2 * This file and its contents are supplied under the terms of the
3 * Common Development and Distribution License ("CDDL"), version 1.0.
4 * You may only use this file in accordance with the terms of version
7 * A full copy of the text of the CDDL should have accompanied this
8 * source. A copy of the CDDL is also available via the Internet at
9 * http://www.illumos.org/license/CDDL.
13 * Copyright 2016 Tooams Soome <tsoome@me.com>
16 #include <sys/cdefs.h>
19 #include <machine/stdarg.h>
20 #include <bootstrap.h>
24 #include "platform/acfreebsd.h"
26 #define ACPI_SYSTEM_XFACE
30 ACPI_TABLE_RSDP
*rsdp
;
31 static EFI_GUID acpi_guid
= ACPI_TABLE_GUID
;
32 static EFI_GUID acpi20_guid
= ACPI_20_TABLE_GUID
;
40 if ((rsdp
= efi_get_table(&acpi20_guid
)) == NULL
)
41 rsdp
= efi_get_table(&acpi_guid
);
46 /* export values from the RSDP */
48 snprintf(buf
, sizeof (buf
), "0x%016llx", (unsigned long long)rsdp
);
50 snprintf(buf
, sizeof (buf
), "0x%08x", (unsigned int)rsdp
);
52 setenv("acpi.rsdp", buf
, 1);
53 revision
= rsdp
->Revision
;
56 snprintf(buf
, sizeof (buf
), "%d", revision
);
57 setenv("acpi.revision", buf
, 1);
58 strncpy(buf
, rsdp
->OemId
, sizeof(rsdp
->OemId
));
59 buf
[sizeof(rsdp
->OemId
)] = '\0';
60 setenv("acpi.oem", buf
, 1);
62 snprintf(buf
, sizeof (buf
), "0x%016llx",
63 (unsigned long long)rsdp
->RsdtPhysicalAddress
);
65 snprintf(buf
, sizeof (buf
), "0x%08x", rsdp
->RsdtPhysicalAddress
);
67 setenv("acpi.rsdt", buf
, 1);
69 snprintf(buf
, sizeof (buf
), "0x%016llx",
70 (unsigned long long)rsdp
->XsdtPhysicalAddress
);
71 setenv("acpi.xsdt", buf
, 1);
72 snprintf(buf
, sizeof (buf
), "%d", rsdp
->Length
);
73 setenv("acpi.xsdt_length", buf
, 1);