Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 474 → Rev 475

/programs/system/pcidev/trunk/PCIDEV.ASM
1,11 → 1,12
;***************************************************************
; project name: PCI Device Enumeration
; target platform: KolibriOS and MenuetOS
; target platform: KolibriOS
; compiler: flat assmebler 1.66
; version: 2.0
; last update: 30(th) August 2006
; maintained by: Jason Delozier and Sergey Kuzmin
; e-mail: cordata51@hotmail.com and kuzmin_serg@list.ru
; version: 2.1
; last update: April 2007
; maintained by: Jason Delozier (cordata51@hotmail.com)
; Sergey Kuzmin (kuzmin_serg@list.ru)
; Mihailov Ilia (ghost.nsk@gmail.com)
; project site: http://www.coolthemes.narod.ru/pcidev.html
;***************************************************************
;Summary: This program will attempt to scan the PCI Bus
17,15 → 18,29
; '!' means big changes
;
;to-do:
; PCI version should be normalized 0210 -> 02.10 (it is BCD number)
; more vendors
; vendor's website
; more vendors
; device IRQ
; Subsystem id and Subsystem vendor id detection
 
; Full device detection (like "ATI Radeon 9200") will increase app
; size a lot and probably it is function of particular drivers
;----------------------------------------------------------------
;2.1: PCIDEV ??/04/2007
;Author: Mihailov Ilia aka Ghost <ghost.nsk@gmail.com>
;Features:
; fixed
; * Same little bugs
; * Source code formating
; * PCI version normalized 0210 -> 2.10
; added
; * + 13 vendor (total now 1000!)
; * + 3 class type
; * Fast call source ready
; * Device IRQ detection
; optimized
; * ! size optimized (61025 -> 32501 see added)
; * easy to add new vendor & class names
;----------------------------------------------------------------
;2.0: PCIDEV 30/08/2006
;(it differs a lot from the version 1.0, which was introduced 19 months ago)
;Author: Marat Zakiyanov aka Mario79 <mario79@bk.ru>
121,120 → 136,47
; * detect Revision, Class and Subclass of Device,
; * and make Description based on Class
;-------------------------------------------------------------
use32
 
org 0x0
 
db 'MENUET01'; 8 byte id
dd 0x01 ; header version
dd START ; start of code
dd I_END ; size of image
dd 0xFFFF ; memory for app = 64 KB
dd I_END ; esp
dd 0x0 , 0x0 ; I_Param , I_Icon
 
 
include 'macros.inc'
include 'VENDORS.INC'
 
START: ; start of execution
MEOS_APP_START
CODE
call draw_window
 
still:
mov eax,10 ; wait here for event
int 0x40
 
cmp eax,1 ; redraw request ?
je red
cmp eax,2 ; key in buffer ?
je key
cmp eax,3 ; button in buffer ?
je button
 
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
mov eax, 9 ;window redraw requested so get new window coordinates and size
mov ebx, Proc_Info ;area to store process information
mov ecx, -1 ;
int 0x40 ;get the process information
mov eax,[Proc_Info+34] ;store the window coordinates into the Form Structure
mcall 9, Proc_Info, -1 ; window redraw requested so get new window coordinates and size
mov eax, [Proc_Info.x_start]; store the window coordinates into the Form Structure
mov [Form+2], ax ;x start position
mov eax,[Proc_Info+38] ;
mov eax, [Proc_Info.y_start];
mov [Form+6],ax ;ystart position
mov eax,[Proc_Info+42] ;
mov eax, [Proc_Info.x_size] ;
mov [Form],ax ;window width
mov eax,[Proc_Info+46] ;
mov eax, [Proc_Info.y_size] ;
mov [Form+4] ,ax ;window height
call draw_window ;go redraw window now
jmp still
 
key: ; key
mov eax,2 ; just read it and ignore
int 0x40
mcall 2 ; just read it and ignore
jmp still
button: ; button
mov eax,17 ; get id
int 0x40
 
mcall 17 ; get id
cmp ah,1 ; button id=1 ?
jne noclose
jne still
mcall -1 ; close this program
 
mov eax,-1 ; close this program
int 0x40
noclose:
jmp still
 
 
 
 
; *********************************************
; ******* WINDOW DEFINITIONS AND DRAW ********
; *********************************************
Form:
dw 780 ;window width
dw 100 ;window x start
dw 420 ;window height
dw 100 ;window y start
 
 
 
draw_window:
 
mov byte [total],0
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,1 ; 1, start of draw
int 0x40
mcall 12, 1 ; start of draw
; DRAW WINDOW
mov eax,0 ; function 0 : define and draw window
mov ebx, dword [Form] ; x/width of window
mov ecx, dword [Form+4] ; y/height of window
mov edx,0x03ffffff ; color of work area RRGGBB,8->color gl
mov esi,0x805080d0 ; color of grab bar RRGGBB,8->color gl
mov edi,0x005080d0 ; color of frames RRGGBB
int 0x40 ; draw the window
; WINDOW LABEL
mov eax,4 ; function 4 : write text to window
mov ebx,8*65536+8 ; [x start] *65536 + [y start]
mov ecx,0x10ddeeff ; font 1 & color ( 0xF0RRGGBB )
mov edx,labelt ; pointer to text beginning
mov esi,labellen-labelt ; text length
int 0x40
 
;draw captions to window
mov ebx, 20*65536+25 ;x start, ystart of text
mov ecx, 0x224466 ;color of text
mov edx, dword PCIWin ;start of text buffer
mov esi, 106 ;lenght of line 106
newline: ;
mov eax, 4 ;draw text system function
int 0x40 ;draw the text
add ebx, 10 ;one line down
add edx, esi ;add lenght of line to offset of text buffer
cmp byte[edx], byte 'x' ;is it the end of buffer?
jne newline ;if not draw another line of text
 
mcall 0, dword [Form], dword [Form + 4], 0x13ffffff, 0x805080d0, title
;Insert horizontal bars in list area
mov eax, 13 ;draw bar system function
mov ebx, 18 ;set Xstart position of bar
244,7 → 186,7
mov ecx, 119*65536+10 ;set Ystart(109) and Height(10) of bar 109
mov edx, 0xC0C0C0 ;set color of bar
again: ;begin draw bar loop
int 0x40 ;draw bar to window area
mcall ; draw bar to window area
shr ecx, 16 ;move the Ystart position to working area
add ecx, 34 ;add 34 pixels to Y Start (moves bar down)
cmp cx,word [Form+4] ;is the Ystart position outside of window area
254,58 → 196,50
add ecx, 10 ;Bar Height is always 10 pixels
jmp again ;draw another bar
nomo: ;done drawing bars here
 
;start PCI stuff
call Get_PCI_Info ;get pci version and last bus
mov cx,word [PCI_Version] ;number to draw
mov eax, 47 ;draw number system function
xor esi, esi ;color of text
mov ebx, 0x00040100 ;4 digits to draw in hex format
mov edx, 110*65536+45 ;x/y start position of number
int 0x40 ;draw pci version to window
mov cl,byte [PCI_LastBus] ;number to draw
mov ebx, 0x00020100 ;2 digits hex format
add edx, 10 ;one line below pci version
int 0x40 ;draw the last bus to window
call Get_PCI_Info ; get pci version and last bus, scan for and draw each pci device
 
call scan_Pci ;scan for and draw each pci device
; Window inteface
mov cx, [PCI_Version]
add ch, '0'
mov [PCIWin + 85], ch ; 0xBADCODE but it work !
mov ch, cl
shr cl, 4
and ch, 0x0f
add cx, '00'
mov [PCIWin + 87], cx
mov cl, [PCI_LastBus]
add cl, '0'
mov [PCIWin + 105], cl
 
mov edx, PCIWin
mov ebx, 20 * 65536 + 25 ; x start, ystart of text
mov ecx, 0x224466 ; color of text
mov eax, 4
@@: movzx esi, byte[edx]
inc edx
mcall
add ebx, 10
add edx, esi
cmp byte[edx], -1
jne @b
; Quantity of devices...
movzx ecx, byte [total] ;number to draw
mov eax, 47 ;draw number system function
mov ebx, 0x00020000 ;2 digits to draw in decimal format
xor esi, esi ;color of text
mov edx, 150*65536+65 ;x/y position to draw to
int 0x40 ;draw total number of devices to window
mcall 47, 0x00020000,,150 * 65536 + 65, 0x224466
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
int 0x40
 
mcall 12, 2 ; end of draw
ret
; ***********************************************
; ******* END WINDOW DEFINITIONS & DRAW *******
; ***********************************************
 
 
;******************************************************
;------------------------------------------------------------------
;* Gets the PCI Version and Last Bus
Get_PCI_Info:
mov eax, 62
xor ebx, ebx
int 0x40
mcall 62, 0
mov word [PCI_Version], ax
mov eax, 62
mov ebx, 1
int 0x40
mcall 62, 1
mov byte [PCI_LastBus], al
ret
;******************************************************
 
 
;******************************************************
;----------------------------------------------------------
;* Get all devices on PCI Bus
scan_Pci:
cmp byte [PCI_LastBus],0xff ;0xFF means no pci bus found
cmp al, 0xff ; 0xFF means no pci bus found
jne Pci_Exists ;
ret ;if no bus then leave
Pci_Exists:
317,8 → 251,7
mov bh, byte [V_Bus] ;bus of pci device
mov ch, byte [V_Dev] ;device number/function
mov cl, 0 ;offset to device/vendor id
mov eax, 62 ;pci system function
int 0x40 ;get ID's
mcall 62 ; get ID's
 
