i386 - Get completely rid of APIC_IO
[dragonfly.git] / sys / platform / pc32 / icu / icu_ipl.s
CommitLineData
8c10bfcf
MD
1/*
2 * Copyright (c) 2003,2004 The DragonFly Project. All rights reserved.
3 *
4 * This code is derived from software contributed to The DragonFly Project
5 * by Matthew Dillon <dillon@backplane.com>
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
16 * distribution.
17 * 3. Neither the name of The DragonFly Project nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific, prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
31 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
984263bc
MD
34 * Copyright (c) 1989, 1990 William F. Jolitz.
35 * Copyright (c) 1990 The Regents of the University of California.
36 * All rights reserved.
37 *
38 * This code is derived from software contributed to Berkeley by
39 * William Jolitz.
40 *
41 * Redistribution and use in source and binary forms, with or without
42 * modification, are permitted provided that the following conditions
43 * are met:
44 * 1. Redistributions of source code must retain the above copyright
45 * notice, this list of conditions and the following disclaimer.
46 * 2. Redistributions in binary form must reproduce the above copyright
47 * notice, this list of conditions and the following disclaimer in the
48 * documentation and/or other materials provided with the distribution.
49 * 3. All advertising materials mentioning features or use of this software
50 * must display the following acknowledgement:
51 * This product includes software developed by the University of
52 * California, Berkeley and its contributors.
53 * 4. Neither the name of the University nor the names of its contributors
54 * may be used to endorse or promote products derived from this software
55 * without specific prior written permission.
56 *
57 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
58 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
59 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
60 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
61 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
62 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
63 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
64 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
65 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
66 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
67 * SUCH DAMAGE.
68 *
69 * $FreeBSD: src/sys/i386/isa/icu_ipl.s,v 1.6 1999/08/28 00:44:42 peter Exp $
78d2573f 70 * $DragonFly: src/sys/platform/pc32/icu/icu_ipl.s,v 1.18 2007/07/07 12:25:26 sephe Exp $
984263bc
MD
71 */
72
06f5be02
MD
73#include "use_npx.h"
74
75#include <machine/asmacros.h>
76#include <machine/segments.h>
06f5be02
MD
77#include <machine/lock.h>
78#include <machine/psl.h>
79#include <machine/trap.h>
06f5be02 80
f8334305 81#include <bus/isa/isareg.h>
06f5be02 82#include "assym.s"
a7231bde 83#include "icu_ipl.h"
06f5be02 84
97359a5b
MD
85/*
86 * WARNING! SMP builds can use the ICU now so this code must be MP safe.
87 */
88
984263bc
MD
89 .data
90 ALIGN_DATA
984263bc 91
ef0fdad1
MD
92 /*
93 * Interrupt mask for ICU interrupts, defaults to all hardware
94 * interrupts turned off.
95 */
72740893
MD
96 .p2align 2 /* MUST be 32bit aligned */
97
06f5be02
MD
98 .globl icu_imen
99icu_imen:
5f456c40 100 .long ICU_HWI_MASK
984263bc 101
984263bc
MD
102 .text
103 SUPERALIGN_TEXT
104
984263bc 105 /*
ef0fdad1
MD
106 * Functions to enable and disable a hardware interrupt. Only
107 * 16 ICU interrupts exist.
108 *
df308fcd 109 * INTREN(irq)
78d2573f 110 * INTRDIS(irq)
984263bc 111 */
37e7efec 112ENTRY(ICU_INTRDIS)
97359a5b 113 ICU_IMASK_LOCK
ef0fdad1 114 movl 4(%esp),%eax
df308fcd 115 btsl %eax,icu_imen
06f5be02 116 movl icu_imen,%eax
ef0fdad1
MD
117 outb %al,$IO_ICU1+ICU_IMR_OFFSET
118 mov %ah,%al
119 outb %al,$IO_ICU2+ICU_IMR_OFFSET
97359a5b 120 ICU_IMASK_UNLOCK
ef0fdad1 121 ret
984263bc 122
37e7efec 123ENTRY(ICU_INTREN)
97359a5b 124 ICU_IMASK_LOCK
ef0fdad1 125 movl 4(%esp),%eax
df308fcd 126 btrl %eax,icu_imen
06f5be02 127 movl icu_imen,%eax
ef0fdad1
MD
128 outb %al,$IO_ICU1+ICU_IMR_OFFSET
129 mov %ah,%al
130 outb %al,$IO_ICU2+ICU_IMR_OFFSET
97359a5b 131 ICU_IMASK_UNLOCK
984263bc 132 ret