Compare commits
243 Commits
system76
...
edk2-stabl
Author | SHA1 | Date | |
---|---|---|---|
bb1bba3d77 | |||
4c7ce0d285 | |||
e1e7306b54 | |||
455b0347a7 | |||
466ebdd2e0 | |||
4c495e5e3d | |||
a92559671a | |||
22c3b5a865 | |||
8c8867c5da | |||
f826b20811 | |||
a7b35aae13 | |||
aab6bb3d32 | |||
c974257821 | |||
d6e6337cd6 | |||
8c1b1fe634 | |||
fd42dcb1fc | |||
d939a25d41 | |||
45137bca2f | |||
77dcd03ecf | |||
f331310a10 | |||
5948ec3647 | |||
48452993ad | |||
b5d4a35d90 | |||
d79df34beb | |||
4050c873b5 | |||
15e635d1b5 | |||
b0a03ca4a9 | |||
c1f2287635 | |||
e13e53cb2f | |||
0f4cdad25b | |||
b258f12889 | |||
6f9e83f757 | |||
939c2355da | |||
c8594a5311 | |||
91b772ab62 | |||
e7663fdd82 | |||
1bc232aae3 | |||
bb146ce32d | |||
9a95d11023 | |||
2f6f3329ad | |||
b80c17b62d | |||
242dcfe30f | |||
ae8acce8ae | |||
04714cef46 | |||
1d66480aa4 | |||
bed990aae6 | |||
e7e8ea27d4 | |||
87a34ca0cf | |||
8b76f23534 | |||
c9ec74a198 | |||
5a2411784b | |||
f079e9b450 | |||
6254037223 | |||
bd5ec03d87 | |||
2f286930a8 | |||
305fd6bee0 | |||
99325a8b65 | |||
6893865b30 | |||
4fdf843c75 | |||
37a33f02aa | |||
90246a6d9f | |||
6ef5797447 | |||
91a978ce7e | |||
36b561623a | |||
11a4af85a4 | |||
2108698346 | |||
f10a112f08 | |||
7e43d3e086 | |||
785cfd3305 | |||
f2400e06db | |||
e0c23cba5e | |||
b21c6794de | |||
9a7509e465 | |||
c6770f4b88 | |||
26aa241d2f | |||
f8d0501ded | |||
47bd85e9f9 | |||
d881c6ddf5 | |||
77e9b3a7c6 | |||
7d78a86ecf | |||
fb759b8b73 | |||
e40fefafa9 | |||
a7fcab7aa3 | |||
43b3840873 | |||
978d428ec3 | |||
6ed6abd6c1 | |||
4225a464c6 | |||
f22feb0e3b | |||
ba4ae92234 | |||
782d018703 | |||
19ee56c4b3 | |||
769e63999f | |||
f17ef10e63 | |||
a5e36ad9bc | |||
018a962d92 | |||
3e958e93ce | |||
e2d7b4950b | |||
de62ccbf4f | |||
ce15936f2f | |||
12e65fd258 | |||
1e33479b39 | |||
9454d1ebcb | |||
f995f8672b | |||
6d2777d85f | |||
37bd08176c | |||
2dd7dd3952 | |||
7b2022d39e | |||
74addfeab6 | |||
28b2df475f | |||
bfaf7c8b9e | |||
25cf58a163 | |||
71c3c9c0c4 | |||
30400318a2 | |||
5ece2ad36c | |||
b4da6c29f1 | |||
80e67bcb23 | |||
942c9bd357 | |||
f09dbf20b9 | |||
06a326caf1 | |||
862e814de4 | |||
55f47d2299 | |||
8456785986 | |||
2c467c9be2 | |||
1d3e89f349 | |||
bf02d73e74 | |||
8583b57c5c | |||
6a8e9ad24b | |||
76602f45dc | |||
27de86ae41 | |||
b9dd64b80e | |||
6073bf6cd8 | |||
06fa1f1931 | |||
0569c52b15 | |||
60d55c4156 | |||
2a49c19b9e | |||
4932f05a00 | |||
606340fba3 | |||
c806b76865 | |||
b3685956d2 | |||
282122ec5f | |||
c49cb8f30e | |||
4cc1458dbe | |||
22873f58c4 | |||
691c5f7762 | |||
7a8c037e9e | |||
235ff9fcd1 | |||
96e006b37e | |||
72ab552554 | |||
653113412f | |||
1ad5182500 | |||
20775950c6 | |||
0875443f7e | |||
422e5d2f7f | |||
2273799677 | |||
9e950cda6a | |||
8b4bb94f64 | |||
f86de75862 | |||
bd298d7593 | |||
8ab8fbc016 | |||
b8675deaa8 | |||
499c4608b1 | |||
442e46d3b6 | |||
c7d5b046d9 | |||
445c39f757 | |||
259c184c8f | |||
c214128a38 | |||
1ce6ceb75b | |||
2ea0a0a414 | |||
4a1899dd79 | |||
dc430ccf3f | |||
cc5a67269e | |||
b0f1b1c5fd | |||
f57040b038 | |||
46b4606ba2 | |||
d60915b751 | |||
7ea7f9c077 | |||
c0cd26f43c | |||
f2a7e24e38 | |||
fdeff3fdae | |||
79019c7a42 | |||
f334c5a41d | |||
542cba73d2 | |||
e3e47d7963 | |||
ac6388add4 | |||
60d8bb9f28 | |||
89f7ed8b29 | |||
010753b7e7 | |||
bda3546c55 | |||
f4e72cf9d6 | |||
c19d18136e | |||
6f501a7c9b | |||
6c80564b89 | |||
3b69fcf5f8 | |||
2fa89c8e11 | |||
a4867dea2a | |||
f108178c56 | |||
2906e572c6 | |||
ebbc8ab2cd | |||
4d5f39cd22 | |||
610d8073f2 | |||
dcd3d63f4f | |||
d96df7e993 | |||
cf7c650592 | |||
6c7d6d4a5e | |||
d248516b3a | |||
851785ea67 | |||
a7cf2c5664 | |||
4473834e7d | |||
edf8bc6d24 | |||
81d71fb86e | |||
c5e805ffe1 | |||
b6bc203375 | |||
e3ee8c8dbd | |||
63fddc98e0 | |||
12e33dca4c | |||
b170806518 | |||
3b3f882288 | |||
cdda3f74a1 | |||
5d34cc49d5 | |||
f0fe55bca4 | |||
9f3eda177a | |||
5b5f10d746 | |||
52e2dabc0f | |||
28152333bc | |||
cb0d24637d | |||
cae735f613 | |||
0f11537548 | |||
443300be46 | |||
dc995ce906 | |||
b04453d36b | |||
77d5fa8024 | |||
ae12188cf8 | |||
6a3e9576b8 | |||
537a724421 | |||
212a2b9bb8 | |||
08293e43da | |||
94e465e5cb | |||
a82bad9730 | |||
b9af5037b2 | |||
ab77b6031b | |||
80e67af9af | |||
8b15024dc7 | |||
82f7e315d6 |
@ -48,6 +48,9 @@ jobs:
|
||||
TARGET_SECURITY:
|
||||
Build.Pkgs: 'SecurityPkg'
|
||||
Build.Targets: 'DEBUG,RELEASE,NO-TARGET'
|
||||
TARGET_UEFIPAYLOAD:
|
||||
Build.Pkgs: 'UefiPayloadPkg'
|
||||
Build.Targets: 'DEBUG,RELEASE,NO-TARGET'
|
||||
TARGET_PLATFORMS:
|
||||
# For Platforms only check code. Leave it to Platform CI
|
||||
# to build them.
|
||||
|
@ -67,7 +67,8 @@ class Settings(CiBuildSettingsManager, UpdateSettingsManager, SetupSettingsManag
|
||||
"CryptoPkg",
|
||||
"UnitTestFrameworkPkg",
|
||||
"OvmfPkg",
|
||||
"RedfishPkg"
|
||||
"RedfishPkg",
|
||||
"UefiPayloadPkg"
|
||||
)
|
||||
|
||||
def GetArchitecturesSupported(self):
|
||||
|
@ -3,6 +3,7 @@
|
||||
#
|
||||
# Copyright (c) 2009 - 2010, Apple Inc. All rights reserved.<BR>
|
||||
# Copyright (c) 2011 - 2021, ARM Limited. All rights reserved.
|
||||
# Copyright (c) 2021, Ampere Computing LLC. All rights reserved.
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
@ -337,9 +338,9 @@
|
||||
# UINT64 Mmio32CpuBase; // mapping target in 64-bit cpu-physical space
|
||||
# UINT64 Mmio64CpuBase; // mapping target in 64-bit cpu-physical space
|
||||
#
|
||||
# PcdPciIoTranslation = IoCpuBase - PcdPciIoBase;
|
||||
# PcdPciMmio32Translation = Mmio32CpuBase - (UINT64)PcdPciMmio32Base;
|
||||
# PcdPciMmio64Translation = Mmio64CpuBase - PcdPciMmio64Base;
|
||||
# gEfiMdePkgTokenSpaceGuid.PcdPciIoTranslation = IoCpuBase - PcdPciIoBase;
|
||||
# gEfiMdePkgTokenSpaceGuid.PcdPciMmio32Translation = Mmio32CpuBase - (UINT64)PcdPciMmio32Base;
|
||||
# gEfiMdePkgTokenSpaceGuid.PcdPciMmio64Translation = Mmio64CpuBase - PcdPciMmio64Base;
|
||||
#
|
||||
# because (a) the target address space (ie. the cpu-physical space) is
|
||||
# 64-bit, and (b) the translation values are meant as offsets for *modular*
|
||||
@ -356,11 +357,11 @@
|
||||
# UINT64 TranslatedMmio64Address; // output parameter
|
||||
#
|
||||
# TranslatedIoAddress = UntranslatedIoAddress +
|
||||
# PcdPciIoTranslation;
|
||||
# gEfiMdePkgTokenSpaceGuid.PcdPciIoTranslation;
|
||||
# TranslatedMmio32Address = (UINT64)UntranslatedMmio32Address +
|
||||
# PcdPciMmio32Translation;
|
||||
# gEfiMdePkgTokenSpaceGuid.PcdPciMmio32Translation;
|
||||
# TranslatedMmio64Address = UntranslatedMmio64Address +
|
||||
# PcdPciMmio64Translation;
|
||||
# gEfiMdePkgTokenSpaceGuid.PcdPciMmio64Translation;
|
||||
#
|
||||
# The modular arithmetic performed in UINT64 ensures that the translation
|
||||
# works correctly regardless of the relation between IoCpuBase and
|
||||
@ -369,16 +370,20 @@
|
||||
#
|
||||
gArmTokenSpaceGuid.PcdPciIoBase|0x0|UINT64|0x00000050
|
||||
gArmTokenSpaceGuid.PcdPciIoSize|0x0|UINT64|0x00000051
|
||||
gArmTokenSpaceGuid.PcdPciIoTranslation|0x0|UINT64|0x00000052
|
||||
gArmTokenSpaceGuid.PcdPciMmio32Base|0x0|UINT32|0x00000053
|
||||
gArmTokenSpaceGuid.PcdPciMmio32Size|0x0|UINT32|0x00000054
|
||||
gArmTokenSpaceGuid.PcdPciMmio32Translation|0x0|UINT64|0x00000055
|
||||
gArmTokenSpaceGuid.PcdPciMmio64Base|0x0|UINT64|0x00000056
|
||||
gArmTokenSpaceGuid.PcdPciMmio64Size|0x0|UINT64|0x00000057
|
||||
gArmTokenSpaceGuid.PcdPciMmio64Translation|0x0|UINT64|0x00000058
|
||||
|
||||
#
|
||||
# Inclusive range of allowed PCI buses.
|
||||
#
|
||||
gArmTokenSpaceGuid.PcdPciBusMin|0x0|UINT32|0x00000059
|
||||
gArmTokenSpaceGuid.PcdPciBusMax|0x0|UINT32|0x0000005A
|
||||
|
||||
[PcdsDynamicEx]
|
||||
#
|
||||
# This dynamic PCD hold the GUID of a firmware FFS which contains
|
||||
# the LinuxBoot payload.
|
||||
#
|
||||
gArmTokenSpaceGuid.PcdLinuxBootFileGuid|{0x0}|VOID*|0x0000005C
|
||||
|
@ -5,6 +5,7 @@
|
||||
# Copyright (c) 2011 - 2021, Arm Limited. All rights reserved.<BR>
|
||||
# Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>
|
||||
# Copyright (c) Microsoft Corporation.<BR>
|
||||
# Copyright (c) 2021, Ampere Computing LLC. All rights reserved.
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
@ -150,6 +151,7 @@
|
||||
ArmPkg/Library/ArmSmcPsciResetSystemLib/ArmSmcPsciResetSystemLib.inf
|
||||
ArmPkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf
|
||||
ArmPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
|
||||
ArmPkg/Library/LinuxBootBootManagerLib/LinuxBootBootManagerLib.inf
|
||||
|
||||
ArmPkg/Drivers/ArmCrashDumpDxe/ArmCrashDumpDxe.inf
|
||||
ArmPkg/Drivers/ArmScmiDxe/ArmScmiDxe.inf
|
||||
|
@ -344,10 +344,6 @@ GicV3ExitBootServicesEvent (
|
||||
GicV3DisableInterruptSource (&gHardwareInterruptV3Protocol, Index);
|
||||
}
|
||||
|
||||
for (Index = 0; Index < mGicNumInterrupts; Index++) {
|
||||
GicV3EndOfInterrupt (&gHardwareInterruptV3Protocol, Index);
|
||||
}
|
||||
|
||||
// Disable Gic Interface
|
||||
ArmGicV3DisableInterruptInterface ();
|
||||
|
||||
|
@ -38,7 +38,7 @@
|
||||
UefiBootServicesTableLib
|
||||
|
||||
[Pcd]
|
||||
gArmTokenSpaceGuid.PcdPciIoTranslation
|
||||
gEfiMdePkgTokenSpaceGuid.PcdPciIoTranslation
|
||||
|
||||
[Protocols]
|
||||
gEfiCpuIo2ProtocolGuid ## PRODUCES
|
||||
|
186
ArmPkg/Library/LinuxBootBootManagerLib/LinuxBootBm.c
Normal file
186
ArmPkg/Library/LinuxBootBootManagerLib/LinuxBootBm.c
Normal file
@ -0,0 +1,186 @@
|
||||
/** @file
|
||||
Implementation for PlatformBootManagerLib library class interfaces.
|
||||
|
||||
Copyright (C) 2015-2016, Red Hat, Inc.
|
||||
Copyright (c) 2014 - 2019, ARM Ltd. All rights reserved.<BR>
|
||||
Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>
|
||||
Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR>
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#include <Uefi.h>
|
||||
|
||||
#include <Guid/EventGroup.h>
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/DevicePathLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
#include <Library/PcdLib.h>
|
||||
#include <Library/UefiBootManagerLib.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/UefiLib.h>
|
||||
#include <Library/UefiRuntimeServicesTableLib.h>
|
||||
#include <Protocol/LoadedImage.h>
|
||||
#include <Protocol/PlatformBootManager.h>
|
||||
|
||||
/**
|
||||
Register a boot option using a file GUID in the FV.
|
||||
|
||||
@param FileGuid The file GUID name in the FV.
|
||||
@param Description The description of the boot option.
|
||||
@param Attributes The attributes of the boot option.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
VOID
|
||||
PlatformRegisterFvBootOption (
|
||||
CONST EFI_GUID *FileGuid,
|
||||
CHAR16 *Description,
|
||||
UINT32 Attributes
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
INTN OptionIndex;
|
||||
EFI_BOOT_MANAGER_LOAD_OPTION NewOption;
|
||||
EFI_BOOT_MANAGER_LOAD_OPTION *BootOptions;
|
||||
UINTN BootOptionCount;
|
||||
MEDIA_FW_VOL_FILEPATH_DEVICE_PATH FileNode;
|
||||
EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
|
||||
Status = gBS->HandleProtocol (
|
||||
gImageHandle,
|
||||
&gEfiLoadedImageProtocolGuid,
|
||||
(VOID **)&LoadedImage
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
EfiInitializeFwVolDevicepathNode (&FileNode, FileGuid);
|
||||
DevicePath = DevicePathFromHandle (LoadedImage->DeviceHandle);
|
||||
ASSERT (DevicePath != NULL);
|
||||
DevicePath = AppendDevicePathNode (
|
||||
DevicePath,
|
||||
(EFI_DEVICE_PATH_PROTOCOL *)&FileNode
|
||||
);
|
||||
ASSERT (DevicePath != NULL);
|
||||
|
||||
Status = EfiBootManagerInitializeLoadOption (
|
||||
&NewOption,
|
||||
LoadOptionNumberUnassigned,
|
||||
LoadOptionTypeBoot,
|
||||
Attributes,
|
||||
Description,
|
||||
DevicePath,
|
||||
NULL,
|
||||
0
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
FreePool (DevicePath);
|
||||
|
||||
BootOptions = EfiBootManagerGetLoadOptions (
|
||||
&BootOptionCount,
|
||||
LoadOptionTypeBoot
|
||||
);
|
||||
|
||||
OptionIndex = EfiBootManagerFindLoadOption (
|
||||
&NewOption,
|
||||
BootOptions,
|
||||
BootOptionCount
|
||||
);
|
||||
|
||||
if (OptionIndex == -1) {
|
||||
Status = EfiBootManagerAddLoadOptionVariable (&NewOption, MAX_UINTN);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
}
|
||||
EfiBootManagerFreeLoadOption (&NewOption);
|
||||
EfiBootManagerFreeLoadOptions (BootOptions, BootOptionCount);
|
||||
}
|
||||
|
||||
/**
|
||||
Do the platform specific action before the console is connected.
|
||||
|
||||
Such as:
|
||||
Update console variable;
|
||||
Register new Driver#### or Boot####;
|
||||
Signal ReadyToLock event.
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
PlatformBootManagerBeforeConsole (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
//
|
||||
// Signal EndOfDxe PI Event
|
||||
//
|
||||
EfiEventGroupSignal (&gEfiEndOfDxeEventGroupGuid);
|
||||
}
|
||||
|
||||
/**
|
||||
Do the platform specific action after the console is connected.
|
||||
|
||||
Such as:
|
||||
Dynamically switch output mode;
|
||||
Signal console ready platform customized event;
|
||||
Run diagnostics like memory testing;
|
||||
Connect certain devices;
|
||||
Dispatch additional option roms.
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
PlatformBootManagerAfterConsole (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
EFI_GUID LinuxBootFileGuid;
|
||||
|
||||
CopyGuid (&LinuxBootFileGuid, PcdGetPtr (PcdLinuxBootFileGuid));
|
||||
|
||||
if (!CompareGuid (&LinuxBootFileGuid, &gZeroGuid)) {
|
||||
//
|
||||
// Register LinuxBoot
|
||||
//
|
||||
PlatformRegisterFvBootOption (
|
||||
&LinuxBootFileGuid,
|
||||
L"LinuxBoot",
|
||||
LOAD_OPTION_ACTIVE
|
||||
);
|
||||
} else {
|
||||
DEBUG ((DEBUG_ERROR, "%a: PcdLinuxBootFileGuid was not set!\n", __FUNCTION__));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
This function is called each second during the boot manager waits the
|
||||
timeout.
|
||||
|
||||
@param TimeoutRemain The remaining timeout.
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
PlatformBootManagerWaitCallback (
|
||||
UINT16 TimeoutRemain
|
||||
)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
The function is called when no boot option could be launched,
|
||||
including platform recovery options and options pointing to applications
|
||||
built into firmware volumes.
|
||||
|
||||
If this function returns, BDS attempts to enter an infinite loop.
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
PlatformBootManagerUnableToBoot (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
return;
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
## @file
|
||||
# Implementation for PlatformBootManagerLib library class interfaces.
|
||||
#
|
||||
# Copyright (C) 2015-2016, Red Hat, Inc.
|
||||
# Copyright (c) 2014, ARM Ltd. All rights reserved.<BR>
|
||||
# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>
|
||||
# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
##
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x0001001B
|
||||
BASE_NAME = LinuxBootBootManagerLib
|
||||
FILE_GUID = 1FA91547-DB23-4F6A-8AF8-3B9782A7F917
|
||||
MODULE_TYPE = DXE_DRIVER
|
||||
VERSION_STRING = 1.0
|
||||
LIBRARY_CLASS = PlatformBootManagerLib|DXE_DRIVER
|
||||
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
#
|
||||
# VALID_ARCHITECTURES = ARM AARCH64
|
||||
#
|
||||
|
||||
[Sources]
|
||||
LinuxBootBm.c
|
||||
|
||||
[Packages]
|
||||
ArmPkg/ArmPkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
MdePkg/MdePkg.dec
|
||||
ShellPkg/ShellPkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
BaseLib
|
||||
BaseMemoryLib
|
||||
DebugLib
|
||||
MemoryAllocationLib
|
||||
PcdLib
|
||||
PrintLib
|
||||
UefiBootManagerLib
|
||||
UefiBootServicesTableLib
|
||||
UefiLib
|
||||
UefiRuntimeServicesTableLib
|
||||
|
||||
[Pcd]
|
||||
gArmTokenSpaceGuid.PcdLinuxBootFileGuid
|
||||
|
||||
[Guids]
|
||||
gEfiEndOfDxeEventGroupGuid
|
||||
gUefiShellFileGuid
|
||||
gZeroGuid
|
||||
|
||||
[Protocols]
|
||||
gEfiLoadedImageProtocolGuid
|
@ -2,9 +2,10 @@
|
||||
Implementation for PlatformBootManagerLib library class interfaces.
|
||||
|
||||
Copyright (C) 2015-2016, Red Hat, Inc.
|
||||
Copyright (c) 2014 - 2019, ARM Ltd. All rights reserved.<BR>
|
||||
Copyright (c) 2014 - 2021, ARM Ltd. All rights reserved.<BR>
|
||||
Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>
|
||||
Copyright (c) 2021, Semihalf All rights reserved.<BR>
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
@ -19,6 +20,7 @@
|
||||
#include <Library/UefiBootManagerLib.h>
|
||||
#include <Library/UefiLib.h>
|
||||
#include <Library/UefiRuntimeServicesTableLib.h>
|
||||
#include <Protocol/BootManagerPolicy.h>
|
||||
#include <Protocol/DevicePath.h>
|
||||
#include <Protocol/EsrtManagement.h>
|
||||
#include <Protocol/GraphicsOutput.h>
|
||||
@ -27,6 +29,7 @@
|
||||
#include <Protocol/PciIo.h>
|
||||
#include <Protocol/PciRootBridgeIo.h>
|
||||
#include <Protocol/PlatformBootManager.h>
|
||||
#include <Guid/BootDiscoveryPolicy.h>
|
||||
#include <Guid/EventGroup.h>
|
||||
#include <Guid/NonDiscoverableDevice.h>
|
||||
#include <Guid/TtyTerm.h>
|
||||
@ -703,6 +706,113 @@ HandleCapsules (
|
||||
|
||||
#define VERSION_STRING_PREFIX L"Tianocore/EDK2 firmware version "
|
||||
|
||||
/**
|
||||
This functions checks the value of BootDiscoverPolicy variable and
|
||||
connect devices of class specified by that variable. Then it refreshes
|
||||
Boot order for newly discovered boot device.
|
||||
|
||||
@retval EFI_SUCCESS Devices connected successfully or connection
|
||||
not required.
|
||||
@retval others Return values from GetVariable(), LocateProtocol()
|
||||
and ConnectDeviceClass().
|
||||
**/
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
BootDiscoveryPolicyHandler (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINT32 DiscoveryPolicy;
|
||||
UINT32 DiscoveryPolicyOld;
|
||||
UINTN Size;
|
||||
EFI_BOOT_MANAGER_POLICY_PROTOCOL *BMPolicy;
|
||||
EFI_GUID *Class;
|
||||
|
||||
Size = sizeof (DiscoveryPolicy);
|
||||
Status = gRT->GetVariable (
|
||||
BOOT_DISCOVERY_POLICY_VAR,
|
||||
&gBootDiscoveryPolicyMgrFormsetGuid,
|
||||
NULL,
|
||||
&Size,
|
||||
&DiscoveryPolicy
|
||||
);
|
||||
if (Status == EFI_NOT_FOUND) {
|
||||
DiscoveryPolicy = PcdGet32 (PcdBootDiscoveryPolicy);
|
||||
Status = PcdSet32S (PcdBootDiscoveryPolicy, DiscoveryPolicy);
|
||||
if (Status == EFI_NOT_FOUND) {
|
||||
return EFI_SUCCESS;
|
||||
} else if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
} else if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
if (DiscoveryPolicy == BDP_CONNECT_MINIMAL) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
switch (DiscoveryPolicy) {
|
||||
case BDP_CONNECT_NET:
|
||||
Class = &gEfiBootManagerPolicyNetworkGuid;
|
||||
break;
|
||||
case BDP_CONNECT_ALL:
|
||||
Class = &gEfiBootManagerPolicyConnectAllGuid;
|
||||
break;
|
||||
default:
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"%a - Unexpected DiscoveryPolicy (0x%x). Run Minimal Discovery Policy\n",
|
||||
__FUNCTION__,
|
||||
DiscoveryPolicy
|
||||
));
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
Status = gBS->LocateProtocol (
|
||||
&gEfiBootManagerPolicyProtocolGuid,
|
||||
NULL,
|
||||
(VOID **)&BMPolicy
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_INFO, "%a - Failed to locate gEfiBootManagerPolicyProtocolGuid."
|
||||
"Driver connect will be skipped.\n", __FUNCTION__));
|
||||
return Status;
|
||||
}
|
||||
|
||||
Status = BMPolicy->ConnectDeviceClass (BMPolicy, Class);
|
||||
if (EFI_ERROR (Status)){
|
||||
DEBUG ((DEBUG_ERROR, "%a - ConnectDeviceClass returns - %r\n", __FUNCTION__, Status));
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Refresh Boot Options if Boot Discovery Policy has been changed
|
||||
//
|
||||
Size = sizeof (DiscoveryPolicyOld);
|
||||
Status = gRT->GetVariable (
|
||||
BOOT_DISCOVERY_POLICY_OLD_VAR,
|
||||
&gBootDiscoveryPolicyMgrFormsetGuid,
|
||||
NULL,
|
||||
&Size,
|
||||
&DiscoveryPolicyOld
|
||||
);
|
||||
if ((Status == EFI_NOT_FOUND) || (DiscoveryPolicyOld != DiscoveryPolicy)) {
|
||||
EfiBootManagerRefreshAllBootOption ();
|
||||
|
||||
Status = gRT->SetVariable (
|
||||
BOOT_DISCOVERY_POLICY_OLD_VAR,
|
||||
&gBootDiscoveryPolicyMgrFormsetGuid,
|
||||
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
|
||||
sizeof (DiscoveryPolicyOld),
|
||||
&DiscoveryPolicy
|
||||
);
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
Do the platform specific action after the console is ready
|
||||
Possible things that can be done in PlatformBootManagerAfterConsole:
|
||||
@ -753,6 +863,12 @@ PlatformBootManagerAfterConsole (
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Connect device specified by BootDiscoverPolicy variable and
|
||||
// refresh Boot order for newly discovered boot devices
|
||||
//
|
||||
BootDiscoveryPolicyHandler ();
|
||||
|
||||
//
|
||||
// On ARM, there is currently no reason to use the phased capsule
|
||||
// update approach where some capsules are dispatched before EndOfDxe
|
||||
|
@ -65,11 +65,15 @@
|
||||
|
||||
[Pcd]
|
||||
gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdBootDiscoveryPolicy
|
||||
|
||||
[Guids]
|
||||
gBootDiscoveryPolicyMgrFormsetGuid
|
||||
gEdkiiNonDiscoverableEhciDeviceGuid
|
||||
gEdkiiNonDiscoverableUhciDeviceGuid
|
||||
gEdkiiNonDiscoverableXhciDeviceGuid
|
||||
gEfiBootManagerPolicyNetworkGuid
|
||||
gEfiBootManagerPolicyConnectAllGuid
|
||||
gEfiFileInfoGuid
|
||||
gEfiFileSystemInfoGuid
|
||||
gEfiFileSystemVolumeLabelInfoIdGuid
|
||||
@ -79,6 +83,7 @@
|
||||
|
||||
[Protocols]
|
||||
gEdkiiNonDiscoverableDeviceProtocolGuid
|
||||
gEfiBootManagerPolicyProtocolGuid
|
||||
gEfiDevicePathProtocolGuid
|
||||
gEfiGraphicsOutputProtocolGuid
|
||||
gEfiLoadedImageProtocolGuid
|
||||
|
@ -219,7 +219,7 @@ ConfigureCacheArchitectureInformation (
|
||||
CacheSize32 = CacheSize16;
|
||||
} else if ((CacheSize64 / 64) < MAX_INT16) {
|
||||
CacheSize16 = (1 << 15) | (CacheSize64 / 64);
|
||||
CacheSize32 = CacheSize16;
|
||||
CacheSize32 = (1 << 31) | (CacheSize64 / 64);
|
||||
} else {
|
||||
if ((CacheSize64 / 1024) <= 2047) {
|
||||
CacheSize32 = CacheSize64;
|
||||
@ -689,7 +689,7 @@ AddSmbiosProcessorTypeTable (
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "[%a]:[%dL] Smbios Type04 Table Log Failed! %r \n",
|
||||
__FUNCTION__, __LINE__, Status));
|
||||
__FUNCTION__, DEBUG_LINE_NUMBER, Status));
|
||||
}
|
||||
FreePool (Type4Record);
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
Functions for processor information common to ARM and AARCH64.
|
||||
|
||||
Copyright (c) 2021, NUVIA Inc. All rights reserved.<BR>
|
||||
Copyright (c) 2021, Ampere Computing LLC. All rights reserved.<BR>
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
@ -171,7 +172,7 @@ SmbiosGetProcessorId (
|
||||
|
||||
if (HasSmcArm64SocId ()) {
|
||||
SmbiosGetSmcArm64SocId (&Jep106Code, &SocRevision);
|
||||
ProcessorId = ((UINT64)Jep106Code << 32) | SocRevision;
|
||||
ProcessorId = ((UINT64)SocRevision << 32) | Jep106Code;
|
||||
} else {
|
||||
ProcessorId = ArmReadMidr ();
|
||||
}
|
||||
|
@ -240,11 +240,12 @@ SMBIOS_MISC_TABLE_FUNCTION (MiscBiosVendor)
|
||||
SmbiosRecord->BiosSegment = (UINT16)(FixedPcdGet32 (PcdFdBaseAddress) / SIZE_64KB);
|
||||
if (BiosPhysicalSize < SIZE_16MB) {
|
||||
SmbiosRecord->BiosSize = Base2ToByteWith64KUnit (BiosPhysicalSize) - 1;
|
||||
SmbiosRecord->ExtendedBiosSize.Size = BiosPhysicalSize / SIZE_1MB;
|
||||
SmbiosRecord->ExtendedBiosSize.Unit = 0; // Size is in MB
|
||||
} else {
|
||||
SmbiosRecord->BiosSize = 0xFF;
|
||||
if (BiosPhysicalSize > 0x3FFF) {
|
||||
if (BiosPhysicalSize < SIZE_16GB) {
|
||||
SmbiosRecord->ExtendedBiosSize.Size = BiosPhysicalSize / SIZE_1MB;
|
||||
SmbiosRecord->ExtendedBiosSize.Unit = 0; // Size is in MB
|
||||
} else {
|
||||
SmbiosRecord->ExtendedBiosSize.Size = BiosPhysicalSize / SIZE_1GB;
|
||||
SmbiosRecord->ExtendedBiosSize.Unit = 1; // Size is in GB
|
||||
}
|
||||
@ -270,7 +271,7 @@ SMBIOS_MISC_TABLE_FUNCTION (MiscBiosVendor)
|
||||
Status = SmbiosMiscAddRecord ((UINT8*)SmbiosRecord, NULL);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "[%a]:[%dL] Smbios Type00 Table Log Failed! %r \n",
|
||||
__FUNCTION__, __LINE__, Status));
|
||||
__FUNCTION__, DEBUG_LINE_NUMBER, Status));
|
||||
}
|
||||
|
||||
FreePool (SmbiosRecord);
|
||||
|
@ -162,7 +162,7 @@ SMBIOS_MISC_TABLE_FUNCTION(MiscSystemManufacturer)
|
||||
Status = SmbiosMiscAddRecord ((UINT8*)SmbiosRecord, NULL);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "[%a]:[%dL] Smbios Type01 Table Log Failed! %r \n",
|
||||
__FUNCTION__, __LINE__, Status));
|
||||
__FUNCTION__, DEBUG_LINE_NUMBER, Status));
|
||||
}
|
||||
|
||||
FreePool (SmbiosRecord);
|
||||
|
@ -196,7 +196,7 @@ SMBIOS_MISC_TABLE_FUNCTION(MiscBaseBoardManufacturer)
|
||||
Status = SmbiosMiscAddRecord ((UINT8 *)SmbiosRecord, NULL);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "[%a]:[%dL] Smbios Type02 Table Log Failed! %r \n",
|
||||
__FUNCTION__, __LINE__, Status));
|
||||
__FUNCTION__, DEBUG_LINE_NUMBER, Status));
|
||||
}
|
||||
|
||||
FreePool (SmbiosRecord);
|
||||
|
@ -178,7 +178,7 @@ SMBIOS_MISC_TABLE_FUNCTION(MiscChassisManufacturer)
|
||||
Status = SmbiosMiscAddRecord ((UINT8*)SmbiosRecord, NULL);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "[%a]:[%dL] Smbios Type03 Table Log Failed! %r \n",
|
||||
__FUNCTION__, __LINE__, Status));
|
||||
__FUNCTION__, DEBUG_LINE_NUMBER, Status));
|
||||
}
|
||||
|
||||
FreePool (SmbiosRecord);
|
||||
|
@ -158,7 +158,7 @@ SMBIOS_MISC_TABLE_FUNCTION(MiscNumberOfInstallableLanguages)
|
||||
Status = SmbiosMiscAddRecord ((UINT8*)SmbiosRecord, NULL);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "[%a]:[%dL] Smbios Type13 Table Log Failed! %r \n",
|
||||
__FUNCTION__, __LINE__, Status));
|
||||
__FUNCTION__, DEBUG_LINE_NUMBER, Status));
|
||||
}
|
||||
|
||||
FreePool (SmbiosRecord);
|
||||
|
@ -68,7 +68,7 @@ SMBIOS_MISC_TABLE_FUNCTION(MiscBootInformation)
|
||||
Status = SmbiosMiscAddRecord ((UINT8*)SmbiosRecord, NULL);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "[%a]:[%dL] Smbios Type32 Table Log Failed! %r \n",
|
||||
__FUNCTION__, __LINE__, Status));
|
||||
__FUNCTION__, DEBUG_LINE_NUMBER, Status));
|
||||
}
|
||||
|
||||
FreePool (SmbiosRecord);
|
||||
|
@ -49,12 +49,13 @@
|
||||
FrameBufferBltLib|MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.inf
|
||||
QemuBootOrderLib|OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.inf
|
||||
FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf
|
||||
PciPcdProducerLib|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
|
||||
PciPcdProducerLib|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
|
||||
PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.inf
|
||||
PciHostBridgeLib|ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf
|
||||
PciHostBridgeLib|OvmfPkg/Fdt/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf
|
||||
PciHostBridgeUtilityLib|ArmVirtPkg/Library/ArmVirtPciHostBridgeUtilityLib/ArmVirtPciHostBridgeUtilityLib.inf
|
||||
|
||||
TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
|
||||
TpmPlatformHierarchyLib|SecurityPkg/Library/PeiDxeTpmPlatformHierarchyLibNull/PeiDxeTpmPlatformHierarchyLib.inf
|
||||
|
||||
!include MdePkg/MdeLibs.dsc.inc
|
||||
|
||||
@ -192,7 +193,7 @@
|
||||
# PCD and PcdPciDisableBusEnumeration above have not been assigned yet
|
||||
gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress|0xFFFFFFFFFFFFFFFF
|
||||
|
||||
gArmTokenSpaceGuid.PcdPciIoTranslation|0
|
||||
gEfiMdePkgTokenSpaceGuid.PcdPciIoTranslation|0
|
||||
|
||||
gEfiSecurityPkgTokenSpaceGuid.PcdTpmBaseAddress|0x0
|
||||
|
||||
@ -292,9 +293,9 @@
|
||||
#
|
||||
# Platform Driver
|
||||
#
|
||||
ArmVirtPkg/VirtioFdtDxe/VirtioFdtDxe.inf
|
||||
ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
|
||||
ArmVirtPkg/HighMemDxe/HighMemDxe.inf
|
||||
OvmfPkg/Fdt/VirtioFdtDxe/VirtioFdtDxe.inf
|
||||
EmbeddedPkg/Drivers/FdtClientDxe/FdtClientDxe.inf
|
||||
OvmfPkg/Fdt/HighMemDxe/HighMemDxe.inf
|
||||
OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
|
||||
OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
|
||||
OvmfPkg/VirtioNetDxe/VirtioNet.inf
|
||||
@ -341,12 +342,12 @@
|
||||
#
|
||||
ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf {
|
||||
<LibraryClasses>
|
||||
NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
|
||||
NULL|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
|
||||
}
|
||||
MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf
|
||||
MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf {
|
||||
<LibraryClasses>
|
||||
NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
|
||||
NULL|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
|
||||
}
|
||||
OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
|
||||
OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
|
||||
@ -360,5 +361,5 @@
|
||||
MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
|
||||
ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpiPlatformDxe.inf {
|
||||
<LibraryClasses>
|
||||
NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
|
||||
NULL|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
|
||||
}
|
||||
|
@ -105,9 +105,9 @@ READ_LOCK_STATUS = TRUE
|
||||
|
||||
INF MdeModulePkg/Core/Dxe/DxeMain.inf
|
||||
INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
|
||||
INF ArmVirtPkg/VirtioFdtDxe/VirtioFdtDxe.inf
|
||||
INF ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
|
||||
INF ArmVirtPkg/HighMemDxe/HighMemDxe.inf
|
||||
INF OvmfPkg/Fdt/VirtioFdtDxe/VirtioFdtDxe.inf
|
||||
INF EmbeddedPkg/Drivers/FdtClientDxe/FdtClientDxe.inf
|
||||
INF OvmfPkg/Fdt/HighMemDxe/HighMemDxe.inf
|
||||
|
||||
#
|
||||
# PI DXE Drivers producing Architectural Protocols (EFI Services)
|
||||
|
@ -57,9 +57,9 @@
|
||||
|
||||
FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf
|
||||
|
||||
PciPcdProducerLib|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
|
||||
PciPcdProducerLib|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
|
||||
PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.inf
|
||||
PciHostBridgeLib|ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf
|
||||
PciHostBridgeLib|OvmfPkg/Fdt/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf
|
||||
PciHostBridgeUtilityLib|ArmVirtPkg/Library/ArmVirtPciHostBridgeUtilityLib/ArmVirtPciHostBridgeUtilityLib.inf
|
||||
|
||||
TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
|
||||
@ -184,7 +184,7 @@
|
||||
# PCD and PcdPciDisableBusEnumeration above have not been assigned yet
|
||||
gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress|0xFFFFFFFFFFFFFFFF
|
||||
|
||||
gArmTokenSpaceGuid.PcdPciIoTranslation|0x0
|
||||
gEfiMdePkgTokenSpaceGuid.PcdPciIoTranslation|0x0
|
||||
|
||||
#
|
||||
# Set video resolution for boot options and for text setup.
|
||||
@ -291,9 +291,9 @@
|
||||
# Platform Driver
|
||||
#
|
||||
ArmVirtPkg/KvmtoolPlatformDxe/KvmtoolPlatformDxe.inf
|
||||
ArmVirtPkg/VirtioFdtDxe/VirtioFdtDxe.inf
|
||||
ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
|
||||
ArmVirtPkg/HighMemDxe/HighMemDxe.inf
|
||||
OvmfPkg/Fdt/VirtioFdtDxe/VirtioFdtDxe.inf
|
||||
EmbeddedPkg/Drivers/FdtClientDxe/FdtClientDxe.inf
|
||||
OvmfPkg/Fdt/HighMemDxe/HighMemDxe.inf
|
||||
OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
|
||||
OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
|
||||
OvmfPkg/VirtioNetDxe/VirtioNet.inf
|
||||
@ -338,17 +338,17 @@
|
||||
#
|
||||
ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf {
|
||||
<LibraryClasses>
|
||||
NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
|
||||
NULL|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
|
||||
NULL|ArmVirtPkg/Library/BaseCachingPciExpressLib/BaseCachingPciExpressLib.inf
|
||||
}
|
||||
MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf {
|
||||
<LibraryClasses>
|
||||
NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
|
||||
NULL|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
|
||||
NULL|ArmVirtPkg/Library/BaseCachingPciExpressLib/BaseCachingPciExpressLib.inf
|
||||
}
|
||||
MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf {
|
||||
<LibraryClasses>
|
||||
NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
|
||||
NULL|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
|
||||
NULL|ArmVirtPkg/Library/BaseCachingPciExpressLib/BaseCachingPciExpressLib.inf
|
||||
}
|
||||
OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
|
||||
|
@ -119,10 +119,10 @@ READ_LOCK_STATUS = TRUE
|
||||
|
||||
INF MdeModulePkg/Core/Dxe/DxeMain.inf
|
||||
INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
|
||||
INF ArmVirtPkg/VirtioFdtDxe/VirtioFdtDxe.inf
|
||||
INF ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
|
||||
INF OvmfPkg/Fdt/VirtioFdtDxe/VirtioFdtDxe.inf
|
||||
INF EmbeddedPkg/Drivers/FdtClientDxe/FdtClientDxe.inf
|
||||
INF ArmVirtPkg/KvmtoolPlatformDxe/KvmtoolPlatformDxe.inf
|
||||
INF ArmVirtPkg/HighMemDxe/HighMemDxe.inf
|
||||
INF OvmfPkg/Fdt/HighMemDxe/HighMemDxe.inf
|
||||
|
||||
#
|
||||
# PI DXE Drivers producing Architectural Protocols (EFI Services)
|
||||
|
@ -35,9 +35,6 @@
|
||||
|
||||
gArmVirtVariableGuid = { 0x50bea1e5, 0xa2c5, 0x46e9, { 0x9b, 0x3a, 0x59, 0x59, 0x65, 0x16, 0xb0, 0x0a } }
|
||||
|
||||
[Protocols]
|
||||
gFdtClientProtocolGuid = { 0xE11FACA0, 0x4710, 0x4C8E, { 0xA7, 0xA2, 0x01, 0xBA, 0xA2, 0x59, 0x1B, 0x4C } }
|
||||
|
||||
[PcdsFeatureFlag]
|
||||
#
|
||||
# Feature Flag PCD that defines whether TPM2 support is enabled
|
||||
|
@ -59,7 +59,7 @@
|
||||
# Virtio Support
|
||||
VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf
|
||||
VirtioMmioDeviceLib|OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceLib.inf
|
||||
QemuFwCfgLib|ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
|
||||
QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMmio.inf
|
||||
QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/BaseQemuFwCfgS3LibNull.inf
|
||||
QemuFwCfgSimpleParserLib|OvmfPkg/Library/QemuFwCfgSimpleParserLib/QemuFwCfgSimpleParserLib.inf
|
||||
QemuLoadImageLib|OvmfPkg/Library/GenericQemuLoadImageLib/GenericQemuLoadImageLib.inf
|
||||
@ -77,17 +77,19 @@
|
||||
FrameBufferBltLib|MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.inf
|
||||
QemuBootOrderLib|OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.inf
|
||||
FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf
|
||||
PciPcdProducerLib|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
|
||||
PciPcdProducerLib|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
|
||||
PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.inf
|
||||
PciHostBridgeLib|ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf
|
||||
PciHostBridgeLib|OvmfPkg/Fdt/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf
|
||||
PciHostBridgeUtilityLib|OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf
|
||||
|
||||
!if $(TPM2_ENABLE) == TRUE
|
||||
Tpm2CommandLib|SecurityPkg/Library/Tpm2CommandLib/Tpm2CommandLib.inf
|
||||
Tcg2PhysicalPresenceLib|OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu/DxeTcg2PhysicalPresenceLib.inf
|
||||
TpmMeasurementLib|SecurityPkg/Library/DxeTpmMeasurementLib/DxeTpmMeasurementLib.inf
|
||||
TpmPlatformHierarchyLib|SecurityPkg/Library/PeiDxeTpmPlatformHierarchyLib/PeiDxeTpmPlatformHierarchyLib.inf
|
||||
!else
|
||||
TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
|
||||
TpmPlatformHierarchyLib|SecurityPkg/Library/PeiDxeTpmPlatformHierarchyLibNull/PeiDxeTpmPlatformHierarchyLib.inf
|
||||
!endif
|
||||
|
||||
[LibraryClasses.common.PEIM]
|
||||
@ -247,7 +249,7 @@
|
||||
# PCD and PcdPciDisableBusEnumeration above have not been assigned yet
|
||||
gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress|0xFFFFFFFFFFFFFFFF
|
||||
|
||||
gArmTokenSpaceGuid.PcdPciIoTranslation|0x0
|
||||
gEfiMdePkgTokenSpaceGuid.PcdPciIoTranslation|0x0
|
||||
|
||||
#
|
||||
# Set video resolution for boot options and for text setup.
|
||||
@ -403,9 +405,9 @@
|
||||
#
|
||||
# Platform Driver
|
||||
#
|
||||
ArmVirtPkg/VirtioFdtDxe/VirtioFdtDxe.inf
|
||||
ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
|
||||
ArmVirtPkg/HighMemDxe/HighMemDxe.inf
|
||||
OvmfPkg/Fdt/VirtioFdtDxe/VirtioFdtDxe.inf
|
||||
EmbeddedPkg/Drivers/FdtClientDxe/FdtClientDxe.inf
|
||||
OvmfPkg/Fdt/HighMemDxe/HighMemDxe.inf
|
||||
OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
|
||||
OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
|
||||
OvmfPkg/VirtioNetDxe/VirtioNet.inf
|
||||
@ -487,12 +489,12 @@
|
||||
#
|
||||
ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf {
|
||||
<LibraryClasses>
|
||||
NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
|
||||
NULL|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
|
||||
}
|
||||
MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf
|
||||
MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf {
|
||||
<LibraryClasses>
|
||||
NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
|
||||
NULL|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
|
||||
}
|
||||
OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
|
||||
OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
|
||||
@ -543,5 +545,5 @@
|
||||
MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
|
||||
OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf {
|
||||
<LibraryClasses>
|
||||
NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
|
||||
NULL|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
|
||||
}
|
||||
|
@ -40,9 +40,9 @@ READ_LOCK_STATUS = TRUE
|
||||
|
||||
INF MdeModulePkg/Core/Dxe/DxeMain.inf
|
||||
INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
|
||||
INF ArmVirtPkg/VirtioFdtDxe/VirtioFdtDxe.inf
|
||||
INF ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
|
||||
INF ArmVirtPkg/HighMemDxe/HighMemDxe.inf
|
||||
INF OvmfPkg/Fdt/VirtioFdtDxe/VirtioFdtDxe.inf
|
||||
INF EmbeddedPkg/Drivers/FdtClientDxe/FdtClientDxe.inf
|
||||
INF OvmfPkg/Fdt/HighMemDxe/HighMemDxe.inf
|
||||
|
||||
#
|
||||
# PI DXE Drivers producing Architectural Protocols (EFI Services)
|
||||
|
@ -57,7 +57,7 @@
|
||||
# Virtio Support
|
||||
VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf
|
||||
VirtioMmioDeviceLib|OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceLib.inf
|
||||
QemuFwCfgLib|ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
|
||||
QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMmio.inf
|
||||
QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/BaseQemuFwCfgS3LibNull.inf
|
||||
QemuFwCfgSimpleParserLib|OvmfPkg/Library/QemuFwCfgSimpleParserLib/QemuFwCfgSimpleParserLib.inf
|
||||
QemuLoadImageLib|OvmfPkg/Library/GenericQemuLoadImageLib/GenericQemuLoadImageLib.inf
|
||||
@ -75,11 +75,12 @@
|
||||
FrameBufferBltLib|MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.inf
|
||||
QemuBootOrderLib|OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.inf
|
||||
FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf
|
||||
PciPcdProducerLib|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
|
||||
PciPcdProducerLib|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
|
||||
PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.inf
|
||||
PciHostBridgeLib|ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf
|
||||
PciHostBridgeLib|OvmfPkg/Fdt/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf
|
||||
PciHostBridgeUtilityLib|OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf
|
||||
TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
|
||||
TpmPlatformHierarchyLib|SecurityPkg/Library/PeiDxeTpmPlatformHierarchyLibNull/PeiDxeTpmPlatformHierarchyLib.inf
|
||||
|
||||
[LibraryClasses.common.DXE_DRIVER]
|
||||
ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
|
||||
@ -227,7 +228,7 @@
|
||||
# PCD and PcdPciDisableBusEnumeration above have not been assigned yet
|
||||
gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress|0xFFFFFFFFFFFFFFFF
|
||||
|
||||
gArmTokenSpaceGuid.PcdPciIoTranslation|0x0
|
||||
gEfiMdePkgTokenSpaceGuid.PcdPciIoTranslation|0x0
|
||||
|
||||
#
|
||||
# Set video resolution for boot options and for text setup.
|
||||
@ -339,9 +340,9 @@
|
||||
#
|
||||
# Platform Driver
|
||||
#
|
||||
ArmVirtPkg/VirtioFdtDxe/VirtioFdtDxe.inf
|
||||
ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
|
||||
ArmVirtPkg/HighMemDxe/HighMemDxe.inf
|
||||
OvmfPkg/Fdt/VirtioFdtDxe/VirtioFdtDxe.inf
|
||||
EmbeddedPkg/Drivers/FdtClientDxe/FdtClientDxe.inf
|
||||
OvmfPkg/Fdt/HighMemDxe/HighMemDxe.inf
|
||||
OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
|
||||
OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
|
||||
OvmfPkg/VirtioNetDxe/VirtioNet.inf
|
||||
@ -423,12 +424,12 @@
|
||||
#
|
||||
ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf {
|
||||
<LibraryClasses>
|
||||
NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
|
||||
NULL|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
|
||||
}
|
||||
MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf
|
||||
MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf {
|
||||
<LibraryClasses>
|
||||
NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
|
||||
NULL|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
|
||||
}
|
||||
OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
|
||||
OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
|
||||
@ -459,5 +460,5 @@
|
||||
MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
|
||||
OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf {
|
||||
<LibraryClasses>
|
||||
NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
|
||||
NULL|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
|
||||
}
|
||||
|
@ -50,6 +50,7 @@
|
||||
PlatformBootManagerLib|ArmPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
|
||||
CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
|
||||
TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
|
||||
TpmPlatformHierarchyLib|SecurityPkg/Library/PeiDxeTpmPlatformHierarchyLibNull/PeiDxeTpmPlatformHierarchyLib.inf
|
||||
|
||||
[LibraryClasses.common.UEFI_DRIVER]
|
||||
UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
|
||||
@ -196,7 +197,7 @@
|
||||
# Platform Driver
|
||||
#
|
||||
ArmVirtPkg/XenioFdtDxe/XenioFdtDxe.inf
|
||||
ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
|
||||
EmbeddedPkg/Drivers/FdtClientDxe/FdtClientDxe.inf
|
||||
|
||||
#
|
||||
# FAT filesystem + GPT/MBR partitioning + UDF filesystem
|
||||
|
@ -139,7 +139,7 @@ READ_LOCK_STATUS = TRUE
|
||||
INF MdeModulePkg/Core/Dxe/DxeMain.inf
|
||||
INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
|
||||
INF ArmVirtPkg/XenioFdtDxe/XenioFdtDxe.inf
|
||||
INF ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
|
||||
INF EmbeddedPkg/Drivers/FdtClientDxe/FdtClientDxe.inf
|
||||
|
||||
#
|
||||
# PI DXE Drivers producing Architectural Protocols (EFI Services)
|
||||
|
@ -30,6 +30,7 @@
|
||||
[Packages]
|
||||
ArmPkg/ArmPkg.dec
|
||||
ArmVirtPkg/ArmVirtPkg.dec
|
||||
EmbeddedPkg/EmbeddedPkg.dec
|
||||
MdePkg/MdePkg.dec
|
||||
|
||||
[Protocols]
|
||||
|
@ -22,6 +22,7 @@
|
||||
[Packages]
|
||||
ArmPlatformPkg/ArmPlatformPkg.dec
|
||||
ArmVirtPkg/ArmVirtPkg.dec
|
||||
EmbeddedPkg/EmbeddedPkg.dec
|
||||
MdePkg/MdePkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
|
@ -24,6 +24,7 @@
|
||||
[Packages]
|
||||
ArmPkg/ArmPkg.dec
|
||||
ArmVirtPkg/ArmVirtPkg.dec
|
||||
EmbeddedPkg/EmbeddedPkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
MdePkg/MdePkg.dec
|
||||
|
||||
|
@ -23,6 +23,7 @@
|
||||
[Packages]
|
||||
ArmPkg/ArmPkg.dec
|
||||
ArmVirtPkg/ArmVirtPkg.dec
|
||||
EmbeddedPkg/EmbeddedPkg.dec
|
||||
MdePkg/MdePkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
[Packages]
|
||||
ArmVirtPkg/ArmVirtPkg.dec
|
||||
EmbeddedPkg/EmbeddedPkg.dec
|
||||
MdePkg/MdePkg.dec
|
||||
PcAtChipsetPkg/PcAtChipsetPkg.dec
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
ArmPkg/ArmPkg.dec
|
||||
ArmPlatformPkg/ArmPlatformPkg.dec
|
||||
ArmVirtPkg/ArmVirtPkg.dec
|
||||
EmbeddedPkg/EmbeddedPkg.dec
|
||||
MdePkg/MdePkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
|
||||
|
@ -24,6 +24,7 @@
|
||||
ArmPlatformPkg/ArmPlatformPkg.dec
|
||||
ArmPkg/ArmPkg.dec
|
||||
ArmVirtPkg/ArmVirtPkg.dec
|
||||
EmbeddedPkg/EmbeddedPkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
BaseLib
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include <Library/PcdLib.h>
|
||||
#include <Library/PlatformBmPrintScLib.h>
|
||||
#include <Library/QemuBootOrderLib.h>
|
||||
#include <Library/TpmPlatformHierarchyLib.h>
|
||||
#include <Library/UefiBootManagerLib.h>
|
||||
#include <Protocol/DevicePath.h>
|
||||
#include <Protocol/FirmwareVolume2.h>
|
||||
@ -696,6 +697,11 @@ PlatformBootManagerBeforeConsole (
|
||||
//
|
||||
EfiEventGroupSignal (&gEfiEndOfDxeEventGroupGuid);
|
||||
|
||||
//
|
||||
// Disable the TPM 2 platform hierarchy
|
||||
//
|
||||
ConfigureTpmPlatformHierarchy ();
|
||||
|
||||
//
|
||||
// Dispatch deferred images after EndOfDxe event.
|
||||
//
|
||||
|
@ -33,6 +33,7 @@
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
MdePkg/MdePkg.dec
|
||||
OvmfPkg/OvmfPkg.dec
|
||||
SecurityPkg/SecurityPkg.dec
|
||||
ShellPkg/ShellPkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
@ -47,6 +48,7 @@
|
||||
QemuBootOrderLib
|
||||
QemuLoadImageLib
|
||||
ReportStatusCodeLib
|
||||
TpmPlatformHierarchyLib
|
||||
UefiBootManagerLib
|
||||
UefiBootServicesTableLib
|
||||
UefiLib
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
[Packages]
|
||||
ArmVirtPkg/ArmVirtPkg.dec
|
||||
EmbeddedPkg/EmbeddedPkg.dec
|
||||
MdePkg/MdePkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
[Packages]
|
||||
ArmVirtPkg/ArmVirtPkg.dec
|
||||
EmbeddedPkg/EmbeddedPkg.dec
|
||||
MdePkg/MdePkg.dec
|
||||
OvmfPkg/OvmfPkg.dec
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
## @file
|
||||
# Download GCC AARCH64 compiler from Linaro's release site
|
||||
# Download GCC AARCH64 compiler from Arm's release site
|
||||
# Set shell variable GCC5_AARCH64_INSTALL to this folder
|
||||
#
|
||||
# This is only downloaded when a build activates scope gcc_aarch64_linux
|
||||
@ -11,11 +11,11 @@
|
||||
"scope": "gcc_aarch64_linux",
|
||||
"type": "web",
|
||||
"name": "gcc_aarch64_linux",
|
||||
"source": "http://releases.linaro.org/components/toolchain/binaries/7.4-2019.02/aarch64-linux-gnu/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu.tar.xz",
|
||||
"version": "7.4.1",
|
||||
"sha256": "27f1dc2c491ed61ae8f0d4b0c11de59cd2f7dd9c94761ee7153006fcac1bf9ab",
|
||||
"source": "https://developer.arm.com/-/media/Files/downloads/gnu-a/10.3-2021.07/binrel/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu.tar.xz",
|
||||
"version": "10.3-2021.07",
|
||||
"sha256": "1e33d53dea59c8de823bbdfe0798280bdcd138636c7060da9d77a97ded095a84",
|
||||
"compression_type": "tar",
|
||||
"internal_path": "/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu/",
|
||||
"internal_path": "/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu/",
|
||||
"flags": ["set_shell_var", ],
|
||||
"var_name": "GCC5_AARCH64_INSTALL"
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
## @file
|
||||
# Download GCC ARM compiler from Linaro's release site
|
||||
# Download GCC ARM compiler from Arm's release site
|
||||
# Set shell variable GCC5_ARM_INSTALL to this folder
|
||||
#
|
||||
# This is only downloaded when a build activates scope gcc_arm_linux
|
||||
@ -11,11 +11,11 @@
|
||||
"scope": "gcc_arm_linux",
|
||||
"type": "web",
|
||||
"name": "gcc_arm_linux",
|
||||
"source": "https://releases.linaro.org/components/toolchain/binaries/7.4-2019.02/arm-linux-gnueabihf/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf.tar.xz",
|
||||
"version": "7.4.1",
|
||||
"sha256": "3C951CF1941D0FA06D64CC0D5E88612B209D8123B273FA26C16D70BD7BC6B163",
|
||||
"source": "https://developer.arm.com/-/media/Files/downloads/gnu-a/10.3-2021.07/binrel/gcc-arm-10.3-2021.07-x86_64-arm-none-linux-gnueabihf.tar.asc",
|
||||
"version": "10.3-2021.07",
|
||||
"sha256": "aa074fa8371a4f73fecbd16bd62c8b1945f23289e26414794f130d6ccdf8e39c",
|
||||
"compression_type": "tar",
|
||||
"internal_path": "/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/",
|
||||
"internal_path": "/gcc-arm-10.3-2021.07-x86_64-arm-none-linux-gnueabihf/",
|
||||
"flags": ["set_shell_var", ],
|
||||
"var_name": "GCC5_ARM_INSTALL"
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ class LinuxGcc5ToolChain(IUefiBuildPlugin):
|
||||
return 0
|
||||
|
||||
# make GCC5_ARM_PREFIX to align with tools_def.txt
|
||||
prefix = os.path.join(install_path, "bin", "arm-linux-gnueabihf-")
|
||||
prefix = os.path.join(install_path, "bin", "arm-none-linux-gnueabihf-")
|
||||
shell_environment.GetEnvironment().set_shell_var("GCC5_ARM_PREFIX", prefix)
|
||||
|
||||
# now confirm it exists
|
||||
@ -80,7 +80,7 @@ class LinuxGcc5ToolChain(IUefiBuildPlugin):
|
||||
return 0
|
||||
|
||||
# make GCC5_AARCH64_PREFIX to align with tools_def.txt
|
||||
prefix = os.path.join(install_path, "bin", "aarch64-linux-gnu-")
|
||||
prefix = os.path.join(install_path, "bin", "aarch64-none-linux-gnu-")
|
||||
shell_environment.GetEnvironment().set_shell_var("GCC5_AARCH64_PREFIX", prefix)
|
||||
|
||||
# now confirm it exists
|
||||
|
@ -142,7 +142,7 @@ class parser_lst(object):
|
||||
line.append(struct)
|
||||
unparse.append(line)
|
||||
else:
|
||||
if uint not in ['UINT8', 'UINT16', 'UINT32', 'UINT64']:
|
||||
if uint not in ['UINT8', 'UINT16', 'UINT32', 'UINT64', 'BOOLEAN']:
|
||||
line = [offset, t_name, 0, uint]
|
||||
line.append(struct)
|
||||
unparse.append(line)
|
||||
@ -569,7 +569,7 @@ class mainprocess(object):
|
||||
for i in List:
|
||||
for j in i:
|
||||
tmp = j.split("|")
|
||||
if (('L"' in j) and ("[" in j)) or (tmp[1].strip() == '{0x0, 0x0}'):
|
||||
if (('L"' in j) and ("[" in j)) or (tmp[1].split("#")[0].strip() == '{0x0, 0x0}'):
|
||||
tmp[0] = tmp[0][:tmp[0].index('[')]
|
||||
List[List.index(i)][i.index(j)] = "|".join(tmp)
|
||||
else:
|
||||
|
@ -46,7 +46,10 @@ UPSTREAMS = [
|
||||
'list': 'devel@edk2.groups.io', 'prefix': 'edk2-platforms'},
|
||||
{'name': 'edk2-non-osi',
|
||||
'repo': 'https://github.com/tianocore/edk2-non-osi.git',
|
||||
'list': 'devel@edk2.groups.io', 'prefix': 'edk2-non-osi'}
|
||||
'list': 'devel@edk2.groups.io', 'prefix': 'edk2-non-osi'},
|
||||
{'name': 'edk2-test',
|
||||
'repo': 'https://github.com/tianocore/edk2-test.git',
|
||||
'list': 'devel@edk2.groups.io', 'prefix': 'edk2-test'}
|
||||
]
|
||||
|
||||
# The minimum version required for all of the below options to work
|
||||
|
@ -1135,6 +1135,8 @@ CVfrVarDataTypeDB::DataTypeAddBitField (
|
||||
if (FieldName != NULL) {
|
||||
strncpy (pNewField->mFieldName, FieldName, MAX_NAME_LEN - 1);
|
||||
pNewField->mFieldName[MAX_NAME_LEN - 1] = 0;
|
||||
} else {
|
||||
strncpy (pNewField->mFieldName, "", MAX_NAME_LEN - 1);
|
||||
}
|
||||
pNewField->mFieldType = pFieldType;
|
||||
pNewField->mIsBitField = TRUE;
|
||||
@ -3916,5 +3918,3 @@ CVfrStringDB::GetUnicodeStringTextSize (
|
||||
CVfrVarDataTypeDB gCVfrVarDataTypeDB;
|
||||
CVfrDefaultStore gCVfrDefaultStore;
|
||||
CVfrDataStorage gCVfrDataStorage;
|
||||
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
# Create makefile for MS nmake and GNU make
|
||||
#
|
||||
# Copyright (c) 2007 - 2021, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2020, ARM Limited. All rights reserved.<BR>
|
||||
# Copyright (c) 2020 - 2021, Arm Limited. All rights reserved.<BR>
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
|
||||
@ -177,11 +177,11 @@ class BuildFile(object):
|
||||
|
||||
MakePath = AutoGenObject.BuildOption.get('MAKE', {}).get('PATH')
|
||||
if not MakePath:
|
||||
self._FileType = ""
|
||||
elif "nmake" in MakePath:
|
||||
MakePath = AutoGenObject.ToolDefinition.get('MAKE', {}).get('PATH')
|
||||
if "nmake" in MakePath:
|
||||
self._FileType = NMAKE_FILETYPE
|
||||
else:
|
||||
self._FileType = "gmake"
|
||||
self._FileType = GMAKE_FILETYPE
|
||||
|
||||
if sys.platform == "win32":
|
||||
self._Platform = WIN32_PLATFORM
|
||||
|
@ -15,6 +15,7 @@ from Common.VariableAttributes import VariableAttributes
|
||||
from Common.Misc import *
|
||||
import collections
|
||||
import Common.DataType as DataType
|
||||
import Common.GlobalData as GlobalData
|
||||
|
||||
var_info = collections.namedtuple("uefi_var", "pcdindex,pcdname,defaultstoragename,skuname,var_name, var_guid, var_offset,var_attribute,pcd_default_value, default_value, data_type,PcdDscLine,StructurePcd")
|
||||
NvStorageHeaderSize = 28
|
||||
@ -173,11 +174,16 @@ class VariableMgr(object):
|
||||
offset += VariableHeaderSize + len(default_info.var_name.split(","))
|
||||
var_data_offset[default_info.pcdindex] = offset
|
||||
offset += data_size - len(default_info.var_name.split(","))
|
||||
|
||||
var_header_buffer = VariableMgr.PACK_VARIABLE_HEADER(var_attr_value, len(default_info.var_name.split(",")), len (default_data), vendorguid)
|
||||
if GlobalData.gCommandLineDefines.get(TAB_DSC_DEFINES_VPD_AUTHENTICATED_VARIABLE_STORE,"FALSE").upper() == "TRUE":
|
||||
var_header_buffer = VariableMgr.PACK_AUTHENTICATED_VARIABLE_HEADER(var_attr_value, len(default_info.var_name.split(",")), len (default_data), vendorguid)
|
||||
else:
|
||||
var_header_buffer = VariableMgr.PACK_VARIABLE_HEADER(var_attr_value, len(default_info.var_name.split(",")), len (default_data), vendorguid)
|
||||
NvStoreDataBuffer += (var_header_buffer + DataBuffer)
|
||||
|
||||
variable_storage_header_buffer = VariableMgr.PACK_VARIABLE_STORE_HEADER(len(NvStoreDataBuffer) + 28)
|
||||
if GlobalData.gCommandLineDefines.get(TAB_DSC_DEFINES_VPD_AUTHENTICATED_VARIABLE_STORE,"FALSE").upper() == "TRUE":
|
||||
variable_storage_header_buffer = VariableMgr.PACK_AUTHENTICATED_VARIABLE_STORE_HEADER(len(NvStoreDataBuffer) + 28)
|
||||
else:
|
||||
variable_storage_header_buffer = VariableMgr.PACK_VARIABLE_STORE_HEADER(len(NvStoreDataBuffer) + 28)
|
||||
|
||||
nv_default_part = VariableMgr.AlignData(VariableMgr.PACK_DEFAULT_DATA(0, 0, VariableMgr.unpack_data(variable_storage_header_buffer+NvStoreDataBuffer)), 8)
|
||||
|
||||
@ -252,6 +258,20 @@ class VariableMgr(object):
|
||||
|
||||
return GuidBuffer + SizeBuffer + FormatBuffer + StateBuffer + reservedBuffer
|
||||
|
||||
def PACK_AUTHENTICATED_VARIABLE_STORE_HEADER(size):
|
||||
#Signature: gEfiAuthenticatedVariableGuid
|
||||
Guid = "{ 0xaaf32c78, 0x947b, 0x439a, { 0xa1, 0x80, 0x2e, 0x14, 0x4e, 0xc3, 0x77, 0x92 }}"
|
||||
Guid = GuidStructureStringToGuidString(Guid)
|
||||
GuidBuffer = PackGUID(Guid.split('-'))
|
||||
|
||||
SizeBuffer = pack('=L', size)
|
||||
FormatBuffer = pack('=B', 0x5A)
|
||||
StateBuffer = pack('=B', 0xFE)
|
||||
reservedBuffer = pack('=H', 0)
|
||||
reservedBuffer += pack('=L', 0)
|
||||
|
||||
return GuidBuffer + SizeBuffer + FormatBuffer + StateBuffer + reservedBuffer
|
||||
|
||||
@staticmethod
|
||||
def PACK_NV_STORE_DEFAULT_HEADER(size, maxsize):
|
||||
Signature = pack('=B', ord('N'))
|
||||
@ -279,6 +299,37 @@ class VariableMgr(object):
|
||||
|
||||
return Buffer
|
||||
|
||||
@staticmethod
|
||||
def PACK_AUTHENTICATED_VARIABLE_HEADER(attribute, namesize, datasize, vendorguid):
|
||||
|
||||
Buffer = pack('=H', 0x55AA) # pack StartID
|
||||
Buffer += pack('=B', 0x3F) # pack State
|
||||
Buffer += pack('=B', 0) # pack reserved
|
||||
|
||||
Buffer += pack('=L', attribute)
|
||||
|
||||
Buffer += pack('=Q', 0) # pack MonotonicCount
|
||||
Buffer += pack('=HBBBBBBLhBB', # pack TimeStamp
|
||||
0, # UINT16 Year
|
||||
0, # UINT8 Month
|
||||
0, # UINT8 Day
|
||||
0, # UINT8 Hour
|
||||
0, # UINT8 Minute
|
||||
0, # UINT8 Second
|
||||
0, # UINT8 Pad1
|
||||
0, # UINT32 Nanosecond
|
||||
0, # INT16 TimeZone
|
||||
0, # UINT8 Daylight
|
||||
0) # UINT8 Pad2
|
||||
Buffer += pack('=L', 0) # pack PubKeyIndex
|
||||
|
||||
Buffer += pack('=L', namesize)
|
||||
Buffer += pack('=L', datasize)
|
||||
|
||||
Buffer += PackGUID(vendorguid)
|
||||
|
||||
return Buffer
|
||||
|
||||
@staticmethod
|
||||
def PACK_VARIABLES_DATA(var_value,data_type, tail = None):
|
||||
Buffer = bytearray()
|
||||
|
@ -254,7 +254,6 @@ class ModuleAutoGen(AutoGen):
|
||||
self.AutoGenDepSet = set()
|
||||
self.ReferenceModules = []
|
||||
self.ConstPcd = {}
|
||||
self.Makefile = None
|
||||
self.FileDependCache = {}
|
||||
|
||||
def __init_platform_info__(self):
|
||||
|
@ -406,6 +406,7 @@ TAB_DSC_DEFINES_SKUID_IDENTIFIER = 'SKUID_IDENTIFIER'
|
||||
TAB_DSC_DEFINES_PCD_INFO_GENERATION = 'PCD_INFO_GENERATION'
|
||||
TAB_DSC_DEFINES_PCD_DYNAMIC_AS_DYNAMICEX = 'PCD_DYNAMIC_AS_DYNAMICEX'
|
||||
TAB_DSC_DEFINES_PCD_VAR_CHECK_GENERATION = 'PCD_VAR_CHECK_GENERATION'
|
||||
TAB_DSC_DEFINES_VPD_AUTHENTICATED_VARIABLE_STORE = 'VPD_AUTHENTICATED_VARIABLE_STORE'
|
||||
TAB_DSC_DEFINES_FLASH_DEFINITION = 'FLASH_DEFINITION'
|
||||
TAB_DSC_DEFINES_BUILD_NUMBER = 'BUILD_NUMBER'
|
||||
TAB_DSC_DEFINES_MAKEFILE_NAME = 'MAKEFILE_NAME'
|
||||
|
@ -105,7 +105,7 @@ class Ecc(object):
|
||||
|
||||
def InitDefaultConfigIni(self):
|
||||
paths = map(lambda p: os.path.join(p, 'Ecc', 'config.ini'), sys.path)
|
||||
paths = (os.path.realpath('config.ini'),) + tuple(paths)
|
||||
paths = (os.path.abspath('config.ini'),) + tuple(paths)
|
||||
for path in paths:
|
||||
if os.path.exists(path):
|
||||
self.ConfigFile = path
|
||||
|
@ -707,8 +707,8 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
||||
FileName,
|
||||
'DEBUG'
|
||||
)
|
||||
OutputPath = os.path.realpath(OutputPath)
|
||||
DebugPath = os.path.realpath(DebugPath)
|
||||
OutputPath = os.path.abspath(OutputPath)
|
||||
DebugPath = os.path.abspath(DebugPath)
|
||||
return OutputPath, DebugPath
|
||||
|
||||
## __GenSimpleFileSection__() method
|
||||
|
@ -20,7 +20,7 @@ from linecache import getlines
|
||||
from io import BytesIO
|
||||
|
||||
import Common.LongFilePathOs as os
|
||||
from Common.TargetTxtClassObject import TargetTxtDict
|
||||
from Common.TargetTxtClassObject import TargetTxtDict,gDefaultTargetTxtFile
|
||||
from Common.DataType import *
|
||||
import Common.GlobalData as GlobalData
|
||||
from Common import EdkLogger
|
||||
@ -153,7 +153,7 @@ def GenFdsApi(FdsCommandDict, WorkSpaceDataBase=None):
|
||||
FdfFilename = GenFdsGlobalVariable.ReplaceWorkspaceMacro(FdfFilename)
|
||||
|
||||
if FdfFilename[0:2] == '..':
|
||||
FdfFilename = os.path.realpath(FdfFilename)
|
||||
FdfFilename = os.path.abspath(FdfFilename)
|
||||
if not os.path.isabs(FdfFilename):
|
||||
FdfFilename = mws.join(GenFdsGlobalVariable.WorkSpaceDir, FdfFilename)
|
||||
if not os.path.exists(FdfFilename):
|
||||
@ -175,7 +175,7 @@ def GenFdsApi(FdsCommandDict, WorkSpaceDataBase=None):
|
||||
ActivePlatform = GenFdsGlobalVariable.ReplaceWorkspaceMacro(ActivePlatform)
|
||||
|
||||
if ActivePlatform[0:2] == '..':
|
||||
ActivePlatform = os.path.realpath(ActivePlatform)
|
||||
ActivePlatform = os.path.abspath(ActivePlatform)
|
||||
|
||||
if not os.path.isabs (ActivePlatform):
|
||||
ActivePlatform = mws.join(GenFdsGlobalVariable.WorkSpaceDir, ActivePlatform)
|
||||
@ -207,7 +207,7 @@ def GenFdsApi(FdsCommandDict, WorkSpaceDataBase=None):
|
||||
GenFdsGlobalVariable.ConfDir = ConfDirectoryPath
|
||||
if not GlobalData.gConfDirectory:
|
||||
GlobalData.gConfDirectory = GenFdsGlobalVariable.ConfDir
|
||||
BuildConfigurationFile = os.path.normpath(os.path.join(ConfDirectoryPath, "target.txt"))
|
||||
BuildConfigurationFile = os.path.normpath(os.path.join(ConfDirectoryPath, gDefaultTargetTxtFile))
|
||||
if os.path.isfile(BuildConfigurationFile) == True:
|
||||
# if no build target given in command line, get it from target.txt
|
||||
TargetObj = TargetTxtDict()
|
||||
@ -299,7 +299,7 @@ def GenFdsApi(FdsCommandDict, WorkSpaceDataBase=None):
|
||||
for Key in GenFdsGlobalVariable.OutputDirDict:
|
||||
OutputDir = GenFdsGlobalVariable.OutputDirDict[Key]
|
||||
if OutputDir[0:2] == '..':
|
||||
OutputDir = os.path.realpath(OutputDir)
|
||||
OutputDir = os.path.abspath(OutputDir)
|
||||
|
||||
if OutputDir[1] != ':':
|
||||
OutputDir = os.path.join (GenFdsGlobalVariable.WorkSpaceDir, OutputDir)
|
||||
|
@ -24,7 +24,7 @@ from Common import EdkLogger
|
||||
from Common.Misc import SaveFileOnChange
|
||||
|
||||
from Common.TargetTxtClassObject import TargetTxtDict
|
||||
from Common.ToolDefClassObject import ToolDefDict
|
||||
from Common.ToolDefClassObject import ToolDefDict,gDefaultToolsDefFile
|
||||
from AutoGen.BuildEngine import ToolBuildRule
|
||||
import Common.DataType as DataType
|
||||
from Common.Misc import PathClass,CreateDirectory
|
||||
@ -103,7 +103,7 @@ class GenFdsGlobalVariable:
|
||||
TargetObj = TargetTxtDict()
|
||||
ToolDefinitionFile = TargetObj.Target.TargetTxtDictionary[DataType.TAB_TAT_DEFINES_TOOL_CHAIN_CONF]
|
||||
if ToolDefinitionFile == '':
|
||||
ToolDefinitionFile = "Conf/tools_def.txt"
|
||||
ToolDefinitionFile = os.path.join('Conf', gDefaultToolsDefFile)
|
||||
if os.path.isfile(ToolDefinitionFile):
|
||||
ToolDefObj = ToolDefDict((os.path.join(os.getenv("WORKSPACE"), "Conf")))
|
||||
ToolDefinition = ToolDefObj.ToolDef.ToolsDefTxtDatabase
|
||||
|
@ -17,6 +17,7 @@ import Common.BuildToolError as BuildToolError
|
||||
from Common.DataType import *
|
||||
from Common.BuildVersion import gBUILD_VERSION
|
||||
from Common.LongFilePathSupport import OpenLongFilePath as open
|
||||
from Common.TargetTxtClassObject import gDefaultTargetTxtFile
|
||||
|
||||
# To Do 1.set clean, 2. add item, if the line is disabled.
|
||||
|
||||
@ -25,7 +26,7 @@ class TargetTool():
|
||||
self.WorkSpace = os.path.normpath(os.getenv('WORKSPACE'))
|
||||
self.Opt = opt
|
||||
self.Arg = args[0]
|
||||
self.FileName = os.path.normpath(os.path.join(self.WorkSpace, 'Conf', 'target.txt'))
|
||||
self.FileName = os.path.normpath(os.path.join(self.WorkSpace, 'Conf', gDefaultTargetTxtFile))
|
||||
if os.path.isfile(self.FileName) == False:
|
||||
print("%s does not exist." % self.FileName)
|
||||
sys.exit(1)
|
||||
|
@ -590,7 +590,6 @@ class PackageBuildClassObject(BuildData):
|
||||
# @var OutputDirectory: To store value for OutputDirectory
|
||||
# @var FlashDefinition: To store value for FlashDefinition
|
||||
# @var BuildNumber: To store value for BuildNumber
|
||||
# @var MakefileName: To store value for MakefileName
|
||||
# @var SkuIds: To store value for SkuIds, it is a set structure as
|
||||
# { 'SkuName' : SkuId, '!include' : includefilename, ...}
|
||||
# @var Modules: To store value for Modules, it is a list structure as
|
||||
@ -614,7 +613,6 @@ class PlatformBuildClassObject(BuildData):
|
||||
self.OutputDirectory = ''
|
||||
self.FlashDefinition = ''
|
||||
self.BuildNumber = ''
|
||||
self.MakefileName = ''
|
||||
|
||||
self.SkuIds = {}
|
||||
self.Modules = []
|
||||
|
@ -19,8 +19,8 @@ from Common.Misc import *
|
||||
from types import *
|
||||
from Common.Expression import *
|
||||
from CommonDataClass.CommonClass import SkuInfoClass
|
||||
from Common.TargetTxtClassObject import TargetTxtDict
|
||||
from Common.ToolDefClassObject import ToolDefDict
|
||||
from Common.TargetTxtClassObject import TargetTxtDict,gDefaultTargetTxtFile
|
||||
from Common.ToolDefClassObject import ToolDefDict,gDefaultToolsDefFile
|
||||
from .MetaDataTable import *
|
||||
from .MetaFileTable import *
|
||||
from .MetaFileParser import *
|
||||
@ -387,6 +387,10 @@ class DscBuildData(PlatformBuildClassObject):
|
||||
for i in range(0, len(LanguageCodes), 3):
|
||||
LanguageList.append(LanguageCodes[i:i + 3])
|
||||
self._ISOLanguages = LanguageList
|
||||
elif Name == TAB_DSC_DEFINES_VPD_AUTHENTICATED_VARIABLE_STORE:
|
||||
if TAB_DSC_DEFINES_VPD_AUTHENTICATED_VARIABLE_STORE not in gCommandLineDefines:
|
||||
gCommandLineDefines[TAB_DSC_DEFINES_VPD_AUTHENTICATED_VARIABLE_STORE] = Record[2].strip()
|
||||
|
||||
elif Name == TAB_DSC_DEFINES_VPD_TOOL_GUID:
|
||||
#
|
||||
# try to convert GUID to a real UUID value to see whether the GUID is format
|
||||
@ -3526,12 +3530,11 @@ class DscBuildData(PlatformBuildClassObject):
|
||||
self._ToolChainFamily = TAB_COMPILER_MSFT
|
||||
TargetObj = TargetTxtDict()
|
||||
TargetTxt = TargetObj.Target
|
||||
BuildConfigurationFile = os.path.normpath(os.path.join(GlobalData.gConfDirectory, "target.txt"))
|
||||
BuildConfigurationFile = os.path.normpath(os.path.join(GlobalData.gConfDirectory, gDefaultTargetTxtFile))
|
||||
if os.path.isfile(BuildConfigurationFile) == True:
|
||||
ToolDefinitionFile = TargetTxt.TargetTxtDictionary[DataType.TAB_TAT_DEFINES_TOOL_CHAIN_CONF]
|
||||
if ToolDefinitionFile == '':
|
||||
ToolDefinitionFile = "tools_def.txt"
|
||||
ToolDefinitionFile = os.path.normpath(mws.join(self.WorkspaceDir, 'Conf', ToolDefinitionFile))
|
||||
ToolDefinitionFile = os.path.normpath(mws.join(self.WorkspaceDir, 'Conf', gDefaultToolsDefFile))
|
||||
if os.path.isfile(ToolDefinitionFile) == True:
|
||||
ToolDefObj = ToolDefDict((os.path.join(os.getenv("WORKSPACE"), "Conf")))
|
||||
ToolDefinition = ToolDefObj.ToolDef.ToolsDefTxtDatabase
|
||||
|
@ -4,7 +4,7 @@
|
||||
# Copyright (c) 2014, Hewlett-Packard Development Company, L.P.<BR>
|
||||
# Copyright (c) 2007 - 2021, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2018, Hewlett Packard Enterprise Development, L.P.<BR>
|
||||
# Copyright (c) 2020, ARM Limited. All rights reserved.<BR>
|
||||
# Copyright (c) 2020 - 2021, ARM Limited. All rights reserved.<BR>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
@ -67,10 +67,6 @@ from AutoGen.AutoGen import CalculatePriorityValue
|
||||
## standard targets of build command
|
||||
gSupportedTarget = ['all', 'genc', 'genmake', 'modules', 'libraries', 'fds', 'clean', 'cleanall', 'cleanlib', 'run']
|
||||
|
||||
## build configuration file
|
||||
gBuildConfiguration = "target.txt"
|
||||
gToolsDefinition = "tools_def.txt"
|
||||
|
||||
TemporaryTablePattern = re.compile(r'^_\d+_\d+_[a-fA-F0-9]+$')
|
||||
TmpTableDict = {}
|
||||
|
||||
@ -1308,6 +1304,9 @@ class Build():
|
||||
if Target == 'run':
|
||||
return True
|
||||
|
||||
# Fetch the MakeFileName.
|
||||
self.MakeFileName = AutoGenObject.MakeFileName
|
||||
|
||||
# build modules
|
||||
if BuildModule:
|
||||
BuildCommand = BuildCommand + [Target]
|
||||
@ -2183,8 +2182,6 @@ class Build():
|
||||
Pa.CreateLibModuelDirs()
|
||||
# Fetch the MakeFileName.
|
||||
self.MakeFileName = Pa.MakeFileName
|
||||
if not self.MakeFileName:
|
||||
self.MakeFileName = Pa.MakeFile
|
||||
|
||||
Pa.DataPipe.DataContainer = {"LibraryBuildDirectoryList":Pa.LibraryBuildDirectoryList}
|
||||
Pa.DataPipe.DataContainer = {"ModuleBuildDirectoryList":Pa.ModuleBuildDirectoryList}
|
||||
|
@ -864,15 +864,11 @@ Pkcs7Verify (
|
||||
// For generic PKCS#7 handling, InData may be NULL if the content is present
|
||||
// in PKCS#7 structure. So ignore NULL checking here.
|
||||
//
|
||||
DataBio = BIO_new (BIO_s_mem ());
|
||||
DataBio = BIO_new_mem_buf (InData, (int) DataLength);
|
||||
if (DataBio == NULL) {
|
||||
goto _Exit;
|
||||
}
|
||||
|
||||
if (BIO_write (DataBio, InData, (int) DataLength) <= 0) {
|
||||
goto _Exit;
|
||||
}
|
||||
|
||||
//
|
||||
// Allow partial certificate chains, terminated by a non-self-signed but
|
||||
// still trusted intermediate certificate. Also disable time checks.
|
||||
|
@ -1,7 +1,7 @@
|
||||
## @file
|
||||
# Dsc include file for Dynamic Tables Framework.
|
||||
#
|
||||
# Copyright (c) 2017 - 2020, Arm Limited. All rights reserved.<BR>
|
||||
# Copyright (c) 2017 - 2021, Arm Limited. All rights reserved.<BR>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
@ -13,6 +13,7 @@
|
||||
RELEASE_*_*_CC_FLAGS = -DMDEPKG_NDEBUG
|
||||
|
||||
[LibraryClasses.common]
|
||||
AcpiHelperLib|DynamicTablesPkg/Library/Common/AcpiHelperLib/AcpiHelperLib.inf
|
||||
AmlLib|DynamicTablesPkg/Library/Common/AmlLib/AmlLib.inf
|
||||
SsdtSerialPortFixupLib|DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPortFixupLib.inf
|
||||
TableHelperLib|DynamicTablesPkg/Library/Common/TableHelperLib/TableHelperLib.inf
|
||||
@ -36,6 +37,9 @@
|
||||
DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtSerialPortLibArm/SsdtSerialPortLibArm.inf
|
||||
DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCmn600LibArm/SsdtCmn600LibArm.inf
|
||||
|
||||
# AML Codegen
|
||||
DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyLibArm.inf
|
||||
|
||||
#
|
||||
# Dynamic Table Factory Dxe
|
||||
#
|
||||
@ -55,6 +59,9 @@
|
||||
# AML Fixup
|
||||
NULL|DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtSerialPortLibArm/SsdtSerialPortLibArm.inf
|
||||
NULL|DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCmn600LibArm/SsdtCmn600LibArm.inf
|
||||
|
||||
# AML Codegen
|
||||
NULL|DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyLibArm.inf
|
||||
}
|
||||
|
||||
#
|
||||
|
@ -5,6 +5,28 @@
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
##
|
||||
{
|
||||
"EccCheck": {
|
||||
## Exception sample looks like below:
|
||||
## "ExceptionList": [
|
||||
## "<ErrorID>", "<KeyWord>"
|
||||
## ]
|
||||
"ExceptionList": [
|
||||
# "The #ifndef at the start of an include file should use
|
||||
# both prefix and postfix underscore characters, '_'"
|
||||
# This error is not triggered for the latest BaseTools code.
|
||||
# @TODO The error should be re-enabled when the python packages
|
||||
# containing the BaseTools are updated to the latest version.
|
||||
"8003", "DISABLE_NEW_DEPRECATED_INTERFACES",
|
||||
"9005", "@defgroup", # Use extra Doxygen commands
|
||||
"9005", "@ingroup", # Use extra Doxygen commands
|
||||
"9005", "@mainpage", # Use extra Doxygen commands
|
||||
"9005", "@ref", # Use extra Doxygen commands
|
||||
],
|
||||
## Both file path and directory path are accepted.
|
||||
"IgnoreFiles": [
|
||||
]
|
||||
},
|
||||
|
||||
## options defined .pytool/Plugin/CompilerPlugin
|
||||
"CompilerPlugin": {
|
||||
"DscPath": "DynamicTablesPkg.dsc"
|
||||
@ -23,6 +45,7 @@
|
||||
## options defined .pytool/Plugin/DependencyCheck
|
||||
"DependencyCheck": {
|
||||
"AcceptableDependencies": [
|
||||
"ArmPkg/ArmPkg.dec",
|
||||
"ArmPlatformPkg/ArmPlatformPkg.dec",
|
||||
"EmbeddedPkg/EmbeddedPkg.dec",
|
||||
"DynamicTablesPkg/DynamicTablesPkg.dec",
|
||||
@ -77,19 +100,25 @@
|
||||
"CCIDX",
|
||||
"CCSIDR",
|
||||
"countof",
|
||||
"edynamic",
|
||||
"EOBJECT",
|
||||
"invoc",
|
||||
"ITARGETSR",
|
||||
"GTBLOCK",
|
||||
"lgreater",
|
||||
"lless",
|
||||
"MPIDR",
|
||||
"PERIPHBASE",
|
||||
"phandle",
|
||||
"pytool",
|
||||
"Rdword",
|
||||
"Roadmap",
|
||||
"ROOTNODEBASE",
|
||||
"ssdtcmn",
|
||||
"ssdtserialporttemplate",
|
||||
"SMMUV",
|
||||
"ssdtpcieosctemplate",
|
||||
"SSDTPC",
|
||||
"standardised",
|
||||
"TABLEEX",
|
||||
"TNSID",
|
||||
|
@ -17,6 +17,10 @@
|
||||
Include
|
||||
|
||||
[LibraryClasses]
|
||||
## @libraryclass Defines a set of Acpi helper methods
|
||||
# independent from the Dynamic Tables Framework.
|
||||
AcpiHelperLib|Include/Library/AcpiHelperLib.h
|
||||
|
||||
## @libraryclass Defines a set of APIs for Dynamic AML generation.
|
||||
AmlLib|Include/Library/AmlLib/AmlLib.h
|
||||
|
||||
|
@ -35,9 +35,11 @@
|
||||
|
||||
[LibraryClasses.ARM, LibraryClasses.AARCH64]
|
||||
NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
|
||||
NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
|
||||
PL011UartLib|ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.inf
|
||||
|
||||
[Components.common]
|
||||
DynamicTablesPkg/Library/Common/AcpiHelperLib/AcpiHelperLib.inf
|
||||
DynamicTablesPkg/Library/Common/AmlLib/AmlLib.inf
|
||||
DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPortFixupLib.inf
|
||||
DynamicTablesPkg/Library/Common/TableHelperLib/TableHelperLib.inf
|
||||
@ -50,4 +52,3 @@
|
||||
# Inhibit C6305: Potential mismatch between sizeof and countof quantities.
|
||||
*_VS2017_*_CC_FLAGS = /wd6305 /analyze
|
||||
!endif
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2017 - 2020, Arm Limited. All rights reserved.<BR>
|
||||
Copyright (c) 2017 - 2021, Arm Limited. All rights reserved.<BR>
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
@ -63,6 +63,10 @@ The Dynamic Tables Framework implements the following ACPI table generators:
|
||||
The SSDT CMN-600 generator collates the CMN-600 information
|
||||
from the Configuration Manager and patches the SSDT CMN-600
|
||||
template to build the SSDT CMN-600 table.
|
||||
- SSDT Cpu-Topology:
|
||||
The SSDT Cpu-Topology generator collates the cpu and LPI
|
||||
information from the Configuration Manager and generates a
|
||||
SSDT table describing the CPU hierarchy.
|
||||
*/
|
||||
|
||||
/** The ACPI_TABLE_GENERATOR_ID type describes ACPI table generator ID.
|
||||
@ -88,6 +92,7 @@ typedef enum StdAcpiTableId {
|
||||
EStdAcpiTableIdSrat, ///< SRAT Generator
|
||||
EStdAcpiTableIdSsdtSerialPort, ///< SSDT Serial-Port Generator
|
||||
EStdAcpiTableIdSsdtCmn600, ///< SSDT Cmn-600 Generator
|
||||
EStdAcpiTableIdSsdtCpuTopology, ///< SSDT Cpu Topology
|
||||
EStdAcpiTableIdMax
|
||||
} ESTD_ACPI_TABLE_ID;
|
||||
|
||||
|
@ -58,6 +58,7 @@ typedef enum ArmObjectID {
|
||||
EArmObjGenericInitiatorAffinityInfo, ///< 34 - Generic Initiator Affinity
|
||||
EArmObjSerialPortInfo, ///< 35 - Generic Serial Port Info
|
||||
EArmObjCmn600Info, ///< 36 - CMN-600 Info
|
||||
EArmObjLpiInfo, ///< 37 - Lpi Info
|
||||
EArmObjMax
|
||||
} EARM_OBJECT_ID;
|
||||
|
||||
@ -395,21 +396,21 @@ typedef struct CmArmGTBlockInfo {
|
||||
} CM_ARM_GTBLOCK_INFO;
|
||||
|
||||
/** A structure that describes the
|
||||
SBSA Generic Watchdog information for the Platform.
|
||||
Arm Generic Watchdog information for the Platform.
|
||||
|
||||
ID: EArmObjPlatformGenericWatchdogInfo
|
||||
*/
|
||||
typedef struct CmArmGenericWatchdogInfo {
|
||||
/// The physical base address of the SBSA Watchdog control frame
|
||||
/// The physical base address of the Arm Watchdog control frame
|
||||
UINT64 ControlFrameAddress;
|
||||
|
||||
/// The physical base address of the SBSA Watchdog refresh frame
|
||||
/// The physical base address of the Arm Watchdog refresh frame
|
||||
UINT64 RefreshFrameAddress;
|
||||
|
||||
/// The watchdog interrupt
|
||||
UINT32 TimerGSIV;
|
||||
|
||||
/** The flags for the watchdog as described by the SBSA watchdog
|
||||
/** The flags for the watchdog as described by the Arm watchdog
|
||||
structure in the ACPI specification.
|
||||
*/
|
||||
UINT32 Flags;
|
||||
@ -711,6 +712,10 @@ typedef struct CmArmProcHierarchyInfo {
|
||||
/// the NoOfPrivateResources is 0, in which case it is recommended to set
|
||||
/// this field to CM_NULL_TOKEN.
|
||||
CM_OBJECT_TOKEN PrivateResourcesArrayToken;
|
||||
/// Optional field: Reference Token for the Lpi state of this processor.
|
||||
/// Token identifying a CM_ARM_OBJ_REF structure, itself referencing
|
||||
/// CM_ARM_LPI_INFO objects.
|
||||
CM_OBJECT_TOKEN LpiToken;
|
||||
} CM_ARM_PROC_HIERARCHY_INFO;
|
||||
|
||||
/** A structure that describes the Cache Type Structure (Type 1) in PPTT
|
||||
@ -878,6 +883,69 @@ typedef struct CmArmCmn600Info {
|
||||
CM_ARM_EXTENDED_INTERRUPT DtcInterrupt[4];
|
||||
} CM_ARM_CMN_600_INFO;
|
||||
|
||||
/** A structure that describes the Lpi information.
|
||||
|
||||
The Low Power Idle states are described in DSDT/SSDT and associated
|
||||
to cpus/clusters in the cpu topology.
|
||||
|
||||
ID: EArmObjLpiInfo
|
||||
*/
|
||||
typedef struct CmArmLpiInfo {
|
||||
/** Minimum Residency. Time in microseconds after which a
|
||||
state becomes more energy efficient than any shallower state.
|
||||
*/
|
||||
UINT32 MinResidency;
|
||||
|
||||
/** Worst case time in microseconds from a wake interrupt
|
||||
being asserted to the return to a running state
|
||||
*/
|
||||
UINT32 WorstCaseWakeLatency;
|
||||
|
||||
/** Flags.
|
||||
*/
|
||||
UINT32 Flags;
|
||||
|
||||
/** Architecture specific context loss flags.
|
||||
*/
|
||||
UINT32 ArchFlags;
|
||||
|
||||
/** Residency counter frequency in cycles-per-second (Hz).
|
||||
*/
|
||||
UINT32 ResCntFreq;
|
||||
|
||||
/** Every shallower power state in the parent is also enabled.
|
||||
*/
|
||||
UINT32 EnableParentState;
|
||||
|
||||
/** The EntryMethod _LPI field can be described as an integer
|
||||
or in a Register resource data descriptor.
|
||||
|
||||
If IsInteger is TRUE, the IntegerEntryMethod field is used.
|
||||
If IsInteger is FALSE, the RegisterEntryMethod field is used.
|
||||
*/
|
||||
BOOLEAN IsInteger;
|
||||
|
||||
/** EntryMethod described as an Integer.
|
||||
*/
|
||||
UINT64 IntegerEntryMethod;
|
||||
|
||||
/** EntryMethod described as a EFI_ACPI_GENERIC_REGISTER_DESCRIPTOR.
|
||||
*/
|
||||
EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE RegisterEntryMethod;
|
||||
|
||||
/** Residency counter register.
|
||||
*/
|
||||
EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE ResidencyCounterRegister;
|
||||
|
||||
/** Usage counter register.
|
||||
*/
|
||||
EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE UsageCounterRegister;
|
||||
|
||||
/** String representing the Lpi state
|
||||
*/
|
||||
CHAR8 StateName[16];
|
||||
} CM_ARM_LPI_INFO;
|
||||
|
||||
#pragma pack()
|
||||
|
||||
#endif // ARM_NAMESPACE_OBJECTS_H_
|
||||
|
93
DynamicTablesPkg/Include/Library/AcpiHelperLib.h
Normal file
93
DynamicTablesPkg/Include/Library/AcpiHelperLib.h
Normal file
@ -0,0 +1,93 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2017 - 2021, Arm Limited. All rights reserved.<BR>
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
**/
|
||||
|
||||
#ifndef ACPI_HELPER_LIB_H_
|
||||
#define ACPI_HELPER_LIB_H_
|
||||
|
||||
/** Is a character upper case
|
||||
*/
|
||||
#define IS_UPPER_CHAR(x) ((x >= 'A') && (x <= 'Z'))
|
||||
|
||||
/** Is a character a decimal digit
|
||||
*/
|
||||
#define IS_DIGIT(x) ((x >= '0') && (x <= '9'))
|
||||
|
||||
/** Is a character an upper case hexadecimal digit
|
||||
*/
|
||||
#define IS_UPPER_HEX(x) (((x >= 'A') && (x <= 'F')) || IS_DIGIT (x))
|
||||
|
||||
/** Convert a hex number to its ASCII code.
|
||||
|
||||
@param [in] Hex Hex number to convert.
|
||||
Must be 0 <= x < 16.
|
||||
|
||||
@return The ASCII code corresponding to x.
|
||||
-1 if error.
|
||||
**/
|
||||
UINT8
|
||||
EFIAPI
|
||||
AsciiFromHex (
|
||||
IN UINT8 Hex
|
||||
);
|
||||
|
||||
/** Convert an ASCII char representing an hexadecimal number
|
||||
to its integer value.
|
||||
|
||||
@param [in] Char Char to convert.
|
||||
Must be between '0'-'9' or 'A'-'F' or 'a'-'f'.
|
||||
|
||||
@return The corresponding integer (between 0-16).
|
||||
-1 if error.
|
||||
**/
|
||||
UINT8
|
||||
EFIAPI
|
||||
HexFromAscii (
|
||||
IN CHAR8 Char
|
||||
);
|
||||
|
||||
/** Check if a HID is a valid PNP ID.
|
||||
|
||||
@param [in] Hid The Hid to validate.
|
||||
|
||||
@retval TRUE The Hid is a valid PNP ID.
|
||||
@retval FALSE The Hid is not a valid PNP ID.
|
||||
**/
|
||||
BOOLEAN
|
||||
IsValidPnpId (
|
||||
IN CONST CHAR8 * Hid
|
||||
);
|
||||
|
||||
/** Check if a HID is a valid ACPI ID.
|
||||
|
||||
@param [in] Hid The Hid to validate.
|
||||
|
||||
@retval TRUE The Hid is a valid ACPI ID.
|
||||
@retval FALSE The Hid is not a valid ACPI ID.
|
||||
**/
|
||||
BOOLEAN
|
||||
IsValidAcpiId (
|
||||
IN CONST CHAR8 * Hid
|
||||
);
|
||||
|
||||
/** Convert a EisaId string to its compressed UINT32 equivalent.
|
||||
|
||||
Cf. ACPI 6.4 specification, s19.3.4 "ASL Macros": "Eisaid"
|
||||
|
||||
@param [in] EisaIdStr Input EisaId string.
|
||||
@param [out] EisaIdInt Output EisaId UINT32 (compressed).
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlGetEisaIdFromString (
|
||||
IN CONST CHAR8 * EisaIdStr,
|
||||
OUT UINT32 * EisaIdInt
|
||||
);
|
||||
|
||||
#endif // ACPI_HELPER_LIB_H_
|
@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
AML Lib.
|
||||
|
||||
Copyright (c) 2019 - 2020, Arm Limited. All rights reserved.<BR>
|
||||
Copyright (c) 2019 - 2021, Arm Limited. All rights reserved.<BR>
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
**/
|
||||
@ -301,7 +301,7 @@ AmlNameOpUpdateString (
|
||||
IN CONST CHAR8 * NewName
|
||||
);
|
||||
|
||||
/** Get the first Resource Data element contained in a "_CRS" object.
|
||||
/** Get the first Resource Data element contained in a named object.
|
||||
|
||||
In the following ASL code, the function will return the Resource Data
|
||||
node corresponding to the "QWordMemory ()" ASL macro.
|
||||
@ -312,27 +312,26 @@ AmlNameOpUpdateString (
|
||||
)
|
||||
|
||||
Note:
|
||||
- The "_CRS" object must be declared using ASL "Name (Declare Named Object)".
|
||||
- "_CRS" declared using ASL "Method (Declare Control Method)" is not
|
||||
supported.
|
||||
"_CRS" names defined as methods are not handled by this function.
|
||||
They must be defined as names, using the "Name ()" statement.
|
||||
|
||||
@ingroup UserApis
|
||||
|
||||
@param [in] NameOpCrsNode NameOp object node defining a "_CRS" object.
|
||||
Must have an OpCode=AML_NAME_OP, SubOpCode=0.
|
||||
NameOp object nodes are defined in ASL
|
||||
using the "Name ()" function.
|
||||
@param [out] OutRdNode Pointer to the first Resource Data element of
|
||||
the "_CRS" object. A Resource Data element
|
||||
is stored in a data node.
|
||||
@param [in] NameOpNode NameOp object node defining a named object.
|
||||
Must have an OpCode=AML_NAME_OP, SubOpCode=0.
|
||||
NameOp object nodes are defined in ASL
|
||||
using the "Name ()" function.
|
||||
@param [out] OutRdNode Pointer to the first Resource Data element of
|
||||
the named object. A Resource Data element
|
||||
is stored in a data node.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlNameOpCrsGetFirstRdNode (
|
||||
IN AML_OBJECT_NODE_HANDLE NameOpCrsNode,
|
||||
AmlNameOpGetFirstRdNode (
|
||||
IN AML_OBJECT_NODE_HANDLE NameOpNode,
|
||||
OUT AML_DATA_NODE_HANDLE * OutRdNode
|
||||
);
|
||||
|
||||
@ -347,13 +346,14 @@ AmlNameOpCrsGetFirstRdNode (
|
||||
}
|
||||
)
|
||||
|
||||
The CurrRdNode Resource Data node must be defined in an object named "_CRS"
|
||||
and defined by a "Name ()" ASL function.
|
||||
Note:
|
||||
"_CRS" names defined as methods are not handled by this function.
|
||||
They must be defined as names, using the "Name ()" statement.
|
||||
|
||||
@ingroup UserApis
|
||||
|
||||
@param [in] CurrRdNode Pointer to the current Resource Data element of
|
||||
the "_CRS" variable.
|
||||
the named object.
|
||||
@param [out] OutRdNode Pointer to the Resource Data element following
|
||||
the CurrRdNode.
|
||||
Contain a NULL pointer if CurrRdNode is the
|
||||
@ -366,7 +366,7 @@ AmlNameOpCrsGetFirstRdNode (
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlNameOpCrsGetNextRdNode (
|
||||
AmlNameOpGetNextRdNode (
|
||||
IN AML_DATA_NODE_HANDLE CurrRdNode,
|
||||
OUT AML_DATA_NODE_HANDLE * OutRdNode
|
||||
);
|
||||
@ -418,36 +418,21 @@ AmlUpdateRdQWord (
|
||||
IN UINT64 BaseAddressLength
|
||||
);
|
||||
|
||||
/** Add an Interrupt Resource Data node.
|
||||
|
||||
This function creates a Resource Data element corresponding to the
|
||||
"Interrupt ()" ASL function, stores it in an AML Data Node.
|
||||
|
||||
It then adds it after the input CurrRdNode in the list of resource data
|
||||
element.
|
||||
/** Code generation for the "Interrupt ()" ASL function.
|
||||
|
||||
The Resource Data effectively created is an Extended Interrupt Resource
|
||||
Data. See ACPI 6.3 specification, s6.4.3.6 "Extended Interrupt Descriptor"
|
||||
for more information about Extended Interrupt Resource Data.
|
||||
Data. Cf ACPI 6.4:
|
||||
- s6.4.3.6 "Extended Interrupt Descriptor"
|
||||
- s19.6.64 "Interrupt (Interrupt Resource Descriptor Macro)"
|
||||
|
||||
The Extended Interrupt contains one single interrupt.
|
||||
The created resource data node can be:
|
||||
- appended to the list of resource data elements of the NameOpNode.
|
||||
In such case NameOpNode must be defined by a the "Name ()" ASL statement
|
||||
and initially contain a "ResourceTemplate ()".
|
||||
- returned through the NewRdNode parameter.
|
||||
|
||||
This function allocates memory to create a data node. It is the caller's
|
||||
responsibility to either:
|
||||
- attach this node to an AML tree;
|
||||
- delete this node.
|
||||
@ingroup CodeGenApis
|
||||
|
||||
Note: The _CRS node must be defined using the ASL Name () function.
|
||||
e.g. Name (_CRS, ResourceTemplate () {
|
||||
...
|
||||
}
|
||||
|
||||
@ingroup UserApis
|
||||
|
||||
@param [in] NameOpCrsNode NameOp object node defining a "_CRS" object.
|
||||
Must have an OpCode=AML_NAME_OP, SubOpCode=0.
|
||||
NameOp object nodes are defined in ASL
|
||||
using the "Name ()" function.
|
||||
@param [in] ResourceConsumer The device consumes the specified interrupt
|
||||
or produces it for use by a child device.
|
||||
@param [in] EdgeTriggered The interrupt is edge triggered or
|
||||
@ -457,7 +442,12 @@ AmlUpdateRdQWord (
|
||||
devices or not (Exclusive).
|
||||
@param [in] IrqList Interrupt list. Must be non-NULL.
|
||||
@param [in] IrqCount Interrupt count. Must be non-zero.
|
||||
|
||||
@param [in] NameOpNode NameOp object node defining a named object.
|
||||
If provided, append the new resource data node
|
||||
to the list of resource data elements of this
|
||||
node.
|
||||
@param [out] NewRdNode If provided and success,
|
||||
contain the created node.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
@ -465,14 +455,15 @@ AmlUpdateRdQWord (
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlCodeGenCrsAddRdInterrupt (
|
||||
IN AML_OBJECT_NODE_HANDLE NameOpCrsNode,
|
||||
AmlCodeGenRdInterrupt (
|
||||
IN BOOLEAN ResourceConsumer,
|
||||
IN BOOLEAN EdgeTriggered,
|
||||
IN BOOLEAN ActiveLow,
|
||||
IN BOOLEAN Shared,
|
||||
IN UINT32 * IrqList,
|
||||
IN UINT8 IrqCount
|
||||
IN UINT32 *IrqList,
|
||||
IN UINT8 IrqCount,
|
||||
IN AML_OBJECT_NODE_HANDLE NameOpNode, OPTIONAL
|
||||
OUT AML_DATA_NODE_HANDLE *NewRdNode OPTIONAL
|
||||
);
|
||||
|
||||
/** AML code generation for DefinitionBlock.
|
||||
@ -628,4 +619,310 @@ AmlCodeGenScope (
|
||||
OUT AML_OBJECT_NODE_HANDLE * NewObjectNode OPTIONAL
|
||||
);
|
||||
|
||||
/** AML code generation for a method returning a NameString.
|
||||
|
||||
AmlCodeGenMethodRetNameString (
|
||||
"MET0", "_CRS", 1, TRUE, 3, ParentNode, NewObjectNode
|
||||
);
|
||||
is equivalent of the following ASL code:
|
||||
Method(MET0, 1, Serialized, 3) {
|
||||
Return (_CRS)
|
||||
}
|
||||
|
||||
The ASL parameters "ReturnType" and "ParameterTypes" are not asked
|
||||
in this function. They are optional parameters in ASL.
|
||||
|
||||
@ingroup CodeGenApis
|
||||
|
||||
@param [in] MethodNameString The new Method's name.
|
||||
Must be a NULL-terminated ASL NameString
|
||||
e.g.: "MET0", "_SB.MET0", etc.
|
||||
The input string is copied.
|
||||
@param [in] ReturnedNameString The name of the object returned by the
|
||||
method. Optional parameter, can be:
|
||||
- NULL (ignored).
|
||||
- A NULL-terminated ASL NameString.
|
||||
e.g.: "MET0", "_SB.MET0", etc.
|
||||
The input string is copied.
|
||||
@param [in] NumArgs Number of arguments.
|
||||
Must be 0 <= NumArgs <= 6.
|
||||
@param [in] IsSerialized TRUE is equivalent to Serialized.
|
||||
FALSE is equivalent to NotSerialized.
|
||||
Default is NotSerialized in ASL spec.
|
||||
@param [in] SyncLevel Synchronization level for the method.
|
||||
Must be 0 <= SyncLevel <= 15.
|
||||
Default is 0 in ASL.
|
||||
@param [in] ParentNode If provided, set ParentNode as the parent
|
||||
of the node created.
|
||||
@param [out] NewObjectNode If success, contains the created node.
|
||||
|
||||
@retval EFI_SUCCESS Success.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
@retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlCodeGenMethodRetNameString (
|
||||
IN CONST CHAR8 * MethodNameString,
|
||||
IN CONST CHAR8 * ReturnedNameString, OPTIONAL
|
||||
IN UINT8 NumArgs,
|
||||
IN BOOLEAN IsSerialized,
|
||||
IN UINT8 SyncLevel,
|
||||
IN AML_NODE_HANDLE ParentNode, OPTIONAL
|
||||
OUT AML_OBJECT_NODE_HANDLE * NewObjectNode OPTIONAL
|
||||
);
|
||||
|
||||
/** Create a _LPI name.
|
||||
|
||||
AmlCreateLpiNode ("_LPI", 0, 1, ParentNode, &LpiNode) is
|
||||
equivalent of the following ASL code:
|
||||
Name (_LPI, Package (
|
||||
0, // Revision
|
||||
1, // LevelId
|
||||
0 // Count
|
||||
))
|
||||
|
||||
This function doesn't define any LPI state. As shown above, the count
|
||||
of _LPI state is set to 0.
|
||||
The AmlAddLpiState () function must be used to add LPI states.
|
||||
|
||||
Cf ACPI 6.3 specification, s8.4.4 "Lower Power Idle States".
|
||||
|
||||
@ingroup CodeGenApis
|
||||
|
||||
@param [in] LpiNameString The new LPI 's object name.
|
||||
Must be a NULL-terminated ASL NameString
|
||||
e.g.: "_LPI", "DEV0.PLPI", etc.
|
||||
The input string is copied.
|
||||
@param [in] Revision Revision number of the _LPI states.
|
||||
@param [in] LevelId A platform defined number that identifies the
|
||||
level of hierarchy of the processor node to
|
||||
which the LPI states apply.
|
||||
@param [in] ParentNode If provided, set ParentNode as the parent
|
||||
of the node created.
|
||||
@param [out] NewLpiNode If success, contains the created node.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
@retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlCreateLpiNode (
|
||||
IN CONST CHAR8 * LpiNameString,
|
||||
IN UINT16 Revision,
|
||||
IN UINT64 LevelId,
|
||||
IN AML_NODE_HANDLE ParentNode, OPTIONAL
|
||||
OUT AML_OBJECT_NODE_HANDLE * NewLpiNode OPTIONAL
|
||||
);
|
||||
|
||||
/** Add an _LPI state to a LPI node created using AmlCreateLpiNode ().
|
||||
|
||||
AmlAddLpiState () increments the Count of LPI states in the LPI node by one,
|
||||
and adds the following package:
|
||||
Package() {
|
||||
MinResidency,
|
||||
WorstCaseWakeLatency,
|
||||
Flags,
|
||||
ArchFlags,
|
||||
ResCntFreq,
|
||||
EnableParentState,
|
||||
(GenericRegisterDescriptor != NULL) ? // Entry method. If a
|
||||
ResourceTemplate(GenericRegisterDescriptor) : // Register is given,
|
||||
Integer, // use it. Use the
|
||||
// Integer otherwise.
|
||||
ResourceTemplate() { // NULL Residency Counter
|
||||
Register (SystemMemory, 0, 0, 0, 0)
|
||||
},
|
||||
ResourceTemplate() { // NULL Usage Counter
|
||||
Register (SystemMemory, 0, 0, 0, 0)
|
||||
},
|
||||
"" // NULL State Name
|
||||
},
|
||||
|
||||
Cf ACPI 6.3 specification, s8.4.4 "Lower Power Idle States".
|
||||
|
||||
@ingroup CodeGenApis
|
||||
|
||||
@param [in] MinResidency Minimum Residency.
|
||||
@param [in] WorstCaseWakeLatency Worst case wake-up latency.
|
||||
@param [in] Flags Flags.
|
||||
@param [in] ArchFlags Architectural flags.
|
||||
@param [in] ResCntFreq Residency Counter Frequency.
|
||||
@param [in] EnableParentState Enabled Parent State.
|
||||
@param [in] GenericRegisterDescriptor Entry Method.
|
||||
If not NULL, use this Register to
|
||||
describe the entry method address.
|
||||
@param [in] Integer Entry Method.
|
||||
If GenericRegisterDescriptor is NULL,
|
||||
take this value.
|
||||
@param [in] ResidencyCounterRegister If not NULL, use it to populate the
|
||||
residency counter register.
|
||||
@param [in] UsageCounterRegister If not NULL, use it to populate the
|
||||
usage counter register.
|
||||
@param [in] StateName If not NULL, use it to populate the
|
||||
state name.
|
||||
@param [in] LpiNode Lpi node created with the function
|
||||
AmlCreateLpiNode to which the new LPI
|
||||
state is appended.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
@retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlAddLpiState (
|
||||
IN UINT32 MinResidency,
|
||||
IN UINT32 WorstCaseWakeLatency,
|
||||
IN UINT32 Flags,
|
||||
IN UINT32 ArchFlags,
|
||||
IN UINT32 ResCntFreq,
|
||||
IN UINT32 EnableParentState,
|
||||
IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE * GenericRegisterDescriptor, OPTIONAL
|
||||
IN UINT64 Integer, OPTIONAL
|
||||
IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE * ResidencyCounterRegister, OPTIONAL
|
||||
IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE * UsageCounterRegister, OPTIONAL
|
||||
IN CHAR8 * StateName, OPTIONAL
|
||||
IN AML_OBJECT_NODE_HANDLE LpiNode
|
||||
);
|
||||
|
||||
// DEPRECATED APIS
|
||||
#ifndef DISABLE_NEW_DEPRECATED_INTERFACES
|
||||
|
||||
/** DEPRECATED API
|
||||
|
||||
Get the first Resource Data element contained in a "_CRS" object.
|
||||
|
||||
In the following ASL code, the function will return the Resource Data
|
||||
node corresponding to the "QWordMemory ()" ASL macro.
|
||||
Name (_CRS, ResourceTemplate() {
|
||||
QWordMemory (...) {...},
|
||||
Interrupt (...) {...}
|
||||
}
|
||||
)
|
||||
|
||||
Note:
|
||||
- The "_CRS" object must be declared using ASL "Name (Declare Named Object)".
|
||||
- "_CRS" declared using ASL "Method (Declare Control Method)" is not
|
||||
supported.
|
||||
|
||||
@ingroup UserApis
|
||||
|
||||
@param [in] NameOpCrsNode NameOp object node defining a "_CRS" object.
|
||||
Must have an OpCode=AML_NAME_OP, SubOpCode=0.
|
||||
NameOp object nodes are defined in ASL
|
||||
using the "Name ()" function.
|
||||
@param [out] OutRdNode Pointer to the first Resource Data element of
|
||||
the "_CRS" object. A Resource Data element
|
||||
is stored in a data node.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlNameOpCrsGetFirstRdNode (
|
||||
IN AML_OBJECT_NODE_HANDLE NameOpCrsNode,
|
||||
OUT AML_DATA_NODE_HANDLE * OutRdNode
|
||||
);
|
||||
|
||||
/** DEPRECATED API
|
||||
|
||||
Get the Resource Data element following the CurrRdNode Resource Data.
|
||||
|
||||
In the following ASL code, if CurrRdNode corresponds to the first
|
||||
"QWordMemory ()" ASL macro, the function will return the Resource Data
|
||||
node corresponding to the "Interrupt ()" ASL macro.
|
||||
Name (_CRS, ResourceTemplate() {
|
||||
QwordMemory (...) {...},
|
||||
Interrupt (...) {...}
|
||||
}
|
||||
)
|
||||
|
||||
The CurrRdNode Resource Data node must be defined in an object named "_CRS"
|
||||
and defined by a "Name ()" ASL function.
|
||||
|
||||
@ingroup UserApis
|
||||
|
||||
@param [in] CurrRdNode Pointer to the current Resource Data element of
|
||||
the "_CRS" variable.
|
||||
@param [out] OutRdNode Pointer to the Resource Data element following
|
||||
the CurrRdNode.
|
||||
Contain a NULL pointer if CurrRdNode is the
|
||||
last Resource Data element in the list.
|
||||
The "End Tag" is not considered as a resource
|
||||
data element and is not returned.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlNameOpCrsGetNextRdNode (
|
||||
IN AML_DATA_NODE_HANDLE CurrRdNode,
|
||||
OUT AML_DATA_NODE_HANDLE * OutRdNode
|
||||
);
|
||||
|
||||
/** DEPRECATED API
|
||||
|
||||
Add an Interrupt Resource Data node.
|
||||
|
||||
This function creates a Resource Data element corresponding to the
|
||||
"Interrupt ()" ASL function, stores it in an AML Data Node.
|
||||
|
||||
It then adds it after the input CurrRdNode in the list of resource data
|
||||
element.
|
||||
|
||||
The Resource Data effectively created is an Extended Interrupt Resource
|
||||
Data. See ACPI 6.3 specification, s6.4.3.6 "Extended Interrupt Descriptor"
|
||||
for more information about Extended Interrupt Resource Data.
|
||||
|
||||
The Extended Interrupt contains one single interrupt.
|
||||
|
||||
This function allocates memory to create a data node. It is the caller's
|
||||
responsibility to either:
|
||||
- attach this node to an AML tree;
|
||||
- delete this node.
|
||||
|
||||
Note: The _CRS node must be defined using the ASL Name () function.
|
||||
e.g. Name (_CRS, ResourceTemplate () {
|
||||
...
|
||||
}
|
||||
|
||||
@ingroup CodeGenApis
|
||||
|
||||
@param [in] NameOpCrsNode NameOp object node defining a "_CRS" object.
|
||||
Must have an OpCode=AML_NAME_OP, SubOpCode=0.
|
||||
NameOp object nodes are defined in ASL
|
||||
using the "Name ()" function.
|
||||
@param [in] ResourceConsumer The device consumes the specified interrupt
|
||||
or produces it for use by a child device.
|
||||
@param [in] EdgeTriggered The interrupt is edge triggered or
|
||||
level triggered.
|
||||
@param [in] ActiveLow The interrupt is active-high or active-low.
|
||||
@param [in] Shared The interrupt can be shared with other
|
||||
devices or not (Exclusive).
|
||||
@param [in] IrqList Interrupt list. Must be non-NULL.
|
||||
@param [in] IrqCount Interrupt count. Must be non-zero.
|
||||
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
@retval EFI_OUT_OF_RESOURCES Could not allocate memory.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlCodeGenCrsAddRdInterrupt (
|
||||
IN AML_OBJECT_NODE_HANDLE NameOpCrsNode,
|
||||
IN BOOLEAN ResourceConsumer,
|
||||
IN BOOLEAN EdgeTriggered,
|
||||
IN BOOLEAN ActiveLow,
|
||||
IN BOOLEAN Shared,
|
||||
IN UINT32 * IrqList,
|
||||
IN UINT8 IrqCount
|
||||
);
|
||||
|
||||
#endif // DISABLE_NEW_DEPRECATED_INTERFACES
|
||||
|
||||
#endif // AML_LIB_H_
|
||||
|
@ -12,17 +12,7 @@
|
||||
#ifndef TABLE_HELPER_LIB_H_
|
||||
#define TABLE_HELPER_LIB_H_
|
||||
|
||||
/** Is a character upper case
|
||||
*/
|
||||
#define IS_UPPER_CHAR(x) ((x >= 'A') && (x <= 'Z'))
|
||||
|
||||
/** Is a character a decimal digit
|
||||
*/
|
||||
#define IS_DIGIT(x) ((x >= '0') && (x <= '9'))
|
||||
|
||||
/** Is a character an upper case hexadecimal digit
|
||||
*/
|
||||
#define IS_UPPER_HEX(x) (((x >= 'A') && (x <= 'F')) || IS_DIGIT (x))
|
||||
#include <Library/AmlLib/AmlLib.h>
|
||||
|
||||
/** The GetCgfMgrInfo function gets the CM_STD_OBJ_CONFIGURATION_MANAGER_INFO
|
||||
object from the Configuration Manager.
|
||||
@ -74,6 +64,39 @@ AddAcpiHeader (
|
||||
IN CONST UINT32 Length
|
||||
);
|
||||
|
||||
/** Build a RootNode containing SSDT ACPI header information using the AmlLib.
|
||||
|
||||
The function utilizes the ACPI table Generator and the Configuration
|
||||
Manager protocol to obtain any information required for constructing the
|
||||
header. It then creates a RootNode. The SSDT ACPI header is part of the
|
||||
RootNode.
|
||||
|
||||
This is essentially a wrapper around AmlCodeGenDefinitionBlock ()
|
||||
from the AmlLib.
|
||||
|
||||
@param [in] CfgMgrProtocol Pointer to the Configuration Manager
|
||||
protocol interface.
|
||||
@param [in] Generator Pointer to the ACPI table Generator.
|
||||
@param [in] AcpiTableInfo Pointer to the ACPI table info structure.
|
||||
@param [out] RootNode If success, contains the created RootNode.
|
||||
The SSDT ACPI header is part of the RootNode.
|
||||
|
||||
@retval EFI_SUCCESS Success.
|
||||
@retval EFI_INVALID_PARAMETER A parameter is invalid.
|
||||
@retval EFI_NOT_FOUND The required object information is not found.
|
||||
@retval EFI_BAD_BUFFER_SIZE The size returned by the Configuration
|
||||
Manager is less than the Object size for the
|
||||
requested object.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AddSsdtAcpiHeader (
|
||||
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol,
|
||||
IN CONST ACPI_TABLE_GENERATOR * CONST Generator,
|
||||
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo,
|
||||
OUT AML_ROOT_NODE_HANDLE * RootNode
|
||||
);
|
||||
|
||||
/**
|
||||
Function prototype for testing if two arbitrary objects are equal.
|
||||
|
||||
@ -119,41 +142,14 @@ FindDuplicateValue (
|
||||
IN PFN_IS_EQUAL EqualTestFunction
|
||||
);
|
||||
|
||||
/** Convert a hex number to its ASCII code.
|
||||
/** Parse and print a CmObjDesc.
|
||||
|
||||
@param [in] x Hex number to convert.
|
||||
Must be 0 <= x < 16.
|
||||
|
||||
@return The ASCII code corresponding to x.
|
||||
@param [in] CmObjDesc The CmObjDesc to parse and print.
|
||||
**/
|
||||
UINT8
|
||||
VOID
|
||||
EFIAPI
|
||||
AsciiFromHex (
|
||||
IN UINT8 x
|
||||
);
|
||||
|
||||
/** Check if a HID is a valid PNP ID.
|
||||
|
||||
@param [in] Hid The Hid to validate.
|
||||
|
||||
@retval TRUE The Hid is a valid PNP ID.
|
||||
@retval FALSE The Hid is not a valid PNP ID.
|
||||
**/
|
||||
BOOLEAN
|
||||
IsValidPnpId (
|
||||
IN CONST CHAR8 * Hid
|
||||
);
|
||||
|
||||
/** Check if a HID is a valid ACPI ID.
|
||||
|
||||
@param [in] Hid The Hid to validate.
|
||||
|
||||
@retval TRUE The Hid is a valid ACPI ID.
|
||||
@retval FALSE The Hid is not a valid ACPI ID.
|
||||
**/
|
||||
BOOLEAN
|
||||
IsValidAcpiId (
|
||||
IN CONST CHAR8 * Hid
|
||||
ParseCmObjDesc (
|
||||
IN CONST CM_OBJ_DESCRIPTOR * CmObjDesc
|
||||
);
|
||||
|
||||
#endif // TABLE_HELPER_LIB_H_
|
||||
|
@ -1,11 +1,11 @@
|
||||
/** @file
|
||||
FADT Table Generator
|
||||
|
||||
Copyright (c) 2017 - 2019, ARM Limited. All rights reserved.
|
||||
Copyright (c) 2017 - 2021, ARM Limited. All rights reserved.
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
@par Reference(s):
|
||||
- ACPI 6.3 Specification, January 2019
|
||||
- ACPI 6.4 Specification, January 2021
|
||||
|
||||
**/
|
||||
|
||||
@ -32,8 +32,8 @@ Requirements:
|
||||
|
||||
/** This macro defines the FADT flag options for ARM Platforms.
|
||||
*/
|
||||
#define FADT_FLAGS (EFI_ACPI_6_3_HW_REDUCED_ACPI | \
|
||||
EFI_ACPI_6_3_LOW_POWER_S0_IDLE_CAPABLE)
|
||||
#define FADT_FLAGS (EFI_ACPI_6_4_HW_REDUCED_ACPI | \
|
||||
EFI_ACPI_6_4_LOW_POWER_S0_IDLE_CAPABLE)
|
||||
|
||||
/** This macro defines the valid mask for the FADT flag option
|
||||
if HW_REDUCED_ACPI flag in the table is set.
|
||||
@ -42,47 +42,47 @@ Requirements:
|
||||
22-31 (reserved).
|
||||
|
||||
Valid bits are:
|
||||
EFI_ACPI_6_3_WBINVD BIT0
|
||||
EFI_ACPI_6_3_PWR_BUTTON BIT4
|
||||
EFI_ACPI_6_3_SLP_BUTTON BIT5
|
||||
EFI_ACPI_6_3_FIX_RTC BIT6
|
||||
EFI_ACPI_6_3_DCK_CAP BIT9
|
||||
EFI_ACPI_6_3_RESET_REG_SUP BIT10
|
||||
EFI_ACPI_6_3_SEALED_CASE BIT11
|
||||
EFI_ACPI_6_3_HEADLESS BIT12
|
||||
EFI_ACPI_6_3_USE_PLATFORM_CLOCK BIT15
|
||||
EFI_ACPI_6_3_FORCE_APIC_CLUSTER_MODEL BIT18
|
||||
EFI_ACPI_6_3_FORCE_APIC_PHYSICAL_DESTINATION_MODE BIT19
|
||||
EFI_ACPI_6_3_HW_REDUCED_ACPI BIT20
|
||||
EFI_ACPI_6_3_LOW_POWER_S0_IDLE_CAPABLE BIT21
|
||||
EFI_ACPI_6_4_WBINVD BIT0
|
||||
EFI_ACPI_6_4_PWR_BUTTON BIT4
|
||||
EFI_ACPI_6_4_SLP_BUTTON BIT5
|
||||
EFI_ACPI_6_4_FIX_RTC BIT6
|
||||
EFI_ACPI_6_4_DCK_CAP BIT9
|
||||
EFI_ACPI_6_4_RESET_REG_SUP BIT10
|
||||
EFI_ACPI_6_4_SEALED_CASE BIT11
|
||||
EFI_ACPI_6_4_HEADLESS BIT12
|
||||
EFI_ACPI_6_4_USE_PLATFORM_CLOCK BIT15
|
||||
EFI_ACPI_6_4_FORCE_APIC_CLUSTER_MODEL BIT18
|
||||
EFI_ACPI_6_4_FORCE_APIC_PHYSICAL_DESTINATION_MODE BIT19
|
||||
EFI_ACPI_6_4_HW_REDUCED_ACPI BIT20
|
||||
EFI_ACPI_6_4_LOW_POWER_S0_IDLE_CAPABLE BIT21
|
||||
*/
|
||||
#define VALID_HARDWARE_REDUCED_FLAG_MASK ( \
|
||||
EFI_ACPI_6_3_WBINVD | \
|
||||
EFI_ACPI_6_3_PWR_BUTTON | \
|
||||
EFI_ACPI_6_3_SLP_BUTTON | \
|
||||
EFI_ACPI_6_3_FIX_RTC | \
|
||||
EFI_ACPI_6_3_DCK_CAP | \
|
||||
EFI_ACPI_6_3_RESET_REG_SUP | \
|
||||
EFI_ACPI_6_3_SEALED_CASE | \
|
||||
EFI_ACPI_6_3_HEADLESS | \
|
||||
EFI_ACPI_6_3_USE_PLATFORM_CLOCK | \
|
||||
EFI_ACPI_6_3_FORCE_APIC_CLUSTER_MODEL | \
|
||||
EFI_ACPI_6_3_FORCE_APIC_PHYSICAL_DESTINATION_MODE | \
|
||||
EFI_ACPI_6_3_HW_REDUCED_ACPI | \
|
||||
EFI_ACPI_6_3_LOW_POWER_S0_IDLE_CAPABLE)
|
||||
EFI_ACPI_6_4_WBINVD | \
|
||||
EFI_ACPI_6_4_PWR_BUTTON | \
|
||||
EFI_ACPI_6_4_SLP_BUTTON | \
|
||||
EFI_ACPI_6_4_FIX_RTC | \
|
||||
EFI_ACPI_6_4_DCK_CAP | \
|
||||
EFI_ACPI_6_4_RESET_REG_SUP | \
|
||||
EFI_ACPI_6_4_SEALED_CASE | \
|
||||
EFI_ACPI_6_4_HEADLESS | \
|
||||
EFI_ACPI_6_4_USE_PLATFORM_CLOCK | \
|
||||
EFI_ACPI_6_4_FORCE_APIC_CLUSTER_MODEL | \
|
||||
EFI_ACPI_6_4_FORCE_APIC_PHYSICAL_DESTINATION_MODE | \
|
||||
EFI_ACPI_6_4_HW_REDUCED_ACPI | \
|
||||
EFI_ACPI_6_4_LOW_POWER_S0_IDLE_CAPABLE)
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
/** The AcpiFadt is a template EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE
|
||||
/** The AcpiFadt is a template EFI_ACPI_6_4_FIXED_ACPI_DESCRIPTION_TABLE
|
||||
structure used for generating the FADT Table.
|
||||
Note: fields marked with "{Template}" will be updated dynamically.
|
||||
*/
|
||||
STATIC
|
||||
EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE AcpiFadt = {
|
||||
EFI_ACPI_6_4_FIXED_ACPI_DESCRIPTION_TABLE AcpiFadt = {
|
||||
ACPI_HEADER (
|
||||
EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
|
||||
EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE,
|
||||
EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE_REVISION
|
||||
EFI_ACPI_6_4_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
|
||||
EFI_ACPI_6_4_FIXED_ACPI_DESCRIPTION_TABLE,
|
||||
EFI_ACPI_6_4_FIXED_ACPI_DESCRIPTION_TABLE_REVISION
|
||||
),
|
||||
// UINT32 FirmwareCtrl
|
||||
0,
|
||||
@ -91,7 +91,7 @@ EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE AcpiFadt = {
|
||||
// UINT8 Reserved0
|
||||
EFI_ACPI_RESERVED_BYTE,
|
||||
// UINT8 PreferredPmProfile
|
||||
EFI_ACPI_6_3_PM_PROFILE_UNSPECIFIED, // {Template}: Power Management Profile
|
||||
EFI_ACPI_6_4_PM_PROFILE_UNSPECIFIED, // {Template}: Power Management Profile
|
||||
// UINT16 SciInt
|
||||
0,
|
||||
// UINT32 SmiCmd
|
||||
@ -160,37 +160,37 @@ EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE AcpiFadt = {
|
||||
0,
|
||||
// UINT32 Flags
|
||||
FADT_FLAGS,
|
||||
// EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE ResetReg
|
||||
// EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE ResetReg
|
||||
NULL_GAS,
|
||||
// UINT8 ResetValue
|
||||
0,
|
||||
// UINT16 ArmBootArch
|
||||
EFI_ACPI_6_3_ARM_PSCI_COMPLIANT, // {Template}: ARM Boot Architecture Flags
|
||||
EFI_ACPI_6_4_ARM_PSCI_COMPLIANT, // {Template}: ARM Boot Architecture Flags
|
||||
// UINT8 MinorRevision
|
||||
EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE_MINOR_REVISION,
|
||||
EFI_ACPI_6_4_FIXED_ACPI_DESCRIPTION_TABLE_MINOR_REVISION,
|
||||
// UINT64 XFirmwareCtrl
|
||||
0,
|
||||
// UINT64 XDsdt
|
||||
0,
|
||||
// EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE XPm1aEvtBlk
|
||||
// EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE XPm1aEvtBlk
|
||||
NULL_GAS,
|
||||
// EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE XPm1bEvtBlk
|
||||
// EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE XPm1bEvtBlk
|
||||
NULL_GAS,
|
||||
// EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE XPm1aCntBlk
|
||||
// EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE XPm1aCntBlk
|
||||
NULL_GAS,
|
||||
// EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE XPm1bCntBlk
|
||||
// EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE XPm1bCntBlk
|
||||
NULL_GAS,
|
||||
// EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE XPm2CntBlk
|
||||
// EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE XPm2CntBlk
|
||||
NULL_GAS,
|
||||
// EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE XPmTmrBlk
|
||||
// EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE XPmTmrBlk
|
||||
NULL_GAS,
|
||||
// EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE XGpe0Blk
|
||||
// EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE XGpe0Blk
|
||||
NULL_GAS,
|
||||
// EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE XGpe1Blk
|
||||
// EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE XGpe1Blk
|
||||
NULL_GAS,
|
||||
// EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE SleepControlReg
|
||||
// EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE SleepControlReg
|
||||
NULL_GAS,
|
||||
// EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE SleepStatusReg
|
||||
// EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE SleepStatusReg
|
||||
NULL_GAS,
|
||||
// UINT64 HypervisorVendorIdentity
|
||||
EFI_ACPI_RESERVED_QWORD // {Template}: Hypervisor Vendor ID
|
||||
@ -532,7 +532,7 @@ BuildFadtTable (
|
||||
This,
|
||||
(EFI_ACPI_DESCRIPTION_HEADER*)&AcpiFadt,
|
||||
AcpiTableInfo,
|
||||
sizeof (EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE)
|
||||
sizeof (EFI_ACPI_6_4_FIXED_ACPI_DESCRIPTION_TABLE)
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((
|
||||
@ -614,9 +614,9 @@ ACPI_TABLE_GENERATOR FadtGenerator = {
|
||||
// Generator Description
|
||||
L"ACPI.STD.FADT.GENERATOR",
|
||||
// ACPI Table Signature
|
||||
EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
|
||||
EFI_ACPI_6_4_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
|
||||
// ACPI Table Revision supported by this Generator
|
||||
EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE_REVISION,
|
||||
EFI_ACPI_6_4_FIXED_ACPI_DESCRIPTION_TABLE_REVISION,
|
||||
// Minimum supported ACPI Table Revision
|
||||
EFI_ACPI_6_2_FIXED_ACPI_DESCRIPTION_TABLE_REVISION,
|
||||
// Creator ID
|
||||
|
@ -1,11 +1,11 @@
|
||||
/** @file
|
||||
GTDT Table Generator
|
||||
|
||||
Copyright (c) 2017 - 2019, ARM Limited. All rights reserved.
|
||||
Copyright (c) 2017 - 2021, ARM Limited. All rights reserved.
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
@par Reference(s):
|
||||
- ACPI 6.3 Specification - January 2019
|
||||
- ACPI 6.4 Specification - January 2021
|
||||
|
||||
**/
|
||||
|
||||
@ -41,7 +41,7 @@ GET_OBJECT_LIST (
|
||||
CM_ARM_GENERIC_TIMER_INFO
|
||||
);
|
||||
|
||||
/** This macro expands to a function that retrieves the SBSA Generic
|
||||
/** This macro expands to a function that retrieves the Arm Generic
|
||||
Watchdog Timer Information from the Configuration Manager.
|
||||
*/
|
||||
GET_OBJECT_LIST (
|
||||
@ -91,7 +91,7 @@ EFI_STATUS
|
||||
EFIAPI
|
||||
AddGenericTimerInfo (
|
||||
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol,
|
||||
IN EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE * CONST Gtdt,
|
||||
IN EFI_ACPI_6_4_GENERIC_TIMER_DESCRIPTION_TABLE * CONST Gtdt,
|
||||
IN CONST UINT32 PlatformTimerCount,
|
||||
IN CONST UINT32 AcpiTableRevision
|
||||
)
|
||||
@ -133,7 +133,7 @@ AddGenericTimerInfo (
|
||||
GenericTimerInfo->CounterReadBaseAddress;
|
||||
Gtdt->PlatformTimerCount = PlatformTimerCount;
|
||||
Gtdt->PlatformTimerOffset = (PlatformTimerCount == 0) ? 0 :
|
||||
sizeof (EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE);
|
||||
sizeof (EFI_ACPI_6_4_GENERIC_TIMER_DESCRIPTION_TABLE);
|
||||
|
||||
if (AcpiTableRevision > EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE_REVISION) {
|
||||
Gtdt->VirtualPL2TimerGSIV = GenericTimerInfo->VirtualPL2TimerGSIV;
|
||||
@ -143,7 +143,7 @@ AddGenericTimerInfo (
|
||||
return Status;
|
||||
}
|
||||
|
||||
/** Add the SBSA Generic Watchdog Timers to the GTDT table.
|
||||
/** Add the Arm Generic Watchdog Timers to the GTDT table.
|
||||
|
||||
@param [in] Gtdt Pointer to the GTDT Table.
|
||||
@param [in] WatchdogOffset Offset to the watchdog information in the
|
||||
@ -154,26 +154,26 @@ AddGenericTimerInfo (
|
||||
STATIC
|
||||
VOID
|
||||
AddGenericWatchdogList (
|
||||
IN EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE * CONST Gtdt,
|
||||
IN EFI_ACPI_6_4_GENERIC_TIMER_DESCRIPTION_TABLE * CONST Gtdt,
|
||||
IN CONST UINT32 WatchdogOffset,
|
||||
IN CONST CM_ARM_GENERIC_WATCHDOG_INFO * WatchdogInfoList,
|
||||
IN UINT32 WatchdogCount
|
||||
)
|
||||
{
|
||||
EFI_ACPI_6_3_GTDT_SBSA_GENERIC_WATCHDOG_STRUCTURE * Watchdog;
|
||||
EFI_ACPI_6_4_GTDT_ARM_GENERIC_WATCHDOG_STRUCTURE * Watchdog;
|
||||
|
||||
ASSERT (Gtdt != NULL);
|
||||
ASSERT (WatchdogInfoList != NULL);
|
||||
|
||||
Watchdog = (EFI_ACPI_6_3_GTDT_SBSA_GENERIC_WATCHDOG_STRUCTURE *)
|
||||
Watchdog = (EFI_ACPI_6_4_GTDT_ARM_GENERIC_WATCHDOG_STRUCTURE *)
|
||||
((UINT8*)Gtdt + WatchdogOffset);
|
||||
|
||||
while (WatchdogCount-- != 0) {
|
||||
// Add watchdog entry
|
||||
DEBUG ((DEBUG_INFO, "GTDT: Watchdog = 0x%p\n", Watchdog));
|
||||
Watchdog->Type = EFI_ACPI_6_3_GTDT_SBSA_GENERIC_WATCHDOG;
|
||||
Watchdog->Type = EFI_ACPI_6_4_GTDT_ARM_GENERIC_WATCHDOG;
|
||||
Watchdog->Length =
|
||||
sizeof (EFI_ACPI_6_3_GTDT_SBSA_GENERIC_WATCHDOG_STRUCTURE);
|
||||
sizeof (EFI_ACPI_6_4_GTDT_ARM_GENERIC_WATCHDOG_STRUCTURE);
|
||||
Watchdog->Reserved = EFI_ACPI_RESERVED_BYTE;
|
||||
Watchdog->RefreshFramePhysicalAddress =
|
||||
WatchdogInfoList->RefreshFrameAddress;
|
||||
@ -249,7 +249,7 @@ IsGtFrameNumberEqual (
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
AddGTBlockTimerFrames (
|
||||
IN EFI_ACPI_6_3_GTDT_GT_BLOCK_TIMER_STRUCTURE * GtBlockFrame,
|
||||
IN EFI_ACPI_6_4_GTDT_GT_BLOCK_TIMER_STRUCTURE * GtBlockFrame,
|
||||
IN CONST CM_ARM_GTBLOCK_TIMER_FRAME_INFO * GTBlockTimerFrameList,
|
||||
IN UINT32 GTBlockFrameCount
|
||||
)
|
||||
@ -329,15 +329,15 @@ STATIC
|
||||
EFI_STATUS
|
||||
AddGTBlockList (
|
||||
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol,
|
||||
IN EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE * CONST Gtdt,
|
||||
IN EFI_ACPI_6_4_GENERIC_TIMER_DESCRIPTION_TABLE * CONST Gtdt,
|
||||
IN CONST UINT32 GTBlockOffset,
|
||||
IN CONST CM_ARM_GTBLOCK_INFO * GTBlockInfo,
|
||||
IN UINT32 BlockTimerCount
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_ACPI_6_3_GTDT_GT_BLOCK_STRUCTURE * GTBlock;
|
||||
EFI_ACPI_6_3_GTDT_GT_BLOCK_TIMER_STRUCTURE * GtBlockFrame;
|
||||
EFI_ACPI_6_4_GTDT_GT_BLOCK_STRUCTURE * GTBlock;
|
||||
EFI_ACPI_6_4_GTDT_GT_BLOCK_TIMER_STRUCTURE * GtBlockFrame;
|
||||
CM_ARM_GTBLOCK_TIMER_FRAME_INFO * GTBlockTimerFrameList;
|
||||
UINT32 GTBlockTimerFrameCount;
|
||||
UINTN Length;
|
||||
@ -345,7 +345,7 @@ AddGTBlockList (
|
||||
ASSERT (Gtdt != NULL);
|
||||
ASSERT (GTBlockInfo != NULL);
|
||||
|
||||
GTBlock = (EFI_ACPI_6_3_GTDT_GT_BLOCK_STRUCTURE *)((UINT8*)Gtdt +
|
||||
GTBlock = (EFI_ACPI_6_4_GTDT_GT_BLOCK_STRUCTURE *)((UINT8*)Gtdt +
|
||||
GTBlockOffset);
|
||||
|
||||
while (BlockTimerCount-- != 0) {
|
||||
@ -367,8 +367,8 @@ AddGTBlockList (
|
||||
return Status;
|
||||
}
|
||||
|
||||
Length = sizeof (EFI_ACPI_6_3_GTDT_GT_BLOCK_STRUCTURE) +
|
||||
(sizeof (EFI_ACPI_6_3_GTDT_GT_BLOCK_TIMER_STRUCTURE) *
|
||||
Length = sizeof (EFI_ACPI_6_4_GTDT_GT_BLOCK_STRUCTURE) +
|
||||
(sizeof (EFI_ACPI_6_4_GTDT_GT_BLOCK_TIMER_STRUCTURE) *
|
||||
GTBlockInfo->GTBlockTimerFrameCount);
|
||||
|
||||
// Check that the length of the GT block does not
|
||||
@ -386,15 +386,15 @@ AddGTBlockList (
|
||||
return Status;
|
||||
}
|
||||
|
||||
GTBlock->Type = EFI_ACPI_6_3_GTDT_GT_BLOCK;
|
||||
GTBlock->Type = EFI_ACPI_6_4_GTDT_GT_BLOCK;
|
||||
GTBlock->Length = (UINT16)Length;
|
||||
GTBlock->Reserved = EFI_ACPI_RESERVED_BYTE;
|
||||
GTBlock->CntCtlBase = GTBlockInfo->GTBlockPhysicalAddress;
|
||||
GTBlock->GTBlockTimerCount = GTBlockInfo->GTBlockTimerFrameCount;
|
||||
GTBlock->GTBlockTimerOffset =
|
||||
sizeof (EFI_ACPI_6_3_GTDT_GT_BLOCK_STRUCTURE);
|
||||
sizeof (EFI_ACPI_6_4_GTDT_GT_BLOCK_STRUCTURE);
|
||||
|
||||
GtBlockFrame = (EFI_ACPI_6_3_GTDT_GT_BLOCK_TIMER_STRUCTURE*)
|
||||
GtBlockFrame = (EFI_ACPI_6_4_GTDT_GT_BLOCK_TIMER_STRUCTURE*)
|
||||
((UINT8*)GTBlock + GTBlock->GTBlockTimerOffset);
|
||||
|
||||
// Add GT Block Timer frames
|
||||
@ -413,7 +413,7 @@ AddGTBlockList (
|
||||
}
|
||||
|
||||
// Next GTBlock
|
||||
GTBlock = (EFI_ACPI_6_3_GTDT_GT_BLOCK_STRUCTURE *)((UINT8*)GTBlock +
|
||||
GTBlock = (EFI_ACPI_6_4_GTDT_GT_BLOCK_STRUCTURE *)((UINT8*)GTBlock +
|
||||
GTBlock->Length);
|
||||
GTBlockInfo++;
|
||||
}// for
|
||||
@ -460,7 +460,7 @@ BuildGtdtTable (
|
||||
UINT32 BlockTimerCount;
|
||||
CM_ARM_GENERIC_WATCHDOG_INFO * WatchdogInfoList;
|
||||
CM_ARM_GTBLOCK_INFO * GTBlockInfo;
|
||||
EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE * Gtdt;
|
||||
EFI_ACPI_6_4_GENERIC_TIMER_DESCRIPTION_TABLE * Gtdt;
|
||||
UINT32 Idx;
|
||||
UINT32 GTBlockOffset;
|
||||
UINT32 WatchdogOffset;
|
||||
@ -527,11 +527,11 @@ BuildGtdtTable (
|
||||
|
||||
// Calculate the GTDT Table Size
|
||||
PlatformTimerCount = 0;
|
||||
TableSize = sizeof (EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE);
|
||||
TableSize = sizeof (EFI_ACPI_6_4_GENERIC_TIMER_DESCRIPTION_TABLE);
|
||||
if (BlockTimerCount != 0) {
|
||||
GTBlockOffset = TableSize;
|
||||
PlatformTimerCount += BlockTimerCount;
|
||||
TableSize += (sizeof (EFI_ACPI_6_3_GTDT_GT_BLOCK_STRUCTURE) *
|
||||
TableSize += (sizeof (EFI_ACPI_6_4_GTDT_GT_BLOCK_STRUCTURE) *
|
||||
BlockTimerCount);
|
||||
|
||||
for (Idx = 0; Idx < BlockTimerCount; Idx++) {
|
||||
@ -546,7 +546,7 @@ BuildGtdtTable (
|
||||
));
|
||||
goto error_handler;
|
||||
}
|
||||
TableSize += (sizeof (EFI_ACPI_6_3_GTDT_GT_BLOCK_TIMER_STRUCTURE) *
|
||||
TableSize += (sizeof (EFI_ACPI_6_4_GTDT_GT_BLOCK_TIMER_STRUCTURE) *
|
||||
GTBlockInfo[Idx].GTBlockTimerFrameCount);
|
||||
}
|
||||
|
||||
@ -562,7 +562,7 @@ BuildGtdtTable (
|
||||
if (WatchdogCount != 0) {
|
||||
WatchdogOffset = TableSize;
|
||||
PlatformTimerCount += WatchdogCount;
|
||||
TableSize += (sizeof (EFI_ACPI_6_3_GTDT_SBSA_GENERIC_WATCHDOG_STRUCTURE) *
|
||||
TableSize += (sizeof (EFI_ACPI_6_4_GTDT_ARM_GENERIC_WATCHDOG_STRUCTURE) *
|
||||
WatchdogCount);
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
@ -585,7 +585,7 @@ BuildGtdtTable (
|
||||
goto error_handler;
|
||||
}
|
||||
|
||||
Gtdt = (EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE*)*Table;
|
||||
Gtdt = (EFI_ACPI_6_4_GENERIC_TIMER_DESCRIPTION_TABLE*)*Table;
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"GTDT: Gtdt = 0x%p TableSize = 0x%x\n",
|
||||
@ -712,9 +712,9 @@ ACPI_TABLE_GENERATOR GtdtGenerator = {
|
||||
// Generator Description
|
||||
L"ACPI.STD.GTDT.GENERATOR",
|
||||
// ACPI Table Signature
|
||||
EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE,
|
||||
EFI_ACPI_6_4_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE,
|
||||
// ACPI Table Revision supported by this Generator
|
||||
EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE_REVISION,
|
||||
EFI_ACPI_6_4_GENERIC_TIMER_DESCRIPTION_TABLE_REVISION,
|
||||
// Minimum ACPI Table Revision supported by this Generator
|
||||
EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE_REVISION,
|
||||
// Creator ID
|
||||
|
@ -10,21 +10,19 @@
|
||||
- Generic ACPI for Arm Components 1.0 Platform Design Document
|
||||
**/
|
||||
|
||||
#include <IndustryStandard/DebugPort2Table.h>
|
||||
#include <Library/AcpiLib.h>
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Protocol/AcpiTable.h>
|
||||
|
||||
// Module specific include files.
|
||||
#include <AcpiTableGenerator.h>
|
||||
#include <ConfigurationManagerObject.h>
|
||||
#include <ConfigurationManagerHelper.h>
|
||||
#include <Library/AcpiHelperLib.h>
|
||||
#include <Library/AmlLib/AmlLib.h>
|
||||
#include <Library/TableHelperLib.h>
|
||||
#include <Protocol/ConfigurationManagerProtocol.h>
|
||||
#include "SsdtCmn600Generator.h"
|
||||
|
||||
@ -286,7 +284,7 @@ FixupCmn600Info (
|
||||
|
||||
// Get the first Rd node in the "_CRS" object.
|
||||
// This is the PERIPHBASE node.
|
||||
Status = AmlNameOpCrsGetFirstRdNode (NameOpCrsNode, &CmnPeriphBaseRdNode);
|
||||
Status = AmlNameOpGetFirstRdNode (NameOpCrsNode, &CmnPeriphBaseRdNode);
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto error_handler;
|
||||
}
|
||||
@ -309,7 +307,7 @@ FixupCmn600Info (
|
||||
// Get the QWord node corresponding to the ROOTNODEBASE.
|
||||
// It is the second Resource Data element in the BufferNode's
|
||||
// variable list of arguments.
|
||||
Status = AmlNameOpCrsGetNextRdNode (
|
||||
Status = AmlNameOpGetNextRdNode (
|
||||
CmnPeriphBaseRdNode,
|
||||
&CmnRootNodeBaseRdNode
|
||||
);
|
||||
@ -338,8 +336,8 @@ FixupCmn600Info (
|
||||
// Resource Data nodes.
|
||||
for (Index = 0; Index < Cmn600Info->DtcCount; Index++) {
|
||||
DtcInt = &Cmn600Info->DtcInterrupt[Index];
|
||||
Status = AmlCodeGenCrsAddRdInterrupt (
|
||||
NameOpCrsNode,
|
||||
|
||||
Status = AmlCodeGenRdInterrupt (
|
||||
((DtcInt->Flags &
|
||||
EFI_ACPI_EXTENDED_INTERRUPT_FLAG_PRODUCER_CONSUMER_MASK) != 0),
|
||||
((DtcInt->Flags &
|
||||
@ -349,7 +347,9 @@ FixupCmn600Info (
|
||||
((DtcInt->Flags &
|
||||
EFI_ACPI_EXTENDED_INTERRUPT_FLAG_SHARABLE_MASK) != 0),
|
||||
(UINT32*)&DtcInt->Interrupt,
|
||||
1
|
||||
1,
|
||||
NameOpCrsNode,
|
||||
NULL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto error_handler;
|
||||
|
@ -1,7 +1,7 @@
|
||||
## @file
|
||||
# Ssdt CMN-600 Table Generator
|
||||
#
|
||||
# Copyright (c) 2020, Arm Limited. All rights reserved.<BR>
|
||||
# Copyright (c) 2021, Arm Limited. All rights reserved.<BR>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
##
|
||||
@ -29,6 +29,7 @@
|
||||
DynamicTablesPkg/DynamicTablesPkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
AcpiHelperLib
|
||||
AmlLib
|
||||
BaseLib
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,134 @@
|
||||
/** @file
|
||||
SSDT Cpu Topology Table Generator.
|
||||
|
||||
Copyright (c) 2021, Arm Limited. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
@par Reference(s):
|
||||
- ACPI 6.3 Specification - January 2019 - s8.4 Declaring Processors
|
||||
**/
|
||||
|
||||
#ifndef SSDT_CPU_TOPOLOGY_GENERATOR_H_
|
||||
#define SSDT_CPU_TOPOLOGY_GENERATOR_H_
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
// Mask for the flags that need to be checked.
|
||||
#define PPTT_PROCESSOR_MASK ( \
|
||||
(EFI_ACPI_6_3_PPTT_PACKAGE_PHYSICAL) | \
|
||||
(EFI_ACPI_6_3_PPTT_PROCESSOR_ID_VALID << 1) | \
|
||||
(EFI_ACPI_6_3_PPTT_NODE_IS_LEAF << 3))
|
||||
|
||||
// Mask for the cpu flags.
|
||||
#define PPTT_CPU_PROCESSOR_MASK ( \
|
||||
(EFI_ACPI_6_3_PPTT_PACKAGE_NOT_PHYSICAL) | \
|
||||
(EFI_ACPI_6_3_PPTT_PROCESSOR_ID_VALID << 1) | \
|
||||
(EFI_ACPI_6_3_PPTT_NODE_IS_LEAF << 3))
|
||||
|
||||
// Mask for the cluster flags.
|
||||
// Even though a _UID is generated for clusters, it is simpler to use
|
||||
// EFI_ACPI_6_3_PPTT_PROCESSOR_ID_INVALID and to not match the cluster id of
|
||||
// the PPTT table (not sure the PPTT table is generated).
|
||||
#define PPTT_CLUSTER_PROCESSOR_MASK ( \
|
||||
(EFI_ACPI_6_3_PPTT_PACKAGE_NOT_PHYSICAL) | \
|
||||
(EFI_ACPI_6_3_PPTT_PROCESSOR_ID_INVALID << 1) | \
|
||||
(EFI_ACPI_6_3_PPTT_NODE_IS_NOT_LEAF << 3))
|
||||
|
||||
/** LPI states are stored in the ASL namespace at '\_SB_.Lxxx',
|
||||
with xxx being the node index of the LPI state.
|
||||
*/
|
||||
#define SB_SCOPE "\\_SB_"
|
||||
#define SB_SCOPE_PREFIX SB_SCOPE "."
|
||||
/// Size of the SB_SCOPE_PREFIX string.
|
||||
#define SB_SCOPE_PREFIX_SIZE sizeof (SB_SCOPE_PREFIX)
|
||||
|
||||
/// HID for a processor device.
|
||||
#define ACPI_HID_PROCESSOR_DEVICE "ACPI0007"
|
||||
|
||||
/// HID for a processor container device.
|
||||
#define ACPI_HID_PROCESSOR_CONTAINER_DEVICE "ACPI0010"
|
||||
|
||||
/** Node names of Cpus and Clusters are 'Cxxx', and 'Lxxx' for LPI states.
|
||||
The 'xxx' is an index on 12 bits is given to node name,
|
||||
thus the limitation in the number of nodes.
|
||||
*/
|
||||
#define MAX_NODE_COUNT (1 << 12)
|
||||
|
||||
/** A structure used to handle the Lpi structures referencing.
|
||||
|
||||
A CM_ARM_PROC_HIERARCHY_INFO structure references a CM_ARM_OBJ_REF.
|
||||
This CM_ARM_OBJ_REF references CM_ARM_LPI_INFO structures.
|
||||
|
||||
Example:
|
||||
(Cpu0) (Cpu1)
|
||||
CM_ARM_PROC_HIERARCHY_INFO CM_ARM_PROC_HIERARCHY_INFO
|
||||
| |
|
||||
+----------------------------------------
|
||||
|
|
||||
v
|
||||
(List of references to Lpi states)
|
||||
CM_ARM_OBJ_REF
|
||||
|
|
||||
+----------------------------------------
|
||||
| |
|
||||
v v
|
||||
(A first Lpi state) (A second Lpi state)
|
||||
CM_ARM_LPI_INFO[0] CM_ARM_LPI_INFO[1]
|
||||
|
||||
Here, Cpu0 and Cpu1 have the same Lpi states. Both CM_ARM_PROC_HIERARCHY_INFO
|
||||
structures reference the same CM_ARM_OBJ_REF. An entry is created in the
|
||||
TokenTable such as:
|
||||
0 <-> CM_ARM_OBJ_REF
|
||||
|
||||
This will lead to the creation of this pseudo-ASL code where Cpu0 and Cpu1
|
||||
return the same object at \_SB.L000:
|
||||
Scope (\_SB) {
|
||||
Device (C000) {
|
||||
[...]
|
||||
Method (_LPI) {
|
||||
Return (\_SB.L000)
|
||||
}
|
||||
} // C000
|
||||
|
||||
Device (C001) {
|
||||
[...]
|
||||
Method (_LPI) {
|
||||
Return (\_SB.L000)
|
||||
}
|
||||
} // C001
|
||||
|
||||
// Lpi states
|
||||
Name (L000, Package (0x05) {
|
||||
[...]
|
||||
}
|
||||
}
|
||||
*/
|
||||
typedef struct TokenTable {
|
||||
/// TokenTable, a table allowing to map:
|
||||
/// Index <-> CM_OBJECT_TOKEN (to CM_ARM_LPI_INFO structures).
|
||||
CM_OBJECT_TOKEN * Table;
|
||||
|
||||
/// Last used index of the TokenTable.
|
||||
/// LastIndex is bound by ProcNodeCount.
|
||||
UINT32 LastIndex;
|
||||
} TOKEN_TABLE;
|
||||
|
||||
/** A structure holding the Cpu topology generator and additional private data.
|
||||
*/
|
||||
typedef struct AcpiCpuTopologyGenerator {
|
||||
/// ACPI Table generator header
|
||||
ACPI_TABLE_GENERATOR Header;
|
||||
|
||||
// Private fields are defined from here.
|
||||
|
||||
/// Private object used to handle token referencing.
|
||||
TOKEN_TABLE TokenTable;
|
||||
/// List of CM_ARM_PROC_HIERARCHY_INFO CM objects.
|
||||
CM_ARM_PROC_HIERARCHY_INFO * ProcNodeList;
|
||||
/// Count of CM_ARM_PROC_HIERARCHY_INFO CM objects.
|
||||
UINT32 ProcNodeCount;
|
||||
} ACPI_CPU_TOPOLOGY_GENERATOR;
|
||||
|
||||
#pragma pack()
|
||||
|
||||
#endif // SSDT_CPU_TOPOLOGY_GENERATOR_H_
|
@ -0,0 +1,33 @@
|
||||
## @file
|
||||
# Ssdt Cpu Topology Table Generator
|
||||
#
|
||||
# Copyright (c) 2021, Arm Limited. All rights reserved.<BR>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
##
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x0001001B
|
||||
BASE_NAME = SsdtCpuTopologyLibArm
|
||||
FILE_GUID = F2835EB6-4B05-48D4-A475-147DA0F3755C
|
||||
VERSION_STRING = 1.0
|
||||
MODULE_TYPE = DXE_DRIVER
|
||||
LIBRARY_CLASS = NULL|DXE_DRIVER
|
||||
CONSTRUCTOR = AcpiSsdtCpuTopologyLibConstructor
|
||||
DESTRUCTOR = AcpiSsdtCpuTopologyLibDestructor
|
||||
|
||||
[Sources]
|
||||
SsdtCpuTopologyGenerator.c
|
||||
SsdtCpuTopologyGenerator.h
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
EmbeddedPkg/EmbeddedPkg.dec
|
||||
ArmPlatformPkg/ArmPlatformPkg.dec
|
||||
DynamicTablesPkg/DynamicTablesPkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
AcpiHelperLib
|
||||
AmlLib
|
||||
BaseLib
|
@ -6,21 +6,19 @@
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
**/
|
||||
|
||||
#include <IndustryStandard/DebugPort2Table.h>
|
||||
#include <Library/AcpiLib.h>
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Protocol/AcpiTable.h>
|
||||
|
||||
// Module specific include files.
|
||||
#include <AcpiTableGenerator.h>
|
||||
#include <ConfigurationManagerObject.h>
|
||||
#include <ConfigurationManagerHelper.h>
|
||||
#include <Library/AcpiHelperLib.h>
|
||||
#include <Library/SsdtSerialPortFixupLib.h>
|
||||
#include <Library/TableHelperLib.h>
|
||||
#include <Protocol/ConfigurationManagerProtocol.h>
|
||||
|
||||
/** ARM standard SSDT Serial Port Table Generator
|
||||
|
@ -1,7 +1,7 @@
|
||||
## @file
|
||||
# Ssdt Serial Port Table Generator
|
||||
#
|
||||
# Copyright (c) 2019 - 2020, Arm Limited. All rights reserved.<BR>
|
||||
# Copyright (c) 2019 - 2021, Arm Limited. All rights reserved.<BR>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
##
|
||||
@ -27,7 +27,7 @@
|
||||
DynamicTablesPkg/DynamicTablesPkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
AcpiHelperLib
|
||||
AmlLib
|
||||
BaseLib
|
||||
TableHelperLib
|
||||
SsdtSerialPortFixupLib
|
||||
|
210
DynamicTablesPkg/Library/Common/AcpiHelperLib/AcpiHelper.c
Normal file
210
DynamicTablesPkg/Library/Common/AcpiHelperLib/AcpiHelper.c
Normal file
@ -0,0 +1,210 @@
|
||||
/** @file
|
||||
Acpi Helper
|
||||
|
||||
Copyright (c) 2017 - 2021, Arm Limited. All rights reserved.<BR>
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
**/
|
||||
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
|
||||
// Module specific include files.
|
||||
#include <Library/AcpiHelperLib.h>
|
||||
|
||||
/** Convert a hex number to its ASCII code.
|
||||
|
||||
@param [in] Hex Hex number to convert.
|
||||
Must be 0 <= x < 16.
|
||||
|
||||
@return The ASCII code corresponding to x.
|
||||
-1 if error.
|
||||
**/
|
||||
UINT8
|
||||
EFIAPI
|
||||
AsciiFromHex (
|
||||
IN UINT8 Hex
|
||||
)
|
||||
{
|
||||
if (Hex < 10) {
|
||||
return (UINT8)(Hex + '0');
|
||||
}
|
||||
|
||||
if (Hex < 16) {
|
||||
return (UINT8)(Hex - 10 + 'A');
|
||||
}
|
||||
|
||||
ASSERT (FALSE);
|
||||
return (UINT8)-1;
|
||||
}
|
||||
|
||||
/** Convert an ASCII char representing an hexadecimal number
|
||||
to its integer value.
|
||||
|
||||
@param [in] Char Char to convert.
|
||||
Must be between '0'-'9' or 'A'-'F' or 'a'-'f'.
|
||||
|
||||
@return The corresponding integer (between 0-16).
|
||||
-1 if error.
|
||||
**/
|
||||
UINT8
|
||||
EFIAPI
|
||||
HexFromAscii (
|
||||
IN CHAR8 Char
|
||||
)
|
||||
{
|
||||
if ((Char >= '0') && (Char <= '9')) {
|
||||
return (UINT8)(Char - '0');
|
||||
}
|
||||
|
||||
if ((Char >= 'A') && (Char <= 'F')) {
|
||||
return (UINT8)(Char - 'A' + 10);
|
||||
}
|
||||
|
||||
if ((Char >= 'a') && (Char <= 'f')) {
|
||||
return (UINT8)(Char - 'a' + 10);
|
||||
}
|
||||
|
||||
ASSERT (FALSE);
|
||||
return (UINT8)-1;
|
||||
}
|
||||
|
||||
/** Check if a HID is a valid PNP ID.
|
||||
|
||||
@param [in] Hid The Hid to validate.
|
||||
|
||||
@retval TRUE The Hid is a valid PNP ID.
|
||||
@retval FALSE The Hid is not a valid PNP ID.
|
||||
**/
|
||||
BOOLEAN
|
||||
IsValidPnpId (
|
||||
IN CONST CHAR8 * Hid
|
||||
)
|
||||
{
|
||||
UINTN Index;
|
||||
|
||||
if (AsciiStrLen (Hid) != 7) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// A valid PNP ID must be of the form "AAA####"
|
||||
// where A is an uppercase letter and # is a hex digit.
|
||||
for (Index = 0; Index < 3; Index++) {
|
||||
if (!IS_UPPER_CHAR (Hid[Index])) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
for (Index = 3; Index < 7; Index++) {
|
||||
if (!IS_UPPER_HEX (Hid[Index])) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/** Check if a HID is a valid ACPI ID.
|
||||
|
||||
@param [in] Hid The Hid to validate.
|
||||
|
||||
@retval TRUE The Hid is a valid ACPI ID.
|
||||
@retval FALSE The Hid is not a valid ACPI ID.
|
||||
**/
|
||||
BOOLEAN
|
||||
IsValidAcpiId (
|
||||
IN CONST CHAR8 * Hid
|
||||
)
|
||||
{
|
||||
UINTN Index;
|
||||
|
||||
if (AsciiStrLen (Hid) != 8) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// A valid ACPI ID must be of the form "NNNN####"
|
||||
// where N is an uppercase letter or a digit ('0'-'9')
|
||||
// and # is a hex digit.
|
||||
for (Index = 0; Index < 4; Index++) {
|
||||
if (!(IS_UPPER_CHAR (Hid[Index]) || IS_DIGIT (Hid[Index]))) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
for (Index = 4; Index < 8; Index++) {
|
||||
if (!IS_UPPER_HEX (Hid[Index])) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/** Convert a EisaId string to its compressed UINT32 equivalent.
|
||||
|
||||
Cf. ACPI 6.4 specification, s19.3.4 "ASL Macros": "Eisaid"
|
||||
|
||||
@param [in] EisaIdStr Input EisaId string.
|
||||
@param [out] EisaIdInt Output EisaId UINT32 (compressed).
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlGetEisaIdFromString (
|
||||
IN CONST CHAR8 * EisaIdStr,
|
||||
OUT UINT32 * EisaIdInt
|
||||
)
|
||||
{
|
||||
if ((EisaIdStr == NULL) ||
|
||||
(!IsValidPnpId (EisaIdStr)) ||
|
||||
(EisaIdInt == NULL)) {
|
||||
ASSERT (0);
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
/* Cf. ACPI 6.4 specification, s19.3.4 "ASL Macros": "Eisaid"
|
||||
|
||||
Converts and compresses the 7-character text argument into its corresponding
|
||||
4-byte numeric EISA ID encoding (Integer). This can be used when declaring
|
||||
IDs for devices that are EISA IDs.
|
||||
|
||||
The algorithm used to convert the TextID is as shown in the following
|
||||
example:
|
||||
Starting with a seven character input string "PNP0303", we want to create
|
||||
a DWordConst. This string contains a three character manufacturer code
|
||||
"PNP", a three character hex product identifier "030", and a one character
|
||||
revision identifier "3".
|
||||
The compressed manufacturer code is created as follows:
|
||||
1) Find hex ASCII value for each letter
|
||||
2) Subtract 40h from each ASCII value
|
||||
3) Retain 5 least significant bits for each letter and discard remaining
|
||||
0's:
|
||||
|
||||
Byte 0:
|
||||
Bit 7: reserved (0)
|
||||
Bit 6-2: 1st character of compressed mfg code "P"
|
||||
Bit 1-0: Upper 2 bits of 2nd character of mfg code "N"
|
||||
Byte 1:
|
||||
Bit 7-5: Lower 3 bits of 2nd character of mfg code "N"
|
||||
Bit 4-0: 3rd character of mfg code "P"
|
||||
Byte 2:
|
||||
Bit 7-4: 1st hex digit of product number "0"
|
||||
Bit 3-0: 2nd hex digit of product number "3"
|
||||
Byte 3:
|
||||
Bit 7-4: 3rd hex digit of product number "0"
|
||||
Bit 3-0: 4th hex digit of product number "3"
|
||||
*/
|
||||
*EisaIdInt = SwapBytes32 (
|
||||
((EisaIdStr[0] - 0x40) << 26) |
|
||||
((EisaIdStr[1] - 0x40) << 21) |
|
||||
((EisaIdStr[2] - 0x40) << 16) |
|
||||
(HexFromAscii (EisaIdStr[3]) << 12) |
|
||||
(HexFromAscii (EisaIdStr[4]) << 8) |
|
||||
(HexFromAscii (EisaIdStr[5]) << 4) |
|
||||
(HexFromAscii (EisaIdStr[6]))
|
||||
);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
## @file
|
||||
# Acpi Helper
|
||||
#
|
||||
# Copyright (c) 2021, ARM Limited. All rights reserved.
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
##
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x0001001B
|
||||
BASE_NAME = AcpiHelperLib
|
||||
FILE_GUID = 45968FB4-A724-46FC-822D-F9E557601F9B
|
||||
VERSION_STRING = 1.0
|
||||
MODULE_TYPE = DXE_DRIVER
|
||||
LIBRARY_CLASS = AcpiHelperLib
|
||||
|
||||
[Sources]
|
||||
AcpiHelper.c
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
DynamicTablesPkg/DynamicTablesPkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
BaseLib
|
@ -2,7 +2,7 @@
|
||||
AML Print Function.
|
||||
|
||||
Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved. <BR>
|
||||
Copyright (c) 2019 - 2020, Arm Limited. All rights reserved.<BR>
|
||||
Copyright (c) 2019 - 2021, Arm Limited. All rights reserved.<BR>
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
**/
|
||||
@ -199,7 +199,7 @@ AmlDbgPrintNodeHeader (
|
||||
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"%3d | %-15s | ",
|
||||
"%3d | %-15a | ",
|
||||
Level,
|
||||
NodeTypeStrTbl[Node->NodeType]
|
||||
));
|
||||
@ -227,7 +227,7 @@ AmlDbgPrintDataNode (
|
||||
|
||||
AmlDbgPrintNodeHeader ((AML_NODE_HEADER*)DataNode, Level);
|
||||
|
||||
DEBUG ((DEBUG_INFO, "%-36s | ", NodeDataTypeStrTbl[DataNode->DataType]));
|
||||
DEBUG ((DEBUG_INFO, "%-36a | ", NodeDataTypeStrTbl[DataNode->DataType]));
|
||||
DEBUG ((DEBUG_INFO, "0x%04x | ", DataNode->Size));
|
||||
|
||||
if ((DataNode->DataType == EAmlNodeDataTypeNameString) ||
|
||||
@ -300,13 +300,13 @@ AmlDbgPrintObjectNode (
|
||||
|
||||
// Print a string corresponding to the field object OpCode/SubOpCode.
|
||||
if (AmlNodeHasAttribute (ObjectNode, AML_IS_FIELD_ELEMENT)) {
|
||||
DEBUG ((DEBUG_INFO, "%-15s ", AmlGetFieldOpCodeStr (
|
||||
DEBUG ((DEBUG_INFO, "%-15a ", AmlGetFieldOpCodeStr (
|
||||
ObjectNode->AmlByteEncoding->OpCode,
|
||||
0
|
||||
)));
|
||||
} else {
|
||||
// Print a string corresponding to the object OpCode/SubOpCode.
|
||||
DEBUG ((DEBUG_INFO, "%-15s | ", AmlGetOpCodeStr (
|
||||
DEBUG ((DEBUG_INFO, "%-15a | ", AmlGetOpCodeStr (
|
||||
ObjectNode->AmlByteEncoding->OpCode,
|
||||
ObjectNode->AmlByteEncoding->SubOpCode)
|
||||
));
|
||||
@ -378,19 +378,19 @@ AmlDbgPrintTableHeader (
|
||||
DEBUG ((DEBUG_INFO, "Lvl | Node Type |\n"));
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
" | %-15s | Signature| Length | Rev | CSum | OemId | "
|
||||
" | %-15a | Signature| Length | Rev | CSum | OemId | "
|
||||
"OemTableId | OemRev | CreatorId| CreatorRev\n",
|
||||
NodeTypeStrTbl[EAmlNodeRoot]
|
||||
));
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
" | %-15s | Op | SubOp| OpName | MaxI| Attribute | "
|
||||
" | %-15a | Op | SubOp| OpName | MaxI| Attribute | "
|
||||
"PkgLen | NodeName (opt)\n",
|
||||
NodeTypeStrTbl[EAmlNodeObject]
|
||||
));
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
" | %-15s | Data Type | Size | "
|
||||
" | %-15a | Data Type | Size | "
|
||||
"Buffer\n",
|
||||
NodeTypeStrTbl[EAmlNodeData]
|
||||
));
|
||||
|
@ -2,7 +2,7 @@
|
||||
AML grammar definitions.
|
||||
|
||||
Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved. <BR>
|
||||
Copyright (c) 2019 - 2020, Arm Limited. All rights reserved.<BR>
|
||||
Copyright (c) 2019 - 2021, Arm Limited. All rights reserved.<BR>
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
**/
|
||||
@ -803,3 +803,88 @@ AmlComputePkgLengthWidth (
|
||||
// Length < 2^6
|
||||
return 1;
|
||||
}
|
||||
|
||||
/** Given a length, compute the value of a PkgLen.
|
||||
|
||||
In AML, some object have a PkgLen, telling the size of the AML object.
|
||||
It can be encoded in 1 to 4 bytes. The bytes used to encode the PkgLen is
|
||||
itself counted in the PkgLen value.
|
||||
This means that if an AML object sees its size increment/decrement,
|
||||
the number of bytes used to encode the PkgLen value can itself
|
||||
increment/decrement.
|
||||
|
||||
For instance, the AML encoding of a DeviceOp is:
|
||||
DefDevice := DeviceOp PkgLength NameString TermList
|
||||
If:
|
||||
- sizeof (NameString) = 4 (the name is "DEV0" for instance);
|
||||
- sizeof (TermList) = (2^6-6)
|
||||
then the PkgLen is encoded on 1 byte. Indeed, its value is:
|
||||
sizeof (PkgLen) + sizeof (NameString) + sizeof (TermList) =
|
||||
sizeof (PkgLen) + 4 + (2^6-6)
|
||||
So:
|
||||
PkgLen = sizeof (PkgLen) + (2^6-2)
|
||||
|
||||
The input arguments Length and PkgLen represent, for the DefDevice:
|
||||
DefDevice := DeviceOp PkgLength NameString TermList
|
||||
|------Length-----|
|
||||
|--------*PgkLength---------|
|
||||
|
||||
@param [in] Length The length to encode as a PkgLen.
|
||||
Length cannot exceed 2^28 - 4 (4 bytes for the
|
||||
PkgLen encoding).
|
||||
The size of the PkgLen encoding bytes should not be
|
||||
counted in this length value.
|
||||
@param [out] PkgLen If success, contains the value of the PkgLen,
|
||||
ready to encode in the PkgLen format.
|
||||
This value takes into account the size of PkgLen
|
||||
encoding.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlComputePkgLength (
|
||||
IN UINT32 Length,
|
||||
OUT UINT32 * PkgLen
|
||||
)
|
||||
{
|
||||
UINT32 PkgLenWidth;
|
||||
UINT32 ReComputedPkgLenWidth;
|
||||
|
||||
if (PkgLen == NULL) {
|
||||
ASSERT (0);
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
// Compute the PkgLenWidth.
|
||||
PkgLenWidth = AmlComputePkgLengthWidth (Length);
|
||||
if (PkgLenWidth == 0) {
|
||||
ASSERT (0);
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
// Add it to the Length.
|
||||
Length += PkgLenWidth;
|
||||
|
||||
// Check that adding the PkgLenWidth didn't trigger a domino effect,
|
||||
// increasing the encoding width of the PkgLen again.
|
||||
// The PkgLen is encoded in at most 4 bytes. It is possible to increase
|
||||
// the PkgLen width if its encoding is less than 3 bytes.
|
||||
ReComputedPkgLenWidth = AmlComputePkgLengthWidth (Length);
|
||||
if (ReComputedPkgLenWidth != PkgLenWidth) {
|
||||
if ((ReComputedPkgLenWidth != 0) &&
|
||||
(ReComputedPkgLenWidth < 4)) {
|
||||
// No need to recompute the PkgLen since a new threshold cannot
|
||||
// be reached by incrementing the value by one.
|
||||
Length += 1;
|
||||
} else {
|
||||
ASSERT (0);
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
}
|
||||
|
||||
*PkgLen = Length;
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
AML grammar definitions.
|
||||
|
||||
Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved. <BR>
|
||||
Copyright (c) 2019 - 2020, Arm Limited. All rights reserved.<BR>
|
||||
Copyright (c) 2019 - 2021, Arm Limited. All rights reserved.<BR>
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
**/
|
||||
@ -326,5 +326,50 @@ AmlComputePkgLengthWidth (
|
||||
IN UINT32 Length
|
||||
);
|
||||
|
||||
/** Given a length, compute the value of a PkgLen.
|
||||
|
||||
In AML, some object have a PkgLen, telling the size of the AML object.
|
||||
It can be encoded in 1 to 4 bytes. The bytes used to encode the PkgLen is
|
||||
itself counted in the PkgLen value.
|
||||
This means that if an AML object sees its size increment/decrement,
|
||||
the number of bytes used to encode the PkgLen value can itself
|
||||
increment/decrement.
|
||||
|
||||
For instance, the AML encoding of a DeviceOp is:
|
||||
DefDevice := DeviceOp PkgLength NameString TermList
|
||||
If:
|
||||
- sizeof (NameString) = 4 (the name is "DEV0" for instance);
|
||||
- sizeof (TermList) = (2^6-6)
|
||||
then the PkgLen is encoded on 1 byte. Indeed, its value is:
|
||||
sizeof (PkgLen) + sizeof (NameString) + sizeof (TermList) =
|
||||
sizeof (PkgLen) + 4 + (2^6-6)
|
||||
So:
|
||||
PkgLen = sizeof (PkgLen) + (2^6-2)
|
||||
|
||||
The input arguments Length and PkgLen represent, for the DefDevice:
|
||||
DefDevice := DeviceOp PkgLength NameString TermList
|
||||
|------Length-----|
|
||||
|--------*PgkLength---------|
|
||||
|
||||
@param [in] Length The length to encode as a PkgLen.
|
||||
Length cannot exceed 2^28 - 4 (4 bytes for the
|
||||
PkgLen encoding).
|
||||
The size of the PkgLen encoding bytes should not be
|
||||
counted in this length value.
|
||||
@param [out] PkgLen If success, contains the value of the PkgLen,
|
||||
ready to encode in the PkgLen format.
|
||||
This value takes into account the size of PkgLen
|
||||
encoding.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlComputePkgLength (
|
||||
IN UINT32 Length,
|
||||
OUT UINT32 * PkgLen
|
||||
);
|
||||
|
||||
#endif // AML_H_
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
## @file
|
||||
# AML Generation Library
|
||||
#
|
||||
# Copyright (c) 2019 - 2020, Arm Limited. All rights reserved.<BR>
|
||||
# Copyright (c) 2019 - 2021, Arm Limited. All rights reserved.<BR>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
##
|
||||
@ -66,6 +66,7 @@
|
||||
DynamicTablesPkg/DynamicTablesPkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
AcpiHelperLib
|
||||
BaseLib
|
||||
|
||||
[BuildOptions]
|
||||
|
@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
AML Api.
|
||||
|
||||
Copyright (c) 2020, Arm Limited. All rights reserved.<BR>
|
||||
Copyright (c) 2020 - 2021, Arm Limited. All rights reserved.<BR>
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
**/
|
||||
@ -222,7 +222,7 @@ AmlNameOpUpdateString (
|
||||
return Status;
|
||||
}
|
||||
|
||||
/** Get the first Resource Data element contained in a "_CRS" object.
|
||||
/** Get the first Resource Data element contained in a named object.
|
||||
|
||||
In the following ASL code, the function will return the Resource Data
|
||||
node corresponding to the "QWordMemory ()" ASL macro.
|
||||
@ -233,35 +233,33 @@ AmlNameOpUpdateString (
|
||||
)
|
||||
|
||||
Note:
|
||||
- The "_CRS" object must be declared using ASL "Name (Declare Named Object)".
|
||||
- "_CRS" declared using ASL "Method (Declare Control Method)" is not
|
||||
supported.
|
||||
"_CRS" names defined as methods are not handled by this function.
|
||||
They must be defined as names, using the "Name ()" statement.
|
||||
|
||||
@param [in] NameOpCrsNode NameOp object node defining a "_CRS" object.
|
||||
Must have an OpCode=AML_NAME_OP, SubOpCode=0.
|
||||
NameOp object nodes are defined in ASL
|
||||
using the "Name ()" function.
|
||||
@param [out] OutRdNode Pointer to the first Resource Data element of
|
||||
the "_CRS" object. A Resource Data element
|
||||
is stored in a data node.
|
||||
@param [in] NameOpNode NameOp object node defining a named object.
|
||||
Must have an OpCode=AML_NAME_OP, SubOpCode=0.
|
||||
NameOp object nodes are defined in ASL
|
||||
using the "Name ()" function.
|
||||
@param [out] OutRdNode Pointer to the first Resource Data element of
|
||||
the named object. A Resource Data element
|
||||
is stored in a data node.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlNameOpCrsGetFirstRdNode (
|
||||
IN AML_OBJECT_NODE_HANDLE NameOpCrsNode,
|
||||
AmlNameOpGetFirstRdNode (
|
||||
IN AML_OBJECT_NODE_HANDLE NameOpNode,
|
||||
OUT AML_DATA_NODE_HANDLE * OutRdNode
|
||||
)
|
||||
{
|
||||
AML_OBJECT_NODE_HANDLE BufferOpNode;
|
||||
AML_DATA_NODE_HANDLE FirstRdNode;
|
||||
|
||||
if ((NameOpCrsNode == NULL) ||
|
||||
(AmlGetNodeType ((AML_NODE_HANDLE)NameOpCrsNode) != EAmlNodeObject) ||
|
||||
(!AmlNodeHasOpCode (NameOpCrsNode, AML_NAME_OP, 0)) ||
|
||||
(!AmlNameOpCompareName (NameOpCrsNode, "_CRS")) ||
|
||||
if ((NameOpNode == NULL) ||
|
||||
(AmlGetNodeType ((AML_NODE_HANDLE)NameOpNode) != EAmlNodeObject) ||
|
||||
(!AmlNodeHasOpCode (NameOpNode, AML_NAME_OP, 0)) ||
|
||||
(OutRdNode == NULL)) {
|
||||
ASSERT (0);
|
||||
return EFI_INVALID_PARAMETER;
|
||||
@ -269,10 +267,10 @@ AmlNameOpCrsGetFirstRdNode (
|
||||
|
||||
*OutRdNode = NULL;
|
||||
|
||||
// Get the _CRS value which is represented as a BufferOp object node
|
||||
// which is the 2nd fixed argument (i.e. index 1).
|
||||
// Get the value of the variable which is represented as a BufferOp object
|
||||
// node which is the 2nd fixed argument (i.e. index 1).
|
||||
BufferOpNode = (AML_OBJECT_NODE_HANDLE)AmlGetFixedArgument (
|
||||
NameOpCrsNode,
|
||||
NameOpNode,
|
||||
EAmlParseIndexTerm1
|
||||
);
|
||||
if ((BufferOpNode == NULL) ||
|
||||
@ -310,11 +308,12 @@ AmlNameOpCrsGetFirstRdNode (
|
||||
}
|
||||
)
|
||||
|
||||
The CurrRdNode Resource Data node must be defined in an object named "_CRS"
|
||||
and defined by a "Name ()" ASL function.
|
||||
Note:
|
||||
"_CRS" names defined as methods are not handled by this function.
|
||||
They must be defined as names, using the "Name ()" statement.
|
||||
|
||||
@param [in] CurrRdNode Pointer to the current Resource Data element of
|
||||
the "_CRS" object.
|
||||
the named object.
|
||||
@param [out] OutRdNode Pointer to the Resource Data element following
|
||||
the CurrRdNode.
|
||||
Contain a NULL pointer if CurrRdNode is the
|
||||
@ -327,12 +326,12 @@ AmlNameOpCrsGetFirstRdNode (
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlNameOpCrsGetNextRdNode (
|
||||
AmlNameOpGetNextRdNode (
|
||||
IN AML_DATA_NODE_HANDLE CurrRdNode,
|
||||
OUT AML_DATA_NODE_HANDLE * OutRdNode
|
||||
)
|
||||
{
|
||||
AML_OBJECT_NODE_HANDLE NameOpCrsNode;
|
||||
AML_OBJECT_NODE_HANDLE NameOpNode;
|
||||
AML_OBJECT_NODE_HANDLE BufferOpNode;
|
||||
|
||||
if ((CurrRdNode == NULL) ||
|
||||
@ -356,12 +355,11 @@ AmlNameOpCrsGetNextRdNode (
|
||||
}
|
||||
|
||||
// The parent of the BufferOpNode must be a NameOp node.
|
||||
NameOpCrsNode = (AML_OBJECT_NODE_HANDLE)AmlGetParent (
|
||||
(AML_NODE_HANDLE)BufferOpNode
|
||||
);
|
||||
if ((NameOpCrsNode == NULL) ||
|
||||
(!AmlNodeHasOpCode (NameOpCrsNode, AML_NAME_OP, 0)) ||
|
||||
(!AmlNameOpCompareName (NameOpCrsNode, "_CRS"))) {
|
||||
NameOpNode = (AML_OBJECT_NODE_HANDLE)AmlGetParent (
|
||||
(AML_NODE_HANDLE)BufferOpNode
|
||||
);
|
||||
if ((NameOpNode == NULL) ||
|
||||
(!AmlNodeHasOpCode (NameOpNode, AML_NAME_OP, 0))) {
|
||||
ASSERT (0);
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
@ -380,3 +378,88 @@ AmlNameOpCrsGetNextRdNode (
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
// DEPRECATED APIS
|
||||
#ifndef DISABLE_NEW_DEPRECATED_INTERFACES
|
||||
|
||||
/** DEPRECATED API
|
||||
|
||||
Get the first Resource Data element contained in a "_CRS" object.
|
||||
|
||||
In the following ASL code, the function will return the Resource Data
|
||||
node corresponding to the "QWordMemory ()" ASL macro.
|
||||
Name (_CRS, ResourceTemplate() {
|
||||
QWordMemory (...) {...},
|
||||
Interrupt (...) {...}
|
||||
}
|
||||
)
|
||||
|
||||
Note:
|
||||
- The "_CRS" object must be declared using ASL "Name (Declare Named Object)".
|
||||
- "_CRS" declared using ASL "Method (Declare Control Method)" is not
|
||||
supported.
|
||||
|
||||
@ingroup UserApis
|
||||
|
||||
@param [in] NameOpCrsNode NameOp object node defining a "_CRS" object.
|
||||
Must have an OpCode=AML_NAME_OP, SubOpCode=0.
|
||||
NameOp object nodes are defined in ASL
|
||||
using the "Name ()" function.
|
||||
@param [out] OutRdNode Pointer to the first Resource Data element of
|
||||
the "_CRS" object. A Resource Data element
|
||||
is stored in a data node.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlNameOpCrsGetFirstRdNode (
|
||||
IN AML_OBJECT_NODE_HANDLE NameOpCrsNode,
|
||||
OUT AML_DATA_NODE_HANDLE * OutRdNode
|
||||
)
|
||||
{
|
||||
return AmlNameOpGetFirstRdNode (NameOpCrsNode, OutRdNode);
|
||||
}
|
||||
|
||||
/** DEPRECATED API
|
||||
|
||||
Get the Resource Data element following the CurrRdNode Resource Data.
|
||||
|
||||
In the following ASL code, if CurrRdNode corresponds to the first
|
||||
"QWordMemory ()" ASL macro, the function will return the Resource Data
|
||||
node corresponding to the "Interrupt ()" ASL macro.
|
||||
Name (_CRS, ResourceTemplate() {
|
||||
QwordMemory (...) {...},
|
||||
Interrupt (...) {...}
|
||||
}
|
||||
)
|
||||
|
||||
The CurrRdNode Resource Data node must be defined in an object named "_CRS"
|
||||
and defined by a "Name ()" ASL function.
|
||||
|
||||
@ingroup UserApis
|
||||
|
||||
@param [in] CurrRdNode Pointer to the current Resource Data element of
|
||||
the "_CRS" variable.
|
||||
@param [out] OutRdNode Pointer to the Resource Data element following
|
||||
the CurrRdNode.
|
||||
Contain a NULL pointer if CurrRdNode is the
|
||||
last Resource Data element in the list.
|
||||
The "End Tag" is not considered as a resource
|
||||
data element and is not returned.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlNameOpCrsGetNextRdNode (
|
||||
IN AML_DATA_NODE_HANDLE CurrRdNode,
|
||||
OUT AML_DATA_NODE_HANDLE * OutRdNode
|
||||
)
|
||||
{
|
||||
return AmlNameOpGetNextRdNode (CurrRdNode, OutRdNode);
|
||||
}
|
||||
|
||||
#endif // DISABLE_NEW_DEPRECATED_INTERFACES
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
AML Resource Data Code Generation.
|
||||
|
||||
Copyright (c) 2020, Arm Limited. All rights reserved.<BR>
|
||||
Copyright (c) 2020 - 2021, Arm Limited. All rights reserved.<BR>
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
@ -24,12 +24,18 @@
|
||||
If NewRdNode is not NULL, update its value to RdNode.
|
||||
|
||||
@param [in] RdNode Newly created Resource Data node.
|
||||
@param [in] ParentNode If not NULL, add the generated node
|
||||
to the end of the variable list of
|
||||
argument of the ParentNode, but
|
||||
before the "End Tag" Resource Data.
|
||||
Must be a BufferOpNode.
|
||||
@param [out] NewRdNode If not NULL, update the its value to RdNode.
|
||||
RdNode is deleted if an error occurs.
|
||||
@param [in] ParentNode If not NULL, ParentNode must:
|
||||
- be a NameOp node, i.e. have the AML_NAME_OP
|
||||
opcode (cf "Name ()" ASL statement)
|
||||
- contain a list of resource data elements
|
||||
(cf "ResourceTemplate ()" ASL statement)
|
||||
RdNode is then added at the end of the variable
|
||||
list of resource data elements, but before the
|
||||
"End Tag" Resource Data.
|
||||
@param [out] NewRdNode If not NULL:
|
||||
- and Success, contains RdNode.
|
||||
- and Error, reset to NULL.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
@ -43,57 +49,85 @@ LinkRdNode (
|
||||
OUT AML_DATA_NODE ** NewRdNode
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS Status1;
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS Status1;
|
||||
AML_OBJECT_NODE *BufferOpNode;
|
||||
|
||||
if (NewRdNode != NULL) {
|
||||
*NewRdNode = NULL;
|
||||
}
|
||||
|
||||
if (ParentNode != NULL) {
|
||||
// Check this is a NameOp node.
|
||||
if ((!AmlNodeHasOpCode (ParentNode, AML_NAME_OP, 0))) {
|
||||
ASSERT (0);
|
||||
Status = EFI_INVALID_PARAMETER;
|
||||
goto error_handler;
|
||||
}
|
||||
|
||||
// Get the value which is represented as a BufferOp object node
|
||||
// which is the 2nd fixed argument (i.e. index 1).
|
||||
BufferOpNode = (AML_OBJECT_NODE_HANDLE)AmlGetFixedArgument (
|
||||
ParentNode,
|
||||
EAmlParseIndexTerm1
|
||||
);
|
||||
if ((BufferOpNode == NULL) ||
|
||||
(AmlGetNodeType ((AML_NODE_HANDLE)BufferOpNode) != EAmlNodeObject) ||
|
||||
(!AmlNodeHasOpCode (BufferOpNode, AML_BUFFER_OP, 0))) {
|
||||
ASSERT (0);
|
||||
Status = EFI_INVALID_PARAMETER;
|
||||
goto error_handler;
|
||||
}
|
||||
|
||||
// Add RdNode as the last element, but before the EndTag.
|
||||
Status = AmlAppendRdNode (BufferOpNode, RdNode);
|
||||
if (EFI_ERROR (Status)) {
|
||||
ASSERT (0);
|
||||
goto error_handler;
|
||||
}
|
||||
}
|
||||
|
||||
if (NewRdNode != NULL) {
|
||||
*NewRdNode = RdNode;
|
||||
}
|
||||
|
||||
// Add RdNode as the last element, but before the EndTag.
|
||||
if (ParentNode != NULL) {
|
||||
Status = AmlAppendRdNode (ParentNode, RdNode);
|
||||
if (EFI_ERROR (Status)) {
|
||||
ASSERT (0);
|
||||
Status1 = AmlDeleteTree ((AML_NODE_HEADER*)RdNode);
|
||||
ASSERT_EFI_ERROR (Status1);
|
||||
// Return original error.
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
|
||||
error_handler:
|
||||
Status1 = AmlDeleteTree ((AML_NODE_HEADER*)RdNode);
|
||||
ASSERT_EFI_ERROR (Status1);
|
||||
// Return original error.
|
||||
return Status;
|
||||
}
|
||||
|
||||
/** Code generation for the "Interrupt ()" ASL function.
|
||||
|
||||
This function creates a Resource Data element corresponding to the
|
||||
"Interrupt ()" ASL function and stores it in an AML Data Node.
|
||||
|
||||
The Resource Data effectively created is an Extended Interrupt Resource
|
||||
Data. See ACPI 6.3 specification, s6.4.3.6 "Extended Interrupt Descriptor"
|
||||
for more information about Extended Interrupt Resource Data.
|
||||
Data. Cf ACPI 6.4:
|
||||
- s6.4.3.6 "Extended Interrupt Descriptor"
|
||||
- s19.6.64 "Interrupt (Interrupt Resource Descriptor Macro)"
|
||||
|
||||
This function allocates memory to create a data node. It is the caller's
|
||||
responsibility to either:
|
||||
- attach this node to an AML tree;
|
||||
- delete this node.
|
||||
The created resource data node can be:
|
||||
- appended to the list of resource data elements of the NameOpNode.
|
||||
In such case NameOpNode must be defined by a the "Name ()" ASL statement
|
||||
and initially contain a "ResourceTemplate ()".
|
||||
- returned through the NewRdNode parameter.
|
||||
|
||||
@param [in] ResourceConsumer The device consumes the specified interrupt
|
||||
or produces it for use by a child device.
|
||||
@param [in] EdgeTriggered The interrupt is edge triggered or
|
||||
level triggered.
|
||||
@param [in] ActiveLow The interrupt is active-high or active-low.
|
||||
@param [in] Shared The interrupt can be shared with other
|
||||
devices or not (Exclusive).
|
||||
@param [in] IrqList Interrupt list. Must be non-NULL.
|
||||
@param [in] IrqCount Interrupt count. Must be non-zero.
|
||||
@param [in] ParentNode If not NULL, add the generated node
|
||||
to the end of the variable list of
|
||||
argument of the ParentNode, but
|
||||
before the "End Tag" Resource Data.
|
||||
Must be a BufferOpNode.
|
||||
@param [out] NewRdNode If success, contains the generated node.
|
||||
@param [in] ResourceConsumer The device consumes the specified interrupt
|
||||
or produces it for use by a child device.
|
||||
@param [in] EdgeTriggered The interrupt is edge triggered or
|
||||
level triggered.
|
||||
@param [in] ActiveLow The interrupt is active-high or active-low.
|
||||
@param [in] Shared The interrupt can be shared with other
|
||||
devices or not (Exclusive).
|
||||
@param [in] IrqList Interrupt list. Must be non-NULL.
|
||||
@param [in] IrqCount Interrupt count. Must be non-zero.
|
||||
@param [in] NameOpNode NameOp object node defining a named object.
|
||||
If provided, append the new resource data node
|
||||
to the list of resource data elements of this
|
||||
node.
|
||||
@param [out] NewRdNode If provided and success,
|
||||
contain the created node.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
@ -101,15 +135,15 @@ LinkRdNode (
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlCodeGenInterrupt (
|
||||
IN BOOLEAN ResourceConsumer,
|
||||
IN BOOLEAN EdgeTriggered,
|
||||
IN BOOLEAN ActiveLow,
|
||||
IN BOOLEAN Shared,
|
||||
IN UINT32 * IrqList,
|
||||
IN UINT8 IrqCount,
|
||||
IN AML_OBJECT_NODE * ParentNode, OPTIONAL
|
||||
OUT AML_DATA_NODE ** NewRdNode OPTIONAL
|
||||
AmlCodeGenRdInterrupt (
|
||||
IN BOOLEAN ResourceConsumer,
|
||||
IN BOOLEAN EdgeTriggered,
|
||||
IN BOOLEAN ActiveLow,
|
||||
IN BOOLEAN Shared,
|
||||
IN UINT32 *IrqList,
|
||||
IN UINT8 IrqCount,
|
||||
IN AML_OBJECT_NODE_HANDLE NameOpNode, OPTIONAL
|
||||
OUT AML_DATA_NODE_HANDLE *NewRdNode OPTIONAL
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
@ -120,16 +154,19 @@ AmlCodeGenInterrupt (
|
||||
|
||||
if ((IrqList == NULL) ||
|
||||
(IrqCount == 0) ||
|
||||
((ParentNode == NULL) && (NewRdNode == NULL))) {
|
||||
((NameOpNode == NULL) && (NewRdNode == NULL))) {
|
||||
ASSERT (0);
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
// Header
|
||||
RdInterrupt.Header.Header.Bits.Name =
|
||||
ACPI_LARGE_EXTENDED_IRQ_DESCRIPTOR_NAME;
|
||||
RdInterrupt.Header.Header.Bits.Type = ACPI_LARGE_ITEM_FLAG;
|
||||
RdInterrupt.Header.Length = sizeof (EFI_ACPI_EXTENDED_INTERRUPT_DESCRIPTOR) -
|
||||
sizeof (ACPI_LARGE_RESOURCE_HEADER);
|
||||
|
||||
// Body
|
||||
RdInterrupt.InterruptVectorFlags = (ResourceConsumer ? BIT0 : 0) |
|
||||
(EdgeTriggered ? BIT1 : 0) |
|
||||
(ActiveLow ? BIT2 : 0) |
|
||||
@ -153,10 +190,215 @@ AmlCodeGenInterrupt (
|
||||
return Status;
|
||||
}
|
||||
|
||||
return LinkRdNode (RdNode, ParentNode, NewRdNode);
|
||||
return LinkRdNode (RdNode, NameOpNode, NewRdNode);
|
||||
}
|
||||
|
||||
/** Add an Interrupt Resource Data node.
|
||||
/** Code generation for the "Register ()" ASL function.
|
||||
|
||||
The Resource Data effectively created is a Generic Register Descriptor.
|
||||
Data. Cf ACPI 6.4:
|
||||
- s6.4.3.7 "Generic Register Descriptor".
|
||||
- s19.6.114 "Register".
|
||||
|
||||
The created resource data node can be:
|
||||
- appended to the list of resource data elements of the NameOpNode.
|
||||
In such case NameOpNode must be defined by a the "Name ()" ASL statement
|
||||
and initially contain a "ResourceTemplate ()".
|
||||
- returned through the NewRdNode parameter.
|
||||
|
||||
@param [in] AddressSpace Address space where the register exists.
|
||||
Can be one of I/O space, System Memory, etc.
|
||||
@param [in] BitWidth Number of bits in the register.
|
||||
@param [in] BitOffset Offset in bits from the start of the register
|
||||
indicated by the Address.
|
||||
@param [in] Address Register address.
|
||||
@param [in] AccessSize Size of data values used when accessing the
|
||||
address space. Can be one of:
|
||||
0 - Undefined, legacy (EFI_ACPI_6_4_UNDEFINED)
|
||||
1 - Byte access (EFI_ACPI_6_4_BYTE)
|
||||
2 - Word access (EFI_ACPI_6_4_WORD)
|
||||
3 - DWord access (EFI_ACPI_6_4_DWORD)
|
||||
4 - QWord access (EFI_ACPI_6_4_QWORD)
|
||||
@param [in] NameOpNode NameOp object node defining a named object.
|
||||
If provided, append the new resource data node
|
||||
to the list of resource data elements of this
|
||||
node.
|
||||
@param [out] NewRdNode If provided and success,
|
||||
contain the created node.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
@retval EFI_OUT_OF_RESOURCES Could not allocate memory.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlCodeGenRdRegister (
|
||||
IN UINT8 AddressSpace,
|
||||
IN UINT8 BitWidth,
|
||||
IN UINT8 BitOffset,
|
||||
IN UINT64 Address,
|
||||
IN UINT8 AccessSize,
|
||||
IN AML_OBJECT_NODE_HANDLE NameOpNode, OPTIONAL
|
||||
OUT AML_DATA_NODE_HANDLE *NewRdNode OPTIONAL
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
AML_DATA_NODE * RdNode;
|
||||
EFI_ACPI_GENERIC_REGISTER_DESCRIPTOR RdRegister;
|
||||
|
||||
if ((AccessSize > EFI_ACPI_6_4_QWORD) ||
|
||||
((NameOpNode == NULL) && (NewRdNode == NULL))) {
|
||||
ASSERT (0);
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
// Header
|
||||
RdRegister.Header.Header.Bits.Name =
|
||||
ACPI_LARGE_GENERIC_REGISTER_DESCRIPTOR_NAME;
|
||||
RdRegister.Header.Header.Bits.Type = ACPI_LARGE_ITEM_FLAG;
|
||||
RdRegister.Header.Length = sizeof (EFI_ACPI_GENERIC_REGISTER_DESCRIPTOR) -
|
||||
sizeof (ACPI_LARGE_RESOURCE_HEADER);
|
||||
|
||||
// Body
|
||||
RdRegister.AddressSpaceId = AddressSpace;
|
||||
RdRegister.RegisterBitWidth = BitWidth;
|
||||
RdRegister.RegisterBitOffset = BitOffset;
|
||||
RdRegister.AddressSize = AccessSize;
|
||||
RdRegister.RegisterAddress = Address;
|
||||
|
||||
Status = AmlCreateDataNode (
|
||||
EAmlNodeDataTypeResourceData,
|
||||
(UINT8*)&RdRegister,
|
||||
sizeof (EFI_ACPI_GENERIC_REGISTER_DESCRIPTOR),
|
||||
&RdNode
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
ASSERT (0);
|
||||
return Status;
|
||||
}
|
||||
|
||||
return LinkRdNode (RdNode, NameOpNode, NewRdNode);
|
||||
}
|
||||
|
||||
/** Code generation for the EndTag resource data.
|
||||
|
||||
The EndTag resource data is automatically generated by the ASL compiler
|
||||
at the end of a list of resource data elements. Thus, it doesn't have
|
||||
a corresponding ASL function.
|
||||
|
||||
This function allocates memory to create a data node. It is the caller's
|
||||
responsibility to either:
|
||||
- attach this node to an AML tree;
|
||||
- delete this node.
|
||||
|
||||
ACPI 6.4, s6.4.2.9 "End Tag":
|
||||
"This checksum is generated such that adding it to the sum of all the data
|
||||
bytes will produce a zero sum."
|
||||
"If the checksum field is zero, the resource data is treated as if the
|
||||
checksum operation succeeded. Configuration proceeds normally."
|
||||
|
||||
To avoid re-computing checksums, if a new resource data elements is
|
||||
added/removed/modified in a list of resource data elements, the AmlLib
|
||||
resets the checksum to 0.
|
||||
|
||||
@param [in] CheckSum CheckSum to store in the EndTag.
|
||||
To ignore/avoid computing the checksum,
|
||||
give 0.
|
||||
@param [in] ParentNode If not NULL, add the generated node
|
||||
to the end of the variable list of
|
||||
argument of the ParentNode.
|
||||
The ParentNode must not initially contain
|
||||
an EndTag resource data element.
|
||||
@param [out] NewRdNode If success, contains the generated node.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
@retval EFI_OUT_OF_RESOURCES Could not allocate memory.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlCodeGenEndTag (
|
||||
IN UINT8 CheckSum, OPTIONAL
|
||||
IN AML_OBJECT_NODE * ParentNode, OPTIONAL
|
||||
OUT AML_DATA_NODE ** NewRdNode OPTIONAL
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
AML_DATA_NODE * RdNode;
|
||||
EFI_ACPI_END_TAG_DESCRIPTOR EndTag;
|
||||
ACPI_SMALL_RESOURCE_HEADER SmallResHdr;
|
||||
|
||||
if ((ParentNode == NULL) && (NewRdNode == NULL)) {
|
||||
ASSERT (0);
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
RdNode = NULL;
|
||||
|
||||
// Header
|
||||
SmallResHdr.Bits.Length = sizeof (EFI_ACPI_END_TAG_DESCRIPTOR) -
|
||||
sizeof (ACPI_SMALL_RESOURCE_HEADER);
|
||||
SmallResHdr.Bits.Name = ACPI_SMALL_END_TAG_DESCRIPTOR_NAME;
|
||||
SmallResHdr.Bits.Type = ACPI_SMALL_ITEM_FLAG;
|
||||
|
||||
// Body
|
||||
EndTag.Desc = SmallResHdr.Byte;
|
||||
EndTag.Checksum = CheckSum;
|
||||
|
||||
Status = AmlCreateDataNode (
|
||||
EAmlNodeDataTypeResourceData,
|
||||
(UINT8*)&EndTag,
|
||||
sizeof (EFI_ACPI_END_TAG_DESCRIPTOR),
|
||||
&RdNode
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
ASSERT (0);
|
||||
return Status;
|
||||
}
|
||||
|
||||
if (NewRdNode != NULL) {
|
||||
*NewRdNode = RdNode;
|
||||
}
|
||||
|
||||
if (ParentNode != NULL) {
|
||||
// Check the BufferOp doesn't contain any resource data yet.
|
||||
// This is a hard check: do not allow to add an EndTag if the BufferNode
|
||||
// already has resource data elements attached. Indeed, the EndTag should
|
||||
// have already been added.
|
||||
if (AmlGetNextVariableArgument ((AML_NODE_HEADER*)ParentNode, NULL) !=
|
||||
NULL) {
|
||||
ASSERT (0);
|
||||
Status = EFI_INVALID_PARAMETER;
|
||||
goto error_handler;
|
||||
}
|
||||
|
||||
// Add the EndTag RdNode. Indeed, the AmlAppendRdNode function
|
||||
// is looking for an EndTag, which we are adding here.
|
||||
Status = AmlVarListAddTail (
|
||||
(AML_NODE_HEADER*)ParentNode,
|
||||
(AML_NODE_HEADER*)RdNode
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
ASSERT (0);
|
||||
goto error_handler;
|
||||
}
|
||||
}
|
||||
|
||||
return Status;
|
||||
|
||||
error_handler:
|
||||
if (RdNode != NULL) {
|
||||
AmlDeleteTree ((AML_NODE_HEADER*)RdNode);
|
||||
}
|
||||
return Status;
|
||||
}
|
||||
|
||||
// DEPRECATED APIS
|
||||
#ifndef DISABLE_NEW_DEPRECATED_INTERFACES
|
||||
|
||||
/** DEPRECATED API
|
||||
|
||||
Add an Interrupt Resource Data node.
|
||||
|
||||
This function creates a Resource Data element corresponding to the
|
||||
"Interrupt ()" ASL function, stores it in an AML Data Node.
|
||||
@ -180,6 +422,8 @@ AmlCodeGenInterrupt (
|
||||
...
|
||||
}
|
||||
|
||||
@ingroup UserApis
|
||||
|
||||
@param [in] NameOpCrsNode NameOp object node defining a "_CRS" object.
|
||||
Must have an OpCode=AML_NAME_OP, SubOpCode=0.
|
||||
NameOp object nodes are defined in ASL
|
||||
@ -211,46 +455,16 @@ AmlCodeGenCrsAddRdInterrupt (
|
||||
IN UINT8 IrqCount
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
AML_OBJECT_NODE_HANDLE BufferOpNode;
|
||||
|
||||
if ((IrqList == NULL) ||
|
||||
(IrqCount == 0) ||
|
||||
(!AmlNodeHasOpCode (NameOpCrsNode, AML_NAME_OP, 0)) ||
|
||||
(!AmlNameOpCompareName (NameOpCrsNode, "_CRS"))) {
|
||||
ASSERT (0);
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
// Get the _CRS value which is represented as a BufferOp object node
|
||||
// which is the 2nd fixed argument (i.e. index 1).
|
||||
BufferOpNode = (AML_OBJECT_NODE_HANDLE)AmlGetFixedArgument (
|
||||
NameOpCrsNode,
|
||||
EAmlParseIndexTerm1
|
||||
);
|
||||
if ((BufferOpNode == NULL) ||
|
||||
(AmlGetNodeType ((AML_NODE_HANDLE)BufferOpNode) != EAmlNodeObject) ||
|
||||
(!AmlNodeHasOpCode (BufferOpNode, AML_BUFFER_OP, 0))) {
|
||||
ASSERT (0);
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
// Generate the Extended Interrupt Resource Data node,
|
||||
// and attach it as the last variable argument of the BufferOpNode.
|
||||
Status = AmlCodeGenInterrupt (
|
||||
ResourceConsumer,
|
||||
EdgeTriggered,
|
||||
ActiveLow,
|
||||
Shared,
|
||||
IrqList,
|
||||
IrqCount,
|
||||
BufferOpNode,
|
||||
NULL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
ASSERT (0);
|
||||
}
|
||||
|
||||
return Status;
|
||||
return AmlCodeGenRdInterrupt (
|
||||
ResourceConsumer,
|
||||
EdgeTriggered,
|
||||
ActiveLow,
|
||||
Shared,
|
||||
IrqList,
|
||||
IrqCount,
|
||||
NameOpCrsNode,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
|
||||
#endif // DISABLE_NEW_DEPRECATED_INTERFACES
|
||||
|
@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
AML Resource Data Code Generation.
|
||||
|
||||
Copyright (c) 2019 - 2020, Arm Limited. All rights reserved.<BR>
|
||||
Copyright (c) 2019 - 2021, Arm Limited. All rights reserved.<BR>
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
**/
|
||||
@ -11,33 +11,32 @@
|
||||
|
||||
/** Code generation for the "Interrupt ()" ASL function.
|
||||
|
||||
This function creates a Resource Data element corresponding to the
|
||||
"Interrupt ()" ASL function and stores it in an AML Data Node.
|
||||
|
||||
The Resource Data effectively created is an Extended Interrupt Resource
|
||||
Data. See ACPI 6.3 specification, s6.4.3.6 "Extended Interrupt Descriptor"
|
||||
for more information about Extended Interrupt Resource Data.
|
||||
Data. Cf ACPI 6.4:
|
||||
- s6.4.3.6 "Extended Interrupt Descriptor"
|
||||
- s19.6.64 "Interrupt (Interrupt Resource Descriptor Macro)"
|
||||
|
||||
This function allocates memory to create a data node. It is the caller's
|
||||
responsibility to either:
|
||||
- attach this node to an AML tree;
|
||||
- delete this node.
|
||||
The created resource data node can be:
|
||||
- appended to the list of resource data elements of the NameOpNode.
|
||||
In such case NameOpNode must be defined by a the "Name ()" ASL statement
|
||||
and initially contain a "ResourceTemplate ()".
|
||||
- returned through the NewRdNode parameter.
|
||||
|
||||
@param [in] ResourceConsumer The device consumes the specified interrupt
|
||||
or produces it for use by a child device.
|
||||
@param [in] EdgeTriggered The interrupt is edge triggered or
|
||||
level triggered.
|
||||
@param [in] ActiveLow The interrupt is active-high or active-low.
|
||||
@param [in] Shared The interrupt can be shared with other
|
||||
devices or not (Exclusive).
|
||||
@param [in] IrqList Interrupt list. Must be non-NULL.
|
||||
@param [in] IrqCount Interrupt count. Must be non-zero.
|
||||
@param [in] ParentNode If not NULL, add the generated node
|
||||
to the end of the variable list of
|
||||
argument of the ParentNode, but
|
||||
before the "End Tag" Resource Data.
|
||||
Must be a BufferOpNode.
|
||||
@param [out] NewRdNode If success, contains the generated node.
|
||||
@param [in] ResourceConsumer The device consumes the specified interrupt
|
||||
or produces it for use by a child device.
|
||||
@param [in] EdgeTriggered The interrupt is edge triggered or
|
||||
level triggered.
|
||||
@param [in] ActiveLow The interrupt is active-high or active-low.
|
||||
@param [in] Shared The interrupt can be shared with other
|
||||
devices or not (Exclusive).
|
||||
@param [in] IrqList Interrupt list. Must be non-NULL.
|
||||
@param [in] IrqCount Interrupt count. Must be non-zero.
|
||||
@param [in] NameOpNode NameOp object node defining a named object.
|
||||
If provided, append the new resource data node
|
||||
to the list of resource data elements of this
|
||||
node.
|
||||
@param [out] NewRdNode If provided and success,
|
||||
contain the created node.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
@ -45,15 +44,107 @@
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlCodeGenInterrupt (
|
||||
IN BOOLEAN ResourceConsumer,
|
||||
IN BOOLEAN EdgeTriggered,
|
||||
IN BOOLEAN ActiveLow,
|
||||
IN BOOLEAN Shared,
|
||||
IN UINT32 * IrqList,
|
||||
IN UINT8 IrqCount,
|
||||
IN AML_OBJECT_NODE * ParentNode, OPTIONAL
|
||||
OUT AML_DATA_NODE ** NewRdNode OPTIONAL
|
||||
AmlCodeGenRdInterrupt (
|
||||
IN BOOLEAN ResourceConsumer,
|
||||
IN BOOLEAN EdgeTriggered,
|
||||
IN BOOLEAN ActiveLow,
|
||||
IN BOOLEAN Shared,
|
||||
IN UINT32 *IrqList,
|
||||
IN UINT8 IrqCount,
|
||||
IN AML_OBJECT_NODE_HANDLE NameOpNode, OPTIONAL
|
||||
OUT AML_DATA_NODE_HANDLE *NewRdNode OPTIONAL
|
||||
);
|
||||
|
||||
/** Code generation for the "Register ()" ASL function.
|
||||
|
||||
The Resource Data effectively created is a Generic Register Descriptor.
|
||||
Data. Cf ACPI 6.4:
|
||||
- s6.4.3.7 "Generic Register Descriptor".
|
||||
- s19.6.114 "Register".
|
||||
|
||||
The created resource data node can be:
|
||||
- appended to the list of resource data elements of the NameOpNode.
|
||||
In such case NameOpNode must be defined by a the "Name ()" ASL statement
|
||||
and initially contain a "ResourceTemplate ()".
|
||||
- returned through the NewRdNode parameter.
|
||||
|
||||
@param [in] AddressSpace Address space where the register exists.
|
||||
Can be one of I/O space, System Memory, etc.
|
||||
@param [in] BitWidth Number of bits in the register.
|
||||
@param [in] BitOffset Offset in bits from the start of the register
|
||||
indicated by the Address.
|
||||
@param [in] Address Register address.
|
||||
@param [in] AccessSize Size of data values used when accessing the
|
||||
address space. Can be one of:
|
||||
0 - Undefined, legacy (EFI_ACPI_6_4_UNDEFINED)
|
||||
1 - Byte access (EFI_ACPI_6_4_BYTE)
|
||||
2 - Word access (EFI_ACPI_6_4_WORD)
|
||||
3 - DWord access (EFI_ACPI_6_4_DWORD)
|
||||
4 - QWord access (EFI_ACPI_6_4_QWORD)
|
||||
@param [in] NameOpNode NameOp object node defining a named object.
|
||||
If provided, append the new resource data node
|
||||
to the list of resource data elements of this
|
||||
node.
|
||||
@param [out] NewRdNode If provided and success,
|
||||
contain the created node.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
@retval EFI_OUT_OF_RESOURCES Could not allocate memory.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlCodeGenRdRegister (
|
||||
IN UINT8 AddressSpace,
|
||||
IN UINT8 BitWidth,
|
||||
IN UINT8 BitOffset,
|
||||
IN UINT64 Address,
|
||||
IN UINT8 AccessSize,
|
||||
IN AML_OBJECT_NODE_HANDLE NameOpNode, OPTIONAL
|
||||
OUT AML_DATA_NODE_HANDLE *NewRdNode OPTIONAL
|
||||
);
|
||||
|
||||
/** Code generation for the EndTag resource data.
|
||||
|
||||
The EndTag resource data is automatically generated by the ASL compiler
|
||||
at the end of a list of resource data elements. Thus, it doesn't have
|
||||
a corresponding ASL function.
|
||||
|
||||
This function allocates memory to create a data node. It is the caller's
|
||||
responsibility to either:
|
||||
- attach this node to an AML tree;
|
||||
- delete this node.
|
||||
|
||||
ACPI 6.4, s6.4.2.9 "End Tag":
|
||||
"This checksum is generated such that adding it to the sum of all the data
|
||||
bytes will produce a zero sum."
|
||||
"If the checksum field is zero, the resource data is treated as if the
|
||||
checksum operation succeeded. Configuration proceeds normally."
|
||||
|
||||
To avoid re-computing checksums, if a new resource data elements is
|
||||
added/removed/modified in a list of resource data elements, the AmlLib
|
||||
resets the checksum to 0.
|
||||
|
||||
@param [in] CheckSum CheckSum to store in the EndTag.
|
||||
To ignore/avoid computing the checksum,
|
||||
give 0.
|
||||
@param [in] ParentNode If not NULL, add the generated node
|
||||
to the end of the variable list of
|
||||
argument of the ParentNode.
|
||||
The ParentNode must not initially contain
|
||||
an EndTag resource data element.
|
||||
@param [out] NewRdNode If success, contains the generated node.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
@retval EFI_OUT_OF_RESOURCES Could not allocate memory.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlCodeGenEndTag (
|
||||
IN UINT8 CheckSum, OPTIONAL
|
||||
IN AML_OBJECT_NODE * ParentNode, OPTIONAL
|
||||
OUT AML_DATA_NODE ** NewRdNode OPTIONAL
|
||||
);
|
||||
|
||||
#endif // AML_RESOURCE_DATA_CODE_GEN_H_
|
||||
|
@ -101,3 +101,36 @@ AmlRdGetSize (
|
||||
return ((ACPI_SMALL_RESOURCE_HEADER*)Header)->Bits.Length +
|
||||
sizeof (ACPI_SMALL_RESOURCE_HEADER);
|
||||
}
|
||||
|
||||
/** Set the Checksum of an EndTag resource data.
|
||||
|
||||
ACPI 6.4, s6.4.2.9 "End Tag":
|
||||
"This checksum is generated such that adding it to the sum of all the data
|
||||
bytes will produce a zero sum."
|
||||
"If the checksum field is zero, the resource data is treated as if the
|
||||
checksum operation succeeded. Configuration proceeds normally."
|
||||
|
||||
@param [in] Header Pointer to the first byte of a resource data.
|
||||
@param [in] CheckSum Checksum value to set.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlRdSetEndTagChecksum (
|
||||
IN CONST AML_RD_HEADER * Header,
|
||||
IN UINT8 CheckSum
|
||||
)
|
||||
{
|
||||
if ((Header == NULL) ||
|
||||
!AmlRdCompareDescId (
|
||||
Header,
|
||||
AML_RD_BUILD_SMALL_DESC_ID (ACPI_SMALL_END_TAG_DESCRIPTOR_NAME))) {
|
||||
ASSERT (0);
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
((EFI_ACPI_END_TAG_DESCRIPTOR*)Header)->Checksum = CheckSum;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
@ -171,4 +171,25 @@ AmlRdGetSize (
|
||||
IN CONST AML_RD_HEADER * Header
|
||||
);
|
||||
|
||||
/** Set the Checksum of an EndTag resource data.
|
||||
|
||||
ACPI 6.4, s6.4.2.9 "End Tag":
|
||||
"This checksum is generated such that adding it to the sum of all the data
|
||||
bytes will produce a zero sum."
|
||||
"If the checksum field is zero, the resource data is treated as if the
|
||||
checksum operation succeeded. Configuration proceeds normally."
|
||||
|
||||
@param [in] Header Pointer to the first byte of a resource data.
|
||||
@param [in] CheckSum Checksum value to set.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlRdSetEndTagChecksum (
|
||||
IN CONST AML_RD_HEADER * Header,
|
||||
IN UINT8 CheckSum
|
||||
);
|
||||
|
||||
#endif // AML_RESOURCE_DATA_H_
|
||||
|
@ -43,8 +43,6 @@ AmlCloneNode (
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
*ClonedNode = NULL;
|
||||
|
||||
if (IS_AML_DATA_NODE (Node)) {
|
||||
DataNode = (AML_DATA_NODE*)Node;
|
||||
Status = AmlCreateDataNode (
|
||||
|
@ -79,7 +79,9 @@ AmlDeleteRootNode (
|
||||
|
||||
@param [in] SdtHeader Pointer to an ACPI DSDT/SSDT header to copy
|
||||
the data from.
|
||||
@param [out] NewRootNodePtr The created AML_ROOT_NODE.
|
||||
@param [out] NewRootNodePtr If success, contains the created
|
||||
AML_ROOT_NODE.
|
||||
Otherwise reset to NULL.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
@ -101,6 +103,8 @@ AmlCreateRootNode (
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
*NewRootNodePtr = NULL;
|
||||
|
||||
RootNode = AllocateZeroPool (sizeof (AML_ROOT_NODE));
|
||||
if (RootNode == NULL) {
|
||||
ASSERT (0);
|
||||
@ -163,7 +167,9 @@ AmlDeleteObjectNode (
|
||||
@param [in] PkgLength PkgLength of the node if the AmlByteEncoding
|
||||
has the PkgLen attribute.
|
||||
0 otherwise.
|
||||
@param [out] NewObjectNodePtr The created AML_OBJECT_NODE.
|
||||
@param [out] NewObjectNodePtr If success, contains the created
|
||||
AML_OBJECT_NODE.
|
||||
Otherwise reset to NULL.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
@ -186,6 +192,8 @@ AmlCreateObjectNode (
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
*NewObjectNodePtr = NULL;
|
||||
|
||||
ObjectNode = AllocateZeroPool (sizeof (AML_OBJECT_NODE));
|
||||
if (ObjectNode == NULL) {
|
||||
ASSERT (0);
|
||||
@ -252,7 +260,9 @@ AmlDeleteDataNode (
|
||||
this node. Data is copied from there.
|
||||
@param [in] DataSize Number of bytes to consider at the address
|
||||
pointed by Data.
|
||||
@param [out] NewDataNodePtr The created AML_DATA_NODE.
|
||||
@param [out] NewDataNodePtr If success, contains the created
|
||||
AML_DATA_NODE.
|
||||
Otherwise reset to NULL.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
@ -284,6 +294,8 @@ AmlCreateDataNode (
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
*NewDataNodePtr = NULL;
|
||||
|
||||
DataNode = AllocateZeroPool (sizeof (AML_DATA_NODE));
|
||||
if (DataNode == NULL) {
|
||||
ASSERT (0);
|
||||
|
@ -17,7 +17,9 @@
|
||||
|
||||
@param [in] SdtHeader Pointer to an ACPI DSDT/SSDT header to copy
|
||||
the data from.
|
||||
@param [out] NewRootNodePtr The created AML_ROOT_NODE.
|
||||
@param [out] NewRootNodePtr If success, contains the created
|
||||
AML_ROOT_NODE.
|
||||
Otherwise reset to NULL.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
@ -36,7 +38,9 @@ AmlCreateRootNode (
|
||||
@param [in] PkgLength PkgLength of the node if the AmlByteEncoding
|
||||
has the PkgLen attribute.
|
||||
0 otherwise.
|
||||
@param [out] NewObjectNodePtr The created AML_OBJECT_NODE.
|
||||
@param [out] NewObjectNodePtr If success, contains the created
|
||||
AML_OBJECT_NODE.
|
||||
Otherwise reset to NULL.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
@ -57,7 +61,9 @@ AmlCreateObjectNode (
|
||||
this node. Data is copied from there.
|
||||
@param [in] DataSize Number of bytes to consider at the address
|
||||
pointed by Data.
|
||||
@param [out] NewDataNodePtr The created AML_DATA_NODE.
|
||||
@param [out] NewDataNodePtr If success, contains the created
|
||||
AML_DATA_NODE.
|
||||
Otherwise reset to NULL.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
|
@ -513,6 +513,13 @@ AmlUpdateDataNode (
|
||||
ASSERT (0);
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Status = AmlSetRdListCheckSum (ParentNode, 0);
|
||||
if (EFI_ERROR (Status)) {
|
||||
ASSERT (0);
|
||||
return Status;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case EAmlNodeDataTypeFieldPkgLen:
|
||||
|
@ -566,8 +566,7 @@ AmlAppendRdNode (
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
AML_DATA_NODE * CurrRdNode;
|
||||
AML_RD_HEADER RdDataType;
|
||||
AML_DATA_NODE * LastRdNode;
|
||||
|
||||
if (!AmlNodeCompareOpCode (BufferOpNode, AML_BUFFER_OP, 0) ||
|
||||
!IS_AML_DATA_NODE (NewRdNode) ||
|
||||
@ -576,56 +575,39 @@ AmlAppendRdNode (
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
// Get the first Resource data node in the variable list of
|
||||
// argument of the BufferOp node.
|
||||
CurrRdNode = (AML_DATA_NODE*)AmlGetNextVariableArgument (
|
||||
// To avoid re-computing checksums, if a new resource data elements is
|
||||
// added/removed/modified in a list of resource data elements, the AmlLib
|
||||
// resets the checksum to 0.
|
||||
// It is possible to have only one Resource Data in a BufferOp with
|
||||
// no EndTag, but it should not be possible to add a new Resource Data
|
||||
// in the list in this case.
|
||||
Status = AmlSetRdListCheckSum (BufferOpNode, 0);
|
||||
if (EFI_ERROR (Status)) {
|
||||
ASSERT (0);
|
||||
return Status;
|
||||
}
|
||||
|
||||
// Get the last Resource data node in the variable list of argument of the
|
||||
// BufferOp node. This must be an EndTag, otherwise setting the checksum
|
||||
// would have failed.
|
||||
LastRdNode = (AML_DATA_NODE*)AmlGetPreviousVariableArgument (
|
||||
(AML_NODE_HEADER*)BufferOpNode,
|
||||
NULL
|
||||
);
|
||||
if ((CurrRdNode == NULL) ||
|
||||
!IS_AML_DATA_NODE (CurrRdNode) ||
|
||||
(CurrRdNode->DataType != EAmlNodeDataTypeResourceData)) {
|
||||
if ((LastRdNode == NULL) ||
|
||||
!IS_AML_DATA_NODE (LastRdNode) ||
|
||||
(LastRdNode->DataType != EAmlNodeDataTypeResourceData)) {
|
||||
ASSERT (0);
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
// Iterate through the Resource Data nodes to find the End Tag.
|
||||
while (TRUE) {
|
||||
Status = AmlGetResourceDataType (CurrRdNode, &RdDataType);
|
||||
if (EFI_ERROR (Status)) {
|
||||
ASSERT (0);
|
||||
return Status;
|
||||
}
|
||||
|
||||
// If the Resource Data is an End Tag,
|
||||
// add the new node before and return.
|
||||
if (AmlRdCompareDescId (
|
||||
&RdDataType,
|
||||
AML_RD_BUILD_SMALL_DESC_ID (ACPI_SMALL_END_TAG_DESCRIPTOR_NAME))) {
|
||||
Status = AmlVarListAddBefore (
|
||||
(AML_NODE_HEADER*)CurrRdNode,
|
||||
(AML_NODE_HEADER*)NewRdNode)
|
||||
;
|
||||
if (EFI_ERROR (Status)) {
|
||||
ASSERT (0);
|
||||
}
|
||||
return Status;
|
||||
}
|
||||
|
||||
// Get the next Resource Data node.
|
||||
// If this was the last node and no End Tag was found, return error.
|
||||
// It is possible to have only one Resource Data in a BufferOp,
|
||||
// but it should not be possible to add a new Resource Data in the list
|
||||
// in this case.
|
||||
CurrRdNode = (AML_DATA_NODE*)AmlGetSiblingVariableArgument (
|
||||
(AML_NODE_HEADER*)CurrRdNode
|
||||
);
|
||||
if (!IS_AML_DATA_NODE (CurrRdNode) ||
|
||||
(CurrRdNode->DataType != EAmlNodeDataTypeResourceData)) {
|
||||
ASSERT (0);
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
} // while
|
||||
// Add NewRdNode before the EndTag.
|
||||
Status = AmlVarListAddBefore (
|
||||
(AML_NODE_HEADER*)LastRdNode,
|
||||
(AML_NODE_HEADER*)NewRdNode)
|
||||
;
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
/** Replace the fixed argument at the Index of the ParentNode with the NewNode.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
AML Utility.
|
||||
|
||||
Copyright (c) 2019 - 2020, Arm Limited. All rights reserved.<BR>
|
||||
Copyright (c) 2019 - 2021, Arm Limited. All rights reserved.<BR>
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
**/
|
||||
@ -192,7 +192,6 @@ AmlComputeSize (
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
**/
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlNodeGetIntegerValue (
|
||||
@ -904,3 +903,79 @@ AmlPropagateInformation (
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/** Find and set the EndTag's Checksum of a list of Resource Data elements.
|
||||
|
||||
Lists of Resource Data elements end with an EndTag (most of the time). This
|
||||
function finds the EndTag (if present) in a list of Resource Data elements
|
||||
and sets the checksum.
|
||||
|
||||
ACPI 6.4, s6.4.2.9 "End Tag":
|
||||
"This checksum is generated such that adding it to the sum of all the data
|
||||
bytes will produce a zero sum."
|
||||
"If the checksum field is zero, the resource data is treated as if the
|
||||
checksum operation succeeded. Configuration proceeds normally."
|
||||
|
||||
To avoid re-computing checksums, if a new resource data elements is
|
||||
added/removed/modified in a list of resource data elements, the AmlLib
|
||||
resets the checksum to 0.
|
||||
|
||||
@param [in] BufferOpNode Node having a list of Resource Data elements.
|
||||
@param [in] CheckSum CheckSum to store in the EndTag.
|
||||
To ignore/avoid computing the checksum,
|
||||
give 0.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
@retval EFI_NOT_FOUND No EndTag found.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlSetRdListCheckSum (
|
||||
IN AML_OBJECT_NODE * BufferOpNode,
|
||||
IN UINT8 CheckSum
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
AML_DATA_NODE * LastRdNode;
|
||||
AML_RD_HEADER RdDataType;
|
||||
|
||||
if (!AmlNodeCompareOpCode (BufferOpNode, AML_BUFFER_OP, 0)) {
|
||||
ASSERT (0);
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
// Get the last Resource data node in the variable list of
|
||||
// argument of the BufferOp node.
|
||||
LastRdNode = (AML_DATA_NODE*)AmlGetPreviousVariableArgument (
|
||||
(AML_NODE_HEADER*)BufferOpNode,
|
||||
NULL
|
||||
);
|
||||
if ((LastRdNode == NULL) ||
|
||||
!IS_AML_DATA_NODE (LastRdNode) ||
|
||||
(LastRdNode->DataType != EAmlNodeDataTypeResourceData)) {
|
||||
ASSERT (0);
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Status = AmlGetResourceDataType (LastRdNode, &RdDataType);
|
||||
if (EFI_ERROR (Status)) {
|
||||
ASSERT (0);
|
||||
return Status;
|
||||
}
|
||||
|
||||
// Check the LastRdNode is an EndTag.
|
||||
// It is possible to have only one Resource Data in a BufferOp with
|
||||
// no EndTag. Return EFI_NOT_FOUND is such case.
|
||||
if (!AmlRdCompareDescId (
|
||||
&RdDataType,
|
||||
AML_RD_BUILD_SMALL_DESC_ID (ACPI_SMALL_END_TAG_DESCRIPTOR_NAME))) {
|
||||
ASSERT (0);
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
Status = AmlRdSetEndTagChecksum (LastRdNode->Buffer, CheckSum);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
AML Utility.
|
||||
|
||||
Copyright (c) 2019 - 2020, Arm Limited. All rights reserved.<BR>
|
||||
Copyright (c) 2019 - 2021, Arm Limited. All rights reserved.<BR>
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
**/
|
||||
@ -39,6 +39,22 @@ AmlComputeSize (
|
||||
IN OUT UINT32 * Size
|
||||
);
|
||||
|
||||
/** Get the value contained in an integer node.
|
||||
|
||||
@param [in] Node Pointer to an integer node.
|
||||
Must be an object node.
|
||||
@param [out] Value Value contained in the integer node.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlNodeGetIntegerValue (
|
||||
IN AML_OBJECT_NODE * Node,
|
||||
OUT UINT64 * Value
|
||||
);
|
||||
|
||||
/** Set the value contained in an integer node.
|
||||
|
||||
The OpCode is updated accordingly to the new value
|
||||
@ -91,5 +107,37 @@ AmlPropagateInformation (
|
||||
IN UINT8 NodeCount
|
||||
);
|
||||
|
||||
/** Find and set the EndTag's Checksum of a list of Resource Data elements.
|
||||
|
||||
Lists of Resource Data elements end with an EndTag (most of the time). This
|
||||
function finds the EndTag (if present) in a list of Resource Data elements
|
||||
and sets the checksum.
|
||||
|
||||
ACPI 6.4, s6.4.2.9 "End Tag":
|
||||
"This checksum is generated such that adding it to the sum of all the data
|
||||
bytes will produce a zero sum."
|
||||
"If the checksum field is zero, the resource data is treated as if the
|
||||
checksum operation succeeded. Configuration proceeds normally."
|
||||
|
||||
To avoid re-computing checksums, if a new resource data elements is
|
||||
added/removed/modified in a list of resource data elements, the AmlLib
|
||||
resets the checksum to 0.
|
||||
|
||||
@param [in] BufferOpNode Node having a list of Resource Data elements.
|
||||
@param [in] CheckSum CheckSum to store in the EndTag.
|
||||
To ignore/avoid computing the checksum,
|
||||
give 0.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
@retval EFI_NOT_FOUND No EndTag found.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlSetRdListCheckSum (
|
||||
IN AML_OBJECT_NODE * BufferOpNode,
|
||||
IN UINT8 CheckSum
|
||||
);
|
||||
|
||||
#endif // AML_UTILITY_H_
|
||||
|
||||
|
@ -16,15 +16,14 @@
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Protocol/AcpiTable.h>
|
||||
|
||||
// Module specific include files.
|
||||
#include <AcpiTableGenerator.h>
|
||||
#include <ConfigurationManagerObject.h>
|
||||
#include <ConfigurationManagerHelper.h>
|
||||
#include <Library/AcpiHelperLib.h>
|
||||
#include <Library/AmlLib/AmlLib.h>
|
||||
#include <Library/TableHelperLib.h>
|
||||
#include <Protocol/ConfigurationManagerProtocol.h>
|
||||
|
||||
/** C array containing the compiled AML template.
|
||||
@ -275,7 +274,7 @@ FixupCrs (
|
||||
}
|
||||
|
||||
// Get the first Rd node in the "_CRS" object.
|
||||
Status = AmlNameOpCrsGetFirstRdNode (NameOpCrsNode, &QWordRdNode);
|
||||
Status = AmlNameOpGetFirstRdNode (NameOpCrsNode, &QWordRdNode);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
@ -298,7 +297,7 @@ FixupCrs (
|
||||
// Get the Interrupt node.
|
||||
// It is the second Resource Data element in the NameOpCrsNode's
|
||||
// variable list of arguments.
|
||||
Status = AmlNameOpCrsGetNextRdNode (QWordRdNode, &InterruptRdNode);
|
||||
Status = AmlNameOpGetNextRdNode (QWordRdNode, &InterruptRdNode);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
@ -25,6 +25,7 @@
|
||||
DynamicTablesPkg/DynamicTablesPkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
AcpiHelperLib
|
||||
AmlLib
|
||||
BaseLib
|
||||
|
||||
|
@ -0,0 +1,713 @@
|
||||
/** @file
|
||||
Configuration Manager Object parser.
|
||||
|
||||
Copyright (c) 2021, ARM Limited. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <ConfigurationManagerObject.h>
|
||||
#include "ConfigurationManagerObjectParser.h"
|
||||
|
||||
STATIC
|
||||
VOID
|
||||
EFIAPI
|
||||
PrintOemId (
|
||||
CONST CHAR8* Format,
|
||||
UINT8* Ptr
|
||||
);
|
||||
|
||||
/** A parser for EArmObjBootArchInfo.
|
||||
*/
|
||||
STATIC CONST CM_OBJ_PARSER CmArmBootArchInfoParser[] = {
|
||||
{"BootArchFlags", 2, "0x%x", NULL}
|
||||
};
|
||||
|
||||
/** A parser for EArmObjPowerManagementProfileInfo.
|
||||
*/
|
||||
STATIC CONST CM_OBJ_PARSER CmArmPowerManagementProfileInfoParser[] = {
|
||||
{"PowerManagementProfile", 1, "0x%x", NULL}
|
||||
};
|
||||
|
||||
/** A parser for EArmObjGicCInfo.
|
||||
*/
|
||||
STATIC CONST CM_OBJ_PARSER CmArmGicCInfoParser[] = {
|
||||
{"CPUInterfaceNumber", 4, "0x%x", NULL},
|
||||
{"AcpiProcessorUid", 4, "0x%x", NULL},
|
||||
{"Flags", 4, "0x%x", NULL},
|
||||
{"ParkingProtocolVersion", 4, "0x%x", NULL},
|
||||
{"PerformanceInterruptGsiv", 4, "0x%x", NULL},
|
||||
{"ParkedAddress", 8, "0x%llx", NULL},
|
||||
{"PhysicalBaseAddress", 8, "0x%llx", NULL},
|
||||
{"GICV", 8, "0x%llx", NULL},
|
||||
{"GICH", 8, "0x%llx", NULL},
|
||||
{"VGICMaintenanceInterrupt", 4, "0x%x", NULL},
|
||||
{"GICRBaseAddress", 8, "0x%llx", NULL},
|
||||
{"MPIDR", 8, "0x%llx", NULL},
|
||||
{"ProcessorPowerEfficiencyClass", 1, "0x%x", NULL},
|
||||
{"SpeOverflowInterrupt", 2, "0x%x", NULL},
|
||||
{"ProximityDomain", 4, "0x%x", NULL},
|
||||
{"ClockDomain", 4, "0x%x", NULL},
|
||||
{"AffinityFlags", 4, "0x%x", NULL}
|
||||
};
|
||||
|
||||
/** A parser for EArmObjGicDInfo.
|
||||
*/
|
||||
STATIC CONST CM_OBJ_PARSER CmArmGicDInfoParser[] = {
|
||||
{"PhysicalBaseAddress", 8, "0x%llx", NULL},
|
||||
{"SystemVectorBase", 4, "0x%x", NULL},
|
||||
{"GicVersion", 1, "0x%x", NULL},
|
||||
};
|
||||
|
||||
/** A parser for EArmObjGicMsiFrameInfo.
|
||||
*/
|
||||
STATIC CONST CM_OBJ_PARSER CmArmGicMsiFrameInfoParser[] = {
|
||||
{"GicMsiFrameId", 4, "0x%x", NULL},
|
||||
{"PhysicalBaseAddress", 8, "0x%llx", NULL},
|
||||
{"Flags", 4, "0x%x", NULL},
|
||||
{"SPICount", 2, "0x%x", NULL},
|
||||
{"SPIBase", 2, "0x%x", NULL}
|
||||
};
|
||||
|
||||
/** A parser for EArmObjGicRedistributorInfo.
|
||||
*/
|
||||
STATIC CONST CM_OBJ_PARSER CmArmGicRedistInfoParser[] = {
|
||||
{"DiscoveryRangeBaseAddress", 8, "0x%llx", NULL},
|
||||
{"DiscoveryRangeLength", 4, "0x%x", NULL}
|
||||
};
|
||||
|
||||
/** A parser for EArmObjGicItsInfo.
|
||||
*/
|
||||
STATIC CONST CM_OBJ_PARSER CmArmGicItsInfoParser[] = {
|
||||
{"GicItsId", 4, "0x%x", NULL},
|
||||
{"PhysicalBaseAddress", 8, "0x%llx", NULL},
|
||||
{"ProximityDomain", 4, "0x%x", NULL}
|
||||
};
|
||||
|
||||
/** A parser for EArmObjSerialConsolePortInfo,
|
||||
EArmObjSerialDebugPortInfo and EArmObjSerialPortInfo.
|
||||
*/
|
||||
STATIC CONST CM_OBJ_PARSER CmArmSerialPortInfoParser[] = {
|
||||
{"BaseAddress", 8, "0x%llx", NULL},
|
||||
{"Interrupt", 4, "0x%x", NULL},
|
||||
{"BaudRate", 8, "0x%llx", NULL},
|
||||
{"Clock", 4, "0x%x", NULL},
|
||||
{"PortSubtype", 2, "0x%x", NULL},
|
||||
{"BaseAddressLength", 8, "0x%llx", NULL},
|
||||
{"AccessSize", 1, "0x%d", NULL}
|
||||
};
|
||||
|
||||
/** A parser for EArmObjGenericTimerInfo.
|
||||
*/
|
||||
STATIC CONST CM_OBJ_PARSER CmArmGenericTimerInfoParser[] = {
|
||||
{"CounterControlBaseAddress", 8, "0x%llx", NULL},
|
||||
{"CounterReadBaseAddress", 8, "0x%llx", NULL},
|
||||
{"SecurePL1TimerGSIV", 4, "0x%x", NULL},
|
||||
{"SecurePL1TimerFlags", 4, "0x%x", NULL},
|
||||
{"NonSecurePL1TimerGSIV", 4, "0x%x", NULL},
|
||||
{"NonSecurePL1TimerFlags", 4, "0x%x", NULL},
|
||||
{"VirtualTimerGSIV", 4, "0x%x", NULL},
|
||||
{"VirtualTimerFlags", 4, "0x%x", NULL},
|
||||
{"NonSecurePL2TimerGSIV", 4, "0x%x", NULL},
|
||||
{"NonSecurePL2TimerFlags", 4, "0x%x", NULL},
|
||||
{"VirtualPL2TimerGSIV", 4, "0x%x", NULL},
|
||||
{"VirtualPL2TimerFlags", 4, "0x%x", NULL}
|
||||
};
|
||||
|
||||
/** A parser for EArmObjPlatformGTBlockInfo.
|
||||
*/
|
||||
STATIC CONST CM_OBJ_PARSER CmArmGTBlockTimerFrameInfoParser[] = {
|
||||
{"FrameNumber", 1, "0x%x", NULL},
|
||||
{"PhysicalAddressCntBase", 8, "0x%llx", NULL},
|
||||
{"PhysicalAddressCntEL0Base", 8, "0x%llx", NULL},
|
||||
{"PhysicalTimerGSIV", 4, "0x%x", NULL},
|
||||
{"PhysicalTimerFlags", 4, "0x%x", NULL},
|
||||
{"VirtualTimerGSIV", 4, "0x%x", NULL},
|
||||
{"VirtualTimerFlags", 4, "0x%x", NULL},
|
||||
{"CommonFlags", 4, "0x%x", NULL}
|
||||
};
|
||||
|
||||
/** A parser for EArmObjGTBlockTimerFrameInfo.
|
||||
*/
|
||||
STATIC CONST CM_OBJ_PARSER CmArmGTBlockInfoParser[] = {
|
||||
{"GTBlockPhysicalAddress", 8, "0x%llx", NULL},
|
||||
{"GTBlockTimerFrameCount", 4, "0x%x", NULL},
|
||||
{"GTBlockTimerFrameToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL}
|
||||
};
|
||||
|
||||
/** A parser for EArmObjPlatformGenericWatchdogInfo.
|
||||
*/
|
||||
STATIC CONST CM_OBJ_PARSER CmArmGenericWatchdogInfoParser[] = {
|
||||
{"ControlFrameAddress", 8, "0x%llx", NULL},
|
||||
{"RefreshFrameAddress", 8, "0x%llx", NULL},
|
||||
{"TimerGSIV", 4, "0x%x", NULL},
|
||||
{"Flags", 4, "0x%x", NULL}
|
||||
};
|
||||
|
||||
/** A parser for EArmObjPciConfigSpaceInfo.
|
||||
*/
|
||||
STATIC CONST CM_OBJ_PARSER CmArmPciConfigSpaceInfoParser[] = {
|
||||
{"BaseAddress", 8, "0x%llx", NULL},
|
||||
{"PciSegmentGroupNumber", 2, "0x%x", NULL},
|
||||
{"StartBusNumber", 1, "0x%x", NULL},
|
||||
{"EndBusNumber", 1, "0x%x", NULL}
|
||||
};
|
||||
|
||||
/** A parser for EArmObjHypervisorVendorIdentity.
|
||||
*/
|
||||
STATIC CONST CM_OBJ_PARSER CmArmHypervisorVendorIdParser[] = {
|
||||
{"HypervisorVendorId", 8, "0x%llx", NULL}
|
||||
};
|
||||
|
||||
/** A parser for EArmObjFixedFeatureFlags.
|
||||
*/
|
||||
STATIC CONST CM_OBJ_PARSER CmArmFixedFeatureFlagsParser[] = {
|
||||
{"Flags", 4, "0x%x", NULL}
|
||||
};
|
||||
|
||||
/** A parser for EArmObjItsGroup.
|
||||
*/
|
||||
STATIC CONST CM_OBJ_PARSER CmArmItsGroupNodeParser[] = {
|
||||
{"Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
|
||||
{"ItsIdCount", 4, "0x%x", NULL},
|
||||
{"ItsIdToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL}
|
||||
};
|
||||
|
||||
/** A parser for EArmObjNamedComponent.
|
||||
*/
|
||||
STATIC CONST CM_OBJ_PARSER CmArmNamedComponentNodeParser[] = {
|
||||
{"Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
|
||||
{"IdMappingCount", 4, "0x%x", NULL},
|
||||
{"IdMappingToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
|
||||
{"Flags", 4, "0x%x", NULL},
|
||||
{"CacheCoherent", 4, "0x%x", NULL},
|
||||
{"AllocationHints", 1, "0x%x", NULL},
|
||||
{"MemoryAccessFlags", 1, "0x%x", NULL},
|
||||
{"AddressSizeLimit", 1, "0x%x", NULL},
|
||||
{"ObjectName", sizeof (CHAR8*), "%a", NULL}
|
||||
};
|
||||
|
||||
/** A parser for EArmObjRootComplex.
|
||||
*/
|
||||
STATIC CONST CM_OBJ_PARSER CmArmRootComplexNodeParser[] = {
|
||||
{"Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
|
||||
{"IdMappingCount", 4, "0x%x", NULL},
|
||||
{"IdMappingToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
|
||||
{"CacheCoherent", 4, "0x%x", NULL},
|
||||
{"AllocationHints", 1, "0x%x", NULL},
|
||||
{"MemoryAccessFlags", 1, "0x%x", NULL},
|
||||
{"AtsAttribute", 4, "0x%x", NULL},
|
||||
{"PciSegmentNumber", 4, "0x%x", NULL},
|
||||
{"MemoryAddressSize", 1, "0x%x", NULL}
|
||||
};
|
||||
|
||||
/** A parser for EArmObjSmmuV1SmmuV2.
|
||||
*/
|
||||
STATIC CONST CM_OBJ_PARSER CmArmSmmuV1SmmuV2NodeParser[] = {
|
||||
{"Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
|
||||
{"IdMappingCount", 4, "0x%x", NULL},
|
||||
{"IdMappingToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
|
||||
{"BaseAddress", 8, "0x%llx", NULL},
|
||||
{"Span", 8, "0x%llx", NULL},
|
||||
{"Model", 4, "0x%x", NULL},
|
||||
{"Flags", 4, "0x%x", NULL},
|
||||
{"ContextInterruptCount", 4, "0x%x", NULL},
|
||||
{"ContextInterruptToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
|
||||
{"PmuInterruptCount", 4, "0x%x", NULL},
|
||||
{"PmuInterruptToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
|
||||
{"SMMU_NSgIrpt", 4, "0x%x", NULL},
|
||||
{"SMMU_NSgIrptFlags", 4, "0x%x", NULL},
|
||||
{"SMMU_NSgCfgIrpt", 4, "0x%x", NULL},
|
||||
{"SMMU_NSgCfgIrptFlags", 4, "0x%x", NULL}
|
||||
};
|
||||
|
||||
/** A parser for EArmObjSmmuV3.
|
||||
*/
|
||||
STATIC CONST CM_OBJ_PARSER CmArmSmmuV3NodeParser[] = {
|
||||
{"Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
|
||||
{"IdMappingCount", 4, "0x%x", NULL},
|
||||
{"IdMappingToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
|
||||
{"BaseAddress", 8, "0x%llx", NULL},
|
||||
{"Flags", 4, "0x%x", NULL},
|
||||
{"VatosAddress", 8, "0x%llx", NULL},
|
||||
{"Model", 4, "0x%x", NULL},
|
||||
{"EventInterrupt", 4, "0x%x", NULL},
|
||||
{"PriInterrupt", 4, "0x%x", NULL},
|
||||
{"GerrInterrupt", 4, "0x%x", NULL},
|
||||
{"SyncInterrupt", 4, "0x%x", NULL},
|
||||
{"ProximityDomain", 4, "0x%x", NULL},
|
||||
{"DeviceIdMappingIndex", 4, "0x%x", NULL}
|
||||
};
|
||||
|
||||
/** A parser for EArmObjPmcg.
|
||||
*/
|
||||
STATIC CONST CM_OBJ_PARSER CmArmPmcgNodeParser[] = {
|
||||
{"Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
|
||||
{"IdMappingCount", 4, "0x%x", NULL},
|
||||
{"IdMappingToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
|
||||
{"BaseAddress", 8, "0x%llx", NULL},
|
||||
{"OverflowInterrupt", 4, "0x%x", NULL},
|
||||
{"Page1BaseAddress", 8, "0x%llx", NULL},
|
||||
{"ReferenceToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL}
|
||||
};
|
||||
|
||||
/** A parser for EArmObjGicItsIdentifierArray.
|
||||
*/
|
||||
STATIC CONST CM_OBJ_PARSER CmArmGicItsIdentifierParser[] = {
|
||||
{"ItsId", 4, "0x%x", NULL}
|
||||
};
|
||||
|
||||
/** A parser for EArmObjIdMappingArray.
|
||||
*/
|
||||
STATIC CONST CM_OBJ_PARSER CmArmIdMappingParser[] = {
|
||||
{"InputBase", 4, "0x%x", NULL},
|
||||
{"NumIds", 4, "0x%x", NULL},
|
||||
{"OutputBase", 4, "0x%x", NULL},
|
||||
{"OutputReferenceToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
|
||||
{"Flags", 4, "0x%x", NULL}
|
||||
};
|
||||
|
||||
/** A parser for EArmObjSmmuInterruptArray.
|
||||
*/
|
||||
STATIC CONST CM_OBJ_PARSER CmArmGenericInterruptParser[] = {
|
||||
{"Interrupt", 4, "0x%x", NULL},
|
||||
{"Flags", 4, "0x%x", NULL}
|
||||
};
|
||||
|
||||
/** A parser for EArmObjProcHierarchyInfo.
|
||||
*/
|
||||
STATIC CONST CM_OBJ_PARSER CmArmProcHierarchyInfoParser[] = {
|
||||
{"Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
|
||||
{"Flags", 4, "0x%x", NULL},
|
||||
{"ParentToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
|
||||
{"GicCToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
|
||||
{"NoOfPrivateResources", 4, "0x%x", NULL},
|
||||
{"PrivateResourcesArrayToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL}
|
||||
};
|
||||
|
||||
/** A parser for EArmObjCacheInfo.
|
||||
*/
|
||||
STATIC CONST CM_OBJ_PARSER CmArmCacheInfoParser[] = {
|
||||
{"Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
|
||||
{"NextLevelOfCacheToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
|
||||
{"Size", 4, "0x%x", NULL},
|
||||
{"NumberOfSets", 4, "0x%x", NULL},
|
||||
{"Associativity", 4, "0x%x", NULL},
|
||||
{"Attributes", 1, "0x%x", NULL},
|
||||
{"LineSize", 2, "0x%x", NULL}
|
||||
};
|
||||
|
||||
/** A parser for EArmObjProcNodeIdInfo.
|
||||
*/
|
||||
STATIC CONST CM_OBJ_PARSER CmArmProcNodeIdInfoParser[] = {
|
||||
{"Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
|
||||
{"VendorId", 4, "0x%p", NULL},
|
||||
{"Level1Id", 8, "0x%x", NULL},
|
||||
{"Level2Id", 8, "0x%x", NULL},
|
||||
{"MajorRev", 2, "0x%x", NULL},
|
||||
{"MinorRev", 2, "0x%x", NULL},
|
||||
{"SpinRev", 2, "0x%x", NULL}
|
||||
};
|
||||
|
||||
/** A parser for EArmObjCmRef.
|
||||
*/
|
||||
STATIC CONST CM_OBJ_PARSER CmArmObjRefParser[] = {
|
||||
{"ReferenceToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL}
|
||||
};
|
||||
|
||||
/** A parser for EArmObjMemoryAffinityInfo.
|
||||
*/
|
||||
STATIC CONST CM_OBJ_PARSER CmArmMemoryAffinityInfoParser[] = {
|
||||
{"ProximityDomain", 4, "0x%x", NULL},
|
||||
{"BaseAddress", 8, "0x%llx", NULL},
|
||||
{"Length", 8, "0x%llx", NULL},
|
||||
{"Flags", 4, "0x%x", NULL}
|
||||
};
|
||||
|
||||
/** A parser for EArmObjDeviceHandleAcpi.
|
||||
*/
|
||||
STATIC CONST CM_OBJ_PARSER CmArmDeviceHandleAcpiParser[] = {
|
||||
{"Hid", 8, "0x%llx", NULL},
|
||||
{"Uid", 4, "0x%x", NULL}
|
||||
};
|
||||
|
||||
/** A parser for EArmObjDeviceHandlePci.
|
||||
*/
|
||||
STATIC CONST CM_OBJ_PARSER CmArmDeviceHandlePciParser[] = {
|
||||
{"SegmentNumber", 2, "0x%x", NULL},
|
||||
{"BusNumber", 1, "0x%x", NULL},
|
||||
{"DeviceNumber", 1, "0x%x", NULL},
|
||||
{"FunctionNumber", 1, "0x%x", NULL}
|
||||
};
|
||||
|
||||
/** A parser for EArmObjGenericInitiatorAffinityInfo.
|
||||
*/
|
||||
STATIC CONST CM_OBJ_PARSER CmArmGenericInitiatorAffinityInfoParser[] = {
|
||||
{"ProximityDomain", 4, "0x%x", NULL},
|
||||
{"Flags", 4, "0x%x", NULL},
|
||||
{"DeviceHandleType", 1, "0x%x", NULL},
|
||||
{"DeviceHandleToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL}
|
||||
};
|
||||
|
||||
/** A parser for EArmObjCmn600Info.
|
||||
*/
|
||||
STATIC CONST CM_OBJ_PARSER CmArmCmn600InfoParser[] = {
|
||||
{"PeriphBaseAddress", 8, "0x%llx", NULL},
|
||||
{"PeriphBaseAddressLength", 8, "0x%llx", NULL},
|
||||
{"RootNodeBaseAddress", 8, "0x%llx", NULL},
|
||||
{"DtcCount", 1, "0x%x", NULL},
|
||||
{"DtcInterrupt[0]", 4, "0x%x", NULL},
|
||||
{"DtcFlags[0]", 4, "0x%x", NULL},
|
||||
{"DtcInterrupt[1]", 4, "0x%x", NULL},
|
||||
{"DtcFlags[1]", 4, "0x%x", NULL},
|
||||
{"DtcInterrupt[2]", 4, "0x%x", NULL},
|
||||
{"DtcFlags[2]", 4, "0x%x", NULL},
|
||||
{"DtcInterrupt[3]", 4, "0x%x", NULL},
|
||||
{"DtcFlags[3]", 4, "0x%x", NULL}
|
||||
};
|
||||
|
||||
/** A parser for the EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE structure.
|
||||
*/
|
||||
STATIC CONST CM_OBJ_PARSER AcpiGenericAddressParser[] = {
|
||||
{"AddressSpaceId", 1, "%d", NULL},
|
||||
{"RegisterBitWidth", 1, "%d", NULL},
|
||||
{"RegisterBitOffset", 1, "%d", NULL},
|
||||
{"AccessSize", 1, "%d", NULL},
|
||||
{"Address", 8, "0x%llx", NULL},
|
||||
};
|
||||
|
||||
/** A parser for EArmObjLpiInfo.
|
||||
*/
|
||||
STATIC CONST CM_OBJ_PARSER CmArmLpiInfoParser[] = {
|
||||
{"MinResidency", 4, "0x%llx", NULL},
|
||||
{"WorstCaseWakeLatency", 4, "0x%llx", NULL},
|
||||
{"Flags", 4, "0x%llx", NULL},
|
||||
{"ArchFlags", 4, "0x%llx", NULL},
|
||||
{"ResCntFreq", 4, "0x%llx", NULL},
|
||||
{"EnableParentState", 4, "0x%llx", NULL},
|
||||
{"IsInteger", 1, "%d", NULL},
|
||||
{"IntegerEntryMethod", 8, "0x%llx", NULL},
|
||||
{"RegisterEntryMethod", sizeof (EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE),
|
||||
NULL, NULL, AcpiGenericAddressParser,
|
||||
ARRAY_SIZE (AcpiGenericAddressParser)},
|
||||
{"ResidencyCounterRegister", sizeof (EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE),
|
||||
NULL, NULL, AcpiGenericAddressParser,
|
||||
ARRAY_SIZE (AcpiGenericAddressParser)},
|
||||
{"UsageCounterRegister", sizeof (EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE),
|
||||
NULL, NULL, AcpiGenericAddressParser,
|
||||
ARRAY_SIZE (AcpiGenericAddressParser)},
|
||||
{"StateName", 16, "0x%a", NULL},
|
||||
};
|
||||
|
||||
/** A parser for Arm namespace objects.
|
||||
*/
|
||||
STATIC CONST CM_OBJ_PARSER_ARRAY ArmNamespaceObjectParser[] = {
|
||||
{"EArmObjReserved", NULL, 0},
|
||||
{"EArmObjBootArchInfo", CmArmBootArchInfoParser,
|
||||
ARRAY_SIZE (CmArmBootArchInfoParser)},
|
||||
{"EArmObjCpuInfo", NULL, 0},
|
||||
{"EArmObjPowerManagementProfileInfo", CmArmPowerManagementProfileInfoParser,
|
||||
ARRAY_SIZE (CmArmPowerManagementProfileInfoParser)},
|
||||
{"EArmObjGicCInfo", CmArmGicCInfoParser, ARRAY_SIZE (CmArmGicCInfoParser)},
|
||||
{"EArmObjGicDInfo", CmArmGicDInfoParser, ARRAY_SIZE (CmArmGicDInfoParser)},
|
||||
{"EArmObjGicMsiFrameInfo", CmArmGicMsiFrameInfoParser,
|
||||
ARRAY_SIZE (CmArmGicMsiFrameInfoParser)},
|
||||
{"EArmObjGicRedistributorInfo", CmArmGicRedistInfoParser,
|
||||
ARRAY_SIZE (CmArmGicRedistInfoParser)},
|
||||
{"EArmObjGicItsInfo", CmArmGicItsInfoParser,
|
||||
ARRAY_SIZE (CmArmGicItsInfoParser)},
|
||||
{"EArmObjSerialConsolePortInfo", CmArmSerialPortInfoParser,
|
||||
ARRAY_SIZE (CmArmSerialPortInfoParser)},
|
||||
{"EArmObjSerialDebugPortInfo", CmArmSerialPortInfoParser,
|
||||
ARRAY_SIZE (CmArmSerialPortInfoParser)},
|
||||
{"EArmObjGenericTimerInfo", CmArmGenericTimerInfoParser,
|
||||
ARRAY_SIZE (CmArmGenericTimerInfoParser)},
|
||||
{"EArmObjPlatformGTBlockInfo", CmArmGTBlockTimerFrameInfoParser,
|
||||
ARRAY_SIZE (CmArmGTBlockTimerFrameInfoParser)},
|
||||
{"EArmObjGTBlockTimerFrameInfo", CmArmGTBlockInfoParser,
|
||||
ARRAY_SIZE (CmArmGTBlockInfoParser)},
|
||||
{"EArmObjPlatformGenericWatchdogInfo", CmArmGenericWatchdogInfoParser,
|
||||
ARRAY_SIZE (CmArmGenericWatchdogInfoParser)},
|
||||
{"EArmObjPciConfigSpaceInfo", CmArmPciConfigSpaceInfoParser,
|
||||
ARRAY_SIZE (CmArmPciConfigSpaceInfoParser)},
|
||||
{"EArmObjHypervisorVendorIdentity", CmArmHypervisorVendorIdParser,
|
||||
ARRAY_SIZE (CmArmHypervisorVendorIdParser)},
|
||||
{"EArmObjFixedFeatureFlags", CmArmFixedFeatureFlagsParser,
|
||||
ARRAY_SIZE (CmArmFixedFeatureFlagsParser)},
|
||||
{"EArmObjItsGroup", CmArmItsGroupNodeParser,
|
||||
ARRAY_SIZE (CmArmItsGroupNodeParser)},
|
||||
{"EArmObjNamedComponent", CmArmNamedComponentNodeParser,
|
||||
ARRAY_SIZE (CmArmNamedComponentNodeParser)},
|
||||
{"EArmObjRootComplex", CmArmRootComplexNodeParser,
|
||||
ARRAY_SIZE (CmArmRootComplexNodeParser)},
|
||||
{"EArmObjSmmuV1SmmuV2", CmArmSmmuV1SmmuV2NodeParser,
|
||||
ARRAY_SIZE (CmArmSmmuV1SmmuV2NodeParser)},
|
||||
{"EArmObjSmmuV3", CmArmSmmuV3NodeParser,
|
||||
ARRAY_SIZE (CmArmSmmuV3NodeParser)},
|
||||
{"EArmObjPmcg", CmArmPmcgNodeParser, ARRAY_SIZE (CmArmPmcgNodeParser)},
|
||||
{"EArmObjGicItsIdentifierArray", CmArmGicItsIdentifierParser,
|
||||
ARRAY_SIZE (CmArmGicItsIdentifierParser)},
|
||||
{"EArmObjIdMappingArray", CmArmIdMappingParser,
|
||||
ARRAY_SIZE (CmArmIdMappingParser)},
|
||||
{"EArmObjSmmuInterruptArray", CmArmGenericInterruptParser,
|
||||
ARRAY_SIZE (CmArmGenericInterruptParser)},
|
||||
{"EArmObjProcHierarchyInfo", CmArmProcHierarchyInfoParser,
|
||||
ARRAY_SIZE (CmArmProcHierarchyInfoParser)},
|
||||
{"EArmObjCacheInfo", CmArmCacheInfoParser,
|
||||
ARRAY_SIZE (CmArmCacheInfoParser)},
|
||||
{"EArmObjProcNodeIdInfo", CmArmProcNodeIdInfoParser,
|
||||
ARRAY_SIZE (CmArmProcNodeIdInfoParser)},
|
||||
{"EArmObjCmRef", CmArmObjRefParser, ARRAY_SIZE (CmArmObjRefParser)},
|
||||
{"EArmObjMemoryAffinityInfo", CmArmMemoryAffinityInfoParser,
|
||||
ARRAY_SIZE (CmArmMemoryAffinityInfoParser)},
|
||||
{"EArmObjDeviceHandleAcpi", CmArmDeviceHandleAcpiParser,
|
||||
ARRAY_SIZE (CmArmDeviceHandleAcpiParser)},
|
||||
{"EArmObjDeviceHandlePci", CmArmDeviceHandlePciParser,
|
||||
ARRAY_SIZE (CmArmDeviceHandlePciParser)},
|
||||
{"EArmObjGenericInitiatorAffinityInfo",
|
||||
CmArmGenericInitiatorAffinityInfoParser,
|
||||
ARRAY_SIZE (CmArmGenericInitiatorAffinityInfoParser)},
|
||||
{"EArmObjSerialPortInfo", CmArmSerialPortInfoParser,
|
||||
ARRAY_SIZE (CmArmSerialPortInfoParser)},
|
||||
{"EArmObjCmn600Info", CmArmCmn600InfoParser,
|
||||
ARRAY_SIZE (CmArmCmn600InfoParser)},
|
||||
{"EArmObjLpiInfo", CmArmLpiInfoParser,
|
||||
ARRAY_SIZE (CmArmLpiInfoParser)},
|
||||
{"EArmObjMax", NULL, 0},
|
||||
};
|
||||
|
||||
/** A parser for EStdObjCfgMgrInfo.
|
||||
*/
|
||||
STATIC CONST CM_OBJ_PARSER StdObjCfgMgrInfoParser[] = {
|
||||
{"Revision", 4, "0x%x", NULL},
|
||||
{"OemId[6]", 6, "%C%C%C%C%C%C", PrintOemId}
|
||||
};
|
||||
|
||||
/** A parser for EStdObjAcpiTableList.
|
||||
*/
|
||||
STATIC CONST CM_OBJ_PARSER StdObjAcpiTableInfoParser[] = {
|
||||
{"AcpiTableSignature", 4, "0x%x", NULL},
|
||||
{"AcpiTableRevision", 1, "%d", NULL},
|
||||
{"TableGeneratorId", sizeof (ACPI_TABLE_GENERATOR_ID), "0x%x", NULL},
|
||||
{"AcpiTableData", sizeof (EFI_ACPI_DESCRIPTION_HEADER*), "0x%p", NULL},
|
||||
{"OemTableId", 8, "0x%LLX", NULL},
|
||||
{"OemRevision", 4, "0x%x", NULL}
|
||||
};
|
||||
|
||||
/** A parser for EStdObjSmbiosTableList.
|
||||
*/
|
||||
STATIC CONST CM_OBJ_PARSER StdObjSmbiosTableInfoParser[] = {
|
||||
{"TableGeneratorId", sizeof (SMBIOS_TABLE_GENERATOR_ID), "0x%x", NULL},
|
||||
{"SmbiosTableData", sizeof (SMBIOS_STRUCTURE*), "0x%p", NULL}
|
||||
};
|
||||
|
||||
/** A parser for Standard namespace objects.
|
||||
*/
|
||||
STATIC CONST CM_OBJ_PARSER_ARRAY StdNamespaceObjectParser[] = {
|
||||
{"EStdObjCfgMgrInfo", StdObjCfgMgrInfoParser,
|
||||
ARRAY_SIZE (StdObjCfgMgrInfoParser)},
|
||||
{"EStdObjAcpiTableList", StdObjAcpiTableInfoParser,
|
||||
ARRAY_SIZE (StdObjAcpiTableInfoParser)},
|
||||
{"EStdObjSmbiosTableList", StdObjSmbiosTableInfoParser,
|
||||
ARRAY_SIZE (StdObjSmbiosTableInfoParser)},
|
||||
};
|
||||
|
||||
/** Print OEM Id.
|
||||
|
||||
@param [in] Format Format to print the Ptr.
|
||||
@param [in] Ptr Pointer to the OEM Id.
|
||||
**/
|
||||
STATIC
|
||||
VOID
|
||||
EFIAPI
|
||||
PrintOemId (
|
||||
IN CONST CHAR8 * Format,
|
||||
IN UINT8 * Ptr
|
||||
)
|
||||
{
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
(Format != NULL) ? Format : "%C%C%C%C%C%C",
|
||||
Ptr[0],
|
||||
Ptr[1],
|
||||
Ptr[2],
|
||||
Ptr[3],
|
||||
Ptr[4],
|
||||
Ptr[5]
|
||||
));
|
||||
}
|
||||
|
||||
/** Print fields of the objects.
|
||||
|
||||
@param [in] Data Pointer to the object to print.
|
||||
@param [in] Parser Parser containing the object fields.
|
||||
@param [in] ItemCount Number of entries/fields in the Parser.
|
||||
@param [in] RemainingSize Parse at most *RemainingSize bytes.
|
||||
This function decrements the value
|
||||
from the number bytes consumed.
|
||||
@param [in] IndentLevel Indentation to use when printing.
|
||||
**/
|
||||
STATIC
|
||||
VOID
|
||||
PrintCmObjDesc (
|
||||
IN VOID *Data,
|
||||
IN CONST CM_OBJ_PARSER *Parser,
|
||||
IN UINTN ItemCount,
|
||||
IN INTN *RemainingSize,
|
||||
IN UINT32 IndentLevel
|
||||
)
|
||||
{
|
||||
UINT32 Index;
|
||||
UINT32 IndentIndex;
|
||||
INTN SubStructSize;
|
||||
|
||||
if ((Data == NULL) ||
|
||||
(Parser == NULL) ||
|
||||
(ItemCount == 0) ||
|
||||
(RemainingSize == NULL)) {
|
||||
ASSERT (0);
|
||||
return;
|
||||
}
|
||||
|
||||
// Print each field.
|
||||
for (Index = 0; Index < ItemCount; Index++) {
|
||||
// Check there is enough space in left.
|
||||
*RemainingSize -= Parser[Index].Length;
|
||||
if (*RemainingSize < 0) {
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"\nERROR: %a: Buffer overrun\n",
|
||||
Parser[Index].NameStr
|
||||
));
|
||||
ASSERT (0);
|
||||
return;
|
||||
}
|
||||
|
||||
// Indentation
|
||||
for (IndentIndex = 0; IndentIndex < IndentLevel; IndentIndex++) {
|
||||
DEBUG ((DEBUG_ERROR, " "));
|
||||
}
|
||||
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%-*a :",
|
||||
OUTPUT_FIELD_COLUMN_WIDTH - 2 * IndentLevel,
|
||||
Parser[Index].NameStr
|
||||
));
|
||||
if (Parser[Index].PrintFormatter != NULL) {
|
||||
Parser[Index].PrintFormatter (Parser[Index].Format, Data);
|
||||
} else if (Parser[Index].Format != NULL) {
|
||||
switch (Parser[Index].Length) {
|
||||
case 1:
|
||||
DEBUG ((DEBUG_ERROR, Parser[Index].Format, *(UINT8*)Data));
|
||||
break;
|
||||
case 2:
|
||||
DEBUG ((DEBUG_ERROR, Parser[Index].Format, *(UINT16*)Data));
|
||||
break;
|
||||
case 4:
|
||||
DEBUG ((DEBUG_ERROR, Parser[Index].Format, *(UINT32*)Data));
|
||||
break;
|
||||
case 8:
|
||||
DEBUG ((DEBUG_ERROR, Parser[Index].Format, ReadUnaligned64(Data)));
|
||||
break;
|
||||
default:
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"\nERROR: %a: CANNOT PARSE THIS FIELD, Field Length = %d\n",
|
||||
Parser[Index].NameStr,
|
||||
Parser[Index].Length
|
||||
));
|
||||
} // switch
|
||||
} else if (Parser[Index].SubObjParser != NULL) {
|
||||
SubStructSize = Parser[Index].Length;
|
||||
|
||||
DEBUG ((DEBUG_ERROR, "\n"));
|
||||
PrintCmObjDesc (
|
||||
Data,
|
||||
Parser[Index].SubObjParser,
|
||||
Parser[Index].SubObjItemCount,
|
||||
&SubStructSize,
|
||||
IndentLevel + 1
|
||||
);
|
||||
} else {
|
||||
ASSERT (0);
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"\nERROR: %a: CANNOT PARSE THIS FIELD, Field Length = %d\n",
|
||||
Parser[Index].NameStr,
|
||||
Parser[Index].Length
|
||||
));
|
||||
}
|
||||
DEBUG ((DEBUG_ERROR, "\n"));
|
||||
Data = (UINT8*)Data + Parser[Index].Length;
|
||||
} // for
|
||||
}
|
||||
|
||||
/** Parse and print a CmObjDesc.
|
||||
|
||||
@param [in] CmObjDesc The CmObjDesc to parse and print.
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
ParseCmObjDesc (
|
||||
IN CONST CM_OBJ_DESCRIPTOR * CmObjDesc
|
||||
)
|
||||
{
|
||||
UINTN ObjId;
|
||||
UINTN NameSpaceId;
|
||||
UINT32 ObjIndex;
|
||||
UINT32 ObjectCount;
|
||||
INTN RemainingSize;
|
||||
CONST CM_OBJ_PARSER_ARRAY * ParserArray;
|
||||
|
||||
if ((CmObjDesc == NULL) || (CmObjDesc->Data == NULL)) {
|
||||
return;
|
||||
}
|
||||
|
||||
NameSpaceId = GET_CM_NAMESPACE_ID (CmObjDesc->ObjectId);
|
||||
ObjId = GET_CM_OBJECT_ID (CmObjDesc->ObjectId);
|
||||
|
||||
switch (NameSpaceId) {
|
||||
case EObjNameSpaceStandard:
|
||||
if (ObjId >= EStdObjMax) {
|
||||
ASSERT (0);
|
||||
return;
|
||||
}
|
||||
ParserArray = &StdNamespaceObjectParser[ObjId];
|
||||
break;
|
||||
case EObjNameSpaceArm:
|
||||
if (ObjId >= EArmObjMax) {
|
||||
ASSERT (0);
|
||||
return;
|
||||
}
|
||||
ParserArray = &ArmNamespaceObjectParser[ObjId];
|
||||
break;
|
||||
default:
|
||||
// Not supported
|
||||
ASSERT (0);
|
||||
return;
|
||||
} // switch
|
||||
|
||||
ObjectCount = CmObjDesc->Count;
|
||||
RemainingSize = CmObjDesc->Size;
|
||||
|
||||
for (ObjIndex = 0; ObjIndex < ObjectCount; ObjIndex++) {
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"\n%-*a [%d/%d]:\n",
|
||||
OUTPUT_FIELD_COLUMN_WIDTH,
|
||||
ParserArray->ObjectName,
|
||||
ObjIndex + 1,
|
||||
ObjectCount
|
||||
));
|
||||
PrintCmObjDesc (
|
||||
CmObjDesc->Data,
|
||||
ParserArray->Parser,
|
||||
ParserArray->ItemCount,
|
||||
&RemainingSize,
|
||||
1
|
||||
);
|
||||
} // for
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
/** @file
|
||||
Configuration Manager Object parser.
|
||||
|
||||
Copyright (c) 2021, ARM Limited. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#ifndef CONFIGURATION_MANAGER_OBJECT_PARSER_H_
|
||||
#define CONFIGURATION_MANAGER_OBJECT_PARSER_H_
|
||||
|
||||
#define OUTPUT_FIELD_COLUMN_WIDTH 32
|
||||
|
||||
/** Function prototype to format a field print.
|
||||
|
||||
@param [in] Format Format string for tracing the data as specified by
|
||||
the 'Format' member of ACPI_PARSER.
|
||||
@param [in] Ptr Pointer to the start of the buffer.
|
||||
**/
|
||||
typedef VOID (EFIAPI *FNPTR_PRINT_FORMATTER)(CONST CHAR8* Format, UINT8* Ptr);
|
||||
|
||||
/**
|
||||
The CM_OBJ_PARSER structure describes the fields of an CmObject and
|
||||
provides means for the parser to interpret and trace appropriately.
|
||||
|
||||
ParseAcpi() uses the format string specified by 'Format' for tracing
|
||||
the field data.
|
||||
*/
|
||||
typedef struct CmObjParser CM_OBJ_PARSER;
|
||||
struct CmObjParser {
|
||||
|
||||
/// String describing the Cm Object
|
||||
CONST CHAR8* NameStr;
|
||||
|
||||
/// The length of the field.
|
||||
UINT32 Length;
|
||||
|
||||
/// Optional Print() style format string for tracing the data. If not
|
||||
/// used this must be set to NULL.
|
||||
CONST CHAR8* Format;
|
||||
|
||||
/// Optional pointer to a print formatter function which
|
||||
/// is typically used to trace complex field information.
|
||||
/// If not used this must be set to NULL.
|
||||
/// The Format string is passed to the PrintFormatter function
|
||||
/// but may be ignored by the implementation code.
|
||||
FNPTR_PRINT_FORMATTER PrintFormatter;
|
||||
|
||||
/// Optional pointer to print the fields of another CM_OBJ_PARSER
|
||||
/// structure. This is useful to print sub-structures.
|
||||
CONST CM_OBJ_PARSER *SubObjParser;
|
||||
|
||||
/// Count of items in the SubObj.
|
||||
UINTN SubObjItemCount;
|
||||
};
|
||||
|
||||
/**
|
||||
A structure mapping an array of Configuration Manager Object parsers
|
||||
with their object names.
|
||||
*/
|
||||
typedef struct CmObjParserArray {
|
||||
|
||||
/// Object name
|
||||
CONST CHAR8 * ObjectName;
|
||||
|
||||
/// Function pointer to the parser
|
||||
CONST CM_OBJ_PARSER * Parser;
|
||||
|
||||
/// Count of items
|
||||
UINTN ItemCount;
|
||||
} CM_OBJ_PARSER_ARRAY;
|
||||
|
||||
#endif // CONFIGURATION_MANAGER_OBJECT_PARSER_H_
|
@ -122,11 +122,13 @@ AddAcpiHeader (
|
||||
ASSERT (CfgMgrProtocol != NULL);
|
||||
ASSERT (Generator != NULL);
|
||||
ASSERT (AcpiHeader != NULL);
|
||||
ASSERT (AcpiTableInfo != NULL);
|
||||
ASSERT (Length >= sizeof (EFI_ACPI_DESCRIPTION_HEADER));
|
||||
|
||||
if ((CfgMgrProtocol == NULL) ||
|
||||
(Generator == NULL) ||
|
||||
(AcpiHeader == NULL) ||
|
||||
(AcpiTableInfo == NULL) ||
|
||||
(Length < sizeof (EFI_ACPI_DESCRIPTION_HEADER))
|
||||
) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
@ -183,6 +185,93 @@ error_handler:
|
||||
return Status;
|
||||
}
|
||||
|
||||
/** Build a RootNode containing SSDT ACPI header information using the AmlLib.
|
||||
|
||||
The function utilizes the ACPI table Generator and the Configuration
|
||||
Manager protocol to obtain any information required for constructing the
|
||||
header. It then creates a RootNode. The SSDT ACPI header is part of the
|
||||
RootNode.
|
||||
|
||||
This is essentially a wrapper around AmlCodeGenDefinitionBlock ()
|
||||
from the AmlLib.
|
||||
|
||||
@param [in] CfgMgrProtocol Pointer to the Configuration Manager
|
||||
protocol interface.
|
||||
@param [in] Generator Pointer to the ACPI table Generator.
|
||||
@param [in] AcpiTableInfo Pointer to the ACPI table info structure.
|
||||
@param [out] RootNode If success, contains the created RootNode.
|
||||
The SSDT ACPI header is part of the RootNode.
|
||||
|
||||
@retval EFI_SUCCESS Success.
|
||||
@retval EFI_INVALID_PARAMETER A parameter is invalid.
|
||||
@retval EFI_NOT_FOUND The required object information is not found.
|
||||
@retval EFI_BAD_BUFFER_SIZE The size returned by the Configuration
|
||||
Manager is less than the Object size for the
|
||||
requested object.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AddSsdtAcpiHeader (
|
||||
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol,
|
||||
IN CONST ACPI_TABLE_GENERATOR * CONST Generator,
|
||||
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo,
|
||||
OUT AML_ROOT_NODE_HANDLE * RootNode
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINT64 OemTableId;
|
||||
UINT32 OemRevision;
|
||||
CM_STD_OBJ_CONFIGURATION_MANAGER_INFO * CfgMfrInfo;
|
||||
|
||||
ASSERT (CfgMgrProtocol != NULL);
|
||||
ASSERT (Generator != NULL);
|
||||
ASSERT (AcpiTableInfo != NULL);
|
||||
|
||||
if ((CfgMgrProtocol == NULL) ||
|
||||
(Generator == NULL) ||
|
||||
(AcpiTableInfo == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Status = GetCgfMgrInfo (CfgMgrProtocol, &CfgMfrInfo);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"ERROR: Failed to get Configuration Manager info. Status = %r\n",
|
||||
Status
|
||||
));
|
||||
return Status;
|
||||
}
|
||||
|
||||
if (AcpiTableInfo->OemTableId != 0) {
|
||||
OemTableId = AcpiTableInfo->OemTableId;
|
||||
} else {
|
||||
OemTableId = SIGNATURE_32 (
|
||||
CfgMfrInfo->OemId[0],
|
||||
CfgMfrInfo->OemId[1],
|
||||
CfgMfrInfo->OemId[2],
|
||||
CfgMfrInfo->OemId[3]
|
||||
) |
|
||||
((UINT64)Generator->AcpiTableSignature << 32);
|
||||
}
|
||||
|
||||
if (AcpiTableInfo->OemRevision != 0) {
|
||||
OemRevision = AcpiTableInfo->OemRevision;
|
||||
} else {
|
||||
OemRevision = CfgMfrInfo->Revision;
|
||||
}
|
||||
|
||||
Status = AmlCodeGenDefinitionBlock (
|
||||
"SSDT",
|
||||
(CONST CHAR8*)&CfgMfrInfo->OemId,
|
||||
(CONST CHAR8*)&OemTableId,
|
||||
OemRevision,
|
||||
RootNode
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
/**
|
||||
Test and report if a duplicate entry exists in the given array of comparable
|
||||
elements.
|
||||
@ -245,99 +334,3 @@ FindDuplicateValue (
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/** Convert a hex number to its ASCII code.
|
||||
|
||||
@param [in] x Hex number to convert.
|
||||
Must be 0 <= x < 16.
|
||||
|
||||
@return The ASCII code corresponding to x.
|
||||
**/
|
||||
UINT8
|
||||
EFIAPI
|
||||
AsciiFromHex (
|
||||
IN UINT8 x
|
||||
)
|
||||
{
|
||||
if (x < 10) {
|
||||
return (UINT8)(x + '0');
|
||||
}
|
||||
|
||||
if (x < 16) {
|
||||
return (UINT8)(x - 10 + 'A');
|
||||
}
|
||||
|
||||
ASSERT (FALSE);
|
||||
return (UINT8)0;
|
||||
}
|
||||
|
||||
/** Check if a HID is a valid PNP ID.
|
||||
|
||||
@param [in] Hid The Hid to validate.
|
||||
|
||||
@retval TRUE The Hid is a valid PNP ID.
|
||||
@retval FALSE The Hid is not a valid PNP ID.
|
||||
**/
|
||||
BOOLEAN
|
||||
IsValidPnpId (
|
||||
IN CONST CHAR8 * Hid
|
||||
)
|
||||
{
|
||||
UINTN Index;
|
||||
|
||||
if (AsciiStrLen (Hid) != 7) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// A valid PNP ID must be of the form "AAA####"
|
||||
// where A is an uppercase letter and # is a hex digit.
|
||||
for (Index = 0; Index < 3; Index++) {
|
||||
if (!IS_UPPER_CHAR (Hid[Index])) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
for (Index = 3; Index < 7; Index++) {
|
||||
if (!IS_UPPER_HEX (Hid[Index])) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/** Check if a HID is a valid ACPI ID.
|
||||
|
||||
@param [in] Hid The Hid to validate.
|
||||
|
||||
@retval TRUE The Hid is a valid ACPI ID.
|
||||
@retval FALSE The Hid is not a valid ACPI ID.
|
||||
**/
|
||||
BOOLEAN
|
||||
IsValidAcpiId (
|
||||
IN CONST CHAR8 * Hid
|
||||
)
|
||||
{
|
||||
UINTN Index;
|
||||
|
||||
if (AsciiStrLen (Hid) != 8) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// A valid ACPI ID must be of the form "NNNN####"
|
||||
// where N is an uppercase letter or a digit ('0'-'9')
|
||||
// and # is a hex digit.
|
||||
for (Index = 0; Index < 4; Index++) {
|
||||
if (!(IS_UPPER_CHAR (Hid[Index]) || IS_DIGIT (Hid[Index]))) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
for (Index = 4; Index < 8; Index++) {
|
||||
if (!IS_UPPER_HEX (Hid[Index])) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user