unsigned char pci_bus;
unsigned char pci_slot;
unsigned char pci_func;
- resource_size_t io_addr[5];
unsigned int irq;
};
int pci_card_alloc(struct pcilst_struct *amcc, int master);
int i_pci_card_free(struct pcilst_struct *amcc);
-int i_pci_card_data(struct pcilst_struct *amcc,
- resource_size_t *io_addr);
/****************************************************************************/
{
struct pci_dev *pcidev = NULL;
struct pcilst_struct *amcc, *last;
- int i;
int i_Count = 0;
amcc_devices = NULL;
last = NULL;
amcc->pci_bus = pcidev->bus->number;
amcc->pci_slot = PCI_SLOT(pcidev->devfn);
amcc->pci_func = PCI_FUNC(pcidev->devfn);
- /* Note: resources may be invalid if PCI device
- * not enabled, but they are corrected in
- * pci_card_alloc. */
- for (i = 0; i < 5; i++)
- amcc->io_addr[i] =
- pci_resource_start(pcidev, i);
amcc->irq = pcidev->irq;
}
/* mark card as used */
int pci_card_alloc(struct pcilst_struct *amcc, int master)
{
- int i;
-
if (!amcc)
return -1;
return 1;
if (comedi_pci_enable(amcc->pcidev, "addi_amcc_s5933"))
return -1;
- /* Resources will be accurate now. */
- for (i = 0; i < 5; i++)
- amcc->io_addr[i] = pci_resource_start(amcc->pcidev, i);
if (master)
pci_set_master(amcc->pcidev);
amcc->used = 1;
return 0;
}
-/****************************************************************************/
-/* return all card information for driver */
-int i_pci_card_data(struct pcilst_struct *amcc,
- resource_size_t *io_addr)
-{
- int i;
-
- if (!amcc)
- return -1;
- for (i = 0; i < 5; i++)
- io_addr[i] = amcc->io_addr[i];
- return 0;
-}
-
/****************************************************************************/
/* select and alloc card */
struct pcilst_struct *ptr_select_and_alloc_pci_card(unsigned short vendor_id,
struct comedi_subdevice *s;
int ret, pages, i, n_subdevices;
unsigned int dw_Dummy;
- resource_size_t io_addr[5];
resource_size_t iobase_a, iobase_main, iobase_addon, iobase_reserved;
struct pcilst_struct *card = NULL;
int i_Dma = 0;
devpriv->allocated = 1;
- if ((i_pci_card_data(card, &io_addr[0])) < 0) {
- i_pci_card_free(card);
- return -EIO;
- }
-
- iobase_a = io_addr[0];
- iobase_main = io_addr[1];
- iobase_addon = io_addr[2];
- iobase_reserved = io_addr[3];
+ iobase_a = pci_resource_start(card->pcidev, 0);
+ iobase_main = pci_resource_start(card->pcidev, 1);
+ iobase_addon = pci_resource_start(card->pcidev, 2);
+ iobase_reserved = pci_resource_start(card->pcidev, 3);
if ((this_board->pc_EepromChip == NULL)
|| (strcmp(this_board->pc_EepromChip, ADDIDATA_9054) != 0)) {
devpriv->i_IobaseReserved = (int) iobase_reserved;
} else {
dev->board_name = this_board->pc_DriverName;
- dev->iobase = (unsigned long)io_addr[2];
+ dev->iobase = pci_resource_start(card->pcidev, 2);
devpriv->amcc = card;
- devpriv->iobase = (int) io_addr[2];
- devpriv->i_IobaseReserved = (int) io_addr[3];
- devpriv->dw_AiBase = ioremap(io_addr[3],
+ devpriv->iobase = pci_resource_start(card->pcidev, 2);
+ devpriv->i_IobaseReserved = pci_resource_start(card->pcidev, 3);
+ devpriv->dw_AiBase = ioremap(pci_resource_start(card->pcidev, 3),
this_board->i_IorangeBase3);
}
dw_Dummy = inl(devpriv->i_IobaseAmcc + 0x38);
outl(dw_Dummy | 0x2000, devpriv->i_IobaseAmcc + 0x38);
}
- addi_eeprom_read_info(dev, io_addr[0]);
+ addi_eeprom_read_info(dev, pci_resource_start(card->pcidev, 0));
}
if (it->options[2] > 0) {
i_ADDI_AttachPCI1710(dev);
/* save base address */
- devpriv->s_BoardInfos.ui_Address = io_addr[2];
+ devpriv->s_BoardInfos.ui_Address = pci_resource_start(card->pcidev, 2);
#endif
} else {
n_subdevices = 7;