Block level-triggered interrupts at the ioapic if they are deferred.

Avoids interrupt storms seen on some systems. Many thanks to
Stoned Elipot for testing.
This commit is contained in:
fvdl 2003-05-04 22:01:56 +00:00
parent d22ec31292
commit 2cd70f0da1
7 changed files with 278 additions and 114 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: genassym.cf,v 1.36 2003/04/02 07:35:58 thorpej Exp $ # $NetBSD: genassym.cf,v 1.37 2003/05/04 22:01:58 fvdl Exp $
# #
# Copyright (c) 1998 The NetBSD Foundation, Inc. # Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -128,6 +128,7 @@ include <machine/cpu.h>
endif endif
if NIOAPIC > 0 if NIOAPIC > 0
include <machine/i82093reg.h>
include <machine/i82093var.h> include <machine/i82093var.h>
endif endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: vector.S,v 1.7 2003/02/26 21:28:25 fvdl Exp $ */ /* $NetBSD: vector.S,v 1.8 2003/05/04 22:01:58 fvdl Exp $ */
/* /*
* Copyright 2002 (c) Wasabi Systems, Inc. * Copyright 2002 (c) Wasabi Systems, Inc.
@ -249,15 +249,16 @@ IDTVEC(intr_lapic_ltimer)
* for specific PICs. * for specific PICs.
*/ */
#define INTRSTUB(name, num, early_ack, late_ack, mask, unmask, level_check) \ #define INTRSTUB(name, num, early_ack, late_ack, mask, unmask, level_mask) \
IDTVEC(recurse_/**/name/**/num) ;\ IDTVEC(recurse_/**/name/**/num) ;\
pushfl ;\ pushfl ;\
pushl %cs ;\ pushl %cs ;\
pushl %esi ;\ pushl %esi ;\
pushl $0 /* dummy error code */ ;\ subl $4,%esp ;\
pushl $T_ASTFLT /* trap # for doing ASTs */ ;\ pushl $T_ASTFLT /* trap # for doing ASTs */ ;\
INTRENTRY ;\ INTRENTRY ;\
IDTVEC(resume_/**/name/**/num) \ IDTVEC(resume_/**/name/**/num) \
movl $IREENT_MAGIC,TF_ERR(%esp) ;\
movl %ebx,%esi ;\ movl %ebx,%esi ;\
movl CPUVAR(ISOURCES) + (num) * 4, %ebp ;\ movl CPUVAR(ISOURCES) + (num) * 4, %ebp ;\
movl IS_MAXLEVEL(%ebp),%ebx ;\ movl IS_MAXLEVEL(%ebp),%ebx ;\
@ -293,24 +294,28 @@ IDTVEC(intr_/**/name/**/num) ;\
movl %edi,CPUVAR(ILEVEL) ;\ movl %edi,CPUVAR(ILEVEL) ;\
call *IH_FUN(%ebx) /* call it */ ;\ call *IH_FUN(%ebx) /* call it */ ;\
addl $4,%esp /* toss the arg */ ;\ addl $4,%esp /* toss the arg */ ;\
level_check(num) ;\
movl IH_NEXT(%ebx),%ebx /* next handler in chain */ ;\ movl IH_NEXT(%ebx),%ebx /* next handler in chain */ ;\
testl %ebx,%ebx ;\ testl %ebx,%ebx ;\
jnz 6b ;\ jnz 6b ;\
5: \ 5: \
UNLOCK_KERNEL ;\ UNLOCK_KERNEL ;\
cli ;\
unmask(num) /* unmask it in hardware */ ;\ unmask(num) /* unmask it in hardware */ ;\
late_ack(num) ;\ late_ack(num) ;\
sti ;\ sti ;\
jmp _C_LABEL(Xdoreti) /* lower spl and do ASTs */ ;\ jmp _C_LABEL(Xdoreti) /* lower spl and do ASTs */ ;\
7: \ 7: \
UNLOCK_KERNEL ;\ UNLOCK_KERNEL ;\
cli ;\
orl $(1 << num),CPUVAR(IPENDING) ;\ orl $(1 << num),CPUVAR(IPENDING) ;\
level_mask(num) ;\
late_ack(num) ;\ late_ack(num) ;\
sti ;\ sti ;\
jmp _C_LABEL(Xdoreti) /* lower spl and do ASTs */ ;\ jmp _C_LABEL(Xdoreti) /* lower spl and do ASTs */ ;\
10: \ 10: \
cli ;\
orl $(1 << num),CPUVAR(IPENDING) ;\ orl $(1 << num),CPUVAR(IPENDING) ;\
level_mask(num) ;\
late_ack(num) ;\ late_ack(num) ;\
sti ;\ sti ;\
INTRFASTEXIT ;\ INTRFASTEXIT ;\
@ -360,38 +365,71 @@ INTRSTUB(legacy,15,i8259_asm_ack2,voidop,i8259_asm_mask,i8259_asm_unmask,
#if NIOAPIC > 0 #if NIOAPIC > 0
INTRSTUB(ioapic,0,voidop,ioapic_asm_ack,voidop,voidop,voidop) INTRSTUB(ioapic_edge,0,voidop,ioapic_asm_ack,voidop,voidop,voidop)
INTRSTUB(ioapic,1,voidop,ioapic_asm_ack,voidop,voidop,voidop) INTRSTUB(ioapic_edge,1,voidop,ioapic_asm_ack,voidop,voidop,voidop)
INTRSTUB(ioapic,2,voidop,ioapic_asm_ack,voidop,voidop,voidop) INTRSTUB(ioapic_edge,2,voidop,ioapic_asm_ack,voidop,voidop,voidop)
INTRSTUB(ioapic,3,voidop,ioapic_asm_ack,voidop,voidop,voidop) INTRSTUB(ioapic_edge,3,voidop,ioapic_asm_ack,voidop,voidop,voidop)
INTRSTUB(ioapic,4,voidop,ioapic_asm_ack,voidop,voidop,voidop) INTRSTUB(ioapic_edge,4,voidop,ioapic_asm_ack,voidop,voidop,voidop)
INTRSTUB(ioapic,5,voidop,ioapic_asm_ack,voidop,voidop,voidop) INTRSTUB(ioapic_edge,5,voidop,ioapic_asm_ack,voidop,voidop,voidop)
INTRSTUB(ioapic,6,voidop,ioapic_asm_ack,voidop,voidop,voidop) INTRSTUB(ioapic_edge,6,voidop,ioapic_asm_ack,voidop,voidop,voidop)
INTRSTUB(ioapic,7,voidop,ioapic_asm_ack,voidop,voidop,voidop) INTRSTUB(ioapic_edge,7,voidop,ioapic_asm_ack,voidop,voidop,voidop)
INTRSTUB(ioapic,8,voidop,ioapic_asm_ack,voidop,voidop,voidop) INTRSTUB(ioapic_edge,8,voidop,ioapic_asm_ack,voidop,voidop,voidop)
INTRSTUB(ioapic,9,voidop,ioapic_asm_ack,voidop,voidop,voidop) INTRSTUB(ioapic_edge,9,voidop,ioapic_asm_ack,voidop,voidop,voidop)
INTRSTUB(ioapic,10,voidop,ioapic_asm_ack,voidop,voidop,voidop) INTRSTUB(ioapic_edge,10,voidop,ioapic_asm_ack,voidop,voidop,voidop)
INTRSTUB(ioapic,11,voidop,ioapic_asm_ack,voidop,voidop,voidop) INTRSTUB(ioapic_edge,11,voidop,ioapic_asm_ack,voidop,voidop,voidop)
INTRSTUB(ioapic,12,voidop,ioapic_asm_ack,voidop,voidop,voidop) INTRSTUB(ioapic_edge,12,voidop,ioapic_asm_ack,voidop,voidop,voidop)
INTRSTUB(ioapic,13,voidop,ioapic_asm_ack,voidop,voidop,voidop) INTRSTUB(ioapic_edge,13,voidop,ioapic_asm_ack,voidop,voidop,voidop)
INTRSTUB(ioapic,14,voidop,ioapic_asm_ack,voidop,voidop,voidop) INTRSTUB(ioapic_edge,14,voidop,ioapic_asm_ack,voidop,voidop,voidop)
INTRSTUB(ioapic,15,voidop,ioapic_asm_ack,voidop,voidop,voidop) INTRSTUB(ioapic_edge,15,voidop,ioapic_asm_ack,voidop,voidop,voidop)
INTRSTUB(ioapic,16,voidop,ioapic_asm_ack,voidop,voidop,voidop) INTRSTUB(ioapic_edge,16,voidop,ioapic_asm_ack,voidop,voidop,voidop)
INTRSTUB(ioapic,17,voidop,ioapic_asm_ack,voidop,voidop,voidop) INTRSTUB(ioapic_edge,17,voidop,ioapic_asm_ack,voidop,voidop,voidop)
INTRSTUB(ioapic,18,voidop,ioapic_asm_ack,voidop,voidop,voidop) INTRSTUB(ioapic_edge,18,voidop,ioapic_asm_ack,voidop,voidop,voidop)
INTRSTUB(ioapic,19,voidop,ioapic_asm_ack,voidop,voidop,voidop) INTRSTUB(ioapic_edge,19,voidop,ioapic_asm_ack,voidop,voidop,voidop)
INTRSTUB(ioapic,20,voidop,ioapic_asm_ack,voidop,voidop,voidop) INTRSTUB(ioapic_edge,20,voidop,ioapic_asm_ack,voidop,voidop,voidop)
INTRSTUB(ioapic,21,voidop,ioapic_asm_ack,voidop,voidop,voidop) INTRSTUB(ioapic_edge,21,voidop,ioapic_asm_ack,voidop,voidop,voidop)
INTRSTUB(ioapic,22,voidop,ioapic_asm_ack,voidop,voidop,voidop) INTRSTUB(ioapic_edge,22,voidop,ioapic_asm_ack,voidop,voidop,voidop)
INTRSTUB(ioapic,23,voidop,ioapic_asm_ack,voidop,voidop,voidop) INTRSTUB(ioapic_edge,23,voidop,ioapic_asm_ack,voidop,voidop,voidop)
INTRSTUB(ioapic,24,voidop,ioapic_asm_ack,voidop,voidop,voidop) INTRSTUB(ioapic_edge,24,voidop,ioapic_asm_ack,voidop,voidop,voidop)
INTRSTUB(ioapic,25,voidop,ioapic_asm_ack,voidop,voidop,voidop) INTRSTUB(ioapic_edge,25,voidop,ioapic_asm_ack,voidop,voidop,voidop)
INTRSTUB(ioapic,26,voidop,ioapic_asm_ack,voidop,voidop,voidop) INTRSTUB(ioapic_edge,26,voidop,ioapic_asm_ack,voidop,voidop,voidop)
INTRSTUB(ioapic,27,voidop,ioapic_asm_ack,voidop,voidop,voidop) INTRSTUB(ioapic_edge,27,voidop,ioapic_asm_ack,voidop,voidop,voidop)
INTRSTUB(ioapic,28,voidop,ioapic_asm_ack,voidop,voidop,voidop) INTRSTUB(ioapic_edge,28,voidop,ioapic_asm_ack,voidop,voidop,voidop)
INTRSTUB(ioapic,29,voidop,ioapic_asm_ack,voidop,voidop,voidop) INTRSTUB(ioapic_edge,29,voidop,ioapic_asm_ack,voidop,voidop,voidop)
INTRSTUB(ioapic,30,voidop,ioapic_asm_ack,voidop,voidop,voidop) INTRSTUB(ioapic_edge,30,voidop,ioapic_asm_ack,voidop,voidop,voidop)
INTRSTUB(ioapic,31,voidop,ioapic_asm_ack,voidop,voidop,voidop) INTRSTUB(ioapic_edge,31,voidop,ioapic_asm_ack,voidop,voidop,voidop)
INTRSTUB(ioapic_level,0,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
INTRSTUB(ioapic_level,1,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
INTRSTUB(ioapic_level,2,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
INTRSTUB(ioapic_level,3,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
INTRSTUB(ioapic_level,4,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
INTRSTUB(ioapic_level,5,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
INTRSTUB(ioapic_level,6,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
INTRSTUB(ioapic_level,7,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
INTRSTUB(ioapic_level,8,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
INTRSTUB(ioapic_level,9,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
INTRSTUB(ioapic_level,10,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
INTRSTUB(ioapic_level,11,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
INTRSTUB(ioapic_level,12,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
INTRSTUB(ioapic_level,13,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
INTRSTUB(ioapic_level,14,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
INTRSTUB(ioapic_level,15,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
INTRSTUB(ioapic_level,16,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
INTRSTUB(ioapic_level,17,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
INTRSTUB(ioapic_level,18,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
INTRSTUB(ioapic_level,19,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
INTRSTUB(ioapic_level,20,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
INTRSTUB(ioapic_level,21,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
INTRSTUB(ioapic_level,22,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
INTRSTUB(ioapic_level,23,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
INTRSTUB(ioapic_level,24,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
INTRSTUB(ioapic_level,25,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
INTRSTUB(ioapic_level,26,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
INTRSTUB(ioapic_level,27,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
INTRSTUB(ioapic_level,28,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
INTRSTUB(ioapic_level,29,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
INTRSTUB(ioapic_level,30,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
INTRSTUB(ioapic_level,31,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
#endif #endif
@ -431,72 +469,139 @@ _C_LABEL(i8259_stubs):
.long _C_LABEL(Xresume_legacy15) .long _C_LABEL(Xresume_legacy15)
#if NIOAPIC > 0 #if NIOAPIC > 0
.globl _C_LABEL(ioapic_stubs) .globl _C_LABEL(ioapic_edge_stubs)
_C_LABEL(ioapic_stubs): _C_LABEL(ioapic_edge_stubs):
.long _C_LABEL(Xintr_ioapic0), _C_LABEL(Xrecurse_ioapic0) .long _C_LABEL(Xintr_ioapic_edge0), _C_LABEL(Xrecurse_ioapic_edge0)
.long _C_LABEL(Xresume_ioapic0) .long _C_LABEL(Xresume_ioapic_edge0)
.long _C_LABEL(Xintr_ioapic1), _C_LABEL(Xrecurse_ioapic1) .long _C_LABEL(Xintr_ioapic_edge1), _C_LABEL(Xrecurse_ioapic_edge1)
.long _C_LABEL(Xresume_ioapic1) .long _C_LABEL(Xresume_ioapic_edge1)
.long _C_LABEL(Xintr_ioapic2), _C_LABEL(Xrecurse_ioapic2) .long _C_LABEL(Xintr_ioapic_edge2), _C_LABEL(Xrecurse_ioapic_edge2)
.long _C_LABEL(Xresume_ioapic2) .long _C_LABEL(Xresume_ioapic_edge2)
.long _C_LABEL(Xintr_ioapic3), _C_LABEL(Xrecurse_ioapic3) .long _C_LABEL(Xintr_ioapic_edge3), _C_LABEL(Xrecurse_ioapic_edge3)
.long _C_LABEL(Xresume_ioapic3) .long _C_LABEL(Xresume_ioapic_edge3)
.long _C_LABEL(Xintr_ioapic4), _C_LABEL(Xrecurse_ioapic4) .long _C_LABEL(Xintr_ioapic_edge4), _C_LABEL(Xrecurse_ioapic_edge4)
.long _C_LABEL(Xresume_ioapic4) .long _C_LABEL(Xresume_ioapic_edge4)
.long _C_LABEL(Xintr_ioapic5), _C_LABEL(Xrecurse_ioapic5) .long _C_LABEL(Xintr_ioapic_edge5), _C_LABEL(Xrecurse_ioapic_edge5)
.long _C_LABEL(Xresume_ioapic5) .long _C_LABEL(Xresume_ioapic_edge5)
.long _C_LABEL(Xintr_ioapic6), _C_LABEL(Xrecurse_ioapic6) .long _C_LABEL(Xintr_ioapic_edge6), _C_LABEL(Xrecurse_ioapic_edge6)
.long _C_LABEL(Xresume_ioapic6) .long _C_LABEL(Xresume_ioapic_edge6)
.long _C_LABEL(Xintr_ioapic7), _C_LABEL(Xrecurse_ioapic7) .long _C_LABEL(Xintr_ioapic_edge7), _C_LABEL(Xrecurse_ioapic_edge7)
.long _C_LABEL(Xresume_ioapic7) .long _C_LABEL(Xresume_ioapic_edge7)
.long _C_LABEL(Xintr_ioapic8), _C_LABEL(Xrecurse_ioapic8) .long _C_LABEL(Xintr_ioapic_edge8), _C_LABEL(Xrecurse_ioapic_edge8)
.long _C_LABEL(Xresume_ioapic8) .long _C_LABEL(Xresume_ioapic_edge8)
.long _C_LABEL(Xintr_ioapic9), _C_LABEL(Xrecurse_ioapic9) .long _C_LABEL(Xintr_ioapic_edge9), _C_LABEL(Xrecurse_ioapic_edge9)
.long _C_LABEL(Xresume_ioapic9) .long _C_LABEL(Xresume_ioapic_edge9)
.long _C_LABEL(Xintr_ioapic10), _C_LABEL(Xrecurse_ioapic10) .long _C_LABEL(Xintr_ioapic_edge10), _C_LABEL(Xrecurse_ioapic_edge10)
.long _C_LABEL(Xresume_ioapic10) .long _C_LABEL(Xresume_ioapic_edge10)
.long _C_LABEL(Xintr_ioapic11), _C_LABEL(Xrecurse_ioapic11) .long _C_LABEL(Xintr_ioapic_edge11), _C_LABEL(Xrecurse_ioapic_edge11)
.long _C_LABEL(Xresume_ioapic11) .long _C_LABEL(Xresume_ioapic_edge11)
.long _C_LABEL(Xintr_ioapic12), _C_LABEL(Xrecurse_ioapic12) .long _C_LABEL(Xintr_ioapic_edge12), _C_LABEL(Xrecurse_ioapic_edge12)
.long _C_LABEL(Xresume_ioapic12) .long _C_LABEL(Xresume_ioapic_edge12)
.long _C_LABEL(Xintr_ioapic13), _C_LABEL(Xrecurse_ioapic13) .long _C_LABEL(Xintr_ioapic_edge13), _C_LABEL(Xrecurse_ioapic_edge13)
.long _C_LABEL(Xresume_ioapic13) .long _C_LABEL(Xresume_ioapic_edge13)
.long _C_LABEL(Xintr_ioapic14), _C_LABEL(Xrecurse_ioapic14) .long _C_LABEL(Xintr_ioapic_edge14), _C_LABEL(Xrecurse_ioapic_edge14)
.long _C_LABEL(Xresume_ioapic14) .long _C_LABEL(Xresume_ioapic_edge14)
.long _C_LABEL(Xintr_ioapic15), _C_LABEL(Xrecurse_ioapic15) .long _C_LABEL(Xintr_ioapic_edge15), _C_LABEL(Xrecurse_ioapic_edge15)
.long _C_LABEL(Xresume_ioapic15) .long _C_LABEL(Xresume_ioapic_edge15)
.long _C_LABEL(Xintr_ioapic16), _C_LABEL(Xrecurse_ioapic16) .long _C_LABEL(Xintr_ioapic_edge16), _C_LABEL(Xrecurse_ioapic_edge16)
.long _C_LABEL(Xresume_ioapic16) .long _C_LABEL(Xresume_ioapic_edge16)
.long _C_LABEL(Xintr_ioapic17), _C_LABEL(Xrecurse_ioapic17) .long _C_LABEL(Xintr_ioapic_edge17), _C_LABEL(Xrecurse_ioapic_edge17)
.long _C_LABEL(Xresume_ioapic17) .long _C_LABEL(Xresume_ioapic_edge17)
.long _C_LABEL(Xintr_ioapic18), _C_LABEL(Xrecurse_ioapic18) .long _C_LABEL(Xintr_ioapic_edge18), _C_LABEL(Xrecurse_ioapic_edge18)
.long _C_LABEL(Xresume_ioapic18) .long _C_LABEL(Xresume_ioapic_edge18)
.long _C_LABEL(Xintr_ioapic19), _C_LABEL(Xrecurse_ioapic19) .long _C_LABEL(Xintr_ioapic_edge19), _C_LABEL(Xrecurse_ioapic_edge19)
.long _C_LABEL(Xresume_ioapic19) .long _C_LABEL(Xresume_ioapic_edge19)
.long _C_LABEL(Xintr_ioapic20), _C_LABEL(Xrecurse_ioapic20) .long _C_LABEL(Xintr_ioapic_edge20), _C_LABEL(Xrecurse_ioapic_edge20)
.long _C_LABEL(Xresume_ioapic20) .long _C_LABEL(Xresume_ioapic_edge20)
.long _C_LABEL(Xintr_ioapic21), _C_LABEL(Xrecurse_ioapic21) .long _C_LABEL(Xintr_ioapic_edge21), _C_LABEL(Xrecurse_ioapic_edge21)
.long _C_LABEL(Xresume_ioapic21) .long _C_LABEL(Xresume_ioapic_edge21)
.long _C_LABEL(Xintr_ioapic22), _C_LABEL(Xrecurse_ioapic22) .long _C_LABEL(Xintr_ioapic_edge22), _C_LABEL(Xrecurse_ioapic_edge22)
.long _C_LABEL(Xresume_ioapic22) .long _C_LABEL(Xresume_ioapic_edge22)
.long _C_LABEL(Xintr_ioapic23), _C_LABEL(Xrecurse_ioapic23) .long _C_LABEL(Xintr_ioapic_edge23), _C_LABEL(Xrecurse_ioapic_edge23)
.long _C_LABEL(Xresume_ioapic23) .long _C_LABEL(Xresume_ioapic_edge23)
.long _C_LABEL(Xintr_ioapic24), _C_LABEL(Xrecurse_ioapic24) .long _C_LABEL(Xintr_ioapic_edge24), _C_LABEL(Xrecurse_ioapic_edge24)
.long _C_LABEL(Xresume_ioapic24) .long _C_LABEL(Xresume_ioapic_edge24)
.long _C_LABEL(Xintr_ioapic25), _C_LABEL(Xrecurse_ioapic25) .long _C_LABEL(Xintr_ioapic_edge25), _C_LABEL(Xrecurse_ioapic_edge25)
.long _C_LABEL(Xresume_ioapic25) .long _C_LABEL(Xresume_ioapic_edge25)
.long _C_LABEL(Xintr_ioapic26), _C_LABEL(Xrecurse_ioapic26) .long _C_LABEL(Xintr_ioapic_edge26), _C_LABEL(Xrecurse_ioapic_edge26)
.long _C_LABEL(Xresume_ioapic26) .long _C_LABEL(Xresume_ioapic_edge26)
.long _C_LABEL(Xintr_ioapic27), _C_LABEL(Xrecurse_ioapic27) .long _C_LABEL(Xintr_ioapic_edge27), _C_LABEL(Xrecurse_ioapic_edge27)
.long _C_LABEL(Xresume_ioapic27) .long _C_LABEL(Xresume_ioapic_edge27)
.long _C_LABEL(Xintr_ioapic28), _C_LABEL(Xrecurse_ioapic28) .long _C_LABEL(Xintr_ioapic_edge28), _C_LABEL(Xrecurse_ioapic_edge28)
.long _C_LABEL(Xresume_ioapic28) .long _C_LABEL(Xresume_ioapic_edge28)
.long _C_LABEL(Xintr_ioapic29), _C_LABEL(Xrecurse_ioapic29) .long _C_LABEL(Xintr_ioapic_edge29), _C_LABEL(Xrecurse_ioapic_edge29)
.long _C_LABEL(Xresume_ioapic29) .long _C_LABEL(Xresume_ioapic_edge29)
.long _C_LABEL(Xintr_ioapic30), _C_LABEL(Xrecurse_ioapic30) .long _C_LABEL(Xintr_ioapic_edge30), _C_LABEL(Xrecurse_ioapic_edge30)
.long _C_LABEL(Xresume_ioapic30) .long _C_LABEL(Xresume_ioapic_edge30)
.long _C_LABEL(Xintr_ioapic31), _C_LABEL(Xrecurse_ioapic31) .long _C_LABEL(Xintr_ioapic_edge31), _C_LABEL(Xrecurse_ioapic_edge31)
.long _C_LABEL(Xresume_ioapic31) .long _C_LABEL(Xresume_ioapic_edge31)
.globl _C_LABEL(ioapic_level_stubs)
_C_LABEL(ioapic_level_stubs):
.long _C_LABEL(Xintr_ioapic_level0), _C_LABEL(Xrecurse_ioapic_level0)
.long _C_LABEL(Xresume_ioapic_level0)
.long _C_LABEL(Xintr_ioapic_level1), _C_LABEL(Xrecurse_ioapic_level1)
.long _C_LABEL(Xresume_ioapic_level1)
.long _C_LABEL(Xintr_ioapic_level2), _C_LABEL(Xrecurse_ioapic_level2)
.long _C_LABEL(Xresume_ioapic_level2)
.long _C_LABEL(Xintr_ioapic_level3), _C_LABEL(Xrecurse_ioapic_level3)
.long _C_LABEL(Xresume_ioapic_level3)
.long _C_LABEL(Xintr_ioapic_level4), _C_LABEL(Xrecurse_ioapic_level4)
.long _C_LABEL(Xresume_ioapic_level4)
.long _C_LABEL(Xintr_ioapic_level5), _C_LABEL(Xrecurse_ioapic_level5)
.long _C_LABEL(Xresume_ioapic_level5)
.long _C_LABEL(Xintr_ioapic_level6), _C_LABEL(Xrecurse_ioapic_level6)
.long _C_LABEL(Xresume_ioapic_level6)
.long _C_LABEL(Xintr_ioapic_level7), _C_LABEL(Xrecurse_ioapic_level7)
.long _C_LABEL(Xresume_ioapic_level7)
.long _C_LABEL(Xintr_ioapic_level8), _C_LABEL(Xrecurse_ioapic_level8)
.long _C_LABEL(Xresume_ioapic_level8)
.long _C_LABEL(Xintr_ioapic_level9), _C_LABEL(Xrecurse_ioapic_level9)
.long _C_LABEL(Xresume_ioapic_level9)
.long _C_LABEL(Xintr_ioapic_level10), _C_LABEL(Xrecurse_ioapic_level10)
.long _C_LABEL(Xresume_ioapic_level10)
.long _C_LABEL(Xintr_ioapic_level11), _C_LABEL(Xrecurse_ioapic_level11)
.long _C_LABEL(Xresume_ioapic_level11)
.long _C_LABEL(Xintr_ioapic_level12), _C_LABEL(Xrecurse_ioapic_level12)
.long _C_LABEL(Xresume_ioapic_level12)
.long _C_LABEL(Xintr_ioapic_level13), _C_LABEL(Xrecurse_ioapic_level13)
.long _C_LABEL(Xresume_ioapic_level13)
.long _C_LABEL(Xintr_ioapic_level14), _C_LABEL(Xrecurse_ioapic_level14)
.long _C_LABEL(Xresume_ioapic_level14)
.long _C_LABEL(Xintr_ioapic_level15), _C_LABEL(Xrecurse_ioapic_level15)
.long _C_LABEL(Xresume_ioapic_level15)
.long _C_LABEL(Xintr_ioapic_level16), _C_LABEL(Xrecurse_ioapic_level16)
.long _C_LABEL(Xresume_ioapic_level16)
.long _C_LABEL(Xintr_ioapic_level17), _C_LABEL(Xrecurse_ioapic_level17)
.long _C_LABEL(Xresume_ioapic_level17)
.long _C_LABEL(Xintr_ioapic_level18), _C_LABEL(Xrecurse_ioapic_level18)
.long _C_LABEL(Xresume_ioapic_level18)
.long _C_LABEL(Xintr_ioapic_level19), _C_LABEL(Xrecurse_ioapic_level19)
.long _C_LABEL(Xresume_ioapic_level19)
.long _C_LABEL(Xintr_ioapic_level20), _C_LABEL(Xrecurse_ioapic_level20)
.long _C_LABEL(Xresume_ioapic_level20)
.long _C_LABEL(Xintr_ioapic_level21), _C_LABEL(Xrecurse_ioapic_level21)
.long _C_LABEL(Xresume_ioapic_level21)
.long _C_LABEL(Xintr_ioapic_level22), _C_LABEL(Xrecurse_ioapic_level22)
.long _C_LABEL(Xresume_ioapic_level22)
.long _C_LABEL(Xintr_ioapic_level23), _C_LABEL(Xrecurse_ioapic_level23)
.long _C_LABEL(Xresume_ioapic_level23)
.long _C_LABEL(Xintr_ioapic_level24), _C_LABEL(Xrecurse_ioapic_level24)
.long _C_LABEL(Xresume_ioapic_level24)
.long _C_LABEL(Xintr_ioapic_level25), _C_LABEL(Xrecurse_ioapic_level25)
.long _C_LABEL(Xresume_ioapic_level25)
.long _C_LABEL(Xintr_ioapic_level26), _C_LABEL(Xrecurse_ioapic_level26)
.long _C_LABEL(Xresume_ioapic_level26)
.long _C_LABEL(Xintr_ioapic_level27), _C_LABEL(Xrecurse_ioapic_level27)
.long _C_LABEL(Xresume_ioapic_level27)
.long _C_LABEL(Xintr_ioapic_level28), _C_LABEL(Xrecurse_ioapic_level28)
.long _C_LABEL(Xresume_ioapic_level28)
.long _C_LABEL(Xintr_ioapic_level29), _C_LABEL(Xrecurse_ioapic_level29)
.long _C_LABEL(Xresume_ioapic_level29)
.long _C_LABEL(Xintr_ioapic_level30), _C_LABEL(Xrecurse_ioapic_level30)
.long _C_LABEL(Xresume_ioapic_level30)
.long _C_LABEL(Xintr_ioapic_level31), _C_LABEL(Xrecurse_ioapic_level31)
.long _C_LABEL(Xresume_ioapic_level31)
#endif #endif
/* /*

View File

@ -1,6 +1,63 @@
/* $NetBSD: i82093reg.h,v 1.4 2003/02/26 21:29:00 fvdl Exp $ */ /* $NetBSD: i82093reg.h,v 1.5 2003/05/04 22:01:58 fvdl Exp $ */
#include <x86/i82093reg.h> #include <x86/i82093reg.h>
#ifdef _KERNEL
#if defined(_KERNEL_OPT)
#include "opt_multiprocessor.h"
#endif
#define ioapic_asm_ack(num) \ #define ioapic_asm_ack(num) \
movl $0,_C_LABEL(local_apic)+LAPIC_EOI movl $0,_C_LABEL(local_apic)+LAPIC_EOI
#ifdef MULTIPROCESSOR
#define ioapic_asm_lock(num) \
movl $1,%esi ;\
77: \
xchgl %esi,PIC_LOCK(%edi) ;\
testl %esi,%esi ;\
jne 77b
#define ioapic_asm_unlock(num) \
movl $0,PIC_LOCK(%edi)
#else
#define ioapic_asm_lock(num)
#define ioapic_asm_unlock(num)
#endif /* MULTIPROCESSOR */
#define ioapic_mask(num) \
movl IS_PIC(%ebp),%edi ;\
ioapic_asm_lock(num) ;\
movl IS_PIN(%ebp),%esi ;\
leal 0x10(%esi,%esi,1),%esi ;\
movl IOAPIC_SC_REG(%edi),%ebx ;\
movl %esi, (%ebx) ;\
movl IOAPIC_SC_DATA(%edi),%ebx ;\
movl (%ebx),%esi ;\
orl $IOAPIC_REDLO_MASK,%esi ;\
movl %esi,(%ebx) ;\
ioapic_asm_unlock(num)
#define ioapic_unmask(num) \
cmpl $IREENT_MAGIC,(TF_ERR+4)(%esp) ;\
jne 79f ;\
movl IS_PIC(%ebp),%edi ;\
ioapic_asm_lock(num) ;\
movl IS_PIN(%ebp),%esi ;\
leal 0x10(%esi,%esi,1),%esi ;\
movl IOAPIC_SC_REG(%edi),%ebx ;\
movl %esi, (%ebx) ;\
movl IOAPIC_SC_DATA(%edi),%ebx ;\
movl (%ebx),%esi ;\
andl $~IOAPIC_REDLO_MASK,%esi ;\
movl %esi,(%ebx) ;\
ioapic_asm_unlock(num) ;\
79:
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: i8259.h,v 1.2 2003/03/03 22:17:15 fvdl Exp $ */ /* $NetBSD: i8259.h,v 1.3 2003/05/04 22:01:56 fvdl Exp $ */
/*- /*-
* Copyright (c) 1990 The Regents of the University of California. * Copyright (c) 1990 The Regents of the University of California.
@ -134,13 +134,11 @@ extern void i8259_reinit(void);
MASKDELAY ;\ MASKDELAY ;\
outb %al,$(ICUADDR+1) outb %al,$(ICUADDR+1)
#define i8259_asm_unmask(num) \ #define i8259_asm_unmask(num) \
cli ;\
movb CVAROFF(i8259_imen, IRQ_BYTE(num)),%al ;\ movb CVAROFF(i8259_imen, IRQ_BYTE(num)),%al ;\
andb $~IRQ_BIT(num),%al ;\ andb $~IRQ_BIT(num),%al ;\
movb %al,CVAROFF(i8259_imen, IRQ_BYTE(num)) ;\ movb %al,CVAROFF(i8259_imen, IRQ_BYTE(num)) ;\
MASKDELAY ;\ MASKDELAY ;\
outb %al,$(ICUADDR+1) ;\ outb %al,$(ICUADDR+1)
sti
#else /* ICU_HARDWARE_MASK */ #else /* ICU_HARDWARE_MASK */

View File

@ -1,4 +1,4 @@
/* $NetBSD: intr.h,v 1.1 2003/02/26 21:26:10 fvdl Exp $ */ /* $NetBSD: intr.h,v 1.2 2003/05/04 22:01:56 fvdl Exp $ */
/*- /*-
* Copyright (c) 1998, 2001 The NetBSD Foundation, Inc. * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@ -234,7 +234,8 @@ extern void Xsoftnet(void);
extern void Xsoftserial(void); extern void Xsoftserial(void);
extern struct intrstub i8259_stubs[]; extern struct intrstub i8259_stubs[];
extern struct intrstub ioapic_stubs[]; extern struct intrstub ioapic_edge_stubs[];
extern struct intrstub ioapic_level_stubs[];
struct cpu_info; struct cpu_info;

View File

@ -1,4 +1,4 @@
/* $NetBSD: intrdefs.h,v 1.1 2003/02/26 21:26:10 fvdl Exp $ */ /* $NetBSD: intrdefs.h,v 1.2 2003/05/04 22:01:56 fvdl Exp $ */
#ifndef _i386_INTRDEFS_H #ifndef _i386_INTRDEFS_H
#define _i386_INTRDEFS_H #define _i386_INTRDEFS_H
@ -86,4 +86,6 @@
"FPU synch IPI", "TLB shootdown IPI", \ "FPU synch IPI", "TLB shootdown IPI", \
"MTRR update IPI", "GDT update IPI" } "MTRR update IPI", "GDT update IPI" }
#define IREENT_MAGIC 0x18041969
#endif /* _X86_INTRDEFS_H */ #endif /* _X86_INTRDEFS_H */

View File

@ -1,4 +1,4 @@
/* $NetBSD: ioapic.c,v 1.3 2003/04/01 15:09:55 thorpej Exp $ */ /* $NetBSD: ioapic.c,v 1.4 2003/05/04 22:01:57 fvdl Exp $ */
/*- /*-
* Copyright (c) 2000 The NetBSD Foundation, Inc. * Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -302,8 +302,8 @@ ioapic_attach(struct device *parent, struct device *self, void *aux)
sc->sc_pic.pic_hwunmask = ioapic_hwunmask; sc->sc_pic.pic_hwunmask = ioapic_hwunmask;
sc->sc_pic.pic_addroute = ioapic_addroute; sc->sc_pic.pic_addroute = ioapic_addroute;
sc->sc_pic.pic_delroute = ioapic_delroute; sc->sc_pic.pic_delroute = ioapic_delroute;
sc->sc_pic.pic_edge_stubs = ioapic_stubs; sc->sc_pic.pic_edge_stubs = ioapic_edge_stubs;
sc->sc_pic.pic_level_stubs = ioapic_stubs; sc->sc_pic.pic_level_stubs = ioapic_level_stubs;
apic_id = (ioapic_read(sc,IOAPIC_ID)&IOAPIC_ID_MASK)>>IOAPIC_ID_SHIFT; apic_id = (ioapic_read(sc,IOAPIC_ID)&IOAPIC_ID_MASK)>>IOAPIC_ID_SHIFT;
ver_sz = ioapic_read(sc, IOAPIC_VER); ver_sz = ioapic_read(sc, IOAPIC_VER);