[edk2-devel] [edk2-platforms][PATCH V1 1/1] IntelSiliconPkg/IntelVTdDxe: Fix NULL pointer dereference

2019-08-23 Thread Kubacki, Michael A
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2116

Cc: Ray Ni 
Cc: Rangasai V Chaganty 
Signed-off-by: Michael Kubacki 
---
 Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmaProtection.c | 19 
+++
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git 
a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmaProtection.c 
b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmaProtection.c
index 956ebb2d3d..9b6135ef94 100644
--- a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmaProtection.c
+++ b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmaProtection.c
@@ -158,10 +158,13 @@ ProcessRequestedAccessAttribute (
 }
 
 /**
-  return the UEFI memory information.
+  Return UEFI memory map information.
+
+  @param[out] Below4GMemoryLimit  The below 4GiB memory limit address or 0 if 
insufficient resources exist to
+  determine the address.
+  @param[out] Above4GMemoryLimit  The above 4GiB memory limit address or 0 if 
insufficient resources exist to
+  determine the address.
 
-  @param[out] Below4GMemoryLimit  The below 4GiB memory limit
-  @param[out] Above4GMemoryLimit  The above 4GiB memory limit
 **/
 VOID
 ReturnUefiMemoryMap (
@@ -206,7 +209,11 @@ ReturnUefiMemoryMap (
 // we process bogus entries and create bogus E820 entries.
 //
 EfiMemoryMap = (EFI_MEMORY_DESCRIPTOR *) AllocatePool (EfiMemoryMapSize);
-ASSERT (EfiMemoryMap != NULL);
+if (EfiMemoryMap == NULL) {
+  ASSERT (EfiMemoryMap != NULL);
+  return;
+}
+
 Status = gBS->GetMemoryMap (
 ,
 EfiMemoryMap,
@@ -218,7 +225,6 @@ ReturnUefiMemoryMap (
   FreePool (EfiMemoryMap);
 }
   } while (Status == EFI_BUFFER_TOO_SMALL);
-
   ASSERT_EFI_ERROR (Status);
 
   //
@@ -242,9 +248,6 @@ ReturnUefiMemoryMap (
 NextEfiEntry  = NEXT_MEMORY_DESCRIPTOR (EfiEntry, EfiDescriptorSize);
   }
 
-  //
-  //
-  //
   DEBUG ((DEBUG_INFO, "MemoryMap:\n"));
   EfiEntry= EfiMemoryMap;
   EfiMemoryMapEnd = (EFI_MEMORY_DESCRIPTOR *) ((UINT8 *) EfiMemoryMap + 
EfiMemoryMapSize);
-- 
2.16.2.windows.1


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

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



Re: [edk2-rfc] [edk2-devel] CPU hotplug using SMM with QEMU+OVMF

2019-08-23 Thread Yao, Jiewen
I give my thought.
Paolo may add more.

> -Original Message-
> From: Kinney, Michael D
> Sent: Friday, August 23, 2019 11:25 PM
> To: Yao, Jiewen ; Paolo Bonzini
> ; Laszlo Ersek ;
> r...@edk2.groups.io; Kinney, Michael D 
> Cc: Alex Williamson ; devel@edk2.groups.io;
> qemu devel list ; Igor Mammedov
> ; Chen, Yingwen ;
> Nakajima, Jun ; Boris Ostrovsky
> ; Joao Marcal Lemos Martins
> ; Phillip Goerl 
> Subject: RE: [edk2-rfc] [edk2-devel] CPU hotplug using SMM with
> QEMU+OVMF
> 
> Hi Jiewen,
> 
> If a hot add CPU needs to run any code before the
> first SMI, I would recommend is only executes code
> from a write protected FLASH range without a stack
> and then wait for the first SMI.
[Jiewen] Right.

Another option from Paolo, the new CPU will not run until 0x7b.
To mitigate DMA threat, someone need guarantee the low memory SIPI vector is 
DMA protected.

NOTE: The LOW memory *could* be mapped to write protected FLASH AREA via PAM 
register. The Host CPU may setup that in SMM.
If that is the case, we don’t need worry DMA.

I copied the detail step here, because I found it is hard to dig them out again.

(01a) QEMU: create new CPU.  The CPU already exists, but it does not
 start running code until unparked by the CPU hotplug controller.

(01b) QEMU: trigger SCI

(02-03) no equivalent

(04) Host CPU: (OS) execute GPE handler from DSDT

(05) Host CPU: (OS) Port 0xB2 write, all CPUs enter SMM (NOTE: New CPU
 will not enter CPU because SMI is disabled)

(06) Host CPU: (SMM) Save 38000, Update 38000 -- fill simple SMM
 rebase code.

(07a) Host CPU: (SMM) Write to CPU hotplug controller to enable
 new CPU

(07b) Host CPU: (SMM) Send INIT/SIPI/SIPI to new CPU.

(08a) New CPU: (Low RAM) Enter protected mode.

(08b) New CPU: (Flash) Signals host CPU to proceed and enter cli;hlt loop.

(09) Host CPU: (SMM) Send SMI to the new CPU only.

(10) New CPU: (SMM) Run SMM code at 38000, and rebase SMBASE to
 TSEG.

(11) Host CPU: (SMM) Restore 38000.

(12) Host CPU: (SMM) Update located data structure to add the new CPU
 information. (This step will involve CPU_SERVICE protocol)

(13) New CPU: (Flash) do whatever other initialization is needed

(14) New CPU: (Flash) Deadloop, and wait for INIT-SIPI-SIPI.

(15) Host CPU: (OS) Send INIT-SIPI-SIPI to pull new CPU in..


> 
> For this OVMF use case, is any CPU init required
> before the first SMI?
[Jiewen] I am sure what is the detail action in 08b.
And I am not sure what your "init" means here?
Personally, I don’t think we need too much init work, such as Microcode or MTRR.
But we need detail info.



> From Paolo's list of steps are steps (8a) and (8b)
> really required?  Can the SMI monarch use the Local
> APIC to send a directed SMI to the hot added CPU?
> The SMI monarch needs to know the APIC ID of the
> hot added CPU.  
[Jiewen] I think it depend upon virtual hardware design.
Leave question to Paolo.



Do we also need to handle the case
> where multiple CPUs are added at once?  I think we
> would need to serialize the use of 3000:8000 for the
> SMM rebase operation on each hot added CPU.
> It would be simpler if we can guarantee that only
> one CPU can be added or removed at a time and the
> complete flow of adding a CPU to SMM and the OS
> needs to be completed before another add/remove
> event needs to be processed.
[Jiewen] Right.
I treat the multiple CPU hot-add at same time as a potential threat.
We don’t want to trust end user.
The solution could be:
1) Let trusted hardware guarantee hot-add one by one.
2) Let trusted software (SMM and init code) guarantee SMREBASE one by one 
(include any code runs before SMREBASE)
3) Let trusted software (SMM and init code) support SMREBASE simultaneously 
(include any code runs before SMREBASE).
Solution #1 or #2 are simple solution.


> Mike
> 
> > -Original Message-
> > From: Yao, Jiewen
> > Sent: Thursday, August 22, 2019 10:00 PM
> > To: Kinney, Michael D ;
> > Paolo Bonzini ; Laszlo Ersek
> > ; r...@edk2.groups.io
> > Cc: Alex Williamson ;
> > devel@edk2.groups.io; qemu devel list  > de...@nongnu.org>; Igor Mammedov ;
> > Chen, Yingwen ; Nakajima, Jun
> > ; Boris Ostrovsky
> > ; Joao Marcal Lemos Martins
> > ; Phillip Goerl
> > 
> > Subject: RE: [edk2-rfc] [edk2-devel] CPU hotplug using
> > SMM with QEMU+OVMF
> >
> > Thank you Mike!
> >
> > That is good reference on the real hardware behavior.
> > (Glad it is public.)
> >
> > For threat model, the unique part in virtual environment
> > is temp RAM.
> > The temp RAM in real platform is per CPU cache, while
> > the temp RAM in virtual platform is global memory.
> > That brings one more potential attack surface in virtual
> > environment, if hot-added CPU need run code with stack
> > or heap before SMI rebase.
> >
> > Other threats, such as SMRAM or DMA, are same.
> >
> > Thank you
> > Yao Jiewen
> >
> >
> > > -Original Message-
> > > From: Kinney, Michael D
> > > Sent: Friday, August 

Re: [edk2-devel] [edk2-platforms][PATCH V1 1/1] MinPlatformPkg/MultiBoardInitSupportLib: Fix NULL pointer dereferences

2019-08-23 Thread Nate DeSimone
Reviewed-by: Nate DeSimone 

-Original Message-
From: Kubacki, Michael A 
Sent: Friday, August 23, 2019 4:24 PM
To: devel@edk2.groups.io
Cc: Chiu, Chasel ; Desimone, Nathaniel L 
; Gao, Liming 
Subject: [edk2-platforms][PATCH V1 1/1] 
MinPlatformPkg/MultiBoardInitSupportLib: Fix NULL pointer dereferences

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

Removes potential NULL pointer de-references in the library and validates NULL 
pointers are not passed to library functions.

Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Liming Gao 
Signed-off-by: Michael Kubacki 
---
 Platform/Intel/MinPlatformPkg/Include/Library/MultiBoardInitSupportLib.h   
   | 84 -
 
Platform/Intel/MinPlatformPkg/PlatformInit/Library/MultiBoardInitSupportLib/DxeMultiBoardInitSupportLib.c
 | 24 -  
Platform/Intel/MinPlatformPkg/PlatformInit/Library/MultiBoardInitSupportLib/PeiMultiBoardInitSupportLib.c
 | 97 +---
 3 files changed, 188 insertions(+), 17 deletions(-)

diff --git 
a/Platform/Intel/MinPlatformPkg/Include/Library/MultiBoardInitSupportLib.h 
b/Platform/Intel/MinPlatformPkg/Include/Library/MultiBoardInitSupportLib.h
index 6c14b5677d..a854f61e27 100644
--- a/Platform/Intel/MinPlatformPkg/Include/Library/MultiBoardInitSupportLib.h
+++ b/Platform/Intel/MinPlatformPkg/Include/Library/MultiBoardInitSuppor
+++ tLib.h
@@ -1,6 +1,6 @@
 /** @file
 
-Copyright (c) 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -10,18 +10,39 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 
 #include 
 
+/**
+  This board service detects the board type.
+
+  @retval EFI_SUCCESS   The board was detected successfully.
+  @retval EFI_NOT_FOUND The board could not be detected.
+
+**/
 typedef
 EFI_STATUS
 (EFIAPI *BOARD_DETECT) (
   VOID
   );
 
+/**
+  This board service performs board-specific initialization.
+
+  @retval EFI_SUCCESS   Board-specific initialization was successful.
+  @retval EFI_NOT_READY The board has not been detected yet.
+
+**/
 typedef
 EFI_STATUS
 (EFIAPI *BOARD_INIT) (
   VOID
   );
 
