[edk2] Csm16.bin(seabios) failed to work in OVMF.

2016-04-22 Thread wq...@aliyun.com
Hi everyone,
I build the Csm16.bin from source code of seabios-1.9.2.tar.gz . And copy 
the Csm16.bin to OvmfPkg/Csm/Csm16/Csm16.bin , Build the OVMF_CODE.fd and 
OVMF_VARS.fd with command build -D CSM_ENABLE.
   Unfortunately, I test the OVMF_CODE.fd and OVMF_VARS.fd in qemu. It failed!
The log is:
ASSERT_EFI_ERROR (Status = Not Found)
ASSERT 
/root/tianocore-edk2/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBios.c(982):
 !EFI_ERROR (Status)
Any information you can provide me would be greatly appreciated.
Thx 




wq...@aliyun.com
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] MdeModulePkg/PXE: Avoid using overloaded BootFileName or ServerName

2016-04-22 Thread Heyi Guo
Sorry, it is not good to modify the original data of the packets. Please 
ignore this patch and I'll send out a new one.


Regards.

Heyi

On 04/22/2016 04:32 PM, Heyi Guo wrote:

BootFileName or ServerName in DHCP offer may be overloaded and cannot
be used, so we manually set the strings to be null to avoid misusing.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: chenzhihui 
Signed-off-by: Heyi Guo 
Cc: Feng Tian 
Cc: Star Zeng 
Cc: Siyuan Fu 
Cc: Jiaxin Wu 
---
  MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c | 4 
  1 file changed, 4 insertions(+)

diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c 
b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c
index 6c06373..ecd1903 100644
--- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c
+++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c
@@ -172,6 +172,8 @@ PxeBcParseCachedDhcpPacket (
   );
  }
}
+  // Terminate the invalid string to avoid misusing
+  Offer->Dhcp4.Header.BootFileName[0] = 0;
  }
  if ((Option->Data[0] & PXEBC_DHCP4_OVERLOAD_SERVER_NAME) != 0) {
for (Index = 0; Index < PXEBC_DHCP4_TAG_INDEX_MAX; Index++) {
@@ -183,6 +185,8 @@ PxeBcParseCachedDhcpPacket (
   );
  }
}
+  // Terminate the invalid string to avoid misusing
+  Offer->Dhcp4.Header.ServerName[0] = 0;
  }
}
  


___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] Ask for recommendation of free automation test tool

2016-04-22 Thread Blibbet
> Have you ever used any free automation test tool? Any recommendation?

What EFI-related thing are you trying to test?

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH v2 0/2] Report ACPI NFIT for reserved memory RAM disks

2016-04-22 Thread El-Haj-Mahmoud, Samer
What if we break down the NFIT registration from the rest of the RamDiskDxe:

RamDiskDxe:
As it is today, without NFIT/ACPI Name Space entries:

RamDiskAcpiDxe
Add NFIT entries (and ACPI Namespace if one doesn't exist).

The RamDiskAcpiDxe would be just a reference implementation, and platforms may 
adapt it to work with its own NVDIMM implementation (as both NVDIMMs and 
RAMDisks need to live in the same NFIT table). Platforms that do not wish to 
support reserved/runtime RAMDisks (for certain use cases like booting an ISO OS 
image from HTTP) do not need to worry about RamDiskAcpiDxe at all.

Thanks,
--Samer


-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Wu, Hao A
Sent: Thursday, April 21, 2016 10:15 PM
To: Laszlo Ersek 
Cc: Justen, Jordan L ; Tian, Feng 
; Xiao Guangrong ; 
edk2-de...@ml01.01.org; Yao, Jiewen 
Subject: Re: [edk2] [PATCH v2 0/2] Report ACPI NFIT for reserved memory RAM 
disks

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
> Laszlo Ersek
> Sent: Thursday, April 21, 2016 7:10 PM
> To: Wu, Hao A
> Cc: Justen, Jordan L; Tian, Feng; Xiao Guangrong; 
> edk2-de...@ml01.01.org; Yao, Jiewen
> Subject: Re: [edk2] [PATCH v2 0/2] Report ACPI NFIT for reserved 
> memory RAM disks
> 
> On 04/21/16 07:59, Wu, Hao A wrote:
> > Hi Laszlo,
> >
> > Thanks for the feedbacks, comments are made below.
> >
> >> -Original Message-
> >> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf 
> >> Of Laszlo Ersek
> >> Sent: Wednesday, April 20, 2016 7:08 PM
> >> To: Wu, Hao A
> >> Cc: Tian, Feng; Xiao Guangrong; Justen, Jordan L; 
> >> edk2-de...@ml01.01.org; Yao, Jiewen
> >> Subject: Re: [edk2] [PATCH v2 0/2] Report ACPI NFIT for reserved 
> >> memory RAM disks
> >>
> >> Hi,
> >>
> >> On 04/20/16 03:58, Hao Wu wrote:
> >>> Changes compared with V1:
> >>> 1. Instead of creating a new NFIT for each registered reserved memory
> >>>RAM disk, new cotent of the NFIT is appended to the existing one.
> >>>
> >>> 2. Report an NVDIMM root device in the \SB scope if there is no NFIT
> >>>in the ACPI table.
> >>>
> >>> 3. Modify FDF files in OvmfPkg to make sure the report of the NVDIMM
> >>>root device will be done correctly.
> >>>
> >>> Hao Wu (2):
> >>>   MdeModulePkg RamDiskDxe: Report ACPI NFIT for reserved memory
> >> RAM
> >>> disks
> >>>   OvmfPkg: Modify fdf files due to RamDiskDxe driver's adding ASL 
> >>> code
> >>>
> >>>  MdeModulePkg/Universal/Disk/RamDiskDxe/RamDisk.asl |  44 ++
> >>>  .../Universal/Disk/RamDiskDxe/RamDiskDxe.inf   |  12 +
> >>>  .../Universal/Disk/RamDiskDxe/RamDiskImpl.h|   6 +
> >>>  .../Universal/Disk/RamDiskDxe/RamDiskProtocol.c| 520
> >> +
> >>>  OvmfPkg/OvmfPkgIa32.fdf|  12 +-
> >>>  OvmfPkg/OvmfPkgIa32X64.fdf |  12 +-
> >>>  OvmfPkg/OvmfPkgX64.fdf |  12 +-
> >>>  7 files changed, 615 insertions(+), 3 deletions(-)  create mode 
> >>> 100644
> >> MdeModulePkg/Universal/Disk/RamDiskDxe/RamDisk.asl
> >>>
> >>
> >> I see that Jordan already commented on patch #2, so I'll leave that 
> >> to him :) My questions / remarks are general.
> >>
> >> (1) About sharing NFIT between different clients:
> >>
> >> QEMU can emulate an NVDIMM device (see "hw/acpi/nvdimm.c"). (I'm
> >> CC'ing Xiao Guangrong who authored it.) When QEMU is instructed to
> >> create an NVDIMM device, it will also generate an SSDT table with an
> >> NVDR object in it, and it will generate an NFIT table too.
> >>
> >> OVMF's ACPI platform driver downloads the generated ACPI payload
> >> from QEMU near the beginning of BDS, and installs the tables. The
> >> question is how those actions are ordered against the NFIT
> >> installation / manipulation in RamDiskDxe.
> >>
> >> * If the RAM disks are created from HII, then the question is not
> >>   relevant, because the HII RamDisk creation does not support the
> >>   allocation of RAM disks from Reserved type memory (only from
> >>   BootServicesData), so this code shouldn't apply to begin with.
> >>
> >> * Assuming some other parts of BDS register RAM disks allocated from
> >>   reserved memory, then this code becomes relevant. I *think* that
> >>   in this case, we'll be safe. Namely:
> >>
> >>   - if QEMU does not emulate an NVDIMM device, then both said SSDT
> >> (with the NVDR) will be missing, and the NFIT table will be
> >> missing too. This series recognizes this situation, and will
> >> install both itself. Fine.
> >>
> >>   - If QEMU does emulate an NVDIMM device, then NFIT and NVDR (in
> >> SSDT) will be present *before* this code should be called from
> >> BDS. (Simply because OVMF's ACPI platform driver installs QEMU's
> >> NFIT and SSDTs before the "rest of BDS" could register the

Re: [edk2] [PATCH] ShellPkg: Enahance 'dh' command to add more protocols decoding support

2016-04-22 Thread El-Haj-Mahmoud, Samer
Reviewed-by: Samer El-Haj-Mahmoud 

-Original Message-
From: Shah, Tapan 
Sent: Friday, April 22, 2016 11:32 AM
To: edk2-devel@lists.01.org
Cc: El-Haj-Mahmoud, Samer ; 
jaben.car...@intel.com; Shah, Tapan 
Subject: [PATCH] ShellPkg: Enahance 'dh' command to add more protocols decoding 
support

Adding EdidDiscovered, EdidActive protocol decode support a in 'dh' command.
Extending GraphicsOutput protocol decoding to list all supported GOP 
resolutions.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Tapan Shah 
---
 ShellPkg/Include/Library/ShellCommandLib.h |  20 ++-
 .../UefiHandleParsingLib/UefiHandleParsingLib.c| 181 -
 .../UefiHandleParsingLib/UefiHandleParsingLib.h|   4 +-
 .../UefiHandleParsingLib/UefiHandleParsingLib.uni  |   9 +
 .../UefiShellCommandLib/UefiShellCommandLib.c  |  61 ++-
 .../UefiShellCommandLib/UefiShellCommandLib.h  |   2 +
 6 files changed, 267 insertions(+), 10 deletions(-)

diff --git a/ShellPkg/Include/Library/ShellCommandLib.h 
b/ShellPkg/Include/Library/ShellCommandLib.h
index 0dd66c2f..5fd18a2 100644
--- a/ShellPkg/Include/Library/ShellCommandLib.h
+++ b/ShellPkg/Include/Library/ShellCommandLib.h
@@ -4,8 +4,9 @@
   This library is for use ONLY by shell commands linked into the shell 
application.
   This library will not funciton if it is used for UEFI Shell 2.0 Applications.
 
-  (C) Copyright 2013-2014 Hewlett-Packard Development Company, L.P.
   Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.
+  (C) Copyright 2016 Hewlett Packard Enterprise Development LP
+  (C) Copyright 2013-2014 Hewlett-Packard Development Company, L.P.
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
   which accompanies this distribution.  The full text of the license may be 
found at @@ -701,4 +702,21 @@ DumpHex (
   IN VOID *UserData
   );
 
+/**
+  Dump HEX data into buffer.
+   
+  @param[in] Buffer HEX data to be dumped in Buffer.
+  @param[in] Indent How many spaces to indent the output.
+  @param[in] Offset The offset of the printing.
+  @param[in] DataSize   The size in bytes of UserData.
+  @param[in] UserData   The data to print out.
+**/
+CHAR16*
+CatSDumpHex (
+  IN CHAR16  *Buffer,
+  IN UINTN   Indent,
+  IN UINTN   Offset,
+  IN UINTN   DataSize,
+  IN VOID*UserData
+  );
 #endif //_SHELL_COMMAND_LIB_
diff --git a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c 
b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c
index 14e7a9f..37d193b 100644
--- a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c
+++ b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c
@@ -244,11 +244,15 @@ GraphicsOutputProtocolDumpInformation(
   IN CONST BOOLEANVerbose
   )
 {
-  EFI_GRAPHICS_OUTPUT_PROTOCOL  *GraphicsOutput;
-  EFI_STATUSStatus;
-  CHAR16*RetVal;
-  CHAR16*Temp;
-  CHAR16*Fmt;
+  EFI_GRAPHICS_OUTPUT_PROTOCOL  *GraphicsOutput;
+  EFI_STATUSStatus;
+  CHAR16*RetVal;
+  CHAR16*Temp;
+  CHAR16*Fmt;
+  CHAR16*TempRetVal;
+  UINTN GopInfoSize;
+  UINT32Mode;
+  EFI_GRAPHICS_OUTPUT_MODE_INFORMATION  *GopInfo;
 
   if (!Verbose) {
 return (CatSPrint(NULL, L"GraphicsOutput")); @@ -295,6 +299,41 @@ 
GraphicsOutputProtocolDumpInformation(
  
GraphicsOutput->Mode->Info->PixelFormat!=PixelBitMask?0:GraphicsOutput->Mode->Info->PixelInformation.BlueMask
  );
 
+  SHELL_FREE_NON_NULL (Temp);
+  
+  Temp = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN 
+ (STR_GOP_RES_LIST_MAIN), NULL);
+
+  TempRetVal = CatSPrint (RetVal, Temp);  SHELL_FREE_NON_NULL (RetVal);  
+ RetVal = TempRetVal;  SHELL_FREE_NON_NULL (Temp);
+
+  Temp = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN 
+ (STR_GOP_RES_LIST_ENTRY), NULL);
+
+  for (Mode = 0; Mode < GraphicsOutput->Mode->MaxMode; Mode++) {
+Status = GraphicsOutput->QueryMode (
+   GraphicsOutput,
+   Mode,
+   &GopInfoSize,
+   &GopInfo
+   );
+if (EFI_ERROR (Status)) {
+  continue;
+}
+
+TempRetVal = CatSPrint (
+   RetVal,
+   Temp,
+   Mode,
+   GopInfo->HorizontalResolution,
+   GopInfo->VerticalResolution
+   );
+
+SHELL_FREE_NON_NULL (GopInfo);
+SHELL_FREE_NON_NULL (RetVal);
+RetVal = TempRetVal;
+  }
+
   SHELL_FREE_NON_NULL(Temp);
   SHELL_FREE_NON_NULL(Fmt);
 
@@ -302,6 +341,134 @@ Graph

Re: [edk2] [PATCH 3/3] Platforms/ARM/Juno: Add support for ACPI 6.0 LPI(Low Power Idle) states

2016-04-22 Thread Sudeep Holla



On 22/04/16 17:51, Leif Lindholm wrote:

On Wed, Apr 20, 2016 at 09:18:38AM +0100, Sudeep Holla wrote:



On 20/04/16 08:42, Ard Biesheuvel wrote:

On 19 April 2016 at 17:11, Sudeep Holla  wrote:

ACPI 6.0 introduced LPI(Low Power Idle) states that provides an alternate
method to describe processor idle states.

LPI extensions leverages the processor container device(again introduced
in ACPI 6.0) allowing to express which parts of the system are affected
by a given LPI state. It defines the local power states for each node
in a hierarchical processor topology. The OSPM can use _LPI object to
select a local power state for each level of processor hierarchy in the
system.

This patch adds LPI support on Juno.

Contributed-under: TianoCore Contribution Agreement 1.0
Cc: Ard Biesheuvel 
Cc: Leif Lindholm 
Signed-off-by: Sudeep Holla 


As for patch #1, I cannot review or test this.


This currently can't be tested with mainline kernel yet.
The patches to support this are still under review


So, should it be merged anyway, or will that break something?
Regardless, sounds like it should be split from the preceding two
patches.



There's no urgency as the Linux patches are still under review.
But I posted just to point people at examples for _LPI tables.

--
Regards,
Sudeep
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH 3/3] Platforms/ARM/Juno: Add support for ACPI 6.0 LPI(Low Power Idle) states

2016-04-22 Thread Leif Lindholm
On Wed, Apr 20, 2016 at 09:18:38AM +0100, Sudeep Holla wrote:
> 
> 
> On 20/04/16 08:42, Ard Biesheuvel wrote:
> >On 19 April 2016 at 17:11, Sudeep Holla  wrote:
> >>ACPI 6.0 introduced LPI(Low Power Idle) states that provides an alternate
> >>method to describe processor idle states.
> >>
> >>LPI extensions leverages the processor container device(again introduced
> >>in ACPI 6.0) allowing to express which parts of the system are affected
> >>by a given LPI state. It defines the local power states for each node
> >>in a hierarchical processor topology. The OSPM can use _LPI object to
> >>select a local power state for each level of processor hierarchy in the
> >>system.
> >>
> >>This patch adds LPI support on Juno.
> >>
> >>Contributed-under: TianoCore Contribution Agreement 1.0
> >>Cc: Ard Biesheuvel 
> >>Cc: Leif Lindholm 
> >>Signed-off-by: Sudeep Holla 
> >
> >As for patch #1, I cannot review or test this.
> 
> This currently can't be tested with mainline kernel yet.
> The patches to support this are still under review

So, should it be merged anyway, or will that break something?
Regardless, sounds like it should be split from the preceding two
patches.

/
Leif

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH] ShellPkg: Enahance 'dh' command to add more protocols decoding support

2016-04-22 Thread Tapan Shah
Adding EdidDiscovered, EdidActive protocol decode support a in 'dh' command.
Extending GraphicsOutput protocol decoding to list all supported GOP 
resolutions.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Tapan Shah 
---
 ShellPkg/Include/Library/ShellCommandLib.h |  20 ++-
 .../UefiHandleParsingLib/UefiHandleParsingLib.c| 181 -
 .../UefiHandleParsingLib/UefiHandleParsingLib.h|   4 +-
 .../UefiHandleParsingLib/UefiHandleParsingLib.uni  |   9 +
 .../UefiShellCommandLib/UefiShellCommandLib.c  |  61 ++-
 .../UefiShellCommandLib/UefiShellCommandLib.h  |   2 +
 6 files changed, 267 insertions(+), 10 deletions(-)

diff --git a/ShellPkg/Include/Library/ShellCommandLib.h 
b/ShellPkg/Include/Library/ShellCommandLib.h
index 0dd66c2f..5fd18a2 100644
--- a/ShellPkg/Include/Library/ShellCommandLib.h
+++ b/ShellPkg/Include/Library/ShellCommandLib.h
@@ -4,8 +4,9 @@
   This library is for use ONLY by shell commands linked into the shell 
application.
   This library will not funciton if it is used for UEFI Shell 2.0 Applications.
 
-  (C) Copyright 2013-2014 Hewlett-Packard Development Company, L.P.
   Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.
+  (C) Copyright 2016 Hewlett Packard Enterprise Development LP
+  (C) Copyright 2013-2014 Hewlett-Packard Development Company, L.P.
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
   which accompanies this distribution.  The full text of the license may be 
found at
@@ -701,4 +702,21 @@ DumpHex (
   IN VOID *UserData
   );
 
+/**
+  Dump HEX data into buffer.
+   
+  @param[in] Buffer HEX data to be dumped in Buffer.
+  @param[in] Indent How many spaces to indent the output.
+  @param[in] Offset The offset of the printing.
+  @param[in] DataSize   The size in bytes of UserData.
+  @param[in] UserData   The data to print out.
+**/
+CHAR16*
+CatSDumpHex (
+  IN CHAR16  *Buffer,
+  IN UINTN   Indent,
+  IN UINTN   Offset,
+  IN UINTN   DataSize,
+  IN VOID*UserData
+  );
 #endif //_SHELL_COMMAND_LIB_
