summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2000-12-06 01:04:02 +0000
committerpeter <peter@FreeBSD.org>2000-12-06 01:04:02 +0000
commit92c9bab52b5aedd40f49ab45b2450cc7dd98e2f4 (patch)
tree91f7166df6c04e0df7c1cbcceafe84b1a9a11faf /sys
parent5e456a15ec12de9e79220564cda4fcce69219d2f (diff)
downloadFreeBSD-src-92c9bab52b5aedd40f49ab45b2450cc7dd98e2f4.zip
FreeBSD-src-92c9bab52b5aedd40f49ab45b2450cc7dd98e2f4.tar.gz
Move io_apic_{read,write} from apic_ipl.s (where they do not belong) into
mpapic.c. This gives us the benefit of C type checking. These functions are not called in any critical paths and are not used by the interrupt routines.
Diffstat (limited to 'sys')
-rw-r--r--sys/amd64/include/smp.h7
-rw-r--r--sys/i386/i386/mpapic.c23
-rw-r--r--sys/i386/include/smp.h7
-rw-r--r--sys/i386/isa/apic_ipl.s29
-rw-r--r--sys/sys/smp.h7
5 files changed, 32 insertions, 41 deletions
diff --git a/sys/amd64/include/smp.h b/sys/amd64/include/smp.h
index b2df060..0ff53bd 100644
--- a/sys/amd64/include/smp.h
+++ b/sys/amd64/include/smp.h
@@ -58,10 +58,6 @@ extern volatile u_int checkstate_need_ast;
extern volatile u_int resched_cpus;
extern void (*cpustop_restartfunc) __P((void));
-/* functions in apic_ipl.s */
-u_int io_apic_read __P((int, int));
-void io_apic_write __P((int, int, u_int));
-
/* global data in mp_machdep.c */
extern int bsp_apic_ready;
extern int mp_ncpus;
@@ -146,6 +142,9 @@ int ext_int_setup __P((int, int));
void set_apic_timer __P((int));
int read_apic_timer __P((void));
void u_sleep __P((int));
+u_int io_apic_read __P((int, int));
+void io_apic_write __P((int, int, u_int));
+
/* global data in init_smp.c */
extern int invltlb_ok;
diff --git a/sys/i386/i386/mpapic.c b/sys/i386/i386/mpapic.c
index 67297ba..8b706c0 100644
--- a/sys/i386/i386/mpapic.c
+++ b/sys/i386/i386/mpapic.c
@@ -758,3 +758,26 @@ u_sleep(int count)
while (read_apic_timer())
/* spin */ ;
}
+
+/*
+ * IOAPIC access helper functions.
+ */
+u_int
+io_apic_read(int idx, int reg)
+{
+ volatile ioapic_t *apic;
+
+ apic = ioapic[idx];
+ apic->ioregsel = reg;
+ return apic->iowin;
+}
+
+void
+io_apic_write(int idx, int reg, u_int value)
+{
+ volatile ioapic_t *apic;
+
+ apic = ioapic[idx];
+ apic->ioregsel = reg;
+ apic->iowin = value;
+}
diff --git a/sys/i386/include/smp.h b/sys/i386/include/smp.h
index b2df060..0ff53bd 100644
--- a/sys/i386/include/smp.h
+++ b/sys/i386/include/smp.h
@@ -58,10 +58,6 @@ extern volatile u_int checkstate_need_ast;
extern volatile u_int resched_cpus;
extern void (*cpustop_restartfunc) __P((void));
-/* functions in apic_ipl.s */
-u_int io_apic_read __P((int, int));
-void io_apic_write __P((int, int, u_int));
-
/* global data in mp_machdep.c */
extern int bsp_apic_ready;
extern int mp_ncpus;
@@ -146,6 +142,9 @@ int ext_int_setup __P((int, int));
void set_apic_timer __P((int));
int read_apic_timer __P((void));
void u_sleep __P((int));
+u_int io_apic_read __P((int, int));
+void io_apic_write __P((int, int, u_int));
+
/* global data in init_smp.c */
extern int invltlb_ok;
diff --git a/sys/i386/isa/apic_ipl.s b/sys/i386/isa/apic_ipl.s
index 774883b..5abd500 100644
--- a/sys/i386/isa/apic_ipl.s
+++ b/sys/i386/isa/apic_ipl.s
@@ -130,32 +130,3 @@ ENTRY(INTRDIS)
IMASK_UNLOCK /* exit critical reg */
popfl /* restore old state of EI flag */
ret
-
-/******************************************************************************
- *
- */
-
-/*
- * u_int io_apic_write(int apic, int select);
- */
-ENTRY(io_apic_read)
- movl 4(%esp), %ecx /* APIC # */
- movl _ioapic, %eax
- movl (%eax,%ecx,4), %edx /* APIC base register address */
- movl 8(%esp), %eax /* target register index */
- movl %eax, (%edx) /* write the target register index */
- movl 16(%edx), %eax /* read the APIC register data */
- ret /* %eax = register value */
-
-/*
- * void io_apic_write(int apic, int select, int value);
- */
-ENTRY(io_apic_write)
- movl 4(%esp), %ecx /* APIC # */
- movl _ioapic, %eax
- movl (%eax,%ecx,4), %edx /* APIC base register address */
- movl 8(%esp), %eax /* target register index */
- movl %eax, (%edx) /* write the target register index */
- movl 12(%esp), %eax /* target register value */
- movl %eax, 16(%edx) /* write the APIC register data */
- ret /* %eax = void */
diff --git a/sys/sys/smp.h b/sys/sys/smp.h
index b2df060..0ff53bd 100644
--- a/sys/sys/smp.h
+++ b/sys/sys/smp.h
@@ -58,10 +58,6 @@ extern volatile u_int checkstate_need_ast;
extern volatile u_int resched_cpus;
extern void (*cpustop_restartfunc) __P((void));
-/* functions in apic_ipl.s */
-u_int io_apic_read __P((int, int));
-void io_apic_write __P((int, int, u_int));
-
/* global data in mp_machdep.c */
extern int bsp_apic_ready;
extern int mp_ncpus;
@@ -146,6 +142,9 @@ int ext_int_setup __P((int, int));
void set_apic_timer __P((int));
int read_apic_timer __P((void));
void u_sleep __P((int));
+u_int io_apic_read __P((int, int));
+void io_apic_write __P((int, int, u_int));
+
/* global data in init_smp.c */
extern int invltlb_ok;
OpenPOWER on IntegriCloud