Commit 1da2f358 authored by Brian King's avatar Brian King Committed by James Bottomley

[PATCH] ipr: Support dynamic IDs

Fixes ipr to handle dynamic pci ids by searching for the adapter
chipset in the probe routine if driver_data is NULL.
Signed-off-by: default avatarBrian King <brking@us.ibm.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent b4982c68
......@@ -125,6 +125,13 @@ static const struct ipr_chip_cfg_t ipr_chip_cfg[] = {
},
};
static const struct ipr_chip_t ipr_chip[] = {
{ PCI_VENDOR_ID_MYLEX, PCI_DEVICE_ID_IBM_GEMSTONE, &ipr_chip_cfg[0] },
{ PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_CITRINE, &ipr_chip_cfg[0] },
{ PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_SNIPE, &ipr_chip_cfg[1] },
{ PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_SCAMP, &ipr_chip_cfg[1] }
};
static int ipr_max_bus_speeds [] = {
IPR_80MBs_SCSI_RATE, IPR_U160_SCSI_RATE, IPR_U320_SCSI_RATE
};
......@@ -5666,6 +5673,28 @@ static void __devinit ipr_init_ioa_cfg(struct ipr_ioa_cfg *ioa_cfg,
t->clr_uproc_interrupt_reg = base + p->clr_uproc_interrupt_reg;
}
/**
* ipr_get_chip_cfg - Find adapter chip configuration
* @dev_id: PCI device id struct
*
* Return value:
* ptr to chip config on success / NULL on failure
**/
static const struct ipr_chip_cfg_t * __devinit
ipr_get_chip_cfg(const struct pci_device_id *dev_id)
{
int i;
if (dev_id->driver_data)
return (const struct ipr_chip_cfg_t *)dev_id->driver_data;
for (i = 0; i < ARRAY_SIZE(ipr_chip); i++)
if (ipr_chip[i].vendor == dev_id->vendor &&
ipr_chip[i].device == dev_id->device)
return ipr_chip[i].cfg;
return NULL;
}
/**
* ipr_probe_ioa - Allocates memory and does first stage of initialization
* @pdev: PCI device struct
......@@ -5703,7 +5732,13 @@ static int __devinit ipr_probe_ioa(struct pci_dev *pdev,
ioa_cfg = (struct ipr_ioa_cfg *)host->hostdata;
memset(ioa_cfg, 0, sizeof(struct ipr_ioa_cfg));
ioa_cfg->chip_cfg = (const struct ipr_chip_cfg_t *)dev_id->driver_data;
ioa_cfg->chip_cfg = ipr_get_chip_cfg(dev_id);
if (!ioa_cfg->chip_cfg) {
dev_err(&pdev->dev, "Unknown adapter chipset 0x%04X 0x%04X\n",
dev_id->vendor, dev_id->device);
goto out_scsi_host_put;
}
ipr_regs_pci = pci_resource_start(pdev, 0);
......
......@@ -782,6 +782,12 @@ struct ipr_chip_cfg_t {
struct ipr_interrupt_offsets regs;
};
struct ipr_chip_t {
u16 vendor;
u16 device;
const struct ipr_chip_cfg_t *cfg;
};
enum ipr_shutdown_type {
IPR_SHUTDOWN_NORMAL = 0x00,
IPR_SHUTDOWN_PREPARE_FOR_NORMAL = 0x40,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment