예제 #1
0
static int __init cpqarray_init_one( struct pci_dev *pdev,
	const struct pci_device_id *ent)
{
	int i;

	printk(KERN_DEBUG "cpqarray: Device 0x%x has been found at"
			" bus %d dev %d func %d\n",
			pdev->device, pdev->bus->number, PCI_SLOT(pdev->devfn),
			PCI_FUNC(pdev->devfn));
	i = alloc_cpqarray_hba();
	if( i < 0 )
		return (-1);
	memset(hba[i], 0, sizeof(ctlr_info_t));
	sprintf(hba[i]->devname, "ida%d", i);
	hba[i]->ctlr = i;
	/* Initialize the pdev driver private data */
	pci_set_drvdata(pdev, hba[i]);

	if (cpqarray_pci_init(hba[i], pdev) != 0) {
		pci_set_drvdata(pdev, NULL);
		release_io_mem(hba[i]);
		free_hba(i);
		return -1;
	}

	return (cpqarray_register_ctlr(i, pdev));
}
예제 #2
0
/*
 * Find the controller and initialize it
 */
static int cpqarray_pci_detect(void)
{
	int index;
	unchar bus=0, dev_fn=0;
	
	for(index=0; ; index++) {
		if (pcibios_find_device(PCI_VENDOR_ID_COMPAQ,
			PCI_DEVICE_ID_COMPAQ_SMART2P, index, &bus, &dev_fn))
			break;

		if (index == 1000000) break;
		if (nr_ctlr == 8) {
			printk("This driver supports a maximum of "
				"8 controllers.\n");
			break;
		}
		
		hba[nr_ctlr] = kmalloc(sizeof(ctlr_info_t), GFP_KERNEL);
		memset(hba[nr_ctlr], 0, sizeof(ctlr_info_t));
		cpqarray_pci_init(hba[nr_ctlr], bus, dev_fn);
		sprintf(hba[nr_ctlr]->devname, "ida%d", nr_ctlr);
		hba[nr_ctlr]->ctlr = nr_ctlr;
		nr_ctlr++;
	}

	return nr_ctlr;
}