xref: /haiku/src/system/boot/platform/efi/menu.cpp (revision 21258e2674226d6aa732321b6f8494841895af5f)
1 /*
2  * Copyright 2016 Haiku, Inc. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 
6 
7 #include <boot/menu.h>
8 #include <boot/platform/generic/text_menu.h>
9 #include <safemode.h>
10 
11 #include "efi_platform.h"
12 #include "video.h"
13 #include "smp.h"
14 
15 
16 void
17 platform_add_menus(Menu *menu)
18 {
19 	MenuItem *item;
20 
21 	switch (menu->Type()) {
22 		case MAIN_MENU:
23 			item = new(std::nothrow)MenuItem("Select video mode", video_mode_menu());
24 			if (item != NULL) {
25 				menu->AddItem(item);
26 				item->SetTarget(video_mode_hook);
27 				item->SetShortcut('v');
28 			}
29 
30 			break;
31 
32 		case SAFE_MODE_MENU:
33 			item = new(std::nothrow) MenuItem("Use fail-safe graphics driver");
34 			if (item != NULL) {
35 				menu->AddItem(item);
36 				item->SetType(MENU_ITEM_MARKABLE);
37 				item->SetData(B_SAFEMODE_FAIL_SAFE_VIDEO_MODE);
38 				item->SetHelpText("The system will use VESA mode "
39 					"and won't try to use any video graphics drivers.");
40 			}
41 
42 			smp_add_safemode_menus(menu);
43 
44 			item = new(std::nothrow) MenuItem("Disable ACPI");
45 			if (item != NULL) {
46 				menu->AddItem(item);
47 				item->SetType(MENU_ITEM_MARKABLE);
48 				item->SetData(B_SAFEMODE_DISABLE_ACPI);
49 				item->SetHelpText("Disables Advanced Configuration and Power "
50 					"Interface hardware support, overriding the ACPI setting "
51 					"in the kernel settings file.");
52 			}
53 			break;
54 
55 		default:
56 			break;
57 	}
58 }
59 
60 
61 void
62 platform_update_menu_item(Menu *menu, MenuItem *item)
63 {
64 	platform_generic_update_text_menu_item(menu, item);
65 }
66 
67 
68 void
69 platform_run_menu(Menu *menu)
70 {
71 	platform_generic_run_text_menu(menu);
72 }
73 
74 
75 size_t
76 platform_get_user_input_text(Menu *menu, MenuItem *item, char *buffer,
77 	size_t bufferSize)
78 {
79 	return platform_generic_get_user_input_text(menu, item, buffer,
80 		bufferSize);
81 }
82