Date   

Re: [Patch 1/6] MdePkg: Reproduce builds across source format changes

Leif Lindholm
 

On Mon, Nov 01, 2021 at 11:29:37 -0700, Michael D Kinney wrote:
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3688

* Add DEBUG_LINE_NUMBER define to DebugLib.h that is
by default mapped to __LINE__. A build can pre-define
DEBUG_LINE_NUMBER to use a fixed value.
* Add DEBUG_EXPRESSION_STRING(Expression) macrso to
DebugLib.h that is by default mapped to #Expression.
A build can define DEBUG_EXPRESSION_STRING_VALUE to
set all expression strings to a fixed string value.
I think it would be useful to separate this


* Use DEBUG_LINE_NUMBER instead of __LINE__.
* Use DEBUG_EXPRESSION_STRING instead of #Expression.
from this.

I.e., I have no need to verify whether macro use changes in MdePkg are
correct, but it is interesting to me to see the new macros being
defined.

/
Leif

Cc: Liming Gao <gaoliming@...>
Cc: Zhiguang Liu <zhiguang.liu@...>
Cc: Michael Kubacki <michael.kubacki@...>
Signed-off-by: Michael D Kinney <michael.d.kinney@...>
---
MdePkg/Include/Library/DebugLib.h | 42 +++++++++++++++++++++++++---
MdePkg/Include/Library/UnitTestLib.h | 18 ++++++------
MdePkg/Library/BaseLib/SafeString.c | 2 +-
3 files changed, 48 insertions(+), 14 deletions(-)

diff --git a/MdePkg/Include/Library/DebugLib.h b/MdePkg/Include/Library/DebugLib.h
index 4cacd4b8e243..287b922e9f74 100644
--- a/MdePkg/Include/Library/DebugLib.h
+++ b/MdePkg/Include/Library/DebugLib.h
@@ -71,6 +71,40 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#define EFI_D_VERBOSE DEBUG_VERBOSE
#define EFI_D_ERROR DEBUG_ERROR

