From 8e8130d1f0ec706a252ab5f255982ad91e955950 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Sundstr=C3=B6m?= Date: Sat, 22 Aug 2009 01:48:18 +0000 Subject: [PATCH] Adding routerboard_mipsel platform stubs and linker script. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32594 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- build/jam/BuildSetup | 7 +- .../routerboard_mipsel/platform_arch.h | 40 ++++++ .../routerboard_mipsel/platform_kernel_args.h | 27 ++++ .../routerboard_mipsel/platform_stage2_args.h | 18 +++ .../boot/platform/routerboard_mipsel/Jamfile | 50 ++++++++ .../platform/routerboard_mipsel/console.cpp | 116 ++++++++++++++++++ .../platform/routerboard_mipsel/console.h | 21 ++++ .../boot/platform/routerboard_mipsel/cpu.cpp | 40 ++++++ .../boot/platform/routerboard_mipsel/cpu.h | 23 ++++ .../boot/platform/routerboard_mipsel/debug.c | 24 ++++ .../platform/routerboard_mipsel/devices.cpp | 47 +++++++ .../platform/routerboard_mipsel/keyboard.cpp | 44 +++++++ .../platform/routerboard_mipsel/keyboard.h | 34 +++++ .../boot/platform/routerboard_mipsel/menu.cpp | 46 +++++++ .../boot/platform/routerboard_mipsel/mmu.cpp | 95 ++++++++++++++ .../boot/platform/routerboard_mipsel/mmu.h | 30 +++++ .../platform/routerboard_mipsel/serial.cpp | 56 +++++++++ .../boot/platform/routerboard_mipsel/serial.h | 27 ++++ .../boot/platform/routerboard_mipsel/start.c | 110 +++++++++++++++++ .../platform/routerboard_mipsel/video.cpp | 37 ++++++ .../platform/routerboard_mipsel/Jamfile | 9 ++ .../platform/routerboard_mipsel/platform.cpp | 3 + .../mipsel/boot_loader_routerboard_mipsel.ld | 35 ++++++ 23 files changed, 936 insertions(+), 3 deletions(-) create mode 100644 headers/private/kernel/boot/platform/routerboard_mipsel/platform_arch.h create mode 100644 headers/private/kernel/boot/platform/routerboard_mipsel/platform_kernel_args.h create mode 100644 headers/private/kernel/boot/platform/routerboard_mipsel/platform_stage2_args.h create mode 100644 src/system/boot/platform/routerboard_mipsel/Jamfile create mode 100644 src/system/boot/platform/routerboard_mipsel/console.cpp create mode 100644 src/system/boot/platform/routerboard_mipsel/console.h create mode 100644 src/system/boot/platform/routerboard_mipsel/cpu.cpp create mode 100644 src/system/boot/platform/routerboard_mipsel/cpu.h create mode 100644 src/system/boot/platform/routerboard_mipsel/debug.c create mode 100644 src/system/boot/platform/routerboard_mipsel/devices.cpp create mode 100644 src/system/boot/platform/routerboard_mipsel/keyboard.cpp create mode 100644 src/system/boot/platform/routerboard_mipsel/keyboard.h create mode 100644 src/system/boot/platform/routerboard_mipsel/menu.cpp create mode 100644 src/system/boot/platform/routerboard_mipsel/mmu.cpp create mode 100644 src/system/boot/platform/routerboard_mipsel/mmu.h create mode 100644 src/system/boot/platform/routerboard_mipsel/serial.cpp create mode 100644 src/system/boot/platform/routerboard_mipsel/serial.h create mode 100644 src/system/boot/platform/routerboard_mipsel/start.c create mode 100644 src/system/boot/platform/routerboard_mipsel/video.cpp create mode 100644 src/system/kernel/platform/routerboard_mipsel/Jamfile create mode 100644 src/system/kernel/platform/routerboard_mipsel/platform.cpp create mode 100644 src/system/ldscripts/mipsel/boot_loader_routerboard_mipsel.ld diff --git a/build/jam/BuildSetup b/build/jam/BuildSetup index e19968f411..80a91b78e8 100644 --- a/build/jam/BuildSetup +++ b/build/jam/BuildSetup @@ -233,10 +233,11 @@ switch $(HAIKU_CPU) { { HAIKU_DEFINES += __MIPSEL__ ; # RouterBOARD firmware (ELF image over TFTP) - HAIKU_BOOT_PLATFORM = routerboot_mipsel ; + HAIKU_BOOT_PLATFORM = routerboard_mipsel ; # offset in floppy image (>= sizeof(haiku_loader)) - HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 192 ; # in kB - todo/fixme - HAIKU_NO_WERROR = 1 ; # we use #warning as placeholders for things to write... + HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 192 ; # in kB + HAIKU_NO_WERROR = 1 ; + # we use #warning as placeholders for things to write... } case * : Exit "Currently unsupported target CPU:" $(HAIKU_CPU) ; diff --git a/headers/private/kernel/boot/platform/routerboard_mipsel/platform_arch.h b/headers/private/kernel/boot/platform/routerboard_mipsel/platform_arch.h new file mode 100644 index 0000000000..42eb7c91b1 --- /dev/null +++ b/headers/private/kernel/boot/platform/routerboard_mipsel/platform_arch.h @@ -0,0 +1,40 @@ +/* + * Copyright 2009 Jonas Sundström, jonas@kirilla.com + * All rights reserved. Distributed under the terms of the MIT License. + */ +#ifndef _KERNEL_BOOT_PLATFORM_ROUTERBOARD_MIPSEL_ARCH_H +#define _KERNEL_BOOT_PLATFORM_ROUTERBOARD_MIPSEL_ARCH_H + +#include + +#warning IMPLEMENT platform_arch.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_ROUTERBOARD_MIPSEL_ARCH_H */ + diff --git a/headers/private/kernel/boot/platform/routerboard_mipsel/platform_kernel_args.h b/headers/private/kernel/boot/platform/routerboard_mipsel/platform_kernel_args.h new file mode 100644 index 0000000000..d45e5d46ef --- /dev/null +++ b/headers/private/kernel/boot/platform/routerboard_mipsel/platform_kernel_args.h @@ -0,0 +1,27 @@ +/* + * Copyright 2009 Jonas Sundström, jonas@kirilla.com + * All rights reserved. Distributed under the terms of the MIT License. + */ +#ifndef _KERNEL_BOOT_PLATFORM_ROUTERBOARD_MIPSEL_KERNEL_ARGS_H +#define _KERNEL_BOOT_PLATFORM_ROUTERBOARD_MIPSEL_KERNEL_ARGS_H + +#ifndef KERNEL_BOOT_KERNEL_ARGS_H +# error This file is included from only +#endif + +#warning IMPLEMENT platform_kernel_args.h + +// 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 { + void* whateverPointer; + char whateverPath[128]; +} platform_kernel_args; + +#endif /* _KERNEL_BOOT_PLATFORM_ROUTERBOARD_MIPSEL_KERNEL_ARGS_H */ + diff --git a/headers/private/kernel/boot/platform/routerboard_mipsel/platform_stage2_args.h b/headers/private/kernel/boot/platform/routerboard_mipsel/platform_stage2_args.h new file mode 100644 index 0000000000..76f736f131 --- /dev/null +++ b/headers/private/kernel/boot/platform/routerboard_mipsel/platform_stage2_args.h @@ -0,0 +1,18 @@ +/* + * Copyright 2009 Jonas Sundström, jonas@kirilla.com + * All rights reserved. Distributed under the terms of the MIT License. + */ +#ifndef _KERNEL_BOOT_PLATFORM_ROUTERBOARD_MIPSEL_STAGE2_ARGS_H +#define _KERNEL_BOOT_PLATFORM_ROUTERBOARD_MIPSEL_STAGE2_ARGS_H + +#ifndef KERNEL_BOOT_STAGE2_ARGS_H +# error This file is included from only +#endif + +#warning IMPLEMENT platform_stage2_args.h + +struct platform_stage2_args { +}; + +#endif /* _KERNEL_BOOT_PLATFORM_ROUTERBOARD_MIPSEL_STAGE2_ARGS_H */ + diff --git a/src/system/boot/platform/routerboard_mipsel/Jamfile b/src/system/boot/platform/routerboard_mipsel/Jamfile new file mode 100644 index 0000000000..a2c2fdc889 --- /dev/null +++ b/src/system/boot/platform/routerboard_mipsel/Jamfile @@ -0,0 +1,50 @@ +SubDir HAIKU_TOP src system boot platform routerboard_mipsel ; + +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) -Wall -Wno-multichar ; + SubDirC++Flags $(defines) -Wall -Wno-multichar -fno-rtti ; +} + +SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src add-ons accelerants common ] ; + +local genericPlatformSources = + text_menu.cpp +# video_blit.cpp +# video_splash.cpp +# video_rle.cpp +; + +KernelMergeObject boot_platform_routerboard_mipsel.o : + console.cpp + cpu.cpp + debug.c + devices.cpp + keyboard.cpp + menu.cpp + mmu.cpp + serial.cpp + start.c + video.cpp + + $(genericPlatformSources) + + : -fno-pic -G0 +; + +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) ; + diff --git a/src/system/boot/platform/routerboard_mipsel/console.cpp b/src/system/boot/platform/routerboard_mipsel/console.cpp new file mode 100644 index 0000000000..cf3aab3819 --- /dev/null +++ b/src/system/boot/platform/routerboard_mipsel/console.cpp @@ -0,0 +1,116 @@ +/* + * Copyright 2009 Jonas Sundström, jonas@kirilla.com + * All rights reserved. Distributed under the terms of the MIT License. + */ + + +#include "console.h" + +#include + +#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; +} + + +status_t +console_init(void) +{ +#warning IMPLEMENT console_init + return B_OK; +} + diff --git a/src/system/boot/platform/routerboard_mipsel/console.h b/src/system/boot/platform/routerboard_mipsel/console.h new file mode 100644 index 0000000000..c455269e66 --- /dev/null +++ b/src/system/boot/platform/routerboard_mipsel/console.h @@ -0,0 +1,21 @@ +/* + * Copyright 2009 Jonas Sundström, jonas@kirilla.com + * All rights reserved. Distributed under the terms of the MIT License. + */ +#ifndef _SYSTEM_BOOT_PLATFORM_ROUTERBOARD_MIPSEL_CONSOLE_H +#define _SYSTEM_BOOT_PLATFORM_ROUTERBOARD_MIPSEL_CONSOLE_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +extern status_t console_init(void); + +#ifdef __cplusplus +} +#endif + +#endif /* _SYSTEM_BOOT_PLATFORM_ROUTERBOARD_MIPSEL_CONSOLE_H */ + diff --git a/src/system/boot/platform/routerboard_mipsel/cpu.cpp b/src/system/boot/platform/routerboard_mipsel/cpu.cpp new file mode 100644 index 0000000000..bc2f15fce0 --- /dev/null +++ b/src/system/boot/platform/routerboard_mipsel/cpu.cpp @@ -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 +#include +#include +#include + +#include + + +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 +} + diff --git a/src/system/boot/platform/routerboard_mipsel/cpu.h b/src/system/boot/platform/routerboard_mipsel/cpu.h new file mode 100644 index 0000000000..2e171e8ae9 --- /dev/null +++ b/src/system/boot/platform/routerboard_mipsel/cpu.h @@ -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_ROUTERBOARD_MIPSEL_CPU_H +#define _SYSTEM_BOOT_PLATFORM_ROUTERBOARD_MIPSEL_CPU_H + + +#include + + +#ifdef __cplusplus +extern "C" { +#endif + +extern void cpu_init(void); + +#ifdef __cplusplus +} +#endif + +#endif /* _SYSTEM_BOOT_PLATFORM_ROUTERBOARD_MIPSEL_CPU_H */ + diff --git a/src/system/boot/platform/routerboard_mipsel/debug.c b/src/system/boot/platform/routerboard_mipsel/debug.c new file mode 100644 index 0000000000..9c9163def1 --- /dev/null +++ b/src/system/boot/platform/routerboard_mipsel/debug.c @@ -0,0 +1,24 @@ +/* + * Copyright 2009 Jonas Sundström, jonas@kirilla.com + * All rights reserved. Distributed under the terms of the MIT License. + */ + + +#include +#include +#include + + +void +panic(const char* format, ...) +{ +#warning IMPLEMENT panic +} + + +void +dprintf(const char* format, ...) +{ +#warning IMPLEMENT dprintf +} + diff --git a/src/system/boot/platform/routerboard_mipsel/devices.cpp b/src/system/boot/platform/routerboard_mipsel/devices.cpp new file mode 100644 index 0000000000..277c58c9ec --- /dev/null +++ b/src/system/boot/platform/routerboard_mipsel/devices.cpp @@ -0,0 +1,47 @@ +/* + * Copyright 2009 Jonas Sundström, jonas@kirilla.com + * All rights reserved. Distributed under the terms of the MIT License. + */ + + +#include +#include +#include +#include +#include + +#include + + +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; +} + diff --git a/src/system/boot/platform/routerboard_mipsel/keyboard.cpp b/src/system/boot/platform/routerboard_mipsel/keyboard.cpp new file mode 100644 index 0000000000..dece242a45 --- /dev/null +++ b/src/system/boot/platform/routerboard_mipsel/keyboard.cpp @@ -0,0 +1,44 @@ +/* + * Copyright 2009 Jonas Sundström, jonas@kirilla.com + * All rights reserved. Distributed under the terms of the MIT License. + */ + + +#include "keyboard.h" + +#include + + +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; +} + diff --git a/src/system/boot/platform/routerboard_mipsel/keyboard.h b/src/system/boot/platform/routerboard_mipsel/keyboard.h new file mode 100644 index 0000000000..523c2be845 --- /dev/null +++ b/src/system/boot/platform/routerboard_mipsel/keyboard.h @@ -0,0 +1,34 @@ +/* + * Copyright 2009 Jonas Sundström, jonas@kirilla.com + * All rights reserved. Distributed under the terms of the MIT License. + */ +#ifndef _SYSTEM_BOOT_PLATFORM_ROUTERBOARD_MIPSEL_KEYBOARD_H +#define _SYSTEM_BOOT_PLATFORM_ROUTERBOARD_MIPSEL_KEYBOARD_H + + +#include + + +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_ROUTERBOARD_MIPSEL_KEYBOARD_H */ + diff --git a/src/system/boot/platform/routerboard_mipsel/menu.cpp b/src/system/boot/platform/routerboard_mipsel/menu.cpp new file mode 100644 index 0000000000..1aaf3c805a --- /dev/null +++ b/src/system/boot/platform/routerboard_mipsel/menu.cpp @@ -0,0 +1,46 @@ +/* + * Copyright 2009 Jonas Sundström, jonas@kirilla.com + * All rights reserved. Distributed under the terms of the MIT License. + */ + + +#include +#include + + +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); +} + diff --git a/src/system/boot/platform/routerboard_mipsel/mmu.cpp b/src/system/boot/platform/routerboard_mipsel/mmu.cpp new file mode 100644 index 0000000000..cb4611926d --- /dev/null +++ b/src/system/boot/platform/routerboard_mipsel/mmu.cpp @@ -0,0 +1,95 @@ +/* + * Copyright 2009 Jonas Sundström, jonas@kirilla.com + * All rights reserved. Distributed under the terms of the MIT License. + */ + + +#include "mmu.h" + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + + +// #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; +} + diff --git a/src/system/boot/platform/routerboard_mipsel/mmu.h b/src/system/boot/platform/routerboard_mipsel/mmu.h new file mode 100644 index 0000000000..b59f13a841 --- /dev/null +++ b/src/system/boot/platform/routerboard_mipsel/mmu.h @@ -0,0 +1,30 @@ +/* + * Copyright 2009 Jonas Sundström, jonas@kirilla.com + * All rights reserved. Distributed under the terms of the MIT License. + */ +#ifndef _SYSTEM_BOOT_PLATFORM_ROUTERBOARD_MIPSEL_MMU_H +#define _SYSTEM_BOOT_PLATFORM_ROUTERBOARD_MIPSEL_MMU_H + + +#include + + +#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_ROUTERBOARD_MIPSEL_MMU_H */ + diff --git a/src/system/boot/platform/routerboard_mipsel/serial.cpp b/src/system/boot/platform/routerboard_mipsel/serial.cpp new file mode 100644 index 0000000000..4c8d121705 --- /dev/null +++ b/src/system/boot/platform/routerboard_mipsel/serial.cpp @@ -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 +#include +#include + +#include + + +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 +} + diff --git a/src/system/boot/platform/routerboard_mipsel/serial.h b/src/system/boot/platform/routerboard_mipsel/serial.h new file mode 100644 index 0000000000..dac5d928b9 --- /dev/null +++ b/src/system/boot/platform/routerboard_mipsel/serial.h @@ -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_ROUTERBOARD_MIPSEL_SERIAL_H +#define _SYSTEM_BOOT_PLATFORM_ROUTERBOARD_MIPSEL_SERIAL_H + + +#include + + +#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 */ + diff --git a/src/system/boot/platform/routerboard_mipsel/start.c b/src/system/boot/platform/routerboard_mipsel/start.c new file mode 100644 index 0000000000..56922a4f7e --- /dev/null +++ b/src/system/boot/platform/routerboard_mipsel/start.c @@ -0,0 +1,110 @@ +/* + * 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 +#include +#include +#include +#include + +#include + + +#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 - + + +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 +_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); +} + diff --git a/src/system/boot/platform/routerboard_mipsel/video.cpp b/src/system/boot/platform/routerboard_mipsel/video.cpp new file mode 100644 index 0000000000..9672899b9b --- /dev/null +++ b/src/system/boot/platform/routerboard_mipsel/video.cpp @@ -0,0 +1,37 @@ +/* + * Copyright 2009 Jonas Sundström, jonas@kirilla.com + * All rights reserved. Distributed under the terms of the MIT License. + */ + + +#include + + +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; +} + diff --git a/src/system/kernel/platform/routerboard_mipsel/Jamfile b/src/system/kernel/platform/routerboard_mipsel/Jamfile new file mode 100644 index 0000000000..4c624707d8 --- /dev/null +++ b/src/system/kernel/platform/routerboard_mipsel/Jamfile @@ -0,0 +1,9 @@ +SubDir HAIKU_TOP src system kernel platform routerboard_mipsel ; + +SubDirCcFlags $(TARGET_KERNEL_PIC_CCFLAGS) ; +SubDirC++Flags $(TARGET_KERNEL_PIC_CCFLAGS) ; + +KernelMergeObject kernel_platform_routerboard_mipsel.o : + platform.cpp +; + diff --git a/src/system/kernel/platform/routerboard_mipsel/platform.cpp b/src/system/kernel/platform/routerboard_mipsel/platform.cpp new file mode 100644 index 0000000000..c30c0cc959 --- /dev/null +++ b/src/system/kernel/platform/routerboard_mipsel/platform.cpp @@ -0,0 +1,3 @@ +/* + Just a dummy. No BIOS services are required in the kernel. +*/ diff --git a/src/system/ldscripts/mipsel/boot_loader_routerboard_mipsel.ld b/src/system/ldscripts/mipsel/boot_loader_routerboard_mipsel.ld new file mode 100644 index 0000000000..616eebfd5e --- /dev/null +++ b/src/system/ldscripts/mipsel/boot_loader_routerboard_mipsel.ld @@ -0,0 +1,35 @@ +OUTPUT_FORMAT("elf32-littlemips") +OUTPUT_ARCH(mips) + +ENTRY(_start) +SECTIONS +{ + . = 0x10000; + + /* text/read-only data */ + .text : { *(.text .gnu.linkonce.t.*) } + + __ctor_list = .; + .ctors : { *(.ctors) } + __ctor_end = .; + + .rodata : { *(.rodata .rodata.*) } + + /* writable data */ + . = ALIGN(0x1000); + __data_start = .; + .data : { *(.data .gnu.linkonce.d.*) } + _gp = .; + /* needed for GPREL16 relocation to small-data section */ + + /* unintialized data (in same segment as writable data) */ + __bss_start = .; + .bss : { *(.bss) } + + . = ALIGN(0x1000); + _end = .; + + /* Strip unnecessary stuff */ + /DISCARD/ : { *(.comment .note .eh_frame .dtors .stab .stabstr .debug*) } +} +