From 92c9bab52b5aedd40f49ab45b2450cc7dd98e2f4 Mon Sep 17 00:00:00 2001 From: peter Date: Wed, 6 Dec 2000 01:04:02 +0000 Subject: 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. --- sys/i386/i386/mpapic.c | 23 +++++++++++++++++++++++ sys/i386/include/smp.h | 7 +++---- sys/i386/isa/apic_ipl.s | 29 ----------------------------- 3 files changed, 26 insertions(+), 33 deletions(-) (limited to 'sys/i386') 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 */ -- cgit v1.1