Improve coding style of PCI device enumerator

The arguments of all of the statements are now indented and one or two
comments have been rewritten partially, improving readability.
This commit is contained in:
Eric-Paul Ickhorn 2024-07-23 00:51:04 +02:00
parent 4d9b1e390d
commit 1285994cbf
Signed by: epickh
GPG Key ID: 1358818BAA38B104
1 changed files with 170 additions and 170 deletions

View File

@ -22,13 +22,14 @@ pci_device_exists:
; Bus Number ; Bus Number
mov al, [esi + 5] mov al, [esi + 5]
; Device Number ; Device Number
shl eax, 5 ; Make space for device number ; Make space for device number
shl eax, 5
mov dl, [esi + 4] mov dl, [esi + 4]
and dl, 0x1f and dl, 0x1f
or al, dl or al, dl
shl eax, 11 shl eax, 11
.io_task: .input_output:
mov dx, PCI_CONFIG_ADDRESS_PORT mov dx, PCI_CONFIG_ADDRESS_PORT
out dx, eax out dx, eax
@ -139,7 +140,8 @@ pci_get_device_class_at_address:
; Bus Number ; Bus Number
mov al, [ebp - 2] mov al, [ebp - 2]
; Device Number ; Device Number
shl eax, 5 ; Make space for device number ; Make space for device number
shl eax, 5
mov dl, [ebp - 4] mov dl, [ebp - 4]
and dl, 0x1f and dl, 0x1f
or al, dl or al, dl
@ -192,6 +194,7 @@ pci_enumerate_bus:
; [esi]: Device-in-bus Index ; [esi]: Device-in-bus Index
; [esi + 4]: Number of existing devices ; [esi + 4]: Number of existing devices
; [esi + 8]: Bus number ; [esi + 8]: Bus number
; [esi + 12]:
mov [esi], dword 0 mov [esi], dword 0
mov [esi + 4], dword 0 mov [esi + 4], dword 0
mov eax, [ebp - 8] mov eax, [ebp - 8]
@ -227,7 +230,6 @@ pci_enumerate_bus:
mov dl, ah mov dl, ah
xor ah, ah xor ah, ah
push ebp push ebp
mov ebp, esp mov ebp, esp
push ax push ax
@ -248,14 +250,10 @@ pci_enumerate_bus:
mov esp, ebp mov esp, ebp
pop ebp pop ebp
mov eax, [esi + 4] mov ebx, [ebp - 4]
inc eax
mov [esi + 4], eax
.no_device: .no_device:
mov ecx, [esi] inc dword [esi]
inc ecx
mov [esi], ecx
jmp .device_loop jmp .device_loop
.epilog: .epilog:
@ -277,6 +275,8 @@ pci_enumerate_bus:
; (0 to eliminate limit) ; (0 to eliminate limit)
; 1. Ptr32 Pointer to PCI driver area of 65536 bytes ; 1. Ptr32 Pointer to PCI driver area of 65536 bytes
; [NEAREST TO EBP] ; [NEAREST TO EBP]
; Returns:
; eax: Number of devices read
pci_enumerate: pci_enumerate:
push dword esi push dword esi
sub esp, 64 sub esp, 64