hw: evaluate also ACPI RSDP v1 with MBI2

Issue #2526
This commit is contained in:
Alexander Boettcher 2017-11-18 15:22:22 +01:00 committed by Christian Helmuth
parent 2b6ae514b5
commit e1ac124a4d
3 changed files with 29 additions and 8 deletions

View File

@ -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>() == Tag::Type::ACPI_RSDP) {
if (tag.read<Tag::Type>() == Tag::Type::ACPI_RSDP_V1 ||
tag.read<Tag::Type>() == 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<Hw::Acpi_rsdp *>(rsdp_addr);
if (rsdp->valid() &&
sizeof(*rsdp) >= tag.read<Tag::Size>() - sizeof_tag)
if (tag.read<Tag::Size>() - 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<Tag::Size>() - sizeof_tag)
acpi_fn(*rsdp);
}

View File

@ -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;
}

View File

@ -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
}