Subversion Repositories Kolibri OS

Rev

Rev 1981 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

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