1/*
2 * Copyright 2003-2006, Axel D��rfler, axeld@pinc-software.de.
3 * Distributed under the terms of the MIT License.
4 */
5#ifndef KERNEL_BOOT_PLATFORM_H
6#define KERNEL_BOOT_PLATFORM_H
7
8
9#include <SupportDefs.h>
10#include <boot/vfs.h>
11
12
13struct stage2_args;
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
19/* debug functions */
20extern void panic(const char *format, ...);
21extern void dprintf(const char *format, ...);
22
23/* heap functions */
24extern void platform_release_heap(struct stage2_args *args, void *base);
25extern status_t platform_init_heap(struct stage2_args *args, void **_base, void **_top);
26
27/* MMU/memory functions */
28extern status_t platform_allocate_region(void **_virtualAddress, size_t size,
29	uint8 protection, bool exactAddress);
30extern status_t platform_free_region(void *address, size_t size);
31extern status_t platform_bootloader_address_to_kernel_address(void *address, addr_t *_result);
32extern status_t platform_kernel_address_to_bootloader_address(addr_t address, void **_result);
33
34/* boot options */
35#define BOOT_OPTION_MENU			1
36#define BOOT_OPTION_DEBUG_OUTPUT	2
37
38extern uint32 platform_boot_options(void);
39
40/* misc functions */
41extern status_t platform_init_video(void);
42extern void platform_switch_to_logo(void);
43extern void platform_switch_to_text_mode(void);
44extern void platform_start_kernel(void);
45extern void platform_exit(void);
46extern void platform_load_ucode(BootVolume& volume);
47
48#ifdef __cplusplus
49}
50
51// these functions have to be implemented in C++
52
53/* device functions */
54
55class Node;
56namespace boot {
57	class Partition;
58}
59
60extern status_t platform_add_boot_device(struct stage2_args *args, NodeList *devicesList);
61extern status_t platform_add_block_devices(struct stage2_args *args, NodeList *devicesList);
62extern status_t platform_get_boot_partitions(struct stage2_args *args, Node *bootDevice,
63					NodeList *partitions, NodeList *bootPartitions);
64extern status_t platform_register_boot_device(Node *device);
65extern void platform_cleanup_devices();
66
67/* menu functions */
68
69class Menu;
70class MenuItem;
71
72extern void platform_add_menus(Menu *menu);
73extern void platform_update_menu_item(Menu *menu, MenuItem *item);
74extern void platform_run_menu(Menu *menu);
75extern size_t platform_get_user_input_text(Menu *menu, MenuItem *item,
76	char *buffer, size_t bufferSize);
77extern char* platform_debug_get_log_buffer(size_t* _size);
78
79#endif
80
81#endif	/* KERNEL_BOOT_PLATFORM_H */
82