cmp ax, 0 ;Vendor ID should not be 0 or 0xFFFF
je nextDev ;check next device if nothing exists here
328,27 → 261,29
mov word [PCI_Vendor], ax ;There is a device here, save the ID's
shr eax, 16 ;
mov word [PCI_Device], ax ;
mov eax, 62 ;PCI Sys Function
mov bl, 4 ;Read config byte
mov bh, byte [V_Bus] ;Bus #
mov ch, byte [V_Dev] ;Device # on bus
mov cl, 0x08 ;Register to read (Get Revision)
int 0x40 ;Read it
mcall 62 ; Read it
mov byte [PCI_Rev], al ;Save it
mov eax, 62 ;PCI Sys Function
mov cl, 0x0b ;Register to read (Get class)
int 0x40 ;Read it
mcall 62 ; Read it
mov byte [PCI_Class], al ;Save it
mov eax, 62 ;PCI Sys Function
mov cl, 0x0a ;Register to read (Get Subclass)
int 0x40 ;Read it
mcall 62 ; Read it
mov byte [PCI_SubClass], al ;Save it
; from Mario79 august 2006
mov eax, 62 ;PCI Sys Function
mov cl, 0x09 ;Register to read (Get Interface)
int 0x40 ;Read it
mcall 62 ; Read it
mov [PCI_Interface], al ;Save it
;
; from Ghost april 2007
mov cl, 0x3c ; Register to read (Get IRQ)
@@: mcall 62 ; Read it
mov [PCI_IRQ], al ; Save it
;
inc byte [total] ;one more device found
call Print_New_Device ;print device info to screen
nextDev:
361,943 → 296,156
cmp byte [V_Bus], al ;was it last bus
jbe Start_Enum ;if not jump to keep searching
ret
;******************************************************
 
 
 
;******************************************************
;------------------------------------------------------------------
;* Print device info to screen
Print_New_Device:
mov eax, 47 ;Write number to screen system function
mov ebx, 0x00040100 ;4 byte number, print in hexidecimal
xor esi, esi ;Color of text
movzx ecx,word [PCI_Vendor] ;Pointer to number to be written
int 0x40 ;Write Vendor ID
mcall 47, 0x00040100 ; Write Vendor ID
and edx, 0xFFFF ;*****************************************
or edx, 54*65536 ;X start becomes 54
movzx ecx,word [PCI_Device] ;get Vendor ID
int 0x40 ;Draw Vendor ID to Window
mov ebx, 0x00020100 ;2 digit number, in hexidecimal format
mcall ; Draw Vendor ID to Window
and edx, 0xFFFF ;*****************************************
or edx, 98*65536 ;X start becomes 98
movzx ecx,byte [V_Bus] ;get bus number
int 0x40 ;draw bus number to screen
mcall ,0x00020100 ; draw bus number to screen
and edx, 0xFFFF ;*****************************************
or edx, 128*65536 ;X start becomes 128
movzx ecx,byte [V_Dev] ;get device number
shr ecx, 3 ;device number is bits 3-7
int 0x40 ;Draw device Number To Window
mcall ; Draw device Number To Window
and edx, 0xFFFF ;*****************************************
or edx, 155*65536 ;X start becomes 155
movzx ecx, byte [V_Dev] ;get Function number
and ecx, 7 ;function is first 3 bits
int 0x40 ;Draw Function Number To Window
mcall ; Draw Function Number To Window
and edx, 0xFFFF ;*****************************************
or edx, 179*65536 ;X start becomes 179
movzx ecx,byte [PCI_Rev] ;get revision number
int 0x40 ;Draw Revision to screen
mcall ; Draw Revision to screen
and edx, 0xFFFF ;*****************************************
or edx, 215*65536 ;X start becomes 215
movzx ecx,byte [PCI_Class] ;get PCI_Class
int 0x40 ;Draw Class to screen
mcall ; Draw Class to screen
and edx, 0xFFFF ;*****************************************
or edx, 250*65536 ;X start becomes 250
movzx ecx,byte [PCI_SubClass];get sub class
int 0x40 ;Draw Sub Class to screen
mcall ; Draw Sub Class to screen
; from Mario79 august 2006
and edx, 0xFFFF ;*****************************************
or edx, 280*65536 ;X start becomes 280
movzx ecx, [PCI_Interface] ;get Interface
int 0x40
mcall
;
; from Ghost april 2007 ;*****************************************
movzx ecx, [PCI_IRQ] ; get Interface
cmp cl, 0x0f ; IRQ between 0..15
ja @f
and edx, 0xFFFF
or edx, 310 * 65536 ; X start becomes 310
mcall
@@:
;
;Write Names
movzx ebx, dx ;Set y position
or ebx, 310*65536 ;set Xposition to 310
or ebx, 340 * 65536 ; set Xposition to 340
 
