[haiku-commits] haiku: hrev50109 - src/system/kernel/platform/u-boot headers/private/kernel/platform/u-boot src/system/boot/loader

  • From: revol@xxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 26 Feb 2016 23:03:00 +0100 (CET)

hrev50109 adds 4 changesets to branch 'master'
old head: 8c5db3649dcd394c1dedb0b506118b892a57aebc
new head: e89ef1fef72922bec0bf2b7b5d36e26b5e10a6eb
overview: 
http://cgit.haiku-os.org/haiku/log/?qt=range&q=e89ef1fef729+%5E8c5db3649dcd

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

73ef47f70ab1: loader: TRACE undefined symbols
  
  While the kernel shouldn't have any, it happens on platforms missing new 
features.
  
  Make it explicit.

14cfccd01179: U-Boot: add a 'physical' arg to fdt_get_device_reg()
  
  If false, try to use the virtual-reg property first.

c82af4bebe21: U-Boot: try to use virtual-reg to get the UART
  
  XXX: possibly only for _BOOT_MODE?

e89ef1fef729: U-Boot: TRACE fdt_serial instead of dprintf
  
  and disable it by default (it would hang on some platforms anyway).

                                          [ François Revol <revol@xxxxxxx> ]

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

4 files changed, 29 insertions(+), 11 deletions(-)
.../private/kernel/platform/u-boot/fdt_support.h |  2 +-
src/system/boot/loader/elf.cpp                   |  1 +
src/system/kernel/platform/u-boot/fdt_serial.cpp | 22 +++++++++++++-------
.../kernel/platform/u-boot/fdt_support.cpp       | 15 ++++++++++---

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

Commit:      73ef47f70ab1ae321681b5239b12bf0a82347435
URL:         http://cgit.haiku-os.org/haiku/commit/?id=73ef47f70ab1
Author:      François Revol <revol@xxxxxxx>
Date:        Fri Nov  6 08:28:49 2015 UTC

loader: TRACE undefined symbols

While the kernel shouldn't have any, it happens on platforms missing new 
features.

Make it explicit.

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

