2000-09-13 03:20:35 +00:00
|
|
|
/*-
|
2017-11-27 14:52:40 +00:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
|
|
|
*
|
2000-09-13 03:20:35 +00:00
|
|
|
* Copyright (c) 2000 Michael Smith
|
2001-08-03 00:50:30 +00:00
|
|
|
* Copyright (c) 2001 Scott Long
|
2000-09-13 03:20:35 +00:00
|
|
|
* Copyright (c) 2000 BSDi
|
2001-08-05 06:15:00 +00:00
|
|
|
* Copyright (c) 2001 Adaptec, Inc.
|
2000-09-13 03:20:35 +00:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
2003-08-24 17:55:58 +00:00
|
|
|
#include <sys/cdefs.h>
|
|
|
|
__FBSDID("$FreeBSD$");
|
|
|
|
|
2000-09-13 03:20:35 +00:00
|
|
|
/*
|
|
|
|
* PCI bus interface and resource allocation.
|
|
|
|
*/
|
|
|
|
|
2001-08-05 06:20:13 +00:00
|
|
|
#include "opt_aac.h"
|
|
|
|
|
2000-09-13 03:20:35 +00:00
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/systm.h>
|
|
|
|
#include <sys/kernel.h>
|
2004-05-30 20:08:47 +00:00
|
|
|
#include <sys/module.h>
|
2000-09-13 03:20:35 +00:00
|
|
|
|
2003-03-01 05:07:19 +00:00
|
|
|
#include <sys/bio.h>
|
2000-09-13 03:20:35 +00:00
|
|
|
#include <sys/bus.h>
|
|
|
|
#include <sys/conf.h>
|
|
|
|
#include <sys/disk.h>
|
|
|
|
|
|
|
|
#include <machine/bus.h>
|
|
|
|
#include <machine/resource.h>
|
|
|
|
#include <sys/rman.h>
|
|
|
|
|
2003-08-22 05:09:35 +00:00
|
|
|
#include <dev/pci/pcireg.h>
|
|
|
|
#include <dev/pci/pcivar.h>
|
2000-09-13 03:20:35 +00:00
|
|
|
|
|
|
|
#include <dev/aac/aacreg.h>
|
2004-12-09 22:20:25 +00:00
|
|
|
#include <sys/aac_ioctl.h>
|
2000-09-13 03:20:35 +00:00
|
|
|
#include <dev/aac/aacvar.h>
|
|
|
|
|
2001-09-05 20:43:02 +00:00
|
|
|
static int aac_pci_probe(device_t dev);
|
|
|
|
static int aac_pci_attach(device_t dev);
|
2000-09-13 03:20:35 +00:00
|
|
|
|
2013-03-01 19:55:10 +00:00
|
|
|
static int aac_enable_msi = 1;
|
|
|
|
SYSCTL_INT(_hw_aac, OID_AUTO, enable_msi, CTLFLAG_RDTUN, &aac_enable_msi, 0,
|
|
|
|
"Enable MSI interrupts");
|
|
|
|
|
2000-09-13 03:20:35 +00:00
|
|
|
static device_method_t aac_methods[] = {
|
2001-09-05 20:43:02 +00:00
|
|
|
/* Device interface */
|
|
|
|
DEVMETHOD(device_probe, aac_pci_probe),
|
|
|
|
DEVMETHOD(device_attach, aac_pci_attach),
|
|
|
|
DEVMETHOD(device_detach, aac_detach),
|
|
|
|
DEVMETHOD(device_suspend, aac_suspend),
|
|
|
|
DEVMETHOD(device_resume, aac_resume),
|
2000-09-13 03:20:35 +00:00
|
|
|
|
2011-11-22 21:28:20 +00:00
|
|
|
DEVMETHOD_END
|
2000-09-13 03:20:35 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static driver_t aac_pci_driver = {
|
|
|
|
"aac",
|
|
|
|
aac_methods,
|
|
|
|
sizeof(struct aac_softc)
|
|
|
|
};
|
|
|
|
|
2002-01-09 03:32:40 +00:00
|
|
|
static devclass_t aac_devclass;
|
|
|
|
|
2013-03-01 19:55:10 +00:00
|
|
|
DRIVER_MODULE(aac, pci, aac_pci_driver, aac_devclass, NULL, NULL);
|
2006-12-11 18:28:31 +00:00
|
|
|
MODULE_DEPEND(aac, pci, 1, 1, 1);
|
|
|
|
|
2013-03-01 19:55:10 +00:00
|
|
|
static const struct aac_ident
|
2000-09-13 03:20:35 +00:00
|
|
|
{
|
2001-09-05 20:43:02 +00:00
|
|
|
u_int16_t vendor;
|
|
|
|
u_int16_t device;
|
|
|
|
u_int16_t subvendor;
|
|
|
|
u_int16_t subdevice;
|
|
|
|
int hwif;
|
2002-04-27 01:31:17 +00:00
|
|
|
int quirks;
|
2013-03-01 19:55:10 +00:00
|
|
|
const char *desc;
|
2000-09-13 03:20:35 +00:00
|
|
|
} aac_identifiers[] = {
|
2003-03-26 17:50:11 +00:00
|
|
|
{0x1028, 0x0001, 0x1028, 0x0001, AAC_HWIF_I960RX, 0,
|
2002-04-27 01:31:17 +00:00
|
|
|
"Dell PERC 2/Si"},
|
2003-03-26 17:50:11 +00:00
|
|
|
{0x1028, 0x0002, 0x1028, 0x0002, AAC_HWIF_I960RX, 0,
|
2002-04-27 01:31:17 +00:00
|
|
|
"Dell PERC 3/Di"},
|
2003-03-26 17:50:11 +00:00
|
|
|
{0x1028, 0x0003, 0x1028, 0x0003, AAC_HWIF_I960RX, 0,
|
2002-04-27 01:31:17 +00:00
|
|
|
"Dell PERC 3/Si"},
|
2003-03-26 17:50:11 +00:00
|
|
|
{0x1028, 0x0004, 0x1028, 0x00d0, AAC_HWIF_I960RX, 0,
|
2002-04-27 01:31:17 +00:00
|
|
|
"Dell PERC 3/Si"},
|
2003-03-26 17:50:11 +00:00
|
|
|
{0x1028, 0x0002, 0x1028, 0x00d1, AAC_HWIF_I960RX, 0,
|
2002-04-27 01:31:17 +00:00
|
|
|
"Dell PERC 3/Di"},
|
2003-03-26 17:50:11 +00:00
|
|
|
{0x1028, 0x0002, 0x1028, 0x00d9, AAC_HWIF_I960RX, 0,
|
2002-04-27 01:31:17 +00:00
|
|
|
"Dell PERC 3/Di"},
|
2003-03-26 17:50:11 +00:00
|
|
|
{0x1028, 0x000a, 0x1028, 0x0106, AAC_HWIF_I960RX, 0,
|
2002-04-27 01:31:17 +00:00
|
|
|
"Dell PERC 3/Di"},
|
2003-03-26 17:50:11 +00:00
|
|
|
{0x1028, 0x000a, 0x1028, 0x011b, AAC_HWIF_I960RX, 0,
|
2002-04-27 01:31:17 +00:00
|
|
|
"Dell PERC 3/Di"},
|
2003-03-26 17:50:11 +00:00
|
|
|
{0x1028, 0x000a, 0x1028, 0x0121, AAC_HWIF_I960RX, 0,
|
2002-04-27 01:31:17 +00:00
|
|
|
"Dell PERC 3/Di"},
|
2003-03-26 17:50:11 +00:00
|
|
|
{0x1011, 0x0046, 0x9005, 0x0364, AAC_HWIF_STRONGARM, 0,
|
2002-04-27 01:31:17 +00:00
|
|
|
"Adaptec AAC-364"},
|
2003-07-09 19:19:16 +00:00
|
|
|
{0x1011, 0x0046, 0x9005, 0x0365, AAC_HWIF_STRONGARM,
|
|
|
|
AAC_FLAGS_BROKEN_MEMMAP, "Adaptec SCSI RAID 5400S"},
|
2003-03-26 17:50:11 +00:00
|
|
|
{0x1011, 0x0046, 0x9005, 0x1364, AAC_HWIF_STRONGARM, AAC_FLAGS_PERC2QC,
|
|
|
|
"Dell PERC 2/QC"},
|
|
|
|
{0x1011, 0x0046, 0x103c, 0x10c2, AAC_HWIF_STRONGARM, 0,
|
2002-12-12 22:23:06 +00:00
|
|
|
"HP NetRaid-4M"},
|
2003-03-26 17:50:11 +00:00
|
|
|
{0x9005, 0x0285, 0x9005, 0x0285, AAC_HWIF_I960RX, AAC_FLAGS_NO4GB |
|
|
|
|
AAC_FLAGS_256FIBS, "Adaptec SCSI RAID 2200S"},
|
|
|
|
{0x9005, 0x0285, 0x1028, 0x0287, AAC_HWIF_I960RX, AAC_FLAGS_NO4GB |
|
|
|
|
AAC_FLAGS_256FIBS, "Dell PERC 320/DC"},
|
|
|
|
{0x9005, 0x0285, 0x9005, 0x0286, AAC_HWIF_I960RX, AAC_FLAGS_NO4GB |
|
|
|
|
AAC_FLAGS_256FIBS, "Adaptec SCSI RAID 2120S"},
|
2003-05-30 09:22:19 +00:00
|
|
|
{0x9005, 0x0285, 0x9005, 0x0290, AAC_HWIF_I960RX, AAC_FLAGS_NO4GB,
|
2006-06-17 18:42:26 +00:00
|
|
|
"Adaptec SATA RAID 2410SA"},
|
2004-03-20 21:07:36 +00:00
|
|
|
{0x9005, 0x0285, 0x1028, 0x0291, AAC_HWIF_I960RX, AAC_FLAGS_NO4GB,
|
|
|
|
"Dell CERC SATA RAID 2"},
|
|
|
|
{0x9005, 0x0285, 0x9005, 0x0292, AAC_HWIF_I960RX, AAC_FLAGS_NO4GB,
|
2006-06-17 18:42:26 +00:00
|
|
|
"Adaptec SATA RAID 2810SA"},
|
2004-10-21 19:14:32 +00:00
|
|
|
{0x9005, 0x0285, 0x9005, 0x0293, AAC_HWIF_I960RX, AAC_FLAGS_NO4GB,
|
2006-06-17 18:42:26 +00:00
|
|
|
"Adaptec SATA RAID 21610SA"},
|
2005-08-08 19:39:58 +00:00
|
|
|
{0x9005, 0x0285, 0x103c, 0x3227, AAC_HWIF_I960RX, AAC_FLAGS_NO4GB,
|
|
|
|
"HP ML110 G2 (Adaptec 2610SA)"},
|
2013-08-06 18:55:59 +00:00
|
|
|
{0x9005, 0x0286, 0x9005, 0x028c, AAC_HWIF_RKT, AAC_FLAGS_NOMSI,
|
2004-12-15 07:03:21 +00:00
|
|
|
"Adaptec SCSI RAID 2230S"},
|
2004-08-13 01:44:09 +00:00
|
|
|
{0x9005, 0x0286, 0x9005, 0x028d, AAC_HWIF_RKT, 0,
|
|
|
|
"Adaptec SCSI RAID 2130S"},
|
2005-10-08 15:55:09 +00:00
|
|
|
{0x9005, 0x0285, 0x9005, 0x0287, AAC_HWIF_I960RX, AAC_FLAGS_NO4GB |
|
|
|
|
AAC_FLAGS_256FIBS, "Adaptec SCSI RAID 2200S"},
|
|
|
|
{0x9005, 0x0285, 0x17aa, 0x0286, AAC_HWIF_I960RX, AAC_FLAGS_NO4GB |
|
|
|
|
AAC_FLAGS_256FIBS, "Legend S220"},
|
|
|
|
{0x9005, 0x0285, 0x17aa, 0x0287, AAC_HWIF_I960RX, AAC_FLAGS_NO4GB |
|
|
|
|
AAC_FLAGS_256FIBS, "Legend S230"},
|
|
|
|
{0x9005, 0x0285, 0x9005, 0x0288, AAC_HWIF_I960RX, 0,
|
|
|
|
"Adaptec SCSI RAID 3230S"},
|
|
|
|
{0x9005, 0x0285, 0x9005, 0x0289, AAC_HWIF_I960RX, 0,
|
|
|
|
"Adaptec SCSI RAID 3240S"},
|
|
|
|
{0x9005, 0x0285, 0x9005, 0x028a, AAC_HWIF_I960RX, 0,
|
|
|
|
"Adaptec SCSI RAID 2020ZCR"},
|
|
|
|
{0x9005, 0x0285, 0x9005, 0x028b, AAC_HWIF_I960RX, 0,
|
|
|
|
"Adaptec SCSI RAID 2025ZCR"},
|
2013-08-06 18:55:59 +00:00
|
|
|
{0x9005, 0x0286, 0x9005, 0x029b, AAC_HWIF_RKT, AAC_FLAGS_NOMSI,
|
2005-10-08 15:55:09 +00:00
|
|
|
"Adaptec SATA RAID 2820SA"},
|
|
|
|
{0x9005, 0x0286, 0x9005, 0x029c, AAC_HWIF_RKT, 0,
|
|
|
|
"Adaptec SATA RAID 2620SA"},
|
|
|
|
{0x9005, 0x0286, 0x9005, 0x029d, AAC_HWIF_RKT, 0,
|
|
|
|
"Adaptec SATA RAID 2420SA"},
|
|
|
|
{0x9005, 0x0286, 0x9005, 0x029e, AAC_HWIF_RKT, 0,
|
2006-06-17 18:42:26 +00:00
|
|
|
"ICP ICP9024RO SCSI RAID"},
|
2005-10-08 15:55:09 +00:00
|
|
|
{0x9005, 0x0286, 0x9005, 0x029f, AAC_HWIF_RKT, 0,
|
2006-06-17 18:42:26 +00:00
|
|
|
"ICP ICP9014RO SCSI RAID"},
|
2005-10-08 15:55:09 +00:00
|
|
|
{0x9005, 0x0285, 0x9005, 0x0294, AAC_HWIF_I960RX, 0,
|
|
|
|
"Adaptec SATA RAID 2026ZCR"},
|
|
|
|
{0x9005, 0x0285, 0x9005, 0x0296, AAC_HWIF_I960RX, 0,
|
|
|
|
"Adaptec SCSI RAID 2240S"},
|
|
|
|
{0x9005, 0x0285, 0x9005, 0x0297, AAC_HWIF_I960RX, 0,
|
|
|
|
"Adaptec SAS RAID 4005SAS"},
|
|
|
|
{0x9005, 0x0285, 0x1014, 0x02f2, AAC_HWIF_I960RX, 0,
|
|
|
|
"IBM ServeRAID 8i"},
|
2007-10-14 19:40:15 +00:00
|
|
|
{0x9005, 0x0285, 0x1014, 0x0312, AAC_HWIF_I960RX, 0,
|
|
|
|
"IBM ServeRAID 8i"},
|
2005-10-08 15:55:09 +00:00
|
|
|
{0x9005, 0x0285, 0x9005, 0x0298, AAC_HWIF_I960RX, 0,
|
2010-04-13 01:16:15 +00:00
|
|
|
"Adaptec RAID 4000"},
|
2005-10-08 15:55:09 +00:00
|
|
|
{0x9005, 0x0285, 0x9005, 0x0299, AAC_HWIF_I960RX, 0,
|
|
|
|
"Adaptec SAS RAID 4800SAS"},
|
|
|
|
{0x9005, 0x0285, 0x9005, 0x029a, AAC_HWIF_I960RX, 0,
|
|
|
|
"Adaptec SAS RAID 4805SAS"},
|
|
|
|
{0x9005, 0x0285, 0x9005, 0x028e, AAC_HWIF_I960RX, 0,
|
|
|
|
"Adaptec SATA RAID 2020SA ZCR"},
|
|
|
|
{0x9005, 0x0285, 0x9005, 0x028f, AAC_HWIF_I960RX, 0,
|
|
|
|
"Adaptec SATA RAID 2025SA ZCR"},
|
|
|
|
{0x9005, 0x0285, 0x9005, 0x02a4, AAC_HWIF_I960RX, 0,
|
2006-06-17 18:42:26 +00:00
|
|
|
"ICP ICP9085LI SAS RAID"},
|
2005-10-08 15:55:09 +00:00
|
|
|
{0x9005, 0x0285, 0x9005, 0x02a5, AAC_HWIF_I960RX, 0,
|
2006-06-17 18:42:26 +00:00
|
|
|
"ICP ICP5085BR SAS RAID"},
|
2005-10-08 15:55:09 +00:00
|
|
|
{0x9005, 0x0286, 0x9005, 0x02a0, AAC_HWIF_RKT, 0,
|
2006-06-17 18:42:26 +00:00
|
|
|
"ICP ICP9047MA SATA RAID"},
|
2005-10-08 15:55:09 +00:00
|
|
|
{0x9005, 0x0286, 0x9005, 0x02a1, AAC_HWIF_RKT, 0,
|
2006-06-17 18:42:26 +00:00
|
|
|
"ICP ICP9087MA SATA RAID"},
|
2007-10-14 19:40:15 +00:00
|
|
|
{0x9005, 0x0286, 0x9005, 0x02a6, AAC_HWIF_RKT, 0,
|
|
|
|
"ICP9067MA SATA RAID"},
|
|
|
|
{0x9005, 0x0285, 0x9005, 0x02b5, AAC_HWIF_I960RX, 0,
|
|
|
|
"Adaptec RAID 5445"},
|
|
|
|
{0x9005, 0x0285, 0x9005, 0x02b6, AAC_HWIF_I960RX, 0,
|
|
|
|
"Adaptec RAID 5805"},
|
|
|
|
{0x9005, 0x0285, 0x9005, 0x02b7, AAC_HWIF_I960RX, 0,
|
|
|
|
"Adaptec RAID 5085"},
|
|
|
|
{0x9005, 0x0285, 0x9005, 0x02b8, AAC_HWIF_I960RX, 0,
|
|
|
|
"ICP RAID ICP5445SL"},
|
|
|
|
{0x9005, 0x0285, 0x9005, 0x02b9, AAC_HWIF_I960RX, 0,
|
|
|
|
"ICP RAID ICP5085SL"},
|
|
|
|
{0x9005, 0x0285, 0x9005, 0x02ba, AAC_HWIF_I960RX, 0,
|
|
|
|
"ICP RAID ICP5805SL"},
|
2007-08-23 20:12:40 +00:00
|
|
|
{0x9005, 0x0285, 0x9005, 0x02bb, AAC_HWIF_I960RX, 0,
|
|
|
|
"Adaptec RAID 3405"},
|
|
|
|
{0x9005, 0x0285, 0x9005, 0x02bc, AAC_HWIF_I960RX, 0,
|
|
|
|
"Adaptec RAID 3805"},
|
2007-10-14 19:40:15 +00:00
|
|
|
{0x9005, 0x0285, 0x9005, 0x02bd, AAC_HWIF_I960RX, 0,
|
|
|
|
"Adaptec RAID 31205"},
|
|
|
|
{0x9005, 0x0285, 0x9005, 0x02be, AAC_HWIF_I960RX, 0,
|
|
|
|
"Adaptec RAID 31605"},
|
|
|
|
{0x9005, 0x0285, 0x9005, 0x02bf, AAC_HWIF_I960RX, 0,
|
|
|
|
"ICP RAID ICP5045BL"},
|
|
|
|
{0x9005, 0x0285, 0x9005, 0x02c0, AAC_HWIF_I960RX, 0,
|
|
|
|
"ICP RAID ICP5085BL"},
|
|
|
|
{0x9005, 0x0285, 0x9005, 0x02c1, AAC_HWIF_I960RX, 0,
|
|
|
|
"ICP RAID ICP5125BR"},
|
|
|
|
{0x9005, 0x0285, 0x9005, 0x02c2, AAC_HWIF_I960RX, 0,
|
|
|
|
"ICP RAID ICP5165BR"},
|
|
|
|
{0x9005, 0x0285, 0x9005, 0x02c3, AAC_HWIF_I960RX, 0,
|
|
|
|
"Adaptec RAID 51205"},
|
|
|
|
{0x9005, 0x0285, 0x9005, 0x02c4, AAC_HWIF_I960RX, 0,
|
|
|
|
"Adaptec RAID 51605"},
|
|
|
|
{0x9005, 0x0285, 0x9005, 0x02c5, AAC_HWIF_I960RX, 0,
|
|
|
|
"ICP RAID ICP5125SL"},
|
|
|
|
{0x9005, 0x0285, 0x9005, 0x02c6, AAC_HWIF_I960RX, 0,
|
|
|
|
"ICP RAID ICP5165SL"},
|
|
|
|
{0x9005, 0x0285, 0x9005, 0x02c7, AAC_HWIF_I960RX, 0,
|
|
|
|
"Adaptec RAID 3085"},
|
|
|
|
{0x9005, 0x0285, 0x9005, 0x02c8, AAC_HWIF_I960RX, 0,
|
|
|
|
"ICP RAID ICP5805BL"},
|
2007-12-06 18:25:29 +00:00
|
|
|
{0x9005, 0x0285, 0x9005, 0x02ce, AAC_HWIF_I960RX, 0,
|
|
|
|
"Adaptec RAID 51245"},
|
|
|
|
{0x9005, 0x0285, 0x9005, 0x02cf, AAC_HWIF_I960RX, 0,
|
|
|
|
"Adaptec RAID 51645"},
|
|
|
|
{0x9005, 0x0285, 0x9005, 0x02d0, AAC_HWIF_I960RX, 0,
|
|
|
|
"Adaptec RAID 52445"},
|
|
|
|
{0x9005, 0x0285, 0x9005, 0x02d1, AAC_HWIF_I960RX, 0,
|
2008-09-12 18:15:12 +00:00
|
|
|
"Adaptec RAID 5405"},
|
2008-06-27 19:34:47 +00:00
|
|
|
{0x9005, 0x0285, 0x9005, 0x02d4, AAC_HWIF_I960RX, 0,
|
2008-09-12 18:15:12 +00:00
|
|
|
"Adaptec RAID 2045"},
|
2008-06-27 19:34:47 +00:00
|
|
|
{0x9005, 0x0285, 0x9005, 0x02d5, AAC_HWIF_I960RX, 0,
|
2008-09-12 18:15:12 +00:00
|
|
|
"Adaptec RAID 2405"},
|
2008-06-27 19:34:47 +00:00
|
|
|
{0x9005, 0x0285, 0x9005, 0x02d6, AAC_HWIF_I960RX, 0,
|
2008-09-12 18:15:12 +00:00
|
|
|
"Adaptec RAID 2445"},
|
2008-06-27 19:34:47 +00:00
|
|
|
{0x9005, 0x0285, 0x9005, 0x02d7, AAC_HWIF_I960RX, 0,
|
2008-09-12 18:15:12 +00:00
|
|
|
"Adaptec RAID 2805"},
|
2006-11-03 04:57:23 +00:00
|
|
|
{0x9005, 0x0286, 0x1014, 0x9580, AAC_HWIF_RKT, 0,
|
|
|
|
"IBM ServeRAID-8k"},
|
2007-10-14 19:40:15 +00:00
|
|
|
{0x9005, 0x0285, 0x1014, 0x034d, AAC_HWIF_I960RX, 0,
|
|
|
|
"IBM ServeRAID 8s"},
|
2007-12-06 18:25:29 +00:00
|
|
|
{0x9005, 0x0285, 0x108e, 0x7aac, AAC_HWIF_I960RX, 0,
|
|
|
|
"Sun STK RAID REM"},
|
|
|
|
{0x9005, 0x0285, 0x108e, 0x7aae, AAC_HWIF_I960RX, 0,
|
|
|
|
"Sun STK RAID EM"},
|
|
|
|
{0x9005, 0x0285, 0x108e, 0x286, AAC_HWIF_I960RX, 0,
|
|
|
|
"SG-XPCIESAS-R-IN"},
|
|
|
|
{0x9005, 0x0285, 0x108e, 0x287, AAC_HWIF_I960RX, 0,
|
|
|
|
"SG-XPCIESAS-R-EX"},
|
2007-12-06 02:10:07 +00:00
|
|
|
{0x9005, 0x0285, 0x15d9, 0x2b5, AAC_HWIF_I960RX, 0,
|
|
|
|
"AOC-USAS-S4i"},
|
|
|
|
{0x9005, 0x0285, 0x15d9, 0x2b6, AAC_HWIF_I960RX, 0,
|
|
|
|
"AOC-USAS-S8i"},
|
|
|
|
{0x9005, 0x0285, 0x15d9, 0x2c9, AAC_HWIF_I960RX, 0,
|
|
|
|
"AOC-USAS-S4iR"},
|
|
|
|
{0x9005, 0x0285, 0x15d9, 0x2ca, AAC_HWIF_I960RX, 0,
|
|
|
|
"AOC-USAS-S8iR"},
|
|
|
|
{0x9005, 0x0285, 0x15d9, 0x2d2, AAC_HWIF_I960RX, 0,
|
|
|
|
"AOC-USAS-S8i-LP"},
|
|
|
|
{0x9005, 0x0285, 0x15d9, 0x2d3, AAC_HWIF_I960RX, 0,
|
|
|
|
"AOC-USAS-S8iR-LP"},
|
2002-04-27 01:31:17 +00:00
|
|
|
{0, 0, 0, 0, 0, 0, 0}
|
2000-09-13 03:20:35 +00:00
|
|
|
};
|
2013-03-01 19:55:10 +00:00
|
|
|
|
|
|
|
static const struct aac_ident
|
2007-12-07 18:05:41 +00:00
|
|
|
aac_family_identifiers[] = {
|
|
|
|
{0x9005, 0x0285, 0, 0, AAC_HWIF_I960RX, 0,
|
|
|
|
"Adaptec RAID Controller"},
|
|
|
|
{0x9005, 0x0286, 0, 0, AAC_HWIF_RKT, 0,
|
|
|
|
"Adaptec RAID Controller"},
|
|
|
|
{0, 0, 0, 0, 0, 0, 0}
|
|
|
|
};
|
2000-09-13 03:20:35 +00:00
|
|
|
|
2013-03-01 19:55:10 +00:00
|
|
|
static const struct aac_ident *
|
2005-11-06 22:52:52 +00:00
|
|
|
aac_find_ident(device_t dev)
|
|
|
|
{
|
2013-03-01 19:55:10 +00:00
|
|
|
const struct aac_ident *m;
|
2007-12-07 18:05:41 +00:00
|
|
|
u_int16_t vendid, devid, sub_vendid, sub_devid;
|
|
|
|
|
|
|
|
vendid = pci_get_vendor(dev);
|
|
|
|
devid = pci_get_device(dev);
|
|
|
|
sub_vendid = pci_get_subvendor(dev);
|
|
|
|
sub_devid = pci_get_subdevice(dev);
|
2005-11-06 22:52:52 +00:00
|
|
|
|
|
|
|
for (m = aac_identifiers; m->vendor != 0; m++) {
|
2007-12-07 18:05:41 +00:00
|
|
|
if ((m->vendor == vendid) && (m->device == devid) &&
|
|
|
|
(m->subvendor == sub_vendid) &&
|
|
|
|
(m->subdevice == sub_devid))
|
|
|
|
return (m);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (m = aac_family_identifiers; m->vendor != 0; m++) {
|
|
|
|
if ((m->vendor == vendid) && (m->device == devid))
|
|
|
|
return (m);
|
2005-11-06 22:52:52 +00:00
|
|
|
}
|
|
|
|
return (NULL);
|
|
|
|
}
|
|
|
|
|
2001-09-05 20:43:02 +00:00
|
|
|
/*
|
2000-09-13 03:20:35 +00:00
|
|
|
* Determine whether this is one of our supported adapters.
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
aac_pci_probe(device_t dev)
|
|
|
|
{
|
2013-03-01 19:55:10 +00:00
|
|
|
const struct aac_ident *id;
|
2000-09-13 03:20:35 +00:00
|
|
|
|
2008-03-24 19:23:33 +00:00
|
|
|
fwprintf(NULL, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
|
2000-09-13 03:20:35 +00:00
|
|
|
|
2005-11-06 22:52:52 +00:00
|
|
|
if ((id = aac_find_ident(dev)) != NULL) {
|
|
|
|
device_set_desc(dev, id->desc);
|
|
|
|
return(BUS_PROBE_DEFAULT);
|
2000-09-13 03:20:35 +00:00
|
|
|
}
|
2001-09-05 20:43:02 +00:00
|
|
|
return(ENXIO);
|
2000-09-13 03:20:35 +00:00
|
|
|
}
|
|
|
|
|
2001-09-05 20:43:02 +00:00
|
|
|
/*
|
2000-09-13 03:20:35 +00:00
|
|
|
* Allocate resources for our device, set up the bus interface.
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
aac_pci_attach(device_t dev)
|
|
|
|
{
|
2001-09-05 20:43:02 +00:00
|
|
|
struct aac_softc *sc;
|
2013-03-01 19:55:10 +00:00
|
|
|
const struct aac_ident *id;
|
2013-08-06 18:55:59 +00:00
|
|
|
int count, error, rid;
|
2000-09-13 03:20:35 +00:00
|
|
|
|
2008-03-24 19:23:33 +00:00
|
|
|
fwprintf(NULL, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
|
2000-09-13 03:20:35 +00:00
|
|
|
|
2001-09-05 20:43:02 +00:00
|
|
|
/*
|
|
|
|
* Initialise softc.
|
|
|
|
*/
|
|
|
|
sc = device_get_softc(dev);
|
|
|
|
sc->aac_dev = dev;
|
2000-09-13 03:20:35 +00:00
|
|
|
|
2001-09-05 20:43:02 +00:00
|
|
|
/* assume failure is 'not configured' */
|
|
|
|
error = ENXIO;
|
2000-09-13 03:20:35 +00:00
|
|
|
|
2010-04-13 00:33:07 +00:00
|
|
|
/*
|
2001-09-05 20:43:02 +00:00
|
|
|
* Verify that the adapter is correctly set up in PCI space.
|
|
|
|
*/
|
2013-03-01 19:55:10 +00:00
|
|
|
pci_enable_busmaster(dev);
|
|
|
|
if (!(pci_read_config(dev, PCIR_COMMAND, 2) & PCIM_CMD_BUSMASTEREN)) {
|
|
|
|
device_printf(dev, "can't enable bus-master feature\n");
|
2001-09-05 20:43:02 +00:00
|
|
|
goto out;
|
|
|
|
}
|
2000-09-13 03:20:35 +00:00
|
|
|
|
2013-08-06 18:55:59 +00:00
|
|
|
/*
|
|
|
|
* Detect the hardware interface version, set up the bus interface
|
|
|
|
* indirection.
|
|
|
|
*/
|
|
|
|
id = aac_find_ident(dev);
|
|
|
|
sc->aac_hwif = id->hwif;
|
|
|
|
switch(sc->aac_hwif) {
|
|
|
|
case AAC_HWIF_I960RX:
|
|
|
|
case AAC_HWIF_NARK:
|
|
|
|
fwprintf(sc, HBA_FLAGS_DBG_INIT_B,
|
|
|
|
"set hardware up for i960Rx/NARK");
|
|
|
|
sc->aac_if = &aac_rx_interface;
|
|
|
|
break;
|
|
|
|
case AAC_HWIF_STRONGARM:
|
|
|
|
fwprintf(sc, HBA_FLAGS_DBG_INIT_B,
|
|
|
|
"set hardware up for StrongARM");
|
|
|
|
sc->aac_if = &aac_sa_interface;
|
|
|
|
break;
|
|
|
|
case AAC_HWIF_RKT:
|
|
|
|
fwprintf(sc, HBA_FLAGS_DBG_INIT_B,
|
|
|
|
"set hardware up for Rocket/MIPS");
|
|
|
|
sc->aac_if = &aac_rkt_interface;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
sc->aac_hwif = AAC_HWIF_UNKNOWN;
|
|
|
|
device_printf(dev, "unknown hardware type\n");
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Set up quirks */
|
|
|
|
sc->flags = id->quirks;
|
|
|
|
|
2001-09-05 20:43:02 +00:00
|
|
|
/*
|
2013-03-01 19:55:10 +00:00
|
|
|
* Allocate the PCI register window(s).
|
2001-09-05 20:43:02 +00:00
|
|
|
*/
|
2013-03-01 19:55:10 +00:00
|
|
|
rid = PCIR_BAR(0);
|
|
|
|
if ((sc->aac_regs_res0 = bus_alloc_resource_any(dev,
|
|
|
|
SYS_RES_MEMORY, &rid, RF_ACTIVE)) == NULL) {
|
|
|
|
device_printf(dev, "can't allocate register window 0\n");
|
2001-09-05 20:43:02 +00:00
|
|
|
goto out;
|
|
|
|
}
|
2009-02-21 15:40:03 +00:00
|
|
|
sc->aac_btag0 = rman_get_bustag(sc->aac_regs_res0);
|
|
|
|
sc->aac_bhandle0 = rman_get_bushandle(sc->aac_regs_res0);
|
|
|
|
|
|
|
|
if (sc->aac_hwif == AAC_HWIF_NARK) {
|
2013-03-01 19:55:10 +00:00
|
|
|
rid = PCIR_BAR(1);
|
|
|
|
if ((sc->aac_regs_res1 = bus_alloc_resource_any(dev,
|
|
|
|
SYS_RES_MEMORY, &rid, RF_ACTIVE)) == NULL) {
|
|
|
|
device_printf(dev,
|
|
|
|
"can't allocate register window 1\n");
|
2009-02-21 15:40:03 +00:00
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
sc->aac_btag1 = rman_get_bustag(sc->aac_regs_res1);
|
|
|
|
sc->aac_bhandle1 = rman_get_bushandle(sc->aac_regs_res1);
|
|
|
|
} else {
|
|
|
|
sc->aac_regs_res1 = sc->aac_regs_res0;
|
|
|
|
sc->aac_btag1 = sc->aac_btag0;
|
|
|
|
sc->aac_bhandle1 = sc->aac_bhandle0;
|
|
|
|
}
|
2000-09-13 03:20:35 +00:00
|
|
|
|
2013-03-01 19:55:10 +00:00
|
|
|
/*
|
|
|
|
* Allocate the interrupt.
|
|
|
|
*/
|
|
|
|
rid = 0;
|
2013-08-06 19:14:02 +00:00
|
|
|
if (aac_enable_msi != 0 && (sc->flags & AAC_FLAGS_NOMSI) == 0) {
|
|
|
|
count = 1;
|
|
|
|
if (pci_alloc_msi(dev, &count) == 0)
|
2013-03-01 19:55:10 +00:00
|
|
|
rid = 1;
|
|
|
|
}
|
|
|
|
if ((sc->aac_irq = bus_alloc_resource_any(sc->aac_dev, SYS_RES_IRQ,
|
2013-08-06 19:14:02 +00:00
|
|
|
&rid, RF_ACTIVE | (rid != 0 ? 0 : RF_SHAREABLE))) == NULL) {
|
2013-03-01 19:55:10 +00:00
|
|
|
device_printf(dev, "can't allocate interrupt\n");
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
2001-09-05 20:43:02 +00:00
|
|
|
/*
|
|
|
|
* Allocate the parent bus DMA tag appropriate for our PCI interface.
|
2010-04-13 00:33:07 +00:00
|
|
|
*
|
2001-09-05 20:43:02 +00:00
|
|
|
* Note that some of these controllers are 64-bit capable.
|
|
|
|
*/
|
2013-03-01 19:55:10 +00:00
|
|
|
if (bus_dma_tag_create(bus_get_dma_tag(dev), /* parent */
|
2012-02-28 19:50:14 +00:00
|
|
|
PAGE_SIZE, 0, /* algnmnt, boundary */
|
2003-03-26 17:50:11 +00:00
|
|
|
BUS_SPACE_MAXADDR, /* lowaddr */
|
2001-09-05 20:43:02 +00:00
|
|
|
BUS_SPACE_MAXADDR, /* highaddr */
|
|
|
|
NULL, NULL, /* filter, filterarg */
|
2003-03-26 17:50:11 +00:00
|
|
|
BUS_SPACE_MAXSIZE_32BIT, /* maxsize */
|
2005-10-08 15:55:09 +00:00
|
|
|
BUS_SPACE_UNRESTRICTED, /* nsegments */
|
2001-09-05 20:43:02 +00:00
|
|
|
BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */
|
2003-03-26 17:50:11 +00:00
|
|
|
0, /* flags */
|
2003-07-01 15:52:06 +00:00
|
|
|
NULL, NULL, /* No locking needed */
|
2001-09-05 20:43:02 +00:00
|
|
|
&sc->aac_parent_dmat)) {
|
2013-03-01 19:55:10 +00:00
|
|
|
device_printf(dev, "can't allocate parent DMA tag\n");
|
2001-09-05 20:43:02 +00:00
|
|
|
goto out;
|
|
|
|
}
|
2000-09-13 03:20:35 +00:00
|
|
|
|
2001-09-05 20:43:02 +00:00
|
|
|
/*
|
|
|
|
* Do bus-independent initialisation.
|
|
|
|
*/
|
|
|
|
error = aac_attach(sc);
|
2005-10-08 15:55:09 +00:00
|
|
|
|
2000-09-13 03:20:35 +00:00
|
|
|
out:
|
2001-09-05 20:43:02 +00:00
|
|
|
if (error)
|
|
|
|
aac_free(sc);
|
|
|
|
return(error);
|
2000-09-13 03:20:35 +00:00
|
|
|
}
|
2005-01-07 05:59:45 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Do nothing driver that will attach to the SCSI channels of a Dell PERC
|
|
|
|
* controller. This is needed to keep the power management subsystem from
|
|
|
|
* trying to power down these devices.
|
|
|
|
*/
|
|
|
|
static int aacch_probe(device_t dev);
|
|
|
|
static int aacch_attach(device_t dev);
|
|
|
|
static int aacch_detach(device_t dev);
|
|
|
|
|
|
|
|
static device_method_t aacch_methods[] = {
|
|
|
|
/* Device interface */
|
|
|
|
DEVMETHOD(device_probe, aacch_probe),
|
|
|
|
DEVMETHOD(device_attach, aacch_attach),
|
|
|
|
DEVMETHOD(device_detach, aacch_detach),
|
2013-03-01 19:55:10 +00:00
|
|
|
DEVMETHOD_END
|
2005-01-07 05:59:45 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static driver_t aacch_driver = {
|
|
|
|
"aacch",
|
|
|
|
aacch_methods,
|
2013-08-06 19:14:02 +00:00
|
|
|
1 /* no softc */
|
2005-01-07 05:59:45 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static devclass_t aacch_devclass;
|
2013-03-01 19:55:10 +00:00
|
|
|
DRIVER_MODULE(aacch, pci, aacch_driver, aacch_devclass, NULL, NULL);
|
2018-06-01 19:42:59 +00:00
|
|
|
MODULE_PNP_INFO("U16:vendor;U16:device;", pci, aac,
|
Reapply, with minor tweaks, r338025, from the original commit:
Remove unused and easy to misuse PNP macro parameter
Inspired by r338025, just remove the element size parameter to the
MODULE_PNP_INFO macro entirely. The 'table' parameter is now required to
have correct pointer (or array) type. Since all invocations of the macro
already had this property and the emitted PNP data continues to include the
element size, there is no functional change.
Mostly done with the coccinelle 'spatch' tool:
$ cat modpnpsize0.cocci
@normaltables@
identifier b,c;
expression a,d,e;
declarer MODULE_PNP_INFO;
@@
MODULE_PNP_INFO(a,b,c,d,
-sizeof(d[0]),
e);
@singletons@
identifier b,c,d;
expression a;
declarer MODULE_PNP_INFO;
@@
MODULE_PNP_INFO(a,b,c,&d,
-sizeof(d),
1);
$ rg -l MODULE_PNP_INFO -- sys | \
xargs spatch --in-place --sp-file modpnpsize0.cocci
(Note that coccinelle invokes diff(1) via a PATH search and expects diff to
tolerate the -B flag, which BSD diff does not. So I had to link gdiff into
PATH as diff to use spatch.)
Tinderbox'd (-DMAKE_JUST_KERNELS).
Approved by: re (glen)
2018-09-26 17:12:14 +00:00
|
|
|
aac_identifiers, nitems(aac_identifiers) - 1);
|
2005-01-07 05:59:45 +00:00
|
|
|
|
|
|
|
static int
|
|
|
|
aacch_probe(device_t dev)
|
|
|
|
{
|
|
|
|
|
2005-07-14 17:43:00 +00:00
|
|
|
if ((pci_get_vendor(dev) != 0x9005) ||
|
|
|
|
(pci_get_device(dev) != 0x00c5))
|
2005-01-07 05:59:45 +00:00
|
|
|
return (ENXIO);
|
|
|
|
|
|
|
|
device_set_desc(dev, "AAC RAID Channel");
|
|
|
|
return (-10);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2013-08-06 19:14:02 +00:00
|
|
|
aacch_attach(device_t dev __unused)
|
2005-01-07 05:59:45 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2013-08-06 19:14:02 +00:00
|
|
|
aacch_detach(device_t dev __unused)
|
2005-01-07 05:59:45 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
return (0);
|
|
|
|
}
|