;**********************************************************
;------------------------------------------------------------------
;Prints the Vendor's Name based on Vendor ID
;
; modified part by vhanla (I know it is not a fastest way to search)
; it needs optimization... HELP this project!
;
; Modified on 30-04-2006 by JMD for size
;-----------------------------------------------------------------------------
;first determine which list to find the vendor in
mov ax, word [PCI_Vendor]
mov ecx, 255 ;# vendors in most lists
cmp ax,4540 ;Check if Vendor's value is less than this number (the start of next part)
jae next1 ;if it is less, let's continue, or jump to next1
mov edx, _FIRSTPART ;select this list
jmp rep1 ;start searching list
next1: ;
cmp ax,5120 ;same thing happening here as above^
jae next2 ;
mov edx, _SECONDPART ;
jmp rep1 ;
next2: ;
cmp ax,5459 ;
jae next3 ;
mov edx, _THIRDPART ;
jmp rep1 ;
next3: ;
mov ecx, 222 ;only 222 vendors in this list
mov edx, _FOURTHPART ;
; Modified on ??-04-2007 by Ghost for size
;------------------------------------------------------------------
mov edx, VendorsTab
mov cx, word[PCI_Vendor]
 
rep1:
cmp ax,word[edx+50] ;are Vendor ID's the same?
je ex ;if so jump to print the description to screen
add edx, 52 ;if not put us at start of next description
dec ecx ;one less description in list
jnz rep1 ;was it our last?
mov edx, _UNKNOWN ;if so we dont know this Vendor
.fn: mov ax, [edx]
add edx, 6
test ax, ax
jz .find
cmp ax, cx
jne .fn
.find: mov edx, [edx - 4]
mcall 4,, 0x80000000 ; lets print the vendor Name
 
ex:
;lets print the vendor Name
xor ecx, ecx ;font color
mov eax,4 ;OS CMD
mov esi,50 ;Length of text
int 0x40 ;Print the text
 
;------------------------------------------------------------------
;Get description based on Class/Subclass
cmp byte [PCI_Class], 11h ;we only know of 17 classes
ja endd ;if its more then, its unknown to us, so jump
movzx eax, byte [PCI_Class] ;load our class
shl eax, 3 ;multiply for jump table
mov ecx, [ClassList+eax+4] ;number of descriptions for this class
mov edx, [ClassList+eax] ;start of description list for class
 
mov al, byte [PCI_SubClass] ;get subclass
; mov ah, byte [PCI_Interface] ;get subclass
repu1:
cmp al,byte[edx+32] ;are subclasses the same?
je interface_check ;if so jump to print the description to screen
add edx, 33 ;if not put us at start of next description
dec ecx ;one less description in list
jnz repu1 ;was it our last?
mov edx,_UNKNOWND ;if so its unknown device
jmp endd
 
interface_check:
 
cmp [PCI_Class], 00h
je endd
 
;////////////////////////////
cmp [PCI_Class], 01h
je check01
jmp nextclass02
 
check01:
cmp [PCI_SubClass], 05h
je sc01_05
jmp endd
 
sc01_05:
cmp [PCI_Interface], 20h
je sc01_05_20
cmp [PCI_Interface], 30h
je sc01_05_30
jmp endd
 
 
sc01_05_20:
mov edx,ata1 ; pointer to text beginning
jmp endd
 
sc01_05_30:
mov edx,ata2 ; pointer to text beginning
jmp endd
 
 
;////////////////////////////
nextclass02:
cmp [PCI_Class], 02h
je endd
;////////////////////////////////
cmp [PCI_Class], 03h
je check03
jmp nextclass04
 
check03:
cmp [PCI_SubClass], 00h
je sc03_00
jmp endd
 
sc03_00:
cmp [PCI_Interface], 00000000b
je sc03_00_00000000
cmp [PCI_Interface], 00000001b
je sc03_00_00000001
;jmp endd
 
 
sc03_00_00000000:
mov edx,display1 ; pointer to text beginning
jmp endd
 
