Compare commits
No commits in common. "18e5b049a42f0f16e3c35ab3f23a7c55e1527349" and "4d9b1e390d14c73e49f35a753cac67438111333a" have entirely different histories.
18e5b049a4
...
4d9b1e390d
|
@ -22,14 +22,13 @@ pci_device_exists:
|
||||||
; Bus Number
|
; Bus Number
|
||||||
mov al, [esi + 5]
|
mov al, [esi + 5]
|
||||||
; Device Number
|
; Device Number
|
||||||
; Make space for device number
|
shl eax, 5 ; 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
|
||||||
|
|
||||||
.input_output:
|
.io_task:
|
||||||
mov dx, PCI_CONFIG_ADDRESS_PORT
|
mov dx, PCI_CONFIG_ADDRESS_PORT
|
||||||
out dx, eax
|
out dx, eax
|
||||||
|
|
||||||
|
@ -140,8 +139,7 @@ pci_get_device_class_at_address:
|
||||||
; Bus Number
|
; Bus Number
|
||||||
mov al, [ebp - 2]
|
mov al, [ebp - 2]
|
||||||
; Device Number
|
; Device Number
|
||||||
; Make space for device number
|
shl eax, 5 ; 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
|
||||||
|
@ -194,7 +192,6 @@ 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]
|
||||||
|
@ -230,6 +227,7 @@ 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
|
||||||
|
@ -250,10 +248,14 @@ pci_enumerate_bus:
|
||||||
mov esp, ebp
|
mov esp, ebp
|
||||||
pop ebp
|
pop ebp
|
||||||
|
|
||||||
mov ebx, [ebp - 4]
|
mov eax, [esi + 4]
|
||||||
|
inc eax
|
||||||
|
mov [esi + 4], eax
|
||||||
|
|
||||||
.no_device:
|
.no_device:
|
||||||
inc dword [esi]
|
mov ecx, [esi]
|
||||||
|
inc ecx
|
||||||
|
mov [esi], ecx
|
||||||
jmp .device_loop
|
jmp .device_loop
|
||||||
|
|
||||||
.epilog:
|
.epilog:
|
||||||
|
@ -275,8 +277,6 @@ 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
|
||||||
|
|
|
@ -1,68 +0,0 @@
|
||||||
|
|
||||||
; Arguments:
|
|
||||||
; [FURTHER FROM EBP]
|
|
||||||
; 3. U16 Register Index
|
|
||||||
; 2. U16 Device Index in device list
|
|
||||||
; 1. Ptr32 Pointer to PCI driver area
|
|
||||||
; [NEAREST TO EBP]
|
|
||||||
pci_read_register:
|
|
||||||
push dword esi
|
|
||||||
sub esp, 64
|
|
||||||
mov esi, esp
|
|
||||||
|
|
||||||
mov [esi + (64 - 8)], ebx
|
|
||||||
mov [esi + (64 - 12)], ecx
|
|
||||||
mov [esi + (64 - 16)], edx
|
|
||||||
mov [esi + (64 - 20)], edi
|
|
||||||
|
|
||||||
.check_device_index:
|
|
||||||
; todo: Boundary checks
|
|
||||||
|
|
||||||
.get_device:
|
|
||||||
|
|
||||||
xor ebx, ebx
|
|
||||||
mov bx, [ebp - 6]
|
|
||||||
shl ebx, 4
|
|
||||||
; Point into the driver's device area
|
|
||||||
add ebx, [ebp - 4]
|
|
||||||
add ebx, PCI_DEVICE_AREA_OFFSET
|
|
||||||
mov [esi], ebx
|
|
||||||
|
|
||||||
xor eax, eax
|
|
||||||
mov ax, [ebx]
|
|
||||||
mov [esi + 4], ah
|
|
||||||
mov [esi + 5], al
|
|
||||||
|
|
||||||
.make_address:
|
|
||||||
xor eax, eax
|
|
||||||
; Enable Bit
|
|
||||||
or al, 1
|
|
||||||
; Make space for 8 Reserved Bits and 8 Bytes of bus number.
|
|
||||||
shl eax, 15
|
|
||||||
; Bus Number
|
|
||||||
mov al, [esi + 5]
|
|
||||||
; Device Number
|
|
||||||
shl eax, 5 ; Make space for device number
|
|
||||||
mov dl, [esi + 4]
|
|
||||||
and dl, 0x1f
|
|
||||||
or al, dl
|
|
||||||
shl eax, 9
|
|
||||||
or al, [ebp - 8]
|
|
||||||
shl eax, 2
|
|
||||||
|
|
||||||
.input_output:
|
|
||||||
mov dx, PCI_CONFIG_ADDRESS_PORT
|
|
||||||
out dx, eax
|
|
||||||
|
|
||||||
mov dx, PCI_CONFIG_DATA_PORT
|
|
||||||
in eax, dx
|
|
||||||
|
|
||||||
.epilog:
|
|
||||||
mov ebx, [esi + (64 - 8)]
|
|
||||||
mov ecx, [esi + (64 - 12)]
|
|
||||||
mov edx, [esi + (64 - 16)]
|
|
||||||
mov edi, [esi + (64 - 20)]
|
|
||||||
|
|
||||||
add esp, 64
|
|
||||||
pop dword esi
|
|
||||||
ret
|
|
Loading…
Reference in New Issue