forked from KolibriOS/kolibrios
cleanup, trimming some fat.
git-svn-id: svn://kolibrios.org@4788 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
ae5097b525
commit
a11044300e
@ -83,7 +83,8 @@ button: ; button
|
|||||||
|
|
||||||
cmp ah, 1 ; button id = 1 ?
|
cmp ah, 1 ; button id = 1 ?
|
||||||
jne @f
|
jne @f
|
||||||
exit: mcall -1 ; close this program
|
exit:
|
||||||
|
mcall -1 ; close this program
|
||||||
@@:
|
@@:
|
||||||
cmp eax, 0x0000ff00
|
cmp eax, 0x0000ff00
|
||||||
jg load_drv
|
jg load_drv
|
||||||
@ -102,7 +103,7 @@ exit: mcall -1 ; close this program
|
|||||||
|
|
||||||
load_drv:
|
load_drv:
|
||||||
shr eax, 16
|
shr eax, 16
|
||||||
mov word [selected], ax
|
mov [selected], ax
|
||||||
|
|
||||||
mov bl, 6 ; get a dword
|
mov bl, 6 ; get a dword
|
||||||
mov bh, ah ; bus
|
mov bh, ah ; bus
|
||||||
@ -110,9 +111,9 @@ load_drv:
|
|||||||
mov cl, 0 ; offset to device/vendor id
|
mov cl, 0 ; offset to device/vendor id
|
||||||
mcall 62 ; get ID's
|
mcall 62 ; get ID's
|
||||||
|
|
||||||
mov word [PCI_Vendor], ax
|
mov [PCI_Vendor], ax
|
||||||
shr eax, 16
|
shr eax, 16
|
||||||
mov word [PCI_Device], ax
|
mov [PCI_Device], ax
|
||||||
call get_drv_ptr
|
call get_drv_ptr
|
||||||
|
|
||||||
mov ecx, eax
|
mov ecx, eax
|
||||||
@ -145,19 +146,18 @@ hook:
|
|||||||
mov [IOCTL.output], 0
|
mov [IOCTL.output], 0
|
||||||
|
|
||||||
mcall 68, 17, IOCTL
|
mcall 68, 17, IOCTL
|
||||||
|
mov [drivernumber], al
|
||||||
mov byte[drivernumber], al
|
|
||||||
|
|
||||||
jmp still
|
jmp still
|
||||||
|
|
||||||
reset:
|
reset:
|
||||||
movzx ebx, byte[drivernumber]
|
movzx ebx, [drivernumber]
|
||||||
mcall 74,,2
|
mcall 74,,2
|
||||||
|
|
||||||
jmp still
|
jmp still
|
||||||
|
|
||||||
unload:
|
unload:
|
||||||
movzx ebx, byte[drivernumber]
|
movzx ebx, [drivernumber]
|
||||||
mcall 74,,3
|
mcall 74,,3
|
||||||
|
|
||||||
jmp still
|
jmp still
|
||||||
@ -202,46 +202,49 @@ draw_window:
|
|||||||
;* Gets the PCI Version and Last Bus
|
;* Gets the PCI Version and Last Bus
|
||||||
Get_PCI_Info:
|
Get_PCI_Info:
|
||||||
mcall 62, 0
|
mcall 62, 0
|
||||||
mov word [PCI_Version], ax
|
mov [PCI_Version], ax
|
||||||
mcall 62, 1
|
mcall 62, 1
|
||||||
mov byte [PCI_LastBus], al
|
mov [PCI_LastBus], al
|
||||||
;----------------------------------------------------------
|
;----------------------------------------------------------
|
||||||
;* Get all devices on PCI Bus
|
;* Get all devices on PCI Bus
|
||||||
mov edx, 20 shl 16 + 110 ; set start write position
|
|
||||||
cmp al, 0xff ; 0xFF means no pci bus found
|
cmp al, 0xff ; 0xFF means no pci bus found
|
||||||
jne Pci_Exists ;
|
jne Pci_Exists ;
|
||||||
ret ; if no bus then leave
|
ret ; if no bus then leave
|
||||||
|
|
||||||
Pci_Exists:
|
Pci_Exists:
|
||||||
mov byte [V_Bus], 0 ; reset varibles
|
mov [V_Bus], 0
|
||||||
mov byte [V_Dev], 0 ;
|
mov [V_Dev], 0
|
||||||
|
mov edx, 20 shl 16 + 110 ; set start write position
|
||||||
|
|
||||||
Start_Enum:
|
Start_Enum:
|
||||||
mov bl , 6 ; get a dword
|
mov bl, 6 ; read dword
|
||||||
mov bh , byte [V_Bus] ; bus of pci device
|
mov bh, [V_Bus]
|
||||||
mov ch , byte [V_Dev] ; device number/function
|
mov ch, [V_Dev]
|
||||||
mov cl, 0 ; offset to device/vendor id
|
mov cl, 0 ; offset to device/vendor id
|
||||||
mcall 62 ; get ID's
|
mcall 62 ; get ID's
|
||||||
|
|
||||||
cmp ax, 0 ; Vendor ID should not be 0 or 0xFFFF
|
cmp ax, 0 ; Vendor ID should not be 0 or 0xFFFF
|
||||||
je nextDev ; check next device if nothing exists here
|
je nextDev ; check next device if nothing exists here
|
||||||
|
|
||||||
cmp ax, 0xffff ;
|
cmp ax, 0xffff ;
|
||||||
je nextDev ;
|
je nextDev ;
|
||||||
|
|
||||||
mov word [PCI_Vendor], ax ; There is a device here, save the ID's
|
mov [PCI_Vendor], ax ; There is a device here, save the ID's
|
||||||
shr eax, 16 ;
|
shr eax, 16 ;
|
||||||
mov word [PCI_Device], ax ;
|
mov [PCI_Device], ax ;
|
||||||
mov bl, 4 ; Read config byte
|
mov bl, 4 ; Read config byte
|
||||||
mov bh , byte [V_Bus] ; Bus #
|
mov bh, [V_Bus] ; Bus #
|
||||||
mov ch , byte [V_Dev] ; Device # on bus
|
mov ch, [V_Dev] ; Device # on bus
|
||||||
mov cl, 0x08 ; Register to read (Get Revision)
|
mov cl, 0x08 ; Register to read (Get Revision)
|
||||||
mcall 62 ; Read it
|
mcall 62 ; Read it
|
||||||
mov byte [PCI_Rev], al ; Save it
|
mov [PCI_Rev], al ; Save it
|
||||||
mov cl, 0x0b ; Register to read (Get class)
|
mov cl, 0x0b ; Register to read (Get class)
|
||||||
mcall 62 ; Read it
|
mcall 62 ; Read it
|
||||||
|
|
||||||
mov byte [PCI_Class], al ; Save it
|
mov [PCI_Class], al ; Save it
|
||||||
mov cl, 0x0a ; Register to read (Get Subclass)
|
mov cl, 0x0a ; Register to read (Get Subclass)
|
||||||
mcall 62 ; Read it
|
mcall 62 ; Read it
|
||||||
mov byte [PCI_SubClass], al ; Save it
|
mov [PCI_SubClass], al ; Save it
|
||||||
mov cl, 0x09 ; Register to read (Get Interface)
|
mov cl, 0x09 ; Register to read (Get Interface)
|
||||||
mcall 62 ; Read it
|
mcall 62 ; Read it
|
||||||
mov [PCI_Interface], al ; Save it
|
mov [PCI_Interface], al ; Save it
|
||||||
@ -273,19 +276,19 @@ Start_Enum:
|
|||||||
js nextDev
|
js nextDev
|
||||||
|
|
||||||
nextdev2:
|
nextdev2:
|
||||||
test byte [V_Dev], 7
|
test [V_Dev], 7
|
||||||
jnz nextDev
|
jnz nextDev
|
||||||
|
|
||||||
or byte [V_Dev], 7
|
or [V_Dev], 7
|
||||||
|
|
||||||
nextDev:
|
nextDev:
|
||||||
inc [V_Dev] ; lower 3 bits are the function number
|
inc [V_Dev] ; lower 3 bits are the function number
|
||||||
|
|
||||||
jnz Start_Enum ; jump until we reach zero
|
jnz Start_Enum ; jump until we reach zero
|
||||||
mov byte [V_Dev], 0 ; reset device number
|
|
||||||
inc byte [V_Bus] ; next bus
|
mov [V_Dev], 0 ; reset device number
|
||||||
mov al , byte [PCI_LastBus] ; get last bus
|
inc [V_Bus] ; next bus
|
||||||
cmp byte [V_Bus], al ; was it last bus
|
mov al, [PCI_LastBus] ; get last bus
|
||||||
|
cmp [V_Bus], al ; was it last bus
|
||||||
jbe Start_Enum ; if not jump to keep searching
|
jbe Start_Enum ; if not jump to keep searching
|
||||||
ret
|
ret
|
||||||
|
|
||||||
@ -338,12 +341,12 @@ Print_New_Device:
|
|||||||
shl ecx, 16
|
shl ecx, 16
|
||||||
add ecx, 9
|
add ecx, 9
|
||||||
|
|
||||||
movzx edx, byte [V_Bus]
|
xor edx, edx
|
||||||
shl dx , 8
|
mov dh, [V_Bus]
|
||||||
mov dl , byte [V_Dev]
|
mov dl, [V_Dev]
|
||||||
|
|
||||||
mov esi, 0x0000c0ff ; color: yellow if selected, blue otherwise
|
mov esi, 0x0000c0ff ; color: yellow if selected, blue otherwise
|
||||||
cmp word [selected], dx
|
cmp [selected], dx
|
||||||
jne @f
|
jne @f
|
||||||
mov esi, 0x00c0c000
|
mov esi, 0x00c0c000
|
||||||
@@:
|
@@:
|
||||||
@ -355,24 +358,24 @@ Print_New_Device:
|
|||||||
pop edx
|
pop edx
|
||||||
|
|
||||||
xor esi, esi ; Color of text
|
xor esi, esi ; Color of text
|
||||||
movzx ecx, word [PCI_Vendor] ; number to be written
|
movzx ecx, [PCI_Vendor] ; number to be written
|
||||||
mcall 47, 0x00040100 ; Write Vendor ID
|
mcall 47, 0x00040100 ; Write Vendor ID
|
||||||
|
|
||||||
add edx, (4*6+18) shl 16
|
add edx, (4*6+18) shl 16
|
||||||
movzx ecx, word [PCI_Device] ; get Vendor ID
|
movzx ecx, [PCI_Device] ; get Vendor ID
|
||||||
mcall ; Draw Vendor ID to Window
|
mcall ; Draw Vendor ID to Window
|
||||||
|
|
||||||
add edx, (4*6+18) shl 16
|
add edx, (4*6+18) shl 16
|
||||||
movzx ecx, byte [V_Bus] ; get bus number
|
movzx ecx, [V_Bus]
|
||||||
mcall ,0x00020100 ; draw bus number to screen
|
mcall ,0x00020100 ; draw bus number to screen
|
||||||
|
|
||||||
add edx, (2*6+18) shl 16
|
add edx, (2*6+18) shl 16
|
||||||
movzx ecx, byte [V_Dev] ; get device number
|
movzx ecx, [V_Dev]
|
||||||
shr ecx, 3 ; device number is bits 3-7
|
shr ecx, 3 ; device number is bits 3-7
|
||||||
mcall ; Draw device Number To Window
|
mcall ; Draw device Number To Window
|
||||||
|
|
||||||
add edx, (2*6+18) shl 16
|
add edx, (2*6+18) shl 16
|
||||||
movzx ecx, byte [PCI_Rev] ; get revision number
|
movzx ecx, [PCI_Rev]
|
||||||
mcall ; Draw Revision to screen
|
mcall ; Draw Revision to screen
|
||||||
|
|
||||||
add edx, (2*6+18) shl 16
|
add edx, (2*6+18) shl 16
|
||||||
@ -390,7 +393,7 @@ Print_New_Device:
|
|||||||
; Prints the Vendor's Name based on Vendor ID
|
; Prints the Vendor's Name based on Vendor ID
|
||||||
;------------------------------------------------------------------
|
;------------------------------------------------------------------
|
||||||
mov edx, VendorsTab
|
mov edx, VendorsTab
|
||||||
mov cx , word[PCI_Vendor]
|
mov cx, [PCI_Vendor]
|
||||||
|
|
||||||
.fn: mov ax, [edx]
|
.fn: mov ax, [edx]
|
||||||
add edx, 6
|
add edx, 6
|
||||||
@ -539,12 +542,14 @@ V_Bus db ?
|
|||||||
V_Dev db ?
|
V_Dev db ?
|
||||||
PCI_Version dw ?
|
PCI_Version dw ?
|
||||||
PCI_LastBus db ?
|
PCI_LastBus db ?
|
||||||
|
; Dont change order
|
||||||
PCI_Vendor dw ?
|
PCI_Vendor dw ?
|
||||||
PCI_Device dw ?
|
PCI_Device dw ?
|
||||||
|
|
||||||
PCI_Bus db ?
|
PCI_Bus db ?
|
||||||
PCI_Dev db ?
|
PCI_Dev db ?
|
||||||
PCI_Rev db ?
|
PCI_Rev db ?
|
||||||
; don`t change order!!!
|
; Dont change order
|
||||||
PCI_Class db ?
|
PCI_Class db ?
|
||||||
PCI_SubClass db ?
|
PCI_SubClass db ?
|
||||||
PCI_Interface db ?
|
PCI_Interface db ?
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user