public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v2 0/4] support HiKey960
@ 2018-02-09 17:31 Haojian Zhuang
  2018-02-09 17:31 ` [PATCH v2 1/4] Platform/Hisilicon/HiKey: include DxePcdLib for HiiDatabase Haojian Zhuang
                   ` (3 more replies)
  0 siblings, 4 replies; 19+ messages in thread
From: Haojian Zhuang @ 2018-02-09 17:31 UTC (permalink / raw)
  To: edk2-devel, linaro-uefi, leif.lindholm, ard.sheuvel, heyi.guo
  Cc: Haojian Zhuang

v2:
  * Use Hisilicon common file.
  * Move SerialPorLib & DebugLib of DXE_RUNTIME out of Hisilicon.dsc.inc.
  * Remove unused PCD values from HiKey960 dsc file.
  * Fix to enter boot manager on HiKey.

v1:
  * Support the skeleton of HiKey960.

Haojian Zhuang (4):
  Platform/Hisilicon/HiKey: include DxePcdLib for HiiDatabase
  Platform/Hisilicon/HiKey: use Hisilicon common file
  Platform/Hisilicon: move out dxe runtime lib from common file
  Platform/Hisilicon/HiKey960: add skeleton of HiKey960

 Platform/Hisilicon/D02/Pv660D02.dsc                |   2 +
 Platform/Hisilicon/D03/D03.dsc                     |   1 +
 Platform/Hisilicon/D05/D05.dsc                     |   1 +
 Platform/Hisilicon/HiKey/HiKey.dsc                 | 211 ++---------------
 Platform/Hisilicon/HiKey/HiKey.fdf                 | 141 +----------
 Platform/Hisilicon/HiKey960/HiKey960.dsc           | 260 +++++++++++++++++++++
 Platform/Hisilicon/HiKey960/HiKey960.fdf           | 214 +++++++++++++++++
 .../HiKey960/Library/HiKey960Lib/HiKey960.c        | 144 ++++++++++++
 .../HiKey960/Library/HiKey960Lib/HiKey960Helper.S  |  52 +++++
 .../HiKey960/Library/HiKey960Lib/HiKey960Lib.inf   |  44 ++++
 .../HiKey960/Library/HiKey960Lib/HiKey960Mem.c     | 163 +++++++++++++
 Silicon/Hisilicon/Hisilicon.dsc.inc                |   2 -
 12 files changed, 905 insertions(+), 330 deletions(-)
 create mode 100644 Platform/Hisilicon/HiKey960/HiKey960.dsc
 create mode 100644 Platform/Hisilicon/HiKey960/HiKey960.fdf
 create mode 100644 Platform/Hisilicon/HiKey960/Library/HiKey960Lib/HiKey960.c
 create mode 100644 Platform/Hisilicon/HiKey960/Library/HiKey960Lib/HiKey960Helper.S
 create mode 100644 Platform/Hisilicon/HiKey960/Library/HiKey960Lib/HiKey960Lib.inf
 create mode 100644 Platform/Hisilicon/HiKey960/Library/HiKey960Lib/HiKey960Mem.c

-- 
2.7.4



^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH v2 1/4] Platform/Hisilicon/HiKey: include DxePcdLib for HiiDatabase
  2018-02-09 17:31 [PATCH v2 0/4] support HiKey960 Haojian Zhuang
@ 2018-02-09 17:31 ` Haojian Zhuang
  2018-02-12 11:45   ` Leif Lindholm
  2018-02-09 17:31 ` [PATCH v2 2/4] Platform/Hisilicon/HiKey: use Hisilicon common file Haojian Zhuang
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 19+ messages in thread
From: Haojian Zhuang @ 2018-02-09 17:31 UTC (permalink / raw)
  To: edk2-devel, linaro-uefi, leif.lindholm, ard.sheuvel, heyi.guo
  Cc: Haojian Zhuang

Include DxePcdLib for HiiDatabase. Otherwise, PlatformBootManager
can't be launched successfully.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
---
 Platform/Hisilicon/HiKey/HiKey.dsc | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/Platform/Hisilicon/HiKey/HiKey.dsc b/Platform/Hisilicon/HiKey/HiKey.dsc
index e8cb957..c7d931e 100644
--- a/Platform/Hisilicon/HiKey/HiKey.dsc
+++ b/Platform/Hisilicon/HiKey/HiKey.dsc
@@ -1,5 +1,5 @@
 #
-#  Copyright (c) 2014-2017, Linaro Limited. All rights reserved.
+#  Copyright (c) 2014-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
@@ -422,7 +422,10 @@
   # Bds
   #
   MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
-  MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
+  MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf {
+    <LibraryClasses>
+      PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
+  }
   MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
   MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
   MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v2 2/4] Platform/Hisilicon/HiKey: use Hisilicon common file
  2018-02-09 17:31 [PATCH v2 0/4] support HiKey960 Haojian Zhuang
  2018-02-09 17:31 ` [PATCH v2 1/4] Platform/Hisilicon/HiKey: include DxePcdLib for HiiDatabase Haojian Zhuang
@ 2018-02-09 17:31 ` Haojian Zhuang
  2018-02-12 11:46   ` Leif Lindholm
  2018-02-09 17:31 ` [PATCH v2 3/4] Platform/Hisilicon: move out dxe runtime lib from " Haojian Zhuang
  2018-02-09 17:31 ` [PATCH v2 4/4] Platform/Hisilicon/HiKey960: add skeleton of HiKey960 Haojian Zhuang
  3 siblings, 1 reply; 19+ messages in thread
From: Haojian Zhuang @ 2018-02-09 17:31 UTC (permalink / raw)
  To: edk2-devel, linaro-uefi, leif.lindholm, ard.sheuvel, heyi.guo
  Cc: Haojian Zhuang

Use common file Hisilicon.dsc.inc/Hisilicon.fdf.inc to reduce
redundant contents in both HiKey.dsc and HiKey.fdf.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
---
 Platform/Hisilicon/HiKey/HiKey.dsc | 204 +++----------------------------------
 Platform/Hisilicon/HiKey/HiKey.fdf | 141 ++-----------------------
 2 files changed, 19 insertions(+), 326 deletions(-)

diff --git a/Platform/Hisilicon/HiKey/HiKey.dsc b/Platform/Hisilicon/HiKey/HiKey.dsc
index c7d931e..b0f8a93 100644
--- a/Platform/Hisilicon/HiKey/HiKey.dsc
+++ b/Platform/Hisilicon/HiKey/HiKey.dsc
@@ -20,152 +20,55 @@
   PLATFORM_GUID                  = 8edf1480-da5c-4857-bc02-7530bd8e7b7a
   PLATFORM_VERSION               = 0.2
   DSC_SPECIFICATION              = 0x00010019
-  OUTPUT_DIRECTORY               = Build/HiKey
+  OUTPUT_DIRECTORY               = Build/$(PLATFORM_NAME)
   SUPPORTED_ARCHITECTURES        = AARCH64
   BUILD_TARGETS                  = DEBUG|RELEASE
   SKUID_IDENTIFIER               = DEFAULT
-  FLASH_DEFINITION               = Platform/Hisilicon/HiKey/HiKey.fdf
+  FLASH_DEFINITION               = Platform/Hisilicon/$(PLATFORM_NAME)/$(PLATFORM_NAME).fdf
 
-[LibraryClasses.common]
-!if $(TARGET) == RELEASE
-  DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
-!else
-  DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
-!endif
-  DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
-
-  ArmDisassemblerLib|ArmPkg/Library/ArmDisassemblerLib/ArmDisassemblerLib.inf
-  ArmGicLib|ArmPkg/Drivers/ArmGic/ArmGicLib.inf
-  ArmGicArchLib|ArmPkg/Library/ArmGicArchLib/ArmGicArchLib.inf
-  ArmHvcLib|ArmPkg/Library/ArmHvcLib/ArmHvcLib.inf
-  ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf
-  ArmGenericTimerCounterLib|ArmPkg/Library/ArmGenericTimerPhyCounterLib/ArmGenericTimerPhyCounterLib.inf
+!include Silicon/Hisilicon/Hisilicon.dsc.inc
 
+[LibraryClasses.common]
   ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf
-  ArmMmuLib|ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf
   ArmPlatformLib|Platform/Hisilicon/HiKey/Library/HiKeyLib/HiKeyLib.inf
-  ArmPlatformStackLib|ArmPlatformPkg/Library/ArmPlatformStackLib/ArmPlatformStackLib.inf
-
-  BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
-  BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
-  CacheMaintenanceLib|ArmPkg/Library/ArmCacheMaintenanceLib/ArmCacheMaintenanceLib.inf
-  DefaultExceptionHandlerLib|ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLib.inf
-  CpuExceptionHandlerLib|ArmPkg/Library/ArmExceptionLib/ArmExceptionLib.inf
-  CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
-  DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.inf
-  DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
-  DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
-  ResetSystemLib|ArmPkg/Library/ArmSmcPsciResetSystemLib/ArmSmcPsciResetSystemLib.inf
-  MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
-  SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
-
-  FdtLib|EmbeddedPkg/Library/FdtLib/FdtLib.inf
+
   CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
   UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
+
   PlatformBootManagerLib|ArmPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
-  BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
   CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
 
-  ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
-  FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
-  SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
-
   # UiApp dependencies
   ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
   FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf
   DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
+  BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
 
-  HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
-  IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
-  HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
-  UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf
-  TimerLib|ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf
-  UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf
-  UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
-  UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
-
-  PL011UartLib|ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.inf
   SerialPortLib|ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf
   RealTimeClockLib|ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.inf
   TimeBaseLib|EmbeddedPkg/Library/TimeBaseLib/TimeBaseLib.inf
 
-  NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
-
-  #
-  # Assume everything is fixed at build
-  #
-  PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
-
-  PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
-  PeCoffExtraActionLib|ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCoffExtraActionLib.inf
-  PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
-  PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
-  PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
-  UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
-  UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
-  UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf
-  UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
-
   # USB Requirements
   UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf
 
   # Network Libraries
-  UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
   NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
   DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
   IpIoLib|MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.inf
   UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf
 
-  # It is not possible to prevent compilers from generating calls to generic
-  # intrinsic functions. This library provides the intrinsic functions
-  # generated by a given compiler.
-  NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
-
-  # Add support for GCC stack protector
-  NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
-
 [LibraryClasses.common.SEC]
   PrePiLib|EmbeddedPkg/Library/PrePiLib/PrePiLib.inf
   ExtractGuidedSectionLib|EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.inf
-  LzmaDecompressLib|IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
-  MemoryAllocationLib|EmbeddedPkg/Library/PrePiMemoryAllocationLib/PrePiMemoryAllocationLib.inf
   HobLib|EmbeddedPkg/Library/PrePiHobLib/PrePiHobLib.inf
-  PrePiHobListPointerLib|ArmPlatformPkg/Library/PrePiHobListPointerLib/PrePiHobListPointerLib.inf
-  PerformanceLib|MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.inf
-  PlatformPeiLib|ArmPlatformPkg/PlatformPei/PlatformPeiLib.inf
+  MemoryAllocationLib|EmbeddedPkg/Library/PrePiMemoryAllocationLib/PrePiMemoryAllocationLib.inf
   MemoryInitPeiLib|ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.inf
-  ArmGicArchLib|ArmPkg/Library/ArmGicArchSecLib/ArmGicArchSecLib.inf
-  DefaultExceptionHandlerLib|ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLibBase.inf
-
-[LibraryClasses.common.DXE_CORE]
-  DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf
-  DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
-  ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf
-  HobLib|MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf
-  MemoryAllocationLib|MdeModulePkg/Library/DxeCoreMemoryAllocationLib/DxeCoreMemoryAllocationLib.inf
-  ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf
-
-[LibraryClasses.common.UEFI_DRIVER]
-  ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf
-
-[LibraryClasses.common.DXE_DRIVER]
-  DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
-  MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
-  ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf
-  SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf
-
-[LibraryClasses.common.DXE_RUNTIME_DRIVER]
-  CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
-  HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
-  MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
-  ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf
+  PlatformPeiLib|ArmPlatformPkg/PlatformPei/PlatformPeiLib.inf
+  PrePiHobListPointerLib|ArmPlatformPkg/Library/PrePiHobListPointerLib/PrePiHobListPointerLib.inf
 
 [BuildOptions]
   GCC:*_*_*_PLATFORM_FLAGS = -I$(WORKSPACE)/Silicon/Hisilicon/Hi6220/Include -I$(WORKSPACE)/Platform/Hisilicon/HiKey/Include
 
-[BuildOptions.common.EDKII.DXE_RUNTIME_DRIVER]
-  GCC:*_*_AARCH64_DLINK_FLAGS = -z common-page-size=0x10000
-
 ################################################################################
 #
 # Pcd Section - list of all EDK II PCD Entries defined by this Platform
@@ -173,95 +76,15 @@
 ################################################################################
 
 [PcdsFeatureFlag.common]
-  # Use the Vector Table location in CpuDxe. We will not copy the Vector Table at PcdCpuVectorBaseAddress
-  gArmTokenSpaceGuid.PcdRelocateVectorTable|FALSE
-
-  gEmbeddedTokenSpaceGuid.PcdPrePiProduceMemoryTypeInformationHob|TRUE
-
-  ## If TRUE, Graphics Output Protocol will be installed on virtual handle created by ConsplitterDxe.
+  #  If TRUE, Graphics Output Protocol will be installed on virtual handle created by ConsplitterDxe.
   #  It could be set FALSE to save size.
   gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|FALSE
 
-  gEfiMdeModulePkgTokenSpaceGuid.PcdTurnOffUsbLegacySupport|TRUE
-
 [PcdsFixedAtBuild.common]
-  gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength|1000000
-  gEfiMdePkgTokenSpaceGuid.PcdMaximumAsciiStringLength|1000000
-  gEfiMdePkgTokenSpaceGuid.PcdMaximumLinkedListLength|1000000
-  gEfiMdePkgTokenSpaceGuid.PcdSpinLockTimeout|10000000
-  gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue|0xAF
-  gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask|1
-  gEfiMdePkgTokenSpaceGuid.PcdPostCodePropertyMask|0
-  gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize|320
-
-  # DEBUG_ASSERT_ENABLED       0x01
-  # DEBUG_PRINT_ENABLED        0x02
-  # DEBUG_CODE_ENABLED         0x04
-  # CLEAR_MEMORY_ENABLED       0x08
-  # ASSERT_BREAKPOINT_ENABLED  0x10
-  # ASSERT_DEADLOOP_ENABLED    0x20
-!if $(TARGET) == RELEASE
-  gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x21
-!else
-  gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x2f
-!endif
-
-  #  DEBUG_INIT      0x00000001  // Initialization
-  #  DEBUG_WARN      0x00000002  // Warnings
-  #  DEBUG_LOAD      0x00000004  // Load events
-  #  DEBUG_FS        0x00000008  // EFI File system
-  #  DEBUG_POOL      0x00000010  // Alloc & Free's
-  #  DEBUG_PAGE      0x00000020  // Alloc & Free's
-  #  DEBUG_INFO      0x00000040  // Verbose
-  #  DEBUG_DISPATCH  0x00000080  // PEI/DXE Dispatchers
-  #  DEBUG_VARIABLE  0x00000100  // Variable
-  #  DEBUG_BM        0x00000400  // Boot Manager
-  #  DEBUG_BLKIO     0x00001000  // BlkIo Driver
-  #  DEBUG_NET       0x00004000  // SNI Driver
-  #  DEBUG_UNDI      0x00010000  // UNDI Driver
-  #  DEBUG_LOADFILE  0x00020000  // Load File
-  #  DEBUG_EVENT     0x00080000  // Event messages
-  #  DEBUG_GCD       0x00100000  // Global Coherency Database changes
-  #  DEBUG_CACHE     0x00200000  // Memory range cachability changes
-  #  DEBUG_ERROR     0x80000000  // Error
-  gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x8000000F
-
-  gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|0x07
-
-  #
-  # Optional feature to help prevent EFI memory map fragments
-  # Turned on and off via: PcdPrePiProduceMemoryTypeInformationHob
-  # Values are in EFI Pages (4K). DXE Core will make sure that
-  # at least this much of each type of memory can be allocated
-  # from a single memory range. This way you only end up with
-  # maximum of two fragements for each type in the memory map
-  # (the memory used, and the free memory that was prereserved
-  # but not used).
-  #
-  gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory|0
-  gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS|0
-  gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType|0
-  gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData|80
-  gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode|65
-  gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesCode|400
-  gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesData|20000
-  gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderCode|20
-  gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderData|0
-
   gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType|4
 
   gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString|L"Alpha"
 
-  #
-  # NV Storage PCDs.
-  #
-  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase|0x30000000
-  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize|0x00010000
-  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0x30010000
-  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize|0x00010000
-  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|0x30020000
-  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize|0x00010000
-
   # System Memory (1GB)
   gArmTokenSpaceGuid.PcdSystemMemoryBase|0x00000000
   gArmTokenSpaceGuid.PcdSystemMemorySize|0x3E000000
@@ -270,8 +93,6 @@
   gArmPlatformTokenSpaceGuid.PcdCoreCount|8
   gArmPlatformTokenSpaceGuid.PcdClusterCount|2
 
-  gArmTokenSpaceGuid.PcdVFPEnabled|1
-
   #
   # ARM PrimeCell
   #
@@ -324,13 +145,14 @@
   # PEI Phase modules
   #
   ArmPlatformPkg/PrePi/PeiUniCore.inf
+  MdeModulePkg/Core/Pei/PeiMain.inf
+  MdeModulePkg/Universal/PCD/Pei/Pcd.inf
 
   #
   # DXE
   #
   MdeModulePkg/Core/Dxe/DxeMain.inf {
     <LibraryClasses>
-      PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
       NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf
   }
 
diff --git a/Platform/Hisilicon/HiKey/HiKey.fdf b/Platform/Hisilicon/HiKey/HiKey.fdf
index f74d868..2a5c5a4 100644
--- a/Platform/Hisilicon/HiKey/HiKey.fdf
+++ b/Platform/Hisilicon/HiKey/HiKey.fdf
@@ -1,5 +1,5 @@
 #
-#  Copyright (c) 2014-2017, Linaro Limited. All rights reserved.
+#  Copyright (c) 2014-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
@@ -66,7 +66,6 @@ FV = FVMAIN_COMPACT
 ################################################################################
 
 [FV.FvMain]
-FvNameGuid         = 69b7d469-55a2-49d8-a426-42bfb22f5b9d
 BlockSize          = 0x40
 NumBlocks          = 0         # This FV gets compressed so make it just big enough
 FvAlignment        = 8         # FV alignment and FV attributes setting.
@@ -86,6 +85,10 @@ READ_STATUS        = TRUE
 READ_LOCK_CAP      = TRUE
 READ_LOCK_STATUS   = TRUE
 
+  APRIORI DXE {
+    INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
+  }
+
   INF MdeModulePkg/Core/Dxe/DxeMain.inf
 
   #
@@ -219,136 +222,4 @@ READ_LOCK_STATUS   = TRUE
     }
   }
 
-
-################################################################################
-#
-# Rules are use with the [FV] section's module INF type to define
-# how an FFS file is created for a given INF file. The following Rule are the default
-# rules for the different module type. User can add the customized rules to define the
-# content of the FFS file.
-#
-################################################################################
-
-
-############################################################################
-# Example of a DXE_DRIVER FFS file with a Checksum encapsulation section   #
-############################################################################
-#
-#[Rule.Common.DXE_DRIVER]
-#  FILE DRIVER = $(NAMED_GUID) {
-#    DXE_DEPEX    DXE_DEPEX               Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
-#    COMPRESS PI_STD {
-#      GUIDED {
-#        PE32     PE32                    $(INF_OUTPUT)/$(MODULE_NAME).efi
-#        UI       STRING="$(MODULE_NAME)" Optional
-#        VERSION  STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
-#      }
-#    }
-#  }
-#
-############################################################################
-
-#
-# These SEC rules are used for ArmPlatformPkg/PrePi module.
-# ArmPlatformPkg/PrePi is declared as a SEC module to make GenFv patch the
-# UEFI Firmware to jump to ArmPlatformPkg/PrePi entrypoint
-#
-[Rule.ARM.SEC]
-  FILE SEC = $(NAMED_GUID) RELOCS_STRIPPED {
-    TE  TE    Align = 32                $(INF_OUTPUT)/$(MODULE_NAME).efi
-  }
-
-[Rule.AARCH64.SEC]
-  FILE SEC = $(NAMED_GUID) RELOCS_STRIPPED {
-    TE  TE    Align = 4K                $(INF_OUTPUT)/$(MODULE_NAME).efi
-  }
-
-# A shim specific rule is required to ensure the alignment is 4K.
-# Otherwise BaseTools pick up the AArch32 alignment (ie: 32)
-[Rule.ARM.SEC.SHIM]
-  FILE SEC = $(NAMED_GUID) RELOCS_STRIPPED {
-    TE  TE    Align = 4K                $(INF_OUTPUT)/$(MODULE_NAME).efi
-  }
-
-[Rule.Common.PEI_CORE]
-  FILE PEI_CORE = $(NAMED_GUID) {
-    TE     TE                           $(INF_OUTPUT)/$(MODULE_NAME).efi
-    UI     STRING ="$(MODULE_NAME)" Optional
-  }
-
-[Rule.Common.PEIM]
-  FILE PEIM = $(NAMED_GUID) {
-     PEI_DEPEX PEI_DEPEX Optional       $(INF_OUTPUT)/$(MODULE_NAME).depex
-     TE       TE                        $(INF_OUTPUT)/$(MODULE_NAME).efi
-     UI       STRING="$(MODULE_NAME)" Optional
-  }
-
-[Rule.Common.PEIM.TIANOCOMPRESSED]
-  FILE PEIM = $(NAMED_GUID) DEBUG_MYTOOLS_IA32 {
-    PEI_DEPEX PEI_DEPEX Optional        $(INF_OUTPUT)/$(MODULE_NAME).depex
-    GUIDED A31280AD-481E-41B6-95E8-127F4C984779 PROCESSING_REQUIRED = TRUE {
-      PE32      PE32                    $(INF_OUTPUT)/$(MODULE_NAME).efi
-      UI        STRING="$(MODULE_NAME)" Optional
-    }
-  }
-
-[Rule.Common.DXE_CORE]
-  FILE DXE_CORE = $(NAMED_GUID) {
-    PE32     PE32                       $(INF_OUTPUT)/$(MODULE_NAME).efi
-    UI       STRING="$(MODULE_NAME)" Optional
-  }
-
-[Rule.Common.UEFI_DRIVER]
-  FILE DRIVER = $(NAMED_GUID) {
-    DXE_DEPEX    DXE_DEPEX              Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
-    PE32         PE32                   $(INF_OUTPUT)/$(MODULE_NAME).efi
-    UI           STRING="$(MODULE_NAME)" Optional
-  }
-
-[Rule.Common.DXE_DRIVER]
-  FILE DRIVER = $(NAMED_GUID) {
-    DXE_DEPEX    DXE_DEPEX              Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
-    PE32         PE32                   $(INF_OUTPUT)/$(MODULE_NAME).efi
-    UI           STRING="$(MODULE_NAME)" Optional
-  }
-
-[Rule.Common.DXE_DRIVER.BINARY]
-  FILE DRIVER = $(NAMED_GUID) {
-  DXE_DEPEX    DXE_DEPEX              Optional |.depex
-  PE32         PE32                   |.efi
-  UI           STRING="$(MODULE_NAME)" Optional
-  }
-
-[Rule.Common.DXE_RUNTIME_DRIVER]
-  FILE DRIVER = $(NAMED_GUID) {
-    DXE_DEPEX    DXE_DEPEX              Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
-    PE32         PE32                   $(INF_OUTPUT)/$(MODULE_NAME).efi
-    UI           STRING="$(MODULE_NAME)" Optional
-  }
-
-[Rule.Common.UEFI_APPLICATION]
-  FILE APPLICATION = $(NAMED_GUID) {
-    UI     STRING ="$(MODULE_NAME)" Optional
-    PE32   PE32                         $(INF_OUTPUT)/$(MODULE_NAME).efi
-  }
-
-[Rule.Common.UEFI_DRIVER.BINARY]
-  FILE DRIVER = $(NAMED_GUID) {
-    DXE_DEPEX DXE_DEPEX Optional      |.depex
-    PE32      PE32                    |.efi
-    UI        STRING="$(MODULE_NAME)" Optional
-    VERSION   STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
-  }
-
-[Rule.Common.UEFI_APPLICATION.BINARY]
-  FILE APPLICATION = $(NAMED_GUID) {
-    PE32      PE32                    |.efi
-    UI        STRING="$(MODULE_NAME)" Optional
-    VERSION   STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
-  }
-
-[Rule.Common.USER_DEFINED.ACPITABLE]
-  FILE FREEFORM = $(NAMED_GUID) {
-    RAW ACPI               |.acpi
-    RAW ASL                |.aml
-  }
+!include Silicon/Hisilicon/Hisilicon.fdf.inc
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v2 3/4] Platform/Hisilicon: move out dxe runtime lib from common file
  2018-02-09 17:31 [PATCH v2 0/4] support HiKey960 Haojian Zhuang
  2018-02-09 17:31 ` [PATCH v2 1/4] Platform/Hisilicon/HiKey: include DxePcdLib for HiiDatabase Haojian Zhuang
  2018-02-09 17:31 ` [PATCH v2 2/4] Platform/Hisilicon/HiKey: use Hisilicon common file Haojian Zhuang
@ 2018-02-09 17:31 ` Haojian Zhuang
  2018-02-12 11:45   ` Leif Lindholm
  2018-02-13  0:23   ` Guo Heyi
  2018-02-09 17:31 ` [PATCH v2 4/4] Platform/Hisilicon/HiKey960: add skeleton of HiKey960 Haojian Zhuang
  3 siblings, 2 replies; 19+ messages in thread
From: Haojian Zhuang @ 2018-02-09 17:31 UTC (permalink / raw)
  To: edk2-devel, linaro-uefi, leif.lindholm, ard.sheuvel, heyi.guo
  Cc: Haojian Zhuang

With the SerialPortLib and DebugLib, Dxe runtime driver can't
be executed well on HiKey. Serial logs are missing.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
---
 Platform/Hisilicon/D02/Pv660D02.dsc | 2 ++
 Platform/Hisilicon/D03/D03.dsc      | 1 +
 Platform/Hisilicon/D05/D05.dsc      | 1 +
 Silicon/Hisilicon/Hisilicon.dsc.inc | 2 --
 4 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/Platform/Hisilicon/D02/Pv660D02.dsc b/Platform/Hisilicon/D02/Pv660D02.dsc
index 9e826ae..018e149 100644
--- a/Platform/Hisilicon/D02/Pv660D02.dsc
+++ b/Platform/Hisilicon/D02/Pv660D02.dsc
@@ -80,6 +80,8 @@
 
 [LibraryClasses.common.DXE_RUNTIME_DRIVER]
   I2CLib|Silicon/Hisilicon/Library/I2CLib/I2CLibRuntime.inf
+  SerialPortLib|Silicon/Hisilicon/Library/Dw8250SerialPortRuntimeLib/Dw8250SerialPortRuntimeLib.inf
+  DebugLib|IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf
 
 [BuildOptions]
   GCC:*_*_AARCH64_PLATFORM_FLAGS == -I$(WORKSPACE)/Silicon/Hisilicon/Pv660/Include
diff --git a/Platform/Hisilicon/D03/D03.dsc b/Platform/Hisilicon/D03/D03.dsc
index c496306..b9bce66 100644
--- a/Platform/Hisilicon/D03/D03.dsc
+++ b/Platform/Hisilicon/D03/D03.dsc
@@ -97,6 +97,7 @@
 [LibraryClasses.common.DXE_RUNTIME_DRIVER]
   I2CLib|Silicon/Hisilicon/Library/I2CLib/I2CLibRuntime.inf
   SerialPortLib|Silicon/Hisilicon/Hi1610/Library/Uart/LpcSerialPortLib/LpcSerialPortLib.inf
+  DebugLib|IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf
 
 [BuildOptions]
   GCC:*_*_AARCH64_PLATFORM_FLAGS == -I$(WORKSPACE)/Silicon/Hisilicon/Hi1610/Include
diff --git a/Platform/Hisilicon/D05/D05.dsc b/Platform/Hisilicon/D05/D05.dsc
index 0792b08..dfee09b 100644
--- a/Platform/Hisilicon/D05/D05.dsc
+++ b/Platform/Hisilicon/D05/D05.dsc
@@ -105,6 +105,7 @@
 [LibraryClasses.common.DXE_RUNTIME_DRIVER]
   I2CLib|Silicon/Hisilicon/Library/I2CLib/I2CLibRuntime.inf
   SerialPortLib|ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf
+  DebugLib|IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf
 
 [BuildOptions]
   GCC:*_*_AARCH64_PLATFORM_FLAGS == -I$(WORKSPACE)/Silicon/Hisilicon/Hi1616/Include
diff --git a/Silicon/Hisilicon/Hisilicon.dsc.inc b/Silicon/Hisilicon/Hisilicon.dsc.inc
index 5766829..b5b9e7e 100644
--- a/Silicon/Hisilicon/Hisilicon.dsc.inc
+++ b/Silicon/Hisilicon/Hisilicon.dsc.inc
@@ -208,8 +208,6 @@
   MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
   ReportStatusCodeLib|MdeModulePkg/Library/RuntimeDxeReportStatusCodeLib/RuntimeDxeReportStatusCodeLib.inf
   CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibFmp/DxeRuntimeCapsuleLib.inf
-  SerialPortLib|Silicon/Hisilicon/Library/Dw8250SerialPortRuntimeLib/Dw8250SerialPortRuntimeLib.inf
-  DebugLib|IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf
 
 [LibraryClasses.AARCH64]
   ArmGenericTimerCounterLib|ArmPkg/Library/ArmGenericTimerPhyCounterLib/ArmGenericTimerPhyCounterLib.inf
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v2 4/4] Platform/Hisilicon/HiKey960: add skeleton of HiKey960
  2018-02-09 17:31 [PATCH v2 0/4] support HiKey960 Haojian Zhuang
                   ` (2 preceding siblings ...)
  2018-02-09 17:31 ` [PATCH v2 3/4] Platform/Hisilicon: move out dxe runtime lib from " Haojian Zhuang
@ 2018-02-09 17:31 ` Haojian Zhuang
  2018-02-12 11:50   ` Leif Lindholm
  3 siblings, 1 reply; 19+ messages in thread
From: Haojian Zhuang @ 2018-02-09 17:31 UTC (permalink / raw)
  To: edk2-devel, linaro-uefi, leif.lindholm, ard.sheuvel, heyi.guo
  Cc: Haojian Zhuang

