Re: [edk2] [Patch v4 1/5] UefiCpuPkg/PiSmmCpuDxeSmm: Use GDT/IDT saved in Smram.

2018-08-14 Thread Ni, Ruiyu
Reviewed-by: Ruiyu Ni 

Thanks/Ray

> -Original Message-
> From: edk2-devel  On Behalf Of Eric Dong
> Sent: Wednesday, August 15, 2018 10:15 AM
> To: edk2-devel@lists.01.org
> Cc: Ni, Ruiyu ; Laszlo Ersek 
> Subject: [edk2] [Patch v4 1/5] UefiCpuPkg/PiSmmCpuDxeSmm: Use GDT/IDT
> saved in Smram.
> 
> Current implementation will copy GDT/IDT at SmmReadyToLock point from ACPI
> NVS memory to Smram. Later at S3 resume phase, it restore the memory saved
> in Smram to ACPI NVS. It can directly use GDT/IDT saved in Smram instead of
> restore the original ACPI NVS memory.
> This patch do this change.
> 
> V4 changes:
> 1. Remove global variables
> mGdtForAp/mIdtForAp/mMachineCheckHandlerForAp.
> 
> Test Done:
>   Do the OS boot and S3 resume test.
> 
> Cc: Laszlo Ersek 
> Cc: Ruiyu Ni 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Eric Dong 
> ---
>  UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c | 31 ++-
>  1 file changed, 14 insertions(+), 17 deletions(-)
> 
> diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c
> b/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c
> index 0b8ef70359..abd8a5a07b 100644
> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c
> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c
> @@ -66,9 +66,6 @@ ACPI_CPU_DATAmAcpiCpuData;
>  volatile UINT32  mNumberToFinish;
>  MP_CPU_EXCHANGE_INFO *mExchangeInfo;
>  BOOLEAN  mRestoreSmmConfigurationInS3 = FALSE;
> -VOID *mGdtForAp = NULL;
> -VOID *mIdtForAp = NULL;
> -VOID *mMachineCheckHandlerForAp = NULL;
>  MP_MSR_LOCK  *mMsrSpinLocks = NULL;
>  UINTNmMsrSpinLockCount;
>  UINTNmMsrCount = 0;
> @@ -448,13 +445,6 @@ PrepareApStartupVector (
>CopyMem ((VOID *) (UINTN) >GdtrProfile, (VOID *) (UINTN)
> mAcpiCpuData.GdtrProfile, sizeof (IA32_DESCRIPTOR));
>CopyMem ((VOID *) (UINTN) >IdtrProfile, (VOID *) (UINTN)
> mAcpiCpuData.IdtrProfile, sizeof (IA32_DESCRIPTOR));
> 
> -  //
> -  // Copy AP's GDT, IDT and Machine Check handler from SMRAM to ACPI NVS
> memory
> -  //
> -  CopyMem ((VOID *) mExchangeInfo->GdtrProfile.Base, mGdtForAp,
> mExchangeInfo->GdtrProfile.Limit + 1);
> -  CopyMem ((VOID *) mExchangeInfo->IdtrProfile.Base, mIdtForAp,
> mExchangeInfo->IdtrProfile.Limit + 1);
> -  CopyMem ((VOID *)(UINTN) mAcpiCpuData.ApMachineCheckHandlerBase,
> mMachineCheckHandlerForAp, mAcpiCpuData.ApMachineCheckHandlerSize);
> -
>mExchangeInfo->StackStart  = (VOID *) (UINTN) mAcpiCpuData.StackAddress;
>mExchangeInfo->StackSize   = mAcpiCpuData.StackSize;
>mExchangeInfo->BufferStart = (UINT32) StartupVector; @@ -831,6 +821,9
> @@ GetAcpiCpuData (
>ACPI_CPU_DATA  *AcpiCpuData;
>IA32_DESCRIPTOR*Gdtr;
>IA32_DESCRIPTOR*Idtr;
> +  VOID   *GdtForAp;
> +  VOID   *IdtForAp;
> +  VOID   *MachineCheckHandlerForAp;
> 
>if (!mAcpiS3Enable) {
>  return;
> @@ -893,14 +886,18 @@ GetAcpiCpuData (
>Gdtr = (IA32_DESCRIPTOR *)(UINTN)mAcpiCpuData.GdtrProfile;
>Idtr = (IA32_DESCRIPTOR *)(UINTN)mAcpiCpuData.IdtrProfile;
> 
> -  mGdtForAp = AllocatePool ((Gdtr->Limit + 1) + (Idtr->Limit + 1) +
> mAcpiCpuData.ApMachineCheckHandlerSize);
> -  ASSERT (mGdtForAp != NULL);
> -  mIdtForAp = (VOID *) ((UINTN)mGdtForAp + (Gdtr->Limit + 1));
> -  mMachineCheckHandlerForAp = (VOID *) ((UINTN)mIdtForAp + (Idtr->Limit +
> 1));
> +  GdtForAp = AllocatePool ((Gdtr->Limit + 1) + (Idtr->Limit + 1) +
> + mAcpiCpuData.ApMachineCheckHandlerSize);
> +  ASSERT (GdtForAp != NULL);
> +  IdtForAp = (VOID *) ((UINTN)GdtForAp + (Gdtr->Limit + 1));
> + MachineCheckHandlerForAp = (VOID *) ((UINTN)IdtForAp + (Idtr->Limit +
> + 1));
> +
> +  CopyMem (GdtForAp, (VOID *)Gdtr->Base, Gdtr->Limit + 1);  CopyMem
> + (IdtForAp, (VOID *)Idtr->Base, Idtr->Limit + 1);  CopyMem
> + (MachineCheckHandlerForAp, (VOID
> + *)(UINTN)mAcpiCpuData.ApMachineCheckHandlerBase,
> + mAcpiCpuData.ApMachineCheckHandlerSize);
> 
> -  CopyMem (mGdtForAp, (VOID *)Gdtr->Base, Gdtr->Limit + 1);
> -  CopyMem (mIdtForAp, (VOID *)Idtr->Base, Idtr->Limit + 1);
> -  CopyMem (mMachineCheckHandlerForAp, (VOID
> *)(UINTN)mAcpiCpuData.ApMachineCheckHandlerBase,
> mAcpiCpuData.ApMachineCheckHandlerSize);
> +  Gdtr->Base = (UINTN)GdtForAp;
> +  Idtr->Base = (UINTN)IdtForAp;
> +  mAcpiCpuData.ApMachineCheckHandlerBase =
> + (EFI_PHYSICAL_ADDRESS)(UINTN)MachineCheckHandlerForAp;
>  }
> 
>  /**
> --
> 2.15.0.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


Re: [edk2] [Patch v4 3/5] UefiCpuPkg/CpuS3DataDxe: Change Memory Type and address limitation.

2018-08-14 Thread Ni, Ruiyu
Reviewed-by: Ruiyu Ni 

Thanks/Ray

> -Original Message-
> From: edk2-devel  On Behalf Of Eric Dong
> Sent: Wednesday, August 15, 2018 10:15 AM
> To: edk2-devel@lists.01.org
> Cc: Laszlo Ersek ; Ni, Ruiyu 
> Subject: [edk2] [Patch v4 3/5] UefiCpuPkg/CpuS3DataDxe: Change Memory
> Type and address limitation.
> 
> Because CpuS3Data memory will be copy to smram at SmmReadyToLock point,
> the memory type no need to be ACPI NVS type, also the address not limit to
> below 4G.
> 
> This change remove the limit of ACPI NVS memory type and below 4G.
> 
> V4 Changes:
> 1. Create AllocateZeroPages and use it. It's easy to use than 
> gBS->AllocatePages.
> 
> Pass OS boot and resume from S3 test.
> 
> Cc: Marvin Häuser 
> Cc: Fan Jeff 
> Cc: Laszlo Ersek 
> Cc: Ruiyu Ni 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Eric Dong 
> ---
>  UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c  | 34
> +---
>  UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf |  1 +
>  2 files changed, 28 insertions(+), 7 deletions(-)
> 
> diff --git a/UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c
> b/UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c
> index dccb406b8d..3e8c8b383c 100644
> --- a/UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c
> +++ b/UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c
> @@ -31,6 +31,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY
> KIND, EITHER EXPRESS OR IMPLIED.
>  #include 
>  #include 
>  #include 
> +#include 
> 
>  #include 
>  #include 
> @@ -81,6 +82,28 @@ AllocateAcpiNvsMemoryBelow4G (
>return Buffer;
>  }
> 
> +/**
> +  Allocate memory and clean it with zero.
> +
> +  @param[in] Size   Size of memory to allocate.
> +
> +  @return   Allocated address for output.
> +
> +**/
> +VOID *
> +AllocateZeroPages (
> +  IN UINTN  Size
> +  )
> +{
> +  VOID  *Buffer;
> +
> +  Buffer = AllocatePages (EFI_SIZE_TO_PAGES (Size));  if (Buffer !=
> + NULL) {
> +ZeroMem (Buffer, Size);
> +  }
> +
> +  return Buffer;
> +}
>  /**
>Callback function executed when the EndOfDxe event group is signaled.
> 
> @@ -171,10 +194,7 @@ CpuS3DataInitialize (
>//
>OldAcpiCpuData = (ACPI_CPU_DATA *) (UINTN) PcdGet64
> (PcdCpuS3DataAddress);
> 
> -  //
> -  // Allocate ACPI NVS memory below 4G memory for use on ACPI S3 resume.
> -  //
> -  AcpiCpuDataEx = AllocateAcpiNvsMemoryBelow4G (sizeof
> (ACPI_CPU_DATA_EX));
> +  AcpiCpuDataEx = AllocateZeroPages (sizeof (ACPI_CPU_DATA_EX));
>ASSERT (AcpiCpuDataEx != NULL);
>AcpiCpuData = >AcpiCpuData;
> 
> @@ -223,11 +243,11 @@ CpuS3DataInitialize (
>AsmReadIdtr (>IdtrProfile);
> 
>//
> -  // Allocate GDT and IDT in ACPI NVS and copy current GDT and IDT contents
> +  // Allocate GDT and IDT and copy current GDT and IDT contents
>//
>GdtSize = AcpiCpuDataEx->GdtrProfile.Limit + 1;
>IdtSize = AcpiCpuDataEx->IdtrProfile.Limit + 1;
> -  Gdt = AllocateAcpiNvsMemoryBelow4G (GdtSize + IdtSize);
> +  Gdt = AllocateZeroPages (GdtSize + IdtSize);
>ASSERT (Gdt != NULL);
>Idt = (VOID *)((UINTN)Gdt + GdtSize);
>CopyMem (Gdt, (VOID *)AcpiCpuDataEx->GdtrProfile.Base, GdtSize); @@ -
> 243,7 +263,7 @@ CpuS3DataInitialize (
>  // Allocate buffer for empty RegisterTable and PreSmmInitRegisterTable 
> for
> all CPUs
>  //
>  TableSize = 2 * NumberOfCpus * sizeof (CPU_REGISTER_TABLE);
> -RegisterTable = (CPU_REGISTER_TABLE *)AllocateAcpiNvsMemoryBelow4G
> (TableSize);
> +RegisterTable = (CPU_REGISTER_TABLE *)AllocateZeroPages
> + (TableSize);
>  ASSERT (RegisterTable != NULL);
> 
>  for (Index = 0; Index < NumberOfCpus; Index++) { diff --git
> a/UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf
> b/UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf
> index 480c98ebcd..c16731529c 100644
> --- a/UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf
> +++ b/UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf
> @@ -51,6 +51,7 @@
>DebugLib
>BaseLib
>MtrrLib
> +  MemoryAllocationLib
> 
>  [Guids]
>gEfiEndOfDxeEventGroupGuid ## CONSUMES   ## Event
> --
> 2.15.0.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] [Patch][edk2-platforms/devel-IntelAtomProcessorE3900] UP2 PCIe NIC.

2018-08-14 Thread zwei4
Disable PCIe root port 1 of UP2, which is connected to a onboard RealTek PCIe 
NIC. If this PCIe NIC is enabled, Windows 10 installation will fail. This patch 
is a temporary solution.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: David Wei 
CC: Mike Wu  
CC: Mang Guo 
---
 .../Board/UP2/BoardInitDxe/BoardInitDxe.c  | 42 +-
 .../Board/UP2/BoardInitDxe/BoardInitDxe.h  |  1 +
 2 files changed, 42 insertions(+), 1 deletion(-)

diff --git a/Platform/BroxtonPlatformPkg/Board/UP2/BoardInitDxe/BoardInitDxe.c 
b/Platform/BroxtonPlatformPkg/Board/UP2/BoardInitDxe/BoardInitDxe.c
index 3b5c5ac566..662d8f1991 100644
--- a/Platform/BroxtonPlatformPkg/Board/UP2/BoardInitDxe/BoardInitDxe.c
+++ b/Platform/BroxtonPlatformPkg/Board/UP2/BoardInitDxe/BoardInitDxe.c
@@ -17,6 +17,7 @@
 #include "BoardInitDxe.h"
 
 GET_BOARD_NAME mUp2GetBoardNamePtr = Up2GetBoardName;
+SYSTEM_CONFIGURATION  mSystemConfiguration;
 
 CHAR16*
 EFIAPI
@@ -37,7 +38,44 @@ Up2GetBoardName (
   }
 }
 
-
+EFI_STATUS
+UpdateSetupVariable (
+  VOID
+  )
+{
+  UINTN   VarSize;
+  UINT32  VariableAttributes;
+  EFI_STATUS  Status;
+
+  //
+  // Update default value of Setup Variable for PCIe W/A.
+  // PCIe RealTek NIC on root port #1 blocks Windows 10 installation.
+  //
+  
+  VarSize = sizeof (SYSTEM_CONFIGURATION);
+  Status = gRT->GetVariable (
+L"Setup",
+,
+,
+,
+
+);
+  ASSERT_EFI_ERROR (Status);
+
+  if (Status == EFI_SUCCESS) {
+mSystemConfiguration.PcieRootPortEn[3]= (UINT8) 0;
+Status = gRT->SetVariable (
+L"Setup",
+,
+VariableAttributes,
+VarSize,
+
+);
+ASSERT_EFI_ERROR (Status);
+  }
+  
+  return Status;
+}
 /**
   Set PCDs for board specific functions
 
@@ -62,6 +100,8 @@ Up2BoardInitDxeConstructor (
   }
 
   PcdSet64 (PcdGetBoardNameFunc, (UINT64) mUp2GetBoardNamePtr);
+ 
+  UpdateSetupVariable();
 
   return EFI_SUCCESS;
 }
diff --git a/Platform/BroxtonPlatformPkg/Board/UP2/BoardInitDxe/BoardInitDxe.h 
b/Platform/BroxtonPlatformPkg/Board/UP2/BoardInitDxe/BoardInitDxe.h
index 61e66978ac..82e976e7ef 100644
--- a/Platform/BroxtonPlatformPkg/Board/UP2/BoardInitDxe/BoardInitDxe.h
+++ b/Platform/BroxtonPlatformPkg/Board/UP2/BoardInitDxe/BoardInitDxe.h
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 
 CHAR16*
 EFIAPI
-- 
2.14.1.windows.1

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


Re: [edk2] [PATCH edk2-platforms v1 07/38] Silicon/Hisilicon/D06: Wait for all disk ready

2018-08-14 Thread Ming


在 8/14/2018 11:26 PM, Leif Lindholm 写道:
> On Fri, Aug 10, 2018 at 09:44:29AM +0800, Ming wrote:
>>> Which is exactly what an event is for.
>>> At the point where the SAS controller driver is currently updating the
>>> variable, it can instead call SignalEvent ().
>>>
>>> The WaitForDiskReady () function can be changed to wait/check for that 
>>> event.
>>
>> As current solution(using variables) have run stable, I prefer don't change
>> SAS driver and this wait function. Is it OK?
> 
> You can leave the driver out if you wish, but it cannot go into the
> 18.08 release with this design.

With event, two problem should be solved:
1 How to share the event between SAS driver and PlatformBootManagerLib;
2 How to avoid waiting for D03/D05;

For the two problems I plan to install a protocal in D06 SAS driver and
locate the protocal in PlatformBootManagerLib. if fail to locate (D03/D05),
it will not wait.
struct _HISI_SAS_NOTIFY_PROTOCAL {
  EFI_EVENT  WaitDiskEvent;
};
How about this?

> 
> This is why it is important to publish the code as soon as possible -
> especially for new platform ports. And to publish bits that are
> possible earlier, rather than wait and do everything in one go once
> the whole port is done.
> 
> Best Regards,
> 
> Leif
> 
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH 1/1] OvmfPkg: link Sha384 and Sha512 support into Tcg2Pei and Tcg2Dxe

2018-08-14 Thread Gary Lin
Sha384 and Sha512 were added to HashInstanceLib recently. To make them
available in Tcg2Pei and Tcg2Dxe, we have to link both libraries.

Cc: Ard Biesheuvel 
Cc: Jordan Justen 
Cc: Laszlo Ersek 
Cc: Marc-André Lureau 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Gary Lin 
---
 OvmfPkg/OvmfPkgIa32.dsc| 4 
 OvmfPkg/OvmfPkgIa32X64.dsc | 4 
 OvmfPkg/OvmfPkgX64.dsc | 4 
 3 files changed, 12 insertions(+)

diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index a28b511d5c2f..9f07e75050c0 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -634,6 +634,8 @@ [Components]
   
HashLib|SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterPei.inf
   NULL|SecurityPkg/Library/HashInstanceLibSha1/HashInstanceLibSha1.inf
   NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256.inf
+  NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384.inf
+  NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512.inf
   }
 !endif
 
@@ -936,5 +938,7 @@ [Components]
   
HashLib|SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterDxe.inf
   NULL|SecurityPkg/Library/HashInstanceLibSha1/HashInstanceLibSha1.inf
   NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256.inf
+  NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384.inf
+  NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512.inf
   }
 !endif
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index 115d0c01ff5c..a4eaeb808c6b 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -642,6 +642,8 @@ [Components.IA32]
   
HashLib|SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterPei.inf
   NULL|SecurityPkg/Library/HashInstanceLibSha1/HashInstanceLibSha1.inf
   NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256.inf
+  NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384.inf
+  NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512.inf
   }
 !endif
 
@@ -946,5 +948,7 @@ [Components.X64]
   
HashLib|SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterDxe.inf
   NULL|SecurityPkg/Library/HashInstanceLibSha1/HashInstanceLibSha1.inf
   NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256.inf
+  NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384.inf
+  NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512.inf
   }
 !endif
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index 362eb789c712..aa3efc5e73b9 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -641,6 +641,8 @@ [Components]
   
HashLib|SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterPei.inf
   NULL|SecurityPkg/Library/HashInstanceLibSha1/HashInstanceLibSha1.inf
   NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256.inf
+  NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384.inf
+  NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512.inf
   }
 !endif
 
@@ -944,5 +946,7 @@ [Components]
   
HashLib|SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterDxe.inf
   NULL|SecurityPkg/Library/HashInstanceLibSha1/HashInstanceLibSha1.inf
   NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256.inf
+  NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384.inf
+  NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512.inf
   }
 !endif
-- 
2.18.0

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


Re: [edk2] [PATCH v1 0/2] add DwMmcHcDxe driver

2018-08-14 Thread Chris Co
> -Original Message-
> From: Leif Lindholm 
> Sent: Tuesday, August 14, 2018 9:32 AM
> To: Haojian Zhuang 
> Cc: edk2-devel@lists.01.org; Ard Biesheuvel ;
> Chris Co 
> Subject: Re: [edk2][PATCH v1 0/2] add DwMmcHcDxe driver
> 
> Haojian,
> 
> This is kind of massive.
> Is there any way it could be broken into more patches?
> The NonDiscoverableDeviceDxe patch is OK, but the changes to
> DwMmcHcDxe are gargantuan.
> 
> Chris - does any of this turn into something you could use for your platforms?
>

Thanks for pointing this out Leif.  One of the main reasons we wrote our own 
was that we needed to support eMMC and SD, which was missing from the original 
EmbeddedPkg driver.  I'd like to use this if possible, but I will need to spend 
some time reviewing it to make sure it suits our needs.

Haojian, please CC me on any followup reviews if possible.

Thanks,
Chris

> /
> Leis
> 
> On Fri, Aug 10, 2018 at 04:49:13PM +0800, Haojian Zhuang wrote:
> > Changelog:
> > v1:
> >   *Add NonDiscoverableDeviceDxe for embedded platform. Make
> DwMmcHcDxe driver
> >to support both eMMC and SD controller.
> >
> > Haojian Zhuang (2):
> >   EmbeddedPkg: add NonDiscoverableDeviceDxe driver
> >   EmbeddedPkg: add DwMmcHcDxe driver
> >
> >  EmbeddedPkg/Drivers/DwMmcHcDxe/DwMmcHcDxe.dec  
> >  |
> 40 +
> >  EmbeddedPkg/EmbeddedPkg.dec
> >  |1 +
> >  EmbeddedPkg/Drivers/DwMmcHcDxe/DwMmcHcDxe.inf  
> >  |
> 69 +
> >
> EmbeddedPkg/Universal/NonDiscoverableDeviceDxe/NonDiscoverableDevic
> eDxe.inf |   52 +
> >  EmbeddedPkg/Drivers/DwMmcHcDxe/DwMmcHcDxe.h
> >  |
> 815 +++
> >  EmbeddedPkg/Drivers/DwMmcHcDxe/DwMmcHci.h  
> >  |
> 983 
> >  EmbeddedPkg/Include/Protocol/PlatformDwMmc.h   
> >  |   79 +
> >
> EmbeddedPkg/Universal/NonDiscoverableDeviceDxe/NonDiscoverableDevic
> eIo.h|   92 +
> >  EmbeddedPkg/Drivers/DwMmcHcDxe/ComponentName.c
> |  214 ++
> >  EmbeddedPkg/Drivers/DwMmcHcDxe/DwMmcHcDxe.c
> >  |
> 1295 +++
> >  EmbeddedPkg/Drivers/DwMmcHcDxe/DwMmcHci.c  
> >  |
> 2366 
> >  EmbeddedPkg/Drivers/DwMmcHcDxe/EmmcDevice.c
> >  |
> 1042 +
> >  EmbeddedPkg/Drivers/DwMmcHcDxe/SdDevice.c  
> >  | 1104
> +
> >  EmbeddedPkg/Universal/NonDiscoverableDeviceDxe/ComponentName.c
> |  124 +
> >
> EmbeddedPkg/Universal/NonDiscoverableDeviceDxe/NonDiscoverableDevic
> eDxe.c   |  243 ++
> >
> EmbeddedPkg/Universal/NonDiscoverableDeviceDxe/NonDiscoverableDevic
> eIo.c|  972 
> >  16 files changed, 9491 insertions(+)
> >  create mode 100644
> EmbeddedPkg/Drivers/DwMmcHcDxe/DwMmcHcDxe.dec
> >  create mode 100644
> EmbeddedPkg/Drivers/DwMmcHcDxe/DwMmcHcDxe.inf
> >  create mode 100644
> >
> EmbeddedPkg/Universal/NonDiscoverableDeviceDxe/NonDiscoverableDevic
> eDx
> > e.inf  create mode 100644
> EmbeddedPkg/Drivers/DwMmcHcDxe/DwMmcHcDxe.h
> >  create mode 100644 EmbeddedPkg/Drivers/DwMmcHcDxe/DwMmcHci.h
> >  create mode 100644 EmbeddedPkg/Include/Protocol/PlatformDwMmc.h
> >  create mode 100644
> >
> EmbeddedPkg/Universal/NonDiscoverableDeviceDxe/NonDiscoverableDevic
> eIo
> > .h  create mode 100644
> EmbeddedPkg/Drivers/DwMmcHcDxe/ComponentName.c
> >  create mode 100644
> EmbeddedPkg/Drivers/DwMmcHcDxe/DwMmcHcDxe.c
> >  create mode 100644 EmbeddedPkg/Drivers/DwMmcHcDxe/DwMmcHci.c
> >  create mode 100644 EmbeddedPkg/Drivers/DwMmcHcDxe/EmmcDevice.c
> >  create mode 100644 EmbeddedPkg/Drivers/DwMmcHcDxe/SdDevice.c
> >  create mode 100644
> > EmbeddedPkg/Universal/NonDiscoverableDeviceDxe/ComponentName.c
> >  create mode 100644
> >
> EmbeddedPkg/Universal/NonDiscoverableDeviceDxe/NonDiscoverableDevic
> eDx
> > e.c  create mode 100644
> >
> EmbeddedPkg/Universal/NonDiscoverableDeviceDxe/NonDiscoverableDevic
> eIo
> > .c
> >
> > Cc: Leif Lindholm 
> > Cc: Ard Biesheuvel 
> > --
> > 2.7.4
> >
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH v2 02/27] MdeModulePkg UiApp: Remove redundant functions

2018-08-14 Thread Dong, Eric
Reviewed-by: Eric Dong 

> -Original Message-
> From: Zhang, Shenglei
> Sent: Wednesday, August 15, 2018 9:46 AM
> To: edk2-devel@lists.01.org
> Cc: Zeng, Star ; Dong, Eric 
> Subject: [PATCH v2 02/27] MdeModulePkg UiApp: Remove redundant
> functions
> 
> The functions that are never called have been removed.
> They are EnableResetReminderFeature,
> DisableResetReminderFeature and DisableResetRequired.
> https://bugzilla.tianocore.org/show_bug.cgi?id=1062
> 
> Cc: Star Zeng 
> Cc: Eric Dong 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: shenglei 
> Reviewed-by: Laszlo Ersek 
> Reviewed-by: Star Zeng 
> ---
>  MdeModulePkg/Application/UiApp/FrontPage.c | 40 --
>  MdeModulePkg/Application/UiApp/Ui.h| 30 
>  2 files changed, 70 deletions(-)
> 
> diff --git a/MdeModulePkg/Application/UiApp/FrontPage.c
> b/MdeModulePkg/Application/UiApp/FrontPage.c
> index 2403aad9d9..f0513deb51 100644
> --- a/MdeModulePkg/Application/UiApp/FrontPage.c
> +++ b/MdeModulePkg/Application/UiApp/FrontPage.c
> @@ -1042,34 +1042,7 @@ UiEntry (
>  //
> 
> 
> -/**
> -  Enable the setup browser reset reminder feature.
> -  This routine is used in platform tip. If the platform policy need the 
> feature,
> use the routine to enable it.
> 
> -**/
> -VOID
> -EFIAPI
> -EnableResetReminderFeature (
> -  VOID
> -  )
> -{
> -  mFeaturerSwitch = TRUE;
> -}
> -
> -
> -/**
> -  Disable the setup browser reset reminder feature.
> -  This routine is used in platform tip. If the platform policy do not want 
> the
> feature, use the routine to disable it.
> -
> -**/
> -VOID
> -EFIAPI
> -DisableResetReminderFeature (
> -  VOID
> -  )
> -{
> -  mFeaturerSwitch = FALSE;
> -}
> 
> 
>  /**
> @@ -1087,19 +1060,6 @@ EnableResetRequired (  }
> 
> 
> -/**
> -  Record the info that  no reset is required.
> -  A  module boolean variable is used to record whether a reset is required.
> -
> -**/
> -VOID
> -EFIAPI
> -DisableResetRequired (
> -  VOID
> -  )
> -{
> -  mResetRequired = FALSE;
> -}
> 
> 
>  /**
> diff --git a/MdeModulePkg/Application/UiApp/Ui.h
> b/MdeModulePkg/Application/UiApp/Ui.h
> index a9c30b0c56..7be164570c 100644
> --- a/MdeModulePkg/Application/UiApp/Ui.h
> +++ b/MdeModulePkg/Application/UiApp/Ui.h
> @@ -53,27 +53,7 @@ typedef struct {
>  //
>  //The interface functions related to the Setup Browser Reset Reminder
> feature  //
> -/**
> -  Enable the setup browser reset reminder feature.
> -  This routine is used in a platform tip. If the platform policy needs the
> feature, use the routine to enable it.
> 
> -**/
> -VOID
> -EFIAPI
> -EnableResetReminderFeature (
> -  VOID
> -  );
> -
> -/**
> -  Disable the setup browser reset reminder feature.
> -  This routine is used in a platform tip. If the platform policy does not 
> want
> the feature, use the routine to disable it.
> -
> -**/
> -VOID
> -EFIAPI
> -DisableResetReminderFeature (
> -  VOID
> -  );
> 
>  /**
>Record the info that a reset is required.
> @@ -87,16 +67,6 @@ EnableResetRequired (
>);
> 
> 
> -/**
> -  Record the info that no reset is required.
> -  A module boolean variable is used to record whether a reset is required.
> -
> -**/
> -VOID
> -EFIAPI
> -DisableResetRequired (
> -  VOID
> -  );
> 
>  /**
>Check whether platform policy enables the reset reminder feature. The
> default is enabled.
> --
> 2.18.0.windows.1

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


Re: [edk2] [PATCH v2 22/27] MdeModulePkg HiiDatabaseDxe: Remove a redundant function

2018-08-14 Thread Dong, Eric
Reviewed-by: Eric Dong 

> -Original Message-
> From: Zhang, Shenglei
> Sent: Wednesday, August 15, 2018 9:46 AM
> To: edk2-devel@lists.01.org
> Cc: Zeng, Star ; Dong, Eric 
> Subject: [PATCH v2 22/27] MdeModulePkg HiiDatabaseDxe: Remove a
> redundant function
> 
> The function GetStorageWidth that is never called has been removed.
> https://bugzilla.tianocore.org/show_bug.cgi?id=1062
> 
> Cc: Star Zeng 
> Cc: Eric Dong 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: shenglei 
> Reviewed-by: Star Zeng 
> Reviewed-by: Laszlo Ersek 
> ---
>  .../Universal/HiiDatabaseDxe/ConfigRouting.c  | 47 ---
>  1 file changed, 47 deletions(-)
> 
> diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
> b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
> index c778cd92f8..39e1811e69 100644
> --- a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
> +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
> @@ -3590,53 +3590,6 @@ Done:
>return Status;
>  }
> 
> -/**
> -  Get Data buffer size based on data type.
> -
> -  @param  ValueType The input data type.
> -
> -  @retval The data buffer size for the input type.
> -**/
> -UINT16
> -GetStorageWidth (
> -  IN UINT8   ValueType
> -  )
> -{
> -  UINT16 StorageWidth;
> -
> -  switch (ValueType) {
> -  case EFI_IFR_NUMERIC_SIZE_1:
> -  case EFI_IFR_TYPE_BOOLEAN:
> -StorageWidth = (UINT16) sizeof (UINT8);
> -break;
> -
> -  case EFI_IFR_NUMERIC_SIZE_2:
> -StorageWidth = (UINT16) sizeof (UINT16);
> -break;
> -
> -  case EFI_IFR_NUMERIC_SIZE_4:
> -StorageWidth = (UINT16) sizeof (UINT32);
> -break;
> -
> -  case EFI_IFR_NUMERIC_SIZE_8:
> -StorageWidth = (UINT16) sizeof (UINT64);
> -break;
> -
> -  case EFI_IFR_TYPE_TIME:
> -StorageWidth = (UINT16) sizeof (EFI_IFR_TIME);
> -break;
> -
> -  case EFI_IFR_TYPE_DATE:
> -StorageWidth = (UINT16) sizeof (EFI_IFR_DATE);
> -break;
> -
> -  default:
> -StorageWidth = 0;
> -break;
> -  }
> -
> -  return StorageWidth;
> -}
> 
>  /**
>Update the default value in the block data which is used as bit var store.
> --
> 2.18.0.windows.1

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


[edk2] [Patch v4 5/5] UefiCpuPkg/RegisterCpuFeaturesLib: Combine implementation.

2018-08-14 Thread Eric Dong
V1 changes:
> Current code logic can't confirm CpuS3DataDxe driver start before
> CpuFeaturesDxe driver. So the assumption in CpuFeaturesDxe not valid.
> Add implementation for AllocateAcpiCpuData function to remove this
> assumption.

V2 changes:
> Because CpuS3Data memory will be copy to smram at SmmReadToLock point,
> so the memory type no need to be ACPI NVS type, also the address not
> limit to below 4G.
> This change remove the limit of ACPI NVS memory type and below 4G.

V3 changes:
> Remove function definition in header file.
> Add STATIC in function implementation.

Pass OS boot and resume from S3 test.

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

Reported-by: Marvin Häuser 
Suggested-by: Fan Jeff 
Cc: Marvin Häuser 
Cc: Fan Jeff 
Cc: Laszlo Ersek 
Cc: Ruiyu Ni 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Dong 
Reviewed-by: Laszlo Ersek 
Reviewed-by: Ruiyu Ni 
---
 .../DxeRegisterCpuFeaturesLib.c|  67 ---
 .../PeiRegisterCpuFeaturesLib.c| 131 -
 .../RegisterCpuFeaturesLib/RegisterCpuFeatures.h   |  20 
 .../RegisterCpuFeaturesLib.c   |  92 +++
 4 files changed, 92 insertions(+), 218 deletions(-)

diff --git 
a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLib.c 
b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLib.c
index 902a339529..1f34a3f489 100644
--- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLib.c
+++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLib.c
@@ -197,70 +197,3 @@ GetNumberOfProcessor (
   ASSERT_EFI_ERROR (Status);
 }
 
-/**
-  Allocates ACPI NVS memory to save ACPI_CPU_DATA.
-
-  @return  Pointer to allocated ACPI_CPU_DATA.
-**/
-ACPI_CPU_DATA *
-AllocateAcpiCpuData (
-  VOID
-  )
-{
-  //
-  // CpuS3DataDxe will do it.
-  //
-  ASSERT (FALSE);
-  return NULL;
-}
-
-/**
-  Enlarges CPU register table for each processor.
-
-  @param[in, out]  RegisterTable   Pointer processor's CPU register table
-**/
-VOID
-EnlargeRegisterTable (
-  IN OUT CPU_REGISTER_TABLE*RegisterTable
-  )
-{
-  EFI_STATUSStatus;
-  EFI_PHYSICAL_ADDRESS  Address;
-  UINTN AllocatePages;
-
-  Address = BASE_4GB - 1;
-  AllocatePages = RegisterTable->AllocatedSize / EFI_PAGE_SIZE;
-  Status  = gBS->AllocatePages (
-   AllocateMaxAddress,
-   EfiACPIMemoryNVS,
-   AllocatePages + 1,
-   
-   );
-  ASSERT_EFI_ERROR (Status);
-
-  //
-  // If there are records existing in the register table, then copy its 
contents
-  // to new region and free the old one.
-  //
-  if (RegisterTable->AllocatedSize > 0) {
-CopyMem (
-  (VOID *) (UINTN) Address,
-  (VOID *) (UINTN) RegisterTable->RegisterTableEntry,
-  RegisterTable->AllocatedSize
-  );
-//
-// RegisterTableEntry is allocated by gBS->AllocatePages() service.
-// So, gBS->FreePages() service is used to free it.
-//
-gBS->FreePages (
-  RegisterTable->RegisterTableEntry,
-  AllocatePages
-  );
-  }
-
-  //
-  // Adjust the allocated size and register table base address.
-  //
-  RegisterTable->AllocatedSize += EFI_PAGE_SIZE;
-  RegisterTable->RegisterTableEntry = Address;
-}
diff --git 
a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.c 
b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.c
index 6804eddf65..82fe268812 100644
--- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.c
+++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.c
@@ -257,134 +257,3 @@ GetNumberOfProcessor (
  );
   ASSERT_EFI_ERROR (Status);
 }
-
-/**
-  Allocates ACPI NVS memory to save ACPI_CPU_DATA.
-
-  @return  Pointer to allocated ACPI_CPU_DATA.
-**/
-ACPI_CPU_DATA *
-AllocateAcpiCpuData (
-  VOID
-  )
-{
-  EFI_STATUS   Status;
-  EFI_PEI_MP_SERVICES_PPI  *CpuMpPpi;
-  UINTNNumberOfCpus;
-  UINTNNumberOfEnabledProcessors;
-  ACPI_CPU_DATA*AcpiCpuData;
-  EFI_PHYSICAL_ADDRESS Address;
-  UINTNTableSize;
-  CPU_REGISTER_TABLE   *RegisterTable;
-  UINTNIndex;
-  EFI_PROCESSOR_INFORMATIONProcessorInfoBuffer;
-
-  Status = PeiServicesAllocatePages (
- EfiACPIMemoryNVS,
- EFI_SIZE_TO_PAGES (sizeof (ACPI_CPU_DATA)),
- 
- );
-  ASSERT_EFI_ERROR (Status);
-  AcpiCpuData = (ACPI_CPU_DATA *) (UINTN) Address;
-  ASSERT (AcpiCpuData != NULL);
-
-  //
-  // Get MP Services Protocol
-  //
-  Status = PeiServicesLocatePpi (
- ,
- 0,
- NULL,
- (VOID **)
- );
-  

[edk2] [Patch v4 4/5] UefiCpuPkg/CpuS3DataDxe: Remove below 4G limitation.

2018-08-14 Thread Eric Dong
Because PrepareApStartupVector() stores StackAddress to
"mExchangeInfo->StackStart" (which has type (VOID*)), and because
"UefiCpuPkg/PiSmmCpuDxeSmm/X64/MpFuncs.nasm" reads the latter with:

 add  edi, StackStartAddressLocation
 add  rax, qword [edi]
 mov  rsp, rax
 mov  qword [edi], rax

in long-mode code. So code can remove below 4G limitation.

Cc: Laszlo Ersek 
Cc: Ruiyu Ni 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Dong 
Reviewed-by: Laszlo Ersek 
Reviewed-by: Ruiyu Ni 
---
 UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c | 17 +
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c 
b/UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c
index 3e8c8b383c..ef98239844 100644
--- a/UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c
+++ b/UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c
@@ -47,9 +47,7 @@ typedef struct {
 } ACPI_CPU_DATA_EX;
 
 /**
-  Allocate EfiACPIMemoryNVS below 4G memory address.
-
-  This function allocates EfiACPIMemoryNVS below 4G memory address.
+  Allocate EfiACPIMemoryNVS memory.
 
   @param[in] Size   Size of memory to allocate.
 
@@ -57,7 +55,7 @@ typedef struct {
 
 **/
 VOID *
-AllocateAcpiNvsMemoryBelow4G (
+AllocateAcpiNvsMemory (
   IN UINTN  Size
   )
 {
@@ -65,9 +63,8 @@ AllocateAcpiNvsMemoryBelow4G (
   EFI_STATUSStatus;
   VOID  *Buffer;
 
-  Address = BASE_4GB - 1;
   Status  = gBS->AllocatePages (
-   AllocateMaxAddress,
+   AllocateAnyPages,
EfiACPIMemoryNVS,
EFI_SIZE_TO_PAGES (Size),

@@ -230,9 +227,13 @@ CpuS3DataInitialize (
   AcpiCpuData->MtrrTable= 
(EFI_PHYSICAL_ADDRESS)(UINTN)>MtrrTable;
 
   //
-  // Allocate stack space for all CPUs
+  // Allocate stack space for all CPUs.
+  // Use ACPI NVS memory type because this data will be directly used by APs
+  // in S3 resume phase in long mode. Also during S3 resume, the stack buffer
+  // will only be used as scratch space. i.e. we won't read anything from it
+  // before we write to it, in PiSmmCpuDxeSmm.
   //
-  Stack = AllocateAcpiNvsMemoryBelow4G (NumberOfCpus * AcpiCpuData->StackSize);
+  Stack = AllocateAcpiNvsMemory (NumberOfCpus * AcpiCpuData->StackSize);
   ASSERT (Stack != NULL);
   AcpiCpuData->StackAddress = (EFI_PHYSICAL_ADDRESS)(UINTN)Stack;
 
-- 
2.15.0.windows.1

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


[edk2] [Patch v4 3/5] UefiCpuPkg/CpuS3DataDxe: Change Memory Type and address limitation.

2018-08-14 Thread Eric Dong
Because CpuS3Data memory will be copy to smram at SmmReadyToLock point,
the memory type no need to be ACPI NVS type, also the address not
limit to below 4G.

This change remove the limit of ACPI NVS memory type and below 4G.

V4 Changes:
1. Create AllocateZeroPages and use it. It's easy to use than 
gBS->AllocatePages.

Pass OS boot and resume from S3 test.

Cc: Marvin Häuser 
Cc: Fan Jeff 
Cc: Laszlo Ersek 
Cc: Ruiyu Ni 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Dong 
---
 UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c  | 34 +---
 UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf |  1 +
 2 files changed, 28 insertions(+), 7 deletions(-)

diff --git a/UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c 
b/UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c
index dccb406b8d..3e8c8b383c 100644
--- a/UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c
+++ b/UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c
@@ -31,6 +31,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -81,6 +82,28 @@ AllocateAcpiNvsMemoryBelow4G (
   return Buffer;
 }
 
+/**
+  Allocate memory and clean it with zero.
+
+  @param[in] Size   Size of memory to allocate.
+
+  @return   Allocated address for output.
+
+**/
+VOID *
+AllocateZeroPages (
+  IN UINTN  Size
+  )
+{
+  VOID  *Buffer;
+
+  Buffer = AllocatePages (EFI_SIZE_TO_PAGES (Size));
+  if (Buffer != NULL) {
+ZeroMem (Buffer, Size);
+  }
+
+  return Buffer;
+}
 /**
   Callback function executed when the EndOfDxe event group is signaled.
 
@@ -171,10 +194,7 @@ CpuS3DataInitialize (
   //
   OldAcpiCpuData = (ACPI_CPU_DATA *) (UINTN) PcdGet64 (PcdCpuS3DataAddress);
 
-  //
-  // Allocate ACPI NVS memory below 4G memory for use on ACPI S3 resume.
-  //
-  AcpiCpuDataEx = AllocateAcpiNvsMemoryBelow4G (sizeof (ACPI_CPU_DATA_EX));
+  AcpiCpuDataEx = AllocateZeroPages (sizeof (ACPI_CPU_DATA_EX));
   ASSERT (AcpiCpuDataEx != NULL);
   AcpiCpuData = >AcpiCpuData;
 
@@ -223,11 +243,11 @@ CpuS3DataInitialize (
   AsmReadIdtr (>IdtrProfile);
 
   //
-  // Allocate GDT and IDT in ACPI NVS and copy current GDT and IDT contents
+  // Allocate GDT and IDT and copy current GDT and IDT contents
   //
   GdtSize = AcpiCpuDataEx->GdtrProfile.Limit + 1;
   IdtSize = AcpiCpuDataEx->IdtrProfile.Limit + 1;
-  Gdt = AllocateAcpiNvsMemoryBelow4G (GdtSize + IdtSize);
+  Gdt = AllocateZeroPages (GdtSize + IdtSize);
   ASSERT (Gdt != NULL);
   Idt = (VOID *)((UINTN)Gdt + GdtSize);
   CopyMem (Gdt, (VOID *)AcpiCpuDataEx->GdtrProfile.Base, GdtSize);
@@ -243,7 +263,7 @@ CpuS3DataInitialize (
 // Allocate buffer for empty RegisterTable and PreSmmInitRegisterTable for 
all CPUs
 //
 TableSize = 2 * NumberOfCpus * sizeof (CPU_REGISTER_TABLE);
-RegisterTable = (CPU_REGISTER_TABLE *)AllocateAcpiNvsMemoryBelow4G 
(TableSize);
+RegisterTable = (CPU_REGISTER_TABLE *)AllocateZeroPages (TableSize);
 ASSERT (RegisterTable != NULL);
 
 for (Index = 0; Index < NumberOfCpus; Index++) {
diff --git a/UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf 
b/UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf
index 480c98ebcd..c16731529c 100644
--- a/UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf
+++ b/UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf
@@ -51,6 +51,7 @@
   DebugLib
   BaseLib
   MtrrLib
+  MemoryAllocationLib
 
 [Guids]
   gEfiEndOfDxeEventGroupGuid ## CONSUMES   ## Event
-- 
2.15.0.windows.1

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


[edk2] [Patch v4 2/5] UefiCpuPkg/AcpiCpuData.h: Remove AcpiNVS and Below 4G limitation.

2018-08-14 Thread Eric Dong
ACPI_CPU_DATA structure first introduced to save data in
normal boot phase. Also this data will be used in S3 phase
by one PEI driver. So in first phase, this data is been
defined to use ACPI NVS memory type and must below 4G.

Later in order to fix potential security issue,
PiSmmCpuDxeSmm driver added logic to copy ACPI_CPU_DATA
(except ResetVector and Stack buffer) to  smram at smm
ready to lock point. ResetVector must below 1M and Stack
buffer is write only in S3 phase, so these two fields not
copy to smram. Also PiSmmCpuDxeSmm driver owned the task
to restore the CPU setting and it's a SMM driver.

After above change, the acpi nvs memory type and below 4G
limitation is no longer needed.

This change remove the limitation in the comments for
ACPI_CPU_DATA definition.

Cc: Marvin Häuser 
Cc: Fan Jeff 
Cc: Laszlo Ersek 
Cc: Ruiyu Ni 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Dong 
Reviewed-by: Laszlo Ersek 
Reviewed-by: Ruiyu Ni 
---
 UefiCpuPkg/Include/AcpiCpuData.h | 34 --
 1 file changed, 12 insertions(+), 22 deletions(-)

diff --git a/UefiCpuPkg/Include/AcpiCpuData.h b/UefiCpuPkg/Include/AcpiCpuData.h
index ec092074ce..9e51145c08 100644
--- a/UefiCpuPkg/Include/AcpiCpuData.h
+++ b/UefiCpuPkg/Include/AcpiCpuData.h
@@ -1,7 +1,7 @@
 /** @file
 Definitions for CPU S3 data.
 
-Copyright (c) 2013 - 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2013 - 2018, 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
@@ -57,15 +57,13 @@ typedef struct {
   //
   UINT32InitialApicId;
   //
-  // Physical address of CPU_REGISTER_TABLE_ENTRY structures.  This buffer 
must be
-  // allocated below 4GB from memory of type EfiACPIMemoryNVS.
+  // Physical address of CPU_REGISTER_TABLE_ENTRY structures.
   //
   EFI_PHYSICAL_ADDRESS  RegisterTableEntry;
 } CPU_REGISTER_TABLE;
 
 //
-// Data structure that is required for ACPI S3 resume.  This structure must be
-// allocated below 4GB from memory of type EfiACPIMemoryNVS.  The PCD
+// Data structure that is required for ACPI S3 resume. The PCD
 // PcdCpuS3DataAddress must be set to the physical address where this structure
 // is allocated
 //
@@ -78,21 +76,17 @@ typedef struct {
   //
   EFI_PHYSICAL_ADDRESS  StartupVector;
   //
-  // Physical address of structure of type IA32_DESCRIPTOR.  This structure 
must
-  // be allocated below 4GB from memory of type EfiACPIMemoryNVS.  The
+  // Physical address of structure of type IA32_DESCRIPTOR. The
   // IA32_DESCRIPTOR structure provides the base address and length of a GDT
-  // The buffer for GDT must also be allocated below 4GB from memory of type
-  // EfiACPIMemoryNVS.  The GDT must be filled in with the GDT contents that 
are
+  // The GDT must be filled in with the GDT contents that are
   // used during an ACPI S3 resume.  This is typically the contents of the GDT
   // used by the boot processor when the platform is booted.
   //
   EFI_PHYSICAL_ADDRESS  GdtrProfile;
   //
-  // Physical address of structure of type IA32_DESCRIPTOR.  This structure 
must
-  // be allocated below 4GB from memory of type EfiACPIMemoryNVS.  The
+  // Physical address of structure of type IA32_DESCRIPTOR.  The
   // IA32_DESCRIPTOR structure provides the base address and length of an IDT.
-  // The buffer for IDT must also be allocated below 4GB from memory of type
-  // EfiACPIMemoryNVS.  The IDT must be filled in with the IDT contents that 
are
+  // The IDT must be filled in with the IDT contents that are
   // used during an ACPI S3 resume.  This is typically the contents of the IDT
   // used by the boot processor when the platform is booted.
   //
@@ -100,7 +94,7 @@ typedef struct {
   //
   // Physical address of a buffer that is used as stacks during ACPI S3 resume.
   // The total size of this buffer, in bytes, is NumberOfCpus * StackSize.  
This
-  // structure must be allocated below 4GB from memory of type 
EfiACPIMemoryNVS.
+  // structure must be allocated from memory of type EfiACPIMemoryNVS.
   //
   EFI_PHYSICAL_ADDRESS  StackAddress;
   //
@@ -118,14 +112,12 @@ typedef struct {
   // Physical address of structure of type MTRR_SETTINGS that contains a copy
   // of the MTRR settings that are compatible with the MTRR settings used by
   // the boot processor when the platform was booted.  These MTRR settings are
-  // used during an ACPI S3 resume.  This structure must be allocated below 4GB
-  // from memory of type EfiACPIMemoryNVS.
+  // used during an ACPI S3 resume.
   //
   EFI_PHYSICAL_ADDRESS  MtrrTable;
   //
   // Physical address of an array of CPU_REGISTER_TABLE structures, with
-  // NumberOfCpus entries.  This array must be allocated below 4GB from memory
-  // of type EfiACPIMemoryNVS.  If a register 

[edk2] [Patch v4 0/5] Change CpuS3Data memory type and address limitation

2018-08-14 Thread Eric Dong
Because CpuS3Data memory will be copy to smram at SmmReadToLock point by 
PiSmmCpuDxeSmm driver, the memory type no need to be ACPI NVS type, also the 
address not limit to below 4G.

This change remove the limit of ACPI NVS memory type and below 4G.

Cc: Marvin H user 
Cc: Fan Jeff 
Cc: Laszlo Ersek 
Cc: Ruiyu Ni 

Eric Dong (5):
  UefiCpuPkg/PiSmmCpuDxeSmm: Use GDT/IDT saved in Smram.
  UefiCpuPkg/AcpiCpuData.h: Remove AcpiNVS and Below 4G limitation.
  UefiCpuPkg/CpuS3DataDxe: Change Memory Type and address limitation.
  UefiCpuPkg/CpuS3DataDxe: Remove below 4G limitation.
  UefiCpuPkg/RegisterCpuFeaturesLib: Combine implementation.

 UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c|  51 +---
 UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf   |   1 +
 UefiCpuPkg/Include/AcpiCpuData.h   |  34 ++
 .../DxeRegisterCpuFeaturesLib.c|  67 ---
 .../PeiRegisterCpuFeaturesLib.c| 131 -
 .../RegisterCpuFeaturesLib/RegisterCpuFeatures.h   |  20 
 .../RegisterCpuFeaturesLib.c   |  92 +++
 UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c  |  31 +++--
 8 files changed, 155 insertions(+), 272 deletions(-)

-- 
2.15.0.windows.1

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


[edk2] [Patch v4 1/5] UefiCpuPkg/PiSmmCpuDxeSmm: Use GDT/IDT saved in Smram.

2018-08-14 Thread Eric Dong
Current implementation will copy GDT/IDT at SmmReadyToLock point
from ACPI NVS memory to Smram. Later at S3 resume phase, it restore
the memory saved in Smram to ACPI NVS. It can directly use GDT/IDT
saved in Smram instead of restore the original ACPI NVS memory.
This patch do this change.

V4 changes:
1. Remove global variables mGdtForAp/mIdtForAp/mMachineCheckHandlerForAp.

Test Done:
  Do the OS boot and S3 resume test.

Cc: Laszlo Ersek 
Cc: Ruiyu Ni 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Dong 
---
 UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c | 31 ++-
 1 file changed, 14 insertions(+), 17 deletions(-)

diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c 
b/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c
index 0b8ef70359..abd8a5a07b 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c
@@ -66,9 +66,6 @@ ACPI_CPU_DATAmAcpiCpuData;
 volatile UINT32  mNumberToFinish;
 MP_CPU_EXCHANGE_INFO *mExchangeInfo;
 BOOLEAN  mRestoreSmmConfigurationInS3 = FALSE;
-VOID *mGdtForAp = NULL;
-VOID *mIdtForAp = NULL;
-VOID *mMachineCheckHandlerForAp = NULL;
 MP_MSR_LOCK  *mMsrSpinLocks = NULL;
 UINTNmMsrSpinLockCount;
 UINTNmMsrCount = 0;
@@ -448,13 +445,6 @@ PrepareApStartupVector (
   CopyMem ((VOID *) (UINTN) >GdtrProfile, (VOID *) (UINTN) 
mAcpiCpuData.GdtrProfile, sizeof (IA32_DESCRIPTOR));
   CopyMem ((VOID *) (UINTN) >IdtrProfile, (VOID *) (UINTN) 
mAcpiCpuData.IdtrProfile, sizeof (IA32_DESCRIPTOR));
 
-  //
-  // Copy AP's GDT, IDT and Machine Check handler from SMRAM to ACPI NVS memory
-  //
-  CopyMem ((VOID *) mExchangeInfo->GdtrProfile.Base, mGdtForAp, 
mExchangeInfo->GdtrProfile.Limit + 1);
-  CopyMem ((VOID *) mExchangeInfo->IdtrProfile.Base, mIdtForAp, 
mExchangeInfo->IdtrProfile.Limit + 1);
-  CopyMem ((VOID *)(UINTN) mAcpiCpuData.ApMachineCheckHandlerBase, 
mMachineCheckHandlerForAp, mAcpiCpuData.ApMachineCheckHandlerSize);
-
   mExchangeInfo->StackStart  = (VOID *) (UINTN) mAcpiCpuData.StackAddress;
   mExchangeInfo->StackSize   = mAcpiCpuData.StackSize;
   mExchangeInfo->BufferStart = (UINT32) StartupVector;
@@ -831,6 +821,9 @@ GetAcpiCpuData (
   ACPI_CPU_DATA  *AcpiCpuData;
   IA32_DESCRIPTOR*Gdtr;
   IA32_DESCRIPTOR*Idtr;
+  VOID   *GdtForAp;
+  VOID   *IdtForAp;
+  VOID   *MachineCheckHandlerForAp;
 
   if (!mAcpiS3Enable) {
 return;
@@ -893,14 +886,18 @@ GetAcpiCpuData (
   Gdtr = (IA32_DESCRIPTOR *)(UINTN)mAcpiCpuData.GdtrProfile;
   Idtr = (IA32_DESCRIPTOR *)(UINTN)mAcpiCpuData.IdtrProfile;
 
-  mGdtForAp = AllocatePool ((Gdtr->Limit + 1) + (Idtr->Limit + 1) +  
mAcpiCpuData.ApMachineCheckHandlerSize);
-  ASSERT (mGdtForAp != NULL);
-  mIdtForAp = (VOID *) ((UINTN)mGdtForAp + (Gdtr->Limit + 1));
-  mMachineCheckHandlerForAp = (VOID *) ((UINTN)mIdtForAp + (Idtr->Limit + 1));
+  GdtForAp = AllocatePool ((Gdtr->Limit + 1) + (Idtr->Limit + 1) +  
mAcpiCpuData.ApMachineCheckHandlerSize);
+  ASSERT (GdtForAp != NULL);
+  IdtForAp = (VOID *) ((UINTN)GdtForAp + (Gdtr->Limit + 1));
+  MachineCheckHandlerForAp = (VOID *) ((UINTN)IdtForAp + (Idtr->Limit + 1));
+
+  CopyMem (GdtForAp, (VOID *)Gdtr->Base, Gdtr->Limit + 1);
+  CopyMem (IdtForAp, (VOID *)Idtr->Base, Idtr->Limit + 1);
+  CopyMem (MachineCheckHandlerForAp, (VOID 
*)(UINTN)mAcpiCpuData.ApMachineCheckHandlerBase, 
mAcpiCpuData.ApMachineCheckHandlerSize);
 
-  CopyMem (mGdtForAp, (VOID *)Gdtr->Base, Gdtr->Limit + 1);
-  CopyMem (mIdtForAp, (VOID *)Idtr->Base, Idtr->Limit + 1);
-  CopyMem (mMachineCheckHandlerForAp, (VOID 
*)(UINTN)mAcpiCpuData.ApMachineCheckHandlerBase, 
mAcpiCpuData.ApMachineCheckHandlerSize);
+  Gdtr->Base = (UINTN)GdtForAp;
+  Idtr->Base = (UINTN)IdtForAp;
+  mAcpiCpuData.ApMachineCheckHandlerBase = 
(EFI_PHYSICAL_ADDRESS)(UINTN)MachineCheckHandlerForAp;
 }
 
 /**
-- 
2.15.0.windows.1

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


Re: [edk2] EDK II Stable Tag release edk2-stable201808 and quiet period starting today

2018-08-14 Thread Zhang, Chao B
Hi Laszlo:
   8  667abfaf8a16 UefiCpuPkg: Removing ipf which is no longer supported from 
edk2.
   9  df49a85dbcc6 CorebootModulePkg: Removing ipf from edk2.
  10  04c7f9023ffe CorebootPayloadPkg: Removing ipf from edk2.
  11  4fcb0d54584f NetworkPkg: Removing ipf which is no longer supported from 
edk2.
  12  87f9867f5536 QuarkPlatformPkg: Removing ipf which is no longer supported 
from edk2.
  13  fda6abd64f02 QuarkSocPkg: Removing ipf which is no longer supported from 
edk2.
  14  22ec06c8aaa1 Vlv2TbltDevicePkg: Removing ipf which from edk2.

  These patches are in a patch series to remove IPF. The community review has 
been started a very long time before silent period.  And part of patch series 
was already in EDK2.
There is no source code change but only removes some useless sections in INF & 
DSC. And from feature complete perspective, I think it is OK to check-in.
Anyway, We will learn from this process and be more careful.


From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Laszlo 
Ersek
Sent: Tuesday, August 14, 2018 11:12 PM
To: Kinney, Michael D ; edk2-devel@lists.01.org; 
leif.lindh...@linaro.org; Andrew Fish (af...@apple.com) ; 
Richardson, Brian 
Subject: Re: [edk2] EDK II Stable Tag release edk2-stable201808 and quiet 
period starting today

On 08/08/18 16:16, Kinney, Michael D wrote:
> Hello,
>
> I sent an RFC for review on EDK II stable tags.
>
> https://lists.01.org/pipermail/edk2-devel/2018-June/026474.html
>
> There were no objections and we would like to move forward
> with the an EDK II Stable Tag release.  The original goal was
> 8/10/2018.  I have seen a request to move the stable tag
> release out a few days.
>
> I recommend we target 8/15/2018 and start a quiet period
> on edk2/master starting today.  This means critical bug
> fixes only on edk2/master.  New features and large changes
> should be held until the edk2-stable201808 tag is created.
>
> Please use Bugzilla for the critical issues that must be
> fixed before the tag is created.
>
> https://bugzilla.tianocore.org/

The following commits have been pushed since we entered the quiet period
(the last commit before it was 9e6c4f1527e6, "FmpDevicePkg FmpDxe: Lock
variables in entrypoint instead of callback"):

   1  3781f14c31e0 SecurityPkg/Library/Tpm2DeviceLibDTpm: fix 
s/Constructor/CONSTRUCTOR

This is a critical bugfix, satisfying the requirement.

   2  b3e1e343fe34 SecurityPkg: HashLib: Update HashLib file GUID

Can also be considered an important bugfix (GUID duplication), although
the commit does not name a TianoCore BZ.

   3  10ea1b6853f9 Maintainers.txt: Add FmpDevicePkg maintainers

Can be considered an important bugfix (no maintainers listed for a
top-level package). Misses a TianoCore BZ reference.

   4  45e076b7a720 Vlv2TbltDevicePkg/Override/Bds: Add test key notification
   5  dc65dd5be697 Vlv2TbltDevicePkg/Feature/Capsule: Add FmpDeviceLib instances
   6  d3049066ca25 Vlv2TbltDevicePkg/Capsule: Add scripts to generate capsules
   7  1aa9314e3a84 Vlv2TbltDevicePkg: Update DSC/FDF to use FmpDevicePkg

These commits violate the quiet period. They add a feature.

   8  667abfaf8a16 UefiCpuPkg: Removing ipf which is no longer supported from 
edk2.
   9  df49a85dbcc6 CorebootModulePkg: Removing ipf from edk2.
  10  04c7f9023ffe CorebootPayloadPkg: Removing ipf from edk2.
  11  4fcb0d54584f NetworkPkg: Removing ipf which is no longer supported from 
edk2.
  12  87f9867f5536 QuarkPlatformPkg: Removing ipf which is no longer supported 
from edk2.
  13  fda6abd64f02 QuarkSocPkg: Removing ipf which is no longer supported from 
edk2.
  14  22ec06c8aaa1 Vlv2TbltDevicePkg: Removing ipf which from edk2.

These commits also violate the quiet period. They implement a valid
cleanup, but not a critical bugfix. They should have been delayed.

Laszlo
___
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 v2 07/27] MdeModulePkg SdMmcPciHcDxe: Remove redundant functions

2018-08-14 Thread Wu, Hao A
Sorry for missing this patch previously.
Reviewed-by: Hao Wu 

Best Regards,
Hao Wu


> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> shenglei
> Sent: Wednesday, August 15, 2018 9:46 AM
> To: edk2-devel@lists.01.org
> Cc: Dong, Eric; Zeng, Star
> Subject: [edk2] [PATCH v2 07/27] MdeModulePkg SdMmcPciHcDxe: Remove
> redundant functions
> 
> The functions that are never called have been removed.
> They are SdCardGetCsd and SdCardGetScr.
> https://bugzilla.tianocore.org/show_bug.cgi?id=1062
> 
> Cc: Star Zeng 
> Cc: Eric Dong 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: shenglei 
> ---
>  MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c | 107 --
>  1 file changed, 107 deletions(-)
> 
> diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c
> b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c
> index 9e70de956f..8c93933bc6 100644
> --- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c
> +++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c
> @@ -318,116 +318,9 @@ SdCardSetRca (
>return Status;
>  }
> 
> -/**
> -  Send command SEND_CSD to the SD device to get the data of the CSD
> register.
> -
> -  Refer to SD Physical Layer Simplified Spec 4.1 Section 4.7 for details.
> -
> -  @param[in]  PassThru  A pointer to the
> EFI_SD_MMC_PASS_THRU_PROTOCOL instance.
> -  @param[in]  Slot  The slot number of the SD card to send the 
> command
> to.
> -  @param[in]  Rca   The relative device address of selected device.
> -  @param[out] Csd   The buffer to store the content of the CSD 
> register.
> -Note the caller should ignore the lowest byte of 
> this
> -buffer as the content of this byte is 
> meaningless even
> -if the operation succeeds.
> -
> -  @retval EFI_SUCCESS   The operation is done correctly.
> -  @retval OthersThe operation fails.
> -
> -**/
> -EFI_STATUS
> -SdCardGetCsd (
> -  IN EFI_SD_MMC_PASS_THRU_PROTOCOL  *PassThru,
> -  IN UINT8  Slot,
> -  IN UINT16 Rca,
> - OUT SD_CSD *Csd
> -  )
> -{
> -  EFI_SD_MMC_COMMAND_BLOCK  SdMmcCmdBlk;
> -  EFI_SD_MMC_STATUS_BLOCK   SdMmcStatusBlk;
> -  EFI_SD_MMC_PASS_THRU_COMMAND_PACKET   Packet;
> -  EFI_STATUSStatus;
> -
> -  ZeroMem (, sizeof (SdMmcCmdBlk));
> -  ZeroMem (, sizeof (SdMmcStatusBlk));
> -  ZeroMem (, sizeof (Packet));
> -
> -  Packet.SdMmcCmdBlk= 
> -  Packet.SdMmcStatusBlk = 
> -  Packet.Timeout= SD_MMC_HC_GENERIC_TIMEOUT;
> 
> -  SdMmcCmdBlk.CommandIndex = SD_SEND_CSD;
> -  SdMmcCmdBlk.CommandType  = SdMmcCommandTypeAc;
> -  SdMmcCmdBlk.ResponseType = SdMmcResponseTypeR2;
> -  SdMmcCmdBlk.CommandArgument = (UINT32)Rca << 16;
> 
> -  Status = SdMmcPassThruPassThru (PassThru, Slot, , NULL);
> -  if (!EFI_ERROR (Status)) {
> -//
> -// For details, refer to SD Host Controller Simplified Spec 3.0 Table 
> 2-12.
> -//
> -CopyMem (((UINT8*)Csd) + 1, , sizeof (SD_CSD) - 1);
> -  }
> -
> -  return Status;
> -}
> -
> -/**
> -  Send command SEND_CSD to the SD device to get the data of the CSD
> register.
> -
> -  Refer to SD Physical Layer Simplified Spec 4.1 Section 4.7 for details.
> 
> -  @param[in]  PassThru  A pointer to the
> EFI_SD_MMC_PASS_THRU_PROTOCOL instance.
> -  @param[in]  Slot  The slot number of the SD card to send the 
> command
> to.
> -  @param[in]  Rca   The relative device address of selected device.
> -  @param[out] Scr   The buffer to store the content of the SCR 
> register.
> -
> -  @retval EFI_SUCCESS   The operation is done correctly.
> -  @retval OthersThe operation fails.
> -
> -**/
> -EFI_STATUS
> -SdCardGetScr (
> -  IN EFI_SD_MMC_PASS_THRU_PROTOCOL  *PassThru,
> -  IN UINT8  Slot,
> -  IN UINT16 Rca,
> - OUT SD_SCR *Scr
> -  )
> -{
> -  EFI_SD_MMC_COMMAND_BLOCK  SdMmcCmdBlk;
> -  EFI_SD_MMC_STATUS_BLOCK   SdMmcStatusBlk;
> -  EFI_SD_MMC_PASS_THRU_COMMAND_PACKET   Packet;
> -  EFI_STATUSStatus;
> -
> -  ZeroMem (, sizeof (SdMmcCmdBlk));
> -  ZeroMem (, sizeof (SdMmcStatusBlk));
> -  ZeroMem (, sizeof (Packet));
> -
> -  Packet.SdMmcCmdBlk= 
> -  Packet.SdMmcStatusBlk = 
> -  Packet.Timeout= SD_MMC_HC_GENERIC_TIMEOUT;
> -
> -  SdMmcCmdBlk.CommandIndex = SD_APP_CMD;
> -  SdMmcCmdBlk.CommandType  = SdMmcCommandTypeAc;
> -  SdMmcCmdBlk.ResponseType = SdMmcResponseTypeR1;
> -  SdMmcCmdBlk.CommandArgument = (UINT32)Rca << 16;
> -
> -  Status = SdMmcPassThruPassThru (PassThru, Slot, , NULL);
> -  if (EFI_ERROR (Status)) {
> -return Status;
> -  }
> -
> -  SdMmcCmdBlk.CommandIndex = SD_SEND_SCR;
> -  SdMmcCmdBlk.CommandType  = SdMmcCommandTypeAdtc;
> 

Re: [edk2] [PATCH 1/1] OvmfPkg: Resolve HashInstanceLibSha384 and HashInstanceLibSha512

2018-08-14 Thread Gary Lin
On Tue, Aug 14, 2018 at 06:37:51PM +0200, Laszlo Ersek wrote:
> Hi Gary,
> 
> (+ Marc-André)
> 
> On 08/14/18 09:36, Gary Lin wrote:
> > Sha384 and Sha512 were added to HashInstanceLib recently. Resolve those
> > two libraries to enable SHA384 and SHA512 support in TPM.
> > 
> > Cc: Ard Biesheuvel 
> > Cc: Jordan Justen 
> > Cc: Laszlo Ersek 
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Gary Lin 
> > ---
> >  OvmfPkg/OvmfPkgIa32.dsc| 4 
> >  OvmfPkg/OvmfPkgIa32X64.dsc | 4 
> >  OvmfPkg/OvmfPkgX64.dsc | 4 
> >  3 files changed, 12 insertions(+)
> > 
> > diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
> > index a28b511d5c2f..9f07e75050c0 100644
> > --- a/OvmfPkg/OvmfPkgIa32.dsc
> > +++ b/OvmfPkg/OvmfPkgIa32.dsc
> > @@ -634,6 +634,8 @@ [Components]
> >
> > HashLib|SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterPei.inf
> >NULL|SecurityPkg/Library/HashInstanceLibSha1/HashInstanceLibSha1.inf
> >
> > NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256.inf
> > +  
> > NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384.inf
> > +  
> > NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512.inf
> >}
> >  !endif
> >  
> > @@ -936,5 +938,7 @@ [Components]
> >
> > HashLib|SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterDxe.inf
> >NULL|SecurityPkg/Library/HashInstanceLibSha1/HashInstanceLibSha1.inf
> >
> > NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256.inf
> > +  
> > NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384.inf
> > +  
> > NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512.inf
> >}
> >  !endif
> > diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
> > index 115d0c01ff5c..a4eaeb808c6b 100644
> > --- a/OvmfPkg/OvmfPkgIa32X64.dsc
> > +++ b/OvmfPkg/OvmfPkgIa32X64.dsc
> > @@ -642,6 +642,8 @@ [Components.IA32]
> >
> > HashLib|SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterPei.inf
> >NULL|SecurityPkg/Library/HashInstanceLibSha1/HashInstanceLibSha1.inf
> >
> > NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256.inf
> > +  
> > NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384.inf
> > +  
> > NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512.inf
> >}
> >  !endif
> >  
> > @@ -946,5 +948,7 @@ [Components.X64]
> >
> > HashLib|SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterDxe.inf
> >NULL|SecurityPkg/Library/HashInstanceLibSha1/HashInstanceLibSha1.inf
> >
> > NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256.inf
> > +  
> > NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384.inf
> > +  
> > NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512.inf
> >}
> >  !endif
> > diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
> > index 362eb789c712..aa3efc5e73b9 100644
> > --- a/OvmfPkg/OvmfPkgX64.dsc
> > +++ b/OvmfPkg/OvmfPkgX64.dsc
> > @@ -641,6 +641,8 @@ [Components]
> >
> > HashLib|SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterPei.inf
> >NULL|SecurityPkg/Library/HashInstanceLibSha1/HashInstanceLibSha1.inf
> >
> > NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256.inf
> > +  
> > NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384.inf
> > +  
> > NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512.inf
> >}
> >  !endif
> >  
> > @@ -944,5 +946,7 @@ [Components]
> >
> > HashLib|SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterDxe.inf
> >NULL|SecurityPkg/Library/HashInstanceLibSha1/HashInstanceLibSha1.inf
> >
> > NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256.inf
> > +  
> > NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384.inf
> > +  
> > NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512.inf
> >}
> >  !endif
> > 
> 
> this patch looks good to me, but we'll have to delay it until after the
> stable tag (see "EDK II Stable Tag release edk2-stable201808 and quiet
> period starting today").
> 
> Meanwhile, can you please repost the patch with some commit message
> updates (including the subject): we're not really resolving these
> libraries for OvmfPkg; instead we link them into Tcg2Pei and Tcg2Dxe via
> NULL class resolution. So I suggest the following subject:
> 
>   OvmfPkg: link Sha384 and Sha512 support into Tcg2Pei and Tcg2Dxe
> 
> Please try to replace the "resolve those two libraries" expression in
> the commit message similarly.
Sure. Will repost the patch after modifying the title and description.

Thanks,

Gary Lin

> 
> Thanks!
> Laszlo
> 

[edk2] [PATCH v2 22/27] MdeModulePkg HiiDatabaseDxe: Remove a redundant function

2018-08-14 Thread shenglei
The function GetStorageWidth that is never called
has been removed.
https://bugzilla.tianocore.org/show_bug.cgi?id=1062

Cc: Star Zeng 
Cc: Eric Dong 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: shenglei 
Reviewed-by: Star Zeng 
Reviewed-by: Laszlo Ersek 
---
 .../Universal/HiiDatabaseDxe/ConfigRouting.c  | 47 ---
 1 file changed, 47 deletions(-)

diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c 
b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
index c778cd92f8..39e1811e69 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
@@ -3590,53 +3590,6 @@ Done:
   return Status;
 }
 
-/**
-  Get Data buffer size based on data type.
-
-  @param  ValueType The input data type.
-
-  @retval The data buffer size for the input type.
-**/
-UINT16
-GetStorageWidth (
-  IN UINT8   ValueType
-  )
-{
-  UINT16 StorageWidth;
-
-  switch (ValueType) {
-  case EFI_IFR_NUMERIC_SIZE_1:
-  case EFI_IFR_TYPE_BOOLEAN:
-StorageWidth = (UINT16) sizeof (UINT8);
-break;
-
-  case EFI_IFR_NUMERIC_SIZE_2:
-StorageWidth = (UINT16) sizeof (UINT16);
-break;
-
-  case EFI_IFR_NUMERIC_SIZE_4:
-StorageWidth = (UINT16) sizeof (UINT32);
-break;
-
-  case EFI_IFR_NUMERIC_SIZE_8:
-StorageWidth = (UINT16) sizeof (UINT64);
-break;
-
-  case EFI_IFR_TYPE_TIME:
-StorageWidth = (UINT16) sizeof (EFI_IFR_TIME);
-break;
-
-  case EFI_IFR_TYPE_DATE:
-StorageWidth = (UINT16) sizeof (EFI_IFR_DATE);
-break;
-
-  default:
-StorageWidth = 0;
-break;
-  }
-
-  return StorageWidth;
-}
 
 /**
   Update the default value in the block data which is used as bit var store.
-- 
2.18.0.windows.1

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


[edk2] [PATCH v2 21/27] MdeModulePkg TerminalDxe: Remove a redundant function

2018-08-14 Thread shenglei
The function UnicodeFiFoGetKeyCount that is never called
has been removed.
https://bugzilla.tianocore.org/show_bug.cgi?id=1062

Cc: Star Zeng 
Cc: Eric Dong 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: shenglei 
Reviewed-by: Ruiyu Ni 
Reviewed-by: Star Zeng 
Reviewed-by: Laszlo Ersek 
---
 .../Universal/Console/TerminalDxe/Terminal.h  | 12 -
 .../Console/TerminalDxe/TerminalConIn.c   | 25 ---
 2 files changed, 37 deletions(-)

diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h 
b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h
index a4543fc8de..84808d55a0 100644
--- a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h
+++ b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h
@@ -1131,18 +1131,6 @@ IsUnicodeFiFoFull (
   TERMINAL_DEV  *TerminalDevice
   );
 
-/**
-  Count Unicode FIFO buffer.
-
-  @param  TerminalDevice   Terminal driver private structure
-
-  @return The count in bytes of Unicode FIFO.
-
-**/
-UINT8
-UnicodeFiFoGetKeyCount (
-  TERMINAL_DEV*TerminalDevice
-  );
 
 /**
   Translate raw data into Unicode (according to different encode), and
diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c 
b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c
index 80c4f6b483..33f9b6e585 100644
--- a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c
+++ b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c
@@ -1200,31 +1200,6 @@ IsUnicodeFiFoFull (
   return FALSE;
 }
 
-/**
-  Count Unicode FIFO buffer.
-
-  @param  TerminalDevice   Terminal driver private structure
-
-  @return The count in bytes of Unicode FIFO.
-
-**/
-UINT8
-UnicodeFiFoGetKeyCount (
-  TERMINAL_DEV*TerminalDevice
-  )
-{
-  UINT8 Tail;
-  UINT8 Head;
-
-  Tail  = TerminalDevice->UnicodeFiFo->Tail;
-  Head  = TerminalDevice->UnicodeFiFo->Head;
-
-  if (Tail >= Head) {
-return (UINT8) (Tail - Head);
-  } else {
-return (UINT8) (Tail + FIFO_MAX_NUMBER + 1 - Head);
-  }
-}
 
 /**
   Update the Unicode characters from a terminal input device into EFI Keys 
FIFO.
-- 
2.18.0.windows.1

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


[edk2] [PATCH v2 27/27] MdeModulePkg UiApp: Remove a redundant function and a variable

2018-08-14 Thread shenglei
1.After the cleanup at "MdeModulePkg UiApp: Remove redundant functions",
  the function "IsResetReminderFeatureEnable()" and the variable
  "mFeaturerSwitch" become redundant so they have been removed.
2.Therefore, the "IF" expression has also been removed, whose judgment condition
  is "IsResetReminderFeatureEnable()".
https://bugzilla.tianocore.org/show_bug.cgi?id=1062

Cc: Star Zeng 
Cc: Eric Dong 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: shenglei 
---
 MdeModulePkg/Application/UiApp/FrontPage.c | 51 --
 1 file changed, 17 insertions(+), 34 deletions(-)

diff --git a/MdeModulePkg/Application/UiApp/FrontPage.c 
b/MdeModulePkg/Application/UiApp/FrontPage.c
index f0513deb51..650aea931d 100644
--- a/MdeModulePkg/Application/UiApp/FrontPage.c
+++ b/MdeModulePkg/Application/UiApp/FrontPage.c
@@ -20,7 +20,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 
 EFI_GUID   mFrontPageGuid  = FRONT_PAGE_FORMSET_GUID;
 
-BOOLEAN   mFeaturerSwitch = TRUE;
 BOOLEAN   mResetRequired  = FALSE;
 
 EFI_FORM_BROWSER2_PROTOCOL  *gFormBrowser2;
@@ -1062,19 +1061,6 @@ EnableResetRequired (
 
 
 
-/**
-  Check whether platform policy enable the reset reminder feature. The default 
is enabled.
-
-**/
-BOOLEAN
-EFIAPI
-IsResetReminderFeatureEnable (
-  VOID
-  )
-{
-  return mFeaturerSwitch;
-}
-
 
 /**
   Check if  user changed any option setting which needs a system reset to be 
effective.
@@ -1106,31 +1092,28 @@ SetupResetReminder (
   CHAR16*StringBuffer1;
   CHAR16*StringBuffer2;
 
-
   //
   //check any reset required change is applied? if yes, reset system
   //
-  if (IsResetReminderFeatureEnable ()) {
-if (IsResetRequired ()) {
-
-  StringBuffer1 = AllocateZeroPool (MAX_STRING_LEN * sizeof (CHAR16));
-  ASSERT (StringBuffer1 != NULL);
-  StringBuffer2 = AllocateZeroPool (MAX_STRING_LEN * sizeof (CHAR16));
-  ASSERT (StringBuffer2 != NULL);
-  StrCpyS (StringBuffer1, MAX_STRING_LEN, L"Configuration changed. Reset 
to apply it Now.");
-  StrCpyS (StringBuffer2, MAX_STRING_LEN, L"Press ENTER to reset");
-  //
-  // Popup a menu to notice user
-  //
-  do {
-CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, , StringBuffer1, 
StringBuffer2, NULL);
-  } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
+  if (IsResetRequired ()) {
+
+StringBuffer1 = AllocateZeroPool (MAX_STRING_LEN * sizeof (CHAR16));
+ASSERT (StringBuffer1 != NULL);
+StringBuffer2 = AllocateZeroPool (MAX_STRING_LEN * sizeof (CHAR16));
+ASSERT (StringBuffer2 != NULL);
+StrCpyS (StringBuffer1, MAX_STRING_LEN, L"Configuration changed. Reset to 
apply it Now.");
+StrCpyS (StringBuffer2, MAX_STRING_LEN, L"Press ENTER to reset");
+//
+// Popup a menu to notice user
+//
+do {
+  CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, , StringBuffer1, 
StringBuffer2, NULL);
+} while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
 
-  FreePool (StringBuffer1);
-  FreePool (StringBuffer2);
+FreePool (StringBuffer1);
+FreePool (StringBuffer2);
 
-  gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);
-}
+gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);
   }
 }
 
-- 
2.18.0.windows.1

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


[edk2] [PATCH v2 20/27] MdeModulePkg SdBlockIoPei: Remove a redundant function

2018-08-14 Thread shenglei
The function SdPeimUnlinkMemBlock that is never called
has been removed.
https://bugzilla.tianocore.org/show_bug.cgi?id=1062

v2: Remove the comment that mentioned 'SdPeimUnlinkMemBlock'
within function SdPeimFreeMemPool().

Cc: Star Zeng 
Cc: Eric Dong 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: shenglei 
Reviewed-by: Hao Wu 
Reviewed-by: Star Zeng 
---
 MdeModulePkg/Bus/Sd/SdBlockIoPei/SdHcMem.c | 26 --
 1 file changed, 26 deletions(-)

diff --git a/MdeModulePkg/Bus/Sd/SdBlockIoPei/SdHcMem.c 
b/MdeModulePkg/Bus/Sd/SdBlockIoPei/SdHcMem.c
index 24ad3dc6c2..03b7963716 100644
--- a/MdeModulePkg/Bus/Sd/SdBlockIoPei/SdHcMem.c
+++ b/MdeModulePkg/Bus/Sd/SdBlockIoPei/SdHcMem.c
@@ -219,31 +219,7 @@ SdPeimIsMemBlockEmpty (
   return TRUE;
 }
 
-/**
-  Unlink the memory block from the pool's list.
-
-  @param  Head   The block list head of the memory's pool.
-  @param  BlockToUnlink  The memory block to unlink.
 
-**/
-VOID
-SdPeimUnlinkMemBlock (
-  IN SD_PEIM_MEM_BLOCK  *Head,
-  IN SD_PEIM_MEM_BLOCK  *BlockToUnlink
-  )
-{
-  SD_PEIM_MEM_BLOCK *Block;
-
-  ASSERT ((Head != NULL) && (BlockToUnlink != NULL));
-
-  for (Block = Head; Block != NULL; Block = Block->Next) {
-if (Block->Next == BlockToUnlink) {
-  Block->Next = BlockToUnlink->Next;
-  BlockToUnlink->Next = NULL;
-  break;
-}
-  }
-}
 
 /**
   Initialize the memory management pool for the host controller.
@@ -305,8 +281,6 @@ SdPeimFreeMemPool (
 
   //
   // Unlink all the memory blocks from the pool, then free them.
-  // SdPeimUnlinkMemBlock can't be used to unlink and free the
-  // first block.
   //
   for (Block = Pool->Head->Next; Block != NULL; Block = Pool->Head->Next) {
 SdPeimFreeMemBlock (Pool, Block);
-- 
2.18.0.windows.1

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


[edk2] [PATCH v2 19/27] MdeModulePkg EmmcBlockIoPei: Remove a redundant function

2018-08-14 Thread shenglei
The function EmmcPeimUnlinkMemBlock that is never called
has been removed.
https://bugzilla.tianocore.org/show_bug.cgi?id=1062

v2: Remove the comment that mentioned 'EmmcPeimUnlinkMemBlock'
within function EmmcPeimFreeMemPool().

Cc: Star Zeng 
Cc: Eric Dong 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: shenglei 
Reviewed-by: Hao Wu 
Reviewed-by: Star Zeng 
---
 .../Bus/Sd/EmmcBlockIoPei/EmmcHcMem.c | 26 ---
 1 file changed, 26 deletions(-)

diff --git a/MdeModulePkg/Bus/Sd/EmmcBlockIoPei/EmmcHcMem.c 
b/MdeModulePkg/Bus/Sd/EmmcBlockIoPei/EmmcHcMem.c
index a6f188f385..a55a34a3dc 100644
--- a/MdeModulePkg/Bus/Sd/EmmcBlockIoPei/EmmcHcMem.c
+++ b/MdeModulePkg/Bus/Sd/EmmcBlockIoPei/EmmcHcMem.c
@@ -219,31 +219,7 @@ EmmcPeimIsMemBlockEmpty (
   return TRUE;
 }
 
-/**
-  Unlink the memory block from the pool's list.
-
-  @param  Head   The block list head of the memory's pool.
-  @param  BlockToUnlink  The memory block to unlink.
 
-**/
-VOID
-EmmcPeimUnlinkMemBlock (
-  IN EMMC_PEIM_MEM_BLOCK  *Head,
-  IN EMMC_PEIM_MEM_BLOCK  *BlockToUnlink
-  )
-{
-  EMMC_PEIM_MEM_BLOCK *Block;
-
-  ASSERT ((Head != NULL) && (BlockToUnlink != NULL));
-
-  for (Block = Head; Block != NULL; Block = Block->Next) {
-if (Block->Next == BlockToUnlink) {
-  Block->Next = BlockToUnlink->Next;
-  BlockToUnlink->Next = NULL;
-  break;
-}
-  }
-}
 
 /**
   Initialize the memory management pool for the host controller.
@@ -305,8 +281,6 @@ EmmcPeimFreeMemPool (
 
   //
   // Unlink all the memory blocks from the pool, then free them.
-  // EmmcPeimUnlinkMemBlock can't be used to unlink and free the
-  // first block.
   //
   for (Block = Pool->Head->Next; Block != NULL; Block = Pool->Head->Next) {
 EmmcPeimFreeMemBlock (Pool, Block);
-- 
2.18.0.windows.1

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


[edk2] [PATCH v2 26/27] MdeModulePkg SetupBrowserDxe: Remove a redundant function

2018-08-14 Thread shenglei
The function IsDevicePathExist that is never called
has been removed.
https://bugzilla.tianocore.org/show_bug.cgi?id=1062

Cc: Star Zeng 
Cc: Eric Dong 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: shenglei 
---
 .../Universal/SetupBrowserDxe/IfrParse.c  | 33 ---
 1 file changed, 33 deletions(-)

diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c 
b/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c
index 3d28e7aa50..042bd4b30d 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c
@@ -452,39 +452,6 @@ IntializeBrowserStorage (
   }
 }
 
-/**
-  Check whether exist device path info in the ConfigHdr string.
-
-  @param  String UEFI configuration string
-
-  @retval TRUE   Device Path exist.
-  @retval FALSE  Not exist device path info.
-
-**/
-BOOLEAN
-IsDevicePathExist (
-  IN  EFI_STRING   String
-  )
-{
-  UINTNLength;
-
-  for (; (*String != 0 && StrnCmp (String, L"PATH=", StrLen (L"PATH=")) != 0); 
String++);
-  if (*String == 0) {
-return FALSE;
-  }
-
-  String += StrLen (L"PATH=");
-  if (*String == 0) {
-return FALSE;
-  }
-
-  for (Length = 0; *String != 0 && *String != L'&'; String++, Length++);
-  if (((Length + 1) / 2) < sizeof (EFI_DEVICE_PATH_PROTOCOL)) {
-return FALSE;
-  }
-
-  return TRUE;
-}
 
 /**
   Allocate a FORMSET_STORAGE data structure and insert to FormSet Storage List.
-- 
2.18.0.windows.1

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


[edk2] [PATCH v2 25/27] MdeModulePkg Tcp4Dxe: Remove redundant functions

2018-08-14 Thread shenglei
The functions that are never called have been removed.
They are SockRcvdErr,SockGroup and TcpPawsOK.
https://bugzilla.tianocore.org/show_bug.cgi?id=1062

Cc: Star Zeng 
Cc: Eric Dong 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: shenglei 
Reviewed-by: Laszlo Ersek 
---
 .../Universal/Network/Tcp4Dxe/SockImpl.c  | 35 
 .../Universal/Network/Tcp4Dxe/SockInterface.c | 41 ---
 .../Universal/Network/Tcp4Dxe/Socket.h| 32 ---
 .../Universal/Network/Tcp4Dxe/Tcp4Option.c| 28 -
 .../Universal/Network/Tcp4Dxe/Tcp4Option.h| 15 ---
 5 files changed, 151 deletions(-)

diff --git a/MdeModulePkg/Universal/Network/Tcp4Dxe/SockImpl.c 
b/MdeModulePkg/Universal/Network/Tcp4Dxe/SockImpl.c
index 0476077c20..adb5aa35cd 100644
--- a/MdeModulePkg/Universal/Network/Tcp4Dxe/SockImpl.c
+++ b/MdeModulePkg/Universal/Network/Tcp4Dxe/SockImpl.c
@@ -1107,41 +1107,6 @@ SockGetFreeSpace (
 }
 
 
-/**
-  Signal the receive token with the specific error or
-  set socket error code after error is received.
-
-  @param  Sock  Pointer to the socket.
-  @param  Error The error code received.
-
-**/
-VOID
-SockRcvdErr (
-  IN OUT SOCKET   *Sock,
-  IN EFI_STATUS   Error
-  )
-{
-  SOCK_TOKEN  *SockToken;
-
-  if (!IsListEmpty (>RcvTokenList)) {
-
-SockToken = NET_LIST_HEAD (
-  >RcvTokenList,
-  SOCK_TOKEN,
-  TokenList
-  );
-
-RemoveEntryList (>TokenList);
-
-SIGNAL_TOKEN (SockToken->Token, Error);
-
-FreePool (SockToken);
-  } else {
-
-SOCK_ERROR (Sock, Error);
-  }
-}
-
 
 /**
   Called by the low layer protocol to indicate that there will be no more data
diff --git a/MdeModulePkg/Universal/Network/Tcp4Dxe/SockInterface.c 
b/MdeModulePkg/Universal/Network/Tcp4Dxe/SockInterface.c
index 6dbabc4e51..cd20b8bcb2 100644
--- a/MdeModulePkg/Universal/Network/Tcp4Dxe/SockInterface.c
+++ b/MdeModulePkg/Universal/Network/Tcp4Dxe/SockInterface.c
@@ -938,48 +938,7 @@ SockGetMode (
 }
 
 
-/**
-  Configure the low level protocol to join a multicast group for
-  this socket's connection.
-
-  @param  Sock Pointer to the socket of the connection to join 
the
-   specific multicast group.
-  @param  GroupInfoPointer to the multicast group info.
-
-  @retval EFI_SUCCESS  The configuration is done successfully.
-  @retval EFI_ACCESS_DENIEDFailed to get the lock to access the socket.
-  @retval EFI_NOT_STARTED  The socket is not configured.
-
-**/
-EFI_STATUS
-SockGroup (
-  IN SOCKET *Sock,
-  IN VOID   *GroupInfo
-  )
-{
-  EFI_STATUS  Status;
-
-  Status = EfiAcquireLockOrFail (&(Sock->Lock));
-
-  if (EFI_ERROR (Status)) {
 
-DEBUG ((EFI_D_ERROR, "SockGroup: Get the access for socket"
-  " failed with %r", Status));
-
-return EFI_ACCESS_DENIED;
-  }
-
-  if (SOCK_IS_UNCONFIGURED (Sock)) {
-Status = EFI_NOT_STARTED;
-goto Exit;
-  }
-
-  Status = Sock->ProtoHandler (Sock, SOCK_GROUP, GroupInfo);
-
-Exit:
-  EfiReleaseLock (&(Sock->Lock));
-  return Status;
-}
 
 
 /**
diff --git a/MdeModulePkg/Universal/Network/Tcp4Dxe/Socket.h 
b/MdeModulePkg/Universal/Network/Tcp4Dxe/Socket.h
index 7ff2fc565e..650a7dd865 100644
--- a/MdeModulePkg/Universal/Network/Tcp4Dxe/Socket.h
+++ b/MdeModulePkg/Universal/Network/Tcp4Dxe/Socket.h
@@ -550,19 +550,6 @@ SockClone (
   IN SOCKET *Sock
   );
 
-/**
-  Signal the receive token with the specific error or
-  set socket error code after error is received.
-
-  @param  Sock  Pointer to the socket.
-  @param  Error The error code received.
-
-**/
-VOID
-SockRcvdErr (
-  IN OUT SOCKET   *Sock,
-  IN EFI_STATUS   Error
-  );
 
 ///
 /// Proto type of the create callback
@@ -909,25 +896,6 @@ SockGetMode (
   IN OUT VOID   *Mode
   );
 
-/**
-  Configure the low level protocol to join a multicast group for
-  this socket's connection.
-
-  @param  Sock Pointer to the socket of the connection to join 
the
-   specific multicast group.
-  @param  GroupInfoPointer to the multicast group info.
-
-  @retval EFI_SUCCESS  The configuration is done successfully.
-  @retval EFI_ACCESS_DENIEDFailed to get the lock to access the socket.
-  @retval EFI_NOT_STARTED  The socket is not configured.
-
-**/
-EFI_STATUS
-SockGroup (
-  IN SOCKET *Sock,
-  IN VOID   *GroupInfo
-  );
-
 /**
   Add or remove route information in IP route table associated
   with this socket.
diff --git a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Option.c 
b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Option.c
index 2817b80295..e84310f6c6 100644
--- a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Option.c
+++ b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Option.c
@@ -350,31 +350,3 @@ TcpParseOption (
 }
 
 
-/**
-  Check the segment against PAWS.
-
-  

[edk2] [PATCH v2 17/27] MdeModulePkg PiSmmCore: Remove redundant functions

2018-08-14 Thread shenglei
The functions that are never called have been removed.
They are IsImageInsideSmram,FindImageRecord,SmmRemoveImageRecord,
SmmMemoryAttributesTableConsistencyCheck,DumpSmmMemoryMapEntry,
SmmMemoryMapConsistencyCheckRange,SmmMemoryMapConsistencyCheck,
DumpSmmMemoryMap,ClearGuardMapBit,SetGuardMapBit,AdjustMemoryA,
AdjustMemoryS,IsHeadGuard and IsTailGuard.
FindImageRecord() is called by SmmRemoveImageRecord(); however,
nothing calls SmmRemoveImageRecord().
SmmMemoryMapConsistencyCheckRange() is called by
SmmMemoryMapConsistencyCheck(); however, nothing calls
SmmMemoryMapConsistencyCheck().
https://bugzilla.tianocore.org/show_bug.cgi?id=1062

v2:append the following to the commit message.
- FindImageRecord() is called by SmmRemoveImageRecord(); however,
nothing calls SmmRemoveImageRecord().
- SmmMemoryMapConsistencyCheckRange() is called by
SmmMemoryMapConsistencyCheck(); however, nothing calls
SmmMemoryMapConsistencyCheck().

Cc: Star Zeng 
Cc: Eric Dong 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: shenglei 
Reviewed-by: Jian J Wang mailto:jian.j.wang at 
intel.com>>
---
 MdeModulePkg/Core/PiSmmCore/HeapGuard.c   | 166 --
 .../Core/PiSmmCore/MemoryAttributesTable.c| 131 --
 MdeModulePkg/Core/PiSmmCore/Page.c| 121 -
 3 files changed, 418 deletions(-)

diff --git a/MdeModulePkg/Core/PiSmmCore/HeapGuard.c 
b/MdeModulePkg/Core/PiSmmCore/HeapGuard.c
index d9e54b96cb..f7ae9ae286 100644
--- a/MdeModulePkg/Core/PiSmmCore/HeapGuard.c
+++ b/MdeModulePkg/Core/PiSmmCore/HeapGuard.c
@@ -455,51 +455,6 @@ GetGuardMapBit (
   return 0;
 }
 
-/**
-  Set the bit in bitmap table for the given address.
-
-  @param[in]  Address The address to set for.
-
-  @return VOID.
-**/
-VOID
-EFIAPI
-SetGuardMapBit (
-  IN EFI_PHYSICAL_ADDRESSAddress
-  )
-{
-  UINT64*GuardMap;
-  UINT64BitMask;
-
-  FindGuardedMemoryMap (Address, TRUE, );
-  if (GuardMap != NULL) {
-BitMask = LShiftU64 (1, GUARDED_HEAP_MAP_ENTRY_BIT_INDEX (Address));
-*GuardMap |= BitMask;
-  }
-}
-
-/**
-  Clear the bit in bitmap table for the given address.
-
-  @param[in]  Address The address to clear for.
-
-  @return VOID.
-**/
-VOID
-EFIAPI
-ClearGuardMapBit (
-  IN EFI_PHYSICAL_ADDRESSAddress
-  )
-{
-  UINT64*GuardMap;
-  UINT64BitMask;
-
-  FindGuardedMemoryMap (Address, TRUE, );
-  if (GuardMap != NULL) {
-BitMask = LShiftU64 (1, GUARDED_HEAP_MAP_ENTRY_BIT_INDEX (Address));
-*GuardMap &= ~BitMask;
-  }
-}
 
 /**
   Check to see if the page at the given address is a Guard page or not.
@@ -526,39 +481,7 @@ IsGuardPage (
   return ((BitMap == BIT0) || (BitMap == BIT2) || (BitMap == (BIT2 | BIT0)));
 }
 
-/**
-  Check to see if the page at the given address is a head Guard page or not.
 
-  @param[in]  Address The address to check for.
-
-  @return TRUE  The page at Address is a head Guard page.
-  @return FALSE The page at Address is not a head Guard page.
-**/
-BOOLEAN
-EFIAPI
-IsHeadGuard (
-  IN EFI_PHYSICAL_ADDRESSAddress
-  )
-{
-  return (GetGuardedMemoryBits (Address, 2) == BIT1);
-}
-
-/**
-  Check to see if the page at the given address is a tail Guard page or not.
-
-  @param[in]  Address The address to check for.
-
-  @return TRUE  The page at Address is a tail Guard page.
-  @return FALSE The page at Address is not a tail Guard page.
-**/
-BOOLEAN
-EFIAPI
-IsTailGuard (
-  IN EFI_PHYSICAL_ADDRESSAddress
-  )
-{
-  return (GetGuardedMemoryBits (Address - EFI_PAGE_SIZE, 2) == BIT0);
-}
 
 /**
   Check to see if the page at the given address is guarded or not.
@@ -864,66 +787,7 @@ UnsetGuardForMemory (
   ClearGuardedMemoryBits(Memory, NumberOfPages);
 }
 
-/**
-  Adjust address of free memory according to existing and/or required Guard.
-
-  This function will check if there're existing Guard pages of adjacent
-  memory blocks, and try to use it as the Guard page of the memory to be
-  allocated.
 
-  @param[in]  Start   Start address of free memory block.
-  @param[in]  SizeSize of free memory block.
-  @param[in]  SizeRequested   Size of memory to allocate.
-
-  @return The end address of memory block found.
-  @return 0 if no enough space for the required size of memory and its Guard.
-**/
-UINT64
-AdjustMemoryS (
-  IN UINT64  Start,
-  IN UINT64  Size,
-  IN UINT64  SizeRequested
-  )
-{
-  UINT64  Target;
-
-  //
-  // UEFI spec requires that allocated pool must be 8-byte aligned. If it's
-  // indicated to put the pool near the Tail Guard, we need extra bytes to
-  // make sure alignment of the returned pool address.
-  //
-  if ((PcdGet8 (PcdHeapGuardPropertyMask) & BIT7) == 0) {
-SizeRequested = ALIGN_VALUE(SizeRequested, 8);
-  }
-
-  Target = Start + Size - SizeRequested;
-  ASSERT (Target >= Start);
-  if (Target == 0) {
-return 0;
-  }
-
-  if (!IsGuardPage (Start + Size)) {
-// No Guard at tail to 

[edk2] [PATCH v2 24/27] MdeModulePkg IScsiDxe: Remove a redundant function

2018-08-14 Thread shenglei
The function IScsiFindTcbByITT that is never called
has been removed.
https://bugzilla.tianocore.org/show_bug.cgi?id=1062

Cc: Star Zeng 
Cc: Eric Dong 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: shenglei 
Reviewed-by: Laszlo Ersek 
---
 .../Universal/Network/IScsiDxe/IScsiProto.c   | 31 ---
 1 file changed, 31 deletions(-)

diff --git a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.c 
b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.c
index 9fb848080a..b4a5c2d024 100644
--- a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.c
+++ b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.c
@@ -1738,37 +1738,6 @@ IScsiDelTcb (
   FreePool (Tcb);
 }
 
-/**
-  Find the task control block by the initator task tag.
-
-  @param[in]  TcbList The tcb list.
-  @param[in]  InitiatorTaskTag The initiator task tag.
-
-  @return The task control block found.
-**/
-ISCSI_TCB *
-IScsiFindTcbByITT (
-  IN LIST_ENTRY  *TcbList,
-  IN UINT32  InitiatorTaskTag
-  )
-{
-  ISCSI_TCB   *Tcb;
-  LIST_ENTRY  *Entry;
-
-  Tcb = NULL;
-
-  NET_LIST_FOR_EACH (Entry, TcbList) {
-Tcb = NET_LIST_USER_STRUCT (Entry, ISCSI_TCB, Link);
-
-if (Tcb->InitiatorTaskTag == InitiatorTaskTag) {
-  break;
-}
-
-Tcb = NULL;
-  }
-
-  return Tcb;
-}
 
 /**
   Create a data segment, pad it and calculate the CRC if needed.
-- 
2.18.0.windows.1

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


[edk2] [PATCH v2 18/27] MdeModulePkg Ps2KeyboardDxe: Remove a redundant function

2018-08-14 Thread shenglei
The function DisableKeyboard that is never called
has been removed.
https://bugzilla.tianocore.org/show_bug.cgi?id=1062

Cc: Star Zeng 
Cc: Eric Dong 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: shenglei 
Reviewed-by: Ruiyu Ni 
Reviewed-by: Laszlo Ersek 
Reviewed-by: Star Zeng 
---
 .../Bus/Isa/Ps2KeyboardDxe/Ps2KbdCtrller.c| 26 ---
 .../Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.h  | 12 -
 2 files changed, 38 deletions(-)

diff --git a/MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdCtrller.c 
b/MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdCtrller.c
index 4def6d9271..2ee293d64d 100644
--- a/MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdCtrller.c
+++ b/MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdCtrller.c
@@ -1812,32 +1812,6 @@ Done:
 
 }
 
-/**
-  Disable the keyboard interface of the 8042 controller.
-
-  @param ConsoleIn   The device instance
-
-  @return status of issuing disable command
-
-**/
-EFI_STATUS
-DisableKeyboard (
-  IN KEYBOARD_CONSOLE_IN_DEV *ConsoleIn
-  )
-{
-  EFI_STATUS  Status;
-
-  //
-  // Disable keyboard interface
-  //
-  Status = KeyboardCommand (ConsoleIn, 
KEYBOARD_8042_COMMAND_DISABLE_KEYBOARD_INTERFACE);
-  if (EFI_ERROR (Status)) {
-KeyboardError (ConsoleIn, L"\n\r");
-return EFI_DEVICE_ERROR;
-  }
-
-  return Status;
-}
 
 /**
   Check whether there is Ps/2 Keyboard device in system by 0xF4 Keyboard 
Command
diff --git a/MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.h 
b/MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.h
index b6a4f3c6b9..e0950ce113 100644
--- a/MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.h
+++ b/MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.h
@@ -300,18 +300,6 @@ InitKeyboard (
   IN BOOLEAN ExtendedVerification
   );
 
-/**
-  Disable the keyboard interface of the 8042 controller.
-
-  @param ConsoleIn   - the device instance
-
-  @return status of issuing disable command
-
-**/
-EFI_STATUS
-DisableKeyboard (
-  IN KEYBOARD_CONSOLE_IN_DEV *ConsoleIn
-  );
 
 /**
   Timer event handler: read a series of scancodes from 8042
-- 
2.18.0.windows.1

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


[edk2] [PATCH v2 16/27] MdeModulePkg Core/Dxe: Remove redundant functions

2018-08-14 Thread shenglei
The functions that are never called have been removed.
They are ClearGuardMapBit,SetGuardMapBit,IsHeadGuard,
IsTailGuard and CoreEfiNotAvailableYetArg0.
https://bugzilla.tianocore.org/show_bug.cgi?id=1062

Cc: Star Zeng 
Cc: Eric Dong 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: shenglei 
Reviewed-by: Ruiyu Ni 
Reviewed-by: Jian J Wang mailto:jian.j.wang at 
intel.com>>
Reviewed-by: Laszlo Ersek 
Reviewed-by: Star Zeng 
---
 MdeModulePkg/Core/Dxe/DxeMain.h | 13 -
 MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c | 22 ---
 MdeModulePkg/Core/Dxe/Mem/HeapGuard.c   | 78 -
 3 files changed, 113 deletions(-)

diff --git a/MdeModulePkg/Core/Dxe/DxeMain.h b/MdeModulePkg/Core/Dxe/DxeMain.h
index 7ec82388a3..8f0b28d095 100644
--- a/MdeModulePkg/Core/Dxe/DxeMain.h
+++ b/MdeModulePkg/Core/Dxe/DxeMain.h
@@ -2178,19 +2178,6 @@ CoreDisplayDiscoveredNotDispatched (
   );
 
 
-/**
-  Place holder function until all the Boot Services and Runtime Services are
-  available.
-
-  @return EFI_NOT_AVAILABLE_YET
-
-**/
-EFI_STATUS
-EFIAPI
-CoreEfiNotAvailableYetArg0 (
-  VOID
-  );
-
 
 /**
   Place holder function until all the Boot Services and Runtime Services are
diff --git a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c 
b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
index fc46022c3c..bbb048a127 100644
--- a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
+++ b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
@@ -560,28 +560,6 @@ DxeMain (
 
 
 
-/**
-  Place holder function until all the Boot Services and Runtime Services are
-  available.
-
-  @return EFI_NOT_AVAILABLE_YET
-
-**/
-EFI_STATUS
-EFIAPI
-CoreEfiNotAvailableYetArg0 (
-  VOID
-  )
-{
-  //
-  // This function should never be executed.  If it does, then the 
architectural protocols
-  // have not been designed correctly.  The CpuBreakpoint () is commented out 
for now until the
-  // DXE Core and all the Architectural Protocols are complete.
-  //
-
-  return EFI_NOT_AVAILABLE_YET;
-}
-
 
 /**
   Place holder function until all the Boot Services and Runtime Services are
diff --git a/MdeModulePkg/Core/Dxe/Mem/HeapGuard.c 
b/MdeModulePkg/Core/Dxe/Mem/HeapGuard.c
index 447c56bb11..663f969c0d 100644
--- a/MdeModulePkg/Core/Dxe/Mem/HeapGuard.c
+++ b/MdeModulePkg/Core/Dxe/Mem/HeapGuard.c
@@ -443,51 +443,6 @@ GetGuardMapBit (
   return 0;
 }
 
-/**
-  Set the bit in bitmap table for the given address.
-
-  @param[in]  Address The address to set for.
-
-  @return VOID.
-**/
-VOID
-EFIAPI
-SetGuardMapBit (
-  IN EFI_PHYSICAL_ADDRESSAddress
-  )
-{
-  UINT64*GuardMap;
-  UINT64BitMask;
-
-  FindGuardedMemoryMap (Address, TRUE, );
-  if (GuardMap != NULL) {
-BitMask = LShiftU64 (1, GUARDED_HEAP_MAP_ENTRY_BIT_INDEX (Address));
-*GuardMap |= BitMask;
-  }
-}
-
-/**
-  Clear the bit in bitmap table for the given address.
-
-  @param[in]  Address The address to clear for.
-
-  @return VOID.
-**/
-VOID
-EFIAPI
-ClearGuardMapBit (
-  IN EFI_PHYSICAL_ADDRESSAddress
-  )
-{
-  UINT64*GuardMap;
-  UINT64BitMask;
-
-  FindGuardedMemoryMap (Address, TRUE, );
-  if (GuardMap != NULL) {
-BitMask = LShiftU64 (1, GUARDED_HEAP_MAP_ENTRY_BIT_INDEX (Address));
-*GuardMap &= ~BitMask;
-  }
-}
 
 /**
   Check to see if the page at the given address is a Guard page or not.
@@ -514,39 +469,6 @@ IsGuardPage (
   return ((BitMap == BIT0) || (BitMap == BIT2) || (BitMap == (BIT2 | BIT0)));
 }
 
-/**
-  Check to see if the page at the given address is a head Guard page or not.
-
-  @param[in]  Address The address to check for
-
-  @return TRUE  The page at Address is a head Guard page
-  @return FALSE The page at Address is not a head Guard page
-**/
-BOOLEAN
-EFIAPI
-IsHeadGuard (
-  IN EFI_PHYSICAL_ADDRESSAddress
-  )
-{
-  return (GetGuardedMemoryBits (Address, 2) == BIT1);
-}
-
-/**
-  Check to see if the page at the given address is a tail Guard page or not.
-
-  @param[in]  Address The address to check for.
-
-  @return TRUE  The page at Address is a tail Guard page.
-  @return FALSE The page at Address is not a tail Guard page.
-**/
-BOOLEAN
-EFIAPI
-IsTailGuard (
-  IN EFI_PHYSICAL_ADDRESSAddress
-  )
-{
-  return (GetGuardedMemoryBits (Address - EFI_PAGE_SIZE, 2) == BIT0);
-}
 
 /**
   Check to see if the page at the given address is guarded or not.
-- 
2.18.0.windows.1

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


[edk2] [PATCH v2 23/27] MdeModulePkg Ip4Dxe: Remove a redundant function

2018-08-14 Thread shenglei
The function Ip4Config2OnDhcp4Event that is never called
has been removed.
https://bugzilla.tianocore.org/show_bug.cgi?id=1062

Cc: Star Zeng 
Cc: Eric Dong 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: shenglei 
Reviewed-by: Laszlo Ersek 
---
 .../Universal/Network/Ip4Dxe/Ip4Config2Impl.c| 16 
 1 file changed, 16 deletions(-)

diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c 
b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
index 043341d6e9..c19a72730e 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
@@ -1628,22 +1628,6 @@ Ip4Config2InitIfInfo (
   CopyMem (>HwAddress, >SnpMode.CurrentAddress, 
IfInfo->HwAddressSize);
 }
 
-/**
-  The event handle routine when DHCPv4 process is finished or is updated.
-
-  @param[in] Event Not used.
-  @param[in] Context   The pointer to the IP4 configuration instance 
data.
-
-**/
-VOID
-EFIAPI
-Ip4Config2OnDhcp4Event (
-  IN EFI_EVENT  Event,
-  IN VOID   *Context
-  )
-{
-  return ;
-}
 
 
 /**
-- 
2.18.0.windows.1

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


[edk2] [PATCH v2 15/27] MdeModulePkg UsbBusPei: Remove redundant functions

2018-08-14 Thread shenglei
The functions that are never called have been removed.
They are PeiHubSetHubFeature,IsPortConnectChange and
PeiUsbClearDeviceFeature.
https://bugzilla.tianocore.org/show_bug.cgi?id=1062

Cc: Star Zeng 
Cc: Eric Dong 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: shenglei 
Reviewed-by: Ruiyu Ni 
Reviewed-by: Star Zeng 
---
 MdeModulePkg/Bus/Usb/UsbBusPei/HubPeim.c   | 39 ---
 MdeModulePkg/Bus/Usb/UsbBusPei/HubPeim.h   | 18 -
 MdeModulePkg/Bus/Usb/UsbBusPei/PeiUsbLib.c | 77 --
 MdeModulePkg/Bus/Usb/UsbBusPei/PeiUsbLib.h | 35 --
 4 files changed, 169 deletions(-)

diff --git a/MdeModulePkg/Bus/Usb/UsbBusPei/HubPeim.c 
b/MdeModulePkg/Bus/Usb/UsbBusPei/HubPeim.c
index 806602511c..5607c65b13 100644
--- a/MdeModulePkg/Bus/Usb/UsbBusPei/HubPeim.c
+++ b/MdeModulePkg/Bus/Usb/UsbBusPei/HubPeim.c
@@ -193,46 +193,7 @@ PeiHubGetHubStatus (
  );
 }
 
-/**
-  Set specified feature to a given hub.
-
-  @param  PeiServices   General-purpose services that are available to every 
PEIM.
-  @param  UsbIoPpi  Indicates the PEI_USB_IO_PPI instance.
-  @param  Value New feature value.
-
-  @retval EFI_SUCCESS   Port feature is set successfully.
-  @retval EFI_DEVICE_ERROR  Cannot set the port feature due to a hardware 
error.
-  @retval OthersOther failure occurs.
-
-**/
-EFI_STATUS
-PeiHubSetHubFeature (
-  IN EFI_PEI_SERVICES**PeiServices,
-  IN PEI_USB_IO_PPI  *UsbIoPpi,
-  IN UINT8   Value
-  )
-{
-  EFI_USB_DEVICE_REQUEST  DeviceRequest;
 
-  ZeroMem (, sizeof (EFI_USB_DEVICE_REQUEST));
-
-  //
-  // Fill Device request packet
-  //
-  DeviceRequest.RequestType = USB_HUB_SET_HUB_FEATURE_REQ_TYPE;
-  DeviceRequest.Request = USB_HUB_SET_HUB_FEATURE;
-  DeviceRequest.Value   = Value;
-
-  return UsbIoPpi->UsbControlTransfer (
- PeiServices,
- UsbIoPpi,
- ,
- EfiUsbNoData,
- PcdGet32 (PcdUsbTransferTimeoutValue),
- NULL,
- 0
- );
-}
 
 /**
   Clear specified feature on a given hub.
diff --git a/MdeModulePkg/Bus/Usb/UsbBusPei/HubPeim.h 
b/MdeModulePkg/Bus/Usb/UsbBusPei/HubPeim.h
index 385a14ec0d..d21057c349 100644
--- a/MdeModulePkg/Bus/Usb/UsbBusPei/HubPeim.h
+++ b/MdeModulePkg/Bus/Usb/UsbBusPei/HubPeim.h
@@ -145,24 +145,6 @@ PeiHubSetPortFeature (
   IN  UINT8 Value
   );
 
-/**
-  Set specified feature to a given hub.
-
-  @param  PeiServices   General-purpose services that are available to every 
PEIM.
-  @param  UsbIoPpi  Indicates the PEI_USB_IO_PPI instance.
-  @param  Value New feature value.
-
-  @retval EFI_SUCCESS   Port feature is set successfully.
-  @retval EFI_DEVICE_ERROR  Cannot set the port feature due to a hardware 
error.
-  @retval OthersOther failure occurs.
-
-**/
-EFI_STATUS
-PeiHubSetHubFeature (
-  IN EFI_PEI_SERVICES   **PeiServices,
-  IN PEI_USB_IO_PPI *UsbIoPpi,
-  IN  UINT8 Value
-  );
 
 /**
   Get a given hub status.
diff --git a/MdeModulePkg/Bus/Usb/UsbBusPei/PeiUsbLib.c 
b/MdeModulePkg/Bus/Usb/UsbBusPei/PeiUsbLib.c
index c5e599e2f7..73a163e7a0 100644
--- a/MdeModulePkg/Bus/Usb/UsbBusPei/PeiUsbLib.c
+++ b/MdeModulePkg/Bus/Usb/UsbBusPei/PeiUsbLib.c
@@ -104,62 +104,7 @@ PeiUsbSetDeviceAddress (
  );
 }
 
-/**
-  Clear a given usb feature.
-
-  @param  PeiServices   General-purpose services that are available to 
every PEIM.
-  @param  UsbIoPpi  Indicates the PEI_USB_IO_PPI instance.
-  @param  Recipient The recipient of ClearFeature Request, should be 
one of Device/Interface/Endpoint.
-  @param  Value Request Value.
-  @param  TargetRequest Index.
-
-  @retval EFI_SUCCESS   Usb feature is cleared successfully.
-  @retval EFI_DEVICE_ERROR  Cannot clear the usb feature due to a hardware 
error.
-  @retval OthersOther failure occurs.
 
-**/
-EFI_STATUS
-PeiUsbClearDeviceFeature (
-  IN EFI_PEI_SERVICES **PeiServices,
-  IN PEI_USB_IO_PPI   *UsbIoPpi,
-  IN EFI_USB_RECIPIENTRecipient,
-  IN UINT16   Value,
-  IN UINT16   Target
-  )
-{
-  EFI_USB_DEVICE_REQUEST  DevReq;
-
-  ASSERT (UsbIoPpi != NULL);
-
-  switch (Recipient) {
-  case EfiUsbDevice:
-DevReq.RequestType = USB_DEV_CLEAR_FEATURE_REQ_TYPE_D;
-break;
-
-  case EfiUsbInterface:
-DevReq.RequestType = USB_DEV_CLEAR_FEATURE_REQ_TYPE_I;
-break;
-
-  case EfiUsbEndpoint:
-DevReq.RequestType = USB_DEV_CLEAR_FEATURE_REQ_TYPE_E;
-break;
-  }
-
-  DevReq.Request  = USB_DEV_CLEAR_FEATURE;
-  DevReq.Value= Value;
-  DevReq.Index= Target;
-  DevReq.Length   = 0;
-
-  return UsbIoPpi->UsbControlTransfer (
- PeiServices,
- UsbIoPpi,
- ,
- 

[edk2] [PATCH v2 14/27] MdeModulePkg UsbBusDxe: Remove redundant functions

2018-08-14 Thread shenglei
The functions that are never called have been removed.
They are UsbHubCtrlSetHubFeature,UsbHubCtrlResetTT,UsbHcReset,
UsbHcAsyncIsochronousTransfer,UsbHcGetState,UsbHcSetState and
UsbHcIsochronousTransfer.
https://bugzilla.tianocore.org/show_bug.cgi?id=1062

Cc: Star Zeng 
Cc: Eric Dong 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: shenglei 
Reviewed-by: Ruiyu Ni 
Reviewed-by: Laszlo Ersek 
Reviewed-by: Star Zeng 
---
 MdeModulePkg/Bus/Usb/UsbBusDxe/UsbHub.c |  68 -
 MdeModulePkg/Bus/Usb/UsbBusDxe/UsbUtility.c | 146 
 MdeModulePkg/Bus/Usb/UsbBusDxe/UsbUtility.h | 114 ---
 3 files changed, 328 deletions(-)

diff --git a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbHub.c 
b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbHub.c
index 2ce5726e63..fdb3276a82 100644
--- a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbHub.c
+++ b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbHub.c
@@ -317,74 +317,6 @@ UsbHubCtrlGetPortStatus (
 }
 
 
-/**
-  Usb hub control transfer to reset the TT (Transaction Transaltor).
-
-  @param  HubDevThe hub device.
-  @param  Port  The port of the hub.
-
-  @retval EFI_SUCCESS   The TT of the hub is reset.
-  @retval OthersFailed to reset the port.
-
-**/
-EFI_STATUS
-UsbHubCtrlResetTT (
-  IN  USB_DEVICE  *HubDev,
-  IN  UINT8   Port
-  )
-{
-  EFI_STATUS  Status;
-
-  Status = UsbCtrlRequest (
- HubDev,
- EfiUsbNoData,
- USB_REQ_TYPE_CLASS,
- USB_HUB_TARGET_HUB,
- USB_HUB_REQ_RESET_TT,
- 0,
- (UINT16) (Port + 1),
- NULL,
- 0
- );
-
-  return Status;
-}
-
-
-/**
-  Usb hub control transfer to set the hub feature.
-
-  @param  HubDevThe hub device.
-  @param  Feature   The feature to set.
-
-  @retval EFI_SUCESSThe feature is set for the hub.
-  @retval OthersFailed to set the feature.
-
-**/
-EFI_STATUS
-UsbHubCtrlSetHubFeature (
-  IN  USB_DEVICE  *HubDev,
-  IN  UINT8   Feature
-  )
-{
-  EFI_STATUS  Status;
-
-  Status = UsbCtrlRequest (
- HubDev,
- EfiUsbNoData,
- USB_REQ_TYPE_CLASS,
- USB_HUB_TARGET_HUB,
- USB_HUB_REQ_SET_FEATURE,
- Feature,
- 0,
- NULL,
- 0
- );
-
-  return Status;
-}
-
-
 /**
   Usb hub control transfer to set the port feature.
 
diff --git a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbUtility.c 
b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbUtility.c
index e9b5fefb9a..e405edfd4a 100644
--- a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbUtility.c
+++ b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbUtility.c
@@ -90,90 +90,12 @@ UsbHcGetCapability (
 }
 
 
-/**
-  Reset the host controller.
 
-  @param  UsbBusThe usb bus driver.
-  @param  AttributesThe reset type, only global reset is used by 
this driver.
 
-  @retval EFI_SUCCESS   The reset operation succeeded.
-  @retval EFI_INVALID_PARAMETER Attributes is not valid.
-  @retval EFI_UNSUPPOURTED  The type of reset specified by Attributes is
-not currently supported by the host controller.
-  @retval EFI_DEVICE_ERROR  Host controller isn't halted to reset.
-**/
-EFI_STATUS
-UsbHcReset (
-  IN USB_BUS  *UsbBus,
-  IN UINT16   Attributes
-  )
-{
-  EFI_STATUS  Status;
 
-  if (UsbBus->Usb2Hc != NULL) {
-Status = UsbBus->Usb2Hc->Reset (UsbBus->Usb2Hc, Attributes);
-  } else {
-Status = UsbBus->UsbHc->Reset (UsbBus->UsbHc, Attributes);
-  }
 
-  return Status;
-}
 
 
-/**
-  Get the current operation state of the host controller.
-
-  @param  UsbBus   The USB bus driver.
-  @param  StateThe host controller operation state.
-
-  @retval EFI_SUCCESS  The operation state is returned in State.
-  @retval Others   Failed to get the host controller state.
-
-**/
-EFI_STATUS
-UsbHcGetState (
-  IN  USB_BUS *UsbBus,
-  OUT EFI_USB_HC_STATE*State
-  )
-{
-  EFI_STATUS  Status;
-
-  if (UsbBus->Usb2Hc != NULL) {
-Status = UsbBus->Usb2Hc->GetState (UsbBus->Usb2Hc, State);
-  } else {
-Status = UsbBus->UsbHc->GetState (UsbBus->UsbHc, State);
-  }
-
-  return Status;
-}
-
-
-/**
-  Set the host controller operation state.
-
-  @param  UsbBus   The USB bus driver.
-  @param  StateThe state to set.
-
-  @retval EFI_SUCCESS  The host controller is now working at State.
-  @retval Others   Failed to set operation state.
-
-**/
-EFI_STATUS
-UsbHcSetState (
-  IN USB_BUS  *UsbBus,
-  IN EFI_USB_HC_STATE State
-  )
-{
-  EFI_STATUS  Status;
-
-  if (UsbBus->Usb2Hc != NULL) {
-Status = UsbBus->Usb2Hc->SetState (UsbBus->Usb2Hc, State);
-  } else {
-Status = UsbBus->UsbHc->SetState (UsbBus->UsbHc, 

[edk2] [PATCH v2 12/27] MdeModulePkg UfsPassThruDxe: Remove redundant functions

2018-08-14 Thread shenglei
The functions that are never called have been removed.
They are UfsClearFlag and UfsFindAvailableSlotInTmrl.
https://bugzilla.tianocore.org/show_bug.cgi?id=1062

Cc: Star Zeng 
Cc: Eric Dong 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: shenglei 
Reviewed-by: Hao Wu 
Reviewed-by: Star Zeng 
---
 .../Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c   | 49 ---
 1 file changed, 49 deletions(-)

diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c 
b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
index e868c8c07e..5756f637fd 100644
--- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
+++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
@@ -753,31 +753,6 @@ UfsFindAvailableSlotInTrl (
   return EFI_NOT_READY;
 }
 
-/**
-  Find out available slot in task management transfer list of a UFS device.
-
-  @param[in]  Private   The pointer to the UFS_PASS_THRU_PRIVATE_DATA data 
structure.
-  @param[out] Slot  The available slot.
-
-  @retval EFI_SUCCESS   The available slot was found successfully.
-
-**/
-EFI_STATUS
-UfsFindAvailableSlotInTmrl (
-  IN UFS_PASS_THRU_PRIVATE_DATA   *Private,
- OUT UINT8*Slot
-  )
-{
-  ASSERT ((Private != NULL) && (Slot != NULL));
-
-  //
-  // The simplest algo to always use slot 0.
-  // TODO: enhance it to support async transfer with multiple slot.
-  //
-  *Slot = 0;
-
-  return EFI_SUCCESS;
-}
 
 /**
   Start specified slot in transfer list of a UFS device.
@@ -1229,31 +1204,7 @@ UfsSetFlag (
   return Status;
 }
 
-/**
-  Clear specified flag to 0 on a UFS device.
-
-  @param[in]  Private   The pointer to the UFS_PASS_THRU_PRIVATE_DATA 
data structure.
-  @param[in]  FlagIdThe ID of flag to be cleared.
-
-  @retval EFI_SUCCESS   The flag was cleared successfully.
-  @retval EFI_DEVICE_ERROR  A device error occurred while attempting to 
clear the flag.
-  @retval EFI_TIMEOUT   A timeout occurred while waiting for the 
completion of clearing the flag.
-
-**/
-EFI_STATUS
-UfsClearFlag (
-  IN  UFS_PASS_THRU_PRIVATE_DATA   *Private,
-  IN  UINT8FlagId
-  )
-{
-  EFI_STATUS Status;
-  UINT8  Value;
-
-  Value  = 0;
-  Status = UfsRwFlags (Private, FALSE, FlagId, );
 
-  return Status;
-}
 
 /**
   Read specified flag from a UFS device.
-- 
2.18.0.windows.1

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


[edk2] [PATCH v2 04/27] MdeModulePkg EhciDxe: Remove redundant functions

2018-08-14 Thread shenglei
The functions that are never called have been removed.
They are EhcDumpRegs,EhcDisableAsyncSchd and EhcDisablePeriodSchd
https://bugzilla.tianocore.org/show_bug.cgi?id=1062

Cc: Star Zeng 
Cc: Eric Dong 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: shenglei 
Reviewed-by: Laszlo Ersek 
Reviewed-by: Ruiyu Ni 
Reviewed-by: Star Zeng 
---
 MdeModulePkg/Bus/Pci/EhciDxe/EhciDebug.c | 27 ---
 MdeModulePkg/Bus/Pci/EhciDxe/EhciDebug.h | 11 --
 MdeModulePkg/Bus/Pci/EhciDxe/EhciReg.c   | 44 
 3 files changed, 82 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/EhciDxe/EhciDebug.c 
b/MdeModulePkg/Bus/Pci/EhciDxe/EhciDebug.c
index 76368b4748..71755d421b 100644
--- a/MdeModulePkg/Bus/Pci/EhciDxe/EhciDebug.c
+++ b/MdeModulePkg/Bus/Pci/EhciDxe/EhciDebug.c
@@ -228,31 +228,4 @@ EhcDumpBuf (
   DEBUG ((EFI_D_VERBOSE, "\n"));
 }
 
-/**
-  Dump the EHCI status registers.
-
-  @param  EhcUSB EHCI Host Controller instance
 
-**/
-VOID
-EhcDumpRegs (
-  IN  USB2_HC_DEV *Ehc
-  )
-{
-  UINT8   Index;
-
-  DEBUG ((EFI_D_VERBOSE, "  EHC_CAPLENGTH_OFFSET   = 0x%08x\n", 
EhcReadCapRegister (Ehc, EHC_CAPLENGTH_OFFSET)));
-  DEBUG ((EFI_D_VERBOSE, "  EHC_HCSPARAMS_OFFSET   = 0x%08x\n", 
EhcReadCapRegister (Ehc, EHC_HCSPARAMS_OFFSET)));
-  DEBUG ((EFI_D_VERBOSE, "  EHC_HCCPARAMS_OFFSET   = 0x%08x\n", 
EhcReadCapRegister (Ehc, EHC_HCCPARAMS_OFFSET)));
-  DEBUG ((EFI_D_VERBOSE, "  EHC_USBCMD_OFFSET  = 0x%08x\n", EhcReadOpReg 
(Ehc, EHC_USBCMD_OFFSET)));
-  DEBUG ((EFI_D_VERBOSE, "  EHC_USBSTS_OFFSET  = 0x%08x\n", EhcReadOpReg 
(Ehc, EHC_USBSTS_OFFSET)));
-  DEBUG ((EFI_D_VERBOSE, "  EHC_USBINTR_OFFSET = 0x%08x\n", EhcReadOpReg 
(Ehc, EHC_USBINTR_OFFSET)));
-  DEBUG ((EFI_D_VERBOSE, "  EHC_FRINDEX_OFFSET = 0x%08x\n", EhcReadOpReg 
(Ehc, EHC_FRINDEX_OFFSET)));
-  DEBUG ((EFI_D_VERBOSE, "  EHC_CTRLDSSEG_OFFSET   = 0x%08x\n", EhcReadOpReg 
(Ehc,  EHC_CTRLDSSEG_OFFSET)));
-  DEBUG ((EFI_D_VERBOSE, "  EHC_FRAME_BASE_OFFSET  = 0x%08x\n", EhcReadOpReg 
(Ehc,  EHC_FRAME_BASE_OFFSET)));
-  DEBUG ((EFI_D_VERBOSE, "  EHC_ASYNC_HEAD_OFFSET  = 0x%08x\n", EhcReadOpReg 
(Ehc, EHC_ASYNC_HEAD_OFFSET)));
-  DEBUG ((EFI_D_VERBOSE, "  EHC_CONFIG_FLAG_OFFSET = 0x%08x\n", EhcReadOpReg 
(Ehc, EHC_CONFIG_FLAG_OFFSET)));
-  for (Index = 0; Index < (UINT8) (Ehc->HcStructParams & HCSP_NPORTS); 
Index++) {
-DEBUG ((EFI_D_VERBOSE, "  EHC_PORT_STAT_OFFSET(%d)  = 0x%08x\n", Index, 
EhcReadOpReg (Ehc, EHC_PORT_STAT_OFFSET + (4 * Index;
-  }
-}
diff --git a/MdeModulePkg/Bus/Pci/EhciDxe/EhciDebug.h 
b/MdeModulePkg/Bus/Pci/EhciDxe/EhciDebug.h
index bc84bb7864..a64b0551a0 100644
--- a/MdeModulePkg/Bus/Pci/EhciDxe/EhciDebug.h
+++ b/MdeModulePkg/Bus/Pci/EhciDxe/EhciDebug.h
@@ -61,15 +61,4 @@ EhcDumpBuf (
   );
 
 
-/**
-  Dump the EHCI status registers.
-
-  @param  EhcUSB EHCI Host Controller instance
-
-**/
-VOID
-EhcDumpRegs (
-  IN  USB2_HC_DEV *Ehc
-  );
-
 #endif
diff --git a/MdeModulePkg/Bus/Pci/EhciDxe/EhciReg.c 
b/MdeModulePkg/Bus/Pci/EhciDxe/EhciReg.c
index 34836eccf5..59752d1bdc 100644
--- a/MdeModulePkg/Bus/Pci/EhciDxe/EhciReg.c
+++ b/MdeModulePkg/Bus/Pci/EhciDxe/EhciReg.c
@@ -372,29 +372,7 @@ EhcEnablePeriodSchd (
 }
 
 
-/**
-  Disable periodic schedule.
 
-  @param  Ehc   The EHCI device.
-  @param  Timeout   Time to wait before abort (in millisecond, ms).
-
-  @retval EFI_SUCCESS   Periodic schedule is disabled.
-  @retval EFI_DEVICE_ERROR  Fail to disable periodic schedule.
-
-**/
-EFI_STATUS
-EhcDisablePeriodSchd (
-  IN USB2_HC_DEV  *Ehc,
-  IN UINT32   Timeout
-  )
-{
-  EFI_STATUS  Status;
-
-  EhcClearOpRegBit (Ehc, EHC_USBCMD_OFFSET, USBCMD_ENABLE_PERIOD);
-
-  Status = EhcWaitOpRegBit (Ehc, EHC_USBSTS_OFFSET, USBSTS_PERIOD_ENABLED, 
FALSE, Timeout);
-  return Status;
-}
 
 
 
@@ -424,29 +402,7 @@ EhcEnableAsyncSchd (
 
 
 
-/**
-  Disable asynchrounous schedule.
 
-  @param  Ehc  The EHCI device.
-  @param  Timeout  Time to wait before abort (in millisecond, ms).
-
-  @retval EFI_SUCCESS  The asynchronous schedule is disabled.
-  @return Others   Failed to disable the asynchronous schedule.
-
-**/
-EFI_STATUS
-EhcDisableAsyncSchd (
-  IN USB2_HC_DEV  *Ehc,
-  IN UINT32   Timeout
-  )
-{
-  EFI_STATUS  Status;
-
-  EhcClearOpRegBit (Ehc, EHC_USBCMD_OFFSET, USBCMD_ENABLE_ASYNC);
-
-  Status = EhcWaitOpRegBit (Ehc, EHC_USBSTS_OFFSET, USBSTS_ASYNC_ENABLED, 
FALSE, Timeout);
-  return Status;
-}
 
 
 
-- 
2.18.0.windows.1

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


[edk2] [PATCH v2 08/27] MdeModulePkg UhciPei: Remove redundant functions

2018-08-14 Thread shenglei
The functions that are never called have been removed.
They are IoMmuFreeBuffer,DelinkMemoryBlock,IsMemoryBlockEmptied
,IsTDLinkPtrQHOrTD,GetCurrentFrameNumber,GetQHHorizontalLinkPtr
and GetQHHorizontalValidorInvalid.
https://bugzilla.tianocore.org/show_bug.cgi?id=1062

Cc: Star Zeng 
Cc: Eric Dong 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: shenglei 
Reviewed-by: Ruiyu Ni 
Reviewed-by: Star Zeng 
---
 MdeModulePkg/Bus/Pci/UhciPei/DmaMem.c  |  22 -
 MdeModulePkg/Bus/Pci/UhciPei/UhcPeim.c | 125 -
 MdeModulePkg/Bus/Pci/UhciPei/UhcPeim.h |  78 ---
 3 files changed, 225 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/UhciPei/DmaMem.c 
b/MdeModulePkg/Bus/Pci/UhciPei/DmaMem.c
index c92bee4298..f4202ba6e6 100644
--- a/MdeModulePkg/Bus/Pci/UhciPei/DmaMem.c
+++ b/MdeModulePkg/Bus/Pci/UhciPei/DmaMem.c
@@ -205,29 +205,7 @@ IoMmuAllocateBuffer (
   return Status;
 }
 
-/**
-  Frees memory that was allocated with AllocateBuffer().
-
-  @param IoMmu  Pointer to IOMMU PPI.
-  @param Pages  The number of pages to free.
-  @param HostAddressThe base system memory address of the allocated 
range.
-  @param MappingThe mapping value returned from Map().
 
-**/
-VOID
-IoMmuFreeBuffer (
-  IN EDKII_IOMMU_PPI*IoMmu,
-  IN UINTN  Pages,
-  IN VOID   *HostAddress,
-  IN VOID   *Mapping
-  )
-{
-  if (IoMmu != NULL) {
-IoMmu->SetAttribute (IoMmu, Mapping, 0);
-IoMmu->Unmap (IoMmu, Mapping);
-IoMmu->FreeBuffer (IoMmu, Pages, HostAddress);
-  }
-}
 
 /**
   Initialize IOMMU.
diff --git a/MdeModulePkg/Bus/Pci/UhciPei/UhcPeim.c 
b/MdeModulePkg/Bus/Pci/UhciPei/UhcPeim.c
index ec2daf1649..645c946f29 100644
--- a/MdeModulePkg/Bus/Pci/UhciPei/UhcPeim.c
+++ b/MdeModulePkg/Bus/Pci/UhciPei/UhcPeim.c
@@ -1252,26 +1252,7 @@ IsStatusOK (
   }
 }
 
-/**
-  Get Current Frame Number.
-
-  @param  UhcDev  The UHCI device.
-  @param  FrameNumberAddr The address of frame list register.
-
-  @retval The content of the frame list register.
 
-**/
-UINT16
-GetCurrentFrameNumber (
-  IN USB_UHC_DEV   *UhcDev,
-  IN UINT32FrameNumberAddr
-  )
-{
-  //
-  // Gets value in the USB frame number register.
-  //
-  return (UINT16) (USBReadPortW (UhcDev, FrameNumberAddr) & 0x03FF);
-}
 
 /**
   Set Frame List Base Address.
@@ -1349,25 +1330,7 @@ SetQHHorizontalLinkPtr (
   PtrQH->QueueHead.QHHorizontalPtr = (UINT32) (UINTN) PtrNext >> 4;
 }
 
-/**
-  Get the horizontal link pointer in QH.
-
-  @param  PtrQH Place to store QH_STRUCT pointer.
 
-  @retval The horizontal link pointer in QH.
-
-**/
-VOID *
-GetQHHorizontalLinkPtr (
-  IN QH_STRUCT  *PtrQH
-  )
-{
-  //
-  // Restore the 28bit address to 32bit address
-  // (take 32bit address as an example)
-  //
-  return (VOID *) (UINTN) ((PtrQH->QueueHead.QHHorizontalPtr) << 4);
-}
 
 /**
   Set a QH or TD horizontally to be connected with a specific QH.
@@ -1470,25 +1433,7 @@ SetQHVerticalValidorInvalid (
   PtrQH->QueueHead.QHVerticalTerminate = IsValid ? 0 : 1;
 }
 
-/**
-  Get the vertical validor bit in QH.
 
-  @param  PtrQH  Place to store QH_STRUCT pointer.
-
-  @retval The vertical linker is valid or not.
-
-**/
-BOOLEAN
-GetQHHorizontalValidorInvalid (
-  IN QH_STRUCT  *PtrQH
-  )
-{
-  //
-  // If TRUE, meaning the Horizontal Link Pointer field is valid,
-  // else, the field is invalid.
-  //
-  return (BOOLEAN) (!(PtrQH->QueueHead.QHHorizontalTerminate));
-}
 
 /**
   Allocate TD or QH Struct.
@@ -2000,26 +1945,7 @@ GetTDLinkPtr (
   return (VOID *) (UINTN) ((PtrTDStruct->TDData.TDLinkPtr) << 4);
 }
 
-/**
-  Get the information about whether the Link Pointer field pointing to
-  a QH or a TD.
 
-  @param  PtrTDStruct Place to store TD_STRUCT pointer.
-
-  @retval whether the Link Pointer field pointing to a QH or a TD.
-
-**/
-BOOLEAN
-IsTDLinkPtrQHOrTD (
-  IN  TD_STRUCT *PtrTDStruct
-  )
-{
-  //
-  // Get the information about whether the Link Pointer field pointing to
-  // a QH or a TD.
-  //
-  return (BOOLEAN) (PtrTDStruct->TDData.TDLinkPtrQSelect);
-}
 
 /**
   Enable/Disable short packet detection mechanism.
@@ -3239,60 +3165,9 @@ InsertMemoryHeaderToList (
   }
 }
 
-/**
-  Judge the memory block in the memory header is empty or not.
-
-  @param  MemoryHeaderPtr   A pointer to the memory header list.
-
-  @retval Whether the memory block in the memory header is empty or not.
-
-**/
-BOOLEAN
-IsMemoryBlockEmptied (
-  IN MEMORY_MANAGE_HEADER  *MemoryHeaderPtr
-  )
-{
-  UINTN Index;
-
-  for (Index = 0; Index < MemoryHeaderPtr->BitArraySizeInBytes; Index++) {
-if (MemoryHeaderPtr->BitArrayPtr[Index] != 0) {
-  return FALSE;
-}
-  }
-
-  return TRUE;
-}
-
-/**
-  remove a memory header from list.
 
-  @param  FirstMemoryHeader   A pointer to the memory header list.
-  @param  FreeMemoryHeaderA memory header to be removed into the list.
 
-**/
-VOID
-DelinkMemoryBlock (
- 

[edk2] [PATCH v2 09/27] MdeModulePkg XhciDxe: Remove redundant functions

2018-08-14 Thread shenglei
The functions that are never called have been removed.
They are XhcReadDoorBellReg and XhcWriteOpReg16.
https://bugzilla.tianocore.org/show_bug.cgi?id=1062

Cc: Star Zeng 
Cc: Eric Dong 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: shenglei 
Reviewed-by: Ruiyu Ni 
Reviewed-by: Laszlo Ersek 
Reviewed-by: Star Zeng 
---
 MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c | 66 --
 MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.h | 28 ---
 2 files changed, 94 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c 
b/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c
index 4d5937de53..5f0736a516 100644
--- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c
+++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c
@@ -158,75 +158,9 @@ XhcWriteOpReg (
   }
 }
 
-/**
-  Write the data to the 2-bytes width XHCI operational register.
 
-  @param  Xhc  The XHCI Instance.
-  @param  Offset   The offset of the 2-bytes width operational register.
-  @param  Data The data to write.
 
-**/
-VOID
-XhcWriteOpReg16 (
-  IN USB_XHCI_INSTANCE*Xhc,
-  IN UINT32   Offset,
-  IN UINT16   Data
-  )
-{
-  EFI_STATUS  Status;
-
-  ASSERT (Xhc->CapLength != 0);
-
-  Status = Xhc->PciIo->Mem.Write (
- Xhc->PciIo,
- EfiPciIoWidthUint16,
- XHC_BAR_INDEX,
- Xhc->CapLength + Offset,
- 1,
- 
- );
-
-  if (EFI_ERROR (Status)) {
-DEBUG ((EFI_D_ERROR, "XhcWriteOpReg16: Pci Io Write error: %r at %d\n", 
Status, Offset));
-  }
-}
-
-/**
-  Read XHCI door bell register.
-
-  @param  Xhc  The XHCI Instance.
-  @param  Offset   The offset of the door bell register.
 
-  @return The register content read
-
-**/
-UINT32
-XhcReadDoorBellReg (
-  IN  USB_XHCI_INSTANCE   *Xhc,
-  IN  UINT32  Offset
-  )
-{
-  UINT32  Data;
-  EFI_STATUS  Status;
-
-  ASSERT (Xhc->DBOff != 0);
-
-  Status = Xhc->PciIo->Mem.Read (
- Xhc->PciIo,
- EfiPciIoWidthUint32,
- XHC_BAR_INDEX,
- Xhc->DBOff + Offset,
- 1,
- 
- );
-
-  if (EFI_ERROR (Status)) {
-DEBUG ((EFI_D_ERROR, "XhcReadDoorBellReg: Pci Io Read error - %r at %d\n", 
Status, Offset));
-Data = 0x;
-  }
-
-  return Data;
-}
 
 /**
   Write the data to the XHCI door bell register.
diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.h 
b/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.h
index 838a44628c..20e7ac0e8f 100644
--- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.h
+++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.h
@@ -286,20 +286,6 @@ XhcWriteOpReg (
   IN UINT32   Data
   );
 
-/**
-  Write the data to the 2-bytes width XHCI operational register.
-
-  @param  Xhc  The XHCI Instance.
-  @param  Offset   The offset of the 2-bytes width operational register.
-  @param  Data The data to write.
-
-**/
-VOID
-XhcWriteOpReg16 (
-  IN USB_XHCI_INSTANCE*Xhc,
-  IN UINT32   Offset,
-  IN UINT16   Data
-  );
 
 /**
   Read XHCI runtime register.
@@ -331,20 +317,6 @@ XhcWriteRuntimeReg (
   IN UINT32   Data
   );
 
-/**
-  Read XHCI door bell register.
-
-  @param  Xhc  The XHCI Instance.
-  @param  Offset   The offset of the door bell register.
-
-  @return The register content read
-
-**/
-UINT32
-XhcReadDoorBellReg (
-  IN  USB_XHCI_INSTANCE   *Xhc,
-  IN  UINT32  Offset
-  );
 
 /**
   Write the data to the XHCI door bell register.
-- 
2.18.0.windows.1

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


[edk2] [PATCH v2 13/27] MdeModulePkg UsbBotPei: Remove redundant functions

2018-08-14 Thread shenglei
The functions that are never called have been removed.
They are PeiUsbSetConfiguration,PeiUsbSetDeviceAddress,
IsPortConnect,IsPortConnectChange,IsPortLowSpeedDeviceAttached
and PeiUsbGetDescriptor.
https://bugzilla.tianocore.org/show_bug.cgi?id=1062

Cc: Star Zeng 
Cc: Eric Dong 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: shenglei 
Reviewed-by: Star Zeng 
---
 MdeModulePkg/Bus/Usb/UsbBotPei/PeiUsbLib.c | 190 -
 MdeModulePkg/Bus/Usb/UsbBotPei/PeiUsbLib.h |  98 ---
 2 files changed, 288 deletions(-)

diff --git a/MdeModulePkg/Bus/Usb/UsbBotPei/PeiUsbLib.c 
b/MdeModulePkg/Bus/Usb/UsbBotPei/PeiUsbLib.c
index 4f20c71144..cd765c40c5 100644
--- a/MdeModulePkg/Bus/Usb/UsbBotPei/PeiUsbLib.c
+++ b/MdeModulePkg/Bus/Usb/UsbBotPei/PeiUsbLib.c
@@ -17,92 +17,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 #include "UsbPeim.h"
 #include "PeiUsbLib.h"
 
-/**
-  Get a given usb descriptor.
-
-  @param  PeiServicesGeneral-purpose services that are available to 
every PEIM.
-  @param  UsbIoPpi   Indicates the PEI_USB_IO_PPI instance.
-  @param  Value  Request Value.
-  @param  Index  Request Index.
-  @param  DescriptorLength   Request descriptor Length.
-  @param  Descriptor Request descriptor.
-
-
-  @retval EFI_SUCCESSUsb descriptor is obtained successfully.
-  @retval EFI_DEVICE_ERROR   Cannot get the usb descriptor due to a hardware 
error.
-  @retval Others Other failure occurs.
-
-**/
-EFI_STATUS
-PeiUsbGetDescriptor (
-  IN  EFI_PEI_SERVICES **PeiServices,
-  IN  PEI_USB_IO_PPI   *UsbIoPpi,
-  IN  UINT16   Value,
-  IN  UINT16   Index,
-  IN  UINT16   DescriptorLength,
-  OUT VOID *Descriptor
-  )
-{
-  EFI_USB_DEVICE_REQUEST  DevReq;
-
-  ASSERT (UsbIoPpi != NULL);
-
-  DevReq.RequestType  = USB_DEV_GET_DESCRIPTOR_REQ_TYPE;
-  DevReq.Request  = USB_DEV_GET_DESCRIPTOR;
-  DevReq.Value= Value;
-  DevReq.Index= Index;
-  DevReq.Length   = DescriptorLength;
-
-  return UsbIoPpi->UsbControlTransfer (
- PeiServices,
- UsbIoPpi,
- ,
- EfiUsbDataIn,
- PcdGet32 (PcdUsbTransferTimeoutValue),
- Descriptor,
- DescriptorLength
- );
-}
-
-/**
-  Set a usb device with a specified address.
-
-  @param  PeiServicesGeneral-purpose services that are available to 
every PEIM.
-  @param  UsbIoPpi   Indicates the PEI_USB_IO_PPI instance.
-  @param  AddressValue   The address to assign.
-
-  @retval EFI_SUCCESSUsb device address is set successfully.
-  @retval EFI_DEVICE_ERROR   Cannot set the usb address due to a hardware 
error.
-  @retval Others Other failure occurs.
-
-**/
-EFI_STATUS
-PeiUsbSetDeviceAddress (
-  IN EFI_PEI_SERVICES **PeiServices,
-  IN PEI_USB_IO_PPI   *UsbIoPpi,
-  IN UINT16   AddressValue
-  )
-{
-  EFI_USB_DEVICE_REQUEST  DevReq;
-
-  ASSERT (UsbIoPpi != NULL);
-
-  DevReq.RequestType  = USB_DEV_SET_ADDRESS_REQ_TYPE;
-  DevReq.Request  = USB_DEV_SET_ADDRESS;
-  DevReq.Value= AddressValue;
-  DevReq.Index= 0;
-  DevReq.Length   = 0;
-
-  return UsbIoPpi->UsbControlTransfer (
- PeiServices,
- UsbIoPpi,
- ,
- EfiUsbNoData,
- PcdGet32 (PcdUsbTransferTimeoutValue),
- NULL,
- 0
- );
-}
 
 /**
   Clear a given usb feature.
@@ -161,40 +75,6 @@ PeiUsbClearDeviceFeature (
  );
 }
 
-/**
-  Configure a usb device to Configuration 1.
-
-  @param  PeiServicesGeneral-purpose services that are available to 
every PEIM.
-  @param  UsbIoPpi   Indicates the PEI_USB_IO_PPI instance.
-
-  @retval EFI_SUCCESS   Usb device is set to use Configuration 1 
successfully.
-  @retval EFI_DEVICE_ERROR  Cannot set the usb device due to a hardware error.
-  @retval OthersOther failure occurs.
-
-**/
-EFI_STATUS
-PeiUsbSetConfiguration (
-  IN EFI_PEI_SERVICES **PeiServices,
-  IN PEI_USB_IO_PPI   *UsbIoPpi
-  )
-{
-  EFI_USB_DEVICE_REQUEST  DevReq;
-  ZeroMem (, sizeof (EFI_USB_DEVICE_REQUEST));
-
-  DevReq.RequestType  = USB_DEV_SET_CONFIGURATION_REQ_TYPE;
-  DevReq.Request  = USB_DEV_SET_CONFIGURATION;
-  DevReq.Value= 1;
-
-  return UsbIoPpi->UsbControlTransfer (
- PeiServices,
- UsbIoPpi,
- ,
- EfiUsbNoData,
- PcdGet32 (PcdUsbTransferTimeoutValue),
- NULL,
- 0
- );
-}
 
 /**
   Clear Endpoint Halt.
@@ -258,74 +138,4 @@ 

[edk2] [PATCH v2 10/27] MdeModulePkg XhciPei: Remove redundant functions

2018-08-14 Thread shenglei
The functions that are never called have been removed.
They are XhcPeiReadDoorBellReg and UsbHcUnlinkMemBlock.
https://bugzilla.tianocore.org/show_bug.cgi?id=1062

Cc: Star Zeng 
Cc: Eric Dong 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: shenglei 
Reviewed-by: Ruiyu Ni 
Reviewed-by: Star Zeng 
---
 MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.c | 24 
 MdeModulePkg/Bus/Pci/XhciPei/XhcPeim.c  | 22 --
 MdeModulePkg/Bus/Pci/XhciPei/XhciReg.h  | 14 --
 3 files changed, 60 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.c 
b/MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.c
index 5d0232ca56..442a613095 100644
--- a/MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.c
+++ b/MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.c
@@ -328,31 +328,7 @@ UsbHcIsMemBlockEmpty (
   return TRUE;
 }
 
-/**
-  Unlink the memory block from the pool's list.
-
-  @param  Head  The block list head of the memory's pool.
-  @param  BlockToUnlink The memory block to unlink.
 
-**/
-VOID
-UsbHcUnlinkMemBlock (
-  IN USBHC_MEM_BLOCK*Head,
-  IN USBHC_MEM_BLOCK*BlockToUnlink
-  )
-{
-  USBHC_MEM_BLOCK   *Block;
-
-  ASSERT ((Head != NULL) && (BlockToUnlink != NULL));
-
-  for (Block = Head; Block != NULL; Block = Block->Next) {
-if (Block->Next == BlockToUnlink) {
-  Block->Next = BlockToUnlink->Next;
-  BlockToUnlink->Next = NULL;
-  break;
-}
-  }
-}
 
 /**
   Initialize the memory management pool for the host controller.
diff --git a/MdeModulePkg/Bus/Pci/XhciPei/XhcPeim.c 
b/MdeModulePkg/Bus/Pci/XhciPei/XhcPeim.c
index c5631e87ca..ee4d1f97bd 100644
--- a/MdeModulePkg/Bus/Pci/XhciPei/XhcPeim.c
+++ b/MdeModulePkg/Bus/Pci/XhciPei/XhcPeim.c
@@ -211,29 +211,7 @@ XhcPeiReadCapRegister (
   return Data;
 }
 
-/**
-  Read XHCI door bell register.
-
-  @param  Xhc   The XHCI device.
-  @param  OffsetThe offset of the door bell register.
-
-  @return The register content read
 
-**/
-UINT32
-XhcPeiReadDoorBellReg (
-  IN  PEI_XHC_DEV   *Xhc,
-  IN  UINT32Offset
-  )
-{
-  UINT32  Data;
-
-  ASSERT (Xhc->DBOff != 0);
-
-  Data = MmioRead32 (Xhc->UsbHostControllerBaseAddress + Xhc->DBOff + Offset);
-
-  return Data;
-}
 
 /**
   Write the data to the XHCI door bell register.
diff --git a/MdeModulePkg/Bus/Pci/XhciPei/XhciReg.h 
b/MdeModulePkg/Bus/Pci/XhciPei/XhciReg.h
index 0297072ffd..3787aeccf5 100644
--- a/MdeModulePkg/Bus/Pci/XhciPei/XhciReg.h
+++ b/MdeModulePkg/Bus/Pci/XhciPei/XhciReg.h
@@ -302,20 +302,6 @@ XhcPeiWaitOpRegBit (
   IN UINT32 Timeout
   );
 
-/**
-  Read XHCI door bell register.
-
-  @param  Xhc   The XHCI device.
-  @param  OffsetThe offset of the door bell register.
-
-  @return The register content read
-
-**/
-UINT32
-XhcPeiReadDoorBellReg (
-  IN  PEI_XHC_DEV   *Xhc,
-  IN  UINT32Offset
-  );
 
 /**
   Write the data to the XHCI door bell register.
-- 
2.18.0.windows.1

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


[edk2] [PATCH v2 11/27] MdeModulePkg UfsBlockIoPei: Remove redundant functions

2018-08-14 Thread shenglei
The functions that are never called have been removed.
They are UfsPeimUnlinkMemBlock,UfsPeimRequestSense,
UfsPeimInquiry,UfsRwAttributes,UfsClearFlag,UfsReadFlag
and UfsFindAvailableSlotInTmrl.
https://bugzilla.tianocore.org/show_bug.cgi?id=1062

v2: Remove the comment that mentioned 'UfsPeimUnlinkMemBlock'
within function UfsPeimFreeMemPool().

Cc: Star Zeng 
Cc: Eric Dong 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: shenglei 
Reviewed-by: Hao Wu 
Reviewed-by: Star Zeng 
---
 .../Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.c | 101 --
 MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHcMem.c |  26 ---
 MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.c   | 180 --
 3 files changed, 307 deletions(-)

diff --git a/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.c 
b/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.c
index 505b92cfc1..204e456413 100644
--- a/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.c
+++ b/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.c
@@ -137,53 +137,7 @@ UFS_PEIM_HC_PRIVATE_DATA   gUfsHcPeimTemplate = {
   }
 };
 
-/**
-  Execute Request Sense SCSI command on a specific UFS device.
-
-  @param[in]  Private  A pointer to UFS_PEIM_HC_PRIVATE_DATA data 
structure.
-  @param[in]  Lun  The lun on which the SCSI cmd executed.
-  @param[out] DataBuffer   A pointer to output sense data.
-  @param[out] DataBufferLength The length of output sense data.
-
-  @retval EFI_SUCCESS  The command executed successfully.
-  @retval EFI_DEVICE_ERROR A device error occurred while attempting to 
send SCSI Request Packet.
-  @retval EFI_TIMEOUT  A timeout occurred while waiting for the 
SCSI Request Packet to execute.
-
-**/
-EFI_STATUS
-UfsPeimRequestSense (
-  IN UFS_PEIM_HC_PRIVATE_DATA*Private,
-  IN UINTN   Lun,
- OUT VOID*DataBuffer,
- OUT UINT32  *DataBufferLength
-  )
-{
-  UFS_SCSI_REQUEST_PACKETPacket;
-  UINT8  Cdb[UFS_SCSI_OP_LENGTH_SIX];
-  EFI_STATUS Status;
 
-  ZeroMem (, sizeof (UFS_SCSI_REQUEST_PACKET));
-  ZeroMem (Cdb, sizeof (Cdb));
-
-  Cdb[0]  = EFI_SCSI_OP_REQUEST_SENSE;
-
-  Packet.Timeout  = UFS_TIMEOUT;
-  Packet.Cdb  = Cdb;
-  Packet.CdbLength= sizeof (Cdb);
-  Packet.DataDirection= UfsDataIn;
-  Packet.InDataBuffer = DataBuffer;
-  Packet.InTransferLength = *DataBufferLength;
-  Packet.SenseData= NULL;
-  Packet.SenseDataLength  = 0;
-
-  Status = UfsExecScsiCmds (Private,(UINT8)Lun, );
-
-  if (!EFI_ERROR (Status)) {
-*DataBufferLength = Packet.InTransferLength;
-  }
-
-  return Status;
-}
 
 /**
   Execute TEST UNITY READY SCSI command on a specific UFS device.
@@ -231,62 +185,7 @@ UfsPeimTestUnitReady (
   return Status;
 }
 
-/**
-  Execute INQUIRY SCSI command on a specific UFS device.
-
-  @param[in]  Private  A pointer to UFS_PEIM_HC_PRIVATE_DATA data 
structure.
-  @param[in]  Lun  The lun on which the SCSI cmd executed.
-  @param[out] Inquiry  A pointer to Inquiry data buffer.
-  @param[out] InquiryLengths   The length of output Inquiry data.
-  @param[out] SenseDataA pointer to output sense data.
-  @param[out] SenseDataLength  The length of output sense data.
-
-  @retval EFI_SUCCESS  The command executed successfully.
-  @retval EFI_DEVICE_ERROR A device error occurred while attempting to 
send SCSI Request Packet.
-  @retval EFI_TIMEOUT  A timeout occurred while waiting for the 
SCSI Request Packet to execute.
-
-**/
-EFI_STATUS
-UfsPeimInquiry (
-  IN UFS_PEIM_HC_PRIVATE_DATA *Private,
-  IN UINTNLun,
- OUT VOID *Inquiry,
- OUT UINT32   *InquiryLength,
- OUT VOID *SenseData,  OPTIONAL
- OUT UINT8*SenseDataLength
-  )
-{
-  UFS_SCSI_REQUEST_PACKET Packet;
-  UINT8   Cdb[UFS_SCSI_OP_LENGTH_SIX];
-  EFI_STATUS  Status;
-
-  ZeroMem (, sizeof (UFS_SCSI_REQUEST_PACKET));
-  ZeroMem (Cdb, sizeof (Cdb));
 
-  Cdb[0]  = EFI_SCSI_OP_INQUIRY;
-  Cdb[4]  = sizeof (EFI_SCSI_INQUIRY_DATA);
-
-  Packet.Timeout  = UFS_TIMEOUT;
-  Packet.Cdb  = Cdb;
-  Packet.CdbLength= sizeof (Cdb);
-  Packet.InDataBuffer = Inquiry;
-  Packet.InTransferLength = *InquiryLength;
-  Packet.DataDirection= UfsDataIn;
-  Packet.SenseData= SenseData;
-  Packet.SenseDataLength  = *SenseDataLength;
-
-  Status = UfsExecScsiCmds (Private, (UINT8)Lun, );
-
-  if (*SenseDataLength != 0) {
-*SenseDataLength = Packet.SenseDataLength;
-  }
-
-  if (!EFI_ERROR (Status)) {
-*InquiryLength = Packet.InTransferLength;
-  }
-
-  return Status;

[edk2] [PATCH v2 05/27] MdeModulePkg NvmExpressDxe: Remove redundant functions

2018-08-14 Thread shenglei
The functions that are never called have been removed.
They are ReadNvmeAdminSubmissionQueueBaseAddress,
ReadNvmeAdminCompletionQueueBaseAddress and ReadNvmeAdminQueueAttributes
https://bugzilla.tianocore.org/show_bug.cgi?id=1062

Cc: Star Zeng 
Cc: Eric Dong 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: shenglei 
Reviewed-by: Star Zeng 
Reviewed-by: Laszlo Ersek 
Reviewed-by: Hao Wu 
---
 .../Bus/Pci/NvmExpressDxe/NvmExpressHci.c | 110 --
 1 file changed, 110 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressHci.c 
b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressHci.c
index 30ade3a589..421561f16d 100644
--- a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressHci.c
+++ b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressHci.c
@@ -183,43 +183,7 @@ ReadNvmeControllerStatus (
   return EFI_SUCCESS;
 }
 
-/**
-  Read Nvm Express admin queue attributes register.
-
-  @param  Private  The pointer to the NVME_CONTROLLER_PRIVATE_DATA 
data structure.
-  @param  Aqa  The buffer used to store admin queue attributes 
register content.
-
-  @return EFI_SUCCESS  Successfully read the admin queue attributes 
register content.
-  @return EFI_DEVICE_ERROR Fail to read the admin queue attributes register.
-
-**/
-EFI_STATUS
-ReadNvmeAdminQueueAttributes (
-  IN NVME_CONTROLLER_PRIVATE_DATA *Private,
-  IN NVME_AQA *Aqa
-  )
-{
-  EFI_PCI_IO_PROTOCOL   *PciIo;
-  EFI_STATUSStatus;
-  UINT32Data;
-
-  PciIo  = Private->PciIo;
-  Status = PciIo->Mem.Read (
-PciIo,
-EfiPciIoWidthUint32,
-NVME_BAR,
-NVME_AQA_OFFSET,
-1,
-
-);
-
-  if (EFI_ERROR(Status)) {
-return Status;
-  }
 
-  WriteUnaligned32 ((UINT32*)Aqa, Data);
-  return EFI_SUCCESS;
-}
 
 /**
   Write Nvm Express admin queue attributes register.
@@ -262,43 +226,6 @@ WriteNvmeAdminQueueAttributes (
   return EFI_SUCCESS;
 }
 
-/**
-  Read Nvm Express admin submission queue base address register.
-
-  @param  Private  The pointer to the NVME_CONTROLLER_PRIVATE_DATA 
data structure.
-  @param  Asq  The buffer used to store admin submission queue 
base address register content.
-
-  @return EFI_SUCCESS  Successfully read the admin submission queue base 
address register content.
-  @return EFI_DEVICE_ERROR Fail to read the admin submission queue base 
address register.
-
-**/
-EFI_STATUS
-ReadNvmeAdminSubmissionQueueBaseAddress (
-  IN NVME_CONTROLLER_PRIVATE_DATA *Private,
-  IN NVME_ASQ *Asq
-  )
-{
-  EFI_PCI_IO_PROTOCOL   *PciIo;
-  EFI_STATUSStatus;
-  UINT64Data;
-
-  PciIo  = Private->PciIo;
-  Status = PciIo->Mem.Read (
-PciIo,
-EfiPciIoWidthUint32,
-NVME_BAR,
-NVME_ASQ_OFFSET,
-2,
-
-);
-
-  if (EFI_ERROR(Status)) {
-return Status;
-  }
-
-  WriteUnaligned64 ((UINT64*)Asq, Data);
-  return EFI_SUCCESS;
-}
 
 /**
   Write Nvm Express admin submission queue base address register.
@@ -341,44 +268,7 @@ WriteNvmeAdminSubmissionQueueBaseAddress (
   return EFI_SUCCESS;
 }
 
-/**
-  Read Nvm Express admin completion queue base address register.
-
-  @param  Private  The pointer to the NVME_CONTROLLER_PRIVATE_DATA 
data structure.
-  @param  Acq  The buffer used to store admin completion queue 
base address register content.
-
-  @return EFI_SUCCESS  Successfully read the admin completion queue base 
address register content.
-  @return EFI_DEVICE_ERROR Fail to read the admin completion queue base 
address register.
-
-**/
-EFI_STATUS
-ReadNvmeAdminCompletionQueueBaseAddress (
-  IN NVME_CONTROLLER_PRIVATE_DATA *Private,
-  IN NVME_ACQ *Acq
-  )
-{
-  EFI_PCI_IO_PROTOCOL   *PciIo;
-  EFI_STATUSStatus;
-  UINT64Data;
-
-  PciIo  = Private->PciIo;
 
-  Status = PciIo->Mem.Read (
-PciIo,
-EfiPciIoWidthUint32,
-NVME_BAR,
-NVME_ACQ_OFFSET,
-2,
-
-);
-
-  if (EFI_ERROR(Status)) {
-return Status;
-  }
-
-  WriteUnaligned64 ((UINT64*)Acq, Data);
-  return EFI_SUCCESS;
-}
 
 /**
   Write Nvm Express admin completion queue base address register.
-- 
2.18.0.windows.1

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


[edk2] [PATCH v2 06/27] MdeModulePkg PciBusDxe: Remove redundant functions

2018-08-14 Thread shenglei
The functions that are never called have been removed.
They are UpStreamBridgesAttributes and GetHpcPciAddressFromRootBridge.
https://bugzilla.tianocore.org/show_bug.cgi?id=1062

Cc: Star Zeng 
Cc: Eric Dong 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: shenglei 
Reviewed-by: Ruiyu Ni 
Reviewed-by: Laszlo Ersek 
---
 .../Bus/Pci/PciBusDxe/PciDeviceSupport.c  | 80 ---
 .../Bus/Pci/PciBusDxe/PciDeviceSupport.h  | 17 
 MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c| 41 --
 MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.h| 21 -
 4 files changed, 159 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c 
b/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c
index 48cf57a24f..f7039da992 100644
--- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c
+++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c
@@ -1061,85 +1061,5 @@ ActiveVGADeviceOnTheRootBridge (
 }
 
 
-/**
-  Get HPC PCI address according to its device path.
-
-  @param RootBridge   Root bridege Io instance.
-  @param RemainingDevicePath  Given searching device path.
-  @param PciAddress   Buffer holding searched result.
-
-  @retval EFI_SUCCESS PCI address was stored in PciAddress
-  @retval EFI_NOT_FOUND   Can not find the specific device path.
-
-**/
-EFI_STATUS
-GetHpcPciAddressFromRootBridge (
-  IN  PCI_IO_DEVICE*RootBridge,
-  IN  EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath,
-  OUT UINT64   *PciAddress
-  )
-{
-  EFI_DEV_PATH_PTR  Node;
-  PCI_IO_DEVICE *Temp;
-  EFI_DEVICE_PATH_PROTOCOL  *CurrentDevicePath;
-  LIST_ENTRY*CurrentLink;
-  BOOLEAN   MisMatch;
-
-  MisMatch  = FALSE;
-
-  CurrentDevicePath = RemainingDevicePath;
-  Node.DevPath  = CurrentDevicePath;
-  Temp  = NULL;
-
-  while (!IsDevicePathEnd (CurrentDevicePath)) {
-
-CurrentLink   = RootBridge->ChildList.ForwardLink;
-Node.DevPath  = CurrentDevicePath;
-
-while (CurrentLink != NULL && CurrentLink != >ChildList) {
-  Temp = PCI_IO_DEVICE_FROM_LINK (CurrentLink);
-
-  if (Node.Pci->Device   == Temp->DeviceNumber &&
-  Node.Pci->Function == Temp->FunctionNumber) {
-RootBridge = Temp;
-break;
-  }
-
-  CurrentLink = CurrentLink->ForwardLink;
-}
-
-//
-// Check if we find the bridge
-//
-if (CurrentLink == >ChildList) {
-
-  MisMatch = TRUE;
-  break;
-
-}
-
-CurrentDevicePath = NextDevicePathNode (CurrentDevicePath);
-  }
-
-  if (MisMatch) {
-
-CurrentDevicePath = NextDevicePathNode (CurrentDevicePath);
-
-if (IsDevicePathEnd (CurrentDevicePath)) {
-  *PciAddress = EFI_PCI_ADDRESS (RootBridge->BusNumber, Node.Pci->Device, 
Node.Pci->Function, 0);
-  return EFI_SUCCESS;
-}
-
-return EFI_NOT_FOUND;
-  }
 
-  if (Temp != NULL) {
-*PciAddress = EFI_PCI_ADDRESS (Temp->BusNumber, Temp->DeviceNumber, 
Temp->FunctionNumber, 0);
-  } else {
-return EFI_NOT_FOUND;
-  }
-
-  return EFI_SUCCESS;
-
-}
 
diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.h 
b/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.h
index 1a01e72b1e..c282381f85 100644
--- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.h
+++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.h
@@ -255,23 +255,6 @@ ActiveVGADeviceOnTheRootBridge (
   IN PCI_IO_DEVICE*RootBridge
   );
 
-/**
-  Get HPC PCI address according to its device path.
-
-  @param RootBridge   Root bridege Io instance.
-  @param RemainingDevicePath  Given searching device path.
-  @param PciAddress   Buffer holding searched result.
-
-  @retval EFI_SUCCESS PCI address was stored in PciAddress.
-  @retval EFI_NOT_FOUND   Can not find the specific device path.
-
-**/
-EFI_STATUS
-GetHpcPciAddressFromRootBridge (
-  IN  PCI_IO_DEVICE*RootBridge,
-  IN  EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath,
-  OUT UINT64   *PciAddress
-  );
 
 /**
   Destroy a pci device node.
diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c 
b/MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c
index 87b0b9884a..291578c63c 100644
--- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c
+++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c
@@ -2061,47 +2061,6 @@ PciIoSetBarAttributes (
   return EFI_SUCCESS;
 }
 
-/**
-  Program parent bridge's attribute recurrently.
-
-  @param PciIoDevice  Child Pci device instance
-  @param OperationThe operation to perform on the attributes for this PCI 
controller.
-  @param Attributes   The mask of attributes that are used for Set, Enable, 
and Disable
-  operations.
-
-  @retval EFI_SUCCESS   The operation on the PCI controller's 
attributes was completed.
-  @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
-  @retval EFI_UNSUPPORTED   one or more of the bits set in
-  

[edk2] [PATCH v2 03/27] MdeModulePkg AtaAtapiPassThru: Remove redundant functions

2018-08-14 Thread shenglei
The functions that are never called have been removed.
They are AhciCheckDeviceStatus,AhciPortReset,DRDYReady,
DRDYReady2,WaitForBSYClear2 and AtaSoftReset.
https://bugzilla.tianocore.org/show_bug.cgi?id=1062

v2: DRDYReady, DRDYReady2, WaitForBSYClear2 and AtaSoftReset
are added to the commit message.

Cc: Star Zeng 
Cc: Eric Dong 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: shenglei 
Reviewed-by: Laszlo Ersek 
Reviewed-by: Star Zeng 
---
 .../Bus/Ata/AtaAtapiPassThru/AhciMode.c   | 104 ---
 .../Bus/Ata/AtaAtapiPassThru/IdeMode.c| 257 --
 2 files changed, 361 deletions(-)

diff --git a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c 
b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c
index 79ae11bd20..d7a8b29666 100644
--- a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c
+++ b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c
@@ -294,41 +294,6 @@ AhciCheckMemSet (
   }
 }
 
-/**
-  Check if the device is still on port. It also checks if the AHCI controller
-  supports the address and data count will be transferred.
-
-  @param  PciIoThe PCI IO protocol instance.
-  @param  Port The number of port.
-
-  @retval EFI_SUCCESS  The device is attached to port and the transfer 
data is
-   supported by AHCI controller.
-  @retval EFI_UNSUPPORTED  The transfer address and count is not supported by 
AHCI
-   controller.
-  @retval EFI_NOT_READYThe physical communication between AHCI controller 
and device
-   is not ready.
-
-**/
-EFI_STATUS
-EFIAPI
-AhciCheckDeviceStatus (
-  IN  EFI_PCI_IO_PROTOCOL*PciIo,
-  IN  UINT8  Port
-  )
-{
-  UINT32  Data;
-  UINT32  Offset;
-
-  Offset = EFI_AHCI_PORT_START + Port * EFI_AHCI_PORT_REG_WIDTH + 
EFI_AHCI_PORT_SSTS;
-
-  Data   = AhciReadReg (PciIo, Offset) & EFI_AHCI_PORT_SSTS_DET_MASK;
-
-  if (Data == EFI_AHCI_PORT_SSTS_DET_PCE) {
-return EFI_SUCCESS;
-  }
-
-  return EFI_NOT_READY;
-}
 
 /**
 
@@ -1361,75 +1326,6 @@ AhciStartCommand (
   return EFI_SUCCESS;
 }
 
-/**
-  Do AHCI port reset.
-
-  @param  PciIo  The PCI IO protocol instance.
-  @param  Port   The number of port.
-  @param  TimeoutThe timeout value of reset, uses 100ns as a unit.
-
-  @retval EFI_DEVICE_ERROR   The port reset unsuccessfully
-  @retval EFI_TIMEOUTThe reset operation is time out.
-  @retval EFI_SUCCESSThe port reset successfully.
-
-**/
-EFI_STATUS
-EFIAPI
-AhciPortReset (
-  IN  EFI_PCI_IO_PROTOCOL   *PciIo,
-  IN  UINT8 Port,
-  IN  UINT64Timeout
-  )
-{
-  EFI_STATUS  Status;
-  UINT32  Offset;
-
-  AhciClearPortStatus (PciIo, Port);
-
-  AhciStopCommand (PciIo, Port, Timeout);
-
-  AhciDisableFisReceive (PciIo, Port, Timeout);
-
-  AhciEnableFisReceive (PciIo, Port, Timeout);
-
-  Offset = EFI_AHCI_PORT_START + Port * EFI_AHCI_PORT_REG_WIDTH + 
EFI_AHCI_PORT_SCTL;
-
-  AhciOrReg (PciIo, Offset, EFI_AHCI_PORT_SCTL_DET_INIT);
-
-  //
-  // wait 5 millisecond before de-assert DET
-  //
-  MicroSecondDelay (5000);
-
-  AhciAndReg (PciIo, Offset, (UINT32)EFI_AHCI_PORT_SCTL_MASK);
-
-  //
-  // wait 5 millisecond before de-assert DET
-  //
-  MicroSecondDelay (5000);
-
-  //
-  // Wait for communication to be re-established
-  //
-  Offset = EFI_AHCI_PORT_START + Port * EFI_AHCI_PORT_REG_WIDTH + 
EFI_AHCI_PORT_SSTS;
-  Status = AhciWaitMmioSet (
- PciIo,
- Offset,
- EFI_AHCI_PORT_SSTS_DET_MASK,
- EFI_AHCI_PORT_SSTS_DET_PCE,
- Timeout
- );
-
-  if (EFI_ERROR (Status)) {
-DEBUG ((EFI_D_ERROR, "Port %d COMRESET failed: %r\n", Port, Status));
-return Status;
-  }
-
-  Offset = EFI_AHCI_PORT_START + Port * EFI_AHCI_PORT_REG_WIDTH + 
EFI_AHCI_PORT_SERR;
-  AhciOrReg (PciIo, Offset, EFI_AHCI_PORT_ERR_CLEAR);
-
-  return EFI_SUCCESS;
-}
 
 /**
   Do AHCI HBA reset.
diff --git a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/IdeMode.c 
b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/IdeMode.c
index 6478f7be07..79142c330d 100644
--- a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/IdeMode.c
+++ b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/IdeMode.c
@@ -627,146 +627,8 @@ DRQReady2 (
   return EFI_TIMEOUT;
 }
 
-/**
-  This function is used to poll for the DRDY bit set in the Status Register. 
DRDY
-  bit is set when the device is ready to accept command. Most ATA commands 
must be
-  sent after DRDY set except the ATAPI Packet Command.
-
-  @param PciIoA pointer to EFI_PCI_IO_PROTOCOL data structure.
-  @param IdeRegisters A pointer to EFI_IDE_REGISTERS data structure.
-  @param Timeout  The time to complete the command, uses 100ns as a 
unit.
-
-  @retval EFI_SUCCESS DRDY bit set within the time out.
-  @retval EFI_TIMEOUT DRDY bit not set within the time out.
-
-  @note  Read Status Register will clear interrupt 

[edk2] [PATCH v2 07/27] MdeModulePkg SdMmcPciHcDxe: Remove redundant functions

2018-08-14 Thread shenglei
The functions that are never called have been removed.
They are SdCardGetCsd and SdCardGetScr.
https://bugzilla.tianocore.org/show_bug.cgi?id=1062

Cc: Star Zeng 
Cc: Eric Dong 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: shenglei 
---
 MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c | 107 --
 1 file changed, 107 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c 
b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c
index 9e70de956f..8c93933bc6 100644
--- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c
+++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c
@@ -318,116 +318,9 @@ SdCardSetRca (
   return Status;
 }
 
-/**
-  Send command SEND_CSD to the SD device to get the data of the CSD register.
-
-  Refer to SD Physical Layer Simplified Spec 4.1 Section 4.7 for details.
-
-  @param[in]  PassThru  A pointer to the EFI_SD_MMC_PASS_THRU_PROTOCOL 
instance.
-  @param[in]  Slot  The slot number of the SD card to send the command 
to.
-  @param[in]  Rca   The relative device address of selected device.
-  @param[out] Csd   The buffer to store the content of the CSD 
register.
-Note the caller should ignore the lowest byte of 
this
-buffer as the content of this byte is meaningless 
even
-if the operation succeeds.
-
-  @retval EFI_SUCCESS   The operation is done correctly.
-  @retval OthersThe operation fails.
-
-**/
-EFI_STATUS
-SdCardGetCsd (
-  IN EFI_SD_MMC_PASS_THRU_PROTOCOL  *PassThru,
-  IN UINT8  Slot,
-  IN UINT16 Rca,
- OUT SD_CSD *Csd
-  )
-{
-  EFI_SD_MMC_COMMAND_BLOCK  SdMmcCmdBlk;
-  EFI_SD_MMC_STATUS_BLOCK   SdMmcStatusBlk;
-  EFI_SD_MMC_PASS_THRU_COMMAND_PACKET   Packet;
-  EFI_STATUSStatus;
-
-  ZeroMem (, sizeof (SdMmcCmdBlk));
-  ZeroMem (, sizeof (SdMmcStatusBlk));
-  ZeroMem (, sizeof (Packet));
-
-  Packet.SdMmcCmdBlk= 
-  Packet.SdMmcStatusBlk = 
-  Packet.Timeout= SD_MMC_HC_GENERIC_TIMEOUT;
 
-  SdMmcCmdBlk.CommandIndex = SD_SEND_CSD;
-  SdMmcCmdBlk.CommandType  = SdMmcCommandTypeAc;
-  SdMmcCmdBlk.ResponseType = SdMmcResponseTypeR2;
-  SdMmcCmdBlk.CommandArgument = (UINT32)Rca << 16;
 
-  Status = SdMmcPassThruPassThru (PassThru, Slot, , NULL);
-  if (!EFI_ERROR (Status)) {
-//
-// For details, refer to SD Host Controller Simplified Spec 3.0 Table 2-12.
-//
-CopyMem (((UINT8*)Csd) + 1, , sizeof (SD_CSD) - 1);
-  }
-
-  return Status;
-}
-
-/**
-  Send command SEND_CSD to the SD device to get the data of the CSD register.
-
-  Refer to SD Physical Layer Simplified Spec 4.1 Section 4.7 for details.
 
-  @param[in]  PassThru  A pointer to the EFI_SD_MMC_PASS_THRU_PROTOCOL 
instance.
-  @param[in]  Slot  The slot number of the SD card to send the command 
to.
-  @param[in]  Rca   The relative device address of selected device.
-  @param[out] Scr   The buffer to store the content of the SCR 
register.
-
-  @retval EFI_SUCCESS   The operation is done correctly.
-  @retval OthersThe operation fails.
-
-**/
-EFI_STATUS
-SdCardGetScr (
-  IN EFI_SD_MMC_PASS_THRU_PROTOCOL  *PassThru,
-  IN UINT8  Slot,
-  IN UINT16 Rca,
- OUT SD_SCR *Scr
-  )
-{
-  EFI_SD_MMC_COMMAND_BLOCK  SdMmcCmdBlk;
-  EFI_SD_MMC_STATUS_BLOCK   SdMmcStatusBlk;
-  EFI_SD_MMC_PASS_THRU_COMMAND_PACKET   Packet;
-  EFI_STATUSStatus;
-
-  ZeroMem (, sizeof (SdMmcCmdBlk));
-  ZeroMem (, sizeof (SdMmcStatusBlk));
-  ZeroMem (, sizeof (Packet));
-
-  Packet.SdMmcCmdBlk= 
-  Packet.SdMmcStatusBlk = 
-  Packet.Timeout= SD_MMC_HC_GENERIC_TIMEOUT;
-
-  SdMmcCmdBlk.CommandIndex = SD_APP_CMD;
-  SdMmcCmdBlk.CommandType  = SdMmcCommandTypeAc;
-  SdMmcCmdBlk.ResponseType = SdMmcResponseTypeR1;
-  SdMmcCmdBlk.CommandArgument = (UINT32)Rca << 16;
-
-  Status = SdMmcPassThruPassThru (PassThru, Slot, , NULL);
-  if (EFI_ERROR (Status)) {
-return Status;
-  }
-
-  SdMmcCmdBlk.CommandIndex = SD_SEND_SCR;
-  SdMmcCmdBlk.CommandType  = SdMmcCommandTypeAdtc;
-  SdMmcCmdBlk.ResponseType = SdMmcResponseTypeR1;
-
-  Packet.InDataBuffer = Scr;
-  Packet.InTransferLength = sizeof (SD_SCR);
-
-  Status = SdMmcPassThruPassThru (PassThru, Slot, , NULL);
-
-  return Status;
-}
 
 /**
   Send command SELECT_DESELECT_CARD to the SD device to select/deselect it.
-- 
2.18.0.windows.1

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


[edk2] [PATCH v2 02/27] MdeModulePkg UiApp: Remove redundant functions

2018-08-14 Thread shenglei
The functions that are never called have been removed.
They are EnableResetReminderFeature,
DisableResetReminderFeature and DisableResetRequired.
https://bugzilla.tianocore.org/show_bug.cgi?id=1062

Cc: Star Zeng 
Cc: Eric Dong 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: shenglei 
Reviewed-by: Laszlo Ersek 
Reviewed-by: Star Zeng 
---
 MdeModulePkg/Application/UiApp/FrontPage.c | 40 --
 MdeModulePkg/Application/UiApp/Ui.h| 30 
 2 files changed, 70 deletions(-)

diff --git a/MdeModulePkg/Application/UiApp/FrontPage.c 
b/MdeModulePkg/Application/UiApp/FrontPage.c
index 2403aad9d9..f0513deb51 100644
--- a/MdeModulePkg/Application/UiApp/FrontPage.c
+++ b/MdeModulePkg/Application/UiApp/FrontPage.c
@@ -1042,34 +1042,7 @@ UiEntry (
 //
 
 
-/**
-  Enable the setup browser reset reminder feature.
-  This routine is used in platform tip. If the platform policy need the 
feature, use the routine to enable it.
 
-**/
-VOID
-EFIAPI
-EnableResetReminderFeature (
-  VOID
-  )
-{
-  mFeaturerSwitch = TRUE;
-}
-
-
-/**
-  Disable the setup browser reset reminder feature.
-  This routine is used in platform tip. If the platform policy do not want the 
feature, use the routine to disable it.
-
-**/
-VOID
-EFIAPI
-DisableResetReminderFeature (
-  VOID
-  )
-{
-  mFeaturerSwitch = FALSE;
-}
 
 
 /**
@@ -1087,19 +1060,6 @@ EnableResetRequired (
 }
 
 
-/**
-  Record the info that  no reset is required.
-  A  module boolean variable is used to record whether a reset is required.
-
-**/
-VOID
-EFIAPI
-DisableResetRequired (
-  VOID
-  )
-{
-  mResetRequired = FALSE;
-}
 
 
 /**
diff --git a/MdeModulePkg/Application/UiApp/Ui.h 
b/MdeModulePkg/Application/UiApp/Ui.h
index a9c30b0c56..7be164570c 100644
--- a/MdeModulePkg/Application/UiApp/Ui.h
+++ b/MdeModulePkg/Application/UiApp/Ui.h
@@ -53,27 +53,7 @@ typedef struct {
 //
 //The interface functions related to the Setup Browser Reset Reminder feature
 //
-/**
-  Enable the setup browser reset reminder feature.
-  This routine is used in a platform tip. If the platform policy needs the 
feature, use the routine to enable it.
 
-**/
-VOID
-EFIAPI
-EnableResetReminderFeature (
-  VOID
-  );
-
-/**
-  Disable the setup browser reset reminder feature.
-  This routine is used in a platform tip. If the platform policy does not want 
the feature, use the routine to disable it.
-
-**/
-VOID
-EFIAPI
-DisableResetReminderFeature (
-  VOID
-  );
 
 /**
   Record the info that a reset is required.
@@ -87,16 +67,6 @@ EnableResetRequired (
   );
 
 
-/**
-  Record the info that no reset is required.
-  A module boolean variable is used to record whether a reset is required.
-
-**/
-VOID
-EFIAPI
-DisableResetRequired (
-  VOID
-  );
 
 /**
   Check whether platform policy enables the reset reminder feature. The 
default is enabled.
-- 
2.18.0.windows.1

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


[edk2] [PATCH v2 00/27] MdeModulePkg Remove redundant functions

2018-08-14 Thread shenglei
https://bugzilla.tianocore.org/show_bug.cgi?id=1062

v2:
1.Fix typos in 18/27, 19/27, 20/27, 21/27, 22/27, 23/27 and 24/27.
2.Remove redundant comments in 11/27, 19/27 and 20/27.
3.Add four funcitions to the commit message in 03/27
4.Add a new patch 27/27.
5.Edit the commit message of 17/27.

shenglei (27):
  MdeModulePkg CapsuleApp: Remove a redundant function
  MdeModulePkg UiApp: Remove redundant functions
  MdeModulePkg AtaAtapiPassThru: Remove redundant functions
  MdeModulePkg EhciDxe: Remove redundant functions
  MdeModulePkg NvmExpressDxe: Remove redundant functions
  MdeModulePkg PciBusDxe: Remove redundant functions
  MdeModulePkg SdMmcPciHcDxe: Remove redundant functions
  MdeModulePkg UhciPei: Remove redundant functions
  MdeModulePkg XhciDxe: Remove redundant functions
  MdeModulePkg XhciPei: Remove redundant functions
  MdeModulePkg UfsBlockIoPei: Remove redundant functions
  MdeModulePkg UfsPassThruDxe: Remove redundant functions
  MdeModulePkg UsbBotPei: Remove redundant functions
  MdeModulePkg UsbBusDxe: Remove redundant functions
  MdeModulePkg UsbBusPei: Remove redundant functions
  MdeModulePkg Core/Dxe: Remove redundant functions
  MdeModulePkg PiSmmCore: Remove redundant functions
  MdeModulePkg Ps2KeyboardDxe: Remove a redundant function
  MdeModulePkg EmmcBlockIoPei: Remove a redundant function
  MdeModulePkg SdBlockIoPei: Remove a redundant function
  MdeModulePkg TerminalDxe: Remove a redundant function
  MdeModulePkg HiiDatabaseDxe: Remove a redundant function
  MdeModulePkg Ip4Dxe: Remove a redundant function
  MdeModulePkg IScsiDxe: Remove a redundant function
  MdeModulePkg Tcp4Dxe: Remove redundant functions
  MdeModulePkg SetupBrowserDxe: Remove a redundant function
  MdeModulePkg UiApp: Remove a redundant function and a variable

 .../Application/CapsuleApp/CapsuleDump.c  |  31 ---
 MdeModulePkg/Application/UiApp/FrontPage.c|  91 ++-
 MdeModulePkg/Application/UiApp/Ui.h   |  30 --
 .../Bus/Ata/AtaAtapiPassThru/AhciMode.c   | 104 ---
 .../Bus/Ata/AtaAtapiPassThru/IdeMode.c| 257 --
 .../Bus/Isa/Ps2KeyboardDxe/Ps2KbdCtrller.c|  26 --
 .../Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.h  |  12 -
 MdeModulePkg/Bus/Pci/EhciDxe/EhciDebug.c  |  27 --
 MdeModulePkg/Bus/Pci/EhciDxe/EhciDebug.h  |  11 -
 MdeModulePkg/Bus/Pci/EhciDxe/EhciReg.c|  44 ---
 .../Bus/Pci/NvmExpressDxe/NvmExpressHci.c | 110 
 .../Bus/Pci/PciBusDxe/PciDeviceSupport.c  |  80 --
 .../Bus/Pci/PciBusDxe/PciDeviceSupport.h  |  17 --
 MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c|  41 ---
 MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.h|  21 --
 MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c | 107 
 MdeModulePkg/Bus/Pci/UhciPei/DmaMem.c |  22 --
 MdeModulePkg/Bus/Pci/UhciPei/UhcPeim.c| 125 -
 MdeModulePkg/Bus/Pci/UhciPei/UhcPeim.h|  78 --
 MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c|  66 -
 MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.h|  28 --
 MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.c   |  24 --
 MdeModulePkg/Bus/Pci/XhciPei/XhcPeim.c|  22 --
 MdeModulePkg/Bus/Pci/XhciPei/XhciReg.h|  14 -
 .../Bus/Sd/EmmcBlockIoPei/EmmcHcMem.c |  26 --
 MdeModulePkg/Bus/Sd/SdBlockIoPei/SdHcMem.c|  26 --
 .../Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.c | 101 ---
 MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHcMem.c |  26 --
 MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.c   | 180 
 .../Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c   |  49 
 MdeModulePkg/Bus/Usb/UsbBotPei/PeiUsbLib.c| 190 -
 MdeModulePkg/Bus/Usb/UsbBotPei/PeiUsbLib.h|  98 ---
 MdeModulePkg/Bus/Usb/UsbBusDxe/UsbHub.c   |  68 -
 MdeModulePkg/Bus/Usb/UsbBusDxe/UsbUtility.c   | 146 --
 MdeModulePkg/Bus/Usb/UsbBusDxe/UsbUtility.h   | 114 
 MdeModulePkg/Bus/Usb/UsbBusPei/HubPeim.c  |  39 ---
 MdeModulePkg/Bus/Usb/UsbBusPei/HubPeim.h  |  18 --
 MdeModulePkg/Bus/Usb/UsbBusPei/PeiUsbLib.c|  77 --
 MdeModulePkg/Bus/Usb/UsbBusPei/PeiUsbLib.h|  35 ---
 MdeModulePkg/Core/Dxe/DxeMain.h   |  13 -
 MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c   |  22 --
 MdeModulePkg/Core/Dxe/Mem/HeapGuard.c |  78 --
 MdeModulePkg/Core/PiSmmCore/HeapGuard.c   | 166 ---
 .../Core/PiSmmCore/MemoryAttributesTable.c| 131 -
 MdeModulePkg/Core/PiSmmCore/Page.c| 121 -
 .../Universal/Console/TerminalDxe/Terminal.h  |  12 -
 .../Console/TerminalDxe/TerminalConIn.c   |  25 --
 .../Universal/HiiDatabaseDxe/ConfigRouting.c  |  47 
 .../Universal/Network/IScsiDxe/IScsiProto.c   |  31 ---
 .../Universal/Network/Ip4Dxe/Ip4Config2Impl.c |  16 --
 .../Universal/Network/Tcp4Dxe/SockImpl.c  |  35 ---
 .../Universal/Network/Tcp4Dxe/SockInterface.c |  41 ---
 .../Universal/Network/Tcp4Dxe/Socket.h|  32 ---
 .../Universal/Network/Tcp4Dxe/Tcp4Option.c|  28 --
 

[edk2] [PATCH v2 01/27] MdeModulePkg CapsuleApp: Remove a redundant function

2018-08-14 Thread shenglei
The function DumpImageAuthentication that is never called
has been removed.
https://bugzilla.tianocore.org/show_bug.cgi?id=1062

Cc: Star Zeng 
Cc: Eric Dong 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: shenglei 
Reviewed-by: Star Zeng 
---
 .../Application/CapsuleApp/CapsuleDump.c  | 31 ---
 1 file changed, 31 deletions(-)

diff --git a/MdeModulePkg/Application/CapsuleApp/CapsuleDump.c 
b/MdeModulePkg/Application/CapsuleApp/CapsuleDump.c
index 45c3ecd050..7a3eb94362 100644
--- a/MdeModulePkg/Application/CapsuleApp/CapsuleDump.c
+++ b/MdeModulePkg/Application/CapsuleApp/CapsuleDump.c
@@ -106,37 +106,6 @@ DumpUxCapsule (
   Print(L"  OffsetY  - 0x%x\n", DisplayCapsule->ImagePayload.OffsetY);
 }
 
-/**
-  Dump FMP image authentication information.
-
-  @param[in] Image  The FMP capsule image
-  @param[in] ImageSize  The size of the FMP capsule image in bytes.
-
-  @return the size of FMP authentication.
-**/
-UINTN
-DumpImageAuthentication (
-  IN VOID   *Image,
-  IN UINTN  ImageSize
-  )
-{
-  EFI_FIRMWARE_IMAGE_AUTHENTICATION *ImageAuthentication;
-
-  ImageAuthentication = Image;
-  if (CompareGuid(>AuthInfo.CertType, ) 
||
-  CompareGuid(>AuthInfo.CertType, 
)) {
-Print(L"[ImageAuthentication]\n");
-Print(L"  MonotonicCount   - 0x%lx\n", 
ImageAuthentication->MonotonicCount);
-Print(L"WIN_CERTIFICATE:\n");
-Print(L"  dwLength - 0x%x\n", 
ImageAuthentication->AuthInfo.Hdr.dwLength);
-Print(L"  wRevision- 0x%x\n", 
ImageAuthentication->AuthInfo.Hdr.wRevision);
-Print(L"  wCertificateType - 0x%x\n", 
ImageAuthentication->AuthInfo.Hdr.wCertificateType);
-Print(L"  CertType - %g\n", 
>AuthInfo.CertType);
-return sizeof(ImageAuthentication->MonotonicCount) + 
ImageAuthentication->AuthInfo.Hdr.dwLength;
-  } else {
-return 0;
-  }
-}
 
 /**
   Dump a non-nested FMP capsule.
-- 
2.18.0.windows.1

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


Re: [edk2] [PATCH] NetworkPkg: Remove the redundant code and definition.

2018-08-14 Thread Wu, Jiaxin
Looks good to me. 

Reviewed-by: Jiaxin Wu 


> -Original Message-
> From: Li, Songpeng
> Sent: Monday, August 13, 2018 10:45 AM
> To: edk2-devel@lists.01.org
> Cc: Wu, Jiaxin ; Fu, Siyuan 
> Subject: [PATCH] NetworkPkg: Remove the redundant code and definition.
> 
> Cc: Jiaxin Wu 
> Cc: Siyuan Fu 
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1064
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Songpeng Li 
> ---
>  NetworkPkg/IScsiDxe/IScsiDxe.inf |  1 -
>  NetworkPkg/IScsiDxe/IScsiProto.c | 33 
>  NetworkPkg/IpSecDxe/Ikev2/Payload.c  | 18 ---
>  NetworkPkg/IpSecDxe/Ikev2/Utility.c  | 76 
>  NetworkPkg/IpSecDxe/Ikev2/Utility.h  | 67 
>  NetworkPkg/TcpDxe/TcpOption.c| 30 ---
>  NetworkPkg/TcpDxe/TcpOption.h| 16 --
>  NetworkPkg/TlsDxe/TlsDxe.inf |  1 -
>  NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c | 23 -
>  NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.h | 10 
>  10 files changed, 275 deletions(-)
> 
> diff --git a/NetworkPkg/IScsiDxe/IScsiDxe.inf
> b/NetworkPkg/IScsiDxe/IScsiDxe.inf
> index 2d96611b44..60737c96ab 100644
> --- a/NetworkPkg/IScsiDxe/IScsiDxe.inf
> +++ b/NetworkPkg/IScsiDxe/IScsiDxe.inf
> @@ -124,7 +124,6 @@
>gEfiIfrTianoGuid  ## SOMETIMES_PRODUCES ## 
> UNDEFINED
>gEfiAcpiTableGuid ## SOMETIMES_CONSUMES ##
> SystemTable
>gEfiAcpi10TableGuid   ## SOMETIMES_CONSUMES ##
> SystemTable
> -  gEfiAcpi20TableGuid   ## SOMETIMES_CONSUMES ##
> SystemTable
>gEfiAdapterInfoNetworkBootGuid## SOMETIMES_CONSUMES ##
> UNDEFINED
>gEfiAdapterInfoUndiIpv6SupportGuid## SOMETIMES_CONSUMES ##
> GUID
> 
> diff --git a/NetworkPkg/IScsiDxe/IScsiProto.c
> b/NetworkPkg/IScsiDxe/IScsiProto.c
> index 7619360568..f4a49c677a 100644
> --- a/NetworkPkg/IScsiDxe/IScsiProto.c
> +++ b/NetworkPkg/IScsiDxe/IScsiProto.c
> @@ -2096,39 +2096,6 @@ IScsiDelTcb (
>  }
> 
> 
> -/**
> -  Find the task control block by the initator task tag.
> -
> -  @param[in]  TcbList The tcb list.
> -  @param[in]  InitiatorTaskTag The initiator task tag.
> -
> -  @return The task control block found.
> -  @retval NULL The task control block cannot be found.
> -
> -**/
> -ISCSI_TCB *
> -IScsiFindTcbByITT (
> -  IN LIST_ENTRY  *TcbList,
> -  IN UINT32  InitiatorTaskTag
> -  )
> -{
> -  ISCSI_TCB   *Tcb;
> -  LIST_ENTRY  *Entry;
> -
> -  Tcb = NULL;
> -
> -  NET_LIST_FOR_EACH (Entry, TcbList) {
> -Tcb = NET_LIST_USER_STRUCT (Entry, ISCSI_TCB, Link);
> -
> -if (Tcb->InitiatorTaskTag == InitiatorTaskTag) {
> -  break;
> -}
> -  }
> -
> -  return Tcb;
> -}
> -
> -
>  /**
>Create a data segment, pad it, and calculate the CRC if needed.
> 
> diff --git a/NetworkPkg/IpSecDxe/Ikev2/Payload.c
> b/NetworkPkg/IpSecDxe/Ikev2/Payload.c
> index 218c26f934..1bb5e2e5e5 100644
> --- a/NetworkPkg/IpSecDxe/Ikev2/Payload.c
> +++ b/NetworkPkg/IpSecDxe/Ikev2/Payload.c
> @@ -3104,24 +3104,6 @@ ON_EXIT:
>return Status;
>  }
> 
> -/**
> -  Save some useful payloads after accepting the Packet.
> -
> -  @param[in] SessionCommon   Pointer to IKEV2_SESSION_COMMON
> related to the operation.
> -  @param[in] IkePacket   Pointer to received IkePacet.
> -  @param[in] IkeType The type used to indicate it is in IkeSa or 
> ChildSa or
> Info
> - exchange.
> -
> -**/
> -VOID
> -Ikev2OnPacketAccepted (
> -  IN IKEV2_SESSION_COMMON *SessionCommon,
> -  IN IKE_PACKET   *IkePacket,
> -  IN UINT8IkeType
> -  )
> -{
> -  return;
> -}
> 
>  /**
> 
> diff --git a/NetworkPkg/IpSecDxe/Ikev2/Utility.c
> b/NetworkPkg/IpSecDxe/Ikev2/Utility.c
> index 698aba1327..0c9c929705 100644
> --- a/NetworkPkg/IpSecDxe/Ikev2/Utility.c
> +++ b/NetworkPkg/IpSecDxe/Ikev2/Utility.c
> @@ -290,21 +290,6 @@ Ikev2SaSessionRemove (
>return NULL;
>  }
> 
> -/**
> -  Marking a SA session as on deleting.
> -
> -  @param[in]  IkeSaSession  Pointer to IKEV2_SA_SESSION.
> -
> -  @retval EFI_SUCCESS   Find the related SA session and marked it.
> -
> -**/
> -EFI_STATUS
> -Ikev2SaSessionOnDeleting (
> -  IN IKEV2_SA_SESSION  *IkeSaSession
> -  )
> -{
> -  return EFI_SUCCESS;
> -}
> 
>  /**
>Free specified Seession Common. The session common would belong to a
> IKE SA or
> @@ -659,33 +644,6 @@ Ikev2ChildSaSessionReg (
>return ;
>  }
> 
> -/**
> -  Find the ChildSaSession by it's MessagId.
> -
> -  @param[in] SaSessionList  Pointer to a ChildSaSession List.
> -  @param[in] MidThe messageId used to search ChildSaSession.
> -
> -  @return Pointer to IKEV2_CHILD_SA_SESSION or NULL.
> -
> -**/
> -IKEV2_CHILD_SA_SESSION *
> -Ikev2ChildSaSessionLookupByMid (
> -  IN LIST_ENTRY   *SaSessionList,
> -  IN UINT32   Mid
> -  )
> -{
> -  LIST_ENTRY  *Entry;
> -  

Re: [edk2] DxeIpl module cannot find DXE entry point

2018-08-14 Thread Zeng, Star
You may try report the FVMAIN_COMPACT with the way like below. Then PeiCore's 
FvInfo notification will decompress the FVMAIN_COMPACT and build FV HOB for 
decompressed FVMAIN for DXE phase. FvInfo is the standard way, FvHob is produce 
for DXE phase. PeiCore only processes FvHob when 
PcdFrameworkCompatibilitySupport = TRUE.

  //
  // Let PEI know about the DXE FV so it can find the DXE Core
  //
  PeiServicesInstallFvInfoPpi (
NULL,
(VOID *)(UINTN) PcdGet32 (PcdOvmfDxeMemFvBase),
PcdGet32 (PcdOvmfDxeMemFvSize),
NULL,
NULL
);

Thanks,
Star
-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Laszlo 
Ersek
Sent: Tuesday, August 14, 2018 9:18 PM
To: Hristo Mihaylov ; 
edk2-devel@lists.01.org
Subject: Re: [edk2] DxeIpl module cannot find DXE entry point

On 08/14/18 14:00, Hristo Mihaylov wrote:
> Hello, Laszlo,
> 
> There is a PEIM that executes BuildFvHob with the FVMAIN_COMPACT address and 
> size, the function also exits normally.
> 
> The crash occurs here: 
> https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Core/DxeIplPeim/DxeLoad.c#L469
>  and the platform uses UDK2015 packages.
> I also updated the DxeIpl module to the latest UDK release, but that didn't 
> fix the issue.
> 
> Now I'm trying two approaches:
> 
> 1. to use a decompressed DXE and see if the issue was in the compression.
> 2. to enable source level debugging and track execution.
> 
> Any idea what else it could be, besides the BuildFvHob function? Or a way to 
> see if the HOB was built successfully.

Sorry, adding fine-grained debug messages (or source level debugging, as you 
say) is my only thought at this point.

Laszlo
___
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] question about uefi calling convention

2018-08-14 Thread krishnaLee
thank you,Laszlo.


krishna.








At 2018-08-14 21:54:03, "Laszlo Ersek"  wrote:
>On 08/14/18 11:09, krishnaLee wrote:
>> Hi,
>> In uefi 2.6 specification -> 2.3.4 x64 Platforms,
>> "Paging mode is enabled and any memory space defined by the UEFI memory map 
>> is identity mapped (virtual address equals physical address)" ...
>> is that mean if I write C code like " void *pointer=0xabcd",the pointer is 
>> virtual address ,is equal to the physical address, and they are the same?
>
>Yes.
>
>> How the virtual address translate from "CR3->Page Base address,Page 
>> directory,page table ..." to physical address in "x64 Long mode,64-bit 
>> mode"? is there any sample not theory?
>
>The page tables are built in the DXE IPL PEIM, function
>CreateIdentityMappingPageTables().
>
>Laszlo
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] EDK II Stable Tag release edk2-stable201808 and quiet period starting today

2018-08-14 Thread Kinney, Michael D
Laszlo,

Thank you for this valuable feedback on the commit
activity in the quiet period.  I agree with your analysis.

Bugzillas should have been entered for all of these
changes and discussed on the mailing list and approved
before commit.

We will learn from this experience and apply it as we
complete the current quiet period and apply to future
ones.

At this time, I am only aware of one additional change
request before adding the edk2-stable201808 tag:

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

Thanks,

Mike

> -Original Message-
> From: Laszlo Ersek [mailto:ler...@redhat.com]
> Sent: Tuesday, August 14, 2018 8:12 AM
> To: Kinney, Michael D ;
> edk2-devel@lists.01.org; leif.lindh...@linaro.org;
> Andrew Fish (af...@apple.com) ;
> Richardson, Brian 
> Subject: Re: [edk2] EDK II Stable Tag release edk2-
> stable201808 and quiet period starting today
> 
> On 08/08/18 16:16, Kinney, Michael D wrote:
> > Hello,
> >
> > I sent an RFC for review on EDK II stable tags.
> >
> > https://lists.01.org/pipermail/edk2-devel/2018-
> June/026474.html
> >
> > There were no objections and we would like to move
> forward
> > with the an EDK II Stable Tag release.  The original
> goal was
> > 8/10/2018.  I have seen a request to move the stable
> tag
> > release out a few days.
> >
> > I recommend we target 8/15/2018 and start a quiet
> period
> > on edk2/master starting today.  This means critical
> bug
> > fixes only on edk2/master.  New features and large
> changes
> > should be held until the edk2-stable201808 tag is
> created.
> >
> > Please use Bugzilla for the critical issues that must
> be
> > fixed before the tag is created.
> >
> > https://bugzilla.tianocore.org/
> 
> The following commits have been pushed since we entered
> the quiet period
> (the last commit before it was 9e6c4f1527e6,
> "FmpDevicePkg FmpDxe: Lock
> variables in entrypoint instead of callback"):
> 
>1  3781f14c31e0
> SecurityPkg/Library/Tpm2DeviceLibDTpm: fix
> s/Constructor/CONSTRUCTOR
> 
> This is a critical bugfix, satisfying the requirement.
> 
>2  b3e1e343fe34 SecurityPkg: HashLib: Update HashLib
> file GUID
> 
> Can also be considered an important bugfix (GUID
> duplication), although
> the commit does not name a TianoCore BZ.
> 
>3  10ea1b6853f9 Maintainers.txt: Add FmpDevicePkg
> maintainers
> 
> Can be considered an important bugfix (no maintainers
> listed for a
> top-level package). Misses a TianoCore BZ reference.
> 
>4  45e076b7a720 Vlv2TbltDevicePkg/Override/Bds: Add
> test key notification
>5  dc65dd5be697 Vlv2TbltDevicePkg/Feature/Capsule:
> Add FmpDeviceLib instances
>6  d3049066ca25 Vlv2TbltDevicePkg/Capsule: Add
> scripts to generate capsules
>7  1aa9314e3a84 Vlv2TbltDevicePkg: Update DSC/FDF to
> use FmpDevicePkg
> 
> These commits violate the quiet period. They add a
> feature.
> 
>8  667abfaf8a16 UefiCpuPkg: Removing ipf which is no
> longer supported from edk2.
>9  df49a85dbcc6 CorebootModulePkg: Removing ipf from
> edk2.
>   10  04c7f9023ffe CorebootPayloadPkg: Removing ipf
> from edk2.
>   11  4fcb0d54584f NetworkPkg: Removing ipf which is no
> longer supported from edk2.
>   12  87f9867f5536 QuarkPlatformPkg: Removing ipf which
> is no longer supported from edk2.
>   13  fda6abd64f02 QuarkSocPkg: Removing ipf which is
> no longer supported from edk2.
>   14  22ec06c8aaa1 Vlv2TbltDevicePkg: Removing ipf
> which from edk2.
> 
> These commits also violate the quiet period. They
> implement a valid
> cleanup, but not a critical bugfix. They should have
> been delayed.
> 
> Laszlo
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH edk2/MdePkg v1 1/1] MdePkg Cper.h: Add generic error macros for ARM platform

2018-08-14 Thread Kinney, Michael D
Leif,

I have no objections to this commit being made before
the edk2 stable tag.

I see a Bugzilla for this topic as well:

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

I have updated the Bugzilla approving this change
for edk2-stable201808.

Thanks,

Mike


> -Original Message-
> From: edk2-devel [mailto:edk2-devel-
> boun...@lists.01.org] On Behalf Of Leif Lindholm
> Sent: Tuesday, August 14, 2018 9:42 AM
> To: Ming Huang 
> Cc: huangmin...@huawei.com; edk2-devel@lists.01.org;
> Gao, Liming ;
> mengfanr...@huawei.com; guoh...@huawei.com;
> zhangjinso...@huawei.com; linaro-u...@lists.linaro.org;
> Kinney, Michael D ;
> wanghuiqi...@huawei.com; huangda...@hisilicon.com
> Subject: Re: [edk2] [PATCH edk2/MdePkg v1 1/1] MdePkg
> Cper.h: Add generic error macros for ARM platform
> 
> On Sun, Aug 12, 2018 at 10:01:48PM +0800, Ming Huang
> wrote:
> > Contributed-under: TianoCore Contribution Agreement
> 1.1
> > Signed-off-by: Ming Huang 
> 
> Mike, Liming.
> Could we merge this during the quiet period?
> It's basically an omission - these are defined since
> (at least) UEFI 2.6.
> 
> > ---
> >  MdePkg/Include/Guid/Cper.h | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/MdePkg/Include/Guid/Cper.h
> b/MdePkg/Include/Guid/Cper.h
> > index 5ddd4c715ebc..525bfe57b21b 100644
> > --- a/MdePkg/Include/Guid/Cper.h
> > +++ b/MdePkg/Include/Guid/Cper.h
> > @@ -256,6 +256,7 @@ typedef struct {
> >  ///@{
> >  #define EFI_GENERIC_ERROR_PROC_TYPE_IA32_X64
> 0x00
> >  #define EFI_GENERIC_ERROR_PROC_TYPE_IA64
> 0x01
> > +#define EFI_GENERIC_ERROR_PROC_TYPE_ARM
> 0x02
> >  ///@}
> >
> >  ///
> > @@ -265,6 +266,8 @@ typedef struct {
> >  #define EFI_GENERIC_ERROR_PROC_ISA_IA32
> 0x00
> >  #define EFI_GENERIC_ERROR_PROC_ISA_IA64
> 0x01
> >  #define EFI_GENERIC_ERROR_PROC_ISA_X64
> 0x02
> > +#define EFI_GENERIC_ERROR_PROC_ISA_ARM32
> 0x03
> > +#define EFI_GENERIC_ERROR_PROC_ISA_ARM64
> 0x04
> 
> Looking at the spec though, these are called:
> ARM A32/T32 and
> ARM A64
> 
> For architectural correctness, I think the names should
> be
> EFI_GENERIC_ERROR_PROC_ISA_A32_T32
> EFI_GENERIC_ERROR_PROC_ISA_A64
> or
> EFI_GENERIC_ERROR_PROC_ISA_ARM_A32_T32
> EFI_GENERIC_ERROR_PROC_ISA_ARM_A64
> which gives some form of glorious symmetry against the
> EFI_GENERIC_ERROR_PROC_TYPE_IA32_X64 above :)
> 
> With either change, as preferred by the package
> maintainers:
> Reviewed-by: Leif Lindholm 
> 
> >  ///@}
> >
> >  ///
> > --
> > 2.17.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


Re: [edk2] [Patch 0/4] Vlv2TbltDevicePkg: Add FmpDevicePkg support

2018-08-14 Thread Kinney, Michael D
Hi Laszlo,

I should have entered a Bugzilla for this item so I 
could clearly document why this is required before
the stable tag and sent email to edk2-devel to inform
everyone that this Bugzilla should be considered for
the stable tag release to give the community a chance
to vote if it should be allowed or not. 

One feature that has been added for this stable tag
is the FmpDevicePkg and the GenerateCapsule tool.
These work together to provide a simpler method to
generate and process UEFI capsules for firmware updates.

I am using the platform in the Vlv2TbltDevicePkg to
demonstrate the use of this feature.  I am adding
Wiki pages on this feature that will reference this
platform with functional examples.

I had hoped I could get this content in before the
start of the quiet period, but I missed the window.

Thanks,

Mike

> -Original Message-
> From: Laszlo Ersek [mailto:ler...@redhat.com]
> Sent: Tuesday, August 14, 2018 7:59 AM
> To: Guo, Mang ; Kinney, Michael D
> ; edk2-devel@lists.01.org
> Cc: Wei, David ; Leif Lindholm
> (Linaro address) 
> Subject: Re: [edk2] [Patch 0/4] Vlv2TbltDevicePkg: Add
> FmpDevicePkg support
> 
> Hi,
> 
> On 08/10/18 08:25, Guo, Mang wrote:
> > Reviewed-by: Guo Mang 
> 
> please consider the diffstat on this patch set:
> 
> >  28 files changed, 2032 insertions(+), 252
> deletions(-)
> 
> May I ask why this patch set has been committed during
> the quiet period,
> before the upcoming stable tag? See "[edk2] EDK II
> Stable Tag release
> edk2-stable201808 and quiet period starting today":
> 
> https://lists.01.org/pipermail/edk2-devel/2018-
> August/028210.html
> 
> On 08/08/18 16:16, Kinney, Michael D wrote:
> > I recommend we target 8/15/2018 and start a quiet
> period
> > on edk2/master starting today.  This means critical
> bug
> > fixes only on edk2/master.  New features and large
> changes
> > should be held until the edk2-stable201808 tag is
> created.
> 
> Based on the diffstat, this series is not a "critical
> bugfix" (the blurb
> bears the subject "Vlv2TbltDevicePkg: Add FmpDevicePkg
> support").
> 
> The quiet period / stable tags don't make much sense if
> we don't honor
> them.
> 
> Laszlo
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH edk2/MdePkg v1 1/1] MdePkg Cper.h: Add generic error macros for ARM platform

2018-08-14 Thread Leif Lindholm
On Sun, Aug 12, 2018 at 10:01:48PM +0800, Ming Huang wrote:
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ming Huang 

Mike, Liming.
Could we merge this during the quiet period?
It's basically an omission - these are defined since (at least) UEFI 2.6.

> ---
>  MdePkg/Include/Guid/Cper.h | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/MdePkg/Include/Guid/Cper.h b/MdePkg/Include/Guid/Cper.h
> index 5ddd4c715ebc..525bfe57b21b 100644
> --- a/MdePkg/Include/Guid/Cper.h
> +++ b/MdePkg/Include/Guid/Cper.h
> @@ -256,6 +256,7 @@ typedef struct {
>  ///@{
>  #define EFI_GENERIC_ERROR_PROC_TYPE_IA32_X64 0x00
>  #define EFI_GENERIC_ERROR_PROC_TYPE_IA64 0x01
> +#define EFI_GENERIC_ERROR_PROC_TYPE_ARM  0x02
>  ///@}
>  
>  ///
> @@ -265,6 +266,8 @@ typedef struct {
>  #define EFI_GENERIC_ERROR_PROC_ISA_IA32  0x00
>  #define EFI_GENERIC_ERROR_PROC_ISA_IA64  0x01
>  #define EFI_GENERIC_ERROR_PROC_ISA_X64   0x02
> +#define EFI_GENERIC_ERROR_PROC_ISA_ARM32 0x03
> +#define EFI_GENERIC_ERROR_PROC_ISA_ARM64 0x04

Looking at the spec though, these are called:
ARM A32/T32 and
ARM A64

For architectural correctness, I think the names should be
EFI_GENERIC_ERROR_PROC_ISA_A32_T32
EFI_GENERIC_ERROR_PROC_ISA_A64
or 
EFI_GENERIC_ERROR_PROC_ISA_ARM_A32_T32
EFI_GENERIC_ERROR_PROC_ISA_ARM_A64
which gives some form of glorious symmetry against the
EFI_GENERIC_ERROR_PROC_TYPE_IA32_X64 above :)

With either change, as preferred by the package maintainers:
Reviewed-by: Leif Lindholm 

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


Re: [edk2] [PATCH 1/1] OvmfPkg: Resolve HashInstanceLibSha384 and HashInstanceLibSha512

2018-08-14 Thread Laszlo Ersek
Hi Gary,

(+ Marc-André)

On 08/14/18 09:36, Gary Lin wrote:
> Sha384 and Sha512 were added to HashInstanceLib recently. Resolve those
> two libraries to enable SHA384 and SHA512 support in TPM.
> 
> Cc: Ard Biesheuvel 
> Cc: Jordan Justen 
> Cc: Laszlo Ersek 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Gary Lin 
> ---
>  OvmfPkg/OvmfPkgIa32.dsc| 4 
>  OvmfPkg/OvmfPkgIa32X64.dsc | 4 
>  OvmfPkg/OvmfPkgX64.dsc | 4 
>  3 files changed, 12 insertions(+)
> 
> diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
> index a28b511d5c2f..9f07e75050c0 100644
> --- a/OvmfPkg/OvmfPkgIa32.dsc
> +++ b/OvmfPkg/OvmfPkgIa32.dsc
> @@ -634,6 +634,8 @@ [Components]
>
> HashLib|SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterPei.inf
>NULL|SecurityPkg/Library/HashInstanceLibSha1/HashInstanceLibSha1.inf
>
> NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256.inf
> +  
> NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384.inf
> +  
> NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512.inf
>}
>  !endif
>  
> @@ -936,5 +938,7 @@ [Components]
>
> HashLib|SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterDxe.inf
>NULL|SecurityPkg/Library/HashInstanceLibSha1/HashInstanceLibSha1.inf
>
> NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256.inf
> +  
> NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384.inf
> +  
> NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512.inf
>}
>  !endif
> diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
> index 115d0c01ff5c..a4eaeb808c6b 100644
> --- a/OvmfPkg/OvmfPkgIa32X64.dsc
> +++ b/OvmfPkg/OvmfPkgIa32X64.dsc
> @@ -642,6 +642,8 @@ [Components.IA32]
>
> HashLib|SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterPei.inf
>NULL|SecurityPkg/Library/HashInstanceLibSha1/HashInstanceLibSha1.inf
>
> NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256.inf
> +  
> NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384.inf
> +  
> NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512.inf
>}
>  !endif
>  
> @@ -946,5 +948,7 @@ [Components.X64]
>
> HashLib|SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterDxe.inf
>NULL|SecurityPkg/Library/HashInstanceLibSha1/HashInstanceLibSha1.inf
>
> NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256.inf
> +  
> NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384.inf
> +  
> NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512.inf
>}
>  !endif
> diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
> index 362eb789c712..aa3efc5e73b9 100644
> --- a/OvmfPkg/OvmfPkgX64.dsc
> +++ b/OvmfPkg/OvmfPkgX64.dsc
> @@ -641,6 +641,8 @@ [Components]
>
> HashLib|SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterPei.inf
>NULL|SecurityPkg/Library/HashInstanceLibSha1/HashInstanceLibSha1.inf
>
> NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256.inf
> +  
> NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384.inf
> +  
> NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512.inf
>}
>  !endif
>  
> @@ -944,5 +946,7 @@ [Components]
>
> HashLib|SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterDxe.inf
>NULL|SecurityPkg/Library/HashInstanceLibSha1/HashInstanceLibSha1.inf
>
> NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256.inf
> +  
> NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384.inf
> +  
> NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512.inf
>}
>  !endif
> 

this patch looks good to me, but we'll have to delay it until after the
stable tag (see "EDK II Stable Tag release edk2-stable201808 and quiet
period starting today").

Meanwhile, can you please repost the patch with some commit message
updates (including the subject): we're not really resolving these
libraries for OvmfPkg; instead we link them into Tcg2Pei and Tcg2Dxe via
NULL class resolution. So I suggest the following subject:

  OvmfPkg: link Sha384 and Sha512 support into Tcg2Pei and Tcg2Dxe

Please try to replace the "resolve those two libraries" expression in
the commit message similarly.

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


Re: [edk2] [PATCH v1 0/2] add DwMmcHcDxe driver

2018-08-14 Thread Leif Lindholm
Haojian,

This is kind of massive.
Is there any way it could be broken into more patches?
The NonDiscoverableDeviceDxe patch is OK, but the changes to
DwMmcHcDxe are gargantuan.

Chris - does any of this turn into something you could use for your
platforms?

/
Leis

On Fri, Aug 10, 2018 at 04:49:13PM +0800, Haojian Zhuang wrote:
> Changelog:
> v1:
>   *Add NonDiscoverableDeviceDxe for embedded platform. Make DwMmcHcDxe driver
>to support both eMMC and SD controller.
> 
> Haojian Zhuang (2):
>   EmbeddedPkg: add NonDiscoverableDeviceDxe driver
>   EmbeddedPkg: add DwMmcHcDxe driver
> 
>  EmbeddedPkg/Drivers/DwMmcHcDxe/DwMmcHcDxe.dec   
> |   40 +
>  EmbeddedPkg/EmbeddedPkg.dec 
> |1 +
>  EmbeddedPkg/Drivers/DwMmcHcDxe/DwMmcHcDxe.inf   
> |   69 +
>  EmbeddedPkg/Universal/NonDiscoverableDeviceDxe/NonDiscoverableDeviceDxe.inf 
> |   52 +
>  EmbeddedPkg/Drivers/DwMmcHcDxe/DwMmcHcDxe.h 
> |  815 +++
>  EmbeddedPkg/Drivers/DwMmcHcDxe/DwMmcHci.h   
> |  983 
>  EmbeddedPkg/Include/Protocol/PlatformDwMmc.h
> |   79 +
>  EmbeddedPkg/Universal/NonDiscoverableDeviceDxe/NonDiscoverableDeviceIo.h
> |   92 +
>  EmbeddedPkg/Drivers/DwMmcHcDxe/ComponentName.c  
> |  214 ++
>  EmbeddedPkg/Drivers/DwMmcHcDxe/DwMmcHcDxe.c 
> | 1295 +++
>  EmbeddedPkg/Drivers/DwMmcHcDxe/DwMmcHci.c   
> | 2366 
>  EmbeddedPkg/Drivers/DwMmcHcDxe/EmmcDevice.c 
> | 1042 +
>  EmbeddedPkg/Drivers/DwMmcHcDxe/SdDevice.c   
> | 1104 +
>  EmbeddedPkg/Universal/NonDiscoverableDeviceDxe/ComponentName.c  
> |  124 +
>  EmbeddedPkg/Universal/NonDiscoverableDeviceDxe/NonDiscoverableDeviceDxe.c   
> |  243 ++
>  EmbeddedPkg/Universal/NonDiscoverableDeviceDxe/NonDiscoverableDeviceIo.c
> |  972 
>  16 files changed, 9491 insertions(+)
>  create mode 100644 EmbeddedPkg/Drivers/DwMmcHcDxe/DwMmcHcDxe.dec
>  create mode 100644 EmbeddedPkg/Drivers/DwMmcHcDxe/DwMmcHcDxe.inf
>  create mode 100644 
> EmbeddedPkg/Universal/NonDiscoverableDeviceDxe/NonDiscoverableDeviceDxe.inf
>  create mode 100644 EmbeddedPkg/Drivers/DwMmcHcDxe/DwMmcHcDxe.h
>  create mode 100644 EmbeddedPkg/Drivers/DwMmcHcDxe/DwMmcHci.h
>  create mode 100644 EmbeddedPkg/Include/Protocol/PlatformDwMmc.h
>  create mode 100644 
> EmbeddedPkg/Universal/NonDiscoverableDeviceDxe/NonDiscoverableDeviceIo.h
>  create mode 100644 EmbeddedPkg/Drivers/DwMmcHcDxe/ComponentName.c
>  create mode 100644 EmbeddedPkg/Drivers/DwMmcHcDxe/DwMmcHcDxe.c
>  create mode 100644 EmbeddedPkg/Drivers/DwMmcHcDxe/DwMmcHci.c
>  create mode 100644 EmbeddedPkg/Drivers/DwMmcHcDxe/EmmcDevice.c
>  create mode 100644 EmbeddedPkg/Drivers/DwMmcHcDxe/SdDevice.c
>  create mode 100644 
> EmbeddedPkg/Universal/NonDiscoverableDeviceDxe/ComponentName.c
>  create mode 100644 
> EmbeddedPkg/Universal/NonDiscoverableDeviceDxe/NonDiscoverableDeviceDxe.c
>  create mode 100644 
> EmbeddedPkg/Universal/NonDiscoverableDeviceDxe/NonDiscoverableDeviceIo.c
> 
> Cc: Leif Lindholm 
> Cc: Ard Biesheuvel 
> -- 
> 2.7.4
> 
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH v1 edk-platforms 0/2] Fix missing PL011UartClockLib

2018-08-14 Thread Leif Lindholm
Hi Haojian,

On Thu, Aug 09, 2018 at 10:45:04AM +0800, Haojian Zhuang wrote:
> Fix build failure by appending PL011UartClockLib

I don't think these patches are required.

Commit 1160c702c24f ("Platform: Add PL011UartClockLib resolution to
all PL011UartLib users") added this resolution to
Silicon/Hisilicon/Hisilicon.dsc.inc, which is included by both these
files.

Can you confirm please?

Best Regards,

Leif

> Haojian Zhuang (2):
>   Platform/HiKey960: add PL011UartClockLib
>   Platform/HiKey: add PL011UartClockLib
> 
>  Platform/Hisilicon/HiKey/HiKey.dsc   | 1 +
>  Platform/Hisilicon/HiKey960/HiKey960.dsc | 1 +
>  2 files changed, 2 insertions(+)
> 
> Cc: Leif Lindholm 
> Cc: Ard Biesheuvel 
> -- 
> 2.7.4
> 
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH edk2-platforms v1 22/38] Platform/Hisilicon/D06: Add OemNicLib

2018-08-14 Thread Leif Lindholm
On Tue, Aug 14, 2018 at 10:38:14AM +0800, Ming wrote:
> 
> 
> 在 8/9/2018 6:19 PM, Leif Lindholm 写道:
> > On Thu, Aug 09, 2018 at 02:16:49PM +0800, Ming wrote:
>  +UINT16 crc_tab[256] = {
> >>>
> >>> CrcTable.
> >>
> >> Modify it in v2.
> >>
> >>> Hmm.
> >>> This might be useful to add to a core library/driver/protocol. We
> >>> don't appear to have it yet. This is another note to the universe.
> >>
> >> Do you suggest to move the CRC16 function to 
> >> MdePkg/Library/BaseLib/CheckSum.c ?
> >> I think it's not enouth time to do this before Linaro 18.08 maybe.
> > 
> > Not needed for 18.08, but I would like to see the improvement made
> > afterwards.
> > 
>  +EFI_STATUS
>  +EFIAPI
>  +OemGetMac (
>  +  IN OUT EFI_MAC_ADDRESS *Mac,
>  +  IN UINTN   Port
>  +  )
>  +{
>  +  EFI_STATUS Status;
>  +
>  +  if (NULL == Mac) {
> >>>
> >>> No jeopardy tests. Turn the comparison around to the logical order.
> >>>
>  +DEBUG ((DEBUG_ERROR, "[%a]:[%dL] Mac buffer is null!\n",
>  +__FUNCTION__, __LINE__));
>  +return EFI_INVALID_PARAMETER;
>  +  }
>  +
>  +  Status = OemGetMacE2prom (Port, Mac->Addr);
>  +  if ((EFI_ERROR (Status))) {
> >>>
> >>> Parantheses around EFI_ERROR are not needed.
> >>>
>  +DEBUG ((DEBUG_ERROR,
>  +  "[%a]:[%dL] Cannot get MAC from EEPROM, Status: %r; using default 
>  MAC.\n",
>  +  __FUNCTION__, __LINE__, Status));
>  +
>  +Mac->Addr[0] = 0x00;
>  +Mac->Addr[1] = 0x18;
>  +Mac->Addr[2] = 0x82;
>  +Mac->Addr[3] = 0x2F;
>  +Mac->Addr[4] = 0x02;
>  +Mac->Addr[5] = Port;
> >>>
> >>> I'm not super happy about this. This would wreak havoc on any real
> >>> network.
> >>> Arguably, a server platform should just fail hard at this point.
> >>> I would certainly appreciate a Pcd making that an option.
> >>>
> >>> Otherwise, some sort of proper scheme would need to be implemented:
> >>> using the 'locally administered range' of MAC addresses, and ensuring
> >>> addresses are only allocated after checking for possible duplicates on
> >>> the network.
> >>
> >> Do you suggest we should return EFI_NOT_FOUND here?
> > 
> > Yes please.
> > It would be good if we could have some (common) code to handle the
> > fluke situation where you end up without your own MAC address.
> > (So that the node can boot up and report that it is broken.)
> > But it needs to be done in a reliable way, and that's too big a task
> > for 18.08.
> 
> I found some modules which invoke OemGetMac() don't judge the Status of
> OemGetMac, so it may cause some issue now if changing to EFI_NOT_FOUND.
> How about change it while we handle the fluke situation after 18.08 ?

We cannot release 18.08 with known bugs.
And not checking return value is a bug.

I presume you mean that these calling functions are inside HwPkg?

The alternative would be to ensure the function does not return.
But I would not recommend that.

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


Re: [edk2] [PATCH edk2-platforms v1 27/38] Platform/Hisilicon/D06: Add EarlyConfigPeim peim

2018-08-14 Thread Leif Lindholm
On Tue, Aug 14, 2018 at 10:31:02AM +0800, Ming wrote:
> >>> That { goes at the end of the previous line.
> >>>
>  +StartupAp ();
> >>>
> >>> Hmm. At some point, we want to rename that function, to align with my
> >>> comments above.
> >>
> 
> As this function is use in several platforms, if I rename this function,
> D03/D05 should be rename in edk2-platforms and many functions in HwPkg
> should be rename.
> How about use the original name?

I would prefer it changed. But it is not required for 18.08. We can
discuss after that release.

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


Re: [edk2] [PATCH edk2-platforms v1 30/38] Hisilicon/D06: add apei driver

2018-08-14 Thread Leif Lindholm
On Fri, Aug 10, 2018 at 10:46:34AM +0800, Ming wrote:
> >> --- /dev/null
> >> +++ b/Silicon/Hisilicon/Hi1620/Drivers/Apei/Apei.inf

> >> +[sources.common]
> >> +  Apei.c
> > 
> > Apei.h?
> 
> As Apei.h is included by Apei.c, so I think Apei.h
> is no need to add here.

Will the build system still generate correct build dependencies if
Apei.h is modified?

> >> +  Bert/bert.c
> >> +  Bert/bert.h

And if so, why are these other .h files explicitly specified?

> >> +  Einj/einj.c
> >> +  Einj/einj.h
> >> +  Erst/erst.c
> >> +  Erst/erst.h
> >> +  Hest/hest.c
> >> +  Hest/hest.h
> >> +  ErrorSource/Ghes.c
> >> +  ErrorSource/Ghes.h
> >> +  OemApeiHi1620.c

> >> diff --git a/Silicon/Hisilicon/Hi1620/Drivers/Apei/Einj/einj.h 
> >> b/Silicon/Hisilicon/Hi1620/Drivers/Apei/Einj/einj.h
> >> new file mode 100644
> >> index 00..a5342b600f
> >> --- /dev/null
> >> +++ b/Silicon/Hisilicon/Hi1620/Drivers/Apei/Einj/einj.h
> >> @@ -0,0 +1,154 @@
> >> +/** @file
> >> +*
> >> +*  Copyright (c) 2017 Hisilicon Limited. 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.
> >> +*
> >> +**/
> >> +
> >> +#ifndef _EINJ_H_
> >> +#define _EINJ_H_
> >> +
> >> +#include "Apei.h"
> >> +
> >> +#define EINJ_ACTION_NO 10
> >> +#define EINJ_BEGIN_OPERATION_VALUE 0x
> >> +#define EINJ_END_OPERATION_VALUE   0
> >> +#define EINJ_WRITE_MASK0x
> >> +#define EINJ_READ_VALUE0x
> >> +#define EINJ_READ_MASK 0x
> >> +
> >> +#define EINJ_TRIGGER_ERROR_ACTION_NO1
> >> +
> >> +#define EFI_ACPI_EINJ_SET_ERROR_TYPE_WITH_ADDRESS   
> >> 0x08
> >> +#define EFI_ACPI_EINJ_GET_EXCUTE_OPERATION_TIMINGS  
> >> 0x09
> >> +
> >> +
> >> +extern EFI_ACPI_TABLE_PROTOCOL*mAcpiTableProtocol;
> >> +extern EFI_ACPI_SDT_PROTOCOL  *mAcpiSdtProtocol;
> >> +extern APEI_TRUSTFIRMWARE_STRUCTURE   *mApeiTrustfirmwareStruc;
> >> +
> >> +//
> >> +// Error Type Definition
> >> +//
> >> +#define EINJ_PROCESSOR_CORRECTABLE  
> >> BIT0
> >> +#define EINJ_PROCESSOR_UNCORRECTABLE_NONFATAL   
> >> BIT1
> >> +#define EINJ_PROCESSOR_UNCORRECTABLE_FATAL  
> >> BIT2
> >> +#define EINJ_MEMORY_CORRECTABLE 
> >> BIT3
> >> +#define EINJ_MEMORY_UNCORRECTABLE_NONFATAL  
> >> BIT4
> >> +#define EINJ_MEMORY_UNCORRECTABLE_FATAL 
> >> BIT5
> >> +#define EINJ_PCIE_CORRECTABLE   
> >> BIT6
> >> +#define EINJ_PCIE_UNCORRECTABLE_NONFATAL
> >> BIT7
> >> +#define EINJ_PCIE_UNCORRECTABLE_FATAL   
> >> BIT8
> >> +#define EINJ_PLATFORM_CORRECTABLE   
> >> BIT9
> >> +#define EINJ_PLATFORM_UNCORRECTABLE_NONFATAL
> >> BIT10
> >> +#define EINJ_PLATFORM_UNCORRECTABLE_FATAL   
> >> BIT11
> >> +#define EINJ_VENDOR_DEFINED_ERROR_TYPE  
> >> BIT31
> >> +
> >> +//
> >> +#define EINJ_PROCESSOR_APIC_VALID   
> >> BIT0
> >> +#define EINJ_MEMORY_ADDRESS_VALID   
> >> BIT1
> >> +#define EINJ_PCIE_SBDF_VALID
> >> BIT2
> >> +
> >> +//CPER
> >> +#define EFI_GENERIC_ERROR_PROC_TYPE_ARM 
> >> 0x02
> >> +
> >> +#define EFI_GENERIC_ERROR_PROC_ISA_ARM32
> >> 0x03
> >> +#define EFI_GENERIC_ERROR_PROC_ISA_ARM64
> >> 0x04
> > 
> > Surely these should be added to MdePkg/Include/Guid/Cper.h instead?
> > Please submit a patch.
> 
> OK, should this macro be add to MdePkg/Include/Guid/Cper.h ?
> EFI_GENERIC_ERROR_PROC_TYPE_ARM

Yes please - I could have been more clear on that.

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


Re: [edk2] [PATCH edk2-platforms v1 07/38] Silicon/Hisilicon/D06: Wait for all disk ready

2018-08-14 Thread Leif Lindholm
On Fri, Aug 10, 2018 at 09:44:29AM +0800, Ming wrote:
> > Which is exactly what an event is for.
> > At the point where the SAS controller driver is currently updating the
> > variable, it can instead call SignalEvent ().
> > 
> > The WaitForDiskReady () function can be changed to wait/check for that 
> > event.
> 
> As current solution(using variables) have run stable, I prefer don't change
> SAS driver and this wait function. Is it OK?

You can leave the driver out if you wish, but it cannot go into the
18.08 release with this design.

This is why it is important to publish the code as soon as possible -
especially for new platform ports. And to publish bits that are
possible earlier, rather than wait and do everything in one go once
the whole port is done.

Best Regards,

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


Re: [edk2] [PATCH] NetworkPkg: Remove the redundant code and definition.

2018-08-14 Thread Laszlo Ersek
On 08/13/18 04:45, Songpeng Li wrote:
> Cc: Jiaxin Wu 
> Cc: Siyuan Fu 
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1064
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Songpeng Li 
> ---
>  NetworkPkg/IScsiDxe/IScsiDxe.inf |  1 -
>  NetworkPkg/IScsiDxe/IScsiProto.c | 33 
>  NetworkPkg/IpSecDxe/Ikev2/Payload.c  | 18 ---
>  NetworkPkg/IpSecDxe/Ikev2/Utility.c  | 76 
>  NetworkPkg/IpSecDxe/Ikev2/Utility.h  | 67 
>  NetworkPkg/TcpDxe/TcpOption.c| 30 ---
>  NetworkPkg/TcpDxe/TcpOption.h| 16 --
>  NetworkPkg/TlsDxe/TlsDxe.inf |  1 -
>  NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c | 23 -
>  NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.h | 10 
>  10 files changed, 275 deletions(-)

Nacked-by: Laszlo Ersek 


Please fragment the patch to a series so that each patch modify only one
module under NetworkPkg. References:

4A89E2EF3DFEDB4C8BFDE51014F606A14E2C6745@SHSMSX104.ccr.corp.intel.com">http://mid.mail-archive.com/4A89E2EF3DFEDB4C8BFDE51014F606A14E2C6745@SHSMSX104.ccr.corp.intel.com

20180808084712.34696-1-shenglei.zhang@intel.com">http://mid.mail-archive.com/20180808084712.34696-1-shenglei.zhang@intel.com

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


Re: [edk2] EDK II Stable Tag release edk2-stable201808 and quiet period starting today

2018-08-14 Thread Laszlo Ersek
On 08/08/18 16:16, Kinney, Michael D wrote:
> Hello,
>
> I sent an RFC for review on EDK II stable tags.
>
> https://lists.01.org/pipermail/edk2-devel/2018-June/026474.html
>
> There were no objections and we would like to move forward
> with the an EDK II Stable Tag release.  The original goal was
> 8/10/2018.  I have seen a request to move the stable tag
> release out a few days.
>
> I recommend we target 8/15/2018 and start a quiet period
> on edk2/master starting today.  This means critical bug
> fixes only on edk2/master.  New features and large changes
> should be held until the edk2-stable201808 tag is created.
>
> Please use Bugzilla for the critical issues that must be
> fixed before the tag is created.
>
> https://bugzilla.tianocore.org/

The following commits have been pushed since we entered the quiet period
(the last commit before it was 9e6c4f1527e6, "FmpDevicePkg FmpDxe: Lock
variables in entrypoint instead of callback"):

   1  3781f14c31e0 SecurityPkg/Library/Tpm2DeviceLibDTpm: fix 
s/Constructor/CONSTRUCTOR

This is a critical bugfix, satisfying the requirement.

   2  b3e1e343fe34 SecurityPkg: HashLib: Update HashLib file GUID

Can also be considered an important bugfix (GUID duplication), although
the commit does not name a TianoCore BZ.

   3  10ea1b6853f9 Maintainers.txt: Add FmpDevicePkg maintainers

Can be considered an important bugfix (no maintainers listed for a
top-level package). Misses a TianoCore BZ reference.

   4  45e076b7a720 Vlv2TbltDevicePkg/Override/Bds: Add test key notification
   5  dc65dd5be697 Vlv2TbltDevicePkg/Feature/Capsule: Add FmpDeviceLib instances
   6  d3049066ca25 Vlv2TbltDevicePkg/Capsule: Add scripts to generate capsules
   7  1aa9314e3a84 Vlv2TbltDevicePkg: Update DSC/FDF to use FmpDevicePkg

These commits violate the quiet period. They add a feature.

   8  667abfaf8a16 UefiCpuPkg: Removing ipf which is no longer supported from 
edk2.
   9  df49a85dbcc6 CorebootModulePkg: Removing ipf from edk2.
  10  04c7f9023ffe CorebootPayloadPkg: Removing ipf from edk2.
  11  4fcb0d54584f NetworkPkg: Removing ipf which is no longer supported from 
edk2.
  12  87f9867f5536 QuarkPlatformPkg: Removing ipf which is no longer supported 
from edk2.
  13  fda6abd64f02 QuarkSocPkg: Removing ipf which is no longer supported from 
edk2.
  14  22ec06c8aaa1 Vlv2TbltDevicePkg: Removing ipf which from edk2.

These commits also violate the quiet period. They implement a valid
cleanup, but not a critical bugfix. They should have been delayed.

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


Re: [edk2] [Patch 0/4] Vlv2TbltDevicePkg: Add FmpDevicePkg support

2018-08-14 Thread Laszlo Ersek
Hi,

On 08/10/18 08:25, Guo, Mang wrote:
> Reviewed-by: Guo Mang 

please consider the diffstat on this patch set:

>  28 files changed, 2032 insertions(+), 252 deletions(-)

May I ask why this patch set has been committed during the quiet period,
before the upcoming stable tag? See "[edk2] EDK II Stable Tag release
edk2-stable201808 and quiet period starting today":

https://lists.01.org/pipermail/edk2-devel/2018-August/028210.html

On 08/08/18 16:16, Kinney, Michael D wrote:
> I recommend we target 8/15/2018 and start a quiet period
> on edk2/master starting today.  This means critical bug
> fixes only on edk2/master.  New features and large changes
> should be held until the edk2-stable201808 tag is created.

Based on the diffstat, this series is not a "critical bugfix" (the blurb
bears the subject "Vlv2TbltDevicePkg: Add FmpDevicePkg support").

The quiet period / stable tags don't make much sense if we don't honor
them.

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


Re: [edk2] [Patch V2] BaseTools: Clean up not used code in BuildClassObject

2018-08-14 Thread Carsey, Jaben
I believe that we should try to move more towards specific imports rather than 
import * or entire modules.  I would therefore prefer we do the OrderedDict 
change in the other direction and remove the collections.OrderedDict items.  
That being said, opinions... The code is still better with this change.

Reviewed-by: Jaben Carsey 

> -Original Message-
> From: Zhu, Yonghong
> Sent: Monday, August 13, 2018 1:12 AM
> To: edk2-devel@lists.01.org
> Cc: Gao, Liming ; Carsey, Jaben
> 
> Subject: [Patch V2] BaseTools: Clean up not used code in BuildClassObject
> Importance: High
> 
> V2: Add back "from Common.DataType import *"
> 
> 1. Remove some import statement that are not used.
> 2. Remove the Type value in the LibraryClassObject because we don't
> actually use it.
> 
> Cc: Liming Gao 
> Cc: Jaben Carsey 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Yonghong Zhu 
> ---
>  BaseTools/Source/Python/Workspace/BuildClassObject.py | 13 ++---
>  1 file changed, 2 insertions(+), 11 deletions(-)
> 
> diff --git a/BaseTools/Source/Python/Workspace/BuildClassObject.py
> b/BaseTools/Source/Python/Workspace/BuildClassObject.py
> index 3b47715..88465c5 100644
> --- a/BaseTools/Source/Python/Workspace/BuildClassObject.py
> +++ b/BaseTools/Source/Python/Workspace/BuildClassObject.py
> @@ -9,15 +9,10 @@
>  #
>  # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
> BASIS,
>  # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
> EXPRESS OR IMPLIED.
>  #
> 
> -import Common.LongFilePathOs as os
> -
> -from collections import OrderedDict
> -from Common.Misc import RealPath2
> -from Common.BuildToolError import *
>  from Common.DataType import *
>  import collections
> 
>  ## PcdClassObject
>  #
> @@ -251,22 +246,18 @@ class StructurePcd(PcdClassObject):
>  # This Class defines LibraryClassObject used in BuildDatabase
>  #
>  # @param object:  Inherited from object class
>  # @param Name:Input value for LibraryClassName, default is None
>  # @param SupModList:  Input value for SupModList, default is []
> -# @param Type:Input value for Type, default is None
>  #
>  # @var LibraryClass:  To store value for LibraryClass
>  # @var SupModList:To store value for SupModList
> -# @var Type:  To store value for Type
>  #
>  class LibraryClassObject(object):
> -def __init__(self, Name = None, SupModList = [], Type = None):
> +def __init__(self, Name = None, SupModList = []):
>  self.LibraryClass = Name
>  self.SupModList = SupModList
> -if Type is not None:
> -self.SupModList =
> CleanString(Type).split(DataType.TAB_SPACE_SPLIT)
> 
>  ## ModuleBuildClassObject
>  #
>  # This Class defines ModuleBuildClass
>  #
> @@ -330,11 +321,11 @@ class ModuleBuildClassObject(object):
>  self.ConstructorList = []
>  self.DestructorList  = []
> 
>  self.Binaries= []
>  self.Sources = []
> -self.LibraryClasses  = OrderedDict()
> +self.LibraryClasses  = collections.OrderedDict()
>  self.Libraries   = []
>  self.Protocols   = []
>  self.Ppis= []
>  self.Guids   = []
>  self.Includes= []
> --
> 2.6.1.windows.1

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


Re: [edk2] Question about SecurityPkg/DxeTcg2PhysicalPresenceLib

2018-08-14 Thread Laszlo Ersek
Hello Heyi,

(+ Marc-André and Stefan)

On 08/14/18 08:18, heyi@linaro.org wrote:
> Hi Jiewen,
>
> I searched the code in EDK2, and found there is another implementation
> of DxeTcg2PhysicalPresenceLib for OVMF: the function
> Tcg2PhysicalPresenceLibProcessRequest() is called in
> PlatformBootManagerAfterConsole() on OVMF, and it doesn't invoke
> VariableLockProtocol->RequestToLock() in
> Tcg2PhysicalPresenceLibProcessRequest().
>
> Is this also an reference solution? Does it have any drawback
> comparing with the implementation in SecurityPkg?

we didn't specifically intend the solution seen in OvmfPkg as a
"reference solution", but you are welcome to copy it if you wish.

With Marc-André and Stefan we had discussed the exact dependency problem
that you point out for a very long time. I have three comments on that
now.


(1) The answer that Jiewen gave you first (i.e., set up one trusted
console in the BeforeConsole PlatformBootManager hook) is documented in
the edk2 tree.

Unfortunately, it is not documented in the "PlatformBootManagerLib.h"
class header. But it is documented near the BeforeConsole call site in
BdsEntry() [MdeModulePkg/Universal/BdsDxe/BdsEntry.c]:

>   // Do the platform init, can be customized by OEM/IBV
>   // Possible things that can be done in PlatformBootManagerBeforeConsole:
>   // > Update console variable: 1. include hot-plug devices; 2. Clear ConIn 
> and add SOL for AMT
>   // > Register new Driver or Boot
>   // > Register new Key: e.g.: F12
>   // > Signal ReadyToLock event
>   // > Authentication action: 1. connect Auth devices; 2. Identify auto logon 
> user.
>   //
>   PERF_INMODULE_BEGIN("PlatformBootManagerBeforeConsole");
>   PlatformBootManagerBeforeConsole ();
>   PERF_INMODULE_END("PlatformBootManagerBeforeConsole");

See the "connect Auth devices" action.


(2) In a virtual machine especially, where the hardware configuration
might change from boot to boot, it's basically impossible to identify a
trusted console device for TPM / "physical presence" purposes. This is
why we needed a different solution for OvmfPkg.

The "trusted console before EndOfDxe" platform requirement is
impractical in general as well. To my understanding, the point of
processing (=confirming) the queued TPM2 PPI opcodes before EndOfDxe is
that 3rd-party UEFI drivers not interfere with their display and
acceptance. But, if you have a physical computer with only a USB
keyboard and a discrete PCIE GPU, then your *only* console, trusted or
not, is that pair of devices. For them to function together as a
console, the UEFI driver in the GPU option ROM has to be executed. And
that will only ever occur after EndOfDxe.

(BTW this example applies to virtual machines directly; you may have a
VM with an assigned (VFIO) GPU, and no other display device, not even a
serial port. In that case, no driver that is built into OVMF will let
you output anything to the screen.)


(3) The solution we chose can be read in the messages of the commits
that introduced (a) the Tcg2PhysicalPresenceLibProcessRequest()
implementation, (b) the call to the same, in OvmfPkg. (Just use
"git-blame".) Namely,

- b9777bb42e4f ("OvmfPkg: add Tcg2PhysicalPresenceLibQemu", 2018-05-22)

- 8d65d3b25e35 ("OvmfPkg/PlatformBootManagerLib: process TPM PPI
request", 2018-05-22)

In the first patch, all code related to TCG2_PHYSICAL_PRESENCE*_VARIABLE
are dropped from the library instance, because QEMU's virtual TPM device
provides a non-standard hardware mechanism for queueing PPI opcodes for
after reboot. This obviates the info channel through UEFI variables (and
eliminates a *huge* complication with ACPI code that enters SMM for
variable access, etc).

(Our understanding is that the *queueing* of PPI opcodes is not a
firmware-privileged operation (i.e. a privileged user at the OS level is
allowed to do it); only the interactive *confirmation* of the queued PPI
opcodes is firmware-privileged.)

In the second patch, the solution is to consider all consoles trusted,
and to rely on the user to enable Secure Boot. Then Secure Boot will
verify those 3rd-party UEFI drivers as well that are necessary for
setting up consoles. If an attacker manages to compromise the OS and to
queue some crafted PPI opcodes, the firmware will still faithfully ask
the user for confirming those (i.e. the attacker cannot hide or
mis-represent the queued PPI opcodes). Because, the drivers instrumental
to console setup are protected from instruction stream tampering with
Secure Boot. (They are not protected from data-attacks by SB, but
neither are DXE drivers that are built directly into the system
firmware.)

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


Re: [edk2] question about uefi calling convention

2018-08-14 Thread Laszlo Ersek
On 08/14/18 11:09, krishnaLee wrote:
> Hi,
> In uefi 2.6 specification -> 2.3.4 x64 Platforms,
> "Paging mode is enabled and any memory space defined by the UEFI memory map 
> is identity mapped (virtual address equals physical address)" ...
> is that mean if I write C code like " void *pointer=0xabcd",the pointer is 
> virtual address ,is equal to the physical address, and they are the same?

Yes.

> How the virtual address translate from "CR3->Page Base address,Page 
> directory,page table ..." to physical address in "x64 Long mode,64-bit mode"? 
> is there any sample not theory?

The page tables are built in the DXE IPL PEIM, function
CreateIdentityMappingPageTables().

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


Re: [edk2] DxeIpl module cannot find DXE entry point

2018-08-14 Thread Laszlo Ersek
On 08/14/18 14:00, Hristo Mihaylov wrote:
> Hello, Laszlo,
> 
> There is a PEIM that executes BuildFvHob with the FVMAIN_COMPACT address and 
> size, the function also exits normally.
> 
> The crash occurs here: 
> https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Core/DxeIplPeim/DxeLoad.c#L469
>  and the platform uses UDK2015 packages.
> I also updated the DxeIpl module to the latest UDK release, but that didn't 
> fix the issue.
> 
> Now I'm trying two approaches:
> 
> 1. to use a decompressed DXE and see if the issue was in the compression.
> 2. to enable source level debugging and track execution.
> 
> Any idea what else it could be, besides the BuildFvHob function? Or a way to 
> see if the HOB was built successfully.

Sorry, adding fine-grained debug messages (or source level debugging, as
you say) is my only thought at this point.

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


Re: [edk2] [Patch v3 1/5] UefiCpuPkg/PiSmmCpuDxeSmm: Use GDT/IDT saved in Smram.

2018-08-14 Thread Laszlo Ersek
On 08/13/18 03:54, Dong, Eric wrote:
> Hi Laszlo,
> 
>> -Original Message-
>> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
>> Laszlo Ersek
>> Sent: Friday, August 10, 2018 11:40 PM
>> To: Dong, Eric ; edk2-devel@lists.01.org
>> Cc: Ni, Ruiyu 
>> Subject: Re: [edk2] [Patch v3 1/5] UefiCpuPkg/PiSmmCpuDxeSmm: Use
>> GDT/IDT saved in Smram.
>>
>> On 08/10/18 06:19, Eric Dong wrote:
>>> Current implementation copies GDT/IDT at SmmReadyToLock point from
>>> ACPI NVS memory to Smram. Later at S3 resume phase, it restores memory
>>> saved in Smram to ACPI NVS. Driver can directly use GDT/IDT saved in
>>> Smram instead of restore the original ACPI NVS memory.
>>>
>>> This patch do this change.
>>>
>>> Test Done:
>>>   Do the OS boot and S3 resume test.
>>>
>>> Cc: Laszlo Ersek 
>>> Cc: Ruiyu Ni 
>>> Contributed-under: TianoCore Contribution Agreement 1.1
>>> Signed-off-by: Eric Dong 
>>> ---
>>>  UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c | 11 ---
>>>  1 file changed, 4 insertions(+), 7 deletions(-)
>>>
>>> diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c
>>> b/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c
>>> index 0b8ef70359..764d8276d3 100644
>>> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c
>>> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c
>>> @@ -448,13 +448,6 @@ PrepareApStartupVector (
>>>CopyMem ((VOID *) (UINTN) >GdtrProfile, (VOID *)
>> (UINTN) mAcpiCpuData.GdtrProfile, sizeof (IA32_DESCRIPTOR));
>>>CopyMem ((VOID *) (UINTN) >IdtrProfile, (VOID *)
>>> (UINTN) mAcpiCpuData.IdtrProfile, sizeof (IA32_DESCRIPTOR));
>>>
>>> -  //
>>> -  // Copy AP's GDT, IDT and Machine Check handler from SMRAM to ACPI
>>> NVS memory
>>> -  //
>>> -  CopyMem ((VOID *) mExchangeInfo->GdtrProfile.Base, mGdtForAp,
>>> mExchangeInfo->GdtrProfile.Limit + 1);
>>> -  CopyMem ((VOID *) mExchangeInfo->IdtrProfile.Base, mIdtForAp,
>>> mExchangeInfo->IdtrProfile.Limit + 1);
>>> -  CopyMem ((VOID *)(UINTN)
>> mAcpiCpuData.ApMachineCheckHandlerBase,
>>> mMachineCheckHandlerForAp,
>> mAcpiCpuData.ApMachineCheckHandlerSize);
>>> -
>>>mExchangeInfo->StackStart  = (VOID *) (UINTN)
>> mAcpiCpuData.StackAddress;
>>>mExchangeInfo->StackSize   = mAcpiCpuData.StackSize;
>>>mExchangeInfo->BufferStart = (UINT32) StartupVector; @@ -901,6
>>> +894,10 @@ GetAcpiCpuData (
>>>CopyMem (mGdtForAp, (VOID *)Gdtr->Base, Gdtr->Limit + 1);
>>>CopyMem (mIdtForAp, (VOID *)Idtr->Base, Idtr->Limit + 1);
>>>CopyMem (mMachineCheckHandlerForAp, (VOID
>>> *)(UINTN)mAcpiCpuData.ApMachineCheckHandlerBase,
>>> mAcpiCpuData.ApMachineCheckHandlerSize);
>>> +
>>> +  Gdtr->Base = (UINTN)mGdtForAp;
>>> +  Idtr->Base = (UINTN)mIdtForAp;
>>> +  mAcpiCpuData.ApMachineCheckHandlerBase =
>>> + (EFI_PHYSICAL_ADDRESS)(UINTN)mMachineCheckHandlerForAp;
>>>  }
>>>
>>>  /**
>>>
>>
>> This patch looks good to me (I'm ready to give R-b), but I think we can 
>> simplify
>> the code further. Can we replace the mGdtForAp, mIdtForAp and
>> mMachineCheckHandlerForAp global variables, with GdtForAp, IdtForAp and
>> MachineCheckHandlerForAp local variables, used only in the
>> GetAcpiCpuData() function?
>>
> 
> Agree to do this change in my next version change. Will send new patches 
> after finishing AllocateZeroPages related discussion.

OK, cool, thanks! I will test that version then.

Laszlo

> 
>> If you prefer to do that as an incremental patch, that's fine too.
>>
>> Thanks,
>> Laszlo
>> ___
>> 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 v3 3/5] UefiCpuPkg/CpuS3DataDxe: Change Memory Type and address limitation.

2018-08-14 Thread Laszlo Ersek
On 08/13/18 07:52, Ni, Ruiyu wrote:
> Ignore my previous mail.
> 
> You could use AllocatePages() instead of directly calling 
> gBS->AllocatePages().
> Then rename the AllocateBootServiceMemory() to AllocateZeroPages() to better
> reflect the function behavior.
> 
> Thanks/Ray
> 
>> -Original Message-
>> From: edk2-devel  On Behalf Of Ni, Ruiyu
>> Sent: Monday, August 13, 2018 1:39 PM
>> To: Dong, Eric ; Laszlo Ersek ;
>> edk2-devel@lists.01.org
>> Subject: Re: [edk2] [Patch v3 3/5] UefiCpuPkg/CpuS3DataDxe: Change
>> Memory Type and address limitation.
>>
>> Eric,
>> I think you could change:
>> AcpiCpuDataEx = AllocateBootServiceMemory (sizeof
>> (ACPI_CPU_DATA_EX));
>> ->
>> AcpiCpuDataEx = AllocatePages (EFI_SIZE_TO_PAGES (sizeof
>> (ACPI_CPU_DATA_EX)));
>>
>> So the AllocateBootServiceMemory() is not needed.
>>
>> Thanks/Ray
>>
>>> -Original Message-
>>> From: Dong, Eric
>>> Sent: Monday, August 13, 2018 9:51 AM
>>> To: Laszlo Ersek ; edk2-devel@lists.01.org
>>> Cc: Marvin Häuser ; Fan Jeff
>>> ; Ni, Ruiyu 
>>> Subject: RE: [Patch v3 3/5] UefiCpuPkg/CpuS3DataDxe: Change Memory
>>> Type and address limitation.
>>>
>>> Hi Laszlo,
>>>
>>> I checked the code base and don't find the API AllocateZeroPages (),

Sorry, I was misled by AllocateZeroPages() in
[IntelSiliconPkg/Feature/VTd/IntelVTdDxe/TranslationTable.c].

>>> and I agree to Zero the memory before using it. So I think update the
>>> original function is the best way now.

If you wouldn't like to do what Ray suggests, or you would like to do it
later / separately:

Reviewed-by: Laszlo Ersek 

because both of my earlier questions for this patch have been explained.

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


Re: [edk2] DxeIpl module cannot find DXE entry point

2018-08-14 Thread Hristo Mihaylov
Hello, Laszlo,

There is a PEIM that executes BuildFvHob with the FVMAIN_COMPACT address and 
size, the function also exits normally.

The crash occurs here: 
https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Core/DxeIplPeim/DxeLoad.c#L469
 and the platform uses UDK2015 packages.
I also updated the DxeIpl module to the latest UDK release, but that didn't fix 
the issue.

Now I'm trying two approaches:

1. to use a decompressed DXE and see if the issue was in the compression.
2. to enable source level debugging and track execution.

Any idea what else it could be, besides the BuildFvHob function? Or a way to 
see if the HOB was built successfully.

Regards,
Hristo Mihaylov

-Original Message-
From: Laszlo Ersek [mailto:ler...@redhat.com] 
Sent: 09 August 2018 18:41
To: Hristo Mihaylov ; 
edk2-devel@lists.01.org
Subject: Re: [edk2] DxeIpl module cannot find DXE entry point

On 08/09/18 14:14, Hristo Mihaylov wrote:
> Hello,
> 
> This is my first time posting to a mailing list. I am building a custom 
> platform that fails when handing off control from PEIM to DXE.
> 
> Here's the error:
> 
> ```
> ASSERT_EFI_ERROR (Status = Not Found)
> ASSERT 
> c:\users\hrimih\documents\work\scalable\bios\MdeModulePkg\Core\DxeIplP
> eim\DxeLoad.c(480): !EFI_ERROR (Status) ```
> 
> In the platform only the DXE phase is compressed, using LZMA. I suspect that 
> it's not being decompressed and the module cannot find the DXE entry point.
> 
> This is the relevant .FDF part.
> 
> ```
> [FV.FVMAIN]
> BlockSize  = 0x1
> FvAlignment= 16
> ERASE_POLARITY = 1
> MEMORY_MAPPED  = TRUE
> STICKY_WRITE   = TRUE
> LOCK_CAP   = TRUE
> LOCK_STATUS= TRUE
> WRITE_DISABLED_CAP = TRUE
> WRITE_ENABLED_CAP  = TRUE
> WRITE_STATUS   = TRUE
> WRITE_LOCK_CAP = TRUE
> WRITE_LOCK_STATUS  = TRUE
> READ_DISABLED_CAP  = TRUE
> READ_ENABLED_CAP   = TRUE
> READ_STATUS= TRUE
> READ_LOCK_CAP  = TRUE
> READ_LOCK_STATUS   = TRUE
> FvNameGuid = CDBB7B35-6833-4ed6-9AB2-57D2ACDDF6F0
> 
> 
> INF modules
> 
> 
> [FV.FVMAIN_COMPACT]
> FvAlignment= 16
> ERASE_POLARITY = 1
> MEMORY_MAPPED  = TRUE
> STICKY_WRITE   = TRUE
> LOCK_CAP   = TRUE
> LOCK_STATUS= TRUE
> WRITE_DISABLED_CAP = TRUE
> WRITE_ENABLED_CAP  = TRUE
> WRITE_STATUS   = TRUE
> WRITE_LOCK_CAP = TRUE
> WRITE_LOCK_STATUS  = TRUE
> READ_DISABLED_CAP  = TRUE
> READ_ENABLED_CAP   = TRUE
> READ_STATUS= TRUE
> READ_LOCK_CAP  = TRUE
> READ_LOCK_STATUS   = TRUE
> FvNameGuid = 27A72E80-3118-4c0c-8673-AA5B4EFA9613
> 
> FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 {
>   SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED = 
> TRUE {
> SECTION FV_IMAGE = FVMAIN
>   }
> }
> ```
> 
> Then in the .DSC I have:
> 
> ```
>   MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf {
> 
>   
> NULL|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompress
> Lib.inf
>  }
> ```
> 
> And for the DXE Main:
> 
> ```
>   MdeModulePkg/Core/Dxe/DxeMain.inf {
> 
>   DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
>   
> NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf
>   NULL| 
> MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
> 
>   gEfiMdePkgTokenSpaceGuid.PcdMaximumLinkedListLength|0
>   }
> ```
> 
> I expect that this PEIM module will decompress the DXE partition and find the 
> entry point:
> 
> ```
> DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.i
> DxeCoreEntryPoint|nf
> ```
> 
> Any advice on how I can debug/fix this?

Do you have a BuildFvHob() call in one of your PEIMs that exposes the base 
address and the size of the FVMAIN_COMPACT firmware volume?

That's usually done with PCDs, such as:

---
[FD.FooBar]
BaseAddress   = ...
Size  = ...
BlockSize = ...
NumBlocks = ...
...
|
PcdFvBaseAddress|PcdFvSize
FV = FVMAIN_COMPACT
---

And then in one of your PEIMs (usually the "platform" PEIM):

---
  BuildFvHob (PcdGet64 (PcdFvBaseAddress), PcdGet32 (PcdFvSize));
---

Because, your error message seems to come from the DxeIplFindDxeCore() 
function, after the PeiServicesFfsFindNextVolume() call fails. (I don't know 
what edk2 release you are using; the line number 480 doesn't match anything for 
me, but this is what I suspect anyway.)

And, PeiServicesFfsFindNextVolume() seems to work off of FV HOBs.

In the PI 1.6 spec, see Volume 1,
- 9 PEI to DXE Handoff
- 9.3 Passing the Hand-Off Block (HOB) List

"One or more Firmware Volume HOB(s)" are required; "The DXE Foundation needs 
this information to begin loading other drivers in the platform."

See also "5.7 Firmware Volume HOB" in Volume 3.

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


[edk2] question about uefi calling convention

2018-08-14 Thread krishnaLee
Hi,
In uefi 2.6 specification -> 2.3.4 x64 Platforms,
"Paging mode is enabled and any memory space defined by the UEFI memory map is 
identity mapped (virtual address equals physical address)" ...
is that mean if I write C code like " void *pointer=0xabcd",the pointer is 
virtual address ,is equal to the physical address, and they are the same?
How the virtual address translate from "CR3->Page Base address,Page 
directory,page table ..." to physical address in "x64 Long mode,64-bit mode"? 
is there any sample not theory?






thank you,
krishna.




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


[edk2] [PATCH edk2-platforms v2 43/43] Platform/Hisilicon/D0x: Update version string to 18.08

2018-08-14 Thread Ming Huang
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ming Huang 
---
 Platform/Hisilicon/D03/D03.dsc | 2 +-
 Platform/Hisilicon/D05/D05.dsc | 2 +-
 Platform/Hisilicon/D06/D06.dsc | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/Platform/Hisilicon/D03/D03.dsc b/Platform/Hisilicon/D03/D03.dsc
index c12790ba59..add15b7f93 100644
--- a/Platform/Hisilicon/D03/D03.dsc
+++ b/Platform/Hisilicon/D03/D03.dsc
@@ -174,7 +174,7 @@
   !ifdef $(FIRMWARE_VER)
 gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString|L"$(FIRMWARE_VER)"
   !else
-gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString|L"Development 
build 18.02 for Hisilicon D03"
+gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString|L"Development 
build 18.08 for Hisilicon D03"
   !endif
 
   gHisiTokenSpaceGuid.PcdBiosVersionString|L"10.01.01T18"
diff --git a/Platform/Hisilicon/D05/D05.dsc b/Platform/Hisilicon/D05/D05.dsc
index 94d386582e..76c0bd421e 100644
--- a/Platform/Hisilicon/D05/D05.dsc
+++ b/Platform/Hisilicon/D05/D05.dsc
@@ -192,7 +192,7 @@
   !ifdef $(FIRMWARE_VER)
 gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString|L"$(FIRMWARE_VER)"
   !else
-gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString|L"Development 
build 18.02 for Hisilicon D05"
+gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString|L"Development 
build 18.08 for Hisilicon D05"
   !endif
 
   gHisiTokenSpaceGuid.PcdBiosVersionString|L"10.01.01T18"
diff --git a/Platform/Hisilicon/D06/D06.dsc b/Platform/Hisilicon/D06/D06.dsc
index 544039e450..09197922ad 100644
--- a/Platform/Hisilicon/D06/D06.dsc
+++ b/Platform/Hisilicon/D06/D06.dsc
@@ -165,12 +165,12 @@
   !ifdef $(FIRMWARE_VER)
 gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString|L"$(FIRMWARE_VER)"
   !else
-gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString|L"Hisilicon D06 
UEFI RC0 - B308 (V0.38)"
+gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString|L"Development 
build 18.08 for Hisilicon D06"
   !endif
 
   gHisiTokenSpaceGuid.PcdBiosVersionString|L"10.01.01T18"
 
-  gHisiTokenSpaceGuid.PcdBiosVersionForBmc|L"0.38"
+  gHisiTokenSpaceGuid.PcdBiosVersionForBmc|L"0.42"
 
   gHisiTokenSpaceGuid.PcdSystemProductName|L"D06"
   gHisiTokenSpaceGuid.PcdSystemVersion|L"VER.A"
-- 
2.17.0

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


[edk2] [PATCH edk2-platforms v2 39/43] Silicon/Hisilicon/Setup: Support SPCR table switch

2018-08-14 Thread Ming Huang
If install SPCR table, KVM will not output while install or boot
some OS, like ubuntu, so add SPCR switch setup item and set it
disable by default.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ming Huang 
Signed-off-by: Heyi Guo 
---
 Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf |  1 +
 Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/UpdateAcpiTable.c   | 24 

 2 files changed, 25 insertions(+)

diff --git a/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf 
b/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf
index 281a4f2ebd..3d133aff85 100644
--- a/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf
+++ b/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf
@@ -51,6 +51,7 @@
 
 [Guids]
   gHisiEfiMemoryMapGuid
+  gOemConfigGuid
 
 [Pcd]
   gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiTableStorageFile## CONSUMES
diff --git a/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/UpdateAcpiTable.c 
b/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/UpdateAcpiTable.c
index 54f49977c3..32878ca4f9 100644
--- a/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/UpdateAcpiTable.c
+++ b/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/UpdateAcpiTable.c
@@ -16,8 +16,10 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
+#include 
 #include 
 
 #define CORECOUNT(X) ((X) * CORE_NUM_PER_SOCKET)
@@ -114,6 +116,25 @@ UpdateSlit (
   return  EFI_SUCCESS;
 }
 
+STATIC
+EFI_STATUS
+IsNeedSpcr (
+  IN OUT EFI_ACPI_DESCRIPTION_HEADER  *Table
+  )
+{
+  EFI_STATUS Status;
+  OEM_CONFIG_DATASetupData;
+  UINTN  DataSize = sizeof (OEM_CONFIG_DATA);
+
+  Status = gRT->GetVariable (OEM_CONFIG_NAME, , NULL, 
, );
+  if (!EFI_ERROR (Status) && (SetupData.EnableSpcr == FALSE)) {
+return EFI_ABORTED;
+  }
+
+  return EFI_SUCCESS;
+}
+
+
 EFI_STATUS
 UpdateAcpiTable (
   IN OUT EFI_ACPI_DESCRIPTION_HEADER  *TableHeader
@@ -130,6 +151,9 @@ UpdateAcpiTable (
   case EFI_ACPI_6_0_SYSTEM_LOCALITY_INFORMATION_TABLE_SIGNATURE:
 Status = UpdateSlit (TableHeader);
 break;
+  case EFI_ACPI_6_2_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE:
+Status = IsNeedSpcr (TableHeader);
+break;
   }
   return Status;
 }
-- 
2.17.0

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


[edk2] [PATCH edk2-platforms v2 42/43] Hisilicon/D06: Add edk2-non-osi Shell components

2018-08-14 Thread Ming Huang
Add Hisilicon Oem Shell libraries for some commands,such as
biosupdate, getmac, setmac, provision, acpistartos, brdinfo,
sfpinfo.

biosupdate example:
ifconfig -s eth2 static 192.168.2.68 255.255.255.0 192.168.2.1
biosupdate serverIp -u user -p password -f D06.fd -m master

acpistartos example:
ifconfig -s eth2 static 192.168.2.69 255.255.255.0 192.168.2.1
provision serverIp -u user -p password -f os\Image -a 0x8
2
provision serverIp -u user -p password -f os\minifs.cpio.gz -a 0x0700
2
acpistartos

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ming Huang 
---
 Silicon/Hisilicon/HisiPkg.dec  | 4 
 Platform/Hisilicon/D06/D06.dsc | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/Silicon/Hisilicon/HisiPkg.dec b/Silicon/Hisilicon/HisiPkg.dec
index 858b840a57..010d501914 100644
--- a/Silicon/Hisilicon/HisiPkg.dec
+++ b/Silicon/Hisilicon/HisiPkg.dec
@@ -39,6 +39,7 @@
   gPlatformSasProtocolGuid = {0x40e9829f, 0x3a2c, 0x479a, {0x9a, 0x93, 0x45, 
0x7d, 0x13, 0x50, 0x96, 0x5d}}
   gHisiPlatformSasProtocolGuid = {0x20e9829f, 0x3a2c, 0x479a, {0x9a, 0x93, 
0x45, 0x7d, 0x13, 0x50, 0x96, 0x6d}}
   gHisiSnpPlatformProtocolGuid = {0x81321f27, 0xff58, 0x4a1d, {0x99, 0x97, 
0xd, 0xcc, 0xfa, 0x82, 0xf4, 0x6f}}
+  gOemNicProtocolGuid = {0xb5903955, 0x31e9, 0x4aaf, {0xb2, 0x83, 0x7, 0x9f, 
0x3c, 0xc4, 0x71, 0x66}}
 
 [Guids]
   gHisiTokenSpaceGuid = {0xc8bc553e, 0x12bf, 0x11e6, {0x97, 0x4f, 0x87, 0xf7, 
0x7c, 0xfd, 0x52, 0x1d}}
@@ -49,6 +50,8 @@
   gHisiOemVariableGuid = {0xac62b9a5, 0x9939, 0x41d3, {0xff, 0x5c, 0xc5, 0x80, 
0x32, 0x7d, 0x9b, 0x29}}
   gOemBootVariableGuid = {0xb7784577, 0x5aaf, 0x4557, {0xa1, 0x99, 0xd4, 0xa4, 
0x2f, 0x45, 0x06, 0xf8}}
   gEfiHisiSocControllerGuid = {0xee369cc3, 0xa743, 0x5382, {0x75, 0x64, 0x53, 
0xe4, 0x31, 0x19, 0x38, 0x35}}
+  HisiShellSampleHiiGuid  = { 0x43859314, 0x82c1, 0x4592, { 0x8f, 0xf7, 0xc1, 
0xbd, 0xf3, 0xb2, 0x0e, 0xd5 }}
+  HisiPlatformShellSampleHiiGuid = { 0x7924a5de, 0xc600, 0x40d5, { 0x91, 0x10, 
0xf9, 0xc3, 0xe7, 0x25, 0x4d, 0x33 }}
 
 [LibraryClasses]
   PlatformSysCtrlLib|Include/Library/PlatformSysCtrlLib.h
@@ -101,6 +104,7 @@
   gHisiTokenSpaceGuid.PcdSlotPerChannelNum|0x0|UINT32|0x4004
 
   gHisiTokenSpaceGuid.PcdShellFile|{ 0x83, 0xA5, 0x04, 0x7C, 0x3E, 0x9E, 0x1C, 
0x4F, 0xAD, 0x65, 0xE0, 0x52, 0x68, 0xD0, 0xB4, 0xD1 }|VOID*|0x30006554
+  gHisiTokenSpaceGuid.PcdStartOsParameter|L""|VOID*|0x500
 
   #FDT File Address
   gHisiTokenSpaceGuid.FdtFileAddress|0x0|UINT64|0x4005
diff --git a/Platform/Hisilicon/D06/D06.dsc b/Platform/Hisilicon/D06/D06.dsc
index 053ea894d5..544039e450 100644
--- a/Platform/Hisilicon/D06/D06.dsc
+++ b/Platform/Hisilicon/D06/D06.dsc
@@ -473,6 +473,8 @@
 !if $(INCLUDE_DP) == TRUE
   NULL|ShellPkg/Library/UefiDpLib/UefiDpLib.inf
 !endif #$(INCLUDE_DP)
+  NULL|Silicon/Hisilicon/Library/HisiShellCmdLib/HisiShellCmdLib.inf
+  
NULL|Silicon/Hisilicon/Hi1620/Library/HisiD06ShellCmdLib/HisiD06ShellCmdLib.inf
 
 
   gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0xFF
-- 
2.17.0

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


[edk2] [PATCH edk2-platforms v2 41/43] Hisilicon/D06: Add PciPlatformLib

2018-08-14 Thread Ming Huang
Add a Null PciPlatformLib for build D06. The switch generic
PciHostBridge patch set add two api for PciPlatform driver,
so need to implement the two api for D06.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ming Huang 
---
 Platform/Hisilicon/D06/D06.dsc 
|  1 +
 Silicon/Hisilicon/Hi1620/Library/Hi1620PciPlatformLib/Hi1620PciPlatformLib.inf 
| 30 +
 Silicon/Hisilicon/Hi1620/Library/Hi1620PciPlatformLib/Hi1620PciPlatformLib.c   
| 67 
 3 files changed, 98 insertions(+)

diff --git a/Platform/Hisilicon/D06/D06.dsc b/Platform/Hisilicon/D06/D06.dsc
index fad6fcc747..053ea894d5 100644
--- a/Platform/Hisilicon/D06/D06.dsc
+++ b/Platform/Hisilicon/D06/D06.dsc
@@ -95,6 +95,7 @@
   FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf
 !endif
   PciExpressLib|MdePkg/Library/BasePciExpressLib/BasePciExpressLib.inf
+  
PciPlatformLib|Silicon/Hisilicon/Hi1620/Library/Hi1620PciPlatformLib/Hi1620PciPlatformLib.inf
 
 [LibraryClasses.common.SEC]
   
ArmPlatformLib|Silicon/Hisilicon/Library/ArmPlatformLibHisilicon/ArmPlatformLibSec.inf
diff --git 
a/Silicon/Hisilicon/Hi1620/Library/Hi1620PciPlatformLib/Hi1620PciPlatformLib.inf
 
b/Silicon/Hisilicon/Hi1620/Library/Hi1620PciPlatformLib/Hi1620PciPlatformLib.inf
new file mode 100644
index 00..7648322522
--- /dev/null
+++ 
b/Silicon/Hisilicon/Hi1620/Library/Hi1620PciPlatformLib/Hi1620PciPlatformLib.inf
@@ -0,0 +1,30 @@
+## @file
+# PCI Segment Library for Hisilicon Hi1610/Hi1616 SoC with multiple RCs
+#
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
+# Copyright (c) 2017 - 2018, Linaro Ltd. All rights reserved.
+# Copyright (c) 2018, Hisilicon Ltd. 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.
+#
+#
+##
+
+[Defines]
+  INF_VERSION= 0x0001001A
+  BASE_NAME  = Hi1620PciPlatformLib
+  FILE_GUID  = 29ba30da-68bc-46a5-888f-c65dabb67fd8
+  MODULE_TYPE= BASE
+  VERSION_STRING = 1.0
+  LIBRARY_CLASS  = PciPlatformLib
+
+[Sources]
+  Hi1620PciPlatformLib.c
+
+[Packages]
+  MdePkg/MdePkg.dec
diff --git 
a/Silicon/Hisilicon/Hi1620/Library/Hi1620PciPlatformLib/Hi1620PciPlatformLib.c 
b/Silicon/Hisilicon/Hi1620/Library/Hi1620PciPlatformLib/Hi1620PciPlatformLib.c
new file mode 100644
index 00..ff77974c0f
--- /dev/null
+++ 
b/Silicon/Hisilicon/Hi1620/Library/Hi1620PciPlatformLib/Hi1620PciPlatformLib.c
@@ -0,0 +1,67 @@
+/** @file
+*
+*  Copyright (c) 2018, Hisilicon Limited. All rights reserved.
+*  Copyright (c) 2018, Linaro Limited. 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 
+
+
+/*++
+
+Routine Description:
+
+  Perform Platform initialization first in PciPlatform.
+
+Arguments:
+
+Returns:
+
+ VOID.
+
+--*/
+VOID
+EFIAPI
+PciInitPlatform (
+  VOID
+  )
+{
+  return;
+}
+
+/*++
+
+Routine Description:
+
+  Perform Platform initialization by the phase indicated.
+
+Arguments:
+
+  HostBridge-  The associated PCI host bridge handle.
+  Phase -  The phase of the PCI controller enumeration.
+  ChipsetPhase  -  Defines the execution phase of the PCI chipset driver.
+
+Returns:
+
+--*/
+VOID
+EFIAPI
+PhaseNotifyPlatform (
+  IN  EFI_HANDLE HostBridge,
+  IN  EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PHASE  Phase,
+  IN  EFI_PCI_CHIPSET_EXECUTION_PHASEChipsetPhase
+  )
+{
+  return;
+}
+
-- 
2.17.0

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


[edk2] [PATCH edk2-platforms v2 38/43] Silicon/Hisilicon/D06: Add I2C Bus Exception handle function

2018-08-14 Thread Ming Huang
During the period of I2c accessing, if the board is reset
unexpectedly, and because the I2c client can not reset,
the SDA will be always pull down, then it cause I2C bus
Exception.

Follow the Hi1620 I2C FS chapter 1.8.2 design, add I2C
Bus Exception handle function. It will Config SCL and SDA
to GPIO, and set the reversal frequency of SCL to 10KHz.

The implementation of functions is in edk2-non-osi.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ming Huang 
---
 Silicon/Hisilicon/Include/Library/PlatformSysCtrlLib.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Silicon/Hisilicon/Include/Library/PlatformSysCtrlLib.h 
b/Silicon/Hisilicon/Include/Library/PlatformSysCtrlLib.h
index 3ccfc6bee3..a232e52ed7 100644
--- a/Silicon/Hisilicon/Include/Library/PlatformSysCtrlLib.h
+++ b/Silicon/Hisilicon/Include/Library/PlatformSysCtrlLib.h
@@ -106,4 +106,7 @@ VOID DisableClusterClock(UINTN CpuClusterBase);
 VOID EnableClusterClock(UINTN CpuClusterBase);
 VOID DisableSocketClock (UINT8 Skt);
 
+EFI_STATUS EFIAPI HandleI2CException (UINT32 Socket, UINT32 Port);
+EFI_STATUS EFIAPI HandleI2CExceptionBySocket (UINT32 Socket);
+
 #endif
-- 
2.17.0

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


[edk2] [PATCH edk2-platforms v2 40/43] Silicon/Hisilicon/setup: Support SMMU switch

2018-08-14 Thread Ming Huang
Select without SMMU iort while SMMU item is disable,
Select with SMMU iort while SMMU item is enable.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ming Huang 
---
 Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/UpdateAcpiTable.c | 88 

 1 file changed, 88 insertions(+)

diff --git a/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/UpdateAcpiTable.c 
b/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/UpdateAcpiTable.c
index 32878ca4f9..e0c29e0f57 100644
--- a/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/UpdateAcpiTable.c
+++ b/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/UpdateAcpiTable.c
@@ -24,6 +24,90 @@
 
 #define CORECOUNT(X) ((X) * CORE_NUM_PER_SOCKET)
 
+#define FIELD_IORT_NODE_OFFSET 40
+
+typedef enum {
+  NodeTypeIts = 0,
+  NodeTypeNameComponent,
+  NodeTypePciRC,
+  NodeTypeSmmuV1,
+  NodeTypeSmmuV3,
+  NodeTypePMCG
+} IORT_NODE_TYPE;
+
+#pragma pack(1)
+typedef struct {
+  UINT8   Type;
+  UINT16  Length;
+  UINT8   Revision;
+  UINT32  Reserved;
+  UINT32  IdMapNumber;
+  UINT32  IdArrayOffset;
+} IORT_NODE_HEAD;
+#pragma pack()
+
+BOOLEAN
+IsIortWithSmmu (
+  IN EFI_ACPI_DESCRIPTION_HEADER  *TableHeader
+  )
+{
+  UINT32   *NodeOffset;
+  UINT32   NextOffset;
+  IORT_NODE_HEAD   *Node;
+
+  NodeOffset = (UINT32 *)((UINT8 *)TableHeader + FIELD_IORT_NODE_OFFSET);
+  NextOffset = *NodeOffset;
+
+  while (NextOffset < TableHeader->Length) {
+Node = (IORT_NODE_HEAD *)((UINT8 *)TableHeader + NextOffset);
+NextOffset += Node->Length;
+
+if ((Node->Type == NodeTypeSmmuV1) || (Node->Type == NodeTypeSmmuV3)) {
+  return TRUE;
+}
+  }
+
+  return FALSE;
+}
+
+EFI_STATUS
+SelectIort (
+  IN EFI_ACPI_DESCRIPTION_HEADER  *TableHeader
+  )
+{
+  EFI_STATUS  Status;
+  UINTN   Size;
+  OEM_CONFIG_DATA Configuration;
+
+  Configuration.EnableSmmu = 0;
+  Size = sizeof (OEM_CONFIG_DATA);
+  Status = gRT->GetVariable (
+  OEM_CONFIG_NAME,
+  ,
+  NULL,
+  ,
+  
+  );
+  if (EFI_ERROR (Status)) {
+DEBUG ((DEBUG_ERROR, "Get OemConfig variable (%r).\n", Status));
+  }
+
+  Status =  EFI_SUCCESS;
+  if (IsIortWithSmmu (TableHeader)) {
+if (!Configuration.EnableSmmu) {
+  Status = EFI_ABORTED;
+}
+  } else {
+if (Configuration.EnableSmmu) {
+  Status = EFI_ABORTED;
+}
+  }
+  DEBUG ((DEBUG_INFO, "SmmuEnable=%x, return %r for Iort table.\n",
+  Configuration.EnableSmmu, Status));
+
+  return Status;
+}
+
 STATIC
 VOID
 RemoveUnusedMemoryNode (
@@ -151,6 +235,10 @@ UpdateAcpiTable (
   case EFI_ACPI_6_0_SYSTEM_LOCALITY_INFORMATION_TABLE_SIGNATURE:
 Status = UpdateSlit (TableHeader);
 break;
+
+  case EFI_ACPI_6_2_IO_REMAPPING_TABLE_SIGNATURE:
+Status = SelectIort (TableHeader);
+break;
   case EFI_ACPI_6_2_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE:
 Status = IsNeedSpcr (TableHeader);
 break;
-- 
2.17.0

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


[edk2] [PATCH edk2-platforms v2 36/43] Platform/Hisilicon/D06: Add capsule upgrade support

2018-08-14 Thread Ming Huang
This module support updating the boot CPU firmware only.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ming Huang 
---
 Platform/Hisilicon/D06/D06.dsc 
  | 14 
 Platform/Hisilicon/D06/D06.fdf 
  | 72 -
 
Platform/Hisilicon/D06/Drivers/SystemFirmwareDescriptor/SystemFirmwareDescriptor.inf
 | 50 
 
Platform/Hisilicon/D06/Drivers/SystemFirmwareDescriptor/SystemFirmwareDescriptorPei.c
| 70 +
 
Platform/Hisilicon/D06/Capsule/SystemFirmwareUpdateConfig/SystemFirmwareUpdateConfig.ini
 | 46 +++
 
Platform/Hisilicon/D06/Drivers/SystemFirmwareDescriptor/SystemFirmwareDescriptor.aslc
| 81 
 6 files changed, 332 insertions(+), 1 deletion(-)

diff --git a/Platform/Hisilicon/D06/D06.dsc b/Platform/Hisilicon/D06/D06.dsc
index 9550e0d497..fad6fcc747 100644
--- a/Platform/Hisilicon/D06/D06.dsc
+++ b/Platform/Hisilicon/D06/D06.dsc
@@ -121,6 +121,11 @@
   gHisiTokenSpaceGuid.PcdIsItsSupported|TRUE
   gArmTokenSpaceGuid.PcdArmGicV3WithV2Legacy|FALSE
   gEfiMdeModulePkgTokenSpaceGuid.PcdHiiOsRuntimeSupport|FALSE
+[PcdsDynamicExDefault.common.DEFAULT]
+  
gEfiSignedCapsulePkgTokenSpaceGuid.PcdEdkiiSystemFirmwareImageDescriptor|{0x0}|VOID*|0x100
+  gEfiMdeModulePkgTokenSpaceGuid.PcdSystemFmpCapsuleImageTypeIdGuid|{0x29, 
0x3d, 0x4b, 0xd3, 0x85, 0x00, 0xb3, 0x4a, 0x8b, 0xe8, 0x84, 0x18, 0x8c, 0xc5, 
0x04, 0x89}
+  gEfiSignedCapsulePkgTokenSpaceGuid.PcdEdkiiSystemFirmwareFileGuid|{0xcf, 
0x4f, 0x2e, 0x64, 0xf7, 0x2d, 0x15, 0x44, 0x8b, 0x70, 0xa0, 0x39, 0x09, 0xc5, 
0x7b, 0x55}
+
 
 [PcdsFixedAtBuild.common]
   gArmPlatformTokenSpaceGuid.PcdCoreCount|48
@@ -266,6 +271,7 @@
   Platform/Hisilicon/D06/EarlyConfigPeim/EarlyConfigPeimD06.inf
   Silicon/Hisilicon/Drivers/VersionInfoPeim/VersionInfoPeim.inf
 
+  
Platform/Hisilicon/D06/Drivers/SystemFirmwareDescriptor/SystemFirmwareDescriptor.inf
   MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf {
 
   
NULL|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
@@ -386,6 +392,8 @@
   MdeModulePkg/Bus/Pci/SataControllerDxe/SataControllerDxe.inf
   MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.inf
   MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBusDxe.inf
+  SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareReportDxe.inf
+  MdeModulePkg/Universal/EsrtDxe/EsrtDxe.inf
   #
   # FAT filesystem + GPT/MBR partitioning
   #
@@ -434,6 +442,12 @@
   MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
   MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
   MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
+  SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareUpdateDxe.inf {
+
+  
FmpAuthenticationLib|SecurityPkg/Library/FmpAuthenticationLibPkcs7/FmpAuthenticationLibPkcs7.inf
+  }
+
+  MdeModulePkg/Application/CapsuleApp/CapsuleApp.inf
 
   #
   # UEFI application (Shell Embedded Boot Loader)
diff --git a/Platform/Hisilicon/D06/D06.fdf b/Platform/Hisilicon/D06/D06.fdf
index 90379b8558..8c3f4f9932 100644
--- a/Platform/Hisilicon/D06/D06.fdf
+++ b/Platform/Hisilicon/D06/D06.fdf
@@ -308,7 +308,9 @@ READ_LOCK_STATUS   = TRUE
   INF MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBusDxe.inf
 
   INF 
Silicon/Hisilicon/Hi1620/Drivers/Pl011DebugSerialPortInitDxe/Pl011DebugSerialPortInitDxe.inf
-  INF MdeModulePkg/Universal/Network/SnpDxe/SnpDxe.inf
+  INF 
SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareReportDxe.inf
+  INF MdeModulePkg/Universal/EsrtDxe/EsrtDxe.inf
+
   #
   # Build Shell from latest source code instead of prebuilt binary
   #
@@ -364,11 +366,79 @@ READ_LOCK_STATUS   = TRUE
 
   INF MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf
 
+  INF RuleOverride = FMP_IMAGE_DESC 
Platform/Hisilicon/D06/Drivers/SystemFirmwareDescriptor/SystemFirmwareDescriptor.inf
   FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 {
 SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED = 
TRUE {
   SECTION FV_IMAGE = FVMAIN
 }
   }
+[FV.CapsuleDispatchFv]
+FvAlignment= 16
+ERASE_POLARITY = 1
+MEMORY_MAPPED  = TRUE
+STICKY_WRITE   = TRUE
+LOCK_CAP   = TRUE
+LOCK_STATUS= TRUE
+WRITE_DISABLED_CAP = TRUE
+WRITE_ENABLED_CAP  = TRUE
+WRITE_STATUS   = TRUE
+WRITE_LOCK_CAP = TRUE
+WRITE_LOCK_STATUS  = TRUE
+READ_DISABLED_CAP  = TRUE
+READ_ENABLED_CAP   = TRUE
+READ_STATUS= TRUE
+READ_LOCK_CAP  = TRUE
+READ_LOCK_STATUS   = TRUE
+
+  INF 
SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareUpdateDxe.inf
+
+[FV.SystemFirmwareUpdateCargo]
+FvAlignment= 16
+ERASE_POLARITY = 1
+MEMORY_MAPPED  = TRUE
+STICKY_WRITE   = TRUE
+LOCK_CAP   = TRUE
+LOCK_STATUS= TRUE
+WRITE_DISABLED_CAP = TRUE
+WRITE_ENABLED_CAP  = TRUE
+WRITE_STATUS   = TRUE
+WRITE_LOCK_CAP = TRUE
+WRITE_LOCK_STATUS  = TRUE
+READ_DISABLED_CAP  = TRUE

[edk2] [PATCH edk2-platforms v2 37/43] Silicon/Hisilicon/D06: Modify for close slave core clock.

2018-08-14 Thread Ming Huang
From: ZhenYao 

When BIOS booting, the power consumption is too high, so need close
some clusters clock that don't work to reduce power consumption.

The implementation of functions is in edk2-non-osi.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: ZhenYao 
---
 Silicon/Hisilicon/Include/Library/PlatformSysCtrlLib.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Silicon/Hisilicon/Include/Library/PlatformSysCtrlLib.h 
b/Silicon/Hisilicon/Include/Library/PlatformSysCtrlLib.h
index ec2b9a36e7..3ccfc6bee3 100644
--- a/Silicon/Hisilicon/Include/Library/PlatformSysCtrlLib.h
+++ b/Silicon/Hisilicon/Include/Library/PlatformSysCtrlLib.h
@@ -102,5 +102,8 @@ VOID PlatformEventBroadcastConfig(VOID);
 UINTN GetDjtagRegBase(UINT32 NodeId);
 VOID LlcCleanInvalidateAsm(VOID);
 VOID PlatformMdioInit(VOID);
+VOID DisableClusterClock(UINTN CpuClusterBase);
+VOID EnableClusterClock(UINTN CpuClusterBase);
+VOID DisableSocketClock (UINT8 Skt);
 
 #endif
-- 
2.17.0

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


[edk2] [PATCH edk2-platforms v2 31/43] Hisilicon/D0x: Update SMBIOS type9 info

2018-08-14 Thread Ming Huang
From: Sun Yuanchen 

Move board level code to OemMiscLibD0x for unifying D0x.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Sun Yuanchen 
---
 Platform/Hisilicon/D03/Library/OemMiscLib2P/OemMiscLib2PHi1610.inf |  1 +
 Platform/Hisilicon/D05/Library/OemMiscLibD05/OemMiscLibD05.inf |  1 +
 Platform/Hisilicon/D06/Library/OemMiscLibD06/OemMiscLibD06.inf |  4 +
 Platform/Hisilicon/D06/Include/Library/CpldD06.h   |  2 +
 Silicon/Hisilicon/Include/Library/OemMiscLib.h |  1 +
 Platform/Hisilicon/D03/Library/OemMiscLib2P/OemMiscLib2PHi1610.c   | 24 ++
 Platform/Hisilicon/D05/Library/OemMiscLibD05/OemMiscLibD05.c   | 27 +-
 Platform/Hisilicon/D06/Library/OemMiscLibD06/OemMiscLibD06.c   | 90 

 Silicon/Hisilicon/Drivers/Smbios/AddSmbiosType9/AddSmbiosType9.c   | 14 +--
 9 files changed, 151 insertions(+), 13 deletions(-)

diff --git a/Platform/Hisilicon/D03/Library/OemMiscLib2P/OemMiscLib2PHi1610.inf 
b/Platform/Hisilicon/D03/Library/OemMiscLib2P/OemMiscLib2PHi1610.inf
index 310bbaea84..0fa7fdf80f 100644
--- a/Platform/Hisilicon/D03/Library/OemMiscLib2P/OemMiscLib2PHi1610.inf
+++ b/Platform/Hisilicon/D03/Library/OemMiscLib2P/OemMiscLib2PHi1610.inf
@@ -34,6 +34,7 @@
   Silicon/Hisilicon/HisiPkg.dec
 
 [LibraryClasses]
+  BaseMemoryLib
   PcdLib
   TimerLib
 
diff --git a/Platform/Hisilicon/D05/Library/OemMiscLibD05/OemMiscLibD05.inf 
b/Platform/Hisilicon/D05/Library/OemMiscLibD05/OemMiscLibD05.inf
index bf44ff7440..022c3e940a 100644
--- a/Platform/Hisilicon/D05/Library/OemMiscLibD05/OemMiscLibD05.inf
+++ b/Platform/Hisilicon/D05/Library/OemMiscLibD05/OemMiscLibD05.inf
@@ -33,6 +33,7 @@
   Silicon/Hisilicon/HisiPkg.dec
 
 [LibraryClasses]
+  BaseMemoryLib
   PcdLib
   TimerLib
 
diff --git a/Platform/Hisilicon/D06/Library/OemMiscLibD06/OemMiscLibD06.inf 
b/Platform/Hisilicon/D06/Library/OemMiscLibD06/OemMiscLibD06.inf
index 8f68f7cec5..bd984a6fe3 100644
--- a/Platform/Hisilicon/D06/Library/OemMiscLibD06/OemMiscLibD06.inf
+++ b/Platform/Hisilicon/D06/Library/OemMiscLibD06/OemMiscLibD06.inf
@@ -30,9 +30,13 @@
   ArmPkg/ArmPkg.dec
   MdeModulePkg/MdeModulePkg.dec
   MdePkg/MdePkg.dec
+  Platform/Hisilicon/D06/D06.dec
   Silicon/Hisilicon/HisiPkg.dec
 
 [LibraryClasses]
+  BaseMemoryLib
+  CpldIoLib
+  IoLib
   PcdLib
   SerdesLib
   TimerLib
diff --git a/Platform/Hisilicon/D06/Include/Library/CpldD06.h 
b/Platform/Hisilicon/D06/Include/Library/CpldD06.h
index be3548c8d1..ec9b49f4e7 100644
--- a/Platform/Hisilicon/D06/Include/Library/CpldD06.h
+++ b/Platform/Hisilicon/D06/Include/Library/CpldD06.h
@@ -29,6 +29,8 @@
 #define CPLD_LOGIC_COMPILE_DAY   (0x3)
 
 #define CPLD_RISER_PRSNT_FLAG 0x40
+#define CPU1_RISER_PRESENTBIT6
+#define CPU0_RISER_PRESENTBIT7
 #define CPLD_RISER2_BOARD_ID  0x44
 
 #define CPLD_X8_X8_X8_BOARD_ID0x92
diff --git a/Silicon/Hisilicon/Include/Library/OemMiscLib.h 
b/Silicon/Hisilicon/Include/Library/OemMiscLib.h
index efecb9aa77..86ea6a1b3d 100644
--- a/Silicon/Hisilicon/Include/Library/OemMiscLib.h
+++ b/Silicon/Hisilicon/Include/Library/OemMiscLib.h
@@ -34,6 +34,7 @@ typedef struct _REPORT_PCIEDIDVID2BMC{
 UINTN   Slot;
 }REPORT_PCIEDIDVID2BMC;
 extern REPORT_PCIEDIDVID2BMC PcieDeviceToReport[PCIEDEVICE_REPORT_MAX];
+extern VOID GetPciDidVid (REPORT_PCIEDIDVID2BMC *Report);
 
 BOOLEAN OemIsSocketPresent (UINTN Socket);
 VOID CoreSelectBoot(VOID);
diff --git a/Platform/Hisilicon/D03/Library/OemMiscLib2P/OemMiscLib2PHi1610.c 
b/Platform/Hisilicon/D03/Library/OemMiscLib2P/OemMiscLib2PHi1610.c
index fa1039bda1..c80500276f 100644
--- a/Platform/Hisilicon/D03/Library/OemMiscLib2P/OemMiscLib2PHi1610.c
+++ b/Platform/Hisilicon/D03/Library/OemMiscLib2P/OemMiscLib2PHi1610.c
@@ -15,6 +15,7 @@
 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -31,6 +32,29 @@ REPORT_PCIEDIDVID2BMC  
PcieDeviceToReport[PCIEDEVICE_REPORT_MAX] = {
   {0x,0x,0x,0x}
 };
 
+REPORT_PCIEDIDVID2BMC PcieDeviceToReport_2P[PCIEDEVICE_REPORT_MAX] = {
+  {0x79,0,0,0},
+  {0xFF,0xFF,0xFF,1},
+  {0xC1,0,0,2},
+  {0xF9,0,0,3},
+  {0xFF,0xFF,0xFF,4},
+  {0x11,0,0,5},
+  {0x31,0,0,6},
+  {0x21,0,0,7}
+};
+
+VOID
+GetPciDidVid (
+  REPORT_PCIEDIDVID2BMC *Report
+  )
+{
+  if (OemIsMpBoot ()) {
+(VOID)CopyMem ((VOID *)Report, (VOID *)PcieDeviceToReport_2P, sizeof 
(PcieDeviceToReport_2P));
+  } else {
+(VOID)CopyMem ((VOID *)Report, (VOID *)PcieDeviceToReport, sizeof 
(PcieDeviceToReport));
+  }
+}
+
 // Right now we only support 1P
 BOOLEAN OemIsSocketPresent (UINTN Socket)
 {
diff --git a/Platform/Hisilicon/D05/Library/OemMiscLibD05/OemMiscLibD05.c 
b/Platform/Hisilicon/D05/Library/OemMiscLibD05/OemMiscLibD05.c
index b17eeada16..4c4c944dbe 100644
--- a/Platform/Hisilicon/D05/Library/OemMiscLibD05/OemMiscLibD05.c
+++ b/Platform/Hisilicon/D05/Library/OemMiscLibD05/OemMiscLibD05.c
@@ -1,7 +1,7 @@
 /** @file
 *
-*  Copyright 

[edk2] [PATCH edk2-platforms v2 35/43] Silicon/Hisilicon/D06: Add some Lpc macro to LpcLib.h

2018-08-14 Thread Ming Huang
Add some Lpc macro to LpcLib.h for D06.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ming Huang 
---
 Silicon/Hisilicon/Include/Library/LpcLib.h | 51 +++-
 1 file changed, 49 insertions(+), 2 deletions(-)

diff --git a/Silicon/Hisilicon/Include/Library/LpcLib.h 
b/Silicon/Hisilicon/Include/Library/LpcLib.h
index 236a52ba45..5cf08ccde1 100755
--- a/Silicon/Hisilicon/Include/Library/LpcLib.h
+++ b/Silicon/Hisilicon/Include/Library/LpcLib.h
@@ -1,7 +1,7 @@
 /** @file
 *
-*  Copyright (c) 2016, Hisilicon Limited. All rights reserved.
-*  Copyright (c) 2016, Linaro Limited. All rights reserved.
+*  Copyright (c) 2016-2018, Hisilicon Limited. All rights reserved.
+*  Copyright (c) 2016-2018, Linaro Limited. All rights reserved.
 *
 *  This program and the accompanying materials
 *  are licensed and made available under the terms and conditions of the BSD 
License
@@ -18,6 +18,53 @@
 
 #include 
 
+#define PCIE_SUBSYS_IOMUX   0x20110
+#define PCIE_SUBSYS_IOMG019 (PCIE_SUBSYS_IOMUX + 0x48)
+#define PCIE_SUBSYS_IOMG020 (PCIE_SUBSYS_IOMUX + 0x4C)
+#define PCIE_SUBSYS_IOMG021 (PCIE_SUBSYS_IOMUX + 0x50)
+#define PCIE_SUBSYS_IOMG022 (PCIE_SUBSYS_IOMUX + 0x54)
+#define PCIE_SUBSYS_IOMG023 (PCIE_SUBSYS_IOMUX + 0x58)
+#define PCIE_SUBSYS_IOMG024 (PCIE_SUBSYS_IOMUX + 0x5C)
+#define PCIE_SUBSYS_IOMG025 (PCIE_SUBSYS_IOMUX + 0x60)
+#define PCIE_SUBSYS_IOMG028 (PCIE_SUBSYS_IOMUX + 0x6C)
+
+#define IO_MGMT_SUBCTRL_BASE0x20107
+#define SC_LPC_RESET_REQ_REG(IO_MGMT_SUBCTRL_BASE + 0x0a58)
+#define SC_LPC_RESET_DREQ_REG   (IO_MGMT_SUBCTRL_BASE + 0x0a5c)
+#define SC_LPC_SEL  (IO_MGMT_SUBCTRL_BASE + 0x2400)
+
+
+#define LPCD06_BASE 0x20119
+#define LPC_FIRM_SPACE0_CFG (LPCD06_BASE + 0x100)
+#define LPC_FIRM_SPACE1_CFG (LPCD06_BASE + 0x104)
+#define LPC_FIRM_SPACE2_CFG (LPCD06_BASE + 0x108)
+#define LPC_FIRM_SPACE3_CFG (LPCD06_BASE + 0x10C)
+#define LPC_FIRM_SPACE4_CFG (LPCD06_BASE + 0x110)
+#define LPC_FIRM_SPACE5_CFG (LPCD06_BASE + 0x114)
+#define LPC_FIRM_SPACE6_CFG (LPCD06_BASE + 0x118)
+#define LPC_FIRM_SPACE7_CFG (LPCD06_BASE + 0x11C)
+#define LPC_MEM_SPACE0_CFG  (LPCD06_BASE + 0x120)
+#define LPC_MEM_SPACE1_CFG  (LPCD06_BASE + 0x124)
+#define LPC_MEM_SPACE2_CFG  (LPCD06_BASE + 0x128)
+#define LPC_MEM_SPACE3_CFG  (LPCD06_BASE + 0x12C)
+#define LPC_MEM_SPACE4_CFG  (LPCD06_BASE + 0x130)
+#define LPC_MEM_SPACE5_CFG  (LPCD06_BASE + 0x134)
+#define LPC_MEM_SPACE6_CFG  (LPCD06_BASE + 0x138)
+
+#define LPCD06_START_REG(LPCD06_BASE + 0x00)
+#define LPCD06_OP_STATUS_REG(LPCD06_BASE + 0x04)
+#define LPCD06_IRQ_ST_REG   (LPCD06_BASE + 0x08)
+#define LPCD06_OP_LEN_REG   (LPCD06_BASE + 0x10)
+#define LPCD06_CMD_REG  (LPCD06_BASE + 0x14)
+#define LPCD06_ADDR_REG (LPCD06_BASE + 0x20)
+#define LPCD06_WDATA_REG(LPCD06_BASE + 0x24)
+#define LPCD06_RDATA_REG(LPCD06_BASE + 0x28)
+
+#define LPC_SIRQ_CTR0   (LPCD06_BASE + 0x80)
+#define LPC_SIRQ_CTR1   (LPCD06_BASE + 0x84)
+#define LPC_SIRQ_INT_MASK   (LPCD06_BASE + 0x94)
+
+
 #define PCIE_SUBSYS_IO_MUX  0xA017
 #define PCIE_SUBSYS_IOMG033 (PCIE_SUBSYS_IO_MUX + 0x84)
 #define PCIE_SUBSYS_IOMG035 (PCIE_SUBSYS_IO_MUX + 0x8C)
-- 
2.17.0

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


[edk2] [PATCH edk2-platforms v2 33/43] Platform/Hisilicon/D06: Add PciHostBridgeLib

2018-08-14 Thread Ming Huang
PciHostBridgeLib which is need by PciHostBridgeDxe, provide
root bridges and deal with resource conflict.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ming Huang 
---
 Platform/Hisilicon/D06/D06.dsc   |   2 +-
 Platform/Hisilicon/D06/Library/PciHostBridgeLib/PciHostBridgeLib.inf |  36 ++
 Platform/Hisilicon/D06/Library/PciHostBridgeLib/PciHostBridgeLib.c   | 635 

 3 files changed, 672 insertions(+), 1 deletion(-)

diff --git a/Platform/Hisilicon/D06/D06.dsc b/Platform/Hisilicon/D06/D06.dsc
index 3de09ea870..c6de9f04ad 100644
--- a/Platform/Hisilicon/D06/D06.dsc
+++ b/Platform/Hisilicon/D06/D06.dsc
@@ -418,7 +418,7 @@
 
   
PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.inf
   PciLib|MdePkg/Library/BasePciLibPciExpress/BasePciLibPciExpress.inf
-  
PciHostBridgeLib|MdeModulePkg/Library/PciHostBridgeLibNull/PciHostBridgeLibNull.inf
+  
PciHostBridgeLib|Platform/Hisilicon/D06/Library/PciHostBridgeLib/PciHostBridgeLib.inf
   }
 
   MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
diff --git 
a/Platform/Hisilicon/D06/Library/PciHostBridgeLib/PciHostBridgeLib.inf 
b/Platform/Hisilicon/D06/Library/PciHostBridgeLib/PciHostBridgeLib.inf
new file mode 100644
index 00..8a998681a3
--- /dev/null
+++ b/Platform/Hisilicon/D06/Library/PciHostBridgeLib/PciHostBridgeLib.inf
@@ -0,0 +1,36 @@
+## @file
+#
+#  Copyright (c) 2018, Hisilicon Limited. All rights reserved.
+#  Copyright (c) 2018, Linaro Limited. 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.
+#
+#
+##
+
+[Defines]
+  INF_VERSION= 0x0001001A
+  BASE_NAME  = PciHostBridgeLib
+  FILE_GUID  = 61b7276a-fc67-11e5-82fd-47ea9896dd5d
+  MODULE_TYPE= DXE_DRIVER
+  VERSION_STRING = 1.0
+  LIBRARY_CLASS  = PciHostBridgeLib|DXE_DRIVER
+
+[Sources]
+  PciHostBridgeLib.c
+
+[Packages]
+  MdeModulePkg/MdeModulePkg.dec
+  MdePkg/MdePkg.dec
+
+[LibraryClasses]
+  BaseLib
+  DebugLib
+  DevicePathLib
+  MemoryAllocationLib
+  UefiBootServicesTableLib
diff --git a/Platform/Hisilicon/D06/Library/PciHostBridgeLib/PciHostBridgeLib.c 
b/Platform/Hisilicon/D06/Library/PciHostBridgeLib/PciHostBridgeLib.c
new file mode 100644
index 00..d1a436d9bc
--- /dev/null
+++ b/Platform/Hisilicon/D06/Library/PciHostBridgeLib/PciHostBridgeLib.c
@@ -0,0 +1,635 @@
+/** @file
+
+  Copyright (c) 2018, Hisilicon Limited. All rights reserved.
+  Copyright (c) 2018, Linaro Limited. 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 
+
+#define ENUM_HB_NUM 8
+
+#define EFI_PCI_SUPPORT   (EFI_PCI_ATTRIBUTE_ISA_MOTHERBOARD_IO | \
+   EFI_PCI_ATTRIBUTE_IDE_SECONDARY_IO | \
+   EFI_PCI_ATTRIBUTE_IDE_PRIMARY_IO | \
+   EFI_PCI_ATTRIBUTE_ISA_IO_16  | \
+   EFI_PCI_ATTRIBUTE_VGA_MEMORY | \
+   EFI_PCI_ATTRIBUTE_VGA_IO_16  | \
+   EFI_PCI_ATTRIBUTE_VGA_PALETTE_IO_16)
+
+#define EFI_PCI_ATTRIBUTE  EFI_PCI_SUPPORT
+
+#pragma pack(1)
+typedef struct {
+  ACPI_HID_DEVICE_PATH AcpiDevicePath;
+  EFI_DEVICE_PATH_PROTOCOL EndDevicePath;
+} EFI_PCI_ROOT_BRIDGE_DEVICE_PATH;
+#pragma pack ()
+
+STATIC EFI_PCI_ROOT_BRIDGE_DEVICE_PATH mEfiPciRootBridgeDevicePath 
[ENUM_HB_NUM] = {
+//Host Bridge 0
+  {
+{
+  {
+ACPI_DEVICE_PATH,
+ACPI_DP,
+{
+  (UINT8)sizeof (ACPI_HID_DEVICE_PATH),
+  (UINT8)(sizeof (ACPI_HID_DEVICE_PATH) >> 8)
+}
+  },
+  EISA_PNP_ID(0x0A03), // PCI
+  0
+},
+{
+  END_DEVICE_PATH_TYPE,
+  END_ENTIRE_DEVICE_PATH_SUBTYPE,
+  {
+END_DEVICE_PATH_LENGTH,
+0
+  }
+}
+  },
+
+//Host Bridge 2
+  {
+{
+  {
+ACPI_DEVICE_PATH,
+ACPI_DP,
+{
+  (UINT8)sizeof (ACPI_HID_DEVICE_PATH),
+  (UINT8)(sizeof (ACPI_HID_DEVICE_PATH) >> 8)
+}
+  },
+  EISA_PNP_ID(0x0A04), // PCI
+  0
+},
+{

[edk2] [PATCH edk2-platforms v2 32/43] Platform/Hisilicon/D06: Add EarlyConfigPeim peim

2018-08-14 Thread Ming Huang
This peim configuare SMMU,BSP,MN(Miscellaneous Node).

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ming Huang 
---
 Platform/Hisilicon/D06/D06.dsc|   1 +
 Platform/Hisilicon/D06/D06.fdf|   1 +
 Platform/Hisilicon/D06/EarlyConfigPeim/EarlyConfigPeimD06.inf |  50 +
 Silicon/Hisilicon/Include/Library/OemAddressMapLib.h  |   2 +
 Platform/Hisilicon/D06/EarlyConfigPeim/EarlyConfigPeimD06.c   | 107 

 5 files changed, 161 insertions(+)

diff --git a/Platform/Hisilicon/D06/D06.dsc b/Platform/Hisilicon/D06/D06.dsc
index 5571028f42..3de09ea870 100644
--- a/Platform/Hisilicon/D06/D06.dsc
+++ b/Platform/Hisilicon/D06/D06.dsc
@@ -263,6 +263,7 @@
   MdeModulePkg/Universal/FaultTolerantWritePei/FaultTolerantWritePei.inf
   MdeModulePkg/Universal/Variable/Pei/VariablePei.inf
 
+  Platform/Hisilicon/D06/EarlyConfigPeim/EarlyConfigPeimD06.inf
   Silicon/Hisilicon/Drivers/VersionInfoPeim/VersionInfoPeim.inf
 
   MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf {
diff --git a/Platform/Hisilicon/D06/D06.fdf b/Platform/Hisilicon/D06/D06.fdf
index 184d5d4dcf..bd3ea47226 100644
--- a/Platform/Hisilicon/D06/D06.fdf
+++ b/Platform/Hisilicon/D06/D06.fdf
@@ -359,6 +359,7 @@ READ_LOCK_STATUS   = TRUE
   INF ArmPkg/Drivers/CpuPei/CpuPei.inf
   INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf
   INF IntelFrameworkModulePkg/Universal/StatusCode/Pei/StatusCodePei.inf
+  INF Platform/Hisilicon/D06/EarlyConfigPeim/EarlyConfigPeimD06.inf
 
   INF MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf
 
diff --git a/Platform/Hisilicon/D06/EarlyConfigPeim/EarlyConfigPeimD06.inf 
b/Platform/Hisilicon/D06/EarlyConfigPeim/EarlyConfigPeimD06.inf
new file mode 100644
index 00..8296ee02de
--- /dev/null
+++ b/Platform/Hisilicon/D06/EarlyConfigPeim/EarlyConfigPeimD06.inf
@@ -0,0 +1,50 @@
+#/** @file
+#
+#Copyright (c) 2018, Hisilicon Limited. All rights reserved.
+#Copyright (c) 2017, Linaro Limited. 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.
+#
+#**/
+
+
+[Defines]
+  INF_VERSION= 0x0001001A
+  BASE_NAME  = EarlyConfigPeimD06
+  FILE_GUID  = FB8C65EB-0199-40C3-A82B-029921A9E9B3
+  MODULE_TYPE= PEIM
+  VERSION_STRING = 1.0
+  ENTRY_POINT= EarlyConfigEntry
+
+[Sources.common]
+  EarlyConfigPeimD06.c
+
+[Packages]
+  ArmPkg/ArmPkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+  MdePkg/MdePkg.dec
+  Silicon/Hisilicon/HisiPkg.dec
+
+[LibraryClasses]
+  ArmLib
+  CacheMaintenanceLib
+  DebugLib
+  IoLib
+  PcdLib
+  PeimEntryPoint
+  PlatformSysCtrlLib
+
+[Pcd]
+  gHisiTokenSpaceGuid.PcdMailBoxAddress
+  gHisiTokenSpaceGuid.PcdPeriSubctrlAddress
+  gHisiTokenSpaceGuid.PcdTrustedFirmwareEnable
+
+[Depex]
+## As we will clean mailbox in this module, need to wait memory init complete
+  gEfiPeiMemoryDiscoveredPpiGuid
diff --git a/Silicon/Hisilicon/Include/Library/OemAddressMapLib.h 
b/Silicon/Hisilicon/Include/Library/OemAddressMapLib.h
index 332a79343f..b330be09ba 100644
--- a/Silicon/Hisilicon/Include/Library/OemAddressMapLib.h
+++ b/Silicon/Hisilicon/Include/Library/OemAddressMapLib.h
@@ -16,6 +16,8 @@
 #ifndef _OEM_ADDRESS_MAP_LIB_H_
 #define _OEM_ADDRESS_MAP_LIB_H_
 
+#include "PlatformArch.h"
+
 typedef struct _DDRC_BASE_ID{
 UINTN  Base;
 UINTN  Id;
diff --git a/Platform/Hisilicon/D06/EarlyConfigPeim/EarlyConfigPeimD06.c 
b/Platform/Hisilicon/D06/EarlyConfigPeim/EarlyConfigPeimD06.c
new file mode 100644
index 00..0790f7941a
--- /dev/null
+++ b/Platform/Hisilicon/D06/EarlyConfigPeim/EarlyConfigPeimD06.c
@@ -0,0 +1,107 @@
+/** @file
+*
+*  Copyright (c) 2018, Hisilicon Limited. All rights reserved.
+*  Copyright (c) 2018, Linaro Limited. 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 PERI_SUBCTRL_BASE   (0x4000)
+#define MDIO_SUBCTRL_BASE   (0x6000)
+#define PCIE2_SUBCTRL_BASE  

[edk2] [PATCH edk2-platforms v2 30/43] Platform/Hisilicon/D06: Add OemNicConfig2P Driver

2018-08-14 Thread Ming Huang
This Driver provide Get/Set Mac function.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ming Huang 
---
 Platform/Hisilicon/D06/D06.dsc |  2 +-
 Platform/Hisilicon/D06/D06.fdf |  2 +-
 Platform/Hisilicon/D06/Drivers/OemNicConfig2PHi1620/OemNicConfig2P.inf | 43 

 Platform/Hisilicon/D06/Drivers/OemNicConfig2PHi1620/OemNicConfig.h | 25 
+++
 Platform/Hisilicon/D06/Drivers/OemNicConfig2PHi1620/OemNicConfig2P.c   | 71 

 5 files changed, 141 insertions(+), 2 deletions(-)

diff --git a/Platform/Hisilicon/D06/D06.dsc b/Platform/Hisilicon/D06/D06.dsc
index e18badf3b3..5571028f42 100644
--- a/Platform/Hisilicon/D06/D06.dsc
+++ b/Platform/Hisilicon/D06/D06.dsc
@@ -285,7 +285,7 @@
   #
   ArmPkg/Drivers/CpuDxe/CpuDxe.inf
   MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
-
+  Platform/Hisilicon/D06/Drivers/OemNicConfig2PHi1620/OemNicConfig2P.inf
 
 !if $(SECURE_BOOT_ENABLE) == TRUE
   MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf {
diff --git a/Platform/Hisilicon/D06/D06.fdf b/Platform/Hisilicon/D06/D06.fdf
index 5bb779d2e4..184d5d4dcf 100644
--- a/Platform/Hisilicon/D06/D06.fdf
+++ b/Platform/Hisilicon/D06/D06.fdf
@@ -174,7 +174,7 @@ READ_LOCK_STATUS   = TRUE
   INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
   INF Platform/Hisilicon/D06/Drivers/SFC/SfcDxeDriver.inf
 
-
+  INF Platform/Hisilicon/D06/Drivers/OemNicConfig2PHi1620/OemNicConfig2P.inf
   INF Silicon/Hisilicon/Drivers/FlashFvbDxe/FlashFvbDxe.inf
   INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
   INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
diff --git 
a/Platform/Hisilicon/D06/Drivers/OemNicConfig2PHi1620/OemNicConfig2P.inf 
b/Platform/Hisilicon/D06/Drivers/OemNicConfig2PHi1620/OemNicConfig2P.inf
new file mode 100644
index 00..a91f2b6005
--- /dev/null
+++ b/Platform/Hisilicon/D06/Drivers/OemNicConfig2PHi1620/OemNicConfig2P.inf
@@ -0,0 +1,43 @@
+#/** @file
+#
+#Copyright (c) 2016-2018, Hisilicon Limited. All rights reserved.
+#Copyright (c) 2016-2018, Linaro Limited. 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.
+#
+#**/
+
+[Defines]
+  INF_VERSION= 0x0001001A
+  BASE_NAME  = OemNicConfigPangea
+  FILE_GUID  = edc95319-ebe9-4c38-96af-1d203fb85231
+  MODULE_TYPE= DXE_DRIVER
+  VERSION_STRING = 1.0
+  ENTRY_POINT= OemNicConfigEntry
+
+[Sources.common]
+  OemNicConfig2P.c
+
+[Packages]
+  MdeModulePkg/MdeModulePkg.dec
+  MdePkg/MdePkg.dec
+  Silicon/Hisilicon/HisiPkg.dec
+
+[Protocols]
+  gHisiBoardNicProtocolGuid   ##Produce
+
+[LibraryClasses]
+  DebugLib
+  IoLib
+  OemNicLib
+  UefiBootServicesTableLib
+  UefiDriverEntryPoint
+
+[Depex]
+  TRUE
diff --git a/Platform/Hisilicon/D06/Drivers/OemNicConfig2PHi1620/OemNicConfig.h 
b/Platform/Hisilicon/D06/Drivers/OemNicConfig2PHi1620/OemNicConfig.h
new file mode 100644
index 00..35228fdf1d
--- /dev/null
+++ b/Platform/Hisilicon/D06/Drivers/OemNicConfig2PHi1620/OemNicConfig.h
@@ -0,0 +1,25 @@
+/** @file
+*
+*  Copyright (c) 2016-2018, Hisilicon Limited. All rights reserved.
+*  Copyright (c) 2016-2018, Linaro Limited. 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.
+*
+**/
+
+#ifndef __OEM_NIC_CONFIG_H__
+#define __OEM_NIC_CONFIG_H__
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#endif
diff --git 
a/Platform/Hisilicon/D06/Drivers/OemNicConfig2PHi1620/OemNicConfig2P.c 
b/Platform/Hisilicon/D06/Drivers/OemNicConfig2PHi1620/OemNicConfig2P.c
new file mode 100644
index 00..c01c49150a
--- /dev/null
+++ b/Platform/Hisilicon/D06/Drivers/OemNicConfig2PHi1620/OemNicConfig2P.c
@@ -0,0 +1,71 @@
+/** @file
+*
+*  Copyright (c) 2016-2018, Hisilicon Limited. All rights reserved.
+*  Copyright (c) 2016-2018, Linaro Limited. 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 

[edk2] [PATCH edk2-platforms v2 28/43] Platform/Hisilicon/D06: Enable ACPI PPTT

2018-08-14 Thread Ming Huang
From: Heyi Guo 

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Heyi Guo 
---
 Platform/Hisilicon/D06/D06.dsc | 1 +
 Platform/Hisilicon/D06/D06.fdf | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/Platform/Hisilicon/D06/D06.dsc b/Platform/Hisilicon/D06/D06.dsc
index bec422670d..06249d8a5b 100644
--- a/Platform/Hisilicon/D06/D06.dsc
+++ b/Platform/Hisilicon/D06/D06.dsc
@@ -338,6 +338,7 @@
   Silicon/Hisilicon/Hi1620/Hi1620AcpiTables/AcpiTablesHi1620.inf
   Silicon/Hisilicon/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf
 
+  Silicon/Hisilicon/Hi1620/Pptt/Pptt.inf
   #
   # Usb Support
   #
diff --git a/Platform/Hisilicon/D06/D06.fdf b/Platform/Hisilicon/D06/D06.fdf
index 06203dc079..5bb779d2e4 100644
--- a/Platform/Hisilicon/D06/D06.fdf
+++ b/Platform/Hisilicon/D06/D06.fdf
@@ -252,6 +252,8 @@ READ_LOCK_STATUS   = TRUE
   INF RuleOverride=ACPITABLE 
Silicon/Hisilicon/Hi1620/Hi1620AcpiTables/AcpiTablesHi1620.inf
   INF Silicon/Hisilicon/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf
 
+  INF Silicon/Hisilicon/Hi1620/Pptt/Pptt.inf
+
   #
   #Network
   #
-- 
2.17.0

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


[edk2] [PATCH edk2-platforms v2 34/43] Hisilicon/D06: add apei driver

2018-08-14 Thread Ming Huang
From: Luqi Jiang 

This driver provide a means for the platform to
convey error information to OSPM.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Luqi Jiang 
---
 Platform/Hisilicon/D06/D06.dsc   |   1 +
 Platform/Hisilicon/D06/D06.fdf   |   1 +
 Silicon/Hisilicon/Hi1620/Drivers/Apei/Apei.inf   |  64 
 Silicon/Hisilicon/Hi1620/Drivers/Apei/Apei.h |  41 +++
 Silicon/Hisilicon/Hi1620/Drivers/Apei/Bert/bert.h|  43 +++
 Silicon/Hisilicon/Hi1620/Drivers/Apei/Einj/einj.h| 146 
 Silicon/Hisilicon/Hi1620/Drivers/Apei/ErrorSource/Ghes.h | 110 ++
 Silicon/Hisilicon/Hi1620/Drivers/Apei/Erst/erst.h| 146 
 Silicon/Hisilicon/Hi1620/Drivers/Apei/Hest/hest.h|  59 +++
 Silicon/Hisilicon/Hi1620/Drivers/Apei/OemApeiHi1620.h|  43 +++
 Silicon/Hisilicon/Hi1620/Drivers/Apei/Apei.c | 108 ++
 Silicon/Hisilicon/Hi1620/Drivers/Apei/Bert/bert.c|  92 +
 Silicon/Hisilicon/Hi1620/Drivers/Apei/Einj/einj.c| 349 
++
 Silicon/Hisilicon/Hi1620/Drivers/Apei/ErrorSource/Ghes.c | 330 
+
 Silicon/Hisilicon/Hi1620/Drivers/Apei/Erst/erst.c| 374 

 Silicon/Hisilicon/Hi1620/Drivers/Apei/Hest/hest.c| 119 +++
 Silicon/Hisilicon/Hi1620/Drivers/Apei/OemApeiHi1620.c| 337 
++
 17 files changed, 2363 insertions(+)

diff --git a/Platform/Hisilicon/D06/D06.dsc b/Platform/Hisilicon/D06/D06.dsc
index c6de9f04ad..9550e0d497 100644
--- a/Platform/Hisilicon/D06/D06.dsc
+++ b/Platform/Hisilicon/D06/D06.dsc
@@ -340,6 +340,7 @@
   Silicon/Hisilicon/Hi1620/Hi1620AcpiTables/AcpiTablesHi1620.inf
   Silicon/Hisilicon/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf
 
+  Silicon/Hisilicon/Hi1620/Drivers/Apei/Apei.inf
   Silicon/Hisilicon/Hi1620/Pptt/Pptt.inf
   #
   # Usb Support
diff --git a/Platform/Hisilicon/D06/D06.fdf b/Platform/Hisilicon/D06/D06.fdf
index bd3ea47226..90379b8558 100644
--- a/Platform/Hisilicon/D06/D06.fdf
+++ b/Platform/Hisilicon/D06/D06.fdf
@@ -251,6 +251,7 @@ READ_LOCK_STATUS   = TRUE
 
   INF RuleOverride=ACPITABLE 
Silicon/Hisilicon/Hi1620/Hi1620AcpiTables/AcpiTablesHi1620.inf
   INF Silicon/Hisilicon/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf
+  INF Silicon/Hisilicon/Hi1620/Drivers/Apei/Apei.inf
 
   INF Silicon/Hisilicon/Hi1620/Pptt/Pptt.inf
 
diff --git a/Silicon/Hisilicon/Hi1620/Drivers/Apei/Apei.inf 
b/Silicon/Hisilicon/Hi1620/Drivers/Apei/Apei.inf
new file mode 100644
index 00..7a75968da1
--- /dev/null
+++ b/Silicon/Hisilicon/Hi1620/Drivers/Apei/Apei.inf
@@ -0,0 +1,64 @@
+/** @file
+*
+*  Copyright (c) 2018, Hisilicon Limited. All rights reserved.
+*  Copyright (c) 2018, Linaro Limited. 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.
+*
+**/
+
+[defines]
+  INF_VERSION= 0x0001001A
+  BASE_NAME  = AcpiApei
+  FILE_GUID  = E9570C39-EF68-4fc6-B921-C1954A87CCD2
+  MODULE_TYPE= DXE_DRIVER
+  VERSION_STRING = 1.0
+  ENTRY_POINT= ApeiEntryPoint
+
+[sources.common]
+  Apei.c
+  Bert/bert.c
+  Bert/bert.h
+  Einj/einj.c
+  Einj/einj.h
+  Erst/erst.c
+  Erst/erst.h
+  Hest/hest.c
+  Hest/hest.h
+  ErrorSource/Ghes.c
+  ErrorSource/Ghes.h
+  OemApeiHi1620.c
+
+[Packages]
+  ArmPkg/ArmPkg.dec
+  MdePkg/MdePkg.dec
+  Silicon/Hisilicon/HisiPkg.dec
+
+[LibraryClasses]
+  ArmSmcLib
+  BaseMemoryLib
+  DebugLib
+  HobLib
+  TimerLib
+  UefiDriverEntryPoint
+  UefiRuntimeServicesTableLib
+
+[Guids]
+  gOemConfigGuid
+
+[Protocols]
+  gEfiAcpiSdtProtocolGuid
+  gEfiAcpiTableProtocolGuid # PROTOCOL ALWAYS_CONSUMED
+
+[Pcd]
+  gHisiTokenSpaceGuid.PcdCpldBaseAddress
+  gHisiTokenSpaceGuid.PcdTrustedFirmwareEnable
+
+[Depex]
+  gEfiAcpiTableProtocolGuid AND gEfiAcpiSdtProtocolGuid
diff --git a/Silicon/Hisilicon/Hi1620/Drivers/Apei/Apei.h 
b/Silicon/Hisilicon/Hi1620/Drivers/Apei/Apei.h
new file mode 100644
index 00..ed8ec417cb
--- /dev/null
+++ b/Silicon/Hisilicon/Hi1620/Drivers/Apei/Apei.h
@@ -0,0 +1,41 @@
+/** @file
+*
+*  Copyright (c) 2018, Hisilicon Limited. All rights reserved.
+*  Copyright (c) 2018, Linaro Limited. 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 

[edk2] [PATCH edk2-platforms v2 29/43] Platform/Hisilicon/D06: Add OemNicLib

2018-08-14 Thread Ming Huang
OemNicLib provide nic related api like GetMac,SetMac.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ming Huang 
---
 Platform/Hisilicon/D06/D06.dsc |   1 +
 Platform/Hisilicon/D06/Library/OemNicLib/OemNicLib.inf |  35 ++
 Platform/Hisilicon/D06/Library/OemNicLib/OemNicLib.c   | 570 

 3 files changed, 606 insertions(+)

diff --git a/Platform/Hisilicon/D06/D06.dsc b/Platform/Hisilicon/D06/D06.dsc
index 06249d8a5b..e18badf3b3 100644
--- a/Platform/Hisilicon/D06/D06.dsc
+++ b/Platform/Hisilicon/D06/D06.dsc
@@ -90,6 +90,7 @@
 
   LpcLib|Silicon/Hisilicon/Hi1620/Library/LpcLibHi1620/LpcLib.inf
   
SerialPortLib|ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf
+  OemNicLib|Platform/Hisilicon/D06/Library/OemNicLib/OemNicLib.inf
 !if $(SECURE_BOOT_ENABLE) == TRUE
   FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf
 !endif
diff --git a/Platform/Hisilicon/D06/Library/OemNicLib/OemNicLib.inf 
b/Platform/Hisilicon/D06/Library/OemNicLib/OemNicLib.inf
new file mode 100644
index 00..3b0bd2d60c
--- /dev/null
+++ b/Platform/Hisilicon/D06/Library/OemNicLib/OemNicLib.inf
@@ -0,0 +1,35 @@
+#/** @file
+#
+#Copyright (c) 2018, Hisilicon Limited. All rights reserved.
+#Copyright (c) 2017, Linaro Limited. 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.
+#
+#**/
+
+[Defines]
+  INF_VERSION= 0x0001001A
+  BASE_NAME  = OemNicLib
+  FILE_GUID  = 520F872C-FFCF-4EF3-AC01-85BDB0816DCE
+  MODULE_TYPE= BASE
+  VERSION_STRING = 1.0
+  LIBRARY_CLASS  = OemNicLib
+
+[Sources.common]
+  OemNicLib.c
+
+[Packages]
+  ArmPkg/ArmPkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+  MdePkg/MdePkg.dec
+  Silicon/Hisilicon/HisiPkg.dec
+
+[LibraryClasses]
+  CpldIoLib
+  I2CLib
diff --git a/Platform/Hisilicon/D06/Library/OemNicLib/OemNicLib.c 
b/Platform/Hisilicon/D06/Library/OemNicLib/OemNicLib.c
new file mode 100644
index 00..caf931cdbb
--- /dev/null
+++ b/Platform/Hisilicon/D06/Library/OemNicLib/OemNicLib.c
@@ -0,0 +1,570 @@
+/** @file
+*
+*  Copyright (c) 2018, Hisilicon Limited. All rights reserved.
+*  Copyright (c) 2017, Linaro Limited. 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 
+
+#define CPU2_SFP2_100G_CARD_OFFSET   0x25
+#define CPU1_SFP1_LOCATE_OFFSET  0x16
+#define CPU1_SFP0_LOCATE_OFFSET  0x12
+#define CPU2_SFP1_LOCATE_OFFSET  0x21
+#define CPU2_SFP0_LOCATE_OFFSET  0x19
+#define CPU2_SFP2_10G_GE_CARD_OFFSET 0x25
+
+#define SFP_10G_SPEED   10
+#define SFP_25G_SPEED   25
+#define SFP_100G_SPEED  100
+#define SFP_GE_SPEED1
+
+#define SFP_GE_SPEED_VAL_VENDOR_FINISAR 0x0C
+#define SFP_GE_SPEED_VAL0x0D
+#define SFP_10G_SPEED_VAL   0x67
+#define SFP_25G_SPEED_VAL   0xFF
+
+#define CARD_PRESENT_100G   (BIT7)
+#define CARD_PRESENT_10G(BIT0)
+#define SELECT_SFP_BY_INDEX(index)  (1 << (index - 1))
+#define SPF_SPEED_OFFSET12
+
+#define SFP_DEVICE_ADDRESS 0x50
+#define CPU1_9545_I2C_ADDR 0x70
+#define CPU2_9545_I2C_ADDR 0x71
+
+#define FIBER_PRESENT 0
+#define CARD_PRESENT  1
+#define I2C_PORT_SFP  4
+#define CPU2_I2C_PORT_SFP 5
+
+#define SOCKET_0 0
+#define SOCKET_1 1
+#define EEPROM_I2C_PORT  4
+#define EEPROM_PAGE_SIZE 0x40
+#define MAC_ADDR_LEN 6
+#define I2C_OFFSET_EEPROM_ETH0   (0xc00)
+#define I2C_SLAVEADDR_EEPROM (0x52)
+
+#pragma pack(1)
+typedef struct {
+  UINT16 Crc16;
+  UINT16 MacLen;
+  UINT8  Mac[MAC_ADDR_LEN];
+} NIC_MAC_ADDRESS;
+#pragma pack()
+
+ETH_PRODUCT_DESC gEthPdtDesc[ETH_MAX_PORT] =
+{
+{TRUE,   ETH_SPEED_10KM,  ETH_FULL_DUPLEX, ETH_INVALID, ETH_INVALID},
+{TRUE,   ETH_SPEED_10KM,  ETH_FULL_DUPLEX, ETH_INVALID, ETH_INVALID},
+{FALSE,  ETH_INVALID, ETH_INVALID, ETH_INVALID, ETH_INVALID},
+{FALSE,  ETH_INVALID, ETH_INVALID, ETH_INVALID, ETH_INVALID},
+{TRUE,   ETH_SPEED_1000M, 

[edk2] [PATCH edk2-platforms v2 24/43] Hisilicon/I2C: Fix a typo issue

2018-08-14 Thread Ming Huang
Modify spedd to Speed.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ming Huang 
---
 Silicon/Hisilicon/Library/I2CLib/I2CHw.h  | 2 +-
 Silicon/Hisilicon/Library/I2CLib/I2CLib.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Silicon/Hisilicon/Library/I2CLib/I2CHw.h 
b/Silicon/Hisilicon/Library/I2CLib/I2CHw.h
index d77aea509e..6fd7b8183e 100644
--- a/Silicon/Hisilicon/Library/I2CLib/I2CHw.h
+++ b/Silicon/Hisilicon/Library/I2CLib/I2CHw.h
@@ -81,7 +81,7 @@
  struct
  {
 UINT32  master: 1   ;
-UINT32  spedd : 2   ;
+UINT32  Speed : 2   ;
 UINT32  slave_10bit   : 1   ;
 UINT32  master_10bit  : 1   ;
 UINT32  restart_en: 1   ;
diff --git a/Silicon/Hisilicon/Library/I2CLib/I2CLib.c 
b/Silicon/Hisilicon/Library/I2CLib/I2CLib.c
index 59633106ce..ed44ac204f 100644
--- a/Silicon/Hisilicon/Library/I2CLib/I2CLib.c
+++ b/Silicon/Hisilicon/Library/I2CLib/I2CLib.c
@@ -158,7 +158,7 @@ I2CInit (
 
   I2C_REG_READ (Base + I2C_CON_OFFSET, I2cControlReg.Val32);
   I2cControlReg.bits.master = 1;
-  I2cControlReg.bits.spedd = 0x1;
+  I2cControlReg.bits.Speed = 0x1;
   I2cControlReg.bits.restart_en = 1;
   I2cControlReg.bits.slave_disable = 1;
   I2C_REG_WRITE (Base + I2C_CON_OFFSET, I2cControlReg.Val32);
-- 
2.17.0

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


[edk2] [PATCH edk2-platforms v2 25/43] Silicon/Hisilicon/D06: Optimize HNS config CDR post time

2018-08-14 Thread Ming Huang
From: shaochangliang 

Use I2C 400KB speed for config CDR.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ming Huang 
---
 Silicon/Hisilicon/Library/I2CLib/I2CLib.c | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/Silicon/Hisilicon/Library/I2CLib/I2CLib.c 
b/Silicon/Hisilicon/Library/I2CLib/I2CLib.c
index ed44ac204f..55c030a3af 100644
--- a/Silicon/Hisilicon/Library/I2CLib/I2CLib.c
+++ b/Silicon/Hisilicon/Library/I2CLib/I2CLib.c
@@ -28,6 +28,9 @@
 #include "I2CLibInternal.h"
 #include "I2CHw.h"
 
+#define I2C_100KB_SPEED 0x1
+#define I2C_400KB_SPEED 0x2
+
 VOID
 I2C_Delay (
   UINT32 Count
@@ -158,7 +161,11 @@ I2CInit (
 
   I2C_REG_READ (Base + I2C_CON_OFFSET, I2cControlReg.Val32);
   I2cControlReg.bits.master = 1;
-  I2cControlReg.bits.Speed = 0x1;
+  if(SpeedMode == Normal) {
+I2cControlReg.bits.Speed = I2C_100KB_SPEED;
+  } else {
+I2cControlReg.bits.Speed = I2C_400KB_SPEED;
+  }
   I2cControlReg.bits.restart_en = 1;
   I2cControlReg.bits.slave_disable = 1;
   I2C_REG_WRITE (Base + I2C_CON_OFFSET, I2cControlReg.Val32);
-- 
2.17.0

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


[edk2] [PATCH edk2-platforms v2 23/43] Silicon/Hisilicon/D06: Add I2C delay for HNS auto config

2018-08-14 Thread Ming Huang
Because I2C Port5 salve device connect under I2C extender
(9545 device), it will cost more time to access I2C slave
device, so add delay time for HNS auto config.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ming Huang 
---
 Silicon/Hisilicon/Library/I2CLib/I2CHw.h  |  3 +++
 Silicon/Hisilicon/Library/I2CLib/I2CLib.c | 21 +++-
 2 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/Silicon/Hisilicon/Library/I2CLib/I2CHw.h 
b/Silicon/Hisilicon/Library/I2CLib/I2CHw.h
index fa954c7937..d77aea509e 100644
--- a/Silicon/Hisilicon/Library/I2CLib/I2CHw.h
+++ b/Silicon/Hisilicon/Library/I2CLib/I2CHw.h
@@ -19,6 +19,9 @@
 #include 
 #include 
 
+// The HNS I2C port 5 is under I2C extender
+#define I2C_EXTENDER_PORT_HNS5
+
 #define I2C_READ_TIMEOUT 500
 #define I2C_DRV_ONCE_WRITE_BYTES_NUM 8
 #define I2C_DRV_ONCE_READ_BYTES_NUM  8
diff --git a/Silicon/Hisilicon/Library/I2CLib/I2CLib.c 
b/Silicon/Hisilicon/Library/I2CLib/I2CLib.c
index d67ddc7f9b..59633106ce 100644
--- a/Silicon/Hisilicon/Library/I2CLib/I2CLib.c
+++ b/Silicon/Hisilicon/Library/I2CLib/I2CLib.c
@@ -258,8 +258,13 @@ CheckI2CTimeOut (
   if (Transfer == I2CTx) {
 Fifo = I2C_GetTxStatus (Socket, Port);
 while (Fifo != 0) {
-  // This is a empirical value for I2C delay. MemoryFance is no need here.
-  I2C_Delay (2);
+  if (Port == I2C_EXTENDER_PORT_HNS) {
+// This is a empirical value for I2C delay. MemoryFance is no need 
here.
+I2C_Delay (1000);
+  } else {
+// This is a empirical value for I2C delay. MemoryFance is no need 
here.
+I2C_Delay (2);
+  }
   if (++Times > I2C_READ_TIMEOUT) {
 (VOID)I2C_Disable (Socket, Port);
 return EFI_TIMEOUT;
@@ -269,8 +274,13 @@ CheckI2CTimeOut (
   } else {
 Fifo = I2C_GetRxStatus (Socket, Port);
 while (Fifo == 0) {
-  // This is a empirical value for I2C delay. MemoryFance is no need here.
-  I2C_Delay (2);
+  if (Port == I2C_EXTENDER_PORT_HNS) {
+// This is a empirical value for I2C delay. MemoryFance is no need 
here.
+I2C_Delay (1000);
+  } else {
+// This is a empirical value for I2C delay. MemoryFance is no need 
here.
+I2C_Delay (2);
+  }
   if (++Times > I2C_READ_TIMEOUT) {
 (VOID)I2C_Disable (Socket, Port);
 return EFI_TIMEOUT;
@@ -369,7 +379,8 @@ I2CWrite(
 Times = 0;
 Fifo = I2C_GetTxStatus (I2cInfo->Socket, I2cInfo->Port);
 while (Fifo > I2C_TXRX_THRESHOLD) {
-  I2C_Delay (2);
+  // This is a empirical value for I2C delay. MemoryFance is no need here.
+  I2C_Delay (1000);
   if (++Times > I2C_READ_TIMEOUT) {
 (VOID)I2C_Disable (I2cInfo->Socket, I2cInfo->Port);
 return EFI_TIMEOUT;
-- 
2.17.0

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


[edk2] [PATCH edk2-platforms v2 21/43] Silicon/Hisilicon/I2C: Refactor I2C library

2018-08-14 Thread Ming Huang
The hunk of waiting TX/TX finish is used by ten times,
so move there hunks to a function CheckI2CTimeOut().

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ming Huang 
---
 Silicon/Hisilicon/Library/I2CLib/I2CHw.h  |   4 +
 Silicon/Hisilicon/Library/I2CLib/I2CLib.c | 161 
 2 files changed, 66 insertions(+), 99 deletions(-)

diff --git a/Silicon/Hisilicon/Library/I2CLib/I2CHw.h 
b/Silicon/Hisilicon/Library/I2CLib/I2CHw.h
index aa561e929c..fa954c7937 100644
--- a/Silicon/Hisilicon/Library/I2CLib/I2CHw.h
+++ b/Silicon/Hisilicon/Library/I2CLib/I2CHw.h
@@ -265,5 +265,9 @@
  UINT32  Val32;
  } I2C0_ENABLE_STATUS_U;
 
+typedef enum {
+  I2CTx,
+  I2CRx
+} I2CTransfer;
 
 #endif
diff --git a/Silicon/Hisilicon/Library/I2CLib/I2CLib.c 
b/Silicon/Hisilicon/Library/I2CLib/I2CLib.c
index f03d55d6b2..9174e50dd4 100644
--- a/Silicon/Hisilicon/Library/I2CLib/I2CLib.c
+++ b/Silicon/Hisilicon/Library/I2CLib/I2CLib.c
@@ -238,6 +238,45 @@ I2C_GetRxStatus (
   return Fifo.bits.rxflr;
 }
 
+EFI_STATUS
+EFIAPI
+CheckI2CTimeOut (
+  UINT32  Socket,
+  UINT8   Port,
+  I2CTransfer Transfer
+  )
+{
+  UINT32 Times = 0;
+  UINT32 Fifo;
+
+  if (Transfer == I2CTx) {
+Fifo = I2C_GetTxStatus (Socket, Port);
+while (Fifo != 0) {
+  // This is a empirical value for I2C delay. MemoryFance is no need here.
+  I2C_Delay (2);
+  if (++Times > I2C_READ_TIMEOUT) {
+(VOID)I2C_Disable (Socket, Port);
+return EFI_TIMEOUT;
+  }
+  Fifo = I2C_GetTxStatus (Socket, Port);
+}
+  } else {
+Fifo = I2C_GetRxStatus (Socket, Port);
+while (Fifo == 0) {
+  // This is a empirical value for I2C delay. MemoryFance is no need here.
+  I2C_Delay (2);
+  if (++Times > I2C_READ_TIMEOUT) {
+(VOID)I2C_Disable (Socket, Port);
+return EFI_TIMEOUT;
+  }
+  Fifo = I2C_GetRxStatus (Socket, Port);
+}
+  }
+
+  return EFI_SUCCESS;
+}
+
+
 EFI_STATUS
 EFIAPI
 WriteBeforeRead (
@@ -254,15 +293,11 @@ WriteBeforeRead (
 
   I2C_SetTarget (I2cInfo->Socket, I2cInfo->Port, I2cInfo->SlaveDeviceAddress);
 
-  Fifo = I2C_GetTxStatus (I2cInfo->Socket, I2cInfo->Port);
-  while (Fifo != 0) {
-I2C_Delay (2);
-if (++Times > I2C_READ_TIMEOUT) {
-  return EFI_TIMEOUT;
-}
-Fifo = I2C_GetTxStatus (I2cInfo->Socket, I2cInfo->Port);
+  if (CheckI2CTimeOut (I2cInfo->Socket, I2cInfo->Port, I2CTx) == EFI_TIMEOUT) {
+return EFI_TIMEOUT;
   }
 
+  Fifo = 0;
   for (Count = 0; Count < Length; Count++) {
 Times = 0;
 while (Fifo > I2C_TXRX_THRESHOLD) {
@@ -277,15 +312,8 @@ WriteBeforeRead (
 Fifo = I2C_GetTxStatus (I2cInfo->Socket, I2cInfo->Port);
   }
 
-  Fifo = I2C_GetTxStatus (I2cInfo->Socket, I2cInfo->Port);
-  Times = 0;
-  while (Fifo != 0) {
-I2C_Delay (2);
-
-if (++Times > I2C_READ_TIMEOUT) {
-  return EFI_TIMEOUT;
-}
-Fifo = I2C_GetTxStatus (I2cInfo->Socket, I2cInfo->Port);
+  if (CheckI2CTimeOut (I2cInfo->Socket, I2cInfo->Port, I2CTx) == EFI_TIMEOUT) {
+return EFI_TIMEOUT;
   }
 
   return EFI_SUCCESS;
@@ -316,14 +344,8 @@ I2CWrite(
 
   I2C_SetTarget(I2cInfo->Socket, I2cInfo->Port, I2cInfo->SlaveDeviceAddress);
 
-  Fifo = I2C_GetTxStatus (I2cInfo->Socket, I2cInfo->Port);
-  while (Fifo != 0) {
-I2C_Delay (2);
-if (++Times > I2C_READ_TIMEOUT) {
-  (VOID)I2C_Disable (I2cInfo->Socket, I2cInfo->Port);
-  return EFI_TIMEOUT;
-}
-Fifo = I2C_GetTxStatus (I2cInfo->Socket, I2cInfo->Port);
+  if (CheckI2CTimeOut (I2cInfo->Socket, I2cInfo->Port, I2CTx) == EFI_TIMEOUT) {
+return EFI_TIMEOUT;
   }
 
   if (I2cInfo->DeviceType) {
@@ -333,15 +355,8 @@ I2CWrite(
 I2C_REG_WRITE (Base + I2C_DATA_CMD_OFFSET, InfoOffset & 0xff);
   }
 
-  Fifo = I2C_GetTxStatus (I2cInfo->Socket, I2cInfo->Port);
-  Times = 0;
-  while (Fifo != 0) {
-I2C_Delay (2);
-if (++Times > I2C_READ_TIMEOUT) {
-  (VOID)I2C_Disable (I2cInfo->Socket, I2cInfo->Port);
-  return EFI_TIMEOUT;
-}
-Fifo = I2C_GetTxStatus (I2cInfo->Socket, I2cInfo->Port);
+  if (CheckI2CTimeOut (I2cInfo->Socket, I2cInfo->Port, I2CTx) == EFI_TIMEOUT) {
+return EFI_TIMEOUT;
   }
 
   for (Idx = 0; Idx < Length; Idx++) {
@@ -364,17 +379,8 @@ I2CWrite(
 }
   }
 
-  Fifo = I2C_GetTxStatus (I2cInfo->Socket, I2cInfo->Port);
-  Times = 0;
-  while (Fifo != 0) {
-I2C_Delay (2);
-
-if (++Times > I2C_READ_TIMEOUT) {
-  DEBUG ((DEBUG_ERROR, "I2C Write try to finished,time out!\n"));
-  (VOID)I2C_Disable (I2cInfo->Socket, I2cInfo->Port);
-  return EFI_TIMEOUT;
-}
-Fifo = I2C_GetTxStatus (I2cInfo->Socket, I2cInfo->Port);
+  if (CheckI2CTimeOut (I2cInfo->Socket, I2cInfo->Port, I2CTx) == EFI_TIMEOUT) {
+return EFI_TIMEOUT;
   }
   (VOID)I2C_Disable (I2cInfo->Socket, I2cInfo->Port);
 
@@ -390,8 +396,6 @@ I2CRead(
   UINT8 *pBuf
   )
 {
-  UINT32  Fifo;
-  UINT32  Times = 0;
   UINT8   I2CWAddr[2];
   EFI_STATUS  Status;
   UINT32  Idx = 0;
@@ -422,15 +426,8 

[edk2] [PATCH edk2-platforms v2 27/43] Hisilicon/Hi1620: Add ACPI PPTT table

2018-08-14 Thread Ming Huang
From: Heyi Guo 

This driver fetches information from MADT,  so it is adaptable for
partial good and 1P/2P, since MADT is updated for different
configurations by certain mechanism.

Since L2 cache is also private resource of core, so we need to set the
next level of cache for L1I and L1D, which is important for OS to
parse cache hierarchy.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Heyi Guo 
---
 Silicon/Hisilicon/Hi1620/Pptt/Pptt.inf |  48 ++
 Silicon/Hisilicon/Hi1620/Pptt/Pptt.h   |  68 +++
 Silicon/Hisilicon/Hi1620/Pptt/Pptt.c   | 543 
 3 files changed, 659 insertions(+)

diff --git a/Silicon/Hisilicon/Hi1620/Pptt/Pptt.inf 
b/Silicon/Hisilicon/Hi1620/Pptt/Pptt.inf
new file mode 100644
index 00..f8a5ed33a4
--- /dev/null
+++ b/Silicon/Hisilicon/Hi1620/Pptt/Pptt.inf
@@ -0,0 +1,48 @@
+/** @file
+*
+*  Copyright (c) 2018, Hisilicon Limited. All rights reserved.
+*  Copyright (c) 2018, Linaro Limited. 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.
+*
+*  Based on the files under Platform/ARM/JunoPkg/AcpiTables/
+*
+**/
+
+[Defines]
+  INF_VERSION= 0x0001001A
+  BASE_NAME  = AcpiPptt
+  FILE_GUID  = 65766562-49e7-11e8-817f-286ed489ee9b
+  MODULE_TYPE= DXE_DRIVER
+  VERSION_STRING = 1.0
+  ENTRY_POINT= PpttEntryPoint
+
+[Sources.common]
+  Pptt.c
+
+[Packages]
+  ArmPkg/ArmPkg.dec
+  MdePkg/MdePkg.dec
+  Silicon/Hisilicon/HisiPkg.dec
+
+[LibraryClasses]
+  ArmLib
+  BaseMemoryLib
+  DebugLib
+  HobLib
+  UefiDriverEntryPoint
+  UefiRuntimeServicesTableLib
+
+[Protocols]
+  gEfiAcpiSdtProtocolGuid   ## PROTOCOL ALWAYS_CONSUMED
+  gEfiAcpiTableProtocolGuid ## PROTOCOL ALWAYS_CONSUMED
+
+[Depex]
+  gEfiAcpiTableProtocolGuid AND gEfiAcpiSdtProtocolGuid
+
diff --git a/Silicon/Hisilicon/Hi1620/Pptt/Pptt.h 
b/Silicon/Hisilicon/Hi1620/Pptt/Pptt.h
new file mode 100644
index 00..5f2ec67cb9
--- /dev/null
+++ b/Silicon/Hisilicon/Hi1620/Pptt/Pptt.h
@@ -0,0 +1,68 @@
+/** @file
+*
+*  Copyright (c) 2018, Hisilicon Limited. All rights reserved.
+*  Copyright (c) 2018, Linaro Limited. 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.
+*
+*  Based on the files under Platform/ARM/JunoPkg/AcpiTables/
+*
+**/
+
+#ifndef _PPTT_H_
+#define _PPTT_H_
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define PPTT_VENDOR_ID SIGNATURE_32('H', 'I', 'S', 'I')
+
+#define EFI_ACPI_MAX_NUM_TABLES20
+
+#define MAX_SCL_PER_SOCKET MAX_DIE
+#define MAX_SCL(MAX_SOCKET * MAX_SCL_PER_SOCKET)
+#define MAX_CLUSTER_PER_SCL8
+
+#define PPTT_TABLE_MAX_LEN 0x6000
+#define PPTT_SOCKET_COMPONENT_NO   0x1
+#define PPTT_CACHE_NO  0x4
+
+typedef union {
+  struct {
+UINT32InD   :1;
+UINT32Level :3;
+UINT32Reserved  :28;
+  } Bits;
+  UINT32 Data;
+} CSSELR_DATA;
+
+typedef union {
+  struct {
+UINT32LineSize   :3;
+UINT32Associativity  :10;
+UINT32NumSets:15;
+UINT32Wa :1;
+UINT32Ra :1;
+UINT32Wb :1;
+UINT32Wt :1;
+  } Bits;
+  UINT32 Data;
+} CCSIDR_DATA;
+
+#endif// _PPTT_H_
+
diff --git a/Silicon/Hisilicon/Hi1620/Pptt/Pptt.c 
b/Silicon/Hisilicon/Hi1620/Pptt/Pptt.c
new file mode 100644
index 00..944b4b9507
--- /dev/null
+++ b/Silicon/Hisilicon/Hi1620/Pptt/Pptt.c
@@ -0,0 +1,543 @@
+/** @file
+*
+*  Copyright (c) 2018, Hisilicon Limited. All rights reserved.
+*  Copyright (c) 2018, Linaro Limited. 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 

[edk2] [PATCH edk2-platforms v2 26/43] Silicon/Hisilicon/Setup: Add Setup Item "EnableGOP"

2018-08-14 Thread Ming Huang
From: Yang XinYi 

Add Setup Item "EnableGOP" for D06, This Item only takes
effect on VGA device SM750.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yang XinYi 
---
 Silicon/Hisilicon/Include/Library/OemConfigData.h| 1 +
 Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfig.c| 1 +
 Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/MiscConfig.hfr | 7 +++
 Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/MiscConfig.uni | 4 ++--
 4 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/Silicon/Hisilicon/Include/Library/OemConfigData.h 
b/Silicon/Hisilicon/Include/Library/OemConfigData.h
index 478821ae2c..e4d5917046 100644
--- a/Silicon/Hisilicon/Include/Library/OemConfigData.h
+++ b/Silicon/Hisilicon/Include/Library/OemConfigData.h
@@ -61,6 +61,7 @@ typedef struct {
   UINT8 EnableSmmu;
   UINT8 EnableFdtTable;
   UINT8 EnableSpcr;
+  UINT8 EnableGOP;
   /*RAS Config*/
   UINT8 EnRasSupport;
   UINT8 EnPoison;
diff --git a/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfig.c 
b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfig.c
index 1e3635307c..3ecae3759a 100644
--- a/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfig.c
+++ b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfig.c
@@ -295,6 +295,7 @@ OemConfigUiLibConstructor (
   Configuration.EnableSmmu = 1;
   Configuration.EnableFdtTable = 0;
   Configuration.EnableSpcr = 0;
+  Configuration.EnableGOP = 0;
   //
   //Set the default value of the Ras option
   //
diff --git a/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/MiscConfig.hfr 
b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/MiscConfig.hfr
index 9e3ac73116..c0b6e294a6 100644
--- a/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/MiscConfig.hfr
+++ b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/MiscConfig.hfr
@@ -38,4 +38,11 @@ form formid = MISC_CONFIG_FORM_ID,
   option text = STRING_TOKEN(STR_ENABLED), value = 1, flags = 0;
 endoneof;
 
+oneof varid   = OEM_CONFIG_DATA.EnableGOP,
+  prompt  = STRING_TOKEN(STR_ENABLE_GOP_FRAME_BUFFER),
+  help= STRING_TOKEN(STR_ENABLE_GOP_FRAME_BUFFER_HELP),
+  option text = STRING_TOKEN(STR_DISABLED), value = 0, flags = DEFAULT;
+  option text = STRING_TOKEN(STR_ENABLED), value = 1, flags = 0;
+endoneof;
+
 endform;
diff --git a/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/MiscConfig.uni 
b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/MiscConfig.uni
index 53eb1622c4..2fd92fedff 100644
--- a/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/MiscConfig.uni
+++ b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/MiscConfig.uni
@@ -23,5 +23,5 @@
 #string STR_FDT_CONFIG_HELP#language en-US  "Enable or Disable Fdt 
Table."
 #string STR_ENABLE_SPCR_TABLE  #language en-US  "Support SPCR"
 #string STR_ENABLE_SPCR_HELP   #language en-US  "Enable or Disable 
SPCR Table."
-#string STR_ENABLE_GOP_FRAME_BUFFER#language en-US  "Support GOP FB"
-#string STR_ENABLE_GOP_FRAME_BUFFER_HELP #language en-US  "Enable or 
Disable GOP frame buffer."
+#string STR_ENABLE_GOP_FRAME_BUFFER#language en-US  "Support GOP FB for 
SM750"
+#string STR_ENABLE_GOP_FRAME_BUFFER_HELP #language en-US  "Enable or 
Disable GOP frame buffer for SM750."
-- 
2.17.0

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


[edk2] [PATCH edk2-platforms v2 22/43] Silicon/Hisilicon/D06: Fix I2C enable fail issue for D06

2018-08-14 Thread Ming Huang
I2C may enable failed in D06, so retry I2C enable while
enable failed.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ming Huang 
---
 Silicon/Hisilicon/Library/I2CLib/I2CLib.c | 18 --
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/Silicon/Hisilicon/Library/I2CLib/I2CLib.c 
b/Silicon/Hisilicon/Library/I2CLib/I2CLib.c
index 9174e50dd4..d67ddc7f9b 100644
--- a/Silicon/Hisilicon/Library/I2CLib/I2CLib.c
+++ b/Silicon/Hisilicon/Library/I2CLib/I2CLib.c
@@ -86,6 +86,7 @@ I2C_Enable (
 {
   I2C0_ENABLE_U   I2cEnableReg;
   I2C0_ENABLE_STATUS_UI2cEnableStatusReg;
+  UINT32  TimeCnt = I2C_READ_TIMEOUT;
 
   UINTN Base = GetI2cBase (Socket, Port);
 
@@ -93,13 +94,18 @@ I2C_Enable (
   I2cEnableReg.bits.enable = 1;
   I2C_REG_WRITE (Base + I2C_ENABLE_OFFSET, I2cEnableReg.Val32);
 
+  do {
+// This is a empirical value for I2C delay. MemoryFance is no need here.
+I2C_Delay (1);
 
-  I2C_REG_READ (Base + I2C_ENABLE_STATUS_OFFSET, I2cEnableStatusReg.Val32);
-  if (I2cEnableStatusReg.bits.ic_en == 1) {
-return EFI_SUCCESS;
-  } else {
-return EFI_DEVICE_ERROR;
-  }
+TimeCnt--;
+I2C_REG_READ (Base + I2C_ENABLE_STATUS_OFFSET, I2cEnableStatusReg.Val32);
+if (TimeCnt == 0) {
+  return EFI_DEVICE_ERROR;
+}
+  } while (I2cEnableStatusReg.bits.ic_en == 0);
+
+  return EFI_SUCCESS;
 }
 
 VOID
-- 
2.17.0

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


[edk2] [PATCH edk2-platforms v2 19/43] Silicon/Hisilicon/D06: Stop watchdog

2018-08-14 Thread Ming Huang
according as watchdog design on D06, watchdog should be
stopped before boot a option.

This is an out of band watchdog timer in BMC; it is used
to monitor the whole BIOS boot process and reset the system
in case BIOS hangs somewhere, i.e. it is armed when system
is power on, and disabled before handling system control to
OS, while UEFI boot services watchdog is only armed before
invoking a boot option. So they are two different watchdogs.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ming Huang 
---
 Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf |  
2 ++
 Silicon/Hisilicon/Include/Library/IpmiCmdLib.h  | 
16 ++
 Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBm.c   | 
22 
 3 files changed, 40 insertions(+)

diff --git 
a/Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf 
b/Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
index a093f13fb0..b9458b0ade 100644
--- 
a/Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
+++ 
b/Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
@@ -46,6 +46,7 @@
   DebugLib
   DevicePathLib
   DxeServicesLib
+  IpmiCmdLib
   MemoryAllocationLib
   PcdLib
   PrintLib
@@ -69,6 +70,7 @@
   gEfiEndOfDxeEventGroupGuid
   gEfiTtyTermGuid
   gHisiOemVariableGuid
+  gOemConfigGuid
 
 [Protocols]
   gEfiGenericMemTestProtocolGuid
diff --git a/Silicon/Hisilicon/Include/Library/IpmiCmdLib.h 
b/Silicon/Hisilicon/Include/Library/IpmiCmdLib.h
index 8868b76135..b956ee6d07 100644
--- a/Silicon/Hisilicon/Include/Library/IpmiCmdLib.h
+++ b/Silicon/Hisilicon/Include/Library/IpmiCmdLib.h
@@ -19,6 +19,17 @@
 #define BOOT_OPTION_BOOT_FLAG_VALID 1
 #define BOOT_OPTION_BOOT_FLAG_INVALID   0
 
+typedef enum {
+  EfiReserved,
+  EfiBiosFrb2,
+  EfiBiosPost,
+  EfiOsLoad,
+  EfiSmsOs,
+  EfiOem,
+  EfiFrbReserved1,
+  EfiFrbReserved2
+} EFI_WDT_USER_TYPE;
+
 typedef enum {
   NoOverride = 0x0,
   ForcePxe,
@@ -91,4 +102,9 @@ IpmiCmdGetSysBootOptions (
   IN IPMI_GET_BOOT_OPTION   *BootOption
   );
 
+EFI_STATUS
+IpmiCmdStopWatchdogTimer (
+  IN EFI_WDT_USER_TYPE  UserType
+  );
+
 #endif
diff --git a/Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBm.c 
b/Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBm.c
index d5f6d78fa4..b63818cbe4 100644
--- a/Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBm.c
+++ b/Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBm.c
@@ -19,6 +19,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -615,6 +617,8 @@ PlatformBootManagerAfterConsole (
 {
   EFI_STATUS Status;
   ESRT_MANAGEMENT_PROTOCOL   *EsrtManagement = NULL;
+  OEM_CONFIG_DATASetupData;
+  UINTN  DataSize = sizeof (OEM_CONFIG_DATA);
 
   //
   // Show the splash screen.
@@ -651,6 +655,24 @@ PlatformBootManagerAfterConsole (
 );
 
   HandleBmcBootType ();
+
+  //Disable POST Watch Dog before attempting boot
+  Status = gRT->GetVariable (
+  OEM_CONFIG_NAME,
+  ,
+  NULL,
+  ,
+  
+  );
+
+  if (!EFI_ERROR (Status)) {
+if (SetupData.BmcWdtEnable) {
+  Status = IpmiCmdStopWatchdogTimer (EfiBiosPost);
+  if (EFI_ERROR (Status)) {
+DEBUG ((DEBUG_ERROR, "%a:%r\n", __FUNCTION__, Status));
+  }
+}
+  }
 }
 
 /**
-- 
2.17.0

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


[edk2] [PATCH edk2-platforms v2 14/43] Silicon/Hisilicon/D06: Wait for all disk ready

2018-08-14 Thread Ming Huang
This patch is relative to D06 SasDxe driver. The SasDxe set a
variable to notice this libray. Here Wait for all disk ready
for 15S at most.

D06:
For using straight-through hard disk backboard, some disk need
15 seconds to ready. Actually, wait less 15 seconds here(minus
the time from end of SAS driver to here).
For using expander backboard, wait less 6 seconds here(minus
the time from end of SAS driver to here).

D03/D05:
As Sas driver don't write the SASDiskInfo variable, D03/D05 will
break the loop, so it no waiting here.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ming Huang 
---
 Silicon/Hisilicon/HisiPkg.dec   |  
1 +
 Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf |  
2 +
 Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBm.c   | 
43 
 3 files changed, 46 insertions(+)

diff --git a/Silicon/Hisilicon/HisiPkg.dec b/Silicon/Hisilicon/HisiPkg.dec
index 35bea970ec..b56a6a6af7 100644
--- a/Silicon/Hisilicon/HisiPkg.dec
+++ b/Silicon/Hisilicon/HisiPkg.dec
@@ -45,6 +45,7 @@
 
   gHisiEfiMemoryMapGuid  = {0xf8870015, 0x6994, 0x4b98, {0x95, 0xa2, 0xbd, 
0x56, 0xda, 0x91, 0xc0, 0x7f}}
   gVersionInfoHobGuid = {0xe13a14c, 0x859c, 0x4f22, {0x82, 0xbd, 0x18, 0xe, 
0xe1, 0x42, 0x12, 0xbf}}
+  gHisiOemVariableGuid = {0xac62b9a5, 0x9939, 0x41d3, {0xff, 0x5c, 0xc5, 0x80, 
0x32, 0x7d, 0x9b, 0x29}}
   gOemBootVariableGuid = {0xb7784577, 0x5aaf, 0x4557, {0xa1, 0x99, 0xd4, 0xa4, 
0x2f, 0x45, 0x06, 0xf8}}
   gEfiHisiSocControllerGuid = {0xee369cc3, 0xa743, 0x5382, {0x75, 0x64, 0x53, 
0xe4, 0x31, 0x19, 0x38, 0x35}}
 
diff --git 
a/Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf 
b/Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
index 7a53befc44..a093f13fb0 100644
--- 
a/Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
+++ 
b/Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
@@ -49,6 +49,7 @@
   MemoryAllocationLib
   PcdLib
   PrintLib
+  TimerLib
   UefiBootManagerLib
   UefiBootServicesTableLib
   UefiLib
@@ -67,6 +68,7 @@
 [Guids]
   gEfiEndOfDxeEventGroupGuid
   gEfiTtyTermGuid
+  gHisiOemVariableGuid
 
 [Protocols]
   gEfiGenericMemTestProtocolGuid
diff --git a/Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBm.c 
b/Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBm.c
index 7dd5ba615c..d5f6d78fa4 100644
--- a/Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBm.c
+++ b/Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBm.c
@@ -20,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -554,6 +555,47 @@ PlatformBootManagerBeforeConsole (
   PlatformRegisterOptionsAndKeys ();
 }
 
+STATIC
+VOID
+WaitForDiskReady (
+  )
+{
+  EFI_STATUSStatus;
+  UINT32Index;
+  UINTN DataSize;
+  UINT32DiskInfo;
+  UINT8 IsFinished;
+
+  Status = EFI_NOT_FOUND;
+  DataSize = sizeof (UINT32);
+  // Wait for 15 seconds at most.
+  for (Index = 0; Index < 15; Index++) {
+Status = gRT->GetVariable (
+L"SASDiskInfo",
+,
+NULL,
+,
+
+);
+if (EFI_ERROR(Status)) {
+  DEBUG ((DEBUG_ERROR, "Get DiskInfo:%r\n", Status));
+  break;
+}
+
+IsFinished = (UINT8)(DiskInfo >> 24);
+if (IsFinished) {
+  break;
+}
+DEBUG ((DEBUG_ERROR, "%a", Index == 0 ? "Wait for disk." : "."));
+MicroSecondDelay(1000 * 1000);
+  }
+
+  if (!EFI_ERROR (Status)) {
+DEBUG ((DEBUG_ERROR, "DiskInfo:%x\n", DiskInfo));
+EfiBootManagerConnectAll ();
+  }
+}
+
 /**
   Do the platform specific action after the console is ready
   Possible things that can be done in PlatformBootManagerAfterConsole:
@@ -583,6 +625,7 @@ PlatformBootManagerAfterConsole (
   // Connect the rest of the devices.
   //
   EfiBootManagerConnectAll ();
+  WaitForDiskReady ();
 
   //
   // Enumerate all possible boot options.
-- 
2.17.0

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


[edk2] [PATCH edk2-platforms v2 13/43] Hisilicon/D06: Add OemMiscLibD06

2018-08-14 Thread Ming Huang
This library include BoardFeatureD06.c and OemMiscLibD06.c c file,
use for several modules like PciHostBridgeLib and Smbios.
Enlarge macro PCIEDEVICE_REPORT_MAX for D06.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ming Huang 
---
 Platform/Hisilicon/D06/D06.dsc  |   1 +
 Platform/Hisilicon/D06/Library/OemMiscLibD06/OemMiscLibD06.inf  |  47 
+++
 Silicon/Hisilicon/Include/Library/OemMiscLib.h  |   6 
+-
 Platform/Hisilicon/D06/Library/OemMiscLibD06/BoardFeatureD06.c  | 432 

 Platform/Hisilicon/D06/Library/OemMiscLibD06/OemMiscLibD06.c| 132 
++
 Platform/Hisilicon/D06/Library/OemMiscLibD06/BoardFeatureD06Strings.uni |  64 
+++
 6 files changed, 681 insertions(+), 1 deletion(-)

diff --git a/Platform/Hisilicon/D06/D06.dsc b/Platform/Hisilicon/D06/D06.dsc
index 94454569f6..9ca7160dad 100644
--- a/Platform/Hisilicon/D06/D06.dsc
+++ b/Platform/Hisilicon/D06/D06.dsc
@@ -70,6 +70,7 @@
 
   TimeBaseLib|EmbeddedPkg/Library/TimeBaseLib/TimeBaseLib.inf
   
RealTimeClockLib|Silicon/Hisilicon/Library/M41T83RealTimeClockLib/M41T83RealTimeClockLib.inf
+  OemMiscLib|Platform/Hisilicon/D06/Library/OemMiscLibD06/OemMiscLibD06.inf
   
OemAddressMapLib|Platform/Hisilicon/D06/Library/OemAddressMapD06/OemAddressMapD06.inf
   
PlatformSysCtrlLib|Silicon/Hisilicon/Hi1620/Library/PlatformSysCtrlLibHi1620/PlatformSysCtrlLibHi1620.inf
 
diff --git a/Platform/Hisilicon/D06/Library/OemMiscLibD06/OemMiscLibD06.inf 
b/Platform/Hisilicon/D06/Library/OemMiscLibD06/OemMiscLibD06.inf
new file mode 100644
index 00..8f68f7cec5
--- /dev/null
+++ b/Platform/Hisilicon/D06/Library/OemMiscLibD06/OemMiscLibD06.inf
@@ -0,0 +1,47 @@
+#/** @file
+#
+#Copyright (c) 2018, Hisilicon Limited. All rights reserved.
+#Copyright (c) 2018, Linaro Limited. 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.
+#
+#**/
+
+[Defines]
+  INF_VERSION= 0x0001001A
+  BASE_NAME  = OemMiscLib
+  FILE_GUID  = 3002911C-C160-4C46-93BB-782846673EEA
+  MODULE_TYPE= BASE
+  VERSION_STRING = 1.0
+  LIBRARY_CLASS  = OemMiscLib
+
+[Sources.common]
+  BoardFeatureD06.c
+  BoardFeatureD06Strings.uni
+  OemMiscLibD06.c
+
+[Packages]
+  ArmPkg/ArmPkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+  MdePkg/MdePkg.dec
+  Silicon/Hisilicon/HisiPkg.dec
+
+[LibraryClasses]
+  PcdLib
+  SerdesLib
+  TimerLib
+
+[Ppis]
+  gEfiPeiReadOnlyVariable2PpiGuid   ## SOMETIMES_CONSUMES
+
+[Pcd]
+  gArmTokenSpaceGuid.PcdArmArchTimerFreqInHz
+  gHisiTokenSpaceGuid.PcdIsMPBoot
+  gHisiTokenSpaceGuid.PcdSocketMask
+  gHisiTokenSpaceGuid.PcdTrustedFirmwareEnable
diff --git a/Silicon/Hisilicon/Include/Library/OemMiscLib.h 
b/Silicon/Hisilicon/Include/Library/OemMiscLib.h
index 87cb498dd7..efecb9aa77 100644
--- a/Silicon/Hisilicon/Include/Library/OemMiscLib.h
+++ b/Silicon/Hisilicon/Include/Library/OemMiscLib.h
@@ -22,7 +22,11 @@
 #include 
 #include 
 
-#define PCIEDEVICE_REPORT_MAX  4
+#define PCIEDEVICE_REPORT_MAX  8
+#define MAX_PROCESSOR_SOCKETS  MAX_SOCKET
+#define MAX_MEMORY_CHANNELSMAX_CHANNEL
+#define MAX_DIMM_PER_CHANNEL   MAX_DIMM
+
 typedef struct _REPORT_PCIEDIDVID2BMC{
 UINTN   Bus;
 UINTN   Device;
diff --git a/Platform/Hisilicon/D06/Library/OemMiscLibD06/BoardFeatureD06.c 
b/Platform/Hisilicon/D06/Library/OemMiscLibD06/BoardFeatureD06.c
new file mode 100644
index 00..7e3f2e2a0e
--- /dev/null
+++ b/Platform/Hisilicon/D06/Library/OemMiscLibD06/BoardFeatureD06.c
@@ -0,0 +1,432 @@
+/** @file
+*
+*  Copyright (c) 2018, Hisilicon Limited. All rights reserved.
+*  Copyright (c) 2018, Linaro Limited. 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 
+
+#include 
+
+I2C_DEVICE gRtcDevice = {
+  .Socket = 0,
+  .Port = 5,
+  .DeviceType = DEVICE_TYPE_SPD,
+  .SlaveDeviceAddress = 0x68
+};
+
+SERDES_POLARITY_INVERT gSerdesPolarityTxDesc[] =
+{
+  {SERDES_INVALID_MACRO_ID, 

[edk2] [PATCH edk2-platforms v2 18/43] Hisilicon/D06: Add Hi1620OemConfigUiLib

2018-08-14 Thread Ming Huang
From: Yang XinYi 

This library is added for oem setup menu item.
Setup item include:
1 DDR option item;
2 BMC option item;
3 Ras option item;
4 Misc option item;

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yang XinYi 
---
 Silicon/Hisilicon/HisiPkg.dec   |   1 +
 Platform/Hisilicon/D06/D06.dsc  |   5 
+-
 Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf   |   2 
+-
 Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigUiLib.inf|  68 

 Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfig.h   | 142 

 Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigUi.h |  64 

 Silicon/Hisilicon/Include/Library/OemConfigData.h   |  84 
+
 Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfig.c   | 363 

 Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/MemoryConfig.hfr  | 154 
+
 Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/MemoryConfig.uni  | 103 
++
 Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/MiscConfig.hfr|  41 
+++
 Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/MiscConfig.uni|  27 
++
 Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigUiLib.uni|  24 
++
 Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigUiLibStrings.uni |  42 
+++
 Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigVfr.Vfr  |  89 
+
 Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/PcieConfig.hfr| 219 

 Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/PcieConfigStrings.uni | 111 
++
 Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/PciePortConfig.hfr| 167 
+
 Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/RasConfig.hfr | 172 
++
 Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/RasConfig.uni |  85 
+
 Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/iBMCConfig.hfr|  81 
+
 Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/iBMCConfig.uni|  34 
++
 22 files changed, 2076 insertions(+), 2 deletions(-)

diff --git a/Silicon/Hisilicon/HisiPkg.dec b/Silicon/Hisilicon/HisiPkg.dec
index b56a6a6af7..858b840a57 100644
--- a/Silicon/Hisilicon/HisiPkg.dec
+++ b/Silicon/Hisilicon/HisiPkg.dec
@@ -44,6 +44,7 @@
   gHisiTokenSpaceGuid = {0xc8bc553e, 0x12bf, 0x11e6, {0x97, 0x4f, 0x87, 0xf7, 
0x7c, 0xfd, 0x52, 0x1d}}
 
   gHisiEfiMemoryMapGuid  = {0xf8870015, 0x6994, 0x4b98, {0x95, 0xa2, 0xbd, 
0x56, 0xda, 0x91, 0xc0, 0x7f}}
+  gOemConfigGuid = {0x42927b59, 0x58fc, 0x41be, {0x8f, 0x59, 0xd1, 0x7c, 0x02, 
0x1a, 0x70, 0x13}}
   gVersionInfoHobGuid = {0xe13a14c, 0x859c, 0x4f22, {0x82, 0xbd, 0x18, 0xe, 
0xe1, 0x42, 0x12, 0xbf}}
   gHisiOemVariableGuid = {0xac62b9a5, 0x9939, 0x41d3, {0xff, 0x5c, 0xc5, 0x80, 
0x32, 0x7d, 0x9b, 0x29}}
   gOemBootVariableGuid = {0xb7784577, 0x5aaf, 0x4557, {0xa1, 0x99, 0xd4, 0xa4, 
0x2f, 0x45, 0x06, 0xf8}}
diff --git a/Platform/Hisilicon/D06/D06.dsc b/Platform/Hisilicon/D06/D06.dsc
index 9d4a86a4f4..bec422670d 100644
--- a/Platform/Hisilicon/D06/D06.dsc
+++ b/Platform/Hisilicon/D06/D06.dsc
@@ -330,7 +330,10 @@
   #ACPI
   #
   MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
-  Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf
+  Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf {
+
+NULL|Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigUiLib.inf
+  }
 
   Silicon/Hisilicon/Hi1620/Hi1620AcpiTables/AcpiTablesHi1620.inf
   Silicon/Hisilicon/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf
diff --git a/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf 
b/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf
index e268a56bbd..281a4f2ebd 100644
--- a/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf
+++ b/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf
@@ -56,7 +56,7 @@
   gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiTableStorageFile## CONSUMES
 
 [Depex]
-  gEfiAcpiTableProtocolGuid
+  gEfiAcpiTableProtocolGuid AND gEfiVariableWriteArchProtocolGuid
 
 [UserExtensions.TianoCore."ExtraFiles"]
   AcpiPlatformExtra.uni
diff --git a/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigUiLib.inf 
b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigUiLib.inf
new file mode 100644
index 00..fba619e9ba
--- /dev/null
+++ b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigUiLib.inf
@@ -0,0 +1,68 @@
+## @file
+#  OEM config Library used by BDS
+#
+#  Copyright (c) 2018, Hisilicon Limited. All rights reserved.
+#  Copyright (c) 2018, Linaro Limited. 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
+#  

[edk2] [PATCH edk2-platforms v2 16/43] Hisilicon/D06: Add Debug Serial Port Init Driver

2018-08-14 Thread Ming Huang
From: Heyi Guo 

Hi1620 have two physical PL011 serial ports on the board,
one for serial port console (described by ACPI SPCR) and
the other for standard debug port (described by ACPI DBG2).
This driver is to initialize the debug UART, not the serial
console.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Heyi Guo 
---
 Platform/Hisilicon/D06/D06.dsc 
  |  1 +
 Platform/Hisilicon/D06/D06.fdf 
  |  1 +
 
Silicon/Hisilicon/Hi1620/Drivers/Pl011DebugSerialPortInitDxe/Pl011DebugSerialPortInitDxe.inf
 | 48 +++
 
Silicon/Hisilicon/Hi1620/Drivers/Pl011DebugSerialPortInitDxe/Pl011DebugSerialPortInitDxe.c
   | 64 
 4 files changed, 114 insertions(+)

diff --git a/Platform/Hisilicon/D06/D06.dsc b/Platform/Hisilicon/D06/D06.dsc
index 9ca7160dad..20d2d2a1b4 100644
--- a/Platform/Hisilicon/D06/D06.dsc
+++ b/Platform/Hisilicon/D06/D06.dsc
@@ -422,6 +422,7 @@
   # Memory test
   #
   MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf
+  
Silicon/Hisilicon/Hi1620/Drivers/Pl011DebugSerialPortInitDxe/Pl011DebugSerialPortInitDxe.inf
   MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
   MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
   MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
diff --git a/Platform/Hisilicon/D06/D06.fdf b/Platform/Hisilicon/D06/D06.fdf
index 07fe096f61..8cac126ccf 100644
--- a/Platform/Hisilicon/D06/D06.fdf
+++ b/Platform/Hisilicon/D06/D06.fdf
@@ -303,6 +303,7 @@ READ_LOCK_STATUS   = TRUE
   INF MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.inf
   INF MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBusDxe.inf
 
+  INF 
Silicon/Hisilicon/Hi1620/Drivers/Pl011DebugSerialPortInitDxe/Pl011DebugSerialPortInitDxe.inf
   INF MdeModulePkg/Universal/Network/SnpDxe/SnpDxe.inf
   #
   # Build Shell from latest source code instead of prebuilt binary
diff --git 
a/Silicon/Hisilicon/Hi1620/Drivers/Pl011DebugSerialPortInitDxe/Pl011DebugSerialPortInitDxe.inf
 
b/Silicon/Hisilicon/Hi1620/Drivers/Pl011DebugSerialPortInitDxe/Pl011DebugSerialPortInitDxe.inf
new file mode 100644
index 00..8c91bdf0f4
--- /dev/null
+++ 
b/Silicon/Hisilicon/Hi1620/Drivers/Pl011DebugSerialPortInitDxe/Pl011DebugSerialPortInitDxe.inf
@@ -0,0 +1,48 @@
+#/** @file
+#
+#Copyright (c) 2016 - 2018, Hisilicon Limited. All rights reserved.
+#Copyright (c) 2016 - 2018, Linaro Limited. 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.
+#
+#**/
+
+[Defines]
+  INF_VERSION= 0x0001001A
+  BASE_NAME  = Pl011DebugSerialPortInitDxe
+  FILE_GUID  = 16D53E86-7EA4-47bd-861F-511EA9B8ABE0
+  MODULE_TYPE= DXE_DRIVER
+  VERSION_STRING = 1.0
+  ENTRY_POINT= SerialPortEntry
+
+[Sources.common]
+  Pl011DebugSerialPortInitDxe.c
+
+
+[Packages]
+  ArmPlatformPkg/ArmPlatformPkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+  MdePkg/MdePkg.dec
+  Silicon/Hisilicon/HisiPkg.dec
+
+[LibraryClasses]
+  BaseLib
+  UefiDriverEntryPoint
+
+[Pcd]
+  gArmPlatformTokenSpaceGuid.PL011UartClkInHz
+  gArmPlatformTokenSpaceGuid.PcdSerialDbgRegisterBase
+  gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate
+  gEfiMdePkgTokenSpaceGuid.PcdUartDefaultDataBits
+  gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity
+  gEfiMdePkgTokenSpaceGuid.PcdUartDefaultStopBits
+
+[Depex]
+  TRUE
+
diff --git 
a/Silicon/Hisilicon/Hi1620/Drivers/Pl011DebugSerialPortInitDxe/Pl011DebugSerialPortInitDxe.c
 
b/Silicon/Hisilicon/Hi1620/Drivers/Pl011DebugSerialPortInitDxe/Pl011DebugSerialPortInitDxe.c
new file mode 100644
index 00..8f83737327
--- /dev/null
+++ 
b/Silicon/Hisilicon/Hi1620/Drivers/Pl011DebugSerialPortInitDxe/Pl011DebugSerialPortInitDxe.c
@@ -0,0 +1,64 @@
+/** @file
+
+Copyright (c) 2016 - 2018, Hisilicon Limited. All rights reserved.
+Copyright (c) 2016 - 2018, Linaro Limited. 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 
+
+RETURN_STATUS
+EFIAPI

[edk2] [PATCH edk2-platforms v2 20/43] Hisilicon/I2C: Modify I2CLib.c for coding style

2018-08-14 Thread Ming Huang
Correct coding style for I2CLib.c before adding other I2CLib patches.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ming Huang 
---
 Silicon/Hisilicon/Library/I2CLib/I2CLib.c | 1034 ++--
 1 file changed, 499 insertions(+), 535 deletions(-)

diff --git a/Silicon/Hisilicon/Library/I2CLib/I2CLib.c 
b/Silicon/Hisilicon/Library/I2CLib/I2CLib.c
index b5b388d756..f03d55d6b2 100644
--- a/Silicon/Hisilicon/Library/I2CLib/I2CLib.c
+++ b/Silicon/Hisilicon/Library/I2CLib/I2CLib.c
@@ -16,640 +16,604 @@
 
 
 #include 
-#include 
-#include 
 #include 
 #include 
+#include 
 #include 
 #include 
+#include 
 
 #include 
 
 #include "I2CLibInternal.h"
 #include "I2CHw.h"
 
-VOID I2C_Delay(UINT32 ulCount)
+VOID
+I2C_Delay (
+  UINT32 Count
+  )
 {
-MicroSecondDelay(ulCount);
-return;
+  MicroSecondDelay (Count);
+  return;
 }
 
 
 EFI_STATUS
 EFIAPI
-I2C_Disable(UINT32 Socket,UINT8 Port)
+I2C_Disable (
+  UINT32 Socket,
+  UINT8  Port
+  )
 {
-UINT32  ulTimeCnt = I2C_READ_TIMEOUT;
-I2C0_STATUS_U   I2cStatusReg;
-I2C0_ENABLE_U   I2cEnableReg;
-I2C0_ENABLE_STATUS_UI2cEnableStatusReg;
+  UINT32  TimeCnt = I2C_READ_TIMEOUT;
+  I2C0_STATUS_U   I2cStatusReg;
+  I2C0_ENABLE_U   I2cEnableReg;
+  I2C0_ENABLE_STATUS_UI2cEnableStatusReg;
 
-UINTN Base = GetI2cBase(Socket, Port);
+  UINTN Base = GetI2cBase (Socket, Port);
 
-I2C_REG_READ((Base + I2C_STATUS_OFFSET), I2cStatusReg.Val32);
+  I2C_REG_READ ((Base + I2C_STATUS_OFFSET), I2cStatusReg.Val32);
 
-while (I2cStatusReg.bits.activity)
-{
-I2C_Delay(1);
+  while (I2cStatusReg.bits.activity) {
+I2C_Delay (1);
 
-ulTimeCnt--;
-I2C_REG_READ(Base + I2C_STATUS_OFFSET, I2cStatusReg.Val32);
-if (0 == ulTimeCnt)
-{
-return EFI_DEVICE_ERROR;
-}
+TimeCnt--;
+I2C_REG_READ (Base + I2C_STATUS_OFFSET, I2cStatusReg.Val32);
+if (TimeCnt == 0) {
+  return EFI_DEVICE_ERROR;
 }
+  }
 
+  I2C_REG_READ (Base + I2C_ENABLE_OFFSET, I2cEnableReg.Val32);
+  I2cEnableReg.bits.enable = 0;
+  I2C_REG_WRITE (Base + I2C_ENABLE_OFFSET, I2cEnableReg.Val32);
 
-I2C_REG_READ(Base + I2C_ENABLE_OFFSET, I2cEnableReg.Val32);
-I2cEnableReg.bits.enable = 0;
-I2C_REG_WRITE(Base + I2C_ENABLE_OFFSET,I2cEnableReg.Val32);
-
-I2C_REG_READ(Base + I2C_ENABLE_OFFSET,I2cEnableStatusReg.Val32);
-if (0 == I2cEnableStatusReg.bits.ic_en)
-{
-return EFI_SUCCESS;
-}
-else
-{
-return EFI_DEVICE_ERROR;
-}
+  I2C_REG_READ (Base + I2C_ENABLE_OFFSET, I2cEnableStatusReg.Val32);
+  if (I2cEnableStatusReg.bits.ic_en == 0) {
+return EFI_SUCCESS;
+  } else {
+return EFI_DEVICE_ERROR;
+  }
 }
 
 
 EFI_STATUS
 EFIAPI
-I2C_Enable(UINT32 Socket,UINT8 Port)
+I2C_Enable (
+  UINT32 Socket,
+  UINT8  Port
+  )
 {
-I2C0_ENABLE_U   I2cEnableReg;
-I2C0_ENABLE_STATUS_UI2cEnableStatusReg;
+  I2C0_ENABLE_U   I2cEnableReg;
+  I2C0_ENABLE_STATUS_UI2cEnableStatusReg;
 
-UINTN Base = GetI2cBase(Socket, Port);
+  UINTN Base = GetI2cBase (Socket, Port);
 
+  I2C_REG_READ (Base + I2C_ENABLE_OFFSET, I2cEnableReg.Val32);
+  I2cEnableReg.bits.enable = 1;
+  I2C_REG_WRITE (Base + I2C_ENABLE_OFFSET, I2cEnableReg.Val32);
 
-I2C_REG_READ(Base + I2C_ENABLE_OFFSET, I2cEnableReg.Val32);
-I2cEnableReg.bits.enable = 1;
-I2C_REG_WRITE(Base + I2C_ENABLE_OFFSET, I2cEnableReg.Val32);
 
-
-I2C_REG_READ(Base + I2C_ENABLE_STATUS_OFFSET, I2cEnableStatusReg.Val32);
-if (1 == I2cEnableStatusReg.bits.ic_en)
-{
-return EFI_SUCCESS;
-}
-else
-{
-return EFI_DEVICE_ERROR;
-}
+  I2C_REG_READ (Base + I2C_ENABLE_STATUS_OFFSET, I2cEnableStatusReg.Val32);
+  if (I2cEnableStatusReg.bits.ic_en == 1) {
+return EFI_SUCCESS;
+  } else {
+return EFI_DEVICE_ERROR;
+  }
 }
 
-void I2C_SetTarget(UINT32 Socket,UINT8 Port,UINT32 I2cDeviceAddr)
+VOID
+I2C_SetTarget (
+  UINT32 Socket,
+  UINT8  Port,
+  UINT32 I2cDeviceAddr
+  )
 {
-I2C0_TAR_UI2cTargetReg;
-UINTN Base = GetI2cBase(Socket, Port);
+  I2C0_TAR_UI2cTargetReg;
 
+  UINTN Base = GetI2cBase (Socket, Port);
 
-I2C_REG_READ(Base + I2C_TAR_OFFSET, I2cTargetReg.Val32);
-I2cTargetReg.bits.ic_tar = I2cDeviceAddr;
-I2C_REG_WRITE(Base + I2C_TAR_OFFSET, I2cTargetReg.Val32);
+  I2C_REG_READ (Base + I2C_TAR_OFFSET, I2cTargetReg.Val32);
+  I2cTargetReg.bits.ic_tar = I2cDeviceAddr;
+  I2C_REG_WRITE (Base + I2C_TAR_OFFSET, I2cTargetReg.Val32);
 
-return;
+  return;
 }
 
 
 EFI_STATUS
 EFIAPI
-I2CInit(UINT32 Socket, UINT32 Port, SPEED_MODE SpeedMode)
+I2CInit (
+  UINT32 Socket,
+  UINT32 Port,
+  SPEED_MODE SpeedMode
+  )
 {
-I2C0_CON_U  I2cControlReg;
-I2C0_SS_SCL_HCNT_U  I2cStandardSpeedSclHighCount;
-I2C0_SS_SCL_LCNT_U  I2cStandardSpeedSclLowCount;
-I2C0_RX_TL_UI2cRxFifoReg;

[edk2] [PATCH edk2-platforms v2 15/43] Silicon/Hisilicon/Acpi: Unify HisiAcipPlatformDxe

2018-08-14 Thread Ming Huang
The EFI_ACPI_STATIC_RESOURCE_AFFINITY_TABLE struct is used by
UpdateAcpiTable.c and Srat aslc. The struct may be different
according to chips, so move some macro to PlatformArch.h.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ming Huang 
---
 Silicon/Hisilicon/Hi1610/Include/PlatformArch.h |  6 
 Silicon/Hisilicon/Hi1620/Include/PlatformArch.h |  6 
 Silicon/Hisilicon/Include/Library/AcpiNextLib.h | 31 
++--
 Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/UpdateAcpiTable.c |  2 --
 4 files changed, 34 insertions(+), 11 deletions(-)

diff --git a/Silicon/Hisilicon/Hi1610/Include/PlatformArch.h 
b/Silicon/Hisilicon/Hi1610/Include/PlatformArch.h
index f39ae0748c..1ebddca4e5 100644
--- a/Silicon/Hisilicon/Hi1610/Include/PlatformArch.h
+++ b/Silicon/Hisilicon/Hi1610/Include/PlatformArch.h
@@ -30,6 +30,12 @@
 // Max NUMA node number for each node type
 #define MAX_NUM_PER_TYPE 8
 
+// for acpi
+#define NODE_IN_SOCKET  2
+#define CORE_NUM_PER_SOCKET 32
+#define EFI_ACPI_MEMORY_AFFINITY_STRUCTURE_COUNT10
+#define EFI_ACPI_6_2_ITS_AFFINITY_STRUCTURE_COUNT   8
+
 #define S1_BASE   0x400
 
 #define RASC_BASE(0x5000)
diff --git a/Silicon/Hisilicon/Hi1620/Include/PlatformArch.h 
b/Silicon/Hisilicon/Hi1620/Include/PlatformArch.h
index 9539cfdada..f3ad45f6c6 100644
--- a/Silicon/Hisilicon/Hi1620/Include/PlatformArch.h
+++ b/Silicon/Hisilicon/Hi1620/Include/PlatformArch.h
@@ -57,5 +57,11 @@
   EFI_ACPI_ARM_CREATOR_REVISION   /* UINT32  CreatorRevision */ \
   }
 
+// for acpi
+#define NODE_IN_SOCKET  2
+#define CORE_NUM_PER_SOCKET 48
+#define EFI_ACPI_MEMORY_AFFINITY_STRUCTURE_COUNT16
+#define EFI_ACPI_6_2_ITS_AFFINITY_STRUCTURE_COUNT   1
+
 #endif
 
diff --git a/Silicon/Hisilicon/Include/Library/AcpiNextLib.h 
b/Silicon/Hisilicon/Include/Library/AcpiNextLib.h
index fd05a3b960..2abffb65fc 100644
--- a/Silicon/Hisilicon/Include/Library/AcpiNextLib.h
+++ b/Silicon/Hisilicon/Include/Library/AcpiNextLib.h
@@ -19,6 +19,21 @@
 #ifndef __ACPI_NEXT_LIB_H__
 #define __ACPI_NEXT_LIB_H__
 
+#include 
+
+///
+/// ITS Affinity Structure Definition
+///
+#pragma pack(1)
+typedef struct {
+  UINT8   Type;
+  UINT8   Length;
+  UINT32  ProximityDomain;
+  UINT16  Reserved;
+  UINT32  ItsHwId;
+} EFI_ACPI_6_2_ITS_AFFINITY_STRUCTURE;
+#pragma pack()
+
 #define EFI_ACPI_6_1_GIC_ITS_INIT(GicITSHwId, GicITSBase) \
   { \
 EFI_ACPI_6_1_GIC_ITS, sizeof (EFI_ACPI_6_1_GIC_ITS_STRUCTURE), 
EFI_ACPI_RESERVED_WORD, \
@@ -42,8 +57,8 @@
 #define EFI_ACPI_6_2_ITS_AFFINITY_STRUCTURE_INIT(  
 \
 ProximityDomain, ItsId)
 \
   {
 \
-4, sizeof (EFI_ACPI_6_2_GIC_ITS_AFFINITY_STRUCTURE), ProximityDomain,  
 \
-{EFI_ACPI_RESERVED_BYTE, EFI_ACPI_RESERVED_BYTE}, ItsId
   \
+4, sizeof (EFI_ACPI_6_2_ITS_AFFINITY_STRUCTURE), ProximityDomain,  
 \
+EFI_ACPI_RESERVED_WORD, ItsId  
 \
   }
 
 #define EFI_ACPI_6_1_MEMORY_AFFINITY_STRUCTURE_INIT(   
   \
@@ -75,15 +90,13 @@
 // Define the number of each table type.
 // This is where the table layout is modified.
 //
-#define EFI_ACPI_PROCESSOR_LOCAL_GICC_AFFINITY_STRUCTURE_COUNT  64
-#define EFI_ACPI_MEMORY_AFFINITY_STRUCTURE_COUNT10
-#define EFI_ACPI_6_2_ITS_AFFINITY_STRUCTURE_COUNT   8
+#define EFI_ACPI_PROCESSOR_LOCAL_GICC_AFFINITY_STRUCTURE_COUNT  
(MAX_SOCKET*CORE_NUM_PER_SOCKET)
 
 typedef struct {
-  EFI_ACPI_6_0_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER  Header;
-  EFI_ACPI_6_0_MEMORY_AFFINITY_STRUCTURE  
Memory[EFI_ACPI_MEMORY_AFFINITY_STRUCTURE_COUNT];
-  EFI_ACPI_6_0_GICC_AFFINITY_STRUCTURE
Gicc[EFI_ACPI_PROCESSOR_LOCAL_GICC_AFFINITY_STRUCTURE_COUNT];
-  EFI_ACPI_6_2_GIC_ITS_AFFINITY_STRUCTURE 
Its[EFI_ACPI_6_2_ITS_AFFINITY_STRUCTURE_COUNT];
+  EFI_ACPI_6_2_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER  Header;
+  EFI_ACPI_6_2_MEMORY_AFFINITY_STRUCTURE  
Memory[EFI_ACPI_MEMORY_AFFINITY_STRUCTURE_COUNT];
+  EFI_ACPI_6_2_GICC_AFFINITY_STRUCTURE
Gicc[EFI_ACPI_PROCESSOR_LOCAL_GICC_AFFINITY_STRUCTURE_COUNT];
+  EFI_ACPI_6_2_ITS_AFFINITY_STRUCTURE 
Its[EFI_ACPI_6_2_ITS_AFFINITY_STRUCTURE_COUNT];
 } EFI_ACPI_STATIC_RESOURCE_AFFINITY_TABLE;
 
 #pragma pack()
diff --git a/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/UpdateAcpiTable.c 

  1   2   >