277,9 → 277,11 |
last_tx dd ? |
|
rb 0x100 - ($ and 0xff) ; align 256 |
|
rx_desc rb RX_RING_SIZE*sizeof.RDESC*2 |
|
rb 0x100 - ($ and 0xff) ; align 256 |
|
tx_desc rb TX_RING_SIZE*sizeof.TDESC*2 |
|
ends |
414,8 → 416,6 |
inc [devices] ; |
|
call start_i8254x |
test eax, eax |
jnz .destroy |
|
mov [ebx + device.type], NET_TYPE_ETH |
invoke NetRegDev |
443,7 → 443,6 |
invoke KernelFree, ebx |
|
.fail: |
DEBUGF 2,"Loading driver failed\n" |
or eax, -1 |
ret |
|
460,9 → 459,6 |
|
align 4 |
unload: |
|
DEBUGF 1,"Unload\n" |
|
; TODO: (in this particular order) |
; |
; - Stop the device |
544,12 → 540,9 |
stosd |
|
call init_rx |
test eax, eax |
jnz .fail |
call init_tx |
|
xor eax, eax |
.fail: |
ret |
|
|
560,10 → 553,9 |
lea edi, [ebx + device.rx_desc] |
mov ecx, RX_RING_SIZE |
.loop: |
push ecx edi |
push ecx |
push edi |
invoke KernelAlloc, MAX_PKT_SIZE |
test eax, eax |
jz .out_of_mem |
DEBUGF 1,"RX buffer: 0x%x\n", eax |
pop edi |
mov dword[edi + RX_RING_SIZE*sizeof.RDESC], eax |
590,13 → 582,7 |
mov dword[esi + REG_RDT], RX_RING_SIZE-1 ; Receive Descriptor Tail |
mov dword[esi + REG_RCTL], RCTL_SBP or RCTL_BAM or RCTL_SECRC or RCTL_UPE or RCTL_MPE |
; Store Bad Packets, Broadcast Accept Mode, Strip Ethernet CRC from incoming packet, Promiscuous mode |
xor eax, eax ; success! |
ret |
|
.out_of_mem: |
DEBUGF 2,"Out of memory!\n" |
pop edi ecx |
or eax, -1 ; error! |
ret |
|
|
634,12 → 620,7 |
align 4 |
reset: |
call reset_dontstart |
test eax, eax |
je start_i8254x |
|
ret |
|
align 4 |
start_i8254x: |
|
mov esi, [ebx + device.mmio_addr] |
845,8 → 826,6 |
push esi |
invoke KernelAlloc, MAX_PKT_SIZE |
pop esi |
test eax, eax |
jz .out_of_mem |
mov dword[esi + RX_RING_SIZE*sizeof.RDESC], eax |
invoke GetPhysAddr |
mov [esi + RDESC.addr_l], eax |
863,15 → 842,6 |
and [ebx + device.cur_rx], RX_RING_SIZE-1 |
|
jmp [Eth_input] |
|
.out_of_mem: |
DEBUGF 2,"Out of memory!\n" |
|
; Move to next rx desc |
inc [ebx + device.cur_rx] |
and [ebx + device.cur_rx], RX_RING_SIZE-1 |
|
jmp [Eth_input] |
.no_rx: |
|
;-------------- |