/*\r
-AcessOS/AcessBasic v0.1\r
-PCI Bus Driver\r
-*/\r
-#include <common.h>\r
+ * AcessOS/AcessBasic v0.1\r
+ * PCI Bus Driver\r
+ */\r
+#define DEBUG 0\r
+#include <acess.h>\r
+#include <modules.h>\r
#include <vfs.h>\r
#include <fs_devfs.h>\r
#include <drv_pci.h>\r
\r
-#define DEBUG 0\r
#define LIST_DEVICES 1\r
\r
// === STRUCTURES ===\r
NULL, "pci",\r
{\r
.Flags = VFS_FFLAG_DIRECTORY,\r
+ .Size = -1,\r
.NumACLs = 1,\r
.ACLs = &gVFS_ACL_EveryoneRX,\r
.ReadDir = PCI_ReadDirRoot,\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
- //LogF("Done.\n");\r
\r
// Scan Busses\r
for( bus = 0; bus < giPCI_BusCount; bus++ )\r
if(tmpPtr != gPCI_Devices)\r
break;\r
}\r
+ \r
+ if(giPCI_DeviceCount == 0)\r
+ return MODULE_ERR_NOTNEEDED;\r
+ \r
tmpPtr = realloc(gPCI_Devices, giPCI_DeviceCount*sizeof(t_pciDevice));\r
if(tmpPtr == NULL)\r
- return 0;\r
+ return MODULE_ERR_MALLOC;\r
gPCI_Devices = tmpPtr;\r
- //LogF("Done.\n");\r
\r
// Complete Driver Structure \r
gPCI_DriverStruct.RootNode.Size = giPCI_DeviceCount;\r
// And add to DevFS\r
DevFS_AddDevice(&gPCI_DriverStruct);\r
\r
- return 1;\r
+ return MODULE_ERR_OK;\r
}\r
\r
/**\r
- * \fn char *PCI_ReadDirRoot(tVFS_Node *node, int pos)\r
+ * \fn char *PCI_ReadDirRoot(tVFS_Node *Node, int Pos)\r
* \brief Read from Root of PCI Driver\r
*/\r
-char *PCI_ReadDirRoot(tVFS_Node *node, int pos)\r
-{ \r
- if(pos < 0 || pos >= giPCI_DeviceCount)\r
+char *PCI_ReadDirRoot(tVFS_Node *Node, int Pos)\r
+{\r
+ ENTER("pNode iPos", Node, Pos);\r
+ if(Pos < 0 || Pos >= giPCI_DeviceCount) {\r
+ LEAVE('n');\r
return NULL;\r
+ }\r
\r
- return gPCI_Devices[pos].Name;\r
+ LEAVE('s', gPCI_Devices[Pos].Name);\r
+ return strdup( gPCI_Devices[Pos].Name );\r
}\r
/**\r
* \fn tVFS_Node *PCI_FindDirRoot(tVFS_Node *node, char *filename)\r
info->Name[2] = '.';\r
info->Name[3] = '0' + slot/10;\r
info->Name[4] = '0' + slot%10;\r
- info->Name[5] = '.';\r
+ info->Name[5] = ':';\r
info->Name[6] = '0' + fcn;\r
info->Name[7] = '\0';\r
\r
\r
\r
// === EXPORTS ===\r
-/*\r
+//*\r
EXPORT(PCI_CountDevices);\r
EXPORT(PCI_GetDevice);\r
+EXPORT(PCI_GetDeviceByClass);\r
EXPORT(PCI_AssignPort);\r
EXPORT(PCI_GetIRQ);\r
-*/\r
+//*/\r