From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:4864:20::442; helo=mail-pf1-x442.google.com; envelope-from=ming.huang@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id DAD6A210F474F for ; Wed, 22 Aug 2018 08:11:28 -0700 (PDT) Received: by mail-pf1-x442.google.com with SMTP id p12-v6so1126413pfh.2 for ; Wed, 22 Aug 2018 08:11:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=lzbVYgNNnMu/kgnRrTlVLVAJwRrGrSbCbinQEl3lRgg=; b=gpJ80u0GA/tDkXaxfTZhA06x1GnGRLcA2fPpuQJDeOUBsLI8urzczxy78UtC54rXhc 8pjRpWVFXujuMPxpuYkbMm7N6wGwLaR1WNEOt2PrcICU60t1XCthw/m+OTk4ShJaMINS 2fwws2nulxHKQ7J6opiIHH6fzfQ2X5Sye71Ls= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=lzbVYgNNnMu/kgnRrTlVLVAJwRrGrSbCbinQEl3lRgg=; b=O3uUXAG6ZyyWqvYvSgS5nhcgSQ+9ednnlo6lF+QL8bOD6kEyLlEfr8CJZRfyC2vOJ1 bbmkp22oeKpTHJG6XXrSG0N+B8QBmUfdE+UHAQqoHi3xHDLyuWHjcIB5WbJlfzcFGzLd emtl46X0i5JK5+l1CJxbF2YabyY71eSrbEHGB5X1ROKtfAJH41AfhV3bsrMUVGThtMfm owYYqHRLzG2+MXlRiCtNiTQzt+0/jCsMoVmIGVlrd9KHo9mIsosNJd7KNyt0mckYG3pW PJD/Q/8ZhLtBWcWKC0UJWoatUr4KWT4rGApNBiXFVJQ+Srqhe4HA7ZSBSQVc4Tcou9Ov PsUQ== X-Gm-Message-State: AOUpUlExqccUXUPdmhQiR6Q3JAitCCRU64KEFFDg9aOfQOCblQppxW4f 8hS3uRjUeo591wqnIaowszOJDw== X-Google-Smtp-Source: AA+uWPzaCQVosKnm9qmiQBZVIm0JBX2sJUTIIQ4Ty4a9UZXZgIeez3y6xleq+HSnuo0zHMLPJ/piZg== X-Received: by 2002:a63:d946:: with SMTP id e6-v6mr52298808pgj.24.1534950688264; Wed, 22 Aug 2018 08:11:28 -0700 (PDT) Received: from [10.84.0.214] ([64.64.108.140]) by smtp.gmail.com with ESMTPSA id x80-v6sm3576537pfe.129.2018.08.22.08.11.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Aug 2018 08:11:27 -0700 (PDT) To: Leif Lindholm Cc: linaro-uefi@lists.linaro.org, edk2-devel@lists.01.org, graeme.gregory@linaro.org, ard.biesheuvel@linaro.org, michael.d.kinney@intel.com, lersek@redhat.com, guoheyi@huawei.com, wanghuiqiang@huawei.com, huangming23@huawei.com, zhangjinsong2@huawei.com, huangdaode@hisilicon.com, john.garry@huawei.com, xinliang.liu@linaro.org, Yang XinYi References: <20180814080903.50466-1-ming.huang@linaro.org> <20180814080903.50466-19-ming.huang@linaro.org> <20180822141433.22npey5rje6zijgl@bivouac.eciton.net> From: Ming Message-ID: <62716765-22e7-b6ea-8df9-500aabe2cbe8@linaro.org> Date: Wed, 22 Aug 2018 23:11:10 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.0 MIME-Version: 1.0 In-Reply-To: <20180822141433.22npey5rje6zijgl@bivouac.eciton.net> Subject: Re: [PATCH edk2-platforms v2 18/43] Hisilicon/D06: Add Hi1620OemConfigUiLib X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Aug 2018 15:11:29 -0000 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit 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 >> >> This library is added for oem setup menu item. >> Setup item include: >> 1 DDR option item; >> 2 BMC option item; >> 3 Ras option item; >> 4 Misc option item; >> >> Contributed-under: TianoCore Contribution Agreement 1.1 >> Signed-off-by: Yang XinYi >> --- >> Silicon/Hisilicon/HisiPkg.dec | 1 + >> Platform/Hisilicon/D06/D06.dsc | 5 +- >> Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf | 2 +- >> Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigUiLib.inf | 68 ++++ >> Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfig.h | 142 ++++++++ >> Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigUi.h | 64 ++++ >> Silicon/Hisilicon/Include/Library/OemConfigData.h | 84 +++++ >> Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfig.c | 363 ++++++++++++++++++++ >> Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/MemoryConfig.hfr | 154 +++++++++ >> Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/MemoryConfig.uni | 103 ++++++ >> Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/MiscConfig.hfr | 41 +++ >> Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/MiscConfig.uni | 27 ++ >> Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigUiLib.uni | 24 ++ >> Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigUiLibStrings.uni | 42 +++ >> Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigVfr.Vfr | 89 +++++ > > 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 { >> + >> + 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 >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include "Library/OemConfigData.h" >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> + >> +// >> +// 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 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 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 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 >> + >> +#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 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 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 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 >