sc03_00_00000001:
mov edx,display2 ; pointer to text beginning
jmp endd
;///////////////////////////////
nextclass04:
cmp [PCI_Class], 04h
je endd
 
cmp [PCI_Class], 05h
je endd
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cmp [PCI_Class], 06h
 
je check06
jmp nextclass07
 
check06:
cmp [PCI_SubClass], 04h
je sc06_04
 
cmp [PCI_SubClass], 09h
je sc06_09
jmp endd
 
sc06_04:
cmp [PCI_Interface], 00h
je sc06_04_00
cmp [PCI_Interface], 01h
je sc06_04_01
jmp endd
 
 
sc06_04_00:
mov edx,bridge1 ; pointer to text beginning
jmp endd
 
sc06_04_01:
mov edx,bridge2 ; pointer to text beginning
jmp endd
 
;======================================
 
sc06_09:
cmp [PCI_Interface], 40h
je sc06_09_40
cmp [PCI_Interface], 80h
je sc06_09_80
jmp endd
 
 
sc06_09_40:
mov edx,bridge3 ; pointer to text beginning
jmp endd
 
sc06_09_80:
mov edx,bridge4 ; pointer to text beginning
jmp endd
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
nextclass07:
cmp [PCI_Class], 07h
je check07
jmp nextclass08
 
check07:
cmp [PCI_SubClass], 00h
je sc07_00
 
cmp [PCI_SubClass], 01h
je sc07_01
 
cmp [PCI_SubClass], 03h
je sc07_03
jmp endd
 
;=
sc07_00:
cmp [PCI_Interface], 00h
je sc07_00_00
cmp [PCI_Interface], 01h
je sc07_00_01
cmp [PCI_Interface], 02h
je sc07_00_02
cmp [PCI_Interface], 03h
je sc07_00_03
cmp [PCI_Interface], 04h
je sc07_00_04
cmp [PCI_Interface], 05h
je sc07_00_05
cmp [PCI_Interface], 06h
je sc07_00_06
 
 
sc07_00_00:
mov edx,communication0 ; pointer to text beginning
jmp endd
 
sc07_00_01:
mov edx,communication1 ; pointer to text beginning
jmp endd
 
sc07_00_02:
mov edx,communication2 ; pointer to text beginning
jmp endd
 
sc07_00_03:
mov edx,communication3 ; pointer to text beginning
jmp endd
 
sc07_00_04:
mov edx,communication4 ; pointer to text beginning
jmp endd
 
sc07_00_05:
mov edx,communication5 ; pointer to text beginning
jmp endd
 
sc07_00_06:
mov edx,communication6 ; pointer to text beginning
jmp endd
;=
sc07_01:
cmp [PCI_Interface], 00h
je sc07_01_00
cmp [PCI_Interface], 01h
je sc07_01_01
cmp [PCI_Interface], 02h
je sc07_01_02
cmp [PCI_Interface], 03h
je sc07_01_03
cmp [PCI_Interface], $FE
je sc07_01_FE
 
 
sc07_01_00:
mov edx,communication7 ; pointer to text beginning
jmp endd
 
sc07_01_01:
mov edx,communication8 ; pointer to text beginning
jmp endd
 
sc07_01_02:
mov edx,communication9 ; pointer to text beginning
jmp endd
 
sc07_01_03:
mov edx,communication10 ; pointer to text beginning
jmp endd
 
sc07_01_FE:
mov edx,communication11 ; pointer to text beginning
jmp endd
 
 
;=
sc07_03:
cmp [PCI_Interface], 00h
je sc07_03_00
cmp [PCI_Interface], 01h
je sc07_03_01
cmp [PCI_Interface], 02h
je sc07_03_02
cmp [PCI_Interface], 03h
je sc07_03_03
cmp [PCI_Interface], 04h
je sc07_03_04
 
 
sc07_03_00:
mov edx,communication12 ; pointer to text beginning
jmp endd
 
sc07_03_01:
mov edx,communication13 ; pointer to text beginning
jmp endd
 
sc07_03_02:
mov edx,communication14 ; pointer to text beginning
jmp endd
 
sc07_03_03:
mov edx,communication15 ; pointer to text beginning
jmp endd
 
sc07_03_04:
mov edx,communication16 ; pointer to text beginning
jmp endd
 
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
nextclass08:
cmp [PCI_Class], 08h
je check08
jmp nextclass09
 