Add skeleton of HiKey960 platform.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
---
 Platform/Hisilicon/HiKey960/HiKey960.dsc           | 260 +++++++++++++++++++++
 Platform/Hisilicon/HiKey960/HiKey960.fdf           | 214 +++++++++++++++++
 .../HiKey960/Library/HiKey960Lib/HiKey960.c        | 144 ++++++++++++
 .../HiKey960/Library/HiKey960Lib/HiKey960Helper.S  |  52 +++++
 .../HiKey960/Library/HiKey960Lib/HiKey960Lib.inf   |  44 ++++
 .../HiKey960/Library/HiKey960Lib/HiKey960Mem.c     | 163 +++++++++++++
 6 files changed, 877 insertions(+)
 create mode 100644 Platform/Hisilicon/HiKey960/HiKey960.dsc
 create mode 100644 Platform/Hisilicon/HiKey960/HiKey960.fdf
 create mode 100644 Platform/Hisilicon/HiKey960/Library/HiKey960Lib/HiKey960.c
 create mode 100644 Platform/Hisilicon/HiKey960/Library/HiKey960Lib/HiKey960Helper.S
 create mode 100644 Platform/Hisilicon/HiKey960/Library/HiKey960Lib/HiKey960Lib.inf
 create mode 100644 Platform/Hisilicon/HiKey960/Library/HiKey960Lib/HiKey960Mem.c