diff --git a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c 
b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c
index 14e7a9f..37d193b 100644
--- a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c
+++ b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c
@@ -244,11 +244,15 @@ GraphicsOutputProtocolDumpInformation(
   IN CONST BOOLEANVerbose
   )
 {
-  EFI_GRAPHICS_OUTPUT_PROTOCOL  *GraphicsOutput;
-  EFI_STATUSStatus;
-  CHAR16*RetVal;
-  CHAR16*Temp;
-  CHAR16*Fmt;
+  EFI_GRAPHICS_OUTPUT_PROTOCOL  *GraphicsOutput;
+  EFI_STATUSStatus;
+  CHAR16*RetVal;
+  CHAR16*Temp;
+  CHAR16*Fmt;
+  CHAR16*TempRetVal;
+  UINTN GopInfoSize;
+  UINT32Mode;
+  EFI_GRAPHICS_OUTPUT_MODE_INFORMATION  *GopInfo;
 
   if (!Verbose) {
 return (CatSPrint(NULL, L"GraphicsOutput"));
@@ -295,6 +299,41 @@ GraphicsOutputProtocolDumpInformation(
  
GraphicsOutput->Mode->Info->PixelFormat!=PixelBitMask?0:GraphicsOutput->Mode->Info->PixelInformation.BlueMask
  );
 
+  SHELL_FREE_NON_NULL (Temp);
+  
+  Temp = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN 
(STR_GOP_RES_LIST_MAIN), NULL);
+
+  TempRetVal = CatSPrint (RetVal, Temp);
+  SHELL_FREE_NON_NULL (RetVal);
+  RetVal = TempRetVal;
+  SHELL_FREE_NON_NULL (Temp);
+
+  Temp = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN 
(STR_GOP_RES_LIST_ENTRY), NULL);
+
+  for (Mode = 0; Mode < GraphicsOutput->Mode->MaxMode; Mode++) {
+Status = GraphicsOutput->QueryMode (
+   GraphicsOutput,
+   Mode,
+   &GopInfoSize,
+   &GopInfo
+   );
+if (EFI_ERROR (Status)) {
+  continue;
+}
+
+TempRetVal = CatSPrint (
+   RetVal,
+   Temp,
+   Mode,
+   GopInfo->HorizontalResolution,
+   GopInfo->VerticalResolution
+   );
+
+SHELL_FREE_NON_NULL (GopInfo);
+SHELL_FREE_NON_NULL (RetVal);
+RetVal = TempRetVal;
+  }
+
   SHELL_FREE_NON_NULL(Temp);
   SHELL_FREE_NON_NULL(Fmt);
 
