[PATCH v2 2/6] Platform/RaspberryPi: Break XHCI into its own SSDT
Lets prepare to switch between XHCI and PCI by moving the XHCI definition into its own SSDT. That way we can select it based on the menu settings. The resource producer/consumer flag is also corrected.
Reviewed-by: Andrei Warkentin <awarkentin@...> Signed-off-by: Jeremy Linton <jeremy.linton@...> --- Platform/RaspberryPi/AcpiTables/AcpiTables.inf | 1 + Platform/RaspberryPi/AcpiTables/Dsdt.asl | 3 -- Platform/RaspberryPi/AcpiTables/Xhci.asl | 35 ++++++++++++++--= ------ Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c | 8 +++++ 4 files changed, 31 insertions(+), 16 deletions(-)
diff --git a/Platform/RaspberryPi/AcpiTables/AcpiTables.inf b/Platform/Ra= spberryPi/AcpiTables/AcpiTables.inf index 1ddc9ca5fe..f3e8d950c1 100644 --- a/Platform/RaspberryPi/AcpiTables/AcpiTables.inf +++ b/Platform/RaspberryPi/AcpiTables/AcpiTables.inf @@ -38,6 +38,7 @@ SpcrPl011.aslc Pptt.aslc SsdtThermal.asl + Xhci.asl =20 [Packages] ArmPkg/ArmPkg.dec diff --git a/Platform/RaspberryPi/AcpiTables/Dsdt.asl b/Platform/Raspberr= yPi/AcpiTables/Dsdt.asl index 1ee6379f46..b594d50bdf 100644 --- a/Platform/RaspberryPi/AcpiTables/Dsdt.asl +++ b/Platform/RaspberryPi/AcpiTables/Dsdt.asl @@ -64,9 +64,6 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 2, "RPIFDN", "RPI"= , 2) Scope (\_SB_) { include ("Pep.asl") -#if (RPI_MODEL =3D=3D 4) - include ("Xhci.asl") -#endif =20 Device (CPU0) { diff --git a/Platform/RaspberryPi/AcpiTables/Xhci.asl b/Platform/Raspberr= yPi/AcpiTables/Xhci.asl index bc3fea60f9..9b37277956 100644 --- a/Platform/RaspberryPi/AcpiTables/Xhci.asl +++ b/Platform/RaspberryPi/AcpiTables/Xhci.asl @@ -9,6 +9,8 @@ =20 #include <IndustryStandard/Bcm2711.h> =20 +#include "AcpiTables.h" + /* * The following can be used to remove parenthesis from * defined macros that the compiler complains about. @@ -24,12 +26,17 @@ */ #define XHCI_REG_LENGTH 0x1000 =20 -Device (SCB0) { - Name (_HID, "ACPI0004") - Name (_UID, 0x0) - Name (_CCA, 0x0) +DefinitionBlock (__FILE__, "SSDT", 5, "RPIFDN", "RPI4XHCI", 2) +{ + Scope (\_SB_) + { + + Device (SCB0) { + Name (_HID, "ACPI0004") + Name (_UID, 0x0) + Name (_CCA, 0x0) =20 - Method (_CRS, 0, Serialized) { // _CRS: Current Resource Settings + Method (_CRS, 0, Serialized) { // _CRS: Current Resource Settings /* * Container devices with _DMA must have _CRS, meaning SCB0 * to provide all resources that XHC0 consumes (except @@ -57,15 +64,15 @@ Device (SCB0) { Add (MMBE, XHCI_REG_LENGTH - 1, MMBE) Add (MMLE, XHCI_REG_LENGTH - 1, MMLE) Return (RBUF) - } + } =20 - Name (_DMA, ResourceTemplate() { + Name (_DMA, ResourceTemplate() { /* * XHC0 is limited to DMA to first 3GB. Note this * only applies to PCIe, not GENET or other devices * next to the A72. */ - QWordMemory (ResourceConsumer, + QWordMemory (ResourceProducer, , MinFixed, MaxFixed, @@ -79,10 +86,10 @@ Device (SCB0) { , , ) - }) + }) =20 - Device (XHC0) - { + Device (XHC0) + { Name (_HID, "PNP0D10") // _HID: Hardware ID Name (_UID, 0x0) // _UID: Unique ID Name (_CCA, 0x0) // _CCA: Cache Coherency Attribute @@ -131,5 +138,7 @@ Device (SCB0) { Debug =3D "xHCI enable" Store (0x6, CMND) } - } -} + } // end XHC0 + } //end SCB0 + } //end scope sb +} //end definition block diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c b/Platfor= m/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c index 87f6b4e7bb..7c5786303d 100644 --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c @@ -814,6 +814,14 @@ STATIC CONST NAMESPACE_TABLES SdtTables[] =3D { PcdToken(PcdSdIsArasan), SsdtEmmcNameOpReplace }, +#if (RPI_MODEL =3D=3D 4) + { + SIGNATURE_64 ('R', 'P', 'I', '4', 'X', 'H', 'C', 'I'), + 0, + PcdToken(PcdXhciPci), + NULL + }, +#endif { // DSDT SIGNATURE_64 ('R', 'P', 'I', 0, 0, 0, 0, 0), 0, --=20 2.13.7
|
|
[PATCH v2 1/6] Platform/RaspberryPi: Add XHCI/PCI selection menu
Arm has standardized a PCI SMC conduit that can be used to access the PCI config space in a standardized way. This functionality doesn't yet exist in many OS/Distro's. Lets add another advanced config item that allows the user to toggle between presenting the XHCI on the base RPi4 as a platform device, or presenting this newer PCIe conduit. The CM4 doesn't have an attached XHCI controller soldered to the PCIe, so PCIe mode is the default.
Signed-off-by: Jeremy Linton <jeremy.linton@...> --- Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c | 42 ++++++++++++++++= ++++++ .../RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf | 1 + .../RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni | 5 +++ .../RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr | 17 +++++++++ Platform/RaspberryPi/Include/ConfigVars.h | 4 +++ Platform/RaspberryPi/RPi3/RPi3.dsc | 6 ++++ Platform/RaspberryPi/RPi4/RPi4.dsc | 8 +++++ Platform/RaspberryPi/RaspberryPi.dec | 1 + 8 files changed, 84 insertions(+)
diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c b/Platfor= m/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c index 9e78cb47ad..87f6b4e7bb 100644 --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c @@ -43,6 +43,7 @@ extern UINT8 ConfigDxeStrings[]; STATIC RASPBERRY_PI_FIRMWARE_PROTOCOL *mFwProtocol; STATIC UINT32 mModelFamily =3D 0; STATIC UINT32 mModelInstalledMB =3D 0; +STATIC UINT32 mModelRevision =3D 0; =20 STATIC EFI_MAC_ADDRESS mMacAddress; =20 @@ -271,6 +272,40 @@ SetupVariables ( ASSERT_EFI_ERROR (Status); } =20 + if (mModelFamily >=3D 4) { + if (((mModelRevision >> 4) & 0xFF) =3D=3D 0x14) { + /* + * Enable PCIe by default on CM4 + */ + Status =3D PcdSet32S (PcdXhciPci, 2); + ASSERT_EFI_ERROR (Status); + } else { + Size =3D sizeof (UINT32); + Status =3D gRT->GetVariable (L"XhciPci", + &gConfigDxeFormSetGuid, + NULL, &Size, &Var32); + if (EFI_ERROR (Status) || (Var32 =3D=3D 0)) { + /* + * Enable XHCI by default + */ + Status =3D PcdSet32S (PcdXhciPci, 0); + ASSERT_EFI_ERROR (Status); + } else { + /*=20 + * Enable PCIe + */ + Status =3D PcdSet32S (PcdXhciPci, 1); + ASSERT_EFI_ERROR (Status); + } + } + } else { + /*=20 + * Disable PCIe and XHCI + */ + Status =3D PcdSet32S (PcdXhciPci, 0); + ASSERT_EFI_ERROR (Status); + } + Size =3D sizeof (AssetTagVar); Status =3D gRT->GetVariable (L"AssetTag", &gConfigDxeFormSetGuid, @@ -888,6 +923,13 @@ ConfigInitialize ( DEBUG ((DEBUG_INFO, "Current Raspberry Pi installed RAM size is %d M= B\n", mModelInstalledMB)); } =20 + Status =3D mFwProtocol->GetModelRevision (&mModelRevision); + if (Status !=3D EFI_SUCCESS) { + DEBUG ((DEBUG_ERROR, "Couldn't get the Raspberry Pi revision: %r\n",= Status)); + } else { + DEBUG ((DEBUG_INFO, "Current Raspberry Pi revision %x\n", mModelRevi= sion)); + } + Status =3D SetupVariables (); if (Status !=3D EFI_SUCCESS) { DEBUG ((DEBUG_ERROR, "Couldn't not setup NV vars: %r\n", Status)); diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf b/Platf= orm/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf index 4bb2d08550..e6e22ad82e 100644 --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf @@ -94,6 +94,7 @@ gRaspberryPiTokenSpaceGuid.PcdFanOnGpio gRaspberryPiTokenSpaceGuid.PcdFanTemp gRaspberryPiTokenSpaceGuid.PcdUartInUse + gRaspberryPiTokenSpaceGuid.PcdXhciPci =20 [Depex] gPcdProtocolGuid AND gRaspberryPiFirmwareProtocolGuid diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni b/Pl= atform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni index 466fa852cb..5ec17072c3 100644 --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni @@ -57,6 +57,11 @@ #string STR_ADVANCED_FANTEMP_PROMPT #language en-US "ACPI fan temperat= ure" #string STR_ADVANCED_FANTEMP_HELP #language en-US "Cycle a fan at C" =20 +#string STR_ADVANCED_XHCIPCI_PROMPT #language en-US "ACPI XHCI/PCIe" +#string STR_ADVANCED_XHCIPCI_HELP #language en-US "OS sees XHCI USB = platform device or PCIe bridge" +#string STR_ADVANCED_XHCIPCI_XHCI #language en-US "XHCI" +#string STR_ADVANCED_XHCIPCI_PCIE #language en-US "PCIe" + #string STR_ADVANCED_ASSET_TAG_PROMPT #language en-US "Asset Tag" #string STR_ADVANCED_ASSET_TAG_HELP #language en-US "Set the system As= set Tag" =20 diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr b/Pl= atform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr index fa34eab809..18b3ec726e 100644 --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr @@ -56,6 +56,11 @@ formset name =3D FanTemp, guid =3D CONFIGDXE_FORM_SET_GUID; =20 + efivarstore ADVANCED_XHCIPCI_VARSTORE_DATA, + attribute =3D EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTI= ME_ACCESS | EFI_VARIABLE_NON_VOLATILE, + name =3D XhciPci, + guid =3D CONFIGDXE_FORM_SET_GUID; + efivarstore SYSTEM_TABLE_MODE_VARSTORE_DATA, attribute =3D EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTI= ME_ACCESS | EFI_VARIABLE_NON_VOLATILE, name =3D SystemTableMode, @@ -212,6 +217,18 @@ formset default =3D 60, endnumeric; endif; + + suppressif ideqval XhciPci.Value =3D=3D 2; + grayoutif NOT ideqval SystemTableMode.Mode =3D=3D SYSTEM_TABLE= _MODE_ACPI; + oneof varid =3D XhciPci.Value, + prompt =3D STRING_TOKEN(STR_ADVANCED_XHCIPCI_PROMPT), + help =3D STRING_TOKEN(STR_ADVANCED_XHCIPCI_HELP), + flags =3D NUMERIC_SIZE_4 | INTERACTIVE | RESET_REQUI= RED, + option text =3D STRING_TOKEN(STR_ADVANCED_XHCIPCI_XHCI), v= alue =3D 0, flags =3D DEFAULT; + option text =3D STRING_TOKEN(STR_ADVANCED_XHCIPCI_PCIE), v= alue =3D 1, flags =3D 0; + endoneof; + endif; + endif; #endif string varid =3D AssetTag.AssetTag, prompt =3D STRING_TOKEN(STR_ADVANCED_ASSET_TAG_PROMPT), diff --git a/Platform/RaspberryPi/Include/ConfigVars.h b/Platform/Raspber= ryPi/Include/ConfigVars.h index 142317985a..a5b32b5284 100644 --- a/Platform/RaspberryPi/Include/ConfigVars.h +++ b/Platform/RaspberryPi/Include/ConfigVars.h @@ -77,6 +77,10 @@ typedef struct { } ADVANCED_FANTEMP_VARSTORE_DATA; =20 typedef struct { + UINT32 Value; +} ADVANCED_XHCIPCI_VARSTORE_DATA; + +typedef struct { #define SYSTEM_TABLE_MODE_ACPI 0 #define SYSTEM_TABLE_MODE_BOTH 1 #define SYSTEM_TABLE_MODE_DT 2 diff --git a/Platform/RaspberryPi/RPi3/RPi3.dsc b/Platform/RaspberryPi/RP= i3/RPi3.dsc index 1c8a5408e7..6ab5d1ae6d 100644 --- a/Platform/RaspberryPi/RPi3/RPi3.dsc +++ b/Platform/RaspberryPi/RPi3/RPi3.dsc @@ -520,6 +520,12 @@ =20 gRaspberryPiTokenSpaceGuid.PcdPlatformResetDelay|L"ResetDelay"|gRaspbe= rryPiTokenSpaceGuid|0x0|0 =20 + # Select XHCI/PCIe mode (not valid on rpi3) + # + # 0 - DISABLED + # + gRaspberryPiTokenSpaceGuid.PcdXhciPci|L"XhciPci"|gConfigDxeFormSetGuid= |0x0|0 + # # Common UEFI ones. # diff --git a/Platform/RaspberryPi/RPi4/RPi4.dsc b/Platform/RaspberryPi/RP= i4/RPi4.dsc index dcf9bb5f11..babcbb2f41 100644 --- a/Platform/RaspberryPi/RPi4/RPi4.dsc +++ b/Platform/RaspberryPi/RPi4/RPi4.dsc @@ -536,6 +536,14 @@ =20 gRaspberryPiTokenSpaceGuid.PcdPlatformResetDelay|L"ResetDelay"|gRaspbe= rryPiTokenSpaceGuid|0x0|0 =20 + # Select XHCI/PCIe mode + # + # 0 - XHCI Enabled (default on !cm4) + # 1 - PCIe Enabled + # 2 - PCIe Enabled (default on cm4) + # + gRaspberryPiTokenSpaceGuid.PcdXhciPci|L"XhciPci"|gConfigDxeFormSetGuid= |0x0|0 + # # Common UEFI ones. # diff --git a/Platform/RaspberryPi/RaspberryPi.dec b/Platform/RaspberryPi/= RaspberryPi.dec index 2ca25ff9e6..797be59274 100644 --- a/Platform/RaspberryPi/RaspberryPi.dec +++ b/Platform/RaspberryPi/RaspberryPi.dec @@ -71,3 +71,4 @@ gRaspberryPiTokenSpaceGuid.PcdPlatformResetDelay|0|UINT32|0x0000001E gRaspberryPiTokenSpaceGuid.PcdMmcEnableDma|0|UINT32|0x0000001F gRaspberryPiTokenSpaceGuid.PcdUartInUse|1|UINT32|0x00000021 + gRaspberryPiTokenSpaceGuid.PcdXhciPci|0|UINT32|0x00000022 --=20 2.13.7
|
|
[PATCH v2 0/6] RPi4: Enable ACPI PCIe conduit
A new Arm standard DEN0115A specifies how platforms that don't have standard ECAM can use the firmware to handle config read/write operations. This is mostly implemented in TFA but UEFI needs to assure that there is a description of the root complex in the ACPI namespace.
This set adds that description based on a new menu item which toggles between XHCI platform description and PCIe via a BDS menu selection on the RPi4. The CM4 is really the platform that needs this as it has a PCIe slot. On that platform PCIe is enabled by default.
v1->v2: Use global shared interrupts in PCI PRT which is a pretty significant simplification. Modify bus max to use the secondary side of the root port for enforcing device limits Various other AML cleanups per Ard (drop redundant _DMA, bump UID to make it unique, etc) Break link status move into its own patch MADT->MCFG typos in various comments Commit message tweaking =09 Jeremy Linton (6): Platform/RaspberryPi: Add XHCI/PCI selection menu Platform/RaspberryPi: Break XHCI into its own SSDT Platform/RaspberryPi: Add PCIe SSDT Silicon/Broadcom/Bcm27xx: Relax PCIe device restriction Silicon/Broadcom/Bcm27xx: Move linkup check into the cfg accessor Platform/RaspberryPi: Enable NVMe boot on CM4
Platform/RaspberryPi/AcpiTables/AcpiTables.inf | 4 + Platform/RaspberryPi/AcpiTables/Dsdt.asl | 3 - Platform/RaspberryPi/AcpiTables/Pci.asl | 209 +++++++++++++++= ++++++ Platform/RaspberryPi/AcpiTables/Xhci.asl | 35 ++-- Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c | 56 ++++++ .../RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf | 1 + .../RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni | 5 + .../RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr | 17 ++ Platform/RaspberryPi/Include/ConfigVars.h | 4 + Platform/RaspberryPi/RPi3/RPi3.dsc | 6 + Platform/RaspberryPi/RPi4/RPi4.dsc | 13 ++ Platform/RaspberryPi/RPi4/RPi4.fdf | 5 + Platform/RaspberryPi/RaspberryPi.dec | 1 + .../Bcm2711PciHostBridgeLibConstructor.c | 5 - .../Library/Bcm2711PciSegmentLib/PciSegmentLib.c | 28 ++- 15 files changed, 364 insertions(+), 28 deletions(-) create mode 100644 Platform/RaspberryPi/AcpiTables/Pci.asl
--=20 2.13.7
|
|
Cancelled Event: TianoCore Bug Triage - APAC / NAMO - Tuesday, August 10, 2021
#cal-cancelled
devel@edk2.groups.io Calendar <noreply@...>
Cancelled: TianoCore Bug Triage - APAC / NAMO
This event has been cancelled.
When:
Tuesday, August 10, 2021
6:30pm to 7:30pm
(UTC-07:00) America/Los Angeles
Where:
https://teams.microsoft.com/l/meetup-join/19%3ameeting_OTUyZTg2NjgtNDhlNS00ODVlLTllYTUtYzg1OTNjNjdiZjFh%40thread.v2/0?context=%7b%22Tid%22%3a%2246c98d88-e344-4ed4-8496-4ed7712e255d%22%2c%22Oid%22%3a%22b286b53a-1218-4db3-bfc9-3d4c5aa7669e%22%7d
Organizer: Liming Gao
gaoliming@...
Description:
TianoCore Bug Triage - APAC / NAMO
Hosted by Liming Gao
________________________________________________________________________________
Microsoft Teams meeting
Join on your computer or mobile app
Click here to join the meeting
Join with a video conferencing device
teams@...
Video Conference ID: 116 062 094 0
Alternate VTC dialing instructions
Or call in (audio only)
+1 916-245-6934,,77463821# United States, Sacramento
Phone Conference ID: 774 638 21#
Find a local number | Reset PIN
Learn More | Meeting options
|
|
回复: [edk2-devel] Event: TianoCore Bug Triage - APAC / NAMO - 08/10/2021
#cal-reminder
Hi, all Few issues are submitted this week. Let’s cancel this week meeting. Thanks Liming
|
|
Re: [PATCH v2 1/1] MdeModulePkg/PiSmmCore: Drop deprecated image profiling commands
Thank you very much!!
Reviewed-by: Ray Ni <ray.ni@...>
I will merge your patches after stable tag release.
toggle quoted messageShow quoted text
-----Original Message----- From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Marvin Häuser Sent: Monday, August 9, 2021 2:09 PM To: devel@edk2.groups.io Cc: Wang, Jian J <jian.j.wang@...>; Wu, Hao A <hao.a.wu@...>; Dong, Eric <eric.dong@...>; Ni, Ray <ray.ni@...>; Vitaly Cheptsov <vit9696@...> Subject: [edk2-devel] [PATCH v2 1/1] MdeModulePkg/PiSmmCore: Drop deprecated image profiling commands
The legacy codebase allowed SMM images to be registered for profiling from DXE. Support for this has been dropped entirely, so remove the remaining handlers.
Cc: Jian J Wang <jian.j.wang@...> Cc: Hao A Wu <hao.a.wu@...> Cc: Eric Dong <eric.dong@...> Cc: Ray Ni <ray.ni@...> Cc: Vitaly Cheptsov <vit9696@...> Signed-off-by: Marvin Häuser <mhaeuser@...> --- MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c | 89 ++------------------ MdeModulePkg/Include/Guid/MemoryProfile.h | 6 +- 2 files changed, 12 insertions(+), 83 deletions(-)
diff --git a/MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c b/MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c index 1b302c810cc9..9d6e3bf27aca 100644 --- a/MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c +++ b/MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c @@ -2232,64 +2232,6 @@ Done: mSmramProfileGettingStatus = SmramProfileGettingStatus;
}
-/**
- SMRAM profile handler to register SMM image.
-
- @param SmramProfileParameterRegisterImage The parameter of SMM profile register image.
-
-**/
-VOID
-SmramProfileHandlerRegisterImage (
- IN SMRAM_PROFILE_PARAMETER_REGISTER_IMAGE *SmramProfileParameterRegisterImage
- )
-{
- EFI_STATUS Status;
- EFI_SMM_DRIVER_ENTRY DriverEntry;
- VOID *EntryPointInImage;
-
- ZeroMem (&DriverEntry, sizeof (DriverEntry));
- CopyMem (&DriverEntry.FileName, &SmramProfileParameterRegisterImage->FileName, sizeof(EFI_GUID));
- DriverEntry.ImageBuffer = SmramProfileParameterRegisterImage->ImageBuffer;
- DriverEntry.NumberOfPage = (UINTN) SmramProfileParameterRegisterImage->NumberOfPage;
- Status = InternalPeCoffGetEntryPoint ((VOID *) (UINTN) DriverEntry.ImageBuffer, &EntryPointInImage);
- ASSERT_EFI_ERROR (Status);
- DriverEntry.ImageEntryPoint = (PHYSICAL_ADDRESS) (UINTN) EntryPointInImage;
-
- Status = RegisterSmramProfileImage (&DriverEntry, FALSE);
- if (!EFI_ERROR (Status)) {
- SmramProfileParameterRegisterImage->Header.ReturnStatus = 0;
- }
-}
-
-/**
- SMRAM profile handler to unregister SMM image.
-
- @param SmramProfileParameterUnregisterImage The parameter of SMM profile unregister image.
-
-**/
-VOID
-SmramProfileHandlerUnregisterImage (
- IN SMRAM_PROFILE_PARAMETER_UNREGISTER_IMAGE *SmramProfileParameterUnregisterImage
- )
-{
- EFI_STATUS Status;
- EFI_SMM_DRIVER_ENTRY DriverEntry;
- VOID *EntryPointInImage;
-
- ZeroMem (&DriverEntry, sizeof (DriverEntry));
- CopyMem (&DriverEntry.FileName, &SmramProfileParameterUnregisterImage->FileName, sizeof (EFI_GUID));
- DriverEntry.ImageBuffer = SmramProfileParameterUnregisterImage->ImageBuffer;
- DriverEntry.NumberOfPage = (UINTN) SmramProfileParameterUnregisterImage->NumberOfPage;
- Status = InternalPeCoffGetEntryPoint ((VOID *) (UINTN) DriverEntry.ImageBuffer, &EntryPointInImage);
- ASSERT_EFI_ERROR (Status);
- DriverEntry.ImageEntryPoint = (PHYSICAL_ADDRESS) (UINTN) EntryPointInImage;
-
- Status = UnregisterSmramProfileImage (&DriverEntry, FALSE);
- if (!EFI_ERROR (Status)) {
- SmramProfileParameterUnregisterImage->Header.ReturnStatus = 0;
- }
-}
-
/**
Dispatch function for a Software SMI handler.
@@ -2374,28 +2316,6 @@ SmramProfileHandler ( }
SmramProfileHandlerGetDataByOffset ((SMRAM_PROFILE_PARAMETER_GET_PROFILE_DATA_BY_OFFSET *) (UINTN) CommBuffer);
break;
- case SMRAM_PROFILE_COMMAND_REGISTER_IMAGE:
- DEBUG ((EFI_D_ERROR, "SmramProfileHandlerRegisterImage\n"));
- if (TempCommBufferSize != sizeof (SMRAM_PROFILE_PARAMETER_REGISTER_IMAGE)) {
- DEBUG ((EFI_D_ERROR, "SmramProfileHandler: SMM communication buffer size invalid!\n"));
- return EFI_SUCCESS;
- }
- if (mSmramReadyToLock) {
- return EFI_SUCCESS;
- }
- SmramProfileHandlerRegisterImage ((SMRAM_PROFILE_PARAMETER_REGISTER_IMAGE *) (UINTN) CommBuffer);
- break;
- case SMRAM_PROFILE_COMMAND_UNREGISTER_IMAGE:
- DEBUG ((EFI_D_ERROR, "SmramProfileHandlerUnregisterImage\n"));
- if (TempCommBufferSize != sizeof (SMRAM_PROFILE_PARAMETER_UNREGISTER_IMAGE)) {
- DEBUG ((EFI_D_ERROR, "SmramProfileHandler: SMM communication buffer size invalid!\n"));
- return EFI_SUCCESS;
- }
- if (mSmramReadyToLock) {
- return EFI_SUCCESS;
- }
- SmramProfileHandlerUnregisterImage ((SMRAM_PROFILE_PARAMETER_UNREGISTER_IMAGE *) (UINTN) CommBuffer);
- break;
case SMRAM_PROFILE_COMMAND_GET_RECORDING_STATE:
DEBUG ((EFI_D_ERROR, "SmramProfileHandlerGetRecordingState\n"));
if (TempCommBufferSize != sizeof (SMRAM_PROFILE_PARAMETER_RECORDING_STATE)) {
@@ -2417,6 +2337,15 @@ SmramProfileHandler ( ParameterRecordingState->Header.ReturnStatus = 0;
break;
+ //
+ // Below 2 commands have been deprecated. They may not be (re-)used.
+ //
+ case SMRAM_PROFILE_COMMAND_DEPRECATED1:
+ case SMRAM_PROFILE_COMMAND_DEPRECATED2:
+ ASSERT (FALSE);
+ //
+ // Fall-through to the default (unrecognized command) case.
+ //
default:
break;
}
diff --git a/MdeModulePkg/Include/Guid/MemoryProfile.h b/MdeModulePkg/Include/Guid/MemoryProfile.h index eee3b9125240..7565e68b5c33 100644 --- a/MdeModulePkg/Include/Guid/MemoryProfile.h +++ b/MdeModulePkg/Include/Guid/MemoryProfile.h @@ -389,10 +389,10 @@ struct _EDKII_MEMORY_PROFILE_PROTOCOL { #define SMRAM_PROFILE_COMMAND_GET_PROFILE_INFO 0x1
#define SMRAM_PROFILE_COMMAND_GET_PROFILE_DATA 0x2
//
-// Below 2 commands are now used by ECP only and only valid before SmmReadyToLock
+// Below 2 commands have been deprecated. They may not be re-used.
//
-#define SMRAM_PROFILE_COMMAND_REGISTER_IMAGE 0x3
-#define SMRAM_PROFILE_COMMAND_UNREGISTER_IMAGE 0x4
+#define SMRAM_PROFILE_COMMAND_DEPRECATED1 0x3
+#define SMRAM_PROFILE_COMMAND_DEPRECATED2 0x4
#define SMRAM_PROFILE_COMMAND_GET_PROFILE_DATA_BY_OFFSET 0x5
#define SMRAM_PROFILE_COMMAND_GET_RECORDING_STATE 0x6
-- 2.31.1
|
|
Re: [PATCH v2 2/2] UefiCpuPkg/BaseUefiCpuLib: Use toolchain-specific rodata section name
Acked-by: Ray Ni <ray.ni@...>
I will depend on tool owner to review the tool configuration change making sure that the correct section name is chosen for different C compilers.
Thanks, Ray
toggle quoted messageShow quoted text
-----Original Message----- From: Marvin Häuser <mhaeuser@...> Sent: Monday, August 9, 2021 5:51 PM To: devel@edk2.groups.io Cc: Dong, Eric <eric.dong@...>; Ni, Ray <ray.ni@...>; Kumar, Rahul1 <rahul1.kumar@...>; Vitaly Cheptsov <vit9696@...> Subject: [PATCH v2 2/2] UefiCpuPkg/BaseUefiCpuLib: Use toolchain-specific rodata section name
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3318
Correctly define the read-only data sections with the toolchain-specific section name. This hardens image permission security and may save image space.
Cc: Eric Dong <eric.dong@...> Cc: Ray Ni <ray.ni@...> Cc: Rahul Kumar <rahul1.kumar@...> Cc: Vitaly Cheptsov <vit9696@...> Signed-off-by: Marvin Häuser <mhaeuser@...> --- UefiCpuPkg/Library/BaseUefiCpuLib/Ia32/InitializeFpu.nasm | 2 +- UefiCpuPkg/Library/BaseUefiCpuLib/X64/InitializeFpu.nasm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/UefiCpuPkg/Library/BaseUefiCpuLib/Ia32/InitializeFpu.nasm b/UefiCpuPkg/Library/BaseUefiCpuLib/Ia32/InitializeFpu.nasm index 5e27cc325012..cfb8bf4a5ae0 100644 --- a/UefiCpuPkg/Library/BaseUefiCpuLib/Ia32/InitializeFpu.nasm +++ b/UefiCpuPkg/Library/BaseUefiCpuLib/Ia32/InitializeFpu.nasm @@ -6,7 +6,7 @@ ;*
;------------------------------------------------------------------------------
- SECTION .rodata
+ SECTION RODATA_SECTION_NAME
;
; Float control word initial value:
diff --git a/UefiCpuPkg/Library/BaseUefiCpuLib/X64/InitializeFpu.nasm b/UefiCpuPkg/Library/BaseUefiCpuLib/X64/InitializeFpu.nasm index 8485b4713548..3c976a21e391 100644 --- a/UefiCpuPkg/Library/BaseUefiCpuLib/X64/InitializeFpu.nasm +++ b/UefiCpuPkg/Library/BaseUefiCpuLib/X64/InitializeFpu.nasm @@ -6,7 +6,7 @@ ;*
;------------------------------------------------------------------------------
- SECTION .rodata
+ SECTION RODATA_SECTION_NAME
;
; Float control word initial value:
; all exceptions masked, double-extended-precision, round-to-nearest
-- 2.31.1
|
|
Re: [edk2-platforms][PATCH v1 1/1] IntelSiliconPkg: Add BaseSmmAccessLibNull
Michael, If your platform doesn't need SmmAccessPPI, you don't put the SmmAccess PEIM in the FDF. Why do you need: 1. Put SmmAccess PEIM in FDF 2. Let SmmAccess PEIM link to a NULL dummy-do-nothing library
I feel the additional abstraction is not necessary.
Thanks, Ray
toggle quoted messageShow quoted text
-----Original Message----- From: mikuback@... <mikuback@...> Sent: Monday, August 9, 2021 10:16 PM To: devel@edk2.groups.io Cc: Ni, Ray <ray.ni@...>; Chaganty, Rangasai V <rangasai.v.chaganty@...> Subject: [edk2-platforms][PATCH v1 1/1] IntelSiliconPkg: Add BaseSmmAccessLibNull
From: Michael Kubacki <michael.kubacki@...>
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3540
Adds a NULL instance of SmmAccessLib.
Cc: Ray Ni <ray.ni@...> Cc: Rangasai V Chaganty <rangasai.v.chaganty@...> Signed-off-by: Michael Kubacki <michael.kubacki@...> --- Silicon/Intel/IntelSiliconPkg/Feature/SmmAccess/Library/BaseSmmAccessLibNull/BaseSmmAccessLibNull.c | 33 ++++++++++++++++++++ Silicon/Intel/IntelSiliconPkg/Feature/SmmAccess/Library/BaseSmmAccessLibNull/BaseSmmAccessLibNull.inf | 26 +++++++++++++++ Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dsc | 1 + 3 files changed, 60 insertions(+)
diff --git a/Silicon/Intel/IntelSiliconPkg/Feature/SmmAccess/Library/BaseSmmAccessLibNull/BaseSmmAccessLibNull.c b/Silicon/Intel/IntelSiliconPkg/Feature/SmmAccess/Library/BaseSmmAccessLibNull/BaseSmmAccessLibNull.c new file mode 100644 index 000000000000..f5ad306b380b --- /dev/null +++ b/Silicon/Intel/IntelSiliconPkg/Feature/SmmAccess/Library/BaseSmmAccessLibNull/BaseSmmAccessLibNull.c @@ -0,0 +1,33 @@ +/** @file + A NULL library instance of SmmAccessLib. + + Copyright (c) 2019 - 2020, Intel Corporation. All rights reserved.<BR> + Copyright (c) Microsoft Corporation.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include <Uefi.h> +#include <Library/DebugLib.h> +#include <Library/SmmAccessLib.h> + +/** + This function is to install an SMM Access PPI + + @retval EFI_SUCCESS - Ppi successfully started and installed. + @retval EFI_NOT_FOUND - Ppi can't be found. + @retval EFI_OUT_OF_RESOURCES - Ppi does not have enough resources to initialize the driver. + @retval EFI_UNSUPPORTED - The PPI was not installed and installation is unsupported in + this instance of function implementation. + +**/ +EFI_STATUS +EFIAPI +PeiInstallSmmAccessPpi ( + VOID + ) +{ + ASSERT (FALSE); + return EFI_UNSUPPORTED; +} diff --git a/Silicon/Intel/IntelSiliconPkg/Feature/SmmAccess/Library/BaseSmmAccessLibNull/BaseSmmAccessLibNull.inf b/Silicon/Intel/IntelSiliconPkg/Feature/SmmAccess/Library/BaseSmmAccessLibNull/BaseSmmAccessLibNull.inf new file mode 100644 index 000000000000..7fd3b0b89655 --- /dev/null +++ b/Silicon/Intel/IntelSiliconPkg/Feature/SmmAccess/Library/BaseSmmAccessLibNull/BaseSmmAccessLibNull.inf @@ -0,0 +1,26 @@ +## @file +# A NULL library instance of SmmAccessLib. +# +# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> +# Copyright (c) Microsoft Corporation.<BR> +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] +INF_VERSION = 0x00010017 +BASE_NAME = BaseSmmAccessLibNull +FILE_GUID = C1A14AB6-B757-4046-9B92-9DCE1A2154C6 +VERSION_STRING = 1.0 +MODULE_TYPE = BASE +LIBRARY_CLASS = SmmAccessLib + +[Packages] + MdePkg/MdePkg.dec + IntelSiliconPkg/IntelSiliconPkg.dec + +[LibraryClasses] + DebugLib + +[Sources] + BaseSmmAccessLibNull.c diff --git a/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dsc b/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dsc index 1092371d848e..dd0928ec58f3 100644 --- a/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dsc +++ b/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dsc @@ -90,6 +90,7 @@ [Components] IntelSiliconPkg/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdateDxe.inf IntelSiliconPkg/Feature/Capsule/Library/MicrocodeFlashAccessLibNull/MicrocodeFlashAccessLibNull.inf IntelSiliconPkg/Feature/ShadowMicrocode/ShadowMicrocodePei.inf + IntelSiliconPkg/Feature/SmmAccess/Library/BaseSmmAccessLibNull/BaseSmmAccessLibNull.inf IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/PeiFirmwareBootMediaLib.inf IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/DxeSmmFirmwareBootMediaLib.inf IntelSiliconPkg/Library/DxeAslUpdateLib/DxeAslUpdateLib.inf -- 2.28.0.windows.1
|
|
Re: [edk2-platforms][PATCH v1 1/1] IntelSiliconPkg/PeiSmmAccessLib: Remove S3 requirement
Michael, Allowing the gPeiSmmAccessPpiGuid PPI installation in normal boot will further allow gEfiPeiSmmCommunicationPpiGuid installation in normal path, while without your change neither of the PPIs is installed in normal boot.
+ Jiewen for potential security concern.
Thanks, Ray
toggle quoted messageShow quoted text
-----Original Message----- From: Chaganty, Rangasai V <rangasai.v.chaganty@...> Sent: Tuesday, August 10, 2021 6:46 AM To: mikuback@...; devel@edk2.groups.io Cc: Ni, Ray <ray.ni@...> Subject: RE: [edk2-platforms][PATCH v1 1/1] IntelSiliconPkg/PeiSmmAccessLib: Remove S3 requirement
Reviewed-by: Sai Chaganty <rangasai.v.chaganty@...>
-----Original Message----- From: mikuback@... <mikuback@...> Sent: Monday, August 09, 2021 6:40 AM To: devel@edk2.groups.io Cc: Ni, Ray <ray.ni@...>; Chaganty, Rangasai V <rangasai.v.chaganty@...> Subject: [edk2-platforms][PATCH v1 1/1] IntelSiliconPkg/PeiSmmAccessLib: Remove S3 requirement
From: Michael Kubacki <michael.kubacki@...>
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3539
PeiInstallSmmAccessPpi() currently requires the boot mode be set to S3 to actually install gEfiPeiMmAccessPpiGuid.
This change removes this requirement in the function implementation for two reasons:
1. Practical use cases exist to require this PPI in cases other than the boot mode being set to BOOT_ON_S3_RESUME.
2. It is poor API design to implicitly bury this requirement within a function whose responsibility is to install the PPI. The caller can easily place arbitrary constraints around whether to call based on conditions such as the boot mode being BOOT_ON_S3_RESUME.
Cc: Ray Ni <ray.ni@...> Cc: Rangasai V Chaganty <rangasai.v.chaganty@...> Signed-off-by: Michael Kubacki <michael.kubacki@...> --- Silicon/Intel/IntelSiliconPkg/Feature/SmmAccess/Library/PeiSmmAccessLib/PeiSmmAccessLib.c | 12 ------------ 1 file changed, 12 deletions(-)
diff --git a/Silicon/Intel/IntelSiliconPkg/Feature/SmmAccess/Library/PeiSmmAccessLib/PeiSmmAccessLib.c b/Silicon/Intel/IntelSiliconPkg/Feature/SmmAccess/Library/PeiSmmAccessLib/PeiSmmAccessLib.c index d9bf4fba983e..4df0d695fdaf 100644 --- a/Silicon/Intel/IntelSiliconPkg/Feature/SmmAccess/Library/PeiSmmAccessLib/PeiSmmAccessLib.c +++ b/Silicon/Intel/IntelSiliconPkg/Feature/SmmAccess/Library/PeiSmmAcce +++ ssLib/PeiSmmAccessLib.c @@ -252,19 +252,7 @@ PeiInstallSmmAccessPpi ( EFI_SMRAM_HOB_DESCRIPTOR_BLOCK *DescriptorBlock; SMM_ACCESS_PRIVATE_DATA *SmmAccessPrivate; VOID *HobList; - EFI_BOOT_MODE BootMode;
- Status = PeiServicesGetBootMode (&BootMode); - if (EFI_ERROR (Status)) { - // - // If not in S3 boot path. do nothing - // - return EFI_SUCCESS; - } - - if (BootMode != BOOT_ON_S3_RESUME) { - return EFI_SUCCESS; - } // // Initialize private data // -- 2.28.0.windows.1
|
|
Event: TianoCore Bug Triage - APAC / NAMO - 08/10/2021
#cal-reminder
devel@edk2.groups.io Calendar <noreply@...>
Reminder: TianoCore Bug Triage - APAC / NAMO
When:
08/10/2021
6:30pm to 7:30pm
(UTC-07:00) America/Los Angeles
Where:
https://teams.microsoft.com/l/meetup-join/19%3ameeting_OTUyZTg2NjgtNDhlNS00ODVlLTllYTUtYzg1OTNjNjdiZjFh%40thread.v2/0?context=%7b%22Tid%22%3a%2246c98d88-e344-4ed4-8496-4ed7712e255d%22%2c%22Oid%22%3a%22b286b53a-1218-4db3-bfc9-3d4c5aa7669e%22%7d
Organizer: Liming Gao
gaoliming@...
View Event
Description:
TianoCore Bug Triage - APAC / NAMO
Hosted by Liming Gao
________________________________________________________________________________
Microsoft Teams meeting
Join on your computer or mobile app
Click here to join the meeting
Join with a video conferencing device
teams@...
Video Conference ID: 116 062 094 0
Alternate VTC dialing instructions
Or call in (audio only)
+1 916-245-6934,,77463821# United States, Sacramento
Phone Conference ID: 774 638 21#
Find a local number | Reset PIN
Learn More | Meeting options
|
|
Re: [Patch V2] MinPlatformPkg: Fix the incompatible change about SecureBootVariableLib
Reviewed-by: Chasel Chiu <chasel.chiu@...>
toggle quoted messageShow quoted text
-----Original Message----- From: Tan, Dun <dun.tan@...> Sent: Monday, August 9, 2021 11:00 PM To: devel@edk2.groups.io Cc: Chiu, Chasel <chasel.chiu@...>; Desimone, Nathaniel L <nathaniel.l.desimone@...>; Liming Gao <gaoliming@...>; Dong, Eric <eric.dong@...>; Tan, Dun <dun.tan@...> Subject: [Patch V2] MinPlatformPkg: Fix the incompatible change about SecureBootVariableLib
V1: The newly created lib will be consumed by SecureBootConfigDxe.inf in CoreDxeInclude.dsc V2: Add SecureBootVariableProvisionLib in CoreDxeInclude.dsc
Cc: Chasel Chiu <chasel.chiu@...> Cc: Nate DeSimone <nathaniel.l.desimone@...> Cc: Liming Gao <gaoliming@...> Cc: Eric Dong <eric.dong@...> Signed-off-by: DunTan <dun.tan@...> --- Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc b/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc index b154f9615d..c3d05fc913 100644 --- a/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc +++ b/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc @@ -139,6 +139,8 @@
!if gMinPlatformPkgTokenSpaceGuid.PcdUefiSecureBootEnable == TRUE AuthVariableLib|SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf + + SecureBootVariableLib|SecurityPkg/Library/SecureBootVariableLib/Secure + BootVariableLib.inf + SecureBootVariableProvisionLib|SecurityPkg/Library/SecureBootVariableP + rovisionLib/SecureBootVariableProvisionLib.inf !endif
SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf -- 2.31.1.windows.1
|
|
Re: [PATCH 1/1] OvmfPkg PlatformBootManagerLib: Move TryRunningQemuKernel()
On 10/8/21 12:52 am, James Bottomley wrote: On Mon, 2021-08-09 at 22:53 +1000, Christoph Willing wrote:
With soft feature freeze started, I wonder if this patch could be reviewed and pushed for edk2-stable202108 tag? I think it has languished because I didn't initially Cc appropriately - pls add others as necessary.
This patch is a trivial (I think) change which fixes a long standing and annoying bug for those booting Qemu with UEFI using external kernel & initrd. I'm with Ard on this one: -kernel is working just fine for me and the team at IBM working on Kata containers. It sounds like this might be a problem local to your environment, so we need to debug it to understand the issue rather than blindly reverse existing commits.
Thanks for responding James & Ard. Below is the script I'm using to create, then run, the VM. To verify that it works normally with UEFI boot, it initially uses the internal kernel & initrd. The OVMF_CODE & my_VARS lines contain git hash to identify the build from which OVMF_CODE.fd & OVMF_VARS.fd were taken; 97fdcg is from a build of yesterday's git master. After the OS has been installed, I can run the VM multiple times to verify that it boots under UEFI OK (I see the TianoCore splash screen) with internal kernel. #!/bin/bash /usr/bin/qemu-kvm \ -name "UEFI Testing" \ -enable-kvm \ -cpu kvm64 \ -smp cores=4 \ -boot once=c \ -m 8192 \ -device intel-hda \ -device hda-duplex \ -vga virtio \ -drive if=pflash,format=raw,file=OVMF_CODE_97fdcb.fd,readonly=on \ -drive if=pflash,format=raw,file=my_VARS_97fdcb.fd \ -drive file=disk.img,format=raw,cache=none,index=0,media=disk \ -cdrom /storage/iso/slackware/slackware64-15.0/slackware64-15.0-20210807.iso \ -daemonize \ "$@" To now use external kernel, I add the lines: -kernel /var/cache/vmbuilder/boot/15.0/x86_64/vmlinuz \ -initrd /var/cache/vmbuilder/boot/15.0/x86_64/initrd \ -append "root=/dev/sda2 rootfstype=ext4 ro vga=0x386" \ to the script just after "-boot once=c" (but I doubt the exact positioning makes any difference). In this case, I see the kernel running and initrd unpacked and its modules loaded but the root partition is unable to be mounted - the disk is not visible (running 'ls -l /dev/sd*' in recovery shell gives 'ls: /dev/sd*: No such file or directory'). The last lines of the Qemu screen are: /boot/initrd-5.13.8.gz: Loading kernel modules from initrd image: insmod /lib/modules/5.13.8/kernel/fs/jbd2/jbd2.ko insmod /lib/modules/5.13.8/kernel/fs/mbcache.ko insmod /lib/modules/5.13.8/kernel/fs/ext4/ext4.ko mount: mounting /dev/sda2 on /mnt failed: No such file or directory ERROR: No /sbin/init found on rootdev (or not mounted). Trouble ahead. You can try to fix it. Type 'exit' when things are done. At that point I'm dropped into a recovery shell to try fixing something but there's nothing that can be done since the disk containing the OS is not visible. However if I now change the script's OVMF files to those built from a patched git master, the VM boots all the way to login prompt. I'm using qemu-6.0.0 on SLackware64 but I've found exactly the same behaviour using other OS's (Ubuntu 20.04 with 4.2-3ubuntu6.17 and Clear Linux with 5.2.0) I've also tried using OVMF files from Ubuntu hirsute's ovmf package (2020.11-4) with same bad result. Of course, in this case, I was unable to use a patched version. From the above, I think I've done everything possible to verify the problem and a possible fix. Is there something fundamentally wrong in the way I'm going about this? chris
|
|
Re: [edk2-platforms][PATCH v1 1/1] IntelSiliconPkg/PeiSmmAccessLib: Remove S3 requirement
Reviewed-by: Sai Chaganty <rangasai.v.chaganty@...>
toggle quoted messageShow quoted text
-----Original Message----- From: mikuback@... <mikuback@...> Sent: Monday, August 09, 2021 6:40 AM To: devel@edk2.groups.io Cc: Ni, Ray <ray.ni@...>; Chaganty, Rangasai V <rangasai.v.chaganty@...> Subject: [edk2-platforms][PATCH v1 1/1] IntelSiliconPkg/PeiSmmAccessLib: Remove S3 requirement From: Michael Kubacki <michael.kubacki@...> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3539PeiInstallSmmAccessPpi() currently requires the boot mode be set to S3 to actually install gEfiPeiMmAccessPpiGuid. This change removes this requirement in the function implementation for two reasons: 1. Practical use cases exist to require this PPI in cases other than the boot mode being set to BOOT_ON_S3_RESUME. 2. It is poor API design to implicitly bury this requirement within a function whose responsibility is to install the PPI. The caller can easily place arbitrary constraints around whether to call based on conditions such as the boot mode being BOOT_ON_S3_RESUME. Cc: Ray Ni <ray.ni@...> Cc: Rangasai V Chaganty <rangasai.v.chaganty@...> Signed-off-by: Michael Kubacki <michael.kubacki@...> --- Silicon/Intel/IntelSiliconPkg/Feature/SmmAccess/Library/PeiSmmAccessLib/PeiSmmAccessLib.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/Silicon/Intel/IntelSiliconPkg/Feature/SmmAccess/Library/PeiSmmAccessLib/PeiSmmAccessLib.c b/Silicon/Intel/IntelSiliconPkg/Feature/SmmAccess/Library/PeiSmmAccessLib/PeiSmmAccessLib.c index d9bf4fba983e..4df0d695fdaf 100644 --- a/Silicon/Intel/IntelSiliconPkg/Feature/SmmAccess/Library/PeiSmmAccessLib/PeiSmmAccessLib.c +++ b/Silicon/Intel/IntelSiliconPkg/Feature/SmmAccess/Library/PeiSmmAcce +++ ssLib/PeiSmmAccessLib.c @@ -252,19 +252,7 @@ PeiInstallSmmAccessPpi ( EFI_SMRAM_HOB_DESCRIPTOR_BLOCK *DescriptorBlock; SMM_ACCESS_PRIVATE_DATA *SmmAccessPrivate; VOID *HobList; - EFI_BOOT_MODE BootMode; - Status = PeiServicesGetBootMode (&BootMode); - if (EFI_ERROR (Status)) { - // - // If not in S3 boot path. do nothing - // - return EFI_SUCCESS; - } - - if (BootMode != BOOT_ON_S3_RESUME) { - return EFI_SUCCESS; - } // // Initialize private data // -- 2.28.0.windows.1
|
|
Re: [edk2-platforms][PATCH v1 1/1] IntelSiliconPkg: Add BaseSmmAccessLibNull
Reviewed-by: Sai Chaganty <rangasai.v.chaganty@...>
toggle quoted messageShow quoted text
-----Original Message----- From: mikuback@... <mikuback@...> Sent: Monday, August 09, 2021 7:16 AM To: devel@edk2.groups.io Cc: Ni, Ray <ray.ni@...>; Chaganty, Rangasai V <rangasai.v.chaganty@...> Subject: [edk2-platforms][PATCH v1 1/1] IntelSiliconPkg: Add BaseSmmAccessLibNull From: Michael Kubacki <michael.kubacki@...> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3540Adds a NULL instance of SmmAccessLib. Cc: Ray Ni <ray.ni@...> Cc: Rangasai V Chaganty <rangasai.v.chaganty@...> Signed-off-by: Michael Kubacki <michael.kubacki@...> --- Silicon/Intel/IntelSiliconPkg/Feature/SmmAccess/Library/BaseSmmAccessLibNull/BaseSmmAccessLibNull.c | 33 ++++++++++++++++++++ Silicon/Intel/IntelSiliconPkg/Feature/SmmAccess/Library/BaseSmmAccessLibNull/BaseSmmAccessLibNull.inf | 26 +++++++++++++++ Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dsc | 1 + 3 files changed, 60 insertions(+) diff --git a/Silicon/Intel/IntelSiliconPkg/Feature/SmmAccess/Library/BaseSmmAccessLibNull/BaseSmmAccessLibNull.c b/Silicon/Intel/IntelSiliconPkg/Feature/SmmAccess/Library/BaseSmmAccessLibNull/BaseSmmAccessLibNull.c new file mode 100644 index 000000000000..f5ad306b380b --- /dev/null +++ b/Silicon/Intel/IntelSiliconPkg/Feature/SmmAccess/Library/BaseSmmAcc +++ essLibNull/BaseSmmAccessLibNull.c @@ -0,0 +1,33 @@ +/** @file + A NULL library instance of SmmAccessLib. + + Copyright (c) 2019 - 2020, Intel Corporation. All rights + reserved.<BR> Copyright (c) Microsoft Corporation.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include <Uefi.h> +#include <Library/DebugLib.h> +#include <Library/SmmAccessLib.h> + +/** + This function is to install an SMM Access PPI + + @retval EFI_SUCCESS - Ppi successfully started and installed. + @retval EFI_NOT_FOUND - Ppi can't be found. + @retval EFI_OUT_OF_RESOURCES - Ppi does not have enough resources to initialize the driver. + @retval EFI_UNSUPPORTED - The PPI was not installed and installation is unsupported in + this instance of function implementation. + +**/ +EFI_STATUS +EFIAPI +PeiInstallSmmAccessPpi ( + VOID + ) +{ + ASSERT (FALSE); + return EFI_UNSUPPORTED; +} diff --git a/Silicon/Intel/IntelSiliconPkg/Feature/SmmAccess/Library/BaseSmmAccessLibNull/BaseSmmAccessLibNull.inf b/Silicon/Intel/IntelSiliconPkg/Feature/SmmAccess/Library/BaseSmmAccessLibNull/BaseSmmAccessLibNull.inf new file mode 100644 index 000000000000..7fd3b0b89655 --- /dev/null +++ b/Silicon/Intel/IntelSiliconPkg/Feature/SmmAccess/Library/BaseSmmAcc +++ essLibNull/BaseSmmAccessLibNull.inf @@ -0,0 +1,26 @@ +## @file +# A NULL library instance of SmmAccessLib. +# +# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> # +Copyright (c) Microsoft Corporation.<BR> # SPDX-License-Identifier: +BSD-2-Clause-Patent # ## + +[Defines] +INF_VERSION = 0x00010017 +BASE_NAME = BaseSmmAccessLibNull +FILE_GUID = C1A14AB6-B757-4046-9B92-9DCE1A2154C6 +VERSION_STRING = 1.0 +MODULE_TYPE = BASE +LIBRARY_CLASS = SmmAccessLib + +[Packages] + MdePkg/MdePkg.dec + IntelSiliconPkg/IntelSiliconPkg.dec + +[LibraryClasses] + DebugLib + +[Sources] + BaseSmmAccessLibNull.c diff --git a/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dsc b/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dsc index 1092371d848e..dd0928ec58f3 100644 --- a/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dsc +++ b/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dsc @@ -90,6 +90,7 @@ [Components] IntelSiliconPkg/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdateDxe.inf IntelSiliconPkg/Feature/Capsule/Library/MicrocodeFlashAccessLibNull/MicrocodeFlashAccessLibNull.inf IntelSiliconPkg/Feature/ShadowMicrocode/ShadowMicrocodePei.inf + + IntelSiliconPkg/Feature/SmmAccess/Library/BaseSmmAccessLibNull/BaseSmm + AccessLibNull.inf IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/PeiFirmwareBootMediaLib.inf IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/DxeSmmFirmwareBootMediaLib.inf IntelSiliconPkg/Library/DxeAslUpdateLib/DxeAslUpdateLib.inf -- 2.28.0.windows.1
|
|
Re: [PATCH v2 1/2] MdePkg/BaseLib: Fix unaligned API prototypes

Andrew Fish
Hi Marvin,
Can you provide an example of which C compiler is flagging this as an error and what error message is generated.
Please enter a BZ with this background information and add link to the BZ in the commit message.
This is a change to the BaseLib class, so we need to make sure there are no impacts to any existing code. I looks like a safe change because changing from a pointer to a fixed size type to VOID * should be compatible. Please add that analysis to the background in the BZ as well.
MIke,
I want to say we had a discussion about this years ago? I don’t remember the outcome.
Dereferencing a misaligned pointer is UB (Undefined Behavior) in C [1], but historically x86 compilers have let it slide.
I think the situation we are in is the BaseLib functions don’t contain UB, but it is UB for the caller to use the returned pointer directly.
Here is a simple example with clang UndefinedBehaviorSanitizer (UBSan) .
~/work/Compiler>cat ub.c #include <stdlib.h>
#define EFIAPI #define IN #define OUT
typedef unsigned char UINT8; typedef unsigned short UINT16;
UINT16 EFIAPI WriteUnaligned16 ( OUT UINT16 *Buffer, IN UINT16 Value ) { // ASSERT (Buffer != NULL);
((volatile UINT8*)Buffer)[0] = (UINT8)Value; ((volatile UINT8*)Buffer)[1] = (UINT8)(Value >> 8);
return Value; }
int main() { UINT8 *buffer = malloc(64); UINT16 *pointer = (UINT16 *)(buffer + 1);
WriteUnaligned16 (pointer, 42);
// *pointer = 42; // Error: misaligned integer pointer assignment return *pointer; } ~/work/Compiler>clang -fsanitize=undefined ub.c ~/work/Compiler>./a.out ub.c:34:9: runtime error: load of misaligned address 0x7feac6405aa1 for type 'UINT16' (aka 'unsigned short'), which requires 2 byte alignment 0x7feac6405aa1: note: pointer points here 00 00 00 64 2a 00 79 6d 28 52 54 4c 44 5f 44 45 46 41 55 4c 54 2c 20 73 77 69 66 74 5f 64 65 6d ^ SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ub.c:34:9 in
FYI line 39 is `return *pointer`and 42 is 0x2A. So reading an writing to *pointer is UB.
As you can see in [1] the general advice is to take code that looks like: int8_t *buffer = malloc(64);int32_t *pointer = (int32_t *)(buffer + 1);*pointer = 42; And replace it with; int8_t *buffer = malloc(64);int32_t value = 42;memcpy(buffer + 1, &value, sizeof(int32_t));
But in these cases the result is in a byte aligned buffer….
Thanks,
Andrew Fish Thanks,Mike-----Original Message----- From: Marvin Häuser <mhaeuser@...> Sent: Monday, August 9, 2021 2:51 AM To: devel@edk2.groups.io Cc: Kinney, Michael D <michael.d.kinney@...>; Liming Gao <gaoliming@...>; Liu, Zhiguang <zhiguang.liu@...>; Vitaly Cheptsov <vit9696@...> Subject: [PATCH v2 1/2] MdePkg/BaseLib: Fix unaligned API prototypes
C prohibits not only dereferencing but also casting to unaligned pointers. Thus, the current set of unaligned APIs cannot be called safely. Update their prototypes to take VOID * pointers, which must be able to represent any valid pointer.
Cc: Michael D Kinney <michael.d.kinney@...> Cc: Liming Gao <gaoliming@...> Cc: Zhiguang Liu <zhiguang.liu@...> Cc: Vitaly Cheptsov <vit9696@...> Signed-off-by: Marvin Häuser <mhaeuser@...> --- MdePkg/Library/BaseLib/Arm/Unaligned.c | 14 ++++----- MdePkg/Library/BaseLib/Unaligned.c | 32 ++++++++++---------- MdePkg/Include/Library/BaseLib.h | 16 +++++----- 3 files changed, 31 insertions(+), 31 deletions(-)
diff --git a/MdePkg/Library/BaseLib/Arm/Unaligned.c b/MdePkg/Library/BaseLib/Arm/Unaligned.c index e9934e7003cb..57f19fc44e0b 100644 --- a/MdePkg/Library/BaseLib/Arm/Unaligned.c +++ b/MdePkg/Library/BaseLib/Arm/Unaligned.c @@ -59,7 +59,7 @@ ReadUnaligned16 ( UINT16
EFIAPI
WriteUnaligned16 (
- OUT UINT16 *Buffer,
+ OUT VOID *Buffer,
IN UINT16 Value
)
{
@@ -87,7 +87,7 @@ WriteUnaligned16 ( UINT32
EFIAPI
ReadUnaligned24 (
- IN CONST UINT32 *Buffer
+ IN CONST VOID *Buffer
)
{
ASSERT (Buffer != NULL);
@@ -116,7 +116,7 @@ ReadUnaligned24 ( UINT32
EFIAPI
WriteUnaligned24 (
- OUT UINT32 *Buffer,
+ OUT VOID *Buffer,
IN UINT32 Value
)
{
@@ -143,7 +143,7 @@ WriteUnaligned24 ( UINT32
EFIAPI
ReadUnaligned32 (
- IN CONST UINT32 *Buffer
+ IN CONST VOID *Buffer
)
{
UINT16 LowerBytes;
@@ -175,7 +175,7 @@ ReadUnaligned32 ( UINT32
EFIAPI
WriteUnaligned32 (
- OUT UINT32 *Buffer,
+ OUT VOID *Buffer,
IN UINT32 Value
)
{
@@ -202,7 +202,7 @@ WriteUnaligned32 ( UINT64
EFIAPI
ReadUnaligned64 (
- IN CONST UINT64 *Buffer
+ IN CONST VOID *Buffer
)
{
UINT32 LowerBytes;
@@ -234,7 +234,7 @@ ReadUnaligned64 ( UINT64
EFIAPI
WriteUnaligned64 (
- OUT UINT64 *Buffer,
+ OUT VOID *Buffer,
IN UINT64 Value
)
{
diff --git a/MdePkg/Library/BaseLib/Unaligned.c b/MdePkg/Library/BaseLib/Unaligned.c index a419cb85e53c..3041adcde606 100644 --- a/MdePkg/Library/BaseLib/Unaligned.c +++ b/MdePkg/Library/BaseLib/Unaligned.c @@ -26,12 +26,12 @@ UINT16
EFIAPI
ReadUnaligned16 (
- IN CONST UINT16 *Buffer
+ IN CONST VOID *Buffer
)
{
ASSERT (Buffer != NULL);
- return *Buffer;
+ return *(CONST UINT16 *) Buffer;
}
/**
@@ -52,13 +52,13 @@ ReadUnaligned16 ( UINT16
EFIAPI
WriteUnaligned16 (
- OUT UINT16 *Buffer,
+ OUT VOID *Buffer,
IN UINT16 Value
)
{
ASSERT (Buffer != NULL);
- return *Buffer = Value;
+ return *(UINT16 *) Buffer = Value;
}
/**
@@ -77,12 +77,12 @@ WriteUnaligned16 ( UINT32
EFIAPI
ReadUnaligned24 (
- IN CONST UINT32 *Buffer
+ IN CONST VOID *Buffer
)
{
ASSERT (Buffer != NULL);
- return *Buffer & 0xffffff;
+ return *(CONST UINT32 *) Buffer & 0xffffff;
}
/**
@@ -103,13 +103,13 @@ ReadUnaligned24 ( UINT32
EFIAPI
WriteUnaligned24 (
- OUT UINT32 *Buffer,
+ OUT VOID *Buffer,
IN UINT32 Value
)
{
ASSERT (Buffer != NULL);
- *Buffer = BitFieldWrite32 (*Buffer, 0, 23, Value);
+ *(UINT32 *) Buffer = BitFieldWrite32 (*(CONST UINT32 *) Buffer, 0, 23, Value);
return Value;
}
@@ -129,12 +129,12 @@ WriteUnaligned24 ( UINT32
EFIAPI
ReadUnaligned32 (
- IN CONST UINT32 *Buffer
+ IN CONST VOID *Buffer
)
{
ASSERT (Buffer != NULL);
- return *Buffer;
+ return *(CONST UINT32 *) Buffer;
}
/**
@@ -155,13 +155,13 @@ ReadUnaligned32 ( UINT32
EFIAPI
WriteUnaligned32 (
- OUT UINT32 *Buffer,
+ OUT VOID *Buffer,
IN UINT32 Value
)
{
ASSERT (Buffer != NULL);
- return *Buffer = Value;
+ return *(UINT32 *) Buffer = Value;
}
/**
@@ -180,12 +180,12 @@ WriteUnaligned32 ( UINT64
EFIAPI
ReadUnaligned64 (
- IN CONST UINT64 *Buffer
+ IN CONST VOID *Buffer
)
{
ASSERT (Buffer != NULL);
- return *Buffer;
+ return *(CONST UINT64 *) Buffer;
}
/**
@@ -206,11 +206,11 @@ ReadUnaligned64 ( UINT64
EFIAPI
WriteUnaligned64 (
- OUT UINT64 *Buffer,
+ OUT VOID *Buffer,
IN UINT64 Value
)
{
ASSERT (Buffer != NULL);
- return *Buffer = Value;
+ return *(UINT64 *) Buffer = Value;
}
diff --git a/MdePkg/Include/Library/BaseLib.h b/MdePkg/Include/Library/BaseLib.h index 2452c1d92e51..4d30f0539c6b 100644 --- a/MdePkg/Include/Library/BaseLib.h +++ b/MdePkg/Include/Library/BaseLib.h @@ -3420,7 +3420,7 @@ DivS64x64Remainder ( UINT16
EFIAPI
ReadUnaligned16 (
- IN CONST UINT16 *Buffer
+ IN CONST VOID *Buffer
);
@@ -3442,7 +3442,7 @@ ReadUnaligned16 ( UINT16
EFIAPI
WriteUnaligned16 (
- OUT UINT16 *Buffer,
+ OUT VOID *Buffer,
IN UINT16 Value
);
@@ -3463,7 +3463,7 @@ WriteUnaligned16 ( UINT32
EFIAPI
ReadUnaligned24 (
- IN CONST UINT32 *Buffer
+ IN CONST VOID *Buffer
);
@@ -3485,7 +3485,7 @@ ReadUnaligned24 ( UINT32
EFIAPI
WriteUnaligned24 (
- OUT UINT32 *Buffer,
+ OUT VOID *Buffer,
IN UINT32 Value
);
@@ -3506,7 +3506,7 @@ WriteUnaligned24 ( UINT32
EFIAPI
ReadUnaligned32 (
- IN CONST UINT32 *Buffer
+ IN CONST VOID *Buffer
);
@@ -3528,7 +3528,7 @@ ReadUnaligned32 ( UINT32
EFIAPI
WriteUnaligned32 (
- OUT UINT32 *Buffer,
+ OUT VOID *Buffer,
IN UINT32 Value
);
@@ -3549,7 +3549,7 @@ WriteUnaligned32 ( UINT64
EFIAPI
ReadUnaligned64 (
- IN CONST UINT64 *Buffer
+ IN CONST VOID *Buffer
);
@@ -3571,7 +3571,7 @@ ReadUnaligned64 ( UINT64
EFIAPI
WriteUnaligned64 (
- OUT UINT64 *Buffer,
+ OUT VOID *Buffer,
IN UINT64 Value
);
-- 2.31.1
|
|
Re: [PATCH v2 4/7] ArmPkg/DefaultExceptionHandlerLib: Check DebugImageInfoTable type safely
Marvin Häuser <mhaeuser@...>
On 09/08/2021 14:40, Marvin Häuser wrote: On 09/08/2021 13:55, Ard Biesheuvel wrote:
On Mon, 9 Aug 2021 at 11:51, Marvin Häuser <mhaeuser@...> wrote:
C does not allow casting to or dereferencing incompatible pointer types. Use the ImageInfoType member of the union first to determine the data type before dereferencing NormalImage.
Cc: Leif Lindholm <leif@...> Cc: Ard Biesheuvel <ardb+tianocore@...> Cc: Vitaly Cheptsov <vit9696@...> Signed-off-by: Marvin Häuser <mhaeuser@...> Hi Marvin,
Could you please organize your patches into a consistent series, include a cover letter and cc me on everything? Hey Ard,
It's a series and there is a cover letter at: https://edk2.groups.io/g/devel/topic/patch_v2_0_7_fix_various/84764899?p=,,,20,0,0,0::recentpostdate%2Fsticky,,,20,2,0,84764899 The mails from yesterday can certainly be discarded, for some reason format-patch did not number the patches without the argument. The mails from today are numbered and there is a cover letter, but for some reason the threading is all wrong in Thunderbird for me. All subsequent patches have the "In-Reply-To" header in the patch files, I think it is supposed to work off of that? Is threading broken for you as well? Any idea what could have gone wrong? Today I learned two things. 1) Both format-patch and send-email support threading individually, and they don't cooperate [1]. 2) Groups.io does not like patch sets [2]. *Sigh*. Sorry. Best regards, Marvin [1] "It is up to the user to ensure that no In-Reply-To header already exists when git send-email is asked to add it (especially note that git format-patch can be configured to do the threading itself). Failure to do so may not produce the expected result in the recipient’s MUA.", https://git-scm.com/docs/git-send-email[2] "Note: This checkbox is selected by default in new Groups.io accounts. If you do not want to see copies of your own messages, clear this checkbox. [...] (For those interested in the technical details: When this checkbox is selected, Groups.io replaces the Message-Id header with a new, system-generated one and renames the original Message-Id header to X-Orig-Message-Id.)", https://groups.io/helpcenter/membersmanual?single=true I will create a V3 with you CC'd on all patches once I understand everything that went wrong. Is it normal to CC all people from each patch on all patches of a series?
Thanks and so sorry for the hassle!
Best regards, Marvin
I am going to disregard anything you sent yesterday and today, as it is a bit of a jumble.
Thanks, Ard.
--- ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerUefi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerUefi.c b/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerUefi.c index e9fea4038252..9befb6d4db9b 100644 --- a/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerUefi.c +++ b/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerUefi.c @@ -51,8 +51,8 @@ GetImageName (
Address = (CHAR8 *)(UINTN)FaultAddress; for (Entry = 0; Entry < DebugTableHeader->TableSize; Entry++, DebugTable++) { - if (DebugTable->NormalImage != NULL) { - if ((DebugTable->NormalImage->ImageInfoType == EFI_DEBUG_IMAGE_INFO_TYPE_NORMAL) && + if (DebugTable->ImageInfoType != NULL) { + if ((*DebugTable->ImageInfoType == EFI_DEBUG_IMAGE_INFO_TYPE_NORMAL) && (DebugTable->NormalImage->LoadedImageProtocolInstance != NULL)) { if ((Address >= (CHAR8 *)DebugTable->NormalImage->LoadedImageProtocolInstance->ImageBase) && (Address <= ((CHAR8 *)DebugTable->NormalImage->LoadedImageProtocolInstance->ImageBase + DebugTable->NormalImage->LoadedImageProtocolInstance->ImageSize))) { -- 2.31.1
|
|
[PATCH v3 2/2] BaseTools/CommonLib: Fix unaligned API prototypes
Marvin Häuser <mhaeuser@...>
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3542C prohibits not only dereferencing but also casting to unaligned pointers. Thus, the current set of unaligned APIs cannot be called safely. Update their prototypes to take VOID * pointers, which must be able to represent any valid pointer. Cc: Bob Feng <bob.c.feng@...> Cc: Liming Gao <gaoliming@...> Cc: Yuwei Chen <yuwei.chen@...> Cc: Vitaly Cheptsov <vit9696@...> Signed-off-by: Marvin Häuser <mhaeuser@...> --- BaseTools/Source/C/Common/CommonLib.c | 16 ++++++++-------- BaseTools/Source/C/Common/CommonLib.h | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/BaseTools/Source/C/Common/CommonLib.c b/BaseTools/Source/C/Common/CommonLib.c index 7fb4ab764fcd..f1223fb2ae0a 100644 --- a/BaseTools/Source/C/Common/CommonLib.c +++ b/BaseTools/Source/C/Common/CommonLib.c @@ -1154,23 +1154,23 @@ StrSize ( UINT64 ReadUnaligned64 ( - CONST UINT64 *Buffer + CONST VOID *Buffer ) { ASSERT (Buffer != NULL); - return *Buffer; + return *(CONST UINT64 *) Buffer; } UINT64 WriteUnaligned64 ( - UINT64 *Buffer, + VOID *Buffer, UINT64 Value ) { ASSERT (Buffer != NULL); - return *Buffer = Value; + return *(UINT64 *) Buffer = Value; } @@ -2018,23 +2018,23 @@ AllocatePool ( UINT16 WriteUnaligned16 ( - UINT16 *Buffer, + VOID *Buffer, UINT16 Value ) { ASSERT (Buffer != NULL); - return *Buffer = Value; + return *(UINT16 *) Buffer = Value; } UINT16 ReadUnaligned16 ( - CONST UINT16 *Buffer + CONST VOID *Buffer ) { ASSERT (Buffer != NULL); - return *Buffer; + return *(CONST UINT16 *) Buffer; } /** Return whether the integer string is a hex string. diff --git a/BaseTools/Source/C/Common/CommonLib.h b/BaseTools/Source/C/Common/CommonLib.h index 0f05d88db206..67c42a91765d 100644 --- a/BaseTools/Source/C/Common/CommonLib.h +++ b/BaseTools/Source/C/Common/CommonLib.h @@ -238,13 +238,13 @@ CopyGuid ( UINT64 WriteUnaligned64 ( - UINT64 *Buffer, + VOID *Buffer, UINT64 Value ); UINT64 ReadUnaligned64 ( - CONST UINT64 *Buffer + CONST VOID *Buffer ); UINTN @@ -363,13 +363,13 @@ AllocatePool ( UINT16 WriteUnaligned16 ( - UINT16 *Buffer, + VOID *Buffer, UINT16 Value ); UINT16 ReadUnaligned16 ( - CONST UINT16 *Buffer + CONST VOID *Buffer ); VOID * -- 2.31.1
|
|
[PATCH v3 1/2] MdePkg/BaseLib: Fix unaligned API prototypes
Marvin Häuser <mhaeuser@...>
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3542C prohibits not only dereferencing but also casting to unaligned pointers. Thus, the current set of unaligned APIs cannot be called safely. Update their prototypes to take VOID * pointers, which must be able to represent any valid pointer. Cc: Michael D Kinney <michael.d.kinney@...> Cc: Liming Gao <gaoliming@...> Cc: Zhiguang Liu <zhiguang.liu@...> Cc: Vitaly Cheptsov <vit9696@...> Signed-off-by: Marvin Häuser <mhaeuser@...> --- MdePkg/Library/BaseLib/Arm/Unaligned.c | 14 ++++----- MdePkg/Library/BaseLib/Unaligned.c | 32 ++++++++++---------- MdePkg/Include/Library/BaseLib.h | 16 +++++----- 3 files changed, 31 insertions(+), 31 deletions(-) diff --git a/MdePkg/Library/BaseLib/Arm/Unaligned.c b/MdePkg/Library/BaseLib/Arm/Unaligned.c index e9934e7003cb..57f19fc44e0b 100644 --- a/MdePkg/Library/BaseLib/Arm/Unaligned.c +++ b/MdePkg/Library/BaseLib/Arm/Unaligned.c @@ -59,7 +59,7 @@ ReadUnaligned16 ( UINT16 EFIAPI WriteUnaligned16 ( - OUT UINT16 *Buffer, + OUT VOID *Buffer, IN UINT16 Value ) { @@ -87,7 +87,7 @@ WriteUnaligned16 ( UINT32 EFIAPI ReadUnaligned24 ( - IN CONST UINT32 *Buffer + IN CONST VOID *Buffer ) { ASSERT (Buffer != NULL); @@ -116,7 +116,7 @@ ReadUnaligned24 ( UINT32 EFIAPI WriteUnaligned24 ( - OUT UINT32 *Buffer, + OUT VOID *Buffer, IN UINT32 Value ) { @@ -143,7 +143,7 @@ WriteUnaligned24 ( UINT32 EFIAPI ReadUnaligned32 ( - IN CONST UINT32 *Buffer + IN CONST VOID *Buffer ) { UINT16 LowerBytes; @@ -175,7 +175,7 @@ ReadUnaligned32 ( UINT32 EFIAPI WriteUnaligned32 ( - OUT UINT32 *Buffer, + OUT VOID *Buffer, IN UINT32 Value ) { @@ -202,7 +202,7 @@ WriteUnaligned32 ( UINT64 EFIAPI ReadUnaligned64 ( - IN CONST UINT64 *Buffer + IN CONST VOID *Buffer ) { UINT32 LowerBytes; @@ -234,7 +234,7 @@ ReadUnaligned64 ( UINT64 EFIAPI WriteUnaligned64 ( - OUT UINT64 *Buffer, + OUT VOID *Buffer, IN UINT64 Value ) { diff --git a/MdePkg/Library/BaseLib/Unaligned.c b/MdePkg/Library/BaseLib/Unaligned.c index a419cb85e53c..3041adcde606 100644 --- a/MdePkg/Library/BaseLib/Unaligned.c +++ b/MdePkg/Library/BaseLib/Unaligned.c @@ -26,12 +26,12 @@ UINT16 EFIAPI ReadUnaligned16 ( - IN CONST UINT16 *Buffer + IN CONST VOID *Buffer ) { ASSERT (Buffer != NULL); - return *Buffer; + return *(CONST UINT16 *) Buffer; } /** @@ -52,13 +52,13 @@ ReadUnaligned16 ( UINT16 EFIAPI WriteUnaligned16 ( - OUT UINT16 *Buffer, + OUT VOID *Buffer, IN UINT16 Value ) { ASSERT (Buffer != NULL); - return *Buffer = Value; + return *(UINT16 *) Buffer = Value; } /** @@ -77,12 +77,12 @@ WriteUnaligned16 ( UINT32 EFIAPI ReadUnaligned24 ( - IN CONST UINT32 *Buffer + IN CONST VOID *Buffer ) { ASSERT (Buffer != NULL); - return *Buffer & 0xffffff; + return *(CONST UINT32 *) Buffer & 0xffffff; } /** @@ -103,13 +103,13 @@ ReadUnaligned24 ( UINT32 EFIAPI WriteUnaligned24 ( - OUT UINT32 *Buffer, + OUT VOID *Buffer, IN UINT32 Value ) { ASSERT (Buffer != NULL); - *Buffer = BitFieldWrite32 (*Buffer, 0, 23, Value); + *(UINT32 *) Buffer = BitFieldWrite32 (*(CONST UINT32 *) Buffer, 0, 23, Value); return Value; } @@ -129,12 +129,12 @@ WriteUnaligned24 ( UINT32 EFIAPI ReadUnaligned32 ( - IN CONST UINT32 *Buffer + IN CONST VOID *Buffer ) { ASSERT (Buffer != NULL); - return *Buffer; + return *(CONST UINT32 *) Buffer; } /** @@ -155,13 +155,13 @@ ReadUnaligned32 ( UINT32 EFIAPI WriteUnaligned32 ( - OUT UINT32 *Buffer, + OUT VOID *Buffer, IN UINT32 Value ) { ASSERT (Buffer != NULL); - return *Buffer = Value; + return *(UINT32 *) Buffer = Value; } /** @@ -180,12 +180,12 @@ WriteUnaligned32 ( UINT64 EFIAPI ReadUnaligned64 ( - IN CONST UINT64 *Buffer + IN CONST VOID *Buffer ) { ASSERT (Buffer != NULL); - return *Buffer; + return *(CONST UINT64 *) Buffer; } /** @@ -206,11 +206,11 @@ ReadUnaligned64 ( UINT64 EFIAPI WriteUnaligned64 ( - OUT UINT64 *Buffer, + OUT VOID *Buffer, IN UINT64 Value ) { ASSERT (Buffer != NULL); - return *Buffer = Value; + return *(UINT64 *) Buffer = Value; } diff --git a/MdePkg/Include/Library/BaseLib.h b/MdePkg/Include/Library/BaseLib.h index 2452c1d92e51..4d30f0539c6b 100644 --- a/MdePkg/Include/Library/BaseLib.h +++ b/MdePkg/Include/Library/BaseLib.h @@ -3420,7 +3420,7 @@ DivS64x64Remainder ( UINT16 EFIAPI ReadUnaligned16 ( - IN CONST UINT16 *Buffer + IN CONST VOID *Buffer ); @@ -3442,7 +3442,7 @@ ReadUnaligned16 ( UINT16 EFIAPI WriteUnaligned16 ( - OUT UINT16 *Buffer, + OUT VOID *Buffer, IN UINT16 Value ); @@ -3463,7 +3463,7 @@ WriteUnaligned16 ( UINT32 EFIAPI ReadUnaligned24 ( - IN CONST UINT32 *Buffer + IN CONST VOID *Buffer ); @@ -3485,7 +3485,7 @@ ReadUnaligned24 ( UINT32 EFIAPI WriteUnaligned24 ( - OUT UINT32 *Buffer, + OUT VOID *Buffer, IN UINT32 Value ); @@ -3506,7 +3506,7 @@ WriteUnaligned24 ( UINT32 EFIAPI ReadUnaligned32 ( - IN CONST UINT32 *Buffer + IN CONST VOID *Buffer ); @@ -3528,7 +3528,7 @@ ReadUnaligned32 ( UINT32 EFIAPI WriteUnaligned32 ( - OUT UINT32 *Buffer, + OUT VOID *Buffer, IN UINT32 Value ); @@ -3549,7 +3549,7 @@ WriteUnaligned32 ( UINT64 EFIAPI ReadUnaligned64 ( - IN CONST UINT64 *Buffer + IN CONST VOID *Buffer ); @@ -3571,7 +3571,7 @@ ReadUnaligned64 ( UINT64 EFIAPI WriteUnaligned64 ( - OUT UINT64 *Buffer, + OUT VOID *Buffer, IN UINT64 Value ); -- 2.31.1
|
|
Re: [Patch V2] MinPlatformPkg: Fix the incompatible change about SecureBootVariableLib

Nate DeSimone
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@...>
toggle quoted messageShow quoted text
-----Original Message----- From: Tan, Dun <dun.tan@...> Sent: Monday, August 9, 2021 8:00 AM To: devel@edk2.groups.io Cc: Chiu, Chasel <chasel.chiu@...>; Desimone, Nathaniel L <nathaniel.l.desimone@...>; Liming Gao <gaoliming@...>; Dong, Eric <eric.dong@...>; Tan, Dun <dun.tan@...> Subject: [Patch V2] MinPlatformPkg: Fix the incompatible change about SecureBootVariableLib
V1: The newly created lib will be consumed by SecureBootConfigDxe.inf in CoreDxeInclude.dsc V2: Add SecureBootVariableProvisionLib in CoreDxeInclude.dsc
Cc: Chasel Chiu <chasel.chiu@...> Cc: Nate DeSimone <nathaniel.l.desimone@...> Cc: Liming Gao <gaoliming@...> Cc: Eric Dong <eric.dong@...> Signed-off-by: DunTan <dun.tan@...> --- Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc b/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc index b154f9615d..c3d05fc913 100644 --- a/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc +++ b/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc @@ -139,6 +139,8 @@
!if gMinPlatformPkgTokenSpaceGuid.PcdUefiSecureBootEnable == TRUE AuthVariableLib|SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf + + SecureBootVariableLib|SecurityPkg/Library/SecureBootVariableLib/Secure + BootVariableLib.inf + SecureBootVariableProvisionLib|SecurityPkg/Library/SecureBootVariableP + rovisionLib/SecureBootVariableProvisionLib.inf !endif
SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf -- 2.31.1.windows.1
|
|
Re: [edk2-platforms][PATCH v1 1/1] MinPlatformPkg/AcpiTables: Update structures for ACPI 6.3

Nate DeSimone
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@...>
toggle quoted messageShow quoted text
-----Original Message----- From: mikuback@... <mikuback@...> Sent: Friday, August 6, 2021 12:54 PM To: devel@edk2.groups.io Cc: Chiu, Chasel <chasel.chiu@...>; Desimone, Nathaniel L <nathaniel.l.desimone@...>; Liming Gao <gaoliming@...>; Dong, Eric <eric.dong@...>; Maddy, Daniel <danmad@...>; Michael Kubacki <michael.kubacki@...> Subject: [edk2-platforms][PATCH v1 1/1] MinPlatformPkg/AcpiTables: Update structures for ACPI 6.3
From: Daniel Maddy <danmad@...>
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3535
Updates ACPI table structures in MinPlatformPkg for ACPI 6.3.
Cc: Chasel Chiu <chasel.chiu@...> Cc: Nate DeSimone <nathaniel.l.desimone@...> Cc: Liming Gao <gaoliming@...> Cc: Eric Dong <eric.dong@...> Cc: Daniel Maddy <danmad@...> Co-authored-by: Michael Kubacki <michael.kubacki@...> Signed-off-by: Michael Kubacki <michael.kubacki@...> --- Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c | 203 ++++++++++---------- Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Facs/Facs.c | 11 +- Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Fadt/Fadt.c | 74 ++++--- 3 files changed, 150 insertions(+), 138 deletions(-)
diff --git a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c index 2b51c34ef2fd..5e3c4c0672f9 100644 --- a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c +++ b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c @@ -2,6 +2,7 @@ ACPI Platform Driver
Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.<BR> +Copyright (c) Microsoft Corporation.<BR> SPDX-License-Identifier: BSD-2-Clause-Patent
**/ @@ -13,7 +14,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #pragma pack(1)
typedef struct { - UINT32 AcpiProcessorId; + UINT32 AcpiProcessorUid; UINT32 ApicId; UINT32 Flags; UINT32 SwProcApicId; @@ -27,9 +28,9 @@ typedef struct { // Define Union of IO APIC & Local APIC structure; // typedef union { - EFI_ACPI_4_0_PROCESSOR_LOCAL_APIC_STRUCTURE AcpiLocalApic; - EFI_ACPI_4_0_IO_APIC_STRUCTURE AcpiIoApic; - EFI_ACPI_4_0_PROCESSOR_LOCAL_X2APIC_STRUCTURE AcpiLocalx2Apic; + EFI_ACPI_6_3_PROCESSOR_LOCAL_APIC_STRUCTURE AcpiLocalApic; + EFI_ACPI_6_3_IO_APIC_STRUCTURE AcpiIoApic; + EFI_ACPI_6_3_PROCESSOR_LOCAL_X2APIC_STRUCTURE AcpiLocalx2Apic; struct { UINT8 Type; UINT8 Length; @@ -38,9 +39,9 @@ typedef union {
#pragma pack()
-extern EFI_ACPI_5_0_FIRMWARE_ACPI_CONTROL_STRUCTURE Facs; - extern EFI_ACPI_5_0_FIXED_ACPI_DESCRIPTION_TABLE Fadt; -extern EFI_ACPI_HIGH_PRECISION_EVENT_TIMER_TABLE_HEADER Hpet; +extern EFI_ACPI_6_3_FIRMWARE_ACPI_CONTROL_STRUCTURE Facs; +extern EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE Fadt; +extern EFI_ACPI_HIGH_PRECISION_EVENT_TIMER_TABLE_HEADER Hpet; extern EFI_ACPI_WSMT_TABLE Wsmt;
VOID *mLocalTable[] = { @@ -217,7 +218,7 @@ DebugDisplayReOrderTable( DEBUG ((EFI_D_ERROR, "Index AcpiProcId ApicId Flags SwApicId Skt\n")); for (Index=0; Index<MAX_CPU_NUM; Index++) { DEBUG ((EFI_D_ERROR, " %02d 0x%02X 0x%02X %d 0x%02X %d\n", - Index, mCpuApicIdOrderTable[Index].AcpiProcessorId, + Index, + mCpuApicIdOrderTable[Index].AcpiProcessorUid, mCpuApicIdOrderTable[Index].ApicId, mCpuApicIdOrderTable[Index].Flags, mCpuApicIdOrderTable[Index].SwProcApicId, @@ -232,31 +233,31 @@ AppendCpuMapTableEntry ( ) { EFI_STATUS Status; - EFI_ACPI_4_0_PROCESSOR_LOCAL_APIC_STRUCTURE *LocalApicPtr; - EFI_ACPI_4_0_PROCESSOR_LOCAL_X2APIC_STRUCTURE *LocalX2ApicPtr; + EFI_ACPI_6_3_PROCESSOR_LOCAL_APIC_STRUCTURE *LocalApicPtr; + EFI_ACPI_6_3_PROCESSOR_LOCAL_X2APIC_STRUCTURE *LocalX2ApicPtr; UINT8 Type;
Status = EFI_SUCCESS; Type = ((ACPI_APIC_STRUCTURE_PTR *)ApicPtr)->AcpiApicCommon.Type; - LocalApicPtr = (EFI_ACPI_4_0_PROCESSOR_LOCAL_APIC_STRUCTURE *)(&((ACPI_APIC_STRUCTURE_PTR *)ApicPtr)->AcpiLocalApic); - LocalX2ApicPtr = (EFI_ACPI_4_0_PROCESSOR_LOCAL_X2APIC_STRUCTURE *)(&((ACPI_APIC_STRUCTURE_PTR *)ApicPtr)->AcpiLocalx2Apic); + LocalApicPtr = (EFI_ACPI_6_3_PROCESSOR_LOCAL_APIC_STRUCTURE + *)(&((ACPI_APIC_STRUCTURE_PTR *)ApicPtr)->AcpiLocalApic); + LocalX2ApicPtr = (EFI_ACPI_6_3_PROCESSOR_LOCAL_X2APIC_STRUCTURE + *)(&((ACPI_APIC_STRUCTURE_PTR *)ApicPtr)->AcpiLocalx2Apic);
- if(Type == EFI_ACPI_4_0_PROCESSOR_LOCAL_APIC) { + if(Type == EFI_ACPI_6_3_PROCESSOR_LOCAL_APIC) { if(!mX2ApicEnabled) { - LocalApicPtr->Flags = (UINT8)mCpuApicIdOrderTable[LocalApicCounter].Flags; - LocalApicPtr->ApicId = (UINT8)mCpuApicIdOrderTable[LocalApicCounter].ApicId; - LocalApicPtr->AcpiProcessorId = (UINT8)mCpuApicIdOrderTable[LocalApicCounter].AcpiProcessorId; + LocalApicPtr->Flags = (UINT8)mCpuApicIdOrderTable[LocalApicCounter].Flags; + LocalApicPtr->ApicId = (UINT8)mCpuApicIdOrderTable[LocalApicCounter].ApicId; + LocalApicPtr->AcpiProcessorUid = + (UINT8)mCpuApicIdOrderTable[LocalApicCounter].AcpiProcessorUid; } else { - LocalApicPtr->Flags = 0; - LocalApicPtr->ApicId = 0xFF; - LocalApicPtr->AcpiProcessorId = (UINT8)0xFF; + LocalApicPtr->Flags = 0; + LocalApicPtr->ApicId = 0xFF; + LocalApicPtr->AcpiProcessorUid = (UINT8)0xFF; Status = EFI_UNSUPPORTED; } - } else if(Type == EFI_ACPI_4_0_PROCESSOR_LOCAL_X2APIC) { + } else if(Type == EFI_ACPI_6_3_PROCESSOR_LOCAL_X2APIC) { if(mX2ApicEnabled) { LocalX2ApicPtr->Flags = (UINT8)mCpuApicIdOrderTable[LocalApicCounter].Flags; LocalX2ApicPtr->X2ApicId = mCpuApicIdOrderTable[LocalApicCounter].ApicId; - LocalX2ApicPtr->AcpiProcessorUid = mCpuApicIdOrderTable[LocalApicCounter].AcpiProcessorId; + LocalX2ApicPtr->AcpiProcessorUid = + mCpuApicIdOrderTable[LocalApicCounter].AcpiProcessorUid; } else { LocalX2ApicPtr->Flags = 0; LocalX2ApicPtr->X2ApicId = (UINT32)-1; @@ -311,8 +312,8 @@ SortCpuLocalApicInTable ( CpuIdMapPtr->ApicId = (UINT32)ProcessorInfoBuffer.ProcessorId; CpuIdMapPtr->Flags = ((ProcessorInfoBuffer.StatusFlag & PROCESSOR_ENABLED_BIT) != 0); CpuIdMapPtr->SocketNum = (UINT32)ProcessorInfoBuffer.Location.Package; - CpuIdMapPtr->AcpiProcessorId = (CpuIdMapPtr->SocketNum * FixedPcdGet32(PcdMaxCpuCoreCount) * FixedPcdGet32(PcdMaxCpuThreadCount)) + GetIndexFromApicId(CpuIdMapPtr->ApicId); //CpuIdMapPtr->ApicId; - CpuIdMapPtr->SwProcApicId = ((UINT32)(ProcessorInfoBuffer.Location.Package << mNumOfBitShift) + (((UINT32)ProcessorInfoBuffer.ProcessorId) & CoreThreadMask)); + CpuIdMapPtr->AcpiProcessorUid = (CpuIdMapPtr->SocketNum * FixedPcdGet32(PcdMaxCpuCoreCount) * FixedPcdGet32(PcdMaxCpuThreadCount)) + GetIndexFromApicId(CpuIdMapPtr->ApicId); //CpuIdMapPtr->ApicId; + CpuIdMapPtr->SwProcApicId = ((UINT32)(ProcessorInfoBuffer.Location.Package << mNumOfBitShift) + (((UINT32)ProcessorInfoBuffer.ProcessorId) & CoreThreadMask)); if(mX2ApicEnabled) { //if X2Apic, re-order the socket # so it starts from base 0 and contiguous //may not necessory!!!!! } @@ -321,18 +322,18 @@ SortCpuLocalApicInTable ( if (CpuIdMapPtr->Flags == 1) {
if(mForceX2ApicId) { - CpuIdMapPtr->SocketNum &= 0x7; - CpuIdMapPtr->AcpiProcessorId &= 0xFF; //keep lower 8bit due to use Proc obj in dsdt - CpuIdMapPtr->SwProcApicId &= 0xFF; + CpuIdMapPtr->SocketNum &= 0x7; + CpuIdMapPtr->AcpiProcessorUid &= 0xFF; //keep lower 8bit due to use Proc obj in dsdt + CpuIdMapPtr->SwProcApicId &= 0xFF; } } } else { //not enabled - CpuIdMapPtr = (EFI_CPU_ID_ORDER_MAP *)&mCpuApicIdOrderTable[Index]; - CpuIdMapPtr->ApicId = (UINT32)-1; - CpuIdMapPtr->Flags = 0; - CpuIdMapPtr->AcpiProcessorId = (UINT32)-1; - CpuIdMapPtr->SwProcApicId = (UINT32)-1; - CpuIdMapPtr->SocketNum = (UINT32)-1; + CpuIdMapPtr = (EFI_CPU_ID_ORDER_MAP *)&mCpuApicIdOrderTable[Index]; + CpuIdMapPtr->ApicId = (UINT32)-1; + CpuIdMapPtr->Flags = 0; + CpuIdMapPtr->AcpiProcessorUid = (UINT32)-1; + CpuIdMapPtr->SwProcApicId = (UINT32)-1; + CpuIdMapPtr->SocketNum = (UINT32)-1; } //end if PROC ENABLE } //end for CurrentProcessor
@@ -366,9 +367,9 @@ SortCpuLocalApicInTable ( mCpuApicIdOrderTable[Index].SwProcApicId = mCpuApicIdOrderTable[0].SwProcApicId; mCpuApicIdOrderTable[0].SwProcApicId = TempVal; //swap AcpiProcId - TempVal = mCpuApicIdOrderTable[Index].AcpiProcessorId; - mCpuApicIdOrderTable[Index].AcpiProcessorId = mCpuApicIdOrderTable[0].AcpiProcessorId; - mCpuApicIdOrderTable[0].AcpiProcessorId = TempVal; + TempVal = mCpuApicIdOrderTable[Index].AcpiProcessorUid; + mCpuApicIdOrderTable[Index].AcpiProcessorUid = mCpuApicIdOrderTable[0].AcpiProcessorUid; + mCpuApicIdOrderTable[0].AcpiProcessorUid = TempVal;
}
@@ -377,23 +378,23 @@ SortCpuLocalApicInTable (
if(mCpuApicIdOrderTable[CurrProcessor].Flags == 0) { //make sure disabled entry has ProcId set to FFs - mCpuApicIdOrderTable[CurrProcessor].ApicId = (UINT32)-1; - mCpuApicIdOrderTable[CurrProcessor].AcpiProcessorId = (UINT32)-1; - mCpuApicIdOrderTable[CurrProcessor].SwProcApicId = (UINT32)-1; + mCpuApicIdOrderTable[CurrProcessor].ApicId = (UINT32)-1; + mCpuApicIdOrderTable[CurrProcessor].AcpiProcessorUid = (UINT32)-1; + mCpuApicIdOrderTable[CurrProcessor].SwProcApicId = (UINT32)-1;
for(Index = CurrProcessor+1; Index < MAX_CPU_NUM; Index++) { if(mCpuApicIdOrderTable[Index].Flags == 1) { //move enabled entry up - mCpuApicIdOrderTable[CurrProcessor].Flags = 1; - mCpuApicIdOrderTable[CurrProcessor].ApicId = mCpuApicIdOrderTable[Index].ApicId; - mCpuApicIdOrderTable[CurrProcessor].AcpiProcessorId = mCpuApicIdOrderTable[Index].AcpiProcessorId; - mCpuApicIdOrderTable[CurrProcessor].SwProcApicId = mCpuApicIdOrderTable[Index].SwProcApicId; - mCpuApicIdOrderTable[CurrProcessor].SocketNum = mCpuApicIdOrderTable[Index].SocketNum; + mCpuApicIdOrderTable[CurrProcessor].Flags = 1; + mCpuApicIdOrderTable[CurrProcessor].ApicId = mCpuApicIdOrderTable[Index].ApicId; + mCpuApicIdOrderTable[CurrProcessor].AcpiProcessorUid = mCpuApicIdOrderTable[Index].AcpiProcessorUid; + mCpuApicIdOrderTable[CurrProcessor].SwProcApicId = mCpuApicIdOrderTable[Index].SwProcApicId; + mCpuApicIdOrderTable[CurrProcessor].SocketNum = mCpuApicIdOrderTable[Index].SocketNum; //disable moved entry - mCpuApicIdOrderTable[Index].Flags = 0; - mCpuApicIdOrderTable[Index].ApicId = (UINT32)-1; - mCpuApicIdOrderTable[Index].AcpiProcessorId = (UINT32)-1; - mCpuApicIdOrderTable[Index].SwProcApicId = (UINT32)-1; + mCpuApicIdOrderTable[Index].Flags = 0; + mCpuApicIdOrderTable[Index].ApicId = (UINT32)-1; + mCpuApicIdOrderTable[Index].AcpiProcessorUid = (UINT32)-1; + mCpuApicIdOrderTable[Index].SwProcApicId = (UINT32)-1; break; } } @@ -422,17 +423,17 @@ typedef struct { } STRUCTURE_HEADER;
STRUCTURE_HEADER mMadtStructureTable[] = { - {EFI_ACPI_4_0_PROCESSOR_LOCAL_APIC, sizeof (EFI_ACPI_4_0_PROCESSOR_LOCAL_APIC_STRUCTURE)}, - {EFI_ACPI_4_0_IO_APIC, sizeof (EFI_ACPI_4_0_IO_APIC_STRUCTURE)}, - {EFI_ACPI_4_0_INTERRUPT_SOURCE_OVERRIDE, sizeof (EFI_ACPI_4_0_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE)}, - {EFI_ACPI_4_0_NON_MASKABLE_INTERRUPT_SOURCE, sizeof (EFI_ACPI_4_0_NON_MASKABLE_INTERRUPT_SOURCE_STRUCTURE)}, - {EFI_ACPI_4_0_LOCAL_APIC_NMI, sizeof (EFI_ACPI_4_0_LOCAL_APIC_NMI_STRUCTURE)}, - {EFI_ACPI_4_0_LOCAL_APIC_ADDRESS_OVERRIDE, sizeof (EFI_ACPI_4_0_LOCAL_APIC_ADDRESS_OVERRIDE_STRUCTURE)}, - {EFI_ACPI_4_0_IO_SAPIC, sizeof (EFI_ACPI_4_0_IO_SAPIC_STRUCTURE)}, - {EFI_ACPI_4_0_LOCAL_SAPIC, sizeof (EFI_ACPI_4_0_PROCESSOR_LOCAL_SAPIC_STRUCTURE)}, - {EFI_ACPI_4_0_PLATFORM_INTERRUPT_SOURCES, sizeof (EFI_ACPI_4_0_PLATFORM_INTERRUPT_SOURCES_STRUCTURE)}, - {EFI_ACPI_4_0_PROCESSOR_LOCAL_X2APIC, sizeof (EFI_ACPI_4_0_PROCESSOR_LOCAL_X2APIC_STRUCTURE)}, - {EFI_ACPI_4_0_LOCAL_X2APIC_NMI, sizeof (EFI_ACPI_4_0_LOCAL_X2APIC_NMI_STRUCTURE)} + {EFI_ACPI_6_3_PROCESSOR_LOCAL_APIC, sizeof (EFI_ACPI_6_3_PROCESSOR_LOCAL_APIC_STRUCTURE)}, + {EFI_ACPI_6_3_IO_APIC, sizeof (EFI_ACPI_6_3_IO_APIC_STRUCTURE)}, + {EFI_ACPI_6_3_INTERRUPT_SOURCE_OVERRIDE, sizeof (EFI_ACPI_6_3_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE)}, + {EFI_ACPI_6_3_NON_MASKABLE_INTERRUPT_SOURCE, sizeof (EFI_ACPI_6_3_NON_MASKABLE_INTERRUPT_SOURCE_STRUCTURE)}, + {EFI_ACPI_6_3_LOCAL_APIC_NMI, sizeof (EFI_ACPI_6_3_LOCAL_APIC_NMI_STRUCTURE)}, + {EFI_ACPI_6_3_LOCAL_APIC_ADDRESS_OVERRIDE, sizeof (EFI_ACPI_6_3_LOCAL_APIC_ADDRESS_OVERRIDE_STRUCTURE)}, + {EFI_ACPI_6_3_IO_SAPIC, sizeof (EFI_ACPI_6_3_IO_SAPIC_STRUCTURE)}, + {EFI_ACPI_6_3_LOCAL_SAPIC, sizeof (EFI_ACPI_6_3_PROCESSOR_LOCAL_SAPIC_STRUCTURE)}, + {EFI_ACPI_6_3_PLATFORM_INTERRUPT_SOURCES, sizeof (EFI_ACPI_6_3_PLATFORM_INTERRUPT_SOURCES_STRUCTURE)}, + {EFI_ACPI_6_3_PROCESSOR_LOCAL_X2APIC, sizeof (EFI_ACPI_6_3_PROCESSOR_LOCAL_X2APIC_STRUCTURE)}, + {EFI_ACPI_6_3_LOCAL_X2APIC_NMI, sizeof (EFI_ACPI_6_3_LOCAL_X2APIC_NMI_STRUCTURE)} };
/** @@ -591,7 +592,7 @@ InitializeHeader ( **/ EFI_STATUS InitializeMadtHeader ( - IN OUT EFI_ACPI_4_0_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER *MadtHeader + IN OUT EFI_ACPI_6_3_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER + *MadtHeader ) { EFI_STATUS Status; @@ -603,8 +604,8 @@ InitializeMadtHeader (
Status = InitializeHeader ( &MadtHeader->Header, - EFI_ACPI_4_0_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE, - EFI_ACPI_4_0_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION, + EFI_ACPI_6_3_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE, + EFI_ACPI_6_3_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION, 0 ); if (EFI_ERROR (Status)) { @@ -612,7 +613,7 @@ InitializeMadtHeader ( }
MadtHeader->LocalApicAddress = PcdGet32(PcdLocalApicAddress); - MadtHeader->Flags = EFI_ACPI_4_0_PCAT_COMPAT; + MadtHeader->Flags = EFI_ACPI_6_3_PCAT_COMPAT;
return EFI_SUCCESS; } @@ -649,7 +650,7 @@ CopyStructure ( // // Initialize the number of table entries and the table based on the table header passed in. // - if (Header->Signature == EFI_ACPI_4_0_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE) { + if (Header->Signature == + EFI_ACPI_6_3_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE) { TableNumEntries = sizeof (mMadtStructureTable) / sizeof (STRUCTURE_HEADER); StructureTable = mMadtStructureTable; } else { @@ -759,7 +760,7 @@ BuildAcpiTable ( return EFI_INVALID_PARAMETER; }
- if (AcpiHeader->Signature != EFI_ACPI_4_0_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE) { + if (AcpiHeader->Signature != + EFI_ACPI_6_3_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE) { DEBUG (( DEBUG_ERROR, "MADT header signature is expected, actually 0x%08x\n", @@ -850,15 +851,15 @@ InstallMadtFromScratch ( { EFI_STATUS Status; UINTN Index; - EFI_ACPI_4_0_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER *NewMadtTable; + EFI_ACPI_6_3_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER *NewMadtTable; UINTN TableHandle; - EFI_ACPI_4_0_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER MadtTableHeader; - EFI_ACPI_4_0_PROCESSOR_LOCAL_APIC_STRUCTURE ProcLocalApicStruct; - EFI_ACPI_4_0_IO_APIC_STRUCTURE IoApicStruct; - EFI_ACPI_4_0_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE IntSrcOverrideStruct; - EFI_ACPI_4_0_LOCAL_APIC_NMI_STRUCTURE LocalApciNmiStruct; - EFI_ACPI_4_0_PROCESSOR_LOCAL_X2APIC_STRUCTURE ProcLocalX2ApicStruct; - EFI_ACPI_4_0_LOCAL_X2APIC_NMI_STRUCTURE LocalX2ApicNmiStruct; + EFI_ACPI_6_3_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER MadtTableHeader; + EFI_ACPI_6_3_PROCESSOR_LOCAL_APIC_STRUCTURE ProcLocalApicStruct; + EFI_ACPI_6_3_IO_APIC_STRUCTURE IoApicStruct; + EFI_ACPI_6_3_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE IntSrcOverrideStruct; + EFI_ACPI_6_3_LOCAL_APIC_NMI_STRUCTURE LocalApciNmiStruct; + EFI_ACPI_6_3_PROCESSOR_LOCAL_X2APIC_STRUCTURE ProcLocalX2ApicStruct; + EFI_ACPI_6_3_LOCAL_X2APIC_NMI_STRUCTURE LocalX2ApicNmiStruct; STRUCTURE_HEADER **MadtStructs; UINTN MaxMadtStructCount; UINTN MadtStructsIndex; @@ -915,11 +916,11 @@ InstallMadtFromScratch ( // // Build Processor Local APIC Structures and Processor Local X2APIC Structures // - ProcLocalApicStruct.Type = EFI_ACPI_4_0_PROCESSOR_LOCAL_APIC; - ProcLocalApicStruct.Length = sizeof (EFI_ACPI_4_0_PROCESSOR_LOCAL_APIC_STRUCTURE); + ProcLocalApicStruct.Type = EFI_ACPI_6_3_PROCESSOR_LOCAL_APIC; + ProcLocalApicStruct.Length = sizeof + (EFI_ACPI_6_3_PROCESSOR_LOCAL_APIC_STRUCTURE);
- ProcLocalX2ApicStruct.Type = EFI_ACPI_4_0_PROCESSOR_LOCAL_X2APIC; - ProcLocalX2ApicStruct.Length = sizeof (EFI_ACPI_4_0_PROCESSOR_LOCAL_X2APIC_STRUCTURE); + ProcLocalX2ApicStruct.Type = EFI_ACPI_6_3_PROCESSOR_LOCAL_X2APIC; + ProcLocalX2ApicStruct.Length = sizeof + (EFI_ACPI_6_3_PROCESSOR_LOCAL_X2APIC_STRUCTURE); ProcLocalX2ApicStruct.Reserved[0] = 0; ProcLocalX2ApicStruct.Reserved[1] = 0;
@@ -930,9 +931,9 @@ InstallMadtFromScratch ( // use a processor local x2APIC structure. // if (!mX2ApicEnabled && mCpuApicIdOrderTable[Index].ApicId < MAX_UINT8) { - ProcLocalApicStruct.Flags = (UINT8) mCpuApicIdOrderTable[Index].Flags; - ProcLocalApicStruct.ApicId = (UINT8) mCpuApicIdOrderTable[Index].ApicId; - ProcLocalApicStruct.AcpiProcessorId = (UINT8) mCpuApicIdOrderTable[Index].AcpiProcessorId; + ProcLocalApicStruct.Flags = (UINT8) mCpuApicIdOrderTable[Index].Flags; + ProcLocalApicStruct.ApicId = (UINT8) mCpuApicIdOrderTable[Index].ApicId; + ProcLocalApicStruct.AcpiProcessorUid = (UINT8) + mCpuApicIdOrderTable[Index].AcpiProcessorUid;
ASSERT (MadtStructsIndex < MaxMadtStructCount); Status = CopyStructure ( @@ -943,7 +944,7 @@ InstallMadtFromScratch ( } else if (mCpuApicIdOrderTable[Index].ApicId != 0xFFFFFFFF) { ProcLocalX2ApicStruct.Flags = (UINT8) mCpuApicIdOrderTable[Index].Flags; ProcLocalX2ApicStruct.X2ApicId = mCpuApicIdOrderTable[Index].ApicId; - ProcLocalX2ApicStruct.AcpiProcessorUid = mCpuApicIdOrderTable[Index].AcpiProcessorId; + ProcLocalX2ApicStruct.AcpiProcessorUid = + mCpuApicIdOrderTable[Index].AcpiProcessorUid;
ASSERT (MadtStructsIndex < MaxMadtStructCount); Status = CopyStructure ( @@ -961,8 +962,8 @@ InstallMadtFromScratch ( // // Build I/O APIC Structures // - IoApicStruct.Type = EFI_ACPI_4_0_IO_APIC; - IoApicStruct.Length = sizeof (EFI_ACPI_4_0_IO_APIC_STRUCTURE); + IoApicStruct.Type = EFI_ACPI_6_3_IO_APIC; IoApicStruct.Length = + sizeof (EFI_ACPI_6_3_IO_APIC_STRUCTURE); IoApicStruct.Reserved = 0;
PcIoApicEnable = PcdGet32(PcdPcIoApicEnable); @@ -1008,8 +1009,8 @@ InstallMadtFromScratch ( // // Build Interrupt Source Override Structures // - IntSrcOverrideStruct.Type = EFI_ACPI_4_0_INTERRUPT_SOURCE_OVERRIDE; - IntSrcOverrideStruct.Length = sizeof (EFI_ACPI_4_0_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE); + IntSrcOverrideStruct.Type = EFI_ACPI_6_3_INTERRUPT_SOURCE_OVERRIDE; + IntSrcOverrideStruct.Length = sizeof + (EFI_ACPI_6_3_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE);
// // IRQ0=>IRQ2 Interrupt Source Override Structure @@ -1052,11 +1053,11 @@ InstallMadtFromScratch ( // // Build Local APIC NMI Structures // - LocalApciNmiStruct.Type = EFI_ACPI_4_0_LOCAL_APIC_NMI; - LocalApciNmiStruct.Length = sizeof (EFI_ACPI_4_0_LOCAL_APIC_NMI_STRUCTURE); - LocalApciNmiStruct.AcpiProcessorId = 0xFF; // Applies to all processors - LocalApciNmiStruct.Flags = 0x0005; // Flags - Edge-tiggered, Active High - LocalApciNmiStruct.LocalApicLint = 0x1; + LocalApciNmiStruct.Type = EFI_ACPI_6_3_LOCAL_APIC_NMI; + LocalApciNmiStruct.Length = sizeof (EFI_ACPI_6_3_LOCAL_APIC_NMI_STRUCTURE); + LocalApciNmiStruct.AcpiProcessorUid = 0xFF; // Applies to all processors + LocalApciNmiStruct.Flags = 0x0005; // Flags - Edge-tiggered, Active High + LocalApciNmiStruct.LocalApicLint = 0x1;
ASSERT (MadtStructsIndex < MaxMadtStructCount); Status = CopyStructure ( @@ -1073,8 +1074,8 @@ InstallMadtFromScratch ( // Build Local x2APIC NMI Structure // if (mX2ApicEnabled) { - LocalX2ApicNmiStruct.Type = EFI_ACPI_4_0_LOCAL_X2APIC_NMI; - LocalX2ApicNmiStruct.Length = sizeof (EFI_ACPI_4_0_LOCAL_X2APIC_NMI_STRUCTURE); + LocalX2ApicNmiStruct.Type = EFI_ACPI_6_3_LOCAL_X2APIC_NMI; + LocalX2ApicNmiStruct.Length = sizeof + (EFI_ACPI_6_3_LOCAL_X2APIC_NMI_STRUCTURE); LocalX2ApicNmiStruct.Flags = 0x000D; // Flags - Level-tiggered, Active High LocalX2ApicNmiStruct.AcpiProcessorUid = 0xFFFFFFFF; // Applies to all processors LocalX2ApicNmiStruct.LocalX2ApicLint = 0x01; @@ -1099,7 +1100,7 @@ InstallMadtFromScratch ( // Status = BuildAcpiTable ( (EFI_ACPI_DESCRIPTION_HEADER *) &MadtTableHeader, - sizeof (EFI_ACPI_4_0_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER), + sizeof (EFI_ACPI_6_3_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER), MadtStructs, MadtStructsIndex, (UINT8 **)&NewMadtTable @@ -1222,7 +1223,7 @@ PlatformUpdateTables ( EFI_ACPI_DESCRIPTION_HEADER *TableHeader; UINT8 *TempOemId; UINT64 TempOemTableId; - EFI_ACPI_5_0_FIXED_ACPI_DESCRIPTION_TABLE *FadtHeader; + EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE *FadtHeader; EFI_ACPI_HIGH_PRECISION_EVENT_TIMER_TABLE_HEADER *HpetTable; UINT32 HpetBaseAddress; EFI_ACPI_HIGH_PRECISION_EVENT_TIMER_BLOCK_ID HpetBlockId; @@ -1279,12 +1280,12 @@ PlatformUpdateTables ( // switch (Table->Signature) {
- case EFI_ACPI_4_0_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE: + case EFI_ACPI_6_3_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE: ASSERT(FALSE); break;
- case EFI_ACPI_5_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE: - FadtHeader = (EFI_ACPI_5_0_FIXED_ACPI_DESCRIPTION_TABLE *) Table; + case EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE: + FadtHeader = (EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE *) Table;
FadtHeader->PreferredPmProfile = PcdGet8 (PcdFadtPreferredPmProfile); FadtHeader->IaPcBootArch = PcdGet16 (PcdFadtIaPcBootArch); @@ -1329,7 +1330,7 @@ PlatformUpdateTables ( DEBUG(( EFI_D_ERROR, " Flags 0x%x\n", FadtHeader->Flags )); break;
- case EFI_ACPI_3_0_HIGH_PRECISION_EVENT_TIMER_TABLE_SIGNATURE: + case EFI_ACPI_6_3_HIGH_PRECISION_EVENT_TIMER_TABLE_SIGNATURE: HpetTable = (EFI_ACPI_HIGH_PRECISION_EVENT_TIMER_TABLE_HEADER *)Table; HpetBaseAddress = PcdGet32 (PcdHpetBaseAddress); HpetTable->BaseAddressLower32Bit.Address = HpetBaseAddress; @@ - 1381,8 +1382,8 @@ IsHardwareChange ( UINTN HWChangeSize; UINT32 PciId; UINTN Handle; - EFI_ACPI_2_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *FacsPtr; - EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *pFADT; + EFI_ACPI_6_3_FIRMWARE_ACPI_CONTROL_STRUCTURE *FacsPtr; + EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE *pFADT;
HandleCount = 0; HandleBuffer = NULL; @@ -1428,7 +1429,7 @@ IsHardwareChange ( // Handle = 0; Status = LocateAcpiTableBySignature ( - EFI_ACPI_1_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE, + EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE, (EFI_ACPI_DESCRIPTION_HEADER **) &pFADT, &Handle ); @@ -1450,7 +1451,7 @@ IsHardwareChange ( // // Set HardwareSignature value based on CRC value. // - FacsPtr = (EFI_ACPI_2_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *)(UINTN)pFADT->FirmwareCtrl; + FacsPtr = (EFI_ACPI_6_3_FIRMWARE_ACPI_CONTROL_STRUCTURE + *)(UINTN)pFADT->FirmwareCtrl; FacsPtr->HardwareSignature = CRC; FreePool( HWChange ); } diff --git a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Facs/Facs.c b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Facs/Facs.c index cde6e478c6b9..8700c44e633d 100644 --- a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Facs/Facs.c +++ b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Facs/Facs.c @@ -1,9 +1,10 @@ /** @file - This file contains a structure definition for the ACPI 5.0 Firmware ACPI + This file contains a structure definition for the ACPI 6.3 Firmware + ACPI Control Structure (FACS). The contents of this file should only be modified for bug fixes, no porting is required.
Copyright (c) 2017, Intel Corporation. All rights reserved.<BR> +Copyright (c) Microsoft Corporation.<BR> SPDX-License-Identifier: BSD-2-Clause-Patent
**/ @@ -35,9 +36,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent // Please modify all values in Facs.h only. //
-EFI_ACPI_5_0_FIRMWARE_ACPI_CONTROL_STRUCTURE Facs = { - EFI_ACPI_5_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE, - sizeof (EFI_ACPI_5_0_FIRMWARE_ACPI_CONTROL_STRUCTURE), +EFI_ACPI_6_3_FIRMWARE_ACPI_CONTROL_STRUCTURE Facs = { + EFI_ACPI_6_3_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE, + sizeof (EFI_ACPI_6_3_FIRMWARE_ACPI_CONTROL_STRUCTURE),
// // Hardware Signature will be updated at runtime @@ -48,7 +49,7 @@ EFI_ACPI_5_0_FIRMWARE_ACPI_CONTROL_STRUCTURE Facs = { EFI_ACPI_GLOBAL_LOCK, EFI_ACPI_FIRMWARE_CONTROL_STRUCTURE_FLAGS, EFI_ACPI_X_FIRMWARE_WAKING_VECTOR, - EFI_ACPI_5_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_VERSION, + EFI_ACPI_6_3_FIRMWARE_ACPI_CONTROL_STRUCTURE_VERSION, { EFI_ACPI_RESERVED_BYTE, EFI_ACPI_RESERVED_BYTE, diff --git a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Fadt/Fadt.c b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Fadt/Fadt.c index 6efb38cda40d..38e767856de7 100644 --- a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Fadt/Fadt.c +++ b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Fadt/Fadt.c @@ -1,9 +1,10 @@ /** @file - This file contains a structure definition for the ACPI 5.0 Fixed ACPI + This file contains a structure definition for the ACPI 6.3 Fixed ACPI Description Table (FADT). The contents of this file should only be modified for bug fixes, no porting is required.
Copyright (c) 2017, Intel Corporation. All rights reserved.<BR> +Copyright (c) Microsoft Corporation.<BR> SPDX-License-Identifier: BSD-2-Clause-Patent
**/ @@ -47,6 +48,12 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#define EFI_ACPI_IAPC_BOOT_ARCH 0 // To be fixed
+// +// ARM Boot Architecture Flags +// + +#define EFI_ACPI_ARM_BOOT_ARCH 0 // To be fixed + // // Fixed Feature Flags // @@ -55,7 +62,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent // // PM1A Event Register Block Generic Address Information // -#define EFI_ACPI_PM1A_EVT_BLK_ADDRESS_SPACE_ID EFI_ACPI_2_0_SYSTEM_IO +#define EFI_ACPI_PM1A_EVT_BLK_ADDRESS_SPACE_ID EFI_ACPI_6_3_SYSTEM_IO #define EFI_ACPI_PM1A_EVT_BLK_BIT_WIDTH 0x20 #define EFI_ACPI_PM1A_EVT_BLK_BIT_OFFSET 0x00 #define EFI_ACPI_PM1A_EVT_BLK_ADDRESS 0 // To be fixed @@ -63,7 +70,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent // // PM1B Event Register Block Generic Address Information // -#define EFI_ACPI_PM1B_EVT_BLK_ADDRESS_SPACE_ID EFI_ACPI_2_0_SYSTEM_IO +#define EFI_ACPI_PM1B_EVT_BLK_ADDRESS_SPACE_ID EFI_ACPI_6_3_SYSTEM_IO #define EFI_ACPI_PM1B_EVT_BLK_BIT_WIDTH 0x00 #define EFI_ACPI_PM1B_EVT_BLK_BIT_OFFSET 0x00 #define EFI_ACPI_PM1B_EVT_BLK_ADDRESS 0 // To be fixed @@ -71,7 +78,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent // // PM1A Control Register Block Generic Address Information // -#define EFI_ACPI_PM1A_CNT_BLK_ADDRESS_SPACE_ID EFI_ACPI_2_0_SYSTEM_IO +#define EFI_ACPI_PM1A_CNT_BLK_ADDRESS_SPACE_ID EFI_ACPI_6_3_SYSTEM_IO #define EFI_ACPI_PM1A_CNT_BLK_BIT_WIDTH 0x10 #define EFI_ACPI_PM1A_CNT_BLK_BIT_OFFSET 0x00 #define EFI_ACPI_PM1A_CNT_BLK_ADDRESS 0 // To be fixed @@ -79,7 +86,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent // // PM1B Control Register Block Generic Address Information // -#define EFI_ACPI_PM1B_CNT_BLK_ADDRESS_SPACE_ID EFI_ACPI_2_0_SYSTEM_IO +#define EFI_ACPI_PM1B_CNT_BLK_ADDRESS_SPACE_ID EFI_ACPI_6_3_SYSTEM_IO #define EFI_ACPI_PM1B_CNT_BLK_BIT_WIDTH 0x00 #define EFI_ACPI_PM1B_CNT_BLK_BIT_OFFSET 0x00 #define EFI_ACPI_PM1B_CNT_BLK_ADDRESS 0 // To be fixed @@ -87,7 +94,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent // // PM2 Control Register Block Generic Address Information // -#define EFI_ACPI_PM2_CNT_BLK_ADDRESS_SPACE_ID EFI_ACPI_2_0_SYSTEM_IO +#define EFI_ACPI_PM2_CNT_BLK_ADDRESS_SPACE_ID EFI_ACPI_6_3_SYSTEM_IO #define EFI_ACPI_PM2_CNT_BLK_BIT_WIDTH 0x08 #define EFI_ACPI_PM2_CNT_BLK_BIT_OFFSET 0x00 #define EFI_ACPI_PM2_CNT_BLK_ADDRESS 0 // To be fixed @@ -96,7 +103,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent // Power Management Timer Control Register Block Generic Address // Information // -#define EFI_ACPI_PM_TMR_BLK_ADDRESS_SPACE_ID EFI_ACPI_2_0_SYSTEM_IO +#define EFI_ACPI_PM_TMR_BLK_ADDRESS_SPACE_ID EFI_ACPI_6_3_SYSTEM_IO #define EFI_ACPI_PM_TMR_BLK_BIT_WIDTH 0x20 #define EFI_ACPI_PM_TMR_BLK_BIT_OFFSET 0x00 #define EFI_ACPI_PM_TMR_BLK_ADDRESS 0 // To be fixed @@ -105,7 +112,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent // General Purpose Event 0 Register Block Generic Address // Information // - #define EFI_ACPI_GPE0_BLK_ADDRESS_SPACE_ID EFI_ACPI_2_0_SYSTEM_IO +#define EFI_ACPI_GPE0_BLK_ADDRESS_SPACE_ID EFI_ACPI_6_3_SYSTEM_IO #define EFI_ACPI_GPE0_BLK_BIT_WIDTH 0 // size of R_PCH_ACPI_GPE0_STS_127_96 + R_PCH_ACPI_GPE0_EN_127_96 #define EFI_ACPI_GPE0_BLK_BIT_OFFSET 0x00 #define EFI_ACPI_GPE0_BLK_ADDRESS 0 // To be fixed @@ -114,14 +121,14 @@ SPDX-License-Identifier: BSD-2-Clause-Patent // General Purpose Event 1 Register Block Generic Address // Information // - #define EFI_ACPI_GPE1_BLK_ADDRESS_SPACE_ID EFI_ACPI_2_0_SYSTEM_IO +#define EFI_ACPI_GPE1_BLK_ADDRESS_SPACE_ID EFI_ACPI_6_3_SYSTEM_IO #define EFI_ACPI_GPE1_BLK_BIT_WIDTH 0x0 #define EFI_ACPI_GPE1_BLK_BIT_OFFSET 0x0 #define EFI_ACPI_GPE1_BLK_ADDRESS 0 // To be fixed // // Reset Register Generic Address Information // -#define EFI_ACPI_RESET_REG_ADDRESS_SPACE_ID EFI_ACPI_2_0_SYSTEM_IO +#define EFI_ACPI_RESET_REG_ADDRESS_SPACE_ID EFI_ACPI_6_3_SYSTEM_IO #define EFI_ACPI_RESET_REG_BIT_WIDTH 0x08 #define EFI_ACPI_RESET_REG_BIT_OFFSET 0x00 #define EFI_ACPI_RESET_REG_ADDRESS 0x00000CF9 @@ -162,11 +169,11 @@ SPDX-License-Identifier: BSD-2-Clause-Patent // Please modify all values in Fadt.h only. //
-EFI_ACPI_5_0_FIXED_ACPI_DESCRIPTION_TABLE Fadt = { +EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE Fadt = { { - EFI_ACPI_5_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE, - sizeof (EFI_ACPI_5_0_FIXED_ACPI_DESCRIPTION_TABLE), - EFI_ACPI_5_0_FIXED_ACPI_DESCRIPTION_TABLE_REVISION, + EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE, + sizeof (EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE), + EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE_REVISION,
// // Checksum will be updated at runtime @@ -187,9 +194,9 @@ EFI_ACPI_5_0_FIXED_ACPI_DESCRIPTION_TABLE Fadt = { // // These addresses will be updated at runtime // - 0x00000000, 0x00000000, - + 0x00000000, + EFI_ACPI_RESERVED_BYTE, EFI_ACPI_PREFERRED_PM_PROFILE, EFI_ACPI_SCI_INT, @@ -198,7 +205,7 @@ EFI_ACPI_5_0_FIXED_ACPI_DESCRIPTION_TABLE Fadt = { EFI_ACPI_ACPI_DISABLE, EFI_ACPI_S4_BIOS_REQ, EFI_ACPI_PSTATE_CNT, - + EFI_ACPI_PM1A_EVT_BLK_ADDRESS, EFI_ACPI_PM1B_EVT_BLK_ADDRESS, EFI_ACPI_PM1A_CNT_BLK_ADDRESS, @@ -240,15 +247,13 @@ EFI_ACPI_5_0_FIXED_ACPI_DESCRIPTION_TABLE Fadt = { EFI_ACPI_RESET_REG_ADDRESS_SPACE_ID, EFI_ACPI_RESET_REG_BIT_WIDTH, EFI_ACPI_RESET_REG_BIT_OFFSET, - EFI_ACPI_5_0_BYTE, + EFI_ACPI_6_3_BYTE, EFI_ACPI_RESET_REG_ADDRESS }, EFI_ACPI_RESET_VALUE, - { - EFI_ACPI_RESERVED_BYTE, - EFI_ACPI_RESERVED_BYTE, - EFI_ACPI_RESERVED_BYTE - }, + + EFI_ACPI_ARM_BOOT_ARCH, + EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE_MINOR_REVISION,
// // These addresses will be updated at runtime @@ -263,7 +268,7 @@ EFI_ACPI_5_0_FIXED_ACPI_DESCRIPTION_TABLE Fadt = { EFI_ACPI_PM1A_EVT_BLK_ADDRESS_SPACE_ID, EFI_ACPI_PM1A_EVT_BLK_BIT_WIDTH, EFI_ACPI_PM1A_EVT_BLK_BIT_OFFSET, - EFI_ACPI_5_0_WORD, + EFI_ACPI_6_3_WORD, EFI_ACPI_PM1A_EVT_BLK_ADDRESS }, { @@ -273,7 +278,7 @@ EFI_ACPI_5_0_FIXED_ACPI_DESCRIPTION_TABLE Fadt = { EFI_ACPI_PM1B_EVT_BLK_ADDRESS_SPACE_ID, EFI_ACPI_PM1B_EVT_BLK_BIT_WIDTH, EFI_ACPI_PM1B_EVT_BLK_BIT_OFFSET, - EFI_ACPI_5_0_WORD, + EFI_ACPI_6_3_WORD, EFI_ACPI_PM1B_EVT_BLK_ADDRESS }, { @@ -283,7 +288,7 @@ EFI_ACPI_5_0_FIXED_ACPI_DESCRIPTION_TABLE Fadt = { EFI_ACPI_PM1A_CNT_BLK_ADDRESS_SPACE_ID, EFI_ACPI_PM1A_CNT_BLK_BIT_WIDTH, EFI_ACPI_PM1A_CNT_BLK_BIT_OFFSET, - EFI_ACPI_5_0_WORD, + EFI_ACPI_6_3_WORD, EFI_ACPI_PM1A_CNT_BLK_ADDRESS }, { @@ -293,7 +298,7 @@ EFI_ACPI_5_0_FIXED_ACPI_DESCRIPTION_TABLE Fadt = { EFI_ACPI_PM1B_CNT_BLK_ADDRESS_SPACE_ID, EFI_ACPI_PM1B_CNT_BLK_BIT_WIDTH, EFI_ACPI_PM1B_CNT_BLK_BIT_OFFSET, - EFI_ACPI_5_0_WORD, + EFI_ACPI_6_3_WORD, EFI_ACPI_PM1B_CNT_BLK_ADDRESS }, { @@ -303,7 +308,7 @@ EFI_ACPI_5_0_FIXED_ACPI_DESCRIPTION_TABLE Fadt = { EFI_ACPI_PM2_CNT_BLK_ADDRESS_SPACE_ID, EFI_ACPI_PM2_CNT_BLK_BIT_WIDTH, EFI_ACPI_PM2_CNT_BLK_BIT_OFFSET, - EFI_ACPI_5_0_BYTE, + EFI_ACPI_6_3_BYTE, EFI_ACPI_PM2_CNT_BLK_ADDRESS }, { @@ -313,7 +318,7 @@ EFI_ACPI_5_0_FIXED_ACPI_DESCRIPTION_TABLE Fadt = { EFI_ACPI_PM_TMR_BLK_ADDRESS_SPACE_ID, EFI_ACPI_PM_TMR_BLK_BIT_WIDTH, EFI_ACPI_PM_TMR_BLK_BIT_OFFSET, - EFI_ACPI_5_0_DWORD, + EFI_ACPI_6_3_DWORD, EFI_ACPI_PM_TMR_BLK_ADDRESS }, { @@ -323,7 +328,7 @@ EFI_ACPI_5_0_FIXED_ACPI_DESCRIPTION_TABLE Fadt = { EFI_ACPI_GPE0_BLK_ADDRESS_SPACE_ID, EFI_ACPI_GPE0_BLK_BIT_WIDTH, EFI_ACPI_GPE0_BLK_BIT_OFFSET, - EFI_ACPI_5_0_BYTE, + EFI_ACPI_6_3_BYTE, EFI_ACPI_GPE0_BLK_ADDRESS }, { @@ -333,7 +338,7 @@ EFI_ACPI_5_0_FIXED_ACPI_DESCRIPTION_TABLE Fadt = { EFI_ACPI_GPE1_BLK_ADDRESS_SPACE_ID, EFI_ACPI_GPE1_BLK_BIT_WIDTH, EFI_ACPI_GPE1_BLK_BIT_OFFSET, - EFI_ACPI_5_0_BYTE, + EFI_ACPI_6_3_BYTE, EFI_ACPI_GPE1_BLK_ADDRESS }, { @@ -355,5 +360,10 @@ EFI_ACPI_5_0_FIXED_ACPI_DESCRIPTION_TABLE Fadt = { 0, 0, 0 - } + }, + + // + // Hypervisor Vendor Identity + // + 0x0000000000000000, }; -- 2.28.0.windows.1
|
|