check08:
cmp [PCI_SubClass], 00h
je sc08_00
cmp [PCI_SubClass], 01h
je sc08_01
cmp [PCI_SubClass], 02h
je sc08_02
cmp [PCI_SubClass], 03h
je sc08_03
jmp endd
;--
sc08_00:
cmp [PCI_Interface], 00h
je sc08_00_00
cmp [PCI_Interface], 01h
je sc08_00_01
cmp [PCI_Interface], 02h
je sc08_00_02
cmp [PCI_Interface], 10h
je sc08_00_10
cmp [PCI_Interface], 20h
je sc08_00_20
jmp endd
 
 
sc08_00_00:
mov edx,system0 ; pointer to text beginning
jmp endd
 
sc08_00_01:
mov edx,system1 ; pointer to text beginning
jmp endd
 
sc08_00_02:
mov edx,system2 ; pointer to text beginning
jmp endd
 
sc08_00_10:
mov edx,system3 ; pointer to text beginning
jmp endd
 
sc08_00_20:
mov edx,system4 ; pointer to text beginning
jmp endd
 
;--
 
sc08_01:
cmp [PCI_Interface], 00h
je sc08_01_00
cmp [PCI_Interface], 01h
je sc08_01_01
cmp [PCI_Interface], 02h
je sc08_01_02
jmp endd
 
 
sc08_01_00:
mov edx,system5 ; pointer to text beginning
jmp endd
 
sc08_01_01:
mov edx,system6 ; pointer to text beginning
jmp endd
 
sc08_01_02:
mov edx,system7 ; pointer to text beginning
jmp endd
 
 
;--
 
sc08_02:
cmp [PCI_Interface], 00h
je sc08_02_00
cmp [PCI_Interface], 01h
je sc08_02_01
cmp [PCI_Interface], 02h
je sc08_02_02
jmp endd
 
 
sc08_02_00:
mov edx,system8 ; pointer to text beginning
jmp endd
 
sc08_02_01:
mov edx,system9 ; pointer to text beginning
jmp endd
 
sc08_02_02:
mov edx,system10 ; pointer to text beginning
jmp endd
 
;--
sc08_03:
cmp [PCI_Interface], 00h
je sc08_03_00
cmp [PCI_Interface], 01h
je sc08_03_01
jmp endd
 
 
sc08_03_00:
mov edx,system11 ; pointer to text beginning
jmp endd
 
sc08_03_01:
mov edx,system12 ; pointer to text beginning
jmp endd
 
;--
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
nextclass09:
 
cmp [PCI_Class], 09h
je check09
jmp nextclass0A
 
check09:
cmp [PCI_SubClass], 04h
je sc09_04
jmp endd
 
sc09_04:
cmp [PCI_Interface], 00h
je sc09_04_00
cmp [PCI_Interface], 10h
je sc09_04_10
jmp endd
 
 
sc09_04_00:
mov edx,gameport1 ; pointer to text beginning
jmp endd
 
sc09_04_10:
mov edx,gameport2 ; pointer to text beginning
jmp endd
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
nextclass0A:
cmp [PCI_Class], 0Ah
je endd
 
cmp [PCI_Class], 0Bh
je endd
;============================================
cmp [PCI_Class], 0Ch
je check0C
jmp nextclass0D
 
check0C:
cmp [PCI_SubClass], 00h
je sc0C_00
cmp [PCI_SubClass], 03h
je sc0C_03
cmp [PCI_SubClass], 07h
je sc0C_07
jmp endd
;;;;;;;;;;;
 
sc0C_00:
cmp [PCI_Interface], 00h
je sc0C_00_00
 
cmp [PCI_Interface], 10h
je sc0C_00_10
 
 
 
sc0C_00_00:
mov edx,serialbus6 ; pointer to text beginning
jmp endd
 
sc0C_00_10:
mov edx,serialbus7 ; pointer to text beginning
jmp endd
;;;;;;;;;;;;;;;;;;;
 
sc0C_03:
cmp [PCI_Interface], 00h
je sc0C_03_00
 
cmp [PCI_Interface], 10h
je sc0C_03_10
 
cmp [PCI_Interface], 20h
je sc0C_03_20
cmp [PCI_Interface], 80h
je sc0C_03_80
 
cmp [PCI_Interface], $FE
je sc0C_03_FE
 
;jmp endd
 
sc0C_03_00:
mov edx,serialbus1 ; pointer to text beginning
jmp endd
 
sc0C_03_10:
mov edx,serialbus2 ; pointer to text beginning
jmp endd
 
 
sc0C_03_20:
mov edx,serialbus3 ; pointer to text beginning
jmp endd
 
sc0C_03_80:
mov edx,serialbus4 ; pointer to text beginning
jmp endd
 
sc0C_03_FE:
mov edx,serialbus5 ; pointer to text beginning
jmp endd
 
;;;;;;;;;;;
 
