Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 3392 → Rev 3393

/kernel/trunk/bus/pci/pci32.inc
155,12 → 155,12
align 4
 
pci_read_reg:
push ebx esi
cmp byte [BOOT_VAR+0x9020], 2;what mechanism will we use?
je pci_read_reg_2
 
; mechanism 1
push esi ; save register size into ESI
mov esi, eax
mov esi, eax ; save register size into ESI
and esi, 3
 
call pci_make_config_cmd
202,7 → 202,7
out dx, eax
 
pop eax
pop esi
pop esi ebx
ret
pci_read_reg_2:
 
209,8 → 209,7
test bh, 128 ;mech#2 only supports 16 devices per bus
jnz pci_read_reg_err
 
push esi; save register size into ESI
mov esi, eax
mov esi, eax ; save register size into ESI
and esi, 3
 
push eax
262,12 → 261,13
out dx, al
 
pop eax
pop esi
pop esi ebx
ret
 
pci_read_reg_err:
xor eax, eax
dec eax
pop esi ebx
ret
 
 
286,12 → 286,12
align 4
 
pci_write_reg:
push esi ebx
cmp byte [BOOT_VAR+0x9020], 2;what mechanism will we use?
je pci_write_reg_2
 
; mechanism 1
push esi ; save register size into ESI
mov esi, eax
mov esi, eax ; save register size into ESI
and esi, 3
 
call pci_make_config_cmd
335,7 → 335,7
out dx, eax
 
xor eax, eax
pop esi
pop ebx esi
 
ret
pci_write_reg_2:
344,8 → 344,7
jnz pci_write_reg_err
 
 
push esi; save register size into ESI
mov esi, eax
mov esi, eax ; save register size into ESI
and esi, 3
 
push eax
397,12 → 396,13
out dx, al
 
xor eax, eax
pop esi
pop ebx esi
ret
 
pci_write_reg_err:
xor eax, eax
dec eax
pop ebx esi
ret
 
if defined mmio_pci_addr ; must be set above
658,3 → 658,67
.return_a:
mov dword[esp + 32], eax
ret
 
proc pci_enum
push ebp
mov ebp, esp
push 0
virtual at ebp-4
.devfn db ?
.bus db ?
end virtual
.loop:
mov ah, [.bus]
mov al, 2
mov bh, [.devfn]
mov bl, 0
call pci_read_reg
cmp eax, 0xFFFFFFFF
jnz .has_device
test byte [.devfn], 7
jnz .next_func
jmp .no_device
.has_device:
push eax
push sizeof.PCIDEV
pop eax
call malloc
pop ecx
test eax, eax
jz .nomemory
mov edi, eax
mov [edi+PCIDEV.vendor_device_id], ecx
mov eax, pcidev_list
mov ecx, [eax+PCIDEV.bk]
mov [edi+PCIDEV.bk], ecx
mov [edi+PCIDEV.fd], eax
mov [ecx+PCIDEV.fd], edi
mov [eax+PCIDEV.bk], edi
mov eax, dword [.devfn]
mov word [edi+PCIDEV.devfn], ax
mov bh, al
mov al, 2
mov bl, 8
call pci_read_reg
shr eax, 8
mov [edi+PCIDEV.class], eax
test byte [.devfn], 7
jnz .next_func
mov ah, [.bus]
mov al, 0
mov bh, [.devfn]
mov bl, 0Eh
call pci_read_reg
test al, al
js .next_func
.no_device:
or byte [.devfn], 7
.next_func:
inc dword [.devfn]
mov ah, [.bus]
cmp ah, [BOOT_VAR+0x9021]
jbe .loop
.nomemory:
leave
ret
endp
/kernel/trunk/const.inc
570,6 → 570,15
count dd ?
ends
 
struct PCIDEV
bk dd ?
fd dd ?
vendor_device_id dd ?
class dd ?
devfn db ?
bus db ?
ends
 
struct MEM_STATE
mutex MUTEX
smallmap dd ?
/kernel/trunk/data32.inc
181,6 → 181,10
.bk dd dll_list
.fd dd dll_list
 
pcidev_list:
.bk dd pcidev_list
.fd dd pcidev_list
 
MAX_DEFAULT_DLL_ADDR = 0x80000000
MIN_DEFAULT_DLL_ADDR = 0x70000000
dll_cur_addr dd MIN_DEFAULT_DLL_ADDR