Date   

[PATCH 3/3] ARM/Assembler: Reuse RVCT assembler for MSFT build

Baptiste Gerondeau
 

From: Baptiste GERONDEAU <bgerondeau@gmail.com>

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1750"

Since RVCT shares the same assembler syntax as MSFT, use .asm files
and associate them with MSFT, which would be a first step to addressing
the above Bugzilla issue.
RVCT will also have to be erased from BaseTools/rest of the build
infrastructure, to fully address BZ#1750 ; this patch only addresses the
"code" in itself.

Signed-off-by: Baptiste Gerondeau <baptiste.gerondeau@linaro.org>
---
ArmPkg/Drivers/ArmGic/ArmGicLib.inf | 2 =
+-
ArmPkg/Library/ArmExceptionLib/ArmExceptionLib.inf | 2 =
+-
ArmPkg/Library/ArmExceptionLib/ArmRelocateExceptionLib.inf | 2 =
+-
ArmPkg/Library/ArmHvcLib/ArmHvcLib.inf | 2 =
+-
ArmPkg/Library/ArmLib/ArmBaseLib.inf | 8 =
++++----
ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf | 2 =
+-
ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf | 2 =
+-
ArmPkg/Library/ArmSmcPsciResetSystemLib/ArmSmcPsciResetSystemLib.inf | 2 =
+-
ArmPkg/Library/ArmSvcLib/ArmSvcLib.inf | 2 =
+-
ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNull.inf | 2 =
+-
ArmPlatformPkg/Library/ArmPlatformStackLib/ArmPlatformStackLib.inf | 2 =
+-
ArmPlatformPkg/PrePeiCore/PrePeiCoreMPCore.inf | 6 =
+++---
ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf | 6 =
+++---
ArmPlatformPkg/PrePi/PeiMPCore.inf | 2 =
+-
ArmPlatformPkg/PrePi/PeiUniCore.inf | 2 =
+-
MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicArmVirt.inf | 2 =
+-
MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.inf | 10 =
+++++-----
MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf | 2 =
+-
18 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/ArmPkg/Drivers/ArmGic/ArmGicLib.inf b/ArmPkg/Drivers/ArmGic/Ar=
mGicLib.inf
index 5e23c732bfab..4fccb938eb6d 100644
--- a/ArmPkg/Drivers/ArmGic/ArmGicLib.inf
+++ b/ArmPkg/Drivers/ArmGic/ArmGicLib.inf
@@ -22,7 +22,7 @@ [Sources]
=0D
[Sources.ARM]=0D
GicV3/Arm/ArmGicV3.S | GCC=0D
- GicV3/Arm/ArmGicV3.asm | RVCT=0D
+ GicV3/Arm/ArmGicV3.asm | MSFT=0D
=0D
[Sources.AARCH64]=0D
GicV3/AArch64/ArmGicV3.S=0D
diff --git a/ArmPkg/Library/ArmExceptionLib/ArmExceptionLib.inf b/ArmPkg/Li=
brary/ArmExceptionLib/ArmExceptionLib.inf
index fdb9c24d21bc..58b2ddbff858 100644
--- a/ArmPkg/Library/ArmExceptionLib/ArmExceptionLib.inf
+++ b/ArmPkg/Library/ArmExceptionLib/ArmExceptionLib.inf
@@ -33,7 +33,7 @@ [Sources.common]
=0D
[Sources.Arm]=0D
Arm/ArmException.c=0D
- Arm/ExceptionSupport.asm | RVCT=0D
+ Arm/ExceptionSupport.asm | MSFT=0D
Arm/ExceptionSupport.S | GCC=0D
=0D
[Sources.AARCH64]=0D
diff --git a/ArmPkg/Library/ArmExceptionLib/ArmRelocateExceptionLib.inf b/A=
rmPkg/Library/ArmExceptionLib/ArmRelocateExceptionLib.inf
index ef1a43a27c45..a404ca2ccf82 100644
--- a/ArmPkg/Library/ArmExceptionLib/ArmRelocateExceptionLib.inf
+++ b/ArmPkg/Library/ArmExceptionLib/ArmRelocateExceptionLib.inf
@@ -28,7 +28,7 @@ [Sources.common]
=0D
[Sources.Arm]=0D
Arm/ArmException.c=0D
- Arm/ExceptionSupport.asm | RVCT=0D
+ Arm/ExceptionSupport.asm | MSFT=0D
Arm/ExceptionSupport.S | GCC=0D
=0D
[Sources.AARCH64]=0D
diff --git a/ArmPkg/Library/ArmHvcLib/ArmHvcLib.inf b/ArmPkg/Library/ArmHvc=
Lib/ArmHvcLib.inf
index 69f68f63d7a6..be8d8a228865 100644
--- a/ArmPkg/Library/ArmHvcLib/ArmHvcLib.inf
+++ b/ArmPkg/Library/ArmHvcLib/ArmHvcLib.inf
@@ -15,7 +15,7 @@ [Defines]
LIBRARY_CLASS =3D ArmHvcLib=0D
=0D
[Sources.ARM]=0D
- Arm/ArmHvc.asm | RVCT=0D
+ Arm/ArmHvc.asm | MSFT=0D
Arm/ArmHvc.S | GCC=0D
=0D
[Sources.AARCH64]=0D
diff --git a/ArmPkg/Library/ArmLib/ArmBaseLib.inf b/ArmPkg/Library/ArmLib/A=
rmBaseLib.inf
index 5e70990872f2..63e175623393 100644
--- a/ArmPkg/Library/ArmLib/ArmBaseLib.inf
+++ b/ArmPkg/Library/ArmLib/ArmBaseLib.inf
@@ -30,10 +30,10 @@ [Sources.ARM]
Arm/ArmV7Support.S | GCC=0D
Arm/ArmV7ArchTimerSupport.S | GCC=0D
=0D
- Arm/ArmLibSupport.asm | RVCT=0D
- Arm/ArmLibSupportV7.asm | RVCT=0D
- Arm/ArmV7Support.asm | RVCT=0D
- Arm/ArmV7ArchTimerSupport.asm | RVCT=0D
+ Arm/ArmLibSupport.asm | MSFT=0D
+ Arm/ArmLibSupportV7.asm | MSFT=0D
+ Arm/ArmV7Support.asm | MSFT=0D
+ Arm/ArmV7ArchTimerSupport.asm | MSFT=0D
=0D
[Sources.AARCH64]=0D
AArch64/AArch64Lib.h=0D
diff --git a/ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf b/ArmPkg/Library/Ar=
mMmuLib/ArmMmuBaseLib.inf
index 33dddf1e2b97..44366f02c6d9 100644
--- a/ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf
+++ b/ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf
@@ -23,7 +23,7 @@ [Sources.AARCH64]
[Sources.ARM]=0D
Arm/ArmMmuLibCore.c=0D
Arm/ArmMmuLibV7Support.S | GCC=0D
- Arm/ArmMmuLibV7Support.asm |RVCT =0D
+ Arm/ArmMmuLibV7Support.asm | MSFT=0D
=0D
[Packages]=0D
ArmPkg/ArmPkg.dec=0D
diff --git a/ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf b/ArmPkg/Library/ArmSmc=
Lib/ArmSmcLib.inf
index 4f4b09f4528a..af8c0e53cc2b 100644
--- a/ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf
+++ b/ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf
@@ -14,7 +14,7 @@ [Defines]
LIBRARY_CLASS =3D ArmSmcLib=0D
=0D
[Sources.ARM]=0D
- Arm/ArmSmc.asm | RVCT=0D
+ Arm/ArmSmc.asm | MSFT=0D
Arm/ArmSmc.S | GCC=0D
=0D
[Sources.AARCH64]=0D
diff --git a/ArmPkg/Library/ArmSmcPsciResetSystemLib/ArmSmcPsciResetSystemL=
ib.inf b/ArmPkg/Library/ArmSmcPsciResetSystemLib/ArmSmcPsciResetSystemLib.i=
nf
index fa19bf649131..f4c9e5510b9a 100644
--- a/ArmPkg/Library/ArmSmcPsciResetSystemLib/ArmSmcPsciResetSystemLib.inf
+++ b/ArmPkg/Library/ArmSmcPsciResetSystemLib/ArmSmcPsciResetSystemLib.inf
@@ -21,7 +21,7 @@ [Sources.AARCH64]
=0D
[Sources.ARM]=0D
Arm/Reset.S | GCC=0D
- Arm/Reset.asm | RVCT=0D
+ Arm/Reset.asm | MSFT=0D
=0D
[Sources]=0D
ArmSmcPsciResetSystemLib.c=0D
diff --git a/ArmPkg/Library/ArmSvcLib/ArmSvcLib.inf b/ArmPkg/Library/ArmSvc=
Lib/ArmSvcLib.inf
index 744a29fbf723..6631e40df130 100644
--- a/ArmPkg/Library/ArmSvcLib/ArmSvcLib.inf
+++ b/ArmPkg/Library/ArmSvcLib/ArmSvcLib.inf
@@ -14,7 +14,7 @@ [Defines]
LIBRARY_CLASS =3D ArmSvcLib=0D
=0D
[Sources.ARM]=0D
- Arm/ArmSvc.asm | RVCT=0D
+ Arm/ArmSvc.asm | MSFT=0D
Arm/ArmSvc.S | GCC=0D
=0D
[Sources.AARCH64]=0D
diff --git a/ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNull.i=
nf b/ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNull.inf
index e0d0028d8224..cc791a3a68fd 100644
--- a/ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNull.inf
+++ b/ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNull.inf
@@ -29,7 +29,7 @@ [Sources.common]
=0D
[Sources.Arm]=0D
Arm/ArmPlatformHelper.S | GCC=0D
- Arm/ArmPlatformHelper.asm | RVCT=0D
+ Arm/ArmPlatformHelper.asm | MSFT=0D
=0D
[Sources.AArch64]=0D
AArch64/ArmPlatformHelper.S=0D
diff --git a/ArmPlatformPkg/Library/ArmPlatformStackLib/ArmPlatformStackLib=
.inf b/ArmPlatformPkg/Library/ArmPlatformStackLib/ArmPlatformStackLib.inf
index 76f809c80d9f..e88330c1c382 100644
--- a/ArmPlatformPkg/Library/ArmPlatformStackLib/ArmPlatformStackLib.inf
+++ b/ArmPlatformPkg/Library/ArmPlatformStackLib/ArmPlatformStackLib.inf
@@ -21,7 +21,7 @@ [Packages]
ArmPlatformPkg/ArmPlatformPkg.dec=0D
=0D
[Sources.ARM]=0D
- Arm/ArmPlatformStackLib.asm | RVCT=0D
+ Arm/ArmPlatformStackLib.asm | MSFT=0D
Arm/ArmPlatformStackLib.S | GCC=0D
=0D
[Sources.AARCH64]=0D
diff --git a/ArmPlatformPkg/PrePeiCore/PrePeiCoreMPCore.inf b/ArmPlatformPk=
g/PrePeiCore/PrePeiCoreMPCore.inf
index f2ac45d171bc..b663ff749182 100644
--- a/ArmPlatformPkg/PrePeiCore/PrePeiCoreMPCore.inf
+++ b/ArmPlatformPkg/PrePeiCore/PrePeiCoreMPCore.inf
@@ -21,11 +21,11 @@ [Sources.common]
=0D
[Sources.ARM]=0D
Arm/ArchPrePeiCore.c=0D
- Arm/PrePeiCoreEntryPoint.asm | RVCT=0D
+ Arm/PrePeiCoreEntryPoint.asm | MSFT=0D
Arm/PrePeiCoreEntryPoint.S | GCC=0D
- Arm/SwitchStack.asm | RVCT=0D
+ Arm/SwitchStack.asm | MSFT=0D
Arm/SwitchStack.S | GCC=0D
- Arm/Exception.asm | RVCT=0D
+ Arm/Exception.asm | MSFT=0D
Arm/Exception.S | GCC=0D
=0D
[Sources.AARCH64]=0D
diff --git a/ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf b/ArmPlatformP=
kg/PrePeiCore/PrePeiCoreUniCore.inf
index 84c319c3679b..6d05ed096c4c 100644
--- a/ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf
+++ b/ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf
@@ -21,11 +21,11 @@ [Sources.common]
=0D
[Sources.ARM]=0D
Arm/ArchPrePeiCore.c=0D
- Arm/PrePeiCoreEntryPoint.asm | RVCT=0D
+ Arm/PrePeiCoreEntryPoint.asm | MSFT=0D
Arm/PrePeiCoreEntryPoint.S | GCC=0D
- Arm/SwitchStack.asm | RVCT=0D
+ Arm/SwitchStack.asm | MSFT=0D
Arm/SwitchStack.S | GCC=0D
- Arm/Exception.asm | RVCT=0D
+ Arm/Exception.asm | MSFT=0D
Arm/Exception.S | GCC=0D
=0D
[Sources.AARCH64]=0D
diff --git a/ArmPlatformPkg/PrePi/PeiMPCore.inf b/ArmPlatformPkg/PrePi/PeiM=
PCore.inf
index 9c5da0d42a7b..fd2a35e59591 100644
--- a/ArmPlatformPkg/PrePi/PeiMPCore.inf
+++ b/ArmPlatformPkg/PrePi/PeiMPCore.inf
@@ -22,7 +22,7 @@ [Sources]
[Sources.ARM]=0D
Arm/ArchPrePi.c=0D
Arm/ModuleEntryPoint.S | GCC=0D
- Arm/ModuleEntryPoint.asm | RVCT=0D
+ Arm/ModuleEntryPoint.asm | MSFT=0D
=0D
[Sources.AArch64]=0D
AArch64/ArchPrePi.c=0D
diff --git a/ArmPlatformPkg/PrePi/PeiUniCore.inf b/ArmPlatformPkg/PrePi/Pei=
UniCore.inf
index ee9b05b25337..de3abadfeac6 100644
--- a/ArmPlatformPkg/PrePi/PeiUniCore.inf
+++ b/ArmPlatformPkg/PrePi/PeiUniCore.inf
@@ -22,7 +22,7 @@ [Sources]
[Sources.ARM]=0D
Arm/ArchPrePi.c=0D
Arm/ModuleEntryPoint.S | GCC=0D
- Arm/ModuleEntryPoint.asm | RVCT=0D
+ Arm/ModuleEntryPoint.asm | MSFT=0D
=0D
[Sources.AArch64]=0D
AArch64/ArchPrePi.c=0D
diff --git a/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicArmVirt.in=
f b/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicArmVirt.inf
index ad68f841fb6b..62b46377116c 100644
--- a/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicArmVirt.inf
+++ b/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicArmVirt.inf
@@ -31,7 +31,7 @@ [Sources]
[Sources.ARM]=0D
IoLibArmVirt.c=0D
Arm/ArmVirtMmio.S | GCC=0D
- Arm/ArmVirtMmio.asm | RVCT=0D
+ Arm/ArmVirtMmio.asm | MSFT=0D
=0D
[Sources.AARCH64]=0D
IoLibArmVirt.c=0D
diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.inf b/M=
dePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.inf
index d38e1397eee1..79ba2a2dfc39 100644
--- a/MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.inf
+++ b/MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.inf
@@ -85,11 +85,11 @@ [Sources.ARM]
Arm/CompareMem.S | GCC=0D
Arm/CompareGuid.S | GCC=0D
=0D
- Arm/ScanMem.asm |RVCT=0D
- Arm/SetMem.asm |RVCT=0D
- Arm/CopyMem.asm |RVCT=0D
- Arm/CompareMem.asm |RVCT=0D
- Arm/CompareGuid.asm |RVCT=0D
+ Arm/ScanMem.asm | MSFT=0D
+ Arm/SetMem.asm | MSFT=0D
+ Arm/CopyMem.asm | MSFT=0D
+ Arm/CompareMem.asm | MSFT=0D
+ Arm/CompareGuid.asm | MSFT=0D
=0D
[Sources.AARCH64]=0D
AArch64/ScanMem.S=0D
diff --git a/MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.i=
nf b/MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
index 446bc19b63eb..39c503a28a2c 100755
--- a/MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
+++ b/MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
@@ -70,7 +70,7 @@ [Sources.EBC]
=0D
[Sources.ARM]=0D
Synchronization.c=0D
- Arm/Synchronization.asm | RVCT=0D
+ Arm/Synchronization.asm | MSFT=0D
Arm/Synchronization.S | GCC=0D
=0D
[Sources.AARCH64]=0D
--=20
2.23.0


