Use nicer casting when retrieving 64-bit FDT entries

Assume UART to be mapped beyond 4GB on PPC embedded boards.
This commit is contained in:
Jan Stoess 2010-06-23 16:20:38 +02:00
parent 1bfcd3e1c2
commit deead1deb6
7 changed files with 10 additions and 11 deletions

View File

@ -128,16 +128,16 @@ static void init_serial (void)
if (! (prop = fdt->find_property_node(node, "serial0")) ) if (! (prop = fdt->find_property_node(node, "serial0")) )
return; return;
if (!(node = fdt->find_subtree(prop->get_string()))) if (!(node = fdt->find_subtree(prop->get_string())))
return; return;
if (! (prop = fdt->find_property_node(node, "reg")) ) if (! (prop = fdt->find_property_node(node, "reg")) )
return; return;
//comport = (u8_t *) prop->get_word(0); // Serial bus is beyond 4GB
comport = (u8_t*)setup_console_mapping(0x140000200ULL, 12); u64_t comport_phys = 0x100000000ULL | (u64_t) prop->get_word(0);
comport = (u8_t*)setup_console_mapping(comport_phys, 12);
#endif /* CONFIG_COMPORT == 0 */ #endif /* CONFIG_COMPORT == 0 */
if (comport) if (comport)

View File

@ -3,7 +3,7 @@
* Copyright (C) 1999-2010, Karlsruhe University * Copyright (C) 1999-2010, Karlsruhe University
* Copyright (C) 2008-2009, Volkmar Uhlig, IBM Corporation * Copyright (C) 2008-2009, Volkmar Uhlig, IBM Corporation
* *
* File path: src/platform/ppc44x/fdt.h * File path: platform/ppc44x/fdt.h
* Description: * Description:
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@ -53,7 +53,8 @@ void SECTION (".init") intctrl_t::init_arch()
prop = fdt->find_property_node(hdr, "compatible"); 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"); panic("UIC0: Couldn't find compatible node in FDT\n");
prop = fdt->find_property_node(hdr, "dcr-reg"); prop = fdt->find_property_node(hdr, "dcr-reg");

View File

@ -34,7 +34,6 @@
#include "fdt.h" #include "fdt.h"
#include "lib.h" #include "lib.h"
static const char *indent = " ";
fdt_header_t *fdt_t::find_subtree_node(fdt_node_t *node, char *name) fdt_header_t *fdt_t::find_subtree_node(fdt_node_t *node, char *name)
{ {

View File

@ -120,7 +120,7 @@ public:
L4_Word_t get_word(int index) L4_Word_t get_word(int index)
{ return data[index]; } { return data[index]; }
L4_Word64_t get_u64(int index) L4_Word64_t get_u64(int index)
{ return *(reinterpret_cast<L4_Word64_t*>(&data[index])); } { return ((L4_Word64_t)data[index]) << 32 | ((L4_Word64_t)data[index + 1]); }
char *get_string() char *get_string()
{ return (char*)data; } { return (char*)data; }

View File

@ -120,7 +120,7 @@ public:
L4_Word_t get_word(int index) L4_Word_t get_word(int index)
{ return data[index]; } { return data[index]; }
L4_Word64_t get_u64(int index) L4_Word64_t get_u64(int index)
{ return *(reinterpret_cast<L4_Word64_t*>(&data[index])); } { return ((L4_Word64_t)data[index]) << 32 | ((L4_Word64_t)data[index + 1]); }
char *get_string() char *get_string()
{ return (char*)data; } { return (char*)data; }

View File

@ -183,7 +183,6 @@ void launch_kernel(L4_Word_t entry)
entry_secondary = kernel; /* release APs */ entry_secondary = kernel; /* release APs */
asm("msync; dcbi 0, %0" : : "b"(&entry_secondary)); asm("msync; dcbi 0, %0" : : "b"(&entry_secondary));
(*kernel)(); (*kernel)();
} }