16152d8f5SFrançois Revol/*
234dc9962SFrançois Revol * Copyright 2008-2010, Fran��ois Revol, revol@free.fr. All rights reserved.
36152d8f5SFrançois Revol * Copyright 2004-2007, Axel D��rfler, axeld@pinc-software.de. All rights reserved.
46152d8f5SFrançois Revol * Distributed under the terms of the MIT License.
56152d8f5SFrançois Revol */
66152d8f5SFrançois Revol
76152d8f5SFrançois Revol
86152d8f5SFrançois Revol#include "smp.h"
96152d8f5SFrançois Revol#include "video.h"
106152d8f5SFrançois Revol
116152d8f5SFrançois Revol#include <boot/menu.h>
126152d8f5SFrançois Revol#include <boot/platform/generic/text_menu.h>
136152d8f5SFrançois Revol#include <safemode.h>
146152d8f5SFrançois Revol
156152d8f5SFrançois Revol
166152d8f5SFrançois Revolvoid
176152d8f5SFrançois Revolplatform_add_menus(Menu *menu)
186152d8f5SFrançois Revol{
196152d8f5SFrançois Revol	MenuItem *item;
206152d8f5SFrançois Revol
216152d8f5SFrançois Revol	switch (menu->Type()) {
226152d8f5SFrançois Revol		case MAIN_MENU:
237ce3cbfbSRahul Jain			menu->AddItem(item = new(nothrow) MenuItem("Select screen resolution", video_mode_menu()));
246152d8f5SFrançois Revol			item->SetTarget(video_mode_hook);
256152d8f5SFrançois Revol			break;
266152d8f5SFrançois Revol		case SAFE_MODE_MENU:
277ce3cbfbSRahul Jain			menu->AddItem(item = new(nothrow) MenuItem("Use fail-safe graphics driver"));
286152d8f5SFrançois Revol			item->SetType(MENU_ITEM_MARKABLE);
296152d8f5SFrançois Revol			item->SetData(B_SAFEMODE_FAIL_SAFE_VIDEO_MODE);
306152d8f5SFrançois Revol			item->SetHelpText("The system will use VESA mode and won't try to open any video graphics driver");
316152d8f5SFrançois Revol
329776e38eSFrançois Revol#if 0
336152d8f5SFrançois Revol			smp_add_safemode_menus(menu);
346152d8f5SFrançois Revol
356152d8f5SFrançois Revol			menu->AddItem(item = new(nothrow) MenuItem("Don't call the BIOS"));
366152d8f5SFrançois Revol			item->SetType(MENU_ITEM_MARKABLE);
376152d8f5SFrançois Revol
386152d8f5SFrançois Revol			menu->AddItem(item = new(nothrow) MenuItem("Disable APM"));
396152d8f5SFrançois Revol			item->SetType(MENU_ITEM_MARKABLE);
406152d8f5SFrançois Revol			item->SetData("disable_apm");
416152d8f5SFrançois Revol			item->SetHelpText("This overrides the APM setting in the kernel settings file");
426152d8f5SFrançois Revol
436152d8f5SFrançois Revol			menu->AddItem(item = new(nothrow) MenuItem("Disable ACPI"));
446152d8f5SFrançois Revol			item->SetType(MENU_ITEM_MARKABLE);
456152d8f5SFrançois Revol			item->SetData(B_SAFEMODE_DISABLE_ACPI);
466152d8f5SFrançois Revol			item->SetHelpText("This overrides the ACPI setting in the kernel settings file");
476152d8f5SFrançois Revol#endif
486152d8f5SFrançois Revol			break;
496152d8f5SFrançois Revol		default:
506152d8f5SFrançois Revol			break;
516152d8f5SFrançois Revol	}
526152d8f5SFrançois Revol}
536152d8f5SFrançois Revol
546152d8f5SFrançois Revol
55b4aa5d34SRene Gollentvoid
566152d8f5SFrançois Revolplatform_update_menu_item(Menu *menu, MenuItem *item)
576152d8f5SFrançois Revol{
586152d8f5SFrançois Revol	platform_generic_update_text_menu_item(menu, item);
596152d8f5SFrançois Revol}
606152d8f5SFrançois Revol
616152d8f5SFrançois Revol
626152d8f5SFrançois Revolvoid
636152d8f5SFrançois Revolplatform_run_menu(Menu *menu)
646152d8f5SFrançois Revol{
656152d8f5SFrançois Revol	platform_generic_run_text_menu(menu);
666152d8f5SFrançois Revol}
676152d8f5SFrançois Revol
68b4aa5d34SRene Gollent
69b4aa5d34SRene Gollentsize_t
708837310cSRene Gollentplatform_get_user_input_text(Menu *menu, MenuItem *item, char *buffer,
71b4aa5d34SRene Gollent	size_t bufferSize)
72b4aa5d34SRene Gollent{
738837310cSRene Gollent	return platform_generic_get_user_input_text(menu, item, buffer,
74b4aa5d34SRene Gollent		bufferSize);
75b4aa5d34SRene Gollent}
76