diff mbox series

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

Message ID 20180814080903.50466-19-ming.huang@linaro.org
State Superseded
Headers show
Series Upload for D06 platform | expand

Commit Message

Ming Huang Aug. 14, 2018, 8:08 a.m. UTC
From: Yang XinYi <yangxingyi@huawei.com>


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

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yang XinYi <yangxingyi@huawei.com>

---
 Silicon/Hisilicon/HisiPkg.dec                                           |   1 +
 Platform/Hisilicon/D06/D06.dsc                                          |   5 +-
 Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf       |   2 +-
 Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigUiLib.inf        |  68 ++++
 Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfig.h               | 142 ++++++++
 Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigUi.h             |  64 ++++
 Silicon/Hisilicon/Include/Library/OemConfigData.h                       |  84 +++++
 Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfig.c               | 363 ++++++++++++++++++++
 Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/MemoryConfig.hfr          | 154 +++++++++
 Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/MemoryConfig.uni          | 103 ++++++
 Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/MiscConfig.hfr            |  41 +++
 Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/MiscConfig.uni            |  27 ++
 Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigUiLib.uni        |  24 ++
 Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigUiLibStrings.uni |  42 +++
 Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigVfr.Vfr          |  89 +++++
 Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/PcieConfig.hfr            | 219 ++++++++++++
 Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/PcieConfigStrings.uni     | 111 ++++++
 Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/PciePortConfig.hfr        | 167 +++++++++
 Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/RasConfig.hfr             | 172 ++++++++++
 Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/RasConfig.uni             |  85 +++++
 Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/iBMCConfig.hfr            |  81 +++++
 Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/iBMCConfig.uni            |  34 ++
 22 files changed, 2076 insertions(+), 2 deletions(-)

-- 
2.17.0

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

Comments

Leif Lindholm Aug. 22, 2018, 2:14 p.m. UTC | #1
On Tue, Aug 14, 2018 at 04:08:38PM +0800, Ming Huang wrote:
> From: Yang XinYi <yangxingyi@huawei.com>

> 

> This library is added for oem setup menu item.

> Setup item include:

> 1 DDR option item;

> 2 BMC option item;

> 3 Ras option item;

> 4 Misc option item;

> 

> Contributed-under: TianoCore Contribution Agreement 1.1

> Signed-off-by: Yang XinYi <yangxingyi@huawei.com>

> ---

>  Silicon/Hisilicon/HisiPkg.dec                                           |   1 +

>  Platform/Hisilicon/D06/D06.dsc                                          |   5 +-

>  Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf       |   2 +-

>  Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigUiLib.inf        |  68 ++++

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

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

>  Silicon/Hisilicon/Include/Library/OemConfigData.h                       |  84 +++++

>  Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfig.c               | 363 ++++++++++++++++++++

>  Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/MemoryConfig.hfr          | 154 +++++++++

>  Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/MemoryConfig.uni          | 103 ++++++

>  Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/MiscConfig.hfr            |  41 +++

>  Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/MiscConfig.uni            |  27 ++

>  Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigUiLib.uni        |  24 ++

>  Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigUiLibStrings.uni |  42 +++

>  Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigVfr.Vfr          |  89 +++++


Ah, I didn't spot thie before - but can you please rename this one
from
.Vfr to
.vfr

to align with the others?

>  Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/PcieConfig.hfr            | 219 ++++++++++++

>  Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/PcieConfigStrings.uni     | 111 ++++++

>  Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/PciePortConfig.hfr        | 167 +++++++++

>  Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/RasConfig.hfr             | 172 ++++++++++

>  Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/RasConfig.uni             |  85 +++++

>  Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/iBMCConfig.hfr            |  81 +++++

>  Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/iBMCConfig.uni            |  34 ++

>  22 files changed, 2076 insertions(+), 2 deletions(-)

> 

> diff --git a/Silicon/Hisilicon/HisiPkg.dec b/Silicon/Hisilicon/HisiPkg.dec

> index b56a6a6af7..858b840a57 100644

> --- a/Silicon/Hisilicon/HisiPkg.dec

> +++ b/Silicon/Hisilicon/HisiPkg.dec

> @@ -44,6 +44,7 @@

>    gHisiTokenSpaceGuid = {0xc8bc553e, 0x12bf, 0x11e6, {0x97, 0x4f, 0x87, 0xf7, 0x7c, 0xfd, 0x52, 0x1d}}

>  

>    gHisiEfiMemoryMapGuid  = {0xf8870015, 0x6994, 0x4b98, {0x95, 0xa2, 0xbd, 0x56, 0xda, 0x91, 0xc0, 0x7f}}

> +  gOemConfigGuid = {0x42927b59, 0x58fc, 0x41be, {0x8f, 0x59, 0xd1, 0x7c, 0x02, 0x1a, 0x70, 0x13}}

>    gVersionInfoHobGuid = {0xe13a14c, 0x859c, 0x4f22, {0x82, 0xbd, 0x18, 0xe, 0xe1, 0x42, 0x12, 0xbf}}

>    gHisiOemVariableGuid = {0xac62b9a5, 0x9939, 0x41d3, {0xff, 0x5c, 0xc5, 0x80, 0x32, 0x7d, 0x9b, 0x29}}

>    gOemBootVariableGuid = {0xb7784577, 0x5aaf, 0x4557, {0xa1, 0x99, 0xd4, 0xa4, 0x2f, 0x45, 0x06, 0xf8}}

> diff --git a/Platform/Hisilicon/D06/D06.dsc b/Platform/Hisilicon/D06/D06.dsc

> index 9d4a86a4f4..bec422670d 100644

> --- a/Platform/Hisilicon/D06/D06.dsc

> +++ b/Platform/Hisilicon/D06/D06.dsc

> @@ -330,7 +330,10 @@

>    #ACPI

>    #

>    MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf

> -  Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf

> +  Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf {

> +    <LibraryClasses>

> +    NULL|Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigUiLib.inf

> +  }

>  

>    Silicon/Hisilicon/Hi1620/Hi1620AcpiTables/AcpiTablesHi1620.inf

>    Silicon/Hisilicon/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf

> diff --git a/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf b/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf

> index e268a56bbd..281a4f2ebd 100644

> --- a/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf

> +++ b/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf

> @@ -56,7 +56,7 @@

>    gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiTableStorageFile    ## CONSUMES

>  

>  [Depex]

> -  gEfiAcpiTableProtocolGuid

> +  gEfiAcpiTableProtocolGuid AND gEfiVariableWriteArchProtocolGuid

>  

>  [UserExtensions.TianoCore."ExtraFiles"]

>    AcpiPlatformExtra.uni

> diff --git a/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigUiLib.inf b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigUiLib.inf

> new file mode 100644

> index 0000000000..fba619e9ba

> --- /dev/null

> +++ b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigUiLib.inf

> @@ -0,0 +1,68 @@

> +## @file

> +#  OEM config Library used by BDS

> +#

> +#  Copyright (c) 2018, Hisilicon Limited. All rights reserved.

> +#  Copyright (c) 2018, Linaro Limited. All rights reserved.

> +#  This program and the accompanying materials are licensed and made available under

> +#  the terms and conditions of the BSD License that accompanies this distribution.

> +#  The full text of the license may be found at

> +#  http://opensource.org/licenses/bsd-license.php.

> +#

> +#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

> +#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

> +#

> +##

> +[Defines]

> +  INF_VERSION                    = 0x0001001A

> +  BASE_NAME                      = OemConfigUiLib

> +  MODULE_UNI_FILE                = OemConfigUiLib.uni

> +  FILE_GUID                      = 32B373AC-00B6-471b-B3AE-6E4A4501F6BA

> +  MODULE_TYPE                    = DXE_DRIVER

> +  VERSION_STRING                 = 1.0

> +  LIBRARY_CLASS                  = NULL|DXE_DRIVER UEFI_APPLICATION

> +  CONSTRUCTOR                    = OemConfigUiLibConstructor

> +  DESTRUCTOR                     = OemConfigUiLibDestructor

> +

> +[Sources]

> +  iBMCConfig.hfr

> +  iBMCConfig.uni

> +  MemoryConfig.hfr

> +  MemoryConfig.uni

> +  MiscConfig.hfr

> +  MiscConfig.uni

> +  OemConfig.c

> +  OemConfig.h

> +  OemConfigUiLibStrings.uni

> +  OemConfigVfr.Vfr

> +  PcieConfig.hfr

> +  PcieConfigStrings.uni

> +  PciePortConfig.hfr

> +  RasConfig.hfr

> +  RasConfig.uni

> +

> +[Packages]

> +  MdeModulePkg/MdeModulePkg.dec

> +  MdePkg/MdePkg.dec

> +  Silicon/Hisilicon/HisiPkg.dec

> +

> +[LibraryClasses]

> +  BaseLib

> +  BaseMemoryLib

> +  DebugLib

> +  DevicePathLib

> +  HiiLib

> +  MemoryAllocationLib

> +  PrintLib

> +  UefiBootServicesTableLib

> +  UefiHiiServicesLib

> +  UefiRuntimeServicesTableLib

> +

> +[Guids]

> +  gEfiHiiPlatformSetupFormsetGuid               ## CONSUMES ## GUID (Indicate the formset class guid to be displayed)

> +  gEfiIfrFrontPageGuid                          ## CONSUMES ## GUID (Indicate the formset in this library need to dispaly in which page)

> +  gEfiIfrTianoGuid                              ## CONSUMES ## GUID (Extended IFR Guid Opcode)

> +  gOemConfigGuid

> +  gVersionInfoHobGuid

> +

> +[Protocols]

> +  gEfiHiiConfigAccessProtocolGuid               ## CONSUMES

> diff --git a/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfig.h b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfig.h

> new file mode 100644

> index 0000000000..f91400150c

> --- /dev/null

> +++ b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfig.h

> @@ -0,0 +1,142 @@

> +/** @file

> +The Oem config reference implement

> +

> +Copyright (c) 2018, Hisilicon Limited. All rights reserved.

> +Copyright (c) 2018, Linaro Limited. All rights reserved.

> +This program and the accompanying materials

> +are licensed and made available under the terms and conditions of the BSD License

> +which accompanies this distribution.  The full text of the license may be found at

> +http://opensource.org/licenses/bsd-license.php

> +

> +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

> +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

> +

> +**/

> +

> +#ifndef _OEM_CONFIG_H_

> +#define _OEM_CONFIG_H_

> +

> +#include <Guid/HiiPlatformSetupFormset.h>

> +#include <Guid/MdeModuleHii.h>

> +#include <Guid/VersionInfoHobGuid.h>

> +#include <Library/BaseMemoryLib.h>

> +#include <Library/BaseLib.h>

> +#include <Library/DebugLib.h>

> +#include <Library/DevicePathLib.h>

> +#include <Library/HiiLib.h>

> +#include <Library/HobLib.h>

> +#include <Library/MemoryAllocationLib.h>

> +#include "Library/OemConfigData.h"

> +#include <Library/PcdLib.h>

> +#include <Library/PrintLib.h>

> +#include <Library/UefiBootServicesTableLib.h>

> +#include <Library/UefiHiiServicesLib.h>

> +#include <Library/UefiRuntimeServicesTableLib.h>

> +#include <Pi/PiFirmwareVolume.h>

> +#include <Protocol/HiiConfigAccess.h>

> +

> +//

> +// These are the VFR compiler generated data representing our VFR data.

> +//

> +extern UINT8  OemConfigVfrBin[];

> +

> +//

> +// HII specific Vendor Device Path definition.

> +//

> +typedef struct {

> +  VENDOR_DEVICE_PATH          VendorDevicePath;

> +  EFI_DEVICE_PATH_PROTOCOL    End;

> +} HII_VENDOR_DEVICE_PATH;

> +

> +#define OEM_CONFIG_CALLBACK_DATA_SIGNATURE  SIGNATURE_32 ('O', 'E', 'M', 'C')

> +typedef struct {

> +  UINTN                             Signature;

> +  EFI_HII_HANDLE                    HiiHandle;

> +  EFI_HANDLE                        DriverHandle;

> +  EFI_HII_CONFIG_ACCESS_PROTOCOL    ConfigAccess;

> +} OEM_CONFIG_CALLBACK_DATA;

> +

> +/**

> +  This function allows a caller to extract the current configuration for one

> +  or more named elements from the target driver.

> +

> +

> +  @param This            Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.

> +  @param Request         A null-terminated Unicode string in <ConfigRequest> format.

> +  @param Progress        On return, points to a character in the Request string.

> +                         Points to the string's null terminator if request was successful.

> +                         Points to the most recent '&' before the first failing name/value

> +                         pair (or the beginning of the string if the failure is in the

> +                         first name/value pair) if the request was not successful.

> +  @param Results         A null-terminated Unicode string in <ConfigAltResp> format which

> +                         has all values filled in for the names in the Request string.

> +                         String to be allocated by the called function.

> +

> +  @retval  EFI_SUCCESS            The Results is filled with the requested values.

> +  @retval  EFI_OUT_OF_RESOURCES   Not enough memory to store the results.

> +  @retval  EFI_INVALID_PARAMETER  Request is illegal syntax, or unknown name.

> +  @retval  EFI_NOT_FOUND          Routing data doesn't match any storage in this driver.

> +

> +**/

> +EFI_STATUS

> +EFIAPI

> +OemExtractConfig (

> +  IN  CONST EFI_HII_CONFIG_ACCESS_PROTOCOL   *This,

> +  IN  CONST EFI_STRING                       Request,

> +  OUT       EFI_STRING                       *Progress,

> +  OUT       EFI_STRING                       *Results

> +  );

> +

> +/**

> +  This function processes the results of changes in configuration.

> +

> +

> +  @param This            Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.

> +  @param Configuration   A null-terminated Unicode string in <ConfigResp> format.

> +  @param Progress        A pointer to a string filled in with the offset of the most

> +                         recent '&' before the first failing name/value pair (or the

> +                         beginning of the string if the failure is in the first

> +                         name/value pair) or the terminating NULL if all was successful.

> +

> +  @retval  EFI_SUCCESS            The Results is processed successfully.

> +  @retval  EFI_INVALID_PARAMETER  Configuration is NULL.

> +  @retval  EFI_NOT_FOUND          Routing data doesn't match any storage in this driver.

> +

> +**/

> +EFI_STATUS

> +EFIAPI

> +OemRouteConfig (

> +  IN  CONST EFI_HII_CONFIG_ACCESS_PROTOCOL   *This,

> +  IN  CONST EFI_STRING                       Configuration,

> +  OUT       EFI_STRING                       *Progress

> +  );

> +

> +/**

> +  This function is invoked if user selected a interactive opcode from Device Manager's

> +  Formset. If user set VBIOS, the new value is saved to EFI variable.

> +

> +  @param This            Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.

> +  @param Action          Specifies the type of action taken by the browser.

> +  @param QuestionId      A unique value which is sent to the original exporting driver

> +                         so that it can identify the type of data to expect.

> +  @param Type            The type of value for the question.

> +  @param Value           A pointer to the data being sent to the original exporting driver.

> +  @param ActionRequest   On return, points to the action requested by the callback function.

> +

> +  @retval  EFI_SUCCESS           The callback successfully handled the action.

> +  @retval  EFI_INVALID_PARAMETER The setup browser call this function with invalid parameters.

> +

> +**/

> +EFI_STATUS

> +EFIAPI

> +OemCallback (

> +  IN  CONST EFI_HII_CONFIG_ACCESS_PROTOCOL   *This,

> +  IN        EFI_BROWSER_ACTION               Action,

> +  IN        EFI_QUESTION_ID                  QuestionId,

> +  IN        UINT8                            Type,

> +  IN        EFI_IFR_TYPE_VALUE               *Value,

> +  OUT       EFI_BROWSER_ACTION_REQUEST       *ActionRequest

> +  );

> +

> +VOID GetReleaseTime (EFI_TIME *Time);

> +#endif

> diff --git a/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigUi.h b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigUi.h

> new file mode 100644

> index 0000000000..792e544c22

> --- /dev/null

> +++ b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigUi.h

> @@ -0,0 +1,64 @@

> +/** @file

> +

> +Copyright (c) 2018, Hisilicon Limited. All rights reserved.

> +Copyright (c) 2018, Linaro Limited. All rights reserved.

> +This program and the accompanying materials

> +are licensed and made available under the terms and conditions of the BSD License

> +which accompanies this distribution.  The full text of the license may be found at

> +http://opensource.org/licenses/bsd-license.php

> +

> +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

> +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

> +

> +Module Name:

> +

> +  OemConfigUi.h

> +

> +Abstract:

> +

> +  NVData structure used by the OEM Config.

> +

> +Revision History:

> +

> +

> +**/

> +

> +#ifndef _OEM_CONFIG_UI_H_

> +#define _OEM_CONFIG_UI_H_

> +

> +#include <Uefi/UefiMultiPhase.h>

> +

> +#define OEM_CONFIG_FORM_ID                   1

> +#define MEMORY_CONFIG_FORM_ID                2

> +#define IBMC_CONFIG_FORM_ID                  3

> +#define PCIE_CONFIG_FORM_ID                  4

> +#define MISC_CONFIG_FORM_ID                  5

> +#define RAS_CONFIG_FORM_ID                   6

> +

> +#define VFR_FORMID_PCIE_SOCKET0              0x4100

> +#define VFR_FORMID_PCIE_SOCKET1              0x4200

> +#define VFR_FORMID_PCIE_PORT0                0x4000

> +#define VFR_FORMID_PCIE_PORT1                0x4001

> +#define VFR_FORMID_PCIE_PORT2                0x4002

> +#define VFR_FORMID_PCIE_PORT3                0x4003

> +#define VFR_FORMID_PCIE_PORT4                0x4004

> +#define VFR_FORMID_PCIE_PORT5                0x4005

> +#define VFR_FORMID_PCIE_PORT6                0x4006

> +#define VFR_FORMID_PCIE_PORT7                0x4007

> +#define VFR_FORMID_PCIE_PORT8                0x4008

> +#define VFR_FORMID_PCIE_PORT9                0x4009

> +#define VFR_FORMID_PCIE_PORT10               0x4010

> +#define VFR_FORMID_PCIE_PORT11               0x4011

> +#define VFR_FORMID_PCIE_PORT12               0x4012

> +#define VFR_FORMID_PCIE_PORT13               0x4013

> +#define VFR_FORMID_PCIE_PORT14               0x4014

> +#define VFR_FORMID_PCIE_PORT15               0x4015

> +

> +#define VFR_FORMID_MEMORY_RAS                0x6100

> +#define VFR_FORMID_CORRECT_ERROR             0x6101

> +#define VFR_FORMID_PCIE_RAS                  0x6200

> +

> +#define RMT_PATTERN_LENGTH                   256

> +

> +

> +#endif

> diff --git a/Silicon/Hisilicon/Include/Library/OemConfigData.h b/Silicon/Hisilicon/Include/Library/OemConfigData.h

> new file mode 100644

> index 0000000000..478821ae2c

> --- /dev/null

> +++ b/Silicon/Hisilicon/Include/Library/OemConfigData.h

> @@ -0,0 +1,84 @@

> +/** @file

> +*

> +*  Copyright (c) 2017 - 2018, Hisilicon Limited. All rights reserved.

> +*  Copyright (c) 2017 - 2018, Linaro Limited. All rights reserved.

> +*

> +*  This program and the accompanying materials

> +*  are licensed and made available under the terms and conditions of the BSD License

> +*  which accompanies this distribution.  The full text of the license may be found at

> +*  http://opensource.org/licenses/bsd-license.php

> +*

> +*  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

> +*  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

> +*

> +**/

> +

> +

> +#ifndef _OEM_CONFIG_DATA_H_

> +#define _OEM_CONFIG_DATA_H_

> +

> +#define PCIE_MAX_TOTAL_PORTS                 16

> +#define OEM_CONFIG_NAME                      L"OemConfig"

> +#define PLATFORM_SETUP_VARIABLE_FLAG         (EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE)

> +

> +#pragma pack(1)

> +typedef struct {

> +  /*Memory Config*/

> +  UINT8         DdrDebugLevel;

> +  UINT8         DdrFreqLimit;

> +  UINT8         DdrRefreshSupport;

> +  UINT8         DdrRefreshRate;

> +  UINT8         RankMargin;

> +  UINT8         RankMarginMode;

> +  UINT32        rmtPatternLength;

> +  UINT8         perbitmargin;

> +  UINT8         CaMargin;

> +  UINT8         CaVrefMarginOption;

> +  UINT8         NumaEn;

> +  UINT8         HwMemTest;

> +  UINT8         DieInterleaving;

> +  UINT8         ChannelInterleaving;

> +  UINT8         RankInterleaving;

> +  UINT8         EccSupport;

> +  /*iBMC Config*/

> +  UINT8         BmcWdtEnable;

> +  UINT8         BmcWdtTimeout;

> +  UINT8         BmcWdtAction;

> +  UINT8         OSWdtEnable;

> +  UINT8         OSWdtTimeout;

> +  UINT8         OSWdtAction;

> +  /*PCIe Config*/

> +  UINT8         PcieSRIOVSupport;

> +  UINT8         PciePort[PCIE_MAX_TOTAL_PORTS];

> +  UINT8         PcieLinkSpeedPort[PCIE_MAX_TOTAL_PORTS];

> +  UINT8         PcieLinkDeEmphasisPort[PCIE_MAX_TOTAL_PORTS];

> +  UINT8         PcieLinkStatusPort[PCIE_MAX_TOTAL_PORTS];

> +  UINT8         PcieLinkSpeedRateStatusPort[PCIE_MAX_TOTAL_PORTS];

> +  UINT8         PcieLinkMaxPort[PCIE_MAX_TOTAL_PORTS];

> +  UINT8         PcieMaxPayloadSizePort[PCIE_MAX_TOTAL_PORTS];

> +  UINT8         PcieAspmPort[PCIE_MAX_TOTAL_PORTS];

> +  /*Misc Config*/

> +  UINT8         EnableSmmu;

> +  UINT8         EnableFdtTable;

> +  UINT8         EnableSpcr;

> +  /*RAS Config*/

> +  UINT8         EnRasSupport;

> +  UINT8         EnPoison;

> +  UINT8         CheckAlgorithm;

> +  UINT8         PatrolScrub;

> +  UINT8         PatrolScrubDuration;

> +  UINT8         DemandScrubMode;

> +  UINT8         CorrectErrorThreshold;

> +  UINT8         AdvanceDeviceCorrection;

> +  UINT8         RankSparing;

> +  UINT8         FunnelPeriod;

> +  UINT8         DpcFeature;

> +  UINT8         EcrcFeature;

> +  UINT8         CompletionTimeout;

> +  UINT8         CompletionTimeoutValue;

> +  UINT8         HotPlug;

> +

> +} OEM_CONFIG_DATA;

