diff --git a/api/libBareMetal.asm b/api/libBareMetal.asm index c939477..d1ac5ba 100644 --- a/api/libBareMetal.asm +++ b/api/libBareMetal.asm @@ -7,13 +7,13 @@ ; Kernel functions b_input equ 0x0000000000100010 ; Scans keyboard for input. OUT: AL = 0 if no key pressed, otherwise ASCII code -b_output equ 0x0000000000100018 ; Displays a number of characters. IN: RSI = message location, RCX = number of characters +b_output equ 0x0000000000100018 ; Displays a number of characters. IN: RSI = Memory address of message, RCX = number of characters -b_net_tx equ 0x0000000000100020 ; Transmit a packet via a network interface. IN: RSI = Memory location where packet is stored, RCX = Length of packet, RDX = Device -b_net_rx equ 0x0000000000100028 ; Polls the network interface for received packet. IN: RDI = Memory location where packet will be stored, RDX = Device. OUT: RCX = Length of packet +b_net_tx equ 0x0000000000100020 ; Transmit a packet via a network interface. IN: RSI = Memory address of where packet is stored, RCX = Length of packet, RDX = Device +b_net_rx equ 0x0000000000100028 ; Polls the network interface for received packet. IN: RDX = Device. OUT: RDI = Memory address of where packet was stored, RCX = Length of packet -b_nvs_read equ 0x0000000000100030 ; Read data from a non-volatile storage device. IN: RAX = Starting sector, RCX = Number of sectors to read, RDX = Device, RDI = Memory location to store data -b_nvs_write equ 0x0000000000100038 ; Write data to a non-volatile storage device. IN: RAX = Starting sector, RCX = Number of sectors to write, RDX = Device, RSI = Memory location of data to store +b_nvs_read equ 0x0000000000100030 ; Read data from a non-volatile storage device. IN: RAX = Starting sector, RCX = Number of sectors to read, RDX = Device, RDI = Memory address to store data +b_nvs_write equ 0x0000000000100038 ; Write data to a non-volatile storage device. IN: RAX = Starting sector, RCX = Number of sectors to write, RDX = Device, RSI = Memory address of data to store b_system equ 0x0000000000100040 ; Configure system. IN: RCX = Function, RAX = Variable 1, RDX = Variable 2. OUT: RAX = Result @@ -35,7 +35,8 @@ SCREEN_X_GET equ 0x21 SCREEN_Y_GET equ 0x22 SCREEN_PPSL_GET equ 0x23 SCREEN_BPP_GET equ 0x24 -MAC_GET equ 0x30 +NET_STATUS equ 0x30 +NET_CONFIG equ 0x31 BUS_READ equ 0x50 BUS_WRITE equ 0x51 STDOUT_SET equ 0x52 diff --git a/api/libBareMetal.c b/api/libBareMetal.c index 1db4c78..04fb633 100644 --- a/api/libBareMetal.c +++ b/api/libBareMetal.c @@ -30,7 +30,7 @@ void b_net_tx(void *mem, u64 len, u64 iid) { u64 b_net_rx(void *mem, u64 iid) { u64 tlong; - asm volatile ("call *0x00100028" : "=c"(tlong) : "D"(mem), "d"(iid)); + asm volatile ("call *0x00100028" : "=D"(mem), "=c"(tlong) : "d"(iid)); return tlong; } diff --git a/api/libBareMetal.h b/api/libBareMetal.h index ee8fd57..3c9f2cb 100644 --- a/api/libBareMetal.h +++ b/api/libBareMetal.h @@ -48,7 +48,8 @@ u64 b_system(u64 function, u64 var1, u64 var2); #define SCREEN_Y_GET 0x22 #define SCREEN_PPSL_GET 0x23 #define SCREEN_BPP_GET 0x24 -#define MAC_GET 0x30 +#define NET_STATUS 0x30 +#define NET_CONFIG 0x31 #define BUS_READ 0x50 #define BUS_WRITE 0x51 #define STDOUT_SET 0x52 diff --git a/src/drivers/net/i8254x.asm b/src/drivers/net/i8254x.asm index 71b9041..6913b06 100644 --- a/src/drivers/net/i8254x.asm +++ b/src/drivers/net/i8254x.asm @@ -23,16 +23,13 @@ net_i8254x_init: add rdi, rax mov ax, 0x8254 ; Driver tag for i8254x - stosw - add rdi, 14 + mov [rdi+nt_ID], ax ; Get the Base Memory Address of the device mov al, 0 ; Read BAR0 call os_bus_read_bar - stosq ; Save the base + mov [rdi+nt_base], rax ; Save the base push rax ; Save the base for gathering the MAC later - mov rax, rcx - stosq ; Save the length ; Set PCI Status/Command values mov dl, 0x01 ; Read Status/Command @@ -44,7 +41,8 @@ net_i8254x_init: ; Get the MAC address pop rsi ; Restore the base - sub rdi, 24 ; 8 bytes into net table entry + push rdi + add rdi, 8 mov eax, [rsi+i8254x_RAL] ; RAL stosb shr eax, 8 @@ -57,19 +55,19 @@ net_i8254x_init: stosb shr eax, 8 stosb + pop rdi ; Set base addresses for TX and RX descriptors xor ecx, ecx mov cl, byte [os_net_icount] shl ecx, 15 - add rdi, 0x22 mov rax, os_tx_desc add rax, rcx - stosq + mov [rdi+nt_tx_desc], rax mov rax, os_rx_desc add rax, rcx - stosq + mov [rdi+nt_rx_desc], rax ; Reset the device xor edx, edx @@ -77,11 +75,12 @@ net_i8254x_init: call net_i8254x_reset ; Store call addresses - sub rdi, 0x20 + mov rax, net_i8254x_config + mov [rdi+nt_config], rax mov rax, net_i8254x_transmit - stosq + mov [rdi+nt_transmit], rax mov rax, net_i8254x_poll - stosq + mov [rdi+nt_poll], rax net_i8254x_init_error: @@ -215,6 +214,34 @@ net_i8254x_reset_nextdesc: ; ----------------------------------------------------------------------------- +; ----------------------------------------------------------------------------- +; net_i8254x_config - +; IN: RAX = Base address to store packets +; RDX = Interface ID +; OUT: Nothing +net_i8254x_config: + push rdi + push rcx + push rax + + mov rdi, [rdx+nt_rx_desc] + mov ecx, i8254x_MAX_DESC + call os_virt_to_phys +net_i8254x_config_next_record: + stosq + add rdi, 8 + add rax, 2048 + dec ecx + cmp ecx, 0 + jnz net_i8254x_config_next_record + + pop rax + pop rcx + pop rdi + ret +; ----------------------------------------------------------------------------- + + ; ----------------------------------------------------------------------------- ; net_i8254x_transmit - Transmit a packet via an Intel 8254x NIC ; IN: RSI = Location of packet @@ -270,9 +297,9 @@ net_i8254x_transmit: ; ----------------------------------------------------------------------------- ; net_i8254x_poll - Polls the Intel 8254x NIC for a received packet -; IN: RDI = Location to store packet -; RDX = Interface ID -; OUT: RCX = Length of packet +; IN: RDX = Interface ID +; OUT: RDI = Location of stored packet +; RCX = Length of packet ; Note: RDESC Descriptor Format: ; First Qword: ; Bits 63:0 - Buffer Address @@ -283,8 +310,8 @@ net_i8254x_transmit: ; Bits 47:40 - Errors ; Bits 63:48 - Special net_i8254x_poll: - push rdi push rsi ; Used for the base MMIO of the NIC + push rbx push rax mov rdi, [rdx+nt_rx_desc] @@ -293,8 +320,9 @@ net_i8254x_poll: ; Calculate the descriptor to read from mov eax, [rdx+nt_rx_head] ; Get rx_lasthead shl eax, 4 ; Quick multiply by 16 - add eax, 8 ; Offset to bytes received add rdi, rax ; Add offset to RDI + mov rbx, [rdi] + add rdi, 8 ; Offset to bytes received ; Todo: read all 64 bits. check status bit for DD xor ecx, ecx ; Clear RCX mov cx, [rdi] ; Get the packet length @@ -303,6 +331,7 @@ net_i8254x_poll: xor eax, eax stosq ; Clear the descriptor length and status + mov rdi, rbx ; Increment i8254x_rx_lasthead and the Receive Descriptor Tail mov eax, [rdx+nt_rx_head] ; Get rx_lasthead @@ -315,16 +344,10 @@ net_i8254x_poll: and eax, i8254x_MAX_DESC - 1 mov [rsi+i8254x_RDT], eax ; Write the updated Receive Descriptor Tail - pop rax - pop rsi - pop rdi - ret - net_i8254x_poll_end: - xor ecx, ecx pop rax + pop rbx pop rsi - pop rdi ret ; ----------------------------------------------------------------------------- @@ -346,8 +369,7 @@ net_i8254x_poll_end: ; Constants -i8254x_MAX_PKT_SIZE equ 16384 -i8254x_MAX_DESC equ 16 ; Must be 16, 32, 64, 128, etc. +i8254x_MAX_DESC equ 2048 ; Must be 16, 32, 64, 128, etc. Each descriptor is 16 bytes ; Register list (13.2) (All registers should be accessed as 32-bit values) diff --git a/src/drivers/net/i8257x.asm b/src/drivers/net/i8257x.asm index 6b003fd..9c0b528 100644 --- a/src/drivers/net/i8257x.asm +++ b/src/drivers/net/i8257x.asm @@ -26,16 +26,13 @@ net_i8257x_init: add rdi, rax mov ax, 0x8257 ; Driver tag for i8257x - stosw - add rdi, 14 + mov [rdi+nt_ID], ax ; Get the Base Memory Address of the device mov al, 0 ; Read BAR0 call os_bus_read_bar - stosq ; Save the base + mov [rdi+nt_base], rax ; Save the base push rax ; Save the base for gathering the MAC later - mov rax, rcx - stosq ; Save the length ; Set PCI Status/Command values mov dl, 0x01 ; Read Status/Command @@ -47,7 +44,8 @@ net_i8257x_init: ; Get the MAC address pop rsi ; Restore the base - sub rdi, 24 ; 8 bytes into net table entry + push rdi + add rdi, 8 mov eax, [rsi+i8257x_RAL] ; RAL stosb shr eax, 8 @@ -60,19 +58,19 @@ net_i8257x_init: stosb shr eax, 8 stosb + pop rdi ; Set base addresses for TX and RX descriptors xor ecx, ecx mov cl, byte [os_net_icount] shl ecx, 15 - add rdi, 0x22 mov rax, os_tx_desc add rax, rcx - stosq + mov [rdi+nt_tx_desc], rax mov rax, os_rx_desc add rax, rcx - stosq + mov [rdi+nt_rx_desc], rax ; Reset the device xor edx, edx @@ -80,11 +78,12 @@ net_i8257x_init: call net_i8257x_reset ; Store call addresses - sub rdi, 0x20 + mov rax, net_i8257x_config + mov [rdi+nt_config], rax mov rax, net_i8257x_transmit - stosq + mov [rdi+nt_transmit], rax mov rax, net_i8257x_poll - stosq + mov [rdi+nt_poll], rax net_i8257x_init_error: @@ -217,6 +216,34 @@ net_i8257x_reset_nextdesc: ; ----------------------------------------------------------------------------- +; ----------------------------------------------------------------------------- +; net_i8257x_config - +; IN: RAX = Base address to store packets +; RDX = Interface ID +; OUT: Nothing +net_i8257x_config: + push rdi + push rcx + push rax + + mov rdi, [rdx+nt_rx_desc] + mov ecx, i8257x_MAX_DESC + call os_virt_to_phys +net_i8257x_config_next_record: + stosq + add rdi, 8 + add rax, 2048 + dec ecx + cmp ecx, 0 + jnz net_i8257x_config_next_record + + pop rax + pop rcx + pop rdi + ret +; ----------------------------------------------------------------------------- + + ; ----------------------------------------------------------------------------- ; net_i8257x_transmit - Transmit a packet via an Intel 8257x NIC ; IN: RSI = Location of packet @@ -285,8 +312,8 @@ net_i8257x_transmit: ; Bits 47:40 - Errors ; Bits 63:48 - VLAN net_i8257x_poll: - push rdi push rsi ; Used for the base MMIO of the NIC + push rbx push rax mov rdi, [rdx+nt_rx_desc] @@ -295,8 +322,9 @@ net_i8257x_poll: ; Calculate the descriptor to read from mov eax, [rdx+nt_rx_head] ; Get rx_lasthead shl eax, 4 ; Quick multiply by 16 - add eax, 8 ; Offset to bytes received add rdi, rax ; Add offset to RDI + mov rbx, [rdi] + add rdi, 8 ; Offset to bytes received ; Todo: read all 64 bits. check status bit for DD xor ecx, ecx ; Clear RCX mov cx, [rdi] ; Get the packet length @@ -305,6 +333,7 @@ net_i8257x_poll: xor eax, eax stosq ; Clear the descriptor length and status + mov rdi, rbx ; Increment i8257x_rx_lasthead and the Receive Descriptor Tail mov eax, [rdx+nt_rx_head] ; Get rx_lasthead @@ -317,23 +346,16 @@ net_i8257x_poll: and eax, i8257x_MAX_DESC - 1 mov [rsi+i8257x_RDT], eax ; Write the updated Receive Descriptor Tail - pop rax - pop rsi - pop rdi - ret - net_i8257x_poll_end: - xor ecx, ecx pop rax + pop rbx pop rsi - pop rdi ret ; ----------------------------------------------------------------------------- ; Constants -i8257x_MAX_PKT_SIZE equ 16384 -i8257x_MAX_DESC equ 16 ; Must be 16, 32, 64, 128, etc. +i8257x_MAX_DESC equ 2048 ; Must be 16, 32, 64, 128, etc. Each descriptor is 16 bytes ; Register list (13.3) (All registers should be accessed as 32-bit values) diff --git a/src/drivers/net/i8259x.asm b/src/drivers/net/i8259x.asm index c1b2c1f..8afaec8 100644 --- a/src/drivers/net/i8259x.asm +++ b/src/drivers/net/i8259x.asm @@ -23,16 +23,13 @@ net_i8259x_init: add rdi, rax mov ax, 0x8259 ; Driver tag for i8259x - stosw - add rdi, 14 + mov [rdi+nt_ID], ax ; Get the Base Memory Address of the device mov al, 0 ; Read BAR0 call os_bus_read_bar - stosq ; Save the base + mov [rdi+nt_base], rax ; Save the base push rax ; Save the base for gathering the MAC later - mov rax, rcx - stosq ; Save the length ; Set PCI Status/Command values mov dl, 0x01 ; Read Status/Command @@ -44,7 +41,8 @@ net_i8259x_init: ; Get the MAC address pop rsi ; Restore the base - sub rdi, 24 ; 8 bytes into net table entry + push rdi + add rdi, 8 mov eax, [rsi+i8259x_RAL] ; RAL stosb shr eax, 8 @@ -57,19 +55,19 @@ net_i8259x_init: stosb shr eax, 8 stosb + pop rdi ; Set base addresses for TX and RX descriptors xor ecx, ecx mov cl, byte [os_net_icount] shl ecx, 15 - add rdi, 0x22 mov rax, os_tx_desc add rax, rcx - stosq + mov [rdi+nt_tx_desc], rax mov rax, os_rx_desc add rax, rcx - stosq + mov [rdi+nt_rx_desc], rax ; Reset the device xor edx, edx @@ -77,11 +75,12 @@ net_i8259x_init: call net_i8259x_reset ; Store call addresses - sub rdi, 0x20 + mov rax, net_i8259x_config + mov [rdi+nt_config], rax mov rax, net_i8259x_transmit - stosq + mov [rdi+nt_transmit], rax mov rax, net_i8259x_poll - stosq + mov [rdi+nt_poll], rax net_i8259x_init_error: @@ -377,6 +376,34 @@ net_i8259x_init_tx_enable_wait: ; ----------------------------------------------------------------------------- +; ----------------------------------------------------------------------------- +; net_i8259x_config - +; IN: RAX = Base address to store packets +; RDX = Interface ID +; OUT: Nothing +net_i8259x_config: + push rdi + push rcx + push rax + + mov rdi, [rdx+nt_rx_desc] + mov ecx, i8259x_MAX_DESC + call os_virt_to_phys +net_i8259x_config_next_record: + stosq + add rdi, 8 + add rax, 2048 + dec ecx + cmp ecx, 0 + jnz net_i8259x_config_next_record + + pop rax + pop rcx + pop rdi + ret +; ----------------------------------------------------------------------------- + + ; ----------------------------------------------------------------------------- ; net_i8259x_transmit - Transmit a packet via an Intel 8259x NIC ; IN: RSI = Location of packet @@ -434,8 +461,8 @@ net_i8259x_transmit: ; Bits 95:64 - Fragment Checksum (Bits 31:16) / Length (Bits 15:0) ; Bits 127:96 - VLAN (Bits 63:48) / Errors (Bits 47:40) / STA (Bits 39:32) net_i8259x_poll: - push rdi push rsi ; Used for the base MMIO of the NIC + push rbx push rax mov rdi, [rdx+nt_rx_desc] @@ -444,8 +471,9 @@ net_i8259x_poll: ; Calculate the descriptor to read from mov eax, [rdx+nt_rx_head] ; Get rx_lasthead shl eax, 4 ; Quick multiply by 16 - add eax, 8 ; Offset to bytes received add rdi, rax ; Add offset to RDI + mov rbx, [rdi] + add rdi, 8 ; Offset to bytes received ; Todo: read all 64 bits. check status bit for DD xor ecx, ecx ; Clear RCX mov cx, [rdi] ; Get the packet length @@ -454,6 +482,7 @@ net_i8259x_poll: xor eax, eax stosq ; Clear the descriptor length and status + mov rdi, rbx ; Increment i8259x_rx_lasthead and the Receive Descriptor Tail mov eax, [rdx+nt_rx_head] ; Get rx_lasthead @@ -466,23 +495,16 @@ net_i8259x_poll: and eax, i8259x_MAX_DESC - 1 mov [rsi+i8259x_RDT], eax ; Write the updated Receive Descriptor Tail - pop rax - pop rsi - pop rdi - ret - net_i8259x_poll_end: - xor ecx, ecx pop rax + pop rbx pop rsi - pop rdi ret ; ----------------------------------------------------------------------------- ; Constants -i8259x_MAX_PKT_SIZE equ 16384 -i8259x_MAX_DESC equ 4096 ; Must be 16, 32, 64, 128, etc. +i8259x_MAX_DESC equ 2048 ; Must be 16, 32, 64, 128, etc. Each descriptor is 16 bytes ; Register list (All registers should be accessed as 32-bit values) diff --git a/src/syscalls/io.asm b/src/syscalls/io.asm index dac495b..8af2114 100644 --- a/src/syscalls/io.asm +++ b/src/syscalls/io.asm @@ -29,7 +29,7 @@ b_input_no_serial: ; ----------------------------------------------------------------------------- ; b_output -- Outputs characters -; IN: RSI = message location (non zero-terminated) +; IN: RSI = Memory address of message (non zero-terminated) ; RCX = number of chars to output ; OUT: All registers preserved b_output: diff --git a/src/syscalls/net.asm b/src/syscalls/net.asm index 3c8d0d6..91eb378 100644 --- a/src/syscalls/net.asm +++ b/src/syscalls/net.asm @@ -40,9 +40,33 @@ b_net_status_end: ; ----------------------------------------------------------------------------- +; ----------------------------------------------------------------------------- +; b_net_config -- Check if network access is available +; IN: RDX = Interface ID +; RAX = Base for receive descriptors +; OUT: Nothing +b_net_config: + push rsi + push rdx + push rcx + + shl edx, 7 ; Quick multiply by 128 + add edx, net_table ; Add offset to net_table + + ; Call the driver config function + call [rdx+nt_config] ; Call driver transmit function passing RDX as interface + +b_net_config_end: + pop rcx + pop rdx + pop rsi + ret +; ----------------------------------------------------------------------------- + + ; ----------------------------------------------------------------------------- ; b_net_tx -- Transmit a packet via the network -; IN: RSI = Memory location where packet is stored +; IN: RSI = Memory address of where packet is stored ; RCX = Length of packet ; RDX = Interface ID ; OUT: Nothing. All registers preserved @@ -75,8 +99,8 @@ b_net_tx_maxcheck: call [rdx+nt_transmit] ; Call driver transmit function passing RDX as interface ; Increment interface counters - inc qword [rdx+nt_tx_packets] ; Increment TXPackets - add qword [rdx+nt_tx_bytes], rcx ; Increment TXBytes + inc qword [rdx+nt_tx_packets] + add qword [rdx+nt_tx_bytes], rcx ; Unlock the network interface mov rax, rdx @@ -93,53 +117,36 @@ b_net_tx_fail: ; ----------------------------------------------------------------------------- ; b_net_rx -- Polls the network for received data -; IN: RDI = Memory location where packet will be stored -; RDX = Interface ID -; OUT: RCX = Length of packet, 0 if no data +; IN: RDX = Interface ID +; OUT: RDI = Memory address of where packet was stored +; RCX = Length of packet, 0 if no data ; All other registers preserved b_net_rx: - push rdi - push rsi push rdx - push rax + mov cl, byte [os_net_icount] ; Get interface count + cmp cl, 0 + je b_net_rx_end ; Bail out if there are no valid interfaces + dec cl ; Interfaces start at 0 + cmp cl, dl xor ecx, ecx - - cmp byte [os_NetEnabled], 1 ; Check if networking is enabled - jne b_net_rx_nodata + ja b_net_rx_end ; Bail out if it was an invalid interface shl edx, 7 ; Quick multiply by 128 add edx, net_table ; Add offset to net_table ; Call the driver poll function - call [rdx+nt_poll] ; Call driver poll function passing RDX as interface + call [rdx+nt_poll] ; Call driver poll function passing RDX as interface cmp cx, 0 - je b_net_rx_nodata + je b_net_rx_end ; Increment interface counters - inc qword [rdx+nt_rx_packets] ; Increment RXPackets - add qword [rdx+nt_rx_bytes], rcx ; Increment RXBytes - - mov rsi, os_PacketBuffers ; Packet exists here - push rcx - rep movsb ; Copy packet to requested address - pop rcx + inc qword [rdx+nt_rx_packets] + add qword [rdx+nt_rx_bytes], rcx -; TODO is b_net_rx_nodata needed if CX is already set b_net_rx_end: - pop rax - pop rdx - pop rsi - pop rdi - ret - -b_net_rx_nodata: - xor ecx, ecx - pop rax pop rdx - pop rsi - pop rdi ret ; ----------------------------------------------------------------------------- diff --git a/src/syscalls/system.asm b/src/syscalls/system.asm index 2881707..d101c13 100644 --- a/src/syscalls/system.asm +++ b/src/syscalls/system.asm @@ -107,10 +107,14 @@ b_system_screen_bpp_get: ; Network -b_system_mac_get: +b_system_net_status: call b_net_status ret +b_system_net_config: + call b_net_config + ret + ; Bus b_system_pci_read: @@ -359,8 +363,8 @@ b_system_table: dw none ; 0x2F ; Network - dw b_system_mac_get ; 0x30 - dw none ; 0x31 + dw b_system_net_status ; 0x30 + dw b_system_net_config ; 0x31 dw none ; 0x32 dw none ; 0x33 dw none ; 0x34 diff --git a/src/sysvar.asm b/src/sysvar.asm index c28a88f..e8b9523 100644 --- a/src/sysvar.asm +++ b/src/sysvar.asm @@ -116,13 +116,6 @@ key: equ os_SystemVariables + 0x0301 key_shift: equ os_SystemVariables + 0x0302 os_BusEnabled: equ os_SystemVariables + 0x0303 ; 1 if PCI is enabled, 2 if PCIe is enabled os_NetEnabled: equ os_SystemVariables + 0x0304 ; 1 if a supported network card was enabled -;os_NetIRQ: equ os_SystemVariables + 0x0305 ; Set to Interrupt line that NIC is connected to -;os_NetActivity_TX: equ os_SystemVariables + 0x0306 -;os_NetActivity_RX: equ os_SystemVariables + 0x0307 -;os_EthernetBuffer_C1: equ os_SystemVariables + 0x0308 ; Counter 1 for the Ethernet RX Ring Buffer -;os_EthernetBuffer_C2: equ os_SystemVariables + 0x0309 ; Counter 2 for the Ethernet RX Ring Buffer -;os_nvsEnabled: equ os_SystemVariables + 0x030A -;os_nvsActivity: equ os_SystemVariables + 0x030B os_NVMeIRQ: equ os_SystemVariables + 0x030C os_NVMeMJR: equ os_SystemVariables + 0x030D os_NVMeMNR: equ os_SystemVariables + 0x030E @@ -149,21 +142,22 @@ net_table: equ os_SystemVariables + 0xA000 os_PacketBuffers: equ os_SystemVariables + 0xC000 ; 16KiB ; net_table values (per device - 128 bytes) -nt_ID: equ 0x00 ; 16-bit -nt_lock: equ 0x02 ; 16-bit -nt_MAC: equ 0x08 ; 48-bit -nt_base: equ 0x10 ; 64-bit -nt_len: equ 0x18 ; 64-bit -nt_transmit: equ 0x20 ; 64-bit -nt_poll: equ 0x28 ; 64-bit -nt_tx_desc: equ 0x30 ; 64-bit -nt_rx_desc: equ 0x38 ; 64-bit -nt_tx_tail: equ 0x40 ; 64-bit -nt_rx_head: equ 0x44 ; 64-bit -nt_tx_packets: equ 0x50 ; 64-bit -nt_tx_bytes: equ 0x58 ; 64-bit -nt_rx_packets: equ 0x60 ; 64-bit -nt_rx_bytes: equ 0x68 ; 64-bit +nt_ID: equ 0x00 ; 16-bit Driver ID +nt_lock: equ 0x02 ; 16-bit Lock for b_net_tx +nt_MAC: equ 0x08 ; 48-bit MAC Address +nt_base: equ 0x10 ; 64-bit Base MMIO +nt_config: equ 0x18 ; 64-bit Config function address +nt_transmit: equ 0x20 ; 64-bit Transmit function address +nt_poll: equ 0x28 ; 64-bit Poll function address +; nt_desc: equ 0xXX ; 64-bit Address of TX/RX descriptors +nt_tx_desc: equ 0x30 ; 64-bit Address of TX descriptors +nt_rx_desc: equ 0x38 ; 64-bit Address of RX descriptors +nt_tx_tail: equ 0x40 ; 64-bit TX Tail +nt_rx_head: equ 0x44 ; 64-bit RX Head +nt_tx_packets: equ 0x50 ; 64-bit Number of packets transmitted +nt_tx_bytes: equ 0x58 ; 64-bit Number of bytes transmitted +nt_rx_packets: equ 0x60 ; 64-bit Number of packets received +nt_rx_bytes: equ 0x68 ; 64-bit Number of bytes received ; bytes 70-7F for future use