Subversion Repositories Kolibri OS

Rev

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

Rev 2455 Rev 3505
Line 64... Line 64...
64
 
64
 
65
        mov     edx, [handler]
65
        mov     edx, [handler]
66
        test    edx, edx
66
        test    edx, edx
Line 67... Line 67...
67
        jz      .err
67
        jz      .err
68
 
-
 
Line 69... Line 68...
69
        pushfd
68
 
Line 70... Line 69...
70
        cli
69
        spin_lock_irqsave IrqsList
71
 
70
 
Line 82... Line 81...
82
        mov     [irq_failed+ebx*4], 0;clear counter
81
        mov     [irq_failed+ebx*4], 0;clear counter
Line 83... Line 82...
83
 
82
 
84
        mov     eax, [user_data]
83
        mov     eax, [user_data]
85
        mov     [ecx+IRQH.handler], edx
84
        mov     [ecx+IRQH.handler], edx
-
 
85
        mov     [ecx+IRQH.data], eax
Line 86... Line 86...
86
        mov     [ecx+IRQH.data], eax
86
        and     [ecx+IRQH.num_ints], 0
87
 
87
 
88
        lea     edx, [irqh_tab+ebx*8]
88
        lea     edx, [irqh_tab+ebx*8]
Line 89... Line 89...
89
         list_add_tail ecx, edx     ;clobber eax
89
        list_add_tail ecx, edx     ;clobber eax
90
        stdcall enable_irq, ebx
90
        stdcall enable_irq, ebx
91
 
91
 
92
.fail:
92
.fail:
93
        popfd
93
        spin_unlock_irqrestore IrqsList
94
.err:
94
.err:
Line 186... Line 186...
186
        push    edi
186
        push    edi
187
        push    esi
187
        push    esi
Line 188... Line 188...
188
 
188
 
189
        push    [ebx+IRQH.data]
189
        push    [ebx+IRQH.data]
190
        call    [ebx+IRQH.handler]
190
        call    [ebx+IRQH.handler]
Line 191... Line 191...
191
        add     esp, 4
191
        pop     ecx
192
 
192
 
193
        pop     esi
193
        pop     esi
Line 194... Line 194...
194
        pop     edi
194
        pop     edi
195
        pop     ebx
195
        pop     ebx
Line -... Line 196...
-
 
196
 
196
 
197
        test    eax, eax
197
        test    eax, eax
198
        jz      .next
Line 198... Line 199...
198
        jz      .next
199
 
199
 
200
        inc     [ebx+IRQH.num_ints]
200
        btr     [irq_active_set], ebp
201
        btr     [irq_active_set], ebp
Line -... Line 202...
-
 
202
        jmp     .next
-
 
203
 
-
 
204
.done:
-
 
205
        btr     [irq_active_set], ebp
-
 
206
        jnc     .exit
-
 
207
 
-
 
208
; There is at least one configuration with one device which generates IRQ
-
 
209
; that is not the same as it should be according to PCI config space.
-
 
210
; For that device, the handler is registered at wrong IRQ.
-
 
211
; As a workaround, when nobody acknowledges the generated IRQ,
-
 
212
; try to ask all other registered handlers; if some handler acknowledges
-
 
213
; the IRQ this time, relink it to the current IRQ list.
-
 
214
; To make this more reliable, for every handler keep number of times
-
 
215
; that it has acknowledged an IRQ, and assume that handlers with at least one
-
 
216
; acknowledged IRQ are registered properly.
-
 
217
; Note: this still isn't 100% correct, because two IRQs can fire simultaneously,
-
 
218
; the better way would be to find the correct IRQ, but I don't know how to do
-
 
219
; this in that case.
-
 
220
        push    ebp
-
 
221
        xor     ebp, ebp
-
 
222
.try_other_irqs:
-
 
223
        cmp     ebp, [esp]
-
 
224
        jz      .try_next_irq
-
 
225
        lea     esi, [irqh_tab+ebp*8]
-
 
226
        mov     ebx, esi
-
 
227
.try_next_handler:
-
 
228
        mov     ebx, [ebx+IRQH.list.next]
-
 
229
        cmp     ebx, esi
-
 
230
        je      .try_next_irq
-
 
231
        cmp     [ebx+IRQH.num_ints], 0
-
 
232
        jne     .try_next_irq
-
 
233
        push    [ebx+IRQH.data]
-
 
234
        call    [ebx+IRQH.handler]
-
 
235
        pop     ecx
-
 
236
        test    eax, eax
-
 
237
        jnz     .found_in_wrong_list
201
        jmp     .next
238
.try_next_irq:
202
 
239
        inc     ebp
203
.done:
240
        cmp     ebp, 16
Line 204... Line 241...
204
        btr     [irq_active_set], ebp
241
        jb      .try_other_irqs
Line 213... Line 250...
213
 
250
 
214
       restore_ring3_context
251
        restore_ring3_context
215
        add     esp, 4
252
        add     esp, 4
Line -... Line 253...
-
 
253
        iret
-
 
254
 
-
 
255
.found_in_wrong_list:
-
 
256
        DEBUGF 1,'K : warning: relinking handler from IRQ%d to IRQ%d\n',\
-
 
257
                ebp, [esp]
-
 
258
        spin_lock_irqsave IrqsList
-
 
259
        list_del ebx
-
 
260
        pop     ebp
-
 
261
        lea     edx, [irqh_tab+ebp*8]
-
 
262
        list_add_tail ebx, edx
-
 
263
        spin_unlock_irqrestore IrqsList
216
        iret
264
        jmp     .exit
217
 
265
 
218
align 4
266
align 4
219
irqD:
267
irqD:
220
        push    eax
268
        push    eax