3 Copyright (c) 2006 - 2008, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 This file include all platform action which can be customized
23 #include "BdsPlatform.h"
25 #define IS_PCI_ISA_PDECODE(_p) IS_CLASS3 (_p, PCI_CLASS_BRIDGE, PCI_CLASS_BRIDGE_ISA_PDECODE, 0)
27 extern BOOLEAN gConnectAllHappened
;
28 extern USB_CLASS_FORMAT_DEVICE_PATH gUsbClassKeyboardDevicePath
;
30 EFI_GUID
*gTableGuidArray
[] = {
31 &gEfiAcpi20TableGuid
, &gEfiAcpiTableGuid
, &gEfiSmbiosTableGuid
, &gEfiMpsTableGuid
35 // BDS Platform Functions
39 GetSystemTablesFromHob (
45 Find GUID'ed HOBs that contain EFI_PHYSICAL_ADDRESS of ACPI, SMBIOS, MPs tables
55 EFI_PEI_HOB_POINTERS GuidHob
;
56 EFI_PEI_HOB_POINTERS HobStart
;
57 EFI_PHYSICAL_ADDRESS
*Table
;
63 HobStart
.Raw
= GetHobList ();
65 // Iteratively add ACPI Table, SMBIOS Table, MPS Table to EFI System Table
67 for (Index
= 0; Index
< sizeof (gTableGuidArray
) / sizeof (*gTableGuidArray
); ++Index
) {
68 GuidHob
.Raw
= GetNextGuidHob (gTableGuidArray
[Index
], HobStart
.Raw
);
69 if (GuidHob
.Raw
!= NULL
) {
70 Table
= GET_GUID_HOB_DATA (GuidHob
.Guid
);
73 // Check if Mps Table/Smbios Table/Acpi Table exists in E/F seg,
74 // According to UEFI Spec, we should make sure Smbios table,
75 // ACPI table and Mps tables kept in memory of specified type
77 ConvertSystemTable(gTableGuidArray
[Index
], (VOID
**)&Table
);
78 gBS
->InstallConfigurationTable (gTableGuidArray
[Index
], (VOID
*)Table
);
86 #define EFI_LDR_MEMORY_DESCRIPTOR_GUID \
87 { 0x7701d7e5, 0x7d1d, 0x4432, {0xa4, 0x68, 0x67, 0x3d, 0xab, 0x8a, 0xde, 0x60 }}
89 EFI_GUID gEfiLdrMemoryDescriptorGuid
= EFI_LDR_MEMORY_DESCRIPTOR_GUID
;
94 EFI_HOB_GUID_TYPE Hob
;
96 EFI_MEMORY_DESCRIPTOR
*MemDesc
;
107 EFI_MEMORY_DESCRIPTOR
*MemMap
;
108 EFI_MEMORY_DESCRIPTOR
*MemMapPtr
;
110 UINTN MapKey
, DescriptorSize
;
112 UINT32 DescriptorVersion
;
118 Status
= gBS
->GetMemoryMap (&MemMapSize
, MemMap
, &MapKey
, &DescriptorSize
, &DescriptorVersion
);
119 ASSERT (Status
== EFI_BUFFER_TOO_SMALL
);
120 MemMapSize
+= EFI_PAGE_SIZE
;
121 Status
= gBS
->AllocatePool (EfiBootServicesData
, MemMapSize
, &MemMap
);
122 ASSERT (Status
== EFI_SUCCESS
);
123 Status
= gBS
->GetMemoryMap (&MemMapSize
, MemMap
, &MapKey
, &DescriptorSize
, &DescriptorVersion
);
124 ASSERT (Status
== EFI_SUCCESS
);
127 ASSERT (DescriptorVersion
== EFI_MEMORY_DESCRIPTOR_VERSION
);
129 for (Index
= 0; Index
< MemMapSize
/ DescriptorSize
; Index
++) {
130 Bytes
= LShiftU64 (MemMap
->NumberOfPages
, 12);
131 DEBUG ((EFI_D_ERROR
, "%lX-%lX %lX %lX %X\n",
132 MemMap
->PhysicalStart
,
133 MemMap
->PhysicalStart
+ Bytes
- 1,
134 MemMap
->NumberOfPages
,
136 (UINTN
)MemMap
->Type
));
137 MemMap
= (EFI_MEMORY_DESCRIPTOR
*)((UINTN
)MemMap
+ DescriptorSize
);
140 gBS
->FreePool (MemMapPtr
);
150 EFI_PEI_HOB_POINTERS GuidHob
;
152 MEMORY_DESC_HOB MemoryDescHob
;
154 EFI_PHYSICAL_ADDRESS Memory
;
155 EFI_GCD_MEMORY_SPACE_DESCRIPTOR Descriptor
;
159 GuidHob
.Raw
= GetHobList();
161 GuidHob
.Raw
= GetNextGuidHob (&gEfiLdrMemoryDescriptorGuid
, GuidHob
.Raw
);
162 if (GuidHob
.Raw
== NULL
) {
163 DEBUG ((EFI_D_ERROR
, "Fail to get gEfiLdrMemoryDescriptorGuid from GUID HOB LIST!\n"));
166 Table
= GET_GUID_HOB_DATA (GuidHob
.Guid
);
168 DEBUG ((EFI_D_ERROR
, "Fail to get gEfiLdrMemoryDescriptorGuid from GUID HOB LIST!\n"));
171 MemoryDescHob
.MemDescCount
= *(UINTN
*)Table
;
172 MemoryDescHob
.MemDesc
= *(EFI_MEMORY_DESCRIPTOR
**)((UINTN
)Table
+ sizeof(UINTN
));
175 // Add ACPINVS, ACPIReclaim, and Reserved memory to MemoryMap
177 for (Index
= 0; Index
< MemoryDescHob
.MemDescCount
; Index
++) {
178 if (MemoryDescHob
.MemDesc
[Index
].PhysicalStart
< 0x100000) {
181 if (MemoryDescHob
.MemDesc
[Index
].PhysicalStart
>= 0x100000000ULL
) {
184 if ((MemoryDescHob
.MemDesc
[Index
].Type
== EfiReservedMemoryType
) ||
185 (MemoryDescHob
.MemDesc
[Index
].Type
== EfiRuntimeServicesData
) ||
186 (MemoryDescHob
.MemDesc
[Index
].Type
== EfiRuntimeServicesCode
) ||
187 (MemoryDescHob
.MemDesc
[Index
].Type
== EfiACPIReclaimMemory
) ||
188 (MemoryDescHob
.MemDesc
[Index
].Type
== EfiACPIMemoryNVS
)) {
189 DEBUG ((EFI_D_ERROR
, "PhysicalStart - 0x%016lx, ", MemoryDescHob
.MemDesc
[Index
].PhysicalStart
));
190 DEBUG ((EFI_D_ERROR
, "PageNumber - 0x%016lx, ", MemoryDescHob
.MemDesc
[Index
].NumberOfPages
));
191 DEBUG ((EFI_D_ERROR
, "Attribute - 0x%016lx, ", MemoryDescHob
.MemDesc
[Index
].Attribute
));
192 DEBUG ((EFI_D_ERROR
, "Type - 0x%08x\n", MemoryDescHob
.MemDesc
[Index
].Type
));
193 if ((MemoryDescHob
.MemDesc
[Index
].Type
== EfiRuntimeServicesData
) ||
194 (MemoryDescHob
.MemDesc
[Index
].Type
== EfiRuntimeServicesCode
)) {
196 // For RuntimeSevicesData and RuntimeServicesCode, they are BFV or DxeCore.
197 // The memory type is assigned in EfiLdr
199 Status
= gDS
->GetMemorySpaceDescriptor (MemoryDescHob
.MemDesc
[Index
].PhysicalStart
, &Descriptor
);
200 if (EFI_ERROR (Status
)) {
203 if (Descriptor
.GcdMemoryType
!= EfiGcdMemoryTypeReserved
) {
205 // BFV or tested DXE core
210 // Untested DXE Core region, free and remove
212 Status
= gDS
->FreeMemorySpace (
213 MemoryDescHob
.MemDesc
[Index
].PhysicalStart
,
214 LShiftU64 (MemoryDescHob
.MemDesc
[Index
].NumberOfPages
, EFI_PAGE_SHIFT
)
216 if (EFI_ERROR (Status
)) {
217 DEBUG ((EFI_D_ERROR
, "FreeMemorySpace fail - %r!\n", Status
));
220 Status
= gDS
->RemoveMemorySpace (
221 MemoryDescHob
.MemDesc
[Index
].PhysicalStart
,
222 LShiftU64 (MemoryDescHob
.MemDesc
[Index
].NumberOfPages
, EFI_PAGE_SHIFT
)
224 if (EFI_ERROR (Status
)) {
225 DEBUG ((EFI_D_ERROR
, "RemoveMemorySpace fail - %r!\n", Status
));
230 // Convert Runtime type to BootTime type
232 if (MemoryDescHob
.MemDesc
[Index
].Type
== EfiRuntimeServicesData
) {
233 MemoryDescHob
.MemDesc
[Index
].Type
= EfiBootServicesData
;
235 MemoryDescHob
.MemDesc
[Index
].Type
= EfiBootServicesCode
;
239 // PassThrough, let below code add and alloate.
243 // ACPI or reserved memory
245 Status
= gDS
->AddMemorySpace (
246 EfiGcdMemoryTypeSystemMemory
,
247 MemoryDescHob
.MemDesc
[Index
].PhysicalStart
,
248 LShiftU64 (MemoryDescHob
.MemDesc
[Index
].NumberOfPages
, EFI_PAGE_SHIFT
),
249 MemoryDescHob
.MemDesc
[Index
].Attribute
251 if (EFI_ERROR (Status
)) {
252 DEBUG ((EFI_D_ERROR
, "AddMemorySpace fail - %r!\n", Status
));
253 if ((MemoryDescHob
.MemDesc
[Index
].Type
== EfiACPIReclaimMemory
) ||
254 (MemoryDescHob
.MemDesc
[Index
].Type
== EfiACPIMemoryNVS
)) {
256 // For EfiACPIReclaimMemory and EfiACPIMemoryNVS, it must success.
257 // For EfiReservedMemoryType, there maybe overlap. So skip check here.
259 // ASSERT_EFI_ERROR (Status);
264 Memory
= MemoryDescHob
.MemDesc
[Index
].PhysicalStart
;
265 Status
= gBS
->AllocatePages (
267 (EFI_MEMORY_TYPE
)MemoryDescHob
.MemDesc
[Index
].Type
,
268 (UINTN
)MemoryDescHob
.MemDesc
[Index
].NumberOfPages
,
271 if (EFI_ERROR (Status
)) {
272 DEBUG ((EFI_D_ERROR
, "AllocatePages fail - %r!\n", Status
));
274 // For the page added, it must be allocated.
276 // ASSERT_EFI_ERROR (Status);
285 DisableUsbLegacySupport(
291 Disabble the USB legacy Support in all Ehci and Uhci.
292 This function assume all PciIo handles have been created in system.
303 EFI_HANDLE
*HandleArray
;
304 UINTN HandleArrayCount
;
306 EFI_PCI_IO_PROTOCOL
*PciIo
;
315 // Find the usb host controller
317 Status
= gBS
->LocateHandleBuffer (
319 &gEfiPciIoProtocolGuid
,
324 if (!EFI_ERROR (Status
)) {
325 for (Index
= 0; Index
< HandleArrayCount
; Index
++) {
326 Status
= gBS
->HandleProtocol (
328 &gEfiPciIoProtocolGuid
,
331 if (!EFI_ERROR (Status
)) {
333 // Find the USB host controller controller
335 Status
= PciIo
->Pci
.Read (PciIo
, EfiPciIoWidthUint8
, 0x09, 3, &Class
);
336 if (!EFI_ERROR (Status
)) {
337 if ((PCI_CLASS_SERIAL
== Class
[2]) &&
338 (PCI_CLASS_SERIAL_USB
== Class
[1])) {
339 if (PCI_CLASSC_PI_UHCI
== Class
[0]) {
341 // Found the UHCI, then disable the legacy support
344 Status
= PciIo
->Pci
.Write (PciIo
, EfiPciIoWidthUint16
, 0xC0, 1, &Command
);
345 } else if (PCI_CLASSC_PI_EHCI
== Class
[0]) {
347 // Found the EHCI, then disable the legacy support
349 Status
= PciIo
->Mem
.Read (
353 (UINT64
) 0x08, //EHC_HCCPARAMS_OFFSET
358 ExtendCap
= (HcCapParams
>> 8) & 0xFF;
360 // Disable the SMI in USBLEGCTLSTS firstly
362 PciIo
->Pci
.Read (PciIo
, EfiPciIoWidthUint32
, ExtendCap
+ 0x4, 1, &Value
);
364 PciIo
->Pci
.Write (PciIo
, EfiPciIoWidthUint32
, ExtendCap
+ 0x4, 1, &Value
);
367 // Get EHCI Ownership from legacy bios
369 PciIo
->Pci
.Read (PciIo
, EfiPciIoWidthUint32
, ExtendCap
, 1, &Value
);
370 Value
|= (0x1 << 24);
371 PciIo
->Pci
.Write (PciIo
, EfiPciIoWidthUint32
, ExtendCap
, 1, &Value
);
377 PciIo
->Pci
.Read (PciIo
, EfiPciIoWidthUint32
, ExtendCap
, 1, &Value
);
379 if ((Value
& 0x01010000) == 0x01000000) {
391 gBS
->FreePool (HandleArray
);
405 Platform Bds init. Incude the platform firmware vendor, revision
416 GetSystemTablesFromHob ();
421 // Append Usb Keyboard short form DevicePath into "ConInDev"
423 BdsLibUpdateConsoleVariable (
425 (EFI_DEVICE_PATH_PROTOCOL
*) &gUsbClassKeyboardDevicePath
,
431 GetPciExpressBaseAddressForRootBridge (
432 IN UINTN HostBridgeNumber
,
433 IN UINTN RootBridgeNumber
438 This routine is to get PciExpress Base Address for this RootBridge
441 HostBridgeNumber - The number of HostBridge
442 RootBridgeNumber - The number of RootBridge
445 UINT64 - PciExpressBaseAddress for this HostBridge and RootBridge
449 EFI_PCI_EXPRESS_BASE_ADDRESS_INFORMATION
*PciExpressBaseAddressInfo
;
453 EFI_PEI_HOB_POINTERS GuidHob
;
456 // Get PciExpressAddressInfo Hob
458 PciExpressBaseAddressInfo
= NULL
;
460 GuidHob
.Raw
= GetFirstGuidHob (&gEfiPciExpressBaseAddressGuid
);
461 if (GuidHob
.Raw
!= NULL
) {
462 PciExpressBaseAddressInfo
= GET_GUID_HOB_DATA (GuidHob
.Guid
);
463 BufferSize
= GET_GUID_HOB_DATA_SIZE (GuidHob
.Guid
);
469 // Search the PciExpress Base Address in the Hob for current RootBridge
471 Number
= (UINT32
)(BufferSize
/ sizeof(EFI_PCI_EXPRESS_BASE_ADDRESS_INFORMATION
));
472 for (Index
= 0; Index
< Number
; Index
++) {
473 if ((PciExpressBaseAddressInfo
[Index
].HostBridgeNumber
== HostBridgeNumber
) &&
474 (PciExpressBaseAddressInfo
[Index
].RootBridgeNumber
== RootBridgeNumber
)) {
475 return PciExpressBaseAddressInfo
[Index
].PciExpressBaseAddress
;
480 // Do not find the PciExpress Base Address in the Hob
486 PatchPciRootBridgeDevicePath (
487 IN UINTN HostBridgeNumber
,
488 IN UINTN RootBridgeNumber
,
489 IN PLATFORM_ROOT_BRIDGE_DEVICE_PATH
*RootBridge
492 UINT64 PciExpressBase
;
494 PciExpressBase
= GetPciExpressBaseAddressForRootBridge (HostBridgeNumber
, RootBridgeNumber
);
496 DEBUG ((EFI_D_INFO
, "Get PciExpress Address from Hob: 0x%X\n", PciExpressBase
));
498 if (PciExpressBase
!= 0) {
499 RootBridge
->PciRootBridge
.HID
= EISA_PNP_ID(0x0A08);
519 EFI_SUCCESS - Connect RootBridge successfully.
520 EFI_STATUS - Connect RootBridge fail.
525 EFI_HANDLE RootHandle
;
528 // Patch Pci Root Bridge Device Path
530 PatchPciRootBridgeDevicePath (0, 0, &gPlatformRootBridge0
);
533 // Make all the PCI_IO protocols on PCI Seg 0 show up
535 BdsLibConnectDevicePath (gPlatformRootBridges
[0]);
537 Status
= gBS
->LocateDevicePath (
538 &gEfiDevicePathProtocolGuid
,
539 &gPlatformRootBridges
[0],
542 DEBUG ((EFI_D_INFO
, "Pci Root bridge handle is 0x%X\n", RootHandle
));
544 if (EFI_ERROR (Status
)) {
548 Status
= gBS
->ConnectController (RootHandle
, NULL
, NULL
, FALSE
);
549 if (EFI_ERROR (Status
)) {
557 PrepareLpcBridgeDevicePath (
558 IN EFI_HANDLE DeviceHandle
564 Add IsaKeyboard to ConIn,
565 add IsaSerial to ConOut, ConIn, ErrOut.
570 DeviceHandle - Handle of PCIIO protocol.
574 EFI_SUCCESS - LPC bridge is added to ConOut, ConIn, and ErrOut.
575 EFI_STATUS - No LPC bridge is added.
580 EFI_DEVICE_PATH_PROTOCOL
*DevicePath
;
581 EFI_DEVICE_PATH_PROTOCOL
*TempDevicePath
;
584 Status
= gBS
->HandleProtocol (
586 &gEfiDevicePathProtocolGuid
,
589 if (EFI_ERROR (Status
)) {
592 TempDevicePath
= DevicePath
;
597 DevicePath
= AppendDevicePathNode (DevicePath
, (EFI_DEVICE_PATH_PROTOCOL
*)&gPnpPs2KeyboardDeviceNode
);
599 BdsLibUpdateConsoleVariable (VarConsoleInp
, DevicePath
, NULL
);
604 DevicePath
= TempDevicePath
;
605 gPnp16550ComPortDeviceNode
.UID
= 0;
607 DevicePath
= AppendDevicePathNode (DevicePath
, (EFI_DEVICE_PATH_PROTOCOL
*)&gPnp16550ComPortDeviceNode
);
608 DevicePath
= AppendDevicePathNode (DevicePath
, (EFI_DEVICE_PATH_PROTOCOL
*)&gUartDeviceNode
);
609 DevicePath
= AppendDevicePathNode (DevicePath
, (EFI_DEVICE_PATH_PROTOCOL
*)&gTerminalTypeDeviceNode
);
611 BdsLibUpdateConsoleVariable (VarConsoleOut
, DevicePath
, NULL
);
612 BdsLibUpdateConsoleVariable (VarConsoleInp
, DevicePath
, NULL
);
613 BdsLibUpdateConsoleVariable (VarErrorOut
, DevicePath
, NULL
);
618 DevicePath
= TempDevicePath
;
619 gPnp16550ComPortDeviceNode
.UID
= 1;
621 DevicePath
= AppendDevicePathNode (DevicePath
, (EFI_DEVICE_PATH_PROTOCOL
*)&gPnp16550ComPortDeviceNode
);
622 DevicePath
= AppendDevicePathNode (DevicePath
, (EFI_DEVICE_PATH_PROTOCOL
*)&gUartDeviceNode
);
623 DevicePath
= AppendDevicePathNode (DevicePath
, (EFI_DEVICE_PATH_PROTOCOL
*)&gTerminalTypeDeviceNode
);
625 BdsLibUpdateConsoleVariable (VarConsoleOut
, DevicePath
, NULL
);
626 BdsLibUpdateConsoleVariable (VarConsoleInp
, DevicePath
, NULL
);
627 BdsLibUpdateConsoleVariable (VarErrorOut
, DevicePath
, NULL
);
634 IN EFI_DEVICE_PATH_PROTOCOL
*PciDevicePath
,
635 OUT EFI_DEVICE_PATH_PROTOCOL
**GopDevicePath
640 EFI_HANDLE PciDeviceHandle
;
641 EFI_DEVICE_PATH_PROTOCOL
*TempDevicePath
;
642 EFI_DEVICE_PATH_PROTOCOL
*TempPciDevicePath
;
643 UINTN GopHandleCount
;
644 EFI_HANDLE
*GopHandleBuffer
;
646 if (PciDevicePath
== NULL
|| GopDevicePath
== NULL
) {
647 return EFI_INVALID_PARAMETER
;
651 // Initialize the GopDevicePath to be PciDevicePath
653 *GopDevicePath
= PciDevicePath
;
654 TempPciDevicePath
= PciDevicePath
;
656 Status
= gBS
->LocateDevicePath (
657 &gEfiDevicePathProtocolGuid
,
661 if (EFI_ERROR (Status
)) {
666 // Try to connect this handle, so that GOP dirver could start on this
667 // device and create child handles with GraphicsOutput Protocol installed
668 // on them, then we get device paths of these child handles and select
669 // them as possible console device.
671 gBS
->ConnectController (PciDeviceHandle
, NULL
, NULL
, FALSE
);
673 Status
= gBS
->LocateHandleBuffer (
675 &gEfiGraphicsOutputProtocolGuid
,
680 if (!EFI_ERROR (Status
)) {
682 // Add all the child handles as possible Console Device
684 for (Index
= 0; Index
< GopHandleCount
; Index
++) {
685 Status
= gBS
->HandleProtocol (GopHandleBuffer
[Index
], &gEfiDevicePathProtocolGuid
, (VOID
*)&TempDevicePath
);
686 if (EFI_ERROR (Status
)) {
692 GetDevicePathSize (PciDevicePath
) - END_DEVICE_PATH_LENGTH
695 // In current implementation, we only enable one of the child handles
696 // as console device, i.e. sotre one of the child handle's device
697 // path to variable "ConOut"
698 // In futhure, we could select all child handles to be console device
701 *GopDevicePath
= TempDevicePath
;
704 // Delete the PCI device's path that added by GetPlugInPciVgaDevicePath()
705 // Add the integrity GOP device path.
707 BdsLibUpdateConsoleVariable (VarConsoleOutDev
, NULL
, PciDevicePath
);
708 BdsLibUpdateConsoleVariable (VarConsoleOutDev
, TempDevicePath
, NULL
);
711 gBS
->FreePool (GopHandleBuffer
);
718 PreparePciVgaDevicePath (
719 IN EFI_HANDLE DeviceHandle
725 Add PCI VGA to ConOut.
730 DeviceHandle - Handle of PCIIO protocol.
734 EFI_SUCCESS - PCI VGA is added to ConOut.
735 EFI_STATUS - No PCI VGA device is added.
740 EFI_DEVICE_PATH_PROTOCOL
*DevicePath
;
741 EFI_DEVICE_PATH_PROTOCOL
*GopDevicePath
;
744 Status
= gBS
->HandleProtocol (
746 &gEfiDevicePathProtocolGuid
,
749 if (EFI_ERROR (Status
)) {
753 GetGopDevicePath (DevicePath
, &GopDevicePath
);
754 DevicePath
= GopDevicePath
;
756 BdsLibUpdateConsoleVariable (VarConsoleOut
, DevicePath
, NULL
);
762 PreparePciSerialDevicePath (
763 IN EFI_HANDLE DeviceHandle
769 Add PCI Serial to ConOut, ConIn, ErrOut.
774 DeviceHandle - Handle of PCIIO protocol.
778 EFI_SUCCESS - PCI Serial is added to ConOut, ConIn, and ErrOut.
779 EFI_STATUS - No PCI Serial device is added.
784 EFI_DEVICE_PATH_PROTOCOL
*DevicePath
;
787 Status
= gBS
->HandleProtocol (
789 &gEfiDevicePathProtocolGuid
,
792 if (EFI_ERROR (Status
)) {
796 DevicePath
= AppendDevicePathNode (DevicePath
, (EFI_DEVICE_PATH_PROTOCOL
*)&gUartDeviceNode
);
797 DevicePath
= AppendDevicePathNode (DevicePath
, (EFI_DEVICE_PATH_PROTOCOL
*)&gTerminalTypeDeviceNode
);
799 BdsLibUpdateConsoleVariable (VarConsoleOut
, DevicePath
, NULL
);
800 BdsLibUpdateConsoleVariable (VarConsoleInp
, DevicePath
, NULL
);
801 BdsLibUpdateConsoleVariable (VarErrorOut
, DevicePath
, NULL
);
807 DetectAndPreparePlatformPciDevicePath (
808 BOOLEAN DetectVgaOnly
814 Do platform specific PCI Device check and add them to ConOut, ConIn, ErrOut
818 DetectVgaOnly - Only detect VGA device if it's TRUE.
822 EFI_SUCCESS - PCI Device check and Console variable update successfully.
823 EFI_STATUS - PCI Device check or Console variable update fail.
829 EFI_HANDLE
*HandleBuffer
;
831 EFI_PCI_IO_PROTOCOL
*PciIo
;
835 // Start to check all the PciIo to find all possible device
839 Status
= gBS
->LocateHandleBuffer (
841 &gEfiPciIoProtocolGuid
,
846 if (EFI_ERROR (Status
)) {
850 for (Index
= 0; Index
< HandleCount
; Index
++) {
851 Status
= gBS
->HandleProtocol (HandleBuffer
[Index
], &gEfiPciIoProtocolGuid
, (VOID
*)&PciIo
);
852 if (EFI_ERROR (Status
)) {
857 // Check for all PCI device
859 Status
= PciIo
->Pci
.Read (
863 sizeof (Pci
) / sizeof (UINT32
),
866 if (EFI_ERROR (Status
)) {
870 if (!DetectVgaOnly
) {
872 // Here we decide whether it is LPC Bridge
874 if ((IS_PCI_LPC (&Pci
)) ||
875 ((IS_PCI_ISA_PDECODE (&Pci
)) && (Pci
.Hdr
.VendorId
== 0x8086) && (Pci
.Hdr
.DeviceId
== 0x7110))) {
877 // Add IsaKeyboard to ConIn,
878 // add IsaSerial to ConOut, ConIn, ErrOut
880 DEBUG ((EFI_D_INFO
, "Find the LPC Bridge device\n"));
881 PrepareLpcBridgeDevicePath (HandleBuffer
[Index
]);
885 // Here we decide which Serial device to enable in PCI bus
887 if (IS_PCI_16550SERIAL (&Pci
)) {
889 // Add them to ConOut, ConIn, ErrOut.
891 DEBUG ((EFI_D_INFO
, "Find the 16550 SERIAL device\n"));
892 PreparePciSerialDevicePath (HandleBuffer
[Index
]);
898 // Here we decide which VGA device to enable in PCI bus
900 if (IS_PCI_VGA (&Pci
)) {
902 // Add them to ConOut.
904 DEBUG ((EFI_D_INFO
, "Find the VGA device\n"));
905 PreparePciVgaDevicePath (HandleBuffer
[Index
]);
910 gBS
->FreePool (HandleBuffer
);
916 PlatformBdsConnectConsole (
917 IN BDS_CONSOLE_CONNECT_ENTRY
*PlatformConsole
923 Connect the predefined platform default console device. Always try to find
924 and enable the vga device if have.
928 PlatformConsole - Predfined platform default console device array.
932 EFI_SUCCESS - Success connect at least one ConIn and ConOut
933 device, there must have one ConOut device is
936 EFI_STATUS - Return the status of
937 BdsLibConnectAllDefaultConsoles ()
943 EFI_DEVICE_PATH_PROTOCOL
*VarConout
;
944 EFI_DEVICE_PATH_PROTOCOL
*VarConin
;
945 UINTN DevicePathSize
;
948 // Connect RootBridge
950 ConnectRootBridge ();
952 VarConout
= BdsLibGetVariableAndSize (
954 &gEfiGlobalVariableGuid
,
957 VarConin
= BdsLibGetVariableAndSize (
959 &gEfiGlobalVariableGuid
,
963 if (VarConout
== NULL
|| VarConin
== NULL
) {
965 // Do platform specific PCI Device check and add them to ConOut, ConIn, ErrOut
967 DetectAndPreparePlatformPciDevicePath (FALSE
);
970 // Have chance to connect the platform default console,
971 // the platform default console is the minimue device group
972 // the platform should support
974 for (Index
= 0; PlatformConsole
[Index
].DevicePath
!= NULL
; ++Index
) {
976 // Update the console variable with the connect type
978 if ((PlatformConsole
[Index
].ConnectType
& CONSOLE_IN
) == CONSOLE_IN
) {
979 BdsLibUpdateConsoleVariable (VarConsoleInp
, PlatformConsole
[Index
].DevicePath
, NULL
);
981 if ((PlatformConsole
[Index
].ConnectType
& CONSOLE_OUT
) == CONSOLE_OUT
) {
982 BdsLibUpdateConsoleVariable (VarConsoleOut
, PlatformConsole
[Index
].DevicePath
, NULL
);
984 if ((PlatformConsole
[Index
].ConnectType
& STD_ERROR
) == STD_ERROR
) {
985 BdsLibUpdateConsoleVariable (VarErrorOut
, PlatformConsole
[Index
].DevicePath
, NULL
);
990 // Only detect VGA device and add them to ConOut
992 DetectAndPreparePlatformPciDevicePath (TRUE
);
996 // The ConIn devices connection will start the USB bus, should disable all
997 // Usb legacy support firstly.
998 // Caution: Must ensure the PCI bus driver has been started. Since the
999 // ConnectRootBridge() will create all the PciIo protocol, it's safe here now
1001 Status
= DisableUsbLegacySupport();
1004 // Connect the all the default console with current cosole variable
1006 Status
= BdsLibConnectAllDefaultConsoles ();
1007 if (EFI_ERROR (Status
)) {
1015 PlatformBdsConnectSequence (
1020 Routine Description:
1022 Connect with predeined platform connect sequence,
1023 the OEM/IBV can customize with their own connect sequence.
1040 // Here we can get the customized platform connect sequence
1041 // Notes: we can connect with new variable which record the
1042 // last time boots connect device path sequence
1044 while (gPlatformConnectSequence
[Index
] != NULL
) {
1046 // Build the platform boot option
1048 BdsLibConnectDevicePath (gPlatformConnectSequence
[Index
]);
1055 PlatformBdsGetDriverOption (
1056 IN OUT LIST_ENTRY
*BdsDriverLists
1060 Routine Description:
1062 Load the predefined driver option, OEM/IBV can customize this
1063 to load their own drivers
1067 BdsDriverLists - The header of the driver option link list.
1080 // Here we can get the customized platform driver option
1082 while (gPlatformDriverOption
[Index
] != NULL
) {
1084 // Build the platform boot option
1086 BdsLibRegisterNewOption (BdsDriverLists
, gPlatformDriverOption
[Index
], NULL
, L
"DriverOrder");
1093 PlatformBdsDiagnostics (
1094 IN EXTENDMEM_COVERAGE_LEVEL MemoryTestLevel
,
1095 IN BOOLEAN QuietBoot
1099 Routine Description:
1101 Perform the platform diagnostic, such like test memory. OEM/IBV also
1102 can customize this fuction to support specific platform diagnostic.
1106 MemoryTestLevel - The memory test intensive level
1108 QuietBoot - Indicate if need to enable the quiet boot
1119 // Here we can decide if we need to show
1120 // the diagnostics screen
1121 // Notes: this quiet boot code should be remove
1122 // from the graphic lib
1125 Status
= EnableQuietBoot (PcdGetPtr(PcdLogoFile
));
1126 if (EFI_ERROR (Status
)) {
1127 DisableQuietBoot ();
1132 // Perform system diagnostic
1134 Status
= BdsMemoryTest (MemoryTestLevel
);
1135 if (EFI_ERROR (Status
)) {
1136 DisableQuietBoot ();
1142 // Perform system diagnostic
1144 Status
= BdsMemoryTest (MemoryTestLevel
);
1149 PlatformBdsPolicyBehavior (
1150 IN OUT LIST_ENTRY
*DriverOptionList
,
1151 IN OUT LIST_ENTRY
*BootOptionList
1155 Routine Description:
1157 The function will excute with as the platform policy, current policy
1158 is driven by boot mode. IBV/OEM can customize this code for their specific
1163 DriverOptionList - The header of the driver option link list
1165 BootOptionList - The header of the boot option link list
1175 EFI_EVENT UserInputDurationTime
;
1177 BDS_COMMON_OPTION
*BootOption
;
1181 EFI_BOOT_MODE BootMode
;
1184 // Init the time out value
1186 Timeout
= PcdGet16 (PcdPlatformBootTimeOut
);
1189 // Load the driver option as the driver option list
1191 PlatformBdsGetDriverOption (DriverOptionList
);
1194 // Get current Boot Mode
1196 Status
= BdsLibGetBootMode (&BootMode
);
1197 DEBUG ((EFI_D_ERROR
, "Boot Mode:%x\n", BootMode
));
1200 // Go the different platform policy with different boot mode
1201 // Notes: this part code can be change with the table policy
1203 ASSERT (BootMode
== BOOT_WITH_FULL_CONFIGURATION
);
1205 // Connect platform console
1207 Status
= PlatformBdsConnectConsole (gPlatformConsole
);
1208 if (EFI_ERROR (Status
)) {
1210 // Here OEM/IBV can customize with defined action
1212 PlatformBdsNoConsoleAction ();
1215 // Create a 300ms duration event to ensure user has enough input time to enter Setup
1217 Status
= gBS
->CreateEvent (
1222 &UserInputDurationTime
1224 ASSERT (Status
== EFI_SUCCESS
);
1225 Status
= gBS
->SetTimer (UserInputDurationTime
, TimerRelative
, 3000000);
1226 ASSERT (Status
== EFI_SUCCESS
);
1228 // Memory test and Logo show
1230 PlatformBdsDiagnostics (IGNORE
, TRUE
);
1233 // Perform some platform specific connect sequence
1235 PlatformBdsConnectSequence ();
1238 // Give one chance to enter the setup if we
1239 // have the time out
1241 // BUGBUG: hard code timeout to 5 second to show logo in graphic mode.
1244 PlatformBdsEnterFrontPage (Timeout
, FALSE
);
1248 //BdsLibConnectAll ();
1249 //BdsLibEnumerateAllBootOption (BootOptionList);
1252 // Please uncomment above ConnectAll and EnumerateAll code and remove following first boot
1253 // checking code in real production tip.
1255 // In BOOT_WITH_FULL_CONFIGURATION boot mode, should always connect every device
1256 // and do enumerate all the default boot options. But in development system board, the boot mode
1257 // cannot be BOOT_ASSUMING_NO_CONFIGURATION_CHANGES because the machine box
1258 // is always open. So the following code only do the ConnectAll and EnumerateAll at first boot.
1260 Status
= BdsLibBuildOptionFromVar (BootOptionList
, L
"BootOrder");
1261 if (EFI_ERROR(Status
)) {
1263 // If cannot find "BootOrder" variable, it may be first boot.
1264 // Try to connect all devices and enumerate all boot options here.
1266 BdsLibConnectAll ();
1267 BdsLibEnumerateAllBootOption (BootOptionList
);
1271 // To give the User a chance to enter Setup here, if user set TimeOut is 0.
1272 // BDS should still give user a chance to enter Setup
1274 // Connect first boot option, and then check user input before exit
1276 for (Link
= BootOptionList
->ForwardLink
; Link
!= BootOptionList
;Link
= Link
->ForwardLink
) {
1277 BootOption
= CR (Link
, BDS_COMMON_OPTION
, Link
, BDS_LOAD_OPTION_SIGNATURE
);
1278 if (!IS_LOAD_OPTION_TYPE (BootOption
->Attribute
, LOAD_OPTION_ACTIVE
)) {
1280 // skip the header of the link list, becuase it has no boot option
1285 // Make sure the boot option device path connected, but ignore the BBS device path
1287 if (DevicePathType (BootOption
->DevicePath
) != BBS_DEVICE_PATH
) {
1288 BdsLibConnectDevicePath (BootOption
->DevicePath
);
1295 // Check whether the user input after the duration time has expired
1297 OldTpl
= EfiGetCurrentTpl();
1298 gBS
->RestoreTPL (TPL_APPLICATION
);
1299 gBS
->WaitForEvent (1, &UserInputDurationTime
, &Index
);
1300 gBS
->CloseEvent (UserInputDurationTime
);
1301 Status
= gST
->ConIn
->ReadKeyStroke (gST
->ConIn
, &Key
);
1302 gBS
->RaiseTPL (OldTpl
);
1304 if (!EFI_ERROR (Status
)) {
1306 // Enter Setup if user input
1309 PlatformBdsEnterFrontPage (Timeout
, FALSE
);
1318 PlatformBdsBootSuccess (
1319 IN BDS_COMMON_OPTION
*Option
1323 Routine Description:
1325 Hook point after a boot attempt succeeds. We don't expect a boot option to
1326 return, so the EFI 1.0 specification defines that you will default to an
1327 interactive mode and stop processing the BootOrder list in this case. This
1328 is alos a platform implementation and can be customized by IBV/OEM.
1332 Option - Pointer to Boot Option that succeeded to boot.
1343 // If Boot returned with EFI_SUCCESS and there is not in the boot device
1344 // select loop then we need to pop up a UI and wait for user input.
1346 TmpStr
= Option
->StatusString
;
1347 if (TmpStr
!= NULL
) {
1348 BdsLibOutputStrings (gST
->ConOut
, TmpStr
, Option
->Description
, L
"\n\r", NULL
);
1349 gBS
->FreePool (TmpStr
);
1355 PlatformBdsBootFail (
1356 IN BDS_COMMON_OPTION
*Option
,
1357 IN EFI_STATUS Status
,
1358 IN CHAR16
*ExitData
,
1359 IN UINTN ExitDataSize
1363 Routine Description:
1365 Hook point after a boot attempt fails.
1369 Option - Pointer to Boot Option that failed to boot.
1371 Status - Status returned from failed boot.
1373 ExitData - Exit data returned from failed boot.
1375 ExitDataSize - Exit data size returned from failed boot.
1386 // If Boot returned with failed status then we need to pop up a UI and wait
1389 TmpStr
= Option
->StatusString
;
1390 if (TmpStr
!= NULL
) {
1391 BdsLibOutputStrings (gST
->ConOut
, TmpStr
, Option
->Description
, L
"\n\r", NULL
);
1392 gBS
->FreePool (TmpStr
);
1398 PlatformBdsNoConsoleAction (
1403 Routine Description:
1405 This function is remained for IBV/OEM to do some platform action,
1406 if there no console device can be connected.
1414 EFI_SUCCESS - Direct return success now.
1422 ConvertSystemTable (
1423 IN EFI_GUID
*TableGuid
,
1428 Routine Description:
1429 Convert ACPI Table /Smbios Table /MP Table if its location is lower than Address:0x100000
1431 As in legacy Bios, ACPI/Smbios/MP table is required to place in E/F Seg,
1432 So here we just check if the range is E/F seg,
1433 and if Not, assume the Memory type is EfiACPIReclaimMemory/EfiACPIMemoryNVS
1436 TableGuid - Guid of the table
1437 Table - pointer to the table
1440 EFI_SUCEESS - Convert Table successfully
1450 // If match acpi guid (1.0, 2.0, or later), Convert ACPI table according to version.
1452 AcpiHeader
= (VOID
*)(UINTN
)(*(UINT64
*)(*Table
));
1454 if (CompareGuid(TableGuid
, &gEfiAcpiTableGuid
) || CompareGuid(TableGuid
, &gEfiAcpi20TableGuid
)){
1455 if (((EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER
*)AcpiHeader
)->Reserved
== 0x00){
1457 // If Acpi 1.0 Table, then RSDP structure doesn't contain Length field, use structure size
1459 AcpiTableLen
= sizeof (EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER
);
1460 } else if (((EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER
*)AcpiHeader
)->Reserved
>= 0x02){
1462 // If Acpi 2.0 or later, use RSDP Length fied.
1464 AcpiTableLen
= ((EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER
*)AcpiHeader
)->Length
;
1467 // Invalid Acpi Version, return
1469 return EFI_UNSUPPORTED
;
1471 Status
= ConvertAcpiTable (AcpiTableLen
, Table
);
1476 // If matches smbios guid, convert Smbios table.
1478 if (CompareGuid(TableGuid
, &gEfiSmbiosTableGuid
)){
1479 Status
= ConvertSmbiosTable (Table
);
1484 // If the table is MP table?
1486 if (CompareGuid(TableGuid
, &gEfiMpsTableGuid
)){
1487 Status
= ConvertMpsTable (Table
);
1491 return EFI_UNSUPPORTED
;
1502 Routine Description:
1503 Convert RSDP of ACPI Table if its location is lower than Address:0x100000
1505 As in legacy Bios, ACPI table is required to place in E/F Seg,
1506 So here we just check if the range is E/F seg,
1507 and if Not, assume the Memory type is EfiACPIReclaimMemory/EfiACPIMemoryNVS
1510 TableLen - Acpi RSDP length
1511 Table - pointer to the table
1514 EFI_SUCEESS - Convert Table successfully
1522 EFI_PHYSICAL_ADDRESS BufferPtr
;
1525 AcpiTableOri
= (VOID
*)(UINTN
)(*(UINT64
*)(*Table
));
1526 if (((UINTN
)AcpiTableOri
< 0x100000) && ((UINTN
)AcpiTableOri
> 0xE0000)) {
1527 BufferPtr
= EFI_SYSTEM_TABLE_MAX_ADDRESS
;
1528 Status
= gBS
->AllocatePages (
1531 EFI_SIZE_TO_PAGES(TableLen
),
1534 ASSERT_EFI_ERROR (Status
);
1535 AcpiTableNew
= (VOID
*)(UINTN
)BufferPtr
;
1536 CopyMem (AcpiTableNew
, AcpiTableOri
, TableLen
);
1538 AcpiTableNew
= AcpiTableOri
;
1541 // Change configuration table Pointer
1543 *Table
= AcpiTableNew
;
1549 ConvertSmbiosTable (
1554 Routine Description:
1556 Convert Smbios Table if the Location of the SMBios Table is lower than Addres 0x100000
1558 As in legacy Bios, Smbios table is required to place in E/F Seg,
1559 So here we just check if the range is F seg,
1560 and if Not, assume the Memory type is EfiACPIMemoryNVS/EfiRuntimeServicesData
1562 Table - pointer to the table
1565 EFI_SUCEESS - Convert Table successfully
1570 SMBIOS_TABLE_ENTRY_POINT
*SmbiosTableNew
;
1571 SMBIOS_TABLE_ENTRY_POINT
*SmbiosTableOri
;
1573 UINT32 SmbiosEntryLen
;
1575 EFI_PHYSICAL_ADDRESS BufferPtr
;
1577 SmbiosTableNew
= NULL
;
1578 SmbiosTableOri
= NULL
;
1581 // Get Smibos configuration Table
1583 SmbiosTableOri
= (SMBIOS_TABLE_ENTRY_POINT
*)(UINTN
)(*(UINT64
*)(*Table
));
1585 if ((SmbiosTableOri
== NULL
) ||
1586 ((UINTN
)SmbiosTableOri
> 0x100000) ||
1587 ((UINTN
)SmbiosTableOri
< 0xF0000)){
1591 // Relocate the Smibos memory
1593 BufferPtr
= EFI_SYSTEM_TABLE_MAX_ADDRESS
;
1594 if (SmbiosTableOri
->SmbiosBcdRevision
!= 0x21) {
1595 SmbiosEntryLen
= SmbiosTableOri
->EntryPointLength
;
1598 // According to Smbios Spec 2.4, we should set entry point length as 0x1F if version is 2.1
1600 SmbiosEntryLen
= 0x1F;
1602 BufferLen
= SmbiosEntryLen
+ SYS_TABLE_PAD(SmbiosEntryLen
) + SmbiosTableOri
->TableLength
;
1603 Status
= gBS
->AllocatePages (
1606 EFI_SIZE_TO_PAGES(BufferLen
),
1609 ASSERT_EFI_ERROR (Status
);
1610 SmbiosTableNew
= (SMBIOS_TABLE_ENTRY_POINT
*)(UINTN
)BufferPtr
;
1617 // Get Smbios Structure table address, and make sure the start address is 32-bit align
1619 BufferPtr
+= SmbiosEntryLen
+ SYS_TABLE_PAD(SmbiosEntryLen
);
1621 (VOID
*)(UINTN
)BufferPtr
,
1622 (VOID
*)(UINTN
)(SmbiosTableOri
->TableAddress
),
1623 SmbiosTableOri
->TableLength
1625 SmbiosTableNew
->TableAddress
= (UINT32
)BufferPtr
;
1626 SmbiosTableNew
->IntermediateChecksum
= 0;
1627 SmbiosTableNew
->IntermediateChecksum
=
1628 CalculateCheckSum8 ((UINT8
*)SmbiosTableNew
+ 0x10, SmbiosEntryLen
-0x10);
1630 // Change the SMBIOS pointer
1632 *Table
= SmbiosTableNew
;
1643 Routine Description:
1645 Convert MP Table if the Location of the SMBios Table is lower than Addres 0x100000
1647 As in legacy Bios, MP table is required to place in E/F Seg,
1648 So here we just check if the range is E/F seg,
1649 and if Not, assume the Memory type is EfiACPIMemoryNVS/EfiRuntimeServicesData
1651 Table - pointer to the table
1654 EFI_SUCEESS - Convert Table successfully
1661 EFI_LEGACY_MP_TABLE_FLOATING_POINTER
*MpsFloatingPointerOri
;
1662 EFI_LEGACY_MP_TABLE_FLOATING_POINTER
*MpsFloatingPointerNew
;
1663 EFI_LEGACY_MP_TABLE_HEADER
*MpsTableOri
;
1664 EFI_LEGACY_MP_TABLE_HEADER
*MpsTableNew
;
1668 EFI_PHYSICAL_ADDRESS BufferPtr
;
1671 // Get MP configuration Table
1673 MpsFloatingPointerOri
= (EFI_LEGACY_MP_TABLE_FLOATING_POINTER
*)(UINTN
)(*(UINT64
*)(*Table
));
1674 if (!(((UINTN
)MpsFloatingPointerOri
<= 0x100000) &&
1675 ((UINTN
)MpsFloatingPointerOri
>= 0xF0000))){
1679 // Get Floating pointer structure length
1681 FPLength
= MpsFloatingPointerOri
->Length
* 16;
1682 Data32
= FPLength
+ SYS_TABLE_PAD (FPLength
);
1683 MpsTableOri
= (EFI_LEGACY_MP_TABLE_HEADER
*)(UINTN
)(MpsFloatingPointerOri
->PhysicalAddress
);
1684 if (MpsTableOri
!= NULL
) {
1685 Data32
+= MpsTableOri
->BaseTableLength
;
1686 Data32
+= MpsTableOri
->ExtendedTableLength
;
1687 if (MpsTableOri
->OemTablePointer
!= 0x00) {
1688 Data32
+= SYS_TABLE_PAD (Data32
);
1689 Data32
+= MpsTableOri
->OemTableSize
;
1697 BufferPtr
= EFI_SYSTEM_TABLE_MAX_ADDRESS
;
1698 Status
= gBS
->AllocatePages (
1701 EFI_SIZE_TO_PAGES(Data32
),
1704 ASSERT_EFI_ERROR (Status
);
1705 MpsFloatingPointerNew
= (EFI_LEGACY_MP_TABLE_FLOATING_POINTER
*)(UINTN
)BufferPtr
;
1706 CopyMem (MpsFloatingPointerNew
, MpsFloatingPointerOri
, FPLength
);
1708 // If Mp Table exists
1710 if (MpsTableOri
!= NULL
) {
1712 // Get Mps table length, including Ext table
1714 BufferPtr
= BufferPtr
+ FPLength
+ SYS_TABLE_PAD (FPLength
);
1715 MpsTableNew
= (EFI_LEGACY_MP_TABLE_HEADER
*)(UINTN
)BufferPtr
;
1716 CopyMem (MpsTableNew
, MpsTableOri
, MpsTableOri
->BaseTableLength
+ MpsTableOri
->ExtendedTableLength
);
1718 if ((MpsTableOri
->OemTableSize
!= 0x0000) && (MpsTableOri
->OemTablePointer
!= 0x0000)){
1719 BufferPtr
+= MpsTableOri
->BaseTableLength
+ MpsTableOri
->ExtendedTableLength
;
1720 BufferPtr
+= SYS_TABLE_PAD (BufferPtr
);
1721 OemTableNew
= (VOID
*)(UINTN
)BufferPtr
;
1722 OemTableOri
= (VOID
*)(UINTN
)MpsTableOri
->OemTablePointer
;
1723 CopyMem (OemTableNew
, OemTableOri
, MpsTableOri
->OemTableSize
);
1724 MpsTableNew
->OemTablePointer
= (UINT32
)(UINTN
)OemTableNew
;
1726 MpsTableNew
->Checksum
= 0;
1727 MpsTableNew
->Checksum
= CalculateCheckSum8 ((UINT8
*)MpsTableNew
, MpsTableOri
->BaseTableLength
);
1728 MpsFloatingPointerNew
->PhysicalAddress
= (UINT32
)(UINTN
)MpsTableNew
;
1729 MpsFloatingPointerNew
->Checksum
= 0;
1730 MpsFloatingPointerNew
->Checksum
= CalculateCheckSum8 ((UINT8
*)MpsFloatingPointerNew
, FPLength
);
1733 // Change the pointer
1735 *Table
= MpsFloatingPointerNew
;
1741 Lock the ConsoleIn device in system table. All key
1742 presses will be ignored until the Password is typed in. The only way to
1743 disable the password is to type it in to a ConIn device.
1745 @param Password Password used to lock ConIn device.
1747 @retval EFI_SUCCESS lock the Console In Spliter virtual handle successfully.
1748 @retval EFI_UNSUPPORTED Password not found
1757 return EFI_UNSUPPORTED
;
1761 This function locks platform flash that is not allowed to be updated during normal boot path.
1762 The flash layout is platform specific.
1767 PlatformBdsLockNonUpdatableFlash (