From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=45.249.212.35; helo=huawei.com; envelope-from=huangming23@huawei.com; receiver=edk2-devel@lists.01.org Received: from huawei.com (unknown [45.249.212.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id E48B62215BD93 for ; Tue, 30 Jan 2018 04:43:07 -0800 (PST) Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id A767CDCE177DA; Tue, 30 Jan 2018 20:48:34 +0800 (CST) Received: from [127.0.0.1] (10.61.17.224) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.361.1; Tue, 30 Jan 2018 20:48:29 +0800 To: Leif Lindholm , Ming Huang References: <1516953650-57980-1-git-send-email-huangming23@huawei.com> <1516953650-57980-6-git-send-email-huangming23@huawei.com> <20180129195859.jkfhnxzpn5s5isgt@bivouac.eciton.net> CC: , , , , , , , , , From: "Huangming (Mark)" Message-ID: <47d46308-ff52-af8e-15ca-4bf96828118b@huawei.com> Date: Tue, 30 Jan 2018 20:48:27 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <20180129195859.jkfhnxzpn5s5isgt@bivouac.eciton.net> X-Originating-IP: [10.61.17.224] X-CFilter-Loop: Reflected Subject: Re: [PATCH edk2-platforms v2 05/15] Hisilicon D03/D05: Add capsule upgrade support X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jan 2018 12:43:09 -0000 Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit On 2018/1/30 3:58, Leif Lindholm wrote: > A few style comments below. > > On Fri, Jan 26, 2018 at 04:00:40PM +0800, Ming Huang wrote: >> From: Jason Zhang >> >> This module support updating the boot CPU firmware only. >> >> Contributed-under: TianoCore Contribution Agreement 1.1 >> Signed-off-by: Jason Zhang >> Signed-off-by: Ming Huang >> Signed-off-by: Heyi Guo >> --- >> Platform/Hisilicon/D03/Capsule/SystemFirmwareUpdateConfig/SystemFirmwareUpdateConfig.ini | 45 +++++++ >> Platform/Hisilicon/D03/D03.dsc | 17 ++- >> Platform/Hisilicon/D03/D03.fdf | 70 +++++++++++ >> Platform/Hisilicon/D03/Drivers/SystemFirmwareDescriptor/SystemFirmwareDescriptor.aslc | 81 +++++++++++++ >> Platform/Hisilicon/D03/Drivers/SystemFirmwareDescriptor/SystemFirmwareDescriptor.inf | 50 ++++++++ >> Platform/Hisilicon/D03/Drivers/SystemFirmwareDescriptor/SystemFirmwareDescriptorPei.c | 70 +++++++++++ >> Platform/Hisilicon/D05/Capsule/SystemFirmwareUpdateConfig/SystemFirmwareUpdateConfig.ini | 45 +++++++ >> Platform/Hisilicon/D05/D05.dsc | 19 ++- >> Platform/Hisilicon/D05/D05.fdf | 70 +++++++++++ >> Platform/Hisilicon/D05/Drivers/SystemFirmwareDescriptor/SystemFirmwareDescriptor.aslc | 81 +++++++++++++ >> Platform/Hisilicon/D05/Drivers/SystemFirmwareDescriptor/SystemFirmwareDescriptor.inf | 50 ++++++++ >> Platform/Hisilicon/D05/Drivers/SystemFirmwareDescriptor/SystemFirmwareDescriptorPei.c | 70 +++++++++++ >> Silicon/Hisilicon/Hisilicon.dsc.inc | 11 +- >> Silicon/Hisilicon/Hisilicon.fdf.inc | 9 ++ >> Silicon/Hisilicon/Library/PlatformFlashAccessLib/PlatformFlashAccessLibDxe.c | 123 ++++++++++++++++++++ >> Silicon/Hisilicon/Library/PlatformFlashAccessLib/PlatformFlashAccessLibDxe.inf | 51 ++++++++ >> 16 files changed, 859 insertions(+), 3 deletions(-) >> > >> diff --git a/Platform/Hisilicon/D03/Drivers/SystemFirmwareDescriptor/SystemFirmwareDescriptor.aslc b/Platform/Hisilicon/D03/Drivers/SystemFirmwareDescriptor/SystemFirmwareDescriptor.aslc >> new file mode 100644 >> index 0000000..d9f4a00 >> --- /dev/null >> +++ b/Platform/Hisilicon/D03/Drivers/SystemFirmwareDescriptor/SystemFirmwareDescriptor.aslc >> @@ -0,0 +1,81 @@ >> +/** @file >> + System Firmware descriptor. >> + >> + Copyright (c) 2018, Hisilicon Limited. All rights reserved. >> + Copyright (c) 2018, Linaro Limited. All rights reserved. >> + Copyright (c) 2016, Intel Corporation. All rights reserved.
>> + >> + This program and the accompanying materials >> + are licensed and made available under the terms and conditions of the BSD License >> + which accompanies this distribution. The full text of the license may be found at >> + http://opensource.org/licenses/bsd-license.php >> + >> + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, >> + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. >> + >> +**/ >> + >> +#include >> +#include >> +#include >> + >> +#define PACKAGE_VERSION 0xFFFFFFFF >> +#define PACKAGE_VERSION_STRING L"Unknown" >> + >> +#define CURRENT_FIRMWARE_VERSION 0x00000002 >> +#define CURRENT_FIRMWARE_VERSION_STRING L"0x00000002" >> +#define LOWEST_SUPPORTED_FIRMWARE_VERSION 0x00000001 >> + >> +#define IMAGE_ID SIGNATURE_64('H','W','A', 'R', 'M', '_', 'F', 'd') >> +#define IMAGE_ID_STRING L"ARMPlatformFd" >> + >> +// PcdSystemFmpCapsuleImageTypeIdGuid >> +#define IMAGE_TYPE_ID_GUID { 0x44c850f2, 0x85ff, 0x4be5, { 0xbf, 0x34, 0xa5, 0x95, 0x28, 0xdf, 0x22, 0xd3 } } >> + >> +typedef struct { >> + EDKII_SYSTEM_FIRMWARE_IMAGE_DESCRIPTOR Descriptor; >> + // real string data >> + CHAR16 ImageIdNameStr[sizeof(IMAGE_ID_STRING) / sizeof(CHAR16)]; >> + CHAR16 VersionNameStr[sizeof(CURRENT_FIRMWARE_VERSION_STRING) / sizeof(CHAR16)]; >> + CHAR16 PackageVersionNameStr[sizeof(PACKAGE_VERSION_STRING) / sizeof(CHAR16)]; > > Use ARRAY_SIZE for the 3 above? > If use ARRAY_SIZE, the three macro must change to array of CHAR16. It is not necessary maybe.The same style is found in SystemFirmwareDescriptor.aslc from other platform,like AMD,Socionext. Thanks, Ming >> +} IMAGE_DESCRIPTOR; >> + >> +IMAGE_DESCRIPTOR mImageDescriptor = >> +{ >> + { >> + EDKII_SYSTEM_FIRMWARE_IMAGE_DESCRIPTOR_SIGNATURE, >> + sizeof (EDKII_SYSTEM_FIRMWARE_IMAGE_DESCRIPTOR), >> + sizeof (IMAGE_DESCRIPTOR), >> + PACKAGE_VERSION, // PackageVersion >> + OFFSET_OF (IMAGE_DESCRIPTOR, PackageVersionNameStr), // PackageVersionName >> + 1, // ImageIndex; >> + {0x0}, // Reserved >> + IMAGE_TYPE_ID_GUID, // ImageTypeId; >> + IMAGE_ID, // ImageId; >> + OFFSET_OF (IMAGE_DESCRIPTOR, ImageIdNameStr), // ImageIdName; >> + CURRENT_FIRMWARE_VERSION, // Version; >> + OFFSET_OF (IMAGE_DESCRIPTOR, VersionNameStr), // VersionName; >> + {0x0}, // Reserved2 >> + FixedPcdGet32 (PcdFdSize), // Size; >> + IMAGE_ATTRIBUTE_IMAGE_UPDATABLE | >> + IMAGE_ATTRIBUTE_RESET_REQUIRED | >> + IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED | >> + IMAGE_ATTRIBUTE_IN_USE, // AttributesSupported; >> + IMAGE_ATTRIBUTE_IMAGE_UPDATABLE | >> + IMAGE_ATTRIBUTE_RESET_REQUIRED | >> + IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED | >> + IMAGE_ATTRIBUTE_IN_USE, // AttributesSetting; >> + 0x0, // Compatibilities; >> + LOWEST_SUPPORTED_FIRMWARE_VERSION, // LowestSupportedImageVersion; >> + 0x00000000, // LastAttemptVersion; >> + 0, // LastAttemptStatus; >> + {0x0}, // Reserved3 >> + 0, // HardwareInstance; >> + }, >> + // real string data >> + {IMAGE_ID_STRING}, >> + {CURRENT_FIRMWARE_VERSION_STRING}, >> + {PACKAGE_VERSION_STRING}, >> +}; >> + >> +VOID* CONST ReferenceAcpiTable = &mImageDescriptor; >> diff --git a/Platform/Hisilicon/D03/Drivers/SystemFirmwareDescriptor/SystemFirmwareDescriptor.inf b/Platform/Hisilicon/D03/Drivers/SystemFirmwareDescriptor/SystemFirmwareDescriptor.inf >> new file mode 100644 >> index 0000000..c38a809 >> --- /dev/null >> +++ b/Platform/Hisilicon/D03/Drivers/SystemFirmwareDescriptor/SystemFirmwareDescriptor.inf >> @@ -0,0 +1,50 @@ >> +## @file >> +# System Firmware descriptor. >> +# >> +# Copyright (c) 2018, Hisilicon Limited. All rights reserved. >> +# Copyright (c) 2018, Linaro Limited. All rights reserved. >> +# Copyright (c) 2016, Intel Corporation. All rights reserved.
>> +# >> +# This program and the accompanying materials >> +# are licensed and made available under the terms and conditions of the BSD License >> +# which accompanies this distribution. The full text of the license may be found at >> +# http://opensource.org/licenses/bsd-license.php >> +# >> +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, >> +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. >> +# >> +## >> + >> +[Defines] >> + INF_VERSION = 0x00010005 > > 0x0001001A > >> + BASE_NAME = SystemFirmwareDescriptor >> + FILE_GUID = 90B2B846-CA6D-4D6E-A8D3-C140A8E110AC >> + MODULE_TYPE = PEIM >> + VERSION_STRING = 1.0 >> + ENTRY_POINT = SystemFirmwareDescriptorPeimEntry >> + >> +[Sources] >> + SystemFirmwareDescriptorPei.c >> + SystemFirmwareDescriptor.aslc >> + >> +[Packages] >> + ArmPkg/ArmPkg.dec >> + ArmPlatformPkg/ArmPlatformPkg.dec >> + MdeModulePkg/MdeModulePkg.dec >> + MdePkg/MdePkg.dec >> + SignedCapsulePkg/SignedCapsulePkg.dec >> + >> +[LibraryClasses] >> + DebugLib >> + PcdLib >> + PeimEntryPoint >> + PeiServicesLib >> + >> +[FixedPcd] >> + gArmTokenSpaceGuid.PcdFdSize >> + >> +[Pcd] >> + gEfiSignedCapsulePkgTokenSpaceGuid.PcdEdkiiSystemFirmwareImageDescriptor >> + >> +[Depex] >> + TRUE > >> diff --git a/Platform/Hisilicon/D05/Drivers/SystemFirmwareDescriptor/SystemFirmwareDescriptor.aslc b/Platform/Hisilicon/D05/Drivers/SystemFirmwareDescriptor/SystemFirmwareDescriptor.aslc >> new file mode 100644 >> index 0000000..9f65bb9 >> --- /dev/null >> +++ b/Platform/Hisilicon/D05/Drivers/SystemFirmwareDescriptor/SystemFirmwareDescriptor.aslc >> @@ -0,0 +1,81 @@ >> +/** @file >> + System Firmware descriptor. >> + >> + Copyright (c) 2018, Hisilicon Limited. All rights reserved. >> + Copyright (c) 2018, Linaro Limited. All rights reserved. >> + Copyright (c) 2016, Intel Corporation. All rights reserved.
>> + >> + This program and the accompanying materials >> + are licensed and made available under the terms and conditions of the BSD License >> + which accompanies this distribution. The full text of the license may be found at >> + http://opensource.org/licenses/bsd-license.php >> + >> + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, >> + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. >> + >> +**/ >> + >> +#include >> +#include >> +#include >> + >> +#define PACKAGE_VERSION 0xFFFFFFFF >> +#define PACKAGE_VERSION_STRING L"Unknown" >> + >> +#define CURRENT_FIRMWARE_VERSION 0x00000002 >> +#define CURRENT_FIRMWARE_VERSION_STRING L"0x00000002" >> +#define LOWEST_SUPPORTED_FIRMWARE_VERSION 0x00000001 >> + >> +#define IMAGE_ID SIGNATURE_64('H','W','A', 'R', 'M', '_', 'F', 'd') >> +#define IMAGE_ID_STRING L"ARMPlatformFd" >> + >> +// PcdSystemFmpCapsuleImageTypeIdGuid >> +#define IMAGE_TYPE_ID_GUID { 0x7978365d, 0x7978, 0x45fd, { 0xad, 0x77, 0xb2, 0x76, 0x93, 0xcf, 0xe8, 0x5b } } >> + >> +typedef struct { >> + EDKII_SYSTEM_FIRMWARE_IMAGE_DESCRIPTOR Descriptor; >> + // real string data >> + CHAR16 ImageIdNameStr[sizeof(IMAGE_ID_STRING) / sizeof(CHAR16)]; >> + CHAR16 VersionNameStr[sizeof(CURRENT_FIRMWARE_VERSION_STRING) / sizeof(CHAR16)]; >> + CHAR16 PackageVersionNameStr[sizeof(PACKAGE_VERSION_STRING) / sizeof(CHAR16)]; > > 3x ARRAY_SIZE? > >> +} IMAGE_DESCRIPTOR; >> + >> +IMAGE_DESCRIPTOR mImageDescriptor = >> +{ >> + { >> + EDKII_SYSTEM_FIRMWARE_IMAGE_DESCRIPTOR_SIGNATURE, >> + sizeof (EDKII_SYSTEM_FIRMWARE_IMAGE_DESCRIPTOR), >> + sizeof (IMAGE_DESCRIPTOR), >> + PACKAGE_VERSION, // PackageVersion >> + OFFSET_OF (IMAGE_DESCRIPTOR, PackageVersionNameStr), // PackageVersionName >> + 1, // ImageIndex; >> + {0x0}, // Reserved >> + IMAGE_TYPE_ID_GUID, // ImageTypeId; >> + IMAGE_ID, // ImageId; >> + OFFSET_OF (IMAGE_DESCRIPTOR, ImageIdNameStr), // ImageIdName; >> + CURRENT_FIRMWARE_VERSION, // Version; >> + OFFSET_OF (IMAGE_DESCRIPTOR, VersionNameStr), // VersionName; >> + {0x0}, // Reserved2 >> + FixedPcdGet32 (PcdFdSize), // Size; >> + IMAGE_ATTRIBUTE_IMAGE_UPDATABLE | >> + IMAGE_ATTRIBUTE_RESET_REQUIRED | >> + IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED | >> + IMAGE_ATTRIBUTE_IN_USE, // AttributesSupported; >> + IMAGE_ATTRIBUTE_IMAGE_UPDATABLE | >> + IMAGE_ATTRIBUTE_RESET_REQUIRED | >> + IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED | >> + IMAGE_ATTRIBUTE_IN_USE, // AttributesSetting; >> + 0x0, // Compatibilities; >> + LOWEST_SUPPORTED_FIRMWARE_VERSION, // LowestSupportedImageVersion; >> + 0x00000000, // LastAttemptVersion; >> + 0, // LastAttemptStatus; >> + {0x0}, // Reserved3 >> + 0, // HardwareInstance; >> + }, >> + // real string data >> + {IMAGE_ID_STRING}, >> + {CURRENT_FIRMWARE_VERSION_STRING}, >> + {PACKAGE_VERSION_STRING}, >> +}; >> + >> +VOID* CONST ReferenceAcpiTable = &mImageDescriptor; >> diff --git a/Platform/Hisilicon/D05/Drivers/SystemFirmwareDescriptor/SystemFirmwareDescriptor.inf b/Platform/Hisilicon/D05/Drivers/SystemFirmwareDescriptor/SystemFirmwareDescriptor.inf >> new file mode 100644 >> index 0000000..c38a809 >> --- /dev/null >> +++ b/Platform/Hisilicon/D05/Drivers/SystemFirmwareDescriptor/SystemFirmwareDescriptor.inf >> @@ -0,0 +1,50 @@ >> +## @file >> +# System Firmware descriptor. >> +# >> +# Copyright (c) 2018, Hisilicon Limited. All rights reserved. >> +# Copyright (c) 2018, Linaro Limited. All rights reserved. >> +# Copyright (c) 2016, Intel Corporation. All rights reserved.
>> +# >> +# This program and the accompanying materials >> +# are licensed and made available under the terms and conditions of the BSD License >> +# which accompanies this distribution. The full text of the license may be found at >> +# http://opensource.org/licenses/bsd-license.php >> +# >> +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, >> +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. >> +# >> +## >> + >> +[Defines] >> + INF_VERSION = 0x00010005 > > 0x0001001A > >> + BASE_NAME = SystemFirmwareDescriptor >> + FILE_GUID = 90B2B846-CA6D-4D6E-A8D3-C140A8E110AC >> + MODULE_TYPE = PEIM >> + VERSION_STRING = 1.0 >> + ENTRY_POINT = SystemFirmwareDescriptorPeimEntry >> + >> +[Sources] >> + SystemFirmwareDescriptorPei.c >> + SystemFirmwareDescriptor.aslc >> + >> +[Packages] >> + ArmPkg/ArmPkg.dec >> + ArmPlatformPkg/ArmPlatformPkg.dec >> + MdeModulePkg/MdeModulePkg.dec >> + MdePkg/MdePkg.dec >> + SignedCapsulePkg/SignedCapsulePkg.dec >> + >> +[LibraryClasses] >> + DebugLib >> + PcdLib >> + PeimEntryPoint >> + PeiServicesLib >> + >> +[FixedPcd] >> + gArmTokenSpaceGuid.PcdFdSize >> + >> +[Pcd] >> + gEfiSignedCapsulePkgTokenSpaceGuid.PcdEdkiiSystemFirmwareImageDescriptor >> + >> +[Depex] >> + TRUE > > . > -- Best Regards, Ming