diff options
author | Haojian Zhuang <haojian.zhuang@outlook.com> | 2016-08-25 19:08:21 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-25 19:08:21 +0800 |
commit | 39add714c81db607311e0c45d07aace4e992ed28 (patch) | |
tree | dfa58822aa69de21274a83e0592ad3572b6790b6 | |
parent | 8db281ab86a8e1e7087fc7fa44e1156b4036b1a2 (diff) | |
parent | 2a872ce3576cb80e9e78a7c8542f92c358389658 (diff) | |
download | device_linaro_bootloader_OpenPlatformPkg-39add714c81db607311e0c45d07aace4e992ed28.tar.gz device_linaro_bootloader_OpenPlatformPkg-39add714c81db607311e0c45d07aace4e992ed28.tar.bz2 device_linaro_bootloader_OpenPlatformPkg-39add714c81db607311e0c45d07aace4e992ed28.zip |
Merge pull request #34 from hzhuang1/get_sn
hikey: Add 'fastboot getvar serialno' support
-rw-r--r-- | Platforms/Hisilicon/HiKey/HiKeyFastbootDxe/HiKeyFastboot.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Platforms/Hisilicon/HiKey/HiKeyFastbootDxe/HiKeyFastboot.c b/Platforms/Hisilicon/HiKey/HiKeyFastbootDxe/HiKeyFastboot.c index 7dafa19..5fc4117 100644 --- a/Platforms/Hisilicon/HiKey/HiKeyFastbootDxe/HiKeyFastboot.c +++ b/Platforms/Hisilicon/HiKey/HiKeyFastbootDxe/HiKeyFastboot.c @@ -630,11 +630,28 @@ HiKeyFastbootPlatformGetVar ( FASTBOOT_PARTITION_LIST *Entry;
CHAR16 PartitionNameUnicode[60];
BOOLEAN PartitionFound;
+ CHAR16 DataUnicode[17];
+ UINTN VariableSize;
if (!AsciiStrCmp (Name, "max-download-size")) {
AsciiStrCpy (Value, FixedPcdGetPtr (PcdArmFastbootFlashLimit));
} else if (!AsciiStrCmp (Name, "product")) {
AsciiStrCpy (Value, FixedPcdGetPtr (PcdFirmwareVendor));
+ } else if (!AsciiStrCmp (Name, "serialno")) {
+ VariableSize = 17 * sizeof (CHAR16);
+ Status = gRT->GetVariable (
+ (CHAR16 *)L"SerialNo",
+ &gHiKeyVariableGuid,
+ NULL,
+ &VariableSize,
+ &DataUnicode
+ );
+ if (EFI_ERROR (Status)) {
+ *Value = '\0';
+ return EFI_NOT_FOUND;
+ }
+ DataUnicode[(VariableSize / sizeof(CHAR16)) - 1] = '\0';
+ UnicodeStrToAsciiStr (DataUnicode, Value);
} else if ( !AsciiStrnCmp (Name, "partition-size", 14)) {
AsciiStrToUnicodeStr ((Name + 15), PartitionNameUnicode);
PartitionFound = FALSE;
|