diff options
-rw-r--r-- | sys/amd64/acpica/OsdEnvironment.c | 40 | ||||
-rw-r--r-- | sys/i386/acpica/OsdEnvironment.c | 40 | ||||
-rw-r--r-- | sys/ia64/acpica/OsdEnvironment.c | 33 |
3 files changed, 81 insertions, 32 deletions
diff --git a/sys/amd64/acpica/OsdEnvironment.c b/sys/amd64/acpica/OsdEnvironment.c index 4e3ae44..a3d3661 100644 --- a/sys/amd64/acpica/OsdEnvironment.c +++ b/sys/amd64/acpica/OsdEnvironment.c @@ -30,32 +30,50 @@ /* * 6.1 : Environmental support */ +#include <sys/types.h> +#include <sys/linker_set.h> +#include <sys/sysctl.h> #include "acpi.h" #include <machine/pc/bios.h> +u_long i386_acpi_root; + +SYSCTL_ULONG(_machdep, OID_AUTO, acpi_root, CTLFLAG_RD, &i386_acpi_root, 0, + "The physical address of the RSDP"); + ACPI_STATUS AcpiOsInitialize(void) { - return(0); + return(0); } ACPI_STATUS AcpiOsTerminate(void) { - return(0); + return(0); } ACPI_STATUS -AcpiOsGetRootPointer( - UINT32 Flags, - ACPI_POINTER *RsdpPhysicalAddress) +AcpiOsGetRootPointer(UINT32 Flags, ACPI_POINTER *RsdpPhysicalAddress) { - /* - * The loader passes the physical address at which it found the - * RSDP in a hint. We could recover this rather than searching - * manually here. - */ - return(AcpiFindRootPointer(Flags, RsdpPhysicalAddress)); + ACPI_POINTER ptr; + ACPI_STATUS status; + + if (i386_acpi_root == 0) { + /* + * The loader passes the physical address at which it found the + * RSDP in a hint. We could recover this rather than searching + * manually here. + */ + status = AcpiFindRootPointer(Flags, &ptr); + if (status == AE_OK) + i386_acpi_root = ptr.Pointer.Physical; + } else + status = AE_OK; + + RsdpPhysicalAddress->PointerType = ACPI_PHYSICAL_POINTER; + RsdpPhysicalAddress->Pointer.Physical = i386_acpi_root; + return (status); } diff --git a/sys/i386/acpica/OsdEnvironment.c b/sys/i386/acpica/OsdEnvironment.c index 4e3ae44..a3d3661 100644 --- a/sys/i386/acpica/OsdEnvironment.c +++ b/sys/i386/acpica/OsdEnvironment.c @@ -30,32 +30,50 @@ /* * 6.1 : Environmental support */ +#include <sys/types.h> +#include <sys/linker_set.h> +#include <sys/sysctl.h> #include "acpi.h" #include <machine/pc/bios.h> +u_long i386_acpi_root; + +SYSCTL_ULONG(_machdep, OID_AUTO, acpi_root, CTLFLAG_RD, &i386_acpi_root, 0, + "The physical address of the RSDP"); + ACPI_STATUS AcpiOsInitialize(void) { - return(0); + return(0); } ACPI_STATUS AcpiOsTerminate(void) { - return(0); + return(0); } ACPI_STATUS -AcpiOsGetRootPointer( - UINT32 Flags, - ACPI_POINTER *RsdpPhysicalAddress) +AcpiOsGetRootPointer(UINT32 Flags, ACPI_POINTER *RsdpPhysicalAddress) { - /* - * The loader passes the physical address at which it found the - * RSDP in a hint. We could recover this rather than searching - * manually here. - */ - return(AcpiFindRootPointer(Flags, RsdpPhysicalAddress)); + ACPI_POINTER ptr; + ACPI_STATUS status; + + if (i386_acpi_root == 0) { + /* + * The loader passes the physical address at which it found the + * RSDP in a hint. We could recover this rather than searching + * manually here. + */ + status = AcpiFindRootPointer(Flags, &ptr); + if (status == AE_OK) + i386_acpi_root = ptr.Pointer.Physical; + } else + status = AE_OK; + + RsdpPhysicalAddress->PointerType = ACPI_PHYSICAL_POINTER; + RsdpPhysicalAddress->Pointer.Physical = i386_acpi_root; + return (status); } diff --git a/sys/ia64/acpica/OsdEnvironment.c b/sys/ia64/acpica/OsdEnvironment.c index 724968e..e4e664e 100644 --- a/sys/ia64/acpica/OsdEnvironment.c +++ b/sys/ia64/acpica/OsdEnvironment.c @@ -30,12 +30,20 @@ /* * 6.1 : Environmental support */ +#include <sys/types.h> +#include <sys/linker_set.h> +#include <sys/sysctl.h> #include "acpi.h" extern u_int64_t ia64_efi_acpi_table; extern u_int64_t ia64_efi_acpi20_table; +u_long ia64_acpi_root; + +SYSCTL_ULONG(_machdep, OID_AUTO, acpi_root, CTLFLAG_RD, &ia64_acpi_root, 0, + "The physical address of the RSDP"); + ACPI_STATUS AcpiOsInitialize(void) { @@ -54,17 +62,22 @@ ACPI_STATUS AcpiOsGetRootPointer(UINT32 Flags, ACPI_POINTER *RsdpAddress) { - if (ia64_efi_acpi20_table) { - RsdpAddress->PointerType = ACPI_PHYSICAL_POINTER; - RsdpAddress->Pointer.Physical = ia64_efi_acpi20_table; - - } - else if (ia64_efi_acpi_table) { - RsdpAddress->PointerType = ACPI_PHYSICAL_POINTER; - RsdpAddress->Pointer.Physical = ia64_efi_acpi_table; + if (ia64_acpi_root == 0) { + if (ia64_efi_acpi20_table) { + /* XXX put under bootverbose. */ + printf("Using ACPI2.0 table at 0x%lx\n", + ia64_efi_acpi20_table); + ia64_acpi_root = ia64_efi_acpi20_table; + } else if (ia64_efi_acpi_table) { + /* XXX put under bootverbose. */ + printf("Using ACPI1.x table at 0x%lx\n", + ia64_efi_acpi_table); + ia64_acpi_root = ia64_efi_acpi_table; + } else + return(AE_NOT_FOUND); } - else - return(AE_NOT_FOUND); + RsdpAddress->PointerType = ACPI_PHYSICAL_POINTER; + RsdpAddress->Pointer.Physical = ia64_acpi_root; return(AE_OK); } |