From e1ac124a4d94c8e1d5a55ad129c7f024ac2e57c1 Mon Sep 17 00:00:00 2001 From: Alexander Boettcher Date: Sat, 18 Nov 2017 15:22:22 +0100 Subject: [PATCH] hw: evaluate also ACPI RSDP v1 with MBI2 Issue #2526 --- .../src/bootstrap/spec/x86_64/multiboot2.h | 17 +++++++++++++---- .../src/bootstrap/spec/x86_64/platform.cc | 6 +++++- tool/run/boot_dir/hw | 14 +++++++++++--- 3 files changed, 29 insertions(+), 8 deletions(-) diff --git a/repos/base-hw/src/bootstrap/spec/x86_64/multiboot2.h b/repos/base-hw/src/bootstrap/spec/x86_64/multiboot2.h index 4617caa236..ff23b0a246 100644 --- a/repos/base-hw/src/bootstrap/spec/x86_64/multiboot2.h +++ b/repos/base-hw/src/bootstrap/spec/x86_64/multiboot2.h @@ -30,7 +30,8 @@ class Genode::Multiboot2_info : Mmio struct Type : Register <0x00, 32> { - enum { END = 0, MEMORY = 6, ACPI_RSDP = 15 }; + enum { END = 0, MEMORY = 6, ACPI_RSDP_V1 = 14, + ACPI_RSDP_V2 = 15 }; }; struct Size : Register <0x04, 32> { }; @@ -76,13 +77,21 @@ class Genode::Multiboot2_info : Mmio } } - if (tag.read() == Tag::Type::ACPI_RSDP) { + if (tag.read() == Tag::Type::ACPI_RSDP_V1 || + tag.read() == Tag::Type::ACPI_RSDP_V2) { size_t const sizeof_tag = 1UL << Tag::LOG2_SIZE; addr_t const rsdp_addr = tag_addr + sizeof_tag; Hw::Acpi_rsdp * rsdp = reinterpret_cast(rsdp_addr); - if (rsdp->valid() && - sizeof(*rsdp) >= tag.read() - sizeof_tag) + + if (tag.read() - sizeof_tag == 20) { + /* ACPI RSDP v1 is 20 byte solely */ + Hw::Acpi_rsdp rsdp_v1; + memset (&rsdp_v1, 0, sizeof(rsdp_v1)); + memcpy (&rsdp_v1, rsdp, 20); + acpi_fn(rsdp_v1); + } + if (sizeof(*rsdp) <= tag.read() - sizeof_tag) acpi_fn(*rsdp); } diff --git a/repos/base-hw/src/bootstrap/spec/x86_64/platform.cc b/repos/base-hw/src/bootstrap/spec/x86_64/platform.cc index fe96d017d3..f753a4e8b2 100644 --- a/repos/base-hw/src/bootstrap/spec/x86_64/platform.cc +++ b/repos/base-hw/src/bootstrap/spec/x86_64/platform.cc @@ -76,7 +76,11 @@ Bootstrap::Platform::Board::Board() lambda(base, size); }, - [&] (Hw::Acpi_rsdp const &rsdp) { acpi_rsdp = rsdp; }); + [&] (Hw::Acpi_rsdp const &rsdp) { + /* prefer higher acpi revisions */ + if (!acpi_rsdp.valid() || acpi_rsdp.revision < rsdp.revision) + acpi_rsdp = rsdp; + }); return; } diff --git a/tool/run/boot_dir/hw b/tool/run/boot_dir/hw index 2c32129ba3..0d191494bc 100644 --- a/tool/run/boot_dir/hw +++ b/tool/run/boot_dir/hw @@ -96,6 +96,12 @@ proc run_boot_dir {binaries} { exec [cross_dev_prefix]strip [run_dir]/image.elf if {[have_include "image/iso"] || [have_include "image/disk"] || [have_include image/uefi]} { + # + # Compress Genode image, to be uncompressed by GRUB + # + exec gzip [run_dir]/image.elf + + set serial_bender_opt "" if {[have_include "image/disk"]} { exec mkdir -p [run_dir]/boot/grub @@ -114,6 +120,8 @@ proc run_boot_dir {binaries} { exec cp $grub2_path/boot/grub2/grub2_64.efi [run_dir]/efi/boot/bootx64.efi exec mkdir -p [run_dir]/boot/grub exec cp [genode_dir]/tool/boot/bender [run_dir]/boot/bender + + set serial_bender_opt "serial_fallback" } # @@ -122,9 +130,9 @@ proc run_boot_dir {binaries} { set fh [open "[run_dir]/boot/grub/grub.cfg" "WRONLY CREAT TRUNC"] puts $fh "set timeout=0" puts $fh "menuentry 'Genode on base-hw' {" - puts $fh " insmod multiboot" - puts $fh " multiboot /boot/bender" - puts $fh " module /image.elf image.elf" + puts $fh " insmod multiboot2" + puts $fh " multiboot2 /boot/bender $serial_bender_opt" + puts $fh " module2 /image.elf.gz image.elf" puts $fh "}" close $fh }