2013-06-07 21:26:03 +04:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;; ;;
|
2016-11-15 23:29:47 +03:00
|
|
|
;; Copyright (C) KolibriOS team 2010-2016. All rights reserved. ;;
|
2013-06-07 21:26:03 +04:00
|
|
|
;; Distributed under terms of the GNU General Public License ;;
|
|
|
|
;; ;;
|
|
|
|
;; netcfg.asm - Network driver control center for KolibriOS ;;
|
|
|
|
;; ;;
|
|
|
|
;; Written by hidnplayr@kolibrios.org ;;
|
|
|
|
;; ;;
|
|
|
|
;; GNU GENERAL PUBLIC LICENSE ;;
|
|
|
|
;; Version 2, June 1991 ;;
|
|
|
|
;; ;;
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
2013-05-28 21:34:26 +04:00
|
|
|
|
|
|
|
format binary as ""
|
|
|
|
|
2016-11-15 23:29:47 +03:00
|
|
|
__DEBUG__ = 1
|
|
|
|
__DEBUG_LEVEL__ = 1
|
|
|
|
|
2013-05-28 21:34:26 +04:00
|
|
|
use32
|
|
|
|
org 0x0
|
|
|
|
|
2014-04-08 00:31:09 +04:00
|
|
|
db 'MENUET01' ; 8 byte id
|
|
|
|
dd 0x01 ; header version
|
|
|
|
dd START ; start of code
|
|
|
|
dd IM_END ; size of image
|
|
|
|
dd (I_END+0x100) ; memory for app
|
|
|
|
dd (I_END+0x100) ; esp
|
2013-05-28 21:34:26 +04:00
|
|
|
dd param, 0x0 ; I_Param , I_Icon
|
|
|
|
|
2013-06-07 21:26:03 +04:00
|
|
|
include '../../macros.inc'
|
2016-11-15 23:29:47 +03:00
|
|
|
include '../../debug-fdo.inc'
|
2013-05-28 21:34:26 +04:00
|
|
|
|
|
|
|
START:
|
|
|
|
; first, check boot parameters
|
|
|
|
|
|
|
|
cmp byte[param], 0
|
|
|
|
je .noparams
|
|
|
|
|
|
|
|
mcall 40, 0
|
|
|
|
|
|
|
|
push .exit
|
|
|
|
cmp byte[param], 'A' ; A for All
|
|
|
|
je Get_PCI_Info
|
|
|
|
|
|
|
|
cmp byte[param], 'F' ; F for First
|
|
|
|
je Get_PCI_Info
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
.exit:
|
|
|
|
mcall -1
|
|
|
|
|
|
|
|
.noparams:
|
2014-04-08 00:31:09 +04:00
|
|
|
call draw_window
|
2013-05-28 21:34:26 +04:00
|
|
|
|
|
|
|
still:
|
|
|
|
mcall 10 ; wait here for event
|
|
|
|
dec eax ; redraw request ?
|
|
|
|
jz red
|
|
|
|
dec eax ; key in buffer ?
|
|
|
|
jz key
|
|
|
|
dec eax ; button in buffer ?
|
|
|
|
jz button
|
|
|
|
jmp still
|
|
|
|
|
|
|
|
red: ; redraw
|
|
|
|
mcall 9, Proc_Info, -1 ; window redraw requested so get new window coordinates and size
|
|
|
|
mov eax, [Proc_Info.box.left]; store the window coordinates into the Form Structure
|
|
|
|
mov [Form + 2], ax ; x start position
|
|
|
|
mov eax, [Proc_Info.box.top];
|
|
|
|
mov [Form + 6], ax ; ystart position
|
|
|
|
mov eax, [Proc_Info.box.width] ;
|
|
|
|
mov [Form], ax ; window width
|
|
|
|
mov eax, [Proc_Info.box.height] ;
|
|
|
|
mov [Form + 4] ,ax ; window height
|
|
|
|
call draw_window ; go redraw window now
|
|
|
|
jmp still
|
|
|
|
|
|
|
|
key: ; key
|
|
|
|
mcall 2 ; just read it and ignore
|
|
|
|
jmp still
|
|
|
|
button: ; button
|
|
|
|
mcall 17 ; get id
|
|
|
|
|
|
|
|
cmp ah, 1 ; button id = 1 ?
|
|
|
|
jne @f
|
2014-04-08 00:31:09 +04:00
|
|
|
exit:
|
|
|
|
mcall -1 ; close this program
|
2013-05-28 21:34:26 +04:00
|
|
|
@@:
|
2014-04-08 00:31:09 +04:00
|
|
|
cmp eax, 0x0000ff00
|
2013-05-28 21:34:26 +04:00
|
|
|
jg load_drv
|
|
|
|
|
|
|
|
cmp ah, 4
|
|
|
|
je hook
|
|
|
|
|
|
|
|
cmp ah, 5
|
|
|
|
je reset
|
|
|
|
|
|
|
|
cmp ah, 6
|
|
|
|
je unload
|
|
|
|
|
|
|
|
jmp still
|
|
|
|
|
|
|
|
|
|
|
|
load_drv:
|
|
|
|
shr eax, 16
|
2014-04-08 00:31:09 +04:00
|
|
|
mov [selected], ax
|
2013-05-28 21:34:26 +04:00
|
|
|
|
2014-04-08 00:31:09 +04:00
|
|
|
mov bl, 6 ; get a dword
|
|
|
|
mov bh, ah ; bus
|
|
|
|
mov ch, al ; dev
|
|
|
|
mov cl, 0 ; offset to device/vendor id
|
2013-05-28 21:34:26 +04:00
|
|
|
mcall 62 ; get ID's
|
|
|
|
|
2014-04-08 00:31:09 +04:00
|
|
|
mov [PCI_Vendor], ax
|
2013-05-28 21:34:26 +04:00
|
|
|
shr eax, 16
|
2014-04-08 00:31:09 +04:00
|
|
|
mov [PCI_Device], ax
|
2013-05-28 21:34:26 +04:00
|
|
|
call get_drv_ptr
|
|
|
|
|
|
|
|
mov ecx, eax
|
|
|
|
mcall 68, 16
|
|
|
|
|
|
|
|
mov [IOCTL.handle], eax
|
|
|
|
|
|
|
|
call draw_window
|
|
|
|
|
|
|
|
cmp [IOCTL.handle], 0
|
|
|
|
jne still
|
|
|
|
|
|
|
|
mcall 4, 20 shl 16 + 30, 1 shl 31 + 0x00ff0000 , load_error
|
|
|
|
|
|
|
|
jmp still
|
|
|
|
|
|
|
|
|
|
|
|
hook:
|
2014-04-08 00:31:09 +04:00
|
|
|
mov ax, [selected]
|
|
|
|
test ax, ax
|
2013-05-28 21:34:26 +04:00
|
|
|
jz still
|
|
|
|
|
|
|
|
mov [hardwareinfo.pci_dev], al
|
|
|
|
mov [hardwareinfo.pci_bus], ah
|
|
|
|
|
|
|
|
mov [IOCTL.io_code], 1 ; SRV_HOOK
|
|
|
|
mov [IOCTL.inp_size], 3
|
|
|
|
mov [IOCTL.input], hardwareinfo
|
|
|
|
mov [IOCTL.out_size], 0
|
|
|
|
mov [IOCTL.output], 0
|
|
|
|
|
|
|
|
mcall 68, 17, IOCTL
|
2014-04-08 00:31:09 +04:00
|
|
|
mov [drivernumber], al
|
2013-05-28 21:34:26 +04:00
|
|
|
|
|
|
|
jmp still
|
|
|
|
|
|
|
|
reset:
|
2014-04-08 00:31:09 +04:00
|
|
|
movzx ebx, [drivernumber]
|
2013-05-28 21:34:26 +04:00
|
|
|
mcall 74,,2
|
|
|
|
|
|
|
|
jmp still
|
|
|
|
|
|
|
|
unload:
|
2014-04-08 00:31:09 +04:00
|
|
|
movzx ebx, [drivernumber]
|
2013-05-28 21:34:26 +04:00
|
|
|
mcall 74,,3
|
|
|
|
|
|
|
|
jmp still
|
|
|
|
|
|
|
|
draw_window:
|
|
|
|
mcall 12, 1 ; start of draw
|
2014-04-08 00:31:09 +04:00
|
|
|
mcall 0, dword[Form], dword[Form + 4], 0x13ffffff, 0x805080d0, title
|
2013-05-28 21:34:26 +04:00
|
|
|
|
|
|
|
call Get_PCI_Info ; get pci version and last bus, scan for and draw each pci device
|
|
|
|
|
|
|
|
cmp edx, 20 shl 16 + 110
|
|
|
|
je .nonefound
|
|
|
|
|
2014-04-08 00:31:09 +04:00
|
|
|
mcall 4, 20 shl 16 + 100, 1 shl 31 + 0x00000000, caption
|
2013-05-28 21:34:26 +04:00
|
|
|
|
|
|
|
cmp [selected], 0
|
|
|
|
jz .done
|
|
|
|
cmp [IOCTL.handle] ,0
|
|
|
|
jz .done
|
|
|
|
|
|
|
|
mcall 8, 18 shl 16 + 100, 35 shl 16 + 18, 4, 0x00007f00
|
|
|
|
mcall ,, 55 shl 16 + 18, 5, 0x0000007f
|
|
|
|
mcall ,, 75 shl 16 + 18, 6, 0x007f0000
|
|
|
|
|
2014-04-08 00:31:09 +04:00
|
|
|
mcall 4, 33 shl 16 + 42, 1 shl 31 + 0x00ffffff, btn_start
|
2013-05-28 21:34:26 +04:00
|
|
|
mcall , 33 shl 16 + 62, , btn_reset
|
|
|
|
mcall , 36 shl 16 + 82, , btn_stop
|
|
|
|
|
|
|
|
jmp .done
|
|
|
|
|
|
|
|
.nonefound:
|
2014-04-08 00:31:09 +04:00
|
|
|
mcall 4, 20 shl 16 + 30, 1 shl 31 + 0x00ff0000, nonefound
|
2013-05-28 21:34:26 +04:00
|
|
|
.done:
|
|
|
|
mcall 12, 2 ; end of draw
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;------------------------------------------------------------------
|
|
|
|
;* Gets the PCI Version and Last Bus
|
|
|
|
Get_PCI_Info:
|
|
|
|
mcall 62, 0
|
2014-04-08 00:31:09 +04:00
|
|
|
mov [PCI_Version], ax
|
2013-05-28 21:34:26 +04:00
|
|
|
mcall 62, 1
|
2014-04-08 00:31:09 +04:00
|
|
|
mov [PCI_LastBus], al
|
2013-05-28 21:34:26 +04:00
|
|
|
;----------------------------------------------------------
|
|
|
|
;* Get all devices on PCI Bus
|
2014-04-08 00:31:09 +04:00
|
|
|
cmp al, 0xff ; 0xFF means no pci bus found
|
2013-05-28 21:34:26 +04:00
|
|
|
jne Pci_Exists ;
|
|
|
|
ret ; if no bus then leave
|
2014-04-08 00:31:09 +04:00
|
|
|
|
2013-05-28 21:34:26 +04:00
|
|
|
Pci_Exists:
|
2014-04-08 00:31:09 +04:00
|
|
|
mov [V_Bus], 0
|
|
|
|
mov [V_Dev], 0
|
|
|
|
mov edx, 20 shl 16 + 110 ; set start write position
|
|
|
|
|
2013-05-28 21:34:26 +04:00
|
|
|
Start_Enum:
|
2014-04-08 00:31:09 +04:00
|
|
|
mov bl, 6 ; read dword
|
|
|
|
mov bh, [V_Bus]
|
|
|
|
mov ch, [V_Dev]
|
|
|
|
mov cl, 0 ; offset to device/vendor id
|
2013-05-28 21:34:26 +04:00
|
|
|
mcall 62 ; get ID's
|
|
|
|
|
|
|
|
cmp ax, 0 ; Vendor ID should not be 0 or 0xFFFF
|
2014-11-04 18:52:56 +03:00
|
|
|
je .nextDev ; check next device if nothing exists here
|
2013-05-28 21:34:26 +04:00
|
|
|
cmp ax, 0xffff ;
|
2014-11-04 18:52:56 +03:00
|
|
|
je .nextDev ;
|
2013-05-28 21:34:26 +04:00
|
|
|
|
2014-04-08 00:31:09 +04:00
|
|
|
mov [PCI_Vendor], ax ; There is a device here, save the ID's
|
2013-05-28 21:34:26 +04:00
|
|
|
shr eax, 16 ;
|
2014-04-08 00:31:09 +04:00
|
|
|
mov [PCI_Device], ax ;
|
|
|
|
mov bl, 4 ; Read config byte
|
|
|
|
mov bh, [V_Bus] ; Bus #
|
|
|
|
mov ch, [V_Dev] ; Device # on bus
|
|
|
|
mov cl, 0x08 ; Register to read (Get Revision)
|
2013-05-28 21:34:26 +04:00
|
|
|
mcall 62 ; Read it
|
2014-04-08 00:31:09 +04:00
|
|
|
mov [PCI_Rev], al ; Save it
|
2014-11-04 18:52:56 +03:00
|
|
|
|
2014-04-08 00:31:09 +04:00
|
|
|
mov cl, 0x0b ; Register to read (Get class)
|
2013-05-28 21:34:26 +04:00
|
|
|
mcall 62 ; Read it
|
2014-04-08 00:31:09 +04:00
|
|
|
mov [PCI_Class], al ; Save it
|
2014-11-04 18:52:56 +03:00
|
|
|
|
2014-04-08 00:31:09 +04:00
|
|
|
mov cl, 0x0a ; Register to read (Get Subclass)
|
2013-05-28 21:34:26 +04:00
|
|
|
mcall 62 ; Read it
|
2014-04-08 00:31:09 +04:00
|
|
|
mov [PCI_SubClass], al ; Save it
|
2014-11-04 18:52:56 +03:00
|
|
|
|
2014-04-08 00:31:09 +04:00
|
|
|
mov cl, 0x09 ; Register to read (Get Interface)
|
2013-05-28 21:34:26 +04:00
|
|
|
mcall 62 ; Read it
|
|
|
|
mov [PCI_Interface], al ; Save it
|
2014-11-04 18:52:56 +03:00
|
|
|
|
2014-04-08 00:31:09 +04:00
|
|
|
mov cl, 0x3c ; Register to read (Get IRQ)
|
2014-11-04 18:52:56 +03:00
|
|
|
mcall 62 ; Read it
|
2013-05-28 21:34:26 +04:00
|
|
|
mov [PCI_IRQ], al ; Save it
|
|
|
|
|
2014-11-04 18:52:56 +03:00
|
|
|
; Could it be a network card?
|
2014-01-23 03:40:31 +04:00
|
|
|
cmp [PCI_Class], 2 ; network controller
|
2014-11-04 18:52:56 +03:00
|
|
|
je .found
|
2013-06-07 21:26:03 +04:00
|
|
|
|
2014-01-23 03:40:31 +04:00
|
|
|
cmp [PCI_Class], 6 ; bridge type device
|
2014-11-04 18:52:56 +03:00
|
|
|
jne .nextDev
|
2014-01-23 03:40:31 +04:00
|
|
|
cmp [PCI_SubClass], 0x80 ; PCI-other bridge (for nvidia chipset)
|
2014-11-04 18:52:56 +03:00
|
|
|
jne .nextDev
|
2014-01-23 03:40:31 +04:00
|
|
|
cmp [PCI_Vendor], 0x10DE ; nvidia
|
2014-11-04 18:52:56 +03:00
|
|
|
jne .nextDev
|
2013-05-28 21:34:26 +04:00
|
|
|
|
2014-11-04 18:52:56 +03:00
|
|
|
.found:
|
|
|
|
cmp byte[param], 0 ; Load network driver immediately?
|
2013-05-28 21:34:26 +04:00
|
|
|
jne load_and_start
|
|
|
|
|
2014-11-04 18:52:56 +03:00
|
|
|
call Print_New_Device ; print device info to screen
|
|
|
|
|
|
|
|
.nextDev:
|
|
|
|
test [V_Dev], 7
|
|
|
|
jnz .nextFn
|
|
|
|
|
|
|
|
; Is this a multifunction device?
|
|
|
|
mov bl, 4 ; Read config byte
|
|
|
|
mov bh, [V_Bus] ; Bus #
|
|
|
|
mov ch, [V_Dev] ; Device # on bus
|
2013-05-28 21:34:26 +04:00
|
|
|
mov cl, 0x0e
|
|
|
|
mcall 62
|
|
|
|
test al, al
|
2014-11-04 18:52:56 +03:00
|
|
|
js .nextFn
|
2013-05-28 21:34:26 +04:00
|
|
|
|
2014-11-04 18:52:56 +03:00
|
|
|
; Not a multifunction device, go to the next device
|
2014-04-08 00:31:09 +04:00
|
|
|
or [V_Dev], 7
|
2013-05-28 21:34:26 +04:00
|
|
|
|
2014-11-04 18:52:56 +03:00
|
|
|
.nextFn:
|
2013-05-28 21:34:26 +04:00
|
|
|
inc [V_Dev] ; lower 3 bits are the function number
|
|
|
|
jnz Start_Enum ; jump until we reach zero
|
2014-04-08 00:31:09 +04:00
|
|
|
|
|
|
|
mov [V_Dev], 0 ; reset device number
|
|
|
|
inc [V_Bus] ; next bus
|
|
|
|
mov al, [PCI_LastBus] ; get last bus
|
|
|
|
cmp [V_Bus], al ; was it last bus
|
2013-05-28 21:34:26 +04:00
|
|
|
jbe Start_Enum ; if not jump to keep searching
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
load_and_start:
|
|
|
|
|
|
|
|
call get_drv_ptr
|
|
|
|
cmp eax, lbl_none
|
2016-11-15 23:29:47 +03:00
|
|
|
je .notsupp
|
2013-05-28 21:34:26 +04:00
|
|
|
|
|
|
|
mov ecx, eax
|
|
|
|
mcall 68, 16
|
|
|
|
test eax, eax
|
2016-11-15 23:29:47 +03:00
|
|
|
jz .fail
|
2013-05-28 21:34:26 +04:00
|
|
|
mov [IOCTL.handle], eax
|
|
|
|
|
|
|
|
mov al, [V_Dev]
|
|
|
|
mov [hardwareinfo.pci_dev], al
|
|
|
|
mov al, [V_Bus]
|
|
|
|
mov [hardwareinfo.pci_bus], al
|
|
|
|
|
|
|
|
mov [IOCTL.io_code], 1 ; SRV_HOOK
|
|
|
|
mov [IOCTL.inp_size], 3
|
|
|
|
mov [IOCTL.input], hardwareinfo
|
|
|
|
mov [IOCTL.out_size], 0
|
|
|
|
mov [IOCTL.output], 0
|
|
|
|
|
|
|
|
mcall 68, 17, IOCTL
|
|
|
|
|
2016-11-15 23:29:47 +03:00
|
|
|
.next:
|
2013-05-28 21:34:26 +04:00
|
|
|
cmp byte[param], 'A'
|
2014-11-04 18:52:56 +03:00
|
|
|
je Start_Enum.nextDev
|
2013-05-28 21:34:26 +04:00
|
|
|
jmp exit
|
|
|
|
|
2016-11-15 23:29:47 +03:00
|
|
|
.fail:
|
|
|
|
DEBUGF 1,"Could not load network driver %s\n", ecx
|
|
|
|
jmp .next
|
|
|
|
|
|
|
|
.notsupp:
|
|
|
|
DEBUGF 1,"Unsupported PCI network card detected: 0x%x:0x%x\n", [PCI_Vendor]:4, [PCI_Device]:4
|
|
|
|
jmp .next
|
|
|
|
|
2013-05-28 21:34:26 +04:00
|
|
|
|
|
|
|
|
|
|
|
;------------------------------------------------------------------
|
|
|
|
;* Print device info to screen
|
|
|
|
Print_New_Device:
|
|
|
|
|
|
|
|
push edx ; Magic ! (to print a button...)
|
|
|
|
|
|
|
|
mov ebx, 18 shl 16
|
2014-04-08 00:31:09 +04:00
|
|
|
mov bx, [Form]
|
|
|
|
sub bx, 36
|
2013-05-28 21:34:26 +04:00
|
|
|
|
2014-04-08 00:31:09 +04:00
|
|
|
mov cx, dx
|
2013-05-28 21:34:26 +04:00
|
|
|
dec cx
|
|
|
|
shl ecx, 16
|
|
|
|
add ecx, 9
|
|
|
|
|
2014-04-08 00:31:09 +04:00
|
|
|
xor edx, edx
|
|
|
|
mov dh, [V_Bus]
|
|
|
|
mov dl, [V_Dev]
|
2013-05-28 21:34:26 +04:00
|
|
|
|
|
|
|
mov esi, 0x0000c0ff ; color: yellow if selected, blue otherwise
|
2014-04-08 00:31:09 +04:00
|
|
|
cmp [selected], dx
|
2013-05-28 21:34:26 +04:00
|
|
|
jne @f
|
|
|
|
mov esi, 0x00c0c000
|
|
|
|
@@:
|
|
|
|
|
|
|
|
shl edx, 8
|
2014-04-08 00:31:09 +04:00
|
|
|
or dl, 0xff
|
2013-05-28 21:34:26 +04:00
|
|
|
|
|
|
|
mcall 8
|
|
|
|
pop edx
|
|
|
|
|
|
|
|
xor esi, esi ; Color of text
|
2014-04-08 00:31:09 +04:00
|
|
|
movzx ecx, [PCI_Vendor] ; number to be written
|
2013-05-28 21:34:26 +04:00
|
|
|
mcall 47, 0x00040100 ; Write Vendor ID
|
|
|
|
|
|
|
|
add edx, (4*6+18) shl 16
|
2014-04-08 00:31:09 +04:00
|
|
|
movzx ecx, [PCI_Device] ; get Vendor ID
|
2013-05-28 21:34:26 +04:00
|
|
|
mcall ; Draw Vendor ID to Window
|
|
|
|
|
|
|
|
add edx, (4*6+18) shl 16
|
2014-04-08 00:31:09 +04:00
|
|
|
movzx ecx, [V_Bus]
|
2013-05-28 21:34:26 +04:00
|
|
|
mcall ,0x00020100 ; draw bus number to screen
|
|
|
|
|
|
|
|
add edx, (2*6+18) shl 16
|
2014-04-08 00:31:09 +04:00
|
|
|
movzx ecx, [V_Dev]
|
2013-05-28 21:34:26 +04:00
|
|
|
shr ecx, 3 ; device number is bits 3-7
|
|
|
|
mcall ; Draw device Number To Window
|
|
|
|
|
|
|
|
add edx, (2*6+18) shl 16
|
2014-04-08 00:31:09 +04:00
|
|
|
movzx ecx, [PCI_Rev]
|
2013-05-28 21:34:26 +04:00
|
|
|
mcall ; Draw Revision to screen
|
|
|
|
|
|
|
|
add edx, (2*6+18) shl 16
|
|
|
|
movzx ecx, [PCI_IRQ]
|
2014-04-08 00:31:09 +04:00
|
|
|
cmp cl, 0x0f ; IRQ must be between 0 and 15
|
2013-05-28 21:34:26 +04:00
|
|
|
ja @f
|
|
|
|
mcall
|
|
|
|
@@:
|
|
|
|
;
|
|
|
|
;Write Names
|
|
|
|
movzx ebx, dx ; Set y position
|
|
|
|
or ebx, 230 shl 16 ; set Xposition
|
|
|
|
|
|
|
|
;------------------------------------------------------------------
|
|
|
|
; Prints the Vendor's Name based on Vendor ID
|
|
|
|
;------------------------------------------------------------------
|
|
|
|
mov edx, VendorsTab
|
2014-04-08 00:31:09 +04:00
|
|
|
mov cx, [PCI_Vendor]
|
2013-05-28 21:34:26 +04:00
|
|
|
|
2014-04-08 00:31:09 +04:00
|
|
|
.fn: mov ax, [edx]
|
2013-05-28 21:34:26 +04:00
|
|
|
add edx, 6
|
2014-04-08 00:31:09 +04:00
|
|
|
test ax, ax
|
2013-05-28 21:34:26 +04:00
|
|
|
jz .find
|
2014-04-08 00:31:09 +04:00
|
|
|
cmp ax, cx
|
2013-05-28 21:34:26 +04:00
|
|
|
jne .fn
|
|
|
|
.find: mov edx, [edx - 4]
|
|
|
|
mcall 4,, 0x80000000 ; lets print the vendor Name
|
|
|
|
|
|
|
|
;------------------------------------------------------------------
|
|
|
|
; Get description based on Class/Subclass
|
|
|
|
;------------------------------------------------------------------
|
2014-04-08 00:31:09 +04:00
|
|
|
mov eax, dword[PCI_Class]
|
2013-05-28 21:34:26 +04:00
|
|
|
and eax, 0xffffff
|
|
|
|
xor edx, edx
|
|
|
|
xor esi, esi
|
|
|
|
.fnc: inc esi
|
|
|
|
mov ecx, [Classes + esi * 8 - 8]
|
|
|
|
cmp cx , 0xffff
|
|
|
|
je .endfc
|
|
|
|
cmp cx , ax
|
|
|
|
jne .fnc
|
|
|
|
test ecx, 0xff000000
|
|
|
|
jz @f
|
|
|
|
mov edx, [Classes + esi * 8 - 4]
|
|
|
|
jmp .fnc
|
|
|
|
@@: cmp eax, ecx
|
|
|
|
jne .fnc
|
|
|
|
xor edx, edx
|
|
|
|
.endfc: test edx, edx
|
|
|
|
jnz @f
|
|
|
|
mov edx, [Classes + esi * 8 - 4]
|
|
|
|
@@:
|
|
|
|
add ebx, 288 shl 16
|
|
|
|
mcall 4,, 0x80000000,, 32 ; draw the text
|
|
|
|
movzx edx, bx ; get y coordinate
|
|
|
|
add edx, 0x0014000A ; add 10 to y coordinate and set x coordinate to 20
|
|
|
|
|
|
|
|
;------------------------------------------------------------------
|
|
|
|
; Print Driver Name
|
|
|
|
;------------------------------------------------------------------
|
|
|
|
push edx
|
|
|
|
add ebx, 120 shl 16
|
|
|
|
push ebx
|
|
|
|
|
|
|
|
call get_drv_ptr
|
|
|
|
mov edx, eax
|
|
|
|
pop ebx
|
|
|
|
mcall 4,,0x80000000 ; lets print the vendor Name
|
|
|
|
pop edx
|
|
|
|
ret
|
|
|
|
|
|
|
|
get_drv_ptr:
|
|
|
|
mov eax, driverlist ; eax will be the pointer to latest driver title
|
|
|
|
mov ebx, driverlist ; ebx is the current pointer
|
|
|
|
mov ecx, dword[PCI_Vendor] ; the device/vendor id of we want to find
|
|
|
|
|
2016-11-15 23:29:47 +03:00
|
|
|
.driverloop:
|
2013-05-28 21:34:26 +04:00
|
|
|
inc ebx
|
2016-11-15 23:29:47 +03:00
|
|
|
cmp byte[ebx], 0
|
|
|
|
jne .driverloop
|
2013-05-28 21:34:26 +04:00
|
|
|
inc ebx ; the device/vendor id list for the driver eax is pointing to starts here.
|
|
|
|
|
2016-11-15 23:29:47 +03:00
|
|
|
.deviceloop:
|
|
|
|
cmp dword[ebx], 0
|
|
|
|
je .nextdriver
|
|
|
|
cmp dword[ebx], ecx
|
|
|
|
je .driverfound
|
2014-04-08 00:31:09 +04:00
|
|
|
add ebx, 4
|
2016-11-15 23:29:47 +03:00
|
|
|
jmp .deviceloop
|
2013-05-28 21:34:26 +04:00
|
|
|
|
2016-11-15 23:29:47 +03:00
|
|
|
.nextdriver:
|
2014-04-08 00:31:09 +04:00
|
|
|
add ebx, 4
|
2016-11-15 23:29:47 +03:00
|
|
|
cmp dword[ebx], 0
|
|
|
|
je .nodriver
|
|
|
|
mov eax, ebx
|
|
|
|
jmp .driverloop
|
2013-05-28 21:34:26 +04:00
|
|
|
|
2016-11-15 23:29:47 +03:00
|
|
|
.nodriver:
|
2013-05-28 21:34:26 +04:00
|
|
|
mov eax, lbl_none ; lets print the vendor Name
|
|
|
|
ret
|
|
|
|
|
2016-11-15 23:29:47 +03:00
|
|
|
.driverfound:
|
2013-05-28 21:34:26 +04:00
|
|
|
ret
|
|
|
|
|
|
|
|
include 'vendors.inc'
|
|
|
|
include 'drivers.inc'
|
|
|
|
|
|
|
|
|
|
|
|
;------------------------------------------------------------------
|
|
|
|
; DATA AREA
|
|
|
|
|
|
|
|
|
|
|
|
DATA
|
|
|
|
|
|
|
|
|
|
|
|
Form: dw 800 ; window width (no more, special for 800x600)
|
|
|
|
dw 100 ; window x start
|
|
|
|
dw 220 ; window height
|
|
|
|
dw 100 ; window y start
|
|
|
|
|
|
|
|
title db 'Network Driver Control Center', 0
|
|
|
|
|
|
|
|
caption db 'Vendor Device Bus Dev Rev IRQ Company Description DRIVER',0
|
|
|
|
nonefound db 'No compatible devices were found!',0
|
|
|
|
btn_start db 'Start device',0
|
|
|
|
btn_reset db 'Reset device',0
|
|
|
|
btn_stop db 'Stop device',0
|
|
|
|
lbl_none db 'none',0
|
2016-11-15 23:29:47 +03:00
|
|
|
load_error db 'Could not load network driver!',0
|
|
|
|
|
|
|
|
include_debug_strings
|
2013-05-28 21:34:26 +04:00
|
|
|
|
|
|
|
hardwareinfo:
|
|
|
|
.type db 1 ; pci
|
|
|
|
.pci_bus db ?
|
|
|
|
.pci_dev db ?
|
|
|
|
|
|
|
|
|
|
|
|
IM_END:
|
|
|
|
|
|
|
|
;------------------------------------------------------------------
|
|
|
|
; UNINITIALIZED DATA AREA
|
|
|
|
|
|
|
|
|
|
|
|
IOCTL:
|
|
|
|
.handle dd ?
|
|
|
|
.io_code dd ?
|
|
|
|
.input dd ?
|
|
|
|
.inp_size dd ?
|
|
|
|
.output dd ?
|
|
|
|
.out_size dd ?
|
|
|
|
|
|
|
|
drivernumber db ?
|
|
|
|
MAC dp ?
|
|
|
|
|
|
|
|
|
|
|
|
type db ?
|
|
|
|
selected dw ?
|
|
|
|
V_Bus db ?
|
|
|
|
V_Dev db ?
|
|
|
|
PCI_Version dw ?
|
|
|
|
PCI_LastBus db ?
|
2014-04-08 00:31:09 +04:00
|
|
|
; Dont change order
|
2013-05-28 21:34:26 +04:00
|
|
|
PCI_Vendor dw ?
|
|
|
|
PCI_Device dw ?
|
2014-04-08 00:31:09 +04:00
|
|
|
|
2013-05-28 21:34:26 +04:00
|
|
|
PCI_Bus db ?
|
|
|
|
PCI_Dev db ?
|
|
|
|
PCI_Rev db ?
|
2014-04-08 00:31:09 +04:00
|
|
|
; Dont change order
|
2013-05-28 21:34:26 +04:00
|
|
|
PCI_Class db ?
|
|
|
|
PCI_SubClass db ?
|
|
|
|
PCI_Interface db ?
|
|
|
|
PCI_IRQ db ?
|
|
|
|
|
|
|
|
Proc_Info process_information
|
|
|
|
|
|
|
|
param rb 1024
|
|
|
|
|
|
|
|
|
|
|
|
I_END:
|