X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Modules%2FNetwork%2FRTL8139%2Frtl8139.c;h=1e9ac899026a47a88248e75e3caef157c1ec494c;hb=bfacdd3b71576cf6ceaa83352d3a7d162adb75e1;hp=a34aeb4a479a3b1bedb2aea5015d555551a0625c;hpb=e957c67ea0f63a668303d087af7ee0c7ecff1f01;p=tpg%2Facess2.git diff --git a/Modules/Network/RTL8139/rtl8139.c b/Modules/Network/RTL8139/rtl8139.c index a34aeb4a..1e9ac899 100644 --- a/Modules/Network/RTL8139/rtl8139.c +++ b/Modules/Network/RTL8139/rtl8139.c @@ -95,21 +95,29 @@ char *RTL8139_ReadDir(tVFS_Node *Node, int Pos); tVFS_Node *RTL8139_FindDir(tVFS_Node *Node, const char *Filename); int RTL8139_RootIOCtl(tVFS_Node *Node, int ID, void *Arg); Uint64 RTL8139_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer); -Uint64 RTL8139_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer); +Uint64 RTL8139_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, const void *Buffer); int RTL8139_IOCtl(tVFS_Node *Node, int ID, void *Arg); void RTL8139_IRQHandler(int Num, void *Ptr); // === GLOBALS === MODULE_DEFINE(0, VERSION, RTL8139, RTL8139_Install, NULL, NULL); +tVFS_NodeType gRTL8139_RootNodeType = { + .ReadDir = RTL8139_ReadDir, + .FindDir = RTL8139_FindDir, + .IOCtl = RTL8139_IOCtl + }; +tVFS_NodeType gRTL8139_DevNodeType = { + .Write = RTL8139_Write, + .Read = RTL8139_Read, + .IOCtl = RTL8139_IOCtl + }; tDevFS_Driver gRTL8139_DriverInfo = { NULL, "RTL8139", { .NumACLs = 1, .ACLs = &gVFS_ACL_EveryoneRX, .Flags = VFS_FFLAG_DIRECTORY, - .ReadDir = RTL8139_ReadDir, - .FindDir = RTL8139_FindDir, - .IOCtl = RTL8139_RootIOCtl + .Type = &gRTL8139_RootNodeType } }; int giRTL8139_CardCount; @@ -127,19 +135,19 @@ int RTL8139_Install(char **Options) tCard *card; giRTL8139_CardCount = PCI_CountDevices(VENDOR_ID, DEVICE_ID); - Log_Debug("RTL8139", "%i cards", giRTL8139_CardCount); if( giRTL8139_CardCount == 0 ) return MODULE_ERR_NOTNEEDED; - + + Log_Debug("RTL8139", "%i cards", giRTL8139_CardCount); gaRTL8139_Cards = calloc( giRTL8139_CardCount, sizeof(tCard) ); - //while( (id = PCI_GetDevice(0x10EC, 0x8139, 0, id)) != -1 ) - while( (id = PCI_GetDevice(VENDOR_ID, DEVICE_ID, i)) != -1 ) + for( i = 0 ; (id = PCI_GetDevice(VENDOR_ID, DEVICE_ID, i)) != -1; i ++ ) { card = &gaRTL8139_Cards[i]; base = PCI_GetBAR( id, 0 ); if( !(base & 1) ) { - Log_Warning("RTL8139", "Driver does not support MMIO, skipping card"); + Log_Warning("RTL8139", "Driver does not support MMIO, skipping card (addr %x)", + base); card->IOBase = 0; card->IRQ = 0; continue ; @@ -206,17 +214,13 @@ int RTL8139_Install(char **Options) card->Node.ImplPtr = card; card->Node.NumACLs = 0; card->Node.CTime = now(); - card->Node.Write = RTL8139_Write; - card->Node.Read = RTL8139_Read; - card->Node.IOCtl = RTL8139_IOCtl; + card->Node.Type = &gRTL8139_DevNodeType; Log_Log("RTL8139", "Card %i 0x%04x, IRQ %i %02x:%02x:%02x:%02x:%02x:%02x", i, card->IOBase, card->IRQ, card->MacAddr[0], card->MacAddr[1], card->MacAddr[2], card->MacAddr[3], card->MacAddr[4], card->MacAddr[5] ); - - i ++; } gRTL8139_DriverInfo.RootNode.Size = giRTL8139_CardCount; @@ -309,7 +313,7 @@ retry: return Length; } -Uint64 RTL8139_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) +Uint64 RTL8139_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, const void *Buffer) { int td; Uint32 status;