sc0C_07:
cmp [PCI_Interface], 00h
je sc0C_07_00
 
cmp [PCI_Interface], 01h
je sc0C_07_01
 
cmp [PCI_Interface], 02h
je sc0C_07_02
 
 
sc0C_07_00:
mov edx,serialbus8 ; pointer to text beginning
jmp endd
 
sc0C_07_01:
mov edx,serialbus9 ; pointer to text beginning
jmp endd
 
sc0C_07_02:
mov edx,serialbus10 ; pointer to text beginning
jmp endd
;;;;;;;;;;;;;;;;;;;
;==============================================
nextclass0D:
cmp [PCI_Class], 0Dh
je endd
;;;;;;;;;;;;;;;;;;;;;;;;;;
cmp [PCI_Class], 0Eh
je check0E
jmp nextclass0F
 
check0E:
cmp [PCI_SubClass], 00h
je sc0E_00
jmp endd
 
sc0E_00:
cmp [PCI_Interface], 00h
je sc0E_00_00
cmp [PCI_Interface], 00h ;!!!
ja sc0E_00_xx
jmp endd
 
 
sc0E_00_00:
mov edx,i2o1 ; pointer to text beginning
jmp endd
 
sc0E_00_xx:
mov edx,i2o2 ; pointer to text beginning
jmp endd
 
 
;////////////////////////////
nextclass0F:
cmp [PCI_Class], 0Fh
je endd
 
cmp [PCI_Class], 10h
je endd
 
cmp [PCI_Class], 11h
je endd
 
endd:
;
; Modified on ??-04-2007 by Ghost for size
;------------------------------------------------------------------
mov eax, dword [PCI_Class]
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]
@@:
and ebx, 0x0000FFFF ;clear X position
or ebx, 0x02300000 ;set X position to 560 pixels
xor ecx, ecx ;color of text
mov eax,4 ;draw text system function
mov esi,32 ;length of text to draw
int 0x40 ;draw the text
 
or ebx, 0x24E0000 ; set X position to 590 pixels
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
ret
 
ClassList:
dd Class0 , 2, Class1 , 8, Class2, 8, Class3, 4
dd Class4 , 4, Class5 , 3, Class6, 12, Class7, 7
dd Class8 , 8, Class9 , 6, ClassA, 2, ClassB, 7
dd ClassC , 10, ClassD , 8, ClassE, 1, ClassF, 4
dd Class10, 3, Class11, 5
include 'VENDORS.INC'
;------------------------------------------------------------------
 
 
 
; DATA AREA
DATA
 
labelt:
db 'PCI Device Enumeration v 2.0 by J. Delozier, S. Kuzmin, V. Hanla, M. Zakiyanov'
labellen:
 
ata1:
db 'Storage - ATA c. w/ single DMA '
ata1len:
Form: dw 800 ; window width (no more, special for 800x600)
dw 100 ; window x start
dw 420 ; window height
dw 100 ; window y start
 
ata2:
db 'Storage - ATA c. w/ chained DMA '
ata2len:
title db 'PCI Device Enumeration v 2.1 by J. Delozier, S. Kuzmin, V. Hanla, M. Zakiyanov', 0
 
PCIWin mls \
'Please remember to enable PCI Access to Applications in Setup Menu.',\
'',\
'PCI Version = x.xx',\
'Last PCI Bus = x',\
'Quantity of devices =',\
'',\
'VenID DevID Bus# Dev# Fnc Rev Class Subclass/ IRQ Company Description',\
' Interface',\
'----- ----- ---- ---- --- --- ----- --------- --- ------------------------------------------ ----------------'
 
display1:
db 'Display - VGA-compatible c. '
display1len:
;------------------------------------------------------------------
; UNINITIALIZED DATA AREA
UDATA
 