diff --git a/Platform/Hisilicon/HiKey960/HiKey960.dsc b/Platform/Hisilicon/HiKey960/HiKey960.dsc
new file mode 100644
index 0000000..98289c0
--- /dev/null
+++ b/Platform/Hisilicon/HiKey960/HiKey960.dsc
@@ -0,0 +1,260 @@
+#
+#  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 Section - statements that will be processed to create a Makefile.
+#
+################################################################################
+[Defines]
+  PLATFORM_NAME                  = HiKey960
+  PLATFORM_GUID                  = bd1a557e-4423-466a-a462-38439588fd37
+  PLATFORM_VERSION               = 0.2
+  DSC_SPECIFICATION              = 0x00010019
+  OUTPUT_DIRECTORY               = Build/$(PLATFORM_NAME)
+  SUPPORTED_ARCHITECTURES        = AARCH64
+  BUILD_TARGETS                  = DEBUG|RELEASE
+  SKUID_IDENTIFIER               = DEFAULT
+  FLASH_DEFINITION               = Platform/Hisilicon/$(PLATFORM_NAME)/$(PLATFORM_NAME).fdf
+
+!include Silicon/Hisilicon/Hisilicon.dsc.inc
+
+[LibraryClasses.common]
+  ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf
+  ArmPlatformLib|Platform/Hisilicon/HiKey960/Library/HiKey960Lib/HiKey960Lib.inf
+
+  CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
+  UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
+  PlatformBootManagerLib|ArmPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
+  CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
+
+  # UiApp dependencies
+  ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
+  FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf
+  DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
+  BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
+
+  SerialPortLib|ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf
+  RealTimeClockLib|ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.inf
+  TimeBaseLib|EmbeddedPkg/Library/TimeBaseLib/TimeBaseLib.inf
+
+  # USB Requirements
+  UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf
+
+  # Network Libraries
+  UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
+  NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
+  DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
+  IpIoLib|MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.inf
+  UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf
+
+[LibraryClasses.common.SEC]
+  PrePiLib|EmbeddedPkg/Library/PrePiLib/PrePiLib.inf
+  ExtractGuidedSectionLib|EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.inf
+  HobLib|EmbeddedPkg/Library/PrePiHobLib/PrePiHobLib.inf
+  MemoryAllocationLib|EmbeddedPkg/Library/PrePiMemoryAllocationLib/PrePiMemoryAllocationLib.inf
+  MemoryInitPeiLib|ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.inf
+  PlatformPeiLib|ArmPlatformPkg/PlatformPei/PlatformPeiLib.inf
+  PrePiHobListPointerLib|ArmPlatformPkg/Library/PrePiHobListPointerLib/PrePiHobListPointerLib.inf
+
+################################################################################
+#
+# Pcd Section - list of all EDK II PCD Entries defined by this Platform
+#
+################################################################################
+
+[PcdsFeatureFlag.common]
+  ## If TRUE, Graphics Output Protocol will be installed on virtual handle created by ConsplitterDxe.
+  #  It could be set FALSE to save size.
+  gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|FALSE
+
+[PcdsFixedAtBuild.common]
+  gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType|4
+
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString|L"Alpha"
+
+  # System Memory (3GB)
+  gArmTokenSpaceGuid.PcdSystemMemoryBase|0x00000000
+  gArmTokenSpaceGuid.PcdSystemMemorySize|0xC0000000
+
+  # HiKey960 Dual-Cluster profile
+  gArmPlatformTokenSpaceGuid.PcdCoreCount|8
+  gArmPlatformTokenSpaceGuid.PcdClusterCount|2
+
+  #
+  # ARM PrimeCell
+  #
+
+  ## PL011 - Serial Terminal
+  DEFINE SERIAL_BASE = 0xFFF32000
+  gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase|$(SERIAL_BASE)
+  gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate|115200
+  gArmPlatformTokenSpaceGuid.PL011UartInteger|10
+  gArmPlatformTokenSpaceGuid.PL011UartFractional|26
+
+  ## PL031 RealTimeClock
+  gArmPlatformTokenSpaceGuid.PcdPL031RtcBase|0xFFF05000
+
+  #
+  # ARM General Interrupt Controller
+  #
+  gArmTokenSpaceGuid.PcdGicDistributorBase|0xE82B1000
+  gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase|0xE82B2000
+
+  gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|10
+
+  # GUID of the UI app
+  gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile|{ 0x21, 0xaa, 0x2c, 0x46, 0x14, 0x76, 0x03, 0x45, 0x83, 0x6e, 0x8a, 0xb6, 0xf4, 0x66, 0x23, 0x31 }
+
+  gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange|FALSE
+
+  gEmbeddedTokenSpaceGuid.PcdMetronomeTickPeriod|1000
+
+  #
+  #
+  # Fastboot
+  #
+  gEmbeddedTokenSpaceGuid.PcdAndroidFastbootUsbVendorId|0x18d1
+  gEmbeddedTokenSpaceGuid.PcdAndroidFastbootUsbProductId|0xd00d
+
+################################################################################
+#
+# Components Section - list of all EDK II Modules needed by this Platform
+#
+################################################################################
+[Components.common]
+  #
+  # PEI Phase modules
+  #
+  ArmPlatformPkg/PrePi/PeiUniCore.inf
+
+  #
+  # DXE
+  #
+  MdeModulePkg/Core/Dxe/DxeMain.inf {
+    <LibraryClasses>
+      PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
+      NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf
+  }
+
+  #
+  # Architectural Protocols
+  #
+  ArmPkg/Drivers/CpuDxe/CpuDxe.inf
+  MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
+  MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
+  MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
+  EmbeddedPkg/EmbeddedMonotonicCounter/EmbeddedMonotonicCounter.inf
+  MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf
+  EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf
+  EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf
+
+  MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
+  MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
+  MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
+  MdeModulePkg/Universal/SerialDxe/SerialDxe.inf
+
+  MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
+  MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf
+
+  ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
+  ArmPkg/Drivers/TimerDxe/TimerDxe.inf
+
+  MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
+
+  MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
+
+  #
+  # GPIO
+  #
+  ArmPlatformPkg/Drivers/PL061GpioDxe/PL061GpioDxe.inf
+
+  #
+  # USB Host Support
+  #
+  MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe.inf
+
+  #
+  # USB Mass Storage Support
+  #
+  MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
+
+  #
+  # USB Peripheral Support
+  #
+  EmbeddedPkg/Drivers/AndroidFastbootTransportUsbDxe/FastbootTransportUsbDxe.inf
+
+  #
+  # Fastboot
+  #
+  EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.inf
+
+
+  #
+  # UEFI Network Stack
+  #
+  MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
+  MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf
+  MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf
+  MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf
+  MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
+  MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dxe.inf
+  MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf
+  MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf
+  MdeModulePkg/Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf
+
+  #
+  # FAT filesystem + GPT/MBR partitioning
+  #
+  MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
+  MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
+  MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
+
+  #
+  # Bds
+  #
+  MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
+  MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf {
+    <LibraryClasses>
+      PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
+  }
+  MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
+  MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
+  MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
+  MdeModulePkg/Application/UiApp/UiApp.inf {
+    <LibraryClasses>
+      NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf
+      NULL|MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf
+      NULL|MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf
+      PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
+  }
+  ShellPkg/Application/Shell/Shell.inf {
+    <LibraryClasses>
+      ShellCommandLib|ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf
+      NULL|ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.inf
+      NULL|ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1CommandsLib.inf
+      NULL|ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.inf
+      NULL|ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.inf
+      NULL|ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf
+      NULL|ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1CommandsLib.inf
+      NULL|ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.inf
+      HandleParsingLib|ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf
+      PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
+      BcfgCommandLib|ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.inf
+    <PcdsFixedAtBuild>
+      gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0xFF
+      gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
+      gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize|8000
+  }
+!ifdef $(INCLUDE_TFTP_COMMAND)
+  ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
+!endif #$(INCLUDE_TFTP_COMMAND)
diff --git a/Platform/Hisilicon/HiKey960/HiKey960.fdf b/Platform/Hisilicon/HiKey960/HiKey960.fdf
new file mode 100644
index 0000000..655032a
--- /dev/null
+++ b/Platform/Hisilicon/HiKey960/HiKey960.fdf
@@ -0,0 +1,214 @@
+#
+#  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.
+#
+
+################################################################################
+#
+# FD Section
+# The [FD] Section is made up of the definition statements and a
+# description of what goes into  the Flash Device Image.  Each FD section
+# defines one flash "device" image.  A flash device image may be one of
+# the following: Removable media bootable image (like a boot floppy
+# image,) an Option ROM image (that would be "flashed" into an add-in
+# card,) a System "Flash"  image (that would be burned into a system's
+# flash) or an Update ("Capsule") image that will be used to update and
+# existing system flash.
+#
+################################################################################
+
+[FD.BL33_AP_UEFI]
+BaseAddress   = 0x1AC98000|gArmTokenSpaceGuid.PcdFdBaseAddress  # The base address of the Firmware in NOR Flash.
+Size          = 0x000F0000|gArmTokenSpaceGuid.PcdFdSize         # The size in bytes of the FLASH Device
+ErasePolarity = 1
+
+# This one is tricky, it must be: BlockSize * NumBlocks = Size
+BlockSize     = 0x00001000
+NumBlocks     = 0xF0
+
+################################################################################
+#
+# Following are lists of FD Region layout which correspond to the locations of different
+# images within the flash device.
+#
+# Regions must be defined in ascending order and may not overlap.
+#
+# A Layout Region start with a eight digit hex offset (leading "0x" required) followed by
+# the pipe "|" character, followed by the size of the region, also in hex with the leading
+# "0x" characters. Like:
+# Offset|Size
+# PcdOffsetCName|PcdSizeCName
+# RegionType <FV, DATA, or FILE>
+#
+################################################################################
+
+0x00000000|0x000F0000
+gArmTokenSpaceGuid.PcdFvBaseAddress|gArmTokenSpaceGuid.PcdFvSize
+FV = FVMAIN_COMPACT
+
+
+################################################################################
+#
+# FV Section
+#
+# [FV] section is used to define what components or modules are placed within a flash
+# device file.  This section also defines order the components and modules are positioned
+# within the image.  The [FV] section consists of define statements, set statements and
+# module statements.
+#
+################################################################################
+
+[FV.FvMain]
+BlockSize          = 0x40
+NumBlocks          = 0         # This FV gets compressed so make it just big enough
+FvAlignment        = 8         # FV alignment and FV attributes setting.
+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
+
+  APRIORI DXE {
+    INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
+  }
+
+  INF MdeModulePkg/Core/Dxe/DxeMain.inf
+
+  #
+  # PI DXE Drivers producing Architectural Protocols (EFI Services)
+  #
+  INF ArmPkg/Drivers/CpuDxe/CpuDxe.inf
+  INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
+  INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
+  INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
+  INF EmbeddedPkg/EmbeddedMonotonicCounter/EmbeddedMonotonicCounter.inf
+  INF MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf
+  INF EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf
+  INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf
+
+  #
+  # Multiple Console IO support
+  #
+  INF MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
+  INF MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
+  INF MdeModulePkg/Universal/SerialDxe/SerialDxe.inf
+
+  INF ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
+  INF ArmPkg/Drivers/TimerDxe/TimerDxe.inf
+
+  INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
+
+  INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
+
+  #
+  # GPIO
+  #
+  INF ArmPlatformPkg/Drivers/PL061GpioDxe/PL061GpioDxe.inf
+
+  #
+  # USB Host Support
+  #
+  INF MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe.inf
+
+  #
+  # USB Mass Storage Support
+  #
+  INF MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
+
+  #
+  # USB Peripheral Support
+  #
+  INF EmbeddedPkg/Drivers/AndroidFastbootTransportUsbDxe/FastbootTransportUsbDxe.inf
+
+  #
+  # Fastboot
+  #
+  INF EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.inf
+
+  #
+  # UEFI Network Stack
+  #
+  INF MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
+  INF MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf
+  INF MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf
+  INF MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf
+  INF MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
+  INF MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dxe.inf
+  INF MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf
+  INF MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf
+  INF MdeModulePkg/Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf
+
+  #
+  # FAT filesystem + GPT/MBR partitioning
+  #
+  INF MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
+  INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
+  INF FatBinPkg/EnhancedFatDxe/Fat.inf
+  INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
+
+  INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
+  INF MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf
+
+  INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
+
+  #
+  # UEFI applications
+  #
+  INF ShellPkg/Application/Shell/Shell.inf
+!ifdef $(INCLUDE_TFTP_COMMAND)
+  INF ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
+!endif #$(INCLUDE_TFTP_COMMAND)
+
+  #
+  # Bds
+  #
+  INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
+  INF MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
+  INF MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
+  INF MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
+  INF MdeModulePkg/Application/UiApp/UiApp.inf
+
+[FV.FVMAIN_COMPACT]
+FvAlignment        = 8
+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 ArmPlatformPkg/PrePi/PeiUniCore.inf
+
+  FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 {
+    SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED = TRUE {
+      SECTION FV_IMAGE = FVMAIN
+    }
+  }
+
+!include Silicon/Hisilicon/Hisilicon.fdf.inc
diff --git a/Platform/Hisilicon/HiKey960/Library/HiKey960Lib/HiKey960.c b/Platform/Hisilicon/HiKey960/Library/HiKey960Lib/HiKey960.c
new file mode 100644
index 0000000..9ae4610
--- /dev/null
+++ b/Platform/Hisilicon/HiKey960/Library/HiKey960Lib/HiKey960.c
@@ -0,0 +1,144 @@
+/** @file
+*
+*  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 <Library/ArmPlatformLib.h>
+#include <Library/DebugLib.h>
+#include <Library/IoLib.h>
+#include <Library/PcdLib.h>
+
+#include <Ppi/ArmMpCoreInfo.h>
+
+ARM_CORE_INFO mHiKey960InfoTable[] = {
+  {
+    // Cluster 0, Core 0
+    0x0, 0x0,
+
+    // MP Core MailBox Set/Get/Clear Addresses and Clear Value
+    (UINT64)0xFFFFFFFF
+  },
+  {
+    // Cluster 0, Core 1
+    0x0, 0x1,
+
+    // MP Core MailBox Set/Get/Clear Addresses and Clear Value
+    (UINT64)0xFFFFFFFF
+  },
+  {
+    // Cluster 0, Core 2
+    0x0, 0x2,
+
+    // MP Core MailBox Set/Get/Clear Addresses and Clear Value
+    (UINT64)0xFFFFFFFF
+  },
+  {
+    // Cluster 0, Core 3
+    0x0, 0x3,
+
+    // MP Core MailBox Set/Get/Clear Addresses and Clear Value
+    (UINT64)0xFFFFFFFF
+  },
+  {
+    // Cluster 1, Core 0
+    0x1, 0x0,
+
+    // MP Core MailBox Set/Get/Clear Addresses and Clear Value
+    (UINT64)0xFFFFFFFF
+  },
+  {
+    // Cluster 1, Core 1
+    0x1, 0x1,
+
+    // MP Core MailBox Set/Get/Clear Addresses and Clear Value
+    (UINT64)0xFFFFFFFF
+  },
+  {
+    // Cluster 1, Core 2
+    0x1, 0x2,
+
+    // MP Core MailBox Set/Get/Clear Addresses and Clear Value
+    (UINT64)0xFFFFFFFF
+  },
+  {
+    // Cluster 1, Core 3
+    0x1, 0x3,
+
+    // MP Core MailBox Set/Get/Clear Addresses and Clear Value
+    (UINT64)0xFFFFFFFF
+  }
+};
+
+/**
+  Return the current Boot Mode
+
+  This function returns the boot reason on the platform
+
+  @return   Return the current Boot Mode of the platform
+
+**/
+EFI_BOOT_MODE
+ArmPlatformGetBootMode (
+  VOID
+  )
+{
+  return BOOT_WITH_FULL_CONFIGURATION;
+}
+
+/**
+  Initialize controllers that must setup in the normal world
+
+  This function is called by the ArmPlatformPkg/Pei or ArmPlatformPkg/Pei/PlatformPeim
+  in the PEI phase.
+
+**/
+RETURN_STATUS
+ArmPlatformInitialize (
+  IN  UINTN                     MpId
+  )
+{
+  return RETURN_SUCCESS;
+}
+
+EFI_STATUS
+PrePeiCoreGetMpCoreInfo (
+  OUT UINTN                   *CoreCount,
+  OUT ARM_CORE_INFO           **ArmCoreTable
+  )
+{
+  // Only support one cluster
+  *CoreCount    = sizeof(mHiKey960InfoTable) / sizeof(ARM_CORE_INFO);
+  *ArmCoreTable = mHiKey960InfoTable;
+  return EFI_SUCCESS;
+}
+
+// Needs to be declared in the file. Otherwise gArmMpCoreInfoPpiGuid is undefined in the contect of PrePeiCore
+EFI_GUID mArmMpCoreInfoPpiGuid = ARM_MP_CORE_INFO_PPI_GUID;
+ARM_MP_CORE_INFO_PPI mMpCoreInfoPpi = { PrePeiCoreGetMpCoreInfo };
+
+EFI_PEI_PPI_DESCRIPTOR      gPlatformPpiTable[] = {
+  {
+    EFI_PEI_PPI_DESCRIPTOR_PPI,
+    &mArmMpCoreInfoPpiGuid,
+    &mMpCoreInfoPpi
+  }
+};
+
+VOID
+ArmPlatformGetPlatformPpiList (
+  OUT UINTN                   *PpiListSize,
+  OUT EFI_PEI_PPI_DESCRIPTOR  **PpiList
+  )
+{
+  *PpiListSize = sizeof(gPlatformPpiTable);
+  *PpiList = gPlatformPpiTable;
+}
diff --git a/Platform/Hisilicon/HiKey960/Library/HiKey960Lib/HiKey960Helper.S b/Platform/Hisilicon/HiKey960/Library/HiKey960Lib/HiKey960Helper.S
new file mode 100644
index 0000000..eb85f67
--- /dev/null
+++ b/Platform/Hisilicon/HiKey960/Library/HiKey960Lib/HiKey960Helper.S
@@ -0,0 +1,52 @@
+#
+#  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 <AsmMacroIoLibV8.h>
+#include <Library/ArmLib.h>
+
+.text
+.align 3
+
+ASM_FUNC(ArmPlatformPeiBootAction)
+  ret
+
+//UINTN
+//ArmPlatformIsPrimaryCore (
+//  IN UINTN MpId
+//  );
+ASM_FUNC(ArmPlatformIsPrimaryCore)
+  MOV32 (w1, FixedPcdGet32(PcdArmPrimaryCoreMask))
+  and   x0, x0, x1
+  MOV32 (w1, FixedPcdGet32(PcdArmPrimaryCore))
+  cmp   w0, w1
+  cset  x0, eq
+  ret
+
+//UINTN
+//ArmPlatformGetPrimaryCoreMpId (
+//  VOID
+//  );
+ASM_FUNC(ArmPlatformGetPrimaryCoreMpId)
+  MOV32 (w0, FixedPcdGet32(PcdArmPrimaryCore))
+  ret
+
+//UINTN
+//ArmPlatformGetCorePosition (
+//  IN UINTN MpId
+//  );
+// With this function: CorePos = (ClusterId * 4) + CoreId
+ASM_FUNC(ArmPlatformGetCorePosition)
+  and   x1, x0, #ARM_CORE_MASK
+  and   x0, x0, #ARM_CLUSTER_MASK
+  add   x0, x1, x0, LSR #6
+  ret
diff --git a/Platform/Hisilicon/HiKey960/Library/HiKey960Lib/HiKey960Lib.inf b/Platform/Hisilicon/HiKey960/Library/HiKey960Lib/HiKey960Lib.inf
new file mode 100644
index 0000000..e16e5a6
--- /dev/null
+++ b/Platform/Hisilicon/HiKey960/Library/HiKey960Lib/HiKey960Lib.inf
@@ -0,0 +1,44 @@
+#
+#  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                    = 0x00010019
+  BASE_NAME                      = HiKey960Lib
+  FILE_GUID                      = 28873463-debb-4573-8382-1036f74bfcca
+  MODULE_TYPE                    = BASE
+  VERSION_STRING                 = 1.0
+  LIBRARY_CLASS                  = ArmPlatformLib
+
+[Packages]
+  ArmPkg/ArmPkg.dec
+  ArmPlatformPkg/ArmPlatformPkg.dec
+  EmbeddedPkg/EmbeddedPkg.dec
+  MdePkg/MdePkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+
+[LibraryClasses]
+  ArmLib
+  HobLib
+  IoLib
+  MemoryAllocationLib
+  SerialPortLib
+
+[Sources.common]
+  HiKey960.c
+  HiKey960Helper.S
+  HiKey960Mem.c
+
+[FixedPcd]
+  gArmTokenSpaceGuid.PcdArmPrimaryCore
+  gArmTokenSpaceGuid.PcdArmPrimaryCoreMask
+  gArmTokenSpaceGuid.PcdSystemMemoryBase
+  gArmTokenSpaceGuid.PcdSystemMemorySize
diff --git a/Platform/Hisilicon/HiKey960/Library/HiKey960Lib/HiKey960Mem.c b/Platform/Hisilicon/HiKey960/Library/HiKey960Lib/HiKey960Mem.c
new file mode 100644
index 0000000..0c37c37
--- /dev/null
+++ b/Platform/Hisilicon/HiKey960/Library/HiKey960Lib/HiKey960Mem.c
@@ -0,0 +1,163 @@
+/** @file
+*
+*  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 <Library/ArmPlatformLib.h>
+#include <Library/DebugLib.h>
+#include <Library/HobLib.h>
+#include <Library/PcdLib.h>
+#include <Library/IoLib.h>
+#include <Library/MemoryAllocationLib.h>
+
+// The total number of descriptors, including the final "end-of-table" descriptor.
+#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS 12
+
+// DDR attributes
+#define DDR_ATTRIBUTES_CACHED           ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK
+#define DDR_ATTRIBUTES_UNCACHED         ARM_MEMORY_REGION_ATTRIBUTE_UNCACHED_UNBUFFERED
+
+#define HI3660_PERIPH_BASE              0xE0000000
+#define HI3660_PERIPH_SZ                0x20000000
+
+#define HIKEY960_EXTRA_SYSTEM_MEMORY_BASE  0x0000000100000000
+#define HIKEY960_EXTRA_SYSTEM_MEMORY_SIZE  0x0000000020000000
+
+#define HIKEY960_MEMORY_SIZE               0x0000000100000000
+
+STATIC struct HiKey960ReservedMemory {
+  EFI_PHYSICAL_ADDRESS         Offset;
+  EFI_PHYSICAL_ADDRESS         Size;
+} HiKey960ReservedMemoryBuffer [] = {
+  { 0x1AC00000, 0x00098000 },    // ARM-TF reserved
+  { 0x32000000, 0x00100000 },    // PSTORE/RAMOOPS
+  { 0x32100000, 0x00001000 },    // ADB REBOOT "REASON"
+  { 0x3E000000, 0x02000000 },    // TEE OS
+  { 0x89B80000, 0x00100000 },    // MCU Code reserved
+  { 0x89C80000, 0x00040000 }     // MCU reserved
+};
+
+/**
+  Return the Virtual Memory Map of your platform
+
+  This Virtual Memory Map is used by MemoryInitPei Module to initialize the MMU on your platform.
+
+  @param[out]   VirtualMemoryMap    Array of ARM_MEMORY_REGION_DESCRIPTOR describing a Physical-to-
+                                    Virtual Memory mapping. This array must be ended by a zero-filled
+                                    entry
+
+**/
+VOID
+ArmPlatformGetVirtualMemoryMap (
+  IN ARM_MEMORY_REGION_DESCRIPTOR** VirtualMemoryMap
+  )
+{
+  ARM_MEMORY_REGION_ATTRIBUTES  CacheAttributes;
+  ARM_MEMORY_REGION_DESCRIPTOR  *VirtualMemoryTable;
+  EFI_RESOURCE_ATTRIBUTE_TYPE   ResourceAttributes;
+  UINTN                         Index = 0, Count, ReservedTop;
+  EFI_PEI_HOB_POINTERS          NextHob;
+  UINT64                        ResourceLength;
+  EFI_PHYSICAL_ADDRESS          ResourceTop;
+
+  ResourceAttributes = (
+    EFI_RESOURCE_ATTRIBUTE_PRESENT |
+    EFI_RESOURCE_ATTRIBUTE_INITIALIZED |
+    EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE |
+    EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE |
+    EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE |
+    EFI_RESOURCE_ATTRIBUTE_TESTED
+  );
+
+  // Create initial Base Hob for system memory.
+  BuildResourceDescriptorHob (
+    EFI_RESOURCE_SYSTEM_MEMORY,
+    ResourceAttributes,
+    PcdGet64 (PcdSystemMemoryBase),
+    PcdGet64 (PcdSystemMemorySize)
+  );
+
+  NextHob.Raw = GetHobList ();
+  Count = sizeof (HiKey960ReservedMemoryBuffer) / sizeof (struct HiKey960ReservedMemory);
+  while ((NextHob.Raw = GetNextHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, NextHob.Raw)) != NULL)
+  {
+    if (Index >= Count)
+      break;
+    if ((NextHob.ResourceDescriptor->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY) &&
+        (HiKey960ReservedMemoryBuffer[Index].Offset >= NextHob.ResourceDescriptor->PhysicalStart) &&
+        ((HiKey960ReservedMemoryBuffer[Index].Offset + HiKey960ReservedMemoryBuffer[Index].Size) <=
+         NextHob.ResourceDescriptor->PhysicalStart + NextHob.ResourceDescriptor->ResourceLength))
+    {
+      ResourceAttributes = NextHob.ResourceDescriptor->ResourceAttribute;
+      ResourceLength = NextHob.ResourceDescriptor->ResourceLength;
+      ResourceTop = NextHob.ResourceDescriptor->PhysicalStart + ResourceLength;
+      ReservedTop = HiKey960ReservedMemoryBuffer[Index].Offset + HiKey960ReservedMemoryBuffer[Index].Size;
+
+      // Create the System Memory HOB for the reserved buffer
+      BuildResourceDescriptorHob (
+        EFI_RESOURCE_MEMORY_RESERVED,
+        EFI_RESOURCE_ATTRIBUTE_PRESENT,
+        HiKey960ReservedMemoryBuffer[Index].Offset,
+        HiKey960ReservedMemoryBuffer[Index].Size
+      );
+      // Update the HOB
+      NextHob.ResourceDescriptor->ResourceLength = HiKey960ReservedMemoryBuffer[Index].Offset -
+                                                   NextHob.ResourceDescriptor->PhysicalStart;
+
+      // If there is some memory available on the top of the reserved memory then create a HOB
+      if (ReservedTop < ResourceTop)
+      {
+        BuildResourceDescriptorHob (EFI_RESOURCE_SYSTEM_MEMORY,
+                                    ResourceAttributes,
+                                    ReservedTop,
+                                    ResourceTop - ReservedTop);
+      }
+      Index++;
+    }
+    NextHob.Raw = GET_NEXT_HOB (NextHob);
+  }
+
+  ASSERT (VirtualMemoryMap != NULL);
+
+  VirtualMemoryTable = (ARM_MEMORY_REGION_DESCRIPTOR*)AllocatePages (
+                                                        EFI_SIZE_TO_PAGES (sizeof(ARM_MEMORY_REGION_DESCRIPTOR) * MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS)
+                                                        );
+  if (VirtualMemoryTable == NULL) {
+    return;
+  }
+
+  CacheAttributes = DDR_ATTRIBUTES_CACHED;
+
+  Index = 0;
+
+  // DDR - 3.0GB section
+  VirtualMemoryTable[Index].PhysicalBase    = PcdGet64 (PcdSystemMemoryBase);
+  VirtualMemoryTable[Index].VirtualBase     = PcdGet64 (PcdSystemMemoryBase);
+  VirtualMemoryTable[Index].Length          = PcdGet64 (PcdSystemMemorySize);
+  VirtualMemoryTable[Index].Attributes      = CacheAttributes;
+
+  // Hi3660 SOC peripherals
+  VirtualMemoryTable[++Index].PhysicalBase  = HI3660_PERIPH_BASE;
+  VirtualMemoryTable[Index].VirtualBase     = HI3660_PERIPH_BASE;
+  VirtualMemoryTable[Index].Length          = HI3660_PERIPH_SZ;
+  VirtualMemoryTable[Index].Attributes      = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
+
+  // End of Table
+  VirtualMemoryTable[++Index].PhysicalBase  = 0;
+  VirtualMemoryTable[Index].VirtualBase     = 0;
+  VirtualMemoryTable[Index].Length          = 0;
+  VirtualMemoryTable[Index].Attributes      = (ARM_MEMORY_REGION_ATTRIBUTES)0;
+
+  ASSERT((Index + 1) <= MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS);
+
+  *VirtualMemoryMap = VirtualMemoryTable;
+}
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 3/4] Platform/Hisilicon: move out dxe runtime lib from common file
  2018-02-09 17:31 ` [PATCH v2 3/4] Platform/Hisilicon: move out dxe runtime lib from " Haojian Zhuang
@ 2018-02-12 11:45   ` Leif Lindholm
  2018-02-12 11:47     ` Haojian Zhuang
  2018-02-15 15:41     ` Leif Lindholm
  2018-02-13  0:23   ` Guo Heyi
  1 sibling, 2 replies; 19+ messages in thread
From: Leif Lindholm @ 2018-02-12 11:45 UTC (permalink / raw)
  To: Haojian Zhuang; +Cc: edk2-devel, linaro-uefi, ard.sheuvel, heyi.guo

On Sat, Feb 10, 2018 at 01:31:06AM +0800, Haojian Zhuang wrote:
> With the SerialPortLib and DebugLib, Dxe runtime driver can't
> be executed well on HiKey. Serial logs are missing.

"Can't be executed well"? Does this mean it crashes?

> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
> ---
>  Platform/Hisilicon/D02/Pv660D02.dsc | 2 ++
>  Platform/Hisilicon/D03/D03.dsc      | 1 +
>  Platform/Hisilicon/D05/D05.dsc      | 1 +
>  Silicon/Hisilicon/Hisilicon.dsc.inc | 2 --
>  4 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/Platform/Hisilicon/D02/Pv660D02.dsc b/Platform/Hisilicon/D02/Pv660D02.dsc
> index 9e826ae..018e149 100644
> --- a/Platform/Hisilicon/D02/Pv660D02.dsc
> +++ b/Platform/Hisilicon/D02/Pv660D02.dsc
> @@ -80,6 +80,8 @@
>  
>  [LibraryClasses.common.DXE_RUNTIME_DRIVER]
>    I2CLib|Silicon/Hisilicon/Library/I2CLib/I2CLibRuntime.inf
> +  SerialPortLib|Silicon/Hisilicon/Library/Dw8250SerialPortRuntimeLib/Dw8250SerialPortRuntimeLib.inf

This change I agree with - this is a clear fix.

> +  DebugLib|IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf

But this one just causes duplication of boilerplate.
Could you instead put the fragment in Hisilicon.dsc.inc ...

>  
>  [BuildOptions]
>    GCC:*_*_AARCH64_PLATFORM_FLAGS == -I$(WORKSPACE)/Silicon/Hisilicon/Pv660/Include
> diff --git a/Platform/Hisilicon/D03/D03.dsc b/Platform/Hisilicon/D03/D03.dsc
> index c496306..b9bce66 100644
> --- a/Platform/Hisilicon/D03/D03.dsc
> +++ b/Platform/Hisilicon/D03/D03.dsc
> @@ -97,6 +97,7 @@
>  [LibraryClasses.common.DXE_RUNTIME_DRIVER]
>    I2CLib|Silicon/Hisilicon/Library/I2CLib/I2CLibRuntime.inf
>    SerialPortLib|Silicon/Hisilicon/Hi1610/Library/Uart/LpcSerialPortLib/LpcSerialPortLib.inf
> +  DebugLib|IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf
>  
>  [BuildOptions]
>    GCC:*_*_AARCH64_PLATFORM_FLAGS == -I$(WORKSPACE)/Silicon/Hisilicon/Hi1610/Include
> diff --git a/Platform/Hisilicon/D05/D05.dsc b/Platform/Hisilicon/D05/D05.dsc
> index 0792b08..dfee09b 100644
> --- a/Platform/Hisilicon/D05/D05.dsc
> +++ b/Platform/Hisilicon/D05/D05.dsc
> @@ -105,6 +105,7 @@
>  [LibraryClasses.common.DXE_RUNTIME_DRIVER]
>    I2CLib|Silicon/Hisilicon/Library/I2CLib/I2CLibRuntime.inf
>    SerialPortLib|ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf
> +  DebugLib|IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf
>  
>  [BuildOptions]
>    GCC:*_*_AARCH64_PLATFORM_FLAGS == -I$(WORKSPACE)/Silicon/Hisilicon/Hi1616/Include
> diff --git a/Silicon/Hisilicon/Hisilicon.dsc.inc b/Silicon/Hisilicon/Hisilicon.dsc.inc
> index 5766829..b5b9e7e 100644
> --- a/Silicon/Hisilicon/Hisilicon.dsc.inc
> +++ b/Silicon/Hisilicon/Hisilicon.dsc.inc
> @@ -208,8 +208,6 @@
>    MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
>    ReportStatusCodeLib|MdeModulePkg/Library/RuntimeDxeReportStatusCodeLib/RuntimeDxeReportStatusCodeLib.inf
>    CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibFmp/DxeRuntimeCapsuleLib.inf
> -  SerialPortLib|Silicon/Hisilicon/Library/Dw8250SerialPortRuntimeLib/Dw8250SerialPortRuntimeLib.inf

... behind a conditional like

!ifndef CONFIG_NO_DEBUGLIB
> -  DebugLib|IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf
!endif

?

And correspondingly set CONFIG_NO_DEBUGLIB in hikey/hikey960 .dscs?

Also, if this is a problem causes by using Hisilicon.dsc.inc, it
should really go in before 2/4.
This is great, by the way - I was not expecting that you would be able
to reuse that, I thought there would be a separate .inc for
hikey/hikey960.

/
    Leif

>  
>  [LibraryClasses.AARCH64]
>    ArmGenericTimerCounterLib|ArmPkg/Library/ArmGenericTimerPhyCounterLib/ArmGenericTimerPhyCounterLib.inf
> -- 
> 2.7.4
> 


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 1/4] Platform/Hisilicon/HiKey: include DxePcdLib for HiiDatabase
  2018-02-09 17:31 ` [PATCH v2 1/4] Platform/Hisilicon/HiKey: include DxePcdLib for HiiDatabase Haojian Zhuang