[PATCH 2/3] ARM/Assembler: Correct syntax from RVCT for MSFT

Baptiste Gerondeau
 

From: Baptiste GERONDEAU <bgerondeau@gmail.com>

RVCT and MSFT's ARM assembler share the same file syntax, but some
instructions use pre-UAL syntax that is not picked up
by MSFT's ARM assembler, this commit translates those instructions
into MSFT-buildable ones (subset of UAL/THUMB).

Signed-off-by: Baptiste Gerondeau <baptiste.gerondeau@linaro.org>
---
ArmPkg/Library/ArmExceptionLib/Arm/ExceptionSupport.asm | 30 +++++++++++++=
++++-------------
ArmPkg/Library/ArmLib/Arm/ArmV7Support.asm | 6 ++++--
MdePkg/Library/BaseIoLibIntrinsic/Arm/ArmVirtMmio.asm | 18 +++++++++----=
-----
3 files changed, 30 insertions(+), 24 deletions(-)

diff --git a/ArmPkg/Library/ArmExceptionLib/Arm/ExceptionSupport.asm b/ArmP=
kg/Library/ArmExceptionLib/Arm/ExceptionSupport.asm
index aa0229d2e85f..880246bd6206 100644
--- a/ArmPkg/Library/ArmExceptionLib/Arm/ExceptionSupport.asm
+++ b/ArmPkg/Library/ArmExceptionLib/Arm/ExceptionSupport.asm
@@ -90,7 +90,7 @@ Fiq
ResetEntry=0D
srsfd #0x13! ; Store return state on SVC stack=0D
; We are already in SVC mode=0D
- stmfd SP!,{LR} ; Store the link register for the cu=
rrent mode=0D
+ push {LR} ; Store the link register for the cu=
rrent mode=0D
sub SP,SP,#0x20 ; Save space for SP, LR, PC, IFAR - =
CPSR=0D
stmfd SP!,{R0-R12} ; Store the register state=0D
=0D
@@ -102,7 +102,7 @@ UndefinedInstructionEntry
sub LR, LR, #4 ; Only -2 for Thumb, adjust in Commo=
nExceptionEntry=0D
srsfd #0x13! ; Store return state on SVC stack=0D
cps #0x13 ; Switch to SVC for common stack=0D
- stmfd SP!,{LR} ; Store the link register for the cu=
rrent mode=0D
+ push {LR} ; Store the link register for the cu=
rrent mode=0D
sub SP,SP,#0x20 ; Save space for SP, LR, PC, IFAR - =
CPSR=0D
stmfd SP!,{R0-R12} ; Store the register state=0D
=0D
@@ -113,7 +113,7 @@ UndefinedInstructionEntry
SoftwareInterruptEntry=0D
srsfd #0x13! ; Store return state on SVC stack=0D
; We are already in SVC mode=0D
- stmfd SP!,{LR} ; Store the link register for the cu=
rrent mode=0D
+ push {LR} ; Store the link register for the cu=
rrent mode=0D
sub SP,SP,#0x20 ; Save space for SP, LR, PC, IFAR - =
CPSR=0D
stmfd SP!,{R0-R12} ; Store the register state=0D
=0D
@@ -125,7 +125,7 @@ PrefetchAbortEntry
sub LR,LR,#4=0D
srsfd #0x13! ; Store return state on SVC stack=0D
cps #0x13 ; Switch to SVC for common stack=0D
- stmfd SP!,{LR} ; Store the link register for the cu=
rrent mode=0D
+ push {LR} ; Store the link register for the cu=
rrent mode=0D
sub SP,SP,#0x20 ; Save space for SP, LR, PC, IFAR - =
CPSR=0D
stmfd SP!,{R0-R12} ; Store the register state=0D
=0D
@@ -137,7 +137,7 @@ DataAbortEntry
sub LR,LR,#8=0D
srsfd #0x13! ; Store return state on SVC stack=0D
cps #0x13 ; Switch to SVC for common stack=0D
- stmfd SP!,{LR} ; Store the link register for the cu=
rrent mode=0D
+ push {LR} ; Store the link register for the cu=
rrent mode=0D
sub SP,SP,#0x20 ; Save space for SP, LR, PC, IFAR - =
CPSR=0D
stmfd SP!,{R0-R12} ; Store the register state=0D
=0D
@@ -148,7 +148,7 @@ DataAbortEntry
ReservedExceptionEntry=0D
srsfd #0x13! ; Store return state on SVC stack=0D
cps #0x13 ; Switch to SVC for common stack=0D
- stmfd SP!,{LR} ; Store the link register for the cu=
rrent mode=0D
+ push {LR} ; Store the link register for the cu=
rrent mode=0D
sub SP,SP,#0x20 ; Save space for SP, LR, PC, IFAR - =
CPSR=0D
stmfd SP!,{R0-R12} ; Store the register state=0D
=0D
@@ -160,7 +160,7 @@ IrqEntry
sub LR,LR,#4=0D
srsfd #0x13! ; Store return state on SVC stack=0D
cps #0x13 ; Switch to SVC for common stack=0D
- stmfd SP!,{LR} ; Store the link register for the cu=
rrent mode=0D
+ push {LR} ; Store the link register for the cu=
rrent mode=0D
sub SP,SP,#0x20 ; Save space for SP, LR, PC, IFAR - =
CPSR=0D
stmfd SP!,{R0-R12} ; Store the register state=0D
=0D
@@ -172,7 +172,7 @@ FiqEntry
sub LR,LR,#4=0D
srsfd #0x13! ; Store return state on SVC stack=0D
cps #0x13 ; Switch to SVC for common stack=0D
- stmfd SP!,{LR} ; Store the link register for the cu=
rrent mode=0D
+ push {LR} ; Store the link register for the cu=
rrent mode=0D
sub SP,SP,#0x20 ; Save space for SP, LR, PC, IFAR - =
CPSR=0D
stmfd SP!,{R0-R12} ; Store the register state=0D
; Since we have already switch to SV=
C R8_fiq - R12_fiq=0D
@@ -213,9 +213,11 @@ AsmCommonExceptionEntry
and R3, R1, #0x1f ; Check CPSR to see if User or System =
Mode=0D
cmp R3, #0x1f ; if ((CPSR =3D=3D 0x10) || (CPSR =3D=
=3D 0x1f))=0D
cmpne R3, #0x10 ;=0D
- stmeqed R2, {lr}^ ; save unbanked lr=0D
+ mrseq R8, lr_usr ; save unbanked lr to R8=0D
+ streq R2, [R8] ; make R2 point to R8=0D
; else=0D
- stmneed R2, {lr} ; save SVC lr=0D
+ mrsne R8, lr_svc ; save SVC lr to R8=0D
+ strne R2, [R8] ; make R2 point to R8=0D
=0D
=0D
ldr R5, [SP, #0x58] ; PC is the LR pushed by srsfd=0D
@@ -280,15 +282,17 @@ CommonCExceptionHandler (
and R1, R1, #0x1f ; Check to see if User or System Mode=
=0D
cmp R1, #0x1f ; if ((CPSR =3D=3D 0x10) || (CPSR =3D=
=3D 0x1f))=0D
cmpne R1, #0x10 ;=0D
- ldmeqed R2, {lr}^ ; restore unbanked lr=0D
+ ldreq R8, [R2] ; load sys/usr lr from R2 pointer=0D
+ msreq lr_usr, R8 ; restore unbanked lr=0D
; else=0D
- ldmneed R3, {lr} ; restore SVC lr, via ldmfd SP!, {LR=
}=0D
+ ldrne R8, [R3] ; load SVC lr from R3 pointer=0D
+ msrne lr_svc, R8 ; restore SVC lr, via ldmfd SP!, {LR=
}=0D
=0D
ldmfd SP!,{R0-R12} ; Restore general purpose registers=0D
; Exception handler can not change SP=
=0D
=0D
add SP,SP,#0x20 ; Clear out the remaining stack space=
=0D
- ldmfd SP!,{LR} ; restore the link register for this c=
ontext=0D
+ pop {LR} ; restore the link register for this c=
ontext=0D
rfefd SP! ; return from exception via srsfd stac=
k slot=0D
=0D
END=0D
diff --git a/ArmPkg/Library/ArmLib/Arm/ArmV7Support.asm b/ArmPkg/Library/Ar=
mLib/Arm/ArmV7Support.asm
index 3146c2b52181..724306399e6c 100644
--- a/ArmPkg/Library/ArmLib/Arm/ArmV7Support.asm
+++ b/ArmPkg/Library/ArmLib/Arm/ArmV7Support.asm
@@ -200,8 +200,10 @@ Loop2
mov R9, R4 ; R9 working copy of the max way size (rig=
ht aligned)=0D
=0D
Loop3=0D
- orr R0, R10, R9, LSL R5 ; factor in the way number and cache numbe=
r into R11=0D
- orr R0, R0, R7, LSL R2 ; factor in the index number=0D
+ lsl R8, R9, R5=0D
+ orr R0, R10, R8 ; factor in the way number and cache numbe=
r=0D
+ lsl R8, R7, R2=0D
+ orr R0, R0, R8 ; factor in the index number=0D
=0D
blx R1=0D
=0D
diff --git a/MdePkg/Library/BaseIoLibIntrinsic/Arm/ArmVirtMmio.asm b/MdePkg=
/Library/BaseIoLibIntrinsic/Arm/ArmVirtMmio.asm
index 5a423df16bff..a46d70e41433 100644
--- a/MdePkg/Library/BaseIoLibIntrinsic/Arm/ArmVirtMmio.asm
+++ b/MdePkg/Library/BaseIoLibIntrinsic/Arm/ArmVirtMmio.asm
@@ -5,16 +5,16 @@
;=0D
=0D
=0D
-AREA IoLibMmio, CODE, READONLY=0D
+ AREA IoLibMmio, CODE, READONLY=0D
=0D
-EXPORT MmioRead8Internal=0D
-EXPORT MmioWrite8Internal=0D
-EXPORT MmioRead16Internal=0D
-EXPORT MmioWrite16Internal=0D
-EXPORT MmioRead32Internal=0D
-EXPORT MmioWrite32Internal=0D
-EXPORT MmioRead64Internal=0D
-EXPORT MmioWrite64Internal=0D
+ EXPORT MmioRead8Internal=0D
+ EXPORT MmioWrite8Internal=0D
+ EXPORT MmioRead16Internal=0D
+ EXPORT MmioWrite16Internal=0D
+ EXPORT MmioRead32Internal=0D
+ EXPORT MmioWrite32Internal=0D
+ EXPORT MmioRead64Internal=0D
+ EXPORT MmioWrite64Internal=0D
=0D
;=0D
; Reads an 8-bit MMIO register.=0D
--=20
2.23.0


[PATCH 1/3] ArmPkg/MdePkg : Unify INF files format

Baptiste Gerondeau
 

From: Baptiste GERONDEAU <bgerondeau@gmail.com>

Add a space between the '|' and the name of the toolchain to use,
as is the case in all other INF files.
Note that I did not touch the RVCT lines, since a following commit in
the set will address those.

Signed-off-by: Baptiste Gerondeau <baptiste.gerondeau@linaro.org>
---
ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf | 2 +-
MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.inf | 10 +++++-----
2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf b/ArmPkg/Library/Ar=
mMmuLib/ArmMmuBaseLib.inf
index f4fecbb4098a..33dddf1e2b97 100644
--- a/ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf
+++ b/ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf
@@ -22,7 +22,7 @@ [Sources.AARCH64]
=0D
[Sources.ARM]=0D
Arm/ArmMmuLibCore.c=0D
- Arm/ArmMmuLibV7Support.S |GCC =0D
+ Arm/ArmMmuLibV7Support.S | GCC=0D
Arm/ArmMmuLibV7Support.asm |RVCT =0D
=0D
[Packages]=0D
diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.inf b/M=
dePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.inf
index e4e3d532e7b8..d38e1397eee1 100644
--- a/MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.inf
+++ b/MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.inf
@@ -79,11 +79,11 @@ [Defines.ARM, Defines.AARCH64]
LIBRARY_CLASS =3D BaseMemoryLib|DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER U=
EFI_DRIVER UEFI_APPLICATION=0D
=0D
[Sources.ARM]=0D
- Arm/ScanMem.S |GCC=0D
- Arm/SetMem.S |GCC=0D
- Arm/CopyMem.S |GCC=0D
- Arm/CompareMem.S |GCC=0D
- Arm/CompareGuid.S |GCC=0D
+ Arm/ScanMem.S | GCC=0D
+ Arm/SetMem.S | GCC=0D
+ Arm/CopyMem.S | GCC=0D
+ Arm/CompareMem.S | GCC=0D
+ Arm/CompareGuid.S | GCC=0D
=0D
Arm/ScanMem.asm |RVCT=0D
Arm/SetMem.asm |RVCT=0D
--=20
2.23.0


[PATCH 0/3] Arm builds on Visual Studio

Baptiste Gerondeau
 

We are currently making an effort to make ARM (and AARCH64 eventually)
builds using Microsoft's Visual Studio Compiler (aka MSVC/MSFT).

These 3 patches correspond to an effort to make the assembler work with
MSFT, which entails :
- Feeding MSFT the RVCT .asm files, since they share syntax
requirements.
- Fixing some instructions syntax in those .asm files, in order to make
them palatable for MSFT.
- Fixing some minor formatting issue in INF files, while we're at it.

This set enables the assembler, meanwhile the C also require changes,
which will come in a set later. This set makes the RVCT toolchain family
and profiles obsolete, unblocking :
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1750

As mentioned in the above bug, dropping RVCT would entail orphanating
the .asm files that powered the RVCT build. Since Visual Studio uses the
same file syntax, those can be reused to power the VS build.

These patches have been tested on VS2019 (v15.9.11) and VS2017 (v16.0.1)

Baptiste GERONDEAU (3):
ArmPkg/MdePkg : Unify INF files format
ARM/Assembler: Correct syntax from RVCT for MSFT
ARM/Assembler: Reuse RVCT assembler for MSFT build

ArmPkg/Drivers/ArmGic/ArmGicLib.inf | 2 +-
ArmPkg/Library/ArmExceptionLib/Arm/ExceptionSupport.asm | 30 +++++++++++++++++-------------
ArmPkg/Library/ArmExceptionLib/ArmExceptionLib.inf | 2 +-
ArmPkg/Library/ArmExceptionLib/ArmRelocateExceptionLib.inf | 2 +-
ArmPkg/Library/ArmHvcLib/ArmHvcLib.inf | 2 +-
ArmPkg/Library/ArmLib/Arm/ArmV7Support.asm | 6 ++++--
ArmPkg/Library/ArmLib/ArmBaseLib.inf | 8 ++++----
ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf | 4 ++--
ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf | 2 +-
ArmPkg/Library/ArmSmcPsciResetSystemLib/ArmSmcPsciResetSystemLib.inf | 2 +-
ArmPkg/Library/ArmSvcLib/ArmSvcLib.inf | 2 +-
ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNull.inf | 2 +-
ArmPlatformPkg/Library/ArmPlatformStackLib/ArmPlatformStackLib.inf | 2 +-
ArmPlatformPkg/PrePeiCore/PrePeiCoreMPCore.inf | 6 +++---
ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf | 6 +++---
ArmPlatformPkg/PrePi/PeiMPCore.inf | 2 +-
ArmPlatformPkg/PrePi/PeiUniCore.inf | 2 +-
MdePkg/Library/BaseIoLibIntrinsic/Arm/ArmVirtMmio.asm | 18 +++++++++---------
MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicArmVirt.inf | 2 +-
MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.inf | 20 ++++++++++----------
MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf | 2 +-
21 files changed, 65 insertions(+), 59 deletions(-)

--
2.23.0


Re: 答复: [edk2-devel] [edk2] DxeIpl : create page table, occupied too much memory range

Tiger Liu(BJ-RD)
 

Hi, Laszlo:
Thanks for your reply!

Is Using PcdUse5LevelPageTable also a method to reduce paging table's memory requirement?

I find PcdUse1GPageTable's default value is false, why?

PcdUse5LevelPageTable's default value is true, and DxeIpl module will create 5-level paging for Dxe's long mode?

Best wishes,

-----邮件原件-----
发件人: Laszlo Ersek <lersek@redhat.com>
发送时间: 2019年9月17日 20:07
收件人: devel@edk2.groups.io; Tiger Liu(BJ-RD) <TigerLiu@zhaoxin.com>
主题: Re: [edk2-devel] [edk2] DxeIpl : create page table, occupied too much memory range

On 09/17/19 13:08, Tiger Liu(BJ-RD) wrote:
Hi, Expert:
I have a question about creating page table.
If a CPU support 48bit physical address line, then creating page tables(Page size=2MB) will occupy too much memory region.

Now, developer could only use PcdUse1GPageTable to avoid occupy too much memory region?
Not only. See <https://bugzilla.tianocore.org/show_bug.cgi?id=2008>.

Thanks
Laszlo


保密声明:
本邮件含有保密或专有信息,仅供指定收件人使用。严禁对本邮件或其内容做任何未经授权的查阅、使用、复制或转发。
CONFIDENTIAL NOTE:
This email contains confidential or legally privileged information and is for the sole use of its intended recipient. Any unauthorized review, use, copying or forwarding of this email or the content of this email is strictly prohibited.


Re: [PATCH 22/35] OvmfPkg/XenBusDxe: fix UninstallMultipleProtocolInterfaces() call

Julien Grall
 

Hi,

On 17/09/2019 20:49, Laszlo Ersek wrote:
Unlike the InstallMultipleProtocolInterfaces() boot service, which takes
an (EFI_HANDLE*) as first parameter, the
UninstallMultipleProtocolInterfaces() boot service takes an EFI_HANDLE as
first parameter.
This is an actual bug. It must have remained hidden until now because it's
on an error path. Fix the UninstallMultipleProtocolInterfaces() call.
Cc: Anthony Perard <anthony.perard@citrix.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Julien Grall <julien.grall@arm.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Julien Grall <julien.grall@arm.com>

Cheers,

--
Julien Grall


Re: [PATCH edk2-CCSS 0/3] Coding Standards: add rule for documenting spurious variable assignments

Laszlo Ersek
 

On 09/17/19 21:10, Michael D Kinney wrote:
Series Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>

I also agree that the macros would be cleaner, easy to review, and
and fewer lines of code without the comment block. If I objected
previously, then I have also changed my mind. I agree we can go
ahead and push the series in its current form and continue the
discussion on the macros.
Thank you all for the help, I've pushed the series:

d096859f15b9..f5ad35ec2c6d

Cheers,
Laszlo


[PATCH] BaseTools:Change the way that get some VpdPcd information

Fan, ZhijuX
 

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

An error occurs using special VpdPcd that is not used in the Inf file

In dsc:
[PcdsDynamicExVpd.common.DEFAULT]
gBoardModuleTokenSpaceGuid.test1|*|{CODE({
{0x0} // terminator
})}

In dec:
[PcdsDynamicEx]
# Vpd GPIO table
gBoardModuleTokenSpaceGuid.test1|{0}|GPIO_INIT_CONFIG[]|0x50000018 {
<HeaderFiles>
Library/GpioLib.h
<Packages>
MdePkg/MdePkg.dec
}
ValueError: invalid literal for int() with base 0: '*'

This Patch is going to fix issue by Change the way that get
some VpdPcd information

Cc: Liming Gao <liming.gao@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com>
---
BaseTools/Source/Python/build/BuildReport.py | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Source/Python/build/BuildReport.py
index 6b26f1c3b0..880459d367 100644
--- a/BaseTools/Source/Python/build/BuildReport.py
+++ b/BaseTools/Source/Python/build/BuildReport.py
@@ -1419,10 +1419,19 @@ class PcdReport(object):
FileWrite(File, '%*s' % (self.MaxLen + 4, SkuInfo.VpdOffset))
VPDPcdItem = (Pcd.TokenSpaceGuidCName + '.' + PcdTokenCName, SkuIdName, SkuInfo.VpdOffset, Pcd.MaxDatumSize, SkuInfo.DefaultValue)
if VPDPcdItem not in VPDPcdList:
- VPDPcdList.append(VPDPcdItem)
+ PcdGuidList = self.UnusedPcds.get(Pcd.TokenSpaceGuidCName)
+ if PcdGuidList:
+ PcdList = PcdGuidList.get(Pcd.Type)
+ if not PcdList:
+ VPDPcdList.append(VPDPcdItem)
+ for VpdPcd in PcdList:
+ if PcdTokenCName == VpdPcd.TokenCName:
+ break
+ else:
+ VPDPcdList.append(VPDPcdItem)
if IsStructure:
FiledOverrideFlag = False
- OverrideValues = Pcd.SkuOverrideValues[Sku]
+ OverrideValues = Pcd.SkuOverrideValues.get(Sku)
if OverrideValues:
Keys = list(OverrideValues.keys())
OverrideFieldStruct = self.OverrideFieldValue(Pcd, OverrideValues[Keys[0]])
--
2.14.1.windows.1


Re: [PATCH 22/35] OvmfPkg/XenBusDxe: fix UninstallMultipleProtocolInterfaces() call

Anthony PERARD
 

On Tue, Sep 17, 2019 at 09:49:22PM +0200, Laszlo Ersek wrote:
Unlike the InstallMultipleProtocolInterfaces() boot service, which takes
an (EFI_HANDLE*) as first parameter, the
UninstallMultipleProtocolInterfaces() boot service takes an EFI_HANDLE as
first parameter.

This is an actual bug. It must have remained hidden until now because it's
on an error path. Fix the UninstallMultipleProtocolInterfaces() call.

Cc: Anthony Perard <anthony.perard@citrix.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Julien Grall <julien.grall@arm.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>

Thanks,

--
Anthony PERARD


Re: [Patch V3] UefiCpuPkg/CpuExceptionHandlerLib: Fix split lock

Laszlo Ersek
 

On 09/18/19 00:49, John E Lofgren wrote:
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2150
V3 changes:
change to mov instruction (non locking instuction) instead
of xchg to simplify design.
I think something's wrong -- the v3 update described above isn't
actually implemented in the patch (it continues using XCHG, rather than
MOV).

Thanks
Laszlo


V2 changes:
Add xchg 16 bit instructions to handle sgdt and sidt base
63:48 bits and 47:32 bits.
Add comment to explain why xchg 64bit isnt being used

Split lock happens when a locking instruction is used on mis-aligned data
that crosses two cachelines. If close source platform enables Alignment Check
Exception(#AC), They can hit a double fault due to split lock being in
CpuExceptionHandlerLib.

sigt and sgdt saves 10 bytes to memory, 8 bytes is base and 2 bytes is limit.
The data is mis-aligned, can cross two cacheline, and a xchg
instruction(locking instuction) is being utilize.

Signed-off-by: John E Lofgren <john.e.lofgren@intel.com>
---
UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.nasm | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.nasm b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.nasm
index 4db1a09f28..7b7642b290 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.nasm
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.nasm
@@ -180,21 +180,29 @@ HasErrorCode:
push qword [rbp + 24]

;; UINT64 Gdtr[2], Idtr[2];
+ ; sidt and sgdt saves 10 bytes to memory, 8 bytes = base and 2 bytes = limit.
+ ; To avoid #AC split lock when separating base and limit into their
+ ; own separate 64 bit memory, we can’t use 64 bit xchg since base [63:48] bits
+ ; may cross the cache line.
xor rax, rax
push rax
push rax
sidt [rsp]
- xchg rax, [rsp + 2]
- xchg rax, [rsp]
- xchg rax, [rsp + 8]
+ xchg eax, [rsp + 2]
+ xchg eax, [rsp]
+ xchg eax, [rsp + 8]
+ xchg ax, [rsp + 6]
+ xchg ax, [rsp + 4]

xor rax, rax
push rax
push rax
sgdt [rsp]
- xchg rax, [rsp + 2]
- xchg rax, [rsp]
- xchg rax, [rsp + 8]
+ xchg eax, [rsp + 2]
+ xchg eax, [rsp]
+ xchg eax, [rsp + 8]
+ xchg ax, [rsp + 6]
+ xchg ax, [rsp + 4]

;; UINT64 Ldtr, Tr;
xor rax, rax


[PATCH v2 1/1] uefi-sct/SctPkg AdapterInfo SetInformation may return unsupported

Tom Zhao
 

If AdapterInfo.SetInformation() is unsupported, it will return
EFI_UNSUPPORTED. Do not fail the test in this case.

Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
Cc: Eric Jin <eric.jin@intel.com>
Signed-off-by: Tom Zhao <tzhao@solarflare.com>
---

Notes:
v2:
- Change commit message to be closer to similar issues.

uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/AdapterInfo/BlackBoxTest/AdapterInfoBBTestConformance.c | 4 ++--
uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/AdapterInfo/BlackBoxTest/AdapterInfoBBTestFunction.c | 8 ++++----
2 files changed, 6 insertions(+), 6 deletions(-)

diff --git
a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/AdapterInfo/BlackBoxTest/AdapterInfoBBTestConformance.c
b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/AdapterInfo/BlackBoxTest/AdapterInfoBBTestConformance.c
index fb42398e4a97..3dc048db5333 100644
---
a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/AdapterInfo/BlackBoxTest/AdapterInfoBBTestConformance.c
+++
b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/AdapterInfo/BlackBoxTest/AdapterInfoBBTestConformance.c
@@ -556,8 +556,8 @@ BBTestSetInformationConformanceTestCheckpoint2 (
NULL,
InformationBlockSize
);
- - if ( Status != EFI_INVALID_PARAMETER && Status !=
EFI_WRITE_PROTECTED) {
+
+ if ( Status != EFI_INVALID_PARAMETER && Status !=
EFI_WRITE_PROTECTED && Status != EFI_UNSUPPORTED) {
AssertionType = EFI_TEST_ASSERTION_FAILED;
} else {
AssertionType = EFI_TEST_ASSERTION_PASSED;
diff --git
a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/AdapterInfo/BlackBoxTest/AdapterInfoBBTestFunction.c
b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/AdapterInfo/BlackBoxTest/AdapterInfoBBTestFunction.c
index 334bb9edc493..4b054b0ef7d8 100644
---
a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/AdapterInfo/BlackBoxTest/AdapterInfoBBTestFunction.c
+++
b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/AdapterInfo/BlackBoxTest/AdapterInfoBBTestFunction.c
@@ -372,11 +372,11 @@ BBTestSetInformationFunctionTestCheckpoint1 (
InformationBlockSize1
);
- if (Status == EFI_SUCCESS || Status == EFI_WRITE_PROTECTED)
- AssertionType = EFI_TEST_ASSERTION_PASSED; + if (Status ==
EFI_SUCCESS || Status == EFI_WRITE_PROTECTED || Status == EFI_UNSUPPORTED)
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
else
- AssertionType = EFI_TEST_ASSERTION_FAILED; - +
AssertionType = EFI_TEST_ASSERTION_FAILED;
+
StandardLib->RecordAssertion (
StandardLib,
AssertionType,
--
2.21.0


Re: [PATCH V3 1/3] MdeModulePkg: Extend the support keyboard type of Terminal console

Laszlo Ersek
 

On 09/18/19 07:33, Zhichao Gao wrote:
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2186

A common terminal console software Putty support various types of
keyboard type, such as normal mode, Linux mode, Xterm R6, Vt400,
VT100+ and SCO. Refer to the link:
https://www.ssh.com/ssh/putty/putty-manuals/0.68/Chapter4.html#config-funkeys

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>
---
MdeModulePkg/Include/Guid/TtyTerm.h | 13 +++++++++++++
MdeModulePkg/MdeModulePkg.dec | 4 ++++
2 files changed, 17 insertions(+)

diff --git a/MdeModulePkg/Include/Guid/TtyTerm.h b/MdeModulePkg/Include/Guid/TtyTerm.h
index 8333344b9d..471a651d4d 100644
--- a/MdeModulePkg/Include/Guid/TtyTerm.h
+++ b/MdeModulePkg/Include/Guid/TtyTerm.h
@@ -4,6 +4,7 @@ provide support for modern *nix terminals.


Copyright (c) 2015 Linaro Ltd.
+Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent

**/
@@ -14,6 +15,18 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#define EFI_TTY_TERM_GUID \
{0x7d916d80, 0x5bb1, 0x458c, {0xa4, 0x8f, 0xe2, 0x5f, 0xdd, 0x51, 0xef, 0x94 } }

+#define EDKII_LINUX_TERM_GUID \
+ {0xe4364a7f, 0xf825, 0x430e, {0x9d, 0x3a, 0x9c, 0x9b, 0xe6, 0x81, 0x7c, 0xa5 } }
+
+#define EDKII_XTERM_R6_GUID \
+ {0xfbfca56b, 0xbb36, 0x4b78, {0xaa, 0xab, 0xbe, 0x1b, 0x97, 0xec, 0x7c, 0xcb } }
+
+#define EDKII_VT400_GUID \
+ {0x8e46dddd, 0x3d49, 0x4a9d, {0xb8, 0x75, 0x3c, 0x08, 0x6f, 0x6a, 0xa2, 0xbd } }
+
+#define EDKII_SCO_TERM_GUID \
+ {0xfc7dd6e0, 0x813c, 0x434d, {0xb4, 0xda, 0x3b, 0xd6, 0x49, 0xe9, 0xe1, 0x5a } }
+
extern EFI_GUID gEfiTtyTermGuid;

#endif
diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index 17beb45235..7f72c122fc 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -342,6 +342,10 @@

## Include/Guid/TtyTerm.h
gEfiTtyTermGuid = { 0x7d916d80, 0x5bb1, 0x458c, {0xa4, 0x8f, 0xe2, 0x5f, 0xdd, 0x51, 0xef, 0x94 }}
+ gEdkiiLinuxTermGuid = { 0xe4364a7f, 0xf825, 0x430e, {0x9d, 0x3a, 0x9c, 0x9b, 0xe6, 0x81, 0x7c, 0xa5 }}
+ gEdkiiXtermR6Guid = { 0xfbfca56b, 0xbb36, 0x4b78, {0xaa, 0xab, 0xbe, 0x1b, 0x97, 0xec, 0x7c, 0xcb }}
+ gEdkiiVT400Guid = { 0x8e46dddd, 0x3d49, 0x4a9d, {0xb8, 0x75, 0x3c, 0x08, 0x6f, 0x6a, 0xa2, 0xbd }}
+ gEdkiiSCOTermGuid = { 0xfc7dd6e0, 0x813c, 0x434d, {0xb4, 0xda, 0x3b, 0xd6, 0x49, 0xe9, 0xe1, 0x5a }}

## Include/Guid/HiiBootMaintenanceFormset.h
gEfiIfrBootMaintenanceGuid = { 0xb2dedc91, 0xd59f, 0x48d2, { 0x89, 0x8a, 0x12, 0x49, 0xc, 0x74, 0xa4, 0xe0 }}
thank you, the new names look helpful.

Acked-by: Laszlo Ersek <lersek@redhat.com>

Thanks
Laszlo


Re: [PATCH 01/35] DO NOT APPLY: edk2: turn standard handle types into pointers to non-VOID

Laszlo Ersek
 

On 09/17/19 22:22, Andrew Fish wrote:


On Sep 17, 2019, at 1:06 PM, Ni, Ray <ray.ni@intel.com> wrote:

Laszlo,
Thank you very much for this work.
They are quite helpful to detect potential issues.

But without this specific patch being checked in, future break will still happen.
I don't want it to be checked in ASAP because I know that there are quite a lot of close source code that may get build break due to this change.
Besides that, what prevent you make the decision to check in the changes?
Ray,

I was thinking the same thing. Could we make this an optional feature via a #define? We could always default to the Spec Behavior, and new projects could opt into the stricter version.

#ifndef STRICTER_UEFI_TYPES
typedef VOID *EFI_PEI_FV_HANDLE;
#else
struct EFI_PEI_FV_OBJECT;
typedef struct EFI_PEI_FV_OBJECT *EFI_PEI_FV_HANDLE;
#endif
Technically, this would work well.

However, if we wanted to allow new projects to #define
STRICTER_UEFI_TYPES as their normal mode of operation (and not just for
a sanity check in CI), then we'd have to update the UEFI spec too.

Otherwise, code that is technically spec-conformant (albeit semantically
nonsensical), like I mentioned up-thread, would no longer compile:

EFI_HANDLE Foobar;
UINT64 Val;

Foobar = &Val;

Thanks
Laszlo


Re: [PATCH 01/35] DO NOT APPLY: edk2: turn standard handle types into pointers to non-VOID

Laszlo Ersek
 

On 09/17/19 22:06, Ni, Ray wrote:
Laszlo,
Thank you very much for this work.
They are quite helpful to detect potential issues.

But without this specific patch being checked in, future break will still happen.
Yes, I agree; that's quite likely.

I don't want it to be checked in ASAP because I know that there are quite a lot of close source code that may get build break due to this change.
Besides that, what prevent you make the decision to check in the changes?
There are two concerns:


(1) Applying this patch would cause edk2 to diverge from the UEFI / PI /
Shell specifications.

For example, consider the following 3rd party code:

EFI_HANDLE Foobar;
UINT64 Val;

Foobar = &Val;

*Semantically*, this code is wrong. However, given the publicly
specified EFI_HANDLE typedef in the UEFI spec, the code is *technically*
correct.

If we changed the EFI_HANDLE typedef in edk2, as follows:

struct EFI_OBJECT;
typedef struct EFI_OBJECT *EFI_HANDLE;

Then the assignment to Foobar above, in the 3rd party code, would become
a C language constraint violation -- and for constraint violations, C
compilers are required to emit diagnostics.

In brief, it would build-break 3rd party code that currently conforms to
the UEFI spec.


(2) Some of the changes in the patch are not optimal with regard to
"data hiding".

An example for good data hiding is the example above: "struct
EFI_OBJECT" being an incomplete type, without any details shared in the
public header.

However, in the patch we have bad data hiding too:

- typedef LIST_ENTRY *EFI_FONT_HANDLE
- typedef UINT8 *EFI_S3_BOOT_SCRIPT_POSITION
- typedef EFI_FILE_PROTOCOL *SHELL_FILE_HANDLE;

These typedefs, while they serve the purposes of the present patch set,
expose too much information (= the actual implementation) about the types.

For solving this data hiding problem, we'd have to (a) introduce
intermittent structure types (similar to EFI_OBJECT), and then (b) we'd
have to rework the rest of the implementation for that. Using
EFI_FONT_HANDLE as example:

(a) introduce the intermittent (opaque) structure type:

struct EFI_FONT_OBJECT;
typedef struct EFI_FONT_OBJECT *EFI_FONT_HANDLE;

(b) rework the implementation:

struct EFI_FONT_OBJECT {
LIST_ENTRY Entry;
};

typedef struct _HII_GLOBAL_FONT_INFO {
UINTN Signature;
struct EFI_FONT_OBJECT FontObject;
HII_FONT_PACKAGE_INSTANCE *FontPackage;
UINTN FontInfoSize;
EFI_FONT_INFO *FontInfo;
} HII_GLOBAL_FONT_INFO;

and then every reference to "HII_GLOBAL_FONT_INFO.Entry" would have to
be updated to "HII_GLOBAL_FONT_INFO.FontObject.Entry".

It's likely doable, but it would take a lot of work.


If we wanted to continue using this patch for sanity-checking edk2, then
one option would be to bracket the changes with #ifdef's. That is, make
the "type separation" dependent on a new feature test macro.

Normally, the feature test macro would not be defined (as it breaks UEFI
spec conformance, see above). But in CI, one set of the builds would
define the macro, for sanity checking edk2 itself.

Thanks
Laszlo



Thanks,
Ray


-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Laszlo Ersek
Sent: Tuesday, September 17, 2019 12:49 PM
To: edk2-devel-groups-io <devel@edk2.groups.io>
Cc: Achin Gupta <achin.gupta@arm.com>; Andrew Fish <afish@apple.com>; Anthony Perard <anthony.perard@citrix.com>;
Ard Biesheuvel <ard.biesheuvel@linaro.org>; You, Benjamin <benjamin.you@intel.com>; Zhang, Chao B
<chao.b.zhang@intel.com>; Bi, Dandan <dandan.bi@intel.com>; David Woodhouse <dwmw2@infradead.org>; Dong, Eric
<eric.dong@intel.com>; Dong, Guo <guo.dong@intel.com>; Wu, Hao A <hao.a.wu@intel.com>; Carsey, Jaben
<jaben.carsey@intel.com>; Wang, Jian J <jian.j.wang@intel.com>; Wu, Jiaxin <jiaxin.wu@intel.com>; Yao, Jiewen
<jiewen.yao@intel.com>; Justen, Jordan L <jordan.l.justen@intel.com>; Julien Grall <julien.grall@arm.com>; Leif Lindholm
<leif.lindholm@linaro.org>; Gao, Liming <liming.gao@intel.com>; Ma, Maurice <maurice.ma@intel.com>; Kinney, Michael
D <michael.d.kinney@intel.com>; Ni, Ray <ray.ni@intel.com>; Fu, Siyuan <siyuan.fu@intel.com>; Supreeth Venkatesh
<supreeth.venkatesh@arm.com>; Gao, Zhichao <zhichao.gao@intel.com>
Subject: [edk2-devel] [PATCH 01/35] DO NOT APPLY: edk2: turn standard handle types into pointers to non-VOID

Unfortunately, the UEFI / PI / Shell specs define a number of handle types
as pointers to VOID. This is a design mistake; those types should have
been pointers to incomplete union or structure types. Any
pointer-to-object type converts implicitly to, and from, pointer-to-void,
which prevents compilers from catching at least the following two types of
mistakes:

- mixing up one handle type with another (for example, EFI_HANDLE with
EFI_EVENT),

- getting the depth of indirection wrong (for example, mixing up
(EFI_HANDLE*) with EFI_HANDLE).

In order to root out such mistakes in the edk2 codebase, introduce
incomplete structure types with unique tags, such as:

struct EFI_FOOBAR_OBJECT;
typedef struct EFI_FOOBAR_OBJECT *EFI_FOOBAR_HANDLE;

replacing the spec mandated

typedef VOID *EFI_FOOBAR_HANDLE;

(For some types, such as:

- EFI_ACPI_HANDLE,
- EFI_EVENT,
- EFI_FONT_HANDLE,
- EFI_HANDLE,
- EFI_HII_HANDLE,
- EFI_S3_BOOT_SCRIPT_POSITION,
- SHELL_FILE_HANDLE,

we connect the actual complete type (the internal, implementation-specific
type) to the typedef. Some of these also demonstrate how the code could
have looked in practice if the specs had used proper opaque (=incomplete)
types.)

Then, unleash "build" on the package DSC files. This causes the compiler
to warn about incompatible pointer assignments, and to stop the build.

The rest of the series addresses the resultant warnings. Each patch
belongs in one of two categories:

- semantic cleanups (no functional / behavioral changes),
- actual bugfixes.

As the subject line of this patch states, this specific patch is *not*
meant to be applied. It is just a "what if" patch that temporarily
isolates the standard types from each other, the way the specs should
have, so that the compiler have more information to work with.

Cc: Achin Gupta <achin.gupta@arm.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Anthony Perard <anthony.perard@citrix.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Chao Zhang <chao.b.zhang@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Guo Dong <guo.dong@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Jian Wang <jian.j.wang@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Julien Grall <julien.grall@arm.com>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
MdePkg/Include/Pi/PiPeiCis.h | 6 ++++--
MdePkg/Include/Protocol/AcpiSystemDescriptionTable.h | 3 ++-
MdePkg/Include/Protocol/Bis.h | 3 ++-
MdePkg/Include/Protocol/Eap.h | 3 ++-
MdePkg/Include/Protocol/HiiFont.h | 3 +--
MdePkg/Include/Protocol/MmMp.h | 3 ++-
MdePkg/Include/Protocol/S3SaveState.h | 2 +-
MdePkg/Include/Protocol/Shell.h | 3 ++-
MdePkg/Include/Protocol/UserManager.h | 9 ++++++---
MdePkg/Include/Uefi/UefiBaseType.h | 6 ++++--
MdePkg/Include/Uefi/UefiInternalFormRepresentation.h | 3 ++-
MdeModulePkg/Core/Dxe/Event/Event.h | 2 +-
MdeModulePkg/Core/Dxe/Hand/Handle.h | 2 +-
MdeModulePkg/Core/PiSmmCore/PiSmmCore.h | 2 +-
MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiSdt.h | 2 +-
MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h | 2 +-
StandaloneMmPkg/Core/StandaloneMmCore.h | 2 +-
17 files changed, 34 insertions(+), 22 deletions(-)

diff --git a/MdePkg/Include/Pi/PiPeiCis.h b/MdePkg/Include/Pi/PiPeiCis.h
index d9d4ed7d413a..3e9e82b62ae9 100644
--- a/MdePkg/Include/Pi/PiPeiCis.h
+++ b/MdePkg/Include/Pi/PiPeiCis.h
@@ -18,12 +18,14 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
///
/// The handles of EFI FV.
///
-typedef VOID *EFI_PEI_FV_HANDLE;
+struct EFI_PEI_FV_OBJECT;
+typedef struct EFI_PEI_FV_OBJECT *EFI_PEI_FV_HANDLE;

///
/// The handles of EFI FFS.
///
-typedef VOID *EFI_PEI_FILE_HANDLE;
+struct EFI_PEI_FILE_OBJECT;
+typedef struct EFI_PEI_FILE_OBJECT *EFI_PEI_FILE_HANDLE;

///
/// Declare the forward reference data structure for EFI_PEI_SERVICE.
diff --git a/MdePkg/Include/Protocol/AcpiSystemDescriptionTable.h
b/MdePkg/Include/Protocol/AcpiSystemDescriptionTable.h
index a8e0b24c6c8d..8a1863f3e03d 100644
--- a/MdePkg/Include/Protocol/AcpiSystemDescriptionTable.h
+++ b/MdePkg/Include/Protocol/AcpiSystemDescriptionTable.h
@@ -16,7 +16,8 @@
{ 0xeb97088e, 0xcfdf, 0x49c6, { 0xbe, 0x4b, 0xd9, 0x6, 0xa5, 0xb2, 0xe, 0x86 }}

typedef UINT32 EFI_ACPI_TABLE_VERSION;
-typedef VOID *EFI_ACPI_HANDLE;
+struct EFI_ACPI_OBJECT;
+typedef struct EFI_ACPI_OBJECT *EFI_ACPI_HANDLE;

#define EFI_ACPI_TABLE_VERSION_NONE (1 << 0)
#define EFI_ACPI_TABLE_VERSION_1_0B (1 << 1)
diff --git a/MdePkg/Include/Protocol/Bis.h b/MdePkg/Include/Protocol/Bis.h
index 2be6718f4bc2..8eca94512d03 100644
--- a/MdePkg/Include/Protocol/Bis.h
+++ b/MdePkg/Include/Protocol/Bis.h
@@ -37,7 +37,8 @@ typedef struct _EFI_BIS_PROTOCOL EFI_BIS_PROTOCOL;
//
// Basic types
//
-typedef VOID *BIS_APPLICATION_HANDLE;
+struct BIS_APPLICATION_OBJECT;
+typedef struct BIS_APPLICATION_OBJECT *BIS_APPLICATION_HANDLE;
typedef UINT16 BIS_ALG_ID;
typedef UINT32 BIS_CERT_ID;

diff --git a/MdePkg/Include/Protocol/Eap.h b/MdePkg/Include/Protocol/Eap.h
index 203d0f40b0dd..06584ef409d0 100644
--- a/MdePkg/Include/Protocol/Eap.h
+++ b/MdePkg/Include/Protocol/Eap.h
@@ -28,7 +28,8 @@ typedef struct _EFI_EAP_PROTOCOL EFI_EAP_PROTOCOL;
/// Type for the identification number assigned to the Port by the
/// System in which the Port resides.
///
-typedef VOID * EFI_PORT_HANDLE;
+struct EFI_PORT_OBJECT;
+typedef struct EFI_PORT_OBJECT *EFI_PORT_HANDLE;

///
/// EAP Authentication Method Type (RFC 3748)
diff --git a/MdePkg/Include/Protocol/HiiFont.h b/MdePkg/Include/Protocol/HiiFont.h
index 1f2e321ea4e2..450cad9ada70 100644
--- a/MdePkg/Include/Protocol/HiiFont.h
+++ b/MdePkg/Include/Protocol/HiiFont.h
@@ -19,8 +19,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
{ 0xe9ca4775, 0x8657, 0x47fc, { 0x97, 0xe7, 0x7e, 0xd6, 0x5a, 0x8, 0x43, 0x24 } }

typedef struct _EFI_HII_FONT_PROTOCOL EFI_HII_FONT_PROTOCOL;
-
-typedef VOID *EFI_FONT_HANDLE;
+typedef LIST_ENTRY *EFI_FONT_HANDLE;

///
/// EFI_HII_OUT_FLAGS.
diff --git a/MdePkg/Include/Protocol/MmMp.h b/MdePkg/Include/Protocol/MmMp.h
index beace1386cbe..cd4e0db47e08 100644
--- a/MdePkg/Include/Protocol/MmMp.h
+++ b/MdePkg/Include/Protocol/MmMp.h
@@ -36,7 +36,8 @@
//
// Completion token
//
-typedef VOID* MM_COMPLETION;
+struct MM_COMPLETION_OBJECT;
+typedef struct MM_COMPLETION_OBJECT* MM_COMPLETION;

typedef struct {
MM_COMPLETION Completion;
diff --git a/MdePkg/Include/Protocol/S3SaveState.h b/MdePkg/Include/Protocol/S3SaveState.h
index c1b8f8b9e08d..235c36be6737 100644
--- a/MdePkg/Include/Protocol/S3SaveState.h
+++ b/MdePkg/Include/Protocol/S3SaveState.h
@@ -21,7 +21,7 @@
{ 0xe857caf6, 0xc046, 0x45dc, { 0xbe, 0x3f, 0xee, 0x7, 0x65, 0xfb, 0xa8, 0x87 }}


-typedef VOID *EFI_S3_BOOT_SCRIPT_POSITION;
+typedef UINT8 *EFI_S3_BOOT_SCRIPT_POSITION;

typedef struct _EFI_S3_SAVE_STATE_PROTOCOL EFI_S3_SAVE_STATE_PROTOCOL;

diff --git a/MdePkg/Include/Protocol/Shell.h b/MdePkg/Include/Protocol/Shell.h
index cfb7878228c5..bf791792b4f2 100644
--- a/MdePkg/Include/Protocol/Shell.h
+++ b/MdePkg/Include/Protocol/Shell.h
@@ -11,12 +11,13 @@
#define __EFI_SHELL_PROTOCOL_H__

#include <Guid/FileInfo.h>
+#include <Protocol/SimpleFileSystem.h>

#define EFI_SHELL_PROTOCOL_GUID \
{ \
0x6302d008, 0x7f9b, 0x4f30, { 0x87, 0xac, 0x60, 0xc9, 0xfe, 0xf5, 0xda, 0x4e } \
}
-typedef VOID *SHELL_FILE_HANDLE;
+typedef EFI_FILE_PROTOCOL *SHELL_FILE_HANDLE;

typedef enum {
///
diff --git a/MdePkg/Include/Protocol/UserManager.h b/MdePkg/Include/Protocol/UserManager.h
index 26ac4955f1ec..9abfcffbeebf 100644
--- a/MdePkg/Include/Protocol/UserManager.h
+++ b/MdePkg/Include/Protocol/UserManager.h
@@ -24,8 +24,10 @@
0xbaf1e6de, 0x209e, 0x4adb, { 0x8d, 0x96, 0xfd, 0x8b, 0x71, 0xf3, 0xf6, 0x83 } \
}

-typedef VOID *EFI_USER_PROFILE_HANDLE;
-typedef VOID *EFI_USER_INFO_HANDLE;
+struct EFI_USER_PROFILE_OBJECT;
+typedef struct EFI_USER_PROFILE_OBJECT *EFI_USER_PROFILE_HANDLE;
+struct EFI_USER_INFO_OBJECT;
+typedef struct EFI_USER_INFO_OBJECT *EFI_USER_INFO_HANDLE;

///
/// The attributes of the user profile information.
@@ -157,7 +159,8 @@ typedef CHAR16 *EFI_USER_INFO_CREDENTIAL_PROVIDER_NAME;
/// Biometric Exchange Formats Framework) specification.
///
#define EFI_USER_INFO_CBEFF_RECORD 0x0B
-typedef VOID *EFI_USER_INFO_CBEFF;
+struct EFI_USER_INFO_CBEFF_OBJECT;
+typedef struct EFI_USER_INFO_CBEFF_OBJECT *EFI_USER_INFO_CBEFF;
///
/// Indicates how close of a match the fingerprint must be in order to be considered a match.
///
diff --git a/MdePkg/Include/Uefi/UefiBaseType.h b/MdePkg/Include/Uefi/UefiBaseType.h
index a62f13dd064f..be5831991b52 100644
--- a/MdePkg/Include/Uefi/UefiBaseType.h
+++ b/MdePkg/Include/Uefi/UefiBaseType.h
@@ -28,11 +28,13 @@ typedef RETURN_STATUS EFI_STATUS;
///
/// A collection of related interfaces.
///
-typedef VOID *EFI_HANDLE;
+struct EFI_OBJECT;
+typedef struct EFI_OBJECT *EFI_HANDLE;
///
/// Handle to an event structure.
///
-typedef VOID *EFI_EVENT;
+struct EFI_EVENT_OBJECT;
+typedef struct EFI_EVENT_OBJECT *EFI_EVENT;
///
/// Task priority level.
///
diff --git a/MdePkg/Include/Uefi/UefiInternalFormRepresentation.h
b/MdePkg/Include/Uefi/UefiInternalFormRepresentation.h
index 4a1346a599d0..93bf9e9e0f13 100644
--- a/MdePkg/Include/Uefi/UefiInternalFormRepresentation.h
+++ b/MdePkg/Include/Uefi/UefiInternalFormRepresentation.h
@@ -20,7 +20,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
///
/// The following types are currently defined:
///
-typedef VOID* EFI_HII_HANDLE;
+struct EFI_HII_OBJECT;
+typedef struct EFI_HII_OBJECT* EFI_HII_HANDLE;
typedef CHAR16* EFI_STRING;
typedef UINT16 EFI_IMAGE_ID;
typedef UINT16 EFI_QUESTION_ID;
diff --git a/MdeModulePkg/Core/Dxe/Event/Event.h b/MdeModulePkg/Core/Dxe/Event/Event.h
index 8141c5003eec..42590cb1dd09 100644
--- a/MdeModulePkg/Core/Dxe/Event/Event.h
+++ b/MdeModulePkg/Core/Dxe/Event/Event.h
@@ -37,7 +37,7 @@ typedef struct {
} TIMER_EVENT_INFO;

#define EVENT_SIGNATURE SIGNATURE_32('e','v','n','t')
-typedef struct {
+typedef struct EFI_EVENT_OBJECT {
UINTN Signature;
UINT32 Type;
UINT32 SignalCount;
diff --git a/MdeModulePkg/Core/Dxe/Hand/Handle.h b/MdeModulePkg/Core/Dxe/Hand/Handle.h
index 83eb2b9f3afe..1f1ab3274e8a 100644
--- a/MdeModulePkg/Core/Dxe/Hand/Handle.h
+++ b/MdeModulePkg/Core/Dxe/Hand/Handle.h
@@ -15,7 +15,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
///
/// IHANDLE - contains a list of protocol handles
///
-typedef struct {
+typedef struct EFI_OBJECT {
UINTN Signature;
/// All handles list of IHANDLE
LIST_ENTRY AllHandles;
diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.h b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.h
index 0908e7f4e9e7..c55da58d465e 100644
--- a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.h
+++ b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.h
@@ -145,7 +145,7 @@ typedef struct {
///
/// IHANDLE - contains a list of protocol handles
///
-typedef struct {
+typedef struct EFI_OBJECT {
UINTN Signature;
/// All handles list of IHANDLE
LIST_ENTRY AllHandles;
diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiSdt.h
b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiSdt.h
index 50d4c96edb63..bfebbb1f8182 100644
--- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiSdt.h
+++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiSdt.h
@@ -88,7 +88,7 @@ struct _EFI_AML_NODE_LIST {
// This buffer should not be freed.
// Size is the total size of this ACPI node buffer.
//
-typedef struct {
+typedef struct EFI_ACPI_OBJECT {
UINT32 Signature;
UINT8 *Buffer;
UINTN Size;
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h
b/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h
index 4a3feab94df5..48972d0fcad6 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h
@@ -274,7 +274,7 @@ typedef struct _HII_DATABASE_PACKAGE_LIST_INSTANCE {

#define HII_HANDLE_SIGNATURE SIGNATURE_32 ('h','i','h','l')

-typedef struct {
+typedef struct EFI_HII_OBJECT {
UINTN Signature;
LIST_ENTRY Handle;
UINTN Key;
diff --git a/StandaloneMmPkg/Core/StandaloneMmCore.h b/StandaloneMmPkg/Core/StandaloneMmCore.h
index 4d0eed273f50..dcf91bc5e916 100644
--- a/StandaloneMmPkg/Core/StandaloneMmCore.h
+++ b/StandaloneMmPkg/Core/StandaloneMmCore.h
@@ -105,7 +105,7 @@ typedef struct {
///
/// IHANDLE - contains a list of protocol handles
///
-typedef struct {
+typedef struct EFI_OBJECT {
UINTN Signature;
/// All handles list of IHANDLE
LIST_ENTRY AllHandles;
--
2.19.1.3.g30247aa5d201



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

View/Reply Online (#47388): https://edk2.groups.io/g/devel/message/47388
Mute This Topic: https://groups.io/mt/34180199/1712937
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [ray.ni@intel.com]
-=-=-=-=-=-=


[PATCH v3] BaseTools/LzmaCompress: Add two switches

Zhang, Shenglei
 

From: "Zhang, Shenglei" <shenglei.zhang@intel.com>

As is requested in the BZ 2077, add two switches to support setting
compression mode and dictionary size.
(https://bugzilla.tianocore.org/show_bug.cgi?id=2077)

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
---
v2: 1.Update DictionarySize to mDictionarySize.
2.Update CompressionMode to mCompressionMode.
3.Use CLzmaEncProps *props as the input parameter of the
function Encode.

v3: Remove the component "mDictionarySize >= 0" in the if judgement.line 303
This is to fix the build failure under Mac OS. Beacuse the type of
mDictionarySize is UINT64, which is always >= 0.


.../Source/C/LzmaCompress/LzmaCompress.c | 43 +++++++++++++++----
BaseTools/Source/C/LzmaCompress/GNUmakefile | 4 +-
BaseTools/Source/C/LzmaCompress/Makefile | 4 +-
3 files changed, 40 insertions(+), 11 deletions(-)

diff --git a/BaseTools/Source/C/LzmaCompress/LzmaCompress.c b/BaseTools/Source/C/LzmaCompress/LzmaCompress.c
index a3607f9b2084..328ecfa930da 100644
--- a/BaseTools/Source/C/LzmaCompress/LzmaCompress.c
+++ b/BaseTools/Source/C/LzmaCompress/LzmaCompress.c
@@ -5,7 +5,7 @@
LzmaUtil.c -- Test application for LZMA compression
2018-04-30 : Igor Pavlov : Public domain

- Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent

**/
@@ -23,6 +23,7 @@
#include "Sdk/C/LzmaEnc.h"
#include "Sdk/C/Bra.h"
#include "CommonLib.h"
+#include "ParseInf.h"

#define LZMA_HEADER_SIZE (LZMA_PROPS_SIZE + 8)

@@ -36,10 +37,14 @@ const char *kCantReadMessage = "Can not read input file";
const char *kCantWriteMessage = "Can not write output file";
const char *kCantAllocateMessage = "Can not allocate memory";
const char *kDataErrorMessage = "Data error";
+const char *kInvalidParamValMessage = "Invalid parameter value";

static Bool mQuietMode = False;
static CONVERTER_TYPE mConType = NoConverter;

+UINT64 mDictionarySize = 31;
+UINT64 mCompressionMode = 2;
+
#define UTILITY_NAME "LzmaCompress"
#define UTILITY_MAJOR_VERSION 0
#define UTILITY_MINOR_VERSION 2
@@ -58,6 +63,8 @@ void PrintHelp(char *buffer)
" -v, --verbose: increase output messages\n"
" -q, --quiet: reduce output messages\n"
" --debug [0-9]: set debug level\n"
+ " -a: set compression mode 0 = fast, 1 = normal, default: 1 (normal)\n"
+ " d: sets Dictionary size - [0, 30], default: 23 (8MB)\n"
" --version: display the program version and exit\n"
" -h, --help: display this help text\n"
);
@@ -87,7 +94,7 @@ void PrintVersion(char *buffer)
sprintf (buffer, "%s Version %d.%d %s ", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);
}

-static SRes Encode(ISeqOutStream *outStream, ISeqInStream *inStream, UInt64 fileSize)
+static SRes Encode(ISeqOutStream *outStream, ISeqInStream *inStream, UInt64 fileSize, CLzmaEncProps *props)
{
SRes res;
size_t inSize = (size_t)fileSize;
@@ -95,10 +102,6 @@ static SRes Encode(ISeqOutStream *outStream, ISeqInStream *inStream, UInt64 file
Byte *outBuffer = 0;
Byte *filteredStream = 0;
size_t outSize;
- CLzmaEncProps props;
-
- LzmaEncProps_Init(&props);
- LzmaEncProps_Normalize(&props);

if (inSize != 0) {
inBuffer = (Byte *)MyAlloc(inSize);
@@ -151,7 +154,7 @@ static SRes Encode(ISeqOutStream *outStream, ISeqInStream *inStream, UInt64 file

res = LzmaEncode(outBuffer + LZMA_HEADER_SIZE, &outSizeProcessed,
mConType != NoConverter ? filteredStream : inBuffer, inSize,
- &props, outBuffer, &outPropsSize, 0,
+ props, outBuffer, &outPropsSize, 0,
NULL, &g_Alloc, &g_Alloc);

if (res != SZ_OK)
@@ -246,6 +249,12 @@ int main2(int numArgs, const char *args[], char *rs)
const char *outputFile = "file.tmp";
int param;
UInt64 fileSize;
+ CLzmaEncProps *props;
+
+ props = (CLzmaEncProps *)AllocateZeroPool(sizeof(CLzmaEncProps));
+
+ LzmaEncProps_Init(props);
+ LzmaEncProps_Normalize(props);

FileSeqInStream_CreateVTable(&inStream);
File_Construct(&inStream.file);
@@ -280,6 +289,24 @@ int main2(int numArgs, const char *args[], char *rs)
// parameter compatibility with other build tools.
//
param++;
+ } else if (strcmp(args[param], "-a") == 0) {
+ AsciiStringToUint64(args[param + 1],FALSE,&mCompressionMode);
+ if ((mCompressionMode == 0)||(mCompressionMode == 1)){
+ props->algo = (int)mCompressionMode;
+ param++;
+ continue;
+ } else {
+ return PrintError(rs, kInvalidParamValMessage);
+ }
+ } else if (strcmp(args[param], "d") == 0) {
+ AsciiStringToUint64(args[param + 1],FALSE,&mDictionarySize);
+ if (mDictionarySize <= 30){
+ props->dictSize = (UINT32)mDictionarySize;
+ param++;
+ continue;
+ } else {
+ return PrintError(rs, kInvalidParamValMessage);
+ }
} else if (
strcmp(args[param], "-h") == 0 ||
strcmp(args[param], "--help") == 0
@@ -335,7 +362,7 @@ int main2(int numArgs, const char *args[], char *rs)
if (!mQuietMode) {
printf("Encoding\n");
}
- res = Encode(&outStream.vt, &inStream.vt, fileSize);
+ res = Encode(&outStream.vt, &inStream.vt, fileSize, props);
}
else
{
diff --git a/BaseTools/Source/C/LzmaCompress/GNUmakefile b/BaseTools/Source/C/LzmaCompress/GNUmakefile
index 533f0a59a0af..c837e7782373 100644
--- a/BaseTools/Source/C/LzmaCompress/GNUmakefile
+++ b/BaseTools/Source/C/LzmaCompress/GNUmakefile
@@ -1,13 +1,15 @@
## @file
# GNU/Linux makefile for 'LzmaCompress' module build.
#
-# Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.<BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
MAKEROOT ?= ..

APPNAME = LzmaCompress

+LIBS = -lCommon
+
SDK_C = Sdk/C

OBJECTS = \
diff --git a/BaseTools/Source/C/LzmaCompress/Makefile b/BaseTools/Source/C/LzmaCompress/Makefile
index 12be48de2940..055f5d3ac3ca 100644
--- a/BaseTools/Source/C/LzmaCompress/Makefile
+++ b/BaseTools/Source/C/LzmaCompress/Makefile
@@ -1,14 +1,14 @@
## @file
# Windows makefile for 'LzmaCompress' module build.
#
-# Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.<BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
!INCLUDE ..\Makefiles\ms.common

APPNAME = LzmaCompress

-#LIBS = $(LIB_PATH)\Common.lib
+LIBS = $(LIB_PATH)\Common.lib

SDK_C = Sdk\C

--
2.18.0.windows.1


[Patch] EmulatorPkg/TimerLib: Add missing GetTimeInNanoSecond function

Liming Gao
 

From: mjohn4 <michael.johnson@intel.com>

Add GetTimeInNanoSecond, already declared in the TimerLib API,
to EmulatorPkg implementations of TimerLib.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Johnson, Michael <michael.johnson@intel.com>
---
.../Library/DxeCoreTimerLib/DxeCoreTimerLib.c | 45 ++++++++++++++++++++-
EmulatorPkg/Library/DxeTimerLib/DxeTimerLib.c | 45 ++++++++++++++++++++-
EmulatorPkg/Library/PeiTimerLib/PeiTimerLib.c | 47 +++++++++++++++++++++-
3 files changed, 134 insertions(+), 3 deletions(-)

diff --git a/EmulatorPkg/Library/DxeCoreTimerLib/DxeCoreTimerLib.c b/EmulatorPkg/Library/DxeCoreTimerLib/DxeCoreTimerLib.c
index c331cbba9c..ab0de143c4 100644
--- a/EmulatorPkg/Library/DxeCoreTimerLib/DxeCoreTimerLib.c
+++ b/EmulatorPkg/Library/DxeCoreTimerLib/DxeCoreTimerLib.c
@@ -1,12 +1,13 @@
/** @file
A non-functional instance of the Timer Library.

- Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent

**/

#include <PiPei.h>
+#include <Library/BaseLib.h>
#include <Library/TimerLib.h>
#include <Library/DebugLib.h>
#include <Library/EmuThunkLib.h>
@@ -119,4 +120,46 @@ GetPerformanceCounterProperties (
return gEmuThunk->QueryPerformanceFrequency ();
}

+/**
+ Converts elapsed ticks of performance counter to time in nanoseconds.
+
+ This function converts the elapsed ticks of running performance counter to
+ time value in unit of nanoseconds.
+
+ @param Ticks The number of elapsed ticks of running performance counter.
+
+ @return The elapsed time in nanoseconds.
+
+**/
+UINT64
+EFIAPI
+GetTimeInNanoSecond (
+ IN UINT64 Ticks
+ )
+{
+ UINT64 Frequency;
+ UINT64 NanoSeconds;
+ UINT64 Remainder;
+ INTN Shift;
+
+ Frequency = GetPerformanceCounterProperties (NULL, NULL);
+
+ //
+ // Ticks
+ // Time = --------- x 1,000,000,000
+ // Frequency
+ //
+ NanoSeconds = MultU64x32 (DivU64x64Remainder (Ticks, Frequency, &Remainder), 1000000000u);
+
+ //
+ // Ensure (Remainder * 1,000,000,000) will not overflow 64-bit.
+ // Since 2^29 < 1,000,000,000 = 0x3B9ACA00 < 2^30, Remainder should < 2^(64-30) = 2^34,
+ // i.e. highest bit set in Remainder should <= 33.
+ //
+ Shift = MAX (0, HighBitSet64 (Remainder) - 33);
+ Remainder = RShiftU64 (Remainder, (UINTN) Shift);
+ Frequency = RShiftU64 (Frequency, (UINTN) Shift);
+ NanoSeconds += DivU64x64Remainder (MultU64x32 (Remainder, 1000000000u), Frequency, NULL);

+ return NanoSeconds;
+}
diff --git a/EmulatorPkg/Library/DxeTimerLib/DxeTimerLib.c b/EmulatorPkg/Library/DxeTimerLib/DxeTimerLib.c
index 14cae4214c..1bbc9e0162 100644
--- a/EmulatorPkg/Library/DxeTimerLib/DxeTimerLib.c
+++ b/EmulatorPkg/Library/DxeTimerLib/DxeTimerLib.c
@@ -1,7 +1,7 @@
/** @file
A non-functional instance of the Timer Library.

- Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent

**/
@@ -198,3 +198,46 @@ DxeTimerLibConstructor (
return EFI_SUCCESS;
}

+/**
+ Converts elapsed ticks of performance counter to time in nanoseconds.
+
+ This function converts the elapsed ticks of running performance counter to
+ time value in unit of nanoseconds.
+
+ @param Ticks The number of elapsed ticks of running performance counter.
+
+ @return The elapsed time in nanoseconds.
+
+**/
+UINT64
+EFIAPI
+GetTimeInNanoSecond (
+ IN UINT64 Ticks
+ )
+{
+ UINT64 Frequency;
+ UINT64 NanoSeconds;
+ UINT64 Remainder;
+ INTN Shift;
+
+ Frequency = GetPerformanceCounterProperties (NULL, NULL);
+
+ //
+ // Ticks
+ // Time = --------- x 1,000,000,000
+ // Frequency
+ //
+ NanoSeconds = MultU64x32 (DivU64x64Remainder (Ticks, Frequency, &Remainder), 1000000000u);
+
+ //
+ // Ensure (Remainder * 1,000,000,000) will not overflow 64-bit.
+ // Since 2^29 < 1,000,000,000 = 0x3B9ACA00 < 2^30, Remainder should < 2^(64-30) = 2^34,
+ // i.e. highest bit set in Remainder should <= 33.
+ //
+ Shift = MAX (0, HighBitSet64 (Remainder) - 33);
+ Remainder = RShiftU64 (Remainder, (UINTN) Shift);
+ Frequency = RShiftU64 (Frequency, (UINTN) Shift);
+ NanoSeconds += DivU64x64Remainder (MultU64x32 (Remainder, 1000000000u), Frequency, NULL);
+
+ return NanoSeconds;
+}
diff --git a/EmulatorPkg/Library/PeiTimerLib/PeiTimerLib.c b/EmulatorPkg/Library/PeiTimerLib/PeiTimerLib.c
index cce46fb366..132abb2c04 100644
--- a/EmulatorPkg/Library/PeiTimerLib/PeiTimerLib.c
+++ b/EmulatorPkg/Library/PeiTimerLib/PeiTimerLib.c
@@ -1,12 +1,13 @@
/** @file
A non-functional instance of the Timer Library.

- Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent

**/

#include <PiPei.h>
+#include <Library/BaseLib.h>
#include <Library/TimerLib.h>
#include <Library/DebugLib.h>
#include <Library/PeiServicesLib.h>
@@ -166,3 +167,47 @@ GetPerformanceCounterProperties (

return 0;
}
+
+/**
+ Converts elapsed ticks of performance counter to time in nanoseconds.
+
+ This function converts the elapsed ticks of running performance counter to
+ time value in unit of nanoseconds.
+
+ @param Ticks The number of elapsed ticks of running performance counter.
+
+ @return The elapsed time in nanoseconds.
+
+**/
+UINT64
+EFIAPI
+GetTimeInNanoSecond (
+ IN UINT64 Ticks
+ )
+{
+ UINT64 Frequency;
+ UINT64 NanoSeconds;
+ UINT64 Remainder;
+ INTN Shift;
+
+ Frequency = GetPerformanceCounterProperties (NULL, NULL);
+
+ //
+ // Ticks
+ // Time = --------- x 1,000,000,000
+ // Frequency
+ //
+ NanoSeconds = MultU64x32 (DivU64x64Remainder (Ticks, Frequency, &Remainder), 1000000000u);
+
+ //
+ // Ensure (Remainder * 1,000,000,000) will not overflow 64-bit.
+ // Since 2^29 < 1,000,000,000 = 0x3B9ACA00 < 2^30, Remainder should < 2^(64-30) = 2^34,
+ // i.e. highest bit set in Remainder should <= 33.
+ //
+ Shift = MAX (0, HighBitSet64 (Remainder) - 33);
+ Remainder = RShiftU64 (Remainder, (UINTN) Shift);
+ Frequency = RShiftU64 (Frequency, (UINTN) Shift);
+ NanoSeconds += DivU64x64Remainder (MultU64x32 (Remainder, 1000000000u), Frequency, NULL);
+
+ return NanoSeconds;
+}
--
2.13.0.windows.1


Re: [PATCH v2 0/2] *** Add VS2019 Support ***

Liming Gao
 

That's good. I have no other comment. Reviewed-by: Liming Gao <liming.gao@intel.com>

-----Original Message-----
From: Cheng, Ching JenX
Sent: Wednesday, September 18, 2019 9:51 AM
To: Gao, Liming <liming.gao@intel.com>; devel@edk2.groups.io
Subject: RE: [edk2-devel] [PATCH v2 0/2] *** Add VS2019 Support ***

Hi Liming,

The VS2017 is still working fine with this changes,
I have verified it with VS2019, VS2017 and VS2015 build,

Thanks,
Allen

-----Original Message-----
From: Gao, Liming
Sent: Tuesday, September 17, 2019 10:57 PM
To: devel@edk2.groups.io; Cheng, Ching JenX
<ching.jenx.cheng@intel.com>
Subject: RE: [edk2-devel] [PATCH v2 0/2] *** Add VS2019 Support ***

Ching:
The change is good. With this change, have you verified VS2017 tool chain?
I want to make sure there is no impact on VS2017.

Thanks
Liming
-----Original Message-----
From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
Cheng, Ching JenX
Sent: Tuesday, September 17, 2019 11:23 AM
To: devel@edk2.groups.io; Cheng, Ching JenX
<ching.jenx.cheng@intel.com>
Subject: Re: [edk2-devel] [PATCH v2 0/2] *** Add VS2019 Support ***

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

In order to support VS2019 on EDK2, the following patches was modified
def and batch files 1. Add VS2019 x86/64 definitions on tools_def.template
2. Add VS2019 support on toolsetup batches, and add version check with
command vswhere
Because VS2019 and VS2017 using the same vswhere to get the
InstallationPath

v2: In 01/02, add ARM/AARCH64/EBC Definitions, Combine VS2017_HOST
and
VS2019_HOST to VS_HOST

Ching JenX Cheng (2):
Add VS2019 Toolchain def
Add VS2019 Support on ToolSetup Batches

BaseTools/Conf/tools_def.template | 220
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++-------------------
BaseTools/get_vsvars.bat | 37
++++++++++++++++++++++++++++++-------
BaseTools/set_vsprefix_envs.bat | 70
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++-----
BaseTools/toolsetup.bat | 16 +++++++++++++---
edksetup.bat | 6 ++++--
5 files changed, 313 insertions(+), 36 deletions(-)

--
2.21.0.windows.1






Re: [PATCH v2 1/1] BaseTools: Add more parameter checking for CopyFileOnChange()

Bob Feng
 

Reviewed-by: Bob Feng <bob.c.feng@intel.com>

-----Original Message-----
From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of Steven Shi
Sent: Wednesday, September 18, 2019 11:21 AM
To: devel@edk2.groups.io
Cc: Gao, Liming <liming.gao@intel.com>; Feng, Bob C <bob.c.feng@intel.com>
Subject: [edk2-devel] [PATCH v2 1/1] BaseTools: Add more parameter checking for CopyFileOnChange()

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

The current CopyFileOnChange() method in Misc.py does not accept the input SrcFile parameter as a dir, but the method does not check the SrcFile is dir or not. This patch is to add more input parameter type checking and error message output for method CopyFileOnChange.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Signed-off-by: Steven Shi <steven.shi@intel.com>
---
BaseTools/Source/Python/Common/Misc.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Python/Common/Misc.py
index 714eb840ea..a488536cb4 100755
--- a/BaseTools/Source/Python/Common/Misc.py
+++ b/BaseTools/Source/Python/Common/Misc.py
@@ -536,7 +536,8 @@ def CopyFileOnChange(SrcFile, Dst, FileLock=None):
SrcFile = LongFilePath(SrcFile)
Dst = LongFilePath(Dst)

- if not os.path.exists(SrcFile):
+ if os.path.isdir(SrcFile):
+ EdkLogger.error(None, FILE_COPY_FAILURE,
+ ExtraData='CopyFileOnChange SrcFile is a dir, not a file: %s' %
+ SrcFile)
return False

if os.path.isdir(Dst):
--
2.17.1.windows.2


[PATCH] MdePkg: Changes in comments

Gris87
 

Simple changes for comments...

Signed-off-by: Gris87 <Gris87@yandex.ru>
---
MdePkg/Include/Protocol/AbsolutePointer.h | 12 ++++++------
MdePkg/Include/Protocol/SimplePointer.h | 4 ++--
2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/MdePkg/Include/Protocol/AbsolutePointer.h b/MdePkg/Include/P=
rotocol/AbsolutePointer.h
index 77d34ae5bd..90c9664dbd 100644
--- a/MdePkg/Include/Protocol/AbsolutePointer.h
+++ b/MdePkg/Include/Protocol/AbsolutePointer.h
@@ -33,14 +33,14 @@ typedef struct _EFI_ABSOLUTE_POINTER_PROTOCOL EFI_ABS=
OLUTE_POINTER_PROTOCOL;
**/
typedef struct {
UINT64 AbsoluteMinX; ///< The Absolute Minimum of the device on the x-=
axis
- UINT64 AbsoluteMinY; ///< The Absolute Minimum of the device on the y =
axis.
+ UINT64 AbsoluteMinY; ///< The Absolute Minimum of the device on the y-=
axis
UINT64 AbsoluteMinZ; ///< The Absolute Minimum of the device on the z-=
axis
UINT64 AbsoluteMaxX; ///< The Absolute Maximum of the device on the x-=
axis. If 0, and the
- ///< AbsoluteMinX is 0, then the pointer device d=
oes not support a xaxis
- UINT64 AbsoluteMaxY; ///< The Absolute Maximum of the device on the y =
-axis. If 0, and the
- ///< AbsoluteMinX is 0, then the pointer device d=
oes not support a yaxis.
- UINT64 AbsoluteMaxZ; ///< The Absolute Maximum of the device on the z-=
axis. If 0 , and the
- ///< AbsoluteMinX is 0, then the pointer device d=
oes not support a zaxis
+ ///< AbsoluteMinX is 0, then the pointer device d=
oes not support a x-axis
+ UINT64 AbsoluteMaxY; ///< The Absolute Maximum of the device on the y-=
axis. If 0, and the
+ ///< AbsoluteMinY is 0, then the pointer device d=
oes not support a y-axis
+ UINT64 AbsoluteMaxZ; ///< The Absolute Maximum of the device on the z-=
axis. If 0, and the
+ ///< AbsoluteMinZ is 0, then the pointer device d=
oes not support a z-axis
UINT32 Attributes; ///< The following bits are set as needed (or'd t=
ogether) to indicate the
///< capabilities of the device supported. The re=
maining bits are undefined
///< and should be 0
diff --git a/MdePkg/Include/Protocol/SimplePointer.h b/MdePkg/Include/Pro=
tocol/SimplePointer.h
index 2f5a940ff9..a63028cb80 100644
--- a/MdePkg/Include/Protocol/SimplePointer.h
+++ b/MdePkg/Include/Protocol/SimplePointer.h
@@ -54,12 +54,12 @@ typedef struct {
UINT64 ResolutionX;
///
/// The resolution of the pointer device on the y-axis in counts/mm.
- /// If 0, then the pointer device does not support an x-axis.
+ /// If 0, then the pointer device does not support an y-axis.
///
UINT64 ResolutionY;
///
/// The resolution of the pointer device on the z-axis in counts/mm.
- /// If 0, then the pointer device does not support an x-axis.
+ /// If 0, then the pointer device does not support an z-axis.
///
UINT64 ResolutionZ;
///
--=20
2.19.1


[edk2-test][Patch] uefi-sct/SctPkg: Fix invalid attribute combination

xianhui liu <xianhuix.liu@...>
 

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1942
avoid using EFI_VARIABLE_RUNTIME_ACCESS without
EFI_VARIABLE_BOOTSERVICE_ACCESS in AttrArray.

Cc: Oleksiy <oleksiyy@ami.com>
Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
Cc: Eric Jin <eric.jin@intel.com>
Signed-off-by: xianhui liu <xianhuix.liu@intel.com>
---
.../BlackBoxTest/AuthVariableServicesBBTestConformance.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)

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 a1d1c4c3..23b00e35 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
@@ -1,7 +1,7 @@
/** @file

Copyright 2006 - 2012 Unified EFI, Inc.<BR>
- Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.<BR>

This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@@ -160,19 +160,16 @@ AuthVariableDERConfTest (
// For 1 attribute.
//
EFI_VARIABLE_NON_VOLATILE,
- EFI_VARIABLE_RUNTIME_ACCESS,
EFI_VARIABLE_BOOTSERVICE_ACCESS,
EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS,

//
// For 2 attributes.
//
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_RUNTIME_ACCESS,
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS,

EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS,
- EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS,

EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS,

@@ -180,7 +177,6 @@ AuthVariableDERConfTest (
// For 3 attributes.
//
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS,
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS,
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS,
EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS,

--
2.14.1.windows.1