Re: [edk2-devel] edk2-test Release candidate 2: edk2-test-rc2_202405

2024-05-05 Thread Heinrich Schuchardt

On 5/4/24 01:47, G Edhaya Chandran wrote:

Hi All,
    A new release candidate is published after upstreaming Stuart's 
commits on build cleanup.
_https://github.com/tianocore/edk2-test/tree/edk2-test-rc2_202405_ 

The updates since the old tag are the following commits in the patch 
series:
_[PATCH v2 0/4] TCG2 protocol clean up (groups.io)_ 


The release candidate may be used for any further testing.
With Warm Regards,
Edhay


Hello Edhaya,

I am not allowed to create the folder structure for uploading the test 
results.


Could you, please, create it and inform us.

Best regards

Heinrich


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#118576): https://edk2.groups.io/g/devel/message/118576
Mute This Topic: https://groups.io/mt/105929926/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/4] TCG2 protocol clean up

2024-04-22 Thread Heinrich Schuchardt

On 4/16/24 16:53, Stuart Yoder wrote:

This patch series cleans up some issues found when building edk2-test with
a non-GCC compiler:
   -TPMT_HA struct had an error due to incorrect use of C flexible array member
   -compute struct member offsets using OFFSET_OF, which is not GCC specific
   -clean up of #pragma pack in one file
   -resolve type conversion warnings

Patches are in github here:
https://github.com/stuyod01/edk2-test/tree/tcg2-cleanup

Version 2
   -add SM3 hash type to TPM2.h
   -resolve type conversion warnings

Stuart Yoder (4):
   uefi-sct/SctPkg: TCG2 Protocol: correct definition of TPMT_HA struct
   uefi-sct/SctPkg: TCG2 Protocol: use OFFSET_OF for computing offsets
   uefi-sct/SctPkg: TCG2 Protocol: #pragma pack cleanup
   uefi-sct/SctPkg: TCG2 Protocol: clean up type conversion warnings

  
uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/TCG2/BlackBoxTest/TCG2ProtocolBBTest.h
|  3 +--
  uefi-sct/SctPkg/UEFI/Protocol/TCG2.h  
   | 17 +++--
  
uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/TCG2/BlackBoxTest/TCG2ProtocolBBTestConformance.c
 | 25 +---
  3 files changed, 27 insertions(+), 18 deletions(-)



Hello Edhaya,

Will we have another release candidate with these patches included?

Best regards

Heinrich



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#118101): https://edk2.groups.io/g/devel/message/118101
Mute This Topic: https://groups.io/mt/105558005/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH v1 3/3] uefi-sct/SctPkg: TCG2 Protocol: #pragma pack cleanup

2024-04-16 Thread Heinrich Schuchardt

On 4/16/24 00:23, Stuart Yoder wrote:

Fix compiler warning by adding #pragma pack() to close a pragma
section.  Also delete extraneous #pragma pack(1).

Signed-off-by: Stuart Yoder 


Reviewed-by: Heinrich Schuchardt 


---
  
uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/TCG2/BlackBoxTest/TCG2ProtocolBBTest.h
 | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)

diff --git 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/TCG2/BlackBoxTest/TCG2ProtocolBBTest.h
 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/TCG2/BlackBoxTest/TCG2ProtocolBBTest.h
index deba13f21804..95307b7fa50f 100644
--- 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/TCG2/BlackBoxTest/TCG2ProtocolBBTest.h
+++ 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/TCG2/BlackBoxTest/TCG2ProtocolBBTest.h
@@ -79,7 +79,6 @@ typedef struct {
UINT8  buffer[TEST_STRING_LEN];
  } TPM2B_MAX_BUFFER;
  
-#pragma pack(1)

  // TPM2B_DIGEST as defined in Table 73 of TPM Library Spec Part 2: Structures
  typedef struct {
UINT16 size;
@@ -110,7 +109,7 @@ typedef struct {
TPM2B_DIGEST data;
TPMT_TK_HASHCHECK validation;
  } TPM2_HASH_RESPONSE;
-#pragma
+#pragma pack()
  
  EFI_STATUS

  EFIAPI




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#117851): https://edk2.groups.io/g/devel/message/117851
Mute This Topic: https://groups.io/mt/105546457/21656
Mute #pragma:https://edk2.groups.io/g/devel/mutehashtag/pragma
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH v1 1/3] uefi-sct/SctPkg: TCG2 Protocol: correct definition of TPMT_HA struct

2024-04-16 Thread Heinrich Schuchardt

On 4/16/24 00:23, Stuart Yoder wrote:

The TPMT_HA struct defining event log hash algorithms was cut/pasted
from the TCG EFI Protocol specification which used a C struct
with a flexible array member as the last element.  This is incorrect
because TPMT_HA itself is used as an array element, and thus can't
be variable size.

Because the size of hash algorithms varies, this should have been
defined as a union of the sizes of supported hash algorithms.  This is
how is it done in the TPM Library specfication and in EDK2.

Signed-off-by: Stuart Yoder 
---
  uefi-sct/SctPkg/UEFI/Protocol/TCG2.h | 13 -
  1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/uefi-sct/SctPkg/UEFI/Protocol/TCG2.h 
b/uefi-sct/SctPkg/UEFI/Protocol/TCG2.h
index a83a84c33134..e42b8b347c05 100644
--- a/uefi-sct/SctPkg/UEFI/Protocol/TCG2.h
+++ b/uefi-sct/SctPkg/UEFI/Protocol/TCG2.h
@@ -51,6 +51,10 @@ Abstract:
  #define EFI_TCG2_EVENT_LOG_FORMAT_TCG_2 0x0002
  
  #define HASH_NUMBER 0x04

+#define SHA1_DIGEST_SIZE20
+#define SHA256_DIGEST_SIZE  32


We should follow the TCG EFI Protocol Specification and support ShangMi 
3 in the test too.


#define SM3_256_DIGEST_SIZE  32


+#define SHA384_DIGEST_SIZE  48
+#define SHA512_DIGEST_SIZE  64
  
  typedef struct _EFI_TCG2_PROTOCOL EFI_TCG2_PROTOCOL;
  
@@ -117,9 +121,16 @@ typedef struct tdEFI_TCG2_EVENT {

UINT8 Event[];
  } EFI_TCG2_EVENT;
  
+typedef union {

+  UINT8 sha1[SHA1_DIGEST_SIZE];
+  UINT8 sha256[SHA256_DIGEST_SIZE];


UINT8 sm3_256[SM3_256_DIGEST_SIZE];

Best regards

Heinrich


+  UINT8 sha384[SHA384_DIGEST_SIZE];
+  UINT8 sha512[SHA512_DIGEST_SIZE];
+} TPMU_HA;
+
  typedef struct {
UINT16 hashAlg;
-  UINT8  digest[];
+  TPMU_HAdigest;
  } TPMT_HA;
  
  typedef struct tdTPML_DIGEST_VALUES {




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#117850): https://edk2.groups.io/g/devel/message/117850
Mute This Topic: https://groups.io/mt/105546455/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/1] OvmfPkg: OVMF supports USB mouses

2024-04-06 Thread Heinrich Schuchardt
From: Phillip Tennen 

From: Phillip Tennen 

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4747

UsbMouseDxe was missing from the OVMF build description, so=20
the Simple Pointer Protocol wasn't usable from within QEMU.

Here's an example of someone getting tripped up by this:
https://forum.osdev.org/viewtopic.php?f=1=31572.

Signed-off-by: Phillip Tennen 
Reviewed-by: Heinrich Schuchardt 
---
v2:
fix formatting problems leading to the patch not being applicable
move both insertions below UsbKbDxe
update commit message
---
 OvmfPkg/OvmfPkgX64.dsc | 1 +
 OvmfPkg/OvmfPkgX64.fdf | 1 +
 2 files changed, 2 insertions(+)

diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index 56c920168d25..b775db6e0919 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -952,6 +952,7 @@ [Components]
   MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf
   MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe.inf
   MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf
+  MdeModulePkg/Bus/Usb/UsbMouseDxe/UsbMouseDxe.inf
   MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
 
 !include OvmfPkg/Include/Dsc/ShellComponents.dsc.inc
diff --git a/OvmfPkg/OvmfPkgX64.fdf b/OvmfPkg/OvmfPkgX64.fdf
index eb3fb90cb8b6..bfe201a352d0 100644
--- a/OvmfPkg/OvmfPkgX64.fdf
+++ b/OvmfPkg/OvmfPkgX64.fdf
@@ -342,6 +342,7 @@ [FV.DXEFV]
 INF  MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf
 INF  MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe.inf
 INF  MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf
+INF  MdeModulePkg/Bus/Usb/UsbMouseDxe/UsbMouseDxe.inf
 INF  MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
 
 INF  OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf
-- 
2.43.0



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#117467): https://edk2.groups.io/g/devel/message/117467
Mute This Topic: https://groups.io/mt/105365480/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH] OvmfPkg: OVMF supports USB mouses

2024-04-05 Thread Heinrich Schuchardt

On 05.04.24 14:58, phil...@axleos.com wrote:

From: Phillip Tennen 

UsbMouseDxe was missing from the OVMF build description, so
the Simple Pointer Protocol wasn't usable from within QEMU.

Here's an example of somone getting tripped up by this:
https://forum.osdev.org/viewtopic.php?f=1=31572.

I worked around this by including the below patch in my local
builds, and was encouraged by Heinrich Schuchardt to submit a patch.

I have not contributed to this project before, so please accept
my apologies if I've formatted anything incorrect. All the best.

Signed-off-by: Phillip Tennen 

---
  OvmfPkg/OvmfPkgX64.dsc | 1 +
  OvmfPkg/OvmfPkgX64.fdf | 1 +
  2 files changed, 2 insertions(+)

diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index 56c920168d..d76a263859 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -953,6 +953,7 @@
MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe.inf
MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf
MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
+  MdeModulePkg/Bus/Usb/UsbMouseDxe/UsbMouseDxe.inf


Thank you Phillip for your contribution.

https://github.com/tianocore/tianocore.github.io/wiki/Code-Contributions 
provides some guidance for contributing.


Currently applying the patch fails:

$ git am --keep-cr /tmp/\[PATCH\]\ OvmfPkg\:\ OVMF\ supports\ USB\ 
mouses\ -\ phil...@axleos.com\ -\ 2024-04-05\ 1458.eml

warning: quoted CRLF detected
Applying: OvmfPkg: OVMF supports USB mouses
.git/rebase-apply/patch:14: trailing whitespace.
  MdeModulePkg/Bus/Usb/UsbMouseDxe/UsbMouseDxe.inf
.git/rebase-apply/patch:26: trailing whitespace.
INF  MdeModulePkg/Bus/Usb/UsbMouseDxe/UsbMouseDxe.inf
error: patch failed: OvmfPkg/OvmfPkgX64.dsc:953
error: OvmfPkg/OvmfPkgX64.dsc: patch does not apply
error: patch failed: OvmfPkg/OvmfPkgX64.fdf:342
error: OvmfPkg/OvmfPkgX64.fdf: patch does not apply
Patch failed at 0001 OvmfPkg: OVMF supports USB mouses

I guess this is due to line endings.

Please, run 'python3 BaseTools/Scripts/SetupGit.py' in your git 
repository to set it up to match the Tianocore submission style, e.g.


[sendemail]
transferEncoding = 8bit

Please, align to the existing indentation.

For consistency it would be preferable to add both lines in the same 
place under UsbKbDxe.inf.


The change looks correct and the USB mouse works fine when testing with 
your IRC application.


File Maintainers contains the list of people that should be CCed on 
mails with OvmfPkg patches.


Best regards

Heinrich

  
  !include OvmfPkg/Include/Dsc/ShellComponents.dsc.inc
  
diff --git a/OvmfPkg/OvmfPkgX64.fdf b/OvmfPkg/OvmfPkgX64.fdf

index eb3fb90cb8..bfe201a352 100644
--- a/OvmfPkg/OvmfPkgX64.fdf
+++ b/OvmfPkg/OvmfPkgX64.fdf
@@ -342,6 +342,7 @@ INF  MdeModulePkg/Bus/Pci/EhciDxe/EhciDxe.inf
  INF  MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf
  INF  MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe.inf
  INF  MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf
+INF  MdeModulePkg/Bus/Usb/UsbMouseDxe/UsbMouseDxe.inf
  INF  MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
  
  INF  OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#117458): https://edk2.groups.io/g/devel/message/117458
Mute This Topic: https://groups.io/mt/105348119/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH] OvmfPkg: OVMF supports USB mouses

2024-04-05 Thread Heinrich Schuchardt

On 05.04.24 14:58, phil...@axleos.com wrote:

From: Phillip Tennen 

UsbMouseDxe was missing from the OVMF build description, so
the Simple Pointer Protocol wasn't usable from within QEMU.

Here's an example of somone getting tripped up by this:
https://forum.osdev.org/viewtopic.php?f=1=31572.

I worked around this by including the below patch in my local
builds, and was encouraged by Heinrich Schuchardt to submit a patch.

I have not contributed to this project before, so please accept
my apologies if I've formatted anything incorrect. All the best.

Signed-off-by: Phillip Tennen 

---
  OvmfPkg/OvmfPkgX64.dsc | 1 +
  OvmfPkg/OvmfPkgX64.fdf | 1 +
  2 files changed, 2 insertions(+)

diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index 56c920168d..d76a263859 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -953,6 +953,7 @@
MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe.inf
MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf
MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
+  MdeModulePkg/Bus/Usb/UsbMouseDxe/UsbMouseDxe.inf


Thank you Phillip for contributing.

https://github.com/tianocore/tianocore.github.io/wiki/Code-Contributions
has some information on the contribution process.

Currently applying the patch in this mail fails:

git am --keep-cr '[PATCH] OvmfPkg: OVMF supports USB mouses - 
phil...@axleos.com - 2024-04-05 1458.eml'


warning: quoted CRLF detected
Applying: OvmfPkg: OVMF supports USB mouses
.git/rebase-apply/patch:14: trailing whitespace.
  MdeModulePkg/Bus/Usb/UsbMouseDxe/UsbMouseDxe.inf
.git/rebase-apply/patch:26: trailing whitespace.
INF  MdeModulePkg/Bus/Usb/UsbMouseDxe/UsbMouseDxe.inf
error: patch failed: OvmfPkg/OvmfPkgX64.dsc:953
error: OvmfPkg/OvmfPkgX64.dsc: patch does not apply
error: patch failed: OvmfPkg/OvmfPkgX64.fdf:342
error: OvmfPkg/OvmfPkgX64.fdf: patch does not apply
Patch failed at 0001 OvmfPkg: OVMF supports USB mouses

I guess it is just a problem with the line endings.

Please, run 'python3 BaseTools/Scripts/SetupGit.py' once. This will set 
up your git repository with the Tianocore defaults for submitting patches.


It would be preferable to match the existing indentation.

Maybe make both insertions at the same place under UsbKbDxe.inf.

Otherwise looks good to me and works fine: The USB mouse is usable in 
your IRC application.


The file 'Maintainers' has a list of the persons that should be CCed for 
OvmfPkg patches.


Best regards

Heinrich

  
  !include OvmfPkg/Include/Dsc/ShellComponents.dsc.inc
  
diff --git a/OvmfPkg/OvmfPkgX64.fdf b/OvmfPkg/OvmfPkgX64.fdf

index eb3fb90cb8..bfe201a352 100644
--- a/OvmfPkg/OvmfPkgX64.fdf
+++ b/OvmfPkg/OvmfPkgX64.fdf
@@ -342,6 +342,7 @@ INF  MdeModulePkg/Bus/Pci/EhciDxe/EhciDxe.inf
  INF  MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf
  INF  MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe.inf
  INF  MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf
+INF  MdeModulePkg/Bus/Usb/UsbMouseDxe/UsbMouseDxe.inf
  INF  MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
  
  INF  OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#117457): https://edk2.groups.io/g/devel/message/117457
Mute This Topic: https://groups.io/mt/105348119/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 v2] SctPkg: Fixed a pinter error in DevicePathFromTextBBTestCoverage.c

2024-02-27 Thread Heinrich Schuchardt

On 27.02.24 07:37, Chao Li wrote:

DevicePathFromTextBBTextCoverage.c function CreateDNSDeviceNode has a
bug, code:

SctStrToIPv4Addr (, (EFI_IPv4_ADDRESS *)(DNS + sizeof 
(DNS_DEVICE_PATH)));

DNS is a pointer, which is increased by a structure size and converted
to EFI_IPv4_ADDRESS*, which will point to an unknown address. So fix it.

Fixes: 847e0363e846 ("SctPkg: Fix the UefiSct-Wincompatible-pointer-types 
warnings")

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4712

Cc: G Edhaya Chandran 
Cc: Barton Gao 
Cc: Carolyn Gjertsen 
Cc: Samer El-Haj-Mahmoud 
Cc: Eric Jin 
Cc: Arvin Chen 
Cc: Supreeth Venkatesh 
Cc: Heinrich Schuchardt 
Signed-off-by: Chao Li 
---
  .../BlackBoxTest/DevicePathFromTextBBTestCoverage.c   | 8 
  1 file changed, 4 insertions(+), 4 deletions(-)

diff --git 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DevicePathFromText/BlackBoxTest/DevicePathFromTextBBTestCoverage.c
 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DevicePathFromText/BlackBoxTest/DevicePathFromTextBBTestCoverage.c
index c96ee246..bd11c25a 100644
--- 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DevicePathFromText/BlackBoxTest/DevicePathFromTextBBTestCoverage.c
+++ 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DevicePathFromText/BlackBoxTest/DevicePathFromTextBBTestCoverage.c
@@ -1734,13 +1734,13 @@ CreateDNSDeviceNode (
}
  
if (DNS->IsIPv6 == 0) {

-SctStrToIPv4Addr (, (EFI_IPv4_ADDRESS *)(DNS + sizeof 
(DNS_DEVICE_PATH)));
-SctStrToIPv4Addr (, (EFI_IPv4_ADDRESS *)(DNS + sizeof 
(DNS_DEVICE_PATH) + sizeof(EFI_IP_ADDRESS)));
+SctStrToIPv4Addr (, (EFI_IPv4_ADDRESS *)((UINT8 *)DNS + sizeof 
(DNS_DEVICE_PATH)));
+SctStrToIPv4Addr (, (EFI_IPv4_ADDRESS *)((UINT8 *)DNS + sizeof 
(DNS_DEVICE_PATH) + sizeof(EFI_IP_ADDRESS)));
}
  
if (DNS->IsIPv6 == 1) {

-SctStrToIPv6Addr (, (EFI_IPv6_ADDRESS *)(DNS + sizeof 
(DNS_DEVICE_PATH)));
-SctStrToIPv6Addr (, (EFI_IPv6_ADDRESS *)(DNS + sizeof 
(DNS_DEVICE_PATH) + sizeof(EFI_IP_ADDRESS)));
+SctStrToIPv6Addr (, (EFI_IPv6_ADDRESS *)((UINT8 *)DNS + sizeof 
(DNS_DEVICE_PATH)));
+SctStrToIPv6Addr (, (EFI_IPv6_ADDRESS *)((UINT8 *)DNS + sizeof 
(DNS_DEVICE_PATH) + sizeof(EFI_IP_ADDRESS)));
}
  
return (EFI_DEVICE_PATH_PROTOCOL *) DNS;


Reviewed-by: Heinrich Schuchardt 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#116044): https://edk2.groups.io/g/devel/message/116044
Mute This Topic: https://groups.io/mt/104598721/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH v1] SctPkg: Fixed a pinter error in DevicePathFromTextBBTestCoverage.c

2024-02-26 Thread Heinrich Schuchardt

On 26.02.24 11:17, Chao Li wrote:

DevicePathFromTextBBTextCoverage.c function CreateDNSDeviceNode has a
bug, code:

SctStrToIPv4Addr (, (EFI_IPv4_ADDRESS *)(DNS + sizeof 
(DNS_DEVICE_PATH)));

DNS is a pointer, which is increased by a structure size and converted
to EFI_IPv4_ADDRESS*, which will point to an unknown address. So fix it.


Hello Chao,

thanks for diving into this.

Please, add

Fixes: 847e0363e846 ("SctPkg: Fix the UefiSct 
-Wincompatible-pointer-types warnings")




BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4712

Cc: G Edhaya Chandran 
Cc: Barton Gao 
Cc: Carolyn Gjertsen 
Signed-off-by: Chao Li 
---
  .../BlackBoxTest/DevicePathFromTextBBTestCoverage.c   | 8 
  1 file changed, 4 insertions(+), 4 deletions(-)

diff --git 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DevicePathFromText/BlackBoxTest/DevicePathFromTextBBTestCoverage.c
 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DevicePathFromText/BlackBoxTest/DevicePathFromTextBBTestCoverage.c
index c96ee246..bd11c25a 100644
--- 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DevicePathFromText/BlackBoxTest/DevicePathFromTextBBTestCoverage.c
+++ 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DevicePathFromText/BlackBoxTest/DevicePathFromTextBBTestCoverage.c
@@ -1734,13 +1734,13 @@ CreateDNSDeviceNode (
}

if (DNS->IsIPv6 == 0) {
-SctStrToIPv4Addr (, (EFI_IPv4_ADDRESS *)(DNS + sizeof 
(DNS_DEVICE_PATH)));
-SctStrToIPv4Addr (, (EFI_IPv4_ADDRESS *)(DNS + sizeof 
(DNS_DEVICE_PATH) + sizeof(EFI_IP_ADDRESS)));
+SctStrToIPv4Addr (, (EFI_IPv4_ADDRESS *)((UINT8 *)DNS + sizeof 
(DNS_DEVICE_PATH)));
+SctStrToIPv4Addr (, (EFI_IPv4_ADDRESS *)((UINT8 *)DNS + sizeof 
(DNS_DEVICE_PATH) + sizeof(EFI_IP_ADDRESS)));
}

if (DNS->IsIPv6 == 1) {
-SctStrToIPv6Addr (, (EFI_IPv6_ADDRESS *)(DNS + sizeof 
(DNS_DEVICE_PATH)));
-SctStrToIPv6Addr (, (EFI_IPv6_ADDRESS *)(DNS + sizeof 
(DNS_DEVICE_PATH) + sizeof(EFI_IP_ADDRESS)));
+SctStrToIPv6Addr (, (EFI_IPv6_ADDRESS *)((UINT8 *)DNS + sizeof 
(DNS_DEVICE_PATH)));
+SctStrToIPv6Addr (, (EFI_IPv6_ADDRESS *)((UINT8 *)DNS + sizeof 
(DNS_DEVICE_PATH) + sizeof(EFI_IP_ADDRESS)));


The change looks correct.

I would prefer using the fields of the DNS_DEVICE_PATH typedef from 
MdePkg/Include/Protocol/DevicePath.h to avoid the conversions:


> +SctStrToIPv4Addr (, >DnsServerIp[0].v4)
> +SctStrToIPv4Addr (, >DnsServerIp[1].v4)

> +SctStrToIPv6Addr (, >DnsServerIp[0].v6)
> +SctStrToIPv6Addr (, >DnsServerIp[1].v6)

Best regards

Heinrich


}

return (EFI_DEVICE_PATH_PROTOCOL *) DNS;
--
2.27.0




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115949): https://edk2.groups.io/g/devel/message/115949
Mute This Topic: https://groups.io/mt/104579419/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH v1 1/6] uefi-sct/SctPkg: TCG2 Protocol: add header with TCG2 protocol definitions

2023-12-18 Thread Heinrich Schuchardt

On 12/15/23 00:39, Stuart Yoder wrote:

From: Joseph Hemann 


Please, provide commit messages.



Signed-off-by: Joseph Hemann 
Signed-off-by: Stuart Yoder 
---
  uefi-sct/SctPkg/UEFI/Protocol/TCG2.h | 179 
  1 file changed, 179 insertions(+)

diff --git a/uefi-sct/SctPkg/UEFI/Protocol/TCG2.h 
b/uefi-sct/SctPkg/UEFI/Protocol/TCG2.h
new file mode 100644
index ..659c61a741e7
--- /dev/null
+++ b/uefi-sct/SctPkg/UEFI/Protocol/TCG2.h
@@ -0,0 +1,179 @@
+/** @file
+
+  Copyright 2006 - 2016 Unified EFI, Inc.
+  Copyright (c) 2013 - 2016, Intel Corporation. All rights reserved.
+  Copyright (c) 2021 - 2023, Arm Inc. All rights reserved.
+
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD 
License
+  which accompanies this distribution.  The full text of the license may be 
found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+/*++
+
+Module Name:
+
+  TCG2.h
+
+Abstract:
+
+  EFI TCG Protocol
+
+--*/
+
+
+#ifndef __TCG2_PROTOCOL_H__
+#define __TCG2_PROTOCOL_H__
+
+//
+// Global ID for the TCG2 Protocol
+//
+#define EFI_TCG2_PROTOCOL_GUID\
+   {0x607f766c, 0x7455, 0x42be, {0x93, 0x0b, 0xe4, 0xd7, 0x6d, 0xb2, 0x72, 
0x0f}}
+
+// Following defintions come from TCG2 Efi Protocol Spec
+#define EFI_TCG2_BOOT_HASH_ALG_SHA1 0x0001
+
+#define EFI_TCG2_BOOT_HASH_ALG_SHA256 0x0002
+
+#define EFI_TCG2_BOOT_HASH_ALG_SHA384 0x0004
+
+#define EFI_TCG2_BOOT_HASH_ALG_SHA512 0x0008
+
+#define EFI_TCG2_BOOT_HASH_ALG_SM3_256 0x0010
+
+#define EFI_TCG2_EVENT_LOG_FORMAT_TCG_1_2 0x0001
+
+#define EFI_TCG2_EVENT_LOG_FORMAT_TCG_2 0x0002
+
+typedef struct _EFI_TCG2_PROTOCOL EFI_TCG2_PROTOCOL;
+
+typedef UINT64 EFI_PHYSICAL_ADDRESS;


EFI_PHYSICAL_ADDRESS already is used in edk2-test. We should avoid 
duplicate definitions.


This type is not TCG2 specific and hence should be defined in a 
different include.


Best regards

Heinrich


+
+typedef UINT32 EFI_TCG2_EVENT_LOG_BITMAP;
+
+typedef UINT32 EFI_TCG2_EVENT_LOG_FORMAT;
+
+typedef UINT32 EFI_TCG2_EVENT_ALGORITHM_BITMAP;
+
+typedef UINT32 TCG_PCRINDEX;
+
+typedef UINT32 TCG_EVENTTYPE;
+
+// Following struct defintions come from TCG2 Efi Protocol Spec
+typedef struct {
+  UINT8 Major;
+  UINT8 Minor;
+} EFI_TCG2_VERSION;
+
+typedef struct {
+  UINT8 Size;
+  EFI_TCG2_VERSION StructureVersion;
+  EFI_TCG2_VERSION ProtocolVersion;
+  EFI_TCG2_EVENT_ALGORITHM_BITMAP HashAlgorithmBitmap;
+  EFI_TCG2_EVENT_LOG_BITMAP SupportedEventLogs;
+  BOOLEAN TPMPresentFlag;
+  UINT16 MaxCommandSize;
+  UINT16 MaxResponseSize;
+  UINT32 ManufacturerID;
+  UINT32 NumberOfPcrBanks;
+  EFI_TCG2_EVENT_ALGORITHM_BITMAP ActivePcrBanks;
+} EFI_TCG2_BOOT_SERVICE_CAPABILITY;
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_TCG2_GET_CAPABILITY) (
+  IN EFI_TCG2_PROTOCOL *This,
+  IN OUT EFI_TCG2_BOOT_SERVICE_CAPABILITY *ProtocolCapability
+);
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_TCG2_GET_EVENT_LOG) (
+  IN EFI_TCG2_PROTOCOL *This,
+  IN EFI_TCG2_EVENT_LOG_FORMAT EventLogFormat,
+  OUT EFI_PHYSICAL_ADDRESS *EventLogLocation,
+  OUT EFI_PHYSICAL_ADDRESS *EventLogLastEntry,
+  OUT BOOLEAN *EventLogTruncated
+);
+
+// all structs except EFI_TCG2_BOOT_SERVICE_CAPABILITY are packed
+#pragma pack(1)
+
+typedef struct tdEFI_TCG2_EVENT_HEADER {
+  UINT32 HeaderSize;
+  UINT16 HeaderVersion;
+  TCG_PCRINDEX PCRIndex;
+  TCG_EVENTTYPE EventType;
+} EFI_TCG2_EVENT_HEADER;
+
+typedef struct tdEFI_TCG2_EVENT {
+  UINT32 Size;
+  EFI_TCG2_EVENT_HEADER Header;
+  UINT8 Event[];
+} EFI_TCG2_EVENT;
+
+#pragma pack()
+
+typedef
+EFI_STATUS
+(EFIAPI * EFI_TCG2_HASH_LOG_EXTEND_EVENT) (
+  IN EFI_TCG2_PROTOCOL *This,
+  IN UINT64 Flags,
+  IN EFI_PHYSICAL_ADDRESS DataToHash,
+  IN UINT64 DataToHashLen,
+  IN EFI_TCG2_EVENT *EfiTcgEvent
+);
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_TCG2_SUBMIT_COMMAND) (
+  IN EFI_TCG2_PROTOCOL *This,
+  IN UINT32 InputParameterBlockSize,
+  IN UINT8 *InputParameterBlock,
+  IN UINT32 OutputParameterBlockSize,
+  IN UINT8 *OutputParameterBlock
+);
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_TCG2_GET_ACTIVE_PCR_BANKS) (
+  IN EFI_TCG2_PROTOCOL *This,
+  OUT UINT32 *ActivePcrBanks
+);
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_TCG2_SET_ACTIVE_PCR_BANKS) (
+  IN EFI_TCG2_PROTOCOL *This,
+  IN UINT32 ActivePcrBanks
+);
+
+typedef
+EFI_STATUS
+(EFIAPI * EFI_TCG2_GET_RESULT_OF_SET_ACTIVE_PCR_BANKS) (
+  IN EFI_TCG2_PROTOCOL *This,
+  OUT UINT32 *OperationPresent,
+  OUT UINT32 *Response
+);
+
+//
+// Interface structure for the TCG2 Protocol
+//
+struct _EFI_TCG2_PROTOCOL {
+  EFI_TCG2_GET_CAPABILITY GetCapability;
+  EFI_TCG2_GET_EVENT_LOG GetEventLog;
+  EFI_TCG2_HASH_LOG_EXTEND_EVENT HashLogExtendEvent;
+  EFI_TCG2_SUBMIT_COMMAND SubmitCommand;
+  EFI_TCG2_GET_ACTIVE_PCR_BANKS GetActivePcrBanks;
+  EFI_TCG2_SET_ACTIVE_PCR_BANKS 

Re: [edk2-devel] [PATCH v1] EmbeddedPkg/NorFlashInfoLib: Update norflash device list

2023-10-20 Thread Heinrich Schuchardt

On 20.10.23 11:49, Laszlo Ersek wrote:

On 10/18/23 10:57, Ard Biesheuvel wrote:

On Wed, 18 Oct 2023 at 10:49, YuinYee Chew
  wrote:

Dear Maintainers,

Just a friendly reminder to ask if you could take a look at my patch. I'd 
really appreciate your feedback and help.


Thanks for the reminder. I don't have time to review this myself but
I'm happy to merge it if someone else reviews it

Heinrich gave an Acked-by up-thread.

(I'd just go ahead and merge this myself to help you out a bit, but I
don't have access to the original patch!)

Laszlo


See appendix.

Best regards

Heinrich


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#109846): https://edk2.groups.io/g/devel/message/109846
Mute This Topic: https://groups.io/mt/101660590/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


--- Begin Message ---
Update Gigadevice norflash list:
gd25q16, gd25q32, gd25q64, gd25lq64c, gd25q128, gd25lq128, gd25q256

Add Silicon Kaiser norflash list:
sk25lp128

Cc: Sunil V L 
Cc: Li Yong 
Cc: Heinrich Schuchardt 
Cc: Leif Lindholm 
Cc: Ard Biesheuvel 
Cc: Abner Chang 
Cc: Daniel Schaefer 
Signed-off-by: John Chew 
---
 EmbeddedPkg/Library/NorFlashInfoLib/NorFlashInfoLib.c | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/EmbeddedPkg/Library/NorFlashInfoLib/NorFlashInfoLib.c 
b/EmbeddedPkg/Library/NorFlashInfoLib/NorFlashInfoLib.c
index e16c1c6a14..422fdac851 100644
--- a/EmbeddedPkg/Library/NorFlashInfoLib/NorFlashInfoLib.c
+++ b/EmbeddedPkg/Library/NorFlashInfoLib/NorFlashInfoLib.c
@@ -1,6 +1,7 @@
 /** @file
 *
 *  Copyright (c) 2017 Marvell International Ltd.
+*  Copyright (c) 2023 StarFive, Technology Co., Ltd. All rights reserved.
 *
 *  SPDX-License-Identifier: BSD-2-Clause-Patent
 *
@@ -33,12 +34,20 @@ STATIC CONST NOR_FLASH_INFO  NorFlashIds[] = {
   { L"en25q128b",  { 0x1c, 0x30, 0x18 }, 3, 256, 64 * 1024,  256,  0   
 },
   { L"en25s64",{ 0x1c, 0x38, 0x17 }, 3, 256, 64 * 1024,  128,  0   
 },
   /* GIGADEVICE */
-  { L"gd25q64b",   { 0xc8, 0x40, 0x17 }, 3, 256, 64 * 1024,  128,  
NOR_FLASH_ERASE_4K   },
+  { L"gd25q16",{ 0xc8, 0x40, 0x15 }, 3, 256, 64 * 1024,  32,   
NOR_FLASH_ERASE_4K   },
+  { L"gd25q32",{ 0xc8, 0x40, 0x16 }, 3, 256, 64 * 1024,  64,   
NOR_FLASH_ERASE_4K   },
   { L"gd25lq32",   { 0xc8, 0x60, 0x16 }, 3, 256, 64 * 1024,  64,   
NOR_FLASH_ERASE_4K   },
+  { L"gd25q64b",   { 0xc8, 0x40, 0x17 }, 3, 256, 64 * 1024,  128,  
NOR_FLASH_ERASE_4K   },
+  { L"gd25lq64c",  { 0xc8, 0x60, 0x17 }, 3, 256, 64 * 1024,  128,  
NOR_FLASH_ERASE_4K   },
+  { L"gd25q128",   { 0xc8, 0x40, 0x18 }, 3, 256, 64 * 1024,  256,  
NOR_FLASH_ERASE_4K   },
+  { L"gd25lq128",  { 0xc8, 0x60, 0x18 }, 3, 256, 64 * 1024,  256,  
NOR_FLASH_ERASE_4K   },
+  { L"gd25q256",   { 0xc8, 0x40, 0x19 }, 3, 256, 64 * 1024,  512,  
NOR_FLASH_ERASE_4K   },
   /* ISSI */
   { L"is25lp032",  { 0x9d, 0x60, 0x16 }, 3, 256, 64 * 1024,  64,   0   
 },
   { L"is25lp064",  { 0x9d, 0x60, 0x17 }, 3, 256, 64 * 1024,  128,  0   
 },
   { L"is25lp128",  { 0x9d, 0x60, 0x18 }, 3, 256, 64 * 1024,  256,  0   
 },
+  /* XINKAI / SILICON KAISER */
+  { L"sk25lp128",  { 0x27, 0x70, 0x18 }, 3, 256, 64 * 1024,  256,  
NOR_FLASH_ERASE_4K   },
   /* MACRONIX */
   { L"mx25l2006e", { 0xc2, 0x20, 0x12 }, 3, 256, 64 * 1024,  4,0   
 },
   { L"mx25l4005",  { 0xc2, 0x20, 0x13 }, 3, 256, 64 * 1024,  8,0   
 },
-- 
2.34.1

--- End Message ---


Re: [edk2-devel] [PATCH v1] EmbeddedPkg/NorFlashInfoLib: Update norflash device list

2023-09-29 Thread Heinrich Schuchardt

On 9/29/23 04:02, John Chew wrote:

Update Gigadevice norflash list:
gd25q16, gd25q32, gd25q64, gd25lq64c, gd25q128, gd25lq128, gd25q256

Add Silicon Kaiser norflash list:
sk25lp128

Cc: Sunil V L 
Cc: Li Yong 
Cc: Heinrich Schuchardt 
Cc: Leif Lindholm 
Cc: Ard Biesheuvel 
Cc: Abner Chang 
Cc: Daniel Schaefer 
Signed-off-by: John Chew 
---
  EmbeddedPkg/Library/NorFlashInfoLib/NorFlashInfoLib.c | 11 ++-
  1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/EmbeddedPkg/Library/NorFlashInfoLib/NorFlashInfoLib.c 
b/EmbeddedPkg/Library/NorFlashInfoLib/NorFlashInfoLib.c
index e16c1c6a14..422fdac851 100644
--- a/EmbeddedPkg/Library/NorFlashInfoLib/NorFlashInfoLib.c
+++ b/EmbeddedPkg/Library/NorFlashInfoLib/NorFlashInfoLib.c
@@ -1,6 +1,7 @@
  /** @file
  *
  *  Copyright (c) 2017 Marvell International Ltd.
+*  Copyright (c) 2023 StarFive, Technology Co., Ltd. All rights reserved.
  *
  *  SPDX-License-Identifier: BSD-2-Clause-Patent
  *
@@ -33,12 +34,20 @@ STATIC CONST NOR_FLASH_INFO  NorFlashIds[] = {
{ L"en25q128b",  { 0x1c, 0x30, 0x18 }, 3, 256, 64 * 1024,  256,  0  
  },
{ L"en25s64",{ 0x1c, 0x38, 0x17 }, 3, 256, 64 * 1024,  128,  0  
  },
/* GIGADEVICE */
-  { L"gd25q64b",   { 0xc8, 0x40, 0x17 }, 3, 256, 64 * 1024,  128,  
NOR_FLASH_ERASE_4K   },
+  { L"gd25q16",{ 0xc8, 0x40, 0x15 }, 3, 256, 64 * 1024,  32,   
NOR_FLASH_ERASE_4K   },
+  { L"gd25q32",{ 0xc8, 0x40, 0x16 }, 3, 256, 64 * 1024,  64,   
NOR_FLASH_ERASE_4K   },
{ L"gd25lq32",   { 0xc8, 0x60, 0x16 }, 3, 256, 64 * 1024,  64,   
NOR_FLASH_ERASE_4K   },
+  { L"gd25q64b",   { 0xc8, 0x40, 0x17 }, 3, 256, 64 * 1024,  128,  
NOR_FLASH_ERASE_4K   },


Linux calls this gd25q64 but probably we don't want to change the 
displayed name.



+  { L"gd25lq64c",  { 0xc8, 0x60, 0x17 }, 3, 256, 64 * 1024,  128,  
NOR_FLASH_ERASE_4K   },
+  { L"gd25q128",   { 0xc8, 0x40, 0x18 }, 3, 256, 64 * 1024,  256,  
NOR_FLASH_ERASE_4K   },
+  { L"gd25lq128",  { 0xc8, 0x60, 0x18 }, 3, 256, 64 * 1024,  256,  
NOR_FLASH_ERASE_4K   },


Linux calls this gd25lq128d.


+  { L"gd25q256",   { 0xc8, 0x40, 0x19 }, 3, 256, 64 * 1024,  512,  
NOR_FLASH_ERASE_4K   },


Except for the two labels the changes match 
drivers/mtd/spi-nor/gigadevice.c in Linux.



/* ISSI */
{ L"is25lp032",  { 0x9d, 0x60, 0x16 }, 3, 256, 64 * 1024,  64,   0  
  },
{ L"is25lp064",  { 0x9d, 0x60, 0x17 }, 3, 256, 64 * 1024,  128,  0  
  },
{ L"is25lp128",  { 0x9d, 0x60, 0x18 }, 3, 256, 64 * 1024,  256,  0  
  },
+  /* XINKAI / SILICON KAISER */
+  { L"sk25lp128",  { 0x27, 0x70, 0x18 }, 3, 256, 64 * 1024,  256,  
NOR_FLASH_ERASE_4K   },


This matches
https://lore.kernel.org/all/20230726214401.929533-1-jo...@kwiboo.se/

Acked-by: Heinrich Schuchardt 



/* MACRONIX */
{ L"mx25l2006e", { 0xc2, 0x20, 0x12 }, 3, 256, 64 * 1024,  4,0  
  },
{ L"mx25l4005",  { 0xc2, 0x20, 0x13 }, 3, 256, 64 * 1024,  8,0  
  },




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#109210): https://edk2.groups.io/g/devel/message/109210
Mute This Topic: https://groups.io/mt/101660590/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH v1] EmbeddedPkg/NorFlashInfoLib: Update norflash device list

2023-09-29 Thread Heinrich Schuchardt

On 29.09.23 15:35, YuinYee Chew wrote:

Hi Heinrich,

Both gd25lq128d and gd25lq128e share the same ID "{ 0xc8, 0x60, 0x18}"
gd25lq128d : 
https://www.gigadevice.com/product/flash/product-series/spi-nor-flash/gd25lq128d.html
gd25lq128e : 
https://www.gigadevice.com/product/flash/product-series/spi-nor-flash/gd25lq128e
So, I'm thinking to put it as "gd25lq128" to represent both "d" and "e".
If sync with Linux, gd25lq128d will be better.

Do you have any suggestion on this?
Or anyone have any opinion?

Thanks again for the feedback! =)


Thank you for the explanation.

My understanding is that these strings are for display only. So we 
should be fine with the patch as is.


Best regards

Heinrich


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#109211): https://edk2.groups.io/g/devel/message/109211
Mute This Topic: https://groups.io/mt/101660590/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 4/4] OvmfPkg/RiscVVirt: Add a readme for build and test

2023-06-20 Thread Heinrich Schuchardt

On 6/16/23 12:16, Sunil V L wrote:

Add a readme file which provides information regarding how
to build and test EDK2 on RISC-V qemu virt platform.

Signed-off-by: Sunil V L 
Cc: Ard Biesheuvel 
Cc: Jiewen Yao 
Cc: Jordan Justen 
Cc: Gerd Hoffmann 
Cc: Andrei Warkentin 


Unfortunately you only sent me the cover letter. Copying from the 
mailing list may have led to some formatting being lost.



---
  OvmfPkg/RiscVVirt/README.md | 46 +
  1 file changed, 46 insertions(+)
  create mode 100644 OvmfPkg/RiscVVirt/README.md

diff --git a/OvmfPkg/RiscVVirt/README.md b/OvmfPkg/RiscVVirt/README.md
new file mode 100644
index ..b07d5b6d3bf9
--- /dev/null
+++ b/OvmfPkg/RiscVVirt/README.md
@@ -0,0 +1,46 @@
+# Support for RISC-V qemu virt platform
+
+## Overview
+RISC-V qemu 'virt' is a generic platform which does not correspond to any real


%s/qemu/QEMU/


+hardware.
+
+EDK2 for RISC-V virt platform is a payload (S-mode) for a previous stage M-mode


%s/for/for the/


+firmware like opensbi. It follows PEI less design.


%s/opensbi/OpenSBI/


+
+The minimum qemu version required is


%s/qemu/QEMU/


+**[8.1](https://wiki.qemu.org/Planning/8.1)** or with commit
+[7efd65423a](https://github.com/qemu/qemu/commit/7efd65423ab22e6f5890ca08ae40c84d6660242f)
+which supports separate pflash devices for EDK2 code and variable storage.
+
+## Build
+export WORKSPACE=`pwd`
+export GCC5_RISCV64_PREFIX=riscv64-linux-gnu-
+export PACKAGES_PATH=$WORKSPACE/edk2
+export EDK_TOOLS_PATH=$WORKSPACE/edk2/BaseTools
+source edk2/edksetup.sh
+make -C edk2/BaseTools
+source edk2/edksetup.sh BaseTools
+build -a RISCV64 --buildtarget RELEASE -p 
OvmfPkg/RiscVVirt/RiscVVirtQemu.dsc -t GCC5
+
+## Test
+1) RISC-V qemu pflash devices should be of of size 32MiB.
+
+`truncate -s 32M Build/RiscVVirtQemu/RELEASE_GCC5/FV/RISCV_VIRT_CODE.fd`
+
+`truncate -s 32M Build/RiscVVirtQemu/RELEASE_GCC5/FV/RISCV_VIRT_VARS.fd`
+
+2) Run qemu


%s/qemu/QEMU/


+
+qemu-system-riscv64 \
+-accel tcg -m 4096 -smp 2 \
+-serial mon:stdio \
+-device virtio-gpu-pci -full-screen \
+-device qemu-xhci \
+-device usb-kbd \
+-blockdev 
node-name=pflash0,driver=file,read-only=on,filename=RISCV_VIRT_CODE.fd \
+-blockdev node-name=pflash1,driver=file,filename=RISCV_VIRT_VARS.fd \
+-M virt,pflash0=pflash0,pflash1=pflash1,acpi=off \
+-kernel linux/arch/riscv/boot/Image \
+-initrd buildroot/output/images/rootfs.cpio \


If you use -kernel and -initrd, why would you use EDK II? It is much 
easier to use the kernel and initrd that is on the drive that you will 
need anyway.


We should provide an example that works on all operating systems no just 
Linux. Hence, I would prefer an example connecting a disk image:


-drive file=riscv64.img,format=raw,if=virtio \



+-netdev user,id=net0 -device virtio-net-pci,netdev=net0 \
+-append "root=/dev/ram rw console=ttyS0 
earlycon=uart8250,mmio,0x1000"


You should remove this parameter too as it is Linux specific.

For testing you could use:

https://cdimage.ubuntu.com/releases/22.04.2/release/ubuntu-22.04.2-live-server-riscv64.img.gz

The unzipped image provides GRUB as EFI/boot/bootriscv64.efi on the ESP.

These are the commands I used:

dd if=/dev/zero of=riscv64.img bs=1M count=16384

qemu-system-riscv64 \
-M virt,pflash0=pflash0,pflash1=pflash1,acpi=off \
-m 4096 -smp 2 \
-serial mon:stdio \
-device virtio-gpu-pci -full-screen \
-device qemu-xhci \
-device usb-kbd \
-device virtio-rng-pci \
-blockdev 
node-name=pflash0,driver=file,read-only=on,filename=RISCV_VIRT_CODE.fd \

-blockdev node-name=pflash1,driver=file,filename=RISCV_VIRT_VARS.fd \
-netdev user,id=net0 \
-device virtio-net-pci,netdev=net0 \
-drive file=riscv64.img,format=raw,if=virtio \
-drive file=ubuntu-22.04.2-live-server-riscv64.img,if=virtio,media=cdrom

As EDK II by default has the EFI shell as first boot option just choose 
the second disk from the boot menu or use the EFI shell to invoke GRUB.


To initialize KASLR and provide enough entropy to /dev/random the RNG 
device is useful.


Best regards

Heinrich


--
2.34.1




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#106188): https://edk2.groups.io/g/devel/message/106188
Mute This Topic: https://groups.io/mt/99567401/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/4] OvmfPkg/RiscVVirt: Separate code and variable storage

2023-06-15 Thread Heinrich Schuchardt

On 6/15/23 13:50, Sunil V L wrote:

On Wed, Jun 14, 2023 at 07:11:18PM +0200, Heinrich Schuchardt wrote:

Sunil V L  schrieb am Mi., 14. Juni 2023, 19:01:


Recent updates to RISC-V qemu virt platform merged today (07/14),
have enabled both pflash devices for the S-mode payload like EDK2.
These updates also aligned the design similar to other architectures
where pflash0 is for read-only code and pflash1 for variable store.
Previously only pflash1 was available for S-mode use.

Current EDK2 will not work with this latest qemu changes since it always
assumed to boot from pflash1. So, separate the code and variable
store and use pflash0 to keep the code.



Not all users will have the newest QEMU provided by their Linx distro. Will
it be possible to boot the same EDK II binary on old and new QEMU
releases?


Hi Heinrich,

While both unified and separate images can not be generated at the same
time, a build flag can be used by which the user can build one of
the schemes matching qemu capabilities. Default will be separate
code and vars matching the latest qemu.

I believe this will alleviate the concern. If this looks better, let me
test and send v2.

Thanks!
Sunil


At least Debian and Ubuntu packaging relies on the separation of code 
and variables. So anyway we would not be able back-port EDK II as 
package to anything that does not have the upcoming QEMU release.


It would be helpful to document the constraints in the yet to be created 
OvmfPkg/RiscVVirt/ReadMe.rst.


Best regards

Heinrich


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#106117): https://edk2.groups.io/g/devel/message/106117
Mute This Topic: https://groups.io/mt/99532021/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/4] OvmfPkg/RiscVVirt: Separate code and variable storage

2023-06-14 Thread Heinrich Schuchardt
Sunil V L  schrieb am Mi., 14. Juni 2023, 19:01:

> Recent updates to RISC-V qemu virt platform merged today (07/14),
> have enabled both pflash devices for the S-mode payload like EDK2.
> These updates also aligned the design similar to other architectures
> where pflash0 is for read-only code and pflash1 for variable store.
> Previously only pflash1 was available for S-mode use.
>
> Current EDK2 will not work with this latest qemu changes since it always
> assumed to boot from pflash1. So, separate the code and variable
> store and use pflash0 to keep the code.
>

Not all users will have the newest QEMU provided by their Linx distro. Will
it be possible to boot the the same EDK II binary on old and new QEMU
releases?

Best regards

Heinrich


> Add 'readme' about build and test as per these changes.
>
> The changes are available in the branch :
> https://github.com/vlsunil/edk2/tree/separate_code_vars
>
> CI tests passed (#4553).
>
> Cc: Ard Biesheuvel 
> Cc: Jiewen Yao 
> Cc: Jordan Justen 
> Cc: Gerd Hoffmann 
> Cc: Andrei Warkentin 
> Cc: Heinrich Schuchardt 
> Cc: Dann Frazier 
>
>
> Sunil V L (4):
>   OvmfPkg/RiscVVirt: Fix couple of issues in VarStore
>   OvmfPkg/RiscVVirt: Add VirtNorFlashDeviceTreeLib library
>   OvmfPkg/RiscVVirt: Add support for separate code and variable store
>   OvmfPkg/RiscVVirt: Add a readme for build and test
>
>  OvmfPkg/RiscVVirt/RiscVVirtQemu.dsc   |   2 +-
>  OvmfPkg/RiscVVirt/RiscVVirtQemu.fdf   |   9 +-
>  .../VirtNorFlashDeviceTreeLib.inf |  40 +
>  .../VirtNorFlashDeviceTreeLib.c   | 137 ++
>  OvmfPkg/RiscVVirt/README.md   |  41 ++
>  OvmfPkg/RiscVVirt/RiscVVirt.fdf.inc   |  12 +-
>  OvmfPkg/RiscVVirt/VarStore.fdf.inc|  25 ++--
>  7 files changed, 245 insertions(+), 21 deletions(-)
>  create mode 100644
> OvmfPkg/RiscVVirt/Library/VirtNorFlashPlatformLib/VirtNorFlashDeviceTreeLib.inf
>  create mode 100644
> OvmfPkg/RiscVVirt/Library/VirtNorFlashPlatformLib/VirtNorFlashDeviceTreeLib.c
>  create mode 100644 OvmfPkg/RiscVVirt/README.md
>
> --
> 2.34.1
>
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#106096): https://edk2.groups.io/g/devel/message/106096
Mute This Topic: https://groups.io/mt/99532021/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 1/1] BaseTools/tools_def.template: Update -march parameter for RISC-V

2023-02-22 Thread Heinrich Schuchardt




On 2/22/23 03:37, Sunil V L wrote:

Replace rv64imafdc with rv64gc so that it works for gcc 12.

"g" means imafd in gcc < 12 and imafd_zifencei_zicsr in gcc >= 12.
So, replacing rv64imafdc with rv64gc will work for both gcc <12
and gcc >=12.

Cc: Bob Feng 
Cc: Liming Gao 
Cc: Yuwei Chen 
Cc: Andrei Warkentin 
Cc: Heinrich Schuchardt 
Signed-off-by: Sunil V L 
Tested-by: Gerd Hoffmann 


Tested-by: Heinrich Schuchardt 


---
Changes since V1:
1) Updated commit message
2) Added Tested-by tag from Gerd

  BaseTools/Conf/tools_def.template | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Conf/tools_def.template 
b/BaseTools/Conf/tools_def.template
index f77e936c0453..471eb67c0c83 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -1965,7 +1965,7 @@ DEFINE GCC5_RISCV_ALL_CC_FLAGS_WARNING_DISABLE= 
-Wno-tautological-compare -W
  
  DEFINE GCC5_RISCV_OPENSBI_TYPES   = -DOPENSBI_EXTERNAL_SBI_TYPES=OpensbiTypes.h
  
-DEFINE GCC5_RISCV64_ARCH   = rv64imafdc

+DEFINE GCC5_RISCV64_ARCH   = rv64gc
  DEFINE GCC5_RISCV32_RISCV64_ASLDLINK_FLAGS = DEF(GCC5_RISCV_ALL_DLINK_COMMON) 
-Wl,--entry,ReferenceAcpiTable -u ReferenceAcpiTable
  DEFINE GCC5_RISCV64_CC_FLAGS   = DEF(GCC5_RISCV_ALL_CC_FLAGS) 
DEF(GCC5_RISCV_ALL_CC_FLAGS_WARNING_DISABLE) DEF(GCC5_RISCV_OPENSBI_TYPES) 
-march=DEF(GCC5_RISCV64_ARCH) -fno-builtin -fno-builtin-memcpy 
-fno-stack-protector -Wno-address -fno-asynchronous-unwind-tables 
-Wno-unused-but-set-variable -fpack-struct=8 -mcmodel=medany -mabi=lp64 
-mno-relax
  DEFINE GCC5_RISCV64_DLINK_FLAGS= DEF(GCC5_RISCV_ALL_DLINK_FLAGS) 
-Wl,-melf64lriscv,--oformat=elf64-littleriscv,--no-relax



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#100445): https://edk2.groups.io/g/devel/message/100445
Mute This Topic: https://groups.io/mt/97152065/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [edk2-staging/RiscV64QemuVirt PATCH V8 00/19] Add support for RISC-V virt machine

2023-02-20 Thread Heinrich Schuchardt




On 2/17/23 10:16, Michael Brown wrote:

On 17/02/2023 04:27, Sunil V L wrote:

On Thu, Feb 16, 2023 at 03:45:49PM -0700, dann frazier wrote:

   Thanks for your work getting this merged! In the above wiki, it
notes that GCC 12+ is not supported. Is that still accurate? If so,
can you clarify what is blocking that?


Please see https://bugzilla.tianocore.org/show_bug.cgi?id=4061.