@ 2018-02-12 11:45   ` Leif Lindholm
  0 siblings, 0 replies; 19+ messages in thread
From: Leif Lindholm @ 2018-02-12 11:45 UTC (permalink / raw)
  To: Haojian Zhuang; +Cc: edk2-devel, linaro-uefi, ard.sheuvel, heyi.guo

On Sat, Feb 10, 2018 at 01:31:04AM +0800, Haojian Zhuang wrote:
> Include DxePcdLib for HiiDatabase. Otherwise, PlatformBootManager
> can't be launched successfully.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>

Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>

> ---
>  Platform/Hisilicon/HiKey/HiKey.dsc | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/Platform/Hisilicon/HiKey/HiKey.dsc b/Platform/Hisilicon/HiKey/HiKey.dsc
> index e8cb957..c7d931e 100644
> --- a/Platform/Hisilicon/HiKey/HiKey.dsc
> +++ b/Platform/Hisilicon/HiKey/HiKey.dsc
> @@ -1,5 +1,5 @@
>  #
> -#  Copyright (c) 2014-2017, Linaro Limited. All rights reserved.
> +#  Copyright (c) 2014-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
> @@ -422,7 +422,10 @@
>    # Bds
>    #
>    MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
> -  MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
> +  MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf {
> +    <LibraryClasses>
> +      PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
> +  }
>    MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
>    MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
>    MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
> -- 
> 2.7.4
> 


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 2/4] Platform/Hisilicon/HiKey: use Hisilicon common file
  2018-02-09 17:31 ` [PATCH v2 2/4] Platform/Hisilicon/HiKey: use Hisilicon common file Haojian Zhuang