+/**
+  This board service detects the boot mode.
+
+  @retval EFI_BOOT_MODE The boot mode.
+  @retval EFI_NOT_READY The board has not been detected yet.
+
+**/
 typedef
 EFI_BOOT_MODE
 (EFIAPI *BOARD_BOOT_MODE_DETECT) (
@@ -52,24 +73,85 @@ typedef struct {
   BOARD_INIT  BoardInitEndOfFirmware;
 } BOARD_NOTIFICATION_INIT_FUNC;
 
+/**
+  Registers the given function for callback during board detection.
+
+  When this function is called the given function pointer is added to 
+ an internal list. When board detection is  performed within the 
+ BoardDetect() API, the function pointers in the list will be invoked until a 
board  detection function reports it has successfully detected the board.
+
+  @param[in]BoardDetect A pointer to a function of type 
BOARD_DETECT_FUNC that is called during
+board detection.
+
+  @retval   EFI_SUCCESS The function was successfully 
registered.
+  @retval   EFI_INVALID_PARAMETER   The function pointer given is NULL.
+  @retval   EFI_OUT_OF_RESOURCESInsufficient memory resources exist to 
add a new board detection callback.
+
+**/
 EFI_STATUS
 EFIAPI
 RegisterBoardDetect (
   IN BOARD_DETECT_FUNC  *BoardDetect
   );
 
+/**
+  Registers the given set of board functions for callback to perform 
pre-memory board initialization tasks.
+
+  When this function is called, the given structure of function 
+ pointers are stored for future invocation. When  board pre-memory 
+ initialization tasks are required, the corresponding pre-memory 
+ function in this structure  will be called. Typically, 
RegisterBoardPreMemInit() is called during board detection with the 
successfully  detected board providing its set of board-specific pre-memory 
initialization functions.
+
+  @param[in]BoardPreMemInit A pointer to a structure of function 
pointers described in the type
+BOARD_PRE_MEM_INIT_FUNC.
+
+  @retval   EFI_SUCCESS The board pre-memory functions were 
successfully registered.
+  @retval   EFI_INVALID_PARAMETER   The pointer given is NULL.
+  @retval   EFI_OUT_OF_RESOURCESInsufficient memory resources exist to 
register the callback functions.
+
+**/
 EFI_STATUS
 EFIAPI
 RegisterBoardPreMemInit (
   IN BOARD_PRE_MEM_INIT_FUNC  *BoardPreMemInit
   );
 
+/**
+  Registers the given set of board functions for callback to perform 
post-memory board initialization tasks.
+
+  When this function is called, the given structure of function 
+ pointers are stored for future invocation. When  board post-memory 
+ initialization tasks are required, the corresponding post-memory 
+ function in this structure  will be called. Typically, 
RegisterBoardPostMemInit() is called 

Re: [edk2-devel] [edk2-platforms PATCH 3/4] Platform/MinPlatformPkg.dsc: Add build option

2019-08-23 Thread Nate DeSimone
As noted by others, please update copyright year. With that change...

Reviewed-by: Nate DeSimone 

-Original Message-
From: Zhang, Shenglei 
Sent: Thursday, August 22, 2019 12:08 AM
To: devel@edk2.groups.io
Cc: Kubacki, Michael A ; Chiu, Chasel 
; Desimone, Nathaniel L 
; Gao, Liming ; Zhang, 
Shenglei 
Subject: [edk2-platforms PATCH 3/4] Platform/MinPlatformPkg.dsc: Add build 
option

Add the build option "/D DISABLE_NEW_DEPRECATED_INTERFACES" in DSC file to make 
sure that the deprecated APIs will not be used in our code.
https://bugzilla.tianocore.org/show_bug.cgi?id=2111

Cc: Michael Kubacki 
Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Liming Gao 
Signed-off-by: Shenglei Zhang 
---
 Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc 
b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
index 8a3638b7..9bbb7963 100644
--- a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
+++ b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
@@ -187,3 +187,6 @@
   MinPlatformPkg/Tcg/Tcg2PlatformPei/Tcg2PlatformPei.inf
   MinPlatformPkg/Tcg/Tcg2PlatformDxe/Tcg2PlatformDxe.inf
 !endif
+
+[BuildOptions]
+  *_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES
\ No newline at end of file
--
2.18.0.windows.1


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

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



[edk2-devel] [edk2-platforms][PATCH V1 1/1] MinPlatformPkg/MultiBoardInitSupportLib: Fix NULL pointer dereferences

2019-08-23 Thread Kubacki, Michael A
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2114

Removes potential NULL pointer de-references in the library and
validates NULL pointers are not passed to library functions.

Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Liming Gao 
Signed-off-by: Michael Kubacki 
---
 Platform/Intel/MinPlatformPkg/Include/Library/MultiBoardInitSupportLib.h   
   | 84 -
 
Platform/Intel/MinPlatformPkg/PlatformInit/Library/MultiBoardInitSupportLib/DxeMultiBoardInitSupportLib.c
 | 24 -
 
Platform/Intel/MinPlatformPkg/PlatformInit/Library/MultiBoardInitSupportLib/PeiMultiBoardInitSupportLib.c
 | 97 +---
 3 files changed, 188 insertions(+), 17 deletions(-)

diff --git 
a/Platform/Intel/MinPlatformPkg/Include/Library/MultiBoardInitSupportLib.h 
b/Platform/Intel/MinPlatformPkg/Include/Library/MultiBoardInitSupportLib.h
index 6c14b5677d..a854f61e27 100644
--- a/Platform/Intel/MinPlatformPkg/Include/Library/MultiBoardInitSupportLib.h
+++ b/Platform/Intel/MinPlatformPkg/Include/Library/MultiBoardInitSupportLib.h
@@ -1,6 +1,6 @@
 /** @file
 
-Copyright (c) 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -10,18 +10,39 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 
 #include 
 
+/**
+  This board service detects the board type.
+
+  @retval EFI_SUCCESS   The board was detected successfully.
+  @retval EFI_NOT_FOUND The board could not be detected.
+
+**/
 typedef
 EFI_STATUS
 (EFIAPI *BOARD_DETECT) (
   VOID
   );
 
+/**
+  This board service performs board-specific initialization.
+
+  @retval EFI_SUCCESS   Board-specific initialization was successful.
+  @retval EFI_NOT_READY The board has not been detected yet.
+
+**/
 typedef
 EFI_STATUS
 (EFIAPI *BOARD_INIT) (
   VOID
   );
 
+/**
+  This board service detects the boot mode.
+
+  @retval EFI_BOOT_MODE The boot mode.
+  @retval EFI_NOT_READY The board has not been detected yet.
+
+**/
 typedef
 EFI_BOOT_MODE
 (EFIAPI *BOARD_BOOT_MODE_DETECT) (
@@ -52,24 +73,85 @@ typedef struct {
   BOARD_INIT  BoardInitEndOfFirmware;
 } BOARD_NOTIFICATION_INIT_FUNC;
 
+/**
+  Registers the given function for callback during board detection.
+
+  When this function is called the given function pointer is added to an 
internal list. When board detection is
+  performed within the BoardDetect() API, the function pointers in the list 
will be invoked until a board
+  detection function reports it has successfully detected the board.
+
+  @param[in]BoardDetect A pointer to a function of type 
BOARD_DETECT_FUNC that is called during
+board detection.
+
+  @retval   EFI_SUCCESS The function was successfully 
registered.
+  @retval   EFI_INVALID_PARAMETER   The function pointer given is NULL.
+  @retval   EFI_OUT_OF_RESOURCESInsufficient memory resources exist to 
add a new board detection callback.
+
+**/
 EFI_STATUS
 EFIAPI
 RegisterBoardDetect (
   IN BOARD_DETECT_FUNC  *BoardDetect
   );
 
+/**
+  Registers the given set of board functions for callback to perform 
pre-memory board initialization tasks.
+
+  When this function is called, the given structure of function pointers are 
stored for future invocation. When
+  board pre-memory initialization tasks are required, the corresponding 
pre-memory function in this structure
+  will be called. Typically, RegisterBoardPreMemInit() is called during board 
detection with the successfully
+  detected board providing its set of board-specific pre-memory initialization 
functions.
+
+  @param[in]BoardPreMemInit A pointer to a structure of function 
pointers described in the type
+BOARD_PRE_MEM_INIT_FUNC.
+
+  @retval   EFI_SUCCESS The board pre-memory functions were 
successfully registered.
+  @retval   EFI_INVALID_PARAMETER   The pointer given is NULL.
+  @retval   EFI_OUT_OF_RESOURCESInsufficient memory resources exist to 
register the callback functions.
+
+**/
 EFI_STATUS
 EFIAPI
 RegisterBoardPreMemInit (
   IN BOARD_PRE_MEM_INIT_FUNC  *BoardPreMemInit
   );
 
+/**
+  Registers the given set of board functions for callback to perform 
post-memory board initialization tasks.
+
+  When this function is called, the given structure of function pointers are 
stored for future invocation. When
+  board post-memory initialization tasks are required, the corresponding 
post-memory function in this structure
+  will be called. Typically, RegisterBoardPostMemInit() is called during board 
detection with the successfuly
+  detected board providing its set of board-specific post-memory 
initialization functions.
+
+  @param[in]BoardPostMemInitA pointer to a structure of function 
pointers described in the type
+BOARD_POST_MEM_INIT_FUNC.
+
+  @retval 

Re: [edk2-devel] [edk2-platforms][PATCH V2 2/2] WhiskeylakeOpenBoardPkg: Fix GCC Build Failures

2019-08-23 Thread Nate DeSimone
1. 
WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/PeiWhiskeylakeURvpInitPreMemLib.c
 - BoardConfigInitPreMem()

You added the ASSERT_EFI_ERROR macros which is good, but it would probably make 
sense to also return the failing error code from this function. Also, the 
comment describing this function at the top is wrong and the function 
declaration doesn't follow style guidelines.

2. 
WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/PeiWhiskeylakeURvpInitPostMemLib.c
 - BoardConfigInit()

You added the ASSERT_EFI_ERROR macros which is good, but it would probably make 
sense to also return the failing error code from this function. Also, the 
comment describing this function at the top is wrong and the function 
declaration doesn't follow style guidelines.

Also, WhiskeylakeURvpBoardInitBeforeSiliconInit(), which calls this function, 
does not check the Status code it returns. Either use the Status codes or make 
the function return VOID.

Thanks,
Nate

-Original Message-
From: Kubacki, Michael A 
Sent: Friday, August 23, 2019 2:23 PM
To: devel@edk2.groups.io
Cc: Chiu, Chasel ; Desimone, Nathaniel L 
; Gao, Liming 
Subject: [edk2-platforms][PATCH V2 2/2] WhiskeylakeOpenBoardPkg: Fix GCC Build 
Failures

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

Fixes build failures on GCC7.3.0. Tested on Ubunutu 18.04.1 LTS.

Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Liming Gao 
Signed-off-by: Michael Kubacki 
---
 Platform/Intel/WhiskeylakeOpenBoardPkg/OpenBoardPkg.dec
  |   6 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/Library/PeiHdaVerbTableLib/PeiHdaVerbTableLib.inf
 |   1 +
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/PeiBoardInitPostMemLib.inf
   |   8 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/PeiMultiBoardInitPostMemLib.inf
  |   2 +
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/PeiMultiBoardInitPreMemLib.inf
   |  12 +-
 Platform/Intel/WhiskeylakeOpenBoardPkg/Include/PcieDeviceOverrideTable.h   
  |   2 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Include/WhiskeylakeURvpId.h
   |  12 -
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/BoardFunc.h
  |   2 +
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/PeiWhiskeylakeURvpInitLib.h
  |  41 -
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/WhiskeylakeURvpInit.h
|  41 +
 
Platform/Intel/WhiskeylakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyInitLib/PeiFspCpuPolicyInitLib.c
   |   4 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/Library/BaseGpioExpanderLib/BaseGpioExpanderLib.c
 |   6 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/Library/PeiHdaVerbTableLib/{PchHdaVerbTables.h
 => PchHdaVerbTables.c} | 963 +---
 
Platform/Intel/WhiskeylakeOpenBoardPkg/Library/PeiHdaVerbTableLib/PeiHdaVerbTableLib.c
   |   7 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/Policy/Library/PeiPolicyUpdateLib/PeiPchPolicyUpdate.c
|   6 -
 
Platform/Intel/WhiskeylakeOpenBoardPkg/Policy/Library/PeiPolicyUpdateLib/PeiSaPolicyUpdatePreMem.c
   |  15 +-
 Platform/Intel/WhiskeylakeOpenBoardPkg/Policy/PolicyInitDxe/BoardInitLib.c 
  |   4 -
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardAcpiLib/SmmMultiBoardAcpiSupportLib.c
|   2 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardAcpiLib/SmmWhiskeylakeURvpAcpiEnableLib.c
|   2 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/BoardFuncInit.c
  |   1 -
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/BoardFuncInitPreMem.c
|   1 -
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/BoardPchInitPreMemLib.c
  |  12 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/BoardSaInitPreMemLib.c
   |   6 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/{GpioTableDefault.h
 => GpioTableDefault.c}   |  16 +-
 

Re: [edk2-devel] git submodule update --init --recursive

2019-08-23 Thread rebecca
On 2019-08-23 14:41, Andrew Fish via Groups.Io wrote:
> I was following the instructions on how to build OVMF and my build failed. It 
> looks like the reason it failed was because I did not do a `git submodule 
> update --init --recursive`. It would be good if we could make how to clone 
> the edk2 instructions a bit more obvious. 


I think we came to the conclusion that "--recursive" isn't needed. But
I've found that there are cases where "--force" is required to make sure
git checks out a submodule correctly.


-- 
Rebecca Cran


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

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



Re: [edk2-devel] [edk2-platforms][PATCH V2 1/2] CoffeelakeSiliconPkg: Fix GCC Build Failures

2019-08-23 Thread Nate DeSimone
Pch/Include/ConfigBlock/HdAudioConfig.h - I think like it would make more sense 
if Uefi.h is included first.

With that change...

Reviewed-by: Nate DeSimone 

-Original Message-
From: devel@edk2.groups.io  On Behalf Of Kubacki, Michael 
A
Sent: Friday, August 23, 2019 2:23 PM
To: devel@edk2.groups.io
Cc: Chiu, Chasel ; Chaganty, Rangasai V 

Subject: [edk2-devel] [edk2-platforms][PATCH V2 1/2] CoffeelakeSiliconPkg: Fix 
GCC Build Failures

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

Fixes build failures on GCC7.3.0. Tested on Ubuntu 18.04.1 LTS.

Cc: Chasel Chiu 
Cc: Sai Chaganty 
Signed-off-by: Michael Kubacki 
---
 Silicon/Intel/CoffeelakeSiliconPkg/Pch/Include/ConfigBlock/HdAudioConfig.h 
  | 2 ++
 Silicon/Intel/CoffeelakeSiliconPkg/Pch/Include/Library/GpioLib.h   
  | 1 +
 
Silicon/Intel/CoffeelakeSiliconPkg/Pch/Library/PeiPchPolicyLib/PeiPchPolicyLib.c
 | 2 --
 Silicon/Intel/CoffeelakeSiliconPkg/SystemAgent/SaInit/Dxe/SaInitDxe.c  
  | 1 +
 4 files changed, 4 insertions(+), 2 deletions(-)

diff --git 
a/Silicon/Intel/CoffeelakeSiliconPkg/Pch/Include/ConfigBlock/HdAudioConfig.h 
b/Silicon/Intel/CoffeelakeSiliconPkg/Pch/Include/ConfigBlock/HdAudioConfig.h
index a810d4f1fc..e2c8730f38 100644
--- a/Silicon/Intel/CoffeelakeSiliconPkg/Pch/Include/ConfigBlock/HdAudioConfig.h
+++ b/Silicon/Intel/CoffeelakeSiliconPkg/Pch/Include/ConfigBlock/HdAudio
+++ Config.h
@@ -9,7 +9,9 @@
 #ifndef _HDAUDIO_CONFIG_H_
 #define _HDAUDIO_CONFIG_H_
 
+#include 
 #include 
+#include 
 
 #define HDAUDIO_PREMEM_CONFIG_REVISION 1  #define HDAUDIO_CONFIG_REVISION 2 
diff --git a/Silicon/Intel/CoffeelakeSiliconPkg/Pch/Include/Library/GpioLib.h 
b/Silicon/Intel/CoffeelakeSiliconPkg/Pch/Include/Library/GpioLib.h
index 25def24fca..ff76e7c60f 100644
--- a/Silicon/Intel/CoffeelakeSiliconPkg/Pch/Include/Library/GpioLib.h
+++ b/Silicon/Intel/CoffeelakeSiliconPkg/Pch/Include/Library/GpioLib.h
@@ -11,6 +11,7 @@
 #define _GPIO_LIB_H_
 
 #include 
+#include 
 
 #define GPIO_NAME_LENGTH_MAX  32
 
diff --git 
a/Silicon/Intel/CoffeelakeSiliconPkg/Pch/Library/PeiPchPolicyLib/PeiPchPolicyLib.c
 
b/Silicon/Intel/CoffeelakeSiliconPkg/Pch/Library/PeiPchPolicyLib/PeiPchPolicyLib.c
index 2a1da20667..ece0be8158 100644
--- 
a/Silicon/Intel/CoffeelakeSiliconPkg/Pch/Library/PeiPchPolicyLib/PeiPchPolicyLib.c
+++ b/Silicon/Intel/CoffeelakeSiliconPkg/Pch/Library/PeiPchPolicyLib/Pei
+++ PchPolicyLib.c
@@ -353,10 +353,8 @@ LoadLanConfigDefault (
   )
 {
   PCH_LAN_CONFIG  *LanConfig;
-  UINT16  LpcDid;
 
   LanConfig = ConfigBlockPointer;
-  LpcDid= PchGetLpcDid ();
 
   DEBUG ((DEBUG_INFO, "LanConfig->Header.GuidHob.Name = %g\n", 
>Header.GuidHob.Name));
   DEBUG ((DEBUG_INFO, "LanConfig->Header.GuidHob.Header.HobLength = 0x%x\n", 
LanConfig->Header.GuidHob.Header.HobLength));
diff --git 
a/Silicon/Intel/CoffeelakeSiliconPkg/SystemAgent/SaInit/Dxe/SaInitDxe.c 
b/Silicon/Intel/CoffeelakeSiliconPkg/SystemAgent/SaInit/Dxe/SaInitDxe.c
index d646e60618..e6980f9a65 100644
--- a/Silicon/Intel/CoffeelakeSiliconPkg/SystemAgent/SaInit/Dxe/SaInitDxe.c
+++ b/Silicon/Intel/CoffeelakeSiliconPkg/SystemAgent/SaInit/Dxe/SaInitDx
+++ e.c
@@ -41,6 +41,7 @@ SaInitEntryPointDxe (
   SaInitEntryPoint ();
 
   Status = SaAcpiInit (ImageHandle);
+  ASSERT_EFI_ERROR (Status);
 
   ///
   /// Create PCI Enumeration Completed callback for SA
--
2.16.2.windows.1





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

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



Re: [edk2-devel] [edk2-platforms][PATCH V2 1/2] KabylakeOpenBoardPkg: Fix GCC Build Failures

2019-08-23 Thread Nate DeSimone
Reviewed-by: Nate DeSimone 

-Original Message-
From: Kubacki, Michael A 
Sent: Thursday, August 22, 2019 11:17 AM
To: devel@edk2.groups.io
Cc: Chiu, Chasel ; Desimone, Nathaniel L 
; Gao, Liming 
Subject: [edk2-platforms][PATCH V2 1/2] KabylakeOpenBoardPkg: Fix GCC Build 
Failures

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

Fixes build failures on GCC7.3.0. Tested on Ubunutu 18.04.1 LTS.

Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Liming Gao 
Signed-off-by: Michael Kubacki 
---
 
Platform/Intel/KabylakeOpenBoardPkg/FspWrapper/Library/SecFspWrapperPlatformSecLib/FspWrapperPlatformSecLib.c
 | 2 +-
 
Platform/Intel/KabylakeOpenBoardPkg/Library/BaseGpioExpanderLib/BaseGpioExpanderLib.c
 | 8 +++-
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git 
a/Platform/Intel/KabylakeOpenBoardPkg/FspWrapper/Library/SecFspWrapperPlatformSecLib/FspWrapperPlatformSecLib.c
 
b/Platform/Intel/KabylakeOpenBoardPkg/FspWrapper/Library/SecFspWrapperPlatformSecLib/FspWrapperPlatformSecLib.c
index d73fc77f69..d40eecae95 100644
--- 
a/Platform/Intel/KabylakeOpenBoardPkg/FspWrapper/Library/SecFspWrapperPlatformSecLib/FspWrapperPlatformSecLib.c
+++ 
b/Platform/Intel/KabylakeOpenBoardPkg/FspWrapper/Library/SecFspWrapperPlatformSecLib/FspWrapperPlatformSecLib.c
@@ -174,7 +174,7 @@ SecPlatformMain (
 //
 CopyMem (CopyDestinationPointer, mPeiCoreFvLocationPpiList, sizeof 
(mPeiCoreFvLocationPpiList));
 TopOfTemporaryRamPpiIndex = 1;
-(UINT8 *) CopyDestinationPointer += sizeof(mPeiCoreFvLocationPpiList);
+CopyDestinationPointer += sizeof (mPeiCoreFvLocationPpiList);
   }
   CopyMem (CopyDestinationPointer, mPeiSecPlatformPpi, 
sizeof(mPeiSecPlatformPpi));
   //
diff --git 
a/Platform/Intel/KabylakeOpenBoardPkg/Library/BaseGpioExpanderLib/BaseGpioExpanderLib.c
 
b/Platform/Intel/KabylakeOpenBoardPkg/Library/BaseGpioExpanderLib/BaseGpioExpanderLib.c
index ead1e6df19..3d1856d89e 100644
--- 
a/Platform/Intel/KabylakeOpenBoardPkg/Library/BaseGpioExpanderLib/BaseGpioExpanderLib.c
+++ 
b/Platform/Intel/KabylakeOpenBoardPkg/Library/BaseGpioExpanderLib/BaseGpioExpanderLib.c
@@ -1,7 +1,7 @@
 /** @file
   Support for IO expander TCA6424.
 
-Copyright (c) 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -70,12 +70,11 @@ GpioExpGetRegister (
   IN UINT8 Register
   )
 {
-  EFI_STATUS Status;
   UINT8 WriBuf[1];
   UINT8 ReBuf[1] = {0};
 
   WriBuf[0] = Register;
-  Status = I2cWriteRead( Bar0, TCA6424_I2C_ADDRESS+Address, 1, WriBuf, 1, 
ReBuf, WAIT_1_SECOND);
+  I2cWriteRead (Bar0, TCA6424_I2C_ADDRESS + Address, 1, WriBuf, 1, ReBuf, 
WAIT_1_SECOND);
 
   return ReBuf[0];
 }
@@ -99,13 +98,12 @@ GpioExpSetRegister (
   IN UINT8 Value
   )
 {
-  EFI_STATUS Status;
   UINT8 WriBuf[2];
 
   WriBuf[0] = Register;
   WriBuf[1] = Value;
-  Status = I2cWriteRead( Bar0, TCA6424_I2C_ADDRESS+Address, 2, WriBuf, 0, 
NULL, WAIT_1_SECOND);
 
+  I2cWriteRead (Bar0, TCA6424_I2C_ADDRESS + Address, 2, WriBuf, 0, NULL, 
WAIT_1_SECOND);
 }
 /**
   Set the input register to a give value mentioned in the function.
-- 
2.16.2.windows.1


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

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



Re: [edk2-devel] [edk2-platforms][PATCH V2 2/2] ClevoOpenBoardPkg: Fix GCC Build Failures

2019-08-23 Thread Nate DeSimone
Reviewed-by: Nate DeSimone 

-Original Message-
From: Kubacki, Michael A 
Sent: Thursday, August 22, 2019 11:17 AM
To: devel@edk2.groups.io
Cc: Desimone, Nathaniel L ; Gao, Liming 
; Sinha, Ankit 
Subject: [edk2-platforms][PATCH V2 2/2] ClevoOpenBoardPkg: Fix GCC Build 
Failures

Fixes build failures on GCC7.3.0. Tested on Ubunutu 18.04.1 LTS.

Cc: Nate DeSimone 
Cc: Liming Gao 
Cc: Ankit Sinha 
Signed-off-by: Michael Kubacki 
---
 
Platform/Intel/ClevoOpenBoardPkg/Library/BaseGpioExpanderLib/BaseGpioExpanderLib.c
 | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git 
a/Platform/Intel/ClevoOpenBoardPkg/Library/BaseGpioExpanderLib/BaseGpioExpanderLib.c
 
b/Platform/Intel/ClevoOpenBoardPkg/Library/BaseGpioExpanderLib/BaseGpioExpanderLib.c
index 260c5bb6a2..cc70f15c24 100644
--- 
a/Platform/Intel/ClevoOpenBoardPkg/Library/BaseGpioExpanderLib/BaseGpioExpanderLib.c
+++ 
b/Platform/Intel/ClevoOpenBoardPkg/Library/BaseGpioExpanderLib/BaseGpioExpanderLib.c
@@ -70,12 +70,11 @@ GpioExpGetRegister (
   IN UINT8 Register
   )
 {
-  EFI_STATUS Status;
   UINT8 WriBuf[1];
   UINT8 ReBuf[1] = {0};
 
   WriBuf[0] = Register;
-  Status = I2cWriteRead( Bar0, TCA6424_I2C_ADDRESS+Address, 1, WriBuf, 1, 
ReBuf, WAIT_1_SECOND);
+  I2cWriteRead (Bar0, TCA6424_I2C_ADDRESS + Address, 1, WriBuf, 1, ReBuf, 
WAIT_1_SECOND);
 
   return ReBuf[0];
 }
@@ -99,13 +98,11 @@ GpioExpSetRegister (
   IN UINT8 Value
   )
 {
-  EFI_STATUS Status;
   UINT8 WriBuf[2];
 
   WriBuf[0] = Register;
   WriBuf[1] = Value;
-  Status = I2cWriteRead( Bar0, TCA6424_I2C_ADDRESS+Address, 2, WriBuf, 0, 
NULL, WAIT_1_SECOND);
-
+  I2cWriteRead (Bar0, TCA6424_I2C_ADDRESS + Address, 2, WriBuf, 0, NULL, 
WAIT_1_SECOND);
 }
 /**
   Set the input register to a give value mentioned in the function.
-- 
2.16.2.windows.1


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

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



Re: [edk2-devel] [edk2-platforms][PATCH V1 2/2] ClevoOpenBoardPkg: Fix GCC Build Failures

2019-08-23 Thread Nate DeSimone
Reviewed-by: Nate DeSimone 

-Original Message-
From: devel@edk2.groups.io  On Behalf Of Kubacki, Michael 
A
Sent: Thursday, August 22, 2019 10:40 AM
To: devel@edk2.groups.io
Cc: Desimone, Nathaniel L ; Gao, Liming 
; Sinha, Ankit 
Subject: [edk2-devel] [edk2-platforms][PATCH V1 2/2] ClevoOpenBoardPkg: Fix GCC 
Build Failures

Fixes build failures on GCC7.3.0. Tested on Ubunutu 18.04.1 LTS.

Cc: Nate DeSimone 
Cc: Liming Gao 
Cc: Ankit Sinha 
Signed-off-by: Michael Kubacki 
---
 
Platform/Intel/ClevoOpenBoardPkg/Library/BaseGpioExpanderLib/BaseGpioExpanderLib.c
 | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git 
a/Platform/Intel/ClevoOpenBoardPkg/Library/BaseGpioExpanderLib/BaseGpioExpanderLib.c
 
b/Platform/Intel/ClevoOpenBoardPkg/Library/BaseGpioExpanderLib/BaseGpioExpanderLib.c
index 260c5bb6a2..cc70f15c24 100644
--- 
a/Platform/Intel/ClevoOpenBoardPkg/Library/BaseGpioExpanderLib/BaseGpioExpanderLib.c
+++ 
b/Platform/Intel/ClevoOpenBoardPkg/Library/BaseGpioExpanderLib/BaseGpioExpanderLib.c
@@ -70,12 +70,11 @@ GpioExpGetRegister (
   IN UINT8 Register
   )
 {
-  EFI_STATUS Status;
   UINT8 WriBuf[1];
   UINT8 ReBuf[1] = {0};
 
   WriBuf[0] = Register;
-  Status = I2cWriteRead( Bar0, TCA6424_I2C_ADDRESS+Address, 1, WriBuf, 1, 
ReBuf, WAIT_1_SECOND);
+  I2cWriteRead (Bar0, TCA6424_I2C_ADDRESS + Address, 1, WriBuf, 1, ReBuf, 
WAIT_1_SECOND);
 
   return ReBuf[0];
 }
@@ -99,13 +98,11 @@ GpioExpSetRegister (
   IN UINT8 Value
   )
 {
-  EFI_STATUS Status;
   UINT8 WriBuf[2];
 
   WriBuf[0] = Register;
   WriBuf[1] = Value;
-  Status = I2cWriteRead( Bar0, TCA6424_I2C_ADDRESS+Address, 2, WriBuf, 0, 
NULL, WAIT_1_SECOND);
-
+  I2cWriteRead (Bar0, TCA6424_I2C_ADDRESS + Address, 2, WriBuf, 0, NULL, 
WAIT_1_SECOND);
 }
 /**
   Set the input register to a give value mentioned in the function.
-- 
2.16.2.windows.1





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

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



Re: [edk2-devel] [edk2-platforms][PATCH V1 1/2] KabylakeOpenBoardPkg: Fix GCC Build Failures

2019-08-23 Thread Nate DeSimone
With copyright year change...

Reviewed-by: Nate DeSimone <

-Original Message-
From: devel@edk2.groups.io  On Behalf Of Kubacki, Michael 
A
Sent: Thursday, August 22, 2019 10:40 AM
To: devel@edk2.groups.io
Cc: Chiu, Chasel ; Desimone, Nathaniel L 
; Gao, Liming 
Subject: [edk2-devel] [edk2-platforms][PATCH V1 1/2] KabylakeOpenBoardPkg: Fix 
GCC Build Failures

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

Fixes build failures on GCC7.3.0. Tested on Ubunutu 18.04.1 LTS.

Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Liming Gao 
Signed-off-by: Michael Kubacki 
---
 
Platform/Intel/KabylakeOpenBoardPkg/FspWrapper/Library/SecFspWrapperPlatformSecLib/FspWrapperPlatformSecLib.c
 | 2 +-
 
Platform/Intel/KabylakeOpenBoardPkg/Library/BaseGpioExpanderLib/BaseGpioExpanderLib.c
 | 6 ++
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git 
a/Platform/Intel/KabylakeOpenBoardPkg/FspWrapper/Library/SecFspWrapperPlatformSecLib/FspWrapperPlatformSecLib.c
 
b/Platform/Intel/KabylakeOpenBoardPkg/FspWrapper/Library/SecFspWrapperPlatformSecLib/FspWrapperPlatformSecLib.c
index d73fc77f69..d40eecae95 100644
--- 
a/Platform/Intel/KabylakeOpenBoardPkg/FspWrapper/Library/SecFspWrapperPlatformSecLib/FspWrapperPlatformSecLib.c
+++ 
b/Platform/Intel/KabylakeOpenBoardPkg/FspWrapper/Library/SecFspWrapperPlatformSecLib/FspWrapperPlatformSecLib.c
@@ -174,7 +174,7 @@ SecPlatformMain (
 //
 CopyMem (CopyDestinationPointer, mPeiCoreFvLocationPpiList, sizeof 
(mPeiCoreFvLocationPpiList));
 TopOfTemporaryRamPpiIndex = 1;
-(UINT8 *) CopyDestinationPointer += sizeof(mPeiCoreFvLocationPpiList);
+CopyDestinationPointer += sizeof (mPeiCoreFvLocationPpiList);
   }
   CopyMem (CopyDestinationPointer, mPeiSecPlatformPpi, 
sizeof(mPeiSecPlatformPpi));
   //
diff --git 
a/Platform/Intel/KabylakeOpenBoardPkg/Library/BaseGpioExpanderLib/BaseGpioExpanderLib.c
 
b/Platform/Intel/KabylakeOpenBoardPkg/Library/BaseGpioExpanderLib/BaseGpioExpanderLib.c
index ead1e6df19..acab1326ff 100644
--- 
a/Platform/Intel/KabylakeOpenBoardPkg/Library/BaseGpioExpanderLib/BaseGpioExpanderLib.c
+++ 
b/Platform/Intel/KabylakeOpenBoardPkg/Library/BaseGpioExpanderLib/BaseGpioExpanderLib.c
@@ -70,12 +70,11 @@ GpioExpGetRegister (
   IN UINT8 Register
   )
 {
-  EFI_STATUS Status;
   UINT8 WriBuf[1];
   UINT8 ReBuf[1] = {0};
 
   WriBuf[0] = Register;
-  Status = I2cWriteRead( Bar0, TCA6424_I2C_ADDRESS+Address, 1, WriBuf, 1, 
ReBuf, WAIT_1_SECOND);
+  I2cWriteRead (Bar0, TCA6424_I2C_ADDRESS + Address, 1, WriBuf, 1, ReBuf, 
WAIT_1_SECOND);
 
   return ReBuf[0];
 }
@@ -99,13 +98,12 @@ GpioExpSetRegister (
   IN UINT8 Value
   )
 {
-  EFI_STATUS Status;
   UINT8 WriBuf[2];
 
   WriBuf[0] = Register;
   WriBuf[1] = Value;
-  Status = I2cWriteRead( Bar0, TCA6424_I2C_ADDRESS+Address, 2, WriBuf, 0, 
NULL, WAIT_1_SECOND);
 
+  I2cWriteRead (Bar0, TCA6424_I2C_ADDRESS + Address, 2, WriBuf, 0, NULL, 
WAIT_1_SECOND);
 }
 /**
   Set the input register to a give value mentioned in the function.
-- 
2.16.2.windows.1





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

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



Re: [edk2-devel] [edk2-platform PATCH 2/2] Platform/MinPlatformPkg: Add missing header files in INF files

2019-08-23 Thread Nate DeSimone
With copyright change noted by other reviewers...

Reviewed-by: Nate DeSimone 

-Original Message-
From: Zhang, Shenglei 
Sent: Wednesday, August 21, 2019 1:01 AM
To: devel@edk2.groups.io
Cc: Kubacki, Michael A ; Chiu, Chasel 
; Desimone, Nathaniel L 
; Gao, Liming 
Subject: [edk2-platform PATCH 2/2] Platform/MinPlatformPkg: Add missing header 
files in INF files

The header files are used but missing in INF,which causes warning message when 
building them.
https://bugzilla.tianocore.org/show_bug.cgi?id=2037

Cc: Michael Kubacki 
Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Liming Gao 
Signed-off-by: Shenglei Zhang 
---
 .../MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceSmm.inf | 1 +
 .../SecFspWrapperPlatformSecLib/SecFspWrapperPlatformSecLib.inf | 1 +
 .../Hsti/HstiIbvPlatformDxe/HstiIbvPlatformDxe.inf  | 1 +
 .../Library/PeiHobVariableLibFce/PeiHobVariableLibFce.inf   | 2 ++
 .../PeiHobVariableLibFce/PeiHobVariableLibFceOptSize.inf| 2 ++
 .../Test/Library/TestPointCheckLib/DxeTestPointCheckLib.inf | 1 +
 .../Test/Library/TestPointCheckLib/SmmTestPointCheckLib.inf | 1 +
 7 files changed, 9 insertions(+)

diff --git 
a/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceSmm.inf 
b/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceSmm.inf
index cca7de94..4c5202f9 100644
--- a/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceSmm.inf
+++ b/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceSmm
+++ .inf
@@ -50,6 +50,7 @@
 [Sources]
   Common/SpiFvbServiceCommon.c
   Common/FvbInfo.c
+  Common/SpiFvbServiceCommon.h
   Smm/SpiFvbServiceSmm.c
 
 [Protocols]
diff --git 
a/Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapperPlatformSecLib/SecFspWrapperPlatformSecLib.inf
 
b/Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapperPlatformSecLib/SecFspWrapperPlatformSecLib.inf
index 5d77e9e4..3f5a63f2 100644
--- 
a/Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapperPlatformSecLib/SecFspWrapperPlatformSecLib.inf
+++ b/Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapperPlat
+++ formSecLib/SecFspWrapperPlatformSecLib.inf
@@ -41,6 +41,7 @@
   SecGetPerformance.c
   SecTempRamDone.c
   PlatformInit.c
+  FsptCoreUpd.h
 
 [Sources.IA32]
   Ia32/SecEntry.nasm
diff --git 
a/Platform/Intel/MinPlatformPkg/Hsti/HstiIbvPlatformDxe/HstiIbvPlatformDxe.inf 
b/Platform/Intel/MinPlatformPkg/Hsti/HstiIbvPlatformDxe/HstiIbvPlatformDxe.inf
index 64814528..172280e8 100644
--- 
a/Platform/Intel/MinPlatformPkg/Hsti/HstiIbvPlatformDxe/HstiIbvPlatformDxe.inf
+++ b/Platform/Intel/MinPlatformPkg/Hsti/HstiIbvPlatformDxe/HstiIbvPlatf
+++ ormDxe.inf
@@ -23,6 +23,7 @@
   SecureBootBypass.c
   ExternalDeviceDmaProtection.c
   MorSupport.c
+  HstiIbvPlatformDxe.h
 
 [Packages]
   MdePkg/MdePkg.dec
diff --git 
a/Platform/Intel/MinPlatformPkg/Library/PeiHobVariableLibFce/PeiHobVariableLibFce.inf
 
b/Platform/Intel/MinPlatformPkg/Library/PeiHobVariableLibFce/PeiHobVariableLibFce.inf
index fd80c611..ad8882fe 100644
--- 
a/Platform/Intel/MinPlatformPkg/Library/PeiHobVariableLibFce/PeiHobVariableLibFce.inf
+++ b/Platform/Intel/MinPlatformPkg/Library/PeiHobVariableLibFce/PeiHobV
+++ ariableLibFce.inf
@@ -37,6 +37,8 @@
 [Sources]
   PeiHobVariableLibFce.c
   InternalCommonLib.c
+  Variable.h
+  Fce.h
 
 [Ppis]
   gEfiPeiMemoryDiscoveredPpiGuid## NOTIFY
diff --git 
a/Platform/Intel/MinPlatformPkg/Library/PeiHobVariableLibFce/PeiHobVariableLibFceOptSize.inf
 
b/Platform/Intel/MinPlatformPkg/Library/PeiHobVariableLibFce/PeiHobVariableLibFceOptSize.inf
index 82d81c98..e1a76715 100644
--- 
a/Platform/Intel/MinPlatformPkg/Library/PeiHobVariableLibFce/PeiHobVariableLibFceOptSize.inf
+++ b/Platform/Intel/MinPlatformPkg/Library/PeiHobVariableLibFce/PeiHobV
+++ ariableLibFceOptSize.inf
@@ -36,6 +36,8 @@
 [Sources]
   PeiHobVariableLibFceOptSize.c
   InternalCommonLib.c
+  Variable.h
+  Fce.h
 
 [Ppis]
   gEfiPeiMemoryDiscoveredPpiGuid## NOTIFY
diff --git 
a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeTestPointCheckLib.inf
 
b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeTestPointCheckLib.inf
index 62fceffb..76e193dc 100644
--- 
a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeTestPointCheckLib.inf
+++ b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeTe
+++ stPointCheckLib.inf
@@ -68,6 +68,7 @@
   DxeCheckTcgMor.c
   DxeCheckDmaProtection.c
   TestPointHelp.c
+  TestPointInternal.h
 
 [Guids]
   gEfiMemoryAttributesTableGuid
diff --git 
a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/SmmTestPointCheckLib.inf
 
b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/SmmTestPointCheckLib.inf
index 6007fbc9..03d027ec 100644
--- 
a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/SmmTestPointCheckLib.inf
+++ b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/SmmTe
+++ stPointCheckLib.inf
@@ -45,6 

[edk2-devel] [edk2-platforms][PATCH V2 2/2] WhiskeylakeOpenBoardPkg: Fix GCC Build Failures

2019-08-23 Thread Kubacki, Michael A
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2110

Fixes build failures on GCC7.3.0. Tested on Ubunutu 18.04.1 LTS.

Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Liming Gao 
Signed-off-by: Michael Kubacki 
---
 Platform/Intel/WhiskeylakeOpenBoardPkg/OpenBoardPkg.dec
  |   6 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/Library/PeiHdaVerbTableLib/PeiHdaVerbTableLib.inf
 |   1 +
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/PeiBoardInitPostMemLib.inf
   |   8 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/PeiMultiBoardInitPostMemLib.inf
  |   2 +
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/PeiMultiBoardInitPreMemLib.inf
   |  12 +-
 Platform/Intel/WhiskeylakeOpenBoardPkg/Include/PcieDeviceOverrideTable.h   
  |   2 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Include/WhiskeylakeURvpId.h
   |  12 -
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/BoardFunc.h
  |   2 +
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/PeiWhiskeylakeURvpInitLib.h
  |  41 -
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/WhiskeylakeURvpInit.h
|  41 +
 
Platform/Intel/WhiskeylakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyInitLib/PeiFspCpuPolicyInitLib.c
   |   4 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/Library/BaseGpioExpanderLib/BaseGpioExpanderLib.c
 |   6 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/Library/PeiHdaVerbTableLib/{PchHdaVerbTables.h
 => PchHdaVerbTables.c} | 963 +---
 
Platform/Intel/WhiskeylakeOpenBoardPkg/Library/PeiHdaVerbTableLib/PeiHdaVerbTableLib.c
   |   7 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/Policy/Library/PeiPolicyUpdateLib/PeiPchPolicyUpdate.c
|   6 -
 
Platform/Intel/WhiskeylakeOpenBoardPkg/Policy/Library/PeiPolicyUpdateLib/PeiSaPolicyUpdatePreMem.c
   |  15 +-
 Platform/Intel/WhiskeylakeOpenBoardPkg/Policy/PolicyInitDxe/BoardInitLib.c 
  |   4 -
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardAcpiLib/SmmMultiBoardAcpiSupportLib.c
|   2 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardAcpiLib/SmmWhiskeylakeURvpAcpiEnableLib.c
|   2 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/BoardFuncInit.c
  |   1 -
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/BoardFuncInitPreMem.c
|   1 -
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/BoardPchInitPreMemLib.c
  |  12 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/BoardSaInitPreMemLib.c
   |   6 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/{GpioTableDefault.h
 => GpioTableDefault.c}   |  16 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/{GpioTableWhlUDdr4.h
 => GpioTableWhiskeylakeUDdr4Rvp.c}  |  20 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/{GpioTableWhlUDdr4PreMem.h
 => GpioTableWhlUDdr4PreMem.c} |  21 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/PeiMultiBoardInitPostMemLib.c
|   2 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/PeiMultiBoardInitPreMemLib.c
 |   2 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/PeiWhiskeylakeURvpDetect.c
   |   2 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/PeiWhiskeylakeURvpInitPostMemLib.c
   |  41 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/PeiWhiskeylakeURvpInitPreMemLib.c
|  58 +-
 31 files changed, 157 insertions(+), 1161 deletions(-)

diff --git a/Platform/Intel/WhiskeylakeOpenBoardPkg/OpenBoardPkg.dec 
b/Platform/Intel/WhiskeylakeOpenBoardPkg/OpenBoardPkg.dec
index 9d56f0e841..8de48077f0 100644
--- a/Platform/Intel/WhiskeylakeOpenBoardPkg/OpenBoardPkg.dec
+++ 

[edk2-devel] [edk2-platforms][PATCH V2 0/2] Fix Whiskey Lake GCC Build Failures

2019-08-23 Thread Kubacki, Michael A
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2124
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2110

Fixes GCC build failures in WhiskeylakeOpenBoardPkg and CoffeelakeSiliconPkg
(silicon package used by WhiskeylakeOpenBoardPkg).

V2 Changes:
 * Breaks changes into a dedicated patch for each package.

Cc: Sai Chaganty 
Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Liming Gao 
Signed-off-by: Michael Kubacki 

Michael Kubacki (2):
  CoffeelakeSiliconPkg: Fix GCC Build Failures
  WhiskeylakeOpenBoardPkg: Fix GCC Build Failures

 Platform/Intel/WhiskeylakeOpenBoardPkg/OpenBoardPkg.dec
  |   6 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/Library/PeiHdaVerbTableLib/PeiHdaVerbTableLib.inf
 |   1 +
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/PeiBoardInitPostMemLib.inf
   |   8 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/PeiMultiBoardInitPostMemLib.inf
  |   2 +
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/PeiMultiBoardInitPreMemLib.inf
   |  12 +-
 Platform/Intel/WhiskeylakeOpenBoardPkg/Include/PcieDeviceOverrideTable.h   
  |   2 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Include/WhiskeylakeURvpId.h
   |  12 -
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/BoardFunc.h
  |   2 +
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/PeiWhiskeylakeURvpInitLib.h
  |  41 -
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/WhiskeylakeURvpInit.h
|  41 +
 Silicon/Intel/CoffeelakeSiliconPkg/Pch/Include/ConfigBlock/HdAudioConfig.h 
  |   2 +
 Silicon/Intel/CoffeelakeSiliconPkg/Pch/Include/Library/GpioLib.h   
  |   1 +
 
Platform/Intel/WhiskeylakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyInitLib/PeiFspCpuPolicyInitLib.c
   |   4 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/Library/BaseGpioExpanderLib/BaseGpioExpanderLib.c
 |   6 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/Library/PeiHdaVerbTableLib/{PchHdaVerbTables.h
 => PchHdaVerbTables.c} | 963 +---
 
Platform/Intel/WhiskeylakeOpenBoardPkg/Library/PeiHdaVerbTableLib/PeiHdaVerbTableLib.c
   |   7 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/Policy/Library/PeiPolicyUpdateLib/PeiPchPolicyUpdate.c
|   6 -
 
Platform/Intel/WhiskeylakeOpenBoardPkg/Policy/Library/PeiPolicyUpdateLib/PeiSaPolicyUpdatePreMem.c
   |  15 +-
 Platform/Intel/WhiskeylakeOpenBoardPkg/Policy/PolicyInitDxe/BoardInitLib.c 
  |   4 -
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardAcpiLib/SmmMultiBoardAcpiSupportLib.c
|   2 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardAcpiLib/SmmWhiskeylakeURvpAcpiEnableLib.c
|   2 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/BoardFuncInit.c
  |   1 -
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/BoardFuncInitPreMem.c
|   1 -
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/BoardPchInitPreMemLib.c
  |  12 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/BoardSaInitPreMemLib.c
   |   6 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/{GpioTableDefault.h
 => GpioTableDefault.c}   |  16 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/{GpioTableWhlUDdr4.h
 => GpioTableWhiskeylakeUDdr4Rvp.c}  |  20 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/{GpioTableWhlUDdr4PreMem.h
 => GpioTableWhlUDdr4PreMem.c} |  21 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/PeiMultiBoardInitPostMemLib.c
|   2 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/PeiMultiBoardInitPreMemLib.c
 |   2 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/PeiWhiskeylakeURvpDetect.c
   

[edk2-devel] [edk2-platforms][PATCH V2 1/2] CoffeelakeSiliconPkg: Fix GCC Build Failures

2019-08-23 Thread Kubacki, Michael A
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2124

Fixes build failures on GCC7.3.0. Tested on Ubuntu 18.04.1 LTS.

Cc: Chasel Chiu 
Cc: Sai Chaganty 
Signed-off-by: Michael Kubacki 
---
 Silicon/Intel/CoffeelakeSiliconPkg/Pch/Include/ConfigBlock/HdAudioConfig.h 
  | 2 ++
 Silicon/Intel/CoffeelakeSiliconPkg/Pch/Include/Library/GpioLib.h   
  | 1 +
 
Silicon/Intel/CoffeelakeSiliconPkg/Pch/Library/PeiPchPolicyLib/PeiPchPolicyLib.c
 | 2 --
 Silicon/Intel/CoffeelakeSiliconPkg/SystemAgent/SaInit/Dxe/SaInitDxe.c  
  | 1 +
 4 files changed, 4 insertions(+), 2 deletions(-)

diff --git 
a/Silicon/Intel/CoffeelakeSiliconPkg/Pch/Include/ConfigBlock/HdAudioConfig.h 
b/Silicon/Intel/CoffeelakeSiliconPkg/Pch/Include/ConfigBlock/HdAudioConfig.h
index a810d4f1fc..e2c8730f38 100644
--- a/Silicon/Intel/CoffeelakeSiliconPkg/Pch/Include/ConfigBlock/HdAudioConfig.h
+++ b/Silicon/Intel/CoffeelakeSiliconPkg/Pch/Include/ConfigBlock/HdAudioConfig.h
@@ -9,7 +9,9 @@
 #ifndef _HDAUDIO_CONFIG_H_
 #define _HDAUDIO_CONFIG_H_
 
+#include 
 #include 
+#include 
 
 #define HDAUDIO_PREMEM_CONFIG_REVISION 1
 #define HDAUDIO_CONFIG_REVISION 2
diff --git a/Silicon/Intel/CoffeelakeSiliconPkg/Pch/Include/Library/GpioLib.h 
b/Silicon/Intel/CoffeelakeSiliconPkg/Pch/Include/Library/GpioLib.h
index 25def24fca..ff76e7c60f 100644
--- a/Silicon/Intel/CoffeelakeSiliconPkg/Pch/Include/Library/GpioLib.h
+++ b/Silicon/Intel/CoffeelakeSiliconPkg/Pch/Include/Library/GpioLib.h
@@ -11,6 +11,7 @@
 #define _GPIO_LIB_H_
 
 #include 
+#include 
 
 #define GPIO_NAME_LENGTH_MAX  32
 
diff --git 
a/Silicon/Intel/CoffeelakeSiliconPkg/Pch/Library/PeiPchPolicyLib/PeiPchPolicyLib.c
 
b/Silicon/Intel/CoffeelakeSiliconPkg/Pch/Library/PeiPchPolicyLib/PeiPchPolicyLib.c
index 2a1da20667..ece0be8158 100644
--- 
a/Silicon/Intel/CoffeelakeSiliconPkg/Pch/Library/PeiPchPolicyLib/PeiPchPolicyLib.c
+++ 
b/Silicon/Intel/CoffeelakeSiliconPkg/Pch/Library/PeiPchPolicyLib/PeiPchPolicyLib.c
@@ -353,10 +353,8 @@ LoadLanConfigDefault (
   )
 {
   PCH_LAN_CONFIG  *LanConfig;
-  UINT16  LpcDid;
 
   LanConfig = ConfigBlockPointer;
-  LpcDid= PchGetLpcDid ();
 
   DEBUG ((DEBUG_INFO, "LanConfig->Header.GuidHob.Name = %g\n", 
>Header.GuidHob.Name));
   DEBUG ((DEBUG_INFO, "LanConfig->Header.GuidHob.Header.HobLength = 0x%x\n", 
LanConfig->Header.GuidHob.Header.HobLength));
diff --git 
a/Silicon/Intel/CoffeelakeSiliconPkg/SystemAgent/SaInit/Dxe/SaInitDxe.c 
b/Silicon/Intel/CoffeelakeSiliconPkg/SystemAgent/SaInit/Dxe/SaInitDxe.c
index d646e60618..e6980f9a65 100644
--- a/Silicon/Intel/CoffeelakeSiliconPkg/SystemAgent/SaInit/Dxe/SaInitDxe.c
+++ b/Silicon/Intel/CoffeelakeSiliconPkg/SystemAgent/SaInit/Dxe/SaInitDxe.c
@@ -41,6 +41,7 @@ SaInitEntryPointDxe (
   SaInitEntryPoint ();
 
   Status = SaAcpiInit (ImageHandle);
+  ASSERT_EFI_ERROR (Status);
 
   ///
   /// Create PCI Enumeration Completed callback for SA
-- 
2.16.2.windows.1


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

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



Re: [edk2-devel] [edk2-platforms:PATCH] Intel/IntelSiliconPkg Implement SmmAccess in IntelSiliconPkg

2019-08-23 Thread Ni, Ray
It's not recommended to make IntelSiliconPkg depend on MdeModulePkg.

> -Original Message-
> From: Chaganty, Rangasai V
> Sent: Friday, August 23, 2019 11:34 AM
> To: Chen, Marc W ; devel@edk2.groups.io
> Cc: Ni, Ray 
> Subject: RE: [edk2-platforms:PATCH] Intel/IntelSiliconPkg Implement SmmAccess 
> in IntelSiliconPkg
> 
> May I know the reason to implement the SmmAccessLib instance under \Feature 
> folder?
> Can we move it under IntelSiliconPkg\Library (We need to create a library 
> folder in the root) and keep just the module in the
> \Feature folder?
> 
> I've noticed there is a dependency on MdeModulePkg with this change.
> Could you provide the reason to have such dependency as part of this change?
> 
> Thanks,
> Sai
> 
> -Original Message-
> From: Chen, Marc W
> Sent: Friday, August 23, 2019 3:28 AM
> To: devel@edk2.groups.io
> Cc: Chen, Marc W ; Ni, Ray ; 
> Chaganty, Rangasai V
> 
> Subject: [edk2-platforms:PATCH] Intel/IntelSiliconPkg Implement SmmAccess in 
> IntelSiliconPkg
> 
> REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2121
> 
> Implement SmmAccess for PEI and DXE phase in IntelSiliconPkg
> 
> Signed-off-by: Marc Chen 
> Cc: Ray Ni 
> Cc: Rangasai V Chaganty 
> ---
>  .../Library/PeiSmmAccessLib/PeiSmmAccessLib.c  | 343 
> +
>  .../Library/PeiSmmAccessLib/PeiSmmAccessLib.inf|  42 +++
>  .../Feature/SmmAccess/SmmAccessDxe/SmmAccess.inf   |  47 +++
>  .../SmmAccess/SmmAccessDxe/SmmAccessDriver.c   | 267 
>  .../SmmAccess/SmmAccessDxe/SmmAccessDriver.h   | 160 ++
>  .../IntelSiliconPkg/Include/Library/SmmAccessLib.h |  32 ++
>  6 files changed, 891 insertions(+)
>  create mode 100644 
> Silicon/Intel/IntelSiliconPkg/Feature/SmmAccess/Library/PeiSmmAccessLib/PeiSmmAccessLib.c
>  create mode 100644 
> Silicon/Intel/IntelSiliconPkg/Feature/SmmAccess/Library/PeiSmmAccessLib/PeiSmmAccessLib.inf
>  create mode 100644 
> Silicon/Intel/IntelSiliconPkg/Feature/SmmAccess/SmmAccessDxe/SmmAccess.inf
>  create mode 100644 
> Silicon/Intel/IntelSiliconPkg/Feature/SmmAccess/SmmAccessDxe/SmmAccessDriver.c
>  create mode 100644 
> Silicon/Intel/IntelSiliconPkg/Feature/SmmAccess/SmmAccessDxe/SmmAccessDriver.h
>  create mode 100644 
> Silicon/Intel/IntelSiliconPkg/Include/Library/SmmAccessLib.h
> 
> diff --git 
> a/Silicon/Intel/IntelSiliconPkg/Feature/SmmAccess/Library/PeiSmmAccessLib/PeiSmmAccessLib.c
> b/Silicon/Intel/IntelSiliconPkg/Feature/SmmAccess/Library/PeiSmmAccessLib/PeiSmmAccessLib.c
> new file mode 100644
> index 00..88eb217d2a
> --- /dev/null
> +++ b/Silicon/Intel/IntelSiliconPkg/Feature/SmmAccess/Library/PeiSmmAcce
> +++ ssLib/PeiSmmAccessLib.c
> @@ -0,0 +1,343 @@
> +/** @file
> +  This is to publish the SMM Access Ppi instance.
> +
> +  Copyright (c) 2019, Intel Corporation. All rights reserved.
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +#include 
> +#include 
> +#include  #include
> + #include  #include
> + #include  #include
> +
> +
> +#include 
> +#include 
> +
> +#define SMM_ACCESS_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('4', '5', 's',
> +'a')
> +
> +///
> +/// Private data
> +///
> +typedef struct {
> +  UINTN Signature;
> +  EFI_HANDLEHandle;
> +  PEI_SMM_ACCESS_PPISmmAccess;
> +  //
> +  // Local Data for SMM Access interface goes here
> +  //
> +  UINTN NumberRegions;
> +  EFI_SMRAM_DESCRIPTOR  *SmramDesc;
> +} SMM_ACCESS_PRIVATE_DATA;
> +
> +#define SMM_ACCESS_PRIVATE_DATA_FROM_THIS(a) \
> +CR (a, \
> +  SMM_ACCESS_PRIVATE_DATA, \
> +  SmmAccess, \
> +  SMM_ACCESS_PRIVATE_DATA_SIGNATURE \
> +  )
> +
> +/**
> +  This routine accepts a request to "open" a region of SMRAM.  The
> +  region could be legacy ABSEG, HSEG, or TSEG near top of physical memory.
> +  The use of "open" means that the memory is visible from all PEIM
> +  and SMM agents.
> +
> +  @param[in] This -  Pointer to the SMM Access Interface.
> +  @param[in] DescriptorIndex  -  Region of SMRAM to Open.
> +  @param[in] PeiServices  -  General purpose services available to every 
> PEIM.
> +
> +  @retval EFI_SUCCESS-  The region was successfully opened.
> +  @retval EFI_DEVICE_ERROR   -  The region could not be opened because 
> locked by
> +chipset.
> +  @retval EFI_INVALID_PARAMETER  -  The descriptor index was out of bounds.
> +**/
> +EFI_STATUS
> +EFIAPI
> +Open (
> +  IN EFI_PEI_SERVICES   **PeiServices,
> +  IN PEI_SMM_ACCESS_PPI *This,
> +  IN UINTN  DescriptorIndex
> +  )
> +{
> +  SMM_ACCESS_PRIVATE_DATA *SmmAccess;
> +
> +  SmmAccess = SMM_ACCESS_PRIVATE_DATA_FROM_THIS (This);  if
> + (DescriptorIndex >= SmmAccess->NumberRegions) {
> +DEBUG ((DEBUG_WARN, "SMRAM region out of range\n"));
> +
> +return EFI_INVALID_PARAMETER;
> +  } else if (SmmAccess->SmramDesc[DescriptorIndex].RegionState & 
> EFI_SMRAM_LOCKED) {
> +   

[edk2-devel] git submodule update --init --recursive

2019-08-23 Thread Andrew Fish via Groups.Io
I was following the instructions on how to build OVMF and my build failed. It 
looks like the reason it failed was because I did not do a `git submodule 
update --init --recursive`. It would be good if we could make how to clone the 
edk2 instructions a bit more obvious. 

Thanks,

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

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



Re: [edk2-devel] [edk2-platforms][PATCH V1 1/1] WhiskeylakeOpenBoardPkg: Fix GCC Build Failures

2019-08-23 Thread Kubacki, Michael A
I missed splitting the changes into commits per packages. I will send a V2 with 
a dedicated patch for CoffeelakeSiliconPkg and WhiskeylakeOpenBoardPkg in a 
patch series.

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

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



[edk2-devel] [edk2-platforms][PATCH V1 1/1] WhiskeylakeOpenBoardPkg: Fix GCC Build Failures

2019-08-23 Thread Kubacki, Michael A
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2110

Fixes build failures on GCC7.3.0. Tested on Ubunutu 18.04.1 LTS.

Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Liming Gao 
Signed-off-by: Michael Kubacki 
---
 Platform/Intel/WhiskeylakeOpenBoardPkg/OpenBoardPkg.dec
  |   6 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/Library/PeiHdaVerbTableLib/PeiHdaVerbTableLib.inf
 |   1 +
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/PeiBoardInitPostMemLib.inf
   |   8 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/PeiMultiBoardInitPostMemLib.inf
  |   2 +
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/PeiMultiBoardInitPreMemLib.inf
   |  12 +-
 Platform/Intel/WhiskeylakeOpenBoardPkg/Include/PcieDeviceOverrideTable.h   
  |   2 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Include/WhiskeylakeURvpId.h
   |  12 -
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/BoardFunc.h
  |   2 +
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/PeiWhiskeylakeURvpInitLib.h
  |  41 -
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/WhiskeylakeURvpInit.h
|  41 +
 Silicon/Intel/CoffeelakeSiliconPkg/Pch/Include/ConfigBlock/HdAudioConfig.h 
  |   2 +
 Silicon/Intel/CoffeelakeSiliconPkg/Pch/Include/Library/GpioLib.h   
  |   1 +
 
Platform/Intel/WhiskeylakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyInitLib/PeiFspCpuPolicyInitLib.c
   |   4 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/Library/BaseGpioExpanderLib/BaseGpioExpanderLib.c
 |   6 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/Library/PeiHdaVerbTableLib/{PchHdaVerbTables.h
 => PchHdaVerbTables.c} | 963 +---
 
Platform/Intel/WhiskeylakeOpenBoardPkg/Library/PeiHdaVerbTableLib/PeiHdaVerbTableLib.c
   |   7 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/Policy/Library/PeiPolicyUpdateLib/PeiPchPolicyUpdate.c
|   6 -
 
Platform/Intel/WhiskeylakeOpenBoardPkg/Policy/Library/PeiPolicyUpdateLib/PeiSaPolicyUpdatePreMem.c
   |  15 +-
 Platform/Intel/WhiskeylakeOpenBoardPkg/Policy/PolicyInitDxe/BoardInitLib.c 
  |   4 -
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardAcpiLib/SmmMultiBoardAcpiSupportLib.c
|   2 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardAcpiLib/SmmWhiskeylakeURvpAcpiEnableLib.c
|   2 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/BoardFuncInit.c
  |   1 -
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/BoardFuncInitPreMem.c
|   1 -
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/BoardPchInitPreMemLib.c
  |  12 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/BoardSaInitPreMemLib.c
   |   6 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/{GpioTableDefault.h
 => GpioTableDefault.c}   |  16 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/{GpioTableWhlUDdr4.h
 => GpioTableWhiskeylakeUDdr4Rvp.c}  |  20 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/{GpioTableWhlUDdr4PreMem.h
 => GpioTableWhlUDdr4PreMem.c} |  21 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/PeiMultiBoardInitPostMemLib.c
|   2 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/PeiMultiBoardInitPreMemLib.c
 |   2 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/PeiWhiskeylakeURvpDetect.c
   |   2 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/PeiWhiskeylakeURvpInitPostMemLib.c
   |  41 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/PeiWhiskeylakeURvpInitPreMemLib.c
|  58 +-
 

Re: [edk2-devel] [edk2-platforms:PATCH] Intel/IntelSiliconPkg Implement SmmAccess in IntelSiliconPkg

2019-08-23 Thread Chaganty, Rangasai V
May I know the reason to implement the SmmAccessLib instance under \Feature 
folder?
Can we move it under IntelSiliconPkg\Library (We need to create a library 
folder in the root) and keep just the module in the \Feature folder?

I've noticed there is a dependency on MdeModulePkg with this change. 
Could you provide the reason to have such dependency as part of this change?

Thanks,
Sai

-Original Message-
From: Chen, Marc W 
Sent: Friday, August 23, 2019 3:28 AM
To: devel@edk2.groups.io
Cc: Chen, Marc W ; Ni, Ray ; Chaganty, 
Rangasai V 
Subject: [edk2-platforms:PATCH] Intel/IntelSiliconPkg Implement SmmAccess in 
IntelSiliconPkg

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

Implement SmmAccess for PEI and DXE phase in IntelSiliconPkg

Signed-off-by: Marc Chen 
Cc: Ray Ni 
Cc: Rangasai V Chaganty 
---
 .../Library/PeiSmmAccessLib/PeiSmmAccessLib.c  | 343 +
 .../Library/PeiSmmAccessLib/PeiSmmAccessLib.inf|  42 +++
 .../Feature/SmmAccess/SmmAccessDxe/SmmAccess.inf   |  47 +++
 .../SmmAccess/SmmAccessDxe/SmmAccessDriver.c   | 267 
 .../SmmAccess/SmmAccessDxe/SmmAccessDriver.h   | 160 ++
 .../IntelSiliconPkg/Include/Library/SmmAccessLib.h |  32 ++
 6 files changed, 891 insertions(+)
 create mode 100644 
Silicon/Intel/IntelSiliconPkg/Feature/SmmAccess/Library/PeiSmmAccessLib/PeiSmmAccessLib.c
 create mode 100644 
Silicon/Intel/IntelSiliconPkg/Feature/SmmAccess/Library/PeiSmmAccessLib/PeiSmmAccessLib.inf
 create mode 100644 
Silicon/Intel/IntelSiliconPkg/Feature/SmmAccess/SmmAccessDxe/SmmAccess.inf
 create mode 100644 
Silicon/Intel/IntelSiliconPkg/Feature/SmmAccess/SmmAccessDxe/SmmAccessDriver.c
 create mode 100644 
Silicon/Intel/IntelSiliconPkg/Feature/SmmAccess/SmmAccessDxe/SmmAccessDriver.h
 create mode 100644 Silicon/Intel/IntelSiliconPkg/Include/Library/SmmAccessLib.h

diff --git 
a/Silicon/Intel/IntelSiliconPkg/Feature/SmmAccess/Library/PeiSmmAccessLib/PeiSmmAccessLib.c
 
b/Silicon/Intel/IntelSiliconPkg/Feature/SmmAccess/Library/PeiSmmAccessLib/PeiSmmAccessLib.c
new file mode 100644
index 00..88eb217d2a
--- /dev/null
+++ b/Silicon/Intel/IntelSiliconPkg/Feature/SmmAccess/Library/PeiSmmAcce
+++ ssLib/PeiSmmAccessLib.c
@@ -0,0 +1,343 @@
+/** @file
+  This is to publish the SMM Access Ppi instance.
+
+  Copyright (c) 2019, Intel Corporation. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+#include 
+#include 
+#include  #include 
+ #include  #include 
+ #include  #include 
+
+
+#include 
+#include 
+
+#define SMM_ACCESS_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('4', '5', 's', 
+'a')
+
+///
+/// Private data
+///
+typedef struct {
+  UINTN Signature;
+  EFI_HANDLEHandle;
+  PEI_SMM_ACCESS_PPISmmAccess;
+  //
+  // Local Data for SMM Access interface goes here
+  //
+  UINTN NumberRegions;
+  EFI_SMRAM_DESCRIPTOR  *SmramDesc;
+} SMM_ACCESS_PRIVATE_DATA;
+
+#define SMM_ACCESS_PRIVATE_DATA_FROM_THIS(a) \
+CR (a, \
+  SMM_ACCESS_PRIVATE_DATA, \
+  SmmAccess, \
+  SMM_ACCESS_PRIVATE_DATA_SIGNATURE \
+  )
+
+/**
+  This routine accepts a request to "open" a region of SMRAM.  The
+  region could be legacy ABSEG, HSEG, or TSEG near top of physical memory.
+  The use of "open" means that the memory is visible from all PEIM
+  and SMM agents.
+
+  @param[in] This -  Pointer to the SMM Access Interface.
+  @param[in] DescriptorIndex  -  Region of SMRAM to Open.
+  @param[in] PeiServices  -  General purpose services available to every 
PEIM.
+
+  @retval EFI_SUCCESS-  The region was successfully opened.
+  @retval EFI_DEVICE_ERROR   -  The region could not be opened because 
locked by
+chipset.
+  @retval EFI_INVALID_PARAMETER  -  The descriptor index was out of bounds.
+**/
+EFI_STATUS
+EFIAPI
+Open (
+  IN EFI_PEI_SERVICES   **PeiServices,
+  IN PEI_SMM_ACCESS_PPI *This,
+  IN UINTN  DescriptorIndex
+  )
+{
+  SMM_ACCESS_PRIVATE_DATA *SmmAccess;
+
+  SmmAccess = SMM_ACCESS_PRIVATE_DATA_FROM_THIS (This);  if 
+ (DescriptorIndex >= SmmAccess->NumberRegions) {
+DEBUG ((DEBUG_WARN, "SMRAM region out of range\n"));
+
+return EFI_INVALID_PARAMETER;
+  } else if (SmmAccess->SmramDesc[DescriptorIndex].RegionState & 
EFI_SMRAM_LOCKED) {
+//
+// Cannot open a "locked" region
+//
+DEBUG ((DEBUG_WARN, "Cannot open a locked SMRAM region\n"));
+
+return EFI_DEVICE_ERROR;
+  }
+
+  SmmAccess->SmramDesc[DescriptorIndex].RegionState &= (UINT64) 
+~(EFI_SMRAM_CLOSED | EFI_ALLOCATED);
+  SmmAccess->SmramDesc[DescriptorIndex].RegionState |= (UINT64) 
+EFI_SMRAM_OPEN;
+  SmmAccess->SmmAccess.OpenState = TRUE;
+  return EFI_SUCCESS;
+}
+
+/**
+  This routine accepts a request to "close" a region of SMRAM.  This is 
+valid for
+  compatible SMRAM region.
+
+  @param[in] PeiServices  -  General purpose services 

Re: [edk2-devel] [edk2-platform PATCH 1/2] Platform/SmbiosBasicDxe: Add a missing header file in INF

2019-08-23 Thread Chaganty, Rangasai V
Have you tried adding the path in AdvancedFeaturePkg.dec under [Includes] 
section?

-Original Message-
From: Zhang, Shenglei 
Sent: Wednesday, August 21, 2019 1:01 AM
To: devel@edk2.groups.io
Cc: Kubacki, Michael A ; Chaganty, Rangasai V 
; Gao, Liming 
Subject: [edk2-platform PATCH 1/2] Platform/SmbiosBasicDxe: Add a missing 
header file in INF

The header file is used but missing in INF,which causes warning message when 
building them.
https://bugzilla.tianocore.org/show_bug.cgi?id=2037

Cc: Michael Kubacki 
Cc: Sai Chaganty 
Cc: Liming Gao 
Signed-off-by: Shenglei Zhang 
---
 .../AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicDxe.inf  | 1 +
 1 file changed, 1 insertion(+)

diff --git 
a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicDxe.inf 
b/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicDxe.inf
index 69e930dd..bbac1d5c 100644
--- a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicDxe.inf
+++ b/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasi
+++ cDxe.inf
@@ -23,6 +23,7 @@
 
 [Sources]
   SmbiosBasicEntryPoint.c
+  SmbiosBasic.h
   Type0BiosVendorFunction.c
   Type1SystemManufacturerFunction.c
   Type2BaseBoardManufacturerFunction.c
--
2.18.0.windows.1


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

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



Re: [edk2-devel] [edk2-platforms PATCH 1/4] Platform/AdvancedFeaturePkg.dsc: Add build option

2019-08-23 Thread Chaganty, Rangasai V
Reviewed-by: Sai Chaganty 

-Original Message-
From: Zhang, Shenglei 
Sent: Thursday, August 22, 2019 12:08 AM
To: devel@edk2.groups.io
Cc: Kubacki, Michael A ; Chaganty, Rangasai V 
; Gao, Liming ; Zhang, 
Shenglei 
Subject: [edk2-platforms PATCH 1/4] Platform/AdvancedFeaturePkg.dsc: Add build 
option

Add the build option "/D DISABLE_NEW_DEPRECATED_INTERFACES" in DSC file to make 
sure that the deprecated APIs will not be used in our code.
https://bugzilla.tianocore.org/show_bug.cgi?id=2111

Cc: Michael Kubacki 
Cc: Sai Chaganty 
Cc: Liming Gao 
Signed-off-by: Shenglei Zhang 
---
 Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc 
b/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
index ea1a0072..57f28b8c 100644
--- a/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
+++ b/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
@@ -148,3 +148,6 @@
   AdvancedFeaturePkg/Ipmi/IpmiFru/IpmiFru.inf
   AdvancedFeaturePkg/Ipmi/BmcElog/BmcElog.inf
   AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcAcpi.inf
+
+[BuildOptions]
+  *_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES
\ No newline at end of file
--
2.18.0.windows.1


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

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



Re: [edk2-devel] [edk2-platform PATCH 2/2] Platform/MinPlatformPkg: Add missing header files in INF files

2019-08-23 Thread Kubacki, Michael A
Please extend the copyright date in all files touched to 2019. With that change:

Reviewed-by: Michael Kubacki 

> -Original Message-
> From: Zhang, Shenglei
> Sent: Wednesday, August 21, 2019 1:01 AM
> To: devel@edk2.groups.io
> Cc: Kubacki, Michael A ; Chiu, Chasel
> ; Desimone, Nathaniel L
> ; Gao, Liming 
> Subject: [edk2-platform PATCH 2/2] Platform/MinPlatformPkg: Add missing
> header files in INF files
> 
> The header files are used but missing in INF,which causes warning message
> when building them.
> https://bugzilla.tianocore.org/show_bug.cgi?id=2037
> 
> Cc: Michael Kubacki 
> Cc: Chasel Chiu 
> Cc: Nate DeSimone 
> Cc: Liming Gao 
> Signed-off-by: Shenglei Zhang 
> ---
>  .../MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceSmm.inf | 1 +
>  .../SecFspWrapperPlatformSecLib/SecFspWrapperPlatformSecLib.inf | 1 +
>  .../Hsti/HstiIbvPlatformDxe/HstiIbvPlatformDxe.inf  | 1 +
>  .../Library/PeiHobVariableLibFce/PeiHobVariableLibFce.inf   | 2 ++
>  .../PeiHobVariableLibFce/PeiHobVariableLibFceOptSize.inf| 2 ++
>  .../Test/Library/TestPointCheckLib/DxeTestPointCheckLib.inf | 1 +
>  .../Test/Library/TestPointCheckLib/SmmTestPointCheckLib.inf | 1 +
>  7 files changed, 9 insertions(+)
> 
> diff --git
> a/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceSmm.inf
> b/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceSmm.inf
> index cca7de94..4c5202f9 100644
> ---
> a/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceSmm.inf
> +++ b/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceSmm
> +++ .inf
> @@ -50,6 +50,7 @@
>  [Sources]
>Common/SpiFvbServiceCommon.c
>Common/FvbInfo.c
> +  Common/SpiFvbServiceCommon.h
>Smm/SpiFvbServiceSmm.c
> 
>  [Protocols]
> diff --git
> a/Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapperPlatfor
> mSecLib/SecFspWrapperPlatformSecLib.inf
> b/Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapperPlatfor
> mSecLib/SecFspWrapperPlatformSecLib.inf
> index 5d77e9e4..3f5a63f2 100644
> ---
> a/Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapperPlatfor
> mSecLib/SecFspWrapperPlatformSecLib.inf
> +++ b/Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapperPlat
> +++ formSecLib/SecFspWrapperPlatformSecLib.inf
> @@ -41,6 +41,7 @@
>SecGetPerformance.c
>SecTempRamDone.c
>PlatformInit.c
> +  FsptCoreUpd.h
> 
>  [Sources.IA32]
>Ia32/SecEntry.nasm
> diff --git
> a/Platform/Intel/MinPlatformPkg/Hsti/HstiIbvPlatformDxe/HstiIbvPlatformDxe.
> inf
> b/Platform/Intel/MinPlatformPkg/Hsti/HstiIbvPlatformDxe/HstiIbvPlatformDxe.
> inf
> index 64814528..172280e8 100644
> ---
> a/Platform/Intel/MinPlatformPkg/Hsti/HstiIbvPlatformDxe/HstiIbvPlatformDxe.
> inf
> +++ b/Platform/Intel/MinPlatformPkg/Hsti/HstiIbvPlatformDxe/HstiIbvPlatf
> +++ ormDxe.inf
> @@ -23,6 +23,7 @@
>SecureBootBypass.c
>ExternalDeviceDmaProtection.c
>MorSupport.c
> +  HstiIbvPlatformDxe.h
> 
>  [Packages]
>MdePkg/MdePkg.dec
> diff --git
> a/Platform/Intel/MinPlatformPkg/Library/PeiHobVariableLibFce/PeiHobVariabl
> eLibFce.inf
> b/Platform/Intel/MinPlatformPkg/Library/PeiHobVariableLibFce/PeiHobVariabl
> eLibFce.inf
> index fd80c611..ad8882fe 100644
> ---
> a/Platform/Intel/MinPlatformPkg/Library/PeiHobVariableLibFce/PeiHobVariabl
> eLibFce.inf
> +++ b/Platform/Intel/MinPlatformPkg/Library/PeiHobVariableLibFce/PeiHobV
> +++ ariableLibFce.inf
> @@ -37,6 +37,8 @@
>  [Sources]
>PeiHobVariableLibFce.c
>InternalCommonLib.c
> +  Variable.h
> +  Fce.h
> 
>  [Ppis]
>gEfiPeiMemoryDiscoveredPpiGuid## NOTIFY
> diff --git
> a/Platform/Intel/MinPlatformPkg/Library/PeiHobVariableLibFce/PeiHobVariabl
> eLibFceOptSize.inf
> b/Platform/Intel/MinPlatformPkg/Library/PeiHobVariableLibFce/PeiHobVariabl
> eLibFceOptSize.inf
> index 82d81c98..e1a76715 100644
> ---
> a/Platform/Intel/MinPlatformPkg/Library/PeiHobVariableLibFce/PeiHobVariabl
> eLibFceOptSize.inf
> +++ b/Platform/Intel/MinPlatformPkg/Library/PeiHobVariableLibFce/PeiHobV
> +++ ariableLibFceOptSize.inf
> @@ -36,6 +36,8 @@
>  [Sources]
>PeiHobVariableLibFceOptSize.c
>InternalCommonLib.c
> +  Variable.h
> +  Fce.h
> 
>  [Ppis]
>gEfiPeiMemoryDiscoveredPpiGuid## NOTIFY
> diff --git
> a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeTestPoint
> CheckLib.inf
> b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeTestPoint
> CheckLib.inf
> index 62fceffb..76e193dc 100644
> ---
> a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeTestPoint
> CheckLib.inf
> +++ b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeTe
> +++ stPointCheckLib.inf
> @@ -68,6 +68,7 @@
>DxeCheckTcgMor.c
>DxeCheckDmaProtection.c
>TestPointHelp.c
> +  TestPointInternal.h
> 
>  [Guids]
>gEfiMemoryAttributesTableGuid
> diff --git
> a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/SmmTestPoin
> tCheckLib.inf
> 

Re: [edk2-devel] [edk2-platform PATCH 1/2] Platform/SmbiosBasicDxe: Add a missing header file in INF

2019-08-23 Thread Kubacki, Michael A
Please extend the copyright date in SmbiosDxe.inf to 2019. With that change:

Reviewed-by: Michael Kubacki 

> -Original Message-
> From: Zhang, Shenglei
> Sent: Wednesday, August 21, 2019 1:01 AM
> To: devel@edk2.groups.io
> Cc: Kubacki, Michael A ; Chaganty, Rangasai V
> ; Gao, Liming 
> Subject: [edk2-platform PATCH 1/2] Platform/SmbiosBasicDxe: Add a missing
> header file in INF
> 
> The header file is used but missing in INF,which causes warning message when
> building them.
> https://bugzilla.tianocore.org/show_bug.cgi?id=2037
> 
> Cc: Michael Kubacki 
> Cc: Sai Chaganty 
> Cc: Liming Gao 
> Signed-off-by: Shenglei Zhang 
> ---
>  .../AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicDxe.inf  | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git
> a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicDx
> e.inf
> b/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicDx
> e.inf
> index 69e930dd..bbac1d5c 100644
> ---
> a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicDx
> e.inf
> +++ b/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasi
> +++ cDxe.inf
> @@ -23,6 +23,7 @@
> 
>  [Sources]
>SmbiosBasicEntryPoint.c
> +  SmbiosBasic.h
>Type0BiosVendorFunction.c
>Type1SystemManufacturerFunction.c
>Type2BaseBoardManufacturerFunction.c
> --
> 2.18.0.windows.1


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

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



Re: [edk2-devel] [edk2-platforms PATCH 3/4] Platform/MinPlatformPkg.dsc: Add build option

2019-08-23 Thread Kubacki, Michael A
Please extend the file copyright date. With that change:

Reviewed-by: Michael Kubacki 

> -Original Message-
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Zhang, Shenglei
> Sent: Thursday, August 22, 2019 12:08 AM
> To: devel@edk2.groups.io
> Cc: Kubacki, Michael A ; Chiu, Chasel
> ; Desimone, Nathaniel L
> ; Gao, Liming ;
> Zhang, Shenglei 
> Subject: [edk2-devel] [edk2-platforms PATCH 3/4]
> Platform/MinPlatformPkg.dsc: Add build option
> 
> Add the build option "/D DISABLE_NEW_DEPRECATED_INTERFACES" in DSC file
> to make sure that the deprecated APIs will not be used in our code.
> https://bugzilla.tianocore.org/show_bug.cgi?id=2111
> 
> Cc: Michael Kubacki 
> Cc: Chasel Chiu 
> Cc: Nate DeSimone 
> Cc: Liming Gao 
> Signed-off-by: Shenglei Zhang 
> ---
>  Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
> b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
> index 8a3638b7..9bbb7963 100644
> --- a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
> +++ b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
> @@ -187,3 +187,6 @@
>MinPlatformPkg/Tcg/Tcg2PlatformPei/Tcg2PlatformPei.inf
>MinPlatformPkg/Tcg/Tcg2PlatformDxe/Tcg2PlatformDxe.inf
>  !endif
> +
> +[BuildOptions]
> +  *_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES
> \ No newline at end of file
> --
> 2.18.0.windows.1
> 
> 
> 


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

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



Re: [edk2-devel] [edk2-platforms PATCH 4/4] Platform/UserInterfaceFeaturePkg.dsc: Add build option

2019-08-23 Thread Kubacki, Michael A
Reviewed-by: Michael Kubacki 

> -Original Message-
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Zhang, Shenglei
> Sent: Thursday, August 22, 2019 12:08 AM
> To: devel@edk2.groups.io
> Cc: Bi, Dandan ; Gao, Liming ;
> Zhang, Shenglei 
> Subject: [edk2-devel] [edk2-platforms PATCH 4/4]
> Platform/UserInterfaceFeaturePkg.dsc: Add build option
> 
> Add the build option "/D DISABLE_NEW_DEPRECATED_INTERFACES" in DSC file
> to make sure that the deprecated APIs will not be used in our code.
> https://bugzilla.tianocore.org/show_bug.cgi?id=2111
> 
> Cc: Dandan Bi 
> Cc: Liming Gao 
> Signed-off-by: Shenglei Zhang 
> ---
>  .../Intel/UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dsc   | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git
> a/Platform/Intel/UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dsc
> b/Platform/Intel/UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dsc
> index 2c24e43f..95c26766 100644
> --- a/Platform/Intel/UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dsc
> +++ b/Platform/Intel/UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dsc
> @@ -76,3 +76,5 @@
>UserInterfaceFeaturePkg/UserAuthentication/UserAuthentication2Dxe.inf
>UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationSmm.inf
> 
> +[BuildOptions]
> +  *_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES
> \ No newline at end of file
> --
> 2.18.0.windows.1
> 
> 
> 


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

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



Re: [edk2-devel] [edk2-platforms PATCH 2/4] Platform/DebugFeaturePkg.dsc: Add build option

2019-08-23 Thread Kubacki, Michael A
Reviewed-by: Michael Kubacki 

> -Original Message-
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Zhang, Shenglei
> Sent: Thursday, August 22, 2019 12:08 AM
> To: devel@edk2.groups.io
> Cc: Dong, Eric ; Gao, Liming ;
> Zhang, Shenglei 
> Subject: [edk2-devel] [edk2-platforms PATCH 2/4]
> Platform/DebugFeaturePkg.dsc: Add build option
> 
> Add the build option "/D DISABLE_NEW_DEPRECATED_INTERFACES" in DSC file
> to make sure that the deprecated APIs will not be used in our code.
> https://bugzilla.tianocore.org/show_bug.cgi?id=2111
> 
> Cc: Eric Dong 
> Cc: Liming Gao 
> Signed-off-by: Shenglei Zhang 
> ---
>  Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dsc | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dsc
> b/Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dsc
> index b88d1fae..61046f7a 100644
> --- a/Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dsc
> +++ b/Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dsc
> @@ -96,3 +96,6 @@
> 
>DebugFeaturePkg/AcpiDebug/AcpiDebugDxe.inf
>DebugFeaturePkg/AcpiDebug/AcpiDebugSmm.inf
> +
> +[BuildOptions]
> +  *_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES
> \ No newline at end of file
> --
> 2.18.0.windows.1
> 
> 
> 


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

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



Re: [edk2-devel] [edk2-platforms PATCH 1/4] Platform/AdvancedFeaturePkg.dsc: Add build option

2019-08-23 Thread Kubacki, Michael A
Reviewed-by: Michael Kubacki 

> -Original Message-
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Zhang, Shenglei
> Sent: Thursday, August 22, 2019 12:08 AM
> To: devel@edk2.groups.io
> Cc: Kubacki, Michael A ; Chaganty, Rangasai V
> ; Gao, Liming ; Zhang,
> Shenglei 
> Subject: [edk2-devel] [edk2-platforms PATCH 1/4]
> Platform/AdvancedFeaturePkg.dsc: Add build option
> 
> Add the build option "/D DISABLE_NEW_DEPRECATED_INTERFACES" in DSC file
> to make sure that the deprecated APIs will not be used in our code.
> https://bugzilla.tianocore.org/show_bug.cgi?id=2111
> 
> Cc: Michael Kubacki 
> Cc: Sai Chaganty 
> Cc: Liming Gao 
> Signed-off-by: Shenglei Zhang 
> ---
>  Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
> b/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
> index ea1a0072..57f28b8c 100644
> --- a/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
> +++ b/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
> @@ -148,3 +148,6 @@
>AdvancedFeaturePkg/Ipmi/IpmiFru/IpmiFru.inf
>AdvancedFeaturePkg/Ipmi/BmcElog/BmcElog.inf
>AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcAcpi.inf
> +
> +[BuildOptions]
> +  *_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES
> \ No newline at end of file
> --
> 2.18.0.windows.1
> 
> 
> 


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

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



Re: [edk2-devel] [edk2-platform patch 7/7] Platform/Intel: Add build option for SIMICS QSP Platform

2019-08-23 Thread David Wei
Hi Mike,
Please see the updates online below. Please let me know if you have any more 
comments.

Thanks
David

-Original Message-
From: Kubacki, Michael A 
Sent: Monday, August 19, 2019 6:05 PM
To: Wei, David Y ; devel@edk2.groups.io
Cc: Wu, Hao A ; Gao, Liming ; Sinha, 
Ankit ; Agyeman, Prince ; 
Desimone, Nathaniel L ; Kinney, Michael D 

Subject: RE: [edk2-platform patch 7/7] Platform/Intel: Add build option for 
SIMICS QSP Platform

You will need to resolve a conflict in build.cfg. When you do so, please keep 
the boards under [PLATFORMS] in lexicographically ascending order for ease of 
maintenance.
Ydwei: done
> -Original Message-
> From: Wei, David Y
> Sent: Friday, August 9, 2019 3:47 PM
> To: devel@edk2.groups.io
> Cc: Wu, Hao A ; Gao, Liming 
> ; Sinha, Ankit ; Agyeman, 
> Prince ; Kubacki, Michael A 
> ; Desimone, Nathaniel L 
> ; Kinney, Michael D 
> 
> Subject: [edk2-platform patch 7/7] Platform/Intel: Add build option 
> for SIMICS QSP Platform
> 
> Add build option in build script for SIMICS QSP Platform
> 
> Cc: Hao Wu 
> Cc: Liming Gao 
> Cc: Ankit Sinha 
> Cc: Agyeman Prince 
> Cc: Kubacki Michael A 
> Cc: Nate DeSimone 
> Cc: Michael D Kinney 
> Contributed-under: TianoCore Contribution Agreement 1.0
> 
> Signed-off-by: David Wei 
> ---
>  Platform/Intel/build.cfg | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/Platform/Intel/build.cfg b/Platform/Intel/build.cfg index
> fc6e4fe824..2ebe09a632 100644
> --- a/Platform/Intel/build.cfg
> +++ b/Platform/Intel/build.cfg
> @@ -54,3 +54,5 @@ NUMBER_OF_PROCESSORS = 0
>  KabylakeRvp3 = KabylakeOpenBoardPkg/KabylakeRvp3/build_config.cfg
>  N1xxWU = ClevoOpenBoardPkg/N1xxWU/build_config.cfg
>  BoardMtOlympus = PurleyOpenBoardPkg/BoardMtOlympus/build_config.cfg
> +WhiskeylakeURvp =
> +WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/build_config.cfg
> +BoardX58ICH10 = SimicsOpenBoardPkg/BoardX58ICH10/build_config.cfg
> --
> 2.16.2.windows.1


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

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



Re: [edk2-devel] [edk2-platform patch 6/7] SimicsOpenBoardPkg: Add board module for QSP Build tip

2019-08-23 Thread David Wei
Hi Mike,
Please see the updates online below. Please let me know if you have any more 
comments.

Thanks
David

-Original Message-
From: Kubacki, Michael A 
Sent: Monday, August 19, 2019 6:05 PM
To: Wei, David Y ; devel@edk2.groups.io
Cc: Wu, Hao A ; Gao, Liming ; Sinha, 
Ankit ; Agyeman, Prince ; 
Desimone, Nathaniel L ; Kinney, Michael D 

Subject: RE: [edk2-platform patch 6/7] SimicsOpenBoardPkg: Add board module for 
QSP Build tip

Feedback I could not find already noted elsewhere:

1. Remove the batch build files:
 - GitEdk2X58ICH10.bat
 - bld.bat
 - prebuild.bat

The changes must be built with the Python scripts.
Ydwei: Will use platform Logo library to replace the EDK2 logo driver in order 
to avoid compile error by Python scripts.
2. General comment that applies to multiple files:
 Files such as "PlatformPkgBuildOption.dsc" should follow the pre-existing 
open board package
 naming convention. For example, "OpenBoardPkgBuildOption.dsc" in 
KabylakeOpenBoardPkg.
Ydwei: done
3. The first commit line should be "SimicsOpenBoardPkg/BoardX58Ich10 to 
indicate the files relative
 to their location in that board directory.
Ydwei: will do it when commit the patch.
4. Some build option macros in here seem unnecessary. For example, 
"PURLEY_FLAG". Can you please
 check and clean this up?
Ydwei: done
5. PlatformPkgConfig.dsc: The following PCDs should not always be TRUE as they 
originate in the
 AdvancedFeaturePkg and should only be enabled for an advanced feature boot.
 - gAdvancedFeaturePkgTokenSpaceGuid.PcdNetworkEnable
 - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosEnable
Ydwei: They are required by SIMICS, and S3 resume also needed. I didn't make 
change.
> -Original Message-
> From: Wei, David Y
> Sent: Friday, August 9, 2019 3:47 PM
> To: devel@edk2.groups.io
> Cc: Wu, Hao A ; Gao, Liming ;
> Sinha, Ankit ; Agyeman, Prince
> ; Kubacki, Michael A
> ; Desimone, Nathaniel L
> ; Kinney, Michael D
> 
> Subject: [edk2-platform patch 6/7] SimicsOpenBoardPkg: Add board module
> for QSP Build tip
> 
> Add BoardX58ICH10 module for QSP Build tip
> 
> Cc: Hao Wu 
> Cc: Liming Gao 
> Cc: Ankit Sinha 
> Cc: Agyeman Prince 
> Cc: Kubacki Michael A 
> Cc: Nate DeSimone 
> Cc: Michael D Kinney 
> Contributed-under: TianoCore Contribution Agreement 1.0
> 
> Signed-off-by: David Wei 
> ---
>  .../Library/BoardInitLib/PeiBoardInitPostMemLib.c  |  44 +++
>  .../Library/BoardInitLib/PeiBoardInitPreMemLib.c   | 110 
>  .../Library/BoardInitLib/PeiX58ICH10Detect.c   |  26 ++
>  .../BoardInitLib/PeiX58ICH10InitPostMemLib.c   |  34 +++
>  .../BoardInitLib/PeiX58ICH10InitPreMemLib.c| 111 
>  .../BoardX58ICH10/DecomprScratchEnd.fdf.inc|  66 +
>  .../BoardX58ICH10/GitEdk2X58ICH10.bat  |  75 +
>  .../BoardInitLib/PeiBoardInitPostMemLib.inf|  36 +++
>  .../Library/BoardInitLib/PeiBoardInitPreMemLib.inf |  38 +++
>  .../Library/BoardInitLib/PeiX58ICH10InitLib.h  |  16 ++
>  .../BoardX58ICH10/PlatformPkgBuildOption.dsc   |  89 ++
>  .../BoardX58ICH10/PlatformPkgConfig.dsc|  56 
>  .../BoardX58ICH10/PlatformPkgPcd.dsc   | 283 +++
>  .../BoardX58ICH10/SimicsX58Pkg.fdf.inc |  48 
>  .../BoardX58ICH10/SimicsX58PkgIa32X64.dsc  | 244 +
>  .../BoardX58ICH10/SimicsX58PkgIa32X64.fdf  | 303
> +
>  .../BoardX58ICH10/VarStore.fdf.inc |  53 
>  .../Intel/SimicsOpenBoardPkg/BoardX58ICH10/bld.bat | 139 ++
>  .../BoardX58ICH10/build_config.cfg |  31 +++
>  .../SimicsOpenBoardPkg/BoardX58ICH10/prebuild.bat  | 198
> ++
>  20 files changed, 2000 insertions(+)
>  create mode 100644
> Platform/Intel/SimicsOpenBoardPkg/BoardX58ICH10/Library/BoardInitLib/PeiB
> oardInitPostMemLib.c
>  create mode 100644
> Platform/Intel/SimicsOpenBoardPkg/BoardX58ICH10/Library/BoardInitLib/PeiB
> oardInitPreMemLib.c
>  create mode 100644
> Platform/Intel/SimicsOpenBoardPkg/BoardX58ICH10/Library/BoardInitLib/PeiX
> 58ICH10Detect.c
>  create mode 100644
> Platform/Intel/SimicsOpenBoardPkg/BoardX58ICH10/Library/BoardInitLib/PeiX
> 58ICH10InitPostMemLib.c
>  create mode 100644
> Platform/Intel/SimicsOpenBoardPkg/BoardX58ICH10/Library/BoardInitLib/PeiX
> 58ICH10InitPreMemLib.c
>  create mode 100644
> Platform/Intel/SimicsOpenBoardPkg/BoardX58ICH10/DecomprScratchEnd.fdf.i
> nc
>  create mode 100644
> Platform/Intel/SimicsOpenBoardPkg/BoardX58ICH10/GitEdk2X58ICH10.bat
>  create mode 100644
> Platform/Intel/SimicsOpenBoardPkg/BoardX58ICH10/Library/BoardInitLib/PeiB
> oardInitPostMemLib.inf
>  create mode 100644
> Platform/Intel/SimicsOpenBoardPkg/BoardX58ICH10/Library/BoardInitLib/PeiB
> oardInitPreMemLib.inf
>  create mode 100644
> Platform/Intel/SimicsOpenBoardPkg/BoardX58ICH10/Library/BoardInitLib/PeiX
> 58ICH10InitLib.h
>  create mode 100644
> 

Re: [edk2-devel] [edk2-test][Patch V2 1/1] uefi-sct/SctPkg: Eliminate 2nd execution of ExitBootServices Test

2019-08-23 Thread Supreeth Venkatesh
On Fri, 2019-08-23 at 00:46 -0500, Eric Jin wrote:
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2098
> 
> In the ExitBootServices() test, after ExitBootServices() call, all
> boot services are forbidden. The original design is to save the
> return
> status value of ExitBootServices() in variable using variable service
> and reset, but this needs one additional execution of the test to
> retrieve the value from variable and this design was not
> straightforward
> from end user perspective.
> This patch enhances the test by leveraging RecoveryLib to restore
> execution after reset automatically, thus requiring only one
> execution.
> 
> Cc: Supreeth Venkatesh 
> Signed-off-by: Eric Jin 


Please re-order the statements like below to make it more clear since
ResetData is a just a pointer to Buffer Array which is statically
allocated to 1024 and ResetData is not being really initialized to
Reset Record after reading reset record, but to Buffer Array.
1. ResetData = (RESET_DATA *)Buffer;
2. RecoveryLib->ReadResetRecord(RecoveryLib, Size, Buffer);
while commiting it.

With that,
Reviewed-by: Supreeth Venkatesh 


> ---
>  uefi-
> sct/SctPkg/TestCase/UEFI/EFI/BootServices/ImageServices/BlackBoxTest/
> ImageBBTest.inf  |   3 ++-
>  uefi-
> sct/SctPkg/TestCase/UEFI/EFI/BootServices/ImageServices/BlackBoxTest/
> ImageBBTest.h|   9 -
>  uefi-
> sct/SctPkg/TestCase/UEFI/EFI/BootServices/ImageServices/BlackBoxTest/
> ImageBBTestConformance.c | 121
> +
> 
>  3 files changed, 115 insertions(+), 18 deletions(-)
> 
> diff --git a/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/BootServices/ImageServices/BlackBoxTest/
> ImageBBTest.inf b/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/BootServices/ImageServices/BlackBoxTest/
> ImageBBTest.inf
> index 49ad79915934..3de43a20e8a4 100644
> --- a/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/BootServices/ImageServices/BlackBoxTest/
> ImageBBTest.inf
> +++ b/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/BootServices/ImageServices/BlackBoxTest/
> ImageBBTest.inf
> @@ -1,7 +1,7 @@
>  ## @file
>  #
>  #  Copyright 2006 - 2012 Unified EFI, Inc.
> -#  Copyright (c) 2010 - 2012, Intel Corporation. All rights
> reserved.
> +#  Copyright (c) 2010 - 2019, Intel Corporation. All rights
> reserved.
>  #
>  #  This program and the accompanying materials
>  #  are licensed and made available under the terms and conditions of
> the BSD License
> @@ -53,4 +53,5 @@
>  
>  [Protocols]
>gEfiTestProfileLibraryGuid
> +  gEfiTestRecoveryLibraryGuid
>gBlackBoxEfiHIIPackageListProtocolGuid
> diff --git a/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/BootServices/ImageServices/BlackBoxTest/
> ImageBBTest.h b/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/BootServices/ImageServices/BlackBoxTest/
> ImageBBTest.h
> index b1c35fee7435..008584577ed1 100644
> --- a/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/BootServices/ImageServices/BlackBoxTest/
> ImageBBTest.h
> +++ b/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/BootServices/ImageServices/BlackBoxTest/
> ImageBBTest.h
> @@ -1,7 +1,7 @@
>  /** @file
>  
>Copyright 2006 - 2017 Unified EFI, Inc.
> -  Copyright (c) 2010 - 2017, Intel Corporation. All rights
> reserved.
> +  Copyright (c) 2010 - 2019, Intel Corporation. All rights
> reserved.
>  
>This program and the accompanying materials
>are licensed and made available under the terms and conditions of
> the BSD License
> @@ -35,6 +35,13 @@ Abstract:
>  #include EFI_PROTOCOL_DEFINITION (LoadFile)
>  
>  #include EFI_TEST_PROTOCOL_DEFINITION (TestProfileLibrary)
> +#include EFI_TEST_PROTOCOL_DEFINITION (TestRecoveryLibrary)
> +
> +typedef struct _RESET_DATA {
> +  UINTN   Step;
> +  UINTN   TplIndex;
> +  UINT32  RepeatTimes;
> +} RESET_DATA;
>  
>  #if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
>  
> diff --git a/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/BootServices/ImageServices/BlackBoxTest/
> ImageBBTestConformance.c b/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/BootServices/ImageServices/BlackBoxTest/
> ImageBBTestConformance.c
> index 0a26d46847da..6ce1d2d72669 100644
> --- a/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/BootServices/ImageServices/BlackBoxTest/
> ImageBBTestConformance.c
> +++ b/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/BootServices/ImageServices/BlackBoxTest/
> ImageBBTestConformance.c
> @@ -1,7 +1,7 @@
>  /** @file
>  
>Copyright 2006 - 2016 Unified EFI, Inc.
> -  Copyright (c) 2010 - 2016, Intel Corporation. All rights
> reserved.
> +  Copyright (c) 2010 - 2019, Intel Corporation. All rights
> reserved.
>  
>This program and the accompanying materials
>are licensed and made available under the terms and conditions of
> the BSD License
> @@ -30,7 +30,8 @@ Abstract:
>  #define TEST_VENDOR1_GUID \
>{ 0xF6FAB04F, 0xACAF, 0x4af3, { 0xB9, 0xFA, 0xDC, 0xF9, 0x7F,
> 0xB4, 0x42, 0x6F } }
>  
> -#define MAX_BUFFER_SIZE  10
> +#define STATUS_BUFFER_SIZE 

Re: [edk2-devel] [edk2-test][Patch 1/1] uefi-sct/SctPkg: Eliminate 2nd execution of ExitBootServices Test

2019-08-23 Thread Supreeth Venkatesh
On Thu, 2019-08-22 at 22:37 -0500, Jin, Eric wrote:
> Hi Supreeth,
> 
> > -Original Message-
> > From: Supreeth Venkatesh [mailto:supreeth.venkat...@arm.com]
> > Sent: Friday, August 23, 2019 2:43 AM
> > To: devel@edk2.groups.io; Jin, Eric 
> > Subject: Re: [edk2-devel] [edk2-test][Patch 1/1] uefi-sct/SctPkg:
> > Eliminate
> > 2nd execution of ExitBootServices Test
> > 
> > On Wed, 2019-08-21 at 20:50 -0500, Eric Jin via Groups.Io wrote:
> > > Hij Supreeth,
> > 
> > Hi Eric,
> > 
> > > 
> > > > -Original Message-
> > > > From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On
> > > > Behalf
> > > > Of Supreeth Venkatesh
> > > > Sent: Thursday, August 22, 2019 12:43 AM
> > > > To: Jin, Eric ; devel@edk2.groups.io
> > > > Subject: Re: [edk2-devel] [edk2-test][Patch 1/1] uefi-
> > > > sct/SctPkg:
> > > > Eliminate
> > > > 2nd execution of ExitBootServices Test
> > > > 
> > > > On Wed, 2019-08-21 at 01:24 -0500, Eric Jin wrote:
> > > > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2098
> > > > 
> > > > Please add the details of the patch to the commit message.
> > > > "In the ExitBootServices() test, after ExitBootServices() call,
> > > > all
> > > > boot services are forbidden. The original design is to save the
> > > > return status value of
> > > > ExitBootServices() in variable using variable service and
> > > > reset, but
> > > > this needs multiple execution of the test to retrieve the value
> > > > from
> > > > variable and this design was not straightforward from end user
> > > > perspective.
> > > > 
> > > 
> > > I would like to change "multiple execution" to "one additional
> > > execution"
> > > 
> > > > This patch enhances the test by leveraging RecoveryLib to
> > > > restore
> > > > execution
> > > > after reset automatically, thus requiring only one execution"
> > > > 
> > > 
> > > I am ok with this suggestion when I push the code to repo
> > 
> > Thanks.
> > 
> > > 
> > > > More comments inline...
> > > > 
> > > > > 
> > > > > Cc: Supreeth Venkatesh 
> > > > > Signed-off-by: Eric Jin 
> > > > > ---
> > > > >  uefi-
> > > > > sct/SctPkg/TestCase/UEFI/EFI/BootServices/ImageServices/Black
> > > > > BoxT
> > > > > est/
> > > > > ImageBBTest.inf  |  3 ++-
> > > > >  uefi-
> > > > > sct/SctPkg/TestCase/UEFI/EFI/BootServices/ImageServices/Black
> > > > > BoxT
> > > > > est/
> > > > > ImageBBTest.h|  9 -
> > > > >  uefi-
> > > > > sct/SctPkg/TestCase/UEFI/EFI/BootServices/ImageServices/Black
> > > > > BoxT
> > > > > est/
> > > > > ImageBBTestConformance.c | 98
> > > > > 
> > > > 
> > > > 
> > 
> > ++
> > > > +++
> > > > > ++---
> > > > >  3 files changed, 93 insertions(+), 17 deletions(-)
> > > > > 
> > > > > diff --git a/uefi-
> > > > > sct/SctPkg/TestCase/UEFI/EFI/BootServices/ImageServices/Black
> > > > > BoxT
> > > > > est/
> > > > > ImageBBTest.inf b/uefi-
> > > > > sct/SctPkg/TestCase/UEFI/EFI/BootServices/ImageServices/Black
> > > > > BoxT
> > > > > est/
> > > > > ImageBBTest.inf
> > > > > index 49ad79915934..3de43a20e8a4 100644
> > > > > --- a/uefi-
> > > > > sct/SctPkg/TestCase/UEFI/EFI/BootServices/ImageServices/Black
> > > > > BoxT
> > > > > est/
> > > > > ImageBBTest.inf
> > > > > +++ b/uefi-
> > > > > sct/SctPkg/TestCase/UEFI/EFI/BootServices/ImageServices/Black
> > > > > BoxT
> > > > > est/
> > > > > ImageBBTest.inf
> > > > > @@ -1,7 +1,7 @@
> > > > >  ## @file
> > > > >  #
> > > > >  #  Copyright 2006 - 2012 Unified EFI, Inc. -#  Copyright
> > > > > (c)
> > > > > 2010
> > > > > - 2012, Intel Corporation. All rights reserved.
> > > > > +#  Copyright (c) 2010 - 2019, Intel Corporation. All rights
> > > > > reserved.
> > > > >  #
> > > > >  #  This program and the accompanying materials  #  are
> > > > > licensed
> > > > > and
> > > > > made available under the terms and conditions of the BSD
> > > > > License
> > > > > @@
> > > > > -53,4 +53,5 @@
> > > > > 
> > > > >  [Protocols]
> > > > >gEfiTestProfileLibraryGuid
> > > > > +  gEfiTestRecoveryLibraryGuid
> > > > >gBlackBoxEfiHIIPackageListProtocolGuid
> > > > > diff --git a/uefi-
> > > > > sct/SctPkg/TestCase/UEFI/EFI/BootServices/ImageServices/Black
> > > > > BoxT
> > > > > est/
> > > > > ImageBBTest.h b/uefi-
> > > > > sct/SctPkg/TestCase/UEFI/EFI/BootServices/ImageServices/Black
> > > > > BoxT
> > > > > est/
> > > > > ImageBBTest.h
> > > > > index b1c35fee7435..008584577ed1 100644
> > > > > --- a/uefi-
> > > > > sct/SctPkg/TestCase/UEFI/EFI/BootServices/ImageServices/Black
> > > > > BoxT
> > > > > est/
> > > > > ImageBBTest.h
> > > > > +++ b/uefi-
> > > > > sct/SctPkg/TestCase/UEFI/EFI/BootServices/ImageServices/Black
> > > > > BoxT
> > > > > est/
> > > > > ImageBBTest.h
> > > > > @@ -1,7 +1,7 @@
> > > > >  /** @file
> > > > > 
> > > > >Copyright 2006 - 2017 Unified EFI, Inc.
> > > > > -  Copyright (c) 2010 - 2017, Intel Corporation. All rights
> > > > > reserved.
> > > > > +  

Re: [edk2-rfc] [edk2-devel] CPU hotplug using SMM with QEMU+OVMF

2019-08-23 Thread Michael D Kinney
Hi Jiewen,

If a hot add CPU needs to run any code before the
first SMI, I would recommend is only executes code
from a write protected FLASH range without a stack
and then wait for the first SMI.

For this OVMF use case, is any CPU init required
before the first SMI?

From Paolo's list of steps are steps (8a) and (8b) 
really required?  Can the SMI monarch use the Local
APIC to send a directed SMI to the hot added CPU?
The SMI monarch needs to know the APIC ID of the
hot added CPU.  Do we also need to handle the case
where multiple CPUs are added at once?  I think we
would need to serialize the use of 3000:8000 for the
SMM rebase operation on each hot added CPU.

It would be simpler if we can guarantee that only
one CPU can be added or removed at a time and the 
complete flow of adding a CPU to SMM and the OS
needs to be completed before another add/remove
event needs to be processed.

Mike

> -Original Message-
> From: Yao, Jiewen
> Sent: Thursday, August 22, 2019 10:00 PM
> To: Kinney, Michael D ;
> Paolo Bonzini ; Laszlo Ersek
> ; r...@edk2.groups.io
> Cc: Alex Williamson ;
> devel@edk2.groups.io; qemu devel list  de...@nongnu.org>; Igor Mammedov ;
> Chen, Yingwen ; Nakajima, Jun
> ; Boris Ostrovsky
> ; Joao Marcal Lemos Martins
> ; Phillip Goerl
> 
> Subject: RE: [edk2-rfc] [edk2-devel] CPU hotplug using
> SMM with QEMU+OVMF
> 
> Thank you Mike!
> 
> That is good reference on the real hardware behavior.
> (Glad it is public.)
> 
> For threat model, the unique part in virtual environment
> is temp RAM.
> The temp RAM in real platform is per CPU cache, while
> the temp RAM in virtual platform is global memory.
> That brings one more potential attack surface in virtual
> environment, if hot-added CPU need run code with stack
> or heap before SMI rebase.
> 
> Other threats, such as SMRAM or DMA, are same.
> 
> Thank you
> Yao Jiewen
> 
> 
> > -Original Message-
> > From: Kinney, Michael D
> > Sent: Friday, August 23, 2019 9:03 AM
> > To: Paolo Bonzini ; Laszlo Ersek
> > ; r...@edk2.groups.io; Yao, Jiewen
> > ; Kinney, Michael D
> 
> > Cc: Alex Williamson ;
> > devel@edk2.groups.io; qemu devel list  de...@nongnu.org>; Igor
> > Mammedov ; Chen, Yingwen
> > ; Nakajima, Jun
> ;
> > Boris Ostrovsky ; Joao
> Marcal Lemos
> > Martins ; Phillip Goerl
> > 
> > Subject: RE: [edk2-rfc] [edk2-devel] CPU hotplug using
> SMM with
> > QEMU+OVMF
> >
> > Paolo,
> >
> > I find the following links related to the discussions
> here along with
> > one example feature called GENPROTRANGE.
> >
> > https://csrc.nist.gov/CSRC/media/Presentations/The-
> Whole-is-Greater/im
> > a ges-media/day1_trusted-computing_200-250.pdf
> > https://cansecwest.com/slides/2017/CSW2017_Cuauhtemoc-
> Rene_CPU_Ho
> > t-Add_flow.pdf
> > https://www.mouser.com/ds/2/612/5520-5500-chipset-ioh-
> datasheet-1131
> > 292.pdf
> >
> > Best regards,
> >
> > Mike
> >
> > > -Original Message-
> > > From: Paolo Bonzini [mailto:pbonz...@redhat.com]
> > > Sent: Thursday, August 22, 2019 4:12 PM
> > > To: Kinney, Michael D ;
> Laszlo Ersek
> > > ; r...@edk2.groups.io; Yao, Jiewen
> > > 
> > > Cc: Alex Williamson ;
> > > devel@edk2.groups.io; qemu devel list  de...@nongnu.org>; Igor
> > > Mammedov ; Chen, Yingwen
> > > ; Nakajima, Jun
> ;
> > > Boris Ostrovsky ; Joao
> Marcal Lemos
> > > Martins ; Phillip Goerl
> > > 
> > > Subject: Re: [edk2-rfc] [edk2-devel] CPU hotplug
> using SMM with
> > > QEMU+OVMF
> > >
> > > On 23/08/19 00:32, Kinney, Michael D wrote:
> > > > Paolo,
> > > >
> > > > It is my understanding that real HW hot plug uses
> the
> > > SDM defined
> > > > methods.  Meaning the initial SMI is to 3000:8000
> and
> > > they rebase to
> > > > TSEG in the first SMI.  They must have chipset
> specific
> > > methods to
> > > > protect 3000:8000 from DMA.
> > >
> > > It would be great if you could check.
> > >
> > > > Can we add a chipset feature to prevent DMA to
> 64KB
> > > range from
> > > > 0x3-0x3 and the UEFI Memory Map and ACPI
> > > content can be
> > > > updated so the Guest OS knows to not use that
> range for
> > > DMA?
> > >
> > > If real hardware does it at the chipset level, we
> will probably use
> > > Igor's suggestion of aliasing A-seg to 3000:.
> Before starting
> > > the new CPU, the SMI handler can prepare the SMBASE
> relocation
> > > trampoline at
> > > A000:8000 and the hot-plugged CPU will find it at
> > > 3000:8000 when it receives the initial SMI.  Because
> this is backed
> > > by RAM at 0xA-0xA, DMA cannot access it and
> would still go
> > > through to RAM at 0x3.
> > >
> > > Paolo

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

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



Re: [edk2-rfc] [edk2-devel] CPU hotplug using SMM with QEMU+OVMF

2019-08-23 Thread Paolo Bonzini
On 22/08/19 22:06, Kinney, Michael D wrote:
> The SMBASE register is internal and cannot be directly accessed 
> by any CPU.  There is an SMBASE field that is member of the SMM Save
> State area and can only be modified from SMM and requires the
> execution of an RSM instruction from SMM for the SMBASE register to
> be updated from the current SMBASE field value.  The new SMBASE
> register value is only used on the next SMI.

Actually there is also an SMBASE MSR, even though in current silicon
it's read-only and its use is theoretically limited to SMM-transfer
monitors.  If that MSR could be made accessible somehow outside SMM,
that would be great.

> Once all the CPUs have been initialized for SMM, the CPUs that are not needed
> can be hot removed.  As noted above, the SMBASE value does not change on
> an INIT.  So as long as the hot add operation does not do a RESET, the
> SMBASE value must be preserved.

IIRC, hot-remove + hot-add will unplugs/plugs a completely different CPU.

> Another idea is to emulate this behavior.  If the hot plug controller
> provide registers (only accessible from SMM) to assign the SMBASE address
> for every CPU.  When a CPU is hot added, QEMU can set the internal SMBASE
> register value from the hot plug controller register value.  If the SMM
> Monarch sends an INIT or an SMI from the Local APIC to the hot added CPU,
> then the SMBASE register should not be modified and the CPU starts execution
> within TSEG the first time it receives an SMI.

Yes, this would work.  But again---if the issue is real on current
hardware too, I'd rather have a matching solution for virtual platforms.

If the current hardware for example remembers INIT-preserved across
hot-remove/hot-add, we could emulate that.

I guess the fundamental question is: how do bare metal platforms avoid
this issue, or plan to avoid this issue?  Once we know that, we can use
that information to find a way to implement it in KVM.  Only if it is
impossible we'll have a different strategy that is specific to our platform.

Paolo

> Jiewen and I can collect specific questions on this topic and continue
> the discussion here.  For example, I do not think there is any method
> other than what I referenced above to program the SMBASE register, but
> I can ask if there are any other methods.


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

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



Re: [edk2-rfc] [edk2-devel] CPU hotplug using SMM with QEMU+OVMF

2019-08-23 Thread Paolo Bonzini
On 23/08/19 00:32, Kinney, Michael D wrote:
> Paolo,
> 
> It is my understanding that real HW hot plug uses the SDM defined
> methods.  Meaning the initial SMI is to 3000:8000 and they rebase
> to TSEG in the first SMI.  They must have chipset specific methods
> to protect 3000:8000 from DMA.

It would be great if you could check.

> Can we add a chipset feature to prevent DMA to 64KB range from
> 0x3-0x3 and the UEFI Memory Map and ACPI content can be
> updated so the Guest OS knows to not use that range for DMA?

If real hardware does it at the chipset level, we will probably use
Igor's suggestion of aliasing A-seg to 3000:.  Before starting the
new CPU, the SMI handler can prepare the SMBASE relocation trampoline at
A000:8000 and the hot-plugged CPU will find it at 3000:8000 when it
receives the initial SMI.  Because this is backed by RAM at
0xA-0xA, DMA cannot access it and would still go through to RAM
at 0x3.

Paolo

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

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



Re: [edk2-rfc] [edk2-devel] CPU hotplug using SMM with QEMU+OVMF

2019-08-23 Thread Laszlo Ersek
On 08/22/19 20:51, Paolo Bonzini wrote:
> On 22/08/19 20:29, Laszlo Ersek wrote:
>> On 08/22/19 08:18, Paolo Bonzini wrote:
>>> On 21/08/19 22:17, Kinney, Michael D wrote:
 DMA protection of memory ranges is a chipset feature. For the current
 QEMU implementation, what ranges of memory are guaranteed to be
 protected from DMA?  Is it only A/B seg and TSEG?
>>>
>>> Yes.
>>
>> This thread (esp. Jiewen's and Mike's messages) are the first time that
>> I've heard about the *existence* of such RAM ranges / the chipset
>> feature. :)
>>
>> Out of interest (independently of virtualization), how is a general
>> purpose OS informed by the firmware, "never try to set up DMA to this
>> RAM area"? Is this communicated through ACPI _CRS perhaps?
>>
>> ... Ah, almost: ACPI 6.2 specifies _DMA, in "6.2.4 _DMA (Direct Memory
>> Access)". It writes,
>>
>> For example, if a platform implements a PCI bus that cannot access
>> all of physical memory, it has a _DMA object under that PCI bus that
>> describes the ranges of physical memory that can be accessed by
>> devices on that bus.
>>
>> Sorry about the digression, and also about being late to this thread,
>> continually -- I'm primarily following and learning.
> 
> It's much simpler: these ranges are not in e820, for example
> 
> kernel: BIOS-e820: [mem 0x00059000-0x0008bfff] usable
> kernel: BIOS-e820: [mem 0x0008c000-0x000f] reserved

(1) Sorry, my _DMA quote was a detour from QEMU -- I wondered how a
physical machine with actual RAM at 0x3, and also chipset level
protection against DMA to/from that RAM range, would expose the fact to
the OS (so that the OS not innocently try to set up DMA there).

(2) In case of QEMU+OVMF, "e820" is not defined at the firmware level.

While
- QEMU exports an "e820 map" (and OVMF does utilize that),
- and Linux parses the UEFI memmap into an "e820 map" (so that dependent
logic only need to deal with e820),

in edk2 the concepts are "GCD memory space map" and "UEFI memmap".

So what OVMF does is, it reserves the TSEG area in the UEFI memmap:

  https://github.com/tianocore/edk2/commit/b09c1c6f2569a

(This was later de-constified for the extended TSEG size, in commit
23bfb5c0aab6, "OvmfPkg/PlatformPei: prepare for PcdQ35TsegMbytes
becoming dynamic", 2017-07-05).

This is just to say that with OVMF, TSEG is not absent from the UEFI
memmap, it is reserved instead. (Apologies if I misunderstood and you
didn't actually claim otherwise.)


> The ranges are not special-cased in any way by QEMU.  Simply, AB-segs
> and TSEG RAM are not part of the address space except when in SMM.

(or when TSEG is not locked, and open; but:) yes, this matches my
understanding.

> Therefore, DMA to those ranges ends up respectively to low VGA RAM[1]
> and to the bit bucket.  When AB-segs are open, for example, DMA to that
> area becomes possible.

Which seems to imply that, if we alias 0x3 to the AB-segs, and rely
on the AB-segs for CPU hotplug, OVMF should close and lock down the
AB-segs at first boot. Correct? (Because OVMF doesn't do anything about
AB at the moment.)

Thanks
Laszlo

> 
> Paolo
> 
> [1] old timers may remember DEF SEG=: BLOAD "foo.img",0.  It still
> works with some disk device models.
> 


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

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



Re: [edk2-devel] [PATCH v1 19/19] MdePkg: Initialise VA_LIST variables before use

2019-08-23 Thread Liming Gao
Is this warning reported on ARM arch?

In Base.h, VA_START is defined as below for ARM arch. Do you mean VS2017 report 
the warning for below macro? 
If so, can you propose the change in VA_START macro to fix this warning, then 
doesn't need to update consumer source code. 

#define VA_START(Marker, Parameter) __va_start (, , 
_INT_SIZE_OF (Parameter), __alignof(Parameter), )

> -Original Message-
> From: Sami Mujawar [mailto:sami.muja...@arm.com]
> Sent: Friday, August 23, 2019 6:56 PM
> To: devel@edk2.groups.io
> Cc: Sami Mujawar ; alexei.fedo...@arm.com; 
> ard.biesheu...@linaro.org; leif.lindh...@linaro.org;
> matteo.carl...@arm.com; Kinney, Michael D ; Gao, 
> Liming ; n...@arm.com
> Subject: [PATCH v1 19/19] MdePkg: Initialise VA_LIST variables before use
> 
> The VS2017 compiler reports 'warning C6001: Using
> uninitialized memory 'Marker'.' for VA_LIST
> variables.
> 
> To fix this issue declare a VA_LIST global variable
> and use this to initialise VA_LIST variables before
> use.
> 
> Note: The VA_LIST cannot be assigned a NULL value
> because some compilers define VA_LIST to be a
> structure.
> 
> Signed-off-by: Sami Mujawar 
> ---
>  MdePkg/Library/BaseLib/SwitchStack.c   | 9 +
>  MdePkg/Library/BasePrintLib/PrintLib.c | 5 +
>  MdePkg/Library/BasePrintLib/PrintLibInternal.c | 9 +
>  3 files changed, 23 insertions(+)
> 
> diff --git a/MdePkg/Library/BaseLib/SwitchStack.c 
> b/MdePkg/Library/BaseLib/SwitchStack.c
> index 
> cb9f69f1eaceba690b48e9ca6b8a9af2e348bddd..e1bb524819b3de3521c5461ce681aa3a6c186f2c
>  100644
> --- a/MdePkg/Library/BaseLib/SwitchStack.c
> +++ b/MdePkg/Library/BaseLib/SwitchStack.c
> @@ -2,12 +2,20 @@
>Switch Stack functions.
> 
>Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
> +  Copyright (c) 2019, ARM Ltd. All rights reserved.
>SPDX-License-Identifier: BSD-2-Clause-Patent
> 
>  **/
> 
>  #include "BaseLibInternals.h"
> 
> +//
> +// Declare a VA_LIST global variable that is used to initialise VA_LIST
> +// variables before use. The VA_LIST cannot be assigned a NULL value
> +// because some compilers define VA_LIST to be a structure.
> +//
> +STATIC VA_LIST gNullVaList;
> +
>  /**
>Transfers control to a function starting with a new stack.
> 
> @@ -57,6 +65,7 @@ SwitchStack (
>//
>ASSERT (((UINTN)NewStack & (CPU_STACK_ALIGNMENT - 1)) == 0);
> 
> +  Marker = gNullVaList;
>VA_START (Marker, NewStack);
> 
>InternalSwitchStack (EntryPoint, Context1, Context2, NewStack, Marker);
> diff --git a/MdePkg/Library/BasePrintLib/PrintLib.c 
> b/MdePkg/Library/BasePrintLib/PrintLib.c
> index 
> af771652e4b0aebd616973ba1089ae5bc2b6f0c0..67c5f3dd547cea5447075ef88d697879883ba5ab
>  100644
> --- a/MdePkg/Library/BasePrintLib/PrintLib.c
> +++ b/MdePkg/Library/BasePrintLib/PrintLib.c
> @@ -3,6 +3,7 @@
> 
>Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
>Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
> +  Copyright (c) 2019, ARM Ltd. All rights reserved.
>SPDX-License-Identifier: BSD-2-Clause-Patent
> 
>  **/
> @@ -177,6 +178,7 @@ UnicodeSPrint (
>VA_LIST Marker;
>UINTN   NumberOfPrinted;
> 
> +  Marker = gNullVaList;
>VA_START (Marker, FormatString);
>NumberOfPrinted = UnicodeVSPrint (StartOfBuffer, BufferSize, FormatString, 
> Marker);
>VA_END (Marker);
> @@ -337,6 +339,7 @@ UnicodeSPrintAsciiFormat (
>VA_LIST Marker;
>UINTN   NumberOfPrinted;
> 
> +  Marker = gNullVaList;
>VA_START (Marker, FormatString);
>NumberOfPrinted = UnicodeVSPrintAsciiFormat (StartOfBuffer, BufferSize, 
> FormatString, Marker);
>VA_END (Marker);
> @@ -614,6 +617,7 @@ AsciiSPrint (
>VA_LIST Marker;
>UINTN   NumberOfPrinted;
> 
> +  Marker = gNullVaList;
>VA_START (Marker, FormatString);
>NumberOfPrinted = AsciiVSPrint (StartOfBuffer, BufferSize, FormatString, 
> Marker);
>VA_END (Marker);
> @@ -774,6 +778,7 @@ AsciiSPrintUnicodeFormat (
>VA_LIST Marker;
>UINTN   NumberOfPrinted;
> 
> +  Marker = gNullVaList;
>VA_START (Marker, FormatString);
>NumberOfPrinted = AsciiVSPrintUnicodeFormat (StartOfBuffer, BufferSize, 
> FormatString, Marker);
>VA_END (Marker);
> diff --git a/MdePkg/Library/BasePrintLib/PrintLibInternal.c 
> b/MdePkg/Library/BasePrintLib/PrintLibInternal.c
> index 
> b6ec5ac4fbb98982f8ccaf3908c2a91ce583e31e..11392f2a5d12eb059611c3ff77b27b602f9b9a40
>  100644
> --- a/MdePkg/Library/BasePrintLib/PrintLibInternal.c
> +++ b/MdePkg/Library/BasePrintLib/PrintLibInternal.c
> @@ -2,12 +2,20 @@
>Print Library internal worker functions.
> 
>Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
> +  Copyright (c) 2019, ARM Ltd. All rights reserved.
>SPDX-License-Identifier: BSD-2-Clause-Patent
> 
>  **/
> 
>  #include "PrintLibInternal.h"
> 
> +//
> +// Declare a VA_LIST global variable that is used to initialise VA_LIST
> +// variables before use. The VA_LIST 

Re: [edk2-devel] [RFC PATCH 01/28] OvmfPkg/Sec: Enable cache early to speed up booting

2019-08-23 Thread Laszlo Ersek
On 08/22/19 22:44, Jordan Justen wrote:
> On 2019-08-22 06:46:07, Laszlo Ersek wrote:
>> On 08/21/19 23:51, Jordan Justen wrote:
>>> On 2019-08-21 07:21:25, Laszlo Ersek wrote:
 On 08/19/19 23:35, Lendacky, Thomas wrote:
> From: Tom Lendacky 
>
> +  //
> +  // Enable caching
> +  //
> +  AsmEnableCache ();
> +
>DEBUG ((EFI_D_INFO,
>  "SecCoreStartupWithStack(0x%x, 0x%x)\n",
>  (UINT32)(UINTN)BootFv,
>

 This makes me uncomfortable. There used to be problems related to
 caching when VFIO device assignment were used. My concern is admittedly
 vague, but this is a very brittle area of OVMF-on-KVM. If you asked me
 "well what could break here", I'd answer "you never know, and the burden
 of proof is not on me". :) Can we make this change conditional on SEV-ES?
>>>
>>> This was also raised as an issue by Peter for the ACRN hypervisor and
>>> Scott for the bhyve hypervisor.
>>>
>>> I think it is rare for a platform to enable cache at this early of a
>>> stage, but it is also rare to decompress a firmware volume at this
>>> point.
>>>
>>> It appears that it could be helpful to figure out how to safely enable
>>> cache by default here, since it does seem to be impacting several
>>> hypervisors.
>>
>> I can't think of anything better than "trial and error".
> 
> Maybe we could try to detect kvm, and enable caching if !kvm.
> 
> Maybe we could enable it during the decompress of the PEI FV and
> disable it afterward?
> 
>> The issues that
>> used to pop up in the past, due to host kernel (KVM) changes,
>> particularly in connection with VFIO device assignment, have been
>> completely obscure and unpenetrable to me.
> 
> Don't we eventually enable caching during the boot, so how is VFIO not
> affected by that?
> 
>> Even though I've contributed
>> at least one KVM patch to mitigate those problems, they remain a mistery
>> to me, and I remain unable to *reason* about the problems or the fixes.
> 
> If VFIO requires uncached access, then what mechanisms does kvm
> support for accessing memory ranges uncached? I thought kvm simply
> ignored the cache setting and always enabled caching, because this
> section of boot is not particularly slow with kvm. But, if enabling
> caching causes issues, then I guess it does something.
> 
> Does kvm support mtrr to uncache i/o ranges? I didn't think kvm
> supported mtrrs in the past.
> 
> I hope we wouldn't have to use paging to disable caching for the
> affected regions.

All good questions, and I'm not equipped to answer them, unfortunately.
I'm happy to review and regression-test -- including GPU assignment, on
my workstation that's dedicated to that use case -- OvmfPkg patches, if
someone posts them.

This stuff is in constant flux in KVM. Recent example:

https://www.redhat.com/archives/vfio-users/2019-August/msg00016.html

Thanks
Laszlo


>> So I think we could only flip the behavior (enable cache by default) and
>> collect bug reports. But that's extremely annoying for end-users, and I
>> see "no regressions" as one of my top responsibilities.
>>
>> Even if we provided an fw_cfg knob to disable the change, using
>> QemuFwCfgSecLib, similarly to commit ab081a50e565 ("OvmfPkg:
>> PlatformPei: take no-exec DXE settings from the QEMU command line",
>> 2015-09-15), such fw_cfg knobs are difficult to use through layered
>> products, such as libvirt, proxmox, etc. And of course fw_cfg is only
>> available on QEMU.
>>
>> Laszlo


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

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



Re: [edk2-devel] [RFC PATCH 05/28] OvmfPkg: Create GHCB pages for use during Pei and Dxe phase

2019-08-23 Thread Laszlo Ersek
On 08/22/19 17:24, Lendacky, Thomas wrote:
> On 8/22/19 9:12 AM, Laszlo Ersek wrote:
>> On 08/21/19 23:42, Lendacky, Thomas wrote:
>>> On 8/21/19 9:31 AM, Laszlo Ersek wrote:
 On 08/19/19 23:35, Lendacky, Thomas wrote:
> From: Tom Lendacky 
>
> Allocate memory for the GHCB pages during SEV initialization for use
> during Pei and Dxe phases. Since the GHCB pages must be mapped as shared
> pages, modify CreateIdentityMappingPageTables() so that pagetable entries
> are created without the encryption bit set.
>
> Signed-off-by: Tom Lendacky 
> ---
>  UefiCpuPkg/UefiCpuPkg.dec |  4 ++
>  OvmfPkg/OvmfPkgX64.dsc|  4 ++
>  MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf   |  3 +
>  OvmfPkg/PlatformPei/PlatformPei.inf   |  2 +
>  .../Core/DxeIplPeim/X64/VirtualMemory.h   | 12 +++-
>  .../Core/DxeIplPeim/Ia32/DxeLoadFunc.c|  4 +-
>  .../Core/DxeIplPeim/X64/DxeLoadFunc.c | 11 +++-
>  .../Core/DxeIplPeim/X64/VirtualMemory.c   | 49 ++
>  .../MemEncryptSevLibInternal.c|  1 -
>  .../BaseMemEncryptSevLib/X64/VirtualMemory.c  | 33 --
>  OvmfPkg/PlatformPei/AmdSev.c  | 64 +++
>  11 files changed, 164 insertions(+), 23 deletions(-)

 Should be split to at least four patches (UefiCpuPkg, MdeModulePkg,
 OvmfPkg/BaseMemEncryptSevLib, OvmfPkg/PlatformPei).

 In addition, MdeModulePkg content must not depend on UefiCpuPkg content
 -- if modules under both packages need to consume a new PCD, then the
 PCD should be declared under MdeModulePkg. The rough dependency order is:

 - MdePkg (must be self-contained)
 - MdeModulePkg (may consume MdePkg)
 - UefiCpuPkg (may consume everything above, to my knowledge)
 - OvmfPkg (may consume everything above)

>>>
>>> Ok, thanks for the guidance.
>>>
>>> Ideally, I just would like to modify the newly created page tables after
>>> the call to CreateIdentityMappingPageTables() in MdeModulePkg/Core/
>>> DxeIplPeim/Ia32/DxeLoadFunc.c. Is there a preferred way to add a listener
>>> or callback or notification service so that the main changes would be
>>> limited to the OvmfPkg files and would that be acceptable?
>>
>> * https://bugzilla.tianocore.org/show_bug.cgi?id=623
>>
>>   Reported on 2017-07-07, resolved as WONTFIX on 2019-07-30 ("no
>>   resources").
>>
>>   And it's not like patches had not been proposed -- Leo had implemented
>>   a notification service --; they were rejected.
>>
>> * https://bugzilla.tianocore.org/show_bug.cgi?id=847
>>
>>   Reported on 2018-01-11, marked "not high priority" as of 2019-07-23
>>   .
>>
>> I don't know what to tell you. While nobody seems to disagree with the
>> necessity of such a service and/or library, core maintainers have
>> rejected all the code proposals thus far (= "don't do that"). And I'm
>> unaware of any constructive guidance (= "do this instead").
> 
> This isn't on the level of a "notify every time something changes" type
> of thing. This is more of a "hey, we built some new pagetables and are
> about to make them active, but before we do have a look and change what
> you think should be changed."
> 
> With that, I'd be able to remove the GhcbBase and GhcbSize that is
> propogated on the ToSplit and Split functions.
> 
> I'll take a look and see what it would look like and go from there.

Maybe not the same kind of notification pattern (and the event
triggering the notification could be different), but the point is the
same -- the platform would like the core to call it back at various
stages / points of page table manipulation. How we implement that, is
"details" (edk2-specific (and versioned) protocol, provided by the
platform and called by the core; versus separate event groups, signaled
by the core; versus custom lib class, implemented by the platform;
versus custom status codes reported by the core; etc). What's important
is for core maintainers to finally accept that the facility *as such* is
needed.

> 
>>
>> I suggest filing a Feature Request BZ for SEV-ES enablement (for
>> OvmfPkg), and referencing that as "dependent bug" in both of the
>> above-mentioned BZs. It might also help to dial in to the APAC/NAMO
>> design / bug triage meeting, and campaign for the feature there.
> 
> Yes, I need to file that Feature Request BZ anyway.

Thanks.
Laszlo

>>
>> https://github.com/tianocore/tianocore.github.io/wiki/Bug-Triage
>>
>> I have a bad track record at convincing core maintainers to do what they
>> don't want to do. And I see escalating such problems from email to phone
>> as a work-around, sort of "wear down your opponent by sheer
>> persistence". So I avoid that. But, I've seen the approach work for
>> others, so you might have better luck.
>>
>> (The APAC/NAMO call is also at a bad time for 

Re: [edk2-devel] [Patch] MdeModulePkg DxeCore: Fix for missing MAT update

2019-08-23 Thread Laszlo Ersek
On 08/22/19 16:52, Gao, Liming wrote:
>> -Original Message-
>> From: Laszlo Ersek [mailto:ler...@redhat.com]
>> Sent: Thursday, August 22, 2019 7:56 PM
>> To: Gao, Liming 
>> Cc: devel@edk2.groups.io; Kinney, Michael D ; 
>> Mike Turner ; Wang, Jian J
>> ; Wu, Hao A ; Bi, Dandan 
>> ; Anthony Perard
>> ; Justen, Jordan L 
>> Subject: Re: [edk2-devel] [Patch] MdeModulePkg DxeCore: Fix for missing MAT 
>> update

>> This is the current status:
>>
>> - OvmfXen:
>>   - runs in Xen HVM guests
>>   - runs in Xen PVH guests
>>
>> - traditional OVMF
>>   - runs in Xen HVM guests
>>   - runs in QEMU/KVM guests
>>
>> The desired (and agreed upon) end-status is the following:
>>
>> - OvmfXen:
>>   - runs in Xen HVM guests
>>   - runs in Xen PVH guests
>>
>> - traditional OVMF
>>   - runs in QEMU/KVM guests
>>
>> (This will match the platform separation that we have under ArmVirtPkg too.)
>>
>> Anthony plans to remove the Xen HVM code from traditional OVMF in a year
>> or so, if I understand correctly. That's when "traditional OVMF" will
>> become QEMU/KVM-only, completing the separation. And that's when I
>> expect we can fix TianoCore#386 for QEMU/KVM *only*, without Jordan
>> NACKing the patch set.
>>
> Ok. Is there BZ for this change? The contributor can propose his work 
> planning. 
> Then, I will update edk2 feature planning wiki.

I've now reported:

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

and assigned it to Anthony. (Anthony, I hope that's OK with you.)

>> Basically, "PcdMemVarstoreEmuEnable" would be constant TRUE in OvmfXen
>> (inherited from the OVMF DEC file), and it would be exposed to the
>> platform builder via "-D MEM_VARSTORE_EMU_ENABLE=FALSE" in the "OVMF for
>> QEMU/KVM" platform. FaultTolerantWritePei and VariablePei would be
>> included in the "OVMF for QEMU/KVM" DSC files only, and so on.
>>
> I think this design meets with the request BZ386. 

I've also reopened

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

now (moving it back to CONFIRMED state, from RESOLVED|WONTFIX), and I've
made it dependent on TianoCore#2122.

Thanks,
Laszlo

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

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



[edk2-devel] [edk2-platforms: PATCH v2 0/1] Platform/Rpi3: Add compatible property to the "usb" Device Tree node

2019-08-23 Thread Pete Batard
(v2 as the previous patch had a FreePool call missing).

The following patch adds automatic the insertion of "bcm,bcm2835-usb" into the
"usb" Device Tree node for the Raspberry Pi 3, if not already present.

In terms of DTS structure, this patch basically alters:
  compatible = "brcm,bcm2708-usb";
to:
  compatible = "brcm,bcm2708-usb", "brcm,bcm2835-usb";

The reason we require this is because the official DT published by the Raspberry
Pi Foundation (https://github.com/raspberrypi/firmware/tree/master/boot) only
lists "brcm,bcm2708-usb" as a compatible property, and some Linux kernels, such
as the one used by Debian, require "bcm,bcm2835-usb" to also be listed in order
to handle USB devices.

For instance, if you don't have "bcm,bcm2835-usb", you may find that the USB
keyboards are unresponsive with the Debian installer.

Also, once this patch has been applied, we should be able to replace the Device
Tree blobs we currently have in edk2-non-osi for the RPi3 platform (that have
been manually modified to have "bcm,bcm2835-usb") with the untouched ones from
the Raspberry Pi Foundation. I will therefore send a patch to that effect once
these changes have been merged.

Pete Batard (1):
  Platform/Rpi3: Add compatible property to the "usb" Device Tree node

 Platform/RaspberryPi/RPi3/Drivers/FdtDxe/FdtDxe.c | 75 
 1 file changed, 75 insertions(+)

-- 
2.21.0.windows.1


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

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



[edk2-devel] [edk2-platforms: PATCH v2 1/1] Platform/Rpi3: Add compatible property to the "usb" Device Tree node

2019-08-23 Thread Pete Batard
Some Linux kernels (e.g. Debian) require "bcm,bcm2835-usb" to be present in
the list of compatible properties for the "usb" node, else they are unable
to handle some USB devices.

This patch ensures that the compatible property is added if not present.

Signed-off-by: Pete Batard 
---
 Platform/RaspberryPi/RPi3/Drivers/FdtDxe/FdtDxe.c | 75 
 1 file changed, 75 insertions(+)

diff --git a/Platform/RaspberryPi/RPi3/Drivers/FdtDxe/FdtDxe.c 
b/Platform/RaspberryPi/RPi3/Drivers/FdtDxe/FdtDxe.c
index 45ffe2e394a2..eb8048930c30 100644
--- a/Platform/RaspberryPi/RPi3/Drivers/FdtDxe/FdtDxe.c
+++ b/Platform/RaspberryPi/RPi3/Drivers/FdtDxe/FdtDxe.c
@@ -135,6 +135,76 @@ UpdateMacAddress (
   return EFI_SUCCESS;
 }
 
+//
+// Add "bcm2835-usb" to the USB compatible property list, if not present.
+// Required because some Linux kernels can't handle USB devices otherwise.
+//
+STATIC
+EFI_STATUS
+AddUsbCompatibleProperty (
+  VOID
+  )
+{
+  CONST CHAR8   Prop[]= "brcm,bcm2708-usb";
+  CONST CHAR8   NewProp[] = "brcm,bcm2835-usb";
+  CONST CHAR8   *List;
+  CHAR8 *NewList;
+  INT32 ListSize;
+  INTN  Node;
+  INTN  Retval;
+
+  // Locate the node that the 'usb' alias refers to
+  Node = fdt_path_offset (mFdtImage, "usb");
+  if (Node < 0) {
+DEBUG ((DEBUG_ERROR, "%a: failed to locate 'usb' alias\n", __FUNCTION__));
+return EFI_NOT_FOUND;
+  }
+
+  // Get the property list. This is a list of NUL terminated strings.
+  List = fdt_getprop (mFdtImage, Node, "compatible", );
+  if (List == NULL) {
+DEBUG ((DEBUG_ERROR, "%a: failed to locate properties\n", __FUNCTION__));
+return EFI_NOT_FOUND;
+  }
+
+  // Check if the compatible value we plan to add is already present
+  if (fdt_stringlist_contains (List, ListSize, NewProp)) {
+DEBUG ((DEBUG_INFO, "%a: property '%a' is already set.\n",
+  __FUNCTION__, NewProp));
+return EFI_SUCCESS;
+  }
+
+  // Make sure the compatible device is what we expect
+  if (!fdt_stringlist_contains (List, ListSize, Prop)) {
+DEBUG ((DEBUG_ERROR, "%a: property '%a' is missing!\n",
+  __FUNCTION__, Prop));
+return EFI_NOT_FOUND;
+  }
+
+  // Add the new NUL terminated entry to our list
+  DEBUG ((DEBUG_INFO, "%a: adding '%a' to the properties\n",
+__FUNCTION__, NewProp));
+
+  NewList = AllocatePool (ListSize + sizeof (NewProp));
+  if (NewList == NULL) {
+DEBUG ((DEBUG_ERROR, "%a: failed to allocate memory\n", __FUNCTION__));
+return EFI_OUT_OF_RESOURCES;;
+  }
+  CopyMem (NewList, List, ListSize);
+  CopyMem ([ListSize], NewProp, sizeof (NewProp));
+
+  Retval = fdt_setprop (mFdtImage, Node, "compatible", NewList,
+ ListSize + sizeof (NewProp));
+  FreePool (NewList);
+  if (Retval != 0) {
+DEBUG ((DEBUG_ERROR, "%a: failed to update properties (%d)\n",
+  __FUNCTION__, Retval));
+return EFI_NOT_FOUND;
+  }
+
+  return EFI_SUCCESS;
+}
+
 STATIC
 EFI_STATUS
 CleanMemoryNodes (
@@ -486,6 +556,11 @@ FdtDxeInitialize (
 Print (L"Failed to update MAC address: %r\n", Status);
   }
 
+  Status = AddUsbCompatibleProperty ();
+  if (EFI_ERROR (Status)) {
+Print (L"Failed to update USB compatible properties: %r\n", Status);
+  }
+
   if (Internal) {
 /*
  * A GPU-provided DTB already has the full command line.
-- 
2.21.0.windows.1


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

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



[edk2-devel] [edk2-platforms: PATCH 1/1] Platform/Rpi3: Add compatible property to the "usb" Device Tree node

2019-08-23 Thread Pete Batard
Some Linux kernels (e.g. Debian) require "bcm,bcm2835-usb" to be present in
the list of compatible properties for the "usb" node, else they are unable
to handle some USB devices.

This patch ensures that the compatible property is added if not present.

Signed-off-by: Pete Batard 
---
 Platform/RaspberryPi/RPi3/Drivers/FdtDxe/FdtDxe.c | 74 
 1 file changed, 74 insertions(+)

diff --git a/Platform/RaspberryPi/RPi3/Drivers/FdtDxe/FdtDxe.c 
b/Platform/RaspberryPi/RPi3/Drivers/FdtDxe/FdtDxe.c
index 45ffe2e394a2..399a48430457 100644
--- a/Platform/RaspberryPi/RPi3/Drivers/FdtDxe/FdtDxe.c
+++ b/Platform/RaspberryPi/RPi3/Drivers/FdtDxe/FdtDxe.c
@@ -135,6 +135,75 @@ UpdateMacAddress (
   return EFI_SUCCESS;
 }
 
+//
+// Add "bcm2835-usb" to the USB compatible property list, if not present.
+// Required because some Linux kernels can't handle USB devices otherwise.
+//
+STATIC
+EFI_STATUS
+AddUsbCompatibleProperty (
+  VOID
+  )
+{
+  CONST CHAR8   Prop[]= "brcm,bcm2708-usb";
+  CONST CHAR8   NewProp[] = "brcm,bcm2835-usb";
+  CONST CHAR8   *List;
+  CHAR8 *NewList;
+  INT32 ListSize;
+  INTN  Node;
+  INTN  Retval;
+
+  // Locate the node that the 'usb' alias refers to
+  Node = fdt_path_offset (mFdtImage, "usb");
+  if (Node < 0) {
+DEBUG ((DEBUG_ERROR, "%a: failed to locate 'usb' alias\n", __FUNCTION__));
+return EFI_NOT_FOUND;
+  }
+
+  // Get the property list. This is a list of NUL terminated strings.
+  List = fdt_getprop (mFdtImage, Node, "compatible", );
+  if (List == NULL) {
+DEBUG ((DEBUG_ERROR, "%a: failed to locate properties\n", __FUNCTION__));
+return EFI_NOT_FOUND;
+  }
+
+  // Check if the compatible value we plan to add is already present
+  if (fdt_stringlist_contains (List, ListSize, NewProp)) {
+DEBUG ((DEBUG_INFO, "%a: property '%a' is already set.\n",
+  __FUNCTION__, NewProp));
+return EFI_SUCCESS;
+  }
+
+  // Make sure the compatible device is what we expect
+  if (!fdt_stringlist_contains (List, ListSize, Prop)) {
+DEBUG ((DEBUG_ERROR, "%a: property '%a' is missing!\n",
+  __FUNCTION__, Prop));
+return EFI_NOT_FOUND;
+  }
+
+  // Add the new NUL terminated entry to our list
+  DEBUG ((DEBUG_INFO, "%a: adding '%a' to the properties\n",
+__FUNCTION__, NewProp));
+
+  NewList = AllocatePool (ListSize + sizeof (NewProp));
+  if (NewList == NULL) {
+DEBUG ((DEBUG_ERROR, "%a: failed to allocate memory\n", __FUNCTION__));
+return EFI_OUT_OF_RESOURCES;;
+  }
+  CopyMem (NewList, List, ListSize);
+  CopyMem ([ListSize], NewProp, sizeof (NewProp));
+
+  Retval = fdt_setprop (mFdtImage, Node, "compatible", NewList,
+ ListSize + sizeof (NewProp));
+  if (Retval != 0) {
+DEBUG ((DEBUG_ERROR, "%a: failed to update properties (%d)\n",
+  __FUNCTION__, Retval));
+return EFI_NOT_FOUND;
+  }
+
+  return EFI_SUCCESS;
+}
+
 STATIC
 EFI_STATUS
 CleanMemoryNodes (
@@ -486,6 +555,11 @@ FdtDxeInitialize (
 Print (L"Failed to update MAC address: %r\n", Status);
   }
 
+  Status = AddUsbCompatibleProperty ();
+  if (EFI_ERROR (Status)) {
+Print (L"Failed to update USB compatible properties: %r\n", Status);
+  }
+
   if (Internal) {
 /*
  * A GPU-provided DTB already has the full command line.
-- 
2.21.0.windows.1


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

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



[edk2-devel] [edk2-platforms: PATCH 0/1] Platform/Rpi3: Add compatible property to the "usb" Device Tree node

2019-08-23 Thread Pete Batard
The following patch adds automatic the insertion of "bcm,bcm2835-usb" into the
"usb" Device Tree node for the Raspberry Pi 3, if not already present.

In terms of DTS structure, this patch basically alters:
  compatible = "brcm,bcm2708-usb";
to:
  compatible = "brcm,bcm2708-usb", "brcm,bcm2835-usb";

The reason we require this is because the official DT published by the Raspberry
Pi Foundation (https://github.com/raspberrypi/firmware/tree/master/boot) only
lists "brcm,bcm2708-usb" as a compatible property, and some Linux kernels, such
as the one used by Debian, require "bcm,bcm2835-usb" to also be listed in order
to handle USB devices.

For instance, if you don't have "bcm,bcm2835-usb", you may find that the USB
keyboards are unresponsive with the Debian installer.

Also, once this patch has been applied, we should be able to replace the Device
Tree blobs we currently have in edk2-non-osi for the RPi3 platform (that have
been manually modified to have "bcm,bcm2835-usb") with the untouched ones from
the Raspberry Pi Foundation. I will therefore send a patch to that effect once
these changes have been merged.

Pete Batard (1):
  Platform/Rpi3: Add compatible property to the "usb" Device Tree node

 Platform/RaspberryPi/RPi3/Drivers/FdtDxe/FdtDxe.c | 74 
 1 file changed, 74 insertions(+)

-- 
2.21.0.windows.1


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

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



Re: [edk2-devel] [PATCH v1 09/19] DynamicTablesPkg: Fix unaligned pointers usage

2019-08-23 Thread Alexei Fedorov
Reviewed-by: Alexei Fedorov 


Alexei


From: Sami Mujawar 
Sent: 23 August 2019 11:55
To: devel@edk2.groups.io 
Cc: Sami Mujawar ; Alexei Fedorov 
; leif.lindh...@linaro.org ; 
Matteo Carlini ; nd 
Subject: [PATCH v1 09/19] DynamicTablesPkg: Fix unaligned pointers usage

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 
---
 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,
  ,
- >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,
  ,
- >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,
  ,
- >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 
6a0fdd08e1533c57285f42086314c70a5ed5..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
   UINT32ProcTopologyStructCount;
+  /// Count of Processor Hierarchy Nodes
+  UINT32ProcHierarchyNodeCount;
+  /// Count of Cache Structures
+  UINT32CacheStructCount;
+  /// Count of Id Structures
+  UINT32IdStructCount;
   /// 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
-  UINT32ProcHierarchyNodeCount;
-  /// Count of Cache 

Re: [edk2-devel] [PATCH v1 08/19] DynamicTablesPkg: Fix ACPI table rev field width

2019-08-23 Thread Alexei Fedorov
Reviewed-by: Alexei Fedorov 


Alexei


From: Sami Mujawar 
Sent: 23 August 2019 11:55
To: devel@edk2.groups.io 
Cc: Sami Mujawar ; Alexei Fedorov 
; leif.lindh...@linaro.org ; 
Matteo Carlini ; nd 
Subject: [PATCH v1 08/19] DynamicTablesPkg: Fix ACPI table rev field width

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 
---
 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 
7d6d3442276db7b4abaeb3b053ba489258adea0b..d7a1209c4d40c2e6ffb3dac786c276a30d70b6df
 100644
--- a/DynamicTablesPkg/Include/AcpiTableGenerator.h
+++ b/DynamicTablesPkg/Include/AcpiTableGenerator.h
@@ -284,10 +284,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_IDTableGeneratorId;
--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'


IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium. Thank you.

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

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



Re: [edk2-devel] [PATCH v1 11/19] DynamicTablesPkg: Remove redundant frame count check

2019-08-23 Thread Alexei Fedorov
Reviewed-by: Alexei Fedorov 


Alexei


From: Sami Mujawar 
Sent: 23 August 2019 11:55
To: devel@edk2.groups.io 
Cc: Sami Mujawar ; Alexei Fedorov 
; leif.lindh...@linaro.org ; 
Matteo Carlini ; nd 
Subject: [PATCH v1 11/19] DynamicTablesPkg: Remove redundant frame count check

Removing GT Block frame count check from AddGTBlockTimerFrames()
as this is already validated in BuildGtdtTable().

Signed-off-by: Sami Mujawar 
---
 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)'


IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium. Thank you.

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

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



Re: [edk2-devel] [PATCH v1 06/19] DynamicTablesPkg: Fix GT Block length assignment

2019-08-23 Thread Alexei Fedorov
Reviewed-by: Alexei Fedorov 


Alexei


From: devel@edk2.groups.io  on behalf of Sami Mujawar via 
Groups.Io 
Sent: 23 August 2019 11:55
To: devel@edk2.groups.io 
Cc: Sami Mujawar ; ard.biesheu...@linaro.org 
; leif.lindh...@linaro.org 
; Matteo Carlini ; Stephanie 
Hughes-Fitt ; nd 
Subject: [edk2-devel] [PATCH v1 06/19] DynamicTablesPkg: Fix GT Block length 
assignment

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 
---
 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;
   UINT32GTBlockTimerFrameCount;
+  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)'





IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium. Thank you.

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

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



Re: [edk2-devel] [PATCH v1 02/19] DynamicTablesPkg: Fix missing local header warning

2019-08-23 Thread Alexei Fedorov
Reviewed-by: Alexei Fedorov 


Alexei


From: devel@edk2.groups.io  on behalf of Sami Mujawar via 
Groups.Io 
Sent: 23 August 2019 11:55
To: devel@edk2.groups.io 
Cc: Sami Mujawar ; ard.biesheu...@linaro.org 
; leif.lindh...@linaro.org 
; Matteo Carlini ; Stephanie 
Hughes-Fitt ; nd 
Subject: [edk2-devel] [PATCH v1 02/19] DynamicTablesPkg: Fix missing local 
header warning

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 
---
 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)'





IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium. Thank you.

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

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



Re: [edk2-devel] [PATCH v1 03/19] DynamicTablesPkg: Remove struct CM_ARM_CPU_INFO

2019-08-23 Thread Alexei Fedorov
Reviewed-by: Alexei Fedorov 


Alexei


From: devel@edk2.groups.io  on behalf of Sami Mujawar via 
Groups.Io 
Sent: 23 August 2019 11:55
To: devel@edk2.groups.io 
Cc: Sami Mujawar ; ard.biesheu...@linaro.org 
; leif.lindh...@linaro.org 
; Matteo Carlini ; Stephanie 
Hughes-Fitt ; nd 
Subject: [edk2-devel] [PATCH v1 03/19] DynamicTablesPkg: Remove struct 
CM_ARM_CPU_INFO

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 
---
 DynamicTablesPkg/Include/ArmNameSpaceObjects.h | 4 
 1 file changed, 4 deletions(-)

diff --git a/DynamicTablesPkg/Include/ArmNameSpaceObjects.h 
b/DynamicTablesPkg/Include/ArmNameSpaceObjects.h
index 
ac451b306dfd7ba299a83209675b21696be235be..f08b8257678c8b6aacc863bbe1db09587b51a291
 100644
--- a/DynamicTablesPkg/Include/ArmNameSpaceObjects.h
+++ b/DynamicTablesPkg/Include/ArmNameSpaceObjects.h
@@ -67,10 +67,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)'





IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium. Thank you.

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

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



Re: [edk2-devel] [PATCH v1 15/19] DynamicTablesPkg: Remove erroneous use of EFIAPI

2019-08-23 Thread Alexei Fedorov
Reviewed-by: Alexei Fedorov 


Alexei


From: Sami Mujawar 
Sent: 23 August 2019 11:55
To: devel@edk2.groups.io 
Cc: Sami Mujawar ; Alexei Fedorov 
; leif.lindh...@linaro.org ; 
Matteo Carlini ; nd 
Subject: [PATCH v1 15/19] DynamicTablesPkg: Remove erroneous use of EFIAPI

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 
---
 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)'


IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium. Thank you.

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

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



Re: [edk2-devel] [PATCH v1 16/19] DynamicTablesPkg: Option for VS2017 static code analysis

2019-08-23 Thread Alexei Fedorov
Reviewed-by: Alexei Fedorov 


Alexei


From: Sami Mujawar 
Sent: 23 August 2019 11:55
To: devel@edk2.groups.io 
Cc: Sami Mujawar ; Alexei Fedorov 
; leif.lindh...@linaro.org ; 
Matteo Carlini ; nd 
Subject: [PATCH v1 16/19] DynamicTablesPkg: Option for VS2017 static code 
analysis

Add build option STATIC_ANALYSIS to enable VS2017 static
code analysis.

Signed-off-by: Sami Mujawar 
---
 DynamicTablesPkg/DynamicTablesPkg.dsc | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

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

@@ -39,3 +39,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)'


IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium. Thank you.

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

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



Re: [edk2-devel] [PATCH v1 14/19] DynamicTablesPkg: PPTT: Fix uninitialized memory usage

2019-08-23 Thread Alexei Fedorov
Reviewed-by: Alexei Fedorov 


Alexei


From: Sami Mujawar 
Sent: 23 August 2019 11:55
To: devel@edk2.groups.io 
Cc: Sami Mujawar ; Alexei Fedorov 
; leif.lindh...@linaro.org ; 
Matteo Carlini ; nd 
Subject: [PATCH v1 14/19] DynamicTablesPkg: PPTT: Fix uninitialized memory usage

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

);
+
+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,

);
+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,

);
+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)'


IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium. Thank you.

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

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



Re: [edk2-devel] [PATCH v1 18/19] ArmPlatformPkg: Fix comparison of constants warning

2019-08-23 Thread Alexei Fedorov
Reviewed-by: Alexei Fedorov 


Alexei


From: Sami Mujawar 
Sent: 23 August 2019 11:55
To: devel@edk2.groups.io 
Cc: Sami Mujawar ; Alexei Fedorov 
; ard.biesheu...@linaro.org 
; leif.lindh...@linaro.org 
; Matteo Carlini ; nd 

Subject: [PATCH v1 18/19] ArmPlatformPkg: Fix comparison of constants warning

The VS2017 compiler reports 'warning C6326: potential
comparison of a constant with another constant' when
a fixed PCD value is compared with a constant value.

The faulting code is as marked by '-->' below:

--> if (FixedPcdGet32 (PL011UartInteger) != 0) {
  Integer = FixedPcdGet32 (PL011UartInteger);
  Fractional = FixedPcdGet32 (PL011UartFractional);
} else {
...

The macro FixedPcdGet32 (PL011UartInteger) evaluates
to a macro _PCD_VALUE_PL011UartInteger that is defined
by the build system to represent the UART Integer
value. Therefore, the VS2017 compiler reports the above
warning.

Fix this warning by enclosing the code in appropriate
 #if .. #else .. #endif directives.

Signed-off-by: Sami Mujawar 
---
 ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.c 
b/ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.c
index 
2d3c279cce49304959953ec4a34b50e09a7d0045..dabf099b9bc82e1fb1bd5a2eae3fa4b5878a9e07
 100644
--- a/ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.c
+++ b/ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.c
@@ -174,10 +174,10 @@ PL011UartInitializePort (
   //

   // If PL011 Integer value has been defined then always ignore the BAUD rate
-  if (FixedPcdGet32 (PL011UartInteger) != 0) {
+#if (FixedPcdGet32 (PL011UartInteger) != 0)
 Integer = FixedPcdGet32 (PL011UartInteger);
 Fractional = FixedPcdGet32 (PL011UartFractional);
-  } else {
+#else
 // If BAUD rate is zero then replace it with the system default value
 if (*BaudRate == 0) {
   *BaudRate = FixedPcdGet32 (PcdSerialBaudRate);
@@ -197,7 +197,7 @@ PL011UartInitializePort (
 Divisor = (UINT32)DivisorValue;
 Integer = Divisor >> FRACTION_PART_SIZE_IN_BITS;
 Fractional = Divisor & FRACTION_PART_MASK;
-  }
+#endif

   //
   // If PL011 is already initialized, check the current settings
--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'


IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium. Thank you.

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

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



Re: [edk2-devel] [PATCH v1 17/19] ArmPlatformPkg: Fix UART divisor warning

2019-08-23 Thread Alexei Fedorov
Reviewed-by: Alexei Fedorov 


Alexei


From: Sami Mujawar 
Sent: 23 August 2019 11:55
To: devel@edk2.groups.io 
Cc: Sami Mujawar ; Alexei Fedorov 
; ard.biesheu...@linaro.org 
; leif.lindh...@linaro.org 
; Matteo Carlini ; nd 

Subject: [PATCH v1 17/19] ArmPlatformPkg: Fix UART divisor warning

The VS2017 compiler reports 'warning C4244: '=': conversion
from 'UINT64' to 'UINT32', possible loss of data' for the
calculation of the UART Divisor value.

Fix this warning by adding appropriate typecast and a validation
that ensures that the UART divisor value generated does not exceed
MAX_UINT32.

Signed-off-by: Sami Mujawar 
---
 ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.c | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.c 
b/ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.c
index 
801990d9551a638c17d560d4226137b8a3ee47bb..2d3c279cce49304959953ec4a34b50e09a7d0045
 100644
--- a/ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.c
+++ b/ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.c
@@ -2,7 +2,7 @@
   Serial I/O Port library functions with no library constructor/destructor

   Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.
-  Copyright (c) 2011 - 2016, ARM Ltd. All rights reserved.
+  Copyright (c) 2011 - 2019, ARM Ltd. All rights reserved.

   SPDX-License-Identifier: BSD-2-Clause-Patent

@@ -78,6 +78,7 @@ PL011UartInitializePort (
   UINT32  Integer;
   UINT32  Fractional;
   UINT32  HardwareFifoDepth;
+  UINT64  DivisorValue;

   HardwareFifoDepth = (PL011_UARTPID2_VER (MmioRead32 (UartBase + UARTPID2)) \
> PL011_VER_R1P4) \
@@ -188,7 +189,12 @@ PL011UartInitializePort (
   return RETURN_INVALID_PARAMETER;
 }

-Divisor = (UartClkInHz * 4) / *BaudRate;
+DivisorValue = (((UINT64)UartClkInHz * 4) / *BaudRate);
+if (DivisorValue > MAX_UINT32) {
+  return RETURN_INVALID_PARAMETER;
+}
+
+Divisor = (UINT32)DivisorValue;
 Integer = Divisor >> FRACTION_PART_SIZE_IN_BITS;
 Fractional = Divisor & FRACTION_PART_MASK;
   }
--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'


IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium. Thank you.

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

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



Re: [edk2-devel] [PATCH v1 19/19] MdePkg: Initialise VA_LIST variables before use

2019-08-23 Thread Alexei Fedorov
Reviewed-by: Alexei Fedorov 


Alexei


From: Sami Mujawar 
Sent: 23 August 2019 11:55
To: devel@edk2.groups.io 
Cc: Sami Mujawar ; Alexei Fedorov 
; ard.biesheu...@linaro.org 
; leif.lindh...@linaro.org 
; Matteo Carlini ; 
michael.d.kin...@intel.com ; liming@intel.com 
; nd 
Subject: [PATCH v1 19/19] MdePkg: Initialise VA_LIST variables before use

The VS2017 compiler reports 'warning C6001: Using
uninitialized memory 'Marker'.' for VA_LIST
variables.

To fix this issue declare a VA_LIST global variable
and use this to initialise VA_LIST variables before
use.

Note: The VA_LIST cannot be assigned a NULL value
because some compilers define VA_LIST to be a
structure.

Signed-off-by: Sami Mujawar 
---
 MdePkg/Library/BaseLib/SwitchStack.c   | 9 +
 MdePkg/Library/BasePrintLib/PrintLib.c | 5 +
 MdePkg/Library/BasePrintLib/PrintLibInternal.c | 9 +
 3 files changed, 23 insertions(+)

diff --git a/MdePkg/Library/BaseLib/SwitchStack.c 
b/MdePkg/Library/BaseLib/SwitchStack.c
index 
cb9f69f1eaceba690b48e9ca6b8a9af2e348bddd..e1bb524819b3de3521c5461ce681aa3a6c186f2c
 100644
--- a/MdePkg/Library/BaseLib/SwitchStack.c
+++ b/MdePkg/Library/BaseLib/SwitchStack.c
@@ -2,12 +2,20 @@
   Switch Stack functions.

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

 **/

 #include "BaseLibInternals.h"

+//
+// Declare a VA_LIST global variable that is used to initialise VA_LIST
+// variables before use. The VA_LIST cannot be assigned a NULL value
+// because some compilers define VA_LIST to be a structure.
+//
+STATIC VA_LIST gNullVaList;
+
 /**
   Transfers control to a function starting with a new stack.

@@ -57,6 +65,7 @@ SwitchStack (
   //
   ASSERT (((UINTN)NewStack & (CPU_STACK_ALIGNMENT - 1)) == 0);

+  Marker = gNullVaList;
   VA_START (Marker, NewStack);

   InternalSwitchStack (EntryPoint, Context1, Context2, NewStack, Marker);
diff --git a/MdePkg/Library/BasePrintLib/PrintLib.c 
b/MdePkg/Library/BasePrintLib/PrintLib.c
index 
af771652e4b0aebd616973ba1089ae5bc2b6f0c0..67c5f3dd547cea5447075ef88d697879883ba5ab
 100644
--- a/MdePkg/Library/BasePrintLib/PrintLib.c
+++ b/MdePkg/Library/BasePrintLib/PrintLib.c
@@ -3,6 +3,7 @@

   Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
   Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
+  Copyright (c) 2019, ARM Ltd. All rights reserved.
   SPDX-License-Identifier: BSD-2-Clause-Patent

 **/
@@ -177,6 +178,7 @@ UnicodeSPrint (
   VA_LIST Marker;
   UINTN   NumberOfPrinted;

+  Marker = gNullVaList;
   VA_START (Marker, FormatString);
   NumberOfPrinted = UnicodeVSPrint (StartOfBuffer, BufferSize, FormatString, 
Marker);
   VA_END (Marker);
@@ -337,6 +339,7 @@ UnicodeSPrintAsciiFormat (
   VA_LIST Marker;
   UINTN   NumberOfPrinted;

+  Marker = gNullVaList;
   VA_START (Marker, FormatString);
   NumberOfPrinted = UnicodeVSPrintAsciiFormat (StartOfBuffer, BufferSize, 
FormatString, Marker);
   VA_END (Marker);
@@ -614,6 +617,7 @@ AsciiSPrint (
   VA_LIST Marker;
   UINTN   NumberOfPrinted;

+  Marker = gNullVaList;
   VA_START (Marker, FormatString);
   NumberOfPrinted = AsciiVSPrint (StartOfBuffer, BufferSize, FormatString, 
Marker);
   VA_END (Marker);
@@ -774,6 +778,7 @@ AsciiSPrintUnicodeFormat (
   VA_LIST Marker;
   UINTN   NumberOfPrinted;

+  Marker = gNullVaList;
   VA_START (Marker, FormatString);
   NumberOfPrinted = AsciiVSPrintUnicodeFormat (StartOfBuffer, BufferSize, 
FormatString, Marker);
   VA_END (Marker);
diff --git a/MdePkg/Library/BasePrintLib/PrintLibInternal.c 
b/MdePkg/Library/BasePrintLib/PrintLibInternal.c
index 
b6ec5ac4fbb98982f8ccaf3908c2a91ce583e31e..11392f2a5d12eb059611c3ff77b27b602f9b9a40
 100644
--- a/MdePkg/Library/BasePrintLib/PrintLibInternal.c
+++ b/MdePkg/Library/BasePrintLib/PrintLibInternal.c
@@ -2,12 +2,20 @@
   Print Library internal worker functions.

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

 **/

 #include "PrintLibInternal.h"

+//
+// Declare a VA_LIST global variable that is used to initialise VA_LIST
+// variables before use. The VA_LIST cannot be assigned a NULL value
+// because some compilers define VA_LIST to be a structure.
+//
+extern VA_LIST gNullVaList;
+
 #define WARNING_STATUS_NUMBER 5
 #define ERROR_STATUS_NUMBER   33

@@ -1256,6 +1264,7 @@ BasePrintLibSPrint (
   VA_LIST  Marker;
   UINTNNumberOfPrinted;

+  Marker = gNullVaList;
   VA_START (Marker, FormatString);
   NumberOfPrinted = BasePrintLibSPrintMarker (StartOfBuffer, BufferSize, 
Flags, FormatString, Marker, NULL);
   VA_END (Marker);
--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'


IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be 

Re: [edk2-devel] [PATCH v1 01/19] DynamicTablesPkg: Fix entry point param definition

2019-08-23 Thread Alexei Fedorov
Reviewed-by: Alexei Fedorov 


Alexei


From: Sami Mujawar 
Sent: 23 August 2019 11:55
To: devel@edk2.groups.io 
Cc: Sami Mujawar ; Alexei Fedorov 
; leif.lindh...@linaro.org ; 
Matteo Carlini ; nd 
Subject: [PATCH v1 01/19] DynamicTablesPkg: Fix entry point param definition

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 
---
 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_HANDLEImageHandle,
+  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_HANDLEImageHandle,
+  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_HANDLEImageHandle,
-  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_HANDLEImageHandle,
-  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 
e9e4991dc127abb97f859436df0c4ceafdb3f5ec..6cb60e898f697ce4347ad3adeb5bca1cc1f30a0c
 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
 

Re: [edk2-devel] [PATCH v1 05/19] DynamicTablesPkg: Fix Proc node length assignment

2019-08-23 Thread Alexei Fedorov
Reviewed-by: Alexei Fedorov 

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

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



[edk2-devel] [PATCH v1 17/19] ArmPlatformPkg: Fix UART divisor warning

2019-08-23 Thread Sami Mujawar
The VS2017 compiler reports 'warning C4244: '=': conversion
from 'UINT64' to 'UINT32', possible loss of data' for the
calculation of the UART Divisor value.

Fix this warning by adding appropriate typecast and a validation
that ensures that the UART divisor value generated does not exceed
MAX_UINT32.

Signed-off-by: Sami Mujawar 
---
 ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.c | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.c 
b/ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.c
index 
801990d9551a638c17d560d4226137b8a3ee47bb..2d3c279cce49304959953ec4a34b50e09a7d0045
 100644
--- a/ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.c
+++ b/ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.c
@@ -2,7 +2,7 @@
   Serial I/O Port library functions with no library constructor/destructor
 
   Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.
-  Copyright (c) 2011 - 2016, ARM Ltd. All rights reserved.
+  Copyright (c) 2011 - 2019, ARM Ltd. All rights reserved.
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -78,6 +78,7 @@ PL011UartInitializePort (
   UINT32  Integer;
   UINT32  Fractional;
   UINT32  HardwareFifoDepth;
+  UINT64  DivisorValue;
 
   HardwareFifoDepth = (PL011_UARTPID2_VER (MmioRead32 (UartBase + UARTPID2)) \
> PL011_VER_R1P4) \
@@ -188,7 +189,12 @@ PL011UartInitializePort (
   return RETURN_INVALID_PARAMETER;
 }
 
-Divisor = (UartClkInHz * 4) / *BaudRate;
+DivisorValue = (((UINT64)UartClkInHz * 4) / *BaudRate);
+if (DivisorValue > MAX_UINT32) {
+  return RETURN_INVALID_PARAMETER;
+}
+
+Divisor = (UINT32)DivisorValue;
 Integer = Divisor >> FRACTION_PART_SIZE_IN_BITS;
 Fractional = Divisor & FRACTION_PART_MASK;
   }
-- 
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'



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

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



[edk2-devel] [PATCH v1 19/19] MdePkg: Initialise VA_LIST variables before use

2019-08-23 Thread Sami Mujawar
The VS2017 compiler reports 'warning C6001: Using
uninitialized memory 'Marker'.' for VA_LIST
variables.

To fix this issue declare a VA_LIST global variable
and use this to initialise VA_LIST variables before
use.

Note: The VA_LIST cannot be assigned a NULL value
because some compilers define VA_LIST to be a
structure.

Signed-off-by: Sami Mujawar 
---
 MdePkg/Library/BaseLib/SwitchStack.c   | 9 +
 MdePkg/Library/BasePrintLib/PrintLib.c | 5 +
 MdePkg/Library/BasePrintLib/PrintLibInternal.c | 9 +
 3 files changed, 23 insertions(+)

diff --git a/MdePkg/Library/BaseLib/SwitchStack.c 
b/MdePkg/Library/BaseLib/SwitchStack.c
index 
cb9f69f1eaceba690b48e9ca6b8a9af2e348bddd..e1bb524819b3de3521c5461ce681aa3a6c186f2c
 100644
--- a/MdePkg/Library/BaseLib/SwitchStack.c
+++ b/MdePkg/Library/BaseLib/SwitchStack.c
@@ -2,12 +2,20 @@
   Switch Stack functions.
 
   Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+  Copyright (c) 2019, ARM Ltd. All rights reserved.
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
 
 #include "BaseLibInternals.h"
 
+//
+// Declare a VA_LIST global variable that is used to initialise VA_LIST
+// variables before use. The VA_LIST cannot be assigned a NULL value
+// because some compilers define VA_LIST to be a structure.
+//
+STATIC VA_LIST gNullVaList;
+
 /**
   Transfers control to a function starting with a new stack.
 
@@ -57,6 +65,7 @@ SwitchStack (
   //
   ASSERT (((UINTN)NewStack & (CPU_STACK_ALIGNMENT - 1)) == 0);
 
+  Marker = gNullVaList;
   VA_START (Marker, NewStack);
 
   InternalSwitchStack (EntryPoint, Context1, Context2, NewStack, Marker);
diff --git a/MdePkg/Library/BasePrintLib/PrintLib.c 
b/MdePkg/Library/BasePrintLib/PrintLib.c
index 
af771652e4b0aebd616973ba1089ae5bc2b6f0c0..67c5f3dd547cea5447075ef88d697879883ba5ab
 100644
--- a/MdePkg/Library/BasePrintLib/PrintLib.c
+++ b/MdePkg/Library/BasePrintLib/PrintLib.c
@@ -3,6 +3,7 @@
 
   Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
   Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
+  Copyright (c) 2019, ARM Ltd. All rights reserved.
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -177,6 +178,7 @@ UnicodeSPrint (
   VA_LIST Marker;
   UINTN   NumberOfPrinted;
 
+  Marker = gNullVaList;
   VA_START (Marker, FormatString);
   NumberOfPrinted = UnicodeVSPrint (StartOfBuffer, BufferSize, FormatString, 
Marker);
   VA_END (Marker);
@@ -337,6 +339,7 @@ UnicodeSPrintAsciiFormat (
   VA_LIST Marker;
   UINTN   NumberOfPrinted;
 
+  Marker = gNullVaList;
   VA_START (Marker, FormatString);
   NumberOfPrinted = UnicodeVSPrintAsciiFormat (StartOfBuffer, BufferSize, 
FormatString, Marker);
   VA_END (Marker);
@@ -614,6 +617,7 @@ AsciiSPrint (
   VA_LIST Marker;
   UINTN   NumberOfPrinted;
 
+  Marker = gNullVaList;
   VA_START (Marker, FormatString);
   NumberOfPrinted = AsciiVSPrint (StartOfBuffer, BufferSize, FormatString, 
Marker);
   VA_END (Marker);
@@ -774,6 +778,7 @@ AsciiSPrintUnicodeFormat (
   VA_LIST Marker;
   UINTN   NumberOfPrinted;
 
+  Marker = gNullVaList;
   VA_START (Marker, FormatString);
   NumberOfPrinted = AsciiVSPrintUnicodeFormat (StartOfBuffer, BufferSize, 
FormatString, Marker);
   VA_END (Marker);
diff --git a/MdePkg/Library/BasePrintLib/PrintLibInternal.c 
b/MdePkg/Library/BasePrintLib/PrintLibInternal.c
index 
b6ec5ac4fbb98982f8ccaf3908c2a91ce583e31e..11392f2a5d12eb059611c3ff77b27b602f9b9a40
 100644
--- a/MdePkg/Library/BasePrintLib/PrintLibInternal.c
+++ b/MdePkg/Library/BasePrintLib/PrintLibInternal.c
@@ -2,12 +2,20 @@
   Print Library internal worker functions.
 
   Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+  Copyright (c) 2019, ARM Ltd. All rights reserved.
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
 
 #include "PrintLibInternal.h"
 
+//
+// Declare a VA_LIST global variable that is used to initialise VA_LIST
+// variables before use. The VA_LIST cannot be assigned a NULL value
+// because some compilers define VA_LIST to be a structure.
+//
+extern VA_LIST gNullVaList;
+
 #define WARNING_STATUS_NUMBER 5
 #define ERROR_STATUS_NUMBER   33
 
@@ -1256,6 +1264,7 @@ BasePrintLibSPrint (
   VA_LIST  Marker;
   UINTNNumberOfPrinted;
 
+  Marker = gNullVaList;
   VA_START (Marker, FormatString);
   NumberOfPrinted = BasePrintLibSPrintMarker (StartOfBuffer, BufferSize, 
Flags, FormatString, Marker, NULL);
   VA_END (Marker);
-- 
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'



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

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



[edk2-devel] [PATCH v1 18/19] ArmPlatformPkg: Fix comparison of constants warning

2019-08-23 Thread Sami Mujawar
The VS2017 compiler reports 'warning C6326: potential
comparison of a constant with another constant' when
a fixed PCD value is compared with a constant value.

The faulting code is as marked by '-->' below:

--> if (FixedPcdGet32 (PL011UartInteger) != 0) {
  Integer = FixedPcdGet32 (PL011UartInteger);
  Fractional = FixedPcdGet32 (PL011UartFractional);
} else {
...

The macro FixedPcdGet32 (PL011UartInteger) evaluates
to a macro _PCD_VALUE_PL011UartInteger that is defined
by the build system to represent the UART Integer
value. Therefore, the VS2017 compiler reports the above
warning.

Fix this warning by enclosing the code in appropriate
 #if .. #else .. #endif directives.

Signed-off-by: Sami Mujawar 
---
 ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.c 
b/ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.c
index 
2d3c279cce49304959953ec4a34b50e09a7d0045..dabf099b9bc82e1fb1bd5a2eae3fa4b5878a9e07
 100644
--- a/ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.c
+++ b/ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.c
@@ -174,10 +174,10 @@ PL011UartInitializePort (
   //
 
   // If PL011 Integer value has been defined then always ignore the BAUD rate
-  if (FixedPcdGet32 (PL011UartInteger) != 0) {
+#if (FixedPcdGet32 (PL011UartInteger) != 0)
 Integer = FixedPcdGet32 (PL011UartInteger);
 Fractional = FixedPcdGet32 (PL011UartFractional);
-  } else {
+#else
 // If BAUD rate is zero then replace it with the system default value
 if (*BaudRate == 0) {
   *BaudRate = FixedPcdGet32 (PcdSerialBaudRate);
@@ -197,7 +197,7 @@ PL011UartInitializePort (
 Divisor = (UINT32)DivisorValue;
 Integer = Divisor >> FRACTION_PART_SIZE_IN_BITS;
 Fractional = Divisor & FRACTION_PART_MASK;
-  }
+#endif
 
   //
   // If PL011 is already initialized, check the current settings
-- 
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'



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

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



[edk2-devel] [PATCH v1 14/19] DynamicTablesPkg: PPTT: Fix uninitialized memory usage

2019-08-23 Thread Sami Mujawar
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 
---
 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,

);
+
+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,

);
+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,

);
+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)'



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

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



[edk2-devel] [PATCH v1 15/19] DynamicTablesPkg: Remove erroneous use of EFIAPI

2019-08-23 Thread Sami Mujawar
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 
---
 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)'



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

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



[edk2-devel] [PATCH v1 10/19] DynamicTablesPkg: Serial debug port initialisation

2019-08-23 Thread Sami Mujawar
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 
---
 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*)
-- 
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'



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

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



[edk2-devel] [PATCH v1 08/19] DynamicTablesPkg: Fix ACPI table rev field width

2019-08-23 Thread Sami Mujawar
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 
---
 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 
7d6d3442276db7b4abaeb3b053ba489258adea0b..d7a1209c4d40c2e6ffb3dac786c276a30d70b6df
 100644
--- a/DynamicTablesPkg/Include/AcpiTableGenerator.h
+++ b/DynamicTablesPkg/Include/AcpiTableGenerator.h
@@ -284,10 +284,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_IDTableGeneratorId;
-- 
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'



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

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



[edk2-devel] [PATCH v1 12/19] DynamicTablesPkg: Fix IORT node length assignment

2019-08-23 Thread Sami Mujawar
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 
---
 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 OUTIORT_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 OUTIORT_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 OUTIORT_NODE_INDEXER  ** CONST NodeIndexer
   )
 {
-  UINT32  Size;
+  UINT64  Size;
 
   ASSERT (NodeList != NULL);
 
@@ -321,7 +321,7 @@ GetSizeofRootComplexNodes (
   while (NodeCount-- != 0) {
  

[edk2-devel] [PATCH v1 11/19] DynamicTablesPkg: Remove redundant frame count check

2019-08-23 Thread Sami Mujawar
Removing GT Block frame count check from AddGTBlockTimerFrames()
as this is already validated in BuildGtdtTable().

Signed-off-by: Sami Mujawar 
---
 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)'



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

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



[edk2-devel] [PATCH v1 16/19] DynamicTablesPkg: Option for VS2017 static code analysis

2019-08-23 Thread Sami Mujawar
Add build option STATIC_ANALYSIS to enable VS2017 static
code analysis.

Signed-off-by: Sami Mujawar 
---
 DynamicTablesPkg/DynamicTablesPkg.dsc | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/DynamicTablesPkg/DynamicTablesPkg.dsc 
b/DynamicTablesPkg/DynamicTablesPkg.dsc
index 
dfe6c07111059cdd3eed23becf5000c04270bd9c..6ff6ff019e080f355ca24c9d05f71f8b85ab9077
 100644
--- a/DynamicTablesPkg/DynamicTablesPkg.dsc
+++ b/DynamicTablesPkg/DynamicTablesPkg.dsc
@@ -4,7 +4,7 @@
 #  Copyright (c) 2019, Linaro Limited. All rights reserved.
 #  Copyright (c) 2019, ARM Limited. All rights reserved.
 #
-#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 ##
 
@@ -39,3 +39,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)'



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

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



[edk2-devel] [PATCH v1 03/19] DynamicTablesPkg: Remove struct CM_ARM_CPU_INFO

2019-08-23 Thread Sami Mujawar
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 
---
 DynamicTablesPkg/Include/ArmNameSpaceObjects.h | 4 
 1 file changed, 4 deletions(-)

diff --git a/DynamicTablesPkg/Include/ArmNameSpaceObjects.h 
b/DynamicTablesPkg/Include/ArmNameSpaceObjects.h
index 
ac451b306dfd7ba299a83209675b21696be235be..f08b8257678c8b6aacc863bbe1db09587b51a291
 100644
--- a/DynamicTablesPkg/Include/ArmNameSpaceObjects.h
+++ b/DynamicTablesPkg/Include/ArmNameSpaceObjects.h
@@ -67,10 +67,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)'



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

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



[edk2-devel] [PATCH v1 09/19] DynamicTablesPkg: Fix unaligned pointers usage

2019-08-23 Thread Sami Mujawar
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 
---
 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,
  ,
- >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,
  ,
- >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,
  ,
- >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 
6a0fdd08e1533c57285f42086314c70a5ed5..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
   UINT32ProcTopologyStructCount;
+  /// Count of Processor Hierarchy Nodes
+  UINT32ProcHierarchyNodeCount;
+  /// Count of Cache Structures
+  UINT32CacheStructCount;
+  /// Count of Id Structures
+  UINT32IdStructCount;
   /// 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
-  UINT32ProcHierarchyNodeCount;
-  /// Count of Cache Structures
-  UINT32CacheStructCount;
-  /// Count of Id Structures
-  UINT32IdStructCount;
-
 } ACPI_PPTT_GENERATOR;
 
 #pragma pack()
-- 
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'



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

[edk2-devel] [PATCH v1 04/19] DynamicTablesPkg: Fix serial port subtype warning

2019-08-23 Thread Sami Mujawar
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 
---
 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)'



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

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



[edk2-devel] [PATCH v1 06/19] DynamicTablesPkg: Fix GT Block length assignment

2019-08-23 Thread Sami Mujawar
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 
---
 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;
   UINT32GTBlockTimerFrameCount;
+  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)'



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

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



[edk2-devel] [PATCH v1 05/19] DynamicTablesPkg: Fix Proc node length assignment

2019-08-23 Thread Sami Mujawar
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 
---
 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)'



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

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



[edk2-devel] [PATCH v1 07/19] DynamicTablesPkg: Fix Boot arch flag width

2019-08-23 Thread Sami Mujawar
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 
---
 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 
f08b8257678c8b6aacc863bbe1db09587b51a291..cd955379c90d8633c89e324b5567643d2676e557
 100644
--- a/DynamicTablesPkg/Include/ArmNameSpaceObjects.h
+++ b/DynamicTablesPkg/Include/ArmNameSpaceObjects.h
@@ -64,7 +64,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)'



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

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



[edk2-devel] [PATCH v1 01/19] DynamicTablesPkg: Fix entry point param definition

2019-08-23 Thread Sami Mujawar
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 
---
 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_HANDLEImageHandle,
+  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_HANDLEImageHandle,
+  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_HANDLEImageHandle,
-  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_HANDLEImageHandle,
-  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 
e9e4991dc127abb97f859436df0c4ceafdb3f5ec..6cb60e898f697ce4347ad3adeb5bca1cc1f30a0c
 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_HANDLEImageHandle,
-  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
 

[edk2-devel] [PATCH v1 13/19] DynamicTablesPkg: IORT: Fix uninitialized memory usage

2019-08-23 Thread Sami Mujawar
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 
---
 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)'



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

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



[edk2-devel] [PATCH v1 00/19] Fix warnings reported by VS2017 compiler

2019-08-23 Thread Sami Mujawar
This patch series:
  - fixes warnings reported by the VS2017 compiler
  - adds an option to enable VS2017 static code
analysis
  - fixes warnings reported by the edk2 build
system

The issues fixed in this series were identified
by building DynamicTablesPkg/DynamicTablesPkg.dsc
using the VS2017 compiler with the static code
analysis option.

The changes can be seen at:
https://github.com/samimujawar/edk2/tree/503_vs2017_compile_issue_v1

Sami Mujawar (19):
  DynamicTablesPkg: Fix entry point param definition
  DynamicTablesPkg: Fix missing local header warning
  DynamicTablesPkg: Remove struct CM_ARM_CPU_INFO
  DynamicTablesPkg: Fix serial port subtype warning
  DynamicTablesPkg: Fix Proc node length assignment
  DynamicTablesPkg: Fix GT Block length assignment
  DynamicTablesPkg: Fix Boot arch flag width
  DynamicTablesPkg: Fix ACPI table rev field width
  DynamicTablesPkg: Fix unaligned pointers usage
  DynamicTablesPkg: Serial debug port initialisation
  DynamicTablesPkg: Remove redundant frame count check
  DynamicTablesPkg: Fix IORT node length assignment
  DynamicTablesPkg: IORT: Fix uninitialized memory usage
  DynamicTablesPkg: PPTT: Fix uninitialized memory usage
  DynamicTablesPkg: Remove erroneous use of EFIAPI
  DynamicTablesPkg: Option for VS2017 static code analysis
  ArmPlatformPkg: Fix UART divisor warning
  ArmPlatformPkg: Fix comparison of constants warning
  MdePkg: Initialise VA_LIST variables before use

 ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.c |  
16 +-
 DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.c   |   
6 +-
 DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.inf |   
1 +
 DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.c   |   
4 +-
 DynamicTablesPkg/DynamicTablesPkg.dsc  |   
9 +-
 DynamicTablesPkg/Include/AcpiTableGenerator.h  |   
4 +-
 DynamicTablesPkg/Include/ArmNameSpaceObjects.h |   
6 +-
 DynamicTablesPkg/Include/Protocol/DynamicTableFactoryProtocol.h|  
11 +-
 DynamicTablesPkg/Include/StandardNameSpaceObjects.h|   
2 +-
 DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c   |  
35 +-
 DynamicTablesPkg/Library/Acpi/Arm/AcpiFadtLibArm/FadtGenerator.c   |   
8 +-
 DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/GtdtGenerator.c   |  
43 +-
 DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/AcpiIortLibArm.inf|   
3 +-
 DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c   | 
454 +---
 DynamicTablesPkg/Library/Acpi/Arm/AcpiMadtLibArm/MadtGenerator.c   |   
8 +-
 DynamicTablesPkg/Library/Acpi/Arm/AcpiMcfgLibArm/McfgGenerator.c   |   
8 +-
 DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/AcpiPpttLibArm.inf|   
1 +
 DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c   |  
98 +++--
 DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.h   |  
13 +-
 DynamicTablesPkg/Library/Acpi/Arm/AcpiRawLibArm/RawGenerator.c |   
8 +-
 DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c   |  
23 +-
 MdePkg/Library/BaseLib/SwitchStack.c   |   
9 +
 MdePkg/Library/BasePrintLib/PrintLib.c |   
5 +
 MdePkg/Library/BasePrintLib/PrintLibInternal.c |   
9 +
 24 files changed, 501 insertions(+), 283 deletions(-)

-- 
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'



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

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



[edk2-devel] [edk2-platforms:PATCH] Intel/IntelSiliconPkg Implement SmmAccess in IntelSiliconPkg

2019-08-23 Thread Marc W Chen
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2121

Implement SmmAccess for PEI and DXE phase in IntelSiliconPkg

Signed-off-by: Marc Chen 
Cc: Ray Ni 
Cc: Rangasai V Chaganty 
---
 .../Library/PeiSmmAccessLib/PeiSmmAccessLib.c  | 343 +
 .../Library/PeiSmmAccessLib/PeiSmmAccessLib.inf|  42 +++
 .../Feature/SmmAccess/SmmAccessDxe/SmmAccess.inf   |  47 +++
 .../SmmAccess/SmmAccessDxe/SmmAccessDriver.c   | 267 
 .../SmmAccess/SmmAccessDxe/SmmAccessDriver.h   | 160 ++
 .../IntelSiliconPkg/Include/Library/SmmAccessLib.h |  32 ++
 6 files changed, 891 insertions(+)
 create mode 100644 
Silicon/Intel/IntelSiliconPkg/Feature/SmmAccess/Library/PeiSmmAccessLib/PeiSmmAccessLib.c
 create mode 100644 
Silicon/Intel/IntelSiliconPkg/Feature/SmmAccess/Library/PeiSmmAccessLib/PeiSmmAccessLib.inf
 create mode 100644 
Silicon/Intel/IntelSiliconPkg/Feature/SmmAccess/SmmAccessDxe/SmmAccess.inf
 create mode 100644 
Silicon/Intel/IntelSiliconPkg/Feature/SmmAccess/SmmAccessDxe/SmmAccessDriver.c
 create mode 100644 
Silicon/Intel/IntelSiliconPkg/Feature/SmmAccess/SmmAccessDxe/SmmAccessDriver.h
 create mode 100644 Silicon/Intel/IntelSiliconPkg/Include/Library/SmmAccessLib.h

diff --git 
a/Silicon/Intel/IntelSiliconPkg/Feature/SmmAccess/Library/PeiSmmAccessLib/PeiSmmAccessLib.c
 
b/Silicon/Intel/IntelSiliconPkg/Feature/SmmAccess/Library/PeiSmmAccessLib/PeiSmmAccessLib.c
new file mode 100644
index 00..88eb217d2a
--- /dev/null
+++ 
b/Silicon/Intel/IntelSiliconPkg/Feature/SmmAccess/Library/PeiSmmAccessLib/PeiSmmAccessLib.c
@@ -0,0 +1,343 @@
+/** @file
+  This is to publish the SMM Access Ppi instance.
+
+  Copyright (c) 2019, Intel Corporation. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#define SMM_ACCESS_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('4', '5', 's', 'a')
+
+///
+/// Private data
+///
+typedef struct {
+  UINTN Signature;
+  EFI_HANDLEHandle;
+  PEI_SMM_ACCESS_PPISmmAccess;
+  //
+  // Local Data for SMM Access interface goes here
+  //
+  UINTN NumberRegions;
+  EFI_SMRAM_DESCRIPTOR  *SmramDesc;
+} SMM_ACCESS_PRIVATE_DATA;
+
+#define SMM_ACCESS_PRIVATE_DATA_FROM_THIS(a) \
+CR (a, \
+  SMM_ACCESS_PRIVATE_DATA, \
+  SmmAccess, \
+  SMM_ACCESS_PRIVATE_DATA_SIGNATURE \
+  )
+
+/**
+  This routine accepts a request to "open" a region of SMRAM.  The
+  region could be legacy ABSEG, HSEG, or TSEG near top of physical memory.
+  The use of "open" means that the memory is visible from all PEIM
+  and SMM agents.
+
+  @param[in] This -  Pointer to the SMM Access Interface.
+  @param[in] DescriptorIndex  -  Region of SMRAM to Open.
+  @param[in] PeiServices  -  General purpose services available to every 
PEIM.
+
+  @retval EFI_SUCCESS-  The region was successfully opened.
+  @retval EFI_DEVICE_ERROR   -  The region could not be opened because 
locked by
+chipset.
+  @retval EFI_INVALID_PARAMETER  -  The descriptor index was out of bounds.
+**/
+EFI_STATUS
+EFIAPI
+Open (
+  IN EFI_PEI_SERVICES   **PeiServices,
+  IN PEI_SMM_ACCESS_PPI *This,
+  IN UINTN  DescriptorIndex
+  )
+{
+  SMM_ACCESS_PRIVATE_DATA *SmmAccess;
+
+  SmmAccess = SMM_ACCESS_PRIVATE_DATA_FROM_THIS (This);
+  if (DescriptorIndex >= SmmAccess->NumberRegions) {
+DEBUG ((DEBUG_WARN, "SMRAM region out of range\n"));
+
+return EFI_INVALID_PARAMETER;
+  } else if (SmmAccess->SmramDesc[DescriptorIndex].RegionState & 
EFI_SMRAM_LOCKED) {
+//
+// Cannot open a "locked" region
+//
+DEBUG ((DEBUG_WARN, "Cannot open a locked SMRAM region\n"));
+
+return EFI_DEVICE_ERROR;
+  }
+
+  SmmAccess->SmramDesc[DescriptorIndex].RegionState &= (UINT64) 
~(EFI_SMRAM_CLOSED | EFI_ALLOCATED);
+  SmmAccess->SmramDesc[DescriptorIndex].RegionState |= (UINT64) EFI_SMRAM_OPEN;
+  SmmAccess->SmmAccess.OpenState = TRUE;
+  return EFI_SUCCESS;
+}
+
+/**
+  This routine accepts a request to "close" a region of SMRAM.  This is valid 
for
+  compatible SMRAM region.
+
+  @param[in] PeiServices  -  General purpose services available to every 
PEIM.
+  @param[in] This -  Pointer to the SMM Access Interface.
+  @param[in] DescriptorIndex  -  Region of SMRAM to Close.
+
+  @retval EFI_SUCCESS-  The region was successfully closed.
+  @retval EFI_DEVICE_ERROR   -  The region could not be closed because 
locked by
+chipset.
+  @retval EFI_INVALID_PARAMETER  -  The descriptor index was out of bounds.
+**/
+EFI_STATUS
+EFIAPI
+Close (
+  IN EFI_PEI_SERVICES**PeiServices,
+  IN PEI_SMM_ACCESS_PPI  *This,
+  IN UINTN   DescriptorIndex
+  )
+{
+  SMM_ACCESS_PRIVATE_DATA *SmmAccess;
+  BOOLEAN

[edk2-devel] Hard Feature Freeze start now for edk2-stable201908

2019-08-23 Thread Liming Gao
Hi, all
  Today, we will enter into Hard Feature Freeze phase until edk2-stable201908 
tag is created at 2019-08-30. In this phase, there is no feature to be pushed. 
The critical bug fix is still allowed.

  If the patch is sent after Hard Feature Freeze, and plans to catch this 
stable tag, please add edk2-stable201908 key words in the patch title and BZ, 
and also cc to Tianocore Stewards, then Stewards can give the comments.

Below is edk2-stable201908 tag planning.
  Date (00:00:00 UTC-8) Description
  2018-06-06 Beginning of development
  2019-08-16 Soft Feature Freeze
  2019-08-23 Hard Feature Freeze
  2019-08-30 Release

Thanks
Liming


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

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



Re: [edk2-devel] [edk2-platforms][PATCH V2 1/2] KabylakeOpenBoardPkg: Fix GCC Build Failures

2019-08-23 Thread Chiu, Chasel


Reviewed-by: Chasel Chiu 

> -Original Message-
> From: Kubacki, Michael A
> Sent: Friday, August 23, 2019 2:17 AM
> To: devel@edk2.groups.io
> Cc: Chiu, Chasel ; Desimone, Nathaniel L
> ; Gao, Liming 
> Subject: [edk2-platforms][PATCH V2 1/2] KabylakeOpenBoardPkg: Fix GCC
> Build Failures
> 
> REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2109
> 
> Fixes build failures on GCC7.3.0. Tested on Ubunutu 18.04.1 LTS.
> 
> Cc: Chasel Chiu 
> Cc: Nate DeSimone 
> Cc: Liming Gao 
> Signed-off-by: Michael Kubacki 
> ---
> 
> Platform/Intel/KabylakeOpenBoardPkg/FspWrapper/Library/SecFspWrapper
> PlatformSecLib/FspWrapperPlatformSecLib.c | 2 +-
> 
> Platform/Intel/KabylakeOpenBoardPkg/Library/BaseGpioExpanderLib/BaseG
> pioExpanderLib.c | 8 +++-
>  2 files changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git
> a/Platform/Intel/KabylakeOpenBoardPkg/FspWrapper/Library/SecFspWrapp
> erPlatformSecLib/FspWrapperPlatformSecLib.c
> b/Platform/Intel/KabylakeOpenBoardPkg/FspWrapper/Library/SecFspWrapp
> erPlatformSecLib/FspWrapperPlatformSecLib.c
> index d73fc77f69..d40eecae95 100644
> ---
> a/Platform/Intel/KabylakeOpenBoardPkg/FspWrapper/Library/SecFspWrapp
> erPlatformSecLib/FspWrapperPlatformSecLib.c
> +++
> b/Platform/Intel/KabylakeOpenBoardPkg/FspWrapper/Library/SecFspWrapp
> erPlatformSecLib/FspWrapperPlatformSecLib.c
> @@ -174,7 +174,7 @@ SecPlatformMain (
>  //
>  CopyMem (CopyDestinationPointer, mPeiCoreFvLocationPpiList, sizeof
> (mPeiCoreFvLocationPpiList));
>  TopOfTemporaryRamPpiIndex = 1;
> -(UINT8 *) CopyDestinationPointer += sizeof(mPeiCoreFvLocationPpiList);
> +CopyDestinationPointer += sizeof (mPeiCoreFvLocationPpiList);
>}
>CopyMem (CopyDestinationPointer, mPeiSecPlatformPpi,
> sizeof(mPeiSecPlatformPpi));
>//
> diff --git
> a/Platform/Intel/KabylakeOpenBoardPkg/Library/BaseGpioExpanderLib/Bas
> eGpioExpanderLib.c
> b/Platform/Intel/KabylakeOpenBoardPkg/Library/BaseGpioExpanderLib/Bas
> eGpioExpanderLib.c
> index ead1e6df19..3d1856d89e 100644
> ---
> a/Platform/Intel/KabylakeOpenBoardPkg/Library/BaseGpioExpanderLib/Bas
> eGpioExpanderLib.c
> +++
> b/Platform/Intel/KabylakeOpenBoardPkg/Library/BaseGpioExpanderLib/Bas
> eGpioExpanderLib.c
> @@ -1,7 +1,7 @@
>  /** @file
>Support for IO expander TCA6424.
> 
> -Copyright (c) 2017, Intel Corporation. All rights reserved.
> +Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
>  SPDX-License-Identifier: BSD-2-Clause-Patent
> 
>  **/
> @@ -70,12 +70,11 @@ GpioExpGetRegister (
>IN UINT8 Register
>)
>  {
> -  EFI_STATUS Status;
>UINT8 WriBuf[1];
>UINT8 ReBuf[1] = {0};
> 
>WriBuf[0] = Register;
> -  Status = I2cWriteRead( Bar0, TCA6424_I2C_ADDRESS+Address, 1, WriBuf, 1,
> ReBuf, WAIT_1_SECOND);
> +  I2cWriteRead (Bar0, TCA6424_I2C_ADDRESS + Address, 1, WriBuf, 1, ReBuf,
> WAIT_1_SECOND);
> 
>return ReBuf[0];
>  }
> @@ -99,13 +98,12 @@ GpioExpSetRegister (
>IN UINT8 Value
>)
>  {
> -  EFI_STATUS Status;
>UINT8 WriBuf[2];
> 
>WriBuf[0] = Register;
>WriBuf[1] = Value;
> -  Status = I2cWriteRead( Bar0, TCA6424_I2C_ADDRESS+Address, 2, WriBuf, 0,
> NULL, WAIT_1_SECOND);
> 
> +  I2cWriteRead (Bar0, TCA6424_I2C_ADDRESS + Address, 2, WriBuf, 0, NULL,
> WAIT_1_SECOND);
>  }
>  /**
>Set the input register to a give value mentioned in the function.
> --
> 2.16.2.windows.1


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

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



Re: [edk2-devel] [PATCH] [edk2-stable201908] BaseTools: Support long file path in windows for misc functions

2019-08-23 Thread Bob Feng
Pushed at 6dd9aa40193cc905cda5f97d07e30ffbd5299439

-Original Message-
From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of Bob Feng
Sent: Thursday, August 22, 2019 11:14 AM
To: devel@edk2.groups.io; Shi, Steven 
Cc: Gao, Liming 
Subject: Re: [edk2-devel] [PATCH] [edk2-stable201908] BaseTools: Support long 
file path in windows for misc functions

Patch looks good.

Reviewed-by: Bob Feng 


-Original Message-
From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of Steven Shi
Sent: Thursday, August 22, 2019 10:44 AM
To: devel@edk2.groups.io
Cc: Gao, Liming ; Feng, Bob C ; 
Shi, Steven 
Subject: [edk2-devel] [PATCH] [edk2-stable201908] BaseTools: Support long file 
path in windows for misc functions

From: "Shi, Steven" 

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

Current CopyFileOnChange() and SaveFileOnChange() in 
BaseTools\Source\Python\Common\Misc.py don't use the dedicated long file path 
API to handle the file path strings and cannot support the long file path copy 
and save in windows. This patch enhances them to support the long file path 
copy and save correctly.

Cc: Liming Gao 
Cc: Bob Feng 
Signed-off-by: Steven Shi 
---
 BaseTools/Source/Python/Common/Misc.py | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/Common/Misc.py 
b/BaseTools/Source/Python/Common/Misc.py
index 4799635cc4..15ae6a9e40 100755
--- a/BaseTools/Source/Python/Common/Misc.py
+++ b/BaseTools/Source/Python/Common/Misc.py
@@ -34,6 +34,8 @@ from Common.BuildToolError import *  from 
CommonDataClass.DataClass import *  from Common.Parsing import 
GetSplitValueList  from Common.LongFilePathSupport import OpenLongFilePath as 
open
+from Common.LongFilePathSupport import CopyLongFilePath as CopyLong 
+from Common.LongFilePathSupport import LongFilePath as LongFilePath
 from Common.MultipleWorkspace import MultipleWorkspace as mws  from 
CommonDataClass.Exceptions import BadExpression  from Common.caching import 
cached_property @@ -450,6 +452,9 @@ def RemoveDirectory(Directory, 
Recursively=False):
 #
 def SaveFileOnChange(File, Content, IsBinaryFile=True, FileLock=None):
 
+# Convert to long file path format
+File = LongFilePath(File)
+
 if os.path.exists(File):
 if IsBinaryFile:
 try:
@@ -530,6 +535,11 @@ def SaveFileOnChange(File, Content, IsBinaryFile=True, 
FileLock=None):
 #   @retval False No copy really happen
 #
 def CopyFileOnChange(SrcFile, Dst, FileLock=None):
+
+# Convert to long file path format
+SrcFile = LongFilePath(SrcFile)
+Dst = LongFilePath(Dst)
+
 if not os.path.exists(SrcFile):
 return False
 
@@ -561,7 +571,7 @@ def CopyFileOnChange(SrcFile, Dst, FileLock=None):
 # copy the src to a temp file in the dst same folder firstly, then
 # replace or rename the temp file to the destination file.
 with tempfile.NamedTemporaryFile(dir=DirName, delete=False) as tf:
-shutil.copy(SrcFile, tf.name)
+CopyLong(SrcFile, tf.name)
 tempname = tf.name
 try:
 if hasattr(os, 'replace'):
--
2.17.1








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

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



Re: [edk2-devel] [Patch][edk2-stable201908] BaseTools: Fix incremental build genmake issue

2019-08-23 Thread Bob Feng
Pushed at 5f7bb39117167018729dc938452c65ea7572eb1f

-Original Message-
From: Gao, Liming 
Sent: Wednesday, August 21, 2019 9:35 PM
To: devel@edk2.groups.io; Feng, Bob C 
Subject: RE: [edk2-devel] [Patch][edk2-stable201908] BaseTools: Fix incremental 
build genmake issue

Reviewed-by: Liming Gao 

> -Original Message-
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of Bob Feng
> Sent: Wednesday, August 21, 2019 5:57 PM
> To: devel@edk2.groups.io
> Cc: Gao, Liming ; Feng, Bob C 
> Subject: [edk2-devel] [Patch][edk2-stable201908] BaseTools: Fix incremental 
> build genmake issue
> 
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2090
> 
> This is a regression issue introduced by commit e8449e.
> This patch is going to fix this issue.
> 
> Cc: Liming Gao 
> Signed-off-by: Bob Feng 
> ---
>  BaseTools/Source/Python/build/build.py | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/BaseTools/Source/Python/build/build.py 
> b/BaseTools/Source/Python/build/build.py
> index 2c10670a69..0406ac314b 100755
> --- a/BaseTools/Source/Python/build/build.py
> +++ b/BaseTools/Source/Python/build/build.py
> @@ -1217,11 +1217,10 @@ class Build():
>  # for target which must generate AutoGen code and makefile
>  mqueue = mp.Queue()
>  for m in AutoGenObject.GetAllModuleInfo:
>  mqueue.put(m)
> 
> -AutoGenObject.DataPipe.DataContainer = {"FfsCommand":FfsCommand}
>  AutoGenObject.DataPipe.DataContainer = {"CommandTarget": 
> self.Target}
>  self.Progress.Start("Generating makefile and code")
>  data_pipe_file = os.path.join(AutoGenObject.BuildDir, 
> "GlobalVar_%s_%s.bin" %
> (str(AutoGenObject.Guid),AutoGenObject.Arch))
>  AutoGenObject.DataPipe.dump(data_pipe_file)
>  autogen_rt,errorcode = self.StartAutoGen(mqueue, 
> AutoGenObject.DataPipe, self.SkipAutoGen, PcdMaList,
> GlobalData.gCacheIR)
> @@ -1736,10 +1735,12 @@ class Build():
>  if Ma.PcdIsDriver:
>  Ma.PlatformInfo = Pa
>  Ma.Workspace = Wa
>  PcdMaList.append(Ma)
>  self.BuildModules.append(Ma)
> +Pa.DataPipe.DataContainer = {"FfsCommand":CmdListDict}
> +Pa.DataPipe.DataContainer = {"Workspace_timestamp": 
> Wa._SrcTimeStamp}
>  self._BuildPa(self.Target, Pa, 
> FfsCommand=CmdListDict,PcdMaList=PcdMaList)
> 
>  # Create MAP file when Load Fix Address is enabled.
>  if self.Target in ["", "all", "fds"]:
>  for Arch in Wa.ArchList:
> --
> 2.20.1.windows.1
> 
> 
> 


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

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



Re: [edk2-devel] [Patch V2][edk2-stable201908] BaseTools: Incorrect error message for library instance not found

2019-08-23 Thread Bob Feng
Pushed @abc0155b034230128ad4aaa51ac05a315acfa7c1

-Original Message-
From: Gao, Liming 
Sent: Thursday, August 22, 2019 10:32 PM
To: Feng, Bob C ; devel@edk2.groups.io
Subject: RE: [Patch V2][edk2-stable201908] BaseTools: Incorrect error message 
for library instance not found

Reviewed-by: Liming Gao 

> -Original Message-
> From: Feng, Bob C
> Sent: Thursday, August 22, 2019 12:01 PM
> To: devel@edk2.groups.io
> Cc: Feng, Bob C ; Gao, Liming 
> 
> Subject: [Patch V2][edk2-stable201908] BaseTools: Incorrect error 
> message for library instance not found
> 
> BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=2099
> This is a regression issue introduced by commit e8449e.
> 
> This patch is to fix this issue.
> 
> Signed-off-by: Bob Feng 
> Cc: Liming Gao 
> ---
> V2: We need to check if a inf is a Library or a Module.
>  BaseTools/Source/Python/AutoGen/DataPipe.py |  2 +-
>  BaseTools/Source/Python/AutoGen/PlatformAutoGen.py  |  2 +-
> BaseTools/Source/Python/AutoGen/WorkspaceAutoGen.py |  4 +++-
>  .../Source/Python/Workspace/WorkspaceCommon.py  | 13 +++--
>  4 files changed, 12 insertions(+), 9 deletions(-)
> 
> diff --git a/BaseTools/Source/Python/AutoGen/DataPipe.py 
> b/BaseTools/Source/Python/AutoGen/DataPipe.py
> index 2ca4f9ff4a..8b8cfd1c51 100755
> --- a/BaseTools/Source/Python/AutoGen/DataPipe.py
> +++ b/BaseTools/Source/Python/AutoGen/DataPipe.py
> @@ -87,11 +87,11 @@ class MemoryDataPipe(DataPipe):
>  #Module's Library Instance
>  ModuleLibs = {}
>  libModules = {}
>  for m in PlatformInfo.Platform.Modules:
>  module_obj = 
> BuildDB.BuildObject[m,PlatformInfo.Arch,PlatformInfo.BuildTarget,PlatformInfo.ToolChain]
> -Libs = GetModuleLibInstances(module_obj, PlatformInfo.Platform, 
> BuildDB.BuildObject,
> PlatformInfo.Arch,PlatformInfo.BuildTarget,PlatformInfo.ToolChain)
> +Libs = GetModuleLibInstances(module_obj, 
> + PlatformInfo.Platform, BuildDB.BuildObject,
> PlatformInfo.Arch,PlatformInfo.BuildTarget,PlatformInfo.ToolChain,PlatformInfo.MetaFile,EdkLogger)
>  for lib in Libs:
>  try:
> 
> libModules[(lib.MetaFile.File,lib.MetaFile.Root,lib.Arch,lib.MetaFile.Path)].append((m.File,m.Root,module_obj.Arch,m.Path))
>  except:
>
> libModules[(lib.MetaFile.File,lib.MetaFile.Root,lib.Arch,lib.MetaFile.
> Path)] = [(m.File,m.Root,module_obj.Arch,m.Path)]
> diff --git a/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py 
> b/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py
> index dd629ba2fa..565424a95e 100644
> --- a/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py
> +++ b/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py
> @@ -1087,11 +1087,11 @@ class PlatformAutoGen(AutoGen):
>  def GetAllModuleInfo(self,WithoutPcd=True):
>  ModuleLibs = set()
>  for m in self.Platform.Modules:
>  module_obj = 
> self.BuildDatabase[m,self.Arch,self.BuildTarget,self.ToolChain]
>  if not bool(module_obj.LibraryClass):
> -Libs = GetModuleLibInstances(module_obj, self.Platform, 
> self.BuildDatabase, self.Arch,self.BuildTarget,self.ToolChain)
> +Libs = GetModuleLibInstances(module_obj, 
> + self.Platform, self.BuildDatabase,
> self.Arch,self.BuildTarget,self.ToolChain,self.MetaFile,EdkLogger)
>  else:
>  Libs = []
> 
> ModuleLibs.update( 
> set([(l.MetaFile.File,l.MetaFile.Root,l.MetaFile.Path,l.MetaFile.BaseN
> ame,l.MetaFile.OriginalPath,l.Arch,True) for l in
> Libs]))
>  if WithoutPcd and module_obj.PcdIsDriver:
>  continue
> diff --git a/BaseTools/Source/Python/AutoGen/WorkspaceAutoGen.py 
> b/BaseTools/Source/Python/AutoGen/WorkspaceAutoGen.py
> index ea0d8f8bfb..2494267472 100644
> --- a/BaseTools/Source/Python/AutoGen/WorkspaceAutoGen.py
> +++ b/BaseTools/Source/Python/AutoGen/WorkspaceAutoGen.py
> @@ -246,11 +246,13 @@ class WorkspaceAutoGen(AutoGen):
>  if BuildData.MetaFile.Ext == '.inf' and str(BuildData) in 
> Platform.Modules :
>  Libs.extend(GetModuleLibInstances(BuildData, Platform,
>   self.BuildDatabase,
>   Arch,
>   self.BuildTarget,
> - self.ToolChain
> + self.ToolChain,
> + self.Platform.MetaFile,
> + EdkLogger
>   ))
>  for BuildData in list(self.BuildDatabase._CACHE_.values()):
>  if BuildData.Arch != Arch:
>  continue
>  if BuildData.MetaFile.Ext == '.inf':
> diff --git a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py 
> b/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
> index 76583f46e5..0b11ec2d59 100644
> ---