Rev 1508 | Rev 1587 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1508 | Rev 1560 | ||
---|---|---|---|
Line 21... | Line 21... | ||
21 | ;; ;; |
21 | ;; ;; |
22 | ;; See file COPYING for details ;; |
22 | ;; See file COPYING for details ;; |
23 | ;; ;; |
23 | ;; ;; |
24 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
24 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
Line 25... | Line 25... | ||
25 | 25 | ||
Line 26... | Line 26... | ||
26 | $Revision: 1508 $ |
26 | $Revision: 1560 $ |
27 | 27 | ||
28 | ;*************************************************************************** |
28 | ;*************************************************************************** |
29 | ; Function |
29 | ; Function |
Line 126... | Line 126... | ||
126 | ;*************************************************************************** |
126 | ;*************************************************************************** |
Line 127... | Line 127... | ||
127 | 127 | ||
Line 128... | Line 128... | ||
128 | align 4 |
128 | align 4 |
129 | - | ||
130 | pci_read_reg: |
- | |
131 | cmp byte [BOOT_VAR+0x9020],2 ;what mechanism will we use? |
- | |
132 | je pci_read_reg_2 |
- | |
133 | 129 | ||
134 | ; mechanism 1 |
130 | pci_read_reg: |
135 | push esi ; save register size into ESI |
131 | push esi ; save register size into ESI |
Line 136... | Line 132... | ||
136 | mov esi,eax |
132 | mov esi,eax |
Line 175... | Line 171... | ||
175 | out dx,eax |
171 | out dx,eax |
Line 176... | Line 172... | ||
176 | 172 | ||
177 | pop eax |
173 | pop eax |
178 | pop esi |
174 | pop esi |
179 | ret |
- | |
180 | pci_read_reg_2: |
- | |
181 | - | ||
182 | test bh,128 ;mech#2 only supports 16 devices per bus |
- | |
183 | jnz pci_read_reg_err |
- | |
184 | - | ||
185 | push esi ; save register size into ESI |
- | |
186 | mov esi,eax |
- | |
187 | and esi,3 |
- | |
188 | - | ||
189 | push eax |
- | |
190 | ;store current state of config space |
- | |
191 | mov dx,0xcf8 |
- | |
192 | in al,dx |
- | |
193 | mov ah,al |
- | |
194 | mov dl,0xfa |
- | |
195 | in al,dx |
- | |
196 | - | ||
197 | xchg eax,[esp] |
- | |
198 | ; out 0xcfa,bus |
- | |
199 | mov al,ah |
- | |
200 | out dx,al |
- | |
201 | ; out 0xcf8,0x80 |
- | |
202 | mov dl,0xf8 |
- | |
203 | mov al,0x80 |
- | |
204 | out dx,al |
- | |
205 | ; compute addr |
- | |
206 | shr bh,3 ; func is ignored in mechanism 2 |
- | |
207 | or bh,0xc0 |
- | |
208 | mov dx,bx |
- | |
209 | - | ||
210 | or esi,esi |
- | |
211 | jz pci_read_byte2 |
- | |
212 | cmp esi,1 |
- | |
213 | jz pci_read_word2 |
- | |
214 | cmp esi,2 |
- | |
215 | jz pci_read_dword2 |
- | |
216 | jmp pci_fin_read2 |
- | |
217 | - | ||
218 | pci_read_byte2: |
- | |
219 | in al,dx |
- | |
220 | jmp pci_fin_read2 |
- | |
221 | pci_read_word2: |
- | |
222 | in ax,dx |
- | |
223 | jmp pci_fin_read2 |
- | |
224 | pci_read_dword2: |
- | |
225 | in eax,dx |
- | |
226 | ; jmp pci_fin_read2 |
- | |
227 | pci_fin_read2: |
- | |
228 | - | ||
229 | ; restore configuration space |
- | |
230 | xchg eax,[esp] |
- | |
231 | mov dx,0xcfa |
- | |
232 | out dx,al |
- | |
233 | mov dl,0xf8 |
- | |
234 | mov al,ah |
- | |
235 | out dx,al |
- | |
236 | - | ||
237 | pop eax |
- | |
238 | pop esi |
- | |
Line 239... | Line 175... | ||
239 | ret |
175 | ret |
240 | 176 | ||
241 | pci_read_reg_err: |
177 | pci_read_reg_err: |
242 | xor eax,eax |
178 | xor eax,eax |
Line 257... | Line 193... | ||
257 | ;*************************************************************************** |
193 | ;*************************************************************************** |
Line 258... | Line 194... | ||
258 | 194 | ||
Line 259... | Line 195... | ||
259 | align 4 |
195 | align 4 |
260 | - | ||
261 | pci_write_reg: |
- | |
262 | cmp byte [BOOT_VAR+0x9020],2 ;what mechanism will we use? |
- | |
263 | je pci_write_reg_2 |
- | |
264 | 196 | ||
265 | ; mechanism 1 |
197 | pci_write_reg: |
266 | push esi ; save register size into ESI |
198 | push esi ; save register size into ESI |
Line 267... | Line 199... | ||
267 | mov esi,eax |
199 | mov esi,eax |
Line 299... | Line 231... | ||
299 | jmp pci_fin_write1 |
231 | jmp pci_fin_write1 |
300 | pci_write_dword1: |
232 | pci_write_dword1: |
301 | out dx,eax |
233 | out dx,eax |
302 | jmp pci_fin_write1 |
234 | jmp pci_fin_write1 |
303 | pci_fin_write1: |
235 | pci_fin_write1: |
304 | - | ||
305 | ; restore configuration control |
236 | ; restore configuration control |
306 | pop eax |
237 | pop eax |
307 | mov dl,0xf8 |
238 | mov dl,0xf8 |
308 | out dx,eax |
239 | out dx,eax |
Line 309... | Line 240... | ||
309 | 240 | ||
310 | xor eax,eax |
241 | xor eax,eax |
311 | pop esi |
- | |
312 | - | ||
313 | ret |
- | |
314 | pci_write_reg_2: |
- | |
315 | - | ||
316 | test bh,128 ;mech#2 only supports 16 devices per bus |
- | |
317 | jnz pci_write_reg_err |
- | |
318 | - | ||
319 | - | ||
320 | push esi ; save register size into ESI |
- | |
321 | mov esi,eax |
- | |
322 | and esi,3 |
- | |
323 | - | ||
324 | push eax |
- | |
325 | ;store current state of config space |
- | |
326 | mov dx,0xcf8 |
- | |
327 | in al,dx |
- | |
328 | mov ah,al |
- | |
329 | mov dl,0xfa |
- | |
330 | in al,dx |
- | |
331 | xchg eax,[esp] |
- | |
332 | ; out 0xcfa,bus |
- | |
333 | mov al,ah |
- | |
334 | out dx,al |
- | |
335 | ; out 0xcf8,0x80 |
- | |
336 | mov dl,0xf8 |
- | |
337 | mov al,0x80 |
- | |
338 | out dx,al |
- | |
339 | ; compute addr |
- | |
340 | shr bh,3 ; func is ignored in mechanism 2 |
- | |
341 | or bh,0xc0 |
- | |
342 | mov dx,bx |
- | |
343 | ; write register |
- | |
344 | mov eax,ecx |
- | |
345 | - | ||
346 | or esi,esi |
- | |
347 | jz pci_write_byte2 |
- | |
348 | cmp esi,1 |
- | |
349 | jz pci_write_word2 |
- | |
350 | cmp esi,2 |
- | |
351 | jz pci_write_dword2 |
- | |
352 | jmp pci_fin_write2 |
- | |
353 | - | ||
354 | pci_write_byte2: |
- | |
355 | out dx,al |
- | |
356 | jmp pci_fin_write2 |
- | |
357 | pci_write_word2: |
- | |
358 | out dx,ax |
- | |
359 | jmp pci_fin_write2 |
- | |
360 | pci_write_dword2: |
- | |
361 | out dx,eax |
- | |
362 | jmp pci_fin_write2 |
- | |
363 | pci_fin_write2: |
- | |
364 | ; restore configuration space |
- | |
365 | pop eax |
- | |
366 | mov dx,0xcfa |
- | |
367 | out dx,al |
- | |
368 | mov dl,0xf8 |
- | |
369 | mov al,ah |
- | |
370 | out dx,al |
- | |
371 | - | ||
372 | xor eax,eax |
- | |
373 | pop esi |
242 | pop esi |
Line 374... | Line 243... | ||
374 | ret |
243 | ret |
375 | 244 | ||
376 | pci_write_reg_err: |
245 | pci_write_reg_err: |