@@ -302,6 +341,134 @@ GraphicsOutputProtocolDumpInformation(
 }
 
 /**
+  Function to dump information about EDID Discovered Protocol.
+
+  This will allocate the return buffer from boot services pool.
+
+  @param[in] TheHandle  The handle that has LoadedImage installed.
+  @param[in] VerboseTRUE for additional informat

Re: [edk2] [PATCH v4 1/3] Platforms/ARM/Juno: Fix IO window min/max base address in PCIe root complex

2016-04-22 Thread G Gregory
On 22 April 2016 at 15:26, Leif Lindholm  wrote:
> On Wed, Apr 20, 2016 at 06:35:06PM +0100, Sudeep Holla wrote:
>> XPress-RICH3 PCIe driver initializes the root complex with the source
>> and target address for IO window. The root complex resources in SSDT
>> should match these settings.
>>
>> This patch fixes the min/max base address for the IO window in Juno PCIe
>> root complex ACPI table. It also adds 'TypeTranslation' to the IO window
>>
>> Contributed-under: TianoCore Contribution Agreement 1.0
>> Cc: Ard Biesheuvel 
>> Cc: Leif Lindholm 
>> Cc: Tomasz Nowicki 
>> Cc: Graeme Gregory 
>> Signed-off-by: Sudeep Holla 
>
> Would anyone like to add any ACKs/Reviewed-bys?
>

Reviewed-by: Graeme Gregory 

Graeme

>> ---
>>  Platforms/ARM/Juno/AcpiTables/AcpiSsdtRootPci.asl | 7 ---
>>  1 file changed, 4 insertions(+), 3 deletions(-)
>>
>> v3->v4:
>>   - Fixed the max to match the length and added TypeTranslation
>> v2->v3:
>>   - Fixed $subject and the commit log
>> v1->v2:
>>   - Made changes as suggested by Graeme & Tomasz
>>
>> diff --git a/Platforms/ARM/Juno/AcpiTables/AcpiSsdtRootPci.asl 
>> b/Platforms/ARM/Juno/AcpiTables/AcpiSsdtRootPci.asl
>> index 800d2cb3b2fb..969c42398f18 100644
>> --- a/Platforms/ARM/Juno/AcpiTables/AcpiSsdtRootPci.asl
>> +++ b/Platforms/ARM/Juno/AcpiTables/AcpiSsdtRootPci.asl
>> @@ -107,10 +107,11 @@ DefinitionBlock("SsdtPci.aml", "SSDT", 1, "ARMLTD", 
>> "ARM-JUNO", EFI_ACPI_ARM_OEM
>>   PosDecode,
>>   EntireRange,
>>   0x,
>>  // Granularity
>> - 0x5f80,
>>  // Min Base Address
>> - 0x5fff,
>>  // Max Base Address
>> + 0x,
>>  // Min Base Address
>> + 0x007f,
>>  // Max Base Address
>>   0x5f80,
>>  // Translate
>> - 0x0080 
>>  // Length
>> + 0x0080,
>>  // Length
>> + ,,,TypeTranslation
>>   )
>>   }) // Name(RBUF)
>>
>> --
>> 1.9.1
>>
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] Boot 64-bit OS from EDK2 compiled for 32-bit?

2016-04-22 Thread Richardson, Brian
This is supported by recent builds of Debian. Use the 'multi-arch' version of 
the distribution.
https://www.debian.org/News/2015/20150426 


Thanks ... br
---
Brian Richardson -- brian.richard...@intel.com -- Twitter: intel_brian

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Welch, 
Brian J
Sent: Friday, April 22, 2016 11:19 AM
To: edk2-devel@lists.01.org
Subject: [edk2] Boot 64-bit OS from EDK2 compiled for 32-bit?


I'm wondering if it is possible to boot a 64-bit Linux kernel from EDK2 that 
has been compiled for 32-bit?

If this is possible are there any caveats (e.g. is it possible to have more 
than 4GB memory, how does the 64-bit memory map get configured, etc.) ?

Brian

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] Boot 64-bit OS from EDK2 compiled for 32-bit?

2016-04-22 Thread Welch, Brian J

I'm wondering if it is possible to boot a 64-bit Linux kernel from EDK2 that 
has been compiled for 32-bit?

If this is possible are there any caveats (e.g. is it possible to have more 
than 4GB memory, how does the 64-bit memory map get configured, etc.) ?

Brian

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [staging/HTTPS-TLS][PATCH 0/3] Provide an UI to support TLS authentication

2016-04-22 Thread El-Haj-Mahmoud, Samer
Series Reviewed-By: Samer El-Haj-Mahmoud 

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Jiaxin Wu
Sent: Tuesday, April 19, 2016 10:08 PM
To: edk2-devel@lists.01.org
Cc: Ye Ting ; Fu Siyuan ; Long Qin 

Subject: [edk2] [staging/HTTPS-TLS][PATCH 0/3] Provide an UI to support TLS 
authentication

Cc: Ye Ting 
Cc: Fu Siyuan 
Cc: Long Qin 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu 

Jiaxin Wu (3):
  NetworkPkg: Provide an UI to support tls authentication.
  Nt32Pkg: Add TlsAuthConfigDxe module
  Readme.MD: Add content for TlsAuthConfigDxe

 NetworkPkg/Include/Guid/TlsAuthConfigHii.h |   25 +
 NetworkPkg/NetworkPkg.dec  |4 +
 NetworkPkg/NetworkPkg.dsc  |2 +
 NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.c |  135 ++
 NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.inf   |   72 +
 NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.uni   |   21 +
 .../TlsAuthConfigDxe/TlsAuthConfigDxeExtra.uni |   19 +
 .../TlsAuthConfigDxe/TlsAuthConfigDxeStrings.uni   |   39 +
 NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigImpl.c| 1843 
 NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigImpl.h|  288 +++
 NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigNvData.h  |   49 +
 NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigVfr.vfr   |  152 ++
 Nt32Pkg/Nt32Pkg.dsc|1 +
 Nt32Pkg/Nt32Pkg.fdf|1 +
 Readme.MD  |2 +
 15 files changed, 2653 insertions(+)
 create mode 100644 NetworkPkg/Include/Guid/TlsAuthConfigHii.h
 create mode 100644 NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.c
 create mode 100644 NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.inf
 create mode 100644 NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.uni
 create mode 100644 NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxeExtra.uni
 create mode 100644 NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxeStrings.uni
 create mode 100644 NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigImpl.c
 create mode 100644 NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigImpl.h
 create mode 100644 NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigNvData.h
 create mode 100644 NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigVfr.vfr

-- 
1.9.5.msysgit.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] NetworkPkg: Don't need to update device path in home environment

2016-04-22 Thread El-Haj-Mahmoud, Samer
Ting, Siyuan, Jiaxin,

Can one of you please commit this change if you have no objections?

Thanks,
--Samer

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
El-Haj-Mahmoud, Samer
Sent: Friday, April 15, 2016 8:26 AM
To: Li, Gary (HPS SW) ; edk2-devel@lists.01.org
Cc: ting...@intel.com; siyuan...@intel.com; jiaxin...@intel.com
Subject: Re: [edk2] [PATCH] NetworkPkg: Don't need to update device path in 
home environment

Reviewed-by: Samer El-Haj-Mahmoud  

-Original Message-
From: Li, Gary (HPS SW)
Sent: Thursday, April 14, 2016 10:32 PM
To: edk2-devel@lists.01.org
Cc: El-Haj-Mahmoud, Samer ; siyuan...@intel.com; 
jiaxin...@intel.com; ting...@intel.com; Li, Gary (HPS SW) 
Subject: [PATCH] NetworkPkg: Don't need to update device path in home 
environment

Don't need to update device path in home environment

Contributed-under: TianoCore Contribution Agreement 1.0

Signed-off-by: Gary Li 
---
 NetworkPkg/HttpBootDxe/HttpBootClient.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/NetworkPkg/HttpBootDxe/HttpBootClient.c 
b/NetworkPkg/HttpBootDxe/HttpBootClient.c
index 9d445e3..7c28009 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootClient.c
+++ b/NetworkPkg/HttpBootDxe/HttpBootClient.c
@@ -36,6 +36,13 @@ HttpBootUpdateDevicePath (
   UINTN  Length;
   EFI_STATUS Status;
 
+  //
+  // Don't need to update device path in home environment  //  if 
+ (Private->FilePathUri != NULL) {
+return EFI_SUCCESS;
+  }
+
   TmpDevicePath = NULL;
   
   //
--
2.7.2.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] OVMF broken under Xen (in PCI initialisation)

2016-04-22 Thread Anthony PERARD
Hi,

Following the switch to MdeModulePkg/Bus/Pci/PciHostBridgeDxe, the pci root
bridge does not finish to initialize and breaks under Xen.

There are several issue probably due to the use of
PcdPciDisableBusEnumeration=TRUE.

First one:
ASSERT MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c(99): 
Bridge->Mem.Limit < 0x0001ULL

This patch would fix the first assert:
diff --git a/OvmfPkg/PlatformPei/Xen.c b/OvmfPkg/PlatformPei/Xen.c
index 7fa9019..15ec7a7 100644
--- a/OvmfPkg/PlatformPei/Xen.c
+++ b/OvmfPkg/PlatformPei/Xen.c
@@ -227,5 +227,11 @@ InitializeXen (

   PcdSetBool (PcdPciDisableBusEnumeration, TRUE);

+  // Values from hvmloader
+#define PCI_MEM_END 0xFC00
+#define HVM_BELOW_4G_MMIO_START 0xF000
+  PcdSet64 (PcdPciMmio32Base, HVM_BELOW_4G_MMIO_START);
+  PcdSet64 (PcdPciMmio32Size, PCI_MEM_END - HVM_BELOW_4G_MMIO_START);
+
   return EFI_SUCCESS;
 }


But that not enough, next assert is:
ASSERT MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c(807): RootBridge != 
((void *) 0)

I have worked around this one with the following patch. That would
correspond to how the former implementation in OvmfPkg was initializing the
struct. Maybe a better way would be to fill ResAllocated under Xen,
somehow. Under Xen, the ResAllocNode status is not allocated, so no
Descriptor are created.

diff --git a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c 
b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c
index cda9b49..eda92b6 100644
--- a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c
+++ b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c
@@ -1509,15 +1509,13 @@ RootBridgeIoConfiguration (

 ResAllocNode = &RootBridge->ResAllocNode[Index];

-if (ResAllocNode->Status != ResAllocated) {
-  continue;
-}
-
 Descriptor->Desc = ACPI_ADDRESS_SPACE_DESCRIPTOR;
 Descriptor->Len  = sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR) - 3;
+if (ResAllocNode->Status != ResAllocated) {
 Descriptor->AddrRangeMin  = ResAllocNode->Base;
 Descriptor->AddrRangeMax  = ResAllocNode->Base + ResAllocNode->Length - 1;
 Descriptor->AddrLen   = ResAllocNode->Length;
+}
 switch (ResAllocNode->Type) {


That leads to one last assert:
> QemuVideo: Cirrus 5446 detected
> InstallProtocolInterface: 09576E91-6D3F-11D2-8E39-00A0C969723B 7B9EF598
> Adding Mode 0 as Cirrus Internal Mode 0: 640x480, 32-bit, 60 Hz
> Adding Mode 1 as Cirrus Internal Mode 1: 800x600, 32-bit, 60 Hz
> Adding Mode 2 as Cirrus Internal Mode 2: 1024x768, 24-bit, 60 Hz
> PixelBlueGreenRedReserved8BitPerColor
> ASSERT 
> /local/home/sheep/work/ovmf/MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c(1789): 
> ((BOOLEAN)(0==1))
For this one, I've workaround by reverting patch 7b0a1ea
(MdeModuelPkg/PciBus: Return AddrTranslationOffset in GetBarAttributes).
That issue was introduce while still using the USE_OLD_PCI_HOST.

Any idee or pointer on how to fix those issues ?

Thanks,

-- 
Anthony PERARD
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH v4 1/3] Platforms/ARM/Juno: Fix IO window min/max base address in PCIe root complex

2016-04-22 Thread Leif Lindholm
On Wed, Apr 20, 2016 at 06:35:06PM +0100, Sudeep Holla wrote:
> XPress-RICH3 PCIe driver initializes the root complex with the source
> and target address for IO window. The root complex resources in SSDT
> should match these settings.
> 
> This patch fixes the min/max base address for the IO window in Juno PCIe
> root complex ACPI table. It also adds 'TypeTranslation' to the IO window
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Cc: Ard Biesheuvel 
> Cc: Leif Lindholm 
> Cc: Tomasz Nowicki 
> Cc: Graeme Gregory 
> Signed-off-by: Sudeep Holla 

Would anyone like to add any ACKs/Reviewed-bys?

> ---
>  Platforms/ARM/Juno/AcpiTables/AcpiSsdtRootPci.asl | 7 ---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> v3->v4:
>   - Fixed the max to match the length and added TypeTranslation
> v2->v3:
>   - Fixed $subject and the commit log
> v1->v2:
>   - Made changes as suggested by Graeme & Tomasz
> 
> diff --git a/Platforms/ARM/Juno/AcpiTables/AcpiSsdtRootPci.asl 
> b/Platforms/ARM/Juno/AcpiTables/AcpiSsdtRootPci.asl
> index 800d2cb3b2fb..969c42398f18 100644
> --- a/Platforms/ARM/Juno/AcpiTables/AcpiSsdtRootPci.asl
> +++ b/Platforms/ARM/Juno/AcpiTables/AcpiSsdtRootPci.asl
> @@ -107,10 +107,11 @@ DefinitionBlock("SsdtPci.aml", "SSDT", 1, "ARMLTD", 
> "ARM-JUNO", EFI_ACPI_ARM_OEM
>   PosDecode,
>   EntireRange,
>   0x, 
> // Granularity
> - 0x5f80, 
> // Min Base Address
> - 0x5fff, 
> // Max Base Address
> + 0x, 
> // Min Base Address
> + 0x007f, 
> // Max Base Address
>   0x5f80, 
> // Translate
> - 0x0080  
> // Length
> + 0x0080, 
> // Length
> + ,,,TypeTranslation
>   )
>   }) // Name(RBUF)
>  
> -- 
> 1.9.1
> 
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] facing memory allocation failure on QEMU

2016-04-22 Thread Ard Biesheuvel
On 22 April 2016 at 11:25, Meenakshi Aggarwal
 wrote:
> Hi Ard,
>
>
>
> I try after enrolling KEK.der into DB and kernel booted up successfully.
> Thanks for your constant support.
>
>
> I have one question... I have enrolled DB.der into DB previously, when I try 
> to enroll another KEK.der into DB then it didn' t allow me.
>
> Then I delete the previously enrolled DB.der and enrolled KEK.der. Enrollment 
> succeeded now.
>
>
>
> Does it mean we can't add more than one ".der" file into DB and we have to 
> sign all our images with same key?
>

No, you can enroll multiple certificates into KEK and DB, but you need
to do it from the bottom up, or they will have to be signed themselves
as well

So enroll DB first, then KEK then PK
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] facing memory allocation failure on QEMU

2016-04-22 Thread Meenakshi Aggarwal
Hi Ard,



I try after enrolling KEK.der into DB and kernel booted up successfully.
Thanks for your constant support.


I have one question... I have enrolled DB.der into DB previously, when I try to 
enroll another KEK.der into DB then it didn' t allow me.

Then I delete the previously enrolled DB.der and enrolled KEK.der. Enrollment 
succeeded now.



Does it mean we can't add more than one ".der" file into DB and we have to sign 
all our images with same key?



Thanks,
Meenakshi

-Original Message-
From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org] 
Sent: Friday, April 22, 2016 1:55 PM
To: Meenakshi Aggarwal 
Cc: Laszlo Ersek ; edk2-devel@lists.01.org 

Subject: Re: [edk2] facing memory allocation failure on QEMU

On 22 April 2016 at 10:18, Meenakshi Aggarwal  
wrote:
> Hi Ard,
>
>
> I tried your image, its verification succeeded, then I tried my kernel 
> Image, verification succeeded for that as well.
>
>
> The only difference is... previously I was signing the image in /mnt 
> directory after mounting vexpress64-oe.img and replacing Image with latest 
> one.
> And Now I signed it elsewhere.
>
>
> Didn’t understand why this is happening because signed image of Grub and 
> HelloWorld works fine by following similar steps.
>
>
>
> Now, while I am launching kernel with this verified kernel image, I am 
> receiving following error:
>
> FS0:\> Image.signed root=/dev/vda2 console=ttyAMA0,38400n8 
> earlycon=pl011,0x9000
> 000
> FSOpen: Open '\Image.signed' Success
> FS0:\>  Open '\Image.signed' Success
> FSOpen: Open '\Image.signed' Success
> FSOpen: Open '\Image.signed' Success
> The image doesn't pass verification: 
> VenHw(837DCA9E-E874-4D82-B29A-23FE0E23D1E2,003E000A)/HD(1,MBR,
> 0x,0x3F,0x21FC0)/\Image.signed
> InstallProtocolInterface: 5B1B31A1-9562-11D2-8E3F-00A0C969723B 
> 7A73A8C0 Loading driver at 0x0007771F000 EntryPoint=0x000780D3FD0 
> Loading driver at 0x0007771F000 EntryPoint=0x000780D3FD0
> InstallProtocolInterface: BC62157E-3E33-4FEC-9920-2D3B36D750DF 
> 7A740B98 Unloading driver at 0x0007771F000 Command Error Status: 
> Security Violation
>

Yes, this is expected if you sign with KEK. You can simply enroll KEK.der into 
DB, and it should work fine.
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] MdeModulePkg/DxeCore: Avoid assertion in CoreLocateProtocol

2016-04-22 Thread Ruiyu Ni
The patch uses CoreAcquireLockOrFail() instead of
CoreAcquireProtocolLock() in CoreLocateProtocol() to avoid
assertion when CoreLocateProtocol() is called with the
protocol database locked.

The issue was found when changing PcdDebugPrintErrorLevel to
enable page/pool allocation debug message.
Nt32 platform hangs immediately after DxeCore is loaded.
Investigation shows the following calling stacks:

DxeCore entry point (Install a certain protocol)
0 DxeCore::CoreInstallProtocolInterface  // Protocol DB is locked
1 DxeCore::AllocatePool
2 PeiDxeDebugLibReportStatusCode::DebugPrint
3 DxeReportStatusCodeLib::ReportStatusCodeEx // <---|
4 DxeReportStatusCodeLib::InternalGetReportStatusCode   |
5 DxeCore::LocateProtocol(StatusCodeRuntimeProtocol)|
 // Assertion when locking Protocol DB 2nd time |
6 DxeCore::CoreAcquireProtocolLock  |
7 PeiDxeDebugLibReportStatusCode::DebugAssert   |
8 DxeReportStatusCodeLib::ReportSatusCodeEx  // loop begins -

In frame #6 the assertion is triggered due to the protocol database
is already locked. #8 calls #4 and the loop begins.
After changing #6 to CoreAcquireLockOrFail(), the assertion is
avoided and the loop is broken.

With the fix, NT32 can boot to Shell even setting
PcdDebugPrintErrorLevel to 0x, with all error levels turned
on.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni 
Cc: Liming Gao 
---
 MdeModulePkg/Core/Dxe/Hand/Locate.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/MdeModulePkg/Core/Dxe/Hand/Locate.c 
b/MdeModulePkg/Core/Dxe/Hand/Locate.c
index d98b55a..d2b6da8 100644
--- a/MdeModulePkg/Core/Dxe/Hand/Locate.c
+++ b/MdeModulePkg/Core/Dxe/Hand/Locate.c
@@ -1,7 +1,7 @@
 /** @file
   Locate handle functions
 
-Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2016, 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
 which accompanies this distribution.  The full text of the license may be 
found at
@@ -581,7 +581,10 @@ CoreLocateProtocol (
   //
   // Lock the protocol database
   //
-  CoreAcquireProtocolLock ();
+  Status = CoreAcquireLockOrFail (&gProtocolDatabaseLock);
+  if (EFI_ERROR (Status)) {
+return EFI_NOT_FOUND;
+  }
 
   mEfiLocateHandleRequest += 1;
 
-- 
2.7.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [patch] MdeModulePkg: Fix GCC code build error of iSCSI driver.

2016-04-22 Thread Wu, Jiaxin
Reviewed-by: Jiaxin Wu 


> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Zhang Lubo
> Sent: Friday, April 22, 2016 4:52 PM
> To: edk2-devel@lists.01.org
> Subject: [edk2] [patch] MdeModulePkg: Fix GCC code build error of iSCSI
> driver.
> 
> Fix GCC build error when refine the codes of iSCSI driver.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Zhang Lubo 
> ---
>  MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c
> b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c
> index bb48d8c..ae202c3 100644
> --- a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c
> +++ b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c
> @@ -587,21 +587,23 @@ IScsiCreateDriverData (
>  /**
>Clean the iSCSI driver data.
> 
>@param[in]  Private The iSCSI driver data.
> 
> -  @retval EFI_SUCCES  The clean operation is successful.
> +  @retval EFI_SUCCESS The clean operation is successful.
>@retval Others  Other errors as indicated.
> 
>  **/
>  EFI_STATUS
>  IScsiCleanDriverData (
>IN ISCSI_DRIVER_DATA  *Private
>)
>  {
>EFI_STATUS Status;
> 
> +  Status = EFI_SUCCESS;
> +
>if (Private->DevicePath != NULL) {
>  Status = gBS->UninstallProtocolInterface (
>  Private->ExtScsiPassThruHandle,
>  &gEfiDevicePathProtocolGuid,
>  Private->DevicePath
> --
> 1.9.5.msysgit.1
> 
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [patch] NetworkPkg: Fix GCC code build error of iSCSI driver.

2016-04-22 Thread Wu, Jiaxin
Since the patch break the GCC build, I will check it soon.

Reviewed-by: Jiaxin Wu 



> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Zhang Lubo
> Sent: Friday, April 22, 2016 4:55 PM
> To: edk2-devel@lists.01.org
> Subject: [edk2] [patch] NetworkPkg: Fix GCC code build error of iSCSI driver.
> 
> Fix GCC build error when refine the codes of iSCSI driver.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Zhang Lubo 
> ---
>  NetworkPkg/IScsiDxe/IScsiMisc.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/NetworkPkg/IScsiDxe/IScsiMisc.c
> b/NetworkPkg/IScsiDxe/IScsiMisc.c index 2406717..a1f2672 100644
> --- a/NetworkPkg/IScsiDxe/IScsiMisc.c
> +++ b/NetworkPkg/IScsiDxe/IScsiMisc.c
> @@ -857,21 +857,23 @@ IScsiCreateDriverData (
>  /**
>Clean the iSCSI driver data.
> 
>@param[in]  Private The iSCSI driver data.
> 
> -  @retval EFI_SUCCES  The clean operation is successful.
> +  @retval EFI_SUCCESS The clean operation is successful.
>@retval Others  Other errors as indicated.
> 
>  **/
>  EFI_STATUS
>  IScsiCleanDriverData (
>IN ISCSI_DRIVER_DATA  *Private
>)
>  {
>EFI_STATUSStatus;
> 
> +  Status = EFI_SUCCESS;
> +
>if (Private->DevicePath != NULL) {
>  Status = gBS->UninstallProtocolInterface (
>  Private->ExtScsiPassThruHandle,
>  &gEfiDevicePathProtocolGuid,
>  Private->DevicePath
> --
> 1.9.5.msysgit.1
> 
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [patch] NetworkPkg: Fix GCC code build error of iSCSI driver.

2016-04-22 Thread Zhang Lubo
Fix GCC build error when refine the codes of iSCSI driver.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo 
---
 NetworkPkg/IScsiDxe/IScsiMisc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/NetworkPkg/IScsiDxe/IScsiMisc.c b/NetworkPkg/IScsiDxe/IScsiMisc.c
index 2406717..a1f2672 100644
--- a/NetworkPkg/IScsiDxe/IScsiMisc.c
+++ b/NetworkPkg/IScsiDxe/IScsiMisc.c
@@ -857,21 +857,23 @@ IScsiCreateDriverData (
 /**
   Clean the iSCSI driver data.
 
   @param[in]  Private The iSCSI driver data.
 
-  @retval EFI_SUCCES  The clean operation is successful.
+  @retval EFI_SUCCESS The clean operation is successful.
   @retval Others  Other errors as indicated.
 
 **/
 EFI_STATUS
 IScsiCleanDriverData (
   IN ISCSI_DRIVER_DATA  *Private
   )
 {
   EFI_STATUSStatus;
 
+  Status = EFI_SUCCESS;
+
   if (Private->DevicePath != NULL) {
 Status = gBS->UninstallProtocolInterface (
 Private->ExtScsiPassThruHandle,
 &gEfiDevicePathProtocolGuid,
 Private->DevicePath
-- 
1.9.5.msysgit.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [patch] MdeModulePkg: Fix GCC code build error of iSCSI driver.

2016-04-22 Thread Zhang Lubo
Fix GCC build error when refine the codes of iSCSI driver.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo 
---
 MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c 
b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c
index bb48d8c..ae202c3 100644
--- a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c
+++ b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c
@@ -587,21 +587,23 @@ IScsiCreateDriverData (
 /**
   Clean the iSCSI driver data.
 
   @param[in]  Private The iSCSI driver data.
 
-  @retval EFI_SUCCES  The clean operation is successful.
+  @retval EFI_SUCCESS The clean operation is successful.
   @retval Others  Other errors as indicated.
 
 **/
 EFI_STATUS
 IScsiCleanDriverData (
   IN ISCSI_DRIVER_DATA  *Private
   )
 {
   EFI_STATUS Status;
 
+  Status = EFI_SUCCESS;
+  
   if (Private->DevicePath != NULL) {
 Status = gBS->UninstallProtocolInterface (
 Private->ExtScsiPassThruHandle,
 &gEfiDevicePathProtocolGuid,
 Private->DevicePath
-- 
1.9.5.msysgit.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch] MdeModulePkg: Correct PlatformHookLibSerialPortPpi module type.

2016-04-22 Thread Tian, Feng
Looks good to me

Reviewed-by: Feng Tian 

Thanks
Feng

-Original Message-
From: Gao, Liming 
Sent: Friday, April 15, 2016 1:41 PM
To: edk2-devel@lists.01.org
Cc: Tian, Feng 
Subject: [Patch] MdeModulePkg: Correct PlatformHookLibSerialPortPpi module type.

This library instance is PEIM type, not BASE type. It has the PPI dependency 
for PEIM.

Cc: Feng Tian 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao 
---
 .../PlatformHookLibSerialPortPpi/PlatformHookLibSerialPortPpi.inf | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/MdeModulePkg/Library/PlatformHookLibSerialPortPpi/PlatformHookLibSerialPortPpi.inf
 
b/MdeModulePkg/Library/PlatformHookLibSerialPortPpi/PlatformHookLibSerialPortPpi.inf
index 09074a8..d577506 100644
--- 
a/MdeModulePkg/Library/PlatformHookLibSerialPortPpi/PlatformHookLibSerialPortPpi.inf
+++ b/MdeModulePkg/Library/PlatformHookLibSerialPortPpi/PlatformHookLibS
+++ erialPortPpi.inf
@@ -16,9 +16,9 @@
   INF_VERSION= 0x00010005
   BASE_NAME  = PlatformHookLibSerialPortPpi
   FILE_GUID  = 621734D8-8B5E-4c01-B330-9F89A1081710
-  MODULE_TYPE= BASE
+  MODULE_TYPE= PEIM
   VERSION_STRING = 1.0
-  LIBRARY_CLASS  = PlatformHookLib
+  LIBRARY_CLASS  = PlatformHookLib|DXE_CORE DXE_DRIVER 
DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER SMM_CORE PEIM SEC PEI_CORE 
UEFI_APPLICATION UEFI_DRIVER
   MODULE_UNI_FILE= PlatformHookLibSerialPortPpi.uni
 
 #
--
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH] MdeModulePkg/PXE: Avoid using overloaded BootFileName or ServerName

2016-04-22 Thread Heyi Guo
BootFileName or ServerName in DHCP offer may be overloaded and cannot
be used, so we manually set the strings to be null to avoid misusing.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: chenzhihui 
Signed-off-by: Heyi Guo 
Cc: Feng Tian 
Cc: Star Zeng 
Cc: Siyuan Fu 
Cc: Jiaxin Wu 
---
 MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c 
b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c
index 6c06373..ecd1903 100644
--- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c
+++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c
@@ -172,6 +172,8 @@ PxeBcParseCachedDhcpPacket (
  );
 }
   }
+  // Terminate the invalid string to avoid misusing
+  Offer->Dhcp4.Header.BootFileName[0] = 0;
 }
 if ((Option->Data[0] & PXEBC_DHCP4_OVERLOAD_SERVER_NAME) != 0) {
   for (Index = 0; Index < PXEBC_DHCP4_TAG_INDEX_MAX; Index++) {
@@ -183,6 +185,8 @@ PxeBcParseCachedDhcpPacket (
  );
 }
   }
+  // Terminate the invalid string to avoid misusing
+  Offer->Dhcp4.Header.ServerName[0] = 0;
 }
   }
 
-- 
2.7.0

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] facing memory allocation failure on QEMU

2016-04-22 Thread Ard Biesheuvel
On 22 April 2016 at 10:18, Meenakshi Aggarwal
 wrote:
> Hi Ard,
>
>
> I tried your image, its verification succeeded,
> then I tried my kernel Image, verification succeeded for that as well.
>
>
> The only difference is... previously I was signing the image in /mnt 
> directory after mounting vexpress64-oe.img and replacing Image with latest 
> one.
> And Now I signed it elsewhere.
>
>
> Didn’t understand why this is happening because signed image of Grub and 
> HelloWorld works fine by following similar steps.
>
>
>
> Now, while I am launching kernel with this verified kernel image, I am 
> receiving following error:
>
> FS0:\> Image.signed root=/dev/vda2 console=ttyAMA0,38400n8 
> earlycon=pl011,0x9000
> 000
> FSOpen: Open '\Image.signed' Success
> FS0:\>  Open '\Image.signed' Success
> FSOpen: Open '\Image.signed' Success
> FSOpen: Open '\Image.signed' Success
> The image doesn't pass verification: 
> VenHw(837DCA9E-E874-4D82-B29A-23FE0E23D1E2,003E000A)/HD(1,MBR,0x,0x3F,0x21FC0)/\Image.signed
> InstallProtocolInterface: 5B1B31A1-9562-11D2-8E3F-00A0C969723B 7A73A8C0
> Loading driver at 0x0007771F000 EntryPoint=0x000780D3FD0
> Loading driver at 0x0007771F000 EntryPoint=0x000780D3FD0
> InstallProtocolInterface: BC62157E-3E33-4FEC-9920-2D3B36D750DF 7A740B98
> Unloading driver at 0x0007771F000
> Command Error Status: Security Violation
>

Yes, this is expected if you sign with KEK. You can simply enroll
KEK.der into DB, and it should work fine.
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] facing memory allocation failure on QEMU

2016-04-22 Thread Meenakshi Aggarwal
Hi Ard,


I tried your image, its verification succeeded, 
then I tried my kernel Image, verification succeeded for that as well.


The only difference is... previously I was signing the image in /mnt directory 
after mounting vexpress64-oe.img and replacing Image with latest one.
And Now I signed it elsewhere.


Didn’t understand why this is happening because signed image of Grub and 
HelloWorld works fine by following similar steps.



Now, while I am launching kernel with this verified kernel image, I am 
receiving following error:

FS0:\> Image.signed root=/dev/vda2 console=ttyAMA0,38400n8 earlycon=pl011,0x9000
000
FSOpen: Open '\Image.signed' Success
FS0:\>  Open '\Image.signed' Success
FSOpen: Open '\Image.signed' Success
FSOpen: Open '\Image.signed' Success
The image doesn't pass verification: 
VenHw(837DCA9E-E874-4D82-B29A-23FE0E23D1E2,003E000A)/HD(1,MBR,0x,0x3F,0x21FC0)/\Image.signed
InstallProtocolInterface: 5B1B31A1-9562-11D2-8E3F-00A0C969723B 7A73A8C0
Loading driver at 0x0007771F000 EntryPoint=0x000780D3FD0
Loading driver at 0x0007771F000 EntryPoint=0x000780D3FD0 
InstallProtocolInterface: BC62157E-3E33-4FEC-9920-2D3B36D750DF 7A740B98
Unloading driver at 0x0007771F000
Command Error Status: Security Violation




Thanks,
Meenakshi



-Original Message-
From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org] 
Sent: Friday, April 22, 2016 1:22 PM
To: Meenakshi Aggarwal 
Cc: Laszlo Ersek ; edk2-devel@lists.01.org 

Subject: Re: [edk2] facing memory allocation failure on QEMU

On 22 April 2016 at 09:43, Meenakshi Aggarwal  
wrote:
> Hi Ard,
>
>
> I tried signing my kernel image with KEK rather than DB (that’s what I 
> think you want me to do, hope I understood you correctly), But this too 
> didn't work for me.
>
>
> $ sudo ~/sbsigntools/src/sbsign --key KEK.key --cert KEK.crt --output 
> Image.signed Image Signing Unsigned original image
>
> $ sudo ~/sbsigntools/src/sbverify --cert KEK.crt Image.signed
> warning: file-aligned section .text extends beyond end of file  
> file_offset 0x1000, regions[n].size 0xb62000, image->size 0x51f000
> warning: checksum areas are greater than image size. Invalid section table?
> warning: checksum areas are greater than image size. Invalid section table?
> No signature table present
> Signature verification failed
>
>
> Am I using correct tag for kernel now?
>

Try this please

$ wget 
https://storage.kernelci.org/mainline/v4.6-rc4-124-g5f44abd041c5/arm64-defconfig/Image
2016-04-22 09:50:15 (452 KB/s) - ‘Image’ saved [11637248/11637248]

$ sbsign --key KEK.key --cert KEK.crt Image $ sbverify --cert KEK.crt 
Image.signed Signature verification OK $ sbsign --version sbsign 0.6
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH 02/12] MdeModulePkg: Add new driver to publish EDKII_PI_SMM_COMMUNICATION_REGION_TABLE.

2016-04-22 Thread Jiewen Yao
Add a driver to publish EDKII_PI_SMM_COMMUNICATION_REGION_TABLE, so that
other DXE driver can consume this table directly. NOTE: This is sample driver.
A platform may uses its own way to define default SMM communication buffer
region and publish information in its own
EDKII_PI_SMM_COMMUNICATION_REGION_TABLE.

This is designed to meet Microsoft WSMT table definition on FIXED_COMM_BUFFERS
requirement.

Cc: "Tian, Feng" 
Cc: "Laszlo Ersek" 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: "Yao, Jiewen" 
Reviewed-by: "Tian, Feng" 
---
 MdeModulePkg/MdeModulePkg.dsc  |   1 +
 .../SmmCommunicationBuffer.c   |  99 +
 .../SmmCommunicationBuffer.inf |  62 +
 .../SmmCommunicationBuffer.uni | Bin 0 -> 2794 bytes
 .../SmmCommunicationBufferExtra.uni| Bin 0 -> 1372 bytes
 5 files changed, 162 insertions(+)
 create mode 100644 
MdeModulePkg/Universal/SmmCommunicationBuffer/SmmCommunicationBuffer.c
 create mode 100644 
MdeModulePkg/Universal/SmmCommunicationBuffer/SmmCommunicationBuffer.inf
 create mode 100644 
MdeModulePkg/Universal/SmmCommunicationBuffer/SmmCommunicationBuffer.uni
 create mode 100644 
MdeModulePkg/Universal/SmmCommunicationBuffer/SmmCommunicationBufferExtra.uni

diff --git a/MdeModulePkg/MdeModulePkg.dsc b/MdeModulePkg/MdeModulePkg.dsc
index c2f5171..8cdcb07 100644
--- a/MdeModulePkg/MdeModulePkg.dsc
+++ b/MdeModulePkg/MdeModulePkg.dsc
@@ -448,6 +448,7 @@
   MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf
   MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmmDxe.inf
   MdeModulePkg/Universal/RegularExpressionDxe/RegularExpressionDxe.inf
+  MdeModulePkg/Universal/SmmCommunicationBuffer/SmmCommunicationBuffer.inf
 
 [Components.X64]
   MdeModulePkg/Universal/CapsulePei/CapsuleX64.inf
diff --git 
a/MdeModulePkg/Universal/SmmCommunicationBuffer/SmmCommunicationBuffer.c 
b/MdeModulePkg/Universal/SmmCommunicationBuffer/SmmCommunicationBuffer.c
new file mode 100644
index 000..3ad264b
--- /dev/null
+++ b/MdeModulePkg/Universal/SmmCommunicationBuffer/SmmCommunicationBuffer.c
@@ -0,0 +1,99 @@
+/** @file
+A driver allocates common SMM communication buffer in EfiReservedMemoryType.
+
+This driver allocates common SMM communication buffer in EfiReservedMemoryType,
+then it publishes the information to EFI configuration table with
+gEdkiiPiSmmCommunicationRegionTableGuid.
+Any other driver or application can get the table and know the common
+communication buffer.
+
+Copyright (c) 2016, 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
+which accompanies this distribution.  The full text of the license may be 
found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define DEFAULT_COMMON_PI_SMM_COMMUNIATION_REGION_PAGES  4
+
+/**
+  Entry Point for SMM communication buffer driver.
+
+  @param[in] ImageHandle  Image handle of this driver.
+  @param[in] SystemTable  A Pointer to the EFI System Table.
+
+  @retval EFI_SUCEESS
+  @return Others  Some error occurs.
+**/
+EFI_STATUS
+EFIAPI
+SmmCommunicationBufferEntryPoint (
+  IN EFI_HANDLEImageHandle,
+  IN EFI_SYSTEM_TABLE  *SystemTable
+  )
+{
+  EFI_STATUS   Status;
+  UINT32   DescriptorSize;
+  EDKII_PI_SMM_COMMUNICATION_REGION_TABLE  *PiSmmCommunicationRegionTable;
+  EFI_MEMORY_DESCRIPTOR*Entry;
+
+  DescriptorSize = sizeof(EFI_MEMORY_DESCRIPTOR);
+  //
+  // Make sure Size != sizeof(EFI_MEMORY_DESCRIPTOR). This will
+  // prevent people from having pointer math bugs in their code.
+  // now you have to use *DescriptorSize to make things work.
+  //
+  DescriptorSize += sizeof(UINT64) - (DescriptorSize % sizeof (UINT64));
+
+  //
+  // Allocate and fill PiSmmCommunicationRegionTable
+  //
+  PiSmmCommunicationRegionTable = AllocateReservedPool 
(sizeof(EDKII_PI_SMM_COMMUNICATION_REGION_TABLE) + DescriptorSize);
+  ASSERT(PiSmmCommunicationRegionTable != NULL);
+  ZeroMem (PiSmmCommunicationRegionTable, 
sizeof(EDKII_PI_SMM_COMMUNICATION_REGION_TABLE) + DescriptorSize);
+
+  PiSmmCommunicationRegionTable->Version = 
EDKII_PI_SMM_COMMUNICATION_REGION_TABLE_VERSION;
+  PiSmmCommunicationRegionTable->NumberOfEntries = 1;
+  PiSmmCommunicationRegionTable->DescriptorSize  = DescriptorSize;
+  Entry = (EFI_MEMORY_DESCRIPTOR *)(PiSmmCommunicationRegionTable + 1);
+  Entry->Type  = EfiConventionalMemory;
+  Entry->PhysicalStart = (EFI_PHYSICAL_ADDRESS)(UINTN)AllocateReservedPages 
(DEFA

[edk2] [PATCH 11/12] SecurityPkg-Opal(2): Enhance AHCI Bar MMIO region check.

2016-04-22 Thread Jiewen Yao
This patch enhance OPAL password SMM driver to check SMM bar is valid MMIO
besides outside of SMRAM.

This is designed to meet Microsoft WSMT table definition on FIXED_COMM_BUFFERS
requirement.

Cc: "Dong, Eric" 
Cc: "Tian, Feng" 
Cc: "Laszlo Ersek" 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: "Dong, Eric" 
Reviewed-by: "Tian, Feng" 
---
 .../Tcg/Opal/OpalPasswordSmm/OpalAhciMode.c| 30 -
 .../Tcg/Opal/OpalPasswordSmm/OpalPasswordSmm.c | 51 ++
 .../Tcg/Opal/OpalPasswordSmm/OpalPasswordSmm.h |  5 ++-
 .../Tcg/Opal/OpalPasswordSmm/OpalPasswordSmm.inf   |  2 +-
 4 files changed, 84 insertions(+), 4 deletions(-)

diff --git a/SecurityPkg/Tcg/Opal/OpalPasswordSmm/OpalAhciMode.c 
b/SecurityPkg/Tcg/Opal/OpalPasswordSmm/OpalAhciMode.c
index 0dc3490..33f77bd 100644
--- a/SecurityPkg/Tcg/Opal/OpalPasswordSmm/OpalAhciMode.c
+++ b/SecurityPkg/Tcg/Opal/OpalPasswordSmm/OpalAhciMode.c
@@ -1023,6 +1023,34 @@ GetAhciBarSize (
 }
 
 /**
+  This function check if the memory region is in GCD MMIO region.
+
+  @param Addr  The memory region start address to be checked.
+  @param Size  The memory region length to be checked.
+
+  @retval TRUE  This memory region is in GCD MMIO region.
+  @retval FALSE This memory region is not in GCD MMIO region.
+**/
+BOOLEAN
+EFIAPI
+OpalIsValidMmioSpace (
+  IN  EFI_PHYSICAL_ADDRESS   Addr,
+  IN  UINTN  Size
+  )
+{
+  UINTN   Index;
+  EFI_GCD_MEMORY_SPACE_DESCRIPTOR *Desc;
+
+  for (Index = 0; Index < mNumberOfDescriptors; Index ++) {
+Desc = &mGcdMemSpace[Index];
+if ((Desc->GcdMemoryType == EfiGcdMemoryTypeMemoryMappedIo) && (Addr >= 
Desc->BaseAddress) && ((Addr + Size) <= (Desc->BaseAddress + Desc->Length))) {
+  return TRUE;
+}
+  }
+
+  return FALSE;
+}
+/**
   Get AHCI mode base address registers' Value.
 
   @param[in] Bus The bus number of ata host controller.
@@ -1055,7 +1083,7 @@ GetAhciBaseAddress (
   //
   // Check if the AHCI Bar region is in SMRAM to avoid malicious attack by 
modifying MMIO Bar to point to SMRAM.
   //
-  if (!SmmIsBufferOutsideSmmValid ((EFI_PHYSICAL_ADDRESS)mAhciBar, Size)) {
+  if (!OpalIsValidMmioSpace ((EFI_PHYSICAL_ADDRESS)mAhciBar, Size)) {
 return EFI_UNSUPPORTED;
   }
 
diff --git a/SecurityPkg/Tcg/Opal/OpalPasswordSmm/OpalPasswordSmm.c 
b/SecurityPkg/Tcg/Opal/OpalPasswordSmm/OpalPasswordSmm.c
index 57d10a1..b7e2d55 100644
--- a/SecurityPkg/Tcg/Opal/OpalPasswordSmm/OpalPasswordSmm.c
+++ b/SecurityPkg/Tcg/Opal/OpalPasswordSmm/OpalPasswordSmm.c
@@ -61,6 +61,9 @@ VOID *mBuffer = NULL; // DMA can not 
read/write Data to smram, s
 // NVME
 NVME_CONTEXT mNvmeContext;
 
+EFI_GCD_MEMORY_SPACE_DESCRIPTOR   *mGcdMemSpace= NULL;
+UINTN mNumberOfDescriptors = 0;
+
 /**
   Add new bridge node or nvme device info to the device list.
 
@@ -593,6 +596,44 @@ S3SleepEntryCallBack (
 }
 
 /**
+  OpalPassword Notification for SMM EndOfDxe protocol.
+
+  @param[in] Protocol   Points to the protocol's unique identifier.
+  @param[in] Interface  Points to the interface instance.
+  @param[in] Handle The handle on which the interface was installed.
+
+  @retval EFI_SUCCESS   Notification runs successfully.
+**/
+EFI_STATUS
+EFIAPI
+OpalPasswordEndOfDxeNotification (
+  IN CONST EFI_GUID  *Protocol,
+  IN VOID*Interface,
+  IN EFI_HANDLE  Handle
+  )
+{
+  UINTNNumberOfDescriptors;
+  EFI_GCD_MEMORY_SPACE_DESCRIPTOR  *MemSpaceMap;
+  EFI_STATUS   Status;
+
+  Status = gDS->GetMemorySpaceMap (&NumberOfDescriptors, &MemSpaceMap);
+  if (EFI_ERROR (Status)) {
+return Status;
+  }
+
+  mGcdMemSpace = AllocateCopyPool (NumberOfDescriptors * sizeof 
(EFI_GCD_MEMORY_SPACE_DESCRIPTOR), MemSpaceMap);
+  if (EFI_ERROR (Status)) {
+gBS->FreePool (MemSpaceMap);
+return Status;
+  }
+
+  mNumberOfDescriptors = NumberOfDescriptors;
+  gBS->FreePool (MemSpaceMap);
+
+  return EFI_SUCCESS;
+}
+
+/**
   Main entry for this driver.
 
   @param ImageHandle Image handle this driver.
@@ -618,6 +659,7 @@ OpalPasswordSmmInit (
   EFI_SMM_VARIABLE_PROTOCOL *SmmVariable;
   OPAL_EXTRA_INFO_VAR   OpalExtraInfo;
   UINTN DataSize;
+  EFI_EVENT EndOfDxeEvent;
   EFI_PHYSICAL_ADDRESS  Address;
 
   mBuffer= NULL;
@@ -726,6 +768,15 @@ OpalPasswordSmmInit (
   //
   mSwSmiValue = (UINT8) Context.SwSmiInputValue;
 
+  //
+  // Create event to record GCD descriptors at end of dxe for judging 
AHCI/NVMe PCI Bar
+  // is in MMIO space to avoid attack.
+  //
+  Status = gSmst->SmmRegisterProtocolNotify (&gEfiSmmEndOfDxeProtocolGuid, 
OpalPasswordEndOfDxeNotification, &EndOfDxeEvent);
+  if (EFI_ERROR (Status)) {
+DEBUG((DEBUG_ERROR, "OpalPasswordSmm: Register SmmEndOfDxe fail, Status: 
%r\n", Status)

[edk2] [PATCH 06/12] MdeModulePkg-FPDT(1): Add SMM_FPDT_FUNCTION_GET_BOOT_RECORD_DATA_BY_OFFSET definition.

2016-04-22 Thread Jiewen Yao
This patch enhance performance data SMM communication by using fixed
SMM communication buffer.

A new command SMM_FPDT_FUNCTION_GET_BOOT_RECORD_DATA_BY_OFFSET is added,
because we need to support get partial PerformanceData to fixed SMM 
communication
buffer. If performance data is bigger than fixed SMM communication buffer,
the DXE agent need to call SMM_FPDT_FUNCTION_GET_BOOT_RECORD_DATA_BY_OFFSET
multiple times to get all data out.

This is designed to meet Microsoft WSMT table definition on FIXED_COMM_BUFFERS
requirement.

Cc: "Gao, Liming" 
Cc: "Tian, Feng" 
Cc: "Laszlo Ersek" 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: "Gao, Liming" 
Reviewed-by: "Tian, Feng" 
---
 MdeModulePkg/Include/Guid/FirmwarePerformance.h | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/MdeModulePkg/Include/Guid/FirmwarePerformance.h 
b/MdeModulePkg/Include/Guid/FirmwarePerformance.h
index a4aeda2..4697a2c 100644
--- a/MdeModulePkg/Include/Guid/FirmwarePerformance.h
+++ b/MdeModulePkg/Include/Guid/FirmwarePerformance.h
@@ -1,7 +1,7 @@
 /** @file
   ACPI Firmware Performance Data Table (FPDT) implementation specific 
definitions.
 
-  Copyright (c) 2011 - 2013, Intel Corporation. All rights reserved.
+  Copyright (c) 2011 - 2016, 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
   which accompanies this distribution.  The full text of the license may be 
found at
@@ -116,14 +116,16 @@ typedef struct {
 //
 // Log BOOT RECORD from SMM driver on boot time.
 //
-#define SMM_FPDT_FUNCTION_GET_BOOT_RECORD_SIZE  1
-#define SMM_FPDT_FUNCTION_GET_BOOT_RECORD_DATA  2
+#define SMM_FPDT_FUNCTION_GET_BOOT_RECORD_SIZE   1
+#define SMM_FPDT_FUNCTION_GET_BOOT_RECORD_DATA   2
+#define SMM_FPDT_FUNCTION_GET_BOOT_RECORD_DATA_BY_OFFSET 3
 
 typedef struct {
   UINTN Function;
   EFI_STATUSReturnStatus;
   UINTN BootRecordSize;
   VOID  *BootRecordData;
+  UINTN BootRecordOffset;
 } SMM_BOOT_RECORD_COMMUNICATE;
 
 extern EFI_GUID gEfiFirmwarePerformanceGuid;
-- 
2.7.4.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH 08/12] MdeModulePkg-FPDT(3): Use SMM_FPDT_FUNCTION_GET_BOOT_RECORD_DATA_BY_OFFSET in FpdtDxe.

2016-04-22 Thread Jiewen Yao
This patch enhance performance data SMM communication by using fixed
SMM communication buffer.

Update FpdtDxe to use fixed SMM communication buffer to get
performance data by SMM_FPDT_FUNCTION_GET_BOOT_RECORD_DATA_BY_OFFSET API.

This is designed to meet Microsoft WSMT table definition on FIXED_COMM_BUFFERS
requirement.

Cc: "Gao, Liming" 
Cc: "Tian, Feng" 
Cc: "Laszlo Ersek" 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: "Gao, Liming" 
Reviewed-by: "Tian, Feng" 
---
 .../FirmwarePerformanceDxe.c   | 118 ++---
 .../FirmwarePerformanceDxe.inf |   3 +-
 2 files changed, 79 insertions(+), 42 deletions(-)

diff --git 
a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.c
 
b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.c
index 423e8f2..6f6ea07 100644
--- 
a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.c
+++ 
b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.c
@@ -5,7 +5,7 @@
   for Firmware Basic Boot Performance Record and other boot performance 
records, 
   and install FPDT to ACPI table.
 
-  Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.
+  Copyright (c) 2011 - 2016, 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
   which accompanies this distribution.  The full text of the license may be 
found at
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -337,6 +338,12 @@ InstallFirmwarePerformanceDataTable (
   UINT8 *BootPerformanceData; 
   EFI_SMM_COMMUNICATION_PROTOCOL  *Communication;
   FIRMWARE_PERFORMANCE_VARIABLE PerformanceVariable;
+  EDKII_PI_SMM_COMMUNICATION_REGION_TABLE *SmmCommRegionTable;
+  EFI_MEMORY_DESCRIPTOR *SmmCommMemRegion;
+  UINTN Index;
+  VOID  *SmmBootRecordData;
+  UINTN SmmBootRecordDataSize;
+  UINTN ReservedMemSize;
 
   //
   // Get AcpiTable Protocol.
@@ -351,40 +358,74 @@ InstallFirmwarePerformanceDataTable (
   //
   SmmBootRecordCommBuffer = NULL;
   SmmCommData = NULL;
+  SmmBootRecordData   = NULL;
+  SmmBootRecordDataSize   = 0;
+  ReservedMemSize = 0;
   Status = gBS->LocateProtocol (&gEfiSmmCommunicationProtocolGuid, NULL, (VOID 
**) &Communication);
   if (!EFI_ERROR (Status)) {
 //
 // Initialize communicate buffer 
+// Get the prepared Reserved Memory Range
 //
-SmmBootRecordCommBuffer = AllocateZeroPool (SMM_BOOT_RECORD_COMM_SIZE);
-ASSERT (SmmBootRecordCommBuffer != NULL);
-SmmCommBufferHeader = (EFI_SMM_COMMUNICATE_HEADER*)SmmBootRecordCommBuffer;
-SmmCommData = (SMM_BOOT_RECORD_COMMUNICATE*)SmmCommBufferHeader->Data;
-ZeroMem((UINT8*)SmmCommData, sizeof(SMM_BOOT_RECORD_COMMUNICATE));
-
-CopyGuid (&SmmCommBufferHeader->HeaderGuid, &gEfiFirmwarePerformanceGuid);
-SmmCommBufferHeader->MessageLength = sizeof(SMM_BOOT_RECORD_COMMUNICATE);
-CommSize = SMM_BOOT_RECORD_COMM_SIZE;
-  
-//
-// Get the size of boot records.
-//
-SmmCommData->Function   = SMM_FPDT_FUNCTION_GET_BOOT_RECORD_SIZE;
-SmmCommData->BootRecordData = NULL;
-Status = Communication->Communicate (Communication, 
SmmBootRecordCommBuffer, &CommSize);
-ASSERT_EFI_ERROR (Status);
-  
-if (!EFI_ERROR (SmmCommData->ReturnStatus) && SmmCommData->BootRecordSize 
!= 0) {
+Status = EfiGetSystemConfigurationTable (
+  &gEdkiiPiSmmCommunicationRegionTableGuid, 
+  (VOID **) &SmmCommRegionTable
+  );
+if (!EFI_ERROR (Status)) {
+  ASSERT (SmmCommRegionTable != NULL);
+  SmmCommMemRegion = (EFI_MEMORY_DESCRIPTOR *) (SmmCommRegionTable + 1);
+  for (Index = 0; Index < SmmCommRegionTable->NumberOfEntries; Index ++) {
+if (SmmCommMemRegion->Type == EfiConventionalMemory) {
+  break;
+}
+SmmCommMemRegion = (EFI_MEMORY_DESCRIPTOR *) ((UINT8 *) 
SmmCommMemRegion + SmmCommRegionTable->DescriptorSize);
+  }
+  ASSERT (Index < SmmCommRegionTable->NumberOfEntries);
+  ASSERT (SmmCommMemRegion->PhysicalStart > 0);
+  ASSERT (SmmCommMemRegion->NumberOfPages > 0);
+  ReservedMemSize = (UINTN) SmmCommMemRegion->NumberOfPages * 
EFI_PAGE_SIZE;
+
   //
-  // Get all boot records
+  // Check enough reserved memory space
   //
-  SmmCommData->Function   = SMM_FPDT_FUNCTION_GET_BOOT_RECORD_DATA;
-  SmmCommData->BootRecordData = 
AllocateZeroPool(SmmCommData->BootRecordSize);
-  ASSERT (SmmCommData->BootRecordData != NULL);
+  if (ReservedMemSize > SMM_BOOT_RECORD_COMM_SIZE) {
+SmmBootRecordCommBuffer = (VOID *) (UINTN) 
SmmCommMemRegion->Physical

[edk2] [PATCH 03/12] MdeModulePkg-MemoryProfile(1): Add SMRAM_PROFILE_COMMAND_GET_PROFILE_DATA_BY_OFFSET definition.

2016-04-22 Thread Jiewen Yao
This patch enhance SMM memory profile SMM communication by using fixed
SMM communication buffer.

A new command SMRAM_PROFILE_COMMAND_GET_PROFILE_DATA_BY_OFFSET is added,
because we need to support get partial ProfileData to fixed SMM communication
buffer. If profile data is bigger than fixed SMM communication buffer,
the DXE agent need to call SMRAM_PROFILE_COMMAND_GET_PROFILE_DATA_BY_OFFSET
multiple times to get all data out.

This is designed to meet Microsoft WSMT table definition on FIXED_COMM_BUFFERS
requirement.

Cc: "Zeng, Star" 
Cc: "Tian, Feng" 
Cc: "Laszlo Ersek" 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: "Zeng, Star" 
Reviewed-by: "Tian, Feng" 
---
 MdeModulePkg/Include/Guid/MemoryProfile.h | 27 ++-
 1 file changed, 22 insertions(+), 5 deletions(-)

diff --git a/MdeModulePkg/Include/Guid/MemoryProfile.h 
b/MdeModulePkg/Include/Guid/MemoryProfile.h
index a2f0325..9c70b9d 100644
--- a/MdeModulePkg/Include/Guid/MemoryProfile.h
+++ b/MdeModulePkg/Include/Guid/MemoryProfile.h
@@ -1,7 +1,7 @@
 /** @file
   Memory profile data structure.
 
-  Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.
+  Copyright (c) 2014 - 2016, 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
   which accompanies this distribution.  The full text of the license may be 
found at
@@ -237,13 +237,15 @@ struct _EDKII_MEMORY_PROFILE_PROTOCOL {
 //
 // SMRAM profile command
 //
-#define SMRAM_PROFILE_COMMAND_GET_PROFILE_INFO 0x1
-#define SMRAM_PROFILE_COMMAND_GET_PROFILE_DATA 0x2
+#define SMRAM_PROFILE_COMMAND_GET_PROFILE_INFO   0x1
+#define SMRAM_PROFILE_COMMAND_GET_PROFILE_DATA   0x2
 //
 // Below 2 commands are now used by ECP only and only valid before 
SmmReadyToLock
 //
-#define SMRAM_PROFILE_COMMAND_REGISTER_IMAGE   0x3
-#define SMRAM_PROFILE_COMMAND_UNREGISTER_IMAGE 0x4
+#define SMRAM_PROFILE_COMMAND_REGISTER_IMAGE 0x3
+#define SMRAM_PROFILE_COMMAND_UNREGISTER_IMAGE   0x4
+
+#define SMRAM_PROFILE_COMMAND_GET_PROFILE_DATA_BY_OFFSET 0x5
 
 typedef struct {
   UINT32Command;
@@ -264,6 +266,21 @@ typedef struct {
 
 typedef struct {
   SMRAM_PROFILE_PARAMETER_HEADERHeader;
+  //
+  // On input, profile buffer size.
+  // On output, actual profile data size copied.
+  //
+  UINT64ProfileSize;
+  PHYSICAL_ADDRESS  ProfileBuffer;
+  //
+  // On input, profile buffer offset to copy.
+  // On output, next time profile buffer offset to copy.
+  //
+  UINT64ProfileOffset;
+} SMRAM_PROFILE_PARAMETER_GET_PROFILE_DATA_BY_OFFSET;
+
+typedef struct {
+  SMRAM_PROFILE_PARAMETER_HEADERHeader;
   EFI_GUID  FileName;
   PHYSICAL_ADDRESS  ImageBuffer;
   UINT64NumberOfPage;
-- 
2.7.4.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH 10/12] SecurityPkg-Opal(1): Use fixed SMM communication buffer in OPAL password lib.

2016-04-22 Thread Jiewen Yao
This patch enhance OPAL password lib SMM communication by using fixed
SMM communication buffer.

Update OPAL password lib to consume EDKII_PI_SMM_COMMUNICATION_REGION_TABLE
as fixed communication buffer for SMM communication.

This is designed to meet Microsoft WSMT table definition on FIXED_COMM_BUFFERS
requirement.

Cc: "Dong, Eric" 
Cc: "Tian, Feng" 
Cc: "Laszlo Ersek" 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: "Dong, Eric" 
Reviewed-by: "Tian, Feng" 
---
 .../OpalPasswordSupportLib.c   | 32 --
 .../OpalPasswordSupportLib.inf |  4 +++
 .../OpalPasswordSupportNotify.h|  2 +-
 3 files changed, 34 insertions(+), 4 deletions(-)

diff --git 
a/SecurityPkg/Library/OpalPasswordSupportLib/OpalPasswordSupportLib.c 
b/SecurityPkg/Library/OpalPasswordSupportLib/OpalPasswordSupportLib.c
index eead27f..8375823 100644
--- a/SecurityPkg/Library/OpalPasswordSupportLib/OpalPasswordSupportLib.c
+++ b/SecurityPkg/Library/OpalPasswordSupportLib/OpalPasswordSupportLib.c
@@ -401,8 +401,36 @@ OpalInitCommunicateBuffer (
   EFI_SMM_COMMUNICATE_HEADER*SmmCommunicateHeader;
   OPAL_SMM_COMMUNICATE_HEADER   *SmmFunctionHeader;
   VOID  *Buffer;
+  EDKII_PI_SMM_COMMUNICATION_REGION_TABLE   *SmmCommRegionTable;
+  EFI_MEMORY_DESCRIPTOR *SmmCommMemRegion;
+  UINTN Index;
+  UINTN Size;
+  EFI_STATUSStatus;
+
+  Buffer = NULL;
+  Status = EfiGetSystemConfigurationTable (
+ &gEdkiiPiSmmCommunicationRegionTableGuid,
+ (VOID **) &SmmCommRegionTable
+ );
+  if (EFI_ERROR (Status)) {
+return NULL;
+  }
 
-  Buffer = AllocateZeroPool (DataSize + OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, 
Data) + OFFSET_OF (OPAL_SMM_COMMUNICATE_HEADER, Data));
+  ASSERT (SmmCommRegionTable != NULL);
+  SmmCommMemRegion = (EFI_MEMORY_DESCRIPTOR *) (SmmCommRegionTable + 1);
+  Size = 0;
+  for (Index = 0; Index < SmmCommRegionTable->NumberOfEntries; Index++) {
+if (SmmCommMemRegion->Type == EfiConventionalMemory) {
+  Size = EFI_PAGES_TO_SIZE ((UINTN) SmmCommMemRegion->NumberOfPages);
+  if (Size >= (DataSize + OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data) + 
OFFSET_OF (OPAL_SMM_COMMUNICATE_HEADER, Data))) {
+break;
+  }
+}
+SmmCommMemRegion = (EFI_MEMORY_DESCRIPTOR *) ((UINT8 *) SmmCommMemRegion + 
SmmCommRegionTable->DescriptorSize);
+  }
+  ASSERT (Index < SmmCommRegionTable->NumberOfEntries);
+
+  Buffer = (VOID*)(UINTN)SmmCommMemRegion->PhysicalStart;
   ASSERT (Buffer != NULL);
 
   SmmCommunicateHeader = (EFI_SMM_COMMUNICATE_HEADER *) Buffer;
@@ -513,8 +541,6 @@ OpalSupportSendPasword(
 
 EXIT:
   ZeroMem(Parameter, Length);
-  FreePool(Buffer);
-
   return Status;
 }
 
diff --git 
a/SecurityPkg/Library/OpalPasswordSupportLib/OpalPasswordSupportLib.inf 
b/SecurityPkg/Library/OpalPasswordSupportLib/OpalPasswordSupportLib.inf
index 274366b..b783135 100644
--- a/SecurityPkg/Library/OpalPasswordSupportLib/OpalPasswordSupportLib.inf
+++ b/SecurityPkg/Library/OpalPasswordSupportLib/OpalPasswordSupportLib.inf
@@ -43,9 +43,13 @@
 
 [Packages]
   MdePkg/MdePkg.dec
+  MdeModulePkg/MdeModulePkg.dec
   SecurityPkg/SecurityPkg.dec
 
 [Protocols]
   gEfiStorageSecurityCommandProtocolGuid ## CONSUMES
   gEfiSmmCommunicationProtocolGuid   ## CONSUMES
   gEfiSmmBase2ProtocolGuid   ## CONSUMES # 
only for SMM version
+
+[Guids]
+  gEdkiiPiSmmCommunicationRegionTableGuid   ## CONSUMES ## SystemTable
diff --git 
a/SecurityPkg/Library/OpalPasswordSupportLib/OpalPasswordSupportNotify.h 
b/SecurityPkg/Library/OpalPasswordSupportLib/OpalPasswordSupportNotify.h
index 59c1214..f0ad3a1 100644
--- a/SecurityPkg/Library/OpalPasswordSupportLib/OpalPasswordSupportNotify.h
+++ b/SecurityPkg/Library/OpalPasswordSupportLib/OpalPasswordSupportNotify.h
@@ -19,7 +19,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 #include 
 
 #include 
-
+#include 
 #include 
 #include 
 #include 
-- 
2.7.4.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH 00/12] Enhance SMM Communication by using fixed comm buffer.

2016-04-22 Thread Jiewen Yao
This series patches are generate to meet Microsoft WSMT table definition on
FIXED_COMM_BUFFERS requirement.

Before this series patches, the DXE or OS module can use any non-SMM memory
as communication buffer to exchange data with SMM agent. Microsoft WSMT table
has requirement to support fixed communication buffer - so that SMM agent
can only support communication buffer with type EfiReservedMemoryType/
EfiRuntimeServicesCode/EfiRuntimeServicesData/EfiACPIMemoryNVS, which will
not be used by OS during runtime.
So we clean up all SMM handler to only use these memory regions for SMM
communication, and enhance check in SmmMemLib to catch the violation.

This series patches are validated on real platforms with SMM enabled.

This series patches are validated on OVMF ia32-x64 with SMM enabled.

Cc: "Gao, Liming" 
Cc: "Tian, Feng" 
Cc: "Zeng, Star" 
Cc: "Dong, Eric" 
Cc: "Laszlo Ersek" 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: "Yao, Jiewen" 
Reviewed-by: "Tian, Feng" 
Reviewed-by: "Gao, Liming" 

Jiewen Yao (12):
  MdeModulePkg: Add EDKII_PI_SMM_COMMUNICATION_REGION_TABLE definition.
  MdeModulePkg: Add new driver to publish
EDKII_PI_SMM_COMMUNICATION_REGION_TABLE.
  MdeModulePkg-MemoryProfile(1): Add
SMRAM_PROFILE_COMMAND_GET_PROFILE_DATA_BY_OFFSET definition.
  MdeModulePkg-MemoryProfile(2): Add
SMRAM_PROFILE_COMMAND_GET_PROFILE_DATA_BY_OFFSET in PiSmmCore.
  MdeModulePkg-MemoryProfile(3): Use
SMRAM_PROFILE_COMMAND_GET_PROFILE_DATA_BY_OFFSET in
MemoryProfileInfo.
  MdeModulePkg-FPDT(1): Add
SMM_FPDT_FUNCTION_GET_BOOT_RECORD_DATA_BY_OFFSET definition.
  MdeModulePkg-FPDT(2): Add
SMM_FPDT_FUNCTION_GET_BOOT_RECORD_DATA_BY_OFFSET in FpdtSmm Handler.
  MdeModulePkg-FPDT(3): Use
SMM_FPDT_FUNCTION_GET_BOOT_RECORD_DATA_BY_OFFSET in FpdtDxe.
  MdeModulePkg-FPDT(4): Use
SMM_FPDT_FUNCTION_GET_BOOT_RECORD_DATA_BY_OFFSET in PerfLib.
  SecurityPkg-Opal(1): Use fixed SMM communication buffer in OPAL
password lib.
  SecurityPkg-Opal(2): Enhance AHCI Bar MMIO region check.
  MdePkg-SmmMemLib: Enhance SmmIsBufferOutsideSmmValid() check for fixed
comm buffer.

 .../MemoryProfileInfo/MemoryProfileInfo.c  | 103 ++---
 .../MemoryProfileInfo/MemoryProfileInfo.inf|   3 +-
 MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c   | 247 +
 MdeModulePkg/Include/Guid/FirmwarePerformance.h|   8 +-
 MdeModulePkg/Include/Guid/MemoryProfile.h  |  27 ++-
 .../Include/Guid/PiSmmCommunicationRegionTable.h   |  63 ++
 .../DxeSmmPerformanceLib/DxeSmmPerformanceLib.c| 154 ++---
 .../DxeSmmPerformanceLib/DxeSmmPerformanceLib.inf  |   3 +-
 MdeModulePkg/MdeModulePkg.dec  |   2 +
 MdeModulePkg/MdeModulePkg.dsc  |   1 +
 .../FirmwarePerformanceDxe.c   | 118 ++
 .../FirmwarePerformanceDxe.inf |   3 +-
 .../FirmwarePerformanceSmm.c   |  63 +++---
 .../SmmCommunicationBuffer.c   |  99 +
 .../SmmCommunicationBuffer.inf |  62 ++
 .../SmmCommunicationBuffer.uni | Bin 0 -> 2794 bytes
 .../SmmCommunicationBufferExtra.uni| Bin 0 -> 1372 bytes
 MdePkg/Library/SmmMemLib/SmmMemLib.c   | 180 ++-
 MdePkg/Library/SmmMemLib/SmmMemLib.inf |   6 +-
 .../OpalPasswordSupportLib.c   |  32 ++-
 .../OpalPasswordSupportLib.inf |   4 +
 .../OpalPasswordSupportNotify.h|   2 +-
 .../Tcg/Opal/OpalPasswordSmm/OpalAhciMode.c|  30 ++-
 .../Tcg/Opal/OpalPasswordSmm/OpalPasswordSmm.c |  51 +
 .../Tcg/Opal/OpalPasswordSmm/OpalPasswordSmm.h |   5 +-
 .../Tcg/Opal/OpalPasswordSmm/OpalPasswordSmm.inf   |   2 +-
 26 files changed, 1071 insertions(+), 197 deletions(-)
 create mode 100644 MdeModulePkg/Include/Guid/PiSmmCommunicationRegionTable.h
 create mode 100644 
MdeModulePkg/Universal/SmmCommunicationBuffer/SmmCommunicationBuffer.c
 create mode 100644 
MdeModulePkg/Universal/SmmCommunicationBuffer/SmmCommunicationBuffer.inf
 create mode 100644 
MdeModulePkg/Universal/SmmCommunicationBuffer/SmmCommunicationBuffer.uni
 create mode 100644 
MdeModulePkg/Universal/SmmCommunicationBuffer/SmmCommunicationBufferExtra.uni

-- 
2.7.4.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH 09/12] MdeModulePkg-FPDT(4): Use SMM_FPDT_FUNCTION_GET_BOOT_RECORD_DATA_BY_OFFSET in PerfLib.

2016-04-22 Thread Jiewen Yao
This patch enhance performance data SMM communication by using fixed
SMM communication buffer.

Update PerformanceLib to use fixed SMM communication buffer to get
performance data by SMM_FPDT_FUNCTION_GET_BOOT_RECORD_DATA_BY_OFFSET API.

This is designed to meet Microsoft WSMT table definition on FIXED_COMM_BUFFERS
requirement.

Cc: "Gao, Liming" 
Cc: "Tian, Feng" 
Cc: "Laszlo Ersek" 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: "Gao, Liming" 
Reviewed-by: "Tian, Feng" 
---
 .../DxeSmmPerformanceLib/DxeSmmPerformanceLib.c| 154 -
 .../DxeSmmPerformanceLib/DxeSmmPerformanceLib.inf  |   3 +-
 2 files changed, 122 insertions(+), 35 deletions(-)

diff --git a/MdeModulePkg/Library/DxeSmmPerformanceLib/DxeSmmPerformanceLib.c 
b/MdeModulePkg/Library/DxeSmmPerformanceLib/DxeSmmPerformanceLib.c
index 218cf8b..d8d0684 100644
--- a/MdeModulePkg/Library/DxeSmmPerformanceLib/DxeSmmPerformanceLib.c
+++ b/MdeModulePkg/Library/DxeSmmPerformanceLib/DxeSmmPerformanceLib.c
@@ -32,10 +32,13 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 
 #include 
 
+#include 
+#include 
+
 #define SMM_PERFORMANCE_COMMUNICATION_BUFFER_SIZE (OFFSET_OF 
(EFI_SMM_COMMUNICATE_HEADER, Data)  + sizeof (SMM_PERF_COMMUNICATE))
 
 EFI_SMM_COMMUNICATION_PROTOCOL  *mSmmCommunication = NULL;
-UINT8   
mSmmPerformanceBuffer[SMM_PERFORMANCE_COMMUNICATION_BUFFER_SIZE];
+UINT8   *mSmmPerformanceBuffer;
 GAUGE_DATA_ENTRY*mGaugeData = NULL;
 UINTN   mGaugeNumberOfEntries = 0;
 GAUGE_DATA_ENTRY_EX *mGaugeDataEx = NULL;
@@ -383,11 +386,18 @@ GetAllSmmGaugeData (
   IN UINTN  LogEntryKey
   )
 {
-  EFI_STATUS  Status;
-  EFI_SMM_COMMUNICATE_HEADER  *SmmCommBufferHeader;
-  SMM_PERF_COMMUNICATE*SmmPerfCommData;
-  UINTN   CommSize;
-  UINTN   DataSize;
+  EFI_STATUSStatus;
+  EFI_SMM_COMMUNICATE_HEADER*SmmCommBufferHeader;
+  SMM_PERF_COMMUNICATE  *SmmPerfCommData;
+  UINTN CommSize;
+  UINTN DataSize;
+  EDKII_PI_SMM_COMMUNICATION_REGION_TABLE   *PiSmmCommunicationRegionTable;
+  UINT32Index;
+  EFI_MEMORY_DESCRIPTOR *Entry;
+  UINT8 *Buffer;
+  UINTN Size;
+  UINTN NumberOfEntries;
+  UINTN EntriesGot;
 
   if (mNoSmmPerfHandler) {
 //
@@ -417,6 +427,28 @@ GetAllSmmGaugeData (
 return NULL;
   }
 
+  Status = EfiGetSystemConfigurationTable (
+ &gEdkiiPiSmmCommunicationRegionTableGuid,
+ (VOID **) &PiSmmCommunicationRegionTable
+ );
+  if (EFI_ERROR (Status)) {
+return NULL;
+  }
+  ASSERT (PiSmmCommunicationRegionTable != NULL);
+  Entry = (EFI_MEMORY_DESCRIPTOR *) (PiSmmCommunicationRegionTable + 1);
+  Size = 0;
+  for (Index = 0; Index < PiSmmCommunicationRegionTable->NumberOfEntries; 
Index++) {
+if (Entry->Type == EfiConventionalMemory) {
+  Size = EFI_PAGES_TO_SIZE ((UINTN) Entry->NumberOfPages);
+  if (Size >= (SMM_PERFORMANCE_COMMUNICATION_BUFFER_SIZE + sizeof 
(GAUGE_DATA_ENTRY))) {
+break;
+  }
+}
+Entry = (EFI_MEMORY_DESCRIPTOR *) ((UINT8 *) Entry + 
PiSmmCommunicationRegionTable->DescriptorSize);
+  }
+  ASSERT (Index < PiSmmCommunicationRegionTable->NumberOfEntries);
+  mSmmPerformanceBuffer = (UINT8 *) (UINTN) Entry->PhysicalStart;
+
   //
   // Initialize communicate buffer 
   //
@@ -441,24 +473,37 @@ GetAllSmmGaugeData (
   }
 
   mGaugeNumberOfEntries = SmmPerfCommData->NumberOfEntries;
-  
+
+  Buffer = mSmmPerformanceBuffer + SMM_PERFORMANCE_COMMUNICATION_BUFFER_SIZE;
+  NumberOfEntries = (Size - SMM_PERFORMANCE_COMMUNICATION_BUFFER_SIZE) / 
sizeof (GAUGE_DATA_ENTRY);
   DataSize = mGaugeNumberOfEntries * sizeof(GAUGE_DATA_ENTRY);
   mGaugeData = AllocateZeroPool(DataSize);
   ASSERT (mGaugeData != NULL);
-  
+
   //
   // Get all SMM gauge data
   //  
   SmmPerfCommData->Function = SMM_PERF_FUNCTION_GET_GAUGE_DATA;
-  SmmPerfCommData->LogEntryKey = 0;
-  SmmPerfCommData->NumberOfEntries = mGaugeNumberOfEntries;
-  SmmPerfCommData->GaugeData = mGaugeData;
-  Status = mSmmCommunication->Communicate (mSmmCommunication, 
mSmmPerformanceBuffer, &CommSize);
-  if (EFI_ERROR (Status) || EFI_ERROR (SmmPerfCommData->ReturnStatus)) {
-FreePool (mGaugeData);
-mGaugeData = NULL;
-mGaugeNumberOfEntries = 0;
-  }
+  SmmPerfCommData->GaugeData = (GAUGE_DATA_ENTRY *) Buffer;
+  EntriesGot = 0;
+  do {
+SmmPerfCommData->LogEntryKey = EntriesGot;
+if ((mGaugeNumberOfEntries - EntriesGot) >= NumberOfEntries) {
+  SmmPerfCommData->NumberOfEntries = NumberOfEntries;
+} els

[edk2] [PATCH 12/12] MdePkg-SmmMemLib: Enhance SmmIsBufferOutsideSmmValid() check for fixed comm buffer.

2016-04-22 Thread Jiewen Yao
This patch adds more check in SmmIsBufferOutsideSmmValid(), to make sure that
SMM communication buffer is only EfiReservedMemoryType/EfiRuntimeServicesCode/
EfiRuntimeServicesData/EfiACPIMemoryNVS. So that the communication buffer will
not touch any OS memory.

The assumption is that a platform reports valid SMM communication buffer at
EndOfDxe, because EndOfDxe is last hook point that SMM code can call-out to
get memory map information.
A platform MUST finish SMM communication buffer allocation before EndOfDxe.
If a DXE or OS driver need do communication after EndOfDxe, it can either
allocate SMM communication buffer before EndOfDxe and save it, or consume
EDKII_PI_SMM_COMMUNICATION_REGION_TABLE table to get general fixed comm buffer.

This is designed to meet Microsoft WSMT table definition on FIXED_COMM_BUFFERS
requirement.

Cc: "Gao, Liming" 
Cc: "Laszlo Ersek" 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: "Yao, Jiewen" 
Reviewed-by: "Gao, Liming" 
---
 MdePkg/Library/SmmMemLib/SmmMemLib.c   | 180 -
 MdePkg/Library/SmmMemLib/SmmMemLib.inf |   6 +-
 2 files changed, 183 insertions(+), 3 deletions(-)

diff --git a/MdePkg/Library/SmmMemLib/SmmMemLib.c 
b/MdePkg/Library/SmmMemLib/SmmMemLib.c
index 420c5a7..b4e3156 100644
--- a/MdePkg/Library/SmmMemLib/SmmMemLib.c
+++ b/MdePkg/Library/SmmMemLib/SmmMemLib.c
@@ -6,7 +6,7 @@
   all SMRAM range via SMM_ACCESS2_PROTOCOL, including the range for firmware 
(like SMM Core
   and SMM driver) and/or specific dedicated hardware.
 
-  Copyright (c) 2015, Intel Corporation. All rights reserved.
+  Copyright (c) 2015 - 2016, 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
   which accompanies this distribution.  The full text of the license may be 
found at
@@ -28,6 +28,11 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+
+#define NEXT_MEMORY_DESCRIPTOR(MemoryDescriptor, Size) \
+  ((EFI_MEMORY_DESCRIPTOR *)((UINT8 *)(MemoryDescriptor) + (Size)))
 
 EFI_SMRAM_DESCRIPTOR *mSmmMemLibInternalSmramRanges;
 UINTNmSmmMemLibInternalSmramCount;
@@ -37,6 +42,15 @@ UINTNmSmmMemLibInternalSmramCount;
 //
 EFI_PHYSICAL_ADDRESS  mSmmMemLibInternalMaximumSupportAddress = 0;
 
+UINTN mMemoryMapEntryCount;
+EFI_MEMORY_DESCRIPTOR *mMemoryMap;
+UINTN mDescriptorSize;
+
+VOID  *mRegistrationEndOfDxe;
+VOID  *mRegistrationReadyToLock;
+
+BOOLEAN   mSmmReadyToLock = FALSE;
+
 /**
   Calculate and save the maximum support address.
 
@@ -137,6 +151,34 @@ SmmIsBufferOutsideSmmValid (
 }
   }
 
+  //
+  // Check override for Valid Communication Region
+  //
+  if (mSmmReadyToLock) {
+EFI_MEMORY_DESCRIPTOR  *MemoryMap;
+BOOLEANInValidCommunicationRegion;
+
+InValidCommunicationRegion = FALSE;
+MemoryMap = mMemoryMap;
+for (Index = 0; Index < mMemoryMapEntryCount; Index++) {
+  if ((Buffer >= MemoryMap->PhysicalStart) &&
+  (Buffer + Length <= MemoryMap->PhysicalStart + LShiftU64 
(MemoryMap->NumberOfPages, EFI_PAGE_SHIFT))) {
+InValidCommunicationRegion = TRUE;
+  }
+  MemoryMap = NEXT_MEMORY_DESCRIPTOR(MemoryMap, mDescriptorSize);
+}
+
+if (!InValidCommunicationRegion) {
+  DEBUG ((
+EFI_D_ERROR,
+"SmmIsBufferOutsideSmmValid: Not in ValidCommunicationRegion: Buffer 
(0x%lx) - Length (0x%lx), ",
+Buffer,
+Length
+));
+  ASSERT (FALSE);
+  return FALSE;
+}
+  }
   return TRUE;
 }
 
@@ -277,6 +319,128 @@ SmmSetMem (
 }
 
 /**
+  Notification for SMM EndOfDxe protocol.
+
+  @param[in] Protocol   Points to the protocol's unique identifier.
+  @param[in] Interface  Points to the interface instance.
+  @param[in] Handle The handle on which the interface was installed.
+
+  @retval EFI_SUCCESS   Notification runs successfully.
+**/
+EFI_STATUS
+EFIAPI
+SmmLibInternalEndOfDxeNotify (
+  IN CONST EFI_GUID  *Protocol,
+  IN VOID*Interface,
+  IN EFI_HANDLE  Handle
+  )
+{
+  EFI_STATUSStatus;
+  UINTN MapKey;
+  UINTN MemoryMapSize;
+  EFI_MEMORY_DESCRIPTOR *MemoryMap;
+  EFI_MEMORY_DESCRIPTOR *MemoryMapStart;
+  EFI_MEMORY_DESCRIPTOR *SmmMemoryMapStart;
+  UINTN MemoryMapEntryCount;
+  UINTN DescriptorSize;
+  UINT32DescriptorVersion;
+  UINTN Index;
+
+  MemoryMapSize = 0;
+  MemoryMap = NULL;
+  Status = gBS->GetMemoryMap (
+ &MemoryMapSize,
+ MemoryMap,
+ &MapKey,
+ &DescriptorSize,
+ &DescriptorVersion
+ );
+  ASSERT (Status == EFI_BUFFER_TOO_SMALL);
+
+  do {
+Status = gBS->AllocatePool (EfiBootServicesData, MemoryMapSize, (VOID 
**)&MemoryMap);
+ASSER

[edk2] [PATCH 05/12] MdeModulePkg-MemoryProfile(3): Use SMRAM_PROFILE_COMMAND_GET_PROFILE_DATA_BY_OFFSET in MemoryProfileInfo.

2016-04-22 Thread Jiewen Yao
This patch enhance SMM memory profile SMM communication by using fixed
SMM communication buffer.

Update MemoryProfileInfo APP to use fixed SMM communication buffer to get
profile data by SMRAM_PROFILE_COMMAND_GET_PROFILE_DATA_BY_OFFSET API.

This is designed to meet Microsoft WSMT table definition on FIXED_COMM_BUFFERS
requirement.

Cc: "Zeng, Star" 
Cc: "Tian, Feng" 
Cc: "Laszlo Ersek" 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: "Zeng, Star" 
Reviewed-by: "Tian, Feng" 
---
 .../MemoryProfileInfo/MemoryProfileInfo.c  | 103 +++--
 .../MemoryProfileInfo/MemoryProfileInfo.inf|   3 +-
 2 files changed, 75 insertions(+), 31 deletions(-)

diff --git a/MdeModulePkg/Application/MemoryProfileInfo/MemoryProfileInfo.c 
b/MdeModulePkg/Application/MemoryProfileInfo/MemoryProfileInfo.c
index f69a3e7..ea2a00b 100644
--- a/MdeModulePkg/Application/MemoryProfileInfo/MemoryProfileInfo.c
+++ b/MdeModulePkg/Application/MemoryProfileInfo/MemoryProfileInfo.c
@@ -1,6 +1,6 @@
 /** @file
   
-  Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.
+  Copyright (c) 2014 - 2016, 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 
   which accompanies this distribution.  The full text of the license may be 
found at
@@ -11,6 +11,7 @@
 
 **/
 
+#include 
 #include 
 #include 
 #include 
@@ -30,6 +31,7 @@
 
 #include 
 #include 
+#include 
 
 CHAR16 *mActionString[] = {
   L"Unknown",
@@ -635,10 +637,17 @@ GetSmramProfileData (
   UINT8 *CommBuffer;
   EFI_SMM_COMMUNICATE_HEADER*CommHeader;
   SMRAM_PROFILE_PARAMETER_GET_PROFILE_INFO  *CommGetProfileInfo;
-  SMRAM_PROFILE_PARAMETER_GET_PROFILE_DATA  *CommGetProfileData;
-  UINT64ProfileSize;
-  PHYSICAL_ADDRESS  ProfileBuffer;
+  SMRAM_PROFILE_PARAMETER_GET_PROFILE_DATA_BY_OFFSET *CommGetProfileData;
+  UINTN ProfileSize;
+  VOID  *ProfileBuffer;
   EFI_SMM_COMMUNICATION_PROTOCOL*SmmCommunication;
+  UINTN MinimalSizeNeeded;
+  EDKII_PI_SMM_COMMUNICATION_REGION_TABLE   *PiSmmCommunicationRegionTable;
+  UINT32Index;
+  EFI_MEMORY_DESCRIPTOR *Entry;
+  VOID  *Buffer;
+  UINTN Size;
+  UINTN Offset;
 
   Status = gBS->LocateProtocol (&gEfiSmmCommunicationProtocolGuid, NULL, (VOID 
**) &SmmCommunication);
   if (EFI_ERROR (Status)) {
@@ -646,13 +655,39 @@ GetSmramProfileData (
 return Status;
   }
 
-  CommSize = sizeof (EFI_GUID) + sizeof (UINTN) + sizeof 
(SMRAM_PROFILE_PARAMETER_GET_PROFILE_DATA);
-  CommBuffer = AllocateZeroPool (CommSize);
-  if (CommBuffer == NULL) {
-Status = EFI_OUT_OF_RESOURCES;
-Print (L"SmramProfile: AllocateZeroPool (0x%x) for comm buffer - %r\n", 
CommSize, Status);
+  MinimalSizeNeeded = sizeof (EFI_GUID) +
+  sizeof (UINTN) +
+  MAX (sizeof (SMRAM_PROFILE_PARAMETER_GET_PROFILE_INFO),
+   sizeof 
(SMRAM_PROFILE_PARAMETER_GET_PROFILE_DATA_BY_OFFSET));
+  MinimalSizeNeeded += MAX (sizeof (MEMORY_PROFILE_CONTEXT),
+MAX (sizeof (MEMORY_PROFILE_DRIVER_INFO),
+ MAX (sizeof (MEMORY_PROFILE_ALLOC_INFO),
+  MAX (sizeof (MEMORY_PROFILE_DESCRIPTOR),
+   MAX (sizeof 
(MEMORY_PROFILE_FREE_MEMORY),
+sizeof 
(MEMORY_PROFILE_MEMORY_RANGE));
+
+  Status = EfiGetSystemConfigurationTable (
+ &gEdkiiPiSmmCommunicationRegionTableGuid,
+ (VOID **) &PiSmmCommunicationRegionTable
+ );
+  if (EFI_ERROR (Status)) {
+DEBUG ((EFI_D_ERROR, "SmramProfile: Get PiSmmCommunicationRegionTable - 
%r\n", Status));
 return Status;
   }
+  ASSERT (PiSmmCommunicationRegionTable != NULL);
+  Entry = (EFI_MEMORY_DESCRIPTOR *) (PiSmmCommunicationRegionTable + 1);
+  Size = 0;
+  for (Index = 0; Index < PiSmmCommunicationRegionTable->NumberOfEntries; 
Index++) {
+if (Entry->Type == EfiConventionalMemory) {
+  Size = EFI_PAGES_TO_SIZE ((UINTN) Entry->NumberOfPages);
+  if (Size >= MinimalSizeNeeded) {
+break;
+  }
+}
+Entry = (EFI_MEMORY_DESCRIPTOR *) ((UINT8 *) Entry + 
PiSmmCommunicationRegionTable->DescriptorSize);
+  }
+  ASSERT (Index < PiSmmCommunicationRegionTable->NumberOfEntries);
+  CommBuffer = (UINT8 *) (UINTN) Entry->PhysicalStart;
 
   //
   // Get Size
@@ -670,7 +705,6

[edk2] [PATCH 01/12] MdeModulePkg: Add EDKII_PI_SMM_COMMUNICATION_REGION_TABLE definition.

2016-04-22 Thread Jiewen Yao
This configuration table is used to describe platform pre-allocated memory
for SMM communication buffer. If DXE driver wants to communicate with SMM
agent, it can use this memory as SMM communication buffer instead of allocate
new memory region.

This is designed to meet Microsoft WSMT table definition on FIXED_COMM_BUFFERS
requirement.

Cc: "Tian, Feng" 
Cc: "Laszlo Ersek" 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: "Yao, Jiewen" 
Reviewed-by: "Tian, Feng" 
---
 .../Include/Guid/PiSmmCommunicationRegionTable.h   | 63 ++
 MdeModulePkg/MdeModulePkg.dec  |  2 +
 2 files changed, 65 insertions(+)
 create mode 100644 MdeModulePkg/Include/Guid/PiSmmCommunicationRegionTable.h

diff --git a/MdeModulePkg/Include/Guid/PiSmmCommunicationRegionTable.h 
b/MdeModulePkg/Include/Guid/PiSmmCommunicationRegionTable.h
new file mode 100644
index 000..e3021ef
--- /dev/null
+++ b/MdeModulePkg/Include/Guid/PiSmmCommunicationRegionTable.h
@@ -0,0 +1,63 @@
+/** @file
+
+Copyright (c) 2015, 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 that accompanies this 
distribution.  
+The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php.
  
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,  
   
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef _PI_SMM_COMMUNICATION_REGION_TABLE_H_
+#define _PI_SMM_COMMUNICATION_REGION_TABLE_H_
+
+#define EDKII_PI_SMM_COMMUNICATION_REGION_TABLE_GUID {\
+  0x4e28ca50, 0xd582, 0x44ac, {0xa1, 0x1f, 0xe3, 0xd5, 0x65, 0x26, 0xdb, 0x34} 
\
+}
+
+//
+// This table to declare the generic SMM communication buffer location.
+// If this table is present, it means the SMM communication buffer is 
restricted to
+// EfiReservedMemoryType, EfiACPIMemoryNVS, or EfiRuntimeServicesData.
+//
+// This table is installed to UEFI configuration table by generic driver
+// or platform driver, at early DXE phase.
+// 
+// The EFI_MEMORY_DESCRIPTOR entry must contain at least one entry.
+// The entries must be normal memory region in EfiReservedMemoryType, 
EfiACPIMemoryNVS,
+// or EfiRuntimeServicesData.
+// If the Entry.Type is EfiConventionalMemory, it means this entry is free to 
use.
+// If the Entry.Type is other, it means this entry is occupied.
+//
+// Any non-SMM component may put communication data there, then use 
+// UEFI defined SMM Communication ACPI Table, or PI defined 
EFI_SMM_COMMUNICATION_PROTOCOL
+// to communicate with SMI handler. The process is:
+// 1) Find an entry whose type is EfiConventional.
+// 2) Change type to be EfiReservedMemoryType before use.
+// 3) Use it.
+// 4) Restore type be EfiConventional.
+//The step 2) must be performed as an atomic transaction, if there might 
be conflict during runtime.
+//For example, on IA-32/x64 platforms, this can be done using the CMPXCHG 
CPU instruction.
+//If there is guarantee on no conflict during boot time, these steps can 
be skipped.
+//For example, DXE, UEFI driver and UEFI application runs in sequence.
+//
+// For example, FPDT driver can use this communication buffer to get SMM
+// performance data in SMM. Profile driver can use this communication buffer
+// to get SMM profile data in SMM.
+//
+typedef struct {
+  UINT32Version;
+  UINT32NumberOfEntries;
+  UINT32DescriptorSize;
+  UINT32Reserved;
+//EFI_MEMORY_DESCRIPTOR Entry[1];
+} EDKII_PI_SMM_COMMUNICATION_REGION_TABLE;
+
+#define EDKII_PI_SMM_COMMUNICATION_REGION_TABLE_VERSION  0x0001
+
+extern EFI_GUID gEdkiiPiSmmCommunicationRegionTableGuid;
+
+#endif
diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index 935554c..a133824 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -347,6 +347,8 @@
   ## Include/Guid/RamDiskHii.h
   gRamDiskFormSetGuid= { 0x2a46715f, 0x3581, 0x4a55, { 0x8e, 0x73, 
0x2b, 0x76, 0x9a, 0xaa, 0x30, 0xc5 }}
 
+  ## Include/Guid/PiSmmCommunicationRegionTable.h
+  gEdkiiPiSmmCommunicationRegionTableGuid = { 0x4e28ca50, 0xd582, 0x44ac, 
{0xa1, 0x1f, 0xe3, 0xd5, 0x65, 0x26, 0xdb, 0x34}}
 
 [Ppis]
   ## Include/Ppi/AtaController.h
-- 
2.7.4.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH 04/12] MdeModulePkg-MemoryProfile(2): Add SMRAM_PROFILE_COMMAND_GET_PROFILE_DATA_BY_OFFSET in PiSmmCore.

2016-04-22 Thread Jiewen Yao
This patch enhance SMM memory profile SMM communication by using fixed
SMM communication buffer.

Update PiSmmCore to handle SMRAM_PROFILE_COMMAND_GET_PROFILE_DATA_BY_OFFSET
request.

This is designed to meet Microsoft WSMT table definition on FIXED_COMM_BUFFERS
requirement.

Cc: "Zeng, Star" 
Cc: "Tian, Feng" 
Cc: "Laszlo Ersek" 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: "Zeng, Star" 
Reviewed-by: "Tian, Feng" 
---
 MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c | 247 +++
 1 file changed, 204 insertions(+), 43 deletions(-)

diff --git a/MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c 
b/MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c
index 72fd37e..57b34a0 100644
--- a/MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c
+++ b/MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c
@@ -1,7 +1,7 @@
 /** @file
   Support routines for SMRAM profile.
 
-  Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.
+  Copyright (c) 2014 - 2016, 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
   which accompanies this distribution.  The full text of the license may be 
found at
@@ -1256,11 +1256,17 @@ SmramProfileGetDataSize (
   Copy SMRAM profile data.
 
   @param ProfileBuffer  The buffer to hold SMRAM profile data.
+  @param ProfileSizeOn input, profile buffer size.
+On output, actual profile data size copied.
+  @param ProfileOffset  On input, profile buffer offset to copy.
+On output, next time profile buffer offset to copy.
 
 **/
 VOID
 SmramProfileCopyData (
-  IN VOID   *ProfileBuffer
+  OUT VOID  *ProfileBuffer,
+  IN OUT UINT64 *ProfileSize,
+  IN OUT UINT64 *ProfileOffset
   )
 {
   MEMORY_PROFILE_CONTEXT   *Context;
@@ -1283,15 +1289,28 @@ SmramProfileCopyData (
   MEMORY_PROFILE_FREE_MEMORY  *FreeMemory;
   MEMORY_PROFILE_MEMORY_RANGE *MemoryRange;
   MEMORY_PROFILE_DESCRIPTOR   *MemoryProfileDescriptor;
+  UINT64  Offset;
+  UINT64  RemainingSize;
 
   ContextData = GetSmramProfileContext ();
   if (ContextData == NULL) {
 return ;
   }
 
-  Context = ProfileBuffer;
-  CopyMem (Context, &ContextData->Context, sizeof (MEMORY_PROFILE_CONTEXT));
-  DriverInfo = (MEMORY_PROFILE_DRIVER_INFO *) (Context + 1);
+  RemainingSize = *ProfileSize;
+  Offset = 0;
+
+  if (*ProfileOffset < sizeof (MEMORY_PROFILE_CONTEXT)) {
+if (RemainingSize >= sizeof (MEMORY_PROFILE_CONTEXT)) {
+  Context = ProfileBuffer;
+  CopyMem (Context, &ContextData->Context, sizeof 
(MEMORY_PROFILE_CONTEXT));
+  RemainingSize -= sizeof (MEMORY_PROFILE_CONTEXT);
+  ProfileBuffer = (UINT8 *) ProfileBuffer + sizeof 
(MEMORY_PROFILE_CONTEXT);
+} else {
+  goto Done;
+}
+  }
+  Offset += sizeof (MEMORY_PROFILE_CONTEXT);
 
   DriverInfoList = ContextData->DriverInfoList;
   for (DriverLink = DriverInfoList->ForwardLink;
@@ -1303,8 +1322,17 @@ SmramProfileCopyData (
Link,
MEMORY_PROFILE_DRIVER_INFO_SIGNATURE
);
-CopyMem (DriverInfo, &DriverInfoData->DriverInfo, sizeof 
(MEMORY_PROFILE_DRIVER_INFO));
-AllocInfo = (MEMORY_PROFILE_ALLOC_INFO *) (DriverInfo + 1);
+if (*ProfileOffset < (Offset + sizeof (MEMORY_PROFILE_DRIVER_INFO))) {
+  if (RemainingSize >= sizeof (MEMORY_PROFILE_DRIVER_INFO)) {
+DriverInfo = ProfileBuffer;
+CopyMem (DriverInfo, &DriverInfoData->DriverInfo, sizeof 
(MEMORY_PROFILE_DRIVER_INFO));
+RemainingSize -= sizeof (MEMORY_PROFILE_DRIVER_INFO);
+ProfileBuffer = (UINT8 *) ProfileBuffer + sizeof 
(MEMORY_PROFILE_DRIVER_INFO);
+  } else {
+goto Done;
+  }
+}
+Offset += sizeof (MEMORY_PROFILE_DRIVER_INFO);
 
 AllocInfoList = DriverInfoData->AllocInfoList;
 for (AllocLink = AllocInfoList->ForwardLink;
@@ -1316,30 +1344,73 @@ SmramProfileCopyData (
 Link,
 MEMORY_PROFILE_ALLOC_INFO_SIGNATURE
 );
-  CopyMem (AllocInfo, &AllocInfoData->AllocInfo, sizeof 
(MEMORY_PROFILE_ALLOC_INFO));
-  AllocInfo += 1;
+  if (*ProfileOffset < (Offset + sizeof (MEMORY_PROFILE_ALLOC_INFO))) {
+if (RemainingSize >= sizeof (MEMORY_PROFILE_ALLOC_INFO)) {
+  AllocInfo = ProfileBuffer;
+  CopyMem (AllocInfo, &AllocInfoData->AllocInfo, sizeof 
(MEMORY_PROFILE_ALLOC_INFO));
+  RemainingSize -= sizeof (MEMORY_PROFILE_ALLOC_INFO);
+  ProfileBuffer = (UINT8 *) ProfileBuffer + sizeof 
(MEMORY_PROFILE_ALLOC_INFO);
+} else {
+  goto Done;
+}
+  }
+  Offset += sizeof (MEMORY_PROFILE_ALLOC_INFO);
 }
-
-DriverInfo = (MEMORY_PROFILE_DRIVER_INFO *) ((UINTN) (DriverInfo + 1) + 
sizeof (MEMORY_PROFILE_ALLOC_INFO) * (UINTN) DriverIn

[edk2] [PATCH 07/12] MdeModulePkg-FPDT(2): Add SMM_FPDT_FUNCTION_GET_BOOT_RECORD_DATA_BY_OFFSET in FpdtSmm Handler.

2016-04-22 Thread Jiewen Yao
This patch enhance performance data SMM communication by using fixed
SMM communication buffer.

Update FpdtSmm to handle SMM_FPDT_FUNCTION_GET_BOOT_RECORD_DATA_BY_OFFSET
request.

This is designed to meet Microsoft WSMT table definition on FIXED_COMM_BUFFERS
requirement.

Cc: "Gao, Liming" 
Cc: "Tian, Feng" 
Cc: "Laszlo Ersek" 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: "Gao, Liming" 
Reviewed-by: "Tian, Feng" 
---
 .../FirmwarePerformanceSmm.c   | 63 --
 1 file changed, 36 insertions(+), 27 deletions(-)

diff --git 
a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwarePerformanceSmm.c
 
b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwarePerformanceSmm.c
index 73188fb..c750331 100644
--- 
a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwarePerformanceSmm.c
+++ 
b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwarePerformanceSmm.c
@@ -11,7 +11,7 @@
 
   FpdtSmiHandler() will receive untrusted input and do basic validation.
 
-  Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.
+  Copyright (c) 2011 - 2016, 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
   which accompanies this distribution.  The full text of the license may be 
found at
@@ -210,6 +210,7 @@ FpdtSmiHandler (
 {
   EFI_STATUS   Status;
   SMM_BOOT_RECORD_COMMUNICATE  *SmmCommData;
+  UINTNBootRecordOffset;
   UINTNBootRecordSize;
   VOID *BootRecordData;
   UINTNTempCommBufferSize;
@@ -238,36 +239,44 @@ FpdtSmiHandler (
 
   switch (SmmCommData->Function) {
 case SMM_FPDT_FUNCTION_GET_BOOT_RECORD_SIZE :
-   SmmCommData->BootRecordSize = mBootRecordSize;
-   break;
+  SmmCommData->BootRecordSize = mBootRecordSize;
+  break;
 
 case SMM_FPDT_FUNCTION_GET_BOOT_RECORD_DATA :
-   BootRecordData = SmmCommData->BootRecordData;
-   BootRecordSize = SmmCommData->BootRecordSize;
-   if (BootRecordData == NULL || BootRecordSize < mBootRecordSize) {
- Status = EFI_INVALID_PARAMETER;
- break;
-   } 
-
-   //
-   // Sanity check
-   //
-   SmmCommData->BootRecordSize = mBootRecordSize;
-   if (!SmmIsBufferOutsideSmmValid ((UINTN)BootRecordData, 
mBootRecordSize)) {
- DEBUG ((EFI_D_ERROR, "FpdtSmiHandler: SMM Data buffer in SMRAM or 
overflow!\n"));
- Status = EFI_ACCESS_DENIED;
- break;
-   }
-
-   CopyMem (
- (UINT8*)BootRecordData, 
- mBootRecordBuffer, 
- mBootRecordSize
- );
-   break;
+  Status = EFI_UNSUPPORTED;
+  break;
+
+case SMM_FPDT_FUNCTION_GET_BOOT_RECORD_DATA_BY_OFFSET :
+  BootRecordOffset = SmmCommData->BootRecordOffset;
+  BootRecordData   = SmmCommData->BootRecordData;
+  BootRecordSize   = SmmCommData->BootRecordSize;
+  if (BootRecordData == NULL || BootRecordOffset >= mBootRecordSize) {
+Status = EFI_INVALID_PARAMETER;
+break;
+  }
+  
+  //
+  // Sanity check
+  //
+  if (BootRecordSize > mBootRecordSize - BootRecordOffset) {
+BootRecordSize = mBootRecordSize - BootRecordOffset;
+  }
+  SmmCommData->BootRecordSize = BootRecordSize;
+  if (!SmmIsBufferOutsideSmmValid ((UINTN)BootRecordData, BootRecordSize)) 
{
+DEBUG ((EFI_D_ERROR, "FpdtSmiHandler: SMM Data buffer in SMRAM or 
overflow!\n"));
+Status = EFI_ACCESS_DENIED;
+break;
+  }
+  
+  CopyMem (
+   (UINT8*)BootRecordData, 
+   mBootRecordBuffer + BootRecordOffset, 
+   BootRecordSize
+   );
+  break;
 
 default:
-   Status = EFI_UNSUPPORTED;
+  Status = EFI_UNSUPPORTED;
   }
 
   SmmCommData->ReturnStatus = Status;
-- 
2.7.4.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [patch] MdeModulePkg: refine codes of iSCSI driver.

2016-04-22 Thread Wu, Jiaxin
Lubo,  Please fix it ASAP.

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Ard Biesheuvel
> Sent: Friday, April 22, 2016 4:00 PM
> To: Wu, Jiaxin 
> Cc: Ye, Ting ; Zhang, Lubo ;
> edk2-devel@lists.01.org; Fu, Siyuan 
> Subject: Re: [edk2] [patch] MdeModulePkg: refine codes of iSCSI driver.
> 
> On 22 April 2016 at 09:37, Wu, Jiaxin  wrote:
> > Reviewed-by: Jiaxin Wu 
> >
> >
> >> -Original Message-
> >> From: Zhang, Lubo
> >> Sent: Tuesday, April 19, 2016 5:05 PM
> >> To: Ye, Ting ; edk2-devel@lists.01.org
> >> Cc: Fu, Siyuan ; Wu, Jiaxin
> >> 
> >> Subject: RE: [edk2] [patch] MdeModulePkg: refine codes of iSCSI driver.
> >>
> >> Thank you for your series comments,  will update them while checking in.
> >>
> >> Thanks
> >> Lubo
> >>
> >> -Original Message-
> >> From: Ye, Ting
> >> Sent: Tuesday, April 19, 2016 5:02 PM
> >> To: Zhang, Lubo ; edk2-devel@lists.01.org
> >> Cc: Fu, Siyuan ; Wu, Jiaxin
> >> 
> >> Subject: RE: [edk2] [patch] MdeModulePkg: refine codes of iSCSI driver.
> >>
> >> Same comment for this patch for MdeModulePkg:
> >>
> >> Suggest to update below comment for EFI_ACCESS_DENIED from
> >> +  @retval EFI_ACCESS_DENIED The interface was not removed because
> >> the interface is
> >> +still being used by a driver.
> >> To:
> >> :  The protocol could not be removed from the handle since its
> >> interfaces are being used.
> >>
> >> Other parts are good to me.
> >>
> >> Reviewed-by: Ye Ting 
> >>
> >> Thanks,
> >> Ting
> >>
> >> -Original Message-
> >> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf
> >> Of Zhang Lubo
> >> Sent: Monday, April 18, 2016 4:12 PM
> >> To: edk2-devel@lists.01.org
> >> Cc: Ye, Ting ; Fu, Siyuan ;
> >> Wu, Jiaxin 
> >> Subject: [edk2] [patch] MdeModulePkg: refine codes of iSCSI driver.
> >>
> >> Add error handling logic in DriverBingingStop function, it may return
> >> error status when invoking the UninstallProtocolInterface.
> >>
> >> Cc: Fu Siyuan 
> >> Cc: Ye Ting 
> >> Cc: Wu Jiaxin 
> >> Contributed-under: TianoCore Contribution Agreement 1.0
> >> Signed-off-by: Zhang Lubo 
> >> ---
> >>  .../Universal/Network/IScsiDxe/IScsiDriver.c   | 11 +--
> >>  .../Universal/Network/IScsiDxe/IScsiMisc.c | 38 ++
> 
> >>  .../Universal/Network/IScsiDxe/IScsiMisc.h |  9 +++--
> >>  3 files changed, 40 insertions(+), 18 deletions(-)
> >>
> >> diff --git a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiDriver.c
> >> b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiDriver.c
> >> index e55bee8..74379e1 100644
> >> --- a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiDriver.c
> >> +++ b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiDriver.c
> >> @@ -1,9 +1,9 @@
> >>  /** @file
> >>The entry point of IScsi driver.
> >>
> >> -Copyright (c) 2004 - 2015, Intel Corporation. All rights
> >> reserved.
> >> +Copyright (c) 2004 - 2016, 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  which
> >> accompanies this distribution.  The full text of the license may be
> >> found at http://opensource.org/licenses/bsd-license.php
> >>
> >> @@ -337,10 +337,14 @@ ON_ERROR:
> >>@param[in]  ChildHandleBuffer An array of child handles to be
> >> freed. May be NULL
> >>  if NumberOfChildren is 0.Not used.
> >>
> >>@retval EFI_SUCCESS   The device was stopped.
> >>@retval EFI_DEVICE_ERROR  The device could not be stopped due to a
> >> device error.
> >> +  @retval EFI_INVALID_PARAMETER Child handle is NULL.
> >> +  @retval EFI_ACCESS_DENIED The interface was not removed because
> >> the interface is
> >> +still being used by a driver.
> >> +
> >>  **/
> >>  EFI_STATUS
> >>  EFIAPI
> >>  IScsiDriverBindingStop (
> >>IN EFI_DRIVER_BINDING_PROTOCOL  *This, @@ -449,11 +453,14 @@
> >> IScsiDriverBindingStop (
> >>// Update the iSCSI Boot Firware Table.
> >>//
> >>IScsiPublishIbft ();
> >>
> >>IScsiSessionAbort (&Private->Session);
> >> -  IScsiCleanDriverData (Private);
> >> +  Status = IScsiCleanDriverData (Private);  if (EFI_ERROR (Status)) {
> >> +return Status;
> >> +  }
> >>
> >>return EFI_SUCCESS;
> >>  }
> >>
> >>  /**
> >> diff --git a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c
> >> b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c
> >> index ebd9f5b..bb48d8c 100644
> >> --- a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c
> >> +++ b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c
> >> @@ -1,9 +1,9 @@
> >>  /** @file
> >>Miscellaneous routines for iSCSI driver.
> >>
> >> -Copyright (c) 2004 - 2015, Intel Corporation. All rights
> >> reserved.
> >> +Copyright (c) 2004 - 2016, Intel Corporation. All rights
> >> +reserved.
> >>  This program and the accom

Re: [edk2] [patch] MdeModulePkg: refine codes of iSCSI driver.

2016-04-22 Thread Ard Biesheuvel
On 22 April 2016 at 09:37, Wu, Jiaxin  wrote:
> Reviewed-by: Jiaxin Wu 
>
>
>> -Original Message-
>> From: Zhang, Lubo
>> Sent: Tuesday, April 19, 2016 5:05 PM
>> To: Ye, Ting ; edk2-devel@lists.01.org
>> Cc: Fu, Siyuan ; Wu, Jiaxin 
>> Subject: RE: [edk2] [patch] MdeModulePkg: refine codes of iSCSI driver.
>>
>> Thank you for your series comments,  will update them while checking in.
>>
>> Thanks
>> Lubo
>>
>> -Original Message-
>> From: Ye, Ting
>> Sent: Tuesday, April 19, 2016 5:02 PM
>> To: Zhang, Lubo ; edk2-devel@lists.01.org
>> Cc: Fu, Siyuan ; Wu, Jiaxin 
>> Subject: RE: [edk2] [patch] MdeModulePkg: refine codes of iSCSI driver.
>>
>> Same comment for this patch for MdeModulePkg:
>>
>> Suggest to update below comment for EFI_ACCESS_DENIED from
>> +  @retval EFI_ACCESS_DENIED The interface was not removed because
>> the interface is
>> +still being used by a driver.
>> To:
>> :  The protocol could not be removed from the handle since its interfaces are
>> being used.
>>
>> Other parts are good to me.
>>
>> Reviewed-by: Ye Ting 
>>
>> Thanks,
>> Ting
>>
>> -Original Message-
>> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
>> Zhang Lubo
>> Sent: Monday, April 18, 2016 4:12 PM
>> To: edk2-devel@lists.01.org
>> Cc: Ye, Ting ; Fu, Siyuan ; Wu,
>> Jiaxin 
>> Subject: [edk2] [patch] MdeModulePkg: refine codes of iSCSI driver.
>>
>> Add error handling logic in DriverBingingStop function, it may return error
>> status when invoking the UninstallProtocolInterface.
>>
>> Cc: Fu Siyuan 
>> Cc: Ye Ting 
>> Cc: Wu Jiaxin 
>> Contributed-under: TianoCore Contribution Agreement 1.0
>> Signed-off-by: Zhang Lubo 
>> ---
>>  .../Universal/Network/IScsiDxe/IScsiDriver.c   | 11 +--
>>  .../Universal/Network/IScsiDxe/IScsiMisc.c | 38 
>> ++
>>  .../Universal/Network/IScsiDxe/IScsiMisc.h |  9 +++--
>>  3 files changed, 40 insertions(+), 18 deletions(-)
>>
>> diff --git a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiDriver.c
>> b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiDriver.c
>> index e55bee8..74379e1 100644
>> --- a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiDriver.c
>> +++ b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiDriver.c
>> @@ -1,9 +1,9 @@
>>  /** @file
>>The entry point of IScsi driver.
>>
>> -Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.
>> +Copyright (c) 2004 - 2016, 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  which
>> accompanies this distribution.  The full text of the license may be found at
>> http://opensource.org/licenses/bsd-license.php
>>
>> @@ -337,10 +337,14 @@ ON_ERROR:
>>@param[in]  ChildHandleBuffer An array of child handles to be freed. May
>> be NULL
>>  if NumberOfChildren is 0.Not used.
>>
>>@retval EFI_SUCCESS   The device was stopped.
>>@retval EFI_DEVICE_ERROR  The device could not be stopped due to a
>> device error.
>> +  @retval EFI_INVALID_PARAMETER Child handle is NULL.
>> +  @retval EFI_ACCESS_DENIED The interface was not removed because
>> the interface is
>> +still being used by a driver.
>> +
>>  **/
>>  EFI_STATUS
>>  EFIAPI
>>  IScsiDriverBindingStop (
>>IN EFI_DRIVER_BINDING_PROTOCOL  *This, @@ -449,11 +453,14 @@
>> IScsiDriverBindingStop (
>>// Update the iSCSI Boot Firware Table.
>>//
>>IScsiPublishIbft ();
>>
>>IScsiSessionAbort (&Private->Session);
>> -  IScsiCleanDriverData (Private);
>> +  Status = IScsiCleanDriverData (Private);  if (EFI_ERROR (Status)) {
>> +return Status;
>> +  }
>>
>>return EFI_SUCCESS;
>>  }
>>
>>  /**
>> diff --git a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c
>> b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c
>> index ebd9f5b..bb48d8c 100644
>> --- a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c
>> +++ b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c
>> @@ -1,9 +1,9 @@
>>  /** @file
>>Miscellaneous routines for iSCSI driver.
>>
>> -Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.
>> +Copyright (c) 2004 - 2016, 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  which
>> accompanies this distribution.  The full text of the license may be found at
>> http://opensource.org/licenses/bsd-license.php
>>
>> @@ -585,38 +585,50 @@ IScsiCreateDriverData (  }
>>
>>  /**
>>Clean the iSCSI driver data.
>>
>> -  @param[in]  Private The iSCSI driver data.
>> +  @param[in]  Private The iSCSI driver data.
>> +
>> +  @retval EFI_SUCCES  The clean operation is successful.
>> +  @retval Others  Other errors as indicated.
>> +
>>  **/
>> -VOID
>> +EFI_STATUS
>>  IScsiCl

Re: [edk2] facing memory allocation failure on QEMU

2016-04-22 Thread Ard Biesheuvel
On 22 April 2016 at 09:43, Meenakshi Aggarwal
 wrote:
> Hi Ard,
>
>
> I tried signing my kernel image with KEK rather than DB (that’s what I think 
> you want me to do, hope I understood you correctly),
> But this too didn't work for me.
>
>
> $ sudo ~/sbsigntools/src/sbsign --key KEK.key --cert KEK.crt --output 
> Image.signed Image
> Signing Unsigned original image
>
> $ sudo ~/sbsigntools/src/sbverify --cert KEK.crt Image.signed
> warning: file-aligned section .text extends beyond end of file
>  file_offset 0x1000, regions[n].size 0xb62000, image->size 0x51f000
> warning: checksum areas are greater than image size. Invalid section table?
> warning: checksum areas are greater than image size. Invalid section table?
> No signature table present
> Signature verification failed
>
>
> Am I using correct tag for kernel now?
>

Try this please

$ wget 
https://storage.kernelci.org/mainline/v4.6-rc4-124-g5f44abd041c5/arm64-defconfig/Image
2016-04-22 09:50:15 (452 KB/s) - ‘Image’ saved [11637248/11637248]

$ sbsign --key KEK.key --cert KEK.crt Image
$ sbverify --cert KEK.crt Image.signed
Signature verification OK
$ sbsign --version
sbsign 0.6
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] facing memory allocation failure on QEMU

2016-04-22 Thread Meenakshi Aggarwal
Hi Ard,


I tried signing my kernel image with KEK rather than DB (that’s what I think 
you want me to do, hope I understood you correctly),
But this too didn't work for me.


$ sudo ~/sbsigntools/src/sbsign --key KEK.key --cert KEK.crt --output 
Image.signed Image
Signing Unsigned original image

$ sudo ~/sbsigntools/src/sbverify --cert KEK.crt Image.signed
warning: file-aligned section .text extends beyond end of file
 file_offset 0x1000, regions[n].size 0xb62000, image->size 0x51f000
warning: checksum areas are greater than image size. Invalid section table?
warning: checksum areas are greater than image size. Invalid section table?
No signature table present
Signature verification failed


Am I using correct tag for kernel now?


Thanks,
Meenakshi

-Original Message-
From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org] 
Sent: Friday, April 22, 2016 12:48 PM
To: Meenakshi Aggarwal 
Cc: Laszlo Ersek ; edk2-devel@lists.01.org 

Subject: Re: [edk2] facing memory allocation failure on QEMU

On 22 April 2016 at 08:49, Meenakshi Aggarwal  
wrote:
> Hi Ard,
>
>
> I cloned tag "llct-20160105.0" from 
> git://git.linaro.org/kernel/linux-linaro-tracking.git.
>
> commit 62862d5eec1567de047fe52551d6eb73683a4a9f
> Merge: 564a141 e117bc4
> Author: Andrey Konovalov 
> Date:   Tue Jan 5 21:25:31 2016 +0300
>
> Merge branch 'tracking-llct-misc-fixes' into 
> merge-linux-linaro-core-tracking
>
>
> I build it using commands mentioned on following page:
> http://releases.linaro.org/14.08/openembedded/aarch64/
>
> But launching signed image of this kernel is also giving similar issue.
>
>
> Please tell the specific patch/branch which I has fix for this.
>
> Here, I am launching kernel image directly from edk2 shell without following 
> shim->grub flow.
>
> Please tell if I need to follow SHIM->GRUB flow for launching kernel.
>

No, you don't need grub

I can sign and verify a kernel image just fine:

$ sbsign --key KEK.key --cert KEK.crt ~/linux-arm64-build/arch/arm64/boot/Image
$ sbverify --cert KEK.crt ~/linux-arm64-build/arch/arm64/boot/Image
Signature verification OK

Can you try to reproduce this first?
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [patch] NetworkPkg: refine codes of iSCSI driver.

2016-04-22 Thread Wu, Jiaxin
Reviewed-by: Jiaxin Wu 


> -Original Message-
> From: Zhang, Lubo
> Sent: Monday, April 18, 2016 4:13 PM
> To: edk2-devel@lists.01.org
> Cc: Fu, Siyuan ; Ye, Ting ; Wu,
> Jiaxin 
> Subject: [patch] NetworkPkg: refine codes of iSCSI driver.
> 
> Add error handling logic in DriverBingingStop function, it may return error
> status when invoking the UninstallProtocolInterface.
> 
> Cc: Fu Siyuan 
> Cc: Ye Ting 
> Cc: Wu Jiaxin 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Zhang Lubo 
> ---
>  NetworkPkg/IScsiDxe/IScsiDriver.c | 20 
>  NetworkPkg/IScsiDxe/IScsiMisc.c   | 25 +
>  NetworkPkg/IScsiDxe/IScsiMisc.h   |  9 ++---
>  3 files changed, 39 insertions(+), 15 deletions(-)
> 
> diff --git a/NetworkPkg/IScsiDxe/IScsiDriver.c
> b/NetworkPkg/IScsiDxe/IScsiDriver.c
> index 51ce169..cdc818f 100644
> --- a/NetworkPkg/IScsiDxe/IScsiDriver.c
> +++ b/NetworkPkg/IScsiDxe/IScsiDriver.c
> @@ -1,9 +1,9 @@
>  /** @file
>The entry point of IScsi driver.
> 
> -Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.
> +Copyright (c) 2004 - 2016, 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  which
> accompanies this distribution.  The full text of the license may be found at
> http://opensource.org/licenses/bsd-license.php
> 
> @@ -321,11 +321,13 @@ IScsiSupported (
>@retval EFI_SUCCESThis driver was started.
>@retval EFI_ALREADY_STARTED   This driver is already running on this
> device.
>@retval EFI_INVALID_PARAMETER Any input parameter is invalid.
>@retval EFI_NOT_FOUND There is no sufficient information to 
> establish
>  the iScsi session.
> -  @retval EFI_DEVICE_ERROR  Failed to get TCP connection device path.
> +  @retval EFI_DEVICE_ERROR  Failed to get TCP connection device path.
> +  @retval EFI_ACCESS_DENIED The interface was not removed because
> the interface is
> +still being used by a driver.
> 
>  **/
>  EFI_STATUS
>  IScsiStart (
>IN EFI_HANDLE   Image,
> @@ -861,11 +863,14 @@ IScsiStart (
>  IScsiRemoveNic (ExistPrivate->Controller);
>  if (ExistPrivate->Session != NULL) {
>IScsiSessionAbort (ExistPrivate->Session);
>  }
> 
> -IScsiCleanDriverData (ExistPrivate);
> +Status = IScsiCleanDriverData (ExistPrivate);
> +if (EFI_ERROR (Status)) {
> +  goto ON_ERROR;
> +}
>}
>  } else {
>//
>// Use the attempt in earlier order as boot selected in single path 
> mode.
>//
> @@ -961,10 +966,13 @@ ON_ERROR:
>  if NumberOfChildren is 0.
>@param[in]  IpVersion IP_VERSION_4 or IP_VERSION_6.
> 
>@retval EFI_SUCCESS   The device was stopped.
>@retval EFI_DEVICE_ERROR  The device could not be stopped due to a
> device error.
> +  @retval EFI_INVALID_PARAMETER Child handle is NULL.
> +  @retval EFI_ACCESS_DENIED The interface was not removed because
> the interface is
> +still being used by a driver.
> 
>  **/
>  EFI_STATUS
>  EFIAPI
>  IScsiStop (
> @@ -1103,11 +,15 @@ IScsiStop (
> 
>if (Private->Session != NULL) {
>  IScsiSessionAbort (Private->Session);
>}
> 
> -  IScsiCleanDriverData (Private);
> +  Status = IScsiCleanDriverData (Private);
> +
> +  if (EFI_ERROR (Status)) {
> +return Status;
> +  }
> 
>return EFI_SUCCESS;
>  }
> 
>  /**
> diff --git a/NetworkPkg/IScsiDxe/IScsiMisc.c
> b/NetworkPkg/IScsiDxe/IScsiMisc.c index 5fc25a0..2406717 100644
> --- a/NetworkPkg/IScsiDxe/IScsiMisc.c
> +++ b/NetworkPkg/IScsiDxe/IScsiMisc.c
> @@ -1,9 +1,9 @@
>  /** @file
>Miscellaneous routines for iSCSI driver.
> 
> -Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.
> +Copyright (c) 2004 - 2016, 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  which
> accompanies this distribution.  The full text of the license may be found at
> http://opensource.org/licenses/bsd-license.php
> 
> @@ -855,26 +855,32 @@ IScsiCreateDriverData (
> 
> 
>  /**
>Clean the iSCSI driver data.
> 
> -  @param[in]  Private The iSCSI driver data.
> +  @param[in]  Private The iSCSI driver data.
> +
> +  @retval EFI_SUCCES  The clean operation is successful.
> +  @retval Others  Other errors as indicated.
> 
>  **/
> -VOID
> +EFI_STATUS
>  IScsiCleanDriverData (
>IN ISCSI_DRIVER_DATA  *Private
>)
>  {
>EFI_STATUSStatus;
> 
>if (Private->DevicePath != NULL) {
> -gBS->UninstallProtocolInterface (
> -   Private->ExtScsiPassThruHandle,
> -   &gEfiDevicePathProtocolGuid,

Re: [edk2] [patch] MdeModulePkg: refine codes of iSCSI driver.

2016-04-22 Thread Wu, Jiaxin
Reviewed-by: Jiaxin Wu 


> -Original Message-
> From: Zhang, Lubo
> Sent: Tuesday, April 19, 2016 5:05 PM
> To: Ye, Ting ; edk2-devel@lists.01.org
> Cc: Fu, Siyuan ; Wu, Jiaxin 
> Subject: RE: [edk2] [patch] MdeModulePkg: refine codes of iSCSI driver.
> 
> Thank you for your series comments,  will update them while checking in.
> 
> Thanks
> Lubo
> 
> -Original Message-
> From: Ye, Ting
> Sent: Tuesday, April 19, 2016 5:02 PM
> To: Zhang, Lubo ; edk2-devel@lists.01.org
> Cc: Fu, Siyuan ; Wu, Jiaxin 
> Subject: RE: [edk2] [patch] MdeModulePkg: refine codes of iSCSI driver.
> 
> Same comment for this patch for MdeModulePkg:
> 
> Suggest to update below comment for EFI_ACCESS_DENIED from
> +  @retval EFI_ACCESS_DENIED The interface was not removed because
> the interface is
> +still being used by a driver.
> To:
> :  The protocol could not be removed from the handle since its interfaces are
> being used.
> 
> Other parts are good to me.
> 
> Reviewed-by: Ye Ting 
> 
> Thanks,
> Ting
> 
> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Zhang Lubo
> Sent: Monday, April 18, 2016 4:12 PM
> To: edk2-devel@lists.01.org
> Cc: Ye, Ting ; Fu, Siyuan ; Wu,
> Jiaxin 
> Subject: [edk2] [patch] MdeModulePkg: refine codes of iSCSI driver.
> 
> Add error handling logic in DriverBingingStop function, it may return error
> status when invoking the UninstallProtocolInterface.
> 
> Cc: Fu Siyuan 
> Cc: Ye Ting 
> Cc: Wu Jiaxin 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Zhang Lubo 
> ---
>  .../Universal/Network/IScsiDxe/IScsiDriver.c   | 11 +--
>  .../Universal/Network/IScsiDxe/IScsiMisc.c | 38 
> ++
>  .../Universal/Network/IScsiDxe/IScsiMisc.h |  9 +++--
>  3 files changed, 40 insertions(+), 18 deletions(-)
> 
> diff --git a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiDriver.c
> b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiDriver.c
> index e55bee8..74379e1 100644
> --- a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiDriver.c
> +++ b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiDriver.c
> @@ -1,9 +1,9 @@
>  /** @file
>The entry point of IScsi driver.
> 
> -Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.
> +Copyright (c) 2004 - 2016, 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  which
> accompanies this distribution.  The full text of the license may be found at
> http://opensource.org/licenses/bsd-license.php
> 
> @@ -337,10 +337,14 @@ ON_ERROR:
>@param[in]  ChildHandleBuffer An array of child handles to be freed. May
> be NULL
>  if NumberOfChildren is 0.Not used.
> 
>@retval EFI_SUCCESS   The device was stopped.
>@retval EFI_DEVICE_ERROR  The device could not be stopped due to a
> device error.
> +  @retval EFI_INVALID_PARAMETER Child handle is NULL.
> +  @retval EFI_ACCESS_DENIED The interface was not removed because
> the interface is
> +still being used by a driver.
> +
>  **/
>  EFI_STATUS
>  EFIAPI
>  IScsiDriverBindingStop (
>IN EFI_DRIVER_BINDING_PROTOCOL  *This, @@ -449,11 +453,14 @@
> IScsiDriverBindingStop (
>// Update the iSCSI Boot Firware Table.
>//
>IScsiPublishIbft ();
> 
>IScsiSessionAbort (&Private->Session);
> -  IScsiCleanDriverData (Private);
> +  Status = IScsiCleanDriverData (Private);  if (EFI_ERROR (Status)) {
> +return Status;
> +  }
> 
>return EFI_SUCCESS;
>  }
> 
>  /**
> diff --git a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c
> b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c
> index ebd9f5b..bb48d8c 100644
> --- a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c
> +++ b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c
> @@ -1,9 +1,9 @@
>  /** @file
>Miscellaneous routines for iSCSI driver.
> 
> -Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.
> +Copyright (c) 2004 - 2016, 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  which
> accompanies this distribution.  The full text of the license may be found at
> http://opensource.org/licenses/bsd-license.php
> 
> @@ -585,38 +585,50 @@ IScsiCreateDriverData (  }
> 
>  /**
>Clean the iSCSI driver data.
> 
> -  @param[in]  Private The iSCSI driver data.
> +  @param[in]  Private The iSCSI driver data.
> +
> +  @retval EFI_SUCCES  The clean operation is successful.
> +  @retval Others  Other errors as indicated.
> +
>  **/
> -VOID
> +EFI_STATUS
>  IScsiCleanDriverData (
>IN ISCSI_DRIVER_DATA  *Private
>)
>  {
> +  EFI_STATUS Status;
> +
>if (Private->DevicePath != NULL) {
> -gBS->UninstallPro

Re: [edk2] facing memory allocation failure on QEMU

2016-04-22 Thread Ard Biesheuvel
On 22 April 2016 at 08:49, Meenakshi Aggarwal
 wrote:
> Hi Ard,
>
>
> I cloned tag "llct-20160105.0" from 
> git://git.linaro.org/kernel/linux-linaro-tracking.git.
>
> commit 62862d5eec1567de047fe52551d6eb73683a4a9f
> Merge: 564a141 e117bc4
> Author: Andrey Konovalov 
> Date:   Tue Jan 5 21:25:31 2016 +0300
>
> Merge branch 'tracking-llct-misc-fixes' into 
> merge-linux-linaro-core-tracking
>
>
> I build it using commands mentioned on following page:
> http://releases.linaro.org/14.08/openembedded/aarch64/
>
> But launching signed image of this kernel is also giving similar issue.
>
>
> Please tell the specific patch/branch which I has fix for this.
>
> Here, I am launching kernel image directly from edk2 shell without following 
> shim->grub flow.
>
> Please tell if I need to follow SHIM->GRUB flow for launching kernel.
>

No, you don't need grub

I can sign and verify a kernel image just fine:

$ sbsign --key KEK.key --cert KEK.crt ~/linux-arm64-build/arch/arm64/boot/Image
$ sbverify --cert KEK.crt ~/linux-arm64-build/arch/arm64/boot/Image
Signature verification OK

Can you try to reproduce this first?
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] BaseTools: Fix the bug for .aml to use ASL binary type in Asbuilt inf

2016-04-22 Thread Yonghong Zhu
Per build spec, the .aml file should use ASL binary type in the Asbuilt
inf file. the original bug is .aml file may use BIN as binary type when
the module type is not BASE or USER_DEFINED. This patch 1) fix this bug.
2) fix some indent coding style issue.

Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu 
---
 BaseTools/Source/Python/AutoGen/AutoGen.py | 37 +-
 1 file changed, 16 insertions(+), 21 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py 
b/BaseTools/Source/Python/AutoGen/AutoGen.py
index 2cc6970..ae0f8a6 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -1113,11 +1113,11 @@ class PlatformAutoGen(AutoGen):
 self.IsCodeFileCreated = True
 
 ## Generate Fds Command
 def _GenFdsCommand(self):
 return self.Workspace.GenFdsCommand
-   
+
 ## Create makefile for the platform and mdoules in it
 #
 #   @param  CreateModuleMakeFileFlag indicating if the makefile for
 #   modules will be created as well
 #
@@ -3664,38 +3664,33 @@ class ModuleAutoGen(AutoGen):
 
 if DriverType:
 AsBuiltInfDict['pcd_is_driver_string'] += [DriverType]
 
 if 'UEFI_SPECIFICATION_VERSION' in self.Specification:
-  AsBuiltInfDict['module_uefi_specification_version'] += 
[self.Specification['UEFI_SPECIFICATION_VERSION']]
+AsBuiltInfDict['module_uefi_specification_version'] += 
[self.Specification['UEFI_SPECIFICATION_VERSION']]
 if 'PI_SPECIFICATION_VERSION' in self.Specification:
-  AsBuiltInfDict['module_pi_specification_version'] += 
[self.Specification['PI_SPECIFICATION_VERSION']]
+AsBuiltInfDict['module_pi_specification_version'] += 
[self.Specification['PI_SPECIFICATION_VERSION']]
 
 OutputDir = self.OutputDir.replace('\\', '/').strip('/')
-if self.ModuleType in ['BASE', 'USER_DEFINED']:
-  for Item in self.CodaTargetList:
+
+for Item in self.CodaTargetList:
 File = Item.Target.Path.replace('\\', 
'/').strip('/').replace(OutputDir, '').strip('/')
 if Item.Target.Ext.lower() == '.aml':
-  AsBuiltInfDict['binary_item'] += ['ASL|' + File]
+AsBuiltInfDict['binary_item'] += ['ASL|' + File]
 elif Item.Target.Ext.lower() == '.acpi':
-  AsBuiltInfDict['binary_item'] += ['ACPI|' + File]
-else:
-  AsBuiltInfDict['binary_item'] += ['BIN|' + File]
-else:
-  for Item in self.CodaTargetList:
-File = Item.Target.Path.replace('\\', 
'/').strip('/').replace(OutputDir, '').strip('/')
-if Item.Target.Ext.lower() == '.efi':
-  AsBuiltInfDict['binary_item'] += ['PE32|' + self.Name + '.efi']
+AsBuiltInfDict['binary_item'] += ['ACPI|' + File]
+elif Item.Target.Ext.lower() == '.efi':
+AsBuiltInfDict['binary_item'] += ['PE32|' + self.Name + '.efi']
 else:
-  AsBuiltInfDict['binary_item'] += ['BIN|' + File]
-  if self.DepexGenerated:
+AsBuiltInfDict['binary_item'] += ['BIN|' + File]
+if self.DepexGenerated:
 if self.ModuleType in ['PEIM']:
-  AsBuiltInfDict['binary_item'] += ['PEI_DEPEX|' + self.Name + 
'.depex']
+AsBuiltInfDict['binary_item'] += ['PEI_DEPEX|' + self.Name + 
'.depex']
 if self.ModuleType in ['DXE_DRIVER', 'DXE_RUNTIME_DRIVER', 
'DXE_SAL_DRIVER', 'UEFI_DRIVER']:
-  AsBuiltInfDict['binary_item'] += ['DXE_DEPEX|' + self.Name + 
'.depex']
+AsBuiltInfDict['binary_item'] += ['DXE_DEPEX|' + self.Name + 
'.depex']
 if self.ModuleType in ['DXE_SMM_DRIVER']:
-  AsBuiltInfDict['binary_item'] += ['SMM_DEPEX|' + self.Name + 
'.depex']
+AsBuiltInfDict['binary_item'] += ['SMM_DEPEX|' + self.Name + 
'.depex']
 
 Bin = self._GenOffsetBin()
 if Bin:
 AsBuiltInfDict['binary_item'] += ['BIN|%s' % Bin]
 
@@ -3843,12 +3838,12 @@ class ModuleAutoGen(AutoGen):
 PcdEntry = Pcd.TokenSpaceGuidCName + '.' + TokenCName
 if PcdComments:
 PcdEntry = PcdComments + '\n  ' + PcdEntry
 AsBuiltInfDict['pcd_item'] += [PcdEntry]
 for Item in self.BuildOption:
-  if 'FLAGS' in self.BuildOption[Item]:
-AsBuiltInfDict['flags_item'] += ['%s:%s_%s_%s_%s_FLAGS = %s' % 
(self.ToolChainFamily, self.BuildTarget, self.ToolChain, self.Arch, Item, 
self.BuildOption[Item]['FLAGS'].strip())]
+if 'FLAGS' in self.BuildOption[Item]:
+AsBuiltInfDict['flags_item'] += ['%s:%s_%s_%s_%s_FLAGS = %s' % 
(self.ToolChainFamily, self.BuildTarget, self.ToolChain, self.Arch, Item, 
self.BuildOption[Item]['FLAGS'].strip())]
 
 # Generated