Rev 1982 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1356 | diamond | 1 | ;*************************************************************** |
132 | diamond | 2 | ; project name: PCI Device Enumeration |
475 | Ghost | 3 | ; target platform: KolibriOS |
1351 | art_zh | 4 | ; compiler: flat assembler 1.68 |
1982 | mario79 | 5 | ; version: 2.3 |
6 | ; last update: June 2011 |
||
1983 | yogev_ezra | 7 | ; maintained by: Jason Delozier |
8 | ; Sergey Kuzmin |
||
9 | ; Mihailov Ilia |
||
1982 | mario79 | 10 | ; Marat Zakiyanov |
1983 | yogev_ezra | 11 | ; Artem Jerdev |
12 | ; Evgeny Grechnikov (diamond) |
||
13 | ; Veronica (CleverMouse) |
||
1982 | mario79 | 14 | ; old project site: http://www.coolthemes.narod.ru/pcidev.html |
15 | ; new project site: http://board.kolibrios.org/viewtopic.php?f=42&t=73 |
||
132 | diamond | 16 | ;*************************************************************** |
17 | ;Summary: This program will attempt to scan the PCI Bus |
||
18 | ; and display basic information about each device |
||
19 | ; connected to the PCI Bus. |
||
20 | ;*************************************************************** |
||
1982 | mario79 | 21 | ;----------------------------------------------------------------------------- |
1364 | diamond | 22 | include '../../../macros.inc' |
1351 | art_zh | 23 | |
1982 | mario79 | 24 | include '../../../develop/libraries/box_lib/load_lib.mac' |
25 | ;----------------------------------------------------------------------------- |
||
26 | use32 |
||
27 | org 0x0 |
||
28 | db 'MENUET01' ; 8 byte id |
||
29 | dd 0x01 ; header version |
||
30 | dd START ; start of code |
||
31 | dd IM_END ; size of image |
||
32 | dd I_END ; memory for app |
||
33 | dd stacktop ; esp |
||
34 | dd 0 ; I_Param |
||
1983 | yogev_ezra | 35 | dd path ; APPLICATION PATH |
1982 | mario79 | 36 | ;----------------------------------------------------------------------------- |
37 | @use_library ; load_lib macro |
||
38 | ;----------------------------------------------------------------------------- |
||
39 | START: |
||
40 | mcall 68,11 |
||
41 | mcall 66,1,1 |
||
42 | ;----------------------------------------------------------------------------- |
||
43 | load_libraries l_libs_start,end_l_libs |
||
44 | ;----------------------------------------------------------------------------- |
||
45 | ;OpenDialog initialisation |
||
46 | push dword OpenDialog_data |
||
47 | call [OpenDialog_Init] |
||
48 | |||
49 | mov edi,filename_area |
||
50 | mov esi,start_temp_file_name |
||
51 | call copy_file_name_path |
||
52 | ;----------------------------------------------------------------------------- |
||
53 | mcall 68,12,4096 |
||
54 | mov [store_text_area_start],eax |
||
55 | ;----------------------------------------------------------------------------- |
||
475 | Ghost | 56 | call draw_window |
1982 | mario79 | 57 | still: |
58 | mcall 10 ; wait here for event |
||
475 | Ghost | 59 | dec eax ; redraw request ? |
60 | jz red |
||
61 | dec eax ; key in buffer ? |
||
62 | jz key |
||
63 | dec eax ; button in buffer ? |
||
64 | jz button |
||
65 | jmp still |
||
1982 | mario79 | 66 | ;----------------------------------------------------------------------------- |
475 | Ghost | 67 | red: ; redraw |
68 | mcall 9, Proc_Info, -1 ; window redraw requested so get new window coordinates and size |
||
485 | heavyiron | 69 | mov eax, [Proc_Info.box.left]; store the window coordinates into the Form Structure |
475 | Ghost | 70 | mov [Form + 2], ax ; x start position |
485 | heavyiron | 71 | mov eax, [Proc_Info.box.top]; |
475 | Ghost | 72 | mov [Form + 6], ax ; ystart position |
485 | heavyiron | 73 | mov eax, [Proc_Info.box.width] ; |
475 | Ghost | 74 | mov [Form], ax ; window width |
485 | heavyiron | 75 | mov eax, [Proc_Info.box.height] ; |
475 | Ghost | 76 | mov [Form + 4] ,ax ; window height |
77 | call draw_window ; go redraw window now |
||
78 | jmp still |
||
1982 | mario79 | 79 | ;----------------------------------------------------------------------------- |
475 | Ghost | 80 | key: ; key |
81 | mcall 2 ; just read it and ignore |
||
1982 | mario79 | 82 | cmp [extended_key],1 |
83 | je .extended_key |
||
84 | test al, al |
||
85 | jnz still |
||
86 | cmp ah, 0xE0 |
||
87 | jne @f |
||
88 | mov [extended_key],1 |
||
475 | Ghost | 89 | jmp still |
1982 | mario79 | 90 | @@: |
91 | cmp ah,129 ; Esc |
||
92 | je button.exit |
||
93 | cmp ah,159 |
||
94 | je call_OpenDialog |
||
95 | jmp still |
||
96 | .extended_key: |
||
97 | mov [extended_key],0 |
||
98 | cmp ah,129 ; Esc |
||
99 | je button.exit |
||
100 | cmp ah,159 |
||
101 | je call_OpenDialog |
||
102 | jmp still |
||
103 | ;----------------------------------------------------------------------------- |
||
1351 | art_zh | 104 | button: ; button |
475 | Ghost | 105 | mcall 17 ; get id |
1982 | mario79 | 106 | cmp ah,2 |
107 | je call_OpenDialog |
||
475 | Ghost | 108 | cmp ah, 1 ; button id = 1 ? |
109 | jne still |
||
1982 | mario79 | 110 | .exit: |
475 | Ghost | 111 | mcall -1 ; close this program |
1982 | mario79 | 112 | ;----------------------------------------------------------------------------- |
113 | call_OpenDialog: |
||
114 | mov [OpenDialog_data.type],1 ; Save |
||
115 | |||
116 | push dword OpenDialog_data |
||
117 | call [OpenDialog_Start] |
||
132 | diamond | 118 | |
1982 | mario79 | 119 | cmp [OpenDialog_data.status],2 ; OpenDialog does not start |
120 | je .save_file_default_path |
||
121 | |||
122 | cmp [OpenDialog_data.status],1 |
||
123 | jne still |
||
124 | |||
125 | call store_data |
||
126 | jmp still |
||
127 | ;---------------------------------------- |
||
128 | .save_file_default_path: |
||
129 | mov edi,file_name |
||
130 | mov esi,file_default_path |
||
131 | call copy_file_name_path |
||
132 | call store_data |
||
133 | jmp still |
||
134 | ;---------------------------------------- |
||
135 | copy_file_name_path: |
||
136 | xor eax,eax |
||
137 | cld |
||
138 | @@: |
||
139 | lodsb |
||
140 | stosb |
||
141 | test eax,eax |
||
142 | jnz @r |
||
143 | ret |
||
144 | ;----------------------------------------------------------------------------- |
||
145 | prepare_text_area: |
||
146 | mov edi,[store_text_area_start] |
||
147 | |||
148 | push edi |
||
149 | mov ecx,4096/4 ; I hope this will be enough for store of data |
||
150 | mov eax,dword ' ' |
||
151 | cld |
||
152 | rep stosd |
||
153 | pop edi |
||
154 | |||
155 | mov esi,PCIWin |
||
156 | xor ecx,ecx |
||
157 | @@: |
||
158 | mov cl,[esi] |
||
159 | inc esi |
||
160 | rep movsb |
||
161 | mov al,0Ah ; CR - carriage return |
||
162 | stosb |
||
163 | cmp [esi],byte 0xFF |
||
164 | jne @r |
||
165 | |||
166 | mov [store_text_area_end],edi |
||
167 | |||
168 | xor edi,edi |
||
169 | ret |
||
170 | ;----------------------------------------------------------------------------- |
||
132 | diamond | 171 | draw_window: |
1982 | mario79 | 172 | call prepare_text_area |
173 | |||
475 | Ghost | 174 | mov byte [total], 0 |
175 | mcall 12, 1 ; start of draw |
||
176 | ; DRAW WINDOW |
||
1982 | mario79 | 177 | mcall 0,dword [Form],dword [Form + 4],0x13ffffff,0x805080d0,title |
178 | mcall 8,<450,100>,<25,25>,2,0xC0C0C0 |
||
179 | shr ecx,16 |
||
180 | mov bx,cx |
||
181 | add ebx,13 shl 16+4 |
||
182 | mcall 4,,0x80000000,text_save_button |
||
183 | add bx,11 |
||
184 | mcall ,,,text_save_button.1 |
||
475 | Ghost | 185 | ; Insert horizontal bars in list area |
1351 | art_zh | 186 | mov eax, 13 ; draw bar system function |
187 | mov ebx, 18 ; set Xstart position of bar |
||
188 | shl ebx, 16 ; |
||
189 | mov bx, word [Form] ; get width of window |
||
475 | Ghost | 190 | sub bx, 32 ; bar is 32 pixels shorter then window width |
191 | mov ecx, 119 * 65536 + 10 ; set Ystart(109) and Height(10) of bar 109 |
||
192 | mov edx, 0xC0C0C0 ; set color of bar |
||
193 | again: ;begin draw bar loop |
||
194 | mcall ; draw bar to window area |
||
1351 | art_zh | 195 | shr ecx, 16 ; move the Ystart position to working area |
196 | add ecx, 34 ; add 34 pixels to Y Start (moves bar down) |
||
475 | Ghost | 197 | cmp cx, word [Form + 4] ; is the Ystart position outside of window area |
198 | jae nomo ; if so stop drawing bars |
||
1351 | art_zh | 199 | sub ecx, 14 ; if not, we only need 20 pixels between bar tops |
200 | shl ecx, 16 ; set that values as Ystart |
||
201 | add ecx, 10 ; Bar Height is always 10 pixels |
||
475 | Ghost | 202 | jmp again ; draw another bar |
1982 | mario79 | 203 | ;----------------------------------------------------------------------------- |
475 | Ghost | 204 | nomo: ;done drawing bars here |
205 | ; start PCI stuff |
||
206 | call Get_PCI_Info ; get pci version and last bus, scan for and draw each pci device |
||
132 | diamond | 207 | |
475 | Ghost | 208 | ; Window inteface |
209 | mov cx, [PCI_Version] |
||
210 | add ch, '0' |
||
1351 | art_zh | 211 | mov [PCIWin + 85], ch ; 0xBADCODE but it works ! |
475 | Ghost | 212 | mov ch, cl |
213 | shr cl, 4 |
||
214 | and ch, 0x0f |
||
215 | add cx, '00' |
||
216 | mov [PCIWin + 87], cx |
||
1351 | art_zh | 217 | mov cl, [PCI_LastBus] ; will only work if [PCI_LastBus] < 10 |
475 | Ghost | 218 | add cl, '0' |
1351 | art_zh | 219 | mov [PCIWin + 106], cl |
220 | |||
475 | Ghost | 221 | mov edx, PCIWin |
222 | mov ebx, 20 * 65536 + 25 ; x start, ystart of text |
||
223 | mov ecx, 0x224466 ; color of text |
||
224 | mov eax, 4 |
||
1982 | mario79 | 225 | @@: |
226 | movzx esi, byte[edx] |
||
475 | Ghost | 227 | inc edx |
228 | mcall |
||
229 | add ebx, 10 |
||
230 | add edx, esi |
||
231 | cmp byte[edx], -1 |
||
232 | jne @b |
||
233 | ; Quantity of devices... |
||
234 | movzx ecx, byte [total] ; number to draw |
||
235 | mcall 47, 0x00020000,,150 * 65536 + 65, 0x224466 |
||
1386 | art_zh | 236 | |
237 | mov ah, [MMIO_allowed] |
||
238 | or ah, ah |
||
239 | jz @f |
||
240 | mov ah, [MMIO_Bus] ; =255 if MMIO disabled / not found |
||
241 | and ah, 0x7f |
||
242 | inc ah |
||
243 | jo @f |
||
1351 | art_zh | 244 | call Try_MMIO |
1386 | art_zh | 245 | @@: |
475 | Ghost | 246 | mcall 12, 2 ; end of draw |
247 | ret |
||
1982 | mario79 | 248 | ;----------------------------------------------------------------------------- |
249 | store_data: |
||
250 | mov eax,[store_text_area_start] |
||
251 | mov [fileinfo.return],eax |
||
252 | mov ebx,[store_text_area_end] |
||
253 | sub ebx,eax |
||
254 | inc ebx |
||
255 | mov [fileinfo.size],ebx |
||
256 | mcall 70,fileinfo |
||
257 | ret |
||
258 | ;----------------------------------------------------------------------------- |
||
205 | heavyiron | 259 | ;* Gets the PCI Version and Last Bus |
132 | diamond | 260 | Get_PCI_Info: |
475 | Ghost | 261 | mcall 62, 0 |
262 | mov word [PCI_Version], ax |
||
263 | mcall 62, 1 |
||
264 | mov byte [PCI_LastBus], al |
||
265 | ;---------------------------------------------------------- |
||
266 | ;* Get all devices on PCI Bus |
||
267 | cmp al, 0xff ; 0xFF means no pci bus found |
||
268 | jne Pci_Exists ; |
||
269 | ret ; if no bus then leave |
||
1982 | mario79 | 270 | ;----------------------------------------------------------------------------- |
132 | diamond | 271 | Pci_Exists: |
1351 | art_zh | 272 | mov byte [V_Bus], 0 ; reset varibles |
273 | mov byte [V_Dev], 0 ; |
||
475 | Ghost | 274 | mov edx, 20 * 65536 + 110 ; set start write position |
132 | diamond | 275 | Start_Enum: |
475 | Ghost | 276 | mov bl, 6 ; get a dword |
277 | mov bh, byte [V_Bus] ; bus of pci device |
||
278 | mov ch, byte [V_Dev] ; device number/function |
||
279 | mov cl, 0 ; offset to device/vendor id |
||
280 | mcall 62 ; get ID's |
||
132 | diamond | 281 | |
475 | Ghost | 282 | cmp ax, 0 ; Vendor ID should not be 0 or 0xFFFF |
1351 | art_zh | 283 | je nextDev ; check next device if nothing exists here |
1982 | mario79 | 284 | |
475 | Ghost | 285 | cmp ax, 0xffff ; |
1351 | art_zh | 286 | je nextDev ; |
132 | diamond | 287 | |
475 | Ghost | 288 | mov word [PCI_Vendor], ax ; There is a device here, save the ID's |
1351 | art_zh | 289 | shr eax, 16 ; |
475 | Ghost | 290 | mov word [PCI_Device], ax ; |
291 | mov bl, 4 ; Read config byte |
||
292 | mov bh, byte [V_Bus] ; Bus # |
||
293 | mov ch, byte [V_Dev] ; Device # on bus |
||
294 | mov cl, 0x08 ; Register to read (Get Revision) |
||
295 | mcall 62 ; Read it |
||
1982 | mario79 | 296 | |
475 | Ghost | 297 | mov byte [PCI_Rev], al ; Save it |
298 | mov cl, 0x0b ; Register to read (Get class) |
||
299 | mcall 62 ; Read it |
||
1351 | art_zh | 300 | |
475 | Ghost | 301 | mov byte [PCI_Class], al ; Save it |
302 | mov cl, 0x0a ; Register to read (Get Subclass) |
||
303 | mcall 62 ; Read it |
||
304 | mov byte [PCI_SubClass], al; Save it |
||
1351 | art_zh | 305 | ; by Mario79 august 2006 |
475 | Ghost | 306 | mov cl, 0x09 ; Register to read (Get Interface) |
307 | mcall 62 ; Read it |
||
1982 | mario79 | 308 | |
475 | Ghost | 309 | mov [PCI_Interface], al ; Save it |
205 | heavyiron | 310 | ; |
1351 | art_zh | 311 | ; by Ghost april 2007 |
475 | Ghost | 312 | mov cl, 0x3c ; Register to read (Get IRQ) |
1982 | mario79 | 313 | @@: |
314 | mcall 62 ; Read it |
||
315 | |||
475 | Ghost | 316 | mov [PCI_IRQ], al ; Save it |
1946 | clevermous | 317 | ; by CleverMouse juny 2011 |
318 | mov cl, 0x0e |
||
319 | mcall 62 |
||
1982 | mario79 | 320 | |
1946 | clevermous | 321 | push eax |
475 | Ghost | 322 | inc byte [total] ; one more device found |
323 | call Print_New_Device ; print device info to screen |
||
1946 | clevermous | 324 | ; don't scan for nonzero functions if zero function says "not multifunction device" |
325 | pop eax |
||
326 | test al, al |
||
327 | js nextDev |
||
1982 | mario79 | 328 | |
1946 | clevermous | 329 | test byte [V_Dev], 7 |
1947 | clevermous | 330 | jnz nextDev |
1982 | mario79 | 331 | |
1946 | clevermous | 332 | or byte [V_Dev], 7 |
132 | diamond | 333 | nextDev: |
475 | Ghost | 334 | inc byte [V_Dev] ; next device on this bus |
335 | jnz Start_Enum ; jump until we reach zero |
||
336 | ;(used to be JNO which caused bug!!! 30-4-2006, JMD) |
||
1351 | art_zh | 337 | mov byte [V_Dev], 0 ; reset device number |
475 | Ghost | 338 | inc byte [V_Bus] ; next bus |
339 | mov al, byte [PCI_LastBus] ; get last bus |
||
340 | cmp byte [V_Bus], al ; was it last bus |
||
341 | jbe Start_Enum ; if not jump to keep searching |
||
342 | ret |
||
1982 | mario79 | 343 | ;----------------------------------------------------------------------------- |
1386 | art_zh | 344 | no_ummio_allowed: |
345 | xor al,al |
||
346 | mov [MMIO_allowed],al ; re-enter the subroutine |
||
475 | Ghost | 347 | ;------------------------------------------------------------------ |
132 | diamond | 348 | ;* Print device info to screen |
1386 | art_zh | 349 | |
132 | diamond | 350 | Print_New_Device: |
1386 | art_zh | 351 | xor esi, esi ; default text color |
352 | mov cl, [MMIO_allowed] |
||
353 | or cl,cl |
||
354 | jz no_ummio_here |
||
355 | mov ch, byte [V_Bus] |
||
356 | mov cl, byte [V_Dev] |
||
1351 | art_zh | 357 | mcall 62, 11 ; detect uMMIO |
1982 | mario79 | 358 | |
1386 | art_zh | 359 | and ax,0x7fff |
360 | inc ax ; -1 returned? |
||
361 | jo no_ummio_allowed |
||
1982 | mario79 | 362 | |
1386 | art_zh | 363 | inc ax ; -2 returned? |
364 | jo no_ummio_here |
||
1982 | mario79 | 365 | |
1386 | art_zh | 366 | inc ax ; -3 returned? |
367 | jo no_ummio_here |
||
1982 | mario79 | 368 | |
1386 | art_zh | 369 | mov esi, 0x990033 ; highlighted text color |
370 | mov bh, byte [V_Bus] |
||
371 | mov bl, byte [V_Dev] |
||
372 | mov byte [MMIO_Bus], bh |
||
373 | mov byte [MMIO_Dev], bl |
||
374 | add bh,'0' |
||
375 | mov [PCIWin + 129], bh ; uMMIO bus |
||
376 | mov al, bl |
||
377 | shr al, 1 |
||
378 | shr al, 1 |
||
379 | shr al, 1 |
||
380 | add al,'0' |
||
381 | mov [PCIWin + 131], al ; uMMIO device |
||
382 | and bl, 7 |
||
383 | add bl, '0' |
||
384 | mov [PCIWin + 133], bl ; uMMIO function |
||
1351 | art_zh | 385 | |
386 | no_ummio_here: |
||
475 | Ghost | 387 | movzx ecx,word [PCI_Vendor] ; Pointer to number to be written |
388 | mcall 47, 0x00040100 ; Write Vendor ID |
||
1982 | mario79 | 389 | |
390 | call store_4_digits |
||
391 | |||
475 | Ghost | 392 | and edx, 0xFFFF ;***************************************** |
1351 | art_zh | 393 | or edx, 54 * 65536 ; X start becomes 54 |
475 | Ghost | 394 | movzx ecx, word [PCI_Device] ; get Vendor ID |
395 | mcall ; Draw Vendor ID to Window |
||
1982 | mario79 | 396 | |
397 | call store_4_digits |
||
398 | |||
475 | Ghost | 399 | and edx, 0xFFFF ;***************************************** |
1351 | art_zh | 400 | or edx, 98 * 65536 ; X start becomes 98 |
475 | Ghost | 401 | movzx ecx, byte [V_Bus] ; get bus number |
402 | mcall ,0x00020100 ; draw bus number to screen |
||
1982 | mario79 | 403 | |
404 | call store_2_digits |
||
405 | |||
475 | Ghost | 406 | and edx, 0xFFFF ;***************************************** |
407 | or edx, 128 * 65536 ; X start becomes 128 |
||
408 | movzx ecx, byte [V_Dev] ; get device number |
||
409 | shr ecx, 3 ; device number is bits 3-7 |
||
410 | mcall ; Draw device Number To Window |
||
1351 | art_zh | 411 | |
1982 | mario79 | 412 | call store_2_digits |
413 | |||
475 | Ghost | 414 | and edx, 0xFFFF ;***************************************** |
415 | or edx, 155 * 65536 ; X start becomes 155 |
||
416 | movzx ecx, byte [V_Dev] ; get Function number |
||
417 | and ecx, 7 ; function is first 3 bits |
||
418 | mcall ; Draw Function Number To Window |
||
1982 | mario79 | 419 | |
420 | call store_2_digits |
||
421 | |||
475 | Ghost | 422 | and edx, 0xFFFF ;***************************************** |
423 | or edx, 179 * 65536 ; X start becomes 179 |
||
424 | movzx ecx, byte [PCI_Rev] ; get revision number |
||
425 | mcall ; Draw Revision to screen |
||
1982 | mario79 | 426 | |
427 | call store_2_digits |
||
428 | |||
475 | Ghost | 429 | and edx, 0xFFFF ;***************************************** |
430 | or edx, 215*65536 ; X start becomes 215 |
||
431 | movzx ecx, byte [PCI_Class] ; get PCI_Class |
||
432 | mcall ; Draw Class to screen |
||
1982 | mario79 | 433 | |
434 | call store_2_digits |
||
435 | |||
475 | Ghost | 436 | and edx, 0xFFFF ;***************************************** |
437 | or edx, 250*65536 ; X start becomes 250 |
||
438 | movzx ecx, byte [PCI_SubClass]; get sub class |
||
439 | mcall ; Draw Sub Class to screen |
||
1982 | mario79 | 440 | |
441 | call store_2_digits |
||
442 | |||
205 | heavyiron | 443 | ; from Mario79 august 2006 |
475 | Ghost | 444 | and edx, 0xFFFF ;***************************************** |
445 | or edx, 280 * 65536 ; X start becomes 280 |
||
446 | movzx ecx, [PCI_Interface] ; get Interface |
||
447 | mcall |
||
1982 | mario79 | 448 | |
449 | call store_2_digits |
||
450 | |||
205 | heavyiron | 451 | ; |
1351 | art_zh | 452 | ; from Ghost april 2007 ;***************************************** |
475 | Ghost | 453 | movzx ecx, [PCI_IRQ] ; get Interface |
454 | cmp cl, 0x0f ; IRQ between 0..15 |
||
455 | ja @f |
||
1982 | mario79 | 456 | |
475 | Ghost | 457 | and edx, 0xFFFF |
458 | or edx, 310 * 65536 ; X start becomes 310 |
||
459 | mcall |
||
1982 | mario79 | 460 | |
461 | call store_2_digits |
||
462 | |||
475 | Ghost | 463 | @@: |
464 | ;Write Names |
||
1351 | art_zh | 465 | movzx ebx, dx ; Set y position |
475 | Ghost | 466 | or ebx, 340 * 65536 ; set Xposition to 340 |
132 | diamond | 467 | |
475 | Ghost | 468 | ;------------------------------------------------------------------ |
469 | ; Prints the Vendor's Name based on Vendor ID |
||
132 | diamond | 470 | ; |
475 | Ghost | 471 | ; Modified on ??-04-2007 by Ghost for size |
472 | ;------------------------------------------------------------------ |
||
473 | mov edx, VendorsTab |
||
474 | mov cx, word[PCI_Vendor] |
||
1351 | art_zh | 475 | |
1982 | mario79 | 476 | .fn: |
477 | mov ax, [edx] |
||
475 | Ghost | 478 | add edx, 6 |
479 | test ax, ax |
||
480 | jz .find |
||
1982 | mario79 | 481 | |
475 | Ghost | 482 | cmp ax, cx |
483 | jne .fn |
||
1982 | mario79 | 484 | |
485 | .find: |
||
486 | mov edx, [edx - 4] |
||
475 | Ghost | 487 | mcall 4,, 0x80000000 ; lets print the vendor Name |
1982 | mario79 | 488 | |
489 | mov [store_text_size],42 |
||
490 | call store_text |
||
132 | diamond | 491 | ;------------------------------------------------------------------ |
475 | Ghost | 492 | ; Get description based on Class/Subclass |
493 | ; |
||
494 | ; Modified on ??-04-2007 by Ghost for size |
||
495 | ;------------------------------------------------------------------ |
||
496 | mov eax, dword [PCI_Class] |
||
497 | and eax, 0xffffff |
||
498 | xor edx, edx |
||
499 | xor esi, esi |
||
1982 | mario79 | 500 | .fnc: |
501 | inc esi |
||
475 | Ghost | 502 | mov ecx, [Classes + esi * 8 - 8] |
503 | cmp cx, 0xffff |
||
504 | je .endfc |
||
1982 | mario79 | 505 | |
475 | Ghost | 506 | cmp cx, ax |
507 | jne .fnc |
||
1982 | mario79 | 508 | |
475 | Ghost | 509 | test ecx, 0xff000000 |
510 | jz @f |
||
1982 | mario79 | 511 | |
475 | Ghost | 512 | mov edx, [Classes + esi * 8 - 4] |
513 | jmp .fnc |
||
1982 | mario79 | 514 | @@: |
515 | cmp eax, ecx |
||
475 | Ghost | 516 | jne .fnc |
1982 | mario79 | 517 | |
475 | Ghost | 518 | xor edx, edx |
1982 | mario79 | 519 | .endfc: |
520 | test edx, edx |
||
475 | Ghost | 521 | jnz @f |
1982 | mario79 | 522 | |
475 | Ghost | 523 | mov edx, [Classes + esi * 8 - 4] |
1351 | art_zh | 524 | @@: |
525 | and ebx, 0x0000FFFF ; clear X position |
||
475 | Ghost | 526 | or ebx, 0x24E0000 ; set X position to 590 pixels |
527 | mcall 4,, 0x80000000,, 32 ; draw the text |
||
1982 | mario79 | 528 | |
529 | mov [store_text_size],0 |
||
530 | call store_text |
||
531 | call store_CR |
||
532 | |||
1351 | art_zh | 533 | movzx edx, bx ; get y coordinate |
534 | add edx, 0x0014000A ; add 10 to y coordinate and set x coordinate to 20 |
||
535 | mov [gr_pos], edx |
||
475 | Ghost | 536 | ret |
1351 | art_zh | 537 | ;------------------------------------------------------------------ |
538 | ; Get the user-MMIO related info |
||
539 | ; |
||
540 | ; Added on ??-12-2009 by art_zh |
||
541 | ;------------------------------------------------------------------ |
||
542 | Try_MMIO: |
||
543 | xor ebx, ebx |
||
544 | mov edx, ebx |
||
1358 | art_zh | 545 | mov bh, [MMIO_BAR] |
1351 | art_zh | 546 | or bx, 12 ; function 12 |
547 | mov ecx, 4096 ; =1 page to map |
||
548 | mcall 62 |
||
1982 | mario79 | 549 | |
1358 | art_zh | 550 | mov [MMIO_Map], eax ; store MMIO lin.addr. |
1351 | art_zh | 551 | mov ecx, 0x80990022 ; print color : red |
552 | add bh, '0' |
||
553 | cmp eax, -3 |
||
554 | jne @f |
||
1982 | mario79 | 555 | |
1351 | art_zh | 556 | mov [bar_um+3], bh |
557 | mov ebx, [gr_pos] |
||
558 | mov edx, bar_um |
||
559 | mcall 4 |
||
1982 | mario79 | 560 | |
1351 | art_zh | 561 | jmp mmio_next_bar |
562 | @@: |
||
563 | cmp eax, -4 |
||
564 | jne @f |
||
565 | mov [bar_io+3], bh |
||
566 | mov ebx, [gr_pos] |
||
567 | mov edx, bar_io |
||
568 | mcall 4 |
||
1982 | mario79 | 569 | |
1351 | art_zh | 570 | jmp mmio_next_bar |
571 | @@: |
||
1358 | art_zh | 572 | cmp bh, '6' ; expansion ROM ? |
573 | je @f |
||
1351 | art_zh | 574 | mov [bar_ram+3], bh |
575 | mov ebx, [gr_pos] |
||
576 | mov edx, bar_ram |
||
577 | mcall 4 |
||
1982 | mario79 | 578 | |
1358 | art_zh | 579 | jmp mmio_dump |
1982 | mario79 | 580 | ;----------------------------------------------------------------------------- |
1353 | art_zh | 581 | @@: |
582 | mov ebx, [gr_pos] |
||
583 | mov edx, bar_rom |
||
584 | mcall 4 |
||
205 | heavyiron | 585 | |
1353 | art_zh | 586 | mmio_dump: |
1358 | art_zh | 587 | mov edx, [MMIO_Map] |
1351 | art_zh | 588 | mov esi, 64 |
589 | mov ecx, 0x099 ; dump color : blue |
||
590 | add ebx, 10 |
||
591 | mov [gr_pos], ebx |
||
592 | mcall 4 |
||
1982 | mario79 | 593 | |
1358 | art_zh | 594 | mov ecx, [MMIO_Map] ; release the tried page |
1351 | art_zh | 595 | mcall 62,13 |
596 | |||
597 | mmio_next_bar: |
||
598 | mov bh, [MMIO_BAR] |
||
599 | inc bh |
||
1353 | art_zh | 600 | cmp bh,7 |
1351 | art_zh | 601 | je @f |
1982 | mario79 | 602 | |
1351 | art_zh | 603 | mov [MMIO_BAR], bh |
604 | add [gr_pos], 10 |
||
605 | jmp Try_MMIO |
||
1982 | mario79 | 606 | ;----------------------------------------------------------------------------- |
1351 | art_zh | 607 | @@: |
608 | xor bh,bh |
||
609 | mov [MMIO_BAR], bh |
||
610 | ret |
||
1982 | mario79 | 611 | ;----------------------------------------------------------------------------- |
612 | store_CR: |
||
613 | pusha |
||
614 | mov edi,[store_text_area_end] |
||
615 | mov [edi],word 0A20h ; CR (carriage return) + SPACE |
||
616 | add dword [store_text_area_end],2 |
||
617 | popa |
||
618 | ret |
||
619 | ;----------------------------------------------------------------------------- |
||
620 | store_text: |
||
621 | pusha |
||
622 | inc dword [store_text_area_end] |
||
623 | mov esi,edx |
||
624 | mov edi,[store_text_area_end] |
||
625 | push edi |
||
626 | xor eax,eax |
||
627 | cld |
||
628 | @@: |
||
629 | lodsb |
||
630 | test eax,eax |
||
631 | jz @f |
||
632 | stosb |
||
633 | inc dword [store_text_area_end] |
||
634 | jmp @r |
||
635 | @@: |
||
636 | pop esi |
||
637 | mov eax,[store_text_size] |
||
638 | test eax,eax |
||
639 | jz @f |
||
640 | sub edi,esi |
||
641 | sub eax,edi |
||
642 | add [store_text_area_end],eax |
||
643 | @@: |
||
644 | popa |
||
645 | ret |
||
646 | ;----------------------------------------------------------------------------- |
||
647 | store_4_digits: |
||
648 | pusha |
||
649 | mov ebx,ecx |
||
650 | mov ecx,4 |
||
651 | mov edi,[store_text_area_end] |
||
652 | call binary_to_hex_string |
||
653 | add [store_text_area_end],dword 6 |
||
654 | popa |
||
655 | ret |
||
656 | ;----------------------------------------------------------------------------- |
||
657 | store_2_digits: |
||
658 | pusha |
||
659 | inc [store_text_area_end] |
||
660 | mov ebx,ecx |
||
661 | mov ecx,2 |
||
662 | mov edi,[store_text_area_end] |
||
663 | call binary_to_hex_string |
||
664 | add [store_text_area_end],dword 4 |
||
665 | popa |
||
666 | ret |
||
667 | ;----------------------------------------------------------------------------- |
||
668 | ; ebx - value |
||
669 | ; ecx - digits |
||
670 | ; edi - output string |
||
671 | binary_to_hex_string: |
||
672 | add edi,ecx |
||
673 | dec edi |
||
674 | std |
||
675 | .1: |
||
676 | mov al,bl |
||
677 | and al,0xf |
||
678 | shr ebx,4 |
||
679 | cmp al,9 |
||
680 | jbe @f |
||
1351 | art_zh | 681 | |
1982 | mario79 | 682 | add al,0x27 |
683 | @@: |
||
684 | add al,0x30 |
||
685 | stosb |
||
686 | dec ecx |
||
687 | jnz .1 |
||
688 | cld |
||
689 | ret |
||
690 | ;----------------------------------------------------------------------------- |
||
1728 | clevermous | 691 | include 'vendors.inc' |
1982 | mario79 | 692 | ;----------------------------------------------------------------------------- |
132 | diamond | 693 | ; DATA AREA |
475 | Ghost | 694 | DATA |
132 | diamond | 695 | |
475 | Ghost | 696 | Form: dw 800 ; window width (no more, special for 800x600) |
697 | dw 100 ; window x start |
||
1358 | art_zh | 698 | dw 620 ; window height |
699 | dw 20 ; window y start |
||
205 | heavyiron | 700 | |
1983 | yogev_ezra | 701 | title db 'PCI Device Enumerator v 2.3 by J.Delozier, S.Kuzmin, V.Hanla, M.Zakiyanov, A.Jerdev, E.Grechnikov, CleverMouse', 0 |
205 | heavyiron | 702 | |
475 | Ghost | 703 | PCIWin mls \ |
1351 | art_zh | 704 | ' Don`t forget to enable PCI Access to Applications in Setup Menu.',\ |
475 | Ghost | 705 | '',\ |
1351 | art_zh | 706 | 'PCI Version = x.xx; Last PCI Bus = x',\ |
707 | 'User MMIO channel = 0F.F:F ',\ |
||
708 | 'Number of PCI units =',\ |
||
475 | Ghost | 709 | '',\ |
710 | 'VenID DevID Bus# Dev# Fnc Rev Class Subclass/ IRQ Company Description',\ |
||
711 | ' Interface',\ |
||
1982 | mario79 | 712 | '----- ----- ---- ---- --- --- ----- --------- --- ------------------------------------------ --------------------------------' |
205 | heavyiron | 713 | |
1351 | art_zh | 714 | bar_ram db 'BARx: MMIO block', 0 |
715 | bar_io db 'BARx: IO ports',0 |
||
716 | bar_um db 'BARx: unmapped',0 |
||
1358 | art_zh | 717 | bar_rom db 'BAR6: Expansion ROM', 0 |
1351 | art_zh | 718 | |
1982 | mario79 | 719 | text_save_button: |
720 | db 'Save PCI list',0 |
||
721 | .1: db '(Press S key)',0 |
||
722 | ;--------------------------------------------------------------------- |
||
723 | system_dir_ProcLib db '/sys/lib/proc_lib.obj',0 |
||
724 | |||
725 | err_message_found_lib2 db 'proc_lib.obj - Not found!',0 |
||
726 | |||
727 | err_message_import2 db 'proc_lib.obj - Wrong import!',0 |
||
728 | |||
729 | head_f_i: |
||
730 | head_f_l db 'error',0 |
||
731 | ;--------------------------------------------------------------------- |
||
732 | l_libs_start: |
||
733 | |||
734 | library02 l_libs system_dir_ProcLib+9, path, library_path, system_dir_ProcLib, \ |
||
735 | err_message_found_lib2, head_f_l, ProcLib_import, err_message_import2, head_f_i |
||
736 | |||
737 | end_l_libs: |
||
738 | ;--------------------------------------------------------------------- |
||
739 | align 4 |
||
740 | ProcLib_import: |
||
741 | OpenDialog_Init dd aOpenDialog_Init |
||
742 | OpenDialog_Start dd aOpenDialog_Start |
||
743 | ;OpenDialog__Version dd aOpenDialog_Version |
||
744 | dd 0 |
||
745 | dd 0 |
||
746 | aOpenDialog_Init db 'OpenDialog_init',0 |
||
747 | aOpenDialog_Start db 'OpenDialog_start',0 |
||
748 | ;aOpenDialog_Version db 'Version_OpenDialog',0 |
||
749 | ;--------------------------------------------------------------------- |
||
750 | align 4 |
||
751 | OpenDialog_data: |
||
752 | .type dd 0 |
||
753 | .procinfo dd Proc_Info ;+4 |
||
754 | .com_area_name dd communication_area_name ;+8 |
||
755 | .com_area dd 0 ;+12 |
||
756 | .opendir_pach dd temp_dir_pach ;+16 |
||
757 | .dir_default_pach dd communication_area_default_pach ;+20 |
||
758 | .start_path dd open_dialog_path ;+24 |
||
759 | .draw_window dd draw_window ;+28 |
||
760 | .status dd 0 ;+32 |
||
761 | .openfile_pach dd file_name ;+36 |
||
762 | .filename_area dd filename_area ;+40 |
||
763 | .filter_area dd Filter |
||
764 | .x: |
||
765 | .x_size dw 420 ;+48 ; Window X size |
||
766 | .x_start dw 10 ;+50 ; Window X position |
||
767 | .y: |
||
768 | .y_size dw 320 ;+52 ; Window y size |
||
769 | .y_start dw 10 ;+54 ; Window Y position |
||
770 | |||
771 | communication_area_name: |
||
772 | db 'FFFFFFFF_open_dialog',0 |
||
773 | open_dialog_path: |
||
774 | db '/sys/File Managers/opendial',0 |
||
775 | communication_area_default_pach: |
||
776 | db '/sys',0 |
||
777 | Filter: |
||
778 | dd Filter.end - Filter.1 |
||
779 | .1: |
||
780 | db 'TXT',0 |
||
781 | db 'LOG',0 |
||
782 | .end: |
||
783 | dd 0 |
||
784 | |||
785 | file_default_path: |
||
786 | db '/sys/' |
||
787 | start_temp_file_name: |
||
788 | db 'pcidev.txt',0 |
||
789 | ;--------------------------------------------------------------------- |
||
790 | align 4 |
||
791 | fileinfo: |
||
792 | .subfunction dd 2 |
||
793 | .Offset dd 0 |
||
794 | .Offset_1 dd 0 |
||
795 | .size dd 4096 |
||
796 | .return dd 0 |
||
797 | db 0 |
||
798 | .name: dd file_name |
||
799 | ;----------------------------------------------------------------------------- |
||
800 | |||
475 | Ghost | 801 | ; UNINITIALIZED DATA AREA |
1982 | mario79 | 802 | IM_END: |
475 | Ghost | 803 | total db ? |
804 | V_Bus db ? |
||
805 | V_Dev db ? |
||
806 | PCI_Version dw ? |
||
807 | PCI_LastBus db ? |
||
808 | PCI_Device dw ? |
||
809 | PCI_Vendor dw ? |
||
1351 | art_zh | 810 | PCI_Bus db ? |
811 | PCI_Dev db ? |
||
812 | PCI_Rev db ? |
||
475 | Ghost | 813 | ; don`t change order!!! |
814 | PCI_Class db ? |
||
815 | PCI_SubClass db ? |
||
816 | PCI_Interface db ? |
||
1351 | art_zh | 817 | PCI_IRQ db ? |
205 | heavyiron | 818 | |
1351 | art_zh | 819 | align 4 |
1386 | art_zh | 820 | MMIO_Bus db 255 |
821 | MMIO_Dev db 255 |
||
1351 | art_zh | 822 | MMIO_BAR db 0 |
1386 | art_zh | 823 | MMIO_allowed db 1 |
1351 | art_zh | 824 | MMIO_Map rd 8 |
825 | |||
826 | gr_pos dd ? |
||
827 | |||
1982 | mario79 | 828 | store_text_area_start dd ? |
829 | store_text_area_end dd ? |
||
830 | store_text_size dd ? |
||
831 | |||
832 | extended_key rb 1 |
||
833 | ;--------------------------------------------------------------------- |
||
834 | library_path: |
||
835 | rb 4096 |
||
836 | ;--------------------------------------------------------------------- |
||
837 | path: |
||
838 | rb 4096 |
||
839 | ;--------------------------------------------------------------------- |
||
840 | temp_dir_pach: |
||
841 | rb 4096 |
||
842 | ;--------------------------------------------------------------------- |
||
843 | file_name: |
||
844 | rb 4096 |
||
845 | ;--------------------------------------------------------------------- |
||
846 | file_name_1: |
||
847 | rb 4096 |
||
848 | ;--------------------------------------------------------------------- |
||
849 | filename_area: |
||
850 | rb 256 |
||
851 | ;--------------------------------------------------------------------- |
||
852 | rb 4096 |
||
853 | stacktop: |
||
854 | ;--------------------------------------------------------------------- |
||
475 | Ghost | 855 | Proc_Info process_information |
1982 | mario79 | 856 | ;--------------------------------------------------------------------- |
857 | I_END: |
||
858 | ;----------------------------------------------------------------------------->25,25>450,100> |