From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c09::244; helo=mail-wm0-x244.google.com; envelope-from=leif.lindholm@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm0-x244.google.com (mail-wm0-x244.google.com [IPv6:2a00:1450:400c:c09::244]) (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 44C4D2215BDB5 for ; Tue, 30 Jan 2018 05:15:55 -0800 (PST) Received: by mail-wm0-x244.google.com with SMTP id v71so1099867wmv.2 for ; Tue, 30 Jan 2018 05:21:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=DrPimb6TI0wCqerW1RjE3Zsd5ePQAtMnfEnNen/sY/Q=; b=Yps/iSsJ2HKmw+M/Rb/ziFOmvXf+3BARgeDKLkur76IJo8RAqGpShHFGZQf0DMLtGD /GNWLV/VJLPjJhN6LmYa0ykD5JKAm+CDCPdlxLb0cLtejhlOdEWlMI48WlOuvOpA6iYd XOJlewFZ1QYhx1rr/6MVokccQo0vL/qRTTkqo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=DrPimb6TI0wCqerW1RjE3Zsd5ePQAtMnfEnNen/sY/Q=; b=p/iSeaHbF6ztjLRbf9ELj+K2scnIjHUVMkVBI6Siuzf3quk5CjpdHt88obW1X0wLiC zMrWXjctaN0OiRjxUmYoymQN3QBvwEz5eBbX4zQsb7xqwAlavAXDDJb3zx8bj7nCrwiK H1NLgWDtHXsi//9Gxlkc+vNAcj8SY4EIA/BOQ3zkW4ylHVoENsU75EDC7W78C17mZ6w6 1NAB9ATSnyXqMCC5aCUmuZgtTAsCmhzH2VebpNNE/ScfEPVUgkGp9fMLOP+MxEqz/wBl VJbGJ32TOm2wGKT6FwTFxYewKUFn7gLVS6v2nUZEkNkrihT0JXcShr4Y/VSjyEwAWMSM LP5g== X-Gm-Message-State: AKwxytd65D3uh87/SpxhzdjZYq5vr0sDkFI7zqRxn6GFgkDP0KiWfCUj Ans7DkrFGYOdUbYlnO+9Mw3zLw== X-Google-Smtp-Source: AH8x227CEevb0rsWYIGQrULaTSQsTc5g4Wx9+GN7o1FMPacz43hnZhTuIwuzSDGx3IZI4OlFdyMRrQ== X-Received: by 10.28.58.208 with SMTP id h199mr23432537wma.79.1517318489140; Tue, 30 Jan 2018 05:21:29 -0800 (PST) Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id o98sm12367568wrb.44.2018.01.30.05.21.27 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 30 Jan 2018 05:21:27 -0800 (PST) Date: Tue, 30 Jan 2018 13:21:25 +0000 From: Leif Lindholm To: "Huangming (Mark)" Cc: Ming Huang , linaro-uefi@lists.linaro.org, edk2-devel@lists.01.org, graeme.gregory@linaro.org, ard.biesheuvel@linaro.org, guoheyi@huawei.com, wanghuiqiang@huawei.com, zhangjinsong2@huawei.com, mengfanrong@huawei.com, huangdaode@hisilicon.com, waip23@126.com Message-ID: <20180130132125.h3nwz4b3yjyeyeik@bivouac.eciton.net> References: <1516953650-57980-1-git-send-email-huangming23@huawei.com> <1516953650-57980-6-git-send-email-huangming23@huawei.com> <20180129195859.jkfhnxzpn5s5isgt@bivouac.eciton.net> <47d46308-ff52-af8e-15ca-4bf96828118b@huawei.com> MIME-Version: 1.0 In-Reply-To: <47d46308-ff52-af8e-15ca-4bf96828118b@huawei.com> User-Agent: NeoMutt/20170113 (1.7.2) 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 13:15:56 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Jan 30, 2018 at 08:48:27PM +0800, Huangming (Mark) wrote: > > > 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. What problem are you encountering when simply replacing CHAR16 ImageIdNameStr[sizeof(IMAGE_ID_STRING) / sizeof(CHAR16)]; with CHAR16 ImageIdNameStr[ARRAY_SIZE (IMAGE_ID_STRING)]; ? > It is not necessary maybe.The same style is found in > SystemFirmwareDescriptor.aslc from other platform,like > AMD,Socionext. Patches welcome. ARRAY_SIZE was only added to MdePkg in October 2016. Ideally, all code should be using this macro, but at least we can try to make sure all _new_ code uses it, when we spot missed opportunities. / Leif