mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-18 02:40:08 +00:00
parent
f42f946f3b
commit
826c81ac18
@ -3,8 +3,6 @@
|
||||
* \author Norman Feske
|
||||
* \author Reto Buerki
|
||||
* \date 2013-04-05
|
||||
*
|
||||
* XXX dimension allocators according to the available physical memory
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -21,16 +19,6 @@
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
Native_region * Platform::_ram_regions(unsigned const i)
|
||||
{
|
||||
static Native_region _regions[] =
|
||||
{
|
||||
{ 2*1024*1024, 1024*1024*254 }
|
||||
};
|
||||
return i < sizeof(_regions)/sizeof(_regions[0]) ? &_regions[i] : 0;
|
||||
}
|
||||
|
||||
|
||||
void Platform::_init_io_port_alloc()
|
||||
{
|
||||
_io_port_alloc.add_range(0, 0x10000);
|
||||
@ -55,6 +43,10 @@ void Platform::_init_io_mem_alloc()
|
||||
_io_mem_alloc.add_range(0, ~0x0UL);
|
||||
alloc_exclude_regions(&_io_mem_alloc, _ram_regions);
|
||||
alloc_exclude_regions(&_io_mem_alloc, _core_only_ram_regions);
|
||||
alloc_exclude_regions(&_io_mem_alloc, _core_only_mmio_regions);
|
||||
|
||||
/* exclude all mmio regions from virt allocator of core */
|
||||
alloc_exclude_regions(_core_mem_alloc.virt_alloc(), _core_only_mmio_regions);
|
||||
}
|
||||
|
||||
|
||||
|
@ -91,6 +91,9 @@
|
||||
leaq _stack_high@GOTPCREL(%rip),%rax
|
||||
movq (%rax), %rsp
|
||||
|
||||
movq __initial_bx@GOTPCREL(%rip),%rax
|
||||
movq %rbx, (%rax)
|
||||
|
||||
/* uniprocessor kernel-initialization which activates multiprocessor */
|
||||
call init_kernel_up
|
||||
|
||||
@ -121,3 +124,6 @@
|
||||
.p2align 8
|
||||
.space 32 * 1024
|
||||
_stack_high:
|
||||
.globl __initial_bx
|
||||
__initial_bx:
|
||||
.space 8
|
||||
|
@ -30,3 +30,13 @@ Native_region * Platform::_core_only_mmio_regions(unsigned const i)
|
||||
}
|
||||
|
||||
void Platform::setup_irq_mode(unsigned, unsigned, unsigned) { }
|
||||
|
||||
|
||||
Native_region * Platform::_ram_regions(unsigned const i)
|
||||
{
|
||||
static Native_region _regions[] =
|
||||
{
|
||||
{ 2*1024*1024, 1024*1024*254 }
|
||||
};
|
||||
return i < sizeof(_regions)/sizeof(_regions[0]) ? &_regions[i] : 0;
|
||||
}
|
||||
|
@ -16,17 +16,29 @@
|
||||
#include <board.h>
|
||||
#include <pic.h>
|
||||
#include <kernel/kernel.h>
|
||||
#include <multiboot.h>
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
/* contains physical pointer to multiboot */
|
||||
extern "C" Genode::addr_t __initial_bx;
|
||||
|
||||
|
||||
Native_region * Platform::_core_only_mmio_regions(unsigned const i)
|
||||
{
|
||||
static Native_region _regions[] =
|
||||
{
|
||||
{ Board::MMIO_LAPIC_BASE, Board::MMIO_LAPIC_SIZE },
|
||||
{ Board::MMIO_IOAPIC_BASE, Board::MMIO_IOAPIC_SIZE },
|
||||
{ 0, 0}
|
||||
};
|
||||
return i < sizeof(_regions)/sizeof(_regions[0]) ? &_regions[i] : 0;
|
||||
|
||||
unsigned const max = sizeof(_regions) / sizeof(_regions[0]);
|
||||
|
||||
if (!_regions[max - 1].size)
|
||||
_regions[max - 1] = { __initial_bx & ~0xFFFUL, get_page_size() };
|
||||
|
||||
return i < max ? &_regions[i] : nullptr;
|
||||
}
|
||||
|
||||
|
||||
@ -35,3 +47,33 @@ void Platform::setup_irq_mode(unsigned irq_number, unsigned trigger,
|
||||
{
|
||||
Kernel::pic()->ioapic.setup_irq_mode(irq_number, trigger, polarity);
|
||||
}
|
||||
|
||||
|
||||
Native_region * Platform::_ram_regions(unsigned const i)
|
||||
{
|
||||
static Native_region _regions[16];
|
||||
|
||||
Multiboot_info::Mmap v = Genode::Multiboot_info(__initial_bx).phys_ram(i);
|
||||
if (!v.base)
|
||||
return nullptr;
|
||||
|
||||
Multiboot_info::Mmap::Addr::access_t base = v.read<Multiboot_info::Mmap::Addr>();
|
||||
Multiboot_info::Mmap::Length::access_t size = v.read<Multiboot_info::Mmap::Length>();
|
||||
|
||||
unsigned const max = sizeof(_regions) / sizeof(_regions[0]);
|
||||
|
||||
if (i < max && _regions[i].size == 0) {
|
||||
if (base == 0 && size >= get_page_size()) {
|
||||
/*
|
||||
* Exclude first physical page, so that it will become part of the
|
||||
* MMIO allocator. The framebuffer requests this page as MMIO.
|
||||
*/
|
||||
base = get_page_size();
|
||||
size -= get_page_size();
|
||||
}
|
||||
_regions[i] = { base, size };
|
||||
} else if (i >= max)
|
||||
PWRN("physical ram region 0x%llx+0x%llx will be not used", base, size);
|
||||
|
||||
return i < max ? &_regions[i] : nullptr;
|
||||
}
|
||||
|
@ -51,10 +51,6 @@ proc run_power_on { } {
|
||||
}
|
||||
if {[have_spec vpb926]} { append qemu_args " -M versatilepb -m 128 " }
|
||||
if {[have_spec zynq_qemu]} { append qemu_args " -M xilinx-zynq-a9 -cpu cortex-a9 -m 256 " }
|
||||
if {[have_spec hw_x86_64]} {
|
||||
regsub -all {\-m ([0-9])+} $qemu_args "" qemu_args
|
||||
append qemu_args " -m 512 "
|
||||
}
|
||||
|
||||
# add devices for specific platforms
|
||||
if {[have_spec zynq] && [have_spec cadence_gem]} { append qemu_args " -net nic,model=cadence_gem" }
|
||||
|
Loading…
Reference in New Issue
Block a user