@ 2018-02-12 11:46   ` Leif Lindholm
  0 siblings, 0 replies; 19+ messages in thread
From: Leif Lindholm @ 2018-02-12 11:46 UTC (permalink / raw)
  To: Haojian Zhuang; +Cc: edk2-devel, linaro-uefi, ard.biesheuvel, heyi.guo

On Sat, Feb 10, 2018 at 01:31:05AM +0800, Haojian Zhuang wrote:
> Use common file Hisilicon.dsc.inc/Hisilicon.fdf.inc to reduce
> redundant contents in both HiKey.dsc and HiKey.fdf.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>

Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>

> ---
>  Platform/Hisilicon/HiKey/HiKey.dsc | 204 +++----------------------------------
>  Platform/Hisilicon/HiKey/HiKey.fdf | 141 ++-----------------------
>  2 files changed, 19 insertions(+), 326 deletions(-)
> 
> diff --git a/Platform/Hisilicon/HiKey/HiKey.dsc b/Platform/Hisilicon/HiKey/HiKey.dsc
> index c7d931e..b0f8a93 100644
> --- a/Platform/Hisilicon/HiKey/HiKey.dsc
> +++ b/Platform/Hisilicon/HiKey/HiKey.dsc
> @@ -20,152 +20,55 @@
>    PLATFORM_GUID                  = 8edf1480-da5c-4857-bc02-7530bd8e7b7a
>    PLATFORM_VERSION               = 0.2
>    DSC_SPECIFICATION              = 0x00010019
> -  OUTPUT_DIRECTORY               = Build/HiKey
> +  OUTPUT_DIRECTORY               = Build/$(PLATFORM_NAME)
>    SUPPORTED_ARCHITECTURES        = AARCH64
>    BUILD_TARGETS                  = DEBUG|RELEASE
>    SKUID_IDENTIFIER               = DEFAULT
> -  FLASH_DEFINITION               = Platform/Hisilicon/HiKey/HiKey.fdf
> +  FLASH_DEFINITION               = Platform/Hisilicon/$(PLATFORM_NAME)/$(PLATFORM_NAME).fdf
>  
> -[LibraryClasses.common]
> -!if $(TARGET) == RELEASE
> -  DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
> -!else
> -  DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
> -!endif
> -  DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
> -
> -  ArmDisassemblerLib|ArmPkg/Library/ArmDisassemblerLib/ArmDisassemblerLib.inf
> -  ArmGicLib|ArmPkg/Drivers/ArmGic/ArmGicLib.inf
> -  ArmGicArchLib|ArmPkg/Library/ArmGicArchLib/ArmGicArchLib.inf
> -  ArmHvcLib|ArmPkg/Library/ArmHvcLib/ArmHvcLib.inf
> -  ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf
> -  ArmGenericTimerCounterLib|ArmPkg/Library/ArmGenericTimerPhyCounterLib/ArmGenericTimerPhyCounterLib.inf
> +!include Silicon/Hisilicon/Hisilicon.dsc.inc
>  
> +[LibraryClasses.common]
>    ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf
> -  ArmMmuLib|ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf
>    ArmPlatformLib|Platform/Hisilicon/HiKey/Library/HiKeyLib/HiKeyLib.inf
> -  ArmPlatformStackLib|ArmPlatformPkg/Library/ArmPlatformStackLib/ArmPlatformStackLib.inf
> -
> -  BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
> -  BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
> -  CacheMaintenanceLib|ArmPkg/Library/ArmCacheMaintenanceLib/ArmCacheMaintenanceLib.inf
> -  DefaultExceptionHandlerLib|ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLib.inf
> -  CpuExceptionHandlerLib|ArmPkg/Library/ArmExceptionLib/ArmExceptionLib.inf
> -  CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
> -  DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.inf
> -  DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
> -  DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
> -  ResetSystemLib|ArmPkg/Library/ArmSmcPsciResetSystemLib/ArmSmcPsciResetSystemLib.inf
> -  MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
> -  SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
> -
> -  FdtLib|EmbeddedPkg/Library/FdtLib/FdtLib.inf
> +
>    CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
>    UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
> +
>    PlatformBootManagerLib|ArmPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
> -  BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
>    CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
>  
> -  ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
> -  FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
> -  SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
> -
>    # UiApp dependencies
>    ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
>    FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf
>    DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
> +  BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
>  
> -  HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
> -  IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
> -  HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
> -  UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf
> -  TimerLib|ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf
> -  UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf
> -  UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
> -  UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
> -
> -  PL011UartLib|ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.inf
>    SerialPortLib|ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf
>    RealTimeClockLib|ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.inf
>    TimeBaseLib|EmbeddedPkg/Library/TimeBaseLib/TimeBaseLib.inf
>  
> -  NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
> -
> -  #
> -  # Assume everything is fixed at build
> -  #
> -  PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
> -
> -  PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
> -  PeCoffExtraActionLib|ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCoffExtraActionLib.inf
> -  PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
> -  PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
> -  PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
> -  UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
> -  UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
> -  UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf
> -  UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
> -
>    # USB Requirements
>    UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf
>  
>    # Network Libraries
> -  UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
>    NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
>    DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
>    IpIoLib|MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.inf
>    UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf
>  
> -  # It is not possible to prevent compilers from generating calls to generic
> -  # intrinsic functions. This library provides the intrinsic functions
> -  # generated by a given compiler.
> -  NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
> -
> -  # Add support for GCC stack protector
> -  NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
> -
>  [LibraryClasses.common.SEC]
>    PrePiLib|EmbeddedPkg/Library/PrePiLib/PrePiLib.inf
>    ExtractGuidedSectionLib|EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.inf
> -  LzmaDecompressLib|IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
> -  MemoryAllocationLib|EmbeddedPkg/Library/PrePiMemoryAllocationLib/PrePiMemoryAllocationLib.inf
>    HobLib|EmbeddedPkg/Library/PrePiHobLib/PrePiHobLib.inf
> -  PrePiHobListPointerLib|ArmPlatformPkg/Library/PrePiHobListPointerLib/PrePiHobListPointerLib.inf
> -  PerformanceLib|MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.inf
> -  PlatformPeiLib|ArmPlatformPkg/PlatformPei/PlatformPeiLib.inf
> +  MemoryAllocationLib|EmbeddedPkg/Library/PrePiMemoryAllocationLib/PrePiMemoryAllocationLib.inf
>    MemoryInitPeiLib|ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.inf
> -  ArmGicArchLib|ArmPkg/Library/ArmGicArchSecLib/ArmGicArchSecLib.inf
> -  DefaultExceptionHandlerLib|ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLibBase.inf
> -
> -[LibraryClasses.common.DXE_CORE]
> -  DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf
> -  DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
> -  ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf
> -  HobLib|MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf
> -  MemoryAllocationLib|MdeModulePkg/Library/DxeCoreMemoryAllocationLib/DxeCoreMemoryAllocationLib.inf
> -  ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf
> -
> -[LibraryClasses.common.UEFI_DRIVER]
> -  ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf
> -
> -[LibraryClasses.common.DXE_DRIVER]
> -  DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
> -  MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
> -  ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf
> -  SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf
> -
> -[LibraryClasses.common.DXE_RUNTIME_DRIVER]
> -  CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
> -  HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
> -  MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
> -  ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf
> +  PlatformPeiLib|ArmPlatformPkg/PlatformPei/PlatformPeiLib.inf
> +  PrePiHobListPointerLib|ArmPlatformPkg/Library/PrePiHobListPointerLib/PrePiHobListPointerLib.inf
>  
>  [BuildOptions]
>    GCC:*_*_*_PLATFORM_FLAGS = -I$(WORKSPACE)/Silicon/Hisilicon/Hi6220/Include -I$(WORKSPACE)/Platform/Hisilicon/HiKey/Include
>  
> -[BuildOptions.common.EDKII.DXE_RUNTIME_DRIVER]
> -  GCC:*_*_AARCH64_DLINK_FLAGS = -z common-page-size=0x10000
> -
>  ################################################################################
>  #
>  # Pcd Section - list of all EDK II PCD Entries defined by this Platform
> @@ -173,95 +76,15 @@
>  ################################################################################
>  
>  [PcdsFeatureFlag.common]
> -  # Use the Vector Table location in CpuDxe. We will not copy the Vector Table at PcdCpuVectorBaseAddress
> -  gArmTokenSpaceGuid.PcdRelocateVectorTable|FALSE
> -
> -  gEmbeddedTokenSpaceGuid.PcdPrePiProduceMemoryTypeInformationHob|TRUE
> -
> -  ## If TRUE, Graphics Output Protocol will be installed on virtual handle created by ConsplitterDxe.
> +  #  If TRUE, Graphics Output Protocol will be installed on virtual handle created by ConsplitterDxe.
>    #  It could be set FALSE to save size.
>    gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|FALSE
>  
> -  gEfiMdeModulePkgTokenSpaceGuid.PcdTurnOffUsbLegacySupport|TRUE
> -
>  [PcdsFixedAtBuild.common]
> -  gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength|1000000
> -  gEfiMdePkgTokenSpaceGuid.PcdMaximumAsciiStringLength|1000000
> -  gEfiMdePkgTokenSpaceGuid.PcdMaximumLinkedListLength|1000000
> -  gEfiMdePkgTokenSpaceGuid.PcdSpinLockTimeout|10000000
> -  gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue|0xAF
> -  gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask|1
> -  gEfiMdePkgTokenSpaceGuid.PcdPostCodePropertyMask|0
> -  gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize|320
> -
> -  # DEBUG_ASSERT_ENABLED       0x01
> -  # DEBUG_PRINT_ENABLED        0x02
> -  # DEBUG_CODE_ENABLED         0x04
> -  # CLEAR_MEMORY_ENABLED       0x08
> -  # ASSERT_BREAKPOINT_ENABLED  0x10
> -  # ASSERT_DEADLOOP_ENABLED    0x20
> -!if $(TARGET) == RELEASE
> -  gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x21
> -!else
> -  gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x2f
> -!endif
> -
> -  #  DEBUG_INIT      0x00000001  // Initialization
> -  #  DEBUG_WARN      0x00000002  // Warnings
> -  #  DEBUG_LOAD      0x00000004  // Load events
> -  #  DEBUG_FS        0x00000008  // EFI File system
> -  #  DEBUG_POOL      0x00000010  // Alloc & Free's
> -  #  DEBUG_PAGE      0x00000020  // Alloc & Free's
> -  #  DEBUG_INFO      0x00000040  // Verbose
> -  #  DEBUG_DISPATCH  0x00000080  // PEI/DXE Dispatchers
> -  #  DEBUG_VARIABLE  0x00000100  // Variable
> -  #  DEBUG_BM        0x00000400  // Boot Manager
> -  #  DEBUG_BLKIO     0x00001000  // BlkIo Driver
> -  #  DEBUG_NET       0x00004000  // SNI Driver
> -  #  DEBUG_UNDI      0x00010000  // UNDI Driver
> -  #  DEBUG_LOADFILE  0x00020000  // Load File
> -  #  DEBUG_EVENT     0x00080000  // Event messages
> -  #  DEBUG_GCD       0x00100000  // Global Coherency Database changes
> -  #  DEBUG_CACHE     0x00200000  // Memory range cachability changes
> -  #  DEBUG_ERROR     0x80000000  // Error
> -  gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x8000000F
> -
> -  gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|0x07
> -
> -  #
> -  # Optional feature to help prevent EFI memory map fragments
> -  # Turned on and off via: PcdPrePiProduceMemoryTypeInformationHob
> -  # Values are in EFI Pages (4K). DXE Core will make sure that
> -  # at least this much of each type of memory can be allocated
> -  # from a single memory range. This way you only end up with
> -  # maximum of two fragements for each type in the memory map
> -  # (the memory used, and the free memory that was prereserved
> -  # but not used).
> -  #
> -  gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory|0
> -  gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS|0
> -  gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType|0
> -  gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData|80
> -  gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode|65
> -  gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesCode|400
> -  gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesData|20000
> -  gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderCode|20
> -  gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderData|0
> -
>    gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType|4
>  
>    gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString|L"Alpha"
>  
> -  #
> -  # NV Storage PCDs.
> -  #
> -  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase|0x30000000
> -  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize|0x00010000
> -  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0x30010000
> -  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize|0x00010000
> -  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|0x30020000
> -  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize|0x00010000
> -
>    # System Memory (1GB)
>    gArmTokenSpaceGuid.PcdSystemMemoryBase|0x00000000
>    gArmTokenSpaceGuid.PcdSystemMemorySize|0x3E000000
> @@ -270,8 +93,6 @@
>    gArmPlatformTokenSpaceGuid.PcdCoreCount|8
>    gArmPlatformTokenSpaceGuid.PcdClusterCount|2
>  
> -  gArmTokenSpaceGuid.PcdVFPEnabled|1
> -
>    #
>    # ARM PrimeCell
>    #
> @@ -324,13 +145,14 @@
>    # PEI Phase modules
>    #
>    ArmPlatformPkg/PrePi/PeiUniCore.inf
> +  MdeModulePkg/Core/Pei/PeiMain.inf
> +  MdeModulePkg/Universal/PCD/Pei/Pcd.inf
>  
>    #
>    # DXE
>    #
>    MdeModulePkg/Core/Dxe/DxeMain.inf {
>      <LibraryClasses>
> -      PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
>        NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf
>    }
>  
> diff --git a/Platform/Hisilicon/HiKey/HiKey.fdf b/Platform/Hisilicon/HiKey/HiKey.fdf
> index f74d868..2a5c5a4 100644
> --- a/Platform/Hisilicon/HiKey/HiKey.fdf
> +++ b/Platform/Hisilicon/HiKey/HiKey.fdf
> @@ -1,5 +1,5 @@
>  #
> -#  Copyright (c) 2014-2017, Linaro Limited. All rights reserved.
> +#  Copyright (c) 2014-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
> @@ -66,7 +66,6 @@ FV = FVMAIN_COMPACT
>  ################################################################################
>  
>  [FV.FvMain]
> -FvNameGuid         = 69b7d469-55a2-49d8-a426-42bfb22f5b9d
>  BlockSize          = 0x40
>  NumBlocks          = 0         # This FV gets compressed so make it just big enough
>  FvAlignment        = 8         # FV alignment and FV attributes setting.
> @@ -86,6 +85,10 @@ READ_STATUS        = TRUE
>  READ_LOCK_CAP      = TRUE
>  READ_LOCK_STATUS   = TRUE
>  
> +  APRIORI DXE {
> +    INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
> +  }
> +
>    INF MdeModulePkg/Core/Dxe/DxeMain.inf
>  
>    #
> @@ -219,136 +222,4 @@ READ_LOCK_STATUS   = TRUE
>      }
>    }
>  
> -
> -################################################################################
> -#
> -# Rules are use with the [FV] section's module INF type to define
> -# how an FFS file is created for a given INF file. The following Rule are the default
> -# rules for the different module type. User can add the customized rules to define the
> -# content of the FFS file.
> -#
> -################################################################################
> -
> -
> -############################################################################
> -# Example of a DXE_DRIVER FFS file with a Checksum encapsulation section   #
> -############################################################################
> -#
> -#[Rule.Common.DXE_DRIVER]
> -#  FILE DRIVER = $(NAMED_GUID) {
> -#    DXE_DEPEX    DXE_DEPEX               Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
> -#    COMPRESS PI_STD {
> -#      GUIDED {
> -#        PE32     PE32                    $(INF_OUTPUT)/$(MODULE_NAME).efi
> -#        UI       STRING="$(MODULE_NAME)" Optional
> -#        VERSION  STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
> -#      }
> -#    }
> -#  }
> -#
> -############################################################################
> -
> -#
> -# These SEC rules are used for ArmPlatformPkg/PrePi module.
> -# ArmPlatformPkg/PrePi is declared as a SEC module to make GenFv patch the
> -# UEFI Firmware to jump to ArmPlatformPkg/PrePi entrypoint
> -#
> -[Rule.ARM.SEC]
> -  FILE SEC = $(NAMED_GUID) RELOCS_STRIPPED {
> -    TE  TE    Align = 32                $(INF_OUTPUT)/$(MODULE_NAME).efi
> -  }
> -
> -[Rule.AARCH64.SEC]
> -  FILE SEC = $(NAMED_GUID) RELOCS_STRIPPED {
> -    TE  TE    Align = 4K                $(INF_OUTPUT)/$(MODULE_NAME).efi
> -  }
> -
> -# A shim specific rule is required to ensure the alignment is 4K.
> -# Otherwise BaseTools pick up the AArch32 alignment (ie: 32)
> -[Rule.ARM.SEC.SHIM]
> -  FILE SEC = $(NAMED_GUID) RELOCS_STRIPPED {
> -    TE  TE    Align = 4K                $(INF_OUTPUT)/$(MODULE_NAME).efi
> -  }
> -
> -[Rule.Common.PEI_CORE]
> -  FILE PEI_CORE = $(NAMED_GUID) {
> -    TE     TE                           $(INF_OUTPUT)/$(MODULE_NAME).efi
> -    UI     STRING ="$(MODULE_NAME)" Optional
> -  }
> -
> -[Rule.Common.PEIM]
> -  FILE PEIM = $(NAMED_GUID) {
> -     PEI_DEPEX PEI_DEPEX Optional       $(INF_OUTPUT)/$(MODULE_NAME).depex
> -     TE       TE                        $(INF_OUTPUT)/$(MODULE_NAME).efi
> -     UI       STRING="$(MODULE_NAME)" Optional
> -  }
> -
> -[Rule.Common.PEIM.TIANOCOMPRESSED]
> -  FILE PEIM = $(NAMED_GUID) DEBUG_MYTOOLS_IA32 {
> -    PEI_DEPEX PEI_DEPEX Optional        $(INF_OUTPUT)/$(MODULE_NAME).depex
> -    GUIDED A31280AD-481E-41B6-95E8-127F4C984779 PROCESSING_REQUIRED = TRUE {
> -      PE32      PE32                    $(INF_OUTPUT)/$(MODULE_NAME).efi
> -      UI        STRING="$(MODULE_NAME)" Optional
> -    }
> -  }
> -
> -[Rule.Common.DXE_CORE]
> -  FILE DXE_CORE = $(NAMED_GUID) {
> -    PE32     PE32                       $(INF_OUTPUT)/$(MODULE_NAME).efi
> -    UI       STRING="$(MODULE_NAME)" Optional
> -  }
> -
> -[Rule.Common.UEFI_DRIVER]
> -  FILE DRIVER = $(NAMED_GUID) {
> -    DXE_DEPEX    DXE_DEPEX              Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
> -    PE32         PE32                   $(INF_OUTPUT)/$(MODULE_NAME).efi
> -    UI           STRING="$(MODULE_NAME)" Optional
> -  }
> -
> -[Rule.Common.DXE_DRIVER]
> -  FILE DRIVER = $(NAMED_GUID) {
> -    DXE_DEPEX    DXE_DEPEX              Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
> -    PE32         PE32                   $(INF_OUTPUT)/$(MODULE_NAME).efi
> -    UI           STRING="$(MODULE_NAME)" Optional
> -  }
> -
> -[Rule.Common.DXE_DRIVER.BINARY]
> -  FILE DRIVER = $(NAMED_GUID) {
> -  DXE_DEPEX    DXE_DEPEX              Optional |.depex
> -  PE32         PE32                   |.efi
> -  UI           STRING="$(MODULE_NAME)" Optional
> -  }
> -
> -[Rule.Common.DXE_RUNTIME_DRIVER]
> -  FILE DRIVER = $(NAMED_GUID) {
> -    DXE_DEPEX    DXE_DEPEX              Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
> -    PE32         PE32                   $(INF_OUTPUT)/$(MODULE_NAME).efi
> -    UI           STRING="$(MODULE_NAME)" Optional
> -  }
> -
> -[Rule.Common.UEFI_APPLICATION]
> -  FILE APPLICATION = $(NAMED_GUID) {
> -    UI     STRING ="$(MODULE_NAME)" Optional
> -    PE32   PE32                         $(INF_OUTPUT)/$(MODULE_NAME).efi
> -  }
> -
> -[Rule.Common.UEFI_DRIVER.BINARY]
> -  FILE DRIVER = $(NAMED_GUID) {
> -    DXE_DEPEX DXE_DEPEX Optional      |.depex
> -    PE32      PE32                    |.efi
> -    UI        STRING="$(MODULE_NAME)" Optional
> -    VERSION   STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
> -  }
> -
> -[Rule.Common.UEFI_APPLICATION.BINARY]
> -  FILE APPLICATION = $(NAMED_GUID) {
> -    PE32      PE32                    |.efi
> -    UI        STRING="$(MODULE_NAME)" Optional
> -    VERSION   STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
> -  }
> -
> -[Rule.Common.USER_DEFINED.ACPITABLE]
> -  FILE FREEFORM = $(NAMED_GUID) {
> -    RAW ACPI               |.acpi
> -    RAW ASL                |.aml
> -  }
> +!include Silicon/Hisilicon/Hisilicon.fdf.inc
> -- 
> 2.7.4
> 


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 3/4] Platform/Hisilicon: move out dxe runtime lib from common file
  2018-02-12 11:45   ` Leif Lindholm
@ 2018-02-12 11:47     ` Haojian Zhuang
  2018-02-12 12:05       ` Ard Biesheuvel
  2018-02-15 15:41     ` Leif Lindholm
  1 sibling, 1 reply; 19+ messages in thread
From: Haojian Zhuang @ 2018-02-12 11:47 UTC (permalink / raw)
  To: Leif Lindholm, Haojian Zhuang
  Cc: edk2-devel@lists.01.org, linaro-uefi@lists.linaro.org,
	ard.sheuvel@linaro.org, heyi.guo@linaro.org

>From: Leif Lindholm <leif.lindholm@linaro.org>
>Sent: Monday, February 12, 2018 11:45 AM
>To: Haojian Zhuang
>Cc: edk2-devel@lists.01.org; linaro-uefi@lists.linaro.org; ard.sheuvel@linaro.org; heyi.guo@linaro.org
>Subject: Re: [PATCH v2 3/4] Platform/Hisilicon: move out dxe runtime lib from common file
>
>On Sat, Feb 10, 2018 at 01:31:06AM +0800, Haojian Zhuang wrote:
>> With the SerialPortLib and DebugLib, Dxe runtime driver can't
>> be executed well on HiKey. Serial logs are missing.
>
>"Can't be executed well"? Does this mean it crashes?

No crash. Serial output are missing since SerialPortLib is different.

Best Regards
Haojian

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 4/4] Platform/Hisilicon/HiKey960: add skeleton of HiKey960
  2018-02-09 17:31 ` [PATCH v2 4/4] Platform/Hisilicon/HiKey960: add skeleton of HiKey960 Haojian Zhuang
@ 2018-02-12 11:50   ` Leif Lindholm
  0 siblings, 0 replies; 19+ messages in thread
From: Leif Lindholm @ 2018-02-12 11:50 UTC (permalink / raw)
  To: Haojian Zhuang; +Cc: edk2-devel, linaro-uefi, ard.sheuvel, heyi.guo

On Sat, Feb 10, 2018 at 01:31:07AM +0800, Haojian Zhuang wrote:
> Add skeleton of HiKey960 platform.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>

Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>

/
    Leif


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 3/4] Platform/Hisilicon: move out dxe runtime lib from common file
  2018-02-12 11:47     ` Haojian Zhuang
@ 2018-02-12 12:05       ` Ard Biesheuvel
  2018-02-12 12:19         ` Haojian Zhuang
  0 siblings, 1 reply; 19+ messages in thread
From: Ard Biesheuvel @ 2018-02-12 12:05 UTC (permalink / raw)
  To: Haojian Zhuang
  Cc: Leif Lindholm, edk2-devel@lists.01.org, heyi.guo@linaro.org,
	ard.sheuvel@linaro.org, linaro-uefi@lists.linaro.org

On 12 February 2018 at 11:47, Haojian Zhuang <haojian.zhuang@linaro.org> wrote:
>>From: Leif Lindholm <leif.lindholm@linaro.org>
>>Sent: Monday, February 12, 2018 11:45 AM
>>To: Haojian Zhuang
>>Cc: edk2-devel@lists.01.org; linaro-uefi@lists.linaro.org; ard.sheuvel@linaro.org; heyi.guo@linaro.org
>>Subject: Re: [PATCH v2 3/4] Platform/Hisilicon: move out dxe runtime lib from common file
>>
>>On Sat, Feb 10, 2018 at 01:31:06AM +0800, Haojian Zhuang wrote:
>>> With the SerialPortLib and DebugLib, Dxe runtime driver can't
>>> be executed well on HiKey. Serial logs are missing.
>>
>>"Can't be executed well"? Does this mean it crashes?
>
> No crash. Serial output are missing since SerialPortLib is different.
>

