Subversion Repositories Kolibri OS

Rev

Rev 135 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
132 diamond 1
;***************************************************************
2
; project name:    PCI Device Enumeration
3
; target platform: KolibriOS and MenuetOS
205 heavyiron 4
; compiler:        flat assmebler 1.66
5
; version:         2.0
6
; last update:     30(th) August 2006
7
; maintained by:   Jason Delozier and Sergey Kuzmin
8
; e-mail:          cordata51@hotmail.com and kuzmin_serg@list.ru
9
; project site:    http://www.coolthemes.narod.ru/pcidev.html
132 diamond 10
;***************************************************************
11
;Summary: This program will attempt to scan the PCI Bus
12
;        and display basic information about each device
13
;        connected to the PCI Bus.
14
;***************************************************************
15
;HISTORY:
16
;keep dates in european format (dd/mm/yyyy), please
17
; '!' means big changes
205 heavyiron 18
;
19
;to-do:
20
; PCI version should be normalized 0210 -> 02.10 (it is BCD number)
21
; vendor's website
22
; more vendors
23
; device IRQ
24
; Subsystem id and Subsystem vendor id detection
25
 
26
; Full device detection (like "ATI Radeon 9200") will increase app
27
; size a lot and probably it is function of particular drivers
132 diamond 28
;----------------------------------------------------------------
205 heavyiron 29
;2.0: PCIDEV   30/08/2006
30
;(it differs a lot from the version 1.0, which was introduced 19 months ago)
31
;Author:    Marat Zakiyanov aka Mario79 
32
;           Sergey Kuzmin aka Wildwest 
33
;Features:
34
;           added
35
;                 * Detection of Interface by Mario79
36
;                 * 122 vendor id's by Wildwest
37
;                 * Description is based on Class, SubClass and Interface now (PCI 3.0) by Wildwest
38
;----------------------------------------------------------------
132 diamond 39
;1.31: PCIDEV   13/05/2006
40
;Author:    Jason Delozier 
41
;Features:
42
;           fixed
43
;                 * ! bug in Company Name look up code that would cause Unknown Name errors.
44
;                 * ! possible bugs, many instructions missing byte, word, dword prefixes
45
;                 * ! possible bug which could have occured after removing  "PREVIOUSVERSIONLIST"
46
;                     entry in loop up code and not fixing jump parameters.
47
;           added
48
;                 *  comments to various parts of the code
49
;           optimized
50
;                 * various parts of the source, too many to remember and mention.
51
;                 * changed entries for Subclasses in vendors.inc to Byte format, saves a little space.
52
;----------------------------------------------------------------
53
;1.30: PCIDEV   11/05/2006
54
;Author:    Sergey Kuzmin aka Wildwest 
55
;Features:
56
;           added
57
;                * 3 new vendor id's (ESS from Madis Kalme and 2 id's
58
;                  forgotten from 1.15 release: Broadcom -SiByte and Chaintech Comp.)
205 heavyiron 59
;           changed
60
;                * I don't know why other devs (Jason or Victor) changed window style
132 diamond 61
;                  to old ugly one, so I changed it back to skinned type 3.
62
;                * the same goes to the use of macroc.inc - it is enabled again.
63
;           deleted
64
;                * there is no more label "PREVIOUSVERSIONLIST" - id's moved to the
65
;                  appropriate parts of global list.
66
;----------------------------------------------------------------
67
;1.29: PCIDEV   30/04/2006
68
;Author:    Jason Delozier 
69
;Features:
70
;           fixed
71
;                 * ! bug that would not allow devices with device
72
;                   numbers > 16 to be displayed.
73
;           added
74
;                 * ! another heading called "FNC" (function) which allows
75
;                   the multipurpose Device/Function varible to be split and
76
;                   displayed to the user properly.
77
;                 * horizontal bars to display for easier reading.
78
;           optimized
79
;                 * vendor/description search routines for speed and space.
80
;----------------------------------------------------------------
81
;1.25: PCIDEV   02/10/2005
82
;Author:    Sergey Kuzmin aka Wildwest 
83
;Features:
84
;            changed
205 heavyiron 85
;                  * ! Description is based on Class and SubClass
132 diamond 86
;                     now (PCI 3.0). The Names of Classes and SubClasses
87
;                     are in the end of Vendors.inc
88
;            deleted
89
;                  * label "Descriptions" (names of Classes)
90
;
91
;----------------------------------------------------------------
92
;1.20: PCIDEV   16/08/2005
93
;Author:    Victor Alberto Gil Hanla a.k.a. vhanla 
94
;Features:
95
;           added
96
;                  * ! many vendor lists (865)
97
;           deleted
98
;                  * previous version's list
99
;           changed
100
;                  * previous Company Name searching and printing
101
;----------------------------------------------------------------
102
;1.15: PCIDEV   03/06/2005
103
;Author:    Sergey Kuzmin aka Wildwest 
104
;Features:
105
;           added
106
;                                  * quantity of devices,
107
;                                  * ! detection of Company Name based on Vendor ID,
108
;                                  * database of VenID (35 ID's),
109
;                                  * macros.inc for smaller size,
110
;           changed
111
;                                  * interface+(skinned window),
112
;                                  * VenID before DevID in 'table'(was DevID before VenID)
113
;----------------------------------------------------------------
114
;1.0: PCIDEV    30/01/2005
115
;Author:    Jason Delozier
116
;Features:
117
;          able to
118
;                 * detect PCI version,
119
;                 * quantity of PCI buses,
120
;                 * Vendor&Device ID for appropriate Device on Bus;
121
;                 * detect Revision, Class and Subclass of Device,
122
;                 * and make Description based on Class
123
;-------------------------------------------------------------
124
use32
125
 
205 heavyiron 126
  org    0x0
132 diamond 127
 
205 heavyiron 128
  db     'MENUET01'; 8 byte id
129
  dd     0x01   ; header version
130
  dd     START   ; start of code
131
  dd     I_END   ; size of image
132
  dd     0xFFFF   ; memory for app = 64 KB
133
  dd     I_END   ; esp
134
  dd     0x0 , 0x0 ; I_Param , I_Icon
132 diamond 135
 
136
 
137
include 'macros.inc'
205 heavyiron 138
include 'VENDORS.INC'
132 diamond 139
 
205 heavyiron 140
START:    ; start of execution
132 diamond 141
     call draw_window
142
 
143
still:
144
    mov  eax,10   ; wait here for event
145
    int  0x40
146
 
205 heavyiron 147
    cmp  eax,1   ; redraw request ?
148
    je  red
149
    cmp  eax,2   ; key in buffer ?
150
    je  key
151
    cmp  eax,3   ; button in buffer ?
152
    je  button
132 diamond 153
 
154
    jmp  still
155
 
205 heavyiron 156
  red:    ; redraw
157
    mov eax, 9        ;window redraw requested so get new window coordinates and size
158
    mov ebx, Proc_Info      ;area to store process information
159
    mov ecx, -1       ;
160
    int 0x40        ;get the process information
132 diamond 161
    mov eax,[Proc_Info+34]  ;store the window coordinates into the Form Structure
205 heavyiron 162
    mov [Form+2], ax      ;x start position
132 diamond 163
    mov eax,[Proc_Info+38]  ;
205 heavyiron 164
    mov [Form+6],ax      ;ystart position
132 diamond 165
    mov eax,[Proc_Info+42]  ;
205 heavyiron 166
    mov [Form],ax      ;window width
132 diamond 167
    mov eax,[Proc_Info+46]  ;
205 heavyiron 168
    mov [Form+4] ,ax      ;window height
169
    call draw_window      ;go redraw window now
132 diamond 170
    jmp  still
171
 
205 heavyiron 172
  key:    ; key
173
    mov  eax,2   ; just read it and ignore
132 diamond 174
    int  0x40
175
    jmp  still
176
  button:   ; button
177
    mov  eax,17   ; get id
178
    int  0x40
179
 
205 heavyiron 180
    cmp  ah,1  ; button id=1 ?
132 diamond 181
    jne  noclose
182
 
183
    mov  eax,-1   ; close this program
184
    int  0x40
185
  noclose:
186
    jmp  still
187
 
188
 
189
 
190
 
191
;   *********************************************
192
;   *******  WINDOW DEFINITIONS AND DRAW ********
193
;   *********************************************
194
Form:
195
   dw 780 ;window width
196
   dw 100 ;window x start
197
   dw 420 ;window height
198
   dw 100 ;window y start
199
 
200
 
201
 
202
draw_window:
203
 
204
    mov byte [total],0
205
 
206
    mov  eax,12      ; function 12:tell os about windowdraw
205 heavyiron 207
    mov  ebx,1       ; 1, start of draw
132 diamond 208
    int  0x40
209
    ; DRAW WINDOW
205 heavyiron 210
    mov  eax,0         ; function 0 : define and draw window
211
    mov  ebx, dword [Form]     ; x/width of window
212
    mov  ecx, dword [Form+4]     ; y/height of window
213
    mov  edx,0x03ffffff      ; color of work area RRGGBB,8->color gl
214
    mov  esi,0x805080d0      ; color of grab bar  RRGGBB,8->color gl
215
    mov  edi,0x005080d0      ; color of frames    RRGGBB
216
    int  0x40         ; draw the window
132 diamond 217
    ; WINDOW LABEL
205 heavyiron 218
    mov  eax,4         ; function 4 : write text to window
219
    mov  ebx,8*65536+8       ; [x start] *65536 + [y start]
220
    mov  ecx,0x10ddeeff      ; font 1 & color ( 0xF0RRGGBB )
221
    mov  edx,labelt       ; pointer to text beginning
222
    mov  esi,labellen-labelt     ; text length
132 diamond 223
    int  0x40
224
 
225
    ;draw captions to window
205 heavyiron 226
    mov ebx, 20*65536+25     ;x start, ystart of text
227
    mov ecx, 0x224466       ;color of text
228
    mov edx, dword PCIWin     ;start of text buffer
229
    mov esi, 106             ;lenght of line  106
230
newline:         ;
231
    mov eax, 4         ;draw text system function
232
    int 0x40         ;draw the text
233
    add ebx, 10        ;one line down
234
    add edx, esi       ;add lenght of line to offset of text buffer
235
    cmp byte[edx], byte 'x'     ;is it the end of buffer?
236
    jne newline        ;if not draw another line of text
132 diamond 237
 
238
    ;Insert horizontal bars  in list area
205 heavyiron 239
    mov eax, 13        ;draw bar system function
240
    mov ebx, 18        ;set Xstart position of bar
241
    shl ebx, 16        ;
242
    mov bx,word [Form]       ;get width of window
243
    sub bx, 32         ;bar is 32 pixels shorter then window width
244
    mov ecx, 119*65536+10     ;set Ystart(109) and Height(10) of bar   109
245
    mov edx, 0xC0C0C0       ;set color of bar
246
   again:         ;begin draw bar loop
247
    int 0x40         ;draw bar to window area
248
    shr ecx, 16        ;move the Ystart position to working area
249
    add ecx, 34        ;add 34 pixels to Y Start (moves bar down)
250
    cmp cx,word [Form+4]     ;is the Ystart position outside of window area
251
    jae nomo         ;if so stop drawing bars
252
    sub ecx, 14        ;if not, we only need 20 pixels between bar tops
253
    shl ecx, 16        ;set that values as Ystart
254
    add ecx, 10        ;Bar Height is always 10 pixels
255
    jmp again         ;draw another bar
256
   nomo:         ;done drawing bars here
132 diamond 257
 
258
    ;start PCI stuff
205 heavyiron 259
    call Get_PCI_Info       ;get pci version and last bus
260
    mov cx,word [PCI_Version]     ;number to draw
261
    mov eax, 47        ;draw number system function
262
    xor esi, esi       ;color of text
263
    mov ebx, 0x00040100      ;4 digits to draw in hex format
264
    mov edx, 110*65536+45     ;x/y start position of number
265
    int 0x40         ;draw pci version to window
266
    mov cl,byte [PCI_LastBus]     ;number to draw
267
    mov ebx, 0x00020100      ;2 digits hex format
268
    add edx, 10        ;one line below pci version
269
    int 0x40         ;draw the last bus to window
132 diamond 270
 
205 heavyiron 271
    call scan_Pci       ;scan for and draw each pci device
132 diamond 272
 
205 heavyiron 273
    movzx ecx, byte [total]     ;number to draw
274
    mov eax, 47        ;draw number system function
275
    mov ebx, 0x00020000      ;2 digits to draw in decimal format
276
    xor esi, esi       ;color of text
277
    mov edx, 150*65536+65     ;x/y position to draw to
278
    int 0x40         ;draw total number of devices to window
132 diamond 279
 
205 heavyiron 280
    mov  eax,12        ; function 12:tell os about windowdraw
281
    mov  ebx,2         ; 2, end of draw
132 diamond 282
    int  0x40
283
 
284
    ret
285
;   ***********************************************
286
;   *******  END WINDOW DEFINITIONS & DRAW  *******
287
;   ***********************************************
288
 
289
 
290
;******************************************************
205 heavyiron 291
;* Gets the PCI Version and Last Bus
132 diamond 292
Get_PCI_Info:
293
    mov eax, 62
294
    xor ebx, ebx
295
    int 0x40
296
    mov word [PCI_Version], ax
297
    mov eax, 62
298
    mov ebx, 1
299
    int 0x40
300
    mov byte [PCI_LastBus], al
301
ret
302
;******************************************************
303
 
304
 
305
;******************************************************
306
;* Get all devices on PCI Bus
307
scan_Pci:
205 heavyiron 308
   cmp  byte [PCI_LastBus],0xff ;0xFF means no pci bus found
309
   jne  Pci_Exists    ;
310
   ret        ;if no bus then leave
132 diamond 311
Pci_Exists:
205 heavyiron 312
   mov  byte [V_Bus], 0   ;reset varibles
313
   mov  byte [V_Dev], 0   ;
314
   mov  edx,  20*65536+110  ;set start write position
132 diamond 315
Start_Enum:
205 heavyiron 316
   mov  bl, 6      ;get a dword
317
   mov  bh, byte [V_Bus]  ;bus of pci device
318
   mov  ch, byte [V_Dev]  ;device number/function
319
   mov  cl, 0      ;offset to device/vendor id
320
   mov  eax, 62     ;pci system function
321
   int  0x40      ;get ID's
132 diamond 322
 
205 heavyiron 323
   cmp  ax, 0      ;Vendor ID should not be 0 or 0xFFFF
324
   je  nextDev     ;check next device if nothing exists here
325
   cmp  ax, 0xffff    ;
326
   je  nextDev     ;
132 diamond 327
 
205 heavyiron 328
   mov  word [PCI_Vendor], ax  ;There is a device here, save the ID's
329
   shr  eax, 16     ;
330
   mov  word [PCI_Device], ax  ;
331
   mov  eax, 62     ;PCI Sys Function
332
   mov  bl, 4      ;Read config byte
333
   mov  bh, byte [V_Bus]  ;Bus #
334
   mov  ch, byte [V_Dev]  ;Device # on bus
335
   mov  cl, 0x08    ;Register to read (Get Revision)
336
   int  0x40      ;Read it
337
   mov  byte [PCI_Rev], al  ;Save it
338
   mov  eax, 62     ;PCI Sys Function
339
   mov  cl, 0x0b    ;Register to read (Get class)
340
   int  0x40      ;Read it
341
   mov  byte [PCI_Class], al  ;Save it
342
   mov  eax, 62     ;PCI Sys Function
343
   mov  cl, 0x0a    ;Register to read (Get Subclass)
344
   int  0x40      ;Read it
345
   mov  byte [PCI_SubClass], al ;Save it
346
; from Mario79 august 2006
347
   mov  eax, 62      ;PCI Sys Function
348
   mov  cl, 0x09      ;Register to read (Get Interface)
349
   int  0x40          ;Read it
350
   mov  [PCI_Interface], al ;Save it
351
;
352
   inc  byte [total]    ;one more device found
353
   call Print_New_Device  ;print device info to screen
132 diamond 354
nextDev:
205 heavyiron 355
   inc  byte [V_Dev]    ;next device on this bus
356
   jnz  Start_Enum    ;jump until we reach zero
357
        ;(used to be JNO which caused bug!!! 30-4-2006, JMD)
358
   mov  byte [V_Dev], 0   ;reset device number
359
   inc  byte [V_Bus]    ;next bus
360
   mov  al, byte [PCI_LastBus]  ;get last bus
361
   cmp  byte [V_Bus], al  ;was it last bus
362
   jbe  Start_Enum    ;if not jump to keep searching
132 diamond 363
ret
364
;******************************************************
365
 
366
 
367
 
368
;******************************************************
369
;* Print device info to screen
370
Print_New_Device:
205 heavyiron 371
   mov   eax, 47    ;Write number to screen system function
372
   mov   ebx, 0x00040100  ;4 byte number, print in hexidecimal
373
   xor   esi, esi                ;Color of text
374
   movzx ecx,word [PCI_Vendor]  ;Pointer to number to be written
375
   int   0x40      ;Write Vendor ID
376
   and   edx, 0xFFFF    ;*****************************************
377
   or   edx, 54*65536    ;X start becomes 54
378
   movzx ecx,word [PCI_Device]  ;get Vendor ID
379
   int   0x40      ;Draw Vendor ID to Window
380
   mov   ebx, 0x00020100  ;2 digit number, in hexidecimal format
381
   and   edx, 0xFFFF    ;*****************************************
382
   or   edx, 98*65536    ;X start becomes 98
383
   movzx ecx,byte [V_Bus]  ;get bus number
384
   int   0x40      ;draw bus number to screen
385
   and   edx, 0xFFFF    ;*****************************************
386
   or   edx, 128*65536   ;X start becomes 128
387
   movzx ecx,byte [V_Dev]  ;get device number
388
   shr   ecx, 3     ;device number is bits 3-7
389
   int   0x40      ;Draw device Number To Window
390
   and   edx, 0xFFFF    ;*****************************************
391
   or   edx, 155*65536   ;X start becomes 155
392
   movzx ecx, byte [V_Dev]  ;get Function number
393
   and   ecx, 7     ;function is first 3 bits
394
   int   0x40      ;Draw Function Number To Window
395
   and   edx, 0xFFFF    ;*****************************************
396
   or   edx, 179*65536   ;X start becomes 179
397
   movzx ecx,byte [PCI_Rev]  ;get revision number
398
   int   0x40      ;Draw Revision to screen
399
   and   edx, 0xFFFF    ;*****************************************
400
   or   edx, 215*65536   ;X start becomes 215
401
   movzx ecx,byte [PCI_Class]  ;get PCI_Class
402
   int   0x40      ;Draw Class to screen
403
   and   edx, 0xFFFF    ;*****************************************
404
   or   edx, 250*65536   ;X start becomes 250
132 diamond 405
   movzx ecx,byte [PCI_SubClass];get sub class
205 heavyiron 406
   int   0x40      ;Draw Sub Class to screen
407
; from Mario79 august 2006
408
   and     edx, 0xFFFF          ;*****************************************
409
   or      edx, 280*65536       ;X start becomes 280
410
   movzx ecx, [PCI_Interface]   ;get Interface
411
   int   0x40
412
;
132 diamond 413
   ;Write Names
205 heavyiron 414
   movzx ebx, dx    ;Set y position
415
   or   ebx, 310*65536   ;set Xposition to 310
132 diamond 416
 
417
;**********************************************************
418
;Prints the Vendor's Name based on Vendor ID
419
;
420
; modified part by vhanla (I know it is not a fastest way to search)
421
; it needs optimization... HELP this project!
422
;
423
; Modified on 30-04-2006 by JMD for size
424
;-----------------------------------------------------------------------------
425
    ;first determine which list to find the vendor in
426
    mov ax, word [PCI_Vendor]
205 heavyiron 427
    mov ecx, 255     ;# vendors in most lists
428
    cmp ax,4540      ;Check if Vendor's value is less than this number (the start of next part)
429
    jae next1       ;if it is less, let's continue, or jump to next1
132 diamond 430
      mov edx, _FIRSTPART  ;select this list
205 heavyiron 431
      jmp rep1       ;start searching list
432
  next1:       ;
433
    cmp ax,5120        ;same thing happening here as above^
434
    jae next2       ;
132 diamond 435
      mov edx, _SECONDPART ;
205 heavyiron 436
      jmp rep1       ;
437
  next2:       ;
438
    cmp ax,5459      ;
439
    jae next3       ;
132 diamond 440
      mov edx, _THIRDPART  ;
205 heavyiron 441
      jmp rep1       ;
442
  next3:       ;
443
      mov ecx, 222     ;only 222 vendors in this list
132 diamond 444
      mov edx, _FOURTHPART ;
445
 
446
  rep1:
205 heavyiron 447
   cmp ax,word[edx+50]     ;are Vendor ID's the same?
448
   je  ex       ;if so jump to print the description to screen
449
   add edx, 52       ;if not put us at start of next description
450
   dec ecx       ;one less description in list
451
   jnz rep1       ;was it our last?
452
   mov edx, _UNKNOWN     ;if so we dont know this Vendor
132 diamond 453
 
454
 ex:
455
  ;lets print the vendor Name
205 heavyiron 456
   xor ecx, ecx      ;font color
457
   mov eax,4       ;OS CMD
458
   mov esi,50       ;Length of text
459
   int 0x40       ;Print the text
132 diamond 460
 
461
;------------------------------------------------------------------
462
;Get description based on Class/Subclass
205 heavyiron 463
   cmp   byte [PCI_Class], 11h    ;we only know of 17 classes
464
   ja   endd        ;if its more then, its unknown to us, so jump
465
   movzx eax, byte [PCI_Class]    ;load our class
466
   shl   eax, 3       ;multiply for jump table
467
   mov   ecx, [ClassList+eax+4]   ;number of descriptions for this class
468
   mov   edx, [ClassList+eax]    ;start of description list for class
469
 
470
   mov   al, byte [PCI_SubClass] ;get subclass
471
  ; mov   ah, byte [PCI_Interface] ;get subclass
132 diamond 472
 repu1:
205 heavyiron 473
   cmp   al,byte[edx+32]    ;are subclasses the same?
474
   je   interface_check          ;if so jump to print the description to screen
475
   add   edx, 33      ;if not put us at start of next description
476
   dec   ecx        ;one less description in list
477
   jnz   repu1        ;was it our last?
478
   mov   edx,_UNKNOWND      ;if so its unknown device
479
   jmp endd
480
 
481
 interface_check:
482
 
483
 cmp [PCI_Class], 00h
484
 je endd
485
 
486
;////////////////////////////
487
 cmp [PCI_Class], 01h
488
 je check01
489
 jmp nextclass02
490
 
491
check01:
492
 cmp [PCI_SubClass], 05h
493
 je sc01_05
494
 jmp endd
495
 
496
sc01_05:
497
cmp [PCI_Interface], 20h
498
je sc01_05_20
499
cmp [PCI_Interface], 30h
500
je sc01_05_30
501
jmp endd
502
 
503
 
504
sc01_05_20:
505
mov  edx,ata1     ; pointer to text beginning
506
jmp endd
507
 
508
sc01_05_30:
509
mov  edx,ata2     ; pointer to text beginning
510
jmp endd
511
 
512
 
513
;////////////////////////////
514
nextclass02:
515
 cmp [PCI_Class], 02h
516
 je endd
517
;////////////////////////////////
518
 cmp [PCI_Class], 03h
519
 je check03
520
 jmp nextclass04
521
 
522
check03:
523
 cmp [PCI_SubClass], 00h
524
 je sc03_00
525
 jmp endd
526
 
527
sc03_00:
528
cmp [PCI_Interface], 00000000b
529
je sc03_00_00000000
530
cmp [PCI_Interface], 00000001b
531
je sc03_00_00000001
532
;jmp endd
533
 
534
 
535
sc03_00_00000000:
536
mov  edx,display1     ; pointer to text beginning
537
jmp endd
538
 
539
sc03_00_00000001:
540
mov  edx,display2     ; pointer to text beginning
541
jmp endd
542
;///////////////////////////////
543
nextclass04:
544
 cmp [PCI_Class], 04h
545
 je endd
546
 
547
 cmp [PCI_Class], 05h
548
 je endd
549
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
550
 cmp [PCI_Class], 06h
551
 
552
 je check06
553
 jmp nextclass07
554
 
555
check06:
556
 cmp [PCI_SubClass], 04h
557
 je sc06_04
558
 
559
 cmp [PCI_SubClass], 09h
560
 je sc06_09
561
 jmp endd
562
 
563
sc06_04:
564
cmp [PCI_Interface], 00h
565
je sc06_04_00
566
cmp [PCI_Interface], 01h
567
je sc06_04_01
568
jmp endd
569
 
570
 
571
sc06_04_00:
572
mov  edx,bridge1     ; pointer to text beginning
573
jmp endd
574
 
575
sc06_04_01:
576
mov  edx,bridge2     ; pointer to text beginning
577
jmp endd
578
 
579
;======================================
580
 
581
sc06_09:
582
cmp [PCI_Interface], 40h
583
je sc06_09_40
584
cmp [PCI_Interface], 80h
585
je sc06_09_80
586
jmp endd
587
 
588
 
589
sc06_09_40:
590
mov  edx,bridge3     ; pointer to text beginning
591
jmp endd
592
 
593
sc06_09_80:
594
mov  edx,bridge4     ; pointer to text beginning
595
jmp endd
596
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
597
nextclass07:
598
 cmp [PCI_Class], 07h
599
 je check07
600
 jmp nextclass08
601
 
602
check07:
603
 cmp [PCI_SubClass], 00h
604
 je sc07_00
605
 
606
 cmp [PCI_SubClass], 01h
607
 je sc07_01
608
 
609
 cmp [PCI_SubClass], 03h
610
 je sc07_03
611
 jmp endd
612
 
613
;=
614
sc07_00:
615
cmp [PCI_Interface], 00h
616
je sc07_00_00
617
cmp [PCI_Interface], 01h
618
je sc07_00_01
619
cmp [PCI_Interface], 02h
620
je sc07_00_02
621
cmp [PCI_Interface], 03h
622
je sc07_00_03
623
cmp [PCI_Interface], 04h
624
je sc07_00_04
625
cmp [PCI_Interface], 05h
626
je sc07_00_05
627
cmp [PCI_Interface], 06h
628
je sc07_00_06
629
 
630
 
631
sc07_00_00:
632
mov  edx,communication0    ; pointer to text beginning
633
jmp endd
634
 
635
sc07_00_01:
636
mov  edx,communication1     ; pointer to text beginning
637
jmp endd
638
 
639
sc07_00_02:
640
mov  edx,communication2     ; pointer to text beginning
641
jmp endd
642
 
643
sc07_00_03:
644
mov  edx,communication3     ; pointer to text beginning
645
jmp endd
646
 
647
sc07_00_04:
648
mov  edx,communication4     ; pointer to text beginning
649
jmp endd
650
 
651
sc07_00_05:
652
mov  edx,communication5     ; pointer to text beginning
653
jmp endd
654
 
655
sc07_00_06:
656
mov  edx,communication6     ; pointer to text beginning
657
jmp endd
658
;=
659
sc07_01:
660
cmp [PCI_Interface], 00h
661
je sc07_01_00
662
cmp [PCI_Interface], 01h
663
je sc07_01_01
664
cmp [PCI_Interface], 02h
665
je sc07_01_02
666
cmp [PCI_Interface], 03h
667
je sc07_01_03
668
cmp [PCI_Interface], $FE
669
je sc07_01_FE
670
 
671
 
672
sc07_01_00:
673
mov  edx,communication7    ; pointer to text beginning
674
jmp endd
675
 
676
sc07_01_01:
677
mov  edx,communication8     ; pointer to text beginning
678
jmp endd
679
 
680
sc07_01_02:
681
mov  edx,communication9     ; pointer to text beginning
682
jmp endd
683
 
684
sc07_01_03:
685
mov  edx,communication10     ; pointer to text beginning
686
jmp endd
687
 
688
sc07_01_FE:
689
mov  edx,communication11     ; pointer to text beginning
690
jmp endd
691
 
692
 
693
;=
694
sc07_03:
695
cmp [PCI_Interface], 00h
696
je sc07_03_00
697
cmp [PCI_Interface], 01h
698
je sc07_03_01
699
cmp [PCI_Interface], 02h
700
je sc07_03_02
701
cmp [PCI_Interface], 03h
702
je sc07_03_03
703
cmp [PCI_Interface], 04h
704
je sc07_03_04
705
 
706
 
707
sc07_03_00:
708
mov  edx,communication12    ; pointer to text beginning
709
jmp endd
710
 
711
sc07_03_01:
712
mov  edx,communication13     ; pointer to text beginning
713
jmp endd
714
 
715
sc07_03_02:
716
mov  edx,communication14     ; pointer to text beginning
717
jmp endd
718
 
719
sc07_03_03:
720
mov  edx,communication15     ; pointer to text beginning
721
jmp endd
722
 
723
sc07_03_04:
724
mov  edx,communication16     ; pointer to text beginning
725
jmp endd
726
 
727
 
728
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
729
nextclass08:
730
cmp [PCI_Class], 08h
731
je check08
732
jmp nextclass09
733
 
734
check08:
735
 cmp [PCI_SubClass], 00h
736
 je sc08_00
737
 cmp [PCI_SubClass], 01h
738
 je sc08_01
739
 cmp [PCI_SubClass], 02h
740
 je sc08_02
741
 cmp [PCI_SubClass], 03h
742
 je sc08_03
743
 jmp endd
744
;--
745
sc08_00:
746
cmp [PCI_Interface], 00h
747
je sc08_00_00
748
cmp [PCI_Interface], 01h
749
je sc08_00_01
750
cmp [PCI_Interface], 02h
751
je sc08_00_02
752
cmp [PCI_Interface], 10h
753
je sc08_00_10
754
cmp [PCI_Interface], 20h
755
je sc08_00_20
756
jmp endd
757
 
758
 
759
sc08_00_00:
760
mov  edx,system0     ; pointer to text beginning
761
jmp endd
762
 
763
sc08_00_01:
764
mov  edx,system1     ; pointer to text beginning
765
jmp endd
766
 
767
sc08_00_02:
768
mov  edx,system2     ; pointer to text beginning
769
jmp endd
770
 
771
sc08_00_10:
772
mov  edx,system3     ; pointer to text beginning
773
jmp endd
774
 
775
sc08_00_20:
776
mov  edx,system4    ; pointer to text beginning
777
jmp endd
778
 
779
;--
780
 
781
sc08_01:
782
cmp [PCI_Interface], 00h
783
je sc08_01_00
784
cmp [PCI_Interface], 01h
785
je sc08_01_01
786
cmp [PCI_Interface], 02h
787
je sc08_01_02
788
jmp endd
789
 
790
 
791
sc08_01_00:
792
mov  edx,system5     ; pointer to text beginning
793
jmp endd
794
 
795
sc08_01_01:
796
mov  edx,system6     ; pointer to text beginning
797
jmp endd
798
 
799
sc08_01_02:
800
mov  edx,system7     ; pointer to text beginning
801
jmp endd
802
 
803
 
804
;--
805
 
806
sc08_02:
807
cmp [PCI_Interface], 00h
808
je sc08_02_00
809
cmp [PCI_Interface], 01h
810
je sc08_02_01
811
cmp [PCI_Interface], 02h
812
je sc08_02_02
813
jmp endd
814
 
815
 
816
sc08_02_00:
817
mov  edx,system8     ; pointer to text beginning
818
jmp endd
819
 
820
sc08_02_01:
821
mov  edx,system9     ; pointer to text beginning
822
jmp endd
823
 
824
sc08_02_02:
825
mov  edx,system10     ; pointer to text beginning
826
jmp endd
827
 
828
;--
829
sc08_03:
830
cmp [PCI_Interface], 00h
831
je sc08_03_00
832
cmp [PCI_Interface], 01h
833
je sc08_03_01
834
jmp endd
835
 
836
 
837
sc08_03_00:
838
mov  edx,system11     ; pointer to text beginning
839
jmp endd
840
 
841
sc08_03_01:
842
mov  edx,system12     ; pointer to text beginning
843
jmp endd
844
 
845
;--
846
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
847
nextclass09:
848
 
849
 cmp [PCI_Class], 09h
850
 je check09
851
 jmp nextclass0A
852
 
853
check09:
854
 cmp [PCI_SubClass], 04h
855
 je sc09_04
856
 jmp endd
857
 
858
sc09_04:
859
cmp [PCI_Interface], 00h
860
je sc09_04_00
861
cmp [PCI_Interface], 10h
862
je sc09_04_10
863
jmp endd
864
 
865
 
866
sc09_04_00:
867
mov  edx,gameport1     ; pointer to text beginning
868
jmp endd
869
 
870
sc09_04_10:
871
mov  edx,gameport2     ; pointer to text beginning
872
jmp endd
873
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
874
 
875
nextclass0A:
876
 cmp [PCI_Class], 0Ah
877
 je endd
878
 
879
 cmp [PCI_Class], 0Bh
880
 je endd
881
;============================================
882
 cmp [PCI_Class], 0Ch
883
 je check0C
884
 jmp nextclass0D
885
 
886
check0C:
887
 cmp [PCI_SubClass], 00h
888
 je sc0C_00
889
 cmp [PCI_SubClass], 03h
890
 je sc0C_03
891
 cmp [PCI_SubClass], 07h
892
 je sc0C_07
893
 jmp endd
894
 ;;;;;;;;;;;
895
 
896
sc0C_00:
897
cmp [PCI_Interface], 00h
898
je sc0C_00_00
899
 
900
cmp [PCI_Interface], 10h
901
je sc0C_00_10
902
 
903
 
904
 
905
sc0C_00_00:
906
mov  edx,serialbus6     ; pointer to text beginning
907
jmp endd
908
 
909
sc0C_00_10:
910
mov  edx,serialbus7     ; pointer to text beginning
911
jmp endd
912
 ;;;;;;;;;;;;;;;;;;;
913
 
914
sc0C_03:
915
cmp [PCI_Interface], 00h
916
je sc0C_03_00
917
 
918
cmp [PCI_Interface], 10h
919
je sc0C_03_10
920
 
921
cmp [PCI_Interface], 20h
922
je sc0C_03_20
923
cmp [PCI_Interface], 80h
924
je sc0C_03_80
925
 
926
cmp [PCI_Interface], $FE
927
je sc0C_03_FE
928
 
929
;jmp endd
930
 
931
sc0C_03_00:
932
mov  edx,serialbus1     ; pointer to text beginning
933
jmp endd
934
 
935
sc0C_03_10:
936
mov  edx,serialbus2     ; pointer to text beginning
937
jmp endd
938
 
939
 
940
sc0C_03_20:
941
mov  edx,serialbus3     ; pointer to text beginning
942
jmp endd
943
 
944
sc0C_03_80:
945
mov  edx,serialbus4     ; pointer to text beginning
946
jmp endd
947
 
948
sc0C_03_FE:
949
mov  edx,serialbus5     ; pointer to text beginning
950
jmp endd
951
 
952
 ;;;;;;;;;;;
953
 
954
sc0C_07:
955
cmp [PCI_Interface], 00h
956
je sc0C_07_00
957
 
958
cmp [PCI_Interface], 01h
959
je sc0C_07_01
960
 
961
cmp [PCI_Interface], 02h
962
je sc0C_07_02
963
 
964
 
965
sc0C_07_00:
966
mov  edx,serialbus8     ; pointer to text beginning
967
jmp endd
968
 
969
sc0C_07_01:
970
mov  edx,serialbus9     ; pointer to text beginning
971
jmp endd
972
 
973
sc0C_07_02:
974
mov  edx,serialbus10     ; pointer to text beginning
975
jmp endd
976
 ;;;;;;;;;;;;;;;;;;;
977
;==============================================
978
nextclass0D:
979
 cmp [PCI_Class], 0Dh
980
 je endd
981
;;;;;;;;;;;;;;;;;;;;;;;;;;
982
cmp [PCI_Class], 0Eh
983
je check0E
984
jmp nextclass0F
985
 
986
check0E:
987
 cmp [PCI_SubClass], 00h
988
 je sc0E_00
989
 jmp endd
990
 
991
sc0E_00:
992
cmp [PCI_Interface], 00h
993
je sc0E_00_00
994
cmp [PCI_Interface], 00h   ;!!!
995
ja sc0E_00_xx
996
jmp endd
997
 
998
 
999
sc0E_00_00:
1000
mov  edx,i2o1     ; pointer to text beginning
1001
jmp endd
1002
 
1003
sc0E_00_xx:
1004
mov  edx,i2o2     ; pointer to text beginning
1005
jmp endd
1006
 
1007
 
1008
;////////////////////////////
1009
nextclass0F:
1010
 cmp [PCI_Class], 0Fh
1011
 je endd
1012
 
1013
 cmp [PCI_Class], 10h
1014
 je endd
1015
 
1016
 cmp [PCI_Class], 11h
1017
 je endd
1018
 
132 diamond 1019
 endd:
205 heavyiron 1020
   and   ebx, 0x0000FFFF    ;clear X position
1021
   or   ebx, 0x02300000    ;set X position to 560 pixels
1022
   xor   ecx, ecx      ;color of text
1023
   mov   eax,4        ;draw text system function
1024
   mov   esi,32       ;length of text to draw
1025
   int   0x40        ;draw the text
132 diamond 1026
 
205 heavyiron 1027
   movzx edx, bx      ;get y coordinate
1028
   add   edx, 0x0014000A    ;add 10 to y coordinate and set x coordinate to 20
132 diamond 1029
ret
1030
 
1031
ClassList:
1032
 dd Class0 ,  2, Class1 , 8, Class2,  8, Class3, 4
1033
 dd Class4 ,  4, Class5 , 3, Class6, 12, Class7, 7
1034
 dd Class8 ,  8, Class9 , 6, ClassA,  2, ClassB, 7
1035
 dd ClassC , 10, ClassD , 8, ClassE,  1, ClassF, 4
1036
 dd Class10,  3, Class11, 5
1037
;------------------------------------------------------------------
1038
 
1039
 
1040
 
1041
; DATA AREA
1042
 
1043
labelt:
205 heavyiron 1044
db 'PCI Device Enumeration v 2.0 by J. Delozier, S. Kuzmin, V. Hanla, M. Zakiyanov'
1045
labellen:
132 diamond 1046
 
205 heavyiron 1047
ata1:
1048
db 'Storage - ATA c. w/ single DMA  '
1049
ata1len:
1050
 
1051
ata2:
1052
db 'Storage - ATA c. w/ chained DMA '
1053
ata2len:
1054
 
1055
 
1056
display1:
1057
db 'Display - VGA-compatible c.     '
1058
display1len:
1059
 
1060
display2:
1061
db 'Display - 8514-compatible c.    '
1062
display2len:
1063
 
1064
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1065
serialbus1:
1066
db 'Serial Bus - USB Universal HC   '
1067
serialbus1len:
1068
 
1069
serialbus2:
1070
db 'Serial Bus - USB Open HC        '
1071
serialbus2len:
1072
 
1073
serialbus3:
1074
db 'Serial Bus - USB2 Enhanced HC   '
1075
serialbus3len:
1076
 
1077
serialbus4:
1078
db 'Serial Bus - USB w/o specific PI'
1079
serialbus4len:
1080
 
1081
serialbus5:
1082
db 'Serial Bus - USB device (not HC)'
1083
serialbus5len:
1084
 
1085
 
1086
serialbus6:
1087
db 'Serial Bus - IEEE 1394(FireWire)'
1088
serialbus6len:
1089
 
1090
serialbus7:
1091
db 'Serial Bus- IEEE 1394(Open HCI) '
1092
serialbus7len:
1093
 
1094
 
1095
serialbus8:
1096
db 'Serial Bus - IPMI SMIC I.       '
1097
serialbus8len:
1098
 
1099
serialbus9:
1100
db 'Serial Bus - IPMI Kybd CSI      '
1101
serialbus9len:
1102
 
1103
serialbus10:
1104
db 'Serial Bus - IPMI BTI           '
1105
serialbus10len:
1106
;;;;;;;;;;;;;;;;;;;;;;;
1107
bridge1:
1108
db 'Bridge - PCI/PCI                '
1109
bridge1len:
1110
 
1111
bridge2:
1112
db 'Bridge - Subtract.Decode PCI/PCI'
1113
bridge2len:
1114
 
1115
bridge3:
1116
db 'Bridge - Semi-transp. PCI/PCI 1 '
1117
bridge3len:
1118
 
1119
bridge4:
1120
db 'Bridge - Semi-transp. PCI/PCI 2 '
1121
bridge4len:
1122
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1123
gameport1:
1124
db 'Input - Gameport  c. (generic)  '
1125
gameport1len:
1126
 
1127
gameport2:
1128
db 'Input - Gameport c. (legacy)    '
1129
gameport2len:
1130
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1131
i2o1:
1132
db 'Intelligent I/O - I/O c. (I2O 1)'
1133
i2o1len:
1134
 
1135
i2o2:
1136
db 'Intelligent I/O - c.(FIFO @ 40h)'
1137
i2o2len:
1138
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1139
 
1140
communication0:
1141
db 'Communication - Serial (XT)     '
1142
communication0len:
1143
 
1144
communication1:
1145
db 'Communication - Serial c.(16450)'
1146
communication1len:
1147
 
1148
communication2:
1149
db 'Communication - Serial c.(16550)'
1150
communication2len:
1151
 
1152
communication3:
1153
db 'Communication - Serial c.(16650)'
1154
communication3len:
1155
 
1156
communication4:
1157
db 'Communication - Serial c.(16750)'
1158
communication4len:
1159
 
1160
communication5:
1161
db 'Communication - Serial c.(16850)'
1162
communication5len:
1163
 
1164
communication6:
1165
db 'Communication - Serial c.(16950)'
1166
communication6len:
1167
;-------------------------------
1168
communication7:
1169
db 'Communication - Parallel port   '
1170
communication7len:
1171
 
1172
communication8:
1173
db 'Communication - Bi-dir. par.port'
1174
communication8len:
1175
 
1176
communication9:
1177
db 'Communication - ECP 1.X par.port'
1178
communication9len:
1179
 
1180
communication10:
1181
db 'Communication - IEEE1284 c.     '
1182
communication10len:
1183
 
1184
communication11:
1185
db 'Communication - IEEE1284 device '
1186
communication11len:
1187
;-------------------------------
1188
communication12:
1189
db 'Communication - Generic modem   '
1190
communication12len:
1191
 
1192
communication13:
1193
db 'Communication -Hayes modem 16450'
1194
communication13len:
1195
 
1196
communication14:
1197
db 'Communication -Hayes modem 16550'
1198
communication14len:
1199
 
1200
communication15:
1201
db 'Communication -Hayes modem 16650'
1202
communication15len:
1203
 
1204
communication16:
1205
db 'Communication -Hayes modem 16750'
1206
communication16len:
1207
 
1208
 
1209
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1210
 
1211
system0:
1212
db 'System - Generic 8259 PIC       '
1213
system0len:
1214
 
1215
system1:
1216
db 'System - ISA PIC                '
1217
system1len:
1218
 
1219
system2:
1220
db 'System - EISA PIC               '
1221
system2len:
1222
 
1223
system3:
1224
db 'System - I/O APIC interrupt c.  '
1225
system3len:
1226
 
1227
system4:
1228
db 'System - I/O(x) APIC interrupt c'
1229
system4len:
1230
;-
1231
system5:
1232
db 'System - Generic 8237 DMA c.    '
1233
system5len:
1234
 
1235
system6:
1236
db 'System - ISA DMA c.             '
1237
system6len:
1238
 
1239
system7:
1240
db 'System - EISA DMA c.            '
1241
system7len:
1242
;--
1243
system8:
1244
db 'System - 8254 system timer      '
1245
system8len:
1246
 
1247
system9:
1248
db 'System - ISA system timer       '
1249
system9len:
1250
 
1251
system10:
1252
db 'System - EISA (2 system timers) '
1253
system10len:
1254
;--
1255
system11:
1256
db 'System - Generic RTC c.         '
1257
system11len:
1258
 
1259
system12:
1260
db 'System - ISA RTC c.             '
1261
system12len:
1262
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
132 diamond 1263
PCIWin:
1264
db 'Please remember to enable PCI Access to Applications in Setup Menu.'
1265
db '                                       '
1266
db '                                                                   '
1267
db '                                       '
1268
db 'PCI Version  =                                                     '
1269
db '                                       '
1270
db 'Last PCI Bus =                                                     '
1271
db '                                       '
205 heavyiron 1272
db 'Quantity of devices =                                              '
132 diamond 1273
db '                                       '
1274
db '                                                                   '
1275
db '                                       '
205 heavyiron 1276
db 'VenID DevID Bus# Dev# Fnc Rev  Class  Subclass/                Comp'
132 diamond 1277
db 'any                      Description   '
205 heavyiron 1278
db '                                      Interface                    '
1279
db '                                       '
132 diamond 1280
db '----- ----- ---- ---- --- ---  -----  -------- --------------------'
1281
db '---------------------- ----------------'
1282
db 'x'
1283
 
205 heavyiron 1284
;
135 diamond 1285
 
205 heavyiron 1286
total       db 0
1287
V_Bus       db 0
1288
V_Dev       db 0
132 diamond 1289
PCI_Version  dw 0
1290
PCI_LastBus  db 0
1291
PCI_Device   dw 0
1292
PCI_Vendor   dw 0
1293
PCI_Bus      db 0
1294
PCI_Dev      db 0
1295
PCI_Rev      db 0
1296
PCI_Class    db 0
1297
PCI_SubClass db 0
205 heavyiron 1298
PCI_Interface db 0
132 diamond 1299
 
1300
Proc_Info:
1301
 times 1024 db 0
1302
 
1303
I_END: