[haiku-commits] haiku: hrev44157 - src/system/boot/platform/raspberrypi_arm src/system/kernel/arch/arm headers/private/kernel/arch/arm

  • From: kallisti5@xxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 15 May 2012 06:27:06 +0200 (CEST)

hrev44157 adds 3 changesets to branch 'master'
old head: cffe50984344ad9947a52b9f8318e8c67bec9c6a
new head: ec3c24ab07f5144c68988b49ec054a080f909b50

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

125c31a: pl011: Make memory reads and writes 32-bits

84882c0: rpi serial: C++ constructors not getting called
  
  * Make a global
  * Thanks to pfoetchen + OmniMancer for figuring it out

ec3c24a: pl011 uart: Work around Rpi constructors not getting called
  
  * Serial UART output on Raspberry Pi now functioning
    This is kind of a hack, however having serial output
    will enable easier debugging of loader. Not a perimant fix.
  * With UART output, we can now turn to why the constructors
    are so messed up.
  * Thanks to pfoetchen for his help and (lots!) of testing.

                          [ Alexander von Gluck IV <kallisti5@xxxxxxxxxxx> ]

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

4 files changed, 21 insertions(+), 32 deletions(-)
headers/private/kernel/arch/arm/uart_pl011.h       |    4 +--
.../boot/platform/raspberrypi_arm/serial.cpp       |   26 +++++-----------
src/system/boot/platform/raspberrypi_arm/start.c   |    7 +++--
src/system/kernel/arch/arm/uart_pl011.cpp          |   16 +++++-----

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

Commit:      125c31a827cbb3cb96d9fe3f08f301950912420e
URL:         http://cgit.haiku-os.org/haiku/commit/?id=125c31a
Author:      Alexander von Gluck IV <kallisti5@xxxxxxxxxxx>
Date:        Tue May 15 01:47:55 2012 UTC

pl011: Make memory reads and writes 32-bits

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

diff --git a/headers/private/kernel/arch/arm/uart_pl011.h 
b/headers/private/kernel/arch/arm/uart_pl011.h
index 470f40b..79d9c8c 100644
--- a/headers/private/kernel/arch/arm/uart_pl011.h
+++ b/headers/private/kernel/arch/arm/uart_pl011.h
@@ -162,8 +162,8 @@ public:
        void                                    FlushRx();
 
 private:
-       void                                    WriteUart(uint32 reg, unsigned 
char data);
-       unsigned char                   ReadUart(uint32 reg);
+       void                                    WriteUart(uint32 reg, uint32 
data);
+       uint32                                  ReadUart(uint32 reg);
 
        bool                                    fUARTEnabled;
        addr_t                                  fUARTBase;
diff --git a/src/system/kernel/arch/arm/uart_pl011.cpp 
b/src/system/kernel/arch/arm/uart_pl011.cpp
index 3bcab84..7eb6132 100644
--- a/src/system/kernel/arch/arm/uart_pl011.cpp
+++ b/src/system/kernel/arch/arm/uart_pl011.cpp
@@ -63,16 +63,16 @@ UartPL011::~UartPL011()
 
 
 void
-UartPL011::WriteUart(uint32 reg, unsigned char data)
+UartPL011::WriteUart(uint32 reg, uint32 data)
 {
-       *(volatile unsigned char *)(fUARTBase + reg) = data;
+       *(volatile uint32*)(fUARTBase + reg) = data;
 }
 
 
-unsigned char
+uint32
 UartPL011::ReadUart(uint32 reg)
 {
-       return *(volatile unsigned char *)(fUARTBase + reg);
+       return *(volatile uint32*)(fUARTBase + reg);
 }
 
 

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

Commit:      84882c0039f72213219bf81a61a6c136a2090c13
URL:         http://cgit.haiku-os.org/haiku/commit/?id=84882c0
Author:      Alexander von Gluck IV <kallisti5@xxxxxxxxxxx>
Date:        Tue May 15 02:43:21 2012 UTC

rpi serial: C++ constructors not getting called

* Make a global
* Thanks to pfoetchen + OmniMancer for figuring it out

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

diff --git a/src/system/boot/platform/raspberrypi_arm/serial.cpp 
b/src/system/boot/platform/raspberrypi_arm/serial.cpp
index f6e786c..6c6627a 100644
--- a/src/system/boot/platform/raspberrypi_arm/serial.cpp
+++ b/src/system/boot/platform/raspberrypi_arm/serial.cpp
@@ -17,7 +17,8 @@
 #include <string.h>
 
 
-UartPL011* gLoaderUART;
+UartPL011 gLoaderUART(uart_base_debug());
+
 
 static int32 sSerialEnabled = 0;
 static char sBuffer[16384];
@@ -27,7 +28,7 @@ static uint32 sBufferPosition;
 static void
 serial_putc(char c)
 {
-       gLoaderUART->PutChar(c);
+       gLoaderUART.PutChar(c);
 }
 
 
