90 CHAR16 BootOptionName[
ARRAY_SIZE (L
"Boot####")];
92 BOOLEAN DevPathStringIsDynamic;
93 CHAR16 *DevPathString;
99 if ((Value != mLoadPrep) && (Value != mLoadFail) &&
100 (Value != mStartPrep) && (Value != mStartFail))
115 if (((Value == mLoadFail) || (Value == mStartFail)) &&
117 (Data->HeaderSize !=
sizeof *Data) ||
119 !
CompareGuid (&Data->Type, &gEfiStatusCodeSpecificDataGuid)))
123 "%a:%a: malformed Data\n",
127 return EFI_INVALID_PARAMETER;
133 VariableSize =
sizeof BootCurrent;
134 Status =
gRT->GetVariable (
136 &gEfiGlobalVariableGuid,
141 if (EFI_ERROR (Status)) {
144 "%a:%a: failed to get %g:\"%s\": %r\n",
147 &gEfiGlobalVariableGuid,
154 if (VariableSize !=
sizeof BootCurrent) {
157 "%a:%a: got %Lu bytes for %g:\"%s\", expected %Lu\n",
160 (UINT64)VariableSize,
161 &gEfiGlobalVariableGuid,
163 (UINT64)
sizeof BootCurrent
165 return EFI_INCOMPATIBLE_VERSION;
173 sizeof BootOptionName,
178 if (EFI_ERROR (Status)) {
181 "%a:%a: EfiBootManagerVariableToLoadOption(\"%s\"): %r\n",
193 DevPathStringIsDynamic =
TRUE;
195 BmBootOption.FilePath,
199 if (DevPathString ==
NULL) {
200 DevPathStringIsDynamic =
FALSE;
201 DevPathString = L
"<out of memory while formatting device path>";
207 if ((Value == mLoadPrep) || (Value == mStartPrep)) {
209 L
"%a: %a %s \"%s\" from %s\n",
211 Value == mLoadPrep ?
"loading" :
"starting",
213 BmBootOption.Description,
218 L
"%a: failed to %a %s \"%s\" from %s: %r\n",
220 Value == mLoadFail ?
"load" :
"start",
222 BmBootOption.Description,
231 if (DevPathStringIsDynamic) {
259 StatusCodeRouter = Context;
283 Status =
gBS->LocateProtocol (
284 &gEfiRscHandlerProtocolGuid,
286 (VOID **)&StatusCodeRouter
289 if (EFI_ERROR (Status)) {
296 mLoadPrep =
PcdGet32 (PcdProgressCodeOsLoaderLoad);
297 mLoadFail = (EFI_SOFTWARE_DXE_BS_DRIVER |
298 EFI_SW_DXE_BS_EC_BOOT_OPTION_LOAD_ERROR);
299 mStartPrep =
PcdGet32 (PcdProgressCodeOsLoaderStart);
300 mStartFail = (EFI_SOFTWARE_DXE_BS_DRIVER |
301 EFI_SW_DXE_BS_EC_BOOT_OPTION_FAILED);
307 if (EFI_ERROR (Status)) {
310 "%a:%a: failed to register status code handler: %r\n",
324 Status =
gBS->CreateEvent (
325 EVT_SIGNAL_EXIT_BOOT_SERVICES,
331 if (EFI_ERROR (Status)) {
337 "%a:%a: failed to create ExitBootServices() event: "
BOOLEAN EFIAPI CompareGuid(IN CONST GUID *Guid1, IN CONST GUID *Guid2)
CHAR16 *EFIAPI ConvertDevicePathToText(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN BOOLEAN DisplayOnly, IN BOOLEAN AllowShortcuts)
VOID EFIAPI FreePool(IN VOID *Buffer)
#define EFI_BOOT_CURRENT_VARIABLE_NAME
UINTN EFIAPI UnicodeSPrint(OUT CHAR16 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR16 *FormatString,...)
EFI_RUNTIME_SERVICES * gRT
#define ARRAY_SIZE(Array)
#define ASSERT_EFI_ERROR(StatusParameter)
#define DEBUG(Expression)
#define PcdGet32(TokenName)
UINT32 EFI_STATUS_CODE_VALUE
UINT32 EFI_STATUS_CODE_TYPE
STATIC EFI_STATUS EFIAPI HandleStatusCode(IN EFI_STATUS_CODE_TYPE CodeType, IN EFI_STATUS_CODE_VALUE Value, IN UINT32 Instance, IN EFI_GUID *CallerId, IN EFI_STATUS_CODE_DATA *Data)
EFI_STATUS EFIAPI PlatformBmPrintScRegisterHandler(VOID)
STATIC VOID EFIAPI UnregisterAtExitBootServices(IN EFI_EVENT Event, IN VOID *Context)
EFI_STATUS EFIAPI EfiBootManagerFreeLoadOption(IN EFI_BOOT_MANAGER_LOAD_OPTION *LoadOption)
EFI_STATUS EFIAPI EfiBootManagerVariableToLoadOption(IN CHAR16 *VariableName, IN OUT EFI_BOOT_MANAGER_LOAD_OPTION *LoadOption)
UINTN EFIAPI Print(IN CONST CHAR16 *Format,...)