+//
+// Source file line number.
+// Default is use the to compiler provided __LINE__ macro value. The __LINE__
+// mapping can be overriden by predefining DEBUG_LINE_NUMBER
+//
+// Defining DEBUG_LINE_NUMBER to a fixed value is useful when comparing builds
+// across source code formatting changes that may add/remove lines in a source
+// file.
+//
+#ifndef DEBUG_LINE_NUMBER
+#define DEBUG_LINE_NUMBER __LINE__
+#endif
+
+/**
+ Macro that converts a Boolean expression to a Null-terminated ASCII string.
+
+ The default is to use the C pre-processor stringizing operator '#' to add
+ quotes around the C expression. If DEBUG_EXPRESSION_STRING_VALUE is defined
+ then the C expression is converted to the fixed string value.
+
+ Defining DEBUG_EXPRESSION_STRING_VALUE to a fixed value is useful when
+ comparing builds across source code formatting changes that may make
+ changes to spaces or parenthesis in a Boolean expression.
+
+ @param Expression Boolean expression.
+
+**/
+
+#ifndef DEBUG_EXPRESSION_STRING_VALUE
+#define DEBUG_EXPRESSION_STRING(Expression) #Expression
+#else
+#define DEBUG_EXPRESSION_STRING(Expression) DEBUG_EXPRESSION_STRING_VALUE
+#endif
+
/**
Prints a debug message to the debug output device if the specified error level is enabled.

@@ -310,15 +344,15 @@ UnitTestDebugAssert (
);

#if defined(__clang__) && defined(__FILE_NAME__)
-#define _ASSERT(Expression) UnitTestDebugAssert (__FILE_NAME__, __LINE__, #Expression)
+#define _ASSERT(Expression) UnitTestDebugAssert (__FILE_NAME__, DEBUG_LINE_NUMBER, DEBUG_EXPRESSION_STRING(Expression))
#else
-#define _ASSERT(Expression) UnitTestDebugAssert (__FILE__, __LINE__, #Expression)
+#define _ASSERT(Expression) UnitTestDebugAssert (__FILE__, DEBUG_LINE_NUMBER, DEBUG_EXPRESSION_STRING(Expression))
#endif
#else
#if defined(__clang__) && defined(__FILE_NAME__)
-#define _ASSERT(Expression) DebugAssert (__FILE_NAME__, __LINE__, #Expression)
+#define _ASSERT(Expression) DebugAssert (__FILE_NAME__, DEBUG_LINE_NUMBER, DEBUG_EXPRESSION_STRING(Expression))
#else
-#define _ASSERT(Expression) DebugAssert (__FILE__, __LINE__, #Expression)
+#define _ASSERT(Expression) DebugAssert (__FILE__, DEBUG_LINE_NUMBER, DEBUG_EXPRESSION_STRING(Expression))
#endif
#endif

diff --git a/MdePkg/Include/Library/UnitTestLib.h b/MdePkg/Include/Library/UnitTestLib.h
index 99175496c8cd..7cc6082387bb 100644
--- a/MdePkg/Include/Library/UnitTestLib.h
+++ b/MdePkg/Include/Library/UnitTestLib.h
@@ -348,7 +348,7 @@ SaveFrameworkState (
@param[in] Expression Expression to be evaluated for TRUE.
**/
#define UT_ASSERT_TRUE(Expression) \
- if(!UnitTestAssertTrue ((Expression), __FUNCTION__, __LINE__, __FILE__, #Expression)) { \
+ if(!UnitTestAssertTrue ((Expression), __FUNCTION__, DEBUG_LINE_NUMBER, __FILE__, #Expression)) { \
return UNIT_TEST_ERROR_TEST_FAILED; \
}

@@ -360,7 +360,7 @@ SaveFrameworkState (
@param[in] Expression Expression to be evaluated for FALSE.
**/
#define UT_ASSERT_FALSE(Expression) \
- if(!UnitTestAssertFalse ((Expression), __FUNCTION__, __LINE__, __FILE__, #Expression)) { \
+ if(!UnitTestAssertFalse ((Expression), __FUNCTION__, DEBUG_LINE_NUMBER, __FILE__, #Expression)) { \
return UNIT_TEST_ERROR_TEST_FAILED; \
}

@@ -373,7 +373,7 @@ SaveFrameworkState (
@param[in] ValueB Value to be compared for equality (64-bit comparison).
**/
#define UT_ASSERT_EQUAL(ValueA, ValueB) \
- if(!UnitTestAssertEqual ((UINT64)(ValueA), (UINT64)(ValueB), __FUNCTION__, __LINE__, __FILE__, #ValueA, #ValueB)) { \
+ if(!UnitTestAssertEqual ((UINT64)(ValueA), (UINT64)(ValueB), __FUNCTION__, DEBUG_LINE_NUMBER, __FILE__, #ValueA, #ValueB)) { \
return UNIT_TEST_ERROR_TEST_FAILED; \
}

@@ -387,7 +387,7 @@ SaveFrameworkState (
@param[in] Length Number of bytes to compare in BufferA and BufferB.
**/
#define UT_ASSERT_MEM_EQUAL(BufferA, BufferB, Length) \
- if(!UnitTestAssertMemEqual ((VOID *)(UINTN)(BufferA), (VOID *)(UINTN)(BufferB), (UINTN)Length, __FUNCTION__, __LINE__, __FILE__, #BufferA, #BufferB)) { \
+ if(!UnitTestAssertMemEqual ((VOID *)(UINTN)(BufferA), (VOID *)(UINTN)(BufferB), (UINTN)Length, __FUNCTION__, DEBUG_LINE_NUMBER, __FILE__, #BufferA, #BufferB)) { \
return UNIT_TEST_ERROR_TEST_FAILED; \
}

@@ -400,7 +400,7 @@ SaveFrameworkState (
@param[in] ValueB Value to be compared for inequality (64-bit comparison).
**/
#define UT_ASSERT_NOT_EQUAL(ValueA, ValueB) \
- if(!UnitTestAssertNotEqual ((UINT64)(ValueA), (UINT64)(ValueB), __FUNCTION__, __LINE__, __FILE__, #ValueA, #ValueB)) { \
+ if(!UnitTestAssertNotEqual ((UINT64)(ValueA), (UINT64)(ValueB), __FUNCTION__, DEBUG_LINE_NUMBER, __FILE__, #ValueA, #ValueB)) { \
return UNIT_TEST_ERROR_TEST_FAILED; \
}

@@ -412,7 +412,7 @@ SaveFrameworkState (
@param[in] Status EFI_STATUS value to check.
**/
#define UT_ASSERT_NOT_EFI_ERROR(Status) \
- if(!UnitTestAssertNotEfiError ((Status), __FUNCTION__, __LINE__, __FILE__, #Status)) { \
+ if(!UnitTestAssertNotEfiError ((Status), __FUNCTION__, DEBUG_LINE_NUMBER, __FILE__, #Status)) { \
return UNIT_TEST_ERROR_TEST_FAILED; \
}

@@ -425,7 +425,7 @@ SaveFrameworkState (
@param[in] Expected EFI_STATUS values to compare for equality.
**/
#define UT_ASSERT_STATUS_EQUAL(Status, Expected) \
- if(!UnitTestAssertStatusEqual ((Status), (Expected), __FUNCTION__, __LINE__, __FILE__, #Status)) { \
+ if(!UnitTestAssertStatusEqual ((Status), (Expected), __FUNCTION__, DEBUG_LINE_NUMBER, __FILE__, #Status)) { \
return UNIT_TEST_ERROR_TEST_FAILED; \
}

@@ -437,7 +437,7 @@ SaveFrameworkState (
@param[in] Pointer Pointer to be checked against NULL.
**/
#define UT_ASSERT_NOT_NULL(Pointer) \
- if(!UnitTestAssertNotNull ((Pointer), __FUNCTION__, __LINE__, __FILE__, #Pointer)) { \
+ if(!UnitTestAssertNotNull ((Pointer), __FUNCTION__, DEBUG_LINE_NUMBER, __FILE__, #Pointer)) { \
return UNIT_TEST_ERROR_TEST_FAILED; \
}

@@ -482,7 +482,7 @@ SaveFrameworkState (
} \
if (!UnitTestExpectAssertFailure ( \
UnitTestJumpStatus, \
- __FUNCTION__, __LINE__, __FILE__, \
+ __FUNCTION__, DEBUG_LINE_NUMBER, __FILE__, \
#FunctionCall, Status)) { \
return UNIT_TEST_ERROR_TEST_FAILED; \
} \
diff --git a/MdePkg/Library/BaseLib/SafeString.c b/MdePkg/Library/BaseLib/SafeString.c
index 3bb23ca1a130..ce6db2b94eff 100644
--- a/MdePkg/Library/BaseLib/SafeString.c
+++ b/MdePkg/Library/BaseLib/SafeString.c
@@ -17,7 +17,7 @@
if (!(Expression)) { \
DEBUG ((DEBUG_VERBOSE, \
"%a(%d) %a: SAFE_STRING_CONSTRAINT_CHECK(%a) failed. Return %r\n", \
- __FILE__, __LINE__, __FUNCTION__, #Expression, Status)); \
+ __FILE__, DEBUG_LINE_NUMBER, __FUNCTION__, DEBUG_EXPRESSION_STRING(Expression), Status)); \
return Status; \
} \
} while (FALSE)
--
2.32.0.windows.1






Re: [edk2-libc Patch v3 5/5] AppPkg/Applications/Python: to update readme files in edk2-libc

Jayaprakash, N
 

Hi Mike,

Submitted the updated PR.

Regards,
JP

-----Original Message-----
From: Jayaprakash, N
Sent: 02 November 2021 00:01
To: Kinney, Michael D <michael.d.kinney@...>; devel@edk2.groups.io
Cc: Rebecca Cran <rebecca@...>
Subject: RE: [edk2-libc Patch v3 5/5] AppPkg/Applications/Python: to update readme files in edk2-libc

Hi Mike,

I didn’t notice this.
Will send an updated patch.

Sorry for the inconvenience.

Regards,
JP

-----Original Message-----
From: Kinney, Michael D <michael.d.kinney@...>
Sent: 01 November 2021 21:59
To: Jayaprakash, N <n.jayaprakash@...>; devel@edk2.groups.io; Kinney, Michael D <michael.d.kinney@...>
Cc: Rebecca Cran <rebecca@...>
Subject: RE: [edk2-libc Patch v3 5/5] AppPkg/Applications/Python: to update readme files in edk2-libc

Hi JP,

The updates to these 2 ReadMe.txt files is not complete and do not match the updated to AppPkg/ReadMe.txt.

There is an additional paragraph with Python 2.x references.

Mike



-----Original Message-----
From: Jayaprakash, N <n.jayaprakash@...>
Sent: Saturday, October 30, 2021 6:53 AM
To: devel@edk2.groups.io
Cc: Rebecca Cran <rebecca@...>; Kinney, Michael D
<michael.d.kinney@...>; Jayaprakash, N <n.jayaprakash@...>
Subject: [edk2-libc Patch v3 5/5] AppPkg/Applications/Python: to
update readme files in edk2-libc

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

This commit is to update references to py 2.7.10 in StdLib/Readme.txt
and StdLibPrivateInternalFiles/ReadMe.txt
documents to py3.6.8.

Cc: Rebecca Cran <rebecca@...>
Cc: Michael D Kinney <michael.d.kinney@...>
Signed-off-by: Jayaprakash N <n.jayaprakash@...>
---
StdLib/ReadMe.txt | 8 ++++----
StdLibPrivateInternalFiles/ReadMe.txt | 8 ++++----
2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/StdLib/ReadMe.txt b/StdLib/ReadMe.txt index
200740a..5199692 100644
--- a/StdLib/ReadMe.txt
+++ b/StdLib/ReadMe.txt
@@ -1,8 +1,8 @@
EADK
EDK II Standard Libraries and Applications
ReadMe
- Version 1.02
- 21 Dec. 2012
+ Version 1.03
+ 29 Oct. 2021


OVERVIEW
@@ -43,9 +43,9 @@ The EADK is comprised of three packages:
Main This application is functionally identical to Hello, except that
it uses the Standard C Library to provide a main() entry point.

- Python A port of the Python-2.7.2 interpreter for UEFI. Building this
+ Python A port of the Python-3.6.8 interpreter for UEFI. Building this
application is disabled by default.
- See the PythonReadMe.txt file, in the Python directory,
+ See the Py368ReadMe.txt file, in the
+ Python\Python-3.6.8 directory,
for information on configuring and building Python.

Sockets A collection of applications demonstrating use of the
diff --git a/StdLibPrivateInternalFiles/ReadMe.txt
b/StdLibPrivateInternalFiles/ReadMe.txt
index 35e3b6a..424ee96 100644
--- a/StdLibPrivateInternalFiles/ReadMe.txt
+++ b/StdLibPrivateInternalFiles/ReadMe.txt
@@ -1,8 +1,8 @@
EADK
EDK II Standard Libraries and Applications
ReadMe
- Version 1.02
- 21 Dec. 2012
+ Version 1.03
+ 29 Oct. 2021


OVERVIEW
@@ -43,9 +43,9 @@ The EADK is comprised of three packages:
Main This application is functionally identical to Hello, except that
it uses the Standard C Library to provide a main() entry point.

- Python A port of the Python-2.7.2 interpreter for UEFI. Building this
+ Python A port of the Python-3.6.8 interpreter for UEFI. Building this
application is disabled by default.
- See the PythonReadMe.txt file, in the Python directory,
+ See the Py368ReadMe.txt file, in the
+ Python\Python-3.6.8 directory,
for information on configuring and building Python.

Sockets A collection of applications demonstrating use of the
--
2.32.0.windows.2


[edk2-libc Patch V4 1/6] AppPkg/Applications/Python: To remove the py2.7.2 uefi port code

Jayaprakash, N
 


[edk2-libc Patch V4 6/6] AppPkg/Applications/Python: to fix readme files in edk2-libc

Jayaprakash, N
 

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

This commit is to update remaining references to py 2.7.10 in
StdLib/Readme.txt and StdLibPrivateInternalFiles/ReadMe.txt
documents to py3.6.8.

Cc: Rebecca Cran <rebecca@...>
Cc: Michael D Kinney <michael.d.kinney@...>
Signed-off-by: Jayaprakash N <n.jayaprakash@...>
---
StdLib/ReadMe.txt | 15 +++++++--------
StdLibPrivateInternalFiles/ReadMe.txt | 14 ++++++--------
2 files changed, 13 insertions(+), 16 deletions(-)

diff --git a/StdLib/ReadMe.txt b/StdLib/ReadMe.txt
index 5199692..8e0305e 100644
--- a/StdLib/ReadMe.txt
+++ b/StdLib/ReadMe.txt
@@ -158,14 +158,13 @@ There are some boiler-plate declarations and definitions that need to be
included in your application's INF and DSC build files. These are described
in the CONFIGURATION section, below.

-A subset of the Python 2.7.2 distribution is included as part of AppPkg. If desired,
-the full Python 2.7.2 distribution may be downloaded from python.org and used instead.
-Delete or rename the existing Python-2.7.2 directory then extract the downloaded
-Python-2.7.2.tgz file into the AppPkg\Applications\Python directory. This will produce a
-Python-2.7.2 directory containing the full Python distribution. Python files that had to be
-modified for EDK II are in the AppPkg\Applications\Python\PyMod-2.7.2 directory. These
-files need to be copied into the corresponding directories within the extracted Python-2.7.2
-directory before Python can be built.
+A full distribution of the Python 3.6.8 has been included as part of AppPkg. But only
+a subset of the features have been enabled for UEFI use case. Python files that had to be
+modified for EDK II are in the AppPkg\Applications\Python\Python-3.6.8\PyMod-3.6.8 directory.
+These files need to be copied into the corresponding directories within the Python-3.6.8
+directory before Python can be built. This can be achieved by running the srcprep.py available
+under AppPkg\Applications\Python\Python-3.6.8.
+


BUILDING
diff --git a/StdLibPrivateInternalFiles/ReadMe.txt b/StdLibPrivateInternalFiles/ReadMe.txt
index 424ee96..e21d2c8 100644
--- a/StdLibPrivateInternalFiles/ReadMe.txt
+++ b/StdLibPrivateInternalFiles/ReadMe.txt
@@ -146,14 +146,12 @@ There are some boiler-plate declarations and definitions that need to be
included in your application's INF and DSC build files. These are described
in the CONFIGURATION section, below.

-A subset of the Python 2.7.2 distribution is included as part of AppPkg. If desired,
-the full Python 2.7.2 distribution may be downloaded from python.org and used instead.
-Delete or rename the existing Python-2.7.2 directory then extract the downloaded
-Python-2.7.2.tgz file into the AppPkg\Applications\Python directory. This will produce a
-Python-2.7.2 directory containing the full Python distribution. Python files that had to be
-modified for EDK II are in the AppPkg\Applications\Python\PyMod-2.7.2 directory. These
-files need to be copied into the corresponding directories within the extracted Python-2.7.2
-directory before Python can be built.
+A full distribution of the Python 3.6.8 has been included as part of AppPkg. But only
+a subset of the features have been enabled for UEFI use case. Python files that had to be
+modified for EDK II are in the AppPkg\Applications\Python\Python-3.6.8\PyMod-3.6.8 directory.
+These files need to be copied into the corresponding directories within the Python-3.6.8
+directory before Python can be built. This can be achieved by running the srcprep.py available
+under AppPkg\Applications\Python\Python-3.6.8.


BUILDING
--
2.32.0.windows.2


[edk2-libc Patch V4 5/6] AppPkg/Applications/Python: to update readme files in edk2-libc

Jayaprakash, N
 

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

This commit is to update references to py 2.7.10 in
StdLib/Readme.txt and StdLibPrivateInternalFiles/ReadMe.txt
documents to py3.6.8.

Cc: Rebecca Cran <rebecca@...>
Cc: Michael D Kinney <michael.d.kinney@...>
Signed-off-by: Jayaprakash N <n.jayaprakash@...>
---
StdLib/ReadMe.txt | 8 ++++----
StdLibPrivateInternalFiles/ReadMe.txt | 8 ++++----
2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/StdLib/ReadMe.txt b/StdLib/ReadMe.txt
index 200740a..5199692 100644
--- a/StdLib/ReadMe.txt
+++ b/StdLib/ReadMe.txt
@@ -1,8 +1,8 @@
EADK
EDK II Standard Libraries and Applications
ReadMe
- Version 1.02
- 21 Dec. 2012
+ Version 1.03
+ 29 Oct. 2021


OVERVIEW
@@ -43,9 +43,9 @@ The EADK is comprised of three packages:
Main This application is functionally identical to Hello, except that
it uses the Standard C Library to provide a main() entry point.

- Python A port of the Python-2.7.2 interpreter for UEFI. Building this
+ Python A port of the Python-3.6.8 interpreter for UEFI. Building this
application is disabled by default.
- See the PythonReadMe.txt file, in the Python directory,
+ See the Py368ReadMe.txt file, in the Python\Python-3.6.8 directory,
for information on configuring and building Python.

Sockets A collection of applications demonstrating use of the
diff --git a/StdLibPrivateInternalFiles/ReadMe.txt b/StdLibPrivateInternalFiles/ReadMe.txt
index 35e3b6a..424ee96 100644
--- a/StdLibPrivateInternalFiles/ReadMe.txt
+++ b/StdLibPrivateInternalFiles/ReadMe.txt
@@ -1,8 +1,8 @@
EADK
EDK II Standard Libraries and Applications
ReadMe
- Version 1.02
- 21 Dec. 2012
+ Version 1.03
+ 29 Oct. 2021


OVERVIEW
@@ -43,9 +43,9 @@ The EADK is comprised of three packages:
Main This application is functionally identical to Hello, except that
it uses the Standard C Library to provide a main() entry point.

- Python A port of the Python-2.7.2 interpreter for UEFI. Building this
+ Python A port of the Python-3.6.8 interpreter for UEFI. Building this
application is disabled by default.
- See the PythonReadMe.txt file, in the Python directory,
+ See the Py368ReadMe.txt file, in the Python\Python-3.6.8 directory,
for information on configuring and building Python.

Sockets A collection of applications demonstrating use of the
--
2.32.0.windows.2


[edk2-libc Patch V4 4/6] AppPkg/Applications/Python: to remove py2.7.10 references from edk2-libc

Jayaprakash, N
 

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

This commit is to remove the document references to py 2.7.10
UEFI port. Py2.7.10 is no more supported as it has reached EOL
starting from 1st Jan 2020. You may use the version py 3.6.8
available for uefi shell from edk2-libc.

Cc: Rebecca Cran <rebecca@...>
Cc: Michael D Kinney <michael.d.kinney@...>
Signed-off-by: Jayaprakash N <n.jayaprakash@...>
---
Readme.md | 1 -
1 file changed, 1 deletion(-)

diff --git a/Readme.md b/Readme.md
index f0e9501..2d7690d 100644
--- a/Readme.md
+++ b/Readme.md
@@ -22,7 +22,6 @@ The majority of the content in the EDK II open source project uses a
[BSD-2-Clause Plus Patent License](License.txt). The EDK II open source project
contains the following components that are covered by additional licenses:

-* [AppPkg/Applications/Python/Python-2.7.10](AppPkg/Applications/Python/Python-2.7.10/LICENSE)
* [AppPkg/Applications/Python/Python-3.6.8](AppPkg/Applications/Python/Python-3.6.8/LICENSE)

The EDK II LIBC Project is composed of packages. The maintainers for each
--
2.32.0.windows.2


[edk2-libc Patch V4 2/6] AppPkg/Applications/Python: to remove document references to py2.7.2

Jayaprakash, N
 

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

This commit is to remove references to the py 2.7.2 UEFI port
in all documents from edk2-libc repo. This python interpreter
is no more supported on UEFI shell due to availability of
py 3.6.8 on UEFI.

Cc: Rebecca Cran <rebecca@...>
Cc: Michael D Kinney <michael.d.kinney@...>
Signed-off-by: Jayaprakash N <n.jayaprakash@...>
---
AppPkg/Applications/Python/PythonReadMe.txt | 237 --------------------
AppPkg/ReadMe.txt | 22 +-
Readme.md | 3 +-
3 files changed, 11 insertions(+), 251 deletions(-)
delete mode 100644 AppPkg/Applications/Python/PythonReadMe.txt

diff --git a/AppPkg/Applications/Python/PythonReadMe.txt b/AppPkg/Applications/Python/PythonReadMe.txt
deleted file mode 100644
index c8cd503..0000000
--- a/AppPkg/Applications/Python/PythonReadMe.txt
+++ /dev/null
@@ -1,237 +0,0 @@
- EDK II Python
- ReadMe
- Version 2.7.2
- Release 1.02
- 18 Jan. 2013
-
-
-1. OVERVIEW
-===========
-This document is devoted to general information on building and setup of the
-Python environment for UEFI 2.3, the invocation of the interpreter, and things
-that make working with Python easier.
-
-It is assumed that you already have either UDK2010 or a current snapshot of
-the EDK II sources from www.tianocore.org, and that you can successfully build
-packages within that distribution.
-
-2. Release Notes
-================
- 1) All C extension modules must be statically linked (built in)
- 2) The site and os modules must exist as discrete files in ...\lib\python.27
- 3) User-specific configurations are not supported.
- 4) Environment variables are not supported.
-
-3. Getting and Building Python
-======================================================
- 3.1 Getting Python
- ==================
- For development ease, a subset of the Python 2.7.2 distribution has been
- included in the AppPkg source tree. If a full distribution is desired, the
- Python-2.7.2 directory can be removed or renamed and the full source code
- downloaded from http://www.python.org/ftp/python/2.7.2/.
-
- A. Within your EDK II development tree, extract the Python distribution into
- AppPkg/Applications/Python. This should create the
- AppPkg/Applications/Python/Python-2.7.2 directory.
-
- B. Copy the files from PyMod-2.7.2 into the corresponding directories within
- the Python-2.7.2 tree. This will overwrite existing files with files
- modified for UEFI usage.
-
- 3.2 Building Python
- ===================
- A. Edit Efi/config.c to enable the built-in modules you need.
- Mandatory Built-in Modules:
- edk2 errno imp marshal
-
- Additional built-in modules which are required to use the help()
- functionality provided by PyDoc, are:
- _codecs _collections _functools _random
- _sre _struct _weakref binascii
- cStringIO gc itertools math
- operator time
-
- B. Edit AppPkg/AppPkg.dsc to enable (uncomment) the PythonCore.inf line
- within the [Components] section.
-
- C. Build AppPkg, which includes Python, using the standard "build" command:
- For example, to build Python for an X64 CPU architecture:
- build -a X64 -p AppPkg\AppPkg.dsc
-
-4. Python-related paths and files
-=================================
-Python depends upon the existence of several directories and files on the
-target system.
-
- \EFI Root of the UEFI system area.
- |- \Tools Location of the Python.efi executable.
- |- \Boot UEFI specified Boot directory.
- |- \StdLib Root of the Standard Libraries sub-tree.
- |- \etc Configuration files used by libraries.
- |- \tmp Temporary files created by tmpfile(), etc.
- |- \lib Root of the libraries tree.
- |- \python.27 Directory containing the Python library
- | modules.
- |- \lib-dynload Dynamically loadable Python extensions.
- |- \site-packages Site-specific packages and modules.
-
-
-5. Installing Python
-====================
-These directories, on the target system, are populated from the development
-system as follows:
-
- * \Efi\Tools receives a copy of Build/AppPkg/DEBUG_VS2005/X64/Python.efi.
- ^^^^^ ^^^^^^^^^^
- Modify the host path to match the your build type and compiler.
-
- * The \Efi\StdLib\etc directory is populated from the StdLib/Efi/StdLib/etc
- source directory.
-
- * Directory \Efi\StdLib\lib\python.27 is populated with packages and modules
- from the AppPkg/Applications/Python/Python-2.7.2/Lib directory.
- The recommended minimum set of modules (.py, .pyc, and/or .pyo):
- os stat ntpath warnings traceback
- site types copy_reg linecache genericpath
-
- * Python C Extension Modules built as dynamically loadable extensions go into
- the \Efi\StdLib\lib\python.27\lib-dynload directory. This functionality is
- not yet implemented.
-
-
-6. Example: Enabling socket support
-===================================
- 1. enable {"_socket", init_socket}, in Efi\config.c
- 2. enable Python-2.7.2/Modules/socketmodule.c in PythonCore.inf.
- 3. copy socket.py over to /Efi/StdLib/lib/python.27 on your target system.
- 4. Make sure dependent modules are present(.py) or built in(.c):
- functools, types, os, sys, warnings, cStringIO, StringIO, errno
-
- 5. build -a X64 -p AppPkg\AppPkg.dsc
- 6. copy Build\AppPkg\DEBUG_VS2005\X64\Python.efi to \Efi\Tools on your
- target system. Replace "DEBUG_VS2005\X64", in the source path, with
- values appropriate for your tool chain and processor architecture.
-
-
-7. Running Python
-=================
- Python must currently be run from an EFI FAT-32 partition, or volume, under
- the UEFI Shell. At the Shell prompt enter the desired volume name, followed
- by a colon ':', then press Enter. Python can then be executed by typing its
- name, followed by any desired options and arguments.
-
- EXAMPLE:
- 2.0 Shell> fs0:
- 2.0 FS0:\> python
- Python 2.7.2 (default, Oct 13 2015, 16:21:53) [C] on uefi
- Type "help", "copyright", "credits" or "license" for more information.
- >>> exit()
- 2.0 FS0:\>
-
- NOTE:
- Python, as distributed, sends its interactive prompts to stderr. If
- STDERR isn't enabled in UEFI Setup so that it's output goes to the
- console, it may appear that Python hangs on startup. If this happens,
- one may be able to rectify the condition by typing "exit()" followed
- by <enter> to exit out of Python. Then, type "exit" at the Shell prompt
- which should enter Setup where you can use the Boot Maintenance
- Manager to modify your Console settings.
-
- NOTE:
- Some platforms don't include the Setup utility, or don't allow STDERR to
- be modified. In these cases, Python may be started with the '-#' option
- which will cause stderr to be the same as stdout and should allow
- Python to be used interactively on those platforms.
-
- Depending upon the version of Shell you are using, it may be necessary
- to escape the '#' character so that the Shell doesn't interpret it as
- the start of a comment. The escape character is '^'.
- Example:
- python -^# -V
-
-8. Supported C Modules
-======================
- Module Name C File(s)
- =============== =============================================
- _ast Python/Python-ast.c
- _bisect Modules/_bisectmodule.c
- _codecs Modules/_codecsmodule.c
- _codecs_cn Modules/cjkcodecs/_codecs_cn.c
- _codecs_hk Modules/cjkcodecs/_codecs_hk.c
- _codecs_iso2022 Modules/cjkcodecs/_codecs_iso2022.c
- _codecs_jp Modules/cjkcodecs/_codecs_jp
- _codecs_kr Modules/cjkcodecs/_codecs_kr
- _codecs_tw Modules/cjkcodecs/_codecs_tw
- _collections Modules/_collectionsmodule.c
- _csv Modules/_csv.c
- _functools Modules/_functoolsmodule.c
- _heapq Modules/_heapqmodule.c
- _io Modules/_io/_iomodule.c Modules/_io/*
- _json Modules/_json.c
- _md5 Modules/md5module.c Modules/md5.c
- _multibytecodec Modules/cjkcodecs/_multibytecodec.c
- _random Modules/_randommodule.c
- _sha Modules/shamodule.c
- _sha256 Modules/sha256module.c
- _sha512 Modules/sha512module.c
- _socket Modules/socketmodule.c
- _sre Modules/_sre.c
- _struct Modules/_struct.c
- _symtable Modules/symtablemodule.c
- _weakref Modules/_weakref.c
- array Modules/arraymodule.c
- binascii Modules/binascii.c
- cmath Modules/cmathmodule.c
- cPickle Modules/cPickle.c
- cStringIO Modules/cStringIO.c
- datetime Modules/datetimemodule.c
- edk2 Modules/Efi/edk2module.c
- errno Modules/errnomodule.c
- future_builtins Modules/future_builtins.c
- gc Modules/gcmodule.c
- imp Python/import.c
- itertools Modules/itertoolsmodule.c
- marshal Python/marshal.c
- math Modules/mathmodule.c Modules/_math.c
- operator Modules/operator.c
- parser Modules/parsermodule.c
- select Modules/selectmodule.c
- signal Modules/signalmodule.c
- strop Modules/stropmodule.c
- time Modules/timemodule.c
- xxsubtype Modules/xxsubtype.c
- zipimport Modules/zipimport.c
- zlib Modules/zlibmodule.c Modules/zlib/*
-
-
-9. Tested Python Library Modules
-================================
-This is a partial list of the packages and modules of the Python Standard
-Library that have been tested or used in some manner.
-
- encodings genericpath.py sha.py
- importlib getopt.py SimpleHTTPServer.py
- json hashlib.py site.py
- pydoc_data heapq.py socket.py
- xml HTMLParser.py SocketServer.py
- abc.py inspect.py sre.py
- argparse.py io.py sre_compile.py
- ast.py keyword.py sre_constants.py
- atexit.py linecache.py sre_parse.py
- BaseHTTPServer.py locale.py stat.py
- binhex.py md5.py string.py
- bisect.py modulefinder.py StringIO.py
- calendar.py ntpath.py struct.py
- cmd.py numbers.py textwrap.py
- codecs.py optparse.py token.py
- collections.py os.py tokenize.py
- copy.py platform.py traceback.py
- copy_reg.py posixpath.py types.py
- csv.py pydoc.py warnings.py
- dummy_thread.py random.py weakref.py
- fileinput.py re.py xmllib.py
- formatter.py repr.py zipfile.py
- functools.py runpy.py expat
-
-# # #
diff --git a/AppPkg/ReadMe.txt b/AppPkg/ReadMe.txt
index cee6493..4a2aee4 100644
--- a/AppPkg/ReadMe.txt
+++ b/AppPkg/ReadMe.txt
@@ -1,8 +1,8 @@
EADK
EDK II Standard Libraries and Applications
ReadMe
- Version 1.02
- 21 Dec. 2012
+ Version 1.03
+ 18 Oct. 2021


OVERVIEW
@@ -43,9 +43,9 @@ The EADK is comprised of three packages:
Main This application is functionally identical to Hello, except that
it uses the Standard C Library to provide a main() entry point.

- Python A port of the Python-2.7.2 interpreter for UEFI. Building this
+ Python A port of the Python-3.6.8 interpreter for UEFI. Building this
application is disabled by default.
- See the PythonReadMe.txt file, in the Python directory,
+ See the Py368ReadMe.txt file, in the Python\Python-3.6.8 directory,
for information on configuring and building Python.

Lua A port of the Lua-5.2.3 interpreter for UEFI. This
@@ -169,14 +169,12 @@ There are some boiler-plate declarations and definitions that need to be
included in your application's INF and DSC build files. These are described
in the CONFIGURATION section, below.

-A subset of the Python 2.7.2 distribution is included as part of AppPkg. If desired,
-the full Python 2.7.2 distribution may be downloaded from python.org and used instead.
-Delete or rename the existing Python-2.7.2 directory then extract the downloaded
-Python-2.7.2.tgz file into the AppPkg\Applications\Python directory. This will produce a
-Python-2.7.2 directory containing the full Python distribution. Python files that had to be
-modified for EDK II are in the AppPkg\Applications\Python\PyMod-2.7.2 directory. These
-files need to be copied into the corresponding directories within the extracted Python-2.7.2
-directory before Python can be built.
+A full distribution of the Python 3.6.8 has been included as part of AppPkg. But only
+a subset of the features have been enabled for UEFI use case. Python files that had to be
+modified for EDK II are in the AppPkg\Applications\Python\Python-3.6.8\PyMod-3.6.8 directory.
+These files need to be copied into the corresponding directories within the Python-3.6.8
+directory before Python can be built. This can be achieved by running the srcprep.py available
+under AppPkg\Applications\Python\Python-3.6.8.


BUILDING
diff --git a/Readme.md b/Readme.md
index 0012cd5..f0e9501 100644
--- a/Readme.md
+++ b/Readme.md
@@ -21,8 +21,7 @@ git filter-branch -f --index-filter "git rm --ignore-unmatch --cached -qr -- . &
The majority of the content in the EDK II open source project uses a
[BSD-2-Clause Plus Patent License](License.txt). The EDK II open source project
contains the following components that are covered by additional licenses:
-* [AppPkg/Applications/Python/Python-2.7.2/Tools/pybench](AppPkg/Applications/Python/Python-2.7.2/Tools/pybench/LICENSE)
-* [AppPkg/Applications/Python/Python-2.7.2](AppPkg/Applications/Python/Python-2.7.2/LICENSE)
+
* [AppPkg/Applications/Python/Python-2.7.10](AppPkg/Applications/Python/Python-2.7.10/LICENSE)
* [AppPkg/Applications/Python/Python-3.6.8](AppPkg/Applications/Python/Python-3.6.8/LICENSE)

--
2.32.0.windows.2


[edk2-libc Patch V4 3/6] AppPkg/Applications/Python: to remove py2.7.10 support from edk2-libc

Jayaprakash, N
 


Re: [PATCH v2 1/1] Silicon/Qemu/Sbsa: Enable Always-On capability for PE timers

Leif Lindholm
 

On Mon, Nov 01, 2021 at 18:54:57 +0100, Marcin Juszkiewicz wrote:
From: Shashi Mallela <shashi.mallela@...>

Setting the Always-on Capability bit in GTDT table for
system PE timers in sbsa platform.This is also required
for ACS sbsa level 3 test compliancy.

Cc: Leif Lindholm <leif@...>
Cc: Ard Biesheuvel <ard.biesheuvel@...>
Cc: Graeme Gregory <graeme@...>
Signed-off-by: Shashi Mallela <shashi.mallela@...>

[fixed compilation error]

Signed-off-by: Marcin Juszkiewicz <marcin.juszkiewicz@...>
Tested-by: Marcin Juszkiewicz <marcin.juszkiewicz@...>
Acked-by: Leif Lindholm <leif@...>
Pushed as f5fe24c4efea - thanks!

---
Silicon/Qemu/SbsaQemu/AcpiTables/Gtdt.aslc | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/Silicon/Qemu/SbsaQemu/AcpiTables/Gtdt.aslc b/Silicon/Qemu/SbsaQemu/AcpiTables/Gtdt.aslc
index 14733a37183d..ba145aff6413 100644
--- a/Silicon/Qemu/SbsaQemu/AcpiTables/Gtdt.aslc
+++ b/Silicon/Qemu/SbsaQemu/AcpiTables/Gtdt.aslc
@@ -28,8 +28,11 @@
#define GTDT_TIMER_LEVEL_TRIGGERED 0
#define GTDT_TIMER_ACTIVE_LOW EFI_ACPI_6_3_GTDT_TIMER_FLAG_TIMER_INTERRUPT_POLARITY
#define GTDT_TIMER_ACTIVE_HIGH 0
+#define GTDT_TIMER_ALWAYS_ON EFI_ACPI_6_3_GTDT_TIMER_FLAG_ALWAYS_ON_CAPABILITY

-#define GTDT_GTIMER_FLAGS (GTDT_TIMER_ACTIVE_LOW | GTDT_TIMER_LEVEL_TRIGGERED)
+#define GTDT_GTIMER_FLAGS (GTDT_TIMER_ACTIVE_LOW | \
+ GTDT_TIMER_LEVEL_TRIGGERED | \
+ GTDT_TIMER_ALWAYS_ON)

#define SBSA_PLATFORM_WATCHDOG_COUNT 1
#define SBSA_PLATFORM_TIMER_COUNT (SBSA_PLATFORM_WATCHDOG_COUNT)
--
2.32.0


Re: [edk2-libc Patch v3 5/5] AppPkg/Applications/Python: to update readme files in edk2-libc

Jayaprakash, N
 

Hi Mike,

I didn’t notice this.
Will send an updated patch.

Sorry for the inconvenience.

Regards,
JP

-----Original Message-----
From: Kinney, Michael D <michael.d.kinney@...>
Sent: 01 November 2021 21:59
To: Jayaprakash, N <n.jayaprakash@...>; devel@edk2.groups.io; Kinney, Michael D <michael.d.kinney@...>
Cc: Rebecca Cran <rebecca@...>
Subject: RE: [edk2-libc Patch v3 5/5] AppPkg/Applications/Python: to update readme files in edk2-libc

Hi JP,

The updates to these 2 ReadMe.txt files is not complete and do not match the updated to AppPkg/ReadMe.txt.

There is an additional paragraph with Python 2.x references.

Mike



-----Original Message-----
From: Jayaprakash, N <n.jayaprakash@...>
Sent: Saturday, October 30, 2021 6:53 AM
To: devel@edk2.groups.io
Cc: Rebecca Cran <rebecca@...>; Kinney, Michael D
<michael.d.kinney@...>; Jayaprakash, N <n.jayaprakash@...>
Subject: [edk2-libc Patch v3 5/5] AppPkg/Applications/Python: to
update readme files in edk2-libc

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

This commit is to update references to py 2.7.10 in StdLib/Readme.txt
and StdLibPrivateInternalFiles/ReadMe.txt
documents to py3.6.8.

Cc: Rebecca Cran <rebecca@...>
Cc: Michael D Kinney <michael.d.kinney@...>
Signed-off-by: Jayaprakash N <n.jayaprakash@...>
---
StdLib/ReadMe.txt | 8 ++++----
StdLibPrivateInternalFiles/ReadMe.txt | 8 ++++----
2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/StdLib/ReadMe.txt b/StdLib/ReadMe.txt index
200740a..5199692 100644
--- a/StdLib/ReadMe.txt
+++ b/StdLib/ReadMe.txt
@@ -1,8 +1,8 @@
EADK
EDK II Standard Libraries and Applications
ReadMe
- Version 1.02
- 21 Dec. 2012
+ Version 1.03
+ 29 Oct. 2021


OVERVIEW
@@ -43,9 +43,9 @@ The EADK is comprised of three packages:
Main This application is functionally identical to Hello, except that
it uses the Standard C Library to provide a main() entry point.

- Python A port of the Python-2.7.2 interpreter for UEFI. Building this
+ Python A port of the Python-3.6.8 interpreter for UEFI. Building this
application is disabled by default.
- See the PythonReadMe.txt file, in the Python directory,
+ See the Py368ReadMe.txt file, in the
+ Python\Python-3.6.8 directory,
for information on configuring and building Python.

Sockets A collection of applications demonstrating use of the
diff --git a/StdLibPrivateInternalFiles/ReadMe.txt
b/StdLibPrivateInternalFiles/ReadMe.txt
index 35e3b6a..424ee96 100644
--- a/StdLibPrivateInternalFiles/ReadMe.txt
+++ b/StdLibPrivateInternalFiles/ReadMe.txt
@@ -1,8 +1,8 @@
EADK
EDK II Standard Libraries and Applications
ReadMe
- Version 1.02
- 21 Dec. 2012
+ Version 1.03
+ 29 Oct. 2021


OVERVIEW
@@ -43,9 +43,9 @@ The EADK is comprised of three packages:
Main This application is functionally identical to Hello, except that
it uses the Standard C Library to provide a main() entry point.

- Python A port of the Python-2.7.2 interpreter for UEFI. Building this
+ Python A port of the Python-3.6.8 interpreter for UEFI. Building this
application is disabled by default.
- See the PythonReadMe.txt file, in the Python directory,
+ See the Py368ReadMe.txt file, in the
+ Python\Python-3.6.8 directory,
for information on configuring and building Python.

Sockets A collection of applications demonstrating use of the
--
2.32.0.windows.2


[Patch 4/6] NetworkPkg: Reproduce builds across source format changes

Michael D Kinney
 

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

Use DEBUG_LINE_NUMBER instead of __LINE__.

Cc: Maciej Rabeda <maciej.rabeda@...>
Cc: Jiaxin Wu <jiaxin.wu@...>
Cc: Siyuan Fu <siyuan.fu@...>
Cc: Michael Kubacki <michael.kubacki@...>
Signed-off-by: Michael D Kinney <michael.d.kinney@...>
---
NetworkPkg/Include/Library/NetLib.h | 8 ++++----
NetworkPkg/Library/DxeNetLib/DxeNetLib.c | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/NetworkPkg/Include/Library/NetLib.h b/NetworkPkg/Include/Library/NetLib.h
index 858d0b6ba07c..6c0924863147 100644
--- a/NetworkPkg/Include/Library/NetLib.h
+++ b/NetworkPkg/Include/Library/NetLib.h
@@ -277,7 +277,7 @@ typedef struct {
NETDEBUG_LEVEL_TRACE, \
Module, \
__FILE__, \
- __LINE__, \
+ DEBUG_LINE_NUMBER, \
NetDebugASPrint PrintArg \
)

@@ -286,7 +286,7 @@ typedef struct {
NETDEBUG_LEVEL_WARNING, \
Module, \
__FILE__, \
- __LINE__, \
+ DEBUG_LINE_NUMBER, \
NetDebugASPrint PrintArg \
)

@@ -295,7 +295,7 @@ typedef struct {
NETDEBUG_LEVEL_ERROR, \
Module, \
__FILE__, \
- __LINE__, \
+ DEBUG_LINE_NUMBER, \
NetDebugASPrint PrintArg \
)

@@ -311,7 +311,7 @@ typedef struct {
NETDEBUG_LEVEL_TRACE,
"Tcp",
__FILE__,
- __LINE__,
+ DEBUG_LINE_NUMBER,
NetDebugASPrint ("State transit to %a\n", Name)
)

diff --git a/NetworkPkg/Library/DxeNetLib/DxeNetLib.c b/NetworkPkg/Library/DxeNetLib/DxeNetLib.c
index 2a555a7b90fa..0f95ce4b710d 100644
--- a/NetworkPkg/Library/DxeNetLib/DxeNetLib.c
+++ b/NetworkPkg/Library/DxeNetLib/DxeNetLib.c
@@ -434,7 +434,7 @@ SyslogBuildPacket (
NETDEBUG_LEVEL_TRACE,
"Tcp",
__FILE__,
- __LINE__,
+ DEBUG_LINE_NUMBER,
NetDebugASPrint ("State transit to %a\n", Name)
)

--
2.32.0.windows.1


[Patch 3/6] MdeModulePkg: Reproduce builds across source format changes

Michael D Kinney
 

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

Use DEBUG_LINE_NUMBER instead of __LINE__.

Cc: Jian J Wang <jian.j.wang@...>
Cc: Liming Gao <gaoliming@...>
Cc: Michael Kubacki <michael.kubacki@...>
Signed-off-by: Michael D Kinney <michael.d.kinney@...>
---
MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridge.c | 2 +-
MdeModulePkg/Library/UefiBootManagerLib/BmDriverHealth.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridge.c b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridge.c
index 4ab9415c9600..163e931dd9e8 100644
--- a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridge.c
+++ b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridge.c
@@ -874,7 +874,7 @@ NotifyPhase (
Translation = GetTranslationByResourceType (RootBridge, Index);
if ((Translation & Alignment) != 0) {
DEBUG ((DEBUG_ERROR, "[%a:%d] Translation %lx is not aligned to %lx!\n",
- __FUNCTION__, __LINE__, Translation, Alignment
+ __FUNCTION__, DEBUG_LINE_NUMBER, Translation, Alignment
));
ASSERT ((Translation & Alignment) == 0);
//
diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmDriverHealth.c b/MdeModulePkg/Library/UefiBootManagerLib/BmDriverHealth.c
index 52e35e45185d..fa1fd87d15ef 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmDriverHealth.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmDriverHealth.c
@@ -574,7 +574,7 @@ BmRepairAllControllers (
BmRepairAllControllers (ReconnectRepairCount + 1);
} else {
DEBUG ((DEBUG_ERROR, "[%a:%d] Repair failed after %d retries.\n",
- __FUNCTION__, __LINE__, ReconnectRepairCount));
+ __FUNCTION__, DEBUG_LINE_NUMBER, ReconnectRepairCount));
}
}

--
2.32.0.windows.1


[Patch 1/6] MdePkg: Reproduce builds across source format changes

Michael D Kinney
 

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

* Add DEBUG_LINE_NUMBER define to DebugLib.h that is
by default mapped to __LINE__. A build can pre-define
DEBUG_LINE_NUMBER to use a fixed value.
* Add DEBUG_EXPRESSION_STRING(Expression) macrso to
DebugLib.h that is by default mapped to #Expression.
A build can define DEBUG_EXPRESSION_STRING_VALUE to
set all expression strings to a fixed string value.
* Use DEBUG_LINE_NUMBER instead of __LINE__.
* Use DEBUG_EXPRESSION_STRING instead of #Expression.

Cc: Liming Gao <gaoliming@...>
Cc: Zhiguang Liu <zhiguang.liu@...>
Cc: Michael Kubacki <michael.kubacki@...>
Signed-off-by: Michael D Kinney <michael.d.kinney@...>
---
MdePkg/Include/Library/DebugLib.h | 42 +++++++++++++++++++++++++---
MdePkg/Include/Library/UnitTestLib.h | 18 ++++++------
MdePkg/Library/BaseLib/SafeString.c | 2 +-
3 files changed, 48 insertions(+), 14 deletions(-)

diff --git a/MdePkg/Include/Library/DebugLib.h b/MdePkg/Include/Library/DebugLib.h
index 4cacd4b8e243..287b922e9f74 100644
--- a/MdePkg/Include/Library/DebugLib.h
+++ b/MdePkg/Include/Library/DebugLib.h
@@ -71,6 +71,40 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#define EFI_D_VERBOSE DEBUG_VERBOSE
#define EFI_D_ERROR DEBUG_ERROR

+//
+// Source file line number.
+// Default is use the to compiler provided __LINE__ macro value. The __LINE__
+// mapping can be overriden by predefining DEBUG_LINE_NUMBER
+//
+// Defining DEBUG_LINE_NUMBER to a fixed value is useful when comparing builds
+// across source code formatting changes that may add/remove lines in a source
+// file.
+//
+#ifndef DEBUG_LINE_NUMBER
+#define DEBUG_LINE_NUMBER __LINE__
+#endif
+
+/**
+ Macro that converts a Boolean expression to a Null-terminated ASCII string.
+
+ The default is to use the C pre-processor stringizing operator '#' to add
+ quotes around the C expression. If DEBUG_EXPRESSION_STRING_VALUE is defined
+ then the C expression is converted to the fixed string value.
+
+ Defining DEBUG_EXPRESSION_STRING_VALUE to a fixed value is useful when
+ comparing builds across source code formatting changes that may make
+ changes to spaces or parenthesis in a Boolean expression.
+
+ @param Expression Boolean expression.
+
+**/
+
+#ifndef DEBUG_EXPRESSION_STRING_VALUE
+#define DEBUG_EXPRESSION_STRING(Expression) #Expression
+#else
+#define DEBUG_EXPRESSION_STRING(Expression) DEBUG_EXPRESSION_STRING_VALUE
+#endif
+
/**
Prints a debug message to the debug output device if the specified error level is enabled.

@@ -310,15 +344,15 @@ UnitTestDebugAssert (
);

#if defined(__clang__) && defined(__FILE_NAME__)
-#define _ASSERT(Expression) UnitTestDebugAssert (__FILE_NAME__, __LINE__, #Expression)
+#define _ASSERT(Expression) UnitTestDebugAssert (__FILE_NAME__, DEBUG_LINE_NUMBER, DEBUG_EXPRESSION_STRING(Expression))
#else
-#define _ASSERT(Expression) UnitTestDebugAssert (__FILE__, __LINE__, #Expression)
+#define _ASSERT(Expression) UnitTestDebugAssert (__FILE__, DEBUG_LINE_NUMBER, DEBUG_EXPRESSION_STRING(Expression))
#endif
#else
#if defined(__clang__) && defined(__FILE_NAME__)
-#define _ASSERT(Expression) DebugAssert (__FILE_NAME__, __LINE__, #Expression)
+#define _ASSERT(Expression) DebugAssert (__FILE_NAME__, DEBUG_LINE_NUMBER, DEBUG_EXPRESSION_STRING(Expression))
#else
-#define _ASSERT(Expression) DebugAssert (__FILE__, __LINE__, #Expression)
+#define _ASSERT(Expression) DebugAssert (__FILE__, DEBUG_LINE_NUMBER, DEBUG_EXPRESSION_STRING(Expression))
#endif
#endif

diff --git a/MdePkg/Include/Library/UnitTestLib.h b/MdePkg/Include/Library/UnitTestLib.h
index 99175496c8cd..7cc6082387bb 100644
--- a/MdePkg/Include/Library/UnitTestLib.h
+++ b/MdePkg/Include/Library/UnitTestLib.h
@@ -348,7 +348,7 @@ SaveFrameworkState (
@param[in] Expression Expression to be evaluated for TRUE.
**/
#define UT_ASSERT_TRUE(Expression) \
- if(!UnitTestAssertTrue ((Expression), __FUNCTION__, __LINE__, __FILE__, #Expression)) { \
+ if(!UnitTestAssertTrue ((Expression), __FUNCTION__, DEBUG_LINE_NUMBER, __FILE__, #Expression)) { \
return UNIT_TEST_ERROR_TEST_FAILED; \
}

@@ -360,7 +360,7 @@ SaveFrameworkState (
@param[in] Expression Expression to be evaluated for FALSE.
**/
#define UT_ASSERT_FALSE(Expression) \
- if(!UnitTestAssertFalse ((Expression), __FUNCTION__, __LINE__, __FILE__, #Expression)) { \
+ if(!UnitTestAssertFalse ((Expression), __FUNCTION__, DEBUG_LINE_NUMBER, __FILE__, #Expression)) { \
return UNIT_TEST_ERROR_TEST_FAILED; \
}

@@ -373,7 +373,7 @@ SaveFrameworkState (
@param[in] ValueB Value to be compared for equality (64-bit comparison).
**/
#define UT_ASSERT_EQUAL(ValueA, ValueB) \
- if(!UnitTestAssertEqual ((UINT64)(ValueA), (UINT64)(ValueB), __FUNCTION__, __LINE__, __FILE__, #ValueA, #ValueB)) { \
+ if(!UnitTestAssertEqual ((UINT64)(ValueA), (UINT64)(ValueB), __FUNCTION__, DEBUG_LINE_NUMBER, __FILE__, #ValueA, #ValueB)) { \
return UNIT_TEST_ERROR_TEST_FAILED; \
}

@@ -387,7 +387,7 @@ SaveFrameworkState (
@param[in] Length Number of bytes to compare in BufferA and BufferB.
**/
#define UT_ASSERT_MEM_EQUAL(BufferA, BufferB, Length) \
- if(!UnitTestAssertMemEqual ((VOID *)(UINTN)(BufferA), (VOID *)(UINTN)(BufferB), (UINTN)Length, __FUNCTION__, __LINE__, __FILE__, #BufferA, #BufferB)) { \
+ if(!UnitTestAssertMemEqual ((VOID *)(UINTN)(BufferA), (VOID *)(UINTN)(BufferB), (UINTN)Length, __FUNCTION__, DEBUG_LINE_NUMBER, __FILE__, #BufferA, #BufferB)) { \
return UNIT_TEST_ERROR_TEST_FAILED; \
}

@@ -400,7 +400,7 @@ SaveFrameworkState (
@param[in] ValueB Value to be compared for inequality (64-bit comparison).
**/
#define UT_ASSERT_NOT_EQUAL(ValueA, ValueB) \
- if(!UnitTestAssertNotEqual ((UINT64)(ValueA), (UINT64)(ValueB), __FUNCTION__, __LINE__, __FILE__, #ValueA, #ValueB)) { \
+ if(!UnitTestAssertNotEqual ((UINT64)(ValueA), (UINT64)(ValueB), __FUNCTION__, DEBUG_LINE_NUMBER, __FILE__, #ValueA, #ValueB)) { \
return UNIT_TEST_ERROR_TEST_FAILED; \
}

@@ -412,7 +412,7 @@ SaveFrameworkState (
@param[in] Status EFI_STATUS value to check.
**/
#define UT_ASSERT_NOT_EFI_ERROR(Status) \
- if(!UnitTestAssertNotEfiError ((Status), __FUNCTION__, __LINE__, __FILE__, #Status)) { \
+ if(!UnitTestAssertNotEfiError ((Status), __FUNCTION__, DEBUG_LINE_NUMBER, __FILE__, #Status)) { \
return UNIT_TEST_ERROR_TEST_FAILED; \
}

@@ -425,7 +425,7 @@ SaveFrameworkState (
@param[in] Expected EFI_STATUS values to compare for equality.
**/
#define UT_ASSERT_STATUS_EQUAL(Status, Expected) \
- if(!UnitTestAssertStatusEqual ((Status), (Expected), __FUNCTION__, __LINE__, __FILE__, #Status)) { \
+ if(!UnitTestAssertStatusEqual ((Status), (Expected), __FUNCTION__, DEBUG_LINE_NUMBER, __FILE__, #Status)) { \
return UNIT_TEST_ERROR_TEST_FAILED; \
}

@@ -437,7 +437,7 @@ SaveFrameworkState (
@param[in] Pointer Pointer to be checked against NULL.
**/
#define UT_ASSERT_NOT_NULL(Pointer) \
- if(!UnitTestAssertNotNull ((Pointer), __FUNCTION__, __LINE__, __FILE__, #Pointer)) { \
+ if(!UnitTestAssertNotNull ((Pointer), __FUNCTION__, DEBUG_LINE_NUMBER, __FILE__, #Pointer)) { \
return UNIT_TEST_ERROR_TEST_FAILED; \
}

@@ -482,7 +482,7 @@ SaveFrameworkState (
} \
if (!UnitTestExpectAssertFailure ( \
UnitTestJumpStatus, \
- __FUNCTION__, __LINE__, __FILE__, \
+ __FUNCTION__, DEBUG_LINE_NUMBER, __FILE__, \
#FunctionCall, Status)) { \
return UNIT_TEST_ERROR_TEST_FAILED; \
} \
diff --git a/MdePkg/Library/BaseLib/SafeString.c b/MdePkg/Library/BaseLib/SafeString.c
index 3bb23ca1a130..ce6db2b94eff 100644
--- a/MdePkg/Library/BaseLib/SafeString.c
+++ b/MdePkg/Library/BaseLib/SafeString.c
@@ -17,7 +17,7 @@
if (!(Expression)) { \
DEBUG ((DEBUG_VERBOSE, \
"%a(%d) %a: SAFE_STRING_CONSTRAINT_CHECK(%a) failed. Return %r\n", \
- __FILE__, __LINE__, __FUNCTION__, #Expression, Status)); \
+ __FILE__, DEBUG_LINE_NUMBER, __FUNCTION__, DEBUG_EXPRESSION_STRING(Expression), Status)); \
return Status; \
} \
} while (FALSE)
--
2.32.0.windows.1


[Patch 2/6] ArmPkg: Reproduce builds across source format changes

Michael D Kinney
 

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

Use DEBUG_LINE_NUMBER instead of __LINE__.

Cc: Leif Lindholm <leif@...>
Cc: Ard Biesheuvel <ardb+tianocore@...>
Cc: Michael Kubacki <michael.kubacki@...>
Signed-off-by: Michael D Kinney <michael.d.kinney@...>
---
.../Universal/Smbios/ProcessorSubClassDxe/ProcessorSubClass.c | 2 +-
.../Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorFunction.c | 2 +-
.../SmbiosMiscDxe/Type01/MiscSystemManufacturerFunction.c | 2 +-
.../SmbiosMiscDxe/Type02/MiscBaseBoardManufacturerFunction.c | 2 +-
.../SmbiosMiscDxe/Type03/MiscChassisManufacturerFunction.c | 2 +-
.../Type13/MiscNumberOfInstallableLanguagesFunction.c | 2 +-
.../Smbios/SmbiosMiscDxe/Type32/MiscBootInformationFunction.c | 2 +-
7 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/ArmPkg/Universal/Smbios/ProcessorSubClassDxe/ProcessorSubClass.c b/ArmPkg/Universal/Smbios/ProcessorSubClassDxe/ProcessorSubClass.c
index 4b409ff7458c..cbdf6df01ee0 100644
--- a/ArmPkg/Universal/Smbios/ProcessorSubClassDxe/ProcessorSubClass.c
+++ b/ArmPkg/Universal/Smbios/ProcessorSubClassDxe/ProcessorSubClass.c
@@ -689,7 +689,7 @@ AddSmbiosProcessorTypeTable (

if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "[%a]:[%dL] Smbios Type04 Table Log Failed! %r \n",
- __FUNCTION__, __LINE__, Status));
+ __FUNCTION__, DEBUG_LINE_NUMBER, Status));
}
FreePool (Type4Record);

diff --git a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorFunction.c b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorFunction.c
index 5679ebaac8a5..2506c03d64b1 100644
--- a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorFunction.c
+++ b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorFunction.c
@@ -271,7 +271,7 @@ SMBIOS_MISC_TABLE_FUNCTION (MiscBiosVendor)
Status = SmbiosMiscAddRecord ((UINT8*)SmbiosRecord, NULL);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "[%a]:[%dL] Smbios Type00 Table Log Failed! %r \n",
- __FUNCTION__, __LINE__, Status));
+ __FUNCTION__, DEBUG_LINE_NUMBER, Status));
}

FreePool (SmbiosRecord);
diff --git a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type01/MiscSystemManufacturerFunction.c b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type01/MiscSystemManufacturerFunction.c
index 2c69c2593f5d..555557a2a946 100644
--- a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type01/MiscSystemManufacturerFunction.c
+++ b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type01/MiscSystemManufacturerFunction.c
@@ -162,7 +162,7 @@ SMBIOS_MISC_TABLE_FUNCTION(MiscSystemManufacturer)
Status = SmbiosMiscAddRecord ((UINT8*)SmbiosRecord, NULL);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "[%a]:[%dL] Smbios Type01 Table Log Failed! %r \n",
- __FUNCTION__, __LINE__, Status));
+ __FUNCTION__, DEBUG_LINE_NUMBER, Status));
}

FreePool (SmbiosRecord);
diff --git a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type02/MiscBaseBoardManufacturerFunction.c b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type02/MiscBaseBoardManufacturerFunction.c
index 097777a23904..f11295b199b3 100644
--- a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type02/MiscBaseBoardManufacturerFunction.c
+++ b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type02/MiscBaseBoardManufacturerFunction.c
@@ -196,7 +196,7 @@ SMBIOS_MISC_TABLE_FUNCTION(MiscBaseBoardManufacturer)
Status = SmbiosMiscAddRecord ((UINT8 *)SmbiosRecord, NULL);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "[%a]:[%dL] Smbios Type02 Table Log Failed! %r \n",
- __FUNCTION__, __LINE__, Status));
+ __FUNCTION__, DEBUG_LINE_NUMBER, Status));
}

FreePool (SmbiosRecord);
diff --git a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type03/MiscChassisManufacturerFunction.c b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type03/MiscChassisManufacturerFunction.c
index 66e3e5327fc3..d64046182b96 100644
--- a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type03/MiscChassisManufacturerFunction.c
+++ b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type03/MiscChassisManufacturerFunction.c
@@ -178,7 +178,7 @@ SMBIOS_MISC_TABLE_FUNCTION(MiscChassisManufacturer)
Status = SmbiosMiscAddRecord ((UINT8*)SmbiosRecord, NULL);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "[%a]:[%dL] Smbios Type03 Table Log Failed! %r \n",
- __FUNCTION__, __LINE__, Status));
+ __FUNCTION__, DEBUG_LINE_NUMBER, Status));
}

FreePool (SmbiosRecord);
diff --git a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type13/MiscNumberOfInstallableLanguagesFunction.c b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type13/MiscNumberOfInstallableLanguagesFunction.c
index 7c941b5c0709..017b410a16d0 100644
--- a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type13/MiscNumberOfInstallableLanguagesFunction.c
+++ b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type13/MiscNumberOfInstallableLanguagesFunction.c
@@ -158,7 +158,7 @@ SMBIOS_MISC_TABLE_FUNCTION(MiscNumberOfInstallableLanguages)
Status = SmbiosMiscAddRecord ((UINT8*)SmbiosRecord, NULL);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "[%a]:[%dL] Smbios Type13 Table Log Failed! %r \n",
- __FUNCTION__, __LINE__, Status));
+ __FUNCTION__, DEBUG_LINE_NUMBER, Status));
}

FreePool (SmbiosRecord);
diff --git a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type32/MiscBootInformationFunction.c b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type32/MiscBootInformationFunction.c
index 4be1e1cd29a9..c4ce6a5e7608 100644
--- a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type32/MiscBootInformationFunction.c
+++ b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type32/MiscBootInformationFunction.c
@@ -68,7 +68,7 @@ SMBIOS_MISC_TABLE_FUNCTION(MiscBootInformation)
Status = SmbiosMiscAddRecord ((UINT8*)SmbiosRecord, NULL);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "[%a]:[%dL] Smbios Type32 Table Log Failed! %r \n",
- __FUNCTION__, __LINE__, Status));
+ __FUNCTION__, DEBUG_LINE_NUMBER, Status));
}

FreePool (SmbiosRecord);
--
2.32.0.windows.1


[Patch 0/6] Reproduce builds across source format changes

Michael D Kinney
 

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

This change is required to help verify that source code formatting
changes such as the use of uncrustify and line ending corrections
do not have any functional differences. Source format changes may
add or remove line endings that change the source file line numbers
of C statements or may change the use of spaces in C expressions
used in an ASSERT() statements. These types of changes can impact
the generated binaries when DEBUG() and ASSERT() macros are
enabled. The following set of changes adds 2 defines that can be used
to override the use of __LINE__ in DEBUG() macros and the use of
#Expression in ASSERT() macros.

* Add DEBUG_LINE_NUMBER define to DebugLib.h that is
by default mapped to __LINE__. A build can pre-define
DEBUG_LINE_NUMBER to use a fixed value.
* Add DEBUG_EXPRESSION_STRING(Expression) macros to
DebugLib.h that is by default mapped to #Expression.
A build can define DEBUG_EXPRESSION_STRING_VALUE to
set all expression strings to a fixed string value.
* Use DEBUG_LINE_NUMBER instead of __LINE__.
* Use DEBUG_EXPRESSION_STRING instead of #Expression.

Submodules that use __LINE__ are not updated. These do not
currently impact build reproducibility unless the debug features
of those submodules are enabled.

The one exception is the UnitTestFrameworkPkg cmocka submodule
that uses `__LINE__`. This means that the binaries generated by host
based unit tests that use cmocka features may not be identical across
a source format change.

Cc: Ard Biesheuvel ardb+tianocore@...
Cc: Jiewen Yao jiewen.yao@...
Cc: Jordan Justen jordan.l.justen@...
Cc: Gerd Hoffmann kraxel@...
Cc: Michael Kubacki michael.kubacki@...
Cc: Jian J Wang jian.j.wang@...
Cc: Maciej Rabeda maciej.rabeda@...
Cc: Jiaxin Wu jiaxin.wu@...
Cc: Siyuan Fu siyuan.fu@...
Cc: Liming Gao gaoliming@...
Cc: Leif Lindholm leif@...
Cc: Zhiguang Liu zhiguang.liu@...
Signed-off-by: Michael D Kinney michael.d.kinney@...

Michael D Kinney (6):
MdePkg: Reproduce builds across source format changes
ArmPkg: Reproduce builds across source format changes
MdeModulePkg: Reproduce builds across source format changes
NetworkPkg: Reproduce builds across source format changes
SecurityPkg: Reproduce builds across source format changes
OvmfPkg: Reproduce builds across source format changes

.../ProcessorSubClassDxe/ProcessorSubClass.c | 2 +-
.../Type00/MiscBiosVendorFunction.c | 2 +-
.../Type01/MiscSystemManufacturerFunction.c | 2 +-
.../MiscBaseBoardManufacturerFunction.c | 2 +-
.../Type03/MiscChassisManufacturerFunction.c | 2 +-
...MiscNumberOfInstallableLanguagesFunction.c | 2 +-
.../Type32/MiscBootInformationFunction.c | 2 +-
.../Bus/Pci/PciHostBridgeDxe/PciHostBridge.c | 2 +-
.../UefiBootManagerLib/BmDriverHealth.c | 2 +-
MdePkg/Include/Library/DebugLib.h | 42 +++++++++++++++++--
MdePkg/Include/Library/UnitTestLib.h | 18 ++++----
MdePkg/Library/BaseLib/SafeString.c | 2 +-
NetworkPkg/Include/Library/NetLib.h | 8 ++--
NetworkPkg/Library/DxeNetLib/DxeNetLib.c | 2 +-
OvmfPkg/Csm/LegacyBiosDxe/LegacyPci.c | 6 +--
.../PlatformBootManagerLib/BdsPlatform.c | 4 +-
.../PlatformBootManagerLibBhyve/BdsPlatform.c | 2 +-
.../PlatformBootManagerLibGrub/BdsPlatform.c | 4 +-
.../Include/Library/TcgStorageCoreLib.h | 4 +-
19 files changed, 72 insertions(+), 38 deletions(-)

--
2.32.0.windows.1


[Patch 6/6] OvmfPkg: Reproduce builds across source format changes

Michael D Kinney
 

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

Use DEBUG_LINE_NUMBER instead of __LINE__.

Cc: Ard Biesheuvel <ardb+tianocore@...>
Cc: Jiewen Yao <jiewen.yao@...>
Cc: Jordan Justen <jordan.l.justen@...>
Cc: Gerd Hoffmann <kraxel@...>
Cc: Michael Kubacki <michael.kubacki@...>
Signed-off-by: Michael D Kinney <michael.d.kinney@...>
---
OvmfPkg/Csm/LegacyBiosDxe/LegacyPci.c | 6 +++---
OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c | 4 ++--
OvmfPkg/Library/PlatformBootManagerLibBhyve/BdsPlatform.c | 2 +-
OvmfPkg/Library/PlatformBootManagerLibGrub/BdsPlatform.c | 4 ++--
4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/OvmfPkg/Csm/LegacyBiosDxe/LegacyPci.c b/OvmfPkg/Csm/LegacyBiosDxe/LegacyPci.c
index 746b366448e6..350cf3dd0b3a 100644
--- a/OvmfPkg/Csm/LegacyBiosDxe/LegacyPci.c
+++ b/OvmfPkg/Csm/LegacyBiosDxe/LegacyPci.c
@@ -2321,7 +2321,7 @@ LegacyBiosInstallRom (
);

if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_ERROR, "return LegacyBiosInstallRom(%d): EFI_OUT_OF_RESOURCES (no more space for OpROM)\n", __LINE__));
+ DEBUG ((DEBUG_ERROR, "return LegacyBiosInstallRom(%d): EFI_OUT_OF_RESOURCES (no more space for OpROM)\n", DEBUG_LINE_NUMBER));
//
// Report Status Code to indicate that there is no enough space for OpROM
//
@@ -2337,7 +2337,7 @@ LegacyBiosInstallRom (
//
RuntimeAddress = Private->OptionRom;
if (RuntimeAddress + *RuntimeImageLength > MaxRomAddr) {
- DEBUG ((DEBUG_ERROR, "return LegacyBiosInstallRom(%d): EFI_OUT_OF_RESOURCES (no more space for OpROM)\n", __LINE__));
+ DEBUG ((DEBUG_ERROR, "return LegacyBiosInstallRom(%d): EFI_OUT_OF_RESOURCES (no more space for OpROM)\n", DEBUG_LINE_NUMBER));
gBS->FreePages (PhysicalAddress, EFI_SIZE_TO_PAGES (ImageSize));
//
// Report Status Code to indicate that there is no enough space for OpROM
@@ -2355,7 +2355,7 @@ LegacyBiosInstallRom (
//
InitAddress = PCI_START_ADDRESS (Private->OptionRom);
if (InitAddress + ImageSize > MaxRomAddr) {
- DEBUG ((DEBUG_ERROR, "return LegacyBiosInstallRom(%d): EFI_OUT_OF_RESOURCES (no more space for OpROM)\n", __LINE__));
+ DEBUG ((DEBUG_ERROR, "return LegacyBiosInstallRom(%d): EFI_OUT_OF_RESOURCES (no more space for OpROM)\n", DEBUG_LINE_NUMBER));
//
// Report Status Code to indicate that there is no enough space for OpROM
//
diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
index 9b21ba2bd699..186401296ae2 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
+++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
@@ -624,7 +624,7 @@ PrepareLpcBridgeDevicePath (
DEBUG((
DEBUG_INFO,
"BdsPlatform.c+%d: COM%d DevPath: %s\n",
- __LINE__,
+ DEBUG_LINE_NUMBER,
gPnp16550ComPortDeviceNode.UID + 1,
DevPathStr
));
@@ -656,7 +656,7 @@ PrepareLpcBridgeDevicePath (
DEBUG((
DEBUG_INFO,
"BdsPlatform.c+%d: COM%d DevPath: %s\n",
- __LINE__,
+ DEBUG_LINE_NUMBER,
gPnp16550ComPortDeviceNode.UID + 1,
DevPathStr
));
diff --git a/OvmfPkg/Library/PlatformBootManagerLibBhyve/BdsPlatform.c b/OvmfPkg/Library/PlatformBootManagerLibBhyve/BdsPlatform.c
index 513d2f00a747..e767c3b172ba 100644
--- a/OvmfPkg/Library/PlatformBootManagerLibBhyve/BdsPlatform.c
+++ b/OvmfPkg/Library/PlatformBootManagerLibBhyve/BdsPlatform.c
@@ -586,7 +586,7 @@ PrepareLpcBridgeDevicePath (
DEBUG((
DEBUG_INFO,
"BdsPlatform.c+%d: COM%d DevPath: %s\n",
- __LINE__,
+ DEBUG_LINE_NUMBER,
gPnp16550ComPortDeviceNode.UID + 1,
DevPathStr
));
diff --git a/OvmfPkg/Library/PlatformBootManagerLibGrub/BdsPlatform.c b/OvmfPkg/Library/PlatformBootManagerLibGrub/BdsPlatform.c
index 1c5405f620e7..fd8057735549 100644
--- a/OvmfPkg/Library/PlatformBootManagerLibGrub/BdsPlatform.c
+++ b/OvmfPkg/Library/PlatformBootManagerLibGrub/BdsPlatform.c
@@ -556,7 +556,7 @@ PrepareLpcBridgeDevicePath (
DEBUG((
DEBUG_INFO,
"BdsPlatform.c+%d: COM%d DevPath: %s\n",
- __LINE__,
+ DEBUG_LINE_NUMBER,
gPnp16550ComPortDeviceNode.UID + 1,
DevPathStr
));
@@ -588,7 +588,7 @@ PrepareLpcBridgeDevicePath (
DEBUG((
DEBUG_INFO,
"BdsPlatform.c+%d: COM%d DevPath: %s\n",
- __LINE__,
+ DEBUG_LINE_NUMBER,
gPnp16550ComPortDeviceNode.UID + 1,
DevPathStr
));
--
2.32.0.windows.1


[Patch 5/6] SecurityPkg: Reproduce builds across source format changes

Michael D Kinney
 

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

Use DEBUG_LINE_NUMBER instead of __LINE__.

Cc: Jiewen Yao <jiewen.yao@...>
Cc: Jian J Wang <jian.j.wang@...>
Cc: Michael Kubacki <michael.kubacki@...>
Signed-off-by: Michael D Kinney <michael.d.kinney@...>
---
SecurityPkg/Include/Library/TcgStorageCoreLib.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/SecurityPkg/Include/Library/TcgStorageCoreLib.h b/SecurityPkg/Include/Library/TcgStorageCoreLib.h
index 01a44c667c80..44dbdc0ffa32 100644
--- a/SecurityPkg/Include/Library/TcgStorageCoreLib.h
+++ b/SecurityPkg/Include/Library/TcgStorageCoreLib.h
@@ -20,7 +20,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
{ \
TCG_RESULT ret = (arg); \
if (ret != TcgResultSuccess) { \
- DEBUG ((DEBUG_INFO, "ERROR_CHECK failed at %a:%u\n", __FILE__, __LINE__)); \
+ DEBUG ((DEBUG_INFO, "ERROR_CHECK failed at %a:%u\n", __FILE__, DEBUG_LINE_NUMBER)); \
return ret; \
} \
}
@@ -34,7 +34,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#define NULL_CHECK(arg) \
do { \
if ((arg) == NULL) { \
- DEBUG ((DEBUG_INFO, "NULL_CHECK(%a) failed at %a:%u\n", #arg, __FILE__, __LINE__)); \
+ DEBUG ((DEBUG_INFO, "NULL_CHECK(%a) failed at %a:%u\n", #arg, __FILE__, DEBUG_LINE_NUMBER)); \
return TcgResultFailureNullPointer; \
} \
} while (0)
--
2.32.0.windows.1


[Patch 1/1] BaseTools/VrfCompile: Fix uninitialized field from unnamed field

Michael D Kinney
 

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

If a C structure parsed by the VFR compiler contains an unnamed
field, then mFieldName is left uninitialized, which generates
random data in the VFR compiler output file.

If the FieldName is NULL, then initialize pNewField->mFieldName
to a Null-terminated empty string.

Cc: Bob Feng <bob.c.feng@...>
Cc: Liming Gao <gaoliming@...>
Cc: Yuwei Chen <yuwei.chen@...>
Signed-off-by: Michael D Kinney <michael.d.kinney@...>
---
BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp b/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
index 2b9b5dbb1ca5..11470de45cce 100644
--- a/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
+++ b/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
@@ -1135,6 +1135,8 @@ CVfrVarDataTypeDB::DataTypeAddBitField (
if (FieldName != NULL) {
strncpy (pNewField->mFieldName, FieldName, MAX_NAME_LEN - 1);
pNewField->mFieldName[MAX_NAME_LEN - 1] = 0;
+ } else {
+ strncpy (pNewField->mFieldName, "", MAX_NAME_LEN - 1);
}
pNewField->mFieldType = pFieldType;
pNewField->mIsBitField = TRUE;
@@ -3916,5 +3918,3 @@ CVfrStringDB::GetUnicodeStringTextSize (
CVfrVarDataTypeDB gCVfrVarDataTypeDB;
CVfrDefaultStore gCVfrDefaultStore;
CVfrDataStorage gCVfrDataStorage;
-
-
--
2.32.0.windows.1


Re: [PATCH] Silicon/Qemu/Sbsa: Enable Always-On capability for PE timers

Leif Lindholm
 

Hi Shashi,

The build fails after applying this patch.
Please resubmit after you have fixed *and* tested it.

/
Leif

On Wed, Oct 27, 2021 at 21:07:56 -0400, Shashi Mallela wrote:
Setting the Always-on Capability bit in GTDT table for
system PE timers in sbsa platform.This is also required
for ACS sbsa level 3 test compliancy.

Cc: Leif Lindholm <leif@...>
Cc: Ard Biesheuvel <ard.biesheuvel@...>
Cc: Graeme Gregory <graeme@...>
Signed-off-by: Shashi Mallela <shashi.mallela@...>
---
Silicon/Qemu/SbsaQemu/AcpiTables/Gtdt.aslc | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/Silicon/Qemu/SbsaQemu/AcpiTables/Gtdt.aslc b/Silicon/Qemu/SbsaQemu/AcpiTables/Gtdt.aslc
index 14733a37183d..27db6da61704 100644
--- a/Silicon/Qemu/SbsaQemu/AcpiTables/Gtdt.aslc
+++ b/Silicon/Qemu/SbsaQemu/AcpiTables/Gtdt.aslc
@@ -28,8 +28,11 @@
#define GTDT_TIMER_LEVEL_TRIGGERED 0
#define GTDT_TIMER_ACTIVE_LOW EFI_ACPI_6_3_GTDT_TIMER_FLAG_TIMER_INTERRUPT_POLARITY
#define GTDT_TIMER_ACTIVE_HIGH 0
+#define GTDT_TIMER_ALWAYS_ON EFI_ACPI_6_3_GTDT_TIMER_FLAG_ALWAYS_ON_CAPABILITY

-#define GTDT_GTIMER_FLAGS (GTDT_TIMER_ACTIVE_LOW | GTDT_TIMER_LEVEL_TRIGGERED)
+#define GTDT_GTIMER_FLAGS (GTDT_TIMER_ACTIVE_LOW |
+ GTDT_TIMER_LEVEL_TRIGGERED |
+ GTDT_TIMER_ALWAYS_ON)

#define SBSA_PLATFORM_WATCHDOG_COUNT 1
#define SBSA_PLATFORM_TIMER_COUNT (SBSA_PLATFORM_WATCHDOG_COUNT)
--
2.27.0


Re: [PATCH 0/4] SynQuacer drivers test the ControllerHandle correctly

Leif Lindholm
 

On Thu, Oct 28, 2021 at 09:53:34 +0900, Masami Hiramatsu wrote:
Hi Leif,

Thank you for your reply!

2021年10月27日(水) 20:21 Leif Lindholm <leif@...>:

Hi Masami,

Apologies for delay.

Thank you, this set looks good.
However, you cannot make legal statements on behalf of Sakamoto-san,
only yourself. If you are happy with that, I could drop their
Signed-off-by: statements before I push. They would retain the
authorship.
Actually I got this patch from Sakamoto-san with the Signed-off-by, so I sent
it via my own internal tree. OK, next time I will ask Sakamoto-san to send it
by himself, or just report to me and I write the patch.

Thank you,
For the series:
Reviewed-by: Leif Lindholm <leif@...>
Pushed as 06489b36ab34..a4f52afa363c.

(I also dropped the Contributed-under: tags - we stopped using those
after the license transition to bsd+patent.)

Best Regards,

Leif


Best Regards,

Leif

On Wed, Oct 13, 2021 at 14:36:43 +0900, Masami Hiramatsu wrote:
Hello,

Here are the patches to fix the SynQuacer related drivers to test
whether the ControllerHandle is managed by that driver correctly.
These bugs are found by edk2-test.

Thank you,

---

Kazuhiko Sakamoto (4):
Silicon/SynQuacerNetsecDxe: Test the ControllerHandle is managed by this driver
Silicon/SynQuacerI2cDxe: Test the ControllerHandle is managed by this driver
Silicon/AtSha204a: Test the ControllerHandle is managed by this driver
Silicon/ChaosKeyDxe: Test the ControllerHandle is managed by this driver


Silicon/Atmel/AtSha204a/AtSha204aDriver.h | 1 +
Silicon/Atmel/AtSha204a/ComponentName.c | 13 +++++++++++++
Silicon/Atmel/AtSha204a/DriverBinding.c | 1 -
Silicon/Openmoko/ChaosKeyDxe/ChaosKeyDriver.h | 1 +
Silicon/Openmoko/ChaosKeyDxe/ComponentName.c | 13 +++++++++++++
Silicon/Openmoko/ChaosKeyDxe/DriverBinding.c | 1 -
.../Drivers/Net/NetsecDxe/ComponentName.c | 13 +++++++++++++
.../Drivers/Net/NetsecDxe/DriverBinding.c | 1 -
.../SynQuacer/Drivers/Net/NetsecDxe/NetsecDxe.h | 1 +
.../Drivers/SynQuacerI2cDxe/ComponentName.c | 13 +++++++++++++
.../Drivers/SynQuacerI2cDxe/DriverBinding.c | 2 +-
.../Drivers/SynQuacerI2cDxe/SynQuacerI2cDxe.h | 1 +
12 files changed, 57 insertions(+), 4 deletions(-)

--
Masami Hiramatsu <masami.hiramatsu@...>


--
Masami Hiramatsu

9421 - 9440 of 92359