diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2009-08-13 15:33:21 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2009-08-13 15:33:21 +0000 |
commit | 171fd2dccafa9efa9c30f426768f80c9bea4ccf6 (patch) | |
tree | 80bcdc68861b69ebbe83c442e492ee86bcd72091 /sys | |
parent | 71e437cadd861881dc7988b3b70ac86d3ce213f0 (diff) |
Cleanup differences between i386 and amd64.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/amd64/amd64/acpi_machdep.c | 27 | ||||
-rw-r--r-- | sys/arch/i386/i386/acpi_machdep.c | 23 |
2 files changed, 29 insertions, 21 deletions
diff --git a/sys/arch/amd64/amd64/acpi_machdep.c b/sys/arch/amd64/amd64/acpi_machdep.c index 8bab06fc5c2..da27272e280 100644 --- a/sys/arch/amd64/amd64/acpi_machdep.c +++ b/sys/arch/amd64/amd64/acpi_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpi_machdep.c,v 1.21 2009/06/06 00:23:38 mlarkin Exp $ */ +/* $OpenBSD: acpi_machdep.c,v 1.22 2009/08/13 15:33:20 kettenis Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com> * @@ -27,6 +27,8 @@ #include <machine/biosvar.h> #include <machine/isa_machdep.h> +#include <machine/cpufunc.h> + #include <dev/isa/isareg.h> #include <dev/acpi/acpireg.h> #include <dev/acpi/acpivar.h> @@ -35,6 +37,10 @@ #include "ioapic.h" #include "lapic.h" +#if NIOAPIC > 0 +#include <machine/i82093var.h> +#endif + #if NLAPIC > 0 #include <machine/apicvar.h> #include <machine/i82489reg.h> @@ -46,7 +52,6 @@ extern u_int32_t acpi_pdirpa; extern paddr_t tramp_pdirpa; extern int acpi_savecpu(void); -extern void ioapic_enable(void); #define ACPI_BIOS_RSDP_WINDOW_BASE 0xe0000 #define ACPI_BIOS_RSDP_WINDOW_SIZE 0x20000 @@ -115,7 +120,8 @@ acpi_scan(struct acpi_mem_map *handle, paddr_t pa, size_t len) } int -acpi_probe(struct device *parent, struct cfdata *match, struct bios_attach_args *ba) +acpi_probe(struct device *parent, struct cfdata *match, + struct bios_attach_args *ba) { struct acpi_mem_map handle; u_int8_t *ptr; @@ -155,6 +161,7 @@ havebase: } #ifndef SMALL_KERNEL + void acpi_attach_machdep(struct acpi_softc *sc) { @@ -165,19 +172,16 @@ acpi_attach_machdep(struct acpi_softc *sc) cpuresetfn = acpi_reset; #ifdef ACPI_SLEEP_ENABLED - /* * Sanity check before setting up trampoline. * Ensure the trampoline size is < PAGE_SIZE */ KASSERT(acpi_resume_end - acpi_real_mode_resume < PAGE_SIZE); - bcopy(acpi_real_mode_resume, - (caddr_t)ACPI_TRAMPOLINE, + bcopy(acpi_real_mode_resume, (caddr_t)ACPI_TRAMPOLINE, acpi_resume_end - acpi_real_mode_resume); acpi_pdirpa = tramp_pdirpa; - #endif /* ACPI_SLEEP_ENABLED */ } @@ -190,11 +194,11 @@ acpi_cpu_flush(struct acpi_softc *sc, int state) if (state > ACPI_STATE_S1) wbinvd(); } + int acpi_sleep_machdep(struct acpi_softc *sc, int state) { #ifdef ACPI_SLEEP_ENABLED - if (sc->sc_facs == NULL) { printf("%s: acpi_sleep_machdep: no FACS\n", DEVNAME(sc)); return (ENXIO); @@ -202,7 +206,7 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state) if (rcr3() != pmap_kernel()->pm_pdirpa) { pmap_activate(curproc); - + KASSERT(rcr3() == pmap_kernel()->pm_pdirpa); } @@ -218,7 +222,6 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state) * containing protected-mode wakeup code. * */ - sc->sc_facs->wakeup_vector = (u_int32_t)ACPI_TRAMPOLINE; if (sc->sc_facs->version == 1) sc->sc_facs->x_wakeup_vector = 0; @@ -249,8 +252,8 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state) initrtclock(); inittodr(time_second); #endif /* ACPI_SLEEP_ENABLED */ - return 0; - } + return (0); +} #endif /* ! SMALL_KERNEL */ diff --git a/sys/arch/i386/i386/acpi_machdep.c b/sys/arch/i386/i386/acpi_machdep.c index 9f3bc4480ce..c50210dc896 100644 --- a/sys/arch/i386/i386/acpi_machdep.c +++ b/sys/arch/i386/i386/acpi_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpi_machdep.c,v 1.22 2009/06/07 16:58:28 mlarkin Exp $ */ +/* $OpenBSD: acpi_machdep.c,v 1.23 2009/08/13 15:33:20 kettenis Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com> * @@ -30,7 +30,6 @@ #include <machine/cpufunc.h> #include <machine/npx.h> -#include <machine/intr.h> #include <dev/isa/isareg.h> #include <dev/acpi/acpireg.h> @@ -52,7 +51,6 @@ #include <machine/i82489var.h> #endif - #if NAPM > 0 int haveacpibutusingapm; #endif @@ -129,7 +127,8 @@ acpi_scan(struct acpi_mem_map *handle, paddr_t pa, size_t len) } int -acpi_probe(struct device *parent, struct cfdata *match, struct bios_attach_args *ba) +acpi_probe(struct device *parent, struct cfdata *match, + struct bios_attach_args *ba) { struct acpi_mem_map handle; u_int8_t *ptr; @@ -173,10 +172,12 @@ havebase: return (0); } #endif + return (1); } #ifndef SMALL_KERNEL + void acpi_attach_machdep(struct acpi_softc *sc) { @@ -190,20 +191,24 @@ acpi_attach_machdep(struct acpi_softc *sc) acpiapm_kqfilter = acpikqfilter; cpuresetfn = acpi_reset; -#ifdef ACPI_SLEEP_ENABLED +#ifdef ACPI_SLEEP_ENABLED /* * Sanity check before setting up trampoline. * Ensure the trampoline size is < PAGE_SIZE */ KASSERT(acpi_resume_end - acpi_real_mode_resume < PAGE_SIZE); - bcopy(acpi_real_mode_resume, (caddr_t)ACPI_TRAMPOLINE, acpi_resume_end - acpi_real_mode_resume); + + bcopy(acpi_real_mode_resume, (caddr_t)ACPI_TRAMPOLINE, + acpi_resume_end - acpi_real_mode_resume); #endif /* ACPI_SLEEP_ENABLED */ } void acpi_cpu_flush(struct acpi_softc *sc, int state) { - /* flush write back caches since we'll lose them */ + /* + * Flush write back caches since we'll lose them. + */ if (state > ACPI_STATE_S1) wbinvd(); } @@ -212,7 +217,6 @@ int acpi_sleep_machdep(struct acpi_softc *sc, int state) { #ifdef ACPI_SLEEP_ENABLED - if (sc->sc_facs == NULL) { printf("%s: acpi_sleep_machdep: no FACS\n", DEVNAME(sc)); return (ENXIO); @@ -274,8 +278,9 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state) #endif initrtclock(); inittodr(time_second); - #endif /* ACPI_SLEEP_ENABLED */ + return (0); } + #endif /* ! SMALL_KERNEL */ |