* [PATCH v2 01/16] DynamicTablesPkg: Fix entry point param definition
2020-03-29 15:13 [PATCH v2 00/16] Fix warnings reported by VS2017 compiler Sami Mujawar
@ 2020-03-29 15:13 ` Sami Mujawar
2020-03-30 8:09 ` [edk2-devel] " Ard Biesheuvel
2020-03-29 15:13 ` [PATCH v2 02/16] DynamicTablesPkg: Fix missing local header warning Sami Mujawar
` (14 subsequent siblings)
15 siblings, 1 reply; 22+ messages in thread
From: Sami Mujawar @ 2020-03-29 15:13 UTC (permalink / raw)
To: devel
Cc: Sami Mujawar, Alexei.Fedorov, leif.lindholm, Matteo.Carlini,
Laura.Moretta, nd
VS2017 reports 'warning C4028: formal parameter 2 different
from declaration' for the library constructor and destructor
interfaces for the Generator modules. VS2017 compiler also
reports similar warnings for the DXE entry points.
Remove the CONST qualifier for the SystemTable pointer (the
second parameter to the constructor/destructor/DXE Entry
point) to make it compatible with the formal declaration.
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
---
Notes:
v2:
Splitting patch series and re-submitting DynamicTablesPkg [SAMI]
patches from https://edk2.groups.io/g/devel/message/46261
DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.c | 6 +++---
DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.c | 4 ++--
DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c | 8 ++++----
DynamicTablesPkg/Library/Acpi/Arm/AcpiFadtLibArm/FadtGenerator.c | 8 ++++----
DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/GtdtGenerator.c | 8 ++++----
DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c | 8 ++++----
DynamicTablesPkg/Library/Acpi/Arm/AcpiMadtLibArm/MadtGenerator.c | 8 ++++----
DynamicTablesPkg/Library/Acpi/Arm/AcpiMcfgLibArm/McfgGenerator.c | 8 ++++----
DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c | 8 ++++----
DynamicTablesPkg/Library/Acpi/Arm/AcpiRawLibArm/RawGenerator.c | 8 ++++----
DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c | 8 ++++----
11 files changed, 41 insertions(+), 41 deletions(-)
diff --git a/DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.c b/DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.c
index d87ea7809eae09cdb5ff06290cff8c2d7e7fa904..d1432348f05143bed8588cea54d7b9b6722b9b6d 100644
--- a/DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.c
+++ b/DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.c
@@ -1,7 +1,7 @@
/** @file
Dynamic Table Factory Dxe
- Copyright (c) 2017 - 2018, ARM Limited. All rights reserved.
+ Copyright (c) 2017 - 2019, ARM Limited. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -60,8 +60,8 @@ EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL DynamicTableFactoryProtocol = {
EFI_STATUS
EFIAPI
DynamicTableFactoryDxeInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE * CONST SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE * SystemTable
)
{
EFI_STATUS Status;
diff --git a/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.c b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.c
index 39b75996d9922d2daf953bb28809aa285f7d214c..e27dcaf37470d811c4d6218d4f40d2260f550c02 100644
--- a/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.c
+++ b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.c
@@ -655,8 +655,8 @@ ProcessAcpiTables (
EFI_STATUS
EFIAPI
DynamicTableManagerDxeInitialize (
- IN CONST EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE * CONST SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE * SystemTable
)
{
EFI_STATUS Status;
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c
index 0b45e15d2d1c2c1e35e801ca719d68d9ff88a65e..346ab5b22f5402bf87c385558f68f080d1b454ed 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c
@@ -418,8 +418,8 @@ ACPI_TABLE_GENERATOR Dbg2Generator = {
EFI_STATUS
EFIAPI
AcpiDbg2LibConstructor (
- IN CONST EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE * CONST SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE * SystemTable
)
{
EFI_STATUS Status;
@@ -442,8 +442,8 @@ AcpiDbg2LibConstructor (
EFI_STATUS
EFIAPI
AcpiDbg2LibDestructor (
- IN CONST EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE * CONST SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE * SystemTable
)
{
EFI_STATUS Status;
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiFadtLibArm/FadtGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiFadtLibArm/FadtGenerator.c
index 1f05a04c7cab0ce3d1264e34d9d0ef252277d81e..b748c982b285a8f6c012c0e08fb95c9904f47730 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiFadtLibArm/FadtGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiFadtLibArm/FadtGenerator.c
@@ -648,8 +648,8 @@ ACPI_TABLE_GENERATOR FadtGenerator = {
EFI_STATUS
EFIAPI
AcpiFadtLibConstructor (
- IN CONST EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE * CONST SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE * SystemTable
)
{
EFI_STATUS Status;
@@ -671,8 +671,8 @@ AcpiFadtLibConstructor (
EFI_STATUS
EFIAPI
AcpiFadtLibDestructor (
- IN CONST EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE * CONST SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE * SystemTable
)
{
EFI_STATUS Status;
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/GtdtGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/GtdtGenerator.c
index a30870806d7f223fde7311e3609cca92f47731cc..7e86c30649bd36ecebac75c7e3a86a0c25cd590b 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/GtdtGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/GtdtGenerator.c
@@ -738,8 +738,8 @@ ACPI_TABLE_GENERATOR GtdtGenerator = {
EFI_STATUS
EFIAPI
AcpiGtdtLibConstructor (
- IN CONST EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE * CONST SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE * SystemTable
)
{
EFI_STATUS Status;
@@ -761,8 +761,8 @@ AcpiGtdtLibConstructor (
EFI_STATUS
EFIAPI
AcpiGtdtLibDestructor (
- IN CONST EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE * CONST SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE * SystemTable
)
{
EFI_STATUS Status;
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c
index 05e360c899c7563aed04c071921865929524fdc4..f303e9f29cc700634d236c08505cab91b9d62cb8 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c
@@ -2040,8 +2040,8 @@ ACPI_IORT_GENERATOR IortGenerator = {
EFI_STATUS
EFIAPI
AcpiIortLibConstructor (
- IN CONST EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE * CONST SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE * SystemTable
)
{
EFI_STATUS Status;
@@ -2063,8 +2063,8 @@ AcpiIortLibConstructor (
EFI_STATUS
EFIAPI
AcpiIortLibDestructor (
- IN CONST EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE * CONST SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE * SystemTable
)
{
EFI_STATUS Status;
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiMadtLibArm/MadtGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiMadtLibArm/MadtGenerator.c
index dc5238078376746847e7ae14258bbe35ca07ca2c..2651ca15414694c494678bcec655fc882ee2cc0c 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiMadtLibArm/MadtGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiMadtLibArm/MadtGenerator.c
@@ -795,8 +795,8 @@ ACPI_TABLE_GENERATOR MadtGenerator = {
EFI_STATUS
EFIAPI
AcpiMadtLibConstructor (
- IN CONST EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE * CONST SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE * SystemTable
)
{
EFI_STATUS Status;
@@ -818,8 +818,8 @@ AcpiMadtLibConstructor (
EFI_STATUS
EFIAPI
AcpiMadtLibDestructor (
- IN CONST EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE * CONST SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE * SystemTable
)
{
EFI_STATUS Status;
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiMcfgLibArm/McfgGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiMcfgLibArm/McfgGenerator.c
index d219e2f04ad6602b8157b048ae840a3094492680..1293ac8e43c8e0ed641b20ba42519172bc541b54 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiMcfgLibArm/McfgGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiMcfgLibArm/McfgGenerator.c
@@ -329,8 +329,8 @@ ACPI_TABLE_GENERATOR McfgGenerator = {
EFI_STATUS
EFIAPI
AcpiMcfgLibConstructor (
- IN CONST EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE * CONST SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE * SystemTable
)
{
EFI_STATUS Status;
@@ -352,8 +352,8 @@ AcpiMcfgLibConstructor (
EFI_STATUS
EFIAPI
AcpiMcfgLibDestructor (
- IN CONST EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE * CONST SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE * SystemTable
)
{
EFI_STATUS Status;
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c
index c8713dec625cc18b0806659ffcdc3d9e70411e11..9e42eee9b75bb330833b0f56c98947563d9eb821 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c
@@ -1492,8 +1492,8 @@ ACPI_PPTT_GENERATOR PpttGenerator = {
EFI_STATUS
EFIAPI
AcpiPpttLibConstructor (
- IN CONST EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE * CONST SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE * SystemTable
)
{
EFI_STATUS Status;
@@ -1516,8 +1516,8 @@ AcpiPpttLibConstructor (
EFI_STATUS
EFIAPI
AcpiPpttLibDestructor (
- IN CONST EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE * CONST SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE * SystemTable
)
{
EFI_STATUS Status;
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiRawLibArm/RawGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiRawLibArm/RawGenerator.c
index 544ea06f0bcb3442b78cf6409846f70ae5360664..2facfaa048115575829c9787084876efbe60834a 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiRawLibArm/RawGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiRawLibArm/RawGenerator.c
@@ -109,8 +109,8 @@ ACPI_TABLE_GENERATOR RawGenerator = {
EFI_STATUS
EFIAPI
AcpiRawLibConstructor (
- IN CONST EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE * CONST SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE * SystemTable
)
{
EFI_STATUS Status;
@@ -132,8 +132,8 @@ AcpiRawLibConstructor (
EFI_STATUS
EFIAPI
AcpiRawLibDestructor (
- IN CONST EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE * CONST SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE * SystemTable
)
{
EFI_STATUS Status;
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c
index 7b70ba2c2c55a9a15a569680d1a57b359db4e73d..1404279f828d5c06bb7605cb2fe6d864ef7a080e 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c
@@ -308,8 +308,8 @@ ACPI_TABLE_GENERATOR SpcrGenerator = {
EFI_STATUS
EFIAPI
AcpiSpcrLibConstructor (
- IN CONST EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE * CONST SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE * SystemTable
)
{
EFI_STATUS Status;
@@ -331,8 +331,8 @@ AcpiSpcrLibConstructor (
EFI_STATUS
EFIAPI
AcpiSpcrLibDestructor (
- IN CONST EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE * CONST SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE * SystemTable
)
{
EFI_STATUS Status;
--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'
^ permalink raw reply related [flat|nested] 22+ messages in thread
* Re: [edk2-devel] [PATCH v2 01/16] DynamicTablesPkg: Fix entry point param definition
2020-03-29 15:13 ` [PATCH v2 01/16] DynamicTablesPkg: Fix entry point param definition Sami Mujawar
@ 2020-03-30 8:09 ` Ard Biesheuvel
0 siblings, 0 replies; 22+ messages in thread
From: Ard Biesheuvel @ 2020-03-30 8:09 UTC (permalink / raw)
To: edk2-devel-groups-io, Sami Mujawar
Cc: Alexei Fedorov, (Exiting) Leif Lindholm, Matteo Carlini,
Laura Moretta, nd
On Sun, 29 Mar 2020 at 17:14, Sami Mujawar <sami.mujawar@arm.com> wrote:
>
> VS2017 reports 'warning C4028: formal parameter 2 different
> from declaration' for the library constructor and destructor
> interfaces for the Generator modules. VS2017 compiler also
> reports similar warnings for the DXE entry points.
>
> Remove the CONST qualifier for the SystemTable pointer (the
> second parameter to the constructor/destructor/DXE Entry
> point) to make it compatible with the formal declaration.
>
> Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
> ---
>
> Notes:
> v2:
> Splitting patch series and re-submitting DynamicTablesPkg [SAMI]
> patches from https://edk2.groups.io/g/devel/message/46261
>
> DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.c | 6 +++---
> DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.c | 4 ++--
> DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c | 8 ++++----
> DynamicTablesPkg/Library/Acpi/Arm/AcpiFadtLibArm/FadtGenerator.c | 8 ++++----
> DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/GtdtGenerator.c | 8 ++++----
> DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c | 8 ++++----
> DynamicTablesPkg/Library/Acpi/Arm/AcpiMadtLibArm/MadtGenerator.c | 8 ++++----
> DynamicTablesPkg/Library/Acpi/Arm/AcpiMcfgLibArm/McfgGenerator.c | 8 ++++----
> DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c | 8 ++++----
> DynamicTablesPkg/Library/Acpi/Arm/AcpiRawLibArm/RawGenerator.c | 8 ++++----
> DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c | 8 ++++----
> 11 files changed, 41 insertions(+), 41 deletions(-)
>
> diff --git a/DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.c b/DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.c
> index d87ea7809eae09cdb5ff06290cff8c2d7e7fa904..d1432348f05143bed8588cea54d7b9b6722b9b6d 100644
> --- a/DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.c
> +++ b/DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.c
> @@ -1,7 +1,7 @@
> /** @file
> Dynamic Table Factory Dxe
>
> - Copyright (c) 2017 - 2018, ARM Limited. All rights reserved.
> + Copyright (c) 2017 - 2019, ARM Limited. All rights reserved.
>
> SPDX-License-Identifier: BSD-2-Clause-Patent
>
> @@ -60,8 +60,8 @@ EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL DynamicTableFactoryProtocol = {
> EFI_STATUS
> EFIAPI
> DynamicTableFactoryDxeInitialize (
> - IN EFI_HANDLE ImageHandle,
> - IN EFI_SYSTEM_TABLE * CONST SystemTable
> + IN EFI_HANDLE ImageHandle,
> + IN EFI_SYSTEM_TABLE * SystemTable
Can we make this
> + IN EFI_SYSTEM_TABLE *SystemTable
instead? (throughout this patch)
> )
> {
> EFI_STATUS Status;
> diff --git a/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.c b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.c
> index 39b75996d9922d2daf953bb28809aa285f7d214c..e27dcaf37470d811c4d6218d4f40d2260f550c02 100644
> --- a/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.c
> +++ b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.c
> @@ -655,8 +655,8 @@ ProcessAcpiTables (
> EFI_STATUS
> EFIAPI
> DynamicTableManagerDxeInitialize (
> - IN CONST EFI_HANDLE ImageHandle,
> - IN EFI_SYSTEM_TABLE * CONST SystemTable
> + IN EFI_HANDLE ImageHandle,
> + IN EFI_SYSTEM_TABLE * SystemTable
> )
> {
> EFI_STATUS Status;
> diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c
> index 0b45e15d2d1c2c1e35e801ca719d68d9ff88a65e..346ab5b22f5402bf87c385558f68f080d1b454ed 100644
> --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c
> +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c
> @@ -418,8 +418,8 @@ ACPI_TABLE_GENERATOR Dbg2Generator = {
> EFI_STATUS
> EFIAPI
> AcpiDbg2LibConstructor (
> - IN CONST EFI_HANDLE ImageHandle,
> - IN EFI_SYSTEM_TABLE * CONST SystemTable
> + IN EFI_HANDLE ImageHandle,
> + IN EFI_SYSTEM_TABLE * SystemTable
> )
> {
> EFI_STATUS Status;
> @@ -442,8 +442,8 @@ AcpiDbg2LibConstructor (
> EFI_STATUS
> EFIAPI
> AcpiDbg2LibDestructor (
> - IN CONST EFI_HANDLE ImageHandle,
> - IN EFI_SYSTEM_TABLE * CONST SystemTable
> + IN EFI_HANDLE ImageHandle,
> + IN EFI_SYSTEM_TABLE * SystemTable
> )
> {
> EFI_STATUS Status;
> diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiFadtLibArm/FadtGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiFadtLibArm/FadtGenerator.c
> index 1f05a04c7cab0ce3d1264e34d9d0ef252277d81e..b748c982b285a8f6c012c0e08fb95c9904f47730 100644
> --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiFadtLibArm/FadtGenerator.c
> +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiFadtLibArm/FadtGenerator.c
> @@ -648,8 +648,8 @@ ACPI_TABLE_GENERATOR FadtGenerator = {
> EFI_STATUS
> EFIAPI
> AcpiFadtLibConstructor (
> - IN CONST EFI_HANDLE ImageHandle,
> - IN EFI_SYSTEM_TABLE * CONST SystemTable
> + IN EFI_HANDLE ImageHandle,
> + IN EFI_SYSTEM_TABLE * SystemTable
> )
> {
> EFI_STATUS Status;
> @@ -671,8 +671,8 @@ AcpiFadtLibConstructor (
> EFI_STATUS
> EFIAPI
> AcpiFadtLibDestructor (
> - IN CONST EFI_HANDLE ImageHandle,
> - IN EFI_SYSTEM_TABLE * CONST SystemTable
> + IN EFI_HANDLE ImageHandle,
> + IN EFI_SYSTEM_TABLE * SystemTable
> )
> {
> EFI_STATUS Status;
> diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/GtdtGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/GtdtGenerator.c
> index a30870806d7f223fde7311e3609cca92f47731cc..7e86c30649bd36ecebac75c7e3a86a0c25cd590b 100644
> --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/GtdtGenerator.c
> +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/GtdtGenerator.c
> @@ -738,8 +738,8 @@ ACPI_TABLE_GENERATOR GtdtGenerator = {
> EFI_STATUS
> EFIAPI
> AcpiGtdtLibConstructor (
> - IN CONST EFI_HANDLE ImageHandle,
> - IN EFI_SYSTEM_TABLE * CONST SystemTable
> + IN EFI_HANDLE ImageHandle,
> + IN EFI_SYSTEM_TABLE * SystemTable
> )
> {
> EFI_STATUS Status;
> @@ -761,8 +761,8 @@ AcpiGtdtLibConstructor (
> EFI_STATUS
> EFIAPI
> AcpiGtdtLibDestructor (
> - IN CONST EFI_HANDLE ImageHandle,
> - IN EFI_SYSTEM_TABLE * CONST SystemTable
> + IN EFI_HANDLE ImageHandle,
> + IN EFI_SYSTEM_TABLE * SystemTable
> )
> {
> EFI_STATUS Status;
> diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c
> index 05e360c899c7563aed04c071921865929524fdc4..f303e9f29cc700634d236c08505cab91b9d62cb8 100644
> --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c
> +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c
> @@ -2040,8 +2040,8 @@ ACPI_IORT_GENERATOR IortGenerator = {
> EFI_STATUS
> EFIAPI
> AcpiIortLibConstructor (
> - IN CONST EFI_HANDLE ImageHandle,
> - IN EFI_SYSTEM_TABLE * CONST SystemTable
> + IN EFI_HANDLE ImageHandle,
> + IN EFI_SYSTEM_TABLE * SystemTable
> )
> {
> EFI_STATUS Status;
> @@ -2063,8 +2063,8 @@ AcpiIortLibConstructor (
> EFI_STATUS
> EFIAPI
> AcpiIortLibDestructor (
> - IN CONST EFI_HANDLE ImageHandle,
> - IN EFI_SYSTEM_TABLE * CONST SystemTable
> + IN EFI_HANDLE ImageHandle,
> + IN EFI_SYSTEM_TABLE * SystemTable
> )
> {
> EFI_STATUS Status;
> diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiMadtLibArm/MadtGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiMadtLibArm/MadtGenerator.c
> index dc5238078376746847e7ae14258bbe35ca07ca2c..2651ca15414694c494678bcec655fc882ee2cc0c 100644
> --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiMadtLibArm/MadtGenerator.c
> +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiMadtLibArm/MadtGenerator.c
> @@ -795,8 +795,8 @@ ACPI_TABLE_GENERATOR MadtGenerator = {
> EFI_STATUS
> EFIAPI
> AcpiMadtLibConstructor (
> - IN CONST EFI_HANDLE ImageHandle,
> - IN EFI_SYSTEM_TABLE * CONST SystemTable
> + IN EFI_HANDLE ImageHandle,
> + IN EFI_SYSTEM_TABLE * SystemTable
> )
> {
> EFI_STATUS Status;
> @@ -818,8 +818,8 @@ AcpiMadtLibConstructor (
> EFI_STATUS
> EFIAPI
> AcpiMadtLibDestructor (
> - IN CONST EFI_HANDLE ImageHandle,
> - IN EFI_SYSTEM_TABLE * CONST SystemTable
> + IN EFI_HANDLE ImageHandle,
> + IN EFI_SYSTEM_TABLE * SystemTable
> )
> {
> EFI_STATUS Status;
> diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiMcfgLibArm/McfgGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiMcfgLibArm/McfgGenerator.c
> index d219e2f04ad6602b8157b048ae840a3094492680..1293ac8e43c8e0ed641b20ba42519172bc541b54 100644
> --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiMcfgLibArm/McfgGenerator.c
> +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiMcfgLibArm/McfgGenerator.c
> @@ -329,8 +329,8 @@ ACPI_TABLE_GENERATOR McfgGenerator = {
> EFI_STATUS
> EFIAPI
> AcpiMcfgLibConstructor (
> - IN CONST EFI_HANDLE ImageHandle,
> - IN EFI_SYSTEM_TABLE * CONST SystemTable
> + IN EFI_HANDLE ImageHandle,
> + IN EFI_SYSTEM_TABLE * SystemTable
> )
> {
> EFI_STATUS Status;
> @@ -352,8 +352,8 @@ AcpiMcfgLibConstructor (
> EFI_STATUS
> EFIAPI
> AcpiMcfgLibDestructor (
> - IN CONST EFI_HANDLE ImageHandle,
> - IN EFI_SYSTEM_TABLE * CONST SystemTable
> + IN EFI_HANDLE ImageHandle,
> + IN EFI_SYSTEM_TABLE * SystemTable
> )
> {
> EFI_STATUS Status;
> diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c
> index c8713dec625cc18b0806659ffcdc3d9e70411e11..9e42eee9b75bb330833b0f56c98947563d9eb821 100644
> --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c
> +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c
> @@ -1492,8 +1492,8 @@ ACPI_PPTT_GENERATOR PpttGenerator = {
> EFI_STATUS
> EFIAPI
> AcpiPpttLibConstructor (
> - IN CONST EFI_HANDLE ImageHandle,
> - IN EFI_SYSTEM_TABLE * CONST SystemTable
> + IN EFI_HANDLE ImageHandle,
> + IN EFI_SYSTEM_TABLE * SystemTable
> )
> {
> EFI_STATUS Status;
> @@ -1516,8 +1516,8 @@ AcpiPpttLibConstructor (
> EFI_STATUS
> EFIAPI
> AcpiPpttLibDestructor (
> - IN CONST EFI_HANDLE ImageHandle,
> - IN EFI_SYSTEM_TABLE * CONST SystemTable
> + IN EFI_HANDLE ImageHandle,
> + IN EFI_SYSTEM_TABLE * SystemTable
> )
> {
> EFI_STATUS Status;
> diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiRawLibArm/RawGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiRawLibArm/RawGenerator.c
> index 544ea06f0bcb3442b78cf6409846f70ae5360664..2facfaa048115575829c9787084876efbe60834a 100644
> --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiRawLibArm/RawGenerator.c
> +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiRawLibArm/RawGenerator.c
> @@ -109,8 +109,8 @@ ACPI_TABLE_GENERATOR RawGenerator = {
> EFI_STATUS
> EFIAPI
> AcpiRawLibConstructor (
> - IN CONST EFI_HANDLE ImageHandle,
> - IN EFI_SYSTEM_TABLE * CONST SystemTable
> + IN EFI_HANDLE ImageHandle,
> + IN EFI_SYSTEM_TABLE * SystemTable
> )
> {
> EFI_STATUS Status;
> @@ -132,8 +132,8 @@ AcpiRawLibConstructor (
> EFI_STATUS
> EFIAPI
> AcpiRawLibDestructor (
> - IN CONST EFI_HANDLE ImageHandle,
> - IN EFI_SYSTEM_TABLE * CONST SystemTable
> + IN EFI_HANDLE ImageHandle,
> + IN EFI_SYSTEM_TABLE * SystemTable
> )
> {
> EFI_STATUS Status;
> diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c
> index 7b70ba2c2c55a9a15a569680d1a57b359db4e73d..1404279f828d5c06bb7605cb2fe6d864ef7a080e 100644
> --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c
> +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c
> @@ -308,8 +308,8 @@ ACPI_TABLE_GENERATOR SpcrGenerator = {
> EFI_STATUS
> EFIAPI
> AcpiSpcrLibConstructor (
> - IN CONST EFI_HANDLE ImageHandle,
> - IN EFI_SYSTEM_TABLE * CONST SystemTable
> + IN EFI_HANDLE ImageHandle,
> + IN EFI_SYSTEM_TABLE * SystemTable
> )
> {
> EFI_STATUS Status;
> @@ -331,8 +331,8 @@ AcpiSpcrLibConstructor (
> EFI_STATUS
> EFIAPI
> AcpiSpcrLibDestructor (
> - IN CONST EFI_HANDLE ImageHandle,
> - IN EFI_SYSTEM_TABLE * CONST SystemTable
> + IN EFI_HANDLE ImageHandle,
> + IN EFI_SYSTEM_TABLE * SystemTable
> )
> {
> EFI_STATUS Status;
> --
> 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'
>
>
>
>
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH v2 02/16] DynamicTablesPkg: Fix missing local header warning
2020-03-29 15:13 [PATCH v2 00/16] Fix warnings reported by VS2017 compiler Sami Mujawar
2020-03-29 15:13 ` [PATCH v2 01/16] DynamicTablesPkg: Fix entry point param definition Sami Mujawar
@ 2020-03-29 15:13 ` Sami Mujawar
2020-03-30 8:09 ` [edk2-devel] " Ard Biesheuvel
2020-03-29 15:13 ` [PATCH v2 03/16] DynamicTablesPkg: Remove struct CM_ARM_CPU_INFO Sami Mujawar
` (13 subsequent siblings)
15 siblings, 1 reply; 22+ messages in thread
From: Sami Mujawar @ 2020-03-29 15:13 UTC (permalink / raw)
To: devel
Cc: Sami Mujawar, Alexei.Fedorov, leif.lindholm, Matteo.Carlini,
Laura.Moretta, nd
The edk2 BaseTools report a warning if a local header file
is not listed under the [Sources] section in the INF file.
Add header files to the [Sources] section in the respective
INF files to fix the warnings.
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
---
Notes:
v2:
Splitting patch series and re-submitting DynamicTablesPkg [SAMI]
patches from https://edk2.groups.io/g/devel/message/46261
DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.inf | 1 +
DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/AcpiIortLibArm.inf | 3 ++-
DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/AcpiPpttLibArm.inf | 1 +
3 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.inf b/DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.inf
index b47a690dd72702a2d7157cbb21249ba1d01d08cd..56b69591ac52ca3ba51250dc01a0846b22442ce9 100644
--- a/DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.inf
+++ b/DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.inf
@@ -25,6 +25,7 @@ [Sources]
DeviceTreeTableFactory/DeviceTreeTableFactory.c
DynamicTableFactoryDxe.c
SmbiosTableFactory/SmbiosTableFactory.c
+ DynamicTableFactory.h
[Packages]
MdePkg/MdePkg.dec
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/AcpiIortLibArm.inf b/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/AcpiIortLibArm.inf
index 3bbd0e7818c6172f9178b12a3d0960e2d298bca1..2f987e3b6d339d4b5f342cb52b8dc712cf4e585c 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/AcpiIortLibArm.inf
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/AcpiIortLibArm.inf
@@ -1,7 +1,7 @@
## @file
# IORT Table Generator
#
-# Copyright (c) 2017 - 2018, ARM Limited. All rights reserved.
+# Copyright (c) 2017 - 2019, ARM Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
##
@@ -18,6 +18,7 @@ [Defines]
[Sources]
IortGenerator.c
+ IortGenerator.h
[Packages]
MdePkg/MdePkg.dec
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/AcpiPpttLibArm.inf b/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/AcpiPpttLibArm.inf
index 3cb13d7d8fd3df04f3e16cc6161d9736f7579a80..2c7d19513d6ceea29fd9f271f983a6cf6d2c1046 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/AcpiPpttLibArm.inf
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/AcpiPpttLibArm.inf
@@ -18,6 +18,7 @@ [Defines]
[Sources]
PpttGenerator.c
+ PpttGenerator.h
[Packages]
EmbeddedPkg/EmbeddedPkg.dec
--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'
^ permalink raw reply related [flat|nested] 22+ messages in thread
* Re: [edk2-devel] [PATCH v2 02/16] DynamicTablesPkg: Fix missing local header warning
2020-03-29 15:13 ` [PATCH v2 02/16] DynamicTablesPkg: Fix missing local header warning Sami Mujawar
@ 2020-03-30 8:09 ` Ard Biesheuvel
0 siblings, 0 replies; 22+ messages in thread
From: Ard Biesheuvel @ 2020-03-30 8:09 UTC (permalink / raw)
To: edk2-devel-groups-io, Sami Mujawar
Cc: Alexei Fedorov, (Exiting) Leif Lindholm, Matteo Carlini,
Laura Moretta, nd
On Sun, 29 Mar 2020 at 17:14, Sami Mujawar <sami.mujawar@arm.com> wrote:
>
> The edk2 BaseTools report a warning if a local header file
> is not listed under the [Sources] section in the INF file.
>
> Add header files to the [Sources] section in the respective
> INF files to fix the warnings.
>
> Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
> Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
>
> Notes:
> v2:
> Splitting patch series and re-submitting DynamicTablesPkg [SAMI]
> patches from https://edk2.groups.io/g/devel/message/46261
>
> DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.inf | 1 +
> DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/AcpiIortLibArm.inf | 3 ++-
> DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/AcpiPpttLibArm.inf | 1 +
> 3 files changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.inf b/DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.inf
> index b47a690dd72702a2d7157cbb21249ba1d01d08cd..56b69591ac52ca3ba51250dc01a0846b22442ce9 100644
> --- a/DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.inf
> +++ b/DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.inf
> @@ -25,6 +25,7 @@ [Sources]
> DeviceTreeTableFactory/DeviceTreeTableFactory.c
> DynamicTableFactoryDxe.c
> SmbiosTableFactory/SmbiosTableFactory.c
> + DynamicTableFactory.h
>
> [Packages]
> MdePkg/MdePkg.dec
> diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/AcpiIortLibArm.inf b/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/AcpiIortLibArm.inf
> index 3bbd0e7818c6172f9178b12a3d0960e2d298bca1..2f987e3b6d339d4b5f342cb52b8dc712cf4e585c 100644
> --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/AcpiIortLibArm.inf
> +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/AcpiIortLibArm.inf
> @@ -1,7 +1,7 @@
> ## @file
> # IORT Table Generator
> #
> -# Copyright (c) 2017 - 2018, ARM Limited. All rights reserved.
> +# Copyright (c) 2017 - 2019, ARM Limited. All rights reserved.
> #
> # SPDX-License-Identifier: BSD-2-Clause-Patent
> ##
> @@ -18,6 +18,7 @@ [Defines]
>
> [Sources]
> IortGenerator.c
> + IortGenerator.h
>
> [Packages]
> MdePkg/MdePkg.dec
> diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/AcpiPpttLibArm.inf b/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/AcpiPpttLibArm.inf
> index 3cb13d7d8fd3df04f3e16cc6161d9736f7579a80..2c7d19513d6ceea29fd9f271f983a6cf6d2c1046 100644
> --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/AcpiPpttLibArm.inf
> +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/AcpiPpttLibArm.inf
> @@ -18,6 +18,7 @@ [Defines]
>
> [Sources]
> PpttGenerator.c
> + PpttGenerator.h
>
> [Packages]
> EmbeddedPkg/EmbeddedPkg.dec
> --
> 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'
>
>
>
>
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH v2 03/16] DynamicTablesPkg: Remove struct CM_ARM_CPU_INFO
2020-03-29 15:13 [PATCH v2 00/16] Fix warnings reported by VS2017 compiler Sami Mujawar
2020-03-29 15:13 ` [PATCH v2 01/16] DynamicTablesPkg: Fix entry point param definition Sami Mujawar
2020-03-29 15:13 ` [PATCH v2 02/16] DynamicTablesPkg: Fix missing local header warning Sami Mujawar
@ 2020-03-29 15:13 ` Sami Mujawar
2020-03-30 8:10 ` [edk2-devel] " Ard Biesheuvel
2020-03-29 15:13 ` [PATCH v2 04/16] DynamicTablesPkg: Fix serial port subtype warning Sami Mujawar
` (12 subsequent siblings)
15 siblings, 1 reply; 22+ messages in thread
From: Sami Mujawar @ 2020-03-29 15:13 UTC (permalink / raw)
To: devel
Cc: Sami Mujawar, Alexei.Fedorov, leif.lindholm, Matteo.Carlini,
Laura.Moretta, nd
The VS2017 compiler reports 'error C2016: C requires that
a struct or union has at least one member' for the struct
CM_ARM_CPU_INFO.
Remove struct CM_ARM_CPU_INFO as this is not in use.
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
---
Notes:
v2:
Splitting patch series and re-submitting DynamicTablesPkg [SAMI]
patches from https://edk2.groups.io/g/devel/message/46261
DynamicTablesPkg/Include/ArmNameSpaceObjects.h | 4 ----
1 file changed, 4 deletions(-)
diff --git a/DynamicTablesPkg/Include/ArmNameSpaceObjects.h b/DynamicTablesPkg/Include/ArmNameSpaceObjects.h
index da70cba2037592f02c72c026dc32f90b67bec8db..2874938b663c33edf5bdaac9f41495f75abfc945 100644
--- a/DynamicTablesPkg/Include/ArmNameSpaceObjects.h
+++ b/DynamicTablesPkg/Include/ArmNameSpaceObjects.h
@@ -71,10 +71,6 @@ typedef struct CmArmBootArchInfo {
UINT32 BootArchFlags;
} CM_ARM_BOOT_ARCH_INFO;
-typedef struct CmArmCpuInfo {
- // Reserved for use when SMBIOS tables are implemented
-} CM_ARM_CPU_INFO;
-
/** A structure that describes the
Power Management Profile Information for the Platform.
--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'
^ permalink raw reply related [flat|nested] 22+ messages in thread
* Re: [edk2-devel] [PATCH v2 03/16] DynamicTablesPkg: Remove struct CM_ARM_CPU_INFO
2020-03-29 15:13 ` [PATCH v2 03/16] DynamicTablesPkg: Remove struct CM_ARM_CPU_INFO Sami Mujawar
@ 2020-03-30 8:10 ` Ard Biesheuvel
0 siblings, 0 replies; 22+ messages in thread
From: Ard Biesheuvel @ 2020-03-30 8:10 UTC (permalink / raw)
To: edk2-devel-groups-io, Sami Mujawar
Cc: Alexei Fedorov, (Exiting) Leif Lindholm, Matteo Carlini,
Laura Moretta, nd
On Sun, 29 Mar 2020 at 17:14, Sami Mujawar <sami.mujawar@arm.com> wrote:
>
> The VS2017 compiler reports 'error C2016: C requires that
> a struct or union has at least one member' for the struct
> CM_ARM_CPU_INFO.
>
> Remove struct CM_ARM_CPU_INFO as this is not in use.
>
> Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
>
> Notes:
> v2:
> Splitting patch series and re-submitting DynamicTablesPkg [SAMI]
> patches from https://edk2.groups.io/g/devel/message/46261
>
> DynamicTablesPkg/Include/ArmNameSpaceObjects.h | 4 ----
> 1 file changed, 4 deletions(-)
>
> diff --git a/DynamicTablesPkg/Include/ArmNameSpaceObjects.h b/DynamicTablesPkg/Include/ArmNameSpaceObjects.h
> index da70cba2037592f02c72c026dc32f90b67bec8db..2874938b663c33edf5bdaac9f41495f75abfc945 100644
> --- a/DynamicTablesPkg/Include/ArmNameSpaceObjects.h
> +++ b/DynamicTablesPkg/Include/ArmNameSpaceObjects.h
> @@ -71,10 +71,6 @@ typedef struct CmArmBootArchInfo {
> UINT32 BootArchFlags;
> } CM_ARM_BOOT_ARCH_INFO;
>
> -typedef struct CmArmCpuInfo {
> - // Reserved for use when SMBIOS tables are implemented
> -} CM_ARM_CPU_INFO;
> -
> /** A structure that describes the
> Power Management Profile Information for the Platform.
>
> --
> 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'
>
>
>
>
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH v2 04/16] DynamicTablesPkg: Fix serial port subtype warning
2020-03-29 15:13 [PATCH v2 00/16] Fix warnings reported by VS2017 compiler Sami Mujawar
` (2 preceding siblings ...)
2020-03-29 15:13 ` [PATCH v2 03/16] DynamicTablesPkg: Remove struct CM_ARM_CPU_INFO Sami Mujawar
@ 2020-03-29 15:13 ` Sami Mujawar
2020-03-29 15:13 ` [PATCH v2 05/16] DynamicTablesPkg: Fix Proc node length assignment Sami Mujawar
` (11 subsequent siblings)
15 siblings, 0 replies; 22+ messages in thread
From: Sami Mujawar @ 2020-03-29 15:13 UTC (permalink / raw)
To: devel
Cc: Sami Mujawar, Alexei.Fedorov, leif.lindholm, Matteo.Carlini,
Laura.Moretta, nd
The VS2017 compiler reports 'warning C4244: '=': conversion
from 'UINT16' to 'UINT8', possible loss of data' for the
SPCR InterfaceType field assignment.
The SPCR InterfaceType field uses the same encoding as that
of the DBG2 table Port Subtype field. However SPCR.InterfaceType
is 8-bit while the Port Subtype field in DBG2 table is 16-bit.
Since the Configuration Manager represents the Serial port
information using the struct CM_ARM_SERIAL_PORT_INFO, the
PortSubtype member in this struct is 16-bit.
To fix the warning an explicit type case is added. A validation
is also added to ensure that the Serial Port Subtype value
provided by the Configuration Manager is within the 8-bit
range (less than 256).
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
---
Notes:
v2:
Splitting patch series and re-submitting DynamicTablesPkg [SAMI]
patches from https://edk2.groups.io/g/devel/message/46261
DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c
index 1404279f828d5c06bb7605cb2fe6d864ef7a080e..4b2580da7df9b4472ae9bcc3df2138a9e13004d0 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c
@@ -217,8 +217,21 @@ BuildSpcrTable (
goto error_handler;
}
+ // The SPCR InterfaceType uses the same encoding as that of the
+ // DBG2 table Port Subtype field. However InterfaceType is 8-bit
+ // while the Port Subtype field in the DBG2 table is 16-bit.
+ if ((SerialPortInfo->PortSubtype & 0xFF00) != 0) {
+ Status = EFI_INVALID_PARAMETER;
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: SPCR: Invalid Port Sybtype (must be < 256). Status = %r\n",
+ Status
+ ));
+ goto error_handler;
+ }
+
// Update the serial port subtype
- AcpiSpcr.InterfaceType = SerialPortInfo->PortSubtype;
+ AcpiSpcr.InterfaceType = (UINT8)SerialPortInfo->PortSubtype;
// Update the base address
AcpiSpcr.BaseAddress.Address = SerialPortInfo->BaseAddress;
--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v2 05/16] DynamicTablesPkg: Fix Proc node length assignment
2020-03-29 15:13 [PATCH v2 00/16] Fix warnings reported by VS2017 compiler Sami Mujawar
` (3 preceding siblings ...)
2020-03-29 15:13 ` [PATCH v2 04/16] DynamicTablesPkg: Fix serial port subtype warning Sami Mujawar
@ 2020-03-29 15:13 ` Sami Mujawar
2020-03-30 8:11 ` [edk2-devel] " Ard Biesheuvel
2020-03-29 15:13 ` [PATCH v2 06/16] DynamicTablesPkg: Fix GT Block " Sami Mujawar
` (10 subsequent siblings)
15 siblings, 1 reply; 22+ messages in thread
From: Sami Mujawar @ 2020-03-29 15:13 UTC (permalink / raw)
To: devel
Cc: Sami Mujawar, Alexei.Fedorov, leif.lindholm, Matteo.Carlini,
Laura.Moretta, nd
The length field for the Processor Hierarchy node structure is
8-bit wide while the number of private resource field is 32-bit
wide. Therefore, the GetProcHierarchyNodeSize() returns the size
as a 32-bit value.
The VS2017 compiler reports 'warning C4244: '=': conversion from
'UINT32' to 'UINT8', possible loss of data' while assigning the
length field of the Processor Hierarchy node structure.
To fix this, a type cast is added. In addition, there is a check
to ensure that the Processor Hierarchy node size does not exceed
MAX_UINT8.
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
---
Notes:
v2:
Splitting patch series and re-submitting DynamicTablesPkg [SAMI]
patches from https://edk2.groups.io/g/devel/message/46261
DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c
index 9e42eee9b75bb330833b0f56c98947563d9eb821..40699ce113caa8530c89ac20562cf5abda26b88e 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c
@@ -504,6 +504,7 @@ AddProcHierarchyNodes (
PPTT_NODE_INDEXER * ProcNodeIterator;
UINT32 NodeCount;
+ UINT32 Length;
ASSERT (
(Generator != NULL) &&
@@ -539,8 +540,8 @@ AddProcHierarchyNodes (
// imposed on the Processor Hierarchy node by the specification.
// Note: The length field is 8 bit wide while the number of private
// resource field is 32 bit wide.
- if ((sizeof (EFI_ACPI_6_3_PPTT_STRUCTURE_PROCESSOR) +
- (ProcInfoNode->NoOfPrivateResources * sizeof (UINT32))) > MAX_UINT8) {
+ Length = GetProcHierarchyNodeSize (ProcInfoNode);
+ if (Length > MAX_UINT8) {
Status = EFI_INVALID_PARAMETER;
DEBUG ((
DEBUG_ERROR,
@@ -556,7 +557,7 @@ AddProcHierarchyNodes (
// Populate the node header
ProcStruct->Type = EFI_ACPI_6_3_PPTT_TYPE_PROCESSOR;
- ProcStruct->Length = GetProcHierarchyNodeSize (ProcInfoNode);
+ ProcStruct->Length = (UINT8)Length;
ProcStruct->Reserved[0] = EFI_ACPI_RESERVED_BYTE;
ProcStruct->Reserved[1] = EFI_ACPI_RESERVED_BYTE;
--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'
^ permalink raw reply related [flat|nested] 22+ messages in thread
* Re: [edk2-devel] [PATCH v2 05/16] DynamicTablesPkg: Fix Proc node length assignment
2020-03-29 15:13 ` [PATCH v2 05/16] DynamicTablesPkg: Fix Proc node length assignment Sami Mujawar
@ 2020-03-30 8:11 ` Ard Biesheuvel
0 siblings, 0 replies; 22+ messages in thread
From: Ard Biesheuvel @ 2020-03-30 8:11 UTC (permalink / raw)
To: edk2-devel-groups-io, Sami Mujawar
Cc: Alexei Fedorov, (Exiting) Leif Lindholm, Matteo Carlini,
Laura Moretta, nd
On Sun, 29 Mar 2020 at 17:14, Sami Mujawar <sami.mujawar@arm.com> wrote:
>
> The length field for the Processor Hierarchy node structure is
> 8-bit wide while the number of private resource field is 32-bit
> wide. Therefore, the GetProcHierarchyNodeSize() returns the size
> as a 32-bit value.
>
> The VS2017 compiler reports 'warning C4244: '=': conversion from
> 'UINT32' to 'UINT8', possible loss of data' while assigning the
> length field of the Processor Hierarchy node structure.
>
> To fix this, a type cast is added. In addition, there is a check
> to ensure that the Processor Hierarchy node size does not exceed
> MAX_UINT8.
>
> Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
>
> Notes:
> v2:
> Splitting patch series and re-submitting DynamicTablesPkg [SAMI]
> patches from https://edk2.groups.io/g/devel/message/46261
>
> DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c
> index 9e42eee9b75bb330833b0f56c98947563d9eb821..40699ce113caa8530c89ac20562cf5abda26b88e 100644
> --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c
> +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c
> @@ -504,6 +504,7 @@ AddProcHierarchyNodes (
>
> PPTT_NODE_INDEXER * ProcNodeIterator;
> UINT32 NodeCount;
> + UINT32 Length;
>
> ASSERT (
> (Generator != NULL) &&
> @@ -539,8 +540,8 @@ AddProcHierarchyNodes (
> // imposed on the Processor Hierarchy node by the specification.
> // Note: The length field is 8 bit wide while the number of private
> // resource field is 32 bit wide.
> - if ((sizeof (EFI_ACPI_6_3_PPTT_STRUCTURE_PROCESSOR) +
> - (ProcInfoNode->NoOfPrivateResources * sizeof (UINT32))) > MAX_UINT8) {
> + Length = GetProcHierarchyNodeSize (ProcInfoNode);
> + if (Length > MAX_UINT8) {
> Status = EFI_INVALID_PARAMETER;
> DEBUG ((
> DEBUG_ERROR,
> @@ -556,7 +557,7 @@ AddProcHierarchyNodes (
>
> // Populate the node header
> ProcStruct->Type = EFI_ACPI_6_3_PPTT_TYPE_PROCESSOR;
> - ProcStruct->Length = GetProcHierarchyNodeSize (ProcInfoNode);
> + ProcStruct->Length = (UINT8)Length;
> ProcStruct->Reserved[0] = EFI_ACPI_RESERVED_BYTE;
> ProcStruct->Reserved[1] = EFI_ACPI_RESERVED_BYTE;
>
> --
> 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'
>
>
>
>
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH v2 06/16] DynamicTablesPkg: Fix GT Block length assignment
2020-03-29 15:13 [PATCH v2 00/16] Fix warnings reported by VS2017 compiler Sami Mujawar
` (4 preceding siblings ...)
2020-03-29 15:13 ` [PATCH v2 05/16] DynamicTablesPkg: Fix Proc node length assignment Sami Mujawar
@ 2020-03-29 15:13 ` Sami Mujawar
2020-03-29 15:13 ` [PATCH v2 07/16] DynamicTablesPkg: Fix Boot arch flag width Sami Mujawar
` (9 subsequent siblings)
15 siblings, 0 replies; 22+ messages in thread
From: Sami Mujawar @ 2020-03-29 15:13 UTC (permalink / raw)
To: devel
Cc: Sami Mujawar, Alexei.Fedorov, leif.lindholm, Matteo.Carlini,
Laura.Moretta, nd
The VS2017 compiler reports 'warning C4267: '=': conversion from
'size_t' to 'UINT16', possible loss of data'.
The sizeof() operator is used to calculate the size of the
GT Block structure. The length field in the GT Block structure
is 16-bit wide. Since the return type of sizeof() operator
is size_t the VS2017 compiler reports the above warning.
To fix the warning, an explicit type cast is added. An additional
check is also performed to ensure that the calculated GT Block
length does not exceed MAX_UINT16.
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
---
Notes:
v2:
Splitting patch series and re-submitting DynamicTablesPkg [SAMI]
patches from https://edk2.groups.io/g/devel/message/46261
DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/GtdtGenerator.c | 25 ++++++++++++++++----
1 file changed, 21 insertions(+), 4 deletions(-)
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/GtdtGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/GtdtGenerator.c
index 7e86c30649bd36ecebac75c7e3a86a0c25cd590b..0e996698887aefca8a7240fc27fe3cb9324fd3e2 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/GtdtGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/GtdtGenerator.c
@@ -350,6 +350,7 @@ AddGTBlockList (
EFI_ACPI_6_3_GTDT_GT_BLOCK_TIMER_STRUCTURE * GtBlockFrame;
CM_ARM_GTBLOCK_TIMER_FRAME_INFO * GTBlockTimerFrameList;
UINT32 GTBlockTimerFrameCount;
+ UINTN Length;
ASSERT (Gtdt != NULL);
ASSERT (GTBlockInfo != NULL);
@@ -376,11 +377,27 @@ AddGTBlockList (
return Status;
}
+ Length = sizeof (EFI_ACPI_6_3_GTDT_GT_BLOCK_STRUCTURE) +
+ (sizeof (EFI_ACPI_6_3_GTDT_GT_BLOCK_TIMER_STRUCTURE) *
+ GTBlockInfo->GTBlockTimerFrameCount);
+
+ // Check that the length of the GT block does not
+ // exceed MAX_UINT16
+ if (Length > MAX_UINT16) {
+ Status = EFI_INVALID_PARAMETER;
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: GTDT: Too many GT Frames. Count = %d. " \
+ "Maximum supported GT Block size exceeded. " \
+ "Status = %r\n",
+ GTBlockInfo->GTBlockTimerFrameCount,
+ Status
+ ));
+ return Status;
+ }
+
GTBlock->Type = EFI_ACPI_6_3_GTDT_GT_BLOCK;
- GTBlock->Length = sizeof (EFI_ACPI_6_3_GTDT_GT_BLOCK_STRUCTURE) +
- (sizeof (EFI_ACPI_6_3_GTDT_GT_BLOCK_TIMER_STRUCTURE) *
- GTBlockInfo->GTBlockTimerFrameCount);
-
+ GTBlock->Length = (UINT16)Length;
GTBlock->Reserved = EFI_ACPI_RESERVED_BYTE;
GTBlock->CntCtlBase = GTBlockInfo->GTBlockPhysicalAddress;
GTBlock->GTBlockTimerCount = GTBlockInfo->GTBlockTimerFrameCount;
--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v2 07/16] DynamicTablesPkg: Fix Boot arch flag width
2020-03-29 15:13 [PATCH v2 00/16] Fix warnings reported by VS2017 compiler Sami Mujawar
` (5 preceding siblings ...)
2020-03-29 15:13 ` [PATCH v2 06/16] DynamicTablesPkg: Fix GT Block " Sami Mujawar
@ 2020-03-29 15:13 ` Sami Mujawar
2020-03-29 15:13 ` [PATCH v2 08/16] DynamicTablesPkg: Fix ACPI table rev field width Sami Mujawar
` (8 subsequent siblings)
15 siblings, 0 replies; 22+ messages in thread
From: Sami Mujawar @ 2020-03-29 15:13 UTC (permalink / raw)
To: devel
Cc: Sami Mujawar, Alexei.Fedorov, leif.lindholm, Matteo.Carlini,
Laura.Moretta, nd
The ArmBootArch field of the FADT table is 16-bit wide. The
VS2017 compiler reports 'warning C4244: '=': conversion from
'UINT32' to 'UINT16', possible loss of data' when assigning the
CM_ARM_BOOT_ARCH_INFO.BootArchFlags value as the width of this
field in CM_ARM_BOOT_ARCH_INFO is 32-bit wide.
To fix this warning, update the CM_ARM_BOOT_ARCH_INFO struct
to make the BootArchFlags field 16-bit wide. This also makes
it compatible with the ACPI FADT specification.
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
---
Notes:
v2:
Splitting patch series and re-submitting DynamicTablesPkg [SAMI]
patches from https://edk2.groups.io/g/devel/message/46261
DynamicTablesPkg/Include/ArmNameSpaceObjects.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/DynamicTablesPkg/Include/ArmNameSpaceObjects.h b/DynamicTablesPkg/Include/ArmNameSpaceObjects.h
index 2874938b663c33edf5bdaac9f41495f75abfc945..2f326960313c1d7658029205e5cb09b89b0cdd88 100644
--- a/DynamicTablesPkg/Include/ArmNameSpaceObjects.h
+++ b/DynamicTablesPkg/Include/ArmNameSpaceObjects.h
@@ -68,7 +68,7 @@ typedef struct CmArmBootArchInfo {
/** This is the ARM_BOOT_ARCH flags field of the FADT Table
described in the ACPI Table Specification.
*/
- UINT32 BootArchFlags;
+ UINT16 BootArchFlags;
} CM_ARM_BOOT_ARCH_INFO;
/** A structure that describes the
--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v2 08/16] DynamicTablesPkg: Fix ACPI table rev field width
2020-03-29 15:13 [PATCH v2 00/16] Fix warnings reported by VS2017 compiler Sami Mujawar
` (6 preceding siblings ...)
2020-03-29 15:13 ` [PATCH v2 07/16] DynamicTablesPkg: Fix Boot arch flag width Sami Mujawar
@ 2020-03-29 15:13 ` Sami Mujawar
2020-03-30 8:11 ` [edk2-devel] " Ard Biesheuvel
2020-03-29 15:13 ` [PATCH v2 09/16] DynamicTablesPkg: Fix unaligned pointers usage Sami Mujawar
` (7 subsequent siblings)
15 siblings, 1 reply; 22+ messages in thread
From: Sami Mujawar @ 2020-03-29 15:13 UTC (permalink / raw)
To: devel
Cc: Sami Mujawar, Alexei.Fedorov, leif.lindholm, Matteo.Carlini,
Laura.Moretta, nd
The VS2017 compiler reports 'warning C4244: '=': conversion from
'const UINT32' to 'UINT8', possible loss of data' when the ACPI
table revision field is being updated.
The width of the revision field in the EFI_ACPI_DESCRIPTION_HEADER
struct is 8-bit wide. Therefore, to fix the above warning make the
ACPI Table revision field usage 8-bit wide across Dynamic Tables
Framework.
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
---
Notes:
v2:
Splitting patch series and re-submitting DynamicTablesPkg [SAMI]
patches from https://edk2.groups.io/g/devel/message/46261
DynamicTablesPkg/Include/AcpiTableGenerator.h | 4 ++--
DynamicTablesPkg/Include/StandardNameSpaceObjects.h | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/DynamicTablesPkg/Include/AcpiTableGenerator.h b/DynamicTablesPkg/Include/AcpiTableGenerator.h
index e46717e6e8442ec516ef79ea979bd29e070f6d0a..b55feb4e7507f0e4e1e0a64c3c4b8068f17dad47 100644
--- a/DynamicTablesPkg/Include/AcpiTableGenerator.h
+++ b/DynamicTablesPkg/Include/AcpiTableGenerator.h
@@ -287,10 +287,10 @@ typedef struct AcpiTableGenerator {
UINT32 AcpiTableSignature;
/// The ACPI table revision.
- UINT32 AcpiTableRevision;
+ UINT8 AcpiTableRevision;
/// The minimum supported ACPI table revision.
- UINT32 MinAcpiTableRevision;
+ UINT8 MinAcpiTableRevision;
/// The ACPI table creator ID.
UINT32 CreatorId;
diff --git a/DynamicTablesPkg/Include/StandardNameSpaceObjects.h b/DynamicTablesPkg/Include/StandardNameSpaceObjects.h
index 21bb7de4044ffd6f97156f761e30fc1790f11c0c..0ba6b163691ea127ae7a7d57fb5f9fdf84789338 100644
--- a/DynamicTablesPkg/Include/StandardNameSpaceObjects.h
+++ b/DynamicTablesPkg/Include/StandardNameSpaceObjects.h
@@ -79,7 +79,7 @@ typedef struct CmAStdObjAcpiTableInfo {
UINT32 AcpiTableSignature;
/// The ACPI table revision
- UINT32 AcpiTableRevision;
+ UINT8 AcpiTableRevision;
/// The ACPI Table Generator ID
ACPI_TABLE_GENERATOR_ID TableGeneratorId;
--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'
^ permalink raw reply related [flat|nested] 22+ messages in thread
* Re: [edk2-devel] [PATCH v2 08/16] DynamicTablesPkg: Fix ACPI table rev field width
2020-03-29 15:13 ` [PATCH v2 08/16] DynamicTablesPkg: Fix ACPI table rev field width Sami Mujawar
@ 2020-03-30 8:11 ` Ard Biesheuvel
0 siblings, 0 replies; 22+ messages in thread
From: Ard Biesheuvel @ 2020-03-30 8:11 UTC (permalink / raw)
To: edk2-devel-groups-io, Sami Mujawar
Cc: Alexei Fedorov, (Exiting) Leif Lindholm, Matteo Carlini,
Laura Moretta, nd
On Sun, 29 Mar 2020 at 17:14, Sami Mujawar <sami.mujawar@arm.com> wrote:
>
> The VS2017 compiler reports 'warning C4244: '=': conversion from
> 'const UINT32' to 'UINT8', possible loss of data' when the ACPI
> table revision field is being updated.
>
> The width of the revision field in the EFI_ACPI_DESCRIPTION_HEADER
> struct is 8-bit wide. Therefore, to fix the above warning make the
> ACPI Table revision field usage 8-bit wide across Dynamic Tables
> Framework.
>
> Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
>
> Notes:
> v2:
> Splitting patch series and re-submitting DynamicTablesPkg [SAMI]
> patches from https://edk2.groups.io/g/devel/message/46261
>
> DynamicTablesPkg/Include/AcpiTableGenerator.h | 4 ++--
> DynamicTablesPkg/Include/StandardNameSpaceObjects.h | 2 +-
> 2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/DynamicTablesPkg/Include/AcpiTableGenerator.h b/DynamicTablesPkg/Include/AcpiTableGenerator.h
> index e46717e6e8442ec516ef79ea979bd29e070f6d0a..b55feb4e7507f0e4e1e0a64c3c4b8068f17dad47 100644
> --- a/DynamicTablesPkg/Include/AcpiTableGenerator.h
> +++ b/DynamicTablesPkg/Include/AcpiTableGenerator.h
> @@ -287,10 +287,10 @@ typedef struct AcpiTableGenerator {
> UINT32 AcpiTableSignature;
>
> /// The ACPI table revision.
> - UINT32 AcpiTableRevision;
> + UINT8 AcpiTableRevision;
>
> /// The minimum supported ACPI table revision.
> - UINT32 MinAcpiTableRevision;
> + UINT8 MinAcpiTableRevision;
>
> /// The ACPI table creator ID.
> UINT32 CreatorId;
> diff --git a/DynamicTablesPkg/Include/StandardNameSpaceObjects.h b/DynamicTablesPkg/Include/StandardNameSpaceObjects.h
> index 21bb7de4044ffd6f97156f761e30fc1790f11c0c..0ba6b163691ea127ae7a7d57fb5f9fdf84789338 100644
> --- a/DynamicTablesPkg/Include/StandardNameSpaceObjects.h
> +++ b/DynamicTablesPkg/Include/StandardNameSpaceObjects.h
> @@ -79,7 +79,7 @@ typedef struct CmAStdObjAcpiTableInfo {
> UINT32 AcpiTableSignature;
>
> /// The ACPI table revision
> - UINT32 AcpiTableRevision;
> + UINT8 AcpiTableRevision;
>
> /// The ACPI Table Generator ID
> ACPI_TABLE_GENERATOR_ID TableGeneratorId;
> --
> 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'
>
>
>
>
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH v2 09/16] DynamicTablesPkg: Fix unaligned pointers usage
2020-03-29 15:13 [PATCH v2 00/16] Fix warnings reported by VS2017 compiler Sami Mujawar
` (7 preceding siblings ...)
2020-03-29 15:13 ` [PATCH v2 08/16] DynamicTablesPkg: Fix ACPI table rev field width Sami Mujawar
@ 2020-03-29 15:13 ` Sami Mujawar
2020-03-29 15:13 ` [PATCH v2 10/16] DynamicTablesPkg: Serial debug port initialisation Sami Mujawar
` (6 subsequent siblings)
15 siblings, 0 replies; 22+ messages in thread
From: Sami Mujawar @ 2020-03-29 15:13 UTC (permalink / raw)
To: devel
Cc: Sami Mujawar, Alexei.Fedorov, leif.lindholm, Matteo.Carlini,
Laura.Moretta, nd
The VS2017 compiler reports 'warning C4366: The result of
the unary '&' operator may be unaligned' if an address of
an unaligned structure member is passed as an argument to
a function.
Fix this warning by using local variables in place of
unaligned structure members.
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
---
Notes:
v2:
Splitting patch series and re-submitting DynamicTablesPkg [SAMI]
patches from https://edk2.groups.io/g/devel/message/46261
DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c | 24 +++++++++++++++-----
DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.h | 13 +++++------
2 files changed, 24 insertions(+), 13 deletions(-)
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c
index 40699ce113caa8530c89ac20562cf5abda26b88e..82070403ac8757f54e839fd00eb4acb3292fc60c 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c
@@ -1066,6 +1066,9 @@ BuildPpttTable (
EFI_STATUS Status;
UINT32 TableSize;
UINT32 ProcTopologyStructCount;
+ UINT32 ProcHierarchyNodeCount;
+ UINT32 CacheStructCount;
+ UINT32 IdStructCount;
UINT32 ProcHierarchyNodeOffset;
UINT32 CacheStructOffset;
@@ -1113,7 +1116,7 @@ BuildPpttTable (
CfgMgrProtocol,
CM_NULL_TOKEN,
&ProcHierarchyNodeList,
- &Generator->ProcHierarchyNodeCount
+ &ProcHierarchyNodeCount
);
if (EFI_ERROR (Status)) {
DEBUG ((
@@ -1124,7 +1127,8 @@ BuildPpttTable (
goto error_handler;
}
- ProcTopologyStructCount = Generator->ProcHierarchyNodeCount;
+ ProcTopologyStructCount = ProcHierarchyNodeCount;
+ Generator->ProcHierarchyNodeCount = ProcHierarchyNodeCount;
// Get the cache info and update the processor topology structure count with
// Cache Type Structures (Type 1)
@@ -1132,7 +1136,7 @@ BuildPpttTable (
CfgMgrProtocol,
CM_NULL_TOKEN,
&CacheStructList,
- &Generator->CacheStructCount
+ &CacheStructCount
);
if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {
DEBUG ((
@@ -1143,7 +1147,8 @@ BuildPpttTable (
goto error_handler;
}
- ProcTopologyStructCount += Generator->CacheStructCount;
+ ProcTopologyStructCount += CacheStructCount;
+ Generator->CacheStructCount = CacheStructCount;
// Get the processor hierarchy node ID info and update the processor topology
// structure count with ID Structures (Type 2)
@@ -1151,7 +1156,7 @@ BuildPpttTable (
CfgMgrProtocol,
CM_NULL_TOKEN,
&IdStructList,
- &Generator->IdStructCount
+ &IdStructCount
);
if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {
DEBUG ((
@@ -1163,7 +1168,8 @@ BuildPpttTable (
goto error_handler;
}
- ProcTopologyStructCount += Generator->IdStructCount;
+ ProcTopologyStructCount += IdStructCount;
+ Generator->IdStructCount = IdStructCount;
// Allocate Node Indexer array
NodeIndexer = (PPTT_NODE_INDEXER*)AllocateZeroPool (
@@ -1475,6 +1481,12 @@ ACPI_PPTT_GENERATOR PpttGenerator = {
// Processor topology node count
0,
+ // Count of Processor Hierarchy Nodes
+ 0,
+ // Count of Cache Structures
+ 0,
+ // Count of Id Structures
+ 0,
// Pointer to PPTT Node Indexer
NULL
};
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.h b/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.h
index 6a0fdd08e1533c57285f420555586314c70a5ed5..0a14da502d595e27d87262b1bac681318f1d9ced 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.h
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.h
@@ -167,6 +167,12 @@ typedef struct AcpiPpttGenerator {
ACPI_TABLE_GENERATOR Header;
/// PPTT structure count
UINT32 ProcTopologyStructCount;
+ /// Count of Processor Hierarchy Nodes
+ UINT32 ProcHierarchyNodeCount;
+ /// Count of Cache Structures
+ UINT32 CacheStructCount;
+ /// Count of Id Structures
+ UINT32 IdStructCount;
/// List of indexed CM objects for PPTT generation
PPTT_NODE_INDEXER * NodeIndexer;
/// Pointer to the start of Processor Hierarchy nodes in
@@ -176,13 +182,6 @@ typedef struct AcpiPpttGenerator {
PPTT_NODE_INDEXER * CacheStructIndexedList;
/// Pointer to the start of Id Structures in the Node Indexer array
PPTT_NODE_INDEXER * IdStructIndexedList;
- /// Count of Processor Hierarchy Nodes
- UINT32 ProcHierarchyNodeCount;
- /// Count of Cache Structures
- UINT32 CacheStructCount;
- /// Count of Id Structures
- UINT32 IdStructCount;
-
} ACPI_PPTT_GENERATOR;
#pragma pack()
--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v2 10/16] DynamicTablesPkg: Serial debug port initialisation
2020-03-29 15:13 [PATCH v2 00/16] Fix warnings reported by VS2017 compiler Sami Mujawar
` (8 preceding siblings ...)
2020-03-29 15:13 ` [PATCH v2 09/16] DynamicTablesPkg: Fix unaligned pointers usage Sami Mujawar
@ 2020-03-29 15:13 ` Sami Mujawar
2020-03-29 15:13 ` [PATCH v2 11/16] DynamicTablesPkg: Remove redundant frame count check Sami Mujawar
` (5 subsequent siblings)
15 siblings, 0 replies; 22+ messages in thread
From: Sami Mujawar @ 2020-03-29 15:13 UTC (permalink / raw)
To: devel
Cc: Sami Mujawar, Alexei.Fedorov, leif.lindholm, Matteo.Carlini,
Laura.Moretta, nd
The ARM DCC serial port subtype is an option that is
supported by the DBG2 generator. However, the serial
port initialisation should only be done for PL011/SBSA
compatible UARTs.
Add check to conditionally initialise the serial port.
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
---
Notes:
v2:
Splitting patch series and re-submitting DynamicTablesPkg [SAMI]
patches from https://edk2.groups.io/g/devel/message/46261
DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c | 27 ++++++++++++--------
1 file changed, 17 insertions(+), 10 deletions(-)
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c
index 346ab5b22f5402bf87c385558f68f080d1b454ed..51c843d25f75388104694855ce133b3d61860196 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c
@@ -175,7 +175,7 @@ GET_OBJECT_LIST (
CM_ARM_SERIAL_PORT_INFO
);
-/** Initialize the PL011 UART with the parameters obtained from
+/** Initialize the PL011/SBSA UART with the parameters obtained from
the Configuration Manager.
@param [in] SerialPortInfo Pointer to the Serial Port Information.
@@ -353,15 +353,22 @@ BuildDbg2Table (
AcpiDbg2.Dbg2DeviceInfo[DBG_PORT_INDEX_PORT1].Dbg2Device.PortSubtype =
SerialPortInfo->PortSubtype;
- // Initialize the serial port
- Status = SetupDebugUart (SerialPortInfo);
- if (EFI_ERROR (Status)) {
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: DBG2: Failed to configure debug serial port. Status = %r\n",
- Status
- ));
- goto error_handler;
+ if ((SerialPortInfo->PortSubtype ==
+ EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_ARM_PL011_UART) ||
+ (SerialPortInfo->PortSubtype ==
+ EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_ARM_SBSA_GENERIC_UART_2X) ||
+ (SerialPortInfo->PortSubtype ==
+ EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_ARM_SBSA_GENERIC_UART)) {
+ // Initialize the serial port
+ Status = SetupDebugUart (SerialPortInfo);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: DBG2: Failed to configure debug serial port. Status = %r\n",
+ Status
+ ));
+ goto error_handler;
+ }
}
*Table = (EFI_ACPI_DESCRIPTION_HEADER*)&AcpiDbg2;
--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v2 11/16] DynamicTablesPkg: Remove redundant frame count check
2020-03-29 15:13 [PATCH v2 00/16] Fix warnings reported by VS2017 compiler Sami Mujawar
` (9 preceding siblings ...)
2020-03-29 15:13 ` [PATCH v2 10/16] DynamicTablesPkg: Serial debug port initialisation Sami Mujawar
@ 2020-03-29 15:13 ` Sami Mujawar
2020-03-29 15:13 ` [PATCH v2 12/16] DynamicTablesPkg: Fix IORT node length assignment Sami Mujawar
` (4 subsequent siblings)
15 siblings, 0 replies; 22+ messages in thread
From: Sami Mujawar @ 2020-03-29 15:13 UTC (permalink / raw)
To: devel
Cc: Sami Mujawar, Alexei.Fedorov, leif.lindholm, Matteo.Carlini,
Laura.Moretta, nd
Removing GT Block frame count check from AddGTBlockTimerFrames()
as this is already validated in BuildGtdtTable().
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
---
Notes:
v2:
Splitting patch series and re-submitting DynamicTablesPkg [SAMI]
patches from https://edk2.groups.io/g/devel/message/46261
DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/GtdtGenerator.c | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/GtdtGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/GtdtGenerator.c
index 0e996698887aefca8a7240fc27fe3cb9324fd3e2..c109f2ac207311646e5a4ad3aa465b1c2883e465 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/GtdtGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/GtdtGenerator.c
@@ -259,16 +259,6 @@ AddGTBlockTimerFrames (
ASSERT (GtBlockFrame != NULL);
ASSERT (GTBlockTimerFrameList != NULL);
- if (GTBlockFrameCount > 8) {
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: GTDT: GT Block Frame Count %d is greater than 8\n",
- GTBlockFrameCount
- ));
- ASSERT (GTBlockFrameCount <= 8);
- return EFI_INVALID_PARAMETER;
- }
-
IsFrameNumberDuplicated = FindDuplicateValue (
GTBlockTimerFrameList,
GTBlockFrameCount,
--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v2 12/16] DynamicTablesPkg: Fix IORT node length assignment
2020-03-29 15:13 [PATCH v2 00/16] Fix warnings reported by VS2017 compiler Sami Mujawar
` (10 preceding siblings ...)
2020-03-29 15:13 ` [PATCH v2 11/16] DynamicTablesPkg: Remove redundant frame count check Sami Mujawar
@ 2020-03-29 15:13 ` Sami Mujawar
2020-03-29 15:13 ` [PATCH v2 13/16] DynamicTablesPkg: IORT: Fix uninitialized memory usage Sami Mujawar
` (3 subsequent siblings)
15 siblings, 0 replies; 22+ messages in thread
From: Sami Mujawar @ 2020-03-29 15:13 UTC (permalink / raw)
To: devel
Cc: Sami Mujawar, Alexei.Fedorov, leif.lindholm, Matteo.Carlini,
Laura.Moretta, nd
The VS2017 compiler reports 'warning C4267: 'return': conversion
from 'size_t' to 'UINT32', possible loss of data' for a number of
functions that compute the IORT node length. Similarly, it reports
warnings for IORT node length field assignments as the length
field is 16-bit wide.
This patch adds type casts at appropriate places and also implements
validations to ensure that the max width of the respective fields
is not exceeded.
This patch also fixes a typo in one of the local variable names.
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
---
Notes:
v2:
Splitting patch series and re-submitting DynamicTablesPkg [SAMI]
patches from https://edk2.groups.io/g/devel/message/46261
DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c | 352 ++++++++++++++------
1 file changed, 253 insertions(+), 99 deletions(-)
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c
index f303e9f29cc700634d236c08505cab91b9d62cb8..bd71220ca19679792de2bb6d88eed8d1913a7600 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c
@@ -140,8 +140,8 @@ GetItsGroupNodeSize (
/* Size of ITS Group Node +
Size of ITS Identifier array
*/
- return sizeof (EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE) +
- (Node->ItsIdCount * sizeof (UINT32));
+ return (UINT32)(sizeof (EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE) +
+ (Node->ItsIdCount * sizeof (UINT32)));
}
/** Returns the total size required for the ITS Group nodes and
@@ -160,7 +160,7 @@ GetItsGroupNodeSize (
@retval Total size of the ITS Group Nodes.
**/
STATIC
-UINT32
+UINT64
GetSizeofItsGroupNodes (
IN CONST UINT32 NodeStartOffset,
IN CONST CM_ARM_ITS_GROUP_NODE * NodeList,
@@ -168,7 +168,7 @@ GetSizeofItsGroupNodes (
IN OUT IORT_NODE_INDEXER ** CONST NodeIndexer
)
{
- UINT32 Size;
+ UINT64 Size;
ASSERT (NodeList != NULL);
@@ -176,7 +176,7 @@ GetSizeofItsGroupNodes (
while (NodeCount-- != 0) {
(*NodeIndexer)->Token = NodeList->Token;
(*NodeIndexer)->Object = (VOID*)NodeList;
- (*NodeIndexer)->Offset = Size + NodeStartOffset;
+ (*NodeIndexer)->Offset = (UINT32)(Size + NodeStartOffset);
DEBUG ((
DEBUG_INFO,
"IORT: Node Indexer = %p, Token = %p, Object = %p, Offset = 0x%x\n",
@@ -211,10 +211,10 @@ GetNamedComponentNodeSize (
Size of ID mapping array +
Size of ASCII string + 'padding to 32-bit word aligned'.
*/
- return sizeof (EFI_ACPI_6_0_IO_REMAPPING_NAMED_COMP_NODE) +
- (Node->IdMappingCount *
- sizeof (EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE)) +
- ALIGN_VALUE (AsciiStrSize (Node->ObjectName), 4);
+ return (UINT32)(sizeof (EFI_ACPI_6_0_IO_REMAPPING_NAMED_COMP_NODE) +
+ (Node->IdMappingCount *
+ sizeof (EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE)) +
+ ALIGN_VALUE (AsciiStrSize (Node->ObjectName), 4));
}
/** Returns the total size required for the Named Component nodes and
@@ -233,7 +233,7 @@ GetNamedComponentNodeSize (
@retval Total size of the Named Component nodes.
**/
STATIC
-UINT32
+UINT64
GetSizeofNamedComponentNodes (
IN CONST UINT32 NodeStartOffset,
IN CONST CM_ARM_NAMED_COMPONENT_NODE * NodeList,
@@ -241,7 +241,7 @@ GetSizeofNamedComponentNodes (
IN OUT IORT_NODE_INDEXER ** CONST NodeIndexer
)
{
- UINT32 Size;
+ UINT64 Size;
ASSERT (NodeList != NULL);
@@ -249,7 +249,7 @@ GetSizeofNamedComponentNodes (
while (NodeCount-- != 0) {
(*NodeIndexer)->Token = NodeList->Token;
(*NodeIndexer)->Object = (VOID*)NodeList;
- (*NodeIndexer)->Offset = Size + NodeStartOffset;
+ (*NodeIndexer)->Offset = (UINT32)(Size + NodeStartOffset);
DEBUG ((
DEBUG_INFO,
"IORT: Node Indexer = %p, Token = %p, Object = %p, Offset = 0x%x\n",
@@ -284,9 +284,9 @@ GetRootComplexNodeSize (
/* Size of Root Complex node +
Size of ID mapping array
*/
- return sizeof (EFI_ACPI_6_0_IO_REMAPPING_RC_NODE) +
- (Node->IdMappingCount *
- sizeof (EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE));
+ return (UINT32)(sizeof (EFI_ACPI_6_0_IO_REMAPPING_RC_NODE) +
+ (Node->IdMappingCount *
+ sizeof (EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE)));
}
/** Returns the total size required for the Root Complex nodes and
@@ -305,7 +305,7 @@ GetRootComplexNodeSize (
@retval Total size of the Root Complex nodes.
**/
STATIC
-UINT32
+UINT64
GetSizeofRootComplexNodes (
IN CONST UINT32 NodeStartOffset,
IN CONST CM_ARM_ROOT_COMPLEX_NODE * NodeList,
@@ -313,7 +313,7 @@ GetSizeofRootComplexNodes (
IN OUT IORT_NODE_INDEXER ** CONST NodeIndexer
)
{
- UINT32 Size;
+ UINT64 Size;
ASSERT (NodeList != NULL);
@@ -321,7 +321,7 @@ GetSizeofRootComplexNodes (
while (NodeCount-- != 0) {
(*NodeIndexer)->Token = NodeList->Token;
(*NodeIndexer)->Object = (VOID*)NodeList;
- (*NodeIndexer)->Offset = Size + NodeStartOffset;
+ (*NodeIndexer)->Offset = (UINT32)(Size + NodeStartOffset);
DEBUG ((
DEBUG_INFO,
"IORT: Node Indexer = %p, Token = %p, Object = %p, Offset = 0x%x\n",
@@ -358,13 +358,13 @@ GetSmmuV1V2NodeSize (
Size of context interrupt array +
Size of PMU interrupt array
*/
- return sizeof (EFI_ACPI_6_0_IO_REMAPPING_SMMU_NODE) +
- (Node->IdMappingCount *
- sizeof (EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE)) +
- (Node->ContextInterruptCount *
- sizeof (EFI_ACPI_6_0_IO_REMAPPING_SMMU_INT)) +
- (Node->PmuInterruptCount *
- sizeof (EFI_ACPI_6_0_IO_REMAPPING_SMMU_INT));
+ return (UINT32)(sizeof (EFI_ACPI_6_0_IO_REMAPPING_SMMU_NODE) +
+ (Node->IdMappingCount *
+ sizeof (EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE)) +
+ (Node->ContextInterruptCount *
+ sizeof (EFI_ACPI_6_0_IO_REMAPPING_SMMU_INT)) +
+ (Node->PmuInterruptCount *
+ sizeof (EFI_ACPI_6_0_IO_REMAPPING_SMMU_INT)));
}
/** Returns the total size required for the SMMUv1/SMMUv2 nodes and
@@ -383,7 +383,7 @@ GetSmmuV1V2NodeSize (
@retval Total size of the SMMUv1/SMMUv2 nodes.
**/
STATIC
-UINT32
+UINT64
GetSizeofSmmuV1V2Nodes (
IN CONST UINT32 NodeStartOffset,
IN CONST CM_ARM_SMMUV1_SMMUV2_NODE * NodeList,
@@ -391,7 +391,7 @@ GetSizeofSmmuV1V2Nodes (
IN OUT IORT_NODE_INDEXER ** CONST NodeIndexer
)
{
- UINT32 Size;
+ UINT64 Size;
ASSERT (NodeList != NULL);
@@ -399,7 +399,7 @@ GetSizeofSmmuV1V2Nodes (
while (NodeCount-- != 0) {
(*NodeIndexer)->Token = NodeList->Token;
(*NodeIndexer)->Object = (VOID*)NodeList;
- (*NodeIndexer)->Offset = Size + NodeStartOffset;
+ (*NodeIndexer)->Offset = (UINT32)(Size + NodeStartOffset);
DEBUG ((
DEBUG_INFO,
"IORT: Node Indexer = %p, Token = %p, Object = %p, Offset = 0x%x\n",
@@ -433,9 +433,9 @@ GetSmmuV3NodeSize (
/* Size of SMMU v1/SMMU v2 node +
Size of ID mapping array
*/
- return sizeof (EFI_ACPI_6_0_IO_REMAPPING_SMMU3_NODE) +
- (Node->IdMappingCount *
- sizeof (EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE));
+ return (UINT32)(sizeof (EFI_ACPI_6_0_IO_REMAPPING_SMMU3_NODE) +
+ (Node->IdMappingCount *
+ sizeof (EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE)));
}
/** Returns the total size required for the SMMUv3 nodes and
@@ -454,7 +454,7 @@ GetSmmuV3NodeSize (
@retval Total size of the SMMUv3 nodes.
**/
STATIC
-UINT32
+UINT64
GetSizeofSmmuV3Nodes (
IN CONST UINT32 NodeStartOffset,
IN CONST CM_ARM_SMMUV3_NODE * NodeList,
@@ -462,7 +462,7 @@ GetSizeofSmmuV3Nodes (
IN OUT IORT_NODE_INDEXER ** CONST NodeIndexer
)
{
- UINT32 Size;
+ UINT64 Size;
ASSERT (NodeList != NULL);
@@ -470,7 +470,7 @@ GetSizeofSmmuV3Nodes (
while (NodeCount-- != 0) {
(*NodeIndexer)->Token = NodeList->Token;
(*NodeIndexer)->Object = (VOID*)NodeList;
- (*NodeIndexer)->Offset = Size + NodeStartOffset;
+ (*NodeIndexer)->Offset = (UINT32)(Size + NodeStartOffset);
DEBUG ((
DEBUG_INFO,
"IORT: Node Indexer = %p, Token = %p, Object = %p, Offset = 0x%x\n",
@@ -504,9 +504,9 @@ GetPmcgNodeSize (
/* Size of PMCG node +
Size of ID mapping array
*/
- return sizeof (EFI_ACPI_6_0_IO_REMAPPING_PMCG_NODE) +
- (Node->IdMappingCount *
- sizeof (EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE));
+ return (UINT32)(sizeof (EFI_ACPI_6_0_IO_REMAPPING_PMCG_NODE) +
+ (Node->IdMappingCount *
+ sizeof (EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE)));
}
/** Returns the total size required for the PMCG nodes and
@@ -525,7 +525,7 @@ GetPmcgNodeSize (
@retval Total size of the PMCG nodes.
**/
STATIC
-UINT32
+UINT64
GetSizeofPmcgNodes (
IN CONST UINT32 NodeStartOffset,
IN CONST CM_ARM_PMCG_NODE * NodeList,
@@ -533,7 +533,7 @@ GetSizeofPmcgNodes (
IN OUT IORT_NODE_INDEXER ** CONST NodeIndexer
)
{
- UINT32 Size;
+ UINT64 Size;
ASSERT (NodeList != NULL);
@@ -541,7 +541,7 @@ GetSizeofPmcgNodes (
while (NodeCount-- != 0) {
(*NodeIndexer)->Token = NodeList->Token;
(*NodeIndexer)->Object = (VOID*)NodeList;
- (*NodeIndexer)->Offset = Size + NodeStartOffset;
+ (*NodeIndexer)->Offset = (UINT32)(Size + NodeStartOffset);
DEBUG ((
DEBUG_INFO,
"IORT: Node Indexer = %p, Token = %p, Object = %p, Offset = 0x%x\n",
@@ -735,6 +735,7 @@ AddItsGroupNodes (
CM_ARM_ITS_IDENTIFIER * ItsIdentifier;
UINT32 ItsIdentifierCount;
UINT32 IdIndex;
+ UINT64 NodeLength;
ASSERT (Iort != NULL);
@@ -742,9 +743,22 @@ AddItsGroupNodes (
NodesStartOffset);
while (NodeCount-- != 0) {
+ NodeLength = GetItsGroupNodeSize (NodeList);
+ if (NodeLength > MAX_UINT16) {
+ Status = EFI_INVALID_PARAMETER;
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: IORT: ITS Id Array Node length 0x%lx > MAX_UINT16."
+ " Status = %r\n",
+ NodeLength,
+ Status
+ ));
+ return Status;
+ }
+
// Populate the node header
ItsGroupNode->Node.Type = EFI_ACPI_IORT_TYPE_ITS_GROUP;
- ItsGroupNode->Node.Length = GetItsGroupNodeSize (NodeList);
+ ItsGroupNode->Node.Length = (UINT16)NodeLength;
ItsGroupNode->Node.Revision = 0;
ItsGroupNode->Node.Reserved = EFI_ACPI_RESERVED_DWORD;
ItsGroupNode->Node.NumIdMappings = 0;
@@ -825,8 +839,9 @@ AddNamedComponentNodes (
EFI_STATUS Status;
EFI_ACPI_6_0_IO_REMAPPING_NAMED_COMP_NODE * NcNode;
EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE * IdMapArray;
- UINT32 ObjectNameLenght;
CHAR8 * ObjectName;
+ UINTN ObjectNameLength;
+ UINT64 NodeLength;
ASSERT (Iort != NULL);
@@ -834,18 +849,30 @@ AddNamedComponentNodes (
NodesStartOffset);
while (NodeCount-- != 0) {
+ NodeLength = GetNamedComponentNodeSize (NodeList);
+ if (NodeLength > MAX_UINT16) {
+ Status = EFI_INVALID_PARAMETER;
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: IORT: Named Component Node length 0x%lx > MAX_UINT16."
+ " Status = %r\n",
+ NodeLength,
+ Status
+ ));
+ return Status;
+ }
+
// Populate the node header
NcNode->Node.Type = EFI_ACPI_IORT_TYPE_NAMED_COMP;
- NcNode->Node.Length =
- GetNamedComponentNodeSize (NodeList);
+ NcNode->Node.Length = (UINT16)NodeLength;
NcNode->Node.Revision = 2;
NcNode->Node.Reserved = EFI_ACPI_RESERVED_DWORD;
NcNode->Node.NumIdMappings = NodeList->IdMappingCount;
- ObjectNameLenght = AsciiStrLen (NodeList->ObjectName) + 1;
+ ObjectNameLength = AsciiStrLen (NodeList->ObjectName) + 1;
NcNode->Node.IdReference =
- sizeof (EFI_ACPI_6_0_IO_REMAPPING_NAMED_COMP_NODE) +
- (ALIGN_VALUE (ObjectNameLenght, 4));
+ (UINT32)(sizeof (EFI_ACPI_6_0_IO_REMAPPING_NAMED_COMP_NODE) +
+ (ALIGN_VALUE (ObjectNameLength, 4)));
// Named Component specific data
NcNode->Flags = NodeList->Flags;
@@ -860,7 +887,7 @@ AddNamedComponentNodes (
sizeof (EFI_ACPI_6_0_IO_REMAPPING_NAMED_COMP_NODE));
Status = AsciiStrCpyS (
ObjectName,
- ObjectNameLenght,
+ ObjectNameLength,
NodeList->ObjectName
);
if (EFI_ERROR (Status)) {
@@ -936,6 +963,7 @@ AddRootComplexNodes (
EFI_STATUS Status;
EFI_ACPI_6_0_IO_REMAPPING_RC_NODE * RcNode;
EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE * IdMapArray;
+ UINT64 NodeLength;
ASSERT (Iort != NULL);
@@ -943,9 +971,22 @@ AddRootComplexNodes (
NodesStartOffset);
while (NodeCount-- != 0) {
+ NodeLength = GetRootComplexNodeSize (NodeList);
+ if (NodeLength > MAX_UINT16) {
+ Status = EFI_INVALID_PARAMETER;
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: IORT: Root Complex Node length 0x%lx > MAX_UINT16."
+ " Status = %r\n",
+ NodeLength,
+ Status
+ ));
+ return Status;
+ }
+
// Populate the node header
RcNode->Node.Type = EFI_ACPI_IORT_TYPE_ROOT_COMPLEX;
- RcNode->Node.Length = GetRootComplexNodeSize (NodeList);
+ RcNode->Node.Length = (UINT16)NodeLength;
RcNode->Node.Revision = 1;
RcNode->Node.Reserved = EFI_ACPI_RESERVED_DWORD;
RcNode->Node.NumIdMappings = NodeList->IdMappingCount;
@@ -1093,6 +1134,7 @@ AddSmmuV1V2Nodes (
EFI_ACPI_6_0_IO_REMAPPING_SMMU_INT * ContextInterruptArray;
EFI_ACPI_6_0_IO_REMAPPING_SMMU_INT * PmuInterruptArray;
+ UINT64 NodeLength;
ASSERT (Iort != NULL);
@@ -1100,9 +1142,21 @@ AddSmmuV1V2Nodes (
NodesStartOffset);
while (NodeCount-- != 0) {
+ NodeLength = GetSmmuV1V2NodeSize (NodeList);
+ if (NodeLength > MAX_UINT16) {
+ Status = EFI_INVALID_PARAMETER;
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: IORT: SMMU V1/V2 Node length 0x%lx > MAX_UINT16. Status = %r\n",
+ NodeLength,
+ Status
+ ));
+ return Status;
+ }
+
// Populate the node header
SmmuNode->Node.Type = EFI_ACPI_IORT_TYPE_SMMUv1v2;
- SmmuNode->Node.Length = GetSmmuV1V2NodeSize (NodeList);
+ SmmuNode->Node.Length = (UINT16)NodeLength;
SmmuNode->Node.Revision = 0;
SmmuNode->Node.Reserved = EFI_ACPI_RESERVED_DWORD;
SmmuNode->Node.NumIdMappings = NodeList->IdMappingCount;
@@ -1239,6 +1293,7 @@ AddSmmuV3Nodes (
EFI_STATUS Status;
EFI_ACPI_6_0_IO_REMAPPING_SMMU3_NODE * SmmuV3Node;
EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE * IdMapArray;
+ UINT64 NodeLength;
ASSERT (Iort != NULL);
@@ -1246,9 +1301,21 @@ AddSmmuV3Nodes (
NodesStartOffset);
while (NodeCount-- != 0) {
+ NodeLength = GetSmmuV3NodeSize (NodeList);
+ if (NodeLength > MAX_UINT16) {
+ Status = EFI_INVALID_PARAMETER;
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: IORT: SMMU V3 Node length 0x%lx > MAX_UINT16. Status = %r\n",
+ NodeLength,
+ Status
+ ));
+ return Status;
+ }
+
// Populate the node header
SmmuV3Node->Node.Type = EFI_ACPI_IORT_TYPE_SMMUv3;
- SmmuV3Node->Node.Length = GetSmmuV3NodeSize (NodeList);
+ SmmuV3Node->Node.Length = (UINT16)NodeLength;
SmmuV3Node->Node.Revision = 2;
SmmuV3Node->Node.Reserved = EFI_ACPI_RESERVED_DWORD;
SmmuV3Node->Node.NumIdMappings = NodeList->IdMappingCount;
@@ -1344,6 +1411,7 @@ AddPmcgNodes (
EFI_ACPI_6_0_IO_REMAPPING_PMCG_NODE * PmcgNode;
EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE * IdMapArray;
ACPI_IORT_GENERATOR * Generator;
+ UINT64 NodeLength;
ASSERT (Iort != NULL);
@@ -1352,9 +1420,21 @@ AddPmcgNodes (
NodesStartOffset);
while (NodeCount-- != 0) {
+ NodeLength = GetPmcgNodeSize (NodeList);
+ if (NodeLength > MAX_UINT16) {
+ Status = EFI_INVALID_PARAMETER;
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: IORT: PMCG Node length 0x%lx > MAX_UINT16. Status = %r\n",
+ NodeLength,
+ Status
+ ));
+ return Status;
+ }
+
// Populate the node header
PmcgNode->Node.Type = EFI_ACPI_IORT_TYPE_PMCG;
- PmcgNode->Node.Length = GetPmcgNodeSize (NodeList);
+ PmcgNode->Node.Length = (UINT16)NodeLength;
PmcgNode->Node.Revision = 1;
PmcgNode->Node.Reserved = EFI_ACPI_RESERVED_DWORD;
PmcgNode->Node.NumIdMappings = NodeList->IdMappingCount;
@@ -1448,9 +1528,11 @@ BuildIortTable (
)
{
EFI_STATUS Status;
- UINT32 TableSize;
+
+ UINT64 TableSize;
+ UINT64 NodeSize;
+
UINT32 IortNodeCount;
-
UINT32 ItsGroupNodeCount;
UINT32 NamedComponentNodeCount;
UINT32 RootComplexNodeCount;
@@ -1638,81 +1720,141 @@ BuildIortTable (
// ITS Group Nodes
if (ItsGroupNodeCount > 0) {
- ItsGroupOffset = TableSize;
+ ItsGroupOffset = (UINT32)TableSize;
// Size of ITS Group node list.
- TableSize += GetSizeofItsGroupNodes (
- ItsGroupOffset,
- ItsGroupNodeList,
- ItsGroupNodeCount,
- &NodeIndexer
- );
+ NodeSize = GetSizeofItsGroupNodes (
+ ItsGroupOffset,
+ ItsGroupNodeList,
+ ItsGroupNodeCount,
+ &NodeIndexer
+ );
+ if (NodeSize > MAX_UINT32) {
+ Status = EFI_INVALID_PARAMETER;
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: IORT: Invalid Size of Group Nodes. Status = %r\n",
+ Status
+ ));
+ goto error_handler;
+ }
+ TableSize += NodeSize;
}
// Named Component Nodes
if (NamedComponentNodeCount > 0) {
- NamedComponentOffset = TableSize;
+ NamedComponentOffset = (UINT32)TableSize;
// Size of Named Component node list.
- TableSize += GetSizeofNamedComponentNodes (
- NamedComponentOffset,
- NamedComponentNodeList,
- NamedComponentNodeCount,
- &NodeIndexer
- );
+ NodeSize = GetSizeofNamedComponentNodes (
+ NamedComponentOffset,
+ NamedComponentNodeList,
+ NamedComponentNodeCount,
+ &NodeIndexer
+ );
+ if (NodeSize > MAX_UINT32) {
+ Status = EFI_INVALID_PARAMETER;
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: IORT: Invalid Size of Named Component Nodes. Status = %r\n",
+ Status
+ ));
+ goto error_handler;
+ }
+ TableSize += NodeSize;
}
// Root Complex Nodes
if (RootComplexNodeCount > 0) {
- RootComplexOffset = TableSize;
+ RootComplexOffset = (UINT32)TableSize;
// Size of Root Complex node list.
- TableSize += GetSizeofRootComplexNodes (
- RootComplexOffset,
- RootComplexNodeList,
- RootComplexNodeCount,
- &NodeIndexer
- );
+ NodeSize = GetSizeofRootComplexNodes (
+ RootComplexOffset,
+ RootComplexNodeList,
+ RootComplexNodeCount,
+ &NodeIndexer
+ );
+ if (NodeSize > MAX_UINT32) {
+ Status = EFI_INVALID_PARAMETER;
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: IORT: Invalid Size of Root Complex Nodes. Status = %r\n",
+ Status
+ ));
+ goto error_handler;
+ }
+ TableSize += NodeSize;
}
// SMMUv1/SMMUv2 Nodes
if (SmmuV1V2NodeCount > 0) {
- SmmuV1V2Offset = TableSize;
+ SmmuV1V2Offset = (UINT32)TableSize;
// Size of SMMUv1/SMMUv2 node list.
- TableSize += GetSizeofSmmuV1V2Nodes (
- SmmuV1V2Offset,
- SmmuV1V2NodeList,
- SmmuV1V2NodeCount,
- &NodeIndexer
- );
+ NodeSize = GetSizeofSmmuV1V2Nodes (
+ SmmuV1V2Offset,
+ SmmuV1V2NodeList,
+ SmmuV1V2NodeCount,
+ &NodeIndexer
+ );
+ if (NodeSize > MAX_UINT32) {
+ Status = EFI_INVALID_PARAMETER;
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: IORT: Invalid Size of SMMUv1/v2 Nodes. Status = %r\n",
+ Status
+ ));
+ goto error_handler;
+ }
+ TableSize += NodeSize;
}
// SMMUv3 Nodes
if (SmmuV3NodeCount > 0) {
- SmmuV3Offset = TableSize;
+ SmmuV3Offset = (UINT32)TableSize;
// Size of SMMUv3 node list.
- TableSize += GetSizeofSmmuV3Nodes (
- SmmuV3Offset,
- SmmuV3NodeList,
- SmmuV3NodeCount,
- &NodeIndexer
- );
+ NodeSize = GetSizeofSmmuV3Nodes (
+ SmmuV3Offset,
+ SmmuV3NodeList,
+ SmmuV3NodeCount,
+ &NodeIndexer
+ );
+ if (NodeSize > MAX_UINT32) {
+ Status = EFI_INVALID_PARAMETER;
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: IORT: Invalid Size of SMMUv3 Nodes. Status = %r\n",
+ Status
+ ));
+ goto error_handler;
+ }
+ TableSize += NodeSize;
}
// PMCG Nodes
if (PmcgNodeCount > 0) {
- PmcgOffset = TableSize;
+ PmcgOffset = (UINT32)TableSize;
// Size of PMCG node list.
- TableSize += GetSizeofPmcgNodes (
- PmcgOffset,
- PmcgNodeList,
- PmcgNodeCount,
- &NodeIndexer
- );
+ NodeSize = GetSizeofPmcgNodes (
+ PmcgOffset,
+ PmcgNodeList,
+ PmcgNodeCount,
+ &NodeIndexer
+ );
+ if (NodeSize > MAX_UINT32) {
+ Status = EFI_INVALID_PARAMETER;
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: IORT: Invalid Size of PMCG Nodes. Status = %r\n",
+ Status
+ ));
+ goto error_handler;
+ }
+ TableSize += NodeSize;
}
DEBUG ((
DEBUG_INFO,
"INFO: IORT:\n" \
" IortNodeCount = %d\n" \
- " TableSize = %d\n",
+ " TableSize = 0x%lx\n",
IortNodeCount,
TableSize
));
@@ -1765,6 +1907,18 @@ BuildIortTable (
PmcgOffset
));
+ if (TableSize > MAX_UINT32) {
+ Status = EFI_INVALID_PARAMETER;
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: IORT: IORT Table Size 0x%lx > MAX_UINT32," \
+ " Status = %r\n",
+ TableSize,
+ Status
+ ));
+ goto error_handler;
+ }
+
// Allocate the Buffer for IORT table
*Table = (EFI_ACPI_DESCRIPTION_HEADER*)AllocateZeroPool (TableSize);
if (*Table == NULL) {
@@ -1783,7 +1937,7 @@ BuildIortTable (
DEBUG ((
DEBUG_INFO,
- "IORT: Iort = 0x%p TableSize = 0x%x\n",
+ "IORT: Iort = 0x%p TableSize = 0x%lx\n",
Iort,
TableSize
));
@@ -1793,7 +1947,7 @@ BuildIortTable (
This,
&Iort->Header,
AcpiTableInfo,
- TableSize
+ (UINT32)TableSize
);
if (EFI_ERROR (Status)) {
DEBUG ((
--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v2 13/16] DynamicTablesPkg: IORT: Fix uninitialized memory usage
2020-03-29 15:13 [PATCH v2 00/16] Fix warnings reported by VS2017 compiler Sami Mujawar
` (11 preceding siblings ...)
2020-03-29 15:13 ` [PATCH v2 12/16] DynamicTablesPkg: Fix IORT node length assignment Sami Mujawar
@ 2020-03-29 15:13 ` Sami Mujawar
2020-03-29 15:13 ` [PATCH v2 14/16] DynamicTablesPkg: PPTT: " Sami Mujawar
` (2 subsequent siblings)
15 siblings, 0 replies; 22+ messages in thread
From: Sami Mujawar @ 2020-03-29 15:13 UTC (permalink / raw)
To: devel
Cc: Sami Mujawar, Alexei.Fedorov, leif.lindholm, Matteo.Carlini,
Laura.Moretta, nd
On enabling the /analyse option the VS2017 compiler
reports: warning C6001: Using uninitialized memory.
This warning is reported as some variables that were
being logged were uninitialised. To fix this, moved
the logging code after the variables being logged are
initialised.
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
---
Notes:
v2:
Splitting patch series and re-submitting DynamicTablesPkg [SAMI]
patches from https://edk2.groups.io/g/devel/message/46261
DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c | 96 ++++++++++----------
1 file changed, 48 insertions(+), 48 deletions(-)
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c
index bd71220ca19679792de2bb6d88eed8d1913a7600..65d006c89e668c8b2b8a14326cddf1b69979597f 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c
@@ -1738,6 +1738,14 @@ BuildIortTable (
goto error_handler;
}
TableSize += NodeSize;
+
+ DEBUG ((
+ DEBUG_INFO,
+ " ItsGroupNodeCount = %d\n" \
+ " ItsGroupOffset = %d\n",
+ ItsGroupNodeCount,
+ ItsGroupOffset
+ ));
}
// Named Component Nodes
@@ -1760,6 +1768,14 @@ BuildIortTable (
goto error_handler;
}
TableSize += NodeSize;
+
+ DEBUG ((
+ DEBUG_INFO,
+ " NamedComponentNodeCount = %d\n" \
+ " NamedComponentOffset = %d\n",
+ NamedComponentNodeCount,
+ NamedComponentOffset
+ ));
}
// Root Complex Nodes
@@ -1782,6 +1798,14 @@ BuildIortTable (
goto error_handler;
}
TableSize += NodeSize;
+
+ DEBUG ((
+ DEBUG_INFO,
+ " RootComplexNodeCount = %d\n" \
+ " RootComplexOffset = %d\n",
+ RootComplexNodeCount,
+ RootComplexOffset
+ ));
}
// SMMUv1/SMMUv2 Nodes
@@ -1804,6 +1828,14 @@ BuildIortTable (
goto error_handler;
}
TableSize += NodeSize;
+
+ DEBUG ((
+ DEBUG_INFO,
+ " SmmuV1V2NodeCount = %d\n" \
+ " SmmuV1V2Offset = %d\n",
+ SmmuV1V2NodeCount,
+ SmmuV1V2Offset
+ ));
}
// SMMUv3 Nodes
@@ -1826,6 +1858,14 @@ BuildIortTable (
goto error_handler;
}
TableSize += NodeSize;
+
+ DEBUG ((
+ DEBUG_INFO,
+ " SmmuV3NodeCount = %d\n" \
+ " SmmuV3Offset = %d\n",
+ SmmuV3NodeCount,
+ SmmuV3Offset
+ ));
}
// PMCG Nodes
@@ -1848,6 +1888,14 @@ BuildIortTable (
goto error_handler;
}
TableSize += NodeSize;
+
+ DEBUG ((
+ DEBUG_INFO,
+ " PmcgNodeCount = %d\n" \
+ " PmcgOffset = %d\n",
+ PmcgNodeCount,
+ PmcgOffset
+ ));
}
DEBUG ((
@@ -1859,54 +1907,6 @@ BuildIortTable (
TableSize
));
- DEBUG ((
- DEBUG_INFO,
- " ItsGroupNodeCount = %d\n" \
- " ItsGroupOffset = %d\n",
- ItsGroupNodeCount,
- ItsGroupOffset
- ));
-
- DEBUG ((
- DEBUG_INFO,
- " NamedComponentNodeCount = %d\n" \
- " NamedComponentOffset = %d\n",
- NamedComponentNodeCount,
- NamedComponentOffset
- ));
-
- DEBUG ((
- DEBUG_INFO,
- " RootComplexNodeCount = %d\n" \
- " RootComplexOffset = %d\n",
- RootComplexNodeCount,
- RootComplexOffset
- ));
-
- DEBUG ((
- DEBUG_INFO,
- " SmmuV1V2NodeCount = %d\n" \
- " SmmuV1V2Offset = %d\n",
- SmmuV1V2NodeCount,
- SmmuV1V2Offset
- ));
-
- DEBUG ((
- DEBUG_INFO,
- " SmmuV3NodeCount = %d\n" \
- " SmmuV3Offset = %d\n",
- SmmuV3NodeCount,
- SmmuV3Offset
- ));
-
- DEBUG ((
- DEBUG_INFO,
- " PmcgNodeCount = %d\n" \
- " PmcgOffset = %d\n",
- PmcgNodeCount,
- PmcgOffset
- ));
-
if (TableSize > MAX_UINT32) {
Status = EFI_INVALID_PARAMETER;
DEBUG ((
--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v2 14/16] DynamicTablesPkg: PPTT: Fix uninitialized memory usage
2020-03-29 15:13 [PATCH v2 00/16] Fix warnings reported by VS2017 compiler Sami Mujawar
` (12 preceding siblings ...)
2020-03-29 15:13 ` [PATCH v2 13/16] DynamicTablesPkg: IORT: Fix uninitialized memory usage Sami Mujawar
@ 2020-03-29 15:13 ` Sami Mujawar
2020-03-29 15:13 ` [PATCH v2 15/16] DynamicTablesPkg: Remove erroneous use of EFIAPI Sami Mujawar
2020-03-29 15:13 ` [PATCH v2 16/16] DynamicTablesPkg: Option for VS2017 static code analysis Sami Mujawar
15 siblings, 0 replies; 22+ messages in thread
From: Sami Mujawar @ 2020-03-29 15:13 UTC (permalink / raw)
To: devel
Cc: Sami Mujawar, Alexei.Fedorov, leif.lindholm, Matteo.Carlini,
Laura.Moretta, nd
On enabling the /analyse option the VS2017 compiler
reports: warning C6001: Using uninitialized memory.
This warning is reported as some variables that were
being logged were uninitialised. To fix this, moved
the logging code after the variables being logged are
initialised.
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
---
Notes:
v2:
Splitting patch series and re-submitting DynamicTablesPkg [SAMI]
patches from https://edk2.groups.io/g/devel/message/46261
DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c | 59 ++++++++++----------
1 file changed, 29 insertions(+), 30 deletions(-)
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c
index 82070403ac8757f54e839fd00eb4acb3292fc60c..d70fc59e754e7d348965b8c3739822a9f1c4b7e6 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c
@@ -1203,6 +1203,17 @@ BuildPpttTable (
Generator->ProcHierarchyNodeCount,
&NodeIndexer
);
+
+ DEBUG ((
+ DEBUG_INFO,
+ " ProcHierarchyNodeCount = %d\n" \
+ " ProcHierarchyNodeOffset = 0x%x\n" \
+ " ProcHierarchyNodeIndexedList = 0x%p\n",
+ Generator->ProcHierarchyNodeCount,
+ ProcHierarchyNodeOffset,
+ Generator->ProcHierarchyNodeIndexedList
+ ));
+
}
// Include the size of Cache Type Structures and index them
@@ -1215,6 +1226,15 @@ BuildPpttTable (
Generator->CacheStructCount,
&NodeIndexer
);
+ DEBUG ((
+ DEBUG_INFO,
+ " CacheStructCount = %d\n" \
+ " CacheStructOffset = 0x%x\n" \
+ " CacheStructIndexedList = 0x%p\n",
+ Generator->CacheStructCount,
+ CacheStructOffset,
+ Generator->CacheStructIndexedList
+ ));
}
// Include the size of ID Type Structures and index them
@@ -1227,6 +1247,15 @@ BuildPpttTable (
Generator->IdStructCount,
&NodeIndexer
);
+ DEBUG ((
+ DEBUG_INFO,
+ " IdStructCount = %d\n" \
+ " IdStructOffset = 0x%x\n" \
+ " IdStructIndexedList = 0x%p\n",
+ Generator->IdStructCount,
+ IdStructOffset,
+ Generator->IdStructIndexedList
+ ));
}
DEBUG ((
@@ -1238,36 +1267,6 @@ BuildPpttTable (
TableSize
));
- DEBUG ((
- DEBUG_INFO,
- " ProcHierarchyNodeCount = %d\n" \
- " ProcHierarchyNodeOffset = 0x%x\n" \
- " ProcHierarchyNodeIndexedList = 0x%p\n",
- Generator->ProcHierarchyNodeCount,
- ProcHierarchyNodeOffset,
- Generator->ProcHierarchyNodeIndexedList
- ));
-
- DEBUG ((
- DEBUG_INFO,
- " CacheStructCount = %d\n" \
- " CacheStructOffset = 0x%x\n" \
- " CacheStructIndexedList = 0x%p\n",
- Generator->CacheStructCount,
- CacheStructOffset,
- Generator->CacheStructIndexedList
- ));
-
- DEBUG ((
- DEBUG_INFO,
- " IdStructCount = %d\n" \
- " IdStructOffset = 0x%x\n" \
- " IdStructIndexedList = 0x%p\n",
- Generator->IdStructCount,
- IdStructOffset,
- Generator->IdStructIndexedList
- ));
-
// Allocate the Buffer for the PPTT table
*Table = (EFI_ACPI_DESCRIPTION_HEADER*)AllocateZeroPool (TableSize);
if (*Table == NULL) {
--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v2 15/16] DynamicTablesPkg: Remove erroneous use of EFIAPI
2020-03-29 15:13 [PATCH v2 00/16] Fix warnings reported by VS2017 compiler Sami Mujawar
` (13 preceding siblings ...)
2020-03-29 15:13 ` [PATCH v2 14/16] DynamicTablesPkg: PPTT: " Sami Mujawar
@ 2020-03-29 15:13 ` Sami Mujawar
2020-03-29 15:13 ` [PATCH v2 16/16] DynamicTablesPkg: Option for VS2017 static code analysis Sami Mujawar
15 siblings, 0 replies; 22+ messages in thread
From: Sami Mujawar @ 2020-03-29 15:13 UTC (permalink / raw)
To: devel
Cc: Sami Mujawar, Alexei.Fedorov, leif.lindholm, Matteo.Carlini,
Laura.Moretta, nd
The Dynamic Tables Factory protocol has an erroneous
EFIAPI calling convention macro in the function
pointer declaration.
Remove the erroneous EFIAPI calling convention macro
from the interface declarations.
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
---
Notes:
v2:
Splitting patch series and re-submitting DynamicTablesPkg [SAMI]
patches from https://edk2.groups.io/g/devel/message/46261
DynamicTablesPkg/Include/Protocol/DynamicTableFactoryProtocol.h | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
diff --git a/DynamicTablesPkg/Include/Protocol/DynamicTableFactoryProtocol.h b/DynamicTablesPkg/Include/Protocol/DynamicTableFactoryProtocol.h
index d07d0cac36dedb0568f6f604daa22429565aafd3..ff2331b060019976319fc2707f65252130a5326c 100644
--- a/DynamicTablesPkg/Include/Protocol/DynamicTableFactoryProtocol.h
+++ b/DynamicTablesPkg/Include/Protocol/DynamicTableFactoryProtocol.h
@@ -1,6 +1,6 @@
/** @file
- Copyright (c) 2017 - 2018, ARM Limited. All rights reserved.
+ Copyright (c) 2017 - 2019, ARM Limited. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -53,7 +53,6 @@ typedef struct DynamicTableFactoryInfo EDKII_DYNAMIC_TABLE_FACTORY_INFO;
**/
typedef
EFI_STATUS
-EFIAPI
(EFIAPI * EDKII_DYNAMIC_TABLE_FACTORY_GET_ACPI_TABLE_GENERATOR) (
IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL * CONST This,
IN CONST ACPI_TABLE_GENERATOR_ID GeneratorId,
@@ -73,7 +72,6 @@ EFIAPI
**/
typedef
EFI_STATUS
-EFIAPI
(EFIAPI * EDKII_DYNAMIC_TABLE_FACTORY_REGISTER_ACPI_TABLE_GENERATOR) (
IN CONST ACPI_TABLE_GENERATOR * CONST Generator
);
@@ -89,7 +87,6 @@ EFIAPI
**/
typedef
EFI_STATUS
-EFIAPI
(EFIAPI * EDKII_DYNAMIC_TABLE_FACTORY_DEREGISTER_ACPI_TABLE_GENERATOR) (
IN CONST ACPI_TABLE_GENERATOR * CONST Generator
);
@@ -109,7 +106,6 @@ EFIAPI
**/
typedef
EFI_STATUS
-EFIAPI
(EFIAPI * EDKII_DYNAMIC_TABLE_FACTORY_GET_SMBIOS_TABLE_GENERATOR) (
IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL * CONST This,
IN CONST SMBIOS_TABLE_GENERATOR_ID GeneratorId,
@@ -129,7 +125,6 @@ EFIAPI
**/
typedef
EFI_STATUS
-EFIAPI
(EFIAPI * EDKII_DYNAMIC_TABLE_FACTORY_REGISTER_SMBIOS_TABLE_GENERATOR) (
IN CONST SMBIOS_TABLE_GENERATOR * CONST Generator
);
@@ -145,7 +140,6 @@ EFIAPI
**/
typedef
EFI_STATUS
-EFIAPI
(EFIAPI * EDKII_DYNAMIC_TABLE_FACTORY_DEREGISTER_SMBIOS_TABLE_GENERATOR) (
IN CONST SMBIOS_TABLE_GENERATOR * CONST Generator
);
@@ -165,7 +159,6 @@ EFIAPI
**/
typedef
EFI_STATUS
-EFIAPI
(EFIAPI * EDKII_DYNAMIC_TABLE_FACTORY_GET_DT_TABLE_GENERATOR) (
IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL * CONST This,
IN CONST DT_TABLE_GENERATOR_ID GeneratorId,
@@ -185,7 +178,6 @@ EFIAPI
**/
typedef
EFI_STATUS
-EFIAPI
(EFIAPI * EDKII_DYNAMIC_TABLE_FACTORY_REGISTER_DT_TABLE_GENERATOR) (
IN CONST DT_TABLE_GENERATOR * CONST Generator
);
@@ -204,7 +196,6 @@ EFIAPI
**/
typedef
EFI_STATUS
-EFIAPI
(EFIAPI * EDKII_DYNAMIC_TABLE_FACTORY_DEREGISTER_DT_TABLE_GENERATOR) (
IN CONST DT_TABLE_GENERATOR * CONST Generator
);
--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v2 16/16] DynamicTablesPkg: Option for VS2017 static code analysis
2020-03-29 15:13 [PATCH v2 00/16] Fix warnings reported by VS2017 compiler Sami Mujawar
` (14 preceding siblings ...)
2020-03-29 15:13 ` [PATCH v2 15/16] DynamicTablesPkg: Remove erroneous use of EFIAPI Sami Mujawar
@ 2020-03-29 15:13 ` Sami Mujawar
15 siblings, 0 replies; 22+ messages in thread
From: Sami Mujawar @ 2020-03-29 15:13 UTC (permalink / raw)
To: devel
Cc: Sami Mujawar, Alexei.Fedorov, leif.lindholm, Matteo.Carlini,
Laura.Moretta, nd
Add build option STATIC_ANALYSIS to enable VS2017 static
code analysis.
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
---
Notes:
v2:
Splitting patch series and re-submitting DynamicTablesPkg [SAMI]
patches from https://edk2.groups.io/g/devel/message/46261
DynamicTablesPkg/DynamicTablesPkg.dsc | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/DynamicTablesPkg/DynamicTablesPkg.dsc b/DynamicTablesPkg/DynamicTablesPkg.dsc
index 19beaaf370f8633efa5e37c97f6665ae4505d4e7..02f04447fffa867c602c748279c041bd566a7fd6 100644
--- a/DynamicTablesPkg/DynamicTablesPkg.dsc
+++ b/DynamicTablesPkg/DynamicTablesPkg.dsc
@@ -40,3 +40,10 @@ [Components.common]
[BuildOptions]
*_*_*_CC_FLAGS = -DDISABLE_NEW_DEPRECATED_INTERFACES
+
+!ifdef STATIC_ANALYSIS
+ # Check all rules
+ # Inhibit C6305: Potential mismatch between sizeof and countof quantities.
+ *_VS2017_*_CC_FLAGS = /wd6305 /analyze
+!endif
+
--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'
^ permalink raw reply related [flat|nested] 22+ messages in thread