forked from KolibriOS/kolibrios
PCIDEV 2.3 (changing the number of version given all previous revisions)
1) Save PCI devices list to disk 2) Using OpenDialog for select of path git-svn-id: svn://kolibrios.org@1982 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
f68029cd8f
commit
a68277b75e
@ -2,26 +2,61 @@
|
|||||||
; project name: PCI Device Enumeration
|
; project name: PCI Device Enumeration
|
||||||
; target platform: KolibriOS
|
; target platform: KolibriOS
|
||||||
; compiler: flat assembler 1.68
|
; compiler: flat assembler 1.68
|
||||||
; version: 2.21
|
; version: 2.3
|
||||||
; last update: December 2007
|
; last update: June 2011
|
||||||
; maintained by: Jason Delozier (cordata51@hotmail.com)
|
; maintained by: Jason Delozier (cordata51@hotmail.com)
|
||||||
; Sergey Kuzmin (kuzmin_serg@list.ru)
|
; Sergey Kuzmin (kuzmin_serg@list.ru)
|
||||||
; Mihailov Ilia (ghost.nsk@gmail.com)
|
; Mihailov Ilia (ghost.nsk@gmail.com)
|
||||||
|
; Marat Zakiyanov <mario79@bk.ru>
|
||||||
; Artem Jerdev (art_zh@yahoo.com)
|
; Artem Jerdev (art_zh@yahoo.com)
|
||||||
; project site: http://www.coolthemes.narod.ru/pcidev.html
|
; Evgeny Grechnikov
|
||||||
|
; Veroniña (Clever Mouse)
|
||||||
|
; Yogev Ezra
|
||||||
|
; old project site: http://www.coolthemes.narod.ru/pcidev.html
|
||||||
|
; new project site: http://board.kolibrios.org/viewtopic.php?f=42&t=73
|
||||||
;***************************************************************
|
;***************************************************************
|
||||||
;Summary: This program will attempt to scan the PCI Bus
|
;Summary: This program will attempt to scan the PCI Bus
|
||||||
; and display basic information about each device
|
; and display basic information about each device
|
||||||
; connected to the PCI Bus.
|
; connected to the PCI Bus.
|
||||||
;***************************************************************
|
;***************************************************************
|
||||||
|
;-----------------------------------------------------------------------------
|
||||||
include '../../../macros.inc'
|
include '../../../macros.inc'
|
||||||
;include 'macros.inc'
|
|
||||||
|
|
||||||
MEOS_APP_START
|
include '../../../develop/libraries/box_lib/load_lib.mac'
|
||||||
CODE
|
;-----------------------------------------------------------------------------
|
||||||
|
use32
|
||||||
|
org 0x0
|
||||||
|
db 'MENUET01' ; 8 byte id
|
||||||
|
dd 0x01 ; header version
|
||||||
|
dd START ; start of code
|
||||||
|
dd IM_END ; size of image
|
||||||
|
dd I_END ; memory for app
|
||||||
|
dd stacktop ; esp
|
||||||
|
dd 0 ; I_Param
|
||||||
|
dd path ; APPLICATION PACH
|
||||||
|
;-----------------------------------------------------------------------------
|
||||||
|
@use_library ; load_lib macro
|
||||||
|
;-----------------------------------------------------------------------------
|
||||||
|
START:
|
||||||
|
mcall 68,11
|
||||||
|
mcall 66,1,1
|
||||||
|
;-----------------------------------------------------------------------------
|
||||||
|
load_libraries l_libs_start,end_l_libs
|
||||||
|
;-----------------------------------------------------------------------------
|
||||||
|
;OpenDialog initialisation
|
||||||
|
push dword OpenDialog_data
|
||||||
|
call [OpenDialog_Init]
|
||||||
|
|
||||||
|
mov edi,filename_area
|
||||||
|
mov esi,start_temp_file_name
|
||||||
|
call copy_file_name_path
|
||||||
|
;-----------------------------------------------------------------------------
|
||||||
|
mcall 68,12,4096
|
||||||
|
mov [store_text_area_start],eax
|
||||||
|
;-----------------------------------------------------------------------------
|
||||||
call draw_window
|
call draw_window
|
||||||
|
still:
|
||||||
still: mcall 10 ; wait here for event
|
mcall 10 ; wait here for event
|
||||||
dec eax ; redraw request ?
|
dec eax ; redraw request ?
|
||||||
jz red
|
jz red
|
||||||
dec eax ; key in buffer ?
|
dec eax ; key in buffer ?
|
||||||
@ -29,7 +64,7 @@ still: mcall 10 ; wait here for event
|
|||||||
dec eax ; button in buffer ?
|
dec eax ; button in buffer ?
|
||||||
jz button
|
jz button
|
||||||
jmp still
|
jmp still
|
||||||
|
;-----------------------------------------------------------------------------
|
||||||
red: ; redraw
|
red: ; redraw
|
||||||
mcall 9, Proc_Info, -1 ; window redraw requested so get new window coordinates and size
|
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 eax, [Proc_Info.box.left]; store the window coordinates into the Form Structure
|
||||||
@ -42,21 +77,112 @@ red: ; redraw
|
|||||||
mov [Form + 4] ,ax ; window height
|
mov [Form + 4] ,ax ; window height
|
||||||
call draw_window ; go redraw window now
|
call draw_window ; go redraw window now
|
||||||
jmp still
|
jmp still
|
||||||
|
;-----------------------------------------------------------------------------
|
||||||
key: ; key
|
key: ; key
|
||||||
mcall 2 ; just read it and ignore
|
mcall 2 ; just read it and ignore
|
||||||
|
cmp [extended_key],1
|
||||||
|
je .extended_key
|
||||||
|
test al, al
|
||||||
|
jnz still
|
||||||
|
cmp ah, 0xE0
|
||||||
|
jne @f
|
||||||
|
mov [extended_key],1
|
||||||
jmp still
|
jmp still
|
||||||
|
@@:
|
||||||
|
cmp ah,129 ; Esc
|
||||||
|
je button.exit
|
||||||
|
cmp ah,159
|
||||||
|
je call_OpenDialog
|
||||||
|
jmp still
|
||||||
|
.extended_key:
|
||||||
|
mov [extended_key],0
|
||||||
|
cmp ah,129 ; Esc
|
||||||
|
je button.exit
|
||||||
|
cmp ah,159
|
||||||
|
je call_OpenDialog
|
||||||
|
jmp still
|
||||||
|
;-----------------------------------------------------------------------------
|
||||||
button: ; button
|
button: ; button
|
||||||
mcall 17 ; get id
|
mcall 17 ; get id
|
||||||
|
cmp ah,2
|
||||||
|
je call_OpenDialog
|
||||||
cmp ah, 1 ; button id = 1 ?
|
cmp ah, 1 ; button id = 1 ?
|
||||||
jne still
|
jne still
|
||||||
|
.exit:
|
||||||
mcall -1 ; close this program
|
mcall -1 ; close this program
|
||||||
|
;-----------------------------------------------------------------------------
|
||||||
|
call_OpenDialog:
|
||||||
|
mov [OpenDialog_data.type],1 ; Save
|
||||||
|
|
||||||
|
push dword OpenDialog_data
|
||||||
|
call [OpenDialog_Start]
|
||||||
|
|
||||||
|
cmp [OpenDialog_data.status],2 ; OpenDialog does not start
|
||||||
|
je .save_file_default_path
|
||||||
|
|
||||||
|
cmp [OpenDialog_data.status],1
|
||||||
|
jne still
|
||||||
|
|
||||||
|
call store_data
|
||||||
|
jmp still
|
||||||
|
;----------------------------------------
|
||||||
|
.save_file_default_path:
|
||||||
|
mov edi,file_name
|
||||||
|
mov esi,file_default_path
|
||||||
|
call copy_file_name_path
|
||||||
|
call store_data
|
||||||
|
jmp still
|
||||||
|
;----------------------------------------
|
||||||
|
copy_file_name_path:
|
||||||
|
xor eax,eax
|
||||||
|
cld
|
||||||
|
@@:
|
||||||
|
lodsb
|
||||||
|
stosb
|
||||||
|
test eax,eax
|
||||||
|
jnz @r
|
||||||
|
ret
|
||||||
|
;-----------------------------------------------------------------------------
|
||||||
|
prepare_text_area:
|
||||||
|
mov edi,[store_text_area_start]
|
||||||
|
|
||||||
|
push edi
|
||||||
|
mov ecx,4096/4 ; I hope this will be enough for store of data
|
||||||
|
mov eax,dword ' '
|
||||||
|
cld
|
||||||
|
rep stosd
|
||||||
|
pop edi
|
||||||
|
|
||||||
|
mov esi,PCIWin
|
||||||
|
xor ecx,ecx
|
||||||
|
@@:
|
||||||
|
mov cl,[esi]
|
||||||
|
inc esi
|
||||||
|
rep movsb
|
||||||
|
mov al,0Ah ; CR - carriage return
|
||||||
|
stosb
|
||||||
|
cmp [esi],byte 0xFF
|
||||||
|
jne @r
|
||||||
|
|
||||||
|
mov [store_text_area_end],edi
|
||||||
|
|
||||||
|
xor edi,edi
|
||||||
|
ret
|
||||||
|
;-----------------------------------------------------------------------------
|
||||||
draw_window:
|
draw_window:
|
||||||
|
call prepare_text_area
|
||||||
|
|
||||||
mov byte [total], 0
|
mov byte [total], 0
|
||||||
mcall 12, 1 ; start of draw
|
mcall 12, 1 ; start of draw
|
||||||
; DRAW WINDOW
|
; DRAW WINDOW
|
||||||
mcall 0, dword [Form], dword [Form + 4], 0x13ffffff, 0x805080d0, title
|
mcall 0,dword [Form],dword [Form + 4],0x13ffffff,0x805080d0,title
|
||||||
|
mcall 8,<450,100>,<25,25>,2,0xC0C0C0
|
||||||
|
shr ecx,16
|
||||||
|
mov bx,cx
|
||||||
|
add ebx,13 shl 16+4
|
||||||
|
mcall 4,,0x80000000,text_save_button
|
||||||
|
add bx,11
|
||||||
|
mcall ,,,text_save_button.1
|
||||||
; Insert horizontal bars in list area
|
; Insert horizontal bars in list area
|
||||||
mov eax, 13 ; draw bar system function
|
mov eax, 13 ; draw bar system function
|
||||||
mov ebx, 18 ; set Xstart position of bar
|
mov ebx, 18 ; set Xstart position of bar
|
||||||
@ -75,6 +201,7 @@ again: ;begin draw bar loop
|
|||||||
shl ecx, 16 ; set that values as Ystart
|
shl ecx, 16 ; set that values as Ystart
|
||||||
add ecx, 10 ; Bar Height is always 10 pixels
|
add ecx, 10 ; Bar Height is always 10 pixels
|
||||||
jmp again ; draw another bar
|
jmp again ; draw another bar
|
||||||
|
;-----------------------------------------------------------------------------
|
||||||
nomo: ;done drawing bars here
|
nomo: ;done drawing bars here
|
||||||
; start PCI stuff
|
; start PCI stuff
|
||||||
call Get_PCI_Info ; get pci version and last bus, scan for and draw each pci device
|
call Get_PCI_Info ; get pci version and last bus, scan for and draw each pci device
|
||||||
@ -96,7 +223,8 @@ nomo: ;done drawing bars here
|
|||||||
mov ebx, 20 * 65536 + 25 ; x start, ystart of text
|
mov ebx, 20 * 65536 + 25 ; x start, ystart of text
|
||||||
mov ecx, 0x224466 ; color of text
|
mov ecx, 0x224466 ; color of text
|
||||||
mov eax, 4
|
mov eax, 4
|
||||||
@@: movzx esi, byte[edx]
|
@@:
|
||||||
|
movzx esi, byte[edx]
|
||||||
inc edx
|
inc edx
|
||||||
mcall
|
mcall
|
||||||
add ebx, 10
|
add ebx, 10
|
||||||
@ -118,8 +246,17 @@ nomo: ;done drawing bars here
|
|||||||
@@:
|
@@:
|
||||||
mcall 12, 2 ; end of draw
|
mcall 12, 2 ; end of draw
|
||||||
ret
|
ret
|
||||||
|
;-----------------------------------------------------------------------------
|
||||||
;------------------------------------------------------------------
|
store_data:
|
||||||
|
mov eax,[store_text_area_start]
|
||||||
|
mov [fileinfo.return],eax
|
||||||
|
mov ebx,[store_text_area_end]
|
||||||
|
sub ebx,eax
|
||||||
|
inc ebx
|
||||||
|
mov [fileinfo.size],ebx
|
||||||
|
mcall 70,fileinfo
|
||||||
|
ret
|
||||||
|
;-----------------------------------------------------------------------------
|
||||||
;* 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
|
||||||
@ -131,6 +268,7 @@ Get_PCI_Info:
|
|||||||
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 byte [V_Bus], 0 ; reset varibles
|
||||||
mov byte [V_Dev], 0 ;
|
mov byte [V_Dev], 0 ;
|
||||||
@ -144,6 +282,7 @@ Start_Enum:
|
|||||||
|
|
||||||
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 ;
|
||||||
|
|
||||||
@ -155,6 +294,7 @@ Start_Enum:
|
|||||||
mov ch, byte [V_Dev] ; Device # on bus
|
mov ch, byte [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 byte [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
|
||||||
@ -166,15 +306,19 @@ Start_Enum:
|
|||||||
; by Mario79 august 2006
|
; by Mario79 august 2006
|
||||||
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
|
||||||
;
|
;
|
||||||
; by Ghost april 2007
|
; by Ghost april 2007
|
||||||
mov cl, 0x3c ; Register to read (Get IRQ)
|
mov cl, 0x3c ; Register to read (Get IRQ)
|
||||||
@@: mcall 62 ; Read it
|
@@:
|
||||||
|
mcall 62 ; Read it
|
||||||
|
|
||||||
mov [PCI_IRQ], al ; Save it
|
mov [PCI_IRQ], al ; Save it
|
||||||
; by CleverMouse juny 2011
|
; by CleverMouse juny 2011
|
||||||
mov cl, 0x0e
|
mov cl, 0x0e
|
||||||
mcall 62
|
mcall 62
|
||||||
|
|
||||||
push eax
|
push eax
|
||||||
inc byte [total] ; one more device found
|
inc byte [total] ; one more device found
|
||||||
call Print_New_Device ; print device info to screen
|
call Print_New_Device ; print device info to screen
|
||||||
@ -182,8 +326,10 @@ Start_Enum:
|
|||||||
pop eax
|
pop eax
|
||||||
test al, al
|
test al, al
|
||||||
js nextDev
|
js nextDev
|
||||||
|
|
||||||
test byte [V_Dev], 7
|
test byte [V_Dev], 7
|
||||||
jnz nextDev
|
jnz nextDev
|
||||||
|
|
||||||
or byte [V_Dev], 7
|
or byte [V_Dev], 7
|
||||||
nextDev:
|
nextDev:
|
||||||
inc byte [V_Dev] ; next device on this bus
|
inc byte [V_Dev] ; next device on this bus
|
||||||
@ -195,7 +341,7 @@ nextDev:
|
|||||||
cmp byte [V_Bus], al ; was it last bus
|
cmp byte [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
|
||||||
|
;-----------------------------------------------------------------------------
|
||||||
no_ummio_allowed:
|
no_ummio_allowed:
|
||||||
xor al,al
|
xor al,al
|
||||||
mov [MMIO_allowed],al ; re-enter the subroutine
|
mov [MMIO_allowed],al ; re-enter the subroutine
|
||||||
@ -210,13 +356,17 @@ Print_New_Device:
|
|||||||
mov ch, byte [V_Bus]
|
mov ch, byte [V_Bus]
|
||||||
mov cl, byte [V_Dev]
|
mov cl, byte [V_Dev]
|
||||||
mcall 62, 11 ; detect uMMIO
|
mcall 62, 11 ; detect uMMIO
|
||||||
|
|
||||||
and ax,0x7fff
|
and ax,0x7fff
|
||||||
inc ax ; -1 returned?
|
inc ax ; -1 returned?
|
||||||
jo no_ummio_allowed
|
jo no_ummio_allowed
|
||||||
|
|
||||||
inc ax ; -2 returned?
|
inc ax ; -2 returned?
|
||||||
jo no_ummio_here
|
jo no_ummio_here
|
||||||
|
|
||||||
inc ax ; -3 returned?
|
inc ax ; -3 returned?
|
||||||
jo no_ummio_here
|
jo no_ummio_here
|
||||||
|
|
||||||
mov esi, 0x990033 ; highlighted text color
|
mov esi, 0x990033 ; highlighted text color
|
||||||
mov bh, byte [V_Bus]
|
mov bh, byte [V_Bus]
|
||||||
mov bl, byte [V_Dev]
|
mov bl, byte [V_Dev]
|
||||||
@ -237,52 +387,81 @@ Print_New_Device:
|
|||||||
no_ummio_here:
|
no_ummio_here:
|
||||||
movzx ecx,word [PCI_Vendor] ; Pointer to number to be written
|
movzx ecx,word [PCI_Vendor] ; Pointer to number to be written
|
||||||
mcall 47, 0x00040100 ; Write Vendor ID
|
mcall 47, 0x00040100 ; Write Vendor ID
|
||||||
|
|
||||||
|
call store_4_digits
|
||||||
|
|
||||||
and edx, 0xFFFF ;*****************************************
|
and edx, 0xFFFF ;*****************************************
|
||||||
or edx, 54 * 65536 ; X start becomes 54
|
or edx, 54 * 65536 ; X start becomes 54
|
||||||
movzx ecx, word [PCI_Device] ; get Vendor ID
|
movzx ecx, word [PCI_Device] ; get Vendor ID
|
||||||
mcall ; Draw Vendor ID to Window
|
mcall ; Draw Vendor ID to Window
|
||||||
|
|
||||||
|
call store_4_digits
|
||||||
|
|
||||||
and edx, 0xFFFF ;*****************************************
|
and edx, 0xFFFF ;*****************************************
|
||||||
or edx, 98 * 65536 ; X start becomes 98
|
or edx, 98 * 65536 ; X start becomes 98
|
||||||
movzx ecx, byte [V_Bus] ; get bus number
|
movzx ecx, byte [V_Bus] ; get bus number
|
||||||
mcall ,0x00020100 ; draw bus number to screen
|
mcall ,0x00020100 ; draw bus number to screen
|
||||||
|
|
||||||
|
call store_2_digits
|
||||||
|
|
||||||
and edx, 0xFFFF ;*****************************************
|
and edx, 0xFFFF ;*****************************************
|
||||||
or edx, 128 * 65536 ; X start becomes 128
|
or edx, 128 * 65536 ; X start becomes 128
|
||||||
movzx ecx, byte [V_Dev] ; get device number
|
movzx ecx, byte [V_Dev] ; get device number
|
||||||
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
|
||||||
|
|
||||||
|
call store_2_digits
|
||||||
|
|
||||||
and edx, 0xFFFF ;*****************************************
|
and edx, 0xFFFF ;*****************************************
|
||||||
or edx, 155 * 65536 ; X start becomes 155
|
or edx, 155 * 65536 ; X start becomes 155
|
||||||
movzx ecx, byte [V_Dev] ; get Function number
|
movzx ecx, byte [V_Dev] ; get Function number
|
||||||
and ecx, 7 ; function is first 3 bits
|
and ecx, 7 ; function is first 3 bits
|
||||||
mcall ; Draw Function Number To Window
|
mcall ; Draw Function Number To Window
|
||||||
|
|
||||||
|
call store_2_digits
|
||||||
|
|
||||||
and edx, 0xFFFF ;*****************************************
|
and edx, 0xFFFF ;*****************************************
|
||||||
or edx, 179 * 65536 ; X start becomes 179
|
or edx, 179 * 65536 ; X start becomes 179
|
||||||
movzx ecx, byte [PCI_Rev] ; get revision number
|
movzx ecx, byte [PCI_Rev] ; get revision number
|
||||||
mcall ; Draw Revision to screen
|
mcall ; Draw Revision to screen
|
||||||
|
|
||||||
|
call store_2_digits
|
||||||
|
|
||||||
and edx, 0xFFFF ;*****************************************
|
and edx, 0xFFFF ;*****************************************
|
||||||
or edx, 215*65536 ; X start becomes 215
|
or edx, 215*65536 ; X start becomes 215
|
||||||
movzx ecx, byte [PCI_Class] ; get PCI_Class
|
movzx ecx, byte [PCI_Class] ; get PCI_Class
|
||||||
mcall ; Draw Class to screen
|
mcall ; Draw Class to screen
|
||||||
|
|
||||||
|
call store_2_digits
|
||||||
|
|
||||||
and edx, 0xFFFF ;*****************************************
|
and edx, 0xFFFF ;*****************************************
|
||||||
or edx, 250*65536 ; X start becomes 250
|
or edx, 250*65536 ; X start becomes 250
|
||||||
movzx ecx, byte [PCI_SubClass]; get sub class
|
movzx ecx, byte [PCI_SubClass]; get sub class
|
||||||
mcall ; Draw Sub Class to screen
|
mcall ; Draw Sub Class to screen
|
||||||
|
|
||||||
|
call store_2_digits
|
||||||
|
|
||||||
; from Mario79 august 2006
|
; from Mario79 august 2006
|
||||||
and edx, 0xFFFF ;*****************************************
|
and edx, 0xFFFF ;*****************************************
|
||||||
or edx, 280 * 65536 ; X start becomes 280
|
or edx, 280 * 65536 ; X start becomes 280
|
||||||
movzx ecx, [PCI_Interface] ; get Interface
|
movzx ecx, [PCI_Interface] ; get Interface
|
||||||
mcall
|
mcall
|
||||||
|
|
||||||
|
call store_2_digits
|
||||||
|
|
||||||
;
|
;
|
||||||
; from Ghost april 2007 ;*****************************************
|
; from Ghost april 2007 ;*****************************************
|
||||||
movzx ecx, [PCI_IRQ] ; get Interface
|
movzx ecx, [PCI_IRQ] ; get Interface
|
||||||
cmp cl, 0x0f ; IRQ between 0..15
|
cmp cl, 0x0f ; IRQ between 0..15
|
||||||
ja @f
|
ja @f
|
||||||
|
|
||||||
and edx, 0xFFFF
|
and edx, 0xFFFF
|
||||||
or edx, 310 * 65536 ; X start becomes 310
|
or edx, 310 * 65536 ; X start becomes 310
|
||||||
mcall
|
mcall
|
||||||
|
|
||||||
|
call store_2_digits
|
||||||
|
|
||||||
@@:
|
@@:
|
||||||
;
|
|
||||||
;Write Names
|
;Write Names
|
||||||
movzx ebx, dx ; Set y position
|
movzx ebx, dx ; Set y position
|
||||||
or ebx, 340 * 65536 ; set Xposition to 340
|
or ebx, 340 * 65536 ; set Xposition to 340
|
||||||
@ -295,15 +474,21 @@ no_ummio_here:
|
|||||||
mov edx, VendorsTab
|
mov edx, VendorsTab
|
||||||
mov cx, word[PCI_Vendor]
|
mov cx, word[PCI_Vendor]
|
||||||
|
|
||||||
.fn: mov ax, [edx]
|
.fn:
|
||||||
|
mov ax, [edx]
|
||||||
add edx, 6
|
add edx, 6
|
||||||
test ax, ax
|
test ax, ax
|
||||||
jz .find
|
jz .find
|
||||||
|
|
||||||
cmp ax, cx
|
cmp ax, cx
|
||||||
jne .fn
|
jne .fn
|
||||||
.find: mov edx, [edx - 4]
|
|
||||||
|
.find:
|
||||||
|
mov edx, [edx - 4]
|
||||||
mcall 4,, 0x80000000 ; lets print the vendor Name
|
mcall 4,, 0x80000000 ; lets print the vendor Name
|
||||||
|
|
||||||
|
mov [store_text_size],42
|
||||||
|
call store_text
|
||||||
;------------------------------------------------------------------
|
;------------------------------------------------------------------
|
||||||
; Get description based on Class/Subclass
|
; Get description based on Class/Subclass
|
||||||
;
|
;
|
||||||
@ -313,26 +498,39 @@ no_ummio_here:
|
|||||||
and eax, 0xffffff
|
and eax, 0xffffff
|
||||||
xor edx, edx
|
xor edx, edx
|
||||||
xor esi, esi
|
xor esi, esi
|
||||||
.fnc: inc esi
|
.fnc:
|
||||||
|
inc esi
|
||||||
mov ecx, [Classes + esi * 8 - 8]
|
mov ecx, [Classes + esi * 8 - 8]
|
||||||
cmp cx, 0xffff
|
cmp cx, 0xffff
|
||||||
je .endfc
|
je .endfc
|
||||||
|
|
||||||
cmp cx, ax
|
cmp cx, ax
|
||||||
jne .fnc
|
jne .fnc
|
||||||
|
|
||||||
test ecx, 0xff000000
|
test ecx, 0xff000000
|
||||||
jz @f
|
jz @f
|
||||||
|
|
||||||
mov edx, [Classes + esi * 8 - 4]
|
mov edx, [Classes + esi * 8 - 4]
|
||||||
jmp .fnc
|
jmp .fnc
|
||||||
@@: cmp eax, ecx
|
@@:
|
||||||
|
cmp eax, ecx
|
||||||
jne .fnc
|
jne .fnc
|
||||||
|
|
||||||
xor edx, edx
|
xor edx, edx
|
||||||
.endfc: test edx, edx
|
.endfc:
|
||||||
|
test edx, edx
|
||||||
jnz @f
|
jnz @f
|
||||||
|
|
||||||
mov edx, [Classes + esi * 8 - 4]
|
mov edx, [Classes + esi * 8 - 4]
|
||||||
@@:
|
@@:
|
||||||
and ebx, 0x0000FFFF ; clear X position
|
and ebx, 0x0000FFFF ; clear X position
|
||||||
or ebx, 0x24E0000 ; set X position to 590 pixels
|
or ebx, 0x24E0000 ; set X position to 590 pixels
|
||||||
mcall 4,, 0x80000000,, 32 ; draw the text
|
mcall 4,, 0x80000000,, 32 ; draw the text
|
||||||
|
|
||||||
|
mov [store_text_size],0
|
||||||
|
call store_text
|
||||||
|
call store_CR
|
||||||
|
|
||||||
movzx edx, bx ; get y coordinate
|
movzx edx, bx ; get y coordinate
|
||||||
add edx, 0x0014000A ; add 10 to y coordinate and set x coordinate to 20
|
add edx, 0x0014000A ; add 10 to y coordinate and set x coordinate to 20
|
||||||
mov [gr_pos], edx
|
mov [gr_pos], edx
|
||||||
@ -349,15 +547,18 @@ Try_MMIO:
|
|||||||
or bx, 12 ; function 12
|
or bx, 12 ; function 12
|
||||||
mov ecx, 4096 ; =1 page to map
|
mov ecx, 4096 ; =1 page to map
|
||||||
mcall 62
|
mcall 62
|
||||||
|
|
||||||
mov [MMIO_Map], eax ; store MMIO lin.addr.
|
mov [MMIO_Map], eax ; store MMIO lin.addr.
|
||||||
mov ecx, 0x80990022 ; print color : red
|
mov ecx, 0x80990022 ; print color : red
|
||||||
add bh, '0'
|
add bh, '0'
|
||||||
cmp eax, -3
|
cmp eax, -3
|
||||||
jne @f
|
jne @f
|
||||||
|
|
||||||
mov [bar_um+3], bh
|
mov [bar_um+3], bh
|
||||||
mov ebx, [gr_pos]
|
mov ebx, [gr_pos]
|
||||||
mov edx, bar_um
|
mov edx, bar_um
|
||||||
mcall 4
|
mcall 4
|
||||||
|
|
||||||
jmp mmio_next_bar
|
jmp mmio_next_bar
|
||||||
@@:
|
@@:
|
||||||
cmp eax, -4
|
cmp eax, -4
|
||||||
@ -366,6 +567,7 @@ Try_MMIO:
|
|||||||
mov ebx, [gr_pos]
|
mov ebx, [gr_pos]
|
||||||
mov edx, bar_io
|
mov edx, bar_io
|
||||||
mcall 4
|
mcall 4
|
||||||
|
|
||||||
jmp mmio_next_bar
|
jmp mmio_next_bar
|
||||||
@@:
|
@@:
|
||||||
cmp bh, '6' ; expansion ROM ?
|
cmp bh, '6' ; expansion ROM ?
|
||||||
@ -374,7 +576,9 @@ Try_MMIO:
|
|||||||
mov ebx, [gr_pos]
|
mov ebx, [gr_pos]
|
||||||
mov edx, bar_ram
|
mov edx, bar_ram
|
||||||
mcall 4
|
mcall 4
|
||||||
|
|
||||||
jmp mmio_dump
|
jmp mmio_dump
|
||||||
|
;-----------------------------------------------------------------------------
|
||||||
@@:
|
@@:
|
||||||
mov ebx, [gr_pos]
|
mov ebx, [gr_pos]
|
||||||
mov edx, bar_rom
|
mov edx, bar_rom
|
||||||
@ -387,6 +591,7 @@ mmio_dump:
|
|||||||
add ebx, 10
|
add ebx, 10
|
||||||
mov [gr_pos], ebx
|
mov [gr_pos], ebx
|
||||||
mcall 4
|
mcall 4
|
||||||
|
|
||||||
mov ecx, [MMIO_Map] ; release the tried page
|
mov ecx, [MMIO_Map] ; release the tried page
|
||||||
mcall 62,13
|
mcall 62,13
|
||||||
|
|
||||||
@ -395,28 +600,106 @@ mmio_next_bar:
|
|||||||
inc bh
|
inc bh
|
||||||
cmp bh,7
|
cmp bh,7
|
||||||
je @f
|
je @f
|
||||||
|
|
||||||
mov [MMIO_BAR], bh
|
mov [MMIO_BAR], bh
|
||||||
add [gr_pos], 10
|
add [gr_pos], 10
|
||||||
jmp Try_MMIO
|
jmp Try_MMIO
|
||||||
|
;-----------------------------------------------------------------------------
|
||||||
@@:
|
@@:
|
||||||
xor bh,bh
|
xor bh,bh
|
||||||
mov [MMIO_BAR], bh
|
mov [MMIO_BAR], bh
|
||||||
ret
|
ret
|
||||||
|
;-----------------------------------------------------------------------------
|
||||||
|
store_CR:
|
||||||
|
pusha
|
||||||
|
mov edi,[store_text_area_end]
|
||||||
|
mov [edi],word 0A20h ; CR (carriage return) + SPACE
|
||||||
|
add dword [store_text_area_end],2
|
||||||
|
popa
|
||||||
|
ret
|
||||||
|
;-----------------------------------------------------------------------------
|
||||||
|
store_text:
|
||||||
|
pusha
|
||||||
|
inc dword [store_text_area_end]
|
||||||
|
mov esi,edx
|
||||||
|
mov edi,[store_text_area_end]
|
||||||
|
push edi
|
||||||
|
xor eax,eax
|
||||||
|
cld
|
||||||
|
@@:
|
||||||
|
lodsb
|
||||||
|
test eax,eax
|
||||||
|
jz @f
|
||||||
|
stosb
|
||||||
|
inc dword [store_text_area_end]
|
||||||
|
jmp @r
|
||||||
|
@@:
|
||||||
|
pop esi
|
||||||
|
mov eax,[store_text_size]
|
||||||
|
test eax,eax
|
||||||
|
jz @f
|
||||||
|
sub edi,esi
|
||||||
|
sub eax,edi
|
||||||
|
add [store_text_area_end],eax
|
||||||
|
@@:
|
||||||
|
popa
|
||||||
|
ret
|
||||||
|
;-----------------------------------------------------------------------------
|
||||||
|
store_4_digits:
|
||||||
|
pusha
|
||||||
|
mov ebx,ecx
|
||||||
|
mov ecx,4
|
||||||
|
mov edi,[store_text_area_end]
|
||||||
|
call binary_to_hex_string
|
||||||
|
add [store_text_area_end],dword 6
|
||||||
|
popa
|
||||||
|
ret
|
||||||
|
;-----------------------------------------------------------------------------
|
||||||
|
store_2_digits:
|
||||||
|
pusha
|
||||||
|
inc [store_text_area_end]
|
||||||
|
mov ebx,ecx
|
||||||
|
mov ecx,2
|
||||||
|
mov edi,[store_text_area_end]
|
||||||
|
call binary_to_hex_string
|
||||||
|
add [store_text_area_end],dword 4
|
||||||
|
popa
|
||||||
|
ret
|
||||||
|
;-----------------------------------------------------------------------------
|
||||||
|
; ebx - value
|
||||||
|
; ecx - digits
|
||||||
|
; edi - output string
|
||||||
|
binary_to_hex_string:
|
||||||
|
add edi,ecx
|
||||||
|
dec edi
|
||||||
|
std
|
||||||
|
.1:
|
||||||
|
mov al,bl
|
||||||
|
and al,0xf
|
||||||
|
shr ebx,4
|
||||||
|
cmp al,9
|
||||||
|
jbe @f
|
||||||
|
|
||||||
|
add al,0x27
|
||||||
|
@@:
|
||||||
|
add al,0x30
|
||||||
|
stosb
|
||||||
|
dec ecx
|
||||||
|
jnz .1
|
||||||
|
cld
|
||||||
|
ret
|
||||||
|
;-----------------------------------------------------------------------------
|
||||||
include 'vendors.inc'
|
include 'vendors.inc'
|
||||||
;------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
; DATA AREA
|
; DATA AREA
|
||||||
DATA
|
DATA
|
||||||
|
|
||||||
|
|
||||||
Form: dw 800 ; window width (no more, special for 800x600)
|
Form: dw 800 ; window width (no more, special for 800x600)
|
||||||
dw 100 ; window x start
|
dw 100 ; window x start
|
||||||
dw 620 ; window height
|
dw 620 ; window height
|
||||||
dw 20 ; window y start
|
dw 20 ; window y start
|
||||||
|
|
||||||
title db 'PCI Device Enumerator v 2.21 by J.Delozier, S.Kuzmin, V.Hanla, M.Zakiyanov, A.Jerdev', 0
|
title db 'PCI Device Enumerator v 2.3 by J.Delozier, S.Kuzmin, V.Hanla, M.Zakiyanov, A.Jerdev, E.Grechnikov, V.Clever Mouse, Y.Ezra', 0
|
||||||
|
|
||||||
PCIWin mls \
|
PCIWin mls \
|
||||||
' Don`t forget to enable PCI Access to Applications in Setup Menu.',\
|
' Don`t forget to enable PCI Access to Applications in Setup Menu.',\
|
||||||
@ -427,17 +710,97 @@ PCIWin mls \
|
|||||||
'',\
|
'',\
|
||||||
'VenID DevID Bus# Dev# Fnc Rev Class Subclass/ IRQ Company Description',\
|
'VenID DevID Bus# Dev# Fnc Rev Class Subclass/ IRQ Company Description',\
|
||||||
' Interface',\
|
' Interface',\
|
||||||
'----- ----- ---- ---- --- --- ----- --------- --- ------------------------------------------ ----------------'
|
'----- ----- ---- ---- --- --- ----- --------- --- ------------------------------------------ --------------------------------'
|
||||||
|
|
||||||
bar_ram db 'BARx: MMIO block', 0
|
bar_ram db 'BARx: MMIO block', 0
|
||||||
bar_io db 'BARx: IO ports',0
|
bar_io db 'BARx: IO ports',0
|
||||||
bar_um db 'BARx: unmapped',0
|
bar_um db 'BARx: unmapped',0
|
||||||
bar_rom db 'BAR6: Expansion ROM', 0
|
bar_rom db 'BAR6: Expansion ROM', 0
|
||||||
|
|
||||||
;------------------------------------------------------------------
|
text_save_button:
|
||||||
; UNINITIALIZED DATA AREA
|
db 'Save PCI list',0
|
||||||
UDATA
|
.1: db '(Press S key)',0
|
||||||
|
;---------------------------------------------------------------------
|
||||||
|
system_dir_ProcLib db '/sys/lib/proc_lib.obj',0
|
||||||
|
|
||||||
|
err_message_found_lib2 db 'proc_lib.obj - Not found!',0
|
||||||
|
|
||||||
|
err_message_import2 db 'proc_lib.obj - Wrong import!',0
|
||||||
|
|
||||||
|
head_f_i:
|
||||||
|
head_f_l db 'error',0
|
||||||
|
;---------------------------------------------------------------------
|
||||||
|
l_libs_start:
|
||||||
|
|
||||||
|
library02 l_libs system_dir_ProcLib+9, path, library_path, system_dir_ProcLib, \
|
||||||
|
err_message_found_lib2, head_f_l, ProcLib_import, err_message_import2, head_f_i
|
||||||
|
|
||||||
|
end_l_libs:
|
||||||
|
;---------------------------------------------------------------------
|
||||||
|
align 4
|
||||||
|
ProcLib_import:
|
||||||
|
OpenDialog_Init dd aOpenDialog_Init
|
||||||
|
OpenDialog_Start dd aOpenDialog_Start
|
||||||
|
;OpenDialog__Version dd aOpenDialog_Version
|
||||||
|
dd 0
|
||||||
|
dd 0
|
||||||
|
aOpenDialog_Init db 'OpenDialog_init',0
|
||||||
|
aOpenDialog_Start db 'OpenDialog_start',0
|
||||||
|
;aOpenDialog_Version db 'Version_OpenDialog',0
|
||||||
|
;---------------------------------------------------------------------
|
||||||
|
align 4
|
||||||
|
OpenDialog_data:
|
||||||
|
.type dd 0
|
||||||
|
.procinfo dd Proc_Info ;+4
|
||||||
|
.com_area_name dd communication_area_name ;+8
|
||||||
|
.com_area dd 0 ;+12
|
||||||
|
.opendir_pach dd temp_dir_pach ;+16
|
||||||
|
.dir_default_pach dd communication_area_default_pach ;+20
|
||||||
|
.start_path dd open_dialog_path ;+24
|
||||||
|
.draw_window dd draw_window ;+28
|
||||||
|
.status dd 0 ;+32
|
||||||
|
.openfile_pach dd file_name ;+36
|
||||||
|
.filename_area dd filename_area ;+40
|
||||||
|
.filter_area dd Filter
|
||||||
|
.x:
|
||||||
|
.x_size dw 420 ;+48 ; Window X size
|
||||||
|
.x_start dw 10 ;+50 ; Window X position
|
||||||
|
.y:
|
||||||
|
.y_size dw 320 ;+52 ; Window y size
|
||||||
|
.y_start dw 10 ;+54 ; Window Y position
|
||||||
|
|
||||||
|
communication_area_name:
|
||||||
|
db 'FFFFFFFF_open_dialog',0
|
||||||
|
open_dialog_path:
|
||||||
|
db '/sys/File Managers/opendial',0
|
||||||
|
communication_area_default_pach:
|
||||||
|
db '/sys',0
|
||||||
|
Filter:
|
||||||
|
dd Filter.end - Filter.1
|
||||||
|
.1:
|
||||||
|
db 'TXT',0
|
||||||
|
db 'LOG',0
|
||||||
|
.end:
|
||||||
|
dd 0
|
||||||
|
|
||||||
|
file_default_path:
|
||||||
|
db '/sys/'
|
||||||
|
start_temp_file_name:
|
||||||
|
db 'pcidev.txt',0
|
||||||
|
;---------------------------------------------------------------------
|
||||||
|
align 4
|
||||||
|
fileinfo:
|
||||||
|
.subfunction dd 2
|
||||||
|
.Offset dd 0
|
||||||
|
.Offset_1 dd 0
|
||||||
|
.size dd 4096
|
||||||
|
.return dd 0
|
||||||
|
db 0
|
||||||
|
.name: dd file_name
|
||||||
|
;-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
; UNINITIALIZED DATA AREA
|
||||||
|
IM_END:
|
||||||
total db ?
|
total db ?
|
||||||
V_Bus db ?
|
V_Bus db ?
|
||||||
V_Dev db ?
|
V_Dev db ?
|
||||||
@ -463,6 +826,34 @@ MMIO_Map rd 8
|
|||||||
|
|
||||||
gr_pos dd ?
|
gr_pos dd ?
|
||||||
|
|
||||||
Proc_Info process_information
|
store_text_area_start dd ?
|
||||||
MEOS_APP_END
|
store_text_area_end dd ?
|
||||||
|
store_text_size dd ?
|
||||||
|
|
||||||
|
extended_key rb 1
|
||||||
|
;---------------------------------------------------------------------
|
||||||
|
library_path:
|
||||||
|
rb 4096
|
||||||
|
;---------------------------------------------------------------------
|
||||||
|
path:
|
||||||
|
rb 4096
|
||||||
|
;---------------------------------------------------------------------
|
||||||
|
temp_dir_pach:
|
||||||
|
rb 4096
|
||||||
|
;---------------------------------------------------------------------
|
||||||
|
file_name:
|
||||||
|
rb 4096
|
||||||
|
;---------------------------------------------------------------------
|
||||||
|
file_name_1:
|
||||||
|
rb 4096
|
||||||
|
;---------------------------------------------------------------------
|
||||||
|
filename_area:
|
||||||
|
rb 256
|
||||||
|
;---------------------------------------------------------------------
|
||||||
|
rb 4096
|
||||||
|
stacktop:
|
||||||
|
;---------------------------------------------------------------------
|
||||||
|
Proc_Info process_information
|
||||||
|
;---------------------------------------------------------------------
|
||||||
|
I_END:
|
||||||
|
;-----------------------------------------------------------------------------
|
||||||
|
@ -1,2 +1,3 @@
|
|||||||
@fasm pcidev.asm pcidev
|
@fasm pcidev.asm pcidev
|
||||||
|
@kpack pcidev
|
||||||
@pause
|
@pause
|
@ -9,11 +9,42 @@ to-do:
|
|||||||
|
|
||||||
Full device detection (like "ATI Radeon 9200") will increase app
|
Full device detection (like "ATI Radeon 9200") will increase app
|
||||||
size a lot and probably it is function of particular drivers
|
size a lot and probably it is function of particular drivers
|
||||||
----------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
2.21: PCIDEV 03/06/2011
|
2.3: PCIDEV 26/06/2011
|
||||||
Author: CleverMouse
|
Author: Marat Zakiyanov aka Mario79 <mario79@bk.ru>
|
||||||
Features: don't scan for other functions on single-function devices
|
Features:
|
||||||
----------------------------------------------------------------
|
added
|
||||||
|
* Save PCI devices list to disk
|
||||||
|
* Using OpenDialog for select of path
|
||||||
|
|
||||||
|
;------------------------------------
|
||||||
|
Author: Veronica aka Clever Mouse
|
||||||
|
Features:
|
||||||
|
fixed
|
||||||
|
* Don't scan for other functions on single-function devices
|
||||||
|
* Some little bugs
|
||||||
|
|
||||||
|
;------------------------------------
|
||||||
|
Author: Artem Jerdev aka art_zh <art_zh@yahoo.com>
|
||||||
|
Features:
|
||||||
|
fixed
|
||||||
|
* pcidev post-enumeration bug fixed
|
||||||
|
optimized
|
||||||
|
* pci vendors database splitted to reduce PCIDEV code downto 10kB.
|
||||||
|
|
||||||
|
;------------------------------------
|
||||||
|
Author: Yogev Ezra
|
||||||
|
Features:
|
||||||
|
added
|
||||||
|
* HDA controller recognition and 17F3 RDC Semiconductor vendor
|
||||||
|
|
||||||
|
;------------------------------------
|
||||||
|
Author: Evgeny Grechnikov aka Diamond
|
||||||
|
Features:
|
||||||
|
fixed
|
||||||
|
* Some little bugs
|
||||||
|
|
||||||
|
;-----------------------------------------------------------------------------
|
||||||
2.2: PCIDEV 03/01/2010
|
2.2: PCIDEV 03/01/2010
|
||||||
Author: Artem Jerdev <art_zh@yahoo.com>
|
Author: Artem Jerdev <art_zh@yahoo.com>
|
||||||
Features:
|
Features:
|
||||||
|
Loading…
Reference in New Issue
Block a user