Hi Leif,
Quick resend of the patchset with minor correction pointed in v3.
The code can be also found in github: https://github.com/MarvellEmbeddedProcessors/edk2-open-platform/commits/opp-...
We will pop the champagne after NonDiscoverable merge, but thank you very much for your help and support getting all Armada 70x0 stuff into the tree.
Best regards, Marcin
Changelog: v3 -> v4
* Change SPI_ID_SIZE to sizeof (UINT32) * Add reviewed-by
v2 -> v3
* Rename header structure to MV_FIRMWARE_IMAGE_HEADER * Add STATIC attribute where possible * Improve flash probe (add comments, use UINT32, SPI_ID_SIZE define and SwapBytes32) * Use CalculateSum32() instead of custom implementation * Improve prints when parsing image path * Sort HiiGuid in Marvell.dec * Improve help in .uni file
v1 -> v2
* Remove executing external shell commands from commandline - now only local files can be burnt to flash * Add MARVELL_SPI_FLASH_PROTOCOL and MARVELL_SPI_MASTER_PROTOCOL usage * In order to be standalone command, enable detecting and configuring SPI flash * Style cleanup and new comments
Jan Dąbroś (2): Applications/FirmwareUpdate: Add 'fupdate' comand to shell Platforms/Marvell: Enable 'fupdate' command on Armada70x0 platform
Applications/FirmwareUpdate/FUpdate.c | 413 ++++++++++++++++++++++++++++++++ Applications/FirmwareUpdate/FUpdate.inf | 75 ++++++ Applications/FirmwareUpdate/FUpdate.uni | Bin 0 -> 5146 bytes Platforms/Marvell/Armada/Armada.dsc.inc | 1 + Platforms/Marvell/Marvell.dec | 1 + 5 files changed, 490 insertions(+) create mode 100644 Applications/FirmwareUpdate/FUpdate.c create mode 100644 Applications/FirmwareUpdate/FUpdate.inf create mode 100644 Applications/FirmwareUpdate/FUpdate.uni
From: Jan Dąbroś jsd@semihalf.com
'fupdate' command performs updating firmware from file placed on local filesystem. It consumes MARVELL_SPI_FLASH_PROTOCOL and MARVELL_SPI_MASTER_PROTOCOL in order to handle SPI transfer of the image. Command also verifies image data correctness before burning to flash.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jan Dabros jsd@semihalf.com Signed-off-by: Marcin Wojtas mw@semihalf.com Reviewed-by: Leif Lindholm leif.lindholm@linaro.org --- Applications/FirmwareUpdate/FUpdate.c | 413 ++++++++++++++++++++++++++++++++ Applications/FirmwareUpdate/FUpdate.inf | 75 ++++++ Applications/FirmwareUpdate/FUpdate.uni | Bin 0 -> 5146 bytes Platforms/Marvell/Marvell.dec | 1 + 4 files changed, 489 insertions(+) create mode 100644 Applications/FirmwareUpdate/FUpdate.c create mode 100644 Applications/FirmwareUpdate/FUpdate.inf create mode 100644 Applications/FirmwareUpdate/FUpdate.uni
diff --git a/Applications/FirmwareUpdate/FUpdate.c b/Applications/FirmwareUpdate/FUpdate.c new file mode 100644 index 0000000..edb6986 --- /dev/null +++ b/Applications/FirmwareUpdate/FUpdate.c @@ -0,0 +1,413 @@ +/******************************************************************************* +Copyright (C) 2016 Marvell International Ltd. + +Marvell BSD License Option + +If you received this File from Marvell, you may opt to use, redistribute and/or +modify this File under the following licensing terms. +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +* Neither the name of Marvell nor the names of its contributors may be + used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +*******************************************************************************/ +#include <ShellBase.h> +#include <Uefi.h> + +#include <Library/BaseLib.h> +#include <Library/BaseMemoryLib.h> +#include <Library/DebugLib.h> +#include <Library/FileHandleLib.h> +#include <Library/HiiLib.h> +#include <Library/MemoryAllocationLib.h> +#include <Library/PrintLib.h> +#include <Library/ShellCEntryLib.h> +#include <Library/ShellCommandLib.h> +#include <Library/ShellLib.h> +#include <Library/UefiBootServicesTableLib.h> +#include <Library/UefiLib.h> + +#include <Protocol/Spi.h> +#include <Protocol/SpiFlash.h> + +#define CMD_NAME_STRING L"fupdate" + +#define MAIN_HDR_MAGIC 0xB105B002 + +STATIC MARVELL_SPI_FLASH_PROTOCOL *SpiFlashProtocol; +STATIC MARVELL_SPI_MASTER_PROTOCOL *SpiMasterProtocol; + +STATIC CONST CHAR16 gShellFUpdateFileName[] = L"ShellCommands"; +STATIC EFI_HANDLE gShellFUpdateHiiHandle = NULL; + +STATIC CONST SHELL_PARAM_ITEM ParamList[] = { + {L"help", TypeFlag}, + {NULL , TypeMax} + }; + +typedef struct { // Bytes + UINT32 Magic; // 0-3 + UINT32 PrologSize; // 4-7 + UINT32 PrologChecksum; // 8-11 + UINT32 BootImageSize; // 12-15 + UINT32 BootImageChecksum; // 16-19 + UINT32 Reserved0; // 20-23 + UINT32 LoadAddr; // 24-27 + UINT32 ExecAddr; // 28-31 + UINT8 UartConfig; // 32 + UINT8 Baudrate; // 33 + UINT8 ExtCount; // 34 + UINT8 AuxFlags; // 35 + UINT32 IoArg0; // 36-39 + UINT32 IoArg1; // 40-43 + UINT32 IoArg2; // 43-47 + UINT32 IoArg3; // 48-51 + UINT32 Reserved1; // 52-55 + UINT32 Reserved2; // 56-59 + UINT32 Reserved3; // 60-63 +} MV_FIRMWARE_IMAGE_HEADER; + +STATIC +EFI_STATUS +SpiFlashProbe ( + IN SPI_DEVICE *Slave + ) +{ + EFI_STATUS Status; + UINT32 IdBuffer, Id, RefId; + + Id = PcdGet32 (PcdSpiFlashId); + + IdBuffer = CMD_READ_ID & 0xff; + + // Read SPI flash ID + SpiFlashProtocol->ReadId (Slave, sizeof (UINT32), (UINT8 *)&IdBuffer); + + // Swap and extract 3 bytes of the ID + RefId = SwapBytes32 (IdBuffer) >> 8; + + if (RefId == 0) { + Print (L"%s: No SPI flash detected"); + return EFI_DEVICE_ERROR; + } else if (RefId != Id) { + Print (L"%s: Unsupported SPI flash detected with ID=%2x\n", CMD_NAME_STRING, RefId); + return EFI_DEVICE_ERROR; + } + + Print (L"%s: Detected supported SPI flash with ID=%3x\n", CMD_NAME_STRING, RefId); + + Status = SpiFlashProtocol->Init (SpiFlashProtocol, Slave); + if (EFI_ERROR(Status)) { + Print (L"%s: Cannot initialize flash device\n", CMD_NAME_STRING); + return EFI_DEVICE_ERROR; + } + + return EFI_SUCCESS; +} + +STATIC +EFI_STATUS +CheckImageHeader ( + IN OUT UINTN *ImageHeader + ) +{ + MV_FIRMWARE_IMAGE_HEADER *Header; + UINT32 HeaderLength, Checksum, ChecksumBackup; + + Header = (MV_FIRMWARE_IMAGE_HEADER *)ImageHeader; + HeaderLength = Header->PrologSize; + ChecksumBackup = Header->PrologChecksum; + + // Compare magic number + if (Header->Magic != MAIN_HDR_MAGIC) { + Print (L"%s: Bad Image magic 0x%08x != 0x%08x\n", CMD_NAME_STRING, Header->Magic, MAIN_HDR_MAGIC); + return EFI_DEVICE_ERROR; + } + + // The checksum field is discarded from calculation + Header->PrologChecksum = 0; + + Checksum = CalculateSum32 ((UINT32 *)Header, HeaderLength); + if (Checksum != ChecksumBackup) { + Print (L"%s: Bad Image checksum. 0x%x != 0x%x\n", CMD_NAME_STRING, Checksum, ChecksumBackup); + return EFI_DEVICE_ERROR; + } + + // Restore checksum backup + Header->PrologChecksum = ChecksumBackup; + + return 0; +} + +STATIC +EFI_STATUS +PrepareFirmwareImage ( + IN LIST_ENTRY *CheckPackage, + IN OUT SHELL_FILE_HANDLE *FileHandle, + IN OUT UINTN **FileBuffer, + IN OUT UINTN *FileSize + ) +{ + CONST CHAR16 *FileStr; + EFI_STATUS Status; + UINT64 OpenMode; + UINTN *Buffer; + + // Parse string from commandline + FileStr = ShellCommandLineGetRawValue (CheckPackage, 1); + if (FileStr == NULL) { + Print (L"%s: No image specified\n", CMD_NAME_STRING); + return EFI_INVALID_PARAMETER; + } else { + Status = ShellIsFile (FileStr); + if (EFI_ERROR(Status)) { + Print (L"%s: File not found\n", CMD_NAME_STRING); + return EFI_INVALID_PARAMETER; + } + } + + // Obtain file size + OpenMode = EFI_FILE_MODE_READ; + + Status = ShellOpenFileByName (FileStr, FileHandle, OpenMode, 0); + if (EFI_ERROR (Status)) { + Print (L"%s: Cannot open Image file\n", CMD_NAME_STRING); + return EFI_DEVICE_ERROR; + } + + Status = FileHandleGetSize (*FileHandle, FileSize); + if (EFI_ERROR (Status)) { + Print (L"%s: Cannot get Image file size\n", CMD_NAME_STRING); + } + + // Read Image header into buffer + Buffer = AllocateZeroPool (*FileSize); + + Status = FileHandleRead (*FileHandle, FileSize, Buffer); + if (EFI_ERROR (Status)) { + Print (L"%s: Cannot read Image file header\n", CMD_NAME_STRING); + ShellCloseFile (FileHandle); + FreePool (Buffer); + return EFI_DEVICE_ERROR; + } + + *FileBuffer = Buffer; + + return EFI_SUCCESS; +} + +/** + Return the file name of the help text file if not using HII. + + @return The string pointer to the file name. +**/ +STATIC +CONST CHAR16* +EFIAPI +ShellCommandGetManFileNameFUpdate ( + VOID + ) +{ + return gShellFUpdateFileName; +} + +STATIC +VOID +FUpdateUsage ( + VOID + ) +{ + Print (L"\nFirmware update command\n" + "fupdate <LocalFilePath>\n\n" + "LocalFilePath - path to local firmware image file\n" + "Example:\n" + "Update firmware from file fs2:flash-image.bin\n" + " fupdate fs2:flash-image.bin\n" + ); +} + +STATIC +SHELL_STATUS +EFIAPI +ShellCommandRunFUpdate ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + IN SHELL_FILE_HANDLE FileHandle; + SPI_DEVICE *Slave; + UINTN FileSize; + UINTN *FileBuffer = NULL; + CHAR16 *ProblemParam; + LIST_ENTRY *CheckPackage; + EFI_STATUS Status; + + // Locate SPI protocols + Status = gBS->LocateProtocol ( + &gMarvellSpiFlashProtocolGuid, + NULL, + (VOID **)&SpiFlashProtocol + ); + + if (EFI_ERROR(Status)) { + Print (L"%s: Cannot locate SpiFlash protocol\n", CMD_NAME_STRING); + return SHELL_ABORTED; + } + + Status = gBS->LocateProtocol ( + &gMarvellSpiMasterProtocolGuid, + NULL, + (VOID **)&SpiMasterProtocol + ); + + if (EFI_ERROR(Status)) { + Print (L"%s: Cannot locate SpiMaster protocol\n", CMD_NAME_STRING); + return SHELL_ABORTED; + } + + // Parse command line + Status = ShellInitialize (); + if (EFI_ERROR (Status)) { + Print (L"%s: Error while initializing Shell\n", CMD_NAME_STRING); + ASSERT_EFI_ERROR (Status); + return SHELL_ABORTED; + } + + Status = ShellCommandLineParse (ParamList, &CheckPackage, &ProblemParam, TRUE); + if (EFI_ERROR (Status)) { + Print (L"%s: Invalid parameter\n", CMD_NAME_STRING); + return SHELL_ABORTED; + } + + if (ShellCommandLineGetFlag (CheckPackage, L"help")) { + FUpdateUsage(); + return EFI_SUCCESS; + } + + // Prepare local file to be burned into flash + Status = PrepareFirmwareImage (CheckPackage, &FileHandle, &FileBuffer, &FileSize); + if (EFI_ERROR(Status)) { + return SHELL_ABORTED; + } + + // Check image checksum and magic + Status = CheckImageHeader (FileBuffer); + if (EFI_ERROR(Status)) { + goto HeaderError; + } + + // Setup and probe SPI flash + Slave = SpiMasterProtocol->SetupDevice (SpiMasterProtocol, 0, 0); + if (Slave == NULL) { + Print(L"%s: Cannot allocate SPI device!\n", CMD_NAME_STRING); + goto HeaderError; + } + + Status = SpiFlashProbe (Slave); + if (EFI_ERROR(Status)) { + Print (L"%s: Error while performing SPI flash probe\n", CMD_NAME_STRING); + goto FlashProbeError; + } + + // Update firmware image in flash at offset 0x0 + Status = SpiFlashProtocol->Update (Slave, 0, FileSize, (UINT8 *)FileBuffer); + + // Release resources + SpiMasterProtocol->FreeDevice(Slave); + FreePool (FileBuffer); + ShellCloseFile (&FileHandle); + + if (EFI_ERROR(Status)) { + Print (L"%s: Error while performing flash update\n", CMD_NAME_STRING); + return SHELL_ABORTED; + } + + Print (L"%s: Update %d bytes at offset 0x0 succeeded!\n", CMD_NAME_STRING, FileSize); + + return EFI_SUCCESS; + +FlashProbeError: + SpiMasterProtocol->FreeDevice(Slave); +HeaderError: + FreePool (FileBuffer); + ShellCloseFile (&FileHandle); + + return SHELL_ABORTED; +} + +EFI_STATUS +EFIAPI +ShellFUpdateCommandConstructor ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + + gShellFUpdateHiiHandle = NULL; + + gShellFUpdateHiiHandle = HiiAddPackages ( + &gShellFUpdateHiiGuid, + gImageHandle, + UefiShellFUpdateCommandLibStrings, + NULL + ); + + if (gShellFUpdateHiiHandle == NULL) { + Print (L"%s: Cannot add Hii package\n", CMD_NAME_STRING); + return EFI_DEVICE_ERROR; + } + + Status = ShellCommandRegisterCommandName ( + CMD_NAME_STRING, + ShellCommandRunFUpdate, + ShellCommandGetManFileNameFUpdate, + 0, + CMD_NAME_STRING, + TRUE, + gShellFUpdateHiiHandle, + STRING_TOKEN (STR_GET_HELP_FUPDATE) + ); + + if (EFI_ERROR(Status)) { + Print (L"%s: Error while registering command\n", CMD_NAME_STRING); + return SHELL_ABORTED; + } + + return EFI_SUCCESS; +} + +EFI_STATUS +EFIAPI +ShellFUpdateCommandDestructor ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + + if (gShellFUpdateHiiHandle != NULL) { + HiiRemovePackages (gShellFUpdateHiiHandle); + } + + return EFI_SUCCESS; +} diff --git a/Applications/FirmwareUpdate/FUpdate.inf b/Applications/FirmwareUpdate/FUpdate.inf new file mode 100644 index 0000000..4d4b97e --- /dev/null +++ b/Applications/FirmwareUpdate/FUpdate.inf @@ -0,0 +1,75 @@ +# +# Marvell BSD License Option +# +# If you received this File from Marvell, you may opt to use, redistribute +# and/or modify this File under the following licensing terms. +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Marvell nor the names of its contributors may be +# used to endorse or promote products derived from this software without +# specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# + +[Defines] + INF_VERSION = 0x00010019 + BASE_NAME = UefiShellFUpdateCommandLib + FILE_GUID = 470292b2-926b-4ed8-8080-be7a260db627 + MODULE_TYPE = UEFI_APPLICATION + VERSION_STRING = 0.1 + LIBRARY_CLASS = NULL|UEFI_APPLICATION UEFI_DRIVER + CONSTRUCTOR = ShellFUpdateCommandConstructor + DESTRUCTOR = ShellFUpdateCommandDestructor + +[Sources] + FUpdate.c + FUpdate.uni + +[Packages] + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + OpenPlatformPkg/Platforms/Marvell/Marvell.dec + ShellPkg/ShellPkg.dec + +[LibraryClasses] + BaseLib + BaseMemoryLib + DebugLib + FileHandleLib + HiiLib + MemoryAllocationLib + PcdLib + ShellCommandLib + ShellLib + UefiBootServicesTableLib + UefiLib + UefiLib + UefiRuntimeServicesTableLib + +[Pcd] + gMarvellTokenSpaceGuid.PcdSpiFlashId + +[Protocols] + gMarvellSpiFlashProtocolGuid + gMarvellSpiMasterProtocolGuid + +[Guids] + gShellFUpdateHiiGuid diff --git a/Applications/FirmwareUpdate/FUpdate.uni b/Applications/FirmwareUpdate/FUpdate.uni new file mode 100644 index 0000000000000000000000000000000000000000..9d52e590c6d239621d226a240a3f9755210f52fe GIT binary patch literal 5146 zcmd6r+fN%;5XR@ZQvZh)c}b%HX&?GPFOo4PK{A+nZD^!ODA<@-!Zx){5&wMK?{|h_ zFE$rNsuWrFo;^Ef=9_OW=dAzzXWQO<)1U9{J8Rm^uI<j|HnvOqVoS^HwPt_N^(T90 zKibb49olC}{B0L@rB7xDHkIUs=B9eG)Y@4Z@vN=;p=}x3`PSF&T5fwuZfpbTnA$?W znRSFCG{xEj8|lfNwBP7DmmDj`3CU11OCcU>eP;W*UL`#v$<1t{xvJ&2nh8x4p}x~S zzT@#yqf9nHf*h8HN%K<Uv7PG~{$^S?)st<>&y#l(jgTBAee3Ytq!n=Gc+oP_Dwv$v zt=3M(e5SjCkC=0gC&J}?cGu!^_5)k^ktNNU*23OAF;~c(r>8^}9>6mfXN%-LnD7LC zKppq!fvv)45Et=(n;1bSK3?k=o#?_3;&rW=nW8t=ozGwg4Nr43&?<OGmwQXh!_q{$ zmbUYdahaZ#KW}vR6m#gBrA(`Gg;j9kF}VRsd|S#g5h^f$R)*jgvaG6C)KqgICwrZx zGQJoW*+VY4J;(K!|8P>ESeI3v#RFv*m|<#Os?D$**OxHmp0CfJI#V9+q1eOo0_oFy zQT>6ae66zR+PwPzU%sM}h|fjJvNEa|4;ABqJcVPrV^J4Tb>20|HP=LK(TTju#~NKJ z>g%c`DzIR1wL5uT6n!^v#g*6|37gk;wI9*N!5wu_?VOqX@lN2lxp(=Za?r}1XKJ}? zvXUp!bI+gP&^xf_G#wcx;S~*z4$eHQ=tAC;%UR|qs9O3q6^XWDPbg}PS|3Tnt$gv0 z6)bz7dn^kVsk05FeWdT;9uMq$uf(o*JUT?t1sC$69;2Rp&|aELF4z9IZ#_G;hI&;? zGd_Q;yN;dcZcnp&n%}jL`eh|jO+7u<Oji=`HP_SJ2hFvUd^hQCDDJF8_DB-Q?pj}? zj>cHukX5eO+|bomzyKrcwd_yX0a>0TS&96iX4|?tHb>u0t9ofRPdmziv@|8x7Y@en z)2w44D?14{dJgsN-D?9MyK(qhwFbI%_BcuGYt^B&bY=C!J(`AmK1f)5$)jLpKUq9_ z@N7S^0tcCVBN}+p6!vzyW45o^W69-Og(SRy2k-LaX+t9r?5W$r(~*Ah6DCjeB@RR# zbZvbKFV{u1BTqpH=g$1&vD}p$r?3NQ-qn>m_o*CDkb=4?9B>T6b#qNUA@jfsQe<=a z&Ppu!4B64T&jr}{nB>YxVd@X@=9+wECe014YA7GbEAYKeNWMN-yk3YF-Vp(3+H)e; zJm*g$+S8a!%VfQy&z|OkUC?$@)ipKB?U#hDEvd+UGOVw=R`L`-;0JcxYscZa#rl{h z=kw%aR1(aCqpMF}%z}+N<pfS8pXwPIL+qQf;Z~{V$Y7+)vGsZZ2bJrdM?Mr40M=7k zXvreKUeDxdkz0+2{D3q12KiECS5=#P?p>w#Xf&yVmN*9yai=p71z$}ka5SfS4!`g~ zPI2eGBkC!76J5YPC8FVRbPeaLJc}mys`p$NiR#1#F>WX?=)NF<b7wPjdk+9twYL=6 zM*peid9g!(+i!>4i6eO0w%_d4!`-WNmgJp<U6%JVKJ3(+DL2_oxVubmGz*=XHcD$b z)v`nSJCA48S;~W+ou$aPRRd?@o?7s_B0E+;1&$l-;Fq#lN8xri)Pac?r+^#n$3sc` zx#6AWHe_imM3d4vpkI;VL^DaJ7tSJETJcHppX5QIpFU1r)6H5d&#U@4HB{}zxr1{i zrzH0UIo@cuR`hKt8?l!w>)BI|H6lanxU!X*Is?C|3OTiM@`MNM9VdRi*zYT=!!8!1 zOTEM@v3uN3M0QhBVViR<=Re+%9UalD^R|wy=Q#*3*t3Wi=NEeM^DFBsc2?Fr7wO_0 z8qvkCh5l*T(Uo^J>SeQ(2U~ixq*_+dt>*KlbbPJ8V1-?iow2LTIuSpd*<Qv@d1Y2v zyUG(WCx=_o-&VD=FE`UZ;QMRjME%-JZ(zJn4U{2%n&$rrc=LCUiE5WDj(;5d3FrI2 xRQ(r{^CzoSRma5Xi9IP!qb*e}|6a^x=~g)6|0aL?;QiK5_}<y7U85Sk{{SUV_8R~I
literal 0 HcmV?d00001
diff --git a/Platforms/Marvell/Marvell.dec b/Platforms/Marvell/Marvell.dec index f1d2def..313eaa6 100644 --- a/Platforms/Marvell/Marvell.dec +++ b/Platforms/Marvell/Marvell.dec @@ -53,6 +53,7 @@ gMarvellTokenSpaceGuid = { 0xf995c6c8, 0xbc9b, 0x4e93, { 0xbd, 0xcf, 0x49, 0x90, 0xc6, 0xe7, 0x8c, 0x7f } }
gShellEepromHiiGuid = { 0xb2f4c714, 0x147f, 0x4ff7, { 0x82, 0x1b, 0xce, 0x7b, 0x91, 0x7f, 0x5f, 0x2f } } + gShellFUpdateHiiGuid = { 0x9b5d2176, 0x590a, 0x49db, { 0x89, 0x5d, 0x4a, 0x70, 0xfe, 0xad, 0xbe, 0x24 } } gShellSfHiiGuid = { 0x03a67756, 0x8cde, 0x4638, { 0x82, 0x34, 0x4a, 0x0f, 0x6d, 0x58, 0x81, 0x39 } }
[PcdsFixedAtBuild.common]
From: Jan Dąbroś jsd@semihalf.com
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jan Dabros jsd@semihalf.com Signed-off-by: Marcin Wojtas mw@semihalf.com Reviewed-by: Leif Lindholm leif.lindholm@linaro.org --- Platforms/Marvell/Armada/Armada.dsc.inc | 1 + 1 file changed, 1 insertion(+)
diff --git a/Platforms/Marvell/Armada/Armada.dsc.inc b/Platforms/Marvell/Armada/Armada.dsc.inc index 74d0645..e47f886 100644 --- a/Platforms/Marvell/Armada/Armada.dsc.inc +++ b/Platforms/Marvell/Armada/Armada.dsc.inc @@ -481,6 +481,7 @@ NULL|ShellPkg/Library/UefiShellTftpCommandLib/UefiShellTftpCommandLib.inf NULL|OpenPlatformPkg/Applications/EepromCmd/EepromCmd.inf NULL|OpenPlatformPkg/Applications/SpiTool/SpiFlashCmd.inf + NULL|OpenPlatformPkg/Applications/FirmwareUpdate/FUpdate.inf HandleParsingLib|ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf BcfgCommandLib|ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.inf
On Wed, Nov 30, 2016 at 11:46:39PM +0100, Marcin Wojtas wrote:
Hi Leif,
Quick resend of the patchset with minor correction pointed in v3.
The code can be also found in github: https://github.com/MarvellEmbeddedProcessors/edk2-open-platform/commits/opp-...
We will pop the champagne after NonDiscoverable merge, but thank you very much for your help and support getting all Armada 70x0 stuff into the tree.
Thanks for your efforts.
I've pushed a branch called armada-70x0 to https://git.linaro.org/uefi/OpenPlatformPkg.git for now, which I'll merge to master once the required NonDiscoverable patches appear in EDK2.
Regards,
Leif
p.s. I've applied on newline fix in "Enable PciEmulation driver for Armada70x0 platform".
Best regards, Marcin
Changelog: v3 -> v4
- Change SPI_ID_SIZE to sizeof (UINT32)
- Add reviewed-by
v2 -> v3
- Rename header structure to MV_FIRMWARE_IMAGE_HEADER
- Add STATIC attribute where possible
- Improve flash probe (add comments, use UINT32, SPI_ID_SIZE define and SwapBytes32)
- Use CalculateSum32() instead of custom implementation
- Improve prints when parsing image path
- Sort HiiGuid in Marvell.dec
- Improve help in .uni file
v1 -> v2
- Remove executing external shell commands from commandline - now only local files can be burnt to flash
- Add MARVELL_SPI_FLASH_PROTOCOL and MARVELL_SPI_MASTER_PROTOCOL usage
- In order to be standalone command, enable detecting and configuring SPI flash
- Style cleanup and new comments
Jan Dąbroś (2): Applications/FirmwareUpdate: Add 'fupdate' comand to shell Platforms/Marvell: Enable 'fupdate' command on Armada70x0 platform
Applications/FirmwareUpdate/FUpdate.c | 413 ++++++++++++++++++++++++++++++++ Applications/FirmwareUpdate/FUpdate.inf | 75 ++++++ Applications/FirmwareUpdate/FUpdate.uni | Bin 0 -> 5146 bytes Platforms/Marvell/Armada/Armada.dsc.inc | 1 + Platforms/Marvell/Marvell.dec | 1 + 5 files changed, 490 insertions(+) create mode 100644 Applications/FirmwareUpdate/FUpdate.c create mode 100644 Applications/FirmwareUpdate/FUpdate.inf create mode 100644 Applications/FirmwareUpdate/FUpdate.uni
-- 1.8.3.1
Hi Leif,
2016-12-01 14:08 GMT+01:00 Leif Lindholm leif.lindholm@linaro.org:
On Wed, Nov 30, 2016 at 11:46:39PM +0100, Marcin Wojtas wrote:
Hi Leif,
Quick resend of the patchset with minor correction pointed in v3.
The code can be also found in github: https://github.com/MarvellEmbeddedProcessors/edk2-open-platform/commits/opp-...
We will pop the champagne after NonDiscoverable merge, but thank you very much for your help and support getting all Armada 70x0 stuff into the tree.
Thanks for your efforts.
I've pushed a branch called armada-70x0 to https://git.linaro.org/uefi/OpenPlatformPkg.git for now, which I'll merge to master once the required NonDiscoverable patches appear in EDK2.
Regards,
Leif
p.s. I've applied on newline fix in "Enable PciEmulation driver for Armada70x0 platform".
Thanks a lot for the information.
Best regards, Marcin
On Wed, Nov 30, 2016 at 11:46:39PM +0100, Marcin Wojtas wrote:
Hi Leif,
Quick resend of the patchset with minor correction pointed in v3.
The code can be also found in github: https://github.com/MarvellEmbeddedProcessors/edk2-open-platform/commits/opp-...
We will pop the champagne after NonDiscoverable merge, but thank you very much for your help and support getting all Armada 70x0 stuff into the tree.
Ard has pushed the required NonDiscoverable patches to EDK2, so I have now pushed this support to OpenPlatformPkg master.
Pop ahead.
Regards,
Leif
Best regards, Marcin
Changelog: v3 -> v4
- Change SPI_ID_SIZE to sizeof (UINT32)
- Add reviewed-by
v2 -> v3
- Rename header structure to MV_FIRMWARE_IMAGE_HEADER
- Add STATIC attribute where possible
- Improve flash probe (add comments, use UINT32, SPI_ID_SIZE define and SwapBytes32)
- Use CalculateSum32() instead of custom implementation
- Improve prints when parsing image path
- Sort HiiGuid in Marvell.dec
- Improve help in .uni file
v1 -> v2
- Remove executing external shell commands from commandline - now only local files can be burnt to flash
- Add MARVELL_SPI_FLASH_PROTOCOL and MARVELL_SPI_MASTER_PROTOCOL usage
- In order to be standalone command, enable detecting and configuring SPI flash
- Style cleanup and new comments
Jan Dąbroś (2): Applications/FirmwareUpdate: Add 'fupdate' comand to shell Platforms/Marvell: Enable 'fupdate' command on Armada70x0 platform
Applications/FirmwareUpdate/FUpdate.c | 413 ++++++++++++++++++++++++++++++++ Applications/FirmwareUpdate/FUpdate.inf | 75 ++++++ Applications/FirmwareUpdate/FUpdate.uni | Bin 0 -> 5146 bytes Platforms/Marvell/Armada/Armada.dsc.inc | 1 + Platforms/Marvell/Marvell.dec | 1 + 5 files changed, 490 insertions(+) create mode 100644 Applications/FirmwareUpdate/FUpdate.c create mode 100644 Applications/FirmwareUpdate/FUpdate.inf create mode 100644 Applications/FirmwareUpdate/FUpdate.uni
-- 1.8.3.1
Hi Leif,
Thanks a lot, everything works fine on tianocore and linaro master branches!
Best regards, Marcin
2016-12-07 11:59 GMT+01:00 Leif Lindholm leif.lindholm@linaro.org:
On Wed, Nov 30, 2016 at 11:46:39PM +0100, Marcin Wojtas wrote:
Hi Leif,
Quick resend of the patchset with minor correction pointed in v3.
The code can be also found in github: https://github.com/MarvellEmbeddedProcessors/edk2-open-platform/commits/opp-...
We will pop the champagne after NonDiscoverable merge, but thank you very much for your help and support getting all Armada 70x0 stuff into the tree.
Ard has pushed the required NonDiscoverable patches to EDK2, so I have now pushed this support to OpenPlatformPkg master.
Pop ahead.
Regards,
Leif
Best regards, Marcin
Changelog: v3 -> v4
- Change SPI_ID_SIZE to sizeof (UINT32)
- Add reviewed-by
v2 -> v3
- Rename header structure to MV_FIRMWARE_IMAGE_HEADER
- Add STATIC attribute where possible
- Improve flash probe (add comments, use UINT32, SPI_ID_SIZE define and SwapBytes32)
- Use CalculateSum32() instead of custom implementation
- Improve prints when parsing image path
- Sort HiiGuid in Marvell.dec
- Improve help in .uni file
v1 -> v2
- Remove executing external shell commands from commandline - now only local files can be burnt to flash
- Add MARVELL_SPI_FLASH_PROTOCOL and MARVELL_SPI_MASTER_PROTOCOL usage
- In order to be standalone command, enable detecting and configuring SPI flash
- Style cleanup and new comments
Jan Dąbroś (2): Applications/FirmwareUpdate: Add 'fupdate' comand to shell Platforms/Marvell: Enable 'fupdate' command on Armada70x0 platform
Applications/FirmwareUpdate/FUpdate.c | 413 ++++++++++++++++++++++++++++++++ Applications/FirmwareUpdate/FUpdate.inf | 75 ++++++ Applications/FirmwareUpdate/FUpdate.uni | Bin 0 -> 5146 bytes Platforms/Marvell/Armada/Armada.dsc.inc | 1 + Platforms/Marvell/Marvell.dec | 1 + 5 files changed, 490 insertions(+) create mode 100644 Applications/FirmwareUpdate/FUpdate.c create mode 100644 Applications/FirmwareUpdate/FUpdate.inf create mode 100644 Applications/FirmwareUpdate/FUpdate.uni
-- 1.8.3.1