X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;ds=sidebyside;f=Kernel%2Farch%2Fx86%2Fpci.c;h=7a0a2c112207d7e83003c9af88904b99d66715d2;hb=c5de7b08d4a82908a5acf6454fd7836bdab68715;hp=b5410a3944d2da9f15dc7113ff613b2d8cd62cb6;hpb=df1d534cfe822903fc38e1cc13c4b18941c91908;p=tpg%2Facess2.git diff --git a/Kernel/arch/x86/pci.c b/Kernel/arch/x86/pci.c index b5410a39..7a0a2c11 100644 --- a/Kernel/arch/x86/pci.c +++ b/Kernel/arch/x86/pci.c @@ -4,58 +4,19 @@ */ #define DEBUG 0 #include - -// === PROTOTYPES === -Uint32 PCI_CfgReadDWord(Uint16 bus, Uint16 dev, Uint16 func, Uint16 offset); -void PCI_CfgWriteDWord(Uint16 bus, Uint16 dev, Uint16 func, Uint16 offset, Uint32 data); -Uint16 PCI_CfgReadWord(Uint16 bus, Uint16 dev, Uint16 func, Uint16 offset); -Uint8 PCI_CfgReadByte(Uint16 bus, Uint16 dev, Uint16 func, Uint16 offset); +#include // === CODE === -Uint32 PCI_CfgReadDWord(Uint16 bus, Uint16 dev, Uint16 func, Uint16 offset) -{ - Uint32 address; - Uint32 data; - - bus &= 0xFF; // 8 Bits - dev &= 0x1F; // 5 Bits - func &= 0x7; // 3 Bits - offset &= 0xFF; // 8 Bits - - address = 0x80000000 | ((Uint)bus<<16) | ((Uint)dev<<11) | ((Uint)func<<8) | (offset&0xFC); - outd(0xCF8, address); - - data = ind(0xCFC); - //Debug("PCI(0x%x) = 0x%08x", address, data); - return data; -} -void PCI_CfgWriteDWord(Uint16 bus, Uint16 dev, Uint16 func, Uint16 offset, Uint32 data) +Uint32 PCI_CfgReadDWord(Uint32 Address) { - Uint32 address; - - bus &= 0xFF; // 8 Bits - dev &= 0x1F; // 5 Bits - func &= 0x7; // 3 Bits - offset &= 0xFF; // 8 Bits - - address = 0x80000000 | ((Uint)bus<<16) | ((Uint)dev<<11) | ((Uint)func<<8) | (offset&0xFC); - outd(0xCF8, address); - outd(0xCFC, data); -} -Uint16 PCI_CfgReadWord(Uint16 bus, Uint16 dev, Uint16 func, Uint16 offset) -{ - Uint32 data = PCI_CfgReadDWord(bus, dev, func, offset); - - data >>= (offset&2)*8; // Allow Access to Upper Word - - return (Uint16)data; + Address |= 0x80000000; + outd(0xCF8, Address); + return ind(0xCFC); } -Uint8 PCI_CfgReadByte(Uint16 bus, Uint16 dev, Uint16 func, Uint16 offset) +void PCI_CfgWriteDWord(Uint32 Address, Uint32 Data) { - Uint32 data = PCI_CfgReadDWord(bus, dev, func, offset); - - data >>= (offset&3)*8; //Allow Access to Upper Word - return (Uint8)data; + Address |= 0x80000000; + outd(0xCF8, Address); + outd(0xCFC, Data); } -