Home | History | Annotate | Line # | Download | only in include
i82093reg.h revision 1.8.68.1
      1 /*	 $NetBSD: i82093reg.h,v 1.8.68.1 2018/01/03 19:58:12 snj Exp $ */
      2 
      3 #include <x86/i82093reg.h>
      4 
      5 #ifdef _KERNEL
      6 
      7 #if defined(_KERNEL_OPT)
      8 #include "opt_multiprocessor.h"
      9 #endif
     10 
     11 #define ioapic_asm_ack(num) \
     12 	movl	$0,_C_LABEL(local_apic)+LAPIC_EOI
     13 
     14 #ifdef MULTIPROCESSOR
     15 
     16 #define ioapic_asm_lock(num) \
     17 	movl	$1,%esi						;\
     18 77:								\
     19 	xchgl	%esi,PIC_LOCK(%edi)				;\
     20 	testl	%esi,%esi					;\
     21 	jne	77b
     22 
     23 #define ioapic_asm_unlock(num) \
     24 	movl	$0,PIC_LOCK(%edi)
     25 
     26 #else
     27 
     28 #define ioapic_asm_lock(num)
     29 #define ioapic_asm_unlock(num)
     30 
     31 #endif	/* MULTIPROCESSOR */
     32 
     33 #define ioapic_mask(num) \
     34 	movl	IS_PIC(%ebp),%edi				;\
     35 	ioapic_asm_lock(num)					;\
     36 	movl	IS_PIN(%ebp),%esi				;\
     37 	leal	0x10(%esi,%esi,1),%esi				;\
     38 	movl	PIC_IOAPIC(%edi),%edi				;\
     39 	movl	IOAPIC_SC_REG(%edi),%ebx			;\
     40 	movl	%esi, (%ebx)					;\
     41 	movl	IOAPIC_SC_DATA(%edi),%ebx			;\
     42 	movl	(%ebx),%esi					;\
     43 	orl	$IOAPIC_REDLO_MASK,%esi				;\
     44 	andl	$~IOAPIC_REDLO_RIRR,%esi			;\
     45 	movl	%esi,(%ebx)					;\
     46 	movl	IS_PIC(%ebp),%edi				;\
     47 	ioapic_asm_unlock(num)
     48 
     49 /*
     50  * Since this is called just before the interrupt stub exits, AND
     51  * because the apic ACK doesn't use any registers, all registers
     52  * can be used here.
     53  * XXX this is not obvious
     54  */
     55 #define ioapic_unmask(num) \
     56 	movl    (%esp),%eax					;\
     57 	cmpl    $IREENT_MAGIC,(TF_ERR+4)(%eax)			;\
     58 	jne     79f						;\
     59 	movl	IS_PIC(%ebp),%edi				;\
     60 	ioapic_asm_lock(num)					;\
     61 	movl	IS_PIN(%ebp),%esi				;\
     62 	leal	0x10(%esi,%esi,1),%esi				;\
     63 	movl	PIC_IOAPIC(%edi),%edi				;\
     64 	movl	IOAPIC_SC_REG(%edi),%ebx			;\
     65 	movl	IOAPIC_SC_DATA(%edi),%eax			;\
     66 	movl	%esi, (%ebx)					;\
     67 	movl	(%eax),%edx					;\
     68 	andl	$~(IOAPIC_REDLO_MASK|IOAPIC_REDLO_RIRR),%edx	;\
     69 	movl	%esi, (%ebx)					;\
     70 	movl	%edx,(%eax)					;\
     71 	movl	IS_PIC(%ebp),%edi				;\
     72 	ioapic_asm_unlock(num)					;\
     73 79:
     74 
     75 #endif
     76