system loader: Initial work on new rasberrypi_arm loader
* Used routerboard loader as a base skel * May just be temporary if u-boot ever gets Raspberry Pi support
This commit is contained in:
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2003, Axel Dörfler, [email protected]. All rights reserved.
|
||||||
|
* Distributed under the terms of the OpenBeOS License.
|
||||||
|
* Copyright 2011-2012, Haiku Inc. All rights reserved.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
#ifndef KERNEL_BOOT_PLATFORM_PI_ARCH_H
|
||||||
|
#define KERNEL_BOOT_PLATFORM_PI_ARCH_H
|
||||||
|
|
||||||
|
|
||||||
|
#include <SupportDefs.h>
|
||||||
|
|
||||||
|
|
||||||
|
struct kernel_args;
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
/* memory management */
|
||||||
|
extern status_t arch_set_callback(void);
|
||||||
|
extern void *arch_mmu_allocate(void *address, size_t size, uint8 protection,
|
||||||
|
bool exactAddress);
|
||||||
|
extern status_t arch_mmu_free(void *address, size_t size);
|
||||||
|
extern status_t arch_mmu_init(void);
|
||||||
|
|
||||||
|
/* CPU */
|
||||||
|
extern status_t boot_arch_cpu_init(void);
|
||||||
|
|
||||||
|
/* kernel start */
|
||||||
|
status_t arch_start_kernel(struct kernel_args *kernelArgs, addr_t kernelEntry,
|
||||||
|
addr_t kernelStackTop);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* KERNEL_BOOT_PLATFORM_PI_ARCH_H */
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2009-2011, Haiku Inc. All rights reserved.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
#ifndef KERNEL_BOOT_PLATFORM_PI_KERNEL_ARGS_H
|
||||||
|
#define KERNEL_BOOT_PLATFORM_PI_KERNEL_ARGS_H
|
||||||
|
|
||||||
|
#ifndef KERNEL_BOOT_KERNEL_ARGS_H
|
||||||
|
# error This file is included from <boot/kernel_args.h> only
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// must match SMP_MAX_CPUS in arch_smp.h
|
||||||
|
#define MAX_BOOT_CPUS 1
|
||||||
|
#define MAX_PHYSICAL_MEMORY_RANGE 4
|
||||||
|
#define MAX_PHYSICAL_ALLOCATED_RANGE 8
|
||||||
|
#define MAX_VIRTUAL_ALLOCATED_RANGE 32
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
char dummy;
|
||||||
|
} platform_kernel_args;
|
||||||
|
|
||||||
|
#endif /* KERNEL_BOOT_PLATFORM_PI_KERNEL_ARGS_H */
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2009-2012, Haiku Inc. All rights reserved.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
#ifndef KERNEL_BOOT_PLATFORM_PI_STAGE2_H
|
||||||
|
#define KERNEL_BOOT_PLATFORM_PI_STAGE2_H
|
||||||
|
|
||||||
|
#ifndef KERNEL_BOOT_STAGE2_ARGS_H
|
||||||
|
# error This file is included from <boot/stage2_args.h> only
|
||||||
|
#endif
|
||||||
|
|
||||||
|
struct platform_stage2_args {
|
||||||
|
void *boot_tgz_data;
|
||||||
|
uint32 boot_tgz_size;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* KERNEL_BOOT_PLATFORM_PI_STAGE2_H */
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
SubDir HAIKU_TOP src system boot platform raspberrypi_arm ;
|
||||||
|
|
||||||
|
SubDirHdrs $(HAIKU_TOP) headers private kernel boot platform $(TARGET_BOOT_PLATFORM) ;
|
||||||
|
|
||||||
|
UsePrivateHeaders [ FDirName kernel disk_device_manager ] ;
|
||||||
|
UsePrivateHeaders [ FDirName graphics common ] ;
|
||||||
|
UsePrivateHeaders [ FDirName graphics vesa ] ;
|
||||||
|
UsePrivateHeaders [ FDirName storage ] ;
|
||||||
|
|
||||||
|
{
|
||||||
|
local defines = _BOOT_MODE ;
|
||||||
|
|
||||||
|
defines = [ FDefines $(defines) ] ;
|
||||||
|
SubDirCcFlags $(defines) ;
|
||||||
|
SubDirC++Flags $(defines) -fno-rtti ;
|
||||||
|
}
|
||||||
|
|
||||||
|
SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src add-ons accelerants common ] ;
|
||||||
|
|
||||||
|
local genericPlatformSources =
|
||||||
|
text_menu.cpp
|
||||||
|
# video_blit.cpp
|
||||||
|
# video_splash.cpp
|
||||||
|
;
|
||||||
|
|
||||||
|
KernelMergeObject boot_platform_raspberrypi_arm.o :
|
||||||
|
entry.S
|
||||||
|
start.c
|
||||||
|
console.cpp
|
||||||
|
cpu.cpp
|
||||||
|
debug.cpp
|
||||||
|
devices.cpp
|
||||||
|
keyboard.cpp
|
||||||
|
menu.cpp
|
||||||
|
mmu.cpp
|
||||||
|
serial.cpp
|
||||||
|
video.cpp
|
||||||
|
arch_start_kernel.S
|
||||||
|
|
||||||
|
$(genericPlatformSources)
|
||||||
|
: -fno-pic
|
||||||
|
: boot_platform_generic.a
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
SEARCH on [ FGristFiles $(genericPlatformSources) ]
|
||||||
|
= [ FDirName $(HAIKU_TOP) src system boot platform generic ] ;
|
||||||
|
|
||||||
|
|
||||||
|
# Tell the build system to where stage1.bin can be found, so it can be used
|
||||||
|
# elsewhere.
|
||||||
|
SEARCH on stage1.bin = $(SUBDIR) ;
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2011, Fran??ois Revol <revol@free.fr>.
|
||||||
|
* All rights reserved. Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <arch/arm/arch_cpu.h>
|
||||||
|
|
||||||
|
#include <asm_defs.h>
|
||||||
|
|
||||||
|
.text
|
||||||
|
|
||||||
|
/*
|
||||||
|
* status_t arch_start_kernel(struct kernel_args *kernelArgs,
|
||||||
|
* addr_t kernelEntry, addr_t kernelStackTop);
|
||||||
|
|
||||||
|
r0 - kernelArgs
|
||||||
|
r1 - kernelEntry
|
||||||
|
r2 - kernelStackTop
|
||||||
|
*/
|
||||||
|
FUNCTION(arch_start_kernel):
|
||||||
|
|
||||||
|
// set the kernel stack
|
||||||
|
mov sp,r2
|
||||||
|
|
||||||
|
// set up kernel _start args
|
||||||
|
//mov r0,r0 // kernelArgs
|
||||||
|
mov r4,r1
|
||||||
|
mov r1,#0 // currentCPU=0
|
||||||
|
|
||||||
|
// call the kernel
|
||||||
|
mov pc,r4
|
||||||
|
|
||||||
|
// return
|
||||||
|
mov r0,#-1 // B_ERROR
|
||||||
|
mov pc,lr
|
||||||
|
|
||||||
|
FUNCTION_END(arch_start_kernel)
|
||||||
@@ -0,0 +1,131 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2009 Jonas Sundström, [email protected]
|
||||||
|
* All rights reserved. Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "console.h"
|
||||||
|
|
||||||
|
#include <SupportDefs.h>
|
||||||
|
|
||||||
|
#include "keyboard.h"
|
||||||
|
|
||||||
|
|
||||||
|
class Console : public ConsoleNode {
|
||||||
|
public:
|
||||||
|
Console();
|
||||||
|
|
||||||
|
virtual ssize_t ReadAt(void* cookie, off_t pos, void* buffer,
|
||||||
|
size_t bufferSize);
|
||||||
|
virtual ssize_t WriteAt(void* cookie, off_t pos,
|
||||||
|
const void* buffer, size_t bufferSize);
|
||||||
|
};
|
||||||
|
|
||||||
|
static uint32 sScreenWidth = 80;
|
||||||
|
static uint32 sScreenHeight = 25;
|
||||||
|
static uint32 sScreenOffset = 0;
|
||||||
|
static uint16 sColor = 0x0f00;
|
||||||
|
|
||||||
|
static Console sInput, sOutput;
|
||||||
|
|
||||||
|
FILE* stdin;
|
||||||
|
FILE* stdout;
|
||||||
|
FILE* stderr;
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
|
Console::Console()
|
||||||
|
: ConsoleNode()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ssize_t
|
||||||
|
Console::ReadAt(void* cookie, off_t pos, void* buffer, size_t bufferSize)
|
||||||
|
{
|
||||||
|
#warning IMPLEMENT ReadAt
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ssize_t
|
||||||
|
Console::WriteAt(void* cookie, off_t /*pos*/, const void* buffer,
|
||||||
|
size_t bufferSize)
|
||||||
|
{
|
||||||
|
#warning IMPLEMENT WriteAt
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
console_clear_screen(void)
|
||||||
|
{
|
||||||
|
#warning IMPLEMENT console_clear_screen
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int32
|
||||||
|
console_width(void)
|
||||||
|
{
|
||||||
|
#warning IMPLEMENT console_width
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int32
|
||||||
|
console_height(void)
|
||||||
|
{
|
||||||
|
#warning IMPLEMENT console_height
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
console_set_cursor(int32 x, int32 y)
|
||||||
|
{
|
||||||
|
#warning IMPLEMENT console_set_cursor
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
console_set_color(int32 foreground, int32 background)
|
||||||
|
{
|
||||||
|
#warning IMPLEMENT console_set_color
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
console_wait_for_key(void)
|
||||||
|
{
|
||||||
|
#warning IMPLEMENT console_wait_for_key
|
||||||
|
union key key;
|
||||||
|
return key.code.ascii;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
console_show_cursor(void)
|
||||||
|
{
|
||||||
|
#warning IMPLEMENT console_show_cursor
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
console_hide_cursor(void)
|
||||||
|
{
|
||||||
|
#warning IMPLEMENT console_hide_cursor
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
console_init(void)
|
||||||
|
{
|
||||||
|
#warning IMPLEMENT console_init
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2009 Jonas Sundström, [email protected]
|
||||||
|
* All rights reserved. Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
#ifndef _SYSTEM_BOOT_PLATFORM_STUB_CONSOLE_H
|
||||||
|
#define _SYSTEM_BOOT_PLATFORM_STUB_CONSOLE_H
|
||||||
|
|
||||||
|
#include <boot/platform/generic/text_console.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern status_t console_init(void);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _SYSTEM_BOOT_PLATFORM_STUB_CONSOLE_H */
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2009 Jonas Sundström, jonas@kirilla.com
|
||||||
|
* All rights reserved. Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "cpu.h"
|
||||||
|
|
||||||
|
#include <OS.h>
|
||||||
|
#include <arch/cpu.h>
|
||||||
|
#include <arch_kernel.h>
|
||||||
|
#include <arch_system_info.h>
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
|
static status_t
|
||||||
|
check_cpu_features()
|
||||||
|
{
|
||||||
|
#warning IMPLEMENT check_cpu_features
|
||||||
|
return B_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
|
extern "C" void
|
||||||
|
spin(bigtime_t microseconds)
|
||||||
|
{
|
||||||
|
#warning IMPLEMENT spin
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
extern "C" void
|
||||||
|
cpu_init()
|
||||||
|
{
|
||||||
|
#warning IMPLEMENT cpu_init
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2009 Jonas Sundström, jonas@kirilla.com
|
||||||
|
* All rights reserved. Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
#ifndef _SYSTEM_BOOT_PLATFORM_PI_CPU_H
|
||||||
|
#define _SYSTEM_BOOT_PLATFORM_PI_CPU_H
|
||||||
|
|
||||||
|
|
||||||
|
#include <SupportDefs.h>
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern void cpu_init(void);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _SYSTEM_BOOT_PLATFORM_ROUTERBOARD_MIPSEL_CPU_H */
|
||||||
|
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2009 Jonas Sundström, jonas@kirilla.com
|
||||||
|
* All rights reserved. Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <boot/platform.h>
|
||||||
|
#include <boot/stdio.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
panic(const char* format, ...)
|
||||||
|
{
|
||||||
|
#warning IMPLEMENT panic
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
dprintf(const char* format, ...)
|
||||||
|
{
|
||||||
|
#warning IMPLEMENT dprintf
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
char*
|
||||||
|
platform_debug_get_log_buffer(size_t* _size)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2009 Jonas Sundström, jonas@kirilla.com
|
||||||
|
* All rights reserved. Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <KernelExport.h>
|
||||||
|
#include <boot/platform.h>
|
||||||
|
#include <boot/partitions.h>
|
||||||
|
#include <boot/stdio.h>
|
||||||
|
#include <boot/stage2.h>
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
platform_add_boot_device(struct stage2_args* args, NodeList* devicesList)
|
||||||
|
{
|
||||||
|
#warning IMPLEMENT platform_add_boot_device
|
||||||
|
return B_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
platform_get_boot_partition(struct stage2_args* args, Node* bootDevice,
|
||||||
|
NodeList* list, boot::Partition** _partition)
|
||||||
|
{
|
||||||
|
#warning IMPLEMENT platform_get_boot_partition
|
||||||
|
return B_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
platform_add_block_devices(stage2_args* args, NodeList* devicesList)
|
||||||
|
{
|
||||||
|
#warning IMPLEMENT platform_add_block_devices
|
||||||
|
return B_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
platform_register_boot_device(Node* device)
|
||||||
|
{
|
||||||
|
#warning IMPLEMENT platform_register_boot_device
|
||||||
|
return B_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
.globl _start
|
||||||
|
_start:
|
||||||
|
|
||||||
|
/* Set up 1MB C Stack Space */
|
||||||
|
mov sp, #0x100000
|
||||||
|
|
||||||
|
mov r4,#0
|
||||||
|
/* Start loader */
|
||||||
|
b pi_start
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2009 Jonas Sundström, jonas@kirilla.com
|
||||||
|
* All rights reserved. Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "keyboard.h"
|
||||||
|
|
||||||
|
#include <boot/platform.h>
|
||||||
|
|
||||||
|
|
||||||
|
static uint16
|
||||||
|
check_for_key(void)
|
||||||
|
{
|
||||||
|
#warning IMPLEMENT check_for_key
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
extern "C" void
|
||||||
|
clear_key_buffer(void)
|
||||||
|
{
|
||||||
|
#warning IMPLEMENT clear_key_buffer
|
||||||
|
while (check_for_key() != 0)
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
extern "C" union key
|
||||||
|
wait_for_key(void)
|
||||||
|
{
|
||||||
|
#warning IMPLEMENT wait_for_key
|
||||||
|
union key key;
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
extern "C" uint32
|
||||||
|
check_for_boot_keys(void)
|
||||||
|
{
|
||||||
|
#warning IMPLEMENT check_for_boot_keys
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2009 Jonas Sundström, jonas@kirilla.com
|
||||||
|
* All rights reserved. Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
#ifndef _SYSTEM_BOOT_PLATFORM_PI_KEYBOARD_H
|
||||||
|
#define _SYSTEM_BOOT_PLATFORM_PI_KEYBOARD_H
|
||||||
|
|
||||||
|
|
||||||
|
#include <SupportDefs.h>
|
||||||
|
|
||||||
|
|
||||||
|
union key {
|
||||||
|
uint16 ax;
|
||||||
|
struct {
|
||||||
|
uint8 ascii;
|
||||||
|
uint8 bios;
|
||||||
|
} code;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern void clear_key_buffer(void);
|
||||||
|
extern union key wait_for_key(void);
|
||||||
|
extern uint32 check_for_boot_keys(void);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _SYSTEM_BOOT_PLATFORM_PI_KEYBOARD_H */
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2009 Jonas Sundström, jonas@kirilla.com
|
||||||
|
* All rights reserved. Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <boot/menu.h>
|
||||||
|
#include <boot/platform/generic/text_menu.h>
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
platform_add_menus(Menu* menu)
|
||||||
|
{
|
||||||
|
MenuItem* item;
|
||||||
|
|
||||||
|
switch (menu->Type()) {
|
||||||
|
case MAIN_MENU:
|
||||||
|
case SAFE_MODE_MENU:
|
||||||
|
menu->AddItem(item = new(nothrow) MenuItem("A menu item"));
|
||||||
|
item->SetType(MENU_ITEM_MARKABLE);
|
||||||
|
item->SetData(0);
|
||||||
|
item->SetHelpText("A helpful text.");
|
||||||
|
|
||||||
|
menu->AddItem(item = new(nothrow) MenuItem("Another menu item"));
|
||||||
|
item->SetHelpText("Some more helpful text.");
|
||||||
|
item->SetType(MENU_ITEM_MARKABLE);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
platform_update_menu_item(Menu* menu, MenuItem* item)
|
||||||
|
{
|
||||||
|
platform_generic_update_text_menu_item(menu, item);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
platform_run_menu(Menu* menu)
|
||||||
|
{
|
||||||
|
platform_generic_run_text_menu(menu);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
platform_get_user_input_text(Menu *menu, MenuItem *item, char *buffer,
|
||||||
|
size_t bufferSize)
|
||||||
|
{
|
||||||
|
platform_generic_get_user_input_text(menu, item, buffer, bufferSize);
|
||||||
|
}
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2009 Jonas Sundström, jonas@kirilla.com
|
||||||
|
* All rights reserved. Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "mmu.h"
|
||||||
|
|
||||||
|
#include <boot/platform.h>
|
||||||
|
#include <boot/stdio.h>
|
||||||
|
#include <boot/kernel_args.h>
|
||||||
|
#include <boot/stage2.h>
|
||||||
|
#include <arch/cpu.h>
|
||||||
|
#include <arch_kernel.h>
|
||||||
|
#include <kernel.h>
|
||||||
|
|
||||||
|
#include <OS.h>
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
|
extern "C" addr_t
|
||||||
|
mmu_map_physical_memory(addr_t physicalAddress, size_t size, uint32 flags)
|
||||||
|
{
|
||||||
|
#warning IMPLEMENT mmu_map_physical_memory
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
extern "C" void*
|
||||||
|
mmu_allocate(void* virtualAddress, size_t size)
|
||||||
|
{
|
||||||
|
#warning IMPLEMENT mmu_allocate
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
extern "C" void
|
||||||
|
mmu_free(void* virtualAddress, size_t size)
|
||||||
|
{
|
||||||
|
#warning IMPLEMENT mmu_free
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
extern "C" void
|
||||||
|
mmu_init_for_kernel(void)
|
||||||
|
{
|
||||||
|
#warning IMPLEMENT mmu_init_for_kernel
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
extern "C" void
|
||||||
|
mmu_init(void)
|
||||||
|
{
|
||||||
|
#warning IMPLEMENT mmu_init
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
|
extern "C" status_t
|
||||||
|
platform_allocate_region(void** _address, size_t size, uint8 protection,
|
||||||
|
bool /*exactAddress*/)
|
||||||
|
{
|
||||||
|
#warning IMPLEMENT platform_allocate_region
|
||||||
|
return B_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
extern "C" status_t
|
||||||
|
platform_free_region(void* address, size_t size)
|
||||||
|
{
|
||||||
|
#warning IMPLEMENT platform_free_region
|
||||||
|
return B_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
platform_release_heap(struct stage2_args* args, void* base)
|
||||||
|
{
|
||||||
|
#warning IMPLEMENT platform_release_heap
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
platform_init_heap(struct stage2_args* args, void** _base, void** _top)
|
||||||
|
{
|
||||||
|
#warning IMPLEMENT platform_init_heap
|
||||||
|
return B_ERROR;
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2009 Jonas Sundström, jonas@kirilla.com
|
||||||
|
* All rights reserved. Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
#ifndef _SYSTEM_BOOT_PLATFORM_PI_MMU_H
|
||||||
|
#define _SYSTEM_BOOT_PLATFORM_PI_MMU_H
|
||||||
|
|
||||||
|
|
||||||
|
#include <SupportDefs.h>
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern void mmu_init(void);
|
||||||
|
extern void mmu_init_for_kernel(void);
|
||||||
|
|
||||||
|
extern addr_t mmu_map_physical_memory(addr_t physicalAddress, size_t size,
|
||||||
|
uint32 flags);
|
||||||
|
|
||||||
|
extern void* mmu_allocate(void* virtualAddress, size_t size);
|
||||||
|
extern void mmu_free(void* virtualAddress, size_t size);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _SYSTEM_BOOT_PLATFORM_PI_MMU_H */
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2009 Jonas Sundström, jonas@kirilla.com
|
||||||
|
* All rights reserved. Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "serial.h"
|
||||||
|
|
||||||
|
#include <boot/platform.h>
|
||||||
|
#include <arch/cpu.h>
|
||||||
|
#include <boot/stage2.h>
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
serial_putc(char c)
|
||||||
|
{
|
||||||
|
#warning IMPLEMENT serial_putc
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
extern "C" void
|
||||||
|
serial_puts(const char* string, size_t size)
|
||||||
|
{
|
||||||
|
#warning IMPLEMENT serial_puts
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
extern "C" void
|
||||||
|
serial_disable(void)
|
||||||
|
{
|
||||||
|
#warning IMPLEMENT serial_disable
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
extern "C" void
|
||||||
|
serial_enable(void)
|
||||||
|
{
|
||||||
|
#warning IMPLEMENT serial_enable
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
extern "C" void
|
||||||
|
serial_cleanup(void)
|
||||||
|
{
|
||||||
|
#warning IMPLEMENT serial_cleanup
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
extern "C" void
|
||||||
|
serial_init(void)
|
||||||
|
{
|
||||||
|
#warning IMPLEMENT serial_init
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2009 Jonas Sundström, jonas@kirilla.com
|
||||||
|
* All rights reserved. Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
#ifndef _SYSTEM_BOOT_PLATFORM_PI_SERIAL_H
|
||||||
|
#define _SYSTEM_BOOT_PLATFORM_PI_SERIAL_H
|
||||||
|
|
||||||
|
|
||||||
|
#include <SupportDefs.h>
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern void serial_init(void);
|
||||||
|
extern void serial_cleanup(void);
|
||||||
|
extern void serial_puts(const char *string, size_t size);
|
||||||
|
extern void serial_disable(void);
|
||||||
|
extern void serial_enable(void);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* _SYSTEM_BOOT_PLATFORM_ROUTERBOARD_MIPSEL_SERIAL_H */
|
||||||
@@ -0,0 +1,117 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2009 Jonas Sundström, jonas@kirilla.com
|
||||||
|
* Copyright 2003-2008 Axel Dörfler, axeld@pinc-software.de
|
||||||
|
* All rights reserved. Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "serial.h"
|
||||||
|
#include "console.h"
|
||||||
|
#include "cpu.h"
|
||||||
|
#include "mmu.h"
|
||||||
|
#include "keyboard.h"
|
||||||
|
|
||||||
|
#include <KernelExport.h>
|
||||||
|
#include <boot/platform.h>
|
||||||
|
#include <boot/heap.h>
|
||||||
|
#include <boot/stage2.h>
|
||||||
|
#include <arch/cpu.h>
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
|
#define HEAP_SIZE 65536
|
||||||
|
|
||||||
|
|
||||||
|
// GCC defined globals
|
||||||
|
extern void (*__ctor_list)(void);
|
||||||
|
extern void (*__ctor_end)(void);
|
||||||
|
extern uint8 __bss_start;
|
||||||
|
extern uint8 _end;
|
||||||
|
|
||||||
|
extern int main(stage2_args *args);
|
||||||
|
void _start(void);
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
clear_bss(void)
|
||||||
|
{
|
||||||
|
/* TODO: fix boot_loader_routerboard_mipsel.ld
|
||||||
|
* so this code works, or find a workaround.
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
memset(&__bss_start, 0, &_end - &__bss_start);
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
call_ctors(void)
|
||||||
|
{
|
||||||
|
/* TODO: fix boot_loader_routerboard_mipsel.ld
|
||||||
|
* so this code works, or find a workaround.
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
void (**f)(void);
|
||||||
|
|
||||||
|
for (f = &__ctor_list; f < &__ctor_end; f++) {
|
||||||
|
(**f)();
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
abort(void)
|
||||||
|
{
|
||||||
|
panic("abort");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint32
|
||||||
|
platform_boot_options(void)
|
||||||
|
{
|
||||||
|
#warning IMPLEMENT platform_boot_options
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
platform_start_kernel(void)
|
||||||
|
{
|
||||||
|
#warning IMPLEMENT platform_start_kernel
|
||||||
|
panic("kernel returned!\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
platform_exit(void)
|
||||||
|
{
|
||||||
|
#warning IMPLEMENT platform_exit
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
pi_start(void)
|
||||||
|
{
|
||||||
|
#warning IMPLEMENT _start
|
||||||
|
stage2_args args;
|
||||||
|
|
||||||
|
clear_bss();
|
||||||
|
call_ctors();
|
||||||
|
|
||||||
|
cpu_init();
|
||||||
|
mmu_init();
|
||||||
|
serial_init();
|
||||||
|
console_init();
|
||||||
|
serial_enable();
|
||||||
|
|
||||||
|
args.heap_size = HEAP_SIZE;
|
||||||
|
args.arguments = NULL;
|
||||||
|
|
||||||
|
main(&args);
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2009 Jonas Sundström, jonas@kirilla.com
|
||||||
|
* All rights reserved. Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <SupportDefs.h>
|
||||||
|
|
||||||
|
|
||||||
|
extern "C" void
|
||||||
|
platform_set_palette(const uint8* palette)
|
||||||
|
{
|
||||||
|
#warning IMPLEMENT platform_set_palette
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
extern "C" void
|
||||||
|
platform_switch_to_logo(void)
|
||||||
|
{
|
||||||
|
#warning IMPLEMENT platform_switch_to_logo
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
extern "C" void
|
||||||
|
platform_switch_to_text_mode(void)
|
||||||
|
{
|
||||||
|
#warning IMPLEMENT platform_switch_to_text_mode
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
extern "C" status_t
|
||||||
|
platform_init_video(void)
|
||||||
|
{
|
||||||
|
#warning IMPLEMENT platform_init_video
|
||||||
|
return B_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
SubDir HAIKU_TOP src system kernel platform raspberrypi_arm ;
|
||||||
|
|
||||||
|
SubDirCcFlags $(TARGET_KERNEL_PIC_CCFLAGS) ;
|
||||||
|
SubDirC++Flags $(TARGET_KERNEL_PIC_CCFLAGS) ;
|
||||||
|
|
||||||
|
KernelMergeObject kernel_platform_raspberrypi_arm.o :
|
||||||
|
platform.cpp
|
||||||
|
;
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
/*
|
||||||
|
Just a dummy. No BIOS services are required in the kernel.
|
||||||
|
*/
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
|
||||||
|
OUTPUT_ARCH(arm)
|
||||||
|
|
||||||
|
ENTRY(_start)
|
||||||
|
SECTIONS
|
||||||
|
{
|
||||||
|
. = BOARD_LOADER_BASE;
|
||||||
|
|
||||||
|
/* text/read-only data */
|
||||||
|
.text : { *(.text .gnu.linkonce.t.*) }
|
||||||
|
|
||||||
|
. = ALIGN(0x4);
|
||||||
|
__ctor_list = .;
|
||||||
|
.ctors : { *(.ctors) }
|
||||||
|
__ctor_end = .;
|
||||||
|
|
||||||
|
.rodata : { *(.rodata .rodata.*) }
|
||||||
|
|
||||||
|
/* writable data */
|
||||||
|
. = ALIGN(0x1000);
|
||||||
|
__data_start = .;
|
||||||
|
.data : { *(.data .gnu.linkonce.d.*) }
|
||||||
|
|
||||||
|
/* exception unwinding - should really not be needed! */
|
||||||
|
__exidx_start = .;
|
||||||
|
.ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) }
|
||||||
|
__exidx_end = .;
|
||||||
|
|
||||||
|
/* uninitialized data (in same segment as writable data) */
|
||||||
|
__bss_start = .;
|
||||||
|
.bss : { *(.bss) }
|
||||||
|
|
||||||
|
. = ALIGN(0x1000);
|
||||||
|
_end = . ;
|
||||||
|
/* Stabs debugging sections. */
|
||||||
|
.stab 0 : { *(.stab) }
|
||||||
|
.stabstr 0 : { *(.stabstr) }
|
||||||
|
/* DWARF debug sections.
|
||||||
|
Symbols in the DWARF debugging sections are relative to the beginning
|
||||||
|
of the section so we begin them at 0. */
|
||||||
|
/* DWARF 1 */
|
||||||
|
.debug 0 : { *(.debug) }
|
||||||
|
.line 0 : { *(.line) }
|
||||||
|
/* GNU DWARF 1 extensions */
|
||||||
|
.debug_srcinfo 0 : { *(.debug_srcinfo) }
|
||||||
|
.debug_sfnames 0 : { *(.debug_sfnames) }
|
||||||
|
/* DWARF 1.1 and DWARF 2 */
|
||||||
|
.debug_aranges 0 : { *(.debug_aranges) }
|
||||||
|
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||||
|
/* DWARF 2 */
|
||||||
|
.debug_info 0 : { *(.debug_info) }
|
||||||
|
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||||
|
.debug_line 0 : { *(.debug_line) }
|
||||||
|
.debug_frame 0 : { *(.debug_frame) }
|
||||||
|
.debug_str 0 : { *(.debug_str) }
|
||||||
|
.debug_loc 0 : { *(.debug_loc) }
|
||||||
|
.debug_macinfo 0 : { *(.debug_macinfo) }
|
||||||
|
/* SGI/MIPS DWARF 2 extensions */
|
||||||
|
.debug_weaknames 0 : { *(.debug_weaknames) }
|
||||||
|
.debug_funcnames 0 : { *(.debug_funcnames) }
|
||||||
|
.debug_typenames 0 : { *(.debug_typenames) }
|
||||||
|
.debug_varnames 0 : { *(.debug_varnames) }
|
||||||
|
/* These must appear regardless of . */
|
||||||
|
|
||||||
|
/* Strip unnecessary stuff */
|
||||||
|
/* /DISCARD/ : { *(.comment .note .eh_frame .dtors .stab .stabstr .debug*) }*/
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user