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
,
747 Perform the platform diagnostic, such like test memory. OEM/IBV also
748 can customize this fuction to support specific platform diagnostic.
752 MemoryTestLevel - The memory test intensive level
754 QuietBoot - Indicate if need to enable the quiet boot
764 DEBUG ((EFI_D_INFO
, "PlatformBdsDiagnostics\n"));
767 // Here we can decide if we need to show
768 // the diagnostics screen
769 // Notes: this quiet boot code should be remove
770 // from the graphic lib
773 EnableQuietBoot (PcdGetPtr(PcdLogoFile
));
775 // Perform system diagnostic
777 Status
= BdsMemoryTest (MemoryTestLevel
);
778 if (EFI_ERROR (Status
)) {
785 // Perform system diagnostic
787 Status
= BdsMemoryTest (MemoryTestLevel
);
793 PlatformBdsPolicyBehavior (
794 IN OUT LIST_ENTRY
*DriverOptionList
,
795 IN OUT LIST_ENTRY
*BootOptionList
801 The function will excute with as the platform policy, current policy
802 is driven by boot mode. IBV/OEM can customize this code for their specific
807 DriverOptionList - The header of the driver option link list
809 BootOptionList - The header of the boot option link list
819 EFI_EVENT UserInputDurationTime
;
821 BDS_COMMON_OPTION
*BootOption
;
825 EFI_BOOT_MODE BootMode
;
827 DEBUG ((EFI_D_INFO
, "PlatformBdsPolicyBehavior\n"));
830 // Init the time out value
832 Timeout
= PcdGet16 (PcdPlatformBootTimeOut
);
835 // Load the driver option as the driver option list
837 PlatformBdsGetDriverOption (DriverOptionList
);
840 // Get current Boot Mode
842 Status
= BdsLibGetBootMode (&BootMode
);
843 DEBUG ((EFI_D_ERROR
, "Boot Mode:%x\n", BootMode
));
846 // Go the different platform policy with different boot mode
847 // Notes: this part code can be change with the table policy
849 ASSERT (BootMode
== BOOT_WITH_FULL_CONFIGURATION
);
851 // Connect platform console
853 Status
= PlatformBdsConnectConsole (gPlatformConsole
);
854 if (EFI_ERROR (Status
)) {
856 // Here OEM/IBV can customize with defined action
858 PlatformBdsNoConsoleAction ();
861 // Create a 300ms duration event to ensure user has enough input time to enter Setup
863 Status
= gBS
->CreateEvent (
868 &UserInputDurationTime
870 ASSERT (Status
== EFI_SUCCESS
);
871 Status
= gBS
->SetTimer (UserInputDurationTime
, TimerRelative
, 3000000);
872 ASSERT (Status
== EFI_SUCCESS
);
874 // Memory test and Logo show
876 PlatformBdsDiagnostics (IGNORE
, TRUE
);
879 // Perform some platform specific connect sequence
881 PlatformBdsConnectSequence ();
884 // Give one chance to enter the setup if we
888 //PlatformBdsEnterFrontPage (Timeout, FALSE);
891 DEBUG ((EFI_D_INFO
, "BdsLibConnectAll\n"));
893 BdsLibEnumerateAllBootOption (BootOptionList
);
896 // Please uncomment above ConnectAll and EnumerateAll code and remove following first boot
897 // checking code in real production tip.
899 // In BOOT_WITH_FULL_CONFIGURATION boot mode, should always connect every device
900 // and do enumerate all the default boot options. But in development system board, the boot mode
901 // cannot be BOOT_ASSUMING_NO_CONFIGURATION_CHANGES because the machine box
902 // is always open. So the following code only do the ConnectAll and EnumerateAll at first boot.
904 Status
= BdsLibBuildOptionFromVar (BootOptionList
, L
"BootOrder");
905 if (EFI_ERROR(Status
)) {
907 // If cannot find "BootOrder" variable, it may be first boot.
908 // Try to connect all devices and enumerate all boot options here.
911 BdsLibEnumerateAllBootOption (BootOptionList
);
915 // To give the User a chance to enter Setup here, if user set TimeOut is 0.
916 // BDS should still give user a chance to enter Setup
918 // Connect first boot option, and then check user input before exit
920 for (Link
= BootOptionList
->ForwardLink
; Link
!= BootOptionList
;Link
= Link
->ForwardLink
) {
921 BootOption
= CR (Link
, BDS_COMMON_OPTION
, Link
, BDS_LOAD_OPTION_SIGNATURE
);
922 if (!IS_LOAD_OPTION_TYPE (BootOption
->Attribute
, LOAD_OPTION_ACTIVE
)) {
924 // skip the header of the link list, becuase it has no boot option
929 // Make sure the boot option device path connected, but ignore the BBS device path
931 if (DevicePathType (BootOption
->DevicePath
) != BBS_DEVICE_PATH
) {
932 BdsLibConnectDevicePath (BootOption
->DevicePath
);
939 // Check whether the user input after the duration time has expired
941 OldTpl
= EfiGetCurrentTpl();
942 gBS
->RestoreTPL (TPL_APPLICATION
);
943 gBS
->WaitForEvent (1, &UserInputDurationTime
, &Index
);
944 gBS
->CloseEvent (UserInputDurationTime
);
945 Status
= gST
->ConIn
->ReadKeyStroke (gST
->ConIn
, &Key
);
946 gBS
->RaiseTPL (OldTpl
);
948 if (!EFI_ERROR (Status
)) {
950 // Enter Setup if user input
953 PlatformBdsEnterFrontPage (Timeout
, FALSE
);
961 PlatformBdsBootSuccess (
962 IN BDS_COMMON_OPTION
*Option
968 Hook point after a boot attempt succeeds. We don't expect a boot option to
969 return, so the EFI 1.0 specification defines that you will default to an
970 interactive mode and stop processing the BootOrder list in this case. This
971 is alos a platform implementation and can be customized by IBV/OEM.
975 Option - Pointer to Boot Option that succeeded to boot.
985 DEBUG ((EFI_D_INFO
, "PlatformBdsBootSuccess\n"));
987 // If Boot returned with EFI_SUCCESS and there is not in the boot device
988 // select loop then we need to pop up a UI and wait for user input.
990 TmpStr
= Option
->StatusString
;
991 if (TmpStr
!= NULL
) {
992 BdsLibOutputStrings (gST
->ConOut
, TmpStr
, Option
->Description
, L
"\n\r", NULL
);
999 PlatformBdsBootFail (
1000 IN BDS_COMMON_OPTION
*Option
,
1001 IN EFI_STATUS Status
,
1002 IN CHAR16
*ExitData
,
1003 IN UINTN ExitDataSize
1007 Routine Description:
1009 Hook point after a boot attempt fails.
1013 Option - Pointer to Boot Option that failed to boot.
1015 Status - Status returned from failed boot.
1017 ExitData - Exit data returned from failed boot.
1019 ExitDataSize - Exit data size returned from failed boot.
1029 DEBUG ((EFI_D_INFO
, "PlatformBdsBootFail\n"));
1032 // If Boot returned with failed status then we need to pop up a UI and wait
1035 TmpStr
= Option
->StatusString
;
1036 if (TmpStr
!= NULL
) {
1037 BdsLibOutputStrings (gST
->ConOut
, TmpStr
, Option
->Description
, L
"\n\r", NULL
);
1043 PlatformBdsNoConsoleAction (
1048 Routine Description:
1050 This function is remained for IBV/OEM to do some platform action,
1051 if there no console device can be connected.
1059 EFI_SUCCESS - Direct return success now.
1063 DEBUG ((EFI_D_INFO
, "PlatformBdsNoConsoleAction\n"));
1069 PlatformBdsLockNonUpdatableFlash (
1073 DEBUG ((EFI_D_INFO
, "PlatformBdsLockNonUpdatableFlash\n"));
1079 This notification function is invoked when an instance of the
1080 EFI_DEVICE_PATH_PROTOCOL is produced.
1082 @param Event The event that occured
1083 @param Context For EFI compatiblity. Not used.
1096 EFI_DEVICE_PATH_PROTOCOL
*DevPathNode
;
1097 ATAPI_DEVICE_PATH
*Atapi
;
1100 // Examine all new handles
1104 // Get the next handle
1106 BufferSize
= sizeof (Handle
);
1107 Status
= gBS
->LocateHandle (
1110 mEfiDevPathNotifyReg
,
1116 // If not found, we're done
1118 if (EFI_NOT_FOUND
== Status
) {
1122 if (EFI_ERROR (Status
)) {
1127 // Get the DevicePath protocol on that handle
1129 Status
= gBS
->HandleProtocol (Handle
, &gEfiDevicePathProtocolGuid
, (VOID
**)&DevPathNode
);
1130 ASSERT_EFI_ERROR (Status
);
1132 while (!IsDevicePathEnd (DevPathNode
)) {
1134 // Find the handler to dump this device path node
1137 (DevicePathType(DevPathNode
) == MESSAGING_DEVICE_PATH
) &&
1138 (DevicePathSubType(DevPathNode
) == MSG_ATAPI_DP
)
1140 Atapi
= (ATAPI_DEVICE_PATH
*) DevPathNode
;
1146 (Atapi
->PrimarySecondary
== 1) ? 0x42: 0x40
1153 // Next device path node
1155 DevPathNode
= NextDevicePathNode (DevPathNode
);
1164 InstallDevicePathCallback (
1168 DEBUG ((EFI_D_INFO
, "Registered NotifyDevPath Event\n"));
1169 mEfiDevPathEvent
= EfiCreateProtocolNotifyEvent (
1170 &gEfiDevicePathProtocolGuid
,
1174 &mEfiDevPathNotifyReg
1179 Lock the ConsoleIn device in system table. All key
1180 presses will be ignored until the Password is typed in. The only way to
1181 disable the password is to type it in to a ConIn device.
1183 @param Password Password used to lock ConIn device.
1185 @retval EFI_SUCCESS lock the Console In Spliter virtual handle successfully.
1186 @retval EFI_UNSUPPORTED Password not found
1195 return EFI_UNSUPPORTED
;