X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Kernel%2Farch%2Farmv7%2Fpci.c;fp=Kernel%2Farch%2Farmv7%2Fpci.c;h=2e674bbccf6043772095a85d8a6befe9b0187420;hb=986359336a3d117cddbf33023aefdf585f6500f7;hp=0d25049f8b64453db2eeef646d4724c79da55a56;hpb=95a9132bcc024715a0a87cb323d58967ea5b1803;p=tpg%2Facess2.git diff --git a/Kernel/arch/armv7/pci.c b/Kernel/arch/armv7/pci.c index 0d25049f..2e674bbc 100644 --- a/Kernel/arch/armv7/pci.c +++ b/Kernel/arch/armv7/pci.c @@ -2,6 +2,7 @@ * */ #include +#include // Realview //#define PCI_BASE 0x60000000 @@ -9,40 +10,23 @@ //#define PCI_BASE 0xF0400000 // VMM Mapping #define PCI_BASE 0 -// === PROTOTYPES === -#if 1 -void PCI_CfgWriteDWord(Uint16 bus, Uint16 dev, Uint16 func, Uint16 offset, Uint32 data); -Uint32 PCI_CfgReadDWord(Uint16 bus, Uint16 dev, Uint16 func, Uint16 offset); -Uint16 PCI_CfgReadWord(Uint16 bus, Uint16 dev, Uint16 func, Uint16 offset); -Uint8 PCI_CfgReadByte(Uint16 bus, Uint16 dev, Uint16 func, Uint16 offset); -#endif - // === CODE === -void PCI_CfgWriteDWord(Uint16 bus, Uint16 dev, Uint16 func, Uint16 offset, Uint32 data) +void PCI_CfgWriteDWord(Uint32 Addr, Uint32 Data) { #if PCI_BASE - Uint32 address = PCI_BASE | ((Uint)bus<<16) | ((Uint)dev<<11) | ((Uint)func<<8) | (offset&0xFC); - *(Uint32*)(address) = data; + Uint32 address = PCI_BASE | Addr; + *(Uint32*)(address) = Data; #else #endif } -Uint32 PCI_CfgReadDWord(Uint16 bus, Uint16 dev, Uint16 func, Uint16 offset) +Uint32 PCI_CfgReadDWord(Uint32 Addr) { #if PCI_BASE - Uint32 address = PCI_BASE | ((Uint)bus<<16) | ((Uint)dev<<11) | ((Uint)func<<8) | (offset&0xFC); + Uint32 address = PCI_BASE | Addr; return *(Uint32*)address; #else return 0xFFFFFFFF; #endif } -Uint16 PCI_CfgReadWord(Uint16 bus, Uint16 dev, Uint16 func, Uint16 offset) -{ - return PCI_CfgReadDWord(bus, dev, func, offset & ~3) >> (8*(offset&2)); -} - -Uint8 PCI_CfgReadByte(Uint16 bus, Uint16 dev, Uint16 func, Uint16 offset) -{ - return PCI_CfgReadDWord(bus, dev, func, offset & ~3) >> (8*(offset&3)); -}