From 54fed38dbc7812cca7816359b3fdde5159dd733d Mon Sep 17 00:00:00 2001 From: emaste Date: Fri, 7 Dec 2007 18:05:41 +0000 Subject: [PATCH] Add family support to allow the driver to attach to new devices that share the same interface. Submitted by: Achim Leubner at Adaptec --- sys/dev/aac/aac.c | 22 +++++++++++++----- sys/dev/aac/aac_pci.c | 28 ++++++++++++++++++----- sys/dev/aac/aacreg.h | 52 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 92 insertions(+), 10 deletions(-) diff --git a/sys/dev/aac/aac.c b/sys/dev/aac/aac.c index cbb5963462d7..27949c846a57 100644 --- a/sys/dev/aac/aac.c +++ b/sys/dev/aac/aac.c @@ -2728,12 +2728,29 @@ aac_describe_controller(struct aac_softc *sc) { struct aac_fib *fib; struct aac_adapter_info *info; + char *adapter_type = "Adaptec RAID controller"; debug_called(2); mtx_lock(&sc->aac_io_lock); aac_alloc_sync_fib(sc, &fib); + if (sc->supported_options & AAC_SUPPORTED_SUPPLEMENT_ADAPTER_INFO) { + fib->data[0] = 0; + if (aac_sync_fib(sc, RequestSupplementAdapterInfo, 0, fib, 1)) + device_printf(sc->aac_dev, + "RequestSupplementAdapterInfo failed\n"); + else + adapter_type = ((struct aac_supplement_adapter_info *) + &fib->data[0])->AdapterTypeText; + } + device_printf(sc->aac_dev, "%s, aac driver %d.%d.%d-%d\n", + adapter_type, + AAC_DRIVER_VERSION >> 24, + (AAC_DRIVER_VERSION >> 16) & 0xFF, + AAC_DRIVER_VERSION & 0xFF, + AAC_DRIVER_BUILD); + fib->data[0] = 0; if (aac_sync_fib(sc, RequestAdapterInfo, 0, fib, 1)) { device_printf(sc->aac_dev, "RequestAdapterInfo failed\n"); @@ -2746,11 +2763,6 @@ aac_describe_controller(struct aac_softc *sc) info = (struct aac_adapter_info *)&fib->data[0]; sc->aac_revision = info->KernelRevision; - device_printf(sc->aac_dev, "Adaptec Raid Controller %d.%d.%d-%d\n", - AAC_DRIVER_VERSION >> 24, - (AAC_DRIVER_VERSION >> 16) & 0xFF, - AAC_DRIVER_VERSION & 0xFF, - AAC_DRIVER_BUILD); if (bootverbose) { device_printf(sc->aac_dev, "%s %dMHz, %dMB memory " diff --git a/sys/dev/aac/aac_pci.c b/sys/dev/aac/aac_pci.c index a16917fc606c..9fdad54f04ec 100644 --- a/sys/dev/aac/aac_pci.c +++ b/sys/dev/aac/aac_pci.c @@ -272,18 +272,36 @@ struct aac_ident "AOC-USAS-S8iR-LP"}, {0, 0, 0, 0, 0, 0, 0} }; +struct aac_ident +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} +}; static struct aac_ident * aac_find_ident(device_t dev) { struct aac_ident *m; + 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); 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); + 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); } return (NULL); diff --git a/sys/dev/aac/aacreg.h b/sys/dev/aac/aacreg.h index dacdead6c5b4..dae21a48b5cf 100644 --- a/sys/dev/aac/aacreg.h +++ b/sys/dev/aac/aacreg.h @@ -604,6 +604,58 @@ struct aac_adapter_info { AAC_OemFlavor OemVariant; } __packed; +/* + * Structure used to respond to a RequestSupplementAdapterInfo fib. + */ +struct vpd_info { + u_int8_t AssemblyPn[8]; + u_int8_t FruPn[8]; + u_int8_t BatteryFruPn[8]; + u_int8_t EcVersionString[8]; + u_int8_t Tsid[12]; +} __packed; + +#define MFG_PCBA_SERIAL_NUMBER_WIDTH 12 +#define MFG_WWN_WIDTH 8 + +struct aac_supplement_adapter_info { + /* The assigned Adapter Type Text, extra byte for null termination */ + int8_t AdapterTypeText[17+1]; + /* Pad for the text above */ + int8_t Pad[2]; + /* Size in bytes of the memory that is flashed */ + u_int32_t FlashMemoryByteSize; + /* The assigned IMAGEID_xxx for this adapter */ + u_int32_t FlashImageId; + /* + * The maximum number of Phys available on a SATA/SAS + * Controller, 0 otherwise + */ + u_int32_t MaxNumberPorts; + /* Version of expansion area */ + u_int32_t Version; + u_int32_t FeatureBits; + u_int8_t SlotNumber; + u_int8_t ReservedPad0[3]; + u_int8_t BuildDate[12]; + /* The current number of Ports on a SAS controller, 0 otherwise */ + u_int32_t CurrentNumberPorts; + + struct vpd_info VpdInfo; + + /* Firmware Revision (Vmaj.min-dash.) */ + struct FsaRevision FlashFirmwareRevision; + u_int32_t RaidTypeMorphOptions; + /* Firmware's boot code Revision (Vmaj.min-dash.) */ + struct FsaRevision FlashFirmwareBootRevision; + /* PCBA serial no. from th MFG sector */ + u_int8_t MfgPcbaSerialNo[MFG_PCBA_SERIAL_NUMBER_WIDTH]; + /* WWN from the MFG sector */ + u_int8_t MfgWWNName[MFG_WWN_WIDTH]; + /* Growth Area for future expansion ((7*4) - 12 - 8)/4 = 2 words */ + u_int32_t ReservedGrowth[2]; +} __packed; + /* * Monitor/Kernel interface. */