diff --git a/src/system/boot/arch/arm/arch_framebuffer_bcm2835.cpp b/src/system/boot/arch/arm/arch_framebuffer_bcm2835.cpp index 47ff79c451..38c3f3b09e 100644 --- a/src/system/boot/arch/arm/arch_framebuffer_bcm2835.cpp +++ b/src/system/boot/arch/arm/arch_framebuffer_bcm2835.cpp @@ -27,14 +27,19 @@ #include "arch_mailbox.h" #include "arch_mmu.h" +#include "fdt_support.h" //XXX extern "C" bool mmu_get_virtual_mapping(addr_t virtualAddress, phys_addr_t *_physicalAddress); +extern "C" ArchMailbox* +arch_get_mailbox_arm_bcm2835(addr_t base); + + +extern void* gFDT; -extern ArchMailbox *gMailbox; struct framebuffer_config { uint32 width; @@ -64,6 +69,8 @@ virtual status_t Init(); virtual status_t Probe(); virtual status_t SetDefaultMode(); virtual status_t SetVideoMode(int width, int height, int depth); +private: + ArchMailbox* fMailbox; }; @@ -77,7 +84,18 @@ arch_get_fb_arm_bcm2835(addr_t base) status_t ArchFBArmBCM2835::Init() { - if (gMailbox == NULL) { + if (!gFDT) { + dprintf("ERROR: FDT access is unavailable!"); + return B_ERROR; + } + phys_addr_t mboxBase = fdt_get_device_reg_byname(gFDT, "/axi/mbox"); + if (!mboxBase) { + dprintf("ERROR: /axi/mbox is unavailable!"); + return B_ERROR; + } + fMailbox = arch_get_mailbox_arm_bcm2835(mboxBase); + + if (fMailbox == NULL) { dprintf("ERROR: Broadcom mailbox is unavailable!"); return B_ERROR; } @@ -129,13 +147,13 @@ ArchFBArmBCM2835::SetVideoMode(int width, int height, int depth) sFramebufferConfig.color_map[i] = 0x1111 * i; } - status_t result = gMailbox->Write(ARM_MAILBOX_CHANNEL_FRAMEBUFFER, + status_t result = fMailbox->Write(ARM_MAILBOX_CHANNEL_FRAMEBUFFER, (uint32)&sFramebufferConfig | BCM283X_VIDEO_CORE_L2_COHERENT); if (result != B_OK) return result; uint32 value; - result = gMailbox->Read(ARM_MAILBOX_CHANNEL_FRAMEBUFFER, value); + result = fMailbox->Read(ARM_MAILBOX_CHANNEL_FRAMEBUFFER, value); if (result != B_OK) return result; diff --git a/src/system/boot/arch/arm/arch_mailbox_bcm2835.cpp b/src/system/boot/arch/arm/arch_mailbox_bcm2835.cpp index 42f5764205..757ad304d4 100644 --- a/src/system/boot/arch/arm/arch_mailbox_bcm2835.cpp +++ b/src/system/boot/arch/arm/arch_mailbox_bcm2835.cpp @@ -83,6 +83,7 @@ ArchMailboxArmBCM2835::GetRegister(unsigned reg) return *reinterpret_cast*>(addr); } + inline uint32 ArchMailboxArmBCM2835::RegisterRead(addr_t reg) { diff --git a/src/system/boot/platform/u-boot/arch/arm/Jamfile b/src/system/boot/platform/u-boot/arch/arm/Jamfile index f07d3b936b..765d3db7ab 100644 --- a/src/system/boot/platform/u-boot/arch/arm/Jamfile +++ b/src/system/boot/platform/u-boot/arch/arm/Jamfile @@ -2,7 +2,6 @@ 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) ; -SubDirHdrs $(HAIKU_TOP) src add-ons kernel bus_managers fdt ; UsePrivateSystemHeaders ; UsePrivateHeaders kernel [ FDirName kernel platform u-boot ] ; @@ -14,8 +13,6 @@ 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 ; #SEARCH on [ FGristFiles arch_cpu_asm.S ] 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 deleted file mode 100644 index 19ecd91f35..0000000000 --- a/src/system/boot/platform/u-boot/arch/arm/arch_mailbox.cpp +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2012-2016 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 "fdt_support.h" - -ArchMailbox *gMailbox = NULL; -extern void* gFDT; - -extern "C" status_t -arch_mailbox_init() -{ - extern ArchMailbox *arch_get_mailbox_arm_bcm2835(addr_t base); - phys_addr_t mboxBase = fdt_get_device_reg_byname(gFDT, "/axi/mbox"); - if (!mboxBase) { - return B_ERROR; - } - gMailbox = arch_get_mailbox_arm_bcm2835(mboxBase); - return B_OK; -} diff --git a/src/system/boot/platform/u-boot/start.cpp b/src/system/boot/platform/u-boot/start.cpp index a927b48310..89ad39c9b8 100644 --- a/src/system/boot/platform/u-boot/start.cpp +++ b/src/system/boot/platform/u-boot/start.cpp @@ -70,9 +70,6 @@ extern "C" void _start(void); 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); -#if defined(__arm__) -extern "C" status_t arch_mailbox_init(); -#endif // declared in shell.S @@ -230,10 +227,6 @@ start_gen(int argc, const char **argv, struct image_header *uimage, void *fdt) serial_init(gFDT); - #if defined(__arm__) - arch_mailbox_init(); - #endif - // initialize the OpenFirmware wrapper // TODO: We need to call this when HAIKU_KERNEL_PLATFORM == openfirmware // boot_platform_init()?