@@ -22,7 +22,7 @@ net_i8254x_init:
2222 shl eax , 7 ; Quick multiply by 128
2323 add rdi , rax
2424
25- mov ax , 0x8254
25+ mov ax , 0x8254 ; Driver tag for i8254x
2626 stosw
2727 add rdi , 14
2828
@@ -98,7 +98,6 @@ net_i8254x_reset:
9898 add rsi , rax
9999 add rsi , 16
100100 mov rsi , [ rsi ]
101- ; mov rsi, [os_NetIOBaseMem]
102101 mov rdi , rsi
103102
104103 ; Disable Interrupts
@@ -144,7 +143,7 @@ net_i8254x_reset:
144143 mov ecx , i8254x_MAX_DESC
145144; TODO - Adjust value based on iid
146145 mov rdi , os_rx_desc
147- net_i8254x_reset_nextdesc:
146+ net_i8254x_reset_nextdesc:
148147 mov rax , os_PacketBuffers ; Default packet will go here
149148 stosq
150149 xor eax , eax
@@ -221,7 +220,6 @@ net_i8254x_transmit:
221220 mov rdi , os_tx_desc ; Transmit Descriptor Base Address
222221
223222 ; Calculate the descriptor to write to
224- ; mov eax, [i8254x_tx_lasttail]
225223 mov eax , [ rdx + 0x30 ] ; Get tx_lasttail
226224 push rax ; Save lasttail
227225 shl eax , 4 ; Quick multiply by 16
@@ -240,9 +238,7 @@ net_i8254x_transmit:
240238 pop rax ; Restore lasttail
241239 add eax , 1
242240 and eax , i8254x_MAX_DESC - 1
243- ; mov [i8254x_tx_lasttail], eax
244241 mov [ rdx + 0x30 ], eax ; Set tx_lasttail
245- ; mov rdi, [os_NetIOBaseMem]
246242 mov rdi , [ rdx + 0x10 ] ; Load the base MMIO of the NIC
247243 mov [ rdi + i8254x_TDT ], eax ; TDL - Transmit Descriptor Tail
248244
@@ -272,11 +268,9 @@ net_i8254x_poll:
272268 push rax
273269
274270 mov rdi , os_rx_desc
275- ; mov rsi, [os_NetIOBaseMem] ; Load the base MMIO of the NIC
276271 mov rsi , [ rdx + 0x10 ] ; Load the base MMIO of the NIC
277272
278273 ; Calculate the descriptor to read from
279- ; mov eax, [i8254x_rx_lasthead]
280274 mov eax , [ rdx + 0x34 ] ; Get rx_lasthead
281275 shl eax , 4 ; Quick multiply by 16
282276 add eax , 8 ; Offset to bytes received
@@ -291,11 +285,9 @@ net_i8254x_poll:
291285 stosq ; Clear the descriptor length and status
292286
293287 ; Increment i8254x_rx_lasthead and the Receive Descriptor Tail
294- ; mov eax, [i8254x_rx_lasthead]
295288 mov eax , [ rdx + 0x34 ] ; Get rx_lasthead
296289 add eax , 1
297290 and eax , i8254x_MAX_DESC - 1
298- ; mov [i8254x_rx_lasthead], eax
299291 mov [ rdx + 0x34 ], eax ; Set rx_lasthead
300292
301293 mov eax , [ rsi + i8254x_RDT ] ; Read the current Receive Descriptor Tail
@@ -333,10 +325,6 @@ net_i8254x_poll_end:
333325; -----------------------------------------------------------------------------
334326
335327
336- ; Variables
337- ;i8254x_tx_lasttail: dd 0
338- ;i8254x_rx_lasthead: dd 0
339-
340328; Constants
341329i8254x_MAX_PKT_SIZE equ 16384
342330i8254x_MAX_DESC equ 16 ; Must be 16, 32, 64, 128, etc.
0 commit comments