FileExplorer.c revision 4fd606d1f5abe38e1f42c38de1d2e895166bd0f4
/** @file
File explorer related functions.
Copyright (c) 2004 - 2012, 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"
/**
Update the File Explore page.
@param CallbackData The BMM context data.
@param MenuOption Pointer to menu options to display.
**/
)
{
NewMenuEntry = NULL;
FormId = 0;
if (NewFileContext->IsBootLegacy) {
continue;
}
//
// Create Text opcode for directory, also create Text opcode for file in FileExplorerStateBootFromFile.
//
0
);
} else {
//
// Create Goto opcode for file in FileExplorerStateAddBootOption or FileExplorerStateAddDriverOptionState.
//
}
);
}
}
mStartOpCodeHandle, // Label FORM_FILE_EXPLORER_ID
mEndOpCodeHandle // LABEL_END
);
}
/**
Update the file explower page with the refershed file system.
@param CallbackData BMM context data
@param KeyValue Key value to identify the type of data to expect.
@retval TRUE Inform the caller to create a callback packet to exit file explorer.
@retval FALSE Indicate that there is no need to exit file explorer.
**/
)
{
NewMenuEntry = NULL;
//
// First in, display file system.
//
} else {
}
if (NewFileContext->IsDir ) {
goto exit;
}
} else {
switch (CallbackData->FeCurrentState) {
//
// Restore to original mode before launching boot option.
//
//
// Here boot from file
//
//
// Set proper video resolution and text mode for setup.
//
break;
} else {
}
CallbackData->LoadContext->FilePathList = ((BM_FILE_CONTEXT *) (CallbackData->MenuEntry->VariableContext))->DevicePath;
//
// Create Subtitle op-code for the display string of the option.
//
0,
0,
0
);
mStartOpCodeHandle, // Label FormId
mEndOpCodeHandle // LABEL_END
);
break;
default:
break;
}
}
}
exit:
return ExitFileExplorer;
}
/**
This function processes the results of changes in configuration.
When user select a interactive opcode, this callback will be triggered.
Based on the Question(QuestionId) that triggers the callback, the corresponding
actions is performed. It handles:
1) the addition of boot option.
2) the addition of driver option.
3) exit from file browser
4) update of file content if a dir is selected.
5) boot the file if a file is selected in "boot from file"
@param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
@param Action Specifies the type of action taken by the browser.
@param QuestionId A unique value which is sent to the original exporting driver
so that it can identify the type of data to expect.
@param Type The type of value for the question.
@param Value A pointer to the data being sent to the original exporting driver.
@param ActionRequest On return, points to the action requested by the callback function.
@retval EFI_SUCCESS The callback successfully handled the action.
@retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the variable and its data.
@retval EFI_DEVICE_ERROR The variable could not be saved.
@retval EFI_UNSUPPORTED The specified Action is not supported by the callback.
@retval EFI_INVALID_PARAMETER If paramter Value or ActionRequest is NULL.
**/
)
{
//
// All other action return unsupported.
//
return EFI_UNSUPPORTED;
}
//
// Retrieve uncommitted data from Form Browser
//
HiiGetBrowserData (&gFileExploreFormSetGuid, mFileExplorerStorageName, sizeof (FILE_EXPLORER_NV_DATA), (UINT8 *) NvRamMap);
if (Action == EFI_BROWSER_ACTION_CHANGED) {
return EFI_INVALID_PARAMETER;
}
//
// Apply changes and exit formset
//
return Status;
}
);
return Status;
}
}
} else if (QuestionId == KEY_VALUE_NO_SAVE_AND_EXIT_BOOT || QuestionId == KEY_VALUE_NO_SAVE_AND_EXIT_DRIVER) {
//
// Discard changes and exit formset
//
} else if (QuestionId < FILE_OPTION_OFFSET) {
//
// Exit File Explorer formset
//
}
} else if (Action == EFI_BROWSER_ACTION_CHANGING) {
return EFI_INVALID_PARAMETER;
}
if (QuestionId >= FILE_OPTION_OFFSET) {
}
}
return Status;
}