From 2ef5adcc96248f593641012481de037f33a80d5e Mon Sep 17 00:00:00 2001 From: jruoho Date: Sun, 12 Jun 2011 11:31:30 +0000 Subject: [PATCH] Follow IA-64 with the x86-specific ACPI MD functions and move these where they belong to. Remove an unused function. Minor KNF. No functional change. --- sys/arch/ia64/acpi/acpi_machdep.c | 13 +------ sys/arch/ia64/include/acpi_machdep.h | 7 ++-- sys/arch/x86/{x86 => acpi}/acpi_machdep.c | 46 ++++++++++------------- sys/arch/x86/conf/files.x86 | 5 +-- sys/arch/x86/include/acpi_machdep.h | 3 +- sys/dev/acpi/acpica/OsdEnvironment.c | 8 ++-- 6 files changed, 31 insertions(+), 51 deletions(-) rename sys/arch/x86/{x86 => acpi}/acpi_machdep.c (90%) diff --git a/sys/arch/ia64/acpi/acpi_machdep.c b/sys/arch/ia64/acpi/acpi_machdep.c index 1f7f20a616c9..dbb75a35e47d 100644 --- a/sys/arch/ia64/acpi/acpi_machdep.c +++ b/sys/arch/ia64/acpi/acpi_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: acpi_machdep.c,v 1.4 2011/06/12 10:11:52 jruoho Exp $ */ +/* $NetBSD: acpi_machdep.c,v 1.5 2011/06/12 11:31:30 jruoho Exp $ */ /* * Copyright (c) 2009 KIYOHARA Takashi * All rights reserved. @@ -28,7 +28,7 @@ * Machine-dependent routines for ACPICA. */ #include -__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.4 2011/06/12 10:11:52 jruoho Exp $"); +__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.5 2011/06/12 11:31:30 jruoho Exp $"); #include @@ -59,15 +59,6 @@ acpi_md_OsInitialize(void) return AE_OK; } -ACPI_STATUS -acpi_md_OsTerminate(void) -{ - - /* nothing to do. */ -printf("%s\n", __func__); - return AE_OK; -} - ACPI_PHYSICAL_ADDRESS acpi_md_OsGetRootPointer(void) { diff --git a/sys/arch/ia64/include/acpi_machdep.h b/sys/arch/ia64/include/acpi_machdep.h index 1ba76b80771b..7768a48e9453 100644 --- a/sys/arch/ia64/include/acpi_machdep.h +++ b/sys/arch/ia64/include/acpi_machdep.h @@ -1,8 +1,7 @@ -/* $NetBSD: acpi_machdep.h,v 1.4 2011/06/12 10:11:52 jruoho Exp $ */ +/* $NetBSD: acpi_machdep.h,v 1.5 2011/06/12 11:31:30 jruoho Exp $ */ -ACPI_STATUS acpi_md_OsInitialize(void); -ACPI_STATUS acpi_md_OsTerminate(void); -ACPI_PHYSICAL_ADDRESS acpi_md_OsGetRootPointer(void); +ACPI_STATUS acpi_md_OsInitialize(void); +ACPI_PHYSICAL_ADDRESS acpi_md_OsGetRootPointer(void); #define acpi_md_OsIn8(x) inb((x)) #define acpi_md_OsIn16(x) inw((x)) diff --git a/sys/arch/x86/x86/acpi_machdep.c b/sys/arch/x86/acpi/acpi_machdep.c similarity index 90% rename from sys/arch/x86/x86/acpi_machdep.c rename to sys/arch/x86/acpi/acpi_machdep.c index 9acc2108f57f..ad8a6a0322a4 100644 --- a/sys/arch/x86/x86/acpi_machdep.c +++ b/sys/arch/x86/acpi/acpi_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: acpi_machdep.c,v 1.29 2011/01/14 18:33:34 jruoho Exp $ */ +/* $NetBSD: acpi_machdep.c,v 1.1 2011/06/12 11:31:31 jruoho Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -40,7 +40,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.29 2011/01/14 18:33:34 jruoho Exp $"); +__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.1 2011/06/12 11:31:31 jruoho Exp $"); #include #include @@ -77,17 +77,7 @@ extern uint32_t cpus_attached; ACPI_STATUS acpi_md_OsInitialize(void) { - - /* Nothing to do, yet. */ - return (AE_OK); -} - -ACPI_STATUS -acpi_md_OsTerminate(void) -{ - - /* Nothing to do, yet. */ - return (AE_OK); + return AE_OK; } ACPI_PHYSICAL_ADDRESS @@ -179,10 +169,13 @@ sci_override: */ ih = intr_establish(irq, pic, pin, trigger, IPL_TTY, (int (*)(void *)) ServiceRoutine, Context, false); + if (ih == NULL) - return (AE_NO_MEMORY); + return AE_NO_MEMORY; + *cookiep = ih; - return (AE_OK); + + return AE_OK; } void @@ -195,20 +188,19 @@ ACPI_STATUS acpi_md_OsMapMemory(ACPI_PHYSICAL_ADDRESS PhysicalAddress, uint32_t Length, void **LogicalAddress) { + int rv; - if (_x86_memio_map(x86_bus_space_mem, PhysicalAddress, Length, - 0, (bus_space_handle_t *) LogicalAddress) == 0) - return (AE_OK); + rv = _x86_memio_map(x86_bus_space_mem, PhysicalAddress, + Length, 0, (bus_space_handle_t *)LogicalAddress); - return (AE_NO_MEMORY); + return (rv != 0) ? AE_NO_MEMORY : AE_OK; } void acpi_md_OsUnmapMemory(void *LogicalAddress, uint32_t Length) { - (void) _x86_memio_unmap(x86_bus_space_mem, - (bus_space_handle_t) LogicalAddress, Length, NULL); + (bus_space_handle_t)LogicalAddress, Length, NULL); } ACPI_STATUS @@ -219,10 +211,10 @@ acpi_md_OsGetPhysicalAddress(void *LogicalAddress, if (pmap_extract(pmap_kernel(), (vaddr_t) LogicalAddress, &pa)) { *PhysicalAddress = pa; - return (AE_OK); + return AE_OK; } - return (AE_ERROR); + return AE_ERROR; } BOOLEAN @@ -236,7 +228,7 @@ acpi_md_OsReadable(void *Pointer, uint32_t Length) eva = round_page((vaddr_t) Pointer + Length); if (sva < VM_MIN_KERNEL_ADDRESS) - return (FALSE); + return FALSE; for (; sva < eva; sva += PAGE_SIZE) { pte = kvtopte(sva); @@ -246,7 +238,7 @@ acpi_md_OsReadable(void *Pointer, uint32_t Length) } } - return (rv); + return rv; } BOOLEAN @@ -260,7 +252,7 @@ acpi_md_OsWritable(void *Pointer, uint32_t Length) eva = round_page((vaddr_t) Pointer + Length); if (sva < VM_MIN_KERNEL_ADDRESS) - return (FALSE); + return FALSE; for (; sva < eva; sva += PAGE_SIZE) { pte = kvtopte(sva); @@ -270,7 +262,7 @@ acpi_md_OsWritable(void *Pointer, uint32_t Length) } } - return (rv); + return rv; } void diff --git a/sys/arch/x86/conf/files.x86 b/sys/arch/x86/conf/files.x86 index 9c8b1a701be0..0c4f89d8a709 100644 --- a/sys/arch/x86/conf/files.x86 +++ b/sys/arch/x86/conf/files.x86 @@ -1,4 +1,4 @@ -# $NetBSD: files.x86,v 1.70 2011/06/12 10:11:52 jruoho Exp $ +# $NetBSD: files.x86,v 1.71 2011/06/12 11:31:31 jruoho Exp $ # options for MP configuration through the MP spec defflag opt_mpbios.h MPBIOS MPVERBOSE MPDEBUG MPBIOS_SCANPCI @@ -105,10 +105,9 @@ file arch/x86/x86/mp.c acpi | mpbios # MP configuration using ACPI file arch/x86/x86/mpacpi.c acpi -file arch/x86/x86/acpi_machdep.c acpi - file arch/x86/acpi/acpi_pdc.c acpi file arch/x86/acpi/acpi_wakeup.c acpi +file arch/x86/acpi/acpi_machdep.c acpi file arch/x86/isa/isa_machdep.c isa diff --git a/sys/arch/x86/include/acpi_machdep.h b/sys/arch/x86/include/acpi_machdep.h index b99745a4bbb5..2fea2b1efac8 100644 --- a/sys/arch/x86/include/acpi_machdep.h +++ b/sys/arch/x86/include/acpi_machdep.h @@ -1,4 +1,4 @@ -/* $NetBSD: acpi_machdep.h,v 1.9 2011/06/12 10:11:52 jruoho Exp $ */ +/* $NetBSD: acpi_machdep.h,v 1.10 2011/06/12 11:31:31 jruoho Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -46,7 +46,6 @@ #include ACPI_STATUS acpi_md_OsInitialize(void); -ACPI_STATUS acpi_md_OsTerminate(void); ACPI_PHYSICAL_ADDRESS acpi_md_OsGetRootPointer(void); #define acpi_md_OsIn8(x) inb((x)) diff --git a/sys/dev/acpi/acpica/OsdEnvironment.c b/sys/dev/acpi/acpica/OsdEnvironment.c index ae25157a8404..efe6f2f0f616 100644 --- a/sys/dev/acpi/acpica/OsdEnvironment.c +++ b/sys/dev/acpi/acpica/OsdEnvironment.c @@ -1,4 +1,4 @@ -/* $NetBSD: OsdEnvironment.c,v 1.5 2009/08/23 15:16:16 jmcneill Exp $ */ +/* $NetBSD: OsdEnvironment.c,v 1.6 2011/06/12 11:31:31 jruoho Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -42,7 +42,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: OsdEnvironment.c,v 1.5 2009/08/23 15:16:16 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: OsdEnvironment.c,v 1.6 2011/06/12 11:31:31 jruoho Exp $"); #include @@ -53,7 +53,7 @@ __KERNEL_RCSID(0, "$NetBSD: OsdEnvironment.c,v 1.5 2009/08/23 15:16:16 jmcneill #include #define _COMPONENT ACPI_OS_SERVICES -ACPI_MODULE_NAME("ENVIRONMENT"); +ACPI_MODULE_NAME ("ENVIRONMENT"); /* * AcpiOsInitialize: @@ -77,7 +77,7 @@ AcpiOsInitialize(void) ACPI_STATUS AcpiOsTerminate(void) { - return acpi_md_OsTerminate(); + return AE_OK; } /*