diff --git a/src/system/boot/loader/elf.cpp b/src/system/boot/loader/elf.cpp
index f77ebe2..ec685a4 100644
--- a/src/system/boot/loader/elf.cpp
+++ b/src/system/boot/loader/elf.cpp
@@ -419,6 +419,7 @@ ELFLoader<Class>::Resolve(ImageType* image, SymType* symbol,
                case SHN_UNDEF:
                        // Since we do that only for the kernel, there 
shouldn't be
                        // undefined symbols.
+                       TRACE(("elf_resolve_symbol: undefined symbol\n"));
                        return B_MISSING_SYMBOL;
                case SHN_ABS:
                        *symbolAddress = symbol->st_value;

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

Commit:      14cfccd011797d5d6a76c3e54881e32cd0b18087
URL:         http://cgit.haiku-os.org/haiku/commit/?id=14cfccd01179
Author:      François Revol <revol@xxxxxxx>
Date:        Sat Jun 13 00:23:14 2015 UTC

U-Boot: add a 'physical' arg to fdt_get_device_reg()

If false, try to use the virtual-reg property first.

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

diff --git a/headers/private/kernel/platform/u-boot/fdt_support.h 
b/headers/private/kernel/platform/u-boot/fdt_support.h
index 84a4642..2202bcd 100644
--- a/headers/private/kernel/platform/u-boot/fdt_support.h
+++ b/headers/private/kernel/platform/u-boot/fdt_support.h
@@ -16,7 +16,7 @@ void dump_fdt(const void *fdt);
 status_t fdt_get_cell_count(const void* fdt, int node,
        int32 &addressCells, int32 &sizeCells);
 
-phys_addr_t fdt_get_device_reg(const void* fdt, int node);
+phys_addr_t fdt_get_device_reg(const void* fdt, int node, bool physical=true);
 phys_addr_t fdt_get_device_reg_byname(const void* fdt, const char* name);
 phys_addr_t fdt_get_device_reg_byalias(const void* fdt, const char* alias);
 
diff --git a/src/system/kernel/platform/u-boot/fdt_support.cpp 
b/src/system/kernel/platform/u-boot/fdt_support.cpp
index c34b666..2fc7653 100644
--- a/src/system/kernel/platform/u-boot/fdt_support.cpp
+++ b/src/system/kernel/platform/u-boot/fdt_support.cpp
@@ -212,10 +212,11 @@ fdt_get_cell_count(const void* fdt, int node,
 
 
 phys_addr_t
-fdt_get_device_reg(const void* fdt, int node)
+fdt_get_device_reg(const void* fdt, int node, bool physical)
 {
-       const void *prop;
+       const void *prop = NULL;
        int len;
+       uint64 baseDevice = 0x0;
 
        int32 regAddressCells = 1;
        int32 regSizeCells = 1;
@@ -223,6 +224,15 @@ fdt_get_device_reg(const void* fdt, int node)
 
        // TODO: check for virtual-reg, and don't -= fdt_get_range_offset?
 
+       // XXX: not sure #address-cells & #size-cells actually apply to 
virtual-reg
+       if (!physical) {
+               prop = fdt_getprop(fdt, node, "virtual-reg", &len);
+               if (prop != NULL) {
+                       baseDevice = fdt32_to_cpu(*(uint32_t *)prop);
+                       return baseDevice;
+               }
+       }
+
        prop = fdt_getprop(fdt, node, "reg", &len);
 
        if (!prop) {
@@ -231,7 +241,6 @@ fdt_get_device_reg(const void* fdt, int node)
        }
 
        const uint32 *p = (const uint32 *)prop;
-       uint64 baseDevice = 0x0;
 
        // soc base address cells
        if (regAddressCells == 2)

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

Commit:      c82af4bebe218fa24ba7d19c8a3c43b186a02a73
URL:         http://cgit.haiku-os.org/haiku/commit/?id=c82af4bebe21
Author:      François Revol <revol@xxxxxxx>
Date:        Sat Jun 13 00:59:21 2015 UTC

U-Boot: try to use virtual-reg to get the UART

XXX: possibly only for _BOOT_MODE?

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

diff --git a/src/system/kernel/platform/u-boot/fdt_serial.cpp 
b/src/system/kernel/platform/u-boot/fdt_serial.cpp
index 810eed9..615a181 100644
--- a/src/system/kernel/platform/u-boot/fdt_serial.cpp
+++ b/src/system/kernel/platform/u-boot/fdt_serial.cpp
@@ -65,7 +65,7 @@ debug_uart_from_fdt(const void *fdt)
                return NULL;
 
        // determine the MMIO address
-       regs = fdt_get_device_reg(fdt, node);
+       regs = fdt_get_device_reg(fdt, node, false);
 
        if (regs == 0)
                return NULL;

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

Revision:    hrev50109
Commit:      e89ef1fef72922bec0bf2b7b5d36e26b5e10a6eb
URL:         http://cgit.haiku-os.org/haiku/commit/?id=e89ef1fef729
Author:      François Revol <revol@xxxxxxx>
Date:        Fri Dec 18 20:39:22 2015 UTC

U-Boot: TRACE fdt_serial instead of dprintf

and disable it by default (it would hang on some platforms anyway).

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

diff --git a/src/system/kernel/platform/u-boot/fdt_serial.cpp 
b/src/system/kernel/platform/u-boot/fdt_serial.cpp
index 615a181..6842437 100644
--- a/src/system/kernel/platform/u-boot/fdt_serial.cpp
+++ b/src/system/kernel/platform/u-boot/fdt_serial.cpp
@@ -30,6 +30,14 @@ extern "C" {
 #include "fdt_support.h"
 
 
+//#define TRACE_SERIAL
+#ifdef TRACE_SERIAL
+#      define TRACE(x...) dprintf("INIT: " x)
+#else
+#      define TRACE(x...) ;
+#endif
+
+
 // If we dprintf before the UART is initalized there will be no output
 
 
@@ -70,33 +78,33 @@ debug_uart_from_fdt(const void *fdt)
        if (regs == 0)
                return NULL;
 
-       dprintf("serial: using '%s', node %d @ %" B_PRIxPHYSADDR "\n",
-               name, node, regs);
+       TRACE(("serial: using '%s', node %d @ %" B_PRIxPHYSADDR "\n",
+               name, node, regs));
 
        // get the UART clock rate
        prop = fdt_getprop(fdt, node, "clock-frequency", &len);
        if (prop && len == 4) {
                clock = fdt32_to_cpu(*(uint32_t *)prop);
-               dprintf("serial: clock %ld\n", clock);
+               TRACE(("serial: clock %ld\n", clock));
        }
 
        // get current speed (XXX: not yet passed over)
        prop = fdt_getprop(fdt, node, "current-speed", &len);
        if (prop && len == 4) {
                speed = fdt32_to_cpu(*(uint32_t *)prop);
-               dprintf("serial: speed %ld\n", speed);
+               TRACE(("serial: speed %ld\n", speed));
        }
 
        // fdt_node_check_compatible returns 0 on match.
 
        if (fdt_node_check_compatible(fdt, node, "ns16550a") == 0
                || fdt_node_check_compatible(fdt, node, "ns16550") == 0) {
-               dprintf("serial: Found 8250 serial UART!\n");
+               TRACE(("serial: Found 8250 serial UART!\n"));
                uart = arch_get_uart_8250(regs, clock);
        #ifdef __ARM__
        } else if (fdt_node_check_compatible(fdt, node, "arm,pl011") == 0
                || fdt_node_check_compatible(fdt, node, "arm,primecell") == 0) {
-               dprintf("serial: Found pl011 serial UART!\n");
+               TRACE(("serial: Found pl011 serial UART!\n"));
                uart = arch_get_uart_pl011(regs, clock);
        #endif
        } else {


Other related posts: