hw: add mbi2 framebuffer support

Issue #2555
This commit is contained in:
Alexander Boettcher
2017-11-18 15:53:02 +01:00
committed by Christian Helmuth
parent e1ac124a4d
commit 858f5732ba
8 changed files with 72 additions and 7 deletions

View File

@ -197,7 +197,8 @@ Platform::Platform()
*construct_at<Boot_info>(bi_base, (addr_t)&core_pd->table,
(addr_t)&core_pd->array,
core_pd->mappings, boot_modules,
board.core_mmio, board.acpi_rsdp);
board.core_mmio, board.acpi_rsdp,
board.framebuffer);
/* add all left RAM to bootinfo */
ram_alloc.for_each_free_region([&] (Memory_region const & r) {

View File

@ -46,6 +46,7 @@ class Bootstrap::Platform
Memory_region_array late_ram_regions;
Mmio_space const core_mmio;
Hw::Acpi_rsdp acpi_rsdp;
Hw::Framebuffer framebuffer;
Board();
};

View File

@ -30,8 +30,10 @@ class Genode::Multiboot2_info : Mmio
struct Type : Register <0x00, 32>
{
enum { END = 0, MEMORY = 6, ACPI_RSDP_V1 = 14,
ACPI_RSDP_V2 = 15 };
enum {
END = 0, MEMORY = 6, FRAMEBUFFER = 8,
ACPI_RSDP_V1 = 14, ACPI_RSDP_V2 = 15
};
};
struct Size : Register <0x04, 32> { };
@ -54,8 +56,8 @@ class Genode::Multiboot2_info : Mmio
Multiboot2_info(addr_t mbi) : Mmio(mbi) { }
template <typename FUNC_MEM, typename FUNC_ACPI>
void for_each_tag(FUNC_MEM mem_fn, FUNC_ACPI acpi_fn)
template <typename FUNC_MEM, typename FUNC_ACPI, typename FUNC_FB>
void for_each_tag(FUNC_MEM mem_fn, FUNC_ACPI acpi_fn, FUNC_FB fb_fn)
{
addr_t const size = read<Multiboot2_info::Size>();
@ -95,6 +97,15 @@ class Genode::Multiboot2_info : Mmio
acpi_fn(*rsdp);
}
if (tag.read<Tag::Type>() == Tag::Type::FRAMEBUFFER) {
size_t const sizeof_tag = 1UL << Tag::LOG2_SIZE;
addr_t const fb_addr = tag_addr + sizeof_tag;
Hw::Framebuffer const * fb = reinterpret_cast<Hw::Framebuffer *>(fb_addr);
if (sizeof(*fb) <= tag.read<Tag::Size>() - sizeof_tag)
fb_fn(*fb);
}
tag_addr += align_addr(tag.read<Tag::Size>(), Tag::LOG2_SIZE);
}
}

View File

@ -80,6 +80,9 @@ Bootstrap::Platform::Board::Board()
/* prefer higher acpi revisions */
if (!acpi_rsdp.valid() || acpi_rsdp.revision < rsdp.revision)
acpi_rsdp = rsdp;
},
[&] (Hw::Framebuffer const &fb) {
framebuffer = fb;
});
return;