mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-29 15:44:02 +00:00
platform_info: add kernel information (fix #3295)
This commit is contained in:
parent
c38c80fd43
commit
f42c21f16b
@ -489,6 +489,7 @@ Platform::Platform() :
|
||||
pages << get_page_size_log2(),
|
||||
"platform_info", [&] ()
|
||||
{
|
||||
xml.node("kernel", [&] () { xml.attribute("name", "foc"); });
|
||||
xml.node("hardware", [&] () {
|
||||
_setup_platform_info(xml, sigma0_map_kip());
|
||||
});
|
||||
|
@ -95,6 +95,54 @@ addr_t Platform::_rom_module_phys(addr_t virt)
|
||||
}
|
||||
|
||||
|
||||
void Platform::_init_platform_info()
|
||||
{
|
||||
unsigned const pages = 1;
|
||||
size_t const rom_size = pages << get_page_size_log2();
|
||||
void *phys_ptr = nullptr;
|
||||
void *virt_ptr = nullptr;
|
||||
const char *rom_name = "platform_info";
|
||||
|
||||
if (!ram_alloc().alloc(get_page_size(), &phys_ptr)) {
|
||||
error("could not setup platform_info ROM - ram allocation error");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!region_alloc().alloc(rom_size, &virt_ptr)) {
|
||||
error("could not setup platform_info ROM - region allocation error");
|
||||
ram_alloc().free(phys_ptr);
|
||||
return;
|
||||
}
|
||||
|
||||
addr_t const phys_addr = reinterpret_cast<addr_t>(phys_ptr);
|
||||
addr_t const virt_addr = reinterpret_cast<addr_t>(virt_ptr);
|
||||
|
||||
if (!map_local(phys_addr, virt_addr, pages, Hw::PAGE_FLAGS_KERN_DATA)) {
|
||||
error("could not setup platform_info ROM - map error");
|
||||
region_alloc().free(virt_ptr);
|
||||
ram_alloc().free(phys_ptr);
|
||||
return;
|
||||
}
|
||||
|
||||
Genode::Xml_generator xml(reinterpret_cast<char *>(virt_addr),
|
||||
rom_size, rom_name, [&] ()
|
||||
{
|
||||
xml.node("kernel", [&] () { xml.attribute("name", "hw"); });
|
||||
_init_additional_platform_info(xml);
|
||||
});
|
||||
|
||||
if (!unmap_local(virt_addr, pages)) {
|
||||
error("could not setup platform_info ROM - unmap error");
|
||||
return;
|
||||
}
|
||||
|
||||
region_alloc().free(virt_ptr);
|
||||
|
||||
_rom_fs.insert(
|
||||
new (core_mem_alloc()) Rom_module(phys_addr, rom_size, rom_name));
|
||||
}
|
||||
|
||||
|
||||
Platform::Platform()
|
||||
:
|
||||
_io_mem_alloc(&core_mem_alloc()),
|
||||
@ -133,7 +181,7 @@ Platform::Platform()
|
||||
|
||||
_init_io_mem_alloc();
|
||||
_init_rom_modules();
|
||||
_init_additional();
|
||||
_init_platform_info();
|
||||
|
||||
/* core log as ROM module */
|
||||
{
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include <base/synced_allocator.h>
|
||||
#include <base/allocator_avl.h>
|
||||
#include <irq_session/irq_session.h>
|
||||
#include <util/xml_generator.h>
|
||||
|
||||
/* base-hw includes */
|
||||
#include <hw/boot_info.h>
|
||||
@ -67,10 +68,15 @@ class Genode::Platform : public Genode::Platform_generic
|
||||
*/
|
||||
void _init_io_mem_alloc();
|
||||
|
||||
/**
|
||||
* Initialize platform_info ROM module
|
||||
*/
|
||||
void _init_platform_info();
|
||||
|
||||
/**
|
||||
* Perform additional platform-specific initialization.
|
||||
* Add additional platform-specific information.
|
||||
*/
|
||||
void _init_additional();
|
||||
void _init_additional_platform_info(Genode::Xml_generator &);
|
||||
|
||||
void _init_rom_modules();
|
||||
|
||||
|
@ -18,7 +18,7 @@ using namespace Genode;
|
||||
|
||||
void Platform::_init_io_port_alloc() { };
|
||||
|
||||
void Platform::_init_additional() { };
|
||||
void Platform::_init_additional_platform_info(Genode::Xml_generator&) { }
|
||||
|
||||
void Platform::setup_irq_mode(unsigned, unsigned, unsigned) { }
|
||||
|
||||
|
@ -23,7 +23,7 @@ using namespace Genode;
|
||||
|
||||
void Platform::_init_io_port_alloc() { }
|
||||
|
||||
void Platform::_init_additional() { }
|
||||
void Platform::_init_additional_platform_info(Genode::Xml_generator&) { }
|
||||
|
||||
void Platform::setup_irq_mode(unsigned, unsigned, unsigned) { }
|
||||
|
||||
|
@ -91,7 +91,7 @@ bool Platform::get_msi_params(const addr_t mmconf, addr_t &address,
|
||||
}
|
||||
|
||||
|
||||
void Platform::_init_additional()
|
||||
void Platform::_init_additional_platform_info(Xml_generator &)
|
||||
{
|
||||
/* export subject info page as ROM module */
|
||||
_rom_fs.insert(new (core_mem_alloc())
|
||||
|
@ -16,87 +16,41 @@
|
||||
#include <kernel/kernel.h>
|
||||
#include <map_local.h>
|
||||
|
||||
#include <util/xml_generator.h>
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
|
||||
void Platform::_init_additional()
|
||||
void Platform::_init_additional_platform_info(Xml_generator &xml)
|
||||
{
|
||||
/* export x86 platform specific infos */
|
||||
xml.node("acpi", [&] () {
|
||||
uint32_t const revision = _boot_info().acpi_rsdp.revision;
|
||||
uint32_t const rsdt = _boot_info().acpi_rsdp.rsdt;
|
||||
uint64_t const xsdt = _boot_info().acpi_rsdp.xsdt;
|
||||
|
||||
unsigned const pages = 1;
|
||||
size_t const rom_size = pages << get_page_size_log2();
|
||||
void *phys_ptr = nullptr;
|
||||
void *virt_ptr = nullptr;
|
||||
const char *rom_name = "platform_info";
|
||||
if (revision && (rsdt || xsdt)) {
|
||||
xml.attribute("revision", revision);
|
||||
if (rsdt)
|
||||
xml.attribute("rsdt", String<32>(Hex(rsdt)));
|
||||
|
||||
if (!ram_alloc().alloc(get_page_size(), &phys_ptr)) {
|
||||
error("could not setup platform_info ROM - ram allocation error");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!region_alloc().alloc(rom_size, &virt_ptr)) {
|
||||
error("could not setup platform_info ROM - region allocation error");
|
||||
ram_alloc().free(phys_ptr);
|
||||
return;
|
||||
}
|
||||
|
||||
addr_t const phys_addr = reinterpret_cast<addr_t>(phys_ptr);
|
||||
addr_t const virt_addr = reinterpret_cast<addr_t>(virt_ptr);
|
||||
|
||||
if (!map_local(phys_addr, virt_addr, pages, Hw::PAGE_FLAGS_KERN_DATA)) {
|
||||
error("could not setup platform_info ROM - map error");
|
||||
region_alloc().free(virt_ptr);
|
||||
ram_alloc().free(phys_ptr);
|
||||
return;
|
||||
}
|
||||
|
||||
Genode::Xml_generator xml(reinterpret_cast<char *>(virt_addr),
|
||||
rom_size, rom_name, [&] ()
|
||||
{
|
||||
xml.node("acpi", [&] () {
|
||||
uint32_t const revision = _boot_info().acpi_rsdp.revision;
|
||||
uint32_t const rsdt = _boot_info().acpi_rsdp.rsdt;
|
||||
uint64_t const xsdt = _boot_info().acpi_rsdp.xsdt;
|
||||
|
||||
if (revision && (rsdt || xsdt)) {
|
||||
xml.attribute("revision", revision);
|
||||
if (rsdt)
|
||||
xml.attribute("rsdt", String<32>(Hex(rsdt)));
|
||||
|
||||
if (xsdt)
|
||||
xml.attribute("xsdt", String<32>(Hex(xsdt)));
|
||||
}
|
||||
});
|
||||
xml.node("boot", [&] () {
|
||||
xml.node("framebuffer", [&] () {
|
||||
Hw::Framebuffer const &boot_fb = _boot_info().framebuffer;
|
||||
xml.attribute("phys", String<32>(Hex(boot_fb.addr)));
|
||||
xml.attribute("width", boot_fb.width);
|
||||
xml.attribute("height", boot_fb.height);
|
||||
xml.attribute("bpp", boot_fb.bpp);
|
||||
xml.attribute("type", boot_fb.type);
|
||||
xml.attribute("pitch", boot_fb.pitch);
|
||||
});
|
||||
});
|
||||
xml.node("hardware", [&] () {
|
||||
xml.node("features", [&] () {
|
||||
xml.attribute("svm", false);
|
||||
xml.attribute("vmx", false);
|
||||
});
|
||||
if (xsdt)
|
||||
xml.attribute("xsdt", String<32>(Hex(xsdt)));
|
||||
}
|
||||
});
|
||||
xml.node("boot", [&] () {
|
||||
xml.node("framebuffer", [&] () {
|
||||
Hw::Framebuffer const &boot_fb = _boot_info().framebuffer;
|
||||
xml.attribute("phys", String<32>(Hex(boot_fb.addr)));
|
||||
xml.attribute("width", boot_fb.width);
|
||||
xml.attribute("height", boot_fb.height);
|
||||
xml.attribute("bpp", boot_fb.bpp);
|
||||
xml.attribute("type", boot_fb.type);
|
||||
xml.attribute("pitch", boot_fb.pitch);
|
||||
});
|
||||
});
|
||||
xml.node("hardware", [&] () {
|
||||
xml.node("features", [&] () {
|
||||
xml.attribute("svm", false);
|
||||
xml.attribute("vmx", false);
|
||||
});
|
||||
});
|
||||
|
||||
if (!unmap_local(virt_addr, pages)) {
|
||||
error("could not setup platform_info ROM - unmap error");
|
||||
return;
|
||||
}
|
||||
|
||||
region_alloc().free(virt_ptr);
|
||||
|
||||
_rom_fs.insert(
|
||||
new (core_mem_alloc()) Rom_module(phys_addr, rom_size, rom_name));
|
||||
}
|
||||
|
||||
|
||||
|
@ -684,6 +684,7 @@ Platform::Platform()
|
||||
pages << get_page_size_log2(),
|
||||
"platform_info", [&] ()
|
||||
{
|
||||
xml.node("kernel", [&] () { xml.attribute("name", "nova"); });
|
||||
xml.node("acpi", [&] () {
|
||||
|
||||
xml.attribute("revision", 2); /* XXX */
|
||||
|
@ -404,6 +404,7 @@ void Platform::_init_rom_modules()
|
||||
|
||||
tsc_freq const * boot_freq = reinterpret_cast<tsc_freq const *>(reinterpret_cast<addr_t>(element) + sizeof(* element));
|
||||
|
||||
xml.node("kernel", [&] () { xml.attribute("name", "sel4"); });
|
||||
xml.node("hardware", [&] () {
|
||||
xml.node("features", [&] () {
|
||||
#ifdef CONFIG_VTX
|
||||
|
Loading…
x
Reference in New Issue
Block a user