Merge "QcomModulePkg: Correct the destination string length"
diff --git a/QcomModulePkg/Library/BootLib/Board.c b/QcomModulePkg/Library/BootLib/Board.c
index bd23263..c354f45 100644
--- a/QcomModulePkg/Library/BootLib/Board.c
+++ b/QcomModulePkg/Library/BootLib/Board.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015-2018, 2020, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2015-2018, 2020-2021, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -456,7 +456,8 @@
ASSERT (0);
}
- if (Revision >= PMIC_VERSION_REVISION) {
+ /* GetPmicInfoExt API is only supported for Protocol Revsion v3 */
+ if (Revision == PMIC_VERSION_REVISION) {
Status = GetPmicInfoExt (PmicDeviceIndex, &pmic_info_ext);
if (Status != EFI_SUCCESS) {
DEBUG ((EFI_D_VERBOSE, "Error finding board pmic info: %r\n", Status));
diff --git a/QcomModulePkg/Library/BootLib/LocateDeviceTree.c b/QcomModulePkg/Library/BootLib/LocateDeviceTree.c
index 7ddb924..cb4ed9b 100644
--- a/QcomModulePkg/Library/BootLib/LocateDeviceTree.c
+++ b/QcomModulePkg/Library/BootLib/LocateDeviceTree.c
@@ -549,7 +549,8 @@
UINT32 Idx;
PmicIdInfo CurPmicInfo;
- memset (BestPmicInfo, 0, sizeof (PmicIdInfo));
+ /* Initialize with NONE_MATCH */
+ BestPmicInfo->DtMatchVal = BIT (NONE_MATCH);
for (PmicEntIdx = 0; PmicEntIdx < PmicEntCount; PmicEntIdx++) {
memset (&CurPmicInfo, 0, sizeof (PmicIdInfo));
for (Idx = 0; Idx < PmicMaxIdx; Idx++) {
@@ -572,8 +573,8 @@
BIT ((PMIC_MATCH_DEFAULT_MODEL_IDX0 + Idx * PMIC_SHIFT_IDX));
} else {
CurPmicInfo.DtMatchVal = BIT (NONE_MATCH);
- DEBUG ((EFI_D_VERBOSE, "Pmic model does not match\n"));
- break;
+ DEBUG ((EFI_D_VERBOSE, "Pmic model does not match Idx(%u)\n", Idx));
+ goto next;
}
/* first match the first four pmic revision */
@@ -588,7 +589,7 @@
Idx * PMIC_SHIFT_IDX));
} else {
DEBUG ((EFI_D_VERBOSE, "Pmic revision does not match\n"));
- break;
+ goto next;
}
}
}
@@ -607,7 +608,7 @@
}
}
}
-
+next:
PmicProp += sizeof (UINT32) * PmicMaxIdx;
}
}
@@ -892,15 +893,20 @@
PmicEntCount = LenPmicId / PmicEntSz;
/* Get the best match pmic */
ReadBestPmicMatch (PmicProp, PmicMaxIdx, PmicEntCount, &BestPmicInfo);
- CurDtbInfo->DtMatchVal |= BestPmicInfo.DtMatchVal;
- for (Idx = 0; Idx < PmicMaxIdx; Idx++) {
- CurDtbInfo->DtPmicModel[Idx] = BestPmicInfo.DtPmicModel[Idx];
- CurDtbInfo->DtPmicRev[Idx] = BestPmicInfo.DtPmicRev[Idx];
- }
+ if (BestPmicInfo.DtMatchVal == BIT (NONE_MATCH)) {
+ CurDtbInfo->DtMatchVal = NONE_MATCH;
+ } else {
+ CurDtbInfo->DtMatchVal |= BestPmicInfo.DtMatchVal;
- DEBUG ((EFI_D_VERBOSE, "CurDtbInfo->DtMatchVal : 0x%llx "
- "BestPmicInfo.DtMatchVal :0x%llx\n", CurDtbInfo->DtMatchVal,
- BestPmicInfo.DtMatchVal));
+ for (Idx = 0; Idx < PmicMaxIdx; Idx++) {
+ CurDtbInfo->DtPmicModel[Idx] = BestPmicInfo.DtPmicModel[Idx];
+ CurDtbInfo->DtPmicRev[Idx] = BestPmicInfo.DtPmicRev[Idx];
+ }
+
+ DEBUG ((EFI_D_VERBOSE, "CurDtbInfo->DtMatchVal : 0x%llx "
+ "BestPmicInfo.DtMatchVal :0x%llx\n", CurDtbInfo->DtMatchVal,
+ BestPmicInfo.DtMatchVal));
+ }
} else {
DEBUG ((EFI_D_VERBOSE, "qcom,pmic-id does not exit\n"));
}