3 * \brief Support header file
6 * \author Adam Lackorznynski <adam@os.inf.tu-dresden.de>
10 * (c) 2008-2009 Author(s)
11 * economic rights: Technische Universität Dresden (Germany)
13 * This file is part of TUD:OS and distributed under the terms of the
14 * GNU General Public License 2.
15 * Please see the COPYING-GPL-2 file for details.
17 #ifndef __BOOTSTRAP__SUPPORT_H__
18 #define __BOOTSTRAP__SUPPORT_H__
20 #include <l4/drivers/uart_base.h>
21 #include <l4/util/mb_info.h>
26 void set_stdio_uart(L4::Uart *uart);
29 unsigned long scan_ram_size(unsigned long base_addr, unsigned long max_scan_size_mb);
35 virtual void init() = 0;
36 virtual void setup_memory_map(l4util_mb_info_t *mbi,
37 Region_list *ram, Region_list *regions) = 0;
38 virtual bool probe() = 0;
46 // remember the chosen platform
47 static Platform_base *platform;
50 static void iterate_platforms()
52 extern Platform_base *__PLATFORMS_BEGIN[];
53 extern Platform_base *__PLATFORMS_END[];
54 for (Platform_base **p = __PLATFORMS_BEGIN; p < __PLATFORMS_END; ++p)
55 if (*p && (*p)->probe())
64 #define REGISTER_PLATFORM(type) \
65 static type type##_inst; \
66 static type * const __attribute__((section(".platformdata"),used)) type##_inst_p = &type##_inst
69 class Platform_single_region_ram : public Platform_base
72 void setup_memory_map(l4util_mb_info_t *,
73 Region_list *ram, Region_list *)
75 unsigned long ram_size_mb = scan_ram_size(RAM_BASE, RAM_SIZE_MB);
76 printf(" Memory size is %ldMB%s (%08lx - %08lx)\n",
77 ram_size_mb, ram_size_mb != RAM_SIZE_MB ? " (Limited by Scan)" : "",
78 (unsigned long)RAM_BASE, RAM_BASE + (ram_size_mb << 20) - 1);
79 ram->add(Region::n(RAM_BASE,
80 (unsigned long long)RAM_BASE + (ram_size_mb << 20),
81 ".ram", Region::Ram));
86 #endif /* __BOOTSTRAP__SUPPORT_H__ */