[haiku-commits] haiku: hrev52470 - in src/system/boot: arch/arm platform/u-boot/arch/arm platform/u-boot

  • From: kallisti5@xxxxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 2 Nov 2018 13:47:19 -0400 (EDT)

hrev52470 adds 1 changeset to branch 'master'
old head: 3bac8deff672a32e9601154ba7d8067d82bc4c87
new head: 8de3883d8b3d829b6bf8cf68f88b2fddc74b6ab4
overview: 
https://git.haiku-os.org/haiku/log/?qt=range&q=8de3883d8b3d+%5E3bac8deff672

----------------------------------------------------------------------------

8de3883d8b3d: bcm2835: Move mailbox init into bcm2835 framebuffer
  
  We won't need the mailbox for most chipsets except bcm2835
  to determine the framebuffer base address.
  (especially at this early boot stage)
  
  This simplifies things by making the mailbox usage limited
  to boot_arch_arm and not spreading it all thoughout the
  platform u-boot code... however we keep the mailbox driver
  as-is since it would make a good kernel driver someday.
  
  mmu_man mentioned us "finding" the fb base from the mailbox
  and modifying the FDT to let it know the base reg of the
  framebuffer... that's beyond 'just getting things building'
  though :-)
  
  Change-Id: Ic2772b85dff004f9d21447ea5958b5ae9776d526

                          [ Alexander von Gluck IV <kallisti5@xxxxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev52470
Commit:      8de3883d8b3d829b6bf8cf68f88b2fddc74b6ab4
URL:         https://git.haiku-os.org/haiku/commit/?id=8de3883d8b3d
Author:      Alexander von Gluck IV <kallisti5@xxxxxxxxxxx>
Date:        Fri Nov  2 17:42:32 2018 UTC

----------------------------------------------------------------------------

5 files changed, 23 insertions(+), 41 deletions(-)
.../boot/arch/arm/arch_framebuffer_bcm2835.cpp   | 26 ++++++++++++++++---
.../boot/arch/arm/arch_mailbox_bcm2835.cpp       |  1 +
src/system/boot/platform/u-boot/arch/arm/Jamfile |  3 ---
.../platform/u-boot/arch/arm/arch_mailbox.cpp    | 27 --------------------
src/system/boot/platform/u-boot/start.cpp        |  7 -----

----------------------------------------------------------------------------

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<std::atomic<uint32_t>*>(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@xxxxxxxxxxx
- */
-
-
-#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()?


Other related posts:

  • » [haiku-commits] haiku: hrev52470 - in src/system/boot: arch/arm platform/u-boot/arch/arm platform/u-boot - kallisti5