X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=KernelLand%2FKernel%2Fdrv%2Fpci.c;h=98acb99a6d495734589a1f0aea98afc4d8f965ad;hb=f61ceab9841c9dabb0b0747c44107da68f75fde8;hp=327d651d8f764277ed28ae8b32132e3e60d25561;hpb=880dd63bfcba522dab0a75cc63fdec1d04ff8c89;p=tpg%2Facess2.git diff --git a/KernelLand/Kernel/drv/pci.c b/KernelLand/Kernel/drv/pci.c index 327d651d..98acb99a 100644 --- a/KernelLand/Kernel/drv/pci.c +++ b/KernelLand/Kernel/drv/pci.c @@ -10,6 +10,7 @@ #include #include +#define USE_PORT_BITMAP 0 #define LIST_DEVICES 1 // === STRUCTURES === @@ -63,7 +64,9 @@ tDevFS_Driver gPCI_DriverStruct = { .Type = &gPCI_RootNodeType } }; +#if USE_PORT_BITMAP Uint32 *gaPCI_PortBitmap = NULL; +#endif Uint32 gaPCI_BusBitmap[256/32]; // === CODE === @@ -73,9 +76,10 @@ Uint32 gaPCI_BusBitmap[256/32]; */ int PCI_Install(char **Arguments) { - int i; + int ret, bus; void *tmpPtr; + #if USE_PORT_BITMAP // Build Portmap gaPCI_PortBitmap = malloc( 1 << 13 ); if( !gaPCI_PortBitmap ) { @@ -83,14 +87,19 @@ int PCI_Install(char **Arguments) return MODULE_ERR_MALLOC; } memset( gaPCI_PortBitmap, 0, 1 << 13 ); + int i; for( i = 0; i < MAX_RESERVED_PORT / 32; i ++ ) gaPCI_PortBitmap[i] = -1; for( i = 0; i < MAX_RESERVED_PORT % 32; i ++ ) gaPCI_PortBitmap[MAX_RESERVED_PORT / 32] = 1 << i; - + #endif + // Scan Bus (Bus 0, Don't fill gPCI_Devices) - i = PCI_ScanBus(0, 0); - if(i != MODULE_ERR_OK) return i; + for( bus = 0; bus < giPCI_BusCount; bus ++ ) + { + ret = PCI_ScanBus(bus, 0); + if(ret != MODULE_ERR_OK) return ret; + } if(giPCI_DeviceCount == 0) { Log_Notice("PCI", "No devices were found"); @@ -109,10 +118,13 @@ int PCI_Install(char **Arguments) // Reset counts giPCI_DeviceCount = 0; - giPCI_BusCount = 0; + giPCI_BusCount = 1; memset(gaPCI_BusBitmap, 0, sizeof(gaPCI_BusBitmap)); // Rescan, filling the PCI device array - PCI_ScanBus(0, 1); + for( bus = 0; bus < giPCI_BusCount; bus ++ ) + { + PCI_ScanBus(bus, 1); + } // Complete Driver Structure gPCI_DriverStruct.RootNode.Size = giPCI_DeviceCount;