> +#pragma pack()

> +

> +#endif

> diff --git a/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfig.c b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfig.c

> new file mode 100644

> index 0000000000..1e3635307c

> --- /dev/null

> +++ b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfig.c

> @@ -0,0 +1,363 @@

> +/** @file

> +The OEM config reference implementation

> +

> +Copyright (c) 2018, Hisilicon Limited. All rights reserved.

> +Copyright (c) 2018, Linaro Limited. All rights reserved.

> +This program and the accompanying materials

> +are licensed and made available under the terms and conditions of the BSD License

> +which accompanies this distribution.  The full text of the license may be found at

> +http://opensource.org/licenses/bsd-license.php

> +

> +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

> +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

> +

> +**/

> +

> +#include "OemConfig.h"

> +

> +OEM_CONFIG_CALLBACK_DATA    mOemConfigPrivate = {

> +  OEM_CONFIG_CALLBACK_DATA_SIGNATURE,

> +  NULL,

> +  NULL,

> +  {

> +    OemExtractConfig,

> +    OemRouteConfig,

> +    OemCallback

> +  }

> +};

> +

> +HII_VENDOR_DEVICE_PATH  mOemHiiVendorDevicePath = {

> +  {

> +    {

> +      HARDWARE_DEVICE_PATH,

> +      HW_VENDOR_DP,

> +      {

> +        (UINT8) (sizeof (VENDOR_DEVICE_PATH)),

> +        (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)

> +      }

> +    },

> +    { 0x874c4dcb, 0x08ec, 0x4fe6, { 0xb5, 0x8e, 0x3a, 0x9e, 0x1c, 0x26, 0x70, 0xb9 } }

> +  },

> +  {

> +    END_DEVICE_PATH_TYPE,

> +    END_ENTIRE_DEVICE_PATH_SUBTYPE,

> +    {

> +      (UINT8) (END_DEVICE_PATH_LENGTH),

> +      (UINT8) ((END_DEVICE_PATH_LENGTH) >> 8)

> +    }

> +  }

> +};

> +

> +

> +

> +

> +

> +

> +/**

> +  This function allows a caller to extract the current configuration for one

> +  or more named elements from the target driver.

> +

> +

> +  @param This            Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.

> +  @param Request         A null-terminated Unicode string in <ConfigRequest> format.

> +  @param Progress        On return, points to a character in the Request string.

> +                         Points to the string's null terminator if request was successful.

> +                         Points to the most recent '&' before the first failing name/value

> +                         pair (or the beginning of the string if the failure is in the

> +                         first name/value pair) if the request was not successful.

> +  @param Results         A null-terminated Unicode string in <ConfigAltResp> format which

> +                         has all values filled in for the names in the Request string.

> +                         String to be allocated by the called function.

> +

> +  @retval  EFI_INVALID_PARAMETER  Request is illegal syntax, or unknown name.

> +  @retval  EFI_NOT_FOUND          Routing data doesn't match any storage in this driver.

> +

> +**/

> +EFI_STATUS

> +EFIAPI

> +OemExtractConfig (

> +  IN  CONST EFI_HII_CONFIG_ACCESS_PROTOCOL   *This,

> +  IN  CONST EFI_STRING                       Request,

> +  OUT EFI_STRING                             *Progress,

> +  OUT EFI_STRING                             *Results

> +  )

> +{

> +  if (Progress == NULL || Results == NULL) {

> +    return EFI_INVALID_PARAMETER;

> +  }

> +  *Progress = Request;

> +  return EFI_NOT_FOUND;

> +}

> +

> +/**

> +  This function processes the results of changes in configuration.

> +

> +  @param This            Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.

> +  @param Configuration   A null-terminated Unicode string in <ConfigResp> format.

> +  @param Progress        A pointer to a string filled in with the offset of the most

> +                         recent '&' before the first failing name/value pair (or the

> +                         beginning of the string if the failure is in the first

> +                         name/value pair) or the terminating NULL if all was successful.

> +

> +  @retval  EFI_INVALID_PARAMETER  Configuration is NULL.

> +  @retval  EFI_NOT_FOUND          Routing data doesn't match any storage in this driver.

> +

> +**/

> +EFI_STATUS

> +EFIAPI

> +OemRouteConfig (

> +  IN  CONST EFI_HII_CONFIG_ACCESS_PROTOCOL   *This,

> +  IN  CONST EFI_STRING                       Configuration,

> +  OUT EFI_STRING                             *Progress

> +  )

> +{

> +  if (Configuration == NULL || Progress == NULL) {

> +    return EFI_INVALID_PARAMETER;

> +  }

> +

> +  *Progress = Configuration;

> +

> +  return EFI_NOT_FOUND;

> +}

> +

> +/**

> +  This function is invoked if user selected a interactive opcode from Device Manager's

> +  Formset. If user set VBIOS, the new value is saved to EFI variable.

> +

> +  @param This            Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.

> +  @param Action          Specifies the type of action taken by the browser.

> +  @param QuestionId      A unique value which is sent to the original exporting driver

> +                         so that it can identify the type of data to expect.

> +  @param Type            The type of value for the question.

> +  @param Value           A pointer to the data being sent to the original exporting driver.

> +  @param ActionRequest   On return, points to the action requested by the callback function.

> +

> +  @retval  EFI_SUCCESS           The callback successfully handled the action.

> +  @retval  EFI_INVALID_PARAMETER The setup browser call this function with invalid parameters.

> +

> +**/

> +EFI_STATUS

> +EFIAPI

> +OemCallback (

> +  IN  CONST EFI_HII_CONFIG_ACCESS_PROTOCOL   *This,

> +  IN  EFI_BROWSER_ACTION                     Action,

> +  IN  EFI_QUESTION_ID                        QuestionId,

> +  IN  UINT8                                  Type,

> +  IN  EFI_IFR_TYPE_VALUE                     *Value,

> +  OUT EFI_BROWSER_ACTION_REQUEST             *ActionRequest

> +  )

> +{

> +  if (Action != EFI_BROWSER_ACTION_CHANGING) {

> +    //

> +    // Do nothing for other UEFI Action. Only do call back when data is changed.

> +    //

> +    return EFI_UNSUPPORTED;

> +  }

> +  if ((Value == NULL) || (ActionRequest == NULL)) {

> +    return EFI_INVALID_PARAMETER;

> +  }

> +

> +  return EFI_SUCCESS;

> +}

> +

> +/**

> +  Install Boot Manager Menu driver.

> +

> +  @param ImageHandle     The image handle.

> +  @param SystemTable     The system table.

> +

> +  @retval  EFI_SUCEESS  Install Boot manager menu success.

> +  @retval  Other        Return error status.

> +

> +**/

> +EFI_STATUS

> +EFIAPI

> +OemConfigUiLibConstructor (

> +  IN EFI_HANDLE                            ImageHandle,

> +  IN EFI_SYSTEM_TABLE                      *SystemTable

> +  )

