From 5906dbb4d4656919daaf375510132107b0af6a8a Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Fri, 6 Mar 2015 07:47:32 -0600 Subject: [PATCH] platform/u-boot: Work towards using arm mailbox driver * Reference bcm2708 framebuffer when it makes sense * Add bcm2708 define to Raspberry Pi board_config.h --- .../arm/board/raspberry_pi/board_config.h | 3 ++- .../boot/platform/u-boot/arch/arm/Jamfile | 4 +++ .../platform/u-boot/arch/arm/arch_mailbox.cpp | 27 +++++++++++++++++++ src/system/boot/platform/u-boot/start.cpp | 7 +++++ src/system/boot/platform/u-boot/video.cpp | 4 +++ 5 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 src/system/boot/platform/u-boot/arch/arm/arch_mailbox.cpp diff --git a/headers/private/kernel/arch/arm/board/raspberry_pi/board_config.h b/headers/private/kernel/arch/arm/board/raspberry_pi/board_config.h index 789ca49d2e..39d05ce841 100644 --- a/headers/private/kernel/arch/arm/board/raspberry_pi/board_config.h +++ b/headers/private/kernel/arch/arm/board/raspberry_pi/board_config.h @@ -11,7 +11,8 @@ #define BOARD_NAME_PRETTY "Raspberry Pi" -#define BOARD_CPU_ARM6 1 +#define BOARD_CPU_TYPE_ARM6 1 +#define BOARD_CPU_BCM2708 1 #include diff --git a/src/system/boot/platform/u-boot/arch/arm/Jamfile b/src/system/boot/platform/u-boot/arch/arm/Jamfile index d5221acf74..620056b206 100644 --- a/src/system/boot/platform/u-boot/arch/arm/Jamfile +++ b/src/system/boot/platform/u-boot/arch/arm/Jamfile @@ -1,6 +1,8 @@ SubDir HAIKU_TOP src system boot platform u-boot arch arm ; SubDirHdrs $(HAIKU_TOP) src system boot platform $(TARGET_BOOT_PLATFORM) ; +SubDirHdrs $(HAIKU_TOP) src system boot arch $(TARGET_KERNEL_ARCH) ; + UsePrivateSystemHeaders ; UsePrivateHeaders kernel [ FDirName kernel arch $(TARGET_KERNEL_ARCH) ] [ FDirName kernel boot platform $(HAIKU_BOOT_PLATFORM) ] ; @@ -11,6 +13,8 @@ SubDirC++Flags -fno-rtti ; BootMergeObject boot_platform_u-boot_arm.o : # must come first to have _start_* at correct locations shell.S + + arch_mailbox.cpp : -fno-pic ; diff --git a/src/system/boot/platform/u-boot/arch/arm/arch_mailbox.cpp b/src/system/boot/platform/u-boot/arch/arm/arch_mailbox.cpp new file mode 100644 index 0000000000..b796a7892e --- /dev/null +++ b/src/system/boot/platform/u-boot/arch/arm/arch_mailbox.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2012-2015 Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Alexander von Gluck IV, kallisti5@unixzen.com + */ + + +#include "arch_mailbox.h" + +#include + + +ArchMailbox *gMailbox = NULL; + + +extern "C" status_t +arch_mailbox_init() +{ + #if defined(BOARD_CPU_BCM2708) + extern ArchMailbox *arch_get_mailbox_arm_bcm2708(addr_t base); + #warning ARM: Add gPeripheralBase to ARM_CTRL_0_MAILBOX_BASE + gMailbox = arch_get_mailbox_arm_bcm2708(ARM_CTRL_0_MAILBOX_BASE); + #endif + return B_OK; +} diff --git a/src/system/boot/platform/u-boot/start.cpp b/src/system/boot/platform/u-boot/start.cpp index e23cfb34b5..b9faf9f83e 100644 --- a/src/system/boot/platform/u-boot/start.cpp +++ b/src/system/boot/platform/u-boot/start.cpp @@ -60,6 +60,10 @@ extern "C" int start_gen(int argc, const char **argv, struct image_header *uimage=NULL, void *fdt=NULL); extern "C" void dump_uimage(struct image_header *image); extern "C" void dump_fdt(const void *fdt); +#if defined(__ARM__) +extern "C" status_t arch_mailbox_init(); +#endif + // declared in shell.S // those are initialized to NULL but not in the BSS @@ -210,6 +214,9 @@ start_gen(int argc, const char **argv, struct image_header *uimage, void *fdt) gFDT = args.platform.fdt_data; } + #if defined(__ARM__) + arch_mailbox_init(); + #endif serial_init(gFDT); console_init(); // initialize the OpenFirmware wrapper diff --git a/src/system/boot/platform/u-boot/video.cpp b/src/system/boot/platform/u-boot/video.cpp index 72f94166b4..1ea111ba2a 100644 --- a/src/system/boot/platform/u-boot/video.cpp +++ b/src/system/boot/platform/u-boot/video.cpp @@ -108,6 +108,10 @@ platform_init_video(void) #if defined(BOARD_CPU_ARM920T) extern ArchFramebuffer *arch_get_fb_arm_920(addr_t base); gFramebuffer = arch_get_fb_arm_920(0x88000000); + #elif defined(BOARD_CPU_BCM2708) + extern ArchFramebuffer *arch_get_fb_arm_bcm2708(addr_t base); + // BCM2708 gets its framebuffer base from a Mailbox + gFramebuffer = arch_get_fb_arm_bcm2708(0x0); #elif defined(BOARD_CPU_OMAP3) extern ArchFramebuffer *arch_get_fb_arm_omap3(addr_t base); gFramebuffer = arch_get_fb_arm_omap3(FB_BASE);