mirror of
https://github.com/genodelabs/genode.git
synced 2025-05-03 09:12:57 +00:00
nova: uefi boot support using multiboot2
- kernel provides ACPI RSDT/XSDT pointer - core exports it via a ROM called "platform_info" Issue #2242
This commit is contained in:
parent
019528ee6a
commit
f30f0a81e0
@ -91,6 +91,8 @@ namespace Nova {
|
|||||||
struct Mem_desc
|
struct Mem_desc
|
||||||
{
|
{
|
||||||
enum Type {
|
enum Type {
|
||||||
|
ACPI_XSDT = -4,
|
||||||
|
ACPI_RSDT = -3,
|
||||||
MULTIBOOT_MODULE = -2,
|
MULTIBOOT_MODULE = -2,
|
||||||
MICROHYPERVISOR = -1,
|
MICROHYPERVISOR = -1,
|
||||||
AVAILABLE_MEMORY = 1,
|
AVAILABLE_MEMORY = 1,
|
||||||
|
@ -1 +1 @@
|
|||||||
1dbfe82b4c40db4c637cc51f65d937abfaac2d52
|
d303aea094b6576a9bb0ba350c7cf4eb648e5ca4
|
||||||
|
@ -4,7 +4,7 @@ DOWNLOADS := nova.git
|
|||||||
|
|
||||||
# r9 branch - use r9_debug for more verbose kernel messages
|
# r9 branch - use r9_debug for more verbose kernel messages
|
||||||
URL(nova) := https://github.com/alex-ab/NOVA.git
|
URL(nova) := https://github.com/alex-ab/NOVA.git
|
||||||
REV(nova) := 2050648226839931dc675c3ec62f8f598bf6d38a
|
REV(nova) := 9a3605ead755be8b5820de3ae6015d6de8baaaf5
|
||||||
DIR(nova) := src/kernel/nova
|
DIR(nova) := src/kernel/nova
|
||||||
|
|
||||||
PATCHES := $(wildcard $(REP_DIR)/patches/*.patch)
|
PATCHES := $(wildcard $(REP_DIR)/patches/*.patch)
|
||||||
|
@ -16,7 +16,8 @@
|
|||||||
/* Genode includes */
|
/* Genode includes */
|
||||||
#include <base/sleep.h>
|
#include <base/sleep.h>
|
||||||
#include <base/thread.h>
|
#include <base/thread.h>
|
||||||
#include <base/snprintf.h>
|
#include <util/string.h>
|
||||||
|
#include <util/xml_generator.h>
|
||||||
#include <trace/source_registry.h>
|
#include <trace/source_registry.h>
|
||||||
|
|
||||||
/* core includes */
|
/* core includes */
|
||||||
@ -564,10 +565,14 @@ Platform::Platform() :
|
|||||||
for (unsigned i = 0; i < num_mem_desc; i++, mem_desc++) {
|
for (unsigned i = 0; i < num_mem_desc; i++, mem_desc++) {
|
||||||
|
|
||||||
if (mem_desc->type == Hip::Mem_desc::AVAILABLE_MEMORY) continue;
|
if (mem_desc->type == Hip::Mem_desc::AVAILABLE_MEMORY) continue;
|
||||||
|
if (mem_desc->type == Hip::Mem_desc::ACPI_RSDT) continue;
|
||||||
|
if (mem_desc->type == Hip::Mem_desc::ACPI_XSDT) continue;
|
||||||
|
|
||||||
Hip::Mem_desc * mem_d = (Hip::Mem_desc *)mem_desc_base;
|
Hip::Mem_desc * mem_d = (Hip::Mem_desc *)mem_desc_base;
|
||||||
for (unsigned j = 0; j < num_mem_desc; j++, mem_d++) {
|
for (unsigned j = 0; j < num_mem_desc; j++, mem_d++) {
|
||||||
if (mem_d->type == Hip::Mem_desc::AVAILABLE_MEMORY) continue;
|
if (mem_d->type == Hip::Mem_desc::AVAILABLE_MEMORY) continue;
|
||||||
|
if (mem_d->type == Hip::Mem_desc::ACPI_RSDT) continue;
|
||||||
|
if (mem_d->type == Hip::Mem_desc::ACPI_XSDT) continue;
|
||||||
if (mem_d == mem_desc) continue;
|
if (mem_d == mem_desc) continue;
|
||||||
|
|
||||||
/* if regions are disjunct all is fine */
|
/* if regions are disjunct all is fine */
|
||||||
@ -588,11 +593,16 @@ Platform::Platform() :
|
|||||||
* From now on, it is save to use the core allocators...
|
* From now on, it is save to use the core allocators...
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
uint64_t rsdt = 0UL;
|
||||||
|
uint64_t xsdt = 0UL;
|
||||||
|
|
||||||
/* build ROM file system */
|
/* build ROM file system */
|
||||||
mem_desc = (Hip::Mem_desc *)mem_desc_base;
|
mem_desc = (Hip::Mem_desc *)mem_desc_base;
|
||||||
for (unsigned i = 0; i < num_mem_desc; i++, mem_desc++) {
|
for (unsigned i = 0; i < num_mem_desc; i++, mem_desc++) {
|
||||||
|
if (mem_desc->type == Hip::Mem_desc::ACPI_RSDT) rsdt = mem_desc->addr;
|
||||||
|
if (mem_desc->type == Hip::Mem_desc::ACPI_XSDT) xsdt = mem_desc->addr;
|
||||||
if (mem_desc->type != Hip::Mem_desc::MULTIBOOT_MODULE) continue;
|
if (mem_desc->type != Hip::Mem_desc::MULTIBOOT_MODULE) continue;
|
||||||
if (!mem_desc->addr || !mem_desc->size || !mem_desc->aux) continue;
|
if (!mem_desc->addr || !mem_desc->size) continue;
|
||||||
|
|
||||||
/* assume core's ELF image has one-page header */
|
/* assume core's ELF image has one-page header */
|
||||||
addr_t const core_phys_start = trunc_page(mem_desc->addr + get_page_size());
|
addr_t const core_phys_start = trunc_page(mem_desc->addr + get_page_size());
|
||||||
@ -608,6 +618,40 @@ Platform::Platform() :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
/* export x86 platform specific infos */
|
||||||
|
|
||||||
|
unsigned const pages = 1;
|
||||||
|
void * phys_ptr = 0;
|
||||||
|
ram_alloc()->alloc(get_page_size(), &phys_ptr);
|
||||||
|
addr_t const phys_addr = reinterpret_cast<addr_t>(phys_ptr);
|
||||||
|
addr_t const core_local_addr = _map_pages(phys_addr >> get_page_size_log2(),
|
||||||
|
pages);
|
||||||
|
|
||||||
|
Genode::Xml_generator xml(reinterpret_cast<char *>(core_local_addr),
|
||||||
|
pages << get_page_size_log2(),
|
||||||
|
"platform_info", [&] ()
|
||||||
|
{
|
||||||
|
xml.node("acpi", [&] () {
|
||||||
|
|
||||||
|
xml.attribute("revision", 2); /* XXX */
|
||||||
|
|
||||||
|
if (rsdt)
|
||||||
|
xml.attribute("rsdt", String<32>(Hex(rsdt)));
|
||||||
|
|
||||||
|
if (xsdt)
|
||||||
|
xml.attribute("xsdt", String<32>(Hex(xsdt)));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
unmap_local(__main_thread_utcb, core_local_addr, pages);
|
||||||
|
region_alloc()->free(reinterpret_cast<void *>(core_local_addr), pages * get_page_size());
|
||||||
|
|
||||||
|
_rom_fs.insert(new (core_mem_alloc())
|
||||||
|
Rom_module(phys_addr, pages * get_page_size(),
|
||||||
|
"platform_info"));
|
||||||
|
}
|
||||||
|
|
||||||
/* export hypervisor info page as ROM module */
|
/* export hypervisor info page as ROM module */
|
||||||
{
|
{
|
||||||
void * phys_ptr = 0;
|
void * phys_ptr = 0;
|
||||||
@ -679,8 +723,7 @@ Platform::Platform() :
|
|||||||
*/
|
*/
|
||||||
Info trace_source_info() const override
|
Info trace_source_info() const override
|
||||||
{
|
{
|
||||||
char name[32];
|
Genode::String<8> name("idle", affinity.xpos());
|
||||||
snprintf(name, sizeof(name), "idle%d", affinity.xpos());
|
|
||||||
|
|
||||||
uint64_t execution_time = 0;
|
uint64_t execution_time = 0;
|
||||||
Nova::sc_ctrl(sc_sel, execution_time);
|
Nova::sc_ctrl(sc_sel, execution_time);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user