[haiku-commits] haiku: hrev54833 - src/system/boot/platform/openfirmware/arch/sparc src/system/boot/platform/openfirmware src/system/boot/loader headers/private/kernel/boot/platform/openfirmware

  • From: waddlesplash <waddlesplash@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 30 Dec 2020 21:58:15 -0500 (EST)

hrev54833 adds 6 changesets to branch 'master'
old head: 03c037b99a24d66bf6a89d4b1d95f30669d4bc05
new head: 964ce003912da099d65567d71c1432d29ab34b24
overview: 
https://git.haiku-os.org/haiku/log/?qt=range&q=964ce003912d+%5E03c037b99a24

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

185e6809fc66: sparc: Build fixes
  
  - Wrong printf format in bootloader elf panic call
  - Missing functions for sparc
  
  Change-Id: I4715a8d6d3d864d379b8386dc3958e0a2c1962e7
  Reviewed-on: https://review.haiku-os.org/c/haiku/+/3571
  Reviewed-by: waddlesplash <waddlesplash@xxxxxxxxx>

bba45f645b8d: openfirmware: fixup video driver for 64bit
  
  We now have a bootsplash on sparc!
  
  Change-Id: I583a3015a86618292088fe4379f548467d30ec4f
  Reviewed-on: https://review.haiku-os.org/c/haiku/+/3572
  Reviewed-by: waddlesplash <waddlesplash@xxxxxxxxx>

baca34bee57d: bootloader heap: more detailed errors on out-of-memory
  
  It's hard enough to debug bootloader code already, let's gather as much
  info as we can from error messages.
  
  Change-Id: I47dff402286625d1213caa36ae6ee8ecf707dfad
  Reviewed-on: https://review.haiku-os.org/c/haiku/+/3574
  Reviewed-by: waddlesplash <waddlesplash@xxxxxxxxx>

19024bc41667: openfirmware: synchronize number of memory range with bios and efi
  
  It was bumped for bios and efi from previously very low values, but
  other architectures did not follow.
  
  Change-Id: I6ce92e2cdb0261d4d0637753e77d555d407073fc
  Reviewed-on: https://review.haiku-os.org/c/haiku/+/3575
  Reviewed-by: waddlesplash <waddlesplash@xxxxxxxxx>

75c2a94a87a4: sparc mmu: fix free physical range search
  
  The code was ignoring most of the memory and eventually didn't find
  enough of it to load all kernel modules.
  
  Change-Id: I8abcb6cd20eb2a37147d720eb63af1c2820628f3
  Reviewed-on: https://review.haiku-os.org/c/haiku/+/3576
  Reviewed-by: waddlesplash <waddlesplash@xxxxxxxxx>

964ce003912d: openfirmware: we need a larger bootloader heap size
  
  Currently about 366K are used. Round up to next power of two.
  
  Change-Id: Id6713b4f4eebfbced310bbd75a16a5737228ae72
  Reviewed-on: https://review.haiku-os.org/c/haiku/+/3577
  Reviewed-by: waddlesplash <waddlesplash@xxxxxxxxx>

                                   [ PulkoMandy <pulkomandy@xxxxxxxxxxxxx> ]

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

7 files changed, 43 insertions(+), 11 deletions(-)
.../platform/openfirmware/platform_kernel_args.h   |  4 ++--
src/system/boot/loader/elf.cpp                     |  2 +-
src/system/boot/loader/heap.cpp                    |  6 ++++--
.../boot/platform/openfirmware/arch/sparc/mmu.cpp  | 18 ++++++++++++++++--
src/system/boot/platform/openfirmware/mmu.cpp      | 16 ++++++++++++++++
src/system/boot/platform/openfirmware/start.cpp    |  2 +-
src/system/boot/platform/openfirmware/video.cpp    |  6 +++---

############################################################################

