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, uint64_t *_result); 32 extern status_t platform_kernel_address_to_bootloader_address(uint64_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 47 #ifdef __cplusplus 48 } 49 50 // these functions have to be implemented in C++ 51 52 /* device functions */ 53 54 class Node; 55 namespace boot { 56 class Partition; 57 } 58 59 extern status_t platform_add_boot_device(struct stage2_args *args, NodeList *devicesList); 60 extern status_t platform_add_block_devices(struct stage2_args *args, NodeList *devicesList); 61 extern status_t platform_get_boot_partitions(struct stage2_args *args, Node *bootDevice, 62 NodeList *partitions, NodeList *bootPartitions); 63 extern status_t platform_register_boot_device(Node *device); 64 extern void platform_cleanup_devices(); 65 66 /* menu functions */ 67 68 class Menu; 69 class MenuItem; 70 71 extern void platform_add_menus(Menu *menu); 72 extern void platform_update_menu_item(Menu *menu, MenuItem *item); 73 extern void platform_run_menu(Menu *menu); 74 extern size_t platform_get_user_input_text(Menu *menu, MenuItem *item, 75 char *buffer, size_t bufferSize); 76 extern char* platform_debug_get_log_buffer(size_t* _size); 77 78 #endif 79 80 #endif /* KERNEL_BOOT_PLATFORM_H */ 81