Re: [edk2-devel] [PATCH] MdeModulePkg/HiiDatabase: Do not modify CONST string
Are we looking for any other reviews on this? Thanks, Jeff From: Jeff Brasen Sent: Tuesday, September 22, 2020 4:13 PM To: Bi, Dandan ; devel@edk2.groups.io Cc: Dong, Eric Subject: Re: [PATCH] MdeModulePkg/HiiDatabase: Do not modify CONST string Thanks Dandan, are we waiting for any additional reviews on this change? Thanks, Jeff From: Bi, Dandan mailto:dandan...@intel.com>> Sent: Monday, September 14, 2020 8:15 AM To: Jeff Brasen mailto:jbra...@nvidia.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io> mailto:devel@edk2.groups.io>> Cc: Dong, Eric mailto:eric.d...@intel.com>> Subject: RE: [PATCH] MdeModulePkg/HiiDatabase: Do not modify CONST string External email: Use caution opening links or attachments Reviewed-by: Dandan Bi mailto:dandan...@intel.com>> Thanks, Dandan > -Original Message- > From: Jeff Brasen mailto:jbra...@nvidia.com>> > Sent: Saturday, September 12, 2020 1:09 AM > To: devel@edk2.groups.io<mailto:devel@edk2.groups.io> > Cc: Bi, Dandan mailto:dandan...@intel.com>>; Dong, Eric > mailto:eric.d...@intel.com>>; > Jeff Brasen mailto:jbra...@nvidia.com>> > Subject: [PATCH] MdeModulePkg/HiiDatabase: Do not modify CONST string > > Update function behavior to not modify the incoming string that is marked as > CONST in the prototype. > > Signed-off-by: Jeff Brasen mailto:jbra...@nvidia.com>> > --- > .../Universal/HiiDatabaseDxe/ConfigRouting.c | 12 +++- > 1 file changed, 7 insertions(+), 5 deletions(-) > > diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c > b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c > index 2cad6d29f4..d492b769d5 100644 > --- a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c > +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c > @@ -5497,7 +5497,6 @@ HiiBlockToConfig ( >UINTN Index; UINT8 > *TemBuffer; CHAR16 > *TemString;- CHAR16 TemChar;TmpBuffer = > NULL; @@ - > 5564,10 +5563,13 @@ HiiBlockToConfig ( >// // Copy and an additional '&' to//- > TemChar = *StringPtr;- *StringPtr = '\0';- AppendToMultiString(Config, > ConfigRequest);- *StringPtr = TemChar;+ TemString = AllocateCopyPool > (sizeof (CHAR16) * (StringPtr - ConfigRequest + 1), ConfigRequest);+ if > (TemString == NULL) {+return EFI_OUT_OF_RESOURCES;+ }+ > TemString[StringPtr - ConfigRequest] = '\0';+ AppendToMultiString(Config, > TemString);+ FreePool (TemString);// // Parse each if > exists-- > 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#65900): https://edk2.groups.io/g/devel/message/65900 Mute This Topic: https://groups.io/mt/76784317/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH] uefi-sct/SctPkg: Correct issue with memory protection enabled.
Are we looking for any other reviews on this? Thanks, Jeff From: Samer El-Haj-Mahmoud Sent: Tuesday, September 29, 2020 8:05 AM To: devel@edk2.groups.io; Jeff Brasen ; Laszlo Ersek Cc: eric@intel.com; G Edhaya Chandran ; Samer El-Haj-Mahmoud Subject: RE: [edk2-devel] [PATCH] uefi-sct/SctPkg: Correct issue with memory protection enabled. External email: Use caution opening links or attachments Jeff, Thanks for the patch. I will send a patch to move the Maintainers.txt one level up for consistency with other TianoCore repos. Reviewed-By Samer El-Haj-Mahmoud mailto:samer.el-haj-mahm...@arm.com>> From: devel@edk2.groups.io<mailto:devel@edk2.groups.io> mailto:devel@edk2.groups.io>> On Behalf Of Jeff Brasen via groups.io Sent: Wednesday, September 23, 2020 11:56 AM To: Laszlo Ersek mailto:ler...@redhat.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io> Cc: eric@intel.com<mailto:eric@intel.com>; G Edhaya Chandran mailto:edhaya.chand...@arm.com>> Subject: Re: [edk2-devel] [PATCH] uefi-sct/SctPkg: Correct issue with memory protection enabled. Didn't see it at first as it was not at the top of edk2-test but under uefi-sct. CC'd maintainers Thanks, Jeff From: Laszlo Ersek mailto:ler...@redhat.com>> Sent: Wednesday, September 23, 2020 2:59 AM To: devel@edk2.groups.io<mailto:devel@edk2.groups.io> mailto:devel@edk2.groups.io>>; Jeff Brasen mailto:jbra...@nvidia.com>> Subject: Re: [edk2-devel] [PATCH] uefi-sct/SctPkg: Correct issue with memory protection enabled. External email: Use caution opening links or attachments On 09/23/20 00:13, Jeff Brasen wrote: > Any comments on this change? I suggest CC'ing the maintainers responsible for reviewing this change. (I don't know who they are, unfortunately -- is there a Maintainers.txt file in the uefi-sct tree?) Thanks Laszlo > > > Thanks, > > Jeff > > > From: Jeff Brasen mailto:jbra...@nvidia.com>> > Sent: Friday, September 11, 2020 11:23 AM > To: devel@edk2.groups.io<mailto:devel@edk2.groups.io> > mailto:devel@edk2.groups.io>> > Cc: Jeff Brasen mailto:jbra...@nvidia.com>> > Subject: [PATCH] uefi-sct/SctPkg: Correct issue with memory protection > enabled. > > On systems with memory protection enabled the modification of local > function initialization data results in permission issue. Make a copy of > data prior to modification. > > Signed-off-by: Jeff Brasen mailto:jbra...@nvidia.com>> > --- > .../UnicodeCollationBBTestFunction.c | 38 ++- > .../UnicodeCollation2BBTestFunction.c | 38 ++- > 2 files changed, 42 insertions(+), 34 deletions(-) > > diff --git > a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UnicodeCollation/BlackBoxTest/UnicodeCollationBBTestFunction.c > > b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UnicodeCollation/BlackBoxTest/UnicodeCollationBBTestFunction.c > index 6fa11e6c..e0b4c1d9 100644 > --- > a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UnicodeCollation/BlackBoxTest/UnicodeCollationBBTestFunction.c > +++ > b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UnicodeCollation/BlackBoxTest/UnicodeCollationBBTestFunction.c > @@ -25,7 +25,7 @@ Abstract: > --*/ > > > > > > -#include "SctLib.h" > +#include "SctLib.h" > > #include "UnicodeCollationBBTestMain.h" > > > > > > @@ -337,6 +337,7 @@ BBTestStrLwrFunctionAutoTest ( > }; > > > >CHAR16 TestDataSav[MAX_SIZE_OF_STRING + 1]; > > + CHAR16 TestDataRw[MAX_SIZE_OF_STRING + 1]; > > > > > > > > @@ -368,14 +369,15 @@ BBTestStrLwrFunctionAutoTest ( > // > > // Backup current test data > > // > > +CopyUnicodeString (TestDataRw, TestData[Index]); > > CopyUnicodeString (TestDataSav, TestData[Index]); > > > > // > > // For each test data, test the StrLwr functionality. > > // > > -UnicodeCollation->StrLwr (UnicodeCollation, TestData[Index]); > > +UnicodeCollation->StrLwr (UnicodeCollation, TestDataRw); > > > > -if (CheckStrLwr (TestDataSav, TestData[Index])) { > > +if (CheckStrLwr (TestDataSav, TestDataRw)) { > >AssertionType = EFI_TEST_ASSERTION_PASSED; > > } else { > >AssertionType = EFI_TEST_ASSERTION_FAILED; > > @@ -390,15 +392,15 @@ BBTestStrLwrFunctionAutoTest ( > __FILE__, > > (UINTN)__LINE__, > > TestDataSav, > > -
[edk2-devel] [PATCH v2] MdeModulePkg/DxeCorePerformanceLib: Switch to UnicodeStrnToAsciiStrS
UnicodeStrToAsciiStrS requires that the source string is shorter than the destination buffer and will ASSERT if this is not true. Switch to UnicodeStrnToAsciiStrS as there are cases where the source string is longer than the buffer allocated for the device path. Signed-off-by: Jeff Brasen --- .../Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c index f500e20b32..d378c59dd9 100644 --- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c +++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c @@ -837,7 +837,7 @@ GetDeviceInfoFromHandleAndUpdateLength ( ControllerNameStringSize = FPDT_MAX_PERF_RECORD_SIZE - (*Length) - 1; } -UnicodeStrToAsciiStrS(StringPtr, ComponentNameString, ControllerNameStringSize); +UnicodeStrnToAsciiStrS(StringPtr, ControllerNameStringSize - 1, ComponentNameString, ControllerNameStringSize, &ControllerNameStringSize); // // Add a space in the end of the ControllerName @@ -879,7 +879,7 @@ GetDeviceInfoFromHandleAndUpdateLength ( AsciiStringPtr = ComponentNameString; } - UnicodeStrToAsciiStrS(StringPtr, AsciiStringPtr, DevicePathStringSize); + UnicodeStrnToAsciiStrS(StringPtr, DevicePathStringSize - 1, AsciiStringPtr, DevicePathStringSize, &DevicePathStringSize); *Length += (UINT8)DevicePathStringSize; return EFI_SUCCESS; } -- 2.17.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#61566): https://edk2.groups.io/g/devel/message/61566 Mute This Topic: https://groups.io/mt/75044750/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH v2] MdeModulePkg/DxeCorePerformanceLib: Switch to UnicodeStrnToAsciiStrS
Do we need any additional review on this before it getting submitted? -Jeff -Original Message- From: Bi, Dandan Sent: Tuesday, June 23, 2020 7:36 PM To: Jeff Brasen ; devel@edk2.groups.io Cc: Gao, Liming Subject: RE: [PATCH v2] MdeModulePkg/DxeCorePerformanceLib: Switch to UnicodeStrnToAsciiStrS External email: Use caution opening links or attachments Reviewed-by: Dandan Bi Thanks, Dandan > -Original Message- > From: Jeff Brasen > Sent: Tuesday, June 23, 2020 2:20 AM > To: devel@edk2.groups.io > Cc: Gao, Liming ; Bi, Dandan > ; Jeff Brasen > Subject: [PATCH v2] MdeModulePkg/DxeCorePerformanceLib: Switch to > UnicodeStrnToAsciiStrS > > UnicodeStrToAsciiStrS requires that the source string is shorter than > the destination buffer and will ASSERT if this is not true. Switch to > UnicodeStrnToAsciiStrS as there are cases where the source string is > longer than the buffer allocated for the device path. > > Signed-off-by: Jeff Brasen > --- > .../Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git > a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLi > b.c > b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLi > b.c > index f500e20b32..d378c59dd9 100644 > --- > a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLi > b.c > +++ > b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLi > b.c > @@ -837,7 +837,7 @@ GetDeviceInfoFromHandleAndUpdateLength ( >ControllerNameStringSize = FPDT_MAX_PERF_RECORD_SIZE - > (*Length) - 1; > } > > -UnicodeStrToAsciiStrS(StringPtr, ComponentNameString, > ControllerNameStringSize); > +UnicodeStrnToAsciiStrS(StringPtr, ControllerNameStringSize - 1, > + ComponentNameString, ControllerNameStringSize, > + &ControllerNameStringSize); > > // > // Add a space in the end of the ControllerName @@ -879,7 +879,7 > @@ GetDeviceInfoFromHandleAndUpdateLength ( > AsciiStringPtr = ComponentNameString; >} > > - UnicodeStrToAsciiStrS(StringPtr, AsciiStringPtr, DevicePathStringSize); > + UnicodeStrnToAsciiStrS(StringPtr, DevicePathStringSize - 1, > + AsciiStringPtr, DevicePathStringSize, &DevicePathStringSize); >*Length += (UINT8)DevicePathStringSize; >return EFI_SUCCESS; > } > -- > 2.17.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#62782): https://edk2.groups.io/g/devel/message/62782 Mute This Topic: https://groups.io/mt/75044750/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH] MdeModulePkg/DxeCorePerformanceLib: Switch to UnicodeStrnToAsciiStrS
UnicodeStrToAsciiStrS requires that the source string is shorter than the destination buffer and will ASSERT if this is not true. Switch to UnicodeStrnToAsciiStrS as there are cases where the source string is longer than the buffer allocated for the device path. Signed-off-by: Jeff Brasen --- .../Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c index f500e20b32..89ae6fb964 100644 --- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c +++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c @@ -879,7 +879,7 @@ GetDeviceInfoFromHandleAndUpdateLength ( AsciiStringPtr = ComponentNameString; } - UnicodeStrToAsciiStrS(StringPtr, AsciiStringPtr, DevicePathStringSize); + UnicodeStrnToAsciiStrS(StringPtr, DevicePathStringSize - 1, AsciiStringPtr, DevicePathStringSize, &DevicePathStringSize); *Length += (UINT8)DevicePathStringSize; return EFI_SUCCESS; } -- 2.17.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#60550): https://edk2.groups.io/g/devel/message/60550 Mute This Topic: https://groups.io/mt/74615004/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH] MdeModulePkg/HiiDatabase: Do not modify CONST string
Update function behavior to not modify the incoming string that is marked as CONST in the prototype. Signed-off-by: Jeff Brasen --- .../Universal/HiiDatabaseDxe/ConfigRouting.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c index 2cad6d29f4..d492b769d5 100644 --- a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c @@ -5497,7 +5497,6 @@ HiiBlockToConfig ( UINTN Index; UINT8 *TemBuffer; CHAR16 *TemString; - CHAR16 TemChar; TmpBuffer = NULL; @@ -5564,10 +5563,13 @@ HiiBlockToConfig ( // // Copy and an additional '&' to // - TemChar = *StringPtr; - *StringPtr = '\0'; - AppendToMultiString(Config, ConfigRequest); - *StringPtr = TemChar; + TemString = AllocateCopyPool (sizeof (CHAR16) * (StringPtr - ConfigRequest + 1), ConfigRequest); + if (TemString == NULL) { +return EFI_OUT_OF_RESOURCES; + } + TemString[StringPtr - ConfigRequest] = '\0'; + AppendToMultiString(Config, TemString); + FreePool (TemString); // // Parse each if exists -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#65192): https://edk2.groups.io/g/devel/message/65192 Mute This Topic: https://groups.io/mt/76784317/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH] MdeModulePkg/NonDiscoverablePciDeviceDxe: Add NULL pointer check
Add check for NULL HostAddress in AllocateBuffer as required by UEFI specification. Signed-off-by: Jeff Brasen --- .../NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c | 4 1 file changed, 4 insertions(+) diff --git a/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c index a40c1a9593..363c4a765b 100644 --- a/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c +++ b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c @@ -856,6 +856,10 @@ CoherentPciIoAllocateBuffer ( return EFI_UNSUPPORTED; } + if (HostAddress == NULL) { +return EFI_INVALID_PARAMETER; + } + if ((MemoryType != EfiBootServicesData) && (MemoryType != EfiRuntimeServicesData)) { return EFI_INVALID_PARAMETER; -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#65193): https://edk2.groups.io/g/devel/message/65193 Mute This Topic: https://groups.io/mt/76784482/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH] uefi-sct/SctPkg: Correct issue with memory protection enabled.
On systems with memory protection enabled the modification of local function initialization data results in permission issue. Make a copy of data prior to modification. Signed-off-by: Jeff Brasen --- .../UnicodeCollationBBTestFunction.c | 38 ++- .../UnicodeCollation2BBTestFunction.c | 38 ++- 2 files changed, 42 insertions(+), 34 deletions(-) diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UnicodeCollation/BlackBoxTest/UnicodeCollationBBTestFunction.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UnicodeCollation/BlackBoxTest/UnicodeCollationBBTestFunction.c index 6fa11e6c..e0b4c1d9 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UnicodeCollation/BlackBoxTest/UnicodeCollationBBTestFunction.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UnicodeCollation/BlackBoxTest/UnicodeCollationBBTestFunction.c @@ -25,7 +25,7 @@ Abstract: --*/ -#include "SctLib.h" +#include "SctLib.h" #include "UnicodeCollationBBTestMain.h" @@ -337,6 +337,7 @@ BBTestStrLwrFunctionAutoTest ( }; CHAR16 TestDataSav[MAX_SIZE_OF_STRING + 1]; + CHAR16 TestDataRw[MAX_SIZE_OF_STRING + 1]; @@ -368,14 +369,15 @@ BBTestStrLwrFunctionAutoTest ( // // Backup current test data // +CopyUnicodeString (TestDataRw, TestData[Index]); CopyUnicodeString (TestDataSav, TestData[Index]); // // For each test data, test the StrLwr functionality. // -UnicodeCollation->StrLwr (UnicodeCollation, TestData[Index]); +UnicodeCollation->StrLwr (UnicodeCollation, TestDataRw); -if (CheckStrLwr (TestDataSav, TestData[Index])) { +if (CheckStrLwr (TestDataSav, TestDataRw)) { AssertionType = EFI_TEST_ASSERTION_PASSED; } else { AssertionType = EFI_TEST_ASSERTION_FAILED; @@ -390,15 +392,15 @@ BBTestStrLwrFunctionAutoTest ( __FILE__, (UINTN)__LINE__, TestDataSav, - TestData[Index] + TestDataRw ); -CopyUnicodeString (TestDataSav, TestData[Index]); -UnicodeCollation->StrUpr (UnicodeCollation, TestData[Index]); -UnicodeCollation->StrLwr (UnicodeCollation, TestData[Index]); +CopyUnicodeString (TestDataSav, TestDataRw); +UnicodeCollation->StrUpr (UnicodeCollation, TestDataRw); +UnicodeCollation->StrLwr (UnicodeCollation, TestDataRw); -if (CheckStrEql (TestDataSav, TestData[Index])) { +if (CheckStrEql (TestDataSav, TestDataRw)) { AssertionType = EFI_TEST_ASSERTION_PASSED; } else { AssertionType = EFI_TEST_ASSERTION_FAILED; @@ -413,7 +415,7 @@ BBTestStrLwrFunctionAutoTest ( __FILE__, (UINTN)__LINE__, TestDataSav, - TestData[Index] + TestDataRw ); }; @@ -458,6 +460,7 @@ BBTestStrUprFunctionAutoTest ( }; CHAR16 TestDataSav[MAX_SIZE_OF_STRING + 1]; + CHAR16 TestDataRw[MAX_SIZE_OF_STRING + 1]; @@ -490,13 +493,14 @@ BBTestStrUprFunctionAutoTest ( // Backup current test data // CopyUnicodeString (TestDataSav, TestData[Index]); +CopyUnicodeString (TestDataRw, TestData[Index]); // // For each test data, test the StrUpr functionality. // -UnicodeCollation->StrUpr (UnicodeCollation, TestData[Index]); +UnicodeCollation->StrUpr (UnicodeCollation, TestDataRw); -if (CheckStrUpr (TestDataSav, TestData[Index])) { +if (CheckStrUpr (TestDataSav, TestDataRw)) { AssertionType = EFI_TEST_ASSERTION_PASSED; } else { AssertionType = EFI_TEST_ASSERTION_FAILED; @@ -511,14 +515,14 @@ BBTestStrUprFunctionAutoTest ( __FILE__, (UINTN)__LINE__, TestDataSav, - TestData[Index] + TestDataRw ); -CopyUnicodeString (TestDataSav, TestData[Index]); -UnicodeCollation->StrLwr (UnicodeCollation, TestData[Index]); -UnicodeCollation->StrUpr (UnicodeCollation, TestData[Index]); +CopyUnicodeString (TestDataSav, TestDataRw); +UnicodeCollation->StrLwr (UnicodeCollation, TestDataRw); +UnicodeCollation->StrUpr (UnicodeCollation, TestDataRw); -if (CheckStrEql (TestDataSav, TestData[Index])) { +if (CheckStrEql (TestDataSav, TestDataRw)) { AssertionType = EFI_TEST_ASSERTION_PASSED; } else { AssertionType = EFI_TEST_ASSERTION_FAILED; @@ -533,7 +537,7 @@ BBTestStrUprFunctionAutoTest ( __FILE__, (UINTN)__LINE__,
Re: [edk2-devel] [PATCH] uefi-sct/SctPkg: Correct issue with memory protection enabled.
Any comments on this change? Thanks, Jeff From: Jeff Brasen Sent: Friday, September 11, 2020 11:23 AM To: devel@edk2.groups.io Cc: Jeff Brasen Subject: [PATCH] uefi-sct/SctPkg: Correct issue with memory protection enabled. On systems with memory protection enabled the modification of local function initialization data results in permission issue. Make a copy of data prior to modification. Signed-off-by: Jeff Brasen --- .../UnicodeCollationBBTestFunction.c | 38 ++- .../UnicodeCollation2BBTestFunction.c | 38 ++- 2 files changed, 42 insertions(+), 34 deletions(-) diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UnicodeCollation/BlackBoxTest/UnicodeCollationBBTestFunction.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UnicodeCollation/BlackBoxTest/UnicodeCollationBBTestFunction.c index 6fa11e6c..e0b4c1d9 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UnicodeCollation/BlackBoxTest/UnicodeCollationBBTestFunction.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UnicodeCollation/BlackBoxTest/UnicodeCollationBBTestFunction.c @@ -25,7 +25,7 @@ Abstract: --*/ -#include "SctLib.h" +#include "SctLib.h" #include "UnicodeCollationBBTestMain.h" @@ -337,6 +337,7 @@ BBTestStrLwrFunctionAutoTest ( }; CHAR16 TestDataSav[MAX_SIZE_OF_STRING + 1]; + CHAR16 TestDataRw[MAX_SIZE_OF_STRING + 1]; @@ -368,14 +369,15 @@ BBTestStrLwrFunctionAutoTest ( // // Backup current test data // +CopyUnicodeString (TestDataRw, TestData[Index]); CopyUnicodeString (TestDataSav, TestData[Index]); // // For each test data, test the StrLwr functionality. // -UnicodeCollation->StrLwr (UnicodeCollation, TestData[Index]); +UnicodeCollation->StrLwr (UnicodeCollation, TestDataRw); -if (CheckStrLwr (TestDataSav, TestData[Index])) { +if (CheckStrLwr (TestDataSav, TestDataRw)) { AssertionType = EFI_TEST_ASSERTION_PASSED; } else { AssertionType = EFI_TEST_ASSERTION_FAILED; @@ -390,15 +392,15 @@ BBTestStrLwrFunctionAutoTest ( __FILE__, (UINTN)__LINE__, TestDataSav, - TestData[Index] + TestDataRw ); -CopyUnicodeString (TestDataSav, TestData[Index]); -UnicodeCollation->StrUpr (UnicodeCollation, TestData[Index]); -UnicodeCollation->StrLwr (UnicodeCollation, TestData[Index]); +CopyUnicodeString (TestDataSav, TestDataRw); +UnicodeCollation->StrUpr (UnicodeCollation, TestDataRw); +UnicodeCollation->StrLwr (UnicodeCollation, TestDataRw); -if (CheckStrEql (TestDataSav, TestData[Index])) { +if (CheckStrEql (TestDataSav, TestDataRw)) { AssertionType = EFI_TEST_ASSERTION_PASSED; } else { AssertionType = EFI_TEST_ASSERTION_FAILED; @@ -413,7 +415,7 @@ BBTestStrLwrFunctionAutoTest ( __FILE__, (UINTN)__LINE__, TestDataSav, - TestData[Index] + TestDataRw ); }; @@ -458,6 +460,7 @@ BBTestStrUprFunctionAutoTest ( }; CHAR16 TestDataSav[MAX_SIZE_OF_STRING + 1]; + CHAR16 TestDataRw[MAX_SIZE_OF_STRING + 1]; @@ -490,13 +493,14 @@ BBTestStrUprFunctionAutoTest ( // Backup current test data // CopyUnicodeString (TestDataSav, TestData[Index]); +CopyUnicodeString (TestDataRw, TestData[Index]); // // For each test data, test the StrUpr functionality. // -UnicodeCollation->StrUpr (UnicodeCollation, TestData[Index]); +UnicodeCollation->StrUpr (UnicodeCollation, TestDataRw); -if (CheckStrUpr (TestDataSav, TestData[Index])) { +if (CheckStrUpr (TestDataSav, TestDataRw)) { AssertionType = EFI_TEST_ASSERTION_PASSED; } else { AssertionType = EFI_TEST_ASSERTION_FAILED; @@ -511,14 +515,14 @@ BBTestStrUprFunctionAutoTest ( __FILE__, (UINTN)__LINE__, TestDataSav, - TestData[Index] + TestDataRw ); -CopyUnicodeString (TestDataSav, TestData[Index]); -UnicodeCollation->StrLwr (UnicodeCollation, TestData[Index]); -UnicodeCollation->StrUpr (UnicodeCollation, TestData[Index]); +CopyUnicodeString (TestDataSav, TestDataRw); +UnicodeCollation->StrLwr (UnicodeCollation, TestDataRw); +UnicodeCollation->StrUpr (UnicodeCollation, TestDataRw); -if (CheckStrEql (TestDataSav, TestData[Index])) { +if (CheckStrEql (TestDataSav, TestDataRw))
Re: [edk2-devel] [PATCH] MdeModulePkg/HiiDatabase: Do not modify CONST string
Thanks Dandan, are we waiting for any additional reviews on this change? Thanks, Jeff From: Bi, Dandan Sent: Monday, September 14, 2020 8:15 AM To: Jeff Brasen ; devel@edk2.groups.io Cc: Dong, Eric Subject: RE: [PATCH] MdeModulePkg/HiiDatabase: Do not modify CONST string External email: Use caution opening links or attachments Reviewed-by: Dandan Bi Thanks, Dandan > -Original Message- > From: Jeff Brasen > Sent: Saturday, September 12, 2020 1:09 AM > To: devel@edk2.groups.io > Cc: Bi, Dandan ; Dong, Eric ; > Jeff Brasen > Subject: [PATCH] MdeModulePkg/HiiDatabase: Do not modify CONST string > > Update function behavior to not modify the incoming string that is marked as > CONST in the prototype. > > Signed-off-by: Jeff Brasen > --- > .../Universal/HiiDatabaseDxe/ConfigRouting.c | 12 +++- > 1 file changed, 7 insertions(+), 5 deletions(-) > > diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c > b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c > index 2cad6d29f4..d492b769d5 100644 > --- a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c > +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c > @@ -5497,7 +5497,6 @@ HiiBlockToConfig ( >UINTN Index; UINT8 > *TemBuffer; CHAR16 > *TemString;- CHAR16 TemChar;TmpBuffer = > NULL; @@ - > 5564,10 +5563,13 @@ HiiBlockToConfig ( >// // Copy and an additional '&' to//- > TemChar = *StringPtr;- *StringPtr = '\0';- AppendToMultiString(Config, > ConfigRequest);- *StringPtr = TemChar;+ TemString = AllocateCopyPool > (sizeof (CHAR16) * (StringPtr - ConfigRequest + 1), ConfigRequest);+ if > (TemString == NULL) {+return EFI_OUT_OF_RESOURCES;+ }+ > TemString[StringPtr - ConfigRequest] = '\0';+ AppendToMultiString(Config, > TemString);+ FreePool (TemString);// // Parse each if > exists-- > 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#65474): https://edk2.groups.io/g/devel/message/65474 Mute This Topic: https://groups.io/mt/76784317/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH] uefi-sct/SctPkg: Correct issue with memory protection enabled.
Didn't see it at first as it was not at the top of edk2-test but under uefi-sct. CC'd maintainers Thanks, Jeff From: Laszlo Ersek Sent: Wednesday, September 23, 2020 2:59 AM To: devel@edk2.groups.io ; Jeff Brasen Subject: Re: [edk2-devel] [PATCH] uefi-sct/SctPkg: Correct issue with memory protection enabled. External email: Use caution opening links or attachments On 09/23/20 00:13, Jeff Brasen wrote: > Any comments on this change? I suggest CC'ing the maintainers responsible for reviewing this change. (I don't know who they are, unfortunately -- is there a Maintainers.txt file in the uefi-sct tree?) Thanks Laszlo > > > Thanks, > > Jeff > > ____ > From: Jeff Brasen > Sent: Friday, September 11, 2020 11:23 AM > To: devel@edk2.groups.io > Cc: Jeff Brasen > Subject: [PATCH] uefi-sct/SctPkg: Correct issue with memory protection > enabled. > > On systems with memory protection enabled the modification of local > function initialization data results in permission issue. Make a copy of > data prior to modification. > > Signed-off-by: Jeff Brasen > --- > .../UnicodeCollationBBTestFunction.c | 38 ++- > .../UnicodeCollation2BBTestFunction.c | 38 ++- > 2 files changed, 42 insertions(+), 34 deletions(-) > > diff --git > a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UnicodeCollation/BlackBoxTest/UnicodeCollationBBTestFunction.c > > b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UnicodeCollation/BlackBoxTest/UnicodeCollationBBTestFunction.c > index 6fa11e6c..e0b4c1d9 100644 > --- > a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UnicodeCollation/BlackBoxTest/UnicodeCollationBBTestFunction.c > +++ > b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UnicodeCollation/BlackBoxTest/UnicodeCollationBBTestFunction.c > @@ -25,7 +25,7 @@ Abstract: > --*/ > > > > > > -#include "SctLib.h" > +#include "SctLib.h" > > #include "UnicodeCollationBBTestMain.h" > > > > > > @@ -337,6 +337,7 @@ BBTestStrLwrFunctionAutoTest ( > }; > > > >CHAR16 TestDataSav[MAX_SIZE_OF_STRING + 1]; > > + CHAR16 TestDataRw[MAX_SIZE_OF_STRING + 1]; > > > > > > > > @@ -368,14 +369,15 @@ BBTestStrLwrFunctionAutoTest ( > // > > // Backup current test data > > // > > +CopyUnicodeString (TestDataRw, TestData[Index]); > > CopyUnicodeString (TestDataSav, TestData[Index]); > > > > // > > // For each test data, test the StrLwr functionality. > > // > > -UnicodeCollation->StrLwr (UnicodeCollation, TestData[Index]); > > +UnicodeCollation->StrLwr (UnicodeCollation, TestDataRw); > > > > -if (CheckStrLwr (TestDataSav, TestData[Index])) { > > +if (CheckStrLwr (TestDataSav, TestDataRw)) { > >AssertionType = EFI_TEST_ASSERTION_PASSED; > > } else { > >AssertionType = EFI_TEST_ASSERTION_FAILED; > > @@ -390,15 +392,15 @@ BBTestStrLwrFunctionAutoTest ( > __FILE__, > > (UINTN)__LINE__, > > TestDataSav, > > - TestData[Index] > > + TestDataRw > > ); > > > > > > -CopyUnicodeString (TestDataSav, TestData[Index]); > > -UnicodeCollation->StrUpr (UnicodeCollation, TestData[Index]); > > -UnicodeCollation->StrLwr (UnicodeCollation, TestData[Index]); > > +CopyUnicodeString (TestDataSav, TestDataRw); > > +UnicodeCollation->StrUpr (UnicodeCollation, TestDataRw); > > +UnicodeCollation->StrLwr (UnicodeCollation, TestDataRw); > > > > -if (CheckStrEql (TestDataSav, TestData[Index])) { > > +if (CheckStrEql (TestDataSav, TestDataRw)) { > >AssertionType = EFI_TEST_ASSERTION_PASSED; > > } else { > >AssertionType = EFI_TEST_ASSERTION_FAILED; > > @@ -413,7 +415,7 @@ BBTestStrLwrFunctionAutoTest ( > __FILE__, > > (UINTN)__LINE__, > > TestDataSav, > > - TestData[Index] > > + TestDataRw > > ); > >}; > > > > @@ -458,6 +460,7 @@ BBTestStrUprFunctionAutoTest ( > }; > > > >CHAR16 TestDataSav[MAX_SIZE_OF_STRING + 1]; > > + CHAR16 TestDataRw[MAX_SIZE_OF_STRING +
Re: [edk2-devel] [PATCH v2 3/3] MdeModulePkg/BdsDxe: Set RuntimeServicesSupported variable
I will work on a patch to variable services and other runtime services that have centrallized implementations to have them check the value of this variable during ExitBootServices and then return unsupported if the bit is not set. Thanks, Jeff From: Gao, Zhichao Sent: Wednesday, November 27, 2019 10:29 PM To: Ni, Ray ; Jeff Brasen ; devel@edk2.groups.io Cc: Gao, Liming ; Wu, Hao A ; Kinney, Michael D Subject: RE: [PATCH v2 3/3] MdeModulePkg/BdsDxe: Set RuntimeServicesSupported variable This bitmask value only affect the runtime service at runtime phase. So the implementation should be after the ExitBootServices() called. I think the patch set is only implemented the basic setting of the variable but no implementation of the RuntimeServices. Thanks, Zhichao > -Original Message- > From: Ni, Ray > Sent: Thursday, November 28, 2019 1:02 PM > To: Jeff Brasen ; devel@edk2.groups.io > Cc: Gao, Liming ; Wu, Hao A ; > Gao, Zhichao ; Kinney, Michael D > > Subject: RE: [PATCH v2 3/3] MdeModulePkg/BdsDxe: Set > RuntimeServicesSupported variable > > Jeff, > I think I forgot to ask a very basic question on the new variable > RuntimeServicesSupported. > > What if the variable claims SetVariable() is not supported but OS still calls > SetVariable()? > I think to behave in a consistent way, SetVariable() should reject to service. > But I cannot find it in your patch. > > The similar thing was done for OsIndications variable. > When firmware claims BOOT_TO_SETUP is not supported, the request is ignored > even OS requests to boot to setup,. > > I suggest we change all runtime services implementation to return unsupported > when the accordingly bit in the PCD is not set. > > Thanks, > Ray > > > > -Original Message- > > From: Jeff Brasen > > Sent: Thursday, November 28, 2019 7:25 AM > > To: devel@edk2.groups.io > > Cc: Gao, Liming ; Kinney, Michael D > > ; Wu, Hao A ; Ni, Ray > > ; Gao, Zhichao ; > > jbra...@nvidia.com > > Subject: [PATCH v2 3/3] MdeModulePkg/BdsDxe: Set > > RuntimeServicesSupported variable > > > > Add support for initializing and setting the UEFI 2.8 global variable > > RuntimeServicesSupported based on the value of a PCD. > > > > Change-Id: I8fbd404d492ff8278466edde8aa37d203537318c > > Signed-off-by: Jeff Brasen > > --- > > MdeModulePkg/Universal/BdsDxe/BdsDxe.inf | 1 + > > MdeModulePkg/Universal/BdsDxe/BdsEntry.c | 35 > > +++- > > MdePkg/MdePkg.dec| 18 > > MdePkg/MdePkg.uni| 17 > > 4 files changed, 70 insertions(+), 1 deletion(-) > > > > diff --git a/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf > > b/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf > > index 9310b4d..52ec04f 100644 > > --- a/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf > > +++ b/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf > > @@ -90,6 +90,7 @@ > >gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultPlatformLang ## > > CONSUMES > >gEfiMdePkgTokenSpaceGuid.PcdHardwareErrorRecordLevel## > > CONSUMES > >gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut ## > > CONSUMES > > + gEfiMdePkgTokenSpaceGuid.PcdRuntimeServicesSupported## > > CONSUMES > >gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVendor## > > CONSUMES > >gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareRevision ## > > CONSUMES > >gEfiMdeModulePkgTokenSpaceGuid.PcdConInConnectOnDemand > > ## CONSUMES > > diff --git a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c > > b/MdeModulePkg/Universal/BdsDxe/BdsEntry.c > > index d387dbe..16bc593 100644 > > --- a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c > > +++ b/MdeModulePkg/Universal/BdsDxe/BdsEntry.c > > @@ -40,7 +40,8 @@ CHAR16 *mReadOnlyVariables[] = { > >EFI_LANG_CODES_VARIABLE_NAME, > >EFI_BOOT_OPTION_SUPPORT_VARIABLE_NAME, > >EFI_HW_ERR_REC_SUPPORT_VARIABLE_NAME, > > - EFI_OS_INDICATIONS_SUPPORT_VARIABLE_NAME > > + EFI_OS_INDICATIONS_SUPPORT_VARIABLE_NAME, > > + EFI_RUNTIME_SERVICES_SUPPORTED_VARIABLE_NAME > >}; > > > > CHAR16 *mBdsLoadOptionName[] = { > > @@ -626,6 +627,33 @@ BdsFormalizeOSIndicationVariable ( > > > > /** > > > > + Formalize RuntimeServicesSupported variable. > > + > > +**/ > > +VOID > > +BdsFormalizeRuntimeServicesSupportedVariable ( > > + VOID > > + ) > > +{ > > + EFI_STATU
Re: [edk2-devel] [PATCH] Support skipping automatic BM enumeration
Can we discuss this at the design meeting this week (12/12)? Thanks, Jeff From: Jeff Brasen Sent: Thursday, November 14, 2019 10:04 AM To: Ni, Ray ; devel@edk2.groups.io ; Laszlo Ersek ; af...@apple.com Cc: Ashish Singhal ; Wang, Jian J ; Wu, Hao A ; Gao, Zhichao ; Kinney, Michael D Subject: RE: [edk2-devel] [PATCH] Support skipping automatic BM enumeration Yes, I think that would be good. Summarizing everything in this thread Problem: Platform needs to customize the boot options, this can be done for normal boot but the UiApp calls EfiBootManagerRefreshAllBootOption in a couple places. Potential solutions: 1 – Define new PCD and event group if PCD is set true then signal event instead of calling EfiBootManagerRefreshAllBootOption in UiApp 2 – Add new function to boot manager library and replace call to EfiBootManagerRefreshAllBootOption in UiApp (need to coordinate rollout with updates to all platform. 3 – Add new protocol with new function, if supported call this otherwise call EfiBootManagerRefreshAllBootOption as is done now 4 – For 2/3 use generic function so we don’t need new APIs for future expansion 5 – Update EfiBootManagerRefreshAllBootOption to call platform specific function. Thanks, Jeff From: Ni, Ray Sent: Wednesday, November 13, 2019 7:09 PM To: devel@edk2.groups.io; Jeff Brasen ; Laszlo Ersek ; af...@apple.com Cc: Ashish Singhal ; Wang, Jian J ; Wu, Hao A ; Gao, Zhichao ; Kinney, Michael D Subject: RE: [edk2-devel] [PATCH] Support skipping automatic BM enumeration Jeff, I think it’s a good topic that we could discuss in the open design meeting. Are you ok to present the problem you have and discuss the potential solutions in that meeting? https://github.com/tianocore/tianocore.github.io/wiki/Design-Meeting Thanks, Ray From: devel@edk2.groups.io<mailto:devel@edk2.groups.io> mailto:devel@edk2.groups.io>> On Behalf Of Jeff Brasen Sent: Thursday, November 14, 2019 2:43 AM To: Ni, Ray mailto:ray...@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Laszlo Ersek mailto:ler...@redhat.com>>; af...@apple.com<mailto:af...@apple.com> Cc: Ashish Singhal mailto:ashishsin...@nvidia.com>>; Wang, Jian J mailto:jian.j.w...@intel.com>>; Wu, Hao A mailto:hao.a...@intel.com>>; Gao, Zhichao mailto:zhichao@intel.com>>; Kinney, Michael D mailto:michael.d.kin...@intel.com>> Subject: Re: [edk2-devel] [PATCH] Support skipping automatic BM enumeration Thinking about this more I think we could do this with a PCD and a new group event without having to define any new function interfaces. We could change UiApp and BootManagerMenuApp (and any others that are relevant) from EfiBootManagerRefreshAllBootOption (); to if (FeaturePcdGet (PcdEventBasedRefreshAllBootOptionSupport) { EFI_EVENT Event; gBS->CreateEventEx ( 0, 0, NULL, NULL, &gEventBasedRefreshGuid, &Event ); gBS->SignalEvent (Event); gBS->CloseEvent (Event); } else { EfiBootManagerRefreshAllBootOption (); } Then a platform that wants to do this on its own would just set this pcd and create a group event and do what it needs to do there. Thanks, Jeff From: Jeff Brasen mailto:jbra...@nvidia.com>> Sent: Monday, November 11, 2019 5:00 PM To: Ni, Ray mailto:ray...@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io> mailto:devel@edk2.groups.io>>; Laszlo Ersek mailto:ler...@redhat.com>>; af...@apple.com<mailto:af...@apple.com> mailto:af...@apple.com>> Cc: Ashish Singhal mailto:ashishsin...@nvidia.com>>; Wang, Jian J mailto:jian.j.w...@intel.com>>; Wu, Hao A mailto:hao.a...@intel.com>>; Gao, Zhichao mailto:zhichao@intel.com>>; Kinney, Michael D mailto:michael.d.kin...@intel.com>> Subject: Re: [edk2-devel] [PATCH] Support skipping automatic BM enumeration I am not sure a PCD would work (unless I am missing something) We do want to do a connect all and re-enumerate in UiApp but we need the platform code to be involved in that process. Thanks, Jeff From: Ni, Ray mailto:ray...@intel.com>> Sent: Monday, November 11, 2019 4:58 PM To: devel@edk2.groups.io<mailto:devel@edk2.groups.io> mailto:devel@edk2.groups.io>>; Jeff Brasen mailto:jbra...@nvidia.com>>; Laszlo Ersek mailto:ler...@redhat.com>>; af...@apple.com<mailto:af...@apple.com> mailto:af...@apple.com>> Cc: Ashish Singhal mailto:ashishsin...@nvidia.com>>; Wang, Jian J mailto:jian.j.w...@intel.com>>; Wu, Hao A mailto:hao.a...@intel.com>>; Gao, Zhichao mailto:zhichao@intel.com>>; Kinney, Michael D mailto:michael.d.kin...@intel.com>> Subject: RE: [edk2-devel] [PATCH] Support skipping automatic BM enumeration Jeff, If add
Re: [edk2-devel] [PATCH] Support skipping automatic BM enumeration
Thanks for the summary Ray, for the problem summary only thing I would add would be that platform also wants to create/modify boot options when full enumeration is requested as well. For solutions I prefer option 2 as we don't have to put the same logic everywhere of how to modify the default enumerated list. And if we do that 2b makes more sense as then we don't have to modify all of the existing platforms. I see two things the platform would need to do. 1. Update list created in BmEnumerateBootOptions 2. Delete any no longer valid platform created boot options Thanks, Jeff From: Ni, Ray Sent: Wednesday, December 11, 2019 7:00 AM To: Jeff Brasen ; devel@edk2.groups.io ; Laszlo Ersek ; af...@apple.com ; disc...@edk2.groups.io Cc: Ashish Singhal ; Wang, Jian J ; Wu, Hao A ; Gao, Zhichao ; Kinney, Michael D Subject: RE: [edk2-devel] [PATCH] Support skipping automatic BM enumeration External email: Use caution opening links or attachments Jeff, Tom from AMD booked the meeting for SEV discussion months ago. I am afraid there is no time for this discussion. Let’s try to resolve it in mails. Firstly, let me rephase the problem and your proposed solutions here (subjective + verb + objective). Sunny’s input is also included. Hope Mike K and others can provide inputs. Personally, I agree with 2.b. It helps us to gradually migrate the PlatformBootManagerLib to PlatformBootManager protocol. Protocol with Revision field helps to reduce the impact to old platforms with new APIs added. **Problem: Platform requires certain BlockIo/SimpleFileSystem/LoadFile instances don’t cause Boot created. It’s a need of platform customization. **Details: Boot for BlockIo/SimpleFileSystem/LoadFile are created by API EfiBootMangerRefreshAllBootOptions(). There are 2 places that call this API: 1. Platform Boot Manager calls the API (usually in the full configuration boot path) 2. UiApp calls the API when entering “Boot Manager” page and “Boot Maintenance Manager” page. Platform can change Platform Boot Manager to remove the unneeded Boot in case #1. But platform has no way to remove the Boot created in case #2 . **Potential solutions: 1. Update UiApp * Define a new PCD and a new event group. If PCD is TRUE, UiApp signals the event. Event callback creates the Boot. Otherwise, EfiBootManagerRefreshAllBootOptions() is called. * Add a new PlatformBootManagerLib API (implemented by platform). UiApp calls the new API instead of EfiBootManagerRefreshAllBootOption. (need to coordinate rollout with updates to all platforms). * Add a new protocol (implemented by platform). UiApp calls the new protocol if it exists otherwise calls EfiBootManagerRefreshAllBootOption. 1. Update EfiBootManagerRefreshAllBootOptions() * Add a new library class (implemented by platform). EfiBootManagerRefreshAllBootOption() calls the new library class. * Add a new PlatformBootManager protocol (implemented by platform). EfiBootManagerRefreshAllBootOption() calls the new protocol if it exists. Thanks, Ray From: Jeff Brasen Sent: Wednesday, December 11, 2019 4:46 AM To: Ni, Ray ; devel@edk2.groups.io; Laszlo Ersek ; af...@apple.com; disc...@edk2.groups.io Cc: Ashish Singhal ; Wang, Jian J ; Wu, Hao A ; Gao, Zhichao ; Kinney, Michael D Subject: Re: [edk2-devel] [PATCH] Support skipping automatic BM enumeration Can we discuss this at the design meeting this week (12/12)? Thanks, Jeff ____ From: Jeff Brasen Sent: Thursday, November 14, 2019 10:04 AM To: Ni, Ray mailto:ray...@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io> mailto:devel@edk2.groups.io>>; Laszlo Ersek mailto:ler...@redhat.com>>; af...@apple.com<mailto:af...@apple.com> mailto:af...@apple.com>> Cc: Ashish Singhal mailto:ashishsin...@nvidia.com>>; Wang, Jian J mailto:jian.j.w...@intel.com>>; Wu, Hao A mailto:hao.a...@intel.com>>; Gao, Zhichao mailto:zhichao@intel.com>>; Kinney, Michael D mailto:michael.d.kin...@intel.com>> Subject: RE: [edk2-devel] [PATCH] Support skipping automatic BM enumeration Yes, I think that would be good. Summarizing everything in this thread Problem: Platform needs to customize the boot options, this can be done for normal boot but the UiApp calls EfiBootManagerRefreshAllBootOption in a couple places. Potential solutions: 1 – Define new PCD and event group if PCD is set true then signal event instead of calling EfiBootManagerRefreshAllBootOption in UiApp 2 – Add new function to boot manager library and replace call to EfiBootManagerRefreshAllBootOption in UiApp (need to coordinate rollout with updates to all platform. 3 – Add new protocol with new function, if supported call this otherwise call EfiBootManagerRefres
[edk2-devel] [PATCH 1/1] MdeModulePkg/BmpSupportLib: Allow BMP with extra data
Add support for processing BMP data that contains extra data after the image array, this data will not be parsed in anyway in the library but images that contain this will not be rejected from processing. --- MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c b/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c index 3ac31f6723d0..944d01fe7cdf 100644 --- a/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c +++ b/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c @@ -213,7 +213,7 @@ TranslateBmpToGopBlt ( if ((BmpHeader->Size != BmpImageSize) || (BmpHeader->Size < BmpHeader->ImageOffset) || - (BmpHeader->Size - BmpHeader->ImageOffset != DataSize)) { + (BmpHeader->Size - BmpHeader->ImageOffset < DataSize)) { DEBUG ((DEBUG_ERROR, "TranslateBmpToGopBlt: invalid BmpImage... \n")); DEBUG ((DEBUG_ERROR, " BmpHeader->Size: 0x%x\n", BmpHeader->Size)); -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#73193): https://edk2.groups.io/g/devel/message/73193 Mute This Topic: https://groups.io/mt/81556610/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
Re: [EXTERNAL] [edk2-devel] [PATCH 1/1] MdeModulePkg/BmpSupportLib: Allow BMP with extra data
Some of the logo files we received for the group that makes our assets like this (not sure what tool they were created with) look like they pad the BMP size to 8 bytes. TranslateBmpToGopBlt: invalid BmpImage... BmpHeader->Size: 0xE1038 BmpHeader->ImageOffset: 0x36 BmpImageSize: 0xE1038 DataSize: 0xE1000 TranslateBmpToGopBlt: invalid BmpImage... BmpHeader->Size: 0x2A3038 BmpHeader->ImageOffset: 0x36 BmpImageSize: 0x2A3038 DataSize: 0x2A3000 TranslateBmpToGopBlt: invalid BmpImage... BmpHeader->Size: 0x5EEC38 BmpHeader->ImageOffset: 0x36 BmpImageSize: 0x5EEC38 DataSize: 0x5EEC00 So, each of these has 2 bytes of padding at the end of the file. We could write a tool that would do the same size recalculation in order to update the size in the header and remove the two bytes but it seems that this is a valid BMP file and it doesn't seem correct that UEFI is rejecting it. I can update the commit message with more context if needed as well. Thanks, Jeff From: Laszlo Ersek Sent: Wednesday, March 24, 2021 5:31 AM To: devel@edk2.groups.io ; bret.barke...@microsoft.com ; Jeff Brasen Cc: jian.j.w...@intel.com ; ao.a...@intel.com Subject: Re: [EXTERNAL] [edk2-devel] [PATCH 1/1] MdeModulePkg/BmpSupportLib: Allow BMP with extra data External email: Use caution opening links or attachments On 03/23/21 18:41, Bret Barkelew via groups.io wrote: > Is this a *good* idea? > > What is considered valid extra data? If it’s immaterial to the FW displaying > the image, our policy has been to strip it off BEFORE adding it to the FW > image. Not counting any potential security aspects, stripping out undisplayed portions helps with flash usage too (I think?), so at least some concrete justification in the commit message would be nice... Thanks Laszlo > > - Bret > > From: Jeff Brasen via groups.io<mailto:jbrasen=nvidia@groups.io> > Sent: Tuesday, March 23, 2021 10:29 AM > To: devel@edk2.groups.io<mailto:devel@edk2.groups.io> > Cc: jian.j.w...@intel.com<mailto:jian.j.w...@intel.com>; > ao.a...@intel.com<mailto:ao.a...@intel.com>; Jeff > Brasen<mailto:jbra...@nvidia.com> > Subject: [EXTERNAL] [edk2-devel] [PATCH 1/1] MdeModulePkg/BmpSupportLib: > Allow BMP with extra data > > Add support for processing BMP data that contains extra data after the > image array, this data will not be parsed in anyway in the library but > images that contain this will not be rejected from processing. > > --- > MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c > b/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c > index 3ac31f6723d0..944d01fe7cdf 100644 > --- a/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c > +++ b/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c > @@ -213,7 +213,7 @@ TranslateBmpToGopBlt ( > >if ((BmpHeader->Size != BmpImageSize) || >(BmpHeader->Size < BmpHeader->ImageOffset) || > - (BmpHeader->Size - BmpHeader->ImageOffset != DataSize)) { > + (BmpHeader->Size - BmpHeader->ImageOffset < DataSize)) { > > DEBUG ((DEBUG_ERROR, "TranslateBmpToGopBlt: invalid BmpImage... \n")); > DEBUG ((DEBUG_ERROR, " BmpHeader->Size: 0x%x\n", BmpHeader->Size)); > -- > 2.25.1 > > > > > > > > > > > > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#73212): https://edk2.groups.io/g/devel/message/73212 Mute This Topic: https://groups.io/mt/81556871/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
Re: [EXTERNAL] [edk2-devel] [PATCH 1/1] MdeModulePkg/BmpSupportLib: Allow BMP with extra data
Sorry I was out for a bit so didn't get back to this thread for a bit. Who should be on any additional security review? In TranslateBmpToGopBlt the Size is only used in DEBUG prints and this verification check. Processing of the data uses the image structure data. In addition BMP that have extra data between the color map (if present right after bmp header) and the image data is allowed with an explicit comment. // // BMP file may has padding data between the bmp header section and the // bmp data section. // if (BmpHeader->ImageOffset - sizeof (BMP_IMAGE_HEADER) < sizeof (BMP_COLOR_MAP) * ColorMapNum) { return RETURN_UNSUPPORTED; } Thanks, Jeff From: Bret Barkelew Sent: Thursday, April 1, 2021 11:37 AM To: devel@edk2.groups.io ; zhichao@intel.com ; af...@apple.com ; Laszlo Ersek Cc: Jeff Brasen ; Wang, Jian J ; Wu, Hao A ; Yao, Jiewen ; Liming Gao ; Ni, Ray Subject: RE: [EXTERNAL] [edk2-devel] [PATCH 1/1] MdeModulePkg/BmpSupportLib: Allow BMP with extra data External email: Use caution opening links or attachments I agree with the proposal for a deeper security review. I also would suggest that we can provide tooling with BaseTools to check and/or correct the format of a BMP to match what the code expects (since there seems to be ambiguity in the spec/implementation). We’ve got a validator in Mu and would be happy to put together some patches to at least get this started for the community to hammer on. - Bret From: Gao, Zhichao via groups.io<mailto:zhichao.gao=intel@groups.io> Sent: Monday, March 29, 2021 6:35 PM To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>; af...@apple.com<mailto:af...@apple.com>; Laszlo Ersek<mailto:ler...@redhat.com> Cc: Jeff Brasen<mailto:jbra...@nvidia.com>; Bret Barkelew<mailto:bret.barke...@microsoft.com>; Wang, Jian J<mailto:jian.j.w...@intel.com>; Wu, Hao A<mailto:hao.a...@intel.com>; Yao, Jiewen<mailto:jiewen@intel.com>; Liming Gao<mailto:gaolim...@byosoft.com.cn>; Ni, Ray<mailto:ray...@intel.com> Subject: Re: [EXTERNAL] [edk2-devel] [PATCH 1/1] MdeModulePkg/BmpSupportLib: Allow BMP with extra data The patch would let the BMP file that with a bunch of data pass the check, no matter the data is valid or not. Do we have other docs to descript which data is allowed and valid? Correct the Cc mail address and invite more experts for security review. Thanks, Zhichao From: devel@edk2.groups.io On Behalf Of Andrew Fish via groups.io Sent: Thursday, March 25, 2021 11:00 AM To: edk2-devel-groups-io ; Laszlo Ersek Cc: Jeff Brasen ; bret.barke...@microsoft.com; Wang, Jian J ; ao.a...@intel.com Subject: Re: [EXTERNAL] [edk2-devel] [PATCH 1/1] MdeModulePkg/BmpSupportLib: Allow BMP with extra data On Mar 24, 2021, at 11:26 AM, Laszlo Ersek mailto:ler...@redhat.com>> wrote: On 03/24/21 16:25, Jeff Brasen wrote: Some of the logo files we received for the group that makes our assets like this (not sure what tool they were created with) look like they pad the BMP size to 8 bytes. TranslateBmpToGopBlt: invalid BmpImage... BmpHeader->Size: 0xE1038 BmpHeader->ImageOffset: 0x36 BmpImageSize: 0xE1038 DataSize: 0xE1000 TranslateBmpToGopBlt: invalid BmpImage... BmpHeader->Size: 0x2A3038 BmpHeader->ImageOffset: 0x36 BmpImageSize: 0x2A3038 DataSize: 0x2A3000 TranslateBmpToGopBlt: invalid BmpImage... BmpHeader->Size: 0x5EEC38 BmpHeader->ImageOffset: 0x36 BmpImageSize: 0x5EEC38 DataSize: 0x5EEC00 So, each of these has 2 bytes of padding at the end of the file. We could write a tool that would do the same size recalculation in order to update the size in the header and remove the two bytes but it seems that this is a valid BMP file and it doesn't seem correct that UEFI is rejecting it. I can update the commit message with more context if needed as well. If there's a spec describing the BMP format, Yes and there are various flavors as at some point I had some graphics given to me in a format that did not work (I think it was BITMAPV4HEADER) :(. https://en.wikipedia.org/wiki/BMP_file_format#cite_note-DIBhelp-5<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FBMP_file_format%23cite_note-DIBhelp-5&data=04%7C01%7Cjbrasen%40nvidia.com%7C56c4c3c190144f8c01ad08d8f534ce80%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C637528954453929169%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=7FTazyRzHFzdnpFv16knDCgMo3iX8RIxkZsHsW6yBRE%3D&reserved=0> edk2 supports ‘BM’ and the BITMAPINFOHEADER DIB. I seem to remember DIBs are defined by the size. So ‘BM' is a Microsoft Spec: https://docs.microsoft.com/en-us/previous-versions/ms969901(v=msdn.10)?redirectedfrom=MSDN<https://nam11.safelinks.protect
[edk2-devel] [PATCH] ArmPlatformPkg/Ds5: Increase path length to 400
Increase length of path that can be read from system from 200 to 400 to allow for longer build paths. Signed-off-by: Jeff Brasen --- ArmPlatformPkg/Scripts/Ds5/firmware_volume.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ArmPlatformPkg/Scripts/Ds5/firmware_volume.py b/ArmPlatformPkg/Scripts/Ds5/firmware_volume.py index 9c06835776..c6d1ca830a 100644 --- a/ArmPlatformPkg/Scripts/Ds5/firmware_volume.py +++ b/ArmPlatformPkg/Scripts/Ds5/firmware_volume.py @@ -81,7 +81,7 @@ class EfiSectionTE: filename = self.base_te + debug_rva + 0xc else: filename = self.base_te + debug_rva + 0x10 -filename = struct.unpack("200s", self.ec.getMemoryService().read(filename, 200, 32))[0] +filename = struct.unpack("400s", self.ec.getMemoryService().read(filename, 400, 32))[0] return filename[0:string.find(filename,'\0')] def get_debug_elfbase(self): @@ -119,7 +119,7 @@ class EfiSectionPE32: filename = self.base_pe32 + debug_rva + 0xc else: filename = self.base_pe32 + debug_rva + 0x10 -filename = struct.unpack("200s", self.ec.getMemoryService().read(str(filename), 200, 32))[0] +filename = struct.unpack("400s", self.ec.getMemoryService().read(str(filename), 400, 32))[0] return filename[0:string.find(filename,'\0')] def get_debug_elfbase(self): @@ -154,7 +154,7 @@ class EfiSectionPE64: filename = self.base_pe64 + debug_rva + 0xc else: filename = self.base_pe64 + debug_rva + 0x10 -filename = struct.unpack("200s", self.ec.getMemoryService().read(str(filename), 200, 32))[0] +filename = struct.unpack("400s", self.ec.getMemoryService().read(str(filename), 400, 32))[0] return filename[0:string.find(filename,'\0')] def get_debug_elfbase(self): -- 2.17.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#54090): https://edk2.groups.io/g/devel/message/54090 Mute This Topic: https://groups.io/mt/71065323/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH] MdeModulePkg/HiiDatabase: Do not modify CONST string
Update function behavior to not modify the incoming string that is marked as CONST in the prototype. Signed-off-by: Jeff Brasen --- .../Universal/HiiDatabaseDxe/ConfigRouting.c| 13 - 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c index 2cad6d29f4..e08a62c387 100644 --- a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c @@ -5497,7 +5497,6 @@ HiiBlockToConfig ( UINTN Index; UINT8 *TemBuffer; CHAR16 *TemString; - CHAR16 TemChar; TmpBuffer = NULL; @@ -5564,10 +5563,14 @@ HiiBlockToConfig ( // // Copy and an additional '&' to // - TemChar = *StringPtr; - *StringPtr = '\0'; - AppendToMultiString(Config, ConfigRequest); - *StringPtr = TemChar; + + TemString = AllocateCopyPool (sizeof (CHAR16) * (StringPtr - ConfigRequest + 1), ConfigRequest); + if (TemString == NULL) { +return EFI_OUT_OF_RESOURCES; + } + TemString[StringPtr - ConfigRequest] = '\0'; + AppendToMultiString(Config, TemString); + FreePool (TemString); // // Parse each if exists -- 2.17.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#56028): https://edk2.groups.io/g/devel/message/56028 Mute This Topic: https://groups.io/mt/72080435/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH] Support skipping automatic BM enumeration
Wouldn't having a variable that we create and delete on every boot put unnecessary stress on the SPI-NOR that the variable store lives on? What about the alternative approach where we allow the platform code to modify the attributes of the auto created variable to disable it with hidden/!active but still match for detection purposes so that it doesn't delete and recreate the modified variable each boot? That way all the logic on what to disable can still be in the platform code and all the existing logic in the boot manager can stay basically the same? Thanks, Jeff -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#49996): https://edk2.groups.io/g/devel/message/49996 Mute This Topic: https://groups.io/mt/39747302/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH] Support skipping automatic BM enumeration
Wouldn't having a variable that we create and delete on every boot put unnecessary stress on the SPI-NOR that the variable store lives on? What about the alternative approach where we allow the platform code to modify the attributes of the auto created variable to disable it with hidden/!active but still match for detection purposes so that it doesn't delete and recreate the modified variable each boot? That way all the logic on what to disable can still be in the platform code and all the existing logic in the boot manager can stay basically the same? What changes every boot that forces the variable to need to get modified? I would assume the NOR driver is smart enough to not update a variable that is not changing. The custom BDS could could only create the variable for this device if it does not exist. [JB] The current flow with no changes in the boot manager would be as follows 1. Scan for instance of the boot option in the variables 2. It will not be found, so create a new boot option store it to a variable and update BootOrder 3. Platform code runs creates the options for the boot option it wants and writes those to variable store 4. Delete/disable the boot option in the variable store When you reboot it won't find the variable so 1/2/4 will re-occur The code that does this (1/2) is EfiBootManagerRefreshAllBootOption in BmBoot.c If you modify the variable to disable it with hidden/not active it would delete that and create a new one as well as the code wouldn't recognize that is the same boot option. If however we modify EfiBootManagerFindLoadOption to not compare the attributes (at least allow for differences in active and hidden) then the when it refreshes every thing it would see the match and not delete/create a new variable in the store and thus we wouldn't have changes every boot. Thanks, Andrew Fish Thanks, Jeff --- This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. --- -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#50029): https://edk2.groups.io/g/devel/message/50029 Mute This Topic: https://groups.io/mt/39747302/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH] Support skipping automatic BM enumeration
As the suggestions below made sense, we updated our platform boot manager library to behave in this manner and for normal boots everything works well. However the UiApp and boot maintenance applications in EDK2 also call EfiBootManagerRefreshAllBootOption() when ever a user goes into the menu which will re-create the skipped boot options with no place for the platform code to intervene. What about a solution where we add a new Platform library function that allows for override of the behavior of BmEnumerateBootOptions? For example, either a function or protocol that takes the same parameters as this function and only if it returns NULL then we continue to the default enumeration code. Or a function call inserted at the end that would modify the load option array after the system does the standard enumeration. -Jeff From: af...@apple.com Sent: Wednesday, November 6, 2019 9:20 AM To: Ni, Ray Cc: devel@edk2.groups.io; Jeff Brasen ; Ashish Singhal ; Laszlo Ersek ; Wang, Jian J ; Wu, Hao A ; Gao, Zhichao ; Mike Kinney Subject: Re: [edk2-devel] [PATCH] Support skipping automatic BM enumeration Ray, Is there an obvious hook point we could point Jeff and Ashish at? Long term it would be a good idea to have a Wiki page to give some guidance on how to customize the BDS. Thanks, Andrew Fish On Nov 5, 2019, at 9:20 PM, Ni, Ray mailto:ray...@intel.com>> wrote: Andrew, I agree with your opinion. It’s expected that Platform Boot Manager lib calls EfiBootManagerRefreshAllBootOption() only in full configuration boot path. The full configuration boot path is chosen when hardware changes happen. So it’s not expected EfiBootManagerRefresh…() be called in every boot. So you could: 1. Delete the auto-created option pointing to LoadFile instance 2. Create your own one with customized description. From: af...@apple.com<mailto:af...@apple.com> mailto:af...@apple.com>> Sent: Wednesday, November 6, 2019 10:47 AM To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>; jbra...@nvidia.com<mailto:jbra...@nvidia.com> Cc: Ashish Singhal mailto:ashishsin...@nvidia.com>>; Laszlo Ersek mailto:ler...@redhat.com>>; Ni, Ray mailto:ray...@intel.com>>; Wang, Jian J mailto:jian.j.w...@intel.com>>; Wu, Hao A mailto:hao.a...@intel.com>>; Gao, Zhichao mailto:zhichao@intel.com>>; Kinney, Michael D mailto:michael.d.kin...@intel.com>> Subject: Re: [edk2-devel] [PATCH] Support skipping automatic BM enumeration On Nov 5, 2019, at 7:34 PM, Jeff Brasen mailto:jbra...@nvidia.com>> wrote: Wouldn't having a variable that we create and delete on every boot put unnecessary stress on the SPI-NOR that the variable store lives on? What about the alternative approach where we allow the platform code to modify the attributes of the auto created variable to disable it with hidden/!active but still match for detection purposes so that it doesn't delete and recreate the modified variable each boot? That way all the logic on what to disable can still be in the platform code and all the existing logic in the boot manager can stay basically the same? What changes every boot that forces the variable to need to get modified? I would assume the NOR driver is smart enough to not update a variable that is not changing. The custom BDS could could only create the variable for this device if it does not exist. [JB] The current flow with no changes in the boot manager would be as follows 1. Scan for instance of the boot option in the variables 2. It will not be found, so create a new boot option store it to a variable and update BootOrder 3. Platform code runs creates the options for the boot option it wants and writes those to variable store 4. Delete/disable the boot option in the variable store When you reboot it won't find the variable so 1/2/4 will re-occur The code that does this (1/2) is EfiBootManagerRefreshAllBootOption in BmBoot.c If you modify the variable to disable it with hidden/not active it would delete that and create a new one as well as the code wouldn't recognize that is the same boot option. If however we modify EfiBootManagerFindLoadOption to not compare the attributes (at least allow for differences in active and hidden) then the when it refreshes every thing it would see the match and not delete/create a new variable in the store and thus we wouldn't have changes every boot. Jeff, Sorry if I'm a little off on the sequence of things as the platform I work on day to day has a custom BDS and does not use this library. I though the patch changed BmEnumerateBootOptions(), so that is going to change how EfiBootManagerRefreshAllBootOption() works. I'd also point out the patch as given is invalid as it changed the behavior of the public library API for EfiBootManagerRefreshAllBootOption() [1] so for the patch to be valid it would need to cha
Re: [edk2-devel] [PATCH] Support skipping automatic BM enumeration
The issue is there are some auto created options we do not want on our platform. Get Outlook for Android<https://aka.ms/ghei36> From: Ni, Ray Sent: Wednesday, November 6, 2019 11:59:31 PM To: Jeff Brasen ; af...@apple.com Cc: devel@edk2.groups.io ; Ashish Singhal ; Laszlo Ersek ; Wang, Jian J ; Wu, Hao A ; Gao, Zhichao ; Kinney, Michael D Subject: RE: [edk2-devel] [PATCH] Support skipping automatic BM enumeration Jeff, RefreshAllBootOption() only modifies/creates the auto-created boot options. For the boot options created by platform boot manager library, they stay with no one touches. And all auto-created boot options are appended in the end of boot option list (through BootOrder). From: Jeff Brasen Sent: Thursday, November 7, 2019 12:13 PM To: af...@apple.com; Ni, Ray Cc: devel@edk2.groups.io; Ashish Singhal ; Laszlo Ersek ; Wang, Jian J ; Wu, Hao A ; Gao, Zhichao ; Kinney, Michael D Subject: RE: [edk2-devel] [PATCH] Support skipping automatic BM enumeration As the suggestions below made sense, we updated our platform boot manager library to behave in this manner and for normal boots everything works well. However the UiApp and boot maintenance applications in EDK2 also call EfiBootManagerRefreshAllBootOption() when ever a user goes into the menu which will re-create the skipped boot options with no place for the platform code to intervene. What about a solution where we add a new Platform library function that allows for override of the behavior of BmEnumerateBootOptions? For example, either a function or protocol that takes the same parameters as this function and only if it returns NULL then we continue to the default enumeration code. Or a function call inserted at the end that would modify the load option array after the system does the standard enumeration. -Jeff From: af...@apple.com<mailto:af...@apple.com> mailto:af...@apple.com>> Sent: Wednesday, November 6, 2019 9:20 AM To: Ni, Ray mailto:ray...@intel.com>> Cc: devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Jeff Brasen mailto:jbra...@nvidia.com>>; Ashish Singhal mailto:ashishsin...@nvidia.com>>; Laszlo Ersek mailto:ler...@redhat.com>>; Wang, Jian J mailto:jian.j.w...@intel.com>>; Wu, Hao A mailto:hao.a...@intel.com>>; Gao, Zhichao mailto:zhichao@intel.com>>; Mike Kinney mailto:michael.d.kin...@intel.com>> Subject: Re: [edk2-devel] [PATCH] Support skipping automatic BM enumeration Ray, Is there an obvious hook point we could point Jeff and Ashish at? Long term it would be a good idea to have a Wiki page to give some guidance on how to customize the BDS. Thanks, Andrew Fish On Nov 5, 2019, at 9:20 PM, Ni, Ray mailto:ray...@intel.com>> wrote: Andrew, I agree with your opinion. It’s expected that Platform Boot Manager lib calls EfiBootManagerRefreshAllBootOption() only in full configuration boot path. The full configuration boot path is chosen when hardware changes happen. So it’s not expected EfiBootManagerRefresh…() be called in every boot. So you could: 1. Delete the auto-created option pointing to LoadFile instance 2. Create your own one with customized description. From: af...@apple.com<mailto:af...@apple.com> mailto:af...@apple.com>> Sent: Wednesday, November 6, 2019 10:47 AM To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>; jbra...@nvidia.com<mailto:jbra...@nvidia.com> Cc: Ashish Singhal mailto:ashishsin...@nvidia.com>>; Laszlo Ersek mailto:ler...@redhat.com>>; Ni, Ray mailto:ray...@intel.com>>; Wang, Jian J mailto:jian.j.w...@intel.com>>; Wu, Hao A mailto:hao.a...@intel.com>>; Gao, Zhichao mailto:zhichao@intel.com>>; Kinney, Michael D mailto:michael.d.kin...@intel.com>> Subject: Re: [edk2-devel] [PATCH] Support skipping automatic BM enumeration On Nov 5, 2019, at 7:34 PM, Jeff Brasen mailto:jbra...@nvidia.com>> wrote: Wouldn't having a variable that we create and delete on every boot put unnecessary stress on the SPI-NOR that the variable store lives on? What about the alternative approach where we allow the platform code to modify the attributes of the auto created variable to disable it with hidden/!active but still match for detection purposes so that it doesn't delete and recreate the modified variable each boot? That way all the logic on what to disable can still be in the platform code and all the existing logic in the boot manager can stay basically the same? What changes every boot that forces the variable to need to get modified? I would assume the NOR driver is smart enough to not update a variable that is not changing. The custom BDS could could only create the variable for this device if it does not exist. [JB] The current flow with no changes in the boot manager would be as follows 1.
Re: [edk2-devel] [PATCH] Support skipping automatic BM enumeration
Fixing UiApp seems reasonable, I do think we would want a hook to the platform library in here as the enumeration that occurs in the UiApp is intended to do a full enumeration of the system and there may be platform specifics to how that occurs. Thanks, Jeff From: Ni, Ray Sent: Thursday, November 7, 2019 12:21 AM To: devel@edk2.groups.io; Jeff Brasen ; af...@apple.com Cc: Ashish Singhal ; Laszlo Ersek ; Wang, Jian J ; Wu, Hao A ; Gao, Zhichao ; Kinney, Michael D Subject: RE: [edk2-devel] [PATCH] Support skipping automatic BM enumeration I treat the issue in this way: 1. Platform Boot Manager library does a good job. It doesn't always call RefreshAll() API to auto-create the boot options 2. But UiApp doesn't. It constantly call RefreshAll(). Do you think that we can fix UiApp instead? For example, introducing a PCD to control the boot option refresh behavior? Thanks, Ray From: devel@edk2.groups.io<mailto:devel@edk2.groups.io> mailto:devel@edk2.groups.io>> On Behalf Of Jeff Brasen Sent: Thursday, November 7, 2019 3:02 PM To: Ni, Ray mailto:ray...@intel.com>>; af...@apple.com<mailto:af...@apple.com> Cc: devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Ashish Singhal mailto:ashishsin...@nvidia.com>>; Laszlo Ersek mailto:ler...@redhat.com>>; Wang, Jian J mailto:jian.j.w...@intel.com>>; Wu, Hao A mailto:hao.a...@intel.com>>; Gao, Zhichao mailto:zhichao@intel.com>>; Kinney, Michael D mailto:michael.d.kin...@intel.com>> Subject: Re: [edk2-devel] [PATCH] Support skipping automatic BM enumeration The issue is there are some auto created options we do not want on our platform. Get Outlook for Android<https://aka.ms/ghei36> From: Ni, Ray mailto:ray...@intel.com>> Sent: Wednesday, November 6, 2019 11:59:31 PM To: Jeff Brasen mailto:jbra...@nvidia.com>>; af...@apple.com<mailto:af...@apple.com> mailto:af...@apple.com>> Cc: devel@edk2.groups.io<mailto:devel@edk2.groups.io> mailto:devel@edk2.groups.io>>; Ashish Singhal mailto:ashishsin...@nvidia.com>>; Laszlo Ersek mailto:ler...@redhat.com>>; Wang, Jian J mailto:jian.j.w...@intel.com>>; Wu, Hao A mailto:hao.a...@intel.com>>; Gao, Zhichao mailto:zhichao@intel.com>>; Kinney, Michael D mailto:michael.d.kin...@intel.com>> Subject: RE: [edk2-devel] [PATCH] Support skipping automatic BM enumeration Jeff, RefreshAllBootOption() only modifies/creates the auto-created boot options. For the boot options created by platform boot manager library, they stay with no one touches. And all auto-created boot options are appended in the end of boot option list (through BootOrder). From: Jeff Brasen mailto:jbra...@nvidia.com>> Sent: Thursday, November 7, 2019 12:13 PM To: af...@apple.com<mailto:af...@apple.com>; Ni, Ray mailto:ray...@intel.com>> Cc: devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Ashish Singhal mailto:ashishsin...@nvidia.com>>; Laszlo Ersek mailto:ler...@redhat.com>>; Wang, Jian J mailto:jian.j.w...@intel.com>>; Wu, Hao A mailto:hao.a...@intel.com>>; Gao, Zhichao mailto:zhichao@intel.com>>; Kinney, Michael D mailto:michael.d.kin...@intel.com>> Subject: RE: [edk2-devel] [PATCH] Support skipping automatic BM enumeration As the suggestions below made sense, we updated our platform boot manager library to behave in this manner and for normal boots everything works well. However the UiApp and boot maintenance applications in EDK2 also call EfiBootManagerRefreshAllBootOption() when ever a user goes into the menu which will re-create the skipped boot options with no place for the platform code to intervene. What about a solution where we add a new Platform library function that allows for override of the behavior of BmEnumerateBootOptions? For example, either a function or protocol that takes the same parameters as this function and only if it returns NULL then we continue to the default enumeration code. Or a function call inserted at the end that would modify the load option array after the system does the standard enumeration. -Jeff From: af...@apple.com<mailto:af...@apple.com> mailto:af...@apple.com>> Sent: Wednesday, November 6, 2019 9:20 AM To: Ni, Ray mailto:ray...@intel.com>> Cc: devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Jeff Brasen mailto:jbra...@nvidia.com>>; Ashish Singhal mailto:ashishsin...@nvidia.com>>; Laszlo Ersek mailto:ler...@redhat.com>>; Wang, Jian J mailto:jian.j.w...@intel.com>>; Wu, Hao A mailto:hao.a...@intel.com>>; Gao, Zhichao mailto:zhichao@intel.com>>; Mike Kinney mailto:michael.d.kin...@intel.com>> Subject: Re: [edk2-devel] [PATCH] Support skipping automatic BM enumeration Ray, Is there an obvious hook point we coul
Re: [edk2-devel] [PATCH] Support skipping automatic BM enumeration
If we are concerned about deploying this and breaking builds we could do this via a new protocol instead. In that case though we would leave the old default behavior in the code to handle platforms that didn't implement the new protocol, so this might not be the cleanest way to deploy this. We could also look at adding a generic platform boot hook function (either as a library function or protocol) if we wanted to limit the number of disruption on new customization hooks. Something like EFI_STATUS PlatformBootNotify (CONST EFI_GUID *NotificationType, VOID *ContextData OPTIONAL) Where Notification type describes where we are that we want platform to potentially handle and ContextData is per type caller allocated data that provides additional in/out data. This has the same issue of leaving the current default behavior in place for unsupported types as well as being a less than specific function to describe. Thanks, Jeff From: Laszlo Ersek Sent: Friday, November 8, 2019 9:37 AM To: Jeff Brasen ; Ni, Ray ; devel@edk2.groups.io ; af...@apple.com Cc: Ashish Singhal ; Wang, Jian J ; Wu, Hao A ; Gao, Zhichao ; Kinney, Michael D Subject: Re: [edk2-devel] [PATCH] Support skipping automatic BM enumeration On 11/07/19 18:46, Jeff Brasen wrote: > Fixing UiApp seems reasonable, I do think we would want a hook to the > platform library in here as the enumeration that occurs in the UiApp is > intended to do a full enumeration of the system and there may be platform > specifics to how that occurs. Fully agreed -- entering UiApp should expose everything bootable in the system, unless (perhaps) PlatformBootManagerLib specifically thinks otherwise. Of course, then we arrive (again) at the problem that a call in UefiBootManagerLib, to a *new* PlatformBootManagerLib API, will break tens of out-of-tree platforms. :) I think that can be prevented, as follows; but it will take quite some time: - introduce the new function declaration in "PlatformBootManagerLib.h", - modify all platforms (in tree and out of tree) to implement (define) the new function, - call the new function from UefiBootManagerLib For some history / background on this kind of problem, I suggest reading through: https://bugzilla.tianocore.org/show_bug.cgi?id=982 Thanks, Laszlo > From: Ni, Ray > Sent: Thursday, November 7, 2019 12:21 AM > To: devel@edk2.groups.io; Jeff Brasen ; af...@apple.com > Cc: Ashish Singhal ; Laszlo Ersek > ; Wang, Jian J ; Wu, Hao A > ; Gao, Zhichao ; Kinney, Michael D > > Subject: RE: [edk2-devel] [PATCH] Support skipping automatic BM enumeration > > I treat the issue in this way: > > 1. Platform Boot Manager library does a good job. It doesn't always call > RefreshAll() API to auto-create the boot options > 2. But UiApp doesn't. It constantly call RefreshAll(). > > Do you think that we can fix UiApp instead? For example, introducing a PCD to > control the boot option refresh behavior? > > Thanks, > Ray > > From: devel@edk2.groups.io<mailto:devel@edk2.groups.io> > mailto:devel@edk2.groups.io>> On Behalf Of Jeff Brasen > Sent: Thursday, November 7, 2019 3:02 PM > To: Ni, Ray mailto:ray...@intel.com>>; > af...@apple.com<mailto:af...@apple.com> > Cc: devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Ashish Singhal > mailto:ashishsin...@nvidia.com>>; Laszlo Ersek > mailto:ler...@redhat.com>>; Wang, Jian J > mailto:jian.j.w...@intel.com>>; Wu, Hao A > mailto:hao.a...@intel.com>>; Gao, Zhichao > mailto:zhichao@intel.com>>; Kinney, Michael D > mailto:michael.d.kin...@intel.com>> > Subject: Re: [edk2-devel] [PATCH] Support skipping automatic BM enumeration > > The issue is there are some auto created options we do not want on our > platform. > Get Outlook for Android<https://aka.ms/ghei36> > > > From: Ni, Ray mailto:ray...@intel.com>> > Sent: Wednesday, November 6, 2019 11:59:31 PM > To: Jeff Brasen mailto:jbra...@nvidia.com>>; > af...@apple.com<mailto:af...@apple.com> > mailto:af...@apple.com>> > Cc: devel@edk2.groups.io<mailto:devel@edk2.groups.io> > mailto:devel@edk2.groups.io>>; Ashish Singhal > mailto:ashishsin...@nvidia.com>>; Laszlo Ersek > mailto:ler...@redhat.com>>; Wang, Jian J > mailto:jian.j.w...@intel.com>>; Wu, Hao A > mailto:hao.a...@intel.com>>; Gao, Zhichao > mailto:zhichao@intel.com>>; Kinney, Michael D > mailto:michael.d.kin...@intel.com>> > Subject: RE: [edk2-devel] [PATCH] Support skipping automatic BM enumeration > > > Jeff, > > RefreshAllBootOption() only modifies/creates the auto-created boot options. > For the boot options cre
Re: [edk2-devel] [PATCH] Support skipping automatic BM enumeration
I am not sure a PCD would work (unless I am missing something) We do want to do a connect all and re-enumerate in UiApp but we need the platform code to be involved in that process. Thanks, Jeff From: Ni, Ray Sent: Monday, November 11, 2019 4:58 PM To: devel@edk2.groups.io ; Jeff Brasen ; Laszlo Ersek ; af...@apple.com Cc: Ashish Singhal ; Wang, Jian J ; Wu, Hao A ; Gao, Zhichao ; Kinney, Michael D Subject: RE: [edk2-devel] [PATCH] Support skipping automatic BM enumeration Jeff, If adding a PCD to control UiApp can meet the real needs, I prefer to do in that way instead of adding new APIs to PlatformBootManagerLib. Thanks, Ray From: devel@edk2.groups.io On Behalf Of Jeff Brasen Sent: Tuesday, November 12, 2019 6:58 AM To: Laszlo Ersek ; Ni, Ray ; devel@edk2.groups.io; af...@apple.com Cc: Ashish Singhal ; Wang, Jian J ; Wu, Hao A ; Gao, Zhichao ; Kinney, Michael D Subject: Re: [edk2-devel] [PATCH] Support skipping automatic BM enumeration If we are concerned about deploying this and breaking builds we could do this via a new protocol instead. In that case though we would leave the old default behavior in the code to handle platforms that didn't implement the new protocol, so this might not be the cleanest way to deploy this. We could also look at adding a generic platform boot hook function (either as a library function or protocol) if we wanted to limit the number of disruption on new customization hooks. Something like EFI_STATUS PlatformBootNotify (CONST EFI_GUID *NotificationType, VOID *ContextData OPTIONAL) Where Notification type describes where we are that we want platform to potentially handle and ContextData is per type caller allocated data that provides additional in/out data. This has the same issue of leaving the current default behavior in place for unsupported types as well as being a less than specific function to describe. Thanks, Jeff From: Laszlo Ersek mailto:ler...@redhat.com>> Sent: Friday, November 8, 2019 9:37 AM To: Jeff Brasen mailto:jbra...@nvidia.com>>; Ni, Ray mailto:ray...@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io> mailto:devel@edk2.groups.io>>; af...@apple.com<mailto:af...@apple.com> mailto:af...@apple.com>> Cc: Ashish Singhal mailto:ashishsin...@nvidia.com>>; Wang, Jian J mailto:jian.j.w...@intel.com>>; Wu, Hao A mailto:hao.a...@intel.com>>; Gao, Zhichao mailto:zhichao@intel.com>>; Kinney, Michael D mailto:michael.d.kin...@intel.com>> Subject: Re: [edk2-devel] [PATCH] Support skipping automatic BM enumeration On 11/07/19 18:46, Jeff Brasen wrote: > Fixing UiApp seems reasonable, I do think we would want a hook to the > platform library in here as the enumeration that occurs in the UiApp is > intended to do a full enumeration of the system and there may be platform > specifics to how that occurs. Fully agreed -- entering UiApp should expose everything bootable in the system, unless (perhaps) PlatformBootManagerLib specifically thinks otherwise. Of course, then we arrive (again) at the problem that a call in UefiBootManagerLib, to a *new* PlatformBootManagerLib API, will break tens of out-of-tree platforms. :) I think that can be prevented, as follows; but it will take quite some time: - introduce the new function declaration in "PlatformBootManagerLib.h", - modify all platforms (in tree and out of tree) to implement (define) the new function, - call the new function from UefiBootManagerLib For some history / background on this kind of problem, I suggest reading through: https://bugzilla.tianocore.org/show_bug.cgi?id=982 Thanks, Laszlo > From: Ni, Ray mailto:ray...@intel.com>> > Sent: Thursday, November 7, 2019 12:21 AM > To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Jeff Brasen > mailto:jbra...@nvidia.com>>; > af...@apple.com<mailto:af...@apple.com> > Cc: Ashish Singhal mailto:ashishsin...@nvidia.com>>; > Laszlo Ersek mailto:ler...@redhat.com>>; Wang, Jian J > mailto:jian.j.w...@intel.com>>; Wu, Hao A > mailto:hao.a...@intel.com>>; Gao, Zhichao > mailto:zhichao@intel.com>>; Kinney, Michael D > mailto:michael.d.kin...@intel.com>> > Subject: RE: [edk2-devel] [PATCH] Support skipping automatic BM enumeration > > I treat the issue in this way: > > 1. Platform Boot Manager library does a good job. It doesn't always call > RefreshAll() API to auto-create the boot options > 2. But UiApp doesn't. It constantly call RefreshAll(). > > Do you think that we can fix UiApp instead? For example, introducing a PCD to > control the boot option refresh behavior? > > Thanks, > Ray > > From: > devel@edk2.groups.io<mailto:devel@edk2.groups.io&
Re: [edk2-devel] [PATCH] Support skipping automatic BM enumeration
Thinking about this more I think we could do this with a PCD and a new group event without having to define any new function interfaces. We could change UiApp and BootManagerMenuApp (and any others that are relevant) from EfiBootManagerRefreshAllBootOption (); to if (FeaturePcdGet (PcdEventBasedRefreshAllBootOptionSupport) { EFI_EVENT Event; gBS->CreateEventEx ( 0, 0, NULL, NULL, &gEventBasedRefreshGuid, &Event ); gBS->SignalEvent (Event); gBS->CloseEvent (Event); } else { EfiBootManagerRefreshAllBootOption (); } Then a platform that wants to do this on its own would just set this pcd and create a group event and do what it needs to do there. Thanks, Jeff ____ From: Jeff Brasen Sent: Monday, November 11, 2019 5:00 PM To: Ni, Ray ; devel@edk2.groups.io ; Laszlo Ersek ; af...@apple.com Cc: Ashish Singhal ; Wang, Jian J ; Wu, Hao A ; Gao, Zhichao ; Kinney, Michael D Subject: Re: [edk2-devel] [PATCH] Support skipping automatic BM enumeration I am not sure a PCD would work (unless I am missing something) We do want to do a connect all and re-enumerate in UiApp but we need the platform code to be involved in that process. Thanks, Jeff From: Ni, Ray Sent: Monday, November 11, 2019 4:58 PM To: devel@edk2.groups.io ; Jeff Brasen ; Laszlo Ersek ; af...@apple.com Cc: Ashish Singhal ; Wang, Jian J ; Wu, Hao A ; Gao, Zhichao ; Kinney, Michael D Subject: RE: [edk2-devel] [PATCH] Support skipping automatic BM enumeration Jeff, If adding a PCD to control UiApp can meet the real needs, I prefer to do in that way instead of adding new APIs to PlatformBootManagerLib. Thanks, Ray From: devel@edk2.groups.io On Behalf Of Jeff Brasen Sent: Tuesday, November 12, 2019 6:58 AM To: Laszlo Ersek ; Ni, Ray ; devel@edk2.groups.io; af...@apple.com Cc: Ashish Singhal ; Wang, Jian J ; Wu, Hao A ; Gao, Zhichao ; Kinney, Michael D Subject: Re: [edk2-devel] [PATCH] Support skipping automatic BM enumeration If we are concerned about deploying this and breaking builds we could do this via a new protocol instead. In that case though we would leave the old default behavior in the code to handle platforms that didn't implement the new protocol, so this might not be the cleanest way to deploy this. We could also look at adding a generic platform boot hook function (either as a library function or protocol) if we wanted to limit the number of disruption on new customization hooks. Something like EFI_STATUS PlatformBootNotify (CONST EFI_GUID *NotificationType, VOID *ContextData OPTIONAL) Where Notification type describes where we are that we want platform to potentially handle and ContextData is per type caller allocated data that provides additional in/out data. This has the same issue of leaving the current default behavior in place for unsupported types as well as being a less than specific function to describe. Thanks, Jeff From: Laszlo Ersek mailto:ler...@redhat.com>> Sent: Friday, November 8, 2019 9:37 AM To: Jeff Brasen mailto:jbra...@nvidia.com>>; Ni, Ray mailto:ray...@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io> mailto:devel@edk2.groups.io>>; af...@apple.com<mailto:af...@apple.com> mailto:af...@apple.com>> Cc: Ashish Singhal mailto:ashishsin...@nvidia.com>>; Wang, Jian J mailto:jian.j.w...@intel.com>>; Wu, Hao A mailto:hao.a...@intel.com>>; Gao, Zhichao mailto:zhichao@intel.com>>; Kinney, Michael D mailto:michael.d.kin...@intel.com>> Subject: Re: [edk2-devel] [PATCH] Support skipping automatic BM enumeration On 11/07/19 18:46, Jeff Brasen wrote: > Fixing UiApp seems reasonable, I do think we would want a hook to the > platform library in here as the enumeration that occurs in the UiApp is > intended to do a full enumeration of the system and there may be platform > specifics to how that occurs. Fully agreed -- entering UiApp should expose everything bootable in the system, unless (perhaps) PlatformBootManagerLib specifically thinks otherwise. Of course, then we arrive (again) at the problem that a call in UefiBootManagerLib, to a *new* PlatformBootManagerLib API, will break tens of out-of-tree platforms. :) I think that can be prevented, as follows; but it will take quite some time: - introduce the new function declaration in "PlatformBootManagerLib.h", - modify all platforms (in tree and out of tree) to implement (define) the new function, - call the new function from UefiBootManagerLib For some history / background on this kind of problem, I suggest reading through: https://bugzilla.tianocore.org/show_bug.cgi?id=982 Thanks, Laszlo > From: Ni, Ray mailto:ray...@intel.com>> > Sent: Thursday, November 7, 2019 12:21 AM > To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>; J
Re: [edk2-devel] [PATCH] Support skipping automatic BM enumeration
Yes, I think that would be good. Summarizing everything in this thread Problem: Platform needs to customize the boot options, this can be done for normal boot but the UiApp calls EfiBootManagerRefreshAllBootOption in a couple places. Potential solutions: 1 - Define new PCD and event group if PCD is set true then signal event instead of calling EfiBootManagerRefreshAllBootOption in UiApp 2 - Add new function to boot manager library and replace call to EfiBootManagerRefreshAllBootOption in UiApp (need to coordinate rollout with updates to all platform. 3 - Add new protocol with new function, if supported call this otherwise call EfiBootManagerRefreshAllBootOption as is done now 4 - For 2/3 use generic function so we don't need new APIs for future expansion 5 - Update EfiBootManagerRefreshAllBootOption to call platform specific function. Thanks, Jeff From: Ni, Ray Sent: Wednesday, November 13, 2019 7:09 PM To: devel@edk2.groups.io; Jeff Brasen ; Laszlo Ersek ; af...@apple.com Cc: Ashish Singhal ; Wang, Jian J ; Wu, Hao A ; Gao, Zhichao ; Kinney, Michael D Subject: RE: [edk2-devel] [PATCH] Support skipping automatic BM enumeration Jeff, I think it's a good topic that we could discuss in the open design meeting. Are you ok to present the problem you have and discuss the potential solutions in that meeting? https://github.com/tianocore/tianocore.github.io/wiki/Design-Meeting Thanks, Ray From: devel@edk2.groups.io<mailto:devel@edk2.groups.io> mailto:devel@edk2.groups.io>> On Behalf Of Jeff Brasen Sent: Thursday, November 14, 2019 2:43 AM To: Ni, Ray mailto:ray...@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Laszlo Ersek mailto:ler...@redhat.com>>; af...@apple.com<mailto:af...@apple.com> Cc: Ashish Singhal mailto:ashishsin...@nvidia.com>>; Wang, Jian J mailto:jian.j.w...@intel.com>>; Wu, Hao A mailto:hao.a...@intel.com>>; Gao, Zhichao mailto:zhichao@intel.com>>; Kinney, Michael D mailto:michael.d.kin...@intel.com>> Subject: Re: [edk2-devel] [PATCH] Support skipping automatic BM enumeration Thinking about this more I think we could do this with a PCD and a new group event without having to define any new function interfaces. We could change UiApp and BootManagerMenuApp (and any others that are relevant) from EfiBootManagerRefreshAllBootOption (); to if (FeaturePcdGet (PcdEventBasedRefreshAllBootOptionSupport) { EFI_EVENT Event; gBS->CreateEventEx ( 0, 0, NULL, NULL, &gEventBasedRefreshGuid, &Event ); gBS->SignalEvent (Event); gBS->CloseEvent (Event); } else { EfiBootManagerRefreshAllBootOption (); } Then a platform that wants to do this on its own would just set this pcd and create a group event and do what it needs to do there. Thanks, Jeff From: Jeff Brasen mailto:jbra...@nvidia.com>> Sent: Monday, November 11, 2019 5:00 PM To: Ni, Ray mailto:ray...@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io> mailto:devel@edk2.groups.io>>; Laszlo Ersek mailto:ler...@redhat.com>>; af...@apple.com<mailto:af...@apple.com> mailto:af...@apple.com>> Cc: Ashish Singhal mailto:ashishsin...@nvidia.com>>; Wang, Jian J mailto:jian.j.w...@intel.com>>; Wu, Hao A mailto:hao.a...@intel.com>>; Gao, Zhichao mailto:zhichao@intel.com>>; Kinney, Michael D mailto:michael.d.kin...@intel.com>> Subject: Re: [edk2-devel] [PATCH] Support skipping automatic BM enumeration I am not sure a PCD would work (unless I am missing something) We do want to do a connect all and re-enumerate in UiApp but we need the platform code to be involved in that process. Thanks, Jeff From: Ni, Ray mailto:ray...@intel.com>> Sent: Monday, November 11, 2019 4:58 PM To: devel@edk2.groups.io<mailto:devel@edk2.groups.io> mailto:devel@edk2.groups.io>>; Jeff Brasen mailto:jbra...@nvidia.com>>; Laszlo Ersek mailto:ler...@redhat.com>>; af...@apple.com<mailto:af...@apple.com> mailto:af...@apple.com>> Cc: Ashish Singhal mailto:ashishsin...@nvidia.com>>; Wang, Jian J mailto:jian.j.w...@intel.com>>; Wu, Hao A mailto:hao.a...@intel.com>>; Gao, Zhichao mailto:zhichao@intel.com>>; Kinney, Michael D mailto:michael.d.kin...@intel.com>> Subject: RE: [edk2-devel] [PATCH] Support skipping automatic BM enumeration Jeff, If adding a PCD to control UiApp can meet the real needs, I prefer to do in that way instead of adding new APIs to PlatformBootManagerLib. Thanks, Ray From: devel@edk2.groups.io<mailto:devel@edk2.groups.io> mailto:devel@edk2.groups.io>> On Behalf Of Jeff Brasen Sent: Tuesday, November 12, 2019 6:58 AM To: Laszlo Ersek mailto:ler...@redhat.com>>; Ni, Ray mailto:ray...@intel.com>>; devel@edk2.groups.io<mailto:de
[edk2-devel] [PATCH 3/3] MdeModulePkg/BdsDxe: Set RuntimeServicesSupported variable
Add support for initializing and setting the UEFI 2.8 global variable RuntimeServicesSupported based on the value of a PCD. Signed-off-by: Jeff Brasen --- MdeModulePkg/MdeModulePkg.dec| 18 MdeModulePkg/Universal/BdsDxe/BdsDxe.inf | 1 + MdeModulePkg/Universal/BdsDxe/BdsEntry.c | 35 +++- 3 files changed, 53 insertions(+), 1 deletion(-) diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec index 41b9e70..a1767e4 100644 --- a/MdeModulePkg/MdeModulePkg.dec +++ b/MdeModulePkg/MdeModulePkg.dec @@ -2003,6 +2003,24 @@ # @Prompt Capsule On Disk relocation device path. gEfiMdeModulePkgTokenSpaceGuid.PcdCodRelocationDevPath|{0xFF}|VOID*|0x002f + ## Bitmask of supported runtime services + # BIT0 - GetTime + # BIT1 - SetTime + # BIT2 - GetWakeupTime + # BIT3 - SetWakeupTime + # BIT4 - GetVariable + # BIT5 - GetNextVariableName + # BIT6 - SetVariable + # BIT7 - SetVirtualAddressMap + # BIT8 - ConvertPointer + # BIT9 - GetNextHighMonotonicCount + # BIT10 - ResetSystem + # BIT11 - UpdateCapsule + # BIT12 - QueryCapsuleCapabilites + # BIT13 - QueryVariableInfo + # @Prompt Supported Runtime services bitmask. + gEfiMdeModulePkgTokenSpaceGuid.PcdRuntimeServicesSupported|0x3FFF|UINT16|0x0030 + [PcdsPatchableInModule] ## Specify memory size with page number for PEI code when # Loading Module at Fixed Address feature is enabled. diff --git a/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf b/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf index 9310b4d..e4ba9be 100644 --- a/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf +++ b/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf @@ -97,6 +97,7 @@ gEfiMdeModulePkgTokenSpaceGuid.PcdTestKeyUsed ## CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdCapsuleOnDiskSupport ## CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdPlatformRecoverySupport ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdRuntimeServicesSupported ## CONSUMES [Depex] TRUE diff --git a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c b/MdeModulePkg/Universal/BdsDxe/BdsEntry.c index d387dbe..16bc593 100644 --- a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c +++ b/MdeModulePkg/Universal/BdsDxe/BdsEntry.c @@ -40,7 +40,8 @@ CHAR16 *mReadOnlyVariables[] = { EFI_LANG_CODES_VARIABLE_NAME, EFI_BOOT_OPTION_SUPPORT_VARIABLE_NAME, EFI_HW_ERR_REC_SUPPORT_VARIABLE_NAME, - EFI_OS_INDICATIONS_SUPPORT_VARIABLE_NAME + EFI_OS_INDICATIONS_SUPPORT_VARIABLE_NAME, + EFI_RUNTIME_SERVICES_SUPPORTED_VARIABLE_NAME }; CHAR16 *mBdsLoadOptionName[] = { @@ -626,6 +627,33 @@ BdsFormalizeOSIndicationVariable ( /** + Formalize RuntimeServicesSupported variable. + +**/ +VOID +BdsFormalizeRuntimeServicesSupportedVariable ( + VOID + ) +{ + EFI_STATUS Status; + UINT16 RuntimeServicesSupported; + + RuntimeServicesSupported = PcdGet16 (PcdRuntimeServicesSupported); + Status = gRT->SetVariable ( + EFI_RUNTIME_SERVICES_SUPPORTED_VARIABLE_NAME, + &gEfiGlobalVariableGuid, + EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, + sizeof(RuntimeServicesSupported), + &RuntimeServicesSupported + ); + // + // Platform needs to make sure setting volatile variable before calling 3rd party code shouldn't fail. + // + ASSERT_EFI_ERROR (Status); +} + +/** + Validate variables. **/ @@ -645,6 +673,11 @@ BdsFormalizeEfiGlobalVariable ( // Validate OSIndication related variable. // BdsFormalizeOSIndicationVariable (); + + // + // Validate Runtime Services Supported variable. + // + BdsFormalizeRuntimeServicesSupportedVariable (); } /** -- 2.7.4 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#50732): https://edk2.groups.io/g/devel/message/50732 Mute This Topic: https://groups.io/mt/59298933/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH 1/3] MdePkg-UefiSpec.h: Add UEFI 2.8 RuntimeServicesSuppported definations
Add bitmask values for the value of the RuntimeServicesSupported variable defined in the UEFI 2.8 specification. This is used to describe what services the platform supports while in runtime. Signed-off-by: Jeff Brasen --- MdePkg/Include/Uefi/UefiSpec.h | 18 ++ 1 file changed, 18 insertions(+) diff --git a/MdePkg/Include/Uefi/UefiSpec.h b/MdePkg/Include/Uefi/UefiSpec.h index 444aa35..7e2b719 100644 --- a/MdePkg/Include/Uefi/UefiSpec.h +++ b/MdePkg/Include/Uefi/UefiSpec.h @@ -1783,6 +1783,24 @@ EFI_STATUS #define EFI_OS_INDICATIONS_START_PLATFORM_RECOVERY 0x0040 // +// Bitmasks of supported runtime functions for RuntimeServicesSupported variable +// +#define EFI_RT_SUPPORTED_GET_TIME 0x0001 +#define EFI_RT_SUPPORTED_SET_TIME 0x0002 +#define EFI_RT_SUPPORTED_GET_WAKEUP_TIME0x0004 +#define EFI_RT_SUPPORTED_SET_WAKEUP_TIME0x0008 +#define EFI_RT_SUPPORTED_GET_VARIABLE 0x0010 +#define EFI_RT_SUPPORTED_GET_NEXT_VARIABLE_NAME 0x0020 +#define EFI_RT_SUPPORTED_SET_VARIABLE 0x0040 +#define EFI_RT_SUPPORTED_SET_VIRTUAL_ADDRESS_MAP0x0080 +#define EFI_RT_SUPPORTED_CONVERT_POINTER0x0100 +#define EFI_RT_SUPPORTED_GET_NEXT_HIGH_MONOTONIC_COUNT 0x0200 +#define EFI_RT_SUPPORTED_RESET_SYSTEM 0x0400 +#define EFI_RT_SUPPORTED_UPDATE_CAPSULE 0x0800 +#define EFI_RT_SUPPORTED_QUERY_CAPSULE_CAPABILITIES 0x1000 +#define EFI_RT_SUPPORTED_QUERY_VARIABLE_INFO0x2000 + +// // EFI Runtime Services Table // #define EFI_SYSTEM_TABLE_SIGNATURE SIGNATURE_64 ('I','B','I',' ','S','Y','S','T') -- 2.7.4 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#50730): https://edk2.groups.io/g/devel/message/50730 Mute This Topic: https://groups.io/mt/59298929/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH 2/3] MdePkg/MdeModule: Add support for RuntimeServicesSupported variable
Add support for new global variable defined in the UEFI 2.8 specification. This provides a bitmask of which calls are implemented by the firmware during runtime services. Signed-off-by: Jeff Brasen --- .../Library/VarCheckUefiLib/VarCheckUefiLibNullClass.c| 11 +++ MdePkg/Include/Guid/GlobalVariable.h | 7 +++ 2 files changed, 18 insertions(+) diff --git a/MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLibNullClass.c b/MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLibNullClass.c index e3bf04a..4264892 100644 --- a/MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLibNullClass.c +++ b/MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLibNullClass.c @@ -553,6 +553,17 @@ UEFI_DEFINED_VARIABLE_ENTRY mGlobalVariableList[] = { }, NULL }, + { +EFI_RUNTIME_SERVICES_SUPPORTED_VARIABLE_NAME, +{ + VAR_CHECK_VARIABLE_PROPERTY_REVISION, + VAR_CHECK_VARIABLE_PROPERTY_READ_ONLY, + VARIABLE_ATTRIBUTE_BS_RT, + sizeof (UINT16), + sizeof (UINT16) +}, +NULL + }, }; UEFI_DEFINED_VARIABLE_ENTRY mGlobalVariableList2[] = { diff --git a/MdePkg/Include/Guid/GlobalVariable.h b/MdePkg/Include/Guid/GlobalVariable.h index 7abc103..06a8a12 100644 --- a/MdePkg/Include/Guid/GlobalVariable.h +++ b/MdePkg/Include/Guid/GlobalVariable.h @@ -182,5 +182,12 @@ extern EFI_GUID gEfiGlobalVariableGuid; /// Its attribute is BS+RT. /// #define EFI_VENDOR_KEYS_VARIABLE_NAME L"VendorKeys" +/// +/// Bitmask of which calls are implemented by the firmware during runtime services. +/// RT access is required only if GetVariable() is implemented by runtime services. +/// Should be treated as read-only. +/// Its attribute is BS+RT. +/// +#define EFI_RUNTIME_SERVICES_SUPPORTED_VARIABLE_NAME L"RuntimeServicesSupported" #endif -- 2.7.4 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#50731): https://edk2.groups.io/g/devel/message/50731 Mute This Topic: https://groups.io/mt/59298932/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH 0/3] Support for RuntimeServicesSupported global variable
Add support for the new UEFI 2.8 runtime services supported variable that is used to indicate which runtime services a platform supports. Also, add support for initializing this variable based on a PCD. Jeff Brasen (3): MdePkg-UefiSpec.h: Add UEFI 2.8 RuntimeServicesSuppported definations MdePkg/MdeModule: Add support for RuntimeServicesSupported variable MdeModulePkg/BdsDxe: Set RuntimeServicesSupported variable .../VarCheckUefiLib/VarCheckUefiLibNullClass.c | 11 +++ MdeModulePkg/MdeModulePkg.dec | 18 +++ MdeModulePkg/Universal/BdsDxe/BdsDxe.inf | 1 + MdeModulePkg/Universal/BdsDxe/BdsEntry.c | 35 +- MdePkg/Include/Guid/GlobalVariable.h | 7 + MdePkg/Include/Uefi/UefiSpec.h | 18 +++ 6 files changed, 89 insertions(+), 1 deletion(-) -- 2.7.4 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#50729): https://edk2.groups.io/g/devel/message/50729 Mute This Topic: https://groups.io/mt/59298925/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH 0/3] Support for RuntimeServicesSupported global variable
Not a problem, I expected that, just wanted to get this up for review so it can go in after the freeze is over. Thanks, Jeff From: Gao, Liming Sent: Tuesday, November 19, 2019 7:19 AM To: Jeff Brasen ; edk2-de...@lists.01.org ; devel@edk2.groups.io Cc: Kinney, Michael D ; Wu, Hao A ; Ni, Ray ; Gao, Zhichao Subject: RE: [PATCH 0/3] Support for RuntimeServicesSupported global variable Jeff: This patch set is a new feature support. Now, edk2 enters into soft feature freeze. No feature is allowed to be added. So, this feature will not catch edk2 2019 stable tag. Thanks Liming > -Original Message- > From: Jeff Brasen > Sent: Saturday, November 16, 2019 1:43 AM > To: edk2-de...@lists.01.org; devel@edk2.groups.io > Cc: Jeff Brasen ; Gao, Liming ; > Kinney, Michael D ; Wu, Hao > A ; Ni, Ray ; Gao, Zhichao > > Subject: [PATCH 0/3] Support for RuntimeServicesSupported global variable > > Add support for the new UEFI 2.8 runtime services supported variable > that is used to indicate which runtime services a platform supports. > Also, add support for initializing this variable based on a PCD. > > Jeff Brasen (3): > MdePkg-UefiSpec.h: Add UEFI 2.8 RuntimeServicesSuppported definations > MdePkg/MdeModule: Add support for RuntimeServicesSupported variable > MdeModulePkg/BdsDxe: Set RuntimeServicesSupported variable > > .../VarCheckUefiLib/VarCheckUefiLibNullClass.c | 11 +++ > MdeModulePkg/MdeModulePkg.dec | 18 +++ > MdeModulePkg/Universal/BdsDxe/BdsDxe.inf | 1 + > MdeModulePkg/Universal/BdsDxe/BdsEntry.c | 35 > +- > MdePkg/Include/Guid/GlobalVariable.h | 7 + > MdePkg/Include/Uefi/UefiSpec.h | 18 +++ > 6 files changed, 89 insertions(+), 1 deletion(-) > > -- > 2.7.4 --- This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. --- -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#50916): https://edk2.groups.io/g/devel/message/50916 Mute This Topic: https://groups.io/mt/59298925/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH v2 3/3] MdeModulePkg/BdsDxe: Set RuntimeServicesSupported variable
Add support for initializing and setting the UEFI 2.8 global variable RuntimeServicesSupported based on the value of a PCD. Change-Id: I8fbd404d492ff8278466edde8aa37d203537318c Signed-off-by: Jeff Brasen --- MdeModulePkg/Universal/BdsDxe/BdsDxe.inf | 1 + MdeModulePkg/Universal/BdsDxe/BdsEntry.c | 35 +++- MdePkg/MdePkg.dec| 18 MdePkg/MdePkg.uni| 17 4 files changed, 70 insertions(+), 1 deletion(-) diff --git a/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf b/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf index 9310b4d..52ec04f 100644 --- a/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf +++ b/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf @@ -90,6 +90,7 @@ gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultPlatformLang ## CONSUMES gEfiMdePkgTokenSpaceGuid.PcdHardwareErrorRecordLevel## CONSUMES gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut ## CONSUMES + gEfiMdePkgTokenSpaceGuid.PcdRuntimeServicesSupported## CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVendor## CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareRevision ## CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdConInConnectOnDemand ## CONSUMES diff --git a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c b/MdeModulePkg/Universal/BdsDxe/BdsEntry.c index d387dbe..16bc593 100644 --- a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c +++ b/MdeModulePkg/Universal/BdsDxe/BdsEntry.c @@ -40,7 +40,8 @@ CHAR16 *mReadOnlyVariables[] = { EFI_LANG_CODES_VARIABLE_NAME, EFI_BOOT_OPTION_SUPPORT_VARIABLE_NAME, EFI_HW_ERR_REC_SUPPORT_VARIABLE_NAME, - EFI_OS_INDICATIONS_SUPPORT_VARIABLE_NAME + EFI_OS_INDICATIONS_SUPPORT_VARIABLE_NAME, + EFI_RUNTIME_SERVICES_SUPPORTED_VARIABLE_NAME }; CHAR16 *mBdsLoadOptionName[] = { @@ -626,6 +627,33 @@ BdsFormalizeOSIndicationVariable ( /** + Formalize RuntimeServicesSupported variable. + +**/ +VOID +BdsFormalizeRuntimeServicesSupportedVariable ( + VOID + ) +{ + EFI_STATUS Status; + UINT16 RuntimeServicesSupported; + + RuntimeServicesSupported = PcdGet16 (PcdRuntimeServicesSupported); + Status = gRT->SetVariable ( + EFI_RUNTIME_SERVICES_SUPPORTED_VARIABLE_NAME, + &gEfiGlobalVariableGuid, + EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, + sizeof(RuntimeServicesSupported), + &RuntimeServicesSupported + ); + // + // Platform needs to make sure setting volatile variable before calling 3rd party code shouldn't fail. + // + ASSERT_EFI_ERROR (Status); +} + +/** + Validate variables. **/ @@ -645,6 +673,11 @@ BdsFormalizeEfiGlobalVariable ( // Validate OSIndication related variable. // BdsFormalizeOSIndicationVariable (); + + // + // Validate Runtime Services Supported variable. + // + BdsFormalizeRuntimeServicesSupportedVariable (); } /** diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec index d022cc5..cdcb2f9 100644 --- a/MdePkg/MdePkg.dec +++ b/MdePkg/MdePkg.dec @@ -2297,5 +2297,23 @@ # @Prompt Boot Timeout (s) gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|0x|UINT16|0x002c + ## Bitmask of supported runtime services + # BIT0 - GetTime + # BIT1 - SetTime + # BIT2 - GetWakeupTime + # BIT3 - SetWakeupTime + # BIT4 - GetVariable + # BIT5 - GetNextVariableName + # BIT6 - SetVariable + # BIT7 - SetVirtualAddressMap + # BIT8 - ConvertPointer + # BIT9 - GetNextHighMonotonicCount + # BIT10 - ResetSystem + # BIT11 - UpdateCapsule + # BIT12 - QueryCapsuleCapabilites + # BIT13 - QueryVariableInfo + # @Prompt Supported Runtime services bitmask. + gEfiMdePkgTokenSpaceGuid.PcdRuntimeServicesSupported|0x3FFF|UINT16|0x002e + [UserExtensions.TianoCore."ExtraFiles"] MdePkgExtra.uni diff --git a/MdePkg/MdePkg.uni b/MdePkg/MdePkg.uni index 5c1fa24..1edf681 100644 --- a/MdePkg/MdePkg.uni +++ b/MdePkg/MdePkg.uni @@ -413,3 +413,20 @@ #string STR_gEfiMdePkgTokenSpaceGuid_PcdUartDefaultReceiveFifoDepth_HELP #language en-US "Indicates the receive FIFO depth of UART controller." +#string STR_gEfiMdePkgTokenSpaceGuid_PcdRuntimeServicesSupported_PROMPT #language en-US "Supported Runtime Services bitmask" + +#string STR_gEfiMdePkgTokenSpaceGuid_PcdRuntimeServicesSupported_HELP #language en-US "Bitmask of supported runtime services\n" + "BIT0 - GetTime\n" + "BIT1 - SetTime\n" + "BIT2 - GetWakeupTime\n" +
[edk2-devel] [PATCH v2 1/3] MdePkg-UefiSpec.h: Add UEFI 2.8 RuntimeServicesSuppported definations
Add bitmask values for the value of the RuntimeServicesSupported variable defined in the UEFI 2.8 specification. This is used to describe what services the platform supports while in runtime. Change-Id: I7ff0fcdb856b4d2e4ba90a08291f8980e2f66375 Signed-off-by: Jeff Brasen --- MdePkg/Include/Uefi/UefiSpec.h | 18 ++ 1 file changed, 18 insertions(+) diff --git a/MdePkg/Include/Uefi/UefiSpec.h b/MdePkg/Include/Uefi/UefiSpec.h index 444aa35..7e2b719 100644 --- a/MdePkg/Include/Uefi/UefiSpec.h +++ b/MdePkg/Include/Uefi/UefiSpec.h @@ -1783,6 +1783,24 @@ EFI_STATUS #define EFI_OS_INDICATIONS_START_PLATFORM_RECOVERY 0x0040 // +// Bitmasks of supported runtime functions for RuntimeServicesSupported variable +// +#define EFI_RT_SUPPORTED_GET_TIME 0x0001 +#define EFI_RT_SUPPORTED_SET_TIME 0x0002 +#define EFI_RT_SUPPORTED_GET_WAKEUP_TIME0x0004 +#define EFI_RT_SUPPORTED_SET_WAKEUP_TIME0x0008 +#define EFI_RT_SUPPORTED_GET_VARIABLE 0x0010 +#define EFI_RT_SUPPORTED_GET_NEXT_VARIABLE_NAME 0x0020 +#define EFI_RT_SUPPORTED_SET_VARIABLE 0x0040 +#define EFI_RT_SUPPORTED_SET_VIRTUAL_ADDRESS_MAP0x0080 +#define EFI_RT_SUPPORTED_CONVERT_POINTER0x0100 +#define EFI_RT_SUPPORTED_GET_NEXT_HIGH_MONOTONIC_COUNT 0x0200 +#define EFI_RT_SUPPORTED_RESET_SYSTEM 0x0400 +#define EFI_RT_SUPPORTED_UPDATE_CAPSULE 0x0800 +#define EFI_RT_SUPPORTED_QUERY_CAPSULE_CAPABILITIES 0x1000 +#define EFI_RT_SUPPORTED_QUERY_VARIABLE_INFO0x2000 + +// // EFI Runtime Services Table // #define EFI_SYSTEM_TABLE_SIGNATURE SIGNATURE_64 ('I','B','I',' ','S','Y','S','T') -- 2.7.4 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#51379): https://edk2.groups.io/g/devel/message/51379 Mute This Topic: https://groups.io/mt/63268482/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH v2 2/3] MdePkg/MdeModule: Add support for RuntimeServicesSupported variable
Add support for new global variable defined in the UEFI 2.8 specification. This provides a bitmask of which calls are implemented by the firmware during runtime services. Change-Id: If871e16052ecd871fd03a0eef2e3ed5fa5beb93c Signed-off-by: Jeff Brasen --- .../Library/VarCheckUefiLib/VarCheckUefiLibNullClass.c| 11 +++ MdePkg/Include/Guid/GlobalVariable.h | 7 +++ 2 files changed, 18 insertions(+) diff --git a/MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLibNullClass.c b/MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLibNullClass.c index e3bf04a..4264892 100644 --- a/MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLibNullClass.c +++ b/MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLibNullClass.c @@ -553,6 +553,17 @@ UEFI_DEFINED_VARIABLE_ENTRY mGlobalVariableList[] = { }, NULL }, + { +EFI_RUNTIME_SERVICES_SUPPORTED_VARIABLE_NAME, +{ + VAR_CHECK_VARIABLE_PROPERTY_REVISION, + VAR_CHECK_VARIABLE_PROPERTY_READ_ONLY, + VARIABLE_ATTRIBUTE_BS_RT, + sizeof (UINT16), + sizeof (UINT16) +}, +NULL + }, }; UEFI_DEFINED_VARIABLE_ENTRY mGlobalVariableList2[] = { diff --git a/MdePkg/Include/Guid/GlobalVariable.h b/MdePkg/Include/Guid/GlobalVariable.h index 7abc103..06a8a12 100644 --- a/MdePkg/Include/Guid/GlobalVariable.h +++ b/MdePkg/Include/Guid/GlobalVariable.h @@ -182,5 +182,12 @@ extern EFI_GUID gEfiGlobalVariableGuid; /// Its attribute is BS+RT. /// #define EFI_VENDOR_KEYS_VARIABLE_NAME L"VendorKeys" +/// +/// Bitmask of which calls are implemented by the firmware during runtime services. +/// RT access is required only if GetVariable() is implemented by runtime services. +/// Should be treated as read-only. +/// Its attribute is BS+RT. +/// +#define EFI_RUNTIME_SERVICES_SUPPORTED_VARIABLE_NAME L"RuntimeServicesSupported" #endif -- 2.7.4 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#51380): https://edk2.groups.io/g/devel/message/51380 Mute This Topic: https://groups.io/mt/63268505/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH v2 0/3] Support for RuntimeServicesSupported global variable
Add support for the new UEFI 2.8 runtime services supported variable that is used to indicate which runtime services a platform supports. Also, add support for initializing this variable based on a PCD. Change Log: v1 - Initial version v2 - Move pcd from MdeModulePkg to MdePkg and update uni file Jeff Brasen (3): MdePkg-UefiSpec.h: Add UEFI 2.8 RuntimeServicesSuppported definations MdePkg/MdeModule: Add support for RuntimeServicesSupported variable MdeModulePkg/BdsDxe: Set RuntimeServicesSupported variable .../VarCheckUefiLib/VarCheckUefiLibNullClass.c | 11 +++ MdeModulePkg/Universal/BdsDxe/BdsDxe.inf | 1 + MdeModulePkg/Universal/BdsDxe/BdsEntry.c | 35 +- MdePkg/Include/Guid/GlobalVariable.h | 7 + MdePkg/Include/Uefi/UefiSpec.h | 18 +++ MdePkg/MdePkg.dec | 18 +++ MdePkg/MdePkg.uni | 17 +++ 7 files changed, 106 insertions(+), 1 deletion(-) -- 2.7.4 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#51378): https://edk2.groups.io/g/devel/message/51378 Mute This Topic: https://groups.io/mt/63268463/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [edk2-test] Location of tests for vendor/edk2 specific protocols
I finally got around to creating the feature request bug: https://bugzilla.tianocore.org/show_bug.cgi?id=1839 Thanks, Jeff From: Jin, Eric Sent: Monday, April 29, 2019 8:03 PM To: Supreeth Venkatesh; devel@edk2.groups.io; Jeff Brasen Cc: Jin, Eric Subject: RE: [edk2-test] Location of tests for vendor/edk2 specific protocols Hi Jeff, For the test for non-standard or vendor specific protocols, in my initial idea, I would like to see them on a separate space and can be built with SCT infrastructure thru description files and build scripts provided by vendor. Anyone can fetch the UEFI SCT or other specific test with his/her purpose/interest in this way easily. BTW, documents or spec link need be provided for user to understand test object and contribute test better. Anyway, it is a good start to record the request in Bugzilla Feature Request for further discussion. Best Regards Eric From: Supreeth Venkatesh Sent: Monday, April 15, 2019 1:25 AM To: devel@edk2.groups.io; Jeff Brasen (jbra...@nvidia.com) Cc: Jin, Eric Subject: RE: [edk2-test] Location of tests for vendor/edk2 specific protocols + Eric Thanks Jeff for bringing this up. As mentioned during our discussion on this topic briefly @ UEFI Plugfest 2019, I definitely like to see these non-standard protocol tests become part of test suite. However, there has been no proposal yet, though there were proposals related to SBBR (Arm’s Server Base Boot Requirements). Currently, any new platform tests added have to be added to UEFI SCT description files and build scripts for it to be included as part of test suite. May I request you to create Bugzilla Feature Request @ https://bugzilla.tianocore.org/ under “edk-test” product and “UEFI-SCT” component, as well expand on how you like this to be implemented? Supreeth From: devel@edk2.groups.io<mailto:devel@edk2.groups.io> mailto:devel@edk2.groups.io>> On Behalf Of Jeff Brasen via Groups.Io Sent: Friday, April 12, 2019 5:53 PM To: devel@edk2.groups.io<mailto:devel@edk2.groups.io> Subject: [edk2-devel] [edk2-test] Location of tests for vendor/edk2 specific protocols Now that we have the edk2-test repo with the SCT infrastructure, has there been any thought for where tests that use this for non-standardized protocols should live? My initial thought is along with the protocols in edk2/edk2-platforms. For example if you had Silicon/NVIDIA/Include/Procotol/x.h you would have Silicon/NVIDIA/TestCase/x/ for this. Has there been any thoughts/plans on this? Thanks, Jeff This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you. -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#41286): https://edk2.groups.io/g/devel/message/41286 Mute This Topic: https://groups.io/mt/31070030/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [edk2-test] Location of tests for vendor/edk2 specific protocols
Now that we have the edk2-test repo with the SCT infrastructure, has there been any thought for where tests that use this for non-standardized protocols should live? My initial thought is along with the protocols in edk2/edk2-platforms. For example if you had Silicon/NVIDIA/Include/Procotol/x.h you would have Silicon/NVIDIA/TestCase/x/ for this. Has there been any thoughts/plans on this? Thanks, Jeff --- This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. --- -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#38981): https://edk2.groups.io/g/devel/message/38981 Mute This Topic: https://groups.io/mt/31070030/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH] OvmfPkg/VirtioMmioDeviceLib: virtio 1.0: Fix SetQueueAlignment.
Nothing to do here for virtio 1.0 devices Signed-off-by: Jeff Brasen --- .../Library/VirtioMmioDeviceLib/VirtioMmioDeviceFunctions.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceFunctions.c b/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceFunctions.c index 8bdf1e1fc3..de2c5fa2a6 100644 --- a/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceFunctions.c +++ b/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceFunctions.c @@ -144,7 +144,9 @@ VirtioMmioSetQueueAlignment ( Device = VIRTIO_MMIO_DEVICE_FROM_VIRTIO_DEVICE (This); - VIRTIO_CFG_WRITE (Device, VIRTIO_MMIO_OFFSET_QUEUE_ALIGN, Alignment); + if (Device->Version == VIRTIO_MMIO_DEVICE_VERSION_0_95) { +VIRTIO_CFG_WRITE (Device, VIRTIO_MMIO_OFFSET_QUEUE_ALIGN, Alignment); + } return EFI_SUCCESS; } -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#101714): https://edk2.groups.io/g/devel/message/101714 Mute This Topic: https://groups.io/mt/97815638/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] HII Keyword utility
I have a UEFI shell application that can set/get UEFI x-UEFI HII Keyword values. edk2-nvidia/Silicon/NVIDIA/Application/HiiKeywordUtil at main · NVIDIA/edk2-nvidia (github.com) ( https://github.com/NVIDIA/edk2-nvidia/tree/main/Silicon/NVIDIA/Application/HiiKeywordUtil ) I have used this to configure iSCSI from the shell. Is this something that is desired to be in the main edk2 repo? If so, what package should this go under? If this is generally useful I'll do some cleanup and make a push request after the stable202405 release is out. -Jeff Brasen -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#118870): https://edk2.groups.io/g/devel/message/118870 Mute This Topic: https://groups.io/mt/106076569/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH] DynamicTablesPkg: SSDT _LPI revision is incorrect
_LPI Revision should be 0 per the ACPI 6.5 specification. "The revision number of the _LPI object. Current revision is 0." Signed-off-by: Jeff Brasen --- .../Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyGenerator.c| 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyGenerator.c index d06c7615fb..91199c4af2 100644 --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyGenerator.c +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyGenerator.c @@ -482,7 +482,7 @@ GenerateLpiStates ( } // We do not support the LevelId field for now, let it to 0. -Status = AmlCreateLpiNode (AslName, 1, 0, ScopeNode, &LpiNode); +Status = AmlCreateLpiNode (AslName, 0, 0, ScopeNode, &LpiNode); if (EFI_ERROR (Status)) { ASSERT (0); return Status; -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#96407): https://edk2.groups.io/g/devel/message/96407 Mute This Topic: https://groups.io/mt/95048993/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH] DynamicTablesPkg/EsrtFmpDxe: Support multiple devices with 0 HardwareInstance
Skip error check if HardwareInstance is 0 as this either means that FmpVersion < 3 and not supported or, "A zero means the FMP provider is not able to determine a unique hardware instance number or a hardware instance number is not needed." per UEFI specification. As the FmpInstances are merged and HardwareInstance is not used remove error check in this case. Signed-off-by: Jeff Brasen --- MdeModulePkg/Universal/EsrtFmpDxe/EsrtFmp.c | 22 - 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/MdeModulePkg/Universal/EsrtFmpDxe/EsrtFmp.c b/MdeModulePkg/Universal/EsrtFmpDxe/EsrtFmp.c index 4f47c55cce..5bc627461d 100644 --- a/MdeModulePkg/Universal/EsrtFmpDxe/EsrtFmp.c +++ b/MdeModulePkg/Universal/EsrtFmpDxe/EsrtFmp.c @@ -153,16 +153,20 @@ CreateEsrtEntry ( // // Check to see of FmpImageInfoBuf GUID/HardwareInstance is unique + // Skip if HardwareInstance is 0 as this is the case if FmpVersion < 3 + // or the device can not create a unique ID per UEFI specification // - for (Index = 0; Index < *NumberOfDescriptors; Index++) { -if (CompareGuid (&HardwareInstances[Index].ImageTypeGuid, &FmpImageInfoBuf->ImageTypeId)) { - if (HardwareInstances[Index].HardwareInstance == FmpHardwareInstance) { -DEBUG ((DEBUG_ERROR, "EsrtFmpDxe: Duplicate firmware image descriptor with GUID %g HardwareInstance:0x%x\n", &FmpImageInfoBuf->ImageTypeId, FmpHardwareInstance)); -ASSERT ( - !CompareGuid (&HardwareInstances[Index].ImageTypeGuid, &FmpImageInfoBuf->ImageTypeId) || - HardwareInstances[Index].HardwareInstance != FmpHardwareInstance - ); -return EFI_UNSUPPORTED; + if (FmpHardwareInstance != 0) { +for (Index = 0; Index < *NumberOfDescriptors; Index++) { + if (CompareGuid (&HardwareInstances[Index].ImageTypeGuid, &FmpImageInfoBuf->ImageTypeId)) { +if (HardwareInstances[Index].HardwareInstance == FmpHardwareInstance) { + DEBUG ((DEBUG_ERROR, "EsrtFmpDxe: Duplicate firmware image descriptor with GUID %g HardwareInstance:0x%x\n", &FmpImageInfoBuf->ImageTypeId, FmpHardwareInstance)); + ASSERT ( +!CompareGuid (&HardwareInstances[Index].ImageTypeGuid, &FmpImageInfoBuf->ImageTypeId) || +HardwareInstances[Index].HardwareInstance != FmpHardwareInstance +); + return EFI_UNSUPPORTED; +} } } } -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#96436): https://edk2.groups.io/g/devel/message/96436 Mute This Topic: https://groups.io/mt/95069050/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH v2] MdeModulePkg/EsrtFmpDxe: Support multiple devices with 0 HardwareInstance
Skip error check if HardwareInstance is 0 as this either means that FmpVersion < 3 and not supported or, "A zero means the FMP provider is not able to determine a unique hardware instance number or a hardware instance number is not needed." per UEFI specification. As the FmpInstances are merged and HardwareInstance is not used remove error check in this case. Signed-off-by: Jeff Brasen --- MdeModulePkg/Universal/EsrtFmpDxe/EsrtFmp.c | 22 - 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/MdeModulePkg/Universal/EsrtFmpDxe/EsrtFmp.c b/MdeModulePkg/Universal/EsrtFmpDxe/EsrtFmp.c index 4f47c55cce..5bc627461d 100644 --- a/MdeModulePkg/Universal/EsrtFmpDxe/EsrtFmp.c +++ b/MdeModulePkg/Universal/EsrtFmpDxe/EsrtFmp.c @@ -153,16 +153,20 @@ CreateEsrtEntry ( // // Check to see of FmpImageInfoBuf GUID/HardwareInstance is unique + // Skip if HardwareInstance is 0 as this is the case if FmpVersion < 3 + // or the device can not create a unique ID per UEFI specification // - for (Index = 0; Index < *NumberOfDescriptors; Index++) { -if (CompareGuid (&HardwareInstances[Index].ImageTypeGuid, &FmpImageInfoBuf->ImageTypeId)) { - if (HardwareInstances[Index].HardwareInstance == FmpHardwareInstance) { -DEBUG ((DEBUG_ERROR, "EsrtFmpDxe: Duplicate firmware image descriptor with GUID %g HardwareInstance:0x%x\n", &FmpImageInfoBuf->ImageTypeId, FmpHardwareInstance)); -ASSERT ( - !CompareGuid (&HardwareInstances[Index].ImageTypeGuid, &FmpImageInfoBuf->ImageTypeId) || - HardwareInstances[Index].HardwareInstance != FmpHardwareInstance - ); -return EFI_UNSUPPORTED; + if (FmpHardwareInstance != 0) { +for (Index = 0; Index < *NumberOfDescriptors; Index++) { + if (CompareGuid (&HardwareInstances[Index].ImageTypeGuid, &FmpImageInfoBuf->ImageTypeId)) { +if (HardwareInstances[Index].HardwareInstance == FmpHardwareInstance) { + DEBUG ((DEBUG_ERROR, "EsrtFmpDxe: Duplicate firmware image descriptor with GUID %g HardwareInstance:0x%x\n", &FmpImageInfoBuf->ImageTypeId, FmpHardwareInstance)); + ASSERT ( +!CompareGuid (&HardwareInstances[Index].ImageTypeGuid, &FmpImageInfoBuf->ImageTypeId) || +HardwareInstances[Index].HardwareInstance != FmpHardwareInstance +); + return EFI_UNSUPPORTED; +} } } } -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#97277): https://edk2.groups.io/g/devel/message/97277 Mute This Topic: https://groups.io/mt/95629273/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH] MdePkg/BaseFdtLib: Rename standard functions
Rename the standard functions in the LibFdtSupport to remove conflicts with other libraries that define them. Signed-off-by: Jeff Brasen --- MdePkg/Library/BaseFdtLib/LibFdtSupport.h | 16 +++ MdePkg/Library/BaseFdtLib/LibFdtWrapper.c | 25 ++- 2 files changed, 18 insertions(+), 23 deletions(-) diff --git a/MdePkg/Library/BaseFdtLib/LibFdtSupport.h b/MdePkg/Library/BaseFdtLib/LibFdtSupport.h index 393019324b..47beac9fac 100644 --- a/MdePkg/Library/BaseFdtLib/LibFdtSupport.h +++ b/MdePkg/Library/BaseFdtLib/LibFdtSupport.h @@ -68,6 +68,12 @@ strrchr( int ); +char * +fdt_strrchr( + const char *, + int + ); + unsigned long strtoul ( const char *, @@ -75,6 +81,13 @@ strtoul ( int ); +unsigned long +fdt_strtoul ( + const char *, + char **, + int + ); + char * strcpy ( char*strDest, @@ -93,7 +106,10 @@ strcpy ( #define strnlen(str, count) (size_t)(AsciiStrnLenS(str, count)) #define strncpy(strDest, strSource, count) AsciiStrnCpyS(strDest, MAX_STRING_SIZE, strSource, (UINTN)count) #define strcat(strDest, strSource) AsciiStrCatS(strDest, MAX_STRING_SIZE, strSource) +#define strchr(str, ch) ScanMem8(str, AsciiStrSize (str), (UINT8)ch) #define strcmp(string1, string2, count) (int)(AsciiStrCmp(string1, string2)) #define strncmp(string1, string2, count)(int)(AsciiStrnCmp(string1, string2, (UINTN)(count))) +#define strrchr(str, ch)fdt_strrchr(str, ch) +#define strtoul(ptr, end_ptr, base) fdt_strtoul(ptr, end_ptr, base) #endif /* FDT_LIB_SUPPORT_H_ */ diff --git a/MdePkg/Library/BaseFdtLib/LibFdtWrapper.c b/MdePkg/Library/BaseFdtLib/LibFdtWrapper.c index ef6452914f..1a4cd573fd 100644 --- a/MdePkg/Library/BaseFdtLib/LibFdtWrapper.c +++ b/MdePkg/Library/BaseFdtLib/LibFdtWrapper.c @@ -18,28 +18,7 @@ // so the code gets a bit clunky to handle that case specifically. char * -strchr ( - const char *Str, - int Char - ) -{ - char *S; - - S = (char *)Str; - - for ( ; ; S++) { -if (*S == Char) { - return S; -} - -if (*S == '\0') { - return NULL; -} - } -} - -char * -strrchr ( +fdt_strrchr ( const char *Str, int Char ) @@ -71,7 +50,7 @@ __isspace ( } unsigned long -strtoul ( +fdt_strtoul ( const char *Nptr, char**EndPtr, int Base -- 2.34.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#112308): https://edk2.groups.io/g/devel/message/112308 Mute This Topic: https://groups.io/mt/103110792/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH] MdePkg: Add FdtLib gmock support
Add Google Mock Library for FdtLib Signed-off-by: Jeff Brasen --- .../Include/GoogleTest/Library/MockFdtLib.h | 165 ++ .../GoogleTest/MockFdtLib/MockFdtLib.cpp | 34 .../GoogleTest/MockFdtLib/MockFdtLib.inf | 28 +++ 3 files changed, 227 insertions(+) create mode 100644 MdePkg/Test/Mock/Include/GoogleTest/Library/MockFdtLib.h create mode 100644 MdePkg/Test/Mock/Library/GoogleTest/MockFdtLib/MockFdtLib.cpp create mode 100644 MdePkg/Test/Mock/Library/GoogleTest/MockFdtLib/MockFdtLib.inf diff --git a/MdePkg/Test/Mock/Include/GoogleTest/Library/MockFdtLib.h b/MdePkg/Test/Mock/Include/GoogleTest/Library/MockFdtLib.h new file mode 100644 index 00..c0aeaa25c0 --- /dev/null +++ b/MdePkg/Test/Mock/Include/GoogleTest/Library/MockFdtLib.h @@ -0,0 +1,165 @@ +/** @file + Google Test mocks for FdtLib + + Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + Copyright (c) 2023, Intel Corporation. All rights reserved. + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#ifndef MOCK_FDT_LIB_H_ +#define MOCK_FDT_LIB_H_ + +#include +#include +extern "C" { +#include +#include +#include +} + +struct MockFdtLib { + MOCK_INTERFACE_DECLARATION (MockFdtLib); + + MOCK_FUNCTION_DECLARATION ( +UINT16, +Fdt16ToCpu, +(IN UINT16 Value) +); + MOCK_FUNCTION_DECLARATION ( +UINT16, +CpuToFdt16, +(IN UINT16 Value) +); + MOCK_FUNCTION_DECLARATION ( +UINT32, +Fdt32ToCpu, +(IN UINT32 Value) +); + MOCK_FUNCTION_DECLARATION ( +UINT32, +CpuToFdt32, +(IN UINT32 Value) +); + MOCK_FUNCTION_DECLARATION ( +UINT64, +Fdt64ToCpu, +(IN UINT64 Value) +); + MOCK_FUNCTION_DECLARATION ( +UINT64, +CpuToFdt64, +(IN UINT64 Value) +); + MOCK_FUNCTION_DECLARATION ( +INT32, +FdtCheckHeader, +(IN CONST VOID *Fdt) +); + MOCK_FUNCTION_DECLARATION ( +INT32, +FdtCreateEmptyTree, +(IN VOID*Buffer, + IN UINT32 BufferSize) +); + MOCK_FUNCTION_DECLARATION ( +INT32, +FdtNextNode, +(IN CONST VOID *Fdt, + IN INT32 Offset, + IN INT32 *Depth) +); + MOCK_FUNCTION_DECLARATION ( +INT32, +FdtFirstSubnode, +(IN CONST VOID *Fdt, + IN INT32 Offset) +); + MOCK_FUNCTION_DECLARATION ( +INT32, +FdtNextSubnode, +(IN CONST VOID *Fdt, + IN INT32 Offset) +); + MOCK_FUNCTION_DECLARATION ( +INT32, +FdtSubnodeOffsetNameLen, +(IN CONST VOID *Fdt, + IN INT32ParentOffset, + IN CONST CHAR8 *Name, + IN INT32NameLength) +); + MOCK_FUNCTION_DECLARATION ( +INT32, +FdtNodeOffsetByPropValue, +(IN CONST VOID *Fdt, + IN INT32StartOffset, + IN CONST CHAR8 *PropertyName, + IN CONST VOID *PropertyValue, + IN INT32PropertyLength) +); + MOCK_FUNCTION_DECLARATION ( +CONST FDT_PROPERTY *, +FdtGetProperty, +(IN CONST VOID *Fdt, + IN INT32NodeOffset, + IN CONST CHAR8 *Name, + IN INT32*Length) +); + MOCK_FUNCTION_DECLARATION ( +INT32, +FdtFirstPropertyOffset, +(IN CONST VOID *Fdt, + IN INT32 NodeOffset) +); + MOCK_FUNCTION_DECLARATION ( +INT32, +FdtNextPropertyOffset, +(IN CONST VOID *Fdt, + IN INT32 NodeOffset) +); + MOCK_FUNCTION_DECLARATION ( +CONST FDT_PROPERTY *, +FdtGetPropertyByOffset, +(IN CONST VOID *Fdt, + IN INT32 Offset, + IN INT32 *Length) +); + MOCK_FUNCTION_DECLARATION ( +CONST CHAR8 *, +FdtGetString, +(IN CONST VOID *Fdt, + IN INT32 StrOffset, + IN INT32 *LengthOPTIONAL) +); + MOCK_FUNCTION_DECLARATION ( +INT32, +FdtAddSubnode, +(IN VOID *Fdt, + IN INT32ParentOffset, + IN CONST CHAR8 *Name) +); + MOCK_FUNCTION_DECLARATION ( +INT32, +FdtSetProp, +(IN VOID *Fdt, + IN INT32NodeOffset, + IN CONST CHAR8 *Name, + IN CONST VOID *Value, + IN UINT32 Length) +); + MOCK_FUNCTION_DECLARATION ( +CONST CHAR8 *, +FdtGetName, +(IN VOID*Fdt, + IN INT32 NodeOffset, + IN UINT32 *Length) +); + MOCK_FUNCTION_DECLARATION ( +INT32, +FdtNodeDepth, +(IN CONST VOID *Fdt, + IN INT32 NodeOffset) +); +}; + +#endif diff --git a/MdePkg/Test/Mock/Library/GoogleTest/MockFdtLib/MockFdtLib.cpp b/MdePkg/Test/Mock/Library/GoogleTest/MockFdtLib/MockFdtLib.cpp new file mode 100644 index 00..a955780d23 --- /dev/null +++ b/MdePkg/Test/Mock/Library/GoogleTest/MockFdtLib/MockFdtLib.cpp @@ -0,0 +1,34 @@ +/** @file + Google Test mocks for FdtLib + + Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + Copyright (c) 2023, Intel Corporation. All rights reserved. + SPDX-License-Identifier: BSD-2-Clause-Paten
[edk2-devel] [PATCH] EmbeddedPkg: Add DtPlatformLoaderLib gmock support
Add Google Mock Library for DtPlatformLoaderDtbLib Signed-off-by: Jeff Brasen --- EmbeddedPkg/EmbeddedPkg.dec | 1 + .../Library/MockDtPlatformDtbLoaderLib.h | 31 +++ .../MockDtPlatformDtbLoaderLib.cpp| 13 .../MockDtPlatformDtbLoaderLib.inf| 29 + 4 files changed, 74 insertions(+) create mode 100644 EmbeddedPkg/Test/Mock/Include/GoogleTest/Library/MockDtPlatformDtbLoaderLib.h create mode 100644 EmbeddedPkg/Test/Mock/Library/GoogleTest/MockDtPlatformDtbLoaderLib/MockDtPlatformDtbLoaderLib.cpp create mode 100644 EmbeddedPkg/Test/Mock/Library/GoogleTest/MockDtPlatformDtbLoaderLib/MockDtPlatformDtbLoaderLib.inf diff --git a/EmbeddedPkg/EmbeddedPkg.dec b/EmbeddedPkg/EmbeddedPkg.dec index 94dc3c9b76..b4834e8b4f 100644 --- a/EmbeddedPkg/EmbeddedPkg.dec +++ b/EmbeddedPkg/EmbeddedPkg.dec @@ -28,6 +28,7 @@ [Includes.common] Include# Root include for the package + Test/Mock/Include [LibraryClasses.common] PrePiLib|Include/Library/PrePiLib.h diff --git a/EmbeddedPkg/Test/Mock/Include/GoogleTest/Library/MockDtPlatformDtbLoaderLib.h b/EmbeddedPkg/Test/Mock/Include/GoogleTest/Library/MockDtPlatformDtbLoaderLib.h new file mode 100644 index 00..23dab21668 --- /dev/null +++ b/EmbeddedPkg/Test/Mock/Include/GoogleTest/Library/MockDtPlatformDtbLoaderLib.h @@ -0,0 +1,31 @@ +/** @file + Google Test mocks for DtPlatformDtbLoaderLib + + Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + Copyright (c) 2023, Intel Corporation. All rights reserved. + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#ifndef MOCK_DT_PLATFORM_DTB_LOADER_LIB_H_ +#define MOCK_DT_PLATFORM_DTB_LOADER_LIB_H_ + +#include +#include +extern "C" { +#include +#include +#include +} + +struct MockDtPlatformDtbLoaderLib { + MOCK_INTERFACE_DECLARATION (MockDtPlatformDtbLoaderLib); + + MOCK_FUNCTION_DECLARATION ( +EFI_STATUS, +DtPlatformLoadDtb, +(OUT VOID **Dtb, + OUT UINTN *DtbSize) +); +}; + +#endif diff --git a/EmbeddedPkg/Test/Mock/Library/GoogleTest/MockDtPlatformDtbLoaderLib/MockDtPlatformDtbLoaderLib.cpp b/EmbeddedPkg/Test/Mock/Library/GoogleTest/MockDtPlatformDtbLoaderLib/MockDtPlatformDtbLoaderLib.cpp new file mode 100644 index 00..a5db68e59a --- /dev/null +++ b/EmbeddedPkg/Test/Mock/Library/GoogleTest/MockDtPlatformDtbLoaderLib/MockDtPlatformDtbLoaderLib.cpp @@ -0,0 +1,13 @@ +/** @file + Google Test mocks for MockDtPlatformDtbLoaderLib + + Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + Copyright (c) 2023, Intel Corporation. All rights reserved. + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include + +MOCK_INTERFACE_DEFINITION (MockDtPlatformDtbLoaderLib); + +MOCK_FUNCTION_DEFINITION (MockDtPlatformDtbLoaderLib, DtPlatformLoadDtb, 2, EFIAPI); diff --git a/EmbeddedPkg/Test/Mock/Library/GoogleTest/MockDtPlatformDtbLoaderLib/MockDtPlatformDtbLoaderLib.inf b/EmbeddedPkg/Test/Mock/Library/GoogleTest/MockDtPlatformDtbLoaderLib/MockDtPlatformDtbLoaderLib.inf new file mode 100644 index 00..9618efd864 --- /dev/null +++ b/EmbeddedPkg/Test/Mock/Library/GoogleTest/MockDtPlatformDtbLoaderLib/MockDtPlatformDtbLoaderLib.inf @@ -0,0 +1,29 @@ +## @file +# Google Test mocks for MockDtPlatformDtbLoaderLib +# +# Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# Copyright (c) 2023, Intel Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION= 0x00010005 + BASE_NAME = MockDtPlatformDtbLoaderLib + FILE_GUID = 34c05e81-3c56-4c78-b4b7-a39be19163a4 + MODULE_TYPE= HOST_APPLICATION + VERSION_STRING = 1.0 + LIBRARY_CLASS = DtPlatformDtbLoaderLib + +[Sources] +MockDtPlatformDtbLoaderLib.cpp + +[Packages] + EmbeddedPkg/EmbeddedPkg.dec + MdePkg/MdePkg.dec + UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec + +[LibraryClasses] + GoogleTestLib + +[BuildOptions] + MSFT:*_*_*_CC_FLAGS = /EHsc -- 2.34.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#112311): https://edk2.groups.io/g/devel/message/112311 Mute This Topic: https://groups.io/mt/103110931/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH] EmbeddedPkg/PrePiMemoryAllocationLib: Add ReallocatePool
Add implementation of ReallocatePool which is defined in the MemoryAllocationLib header file to allow components to not need special handling for PrePi module types. Signed-off-by: Jeff Brasen --- .../MemoryAllocationLib.c | 57 +++ 1 file changed, 57 insertions(+) diff --git a/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c b/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c index 08a0add340..39fbe243dd 100644 --- a/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c +++ b/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c @@ -269,3 +269,60 @@ FreePool ( { // Not implemented yet } + +/** + Reallocates a buffer of type EfiBootServicesData. + + Allocates and zeros the number bytes specified by NewSize from memory of type + EfiBootServicesData. If OldBuffer is not NULL, then the smaller of OldSize and + NewSize bytes are copied from OldBuffer to the newly allocated buffer, and + OldBuffer is freed. A pointer to the newly allocated buffer is returned. + If NewSize is 0, then a valid buffer of 0 size is returned. If there is not + enough memory remaining to satisfy the request, then NULL is returned. + + If the allocation of the new buffer is successful and the smaller of NewSize and OldSize + is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT(). + + @param OldSizeThe size, in bytes, of OldBuffer. + @param NewSizeThe size, in bytes, of the buffer to reallocate. + @param OldBuffer The buffer to copy to the allocated buffer. This is an optional + parameter that may be NULL. + + @return A pointer to the allocated buffer or NULL if allocation fails. + +**/ +VOID * +EFIAPI +ReallocatePool ( + IN UINTN OldSize, + IN UINTN NewSize, + IN VOID *OldBuffer OPTIONAL + ) +{ + VOID *NewBuffer; + + // Validate the OldBuffer is HobAllocated. + DEBUG_CODE_BEGIN (); + EFI_HOB_HANDOFF_INFO_TABLE *HandOffHob; + + if (OldBuffer != NULL) { +HandOffHob = GetHobList (); +ASSERT (((EFI_PHYSICAL_ADDRESS)OldBuffer >= HandOffHob->EfiMemoryBottom)); +ASSERT (((EFI_PHYSICAL_ADDRESS)(OldBuffer + OldSize) <= HandOffHob->EfiFreeMemoryBottom)); + } + + DEBUG_CODE_END (); + + // If new buffer would be smaller just return old buffer as FreePool isn't supported. + if ((OldBuffer != NULL) && (OldSize >= NewSize)) { +return OldBuffer; + } + + NewBuffer = AllocateZeroPool (NewSize); + if ((NewBuffer != NULL) && (OldBuffer != NULL)) { +CopyMem (NewBuffer, OldBuffer, MIN (OldSize, NewSize)); +FreePool (OldBuffer); + } + + return NewBuffer; +} -- 2.34.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#112312): https://edk2.groups.io/g/devel/message/112312 Mute This Topic: https://groups.io/mt/103110962/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH] MdePkg/BaseFdtLib: Rename standard functions
Hit send before adding the cc on this one. (Would probably be good to get that added to here (https://github.com/tianocore/tianocore.github.io/wiki/EDK-II-Development-Process) so copy paste doesn't get folks 😊. I sent them as different patch series as I thought this one might cause some discussion and wanted to separate it from that. This issue I was seeing is if you both include FdtLib and BaseCryptLib they both contain implementations of these standard functions with other functions in the same c files. This results in a link error as the linker won't discard part of a compilation unit if it is used so if you have Foo.c has functions func1 and func2 Bar.c has functions func3 and func2 If func3 and func1 are both used externally that will cause both objects to be included and the linker to complain that func2 is defined twice. We could move these to c files with just 1 function each in both libraries but that seemed like a bigger change than this. -Jeff > -Original Message- > From: Pedro Falcato > Sent: Monday, December 11, 2023 9:00 AM > To: devel@edk2.groups.io; Jeff Brasen > Subject: Re: [edk2-devel] [PATCH] MdePkg/BaseFdtLib: Rename standard > functions > > External email: Use caution opening links or attachments > > > On Mon, Dec 11, 2023 at 3:40 PM Jeff Brasen via groups.io > wrote: > > > > Jeff, > > You're missing CC's on this patch. Also, you should probably send the > 3 patches in a single series, since they're all related. > > > Rename the standard functions in the LibFdtSupport to remove conflicts > > with other libraries that define them. > > This is a funny problem. What error were you seeing? As far as I can tell, you > can totally define your local C library functions, it shouldn't result in any > linker > errors (even if, IIRC, deemed UB by the C spec). > > -- > Pedro -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#112319): https://edk2.groups.io/g/devel/message/112319 Mute This Topic: https://groups.io/mt/103110792/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH] EmbeddedPkg/PrePiMemoryAllocationLib: Add ReallocatePool
Looks like I missed an UINTN cast will fix and push a v2. > -Original Message- > From: Ard Biesheuvel > Sent: Thursday, December 21, 2023 7:54 AM > To: Chang, Abner > Cc: Jeff Brasen ; devel@edk2.groups.io; > ardb+tianoc...@kernel.org; quic_llind...@quicinc.com > Subject: Re: [PATCH] EmbeddedPkg/PrePiMemoryAllocationLib: Add > ReallocatePool > > External email: Use caution opening links or attachments > > > On Thu, 21 Dec 2023 at 15:39, Ard Biesheuvel wrote: > > > > On Mon, 18 Dec 2023 at 03:23, Chang, Abner > wrote: > > > > > > [AMD Official Use Only - General] > > > > > > Reviewed-by: Abner Chang > > > > > > > I've queued this up, along with the mock one - thanks. > > > > Rejected by CI: > https://github.com/tianocore/edk2/pull/5184 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#112988): https://edk2.groups.io/g/devel/message/112988 Mute This Topic: https://groups.io/mt/103110962/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH v2 0/3] EmbeddedPkg ReallocatePool and Mock changes
Adding Mock support for DtPlatformLoaderLib and changing ci.yaml to support this Adding ReallocatePool support to PrePi Library. Passing CI in https://github.com/tianocore/edk2/pull/5197 Change log v2 - Fix uncrustify errors Fix ci allowed packages entries Fix cast on 32-bit systems Jeff Brasen (3): EmbeddedPkg/PrePiMemoryAllocationLib: Add ReallocatePool EmbeddedPkg: Add host based dependency to ci EmbeddedPkg: Add DtPlatformLoaderLib gmock support EmbeddedPkg/EmbeddedPkg.dec | 1 + .../MockDtPlatformDtbLoaderLib.inf| 29 ++ .../Library/MockDtPlatformDtbLoaderLib.h | 31 ++ .../MemoryAllocationLib.c | 57 +++ EmbeddedPkg/EmbeddedPkg.ci.yaml | 4 +- .../MockDtPlatformDtbLoaderLib.cpp| 13 + 6 files changed, 134 insertions(+), 1 deletion(-) create mode 100644 EmbeddedPkg/Test/Mock/Library/GoogleTest/MockDtPlatformDtbLoaderLib/MockDtPlatformDtbLoaderLib.inf create mode 100644 EmbeddedPkg/Test/Mock/Include/GoogleTest/Library/MockDtPlatformDtbLoaderLib.h create mode 100644 EmbeddedPkg/Test/Mock/Library/GoogleTest/MockDtPlatformDtbLoaderLib/MockDtPlatformDtbLoaderLib.cpp -- 2.34.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#112989): https://edk2.groups.io/g/devel/message/112989 Mute This Topic: https://groups.io/mt/103407482/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH v2 2/3] EmbeddedPkg: Add host based dependency to ci
Add UnitTestFrameworkPkg to AcceptableDependencies-HOST_APPLICATION list Signed-off-by: Jeff Brasen --- EmbeddedPkg/EmbeddedPkg.ci.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/EmbeddedPkg/EmbeddedPkg.ci.yaml b/EmbeddedPkg/EmbeddedPkg.ci.yaml index 96a60a6f8b4d..6d042fc721ab 100644 --- a/EmbeddedPkg/EmbeddedPkg.ci.yaml +++ b/EmbeddedPkg/EmbeddedPkg.ci.yaml @@ -50,7 +50,9 @@ "MdePkg/MdePkg.dec" ], # For host based unit tests -"AcceptableDependencies-HOST_APPLICATION":[], +"AcceptableDependencies-HOST_APPLICATION":[ +"UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec" +], # For UEFI shell based apps "AcceptableDependencies-UEFI_APPLICATION":[], "IgnoreInf": [] -- 2.34.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#112990): https://edk2.groups.io/g/devel/message/112990 Mute This Topic: https://groups.io/mt/103407483/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH v2 1/3] EmbeddedPkg/PrePiMemoryAllocationLib: Add ReallocatePool
Add implementation of ReallocatePool which is defined in the MemoryAllocationLib header file to allow components to not need special handling for PrePi module types. Signed-off-by: Jeff Brasen --- .../MemoryAllocationLib.c | 57 +++ 1 file changed, 57 insertions(+) diff --git a/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c b/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c index 08a0add340cf..fa81cc9d595a 100644 --- a/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c +++ b/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c @@ -269,3 +269,60 @@ FreePool ( { // Not implemented yet } + +/** + Reallocates a buffer of type EfiBootServicesData. + + Allocates and zeros the number bytes specified by NewSize from memory of type + EfiBootServicesData. If OldBuffer is not NULL, then the smaller of OldSize and + NewSize bytes are copied from OldBuffer to the newly allocated buffer, and + OldBuffer is freed. A pointer to the newly allocated buffer is returned. + If NewSize is 0, then a valid buffer of 0 size is returned. If there is not + enough memory remaining to satisfy the request, then NULL is returned. + + If the allocation of the new buffer is successful and the smaller of NewSize and OldSize + is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT(). + + @param OldSizeThe size, in bytes, of OldBuffer. + @param NewSizeThe size, in bytes, of the buffer to reallocate. + @param OldBuffer The buffer to copy to the allocated buffer. This is an optional + parameter that may be NULL. + + @return A pointer to the allocated buffer or NULL if allocation fails. + +**/ +VOID * +EFIAPI +ReallocatePool ( + IN UINTN OldSize, + IN UINTN NewSize, + IN VOID *OldBuffer OPTIONAL + ) +{ + VOID *NewBuffer; + + // Validate the OldBuffer is HobAllocated. + DEBUG_CODE_BEGIN (); + EFI_HOB_HANDOFF_INFO_TABLE *HandOffHob; + + if (OldBuffer != NULL) { +HandOffHob = GetHobList (); +ASSERT (((EFI_PHYSICAL_ADDRESS)(UINTN)OldBuffer >= HandOffHob->EfiMemoryBottom)); +ASSERT (((EFI_PHYSICAL_ADDRESS)(UINTN)(OldBuffer + OldSize) <= HandOffHob->EfiFreeMemoryBottom)); + } + + DEBUG_CODE_END (); + + // If new buffer would be smaller just return old buffer as FreePool isn't supported. + if ((OldBuffer != NULL) && (OldSize >= NewSize)) { +return OldBuffer; + } + + NewBuffer = AllocateZeroPool (NewSize); + if ((NewBuffer != NULL) && (OldBuffer != NULL)) { +CopyMem (NewBuffer, OldBuffer, MIN (OldSize, NewSize)); +FreePool (OldBuffer); + } + + return NewBuffer; +} -- 2.34.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#112991): https://edk2.groups.io/g/devel/message/112991 Mute This Topic: https://groups.io/mt/103407484/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH v2 3/3] EmbeddedPkg: Add DtPlatformLoaderLib gmock support
Add Google Mock Library for DtPlatformLoaderDtbLib Signed-off-by: Jeff Brasen --- EmbeddedPkg/EmbeddedPkg.dec | 1 + .../MockDtPlatformDtbLoaderLib.inf| 29 + .../Library/MockDtPlatformDtbLoaderLib.h | 31 +++ .../MockDtPlatformDtbLoaderLib.cpp| 13 4 files changed, 74 insertions(+) create mode 100644 EmbeddedPkg/Test/Mock/Library/GoogleTest/MockDtPlatformDtbLoaderLib/MockDtPlatformDtbLoaderLib.inf create mode 100644 EmbeddedPkg/Test/Mock/Include/GoogleTest/Library/MockDtPlatformDtbLoaderLib.h create mode 100644 EmbeddedPkg/Test/Mock/Library/GoogleTest/MockDtPlatformDtbLoaderLib/MockDtPlatformDtbLoaderLib.cpp diff --git a/EmbeddedPkg/EmbeddedPkg.dec b/EmbeddedPkg/EmbeddedPkg.dec index 94dc3c9b76ca..b4834e8b4f88 100644 --- a/EmbeddedPkg/EmbeddedPkg.dec +++ b/EmbeddedPkg/EmbeddedPkg.dec @@ -28,6 +28,7 @@ [Defines] [Includes.common] Include# Root include for the package + Test/Mock/Include [LibraryClasses.common] PrePiLib|Include/Library/PrePiLib.h diff --git a/EmbeddedPkg/Test/Mock/Library/GoogleTest/MockDtPlatformDtbLoaderLib/MockDtPlatformDtbLoaderLib.inf b/EmbeddedPkg/Test/Mock/Library/GoogleTest/MockDtPlatformDtbLoaderLib/MockDtPlatformDtbLoaderLib.inf new file mode 100644 index ..9618efd86470 --- /dev/null +++ b/EmbeddedPkg/Test/Mock/Library/GoogleTest/MockDtPlatformDtbLoaderLib/MockDtPlatformDtbLoaderLib.inf @@ -0,0 +1,29 @@ +## @file +# Google Test mocks for MockDtPlatformDtbLoaderLib +# +# Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# Copyright (c) 2023, Intel Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION= 0x00010005 + BASE_NAME = MockDtPlatformDtbLoaderLib + FILE_GUID = 34c05e81-3c56-4c78-b4b7-a39be19163a4 + MODULE_TYPE= HOST_APPLICATION + VERSION_STRING = 1.0 + LIBRARY_CLASS = DtPlatformDtbLoaderLib + +[Sources] +MockDtPlatformDtbLoaderLib.cpp + +[Packages] + EmbeddedPkg/EmbeddedPkg.dec + MdePkg/MdePkg.dec + UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec + +[LibraryClasses] + GoogleTestLib + +[BuildOptions] + MSFT:*_*_*_CC_FLAGS = /EHsc diff --git a/EmbeddedPkg/Test/Mock/Include/GoogleTest/Library/MockDtPlatformDtbLoaderLib.h b/EmbeddedPkg/Test/Mock/Include/GoogleTest/Library/MockDtPlatformDtbLoaderLib.h new file mode 100644 index ..ce0fca2c3293 --- /dev/null +++ b/EmbeddedPkg/Test/Mock/Include/GoogleTest/Library/MockDtPlatformDtbLoaderLib.h @@ -0,0 +1,31 @@ +/** @file + Google Test mocks for DtPlatformDtbLoaderLib + + Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + Copyright (c) 2023, Intel Corporation. All rights reserved. + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#ifndef MOCK_DT_PLATFORM_DTB_LOADER_LIB_H_ +#define MOCK_DT_PLATFORM_DTB_LOADER_LIB_H_ + +#include +#include +extern "C" { + #include + #include + #include +} + +struct MockDtPlatformDtbLoaderLib { + MOCK_INTERFACE_DECLARATION (MockDtPlatformDtbLoaderLib); + + MOCK_FUNCTION_DECLARATION ( +EFI_STATUS, +DtPlatformLoadDtb, +(OUT VOID **Dtb, + OUT UINTN *DtbSize) +); +}; + +#endif diff --git a/EmbeddedPkg/Test/Mock/Library/GoogleTest/MockDtPlatformDtbLoaderLib/MockDtPlatformDtbLoaderLib.cpp b/EmbeddedPkg/Test/Mock/Library/GoogleTest/MockDtPlatformDtbLoaderLib/MockDtPlatformDtbLoaderLib.cpp new file mode 100644 index ..a5db68e59a09 --- /dev/null +++ b/EmbeddedPkg/Test/Mock/Library/GoogleTest/MockDtPlatformDtbLoaderLib/MockDtPlatformDtbLoaderLib.cpp @@ -0,0 +1,13 @@ +/** @file + Google Test mocks for MockDtPlatformDtbLoaderLib + + Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + Copyright (c) 2023, Intel Corporation. All rights reserved. + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include + +MOCK_INTERFACE_DEFINITION (MockDtPlatformDtbLoaderLib); + +MOCK_FUNCTION_DEFINITION (MockDtPlatformDtbLoaderLib, DtPlatformLoadDtb, 2, EFIAPI); -- 2.34.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#112992): https://edk2.groups.io/g/devel/message/112992 Mute This Topic: https://groups.io/mt/103407486/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH v4 1/4] DynamicTablesPkg: Add ThermalZone CodeGen function
Add API to generate a ThermalZone object to AmlLib. Signed-off-by: Jeff Brasen --- .../Include/Library/AmlLib/AmlLib.h | 28 + .../Common/AmlLib/CodeGen/AmlCodeGen.c| 116 ++ 2 files changed, 144 insertions(+) diff --git a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h index 9210c50915..d201ae9499 100644 --- a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h +++ b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h @@ -1038,6 +1038,34 @@ AmlCodeGenDevice ( OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL ); +/** AML code generation for a ThermalZone object node. + + AmlCodeGenThermalZone ("TZ00", ParentNode, NewObjectNode) is + equivalent of the following ASL code: +ThermalZone(TZ00) {} + + @ingroup CodeGenApis + + @param [in] NameString The new ThermalZone's name. + Must be a NULL-terminated ASL NameString + e.g.: "DEV0", "DV15.DEV0", etc. + The input string is copied. + @param [in] ParentNode If provided, set ParentNode as the parent + of the node created. + @param [out] NewObjectNode If success, contains the created node. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCESFailed to allocate memory. +**/ +EFI_STATUS +EFIAPI +AmlCodeGenThermalZone ( + IN CONST CHAR8 *NameString, + INAML_NODE_HANDLE ParentNode OPTIONAL, + OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL + ); + /** AML code generation for a Scope object node. AmlCodeGenScope ("_SB", ParentNode, NewObjectNode) is diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c index 0b223379fa..88537b7e2d 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c @@ -1218,6 +1218,122 @@ error_handler1: return Status; } +/** AML code generation for a ThermalZone object node. + + AmlCodeGenThermalZone ("TZ00", ParentNode, NewObjectNode) is + equivalent of the following ASL code: +ThermalZone(TZ00) {} + + @ingroup CodeGenApis + + @param [in] NameString The new ThermalZone's name. + Must be a NULL-terminated ASL NameString + e.g.: "DEV0", "DV15.DEV0", etc. + The input string is copied. + @param [in] ParentNode If provided, set ParentNode as the parent + of the node created. + @param [out] NewObjectNode If success, contains the created node. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCESFailed to allocate memory. +**/ +EFI_STATUS +EFIAPI +AmlCodeGenThermalZone ( + IN CONST CHAR8 *NameString, + INAML_NODE_HANDLE ParentNode OPTIONAL, + OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL + ) +{ + EFI_STATUS Status; + AML_OBJECT_NODE *ObjectNode; + AML_DATA_NODE*DataNode; + CHAR8*AmlNameString; + UINT32 AmlNameStringSize; + + if ((NameString == NULL) || + ((ParentNode == NULL) && (NewObjectNode == NULL))) + { +ASSERT (0); +return EFI_INVALID_PARAMETER; + } + + ObjectNode= NULL; + DataNode = NULL; + AmlNameString = NULL; + + Status = ConvertAslNameToAmlName (NameString, &AmlNameString); + if (EFI_ERROR (Status)) { +ASSERT (0); +return Status; + } + + Status = AmlGetNameStringSize (AmlNameString, &AmlNameStringSize); + if (EFI_ERROR (Status)) { +ASSERT (0); +goto error_handler1; + } + + Status = AmlCreateObjectNode ( + AmlGetByteEncodingByOpCode (AML_EXT_OP, AML_EXT_THERMAL_ZONE_OP), + AmlNameStringSize + AmlComputePkgLengthWidth (AmlNameStringSize), + &ObjectNode + ); + if (EFI_ERROR (Status)) { +ASSERT (0); +goto error_handler1; + } + + Status = AmlCreateDataNode ( + EAmlNodeDataTypeNameString, + (UINT8 *)AmlNameString, + AmlNameStringSize, + &DataNode + ); + if (EFI_ERROR (Status)) { +ASSERT (0); +goto error_handler2; + } + + Status = AmlSetFixedArgument ( + ObjectNode, + EAmlParseIndexTerm0, + (AML_NODE_HEADER *)DataNode + ); + if (EFI_ERROR (Status)) { +ASSERT (0); +AmlDeleteTree ((AML_NODE_HEADER *)DataNode); +go
[edk2-devel] [PATCH v4 0/4] Add support for generating ACPI ThermalZones
Add APIs needed to create thermal zones dynamically. Does not add a generator for this as creating the TMP method generically may be difficult. Change log: v4 - Fixed an additional error handling path v3 - Fixed a couple error handling paths v2 - renamed NameString function and added goto dones in a couple error cases Jeff Brasen (4): DynamicTablesPkg: Add ThermalZone CodeGen function DynamicTablesPkg: Add support for simple method invocation. DynamicTablesPkg: Add support to add Strings to package DynamicTablesPkg: Add Aml NameUnicodeString API .../Include/Library/AmlLib/AmlLib.h | 130 + .../Common/AmlLib/CodeGen/AmlCodeGen.c| 534 ++ 2 files changed, 664 insertions(+) -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#108800): https://edk2.groups.io/g/devel/message/108800 Mute This Topic: https://groups.io/mt/101436334/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH v4 2/4] DynamicTablesPkg: Add support for simple method invocation.
Add support to add Return objects via AML that pass a single integer argument to the named method. Signed-off-by: Jeff Brasen --- .../Include/Library/AmlLib/AmlLib.h | 54 .../Common/AmlLib/CodeGen/AmlCodeGen.c| 244 ++ 2 files changed, 298 insertions(+) diff --git a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h index d201ae9499..b82c7a3ce8 100644 --- a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h +++ b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h @@ -1194,6 +1194,60 @@ AmlCodeGenMethodRetInteger ( OUT AML_OBJECT_NODE_HANDLE *NewObjectNodeOPTIONAL ); +/** AML code generation for a method returning a NameString that takes an +integer argument. + + AmlCodeGenMethodRetNameStringIntegerArgument ( +"MET0", "MET1", 1, TRUE, 3, 5, ParentNode, NewObjectNode +); + is equivalent of the following ASL code: +Method(MET0, 1, Serialized, 3) { + Return (MET1 (5)) +} + + The ASL parameters "ReturnType" and "ParameterTypes" are not asked + in this function. They are optional parameters in ASL. + + @param [in] MethodNameString The new Method's name. +Must be a NULL-terminated ASL NameString +e.g.: "MET0", "_SB.MET0", etc. +The input string is copied. + @param [in] ReturnedNameString The name of the object returned by the +method. Optional parameter, can be: + - NULL (ignored). + - A NULL-terminated ASL NameString. + e.g.: "MET0", "_SB.MET0", etc. + The input string is copied. + @param [in] NumArgs Number of arguments. +Must be 0 <= NumArgs <= 6. + @param [in] IsSerialized TRUE is equivalent to Serialized. +FALSE is equivalent to NotSerialized. +Default is NotSerialized in ASL spec. + @param [in] SyncLevelSynchronization level for the method. +Must be 0 <= SyncLevel <= 15. +Default is 0 in ASL. + @param [in] IntegerArgument Argument to pass to the NameString. + @param [in] ParentNode If provided, set ParentNode as the parent +of the node created. + @param [out] NewObjectNodeIf success, contains the created node. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCESFailed to allocate memory. +**/ +EFI_STATUS +EFIAPI +AmlCodeGenMethodRetNameStringIntegerArgument ( + IN CONST CHAR8 *MethodNameString, + IN CONST CHAR8 *ReturnedNameString OPTIONAL, + INUINT8 NumArgs, + INBOOLEAN IsSerialized, + INUINT8 SyncLevel, + INUINT64 IntegerArgument, + INAML_NODE_HANDLE ParentNode OPTIONAL, + OUT AML_OBJECT_NODE_HANDLE *NewObjectNodeOPTIONAL + ); + /** Create a _LPI name. AmlCreateLpiNode ("_LPI", 0, 1, ParentNode, &LpiNode) is diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c index 88537b7e2d..ea519d1aa8 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c @@ -1881,6 +1881,138 @@ AmlCodeGenReturnInteger ( return Status; } +/** AML code generation for a Return object node, +returning the object as an input NameString with a integer argument. + + AmlCodeGenReturn ("NAM1", 6, ParentNode, NewObjectNode) is + equivalent of the following ASL code: +Return(NAM1 (6)) + + The ACPI 6.3 specification, s20.2.5.3 "Type 1 Opcodes Encoding" states: +DefReturn := ReturnOp ArgObject +ReturnOp := 0xA4 +ArgObject := TermArg => DataRefObject + + Thus, the ReturnNode must be evaluated as a DataRefObject. It can + be a NameString referencing an object. As this CodeGen Api doesn't + do semantic checking, it is strongly advised to check the AML bytecode + generated by this function against an ASL compiler. + + The ReturnNode must be generated inside a Method body scope. + + @param [in] NameString The object referenced by this NameString + is returned by the Return ASL statem
[edk2-devel] [PATCH v4 3/4] DynamicTablesPkg: Add support to add Strings to package
Add API to add a String to a package created with NamedPackage API. Signed-off-by: Jeff Brasen --- .../Include/Library/AmlLib/AmlLib.h | 17 .../Common/AmlLib/CodeGen/AmlCodeGen.c| 88 +++ 2 files changed, 105 insertions(+) diff --git a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h index b82c7a3ce8..f4a4908753 100644 --- a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h +++ b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h @@ -1472,4 +1472,21 @@ AmlCreateCpcNode ( OUT AML_OBJECT_NODE_HANDLE *NewCpcNode OPTIONAL ); +/** AML code generation to add a NameString to the package in a named node. + + + @param [in] NameString NameString to add + @param [in] NamedNode Node to add the string to the included package. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCESFailed to allocate memory. +**/ +EFI_STATUS +EFIAPI +AmlAddNameStringToNamedPackage ( + IN CHAR8 *NameString, + IN AML_OBJECT_NODE_HANDLE NamedNode + ); + #endif // AML_LIB_H_ diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c index ea519d1aa8..2afd405750 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c @@ -3685,3 +3685,91 @@ error_handler: AmlDeleteTree ((AML_NODE_HANDLE)CpcNode); return Status; } + +/** AML code generation to add a NameString to the package in a named node. + + + @param [in] NameString NameString to add + @param [in] NamedNode Node to add the string to the included package. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCESFailed to allocate memory. +**/ +EFI_STATUS +EFIAPI +AmlAddNameStringToNamedPackage ( + IN CHAR8 *NameString, + IN AML_OBJECT_NODE_HANDLE NamedNode + ) +{ + EFI_STATUS Status; + AML_DATA_NODE *DataNode; + CHAR8 *AmlNameString; + UINT32 AmlNameStringSize; + AML_OBJECT_NODE_HANDLE PackageNode; + + DataNode = NULL; + + if ((NamedNode == NULL) || + (AmlGetNodeType ((AML_NODE_HANDLE)NamedNode) != EAmlNodeObject) || + (!AmlNodeHasOpCode (NamedNode, AML_NAME_OP, 0))) + { +ASSERT (0); +return EFI_INVALID_PARAMETER; + } + + PackageNode = (AML_OBJECT_NODE_HANDLE)AmlGetFixedArgument ( + NamedNode, + EAmlParseIndexTerm1 + ); + if ((PackageNode == NULL) || + (AmlGetNodeType ((AML_NODE_HANDLE)PackageNode) != EAmlNodeObject) || + (!AmlNodeHasOpCode (PackageNode, AML_PACKAGE_OP, 0))) + { +ASSERT (0); +return EFI_INVALID_PARAMETER; + } + + Status = ConvertAslNameToAmlName (NameString, &AmlNameString); + if (EFI_ERROR (Status)) { +ASSERT (0); +return Status; + } + + Status = AmlGetNameStringSize (AmlNameString, &AmlNameStringSize); + if (EFI_ERROR (Status)) { +ASSERT (0); +goto exit_handler; + } + + Status = AmlCreateDataNode ( + EAmlNodeDataTypeNameString, + (UINT8 *)AmlNameString, + AmlNameStringSize, + &DataNode + ); + if (EFI_ERROR (Status)) { +ASSERT (0); +goto exit_handler; + } + + Status = AmlVarListAddTail ( + (AML_NODE_HANDLE)PackageNode, + (AML_NODE_HANDLE)DataNode + ); + ASSERT_EFI_ERROR (Status); + +exit_handler: + if (AmlNameString != NULL) { +FreePool (AmlNameString); + } + + if (EFI_ERROR (Status)) { +if (DataNode != NULL) { + AmlDeleteTree ((AML_NODE_HANDLE)DataNode); +} + } + + return Status; +} -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#108802): https://edk2.groups.io/g/devel/message/108802 Mute This Topic: https://groups.io/mt/101436338/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH v4 4/4] DynamicTablesPkg: Add Aml NameUnicodeString API
Add API to generate a Name that contains a Unicode string buffer. Signed-off-by: Jeff Brasen --- .../Include/Library/AmlLib/AmlLib.h | 31 +++ .../Common/AmlLib/CodeGen/AmlCodeGen.c| 86 +++ 2 files changed, 117 insertions(+) diff --git a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h index f4a4908753..e0dc1340ab 100644 --- a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h +++ b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h @@ -958,6 +958,37 @@ AmlCodeGenNameResourceTemplate ( OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL ); +/** AML code generation for a Name object node, containing a String. + + AmlCodeGenNameUnicodeString ("_STR", L"String", ParentNode, NewObjectNode) is + equivalent of the following ASL code: +Name(_STR, Unicode ("String")) + + @ingroup CodeGenApis + + @param [in] NameString The new variable name. + Must be a NULL-terminated ASL NameString + e.g.: "DEV0", "DV15.DEV0", etc. + The input string is copied. + @param [in] String NULL terminated Unicode String to associate to the + NameString. + @param [in] ParentNode If provided, set ParentNode as the parent + of the node created. + @param [out] NewObjectNode If success, contains the created node. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCESFailed to allocate memory. +**/ +EFI_STATUS +EFIAPI +AmlCodeGenNameUnicodeString ( + IN CONST CHAR8 *NameString, + INCHAR16 *String, + INAML_NODE_HANDLE ParentNode OPTIONAL, + OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL + ); + /** Add a _PRT entry. AmlCodeGenPrtEntry (0x0, 0, "LNKA", 0, PrtNameNode) is diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c index 2afd405750..51eece5958 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c @@ -869,6 +869,92 @@ AmlCodeGenNameResourceTemplate ( return Status; } +/** AML code generation for a Name object node, containing a String. + + AmlCodeGenNameUnicodeString ("_STR", L"String", ParentNode, NewObjectNode) is + equivalent of the following ASL code: + Name(_STR, Unicode ("String")) + + @ingroup CodeGenApis + + @param [in] NameString The new variable name. + Must be a NULL-terminated ASL NameString + e.g.: "DEV0", "DV15.DEV0", etc. + The input string is copied. + @param [in] String NULL terminated Unicode String to associate to the + NameString. + @param [in] ParentNode If provided, set ParentNode as the parent + of the node created. + @param [out] NewObjectNode If success, contains the created node. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCESFailed to allocate memory. +**/ +EFI_STATUS +EFIAPI +AmlCodeGenNameUnicodeString ( + IN CONST CHAR8 *NameString, + INCHAR16 *String, + INAML_NODE_HANDLE ParentNode OPTIONAL, + OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL + ) +{ + EFI_STATUS Status; + AML_OBJECT_NODE *ObjectNode; + AML_DATA_NODE*DataNode; + + if ((NameString == NULL) || + (String == NULL) || + ((ParentNode == NULL) && (NewObjectNode == NULL))) + { +ASSERT (0); +return EFI_INVALID_PARAMETER; + } + + Status = AmlCodeGenBuffer (NULL, 0, &ObjectNode); + if (EFI_ERROR (Status)) { +ASSERT_EFI_ERROR (Status); +return Status; + } + + Status = AmlCreateDataNode ( + EAmlNodeDataTypeRaw, + (CONST UINT8 *)String, + StrSize (String), + &DataNode + ); + if (EFI_ERROR (Status)) { +ASSERT_EFI_ERROR (Status); +AmlDeleteTree ((AML_NODE_HEADER *)ObjectNode); +return Status; + } + + Status = AmlVarListAddTail ( + (AML_NODE_HEADER *)ObjectNode, + (AML_NODE_HEADER *)DataNode + ); + if (EFI_ERROR (Status)) { +ASSERT_EFI_ERROR (Status); +AmlDeleteTree ((AML_NODE_HEADER *)ObjectNode); +AmlDeleteTree ((AML_NODE_HANDLE)DataNode); +return Status; + } + + Status =
Re: [edk2-devel] [PATCH v4 3/4] DynamicTablesPkg: Add support to add Strings to package
Hi Sami, That sounds good. Thanks, Jeff > -Original Message- > From: Sami Mujawar > Sent: Thursday, September 21, 2023 10:50 AM > To: Jeff Brasen ; devel@edk2.groups.io > Cc: pierre.gond...@arm.com; Swatisri Kantamsetti ; > Ashish Singhal ; n...@arm.com > Subject: Re: [PATCH v4 3/4] DynamicTablesPkg: Add support to add Strings to > package > > External email: Use caution opening links or attachments > > > Hi Jeff, > > Thank you for this patch. > > Please see my response inline marked [SAMI]. > > Regards, > > Sami Mujawar > > On 18/09/2023 04:46 pm, Jeff Brasen wrote: > > Add API to add a String to a package created with NamedPackage API. > > > > > > > > Signed-off-by: Jeff Brasen > > > > --- > > > > .../Include/Library/AmlLib/AmlLib.h | 17 > > > > .../Common/AmlLib/CodeGen/AmlCodeGen.c| 88 > +++ > > > > 2 files changed, 105 insertions(+) > > > > > > > > diff --git a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h > > b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h > > > > index b82c7a3ce8..f4a4908753 100644 > > > > --- a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h > > > > +++ b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h > > > > @@ -1472,4 +1472,21 @@ AmlCreateCpcNode ( > > > > OUT AML_OBJECT_NODE_HANDLE *NewCpcNode OPTIONAL > > > > ); > > > > > > > > +/** AML code generation to add a NameString to the package in a named > node. > > > > + > > > > + > > > > + @param [in] NameString NameString to add > > > > + @param [in] NamedNode Node to add the string to the included > package. > > > > + > > > > + @retval EFI_SUCCESS Success. > > > > + @retval EFI_INVALID_PARAMETER Invalid parameter. > > > > + @retval EFI_OUT_OF_RESOURCESFailed to allocate memory. > > > > +**/ > > > > +EFI_STATUS > > > > +EFIAPI > > > > +AmlAddNameStringToNamedPackage ( > > > > + IN CHAR8 *NameString, > > > > + IN AML_OBJECT_NODE_HANDLE NamedNode > > > > + ); > > > > + > > > > #endif // AML_LIB_H_ > > > > diff --git > > a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c > > b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c > > > > index ea519d1aa8..2afd405750 100644 > > > > --- > a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c > > > > +++ > b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c > > > > @@ -3685,3 +3685,91 @@ error_handler: > > > > AmlDeleteTree ((AML_NODE_HANDLE)CpcNode); > > > > return Status; > > > > } > > > > + > > > > +/** AML code generation to add a NameString to the package in a named > node. > > > > + > > > > + > > > > + @param [in] NameString NameString to add > > > > + @param [in] NamedNode Node to add the string to the included > package. > > > > + > > > > + @retval EFI_SUCCESS Success. > > > > + @retval EFI_INVALID_PARAMETER Invalid parameter. > > > > + @retval EFI_OUT_OF_RESOURCESFailed to allocate memory. > > > > +**/ > > > > +EFI_STATUS > > > > +EFIAPI > > > > +AmlAddNameStringToNamedPackage ( > > > > + IN CHAR8 *NameString, > > > > + IN AML_OBJECT_NODE_HANDLE NamedNode > > > > + ) > > > > +{ > > > > + EFI_STATUS Status; > > > > + AML_DATA_NODE *DataNode; > > > > + CHAR8 *AmlNameString; > > > > + UINT32 AmlNameStringSize; > > > > + AML_OBJECT_NODE_HANDLE PackageNode; > > > > + > > > > + DataNode = NULL; > > > > + > > > > + if ((NamedNode == NULL) || > > > > + (AmlGetNodeType ((AML_NODE_HANDLE)NamedNode) != > EAmlNodeObject) > > + || > > > > + (!AmlNodeHasOpCode (NamedNode, AML_NAME_OP, 0))) > > > > + { > > > > +ASSERT (0); > > > > +return EFI_INVALID_PARAMETER; > > > > + } > > > > + > > > > + PackageNode = (AML_OBJECT_NODE_HANDLE)AmlGetFixedArgument ( > > >
Re: [edk2-devel] [PATCH v4 2/4] DynamicTablesPkg: Add support for simple method invocation.
Only thing I see is if AmlCodeGenInteger fails we don’t delete DataNode right? From: Sami Mujawar Sent: Thursday, September 21, 2023 10:49 AM To: Jeff Brasen ; devel@edk2.groups.io Cc: pierre.gond...@arm.com; Swatisri Kantamsetti ; Ashish Singhal ; n...@arm.com Subject: Re: [PATCH v4 2/4] DynamicTablesPkg: Add support for simple method invocation. External email: Use caution opening links or attachments Hi Jeff, Thank you for this patch. Please see my response inline marked [SAMI]. Regards, Sami Mujawar On 18/09/2023 04:46 pm, Jeff Brasen wrote: Add support to add Return objects via AML that pass a single integer argument to the named method. Signed-off-by: Jeff Brasen <mailto:jbra...@nvidia.com> --- .../Include/Library/AmlLib/AmlLib.h | 54 .../Common/AmlLib/CodeGen/AmlCodeGen.c| 244 ++ 2 files changed, 298 insertions(+) diff --git a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h index d201ae9499..b82c7a3ce8 100644 --- a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h +++ b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h @@ -1194,6 +1194,60 @@ AmlCodeGenMethodRetInteger ( OUT AML_OBJECT_NODE_HANDLE *NewObjectNodeOPTIONAL ); +/** AML code generation for a method returning a NameString that takes an +integer argument. + + AmlCodeGenMethodRetNameStringIntegerArgument ( +"MET0", "MET1", 1, TRUE, 3, 5, ParentNode, NewObjectNode +); + is equivalent of the following ASL code: +Method(MET0, 1, Serialized, 3) { + Return (MET1 (5)) +} + + The ASL parameters "ReturnType" and "ParameterTypes" are not asked + in this function. They are optional parameters in ASL. + + @param [in] MethodNameString The new Method's name. +Must be a NULL-terminated ASL NameString +e.g.: "MET0", "_SB.MET0", etc. +The input string is copied. + @param [in] ReturnedNameString The name of the object returned by the +method. Optional parameter, can be: + - NULL (ignored). + - A NULL-terminated ASL NameString. + e.g.: "MET0", "_SB.MET0", etc. + The input string is copied. + @param [in] NumArgs Number of arguments. +Must be 0 <= NumArgs <= 6. + @param [in] IsSerialized TRUE is equivalent to Serialized. +FALSE is equivalent to NotSerialized. +Default is NotSerialized in ASL spec. + @param [in] SyncLevelSynchronization level for the method. +Must be 0 <= SyncLevel <= 15. +Default is 0 in ASL. + @param [in] IntegerArgument Argument to pass to the NameString. + @param [in] ParentNode If provided, set ParentNode as the parent +of the node created. + @param [out] NewObjectNodeIf success, contains the created node. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCESFailed to allocate memory. +**/ +EFI_STATUS +EFIAPI +AmlCodeGenMethodRetNameStringIntegerArgument ( + IN CONST CHAR8 *MethodNameString, + IN CONST CHAR8 *ReturnedNameString OPTIONAL, + INUINT8 NumArgs, + INBOOLEAN IsSerialized, + INUINT8 SyncLevel, + INUINT64 IntegerArgument, + INAML_NODE_HANDLE ParentNode OPTIONAL, + OUT AML_OBJECT_NODE_HANDLE *NewObjectNodeOPTIONAL + ); + /** Create a _LPI name. AmlCreateLpiNode ("_LPI", 0, 1, ParentNode, &LpiNode) is diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c index 88537b7e2d..ea519d1aa8 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c @@ -1881,6 +1881,138 @@ AmlCodeGenReturnInteger ( return Status; } +/** AML code generation for a Return object node, +returning the object as an input NameString with a integer argument. + + AmlCodeGenReturn ("NAM1", 6, ParentNode, NewObjectNode) i
[edk2-devel] [PATCH v2 0/2] Add support for PCI IO using Qword resources
Use AmlCodeGenRdQWordIo() to generate the I/O range in _CRS instead of AmlCodeGenRdDWordIo() to cater to the scenarios where 64-bit addresses can be used to generate I/O packets over the PCIe bus. Changes: v2 - Rebased and set transferEncoding = 8bit Vidya Sagar (2): DynamicTablesPkg: AML Code generation for I/O ranges DynamicTablesPkg: AcpiSsdtPcieLibArm: Use QWord todescribe I/O range .../Include/Library/AmlLib/AmlLib.h | 67 ++ .../AcpiSsdtPcieLibArm/SsdtPcieGenerator.c| 2 +- .../AmlLib/CodeGen/AmlResourceDataCodeGen.c | 90 +++ 3 files changed, 158 insertions(+), 1 deletion(-) -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#108969): https://edk2.groups.io/g/devel/message/108969 Mute This Topic: https://groups.io/mt/101508452/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH v2 1/2] DynamicTablesPkg: AML Code generation for I/O ranges
From: Vidya Sagar Add helper functions to generate AML Resource Data describing I/O ranges of four words long. API AmlCodeGenRdQWordIo () is exposed. Signed-off-by: Jeff Brasen --- .../Include/Library/AmlLib/AmlLib.h | 67 ++ .../AmlLib/CodeGen/AmlResourceDataCodeGen.c | 90 +++ 2 files changed, 157 insertions(+) diff --git a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h index 9210c5091548..8e24cecdd77b 100644 --- a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h +++ b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h @@ -683,6 +683,73 @@ AmlCodeGenRdWordBusNumber ( OUT AML_DATA_NODE_HANDLE*NewRdNode OPTIONAL ); +/** Code generation for the "QWordIO ()" ASL function. + + The Resource Data effectively created is a QWord Address Space Resource + Data. Cf ACPI 6.4: + - s6.4.3.5.1 "QWord Address Space Descriptor". + - s19.6.109 "QWordIO". + + The created resource data node can be: + - appended to the list of resource data elements of the NameOpNode. + In such case NameOpNode must be defined by a the "Name ()" ASL statement + and initially contain a "ResourceTemplate ()". + - returned through the NewRdNode parameter. + + See ACPI 6.4 spec, s19.6.109 for more. + + @param [in] IsResourceConsumer ResourceUsage parameter. + @param [in] IsMinFixed Minimum address is fixed. + @param [in] IsMaxFixed Maximum address is fixed. + @param [in] IsPosDecode Decode parameter + @param [in] IsaRangesPossible values are: + 0-Reserved + 1-NonISAOnly + 2-ISAOnly + 3-EntireRange + @param [in] AddressGranularity Address granularity. + @param [in] AddressMinimum Minimum address. + @param [in] AddressMaximum Maximum address. + @param [in] AddressTranslation Address translation. + @param [in] RangeLength Range length. + @param [in] ResourceSourceIndex Resource Source index. +Unused. Must be 0. + @param [in] ResourceSource Resource Source. +Unused. Must be NULL. + @param [in] IsDenseTranslation TranslationDensity parameter. + @param [in] IsTypeStatic TranslationType parameter. + @param [in] NameOpNode NameOp object node defining a named object. +If provided, append the new resource data +node to the list of resource data elements +of this node. + @param [out] NewRdNodeIf provided and success, +contain the created node. + + @retval EFI_SUCCESS The function completed successfully. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCESCould not allocate memory. +**/ +EFI_STATUS +EFIAPI +AmlCodeGenRdQWordIo ( + INBOOLEAN IsResourceConsumer, + INBOOLEAN IsMinFixed, + INBOOLEAN IsMaxFixed, + INBOOLEAN IsPosDecode, + INUINT8 IsaRanges, + INUINT64 AddressGranularity, + INUINT64 AddressMinimum, + INUINT64 AddressMaximum, + INUINT64 AddressTranslation, + INUINT64 RangeLength, + INUINT8 ResourceSourceIndex, + IN CONST CHAR8 *ResourceSource, + INBOOLEAN IsDenseTranslation, + INBOOLEAN IsTypeStatic, + INAML_OBJECT_NODE_HANDLE NameOpNode, OPTIONAL + OUT AML_DATA_NODE_HANDLE*NewRdNode OPTIONAL + ); + /** Code generation for the "QWordMemory ()" ASL function. The Resource Data effectively created is a QWord Address Space Resource diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeGen.c b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeGen.c index 4ca63ccd2396..9c6700b9e08c 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeGen.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeGen.c @@ -1012,6 +1012,96 @@ AmlCodeGenRdQWordSpace ( return LinkRdNode (RdNode, NameOpNode, NewRdNode); } +/** Code generation for the "QWordIO ()" ASL function. + + The Resource Data effectively created is a QWord Address Space Resource + Data. Cf ACPI 6.4: + - s6.4.3.5.1 "QWord Address Space Descriptor". + - s19.6.109 "QWordIO". + + The created resource data node can be: + - appended to the list of resource data elements of the NameOpNode. + In such case NameOpNode must be defined by a the "Name ()" ASL statement + and initially contain a "ResourceTemplate ()". + - returned through the NewRdNode parameter. + + See AC
[edk2-devel] [PATCH v2 2/2] DynamicTablesPkg: AcpiSsdtPcieLibArm: Use QWord todescribe I/O range
From: Vidya Sagar Use AmlCodeGenRdQWordIo() to generate the I/O range in _CRS instead of AmlCodeGenRdDWordIo() to cater to the scenarios where 64-bit addresses can be used to generate I/O packets over the PCIe bus. Signed-off-by: Jeff Brasen --- .../Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c index c54ae6f551f6..9ddaddc198fa 100644 --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c @@ -540,7 +540,7 @@ GeneratePciCrs ( switch (AddrMapInfo->SpaceCode) { case PCI_SS_IO: -Status = AmlCodeGenRdDWordIo ( +Status = AmlCodeGenRdQWordIo ( FALSE, TRUE, TRUE, -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#108971): https://edk2.groups.io/g/devel/message/108971 Mute This Topic: https://groups.io/mt/101508459/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH v4 2/4] DynamicTablesPkg: Add support for simple method invocation.
I see you swapped the order of the functions, that looks good and avoids special handling for that case. That looks good to me. Thanks, Jeff From: Sami Mujawar Sent: Thursday, September 21, 2023 2:07 PM To: Jeff Brasen ; devel@edk2.groups.io Cc: Pierre Gondois ; Swatisri Kantamsetti ; Ashish Singhal ; nd Subject: Re: [PATCH v4 2/4] DynamicTablesPkg: Add support for simple method invocation. External email: Use caution opening links or attachments Hi Jeff, Yes, I recorded the integer node and data node creation. Regards, Sami Mujawar From: Jeff Brasen mailto:jbra...@nvidia.com>> Sent: 21 September 2023 18:38 To: Sami Mujawar mailto:sami.muja...@arm.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io> mailto:devel@edk2.groups.io>> Cc: Pierre Gondois mailto:pierre.gond...@arm.com>>; Swatisri Kantamsetti mailto:swatis...@nvidia.com>>; Ashish Singhal mailto:ashishsin...@nvidia.com>>; nd mailto:n...@arm.com>> Subject: RE: [PATCH v4 2/4] DynamicTablesPkg: Add support for simple method invocation. Only thing I see is if AmlCodeGenInteger fails we don't delete DataNode right? From: Sami Mujawar mailto:sami.muja...@arm.com>> Sent: Thursday, September 21, 2023 10:49 AM To: Jeff Brasen mailto:jbra...@nvidia.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io> Cc: pierre.gond...@arm.com<mailto:pierre.gond...@arm.com>; Swatisri Kantamsetti mailto:swatis...@nvidia.com>>; Ashish Singhal mailto:ashishsin...@nvidia.com>>; n...@arm.com<mailto:n...@arm.com> Subject: Re: [PATCH v4 2/4] DynamicTablesPkg: Add support for simple method invocation. External email: Use caution opening links or attachments Hi Jeff, Thank you for this patch. Please see my response inline marked [SAMI]. Regards, Sami Mujawar On 18/09/2023 04:46 pm, Jeff Brasen wrote: Add support to add Return objects via AML that pass a single integer argument to the named method. Signed-off-by: Jeff Brasen <mailto:jbra...@nvidia.com> --- .../Include/Library/AmlLib/AmlLib.h | 54 .../Common/AmlLib/CodeGen/AmlCodeGen.c| 244 ++ 2 files changed, 298 insertions(+) diff --git a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h index d201ae9499..b82c7a3ce8 100644 --- a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h +++ b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h @@ -1194,6 +1194,60 @@ AmlCodeGenMethodRetInteger ( OUT AML_OBJECT_NODE_HANDLE *NewObjectNodeOPTIONAL ); +/** AML code generation for a method returning a NameString that takes an +integer argument. + + AmlCodeGenMethodRetNameStringIntegerArgument ( +"MET0", "MET1", 1, TRUE, 3, 5, ParentNode, NewObjectNode +); + is equivalent of the following ASL code: +Method(MET0, 1, Serialized, 3) { + Return (MET1 (5)) +} + + The ASL parameters "ReturnType" and "ParameterTypes" are not asked + in this function. They are optional parameters in ASL. + + @param [in] MethodNameString The new Method's name. +Must be a NULL-terminated ASL NameString +e.g.: "MET0", "_SB.MET0", etc. +The input string is copied. + @param [in] ReturnedNameString The name of the object returned by the +method. Optional parameter, can be: + - NULL (ignored). + - A NULL-terminated ASL NameString. + e.g.: "MET0", "_SB.MET0", etc. + The input string is copied. + @param [in] NumArgs Number of arguments. +Must be 0 <= NumArgs <= 6. + @param [in] IsSerialized TRUE is equivalent to Serialized. +FALSE is equivalent to NotSerialized. +Default is NotSerialized in ASL spec. + @param [in] SyncLevelSynchronization level for the method. +Must be 0 <= SyncLevel <= 15. +Default is 0 in ASL. + @param [in] IntegerArgument Argument to pass to the NameString. + @param [in] ParentNode If provided, set ParentNode as the parent +of the node created. + @param [out] NewObjectNodeIf success, contains the created node. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARA
Re: [edk2-devel] [PATCH 1/1] DynamicTablesPkg/AmlLib: Define an enum for IsaRanges
Reviewed-by: Jeff Brasen > -Original Message- > From: pierre.gond...@arm.com > Sent: Friday, September 22, 2023 8:18 AM > To: devel@edk2.groups.io > Cc: Sami Mujawar ; Leif Lindholm > ; Jeff Brasen > Subject: [PATCH 1/1] DynamicTablesPkg/AmlLib: Define an enum for > IsaRanges > > External email: Use caution opening links or attachments > > > From: Pierre Gondois > > The IsaRange parameter in: > - AmlCodeGenRdDWordIo() > - AmlCodeGenRdQWordIo() > is an hard-coded value. Define an enum for IsarRanges and use it. > > Suggested-by: Leif Lindholm > Signed-off-by: Pierre Gondois > --- > .../Include/Library/AmlLib/AmlLib.h | 28 +++ > .../AcpiSsdtPcieLibArm/SsdtPcieGenerator.c| 2 +- > .../AmlLib/CodeGen/AmlResourceDataCodeGen.c | 28 +++ > 3 files changed, 27 insertions(+), 31 deletions(-) > > diff --git a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h > b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h > index 8e24cecdd77b..ce81f5876681 100644 > --- a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h > +++ b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h > @@ -59,6 +59,18 @@ typedef void *AML_DATA_NODE_HANDLE; > > #endif // AML_HANDLE > > +/** Enum for ISA Ranges. > + > + See ACPI 6.4 spec, s19.6.34 for more. > +*/ > +typedef enum { > + EAmlIsaRangeReserved = 0, ///< Reserved. > + EAmlIsaRangeNonIsaOnly, ///< NonIsaOnly. > + EAmlIsaRangeIsaOnly,///< IsaOnly. > + EAmlIsaRangeEntireRange,///< EntireRange. > + EAmlIsaRangeMax,///< Max. > +} EAML_ISA_RANGE; > + > /** Parse the definition block. > >The function parses the whole AML blob. It starts with the ACPI DSDT/SSDT > @@ -471,11 +483,7 @@ AmlUpdateRdQWord ( >@param [in] IsMinFixed Minimum address is fixed. >@param [in] IsMaxFixed Maximum address is fixed. >@param [in] IsPosDecode Decode parameter > - @param [in] IsaRangesPossible values are: > - 0-Reserved > - 1-NonISAOnly > - 2-ISAOnly > - 3-EntireRange > + @param [in] IsaRangesIsa Range. >@param [in] AddressGranularity Address granularity. >@param [in] AddressMinimum Minimum address. >@param [in] AddressMaximum Maximum address. > @@ -505,7 +513,7 @@ AmlCodeGenRdDWordIo ( >INBOOLEAN IsMinFixed, >INBOOLEAN IsMaxFixed, >INBOOLEAN IsPosDecode, > - INUINT8 IsaRanges, > + INEAML_ISA_RANGE IsaRanges, >INUINT32 AddressGranularity, >INUINT32 AddressMinimum, >INUINT32 AddressMaximum, > @@ -702,11 +710,7 @@ AmlCodeGenRdWordBusNumber ( >@param [in] IsMinFixed Minimum address is fixed. >@param [in] IsMaxFixed Maximum address is fixed. >@param [in] IsPosDecode Decode parameter > - @param [in] IsaRangesPossible values are: > - 0-Reserved > - 1-NonISAOnly > - 2-ISAOnly > - 3-EntireRange > + @param [in] IsaRangesIsa Range. >@param [in] AddressGranularity Address granularity. >@param [in] AddressMinimum Minimum address. >@param [in] AddressMaximum Maximum address. > @@ -736,7 +740,7 @@ AmlCodeGenRdQWordIo ( >INBOOLEAN IsMinFixed, >INBOOLEAN IsMaxFixed, >INBOOLEAN IsPosDecode, > - INUINT8 IsaRanges, > + INEAML_ISA_RANGE IsaRanges, >INUINT64 AddressGranularity, >INUINT64 AddressMinimum, >INUINT64 AddressMaximum, > diff --git > a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenera > tor.c > b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenera > tor.c > index 9ddaddc198fa..87b426ccfe07 100644 > --- > a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenera > tor.c > +++ > b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGener > +++ ator.c > @@ -545,7 +545,7 @@ GeneratePciCrs ( > TRUE, > TRUE, > IsPosDecode, > - 3, > + EAmlIsaRangeEntireRange, > 0, > AddrMapInfo->PciAddress, > AddrMapInfo->PciAddress + AddrMapInfo->AddressSize - 1, > diff -- > git > a/DynamicTable
Re: [edk2-devel] [PATCH v2 0/2] dp command without ACPI
Anything else needed on this to get it merged? Thanks, Jeff > -Original Message- > From: gaoliming > Sent: Tuesday, September 12, 2023 6:59 AM > To: Jeff Brasen ; devel@edk2.groups.io > Cc: jian.j.w...@intel.com; dandan...@intel.com; zhichao@intel.com > Subject: 回复: [PATCH v2 0/2] dp command without ACPI > > External email: Use caution opening links or attachments > > > For the change in MdeModulePkg, Reviewed-by: Liming Gao > > > > -邮件原件- > > 发件人: Jeff Brasen > > 发送时间: 2023年9月12日 4:39 > > 收件人: devel@edk2.groups.io > > 抄送: jian.j.w...@intel.com; gaolim...@byosoft.com.cn; > > dandan...@intel.com; zhichao@intel.com > > 主题: RE: [PATCH v2 0/2] dp command without ACPI > > > > > > Any additional thoughts/feedback on this patch series? > > > > Thanks, > > Jeff > > > > > > > -Original Message- > > > From: Jeff Brasen > > > Sent: Friday, June 30, 2023 11:30 AM > > > To: devel@edk2.groups.io > > > Cc: jian.j.w...@intel.com; gaolim...@byosoft.com.cn; > > dandan...@intel.com; > > > zhichao@intel.com; Jeff Brasen > > > Subject: [PATCH v2 0/2] dp command without ACPI > > > > > > Systems that do not boot with ACPI (system that use device tree for > > example) > > > can not use the shell dp command. This patch adds this to the > configuration > > > table so that dp command can get this without the FPDT table. > > > > > > I am open to other ways for this to be passed if desired (Installed > protocol, > > > handler of the status code, etc) but wanted to post this to at least > > > get thoughts on this. > > > > > > Change Log > > > v2 - Fix missing cast for IA32 builds > > > > > > -Jeff > > > > > > Jeff Brasen (2): > > > MdeModulePkg/DxeCorePerformanceLib: Install BPDT in config table > > > ShellPkg/Dp: Allow dp command to work without ACPI > > > > > > ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.inf| 1 + > > > .../DpDynamicCommand/DpDynamicCommand.inf | 1 + > > > .../DxeCorePerformanceLib/DxeCorePerformanceLib.c | 2 ++ > > > ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c | 11 > > - > > > -- > > > 4 files changed, 12 insertions(+), 3 deletions(-) > > > > > > -- > > > 2.25.1 > > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#109318): https://edk2.groups.io/g/devel/message/109318 Mute This Topic: https://groups.io/mt/101756432/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH] ArmPkg/ArmPsciMpServices Add EFI_NOT_READY return
Anything else needed on this to get it merged? Thanks, Jeff > -Original Message- > From: Ard Biesheuvel > Sent: Thursday, September 7, 2023 8:17 AM > To: devel@edk2.groups.io; Jeff Brasen > Cc: quic_llind...@quicinc.com; ardb+tianoc...@kernel.org; > rebe...@bsdio.com > Subject: Re: [edk2-devel] [PATCH] ArmPkg/ArmPsciMpServices Add > EFI_NOT_READY return > > External email: Use caution opening links or attachments > > > On Thu, 29 Jun 2023 at 22:47, Jeff Brasen via groups.io > wrote: > > > > Add EFI_NOT_READY return if the CPU can not be enabled if the > > processor is already on. > > > > This can occur in normal use if the CPU is still being turned off from > > a previous call when this is called again. > > > > Signed-off-by: Jeff Brasen > > Acked-by: Ard Biesheuvel > > I'll queue this up - thanks. > > > --- > > ArmPkg/Drivers/ArmPsciMpServicesDxe/ArmPsciMpServicesDxe.c | 4 > +++- > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > diff --git > > a/ArmPkg/Drivers/ArmPsciMpServicesDxe/ArmPsciMpServicesDxe.c > > b/ArmPkg/Drivers/ArmPsciMpServicesDxe/ArmPsciMpServicesDxe.c > > index f822a9877c..e7f4223513 100644 > > --- a/ArmPkg/Drivers/ArmPsciMpServicesDxe/ArmPsciMpServicesDxe.c > > +++ b/ArmPkg/Drivers/ArmPsciMpServicesDxe/ArmPsciMpServicesDxe.c > > @@ -103,7 +103,9 @@ DispatchCpu ( > > > >ArmCallSmc (&Args); > > > > - if (Args.Arg0 != ARM_SMC_PSCI_RET_SUCCESS) { > > + if (Args.Arg0 == ARM_SMC_PSCI_RET_ALREADY_ON) { > > +Status = EFI_NOT_READY; > > + } else if (Args.Arg0 != ARM_SMC_PSCI_RET_SUCCESS) { > > DEBUG ((DEBUG_ERROR, "PSCI_CPU_ON call failed: %d\n", Args.Arg0)); > > Status = EFI_DEVICE_ERROR; > >} > > -- > > 2.25.1 > > > > > > > > > > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#109319): https://edk2.groups.io/g/devel/message/109319 Mute This Topic: https://groups.io/mt/99859167/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH] MdeModulePkg/DxeCore: Allow relocation of images with large address
Anyone have any thoughts on this patch? Thanks, Jeff > -Original Message- > From: Jeff Brasen > Sent: Monday, September 11, 2023 2:14 PM > To: devel@edk2.groups.io > Cc: jian.j.w...@intel.com; gaolim...@byosoft.com.cn; > dandan...@intel.com; Ashish Singhal > Subject: RE: [PATCH] MdeModulePkg/DxeCore: Allow relocation of images > with large address > > Any thoughts/feedback on this patch? > > Thanks, > Jeff > > > > -Original Message- > > From: Jeff Brasen > > Sent: Monday, May 15, 2023 5:49 PM > > To: devel@edk2.groups.io > > Cc: jian.j.w...@intel.com; gaolim...@byosoft.com.cn; > > dandan...@intel.com; Jeff Brasen ; Ashish Singhal > > > > Subject: [PATCH] MdeModulePkg/DxeCore: Allow relocation of images > with > > large address > > > > Add PCD to control if modules with start addresses in PE/COFF > > > 0x10 attempt to load at specified address. > > If a module has an address in this range and there is untested memory > > DxeCore will attempt to promote all memory to tested which bypasses > > any memory testing that would occur later in boot. > > > > There are several existing AARCH64 option roms that have base > > addresses of 0x18000. > > > > Signed-off-by: Jeff Brasen > > Reviewed-by: Ashish Singhal > > --- > > MdeModulePkg/Core/Dxe/DxeMain.inf | 1 + > > MdeModulePkg/Core/Dxe/Image/Image.c | 4 +++- > > MdeModulePkg/MdeModulePkg.dec | 7 +++ > > 3 files changed, 11 insertions(+), 1 deletion(-) > > > > diff --git a/MdeModulePkg/Core/Dxe/DxeMain.inf > > b/MdeModulePkg/Core/Dxe/DxeMain.inf > > index 35d5bf0dee..16871f2021 100644 > > --- a/MdeModulePkg/Core/Dxe/DxeMain.inf > > +++ b/MdeModulePkg/Core/Dxe/DxeMain.inf > > @@ -187,6 +187,7 @@ > >gEfiMdeModulePkgTokenSpaceGuid.PcdHeapGuardPropertyMask > > ## CONSUMES > >gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard > > ## > > CONSUMES > > > gEfiMdeModulePkgTokenSpaceGuid.PcdFwVolDxeMaxEncapsulationDepth > > ## CONSUMES > > + gEfiMdeModulePkgTokenSpaceGuid.PcdImageLargeAddressLoad > > ## CONSUMES > > > > # [Hob] > > # RESOURCE_DESCRIPTOR ## CONSUMES > > diff --git a/MdeModulePkg/Core/Dxe/Image/Image.c > > b/MdeModulePkg/Core/Dxe/Image/Image.c > > index 9dbfb2a1fa..6bc3a549ae 100644 > > --- a/MdeModulePkg/Core/Dxe/Image/Image.c > > +++ b/MdeModulePkg/Core/Dxe/Image/Image.c > > @@ -680,7 +680,9 @@ CoreLoadPeImage ( > > ); > >} > > } else { > > - if ((Image->ImageContext.ImageAddress >= 0x10) || Image- > > >ImageContext.RelocationsStripped) { > > + if ((PcdGetBool (PcdImageLargeAddressLoad) && ((Image- > > >ImageContext.ImageAddress) >= 0x10)) || > > + Image->ImageContext.RelocationsStripped) > > + { > > Status = CoreAllocatePages ( > > AllocateAddress, > > (EFI_MEMORY_TYPE)(Image- > > >ImageContext.ImageCodeMemoryType), > > diff --git a/MdeModulePkg/MdeModulePkg.dec > > b/MdeModulePkg/MdeModulePkg.dec index 95dd077e19..6fd1bd7b8f > > 100644 > > --- a/MdeModulePkg/MdeModulePkg.dec > > +++ b/MdeModulePkg/MdeModulePkg.dec > > @@ -1116,6 +1116,13 @@ > ># @Prompt Output MMIO address of Trace Hub message. > > > > > gEfiMdeModulePkgTokenSpaceGuid.PcdTraceHubDebugMmioAddress|0|UI > N > > T64|0x30001058 > > > > + ## Indicates if images with large load address (>0x10) should > > attempted to load at specified location. > > + # If enabled, attempt to allocate at specfied location will be > > + attempted with > > a fall back to any address. > > + # TRUE - UEFI will attempt to load at specified location. > > + # FALSE - UEFI will load at any address > > + # @Prompt Enable large address image loading. > > + > > + > > > gEfiMdeModulePkgTokenSpaceGuid.PcdImageLargeAddressLoad|TRUE|BO > OL > > EAN|0 > > + x30001059 > > + > > [PcdsFixedAtBuild, PcdsPatchableInModule] > >## Dynamic type PCD can be registered callback function for Pcd > > setting action. > ># PcdMaxPeiPcdCallBackNumberPerPcdEntry indicates the maximum > > number of callback function > > -- > > 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#109320): https://edk2.groups.io/g/devel/message/109320 Mute This Topic: https://groups.io/mt/98916659/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH] MdeModulePkg/DxeCore: Allow relocation of images with large address
Anything else needed to get this merged would as the November stable release is coming up. Thanks, Jeff > -Original Message- > From: gaoliming > Sent: Friday, October 6, 2023 11:23 PM > To: Jeff Brasen ; devel@edk2.groups.io > Cc: jian.j.w...@intel.com; dandan...@intel.com; Ashish Singhal > ; michael.d.kin...@intel.com > Subject: 回复: [PATCH] MdeModulePkg/DxeCore: Allow relocation of > images with large address > > External email: Use caution opening links or attachments > > > Jeff: > I have no better solution than your proposal for this problem. So, this > patch > is good to me. Reviewed-by: Liming Gao > > Thanks > Liming > > -邮件原件- > > 发件人: Jeff Brasen > > 发送时间: 2023年9月12日 4:14 > > 收件人: devel@edk2.groups.io > > 抄送: jian.j.w...@intel.com; gaolim...@byosoft.com.cn; > > dandan...@intel.com; Ashish Singhal > > 主题: RE: [PATCH] MdeModulePkg/DxeCore: Allow relocation of images > with > > large address > > > > Any thoughts/feedback on this patch? > > > > Thanks, > > Jeff > > > > > > > -Original Message- > > > From: Jeff Brasen > > > Sent: Monday, May 15, 2023 5:49 PM > > > To: devel@edk2.groups.io > > > Cc: jian.j.w...@intel.com; gaolim...@byosoft.com.cn; > > dandan...@intel.com; > > > Jeff Brasen ; Ashish Singhal > > > > > > Subject: [PATCH] MdeModulePkg/DxeCore: Allow relocation of images > > > with large address > > > > > > Add PCD to control if modules with start addresses in PE/COFF > > > > 0x10 attempt to load at specified address. > > > If a module has an address in this range and there is untested > > > memory DxeCore will attempt to promote all memory to tested which > > > bypasses any memory testing that would occur later in boot. > > > > > > There are several existing AARCH64 option roms that have base > > > addresses > > of > > > 0x18000. > > > > > > Signed-off-by: Jeff Brasen > > > Reviewed-by: Ashish Singhal > > > --- > > > MdeModulePkg/Core/Dxe/DxeMain.inf | 1 + > > > MdeModulePkg/Core/Dxe/Image/Image.c | 4 +++- > > > MdeModulePkg/MdeModulePkg.dec | 7 +++ > > > 3 files changed, 11 insertions(+), 1 deletion(-) > > > > > > diff --git a/MdeModulePkg/Core/Dxe/DxeMain.inf > > > b/MdeModulePkg/Core/Dxe/DxeMain.inf > > > index 35d5bf0dee..16871f2021 100644 > > > --- a/MdeModulePkg/Core/Dxe/DxeMain.inf > > > +++ b/MdeModulePkg/Core/Dxe/DxeMain.inf > > > @@ -187,6 +187,7 @@ > > >gEfiMdeModulePkgTokenSpaceGuid.PcdHeapGuardPropertyMask > > > ## CONSUMES > > >gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard > > ## > > > CONSUMES > > > > > > gEfiMdeModulePkgTokenSpaceGuid.PcdFwVolDxeMaxEncapsulationDepth > > > ## CONSUMES > > > + gEfiMdeModulePkgTokenSpaceGuid.PcdImageLargeAddressLoad > > > ## CONSUMES > > > > > > # [Hob] > > > # RESOURCE_DESCRIPTOR ## CONSUMES > > > diff --git a/MdeModulePkg/Core/Dxe/Image/Image.c > > > b/MdeModulePkg/Core/Dxe/Image/Image.c > > > index 9dbfb2a1fa..6bc3a549ae 100644 > > > --- a/MdeModulePkg/Core/Dxe/Image/Image.c > > > +++ b/MdeModulePkg/Core/Dxe/Image/Image.c > > > @@ -680,7 +680,9 @@ CoreLoadPeImage ( > > > ); > > >} > > > } else { > > > - if ((Image->ImageContext.ImageAddress >= 0x10) || Image- > > > >ImageContext.RelocationsStripped) { > > > + if ((PcdGetBool (PcdImageLargeAddressLoad) && ((Image- > > > >ImageContext.ImageAddress) >= 0x10)) || > > > + Image->ImageContext.RelocationsStripped) > > > + { > > > Status = CoreAllocatePages ( > > > AllocateAddress, > > > (EFI_MEMORY_TYPE)(Image- > > > >ImageContext.ImageCodeMemoryType), > > > diff --git a/MdeModulePkg/MdeModulePkg.dec > > > b/MdeModulePkg/MdeModulePkg.dec index 95dd077e19..6fd1bd7b8f > > > 100644 > > > --- a/MdeModulePkg/MdeModulePkg.dec > > > +++ b/MdeModulePkg/MdeModulePkg.dec > > > @@ -1116,6 +1116,13 @@ > > ># @Prompt Output MMIO address of Trace Hub message. > > > > > > > > > gEfiMdeModulePkgTokenSpaceGuid.PcdTraceHubDebugMmioAddress|0|UI > N > > > T64|0x30001058 > > > > > > + ## Indicates if images with large load address
Re: [edk2-devel] [PATCH v2 0/2] dp command without ACPI
Anything else needed to get this merged as the November stable release is coming up. Thanks, Jeff > -Original Message- > From: Gao, Zhichao > Sent: Monday, October 16, 2023 8:39 PM > To: Jeff Brasen ; Gao, Liming > ; devel@edk2.groups.io > Cc: Wang, Jian J ; Bi, Dandan > > Subject: RE: [PATCH v2 0/2] dp command without ACPI > > External email: Use caution opening links or attachments > > > Hi Liming, > > This patch set is already reviewed. Can you help on the merge? > > Thanks, > Zhichao > > > -Original Message- > > From: Jeff Brasen > > Sent: Wednesday, October 4, 2023 10:37 PM > > To: Gao, Liming ; devel@edk2.groups.io > > Cc: Wang, Jian J ; Bi, Dandan > > ; Gao, Zhichao > > Subject: RE: [PATCH v2 0/2] dp command without ACPI > > > > Anything else needed on this to get it merged? > > > > Thanks, > > Jeff > > > > > -Original Message- > > > From: gaoliming > > > Sent: Tuesday, September 12, 2023 6:59 AM > > > To: Jeff Brasen ; devel@edk2.groups.io > > > Cc: jian.j.w...@intel.com; dandan...@intel.com; > > > zhichao@intel.com > > > Subject: 回复: [PATCH v2 0/2] dp command without ACPI > > > > > > External email: Use caution opening links or attachments > > > > > > > > > For the change in MdeModulePkg, Reviewed-by: Liming Gao > > > > > > > > > > -邮件原件- > > > > 发件人: Jeff Brasen > > > > 发送时间: 2023年9月12日 4:39 > > > > 收件人: devel@edk2.groups.io > > > > 抄送: jian.j.w...@intel.com; gaolim...@byosoft.com.cn; > > > > dandan...@intel.com; zhichao@intel.com > > > > 主题: RE: [PATCH v2 0/2] dp command without ACPI > > > > > > > > > > > > Any additional thoughts/feedback on this patch series? > > > > > > > > Thanks, > > > > Jeff > > > > > > > > > > > > > -Original Message- > > > > > From: Jeff Brasen > > > > > Sent: Friday, June 30, 2023 11:30 AM > > > > > To: devel@edk2.groups.io > > > > > Cc: jian.j.w...@intel.com; gaolim...@byosoft.com.cn; > > > > dandan...@intel.com; > > > > > zhichao@intel.com; Jeff Brasen > > > > > Subject: [PATCH v2 0/2] dp command without ACPI > > > > > > > > > > Systems that do not boot with ACPI (system that use device tree > > > > > for > > > > example) > > > > > can not use the shell dp command. This patch adds this to the > > > configuration > > > > > table so that dp command can get this without the FPDT table. > > > > > > > > > > I am open to other ways for this to be passed if desired > > > > > (Installed > > > protocol, > > > > > handler of the status code, etc) but wanted to post this to at > > > > > least get thoughts on this. > > > > > > > > > > Change Log > > > > > v2 - Fix missing cast for IA32 builds > > > > > > > > > > -Jeff > > > > > > > > > > Jeff Brasen (2): > > > > > MdeModulePkg/DxeCorePerformanceLib: Install BPDT in config > table > > > > > ShellPkg/Dp: Allow dp command to work without ACPI > > > > > > > > > > ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.inf| 1 + > > > > > .../DpDynamicCommand/DpDynamicCommand.inf | 1 + > > > > > .../DxeCorePerformanceLib/DxeCorePerformanceLib.c | 2 ++ > > > > > ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c | 11 > > > > - > > > > > -- > > > > > 4 files changed, 12 insertions(+), 3 deletions(-) > > > > > > > > > > -- > > > > > 2.25.1 > > > > > > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#110334): https://edk2.groups.io/g/devel/message/110334 Mute This Topic: https://groups.io/mt/101756432/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH] ArmPkg/ArmPsciMpServices Add EFI_NOT_READY return
Add EFI_NOT_READY return if the CPU can not be enabled if the processor is already on. This can occur in normal use if the CPU is still being turned off from a previous call when this is called again. Signed-off-by: Jeff Brasen --- ArmPkg/Drivers/ArmPsciMpServicesDxe/ArmPsciMpServicesDxe.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ArmPkg/Drivers/ArmPsciMpServicesDxe/ArmPsciMpServicesDxe.c b/ArmPkg/Drivers/ArmPsciMpServicesDxe/ArmPsciMpServicesDxe.c index f822a9877c..e7f4223513 100644 --- a/ArmPkg/Drivers/ArmPsciMpServicesDxe/ArmPsciMpServicesDxe.c +++ b/ArmPkg/Drivers/ArmPsciMpServicesDxe/ArmPsciMpServicesDxe.c @@ -103,7 +103,9 @@ DispatchCpu ( ArmCallSmc (&Args); - if (Args.Arg0 != ARM_SMC_PSCI_RET_SUCCESS) { + if (Args.Arg0 == ARM_SMC_PSCI_RET_ALREADY_ON) { +Status = EFI_NOT_READY; + } else if (Args.Arg0 != ARM_SMC_PSCI_RET_SUCCESS) { DEBUG ((DEBUG_ERROR, "PSCI_CPU_ON call failed: %d\n", Args.Arg0)); Status = EFI_DEVICE_ERROR; } -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#106531): https://edk2.groups.io/g/devel/message/106531 Mute This Topic: https://groups.io/mt/99859167/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH] MdeModulePkg/PciHostBridge: Add support for driver binding
If the platform does not support any PCIe devices using the library method allow devices to connect to host bridge via driver binding. Signed-off-by: Jeff Brasen --- .../Bus/Pci/PciHostBridgeDxe/PciHostBridge.c | 649 ++ .../Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf | 1 + .../Bus/Pci/PciHostBridgeDxe/PciRootBridge.h | 13 + .../Pci/PciHostBridgeDxe/PciRootBridgeIo.c| 24 + MdeModulePkg/MdeModulePkg.dec | 4 + 5 files changed, 562 insertions(+), 129 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridge.c b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridge.c index d573e532ba..506c6660ae 100644 --- a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridge.c +++ b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridge.c @@ -422,167 +422,320 @@ IoMmuProtocolCallback ( } /** + PCI Root Bridge Memory setup. - Entry point of this driver. + @param RootBridgeRoot Bridge instance. - @param ImageHandle Image handle of this driver. - @param SystemTable Pointer to standard EFI system table. - - @retval EFI_SUCCESS Succeed. - @retval EFI_DEVICE_ERROR Fail to install PCI_ROOT_BRIDGE_IO protocol. + @retval EFI_SUCCESS Memory was setup correctly + @retval othersError in setup **/ EFI_STATUS EFIAPI -InitializePciHostBridge ( - IN EFI_HANDLEImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable +PciRootBridgeMemorySetup ( + IN PCI_ROOT_BRIDGE *RootBridge ) { EFI_STATUSStatus; - PCI_HOST_BRIDGE_INSTANCE *HostBridge; - PCI_ROOT_BRIDGE_INSTANCE *RootBridge; - PCI_ROOT_BRIDGE *RootBridges; - UINTN RootBridgeCount; - UINTN Index; + UINT64HostAddress; PCI_ROOT_BRIDGE_APERTURE *MemApertures[4]; UINTN MemApertureIndex; - BOOLEAN ResourceAssigned; - LIST_ENTRY*Link; - UINT64HostAddress; - RootBridges = PciHostBridgeGetRootBridges (&RootBridgeCount); - if ((RootBridges == NULL) || (RootBridgeCount == 0)) { -return EFI_UNSUPPORTED; - } - - Status = gBS->LocateProtocol (&gEfiCpuIo2ProtocolGuid, NULL, (VOID **)&mCpuIo); - ASSERT_EFI_ERROR (Status); - - // - // Most systems in the world including complex servers have only one Host Bridge. - // - HostBridge = AllocateZeroPool (sizeof (PCI_HOST_BRIDGE_INSTANCE)); - ASSERT (HostBridge != NULL); - - HostBridge->Signature= PCI_HOST_BRIDGE_SIGNATURE; - HostBridge->CanRestarted = TRUE; - InitializeListHead (&HostBridge->RootBridges); - ResourceAssigned = FALSE; - - // - // Create Root Bridge Device Handle in this Host Bridge - // - for (Index = 0; Index < RootBridgeCount; Index++) { + if (RootBridge->Io.Base <= RootBridge->Io.Limit) { // -// Create Root Bridge Handle Instance +// Base and Limit in PCI_ROOT_BRIDGE_APERTURE are device address. +// For GCD resource manipulation, we need to use host address. // -RootBridge = CreateRootBridge (&RootBridges[Index]); -ASSERT (RootBridge != NULL); -if (RootBridge == NULL) { - continue; +HostAddress = TO_HOST_ADDRESS ( +RootBridge->Io.Base, +RootBridge->Io.Translation +); + +Status = AddIoSpace ( + HostAddress, + RootBridge->Io.Limit - RootBridge->Io.Base + 1 + ); +ASSERT_EFI_ERROR (Status); +if (EFI_ERROR (Status)) { + return Status; } -// -// Make sure all root bridges share the same ResourceAssigned value. -// -if (Index == 0) { - ResourceAssigned = RootBridges[Index].ResourceAssigned; -} else { - ASSERT (ResourceAssigned == RootBridges[Index].ResourceAssigned); +if (RootBridge->ResourceAssigned) { + Status = gDS->AllocateIoSpace ( + EfiGcdAllocateAddress, + EfiGcdIoTypeIo, + 0, + RootBridge->Io.Limit - RootBridge->Io.Base + 1, + &HostAddress, + gImageHandle, + NULL + ); + ASSERT_EFI_ERROR (Status); + if (EFI_ERROR (Status)) { +return Status; + } } + } + + // + // Add all the Mem/PMem aperture to GCD + // Mem/PMem shouldn't overlap with each other + // Root bridge which needs to combine MEM and PMEM should only report + // the MEM aperture in Mem + // + MemApertures[0] = &RootBridge->Mem; + MemApertures[1] = &RootBridge->MemAbove4G; + MemApertures[2] = &RootBridge->PMem; + MemApertures[3] = &RootBridge->PMemAbove4G; -if (RootBridges[Inde
[edk2-devel] [PATCH 2/2] ShellPkg/Dp: Allow dp command to work without ACPI
If the system does not have ACPI setup use the configuration table to get the performance info. Signed-off-by: Jeff Brasen --- ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c | 11 --- ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.inf| 1 + .../DpDynamicCommand/DpDynamicCommand.inf | 1 + 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c b/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c index 512a146da6..98c84d2ef9 100644 --- a/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c +++ b/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c @@ -129,17 +129,22 @@ EFI_STATUS GetBootPerformanceTable ( ) { + EFI_STATUS Status; FIRMWARE_PERFORMANCE_TABLE *FirmwarePerformanceTable; FirmwarePerformanceTable = (FIRMWARE_PERFORMANCE_TABLE *)EfiLocateFirstAcpiTable ( EFI_ACPI_5_0_FIRMWARE_PERFORMANCE_DATA_TABLE_SIGNATURE ); if (FirmwarePerformanceTable == NULL) { -ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_GET_ACPI_FPDT_FAIL), mDpHiiHandle); -return EFI_NOT_FOUND; +Status = EfiGetSystemConfigurationTable (&gEdkiiFpdtExtendedFirmwarePerformanceGuid, (VOID **)&mBootPerformanceTable); +if (EFI_ERROR (Status)) { + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_GET_ACPI_FPDT_FAIL), mDpHiiHandle); + return EFI_NOT_FOUND; +} + } else { +mBootPerformanceTable = (UINT8 *)(UINTN)FirmwarePerformanceTable->BootPointerRecord.BootPerformanceTablePointer; } - mBootPerformanceTable = (UINT8 *)(UINTN)FirmwarePerformanceTable->BootPointerRecord.BootPerformanceTablePointer; mBootPerformanceTableSize = ((BOOT_PERFORMANCE_TABLE *)mBootPerformanceTable)->Header.Length; return EFI_SUCCESS; diff --git a/ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.inf b/ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.inf index 4a58286b8c..d9e1c23a1e 100644 --- a/ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.inf +++ b/ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.inf @@ -54,6 +54,7 @@ [Guids] gPerformanceProtocolGuid## CONSUMES ## SystemTable + gEdkiiFpdtExtendedFirmwarePerformanceGuid ## CONSUMES ## SystemTable [Protocols] gEfiLoadedImageProtocolGuid ## CONSUMES diff --git a/ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.inf b/ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.inf index 013bdbd4a0..2723fee706 100644 --- a/ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.inf +++ b/ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.inf @@ -55,6 +55,7 @@ [Guids] gPerformanceProtocolGuid## CONSUMES ## SystemTable + gEdkiiFpdtExtendedFirmwarePerformanceGuid ## CONSUMES ## SystemTable [Protocols] gEfiLoadedImageProtocolGuid ## CONSUMES -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#106533): https://edk2.groups.io/g/devel/message/106533 Mute This Topic: https://groups.io/mt/99859554/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH 1/2] MdeModulePkg/DxeCorePerformanceLib: Install BPDT in config table
Install the performance table into the UEFI configuration table. This will allow the shell application to get this if the system is not using ACPI. Signed-off-by: Jeff Brasen --- .../Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c index ef14bc0738..e72b04794a 100644 --- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c +++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c @@ -1403,6 +1403,8 @@ ReportFpdtRecordBuffer ( &BPDTAddr, sizeof (UINT64) ); + Status = gBS->InstallConfigurationTable (&gEdkiiFpdtExtendedFirmwarePerformanceGuid, (VOID *)BPDTAddr); + ASSERT_EFI_ERROR (Status); } // -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#106535): https://edk2.groups.io/g/devel/message/106535 Mute This Topic: https://groups.io/mt/99859556/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH 0/2] dp command without ACPI
Systems that do not boot with ACPI (system that use device tree for example) can not use the shell dp command. This patch adds this to the configuration table so that dp command can get this without the FPDT table. I am open to other ways for this to be passed if desired (Installed protocol, handler of the status code, etc) but wanted to post this to at least get thoughts on this. -Jeff Jeff Brasen (2): MdeModulePkg/DxeCorePerformanceLib: Install BPDT in config table ShellPkg/Dp: Allow dp command to work without ACPI .../DxeCorePerformanceLib/DxeCorePerformanceLib.c | 2 ++ ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c | 11 --- ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.inf| 1 + .../DpDynamicCommand/DpDynamicCommand.inf | 1 + 4 files changed, 12 insertions(+), 3 deletions(-) -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#106534): https://edk2.groups.io/g/devel/message/106534 Mute This Topic: https://groups.io/mt/99859555/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH 0/4] Add support for generating ACPI ThermalZones
Add APIs needed to create thermal zones dynamically. Does not add a generator for this as creating the TMP method generically may be difficult. Jeff Brasen (4): DynamicTablesPkg: Add ThermalZone CodeGen function DynamicTablesPkg: Add support for simple method invocation. DynamicTablesPkg: Add support to add Strings to package DynamicTablesPkg: Add Aml NameUnicodeString API .../Include/Library/AmlLib/AmlLib.h | 130 + .../Common/AmlLib/CodeGen/AmlCodeGen.c| 508 ++ 2 files changed, 638 insertions(+) -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#106540): https://edk2.groups.io/g/devel/message/106540 Mute This Topic: https://groups.io/mt/99861336/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH 1/4] DynamicTablesPkg: Add ThermalZone CodeGen function
Add API to generate a ThermalZone object to AmlLib. Signed-off-by: Jeff Brasen Reviewed-by: Swatisri Kantamsetti Reviewed-by: Ashish Singhal --- .../Include/Library/AmlLib/AmlLib.h | 28 + .../Common/AmlLib/CodeGen/AmlCodeGen.c| 116 ++ 2 files changed, 144 insertions(+) diff --git a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h index 9210c50915..d201ae9499 100644 --- a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h +++ b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h @@ -1038,6 +1038,34 @@ AmlCodeGenDevice ( OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL ); +/** AML code generation for a ThermalZone object node. + + AmlCodeGenThermalZone ("TZ00", ParentNode, NewObjectNode) is + equivalent of the following ASL code: +ThermalZone(TZ00) {} + + @ingroup CodeGenApis + + @param [in] NameString The new ThermalZone's name. + Must be a NULL-terminated ASL NameString + e.g.: "DEV0", "DV15.DEV0", etc. + The input string is copied. + @param [in] ParentNode If provided, set ParentNode as the parent + of the node created. + @param [out] NewObjectNode If success, contains the created node. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCESFailed to allocate memory. +**/ +EFI_STATUS +EFIAPI +AmlCodeGenThermalZone ( + IN CONST CHAR8 *NameString, + INAML_NODE_HANDLE ParentNode OPTIONAL, + OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL + ); + /** AML code generation for a Scope object node. AmlCodeGenScope ("_SB", ParentNode, NewObjectNode) is diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c index 0b223379fa..88537b7e2d 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c @@ -1218,6 +1218,122 @@ error_handler1: return Status; } +/** AML code generation for a ThermalZone object node. + + AmlCodeGenThermalZone ("TZ00", ParentNode, NewObjectNode) is + equivalent of the following ASL code: +ThermalZone(TZ00) {} + + @ingroup CodeGenApis + + @param [in] NameString The new ThermalZone's name. + Must be a NULL-terminated ASL NameString + e.g.: "DEV0", "DV15.DEV0", etc. + The input string is copied. + @param [in] ParentNode If provided, set ParentNode as the parent + of the node created. + @param [out] NewObjectNode If success, contains the created node. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCESFailed to allocate memory. +**/ +EFI_STATUS +EFIAPI +AmlCodeGenThermalZone ( + IN CONST CHAR8 *NameString, + INAML_NODE_HANDLE ParentNode OPTIONAL, + OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL + ) +{ + EFI_STATUS Status; + AML_OBJECT_NODE *ObjectNode; + AML_DATA_NODE*DataNode; + CHAR8*AmlNameString; + UINT32 AmlNameStringSize; + + if ((NameString == NULL) || + ((ParentNode == NULL) && (NewObjectNode == NULL))) + { +ASSERT (0); +return EFI_INVALID_PARAMETER; + } + + ObjectNode= NULL; + DataNode = NULL; + AmlNameString = NULL; + + Status = ConvertAslNameToAmlName (NameString, &AmlNameString); + if (EFI_ERROR (Status)) { +ASSERT (0); +return Status; + } + + Status = AmlGetNameStringSize (AmlNameString, &AmlNameStringSize); + if (EFI_ERROR (Status)) { +ASSERT (0); +goto error_handler1; + } + + Status = AmlCreateObjectNode ( + AmlGetByteEncodingByOpCode (AML_EXT_OP, AML_EXT_THERMAL_ZONE_OP), + AmlNameStringSize + AmlComputePkgLengthWidth (AmlNameStringSize), + &ObjectNode + ); + if (EFI_ERROR (Status)) { +ASSERT (0); +goto error_handler1; + } + + Status = AmlCreateDataNode ( + EAmlNodeDataTypeNameString, + (UINT8 *)AmlNameString, + AmlNameStringSize, + &DataNode + ); + if (EFI_ERROR (Status)) { +ASSERT (0); +goto error_handler2; + } + + Status = AmlSetFixedArgument ( + ObjectNode, + EAmlParseIndexTerm0, + (AML_NODE_HEADER *)DataNode + ); + if (EFI_ERROR (Status)) { +ASSER
[edk2-devel] [PATCH 2/4] DynamicTablesPkg: Add support for simple method invocation.
Add support to add Return objects via AML that pass a single integer argument to the named method. Signed-off-by: Jeff Brasen Reviewed-by: Swatisri Kantamsetti Reviewed-by: Ashish Singhal --- .../Include/Library/AmlLib/AmlLib.h | 54 + .../Common/AmlLib/CodeGen/AmlCodeGen.c| 224 ++ 2 files changed, 278 insertions(+) diff --git a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h index d201ae9499..b82c7a3ce8 100644 --- a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h +++ b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h @@ -1194,6 +1194,60 @@ AmlCodeGenMethodRetInteger ( OUT AML_OBJECT_NODE_HANDLE *NewObjectNodeOPTIONAL ); +/** AML code generation for a method returning a NameString that takes an +integer argument. + + AmlCodeGenMethodRetNameStringIntegerArgument ( +"MET0", "MET1", 1, TRUE, 3, 5, ParentNode, NewObjectNode +); + is equivalent of the following ASL code: +Method(MET0, 1, Serialized, 3) { + Return (MET1 (5)) +} + + The ASL parameters "ReturnType" and "ParameterTypes" are not asked + in this function. They are optional parameters in ASL. + + @param [in] MethodNameString The new Method's name. +Must be a NULL-terminated ASL NameString +e.g.: "MET0", "_SB.MET0", etc. +The input string is copied. + @param [in] ReturnedNameString The name of the object returned by the +method. Optional parameter, can be: + - NULL (ignored). + - A NULL-terminated ASL NameString. + e.g.: "MET0", "_SB.MET0", etc. + The input string is copied. + @param [in] NumArgs Number of arguments. +Must be 0 <= NumArgs <= 6. + @param [in] IsSerialized TRUE is equivalent to Serialized. +FALSE is equivalent to NotSerialized. +Default is NotSerialized in ASL spec. + @param [in] SyncLevelSynchronization level for the method. +Must be 0 <= SyncLevel <= 15. +Default is 0 in ASL. + @param [in] IntegerArgument Argument to pass to the NameString. + @param [in] ParentNode If provided, set ParentNode as the parent +of the node created. + @param [out] NewObjectNodeIf success, contains the created node. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCESFailed to allocate memory. +**/ +EFI_STATUS +EFIAPI +AmlCodeGenMethodRetNameStringIntegerArgument ( + IN CONST CHAR8 *MethodNameString, + IN CONST CHAR8 *ReturnedNameString OPTIONAL, + INUINT8 NumArgs, + INBOOLEAN IsSerialized, + INUINT8 SyncLevel, + INUINT64 IntegerArgument, + INAML_NODE_HANDLE ParentNode OPTIONAL, + OUT AML_OBJECT_NODE_HANDLE *NewObjectNodeOPTIONAL + ); + /** Create a _LPI name. AmlCreateLpiNode ("_LPI", 0, 1, ParentNode, &LpiNode) is diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c index 88537b7e2d..2b95839e4c 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c @@ -1881,6 +1881,118 @@ AmlCodeGenReturnInteger ( return Status; } +/** AML code generation for a Return object node, +returning the object as an input NameString with a integer argument. + + AmlCodeGenReturn ("NAM1", 6, ParentNode, NewObjectNode) is + equivalent of the following ASL code: +Return(NAM1 (6)) + + The ACPI 6.3 specification, s20.2.5.3 "Type 1 Opcodes Encoding" states: +DefReturn := ReturnOp ArgObject +ReturnOp := 0xA4 +ArgObject := TermArg => DataRefObject + + Thus, the ReturnNode must be evaluated as a DataRefObject. It can + be a NameString referencing an object. As this CodeGen Api doesn't + do semantic checking, it is strongly advised to check the AML bytecode + generated by this function against an ASL compiler. + + The ReturnNode must be generated inside a Method body scope. + + @param [in] NameString The object referenced by this NameString +
[edk2-devel] [PATCH 4/4] DynamicTablesPkg: Add Aml NameUnicodeString API
Add API to generate a Name that contains a Unicode string buffer. Change-Id: I0116b2921cbbbecc3420ff7a42a7ab6e01852534 Reviewed-by: Swatisri Kantamsetti Reviewed-by: Ashish Singhal --- .../Include/Library/AmlLib/AmlLib.h | 31 +++ .../Common/AmlLib/CodeGen/AmlCodeGen.c| 86 +++ 2 files changed, 117 insertions(+) diff --git a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h index 043e7ee901..5150aa4870 100644 --- a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h +++ b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h @@ -958,6 +958,37 @@ AmlCodeGenNameResourceTemplate ( OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL ); +/** AML code generation for a Name object node, containing a String. + + AmlCodeGenNameUnicodeString ("_STR", L"String", ParentNode, NewObjectNode) is + equivalent of the following ASL code: +Name(_STR, Unicode ("String")) + + @ingroup CodeGenApis + + @param [in] NameString The new variable name. + Must be a NULL-terminated ASL NameString + e.g.: "DEV0", "DV15.DEV0", etc. + The input string is copied. + @param [in] String NULL terminated Unicode String to associate to the + NameString. + @param [in] ParentNode If provided, set ParentNode as the parent + of the node created. + @param [out] NewObjectNode If success, contains the created node. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCESFailed to allocate memory. +**/ +EFI_STATUS +EFIAPI +AmlCodeGenNameUnicodeString ( + IN CONST CHAR8 *NameString, + INCHAR16 *String, + INAML_NODE_HANDLE ParentNode OPTIONAL, + OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL + ); + /** Add a _PRT entry. AmlCodeGenPrtEntry (0x0, 0, "LNKA", 0, PrtNameNode) is diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c index a0d01032d5..20ddad031d 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c @@ -869,6 +869,92 @@ AmlCodeGenNameResourceTemplate ( return Status; } +/** AML code generation for a Name object node, containing a String. + + AmlCodeGenNameUnicodeString ("_STR", L"String", ParentNode, NewObjectNode) is + equivalent of the following ASL code: + Name(_STR, Unicode ("String")) + + @ingroup CodeGenApis + + @param [in] NameString The new variable name. + Must be a NULL-terminated ASL NameString + e.g.: "DEV0", "DV15.DEV0", etc. + The input string is copied. + @param [in] String NULL terminated Unicode String to associate to the + NameString. + @param [in] ParentNode If provided, set ParentNode as the parent + of the node created. + @param [out] NewObjectNode If success, contains the created node. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCESFailed to allocate memory. +**/ +EFI_STATUS +EFIAPI +AmlCodeGenNameUnicodeString ( + IN CONST CHAR8 *NameString, + INCHAR16 *String, + INAML_NODE_HANDLE ParentNode OPTIONAL, + OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL + ) +{ + EFI_STATUS Status; + AML_OBJECT_NODE *ObjectNode; + AML_DATA_NODE*DataNode; + + if ((NameString == NULL) || + (String == NULL) || + ((ParentNode == NULL) && (NewObjectNode == NULL))) + { +ASSERT (0); +return EFI_INVALID_PARAMETER; + } + + Status = AmlCodeGenBuffer (NULL, 0, &ObjectNode); + if (EFI_ERROR (Status)) { +ASSERT_EFI_ERROR (Status); +return Status; + } + + Status = AmlCreateDataNode ( + EAmlNodeDataTypeRaw, + (CONST UINT8 *)String, + StrSize (String), + &DataNode + ); + if (EFI_ERROR (Status)) { +ASSERT_EFI_ERROR (Status); +AmlDeleteTree ((AML_NODE_HEADER *)ObjectNode); +return Status; + } + + Status = AmlVarListAddTail ( + (AML_NODE_HEADER *)ObjectNode, + (AML_NODE_HEADER *)DataNode + ); + if (EFI_ERROR (Status)) { +ASSERT_EFI_ERROR (Status); +AmlDeleteTree ((AML_NODE_HEADER *)ObjectNode); +AmlDeleteTree ((AML_NODE_HANDLE)DataNode); +return Status; + } + + Status = AmlCodeGenName ( + NameString, +
[edk2-devel] [PATCH 3/4] DynamicTablesPkg: Add support to add Strings to package
Add API to add a String to a package created with NamedPackage API. Signed-off-by: Jeff Brasen Reviewed-by: Swatisri Kantamsetti Reviewed-by: Ashish Singhal --- .../Include/Library/AmlLib/AmlLib.h | 17 .../Common/AmlLib/CodeGen/AmlCodeGen.c| 82 +++ 2 files changed, 99 insertions(+) diff --git a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h index b82c7a3ce8..043e7ee901 100644 --- a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h +++ b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h @@ -1472,4 +1472,21 @@ AmlCreateCpcNode ( OUT AML_OBJECT_NODE_HANDLE *NewCpcNode OPTIONAL ); +/** AML code generation to add a string to the package in a named node. + + + @param [in] String String to add + @param [in] NamedNode Node to add the string to the included package. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCESFailed to allocate memory. +**/ +EFI_STATUS +EFIAPI +AmlAddStringToNamedPackage ( + IN CHAR8 *String, + IN AML_OBJECT_NODE_HANDLE NamedNode + ); + #endif // AML_LIB_H_ diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c index 2b95839e4c..a0d01032d5 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c @@ -3665,3 +3665,85 @@ error_handler: AmlDeleteTree ((AML_NODE_HANDLE)CpcNode); return Status; } + +/** AML code generation to add a string to the package in a named node. + + + @param [in] Name String to add + @param [in] NamedNode Node to add the string to the included package. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCESFailed to allocate memory. +**/ +EFI_STATUS +EFIAPI +AmlAddStringToNamedPackage ( + IN CHAR8 *String, + IN AML_OBJECT_NODE_HANDLE NamedNode + ) +{ + EFI_STATUS Status; + AML_DATA_NODE *DataNode; + CHAR8 *AmlNameString; + UINT32 AmlNameStringSize; + AML_OBJECT_NODE_HANDLE PackageNode; + + DataNode = NULL; + + if ((NamedNode == NULL) || + (AmlGetNodeType ((AML_NODE_HANDLE)NamedNode) != EAmlNodeObject) || + (!AmlNodeHasOpCode (NamedNode, AML_NAME_OP, 0))) + { +ASSERT (0); +return EFI_INVALID_PARAMETER; + } + + PackageNode = (AML_OBJECT_NODE_HANDLE)AmlGetFixedArgument ( + NamedNode, + EAmlParseIndexTerm1 + ); + if ((PackageNode == NULL) || + (AmlGetNodeType ((AML_NODE_HANDLE)PackageNode) != EAmlNodeObject) || + (!AmlNodeHasOpCode (PackageNode, AML_PACKAGE_OP, 0))) + { +ASSERT (0); +return EFI_INVALID_PARAMETER; + } + + Status = ConvertAslNameToAmlName (String, &AmlNameString); + if (EFI_ERROR (Status)) { +ASSERT (0); +return Status; + } + + Status = AmlGetNameStringSize (AmlNameString, &AmlNameStringSize); + if (EFI_ERROR (Status)) { +ASSERT (0); +goto exit_handler; + } + + Status = AmlCreateDataNode ( + EAmlNodeDataTypeNameString, + (UINT8 *)AmlNameString, + AmlNameStringSize, + &DataNode + ); + if (EFI_ERROR (Status)) { +ASSERT (0); +goto exit_handler; + } + + Status = AmlVarListAddTail ( + (AML_NODE_HANDLE)PackageNode, + (AML_NODE_HANDLE)DataNode + ); + ASSERT_EFI_ERROR (Status); + +exit_handler: + if (AmlNameString != NULL) { +FreePool (AmlNameString); + } + + return Status; +} -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#106544): https://edk2.groups.io/g/devel/message/106544 Mute This Topic: https://groups.io/mt/99861341/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH] MdeModulePkg/PciHostBridge: Add support for driver binding
Not sure why the patch failed to apply I'll see if there is something wrong with my gitconfig tomorrow. The path you suggested below is exactly what our current implementation does. However, I am trying to make our pcie controller driver do async initialization so that using a depex is less ideal as we may have to postpone driver load to after end of dxe instead of just the connection. It seemed that a driver binding type approach was a good approach for this. On a less important implementation if the pieces that live under the library are driver binding we have to reject any stop requests as there is no driver linkage between the two layers. -Jeff -Original Message- From: Ni, Ray Sent: Thursday, June 29, 2023 8:29 PM To: Jeff Brasen ; devel@edk2.groups.io Cc: Wang, Jian J ; Gao, Liming ; Wu, Hao A Subject: RE: [PATCH] MdeModulePkg/PciHostBridge: Add support for driver binding External email: Use caution opening links or attachments I failed to apply the patch in my local tree. It seems you invented a new EdkiiRootBridgeIo protocol and a certain proprietary driver would produce this protocol instance. Then the open source PciHostBridge driver starts on that. Then, why not implement your own PciHostBridgeLib and let it depends on some "AllRootBridgeIoInformationIsReady" protocol. So that the PciHostBridge driver could still call PciHostBridgeLib and all your implementation in this patch can be in that lib. Thanks, Ray > -Original Message- > From: Jeff Brasen > Sent: Friday, June 30, 2023 4:54 AM > To: devel@edk2.groups.io > Cc: Wang, Jian J ; Gao, Liming > ; Wu, Hao A ; Ni, Ray > ; Jeff Brasen > Subject: [PATCH] MdeModulePkg/PciHostBridge: Add support for driver > binding > > If the platform does not support any PCIe devices using the library > > method allow devices to connect to host bridge via driver binding. > > > > Signed-off-by: Jeff Brasen > > --- > > .../Bus/Pci/PciHostBridgeDxe/PciHostBridge.c | 649 > ++ > > .../Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf | 1 + > > .../Bus/Pci/PciHostBridgeDxe/PciRootBridge.h | 13 + > > .../Pci/PciHostBridgeDxe/PciRootBridgeIo.c| 24 + > > MdeModulePkg/MdeModulePkg.dec | 4 + > > 5 files changed, 562 insertions(+), 129 deletions(-) > > > > diff --git a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridge.c > b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridge.c > > index d573e532ba..506c6660ae 100644 > > --- a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridge.c > > +++ b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridge.c > > @@ -422,167 +422,320 @@ IoMmuProtocolCallback ( > > } > > > > /** > > + PCI Root Bridge Memory setup. > > > > - Entry point of this driver. > > + @param RootBridgeRoot Bridge instance. > > > > - @param ImageHandle Image handle of this driver. > > - @param SystemTable Pointer to standard EFI system table. > > - > > - @retval EFI_SUCCESS Succeed. > > - @retval EFI_DEVICE_ERROR Fail to install PCI_ROOT_BRIDGE_IO protocol. > > + @retval EFI_SUCCESS Memory was setup correctly > > + @retval othersError in setup > > > > **/ > > EFI_STATUS > > EFIAPI > > -InitializePciHostBridge ( > > - IN EFI_HANDLEImageHandle, > > - IN EFI_SYSTEM_TABLE *SystemTable > > +PciRootBridgeMemorySetup ( > > + IN PCI_ROOT_BRIDGE *RootBridge > >) > > { > >EFI_STATUSStatus; > > - PCI_HOST_BRIDGE_INSTANCE *HostBridge; > > - PCI_ROOT_BRIDGE_INSTANCE *RootBridge; > > - PCI_ROOT_BRIDGE *RootBridges; > > - UINTN RootBridgeCount; > > - UINTN Index; > > + UINT64HostAddress; > >PCI_ROOT_BRIDGE_APERTURE *MemApertures[4]; > >UINTN MemApertureIndex; > > - BOOLEAN ResourceAssigned; > > - LIST_ENTRY*Link; > > - UINT64HostAddress; > > > > - RootBridges = PciHostBridgeGetRootBridges (&RootBridgeCount); > > - if ((RootBridges == NULL) || (RootBridgeCount == 0)) { > > -return EFI_UNSUPPORTED; > > - } > > - > > - Status = gBS->LocateProtocol (&gEfiCpuIo2ProtocolGuid, NULL, (VOID > **)&mCpuIo); > > - ASSERT_EFI_ERROR (Status); > > - > > - // > > - // Most systems in the world including complex servers have only > one Host Bridge. > > - // > > - HostBridge = AllocateZeroPool (sizeof (PCI_HOST_BRIDGE_INSTANCE)); > > - ASSERT (HostBridge != NUL
Re: [edk2-devel] [PATCH] MdeModulePkg/PciHostBridge: Add support for driver binding
> -Original Message- > From: Ni, Ray > Sent: Thursday, June 29, 2023 9:59 PM > To: Jeff Brasen ; devel@edk2.groups.io > Cc: Wang, Jian J ; Gao, Liming > ; Wu, Hao A > Subject: RE: [PATCH] MdeModulePkg/PciHostBridge: Add support for driver > binding > > External email: Use caution opening links or attachments > > > > -Original Message- > > From: Jeff Brasen > > Sent: Friday, June 30, 2023 11:21 AM > > To: Ni, Ray ; devel@edk2.groups.io > > Cc: Wang, Jian J ; Gao, Liming > > ; Wu, Hao A > > Subject: RE: [PATCH] MdeModulePkg/PciHostBridge: Add support for > > driver binding > > > > Not sure why the patch failed to apply I'll see if there is something > > wrong with my gitconfig tomorrow. The path you suggested below is > > exactly what our current implementation does. However, I am trying to > > make our pcie controller driver do async initialization so that using > > a depex is less ideal as we may have to postpone driver load to after > > end of dxe instead of just the connection. It seemed that a driver binding > type approach was a good approach for this. > > I am curious how the pcie root (root complex) initialization is done in async > way? > Does it use a timer callback to poll the initialization status every certain > interval? > [JB] That is correct, we use a timer when we expect sleeps or polling loops. > On the other hand, even you make PciHostBridge as a UEFI driver-model > driver, you still require some code to initiate the "ConnectController()". > How is > that done? > > Comparing the two paths (today's = my proposal, new way = your patch), > both require some code to explicitly call "ConnectController()". > [JB] We have a sync point in BDS prior to the ConnectController call that is made. I could put that and a dispatch call prior to EndOfDxe signal but was hoping to not trigger any of the driver seen but not loaded debug messages from the main dispatch loop if possible as that can be a useful message to trigger something might be wrong. > > > > On a less important implementation if the pieces that live under the > > library are driver binding we have to reject any stop requests as > > there is no driver linkage between the two layers. > > In x86, root complex (pcie root) is almost the root of all peripherals. I > cannot > see a value to Stop () the pcie root. > If you check the PciBus implementation, it supports Stop() but the Stop() only > succeeds when all upper layer drivers succeed to Stop(). (usually it's not the > case.) And even PciBus.Stop() succeeds, the resource(MMIO/IO/BUS) > allocation is not un-done. It's only the PciIo handles that are destroyed in > software level. > [JB] Yeah, not allowing stop to work on this isn't a big deal (and what we currently have implemented) but it was something we noticed a while ago is that we couldn't implement this even if we wanted to as there was no way to stop the host bridge driver. > Thanks, > Ray > > > > > > -Jeff > > > > > > -Original Message- > > From: Ni, Ray > > Sent: Thursday, June 29, 2023 8:29 PM > > To: Jeff Brasen ; devel@edk2.groups.io > > Cc: Wang, Jian J ; Gao, Liming > > ; Wu, Hao A > > Subject: RE: [PATCH] MdeModulePkg/PciHostBridge: Add support for > > driver binding > > > > External email: Use caution opening links or attachments > > > > > > I failed to apply the patch in my local tree. > > > > It seems you invented a new EdkiiRootBridgeIo protocol and a certain > > proprietary driver would produce this protocol instance. > > Then the open source PciHostBridge driver starts on that. > > > > Then, why not implement your own PciHostBridgeLib and let it depends > > on some "AllRootBridgeIoInformationIsReady" protocol. > > So that the PciHostBridge driver could still call PciHostBridgeLib and > > all your implementation in this patch can be in that lib. > > > > Thanks, > > Ray > > > > > -Original Message- > > > From: Jeff Brasen > > > Sent: Friday, June 30, 2023 4:54 AM > > > To: devel@edk2.groups.io > > > Cc: Wang, Jian J ; Gao, Liming > > > ; Wu, Hao A ; Ni, Ray > > > ; Jeff Brasen > > > Subject: [PATCH] MdeModulePkg/PciHostBridge: Add support for driver > > > binding > > > > > > If the platform does not support any PCIe devices using the library > > > > > > method allow devices to connect to host bridge via driver binding. > > > > > > > > > >
[edk2-devel] [PATCH v2 0/2] dp command without ACPI
Systems that do not boot with ACPI (system that use device tree for example) can not use the shell dp command. This patch adds this to the configuration table so that dp command can get this without the FPDT table. I am open to other ways for this to be passed if desired (Installed protocol, handler of the status code, etc) but wanted to post this to at least get thoughts on this. Change Log v2 - Fix missing cast for IA32 builds -Jeff Jeff Brasen (2): MdeModulePkg/DxeCorePerformanceLib: Install BPDT in config table ShellPkg/Dp: Allow dp command to work without ACPI ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.inf| 1 + .../DpDynamicCommand/DpDynamicCommand.inf | 1 + .../DxeCorePerformanceLib/DxeCorePerformanceLib.c | 2 ++ ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c | 11 --- 4 files changed, 12 insertions(+), 3 deletions(-) -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#106573): https://edk2.groups.io/g/devel/message/106573 Mute This Topic: https://groups.io/mt/99877761/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH v2 1/2] MdeModulePkg/DxeCorePerformanceLib: Install BPDT in config table
Install the performance table into the UEFI configuration table. This will allow the shell application to get this if the system is not using ACPI. Signed-off-by: Jeff Brasen --- .../Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c index ef14bc073810..57792ba44e7f 100644 --- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c +++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c @@ -1403,6 +1403,8 @@ ReportFpdtRecordBuffer ( &BPDTAddr, sizeof (UINT64) ); + Status = gBS->InstallConfigurationTable (&gEdkiiFpdtExtendedFirmwarePerformanceGuid, (VOID *)(UINTN)BPDTAddr); + ASSERT_EFI_ERROR (Status); } // -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#106574): https://edk2.groups.io/g/devel/message/106574 Mute This Topic: https://groups.io/mt/99877762/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH v2 2/2] ShellPkg/Dp: Allow dp command to work without ACPI
If the system does not have ACPI setup use the configuration table to get the performance info. Signed-off-by: Jeff Brasen --- ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.inf| 1 + .../DpDynamicCommand/DpDynamicCommand.inf | 1 + ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c | 11 --- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.inf b/ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.inf index 4a58286b8c1a..d9e1c23a1ee7 100644 --- a/ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.inf +++ b/ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.inf @@ -54,6 +54,7 @@ [LibraryClasses] [Guids] gPerformanceProtocolGuid## CONSUMES ## SystemTable + gEdkiiFpdtExtendedFirmwarePerformanceGuid ## CONSUMES ## SystemTable [Protocols] gEfiLoadedImageProtocolGuid ## CONSUMES diff --git a/ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.inf b/ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.inf index 013bdbd4a07e..2723fee7066e 100644 --- a/ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.inf +++ b/ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.inf @@ -55,6 +55,7 @@ [LibraryClasses] [Guids] gPerformanceProtocolGuid## CONSUMES ## SystemTable + gEdkiiFpdtExtendedFirmwarePerformanceGuid ## CONSUMES ## SystemTable [Protocols] gEfiLoadedImageProtocolGuid ## CONSUMES diff --git a/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c b/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c index 512a146da6dd..98c84d2ef938 100644 --- a/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c +++ b/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c @@ -129,17 +129,22 @@ EFI_STATUS GetBootPerformanceTable ( ) { + EFI_STATUS Status; FIRMWARE_PERFORMANCE_TABLE *FirmwarePerformanceTable; FirmwarePerformanceTable = (FIRMWARE_PERFORMANCE_TABLE *)EfiLocateFirstAcpiTable ( EFI_ACPI_5_0_FIRMWARE_PERFORMANCE_DATA_TABLE_SIGNATURE ); if (FirmwarePerformanceTable == NULL) { -ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_GET_ACPI_FPDT_FAIL), mDpHiiHandle); -return EFI_NOT_FOUND; +Status = EfiGetSystemConfigurationTable (&gEdkiiFpdtExtendedFirmwarePerformanceGuid, (VOID **)&mBootPerformanceTable); +if (EFI_ERROR (Status)) { + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_GET_ACPI_FPDT_FAIL), mDpHiiHandle); + return EFI_NOT_FOUND; +} + } else { +mBootPerformanceTable = (UINT8 *)(UINTN)FirmwarePerformanceTable->BootPointerRecord.BootPerformanceTablePointer; } - mBootPerformanceTable = (UINT8 *)(UINTN)FirmwarePerformanceTable->BootPointerRecord.BootPerformanceTablePointer; mBootPerformanceTableSize = ((BOOT_PERFORMANCE_TABLE *)mBootPerformanceTable)->Header.Length; return EFI_SUCCESS; -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#106575): https://edk2.groups.io/g/devel/message/106575 Mute This Topic: https://groups.io/mt/99877763/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH v2 0/4] Add support for generating ACPI ThermalZones
Add APIs needed to create thermal zones dynamically. Does not add a generator for this as creating the TMP method generically may be difficult. Change log: v2 - renamed NameString function and added goto dones in a couple error cases Jeff Brasen (4): DynamicTablesPkg: Add ThermalZone CodeGen function DynamicTablesPkg: Add support for simple method invocation. DynamicTablesPkg: Add support to add Strings to package DynamicTablesPkg: Add Aml NameUnicodeString API .../Include/Library/AmlLib/AmlLib.h | 130 + .../Common/AmlLib/CodeGen/AmlCodeGen.c| 508 ++ 2 files changed, 638 insertions(+) -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#106774): https://edk2.groups.io/g/devel/message/106774 Mute This Topic: https://groups.io/mt/100068075/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH v2 1/4] DynamicTablesPkg: Add ThermalZone CodeGen function
Add API to generate a ThermalZone object to AmlLib. Reviewed-by: Swatisri Kantamsetti Reviewed-by: Ashish Singhal --- .../Include/Library/AmlLib/AmlLib.h | 28 + .../Common/AmlLib/CodeGen/AmlCodeGen.c| 116 ++ 2 files changed, 144 insertions(+) diff --git a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h index 9210c5091548..d201ae9499fa 100644 --- a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h +++ b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h @@ -1038,6 +1038,34 @@ AmlCodeGenDevice ( OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL ); +/** AML code generation for a ThermalZone object node. + + AmlCodeGenThermalZone ("TZ00", ParentNode, NewObjectNode) is + equivalent of the following ASL code: +ThermalZone(TZ00) {} + + @ingroup CodeGenApis + + @param [in] NameString The new ThermalZone's name. + Must be a NULL-terminated ASL NameString + e.g.: "DEV0", "DV15.DEV0", etc. + The input string is copied. + @param [in] ParentNode If provided, set ParentNode as the parent + of the node created. + @param [out] NewObjectNode If success, contains the created node. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCESFailed to allocate memory. +**/ +EFI_STATUS +EFIAPI +AmlCodeGenThermalZone ( + IN CONST CHAR8 *NameString, + INAML_NODE_HANDLE ParentNode OPTIONAL, + OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL + ); + /** AML code generation for a Scope object node. AmlCodeGenScope ("_SB", ParentNode, NewObjectNode) is diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c index 0b223379fa4b..88537b7e2d27 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c @@ -1218,6 +1218,122 @@ AmlCodeGenDevice ( return Status; } +/** AML code generation for a ThermalZone object node. + + AmlCodeGenThermalZone ("TZ00", ParentNode, NewObjectNode) is + equivalent of the following ASL code: +ThermalZone(TZ00) {} + + @ingroup CodeGenApis + + @param [in] NameString The new ThermalZone's name. + Must be a NULL-terminated ASL NameString + e.g.: "DEV0", "DV15.DEV0", etc. + The input string is copied. + @param [in] ParentNode If provided, set ParentNode as the parent + of the node created. + @param [out] NewObjectNode If success, contains the created node. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCESFailed to allocate memory. +**/ +EFI_STATUS +EFIAPI +AmlCodeGenThermalZone ( + IN CONST CHAR8 *NameString, + INAML_NODE_HANDLE ParentNode OPTIONAL, + OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL + ) +{ + EFI_STATUS Status; + AML_OBJECT_NODE *ObjectNode; + AML_DATA_NODE*DataNode; + CHAR8*AmlNameString; + UINT32 AmlNameStringSize; + + if ((NameString == NULL) || + ((ParentNode == NULL) && (NewObjectNode == NULL))) + { +ASSERT (0); +return EFI_INVALID_PARAMETER; + } + + ObjectNode= NULL; + DataNode = NULL; + AmlNameString = NULL; + + Status = ConvertAslNameToAmlName (NameString, &AmlNameString); + if (EFI_ERROR (Status)) { +ASSERT (0); +return Status; + } + + Status = AmlGetNameStringSize (AmlNameString, &AmlNameStringSize); + if (EFI_ERROR (Status)) { +ASSERT (0); +goto error_handler1; + } + + Status = AmlCreateObjectNode ( + AmlGetByteEncodingByOpCode (AML_EXT_OP, AML_EXT_THERMAL_ZONE_OP), + AmlNameStringSize + AmlComputePkgLengthWidth (AmlNameStringSize), + &ObjectNode + ); + if (EFI_ERROR (Status)) { +ASSERT (0); +goto error_handler1; + } + + Status = AmlCreateDataNode ( + EAmlNodeDataTypeNameString, + (UINT8 *)AmlNameString, + AmlNameStringSize, + &DataNode + ); + if (EFI_ERROR (Status)) { +ASSERT (0); +goto error_handler2; + } + + Status = AmlSetFixedArgument ( + ObjectNode, + EAmlParseIndexTerm0, + (AML_NODE_HEADER *)DataNode + ); + if (EFI_ERROR (Status)) { +ASSERT (0); +AmlDeleteTree ((AML_NODE_HEADER *)DataNode); +goto error_handler2; + } + + Status = LinkNode ( + ObjectNode, + ParentNode, + NewObjectNode + ); + if (EFI_ERROR (Status)) { +ASSERT (0); +goto
[edk2-devel] [PATCH v2 2/4] DynamicTablesPkg: Add support for simple method invocation.
Add support to add Return objects via AML that pass a single integer argument to the named method. Reviewed-by: Swatisri Kantamsetti Reviewed-by: Ashish Singhal --- .../Include/Library/AmlLib/AmlLib.h | 54 + .../Common/AmlLib/CodeGen/AmlCodeGen.c| 224 ++ 2 files changed, 278 insertions(+) diff --git a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h index d201ae9499fa..b82c7a3ce874 100644 --- a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h +++ b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h @@ -1194,6 +1194,60 @@ AmlCodeGenMethodRetInteger ( OUT AML_OBJECT_NODE_HANDLE *NewObjectNodeOPTIONAL ); +/** AML code generation for a method returning a NameString that takes an +integer argument. + + AmlCodeGenMethodRetNameStringIntegerArgument ( +"MET0", "MET1", 1, TRUE, 3, 5, ParentNode, NewObjectNode +); + is equivalent of the following ASL code: +Method(MET0, 1, Serialized, 3) { + Return (MET1 (5)) +} + + The ASL parameters "ReturnType" and "ParameterTypes" are not asked + in this function. They are optional parameters in ASL. + + @param [in] MethodNameString The new Method's name. +Must be a NULL-terminated ASL NameString +e.g.: "MET0", "_SB.MET0", etc. +The input string is copied. + @param [in] ReturnedNameString The name of the object returned by the +method. Optional parameter, can be: + - NULL (ignored). + - A NULL-terminated ASL NameString. + e.g.: "MET0", "_SB.MET0", etc. + The input string is copied. + @param [in] NumArgs Number of arguments. +Must be 0 <= NumArgs <= 6. + @param [in] IsSerialized TRUE is equivalent to Serialized. +FALSE is equivalent to NotSerialized. +Default is NotSerialized in ASL spec. + @param [in] SyncLevelSynchronization level for the method. +Must be 0 <= SyncLevel <= 15. +Default is 0 in ASL. + @param [in] IntegerArgument Argument to pass to the NameString. + @param [in] ParentNode If provided, set ParentNode as the parent +of the node created. + @param [out] NewObjectNodeIf success, contains the created node. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCESFailed to allocate memory. +**/ +EFI_STATUS +EFIAPI +AmlCodeGenMethodRetNameStringIntegerArgument ( + IN CONST CHAR8 *MethodNameString, + IN CONST CHAR8 *ReturnedNameString OPTIONAL, + INUINT8 NumArgs, + INBOOLEAN IsSerialized, + INUINT8 SyncLevel, + INUINT64 IntegerArgument, + INAML_NODE_HANDLE ParentNode OPTIONAL, + OUT AML_OBJECT_NODE_HANDLE *NewObjectNodeOPTIONAL + ); + /** Create a _LPI name. AmlCreateLpiNode ("_LPI", 0, 1, ParentNode, &LpiNode) is diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c index 88537b7e2d27..d31a86e98c4c 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c @@ -1881,6 +1881,118 @@ AmlCodeGenReturnInteger ( return Status; } +/** AML code generation for a Return object node, +returning the object as an input NameString with a integer argument. + + AmlCodeGenReturn ("NAM1", 6, ParentNode, NewObjectNode) is + equivalent of the following ASL code: +Return(NAM1 (6)) + + The ACPI 6.3 specification, s20.2.5.3 "Type 1 Opcodes Encoding" states: +DefReturn := ReturnOp ArgObject +ReturnOp := 0xA4 +ArgObject := TermArg => DataRefObject + + Thus, the ReturnNode must be evaluated as a DataRefObject. It can + be a NameString referencing an object. As this CodeGen Api doesn't + do semantic checking, it is strongly advised to check the AML bytecode + generated by this function against an ASL compiler. + + The ReturnNode must be generated inside a Method body scope. + + @param [in] NameString The object referenced by this NameString + is returned by the Return ASL statement. + Must be a NULL-terminated ASL NameString + e.g.: "NAM1", "_SB.NAM1", etc. + The input string is copied. + @param
[edk2-devel] [PATCH v2 3/4] DynamicTablesPkg: Add support to add Strings to package
Add API to add a String to a package created with NamedPackage API. Signed-off-by: Jeff Brasen Reviewed-by: Swatisri Kantamsetti Reviewed-by: Ashish Singhal --- .../Include/Library/AmlLib/AmlLib.h | 17 .../Common/AmlLib/CodeGen/AmlCodeGen.c| 82 +++ 2 files changed, 99 insertions(+) diff --git a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h index b82c7a3ce874..f4a490875365 100644 --- a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h +++ b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h @@ -1472,4 +1472,21 @@ AmlCreateCpcNode ( OUT AML_OBJECT_NODE_HANDLE *NewCpcNode OPTIONAL ); +/** AML code generation to add a NameString to the package in a named node. + + + @param [in] NameString NameString to add + @param [in] NamedNode Node to add the string to the included package. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCESFailed to allocate memory. +**/ +EFI_STATUS +EFIAPI +AmlAddNameStringToNamedPackage ( + IN CHAR8 *NameString, + IN AML_OBJECT_NODE_HANDLE NamedNode + ); + #endif // AML_LIB_H_ diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c index d31a86e98c4c..a2009d9805b5 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c @@ -3665,3 +3665,85 @@ AmlCreateCpcNode ( AmlDeleteTree ((AML_NODE_HANDLE)CpcNode); return Status; } + +/** AML code generation to add a NameString to the package in a named node. + + + @param [in] NameString NameString to add + @param [in] NamedNode Node to add the string to the included package. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCESFailed to allocate memory. +**/ +EFI_STATUS +EFIAPI +AmlAddNameStringToNamedPackage ( + IN CHAR8 *NameString, + IN AML_OBJECT_NODE_HANDLE NamedNode + ) +{ + EFI_STATUS Status; + AML_DATA_NODE *DataNode; + CHAR8 *AmlNameString; + UINT32 AmlNameStringSize; + AML_OBJECT_NODE_HANDLE PackageNode; + + DataNode = NULL; + + if ((NamedNode == NULL) || + (AmlGetNodeType ((AML_NODE_HANDLE)NamedNode) != EAmlNodeObject) || + (!AmlNodeHasOpCode (NamedNode, AML_NAME_OP, 0))) + { +ASSERT (0); +return EFI_INVALID_PARAMETER; + } + + PackageNode = (AML_OBJECT_NODE_HANDLE)AmlGetFixedArgument ( + NamedNode, + EAmlParseIndexTerm1 + ); + if ((PackageNode == NULL) || + (AmlGetNodeType ((AML_NODE_HANDLE)PackageNode) != EAmlNodeObject) || + (!AmlNodeHasOpCode (PackageNode, AML_PACKAGE_OP, 0))) + { +ASSERT (0); +return EFI_INVALID_PARAMETER; + } + + Status = ConvertAslNameToAmlName (NameString, &AmlNameString); + if (EFI_ERROR (Status)) { +ASSERT (0); +return Status; + } + + Status = AmlGetNameStringSize (AmlNameString, &AmlNameStringSize); + if (EFI_ERROR (Status)) { +ASSERT (0); +goto exit_handler; + } + + Status = AmlCreateDataNode ( + EAmlNodeDataTypeNameString, + (UINT8 *)AmlNameString, + AmlNameStringSize, + &DataNode + ); + if (EFI_ERROR (Status)) { +ASSERT (0); +goto exit_handler; + } + + Status = AmlVarListAddTail ( + (AML_NODE_HANDLE)PackageNode, + (AML_NODE_HANDLE)DataNode + ); + ASSERT_EFI_ERROR (Status); + +exit_handler: + if (AmlNameString != NULL) { +FreePool (AmlNameString); + } + + return Status; +} -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#106777): https://edk2.groups.io/g/devel/message/106777 Mute This Topic: https://groups.io/mt/100068078/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH v2 4/4] DynamicTablesPkg: Add Aml NameUnicodeString API
Add API to generate a Name that contains a Unicode string buffer. Signed-off-by: Jeff Brasen Reviewed-by: Swatisri Kantamsetti Reviewed-by: Ashish Singhal --- .../Include/Library/AmlLib/AmlLib.h | 31 +++ .../Common/AmlLib/CodeGen/AmlCodeGen.c| 86 +++ 2 files changed, 117 insertions(+) diff --git a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h index f4a490875365..e0dc1340ab50 100644 --- a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h +++ b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h @@ -958,6 +958,37 @@ AmlCodeGenNameResourceTemplate ( OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL ); +/** AML code generation for a Name object node, containing a String. + + AmlCodeGenNameUnicodeString ("_STR", L"String", ParentNode, NewObjectNode) is + equivalent of the following ASL code: +Name(_STR, Unicode ("String")) + + @ingroup CodeGenApis + + @param [in] NameString The new variable name. + Must be a NULL-terminated ASL NameString + e.g.: "DEV0", "DV15.DEV0", etc. + The input string is copied. + @param [in] String NULL terminated Unicode String to associate to the + NameString. + @param [in] ParentNode If provided, set ParentNode as the parent + of the node created. + @param [out] NewObjectNode If success, contains the created node. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCESFailed to allocate memory. +**/ +EFI_STATUS +EFIAPI +AmlCodeGenNameUnicodeString ( + IN CONST CHAR8 *NameString, + INCHAR16 *String, + INAML_NODE_HANDLE ParentNode OPTIONAL, + OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL + ); + /** Add a _PRT entry. AmlCodeGenPrtEntry (0x0, 0, "LNKA", 0, PrtNameNode) is diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c index a2009d9805b5..ffc809ba1b0a 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c @@ -869,6 +869,92 @@ AmlCodeGenNameResourceTemplate ( return Status; } +/** AML code generation for a Name object node, containing a String. + + AmlCodeGenNameUnicodeString ("_STR", L"String", ParentNode, NewObjectNode) is + equivalent of the following ASL code: + Name(_STR, Unicode ("String")) + + @ingroup CodeGenApis + + @param [in] NameString The new variable name. + Must be a NULL-terminated ASL NameString + e.g.: "DEV0", "DV15.DEV0", etc. + The input string is copied. + @param [in] String NULL terminated Unicode String to associate to the + NameString. + @param [in] ParentNode If provided, set ParentNode as the parent + of the node created. + @param [out] NewObjectNode If success, contains the created node. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCESFailed to allocate memory. +**/ +EFI_STATUS +EFIAPI +AmlCodeGenNameUnicodeString ( + IN CONST CHAR8 *NameString, + INCHAR16 *String, + INAML_NODE_HANDLE ParentNode OPTIONAL, + OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL + ) +{ + EFI_STATUS Status; + AML_OBJECT_NODE *ObjectNode; + AML_DATA_NODE*DataNode; + + if ((NameString == NULL) || + (String == NULL) || + ((ParentNode == NULL) && (NewObjectNode == NULL))) + { +ASSERT (0); +return EFI_INVALID_PARAMETER; + } + + Status = AmlCodeGenBuffer (NULL, 0, &ObjectNode); + if (EFI_ERROR (Status)) { +ASSERT_EFI_ERROR (Status); +return Status; + } + + Status = AmlCreateDataNode ( + EAmlNodeDataTypeRaw, + (CONST UINT8 *)String, + StrSize (String), + &DataNode + ); + if (EFI_ERROR (Status)) { +ASSERT_EFI_ERROR (Status); +AmlDeleteTree ((AML_NODE_HEADER *)ObjectNode); +return Status; + } + + Status = AmlVarListAddTail ( + (AML_NODE_HEADER *)ObjectNode, + (AML_NODE_HEADER *)DataNode + ); + if (EFI_ERROR (Status)) { +ASSERT_EFI_ERROR (Status); +AmlDeleteTree ((AML_NODE_HEADER *)ObjectNode); +AmlDeleteTree ((AML_NODE_HANDLE)DataNode); +return Status; + } + + Status = AmlCodeGenName ( + NameString, +
Re: [edk2-devel] [PATCH] MdeModulePkg/PciHostBridge: Add support for driver binding
Ray, Would you prefer this sort of use would be done by an extra dispatch after the wait for everything being completed and the connect controller call in BDS as opposed to the driver binding approach? Basically using a depex on the library as we are currently doing. -Jeff > -Original Message- > From: Jeff Brasen > Sent: Friday, June 30, 2023 9:57 AM > To: Ni, Ray ; devel@edk2.groups.io > Cc: Wang, Jian J ; Gao, Liming > ; Wu, Hao A > Subject: RE: [PATCH] MdeModulePkg/PciHostBridge: Add support for driver > binding > > > > > -Original Message- > > From: Ni, Ray > > Sent: Thursday, June 29, 2023 9:59 PM > > To: Jeff Brasen ; devel@edk2.groups.io > > Cc: Wang, Jian J ; Gao, Liming > > ; Wu, Hao A > > Subject: RE: [PATCH] MdeModulePkg/PciHostBridge: Add support for > > driver binding > > > > External email: Use caution opening links or attachments > > > > > > > -Original Message- > > > From: Jeff Brasen > > > Sent: Friday, June 30, 2023 11:21 AM > > > To: Ni, Ray ; devel@edk2.groups.io > > > Cc: Wang, Jian J ; Gao, Liming > > > ; Wu, Hao A > > > Subject: RE: [PATCH] MdeModulePkg/PciHostBridge: Add support for > > > driver binding > > > > > > Not sure why the patch failed to apply I'll see if there is > > > something wrong with my gitconfig tomorrow. The path you suggested > > > below is exactly what our current implementation does. However, I am > > > trying to make our pcie controller driver do async initialization so > > > that using a depex is less ideal as we may have to postpone driver > > > load to after end of dxe instead of just the connection. It seemed > > > that a driver binding > > type approach was a good approach for this. > > > > I am curious how the pcie root (root complex) initialization is done > > in async way? > > Does it use a timer callback to poll the initialization status every > > certain interval? > > > > [JB] That is correct, we use a timer when we expect sleeps or polling loops. > > > On the other hand, even you make PciHostBridge as a UEFI driver-model > > driver, you still require some code to initiate the > > "ConnectController()". How is that done? > > > > Comparing the two paths (today's = my proposal, new way = your patch), > > both require some code to explicitly call "ConnectController()". > > > > [JB] We have a sync point in BDS prior to the ConnectController call that is > made. I could put that and a dispatch call prior to EndOfDxe signal but was > hoping to not trigger any of the driver seen but not loaded debug messages > from the main dispatch loop if possible as that can be a useful message to > trigger something might be wrong. > > > > > > > On a less important implementation if the pieces that live under the > > > library are driver binding we have to reject any stop requests as > > > there is no driver linkage between the two layers. > > > > In x86, root complex (pcie root) is almost the root of all > > peripherals. I cannot see a value to Stop () the pcie root. > > If you check the PciBus implementation, it supports Stop() but the > > Stop() only succeeds when all upper layer drivers succeed to Stop(). > > (usually it's not the > > case.) And even PciBus.Stop() succeeds, the resource(MMIO/IO/BUS) > > allocation is not un-done. It's only the PciIo handles that are > > destroyed in software level. > > > > [JB] Yeah, not allowing stop to work on this isn't a big deal (and what we > currently have implemented) but it was something we noticed a while ago is > that we couldn't implement this even if we wanted to as there was no way to > stop the host bridge driver. > > > Thanks, > > Ray > > > > > > > > > > -Jeff > > > > > > > > > -Original Message- > > > From: Ni, Ray > > > Sent: Thursday, June 29, 2023 8:29 PM > > > To: Jeff Brasen ; devel@edk2.groups.io > > > Cc: Wang, Jian J ; Gao, Liming > > > ; Wu, Hao A > > > Subject: RE: [PATCH] MdeModulePkg/PciHostBridge: Add support for > > > driver binding > > > > > > External email: Use caution opening links or attachments > > > > > > > > > I failed to apply the patch in my local tree. > > > > > > It seems you invented a new EdkiiRootBridgeIo protocol and a certain > > > proprietary driver would produce this protocol instance. > > >
Re: [edk2-devel] [PATCH] MdeModulePkg/DxeCore: Allow relocation of images with large address
Any thoughts/feedback on this patch? Thanks, Jeff > -Original Message- > From: Jeff Brasen > Sent: Monday, May 15, 2023 5:49 PM > To: devel@edk2.groups.io > Cc: jian.j.w...@intel.com; gaolim...@byosoft.com.cn; dandan...@intel.com; > Jeff Brasen ; Ashish Singhal > > Subject: [PATCH] MdeModulePkg/DxeCore: Allow relocation of images with > large address > > Add PCD to control if modules with start addresses in PE/COFF > 0x10 > attempt to load at specified address. > If a module has an address in this range and there is untested memory > DxeCore will attempt to promote all memory to tested which bypasses any > memory testing that would occur later in boot. > > There are several existing AARCH64 option roms that have base addresses of > 0x18000. > > Signed-off-by: Jeff Brasen > Reviewed-by: Ashish Singhal > --- > MdeModulePkg/Core/Dxe/DxeMain.inf | 1 + > MdeModulePkg/Core/Dxe/Image/Image.c | 4 +++- > MdeModulePkg/MdeModulePkg.dec | 7 +++ > 3 files changed, 11 insertions(+), 1 deletion(-) > > diff --git a/MdeModulePkg/Core/Dxe/DxeMain.inf > b/MdeModulePkg/Core/Dxe/DxeMain.inf > index 35d5bf0dee..16871f2021 100644 > --- a/MdeModulePkg/Core/Dxe/DxeMain.inf > +++ b/MdeModulePkg/Core/Dxe/DxeMain.inf > @@ -187,6 +187,7 @@ >gEfiMdeModulePkgTokenSpaceGuid.PcdHeapGuardPropertyMask > ## CONSUMES >gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard > ## > CONSUMES >gEfiMdeModulePkgTokenSpaceGuid.PcdFwVolDxeMaxEncapsulationDepth > ## CONSUMES > + gEfiMdeModulePkgTokenSpaceGuid.PcdImageLargeAddressLoad > ## CONSUMES > > # [Hob] > # RESOURCE_DESCRIPTOR ## CONSUMES > diff --git a/MdeModulePkg/Core/Dxe/Image/Image.c > b/MdeModulePkg/Core/Dxe/Image/Image.c > index 9dbfb2a1fa..6bc3a549ae 100644 > --- a/MdeModulePkg/Core/Dxe/Image/Image.c > +++ b/MdeModulePkg/Core/Dxe/Image/Image.c > @@ -680,7 +680,9 @@ CoreLoadPeImage ( > ); >} > } else { > - if ((Image->ImageContext.ImageAddress >= 0x10) || Image- > >ImageContext.RelocationsStripped) { > + if ((PcdGetBool (PcdImageLargeAddressLoad) && ((Image- > >ImageContext.ImageAddress) >= 0x10)) || > + Image->ImageContext.RelocationsStripped) > + { > Status = CoreAllocatePages ( > AllocateAddress, > (EFI_MEMORY_TYPE)(Image- > >ImageContext.ImageCodeMemoryType), > diff --git a/MdeModulePkg/MdeModulePkg.dec > b/MdeModulePkg/MdeModulePkg.dec index 95dd077e19..6fd1bd7b8f > 100644 > --- a/MdeModulePkg/MdeModulePkg.dec > +++ b/MdeModulePkg/MdeModulePkg.dec > @@ -1116,6 +1116,13 @@ ># @Prompt Output MMIO address of Trace Hub message. > > gEfiMdeModulePkgTokenSpaceGuid.PcdTraceHubDebugMmioAddress|0|UIN > T64|0x30001058 > > + ## Indicates if images with large load address (>0x10) should > attempted to load at specified location. > + # If enabled, attempt to allocate at specfied location will be attempted > with > a fall back to any address. > + # TRUE - UEFI will attempt to load at specified location. > + # FALSE - UEFI will load at any address > + # @Prompt Enable large address image loading. > + > + > gEfiMdeModulePkgTokenSpaceGuid.PcdImageLargeAddressLoad|TRUE|BOOL > EAN|0 > + x30001059 > + > [PcdsFixedAtBuild, PcdsPatchableInModule] >## Dynamic type PCD can be registered callback function for Pcd setting > action. ># PcdMaxPeiPcdCallBackNumberPerPcdEntry indicates the maximum > number of callback function > -- > 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#108497): https://edk2.groups.io/g/devel/message/108497 Mute This Topic: https://groups.io/mt/98916659/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH v2 0/2] dp command without ACPI
Any additional thoughts/feedback on this patch series? Thanks, Jeff > -Original Message- > From: Jeff Brasen > Sent: Friday, June 30, 2023 11:30 AM > To: devel@edk2.groups.io > Cc: jian.j.w...@intel.com; gaolim...@byosoft.com.cn; dandan...@intel.com; > zhichao....@intel.com; Jeff Brasen > Subject: [PATCH v2 0/2] dp command without ACPI > > Systems that do not boot with ACPI (system that use device tree for example) > can not use the shell dp command. This patch adds this to the configuration > table so that dp command can get this without the FPDT table. > > I am open to other ways for this to be passed if desired (Installed protocol, > handler of the status code, etc) but wanted to post this to at least get > thoughts on this. > > Change Log > v2 - Fix missing cast for IA32 builds > > -Jeff > > Jeff Brasen (2): > MdeModulePkg/DxeCorePerformanceLib: Install BPDT in config table > ShellPkg/Dp: Allow dp command to work without ACPI > > ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.inf| 1 + > .../DpDynamicCommand/DpDynamicCommand.inf | 1 + > .../DxeCorePerformanceLib/DxeCorePerformanceLib.c | 2 ++ > ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c | 11 - > -- > 4 files changed, 12 insertions(+), 3 deletions(-) > > -- > 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#108498): https://edk2.groups.io/g/devel/message/108498 Mute This Topic: https://groups.io/mt/99877761/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH v3 0/4] Add support for generating ACPI ThermalZones
Add APIs needed to create thermal zones dynamically. Does not add a generator for this as creating the TMP method generically may be difficult. Change log: v3 - Fixed a couple error handling paths v2 - renamed NameString function and added goto dones in a couple error cases Jeff Brasen (4): DynamicTablesPkg: Add ThermalZone CodeGen function DynamicTablesPkg: Add support for simple method invocation. DynamicTablesPkg: Add support to add Strings to package DynamicTablesPkg: Add Aml NameUnicodeString API .../Include/Library/AmlLib/AmlLib.h | 130 + .../Common/AmlLib/CodeGen/AmlCodeGen.c| 526 ++ 2 files changed, 656 insertions(+) -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#108499): https://edk2.groups.io/g/devel/message/108499 Mute This Topic: https://groups.io/mt/101303759/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH v3 4/4] DynamicTablesPkg: Add Aml NameUnicodeString API
Add API to generate a Name that contains a Unicode string buffer. Bug 4063340 Signed-off-by: Jeff Brasen Reviewed-by: Swatisri Kantamsetti Reviewed-by: Ashish Singhal --- .../Include/Library/AmlLib/AmlLib.h | 31 +++ .../Common/AmlLib/CodeGen/AmlCodeGen.c| 86 +++ 2 files changed, 117 insertions(+) diff --git a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h index f4a4908753..e0dc1340ab 100644 --- a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h +++ b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h @@ -958,6 +958,37 @@ AmlCodeGenNameResourceTemplate ( OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL ); +/** AML code generation for a Name object node, containing a String. + + AmlCodeGenNameUnicodeString ("_STR", L"String", ParentNode, NewObjectNode) is + equivalent of the following ASL code: +Name(_STR, Unicode ("String")) + + @ingroup CodeGenApis + + @param [in] NameString The new variable name. + Must be a NULL-terminated ASL NameString + e.g.: "DEV0", "DV15.DEV0", etc. + The input string is copied. + @param [in] String NULL terminated Unicode String to associate to the + NameString. + @param [in] ParentNode If provided, set ParentNode as the parent + of the node created. + @param [out] NewObjectNode If success, contains the created node. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCESFailed to allocate memory. +**/ +EFI_STATUS +EFIAPI +AmlCodeGenNameUnicodeString ( + IN CONST CHAR8 *NameString, + INCHAR16 *String, + INAML_NODE_HANDLE ParentNode OPTIONAL, + OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL + ); + /** Add a _PRT entry. AmlCodeGenPrtEntry (0x0, 0, "LNKA", 0, PrtNameNode) is diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c index d7fec859ef..0eba254193 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c @@ -869,6 +869,92 @@ AmlCodeGenNameResourceTemplate ( return Status; } +/** AML code generation for a Name object node, containing a String. + + AmlCodeGenNameUnicodeString ("_STR", L"String", ParentNode, NewObjectNode) is + equivalent of the following ASL code: + Name(_STR, Unicode ("String")) + + @ingroup CodeGenApis + + @param [in] NameString The new variable name. + Must be a NULL-terminated ASL NameString + e.g.: "DEV0", "DV15.DEV0", etc. + The input string is copied. + @param [in] String NULL terminated Unicode String to associate to the + NameString. + @param [in] ParentNode If provided, set ParentNode as the parent + of the node created. + @param [out] NewObjectNode If success, contains the created node. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCESFailed to allocate memory. +**/ +EFI_STATUS +EFIAPI +AmlCodeGenNameUnicodeString ( + IN CONST CHAR8 *NameString, + INCHAR16 *String, + INAML_NODE_HANDLE ParentNode OPTIONAL, + OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL + ) +{ + EFI_STATUS Status; + AML_OBJECT_NODE *ObjectNode; + AML_DATA_NODE*DataNode; + + if ((NameString == NULL) || + (String == NULL) || + ((ParentNode == NULL) && (NewObjectNode == NULL))) + { +ASSERT (0); +return EFI_INVALID_PARAMETER; + } + + Status = AmlCodeGenBuffer (NULL, 0, &ObjectNode); + if (EFI_ERROR (Status)) { +ASSERT_EFI_ERROR (Status); +return Status; + } + + Status = AmlCreateDataNode ( + EAmlNodeDataTypeRaw, + (CONST UINT8 *)String, + StrSize (String), + &DataNode + ); + if (EFI_ERROR (Status)) { +ASSERT_EFI_ERROR (Status); +AmlDeleteTree ((AML_NODE_HEADER *)ObjectNode); +return Status; + } + + Status = AmlVarListAddTail ( + (AML_NODE_HEADER *)ObjectNode, + (AML_NODE_HEADER *)DataNode + ); + if (EFI_ERROR (Status)) { +ASSERT_EFI_ERROR (Status); +AmlDeleteTree ((AML_NODE_HEADER *)ObjectNode); +Am
[edk2-devel] [PATCH v3 3/4] DynamicTablesPkg: Add support to add Strings to package
Add API to add a String to a package created with NamedPackage API. Bug 4063340 Signed-off-by: Jeff Brasen Reviewed-by: Swatisri Kantamsetti Reviewed-by: Ashish Singhal --- .../Include/Library/AmlLib/AmlLib.h | 17 .../Common/AmlLib/CodeGen/AmlCodeGen.c| 88 +++ 2 files changed, 105 insertions(+) diff --git a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h index b82c7a3ce8..f4a4908753 100644 --- a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h +++ b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h @@ -1472,4 +1472,21 @@ AmlCreateCpcNode ( OUT AML_OBJECT_NODE_HANDLE *NewCpcNode OPTIONAL ); +/** AML code generation to add a NameString to the package in a named node. + + + @param [in] NameString NameString to add + @param [in] NamedNode Node to add the string to the included package. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCESFailed to allocate memory. +**/ +EFI_STATUS +EFIAPI +AmlAddNameStringToNamedPackage ( + IN CHAR8 *NameString, + IN AML_OBJECT_NODE_HANDLE NamedNode + ); + #endif // AML_LIB_H_ diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c index 53c537e2d3..d7fec859ef 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c @@ -3677,3 +3677,91 @@ error_handler: AmlDeleteTree ((AML_NODE_HANDLE)CpcNode); return Status; } + +/** AML code generation to add a NameString to the package in a named node. + + + @param [in] NameString NameString to add + @param [in] NamedNode Node to add the string to the included package. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCESFailed to allocate memory. +**/ +EFI_STATUS +EFIAPI +AmlAddNameStringToNamedPackage ( + IN CHAR8 *NameString, + IN AML_OBJECT_NODE_HANDLE NamedNode + ) +{ + EFI_STATUS Status; + AML_DATA_NODE *DataNode; + CHAR8 *AmlNameString; + UINT32 AmlNameStringSize; + AML_OBJECT_NODE_HANDLE PackageNode; + + DataNode = NULL; + + if ((NamedNode == NULL) || + (AmlGetNodeType ((AML_NODE_HANDLE)NamedNode) != EAmlNodeObject) || + (!AmlNodeHasOpCode (NamedNode, AML_NAME_OP, 0))) + { +ASSERT (0); +return EFI_INVALID_PARAMETER; + } + + PackageNode = (AML_OBJECT_NODE_HANDLE)AmlGetFixedArgument ( + NamedNode, + EAmlParseIndexTerm1 + ); + if ((PackageNode == NULL) || + (AmlGetNodeType ((AML_NODE_HANDLE)PackageNode) != EAmlNodeObject) || + (!AmlNodeHasOpCode (PackageNode, AML_PACKAGE_OP, 0))) + { +ASSERT (0); +return EFI_INVALID_PARAMETER; + } + + Status = ConvertAslNameToAmlName (NameString, &AmlNameString); + if (EFI_ERROR (Status)) { +ASSERT (0); +return Status; + } + + Status = AmlGetNameStringSize (AmlNameString, &AmlNameStringSize); + if (EFI_ERROR (Status)) { +ASSERT (0); +goto exit_handler; + } + + Status = AmlCreateDataNode ( + EAmlNodeDataTypeNameString, + (UINT8 *)AmlNameString, + AmlNameStringSize, + &DataNode + ); + if (EFI_ERROR (Status)) { +ASSERT (0); +goto exit_handler; + } + + Status = AmlVarListAddTail ( + (AML_NODE_HANDLE)PackageNode, + (AML_NODE_HANDLE)DataNode + ); + ASSERT_EFI_ERROR (Status); + +exit_handler: + if (AmlNameString != NULL) { +FreePool (AmlNameString); + } + + if (EFI_ERROR (Status)) { +if (DataNode != NULL) { + AmlDeleteTree ((AML_NODE_HANDLE)DataNode); +} + } + + return Status; +} -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#108502): https://edk2.groups.io/g/devel/message/108502 Mute This Topic: https://groups.io/mt/101303762/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH v3 2/4] DynamicTablesPkg: Add support for simple method invocation.
Add support to add Return objects via AML that pass a single integer argument to the named method. Bug 4063340 Signed-off-by: Jeff Brasen Reviewed-by: Swatisri Kantamsetti Reviewed-by: Ashish Singhal --- .../Include/Library/AmlLib/AmlLib.h | 54 .../Common/AmlLib/CodeGen/AmlCodeGen.c| 236 ++ 2 files changed, 290 insertions(+) diff --git a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h index d201ae9499..b82c7a3ce8 100644 --- a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h +++ b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h @@ -1194,6 +1194,60 @@ AmlCodeGenMethodRetInteger ( OUT AML_OBJECT_NODE_HANDLE *NewObjectNodeOPTIONAL ); +/** AML code generation for a method returning a NameString that takes an +integer argument. + + AmlCodeGenMethodRetNameStringIntegerArgument ( +"MET0", "MET1", 1, TRUE, 3, 5, ParentNode, NewObjectNode +); + is equivalent of the following ASL code: +Method(MET0, 1, Serialized, 3) { + Return (MET1 (5)) +} + + The ASL parameters "ReturnType" and "ParameterTypes" are not asked + in this function. They are optional parameters in ASL. + + @param [in] MethodNameString The new Method's name. +Must be a NULL-terminated ASL NameString +e.g.: "MET0", "_SB.MET0", etc. +The input string is copied. + @param [in] ReturnedNameString The name of the object returned by the +method. Optional parameter, can be: + - NULL (ignored). + - A NULL-terminated ASL NameString. + e.g.: "MET0", "_SB.MET0", etc. + The input string is copied. + @param [in] NumArgs Number of arguments. +Must be 0 <= NumArgs <= 6. + @param [in] IsSerialized TRUE is equivalent to Serialized. +FALSE is equivalent to NotSerialized. +Default is NotSerialized in ASL spec. + @param [in] SyncLevelSynchronization level for the method. +Must be 0 <= SyncLevel <= 15. +Default is 0 in ASL. + @param [in] IntegerArgument Argument to pass to the NameString. + @param [in] ParentNode If provided, set ParentNode as the parent +of the node created. + @param [out] NewObjectNodeIf success, contains the created node. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCESFailed to allocate memory. +**/ +EFI_STATUS +EFIAPI +AmlCodeGenMethodRetNameStringIntegerArgument ( + IN CONST CHAR8 *MethodNameString, + IN CONST CHAR8 *ReturnedNameString OPTIONAL, + INUINT8 NumArgs, + INBOOLEAN IsSerialized, + INUINT8 SyncLevel, + INUINT64 IntegerArgument, + INAML_NODE_HANDLE ParentNode OPTIONAL, + OUT AML_OBJECT_NODE_HANDLE *NewObjectNodeOPTIONAL + ); + /** Create a _LPI name. AmlCreateLpiNode ("_LPI", 0, 1, ParentNode, &LpiNode) is diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c index 88537b7e2d..53c537e2d3 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c @@ -1881,6 +1881,130 @@ AmlCodeGenReturnInteger ( return Status; } +/** AML code generation for a Return object node, +returning the object as an input NameString with a integer argument. + + AmlCodeGenReturn ("NAM1", 6, ParentNode, NewObjectNode) is + equivalent of the following ASL code: +Return(NAM1 (6)) + + The ACPI 6.3 specification, s20.2.5.3 "Type 1 Opcodes Encoding" states: +DefReturn := ReturnOp ArgObject +ReturnOp := 0xA4 +ArgObject := TermArg => DataRefObject + + Thus, the ReturnNode must be evaluated as a DataRefObject. It can + be a NameString referencing an object. As this CodeGen Api doesn't + do semantic checking, it is strongly advised to check the AML bytecode + generated by this function against an ASL compiler. + + The ReturnNode must be generated inside a Method body scope. + + @param [in] NameString The object referenced by this NameSt
[edk2-devel] [PATCH v3 1/4] DynamicTablesPkg: Add ThermalZone CodeGen function
Add API to generate a ThermalZone object to AmlLib. Bug 4063340 Signed-off-by: Jeff Brasen Reviewed-by: Swatisri Kantamsetti Reviewed-by: Ashish Singhal --- .../Include/Library/AmlLib/AmlLib.h | 28 + .../Common/AmlLib/CodeGen/AmlCodeGen.c| 116 ++ 2 files changed, 144 insertions(+) diff --git a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h index 9210c50915..d201ae9499 100644 --- a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h +++ b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h @@ -1038,6 +1038,34 @@ AmlCodeGenDevice ( OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL ); +/** AML code generation for a ThermalZone object node. + + AmlCodeGenThermalZone ("TZ00", ParentNode, NewObjectNode) is + equivalent of the following ASL code: +ThermalZone(TZ00) {} + + @ingroup CodeGenApis + + @param [in] NameString The new ThermalZone's name. + Must be a NULL-terminated ASL NameString + e.g.: "DEV0", "DV15.DEV0", etc. + The input string is copied. + @param [in] ParentNode If provided, set ParentNode as the parent + of the node created. + @param [out] NewObjectNode If success, contains the created node. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCESFailed to allocate memory. +**/ +EFI_STATUS +EFIAPI +AmlCodeGenThermalZone ( + IN CONST CHAR8 *NameString, + INAML_NODE_HANDLE ParentNode OPTIONAL, + OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL + ); + /** AML code generation for a Scope object node. AmlCodeGenScope ("_SB", ParentNode, NewObjectNode) is diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c index 0b223379fa..88537b7e2d 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c @@ -1218,6 +1218,122 @@ error_handler1: return Status; } +/** AML code generation for a ThermalZone object node. + + AmlCodeGenThermalZone ("TZ00", ParentNode, NewObjectNode) is + equivalent of the following ASL code: +ThermalZone(TZ00) {} + + @ingroup CodeGenApis + + @param [in] NameString The new ThermalZone's name. + Must be a NULL-terminated ASL NameString + e.g.: "DEV0", "DV15.DEV0", etc. + The input string is copied. + @param [in] ParentNode If provided, set ParentNode as the parent + of the node created. + @param [out] NewObjectNode If success, contains the created node. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCESFailed to allocate memory. +**/ +EFI_STATUS +EFIAPI +AmlCodeGenThermalZone ( + IN CONST CHAR8 *NameString, + INAML_NODE_HANDLE ParentNode OPTIONAL, + OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL + ) +{ + EFI_STATUS Status; + AML_OBJECT_NODE *ObjectNode; + AML_DATA_NODE*DataNode; + CHAR8*AmlNameString; + UINT32 AmlNameStringSize; + + if ((NameString == NULL) || + ((ParentNode == NULL) && (NewObjectNode == NULL))) + { +ASSERT (0); +return EFI_INVALID_PARAMETER; + } + + ObjectNode= NULL; + DataNode = NULL; + AmlNameString = NULL; + + Status = ConvertAslNameToAmlName (NameString, &AmlNameString); + if (EFI_ERROR (Status)) { +ASSERT (0); +return Status; + } + + Status = AmlGetNameStringSize (AmlNameString, &AmlNameStringSize); + if (EFI_ERROR (Status)) { +ASSERT (0); +goto error_handler1; + } + + Status = AmlCreateObjectNode ( + AmlGetByteEncodingByOpCode (AML_EXT_OP, AML_EXT_THERMAL_ZONE_OP), + AmlNameStringSize + AmlComputePkgLengthWidth (AmlNameStringSize), + &ObjectNode + ); + if (EFI_ERROR (Status)) { +ASSERT (0); +goto error_handler1; + } + + Status = AmlCreateDataNode ( + EAmlNodeDataTypeNameString, + (UINT8 *)AmlNameString, + AmlNameStringSize, + &DataNode + ); + if (EFI_ERROR (Status)) { +ASSERT (0); +goto error_handler2; + } + + Status = AmlSetFixedArgument ( + ObjectNode, + EAmlParseIndexTerm0, + (AML_NODE_HEADER *)DataNode + ); + if (EFI_ERROR (S
[edk2-devel] [PATCH 1/2] DynamicTablesPkg: AML Code generation for I/O ranges
From: Vidya Sagar Add helper functions to generate AML Resource Data describing I/O ranges of four words long. API AmlCodeGenRdQWordIo () is exposed. Reviewed-by: Shanker Donthineni Signed-off-by: Vidya Sagar Signed-off-by: Jeff Brasen --- .../Include/Library/AmlLib/AmlLib.h | 67 ++ .../AmlLib/CodeGen/AmlResourceDataCodeGen.c | 90 +++ 2 files changed, 157 insertions(+) diff --git a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h index 9210c5091548..8e24cecdd77b 100644 --- a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h +++ b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h @@ -683,6 +683,73 @@ AmlCodeGenRdWordBusNumber ( OUT AML_DATA_NODE_HANDLE*NewRdNode OPTIONAL ); +/** Code generation for the "QWordIO ()" ASL function. + + The Resource Data effectively created is a QWord Address Space Resource + Data. Cf ACPI 6.4: + - s6.4.3.5.1 "QWord Address Space Descriptor". + - s19.6.109 "QWordIO". + + The created resource data node can be: + - appended to the list of resource data elements of the NameOpNode. + In such case NameOpNode must be defined by a the "Name ()" ASL statement + and initially contain a "ResourceTemplate ()". + - returned through the NewRdNode parameter. + + See ACPI 6.4 spec, s19.6.109 for more. + + @param [in] IsResourceConsumer ResourceUsage parameter. + @param [in] IsMinFixed Minimum address is fixed. + @param [in] IsMaxFixed Maximum address is fixed. + @param [in] IsPosDecode Decode parameter + @param [in] IsaRangesPossible values are: + 0-Reserved + 1-NonISAOnly + 2-ISAOnly + 3-EntireRange + @param [in] AddressGranularity Address granularity. + @param [in] AddressMinimum Minimum address. + @param [in] AddressMaximum Maximum address. + @param [in] AddressTranslation Address translation. + @param [in] RangeLength Range length. + @param [in] ResourceSourceIndex Resource Source index. +Unused. Must be 0. + @param [in] ResourceSource Resource Source. +Unused. Must be NULL. + @param [in] IsDenseTranslation TranslationDensity parameter. + @param [in] IsTypeStatic TranslationType parameter. + @param [in] NameOpNode NameOp object node defining a named object. +If provided, append the new resource data +node to the list of resource data elements +of this node. + @param [out] NewRdNodeIf provided and success, +contain the created node. + + @retval EFI_SUCCESS The function completed successfully. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCESCould not allocate memory. +**/ +EFI_STATUS +EFIAPI +AmlCodeGenRdQWordIo ( + INBOOLEAN IsResourceConsumer, + INBOOLEAN IsMinFixed, + INBOOLEAN IsMaxFixed, + INBOOLEAN IsPosDecode, + INUINT8 IsaRanges, + INUINT64 AddressGranularity, + INUINT64 AddressMinimum, + INUINT64 AddressMaximum, + INUINT64 AddressTranslation, + INUINT64 RangeLength, + INUINT8 ResourceSourceIndex, + IN CONST CHAR8 *ResourceSource, + INBOOLEAN IsDenseTranslation, + INBOOLEAN IsTypeStatic, + INAML_OBJECT_NODE_HANDLE NameOpNode, OPTIONAL + OUT AML_DATA_NODE_HANDLE*NewRdNode OPTIONAL + ); + /** Code generation for the "QWordMemory ()" ASL function. The Resource Data effectively created is a QWord Address Space Resource diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeGen.c b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeGen.c index 4ca63ccd2396..9c6700b9e08c 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeGen.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeGen.c @@ -1012,6 +1012,96 @@ AmlCodeGenRdQWordSpace ( return LinkRdNode (RdNode, NameOpNode, NewRdNode); } +/** Code generation for the "QWordIO ()" ASL function. + + The Resource Data effectively created is a QWord Address Space Resource + Data. Cf ACPI 6.4: + - s6.4.3.5.1 "QWord Address Space Descriptor". + - s19.6.109 "QWordIO". + + The created resource data node can be: + - appended to the list of resource data elements of the NameOpNode. + In such case NameOpNode must be defined by a the "Name ()" ASL statement + and initially contain a "ResourceTemplate ()"