return;
}
-static int __devinit cciss_pci_init(ctlr_info_t *c)
+static int __devinit cciss_lookup_board_id(struct pci_dev *pdev, u32 *board_id)
{
- ushort subsystem_vendor_id, subsystem_device_id, command;
- __u32 board_id, scratchpad = 0;
- __u64 cfg_offset;
- __u32 cfg_base_addr;
- __u64 cfg_base_addr_index;
- int i, prod_index, err;
- __u32 trans_offset;
+ int i;
+ u32 subsystem_vendor_id, subsystem_device_id;
- subsystem_vendor_id = c->pdev->subsystem_vendor;
- subsystem_device_id = c->pdev->subsystem_device;
- board_id = (((__u32) (subsystem_device_id << 16) & 0xffff0000) |
- subsystem_vendor_id);
+ subsystem_vendor_id = pdev->subsystem_vendor;
+ subsystem_device_id = pdev->subsystem_device;
+ *board_id = ((subsystem_device_id << 16) & 0xffff0000) |
+ subsystem_vendor_id;
for (i = 0; i < ARRAY_SIZE(products); i++) {
/* Stand aside for hpsa driver on request */
if (cciss_allow_hpsa && products[i].board_id == HPSA_BOUNDARY)
return -ENODEV;
- if (board_id == products[i].board_id)
- break;
+ if (*board_id == products[i].board_id)
+ return i;
}
- prod_index = i;
- if (prod_index == ARRAY_SIZE(products)) {
- dev_warn(&c->pdev->dev,
- "unrecognized board ID: 0x%08lx, ignoring.\n",
- (unsigned long) board_id);
+ dev_warn(&pdev->dev, "unrecognized board ID: 0x%08x, ignoring.\n",
+ *board_id);
+ return -ENODEV;
+}
+
+static int __devinit cciss_pci_init(ctlr_info_t *c)
+{
+ ushort command;
+ __u32 scratchpad = 0;
+ __u64 cfg_offset;
+ __u32 cfg_base_addr;
+ __u64 cfg_base_addr_index;
+ __u32 trans_offset;
+ int i, prod_index, err;
+
+ prod_index = cciss_lookup_board_id(c->pdev, &c->board_id);
+ if (prod_index < 0)
return -ENODEV;
- }
+ c->product_name = products[prod_index].product_name;
+ c->access = *(products[prod_index].access);
/* check to see if controller has been disabled */
/* BEFORE trying to enable it */
#ifdef CCISS_DEBUG
printk(KERN_INFO "command = %x\n", command);
printk(KERN_INFO "irq = %x\n", c->pdev->irq);
- printk(KERN_INFO "board_id = %x\n", board_id);
+ printk(KERN_INFO "board_id = %x\n", c->board_id);
#endif /* CCISS_DEBUG */
/* If the kernel supports MSI/MSI-X we will try to enable that functionality,
* else we use the IO-APIC interrupt assigned to us by system ROM.
*/
- cciss_interrupt_mode(c, board_id);
+ cciss_interrupt_mode(c, c->board_id);
/* find the memory BAR */
for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
c->transtable = remap_pci_mem(pci_resource_start(c->pdev,
cfg_base_addr_index) + cfg_offset+trans_offset,
sizeof(*c->transtable));
- c->board_id = board_id;
-
- #ifdef CCISS_DEBUG
- print_cfg_table(c->cfgtable);
- #endif /* CCISS_DEBUG */
+#ifdef CCISS_DEBUG
+ print_cfg_table(c->cfgtable);
+#endif /* CCISS_DEBUG */
/* Some controllers support Zero Memory Raid (ZMR).
* When configured in ZMR mode the number of supported
c->chainsize = 0; /* traditional */
}
- c->product_name = products[prod_index].product_name;
- c->access = *(products[prod_index].access);
c->nr_cmds = c->max_commands - 4;
if ((readb(&c->cfgtable->Signature[0]) != 'C') ||
(readb(&c->cfgtable->Signature[1]) != 'I') ||
* We've disabled prefetch for some time now. Testing with XEN
* kernels revealed a bug in the refetch if dom0 resides on a P600.
*/
- if(board_id == 0x3225103C) {
- __u32 dma_prefetch;
+ if (c->board_id == 0x3225103C) {
+ __u32 dma_prefetch;
__u32 dma_refetch;
dma_prefetch = readl(c->vaddr + I2O_DMA1_CFG);
dma_prefetch |= 0x8000;