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