My attempt to fix this issue
(https://edk2.groups.io/g/devel/message/93831) was not accepted due to
the concerns that it can cause weird issues in CI.

So, we are left with either support gcc <12 or gcc >=12. We can mandate
gcc 12 itself for RISC-V, but that change need to be done hand in hand
with CI tests moving to use gcc 12. Otherwise, it will break CI.


Is there an alternative (and presumably less ideal) way to force an 
instruction cache invalidation?  For example, does a global TSO "fence" 
instruction as used in RiscVInvalidateDataCacheAsm() also invalidate the 
instruction cache?


If so, then a viable solution would be:

--- a/MdePkg/Library/BaseLib/RiscV64/FlushCache.S
+++ b/MdePkg/Library/BaseLib/RiscV64/FlushCache.S
@@ -15,3 +15,7 @@ ASM_GLOBAL ASM_PFX(RiscVInvalidateDataCacheAsm)
  ASM_PFX(RiscVInvalidateInstCacheAsm):
-    fence.i
+#ifdef __riscv_zifencei
+   fence.i
+#else
+   fence
+#endif
  ret


This would also permit EDK2 to be used on implementations that genuinely 
do not provide the fence.i instruction.


Michael



fence.i is the right instruction to use. The problem are not platforms 
that do not provide the fence.i instruction but that the fence.i 
instruction was removed from RVGC64 in the specification.


Now all programs like OpenSBI, U-Boot, Linux have to be compiled with 
different -march parameters for GCC11 and GCC12.


Sunil suggested dropping support for GCC < 12. This seems to be the 
easiest approach. An alternative would be adding a GCC12 profile to 
BaseTools/Conf/tools_def.template but that would create a high effort.


Best regards

Heinrich


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#100399): https://edk2.groups.io/g/devel/message/100399
Mute This Topic: https://groups.io/mt/96874977/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [RFC PATCH V2 18/19] RISC-V: Add Qemu Virt platform support

2022-12-07 Thread Heinrich Schuchardt

On 9/7/22 13:36, Sunil V L wrote:

Add build infrastructure files to boot qemu virt machine.

EDK2 will boot as S-mode payload of opensbi. There is no
integrated opensbi (M-mode firmware) within EDK2 for virt
machine.

It relies on the RISC-V calling convention that M-mode firmware like
opensbi will pass the BootHartId and the DTB to EDK2. This helps
to simplify the platform specific PCD variables required. It
can parse the DTB to know all the details. Even for future ACPI
support, EDK2 can parse the DTB to create static tables.

Signed-off-by: Sunil V L 
---
  OvmfPkg/RiscVVirt/RiscVVirt.dsc | 713 
  OvmfPkg/RiscVVirt/RiscVVirt.fdf | 379 +++
  OvmfPkg/RiscVVirt/RiscVVirt.fdf.inc |  49 ++
  OvmfPkg/RiscVVirt/VarStore.fdf.inc  |  79 +++
  4 files changed, 1220 insertions(+)

diff --git a/OvmfPkg/RiscVVirt/RiscVVirt.dsc b/OvmfPkg/RiscVVirt/RiscVVirt.dsc
new file mode 100644
index ..d189c047e817
--- /dev/null
+++ b/OvmfPkg/RiscVVirt/RiscVVirt.dsc
@@ -0,0 +1,713 @@
+## @file
+#  RISC-V EFI on RiscVVirt RISC-V platform
+#
+#  Copyright (c) 2021, Hewlett Packard Enterprise Development LP. All rights 
reserved.
+#  Copyright (c) 2022, Ventana Micro Systems Inc. All rights reserved.
+#
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+
+#
+# Defines Section - statements that will be processed to create a Makefile.
+#
+
+[Defines]
+  PLATFORM_NAME  = RiscVVirt
+  PLATFORM_GUID  = 39DADB39-1B21-4867-838E-830B6149B9E0
+  PLATFORM_VERSION   = 0.1
+  DSC_SPECIFICATION  = 0x0001001c
+  OUTPUT_DIRECTORY   = Build/$(PLATFORM_NAME)
+  SUPPORTED_ARCHITECTURES= RISCV64
+  BUILD_TARGETS  = DEBUG|RELEASE|NOOPT
+  SKUID_IDENTIFIER   = DEFAULT
+  FLASH_DEFINITION   = OvmfPkg/RiscVVirt/RiscVVirt.fdf
+
+  #
+  # Enable below options may cause build error or may not work on
+  # the initial version of RISC-V package
+  # Defines for default states.  These can be changed on the command line.
+  # -D FLAG=VALUE
+  #
+  DEFINE SECURE_BOOT_ENABLE  = FALSE
+  DEFINE DEBUG_ON_SERIAL_PORT= TRUE
+
+  #
+  # Network definition
+  #
+  DEFINE NETWORK_SNP_ENABLE   = FALSE
+  DEFINE NETWORK_IP6_ENABLE   = FALSE


Why should we disable IPv6? It is supported by QEMU.

Best regards

Heinrich


+  DEFINE NETWORK_TLS_ENABLE   = TRUE
+  DEFINE NETWORK_HTTP_BOOT_ENABLE = TRUE
+  DEFINE NETWORK_ISCSI_ENABLE = FALSE
+  DEFINE NETWORK_ALLOW_HTTP_CONNECTIONS = TRUE
+
+[BuildOptions]
+  GCC:RELEASE_*_*_CC_FLAGS   = -DMDEPKG_NDEBUG
+!ifdef $(SOURCE_DEBUG_ENABLE)
+  GCC:*_*_RISCV64_GENFW_FLAGS= --keepexceptiontable
+!endif
+
+[BuildOptions.common.EDKII.DXE_RUNTIME_DRIVER]
+  GCC:  *_*_*_DLINK_FLAGS = -z common-page-size=0x1000
+  MSFT: *_*_*_DLINK_FLAGS = /ALIGN:4096
+
+
+#
+# SKU Identification section - list of all SKU IDs supported by this Platform.
+#
+
+[SkuIds]
+  0|DEFAULT
+
+
+#
+# Library Class section - list of all Library Classes needed by this Platform.
+#
+
+
+!include MdePkg/MdeLibs.dsc.inc
+
+[LibraryClasses]
+  PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
+  PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
+  BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
+  BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
+  SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf
+  
SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
+  CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
+  
PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
+  PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
+  
CacheMaintenanceLib|MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf
+  
UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf
+  
UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf
+  HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
+  CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
+  DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
+  
DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
+  
PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
+  IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
+  
OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf
+  

Re: [edk2-devel] [RFC PATCH V2 07/19] MdePkg: Add ArchTimerLib library

2022-12-07 Thread Heinrich Schuchardt




On 9/7/22 13:36, Sunil V L wrote:

This library implements the TimerLib.h functionality. This library
is similar to CpuTimerLib but needs the library constructor.

Signed-off-by: Sunil V L 
---
  MdePkg/Library/ArchTimerLib/ArchTimerLib.inf  |  40 +++
  MdePkg/Library/ArchTimerLib/RiscV64/CpuTimerLib.c | 299 
  MdePkg/Library/ArchTimerLib/ArchTimerLib.uni  |  14 +
  3 files changed, 353 insertions(+)

diff --git a/MdePkg/Library/ArchTimerLib/ArchTimerLib.inf 
b/MdePkg/Library/ArchTimerLib/ArchTimerLib.inf
new file mode 100644
index ..b61ae58d0142
--- /dev/null
+++ b/MdePkg/Library/ArchTimerLib/ArchTimerLib.inf
@@ -0,0 +1,40 @@
+## @file
+# Timer Library Instance which needs a constructor for the architecture.
+#
+#  Copyright (c) 2016 - 2019, Hewlett Packard Enterprise Development LP. All rights 
reserved.
+#  Copyright (c) 2022, Ventana Micro System Inc. All rights reserved.
+#
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+  INF_VERSION  = 0x0001001b
+  BASE_NAME= ArchTimerLib
+  FILE_GUID= D3CF51A9-1CEA-4776-A8AB-CCFD14D7DAAF
+  MODULE_TYPE  = BASE
+  VERSION_STRING   = 1.0
+  LIBRARY_CLASS= TimerLib
+  MODULE_UNI_FILE  = ArchTimerLib.uni
+  CONSTRUCTOR  = ArchTimerLibConstructor
+
+[Sources.RISCV64]
+  RiscV64/CpuTimerLib.c
+
+[Packages]
+  MdePkg/MdePkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+  UefiCpuPkg/UefiCpuPkg.dec
+  EmbeddedPkg/EmbeddedPkg.dec
+
+[LibraryClasses]
+  BaseLib
+  DebugLib
+  FdtLib
+  HobLib
+
+[Pcd]
+  gUefiCpuPkgTokenSpaceGuid.PcdRiscVTimerFrequencyInHz  ## CONSUMES
+
+[Guids]
+  gFdtHobGuid
diff --git a/MdePkg/Library/ArchTimerLib/RiscV64/CpuTimerLib.c 
b/MdePkg/Library/ArchTimerLib/RiscV64/CpuTimerLib.c
new file mode 100644
index ..a81ac8c37cad
--- /dev/null
+++ b/MdePkg/Library/ArchTimerLib/RiscV64/CpuTimerLib.c
@@ -0,0 +1,299 @@
+/** @file
+  RISC-V instance of Timer Library.
+
+  Copyright (c) 2016 - 2022, Hewlett Packard Enterprise Development LP. All rights 
reserved.
+  Copyright (c) 2022, Ventana Micro Systems Inc. All rights reserved.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+
+STATIC UINT32 mTimeBaseFrequency;
+STATIC BOOLEAN mTimeBaseFreqInitialized;
+
+UINT32
+InternalGetTimerFrequency(
+  VOID
+  )
+{
+  return mTimeBaseFrequency;
+}
+
+
+/**
+  Stalls the CPU for at least the given number of ticks.
+
+  Stalls the CPU for at least the given number of ticks. It's invoked by
+  MicroSecondDelay() and NanoSecondDelay().
+
+  @param  Delay A period of time to delay in ticks.
+
+**/
+VOID
+InternalRiscVTimerDelay (
+  IN UINT32  Delay
+  )
+{
+  UINT32  Ticks;
+  UINT32  Times;
+
+  Times  = Delay >> (RISCV_TIMER_COMPARE_BITS - 2);
+  Delay &= ((1 << (RISCV_TIMER_COMPARE_BITS - 2)) - 1);
+  do {
+//
+// The target timer count is calculated here
+//
+Ticks = csr_read(CSR_TIME) + Delay;
+Delay = 1 << (RISCV_TIMER_COMPARE_BITS - 2);
+while (((Ticks - csr_read(CSR_TIME)) & (1 << (RISCV_TIMER_COMPARE_BITS - 
1))) == 0) {
+  CpuPause ();


Is CpuPause() guaranteed to return before two ticks have elapsed?

'== 0' might be too strict especially when considering that interrupts 
might have to be handled in future.


You don't want this routine to hang for another 2^32 ticks.

Best regards

Heinrich


+}
+  } while (Times-- > 0);
+}
+
+/**
+  Stalls the CPU for at least the given number of microseconds.
+
+  Stalls the CPU for the number of microseconds specified by MicroSeconds.
+
+  @param  MicroSeconds  The minimum number of microseconds to delay.
+
+  @return MicroSeconds
+
+**/
+UINTN
+EFIAPI
+MicroSecondDelay (
+  IN UINTN  MicroSeconds
+  )
+{
+  InternalRiscVTimerDelay (
+(UINT32)DivU64x32 (
+  MultU64x32 (
+MicroSeconds,
+InternalGetTimerFrequency()
+),
+  100u
+  )
+);
+  return MicroSeconds;
+}
+
+/**
+  Stalls the CPU for at least the given number of nanoseconds.
+
+  Stalls the CPU for the number of nanoseconds specified by NanoSeconds.
+
+  @param  NanoSeconds The minimum number of nanoseconds to delay.
+
+  @return NanoSeconds
+
+**/
+UINTN
+EFIAPI
+NanoSecondDelay (
+  IN UINTN  NanoSeconds
+  )
+{
+  InternalRiscVTimerDelay (
+(UINT32)DivU64x32 (
+  MultU64x32 (
+NanoSeconds,
+InternalGetTimerFrequency()
+),
+  10u
+  )
+);
+  return NanoSeconds;
+}
+
+/**
+  Retrieves the current value of a 64-bit free running performance counter.
+
+  Retrieves the current value of a 64-bit free running performance counter. The
+  counter can either count up by 1 or count down by 1. If the physical
+  performance counter counts by a larger increment, then the 

Re: [edk2-devel] [RFC PATCH V2 03/19] MdePkg/Protocol: Add RiscVBootProtocol.h

2022-12-07 Thread Heinrich Schuchardt

On 9/7/22 13:36, Sunil V L wrote:

RISC-V UEFI platforms need to implement RISCV_EFI_BOOT_PROTOCOL.
Add header file with the definitions of this protocol.

Signed-off-by: Sunil V L 


Reviewed-by: Heinrich Schuchardt 


---
  MdePkg/Include/Protocol/RiscVBootProtocol.h | 35 
  1 file changed, 35 insertions(+)

diff --git a/MdePkg/Include/Protocol/RiscVBootProtocol.h 
b/MdePkg/Include/Protocol/RiscVBootProtocol.h
new file mode 100644
index ..7ceb7d830924
--- /dev/null
+++ b/MdePkg/Include/Protocol/RiscVBootProtocol.h
@@ -0,0 +1,35 @@
+
+/** @file
+  RISC-V Boot Protocol mandatory for RISC-V UEFI platforms.
+
+  Specification available at
+   
https://github.com/riscv-non-isa/riscv-uefi/releases/download/1.0.0/RISCV_UEFI_PROTOCOL-spec.pdf
+
+  Copyright (c) 2022, Ventana Micro Systems Inc. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _RISCV_BOOT_PROTOCOL_H_
+#define _RISCV_BOOT_PROTOCOL_H_
+
+//extern EFI_GUID  gRiscVEfiBootProtocolGuid;
+
+typedef struct _RISCV_EFI_BOOT_PROTOCOL RISCV_EFI_BOOT_PROTOCOL;
+
+#define RISCV_EFI_BOOT_PROTOCOL_REVISION 0x0001
+#define RISCV_EFI_BOOT_PROTOCOL_LATEST_VERSION \
+RISCV_EFI_BOOT_PROTOCOL_REVISION
+
+typedef EFI_STATUS
+(EFIAPI *EFI_GET_BOOT_HARTID) (
+  IN RISCV_EFI_BOOT_PROTOCOL   *This,
+  OUT UINTN*BootHartId
+  );
+
+typedef struct _RISCV_EFI_BOOT_PROTOCOL {
+  UINT64Revision;
+  EFI_GET_BOOT_HARTID   GetBootHartId;
+} RISCV_EFI_BOOT_PROTOCOL;
+
+#endif



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#97125): https://edk2.groups.io/g/devel/message/97125
Mute This Topic: https://groups.io/mt/93522696/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [RFC PATCH V2 08/19] MdePkg: Add RiscVSbiLib Library for RISC-V

2022-12-07 Thread Heinrich Schuchardt




On 9/7/22 13:36, Sunil V L wrote:

This library is required to make SBI ecalls from the S-mode EDK2.

Signed-off-by: Sunil V L 
---
  MdePkg/Library/RiscVSbiLib/RiscVSbiLib.inf |  27 +++
  MdePkg/Include/Library/RiscVSbiLib.h   | 129 +++
  MdePkg/Library/RiscVSbiLib/RiscVSbiLib.c   | 228 
  3 files changed, 384 insertions(+)

diff --git a/MdePkg/Library/RiscVSbiLib/RiscVSbiLib.inf 
b/MdePkg/Library/RiscVSbiLib/RiscVSbiLib.inf
new file mode 100644
index ..a621243a1a99
--- /dev/null
+++ b/MdePkg/Library/RiscVSbiLib/RiscVSbiLib.inf
@@ -0,0 +1,27 @@
+## @file
+# RISC-V Library to call SBI ecalls
+#
+#  Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights 
reserved.
+#  Copyright (c) 2022, Ventana Micro Systems Inc. All rights reserved.
+#
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+  INF_VERSION= 0x0001001b
+  BASE_NAME  = RiscVSbiLib
+  FILE_GUID  = D742CF3D-E600-4009-8FB5-318073008508
+  MODULE_TYPE= BASE
+  VERSION_STRING = 1.0
+  LIBRARY_CLASS  = RiscVSbiLib
+
+[Sources]
+  RiscVSbiLib.c
+
+[Packages]
+  MdePkg/MdePkg.dec
+  UefiCpuPkg/UefiCpuPkg.dec
+
+[LibraryClasses]
+  BaseLib
diff --git a/MdePkg/Include/Library/RiscVSbiLib.h 
b/MdePkg/Include/Library/RiscVSbiLib.h
new file mode 100644
index ..e94adb08fd40
--- /dev/null
+++ b/MdePkg/Include/Library/RiscVSbiLib.h
@@ -0,0 +1,129 @@
+/** @file
+  Library to call the RISC-V SBI ecalls
+
+  Copyright (c) 2021-2022, Hewlett Packard Development LP. All rights 
reserved.
+  Copyright (c) 2022, Ventana Micro Systems Inc. All rights reserved.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+  @par Glossary:
+- Hart - Hardware Thread, similar to a CPU core
+
+  Currently, EDK2 needs to call SBI only to set the time and to do system 
reset.
+
+**/
+
+#ifndef RISCV_SBI_LIB_H_
+#define RISCV_SBI_LIB_H_
+
+#include 
+
+/* SBI Extension IDs */
+#define SBI_EXT_TIME   0x54494D45
+#define SBI_EXT_SRST   0x53525354
+
+/* SBI function IDs for TIME extension*/
+#define SBI_EXT_TIME_SET_TIMER  0x0
+
+/* SBI function IDs for SRST extension */
+#define SBI_EXT_SRST_RESET  0x0
+
+#define SBI_SRST_RESET_TYPE_SHUTDOWN0x0
+#define SBI_SRST_RESET_TYPE_COLD_REBOOT 0x1
+#define SBI_SRST_RESET_TYPE_WARM_REBOOT 0x2
+#define SBI_SRST_RESET_TYPE_LAST SBI_SRST_RESET_TYPE_WARM_REBOOT


I cannot see that SBI_SRST_RESET_TYPE_LAST will ever be used in EDK II.
The highest allowed value for a reset type in the current SBI standard 
is 0x.



+
+#define SBI_SRST_RESET_REASON_NONE  0x0
+#define SBI_SRST_RESET_REASON_SYSFAIL   0x1
+
+/* SBI return error codes */
+#define SBI_SUCCESS  0
+#define SBI_ERR_FAILED  -1
+#define SBI_ERR_NOT_SUPPORTED   -2
+#define SBI_ERR_INVALID_PARAM   -3
+#define SBI_ERR_DENIED  -4
+#define SBI_ERR_INVALID_ADDRESS -5
+#define SBI_ERR_ALREADY_AVAILABLE   -6
+#define SBI_ERR_ALREADY_STARTED -7
+#define SBI_ERR_ALREADY_STOPPED -8
+
+#define SBI_LAST_ERR SBI_ERR_ALREADY_STOPPED
+
+typedef struct {
+  UINT64 BootHartId;
+  VOID   *PeiServiceTable;// PEI Service table
+  UINT64 FlattenedDeviceTree; // Pointer to Flattened Device tree
+} EFI_RISCV_FIRMWARE_CONTEXT;
+
+
+//
+// EDK2 OpenSBI firmware extension return status.
+//
+typedef struct {
+  UINTNError; ///< SBI status code
+  UINTNValue; ///< Value returned
+} SBI_RET;
+
+VOID
+EFIAPI
+SbiSetTimer (
+  IN  UINT64  Time
+  );
+
+EFI_STATUS
+EFIAPI
+SbiSystemReset (
+  IN  UINTN  ResetType,
+  IN  UINTN  ResetReason
+  );
+
+/**
+  Get firmware context of the calling hart.
+
+  @param[out] FirmwareContext  The firmware context pointer.
+**/
+VOID
+EFIAPI
+GetFirmwareContext (
+  OUT EFI_RISCV_FIRMWARE_CONTEXT  **FirmwareContext
+  );
+
+/**
+  Set firmware context of the calling hart.
+
+  @param[in] FirmwareContext   The firmware context pointer.
+**/
+VOID
+EFIAPI
+SetFirmwareContext (
+  IN EFI_RISCV_FIRMWARE_CONTEXT  *FirmwareContext
+  );
+
+/**
+  Get pointer to OpenSBI Firmware Context
+
+  Get the pointer of firmware context.
+
+  @paramFirmwareContextPtr   Pointer to retrieve pointer to the
+ Firmware Context.
+**/
+VOID
+EFIAPI
+GetFirmwareContextPointer (
+  IN OUT EFI_RISCV_FIRMWARE_CONTEXT  **FirmwareContextPtr
+  );
+
+/**
+  Set pointer to OpenSBI Firmware Context
+
+  Set the pointer of firmware context.
+
+  @paramFirmwareContextPtr   Pointer to Firmware Context.
+**/
+VOID
+EFIAPI
+SetFirmwareContextPointer (
+  IN EFI_RISCV_FIRMWARE_CONTEXT  *FirmwareContextPtr
+  );
+
+#endif
diff --git a/MdePkg/Library/RiscVSbiLib/RiscVSbiLib.c 
b/MdePkg/Library/RiscVSbiLib/RiscVSbiLib.c
new file mode 100644
index ..39cc6628be6c
--- 

Re: [edk2-devel] [RFC PATCH V2 06/19] MdePkg/BaseLib: RISC-V: Add generic CPU related functions

2022-12-07 Thread Heinrich Schuchardt




On 9/7/22 13:36, Sunil V L wrote:

EDK2 in S-mode needs to use SSCRATCH register. Implement functions
to set/get the SSCRATCH register.

Signed-off-by: Sunil V L 
---
  MdePkg/Library/BaseLib/BaseLib.inf  |  1 +
  MdePkg/Include/Library/BaseLib.h| 10 ++
  MdePkg/Library/BaseLib/RiscV64/CpuGen.S | 33 
  3 files changed, 44 insertions(+)

diff --git a/MdePkg/Library/BaseLib/BaseLib.inf 
b/MdePkg/Library/BaseLib/BaseLib.inf
index 6be5be9428f2..5429329e39b0 100644
--- a/MdePkg/Library/BaseLib/BaseLib.inf
+++ b/MdePkg/Library/BaseLib/BaseLib.inf
@@ -401,6 +401,7 @@ [Sources.RISCV64]
RiscV64/RiscVCpuPause.S   | GCC
RiscV64/RiscVInterrupt.S  | GCC
RiscV64/FlushCache.S  | GCC
+  RiscV64/CpuGen.S  | GCC
  
  [Packages]

MdePkg/MdePkg.dec
diff --git a/MdePkg/Include/Library/BaseLib.h b/MdePkg/Include/Library/BaseLib.h
index a6f9a194ef1c..a742de61a442 100644
--- a/MdePkg/Include/Library/BaseLib.h
+++ b/MdePkg/Include/Library/BaseLib.h
@@ -150,6 +150,16 @@ typedef struct {
  
  #define BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT  8
  
+VOID

+RiscVSetSupervisorScratch (
+  UINT64
+  );
+
+UINT64
+RiscVGetSupervisorScratch (
+  VOID
+  );
+
  #endif // defined (MDE_CPU_RISCV64)
  
  //

diff --git a/MdePkg/Library/BaseLib/RiscV64/CpuGen.S 
b/MdePkg/Library/BaseLib/RiscV64/CpuGen.S
new file mode 100644
index ..d11929cf3233
--- /dev/null
+++ b/MdePkg/Library/BaseLib/RiscV64/CpuGen.S
@@ -0,0 +1,33 @@
+//--
+//
+// Generic CPU related functions for RISC-V
+//
+// Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights 
reserved.
+// Copyright (c) 2022, Ventana Micro Systems Inc. All rights reserved.
+//
+// SPDX-License-Identifier: BSD-2-Clause-Patent
+//
+//--
+
+#include 
+#include 
+
+.data
+.align 3
+.section .text
+
+//
+// Set Supervisor mode scratch.
+// @param a0 : Value set to Supervisor mode scratch
+//
+ASM_FUNC (RiscVSetSupervisorScratch)
+csrrw a1, CSR_SSCRATCH, a0
+ret


I am wondering why you are reading the old value into a1 while the 
function has a VOID return value.


If you are not interested in reading the old value, the "RISC-V 
Unprivileged ISA Specification" suggests to use the x0 (zero) register 
as read register or just use the CSRW pseudo code.


Best regards1.

Heinrich


+
+//
+// Get Supervisor mode scratch.
+// @retval a0 : Value in Supervisor mode scratch
+//
+ASM_FUNC (RiscVGetSupervisorScratch)
+csrr a0, CSR_SSCRATCH
+ret



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#97128): https://edk2.groups.io/g/devel/message/97128
Mute This Topic: https://groups.io/mt/93522701/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [RFC PATCH V2 02/19] MdePkg/MdePkg.dec: Add RISCV_EFI_BOOT_PROTOCOL GUID

2022-12-07 Thread Heinrich Schuchardt

On 9/7/22 13:36, Sunil V L wrote:

RISC-V UEFI based platforms need to support RISCV_EFI_BOOT_PROTOCOL.
Add this protocol GUID definition.

Signed-off-by: Sunil V L 


Reviewed-by: Heinrich Schuchardt 


---
  MdePkg/MdePkg.dec | 6 ++
  1 file changed, 6 insertions(+)

diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
index f1ebf9e251c1..8f1bcfdc3e97 100644
--- a/MdePkg/MdePkg.dec
+++ b/MdePkg/MdePkg.dec
@@ -1915,6 +1915,12 @@ [Protocols]
## Include/Protocol/ShellDynamicCommand.h
gEfiShellDynamicCommandProtocolGuid  = { 0x3c7200e9, 0x005f, 0x4ea4, {0x87, 
0xde, 0xa3, 0xdf, 0xac, 0x8a, 0x27, 0xc3 }}
  
+  #

+  # Protocols defined for RISC-V systems
+  #
+  ## Include/Protocol/RiscVBootProtocol.h
+  gRiscVEfiBootProtocolGuid  = { 0xccd15fec, 0x6f73, 0x4eec, { 0x83, 0x95, 
0x3e, 0x69, 0xe4, 0xb9, 0x40, 0xbf }}
+
  #
  # [Error.gEfiMdePkgTokenSpaceGuid]
  #   0x8001 | Invalid value provided.



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#97124): https://edk2.groups.io/g/devel/message/97124
Mute This Topic: https://groups.io/mt/93522695/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [RFC PATCH 2/2] Maintainers.txt: Add entry for new RiscVVirt

2022-09-07 Thread Heinrich Schuchardt

On 9/6/22 19:10, Sunil V L wrote:

Signed-off-by: Sunil V L 
---
  Maintainers.txt | 5 +
  1 file changed, 5 insertions(+)


Acked-by: Heinrich Schuchardt 



diff --git a/Maintainers.txt b/Maintainers.txt
index a4a0e4b907..6fac3369dd 100644
--- a/Maintainers.txt
+++ b/Maintainers.txt
@@ -381,6 +381,11 @@ F: Silicon/RISC-V/ProcessorPkg/
  M: Sunil V L 
  R: Daniel Schaefer 
  
+QEMU RISC-V virt platform

+F: Platform/Qemu/RiscVVirt/
+M: Sunil V L 
+R: Daniel Schaefer 
+
  Silicon/SiFive
  F: Silicon/SiFive/
  M: Daniel Schaefer 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#93458): https://edk2.groups.io/g/devel/message/93458
Mute This Topic: https://groups.io/mt/93506319/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [RFC PATCH 1/2] RISC-V: Add Qemu Virt platform support

2022-09-07 Thread Heinrich Schuchardt




On 9/6/22 19:10, Sunil V L wrote:

Add build infrastructure files to boot qemu virt machine.

EDK2 will boot as S-mode payload of opensbi. There is no
integrated opensbi (M-mode firmware) within EDK2 for virt
machine.

It relies on the RISC-V calling convention that M-mode firmware like
opensbi will pass the BootHartId and the DTB to EDK2. This helps
to simplify the platform specific PCD variables required. It
can parse the DTB to know all the details. Even for future ACPI
support, EDK2 can parse the DTB to create static tables.

Signed-off-by: Sunil V L 



Please, provide a list of all prerequisite patches in the cover-letter.

It seems that this patch at least depends on

https://edk2.groups.io/g/devel/message/93261
[RFC PATCH 00/17] Refactor and add RISC-V support in edk2 repo

Best regards

Heinrich


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#93460): https://edk2.groups.io/g/devel/message/93460
Mute This Topic: https://groups.io/mt/93506318/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [RFC PATCH 1/2] RISC-V: Add Qemu Virt platform support

2022-09-07 Thread Heinrich Schuchardt

On 9/6/22 19:10, Sunil V L wrote:

Add build infrastructure files to boot qemu virt machine.

EDK2 will boot as S-mode payload of opensbi. There is no
integrated opensbi (M-mode firmware) within EDK2 for virt
machine.

It relies on the RISC-V calling convention that M-mode firmware like
opensbi will pass the BootHartId and the DTB to EDK2. This helps
to simplify the platform specific PCD variables required. It
can parse the DTB to know all the details. Even for future ACPI
support, EDK2 can parse the DTB to create static tables.

Signed-off-by: Sunil V L 


The patch does not apply cleanly on origin/master:

$ git am ~/temp/0.patch --keep-cr
warning: quoted CRLF detected
Applying: RISC-V: Add Qemu Virt platform support
error: git diff header lacks filename information when removing 1 
leading pathname component (line 13)

Patch failed at 0001 RISC-V: Add Qemu Virt platform support

I guess the problem is with using the wrong transferEncoding.

Please, run
edk2/BaseTools/Scripts/SetupGit.py
on the platform repo and resend with git send-email.

Best regards

Heinrich


---
  Platform/Qemu/RiscVVirt/RiscVVirt.dsc | 713 ++
  Platform/Qemu/RiscVVirt/RiscVVirt.fdf | 379 
  Platform/Qemu/RiscVVirt/RiscVVirt.fdf.inc |  49 ++
  Platform/Qemu/RiscVVirt/VarStore.fdf.inc  |  79 +++
  4 files changed, 1220 insertions(+)
  create mode 100644 Platform/Qemu/RiscVVirt/RiscVVirt.dsc
  create mode 100644 Platform/Qemu/RiscVVirt/RiscVVirt.fdf
  create mode 100644 Platform/Qemu/RiscVVirt/RiscVVirt.fdf.inc
  create mode 100644 Platform/Qemu/RiscVVirt/VarStore.fdf.inc

diff --git a/Platform/Qemu/RiscVVirt/RiscVVirt.dsc 
b/Platform/Qemu/RiscVVirt/RiscVVirt.dsc
new file mode 100644
index 00..3bd030fb87
--- /dev/null
+++ b/Platform/Qemu/RiscVVirt/RiscVVirt.dsc
@@ -0,0 +1,713 @@
+## @file
+#  RISC-V EFI on RiscVVirt RISC-V platform
+#
+#  Copyright (c) 2021, Hewlett Packard Enterprise Development LP. All rights 
reserved.
+#  Copyright (c) 2022, Ventana Micro Systems Inc. All rights reserved.
+#
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+
+#
+# Defines Section - statements that will be processed to create a Makefile.
+#
+
+[Defines]
+  PLATFORM_NAME  = RiscVVirt
+  PLATFORM_GUID  = 39DADB39-1B21-4867-838E-830B6149B9E0
+  PLATFORM_VERSION   = 0.1
+  DSC_SPECIFICATION  = 0x0001001c
+  OUTPUT_DIRECTORY   = Build/$(PLATFORM_NAME)
+  SUPPORTED_ARCHITECTURES= RISCV64
+  BUILD_TARGETS  = DEBUG|RELEASE|NOOPT
+  SKUID_IDENTIFIER   = DEFAULT
+  FLASH_DEFINITION   = Platform/Qemu/RiscVVirt/RiscVVirt.fdf
+
+  #
+  # Enable below options may cause build error or may not work on
+  # the initial version of RISC-V package
+  # Defines for default states.  These can be changed on the command line.
+  # -D FLAG=VALUE
+  #
+  DEFINE SECURE_BOOT_ENABLE  = FALSE
+  DEFINE DEBUG_ON_SERIAL_PORT= TRUE
+
+  #
+  # Network definition
+  #
+  DEFINE NETWORK_SNP_ENABLE   = FALSE
+  DEFINE NETWORK_IP6_ENABLE   = FALSE
+  DEFINE NETWORK_TLS_ENABLE   = TRUE
+  DEFINE NETWORK_HTTP_BOOT_ENABLE = TRUE
+  DEFINE NETWORK_ISCSI_ENABLE = FALSE
+  DEFINE NETWORK_ALLOW_HTTP_CONNECTIONS = TRUE
+
+[BuildOptions]
+  GCC:RELEASE_*_*_CC_FLAGS   = -DMDEPKG_NDEBUG
+!ifdef $(SOURCE_DEBUG_ENABLE)
+  GCC:*_*_RISCV64_GENFW_FLAGS= --keepexceptiontable
+!endif
+
+[BuildOptions.common.EDKII.DXE_RUNTIME_DRIVER]
+  GCC:  *_*_*_DLINK_FLAGS = -z common-page-size=0x1000
+  MSFT: *_*_*_DLINK_FLAGS = /ALIGN:4096
+
+
+#
+# SKU Identification section - list of all SKU IDs supported by this Platform.
+#
+
+[SkuIds]
+  0|DEFAULT
+
+
+#
+# Library Class section - list of all Library Classes needed by this Platform.
+#
+
+
+!include MdePkg/MdeLibs.dsc.inc
+
+[LibraryClasses]
+  PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
+  PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
+  BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
+  BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
+  SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf
+  
SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
+  CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
+  
PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
+  PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
+  

[edk2-devel] [PATCH edk2-test 1/1] uefi-sct/SctPkg: invalid values for SetWakeupTime()

2021-11-11 Thread Heinrich Schuchardt
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2529

According to the UEFI specification EFI_TIME.YEAR may take values in the
range 1900-. The specification does not forbid to set a wakeup time in
the past. We should not expect EFI_INVALID_PARAMETER to be returned by
SetWakeupTime() for the years 1997 and 2100.

Values 1899 and 1 must lead to this error code.

Signed-off-by: Heinrich Schuchardt 
---
 .../BlackBoxTest/TimeServicesBBTestConformance.c  | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/TimeServices/BlackBoxTest/TimeServicesBBTestConformance.c
 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/TimeServices/BlackBoxTest/TimeServicesBBTestConformance.c
index fcc79548c07d..bdb150d02ea3 100644
--- 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/TimeServices/BlackBoxTest/TimeServicesBBTestConformance.c
+++ 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/TimeServices/BlackBoxTest/TimeServicesBBTestConformance.c
@@ -817,7 +817,7 @@ BBTestSetWakeupTimeConsistencyTest (
);
   } else {
 Time = OldTime;
-Time.Year = 1997;
+Time.Year = 1899;
 Status = gtRT->SetWakeupTime (
  TRUE,
  
@@ -844,7 +844,7 @@ BBTestSetWakeupTimeConsistencyTest (
StandardLib,
AssertionType,
gTimeServicesBBTestConformanceAssertionGuid026,
-   L"RT.SetWakeupTime - Time.Year is 1997",
+   L"RT.SetWakeupTime - Time.Year is 1899",
L"%a:%d:Status - %r",
__FILE__,
(UINTN)__LINE__,
@@ -852,7 +852,7 @@ BBTestSetWakeupTimeConsistencyTest (
);
 
 Time = OldTime;
-Time.Year = 2100;
+Time.Year = 1;
 Status = gtRT->SetWakeupTime (
  TRUE,
  
@@ -866,7 +866,7 @@ BBTestSetWakeupTimeConsistencyTest (
StandardLib,
AssertionType,
gTimeServicesBBTestConformanceAssertionGuid027,
-   L"RT.SetWakeupTime - Time.Year is 2100",
+   L"RT.SetWakeupTime - Time.Year is 1",
L"%a:%d:Status - %r",
__FILE__,
(UINTN)__LINE__,
-- 
2.32.0



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#83655): https://edk2.groups.io/g/devel/message/83655
Mute This Topic: https://groups.io/mt/86986279/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] [PATCH v1 1/1] SctPkg: Fix X64 build errors for GCC toolchain

2021-11-11 Thread Heinrich Schuchardt

On 10/26/21 13:42, Abdul Lateef Attar via groups.io wrote:

Corrects the function declaration/definition
by adding EFIAPI.
Removes duplicate functions.



Unfortunately this mail is not a valid patch:

$ wget https://patchew.org/EDK2/20211026114226.30761-1-abdat...@amd.com/mbox
$ git am mbox --keep-cr
Applying: SctPkg: Fix X64 build errors for GCC toolchain
error: patch fragment without header at line 246: @@ -84,6 +85,7 @@
InitializeHIIStringBBTest (
Patch failed at 0001 SctPkg: Fix X64 build errors for GCC toolchain

Could you, please, upload the patch to
https://bugzilla.tianocore.org/show_bug.cgi?id=2126

Best regards

Heinrich


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#83654): https://edk2.groups.io/g/devel/message/83654
Mute This Topic: https://groups.io/mt/86600279/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] Return EFI_INVALID_PARAMETER if attribute only has EFI_VARIABLE_NON_VOLATILE set

2021-10-23 Thread Heinrich Schuchardt




On 10/21/21 12:18, Sunny Wang wrote:

Hi Liming, Hao, and all

Now we’re checking the SCT runtime variable service test case.
https://github.com/tianocore/edk2-test/blob/92a0343c1553342c53fae9d9d646b763add232c0/uefi-sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/VariableServices/BlackBoxTest/VariableServicesBBTestConformance.c#L3401

and have a question below.

Is there any use case to call the runtime variable service functions
with the Attributes that only has EFI_VARIABLE_NON_VOLATILE set?

We checked UEFI spec, documents, and current EDK2 implementation. There
is no specific description or any implementation for this. However,
there seems an implication that EFI_VARIABLE_NON_VOLATILE must be set
with at least EFI_VARIABLE_BOOTSERVICE_ACCESS.  Actually, it looks like
making NO sense to have a variable attribute combination that doesn’t
have any X_ACCESS attribute (BS, RT, or AT) set.

Therefore, we think only having EFI_VARIABLE_NON_VOLATILE set may be an
invalid case and would like to add a check into the EDK2 variable driver
to return EFI_INVALID_PARAMETER.  What do you guys think?


The Self Certification Test (SCT) II Case Specification, June 2017
explicitly forbids this value for QueryVariableInfo():


5.2.1.4.5

 Call QueryVariableInfo service with the Attributes:

* EFI_VARIABLE_NON_VOLATILE
* EFI_VARIABLE_RUNTIME_ACCESS
* EFI_VARIABLE_NON_VOLATILE|EFI_VARIABLE_RUNTIME_ACCESS

The returned code must be EFI_INVALID_PARAMETER.


This corresponds to the UEFI specification saying:

QueryVariableInfo()
Status Codes returned
EFI_INVALID_PARAMETER:
An invalid combination of attribute bits was supplied.


A variable being not accessible at BootTime seems not to be foreseen by
the specification:


SetVariable()
...
If software uses a nonvolatile variable, it should use a variable that
is only accessible at boot services time if possible.
...
Attributes that have EFI_VARIABLE_RUNTIME_ACCESS set must also have
EFI_VARIABLE_BOOTSERVICE_ACCESS set.


This sounds like a nonvolatile variable should always be accessible at
boot services time. But an explicit rule forbidding the creation of
inaccessible variables, i.e. without EFI_VARIABLE_BOOTSERVICE_ACCESS, is
missing.

It would be good to have a paragraph in the specification that
unambiguously defines which combination of attribute bits are valid.

How about:

"All variables must be created with attribute bit
EFI_VARIABLE_BOOTSERVICE_ACCESS."

Best regards

Heinrich



Best Regards,

Sunny



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#82601): https://edk2.groups.io/g/devel/message/82601
Mute This Topic: https://groups.io/mt/86486174/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] EDK II bug 3066: please merge [PATCH 1/1] BaseTools: add edk2-test repo to SetupGit.py

2021-10-13 Thread Heinrich Schuchardt

Dear Bob, dear Liming,

The patch appended to
https://bugzilla.tianocore.org/show_bug.cgi?id=3066
was reviewed by Yuwei Chen last year but has not been merged since.

Please, consider adding the patch to EDK II.

Cf. https://edk2.groups.io/g/devel/message/67192

Best regards

Heinrich


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#81887): https://edk2.groups.io/g/devel/message/81887
Mute This Topic: https://groups.io/mt/86290560/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH edk2-test v2 1/1] uefi-sct/SctPkg: fix BuildAtaDeviceNode()

2021-09-08 Thread Heinrich Schuchardt
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3290

When BuildAtaDeviceNode() is called with L"Ata(0,0,0)" it creates a node
Ata(1,1,0). This leads to test to an assertion failed test result

../DevicePathToTextBBTestFunction.c:332:
Convert result: Ata(0,0,0) - Expected: Ata(Primary,Master,0)

Signed-off-by: Heinrich Schuchardt 
---
v2:
correct parentheses
---
 .../BlackBoxTest/DevicePathToTextBBTestMain.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DevicePathToText/BlackBoxTest/DevicePathToTextBBTestMain.c
 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DevicePathToText/BlackBoxTest/DevicePathToTextBBTestMain.c
index 46b97a2d2648..183434ee1c78 100644
--- 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DevicePathToText/BlackBoxTest/DevicePathToTextBBTestMain.c
+++ 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DevicePathToText/BlackBoxTest/DevicePathToTextBBTestMain.c
@@ -1162,9 +1162,9 @@ BuildAtaDeviceNode (

   Status = GetNextRequiredParam(, L"Controller", 
, );
   if ((!EFI_ERROR(Status)) && (ParamIdentifierVal != NULL)) {
-   if ((SctStrCmp (ParamIdentifierVal, L"Primary") == 0) || 
(SctStrCmp(ParamIdentifierVal, L"0"))) {
+if ((SctStrCmp (ParamIdentifierVal, L"Primary") == 0) || 
(SctStrCmp(ParamIdentifierVal, L"0") == 0)) {
   Atapi->PrimarySecondary = 0;
-} else if ((SctStrCmp (ParamIdentifierVal, L"Secondary") == 0) || 
(SctStrCmp(ParamIdentifierVal, L"1"))) {
+} else if ((SctStrCmp (ParamIdentifierVal, L"Secondary") == 0) || 
(SctStrCmp(ParamIdentifierVal, L"1") == 0)) {
   Atapi->PrimarySecondary = 1;
 } else {
   goto InValidText;
@@ -1175,9 +1175,9 @@ BuildAtaDeviceNode (

   Status = GetNextRequiredParam(, L"Drive", 
, );
   if ((!EFI_ERROR(Status)) && (ParamIdentifierVal != NULL)) {
-   if ((SctStrCmp (ParamIdentifierVal, L"Master") == 0) || 
(SctStrCmp(ParamIdentifierVal, L"0"))) {
+if ((SctStrCmp (ParamIdentifierVal, L"Master") == 0) || 
(SctStrCmp(ParamIdentifierVal, L"0") == 0)) {
   Atapi->SlaveMaster = 0;
-} else if ((SctStrCmp (ParamIdentifierVal, L"Slave") == 0) || 
(SctStrCmp(ParamIdentifierVal, L"1"))) {
+} else if ((SctStrCmp (ParamIdentifierVal, L"Slave") == 0) || 
(SctStrCmp(ParamIdentifierVal, L"1") == 0)) {
   Atapi->SlaveMaster = 1;
 } else {
   goto InValidText;
--
2.30.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#80377): https://edk2.groups.io/g/devel/message/80377
Mute This Topic: https://groups.io/mt/85467867/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH edk2-test 1/1] uefi-sct/SctPkg: unsupported TEXT_INPUT_EX.SetState

2021-09-08 Thread Heinrich Schuchardt
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3390

According to the UEFI specification
EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.SetState() may return EFI_UNSUPPORTED if
"the device does not support the ability to have its state set."

BBTestReadKeyStrokeExFunctionAutoTestCheckpoint1() must not report an error
in this case.

Fixes: e9c21711c17 ("uefi-sct/SctPkg:Add checkpoint of ReadKeyStrokeEx Toggle 
state")
Signed-off-by: Heinrich Schuchardt 
---
 .../BlackBoxTest/SimpleTextInputExBBTestFunction.c | 3 +++
 .../BlackBoxTest/SimpleTextInputExBBTestFunction.c | 3 +++
 2 files changed, 6 insertions(+)

diff --git 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestFunction.c
 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestFunction.c
index 3ae40ee3b3ed..c9eaf408ab02 100644
--- 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestFunction.c
+++ 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestFunction.c
@@ -1182,6 +1182,9 @@ BBTestReadKeyStrokeExFunctionAutoTestCheckpoint1 (
 SimpleTextInputEx,
 
 );
+  if (Status == EFI_UNSUPPORTED) {
+return EFI_UNSUPPORTED;
+  }

   if (EFI_ERROR(Status)) {
 StandardLib->RecordAssertion (
diff --git 
a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestFunction.c
 
b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestFunction.c
index 7dfd5dea6269..eddce4d3640d 100644
--- 
a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestFunction.c
+++ 
b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestFunction.c
@@ -1182,6 +1182,9 @@ BBTestReadKeyStrokeExFunctionAutoTestCheckpoint1 (
 SimpleTextInputEx,
 
 );
+  if (Status == EFI_UNSUPPORTED) {
+return EFI_UNSUPPORTED;
+  }

   if (EFI_ERROR(Status)) {
 StandardLib->RecordAssertion (
--
2.30.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#80376): https://edk2.groups.io/g/devel/message/80376
Mute This Topic: https://groups.io/mt/85467724/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH edk2-test 1/1] uefi-sct/SctPkg: uefi-sct: QueryVariableInfo(EFI_VARIABLE_NON_VOLATILE)

2021-06-30 Thread Heinrich Schuchardt
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3469

The Self Certification Test (SCT) II Case Specification, 2017 requires
in 5.2.1.4.5. that QueryVariableInfo() shall fail for

attributes = EFI_VARIABLE_NON_VOLATILE.

Add EFI_VARIABLE_NON_VOLATILE to tested values in function
QueryVariableInfoConfTestSub5().

Signed-off-by: Heinrich Schuchardt 
---
 .../BlackBoxTest/VariableServicesBBTestConformance.c | 1 +
 1 file changed, 1 insertion(+)

diff --git 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/VariableServices/BlackBoxTest/VariableServicesBBTestConformance.c
 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/VariableServices/BlackBoxTest/VariableServicesBBTestConformance.c
index e2182c5cca7b..731a3cadeac2 100644
--- 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/VariableServices/BlackBoxTest/VariableServicesBBTestConformance.c
+++ 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/VariableServices/BlackBoxTest/VariableServicesBBTestConformance.c
@@ -3399,6 +3399,7 @@ QueryVariableInfoConfTestSub5 (
 {
   EFI_STATUSStatus;
   UINT32InvalidAttributes[] = {
+  EFI_VARIABLE_NON_VOLATILE,
   EFI_VARIABLE_RUNTIME_ACCESS,
   
EFI_VARIABLE_NON_VOLATILE|EFI_VARIABLE_RUNTIME_ACCESS,
   0
--
2.30.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#77367): https://edk2.groups.io/g/devel/message/77367
Mute This Topic: https://groups.io/mt/83894157/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][PATCH v2 1/1] uefi-sct/SctPkg: Not create event with TPL_HIGH_LEVEL

2021-06-11 Thread Heinrich Schuchardt
On 11.06.21 10:35, Sunny Wang wrote:
> The commits a9d1fb58 and ae7e5477b555 caused SCT BS.CreateEvent failures.
>
> Section 7.1 of the UEFI Spec states that TPL_HIGH_LEVEL is designed for
> exclusive use by the firmware. The creation of events by UEFI
> applications, UEFI drivers, and UEFI OS Loaders should not use this TPL
> level.
>
> Therefore, revert TPL_HIGH_LEVEL change in commits a9d1fb58 and
> ae7e5477b555 to not create event with TPL_HIGH_LEVEL to be compliant
> with UEFI Spec and fix the failures.
>
> For more information, https://edk2.groups.io/g/devel/message/76338
>
> Cc: Samer El-Haj-Mahmoud 
> Cc: G Edhaya Chandran 
> Cc: Barton Gao 
> Cc: Heinrich Schuchardt 
> Cc: Michael D Kinney 
> Signed-off-by: Sunny Wang 

Acked-by: Heinrich Schuchardt 

> ---
>  .../EventTimerTaskPriorityServicesBBTestCreateEvent.c| 5 +
>  .../EventTimerTaskPriorityServicesBBTestCreateEventEx.c  | 4 +---
>  2 files changed, 2 insertions(+), 7 deletions(-)
>
> diff --git 
> a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/EventTimerTaskPriorityServicesBBTestCreateEvent.c
>  
> b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/EventTimerTaskPriorityServicesBBTestCreateEvent.c
> index a7e7366e..d5c033f7 100644
> --- 
> a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/EventTimerTaskPriorityServicesBBTestCreateEvent.c
> +++ 
> b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/EventTimerTaskPriorityServicesBBTestCreateEvent.c
> @@ -2,6 +2,7 @@
>
>Copyright 2006 - 2012 Unified EFI, Inc.
>Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.
> +  Copyright (c) 2021, ARM Limited. All rights reserved.
>
>This program and the accompanying materials
>are licensed and made available under the terms and conditions of the BSD 
> License
> @@ -190,7 +191,6 @@ BBTestCreateEvent_Conf_Sub1 (
>EFI_TPL NotifyTpls[] = {
>  TPL_CALLBACK,
>  TPL_NOTIFY,
> -TPL_HIGH_LEVEL,
>  0
>};
>EFI_TEST_ASSERTION  AssertionType;
> @@ -342,7 +342,6 @@ BBTestCreateEvent_Conf_Sub3 (
>EFI_TPL NotifyTpls[] = {
>  TPL_CALLBACK,
>  TPL_NOTIFY,
> -TPL_HIGH_LEVEL,
>  0
>};
>EFI_TEST_ASSERTION  AssertionType;
> @@ -407,7 +406,6 @@ BBTestCreateEvent_Conf_Sub4 (
>EFI_TPL NotifyTpls[] = {
>  TPL_CALLBACK,
>  TPL_NOTIFY,
> -TPL_HIGH_LEVEL,
>  0
>};
>EFI_TEST_ASSERTION  AssertionType;
> @@ -482,7 +480,6 @@ BBTestCreateEvent_Func_Sub1 (
>EFI_TPL NotifyTpls[] = {
>  TPL_CALLBACK,
>  TPL_NOTIFY,
> -TPL_HIGH_LEVEL,
>  0
>};
>EFI_TEST_ASSERTION  AssertionType;
> diff --git 
> a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/EventTimerTaskPriorityServicesBBTestCreateEventEx.c
>  
> b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/EventTimerTaskPriorityServicesBBTestCreateEventEx.c
> index eb458de5..03b7ae6e 100644
> --- 
> a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/EventTimerTaskPriorityServicesBBTestCreateEventEx.c
> +++ 
> b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/EventTimerTaskPriorityServicesBBTestCreateEventEx.c
> @@ -2,6 +2,7 @@
>
>Copyright 2006 - 2016 Unified EFI, Inc.
>Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.
> +  Copyright (c) 2021, ARM Limited. All rights reserved.
>
>This program and the accompanying materials
>are licensed and made available under the terms and conditions of the BSD 
> License
> @@ -228,7 +229,6 @@ BBTestCreateEventEx_Conf_Sub1 (
>EFI_TPL NotifyTpls[] = {
>  TPL_CALLBACK,
>  TPL_NOTIFY,
> -TPL_HIGH_LEVEL,
>  0
>};
>EFI_GUID*EventGroups[] = {
> @@ -318,7 +318,6 @@ BBTestCreateEventEx_Conf_Sub2 (
>EFI_TPL NotifyTpls[] = {
>  TPL_CALLBACK,
> 

Re: [edk2-devel] [edk2-test][PATCH v1 1/1] uefi-sct/SctPkg: Not create event with TPL_HIGH_LEVEL

2021-06-11 Thread Heinrich Schuchardt
On 11.06.21 09:07, Sunny Wang wrote:
> The commit a9d1fb58 caused SCT BS.CreateEvent failures.
>
> Section 7.1 of the UEFI Spec states that TPL_HIGH_LEVEL is designed for
> exclusive use by the firmware. The creation of events by UEFI
> applications, UEFI drivers, and UEFI OS Loaders should not use this TPL
> level.
>
> Therefore, revert TPL_HIGH_LEVEL change in commit a9d1fb58 to not create
> event with TPL_HIGH_LEVEL to be compliant with UEFI Spec and fix the
> failures.
>
> For more information, https://edk2.groups.io/g/devel/message/76338

Please, have a look at commit ae7e5477b555 ("uefi-sct/SctPkg: allowable
NotifyTpl in CreateEventEx") too.

Acked-by: Heinrich Schuchardt 

>
> Cc: Samer El-Haj-Mahmoud 
> Cc: G Edhaya Chandran 
> Cc: Barton Gao 
> Cc: Heinrich Schuchardt 
> Cc: Michael D Kinney 
> Signed-off-by: Sunny Wang 
> ---
>  .../EventTimerTaskPriorityServicesBBTestCreateEvent.c| 5 +
>  1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git 
> a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/EventTimerTaskPriorityServicesBBTestCreateEvent.c
>  
> b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/EventTimerTaskPriorityServicesBBTestCreateEvent.c
> index a7e7366e..d5c033f7 100644
> --- 
> a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/EventTimerTaskPriorityServicesBBTestCreateEvent.c
> +++ 
> b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/EventTimerTaskPriorityServicesBBTestCreateEvent.c
> @@ -2,6 +2,7 @@
>
>Copyright 2006 - 2012 Unified EFI, Inc.
>Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.
> +  Copyright (c) 2021, ARM Limited. All rights reserved.
>
>This program and the accompanying materials
>are licensed and made available under the terms and conditions of the BSD 
> License
> @@ -190,7 +191,6 @@ BBTestCreateEvent_Conf_Sub1 (
>EFI_TPL NotifyTpls[] = {
>  TPL_CALLBACK,
>  TPL_NOTIFY,
> -TPL_HIGH_LEVEL,
>  0
>};
>EFI_TEST_ASSERTION  AssertionType;
> @@ -342,7 +342,6 @@ BBTestCreateEvent_Conf_Sub3 (
>EFI_TPL NotifyTpls[] = {
>  TPL_CALLBACK,
>  TPL_NOTIFY,
> -TPL_HIGH_LEVEL,
>  0
>};
>EFI_TEST_ASSERTION  AssertionType;
> @@ -407,7 +406,6 @@ BBTestCreateEvent_Conf_Sub4 (
>EFI_TPL NotifyTpls[] = {
>  TPL_CALLBACK,
>  TPL_NOTIFY,
> -TPL_HIGH_LEVEL,
>  0
>};
>EFI_TEST_ASSERTION  AssertionType;
> @@ -482,7 +480,6 @@ BBTestCreateEvent_Func_Sub1 (
>EFI_TPL NotifyTpls[] = {
>  TPL_CALLBACK,
>  TPL_NOTIFY,
> -TPL_HIGH_LEVEL,
>  0
>};
>EFI_TEST_ASSERTION  AssertionType;
>



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#76374): https://edk2.groups.io/g/devel/message/76374
Mute This Topic: https://groups.io/mt/83463343/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] Commit a9d1fb58 - uefi-sct/SctPkg: allowable NotifyTpl in CreateEvent

2021-06-10 Thread Heinrich Schuchardt

On 6/10/21 7:22 PM, Samer El-Haj-Mahmoud wrote:

+ Mike

I agree with Sunny's evaluation. The original EDK2 patch from Jan had good 
feedback from Mike K.. The exact language from the UEFI spec section 7.1 is:

" Consequently, there is a fourth TPL, TPL_HIGH_LEVEL, designed for use exclusively 
by the firmware."


Firmware includes drivers. Drivers use CreateEvent().



" This is the highest priority level. It is not interruptible (interrupts are 
disabled) and is used sparingly by firmware to synchronize operations that need to be 
accessible from any priority level. For example, it must be possible to signal events 
while executing at any priority level. Therefore, firmware manipulates the internal event 
structure while at this priority level."

Given this, I think the following needs to happen:

1. The SCT commit 
(https://github.com/tianocore/edk2-test/commit/421a6997ef362c6286c4ef87d21d5367a9d1fb58
 ) needs to be reverted
2. The SCT change can be re-submitted as a new patch, without adding 
TPL_HIGH_LEVEL
3. The original EDK2 patch on Jan 6 
(https://edk2.groups.io/g/devel/topic/79479680#69853) needs to be re-submitted 
per Mike's feedback. This means not adding the TPL_HIGH_LEVEL support in 
CreateEvent

In my opinion, (1) needs to be reverted right way, as it is causing SCT 
failures on many (all?) EDK2 based systems. This needs to happen before the 
edk2-test stable tag is created


Table 7-3 TPL Restrictions in UEFI spec 2.9 explicitly has:

Event Notification Levels
> TPL_APPLICATION
<= TPL_HIGH_LEVEL

Nowhere does the specification say that CreateEvent() cannot be called
with with TPL_HIGH_LEVEL.

I can understand why Michael suggests that CreateEvent() should not be
callable at TPL_HIGH_LEVEL. But this requires a change request updating
the specification.

I am missing this step in the action list above.

1) and 2) can be done with a single patch. Just don't revert the line
adding TPL_APPLICATION.

Best regards

Heinrich



Any thought about these suggested next steps?

Thanks,
--Samer


-Original Message-
From: Sunny Wang 
Sent: Thursday, June 10, 2021 4:26 AM
To: Heinrich Schuchardt ; Samer El-Haj-Mahmoud
; Barton Gao
; G Edhaya Chandran

Cc: Sunny Wang 
Subject: RE: Commit a9d1fb58

Thanks for the information, Heinrich.

I think we need to further work on this for Mike's comment with your
ongoing edk2 patch.
  -
https://edk2.groups.io/g/devel/message/69853?p=,,,20,0,0,0::relevance,,M
deModulePkg%3A+correct+TPL+level+check+CoreCreateEventEx,20,2,0,794
79680
For addressing Mike's comment, we will need to update both of your edk2
and edk2-test patches.
Therefore, I would suggest NOT picking up your edk2-test commit into the
upcoming stable tag/release. What do you guys think?

In other words, the main problem is that SCT should not create an event with
TPL_HIGH_LEVEL, so we need to revert TPL_HIGH_LEVEL related change in
Heinrich's commit https://github.com/tianocore/edk2-
test/commit/421a6997ef362c6286c4ef87d21d5367a9d1fb58.

By the way, I confirmed this issue on two of my AARCH64 platforms (RPi4 and
another one).

Best Regards,
Sunny Wang

-Original Message-
From: Heinrich Schuchardt 
Sent: Thursday, June 10, 2021 1:04 PM
To: Samer El-Haj-Mahmoud ; Barton
Gao ; G Edhaya Chandran
; Sunny Wang 
Subject: Re: Commit a9d1fb58

On 6/10/21 4:10 AM, Samer El-Haj-Mahmoud wrote:

With commit
https://github.com/tianocore/edk2-

test/commit/421a6997ef362c6286c4ef87d21d5367a9d1fb58

<https://github.com/tianocore/edk2-

test/commit/421a6997ef362c6286c4ef87d21d5367a9d1fb58>

, I am seeing the following new failure on some EDK2 based systems:

BS.CreateEvent - Create event with all valid event type and supported TPL.

--

*FAILURE*

EF317ADE-8668-456F-BED9-766056672DFF

/RELEASE_BUILD/edk2-test/uefi-

sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/
BlackBoxTest/EventTimerTaskPriorityServicesBBTestCreateEvent.c:520:Statu
s - Invalid Parameter, EventType - 0x0100, NotifyTpl -

31

BS.CreateEvent - Create event with all valid event type and supported TPL.

--

*FAILURE*

EF317ADE-8668-456F-BED9-766056672DFF

/RELEASE_BUILD/edk2-test/uefi-

sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/
BlackBoxTest/EventTimerTaskPriorityServicesBBTestCreateEvent.c:520:Statu
s - Invalid Parameter, EventType - 0x0200, NotifyTpl -

31

Are we sure this is implemented properly in EDK2? I imagine this code is
common in TianoCore/EDK2, and all systems will experience such failure.

I confirmed this on one AARCH64 system. I am trying to confirm on
another AARCH64 as well.

Can anyone confirm on other systems/archs?

If there is going to be a stable tag/release of edk2-test, we may want
to confirm this change does not cause failures in many systems before we
pick it up.

Thanks,

--Samer


An EDK II patch is available since 2021-01-06 via
https://bugzilla.tianocore.org/show_bug.cgi?id=3058
Cf. https://edk2.groups.io/g/d

Re: [edk2-devel] [PATCH] Add support for RISCV GOT/PLT relocations

2021-05-27 Thread Heinrich Schuchardt
Am 27. Mai 2021 16:41:13 MESZ schrieb Sunil V L :
>Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3096
>
>This patch adds support for R_RISCV_CALL_PLT and R_RISCV_GOT_HI20
>relocations.
>

gnu-efi tries to avoid GOT based relocations on ARM using

#if defined(__GNUC__) && !__STDC_HOSTED__
#pragma GCC visibility push (hidden)
#endif

Maybe this is something we should additionally explore.

Best regards

Heinrich




>Signed-off-by: Sunil V L 
>Cc: Abner Chang 
>Cc: Daniel Schaefer 
>Cc: Heinrich Schuchardt 
>---
> BaseTools/Source/C/GenFw/Elf64Convert.c | 45 +
> 1 file changed, 39 insertions(+), 6 deletions(-)
>
>diff --git a/BaseTools/Source/C/GenFw/Elf64Convert.c
>b/BaseTools/Source/C/GenFw/Elf64Convert.c
>index d097db8632..d05dcf9992 100644
>--- a/BaseTools/Source/C/GenFw/Elf64Convert.c
>+++ b/BaseTools/Source/C/GenFw/Elf64Convert.c
>@@ -129,6 +129,8 @@ STATIC UINT32 mDebugOffset;
> STATIC UINT8   *mRiscVPass1Targ = NULL;>
> STATIC Elf_Shdr*mRiscVPass1Sym = NULL;>
> STATIC Elf64_Half  mRiscVPass1SymSecIndex = 0;>
>+STATIC INT32   mRiscVPass1Offset;>
>+STATIC INT32   mRiscVPass1GotFixup;>
> >
> //>
> // Initialization Function>
>@@ -479,11 +481,11 @@ WriteSectionRiscV64 (
> break;>
> >
>   case R_RISCV_32:>
>-*(UINT32 *)Targ = (UINT32)((UINT64)(*(UINT32 *)Targ) -
>SymShdr->sh_addr + mCoffSectionsOffset[Sym->st_shndx]);>
>+*(UINT64 *)Targ = Sym->st_value + Rel->r_addend;>
> break;>
> >
>   case R_RISCV_64:>
>-*(UINT64 *)Targ = *(UINT64 *)Targ - SymShdr->sh_addr +
>mCoffSectionsOffset[Sym->st_shndx];>
>+*(UINT64 *)Targ = Sym->st_value + Rel->r_addend;>
> break;>
> >
>   case R_RISCV_HI20:>
>@@ -533,6 +535,18 @@ WriteSectionRiscV64 (
> mRiscVPass1SymSecIndex = 0;>
> break;>
> >
>+  case R_RISCV_GOT_HI20:>
>+Value = (Sym->st_value - Rel->r_offset);>
>+mRiscVPass1Offset = RV_X(Value, 0, 12);>
>+Value = RV_X(Value, 12, 20);>
>+*(UINT32 *)Targ = (Value << 12) | (RV_X(*(UINT32*)Targ, 0, 12));>
>+>
>+mRiscVPass1Targ = Targ;>
>+mRiscVPass1Sym = SymShdr;>
>+mRiscVPass1SymSecIndex = Sym->st_shndx;>
>+mRiscVPass1GotFixup = 1;>
>+break;>
>+>
>   case R_RISCV_PCREL_HI20:>
> mRiscVPass1Targ = Targ;>
> mRiscVPass1Sym = SymShdr;>
>@@ -545,11 +559,17 @@ WriteSectionRiscV64 (
>if (mRiscVPass1Targ != NULL && mRiscVPass1Sym != NULL &&
>mRiscVPass1SymSecIndex != 0) {>
>   int i;>
>   Value2 = (UINT32)(RV_X(*(UINT32 *)mRiscVPass1Targ, 12, 20));>
>-  Value = (UINT32)(RV_X(*(UINT32 *)Targ, 20, 12));>
>-  if(Value & (RISCV_IMM_REACH/2)) {>
>-Value |= ~(RISCV_IMM_REACH-1);>
>+>
>+  if(mRiscVPass1GotFixup) {>
>+Value = (UINT32)(mRiscVPass1Offset);>
>+  } else {>
>+Value = (UINT32)(RV_X(*(UINT32 *)Targ, 20, 12));>
>+if(Value & (RISCV_IMM_REACH/2)) {>
>+  Value |= ~(RISCV_IMM_REACH-1);>
>+}>
>   }>
>Value = Value - (UINT32)mRiscVPass1Sym->sh_addr +
>mCoffSectionsOffset[mRiscVPass1SymSecIndex];>
>+>
>   if(-2048 > (INT32)Value) {>
> i = (((INT32)Value * -1) / 4096);>
> Value2 -= i;>
>@@ -569,12 +589,22 @@ WriteSectionRiscV64 (
> }>
>   }>
> >
>-  *(UINT32 *)Targ = (RV_X(Value, 0, 12) << 20) |
>(RV_X(*(UINT32*)Targ, 0, 20));>
>+  if(mRiscVPass1GotFixup) {>
>+*(UINT32 *)Targ = (RV_X((UINT32)Value, 0, 12) << 20)>
>+| (RV_X(*(UINT32*)Targ, 0, 20));>
>+/* Convert LD instruction to ADDI */>
>+*(UINT32 *)Targ = ((*(UINT32 *)Targ & ~0x707f) | 0x13);>
>+  }>
>+  else {>
>+*(UINT32 *)Targ = (RV_X(Value, 0, 12) << 20) |
>(RV_X(*(UINT32*)Targ, 0, 20));>
>+  }>
>*(UINT32 *)mRiscVPass1Targ = (RV_X(Value2, 0, 20)<<12) | (RV_X(*(UINT32
>*)mRiscVPass1Targ, 0, 12));>
> }>
> mRiscVPass1Sym = NULL;>
> mRiscVPass1Targ = NULL;>
> mRiscVPass1SymSecIndex = 0;>
>+mRiscVPass1Offset = 0;>
>+mRiscVPass1GotFixup = 0;>
> break;>
> >
>   case R_RISCV_ADD64:>
>@@ -586,6 +616,7 @@ WriteSectionRiscV64 (
>   case R_RISCV_GPREL_I:>
>   case R_RISCV_GPREL_S:>
>   case R_RISCV_CALL:>
>+  case R_RISCV_CALL_PLT:>
>   case R_RISCV_RVC_BRANCH:>
>   case R_RISCV_RVC_JUMP:>
>   case R_RISCV_RELAX:>
>@@ -1528,6 +1

Re: [edk2-devel] [PATCH edk2-test 1/1] uefi-sct/SctPkg: IHV: type mismatch in SimpleTextOut test

2021-05-10 Thread Heinrich Schuchardt

On 5/10/21 11:24 AM, Sunny Wang wrote:

Looks good. However, I'm thinking about if this is a UEFI specification issue. 
It looks like we should change the parameter type in 
EFI_SIMPLE_TEXT_OUTPUT_MODE data structure instead of doing typecasting.
Morevover, we may also need to check the files below:
- 
uefi-sct\SctPkg\TestCase\UEFI\EFI\Protocol\SimpleTextOut\BlackBoxTest\SimpleTextOutBBTestConformance_efi.c
- 
uefi-sct\SctPkg\TestCase\UEFI\EFI\Protocol\SimpleTextOut\BlackBoxTest\SimpleTextOutBBTestConformance_uefi.c
- 
uefi-sct\SctPkg\TestCase\UEFI\EFI\Protocol\SimpleTextOut\BlackBoxTest\SimpleTextOutBBTestFunction_efi.c
- 
uefi-sct\SctPkg\TestCase\UEFI\IHV\Protocol\SimpleTextOut\BlackBoxTest\SimpleTextOutBBTestConformance_uefi.c

Reviewed-by: Sunny Wang 


Thank you for reviewing.

I had a look into the UEFI spec 2.9:

Structure SIMPLE_TEXT_OUTPUT_MODE is defined with Mode and MaxMode as INT32.

EDK II uses the structure name EFI_SIMPLE_TEXT_OUTPUT_MODE instead of
SIMPLE_TEXT_OUTPUT_MODE.

Changing the component types in SIMPLE_TEXT_OUTPUT_MODE would break
forward and backward compatibility of UEFI applications. I see no value
in such a change.

Best regards

Heinrich



Best Regards,
Sunny Wang

-Original Message-
From: devel@edk2.groups.io  On Behalf Of Heinrich 
Schuchardt via groups.io
Sent: Tuesday, March 30, 2021 11:09 PM
To: EDK II Development 
Cc: Eric Jin ; G Edhaya Chandran ; Barton Gao 
; Arvin Chen ; Samer El-Haj-Mahmoud 
; Heinrich Schuchardt ; G Edhaya Chandran 

Subject: [edk2-devel] [PATCH edk2-test 1/1] uefi-sct/SctPkg: IHV: type mismatch 
in SimpleTextOut test

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3253

SctPrint() requires that %d refers to an UINTN parameter.

SimpleTextOutBBTestFunction_uefi.c has a lot of
StandardLib->RecordAssertion() calls where an INT32 is passed
as argument for a '%d' print code.

This leads to incorrect output like:

MaxMode=-549755813885,

-549755813885 is 0x0xFF83. So MaxMode actually is an INT32 with 
value 3 in this example.

Convert the parameters to UINTN.

Signed-off-by: Heinrich Schuchardt 
Reviewed-by: G Edhaya Chandran
---
  .../SimpleTextOutBBTestFunction_uefi.c| 624 +-
  1 file changed, 312 insertions(+), 312 deletions(-)

diff --git 
a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextOut/BlackBoxTest/SimpleTextOutBBTestFunction_uefi.c
 
b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextOut/BlackBoxTest/SimpleTextOutBBTestFunction_uefi.c
index 2bc9bcdb51f9..a833498c2816 100644
--- 
a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextOut/BlackBoxTest/SimpleTextOutBBTestFunction_uefi.c
+++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextOut/BlackBoxT
+++ est/SimpleTextOutBBTestFunction_uefi.c
@@ -176,12 +176,12 @@ BBTestResetFunctionManualTest (
   L" Expected:Cursor Position(%d x %d), MaxMode=%d.",
   __FILE__,
   (UINTN)__LINE__,
- SimpleOut->Mode->CursorColumn,
- SimpleOut->Mode->CursorRow,
- SimpleOut->Mode->MaxMode,
- ModeExpected.CursorColumn,
- ModeExpected.CursorRow,
- ModeExpected.MaxMode
+ (UINTN)SimpleOut->Mode->CursorColumn,
+ (UINTN)SimpleOut->Mode->CursorRow,
+ (UINTN)SimpleOut->Mode->MaxMode,
+ (UINTN)ModeExpected.CursorColumn,
+ (UINTN)ModeExpected.CursorRow,
+ (UINTN)ModeExpected.MaxMode
   );

//
@@ -272,12 +272,12 @@ BBTestResetFunctionManualTest (
   L" Expected:Cursor Position(%d x %d), MaxMode=%d.",
   __FILE__,
   (UINTN)__LINE__,
- SimpleOut->Mode->CursorColumn,
- SimpleOut->Mode->CursorRow,
- SimpleOut->Mode->MaxMode,
- ModeExpected.CursorColumn,
- ModeExpected.CursorRow,
- ModeExpected.MaxMode
+ (UINTN)SimpleOut->Mode->CursorColumn,
+ (UINTN)SimpleOut->Mode->CursorRow,
+ (UINTN)SimpleOut->Mode->MaxMode,
+ (UINTN)ModeExpected.CursorColumn,
+ (UINTN)ModeExpected.CursorRow,
+ (UINTN)ModeExpected.MaxMode
   );

//
@@ -505,12 +505,12 @@ BBTestResetFunctionAutoTest (
 L"Expected:Cursor Position(%d x %d), MaxMode=%d.",
 __FILE__,
 (UINTN)__LINE__,
-   SimpleOut->Mode->CursorColumn,
-   SimpleOut->Mode->CursorRow,
-   SimpleOut->Mode->MaxMode,
-   ModeExpected.CursorColumn,
-   ModeExpected.CursorRow,
-   ModeExpected.MaxMode
+   

[edk2-devel] [PATCH edk2-test 1/1] uefi-sct/SctPkg: correct print code for EFI_MEMORY_TYPE

2021-04-30 Thread Heinrich Schuchardt
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2284

EFI_MEMORY_TYPE is an enum. SctPrint expects an UINTN when printing with
%d. Add missing conversions in MemoryAllocationServicesBBTestFunction.

Signed-off-by: Heinrich Schuchardt 
---
 .../MemoryAllocationServicesBBTestFunction.c  | 98 +--
 1 file changed, 49 insertions(+), 49 deletions(-)

diff --git 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/MemoryAllocationServices/BlackBoxTest/MemoryAllocationServicesBBTestFunction.c
 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/MemoryAllocationServices/BlackBoxTest/MemoryAllocationServicesBBTestFunction.c
index bf8cd3b3afa4..e545b3cfc5b8 100644
--- 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/MemoryAllocationServices/BlackBoxTest/MemoryAllocationServicesBBTestFunction.c
+++ 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/MemoryAllocationServices/BlackBoxTest/MemoryAllocationServicesBBTestFunction.c
@@ -417,7 +417,7 @@ BBTestAllocatePagesInterfaceTest (
  (UINTN)__LINE__,
  Status,
  TplArray[Index],
- AllocatePagesMemoryType[TypeIndex]
+ (UINTN)AllocatePagesMemoryType[TypeIndex]
  );
   if (!(Memory & EFI_PAGE_MASK)) {
 AssertionType = EFI_TEST_ASSERTION_PASSED;
@@ -437,7 +437,7 @@ BBTestAllocatePagesInterfaceTest (
  __FILE__,
  (UINTN)__LINE__,
  TplArray[Index],
- AllocatePagesMemoryType[TypeIndex]
+ (UINTN)AllocatePagesMemoryType[TypeIndex]
  );
   if (Memory != 0) {
 Status = gtBS->FreePages (
@@ -455,7 +455,7 @@ BBTestAllocatePagesInterfaceTest (
  (UINTN)__LINE__,
  Status,
  TplArray[Index],
- AllocatePagesMemoryType[TypeIndex]
+ (UINTN)AllocatePagesMemoryType[TypeIndex]
  );
 }
   }
@@ -478,7 +478,7 @@ BBTestAllocatePagesInterfaceTest (
(UINTN)__LINE__,
Status,
TplArray[Index],
-   AllocatePagesMemoryType[TypeIndex]
+   (UINTN)AllocatePagesMemoryType[TypeIndex]
);
   } else {
 PageNum = (UINTN)Descriptor.NumberOfPages;
@@ -512,7 +512,7 @@ BBTestAllocatePagesInterfaceTest (
(UINTN)__LINE__,
Status,
TplArray[Index],
-   AllocatePagesMemoryType[TypeIndex]
+   (UINTN)AllocatePagesMemoryType[TypeIndex]
);
 if (!(Memory & EFI_PAGE_MASK)) {
   AssertionType = EFI_TEST_ASSERTION_PASSED;
@@ -532,7 +532,7 @@ BBTestAllocatePagesInterfaceTest (
__FILE__,
(UINTN)__LINE__,
TplArray[Index],
-   AllocatePagesMemoryType[TypeIndex]
+   (UINTN)AllocatePagesMemoryType[TypeIndex]
);
 if (Memory <= Descriptor.PhysicalStart +
  SctLShiftU64 (Descriptor.NumberOfPages, EFI_PAGE_SHIFT) -
@@ -554,7 +554,7 @@ BBTestAllocatePagesInterfaceTest (
__FILE__,
(UINTN)__LINE__,
TplArray[Index],
-   AllocatePagesMemoryType[TypeIndex],
+   (UINTN)AllocatePagesMemoryType[TypeIndex],
Descriptor.PhysicalStart,
Descriptor.NumberOfPages,
Memory
@@ -589,7 +589,7 @@ BBTestAllocatePagesInterfaceTest (
(UINTN)__LINE__,
Status,
TplArray[Index],
-   AllocatePagesMemoryType[TypeIndex]
+   (UINTN)AllocatePagesMemoryType[TypeIndex]
);
 if (!(Memory2 & EFI_PAGE_MASK)) {
   AssertionType = EFI_TEST_ASSERTION_PASSED;
@@ -609,7 +609,7 @@ BBTestAllocatePagesInterfaceTest (
__FILE__,
(UINTN)__LINE__,
TplArray[Index],
-   AllocatePagesMemoryType[TypeIndex]
+   (UINTN)AllocatePagesMemoryType[TypeIndex]
);
 if ( Memory2 <= Descriptor.PhysicalStart +
  SctLShiftU64 (Descriptor.NumberOfPages, EFI_PAGE_SHIFT) -
@@ -631,7 +631,7 @@ BBTestAllocatePagesInterfaceTest (
__FILE__,
(UINTN)__LINE__,
TplArray[Index],
-   AllocatePagesMemoryType[TypeIndex],
+   (UINTN)AllocatePagesMemoryType[TypeIndex],
Memory2
);
   

[edk2-devel] [PATCH edk2-test 1/1] uefi-sct/SctPkg: fix BuildAtaDeviceNode()

2021-03-31 Thread Heinrich Schuchardt
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3290

When BuildAtaDeviceNode() is called with L"Ata(0,0,0)" it creates a node
Ata(1,1,0). This leads to test to an assertion failed test result

../DevicePathToTextBBTestFunction.c:332:
Convert result: Ata(0,0,0) - Expected: Ata(Primary,Master,0)

Signed-off-by: Heinrich Schuchardt 
---
 .../BlackBoxTest/DevicePathToTextBBTestMain.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DevicePathToText/BlackBoxTest/DevicePathToTextBBTestMain.c
 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DevicePathToText/BlackBoxTest/DevicePathToTextBBTestMain.c
index 7cf473d30643..59f9cc71831b 100644
--- 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DevicePathToText/BlackBoxTest/DevicePathToTextBBTestMain.c
+++ 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DevicePathToText/BlackBoxTest/DevicePathToTextBBTestMain.c
@@ -1162,9 +1162,9 @@ BuildAtaDeviceNode (

   Status = GetNextRequiredParam(, L"Controller", 
, );
   if ((!EFI_ERROR(Status)) && (ParamIdentifierVal != NULL)) {
-   if ((SctStrCmp (ParamIdentifierVal, L"Primary") == 0) || 
(SctStrCmp(ParamIdentifierVal, L"0"))) {
+if ((SctStrCmp (ParamIdentifierVal, L"Primary") == 0) || 
(SctStrCmp(ParamIdentifierVal, L"0" == 0))) {
   Atapi->PrimarySecondary = 0;
-} else if ((SctStrCmp (ParamIdentifierVal, L"Secondary") == 0) || 
(SctStrCmp(ParamIdentifierVal, L"1"))) {
+} else if ((SctStrCmp (ParamIdentifierVal, L"Secondary") == 0) || 
(SctStrCmp(ParamIdentifierVal, L"1" == 0))) {
   Atapi->PrimarySecondary = 1;
 } else {
   goto InValidText;
@@ -1175,9 +1175,9 @@ BuildAtaDeviceNode (

   Status = GetNextRequiredParam(, L"Drive", 
, );
   if ((!EFI_ERROR(Status)) && (ParamIdentifierVal != NULL)) {
-   if ((SctStrCmp (ParamIdentifierVal, L"Master") == 0) || 
(SctStrCmp(ParamIdentifierVal, L"0"))) {
+if ((SctStrCmp (ParamIdentifierVal, L"Master") == 0) || 
(SctStrCmp(ParamIdentifierVal, L"0") == 0)) {
   Atapi->SlaveMaster = 0;
-} else if ((SctStrCmp (ParamIdentifierVal, L"Slave") == 0) || 
(SctStrCmp(ParamIdentifierVal, L"1"))) {
+} else if ((SctStrCmp (ParamIdentifierVal, L"Slave") == 0) || 
(SctStrCmp(ParamIdentifierVal, L"1" == 0))) {
   Atapi->SlaveMaster = 1;
 } else {
   goto InValidText;
--
2.30.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#73580): https://edk2.groups.io/g/devel/message/73580
Mute This Topic: https://groups.io/mt/81752799/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH edk2-test 1/1] uefi-sct/SctPkg: IHV: type mismatch in SimpleTextOut test

2021-03-30 Thread Heinrich Schuchardt
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3253

SctPrint() requires that %d refers to an UINTN parameter.

SimpleTextOutBBTestFunction_uefi.c has a lot of
StandardLib->RecordAssertion() calls where an INT32 is passed
as argument for a '%d' print code.

This leads to incorrect output like:

MaxMode=-549755813885,

-549755813885 is 0x0xFF83. So MaxMode actually
is an INT32 with value 3 in this example.

Convert the parameters to UINTN.

Signed-off-by: Heinrich Schuchardt 
Reviewed-by: G Edhaya Chandran
---
 .../SimpleTextOutBBTestFunction_uefi.c| 624 +-
 1 file changed, 312 insertions(+), 312 deletions(-)

diff --git 
a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextOut/BlackBoxTest/SimpleTextOutBBTestFunction_uefi.c
 
b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextOut/BlackBoxTest/SimpleTextOutBBTestFunction_uefi.c
index 2bc9bcdb51f9..a833498c2816 100644
--- 
a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextOut/BlackBoxTest/SimpleTextOutBBTestFunction_uefi.c
+++ 
b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextOut/BlackBoxTest/SimpleTextOutBBTestFunction_uefi.c
@@ -176,12 +176,12 @@ BBTestResetFunctionManualTest (
  L" Expected:Cursor Position(%d x %d), MaxMode=%d.",
  __FILE__,
  (UINTN)__LINE__,
- SimpleOut->Mode->CursorColumn,
- SimpleOut->Mode->CursorRow,
- SimpleOut->Mode->MaxMode,
- ModeExpected.CursorColumn,
- ModeExpected.CursorRow,
- ModeExpected.MaxMode
+ (UINTN)SimpleOut->Mode->CursorColumn,
+ (UINTN)SimpleOut->Mode->CursorRow,
+ (UINTN)SimpleOut->Mode->MaxMode,
+ (UINTN)ModeExpected.CursorColumn,
+ (UINTN)ModeExpected.CursorRow,
+ (UINTN)ModeExpected.MaxMode
  );

   //
@@ -272,12 +272,12 @@ BBTestResetFunctionManualTest (
  L" Expected:Cursor Position(%d x %d), MaxMode=%d.",
  __FILE__,
  (UINTN)__LINE__,
- SimpleOut->Mode->CursorColumn,
- SimpleOut->Mode->CursorRow,
- SimpleOut->Mode->MaxMode,
- ModeExpected.CursorColumn,
- ModeExpected.CursorRow,
- ModeExpected.MaxMode
+ (UINTN)SimpleOut->Mode->CursorColumn,
+ (UINTN)SimpleOut->Mode->CursorRow,
+ (UINTN)SimpleOut->Mode->MaxMode,
+ (UINTN)ModeExpected.CursorColumn,
+ (UINTN)ModeExpected.CursorRow,
+ (UINTN)ModeExpected.MaxMode
  );

   //
@@ -505,12 +505,12 @@ BBTestResetFunctionAutoTest (
L"Expected:Cursor Position(%d x %d), MaxMode=%d.",
__FILE__,
(UINTN)__LINE__,
-   SimpleOut->Mode->CursorColumn,
-   SimpleOut->Mode->CursorRow,
-   SimpleOut->Mode->MaxMode,
-   ModeExpected.CursorColumn,
-   ModeExpected.CursorRow,
-   ModeExpected.MaxMode
+   (UINTN)SimpleOut->Mode->CursorColumn,
+   (UINTN)SimpleOut->Mode->CursorRow,
+   (UINTN)SimpleOut->Mode->MaxMode,
+   (UINTN)ModeExpected.CursorColumn,
+   (UINTN)ModeExpected.CursorRow,
+   (UINTN)ModeExpected.MaxMode
);

 //
@@ -582,12 +582,12 @@ BBTestResetFunctionAutoTest (
L" Expected:Cursor Position(%d x %d), MaxMode=%d.",
__FILE__,
(UINTN)__LINE__,
-   SimpleOut->Mode->CursorColumn,
-   SimpleOut->Mode->CursorRow,
-   SimpleOut->Mode->MaxMode,
-   ModeExpected.CursorColumn,
-   ModeExpected.CursorRow,
-   ModeExpected.MaxMode
+   (UINTN)SimpleOut->Mode->CursorColumn,
+   (UINTN)SimpleOut->Mode->CursorRow,
+   (UINTN)SimpleOut->Mode->MaxMode,
+   (UINTN)ModeExpected.CursorColumn,
+   (UINTN)ModeExpected.CursorRow,
+   (UINTN)ModeExpected.MaxMode
);

 //
@@ -850,18 +850,18 @@ BBTestOutputStringFunctionAutoTest (
  L" Expected:Cursor Position(%d x %d), Mode=%d, MaxMode=%d, 
Attribute=%d, CursorVisible=%d.",
  __FILE__,
  (UINTN)__LINE__,
- SimpleOut->Mode->CursorColumn,
- SimpleOut->Mode->CursorRow,
- SimpleOut->Mode->Mode,
- SimpleOut->Mode->MaxMod

[edk2-devel] [PATCH edk2-test 1/1] uefi-sct/SctPkg: type mismatch in Simple Network test

2021-03-30 Thread Heinrich Schuchardt
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3257

SctPrint() requires that %x and %d refers to an UINTN parameter.

SimpleNetworkBBTestFunction.c tries to print INT32 using %x, %d without
converting to UINTN resulting in corrupted output like:

SimpleNetworkBBTestFunction.c:891:
Status - Unsupported, Filter - 

Mode->ReceiveFilterSetting has only 32 bit. The true value is 0.

Convert the parameters to UINTN.

Signed-off-by: Heinrich Schuchardt 
---
 .../SimpleNetworkBBTestFunction.c | 52 +--
 1 file changed, 26 insertions(+), 26 deletions(-)

diff --git 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/BlackBoxTest/SimpleNetworkBBTestFunction.c
 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/BlackBoxTest/SimpleNetworkBBTestFunction.c
index 8767e68e92d4..5fc01aadd96a 100644
--- 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/BlackBoxTest/SimpleNetworkBBTestFunction.c
+++ 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/BlackBoxTest/SimpleNetworkBBTestFunction.c
@@ -775,7 +775,7 @@ BBTestReceiveFilterFunctionTest (
__FILE__,
(UINTN)__LINE__,
Status,
-   SnpInterface->Mode->ReceiveFilterSetting
+   (UINTN)SnpInterface->Mode->ReceiveFilterSetting
);

 // Check point A. Enable Specified bit.
@@ -797,7 +797,7 @@ BBTestReceiveFilterFunctionTest (
__FILE__,
(UINTN)__LINE__,
Status,
-   SnpInterface->Mode->ReceiveFilterSetting
+   (UINTN)SnpInterface->Mode->ReceiveFilterSetting
);

 // Check point C. Enable and Disable Specified bit together.
@@ -819,7 +819,7 @@ BBTestReceiveFilterFunctionTest (
__FILE__,
(UINTN)__LINE__,
Status,
-   SnpInterface->Mode->ReceiveFilterSetting
+   (UINTN)SnpInterface->Mode->ReceiveFilterSetting
);
   }

@@ -856,12 +856,12 @@ BBTestReceiveFilterFunctionTest (
__FILE__,
(UINTN)__LINE__,
Status,
-   SnpInterface->Mode->ReceiveFilterSetting,
-   SnpInterface->Mode->ReceiveFilterMask,
-   SnpInterface->Mode->MCastFilterCount,
-   SnpInterface->Mode->MCastFilter[0].Addr[0],
-   SnpInterface->Mode->MCastFilter[0].Addr[5],
-   SnpInterface->Mode->MCastFilter[1].Addr[0]
+   (UINTN)SnpInterface->Mode->ReceiveFilterSetting,
+   (UINTN)SnpInterface->Mode->ReceiveFilterMask,
+   (UINTN)SnpInterface->Mode->MCastFilterCount,
+   (UINTN)SnpInterface->Mode->MCastFilter[0].Addr[0],
+   (UINTN)SnpInterface->Mode->MCastFilter[0].Addr[5],
+   (UINTN)SnpInterface->Mode->MCastFilter[1].Addr[0]
);
   }

@@ -885,17 +885,17 @@ BBTestReceiveFilterFunctionTest (
  AssertionType,
  gSimpleNetworkBBTestFunctionAssertionGuid012,
  L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke 
ReceiveFilters() to reset multicast receive filters list and verify interface 
correctness within test case",
- L"%a:%d:Status - %r, Filter - %x, Mask - %x,Count - %d(%d), 
Address - %x, %x, %x",
+ L"%a:%d:Status - %r, Filter - %x, Mask - %x, Count - %d(%d), 
Address - %x, %x, %x",
  __FILE__,
  (UINTN)__LINE__,
  Status,
- SnpInterface->Mode->ReceiveFilterSetting,
- SnpInterface->Mode->ReceiveFilterMask,
- SnpInterface->Mode->MCastFilterCount,
- Mode.MCastFilterCount,
- SnpInterface->Mode->MCastFilter[0].Addr[0],
- SnpInterface->Mode->MCastFilter[0].Addr[5],
- SnpInterface->Mode->MCastFilter[1].Addr[0]
+ (UINTN)SnpInterface->Mode->ReceiveFilterSetting,
+ (UINTN)SnpInterface->Mode->ReceiveFilterMask,
+ (UINTN)SnpInterface->Mode->MCastFilterCount,
+ (UINTN)Mode.MCastFilterCount,
+ (UINTN)SnpInterface->Mode->MCastFilter[0].Addr[0],
+ (UINTN)SnpInterface->Mode->MCastFilter[0].Addr[5],
+ (UINTN)SnpInterface->Mode->MCastFilter[1].Addr[0]
  );
   //
   // Restore SNP State
@@ -1358,12 +1358,12 @@ BBTestMCastIpToMacFunctionTest (
  __FILE__,
  (UINTN)__LINE__,
  Status,
- MAC1.Addr[0],
- MAC

[edk2-devel] [PATCH edk2-test 1/1] uefi-sct/SctPkg: IHV: type mismatch in Simple Network test

2021-03-22 Thread Heinrich Schuchardt
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3257

SctPrint() requires that %x and %d refers to an UINTN parameter.

SimpleNetworkBBTestFunction.c tries to print INT32 using %x, %d without
converting to UINTN resulting in corrupted output like:

SimpleNetworkBBTestFunction.c:891:
Status - Unsupported, Filter - 

Mode->ReceiveFilterSetting has only 32 bit. The true value is 0.

Convert the parameters to UINTN.

Signed-off-by: Heinrich Schuchardt 
---
 .../SimpleNetworkBBTestFunction.c | 50 +--
 1 file changed, 25 insertions(+), 25 deletions(-)

diff --git 
a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleNetwork/BlackBoxTest/SimpleNetworkBBTestFunction.c
 
b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleNetwork/BlackBoxTest/SimpleNetworkBBTestFunction.c
index ca15df6303f6..06ad3163ef6b 100644
--- 
a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleNetwork/BlackBoxTest/SimpleNetworkBBTestFunction.c
+++ 
b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleNetwork/BlackBoxTest/SimpleNetworkBBTestFunction.c
@@ -775,7 +775,7 @@ BBTestReceiveFilterFunctionTest (
__FILE__,
(UINTN)__LINE__,
Status,
-   SnpInterface->Mode->ReceiveFilterSetting
+   (UINTN)SnpInterface->Mode->ReceiveFilterSetting
);

 // Check point A. Enable Specified bit.
@@ -797,7 +797,7 @@ BBTestReceiveFilterFunctionTest (
__FILE__,
(UINTN)__LINE__,
Status,
-   SnpInterface->Mode->ReceiveFilterSetting
+   (UINTN)SnpInterface->Mode->ReceiveFilterSetting
);

 // Check point C. Enable and Disable Specified bit together.
@@ -819,7 +819,7 @@ BBTestReceiveFilterFunctionTest (
__FILE__,
(UINTN)__LINE__,
Status,
-   SnpInterface->Mode->ReceiveFilterSetting
+   (UINTN)SnpInterface->Mode->ReceiveFilterSetting
);
   }

@@ -856,12 +856,12 @@ BBTestReceiveFilterFunctionTest (
__FILE__,
(UINTN)__LINE__,
Status,
-   SnpInterface->Mode->ReceiveFilterSetting,
-   SnpInterface->Mode->ReceiveFilterMask,
-   SnpInterface->Mode->MCastFilterCount,
-   SnpInterface->Mode->MCastFilter[0].Addr[0],
-   SnpInterface->Mode->MCastFilter[0].Addr[5],
-   SnpInterface->Mode->MCastFilter[1].Addr[0]
+   (UINTN)SnpInterface->Mode->ReceiveFilterSetting,
+   (UINTN)SnpInterface->Mode->ReceiveFilterMask,
+   (UINTN)SnpInterface->Mode->MCastFilterCount,
+   (UINTN)SnpInterface->Mode->MCastFilter[0].Addr[0],
+   (UINTN)SnpInterface->Mode->MCastFilter[0].Addr[5],
+   (UINTN)SnpInterface->Mode->MCastFilter[1].Addr[0]
);
   }

@@ -889,13 +889,13 @@ BBTestReceiveFilterFunctionTest (
  __FILE__,
  (UINTN)__LINE__,
  Status,
- SnpInterface->Mode->ReceiveFilterSetting,
- SnpInterface->Mode->ReceiveFilterMask,
- SnpInterface->Mode->MCastFilterCount,
- Mode.MCastFilterCount,
- SnpInterface->Mode->MCastFilter[0].Addr[0],
- SnpInterface->Mode->MCastFilter[0].Addr[5],
- SnpInterface->Mode->MCastFilter[1].Addr[0]
+ (UINTN)SnpInterface->Mode->ReceiveFilterSetting,
+ (UINTN)SnpInterface->Mode->ReceiveFilterMask,
+ (UINTN)SnpInterface->Mode->MCastFilterCount,
+ (UINTN)Mode.MCastFilterCount,
+ (UINTN)SnpInterface->Mode->MCastFilter[0].Addr[0],
+ (UINTN)SnpInterface->Mode->MCastFilter[0].Addr[5],
+ (UINTN)SnpInterface->Mode->MCastFilter[1].Addr[0]
  );
   //
   // Restore SNP State
@@ -1358,12 +1358,12 @@ BBTestMCastIpToMacFunctionTest (
  __FILE__,
  (UINTN)__LINE__,
  Status,
- MAC1.Addr[0],
- MAC1.Addr[1],
- MAC1.Addr[2],
- MAC1.Addr[3],
- MAC1.Addr[4],
- MAC1.Addr[5]
+ (UINTN)MAC1.Addr[0],
+ (UINTN)MAC1.Addr[1],
+ (UINTN)MAC1.Addr[2],
+ (UINTN)MAC1.Addr[3],
+ (UINTN)MAC1.Addr[4],
+ (UINTN)MAC1.Addr[5]
  );

   //
@@ -1510,8 +1510,8 @@ BBTestNVDataFunctionTest (
__FILE__,
(UINTN)__LINE_

[edk2-devel] [PATCH edk2-test 1/1] uefi-sct/SctPkg: type mismatch in SimpleTextOut test

2021-03-09 Thread Heinrich Schuchardt
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3253

SctPrint() requires that %d refers to an UINTN parameter.

SimpleTextOutBBTestFunction_uefi.c has a lot of
StandardLib->RecordAssertion() calls where an INT32 is passed
as argument for a '%d' print code.

This leads to incorrect output like:

MaxMode=-549755813885,

-549755813885 is 0x0xFF83. So MaxMode actually
is an INT32 with value 3 in this example.

Convert the parameters to UINTN.

Signed-off-by: Heinrich Schuchardt 
---
 .../SimpleTextOutBBTestFunction_uefi.c| 624 +-
 1 file changed, 312 insertions(+), 312 deletions(-)

diff --git 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextOut/BlackBoxTest/SimpleTextOutBBTestFunction_uefi.c
 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextOut/BlackBoxTest/SimpleTextOutBBTestFunction_uefi.c
index 9b0ae233ce5f..bbe3f4e27077 100644
--- 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextOut/BlackBoxTest/SimpleTextOutBBTestFunction_uefi.c
+++ 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextOut/BlackBoxTest/SimpleTextOutBBTestFunction_uefi.c
@@ -176,12 +176,12 @@ BBTestResetFunctionManualTest (
  L" Expected:Cursor Position(%d x %d), MaxMode=%d.",
  __FILE__,
  (UINTN)__LINE__,
- SimpleOut->Mode->CursorColumn,
- SimpleOut->Mode->CursorRow,
- SimpleOut->Mode->MaxMode,
- ModeExpected.CursorColumn,
- ModeExpected.CursorRow,
- ModeExpected.MaxMode
+ (UINTN)SimpleOut->Mode->CursorColumn,
+ (UINTN)SimpleOut->Mode->CursorRow,
+ (UINTN)SimpleOut->Mode->MaxMode,
+ (UINTN)ModeExpected.CursorColumn,
+ (UINTN)ModeExpected.CursorRow,
+ (UINTN)ModeExpected.MaxMode
  );

   //
@@ -272,12 +272,12 @@ BBTestResetFunctionManualTest (
  L" Expected:Cursor Position(%d x %d), MaxMode=%d.",
  __FILE__,
  (UINTN)__LINE__,
- SimpleOut->Mode->CursorColumn,
- SimpleOut->Mode->CursorRow,
- SimpleOut->Mode->MaxMode,
- ModeExpected.CursorColumn,
- ModeExpected.CursorRow,
- ModeExpected.MaxMode
+ (UINTN)SimpleOut->Mode->CursorColumn,
+ (UINTN)SimpleOut->Mode->CursorRow,
+ (UINTN)SimpleOut->Mode->MaxMode,
+ (UINTN)ModeExpected.CursorColumn,
+ (UINTN)ModeExpected.CursorRow,
+ (UINTN)ModeExpected.MaxMode
  );

   //
@@ -505,12 +505,12 @@ BBTestResetFunctionAutoTest (
L"Expected:Cursor Position(%d x %d), MaxMode=%d.",
__FILE__,
(UINTN)__LINE__,
-   SimpleOut->Mode->CursorColumn,
-   SimpleOut->Mode->CursorRow,
-   SimpleOut->Mode->MaxMode,
-   ModeExpected.CursorColumn,
-   ModeExpected.CursorRow,
-   ModeExpected.MaxMode
+   (UINTN)SimpleOut->Mode->CursorColumn,
+   (UINTN)SimpleOut->Mode->CursorRow,
+   (UINTN)SimpleOut->Mode->MaxMode,
+   (UINTN)ModeExpected.CursorColumn,
+   (UINTN)ModeExpected.CursorRow,
+   (UINTN)ModeExpected.MaxMode
);

 //
@@ -582,12 +582,12 @@ BBTestResetFunctionAutoTest (
L" Expected:Cursor Position(%d x %d), MaxMode=%d.",
__FILE__,
(UINTN)__LINE__,
-   SimpleOut->Mode->CursorColumn,
-   SimpleOut->Mode->CursorRow,
-   SimpleOut->Mode->MaxMode,
-   ModeExpected.CursorColumn,
-   ModeExpected.CursorRow,
-   ModeExpected.MaxMode
+   (UINTN)SimpleOut->Mode->CursorColumn,
+   (UINTN)SimpleOut->Mode->CursorRow,
+   (UINTN)SimpleOut->Mode->MaxMode,
+   (UINTN)ModeExpected.CursorColumn,
+   (UINTN)ModeExpected.CursorRow,
+   (UINTN)ModeExpected.MaxMode
);

 //
@@ -850,18 +850,18 @@ BBTestOutputStringFunctionAutoTest (
  L" Expected:Cursor Position(%d x %d), Mode=%d, MaxMode=%d, 
Attribute=%d, CursorVisible=%d.",
  __FILE__,
  (UINTN)__LINE__,
- SimpleOut->Mode->CursorColumn,
- SimpleOut->Mode->CursorRow,
- SimpleOut->Mode->Mode,
- SimpleOut->Mode->MaxMod

[edk2-devel] [PATCH edk2-test 1/1] uefi-sct/SctPkg: typo Positoin

2021-03-03 Thread Heinrich Schuchardt
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3244

%s/Positoin/Position/g
%s/positoin/position/g

Signed-off-by: Heinrich Schuchardt 
---
 .../BlackBoxTest/SimpleTextOutBBTestConformance_efi.c | 4 ++--
 .../BlackBoxTest/SimpleTextOutBBTestConformance_uefi.c| 4 ++--
 .../BlackBoxTest/SimpleTextOutBBTestFunction_efi.c| 4 ++--
 .../BlackBoxTest/SimpleTextOutBBTestFunction_uefi.c   | 4 ++--
 .../BlackBoxTest/SimpleTextOutBBTestConformance_uefi.c| 4 ++--
 .../BlackBoxTest/SimpleTextOutBBTestFunction_uefi.c   | 4 ++--
 .../SctPkg/TestInfrastructure/SCT/Framework/UI/KeyFunction.c  | 2 +-
 7 files changed, 13 insertions(+), 13 deletions(-)

diff --git 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextOut/BlackBoxTest/SimpleTextOutBBTestConformance_efi.c
 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextOut/BlackBoxTest/SimpleTextOutBBTestConformance_efi.c
index 3b394f242434..8b8c3f86f3ca 100644
--- 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextOut/BlackBoxTest/SimpleTextOutBBTestConformance_efi.c
+++ 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextOut/BlackBoxTest/SimpleTextOutBBTestConformance_efi.c
@@ -840,7 +840,7 @@ BBTestSetCursorPositionConformanceAutoTest (
  AssertionType,
  gSimpleTextOutputConformanceTestAssertionGuid009,
  L"EFI_SIMPLE_TEXT_OUT_PROTOCOL.SetCursorPosition - 
SetCursorPosition() with invalid position, mode position integrity",
- L"%a:%d: Mode=%d, Positoin=(%d x %d) Current: Cursor 
Position(%d x %d), Mode=%d, MaxMode=%d, Attribute=%d, CursorVisible=%d. "\
+ L"%a:%d: Mode=%d, Position=(%d x %d) Current: Cursor 
Position(%d x %d), Mode=%d, MaxMode=%d, Attribute=%d, CursorVisible=%d. "\
  L" Expected:Cursor Position(%d x %d), Mode=%d, 
MaxMode=%d, Attribute=%d, CursorVisible=%d.",
  __FILE__,
  (UINTN)__LINE__,
@@ -873,7 +873,7 @@ BBTestSetCursorPositionConformanceAutoTest (
  StandardLib,
  AssertionType,
  gSimpleTextOutputConformanceTestAssertionGuid010,
- L"EFI_SIMPLE_TEXT_OUT_PROTOCOL.SetCursorPosition - 
SetCursorPositoin() with invalid Position",
+ L"EFI_SIMPLE_TEXT_OUT_PROTOCOL.SetCursorPosition - 
SetCursorPosition() with invalid Position",
  L"%a:%d: Status = %r, Mode = %d, Position = (%d x %d)",
  __FILE__,
  (UINTN)__LINE__,
diff --git 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextOut/BlackBoxTest/SimpleTextOutBBTestConformance_uefi.c
 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextOut/BlackBoxTest/SimpleTextOutBBTestConformance_uefi.c
index 9afb3c0882b7..99e14d7b3bae 100644
--- 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextOut/BlackBoxTest/SimpleTextOutBBTestConformance_uefi.c
+++ 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextOut/BlackBoxTest/SimpleTextOutBBTestConformance_uefi.c
@@ -838,7 +838,7 @@ BBTestSetCursorPositionConformanceAutoTest (
  AssertionType,
  gSimpleTextOutputConformanceTestAssertionGuid009,
  L"EFI_SIMPLE_TEXT_OUT_PROTOCOL.SetCursorPosition - 
SetCursorPosition() with invalid position, mode position integrity",
- L"%a:%d: Mode=%d, Positoin=(%d x %d) Current: Cursor 
Position(%d x %d), Mode=%d, MaxMode=%d, Attribute=%d, CursorVisible=%d. "\
+ L"%a:%d: Mode=%d, Position=(%d x %d) Current: Cursor 
Position(%d x %d), Mode=%d, MaxMode=%d, Attribute=%d, CursorVisible=%d. "\
  L" Expected:Cursor Position(%d x %d), Mode=%d, 
MaxMode=%d, Attribute=%d, CursorVisible=%d.",
  __FILE__,
  (UINTN)__LINE__,
@@ -871,7 +871,7 @@ BBTestSetCursorPositionConformanceAutoTest (
  StandardLib,
  AssertionType,
  gSimpleTextOutputConformanceTestAssertionGuid010,
- L"EFI_SIMPLE_TEXT_OUT_PROTOCOL.SetCursorPosition - 
SetCursorPositoin() with invalid Position",
+ L"EFI_SIMPLE_TEXT_OUT_PROTOCOL.SetCursorPosition - 
SetCursorPosition() with invalid Position",
  L"%a:%d: Status = %r, Mode = %d, Position = (%d x %d)",
  __FILE__,
  (UINTN)__LINE__,
diff --git 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextOut/BlackBoxTest/SimpleTextOutBBTestFunction_efi.c
 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextOut/BlackBoxTest/SimpleTextOutBBTestFunction_efi.c
index e59e51fc12bb..6b3db8a054ab 100644
--- 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextOut/BlackBoxTest/Simp

[edk2-devel] [PATCH edk2-test 1/1] SctPkg: remove CR in uefi-sct/SctPkg/build.sh

2021-02-26 Thread Heinrich Schuchardt
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3239

A superfluous carriage return leads to an error:

uefi-sct/SctPkg/build.sh: line 61:
syntax error near unexpected token `fi'
uefi-sct/SctPkg/build.sh: line 61:
`fi'

Signed-off-by: Heinrich Schuchardt 
---
 uefi-sct/SctPkg/build.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/uefi-sct/SctPkg/build.sh b/uefi-sct/SctPkg/build.sh
index 2efc5535b8fc..de7a10034e3d 100755
--- a/uefi-sct/SctPkg/build.sh
+++ b/uefi-sct/SctPkg/build.sh
@@ -56,7 +56,7 @@ function get_gcc_version
 {
gcc_version=$($1 -dumpversion)

-   if [ ${gcc_version%%.*} -ge 5 ]; then
+   if [ ${gcc_version%%.*} -ge 5 ]; then
gcc_version=5
fi

--
2.30.0



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#72232): https://edk2.groups.io/g/devel/message/72232
Mute This Topic: https://groups.io/mt/80925661/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 PATCH v1 2/2] SctPkg: Enable RISCV64 support using AARCH64 sources

2021-02-09 Thread Heinrich Schuchardt
On 09.02.21 13:42, Leif Lindholm wrote:
> On Mon, Feb 08, 2021 at 18:04:45 +0100, Heinrich Schuchardt wrote:
>>>>> diff --git a/uefi-sct/SctPkg/SCRT/SCRTApp/Riscv64/GoVirtual.S
>>>>> b/uefi-sct/SctPkg/SCRT/SCRTApp/Riscv64/GoVirtual.S
>>>>> new file mode 100644
>>>>> index ..8bc2c624
>>>>> --- /dev/null
>>>>> +++ b/uefi-sct/SctPkg/SCRT/SCRTApp/Riscv64/GoVirtual.S
>>>>> @@ -0,0 +1,45 @@
>>>>> +## @file
>>>>> +#
>>>>> +#  Copyright 2010 - 2012 Unified EFI, Inc.
>>>>> +#  Copyright (c) 2012, ARM Ltd. All rights reserved.
>>>>> +#  Copyright (c) 2020, Hewlett Packard Enterprise Development LP.
>>>>> +#
>>>>> +#  This program and the accompanying materials
>>>>> +#  are licensed and made available under the terms and conditions of
>>>>> the BSD License
>>>>> +#  which accompanies this distribution.  The full text of the
>>>>> license may be found at
>>>>> +#  http://opensource.org/licenses/bsd-license.php
>>>>> +#
>>>>> +#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
>>>>> BASIS,
>>>>> +#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS
>>>>> OR IMPLIED.
>>>>> +#
>>>>> +##
>>>>> +#
>>>>> +#
>>>>> +#/*++
>>>>> +#
>>>>> +# Module Name:
>>>>> +#
>>>>> +#  GoVirtual.S
>>>>> +#
>>>>> +#--*/
>>>>> +#start of the code section
>>>>> +.text
>>>>> +/* FIXME: Should alignment be different on Aarch64? */
>>>>
>>>> 1) FIXME
>>>> 2) Aarch64.
>>>
>>> I have no idea why the alignment would be 3 on other platforms, so I
>>> don't know how to fix it.
>>> If anyone knows more, please let me know. I'll just change the comment
>>> to say Riscv64.
>>>
>>>>> +.align 3
>>
>> Both on Aarch64 and on RISC-V an odd alignment value makes no sense.
>>
>> .align 8 should do no harm. But is it needed?
>
> The glory of the GAS .align directive is that its meaning differs
> between architectures and executable formats. On ARM/AArch64, as well
> as on RISC-V (I think?) the alignment is described as a power of 2.
>
> So .align 3 on ARM and others are the same as .align 8 on x86 (ELF)
> and others.
>
> (It might not be a bad idea to start replacing .align directives with
> .baligh to reduce confusion.)

Thanks for pointing out the different meanings of .align. They are
documented in binutils-2.36/gas/doc/as.info chapter 7.3.

.balign is GNU assembler specific.

Do we have to consider other assemblers here?

Best regards

Heinrich

>
> I haven't looked into whether 8-byte alignment is actually required by
> the code here.
>
> /
> Leif
>



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#71515): https://edk2.groups.io/g/devel/message/71515
Mute This Topic: https://groups.io/mt/78637307/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 PATCH v1 2/2] SctPkg: Enable RISCV64 support using AARCH64 sources

2021-02-08 Thread Heinrich Schuchardt
On 08.02.21 16:09, Daniel Schaefer wrote:
> Hi Leif,
>
> thanks very much for the review!
> I've cleaned up the patchset and addressed the issues. I'll send out
> another set soon.
> See comments below.
>
> Thanks,
> Daniel
>
> On 12/2/20 8:04 PM, Leif Lindholm wrote:
>> On Wed, Dec 02, 2020 at 00:17:52 +0800, Daniel Schaefer wrote:
>>> REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3042
>>>
>>> TODO: Need to check whether we can avoid copying Aarch64 sources.
>>>
>>> Cc: Leif Lindholm 
>>> Cc: Heinrich Schuchardt 
>>> Cc: Abner Chang 
>>> Cc: Gilbert Chen 
>>> Cc: Eric Jin 
>>> Cc: G Edhaya Chandran 
>>> Cc: Barton Gao 
>>> Cc: Samer El-Haj-Mahmoud 
>>> Signed-off-by: Daniel Schaefer 
>>> ---
>>>  
>>> uefi-sct/SctPkg/Library/SctLib/Riscv64/SctLibPlat.h 
>>>   
>>> |  32 +++
>>>  
>>> uefi-sct/SctPkg/Library/SctLib/Riscv64/initplat.c   
>>>   
>>> |  45 
>>>  
>>> uefi-sct/SctPkg/SCRT/SCRTApp/Riscv64/GoVirtual.S
>>>   
>>> |  45 
>>>  
>>> uefi-sct/SctPkg/SCRT/SCRTApp/Riscv64/VirtualMemory.c
>>>   
>>> | 182 +
>>>  
>>> uefi-sct/SctPkg/SCRT/SCRTDriver/Riscv64/Debug.c 
>>>   
>>> |  88 +++
>>>  
>>> uefi-sct/SctPkg/SCRT/SCRTDriver/Riscv64/Dump.c  
>>>   
>>> |  68 +
>>>  
>>> uefi-sct/SctPkg/SCRT/SCRTDriver/Riscv64/Io.c
>>>   
>>> | 134 ++
>>>  
>>> uefi-sct/SctPkg/SCRT/SCRTDriver/Riscv64/Io.h
>>>   
>>> |  48 
>>>  
>>> uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DebugSupport/BlackBoxTest/Riscv64/DebugSupportBBTestCacheFunction.c
>>> 
>>> | 137 ++
>>>  
>>> uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DebugSupport/BlackBoxTest/Riscv64/DebugSupportBBTestExceptionCallbackFunction.c
>>> | 276 
>>>  
>>> uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DebugSupport/BlackBoxTest/Riscv64/PlatformIsa.c
>>> 
>>> |  30 +++
>>>  
>>> uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UsbHc/BlackBoxTest/Riscv64/TimerInterrupt.c
>>> 
>>> |  51 
>>>  
>>> uefi-sct/SctPkg/TestInfrastructure/SCT/Framework/ENTS/EasLib/Riscv64/EntsLibPlat.h
>>> 
>>> |  55 
>>>  
>>> uefi-sct/SctPkg/TestInfrastructure/SCT/Framework/ENTS/EasLib/Riscv64/InitPlat.c
>>>    
>>> |  55 
>>>   14 files changed, 1246 insertions(+)
>>>
>>> diff --git a/uefi-sct/SctPkg/Library/SctLib/Riscv64/SctLibPlat.h
>>> b/uefi-sct/SctPkg/Library/SctLib/Riscv64/SctLibPlat.h
>>> new file mode 100644
>>> index ..ee7c656b
>>> --- /dev/null
>>> +++ b/uefi-sct/SctPkg/Library/SctLib/Riscv64/SctLibPlat.h
>>> @@ -0,0 +1,32 @@
>>> +/** @file
>>> +
>>> +  Copyright 2006 - 2012 Unified EFI, Inc.
>>> +  Copyright (c) 2011 - 2012, ARM Ltd. All rights reserved.
>>> +
>>> +  This program and the accompanying materials
>>> +  are licensed and made available under the terms and conditions of
>>> the BSD License
>>> +  which accompanies this distribution.  The full text of the license
>>> may be found at
>>> +  http://opensource.org/licenses/bsd-license.php
>>> +
>>> +  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
>>> +  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS
>>> OR IMPLIED.
>>> +
>>> +**/
>>> +/*++
>>> +
>>> +Module Name:
>>> +
>>> +  SctLibPlat.h
>>> +
>>> +Abstract:
>>> +
>>> +  AArch64 specific defines
>>
>> *cough*
>
> For the next patch series I w

Re: [edk2-devel] [edk2-test PATCH v1 0/2] Add RISCV64 support to SctPkg

2021-02-08 Thread Heinrich Schuchardt
On 08.02.21 15:30, Daniel Schaefer wrote:
> On 12/2/20 1:37 AM, Heinrich Schuchardt wrote:
>> On 12/1/20 6:11 PM, Daniel Schaefer wrote:
>>> On 12/2/20 12:59 AM, Heinrich Schuchardt wrote:
>>>> On 12/1/20 5:17 PM, Daniel Schaefer wrote:
>>>>> REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3042
>>>>>
>>>>> With this patch series we can build the UEFI SCT for RISCV64. It was
>>>>> confirmed
>>>>> to be working on the U-Boot UEFI implementation by Heinrich.
>>>>> It hasn't been tested on EDK2 yet.
>>>>>
>>>>> Build requirements are the same as for the EDK2 RISCV64 port and
>>>>> detailed here:
>>>>> https://github.com/riscv/riscv-uefi-edk2-docs
>>>>>
>>>>> The second patch is a big one because it adds architecture specific
>>>>> files by
>>>>> copying them from the Aarch64 directory. Only a single file, an
>>>>> assembly file
>>>>> needed modifications. I'm not sure why the other ones are in an
>>>>> architecture
>>>>> specific directory. They're all C files and seem to be generic. We
>>>>> can probably
>>>>> unify them.
>>>>
>>>> Hello Daniel,
>>>>
>>>> thanks a lot for your patches.
>>>>
>>>> You address the uefi-sct/SctPkg/TestCase/UEFI/EFI directory.
>>>>
>>>> Are you planning future patches for uefi-sct/SctPkg/TestCase/UEFI/IHV
>>>> too?
>>>
>>> I grepped the repo for strings related to arm64 and aarch64. I ported
>>> what I found.
>>> Do you see anything that's not ported?
>>
>> uefi-sct/SctPkg/UEFI/IHV_SCT.dsc is the only IHV related file with
>> AARCH64 in it and that one is covered by your patch series.
>>
>>>
>>> The only thing I see, is in
>>> Protocol/UsbIo/BlackBoxTest/UsbIoTestConformance.c
>>> where some code is not used for ARM because:
>>>
>>>    // Note: This function uses the EDKII Glu library from EDKII
>>> compatibility pkg.
>>>
>>>    // which is not ported to ARM yet. Hence for the time being just
>>> return success.
>>>
>>>
>>> I'm not yet sure what library that's referring to, but most likely it's
>>> also
>>> not implemented for RISC-V.
>>
>> I assume this refers to:
>> https://github.com/tianocore/edk/tree/master/Foundation/Library/EdkIIGlueLib
>>
>>
>> The files of this library are in edk2/MdePkg/Library now.
>
> Wow, that code is ancient then. I'm not gonna ifdef it out for RISC-V.
> If it works for x86 it might work for RISC-V now.
> Maybe the ARM people can try it on ARM first ;)
>
>>> Thanks for testing!
>>> Does the SCT result look like what you expect? Or are some tests failing
>>> that you expect to succeed?
>>
>> Not all tests have run yet. Running SCT on QEMU is really slow.
>>
>> But from what I can see there is no difference to AARCH64 results on
>> QEMU.
>
> Sounds great! I assume all the tests have succeeded now?

The SCT version built for RISC-V with you patches returned equivalent
results to ARM for U-Boot.

Best regards

Heinrich


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#71469): https://edk2.groups.io/g/devel/message/71469
Mute This Topic: https://groups.io/mt/78637295/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] [PATCH 1/1] uefi-sct/SctPkg: fix variable services conformance test

2020-08-12 Thread Heinrich Schuchardt
On 8/4/20 1:13 PM, Samer El-Haj-Mahmoud wrote:
> Reviewed-by: Samer El-Haj-Mahmoud 

Dear Edhaya,

could you, please, consider these patches

https://edk2.groups.io/g/devel/message/63354
https://edk2.groups.io/g/devel/message/52599

for review and merging.

Best regards

Heinrich

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#64071): https://edk2.groups.io/g/devel/message/64071
Mute This Topic: https://groups.io/mt/75828348/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH] Check return status on calls to GetTime()

2020-08-06 Thread Heinrich Schuchardt
On 06.08.20 15:31, Samer El-Haj-Mahmoud wrote:
> One issue here is that UEFI 2.8 spec language around allowing runtime 
> services (like GetTime() ) to return EFI_UNSUPPORTED is a bit vague:
>
> ""
> EFI_UNSUPPORTED
> This call is not supported by this platform at the time the call is made. The 
> platform should describe this runtime service as unsupported at runtime via 
> an EFI_RT_PROPERTIES_TABLE configuration table.
> ""
>
> The "at the time the call is made" language may be interpreted as the service 
> is allowed to return EFI_UNSUPPORTED anytime (before or after 
> ExitBootServices() ). But the next sentence (about declaring the unsupported 
> at runtime) make it sounds like this is restricted to only being at runtime. 
> While the use case makes sense, we may need some clarification in the UEFI 
> spec language to make this clear. Otherwise, callers (like SCT) may assume 
> the function is always supported.

Some systems do not have a real time clock. So these system have to
return EFI_UNSUPPORTED before as well as after ExitBootServices().

Due to possible conflicts with the access by the operating system many
systems with RTC will opt not to implement GetTime() at runtime but may
implement GetTime() before ExitBootServices(). This is what we do in U-Boot.

But of cause it is allowable to provide the service at all times if
feasible.

An implementation supplying GetTime() only after ExitBootServices()
would not make much sense to me but is not explicitly forbidden by the spec.

A clearer wording for the spec might be:

"If the service is available at runtime or not, has to be marked in the
EFI_RT_PROPROPERTIES_TABLE."

Best regards

Heinrich

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#63784): https://edk2.groups.io/g/devel/message/63784
Mute This Topic: https://groups.io/mt/75912028/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH] Check return status on calls to GetTime()

2020-08-01 Thread Heinrich Schuchardt
On 7/31/20 7:19 PM, Grant Likely wrote:
> Not all platforms implement GetTime(), but the SCT just assumes calls to
> GetTime will be successful. If GetTime() doesn't return EFI_SUCCESS,
> then the EFI_TIME value will be uninitialized data.
>
> Fix by checking the GetTime() return code. If it doesn't return
> EFI_SUCCESS, then use the traditional 1/1/1970 epoch so that the test
> report at least looks sane, but it is obvious that we don't have a valid
> timestamp.
>
> Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=2870
>
> Cc: G Edhaya Chandran 
> Cc: Heinrich Schuchardt 
> Cc: Samer El-Haj-Mahmoud 
> Signed-off-by: Grant Likely 
> ---
>  .../SimpleNetwork/SimpleNetworkENTSTestCase.c | 26 +--
>  .../MiscBootServicesBBTestFunction.c  |  8 --
>  .../DriverBindingBBTestFunction.c |  5 +++-
>  .../SCT/Drivers/StandardTest/StandardTest.c   | 11 +---
>  .../Framework/ENTS/EasDispatcher/Core/Eas.c   |  9 +--
>  .../ENTS/EasDispatcher/Exec/EasCmdDisp.c  | 20 +-
>  6 files changed, 57 insertions(+), 22 deletions(-)
>
> diff --git 
> a/uefi-sct/SctPkg/TestCase/RIVL/Protocol/SimpleNetwork/SimpleNetworkENTSTestCase.c
>  
> b/uefi-sct/SctPkg/TestCase/RIVL/Protocol/SimpleNetwork/SimpleNetworkENTSTestCase.c
> index 9c8d2a70..5579be7e 100644
> --- 
> a/uefi-sct/SctPkg/TestCase/RIVL/Protocol/SimpleNetwork/SimpleNetworkENTSTestCase.c
> +++ 
> b/uefi-sct/SctPkg/TestCase/RIVL/Protocol/SimpleNetwork/SimpleNetworkENTSTestCase.c
> @@ -24,6 +24,8 @@ Abstract:
>
>  #include "SimpleNetworkENTSTestCase.h"
>
> +static EFI_TIME Epoch = { .Year = 1970, .Month = 1, .Day = 1 };
> +
>  //
>  // SimpleNetwork.Start
>  //
> @@ -928,7 +930,8 @@ Returns:
>Status  = EFI_SUCCESS;
>tBS->Stall (5000);
>
> -  tRT->GetTime (, NULL);
> +  if (tRT->GetTime (, NULL) != EFI_SUCCESS)
> +BeginTime = Epoch;
>for (Index = 0; Index < 1;) {
>  Status = SimpleNetwork->Transmit (
>SimpleNetwork,
> @@ -964,7 +967,8 @@ Returns:
>  }
>}
>
> -  tRT->GetTime (, NULL);
> +  if (tRT->GetTime (, NULL) != EFI_SUCCESS)
> +BeginTime = Epoch;
>
>for (Index = 1; Index < TransmitPattern1Number;) {
>  Status = SimpleNetwork->Transmit (
> @@ -1002,7 +1006,8 @@ Returns:
>}
>
>  End:
> -  tRT->GetTime (, NULL);
> +  if (tRT->GetTime (, NULL) != EFI_SUCCESS)
> +EndTime = Epoch;
>
>*TransmitPattern1Status = Status;
>
> @@ -1125,7 +1130,8 @@ Returns:
>Status  = EFI_SUCCESS;
>tBS->Stall (5000);
>
> -  tRT->GetTime (, NULL);
> +  if (tRT->GetTime (, NULL) != EFI_SUCCESS)
> +BeginTime = Epoch;
>for (Index = 0; Index < 1;) {
>  Status = SimpleNetwork->Transmit (
>SimpleNetwork,
> @@ -1161,7 +1167,8 @@ Returns:
>  }
>}
>
> -  tRT->GetTime (, NULL);
> +  if (tRT->GetTime (, NULL) != EFI_SUCCESS)
> +BeginTime = Epoch;
>
>for (Index = 1; Index < TransmitPattern2Number;) {
>  Status = SimpleNetwork->Transmit (
> @@ -1199,7 +1206,8 @@ Returns:
>}
>
>  End:
> -  tRT->GetTime (, NULL);
> +  if (tRT->GetTime (, NULL) != EFI_SUCCESS)
> +EndTime = Epoch;
>
>*TransmitPattern1Status = Status;
>
> @@ -1326,7 +1334,8 @@ Returns:
>  }
>}
>
> -  tRT->GetTime (, NULL);
> +  if (tRT->GetTime (, NULL) != EFI_SUCCESS)
> +BeginTime = Epoch;
>
>for (Index = 1; Index < ReceivePattern1Number;) {
>  *ReceivePattern1BufferSize = BufferSizeOrg;
> @@ -1346,7 +1355,8 @@ Returns:
>  }
>}
>
> -  tRT->GetTime (, NULL);
> +  if (tRT->GetTime (, NULL) != EFI_SUCCESS)
> +EndTime = Epoch;
>
>*ReceivePattern1Status = Status;
>
> diff --git 
> a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/MiscBootServices/BlackBoxTest/MiscBootServicesBBTestFunction.c
>  
> b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/MiscBootServices/BlackBoxTest/MiscBootServicesBBTestFunction.c
> index 1d231d8c..3a530282 100644
> --- 
> a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/MiscBootServices/BlackBoxTest/MiscBootServicesBBTestFunction.c
> +++ 
> b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/MiscBootServices/BlackBoxTest/MiscBootServicesBBTestFunction.c
> @@ -27,6 +27,8 @@ Abstract:
>  #include "SctLib.h"

I tried to apply your patch with 'git am --keep-cr'. This chunk has a
problem.

While all other lines in the file have CR LF line endings this very line
has only LF in EDK2 master. But your patch has CR LF for the line.

Did you use Windows and not Linux to

Re: [edk2-devel] [edk2-test] [PATCH 1/1] uefi-sct/SctPkg: EFI_RNG_PROTOCOL.GetInfo check size != 0

2020-07-29 Thread Heinrich Schuchardt
Hello Eric, hello Edhaya,

probably due to a maintainer change the patch below was missed out.

Could you, please, review and merge it.

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2438

Best regards

Heinrich

On 12/28/19 4:37 PM, Heinrich Schuchardt wrote:
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2438
>
> The EFI_RNG_PROTOCOL conformance test checks that the size returned by
> GetInfo() is a multiple of 16. This would be fulfilled by size == 0.
>
> The UEFI specification requires that at least one algorithm is implemented.
> So we should check that size is non-zero too.
>
> Signed-off-by: Heinrich Schuchardt 
> ---
>  .../RandomNumber/BlackBoxTest/RandomNumberBBTestConformance.c  | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git 
> a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/RandomNumber/BlackBoxTest/RandomNumberBBTestConformance.c
>  
> b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/RandomNumber/BlackBoxTest/RandomNumberBBTestConformance.c
> index f0a7c030..cd419d68 100644
> --- 
> a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/RandomNumber/BlackBoxTest/RandomNumberBBTestConformance.c
> +++ 
> b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/RandomNumber/BlackBoxTest/RandomNumberBBTestConformance.c
> @@ -169,7 +169,8 @@ BBTestGetInfoConformanceTestCheckpoint1 (
>  return Status;
>}
>
> -  if (EFI_BUFFER_TOO_SMALL == Status && RNGAlgorithmListSize % 
> sizeof(EFI_RNG_ALGORITHM) == 0) {
> +  if (EFI_BUFFER_TOO_SMALL == Status && RNGAlgorithmListSize &&
> +  RNGAlgorithmListSize % sizeof(EFI_RNG_ALGORITHM) == 0) {
>  AssertionType = EFI_TEST_ASSERTION_PASSED;
>} else {
>  AssertionType = EFI_TEST_ASSERTION_FAILED;
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#63467): https://edk2.groups.io/g/devel/message/63467
Mute This Topic: https://groups.io/mt/69304206/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [edk2-test] [PATCH 1/1] uefi-sct/SctPkg: fix variable services conformance test

2020-07-27 Thread Heinrich Schuchardt
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2865

QueryVariableInfo() returning EFI_SUCCESS for a legal combination of
attributes is not an error.

Signed-off-by: Heinrich Schuchardt 
---
 .../BlackBoxTest/AuthVariableServicesBBTestConformance.c| 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/VariableServices/BlackBoxTest/AuthVariableServicesBBTestConformance.c
 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/VariableServices/BlackBoxTest/AuthVariableServicesBBTestConformance.c
index 23b00e35..f16560ff 100644
--- 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/VariableServices/BlackBoxTest/AuthVariableServicesBBTestConformance.c
+++ 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/VariableServices/BlackBoxTest/AuthVariableServicesBBTestConformance.c
@@ -287,7 +287,7 @@ AuthVariableDERConfTest (

);
 
-if (Status == EFI_UNSUPPORTED) {
+if (Status == EFI_SUCCESS || Status == EFI_UNSUPPORTED) {
   Result = EFI_TEST_ASSERTION_PASSED;
 } else {
   Result = EFI_TEST_ASSERTION_FAILED;
-- 
2.27.0


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#63354): https://edk2.groups.io/g/devel/message/63354
Mute This Topic: https://groups.io/mt/75828348/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [edk2-core] [PATCH v3 1/1] MdeModulePkg: Make retval in UninstallMultipleProtocol follow Spec

2020-02-19 Thread Heinrich Schuchardt

On 2/19/20 6:58 AM, Bi, Dandan wrote:

This patch seems be reviewed but not submitted. Hope it can be covered in Q1 
stable tag.


I have reopened
https://bugzilla.tianocore.org/show_bug.cgi?id=1869



Thanks,
Dandan


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#54631): https://edk2.groups.io/g/devel/message/54631
Mute This Topic: https://groups.io/mt/34112406/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [edk2-test] [PATCH 1/1] uefi-sct/SctPkg: EFI_RNG_PROTOCOL.GetInfo check size != 0

2019-12-28 Thread Heinrich Schuchardt
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2438

The EFI_RNG_PROTOCOL conformance test checks that the size returned by
GetInfo() is a multiple of 16. This would be fulfilled by size == 0.

The UEFI specification requires that at least one algorithm is implemented.
So we should check that size is non-zero too.

Signed-off-by: Heinrich Schuchardt 
---
 .../RandomNumber/BlackBoxTest/RandomNumberBBTestConformance.c  | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/RandomNumber/BlackBoxTest/RandomNumberBBTestConformance.c
 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/RandomNumber/BlackBoxTest/RandomNumberBBTestConformance.c
index f0a7c030..cd419d68 100644
--- 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/RandomNumber/BlackBoxTest/RandomNumberBBTestConformance.c
+++ 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/RandomNumber/BlackBoxTest/RandomNumberBBTestConformance.c
@@ -169,7 +169,8 @@ BBTestGetInfoConformanceTestCheckpoint1 (
 return Status;
   }
 
-  if (EFI_BUFFER_TOO_SMALL == Status && RNGAlgorithmListSize % 
sizeof(EFI_RNG_ALGORITHM) == 0) {
+  if (EFI_BUFFER_TOO_SMALL == Status && RNGAlgorithmListSize &&
+  RNGAlgorithmListSize % sizeof(EFI_RNG_ALGORITHM) == 0) {
 AssertionType = EFI_TEST_ASSERTION_PASSED;
   } else {
 AssertionType = EFI_TEST_ASSERTION_FAILED;
-- 
2.24.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#52599): https://edk2.groups.io/g/devel/message/52599
Mute This Topic: https://groups.io/mt/69304206/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [edk2-test] [PATCH 1/1] uefi-sct/SctPkg: typo Verity in TimeServicesBBTestFunction

2019-12-08 Thread Heinrich Schuchardt
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2407

%s/Verity/Verify/g

Signed-off-by: Heinrich Schuchardt 
---
 .../BlackBoxTest/TimeServicesBBTestFunction.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/TimeServices/BlackBoxTest/TimeServicesBBTestFunction.c
 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/TimeServices/BlackBoxTest/TimeServicesBBTestFunction.c
index 0d139d3b..18e00a35 100644
--- 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/TimeServices/BlackBoxTest/TimeServicesBBTestFunction.c
+++ 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/TimeServices/BlackBoxTest/TimeServicesBBTestFunction.c
@@ -379,7 +379,7 @@ step1:
  (Index == 1? \
   gTimeServicesBBTestFunctionAssertionGuid017: \
   gTimeServicesBBTestFunctionAssertionGuid018),
- L"RT.SetTime - Verity year after change",
+ L"RT.SetTime - Verify year after change",
  L"%a:%d:Status - %r, TPL - %d",
  __FILE__,
  (UINTN)__LINE__,
@@ -491,7 +491,7 @@ step2:
  (Index == 1? \
   gTimeServicesBBTestFunctionAssertionGuid023: \
   gTimeServicesBBTestFunctionAssertionGuid024),
- L"RT.SetTime - Verity month after change",
+ L"RT.SetTime - Verify month after change",
  L"%a:%d:Status - %r, TPL - %d",
  __FILE__,
  (UINTN)__LINE__,
@@ -600,7 +600,7 @@ step3:
  (Index == 1? \
   gTimeServicesBBTestFunctionAssertionGuid029: \
   gTimeServicesBBTestFunctionAssertionGuid030),
- L"RT.SetTime - Verity daylight after change",
+ L"RT.SetTime - Verify daylight after change",
  L"%a:%d:Status - %r, TPL - %d",
  __FILE__,
  (UINTN)__LINE__,
@@ -708,7 +708,7 @@ step4:
  (Index == 1? \
   gTimeServicesBBTestFunctionAssertionGuid035: \
   gTimeServicesBBTestFunctionAssertionGuid036),
- L"RT.SetTime - Verity time zone after change",
+ L"RT.SetTime - Verify time zone after change",
  L"%a:%d:Status - %r, TPL - %d",
  __FILE__,
  (UINTN)__LINE__,
-- 
2.24.0


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#52030): https://edk2.groups.io/g/devel/message/52030
Mute This Topic: https://groups.io/mt/67740553/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [edk] [PATCH] ShellPkg/edit: allow non-ASCII characters in edit

2019-11-24 Thread Heinrich Schuchardt
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2339

Currently it is not possible to add letters outside the range
U+0020 - U+007F to a file using the edit command.

In Unicode the following are control characters:

* U+—U+001F (C0 controls)
* U+007F (DEL)
* U+0080—U+009F (C1 controls).

For reference see:

* https://unicode.org/charts/PDF/U.pdf
* https://unicode.org/charts/PDF/U0080.pdf

So the characters we should exclude from the file buffer are:
U+ - U+001f, U+007f - U009F

Allow all other characters as input to the file buffer in Unicode mode.
Allow only ASCII characters as input in ASCII mode.

When saving a file in ASCII mode replace non-ASCII characters by a question
mark ('?').

Signed-off-by: Heinrich Schuchardt 
---
Resent due to a typo in Limings email-address.
---
 .../Edit/FileBuffer.c | 21 +++
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/FileBuffer.c 
b/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/FileBuffer.c
index fd324cc4a8..12235e4e4b 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/FileBuffer.c
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/FileBuffer.c
@@ -1360,6 +1360,8 @@ GetNewLine (
 /**

   Change a Unicode string to an ASCII string.

 

+  Non-ASCII characters are replaced by '?'.

+

   @param[in] UStr The Unicode string.

   @param[in] Length   The maximum size of AStr.

   @param[out] AStrASCII string to pass out.

@@ -1378,8 +1380,12 @@ UnicodeToAscii (
   //

   // just buffer copy, not character copy

   //

-  for (Index = 0; Index < Length; Index++) {

-*AStr++ = (CHAR8) *UStr++;

+  for (Index = 0; Index < Length; Index++, UStr++) {

+if (*UStr < 0x80) {

+  *AStr++ = (CHAR8) *UStr;

+} else {

+  *AStr++ = '?';

+}

   }

 

   return Index;

@@ -2154,9 +2160,16 @@ FileBufferDoCharInput (
 

   default:

 //

-// DEAL WITH ASCII CHAR, filter out thing like ctrl+f

+// Do not add Unicode control characters to the file buffer:

+//

+// * U+-U+001f (C0 controls)

+// * U+007f (DEL)

+// * U+0080-U+009f (C1 controls)

+//

+// Do not add non-ASCII characters in ASCII mode.

 //

-if (Char > 127 || Char < 32) {

+if (Char < 0x20 || (Char >= 0x7f &&

+(Char <= 0x9f || FileBuffer.FileType == FileTypeAscii))) {

   Status = StatusBarSetStatusString (L"Unknown Command");

 } else {

   Status = FileBufferAddChar (Char);

-- 
2.24.0


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#51207): https://edk2.groups.io/g/devel/message/51207
Mute This Topic: https://groups.io/mt/61872994/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [edk2] [PATCH] ShellPkg/edit: typo "%d Lines Wrote"

2019-11-24 Thread Heinrich Schuchardt
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2379

When a file is saved in the edit command a status message L"%d Lines Wrote"
is displayed. The hexedit command suffers from the same typo.

Change the message to L"%d Lines Written".

Signed-off-by: Heinrich Schuchardt 
---
 ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/FileBuffer.c   | 2 +-
 ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/FileImage.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/FileBuffer.c 
b/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/FileBuffer.c
index 12235e4e4b..71036a7487 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/FileBuffer.c
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/FileBuffer.c
@@ -1608,7 +1608,7 @@ FileBufferSave (
   //
   // set status string
   //
-  Str = CatSPrint (NULL, L"%d Lines Wrote", NumLines);
+  Str = CatSPrint (NULL, L"%d Lines Written", NumLines);
   if (Str == NULL) {
 return EFI_OUT_OF_RESOURCES;
   }
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/FileImage.c 
b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/FileImage.c
index b393f2a423..bb324ceafc 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/FileImage.c
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/FileImage.c
@@ -368,7 +368,7 @@ HFileImageSave (
   //
   // set status string
   //
-  Str = CatSPrint(NULL, L"%d Lines Wrote", NumLines);
+  Str = CatSPrint(NULL, L"%d Lines Written", NumLines);
   StatusBarSetStatusString (Str);
   FreePool (Str);
 
-- 
2.24.0


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#51206): https://edk2.groups.io/g/devel/message/51206
Mute This Topic: https://groups.io/mt/61873155/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [edk] [PATCH] ShellPkg/edit: allow non-ASCII characters in edit

2019-11-24 Thread Heinrich Schuchardt
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2339

Currently it is not possible to add letters outside the range
U+0020 - U+007F to a file using the edit command.

In Unicode the following are control characters:

* U+—U+001F (C0 controls)
* U+007F (DEL)
* U+0080—U+009F (C1 controls).

For reference see:

* https://unicode.org/charts/PDF/U.pdf
* https://unicode.org/charts/PDF/U0080.pdf

So the characters we should exclude from the file buffer are:
U+ - U+001f, U+007f - U009F

Allow all other characters as input to the file buffer in Unicode mode.
Allow only ASCII characters as input in ASCII mode.

When saving a file in ASCII mode replace non-ASCII characters by a question
mark ('?').

Signed-off-by: Heinrich Schuchardt 
---
 .../Edit/FileBuffer.c | 21 +++
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/FileBuffer.c 
b/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/FileBuffer.c
index fd324cc4a8..12235e4e4b 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/FileBuffer.c
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/FileBuffer.c
@@ -1360,6 +1360,8 @@ GetNewLine (
 /**

   Change a Unicode string to an ASCII string.

 

+  Non-ASCII characters are replaced by '?'.

+

   @param[in] UStr The Unicode string.

   @param[in] Length   The maximum size of AStr.

   @param[out] AStrASCII string to pass out.

@@ -1378,8 +1380,12 @@ UnicodeToAscii (
   //

   // just buffer copy, not character copy

   //

-  for (Index = 0; Index < Length; Index++) {

-*AStr++ = (CHAR8) *UStr++;

+  for (Index = 0; Index < Length; Index++, UStr++) {

+if (*UStr < 0x80) {

+  *AStr++ = (CHAR8) *UStr;

+} else {

+  *AStr++ = '?';

+}

   }

 

   return Index;

@@ -2154,9 +2160,16 @@ FileBufferDoCharInput (
 

   default:

 //

-// DEAL WITH ASCII CHAR, filter out thing like ctrl+f

+// Do not add Unicode control characters to the file buffer:

+//

+// * U+-U+001f (C0 controls)

+// * U+007f (DEL)

+// * U+0080-U+009f (C1 controls)

+//

+// Do not add non-ASCII characters in ASCII mode.

 //

-if (Char > 127 || Char < 32) {

+if (Char < 0x20 || (Char >= 0x7f &&

+(Char <= 0x9f || FileBuffer.FileType == FileTypeAscii))) {

   Status = StatusBarSetStatusString (L"Unknown Command");

 } else {

   Status = FileBufferAddChar (Char);

-- 
2.24.0


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#51205): https://edk2.groups.io/g/devel/message/51205
Mute This Topic: https://groups.io/mt/61872994/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][Patch] uefi-sct/SctPkg: Add MediaPresentSupported check

2019-09-27 Thread Heinrich Schuchardt

On 9/27/19 4:01 AM, Liu, XianhuiX wrote:

Hi Heinrich,
Any concern about it? Thanks.


Your patch is correct. It is preceded by:

SctPrint (L"\nPlease disconnect the machine from the LAN, press any key
within 10 seconds\n");

If MediaPresentSupported is false you cannot detect if the user removed
the LAN cable or not.

Sorry for the noise.

Best regards

Heinrich



Best Regards
Xianhui Liu


-Original Message-
From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
xianhui liu
Sent: Wednesday, September 25, 2019 10:18 AM
To: devel@edk2.groups.io; xypron.g...@gmx.de
Cc: Supreeth Venkatesh ; Jin, Eric

Subject: Re: [edk2-devel] [edk2-test][Patch] uefi-sct/SctPkg: Add
MediaPresentSupported check

Please refer to below comments.


-Original Message-
From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
Heinrich Schuchardt
Sent: Wednesday, September 25, 2019 3:06 AM
To: Liu, XianhuiX ; devel@edk2.groups.io
Cc: Supreeth Venkatesh ; Jin, Eric

Subject: Re: [edk2-devel] [edk2-test][Patch] uefi-sct/SctPkg: Add
MediaPresentSupported check

On 9/24/19 10:50 AM, xianhui liu wrote:

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2061
check MediaPresent while MediaPresentSupported is TRUE sync change
from EFI to IHV SimpleNetworkBBTestFunction


Thanks for addressing this issue.



Cc: Heinrich Schuchardt 


%s/Cc:/Reported-by:/


Cc: Supreeth Venkatesh 
Cc: Eric Jin 

Signed-off-by: xianhui liu 
---
   .../BlackBoxTest/SimpleNetworkBBTestFunction.c | 64 +++-

--



   1 file changed, 33 insertions(+), 31 deletions(-)

diff --git
a/uefi-

sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleNetwork/BlackBoxTes

t/SimpleNetworkBBTestFunction.c
b/uefi-

sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleNetwork/BlackBoxTes

t/SimpleNetworkBBTestFunction.c
index b4c7b5ee..8559e894 100644
---
a/uefi-

sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleNetwork/BlackBoxTes

t/SimpleNetworkBBTestFunction.c
+++ b/uefi-

sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleNetwork/BlackBo

+++ xTest/SimpleNetworkBBTestFunction.c
@@ -1888,38 +1888,40 @@ BBTestGetStatusFunctionTest (
 Status = SnpInterface->GetStatus (SnpInterface,
,

);

 Status1 = SnpInterface->GetStatus (SnpInterface,
, );

-  if (SnpInterface->Mode->MediaPresent == FALSE) {
-if ((Status1 == EFI_SUCCESS) && (Status == EFI_SUCCESS) &&

(InterruptStatus == 0)) {

-  AssertionType = EFI_TEST_ASSERTION_PASSED;
-} else {
-  AssertionType = EFI_TEST_ASSERTION_FAILED;
-}
-  } else {
-if ((Status1 == EFI_SUCCESS) && (Status == EFI_SUCCESS)) {
-  AssertionType = EFI_TEST_ASSERTION_PASSED;
-  if (InterruptStatus &
- ~( EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT |
-EFI_SIMPLE_NETWORK_TRANSMIT_INTERRUPT |
-EFI_SIMPLE_NETWORK_COMMAND_INTERRUPT |
-EFI_SIMPLE_NETWORK_SOFTWARE_INTERRUPT)) {
-AssertionType = EFI_TEST_ASSERTION_FAILED;
-  }
-} else {
-  AssertionType = EFI_TEST_ASSERTION_FAILED;
-}
+  if (SnpInterface->Mode-> MediaPresentSupported == TRUE) {
+ if (SnpInterface->Mode->MediaPresent == FALSE) {



If MediaPresentSupported == FALSE shouldn't we assume that Media is
present.

So isn't a single 'if' enough:

if (SnpInterface->Mode-> MediaPresentSupported == TRUE &&
  SnpInterface->Mode->MediaPresent == FALSE) {

Best regards

Heinrich Schuchardt


Hi Heinrich,
We will skip the checkpoint if MediaPresentSupported == FALSE. Thanks.

Hi Eric,
Please help correct me if any mistake here. Thanks.

Best Regards
Xianhui Liu





+   if ((Status1 == EFI_SUCCESS) && (Status == EFI_SUCCESS) &&

(InterruptStatus == 0)) {

+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+   } else {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+   }
+ } else {
+   if ((Status1 == EFI_SUCCESS) && (Status == EFI_SUCCESS)) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ if (InterruptStatus &
+~( EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT |
+   EFI_SIMPLE_NETWORK_TRANSMIT_INTERRUPT |
+   EFI_SIMPLE_NETWORK_COMMAND_INTERRUPT |
+   EFI_SIMPLE_NETWORK_SOFTWARE_INTERRUPT)) {
+   AssertionType = EFI_TEST_ASSERTION_FAILED;
+ }
+   } else {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+   }
+ }
+ StandardLib->RecordAssertion (
+StandardLib,
+AssertionType,
+gSimpleNetworkBBTestFunctionAssertionGuid022,
+L"EFI_SIMPLE_NETWORK_PROTOCOL.GetStatus -
+ Invoke

GetStatus() and verify interface correctness within test case",

+L"%a:%d:Status - %r, Status1 - %r, InterruptStatus - %d",
+__FILE__,
+(UINTN)__LINE__,
+Status,
+Status1

[edk2-devel] [PATCH 1/1] uefi-sct/SctPkg: network: missing EFIAPI

2019-09-24 Thread Heinrich Schuchardt
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2126

Avoid errors of type:

~/edk2/SctPkg/TestCase/RIVL/Protocol/Http/Http/HttpENTSTest.c:74:1:
error: conflicting types for ‘HttpENTSTestMain’
   74 | HttpENTSTestMain (
  | ^~~~
In file included from :
~/edk2/Build/UefiSct/RELEASE_GCC5/X64/SctPkg/TestCase/RIVL/Protocol/
Http/Http/HttpENTSTest/DEBUG/AutoGen.h:77:1:
note: previous declaration of ‘HttpENTSTestMain’ was here
   77 | HttpENTSTestMain (
  | ^~~~

Signed-off-by: Heinrich Schuchardt 
---
This is only a partial fix to the problem reported in #2126.
---
 uefi-sct/SctPkg/TestCase/RIVL/Protocol/Http/Http/HttpENTSTest.c  | 1 +
 .../Http/HttpServiceBinding/HttpServiceBindingENTSTest.c | 1 +
 .../Mtftp6/Mtftp6ServiceBinding/Mtftp6ServiceBindingENTSTest.c   | 1 +
 uefi-sct/SctPkg/TestCase/RIVL/Protocol/Tcp4/Tcp4/Tcp4ENTSTest.c  | 1 +
 .../Tcp4/Tcp4ServiceBinding/Tcp4ServiceBindingENTSTest.c | 1 +
 uefi-sct/SctPkg/TestCase/RIVL/Protocol/Tcp6/Tcp6/Tcp6ENTSTest.c  | 1 +
 .../Tcp6/Tcp6ServiceBinding/Tcp6ServiceBindingENTSTest.c | 1 +
 7 files changed, 7 insertions(+)

diff --git a/uefi-sct/SctPkg/TestCase/RIVL/Protocol/Http/Http/HttpENTSTest.c 
b/uefi-sct/SctPkg/TestCase/RIVL/Protocol/Http/Http/HttpENTSTest.c
index 0e65fc0e..f380df70 100644
--- a/uefi-sct/SctPkg/TestCase/RIVL/Protocol/Http/Http/HttpENTSTest.c
+++ b/uefi-sct/SctPkg/TestCase/RIVL/Protocol/Http/Http/HttpENTSTest.c
@@ -71,6 +71,7 @@ HttpENTSTestUnload (
 

 

 EFI_STATUS

+EFIAPI

 HttpENTSTestMain (

   IN EFI_HANDLEImageHandle,

   IN EFI_SYSTEM_TABLE  *SystemTable

diff --git 
a/uefi-sct/SctPkg/TestCase/RIVL/Protocol/Http/HttpServiceBinding/HttpServiceBindingENTSTest.c
 
b/uefi-sct/SctPkg/TestCase/RIVL/Protocol/Http/HttpServiceBinding/HttpServiceBindingENTSTest.c
index 5a538ca7..0b2f0b15 100644
--- 
a/uefi-sct/SctPkg/TestCase/RIVL/Protocol/Http/HttpServiceBinding/HttpServiceBindingENTSTest.c
+++ 
b/uefi-sct/SctPkg/TestCase/RIVL/Protocol/Http/HttpServiceBinding/HttpServiceBindingENTSTest.c
@@ -52,6 +52,7 @@ HttpServiceBindingENTSTestUnload (
 

 

 EFI_STATUS

+EFIAPI

 HttpServiceBindingENTSTestMain (

   IN EFI_HANDLEImageHandle,

   IN EFI_SYSTEM_TABLE  *SystemTable

diff --git 
a/uefi-sct/SctPkg/TestCase/RIVL/Protocol/Mtftp6/Mtftp6ServiceBinding/Mtftp6ServiceBindingENTSTest.c
 
b/uefi-sct/SctPkg/TestCase/RIVL/Protocol/Mtftp6/Mtftp6ServiceBinding/Mtftp6ServiceBindingENTSTest.c
index b87a43ef..07a1ca0d 100644
--- 
a/uefi-sct/SctPkg/TestCase/RIVL/Protocol/Mtftp6/Mtftp6ServiceBinding/Mtftp6ServiceBindingENTSTest.c
+++ 
b/uefi-sct/SctPkg/TestCase/RIVL/Protocol/Mtftp6/Mtftp6ServiceBinding/Mtftp6ServiceBindingENTSTest.c
@@ -53,6 +53,7 @@ Mtftp6ServiceBindingENTSTestUnload (
 

 

 EFI_STATUS

+EFIAPI

 Mtftp6ServiceBindingENTSTestMain (

   IN EFI_HANDLEImageHandle,

   IN EFI_SYSTEM_TABLE  *SystemTable

diff --git a/uefi-sct/SctPkg/TestCase/RIVL/Protocol/Tcp4/Tcp4/Tcp4ENTSTest.c 
b/uefi-sct/SctPkg/TestCase/RIVL/Protocol/Tcp4/Tcp4/Tcp4ENTSTest.c
index 261e9adb..e8d472c2 100644
--- a/uefi-sct/SctPkg/TestCase/RIVL/Protocol/Tcp4/Tcp4/Tcp4ENTSTest.c
+++ b/uefi-sct/SctPkg/TestCase/RIVL/Protocol/Tcp4/Tcp4/Tcp4ENTSTest.c
@@ -91,6 +91,7 @@ Tcp4ENTSTestUnload (
 

 

 EFI_STATUS

+EFIAPI

 Tcp4ENTSTestMain (

   IN EFI_HANDLEImageHandle,

   IN EFI_SYSTEM_TABLE  *SystemTable

diff --git 
a/uefi-sct/SctPkg/TestCase/RIVL/Protocol/Tcp4/Tcp4ServiceBinding/Tcp4ServiceBindingENTSTest.c
 
b/uefi-sct/SctPkg/TestCase/RIVL/Protocol/Tcp4/Tcp4ServiceBinding/Tcp4ServiceBindingENTSTest.c
index 15e6b1cc..b887ee64 100644
--- 
a/uefi-sct/SctPkg/TestCase/RIVL/Protocol/Tcp4/Tcp4ServiceBinding/Tcp4ServiceBindingENTSTest.c
+++ 
b/uefi-sct/SctPkg/TestCase/RIVL/Protocol/Tcp4/Tcp4ServiceBinding/Tcp4ServiceBindingENTSTest.c
@@ -52,6 +52,7 @@ Tcp4ServiceBindingENTSTestUnload (
 

 

 EFI_STATUS

+EFIAPI

 Tcp4ServiceBindingENTSTestMain (

   IN EFI_HANDLEImageHandle,

   IN EFI_SYSTEM_TABLE  *SystemTable

diff --git a/uefi-sct/SctPkg/TestCase/RIVL/Protocol/Tcp6/Tcp6/Tcp6ENTSTest.c 
b/uefi-sct/SctPkg/TestCase/RIVL/Protocol/Tcp6/Tcp6/Tcp6ENTSTest.c
index 3d4d5a35..f643136d 100644
--- a/uefi-sct/SctPkg/TestCase/RIVL/Protocol/Tcp6/Tcp6/Tcp6ENTSTest.c
+++ b/uefi-sct/SctPkg/TestCase/RIVL/Protocol/Tcp6/Tcp6/Tcp6ENTSTest.c
@@ -87,6 +87,7 @@ Tcp6ENTSTestUnload (
 

 

 EFI_STATUS

+EFIAPI

 Tcp6ENTSTestMain (

   IN EFI_HANDLEImageHandle,

   IN EFI_SYSTEM_TABLE  *SystemTable

diff --git 
a/uefi-sct/SctPkg/TestCase/RIVL/Protocol/Tcp6/Tcp6ServiceBinding/Tcp6ServiceBindingENTSTest.c
 
b/uefi-sct/SctPkg/TestCase/RIVL/Protocol/Tcp6/Tcp6ServiceBinding/Tcp6ServiceBindingENTSTest.c
index e35f6fc1..6c49bd1d 100644
--- 
a/uefi-sct/SctPkg/TestCase/RIVL/Protocol/Tcp6/Tcp6ServiceBinding/Tcp6ServiceBindingENTSTest.c
+++ 
b/uefi-sct/SctPkg/TestCase/RIVL/Protocol/Tcp6/Tcp6ServiceBinding

Re: [edk2-devel] [edk2-test][Patch] uefi-sct/SctPkg: Add MediaPresentSupported check

2019-09-24 Thread Heinrich Schuchardt

On 9/24/19 10:50 AM, xianhui liu wrote:

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2061
check MediaPresent while MediaPresentSupported is TRUE
sync change from EFI to IHV SimpleNetworkBBTestFunction


Thanks for addressing this issue.



Cc: Heinrich Schuchardt 


%s/Cc:/Reported-by:/


Cc: Supreeth Venkatesh 
Cc: Eric Jin 

Signed-off-by: xianhui liu 
---
  .../BlackBoxTest/SimpleNetworkBBTestFunction.c | 64 +++---
  1 file changed, 33 insertions(+), 31 deletions(-)

diff --git 
a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleNetwork/BlackBoxTest/SimpleNetworkBBTestFunction.c
 
b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleNetwork/BlackBoxTest/SimpleNetworkBBTestFunction.c
index b4c7b5ee..8559e894 100644
--- 
a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleNetwork/BlackBoxTest/SimpleNetworkBBTestFunction.c
+++ 
b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleNetwork/BlackBoxTest/SimpleNetworkBBTestFunction.c
@@ -1888,38 +1888,40 @@ BBTestGetStatusFunctionTest (
Status = SnpInterface->GetStatus (SnpInterface, , );
Status1 = SnpInterface->GetStatus (SnpInterface, , );

-  if (SnpInterface->Mode->MediaPresent == FALSE) {
-if ((Status1 == EFI_SUCCESS) && (Status == EFI_SUCCESS) && 
(InterruptStatus == 0)) {
-  AssertionType = EFI_TEST_ASSERTION_PASSED;
-} else {
-  AssertionType = EFI_TEST_ASSERTION_FAILED;
-}
-  } else {
-if ((Status1 == EFI_SUCCESS) && (Status == EFI_SUCCESS)) {
-  AssertionType = EFI_TEST_ASSERTION_PASSED;
-  if (InterruptStatus &
- ~( EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT |
-EFI_SIMPLE_NETWORK_TRANSMIT_INTERRUPT |
-EFI_SIMPLE_NETWORK_COMMAND_INTERRUPT |
-EFI_SIMPLE_NETWORK_SOFTWARE_INTERRUPT)) {
-AssertionType = EFI_TEST_ASSERTION_FAILED;
-  }
-} else {
-  AssertionType = EFI_TEST_ASSERTION_FAILED;
-}
+  if (SnpInterface->Mode-> MediaPresentSupported == TRUE) {
+ if (SnpInterface->Mode->MediaPresent == FALSE) {



If MediaPresentSupported == FALSE shouldn't we assume that Media is present.

So isn't a single 'if' enough:

if (SnpInterface->Mode-> MediaPresentSupported == TRUE &&
SnpInterface->Mode->MediaPresent == FALSE) {

Best regards

Heinrich Schuchardt


+   if ((Status1 == EFI_SUCCESS) && (Status == EFI_SUCCESS) && 
(InterruptStatus == 0)) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+   } else {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+   }
+ } else {
+   if ((Status1 == EFI_SUCCESS) && (Status == EFI_SUCCESS)) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ if (InterruptStatus &
+~( EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT |
+   EFI_SIMPLE_NETWORK_TRANSMIT_INTERRUPT |
+   EFI_SIMPLE_NETWORK_COMMAND_INTERRUPT |
+   EFI_SIMPLE_NETWORK_SOFTWARE_INTERRUPT)) {
+   AssertionType = EFI_TEST_ASSERTION_FAILED;
+ }
+   } else {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+   }
+ }
+ StandardLib->RecordAssertion (
+StandardLib,
+AssertionType,
+gSimpleNetworkBBTestFunctionAssertionGuid022,
+L"EFI_SIMPLE_NETWORK_PROTOCOL.GetStatus - Invoke GetStatus() 
and verify interface correctness within test case",
+L"%a:%d:Status - %r, Status1 - %r, InterruptStatus - %d",
+__FILE__,
+(UINTN)__LINE__,
+Status,
+Status1,
+InterruptStatus
+);
}
-  StandardLib->RecordAssertion (
- StandardLib,
- AssertionType,
- gSimpleNetworkBBTestFunctionAssertionGuid022,
- L"EFI_SIMPLE_NETWORK_PROTOCOL.GetStatus - Invoke GetStatus() and 
verify interface correctness within test case",
- L"%a:%d:Status - %r, Status1 - %r, InterruptStatus - %d",
- __FILE__,
- (UINTN)__LINE__,
- Status,
- Status1,
- InterruptStatus
- );

//
// Restore SNP State




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#47991): https://edk2.groups.io/g/devel/message/47991
Mute This Topic: https://groups.io/mt/34258689/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [edk2-test] [PATCH 1/1] uefi-sct/SctPkg: use EFI_UNICODE_COLLATION_PROTOCOL2_GUID

2019-09-20 Thread Heinrich Schuchardt
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1802

The protocol identified by EFI_UNICODE_COLLATION_PROTOCOL_GUID is
deprecated. Use the protocol identified by
EFI_UNICODE_COLLATION_PROTOCOL2_GUID instead. Both protocols only differ
in the values for the SupportedLanguages field.

Signed-off-by: Heinrich Schuchardt 
---
 uefi-sct/SctPkg/Library/SctGuidLib/SctGuidLib.c | 2 +-
 uefi-sct/SctPkg/Library/SctLib/Guid.c   | 2 +-
 uefi-sct/SctPkg/Library/SctLib/Init.c   | 6 +++---
 uefi-sct/SctPkg/Library/SctLib/SctLib.inf   | 2 +-
 .../BlackBoxTest/EfiCompliantBBTestPlatform_uefi.c  | 4 ++--
 5 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/uefi-sct/SctPkg/Library/SctGuidLib/SctGuidLib.c 
b/uefi-sct/SctPkg/Library/SctGuidLib/SctGuidLib.c
index cb5a7c97..3265ac82 100644
--- a/uefi-sct/SctPkg/Library/SctGuidLib/SctGuidLib.c
+++ b/uefi-sct/SctPkg/Library/SctGuidLib/SctGuidLib.c
@@ -38,7 +38,7 @@ EFI_GUID gEfiLoadFileProtocolGuid = { 0x56EC3091, 0x954C, 
0x11D2, { 0x8E, 0x3F,
 EFI_GUID gEfiDeviceIoProtocolGuid = { 0xAF6AC311, 0x84C3, 0x11D2, { 0x8E, 
0x3C, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B }};
 EFI_GUID gEfiFileInfoGuid = { 0x09576E92, 0x6D3F, 0x11D2, { 0x8E, 0x39, 0x00, 
0xA0, 0xC9, 0x69, 0x72, 0x3B }};
 EFI_GUID gEfiFileSystemInfoGuid = { 0x09576E93, 0x6D3F, 0x11D2, { 0x8E, 0x39, 
0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B }};
-EFI_GUID gEfiUnicodeCollationProtocolGuid = { 0x1D85CD7F, 0xF43D, 0x11D2, { 
0x9A, 0x0C, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }};
+EFI_GUID gEfiUnicodeCollation2ProtocolGuid = {0xa4c751fc, 0x23ae, 0x4c3e, { 
0x92, 0xe9, 0x49, 0x64, 0xcf, 0x63, 0xf3, 0x49 }};
 EFI_GUID gEfiSerialIoProtocolGuid = { 0xBB25CF6F, 0xF1D4, 0x11D2, { 0x9A, 
0x0C, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0xFD }};
 EFI_GUID gEfiSimpleNetworkProtocolGuid = { 0xA19832B9, 0xAC25, 0x11D3, { 0x9A, 
0x2D, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }};
 EFI_GUID gEfiNetworkInterfaceIdentifierProtocolGuid = { 0xE18541CD, 0xF755, 
0x4F73, { 0x92, 0x8D, 0x64, 0x3C, 0x8A, 0x79, 0xB2, 0x29 }};
diff --git a/uefi-sct/SctPkg/Library/SctLib/Guid.c 
b/uefi-sct/SctPkg/Library/SctLib/Guid.c
index d0391060..f318725b 100644
--- a/uefi-sct/SctPkg/Library/SctLib/Guid.c
+++ b/uefi-sct/SctPkg/Library/SctLib/Guid.c
@@ -117,7 +117,7 @@ struct {
   { ,   L"GenFileInfo" },
   { ,L"FileSysInfo" },
 
-  { ,  L"UnicodeCollation" },
+  { , L"UnicodeCollation2" },
   { ,  L"serialio" },
   { , L"net" },
   { ,L"nii" },
diff --git a/uefi-sct/SctPkg/Library/SctLib/Init.c 
b/uefi-sct/SctPkg/Library/SctLib/Init.c
index 7e7618eb..704636e3 100644
--- a/uefi-sct/SctPkg/Library/SctLib/Init.c
+++ b/uefi-sct/SctPkg/Library/SctLib/Init.c
@@ -81,7 +81,7 @@ InitializeUnicodeSupport (
   // If we don't know it, lookup the current language code
   //
 
-  SctLocateHandle (ByProtocol, , NULL, 
, );
+  SctLocateHandle (ByProtocol, , NULL, 
, );
   if (!LangCode || !NoHandles) {
 goto Done;
   }
@@ -91,7 +91,7 @@ InitializeUnicodeSupport (
   //
 
   for (Index=0; Index < NoHandles; Index++) {
-Status = tBS->HandleProtocol (Handles[Index], 
, (VOID**));
+Status = tBS->HandleProtocol (Handles[Index], 
, (VOID**));
 if (EFI_ERROR(Status)) {
   continue;
 }
@@ -180,7 +180,7 @@ SctInitializeLib (
 //
 // LangCode = LibGetVariable (VarLanguage, );
 // InitializeUnicodeSupport (LangCode);
-InitializeUnicodeSupport ("eng");
+InitializeUnicodeSupport ("en");
 if (LangCode) {
   SctFreePool (LangCode);
 }
diff --git a/uefi-sct/SctPkg/Library/SctLib/SctLib.inf 
b/uefi-sct/SctPkg/Library/SctLib/SctLib.inf
index ff6ce579..cd354ffe 100644
--- a/uefi-sct/SctPkg/Library/SctLib/SctLib.inf
+++ b/uefi-sct/SctPkg/Library/SctLib/SctLib.inf
@@ -108,7 +108,7 @@
   gEfiSimpleNetworkProtocolGuid
   gEfiSimpleTextInProtocolGuid
   gEfiSimpleTextOutProtocolGuid
-  gEfiUnicodeCollationProtocolGuid
+  gEfiUnicodeCollation2ProtocolGuid
   gEfiDriverBindingProtocolGuid
   gEfiDriverConfigurationProtocolGuid
   gEfiDriverDiagnosticsProtocolGuid
diff --git 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Generic/EfiCompliant/BlackBoxTest/EfiCompliantBBTestPlatform_uefi.c
 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Generic/EfiCompliant/BlackBoxTest/EfiCompliantBBTestPlatform_uefi.c
index b3f1b8c5..09d89772 100644
--- 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Generic/EfiCompliant/BlackBoxTest/EfiCompliantBBTestPlatform_uefi.c
+++ 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Generic/EfiCompliant/BlackBoxTest/EfiCompliantBBTestPlatform_uefi.c
@@ -1180,7 +1180,7 @@ CheckBootFromDiskProtocols (
   // Check the UNICODE_COLLATION protocol
   //
   Status = gtBS->LocateProtocol (
-   ,
+   ,
NULL,
(VOID **) 
);
@@ -3851,4 +3851,4 @@ CheckIPSecProtocols (
  );
 
 

[edk2-devel] [PATCH 1/1] uefi-sct/SctPkg: SNP ReceiveFilters may be unsupported

2019-09-16 Thread Heinrich Schuchardt
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2197

If EFI_SIMPLE_NETWORK.ReceiveFilters() is not supported, it will return
EFI_UNSUPPORTED. In this case do not expect input parameters to be checked
for conformance.

Signed-off-by: Heinrich Schuchardt 
---
 .../SimpleNetworkBBTestConformance.c  | 223 +++---
 1 file changed, 138 insertions(+), 85 deletions(-)

diff --git 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/BlackBoxTest/SimpleNetworkBBTestConformance.c
 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/BlackBoxTest/SimpleNetworkBBTestConformance.c
index 9bd21a76..09b47ee6 100644
--- 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/BlackBoxTest/SimpleNetworkBBTestConformance.c
+++ 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/BlackBoxTest/SimpleNetworkBBTestConformance.c
@@ -626,22 +626,31 @@ BBTestReceiveFilterConformanceTest (
   // Call ReceiveFilters() function if network interface not start.
   //
   Status = SnpInterface->ReceiveFilters (SnpInterface, 0, 0, FALSE, 0, NULL);
-  if ((Status == EFI_NOT_STARTED) && (SnpInterface->Mode->State == 
EfiSimpleNetworkStopped)) {
-AssertionType = EFI_TEST_ASSERTION_PASSED;
+  if (Status == EFI_UNSUPPORTED) {
+StandardLib->RecordMessage(
+   StandardLib,
+   EFI_VERBOSE_LEVEL_QUIET,
+   L"ReceiveFilters isn't supported, Status - %r\n",
+   Status
+   );
   } else {
-AssertionType = EFI_TEST_ASSERTION_FAILED;
-  }
+if ((Status == EFI_NOT_STARTED) && (SnpInterface->Mode->State == 
EfiSimpleNetworkStopped)) {
+  AssertionType = EFI_TEST_ASSERTION_PASSED;
+} else {
+  AssertionType = EFI_TEST_ASSERTION_FAILED;
+}
 
-  StandardLib->RecordAssertion (
- StandardLib,
- AssertionType,
- gSimpleNetworkBBTestConformanceAssertionGuid006,
- L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke 
ReceiveFilters() when network interface not start.",
- L"%a:%d:Status - %r",
- __FILE__,
- (UINTN)__LINE__,
- Status
- );
+StandardLib->RecordAssertion (
+   StandardLib,
+   AssertionType,
+   gSimpleNetworkBBTestConformanceAssertionGuid006,
+   L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke 
ReceiveFilters() when network interface not start.",
+   L"%a:%d:Status - %r",
+   __FILE__,
+   (UINTN)__LINE__,
+   Status
+   );
+  }
 
   //
   // Assertion Point 5.6.2.2
@@ -653,22 +662,31 @@ BBTestReceiveFilterConformanceTest (
   }
 
   Status = SnpInterface->ReceiveFilters (SnpInterface, 0, 0, FALSE, 0, NULL);
-  if (Status == EFI_DEVICE_ERROR) {
-AssertionType = EFI_TEST_ASSERTION_PASSED;
+  if (Status == EFI_UNSUPPORTED) {
+StandardLib->RecordMessage(
+   StandardLib,
+   EFI_VERBOSE_LEVEL_QUIET,
+   L"ReceiveFilters isn't supported, Status - %r\n",
+   Status
+   );
   } else {
-AssertionType = EFI_TEST_ASSERTION_FAILED;
-  }
+if (Status == EFI_DEVICE_ERROR) {
+  AssertionType = EFI_TEST_ASSERTION_PASSED;
+} else {
+  AssertionType = EFI_TEST_ASSERTION_FAILED;
+}
 
-  StandardLib->RecordAssertion (
- StandardLib,
- AssertionType,
- gSimpleNetworkBBTestConformanceAssertionGuid007,
- L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke 
ReceiveFilters() when network interface not initialized.",
- L"%a:%d:Status - %r",
- __FILE__,
- (UINTN)__LINE__,
- Status
- );
+StandardLib->RecordAssertion (
+   StandardLib,
+   AssertionType,
+   gSimpleNetworkBBTestConformanceAssertionGuid007,
+   L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke 
ReceiveFilters() when network interface not initialized.",
+   L"%a:%d:Status - %r",
+   __FILE__,
+   (UINTN)__LINE__,
+   Status
+   );
+  }
 
   //
   // Assertion Point 5.6.2.3
@@ -683,22 +701,31 @@ BBTestReceiveFilterConformanceTest (
   //  Call ReceiveFilters with invalide Enable
   //
   Status = SnpInterface->ReceiveFilters (SnpInterface, 
~(SnpInterface->Mode->ReceiveFilterMask), 0, FALSE, 0, NULL);
-  if (Status == EFI_INVALID_PARAMETER) {
-AssertionType = EFI_TEST_ASSERTION_PASSED;
+  if (Status == EFI_UNSUPPORTED) {
+StandardLib->RecordMessage(
+   StandardLib,
+ 

[edk2-devel] [edk2-test] [PATCH 1/1] uefi-sct/SctPkg: UninstallMultipleProtocols, checkpoint 7-9

2019-09-12 Thread Heinrich Schuchardt
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1869

BS.UninstallMultipleProtocolInterfaces - InterfaceTestCheckpoint7 - 9
expect UninstallMultipleProtocols() to return EFI_ACCESS_DENIED but the
UEFI spec has:

"If any errors are generated while the protocol interfaces are being
uninstalled, then the protocols uninstalled prior to the error will be
reinstalled with the boot service
EFI_BOOT_SERVICES.InstallProtocolInterface() and the status code
EFI_INVALID_PARAMETER is returned."

So the SCT should check for EFI_INVALID_PARAMETER and not for
EFI_ACCESS_DENIED.

Correct the assertions.

InterfaceCheckpoint6 has already been corrected with commit 30c4031acbdb
("uefi-sct/SctPkg: assertion for UninstallMultipleProtocols")

Signed-off-by: Heinrich Schuchardt 
---
 .../BlackBoxTest/ProtocolHandlerBBTestFunction_2.c  | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/ProtocolHandlerServices/BlackBoxTest/ProtocolHandlerBBTestFunction_2.c
 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/ProtocolHandlerServices/BlackBoxTest/ProtocolHandlerBBTestFunction_2.c
index fe6146b2..104e93b5 100644
--- 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/ProtocolHandlerServices/BlackBoxTest/ProtocolHandlerBBTestFunction_2.c
+++ 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/ProtocolHandlerServices/BlackBoxTest/ProtocolHandlerBBTestFunction_2.c
@@ -13108,7 +13108,7 @@ 
BBTestUninstallMultipleProtocolInterfacesInterfaceTestCheckPoint7 (
 //
 // Step 1: check return status
 //
-if (EFI_ACCESS_DENIED == Status) {
+if (EFI_INVALID_PARAMETER == Status) {
   AssertionType = EFI_TEST_ASSERTION_PASSED;
 } else {
   AssertionType = EFI_TEST_ASSERTION_FAILED;
@@ -13453,7 +13453,7 @@ 
BBTestUninstallMultipleProtocolInterfacesInterfaceTestCheckPoint8 (
 //
 // Step 1: check return status
 //
-if (EFI_ACCESS_DENIED == Status) {
+if (EFI_INVALID_PARAMETER == Status) {
   AssertionType = EFI_TEST_ASSERTION_PASSED;
 } else {
   AssertionType = EFI_TEST_ASSERTION_FAILED;
@@ -13807,7 +13807,7 @@ 
BBTestUninstallMultipleProtocolInterfacesInterfaceTestCheckPoint9 (
 //
 // Step 1: check return status
 //
-if (EFI_ACCESS_DENIED == Status) {
+if (EFI_INVALID_PARAMETER == Status) {
   AssertionType = EFI_TEST_ASSERTION_PASSED;
 } else {
   AssertionType = EFI_TEST_ASSERTION_FAILED;
-- 
2.23.0


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#47199): https://edk2.groups.io/g/devel/message/47199
Mute This Topic: https://groups.io/mt/34118784/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [edk2-core] [PATCH v3 1/1] MdeModulePkg: Make retval in UninstallMultipleProtocol follow Spec

2019-09-12 Thread Heinrich Schuchardt
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1869

The UEFI spec requires that if any error occurs in
UninstallMultipleProtocolInterfaces(), EFI_INVALID_PARAMETER is returned
and not the return code of UninstallProtocolInterface().

Signed-off-by: Heinrich Schuchardt 
Reviewed-by: Dandan Bi 
---
v3
Use @retval instead of @return.
The protocols are reinstalled in the same order in which they are
uninstalled.
v2
Adjust the subject line.
Adjust the function comments to clarify the behavior.
This replaces https://edk2.groups.io/g/devel/message/46974
---
 MdeModulePkg/Core/Dxe/Hand/Handle.c | 20 ++--
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/MdeModulePkg/Core/Dxe/Hand/Handle.c 
b/MdeModulePkg/Core/Dxe/Hand/Handle.c
index b2721b3ab2..81a13c6ae5 100644
--- a/MdeModulePkg/Core/Dxe/Hand/Handle.c
+++ b/MdeModulePkg/Core/Dxe/Hand/Handle.c
@@ -802,20 +802,27 @@ Done:
 
 
 
-
 /**
   Uninstalls a list of protocol interface in the boot services environment.
-  This function calls UnisatllProtocolInterface() in a loop. This is
+  This function calls UninstallProtocolInterface() in a loop. This is
   basically a lib function to save space.
 
-  @param  Handle The handle to uninstall the protocol
+  If any errors are generated while the protocol interfaces are being
+  uninstalled, then the protocol interfaces uninstalled prior to the error will
+  be reinstalled and EFI_INVALID_PARAMETER will be returned.
+
+  @param  Handle The handle to uninstall the protocol 
interfaces
+ from.
   @param  ...EFI_GUID followed by protocol instance. A NULL
- terminates the  list. The pairs are the
+ terminates the list. The pairs are the
  arguments to UninstallProtocolInterface(). All
  the protocols are added to Handle.
 
-  @return Status code
-
+  @retval EFI_SUCCESSif all protocol interfaces where uninstalled.
+  @retval EFI_INVALID_PARAMETER  if any protocol interface could not be
+ uninstalled and an attempt was made to
+ reinstall previously uninstalled protocol
+ interfaces.
 **/
 EFI_STATUS
 EFIAPI
@@ -864,6 +871,7 @@ CoreUninstallMultipleProtocolInterfaces (
   CoreInstallProtocolInterface (, Protocol, EFI_NATIVE_INTERFACE, 
Interface);
 }
 VA_END (Args);
+Status = EFI_INVALID_PARAMETER;
   }
 
   return Status;
-- 
2.20.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#47177): https://edk2.groups.io/g/devel/message/47177
Mute This Topic: https://groups.io/mt/34112406/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [edk2-core] [PATCH v2 1/1] MdeModulePkg: Make retval in UninstallMultipleProtocol follow Spec

2019-09-12 Thread Heinrich Schuchardt

On 9/12/19 3:59 AM, Bi, Dandan wrote:

Hi ,

Thanks for the update.
I don't know how you send this patch, the format and subject seems a little 
different from V1 patch. Anyway it doesn't block my review of this patch.

I have two minor comments for the function comments:
1. Per EDKII C Coding Spec, @retval for each unique return value, @return for a 
function's return values when those values aren't easily described by @retval 
commands.


Thanks for pointing me to the coding spec (available at
https://github.com/tianocore-docs/Docs/raw/master/Specifications/CCS_2_1_Draft.pdf).

I will correct that. Looking at the rest of the file you will other
examples of incorrect use of @return: CoreUnregisterProtocolNotifyEvent.


So here I think we should use @retval instead of @return.
2. Per my understanding, the protocol interfaces uninstalled prior to the error 
seems not to be reinstalled in reverse order of uninstalling, the 
reinstallation seems in the same order of previous uninstalling (start from the 
first pair after the handle to next...). Please help double check this issue 
and update the comments if needed .


You are right. VA_ARG() moves form first to last.

Thanks for reviewing. Best regards

Heinrich



Since these are the comments update and with these addressed,  Reviewed-by: Dandan Bi 


Thanks,
Dandan

-Original Message-
From: Heinrich Schuchardt [mailto:xypron.g...@gmx.de]
Sent: Tuesday, September 10, 2019 4:12 PM
To: EDK II Development ; Bi, Dandan

Cc: Wu, Hao A ; Wang, Jian J ;
Gao, Liming ; Zeng, Star ; Yao,
Jiewen ; Laszlo Ersek ; Jin, Eric
; Supreeth Venkatesh ;
Stephano Cetola ; Heinrich Schuchardt

Subject: [edk2-core] [PATCH v2 1/1] MdeModulePkg: Make retval in
UninstallMultipleProtocol follow Spec

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1869

The UEFI spec requires that if any error occurs in
UninstallMultipleProtocolInterfaces(), EFI_INVALID_PARAMETER is returned
and not the return code of UninstallProtocolInterface().

Signed-off-by: Heinrich Schuchardt 
---
v2
Adjust the subject line.
Adjust the function comments to clarify the behavior.
This replaces https://edk2.groups.io/g/devel/message/46974
---
  MdeModulePkg/Core/Dxe/Hand/Handle.c | 21 +++--
  1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/MdeModulePkg/Core/Dxe/Hand/Handle.c
b/MdeModulePkg/Core/Dxe/Hand/Handle.c
index b2721b3ab2..719ba98261 100644
--- a/MdeModulePkg/Core/Dxe/Hand/Handle.c
+++ b/MdeModulePkg/Core/Dxe/Hand/Handle.c
@@ -802,20 +802,28 @@ Done:
- /**   Uninstalls a list of protocol interface in the boot services
environment.-  This function calls UnisatllProtocolInterface() in a loop. This
is+  This function calls UninstallProtocolInterface() in a loop. This is   
basically a
lib function to save space. -  @param  Handle The handle to 
uninstall
the protocol+  If any errors are generated while the protocol interfaces are
being+  uninstalled, then the protocol interfaces uninstalled prior to the error
will+  be reinstalled in reverse order of uninstalling and
EFI_INVALID_PARAMETER is+  returned.++  @param  Handle The
handle to uninstall the protocol interfaces+ 
from.   @param  ...
EFI_GUID followed by protocol instance. A NULL- 
terminates
the  list. The pairs are the+ terminates the 
list. The pairs are
the  arguments to UninstallProtocolInterface(). 
All
the protocols are added to Handle. -  @return Status code-+  @return
EFI_SUCCESSif all protocol interfaces where uninstalled.+  @return
EFI_INVALID_PARAMETER  if any protocol interface could not be+
uninstalled and an attempt was made to+ 
reinstall previously
uninstalled protocol+ interfaces. **/ 
EFI_STATUS EFIAPI@@ -
864,6 +872,7 @@ CoreUninstallMultipleProtocolInterfaces (
CoreInstallProtocolInterface (, Protocol, EFI_NATIVE_INTERFACE,
Interface); } VA_END (Args);+Status = EFI_INVALID_PARAMETER;   }
return Status;--
2.20.1






-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#47176): https://edk2.groups.io/g/devel/message/47176
Mute This Topic: https://groups.io/mt/34089787/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] Copyright EDK II C Coding Standards Specification

2019-09-12 Thread Heinrich Schuchardt

Hello Stephano,

the EDK II C Coding Standards Specification is available at:

https://raw.githubusercontent.com/tianocore-docs/Docs/master/Specifications/CCS_2_1_Draft.pdf

It is copyright restricted, allowing only copying for internal use.

As EDK II has moved to be open source wouldn't it make sense to apply
some more liberal copyright license for the accompanying material too, e.g.

https://creativecommons.org/licenses/by/4.0/

Best regards

Heinrich

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#47174): https://edk2.groups.io/g/devel/message/47174
Mute This Topic: https://groups.io/mt/34112329/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] [PATCH v2 1/1] uefi-sct/SctPkg: setting key toggle state may be unsupported

2019-09-11 Thread Heinrich Schuchardt

On 9/12/19 4:32 AM, Jin, Eric wrote:

Heinrich,

Could you please provide your company/organization info in copyright part?


Hello Eric,

my work on EDK2 has neither been on behalf of a company or organization,
nor have I received any remuneration for it. If you deem it appropriate,
feel free to add my name.

Best regards

Heinrich Schuchardt


I could help to add it when I push the patch.

With that - Reviewed by: Eric Jin 

Best Regards
Eric

-Original Message-
From: Heinrich Schuchardt 
Sent: Thursday, September 12, 2019 2:45 AM
To: EDK II Development 
Cc: Jin, Eric ; Supreeth Venkatesh ; 
Stephano Cetola ; Heinrich Schuchardt 
Subject: [edk2-test] [PATCH v2 1/1] uefi-sct/SctPkg: setting key toggle state 
may be unsupported

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2169

The UEFI specification allows EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.SetState()
to return EFI_UNSUPPORTED if a state change is not supported. This for instance 
may be the case when connecting via a serial connection.

Up to now the SCT has marked the conformance test as FAILED if SetState() was 
called with invalid parameters and EFI_UNSUPPORTED was returned which 
contradicts the specification.

Instead create a warning if SetState() returns EFI_UNSUPPORTED. This allows the 
user to check if the non-support is justified.

Signed-off-by: Heinrich Schuchardt 
---
v2:
Issue warning if EFI_UNSUPPORTED is returned when called with
invalid parameters.
---
  .../BlackBoxTest/SimpleTextInputExBBTestConformance.c   | 6 --
  1 file changed, 4 insertions(+), 2 deletions(-)

diff --git 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestConformance.c
 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestConformance.c
index d997b651..946cb274 100644
--- 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestConformance.c
+++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/Black
+++ BoxTest/SimpleTextInputExBBTestConformance.c
@@ -483,8 +483,10 @@ BBTestSetStateConformanceTestCheckpoint1 (
  ); }   }-  -  if ( EFI_INVALID_PARAMETER != 
Status) {++  if (Status == EFI_UNSUPPORTED) {+AssertionType = 
EFI_TEST_ASSERTION_WARNING;+  } else if (Status != EFI_INVALID_PARAMETER) { 
AssertionType = EFI_TEST_ASSERTION_FAILED;   } else { AssertionType = 
EFI_TEST_ASSERTION_PASSED;--
2.20.1





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#47169): https://edk2.groups.io/g/devel/message/47169
Mute This Topic: https://groups.io/mt/34106966/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [edk2-test] [PATCH v2 1/1] uefi-sct/SctPkg: buffer overflow in NotifyFunctionTplEx()

2019-09-11 Thread Heinrich Schuchardt
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1976

CreateEventEx() may lead to a change in the memory map causing an
EFI_EVENT_GROUP_MEMORY_MAP_CHANGE. So in BBTestCreateEventEx_Func_Sub3() we
should only check for events triggered after the events have been set up.

Among other changes commit c093702f98ad (""uefi-sct/SctPkg:Fix flaw in
BBTestCreateEventEx_Func_Sub3) tried to adjust the event recording logic in
NotifyFunctionTplEx() to account for this.

The commit did not consider that CloseEvent() will release memory and
equally lead to EFI_EVENT_GROUP_MEMORY_MAP_CHANGE. NotifyFunctionTplEx()
does not check the limits of the buffer. So a buffer overrun occurs in this
case.

The easiest way to account for memory map changes by CreateEventEx() is to
initialize the event invocation records after setting up the events.

Moving the check of the event sequence to before CloseEvent() ensures that
we only measure the events we are interested in.

In function NotifyFunctionTplEx() check the index against the buffer
limits. Stop recording after MAX_TEST_EVENT_NUM events.

Fixes: c093702f98ad (""uefi-sct/SctPkg:Fix flaw in 
BBTestCreateEventEx_Func_Sub3)
Signed-off-by: Heinrich Schuchardt 
---
v2:
Move closing and freeing of events after the assertion. This ensures
that memory changes resulting from CloseEvent() do not change the
test results.
---
 ...rTaskPriorityServicesBBTestCreateEventEx.c | 35 +++-
 .../BlackBoxTest/Support.c| 55 +--
 2 files changed, 35 insertions(+), 55 deletions(-)

diff --git 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/EventTimerTaskPriorityServicesBBTestCreateEventEx.c
 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/EventTimerTaskPriorityServicesBBTestCreateEventEx.c
index 4a8e44e2..2b119ff0 100644
--- 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/EventTimerTaskPriorityServicesBBTestCreateEventEx.c
+++ 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/EventTimerTaskPriorityServicesBBTestCreateEventEx.c
@@ -918,12 +918,11 @@ BBTestCreateEventEx_Func_Sub3 (
   UINTN   Buffer[MAX_TEST_EVENT_NUM + MAX_TEST_EVENT_NUM*2];
 
   //
-  // Initialize Buffer as SIGNAL_CONTEXT
+  // Initialize the event index. The event invocation records will be
+  // initialized later.
   //
   for (Index = 0; Index < MAX_TEST_EVENT_NUM; Index ++) {
 Buffer[Index] = Index;
-Buffer[Index + MAX_TEST_EVENT_NUM + Index] = (UINTN)(SIGNAL_CONTEXT);
-Buffer[Index + MAX_TEST_EVENT_NUM + 1 + Index] = (UINTN)(SIGNAL_CONTEXT);
   }
 
   //
@@ -976,7 +975,17 @@ BBTestCreateEventEx_Func_Sub3 (
 gtBS->CloseEvent (Event[1]);
 return Status;
   }
-  
+
+  //
+  // CreateEventEx() may lead to a change in the memory map and trigger
+  // EFI_EVENT_GROUP_MEMORY_MAP_CHANGE itself. So initialize the event
+  // invocation records after creating the events.
+  //
+  for (Index = 0; Index < MAX_TEST_EVENT_NUM; Index ++) {
+Buffer[Index + MAX_TEST_EVENT_NUM + Index] = (UINTN)(SIGNAL_CONTEXT);
+Buffer[Index + MAX_TEST_EVENT_NUM + 1 + Index] = (UINTN)(SIGNAL_CONTEXT);
+  }
+
   //
   // Call AllocatePage to change the memorymap
   //
@@ -998,14 +1007,6 @@ BBTestCreateEventEx_Func_Sub3 (

   gtBS->RestoreTPL (OldTpl);
 
-  //
-  // Close all the events created and Free the pages
-  //
-  gtBS->CloseEvent (Event[0]);
-  gtBS->CloseEvent (Event[1]);
-  gtBS->CloseEvent (Event[2]);
-  gtBS->FreePages (Memory, 2);
-
   //
   // Compare the notify order
   //
@@ -1030,9 +1031,17 @@ BBTestCreateEventEx_Func_Sub3 (
  Buffer[MAX_TEST_EVENT_NUM + 5]
  );
 
+  //
+  // Close all the events created and Free the pages
+  //
+  gtBS->CloseEvent (Event[0]);
+  gtBS->CloseEvent (Event[1]);
+  gtBS->CloseEvent (Event[2]);
+  gtBS->FreePages (Memory, 2);
+
   //
   // Done
   //
   return EFI_SUCCESS;
 }
-#endif
\ No newline at end of file
+#endif
diff --git 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/Support.c
 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/Support.c
index c702f84d..0c900a3e 100644
--- 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/Support.c
+++ 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/Support.c
@@ -58,58 +58,29 @@ NotifyFunctionTplEx(
   EFI_TPL   OldTpl;
   UINTN EventIndex;
   UINTN Index;
-  
+
   if (Context != NULL) {
 Buffer = Context;
 
 EventIndex = Buffer[0];
 
 //
-// The special code check for the BBTestCreateEventEx_Func_Sub3
-// Besides AllocatePages(), CreateEventEx() may trigger the memorymap
-// chan

[edk2-devel] [edk2-test] [PATCH v2 1/1] uefi-sct/SctPkg: setting key toggle state may be unsupported

2019-09-11 Thread Heinrich Schuchardt
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2169

The UEFI specification allows EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.SetState()
to return EFI_UNSUPPORTED if a state change is not supported. This for
instance may be the case when connecting via a serial connection.

Up to now the SCT has marked the conformance test as FAILED if SetState()
was called with invalid parameters and EFI_UNSUPPORTED was returned which
contradicts the specification.

Instead create a warning if SetState() returns EFI_UNSUPPORTED. This allows
the user to check if the non-support is justified.

Signed-off-by: Heinrich Schuchardt 
---
v2:
Issue warning if EFI_UNSUPPORTED is returned when called with
invalid parameters.
---
 .../BlackBoxTest/SimpleTextInputExBBTestConformance.c   | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestConformance.c
 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestConformance.c
index d997b651..946cb274 100644
--- 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestConformance.c
+++ 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestConformance.c
@@ -483,8 +483,10 @@ BBTestSetStateConformanceTestCheckpoint1 (
 );
 }
   }
-  
-  if ( EFI_INVALID_PARAMETER != Status) {
+
+  if (Status == EFI_UNSUPPORTED) {
+AssertionType = EFI_TEST_ASSERTION_WARNING;
+  } else if (Status != EFI_INVALID_PARAMETER) {
 AssertionType = EFI_TEST_ASSERTION_FAILED;
   } else {
 AssertionType = EFI_TEST_ASSERTION_PASSED;
-- 
2.20.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#47136): https://edk2.groups.io/g/devel/message/47136
Mute This Topic: https://groups.io/mt/34106966/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [edk2-core] [PATCH v2 1/1] MdeModulePkg: Make retval in UninstallMultipleProtocol follow Spec

2019-09-10 Thread Heinrich Schuchardt
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1869

The UEFI spec requires that if any error occurs in
UninstallMultipleProtocolInterfaces(), EFI_INVALID_PARAMETER is returned
and not the return code of UninstallProtocolInterface().

Signed-off-by: Heinrich Schuchardt 
---
v2
Adjust the subject line.
Adjust the function comments to clarify the behavior.
This replaces https://edk2.groups.io/g/devel/message/46974
---
 MdeModulePkg/Core/Dxe/Hand/Handle.c | 21 +++--
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/MdeModulePkg/Core/Dxe/Hand/Handle.c 
b/MdeModulePkg/Core/Dxe/Hand/Handle.c
index b2721b3ab2..719ba98261 100644
--- a/MdeModulePkg/Core/Dxe/Hand/Handle.c
+++ b/MdeModulePkg/Core/Dxe/Hand/Handle.c
@@ -802,20 +802,28 @@ Done:
 
 
 
-
 /**
   Uninstalls a list of protocol interface in the boot services environment.
-  This function calls UnisatllProtocolInterface() in a loop. This is
+  This function calls UninstallProtocolInterface() in a loop. This is
   basically a lib function to save space.
 
-  @param  Handle The handle to uninstall the protocol
+  If any errors are generated while the protocol interfaces are being
+  uninstalled, then the protocol interfaces uninstalled prior to the error will
+  be reinstalled in reverse order of uninstalling and EFI_INVALID_PARAMETER is
+  returned.
+
+  @param  Handle The handle to uninstall the protocol 
interfaces
+ from.
   @param  ...EFI_GUID followed by protocol instance. A NULL
- terminates the  list. The pairs are the
+ terminates the list. The pairs are the
  arguments to UninstallProtocolInterface(). All
  the protocols are added to Handle.
 
-  @return Status code
-
+  @return EFI_SUCCESSif all protocol interfaces where uninstalled.
+  @return EFI_INVALID_PARAMETER  if any protocol interface could not be
+ uninstalled and an attempt was made to
+ reinstall previously uninstalled protocol
+ interfaces.
 **/
 EFI_STATUS
 EFIAPI
@@ -864,6 +872,7 @@ CoreUninstallMultipleProtocolInterfaces (
   CoreInstallProtocolInterface (, Protocol, EFI_NATIVE_INTERFACE, 
Interface);
 }
 VA_END (Args);
+Status = EFI_INVALID_PARAMETER;
   }
 
   return Status;
-- 
2.20.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#47069): https://edk2.groups.io/g/devel/message/47069
Mute This Topic: https://groups.io/mt/34089787/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [edk2-test] [PATCH v2 1/1] uefi-sct/SctPkg: SNP Statistics may be unsupported

2019-09-09 Thread Heinrich Schuchardt
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2160

If EFI_SIMPLE_NETWORK.Statistics() is not supported, it will return
EFI_UNSUPPORTED. In this case do not expect input parameters to be checked
for conformance.

If an error in SnpInterface->Start() occurs we error out. Therefore create
assertion messages always directly after each individual check.

Fix some typos in comments and messages.

Signed-off-by: Heinrich Schuchardt 
---
v2:
Create assertion messages always directly after each individual check.
Fix typos in comments and messages.
---
 .../SimpleNetworkBBTestConformance.c  | 123 ++
 1 file changed, 72 insertions(+), 51 deletions(-)

diff --git 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/BlackBoxTest/SimpleNetworkBBTestConformance.c
 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/BlackBoxTest/SimpleNetworkBBTestConformance.c
index 9d5bec18..9bd21a76 100644
--- 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/BlackBoxTest/SimpleNetworkBBTestConformance.c
+++ 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/BlackBoxTest/SimpleNetworkBBTestConformance.c
@@ -964,8 +964,7 @@ BBTestStatisticsConformanceTest (
 {
   EFI_STANDARD_TEST_LIBRARY_PROTOCOL*StandardLib;
   EFI_STATUSStatus;
-  EFI_STATUSStatusBuf[3];  
-  EFI_TEST_ASSERTIONAssertionType[3];
+  EFI_TEST_ASSERTIONAssertionType;
   EFI_SIMPLE_NETWORK_PROTOCOL   *SnpInterface;
   EFI_SIMPLE_NETWORK_STATE  State1, State2;
   EFI_NETWORK_STATISTICSStatisticsTable;
@@ -1012,31 +1011,68 @@ BBTestStatisticsConformanceTest (
   StatisticsSize = sizeof (EFI_NETWORK_STATISTICS);
   //
   // Assertion Point 5.8.2.1
-  // Call Statistics() function if network interface not start.
+  // Call Statistics() function while network interface is not started.
   //
-  StatusBuf[0] = SnpInterface->Statistics (SnpInterface, FALSE, 
, );
-  if ((StatusBuf[0] == EFI_NOT_STARTED) && (SnpInterface->Mode->State == 
EfiSimpleNetworkStopped)) {
-AssertionType[0] = EFI_TEST_ASSERTION_PASSED;
+  Status = SnpInterface->Statistics (SnpInterface, FALSE, , 
);
+  if (Status == EFI_UNSUPPORTED) {
+StandardLib->RecordMessage(
+   StandardLib,
+   EFI_VERBOSE_LEVEL_QUIET,
+   L"Statistics isn't supported, Status - %r\n",
+   Status
+   );
   } else {
-AssertionType[0] = EFI_TEST_ASSERTION_FAILED;
+if ((Status == EFI_NOT_STARTED) && (SnpInterface->Mode->State == 
EfiSimpleNetworkStopped)) {
+  AssertionType = EFI_TEST_ASSERTION_PASSED;
+} else {
+  AssertionType = EFI_TEST_ASSERTION_FAILED;
+}
+StandardLib->RecordAssertion (
+   StandardLib,
+   AssertionType,
+   gSimpleNetworkBBTestConformanceAssertionGuid014,
+   L"EFI_SIMPLE_NETWORK_PROTOCOL.Statistics - Invoke 
Statistics() while network interface not started.",
+   L"%a:%d:Status - %r",
+   __FILE__,
+   (UINTN)__LINE__,
+   Status
+   );
   }
 
   //
   // Assertion Point 5.8.2.2
-  // Call Statistics() function if network interface not initialized.
+  // Call Statistics() function while network interface is not initialized.
   //
   Status = SnpInterface->Start (SnpInterface);
   if (EFI_ERROR(Status)) {
 return Status;
   }
 
-  StatusBuf[1] = SnpInterface->Statistics (SnpInterface, FALSE, 
, );
-  if (StatusBuf[1] == EFI_DEVICE_ERROR) {
-AssertionType[1] = EFI_TEST_ASSERTION_PASSED;
+  Status = SnpInterface->Statistics (SnpInterface, FALSE, , 
);
+  if (Status == EFI_UNSUPPORTED) {
+StandardLib->RecordMessage(
+   StandardLib,
+   EFI_VERBOSE_LEVEL_QUIET,
+   L"Statistics isn't supported, Status - %r\n",
+   Status
+   );
   } else {
-AssertionType[1] = EFI_TEST_ASSERTION_FAILED;
+if (Status == EFI_DEVICE_ERROR) {
+  AssertionType = EFI_TEST_ASSERTION_PASSED;
+} else {
+  AssertionType = EFI_TEST_ASSERTION_FAILED;
+}
+StandardLib->RecordAssertion (
+   StandardLib,
+   AssertionType,
+   gSimpleNetworkBBTestConformanceAssertionGuid015,
+   L"EFI_SIMPLE_NETWORK_PROTOCOL.Statistics - Invoke 
Statistics() while network interface is not initialized.",
+   L"%a:%d:Status - %r",
+   __FILE__,
+   (UINTN)__LINE__,
+   Status
+   );
   }
- 
 
   //
   // Assertion Point 5.8.2.3
@@ -1053,47 +1089,32 @@ BBTestStatisticsConformanceTest (
   //
   StatisticsSize = 0;
 
-  Sta

[edk2-devel] [edk2-core] [PATCH 1/1] MdeModulePkg: errors in UninstallMultipleProtocolInterfaces

2019-09-06 Thread Heinrich Schuchardt
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1869

The UEFI spec requires that if any error occurs in
UninstallMultipleProtocolInterfaces(), EFI_INVALID_PARAMETER is returned
and not the return code of UninstallProtocolInterface().

Signed-off-by: Heinrich Schuchardt 
---
 MdeModulePkg/Core/Dxe/Hand/Handle.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MdeModulePkg/Core/Dxe/Hand/Handle.c 
b/MdeModulePkg/Core/Dxe/Hand/Handle.c
index b2721b3ab2..7533b8a2ce 100644
--- a/MdeModulePkg/Core/Dxe/Hand/Handle.c
+++ b/MdeModulePkg/Core/Dxe/Hand/Handle.c
@@ -864,6 +864,7 @@ CoreUninstallMultipleProtocolInterfaces (
   CoreInstallProtocolInterface (, Protocol, EFI_NATIVE_INTERFACE, 
Interface);
 }
 VA_END (Args);
+Status = EFI_INVALID_PARAMETER;
   }
 
   return Status;
-- 
2.20.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#46974): https://edk2.groups.io/g/devel/message/46974
Mute This Topic: https://groups.io/mt/33164398/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [edk2-test] [PATCH 1/1] uefi-sct/SctPkg: setting key toggle state may be unsupported

2019-09-04 Thread Heinrich Schuchardt
It is allowable that a system does not support
EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.SetState(). For instance a serial console
would not allow to set toggle keys. In this case do not expect the function
to check its arguments. It will typically directly return EFI_UNSUPPORTED.

Signed-off-by: Heinrich Schuchardt 
---
 .../SimpleTextInputExBBTestConformance.c  | 37 ---
 1 file changed, 23 insertions(+), 14 deletions(-)

diff --git 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestConformance.c
 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestConformance.c
index d997b651..7876d8db 100644
--- 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestConformance.c
+++ 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestConformance.c
@@ -483,22 +483,31 @@ BBTestSetStateConformanceTestCheckpoint1 (
 );
 }
   }
-  
-  if ( EFI_INVALID_PARAMETER != Status) {
-AssertionType = EFI_TEST_ASSERTION_FAILED;
+
+  if (Status == EFI_UNSUPPORTED) {
+StandardLib->RecordMessage(
+   StandardLib,
+   EFI_VERBOSE_LEVEL_QUIET,
+   L"SetState isn't supported, Status - %r\n",
+   Status
+   );
   } else {
-AssertionType = EFI_TEST_ASSERTION_PASSED;
+if ( EFI_INVALID_PARAMETER != Status) {
+  AssertionType = EFI_TEST_ASSERTION_FAILED;
+} else {
+  AssertionType = EFI_TEST_ASSERTION_PASSED;
+}
+StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ gSimpleTextInputExBBTestConformanceAssertionGuid003,
+ L"SIMPLE_TEXT_INPUT_EX_PROTOCOL.SetState - SetState() returns 
EFI_INVALID_PARAMETER with KeyToggleState being NULL.",
+ L"%a:%d: Status - %r",
+ __FILE__,
+ (UINTN)__LINE__,
+ Status
+ );
   }
-  StandardLib->RecordAssertion (
-   StandardLib,
-   AssertionType,
-   gSimpleTextInputExBBTestConformanceAssertionGuid003,
-   L"SIMPLE_TEXT_INPUT_EX_PROTOCOL.SetState - SetState() returns 
EFI_INVALID_PARAMETER with KeyToggleState being NULL.",
-   L"%a:%d: Status - %r",
-   __FILE__,
-   (UINTN)__LINE__,
-   Status
-   );
 
   return EFI_SUCCESS;
 }
-- 
2.23.0.rc1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#46832): https://edk2.groups.io/g/devel/message/46832
Mute This Topic: https://groups.io/mt/33143842/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [edk2-test] [PATCH 1/1] uefi-sct/SctPkg: SNP Statistics may be unsupported

2019-09-04 Thread Heinrich Schuchardt
If EFI_SIMPLE_NETWORK.Statistics() is not supported, it will return
EFI_UNSUPPORTED. In this case do not expect input parameters to be checked
for conformance.

Signed-off-by: Heinrich Schuchardt 
---
 .../SimpleNetworkBBTestConformance.c  | 112 +++---
 1 file changed, 72 insertions(+), 40 deletions(-)

diff --git 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/BlackBoxTest/SimpleNetworkBBTestConformance.c
 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/BlackBoxTest/SimpleNetworkBBTestConformance.c
index 9d5bec18..ea4a806b 100644
--- 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/BlackBoxTest/SimpleNetworkBBTestConformance.c
+++ 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/BlackBoxTest/SimpleNetworkBBTestConformance.c
@@ -1015,10 +1015,19 @@ BBTestStatisticsConformanceTest (
   // Call Statistics() function if network interface not start.
   //
   StatusBuf[0] = SnpInterface->Statistics (SnpInterface, FALSE, 
, );
-  if ((StatusBuf[0] == EFI_NOT_STARTED) && (SnpInterface->Mode->State == 
EfiSimpleNetworkStopped)) {
-AssertionType[0] = EFI_TEST_ASSERTION_PASSED;
+  if (StatusBuf[0] == EFI_UNSUPPORTED) {
+StandardLib->RecordMessage(
+   StandardLib,
+   EFI_VERBOSE_LEVEL_QUIET,
+   L"Statistics isn't supported, Status - %r\n",
+   StatusBuf[0]
+   );
   } else {
-AssertionType[0] = EFI_TEST_ASSERTION_FAILED;
+if ((StatusBuf[0] == EFI_NOT_STARTED) && (SnpInterface->Mode->State == 
EfiSimpleNetworkStopped)) {
+  AssertionType[0] = EFI_TEST_ASSERTION_PASSED;
+} else {
+  AssertionType[0] = EFI_TEST_ASSERTION_FAILED;
+}
   }
 
   //
@@ -1031,10 +1040,19 @@ BBTestStatisticsConformanceTest (
   }
 
   StatusBuf[1] = SnpInterface->Statistics (SnpInterface, FALSE, 
, );
-  if (StatusBuf[1] == EFI_DEVICE_ERROR) {
-AssertionType[1] = EFI_TEST_ASSERTION_PASSED;
+  if (StatusBuf[1] == EFI_UNSUPPORTED) {
+StandardLib->RecordMessage(
+   StandardLib,
+   EFI_VERBOSE_LEVEL_QUIET,
+   L"Statistics isn't supported, Status - %r\n",
+   StatusBuf[1]
+   );
   } else {
-AssertionType[1] = EFI_TEST_ASSERTION_FAILED;
+if (StatusBuf[1] == EFI_DEVICE_ERROR) {
+  AssertionType[1] = EFI_TEST_ASSERTION_PASSED;
+} else {
+  AssertionType[1] = EFI_TEST_ASSERTION_FAILED;
+}
   }
  
 
@@ -1054,45 +1072,59 @@ BBTestStatisticsConformanceTest (
   StatisticsSize = 0;
 
   StatusBuf[2] = SnpInterface->Statistics (SnpInterface, FALSE, 
, );
-  if (StatusBuf[2] == EFI_BUFFER_TOO_SMALL || Status == EFI_UNSUPPORTED) {
-AssertionType[2] = EFI_TEST_ASSERTION_PASSED;
+  if (StatusBuf[2] == EFI_UNSUPPORTED) {
+StandardLib->RecordMessage(
+   StandardLib,
+   EFI_VERBOSE_LEVEL_QUIET,
+   L"Statistics isn't supported, Status - %r\n",
+   StatusBuf[2]
+   );
   } else {
-AssertionType[2] = EFI_TEST_ASSERTION_FAILED;
+if (StatusBuf[2] == EFI_BUFFER_TOO_SMALL || Status == EFI_UNSUPPORTED) {
+  AssertionType[2] = EFI_TEST_ASSERTION_PASSED;
+} else {
+  AssertionType[2] = EFI_TEST_ASSERTION_FAILED;
+}
   }
 
+  if (StatusBuf[0] != EFI_UNSUPPORTED) {
+StandardLib->RecordAssertion (
+   StandardLib,
+   AssertionType[0],
+   gSimpleNetworkBBTestConformanceAssertionGuid014,
+   L"EFI_SIMPLE_NETWORK_PROTOCOL.Statistics - Invoke 
Statistics() when network interface not start.",
+   L"%a:%d:Status - %r",
+   __FILE__,
+   (UINTN)__LINE__,
+   StatusBuf[0]
+   );
+  }
   
-  StandardLib->RecordAssertion (
- StandardLib,
- AssertionType[0],
- gSimpleNetworkBBTestConformanceAssertionGuid014,
- L"EFI_SIMPLE_NETWORK_PROTOCOL.Statistics - Invoke 
Statistics() when network interface not start.",
- L"%a:%d:Status - %r",
- __FILE__,
- (UINTN)__LINE__,
- StatusBuf[0]
- );
-  
-  StandardLib->RecordAssertion (
- StandardLib,
- AssertionType[1],
- gSimpleNetworkBBTestConformanceAssertionGuid015,
- L"EFI_SIMPLE_NETWORK_PROTOCOL.Statistics - Invoke 
Statistics() when network interface not initialized.",
- L"%a:%d:Status - %r",
- __FILE__,
- (UINTN)__LINE__,
- StatusBuf[1]
- );
+  if (StatusBuf[1] != EFI_UNSUPPORTED) {
+StandardLib->RecordAssertion (
+

[edk2-devel] [edk2-test] [PATCH 1/1] uefi-sct/SctPkg: fix typo 'supproted'

2019-09-04 Thread Heinrich Schuchardt
%s/supproted/supported/g

Signed-off-by: Heinrich Schuchardt 
---
 .../Protocol/PciIo/BlackBoxTest/PciIoBBTestStress.c  |  2 +-
 .../BlackBoxTest/SimpleNetworkBBTestConformance.c| 12 ++--
 .../BlackBoxTest/SimpleNetworkBBTestFunction.c   | 12 ++--
 .../BlackBoxTest/SimpleNetworkBBTestConformance.c| 12 ++--
 .../BlackBoxTest/SimpleNetworkBBTestFunction.c   | 12 ++--
 5 files changed, 25 insertions(+), 25 deletions(-)

diff --git 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PciIo/BlackBoxTest/PciIoBBTestStress.c
 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PciIo/BlackBoxTest/PciIoBBTestStress.c
index 645e37f7..225724ae 100644
--- 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PciIo/BlackBoxTest/PciIoBBTestStress.c
+++ 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PciIo/BlackBoxTest/PciIoBBTestStress.c
@@ -999,7 +999,7 @@ GetAndSetBarAttributes_Stress (
StandardLib,
AssertionType,
gPciIoBBTestStressAssertionGuid021,
-   L"EFI_PCI_IO_PROTOCOL.GetBarAttributes - Bar supported 
attributes must in the range of Device supproted attributes",
+   L"EFI_PCI_IO_PROTOCOL.GetBarAttributes - Bar supported 
attributes must in the range of Device supported attributes",
L"%a:%d:Bar Supported - %lXh, Dev Supported - %lXh",
__FILE__,
(UINTN)__LINE__,
diff --git 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/BlackBoxTest/SimpleNetworkBBTestConformance.c
 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/BlackBoxTest/SimpleNetworkBBTestConformance.c
index 03a0d041..9d5bec18 100644
--- 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/BlackBoxTest/SimpleNetworkBBTestConformance.c
+++ 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/BlackBoxTest/SimpleNetworkBBTestConformance.c
@@ -885,7 +885,7 @@ BBTestStationAddressConformanceTest (
 StandardLib->RecordMessage(
StandardLib,
EFI_VERBOSE_LEVEL_QUIET,
-   L"StationAddress isn't supproted, Status - %r\n",
+   L"StationAddress isn't supported, Status - %r\n",
StatusBuf[0]
);
   } else {
@@ -911,7 +911,7 @@ BBTestStationAddressConformanceTest (
 StandardLib->RecordMessage(
StandardLib,
EFI_VERBOSE_LEVEL_QUIET,
-   L"StationAddress isn't supproted, Status - %r\n",
+   L"StationAddress isn't supported, Status - %r\n",
StatusBuf[1]
);
   } else {
@@ -1369,7 +1369,7 @@ BBTestNVDataConformanceTest (
 StandardLib->RecordMessage(
StandardLib,
EFI_VERBOSE_LEVEL_QUIET,
-   L"NvData isn't supproted, Status - %r\n",
+   L"NvData isn't supported, Status - %r\n",
StatusBuf[0]
);
   } else {
@@ -1394,7 +1394,7 @@ BBTestNVDataConformanceTest (
 StandardLib->RecordMessage(
StandardLib,
EFI_VERBOSE_LEVEL_QUIET,
-   L"NvData isn't supproted, Status - %r\n",
+   L"NvData isn't supported, Status - %r\n",
StatusBuf[1]
);
   } else {
@@ -1419,7 +1419,7 @@ BBTestNVDataConformanceTest (
 StandardLib->RecordMessage(
StandardLib,
EFI_VERBOSE_LEVEL_QUIET,
-   L"NvData isn't supproted, Status - %r\n",
+   L"NvData isn't supported, Status - %r\n",
StatusBuf[2]
);
   } else {
@@ -1444,7 +1444,7 @@ BBTestNVDataConformanceTest (
 StandardLib->RecordMessage(
StandardLib,
EFI_VERBOSE_LEVEL_QUIET,
-   L"NvData isn't supproted, Status - %r\n",
+   L"NvData isn't supported, Status - %r\n",
StatusBuf[3]
);
   } else {
diff --git 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/BlackBoxTest/SimpleNetworkBBTestFunction.c
 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/BlackBoxTest/SimpleNetworkBBTestFunction.c
index af520430..133ef8a9 100644
--- 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/BlackBoxTest/SimpleNetworkBBTestFunction.c
+++ 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/BlackBoxTest/SimpleNetworkBBTestFunction.c
@@ -1016,7 +1016,7 @@ BBTestStationAddressFunctionTest (
 StandardLib->RecordMessage(
StandardLib,
EFI_VERBOSE_LEVEL_QUIET,
-   L"StationAddress isn't supproted, Status - %r\n",
+  

Re: [edk2-devel] [edk2-test] [PATCH 1/1] uefi-sct/SctPkg: fix typo 'Remained test cases'

2019-09-04 Thread Heinrich Schuchardt

On 9/4/19 4:27 AM, Jin, Eric wrote:

Hi Heinrich Schuchardt,

According to 
https://github.com/tianocore/tianocore.github.io/wiki/Commit-Message-Format
The statement "Contributed-under:..." need be removed.
With that: Reviewed-by: Eric Jin 

If no object, I will help to push with this change by end of this week.



If that contributed-under is not needed anymore, that is great. Please,
feel free to remove it when pushing.

Best regards

Heinrich

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#46745): https://edk2.groups.io/g/devel/message/46745
Mute This Topic: https://groups.io/mt/33124786/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [edk2-test] [PATCH 1/1] uefi-sct/SctPkg: buffer overflow in NotifyFunctionTplEx()

2019-09-03 Thread Heinrich Schuchardt
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1976

CreateEventEx() may lead to a change in the memory map causing an
EFI_EVENT_GROUP_MEMORY_MAP_CHANGE. So in BBTestCreateEventEx_Func_Sub3() we
should only check for events triggered after the events have been set up.

Among other changes commit c093702f98ad (""uefi-sct/SctPkg:Fix flaw in
BBTestCreateEventEx_Func_Sub3) tried to adjust the event recording logic in
NotifyFunctionTplEx() to account for this.

The commit did not consider that CloseEvent() will release memory and
equally lead to EFI_EVENT_GROUP_MEMORY_MAP_CHANGE. NotifyFunctionTplEx()
does not check the limits of the buffer. So a buffer overrun occurs in this
case.

The easiest way to account for memory map changes by CreateEventEx() is to
initialize the event invocation records after setting up the events.

In function NotifyFunctionTplEx() check the index against the buffer
limits. Stop recording after MAX_TEST_EVENT_NUM events.

Fixes: c093702f98ad (""uefi-sct/SctPkg:Fix flaw in 
BBTestCreateEventEx_Func_Sub3)
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Heinrich Schuchardt 
---
 ...rTaskPriorityServicesBBTestCreateEventEx.c | 19 +--
 .../BlackBoxTest/Support.c| 55 +--
 2 files changed, 27 insertions(+), 47 deletions(-)

diff --git 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/EventTimerTaskPriorityServicesBBTestCreateEventEx.c
 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/EventTimerTaskPriorityServicesBBTestCreateEventEx.c
index 4a8e44e2..40af6c07 100644
--- 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/EventTimerTaskPriorityServicesBBTestCreateEventEx.c
+++ 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/EventTimerTaskPriorityServicesBBTestCreateEventEx.c
@@ -918,12 +918,11 @@ BBTestCreateEventEx_Func_Sub3 (
   UINTN   Buffer[MAX_TEST_EVENT_NUM + MAX_TEST_EVENT_NUM*2];
 
   //
-  // Initialize Buffer as SIGNAL_CONTEXT
+  // Initialize the event index. The event invocation records will be
+  // initialized later.
   //
   for (Index = 0; Index < MAX_TEST_EVENT_NUM; Index ++) {
 Buffer[Index] = Index;
-Buffer[Index + MAX_TEST_EVENT_NUM + Index] = (UINTN)(SIGNAL_CONTEXT);
-Buffer[Index + MAX_TEST_EVENT_NUM + 1 + Index] = (UINTN)(SIGNAL_CONTEXT);
   }
 
   //
@@ -976,7 +975,17 @@ BBTestCreateEventEx_Func_Sub3 (
 gtBS->CloseEvent (Event[1]);
 return Status;
   }
-  
+
+  //
+  // CreateEventEx() may lead to a change in the memory map and trigger
+  // EFI_EVENT_GROUP_MEMORY_MAP_CHANGE itself. So initialize the event
+  // invocation records after creating the events.
+  //
+  for (Index = 0; Index < MAX_TEST_EVENT_NUM; Index ++) {
+Buffer[Index + MAX_TEST_EVENT_NUM + Index] = (UINTN)(SIGNAL_CONTEXT);
+Buffer[Index + MAX_TEST_EVENT_NUM + 1 + Index] = (UINTN)(SIGNAL_CONTEXT);
+  }
+
   //
   // Call AllocatePage to change the memorymap
   //
@@ -1035,4 +1044,4 @@ BBTestCreateEventEx_Func_Sub3 (
   //
   return EFI_SUCCESS;
 }
-#endif
\ No newline at end of file
+#endif
diff --git 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/Support.c
 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/Support.c
index c702f84d..0c900a3e 100644
--- 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/Support.c
+++ 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/Support.c
@@ -58,58 +58,29 @@ NotifyFunctionTplEx(
   EFI_TPL   OldTpl;
   UINTN EventIndex;
   UINTN Index;
-  
+
   if (Context != NULL) {
 Buffer = Context;
 
 EventIndex = Buffer[0];
 
 //
-// The special code check for the BBTestCreateEventEx_Func_Sub3
-// Besides AllocatePages(), CreateEventEx() may trigger the memorymap
-// change when it is out of resource in memory pool
-// Use SIGNAL_CONTEXT to block possible enter triggered by CreateEventEx
-//
-if (EventIndex != 2 && Buffer[4] == (UINTN)(SIGNAL_CONTEXT))
-  return;
-
-//
-// It is the code execution path as expect
-// The overall layout buffer as below
-// Buffer[0] [1] [2] store 1st/2nd/3rd event index (start from 0)
-// Buffer[3] [5] [7] store the index of event notified
-// Buffer[4] [6] [8] store the tpl of notification function of 1st/2nd/3rd 
event notified
+// The event's context is offset by EventIndex from the true buffer start.
+// Skip over the MAX_TEST_EVENT_NUM leading index entries.
+// A maximum of MAX_TEST_EVENT_NUM events can be recorded.
 //
-// since 3rd event is created at notify tpl, 1nd/2rd event at callback
-// EventIndex should be 2 here for the first enter
-

[edk2-devel] [edk2-test] [PATCH 1/1] uefi-sct/SctPkg: fix typo 'Remained test cases'

2019-09-03 Thread Heinrich Schuchardt
%s/Remained/Remaining/g

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Heinrich Schuchardt 
---
 .../SctPkg/TestInfrastructure/SCT/Framework/Execute/Execute.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/uefi-sct/SctPkg/TestInfrastructure/SCT/Framework/Execute/Execute.c 
b/uefi-sct/SctPkg/TestInfrastructure/SCT/Framework/Execute/Execute.c
index 9e7f672e..6fd36914 100644
--- a/uefi-sct/SctPkg/TestInfrastructure/SCT/Framework/Execute/Execute.c
+++ b/uefi-sct/SctPkg/TestInfrastructure/SCT/Framework/Execute/Execute.c
@@ -608,10 +608,10 @@ Routine Description:
   //
   while (TRUE) {
 //
-// Calculate the number of remained cases
+// Calculate the number of remaining test cases
 //
 GetTestCaseRemainNum();
-SctPrint(L"  Remained test cases: %d\n", Remain);
+SctPrint(L"  Remaining test cases: %d\n", Remain);
 
 //
 // Send assertion to remotion computer in passive mode to inform case 
begin.
-- 
2.23.0.rc1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#46706): https://edk2.groups.io/g/devel/message/46706
Mute This Topic: https://groups.io/mt/33124786/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH v3 1/1] ShellPkg/CommandLib: avoid NULL derefence and memory leak

2019-09-02 Thread Heinrich Schuchardt

On 5/10/19 4:32 PM, Carsey, Jaben wrote:

Reviewed-by: Jaben Carsey 

Code change looks good visually.


Somehow this patch

https://edk2.groups.io/g/devel/message/40395

was never merged.

Who is the maintainer for the ShellPkg?

Best regards

Heinrich

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#46664): https://edk2.groups.io/g/devel/message/46664
Mute This Topic: https://groups.io/mt/31573312/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [edk2-test] [PATCH] uefi-sct/SctPkg: StrUpr() test for cyrillic letters

2019-09-02 Thread Heinrich Schuchardt
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1911

The test of StrUpr() of the UnicodeCollationProtocol2 uses the following
test string:

L"\x30\x50[A-D]\x40\x20\x30\x50f\x40\x20"

This string contains the Unicode code point 0x050f (CYRILLIC SMALL LETTER
KOMI TJE). The correct conversion to upper case is 0x050e (CYRILLIC
CAPITAL LETTER KOMI TJE).

The SCT code uses function ToUpper() which is not a part of the SCT code
itself for the verification. As the EDK2 implementation of StrUpr() does
not support upper-casing cyrillic letters it does not convert 0x050f but
leaves it unchanged.

This leads to rejecting the output of UEFI implementations fully supporting
cyrillic letters.

Replace cyrillic 0x50f by 0x50 ('P') to avoid false positives.

Signed-off-by: Heinrich Schuchardt 
---
 .../BlackBoxTest/UnicodeCollation2BBTestFunction.c  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UnicodeCollation2/BlackBoxTest/UnicodeCollation2BBTestFunction.c
 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UnicodeCollation2/BlackBoxTest/UnicodeCollation2BBTestFunction.c
index a8652a5c..653b263a 100644
--- 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UnicodeCollation2/BlackBoxTest/UnicodeCollation2BBTestFunction.c
+++ 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UnicodeCollation2/BlackBoxTest/UnicodeCollation2BBTestFunction.c
@@ -451,7 +451,7 @@ BBTestStrUprFunctionAutoTest (
   CHAR16   *TestData[] ={
  
L"\x21\x22\x31\x32\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4A\x4B\x4C\x4D\x4E\x4F\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5Ax61\x62\x7D\x7E",
  
L"\x30\x50[abcdzyxw!)(@#*]\x40\x20\x30\x50\ab\x40\x20",
- 
L"\x30\x50[A-D]\x40\x20\x30\x50f\x40\x20",
+ 
L"\x30\x50[A-D]\x40\x20\x30\x50\x40\x20",
  L""
 };
 
-- 
2.20.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#46663): https://edk2.groups.io/g/devel/message/46663
Mute This Topic: https://groups.io/mt/33109522/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [edk2-test] [PATCH 1/1] uefi-sct/SctPkg: assertion for UninstallMultipleProtocols

2019-09-02 Thread Heinrich Schuchardt
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1869

BS.UninstallMultipleProtocolInterfaces - InterfaceTestCheckpoint6 expects
UninstallMultipleProtocols() to return EFI_ACCESS_DENIED but the UEFI spec
has:

"If any errors are generated while the protocol interfaces are being
uninstalled, then the protocols uninstalled prior to the error will be
reinstalled with the boot service
EFI_BOOT_SERVICES.InstallProtocolInterface() and the status code
EFI_INVALID_PARAMETER is returned."

So the SCT should check for EFI_INVALID_PARAMETER and not for
EFI_ACCESS_DENIED.

Correct the assertion.

Signed-off-by: Heinrich Schuchardt 
---
 .../BlackBoxTest/ProtocolHandlerBBTestFunction_2.c  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/ProtocolHandlerServices/BlackBoxTest/ProtocolHandlerBBTestFunction_2.c
 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/ProtocolHandlerServices/BlackBoxTest/ProtocolHandlerBBTestFunction_2.c
index c143e558..fe6146b2 100644
--- 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/ProtocolHandlerServices/BlackBoxTest/ProtocolHandlerBBTestFunction_2.c
+++ 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/ProtocolHandlerServices/BlackBoxTest/ProtocolHandlerBBTestFunction_2.c
@@ -12778,7 +12778,7 @@ 
BBTestUninstallMultipleProtocolInterfacesInterfaceTestCheckPoint6 (
 //
 // Step 1: check return status
 //
-if (EFI_ACCESS_DENIED == Status) {
+if (EFI_INVALID_PARAMETER == Status) {
   AssertionType = EFI_TEST_ASSERTION_PASSED;
 } else {
   AssertionType = EFI_TEST_ASSERTION_FAILED;
-- 
2.20.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#46658): https://edk2.groups.io/g/devel/message/46658
Mute This Topic: https://groups.io/mt/33109181/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v3 1/1] ShellPkg/CommandLib: avoid NULL derefence and memory leak

2019-05-09 Thread Heinrich Schuchardt
Since TianoCore EDK2 commit d65f2cea36d1 ("ShellPkg/CommandLib: Locate
proper UnicodeCollation instance") in edk2 the UEFI Shell crashes if EFI
variable PlatformLang is not defined due to dereferencing gUnicodeCollation
gUnicodeCollation (= NULL) in ShellCommandRegisterCommandName().

Furthermore CommandInit() is leaking PlatformLang if
gUnicodeCollation != NULL.

Close the memory leak and use the first UnicodeCollation instance if
PlatfomLang is not defined.

Fixes: d65f2cea36d1 ("ShellPkg/CommandLib: Locate proper UnicodeCollation
instance")
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Heinrich Schuchardt 
Reviewed-by: Zhichao Gao 
---
v3
resend as quoted-printable
---
 .../UefiShellCommandLib/UefiShellCommandLib.c | 20 +--
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c 
b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
index ddc4bb1567..e60279e5ac 100644
--- a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
+++ b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
@@ -80,12 +80,10 @@ CommandInit(
   EFI_STATUS  Status;
   CHAR8   *PlatformLang;
 
-  GetEfiGlobalVariable2 (EFI_PLATFORM_LANG_VARIABLE_NAME, 
(VOID**), NULL);
-  if (PlatformLang == NULL) {
-return EFI_UNSUPPORTED;
-  }
-
   if (gUnicodeCollation == NULL) {
+
+GetEfiGlobalVariable2 (EFI_PLATFORM_LANG_VARIABLE_NAME, 
(VOID**), NULL);
+
 Status = gBS->LocateHandleBuffer (
 ByProtocol,
 ,
@@ -113,6 +111,14 @@ CommandInit(
 continue;
   }
 
+  //
+  // Without clue provided use the first Unicode Collation2 protocol.
+  //
+  if (PlatformLang == NULL) {
+gUnicodeCollation = Uc;
+break;
+  }
+
   //
   // Find the best matching matching language from the supported languages
   // of Unicode Collation2 protocol.
@@ -132,7 +138,9 @@ CommandInit(
 if (Handles != NULL) {
   FreePool (Handles);
 }
-FreePool (PlatformLang);
+if (PlatformLang != NULL) {
+  FreePool (PlatformLang);
+}
   }
 
   return (gUnicodeCollation == NULL) ? EFI_UNSUPPORTED : EFI_SUCCESS;
-- 
2.20.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#40395): https://edk2.groups.io/g/devel/message/40395
Mute This Topic: https://groups.io/mt/31573312/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/1] ShellPkg/CommandLib: avoid NULL derefence and memory leak

2019-04-09 Thread Heinrich Schuchardt
Since TianoCore EDK2 commit d65f2cea36d1 ("ShellPkg/CommandLib: Locate
proper UnicodeCollation instance") in edk2 the UEFI Shell crashes if EFI
variable PlatformLang is not defined due to dereferencing gUnicodeCollation
gUnicodeCollation (= NULL) in ShellCommandRegisterCommandName().

Furthermore CommandInit() is leaking PlatformLang if
gUnicodeCollation != NULL.

Close the memory leak and use the first UnicodeCollation instance if
PlatfomLang is not defined.

Fixes: d65f2cea36d1 ("ShellPkg/CommandLib: Locate proper UnicodeCollation
instance")
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Heinrich Schuchardt 
---
v2
resend with transfer encoding base64
---
 .../UefiShellCommandLib/UefiShellCommandLib.c | 20 +--
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c 
b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
index ddc4bb1567..e60279e5ac 100644
--- a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
+++ b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
@@ -80,12 +80,10 @@ CommandInit(
   EFI_STATUS  Status;
   CHAR8   *PlatformLang;
 
-  GetEfiGlobalVariable2 (EFI_PLATFORM_LANG_VARIABLE_NAME, 
(VOID**), NULL);
-  if (PlatformLang == NULL) {
-return EFI_UNSUPPORTED;
-  }
-
   if (gUnicodeCollation == NULL) {
+
+GetEfiGlobalVariable2 (EFI_PLATFORM_LANG_VARIABLE_NAME, 
(VOID**), NULL);
+
 Status = gBS->LocateHandleBuffer (
 ByProtocol,
 ,
@@ -113,6 +111,14 @@ CommandInit(
 continue;
   }
 
+  //
+  // Without clue provided use the first Unicode Collation2 protocol.
+  //
+  if (PlatformLang == NULL) {
+gUnicodeCollation = Uc;
+break;
+  }
+
   //
   // Find the best matching matching language from the supported languages
   // of Unicode Collation2 protocol.
@@ -132,7 +138,9 @@ CommandInit(
 if (Handles != NULL) {
   FreePool (Handles);
 }
-FreePool (PlatformLang);
+if (PlatformLang != NULL) {
+  FreePool (PlatformLang);
+}
   }
 
   return (gUnicodeCollation == NULL) ? EFI_UNSUPPORTED : EFI_SUCCESS;
-- 
2.20.1



Re: [edk2-devel] [PATCH 1/1] ShellPkg/CommandLib: avoid NULL derefence and memory leak

2019-04-09 Thread Heinrich Schuchardt
On 4/9/19 7:33 AM, Gao, Zhichao wrote:
> The patch code looks good to me.
> But while I apply this patch, it will shows "error: corrupt patch at line 24" 
> and " error: could not build fake ancestor". Maybe you direct change the 
> patch file and remove some blank lines.
> For Uefi BdsDxe driver, the variable "PlatfomLang" would be initialize all 
> the time. But maybe other manufacturers may have their own Bds solution and 
> do not set this variable. This patch makes the Shell app more compatible.
>
> Without the patch warning.
> Reviewed-by: Zhichao Gao 

Hello Zhichao,

I am not able to reproduce the problem. I resend you the patch as
attachment.

When applying I had to use --keep-cr:

git am --keep-cr \
../patch/0001-ShellPkg-CommandLib-avoid-NULL-derefence-and-memory-.patch

I have found no way neither on Windows nor on Linux to create a patch
that applies without --keep-cr.

If you still have a problem, please, send me your global and local
gitconfig files, your .gitattributes and indicate on which operating
system you are working with which git version.

Best regards

Heinrich

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#38742): https://edk2.groups.io/g/devel/message/38742
Mute This Topic: https://groups.io/mt/30920004/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

From 9478bbcd1d8a03762924a0b4533c1b84cbfcaa57 Mon Sep 17 00:00:00 2001
From: Heinrich Schuchardt 
Date: Fri, 5 Apr 2019 03:06:18 +0200
Subject: [PATCH 1/1] ShellPkg/CommandLib: avoid NULL derefence and memory leak

Since TianoCore EDK2 commit d65f2cea36d1 ("ShellPkg/CommandLib: Locate
proper UnicodeCollation instance") in edk2 the UEFI Shell crashes if EFI
variable PlatformLang is not defined due to dereferencing gUnicodeCollation
gUnicodeCollation (= NULL) in ShellCommandRegisterCommandName().

Furthermore CommandInit() is leaking PlatformLang if
gUnicodeCollation != NULL.

Close the memory leak and use the first UnicodeCollation instance if
PlatfomLang is not defined.

Fixes: d65f2cea36d1 ("ShellPkg/CommandLib: Locate proper UnicodeCollation
instance")
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Heinrich Schuchardt 
---
 .../UefiShellCommandLib/UefiShellCommandLib.c | 20 +--
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
index ddc4bb1567..e60279e5ac 100644
--- a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
+++ b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
@@ -80,12 +80,10 @@ CommandInit(
   EFI_STATUS  Status;
   CHAR8   *PlatformLang;
 
-  GetEfiGlobalVariable2 (EFI_PLATFORM_LANG_VARIABLE_NAME, (VOID**), NULL);
-  if (PlatformLang == NULL) {
-return EFI_UNSUPPORTED;
-  }
-
   if (gUnicodeCollation == NULL) {
+
+GetEfiGlobalVariable2 (EFI_PLATFORM_LANG_VARIABLE_NAME, (VOID**), NULL);
+
 Status = gBS->LocateHandleBuffer (
 ByProtocol,
 ,
@@ -113,6 +111,14 @@ CommandInit(
 continue;
   }
 
+  //
+  // Without clue provided use the first Unicode Collation2 protocol.
+  //
+  if (PlatformLang == NULL) {
+gUnicodeCollation = Uc;
+break;
+  }
+
   //
   // Find the best matching matching language from the supported languages
   // of Unicode Collation2 protocol.
@@ -132,7 +138,9 @@ CommandInit(
 if (Handles != NULL) {
   FreePool (Handles);
 }
-FreePool (PlatformLang);
+if (PlatformLang != NULL) {
+  FreePool (PlatformLang);
+}
   }
 
   return (gUnicodeCollation == NULL) ? EFI_UNSUPPORTED : EFI_SUCCESS;
-- 
2.20.1



[edk2-devel] [PATCH 1/1] ShellPkg/CommandLib: avoid NULL derefence and memory leak

2019-04-04 Thread Heinrich Schuchardt
Since TianoCore EDK2 commit d65f2cea36d1 ("ShellPkg/CommandLib: Locate
proper UnicodeCollation instance") in edk2 the UEFI Shell crashes if EFI
variable PlatformLang is not defined due to dereferencing gUnicodeCollation
gUnicodeCollation (= NULL) in ShellCommandRegisterCommandName().

Furthermore CommandInit() is leaking PlatformLang if
gUnicodeCollation != NULL.

Close the memory leak and use the first UnicodeCollation instance if
PlatfomLang is not defined.

Fixes: d65f2cea36d1 ("ShellPkg/CommandLib: Locate proper UnicodeCollation
instance")
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Heinrich Schuchardt 
---
 .../UefiShellCommandLib/UefiShellCommandLib.c | 20 +--
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c 
b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
index ddc4bb1567..e60279e5ac 100644
--- a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
+++ b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
@@ -80,12 +80,10 @@ CommandInit(
   EFI_STATUS  Status;
   CHAR8   *PlatformLang;

-  GetEfiGlobalVariable2 (EFI_PLATFORM_LANG_VARIABLE_NAME, 
(VOID**), NULL);
-  if (PlatformLang == NULL) {
-return EFI_UNSUPPORTED;
-  }
-
   if (gUnicodeCollation == NULL) {
+
+GetEfiGlobalVariable2 (EFI_PLATFORM_LANG_VARIABLE_NAME, 
(VOID**), NULL);
+
 Status = gBS->LocateHandleBuffer (
 ByProtocol,
 ,
@@ -113,6 +111,14 @@ CommandInit(
 continue;
   }

+  //
+  // Without clue provided use the first Unicode Collation2 protocol.
+  //
+  if (PlatformLang == NULL) {
+gUnicodeCollation = Uc;
+break;
+  }
+
   //
   // Find the best matching matching language from the supported languages
   // of Unicode Collation2 protocol.
@@ -132,7 +138,9 @@ CommandInit(
 if (Handles != NULL) {
   FreePool (Handles);
 }
-FreePool (PlatformLang);
+if (PlatformLang != NULL) {
+  FreePool (PlatformLang);
+}
   }

   return (gUnicodeCollation == NULL) ? EFI_UNSUPPORTED : EFI_SUCCESS;
--
2.20.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#38597): https://edk2.groups.io/g/devel/message/38597
Mute This Topic: https://groups.io/mt/30920004/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-