summaryrefslogtreecommitdiffstats
path: root/sys/amd64/acpica
diff options
context:
space:
mode:
authorjkim <jkim@FreeBSD.org>2010-11-09 00:14:39 +0000
committerjkim <jkim@FreeBSD.org>2010-11-09 00:14:39 +0000
commit36651dc0f06343169a69e006361c5b933ee37567 (patch)
treea2359e43e7a60e9e2e05cc75bf94b30f306e9fd6 /sys/amd64/acpica
parent1d77e31425860c5adf9e625c70a2ba03bbc272b6 (diff)
downloadFreeBSD-src-36651dc0f06343169a69e006361c5b933ee37567.zip
FreeBSD-src-36651dc0f06343169a69e006361c5b933ee37567.tar.gz
Reduce diff between platforms and fix style(9) bugs.
Diffstat (limited to 'sys/amd64/acpica')
-rw-r--r--sys/amd64/acpica/OsdEnvironment.c50
1 files changed, 35 insertions, 15 deletions
diff --git a/sys/amd64/acpica/OsdEnvironment.c b/sys/amd64/acpica/OsdEnvironment.c
index fb01a3f..a35a3e0 100644
--- a/sys/amd64/acpica/OsdEnvironment.c
+++ b/sys/amd64/acpica/OsdEnvironment.c
@@ -28,9 +28,6 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-/*
- * 6.1 : Environmental support
- */
#include <sys/types.h>
#include <sys/bus.h>
#include <sys/linker_set.h>
@@ -39,33 +36,56 @@ __FBSDID("$FreeBSD$");
#include <contrib/dev/acpica/include/acpi.h>
#include <contrib/dev/acpica/include/actables.h>
-static u_long amd64_acpi_root;
+static u_long acpi_root_phys;
-SYSCTL_ULONG(_machdep, OID_AUTO, acpi_root, CTLFLAG_RD, &amd64_acpi_root, 0,
- "The physical address of the RSDP");
+SYSCTL_ULONG(_machdep, OID_AUTO, acpi_root, CTLFLAG_RD, &acpi_root_phys, 0,
+ "The physical address of the RSDP");
ACPI_STATUS
AcpiOsInitialize(void)
{
- return(0);
+
+ return (AE_OK);
}
ACPI_STATUS
AcpiOsTerminate(void)
{
- return(0);
+
+ return (AE_OK);
+}
+
+static u_long
+acpi_get_root_from_loader(void)
+{
+ long acpi_root;
+
+ if (resource_long_value("acpi", 0, "rsdp", &acpi_root) == 0)
+ return (acpi_root);
+
+ return (0);
+}
+
+static u_long
+acpi_get_root_from_memory(void)
+{
+ ACPI_SIZE acpi_root;
+
+ if (ACPI_SUCCESS(AcpiFindRootPointer(&acpi_root)))
+ return (acpi_root);
+
+ return (0);
}
ACPI_PHYSICAL_ADDRESS
AcpiOsGetRootPointer(void)
{
- u_long ptr;
- if (amd64_acpi_root == 0 &&
- (resource_long_value("acpi", 0, "rsdp", (long *)&ptr) == 0 ||
- AcpiFindRootPointer((ACPI_SIZE *)&ptr) == AE_OK) &&
- ptr != 0)
- amd64_acpi_root = ptr;
+ if (acpi_root_phys == 0) {
+ acpi_root_phys = acpi_get_root_from_loader();
+ if (acpi_root_phys == 0)
+ acpi_root_phys = acpi_get_root_from_memory();
+ }
- return (amd64_acpi_root);
+ return (acpi_root_phys);
}
OpenPOWER on IntegriCloud