3 * arch/x86/pci.h - x86 PCI Bus Access
\r
8 // === PROTOTYPES ===
\r
9 Uint32 PCI_CfgReadDWord(Uint16 bus, Uint16 dev, Uint16 func, Uint16 offset);
\r
10 void PCI_CfgWriteDWord(Uint16 bus, Uint16 dev, Uint16 func, Uint16 offset, Uint32 data);
\r
11 Uint16 PCI_CfgReadWord(Uint16 bus, Uint16 dev, Uint16 func, Uint16 offset);
\r
12 Uint8 PCI_CfgReadByte(Uint16 bus, Uint16 dev, Uint16 func, Uint16 offset);
\r
15 Uint32 PCI_CfgReadDWord(Uint16 bus, Uint16 dev, Uint16 func, Uint16 offset)
\r
20 bus &= 0xFF; // 8 Bits
\r
21 dev &= 0x1F; // 5 Bits
\r
22 func &= 0x7; // 3 Bits
\r
23 offset &= 0xFF; // 8 Bits
\r
25 address = 0x80000000 | ((Uint)bus<<16) | ((Uint)dev<<11) | ((Uint)func<<8) | (offset&0xFC);
\r
26 outd(0xCF8, address);
\r
29 //Debug("PCI(0x%x) = 0x%08x", address, data);
\r
32 void PCI_CfgWriteDWord(Uint16 bus, Uint16 dev, Uint16 func, Uint16 offset, Uint32 data)
\r
36 bus &= 0xFF; // 8 Bits
\r
37 dev &= 0x1F; // 5 Bits
\r
38 func &= 0x7; // 3 Bits
\r
39 offset &= 0xFF; // 8 Bits
\r
41 address = 0x80000000 | ((Uint)bus<<16) | ((Uint)dev<<11) | ((Uint)func<<8) | (offset&0xFC);
\r
42 outd(0xCF8, address);
\r
45 Uint16 PCI_CfgReadWord(Uint16 bus, Uint16 dev, Uint16 func, Uint16 offset)
\r
47 Uint32 data = PCI_CfgReadDWord(bus, dev, func, offset);
\r
49 data >>= (offset&2)*8; // Allow Access to Upper Word
\r
51 return (Uint16)data;
\r
54 Uint8 PCI_CfgReadByte(Uint16 bus, Uint16 dev, Uint16 func, Uint16 offset)
\r
56 Uint32 data = PCI_CfgReadDWord(bus, dev, func, offset);
\r
58 data >>= (offset&3)*8; //Allow Access to Upper Word
\r