From 933de213395afd7adfb1cbe9344a2cc57570ccd4 Mon Sep 17 00:00:00 2001 From: Alexander Boettcher Date: Tue, 25 May 2021 08:27:11 +0200 Subject: [PATCH] base: add platform_info to microkernel platforms Add to older platforms also the info ROM to avoid confusion/red messages. Issue #4016 --- repos/base-fiasco/src/core/platform.cc | 24 +++++++++++++++++++ repos/base-okl4/src/core/platform.cc | 28 +++++++++++++++++++++++ repos/base-pistachio/src/core/platform.cc | 24 +++++++++++++++++++ repos/os/run/demo.run | 3 --- 4 files changed, 76 insertions(+), 3 deletions(-) diff --git a/repos/base-fiasco/src/core/platform.cc b/repos/base-fiasco/src/core/platform.cc index 64b1159b52..953f023982 100644 --- a/repos/base-fiasco/src/core/platform.cc +++ b/repos/base-fiasco/src/core/platform.cc @@ -16,6 +16,7 @@ #include #include #include +#include /* base-internal includes */ #include @@ -466,6 +467,29 @@ Platform::Platform() init_core_log(Core_log_range { core_local_addr, log_size } ); } + + /* export platform specific infos */ + { + void * phys_ptr = nullptr; + size_t const size = 1 << get_page_size_log2(); + + if (ram_alloc().alloc_aligned(size, &phys_ptr, + get_page_size_log2()).ok()) { + addr_t const phys_addr = reinterpret_cast(phys_ptr); + addr_t const core_local_addr = phys_addr; + + region_alloc().remove_range(core_local_addr, size); + + Genode::Xml_generator xml(reinterpret_cast(core_local_addr), + size, "platform_info", [&] () + { + xml.node("kernel", [&] () { xml.attribute("name", "fiasco"); }); + }); + + _rom_fs.insert(new (core_mem_alloc()) Rom_module(phys_addr, size, + "platform_info")); + } + } } diff --git a/repos/base-okl4/src/core/platform.cc b/repos/base-okl4/src/core/platform.cc index e9194d00de..7104429f04 100644 --- a/repos/base-okl4/src/core/platform.cc +++ b/repos/base-okl4/src/core/platform.cc @@ -16,6 +16,7 @@ #include #include #include +#include /* base-internal includes */ #include @@ -208,6 +209,33 @@ Platform::Platform() init_core_log(Core_log_range { core_local_addr, log_size } ); } + + /* export platform specific infos */ + { + void * core_local_ptr = nullptr; + void * phys_ptr = nullptr; + unsigned const pages = 1; + size_t const size = pages << get_page_size_log2(); + + if (ram_alloc().alloc_aligned(size, &phys_ptr, get_page_size_log2()).ok()) { + addr_t const phys_addr = reinterpret_cast(phys_ptr); + + /* let one page free after the log buffer */ + region_alloc().alloc_aligned(size, &core_local_ptr, get_page_size_log2()); + addr_t const core_local_addr = reinterpret_cast(core_local_ptr); + + if (map_local(phys_addr, core_local_addr, pages)) { + + Genode::Xml_generator xml(reinterpret_cast(core_local_addr), + size, "platform_info", [&] () { + xml.node("kernel", [&] () { xml.attribute("name", "okl4"); }); + }); + + _rom_fs.insert(new (core_mem_alloc()) Rom_module(phys_addr, size, + "platform_info")); + } + } + } } diff --git a/repos/base-pistachio/src/core/platform.cc b/repos/base-pistachio/src/core/platform.cc index 3bdd46f083..91340665a3 100644 --- a/repos/base-pistachio/src/core/platform.cc +++ b/repos/base-pistachio/src/core/platform.cc @@ -17,6 +17,7 @@ #include #include #include +#include /* base-internal includes */ #include @@ -626,6 +627,29 @@ Platform::Platform() init_core_log(Core_log_range { core_local_addr, log_size } ); } + + /* export platform specific infos */ + { + void * phys_ptr = nullptr; + size_t const size = 1 << get_page_size_log2(); + + if (ram_alloc().alloc_aligned(size, &phys_ptr, + get_page_size_log2()).ok()) { + addr_t const phys_addr = reinterpret_cast(phys_ptr); + addr_t const core_local_addr = phys_addr; + + region_alloc().remove_range(core_local_addr, size); + + Genode::Xml_generator xml(reinterpret_cast(core_local_addr), + size, "platform_info", [&] () { + xml.node("kernel", [&] () { xml.attribute("name", "pistachio"); }); + }); + + _rom_fs.insert(new (core_mem_alloc()) Rom_module(phys_addr, size, + "platform_info")); + } + } + } diff --git a/repos/os/run/demo.run b/repos/os/run/demo.run index 64303aa0c0..41a84c118a 100644 --- a/repos/os/run/demo.run +++ b/repos/os/run/demo.run @@ -224,9 +224,6 @@ if {[get_cmd_switch --autopilot]} { # remove Error messages which are not fatal, mostly unify_output {(?n)^.*platform_drv] Error:.*ACPI table information is wrong.*$} "" unify_output {(?n)^.*platform_drv] Error: adjust size from.*$} "" - unify_output {(?n)^.*platform_drv] Error: IRQ-session creation failed.*$} "" - unify_output {(?n)^.*platform_drv] Error:.*platform_info.*$} "" - unify_output {(?n)^.*acpi_drv] Error:.*platform_info.*$} "" unify_output {(?n)^.*ps2_drv] Error: no data available.*$} "" unify_output {(?n)^.*ps2_drv] Error: failed to read from port.*$} "" unify_output {(?n)^.*] Error: RAM preservation exceeds available memory.*$} ""