Subversion Repositories Kolibri OS

Rev

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

Rev 2465 Rev 3555
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
; Also, [fdc_irq_func], [irq14_func], [irq15_func] could process interrupt
-
 
221
; but do not return whether they did it, so just ignore IRQs 6, 14, 15.
-
 
222
        cmp     ebp, 6
-
 
223
        jz      .fail
-
 
224
        cmp     ebp, 14
-
 
225
        jz      .fail
-
 
226
        cmp     ebp, 15
-
 
227
        jz      .fail
-
 
228
        push    ebp
-
 
229
        xor     ebp, ebp
-
 
230
.try_other_irqs:
-
 
231
        cmp     ebp, [esp]
-
 
232
        jz      .try_next_irq
-
 
233
        cmp     ebp, 1
-
 
234
        jz      .try_next_irq
-
 
235
        cmp     ebp, 12
-
 
236
        jz      .try_next_irq
-
 
237
        lea     esi, [irqh_tab+ebp*8]
-
 
238
        mov     ebx, esi
-
 
239
.try_next_handler:
-
 
240
        mov     ebx, [ebx+IRQH.list.next]
-
 
241
        cmp     ebx, esi
-
 
242
        je      .try_next_irq
-
 
243
        cmp     [ebx+IRQH.num_ints], 0
-
 
244
        jne     .try_next_handler
-
 
245
; keyboard handler acknowledges everything
-
 
246
        push    [ebx+IRQH.data]
-
 
247
        call    [ebx+IRQH.handler]
-
 
248
        pop     ecx
-
 
249
        test    eax, eax
-
 
250
        jz      .try_next_handler
-
 
251
 
-
 
252
.found_in_wrong_list:
-
 
253
        DEBUGF 1,'K : warning: relinking handler from IRQ%d to IRQ%d\n',\
-
 
254
                ebp, [esp]
-
 
255
        pop     ebp
-
 
256
        spin_lock_irqsave IrqsList
-
 
257
        list_del ebx
-
 
258
        lea     edx, [irqh_tab+ebp*8]
-
 
259
        list_add_tail ebx, edx
-
 
260
        spin_unlock_irqrestore IrqsList
-
 
261
        jmp     .exit
-
 
262
 
-
 
263
.try_next_irq:
201
       jmp .next
264
        inc     ebp
202
 
265
        cmp     ebp, 16
203
.done:
-
 
Line 204... Line 266...
204
       btr [irq_active_set], ebp
266
        jb      .try_other_irqs
205
       jnc .exit
267
        pop     ebp
Line 206... Line 268...
206
 
268