[haiku-commits] haiku: hrev43299 - src/system/boot/platform/u-boot

  • From: revol@xxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 21 Nov 2011 03:20:13 +0100 (CET)

hrev43299 adds 2 changesets to branch 'master'
old head: 70ac17baab59be3a1c82826119e235d3a4549a4d
new head: 75e4ff02d0c9d51f1d7f8331c666198484093677

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

1cdb590: U-Boot: Print the panic message also to the serial port
  
  It seems puts() currently hangs when used in panic(), will need some more 
work.

75e4ff0: Style cleanup

                                          [ François Revol <revol@xxxxxxx> ]


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

3 files changed, 22 insertions(+), 6 deletions(-)
src/system/boot/platform/u-boot/debug.cpp   |   17 +++++++++++++++--
src/system/boot/platform/u-boot/devices.cpp |    7 +++++--
src/system/boot/platform/u-boot/start2.cpp  |    4 ++--

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

Commit:      1cdb5905fcb978d9f3f138db6dd2247a6f81af80
URL:         http://cgit.haiku-os.org/haiku/commit/?id=1cdb590
Author:      François Revol <revol@xxxxxxx>
Date:        Mon Nov 21 02:00:07 2011 UTC

U-Boot: Print the panic message also to the serial port

It seems puts() currently hangs when used in panic(), will need some more work.

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

diff --git a/src/system/boot/platform/u-boot/debug.cpp 
b/src/system/boot/platform/u-boot/debug.cpp
index 5b4e0ac..0fc8a3d 100644
--- a/src/system/boot/platform/u-boot/debug.cpp
+++ b/src/system/boot/platform/u-boot/debug.cpp
@@ -17,16 +17,29 @@
 extern "C" void
 panic(const char* format, ...)
 {
+       const char hint[] = "*** PANIC ***";
+       char buffer[512];
        va_list list;
+       int length;
 
        platform_switch_to_text_mode();
 
-       puts("*** PANIC ***");
+       serial_puts(hint, sizeof(hint));
+       serial_puts("\n", 1);
+       //fprintf(stderr, "%s", hint);
+       puts(hint);
 
        va_start(list, format);
-       vprintf(format, list);
+       length = vsnprintf(buffer, sizeof(buffer), format, list);
        va_end(list);
 
+       if (length >= (int)sizeof(buffer))
+               length = sizeof(buffer) - 1;
+
+       serial_puts(buffer, length);
+       //fprintf(stderr, "%s", buffer);
+       puts(buffer);
+
        puts("\nPress key to reboot.");
 
        clear_key_buffer();

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

Revision:    hrev43299
Commit:      75e4ff02d0c9d51f1d7f8331c666198484093677
URL:         http://cgit.haiku-os.org/haiku/commit/?id=75e4ff0
Author:      François Revol <revol@xxxxxxx>
Date:        Mon Nov 21 02:19:31 2011 UTC

Style cleanup

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

diff --git a/src/system/boot/platform/u-boot/devices.cpp 
b/src/system/boot/platform/u-boot/devices.cpp
index 9e3f95e..650211b 100644
--- a/src/system/boot/platform/u-boot/devices.cpp
+++ b/src/system/boot/platform/u-boot/devices.cpp
@@ -27,9 +27,12 @@ platform_add_boot_device(struct stage2_args *args, NodeList 
*devicesList)
 
        if (!args->platform.boot_tgz_data || !args->platform.boot_tgz_size)
                return B_DEVICE_NOT_FOUND;
-       TRACE("Memory Disk at: %lx size: %lx\n",args->platform.boot_tgz_data, 
args->platform.boot_tgz_size);
+
+       TRACE("Memory Disk at: %lx size: %lx\n", args->platform.boot_tgz_data,
+               args->platform.boot_tgz_size);
+
        MemoryDisk* disk = new(nothrow) MemoryDisk(
-               (const uint8 *)args->platform.boot_tgz_data, 
+               (const uint8 *)args->platform.boot_tgz_data,
                args->platform.boot_tgz_size, "boot.tgz");
        if (!disk) {
                dprintf("platform_add_boot_device(): Could not create 
MemoryDisk !\n");
diff --git a/src/system/boot/platform/u-boot/start2.cpp 
b/src/system/boot/platform/u-boot/start2.cpp
index ac42a10..32fdcde 100644
--- a/src/system/boot/platform/u-boot/start2.cpp
+++ b/src/system/boot/platform/u-boot/start2.cpp
@@ -102,7 +102,6 @@ platform_start_kernel(void)
        status_t error = arch_start_kernel(&gKernelArgs, kernelEntry,
                stackTop);
 
-       dprintf("kernel returned!\n");
        panic("kernel returned!\n");
 }
 
@@ -152,7 +151,8 @@ start_raw(int argc, const char **argv)
 
        // if we get passed a uimage, try to find the second blob
        if (gUImage != NULL
-               && image_multi_getimg(gUImage, 1, 
(uint32*)&args.platform.boot_tgz_data,
+               && image_multi_getimg(gUImage, 1,
+                       (uint32*)&args.platform.boot_tgz_data,
                        &args.platform.boot_tgz_size)) {
                dprintf("Found boot tgz @ %p, %" B_PRIu32 " bytes\n",
                        args.platform.boot_tgz_data, 
args.platform.boot_tgz_size);


Other related posts:

  • » [haiku-commits] haiku: hrev43299 - src/system/boot/platform/u-boot - revol