U-Boot: Guard ARM-specific stuff

* those must be cleaned up and moved away
* allows building U-Boot loader for ppc
This commit is contained in:
François Revol
2012-05-17 19:10:10 +02:00
parent 3d4f1347fe
commit 386671b4d0
2 changed files with 25 additions and 3 deletions
+15
View File
@@ -14,7 +14,9 @@
#include <boot/stage2.h> #include <boot/stage2.h>
#include <arch/cpu.h> #include <arch/cpu.h>
#include <arch_kernel.h> #include <arch_kernel.h>
#ifdef __ARM__
#include <arm_mmu.h> #include <arm_mmu.h>
#endif
#include <kernel.h> #include <kernel.h>
#include <board_config.h> #include <board_config.h>
@@ -37,6 +39,7 @@
// You also need to define ENABLE_SERIAL in serial.cpp // You also need to define ENABLE_SERIAL in serial.cpp
// for output to work. // for output to work.
#ifdef __ARM__
/* /*
TODO: TODO:
@@ -620,6 +623,8 @@ mmu_init(void)
gKernelArgs.cpu_kstack[0].start + gKernelArgs.cpu_kstack[0].size)); gKernelArgs.cpu_kstack[0].start + gKernelArgs.cpu_kstack[0].size));
} }
#endif
// #pragma mark - // #pragma mark -
@@ -628,19 +633,25 @@ extern "C" status_t
platform_allocate_region(void **_address, size_t size, uint8 protection, platform_allocate_region(void **_address, size_t size, uint8 protection,
bool /*exactAddress*/) bool /*exactAddress*/)
{ {
#ifdef __ARM__
void *address = mmu_allocate(*_address, size); void *address = mmu_allocate(*_address, size);
if (address == NULL) if (address == NULL)
return B_NO_MEMORY; return B_NO_MEMORY;
*_address = address; *_address = address;
return B_OK; return B_OK;
#else
return B_ERROR;
#endif
} }
extern "C" status_t extern "C" status_t
platform_free_region(void *address, size_t size) platform_free_region(void *address, size_t size)
{ {
#ifdef __ARM__
mmu_free(address, size); mmu_free(address, size);
#endif
return B_OK; return B_OK;
} }
@@ -657,6 +668,7 @@ platform_release_heap(struct stage2_args *args, void *base)
status_t status_t
platform_init_heap(struct stage2_args *args, void **_base, void **_top) platform_init_heap(struct stage2_args *args, void **_base, void **_top)
{ {
#ifdef __ARM__
void *heap = (void *)get_next_physical_address(args->heap_size); void *heap = (void *)get_next_physical_address(args->heap_size);
if (heap == NULL) if (heap == NULL)
return B_NO_MEMORY; return B_NO_MEMORY;
@@ -664,4 +676,7 @@ platform_init_heap(struct stage2_args *args, void **_base, void **_top)
*_base = heap; *_base = heap;
*_top = (void *)((int8 *)heap + args->heap_size); *_top = (void *)((int8 *)heap + args->heap_size);
return B_OK; return B_OK;
#else
return B_ERROR;
#endif
} }
+10 -3
View File
@@ -5,7 +5,10 @@
#include "video.h" #include "video.h"
//XXX
#ifdef __ARM__
#include "arch_video.h" #include "arch_video.h"
#endif
#include <arch/cpu.h> #include <arch/cpu.h>
#include <boot/stage2.h> #include <boot/stage2.h>
@@ -92,14 +95,16 @@ platform_switch_to_logo(void)
status_t err; status_t err;
#ifdef __ARM__
err = arch_set_default_video_mode(); err = arch_set_default_video_mode();
dprintf("set video mode: 0x%08x\n", err); dprintf("set video mode: 0x%08x\n", err);
if (err < B_OK) if (err < B_OK)
return; return;
#endif
err = video_display_splash((addr_t)gFrameBufferBase); err = video_display_splash((addr_t)gFrameBufferBase);
dprintf("video_display_splash: 0x%08x\n", err); dprintf("video_display_splash: 0x%08x\n", err);
#warning ARM:TODO #warning U-Boot:TODO
} }
@@ -107,7 +112,7 @@ extern "C" void
platform_switch_to_text_mode(void) platform_switch_to_text_mode(void)
{ {
TRACE(("%s()\n", __FUNCTION__)); TRACE(("%s()\n", __FUNCTION__));
#warning ARM:TODO #warning U-Boot:TODO
} }
@@ -115,8 +120,10 @@ extern "C" status_t
platform_init_video(void) platform_init_video(void)
{ {
TRACE(("%s()\n", __FUNCTION__)); TRACE(("%s()\n", __FUNCTION__));
#warning ARM:TODO #warning U-Boot:TODO
#ifdef __ARM__
arch_probe_video_mode(); arch_probe_video_mode();
#endif
//XXX for testing //XXX for testing
//platform_switch_to_logo(); //platform_switch_to_logo();
//return arch_probe_video_mode(); //return arch_probe_video_mode();