Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Jun 2015 14:02:24 +0000 (UTC)
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r284266 - head/sys/boot/efi/loader/arch/arm64
Message-ID:  <201506111402.t5BE2OZA084291@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: andrew
Date: Thu Jun 11 14:02:23 2015
New Revision: 284266
URL: https://svnweb.freebsd.org/changeset/base/284266

Log:
  Pass the ACPI table pointer to the arm64 kernel from loader.efi.
  
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sys/boot/efi/loader/arch/arm64/exec.c

Modified: head/sys/boot/efi/loader/arch/arm64/exec.c
==============================================================================
--- head/sys/boot/efi/loader/arch/arm64/exec.c	Thu Jun 11 13:58:40 2015	(r284265)
+++ head/sys/boot/efi/loader/arch/arm64/exec.c	Thu Jun 11 14:02:23 2015	(r284266)
@@ -42,6 +42,15 @@ __FBSDID("$FreeBSD$");
 #include "loader_efi.h"
 #include "cache.h"
 
+#include "platform/acfreebsd.h"
+#include "acconfig.h"
+#define ACPI_SYSTEM_XFACE
+#include "actypes.h"
+#include "actbl.h"
+
+static EFI_GUID acpi_guid = ACPI_TABLE_GUID;
+static EFI_GUID acpi20_guid = ACPI_20_TABLE_GUID;
+
 static int elf64_exec(struct preloaded_file *amp);
 static int elf64_obj_exec(struct preloaded_file *amp);
 
@@ -64,12 +73,41 @@ elf64_exec(struct preloaded_file *fp)
 	vm_offset_t clean_addr;
 	size_t clean_size;
 	struct file_metadata *md;
+	ACPI_TABLE_RSDP *rsdp;
 	EFI_STATUS status;
 	EFI_PHYSICAL_ADDRESS addr;
 	Elf_Ehdr *ehdr;
-	int err;
+	char buf[24];
+	int err, revision;
 	void (*entry)(vm_offset_t);
 
+	rsdp = efi_get_table(&acpi20_guid);
+	if (rsdp == NULL) {
+		rsdp = efi_get_table(&acpi_guid);
+	}
+	if (rsdp != NULL) {
+		sprintf(buf, "0x%016llx", (unsigned long long)rsdp);
+		setenv("hint.acpi.0.rsdp", buf, 1);
+		revision = rsdp->Revision;
+		if (revision == 0)
+			revision = 1;
+		sprintf(buf, "%d", revision);
+		setenv("hint.acpi.0.revision", buf, 1);
+		strncpy(buf, rsdp->OemId, sizeof(rsdp->OemId));
+		buf[sizeof(rsdp->OemId)] = '\0';
+		setenv("hint.acpi.0.oem", buf, 1);
+		sprintf(buf, "0x%016x", rsdp->RsdtPhysicalAddress);
+		setenv("hint.acpi.0.rsdt", buf, 1);
+		if (revision >= 2) {
+			/* XXX extended checksum? */
+			sprintf(buf, "0x%016llx",
+			    (unsigned long long)rsdp->XsdtPhysicalAddress);
+			setenv("hint.acpi.0.xsdt", buf, 1);
+			sprintf(buf, "%d", rsdp->Length);
+			setenv("hint.acpi.0.xsdt_length", buf, 1);
+		}
+	}
+
 	if ((md = file_findmetadata(fp, MODINFOMD_ELFHDR)) == NULL)
         	return(EFTYPE);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201506111402.t5BE2OZA084291>