@@ -80,12 +81,8 @@ serial_cleanup(void)
 extern "C" void
 serial_init(void)
 {
-       gLoaderUART = new(nothrow) UartPL011(uart_base_debug());
-       if (gLoaderUART == 0)
-               return;
-
-       gLoaderUART->InitEarly();
-       gLoaderUART->InitPort(9600);
+       gLoaderUART.InitEarly();
+       gLoaderUART.InitPort(9600);
 
        serial_enable();
 

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

Revision:    hrev44157
Commit:      ec3c24ab07f5144c68988b49ec054a080f909b50
URL:         http://cgit.haiku-os.org/haiku/commit/?id=ec3c24a
Author:      Alexander von Gluck IV <kallisti5@xxxxxxxxxxx>
Date:        Tue May 15 04:25:14 2012 UTC

pl011 uart: Work around Rpi constructors not getting called

* Serial UART output on Raspberry Pi now functioning
  This is kind of a hack, however having serial output
  will enable easier debugging of loader. Not a perimant fix.
* With UART output, we can now turn to why the constructors
  are so messed up.
* Thanks to pfoetchen for his help and (lots!) of testing.

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

diff --git a/src/system/boot/platform/raspberrypi_arm/serial.cpp 
b/src/system/boot/platform/raspberrypi_arm/serial.cpp
index 6c6627a..e0bb0ec 100644
--- a/src/system/boot/platform/raspberrypi_arm/serial.cpp
+++ b/src/system/boot/platform/raspberrypi_arm/serial.cpp
@@ -21,8 +21,6 @@ UartPL011 gLoaderUART(uart_base_debug());
 
 
 static int32 sSerialEnabled = 0;
-static char sBuffer[16384];
-static uint32 sBufferPosition;
 
 
 static void
@@ -38,12 +36,7 @@ serial_puts(const char* string, size_t size)
        if (sSerialEnabled <= 0)
                return;
 
-       if (sBufferPosition + size < sizeof(sBuffer)) {
-               memcpy(sBuffer + sBufferPosition, string, size);
-               sBufferPosition += size;
-       }
-
-       while (size-- != 0) {
+       while (size-- > 0) {
                char c = string[0];
 
                if (c == '\n') {
@@ -86,7 +79,5 @@ serial_init(void)
 
        serial_enable();
 
-       serial_putc('!');
-       serial_puts("SER INIT", 8);
+       serial_puts("Serial startup\n", 15);
 }
-
diff --git a/src/system/boot/platform/raspberrypi_arm/start.c 
b/src/system/boot/platform/raspberrypi_arm/start.c
index 258744a..691952a8 100644
--- a/src/system/boot/platform/raspberrypi_arm/start.c
+++ b/src/system/boot/platform/raspberrypi_arm/start.c
@@ -44,6 +44,7 @@ clear_bss(void)
 static void
 call_ctors(void)
 {
+       #warning BUG: constructors don't get called!
        void (**f)(void);
 
        for (f = &__ctor_list; f < &__ctor_end; f++) {
@@ -65,7 +66,7 @@ abort(void)
 uint32
 platform_boot_options(void)
 {
-#warning IMPLEMENT platform_boot_options
+       #warning IMPLEMENT platform_boot_options
        return 0;
 }
 
@@ -73,7 +74,7 @@ platform_boot_options(void)
 void
 platform_start_kernel(void)
 {
-#warning IMPLEMENT platform_start_kernel
+       #warning IMPLEMENT platform_start_kernel
        panic("kernel returned!\n");
 }
 
@@ -81,7 +82,7 @@ platform_start_kernel(void)
 void
 platform_exit(void)
 {
-#warning IMPLEMENT platform_exit
+       #warning IMPLEMENT platform_exit
 }
 
 
diff --git a/src/system/kernel/arch/arm/uart_pl011.cpp 
b/src/system/kernel/arch/arm/uart_pl011.cpp
index 7eb6132..916558a 100644
--- a/src/system/kernel/arch/arm/uart_pl011.cpp
+++ b/src/system/kernel/arch/arm/uart_pl011.cpp
@@ -104,7 +104,9 @@ void
 UartPL011::InitEarly()
 {
        // Perform special hardware UART configuration
-       // Raspberry Pi: Early gpio handled by gpio_init in platform code
+
+       #warning Raspberry Pi Hack: Fix constructors not getting called in 
loader.
+       fUARTBase = uart_base_debug();
 }
 
 
@@ -135,7 +137,7 @@ int
 UartPL011::PutChar(char c)
 {
        if (fUARTEnabled == true) {
-               WriteUart(PL01x_DR, (unsigned int)c);
+               WriteUart(PL01x_DR, c);
                // Empty the transmit buffer
                FlushTx();
                return 0;
@@ -145,7 +147,6 @@ UartPL011::PutChar(char c)
 }
 
 
-/* returns -1 if no data available */
 int
 UartPL011::GetChar(bool wait)
 {
@@ -158,7 +159,6 @@ void
 UartPL011::FlushTx()
 {
        while (ReadUart(PL01x_FR) & PL01x_FR_TXFF);
-               // wait for the last char to get out
 }
 
 


Other related posts: