Date   

[edk2-platforms Patch 1/2] Hisilicon: Convert UNI files from UTF-16 to UTF-8

Michael D Kinney
 

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

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
---
.../BoardFeature2PHi1610Strings.uni | Bin 3538 -> 1780 bytes
.../Type09/MiscSystemSlotDesignation.uni | Bin 826 -> 412 bytes
2 files changed, 0 insertions(+), 0 deletions(-)

diff --git a/Platform/Hisilicon/D03/Library/OemMiscLib2P/BoardFeature2PHi1610Strings.uni b/Platform/Hisilicon/D03/Library/OemMiscLib2P/BoardFeature2PHi1610Strings.uni
index 3e321f98848ef80ad178dde66ea72366306d73e4..eb809d7dc1cd8a5a3a324309046a280174d3c978 100644
GIT binary patch
literal 1780
zcmai#-D<)>5Jv9{zQdq5tv0%|Y3&bfL5&x-Nfc9QdliDNF*Ix>iI%>7H?fFNrV|KZ
z+4=T6fdkv?LA%pwob`Iu3!`lNohR|8g!APENFn-QnGcFfnCMcaW+2~Yc~mBu?!q8V
zp`I=vSB1*=YSn!h&YzCQ1vBT}a+9Ufg|a3qrORZUsQey=fn!N)ltw$VF^fvGa|~Hl
z+rXIRW2^eK(n!ZEwFafFMF7pQj?<*rH0zNA^-#r$hTjcv&HOHk6$E9T=(so>+$!o7
z1h4bZ8++6FM;I)IBX<x4;lh9Mr*A%(r*5m$hdO93^rz0g^l6_n@jP(U-uxK2*)l4#
z91h2uvZ@XoVH@(3O4n5S;Rr=og+n1k)%K^Z`Fw4P{tY4#>~ld$1aFuiQmD6FkV3uV
zf)pwWCMhXaL@r6eqU4e!t<5BDlJ<&AlC+#ZHc86}gru^_7=(hPWfVd|(lQPqX{}@&
zLZoOV;}9Z6D;bB7^j0zsp(JS;hftEVj6+CzD>;X3l9qFb^j2059WRfuUNILz<Ln1G
C8}9o6

literal 3538
zcmbuCTW`}q5QWckCH{leyg<PO+fXh7B+~EzByB~gfTyTx(lnw<P?8q$=Yel*hg<{?
zlhMlSop^T6%-Qi#{QFl^O(i<eea0T^W<4i5(p2B|Q!|Y<(v=qY-PMKeanJRLamXsI
ztql7C>vx*qIn*_4i!dXG&FB0&W;M}6p1k3?d8}g3OKYe(duO_39^m;>Eq&DMt;~8l
zRa;-c?hx|=-$}VI1$|IjhIPqhv0f0lr5-y{@=nR>nrv?B9j9ex7Gbf4lHz+%@^Pnp
z@=6Wa%C1HkV*)RRcL{<;NOcBIqJ6!^8sRer<qCVb&-ksP8S5=}jqsVU-rSK;*?Ae`
zhWiM=gvg7MFN-|?8>Px-zV^&KKfzjGU7~h%!ul&#kL+4h-+}!eqmO;84_qhu%$(F?
zRoe=Cy*jJ!jNHC)P4$EMfAzIFk1ivD`yppqot4!#<<zVrtTPg-*{*EGQJcOhYR=dF
zR#kTDDvzn?NY;ma@G9g!mW^d?$=b>NySjb7*OR)U#ztly#LS6!7)H#Uh);uv#<P#r
zXJJGytIxxTURI5j>TTGycT8D*yk_)#6w}LWhLT1x{oEEo%wh*_ABQph+(z}M;B>q_
z6jLDUdw<`?G{`Xh+{RSMF#X)dbjaRsFSn*5k@wRuz1-&Ph+=xV&4W5*I_Bp#rbCA5
w=QgH8hUw=vrb8M3+x*-{b*R{Z+o%rt^)}a1hc>^t>?>e^c6+}DmQnWf2e10@TmS$7

diff --git a/Silicon/Hisilicon/Drivers/Smbios/SmbiosMiscDxe/Type09/MiscSystemSlotDesignation.uni b/Silicon/Hisilicon/Drivers/Smbios/SmbiosMiscDxe/Type09/MiscSystemSlotDesignation.uni
index 6e77b63a5c95db642825d4d1228003699a34d785..1983200ccf8eac4cec2fc9a958b0836a1b7c3607 100644
GIT binary patch
literal 412
zcmb7=Piq1(5XJ9;-(grUtr}N7cqnZ_cb9fy{e#&;ds@Qo7zbh^Ni6v78$;=-hxRZ$
zhWGgKcxej5(Wu``)7wF2&R0wF=;5xthxv5602X969Yd)-st~YeV}&Q9C$LlsV%mX4
zhxQY@$>VDO{3~j<7{e<$Qq&p^6`jb3`2QIdX<^OZ0I>+)<?pPb7PUiGcBnla2<-!`
zc+Tc5Q{obgo$$f=8G^B4SR}kpgPRPL(6Yk=pk{9zl0r*G?wCZ+c}rRXulLQm<XOW%
tcwMX;UTy0pFL?Q~S=Qxt0}*l&62B>s@T>E90<MgQ934p=myOtd?+d$?c~AfV

literal 826
zcmchVOH0F05QWcL@IPGIjaFlA7cN8v+XgMPwwMaK3Z;)&s8Nzu@XxE?Tw_z0f=HN~
znYnZ4oOyh_*HxEOO$U6t+QF)C{!VQ@>qT$Mv{0f)t%%*zMEm@kI_5h;3ks`&eTd#w
zO5{vSbjy&D!_G0@1zM^jZZ5gEh%$HXt(kJ(W_snE5_zVUZguesRt;Dgk899!WQj~X
zu2T>F2{C?_{XcjZW=i!L9R8BQ_q?1U4b{;-lQ66awWYp`0kfET%Q`<tth1-EXz`{)
zd=qKYp|RG*i=m&BWms)`ULpm=*NPqa@}8^e<IJl1Oewo!sB>^EPoO){oGJ>j5<ice
zZK`a&%R#eEuzRa##LQ#$;UB>-=6vwp5T98+4Ty=UA;jwHN;hoO2yKAowwSD`CxORL
gF2*KevkiB~Mi}Oj`Phbc@YvoYuqk)8WNVdv0^sR;O#lD@

--
2.21.0.windows.1


[edk2-platforms Patch 0/2] Convert UNI files from UTF-16 to UTF-8

Michael D Kinney
 

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

Convert UNI files in Hisilicon and Marvel packages from UTF-16 to UTF-8.

There are no file content changes in these patches.

The patch files show these as binary files due to the UTF-16 encoding. Future
updates to these files in UTF-8 format will show the changes as text files.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>

Michael D Kinney (2):
Hisilicon: Convert UNI files from UTF-16 to UTF-8
Marvel: Convert UNI files from UTF-16 to UTF-8

.../BoardFeature2PHi1610Strings.uni | Bin 3538 -> 1780 bytes
.../Type09/MiscSystemSlotDesignation.uni | Bin 826 -> 412 bytes
.../Applications/EepromCmd/EepromCmd.uni | Bin 3558 -> 1778 bytes
.../Applications/FirmwareUpdate/FUpdate.uni | Bin 3500 -> 1749 bytes
.../Applications/SpiTool/SpiFlashCmd.uni | Bin 3958 -> 1978 bytes
5 files changed, 0 insertions(+), 0 deletions(-)

--
2.21.0.windows.1


Re: [PATCH 7/9] ArmPkg: ArmScmiDxe - convert .h to UTF-8 from 8859-x

Michael D Kinney
 

Leif,

We prefer ASCII only in source files. I have deleted or changed
to an appropriate ASCII character when I have seen these types
of special symbols.

Mike

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On
Behalf Of Leif Lindholm
Sent: Wednesday, September 18, 2019 3:43 PM
To: devel@edk2.groups.io
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: [edk2-devel] [PATCH 7/9] ArmPkg: ArmScmiDxe -
convert .h to UTF-8 from 8859-x

A paragraph sign in a comment came from some ISO8859
encoding, convert it (and hence the file) to UTF-8.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
---

ArmPkg/Drivers/ArmScmiDxe/ArmScmiPerformanceProtocolPri
vate.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git
a/ArmPkg/Drivers/ArmScmiDxe/ArmScmiPerformanceProtocolP
rivate.h
b/ArmPkg/Drivers/ArmScmiDxe/ArmScmiPerformanceProtocolP
rivate.h
index ee8734bbaab0..ece84eeff32e 100644
---
a/ArmPkg/Drivers/ArmScmiDxe/ArmScmiPerformanceProtocolP
rivate.h
+++
b/ArmPkg/Drivers/ArmScmiDxe/ArmScmiPerformanceProtocolP
rivate.h
@@ -23,7 +23,7 @@
#define NUM_REMAIN_PERF_LEVELS(Lvls) (Lvls >>
NUM_REMAIN_PERF_LEVELS_SHIFT)

/** Return values for
SCMI_MESSAGE_ID_PERFORMANCE_DESCRIBE_LEVELS command.
- SCMI Spec 4.5.2.5
+ SCMI Spec § 4.5.2.5
**/
typedef struct {
UINT32 NumLevels;
--
2.20.1



Re: [PATCH 9/9] EmbeddedPkg: convert Lauterbach README.txt to UTF-8

Michael D Kinney
 

Leif,

Since this is a readme file, perhaps those should be changed
to `text` markdown style in an ASCII text file and rename the
file to README.md so it is rendered correctly from the GitHub
web view.

Mike

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On
Behalf Of Leif Lindholm
Sent: Wednesday, September 18, 2019 3:44 PM
To: devel@edk2.groups.io
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: [edk2-devel] [PATCH 9/9] EmbeddedPkg: convert
Lauterbach README.txt to UTF-8

This file contained what looked like windows 1250
encoded single quotation marks. Convert them to UTF-8.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
---
EmbeddedPkg/Scripts/LauterbachT32/README.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git
a/EmbeddedPkg/Scripts/LauterbachT32/README.txt
b/EmbeddedPkg/Scripts/LauterbachT32/README.txt
index 06602ab8763a..5b323375ae35 100644
--- a/EmbeddedPkg/Scripts/LauterbachT32/README.txt
+++ b/EmbeddedPkg/Scripts/LauterbachT32/README.txt
@@ -1,7 +1,7 @@
DXE Phase Debug
===============
-Update the memsize variable in EfiLoadDxe.cmm for the
actual amount of memory available in your system.
Allow your system to boot to the point that the DXE
core is initialized (so that the System Table and Debug
Information table is present in memory) and execute
this script (using the toolbar button or do EfiLoadDxe
from the command area). It will scan memory for the
debug info table and load modules in it.
+Update the memsize variable in EfiLoadDxe.cmm for the
actual amount of memory available in your system.
Allow your system to boot to the point that the DXE
core is initialized (so that the System Table and Debug
Information table is present in memory) and execute
this script (using the toolbar button or ‘do
EfiLoadDxe’ from the command area). It will scan
memory for the debug info table and load modules in it.

SEC/PEI Phase Debug
===================
-There is no way to autodetect where these images
reside so you must pass an address for the memory-
mapped Firmware Volume containing these images. To do
this, enter do EfiLoadFv <addr> where <addr> is the
base address for the firmware volume containing the SEC
or PEI code. To be more efficient you may want to
create a script that calls this, like
MyBoardLoadSec.cmm which contains the call to
EfiLoadFv. You can them map this script to a T32 menu
or toolbar button for quick access.
+There is no way to autodetect where these images
reside so you must pass an address for the memory-
mapped Firmware Volume containing these images. To do
this, enter ‘do EfiLoadFv <addr>’ where <addr> is the
base address for the firmware volume containing the SEC
or PEI code. To be more efficient you may want to
create a script that calls this, like
MyBoardLoadSec.cmm which contains the call to
EfiLoadFv. You can them map this script to a T32 menu
or toolbar button for quick access.
--
2.20.1



Re: [PATCH 3/9] NetworkPkg: add missing newline at end of file

Siyuan, Fu
 

Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>

-----Original Message-----
From: Leif Lindholm <leif.lindholm@linaro.org>
Sent: 2019年9月19日 6:43
To: devel@edk2.groups.io
Cc: Fu, Siyuan <siyuan.fu@intel.com>; Wu, Jiaxin <jiaxin.wu@intel.com>
Subject: [PATCH 3/9] NetworkPkg: add missing newline at end of file

Add missing newline at end of WifiConnectionManagerDxe .uni.

Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
---

NetworkPkg/WifiConnectionManagerDxe/WifiConnectionManagerDxeStrings
.uni | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git
a/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionManagerDxeStrin
gs.uni
b/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionManagerDxeStri
ngs.uni
index 3f2b068fb827..187e5047aa9c 100644
---
a/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionManagerDxeStrin
gs.uni
+++
b/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionManagerDxeStri
ngs.uni
@@ -100,4 +100,4 @@
#string STR_ADD_HIDDEN_NETWORK #language en-US "Add Hidden
Network"
#string STR_HIDDEN_NETWORK_LIST #language en-US "Hidden
Network List"
#string STR_REMOVE_HIDDEN_NETWORK_HELP #language en-US ""
-#string STR_REMOVE_HIDDEN_NETWORK #language en-US "Remove
Hidden Network"
\ No newline at end of file
+#string STR_REMOVE_HIDDEN_NETWORK #language en-US "Remove
Hidden Network"
--
2.20.1


[PATCH 9/9] EmbeddedPkg: convert Lauterbach README.txt to UTF-8

Leif Lindholm
 

This file contained what looked like windows 1250 encoded single
quotation marks. Convert them to UTF-8.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
---
EmbeddedPkg/Scripts/LauterbachT32/README.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/EmbeddedPkg/Scripts/LauterbachT32/README.txt b/EmbeddedPkg/Scripts/LauterbachT32/README.txt
index 06602ab8763a..5b323375ae35 100644
--- a/EmbeddedPkg/Scripts/LauterbachT32/README.txt
+++ b/EmbeddedPkg/Scripts/LauterbachT32/README.txt
@@ -1,7 +1,7 @@
DXE Phase Debug
===============
-Update the memsize variable in EfiLoadDxe.cmm for the actual amount of memory available in your system. Allow your system to boot to the point that the DXE core is initialized (so that the System Table and Debug Information table is present in memory) and execute this script (using the toolbar button or do EfiLoadDxe from the command area). It will scan memory for the debug info table and load modules in it.
+Update the memsize variable in EfiLoadDxe.cmm for the actual amount of memory available in your system. Allow your system to boot to the point that the DXE core is initialized (so that the System Table and Debug Information table is present in memory) and execute this script (using the toolbar button or ‘do EfiLoadDxe’ from the command area). It will scan memory for the debug info table and load modules in it.

SEC/PEI Phase Debug
===================
-There is no way to autodetect where these images reside so you must pass an address for the memory-mapped Firmware Volume containing these images. To do this, enter do EfiLoadFv <addr> where <addr> is the base address for the firmware volume containing the SEC or PEI code. To be more efficient you may want to create a script that calls this, like MyBoardLoadSec.cmm which contains the call to EfiLoadFv. You can them map this script to a T32 menu or toolbar button for quick access.
+There is no way to autodetect where these images reside so you must pass an address for the memory-mapped Firmware Volume containing these images. To do this, enter ‘do EfiLoadFv <addr>’ where <addr> is the base address for the firmware volume containing the SEC or PEI code. To be more efficient you may want to create a script that calls this, like MyBoardLoadSec.cmm which contains the call to EfiLoadFv. You can them map this script to a T32 menu or toolbar button for quick access.
--
2.20.1


[PATCH 8/9] BaseTools: correct line endings for ConvertFce Python script

Leif Lindholm
 

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
---
BaseTools/Scripts/ConvertFceToStructurePcd.py | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/BaseTools/Scripts/ConvertFceToStructurePcd.py b/BaseTools/Scripts/ConvertFceToStructurePcd.py
index 10f19dbe2f3c..89e6a727a201 100644
--- a/BaseTools/Scripts/ConvertFceToStructurePcd.py
+++ b/BaseTools/Scripts/ConvertFceToStructurePcd.py
@@ -506,8 +506,8 @@ class mainprocess(object):
for i in range(len(info_list)-1,-1,-1):
if len(info_list[i]) == 0:
info_list.remove(info_list[i])
- for i in (inf_list, title_all, header_list):
- i.sort()
+ for i in (inf_list, title_all, header_list):
+ i.sort()
return keys,title_all,info_list,header_list,inf_list

def remove_bracket(self,List):
@@ -519,9 +519,9 @@ class mainprocess(object):
List[List.index(i)][i.index(j)] = "|".join(tmp)
else:
List[List.index(i)][i.index(j)] = j
- for i in List:
- if type(i) == type([0,0]):
- i.sort()
+ for i in List:
+ if type(i) == type([0,0]):
+ i.sort()
return List

def write_all(self):
--
2.20.1


[PATCH 7/9] ArmPkg: ArmScmiDxe - convert .h to UTF-8 from 8859-x

Leif Lindholm
 

A paragraph sign in a comment came from some ISO8859 encoding,
convert it (and hence the file) to UTF-8.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
---
ArmPkg/Drivers/ArmScmiDxe/ArmScmiPerformanceProtocolPrivate.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ArmPkg/Drivers/ArmScmiDxe/ArmScmiPerformanceProtocolPrivate.h b/ArmPkg/Drivers/ArmScmiDxe/ArmScmiPerformanceProtocolPrivate.h
index ee8734bbaab0..ece84eeff32e 100644
--- a/ArmPkg/Drivers/ArmScmiDxe/ArmScmiPerformanceProtocolPrivate.h
+++ b/ArmPkg/Drivers/ArmScmiDxe/ArmScmiPerformanceProtocolPrivate.h
@@ -23,7 +23,7 @@
#define NUM_REMAIN_PERF_LEVELS(Lvls) (Lvls >> NUM_REMAIN_PERF_LEVELS_SHIFT)

/** Return values for SCMI_MESSAGE_ID_PERFORMANCE_DESCRIBE_LEVELS command.
- SCMI Spec 4.5.2.5
+ SCMI Spec § 4.5.2.5
**/
typedef struct {
UINT32 NumLevels;
--
2.20.1


[PATCH 6/9] DynamicTablesPkg: fix .dsc line ending

Leif Lindholm
 

Correct line ending in package .dsc.

Cc: Sami Mujawar <Sami.Mujawar@arm.com>
Cc: Alexei Fedorov <Alexei.Fedorov@arm.com>
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
---
DynamicTablesPkg/DynamicTablesPkg.dsc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/DynamicTablesPkg/DynamicTablesPkg.dsc b/DynamicTablesPkg/DynamicTablesPkg.dsc
index dfe6c0711105..ef958077ed48 100644
--- a/DynamicTablesPkg/DynamicTablesPkg.dsc
+++ b/DynamicTablesPkg/DynamicTablesPkg.dsc
@@ -4,7 +4,7 @@
# Copyright (c) 2019, Linaro Limited. All rights reserved.<BR>
# Copyright (c) 2019, ARM Limited. All rights reserved.<BR>
#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
+# SPDX-License-Identifier: BSD-2-Clause-Patent
#
##

--
2.20.1


[PATCH 5/9] BaseTools: fix line endings in SetupGit.py Conf files

Leif Lindholm
 

A file header license/copyright header copied around in commit
5b3e695d8ac5 ("BaseTools: add centralized location for git config files")
was missing a CR - add it in both faulty locations.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
---
BaseTools/Conf/diff.order | 2 +-
BaseTools/Conf/gitattributes | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Conf/diff.order b/BaseTools/Conf/diff.order
index 68b926ca94aa..4361817012c9 100644
--- a/BaseTools/Conf/diff.order
+++ b/BaseTools/Conf/diff.order
@@ -2,7 +2,7 @@
# Copyright (c) 2019, Linaro Ltd. All rights reserved.
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
+#
*.dec
*.dsc.inc
*.dsc
diff --git a/BaseTools/Conf/gitattributes b/BaseTools/Conf/gitattributes
index 9b6ab81a475b..58b93e9d4c27 100644
--- a/BaseTools/Conf/gitattributes
+++ b/BaseTools/Conf/gitattributes
@@ -2,7 +2,7 @@
# Copyright (c) 2019, Linaro Ltd. All rights reserved.
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
+#
*.efi -diff
*.EFI -diff
*.bin -diff
--
2.20.1


[PATCH 4/9] EmbeddedPkg: delete outdated FdtLib README.txt

Leif Lindholm
 

While looking at encoding and line ending errors, I found this file
in fact simply points to a sourceforge page which no longer exists.
Since there is nothing more to say than "this is an import of
libfdt", let's just delete it.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
---
EmbeddedPkg/Library/FdtLib/README.txt | 1 -
1 file changed, 1 deletion(-)

diff --git a/EmbeddedPkg/Library/FdtLib/README.txt b/EmbeddedPkg/Library/FdtLib/README.txt
deleted file mode 100644
index fb4010539f73..000000000000
--- a/EmbeddedPkg/Library/FdtLib/README.txt
+++ /dev/null
@@ -1 +0,0 @@
-See: https://sourceforge.net/apps/mediawiki/tianocore/index.php?title=EmbeddedPkg/Fdt
\ No newline at end of file
--
2.20.1


[PATCH 3/9] NetworkPkg: add missing newline at end of file

Leif Lindholm
 

Add missing newline at end of WifiConnectionManagerDxe .uni.

Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
---
NetworkPkg/WifiConnectionManagerDxe/WifiConnectionManagerDxeStrings.uni | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionManagerDxeStrings.uni b/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionManagerDxeStrings.uni
index 3f2b068fb827..187e5047aa9c 100644
--- a/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionManagerDxeStrings.uni
+++ b/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionManagerDxeStrings.uni
@@ -100,4 +100,4 @@
#string STR_ADD_HIDDEN_NETWORK #language en-US "Add Hidden Network"
#string STR_HIDDEN_NETWORK_LIST #language en-US "Hidden Network List"
#string STR_REMOVE_HIDDEN_NETWORK_HELP #language en-US ""
-#string STR_REMOVE_HIDDEN_NETWORK #language en-US "Remove Hidden Network"
\ No newline at end of file
+#string STR_REMOVE_HIDDEN_NETWORK #language en-US "Remove Hidden Network"
--
2.20.1


[PATCH 2/9] EmbeddedPkg: add missing newline at end of TemplateResetSystemLib.inf

Leif Lindholm
 

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
---
EmbeddedPkg/Library/TemplateResetSystemLib/TemplateResetSystemLib.inf | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/EmbeddedPkg/Library/TemplateResetSystemLib/TemplateResetSystemLib.inf b/EmbeddedPkg/Library/TemplateResetSystemLib/TemplateResetSystemLib.inf
index 434f4ef298c7..cd7a9f845d53 100644
--- a/EmbeddedPkg/Library/TemplateResetSystemLib/TemplateResetSystemLib.inf
+++ b/EmbeddedPkg/Library/TemplateResetSystemLib/TemplateResetSystemLib.inf
@@ -27,4 +27,4 @@ [Packages]

[LibraryClasses]
IoLib
- DebugLib
\ No newline at end of file
+ DebugLib
--
2.20.1


[PATCH 1/9] BaseTools: add missing newlines at end of files

Leif Lindholm
 

Some scripts in Source/Python were missing newlines at end of files,
so add them.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
---
BaseTools/Source/Python/AutoGen/DataPipe.py | 2 +-
BaseTools/Source/Python/Common/DataType.py | 2 +-
BaseTools/Source/Python/Common/GlobalData.py | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/DataPipe.py b/BaseTools/Source/Python/AutoGen/DataPipe.py
index 8b8cfd1c51eb..078bafecb45b 100755
--- a/BaseTools/Source/Python/AutoGen/DataPipe.py
+++ b/BaseTools/Source/Python/AutoGen/DataPipe.py
@@ -163,4 +163,4 @@ class MemoryDataPipe(DataPipe):

self.DataContainer = {"BinCacheDest":GlobalData.gBinCacheDest}

- self.DataContainer = {"EnableGenfdsMultiThread":GlobalData.gEnableGenfdsMultiThread}
\ No newline at end of file
+ self.DataContainer = {"EnableGenfdsMultiThread":GlobalData.gEnableGenfdsMultiThread}
diff --git a/BaseTools/Source/Python/Common/DataType.py b/BaseTools/Source/Python/Common/DataType.py
index 8ae1bd28fabf..5d49afb0a92a 100644
--- a/BaseTools/Source/Python/Common/DataType.py
+++ b/BaseTools/Source/Python/Common/DataType.py
@@ -532,4 +532,4 @@ PACK_CODE_BY_SIZE = {8:'=Q',
0:'=B',
16:""}

-TAB_COMPILER_MSFT = 'MSFT'
\ No newline at end of file
+TAB_COMPILER_MSFT = 'MSFT'
diff --git a/BaseTools/Source/Python/Common/GlobalData.py b/BaseTools/Source/Python/Common/GlobalData.py
index 8eb72aa1d6f5..74c6d0079bba 100755
--- a/BaseTools/Source/Python/Common/GlobalData.py
+++ b/BaseTools/Source/Python/Common/GlobalData.py
@@ -129,4 +129,4 @@ file_lock = None
# Common dictionary to share platform libraries' constant Pcd
libConstPcd = None
# Common dictionary to share platform libraries' reference info
-Refes = None
\ No newline at end of file
+Refes = None
--
2.20.1


[PATCH 0/9] Various line ending and encoding fixes

Leif Lindholm
 

I have started looking into doing the CRLF->native conversion for EDK2,
and as part of my initial scan, I found a bunch of trivial issues that
would be easier to just fix beforehand.

Leif Lindholm (9):
BaseTools: add missing newlines at end of files
EmbeddedPkg: add missing newline at end of TemplateResetSystemLib.inf
NetworkPkg: add missing newline at end of file
EmbeddedPkg: delete outdated FdtLib README.txt
BaseTools: fix line endings in SetupGit.py Conf files
DynamicTablesPkg: fix .dsc line ending
ArmPkg: ArmScmiDxe - convert .h to UTF-8 from 8859-x
BaseTools: correct line endings for ConvertFce Python script
EmbeddedPkg: convert Lauterbach README.txt to UTF-8

ArmPkg/Drivers/ArmScmiDxe/ArmScmiPerformanceProtocolPrivate.h | 2 +-
BaseTools/Conf/diff.order | 2 +-
BaseTools/Conf/gitattributes | 2 +-
BaseTools/Scripts/ConvertFceToStructurePcd.py | 10 +++++-----
BaseTools/Source/Python/AutoGen/DataPipe.py | 2 +-
BaseTools/Source/Python/Common/DataType.py | 2 +-
BaseTools/Source/Python/Common/GlobalData.py | 2 +-
DynamicTablesPkg/DynamicTablesPkg.dsc | 2 +-
EmbeddedPkg/Library/FdtLib/README.txt | 1 -
EmbeddedPkg/Library/TemplateResetSystemLib/TemplateResetSystemLib.inf | 2 +-
EmbeddedPkg/Scripts/LauterbachT32/README.txt | 4 ++--
NetworkPkg/WifiConnectionManagerDxe/WifiConnectionManagerDxeStrings.uni | 2 +-
12 files changed, 16 insertions(+), 17 deletions(-)
delete mode 100644 EmbeddedPkg/Library/FdtLib/README.txt

Cc: Alexei Fedorov <Alexei.Fedorov@arm.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Sami Mujawar <Sami.Mujawar@arm.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
--
2.20.1


Re: [Patch] EmulatorPkg/TimerLib: Add missing GetTimeInNanoSecond function

Ni, Ray
 

Reviewed-by: Ray Ni <ray.ni@intel.com>

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Jordan Justen
Sent: Wednesday, September 18, 2019 11:53 AM
To: Gao, Liming <liming.gao@intel.com>; devel@edk2.groups.io
Cc: Johnson, Michael <michael.johnson@intel.com>; Andrew Fish <afish@apple.com>; Ni, Ray <ray.ni@intel.com>;
Johnson
Subject: Re: [edk2-devel] [Patch] EmulatorPkg/TimerLib: Add missing GetTimeInNanoSecond function

On 2019-09-18 01:13:54, Liming Gao wrote:
From: mjohn4 <michael.johnson@intel.com>
It looks like the author is not set properly. If you run "git log -1",
then it'll probably show mjohn4 rather than Michael Johnson.

Michael should run:

$ git config --global user.name "Michael Johnson"

After that when git commit it will get the correct author name in the
patch.

Michael, Liming: You can adjust it locally with:

git commit --amend --author="Michael Johnson <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>
To be a valid email address, I think this should either be:

Signed-off-by: "Johnson, Michael" <michael.johnson@intel.com>

or

Signed-off-by: Michael Johnson <michael.johnson@intel.com>

The second form is more common.

If user.name was set as above then "git commit -s" would add it to the
patch automatically, and correctly.

Aside from all that, it seems like the code matches other
implementations in edk2, so:

Reviewed-by: Jordan Justen <jordan.l.justen@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] EmulatorPkg/TimerLib: Add missing GetTimeInNanoSecond function

Jordan Justen
 

On 2019-09-18 01:13:54, Liming Gao wrote:
From: mjohn4 <michael.johnson@intel.com>
It looks like the author is not set properly. If you run "git log -1",
then it'll probably show mjohn4 rather than Michael Johnson.

Michael should run:

$ git config --global user.name "Michael Johnson"

After that when git commit it will get the correct author name in the
patch.

Michael, Liming: You can adjust it locally with:

git commit --amend --author="Michael Johnson <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>
To be a valid email address, I think this should either be:

Signed-off-by: "Johnson, Michael" <michael.johnson@intel.com>

or

Signed-off-by: Michael Johnson <michael.johnson@intel.com>

The second form is more common.

If user.name was set as above then "git commit -s" would add it to the
patch automatically, and correctly.

Aside from all that, it seems like the code matches other
implementations in edk2, so:

Reviewed-by: Jordan Justen <jordan.l.justen@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 V3] UefiCpuPkg/CpuExceptionHandlerLib: Fix split lock

Laszlo Ersek
 

On 09/18/19 17:43, 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.
This patch should have been posted as "v4" actually -- it differs from
what you originally posted as v3. Therefore it cannot be considered v3.

The changelog in the patch would say,

v4:
The v3 posting didn't do what it promised to do, so do it now for real.

v3:
<whatever it originally said>

Anyway, not a deal breaker. More comments below.

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 | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.nasm b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.nasm
index 4db1a09f28..19198f2731 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.nasm
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.nasm
@@ -184,17 +184,19 @@ HasErrorCode:
push rax
push rax
sidt [rsp]
- xchg rax, [rsp + 2]
- xchg rax, [rsp]
- xchg rax, [rsp + 8]
+ mov bx, word [rsp]
+ mov rax, qword [rsp + 2]
+ mov qword [rsp], rax
+ mov word [rsp + 8], bx

xor rax, rax
push rax
push rax
sgdt [rsp]
- xchg rax, [rsp + 2]
- xchg rax, [rsp]
- xchg rax, [rsp + 8]
+ mov bx, word [rsp]
+ mov rax, qword [rsp + 2]
+ mov qword [rsp], rax
+ mov word [rsp + 8], bx

;; UINT64 Ldtr, Tr;
xor rax, rax
I think it would be nice to learn why XCHG was used in the first place.
Then again, whatever it was preferred for, it could not have been
locking, as the three XCHG instructions are not atomic as a whole (i.e.
they are not locked all together).

Another reason for XCHG could be that they wanted to use just one
register -- but I totally don't see the point of not using BX too.

So:

Reviewed-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/18/19 17:55, Andrew Fish wrote:


On Sep 18, 2019, at 1:41 AM, Laszlo Ersek <lersek@redhat.com> wrote:

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:
Laszlo,

I think helping people NOT write nonsensical code is good. It is very good idea and I'd like to add it to the spec but as you point out it would break a lot of existing code so I'm not sure it is possible. I guess we could try to add a strict mode to the spec but given the types are defined in tables that may be problematic.

We have coding standards that are more strict than what the C spec allows. So I would see the STRICT_UEFI_TYPES as more of a enforce the coding standard kind of thing?
Hmmm, okay. That makes sense. The macro could be advertised as, "this
will give your project / platform some extra safety, but it will place
coding style requirements on your project / platform that go beyond, and
sometimes conflict (in case of semantically bogus code), with the UEFI
spec".

Thanks
Laszlo


Re: [PATCH 02/35] EmbeddedPkg: add missing EFIAPI calling convention specifiers

Leif Lindholm
 

On Tue, Sep 17, 2019 at 09:49:02PM +0200, Laszlo Ersek wrote:
This patch is unrelated to the rest of the series; it just makes sure that
"EmbeddedPkg/EmbeddedPkg.dsc" builds for all platforms advertised in
SUPPORTED_ARCHITECTURES (in particular, X64).
Hmm, I'm nearly 100% sure I have tested that in the past, but it
certainly doesn't work with my GCC8 compiler.

No functional changes.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---

Notes:
build-tested only
Well, EFIAPI is either a no-op or required for proper functionality to
begin with, so...

Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>

EmbeddedPkg/Drivers/SataSiI3132Dxe/SataSiI3132.h | 32 +++++++++++++++-----
EmbeddedPkg/GdbStub/GdbStubInternal.h | 9 ++++++
EmbeddedPkg/Drivers/ConsolePrefDxe/ConsolePrefDxe.c | 1 +
EmbeddedPkg/Drivers/Lan9118Dxe/Lan9118Dxe.c | 1 +
EmbeddedPkg/Drivers/SataSiI3132Dxe/SiI3132AtaPassThru.c | 8 +++++
EmbeddedPkg/MetronomeDxe/Metronome.c | 1 +
6 files changed, 44 insertions(+), 8 deletions(-)

diff --git a/EmbeddedPkg/Drivers/SataSiI3132Dxe/SataSiI3132.h b/EmbeddedPkg/Drivers/SataSiI3132Dxe/SataSiI3132.h
index e3db0821c38f..20636574c271 100644
--- a/EmbeddedPkg/Drivers/SataSiI3132Dxe/SataSiI3132.h
+++ b/EmbeddedPkg/Drivers/SataSiI3132Dxe/SataSiI3132.h
@@ -205,7 +205,9 @@ SataSiI3132DriverBindingStop (
IN EFI_HANDLE *ChildHandleBuffer
);

-EFI_STATUS SiI3132AtaPassThruCommand (
+EFI_STATUS
+EFIAPI
+SiI3132AtaPassThruCommand (
IN SATA_SI3132_INSTANCE *pSataSiI3132Instance,
IN SATA_SI3132_PORT *pSataPort,
IN UINT16 PortMultiplierPort,
@@ -216,7 +218,9 @@ EFI_STATUS SiI3132AtaPassThruCommand (
/**
* EFI ATA Pass Thru Protocol
*/
-EFI_STATUS SiI3132AtaPassThru (
+EFI_STATUS
+EFIAPI
+SiI3132AtaPassThru (
IN EFI_ATA_PASS_THRU_PROTOCOL *This,
IN UINT16 Port,
IN UINT16 PortMultiplierPort,
@@ -224,37 +228,49 @@ EFI_STATUS SiI3132AtaPassThru (
IN EFI_EVENT Event OPTIONAL
);

-EFI_STATUS SiI3132GetNextPort (
+EFI_STATUS
+EFIAPI
+SiI3132GetNextPort (
IN EFI_ATA_PASS_THRU_PROTOCOL *This,
IN OUT UINT16 *Port
);

-EFI_STATUS SiI3132GetNextDevice (
+EFI_STATUS
+EFIAPI
+SiI3132GetNextDevice (
IN EFI_ATA_PASS_THRU_PROTOCOL *This,
IN UINT16 Port,
IN OUT UINT16 *PortMultiplierPort
);

-EFI_STATUS SiI3132BuildDevicePath (
+EFI_STATUS
+EFIAPI
+SiI3132BuildDevicePath (
IN EFI_ATA_PASS_THRU_PROTOCOL *This,
IN UINT16 Port,
IN UINT16 PortMultiplierPort,
IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
);

-EFI_STATUS SiI3132GetDevice (
+EFI_STATUS
+EFIAPI
+SiI3132GetDevice (
IN EFI_ATA_PASS_THRU_PROTOCOL *This,
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
OUT UINT16 *Port,
OUT UINT16 *PortMultiplierPort
);

-EFI_STATUS SiI3132ResetPort (
+EFI_STATUS
+EFIAPI
+SiI3132ResetPort (
IN EFI_ATA_PASS_THRU_PROTOCOL *This,
IN UINT16 Port
);

-EFI_STATUS SiI3132ResetDevice (
+EFI_STATUS
+EFIAPI
+SiI3132ResetDevice (
IN EFI_ATA_PASS_THRU_PROTOCOL *This,
IN UINT16 Port,
IN UINT16 PortMultiplierPort
diff --git a/EmbeddedPkg/GdbStub/GdbStubInternal.h b/EmbeddedPkg/GdbStub/GdbStubInternal.h
index b8346d7a545f..b08159302cfa 100644
--- a/EmbeddedPkg/GdbStub/GdbStubInternal.h
+++ b/EmbeddedPkg/GdbStub/GdbStubInternal.h
@@ -323,6 +323,7 @@ SendError (
Send 'OK' when the function is done executing successfully.
**/
VOID
+EFIAPI
SendSuccess (
VOID
);
@@ -332,6 +333,7 @@ SendSuccess (
Send empty packet to specify that particular command/functionality is not supported.
**/
VOID
+EFIAPI
SendNotSupported (
VOID
);
@@ -353,6 +355,7 @@ ReadNthRegister (
@param SystemContext Register content at time of the exception
**/
VOID
+EFIAPI
ReadGeneralRegisters (
IN EFI_SYSTEM_CONTEXT SystemContext
);
@@ -364,6 +367,7 @@ ReadGeneralRegisters (
@param InBuffer This is the input buffer received from gdb server
**/
VOID
+EFIAPI
WriteNthRegister (
IN EFI_SYSTEM_CONTEXT SystemContext,
IN CHAR8 *InBuffer
@@ -377,6 +381,7 @@ WriteNthRegister (
**/

VOID
+EFIAPI
WriteGeneralRegisters (
IN EFI_SYSTEM_CONTEXT SystemContext,
IN CHAR8 *InBuffer
@@ -391,6 +396,7 @@ WriteGeneralRegisters (
@param *PacketData Pointer to Payload data for the packet
**/
VOID
+EFIAPI
ReadFromMemory (
IN CHAR8 *PacketData
);
@@ -404,6 +410,7 @@ ReadFromMemory (
@param PacketData Pointer to Payload data for the packet
**/
VOID
+EFIAPI
WriteToMemory (
IN CHAR8 *PacketData
);
@@ -418,6 +425,7 @@ WriteToMemory (
**/

VOID
+EFIAPI
ContinueAtAddress (
IN EFI_SYSTEM_CONTEXT SystemContext,
IN CHAR8 *PacketData
@@ -432,6 +440,7 @@ ContinueAtAddress (
@param PacketData Pointer to Payload data for the packet
**/
VOID
+EFIAPI
SingleStep (
IN EFI_SYSTEM_CONTEXT SystemContext,
IN CHAR8 *PacketData
diff --git a/EmbeddedPkg/Drivers/ConsolePrefDxe/ConsolePrefDxe.c b/EmbeddedPkg/Drivers/ConsolePrefDxe/ConsolePrefDxe.c
index c250844eda74..08bba1bbf111 100644
--- a/EmbeddedPkg/Drivers/ConsolePrefDxe/ConsolePrefDxe.c
+++ b/EmbeddedPkg/Drivers/ConsolePrefDxe/ConsolePrefDxe.c
@@ -174,6 +174,7 @@ RemoveSpcrTable (

STATIC
VOID
+EFIAPI
OnReadyToBoot (
IN EFI_EVENT Event,
IN VOID *Context
diff --git a/EmbeddedPkg/Drivers/Lan9118Dxe/Lan9118Dxe.c b/EmbeddedPkg/Drivers/Lan9118Dxe/Lan9118Dxe.c
index a0fca4d6a335..2138f7576bec 100644
--- a/EmbeddedPkg/Drivers/Lan9118Dxe/Lan9118Dxe.c
+++ b/EmbeddedPkg/Drivers/Lan9118Dxe/Lan9118Dxe.c
@@ -34,6 +34,7 @@ LAN9118_DEVICE_PATH Lan9118PathTemplate = {
**
*/
EFI_STATUS
+EFIAPI
Lan9118DxeEntry (
IN EFI_HANDLE Handle,
IN EFI_SYSTEM_TABLE *SystemTable
diff --git a/EmbeddedPkg/Drivers/SataSiI3132Dxe/SiI3132AtaPassThru.c b/EmbeddedPkg/Drivers/SataSiI3132Dxe/SiI3132AtaPassThru.c
index f6a723adfb28..0e2905c1ebb0 100644
--- a/EmbeddedPkg/Drivers/SataSiI3132Dxe/SiI3132AtaPassThru.c
+++ b/EmbeddedPkg/Drivers/SataSiI3132Dxe/SiI3132AtaPassThru.c
@@ -39,6 +39,7 @@ GetSataDevice (
}

EFI_STATUS
+EFIAPI
SiI3132AtaPassThruCommand (
IN SATA_SI3132_INSTANCE *SataSiI3132Instance,
IN SATA_SI3132_PORT *SataPort,
@@ -310,6 +311,7 @@ SiI3132AtaPassThruCommand (

**/
EFI_STATUS
+EFIAPI
SiI3132AtaPassThru (
IN EFI_ATA_PASS_THRU_PROTOCOL *This,
IN UINT16 Port,
@@ -371,6 +373,7 @@ SiI3132AtaPassThru (

**/
EFI_STATUS
+EFIAPI
SiI3132GetNextPort (
IN EFI_ATA_PASS_THRU_PROTOCOL *This,
IN OUT UINT16 *Port
@@ -442,6 +445,7 @@ SiI3132GetNextPort (

**/
EFI_STATUS
+EFIAPI
SiI3132GetNextDevice (
IN EFI_ATA_PASS_THRU_PROTOCOL *This,
IN UINT16 Port,
@@ -523,6 +527,7 @@ SiI3132GetNextDevice (

**/
EFI_STATUS
+EFIAPI
SiI3132BuildDevicePath (
IN EFI_ATA_PASS_THRU_PROTOCOL *This,
IN UINT16 Port,
@@ -601,6 +606,7 @@ SiI3132BuildDevicePath (
port number does not exist.
**/
EFI_STATUS
+EFIAPI
SiI3132GetDevice (
IN EFI_ATA_PASS_THRU_PROTOCOL *This,
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
@@ -717,6 +723,7 @@ SiI3132HwResetPort (

**/
EFI_STATUS
+EFIAPI
SiI3132ResetPort (
IN EFI_ATA_PASS_THRU_PROTOCOL *This,
IN UINT16 Port
@@ -772,6 +779,7 @@ SiI3132ResetPort (

**/
EFI_STATUS
+EFIAPI
SiI3132ResetDevice (
IN EFI_ATA_PASS_THRU_PROTOCOL *This,
IN UINT16 Port,
diff --git a/EmbeddedPkg/MetronomeDxe/Metronome.c b/EmbeddedPkg/MetronomeDxe/Metronome.c
index 579332169507..13db25168fac 100644
--- a/EmbeddedPkg/MetronomeDxe/Metronome.c
+++ b/EmbeddedPkg/MetronomeDxe/Metronome.c
@@ -110,6 +110,7 @@ EFI_HANDLE gMetronomeHandle = NULL;

**/
EFI_STATUS
+EFIAPI
MetronomeInitialize (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
--
2.19.1.3.g30247aa5d201