From 61452645d3f99a146c86b5d16370d59041315db9 Mon Sep 17 00:00:00 2001 From: Sepherosa Ziehau Date: Wed, 4 May 2011 17:04:43 +0800 Subject: [PATCH] x86_64: Move ioapic function declarations from smp.h to apic/ioapic.h --- sys/platform/pc64/acpica5/acpi_madt.c | 1 + sys/platform/pc64/apic/ioapic.c | 1 + sys/platform/pc64/apic/ioapic.h | 66 +++++++++++++++++++++++++++ sys/platform/pc64/apic/ioapic_abi.c | 3 +- sys/platform/pc64/include/smp.h | 35 -------------- sys/platform/pc64/x86_64/mp_machdep.c | 1 + 6 files changed, 71 insertions(+), 36 deletions(-) create mode 100644 sys/platform/pc64/apic/ioapic.h diff --git a/sys/platform/pc64/acpica5/acpi_madt.c b/sys/platform/pc64/acpica5/acpi_madt.c index 18e9d305c0..ed323ad86c 100644 --- a/sys/platform/pc64/acpica5/acpi_madt.c +++ b/sys/platform/pc64/acpica5/acpi_madt.c @@ -42,6 +42,7 @@ #include #include #include +#include #include "acpi_sdt.h" #include "acpi_sdt_var.h" diff --git a/sys/platform/pc64/apic/ioapic.c b/sys/platform/pc64/apic/ioapic.c index c78a0e1d45..a6a0df545a 100644 --- a/sys/platform/pc64/apic/ioapic.c +++ b/sys/platform/pc64/apic/ioapic.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include diff --git a/sys/platform/pc64/apic/ioapic.h b/sys/platform/pc64/apic/ioapic.h new file mode 100644 index 0000000000..5b263656f7 --- /dev/null +++ b/sys/platform/pc64/apic/ioapic.h @@ -0,0 +1,66 @@ +/* + * Copyright (c) 1996, by Steve Passe + * Copyright (c) 2008 The DragonFly Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. The name of the developer may NOT be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/sys/i386/include/mpapic.h,v 1.14.2.2 2000/09/30 02:49:34 ps Exp $ + * $DragonFly: src/sys/platform/pc64/apic/mpapic.h,v 1.1 2008/08/29 17:07:12 dillon Exp $ + */ + +#ifndef _ARCH_APIC_IOAPIC_H_ +#define _ARCH_APIC_IOAPIC_H_ + +#ifndef _SYS_BUS_H_ +#include +#endif + +#ifndef _SYS_QUEUE_H_ +#include +#endif + +u_int ioapic_read(volatile void *, int); +void ioapic_write(volatile void *, int, u_int); + +struct ioapic_enumerator { + int ioapic_prio; + TAILQ_ENTRY(ioapic_enumerator) ioapic_link; + int (*ioapic_probe)(struct ioapic_enumerator *); + void (*ioapic_enumerate)(struct ioapic_enumerator *); +}; + +#define IOAPIC_ENUM_PRIO_MPTABLE 20 +#define IOAPIC_ENUM_PRIO_MADT 40 + +void ioapic_config(void); +void ioapic_enumerator_register(struct ioapic_enumerator *); +void ioapic_add(void *, int, int); +void ioapic_intsrc(int, int, enum intr_trigger, enum intr_polarity); +void *ioapic_gsi_ioaddr(int); +int ioapic_gsi_pin(int); +void ioapic_pin_setup(void *, int, int, + enum intr_trigger, enum intr_polarity); +void ioapic_extpin_setup(void *, int, int); +int ioapic_extpin_gsi(void); +int ioapic_gsi(int, int); + +#endif /* !_ARCH_APIC_IOAPIC_H_ */ diff --git a/sys/platform/pc64/apic/ioapic_abi.c b/sys/platform/pc64/apic/ioapic_abi.c index f596e90003..16903b3870 100644 --- a/sys/platform/pc64/apic/ioapic_abi.c +++ b/sys/platform/pc64/apic/ioapic_abi.c @@ -51,12 +51,13 @@ #include #include #include -#include #include #include +#include #include +#include #include #include diff --git a/sys/platform/pc64/include/smp.h b/sys/platform/pc64/include/smp.h index 4c111b3169..0c94eab960 100644 --- a/sys/platform/pc64/include/smp.h +++ b/sys/platform/pc64/include/smp.h @@ -66,10 +66,6 @@ extern volatile cpumask_t started_cpus; extern volatile u_int checkstate_probed_cpus; extern void (*cpustop_restartfunc) (void); -/* functions in apic_ipl.s */ -u_int ioapic_read (volatile void *, int); -void ioapic_write (volatile void *, int, u_int); - /* global data in mp_machdep.c */ extern int imcr_present; extern int apic_io_enable; @@ -114,37 +110,6 @@ void forward_signal (struct proc *); int mptable_pci_int_route(int, int, int, int); void mptable_pci_int_dump(void); -#ifndef _SYS_QUEUE_H_ -#include -#endif - -struct ioapic_enumerator { - int ioapic_prio; - TAILQ_ENTRY(ioapic_enumerator) ioapic_link; - int (*ioapic_probe)(struct ioapic_enumerator *); - void (*ioapic_enumerate)(struct ioapic_enumerator *); -}; - -#define IOAPIC_ENUM_PRIO_MPTABLE 20 -#define IOAPIC_ENUM_PRIO_MADT 40 - -#ifndef _SYS_BUS_H_ -#include -#endif - -/* functions in mpapic.c */ -void ioapic_config(void); -void ioapic_enumerator_register(struct ioapic_enumerator *); -void ioapic_add(void *, int, int); -void ioapic_intsrc(int, int, enum intr_trigger, enum intr_polarity); -void *ioapic_gsi_ioaddr(int); -int ioapic_gsi_pin(int); -void ioapic_pin_setup(void *, int, int, - enum intr_trigger, enum intr_polarity); -void ioapic_extpin_setup(void *, int, int); -int ioapic_extpin_gsi(void); -int ioapic_gsi(int, int); - #if defined(READY) void clr_io_apic_mask24 (int, u_int32_t); void set_io_apic_mask24 (int, u_int32_t); diff --git a/sys/platform/pc64/x86_64/mp_machdep.c b/sys/platform/pc64/x86_64/mp_machdep.c index 8a2a2c56f1..3a1b82c1bb 100644 --- a/sys/platform/pc64/x86_64/mp_machdep.c +++ b/sys/platform/pc64/x86_64/mp_machdep.c @@ -55,6 +55,7 @@ #include #include #include +#include #include #include #include -- 2.41.0