Re: [edk2] [PATCH] NetworkPkg: Make HttpBootGetBootFile return EFI_BUFFER_TOO_SMALL

2016-05-08 Thread Wu, Jiaxin
Looks good to me.

Reviewed-By: Wu Jiaxin 

Best Regards!
Jiaxin

> -Original Message-
> From: Gary Lin [mailto:g...@suse.com]
> Sent: Monday, May 9, 2016 12:33 PM
> To: edk2-devel@lists.01.org
> Cc: Fu, Siyuan ; Wu, Jiaxin 
> Subject: [PATCH] NetworkPkg: Make HttpBootGetBootFile return
> EFI_BUFFER_TOO_SMALL
> 
> Per the description of HttpBootGetBootFile, the function should return
> EFI_BUFFER_TOO_SMALL if the given buffer is smaller than the remote
> image.
> 
> Cc: Siyuan Fu 
> Cc: Jiaxin Wu 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Gary Lin 
> ---
>  NetworkPkg/HttpBootDxe/HttpBootClient.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/NetworkPkg/HttpBootDxe/HttpBootClient.c
> b/NetworkPkg/HttpBootDxe/HttpBootClient.c
> index 9d445e3..46cf9ca 100644
> --- a/NetworkPkg/HttpBootDxe/HttpBootClient.c
> +++ b/NetworkPkg/HttpBootDxe/HttpBootClient.c
> @@ -1074,6 +1074,8 @@ HttpBootGetBootFile (
> 
>if (*BufferSize < ContentLength) {
>  Status = EFI_BUFFER_TOO_SMALL;
> +  } else {
> +Status = EFI_SUCCESS;
>}
>*BufferSize = ContentLength;
> 
> @@ -1089,7 +1091,7 @@ HttpBootGetBootFile (
>  HttpFreeMsgParser (Parser);
>}
> 
> -  return EFI_SUCCESS;
> +  return Status;
> 
>  ERROR_6:
>if (Parser != NULL) {
> --
> 2.8.2

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


[edk2] [Patch] MdeModulePkg/PciSioSerialDxe: Do not flush the UART

2016-05-08 Thread Ruiyu Ni
The patch aligns to the IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe
driver not flush the UART in Reset() and SetAttributes() function.
It was found the flush causes hang on certain PCI serial devices.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni 
Cc: Eric Jin 
---
 MdeModulePkg/Bus/Pci/PciSioSerialDxe/SerialIo.c | 27 +
 1 file changed, 1 insertion(+), 26 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/PciSioSerialDxe/SerialIo.c 
b/MdeModulePkg/Bus/Pci/PciSioSerialDxe/SerialIo.c
index f1870f3..cce61d7 100644
--- a/MdeModulePkg/Bus/Pci/PciSioSerialDxe/SerialIo.c
+++ b/MdeModulePkg/Bus/Pci/PciSioSerialDxe/SerialIo.c
@@ -1,7 +1,7 @@
 /** @file
   SerialIo implementation for PCI or SIO UARTs.
 
-Copyright (c) 2006 - 2015, 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
@@ -442,27 +442,6 @@ SerialReceiveTransmit (
   return EFI_SUCCESS;
 }
 
-/**
-  Flush the serial hardware transmit FIFO and shift register.
-
-  @param SerialDevice  The device to flush.
-**/
-VOID
-SerialFlushTransmitFifo (
-  SERIAL_DEV  *SerialDevice
-  )
-{
-  SERIAL_PORT_LSR  Lsr;
-
-  //
-  // Wait for the serial port to be ready, to make sure both the transmit FIFO
-  // and shift register empty.
-  //
-  do {
-Lsr.Data = READ_LSR (SerialDevice);
-  } while (Lsr.Bits.Temt == 0);
-}
-
 //
 // Interface Functions
 //
@@ -503,8 +482,6 @@ SerialReset (
 
   Tpl = gBS->RaiseTPL (TPL_NOTIFY);
 
-  SerialFlushTransmitFifo (SerialDevice);
-
   //
   // Make sure DLAB is 0.
   //
@@ -683,8 +660,6 @@ SerialSetAttributes (
 
   Tpl = gBS->RaiseTPL (TPL_NOTIFY);
 
-  SerialFlushTransmitFifo (SerialDevice);
-
   //
   // Put serial port on Divisor Latch Mode
   //
-- 
2.7.0.windows.1

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


[edk2] [PATCH] NetworkPkg: Make HttpBootGetBootFile return EFI_BUFFER_TOO_SMALL

2016-05-08 Thread Gary Lin
Per the description of HttpBootGetBootFile, the function should return
EFI_BUFFER_TOO_SMALL if the given buffer is smaller than the remote image.

Cc: Siyuan Fu 
Cc: Jiaxin Wu 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Gary Lin 
---
 NetworkPkg/HttpBootDxe/HttpBootClient.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/NetworkPkg/HttpBootDxe/HttpBootClient.c 
b/NetworkPkg/HttpBootDxe/HttpBootClient.c
index 9d445e3..46cf9ca 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootClient.c
+++ b/NetworkPkg/HttpBootDxe/HttpBootClient.c
@@ -1074,6 +1074,8 @@ HttpBootGetBootFile (
 
   if (*BufferSize < ContentLength) {
 Status = EFI_BUFFER_TOO_SMALL;
+  } else {
+Status = EFI_SUCCESS;
   }
   *BufferSize = ContentLength;
 
@@ -1089,7 +1091,7 @@ HttpBootGetBootFile (
 HttpFreeMsgParser (Parser);
   }
 
-  return EFI_SUCCESS;
+  return Status;
   
 ERROR_6:
   if (Parser != NULL) {
-- 
2.8.2

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


Re: [edk2] [patch] MdeModulePkg/Sd: add Erase Block support on sd/emmc device

2016-05-08 Thread Tian, Feng
I agree your comment. I will update it during check-in

Thanks
Feng

-Original Message-
From: Wu, Hao A 
Sent: Monday, May 9, 2016 10:54 AM
To: Tian, Feng 
Cc: edk2-devel@lists.01.org
Subject: RE: [patch] MdeModulePkg/Sd: add Erase Block support on sd/emmc device

One comment below.
And with that solved, Reviewed-by: Hao Wu 

Best Regards,
Hao Wu

> -Original Message-
> From: Tian, Feng
> Sent: Wednesday, May 04, 2016 1:30 PM
> To: Wu, Hao A
> Cc: edk2-devel@lists.01.org; Wu
> Subject: [patch] MdeModulePkg/Sd: add Erase Block support on sd/emmc 
> device
> 
> It's done by producing EFI_ERASE_BLOCK_PROTOCOL protocol instance.
> 
> Cc: Wu, Hao A 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Feng Tian 
> ---
>  MdeModulePkg/Bus/Sd/EmmcDxe/EmmcBlockIo.c | 411
> ++
>  MdeModulePkg/Bus/Sd/EmmcDxe/EmmcBlockIo.h |  39 ++-
>  MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxe.c |  74 +-
>  MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxe.h |   5 +
>  MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxe.inf   |   3 +-
>  MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c | 384
> 
>  MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.h |  39 ++-
>  MdeModulePkg/Bus/Sd/SdDxe/SdDxe.c |  15 ++
>  MdeModulePkg/Bus/Sd/SdDxe/SdDxe.h |   7 +-
>  MdeModulePkg/Bus/Sd/SdDxe/SdDxe.inf   |   3 +-
>  10 files changed, 974 insertions(+), 6 deletions(-)
> 
> diff --git a/MdeModulePkg/Bus/Sd/EmmcDxe/EmmcBlockIo.c
> b/MdeModulePkg/Bus/Sd/EmmcDxe/EmmcBlockIo.c
> index edb438b..a12cd63 100644
> --- a/MdeModulePkg/Bus/Sd/EmmcDxe/EmmcBlockIo.c
> +++ b/MdeModulePkg/Bus/Sd/EmmcDxe/EmmcBlockIo.c
> @@ -47,6 +47,8 @@ AsyncIoCallback (
> 
>if (EFI_ERROR (Request->Packet.TransactionStatus)) {
>  Request->Token->TransactionStatus = 
> Request->Packet.TransactionStatus;
> +  } else {
> +Request->Token->TransactionStatus = EFI_SUCCESS;

I think the 'TransactionStatus' cannot be set to EFI_SUCCESS upon every 
successful async I/O completion. If a previous subtask of an async I/O request 
fails, the 'TransactionStatus' should be an error status regardless of the 
execution status of subsequent subtasks.

Similar issue also exists in SdBlockIo.c.

>}
> 
>RemoveEntryList (>Link);
> @@ -1589,3 +1591,412 @@ EmmcSecurityProtocolOut (
>return Status;
>  }
> 
> +/**
> +  Set the erase start address through sync or async I/O request.
> +
> +  @param[in]  Partition A pointer to the EMMC_PARTITION instance.
> +  @param[in]  StartLba  The starting logical block address to be 
> erased.
> +  @param[in]  Token A pointer to the token associated with the
> transaction.
> +  @param[in]  IsEnd A boolean to show whether it's the last cmd 
> in a
> series of cmds.
> +This parameter is only meaningful in async 
> I/O request.
> +
> +  @retval EFI_SUCCESS   The request is executed successfully.
> +  @retval EFI_OUT_OF_RESOURCES  The request could not be executed due 
> + to
> a lack of resources.
> +  @retval OthersThe request could not be executed 
> successfully.
> +
> +**/
> +EFI_STATUS
> +EmmcEraseBlockStart (
> +  IN  EMMC_PARTITION*Partition,
> +  IN  EFI_LBA   StartLba,
> +  IN  EFI_BLOCK_IO2_TOKEN   *Token,
> +  IN  BOOLEAN   IsEnd
> +  )
> +{
> +  EFI_STATUS   Status;
> +  EFI_SD_MMC_PASS_THRU_PROTOCOL*PassThru;
> +  EMMC_DEVICE  *Device;
> +  EMMC_REQUEST *EraseBlockStart;
> +  EFI_TPL  OldTpl;
> +
> +  EraseBlockStart = NULL;
> +
> +  Device   = Partition->Device;
> +  PassThru = Device->Private->PassThru;
> +
> +  EraseBlockStart = AllocateZeroPool (sizeof (EMMC_REQUEST));  if 
> + (EraseBlockStart == NULL) {
> +Status = EFI_OUT_OF_RESOURCES;
> +goto Error;
> +  }
> +
> +  EraseBlockStart->Signature = EMMC_REQUEST_SIGNATURE;  OldTpl = 
> + gBS->RaiseTPL (TPL_CALLBACK);  InsertTailList (>Queue, 
> + >Link);  gBS->RestoreTPL (OldTpl);
> +  EraseBlockStart->Packet.SdMmcCmdBlk= 
> >SdMmcCmdBlk;
> +  EraseBlockStart->Packet.SdMmcStatusBlk = 
> >SdMmcStatusBlk;
> +  EraseBlockStart->Packet.Timeout= EMMC_GENERIC_TIMEOUT;
> +
> +  EraseBlockStart->SdMmcCmdBlk.CommandIndex =
> EMMC_ERASE_GROUP_START;
> +  EraseBlockStart->SdMmcCmdBlk.CommandType  = SdMmcCommandTypeAc;  
> + EraseBlockStart->SdMmcCmdBlk.ResponseType = SdMmcResponseTypeR1;
> +
> +  if (Device->SectorAddressing) {
> +EraseBlockStart->SdMmcCmdBlk.CommandArgument = (UINT32)StartLba;  
> + } else {
> +EraseBlockStart->SdMmcCmdBlk.CommandArgument =
> (UINT32)MultU64x32 (StartLba, Partition->BlockMedia.BlockSize);
> +  }
> +
> +  EraseBlockStart->IsEnd = IsEnd;
> +  EraseBlockStart->Token = Token;
> +
> +  if ((Token != NULL) && (Token->Event != NULL)) {
> +

[edk2] [PATCH 2/2] MdeModulePkg ScsiDiskDxe: Add Erase Block Protocol support for UFS devices

2016-05-08 Thread Hao Wu
This patch implements the EFI_ERASE_BLOCK_PROTOCOL in ScsiDiskDxe driver.

For now, the codes support the erase block feature only on Universal Flash
Storage (UFS) devices.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu 
---
 MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c  | 700 +-
 MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h  |  85 ++-
 MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf |   3 +-
 3 files changed, 761 insertions(+), 27 deletions(-)

diff --git a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c 
b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c
index 1b75d55..b5eff25 100644
--- a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c
+++ b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c
@@ -230,22 +230,27 @@ ScsiDiskDriverBindingStart (
 return Status;
   }
 
-  ScsiDiskDevice->Signature= SCSI_DISK_DEV_SIGNATURE;
-  ScsiDiskDevice->ScsiIo   = ScsiIo;
-  ScsiDiskDevice->BlkIo.Revision   = EFI_BLOCK_IO_PROTOCOL_REVISION3;
-  ScsiDiskDevice->BlkIo.Media  = >BlkIoMedia;
-  ScsiDiskDevice->BlkIo.Media->IoAlign = ScsiIo->IoAlign;
-  ScsiDiskDevice->BlkIo.Reset  = ScsiDiskReset;
-  ScsiDiskDevice->BlkIo.ReadBlocks = ScsiDiskReadBlocks;
-  ScsiDiskDevice->BlkIo.WriteBlocks= ScsiDiskWriteBlocks;
-  ScsiDiskDevice->BlkIo.FlushBlocks= ScsiDiskFlushBlocks;
-  ScsiDiskDevice->BlkIo2.Media = >BlkIoMedia;
-  ScsiDiskDevice->BlkIo2.Reset = ScsiDiskResetEx;
-  ScsiDiskDevice->BlkIo2.ReadBlocksEx  = ScsiDiskReadBlocksEx;
-  ScsiDiskDevice->BlkIo2.WriteBlocksEx = ScsiDiskWriteBlocksEx;
-  ScsiDiskDevice->BlkIo2.FlushBlocksEx = ScsiDiskFlushBlocksEx;
-  ScsiDiskDevice->Handle   = Controller;
-  InitializeListHead (>BlkIo2Queue);
+  ScsiDiskDevice->Signature = SCSI_DISK_DEV_SIGNATURE;
+  ScsiDiskDevice->ScsiIo= ScsiIo;
+  ScsiDiskDevice->BlkIo.Revision= 
EFI_BLOCK_IO_PROTOCOL_REVISION3;
+  ScsiDiskDevice->BlkIo.Media   = 
>BlkIoMedia;
+  ScsiDiskDevice->BlkIo.Media->IoAlign  = ScsiIo->IoAlign;
+  ScsiDiskDevice->BlkIo.Reset   = ScsiDiskReset;
+  ScsiDiskDevice->BlkIo.ReadBlocks  = ScsiDiskReadBlocks;
+  ScsiDiskDevice->BlkIo.WriteBlocks = ScsiDiskWriteBlocks;
+  ScsiDiskDevice->BlkIo.FlushBlocks = ScsiDiskFlushBlocks;
+  ScsiDiskDevice->BlkIo2.Media  = 
>BlkIoMedia;
+  ScsiDiskDevice->BlkIo2.Reset  = ScsiDiskResetEx;
+  ScsiDiskDevice->BlkIo2.ReadBlocksEx   = ScsiDiskReadBlocksEx;
+  ScsiDiskDevice->BlkIo2.WriteBlocksEx  = ScsiDiskWriteBlocksEx;
+  ScsiDiskDevice->BlkIo2.FlushBlocksEx  = ScsiDiskFlushBlocksEx;
+  ScsiDiskDevice->EraseBlock.Revision   = 
EFI_ERASE_BLOCK_PROTOCOL_REVISION;
+  ScsiDiskDevice->EraseBlock.EraseLengthGranularity = 1;
+  ScsiDiskDevice->EraseBlock.EraseBlocks= ScsiDiskEraseBlocks;
+  ScsiDiskDevice->UnmapInfo.MaxBlkDespCnt   = 1;
+  ScsiDiskDevice->BlockLimitsVpdSupported   = FALSE;
+  ScsiDiskDevice->Handle= Controller;
+  InitializeListHead (>AsyncTaskQueue);
 
   ScsiIo->GetDeviceType (ScsiIo, &(ScsiDiskDevice->DeviceType));
   switch (ScsiDiskDevice->DeviceType) {
@@ -323,6 +328,17 @@ ScsiDiskDriverBindingStart (
   NULL
   );
   if (!EFI_ERROR(Status)) {
+if (DetermineInstallEraseBlock(ScsiDiskDevice, Controller)) {
+  Status = gBS->InstallProtocolInterface (
+  ,
+  ,
+  EFI_NATIVE_INTERFACE,
+  >EraseBlock
+  );
+  if (EFI_ERROR(Status)) {
+DEBUG ((EFI_D_ERROR, "ScsiDisk: Failed to install the Erase Block 
Protocol! Status = %r\n", Status));
+  }
+}
 ScsiDiskDevice->ControllerNameTable = NULL;
 AddUnicodeString2 (
   "eng",
@@ -384,9 +400,10 @@ ScsiDiskDriverBindingStop (
   IN  EFI_HANDLE  *ChildHandleBuffer   OPTIONAL
   )
 {
-  EFI_BLOCK_IO_PROTOCOL *BlkIo;
-  SCSI_DISK_DEV *ScsiDiskDevice;
-  EFI_STATUSStatus;
+  EFI_BLOCK_IO_PROTOCOL  *BlkIo;
+  EFI_ERASE_BLOCK_PROTOCOL   *EraseBlock;
+  SCSI_DISK_DEV  *ScsiDiskDevice;
+  EFI_STATUS Status;
 
   Status = gBS->OpenProtocol (
   Controller,
@@ -405,7 +422,30 @@ ScsiDiskDriverBindingStop (
   //
   // Wait for the BlockIo2 requests queue to become empty
   //
-  while (!IsListEmpty (>BlkIo2Queue));
+  while (!IsListEmpty (>AsyncTaskQueue));
+
+  //
+  // If Erase Block Protocol is installed, then uninstall this protocol.
+  //
+  Status = gBS->OpenProtocol (
+  Controller,
+  ,
+  (VOID **) ,
+  

[edk2] [PATCH 1/2] MdePkg IndustryStandard/Scsi.h: Add Unmap command support

2016-05-08 Thread Hao Wu
According to the SCSI Block Commands - 4 (SBC-4) spec, the patch add SCSI
unmap command support in IndustryStandard/Scsi.h.

The following changes have been made:
1. Add SCSI unmap command OP Code
2. Update the structure definition for Block Limits VPD page
3. Add structure definitions for UNMAP parameter list header & UNMAP block
descriptor.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu 
---
 MdePkg/Include/IndustryStandard/Scsi.h | 64 +++---
 1 file changed, 60 insertions(+), 4 deletions(-)

diff --git a/MdePkg/Include/IndustryStandard/Scsi.h 
b/MdePkg/Include/IndustryStandard/Scsi.h
index 3c8f31a..0d81314 100644
--- a/MdePkg/Include/IndustryStandard/Scsi.h
+++ b/MdePkg/Include/IndustryStandard/Scsi.h
@@ -1,7 +1,7 @@
 /** @file
   Support for SCSI-2 standard
 
-  Copyright (c) 2006 - 2011, 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
@@ -72,6 +72,7 @@
 #define EFI_SCSI_OP_WRITE_VERIFY0x2e
 #define EFI_SCSI_OP_WRITE_LONG  0x3f
 #define EFI_SCSI_OP_WRITE_SAME  0x41
+#define EFI_SCSI_OP_UNMAP   0x42
 
 //
 // Additional commands for Sequential Access Devices
@@ -234,9 +235,11 @@ typedef struct {
   UINT8 Peripheral_Type : 5;
   UINT8 Peripheral_Qualifier : 3;
   UINT8 PageCode;
-  UINT8 Reserved_2;
-  UINT8 PageLength;
-  UINT8 Reserved_4_5[2];
+  UINT8 PageLength2;
+  UINT8 PageLength1;
+  UINT8 WriteSameNonZero : 1;
+  UINT8 Reserved_4 : 7;
+  UINT8 MaximumCompareAndWriteLength;
   UINT8 OptimalTransferLengthGranularity2;
   UINT8 OptimalTransferLengthGranularity1;
   UINT8 MaximumTransferLength4;
@@ -251,6 +254,47 @@ typedef struct {
   UINT8 MaximumPrefetchXdreadXdwriteTransferLength3;
   UINT8 MaximumPrefetchXdreadXdwriteTransferLength2;
   UINT8 MaximumPrefetchXdreadXdwriteTransferLength1;
+  UINT8 MaximumUnmapLbaCount4;
+  UINT8 MaximumUnmapLbaCount3;
+  UINT8 MaximumUnmapLbaCount2;
+  UINT8 MaximumUnmapLbaCount1;
+  UINT8 MaximumUnmapBlockDescriptorCount4;
+  UINT8 MaximumUnmapBlockDescriptorCount3;
+  UINT8 MaximumUnmapBlockDescriptorCount2;
+  UINT8 MaximumUnmapBlockDescriptorCount1;
+  UINT8 OptimalUnmapGranularity4;
+  UINT8 OptimalUnmapGranularity3;
+  UINT8 OptimalUnmapGranularity2;
+  UINT8 OptimalUnmapGranularity1;
+  UINT8 UnmapGranularityAlignment4 : 7;
+  UINT8 UnmapGranularityAlignmentValid : 1;
+  UINT8 UnmapGranularityAlignment3;
+  UINT8 UnmapGranularityAlignment2;
+  UINT8 UnmapGranularityAlignment1;
+  UINT8 MaximumWriteSameLength4;
+  UINT8 MaximumWriteSameLength3;
+  UINT8 MaximumWriteSameLength2;
+  UINT8 MaximumWriteSameLength1;
+  UINT8 MaximumAtomicTransferLength4;
+  UINT8 MaximumAtomicTransferLength3;
+  UINT8 MaximumAtomicTransferLength2;
+  UINT8 MaximumAtomicTransferLength1;
+  UINT8 AtomicAlignment4;
+  UINT8 AtomicAlignment3;
+  UINT8 AtomicAlignment2;
+  UINT8 AtomicAlignment1;
+  UINT8 AtomicTransferLengthGranularity4;
+  UINT8 AtomicTransferLengthGranularity3;
+  UINT8 AtomicTransferLengthGranularity2;
+  UINT8 AtomicTransferLengthGranularity1;
+  UINT8 MaximumAtomicTransferLengthWithAtomicBoundary4;
+  UINT8 MaximumAtomicTransferLengthWithAtomicBoundary3;
+  UINT8 MaximumAtomicTransferLengthWithAtomicBoundary2;
+  UINT8 MaximumAtomicTransferLengthWithAtomicBoundary1;
+  UINT8 MaximumAtomicBoundarySize4;
+  UINT8 MaximumAtomicBoundarySize3;
+  UINT8 MaximumAtomicBoundarySize2;
+  UINT8 MaximumAtomicBoundarySize1;
 } EFI_SCSI_BLOCK_LIMITS_VPD_PAGE;
 
 ///
@@ -307,6 +351,18 @@ typedef struct {
   UINT8 Reserved[16];  
 } EFI_SCSI_DISK_CAPACITY_DATA16;
 
+typedef struct {
+  UINT16 DataLen;
+  UINT16 BlkDespDataLen;
+  UINT8  Reserved[4];
+} EFI_SCSI_DISK_UNMAP_PARAM_LIST_HEADER;
+
+typedef struct {
+  UINT64 Lba;
+  UINT32 BlockNum;
+  UINT8  Reserved[4];
+} EFI_SCSI_DISK_UNMAP_BLOCK_DESP;
+
 
 #pragma pack()
 
-- 
1.9.5.msysgit.0

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


[edk2] [PATCH 3/4] MdeModulePkg AtaAtapiPassThru: Use the new PortMultiplierPort semantics

2016-05-08 Thread Hao Wu
The UEFI2.6 spec updated the description of the port multiplier port
number parameter in SATA Device Path Node and ATA Pass-Through Protocol.

Now, this parameter should be set to 0x instead of 0 to indicate that
an ATA device is directly attached on the controller port.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu 
---
 MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c   |  2 +-
 .../Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c| 75 +-
 .../Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.h| 12 ++--
 3 files changed, 66 insertions(+), 23 deletions(-)

diff --git a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c 
b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c
index f64a340..b278aa8 100644
--- a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c
+++ b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c
@@ -2513,7 +2513,7 @@ AhciModeInitialization (
   //
   // Found a ATA or ATAPI device, add it into the device list.
   //
-  CreateNewDeviceInfo (Instance, Port, 0, DeviceType, );
+  CreateNewDeviceInfo (Instance, Port, 0x, DeviceType, );
   if (DeviceType == EfiIdeHarddisk) {
 REPORT_STATUS_CODE (EFI_PROGRESS_CODE, (EFI_PERIPHERAL_FIXED_MEDIA | 
EFI_P_PC_ENABLE));
   }
diff --git a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c 
b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c
index 870900f..2389d54 100644
--- a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c
+++ b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c
@@ -2,7 +2,7 @@
   This file implements ATA_PASSTHRU_PROCTOCOL and EXT_SCSI_PASSTHRU_PROTOCOL 
interfaces
   for managed ATA controllers.
 
-  Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.
+  Copyright (c) 2010 - 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
@@ -148,7 +148,7 @@ UINT8 mScsiId[TARGET_MAX_BYTES] = {
 
   @param[in]  Port   The port number of the ATA device to send 
the command.
   @param[in]  PortMultiplierPort The port multiplier port number of the 
ATA device to send the command.
- If there is no port multiplier, then 
specify 0.
+ If there is no port multiplier, then 
specify 0x.
   @param[in, out] Packet A pointer to the ATA command to send to 
the ATA device specified by Port
  and PortMultiplierPort.
   @param[in]  Instance   Pointer to the 
ATA_ATAPI_PASS_THRU_INSTANCE.
@@ -272,6 +272,14 @@ AtaPassThruPassThruExecute (
   }
   break;
 case EfiAtaAhciMode :
+  if (PortMultiplierPort == 0x) {
+//
+// If there is no port multiplier, PortMultiplierPort will be 0x
+// according to UEFI spec. Here, we convert its value to 0 to follow
+// AHCI spec.
+//
+PortMultiplierPort = 0;
+  }
   switch (Protocol) {
 case EFI_ATA_PASS_THRU_PROTOCOL_ATA_NON_DATA:
   Status = AhciNonDataTransfer (
@@ -982,7 +990,7 @@ AtaAtapiPassThruStop (
   @param[in]  InstanceA pointer to the 
ATA_ATAPI_PASS_THRU_INSTANCE instance.
   @param[in]  PortThe port number of the ATA device to send 
the command.
   @param[in]  PortMultiplierPort  The port multiplier port number of the ATA 
device to send the command.
-  If there is no port multiplier, then specify 
0.
+  If there is no port multiplier, then specify 
0x.
   @param[in]  DeviceType  The device type of the ATA device.
 
   @retval The pointer to the data structure of the device info to access.
@@ -1004,6 +1012,18 @@ SearchDeviceInfoList (
   while (!IsNull (>DeviceList, Node)) {
 DeviceInfo = ATA_ATAPI_DEVICE_INFO_FROM_THIS (Node);
 
+//
+// For CD-ROM working in the AHCI mode, only 8 bits are used to record
+// the PortMultiplier information. If the CD-ROM is directly attached
+// on a SATA port, the PortMultiplier should be translated from 0xFF
+// to 0x according to the UEFI spec.
+//
+if ((Instance->Mode == EfiAtaAhciMode) &&
+(DeviceInfo->Type == EfiIdeCdrom) &&
+(PortMultiplier == 0xFF)) {
+PortMultiplier = 0x;
+}
+
 if ((DeviceInfo->Type == DeviceType) &&
 (Port == DeviceInfo->Port) &&
 (PortMultiplier == DeviceInfo->PortMultiplier)) {
@@ -1023,7 +1043,7 @@ SearchDeviceInfoList (
   @param[in]  InstanceA pointer to the 
ATA_ATAPI_PASS_THRU_INSTANCE instance.
   @param[in]  PortThe port number of the ATA device to send 
the command.
   @param[in]  PortMultiplierPort  The port multiplier port 

[edk2] [PATCH 4/4] MdeModulePkg AtaAtapiPassThru: Fix incorrect parameter description comment

2016-05-08 Thread Hao Wu
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu 
---
 MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c 
b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c
index b278aa8..3534d9f 100644
--- a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c
+++ b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c
@@ -1,7 +1,7 @@
 /** @file
   The file for AHCI mode of ATA host controller.
 
-  Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.
+  Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.
   (C) Copyright 2015 Hewlett Packard Enterprise Development LP
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
@@ -1484,7 +1484,7 @@ AhciReset (
   @param  PciIo   The PCI IO protocol instance.
   @param  AhciRegisters   The pointer to the EFI_AHCI_REGISTERS.
   @param  PortThe number of port.
-  @param  PortMultiplier  The timeout value of stop.
+  @param  PortMultiplier  The port multiplier port number.
   @param  AtaStatusBlock  A pointer to EFI_ATA_STATUS_BLOCK data structure.
 
   @retval EFI_SUCCESS Successfully get the return status of S.M.A.R.T 
command execution.
@@ -1582,7 +1582,7 @@ AhciAtaSmartReturnStatusCheck (
   @param  PciIo   The PCI IO protocol instance.
   @param  AhciRegisters   The pointer to the EFI_AHCI_REGISTERS.
   @param  PortThe number of port.
-  @param  PortMultiplier  The timeout value of stop.
+  @param  PortMultiplier  The port multiplier port number.
   @param  IdentifyDataA pointer to data buffer which is used to 
contain IDENTIFY data.
   @param  AtaStatusBlock  A pointer to EFI_ATA_STATUS_BLOCK data structure.
 
@@ -1698,7 +1698,7 @@ AhciAtaSmartSupport (
   @param  PciIo   The PCI IO protocol instance.
   @param  AhciRegisters   The pointer to the EFI_AHCI_REGISTERS.
   @param  PortThe number of port.
-  @param  PortMultiplier  The timeout value of stop.
+  @param  PortMultiplier  The port multiplier port number.
   @param  Buffer  The data buffer to store IDENTIFY PACKET data.
 
   @retval EFI_DEVICE_ERRORThe cmd abort with error occurs.
@@ -1756,7 +1756,7 @@ AhciIdentify (
   @param  PciIo   The PCI IO protocol instance.
   @param  AhciRegisters   The pointer to the EFI_AHCI_REGISTERS.
   @param  PortThe number of port.
-  @param  PortMultiplier  The timeout value of stop.
+  @param  PortMultiplier  The port multiplier port number.
   @param  Buffer  The data buffer to store IDENTIFY PACKET data.
 
   @retval EFI_DEVICE_ERRORThe cmd abort with error occurs.
@@ -1814,7 +1814,7 @@ AhciIdentifyPacket (
   @param  PciIo   The PCI IO protocol instance.
   @param  AhciRegisters   The pointer to the EFI_AHCI_REGISTERS.
   @param  PortThe number of port.
-  @param  PortMultiplier  The timeout value of stop.
+  @param  PortMultiplier  The port multiplier port number.
   @param  Feature The data to send Feature register.
   @param  FeatureSpecificData The specific data for SET FEATURE cmd.
 
-- 
1.9.5.msysgit.0

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


[edk2] [PATCH 2/4] MdePkg Protocol/AtaPassThru.h: Update PortMultiplierPort related comments

2016-05-08 Thread Hao Wu
The UEFI2.6 spec updated 'PortMultiplierPort' parameter description for
the following services in EFI_ATA_PASS_THRU_PROTOCOL:
1. PassThru
2. BuildDevicePath
3. ResetDevice

Now, if there is no port multiplier on a ATA controller port, the
PortMultiplierPort parameter should be set to 0x instead of 0.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu 
---
 MdePkg/Include/Protocol/AtaPassThru.h | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/MdePkg/Include/Protocol/AtaPassThru.h 
b/MdePkg/Include/Protocol/AtaPassThru.h
index 6153b70..c054554 100644
--- a/MdePkg/Include/Protocol/AtaPassThru.h
+++ b/MdePkg/Include/Protocol/AtaPassThru.h
@@ -3,7 +3,7 @@
   to send ATA Command Blocks to any ATA device attached to that ATA 
controller. The information
   includes the attributes of the ATA controller.
 
-  Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.
+  Copyright (c) 2009 - 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
@@ -180,7 +180,7 @@ typedef struct {
   @param[in] ThisA pointer to the 
EFI_ATA_PASS_THRU_PROTOCOL instance. 
   @param[in] PortThe port number of the ATA device to send 
the command. 
   @param[in] PortMultiplierPort  The port multiplier port number of the 
ATA device to send the command.
- If there is no port multiplier, then 
specify 0.
+ If there is no port multiplier, then 
specify 0x.
   @param[in,out] Packet  A pointer to the ATA command to send to 
the ATA device specified by Port
  and PortMultiplierPort.
   @param[in] Event   If non-blocking I/O is not supported then 
Event is ignored, and blocking
@@ -317,7 +317,7 @@ EFI_STATUS
  device path node is to be allocated and 
built.
   @param[in] PortMultiplierPort  The port multiplier port number of the 
ATA device for which a
  device path node is to be allocated and 
built. If there is no
- port multiplier, then specify 0.
+ port multiplier, then specify 0x.
   @param[in,out] DevicePath  A pointer to a single device path node 
that describes the ATA
  device specified by Port and 
PortMultiplierPort. This function
  is responsible for allocating the buffer 
DevicePath with the
@@ -437,7 +437,7 @@ EFI_STATUS
   @param[in] ThisA pointer to the EFI_ATA_PASS_THRU_PROTOCOL 
instance.
   @param[in] PortPort represents the port number of the ATA 
device to be reset.
   @param[in] PortMultiplierPort  The port multiplier port number of the ATA 
device to reset.
- If there is no port multiplier, then specify 
0.
+ If there is no port multiplier, then specify 
0x.
   @retval EFI_SUCCESSThe ATA device specified by Port and 
PortMultiplierPort was reset.
   @retval EFI_UNSUPPORTEDThe ATA controller does not support a device 
reset operation.
   @retval EFI_INVALID_PARAMETER  Port or PortMultiplierPort are invalid.
-- 
1.9.5.msysgit.0

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


[edk2] [PATCH 1/4] MdePkg Protocol/DevicePath.h: Update SATA Device Path comments

2016-05-08 Thread Hao Wu
The UEFI2.6 spec updated the Port Multiplier Port Number description of
SATA device path to use 0x when the device is directly connected to
the HBA.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu 
---
 MdePkg/Include/Protocol/DevicePath.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/MdePkg/Include/Protocol/DevicePath.h 
b/MdePkg/Include/Protocol/DevicePath.h
index 9a9ad2c..aa7aec7 100644
--- a/MdePkg/Include/Protocol/DevicePath.h
+++ b/MdePkg/Include/Protocol/DevicePath.h
@@ -5,7 +5,7 @@
   from a software point of view. The path must persist from boot to boot, so 
   it can not contain things like PCI bus numbers that change from boot to boot.
 
-Copyright (c) 2006 - 2015, 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 that accompanies this 
distribution.  
 The full text of the license may be found at
@@ -509,7 +509,7 @@ typedef struct {
   UINT16  HBAPortNumber;
   ///
   /// The Port multiplier port number that facilitates the connection
-  /// to the device. Bit 15 should be set if the device is directly
+  /// to the device. Must be set to 0x if the device is directly
   /// connected to the HBA.
   ///
   UINT16  PortMultiplierPortNumber;
-- 
1.9.5.msysgit.0

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


[edk2] [staging/HTTPS-TLS][PATCH] NetworkPkg: Fix unclosed TCP connection case if TLS session failed

2016-05-08 Thread Jiaxin Wu
This patch is used to fix unclosed TCP connection case if TLS
session build failed.

Cc: El-Haj-Mahmoud Samer 
Cc: Ye Ting 
Cc: Fu Siyuan 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu 
---
 NetworkPkg/HttpDxe/HttpImpl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/NetworkPkg/HttpDxe/HttpImpl.c b/NetworkPkg/HttpDxe/HttpImpl.c
index cf58b13..d380d6a 100644
--- a/NetworkPkg/HttpDxe/HttpImpl.c
+++ b/NetworkPkg/HttpDxe/HttpImpl.c
@@ -594,14 +594,14 @@ Error4:
 Error3:
   if (HttpInstance->UseHttps) {
 TlsCloseSession (HttpInstance);
 TlsCloseTxRxEvent (HttpInstance);
   }  
-  
-  HttpCloseConnection (HttpInstance);
 
 Error2:
+  HttpCloseConnection (HttpInstance);
+  
   HttpCloseTcpConnCloseEvent (HttpInstance);
   if (NULL != Wrap->TcpWrap.Tx4Token.CompletionToken.Event) {
 gBS->CloseEvent (Wrap->TcpWrap.Tx4Token.CompletionToken.Event);
 Wrap->TcpWrap.Tx4Token.CompletionToken.Event = NULL;
   }
-- 
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 2/2] MdePkg: MDE implementations for RISC-V arch.

2016-05-08 Thread Yao, Jiewen
Hi Abner
I have a quick review on that and I have question for below library/APIs:

1) BaseCacheMaintenanceLib - It seems you just leave empty function there, 
without any implementation.
If there is no need to implement this, would you please add some comments 
around the code?

2) IoLib - It seems MMIO and IO is treated to be same. Is that true?
If there is no special IO instruction in RISC-V, using ASSERT might be better. 
You can take ARM as example.

3) BaseSynchronizationLib - It seems you use C-code to perform atomic memory 
read-modify-write. Will the compiler generic atomic memory operation? If yes, 
would you please add some comments around the c-code?
If no, I suggest using AMO instruction in assembly code.

UINT32
EFIAPI
InternalSyncIncrement (
  IN  volatile UINT32   *Value
  )
{
  return ++*Value;
}

Thank you
Yao Jiewen

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Abner Chang
> Sent: Sunday, May 8, 2016 12:17 PM
> To: edk2-devel@lists.01.org
> Cc: AbnerChang ; Gao, Liming
> 
> Subject: [edk2] [PATCH 2/2] MdePkg: MDE implementations for RISC-V arch.
> 
> From: AbnerChang 
> 
>  The library instances of RISC-V MDE implementations.
> 
>  Contributed-under: TianoCore Contribution Agreement 1.0
> 
>  Signed-off-by: Abner Chang
> 
> ---
>  .../BaseCacheMaintenanceLib.inf|   4 +
>  .../Library/BaseCacheMaintenanceLib/RiscVCache.c   | 228 +++
>  MdePkg/Library/BaseCpuLib/BaseCpuLib.inf   |   4 +
>  MdePkg/Library/BaseCpuLib/RiscV/Cpu.s  |  25 ++
>  .../BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf  |   8 +-
>  MdePkg/Library/BaseIoLibIntrinsic/IoLibRiscV.c | 418
> +
>  MdePkg/Library/BaseLib/BaseLib.inf |  14 +
>  MdePkg/Library/BaseLib/RiscV64/CpuBreakpoint.c |  33 ++
>  MdePkg/Library/BaseLib/RiscV64/CpuPause.c  |  35 ++
>  MdePkg/Library/BaseLib/RiscV64/DisableInterrupts.c |  30 ++
>  MdePkg/Library/BaseLib/RiscV64/EnableInterrupts.c  |  31 ++
>  MdePkg/Library/BaseLib/RiscV64/GetInterruptState.c |  42 +++
>  .../Library/BaseLib/RiscV64/InternalSwitchStack.c  |  61 +++
>  MdePkg/Library/BaseLib/RiscV64/LongJump.c  |  38 ++
>  .../Library/BaseLib/RiscV64/RiscVCpuBreakpoint.S   |  20 +
>  MdePkg/Library/BaseLib/RiscV64/RiscVCpuPause.S |  20 +
>  MdePkg/Library/BaseLib/RiscV64/RiscVInterrupt.S|  33 ++
>  .../Library/BaseLib/RiscV64/RiscVSetJumpLongJump.S |  63 
>  MdePkg/Library/BaseLib/RiscV64/Unaligned.c | 270
> +
>  MdePkg/Library/BasePeCoffLib/BasePeCoff.c  |   3 +-
>  MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf |   5 +
>  MdePkg/Library/BasePeCoffLib/BasePeCoffLib.uni |   2 +
>  .../Library/BasePeCoffLib/BasePeCoffLibInternals.h |   1 +
>  .../Library/BasePeCoffLib/RiscV/PeCoffLoaderEx.c   | 161 
>  .../BaseSynchronizationLib.inf |   5 +
>  .../RiscV64/Synchronization.c  | 147 
>  26 files changed, 1698 insertions(+), 3 deletions(-)
>  create mode 100644
> MdePkg/Library/BaseCacheMaintenanceLib/RiscVCache.c
>  create mode 100644 MdePkg/Library/BaseCpuLib/RiscV/Cpu.s
>  create mode 100644 MdePkg/Library/BaseIoLibIntrinsic/IoLibRiscV.c
>  create mode 100644 MdePkg/Library/BaseLib/RiscV64/CpuBreakpoint.c
>  create mode 100644 MdePkg/Library/BaseLib/RiscV64/CpuPause.c
>  create mode 100644 MdePkg/Library/BaseLib/RiscV64/DisableInterrupts.c
>  create mode 100644 MdePkg/Library/BaseLib/RiscV64/EnableInterrupts.c
>  create mode 100644 MdePkg/Library/BaseLib/RiscV64/GetInterruptState.c
>  create mode 100644
> MdePkg/Library/BaseLib/RiscV64/InternalSwitchStack.c
>  create mode 100644 MdePkg/Library/BaseLib/RiscV64/LongJump.c
>  create mode 100644
> MdePkg/Library/BaseLib/RiscV64/RiscVCpuBreakpoint.S
>  create mode 100644 MdePkg/Library/BaseLib/RiscV64/RiscVCpuPause.S
>  create mode 100644 MdePkg/Library/BaseLib/RiscV64/RiscVInterrupt.S
>  create mode 100644
> MdePkg/Library/BaseLib/RiscV64/RiscVSetJumpLongJump.S
>  create mode 100644 MdePkg/Library/BaseLib/RiscV64/Unaligned.c
>  create mode 100644
> MdePkg/Library/BasePeCoffLib/RiscV/PeCoffLoaderEx.c
>  create mode 100644
> MdePkg/Library/BaseSynchronizationLib/RiscV64/Synchronization.c
> 
> diff --git
> a/MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.in
> f
> b/MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.in
> f
> index d659161..dcb6043 100644
> ---
> a/MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.in
> f
> +++
> b/MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.in
> f
> @@ -6,6 +6,7 @@
>  #
>  #  Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.
>  #  Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
> +#  Copyright (c) 2016, Hewlett Packard Enterprise Development LP. All
> rights 

Re: [edk2] [PATCH v2 1/1] MdeModulePkg:DxeHttpLib: Add checks in HttpGenRequestMessage API

2016-05-08 Thread Wu, Jiaxin
It's good to me!

Reviewed-By: Wu Jiaxin 

Best Regards!
Jiaxin

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Nagaraj Hegde
> Sent: Thursday, May 5, 2016 2:59 PM
> To: edk2-devel@lists.01.org
> Cc: Ye, Ting ; Fu, Siyuan ; Wu,
> Jiaxin 
> Subject: [edk2] [PATCH v2 1/1] MdeModulePkg:DxeHttpLib: Add checks in
> HttpGenRequestMessage API
> 
> v2:
> More input validation based on Request and HeaderCount.
> 
> HttpGenRequestMessage assumes that HTTP message would always contain
> a request-line, headers and an optional message body.
> However, subsequent to a HTTP PUT/POST request, HTTP requests would
> contain just the message body. This patch supports creation of such request
> messages with additional checks.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Hegde, Nagaraj P nagaraj-p.he...@hpe.com
> ---
>  MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c | 225 +++---
> --
>  1 file changed, 130 insertions(+), 95 deletions(-)
> 
> diff --git a/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c
> b/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c
> index 8d61d0b..1b0858c 100644
> --- a/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c
> +++ b/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c
> @@ -1681,61 +1681,92 @@ HttpGenRequestMessage (
>HttpUtilitiesProtocol = NULL;
> 
>//
> -  // Locate the HTTP_UTILITIES protocol.
> +  // 1. If we have a Request, we cannot have a NULL Url  // 2. If we
> + have a Request, HeaderCount can not be non-zero  // 3. If we do not
> + have a Request, HeaderCount should be zero  // 4. If we do not have
> + Request and Headers, we need at least a message-body
>//
> -  Status = gBS->LocateProtocol (
> -  ,
> -  NULL,
> -  (VOID **)
> -  );
> -
> -  if (EFI_ERROR (Status)) {
> -DEBUG ((DEBUG_ERROR,"Failed to locate Http Utilities protocol. Status
> = %r.\n", Status));
> -return Status;
> +  if ((Message->Data.Request != NULL && Url == NULL) ||
> +  (Message->Data.Request != NULL && Message->HeaderCount == 0) ||
> +  (Message->Data.Request == NULL && Message->HeaderCount != 0) ||
> +  (Message->Data.Request == NULL && Message->HeaderCount == 0 &&
> Message->BodyLength == 0)) {
> +return EFI_INVALID_PARAMETER;
> +  }
> +
> +  if (Message->HeaderCount != 0) {
> +//
> +// Locate the HTTP_UTILITIES protocol.
> +//
> +Status = gBS->LocateProtocol (
> +,
> +NULL,
> +(VOID **)
> +);
> +
> +if (EFI_ERROR (Status)) {
> +  DEBUG ((DEBUG_ERROR,"Failed to locate Http Utilities protocol. Status
> = %r.\n", Status));
> +  return Status;
> +}
> +
> +//
> +// Build AppendList to send into HttpUtilitiesBuild
> +//
> +AppendList = AllocateZeroPool (sizeof (EFI_HTTP_HEADER *) * (Message-
> >HeaderCount));
> +if (AppendList == NULL) {
> +  return EFI_OUT_OF_RESOURCES;
> +}
> +
> +for(Index = 0; Index < Message->HeaderCount; Index++){
> +  AppendList[Index] = >Headers[Index];
> +}
> +
> +//
> +// Build raw HTTP Headers
> +//
> +Status = HttpUtilitiesProtocol->Build (
> +HttpUtilitiesProtocol,
> +0,
> +NULL,
> +0,
> +NULL,
> +Message->HeaderCount,
> +AppendList,
> +,
> +
> +);
> +
> +if (AppendList != NULL) {
> +  FreePool (AppendList);
> +}
> +
> +if (EFI_ERROR (Status) || HttpHdr == NULL){
> +  return Status;
> +}
>}
> 
>//
> -  // Build AppendList to send into HttpUtilitiesBuild
> +  // If we have headers to be sent, account for it.
>//
> -  AppendList = AllocateZeroPool (sizeof (EFI_HTTP_HEADER *) * (Message-
> >HeaderCount));
> -  if (AppendList == NULL) {
> -return EFI_OUT_OF_RESOURCES;
> -  }
> -
> -  for(Index = 0; Index < Message->HeaderCount; Index++){
> -AppendList[Index] = >Headers[Index];
> +  if (Message->HeaderCount != 0) {
> +MsgSize = HttpHdrSize;
>}
> 
>//
> -  // Build raw HTTP Headers
> +  // If we have a request line, account for the fields.
>//
> -  Status = HttpUtilitiesProtocol->Build (
> -  HttpUtilitiesProtocol,
> -  0,
> -  NULL,
> -  0,
> -  NULL,
> -  Message->HeaderCount,
> -  AppendList,
> -  ,
> -  
> -  );
> -
> -  if (AppendList != NULL) {
> -FreePool (AppendList);
> -  }
> -
> -  if (EFI_ERROR (Status) || HttpHdr == NULL){
> -return Status;
> +  if (Message->Data.Request != NULL) {
> +MsgSize += HTTP_METHOD_MAXIMUM_LEN + AsciiStrLen
> + (HTTP_VERSION_CRLF_STR) + AsciiStrLen (Url);
>}
> 
> +
>//
> -  

Re: [edk2] [PATCH v2 1/1] NetworkPkg:HttpDxe: Code changes to support HTTP PUT/POST operations

2016-05-08 Thread Wu, Jiaxin
Hi Nagaraj,

In every EfiHttpRequest() for PUT/POST, HttpInitTcp() will be called even the 
TCP state is established (get from TCP4/6 GetModeData each time) and return 
EFI_SUCCESS. 

To avoid this repeating function call and improve the performance, we can check 
the current Http state, if required, then call it:

if (HttpInstance->State != HTTP_STATE_TCP_CONNECTED) {
  Status = HttpInitTcp (HttpInstance, Wrap, Configure);
   if (EFI_ERROR (Status)) {
 goto Error2;
   }
}

Others is good to me.
Reviewed-By: Wu Jiaxin 

Thanks.
Jiaxin


> -Original Message-
> From: Nagaraj Hegde [mailto:nagaraj-p.he...@hpe.com]
> Sent: Friday, May 6, 2016 6:20 PM
> To: edk2-devel@lists.01.org
> Cc: Wu, Jiaxin ; Fu, Siyuan ; Ye,
> Ting ; samer.el-haj-mahm...@hpe.com
> Subject: [PATCH v2 1/1] NetworkPkg:HttpDxe: Code changes to support
> HTTP PUT/POST operations
> 
> v2: Add comments for the code changes.
> 
> Code changes enables HttpDxe to handle PUT/POST operations.
> EfiHttpRequest assumes "Request" and "HttpMsg->Headers" can never be
> NULL. Also, HttpResponseWorker assumes HTTP Reponse will contain
> headers. We could have response which could contain only a string (HTTP 100
> Continue) and no headers. Code changes tries to do-away from these
> assumptions, which would enable HttpDxe to support PUT/POST operations.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Hegde, Nagaraj P nagaraj-p.he...@hpe.com
> ---
>  NetworkPkg/HttpDxe/HttpDriver.c |   3 +
>  NetworkPkg/HttpDxe/HttpImpl.c   | 445 
>  NetworkPkg/HttpDxe/HttpProto.h  |   1 +
>  3 files changed, 264 insertions(+), 185 deletions(-)
> 
> diff --git a/NetworkPkg/HttpDxe/HttpDriver.c
> b/NetworkPkg/HttpDxe/HttpDriver.c index 2518f4e..da6d087 100644
> --- a/NetworkPkg/HttpDxe/HttpDriver.c
> +++ b/NetworkPkg/HttpDxe/HttpDriver.c
> @@ -2,6 +2,7 @@
>The driver binding and service binding protocol for HttpDxe driver.
> 
>Copyright (c) 2015, Intel Corporation. All rights reserved.
> +  (C) Copyright 2016 Hewlett Packard Enterprise Development LP
> 
>This program and the accompanying materials
>are licensed and made available under the terms and conditions of the BSD
> License @@ -939,6 +940,8 @@ HttpServiceBindingCreateChild (
> 
>HttpInstance->Signature = HTTP_PROTOCOL_SIGNATURE;
>HttpInstance->Service   = HttpService;
> +  HttpInstance->Method = HttpMethodMax;
> +
>CopyMem (>Http, , sizeof
> (HttpInstance->Http));
>NetMapInit (>TxTokens);
>NetMapInit (>RxTokens); diff --git
> a/NetworkPkg/HttpDxe/HttpImpl.c b/NetworkPkg/HttpDxe/HttpImpl.c
> index 7a236f4..9bc0f8a 100644
> --- a/NetworkPkg/HttpDxe/HttpImpl.c
> +++ b/NetworkPkg/HttpDxe/HttpImpl.c
> @@ -248,151 +248,185 @@ EfiHttpRequest (
>HTTP_TOKEN_WRAP   *Wrap;
>CHAR8 *FileUrl;
>UINTN RequestMsgSize;
> -
> +
> +  //
> +  // Initializations
> +  //
> +  Url = NULL;
> +  HostName = NULL;
> +  RequestMsg = NULL;
> +  HostNameStr = NULL;
> +  Wrap = NULL;
> +  FileUrl = NULL;
> +
>if ((This == NULL) || (Token == NULL)) {
>  return EFI_INVALID_PARAMETER;
>}
> 
>HttpMsg = Token->Message;
> -  if ((HttpMsg == NULL) || (HttpMsg->Headers == NULL)) {
> +  if (HttpMsg == NULL) {
>  return EFI_INVALID_PARAMETER;
>}
> 
> -  //
> -  // Current implementation does not support POST/PUT method.
> -  // If future version supports these two methods, Request could be NULL
> for a special case that to send large amounts
> -  // of data. For this case, the implementation need check whether previous
> call to Request() has been completed or not.
> -  //
> -  //
>Request = HttpMsg->Data.Request;
> -  if ((Request == NULL) || (Request->Url == NULL)) {
> -return EFI_INVALID_PARAMETER;
> -  }
> 
>//
> -  // Only support GET and HEAD method in current implementation.
> +  // Only support GET, HEAD, PUT and POST method in current
> implementation.
>//
> -  if ((Request->Method != HttpMethodGet) && (Request->Method !=
> HttpMethodHead)) {
> +  if ((Request != NULL) && (Request->Method != HttpMethodGet) &&
> +  (Request->Method != HttpMethodHead) && (Request->Method !=
> + HttpMethodPut) && (Request->Method != HttpMethodPost)) {
>  return EFI_UNSUPPORTED;
>}
> 
>HttpInstance = HTTP_INSTANCE_FROM_PROTOCOL (This);
>ASSERT (HttpInstance != NULL);
> 
> +  //
> +  // Capture the method into HttpInstance.
> +  //
> +  if (Request != NULL) {
> +HttpInstance->Method = Request->Method;  }
> +
>if (HttpInstance->State < HTTP_STATE_HTTP_CONFIGED) {
>  return EFI_NOT_STARTED;
>}
> 
> -  //
> -  // Check whether the token already existed.
> -  //
> -  if (EFI_ERROR (NetMapIterate (>TxTokens, HttpTokenExist,
> Token))) {
> -return EFI_ACCESS_DENIED;
> -  }
> -
> -  HostName= NULL;
> - 

Re: [edk2] [PATCH] MdeModulePkg: FileExplorerLib: prevent freeing null pointer

2016-05-08 Thread Tian, Feng
Thanks for your contribution, Mike.

Your commit log misses the license statement, I will help add below in.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Zimmermann 

Here is my response:
Reviewed-by: Feng Tian 

Thanks
Feng

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Michael 
Zimmermann
Sent: Saturday, May 7, 2016 11:17 AM
To: edk2-devel@lists.01.org 
Subject: [edk2] [PATCH] MdeModulePkg: FileExplorerLib: prevent freeing null 
pointer

when there's no volume label 'Info' can be NULL
---
 MdeModulePkg/Library/FileExplorerLib/FileExplorer.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Library/FileExplorerLib/FileExplorer.c
b/MdeModulePkg/Library/FileExplorerLib/FileExplorer.c
index 9f75d6e..a9ca432 100644
--- a/MdeModulePkg/Library/FileExplorerLib/FileExplorer.c
+++ b/MdeModulePkg/Library/FileExplorerLib/FileExplorer.c
@@ -775,7 +775,8 @@ LibFindFileSystem (
  MenuEntry->DisplayString,
  NULL
  );
-  FreePool (Info);
+  if (Info != NULL)
+FreePool (Info);

   OptionNumber++;
   InsertTailList (>Head,
>Link);
-- 
2.8.2
___
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] MdeModulePkg/DxeIplPeim: RISC-V arch DxeIpl.

2016-05-08 Thread Yao, Jiewen
Hi Abner
I think it is great to have more arch for UEFI. Thanks for your great 
contribution.
As you mentioned, this RISC-V seems not in public UEFI standard yet, code might 
be subject to change.

If so, do you think it might be a better idea to check in this as staging tree, 
which follow EDKII staging process?
You can find link here https://github.com/tianocore/edk2-staging

It is still public available. And you may find 2 examples (HTTPS-TLS, 
Customized-Secure-Boot) there. 
https://github.com/tianocore/edk2-staging/branches

Once RISC-V is added to UEFI spec officially, we can move support from staging 
tree to trunk.

Thank you
Yao Jiewen

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Chang, Abner (HPS SW/FW Technologist)
> Sent: Sunday, May 8, 2016 7:19 PM
> To: Justen, Jordan L ; edk2-devel@lists.01.org
> Cc: Gao, Liming 
> Subject: Re: [edk2] [PATCH] MdeModulePkg/DxeIplPeim: RISC-V arch DxeIpl.
> 
> Hi Jordan,
> The UEFI/PI ECR for RISC-V is ready but not yet send to UEFI for review. I
> have been told to upstream RISC-V code first and then submit the spec. I will
> confirm this again.
> Below response to your comments,
> > ---
> >  MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf|  6 +-
> >  MdeModulePkg/Core/DxeIplPeim/Riscv64/DxeLoadFunc.c | 79
> > ++
> >>>Is it Riscv64 or RiscV64?
> >>>Like MdePkg, I think MdeModulePkg only upports achitectures in the
> UEFI spec.
> 
> This is typo, should be RiscV64. RISC-V arch UEFI spec is ready for review.
> 
> >
> > ---
> >  RiscVPkg/Include/RiscV.h   | 105 +++
> >  .../PeiServicesTablePointer.c  | 121 +++
> >  .../PeiServicesTablePointerLib.inf |  46 ++
> >  .../PeiServicesTablePointerLib.uni | Bin 0 -> 2520
> bytes
> >
> >>> utf-8. (See other my other email.)
> >>>
> >>>I think this library should live in MdePkg, except MdePkg only
> >>>supports architectures that are in the UEFI spec.
> PeiServerTablePointer lib is very processor depends. PI spec changes for this
> is ready for review as well.
> 
> >>> RiscVPkg,
> >>>This package seems to be mash up of things that possibly should be in
> >>>MdePkg, UefiCpuPkg, a chipset package, and possibly platform
> packages.
> >>>
> Modules and libraries under RiscVPkg are all processor specific. Like Timer is
> provided by RISC-V processor itself instead of using something else on
> platform. ResetVector, Sec, exception and etc. are all the same.
> UefiCpuPkg seems to me still not clean enough for common CPU usage. Like
> sec and ResetVector, we still have to use the modules from other processor
> package. So put RISC-V modules under its own package is mush clean in my
> opinion for now.
> 
> >>>What is the status of the QEMU port?
> >>>I don't think we should put this upstream into EDK II until QEMU has
> >>>it upstream. Maybe https://github.com/tianocore/edk2-platforms in a
> >>>ovmf-riscv branch?
> There is no official QEMU supports RISC-V yet. The QEMU which supports
> RISC-V QEMU is on RISC-V Github. However, I have another RISC-V QEMU
> port for PC/AT which uses PCI as the platform bus spec because RISC-V
> platform spec is not yet ready.
> The RISC-V QEMU PC/AT port is on my github. The detail is mentioned in the
> readme file in RiscVVirtPkg. You also can refer to this link
> https://github.com/AbnerChang/RiscVQemuPcat
> 
> >>>What would prevent this from living under OvmfPkg? Say
> >>>OvmfPkg/OvmfPkgRiscV64.dsc?
> I think it should be no problem to use OvmfPkg as common
> processor/platform emulator. Just you still can see few Intel things. ARM
> QEMU implementation must be considered as well if we move RISC-V to
> OvmfPkg, thus we can have the consistent implementation.
> RISC-V QEMU implementation just follows ARM QEMU implement, that is to
> have a separate package. But I agree with you that all processors/platforms
> emulator should be under OvmfPkg.
> 
> >>>This should be utf-8:
> >>>BaseTools/Scripts/ConvertUni.py
> I will fix this.
> 
> I think I set the configurations when submit patches. Will figure it out.
> Thanks
> Abner
> 
> -Original Message-
> From: Jordan Justen [mailto:jordan.l.jus...@intel.com]
> Sent: Sunday, May 08, 2016 1:53 PM
> To: Chang, Abner (HPS SW/FW Technologist) ;
> edk2-devel@lists.01.org
> Cc: liming@intel.com
> Subject: Re: [edk2] [PATCH] MdeModulePkg/DxeIplPeim: RISC-V arch DxeIpl.
> 
> On 2016-05-07 21:23:36, Abner Chang wrote:
> > From: AbnerChang 
> >
> 
> git config settings. :)
> 
> > The implementation of RISC-V DxeIpl.
> >
> > Contributed-under: TianoCore Contribution Agreement 1.0
> > Signed-off-by: Abner Chang
> 
> space before <
> 
> > ---
> >  MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf|  6 +-
> >  MdeModulePkg/Core/DxeIplPeim/Riscv64/DxeLoadFunc.c | 79
> > 

[edk2] [PATCH v4 1/2] MdeModulePkg RamDiskDxe: Report ACPI NFIT for reserved memory RAM disks

2016-05-08 Thread Hao Wu
The RamDiskDxe now will report RAM disks with reserved memory type to NFIT
in the ACPI table.

This commit will also make sure that an NVDIMM root device exists in the
\SB scope before reporting any RAM disk to NFIT.

To properly report the NVDIMM root device, one will need to append the
following content in the [Rule.Common.DXE_DRIVER] field in platform FDF
files:

RAW ACPI  Optional|.acpi
RAW ASL   Optional|.aml

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu 
---
 MdeModulePkg/Universal/Disk/RamDiskDxe/RamDisk.asl |  44 ++
 .../Universal/Disk/RamDiskDxe/RamDiskDriver.c  |  80 
 .../Universal/Disk/RamDiskDxe/RamDiskDxe.inf   |  12 +
 .../Universal/Disk/RamDiskDxe/RamDiskImpl.h|  28 ++
 .../Universal/Disk/RamDiskDxe/RamDiskProtocol.c| 494 +
 5 files changed, 658 insertions(+)
 create mode 100644 MdeModulePkg/Universal/Disk/RamDiskDxe/RamDisk.asl

diff --git a/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDisk.asl 
b/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDisk.asl
new file mode 100644
index 000..115dca0
--- /dev/null
+++ b/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDisk.asl
@@ -0,0 +1,44 @@
+/** @file
+  The definition block in ACPI table for NVDIMM root device.
+
+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.
+
+**/
+
+DefinitionBlock (
+  "RamDisk.aml",
+  "SSDT",
+  2,
+  "INTEL ",
+  "RamDisk ",
+  0x1000
+  )
+{
+  Scope (\_SB)
+  {
+Device (NVDR)
+{
+  //
+  // Define _HID, "ACPI0012" NVDIMM Root Device
+  //
+  Name (_HID, "ACPI0012")
+
+  //
+  // Readable name of this device
+  //
+  Name (_STR, Unicode ("NVDIMM Root Device"))
+
+  Method (_STA, 0)
+  {
+Return (0x0f)
+  }
+}
+  }
+}
diff --git a/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDriver.c 
b/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDriver.c
index 7d068b2..e65aee8 100644
--- a/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDriver.c
+++ b/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDriver.c
@@ -34,6 +34,77 @@ EFI_RAM_DISK_PROTOCOL  mRamDiskProtocol = {
 LIST_ENTRY  RegisteredRamDisks;
 UINTN   ListEntryNum;
 
+//
+// Pointers to the EFI_ACPI_TABLE_PROTOCOL and EFI_ACPI_SDT_PROTOCOL.
+//
+EFI_ACPI_TABLE_PROTOCOL  *mAcpiTableProtocol = NULL;
+EFI_ACPI_SDT_PROTOCOL*mAcpiSdtProtocol   = NULL;
+
+
+/**
+  Check whether EFI_ACPI_TABLE_PROTOCOL and EFI_ACPI_SDT_PROTOCOL are produced.
+  If both protocols are produced, publish all the reserved memory type RAM
+  disks to the NVDIMM Firmware Interface Table (NFIT).
+
+  @param[in] Event  Event whose notification function is being invoked.
+  @param[in] ContextThe pointer to the notification function's context,
+which is implementation-dependent.
+
+**/
+VOID
+EFIAPI
+RamDiskAcpiCheck (
+  IN EFI_EVENTEvent,
+  IN VOID *Context
+  )
+{
+  EFI_STATUS Status;
+  LIST_ENTRY *Entry;
+  RAM_DISK_PRIVATE_DATA  *PrivateData;
+
+  gBS->CloseEvent (Event);
+
+  //
+  // Locate the EFI_ACPI_TABLE_PROTOCOL.
+  //
+  Status = gBS->LocateProtocol (
+  ,
+  NULL,
+  (VOID **)
+  );
+  if (EFI_ERROR (Status)) {
+DEBUG ((
+  EFI_D_INFO,
+  "RamDiskAcpiCheck: Cannot locate the EFI ACPI Table Protocol,",
+  "unable to publish RAM disks to NFIT.\n"
+  ));
+return;
+  }
+
+  //
+  // Locate the EFI_ACPI_SDT_PROTOCOL.
+  //
+  Status = gBS->LocateProtocol (
+  ,
+  NULL,
+  (VOID **)
+  );
+  if (EFI_ERROR (Status)) {
+DEBUG ((
+  EFI_D_INFO,
+  "RamDiskAcpiCheck: Cannot locate the EFI ACPI Sdt Protocol,",
+  "unable to publish RAM disks to NFIT.\n"
+  ));
+mAcpiTableProtocol = NULL;
+return;
+  }
+
+  EFI_LIST_FOR_EACH (Entry, ) {
+PrivateData = RAM_DISK_PRIVATE_FROM_THIS (Entry);
+RamDiskPublishNfit (PrivateData);
+  }
+}
+
 
 /**
   The entry point for RamDiskDxe driver.
@@ -58,6 +129,7 @@ RamDiskDxeEntryPoint (
   EFI_STATUS  Status;
   RAM_DISK_CONFIG_PRIVATE_DATA*ConfigPrivate;
   VOID*DummyInterface;
+  EFI_EVENT   Event;
 
   //
   // If already started, return.
@@ -109,6 +181,14 @@ RamDiskDxeEntryPoint (
   //
   InitializeListHead ();
 
+  Status = EfiCreateEventReadyToBootEx (
+ TPL_CALLBACK,
+ RamDiskAcpiCheck,
+ 

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

2016-05-08 Thread Wu, Hao A
Hi Laszlo,

Since the v4 1/2 patch is the same as the v3 1/2 one, so I skipped sending
this patch. Sorry for the confusion, I will send the missing patch later.

Best Regards,
Hao Wu

> -Original Message-
> From: Laszlo Ersek [mailto:ler...@redhat.com]
> Sent: Friday, May 06, 2016 11:57 PM
> To: El-Haj-Mahmoud, Samer; edk2-devel@lists.01.org; Justen, Jordan L; Wu,
> Hao A
> Cc: Hsiung, Harry L
> Subject: Re: [edk2] [PATCH v4 0/2] Report ACPI NFIT for reserved memory RAM
> disks
> 
> On 05/06/16 17:41, El-Haj-Mahmoud, Samer wrote:
> > What is the status of this series? It got reviewed a while ago,
> 
> Where?
> 
> I can only find my own review for v4 2/2, and your review for v4 0/2.
> 
> But, patch #1 doesn't even seem to be part of the v4 posting (!), plus I
> can't find reviews from MdeModulePkg maintainers for patch #1.
> 
> Thanks
> Laszlo
> 
> 
> > but it still not committed.
> >
> > From: El-Haj-Mahmoud, Samer
> > Sent: Thursday, April 28, 2016 10:30 PM
> > To: edk2-devel@lists.01.org; ler...@redhat.com; jordan.l.jus...@intel.com;
> hao.a...@intel.com
> > Cc: hao.a...@intel.com
> > Subject: RE: [edk2] [PATCH v4 0/2] Report ACPI NFIT for reserved memory
> RAM disks
> >
> > Series Reviewed-By: Samer El-Haj-Mahmoud
> >
> >
> >
> >
> > -Original Message-
> > From: Hao Wu [hao.a...@intel.com]
> > Received: Thursday, 28 Apr 2016, 9:23PM
> > To: edk2-devel@lists.01.org [edk2-
> de...@lists.01.org]; ler...@redhat.com
> [ler...@redhat.com];
> jordan.l.jus...@intel.com
> [jordan.l.jus...@intel.com]
> > CC: Hao Wu [hao.a...@intel.com]
> > Subject: [edk2] [PATCH v4 0/2] Report ACPI NFIT for reserved memory RAM
> disks
> > Since the RamDiskDxe part in MdeModulePkg has not been changed, this
> > series only contains the patch for changes made in OvmfPkg.
> >
> > Changes compared with V3:
> > 1. Set Pcd 'PcdInstallAcpiSdtProtocol' to TURE in OVMF DSC files.
> >
> > Changes compared with V2:
> > 1. RamDiskDxe driver now will register an EFI event in the Ready To Boot
> >Event Group to a). detect whether EFI_ACPI_TABLE_PROTOCOL and
> >EFI_ACPI_SDT_PROTOCOL are both produced; b). publish all the reserved
> >memory type RAM disks registered at this point to the NFIT if both
> >protocols are produced.
> >
> > 2. The RamDiskUnpublishNfit() now will uninstall NFIT and SSDT that is
> >used to report the NVDIMM root device from the ACPI table when there is
> >no NFIT structure in NFIT after removing a RAM disk.
> >
> > 3. Instead of adding a new rule in OvmfPkg FDF files, the patch now lists
> >the asl and aml options in the main [Rule.Common.DXE_DRIVER] field.
> >
> >
> > 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/DSC files for RamDiskDxe's adding NFIT report
> > feature
> >
> >  MdeModulePkg/Universal/Disk/RamDiskDxe/RamDisk.asl |  44 ++
> >  .../Universal/Disk/RamDiskDxe/RamDiskDriver.c  |  80 
> >  .../Universal/Disk/RamDiskDxe/RamDiskDxe.inf   |  12 +
> >  .../Universal/Disk/RamDiskDxe/RamDiskImpl.h|  28 ++
> >  .../Universal/Disk/RamDiskDxe/RamDiskProtocol.c| 494
> +
> >  OvmfPkg/OvmfPkgIa32.dsc|   1 +
> >  OvmfPkg/OvmfPkgIa32.fdf|   2 +
> >  OvmfPkg/OvmfPkgIa32X64.dsc |   1 +
> >  OvmfPkg/OvmfPkgIa32X64.fdf |   2 +
> >  OvmfPkg/OvmfPkgX64.dsc |   1 +
> >  OvmfPkg/OvmfPkgX64.fdf |   2 +
> >  11 files changed, 667 insertions(+)
> >  create mode 100644
> MdeModulePkg/Universal/Disk/RamDiskDxe/RamDisk.asl
> >
> > --
> > 1.9.5.msysgit.0
> >
> > ___
> > 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-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel