aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2010-07-09 21:03:13 -0700
committerH. Peter Anvin <hpa@zytor.com>2010-07-09 21:04:05 -0700
commit866826b3dd41636ef6e93f036a44aa12ab99a046 (patch)
tree0a4dbd148788dc00e485edf65d51220927b7f20d
parent25956b55fe891d8d766e6c10eea57a58340a6a24 (diff)
downloadsyslinux-memdisk-acpi.tar.gz
syslinux-memdisk-acpi.tar.xz
syslinux-memdisk-acpi.zip
memdisk: write a message if the RSDP is writable or notmemdisk-acpi
Test the RSDP for writability; print a message if it is. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--memdisk/acpi.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/memdisk/acpi.c b/memdisk/acpi.c
index cd0431c1..82a0808b 100644
--- a/memdisk/acpi.c
+++ b/memdisk/acpi.c
@@ -165,6 +165,7 @@ size_t acpi_bytes_needed(void)
{
struct acpi_rsdp *rsdp;
struct acpi_description_header *dsdt;
+ bool rsdp_writable;
int i, n;
rsdp = find_rsdp();
@@ -173,6 +174,27 @@ size_t acpi_bytes_needed(void)
return 0;
}
+ /* Check to see if the RSDP is writable */
+ if (0 && (size_t)rsdp < 0xa0000) {
+ rsdp_writable = true;
+ } else {
+ size_t t1, t2;
+
+ asm volatile(
+ "cli ; "
+ "movl %2,%0 ; "
+ "xorl $-1,%2 ; "
+ "movl %2,%1 ; "
+ "movl %0,%2 ; "
+ "sti"
+ : "=r" (t1), "=r" (t2)
+ : "m" (rsdp->rsdt_addr));
+
+ rsdp_writable = (t1 ^ t2) == -1;
+ }
+
+ printf("ACPI: RSDP is %s\n", rsdp_writable ? "writable" : "readonly");
+
rsdt = (struct acpi_rsdt *)rsdp->rsdt_addr;
if (is_valid_table(rsdt) != ERR_NONE) {
printf("ACPI: unable to locate an ACPI RSDT\n");