X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Modules%2FNetwork%2FNE2000%2Fne2000.c;h=37d9c5a69974c7d2fea74268da430a4663911ebb;hb=4bd32b966938a9f52c22d63cac0b22d6932e585d;hp=eb3673f291ba4375b79323424b37fb5cc36b03a4;hpb=e6795eb552a6be88b7870dae14a958ab391bfae8;p=tpg%2Facess2.git diff --git a/Modules/Network/NE2000/ne2000.c b/Modules/Network/NE2000/ne2000.c index eb3673f2..37d9c5a6 100644 --- a/Modules/Network/NE2000/ne2000.c +++ b/Modules/Network/NE2000/ne2000.c @@ -91,7 +91,7 @@ Uint64 Ne2k_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer); int Ne2k_int_ReadDMA(tCard *Card, int FirstPage, int NumPages, void *Buffer); Uint8 Ne2k_int_GetWritePage(tCard *Card, Uint16 Length); -void Ne2k_IRQHandler(int IntNum); +void Ne2k_IRQHandler(int IntNum, void *Ptr); // === GLOBALS === MODULE_DEFINE(0, VERSION, Ne2k, Ne2k_Install, NULL, NULL); @@ -129,10 +129,7 @@ int Ne2k_Install(char **Options) giNe2k_CardCount += PCI_CountDevices( csaCOMPAT_DEVICES[i].Vendor, csaCOMPAT_DEVICES[i].Device ); } - if( giNe2k_CardCount == 0 ) { - Log_Warning("Ne2k", "No cards detected"); - return MODULE_ERR_NOTNEEDED; - } + if( giNe2k_CardCount == 0 ) return MODULE_ERR_NOTNEEDED; // Enumerate Cards k = 0; @@ -152,7 +149,7 @@ int Ne2k_Install(char **Options) gpNe2k_Cards[ k ].NextRXPage = RX_FIRST; // Install IRQ Handler - IRQ_AddHandler(gpNe2k_Cards[ k ].IRQ, Ne2k_IRQHandler); + IRQ_AddHandler(gpNe2k_Cards[ k ].IRQ, Ne2k_IRQHandler, &gpNe2k_Cards[k]); // Reset Card outb( base + 0x1F, inb(base + 0x1F) ); @@ -506,41 +503,35 @@ Uint8 Ne2k_int_GetWritePage(tCard *Card, Uint16 Length) /** * \fn void Ne2k_IRQHandler(int IntNum) */ -void Ne2k_IRQHandler(int IntNum) +void Ne2k_IRQHandler(int IntNum, void *Ptr) { - int i; Uint8 byte; - for( i = 0; i < giNe2k_CardCount; i++ ) - { - if(gpNe2k_Cards[i].IRQ == IntNum) - { - byte = inb( gpNe2k_Cards[i].IOBase + ISR ); - - LOG("byte = 0x%02x", byte); - + tCard *card = Ptr; + + if(card->IRQ != IntNum) return; + + byte = inb( card->IOBase + ISR ); + + LOG("byte = 0x%02x", byte); - // Reset All (save for RDMA), that's polled - outb( gpNe2k_Cards[i].IOBase + ISR, 0xFF&(~0x40) ); - // 0: Packet recieved (no error) - if( byte & 1 ) - { - //if( gpNe2k_Cards[i].NumWaitingPackets > MAX_PACKET_QUEUE ) - // gpNe2k_Cards[i].NumWaitingPackets = MAX_PACKET_QUEUE; - if( Semaphore_Signal( &gpNe2k_Cards[i].Semaphore, 1 ) != 1 ) { - // Oops? - } - } - // 1: Packet sent (no error) - // 2: Recieved with error - // 3: Transmission Halted (Excessive Collisions) - // 4: Recieve Buffer Exhausted - // 5: - // 6: Remote DMA Complete - // 7: Reset + // Reset All (save for RDMA), that's polled + outb( card->IOBase + ISR, 0xFF&(~0x40) ); - return ; + // 0: Packet recieved (no error) + if( byte & 1 ) + { + //if( card->NumWaitingPackets > MAX_PACKET_QUEUE ) + // card->NumWaitingPackets = MAX_PACKET_QUEUE; + if( Semaphore_Signal( &card->Semaphore, 1 ) != 1 ) { + // Oops? } } - Log_Warning("Ne2k", "Recieved Unknown IRQ %i", IntNum); + // 1: Packet sent (no error) + // 2: Recieved with error + // 3: Transmission Halted (Excessive Collisions) + // 4: Recieve Buffer Exhausted + // 5: + // 6: Remote DMA Complete + // 7: Reset }