Commit:      185e6809fc6639ae249a03bca515c8741774b25d
URL:         https://git.haiku-os.org/haiku/commit/?id=185e6809fc66
Author:      PulkoMandy <pulkomandy@xxxxxxxxxxxxx>
Date:        Wed Dec 30 19:39:07 2020 UTC
Committer:   waddlesplash <waddlesplash@xxxxxxxxx>
Commit-Date: Thu Dec 31 02:58:10 2020 UTC

sparc: Build fixes

- Wrong printf format in bootloader elf panic call
- Missing functions for sparc

Change-Id: I4715a8d6d3d864d379b8386dc3958e0a2c1962e7
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3571
Reviewed-by: waddlesplash <waddlesplash@xxxxxxxxx>

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

diff --git a/src/system/boot/loader/elf.cpp b/src/system/boot/loader/elf.cpp
index fd4655d2a9..99495aaf93 100644
--- a/src/system/boot/loader/elf.cpp
+++ b/src/system/boot/loader/elf.cpp
@@ -152,7 +152,7 @@ struct ELF64Class {
 #else
                void *result;
                if (platform_kernel_address_to_bootloader_address(address, 
&result) != B_OK) {
-                       panic("Couldn't convert address %#lx", address);
+                       panic("Couldn't convert address %#" PRIx64, address);
                }
                return result;
 #endif
diff --git a/src/system/boot/platform/openfirmware/mmu.cpp 
b/src/system/boot/platform/openfirmware/mmu.cpp
index b765e8dcb1..4f47608268 100644
--- a/src/system/boot/platform/openfirmware/mmu.cpp
+++ b/src/system/boot/platform/openfirmware/mmu.cpp
@@ -28,6 +28,22 @@ platform_allocate_region(void **_address, size_t size, uint8 
protection,
 }
 
 
+extern "C" status_t
+platform_bootloader_address_to_kernel_address(void *address, addr_t *_result)
+{
+       *_result = (addr_t)address;
+       return B_OK;
+}
+
+
+extern "C" status_t
+platform_kernel_address_to_bootloader_address(addr_t address, void **_result)
+{
+       *_result = (void*)address;
+       return B_OK;
+}
+
+
 status_t
 platform_free_region(void *address, size_t size)
 {

############################################################################

Commit:      bba45f645b8dce2d98d838bf447ff2a62b023b5e
URL:         https://git.haiku-os.org/haiku/commit/?id=bba45f645b8d
Author:      PulkoMandy <pulkomandy@xxxxxxxxxxxxx>
Date:        Wed Dec 30 20:30:19 2020 UTC
Committer:   waddlesplash <waddlesplash@xxxxxxxxx>
Commit-Date: Thu Dec 31 02:58:10 2020 UTC

openfirmware: fixup video driver for 64bit

We now have a bootsplash on sparc!

Change-Id: I583a3015a86618292088fe4379f548467d30ec4f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3572
Reviewed-by: waddlesplash <waddlesplash@xxxxxxxxx>

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

diff --git a/src/system/boot/platform/openfirmware/video.cpp 
b/src/system/boot/platform/openfirmware/video.cpp
index 455f30c816..41cbd4f935 100644
--- a/src/system/boot/platform/openfirmware/video.cpp
+++ b/src/system/boot/platform/openfirmware/video.cpp
@@ -15,7 +15,7 @@
 //#define TRACE_VIDEO
 
 
-static int sScreen;
+static intptr_t sScreen;
 
 
 void
@@ -58,10 +58,10 @@ platform_switch_to_logo(void)
        if (sScreen == OF_FAILED)
                return;
 
-       int package = of_instance_to_package(sScreen);
+       intptr_t package = of_instance_to_package(sScreen);
        if (package == OF_FAILED)
                return;
-       uint32 width, height;
+       uintptr_t width, height;
        if (of_call_method(sScreen, "dimensions", 0, 2, &height, &width)
                        == OF_FAILED) {
                if (of_getprop(package, "width", &width, sizeof(int32)) == 
OF_FAILED)

############################################################################

Commit:      baca34bee57dfeca98442b42347eabe234849413
URL:         https://git.haiku-os.org/haiku/commit/?id=baca34bee57d
Author:      PulkoMandy <pulkomandy@xxxxxxxxxxxxx>
Date:        Wed Dec 30 20:43:47 2020 UTC
Committer:   waddlesplash <waddlesplash@xxxxxxxxx>
Commit-Date: Thu Dec 31 02:58:10 2020 UTC

bootloader heap: more detailed errors on out-of-memory

It's hard enough to debug bootloader code already, let's gather as much
info as we can from error messages.

Change-Id: I47dff402286625d1213caa36ae6ee8ecf707dfad
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3574
Reviewed-by: waddlesplash <waddlesplash@xxxxxxxxx>

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

diff --git a/src/system/boot/loader/heap.cpp b/src/system/boot/loader/heap.cpp
index dcf32696df..5632bc9b96 100644
--- a/src/system/boot/loader/heap.cpp
+++ b/src/system/boot/loader/heap.cpp
@@ -464,7 +464,8 @@ malloc(size_t size)
                return malloc_large(size);
 
        if (size > sAvailable) {
-               dprintf("malloc(): Out of memory!\n");
+               dprintf("malloc(): Out of memory allocating a block of %ld 
bytes, "
+                       "only %ld left!\n", size, sAvailable);
                return NULL;
        }
 
@@ -473,7 +474,8 @@ malloc(size_t size)
 
        if (chunk == NULL) {
                // could not find a free chunk as large as needed
-               dprintf("malloc(): Out of memory!\n");
+               dprintf("malloc(): Out of memory allocating a block of %ld 
bytes, "
+                       "no free chunks!\n", size);
                return NULL;
        }
 

############################################################################

Commit:      19024bc416679a9dcd31c9175c77e4e01f39441e
URL:         https://git.haiku-os.org/haiku/commit/?id=19024bc41667
Author:      PulkoMandy <pulkomandy@xxxxxxxxxxxxx>
Date:        Wed Dec 30 21:42:50 2020 UTC
Committer:   waddlesplash <waddlesplash@xxxxxxxxx>
Commit-Date: Thu Dec 31 02:58:10 2020 UTC

openfirmware: synchronize number of memory range with bios and efi

It was bumped for bios and efi from previously very low values, but
other architectures did not follow.

Change-Id: I6ce92e2cdb0261d4d0637753e77d555d407073fc
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3575
Reviewed-by: waddlesplash <waddlesplash@xxxxxxxxx>

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

diff --git 
a/headers/private/kernel/boot/platform/openfirmware/platform_kernel_args.h 
b/headers/private/kernel/boot/platform/openfirmware/platform_kernel_args.h
index 2c9cea97aa..6e951af4e3 100644
--- a/headers/private/kernel/boot/platform/openfirmware/platform_kernel_args.h
+++ b/headers/private/kernel/boot/platform/openfirmware/platform_kernel_args.h
@@ -13,8 +13,8 @@
 #define SMP_MAX_CPUS 1
        // TODO: Until inline kernel atomic code for ppc is fixed
 
-#define MAX_PHYSICAL_MEMORY_RANGE 4
-#define MAX_PHYSICAL_ALLOCATED_RANGE 8
+#define MAX_PHYSICAL_MEMORY_RANGE 32
+#define MAX_PHYSICAL_ALLOCATED_RANGE 32
 #define MAX_VIRTUAL_ALLOCATED_RANGE 32
 
 

############################################################################

Commit:      75c2a94a87a424bf560648b1076a886d2b7c7080
URL:         https://git.haiku-os.org/haiku/commit/?id=75c2a94a87a4
Author:      PulkoMandy <pulkomandy@xxxxxxxxxxxxx>
Date:        Wed Dec 30 21:44:55 2020 UTC
Committer:   waddlesplash <waddlesplash@xxxxxxxxx>
Commit-Date: Thu Dec 31 02:58:10 2020 UTC

sparc mmu: fix free physical range search

The code was ignoring most of the memory and eventually didn't find
enough of it to load all kernel modules.

Change-Id: I8abcb6cd20eb2a37147d720eb63af1c2820628f3
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3576
Reviewed-by: waddlesplash <waddlesplash@xxxxxxxxx>

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

diff --git a/src/system/boot/platform/openfirmware/arch/sparc/mmu.cpp 
b/src/system/boot/platform/openfirmware/arch/sparc/mmu.cpp
index 000f149790..6bae0a5e25 100644
--- a/src/system/boot/platform/openfirmware/arch/sparc/mmu.cpp
+++ b/src/system/boot/platform/openfirmware/arch/sparc/mmu.cpp
@@ -299,8 +299,7 @@ find_physical_memory_range(size_t size)
 static void *
 find_free_physical_range(size_t size)
 {
-       // just do a simple linear search at the end of the allocated
-       // ranges (dumb memory allocation)
+       // If nothing is allocated, just return the first address in RAM
        if (gKernelArgs.num_physical_allocated_ranges == 0) {
                if (gKernelArgs.num_physical_memory_ranges == 0)
                        return PHYSINVAL;
@@ -308,6 +307,7 @@ find_free_physical_range(size_t size)
                return find_physical_memory_range(size);
        }
 
+       // Try to find space after an already allocated range
        for (uint32 i = 0; i < gKernelArgs.num_physical_allocated_ranges; i++) {
                void *address
                        = (void 
*)(addr_t)(gKernelArgs.physical_allocated_range[i].start
@@ -317,6 +317,20 @@ find_free_physical_range(size_t size)
                        return address;
                }
        }
+
+       // Check if there is enough space at the start of one of the physical 
ranges
+       // (that memory isn't after an already allocated range so it wouldn't be
+       // found by the method above for ranges where there isn't already an 
initial
+       // allocation at the start)
+       for (uint32 i = 0; i < gKernelArgs.num_physical_memory_ranges; i++) {
+               void *address = (void 
*)gKernelArgs.physical_memory_range[i].start;
+               if (gKernelArgs.physical_memory_range[i].size > size
+                       && !is_physical_allocated(address, size)) {
+                       return address;
+               }
+       }
+
+       // We're really out of memory
        return PHYSINVAL;
 }
 

############################################################################

Revision:    hrev54833
Commit:      964ce003912da099d65567d71c1432d29ab34b24
URL:         https://git.haiku-os.org/haiku/commit/?id=964ce003912d
Author:      PulkoMandy <pulkomandy@xxxxxxxxxxxxx>
Date:        Wed Dec 30 21:45:44 2020 UTC
Committer:   waddlesplash <waddlesplash@xxxxxxxxx>
Commit-Date: Thu Dec 31 02:58:10 2020 UTC

openfirmware: we need a larger bootloader heap size

Currently about 366K are used. Round up to next power of two.

Change-Id: Id6713b4f4eebfbced310bbd75a16a5737228ae72
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3577
Reviewed-by: waddlesplash <waddlesplash@xxxxxxxxx>

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

diff --git a/src/system/boot/platform/openfirmware/start.cpp 
b/src/system/boot/platform/openfirmware/start.cpp
index f0f8abd7a1..ac3f5cde60 100644
--- a/src/system/boot/platform/openfirmware/start.cpp
+++ b/src/system/boot/platform/openfirmware/start.cpp
@@ -23,7 +23,7 @@
 #include "real_time_clock.h"
 
 
-#define HEAP_SIZE 65536
+#define HEAP_SIZE (512 * 1024)
 
 
 // GCC defined globals


Other related posts:

  • » [haiku-commits] haiku: hrev54833 - src/system/boot/platform/openfirmware/arch/sparc src/system/boot/platform/openfirmware src/system/boot/loader headers/private/kernel/boot/platform/openfirmware - waddlesplash