2 * Copyright (c) 1997, by Steve Passe
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. The name of the developer may NOT be used to endorse or promote products
11 * derived from this software without specific prior written permission.
13 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * This is the UP equivilant of _imen.
34 * It is OPAQUE, and must NOT be accessed directly.
35 * It MUST be accessed along with the IO APIC as a 'critical region'.
41 .p2align 2 /* MUST be 32bit aligned */
49 /******************************************************************************
50 * XXX FIXME: figure out where these belong.
53 /* this nonsense is to verify that masks ALWAYS have 1 and only 1 bit set */
54 #define QUALIFY_MASKS_NOT
57 #define QUALIFY_MASK \
65 bad_mask: .asciz "bad mask"
71 * (soon to be) MP-safe function to clear ONE INT mask bit.
72 * The passed arg is a 32bit u_int MASK.
73 * It sets the associated bit in _apic_imen.
74 * It sets the mask bit of the associated IO APIC register.
77 pushfl /* save state of EI flag */
78 cli /* prevent recursion */
79 IMASK_LOCK /* enter critical reg */
81 movl 8(%esp), %eax /* mask into %eax */
82 bsfl %eax, %ecx /* get pin index */
83 btrl %ecx, apic_imen /* update apic_imen */
88 movl CNAME(int_to_apicintpin) + 8(%ecx), %edx
89 movl CNAME(int_to_apicintpin) + 12(%ecx), %ecx
93 movl %ecx, (%edx) /* write the target register index */
94 movl 16(%edx), %eax /* read the target register data */
95 andl $~IOART_INTMASK, %eax /* clear mask bit */
96 movl %eax, 16(%edx) /* write the APIC register data */
98 IMASK_UNLOCK /* exit critical reg */
99 popfl /* restore old state of EI flag */
103 * (soon to be) MP-safe function to set ONE INT mask bit.
104 * The passed arg is a 32bit u_int MASK.
105 * It clears the associated bit in _apic_imen.
106 * It clears the mask bit of the associated IO APIC register.
109 pushfl /* save state of EI flag */
110 cli /* prevent recursion */
111 IMASK_LOCK /* enter critical reg */
113 movl 8(%esp), %eax /* mask into %eax */
114 bsfl %eax, %ecx /* get pin index */
115 btsl %ecx, apic_imen /* update apic_imen */
120 movl CNAME(int_to_apicintpin) + 8(%ecx), %edx
121 movl CNAME(int_to_apicintpin) + 12(%ecx), %ecx
125 movl %ecx, (%edx) /* write the target register index */
126 movl 16(%edx), %eax /* read the target register data */
127 orl $IOART_INTMASK, %eax /* set mask bit */
128 movl %eax, 16(%edx) /* write the APIC register data */
130 IMASK_UNLOCK /* exit critical reg */
131 popfl /* restore old state of EI flag */