2 Platform BDS customizations.
4 Copyright (c) 2004 - 2008, Intel Corporation. <BR>
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #include "BdsPlatform.h"
22 VOID
*mEfiDevPathNotifyReg
;
23 EFI_EVENT mEfiDevPathEvent
;
27 // Function prototypes
31 InstallDevicePathCallback (
37 // BDS Platform Functions
48 Platform Bds init. Incude the platform firmware vendor, revision
59 DEBUG ((EFI_D_INFO
, "PlatformBdsInit\n"));
60 InstallDevicePathCallback ();
80 EFI_SUCCESS - Connect RootBridge successfully.
81 EFI_STATUS - Connect RootBridge fail.
86 EFI_HANDLE RootHandle
;
89 // Make all the PCI_IO protocols on PCI Seg 0 show up
91 BdsLibConnectDevicePath (gPlatformRootBridges
[0]);
93 Status
= gBS
->LocateDevicePath (
94 &gEfiDevicePathProtocolGuid
,
95 &gPlatformRootBridges
[0],
98 if (EFI_ERROR (Status
)) {
102 Status
= gBS
->ConnectController (RootHandle
, NULL
, NULL
, FALSE
);
103 if (EFI_ERROR (Status
)) {
112 PrepareLpcBridgeDevicePath (
113 IN EFI_HANDLE DeviceHandle
119 Add IsaKeyboard to ConIn,
120 add IsaSerial to ConOut, ConIn, ErrOut.
125 DeviceHandle - Handle of PCIIO protocol.
129 EFI_SUCCESS - LPC bridge is added to ConOut, ConIn, and ErrOut.
130 EFI_STATUS - No LPC bridge is added.
135 EFI_DEVICE_PATH_PROTOCOL
*DevicePath
;
136 EFI_DEVICE_PATH_PROTOCOL
*TempDevicePath
;
140 Status
= gBS
->HandleProtocol (
142 &gEfiDevicePathProtocolGuid
,
145 if (EFI_ERROR (Status
)) {
148 TempDevicePath
= DevicePath
;
153 DevicePath
= AppendDevicePathNode (DevicePath
, (EFI_DEVICE_PATH_PROTOCOL
*)&gPnpPs2KeyboardDeviceNode
);
155 BdsLibUpdateConsoleVariable (VarConsoleInp
, DevicePath
, NULL
);
160 DevicePath
= TempDevicePath
;
161 gPnp16550ComPortDeviceNode
.UID
= 0;
163 DevicePath
= AppendDevicePathNode (DevicePath
, (EFI_DEVICE_PATH_PROTOCOL
*)&gPnp16550ComPortDeviceNode
);
164 DevicePath
= AppendDevicePathNode (DevicePath
, (EFI_DEVICE_PATH_PROTOCOL
*)&gUartDeviceNode
);
165 DevicePath
= AppendDevicePathNode (DevicePath
, (EFI_DEVICE_PATH_PROTOCOL
*)&gTerminalTypeDeviceNode
);
170 DevPathStr
= DevicePathToStr(DevicePath
);
173 "BdsPlatform.c+%d: COM%d DevPath: %s\n",
175 gPnp16550ComPortDeviceNode
.UID
+ 1,
178 FreePool(DevPathStr
);
180 BdsLibUpdateConsoleVariable (VarConsoleOut
, DevicePath
, NULL
);
181 BdsLibUpdateConsoleVariable (VarConsoleInp
, DevicePath
, NULL
);
182 BdsLibUpdateConsoleVariable (VarErrorOut
, DevicePath
, NULL
);
187 DevicePath
= TempDevicePath
;
188 gPnp16550ComPortDeviceNode
.UID
= 1;
190 DevicePath
= AppendDevicePathNode (DevicePath
, (EFI_DEVICE_PATH_PROTOCOL
*)&gPnp16550ComPortDeviceNode
);
191 DevicePath
= AppendDevicePathNode (DevicePath
, (EFI_DEVICE_PATH_PROTOCOL
*)&gUartDeviceNode
);
192 DevicePath
= AppendDevicePathNode (DevicePath
, (EFI_DEVICE_PATH_PROTOCOL
*)&gTerminalTypeDeviceNode
);
197 DevPathStr
= DevicePathToStr(DevicePath
);
200 "BdsPlatform.c+%d: COM%d DevPath: %s\n",
202 gPnp16550ComPortDeviceNode
.UID
+ 1,
205 FreePool(DevPathStr
);
207 BdsLibUpdateConsoleVariable (VarConsoleOut
, DevicePath
, NULL
);
208 BdsLibUpdateConsoleVariable (VarConsoleInp
, DevicePath
, NULL
);
209 BdsLibUpdateConsoleVariable (VarErrorOut
, DevicePath
, NULL
);
216 IN EFI_DEVICE_PATH_PROTOCOL
*PciDevicePath
,
217 OUT EFI_DEVICE_PATH_PROTOCOL
**GopDevicePath
222 EFI_HANDLE PciDeviceHandle
;
223 EFI_DEVICE_PATH_PROTOCOL
*TempDevicePath
;
224 EFI_DEVICE_PATH_PROTOCOL
*TempPciDevicePath
;
225 UINTN GopHandleCount
;
226 EFI_HANDLE
*GopHandleBuffer
;
228 if (PciDevicePath
== NULL
|| GopDevicePath
== NULL
) {
229 return EFI_INVALID_PARAMETER
;
233 // Initialize the GopDevicePath to be PciDevicePath
235 *GopDevicePath
= PciDevicePath
;
236 TempPciDevicePath
= PciDevicePath
;
238 Status
= gBS
->LocateDevicePath (
239 &gEfiDevicePathProtocolGuid
,
243 if (EFI_ERROR (Status
)) {
248 // Try to connect this handle, so that GOP dirver could start on this
249 // device and create child handles with GraphicsOutput Protocol installed
250 // on them, then we get device paths of these child handles and select
251 // them as possible console device.
253 gBS
->ConnectController (PciDeviceHandle
, NULL
, NULL
, FALSE
);
255 Status
= gBS
->LocateHandleBuffer (
257 &gEfiGraphicsOutputProtocolGuid
,
262 if (!EFI_ERROR (Status
)) {
264 // Add all the child handles as possible Console Device
266 for (Index
= 0; Index
< GopHandleCount
; Index
++) {
267 Status
= gBS
->HandleProtocol (GopHandleBuffer
[Index
], &gEfiDevicePathProtocolGuid
, (VOID
*)&TempDevicePath
);
268 if (EFI_ERROR (Status
)) {
274 GetDevicePathSize (PciDevicePath
) - END_DEVICE_PATH_LENGTH
277 // In current implementation, we only enable one of the child handles
278 // as console device, i.e. sotre one of the child handle's device
279 // path to variable "ConOut"
280 // In futhure, we could select all child handles to be console device
283 *GopDevicePath
= TempDevicePath
;
286 // Delete the PCI device's path that added by GetPlugInPciVgaDevicePath()
287 // Add the integrity GOP device path.
289 BdsLibUpdateConsoleVariable (VarConsoleOutDev
, NULL
, PciDevicePath
);
290 BdsLibUpdateConsoleVariable (VarConsoleOutDev
, TempDevicePath
, NULL
);
293 gBS
->FreePool (GopHandleBuffer
);
300 PreparePciVgaDevicePath (
301 IN EFI_HANDLE DeviceHandle
307 Add PCI VGA to ConOut.
312 DeviceHandle - Handle of PCIIO protocol.
316 EFI_SUCCESS - PCI VGA is added to ConOut.
317 EFI_STATUS - No PCI VGA device is added.
322 EFI_DEVICE_PATH_PROTOCOL
*DevicePath
;
323 EFI_DEVICE_PATH_PROTOCOL
*GopDevicePath
;
326 Status
= gBS
->HandleProtocol (
328 &gEfiDevicePathProtocolGuid
,
331 if (EFI_ERROR (Status
)) {
335 GetGopDevicePath (DevicePath
, &GopDevicePath
);
336 DevicePath
= GopDevicePath
;
338 BdsLibUpdateConsoleVariable (VarConsoleOut
, DevicePath
, NULL
);
344 PreparePciSerialDevicePath (
345 IN EFI_HANDLE DeviceHandle
351 Add PCI Serial to ConOut, ConIn, ErrOut.
356 DeviceHandle - Handle of PCIIO protocol.
360 EFI_SUCCESS - PCI Serial is added to ConOut, ConIn, and ErrOut.
361 EFI_STATUS - No PCI Serial device is added.
366 EFI_DEVICE_PATH_PROTOCOL
*DevicePath
;
369 Status
= gBS
->HandleProtocol (
371 &gEfiDevicePathProtocolGuid
,
374 if (EFI_ERROR (Status
)) {
378 DevicePath
= AppendDevicePathNode (DevicePath
, (EFI_DEVICE_PATH_PROTOCOL
*)&gUartDeviceNode
);
379 DevicePath
= AppendDevicePathNode (DevicePath
, (EFI_DEVICE_PATH_PROTOCOL
*)&gTerminalTypeDeviceNode
);
381 BdsLibUpdateConsoleVariable (VarConsoleOut
, DevicePath
, NULL
);
382 BdsLibUpdateConsoleVariable (VarConsoleInp
, DevicePath
, NULL
);
383 BdsLibUpdateConsoleVariable (VarErrorOut
, DevicePath
, NULL
);
389 DetectAndPreparePlatformPciDevicePath (
390 BOOLEAN DetectVgaOnly
396 Do platform specific PCI Device check and add them to ConOut, ConIn, ErrOut
400 DetectVgaOnly - Only detect VGA device if it's TRUE.
404 EFI_SUCCESS - PCI Device check and Console variable update successfully.
405 EFI_STATUS - PCI Device check or Console variable update fail.
411 EFI_HANDLE
*HandleBuffer
;
413 EFI_PCI_IO_PROTOCOL
*PciIo
;
417 // Start to check all the PciIo to find all possible device
421 Status
= gBS
->LocateHandleBuffer (
423 &gEfiPciIoProtocolGuid
,
428 if (EFI_ERROR (Status
)) {
432 for (Index
= 0; Index
< HandleCount
; Index
++) {
433 Status
= gBS
->HandleProtocol (HandleBuffer
[Index
], &gEfiPciIoProtocolGuid
, (VOID
*)&PciIo
);
434 if (EFI_ERROR (Status
)) {
439 // Check for all PCI device
441 Status
= PciIo
->Pci
.Read (
445 sizeof (Pci
) / sizeof (UINT32
),
448 if (EFI_ERROR (Status
)) {
452 if (!DetectVgaOnly
) {
454 // Here we decide whether it is LPC Bridge
456 if ((IS_PCI_LPC (&Pci
)) ||
457 ((IS_PCI_ISA_PDECODE (&Pci
)) &&
458 (Pci
.Hdr
.VendorId
== 0x8086) &&
459 (Pci
.Hdr
.DeviceId
== 0x7000)
462 Status
= PciIo
->Attributes (
464 EfiPciIoAttributeOperationEnable
,
465 EFI_PCI_DEVICE_ENABLE
,
469 // Add IsaKeyboard to ConIn,
470 // add IsaSerial to ConOut, ConIn, ErrOut
472 DEBUG ((EFI_D_INFO
, "Find the LPC Bridge device\n"));
473 PrepareLpcBridgeDevicePath (HandleBuffer
[Index
]);
477 // Here we decide which Serial device to enable in PCI bus
479 if (IS_PCI_16550SERIAL (&Pci
)) {
481 // Add them to ConOut, ConIn, ErrOut.
483 DEBUG ((EFI_D_INFO
, "Find the 16550 SERIAL device\n"));
484 PreparePciSerialDevicePath (HandleBuffer
[Index
]);
489 if ((Pci
.Hdr
.VendorId
== 0x8086) &&
490 (Pci
.Hdr
.DeviceId
== 0x7010)
492 Status
= PciIo
->Attributes (
494 EfiPciIoAttributeOperationEnable
,
495 EFI_PCI_DEVICE_ENABLE
,
501 // Here we decide which VGA device to enable in PCI bus
503 if (IS_PCI_VGA (&Pci
)) {
505 // Add them to ConOut.
507 DEBUG ((EFI_D_INFO
, "Find the VGA device\n"));
508 PreparePciVgaDevicePath (HandleBuffer
[Index
]);
513 gBS
->FreePool (HandleBuffer
);
520 PlatformBdsConnectConsole (
521 IN BDS_CONSOLE_CONNECT_ENTRY
*PlatformConsole
527 Connect the predefined platform default console device. Always try to find
528 and enable the vga device if have.
532 PlatformConsole - Predfined platform default console device array.
536 EFI_SUCCESS - Success connect at least one ConIn and ConOut
537 device, there must have one ConOut device is
540 EFI_STATUS - Return the status of
541 BdsLibConnectAllDefaultConsoles ()
547 EFI_DEVICE_PATH_PROTOCOL
*VarConout
;
548 EFI_DEVICE_PATH_PROTOCOL
*VarConin
;
549 UINTN DevicePathSize
;
552 // Connect RootBridge
554 ConnectRootBridge ();
556 VarConout
= BdsLibGetVariableAndSize (
558 &gEfiGlobalVariableGuid
,
561 VarConin
= BdsLibGetVariableAndSize (
563 &gEfiGlobalVariableGuid
,
567 if (VarConout
== NULL
|| VarConin
== NULL
) {
569 // Do platform specific PCI Device check and add them to ConOut, ConIn, ErrOut
571 DetectAndPreparePlatformPciDevicePath (FALSE
);
574 // Have chance to connect the platform default console,
575 // the platform default console is the minimue device group
576 // the platform should support
578 for (Index
= 0; PlatformConsole
[Index
].DevicePath
!= NULL
; ++Index
) {
580 // Update the console variable with the connect type
582 if ((PlatformConsole
[Index
].ConnectType
& CONSOLE_IN
) == CONSOLE_IN
) {
583 BdsLibUpdateConsoleVariable (VarConsoleInp
, PlatformConsole
[Index
].DevicePath
, NULL
);
585 if ((PlatformConsole
[Index
].ConnectType
& CONSOLE_OUT
) == CONSOLE_OUT
) {
586 BdsLibUpdateConsoleVariable (VarConsoleOut
, PlatformConsole
[Index
].DevicePath
, NULL
);
588 if ((PlatformConsole
[Index
].ConnectType
& STD_ERROR
) == STD_ERROR
) {
589 BdsLibUpdateConsoleVariable (VarErrorOut
, PlatformConsole
[Index
].DevicePath
, NULL
);
594 // Only detect VGA device and add them to ConOut
596 DetectAndPreparePlatformPciDevicePath (TRUE
);
600 // Connect the all the default console with current cosole variable
602 Status
= BdsLibConnectAllDefaultConsoles ();
603 if (EFI_ERROR (Status
)) {
616 // Bus 0, Device 0, Function 0 - Host to PCI Bridge
618 PciWrite8 (PCI_LIB_ADDRESS (0, 0, 0, 0x3c), 0x00);
621 // Bus 0, Device 1, Function 0 - PCI to ISA Bridge
623 PciWrite8 (PCI_LIB_ADDRESS (0, 1, 0, 0x3c), 0x00);
624 PciWrite8 (PCI_LIB_ADDRESS (0, 1, 0, 0x60), 0x0b);
625 PciWrite8 (PCI_LIB_ADDRESS (0, 1, 0, 0x61), 0x09);
626 PciWrite8 (PCI_LIB_ADDRESS (0, 1, 0, 0x62), 0x0b);
627 PciWrite8 (PCI_LIB_ADDRESS (0, 1, 0, 0x63), 0x09);
630 // Bus 0, Device 1, Function 1 - IDE Controller
632 PciWrite8 (PCI_LIB_ADDRESS (0, 1, 1, 0x3c), 0x00);
633 PciWrite8 (PCI_LIB_ADDRESS (0, 1, 1, 0x0d), 0x40);
636 // Bus 0, Device 1, Function 3 - Power Managment Controller
638 PciWrite8 (PCI_LIB_ADDRESS (0, 1, 3, 0x3c), 0x0b);
639 PciWrite8 (PCI_LIB_ADDRESS (0, 1, 3, 0x3d), 0x01);
642 // Bus 0, Device 2, Function 0 - Video Controller
644 PciWrite8 (PCI_LIB_ADDRESS (0, 2, 0, 0x3c), 0x00);
647 // Bus 0, Device 3, Function 0 - Network Controller
649 PciWrite8 (PCI_LIB_ADDRESS (0, 3, 0, 0x3c), 0x0b);
650 PciWrite8 (PCI_LIB_ADDRESS (0, 3, 0, 0x3d), 0x01);
653 // Bus 0, Device 4, Function 0 - RAM Memory
655 PciWrite8 (PCI_LIB_ADDRESS (0, 4, 0, 0x3c), 0x09);
656 PciWrite8 (PCI_LIB_ADDRESS (0, 4, 0, 0x3d), 0x01);
661 PlatformBdsConnectSequence (
668 Connect with predeined platform connect sequence,
669 the OEM/IBV can customize with their own connect sequence.
683 DEBUG ((EFI_D_INFO
, "PlatformBdsConnectSequence\n"));
688 // Here we can get the customized platform connect sequence
689 // Notes: we can connect with new variable which record the
690 // last time boots connect device path sequence
692 while (gPlatformConnectSequence
[Index
] != NULL
) {
694 // Build the platform boot option
696 BdsLibConnectDevicePath (gPlatformConnectSequence
[Index
]);
701 // Just use the simple policy to connect all devices
705 PciInitialization ();
708 // Clear the logo after all devices are connected.
710 gST
->ConOut
->ClearScreen (gST
->ConOut
);
714 PlatformBdsGetDriverOption (
715 IN OUT LIST_ENTRY
*BdsDriverLists
721 Load the predefined driver option, OEM/IBV can customize this
722 to load their own drivers
726 BdsDriverLists - The header of the driver option link list.
734 DEBUG ((EFI_D_INFO
, "PlatformBdsGetDriverOption\n"));
739 PlatformBdsDiagnostics (
740 IN EXTENDMEM_COVERAGE_LEVEL MemoryTestLevel
,
741 IN BOOLEAN QuietBoot
,
742 IN BASEM_MEMORY_TEST BaseMemoryTest
748 Perform the platform diagnostic, such like test memory. OEM/IBV also
749 can customize this fuction to support specific platform diagnostic.
753 MemoryTestLevel - The memory test intensive level
755 QuietBoot - Indicate if need to enable the quiet boot
757 BaseMemoryTest - A pointer to BaseMemoryTest()
767 DEBUG ((EFI_D_INFO
, "PlatformBdsDiagnostics\n"));
770 // Here we can decide if we need to show
771 // the diagnostics screen
772 // Notes: this quiet boot code should be remove
773 // from the graphic lib
776 EnableQuietBoot (PcdGetPtr(PcdLogoFile
));
778 // Perform system diagnostic
780 Status
= BaseMemoryTest (MemoryTestLevel
);
781 if (EFI_ERROR (Status
)) {
788 // Perform system diagnostic
790 Status
= BaseMemoryTest (MemoryTestLevel
);
796 PlatformBdsPolicyBehavior (
797 IN OUT LIST_ENTRY
*DriverOptionList
,
798 IN OUT LIST_ENTRY
*BootOptionList
,
799 IN PROCESS_CAPSULES ProcessCapsules
,
800 IN BASEM_MEMORY_TEST BaseMemoryTest
806 The function will excute with as the platform policy, current policy
807 is driven by boot mode. IBV/OEM can customize this code for their specific
812 DriverOptionList - The header of the driver option link list
814 BootOptionList - The header of the boot option link list
816 ProcessCapsules - A pointer to ProcessCapsules()
818 BaseMemoryTest - A pointer to BaseMemoryTest()
828 EFI_EVENT UserInputDurationTime
;
830 BDS_COMMON_OPTION
*BootOption
;
834 EFI_BOOT_MODE BootMode
;
836 DEBUG ((EFI_D_INFO
, "PlatformBdsPolicyBehavior\n"));
839 // Init the time out value
841 Timeout
= PcdGet16 (PcdPlatformBootTimeOut
);
844 // Load the driver option as the driver option list
846 PlatformBdsGetDriverOption (DriverOptionList
);
849 // Get current Boot Mode
851 Status
= BdsLibGetBootMode (&BootMode
);
852 DEBUG ((EFI_D_ERROR
, "Boot Mode:%x\n", BootMode
));
855 // Go the different platform policy with different boot mode
856 // Notes: this part code can be change with the table policy
858 ASSERT (BootMode
== BOOT_WITH_FULL_CONFIGURATION
);
860 // Connect platform console
862 Status
= PlatformBdsConnectConsole (gPlatformConsole
);
863 if (EFI_ERROR (Status
)) {
865 // Here OEM/IBV can customize with defined action
867 PlatformBdsNoConsoleAction ();
870 // Create a 300ms duration event to ensure user has enough input time to enter Setup
872 Status
= gBS
->CreateEvent (
877 &UserInputDurationTime
879 ASSERT (Status
== EFI_SUCCESS
);
880 Status
= gBS
->SetTimer (UserInputDurationTime
, TimerRelative
, 3000000);
881 ASSERT (Status
== EFI_SUCCESS
);
883 // Memory test and Logo show
885 PlatformBdsDiagnostics (IGNORE
, TRUE
, BaseMemoryTest
);
888 // Perform some platform specific connect sequence
890 PlatformBdsConnectSequence ();
893 // Give one chance to enter the setup if we
897 //PlatformBdsEnterFrontPage (Timeout, FALSE);
900 DEBUG ((EFI_D_INFO
, "BdsLibConnectAll\n"));
902 BdsLibEnumerateAllBootOption (BootOptionList
);
905 // Please uncomment above ConnectAll and EnumerateAll code and remove following first boot
906 // checking code in real production tip.
908 // In BOOT_WITH_FULL_CONFIGURATION boot mode, should always connect every device
909 // and do enumerate all the default boot options. But in development system board, the boot mode
910 // cannot be BOOT_ASSUMING_NO_CONFIGURATION_CHANGES because the machine box
911 // is always open. So the following code only do the ConnectAll and EnumerateAll at first boot.
913 Status
= BdsLibBuildOptionFromVar (BootOptionList
, L
"BootOrder");
914 if (EFI_ERROR(Status
)) {
916 // If cannot find "BootOrder" variable, it may be first boot.
917 // Try to connect all devices and enumerate all boot options here.
920 BdsLibEnumerateAllBootOption (BootOptionList
);
924 // To give the User a chance to enter Setup here, if user set TimeOut is 0.
925 // BDS should still give user a chance to enter Setup
927 // Connect first boot option, and then check user input before exit
929 for (Link
= BootOptionList
->ForwardLink
; Link
!= BootOptionList
;Link
= Link
->ForwardLink
) {
930 BootOption
= CR (Link
, BDS_COMMON_OPTION
, Link
, BDS_LOAD_OPTION_SIGNATURE
);
931 if (!IS_LOAD_OPTION_TYPE (BootOption
->Attribute
, LOAD_OPTION_ACTIVE
)) {
933 // skip the header of the link list, becuase it has no boot option
938 // Make sure the boot option device path connected, but ignore the BBS device path
940 if (DevicePathType (BootOption
->DevicePath
) != BBS_DEVICE_PATH
) {
941 BdsLibConnectDevicePath (BootOption
->DevicePath
);
948 // Check whether the user input after the duration time has expired
950 OldTpl
= EfiGetCurrentTpl();
951 gBS
->RestoreTPL (TPL_APPLICATION
);
952 gBS
->WaitForEvent (1, &UserInputDurationTime
, &Index
);
953 gBS
->CloseEvent (UserInputDurationTime
);
954 Status
= gST
->ConIn
->ReadKeyStroke (gST
->ConIn
, &Key
);
955 gBS
->RaiseTPL (OldTpl
);
957 if (!EFI_ERROR (Status
)) {
959 // Enter Setup if user input
962 PlatformBdsEnterFrontPage (Timeout
, FALSE
);
970 PlatformBdsBootSuccess (
971 IN BDS_COMMON_OPTION
*Option
977 Hook point after a boot attempt succeeds. We don't expect a boot option to
978 return, so the EFI 1.0 specification defines that you will default to an
979 interactive mode and stop processing the BootOrder list in this case. This
980 is alos a platform implementation and can be customized by IBV/OEM.
984 Option - Pointer to Boot Option that succeeded to boot.
994 DEBUG ((EFI_D_INFO
, "PlatformBdsBootSuccess\n"));
996 // If Boot returned with EFI_SUCCESS and there is not in the boot device
997 // select loop then we need to pop up a UI and wait for user input.
999 TmpStr
= Option
->StatusString
;
1000 if (TmpStr
!= NULL
) {
1001 BdsLibOutputStrings (gST
->ConOut
, TmpStr
, Option
->Description
, L
"\n\r", NULL
);
1008 PlatformBdsBootFail (
1009 IN BDS_COMMON_OPTION
*Option
,
1010 IN EFI_STATUS Status
,
1011 IN CHAR16
*ExitData
,
1012 IN UINTN ExitDataSize
1016 Routine Description:
1018 Hook point after a boot attempt fails.
1022 Option - Pointer to Boot Option that failed to boot.
1024 Status - Status returned from failed boot.
1026 ExitData - Exit data returned from failed boot.
1028 ExitDataSize - Exit data size returned from failed boot.
1038 DEBUG ((EFI_D_INFO
, "PlatformBdsBootFail\n"));
1041 // If Boot returned with failed status then we need to pop up a UI and wait
1044 TmpStr
= Option
->StatusString
;
1045 if (TmpStr
!= NULL
) {
1046 BdsLibOutputStrings (gST
->ConOut
, TmpStr
, Option
->Description
, L
"\n\r", NULL
);
1052 PlatformBdsNoConsoleAction (
1057 Routine Description:
1059 This function is remained for IBV/OEM to do some platform action,
1060 if there no console device can be connected.
1068 EFI_SUCCESS - Direct return success now.
1072 DEBUG ((EFI_D_INFO
, "PlatformBdsNoConsoleAction\n"));
1078 PlatformBdsLockNonUpdatableFlash (
1082 DEBUG ((EFI_D_INFO
, "PlatformBdsLockNonUpdatableFlash\n"));
1088 This notification function is invoked when an instance of the
1089 EFI_DEVICE_PATH_PROTOCOL is produced.
1091 @param Event The event that occured
1092 @param Context For EFI compatiblity. Not used.
1105 EFI_DEVICE_PATH_PROTOCOL
*DevPathNode
;
1106 ATAPI_DEVICE_PATH
*Atapi
;
1109 // Examine all new handles
1113 // Get the next handle
1115 BufferSize
= sizeof (Handle
);
1116 Status
= gBS
->LocateHandle (
1119 mEfiDevPathNotifyReg
,
1125 // If not found, we're done
1127 if (EFI_NOT_FOUND
== Status
) {
1131 if (EFI_ERROR (Status
)) {
1136 // Get the DevicePath protocol on that handle
1138 Status
= gBS
->HandleProtocol (Handle
, &gEfiDevicePathProtocolGuid
, (VOID
**)&DevPathNode
);
1139 ASSERT_EFI_ERROR (Status
);
1141 while (!IsDevicePathEnd (DevPathNode
)) {
1143 // Find the handler to dump this device path node
1146 (DevicePathType(DevPathNode
) == MESSAGING_DEVICE_PATH
) &&
1147 (DevicePathSubType(DevPathNode
) == MSG_ATAPI_DP
)
1149 Atapi
= (ATAPI_DEVICE_PATH
*) DevPathNode
;
1155 (Atapi
->PrimarySecondary
== 1) ? 0x42: 0x40
1162 // Next device path node
1164 DevPathNode
= NextDevicePathNode (DevPathNode
);
1173 InstallDevicePathCallback (
1177 DEBUG ((EFI_D_INFO
, "Registered NotifyDevPath Event\n"));
1178 mEfiDevPathEvent
= EfiCreateProtocolNotifyEvent (
1179 &gEfiDevicePathProtocolGuid
,
1183 &mEfiDevPathNotifyReg
1188 Lock the ConsoleIn device in system table. All key
1189 presses will be ignored until the Password is typed in. The only way to
1190 disable the password is to type it in to a ConIn device.
1192 @param Password Password used to lock ConIn device.
1194 @retval EFI_SUCCESS lock the Console In Spliter virtual handle successfully.
1195 @retval EFI_UNSUPPORTED Password not found
1204 return EFI_UNSUPPORTED
;