display2:
db 'Display - 8514-compatible c. '
display2len:
total db ?
V_Bus db ?
V_Dev db ?
PCI_Version dw ?
PCI_LastBus db ?
PCI_Device dw ?
PCI_Vendor dw ?
PCI_Bus db ?
PCI_Dev db ?
PCI_Rev db ?
; don`t change order!!!
PCI_Class db ?
PCI_SubClass db ?
PCI_Interface db ?
PCI_IRQ db ?
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
serialbus1:
db 'Serial Bus - USB Universal HC '
serialbus1len:
 
serialbus2:
db 'Serial Bus - USB Open HC '
serialbus2len:
 
serialbus3:
db 'Serial Bus - USB2 Enhanced HC '
serialbus3len:
 
serialbus4:
db 'Serial Bus - USB w/o specific PI'
serialbus4len:
 
serialbus5:
db 'Serial Bus - USB device (not HC)'
serialbus5len:
 
 
serialbus6:
db 'Serial Bus - IEEE 1394(FireWire)'
serialbus6len:
 
serialbus7:
db 'Serial Bus- IEEE 1394(Open HCI) '
serialbus7len:
 
 
serialbus8:
db 'Serial Bus - IPMI SMIC I. '
serialbus8len:
 
serialbus9:
db 'Serial Bus - IPMI Kybd CSI '
serialbus9len:
 
serialbus10:
db 'Serial Bus - IPMI BTI '
serialbus10len:
;;;;;;;;;;;;;;;;;;;;;;;
bridge1:
db 'Bridge - PCI/PCI '
bridge1len:
 
bridge2:
db 'Bridge - Subtract.Decode PCI/PCI'
bridge2len:
 
bridge3:
db 'Bridge - Semi-transp. PCI/PCI 1 '
bridge3len:
 
bridge4:
db 'Bridge - Semi-transp. PCI/PCI 2 '
bridge4len:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
gameport1:
db 'Input - Gameport c. (generic) '
gameport1len:
 
gameport2:
db 'Input - Gameport c. (legacy) '
gameport2len:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
i2o1:
db 'Intelligent I/O - I/O c. (I2O 1)'
i2o1len:
 
i2o2:
db 'Intelligent I/O - c.(FIFO @ 40h)'
i2o2len:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
communication0:
db 'Communication - Serial (XT) '
communication0len:
 
communication1:
db 'Communication - Serial c.(16450)'
communication1len:
 
communication2:
db 'Communication - Serial c.(16550)'
communication2len:
 
communication3:
db 'Communication - Serial c.(16650)'
communication3len:
 
communication4:
db 'Communication - Serial c.(16750)'
communication4len:
 
communication5:
db 'Communication - Serial c.(16850)'
communication5len:
 
communication6:
db 'Communication - Serial c.(16950)'
communication6len:
;-------------------------------
communication7:
db 'Communication - Parallel port '
communication7len:
 
communication8:
db 'Communication - Bi-dir. par.port'
communication8len:
 
communication9:
db 'Communication - ECP 1.X par.port'
communication9len:
 
communication10:
db 'Communication - IEEE1284 c. '
communication10len:
 
communication11:
db 'Communication - IEEE1284 device '
communication11len:
;-------------------------------
communication12:
db 'Communication - Generic modem '
communication12len:
 
communication13:
db 'Communication -Hayes modem 16450'
communication13len:
 
communication14:
db 'Communication -Hayes modem 16550'
communication14len:
 
communication15:
db 'Communication -Hayes modem 16650'
communication15len:
 
communication16:
db 'Communication -Hayes modem 16750'
communication16len:
 
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
system0:
db 'System - Generic 8259 PIC '
system0len:
 
system1:
db 'System - ISA PIC '
system1len:
 
system2:
db 'System - EISA PIC '
system2len:
 
system3:
db 'System - I/O APIC interrupt c. '
system3len:
 
system4:
db 'System - I/O(x) APIC interrupt c'
system4len:
;-
system5:
db 'System - Generic 8237 DMA c. '
system5len:
 
system6:
db 'System - ISA DMA c. '
system6len:
 
system7:
db 'System - EISA DMA c. '
system7len:
;--
system8:
db 'System - 8254 system timer '
system8len:
 
system9:
db 'System - ISA system timer '
system9len:
 
system10:
db 'System - EISA (2 system timers) '
system10len:
;--
system11:
db 'System - Generic RTC c. '
system11len:
 
system12:
db 'System - ISA RTC c. '
system12len:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
PCIWin:
db 'Please remember to enable PCI Access to Applications in Setup Menu.'
db ' '
db ' '
db ' '
db 'PCI Version = '
db ' '
db 'Last PCI Bus = '
db ' '
db 'Quantity of devices = '
db ' '
db ' '
db ' '
db 'VenID DevID Bus# Dev# Fnc Rev Class Subclass/ Comp'
db 'any Description '
db ' Interface '
db ' '
db '----- ----- ---- ---- --- --- ----- -------- --------------------'
db '---------------------- ----------------'
db 'x'
 
;
 
total db 0
V_Bus db 0
V_Dev db 0
PCI_Version dw 0
PCI_LastBus db 0
PCI_Device dw 0
PCI_Vendor dw 0
PCI_Bus db 0
PCI_Dev db 0
PCI_Rev db 0
PCI_Class db 0
PCI_SubClass db 0
PCI_Interface db 0
 
Proc_Info:
times 1024 db 0
 
I_END:
Proc_Info process_information
MEOS_APP_END