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
|
|
|
|
|
|
|
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
|
|
|
|
2001-09-05 20:43:02 +00:00
|
|
|
DEVMETHOD(bus_print_child, bus_generic_print_child),
|
|
|
|
DEVMETHOD(bus_driver_added, bus_generic_driver_added),
|
|
|
|
{ 0, 0 }
|
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;
|
|
|
|
|
2000-09-13 03:20:35 +00:00
|
|
|
DRIVER_MODULE(aac, pci, aac_pci_driver, aac_devclass, 0, 0);
|
2006-12-11 18:28:31 +00:00
|
|
|
MODULE_DEPEND(aac, pci, 1, 1, 1);
|
|
|
|
|
2000-09-13 03:20:35 +00:00
|
|
|
|
|
|
|
struct aac_ident
|
|
|
|
{
|
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;
|
2001-09-05 20:43:02 +00:00
|
|
|
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)"},
|
2004-12-15 07:03:21 +00:00
|
|
|
{0x9005, 0x0286, 0x9005, 0x028c, AAC_HWIF_RKT, 0,
|
|
|
|
"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"},
|
|
|
|
{0x9005, 0x0286, 0x9005, 0x029b, AAC_HWIF_RKT, 0,
|
|
|
|
"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, 0x103c, 0x3227, AAC_HWIF_I960RX, 0,
|
|
|
|
"Adaptec SATA RAID 2610SA"},
|
|
|
|
{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"},
|
|
|
|
{0x9005, 0x0285, 0x9005, 0x0298, AAC_HWIF_I960RX, 0,
|
|
|
|
"Adaptec SAS RAID 4000SAS"},
|
|
|
|
{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"},
|
2006-11-03 04:57:23 +00:00
|
|
|
{0x9005, 0x0286, 0x1014, 0x9580, AAC_HWIF_RKT, 0,
|
|
|
|
"IBM ServeRAID-8k"},
|
2002-04-27 01:31:17 +00:00
|
|
|
{0, 0, 0, 0, 0, 0, 0}
|
2000-09-13 03:20:35 +00:00
|
|
|
};
|
|
|
|
|
2005-11-06 22:52:52 +00:00
|
|
|
static struct aac_ident *
|
|
|
|
aac_find_ident(device_t dev)
|
|
|
|
{
|
|
|
|
struct aac_ident *m;
|
|
|
|
|
|
|
|
for (m = aac_identifiers; m->vendor != 0; m++) {
|
|
|
|
if ((m->vendor == pci_get_vendor(dev)) &&
|
|
|
|
(m->device == pci_get_device(dev)) &&
|
|
|
|
(m->subvendor == pci_get_subvendor(dev)) &&
|
|
|
|
(m->subdevice == pci_get_subdevice(dev)))
|
|
|
|
return (m);
|
|
|
|
}
|
|
|
|
|
|
|
|
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)
|
|
|
|
{
|
2005-11-06 22:52:52 +00:00
|
|
|
struct aac_ident *id;
|
2000-09-13 03:20:35 +00:00
|
|
|
|
2001-09-05 20:43:02 +00:00
|
|
|
debug_called(1);
|
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;
|
2005-11-06 22:52:52 +00:00
|
|
|
struct aac_ident *id;
|
|
|
|
int error;
|
2001-09-05 20:43:02 +00:00
|
|
|
u_int32_t command;
|
2000-09-13 03:20:35 +00:00
|
|
|
|
2001-09-05 20:43:02 +00:00
|
|
|
debug_called(1);
|
2000-09-13 03:20:35 +00:00
|
|
|
|
2001-09-05 20:43:02 +00:00
|
|
|
/*
|
|
|
|
* Initialise softc.
|
|
|
|
*/
|
|
|
|
sc = device_get_softc(dev);
|
|
|
|
bzero(sc, sizeof(*sc));
|
|
|
|
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
|
|
|
|
2001-09-05 20:43:02 +00:00
|
|
|
/*
|
|
|
|
* Verify that the adapter is correctly set up in PCI space.
|
|
|
|
*/
|
|
|
|
command = pci_read_config(sc->aac_dev, PCIR_COMMAND, 2);
|
|
|
|
command |= PCIM_CMD_BUSMASTEREN;
|
|
|
|
pci_write_config(dev, PCIR_COMMAND, command, 2);
|
|
|
|
command = pci_read_config(sc->aac_dev, PCIR_COMMAND, 2);
|
|
|
|
if (!(command & PCIM_CMD_BUSMASTEREN)) {
|
|
|
|
device_printf(sc->aac_dev, "can't enable bus-master feature\n");
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
if ((command & PCIM_CMD_MEMEN) == 0) {
|
|
|
|
device_printf(sc->aac_dev, "memory window not available\n");
|
|
|
|
goto out;
|
|
|
|
}
|
2000-09-13 03:20:35 +00:00
|
|
|
|
2001-09-05 20:43:02 +00:00
|
|
|
/*
|
|
|
|
* Allocate the PCI register window.
|
|
|
|
*/
|
2003-09-09 06:44:58 +00:00
|
|
|
sc->aac_regs_rid = PCIR_BAR(0);
|
2004-03-17 17:50:55 +00:00
|
|
|
if ((sc->aac_regs_resource = bus_alloc_resource_any(sc->aac_dev,
|
|
|
|
SYS_RES_MEMORY,
|
|
|
|
&sc->aac_regs_rid,
|
|
|
|
RF_ACTIVE)) ==
|
|
|
|
NULL) {
|
2001-09-05 20:43:02 +00:00
|
|
|
device_printf(sc->aac_dev,
|
|
|
|
"couldn't allocate register window\n");
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
sc->aac_btag = rman_get_bustag(sc->aac_regs_resource);
|
|
|
|
sc->aac_bhandle = rman_get_bushandle(sc->aac_regs_resource);
|
2000-09-13 03:20:35 +00:00
|
|
|
|
2001-09-05 20:43:02 +00:00
|
|
|
/* assume failure is 'out of memory' */
|
|
|
|
error = ENOMEM;
|
2000-09-13 03:20:35 +00:00
|
|
|
|
2001-09-05 20:43:02 +00:00
|
|
|
/*
|
|
|
|
* Allocate the parent bus DMA tag appropriate for our PCI interface.
|
|
|
|
*
|
|
|
|
* Note that some of these controllers are 64-bit capable.
|
|
|
|
*/
|
|
|
|
if (bus_dma_tag_create(NULL, /* parent */
|
2002-04-24 05:12:50 +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)) {
|
|
|
|
device_printf(sc->aac_dev, "can't allocate parent DMA tag\n");
|
|
|
|
goto out;
|
|
|
|
}
|
2000-09-13 03:20:35 +00:00
|
|
|
|
2001-09-05 20:43:02 +00:00
|
|
|
/*
|
|
|
|
* Detect the hardware interface version, set up the bus interface
|
|
|
|
* indirection.
|
|
|
|
*/
|
2005-11-06 22:52:52 +00:00
|
|
|
id = aac_find_ident(dev);
|
|
|
|
sc->aac_hwif = id->hwif;
|
|
|
|
switch(sc->aac_hwif) {
|
|
|
|
case AAC_HWIF_I960RX:
|
|
|
|
debug(2, "set hardware up for i960Rx");
|
|
|
|
sc->aac_if = aac_rx_interface;
|
|
|
|
break;
|
|
|
|
case AAC_HWIF_STRONGARM:
|
|
|
|
debug(2, "set hardware up for StrongARM");
|
|
|
|
sc->aac_if = aac_sa_interface;
|
|
|
|
break;
|
|
|
|
case AAC_HWIF_FALCON:
|
|
|
|
debug(2, "set hardware up for Falcon/PPC");
|
|
|
|
sc->aac_if = aac_fa_interface;
|
|
|
|
break;
|
|
|
|
case AAC_HWIF_RKT:
|
|
|
|
debug(2, "set hardware up for Rocket/MIPS");
|
|
|
|
sc->aac_if = aac_rkt_interface;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
sc->aac_hwif = AAC_HWIF_UNKNOWN;
|
2001-09-05 20:43:02 +00:00
|
|
|
device_printf(sc->aac_dev, "unknown hardware type\n");
|
|
|
|
error = ENXIO;
|
|
|
|
goto out;
|
2000-09-13 03:20:35 +00:00
|
|
|
}
|
|
|
|
|
2005-11-06 22:52:52 +00:00
|
|
|
/* Set up quirks */
|
|
|
|
sc->flags = id->quirks;
|
2002-02-06 01:34:09 +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),
|
|
|
|
{ 0, 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
struct aacch_softc {
|
|
|
|
device_t dev;
|
|
|
|
};
|
|
|
|
|
|
|
|
static driver_t aacch_driver = {
|
|
|
|
"aacch",
|
|
|
|
aacch_methods,
|
|
|
|
sizeof(struct aacch_softc)
|
|
|
|
};
|
|
|
|
|
|
|
|
static devclass_t aacch_devclass;
|
|
|
|
DRIVER_MODULE(aacch, pci, aacch_driver, aacch_devclass, 0, 0);
|
|
|
|
|
|
|
|
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
|
|
|
|
aacch_attach(device_t dev)
|
|
|
|
{
|
|
|
|
struct aacch_softc *sc;
|
|
|
|
|
|
|
|
sc = device_get_softc(dev);
|
|
|
|
|
|
|
|
sc->dev = dev;
|
|
|
|
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
aacch_detach(device_t dev)
|
|
|
|
{
|
|
|
|
|
|
|
|
return (0);
|
|
|
|
}
|