xref: /haiku/headers/private/kernel/boot/platform.h (revision 64b46b706b02d969629415c9a44c394a2a5e4993)
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  
13  struct stage2_args;
14  
15  #ifdef __cplusplus
16  extern "C" {
17  #endif
18  
19  /* debug functions */
20  extern void panic(const char *format, ...);
21  extern void dprintf(const char *format, ...);
22  
23  /* heap functions */
24  extern void platform_release_heap(struct stage2_args *args, void *base);
25  extern status_t platform_init_heap(struct stage2_args *args, void **_base, void **_top);
26  
27  /* MMU/memory functions */
28  extern status_t platform_allocate_region(void **_virtualAddress, size_t size,
29  	uint8 protection, bool exactAddress);
30  extern status_t platform_free_region(void *address, size_t size);
31  extern status_t platform_bootloader_address_to_kernel_address(void *address, addr_t *_result);
32  extern 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  
38  extern uint32 platform_boot_options(void);
39  
40  /* misc functions */
41  extern status_t platform_init_video(void);
42  extern void platform_switch_to_logo(void);
43  extern void platform_switch_to_text_mode(void);
44  extern void platform_start_kernel(void);
45  extern void platform_exit(void);
46  extern 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  
55  class Node;
56  namespace boot {
57  	class Partition;
58  }
59  
60  extern status_t platform_add_boot_device(struct stage2_args *args, NodeList *devicesList);
61  extern status_t platform_add_block_devices(struct stage2_args *args, NodeList *devicesList);
62  extern status_t platform_get_boot_partition(struct stage2_args *args, Node *bootDevice,
63  					NodeList *partitions, boot::Partition **_partition);
64  extern status_t platform_register_boot_device(Node *device);
65  extern void platform_cleanup_devices();
66  
67  /* menu functions */
68  
69  class Menu;
70  class MenuItem;
71  
72  extern void platform_add_menus(Menu *menu);
73  extern void platform_update_menu_item(Menu *menu, MenuItem *item);
74  extern void platform_run_menu(Menu *menu);
75  extern size_t platform_get_user_input_text(Menu *menu, MenuItem *item,
76  	char *buffer, size_t bufferSize);
77  extern char* platform_debug_get_log_buffer(size_t* _size);
78  
79  #endif
80  
81  #endif	/* KERNEL_BOOT_PLATFORM_H */
82