> +{

> +  EFI_STATUS                  Status;

> +  OEM_CONFIG_DATA             Configuration;

> +  VOID                        *Hob;

> +  VERSION_INFO                *VersionInfo;

> +  UINTN                       BufSize;

> +  BOOLEAN                     Action;

> +  EFI_STRING                  ConfigRequestHdr;

> +  EFI_TIME                    Time = {0};

> +  CHAR16                      TmpString[0x100] = {0};

> +

> +  mOemConfigPrivate.DriverHandle = NULL;

> +  Status = gBS->InstallMultipleProtocolInterfaces (

> +                  &mOemConfigPrivate.DriverHandle,

> +                  &gEfiDevicePathProtocolGuid,

> +                  &mOemHiiVendorDevicePath,

> +                  &gEfiHiiConfigAccessProtocolGuid,

> +                  &mOemConfigPrivate.ConfigAccess,

> +                  NULL

> +                  );

> +  if (EFI_ERROR (Status)) {

> +    return Status;

> +  }

> +

> +  //

> +  // Publish our HII data.

> +  //

> +  mOemConfigPrivate.HiiHandle = HiiAddPackages (

> +                                   &gOemConfigGuid,

> +                                   mOemConfigPrivate.DriverHandle,

> +                                   OemConfigVfrBin,

> +                                   OemConfigUiLibStrings,

> +                                   NULL

> +                                   );

> +  if (mOemConfigPrivate.HiiHandle == NULL) {

> +    DEBUG ((DEBUG_ERROR, "OemConfigUiLibConstructor(), Fail to Add Oem Hii Package.\n"));


Sorry, missed this one first time around:
Please use %a and __FUNCTION__ instead of hardcoding the function name.

> +    return EFI_INVALID_PARAMETER;

> +  }

> +  //

> +  //BIOS Build Time Init

> +  //

> +  Hob = GetFirstGuidHob (&gVersionInfoHobGuid);

> +  if (Hob == NULL) {

> +    DEBUG ((DEBUG_ERROR, "[%a]:[%d] Version information HOB not found!\n",

> +      __FILE__, __LINE__));

> +    return EFI_NOT_FOUND;

> +  }

> +  VersionInfo = GET_GUID_HOB_DATA (Hob);

> +  Time = VersionInfo->BuildTime;

> +  UnicodeSPrint (

> +    TmpString,

> +    sizeof (TmpString),

> +    L"%02d/%02d/%04d %02d:%02d",

> +    Time.Month,

> +    Time.Day,

> +    Time.Year,

> +    Time.Hour,

> +    Time.Minute

> +    );

> +  HiiSetString (

> +    mOemConfigPrivate.HiiHandle,

> +    STRING_TOKEN (STR_MISC_BIOS_BUILDTIME),

> +    TmpString,

> +    "en-US"

> +    );

> +  //

> +  // Check Oem Config Variable.

> +  //

> +  ConfigRequestHdr = HiiConstructConfigHdr (

> +                       &gOemConfigGuid,

> +                       OEM_CONFIG_NAME,

> +                       mOemConfigPrivate.DriverHandle

> +                       );

> +  ZeroMem (&Configuration, sizeof (OEM_CONFIG_DATA));

> +  BufSize = sizeof (OEM_CONFIG_DATA);

> +  Status = gRT->GetVariable (

> +                  OEM_CONFIG_NAME,

> +                  &gOemConfigGuid,

> +                  NULL,

> +                  &BufSize,

> +                  &Configuration

> +                  );

> +  if (EFI_ERROR (Status)) {

> +    Action = HiiSetToDefaults (ConfigRequestHdr, EFI_HII_DEFAULT_CLASS_STANDARD);

> +    if (!Action) {

> +      //

> +      //Set the default value of the DDR option

> +      //

> +      Configuration.DdrDebugLevel = 0;

> +      Configuration.DdrFreqLimit = 0;

> +      Configuration.DdrRefreshSupport = 0;

> +      Configuration.DdrRefreshRate = 0;

> +      Configuration.RankMargin = 0;

> +      Configuration.RankMarginMode = 2;

> +      Configuration.rmtPatternLength = 256;

> +      Configuration.perbitmargin = 0x0;

> +      Configuration.CaMargin = 0x0;

> +      Configuration.CaVrefMarginOption = 0x0;

> +      Configuration.NumaEn = 1;

> +      Configuration.HwMemTest = 0;

> +      Configuration.DieInterleaving = 0;

> +      Configuration.ChannelInterleaving = 1;

> +      Configuration.RankInterleaving = 2;

> +      Configuration.EccSupport = 0;

> +      //

> +      //Set the default value of the BMC option

> +      //

> +      Configuration.BmcWdtEnable = 0;

> +      Configuration.BmcWdtTimeout = 15;

> +      Configuration.BmcWdtAction = 1;

> +      Configuration.OSWdtEnable = 0;

> +      Configuration.OSWdtTimeout = 5;

> +      Configuration.OSWdtAction = 1;


Where did the PCIe go?

/
    Leif
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Ming Huang Aug. 22, 2018, 3:11 p.m. UTC | #2
On 8/22/2018 10:14 PM, Leif Lindholm wrote:
> On Tue, Aug 14, 2018 at 04:08:38PM +0800, Ming Huang wrote:

>> From: Yang XinYi <yangxingyi@huawei.com>

>>

>> This library is added for oem setup menu item.

>> Setup item include:

>> 1 DDR option item;

>> 2 BMC option item;

>> 3 Ras option item;

>> 4 Misc option item;

>>

>> Contributed-under: TianoCore Contribution Agreement 1.1

>> Signed-off-by: Yang XinYi <yangxingyi@huawei.com>

>> ---

>>  Silicon/Hisilicon/HisiPkg.dec                                           |   1 +

>>  Platform/Hisilicon/D06/D06.dsc                                          |   5 +-

>>  Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf       |   2 +-

>>  Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigUiLib.inf        |  68 ++++

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

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

>>  Silicon/Hisilicon/Include/Library/OemConfigData.h                       |  84 +++++

>>  Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfig.c               | 363 ++++++++++++++++++++

>>  Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/MemoryConfig.hfr          | 154 +++++++++

>>  Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/MemoryConfig.uni          | 103 ++++++

>>  Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/MiscConfig.hfr            |  41 +++

>>  Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/MiscConfig.uni            |  27 ++

>>  Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigUiLib.uni        |  24 ++

>>  Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigUiLibStrings.uni |  42 +++

>>  Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigVfr.Vfr          |  89 +++++

> 

> Ah, I didn't spot thie before - but can you please rename this one

> from

> .Vfr to

> .vfr

> 

> to align with the others?


OK, do it in v4.

> 

>>  Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/PcieConfig.hfr            | 219 ++++++++++++

>>  Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/PcieConfigStrings.uni     | 111 ++++++

>>  Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/PciePortConfig.hfr        | 167 +++++++++

>>  Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/RasConfig.hfr             | 172 ++++++++++

>>  Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/RasConfig.uni             |  85 +++++

>>  Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/iBMCConfig.hfr            |  81 +++++

>>  Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/iBMCConfig.uni            |  34 ++

>>  22 files changed, 2076 insertions(+), 2 deletions(-)

>>

>> diff --git a/Silicon/Hisilicon/HisiPkg.dec b/Silicon/Hisilicon/HisiPkg.dec

>> index b56a6a6af7..858b840a57 100644

>> --- a/Silicon/Hisilicon/HisiPkg.dec

>> +++ b/Silicon/Hisilicon/HisiPkg.dec

>> @@ -44,6 +44,7 @@

>>    gHisiTokenSpaceGuid = {0xc8bc553e, 0x12bf, 0x11e6, {0x97, 0x4f, 0x87, 0xf7, 0x7c, 0xfd, 0x52, 0x1d}}

>>  

>>    gHisiEfiMemoryMapGuid  = {0xf8870015, 0x6994, 0x4b98, {0x95, 0xa2, 0xbd, 0x56, 0xda, 0x91, 0xc0, 0x7f}}

>> +  gOemConfigGuid = {0x42927b59, 0x58fc, 0x41be, {0x8f, 0x59, 0xd1, 0x7c, 0x02, 0x1a, 0x70, 0x13}}

>>    gVersionInfoHobGuid = {0xe13a14c, 0x859c, 0x4f22, {0x82, 0xbd, 0x18, 0xe, 0xe1, 0x42, 0x12, 0xbf}}

>>    gHisiOemVariableGuid = {0xac62b9a5, 0x9939, 0x41d3, {0xff, 0x5c, 0xc5, 0x80, 0x32, 0x7d, 0x9b, 0x29}}

>>    gOemBootVariableGuid = {0xb7784577, 0x5aaf, 0x4557, {0xa1, 0x99, 0xd4, 0xa4, 0x2f, 0x45, 0x06, 0xf8}}

>> diff --git a/Platform/Hisilicon/D06/D06.dsc b/Platform/Hisilicon/D06/D06.dsc

>> index 9d4a86a4f4..bec422670d 100644

>> --- a/Platform/Hisilicon/D06/D06.dsc

>> +++ b/Platform/Hisilicon/D06/D06.dsc

>> @@ -330,7 +330,10 @@

>>    #ACPI

>>    #

>>    MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf

>> -  Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf

>> +  Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf {

>> +    <LibraryClasses>

>> +    NULL|Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigUiLib.inf

>> +  }

>>  

>>    Silicon/Hisilicon/Hi1620/Hi1620AcpiTables/AcpiTablesHi1620.inf

>>    Silicon/Hisilicon/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf

>> diff --git a/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf b/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf

>> index e268a56bbd..281a4f2ebd 100644

>> --- a/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf

>> +++ b/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf

>> @@ -56,7 +56,7 @@

>>    gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiTableStorageFile    ## CONSUMES

>>  

>>  [Depex]

>> -  gEfiAcpiTableProtocolGuid

>> +  gEfiAcpiTableProtocolGuid AND gEfiVariableWriteArchProtocolGuid

>>  

>>  [UserExtensions.TianoCore."ExtraFiles"]

>>    AcpiPlatformExtra.uni

>> diff --git a/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigUiLib.inf b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigUiLib.inf

>> new file mode 100644

>> index 0000000000..fba619e9ba

>> --- /dev/null

>> +++ b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigUiLib.inf

>> @@ -0,0 +1,68 @@

>> +## @file

>> +#  OEM config Library used by BDS

>> +#

>> +#  Copyright (c) 2018, Hisilicon Limited. All rights reserved.

>> +#  Copyright (c) 2018, Linaro Limited. All rights reserved.

>> +#  This program and the accompanying materials are licensed and made available under

>> +#  the terms and conditions of the BSD License that accompanies this distribution.

>> +#  The full text of the license may be found at

>> +#  http://opensource.org/licenses/bsd-license.php.

>> +#

>> +#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

>> +#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

>> +#

>> +##

>> +[Defines]

>> +  INF_VERSION                    = 0x0001001A

>> +  BASE_NAME                      = OemConfigUiLib

>> +  MODULE_UNI_FILE                = OemConfigUiLib.uni

>> +  FILE_GUID                      = 32B373AC-00B6-471b-B3AE-6E4A4501F6BA

>> +  MODULE_TYPE                    = DXE_DRIVER

>> +  VERSION_STRING                 = 1.0

>> +  LIBRARY_CLASS                  = NULL|DXE_DRIVER UEFI_APPLICATION

>> +  CONSTRUCTOR                    = OemConfigUiLibConstructor

>> +  DESTRUCTOR                     = OemConfigUiLibDestructor

>> +

>> +[Sources]

>> +  iBMCConfig.hfr

>> +  iBMCConfig.uni

>> +  MemoryConfig.hfr

>> +  MemoryConfig.uni

>> +  MiscConfig.hfr

>> +  MiscConfig.uni

>> +  OemConfig.c

>> +  OemConfig.h

>> +  OemConfigUiLibStrings.uni

>> +  OemConfigVfr.Vfr

>> +  PcieConfig.hfr

>> +  PcieConfigStrings.uni

>> +  PciePortConfig.hfr

>> +  RasConfig.hfr

>> +  RasConfig.uni

>> +

>> +[Packages]

>> +  MdeModulePkg/MdeModulePkg.dec

>> +  MdePkg/MdePkg.dec

>> +  Silicon/Hisilicon/HisiPkg.dec

>> +

>> +[LibraryClasses]

>> +  BaseLib

>> +  BaseMemoryLib

>> +  DebugLib

>> +  DevicePathLib

>> +  HiiLib

>> +  MemoryAllocationLib

>> +  PrintLib

>> +  UefiBootServicesTableLib

>> +  UefiHiiServicesLib

>> +  UefiRuntimeServicesTableLib

>> +

>> +[Guids]

>> +  gEfiHiiPlatformSetupFormsetGuid               ## CONSUMES ## GUID (Indicate the formset class guid to be displayed)

>> +  gEfiIfrFrontPageGuid                          ## CONSUMES ## GUID (Indicate the formset in this library need to dispaly in which page)

>> +  gEfiIfrTianoGuid                              ## CONSUMES ## GUID (Extended IFR Guid Opcode)

>> +  gOemConfigGuid

>> +  gVersionInfoHobGuid

>> +

>> +[Protocols]

>> +  gEfiHiiConfigAccessProtocolGuid               ## CONSUMES

>> diff --git a/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfig.h b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfig.h

>> new file mode 100644

>> index 0000000000..f91400150c

>> --- /dev/null

>> +++ b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfig.h

>> @@ -0,0 +1,142 @@

>> +/** @file

>> +The Oem config reference implement

>> +

>> +Copyright (c) 2018, Hisilicon Limited. All rights reserved.

>> +Copyright (c) 2018, Linaro Limited. All rights reserved.

>> +This program and the accompanying materials

>> +are licensed and made available under the terms and conditions of the BSD License

>> +which accompanies this distribution.  The full text of the license may be found at

>> +http://opensource.org/licenses/bsd-license.php

>> +

>> +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

>> +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

>> +

>> +**/

>> +

>> +#ifndef _OEM_CONFIG_H_

>> +#define _OEM_CONFIG_H_

>> +

>> +#include <Guid/HiiPlatformSetupFormset.h>

>> +#include <Guid/MdeModuleHii.h>

>> +#include <Guid/VersionInfoHobGuid.h>

>> +#include <Library/BaseMemoryLib.h>

>> +#include <Library/BaseLib.h>

>> +#include <Library/DebugLib.h>

>> +#include <Library/DevicePathLib.h>

>> +#include <Library/HiiLib.h>

>> +#include <Library/HobLib.h>

>> +#include <Library/MemoryAllocationLib.h>

>> +#include "Library/OemConfigData.h"

>> +#include <Library/PcdLib.h>

>> +#include <Library/PrintLib.h>

>> +#include <Library/UefiBootServicesTableLib.h>

>> +#include <Library/UefiHiiServicesLib.h>

>> +#include <Library/UefiRuntimeServicesTableLib.h>

>> +#include <Pi/PiFirmwareVolume.h>

>> +#include <Protocol/HiiConfigAccess.h>

>> +

>> +//

>> +// These are the VFR compiler generated data representing our VFR data.

>> +//

>> +extern UINT8  OemConfigVfrBin[];

>> +

>> +//

>> +// HII specific Vendor Device Path definition.

>> +//

>> +typedef struct {

>> +  VENDOR_DEVICE_PATH          VendorDevicePath;

>> +  EFI_DEVICE_PATH_PROTOCOL    End;

>> +} HII_VENDOR_DEVICE_PATH;

>> +

>> +#define OEM_CONFIG_CALLBACK_DATA_SIGNATURE  SIGNATURE_32 ('O', 'E', 'M', 'C')

>> +typedef struct {

>> +  UINTN                             Signature;

>> +  EFI_HII_HANDLE                    HiiHandle;

>> +  EFI_HANDLE                        DriverHandle;

>> +  EFI_HII_CONFIG_ACCESS_PROTOCOL    ConfigAccess;

>> +} OEM_CONFIG_CALLBACK_DATA;

>> +

>> +/**

>> +  This function allows a caller to extract the current configuration for one

>> +  or more named elements from the target driver.

>> +

>> +

>> +  @param This            Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.

>> +  @param Request         A null-terminated Unicode string in <ConfigRequest> format.

>> +  @param Progress        On return, points to a character in the Request string.

>> +                         Points to the string's null terminator if request was successful.

>> +                         Points to the most recent '&' before the first failing name/value

>> +                         pair (or the beginning of the string if the failure is in the

>> +                         first name/value pair) if the request was not successful.

>> +  @param Results         A null-terminated Unicode string in <ConfigAltResp> format which

>> +                         has all values filled in for the names in the Request string.

>> +                         String to be allocated by the called function.

>> +

>> +  @retval  EFI_SUCCESS            The Results is filled with the requested values.

>> +  @retval  EFI_OUT_OF_RESOURCES   Not enough memory to store the results.

>> +  @retval  EFI_INVALID_PARAMETER  Request is illegal syntax, or unknown name.

>> +  @retval  EFI_NOT_FOUND          Routing data doesn't match any storage in this driver.

>> +

>> +**/

>> +EFI_STATUS

>> +EFIAPI

>> +OemExtractConfig (

>> +  IN  CONST EFI_HII_CONFIG_ACCESS_PROTOCOL   *This,

>> +  IN  CONST EFI_STRING                       Request,

>> +  OUT       EFI_STRING                       *Progress,

>> +  OUT       EFI_STRING                       *Results

>> +  );

>> +

>> +/**

>> +  This function processes the results of changes in configuration.

>> +

>> +

>> +  @param This            Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.

>> +  @param Configuration   A null-terminated Unicode string in <ConfigResp> format.

>> +  @param Progress        A pointer to a string filled in with the offset of the most

>> +                         recent '&' before the first failing name/value pair (or the

>> +                         beginning of the string if the failure is in the first

>> +                         name/value pair) or the terminating NULL if all was successful.

>> +

>> +  @retval  EFI_SUCCESS            The Results is processed successfully.

>> +  @retval  EFI_INVALID_PARAMETER  Configuration is NULL.

>> +  @retval  EFI_NOT_FOUND          Routing data doesn't match any storage in this driver.

>> +

>> +**/

>> +EFI_STATUS

>> +EFIAPI

>> +OemRouteConfig (

>> +  IN  CONST EFI_HII_CONFIG_ACCESS_PROTOCOL   *This,

>> +  IN  CONST EFI_STRING                       Configuration,

>> +  OUT       EFI_STRING                       *Progress

>> +  );

>> +

>> +/**

>> +  This function is invoked if user selected a interactive opcode from Device Manager's

>> +  Formset. If user set VBIOS, the new value is saved to EFI variable.

>> +

>> +  @param This            Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.

>> +  @param Action          Specifies the type of action taken by the browser.

>> +  @param QuestionId      A unique value which is sent to the original exporting driver

>> +                         so that it can identify the type of data to expect.

>> +  @param Type            The type of value for the question.

>> +  @param Value           A pointer to the data being sent to the original exporting driver.

>> +  @param ActionRequest   On return, points to the action requested by the callback function.

>> +

>> +  @retval  EFI_SUCCESS           The callback successfully handled the action.

>> +  @retval  EFI_INVALID_PARAMETER The setup browser call this function with invalid parameters.

>> +

>> +**/

>> +EFI_STATUS

>> +EFIAPI

>> +OemCallback (

>> +  IN  CONST EFI_HII_CONFIG_ACCESS_PROTOCOL   *This,

>> +  IN        EFI_BROWSER_ACTION               Action,

>> +  IN        EFI_QUESTION_ID                  QuestionId,

>> +  IN        UINT8                            Type,

>> +  IN        EFI_IFR_TYPE_VALUE               *Value,

>> +  OUT       EFI_BROWSER_ACTION_REQUEST       *ActionRequest

>> +  );

>> +

>> +VOID GetReleaseTime (EFI_TIME *Time);

>> +#endif

>> diff --git a/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigUi.h b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigUi.h

>> new file mode 100644

>> index 0000000000..792e544c22

>> --- /dev/null

>> +++ b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigUi.h

>> @@ -0,0 +1,64 @@

>> +/** @file

>> +

>> +Copyright (c) 2018, Hisilicon Limited. All rights reserved.

>> +Copyright (c) 2018, Linaro Limited. All rights reserved.

>> +This program and the accompanying materials

>> +are licensed and made available under the terms and conditions of the BSD License

>> +which accompanies this distribution.  The full text of the license may be found at

>> +http://opensource.org/licenses/bsd-license.php

>> +

>> +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

>> +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

>> +

>> +Module Name:

>> +

>> +  OemConfigUi.h

>> +

>> +Abstract:

>> +

>> +  NVData structure used by the OEM Config.

>> +

>> +Revision History:

>> +

>> +

>> +**/

>> +

>> +#ifndef _OEM_CONFIG_UI_H_

>> +#define _OEM_CONFIG_UI_H_

>> +

>> +#include <Uefi/UefiMultiPhase.h>

>> +

>> +#define OEM_CONFIG_FORM_ID                   1

>> +#define MEMORY_CONFIG_FORM_ID                2

>> +#define IBMC_CONFIG_FORM_ID                  3

>> +#define PCIE_CONFIG_FORM_ID                  4

>> +#define MISC_CONFIG_FORM_ID                  5

>> +#define RAS_CONFIG_FORM_ID                   6

>> +

>> +#define VFR_FORMID_PCIE_SOCKET0              0x4100

>> +#define VFR_FORMID_PCIE_SOCKET1              0x4200

>> +#define VFR_FORMID_PCIE_PORT0                0x4000

>> +#define VFR_FORMID_PCIE_PORT1                0x4001

>> +#define VFR_FORMID_PCIE_PORT2                0x4002

>> +#define VFR_FORMID_PCIE_PORT3                0x4003

>> +#define VFR_FORMID_PCIE_PORT4                0x4004

>> +#define VFR_FORMID_PCIE_PORT5                0x4005

>> +#define VFR_FORMID_PCIE_PORT6                0x4006

>> +#define VFR_FORMID_PCIE_PORT7                0x4007

>> +#define VFR_FORMID_PCIE_PORT8                0x4008

>> +#define VFR_FORMID_PCIE_PORT9                0x4009

>> +#define VFR_FORMID_PCIE_PORT10               0x4010

>> +#define VFR_FORMID_PCIE_PORT11               0x4011

>> +#define VFR_FORMID_PCIE_PORT12               0x4012

>> +#define VFR_FORMID_PCIE_PORT13               0x4013

>> +#define VFR_FORMID_PCIE_PORT14               0x4014

>> +#define VFR_FORMID_PCIE_PORT15               0x4015

>> +

>> +#define VFR_FORMID_MEMORY_RAS                0x6100

>> +#define VFR_FORMID_CORRECT_ERROR             0x6101

>> +#define VFR_FORMID_PCIE_RAS                  0x6200

>> +

>> +#define RMT_PATTERN_LENGTH                   256

>> +

>> +

>> +#endif

>> diff --git a/Silicon/Hisilicon/Include/Library/OemConfigData.h b/Silicon/Hisilicon/Include/Library/OemConfigData.h

>> new file mode 100644

>> index 0000000000..478821ae2c

>> --- /dev/null

>> +++ b/Silicon/Hisilicon/Include/Library/OemConfigData.h

>> @@ -0,0 +1,84 @@

>> +/** @file

>> +*

>> +*  Copyright (c) 2017 - 2018, Hisilicon Limited. All rights reserved.

>> +*  Copyright (c) 2017 - 2018, Linaro Limited. All rights reserved.

>> +*

>> +*  This program and the accompanying materials

>> +*  are licensed and made available under the terms and conditions of the BSD License

>> +*  which accompanies this distribution.  The full text of the license may be found at

>> +*  http://opensource.org/licenses/bsd-license.php

>> +*

>> +*  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

>> +*  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

>> +*

>> +**/

>> +

>> +

>> +#ifndef _OEM_CONFIG_DATA_H_

>> +#define _OEM_CONFIG_DATA_H_

>> +

>> +#define PCIE_MAX_TOTAL_PORTS                 16

>> +#define OEM_CONFIG_NAME                      L"OemConfig"

>> +#define PLATFORM_SETUP_VARIABLE_FLAG         (EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE)

>> +

>> +#pragma pack(1)

>> +typedef struct {

>> +  /*Memory Config*/

>> +  UINT8         DdrDebugLevel;

>> +  UINT8         DdrFreqLimit;

>> +  UINT8         DdrRefreshSupport;

>> +  UINT8         DdrRefreshRate;

>> +  UINT8         RankMargin;

>> +  UINT8         RankMarginMode;

>> +  UINT32        rmtPatternLength;

>> +  UINT8         perbitmargin;

>> +  UINT8         CaMargin;

>> +  UINT8         CaVrefMarginOption;

>> +  UINT8         NumaEn;

>> +  UINT8         HwMemTest;

>> +  UINT8         DieInterleaving;

>> +  UINT8         ChannelInterleaving;

>> +  UINT8         RankInterleaving;

>> +  UINT8         EccSupport;

>> +  /*iBMC Config*/

>> +  UINT8         BmcWdtEnable;

>> +  UINT8         BmcWdtTimeout;

>> +  UINT8         BmcWdtAction;

>> +  UINT8         OSWdtEnable;

>> +  UINT8         OSWdtTimeout;

>> +  UINT8         OSWdtAction;

>> +  /*PCIe Config*/

>> +  UINT8         PcieSRIOVSupport;

>> +  UINT8         PciePort[PCIE_MAX_TOTAL_PORTS];

>> +  UINT8         PcieLinkSpeedPort[PCIE_MAX_TOTAL_PORTS];

>> +  UINT8         PcieLinkDeEmphasisPort[PCIE_MAX_TOTAL_PORTS];

>> +  UINT8         PcieLinkStatusPort[PCIE_MAX_TOTAL_PORTS];

>> +  UINT8         PcieLinkSpeedRateStatusPort[PCIE_MAX_TOTAL_PORTS];

>> +  UINT8         PcieLinkMaxPort[PCIE_MAX_TOTAL_PORTS];

>> +  UINT8         PcieMaxPayloadSizePort[PCIE_MAX_TOTAL_PORTS];

>> +  UINT8         PcieAspmPort[PCIE_MAX_TOTAL_PORTS];

>> +  /*Misc Config*/

>> +  UINT8         EnableSmmu;

>> +  UINT8         EnableFdtTable;

>> +  UINT8         EnableSpcr;

>> +  /*RAS Config*/

>> +  UINT8         EnRasSupport;

>> +  UINT8         EnPoison;

>> +  UINT8         CheckAlgorithm;

>> +  UINT8         PatrolScrub;

>> +  UINT8         PatrolScrubDuration;

>> +  UINT8         DemandScrubMode;

>> +  UINT8         CorrectErrorThreshold;

>> +  UINT8         AdvanceDeviceCorrection;

>> +  UINT8         RankSparing;

>> +  UINT8         FunnelPeriod;

>> +  UINT8         DpcFeature;

>> +  UINT8         EcrcFeature;

>> +  UINT8         CompletionTimeout;

>> +  UINT8         CompletionTimeoutValue;

>> +  UINT8         HotPlug;

>> +

>> +} OEM_CONFIG_DATA;

>> +#pragma pack()

>> +

>> +#endif

>> diff --git a/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfig.c b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfig.c

>> new file mode 100644

>> index 0000000000..1e3635307c

>> --- /dev/null

>> +++ b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfig.c

>> @@ -0,0 +1,363 @@

>> +/** @file

>> +The OEM config reference implementation

>> +

>> +Copyright (c) 2018, Hisilicon Limited. All rights reserved.

>> +Copyright (c) 2018, Linaro Limited. All rights reserved.

>> +This program and the accompanying materials

>> +are licensed and made available under the terms and conditions of the BSD License

>> +which accompanies this distribution.  The full text of the license may be found at

>> +http://opensource.org/licenses/bsd-license.php

>> +

>> +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

>> +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

>> +

>> +**/

>> +

>> +#include "OemConfig.h"

>> +

>> +OEM_CONFIG_CALLBACK_DATA    mOemConfigPrivate = {

>> +  OEM_CONFIG_CALLBACK_DATA_SIGNATURE,

>> +  NULL,

>> +  NULL,

>> +  {

>> +    OemExtractConfig,

>> +    OemRouteConfig,

>> +    OemCallback

>> +  }

>> +};

>> +

>> +HII_VENDOR_DEVICE_PATH  mOemHiiVendorDevicePath = {

>> +  {

>> +    {

>> +      HARDWARE_DEVICE_PATH,

>> +      HW_VENDOR_DP,

>> +      {

>> +        (UINT8) (sizeof (VENDOR_DEVICE_PATH)),

>> +        (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)

>> +      }

>> +    },

>> +    { 0x874c4dcb, 0x08ec, 0x4fe6, { 0xb5, 0x8e, 0x3a, 0x9e, 0x1c, 0x26, 0x70, 0xb9 } }

>> +  },

>> +  {

>> +    END_DEVICE_PATH_TYPE,

>> +    END_ENTIRE_DEVICE_PATH_SUBTYPE,

>> +    {

>> +      (UINT8) (END_DEVICE_PATH_LENGTH),

>> +      (UINT8) ((END_DEVICE_PATH_LENGTH) >> 8)

>> +    }

>> +  }

>> +};

>> +

>> +

>> +

>> +

>> +

>> +

>> +/**

>> +  This function allows a caller to extract the current configuration for one

>> +  or more named elements from the target driver.

>> +

>> +

>> +  @param This            Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.

>> +  @param Request         A null-terminated Unicode string in <ConfigRequest> format.

>> +  @param Progress        On return, points to a character in the Request string.

>> +                         Points to the string's null terminator if request was successful.

>> +                         Points to the most recent '&' before the first failing name/value

>> +                         pair (or the beginning of the string if the failure is in the

>> +                         first name/value pair) if the request was not successful.

>> +  @param Results         A null-terminated Unicode string in <ConfigAltResp> format which

>> +                         has all values filled in for the names in the Request string.

>> +                         String to be allocated by the called function.

>> +

>> +  @retval  EFI_INVALID_PARAMETER  Request is illegal syntax, or unknown name.

>> +  @retval  EFI_NOT_FOUND          Routing data doesn't match any storage in this driver.

>> +

>> +**/

>> +EFI_STATUS

>> +EFIAPI

>> +OemExtractConfig (

>> +  IN  CONST EFI_HII_CONFIG_ACCESS_PROTOCOL   *This,

>> +  IN  CONST EFI_STRING                       Request,

>> +  OUT EFI_STRING                             *Progress,

>> +  OUT EFI_STRING                             *Results

>> +  )

>> +{

>> +  if (Progress == NULL || Results == NULL) {

>> +    return EFI_INVALID_PARAMETER;

>> +  }

>> +  *Progress = Request;

>> +  return EFI_NOT_FOUND;

>> +}

>> +

>> +/**

>> +  This function processes the results of changes in configuration.

>> +

>> +  @param This            Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.

>> +  @param Configuration   A null-terminated Unicode string in <ConfigResp> format.

>> +  @param Progress        A pointer to a string filled in with the offset of the most

>> +                         recent '&' before the first failing name/value pair (or the

>> +                         beginning of the string if the failure is in the first

>> +                         name/value pair) or the terminating NULL if all was successful.

>> +

>> +  @retval  EFI_INVALID_PARAMETER  Configuration is NULL.

>> +  @retval  EFI_NOT_FOUND          Routing data doesn't match any storage in this driver.

>> +

>> +**/

>> +EFI_STATUS

>> +EFIAPI

>> +OemRouteConfig (

>> +  IN  CONST EFI_HII_CONFIG_ACCESS_PROTOCOL   *This,

>> +  IN  CONST EFI_STRING                       Configuration,

>> +  OUT EFI_STRING                             *Progress

>> +  )

>> +{

>> +  if (Configuration == NULL || Progress == NULL) {

>> +    return EFI_INVALID_PARAMETER;

>> +  }

>> +

>> +  *Progress = Configuration;

>> +

>> +  return EFI_NOT_FOUND;

>> +}

>> +

>> +/**

>> +  This function is invoked if user selected a interactive opcode from Device Manager's

>> +  Formset. If user set VBIOS, the new value is saved to EFI variable.

>> +

>> +  @param This            Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.

>> +  @param Action          Specifies the type of action taken by the browser.

>> +  @param QuestionId      A unique value which is sent to the original exporting driver

>> +                         so that it can identify the type of data to expect.

>> +  @param Type            The type of value for the question.

>> +  @param Value           A pointer to the data being sent to the original exporting driver.

>> +  @param ActionRequest   On return, points to the action requested by the callback function.

>> +

>> +  @retval  EFI_SUCCESS           The callback successfully handled the action.

>> +  @retval  EFI_INVALID_PARAMETER The setup browser call this function with invalid parameters.

>> +

>> +**/

>> +EFI_STATUS

>> +EFIAPI

>> +OemCallback (

>> +  IN  CONST EFI_HII_CONFIG_ACCESS_PROTOCOL   *This,

>> +  IN  EFI_BROWSER_ACTION                     Action,

>> +  IN  EFI_QUESTION_ID                        QuestionId,

>> +  IN  UINT8                                  Type,

>> +  IN  EFI_IFR_TYPE_VALUE                     *Value,

>> +  OUT EFI_BROWSER_ACTION_REQUEST             *ActionRequest

>> +  )

>> +{

>> +  if (Action != EFI_BROWSER_ACTION_CHANGING) {

>> +    //

>> +    // Do nothing for other UEFI Action. Only do call back when data is changed.

>> +    //

>> +    return EFI_UNSUPPORTED;

>> +  }

>> +  if ((Value == NULL) || (ActionRequest == NULL)) {

>> +    return EFI_INVALID_PARAMETER;

>> +  }

>> +

>> +  return EFI_SUCCESS;

>> +}

>> +

>> +/**

>> +  Install Boot Manager Menu driver.

>> +

>> +  @param ImageHandle     The image handle.

>> +  @param SystemTable     The system table.

>> +

>> +  @retval  EFI_SUCEESS  Install Boot manager menu success.

>> +  @retval  Other        Return error status.

>> +

>> +**/

>> +EFI_STATUS

>> +EFIAPI

>> +OemConfigUiLibConstructor (

>> +  IN EFI_HANDLE                            ImageHandle,

>> +  IN EFI_SYSTEM_TABLE                      *SystemTable

>> +  )

>> +{

>> +  EFI_STATUS                  Status;

>> +  OEM_CONFIG_DATA             Configuration;

>> +  VOID                        *Hob;

>> +  VERSION_INFO                *VersionInfo;

>> +  UINTN                       BufSize;

>> +  BOOLEAN                     Action;

>> +  EFI_STRING                  ConfigRequestHdr;

>> +  EFI_TIME                    Time = {0};

>> +  CHAR16                      TmpString[0x100] = {0};

>> +

>> +  mOemConfigPrivate.DriverHandle = NULL;

>> +  Status = gBS->InstallMultipleProtocolInterfaces (

>> +                  &mOemConfigPrivate.DriverHandle,

>> +                  &gEfiDevicePathProtocolGuid,

>> +                  &mOemHiiVendorDevicePath,

>> +                  &gEfiHiiConfigAccessProtocolGuid,

>> +                  &mOemConfigPrivate.ConfigAccess,

>> +                  NULL

>> +                  );

>> +  if (EFI_ERROR (Status)) {

>> +    return Status;

>> +  }

>> +

>> +  //

>> +  // Publish our HII data.

>> +  //

>> +  mOemConfigPrivate.HiiHandle = HiiAddPackages (

>> +                                   &gOemConfigGuid,

>> +                                   mOemConfigPrivate.DriverHandle,

>> +                                   OemConfigVfrBin,

>> +                                   OemConfigUiLibStrings,

>> +                                   NULL

>> +                                   );

>> +  if (mOemConfigPrivate.HiiHandle == NULL) {

>> +    DEBUG ((DEBUG_ERROR, "OemConfigUiLibConstructor(), Fail to Add Oem Hii Package.\n"));

> 

> Sorry, missed this one first time around:

> Please use %a and __FUNCTION__ instead of hardcoding the function name.


Modify it in v4.

> 

>> +    return EFI_INVALID_PARAMETER;

>> +  }

>> +  //

>> +  //BIOS Build Time Init

>> +  //

>> +  Hob = GetFirstGuidHob (&gVersionInfoHobGuid);

>> +  if (Hob == NULL) {

>> +    DEBUG ((DEBUG_ERROR, "[%a]:[%d] Version information HOB not found!\n",

>> +      __FILE__, __LINE__));

>> +    return EFI_NOT_FOUND;

>> +  }

>> +  VersionInfo = GET_GUID_HOB_DATA (Hob);

>> +  Time = VersionInfo->BuildTime;

>> +  UnicodeSPrint (

>> +    TmpString,

>> +    sizeof (TmpString),

>> +    L"%02d/%02d/%04d %02d:%02d",

>> +    Time.Month,

>> +    Time.Day,

>> +    Time.Year,

>> +    Time.Hour,

>> +    Time.Minute

>> +    );

>> +  HiiSetString (

>> +    mOemConfigPrivate.HiiHandle,

>> +    STRING_TOKEN (STR_MISC_BIOS_BUILDTIME),

>> +    TmpString,

>> +    "en-US"

>> +    );

>> +  //

>> +  // Check Oem Config Variable.

>> +  //

>> +  ConfigRequestHdr = HiiConstructConfigHdr (

>> +                       &gOemConfigGuid,

>> +                       OEM_CONFIG_NAME,

>> +                       mOemConfigPrivate.DriverHandle

>> +                       );

>> +  ZeroMem (&Configuration, sizeof (OEM_CONFIG_DATA));

>> +  BufSize = sizeof (OEM_CONFIG_DATA);

>> +  Status = gRT->GetVariable (

>> +                  OEM_CONFIG_NAME,

>> +                  &gOemConfigGuid,

>> +                  NULL,

>> +                  &BufSize,

>> +                  &Configuration

>> +                  );

>> +  if (EFI_ERROR (Status)) {

>> +    Action = HiiSetToDefaults (ConfigRequestHdr, EFI_HII_DEFAULT_CLASS_STANDARD);

>> +    if (!Action) {

>> +      //

>> +      //Set the default value of the DDR option

>> +      //

>> +      Configuration.DdrDebugLevel = 0;

>> +      Configuration.DdrFreqLimit = 0;

>> +      Configuration.DdrRefreshSupport = 0;

>> +      Configuration.DdrRefreshRate = 0;

>> +      Configuration.RankMargin = 0;

>> +      Configuration.RankMarginMode = 2;

>> +      Configuration.rmtPatternLength = 256;

>> +      Configuration.perbitmargin = 0x0;

>> +      Configuration.CaMargin = 0x0;

>> +      Configuration.CaVrefMarginOption = 0x0;

>> +      Configuration.NumaEn = 1;

>> +      Configuration.HwMemTest = 0;

>> +      Configuration.DieInterleaving = 0;

>> +      Configuration.ChannelInterleaving = 1;

>> +      Configuration.RankInterleaving = 2;

>> +      Configuration.EccSupport = 0;

>> +      //

>> +      //Set the default value of the BMC option

>> +      //

>> +      Configuration.BmcWdtEnable = 0;

>> +      Configuration.BmcWdtTimeout = 15;

>> +      Configuration.BmcWdtAction = 1;

>> +      Configuration.OSWdtEnable = 0;

>> +      Configuration.OSWdtTimeout = 5;

>> +      Configuration.OSWdtAction = 1;

> 

> Where did the PCIe go?


PCIe is not ready now, so the PCIe item hide.
The PCIe hunk source is not applicable for D06, so delete it.

> 

> /

>     Leif

> 

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
diff mbox series

Patch

diff --git a/Silicon/Hisilicon/HisiPkg.dec b/Silicon/Hisilicon/HisiPkg.dec
index b56a6a6af7..858b840a57 100644
--- a/Silicon/Hisilicon/HisiPkg.dec
+++ b/Silicon/Hisilicon/HisiPkg.dec
@@ -44,6 +44,7 @@ 
   gHisiTokenSpaceGuid = {0xc8bc553e, 0x12bf, 0x11e6, {0x97, 0x4f, 0x87, 0xf7, 0x7c, 0xfd, 0x52, 0x1d}}
 
   gHisiEfiMemoryMapGuid  = {0xf8870015, 0x6994, 0x4b98, {0x95, 0xa2, 0xbd, 0x56, 0xda, 0x91, 0xc0, 0x7f}}
+  gOemConfigGuid = {0x42927b59, 0x58fc, 0x41be, {0x8f, 0x59, 0xd1, 0x7c, 0x02, 0x1a, 0x70, 0x13}}
   gVersionInfoHobGuid = {0xe13a14c, 0x859c, 0x4f22, {0x82, 0xbd, 0x18, 0xe, 0xe1, 0x42, 0x12, 0xbf}}
   gHisiOemVariableGuid = {0xac62b9a5, 0x9939, 0x41d3, {0xff, 0x5c, 0xc5, 0x80, 0x32, 0x7d, 0x9b, 0x29}}
   gOemBootVariableGuid = {0xb7784577, 0x5aaf, 0x4557, {0xa1, 0x99, 0xd4, 0xa4, 0x2f, 0x45, 0x06, 0xf8}}
diff --git a/Platform/Hisilicon/D06/D06.dsc b/Platform/Hisilicon/D06/D06.dsc
index 9d4a86a4f4..bec422670d 100644
--- a/Platform/Hisilicon/D06/D06.dsc
+++ b/Platform/Hisilicon/D06/D06.dsc
@@ -330,7 +330,10 @@ 
   #ACPI
   #
   MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
-  Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf
+  Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf {
+    <LibraryClasses>
+    NULL|Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigUiLib.inf
+  }
 
   Silicon/Hisilicon/Hi1620/Hi1620AcpiTables/AcpiTablesHi1620.inf
   Silicon/Hisilicon/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf
diff --git a/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf b/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf
index e268a56bbd..281a4f2ebd 100644
--- a/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf
+++ b/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf
@@ -56,7 +56,7 @@ 
   gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiTableStorageFile    ## CONSUMES
 
 [Depex]
-  gEfiAcpiTableProtocolGuid
+  gEfiAcpiTableProtocolGuid AND gEfiVariableWriteArchProtocolGuid
 
 [UserExtensions.TianoCore."ExtraFiles"]
   AcpiPlatformExtra.uni
diff --git a/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigUiLib.inf b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigUiLib.inf
new file mode 100644
index 0000000000..fba619e9ba
--- /dev/null
+++ b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigUiLib.inf
@@ -0,0 +1,68 @@ 
+## @file
+#  OEM config Library used by BDS
+#
+#  Copyright (c) 2018, Hisilicon Limited. All rights reserved.
+#  Copyright (c) 2018, Linaro Limited. All rights reserved.
+#  This program and the accompanying materials are licensed and made available under
+#  the terms and conditions of the BSD License that accompanies this distribution.
+#  The full text of the license may be found at
+#  http://opensource.org/licenses/bsd-license.php.
+#
+#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+##
+[Defines]
+  INF_VERSION                    = 0x0001001A
+  BASE_NAME                      = OemConfigUiLib
+  MODULE_UNI_FILE                = OemConfigUiLib.uni
+  FILE_GUID                      = 32B373AC-00B6-471b-B3AE-6E4A4501F6BA
+  MODULE_TYPE                    = DXE_DRIVER
+  VERSION_STRING                 = 1.0
+  LIBRARY_CLASS                  = NULL|DXE_DRIVER UEFI_APPLICATION
+  CONSTRUCTOR                    = OemConfigUiLibConstructor
+  DESTRUCTOR                     = OemConfigUiLibDestructor
+
+[Sources]
+  iBMCConfig.hfr
+  iBMCConfig.uni
+  MemoryConfig.hfr
+  MemoryConfig.uni
+  MiscConfig.hfr
+  MiscConfig.uni
+  OemConfig.c
+  OemConfig.h
+  OemConfigUiLibStrings.uni
+  OemConfigVfr.Vfr
+  PcieConfig.hfr
+  PcieConfigStrings.uni
+  PciePortConfig.hfr
+  RasConfig.hfr
+  RasConfig.uni
+
+[Packages]
+  MdeModulePkg/MdeModulePkg.dec
+  MdePkg/MdePkg.dec
+  Silicon/Hisilicon/HisiPkg.dec
+
+[LibraryClasses]
+  BaseLib
+  BaseMemoryLib
+  DebugLib
+  DevicePathLib
+  HiiLib
+  MemoryAllocationLib
+  PrintLib
+  UefiBootServicesTableLib
+  UefiHiiServicesLib
+  UefiRuntimeServicesTableLib
+
+[Guids]
+  gEfiHiiPlatformSetupFormsetGuid               ## CONSUMES ## GUID (Indicate the formset class guid to be displayed)
+  gEfiIfrFrontPageGuid                          ## CONSUMES ## GUID (Indicate the formset in this library need to dispaly in which page)
+  gEfiIfrTianoGuid                              ## CONSUMES ## GUID (Extended IFR Guid Opcode)
+  gOemConfigGuid
+  gVersionInfoHobGuid
+
+[Protocols]
+  gEfiHiiConfigAccessProtocolGuid               ## CONSUMES
diff --git a/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfig.h b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfig.h
new file mode 100644
index 0000000000..f91400150c
--- /dev/null
+++ b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfig.h
@@ -0,0 +1,142 @@ 
+/** @file
+The Oem config reference implement
+
+Copyright (c) 2018, Hisilicon Limited. All rights reserved.
+Copyright (c) 2018, Linaro Limited. All rights reserved.
+This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution.  The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef _OEM_CONFIG_H_
+#define _OEM_CONFIG_H_
+
+#include <Guid/HiiPlatformSetupFormset.h>
+#include <Guid/MdeModuleHii.h>
+#include <Guid/VersionInfoHobGuid.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/BaseLib.h>
+#include <Library/DebugLib.h>
+#include <Library/DevicePathLib.h>
+#include <Library/HiiLib.h>
+#include <Library/HobLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include "Library/OemConfigData.h"
+#include <Library/PcdLib.h>
+#include <Library/PrintLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/UefiHiiServicesLib.h>
+#include <Library/UefiRuntimeServicesTableLib.h>
+#include <Pi/PiFirmwareVolume.h>
+#include <Protocol/HiiConfigAccess.h>
+
+//
+// These are the VFR compiler generated data representing our VFR data.
+//
+extern UINT8  OemConfigVfrBin[];
+
+//
+// HII specific Vendor Device Path definition.
+//
+typedef struct {
+  VENDOR_DEVICE_PATH          VendorDevicePath;
+  EFI_DEVICE_PATH_PROTOCOL    End;
+} HII_VENDOR_DEVICE_PATH;
+
+#define OEM_CONFIG_CALLBACK_DATA_SIGNATURE  SIGNATURE_32 ('O', 'E', 'M', 'C')
+typedef struct {
+  UINTN                             Signature;
+  EFI_HII_HANDLE                    HiiHandle;
+  EFI_HANDLE                        DriverHandle;
+  EFI_HII_CONFIG_ACCESS_PROTOCOL    ConfigAccess;
+} OEM_CONFIG_CALLBACK_DATA;
+
+/**
+  This function allows a caller to extract the current configuration for one
+  or more named elements from the target driver.
+
+
+  @param This            Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
+  @param Request         A null-terminated Unicode string in <ConfigRequest> format.
+  @param Progress        On return, points to a character in the Request string.
+                         Points to the string's null terminator if request was successful.
+                         Points to the most recent '&' before the first failing name/value
+                         pair (or the beginning of the string if the failure is in the
+                         first name/value pair) if the request was not successful.
+  @param Results         A null-terminated Unicode string in <ConfigAltResp> format which
+                         has all values filled in for the names in the Request string.
+                         String to be allocated by the called function.
+
+  @retval  EFI_SUCCESS            The Results is filled with the requested values.
+  @retval  EFI_OUT_OF_RESOURCES   Not enough memory to store the results.
+  @retval  EFI_INVALID_PARAMETER  Request is illegal syntax, or unknown name.
+  @retval  EFI_NOT_FOUND          Routing data doesn't match any storage in this driver.
+
+**/
+EFI_STATUS
+EFIAPI
+OemExtractConfig (
+  IN  CONST EFI_HII_CONFIG_ACCESS_PROTOCOL   *This,
+  IN  CONST EFI_STRING                       Request,
+  OUT       EFI_STRING                       *Progress,
+  OUT       EFI_STRING                       *Results
+  );
+
+/**
+  This function processes the results of changes in configuration.
+
+
+  @param This            Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
+  @param Configuration   A null-terminated Unicode string in <ConfigResp> format.
+  @param Progress        A pointer to a string filled in with the offset of the most
+                         recent '&' before the first failing name/value pair (or the
+                         beginning of the string if the failure is in the first
+                         name/value pair) or the terminating NULL if all was successful.
+
+  @retval  EFI_SUCCESS            The Results is processed successfully.
+  @retval  EFI_INVALID_PARAMETER  Configuration is NULL.
+  @retval  EFI_NOT_FOUND          Routing data doesn't match any storage in this driver.
+
+**/
+EFI_STATUS
+EFIAPI
+OemRouteConfig (
+  IN  CONST EFI_HII_CONFIG_ACCESS_PROTOCOL   *This,
+  IN  CONST EFI_STRING                       Configuration,
+  OUT       EFI_STRING                       *Progress
+  );
+
+/**
+  This function is invoked if user selected a interactive opcode from Device Manager's
+  Formset. If user set VBIOS, the new value is saved to EFI variable.
+
+  @param This            Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
+  @param Action          Specifies the type of action taken by the browser.
+  @param QuestionId      A unique value which is sent to the original exporting driver
+                         so that it can identify the type of data to expect.
+  @param Type            The type of value for the question.
+  @param Value           A pointer to the data being sent to the original exporting driver.
+  @param ActionRequest   On return, points to the action requested by the callback function.
+
+  @retval  EFI_SUCCESS           The callback successfully handled the action.
+  @retval  EFI_INVALID_PARAMETER The setup browser call this function with invalid parameters.
+
+**/
+EFI_STATUS
+EFIAPI
+OemCallback (
+  IN  CONST EFI_HII_CONFIG_ACCESS_PROTOCOL   *This,
+  IN        EFI_BROWSER_ACTION               Action,
+  IN        EFI_QUESTION_ID                  QuestionId,
+  IN        UINT8                            Type,
+  IN        EFI_IFR_TYPE_VALUE               *Value,
+  OUT       EFI_BROWSER_ACTION_REQUEST       *ActionRequest
+  );
+
+VOID GetReleaseTime (EFI_TIME *Time);
+#endif
diff --git a/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigUi.h b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigUi.h
new file mode 100644
index 0000000000..792e544c22
--- /dev/null
+++ b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigUi.h
@@ -0,0 +1,64 @@ 
+/** @file
+
+Copyright (c) 2018, Hisilicon Limited. All rights reserved.
+Copyright (c) 2018, Linaro Limited. All rights reserved.
+This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution.  The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+Module Name:
+
+  OemConfigUi.h
+
+Abstract:
+
+  NVData structure used by the OEM Config.
+
+Revision History:
+
+
+**/
+
+#ifndef _OEM_CONFIG_UI_H_
+#define _OEM_CONFIG_UI_H_
+
+#include <Uefi/UefiMultiPhase.h>
+
+#define OEM_CONFIG_FORM_ID                   1
+#define MEMORY_CONFIG_FORM_ID                2
+#define IBMC_CONFIG_FORM_ID                  3
+#define PCIE_CONFIG_FORM_ID                  4
+#define MISC_CONFIG_FORM_ID                  5
+#define RAS_CONFIG_FORM_ID                   6
+
+#define VFR_FORMID_PCIE_SOCKET0              0x4100
+#define VFR_FORMID_PCIE_SOCKET1              0x4200
+#define VFR_FORMID_PCIE_PORT0                0x4000
+#define VFR_FORMID_PCIE_PORT1                0x4001
+#define VFR_FORMID_PCIE_PORT2                0x4002
+#define VFR_FORMID_PCIE_PORT3                0x4003
+#define VFR_FORMID_PCIE_PORT4                0x4004
+#define VFR_FORMID_PCIE_PORT5                0x4005
+#define VFR_FORMID_PCIE_PORT6                0x4006
+#define VFR_FORMID_PCIE_PORT7                0x4007
+#define VFR_FORMID_PCIE_PORT8                0x4008
+#define VFR_FORMID_PCIE_PORT9                0x4009
+#define VFR_FORMID_PCIE_PORT10               0x4010
+#define VFR_FORMID_PCIE_PORT11               0x4011
+#define VFR_FORMID_PCIE_PORT12               0x4012
+#define VFR_FORMID_PCIE_PORT13               0x4013
+#define VFR_FORMID_PCIE_PORT14               0x4014
+#define VFR_FORMID_PCIE_PORT15               0x4015
+
+#define VFR_FORMID_MEMORY_RAS                0x6100
+#define VFR_FORMID_CORRECT_ERROR             0x6101
+#define VFR_FORMID_PCIE_RAS                  0x6200
+
+#define RMT_PATTERN_LENGTH                   256
+
+
+#endif
diff --git a/Silicon/Hisilicon/Include/Library/OemConfigData.h b/Silicon/Hisilicon/Include/Library/OemConfigData.h
new file mode 100644
index 0000000000..478821ae2c
--- /dev/null
+++ b/Silicon/Hisilicon/Include/Library/OemConfigData.h
@@ -0,0 +1,84 @@ 
+/** @file
+*
+*  Copyright (c) 2017 - 2018, Hisilicon Limited. All rights reserved.
+*  Copyright (c) 2017 - 2018, Linaro Limited. All rights reserved.
+*
+*  This program and the accompanying materials
+*  are licensed and made available under the terms and conditions of the BSD License
+*  which accompanies this distribution.  The full text of the license may be found at
+*  http://opensource.org/licenses/bsd-license.php
+*
+*  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+*  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+*
+**/
+
+
+#ifndef _OEM_CONFIG_DATA_H_
+#define _OEM_CONFIG_DATA_H_
+
+#define PCIE_MAX_TOTAL_PORTS                 16
+#define OEM_CONFIG_NAME                      L"OemConfig"
+#define PLATFORM_SETUP_VARIABLE_FLAG         (EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE)
+
+#pragma pack(1)
+typedef struct {
+  /*Memory Config*/
+  UINT8         DdrDebugLevel;
+  UINT8         DdrFreqLimit;
+  UINT8         DdrRefreshSupport;
+  UINT8         DdrRefreshRate;
+  UINT8         RankMargin;
+  UINT8         RankMarginMode;
+  UINT32        rmtPatternLength;
+  UINT8         perbitmargin;
+  UINT8         CaMargin;
+  UINT8         CaVrefMarginOption;
+  UINT8         NumaEn;
+  UINT8         HwMemTest;
+  UINT8         DieInterleaving;
+  UINT8         ChannelInterleaving;
+  UINT8         RankInterleaving;
+  UINT8         EccSupport;
+  /*iBMC Config*/
+  UINT8         BmcWdtEnable;
+  UINT8         BmcWdtTimeout;
+  UINT8         BmcWdtAction;
+  UINT8         OSWdtEnable;
+  UINT8         OSWdtTimeout;
+  UINT8         OSWdtAction;
+  /*PCIe Config*/
+  UINT8         PcieSRIOVSupport;
+  UINT8         PciePort[PCIE_MAX_TOTAL_PORTS];
+  UINT8         PcieLinkSpeedPort[PCIE_MAX_TOTAL_PORTS];
+  UINT8         PcieLinkDeEmphasisPort[PCIE_MAX_TOTAL_PORTS];
+  UINT8         PcieLinkStatusPort[PCIE_MAX_TOTAL_PORTS];
+  UINT8         PcieLinkSpeedRateStatusPort[PCIE_MAX_TOTAL_PORTS];
+  UINT8         PcieLinkMaxPort[PCIE_MAX_TOTAL_PORTS];
+  UINT8         PcieMaxPayloadSizePort[PCIE_MAX_TOTAL_PORTS];
+  UINT8         PcieAspmPort[PCIE_MAX_TOTAL_PORTS];
+  /*Misc Config*/
+  UINT8         EnableSmmu;
+  UINT8         EnableFdtTable;
+  UINT8         EnableSpcr;
+  /*RAS Config*/
+  UINT8         EnRasSupport;
+  UINT8         EnPoison;
+  UINT8         CheckAlgorithm;
+  UINT8         PatrolScrub;
+  UINT8         PatrolScrubDuration;
+  UINT8         DemandScrubMode;
+  UINT8         CorrectErrorThreshold;
+  UINT8         AdvanceDeviceCorrection;
+  UINT8         RankSparing;
+  UINT8         FunnelPeriod;
+  UINT8         DpcFeature;
+  UINT8         EcrcFeature;
+  UINT8         CompletionTimeout;
+  UINT8         CompletionTimeoutValue;
+  UINT8         HotPlug;
+
+} OEM_CONFIG_DATA;
+#pragma pack()
+
+#endif
diff --git a/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfig.c b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfig.c
new file mode 100644
index 0000000000..1e3635307c
--- /dev/null
+++ b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfig.c
@@ -0,0 +1,363 @@ 
+/** @file
+The OEM config reference implementation
+
+Copyright (c) 2018, Hisilicon Limited. All rights reserved.
+Copyright (c) 2018, Linaro Limited. All rights reserved.
+This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution.  The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include "OemConfig.h"
+
+OEM_CONFIG_CALLBACK_DATA    mOemConfigPrivate = {
+  OEM_CONFIG_CALLBACK_DATA_SIGNATURE,
+  NULL,
+  NULL,
+  {
+    OemExtractConfig,
+    OemRouteConfig,
+    OemCallback
+  }
+};
+
+HII_VENDOR_DEVICE_PATH  mOemHiiVendorDevicePath = {
+  {
+    {
+      HARDWARE_DEVICE_PATH,
+      HW_VENDOR_DP,
+      {
+        (UINT8) (sizeof (VENDOR_DEVICE_PATH)),
+        (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)
+      }
+    },
+    { 0x874c4dcb, 0x08ec, 0x4fe6, { 0xb5, 0x8e, 0x3a, 0x9e, 0x1c, 0x26, 0x70, 0xb9 } }
+  },
+  {
+    END_DEVICE_PATH_TYPE,
+    END_ENTIRE_DEVICE_PATH_SUBTYPE,
+    {
+      (UINT8) (END_DEVICE_PATH_LENGTH),
+      (UINT8) ((END_DEVICE_PATH_LENGTH) >> 8)
+    }
+  }
+};
+
+
+
+
+
+
+/**
+  This function allows a caller to extract the current configuration for one
+  or more named elements from the target driver.
+
+
+  @param This            Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
+  @param Request         A null-terminated Unicode string in <ConfigRequest> format.
+  @param Progress        On return, points to a character in the Request string.
+                         Points to the string's null terminator if request was successful.
+                         Points to the most recent '&' before the first failing name/value
+                         pair (or the beginning of the string if the failure is in the
+                         first name/value pair) if the request was not successful.
+  @param Results         A null-terminated Unicode string in <ConfigAltResp> format which
+                         has all values filled in for the names in the Request string.
+                         String to be allocated by the called function.
+
+  @retval  EFI_INVALID_PARAMETER  Request is illegal syntax, or unknown name.
+  @retval  EFI_NOT_FOUND          Routing data doesn't match any storage in this driver.
+
+**/
+EFI_STATUS
+EFIAPI
+OemExtractConfig (
+  IN  CONST EFI_HII_CONFIG_ACCESS_PROTOCOL   *This,
+  IN  CONST EFI_STRING                       Request,
+  OUT EFI_STRING                             *Progress,
+  OUT EFI_STRING                             *Results
+  )
+{
+  if (Progress == NULL || Results == NULL) {
+    return EFI_INVALID_PARAMETER;
+  }
+  *Progress = Request;
+  return EFI_NOT_FOUND;
+}
+
+/**
+  This function processes the results of changes in configuration.
+
+  @param This            Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
+  @param Configuration   A null-terminated Unicode string in <ConfigResp> format.
+  @param Progress        A pointer to a string filled in with the offset of the most
+                         recent '&' before the first failing name/value pair (or the
+                         beginning of the string if the failure is in the first
+                         name/value pair) or the terminating NULL if all was successful.
+
+  @retval  EFI_INVALID_PARAMETER  Configuration is NULL.
+  @retval  EFI_NOT_FOUND          Routing data doesn't match any storage in this driver.
+
+**/
+EFI_STATUS
+EFIAPI
+OemRouteConfig (
+  IN  CONST EFI_HII_CONFIG_ACCESS_PROTOCOL   *This,
+  IN  CONST EFI_STRING                       Configuration,
+  OUT EFI_STRING                             *Progress
+  )
+{
+  if (Configuration == NULL || Progress == NULL) {
+    return EFI_INVALID_PARAMETER;
+  }
+
+  *Progress = Configuration;
+
+  return EFI_NOT_FOUND;
+}
+
+/**
+  This function is invoked if user selected a interactive opcode from Device Manager's
+  Formset. If user set VBIOS, the new value is saved to EFI variable.
+
+  @param This            Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
+  @param Action          Specifies the type of action taken by the browser.
+  @param QuestionId      A unique value which is sent to the original exporting driver
+                         so that it can identify the type of data to expect.
+  @param Type            The type of value for the question.
+  @param Value           A pointer to the data being sent to the original exporting driver.
+  @param ActionRequest   On return, points to the action requested by the callback function.
+
+  @retval  EFI_SUCCESS           The callback successfully handled the action.
+  @retval  EFI_INVALID_PARAMETER The setup browser call this function with invalid parameters.
+
+**/
+EFI_STATUS
+EFIAPI
+OemCallback (
+  IN  CONST EFI_HII_CONFIG_ACCESS_PROTOCOL   *This,
+  IN  EFI_BROWSER_ACTION                     Action,
+  IN  EFI_QUESTION_ID                        QuestionId,
+  IN  UINT8                                  Type,
+  IN  EFI_IFR_TYPE_VALUE                     *Value,
+  OUT EFI_BROWSER_ACTION_REQUEST             *ActionRequest
+  )
+{
+  if (Action != EFI_BROWSER_ACTION_CHANGING) {
+    //
+    // Do nothing for other UEFI Action. Only do call back when data is changed.
+    //
+    return EFI_UNSUPPORTED;
+  }
+  if ((Value == NULL) || (ActionRequest == NULL)) {
+    return EFI_INVALID_PARAMETER;
+  }
+
+  return EFI_SUCCESS;
+}
+
+/**
+  Install Boot Manager Menu driver.
+
+  @param ImageHandle     The image handle.
+  @param SystemTable     The system table.
+
+  @retval  EFI_SUCEESS  Install Boot manager menu success.
+  @retval  Other        Return error status.
+
+**/
+EFI_STATUS
+EFIAPI
+OemConfigUiLibConstructor (
+  IN EFI_HANDLE                            ImageHandle,
+  IN EFI_SYSTEM_TABLE                      *SystemTable
+  )
+{
+  EFI_STATUS                  Status;
+  OEM_CONFIG_DATA             Configuration;
+  VOID                        *Hob;
+  VERSION_INFO                *VersionInfo;
+  UINTN                       BufSize;
+  BOOLEAN                     Action;
+  EFI_STRING                  ConfigRequestHdr;
+  EFI_TIME                    Time = {0};
+  CHAR16                      TmpString[0x100] = {0};
+
+  mOemConfigPrivate.DriverHandle = NULL;
+  Status = gBS->InstallMultipleProtocolInterfaces (
+                  &mOemConfigPrivate.DriverHandle,
+                  &gEfiDevicePathProtocolGuid,
+                  &mOemHiiVendorDevicePath,
+                  &gEfiHiiConfigAccessProtocolGuid,
+                  &mOemConfigPrivate.ConfigAccess,
+                  NULL
+                  );
+  if (EFI_ERROR (Status)) {
+    return Status;
+  }
+
+  //
+  // Publish our HII data.
+  //
+  mOemConfigPrivate.HiiHandle = HiiAddPackages (
+                                   &gOemConfigGuid,
+                                   mOemConfigPrivate.DriverHandle,
+                                   OemConfigVfrBin,
+                                   OemConfigUiLibStrings,
+                                   NULL
+                                   );
+  if (mOemConfigPrivate.HiiHandle == NULL) {
+    DEBUG ((DEBUG_ERROR, "OemConfigUiLibConstructor(), Fail to Add Oem Hii Package.\n"));
+    return EFI_INVALID_PARAMETER;
+  }
+  //
+  //BIOS Build Time Init
+  //
+  Hob = GetFirstGuidHob (&gVersionInfoHobGuid);
+  if (Hob == NULL) {
+    DEBUG ((DEBUG_ERROR, "[%a]:[%d] Version information HOB not found!\n",
+      __FILE__, __LINE__));
+    return EFI_NOT_FOUND;
+  }
+  VersionInfo = GET_GUID_HOB_DATA (Hob);
+  Time = VersionInfo->BuildTime;
+  UnicodeSPrint (
+    TmpString,
+    sizeof (TmpString),
+    L"%02d/%02d/%04d %02d:%02d",
+    Time.Month,
+    Time.Day,
+    Time.Year,
+    Time.Hour,
+    Time.Minute
+    );
+  HiiSetString (
+    mOemConfigPrivate.HiiHandle,
+    STRING_TOKEN (STR_MISC_BIOS_BUILDTIME),
+    TmpString,
+    "en-US"
+    );
+  //
+  // Check Oem Config Variable.
+  //
+  ConfigRequestHdr = HiiConstructConfigHdr (
+                       &gOemConfigGuid,
+                       OEM_CONFIG_NAME,
+                       mOemConfigPrivate.DriverHandle
+                       );
+  ZeroMem (&Configuration, sizeof (OEM_CONFIG_DATA));
+  BufSize = sizeof (OEM_CONFIG_DATA);
+  Status = gRT->GetVariable (
+                  OEM_CONFIG_NAME,
+                  &gOemConfigGuid,
+                  NULL,
+                  &BufSize,
+                  &Configuration
+                  );
+  if (EFI_ERROR (Status)) {
+    Action = HiiSetToDefaults (ConfigRequestHdr, EFI_HII_DEFAULT_CLASS_STANDARD);
+    if (!Action) {
+      //
+      //Set the default value of the DDR option
+      //
+      Configuration.DdrDebugLevel = 0;
+      Configuration.DdrFreqLimit = 0;
+      Configuration.DdrRefreshSupport = 0;
+      Configuration.DdrRefreshRate = 0;
+      Configuration.RankMargin = 0;
+      Configuration.RankMarginMode = 2;
+      Configuration.rmtPatternLength = 256;
+      Configuration.perbitmargin = 0x0;
+      Configuration.CaMargin = 0x0;
+      Configuration.CaVrefMarginOption = 0x0;
+      Configuration.NumaEn = 1;
+      Configuration.HwMemTest = 0;
+      Configuration.DieInterleaving = 0;
+      Configuration.ChannelInterleaving = 1;
+      Configuration.RankInterleaving = 2;
+      Configuration.EccSupport = 0;
+      //
+      //Set the default value of the BMC option
+      //
+      Configuration.BmcWdtEnable = 0;
+      Configuration.BmcWdtTimeout = 15;
+      Configuration.BmcWdtAction = 1;
+      Configuration.OSWdtEnable = 0;
+      Configuration.OSWdtTimeout = 5;
+      Configuration.OSWdtAction = 1;
+      //
+      //Set the default value of the Misc option
+      //
+      Configuration.EnableSmmu = 1;
+      Configuration.EnableFdtTable = 0;
+      Configuration.EnableSpcr = 0;
+      //
+      //Set the default value of the Ras option
+      //
+      Configuration.EnRasSupport = 1;
+      Configuration.EnPoison = 1;
+      Configuration.CheckAlgorithm = 0;
+      Configuration.PatrolScrub = 1;
+      Configuration.PatrolScrubDuration = 24;
+      Configuration.DemandScrubMode = 0;
+      Configuration.CorrectErrorThreshold = 0;
+      Configuration.AdvanceDeviceCorrection = 0;
+      Configuration.RankSparing = 0;
+      Configuration.FunnelPeriod = 0;
+      Configuration.DpcFeature = 0;
+      Configuration.EcrcFeature = 0;
+      Configuration.CompletionTimeout = 1;
+      Configuration.CompletionTimeoutValue = 0;
+      Configuration.HotPlug = 1;
+      Status = gRT->SetVariable (
+                      OEM_CONFIG_NAME,
+                      &gOemConfigGuid,
+                      EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
+                      sizeof (OEM_CONFIG_DATA),
+                      &Configuration
+                      );
+    }
+  } else {
+    Action = HiiValidateSettings (ConfigRequestHdr);
+    if (!Action) {
+      return EFI_INVALID_PARAMETER;
+    }
+  }
+  return EFI_SUCCESS;
+}
+
+/**
+  Unloads the application and its installed protocol.
+
+  @param  ImageHandle     Handle that identifies the image to be unloaded.
+  @param  SystemTable     The system table.
+
+  @retval EFI_SUCCESS           The image has been unloaded.
+**/
+EFI_STATUS
+EFIAPI
+OemConfigUiLibDestructor (
+  IN EFI_HANDLE                            ImageHandle,
+  IN EFI_SYSTEM_TABLE                      *SystemTable
+  )
+{
+  EFI_STATUS                  Status;
+
+  Status = gBS->UninstallMultipleProtocolInterfaces (
+                  mOemConfigPrivate.DriverHandle,
+                  &gEfiDevicePathProtocolGuid,
+                  &mOemHiiVendorDevicePath,
+                  &gEfiHiiConfigAccessProtocolGuid,
+                  &mOemConfigPrivate.ConfigAccess,
+                  NULL
+                  );
+
+  HiiRemovePackages (mOemConfigPrivate.HiiHandle);
+
+  return Status;
+}
+
diff --git a/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/MemoryConfig.hfr b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/MemoryConfig.hfr
new file mode 100644
index 0000000000..c709975c38
--- /dev/null
+++ b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/MemoryConfig.hfr
@@ -0,0 +1,154 @@ 
+/** @file
+*
+*  Memory Config form at Oem Config fromset.
+*
+*  Copyright (c) 2017 - 2018, Hisilicon Limited. All rights reserved.
+*  Copyright (c) 2017 - 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.
+*
+**/
+
+form formid = MEMORY_CONFIG_FORM_ID,
+  title  = STRING_TOKEN(STR_MEMORY_CONFIG_FORM_TITLE);
+
+  oneof varid  = OEM_CONFIG_DATA.DdrDebugLevel,
+        prompt   = STRING_TOKEN (STR_MEM_PRINT_LEVEL_PROMPT),
+        help     = STRING_TOKEN (STR_MEM_PRINT_LEVEL_HELP),
+        option text = STRING_TOKEN (STR_MEM_PRINT_LEVEL_DISABLE),  value = 0, flags = RESET_REQUIRED;
+        option text = STRING_TOKEN (STR_MEM_PRINT_LEVEL_MINIMUM), value = 1, flags = RESET_REQUIRED | MANUFACTURING | DEFAULT;
+        option text = STRING_TOKEN (STR_MEM_PRINT_LEVEL_MINMAX),  value = 2, flags = RESET_REQUIRED;
+        option text = STRING_TOKEN (STR_MEM_PRINT_LEVEL_MAXIMUM),  value = 3, flags = RESET_REQUIRED;
+  endoneof;
+
+  oneof varid = OEM_CONFIG_DATA.DdrFreqLimit,
+        prompt  = STRING_TOKEN(STR_XMP_DDR_FREQ_LIMIT_PROMPT),
+        help    = STRING_TOKEN(STR_XMP_DDR_FREQ_LIMIT_HELP),
+        option text = STRING_TOKEN(STR_AUTO), value = 0, flags = MANUFACTURING | DEFAULT | RESET_REQUIRED;
+        option text = STRING_TOKEN(STR_DDR_FREQ_1333_STRING), value = 5, flags = RESET_REQUIRED;
+        option text = STRING_TOKEN(STR_DDR_FREQ_1600_STRING), value = 7, flags = RESET_REQUIRED;
+        option text = STRING_TOKEN(STR_DDR_FREQ_1866_STRING), value = 9, flags = RESET_REQUIRED;
+        option text = STRING_TOKEN(STR_DDR_FREQ_2133_STRING), value = 11, flags = RESET_REQUIRED ;
+        option text = STRING_TOKEN(STR_DDR_FREQ_2400_STRING), value = 13, flags = RESET_REQUIRED ;
+        option text = STRING_TOKEN(STR_DDR_FREQ_2667_STRING), value = 15, flags = RESET_REQUIRED ;
+        option text = STRING_TOKEN(STR_DDR_FREQ_2933_STRING), value = 17, flags = RESET_REQUIRED ;
+        option text = STRING_TOKEN(STR_DDR_FREQ_3200_STRING), value = 19, flags = RESET_REQUIRED ;
+  endoneof;
+
+  suppressif TRUE;
+    oneof varid = OEM_CONFIG_DATA.DdrRefreshSupport,
+          prompt  = STRING_TOKEN(STR_DDR_REFRESH_SUPPORT_PROMPT),
+          help    = STRING_TOKEN(STR_DDR_REFRESH_SUPPORT_HELP),
+          option text = STRING_TOKEN(STR_ENABLE), value = 1, flags = MANUFACTURING | DEFAULT | RESET_REQUIRED;
+          option text = STRING_TOKEN(STR_DISABLE), value = 0, flags = RESET_REQUIRED;
+    endoneof;
+
+    suppressif ideqval OEM_CONFIG_DATA.DdrRefreshSupport == 0;
+      oneof varid = OEM_CONFIG_DATA.DdrRefreshRate,
+            prompt  = STRING_TOKEN(STR_DDR_REFRESH_PROMPT),
+            help    = STRING_TOKEN(STR_DDR_REFRESH_HELP),
+            option text = STRING_TOKEN(STR_32MS), value = 0, flags = MANUFACTURING | DEFAULT | RESET_REQUIRED;
+            option text = STRING_TOKEN(STR_64MS), value = 1, flags = RESET_REQUIRED;
+      endoneof;
+    endif;
+
+    oneof varid  = OEM_CONFIG_DATA.RankMargin,
+          prompt   = STRING_TOKEN (STR_RMT_PROMPT),
+          help     = STRING_TOKEN (STR_RMT_HELP),
+          option text = STRING_TOKEN (STR_DISABLE), value = 0, flags = DEFAULT | MANUFACTURING |RESET_REQUIRED;
+          option text = STRING_TOKEN (STR_ENABLE),  value = 1, flags = RESET_REQUIRED;
+    endoneof;
+
+    suppressif  ideqval OEM_CONFIG_DATA.RankMargin == 0;
+      oneof varid  = OEM_CONFIG_DATA.RankMarginMode,
+            prompt   = STRING_TOKEN (STR_RMTM_PROMPT),
+            help     = STRING_TOKEN (STR_RMTM_HELP),
+            option text = STRING_TOKEN (STR_RMTM_SFC),     value = 1, flags = RESET_REQUIRED;
+            option text = STRING_TOKEN (STR_RMTM_EXMBIST), value = 2, flags = DEFAULT | MANUFACTURING |RESET_REQUIRED;
+      endoneof;
+
+      numeric varid = OEM_CONFIG_DATA.rmtPatternLength,
+              prompt    = STRING_TOKEN (STR_RMT_PATTERN_PROMPT),
+              help      = STRING_TOKEN (STR_RMT_PATTERN_HELP),
+              flags     = RESET_REQUIRED,
+              minimum   = 1,
+              maximum   = 32767,
+              step      = 1,
+              default   = RMT_PATTERN_LENGTH,
+      endnumeric;
+
+      oneof varid  = OEM_CONFIG_DATA.perbitmargin,
+            prompt   = STRING_TOKEN (STR_PER_BIT_MARGIN_PROMPT),
+            help     = STRING_TOKEN (STR_PER_BIT_MARGIN_HELP),
+            option text = STRING_TOKEN (STR_DISABLE), value = 0, flags = MANUFACTURING | DEFAULT | RESET_REQUIRED;
+            option text = STRING_TOKEN (STR_ENABLE),  value = 1, flags = RESET_REQUIRED;
+      endoneof;
+
+      oneof varid  = OEM_CONFIG_DATA.CaMargin,
+            prompt   = STRING_TOKEN (STR_CA_MARGINS_PROMPT),
+            help     = STRING_TOKEN (STR_CA_MARGINS_HELP),
+            option text = STRING_TOKEN (STR_DISABLE), value = 0, flags = MANUFACTURING | DEFAULT | RESET_REQUIRED;
+            option text = STRING_TOKEN (STR_ENABLE),  value = 1, flags = RESET_REQUIRED;
+      endoneof;
+
+      oneof varid  = OEM_CONFIG_DATA.CaVrefMarginOption,
+            prompt   = STRING_TOKEN (STR_CAVREF_MARGINS_PROMPT),
+            help     = STRING_TOKEN (STR_CAVREF_MARGINS_HELP),
+            option text = STRING_TOKEN (STR_CAVREF_MARGINS_OPTION0), value = 0, flags = MANUFACTURING | DEFAULT | RESET_REQUIRED;
+            option text = STRING_TOKEN (STR_CAVREF_MARGINS_OPTION2),  value = 1, flags = RESET_REQUIRED;
+      endoneof;
+    endif;
+
+    oneof varid = OEM_CONFIG_DATA.DieInterleaving,
+          prompt  = STRING_TOKEN(STR_DIE_INTERLEAVING_PROMPT),
+          help    = STRING_TOKEN(STR_DIE_INTERLEAVING_HELP),
+          option text = STRING_TOKEN(STR_DISABLE),               value = 0, flags = RESET_REQUIRED | MANUFACTURING | DEFAULT;
+          option text = STRING_TOKEN(STR_ENABLE),                value = 1, flags = RESET_REQUIRED;
+    endoneof;
+
+    oneof varid = OEM_CONFIG_DATA.ChannelInterleaving,
+          prompt  = STRING_TOKEN(STR_CHANNEL_INTERLEAVING_PROMPT),
+          help    = STRING_TOKEN(STR_CHANNEL_INTERLEAVING_HELP),
+          option text = STRING_TOKEN(STR_DISABLE),               value = 0, flags = RESET_REQUIRED;
+          option text = STRING_TOKEN(STR_ENABLE),                value = 1, flags = RESET_REQUIRED | MANUFACTURING | DEFAULT;
+    endoneof;
+
+    oneof varid = OEM_CONFIG_DATA.RankInterleaving,
+          prompt  = STRING_TOKEN(STR_RANK_INTERLEAVING_PROMPT),
+          help    = STRING_TOKEN(STR_RANK_INTERLEAVING_HELP),
+          option text = STRING_TOKEN(STR_1WAY_STRING),           value = 1, flags = RESET_REQUIRED;
+          option text = STRING_TOKEN(STR_2WAY_STRING),           value = 2, flags = RESET_REQUIRED | MANUFACTURING | DEFAULT;
+          option text = STRING_TOKEN(STR_4WAY_STRING),           value = 4, flags = RESET_REQUIRED;
+    endoneof;
+
+    oneof varid = OEM_CONFIG_DATA.NumaEn,
+          prompt  = STRING_TOKEN(STR_NUMA_PROMPT),
+          help    = STRING_TOKEN(STR_NUMA_HELP),
+          option text = STRING_TOKEN(STR_DISABLE),      value = 0,  flags = RESET_REQUIRED;
+          option text = STRING_TOKEN(STR_ENABLE),       value = 1,  flags = RESET_REQUIRED | MANUFACTURING | DEFAULT;
+    endoneof;
+
+    oneof varid  = OEM_CONFIG_DATA.HwMemTest,
+          prompt   = STRING_TOKEN (STR_MEM_TEST_PROMPT),
+          help     = STRING_TOKEN (STR_MEM_TEST_HELP),
+          option text = STRING_TOKEN (STR_DISABLE), value = 0, flags = MANUFACTURING | DEFAULT | RESET_REQUIRED;
+          option text = STRING_TOKEN (STR_ENABLE),  value = 1, flags = RESET_REQUIRED;
+    endoneof;
+
+    oneof varid  = OEM_CONFIG_DATA.EccSupport,
+          prompt   = STRING_TOKEN (STR_ECC_SUPPORT_PROMPT),
+          help     = STRING_TOKEN (STR_ECC_SUPPORT_HELP),
+          option text = STRING_TOKEN (STR_DISABLE), value = 0, flags = MANUFACTURING | DEFAULT | RESET_REQUIRED;
+          option text = STRING_TOKEN (STR_ECC_EN),  value = 1, flags = RESET_REQUIRED;
+          option text = STRING_TOKEN (STR_SDEC_EN),  value = 2, flags = RESET_REQUIRED;
+    endoneof;
+  endif;
+
+endform;
+
diff --git a/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/MemoryConfig.uni b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/MemoryConfig.uni
new file mode 100644
index 0000000000..0ecf5e59cf
--- /dev/null
+++ b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/MemoryConfig.uni
@@ -0,0 +1,103 @@ 
+/** @file
+*
+*  String definitions for the Memory Config.
+*
+*  Copyright (c) 2017 - 2018, Hisilicon Limited. All rights reserved.
+*  Copyright (c) 2017 - 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.
+*
+**/
+
+/=#
+
+#langdef   en-US "English"
+
+#string STR_MEMORY_CONFIG_FORM_TITLE        #language en-US "Memory Configuration"
+#string STR_MEMORY_CONFIG_FORM_HELP         #language en-US "Displays and provides option to change the Memory Settings"
+#string STR_MEMORY_RAS_CONFIG_FORM_TITLE    #language en-US "Memory RAS Configuration"
+#string STR_MEMORY_RAS_CONFIG_FORM_HELP     #language en-US "Displays and provides option to change the Ras Configuration"
+#string STR_MEM_PRINT_LEVEL_PROMPT          #language en-US "Memory Print Level"
+#string STR_MEM_PRINT_LEVEL_HELP            #language en-US "Memory Print Level Set. Disable: Do not print any MRC statement/ Minimum: Print the most important(High level) MRC statement/ Minmax: Print the Mid-important(Mid level) and most important MRC statement/ Maximum: Print all of the MRC statement"
+#string STR_ENABLE                          #language en-US  "Enabled"
+#string STR_DISABLE                         #language en-US  "Disabled"
+
+#string STR_MEM_PRINT_LEVEL_MINIMUM         #language en-US "Minimum"
+#string STR_MEM_PRINT_LEVEL_MINMAX          #language en-US "Minmax"
+#string STR_MEM_PRINT_LEVEL_MAXIMUM         #language en-US "Maximum"
+#string STR_MEM_PRINT_LEVEL_DISABLE         #language en-US "Disable"
+
+#string STR_XMP_DDR_FREQ_LIMIT_PROMPT       #language en-US "Memory Frequency"
+#string STR_XMP_DDR_FREQ_LIMIT_HELP         #language en-US "Maximum Memory Frequency Selections in Mhz. Do not select Reserved"
+#string STR_AUTO                            #language en-US "Auto"
+#string STR_DDR_FREQ_1333_STRING            #language en-US "1333"
+#string STR_DDR_FREQ_1600_STRING            #language en-US "1600"
+#string STR_DDR_FREQ_1866_STRING            #language en-US "1866"
+#string STR_DDR_FREQ_2133_STRING            #language en-US "2133"
+#string STR_DDR_FREQ_2400_STRING            #language en-US "2400"
+#string STR_DDR_FREQ_2600_STRING            #language en-US "2600"
+#string STR_DDR_FREQ_2667_STRING            #language en-US "2667"
+#string STR_DDR_FREQ_2800_STRING            #language en-US "2800"
+#string STR_DDR_FREQ_2933_STRING            #language en-US "2993"
+#string STR_DDR_FREQ_3000_STRING            #language en-US "3000"
+#string STR_DDR_FREQ_3200_STRING            #language en-US "3200"
+
+#string STR_DDR_REFRESH_SUPPORT_PROMPT      #language en-US "Custom Refresh Enable"
+#string STR_DDR_REFRESH_SUPPORT_HELP        #language en-US "Memory Custom Refresh Enable "
+#string STR_DDR_REFRESH_PROMPT              #language en-US "Custom Refresh Rate"
+#string STR_DDR_REFRESH_HELP                #language en-US "Memory Custom Refresh Rate "
+#string STR_32MS                            #language en-US "32ms"
+#string STR_64MS                            #language en-US "64ms"
+
+#string STR_RMT_PROMPT                      #language en-US "Rank Margin Tool"
+#string STR_RMT_HELP                        #language en-US "Enable the rank margin tool to run after DDR memory training"
+#string STR_RMTM_PROMPT                     #language en-US "Rank Margin Mode"
+#string STR_RMTM_HELP                       #language en-US "Select test mode for rank margin test"
+#string STR_RMTM_SFC                        #language en-US "SFC"
+#string STR_RMTM_EXMBIST                    #language en-US "EXMBIST"
+#string STR_RMT_PATTERN_PROMPT              #language en-US "RMT Pattern Length"
+#string STR_RMT_PATTERN_HELP                #language en-US "Set the pattern length(1-32767) for the Rank Margin Tool"
+#string STR_PER_BIT_MARGIN_PROMPT           #language en-US "Per Bit Margin"
+#string STR_PER_BIT_MARGIN_HELP             #language en-US "Enables the logging from the serial port of DDR Per Bit Margin Data"
+#string STR_CA_MARGINS_PROMPT               #language en-US "CA Margin"
+#string STR_CA_MARGINS_HELP                 #language en-US "Enables CA margin"
+#string STR_CAVREF_MARGINS_PROMPT           #language en-US "CAVref Margin"
+#string STR_CAVREF_MARGINS_HELP             #language en-US "CAVref margin Options"
+#string STR_CAVREF_MARGINS_OPTION0          #language en-US "VDD/2^2 connected to QVrefVA and BVrefCA"
+#string STR_CAVREF_MARGINS_OPTION2          #language en-US "Internally generated Vref connected to QVrefCA^3 VDD/2^2 connected to BVrefCA"
+
+#string STR_DIE_INTERLEAVING_PROMPT         #language en-US "Die Interleaving"
+#string STR_DIE_INTERLEAVING_HELP           #language en-US "Select Die Interleaving setting"
+#string STR_CHANNEL_INTERLEAVING_PROMPT     #language en-US "Channel Interleaving"
+#string STR_CHANNEL_INTERLEAVING_HELP       #language en-US "Select Channel Interleaving setting"
+#string STR_RANK_INTERLEAVING_PROMPT        #language en-US "Rank Interleaving"
+#string STR_RANK_INTERLEAVING_HELP          #language en-US "Select Rank Interleaving setting"
+
+#string STR_1WAY_STRING                     #language en-US "1-way Interleave"
+#string STR_2WAY_STRING                     #language en-US "2-way Interleave"
+#string STR_3WAY_STRING                     #language en-US "3-way Interleave"
+#string STR_4WAY_STRING                     #language en-US "4-way Interleave"
+#string STR_6WAY_STRING                     #language en-US "6-way Interleave"
+#string STR_8WAY_STRING                     #language en-US "8-way Interleave"
+
+#string STR_NUMA_PROMPT                     #language en-US "NUMA"
+#string STR_NUMA_HELP                       #language en-US "Enable or Disable Non uniform Memory Access (NUMA)."
+
+#string STR_MEM_TEST_PROMPT                 #language en-US "Memory Test"
+#string STR_MEM_TEST_HELP                   #language en-US "Enable/disable memory test during normal boot"
+
+#string STR_ECC_SUPPORT_PROMPT              #language en-US "ECC/SDEC Support"
+#string STR_ECC_SUPPORT_HELP                #language en-US "Enable/disable DDR Ecc/SDEC Support"
+#string STR_ECC_EN                          #language en-US "Ecc Enable"
+#string STR_SDEC_EN                         #language en-US "SDEC Enable"
+
+
+
+
+
diff --git a/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/MiscConfig.hfr b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/MiscConfig.hfr
new file mode 100644
index 0000000000..9e3ac73116
--- /dev/null
+++ b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/MiscConfig.hfr
@@ -0,0 +1,41 @@ 
+/** @file
+*
+*  Misc Config form at Oem Config fromset.
+*
+*  Copyright (c) 2017 - 2018, Hisilicon Limited. All rights reserved.
+*  Copyright (c) 2017 - 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.
+*
+**/
+form formid = MISC_CONFIG_FORM_ID,
+  title  = STRING_TOKEN(STR_MISC_CONFIG_FORM_TITLE);
+
+    oneof varid   = OEM_CONFIG_DATA.EnableSmmu,
+      prompt      = STRING_TOKEN(STR_OEM_TABLE),
+      help        = STRING_TOKEN(STR_OEM_CONFIG_HELP),
+      option text = STRING_TOKEN(STR_DISABLED), value = 0, flags = 0;
+      option text = STRING_TOKEN(STR_ENABLED), value = 1, flags = DEFAULT;
+    endoneof;
+
+    oneof varid   = OEM_CONFIG_DATA.EnableFdtTable,
+      prompt      = STRING_TOKEN(STR_FDT_TABLE),
+      help        = STRING_TOKEN(STR_FDT_CONFIG_HELP),
+      option text = STRING_TOKEN(STR_DISABLED), value = 0, flags = DEFAULT;
+      option text = STRING_TOKEN(STR_ENABLED), value = 1, flags = 0;
+    endoneof;
+
+    oneof varid   = OEM_CONFIG_DATA.EnableSpcr,
+      prompt      = STRING_TOKEN(STR_ENABLE_SPCR_TABLE),
+      help        = STRING_TOKEN(STR_ENABLE_SPCR_HELP),
+      option text = STRING_TOKEN(STR_DISABLED), value = 0, flags = DEFAULT;
+      option text = STRING_TOKEN(STR_ENABLED), value = 1, flags = 0;
+    endoneof;
+
+endform;
diff --git a/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/MiscConfig.uni b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/MiscConfig.uni
new file mode 100644
index 0000000000..53eb1622c4
--- /dev/null
+++ b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/MiscConfig.uni
@@ -0,0 +1,27 @@ 
+/** @file
+*
+*  String definitions for the Misc Config form.
+*
+*  Copyright (c) 2017 - 2018, Hisilicon Limited. All rights reserved.
+*  Copyright (c) 2017 - 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.
+*
+**/
+
+#langdef   en-US "English"
+
+#string STR_OEM_TABLE                  #language en-US  "Support Smmu"
+#string STR_OEM_CONFIG_HELP            #language en-US  "Enable or Disable Smmu."
+#string STR_FDT_TABLE                  #language en-US  "Install DTB Table"
+#string STR_FDT_CONFIG_HELP            #language en-US  "Enable or Disable Fdt Table."
+#string STR_ENABLE_SPCR_TABLE          #language en-US  "Support SPCR"
+#string STR_ENABLE_SPCR_HELP           #language en-US  "Enable or Disable SPCR Table."
+#string STR_ENABLE_GOP_FRAME_BUFFER    #language en-US  "Support GOP FB"
+#string STR_ENABLE_GOP_FRAME_BUFFER_HELP     #language en-US  "Enable or Disable GOP frame buffer."
diff --git a/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigUiLib.uni b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigUiLib.uni
new file mode 100644
index 0000000000..0b2c63a625
--- /dev/null
+++ b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigUiLib.uni
@@ -0,0 +1,24 @@ 
+/** @file
+*
+*  OEM Config Library used by UiApp
+*
+*  Copyright (c) 2017 - 2018, Hisilicon Limited. All rights reserved.
+*  Copyright (c) 2017 - 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.
+*
+**/
+
+#string STR_MODULE_ABSTRACT
+#language en-US              "OEM Config Library used by BDS"
+
+#string STR_MODULE_DESCRIPTION
+#language en-US              "OEM Config Library used by BDS"
+
+
diff --git a/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigUiLibStrings.uni b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigUiLibStrings.uni
new file mode 100644
index 0000000000..afc048e6cd
--- /dev/null
+++ b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigUiLibStrings.uni
@@ -0,0 +1,42 @@ 
+/** @file
+*
+*  String definitions for the OEM Config.
+*
+*  Copyright (c) 2017 - 2018, Hisilicon Limited. All rights reserved.
+*  Copyright (c) 2017 - 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.
+*
+**/
+
+/=#
+
+#langdef   en-US "English"
+
+#string STR_EMPTY_STRING               #language en-US  ""
+#string STR_BIOS_BUILDTIME_STRING      #language en-US  "Build Date"
+#string STR_MISC_BIOS_BUILDTIME        #language en-US  ""
+#string SYSTEM_TIME                    #language en-US  "System Time"
+#string SYSTEM_TIME_HELP               #language en-US  "System Time (HH:MM:SS)"
+#string SYSTEM_DATE                    #language en-US  "System Date"
+#string SYSTEM_DATE_HELP               #language en-US  "System Date (MM/DD/YYYY) Use [ENTER],[TAB] or [SHIFT-TAB] to select a field. Use [+] or [-] to configure system Time."
+#string STR_OEM_CONFIG                 #language en-US  "Oem Config"
+#string STR_ENABLED                    #language en-US  "Enabled"
+#string STR_DISABLED                   #language en-US  "Disabled"
+#string STR_MEMORY_CONFIG_FORM_TITLE   #language en-US  "Memory Config"
+#string STR_MEMORY_CONFIG_FORM_HELP    #language en-US  "Display Memory DIMM information."
+#string STR_PCIE_CONFIG_FORM_TITLE     #language en-US  "PCIe Config"
+#string STR_PCIE_CONFIG_FORM_HELP      #language en-US  "Display PCIe information."
+#string STR_MISC_CONFIG_FORM_TITLE     #language en-US  "MISC Config"
+#string STR_MISC_CONFIG_FORM_HELP      #language en-US  "Include SMMU Support Enable and Change the boot manner of DTB/ACPI."
+#string STR_IBMC_CONFIG_FORM_TITLE     #language en-US  "IBMC Config"
+#string STR_IBMC_CONFIG_FORM_HELP      #language en-US  "Include IBMC WDT(Watchdog Timer) Config."
+#string STR_RAS_CONFIG_FORM_TITLE      #language en-US  "RAS Config"
+#string STR_RAS_CONFIG_FORM_HELP       #language en-US  "Displays and provides option to change the Ras Configuration"
+#string STR_EXIT_STRING                #language en-US  "Press ESC to exit."
diff --git a/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigVfr.Vfr b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigVfr.Vfr
new file mode 100644
index 0000000000..470e9ace3d
--- /dev/null
+++ b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigVfr.Vfr
@@ -0,0 +1,89 @@ 
+/** @file
+*
+*  OEM Config formset.
+*
+*  Copyright (c) 2017 - 2018, Hisilicon Limited. All rights reserved.
+*  Copyright (c) 2017 - 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 "OemConfigUi.h"
+#include "Library/OemConfigData.h"
+
+formset
+  guid      = gOemConfigGuid,
+  title     = STRING_TOKEN(STR_OEM_CONFIG),
+  help      = STRING_TOKEN(STR_OEM_CONFIG),
+  classguid = gEfiIfrFrontPageGuid,  // for MdeModule Bds.
+  efivarstore OEM_CONFIG_DATA,
+    attribute = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE,
+    name  = OemConfig,
+    guid  = gOemConfigGuid;
+
+  form formid = OEM_CONFIG_FORM_ID,
+    title  = STRING_TOKEN(STR_OEM_CONFIG);
+
+    grayoutif  TRUE;
+      text
+        help   = STRING_TOKEN(STR_EMPTY_STRING),
+        text   = STRING_TOKEN(STR_BIOS_BUILDTIME_STRING),
+        text   = STRING_TOKEN(STR_MISC_BIOS_BUILDTIME),
+        flags  = 0,
+        key    = 0;
+    endif;
+
+    date
+      prompt  = STRING_TOKEN(SYSTEM_DATE),
+      help    = STRING_TOKEN(SYSTEM_DATE_HELP),
+      flags   = 0x10,
+      default = 2017/1/1,
+    enddate;
+
+    time
+      prompt  = STRING_TOKEN(SYSTEM_TIME),
+      help    = STRING_TOKEN(SYSTEM_TIME_HELP),
+      flags   = 0x10,
+    endtime;
+
+    subtitle text = STRING_TOKEN(STR_EMPTY_STRING);
+
+    goto MEMORY_CONFIG_FORM_ID,
+      prompt = STRING_TOKEN(STR_MEMORY_CONFIG_FORM_TITLE),
+      help   = STRING_TOKEN(STR_MEMORY_CONFIG_FORM_HELP);
+
+    goto IBMC_CONFIG_FORM_ID,
+      prompt = STRING_TOKEN(STR_IBMC_CONFIG_FORM_TITLE),
+      help   = STRING_TOKEN(STR_IBMC_CONFIG_FORM_HELP);
+
+    suppressif TRUE;
+    goto PCIE_CONFIG_FORM_ID,
+      prompt  = STRING_TOKEN(STR_PCIE_CONFIG_FORM_TITLE),
+      help    = STRING_TOKEN(STR_PCIE_CONFIG_FORM_HELP);
+    endif;
+
+    goto MISC_CONFIG_FORM_ID,
+      prompt  = STRING_TOKEN(STR_MISC_CONFIG_FORM_TITLE),
+      help    = STRING_TOKEN(STR_MISC_CONFIG_FORM_HELP);
+
+    goto RAS_CONFIG_FORM_ID,
+      prompt  = STRING_TOKEN(STR_RAS_CONFIG_FORM_TITLE),
+      help    = STRING_TOKEN(STR_RAS_CONFIG_FORM_HELP);
+
+    subtitle text = STRING_TOKEN(STR_EMPTY_STRING);
+    subtitle text = STRING_TOKEN(STR_EXIT_STRING);
+
+  endform;
+
+#include "MemoryConfig.hfr"
+#include "iBMCConfig.hfr"
+#include "PcieConfig.hfr"
+#include "MiscConfig.hfr"
+#include "RasConfig.hfr"
+endformset;
diff --git a/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/PcieConfig.hfr b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/PcieConfig.hfr
new file mode 100644
index 0000000000..7cf7cdd29b
--- /dev/null
+++ b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/PcieConfig.hfr
@@ -0,0 +1,219 @@ 
+/** @file
+*
+*  PCIe Config form at Oem Config fromset.
+*
+*  Copyright (c) 2017 - 2018, Hisilicon Limited. All rights reserved.
+*  Copyright (c) 2017 - 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.
+*
+**/
+form formid = PCIE_CONFIG_FORM_ID,
+  title   = STRING_TOKEN (STR_PCIE_CONFIG_FORM_TITLE);
+
+  goto VFR_FORMID_PCIE_SOCKET0,
+    prompt  = STRING_TOKEN (STR_PCIE_CPU_0_PROMPT),
+    help    = STRING_TOKEN (STR_PCIE_CPU_PROMPT_HELP);
+
+  goto VFR_FORMID_PCIE_SOCKET1,
+    prompt  = STRING_TOKEN (STR_PCIE_CPU_1_PROMPT),
+    help    = STRING_TOKEN (STR_PCIE_CPU_PROMPT_HELP);
+
+  oneof varid  = OEM_CONFIG_DATA.PcieSRIOVSupport,
+        prompt   = STRING_TOKEN (STR_SRIOV_SUPPORT_PROMPT),
+        help     = STRING_TOKEN (STR_SRIOV_SUPPORT_HELP),
+        option text = STRING_TOKEN (STR_DISABLE), value = 0, flags = MANUFACTURING | DEFAULT | RESET_REQUIRED;
+        option text = STRING_TOKEN (STR_ENABLE),  value = 1, flags = RESET_REQUIRED;
+  endoneof;
+
+endform;
+
+form formid = VFR_FORMID_PCIE_SOCKET0,
+  title = STRING_TOKEN(STR_PCIE_CPU_0_PROMPT);
+
+  goto VFR_FORMID_PCIE_PORT2,
+    prompt  = STRING_TOKEN(STR_PCIE_PORT_2_PROMPT),
+    help    = STRING_TOKEN(STR_PCIE_PORT_PROMPT_HELP);
+
+  goto VFR_FORMID_PCIE_PORT4,
+    prompt  = STRING_TOKEN(STR_PCIE_PORT_4_PROMPT),
+    help    = STRING_TOKEN(STR_PCIE_PORT_PROMPT_HELP);
+
+  goto VFR_FORMID_PCIE_PORT5,
+    prompt  = STRING_TOKEN(STR_PCIE_PORT_5_PROMPT),
+    help    = STRING_TOKEN(STR_PCIE_PORT_PROMPT_HELP);
+
+  goto VFR_FORMID_PCIE_PORT6,
+    prompt  = STRING_TOKEN(STR_PCIE_PORT_6_PROMPT),
+    help    = STRING_TOKEN(STR_PCIE_PORT_PROMPT_HELP);
+
+  goto VFR_FORMID_PCIE_PORT7,
+    prompt  = STRING_TOKEN(STR_PCIE_PORT_7_PROMPT),
+    help    = STRING_TOKEN(STR_PCIE_PORT_PROMPT_HELP);
+
+endform;
+
+form formid = VFR_FORMID_PCIE_SOCKET1,
+  title = STRING_TOKEN(STR_PCIE_CPU_1_PROMPT);
+  goto VFR_FORMID_PCIE_PORT10,
+    prompt  = STRING_TOKEN(STR_PCIE_PORT_10_PROMPT),
+    help    = STRING_TOKEN(STR_PCIE_PORT_PROMPT_HELP);
+
+  goto VFR_FORMID_PCIE_PORT12,
+    prompt  = STRING_TOKEN(STR_PCIE_PORT_12_PROMPT),
+    help    = STRING_TOKEN(STR_PCIE_PORT_PROMPT_HELP);
+
+  goto VFR_FORMID_PCIE_PORT13,
+    prompt  = STRING_TOKEN(STR_PCIE_PORT_13_PROMPT),
+    help    = STRING_TOKEN(STR_PCIE_PORT_PROMPT_HELP);
+endform;
+
+form formid = VFR_FORMID_PCIE_PORT0,
+  title = STRING_TOKEN(STR_PCIE_PORT_0_PROMPT);
+  #undef  INDEX
+  #define INDEX   0
+  #include "PciePortConfig.hfr"
+
+endform;
+
+form formid = VFR_FORMID_PCIE_PORT1,
+  title = STRING_TOKEN(STR_PCIE_PORT_1_PROMPT);
+
+  #undef  INDEX
+  #define INDEX   1
+  #include "PciePortConfig.hfr"
+
+endform;
+
+form formid = VFR_FORMID_PCIE_PORT2,
+  title = STRING_TOKEN(STR_PCIE_PORT_2_PROMPT);
+
+  #undef  INDEX
+  #define INDEX   2
+  #include "PciePortConfig.hfr"
+
+endform;
+
+form formid = VFR_FORMID_PCIE_PORT3,
+  title = STRING_TOKEN(STR_PCIE_PORT_3_PROMPT);
+
+  #undef  INDEX
+  #define INDEX   3
+  #include "PciePortConfig.hfr"
+
+endform;
+
+form formid = VFR_FORMID_PCIE_PORT4,
+  title = STRING_TOKEN(STR_PCIE_PORT_4_PROMPT);
+
+  #undef  INDEX
+  #define INDEX   4
+  #include "PciePortConfig.hfr"
+
+endform;
+
+form formid = VFR_FORMID_PCIE_PORT5,
+  title = STRING_TOKEN(STR_PCIE_PORT_5_PROMPT);
+
+  #undef  INDEX
+  #define INDEX   5
+  #include "PciePortConfig.hfr"
+
+endform;
+
+form formid = VFR_FORMID_PCIE_PORT6,
+  title = STRING_TOKEN(STR_PCIE_PORT_6_PROMPT);
+
+  #undef  INDEX
+  #define INDEX   6
+  #include "PciePortConfig.hfr"
+
+endform;
+
+form formid = VFR_FORMID_PCIE_PORT7,
+  title = STRING_TOKEN(STR_PCIE_PORT_7_PROMPT);
+
+  #undef  INDEX
+  #define INDEX   7
+  #include "PciePortConfig.hfr"
+
+endform;
+
+form formid = VFR_FORMID_PCIE_PORT8,
+  title = STRING_TOKEN(STR_PCIE_PORT_8_PROMPT);
+
+  #undef  INDEX
+  #define INDEX   8
+  #include "PciePortConfig.hfr"
+
+endform;
+
+form formid = VFR_FORMID_PCIE_PORT9,
+  title = STRING_TOKEN(STR_PCIE_PORT_9_PROMPT);
+
+  #undef  INDEX
+  #define INDEX   9
+  #include "PciePortConfig.hfr"
+
+endform;
+
+form formid = VFR_FORMID_PCIE_PORT10,
+  title = STRING_TOKEN(STR_PCIE_PORT_10_PROMPT);
+
+  #undef  INDEX
+  #define INDEX   10
+  #include "PciePortConfig.hfr"
+
+endform;
+
+form formid = VFR_FORMID_PCIE_PORT11,
+  title = STRING_TOKEN(STR_PCIE_PORT_11_PROMPT);
+
+  #undef  INDEX
+  #define INDEX   11
+  #include "PciePortConfig.hfr"
+
+endform;
+
+form formid = VFR_FORMID_PCIE_PORT12,
+  title = STRING_TOKEN(STR_PCIE_PORT_12_PROMPT);
+
+  #undef  INDEX
+  #define INDEX   12
+  #include "PciePortConfig.hfr"
+
+endform;
+
+form formid = VFR_FORMID_PCIE_PORT13,
+  title = STRING_TOKEN(STR_PCIE_PORT_13_PROMPT);
+
+  #undef  INDEX
+  #define INDEX   13
+  #include "PciePortConfig.hfr"
+
+endform;
+
+form formid = VFR_FORMID_PCIE_PORT14,
+  title = STRING_TOKEN(STR_PCIE_PORT_14_PROMPT);
+
+  #undef  INDEX
+  #define INDEX   14
+  #include "PciePortConfig.hfr"
+
+endform;
+
+form formid = VFR_FORMID_PCIE_PORT15,
+  title = STRING_TOKEN(STR_PCIE_PORT_15_PROMPT);
+
+  #undef  INDEX
+  #define INDEX   15
+  #include "PciePortConfig.hfr"
+
+endform;
+
diff --git a/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/PcieConfigStrings.uni b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/PcieConfigStrings.uni
new file mode 100644
index 0000000000..d87d30f975
--- /dev/null
+++ b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/PcieConfigStrings.uni
@@ -0,0 +1,111 @@ 
+/** @file
+*
+*  String definitions for the PCIe Config form.
+*
+*  Copyright (c) 2017 - 2018, Hisilicon Limited. All rights reserved.
+*  Copyright (c) 2017 - 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.
+*
+**/
+
+/=#
+
+#langdef   en-US "English"
+
+#string STR_BLANK_STRING                #language en-US ""
+#string STR_PCIE_CPU_PROMPT_HELP        #language en-US "Press <Enter> to config this CPU."
+#string STR_PCIE_CPU_0_NULL_PROMPT      #language en-US ""
+#string STR_PCIE_CPU_0_PROMPT           #language en-US "CPU 0 PCIE Configuration"
+#string STR_PCIE_CPU_1_PROMPT           #language en-US "CPU 1 PCIE Configuration"
+#string STR_SRIOV_SUPPORT_PROMPT        #language en-US "SRIOV"
+#string STR_SRIOV_SUPPORT_HELP          #language en-US "This option enables / disables the SRIOV function"
+
+#string STR_PCIE_PORT_PROMPT_HELP       #language en-US "Press <Enter> to config this port."
+#string STR_PCIE_PORT_0_NULL_PROMPT     #language en-US ""
+#string STR_PCIE_PORT_0_PROMPT          #language en-US "CPU 0 Pcie - Port 0"
+#string STR_PCIE_PORT_1_PROMPT          #language en-US "CPU 0 Pcie - Port 1"
+#string STR_PCIE_PORT_2_PROMPT          #language en-US "CPU 0 Pcie - Port 2"
+#string STR_PCIE_PORT_3_PROMPT          #language en-US "CPU 0 Pcie - Port 3"
+#string STR_PCIE_PORT_4_PROMPT          #language en-US "CPU 0 Pcie - Port 4"
+#string STR_PCIE_PORT_5_PROMPT          #language en-US "CPU 0 Pcie - Port 5"
+#string STR_PCIE_PORT_6_PROMPT          #language en-US "CPU 0 Pcie - Port 6"
+#string STR_PCIE_PORT_7_PROMPT          #language en-US "CPU 0 Pcie - Port 7"
+#string STR_PCIE_PORT_8_PROMPT          #language en-US "CPU 1 Pcie - Port 0"
+#string STR_PCIE_PORT_9_PROMPT          #language en-US "CPU 1 Pcie - Port 1"
+#string STR_PCIE_PORT_10_PROMPT         #language en-US "CPU 1 Pcie - Port 2"
+#string STR_PCIE_PORT_11_PROMPT         #language en-US "CPU 1 Pcie - Port 3"
+#string STR_PCIE_PORT_12_PROMPT         #language en-US "CPU 1 Pcie - Port 4"
+#string STR_PCIE_PORT_13_PROMPT         #language en-US "CPU 1 Pcie - Port 5"
+#string STR_PCIE_PORT_14_PROMPT         #language en-US "CPU 1 Pcie - Port 6"
+#string STR_PCIE_PORT_15_PROMPT         #language en-US "CPU 1 Pcie - Port 7"
+
+#string STR_PCIE_PORT_ENABLE_PROMPT_0   #language en-US "PCI-E Port"
+#string STR_PCIE_PORT_ENABLE_HELP       #language en-US "Disable is used to disable the port and hide its CFG space."
+
+#string STR_LINK_STATUS                 #language en-US "PCI-E Port Link Status"
+#string STR_LINK_STATUS_NG              #language en-US "Link Training Error"
+#string STR_LINK_STATUS_OK              #language en-US "Link Up"
+#string STR_MAXLINK_STATUS              #language en-US "PCI-E Port Link Max"
+#string STR_WIDTH1_STRING               #language en-US "X1"
+#string STR_WIDTH2_STRING               #language en-US "X2"
+#string STR_WIDTH4_STRING               #language en-US "X4"
+#string STR_WIDTH8_STRING               #language en-US "X8"
+#string STR_WIDTH16_STRING              #language en-US "X16"
+#string STR_WIDTH32_STRING              #language en-US "X32"
+
+#string STR_PCIESPEED_STATUS            #language en-US "PCI-E Port Link Speed"
+#string STR_PCIE_LINK_SPEED1_STRING     #language en-US "Gen 1 (2.5 GT/s)"
+#string STR_PCIE_LINK_SPEED2_STRING     #language en-US "Gen 2 (5 GT/s)"
+#string STR_PCIE_LINK_SPEED3_STRING     #language en-US "Gen 3 (8 GT/s)"
+
+#string STR_PCIE_PORT_DEEMPHASIS_PROMPT_0  #language en-US "PCI-E Port DeEmphasis"
+
+#string STR_PCIE_PORT_DEEMPHASIS_HELP   #language en-US "De-Emphais control for this PCIe port."
+
+#string STR_35DB                        #language en-US "-3.5 dB"
+#string STR_60DB                        #language en-US "-6.0 dB"
+
+#string STR_PCIE_PORT_ASPM_PROMPT_G     #language en-US "PCI-E ASPM Support"
+
+#string STR_PCIE_GLOBAL_ASPM_HELP       #language en-US "This option enables / disables the ASPM support for all downstream devices."
+#string STR_PCIE_PORT_ASPM_HELP         #language en-US "This option enables / disables the ASPM (L1) support for the downstream devices."
+
+#string STR_L0S_ONLY                    #language en-US "L0s Only"
+#string STR_L0S_L1_BOTH                 #language en-US "L0s & L1 Both"
+#string STR_L1_ONLY                     #language en-US "L1 Only"
+
+#string STR_PCIE_PORT_MAX_PAYLOAD_REQUEST_PROMPT    #language en-US "Max Payload Size"
+#string STR_PCIE_PORT_MAX_PAYLOAD_REQUEST_HELP      #language en-US "Set Maxpayload size to 512B if possible"
+//
+// Common Strings
+//
+#string STR_AUTO                        #language en-US "Auto"
+#string STR_X1                          #language en-US "x1"
+#string STR_X2                          #language en-US "x2"
+#string STR_X4                          #language en-US "x4"
+#string STR_X8                          #language en-US "x8"
+#string STR_X16                         #language en-US "x16"
+
+#string STR_128B                        #language en-US "128B"
+#string STR_256B                        #language en-US "256B"
+#string STR_512B                        #language en-US "512B"
+#string STR_1024B                       #language en-US "1024B"
+#string STR_2048B                       #language en-US "2048B"
+#string STR_4096B                       #language en-US "4096B"
+
+#string STR_CLEAR                       #language en-US "Clear"
+#string STR_SET                         #language en-US "Set"
+
+#string STR_PCIE_PORT_LINK_SPEED_PROMPT_0       #language en-US "Link Speed"
+#string STR_PCIE_PORT_LINK_SPEED_HELP           #language en-US "Link Speed:Gen1(2.5 GT/s)/Gen2(5 GT/s)/Gen3(8 GT/s)/GEN 4 (16 gt/s)"
+#string STR_PCIE_GEN1                           #language en-US "Gen 1 (2.5 GT/s)"
+#string STR_PCIE_GEN2                           #language en-US "Gen 2 (5 GT/s)"
+#string STR_PCIE_GEN3                           #language en-US "Gen 3 (8 GT/s)"
+#string STR_PCIE_GEN4                           #language en-US "Gen 4 (16 GT/s)"
diff --git a/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/PciePortConfig.hfr b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/PciePortConfig.hfr
new file mode 100644
index 0000000000..1a8942157c
--- /dev/null
+++ b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/PciePortConfig.hfr
@@ -0,0 +1,167 @@ 
+/** @file
+*
+*  PCIe Config form at Oem Config fromset.
+*
+*  Copyright (c) 2017 - 2018, Hisilicon Limited. All rights reserved.
+*  Copyright (c) 2017 - 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.
+*
+**/
+oneof varid = OEM_CONFIG_DATA.PciePort[INDEX],
+  prompt  = STRING_TOKEN(STR_PCIE_PORT_ENABLE_PROMPT_0),
+  help    = STRING_TOKEN(STR_PCIE_PORT_ENABLE_HELP),
+  option text = STRING_TOKEN(STR_ENABLE),  value = 1, flags = RESET_REQUIRED | MANUFACTURING | DEFAULT;
+  option text = STRING_TOKEN(STR_DISABLE), value = 0, flags = RESET_REQUIRED;
+endoneof;
+
+suppressif ideqval OEM_CONFIG_DATA.PciePort[INDEX] == 0x00;
+  oneof varid     = OEM_CONFIG_DATA.PcieLinkSpeedPort[INDEX],
+    prompt          = STRING_TOKEN(STR_PCIE_PORT_LINK_SPEED_PROMPT_0),
+    help            = STRING_TOKEN(STR_PCIE_PORT_LINK_SPEED_HELP),
+    option text     = STRING_TOKEN(STR_PCIE_GEN1),  value = 1, flags = DEFAULT | MANUFACTURING | RESET_REQUIRED;
+    option text     = STRING_TOKEN(STR_PCIE_GEN2),  value = 2, flags = RESET_REQUIRED;
+    option text     = STRING_TOKEN(STR_PCIE_GEN3),  value = 3, flags = RESET_REQUIRED;
+    option text     = STRING_TOKEN(STR_PCIE_GEN4),  value = 4, flags = RESET_REQUIRED;
+  endoneof;
+
+  suppressif NOT ideqval OEM_CONFIG_DATA.PcieLinkSpeedPort[INDEX] == 2;
+    oneof varid = OEM_CONFIG_DATA.PcieLinkDeEmphasisPort[INDEX],
+      prompt  = STRING_TOKEN(STR_PCIE_PORT_DEEMPHASIS_PROMPT_0),
+      help    = STRING_TOKEN(STR_PCIE_PORT_DEEMPHASIS_HELP),
+    #if ( INDEX == 0)
+      option text = STRING_TOKEN(STR_60DB), value = 0, flags = RESET_REQUIRED | MANUFACTURING | DEFAULT;
+      option text = STRING_TOKEN(STR_35DB), value = 1, flags = RESET_REQUIRED;
+    #endif
+
+    #if ( INDEX == 1)
+      option text = STRING_TOKEN(STR_60DB), value = 0, flags = RESET_REQUIRED | MANUFACTURING | DEFAULT;
+      option text = STRING_TOKEN(STR_35DB), value = 1, flags = RESET_REQUIRED;
+    #endif
+
+    #if ( INDEX == 3)
+      option text = STRING_TOKEN(STR_60DB), value = 0, flags = RESET_REQUIRED | MANUFACTURING | DEFAULT;
+      option text = STRING_TOKEN(STR_35DB), value = 1, flags = RESET_REQUIRED;
+    #endif
+
+    #if ( INDEX == 4)
+      option text = STRING_TOKEN(STR_60DB), value = 0, flags = RESET_REQUIRED | MANUFACTURING | DEFAULT;
+      option text = STRING_TOKEN(STR_35DB), value = 1, flags = RESET_REQUIRED;
+    #endif
+
+    #if ( INDEX == 6)
+      option text = STRING_TOKEN(STR_60DB), value = 0, flags = RESET_REQUIRED | MANUFACTURING | DEFAULT;
+      option text = STRING_TOKEN(STR_35DB), value = 1, flags = RESET_REQUIRED;
+    #endif
+
+    #if ( INDEX == 7)
+      option text = STRING_TOKEN(STR_60DB), value = 0, flags = RESET_REQUIRED | MANUFACTURING | DEFAULT;
+      option text = STRING_TOKEN(STR_35DB), value = 1, flags = RESET_REQUIRED;
+    #endif
+
+    #if ( INDEX == 8)
+      option text = STRING_TOKEN(STR_60DB), value = 0, flags = RESET_REQUIRED | MANUFACTURING | DEFAULT;
+      option text = STRING_TOKEN(STR_35DB), value = 1, flags = RESET_REQUIRED;
+    #endif
+
+    #if ( INDEX == 9)
+      option text = STRING_TOKEN(STR_60DB), value = 0, flags = RESET_REQUIRED | MANUFACTURING | DEFAULT;
+      option text = STRING_TOKEN(STR_35DB), value = 1, flags = RESET_REQUIRED;
+    #endif
+
+    #if ( INDEX == 11)
+      option text = STRING_TOKEN(STR_60DB), value = 0, flags = RESET_REQUIRED | MANUFACTURING | DEFAULT;
+      option text = STRING_TOKEN(STR_35DB), value = 1, flags = RESET_REQUIRED;
+    #endif
+
+    #if ( INDEX == 14)
+      option text = STRING_TOKEN(STR_60DB), value = 0, flags = RESET_REQUIRED | MANUFACTURING | DEFAULT;
+      option text = STRING_TOKEN(STR_35DB), value = 1, flags = RESET_REQUIRED;
+    #endif
+
+    #if ( INDEX == 15)
+      option text = STRING_TOKEN(STR_60DB), value = 0, flags = RESET_REQUIRED | MANUFACTURING | DEFAULT;
+      option text = STRING_TOKEN(STR_35DB), value = 1, flags = RESET_REQUIRED;
+    #endif
+
+    #if ( INDEX == 2)
+      option text = STRING_TOKEN(STR_60DB), value = 0, flags = RESET_REQUIRED ;
+      option text = STRING_TOKEN(STR_35DB), value = 1, flags = RESET_REQUIRED| MANUFACTURING | DEFAULT;
+    #endif
+
+    #if ( INDEX == 5)
+      option text = STRING_TOKEN(STR_60DB), value = 0, flags = RESET_REQUIRED;
+      option text = STRING_TOKEN(STR_35DB), value = 1, flags = RESET_REQUIRED | MANUFACTURING | DEFAULT;
+    #endif
+
+    #if ( INDEX == 10)
+      option text = STRING_TOKEN(STR_60DB), value = 0, flags = RESET_REQUIRED;
+      option text = STRING_TOKEN(STR_35DB), value = 1, flags = RESET_REQUIRED | MANUFACTURING | DEFAULT;
+    #endif
+
+    #if ( INDEX == 12)
+      option text = STRING_TOKEN(STR_60DB), value = 0, flags = RESET_REQUIRED;
+      option text = STRING_TOKEN(STR_35DB), value = 1, flags = RESET_REQUIRED | MANUFACTURING | DEFAULT;
+    #endif
+
+    #if ( INDEX == 13)
+      option text = STRING_TOKEN(STR_60DB), value = 0, flags = RESET_REQUIRED;
+      option text = STRING_TOKEN(STR_35DB), value = 1, flags = RESET_REQUIRED | MANUFACTURING | DEFAULT;
+    #endif
+
+    endoneof;
+  endif;
+
+  grayoutif  TRUE;
+    oneof varid = OEM_CONFIG_DATA.PcieLinkStatusPort[INDEX],
+      prompt  = STRING_TOKEN(STR_LINK_STATUS),
+      help    = STRING_TOKEN(STR_BLANK_STRING),
+      option text = STRING_TOKEN(STR_LINK_STATUS_NG), value = 0, flags = MANUFACTURING | DEFAULT | RESET_REQUIRED;
+      option text = STRING_TOKEN(STR_LINK_STATUS_OK), value = 1, flags = RESET_REQUIRED;
+    endoneof;
+
+    oneof varid = OEM_CONFIG_DATA.PcieLinkMaxPort[INDEX],
+      prompt  = STRING_TOKEN(STR_MAXLINK_STATUS),
+      help    = STRING_TOKEN(STR_BLANK_STRING),
+      option text = STRING_TOKEN(STR_WIDTH1_STRING), value = 1, flags = RESET_REQUIRED;
+      option text = STRING_TOKEN(STR_WIDTH2_STRING), value = 2, flags = RESET_REQUIRED;
+      option text = STRING_TOKEN(STR_WIDTH4_STRING), value = 4, flags = RESET_REQUIRED;
+      option text = STRING_TOKEN(STR_WIDTH8_STRING), value = 8, flags = RESET_REQUIRED | MANUFACTURING | DEFAULT;
+    endoneof;
+
+    suppressif NOT ideqval OEM_CONFIG_DATA.PcieLinkStatusPort[INDEX] == 1;
+      oneof varid = OEM_CONFIG_DATA.PcieLinkSpeedRateStatusPort[INDEX],
+        prompt  = STRING_TOKEN(STR_PCIESPEED_STATUS),
+        help    = STRING_TOKEN(STR_BLANK_STRING),
+        option text = STRING_TOKEN(STR_PCIE_LINK_SPEED1_STRING), value = 0, flags = MANUFACTURING | DEFAULT | RESET_REQUIRED;
+        option text = STRING_TOKEN(STR_PCIE_LINK_SPEED2_STRING), value = 1, flags = RESET_REQUIRED;
+        option text = STRING_TOKEN(STR_PCIE_LINK_SPEED3_STRING), value = 2, flags = RESET_REQUIRED;
+      endoneof;
+    endif;
+  endif;
+
+  oneof varid = OEM_CONFIG_DATA.PcieMaxPayloadSizePort[INDEX],
+    prompt  = STRING_TOKEN(STR_PCIE_PORT_MAX_PAYLOAD_REQUEST_PROMPT),
+    help    = STRING_TOKEN(STR_PCIE_PORT_MAX_PAYLOAD_REQUEST_HELP),
+      option text = STRING_TOKEN(STR_128B), value = 0, flags = MANUFACTURING | DEFAULT | RESET_REQUIRED;
+      option text = STRING_TOKEN(STR_256B), value = 1, flags = RESET_REQUIRED;
+      option text = STRING_TOKEN(STR_512B), value = 2, flags = RESET_REQUIRED;
+  endoneof;
+
+  oneof varid = OEM_CONFIG_DATA.PcieAspmPort[INDEX],
+    prompt   = STRING_TOKEN (STR_PCIE_PORT_ASPM_PROMPT_G),
+    help     = STRING_TOKEN (STR_PCIE_GLOBAL_ASPM_HELP),
+    option text = STRING_TOKEN(STR_DISABLE),      value = 0, flags = RESET_REQUIRED | MANUFACTURING | DEFAULT;
+    option text = STRING_TOKEN(STR_L0S_ONLY),     value = 1, flags = RESET_REQUIRED;
+    option text = STRING_TOKEN(STR_L1_ONLY),      value = 2, flags = RESET_REQUIRED;
+    option text = STRING_TOKEN(STR_L0S_L1_BOTH),  value = 3, flags = RESET_REQUIRED;
+  endoneof;
+
+endif;
+
diff --git a/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/RasConfig.hfr b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/RasConfig.hfr
new file mode 100644
index 0000000000..7c0ea53061
--- /dev/null
+++ b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/RasConfig.hfr
@@ -0,0 +1,172 @@ 
+ ///** @file
+//
+//  Memory RAS Config form.
+//
+//  Copyright (c) 2018, Hisilicon Limited. All rights reserved.
+//  Copyright (c) 2018, Linaro Limited. All rights reserved.
+//  This program and the accompanying materials
+//  are licensed and made available under the terms and conditions of the BSD License
+//  which accompanies this distribution.  The full text of the license may be found at
+//  http://opensource.org/licenses/bsd-license.php
+//
+//  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+//
+//**/
+  form formid = RAS_CONFIG_FORM_ID,
+       title  = STRING_TOKEN(STR_RAS_CONFIG_FORM_TITLE);
+
+    oneof varid = OEM_CONFIG_DATA.EnRasSupport,
+      prompt  = STRING_TOKEN(STR_SUPPORT_RAS_TITLE),
+      help    = STRING_TOKEN(STR_SUPPORT_RAS_HELP),
+      option text = STRING_TOKEN(STR_DISABLE), value = 0, flags = RESET_REQUIRED;
+      option text = STRING_TOKEN(STR_ENABLE), value = 1, flags = MANUFACTURING | DEFAULT | RESET_REQUIRED;
+    endoneof;
+
+    suppressif TRUE;
+      goto VFR_FORMID_MEMORY_RAS,
+        prompt = STRING_TOKEN(STR_MEMORY_RAS_CONFIG_FORM_TITLE),
+        help   = STRING_TOKEN(STR_MEMORY_RAS_CONFIG_FORM_HELP);
+
+      goto VFR_FORMID_PCIE_RAS,
+        prompt  = STRING_TOKEN(STR_PCIE_RAS_CONFIG_FORM_TITLE),
+        help    = STRING_TOKEN(STR_PCIE_RAS_CONFIG_FORM_HELP);
+    endif;
+  endform;
+
+  form formid = VFR_FORMID_MEMORY_RAS,
+       title  = STRING_TOKEN(STR_MEMORY_RAS_CONFIG_FORM_TITLE);
+
+    oneof varid = OEM_CONFIG_DATA.CheckAlgorithm,
+      prompt  = STRING_TOKEN(STR_CHECK_ALGORITHM_PROMPT),
+      help    = STRING_TOKEN(STR_CHECK_ALGORITHM_HELP),
+      option text = STRING_TOKEN(STR_DISABLE), value = 0, flags = MANUFACTURING | DEFAULT | RESET_REQUIRED;
+      option text = STRING_TOKEN(STR_ECC), value = 1, flags = RESET_REQUIRED;
+      option text = STRING_TOKEN(STR_SDEC), value = 2, flags = RESET_REQUIRED;
+    endoneof;
+
+    grayoutif ideqval OEM_CONFIG_DATA.CheckAlgorithm == 0;
+      oneof varid = OEM_CONFIG_DATA.EnPoison,
+        prompt  = STRING_TOKEN(STR_ENABLE_POISON_PROMPT),
+        help    = STRING_TOKEN(STR_ENABLE_POISON_HELP),
+        option text = STRING_TOKEN(STR_DISABLE), value = 0, flags = RESET_REQUIRED;
+        option text = STRING_TOKEN(STR_ENABLE), value = 1, flags = MANUFACTURING | DEFAULT | RESET_REQUIRED;
+      endoneof;
+
+      oneof varid = OEM_CONFIG_DATA.PatrolScrub,
+        prompt  = STRING_TOKEN(STR_PATROL_SCRUB_PROMPT),
+        help    = STRING_TOKEN(STR_PATROL_SCRUB_HELP),
+        option text = STRING_TOKEN(STR_DISABLE), value = 0, flags = RESET_REQUIRED;
+        option text = STRING_TOKEN(STR_ENABLE), value = 1, flags = MANUFACTURING | DEFAULT | RESET_REQUIRED;
+      endoneof;
+    endif;
+
+    grayoutif ideqval OEM_CONFIG_DATA.CheckAlgorithm == 0 OR ideqval OEM_CONFIG_DATA.PatrolScrub == 0;
+      numeric varid   = OEM_CONFIG_DATA.PatrolScrubDuration,
+        prompt  = STRING_TOKEN(STR_PATROL_SCRUB_DURATION_PROMPT),
+        help    = STRING_TOKEN(STR_PATROL_SCRUB_DURATION_HELP),
+        flags   = 0 | RESET_REQUIRED,
+        minimum = 0,
+        maximum = 24,
+        step    = 1,
+        default = 24,
+      endnumeric;
+    endif;
+
+    grayoutif ideqval OEM_CONFIG_DATA.CheckAlgorithm == 0;
+      oneof varid = OEM_CONFIG_DATA.DemandScrubMode,
+        prompt  = STRING_TOKEN(STR_DEMAND_SCRUB_PROMPT),
+        help    = STRING_TOKEN(STR_DEMAND_SCRUB_HELP),
+        option text = STRING_TOKEN(STR_DISABLE), value = 0, flags = MANUFACTURING | DEFAULT | RESET_REQUIRED;
+        option text = STRING_TOKEN(STR_ENABLE), value = 1, flags = RESET_REQUIRED;
+      endoneof;
+    endif;
+
+    suppressif ideqval OEM_CONFIG_DATA.CheckAlgorithm == 0 OR ideqval OEM_CONFIG_DATA.CheckAlgorithm == 1;
+      goto VFR_FORMID_CORRECT_ERROR,
+        prompt = STRING_TOKEN(STR_CORRECT_ERROR_FORM_TITLE),
+        help   = STRING_TOKEN(STR_CORRECT_ERROR_FORM_HELP);
+    endif;
+  endform;
+
+
+  form formid = VFR_FORMID_CORRECT_ERROR,
+       title  = STRING_TOKEN(STR_CORRECT_ERROR_FORM_TITLE);
+
+    oneof varid = OEM_CONFIG_DATA.CorrectErrorThreshold,
+      prompt  = STRING_TOKEN(STR_CORRECT_ERROR_THRESHOLD_PROMPT),
+      help    = STRING_TOKEN(STR_CORRECT_ERROR_THRESHOLD_HELP),
+      option text = STRING_TOKEN(STR_DISABLE), value = 0, flags = MANUFACTURING | DEFAULT | RESET_REQUIRED;
+      option text = STRING_TOKEN(STR_500), value = 1, flags = RESET_REQUIRED;
+      option text = STRING_TOKEN(STR_1000), value = 2, flags = RESET_REQUIRED;
+      option text = STRING_TOKEN(STR_2000), value = 3, flags = RESET_REQUIRED;
+    endoneof;
+
+    oneof varid = OEM_CONFIG_DATA.FunnelPeriod,
+      prompt  = STRING_TOKEN(STR_FUNNEL_PERIOD_PROMPT),
+      help    = STRING_TOKEN(STR_FUNNEL_PERIOD_HELP),
+      option text = STRING_TOKEN(STR_DISABLE), value = 0, flags = MANUFACTURING | DEFAULT | RESET_REQUIRED;
+      option text = STRING_TOKEN(STR_30), value = 1, flags = RESET_REQUIRED;
+      option text = STRING_TOKEN(STR_60), value = 2, flags = RESET_REQUIRED;
+    endoneof;
+
+    suppressif ideqval OEM_CONFIG_DATA.CorrectErrorThreshold == 0;
+      oneof varid = OEM_CONFIG_DATA.AdvanceDeviceCorrection ,
+        prompt  = STRING_TOKEN(STR_ADVANCE_DEVICE_CORRECTION_PROMPT),
+        help    = STRING_TOKEN(STR_ADVANCE_DEVICE_CORRECTION_HELP),
+        option text = STRING_TOKEN(STR_DISABLE), value = 0, flags = MANUFACTURING | DEFAULT | RESET_REQUIRED;
+        option text = STRING_TOKEN(STR_SR), value = 1, flags = RESET_REQUIRED;
+        option text = STRING_TOKEN(STR_MR), value = 2, flags = RESET_REQUIRED;
+      endoneof;
+
+      oneof varid = OEM_CONFIG_DATA.RankSparing,
+        prompt  = STRING_TOKEN(STR_RANK_SPARING_PROMPT),
+        help    = STRING_TOKEN(STR_RANK_SPARING_HELP),
+        option text = STRING_TOKEN(STR_DISABLE), value = 0, flags = MANUFACTURING | DEFAULT | RESET_REQUIRED;
+        option text = STRING_TOKEN(STR_ENABLE), value = 1, flags = RESET_REQUIRED;
+      endoneof;
+    endif;
+  endform;
+
+  form formid = VFR_FORMID_PCIE_RAS,
+       title  = STRING_TOKEN(STR_PCIE_RAS_CONFIG_FORM_TITLE);
+
+      oneof varid = OEM_CONFIG_DATA.DpcFeature,
+        prompt  = STRING_TOKEN(STR_DPC_FEARURE),
+        help    = STRING_TOKEN(STR_DPC_FEARURE_HELP),
+        option text = STRING_TOKEN(STR_DISABLE), value = 0, flags = MANUFACTURING | DEFAULT | RESET_REQUIRED;
+        option text = STRING_TOKEN(STR_ENABLE), value = 1, flags = RESET_REQUIRED;
+      endoneof;
+
+      oneof varid = OEM_CONFIG_DATA.EcrcFeature,
+        prompt  = STRING_TOKEN(STR_ECRC_FEARURE),
+        help    = STRING_TOKEN(STR_ECRC_FEARURE_HELP),
+        option text = STRING_TOKEN(STR_DISABLE), value = 0, flags = MANUFACTURING | DEFAULT | RESET_REQUIRED;
+        option text = STRING_TOKEN(STR_ENABLE), value = 1, flags = RESET_REQUIRED;
+      endoneof;
+
+      oneof varid = OEM_CONFIG_DATA.CompletionTimeout,
+        prompt  = STRING_TOKEN(STR_COMPLETION_TIMEOUT),
+        help    = STRING_TOKEN(STR_COMPLETION_TIMEOUT_HELP),
+        option text = STRING_TOKEN(STR_DISABLE), value = 0, flags = RESET_REQUIRED;
+        option text = STRING_TOKEN(STR_ENABLE), value = 1, flags = MANUFACTURING | DEFAULT | RESET_REQUIRED;
+      endoneof;
+
+    suppressif ideqval OEM_CONFIG_DATA.CompletionTimeout == 0;
+      oneof varid = OEM_CONFIG_DATA.CompletionTimeoutValue,
+        prompt  = STRING_TOKEN(STR_COMPLETION_TIMEOUT_VALUE),
+        help    = STRING_TOKEN(STR_COMPLETION_TIMEOUT_VALUE_HELP),
+        option text = STRING_TOKEN(STR_50US_TO_50MS), value = 0, flags = MANUFACTURING | DEFAULT | RESET_REQUIRED;
+        option text = STRING_TOKEN(STR_50US_TO_100US), value = 1, flags = RESET_REQUIRED;
+        option text = STRING_TOKEN(STR_1MS_TO_10MS), value = 2, flags = RESET_REQUIRED;
+      endoneof;
+    endif;
+
+      oneof varid = OEM_CONFIG_DATA.HotPlug,
+        prompt  = STRING_TOKEN(STR_HOT_PLUG),
+        help    = STRING_TOKEN(STR_HOT_PLUG_HELP),
+        option text = STRING_TOKEN(STR_DISABLE), value = 0, flags = RESET_REQUIRED;
+        option text = STRING_TOKEN(STR_ENABLE), value = 1, flags = MANUFACTURING | DEFAULT | RESET_REQUIRED;
+      endoneof;
+  endform;
+
diff --git a/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/RasConfig.uni b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/RasConfig.uni
new file mode 100644
index 0000000000..551c65fa5f
--- /dev/null
+++ b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/RasConfig.uni
@@ -0,0 +1,85 @@ 
+// /** @file
+// OEM Config Library used by UiApp
+//
+//
+//  Copyright (c) 2018, Hisilicon Limited. All rights reserved.
+//  Copyright (c) 2018, Linaro Limited. All rights reserved.
+//
+// This program and the accompanying materials are licensed and made available under
+// the terms and conditions of the BSD License that accompanies this distribution.
+// The full text of the license may be found at
+// 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.
+//
+// **/
+#langdef   en-US "English"
+
+#string STR_SUPPORT_RAS_TITLE                     #language en-US  "Support RAS"
+#string STR_SUPPORT_RAS_HELP                      #language en-US  "Support memory/PCIe/CPU RAS funtions."
+
+#string STR_MEMORY_RAS_CONFIG_FORM_TITLE          #language en-US  "Memory RAS Config"
+#string STR_MEMORY_RAS_CONFIG_FORM_HELP           #language en-US  "Memory RAS Config"
+
+#string STR_PCIE_RAS_CONFIG_FORM_TITLE            #language en-US  "PCIe RAS Config"
+#string STR_PCIE_RAS_CONFIG_FORM_HELP             #language en-US  "PCIe RAS Config"
+
+#string STR_CPU_RAS_CONFIG_FORM_TITLE             #language en-US  "CPU RAS Config"
+#string STR_CPU_RAS_CONFIG_FORM_HELP              #language en-US  "CPU RAS Config"
+
+#string STR_ENABLE_POISON_PROMPT                  #language en-US  "Poison"
+#string STR_ENABLE_POISON_HELP                    #language en-US  "Enable/Disable Poison flag"
+
+#string STR_CHECK_ALGORITHM_PROMPT                #language en-US  "Check Algorithm"
+#string STR_CHECK_ALGORITHM_HELP                  #language en-US  "Set the memory check algorithm"
+#string STR_ECC                                   #language en-US  "ECC"
+#string STR_SDEC                                  #language en-US  "SDEC"
+
+#string STR_PATROL_SCRUB_PROMPT                   #language en-US  "Active Scrub"
+#string STR_PATROL_SCRUB_HELP                     #language en-US  "Enable/Disable Active Scrub"
+
+#string STR_PATROL_SCRUB_DURATION_PROMPT          #language en-US  "Active Scrub Interval"
+#string STR_PATROL_SCRUB_DURATION_HELP            #language en-US  "Selects the number of hours (0-24) required to complete full scrub. A value of zero means auto!"
+
+#string STR_DEMAND_SCRUB_PROMPT                   #language en-US  "Passive Scrub"
+#string STR_DEMAND_SCRUB_HELP                     #language en-US  "Enable/Disable Passive Scrub"
+
+#string STR_CORRECT_ERROR_FORM_TITLE              #language en-US  "Correct Error handle"
+#string STR_CORRECT_ERROR_FORM_HELP               #language en-US  "Correctable error-related configuration"
+
+#string STR_CORRECT_ERROR_THRESHOLD_PROMPT        #language en-US  "Correct Error Threshold"
+#string STR_CORRECT_ERROR_THRESHOLD_HELP          #language en-US  "Correctable error-related configuration"
+#string STR_500                                   #language en-US  "500"
+#string STR_1000                                  #language en-US  "1000"
+#string STR_2000                                  #language en-US  "2000"
+
+#string STR_FUNNEL_PERIOD_PROMPT                  #language en-US  "Funnel Period(min)"
+#string STR_FUNNEL_PERIOD_HELP                    #language en-US  "Set the Funnel function time period"
+#string STR_30                                    #language en-US  "30"
+#string STR_60                                    #language en-US  "60"
+
+#string STR_ADVANCE_DEVICE_CORRECTION_PROMPT      #language en-US  "Advance Device Correction"
+#string STR_ADVANCE_DEVICE_CORRECTION_HELP        #language en-US  "Configure the correctable error threshold alarm handling solution"
+#string STR_SR                                    #language en-US  "SR"
+#string STR_MR                                    #language en-US  "MR"
+
+#string STR_RANK_SPARING_PROMPT                   #language en-US  "Rank Sparing"
+#string STR_RANK_SPARING_HELP                     #language en-US  "Enable/Disable Rank Sparing"
+
+#string STR_DPC_FEARURE                           #language en-US  "DPC Feature"
+#string STR_DPC_FEARURE_HELP                      #language en-US  "Enable/Disable PCIE DPC(DownStream Port Containment) feature."
+
+#string STR_ECRC_FEARURE                          #language en-US  "ECRC Feature"
+#string STR_ECRC_FEARURE_HELP                     #language en-US  "Enable/Disable ECRC check feature"
+#string STR_COMPLETION_TIMEOUT                    #language en-US  "Completion Timeout"
+#string STR_COMPLETION_TIMEOUT_HELP               #language en-US  "Enable/Disable PCIE Completion Timeout feature."
+
+#string STR_COMPLETION_TIMEOUT_VALUE              #language en-US  "Completion Timeout Value"
+#string STR_COMPLETION_TIMEOUT_VALUE_HELP         #language en-US  "Set the corresponding Completion Timeout value."
+
+#string STR_HOT_PLUG                              #language en-US  "Hot-Plug"
+#string STR_HOT_PLUG_HELP                         #language en-US  "Enable/Disable PCIE Hot-plug feature."
+#string STR_50US_TO_50MS                          #language en-US  "50 us to 50 ms"
+#string STR_50US_TO_100US                         #language en-US  "50 us to 100 us"
+#string STR_1MS_TO_10MS                           #language en-US  "1 ms to 10 ms"
diff --git a/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/iBMCConfig.hfr b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/iBMCConfig.hfr
new file mode 100644
index 0000000000..4d295a8593
--- /dev/null
+++ b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/iBMCConfig.hfr
@@ -0,0 +1,81 @@ 
+ ///** @file
+//
+// IBMC Config form.
+//
+//  Copyright (c) 2018, Hisilicon Limited. All rights reserved.
+//  Copyright (c) 2018, Linaro Limited. All rights reserved.
+//  This program and the accompanying materials
+//  are licensed and made available under the terms and conditions of the BSD License
+//  which accompanies this distribution.  The full text of the license may be found at
+//  http://opensource.org/licenses/bsd-license.php
+//
+//  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+//
+//**/
+  form formid = IBMC_CONFIG_FORM_ID,
+       title  = STRING_TOKEN(STR_IBMC_CONFIG_FORM_TITLE);
+
+    oneof
+        varid       = OEM_CONFIG_DATA.BmcWdtEnable,
+        prompt      = STRING_TOKEN(STR_BMC_WATCHDOG_TIMER),
+        help        = STRING_TOKEN(STR_BMC_WATCHDOG_TIMER_HELP),
+        option text = STRING_TOKEN(STR_DISABLE),  value = 0, flags = DEFAULT;
+        option text = STRING_TOKEN(STR_ENABLE),   value = 1, flags = 0;
+    endoneof;
+
+    suppressif ideqval OEM_CONFIG_DATA.BmcWdtEnable == 0;
+      numeric
+        varid       = OEM_CONFIG_DATA.BmcWdtTimeout,
+        prompt      = STRING_TOKEN(STR_BMC_WATCHDOG_TIMER_TIMEOUT),
+        help        = STRING_TOKEN(STR_BMC_WATCHDOG_TIMER_TIMEOUT_C10_HELP),
+        minimum     = 15,
+        maximum     = 25,
+        step        = 1,
+        default     = 15,
+      endnumeric;
+
+      oneof
+        varid       = OEM_CONFIG_DATA.BmcWdtAction,
+        prompt      = STRING_TOKEN(STR_BMC_WATCHDOG_TIMER_ACTION),
+        help        = STRING_TOKEN(STR_BMC_WATCHDOG_TIMER_ACTION_HELP),
+        option text = STRING_TOKEN(STR_BMC_WATCHDOG_TIMER_NO_ACTION),   value = 0, flags = 0;
+        option text = STRING_TOKEN(STR_BMC_WATCHDOG_TIMER_HARD_RESET),  value = 1, flags = DEFAULT;
+        option text = STRING_TOKEN(STR_BMC_WATCHDOG_TIMER_POWER_DOWN),  value = 2, flags = 0;
+        option text = STRING_TOKEN(STR_BMC_WATCHDOG_TIMER_POWER_CYCLE), value = 3, flags = 0;
+      endoneof;
+    endif;
+
+    suppressif TRUE;
+      oneof
+        varid       = OEM_CONFIG_DATA.OSWdtEnable,
+        prompt      = STRING_TOKEN(STR_BMC_OS_WATCHDOG_TIMER),
+        help        = STRING_TOKEN(STR_BMC_OS_WATCHDOG_TIMER_HELP),
+        option text = STRING_TOKEN(STR_DISABLE), value = 0, flags = DEFAULT;
+        option text = STRING_TOKEN(STR_ENABLE),  value = 1, flags = 0;
+      endoneof;
+    endif;
+
+    suppressif ideqval OEM_CONFIG_DATA.OSWdtEnable == 0;
+      numeric
+        varid       = OEM_CONFIG_DATA.OSWdtTimeout,
+        prompt      = STRING_TOKEN(STR_BMC_OS_WDT_TIMEOUT),
+        help        = STRING_TOKEN(STR_BMC_OS_WDT_TIMEOUT_HELP),
+        minimum     = 5,
+        maximum     = 8,
+        step        = 1,
+        default     = 5,
+      endnumeric;
+
+      oneof
+        varid       = OEM_CONFIG_DATA.OSWdtAction,
+        prompt      = STRING_TOKEN(STR_BMC_OS_WDT_ACTION),
+        help        = STRING_TOKEN(STR_BMC_WATCHDOG_TIMER_ACTION_HELP),
+        option text = STRING_TOKEN(STR_BMC_WATCHDOG_TIMER_NO_ACTION),   value = 0, flags = 0;
+        option text = STRING_TOKEN(STR_BMC_WATCHDOG_TIMER_HARD_RESET),  value = 1, flags = DEFAULT;
+        option text = STRING_TOKEN(STR_BMC_WATCHDOG_TIMER_POWER_DOWN),  value = 2, flags = 0;
+        option text = STRING_TOKEN(STR_BMC_WATCHDOG_TIMER_POWER_CYCLE), value = 3, flags = 0;
+      endoneof;
+    endif;
+
+  endform;
diff --git a/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/iBMCConfig.uni b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/iBMCConfig.uni
new file mode 100644
index 0000000000..e12e433760
--- /dev/null
+++ b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/iBMCConfig.uni
@@ -0,0 +1,34 @@ 
+// /** @file
+// OEM Config Library used by UiApp
+//
+//
+//  Copyright (c) 2018, Hisilicon Limited. All rights reserved.
+//  Copyright (c) 2018, Linaro Limited. All rights reserved.
+//
+// This program and the accompanying materials are licensed and made available under
+// the terms and conditions of the BSD License that accompanies this distribution.
+// The full text of the license may be found at
+// 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.
+//
+// **/
+#langdef   en-US "English"
+
+#string STR_BMC_WATCHDOG_TIMER                      #language en-US  "iBMC WDT Support For POST"
+#string STR_BMC_WATCHDOG_TIMER_HELP                 #language en-US  "Enable/Disable iBMC watchdog timer at start of POST."
+#string STR_BMC_WATCHDOG_TIMER_TIMEOUT              #language en-US  "iBMC WDT TimeOut For POST"
+#string STR_BMC_WATCHDOG_TIMER_TIMEOUT_C10_HELP     #language en-US  "Enter the number of minutes the system firmware has to boot the OS before it takes the Timeout Action. Valid values are from 15 to 25 minutes."
+#string STR_BMC_WATCHDOG_TIMER_ACTION               #language en-US  "iBMC WDT Action For POST"
+#string STR_BMC_WATCHDOG_TIMER_ACTION_HELP          #language en-US  "Timeout Action Choices: No Action, Hard Reset, Power Down or Power Cycle"
+#string STR_BMC_WATCHDOG_TIMER_NO_ACTION            #language en-US  "No Action"
+#string STR_BMC_WATCHDOG_TIMER_HARD_RESET           #language en-US  "Hard Reset"
+#string STR_BMC_WATCHDOG_TIMER_POWER_DOWN           #language en-US  "Power Down"
+#string STR_BMC_WATCHDOG_TIMER_POWER_CYCLE          #language en-US  "Power Cycle"
+#string STR_BMC_OS_WATCHDOG_TIMER                   #language en-US  "iBMC WDT Support For OS"
+#string STR_BMC_OS_WATCHDOG_TIMER_HELP              #language en-US  "Enable/Disable OS Watchdog Timer When OS Load"
+#string STR_BMC_OS_WDT_TIMEOUT                      #language en-US  "iBMC WDT TimeOut For OS"
+#string STR_BMC_OS_WDT_TIMEOUT_HELP                 #language en-US  "Enter the number of minutes the system firmware \n has to OS Load before it takes the Timeout Action. Valid values are from 5 to 8 minutes."
+#string STR_BMC_OS_WDT_ACTION                       #language en-US  "iBMC WDT Action For OS"
+