summaryrefslogtreecommitdiff
path: root/usr/src/cmd/acpi
diff options
context:
space:
mode:
authorToomas Soome <tsoome@me.com>2017-02-14 15:18:19 -0500
committerDan McDonald <danmcd@omniti.com>2017-02-14 15:18:19 -0500
commit760a9770c08916571766d1f0145d2a3343e1a8d9 (patch)
treeb825702cf6915fd1015ce46774447e3021fa1c28 /usr/src/cmd/acpi
parentcff899ea9243cc9336cf0af13fd3c8416466ae0d (diff)
downloadillumos-gate-760a9770c08916571766d1f0145d2a3343e1a8d9.tar.gz
7864 acpidump: use acpi-root-tab property
Reviewed by: Adam Stevko <adam.stevko@gmail.com> Reviewed by: Robert Mustacchi <rm@joyent.com> Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com> Reviewed by: Juraj Lutter <juraj@lutter.sk> Approved by: Dan McDonald <danmcd@omniti.com>
Diffstat (limited to 'usr/src/cmd/acpi')
-rw-r--r--usr/src/cmd/acpi/acpidump/Makefile2
-rw-r--r--usr/src/cmd/acpi/acpidump/osillumostbl.c41
2 files changed, 39 insertions, 4 deletions
diff --git a/usr/src/cmd/acpi/acpidump/Makefile b/usr/src/cmd/acpi/acpidump/Makefile
index 35a352d851..5c9b24ccbe 100644
--- a/usr/src/cmd/acpi/acpidump/Makefile
+++ b/usr/src/cmd/acpi/acpidump/Makefile
@@ -25,6 +25,8 @@ CERRWARN += -_gcc=-Wno-unused-function
CPPFLAGS += -I$(SRC)/uts/intel/sys/acpi -DACPI_DUMP_APP
+LDLIBS += -ldevinfo
+
.KEEP_STATE:
all: $(PROG)
diff --git a/usr/src/cmd/acpi/acpidump/osillumostbl.c b/usr/src/cmd/acpi/acpidump/osillumostbl.c
index bd4d500ba3..12bf145f7e 100644
--- a/usr/src/cmd/acpi/acpidump/osillumostbl.c
+++ b/usr/src/cmd/acpi/acpidump/osillumostbl.c
@@ -50,6 +50,7 @@
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
+#include <libdevinfo.h>
#include "acpidump.h"
#define _COMPONENT ACPI_OS_SERVICES
@@ -359,16 +360,48 @@ AcpiOsGetTableByIndex(UINT32 Index, ACPI_TABLE_HEADER **Table,
* DESCRIPTION: Scan and load RSDP.
* See the find_rsdp() function in usr/src/uts/i86pc/os/fakebop.c, which is how
* the kernel finds the RSDP. That algorithm matches AcpiFindRootPointer().
- * The code here is derived from AcpiFindRootPointer, except that we will try
- * the BIOS if the EBDA fails, and we will copy the table if found.
+ *
+ * If the system is not using BIOS, and ACPI information was passed to the
+ * system from the boot loader, then the RSDP is recorded in the "acpi-root-tab"
+ * property.
+ *
+ * The code here is derived from AcpiFindRootPointer, except that we will
+ * try the "acpi-root-tab" property first. If the property does not exist or
+ * we do not find the root, then we scan the EBDA. Finally, we will search
+ * the BIOS and copy the table if found.
*/
static ACPI_STATUS
OslLoadRsdp(void)
{
- UINT8 *mapp;
+ UINT8 *mapp = NULL;
ACPI_TABLE_HEADER *tblp;
- ACPI_SIZE mapsize;
+ ACPI_SIZE mapsize = sizeof (ACPI_TABLE_RSDP);
ACPI_PHYSICAL_ADDRESS physaddr;
+ di_node_t root;
+ int64_t *val64;
+
+ if ((root = di_init("/", DINFOPROP)) != DI_NODE_NIL) {
+ if (di_prop_lookup_int64(DDI_DEV_T_ANY, root,
+ "acpi-root-tab", &val64) == 1) {
+ physaddr = (ACPI_PHYSICAL_ADDRESS)*val64;
+ mapp = AcpiOsMapMemory(physaddr, mapsize);
+ }
+ di_fini(root);
+ }
+
+ if (mapp != NULL) {
+ tblp = ACPI_CAST_PTR(ACPI_TABLE_HEADER,
+ AcpiTbScanMemoryForRsdp(mapp, mapsize));
+ if (tblp != NULL) {
+ physaddr += (ACPI_PHYSICAL_ADDRESS)
+ ACPI_PTR_DIFF(tblp, mapp);
+ Gbl_RsdpAddress = physaddr;
+ memcpy(&Gbl_Rsdp, tblp, sizeof (ACPI_TABLE_RSDP));
+ AcpiOsUnmapMemory(mapp, mapsize);
+ return (AE_OK);
+ }
+ AcpiOsUnmapMemory(mapp, mapsize);
+ }
/* 1a) Get the location of the Extended BIOS Data Area (EBDA) */
mapp = AcpiOsMapMemory((ACPI_PHYSICAL_ADDRESS)ACPI_EBDA_PTR_LOCATION,