Does this driver take care to only create serial output at boot time?
Does it, e.g., call EfiAtRuntime() or use a notification callback at
ExitBootServices to make absolutely sure the serial port is no longer
used?


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 3/4] Platform/Hisilicon: move out dxe runtime lib from common file
  2018-02-12 12:05       ` Ard Biesheuvel
@ 2018-02-12 12:19         ` Haojian Zhuang
  2018-02-12 12:22           ` Ard Biesheuvel
  0 siblings, 1 reply; 19+ messages in thread
From: Haojian Zhuang @ 2018-02-12 12:19 UTC (permalink / raw)
  To: Ard Biesheuvel, Haojian Zhuang
  Cc: Leif Lindholm, edk2-devel@lists.01.org, heyi.guo@linaro.org,
	linaro-uefi@lists.linaro.org

>From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>Sent: Monday, February 12, 2018 12:05 PM
>To: Haojian Zhuang
>Cc: Leif Lindholm; edk2-devel@lists.01.org; heyi.guo@linaro.org; ard.sheuvel@linaro.org; linaro-uefi@lists.linaro.org
>Subject: Re: [edk2] [PATCH v2 3/4] Platform/Hisilicon: move out dxe runtime lib from common file
>
>On 12 February 2018 at 11:47, Haojian Zhuang <haojian.zhuang@linaro.org> wrote:
>>>From: Leif Lindholm <leif.lindholm@linaro.org>
>>>Sent: Monday, February 12, 2018 11:45 AM
>>>To: Haojian Zhuang
>>>Cc: edk2-devel@lists.01.org; linaro-uefi@lists.linaro.org; ard.sheuvel@linaro.org; heyi.guo@linaro.org
>>>Subject: Re: [PATCH v2 3/4] Platform/Hisilicon: move out dxe runtime lib from common file
>>>
>>>On Sat, Feb 10, 2018 at 01:31:06AM +0800, Haojian Zhuang wrote:
>>>> With the SerialPortLib and DebugLib, Dxe runtime driver can't
>>>> be executed well on HiKey. Serial logs are missing.
>>>
>>>"Can't be executed well"? Does this mean it crashes?
>>
>> No crash. Serial output are missing since SerialPortLib is different.
>>
>
>Does this driver take care to only create serial output at boot time?
>Does it, e.g., call EfiAtRuntime() or use a notification callback at
>ExitBootServices to make absolutely sure the serial port is no longer
>used?

These drivers don't use serial port directly. But I tried to use DEBUG () 
function to dump some debug informations in these drivers. I found 
that I can't output anything on serial console.

Best Regards
Haojian

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 3/4] Platform/Hisilicon: move out dxe runtime lib from common file
  2018-02-12 12:19         ` Haojian Zhuang
@ 2018-02-12 12:22           ` Ard Biesheuvel
  2018-02-12 12:57             ` Haojian Zhuang
  0 siblings, 1 reply; 19+ messages in thread
From: Ard Biesheuvel @ 2018-02-12 12:22 UTC (permalink / raw)
  To: Haojian Zhuang
  Cc: Leif Lindholm, edk2-devel@lists.01.org, heyi.guo@linaro.org,
	linaro-uefi@lists.linaro.org

On 12 February 2018 at 12:19, Haojian Zhuang <haojian.zhuang@linaro.org> wrote:
>>From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>>Sent: Monday, February 12, 2018 12:05 PM
>>To: Haojian Zhuang
>>Cc: Leif Lindholm; edk2-devel@lists.01.org; heyi.guo@linaro.org; ard.sheuvel@linaro.org; linaro-uefi@lists.linaro.org
>>Subject: Re: [edk2] [PATCH v2 3/4] Platform/Hisilicon: move out dxe runtime lib from common file
>>
>>On 12 February 2018 at 11:47, Haojian Zhuang <haojian.zhuang@linaro.org> wrote:
>>>>From: Leif Lindholm <leif.lindholm@linaro.org>
>>>>Sent: Monday, February 12, 2018 11:45 AM
>>>>To: Haojian Zhuang
>>>>Cc: edk2-devel@lists.01.org; linaro-uefi@lists.linaro.org; ard.sheuvel@linaro.org; heyi.guo@linaro.org
>>>>Subject: Re: [PATCH v2 3/4] Platform/Hisilicon: move out dxe runtime lib from common file
>>>>
>>>>On Sat, Feb 10, 2018 at 01:31:06AM +0800, Haojian Zhuang wrote:
>>>>> With the SerialPortLib and DebugLib, Dxe runtime driver can't
>>>>> be executed well on HiKey. Serial logs are missing.
>>>>
>>>>"Can't be executed well"? Does this mean it crashes?
>>>
>>> No crash. Serial output are missing since SerialPortLib is different.
>>>
>>
>>Does this driver take care to only create serial output at boot time?
>>Does it, e.g., call EfiAtRuntime() or use a notification callback at
>>ExitBootServices to make absolutely sure the serial port is no longer
>>used?
>
> These drivers don't use serial port directly. But I tried to use DEBUG ()
> function to dump some debug informations in these drivers. I found
> that I can't output anything on serial console.
>

But do those DEBUG() calls only occur at boot time? Or could they be
called at runtime as well?


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 3/4] Platform/Hisilicon: move out dxe runtime lib from common file
  2018-02-12 12:22           ` Ard Biesheuvel
@ 2018-02-12 12:57             ` Haojian Zhuang
  0 siblings, 0 replies; 19+ messages in thread
From: Haojian Zhuang @ 2018-02-12 12:57 UTC (permalink / raw)
  To: Ard Biesheuvel, Haojian Zhuang
  Cc: Leif Lindholm, edk2-devel@lists.01.org, heyi.guo@linaro.org,
	linaro-uefi@lists.linaro.org

>From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>Sent: Monday, February 12, 2018 12:22 PM
>To: Haojian Zhuang
>Cc: Leif Lindholm; edk2-devel@lists.01.org; heyi.guo@linaro.org; linaro-uefi@lists.linaro.org
>Subject: Re: [edk2] [PATCH v2 3/4] Platform/Hisilicon: move out dxe runtime lib from common file
>
>On 12 February 2018 at 12:19, Haojian Zhuang <haojian.zhuang@linaro.org> wrote:
>>>From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>>>Sent: Monday, February 12, 2018 12:05 PM
>>>To: Haojian Zhuang
>>>Cc: Leif Lindholm; edk2-devel@lists.01.org; heyi.guo@linaro.org; ard.sheuvel@linaro.org; linaro-uefi@lists.linaro.org
>>>Subject: Re: [edk2] [PATCH v2 3/4] Platform/Hisilicon: move out dxe runtime lib from common file
>>>
>>>>On 12 February 2018 at 11:47, Haojian Zhuang <haojian.zhuang@linaro.org> wrote:
>>>>>From: Leif Lindholm <leif.lindholm@linaro.org>
>>>>>Sent: Monday, February 12, 2018 11:45 AM
>>>>>To: Haojian Zhuang
>>>>>Cc: edk2-devel@lists.01.org; linaro-uefi@lists.linaro.org; ard.sheuvel@linaro.org; heyi.guo@linaro.org
>>>>>Subject: Re: [PATCH v2 3/4] Platform/Hisilicon: move out dxe runtime lib from common file
>>>>>
>>>>>On Sat, Feb 10, 2018 at 01:31:06AM +0800, Haojian Zhuang wrote:
>>>>>> With the SerialPortLib and DebugLib, Dxe runtime driver can't
>>>>>> be executed well on HiKey. Serial logs are missing.
>>>>>
>>>>>"Can't be executed well"? Does this mean it crashes?
>>>>
>>>> No crash. Serial output are missing since SerialPortLib is different.
>>>>
>>>
>>>Does this driver take care to only create serial output at boot time?
>>>Does it, e.g., call EfiAtRuntime() or use a notification callback at
>>>ExitBootServices to make absolutely sure the serial port is no longer
>>>used?
>>
>> These drivers don't use serial port directly. But I tried to use DEBUG ()
>> function to dump some debug informations in these drivers. I found
>> that I can't output anything on serial console.
>>
>
>But do those DEBUG() calls only occur at boot time? Or could they be
>called at runtime as well?

Excuse me that I didn't explain it clearly. 

At first, I need to make sure everything executed well when I switch to
the common dsc file. So I added some debug messages in those key
drivers.
In the second, I need to debug the boot flow later. I mean that I need some
debug message in the initialization of DXE runtime driver. I'm considering
to make use of EmuVariable and predefined emu variable region in RAM.
Then I could store the predefined boot options in emu variable region.
And I could re-use PlatformBootManager in ArmPlatformPkg without big
changes. So I need to add some debug messages in these DXE runtime
driver.

These two drivers in the common dsc file blocks me enabling debug
messages in the initialization code of DXE runtime driver. So I have
to move them out.

Best Regards
Haojian

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 3/4] Platform/Hisilicon: move out dxe runtime lib from common file
  2018-02-09 17:31 ` [PATCH v2 3/4] Platform/Hisilicon: move out dxe runtime lib from " Haojian Zhuang
  2018-02-12 11:45   ` Leif Lindholm
@ 2018-02-13  0:23   ` Guo Heyi
  2018-02-13  0:59     ` Haojian Zhuang
  1 sibling, 1 reply; 19+ messages in thread
From: Guo Heyi @ 2018-02-13  0:23 UTC (permalink / raw)
  To: Haojian Zhuang
  Cc: edk2-devel, linaro-uefi, leif.lindholm, ard.sheuvel, heyi.guo

Hi Haojian,

Dw8250SerialPortRuntimeLib actually depends on DW8250 hardware IP; if there
isn't such device on Hikey, then you can't use this library instance indeed.

But I think PeiDxeDebugLibReportStatusCode should be some common code, however
it depends on ReportStatusCodeLib and Status Code PEIM and Status code DXE
driver. Have you added them too?

Heyi

On Sat, Feb 10, 2018 at 01:31:06AM +0800, Haojian Zhuang wrote:
> With the SerialPortLib and DebugLib, Dxe runtime driver can't
> be executed well on HiKey. Serial logs are missing.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
> ---
>  Platform/Hisilicon/D02/Pv660D02.dsc | 2 ++
>  Platform/Hisilicon/D03/D03.dsc      | 1 +
>  Platform/Hisilicon/D05/D05.dsc      | 1 +
>  Silicon/Hisilicon/Hisilicon.dsc.inc | 2 --
>  4 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/Platform/Hisilicon/D02/Pv660D02.dsc b/Platform/Hisilicon/D02/Pv660D02.dsc
> index 9e826ae..018e149 100644
> --- a/Platform/Hisilicon/D02/Pv660D02.dsc
> +++ b/Platform/Hisilicon/D02/Pv660D02.dsc
> @@ -80,6 +80,8 @@
>  
>  [LibraryClasses.common.DXE_RUNTIME_DRIVER]
>    I2CLib|Silicon/Hisilicon/Library/I2CLib/I2CLibRuntime.inf
> +  SerialPortLib|Silicon/Hisilicon/Library/Dw8250SerialPortRuntimeLib/Dw8250SerialPortRuntimeLib.inf
> +  DebugLib|IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf
>  
>  [BuildOptions]
>    GCC:*_*_AARCH64_PLATFORM_FLAGS == -I$(WORKSPACE)/Silicon/Hisilicon/Pv660/Include
> diff --git a/Platform/Hisilicon/D03/D03.dsc b/Platform/Hisilicon/D03/D03.dsc
> index c496306..b9bce66 100644
> --- a/Platform/Hisilicon/D03/D03.dsc
> +++ b/Platform/Hisilicon/D03/D03.dsc
> @@ -97,6 +97,7 @@
>  [LibraryClasses.common.DXE_RUNTIME_DRIVER]
>    I2CLib|Silicon/Hisilicon/Library/I2CLib/I2CLibRuntime.inf
>    SerialPortLib|Silicon/Hisilicon/Hi1610/Library/Uart/LpcSerialPortLib/LpcSerialPortLib.inf
> +  DebugLib|IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf
>  
>  [BuildOptions]
>    GCC:*_*_AARCH64_PLATFORM_FLAGS == -I$(WORKSPACE)/Silicon/Hisilicon/Hi1610/Include
> diff --git a/Platform/Hisilicon/D05/D05.dsc b/Platform/Hisilicon/D05/D05.dsc
> index 0792b08..dfee09b 100644
> --- a/Platform/Hisilicon/D05/D05.dsc
> +++ b/Platform/Hisilicon/D05/D05.dsc
> @@ -105,6 +105,7 @@
>  [LibraryClasses.common.DXE_RUNTIME_DRIVER]
>    I2CLib|Silicon/Hisilicon/Library/I2CLib/I2CLibRuntime.inf
>    SerialPortLib|ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf
> +  DebugLib|IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf
>  
>  [BuildOptions]
>    GCC:*_*_AARCH64_PLATFORM_FLAGS == -I$(WORKSPACE)/Silicon/Hisilicon/Hi1616/Include
> diff --git a/Silicon/Hisilicon/Hisilicon.dsc.inc b/Silicon/Hisilicon/Hisilicon.dsc.inc
> index 5766829..b5b9e7e 100644
> --- a/Silicon/Hisilicon/Hisilicon.dsc.inc
> +++ b/Silicon/Hisilicon/Hisilicon.dsc.inc
> @@ -208,8 +208,6 @@
>    MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
>    ReportStatusCodeLib|MdeModulePkg/Library/RuntimeDxeReportStatusCodeLib/RuntimeDxeReportStatusCodeLib.inf
>    CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibFmp/DxeRuntimeCapsuleLib.inf
> -  SerialPortLib|Silicon/Hisilicon/Library/Dw8250SerialPortRuntimeLib/Dw8250SerialPortRuntimeLib.inf
> -  DebugLib|IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf
>  
>  [LibraryClasses.AARCH64]
>    ArmGenericTimerCounterLib|ArmPkg/Library/ArmGenericTimerPhyCounterLib/ArmGenericTimerPhyCounterLib.inf
> -- 
> 2.7.4
> 


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 3/4] Platform/Hisilicon: move out dxe runtime lib from common file
  2018-02-13  0:23   ` Guo Heyi
@ 2018-02-13  0:59     ` Haojian Zhuang
  2018-02-13  2:26       ` Guo Heyi
  0 siblings, 1 reply; 19+ messages in thread
From: Haojian Zhuang @ 2018-02-13  0:59 UTC (permalink / raw)
  To: Guo Heyi, Haojian Zhuang
  Cc: edk2-devel@lists.01.org, linaro-uefi@lists.linaro.org,
	leif.lindholm@linaro.org, ard.biesheuvel@linaro.org

On 02/13/2018 08:23 AM, Guo Heyi wrote:
> Hi Haojian,
> 
> Dw8250SerialPortRuntimeLib actually depends on DW8250 hardware IP; if there
> isn't such device on Hikey, then you can't use this library instance indeed.
> 
> But I think PeiDxeDebugLibReportStatusCode should be some common code, however
> it depends on ReportStatusCodeLib and Status Code PEIM and Status code DXE
> driver. Have you added them too?
>
If I leave PeiDxeDebugLibReportStatusCode and move Dw8250SerialPortRuntimeLib out,
I'll meet UEFI crash. It seems the debug lib is depended on serial port lib.

And I consider that Dw8250 serial port is only valid on D02. So I decide to move them out.

Best Regards
Haojian

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 3/4] Platform/Hisilicon: move out dxe runtime lib from common file
  2018-02-13  0:59     ` Haojian Zhuang
@ 2018-02-13  2:26       ` Guo Heyi
  0 siblings, 0 replies; 19+ messages in thread
From: Guo Heyi @ 2018-02-13  2:26 UTC (permalink / raw)
  To: Haojian Zhuang
  Cc: Guo Heyi, edk2-devel@lists.01.org, linaro-uefi@lists.linaro.org,
	leif.lindholm@linaro.org, ard.biesheuvel@linaro.org

On Tue, Feb 13, 2018 at 12:59:50AM +0000, Haojian Zhuang wrote:
> On 02/13/2018 08:23 AM, Guo Heyi wrote:
> > Hi Haojian,
> > 
> > Dw8250SerialPortRuntimeLib actually depends on DW8250 hardware IP; if there
> > isn't such device on Hikey, then you can't use this library instance indeed.
> > 
> > But I think PeiDxeDebugLibReportStatusCode should be some common code, however
> > it depends on ReportStatusCodeLib and Status Code PEIM and Status code DXE
> > driver. Have you added them too?
> >
> If I leave PeiDxeDebugLibReportStatusCode and move Dw8250SerialPortRuntimeLib out,
> I'll meet UEFI crash. It seems the debug lib is depended on serial port lib.
This is strange, because you should have your own SerialPortLib of your
platform, otherwise error will occur when you build your UEFI.

> 
> And I consider that Dw8250 serial port is only valid on D02. So I decide to move them out.

I agree.

Regards,

Heyi

> 
> Best Regards
> Haojian


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 3/4] Platform/Hisilicon: move out dxe runtime lib from common file
  2018-02-12 11:45   ` Leif Lindholm
  2018-02-12 11:47     ` Haojian Zhuang
@ 2018-02-15 15:41     ` Leif Lindholm
  2018-02-16  0:55       ` Haojian Zhuang
  1 sibling, 1 reply; 19+ messages in thread
From: Leif Lindholm @ 2018-02-15 15:41 UTC (permalink / raw)
  To: Haojian Zhuang; +Cc: edk2-devel, linaro-uefi, ard.biesheuvel, heyi.guo

On Mon, Feb 12, 2018 at 11:45:06AM +0000, Leif Lindholm wrote:
> On Sat, Feb 10, 2018 at 01:31:06AM +0800, Haojian Zhuang wrote:
> > With the SerialPortLib and DebugLib, Dxe runtime driver can't
> > be executed well on HiKey. Serial logs are missing.
> 
> "Can't be executed well"? Does this mean it crashes?

You replied to this question, but not the further ones below.
Can you have a look, please?

/
    Leif

> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
> > ---
> >  Platform/Hisilicon/D02/Pv660D02.dsc | 2 ++
> >  Platform/Hisilicon/D03/D03.dsc      | 1 +
> >  Platform/Hisilicon/D05/D05.dsc      | 1 +
> >  Silicon/Hisilicon/Hisilicon.dsc.inc | 2 --
> >  4 files changed, 4 insertions(+), 2 deletions(-)
> > 
> > diff --git a/Platform/Hisilicon/D02/Pv660D02.dsc b/Platform/Hisilicon/D02/Pv660D02.dsc
> > index 9e826ae..018e149 100644
> > --- a/Platform/Hisilicon/D02/Pv660D02.dsc
> > +++ b/Platform/Hisilicon/D02/Pv660D02.dsc
> > @@ -80,6 +80,8 @@
> >  
> >  [LibraryClasses.common.DXE_RUNTIME_DRIVER]
> >    I2CLib|Silicon/Hisilicon/Library/I2CLib/I2CLibRuntime.inf
> > +  SerialPortLib|Silicon/Hisilicon/Library/Dw8250SerialPortRuntimeLib/Dw8250SerialPortRuntimeLib.inf
> 
> This change I agree with - this is a clear fix.
> 
> > +  DebugLib|IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf
> 
> But this one just causes duplication of boilerplate.
> Could you instead put the fragment in Hisilicon.dsc.inc ...
> 
> >  
> >  [BuildOptions]
> >    GCC:*_*_AARCH64_PLATFORM_FLAGS == -I$(WORKSPACE)/Silicon/Hisilicon/Pv660/Include
> > diff --git a/Platform/Hisilicon/D03/D03.dsc b/Platform/Hisilicon/D03/D03.dsc
> > index c496306..b9bce66 100644
> > --- a/Platform/Hisilicon/D03/D03.dsc
> > +++ b/Platform/Hisilicon/D03/D03.dsc
> > @@ -97,6 +97,7 @@
> >  [LibraryClasses.common.DXE_RUNTIME_DRIVER]
> >    I2CLib|Silicon/Hisilicon/Library/I2CLib/I2CLibRuntime.inf
> >    SerialPortLib|Silicon/Hisilicon/Hi1610/Library/Uart/LpcSerialPortLib/LpcSerialPortLib.inf
> > +  DebugLib|IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf
> >  
> >  [BuildOptions]
> >    GCC:*_*_AARCH64_PLATFORM_FLAGS == -I$(WORKSPACE)/Silicon/Hisilicon/Hi1610/Include
> > diff --git a/Platform/Hisilicon/D05/D05.dsc b/Platform/Hisilicon/D05/D05.dsc
> > index 0792b08..dfee09b 100644
> > --- a/Platform/Hisilicon/D05/D05.dsc
> > +++ b/Platform/Hisilicon/D05/D05.dsc
> > @@ -105,6 +105,7 @@
> >  [LibraryClasses.common.DXE_RUNTIME_DRIVER]
> >    I2CLib|Silicon/Hisilicon/Library/I2CLib/I2CLibRuntime.inf
> >    SerialPortLib|ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf
> > +  DebugLib|IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf
> >  
> >  [BuildOptions]
> >    GCC:*_*_AARCH64_PLATFORM_FLAGS == -I$(WORKSPACE)/Silicon/Hisilicon/Hi1616/Include
> > diff --git a/Silicon/Hisilicon/Hisilicon.dsc.inc b/Silicon/Hisilicon/Hisilicon.dsc.inc
> > index 5766829..b5b9e7e 100644
> > --- a/Silicon/Hisilicon/Hisilicon.dsc.inc
> > +++ b/Silicon/Hisilicon/Hisilicon.dsc.inc
> > @@ -208,8 +208,6 @@
> >    MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
> >    ReportStatusCodeLib|MdeModulePkg/Library/RuntimeDxeReportStatusCodeLib/RuntimeDxeReportStatusCodeLib.inf
> >    CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibFmp/DxeRuntimeCapsuleLib.inf
> > -  SerialPortLib|Silicon/Hisilicon/Library/Dw8250SerialPortRuntimeLib/Dw8250SerialPortRuntimeLib.inf
> 
> ... behind a conditional like
> 
> !ifndef CONFIG_NO_DEBUGLIB
> > -  DebugLib|IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf
> !endif
> 
> ?
> 
> And correspondingly set CONFIG_NO_DEBUGLIB in hikey/hikey960 .dscs?
> 
> Also, if this is a problem causes by using Hisilicon.dsc.inc, it
> should really go in before 2/4.
> This is great, by the way - I was not expecting that you would be able
> to reuse that, I thought there would be a separate .inc for
> hikey/hikey960.
> 
> /
>     Leif
> 
> >  
> >  [LibraryClasses.AARCH64]
> >    ArmGenericTimerCounterLib|ArmPkg/Library/ArmGenericTimerPhyCounterLib/ArmGenericTimerPhyCounterLib.inf
> > -- 
> > 2.7.4
> > 


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 3/4] Platform/Hisilicon: move out dxe runtime lib from common file
  2018-02-15 15:41     ` Leif Lindholm
@ 2018-02-16  0:55       ` Haojian Zhuang
  0 siblings, 0 replies; 19+ messages in thread
From: Haojian Zhuang @ 2018-02-16  0:55 UTC (permalink / raw)
  To: Leif Lindholm, Haojian Zhuang
  Cc: edk2-devel@lists.01.org, linaro-uefi@lists.linaro.org,
	ard.biesheuvel@linaro.org, heyi.guo@linaro.org

On 02/15/2018 11:41 PM, Leif Lindholm wrote:
> On Mon, Feb 12, 2018 at 11:45:06AM +0000, Leif Lindholm wrote:
>> On Sat, Feb 10, 2018 at 01:31:06AM +0800, Haojian Zhuang wrote:
>>> With the SerialPortLib and DebugLib, Dxe runtime driver can't
>>> be executed well on HiKey. Serial logs are missing.
>>
>> "Can't be executed well"? Does this mean it crashes?
> 
> You replied to this question, but not the further ones below.
> Can you have a look, please?

Excuse me that I missed comment in below.

> 
>>> Contributed-under: TianoCore Contribution Agreement 1.1
>>> Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
>>> ---
>>>   Platform/Hisilicon/D02/Pv660D02.dsc | 2 ++
>>>   Platform/Hisilicon/D03/D03.dsc      | 1 +
>>>   Platform/Hisilicon/D05/D05.dsc      | 1 +
>>>   Silicon/Hisilicon/Hisilicon.dsc.inc | 2 --
>>>   4 files changed, 4 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/Platform/Hisilicon/D02/Pv660D02.dsc b/Platform/Hisilicon/D02/Pv660D02.dsc
>>> index 9e826ae..018e149 100644
>>> --- a/Platform/Hisilicon/D02/Pv660D02.dsc
>>> +++ b/Platform/Hisilicon/D02/Pv660D02.dsc
>>> @@ -80,6 +80,8 @@
>>>   
>>>   [LibraryClasses.common.DXE_RUNTIME_DRIVER]
>>>     I2CLib|Silicon/Hisilicon/Library/I2CLib/I2CLibRuntime.inf
>>> +  SerialPortLib|Silicon/Hisilicon/Library/Dw8250SerialPortRuntimeLib/Dw8250SerialPortRuntimeLib.inf
>>
>> This change I agree with - this is a clear fix.
>>
>>> +  DebugLib|IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf
>>
>> But this one just causes duplication of boilerplate.
>> Could you instead put the fragment in Hisilicon.dsc.inc ...
>>
>>>   
>>>   [BuildOptions]
>>>     GCC:*_*_AARCH64_PLATFORM_FLAGS == -I$(WORKSPACE)/Silicon/Hisilicon/Pv660/Include
>>> diff --git a/Platform/Hisilicon/D03/D03.dsc b/Platform/Hisilicon/D03/D03.dsc
>>> index c496306..b9bce66 100644
>>> --- a/Platform/Hisilicon/D03/D03.dsc
>>> +++ b/Platform/Hisilicon/D03/D03.dsc
>>> @@ -97,6 +97,7 @@
>>>   [LibraryClasses.common.DXE_RUNTIME_DRIVER]
>>>     I2CLib|Silicon/Hisilicon/Library/I2CLib/I2CLibRuntime.inf
>>>     SerialPortLib|Silicon/Hisilicon/Hi1610/Library/Uart/LpcSerialPortLib/LpcSerialPortLib.inf
>>> +  DebugLib|IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf
>>>   
>>>   [BuildOptions]
>>>     GCC:*_*_AARCH64_PLATFORM_FLAGS == -I$(WORKSPACE)/Silicon/Hisilicon/Hi1610/Include
>>> diff --git a/Platform/Hisilicon/D05/D05.dsc b/Platform/Hisilicon/D05/D05.dsc
>>> index 0792b08..dfee09b 100644
>>> --- a/Platform/Hisilicon/D05/D05.dsc
>>> +++ b/Platform/Hisilicon/D05/D05.dsc
>>> @@ -105,6 +105,7 @@
>>>   [LibraryClasses.common.DXE_RUNTIME_DRIVER]
>>>     I2CLib|Silicon/Hisilicon/Library/I2CLib/I2CLibRuntime.inf
>>>     SerialPortLib|ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf
>>> +  DebugLib|IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf
>>>   
>>>   [BuildOptions]
>>>     GCC:*_*_AARCH64_PLATFORM_FLAGS == -I$(WORKSPACE)/Silicon/Hisilicon/Hi1616/Include
>>> diff --git a/Silicon/Hisilicon/Hisilicon.dsc.inc b/Silicon/Hisilicon/Hisilicon.dsc.inc
>>> index 5766829..b5b9e7e 100644
>>> --- a/Silicon/Hisilicon/Hisilicon.dsc.inc
>>> +++ b/Silicon/Hisilicon/Hisilicon.dsc.inc
>>> @@ -208,8 +208,6 @@
>>>     MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
>>>     ReportStatusCodeLib|MdeModulePkg/Library/RuntimeDxeReportStatusCodeLib/RuntimeDxeReportStatusCodeLib.inf
>>>     CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibFmp/DxeRuntimeCapsuleLib.inf
>>> -  SerialPortLib|Silicon/Hisilicon/Library/Dw8250SerialPortRuntimeLib/Dw8250SerialPortRuntimeLib.inf
>>
>> ... behind a conditional like
>>
>> !ifndef CONFIG_NO_DEBUGLIB
>>> -  DebugLib|IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf
>> !endif
>>
>> ?
>>
>> And correspondingly set CONFIG_NO_DEBUGLIB in hikey/hikey960 .dscs?

OK. I'll create it.

>>
>> Also, if this is a problem causes by using Hisilicon.dsc.inc, it
>> should really go in before 2/4.

OK. I'll move it before [2/4].

>> This is great, by the way - I was not expecting that you would be able
>> to reuse that, I thought there would be a separate .inc for
>> hikey/hikey960.
>>
>> /
>>      Leif
>>
>>>   
>>>   [LibraryClasses.AARCH64]
>>>     ArmGenericTimerCounterLib|ArmPkg/Library/ArmGenericTimerPhyCounterLib/ArmGenericTimerPhyCounterLib.inf
>>> -- 
>>> 2.7.4
>>>


^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2018-02-16  0:49 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-09 17:31 [PATCH v2 0/4] support HiKey960 Haojian Zhuang
2018-02-09 17:31 ` [PATCH v2 1/4] Platform/Hisilicon/HiKey: include DxePcdLib for HiiDatabase Haojian Zhuang
2018-02-12 11:45   ` Leif Lindholm
2018-02-09 17:31 ` [PATCH v2 2/4] Platform/Hisilicon/HiKey: use Hisilicon common file Haojian Zhuang
2018-02-12 11:46   ` Leif Lindholm
2018-02-09 17:31 ` [PATCH v2 3/4] Platform/Hisilicon: move out dxe runtime lib from " Haojian Zhuang
2018-02-12 11:45   ` Leif Lindholm
2018-02-12 11:47     ` Haojian Zhuang
2018-02-12 12:05       ` Ard Biesheuvel
2018-02-12 12:19         ` Haojian Zhuang
2018-02-12 12:22           ` Ard Biesheuvel
2018-02-12 12:57             ` Haojian Zhuang
2018-02-15 15:41     ` Leif Lindholm
2018-02-16  0:55       ` Haojian Zhuang
2018-02-13  0:23   ` Guo Heyi
2018-02-13  0:59     ` Haojian Zhuang
2018-02-13  2:26       ` Guo Heyi
2018-02-09 17:31 ` [PATCH v2 4/4] Platform/Hisilicon/HiKey960: add skeleton of HiKey960 Haojian Zhuang
2018-02-12 11:50   ` Leif Lindholm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox