From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: "Huangming (Mark)" <huangming23@huawei.com>
Cc: Ming Huang <heyi.guo@linaro.org>,
"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>,
Leif Lindholm <leif.lindholm@linaro.org>,
Mengfanrong <mengfanrong@huawei.com>,
Jason Zhang <zhangjinsong2@huawei.com>,
linaro-uefi <linaro-uefi@lists.linaro.org>,
guoheyi@huawei.com, waip23@126.com,
wanghuiqiang <wanghuiqiang@huawei.com>
Subject: Re: [PATCH edk2-platforms v1 04/14] Hisilicon D03/D05: Add capsule upgrade support
Date: Tue, 23 Jan 2018 09:33:03 +0000 [thread overview]
Message-ID: <CAKv+Gu_N=a-fA-26OcAn0ifBoap=yQehGN-dE=TSCPAksRdAOA@mail.gmail.com> (raw)
In-Reply-To: <9ea4e05c-c407-4b41-a900-5c12373781a7@huawei.com>
On 23 January 2018 at 08:53, Huangming (Mark) <huangming23@huawei.com> wrote:
>
>
> On 2018/1/20 18:50, Ard Biesheuvel wrote:
>> On 18 January 2018 at 15:01, Ming Huang <heyi.guo@linaro.org> wrote:
>>> From: Jason Zhang <zhangjinsong2@huawei.com>
>>>
>>> Contributed-under: TianoCore Contribution Agreement 1.1
>>> Signed-off-by: Jason Zhang <zhangjinsong2@huawei.com>
>>> Signed-off-by: Ming Huang <huangming23@huawei.com>
>>> Signed-off-by: Heyi Guo <heyi.guo@linaro.org>
>>> ---
>>> Platform/Hisilicon/D03/Capsule/SystemFirmwareUpdateConfig/SystemFirmwareUpdateConfig.ini | 45 +++++++++
>>> Platform/Hisilicon/D03/D03.dsc | 17 +++-
>>> Platform/Hisilicon/D03/D03.fdf | 70 +++++++++++++
>>> Platform/Hisilicon/D05/Capsule/SystemFirmwareUpdateConfig/SystemFirmwareUpdateConfig.ini | 45 +++++++++
>>> Platform/Hisilicon/D05/D05.dsc | 19 +++-
>>> Platform/Hisilicon/D05/D05.fdf | 70 +++++++++++++
>>> Silicon/Hisilicon/Drivers/SystemFirmwareDescriptor/SystemFirmwareDescriptor.aslc | 81 +++++++++++++++
>>> Silicon/Hisilicon/Drivers/SystemFirmwareDescriptor/SystemFirmwareDescriptor.inf | 50 +++++++++
>>> Silicon/Hisilicon/Drivers/SystemFirmwareDescriptor/SystemFirmwareDescriptorPei.c | 70 +++++++++++++
>>> Silicon/Hisilicon/Hisilicon.dsc.inc | 11 +-
>>> Silicon/Hisilicon/Hisilicon.fdf.inc | 9 ++
>>> Silicon/Hisilicon/Library/PlatformFlashAccessLib/PlatformFlashAccessLibDxe.c | 106 ++++++++++++++++++++
>>> Silicon/Hisilicon/Library/PlatformFlashAccessLib/PlatformFlashAccessLibDxe.inf | 51 ++++++++++
>>> 13 files changed, 641 insertions(+), 3 deletions(-)
>>>
>>
>> Excellent!! Very happy to see this added.
>>
...
>>> diff --git a/Silicon/Hisilicon/Library/PlatformFlashAccessLib/PlatformFlashAccessLibDxe.c b/Silicon/Hisilicon/Library/PlatformFlashAccessLib/PlatformFlashAccessLibDxe.c
>>> new file mode 100644
>>> index 0000000..db5725d
>>> --- /dev/null
>>> +++ b/Silicon/Hisilicon/Library/PlatformFlashAccessLib/PlatformFlashAccessLibDxe.c
>>> @@ -0,0 +1,106 @@
>>> +/** @file
>>> + Platform Flash Access library.
>>> +
>>> + Copyright (c) 2018, Hisilicon Limited. All rights reserved.
>>> + Copyright (c) 2018, Linaro Limited. All rights reserved.
>>> + Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
>>> +
>>> + 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 <PiDxe.h>
>>> +#include <Library/BaseLib.h>
>>> +#include <Library/BaseMemoryLib.h>
>>> +#include <Library/DebugLib.h>
>>> +#include <Library/PcdLib.h>
>>> +#include <Library/PlatformFlashAccessLib.h>
>>> +#include <Library/UefiBootServicesTableLib.h>
>>> +#include <Protocol/HisiSpiFlashProtocol.h>
>>> +
>>> +STATIC EFI_PHYSICAL_ADDRESS mInternalFdAddress;
>>> +STATIC EFI_PHYSICAL_ADDRESS mSFCMEM0BaseAddress;
>>> +
>>> +HISI_SPI_FLASH_PROTOCOL *mSpiProtocol;
>>
>> STATIC
>>
>
> I agree with all of your comments except this one.
> PerformFlashWrite is called in SystemFirmwareUpdateDxe module,
> so STATIC can not be added.
>
I meant mSpiProtocol not PerformFlashWrite
>>> +
>>> +/**
>>> + Perform flash write opreation.
>>> +
>>> + @param[in] FirmwareType The type of firmware.
>>> + @param[in] FlashAddress The address of flash device to be accessed.
>>> + @param[in] FlashAddressType The type of flash device address.
>>> + @param[in] Buffer The pointer to the data buffer.
>>> + @param[in] Length The length of data buffer in bytes.
>>> +
>>> + @retval EFI_SUCCESS The operation returns successfully.
>>> + @retval EFI_WRITE_PROTECTED The flash device is read only.
>>> + @retval EFI_UNSUPPORTED The flash device access is unsupported.
>>> + @retval EFI_INVALID_PARAMETER The input parameter is not valid.
>>> +**/
>>> +EFI_STATUS
>>> +EFIAPI
>>> +PerformFlashWrite (
>>> + IN PLATFORM_FIRMWARE_TYPE FirmwareType,
>>> + IN EFI_PHYSICAL_ADDRESS FlashAddress,
>>> + IN FLASH_ADDRESS_TYPE FlashAddressType,
>>> + IN VOID *Buffer,
>>> + IN UINTN Length
>>> + )
>>> +{
>>> + UINT32 RomAddress;
>>> + EFI_STATUS Status;
>>> +
>>> + DEBUG ((DEBUG_INFO, "PerformFlashWrite - 0x%x(%x) - 0x%x\n", (UINTN)FlashAddress, (UINTN)FlashAddressType, Length));
>>> +
>>
>> Line length
>>
>>> + if (FlashAddressType == FlashAddressTypeAbsoluteAddress) {
>>> + FlashAddress = FlashAddress - mInternalFdAddress;
>>> + }
>>> +
>>> + RomAddress = (UINT32)FlashAddress + (mInternalFdAddress - mSFCMEM0BaseAddress);
>>> +
>>> + DEBUG ((DEBUG_INFO, "Erase and Write Flash Start\n"));
>>> +
>>> + Status = mSpiProtocol->EraseWrite (mSpiProtocol, (UINT32) RomAddress, (UINT8 *)Buffer, (UINT32) Length);
>>
>> Line length
>>
>>> + if (EFI_ERROR (Status)) {
>>> + DEBUG ((DEBUG_ERROR, "Erase and Write Status = %r \n", Status));
>>> + }
>>> +
>>> + return Status;
>>> +}
>>> +
>>> +/**
>>> + Platform Flash Access Lib Constructor.
>>> +
>>> + @param[in] ImageHandle The firmware allocated handle for the EFI image.
>>> + @param[in] SystemTable A pointer to the EFI System Table.
>>> +
>>> + @retval EFI_SUCCESS Constructor returns successfully.
>>> +**/
>>> +EFI_STATUS
>>> +EFIAPI
>>> +PerformFlashAccessLibConstructor (
>>> + IN EFI_HANDLE ImageHandle,
>>> + IN EFI_SYSTEM_TABLE *SystemTable
>>> + )
>>> +{
>>> + EFI_STATUS Status;
>>> +
>>> + mInternalFdAddress = (EFI_PHYSICAL_ADDRESS)(UINTN) PcdGet64 (PcdFdBaseAddress);
>>> +
>>> + mSFCMEM0BaseAddress = (EFI_PHYSICAL_ADDRESS)(UINTN) PcdGet64 (PcdSFCMEM0BaseAddress);
>>> +
>>
>> Drop the (UINTN) cast, EFI_PHYSICAL_ADDRESS is always 64 bits.
>>
>>> + DEBUG ((DEBUG_INFO, "PcdFlashAreaBaseAddress - 0x%x, PcdSFCMEM0BaseAddress - 0x%x \n", mInternalFdAddress, mSFCMEM0BaseAddress));
>>> +
>>> + Status = gBS->LocateProtocol (&gHisiSpiFlashProtocolGuid, NULL, (VOID **)&mSpiProtocol);
>>> + if (EFI_ERROR (Status)) {
>>> + DEBUG ((DEBUG_ERROR, "LocateProtocol gHisiSpiFlashProtocolGuid Status = %r \n", Status));
>>> + }
>>> +
>>
>> Line length
>>
>>> + return Status;
>>> +}
>>> diff --git a/Silicon/Hisilicon/Library/PlatformFlashAccessLib/PlatformFlashAccessLibDxe.inf b/Silicon/Hisilicon/Library/PlatformFlashAccessLib/PlatformFlashAccessLibDxe.inf
>>> new file mode 100644
>>> index 0000000..f4533ac
>>> --- /dev/null
>>> +++ b/Silicon/Hisilicon/Library/PlatformFlashAccessLib/PlatformFlashAccessLibDxe.inf
>>> @@ -0,0 +1,51 @@
>>> +## @file
>>> +# Platform Flash Access library.
>>> +#
>>> +# Copyright (c) 2018, Hisilicon Limited. All rights reserved.
>>> +# Copyright (c) 2018, Linaro Limited. All rights reserved.
>>> +# Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
>>> +#
>>> +# 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
>>
>> 0x0000001A
>>
>>> + BASE_NAME = PlatformFlashAccessLibDxe
>>> + FILE_GUID = 9168384A-5F66-4CF7-AEB6-845BDEBD3012
>>
>> Use a fresh GUID
>>
>>> + MODULE_TYPE = DXE_DRIVER
>>> + VERSION_STRING = 1.0
>>> + LIBRARY_CLASS = PlatformFlashAccessLib|DXE_DRIVER
>>> + CONSTRUCTOR = PerformFlashAccessLibConstructor
>>> +
>>> +[Sources]
>>> + PlatformFlashAccessLibDxe.c
>>> +
>>> +[Packages]
>>> + ArmPkg/ArmPkg.dec
>>> + MdeModulePkg/MdeModulePkg.dec
>>> + MdePkg/MdePkg.dec
>>> + SignedCapsulePkg/SignedCapsulePkg.dec
>>> + Silicon/Hisilicon/HisiPkg.dec
>>> +
>>> +[LibraryClasses]
>>> + BaseMemoryLib
>>> + DebugLib
>>> + PcdLib
>>> + UefiBootServicesTableLib
>>> +
>>> +[Protocols]
>>> + gHisiSpiFlashProtocolGuid
>>> +
>>> +[FixedPcd]
>>> + gArmTokenSpaceGuid.PcdFdBaseAddress
>>> + gHisiTokenSpaceGuid.PcdSFCMEM0BaseAddress
>>> +
>>> +[Depex]
>>> + gHisiSpiFlashProtocolGuid
>>> --
>>> 1.9.1
>>>
>>
>> .
>>
>
> --
> Best Regards,
>
> Ming
>
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
next prev parent reply other threads:[~2018-01-23 9:27 UTC|newest]
Thread overview: 72+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-18 15:01 [PATCH edk2-platforms v1 00/14] Improve D0x platforms and bug fix Ming Huang
2018-01-18 15:01 ` [PATCH edk2-platforms v1 01/14] Hisilicon/D05: Add PPTT support Ming Huang
2018-01-20 10:16 ` Ard Biesheuvel
2018-01-22 9:16 ` Huangming (Mark)
2018-01-23 6:00 ` Huangming (Mark)
2018-01-22 13:53 ` Leif Lindholm
2018-01-22 14:15 ` Leif Lindholm
2018-01-24 13:49 ` graeme.gregory
2018-01-23 21:29 ` Jeremy Linton
2018-01-24 7:57 ` Huangming (Mark)
2018-01-25 5:56 ` Huangming (Mark)
2018-01-25 15:27 ` Jeremy Linton
2018-01-18 15:01 ` [PATCH edk2-platforms v1 02/14] Hisilicon D03/D05:Switch to Generic BDS driver Ming Huang
2018-01-20 10:27 ` Ard Biesheuvel
2018-01-22 18:38 ` Leif Lindholm
2018-01-23 6:03 ` Huangming (Mark)
2018-01-18 15:01 ` [PATCH edk2-platforms v1 03/14] Hisilicon D03/D05: Optimize the feature of BMC set boot option Ming Huang
2018-01-20 10:41 ` Ard Biesheuvel
2018-01-23 8:28 ` Huangming (Mark)
2018-01-23 10:28 ` Leif Lindholm
2018-01-23 10:51 ` Huangming (Mark)
2018-01-18 15:01 ` [PATCH edk2-platforms v1 04/14] Hisilicon D03/D05: Add capsule upgrade support Ming Huang
2018-01-20 10:50 ` Ard Biesheuvel
2018-01-23 8:53 ` Huangming (Mark)
2018-01-23 9:33 ` Ard Biesheuvel [this message]
2018-01-24 11:10 ` Huangming (Mark)
2018-01-24 11:21 ` Ard Biesheuvel
2018-01-25 0:53 ` Huangming (Mark)
2018-01-23 14:06 ` Leif Lindholm
2018-01-18 15:01 ` [PATCH edk2-platforms v1 05/14] Hisilicon D03/D05: Open SasPlatform source code Ming Huang
2018-01-20 10:57 ` Ard Biesheuvel
2018-01-23 11:01 ` Huangming (Mark)
2018-01-23 14:04 ` Leif Lindholm
2018-01-18 15:01 ` [PATCH edk2-platforms v1 06/14] Hisilicon D03/D05: Open SnpPlatform " Ming Huang
2018-01-20 11:00 ` Ard Biesheuvel
2018-01-23 11:01 ` Huangming (Mark)
2018-01-23 14:07 ` Leif Lindholm
2018-01-24 12:31 ` Huangming (Mark)
2018-01-24 13:47 ` Leif Lindholm
2018-01-18 15:01 ` [PATCH edk2-platforms v1 07/14] Hisilicon/Smbios: modify type 4 Ming Huang
2018-01-20 11:01 ` Ard Biesheuvel
2018-01-23 14:15 ` Leif Lindholm
2018-01-18 15:01 ` [PATCH edk2-platforms v1 08/14] Hisilicon/PCIe: Disable PCIe ASPM Ming Huang
2018-01-20 11:04 ` Ard Biesheuvel
2018-01-18 15:01 ` [PATCH edk2-platforms v1 09/14] Hisilicon/D05: Replace SP805Watchdog by WatchdogTimer driver Ming Huang
2018-01-20 11:05 ` Ard Biesheuvel
2018-01-23 14:21 ` Leif Lindholm
2018-01-18 15:01 ` [PATCH edk2-platforms v1 10/14] Hisilicon/D03: " Ming Huang
2018-01-20 11:05 ` Ard Biesheuvel
2018-01-23 14:21 ` Leif Lindholm
2018-01-18 15:01 ` [PATCH edk2-platforms v1 11/14] Hisilicon/D05/ACPI: Add ITS PXM Ming Huang
2018-01-20 11:06 ` Ard Biesheuvel
2018-01-18 15:01 ` [PATCH edk2-platforms v1 12/14] Hisilicon/D05/ACPI: Add Pcie, HNS and SAS PXM Ming Huang
2018-01-20 11:08 ` Ard Biesheuvel
2018-01-18 15:01 ` [PATCH edk2-platforms v1 13/14] Hisilicon/Library: Add OsBootLib Ming Huang
2018-01-20 11:11 ` Ard Biesheuvel
2018-01-23 10:23 ` Leif Lindholm
2018-01-27 1:47 ` Huangming (Mark)
2018-01-27 10:37 ` Ard Biesheuvel
2018-01-29 8:55 ` Huangming (Mark)
2018-01-29 10:19 ` Ard Biesheuvel
2018-01-29 11:16 ` Leif Lindholm
2018-02-07 21:16 ` Peter Jones
2018-02-11 6:03 ` Huangming (Mark)
2018-02-26 1:12 ` Guo Heyi
2018-01-18 15:01 ` [PATCH edk2-platforms v1 14/14] Hisilicon D03/D05: Update firmware version to 18.02 Ming Huang
2018-01-20 11:11 ` Ard Biesheuvel
2018-01-23 10:18 ` Leif Lindholm
2018-01-24 1:17 ` Huangming (Mark)
2018-01-24 7:54 ` Leif Lindholm
2018-01-22 13:26 ` [PATCH edk2-platforms v1 00/14] Improve D0x platforms and bug fix Leif Lindholm
2018-01-23 14:24 ` Leif Lindholm
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAKv+Gu_N=a-fA-26OcAn0ifBoap=yQehGN-dE=TSCPAksRdAOA@mail.gmail.com' \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox