5 #define PCITAG struct pci_filter *
9 struct pci_access *pacc;
12 struct pci_filter ltag;
23 for (dev = pacc->devices; dev; dev = dev->next) {
24 pci_fill_info(dev, PCI_FILL_IDENT | PCI_FILL_BASES);
35 PCITAG findPci(unsigned short bx)
39 int bus = (bx >> 8) & 0xFF;
40 int slot = (bx >> 3) & 0x1F;
47 if (pci_get_dev(pacc, 0, bus, slot, func))
53 u32 pciSlotBX(PCITAG tag)
55 return (tag->bus << 8) | (tag->slot << 3) | (tag->func);
58 u8 pciReadByte(PCITAG tag, u32 idx)
61 if ((d = pci_get_dev(pacc, 0, tag->bus, tag->slot, tag->func)))
62 return pci_read_byte(d, idx);
64 printf("PCI: device not found while read byte (%x:%x.%x)\n",
65 tag->bus, tag->slot, tag->func);
70 u16 pciReadWord(PCITAG tag, u32 idx)
73 if ((d = pci_get_dev(pacc, 0, tag->bus, tag->slot, tag->func)))
74 return pci_read_word(d, idx);
76 printf("PCI: device not found while read word (%x:%x.%x)\n",
77 tag->bus, tag->slot, tag->func);
82 u32 pciReadLong(PCITAG tag, u32 idx)
85 if ((d = pci_get_dev(pacc, 0, tag->bus, tag->slot, tag->func)))
86 return pci_read_long(d, idx);
88 printf("PCI: device not found while read long (%x:%x.%x)\n",
89 tag->bus, tag->slot, tag->func);
95 void pciWriteLong(PCITAG tag, u32 idx, u32 data)
98 if ((d = pci_get_dev(pacc, 0, tag->bus, tag->slot, tag->func)))
99 pci_write_long(d, idx, data);
102 printf("PCI: device not found while write long (%x:%x.%x)\n",
103 tag->bus, tag->slot, tag->func);
107 void pciWriteWord(PCITAG tag, u32 idx, u16 data)
110 if ((d = pci_get_dev(pacc, 0, tag->bus, tag->slot, tag->func)))
111 pci_write_word(d, idx, data);
114 printf("PCI: device not found while write word (%x:%x.%x)\n",
115 tag->bus, tag->slot, tag->func);
120 void pciWriteByte(PCITAG tag, u32 idx, u8 data)
123 if ((d = pci_get_dev(pacc, 0, tag->bus, tag->slot, tag->func)))
124 pci_write_long(d, idx, data);
127 printf("PCI: device not found while write long (%x:%x.%x)\n",
128 tag->bus, tag->slot, tag->func);