aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaojian Zhuang <haojian.zhuang@linaro.org>2018-03-07 22:05:38 +0800
committerHaojian Zhuang <haojian.zhuang@linaro.org>2018-03-07 22:07:44 +0800
commit43e836468cf761cbc7cf0d0d24cef20c3871243b (patch)
tree5531dfd99ce0f17afe5d536ca76f534f23e84667
parent65685632d801eb4183a3a84b7f3f4054465399a0 (diff)
downloadOpenPlatformPkg-43e836468cf761cbc7cf0d0d24cef20c3871243b.tar.gz
Platforms/HiKey: set specified serialno
Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
-rw-r--r--Platforms/Hisilicon/HiKey/HiKeyFastbootDxe/HiKeyFastbootDxe.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/Platforms/Hisilicon/HiKey/HiKeyFastbootDxe/HiKeyFastbootDxe.c b/Platforms/Hisilicon/HiKey/HiKeyFastbootDxe/HiKeyFastbootDxe.c
index a62c094..ee45b99 100644
--- a/Platforms/Hisilicon/HiKey/HiKeyFastbootDxe/HiKeyFastbootDxe.c
+++ b/Platforms/Hisilicon/HiKey/HiKeyFastbootDxe/HiKeyFastbootDxe.c
@@ -562,15 +562,32 @@ HiKeyFastbootPlatformOemCommand (
{
EFI_STATUS Status;
CHAR16 UnicodeSN[SERIAL_NUMBER_SIZE];
+ UINTN Size;
+ Size = AsciiStrLen ("serialno");
if (AsciiStrCmp (Command, "Demonstrate") == 0) {
DEBUG ((DEBUG_ERROR, "ARM OEM Fastboot command 'Demonstrate' received.\n"));
return EFI_SUCCESS;
- } else if (AsciiStrCmp (Command, "serialno") == 0) {
- Status = GenerateUsbSN (UnicodeSN);
- if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_ERROR, "Failed to generate USB Serial Number.\n"));
- return Status;
+ } else if (AsciiStrnCmp (Command, "serialno", Size) == 0) {
+ while (*(Command + Size) == ' ') {
+ Size++;
+ }
+ if (AsciiStrnCmp (Command + Size, "set", AsciiStrLen ("set")) == 0) {
+ Size += AsciiStrLen ("set");
+ while (*(Command + Size) == ' ') {
+ Size++;
+ }
+ Status = AssignUsbSN (Command + Size, UnicodeSN);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "Failed to set USB Serial Number.\n"));
+ return Status;
+ }
+ } else {
+ Status = GenerateUsbSN (UnicodeSN);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "Failed to generate USB Serial Number.\n"));
+ return Status;
+ }
}
Status = StoreSNToBlock (mFlashHandle, SERIAL_NUMBER_LBA, UnicodeSN);
return Status;