Kernel - Cleaning up useless message spam
[tpg/acess2.git] / KernelLand / Kernel / drv / pci.c
index 8745080..98acb99 100644 (file)
@@ -10,6 +10,7 @@
 #include <drv_pci.h>\r
 #include <drv_pci_int.h>\r
 \r
+#define USE_PORT_BITMAP        0\r
 #define        LIST_DEVICES    1\r
 \r
 // === STRUCTURES ===\r
@@ -35,7 +36,7 @@ typedef struct sPCIDevice
 char   *PCI_int_ReadDirRoot(tVFS_Node *node, int pos);\r
 tVFS_Node      *PCI_int_FindDirRoot(tVFS_Node *node, const char *filename);\r
 Uint32 PCI_int_GetBusAddr(Uint16 Bus, Uint16 Slot, Uint16 Fcn, Uint8 Offset);\r
-Uint64 PCI_int_ReadDevice(tVFS_Node *node, Uint64 pos, Uint64 length, void *buffer);\r
+size_t PCI_int_ReadDevice(tVFS_Node *node, off_t Offset, size_t Length, void *buffer);\r
  int   PCI_int_EnumDevice(Uint16 bus, Uint16 dev, Uint16 fcn, tPCIDevice *info);\r
 \r
 // === GLOBALS ===\r
@@ -63,7 +64,9 @@ tDevFS_Driver gPCI_DriverStruct = {
        .Type = &gPCI_RootNodeType\r
        }\r
 };\r
+#if USE_PORT_BITMAP\r
 Uint32 *gaPCI_PortBitmap = NULL;\r
+#endif\r
 Uint32 gaPCI_BusBitmap[256/32];\r
  \r
 // === CODE ===\r
@@ -73,9 +76,10 @@ Uint32       gaPCI_BusBitmap[256/32];
  */\r
 int PCI_Install(char **Arguments)\r
 {\r
-        int    i;\r
+        int    ret, bus;\r
        void    *tmpPtr;\r
        \r
+       #if USE_PORT_BITMAP\r
        // Build Portmap\r
        gaPCI_PortBitmap = malloc( 1 << 13 );\r
        if( !gaPCI_PortBitmap ) {\r
@@ -83,14 +87,19 @@ int PCI_Install(char **Arguments)
                return MODULE_ERR_MALLOC;\r
        }\r
        memset( gaPCI_PortBitmap, 0, 1 << 13 );\r
+        int    i;\r
        for( i = 0; i < MAX_RESERVED_PORT / 32; i ++ )\r
                gaPCI_PortBitmap[i] = -1;\r
        for( i = 0; i < MAX_RESERVED_PORT % 32; i ++ )\r
                gaPCI_PortBitmap[MAX_RESERVED_PORT / 32] = 1 << i;\r
-       \r
+       #endif  \r
+\r
        // Scan Bus (Bus 0, Don't fill gPCI_Devices)\r
-       i = PCI_ScanBus(0, 0);\r
-       if(i != MODULE_ERR_OK)  return i;\r
+       for( bus = 0; bus < giPCI_BusCount; bus ++ )\r
+       {\r
+               ret = PCI_ScanBus(bus, 0);\r
+               if(ret != MODULE_ERR_OK)        return ret;\r
+       }\r
                \r
        if(giPCI_DeviceCount == 0) {\r
                Log_Notice("PCI", "No devices were found");\r
@@ -109,10 +118,13 @@ int PCI_Install(char **Arguments)
        \r
        // Reset counts\r
        giPCI_DeviceCount = 0;\r
-       giPCI_BusCount = 0;\r
+       giPCI_BusCount = 1;\r
        memset(gaPCI_BusBitmap, 0, sizeof(gaPCI_BusBitmap));\r
        // Rescan, filling the PCI device array\r
-       PCI_ScanBus(0, 1);\r
+       for( bus = 0; bus < giPCI_BusCount; bus ++ )\r
+       {\r
+               PCI_ScanBus(bus, 1);\r
+       }\r
        \r
        // Complete Driver Structure\r
        gPCI_DriverStruct.RootNode.Size = giPCI_DeviceCount;\r
@@ -235,8 +247,9 @@ tVFS_Node *PCI_int_FindDirRoot(tVFS_Node *node, const char *filename)
 }\r
 \r
 /**\r
+ * \brief Read the PCI configuration space of a device\r
  */\r
-Uint64 PCI_int_ReadDevice(tVFS_Node *node, Uint64 pos, Uint64 length, void *buffer)\r
+size_t PCI_int_ReadDevice(tVFS_Node *node, off_t pos, size_t length, void *buffer)\r
 {      \r
        if( pos + length > 256 )        return 0;\r
        \r

UCC git Repository :: git.ucc.asn.au