From deead1deb6f060139a49091570d7c936664c12b3 Mon Sep 17 00:00:00 2001 From: Jan Stoess Date: Wed, 23 Jun 2010 16:20:38 +0200 Subject: [PATCH] Use nicer casting when retrieving 64-bit FDT entries Assume UART to be mapped beyond 4GB on PPC embedded boards. --- kernel/kdb/platform/ppc44x/io.cc | 10 +++++----- kernel/src/platform/ppc44x/fdt.h | 2 +- kernel/src/platform/ppc44x/uic.cc | 3 ++- user/lib/io/fdt.cc | 1 - user/lib/io/fdt.h | 2 +- user/util/kickstart/fdt.h | 2 +- user/util/kickstart/powerpc.cc | 1 - 7 files changed, 10 insertions(+), 11 deletions(-) diff --git a/kernel/kdb/platform/ppc44x/io.cc b/kernel/kdb/platform/ppc44x/io.cc index a26c43c1..ba1a13db 100644 --- a/kernel/kdb/platform/ppc44x/io.cc +++ b/kernel/kdb/platform/ppc44x/io.cc @@ -128,16 +128,16 @@ static void init_serial (void) if (! (prop = fdt->find_property_node(node, "serial0")) ) return; - if (!(node = fdt->find_subtree(prop->get_string()))) return; if (! (prop = fdt->find_property_node(node, "reg")) ) return; - - //comport = (u8_t *) prop->get_word(0); - comport = (u8_t*)setup_console_mapping(0x140000200ULL, 12); - + + // Serial bus is beyond 4GB + u64_t comport_phys = 0x100000000ULL | (u64_t) prop->get_word(0); + comport = (u8_t*)setup_console_mapping(comport_phys, 12); + #endif /* CONFIG_COMPORT == 0 */ if (comport) diff --git a/kernel/src/platform/ppc44x/fdt.h b/kernel/src/platform/ppc44x/fdt.h index 7a6c6d27..31d9165c 100644 --- a/kernel/src/platform/ppc44x/fdt.h +++ b/kernel/src/platform/ppc44x/fdt.h @@ -3,7 +3,7 @@ * Copyright (C) 1999-2010, Karlsruhe University * Copyright (C) 2008-2009, Volkmar Uhlig, IBM Corporation * - * File path: src/platform/ppc44x/fdt.h + * File path: platform/ppc44x/fdt.h * Description: * * Redistribution and use in source and binary forms, with or without diff --git a/kernel/src/platform/ppc44x/uic.cc b/kernel/src/platform/ppc44x/uic.cc index 26877bcc..56c1c993 100644 --- a/kernel/src/platform/ppc44x/uic.cc +++ b/kernel/src/platform/ppc44x/uic.cc @@ -53,7 +53,8 @@ void SECTION (".init") intctrl_t::init_arch() prop = fdt->find_property_node(hdr, "compatible"); - if (!prop || strcmp(prop->get_string(), "ibm,uic") || strcmp(prop->get_string(), "ibm,uic-440gp") != 0) + if (!prop || strcmp(prop->get_string(), "ibm,uic") || + strcmp(prop->get_string(), "ibm,uic-440gp") != 0) panic("UIC0: Couldn't find compatible node in FDT\n"); prop = fdt->find_property_node(hdr, "dcr-reg"); diff --git a/user/lib/io/fdt.cc b/user/lib/io/fdt.cc index 063fb3f7..7eaad31e 100644 --- a/user/lib/io/fdt.cc +++ b/user/lib/io/fdt.cc @@ -34,7 +34,6 @@ #include "fdt.h" #include "lib.h" -static const char *indent = " "; fdt_header_t *fdt_t::find_subtree_node(fdt_node_t *node, char *name) { diff --git a/user/lib/io/fdt.h b/user/lib/io/fdt.h index f839ae47..764789b7 100644 --- a/user/lib/io/fdt.h +++ b/user/lib/io/fdt.h @@ -120,7 +120,7 @@ public: L4_Word_t get_word(int index) { return data[index]; } L4_Word64_t get_u64(int index) - { return *(reinterpret_cast(&data[index])); } + { return ((L4_Word64_t)data[index]) << 32 | ((L4_Word64_t)data[index + 1]); } char *get_string() { return (char*)data; } diff --git a/user/util/kickstart/fdt.h b/user/util/kickstart/fdt.h index d1a6140e..e5cd36f0 100644 --- a/user/util/kickstart/fdt.h +++ b/user/util/kickstart/fdt.h @@ -120,7 +120,7 @@ public: L4_Word_t get_word(int index) { return data[index]; } L4_Word64_t get_u64(int index) - { return *(reinterpret_cast(&data[index])); } + { return ((L4_Word64_t)data[index]) << 32 | ((L4_Word64_t)data[index + 1]); } char *get_string() { return (char*)data; } diff --git a/user/util/kickstart/powerpc.cc b/user/util/kickstart/powerpc.cc index f33e7849..697ce84f 100644 --- a/user/util/kickstart/powerpc.cc +++ b/user/util/kickstart/powerpc.cc @@ -183,7 +183,6 @@ void launch_kernel(L4_Word_t entry) entry_secondary = kernel; /* release APs */ asm("msync; dcbi 0, %0" : : "b"(&entry_secondary)); - (*kernel)(); }