/** @file
Dynamically update the pages.
Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "BootMaint.h"
/**
Refresh the global UpdateData structure.
**/
)
{
//
// Free current updated date
//
if (mStartOpCodeHandle != NULL) {
}
//
// Create new OpCode Handle
//
//
// Create Hii Extend Label OpCode as the start opcode
//
mStartLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (mStartOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
}
/**
Add a "Go back to main page" tag in front of the form when there are no
"Apply changes" and "Discard changes" tags in the end of the form.
@param CallbackData The BMM context data.
**/
)
{
if (!(CallbackData->BmmAskSaveOrNot)) {
//
// Add a "Go back to main page" tag in front of the form when there are no
// "Apply changes" and "Discard changes" tags in the end of the form.
//
0,
);
}
}
/**
Create the "Apply changes" and "Discard changes" tags. And
ensure user can return to the main page.
@param CallbackData The BMM context data.
**/
)
{
//
// Create the "Apply changes" and "Discard changes" tags.
//
if (CallbackData->BmmAskSaveOrNot) {
0,
0,
0
);
0
);
}
//
// Ensure user can return to the main page.
//
0
);
mStartOpCodeHandle, // Label CallbackData->BmmCurrentPageId
mEndOpCodeHandle // LABEL_END
);
}
/**
Clean up the dynamic opcode at label and form specified by both LabelId.
@param LabelId It is both the Form ID and Label ID for opcode deletion.
@param CallbackData The BMM context data.
**/
)
{
//
// Remove all op-codes from dynamic page
//
mStartOpCodeHandle, // Label LabelId
mEndOpCodeHandle // LABEL_END
);
}
/**
Boot a file selected by user at File Expoloer of BMM.
@param FileContext The file context data, which contains the device path
of the file to be boot from.
@retval EFI_SUCCESS The function completed successfull.
@return Other value if the boot from the file fails.
**/
)
{
Option->Description = (CHAR16 *) AllocateCopyPool (StrSize (FileContext->FileName), FileContext->FileName);
Option->LoadOptionsSize = 0;
//
// Since current no boot from removable media directly is allowed */
//
ExitDataSize = 0;
return Status;
}
/**
Create a list of Goto Opcode for all terminal devices logged
by TerminaMenu. This list will be inserted to form FORM_CON_COM_SETUP_ID.
@param CallbackData The BMM context data.
**/
)
{
);
}
}
/**
Create a lit of boot option from global BootOptionMenu. It
allow user to delete the boot option.
@param CallbackData The BMM context data.
**/
)
{
ASSERT (BootOptionMenu.MenuNumber <= (sizeof (CallbackData->BmmFakeNvData.OptionDel) / sizeof (CallbackData->BmmFakeNvData.OptionDel[0])));
if (NewLoadContext->IsLegacy) {
continue;
}
0,
0,
);
}
}
/**
Create a lit of driver option from global DriverMenu.
@param CallbackData The BMM context data.
**/
)
{
);
}
}
/**
Create a lit of driver option from global DriverOptionMenu. It
allow user to delete the driver option.
@param CallbackData The BMM context data.
**/
)
{
ASSERT (DriverOptionMenu.MenuNumber <= (sizeof (CallbackData->BmmFakeNvData.OptionDel) / sizeof (CallbackData->BmmFakeNvData.OptionDel[0])));
0,
0,
);
}
}
/**
Prepare the page to allow user to add description for
a Driver Option.
@param CallbackData The BMM context data.
**/
)
{
0,
0,
0
);
0,
0,
6,
75,
);
0,
0,
);
0,
0,
6,
75,
);
}
/**
Update console page.
@param UpdatePageId The form ID to be updated.
@param ConsoleMenu The console menu list.
@param CallbackData The BMM context data.
**/
)
{
CheckFlags = 0;
if (NewConsoleContext->IsActive) {
} else {
}
0,
);
}
CheckFlags = 0;
) {
} else {
}
0,
);
Index++;
}
}
/**
Update the page's NV Map if user has changed the order
a list. This list can be Boot Order or Driver Order.
@param UpdatePageId The form ID to be updated.
@param OptionMenu The new list.
@param CallbackData The BMM context data.
**/
)
{
ZeroMem (CallbackData->BmmFakeNvData.OptionOrder, sizeof (CallbackData->BmmFakeNvData.OptionOrder));
for (
Index = 0, OptionOrderIndex = 0;
(
(
)
)
);
Index++
) {
if (NewLoadContext->IsLegacy) {
} else {
//
// Only show one legacy boot option for the same device type
// assuming the boot options are grouped by the device type
//
continue;
}
}
0,
);
CallbackData->BmmFakeNvData.OptionOrder[OptionOrderIndex++] = (UINT32) (NewMenuEntry->OptionNumber + 1);
}
if (OptionMenu->MenuNumber > 0) {
mStartOpCodeHandle, // Container for dynamic created opcodes
VARSTORE_ID_BOOT_MAINT, // VarStore ID
OPTION_ORDER_VAR_OFFSET, // Offset in Buffer Storage
0, // Question flag
0, // Ordered list flag, e.g. EFI_IFR_UNIQUE_SET
100, // Maximum container
);
}
CopyMem (
);
}
/**
Create the dynamic page to allow user to set
the "BootNext" value.
@param CallbackData The BMM context data.
**/
)
{
if (NumberOfOptions > 0) {
if (NewLoadContext->IsBootNext) {
);
} else {
0,
);
}
}
);
} else {
0,
);
}
0,
);
}
}
/**
Create the dynamic page to allow user to set the "TimeOut" value.
@param CallbackData The BMM context data.
**/
)
{
HiiCreateDefaultOpCode (DefaultOpCodeHandle, EFI_HII_DEFAULT_CLASS_STANDARD, EFI_IFR_TYPE_NUM_SIZE_16, BootTimeOut);
0,
0,
65535,
0,
);
}
/**
Refresh the text mode page.
@param CallbackData The BMM context data.
**/
)
{
Index = 0;
ValidMode = 0;
//
// Check valid mode
//
continue;
}
ValidMode++;
}
if (ValidMode == 0) {
return;
}
//
// Determin which mode should be the first entry in menu
//
//
// Build text mode options
//
continue;
}
//
// Build mode string Column x Row
//
PStr = &ModeString[0];
);
} else {
0,
);
}
Index++;
}
);
}
/**
Create the dynamic page which allows user to set the property such as Baud Rate, Data Bits,
Parity, Stop Bits, Terminal Type.
@param CallbackData The BMM context data.
**/
)
{
);
if (NewMenuEntry == NULL) {
return ;
}
CheckFlags = 0;
}
);
}
0,
);
CheckFlags = 0;
}
);
}
0,
);
CheckFlags = 0;
}
);
}
0,
);
CheckFlags = 0;
}
);
}
0,
);
CheckFlags = 0;
}
);
}
0,
);
0,
);
}
0,
);
}
/**
Dispatch the correct update page function to call based on
the UpdatePageId.
@param UpdatePageId The form ID.
@param CallbackData The BMM context data.
**/
)
{
switch (UpdatePageId) {
case FORM_CON_IN_ID:
break;
case FORM_CON_OUT_ID:
break;
case FORM_CON_ERR_ID:
break;
case FORM_BOOT_CHG_ID:
break;
case FORM_DRV_CHG_ID:
break;
default:
break;
}
}
/**
Get the index number (#### in Boot####) for the boot option pointed to a BBS legacy device type
specified by DeviceType.
@param DeviceType The legacy device type. It can be floppy, network, harddisk, cdrom,
etc.
@param OptionIndex Returns the index number (#### in Boot####).
@param OptionSize Return the size of the Boot### variable.
**/
VOID *
)
{
//
// Get Boot Option number from the size of BootOrder
//
L"BootOrder",
);
if (OrderBuffer == NULL) {
return NULL;
}
);
if (NULL == OptionBuffer) {
continue;
}
//
// Now Ptr point to Device Path
//
Ptr += FilePathSize;
//
// Now Ptr point to Optional Data
//
OptionalData = Ptr;
) {
return OptionBuffer;
} else {
}
}
return NULL;
}
/**
Create a dynamic page so that Legacy Device boot order
can be set for specified device type.
@param UpdatePageId The form ID. It also spefies the legacy device type.
@param CallbackData The BMM context data.
**/
)
{
OptionMenu = NULL;
Key = 0;
StrRef = 0;
StrRefHelp = 0;
TypeStrHelp = NULL;
LegacyOrder = NULL;
DisMap = ZeroMem (CallbackData->BmmOldFakeNVData.DisableMap, sizeof (CallbackData->BmmOldFakeNVData.DisableMap));
//
// Create oneof option list
//
switch (UpdatePageId) {
case FORM_SET_FD_ORDER_ID:
break;
case FORM_SET_HD_ORDER_ID:
break;
case FORM_SET_CD_ORDER_ID:
break;
case FORM_SET_NET_ORDER_ID:
break;
case FORM_SET_BEV_ORDER_ID:
break;
default:
return;
}
//
// Create OneOf for each legacy device
//
0,
);
}
//
// Create OneOf for item "Disabled"
//
0,
0xFF
);
//
// Get Device Order from variable
//
);
break;
}
}
//
//
//
// Create the string for oneof tag
//
);
VarDevOrder = *(UINT16 *) ((UINT8 *) DevOrder + sizeof (BBS_TYPE) + sizeof (UINT16) + Index * sizeof (UINT16));
} else {
}
}
}
}
/**
Dispatch the display to the next page based on NewPageId.
@param Private The BMM context data.
@param NewPageId The original page ID.
**/
)
{
//
// If we select a handle to add driver option, advance to the add handle description page.
//
//
// Return to main page after "Save Changes" or "Discard Changes".
//
}
}
}