QcomModulePkg: Use the optimized SetMem and CopyMem
Use the optimized gBS->SetMem and gBS->CopyMem instead of the original
SetMem and CopyMem for better performance.
CRs-Fixed: 2046534
Change-Id: I96b818a7d2a590db5aaaad13bf93f482dccdafa1
diff --git a/QcomModulePkg/Library/BootLib/PartitionTableUpdate.c b/QcomModulePkg/Library/BootLib/PartitionTableUpdate.c
index 7fd20a4..b7b33e7 100644
--- a/QcomModulePkg/Library/BootLib/PartitionTableUpdate.c
+++ b/QcomModulePkg/Library/BootLib/PartitionTableUpdate.c
@@ -97,7 +97,7 @@
PartitionCount = 0;
/*Nullify the PtnEntries array before using it*/
- SetMem((VOID*) PtnEntries, (sizeof(PtnEntries[0]) * MAX_NUM_PARTITIONS), 0);
+ gBS->SetMem((VOID*) PtnEntries, (sizeof(PtnEntries[0]) * MAX_NUM_PARTITIONS), 0);
for (i = 0; i < MaxLuns; i++) {
for (j = 0; (j < Ptable[i].MaxHandles) && (Index < MAX_NUM_PARTITIONS); j++, Index++) {
@@ -109,7 +109,7 @@
continue;
}
- CopyMem((&PtnEntries[Index]), PartEntry, sizeof(PartEntry[0]));
+ gBS->CopyMem((&PtnEntries[Index]), PartEntry, sizeof(PartEntry[0]));
PtnEntries[Index].lun = i;
}
}
@@ -229,7 +229,7 @@
return;
}
- SetMem((VOID *) GptHdr, MaxGptPartEntrySzBytes, 0);
+ gBS->SetMem((VOID *) GptHdr, MaxGptPartEntrySzBytes, 0);
GptHdrPtr = GptHdr;
/* This loop iterates twice to update both primary and backup Gpt*/
@@ -271,7 +271,7 @@
if(Attr != PtnEntries[i].PartEntry.Attributes) {
/* Update the partition attributes and partiton GUID values */
PUT_LONG_LONG(&PtnEntriesPtr[ATTRIBUTE_FLAG_OFFSET], PtnEntries[i].PartEntry.Attributes);
- CopyMem((VOID *)PtnEntriesPtr, (VOID *)&PtnEntries[i].PartEntry.PartitionTypeGUID, GUID_SIZE);
+ gBS->CopyMem((VOID *)PtnEntriesPtr, (VOID *)&PtnEntries[i].PartEntry.PartitionTypeGUID, GUID_SIZE);
SkipUpdation = FALSE;
}
@@ -342,9 +342,9 @@
if (p1 == NULL || p2 == NULL)
return;
- CopyMem((VOID *)&Temp, (VOID *)&p1->PartitionTypeGUID, sizeof(EFI_GUID));
- CopyMem((VOID *)&p1->PartitionTypeGUID, (VOID *)&p2->PartitionTypeGUID, sizeof(EFI_GUID));
- CopyMem((VOID *)&p2->PartitionTypeGUID, (VOID *)&Temp, sizeof(EFI_GUID));
+ gBS->CopyMem((VOID *)&Temp, (VOID *)&p1->PartitionTypeGUID, sizeof(EFI_GUID));
+ gBS->CopyMem((VOID *)&p1->PartitionTypeGUID, (VOID *)&p2->PartitionTypeGUID, sizeof(EFI_GUID));
+ gBS->CopyMem((VOID *)&p2->PartitionTypeGUID, (VOID *)&Temp, sizeof(EFI_GUID));
}
STATIC EFI_STATUS GetMultiSlotPartsList() {
@@ -430,8 +430,8 @@
}
/* Swap the guids for the slots */
SwapPtnGuid(&PtnCurrent->PartEntry, &PtnNew->PartEntry);
- SetMem(CurSlot, BOOT_PART_SIZE, 0);
- SetMem(NewSlot, BOOT_PART_SIZE, 0);
+ gBS->SetMem(CurSlot, BOOT_PART_SIZE, 0);
+ gBS->SetMem(NewSlot, BOOT_PART_SIZE, 0);
PtnCurrent = PtnNew = NULL;
}
@@ -471,7 +471,7 @@
gEfiUfsLU7Guid,
};
- SetMem((VOID*) Ptable, (sizeof(struct StoragePartInfo) * MAX_LUNS), 0);
+ gBS->SetMem((VOID*) Ptable, (sizeof(struct StoragePartInfo) * MAX_LUNS), 0);
/* By default look for emmc partitions if not found look for UFS */
Attribs |= BLK_IO_SEL_MATCH_ROOT_DEVICE;
@@ -893,7 +893,7 @@
return FAILURE;
}
FlashingGpt = 0;
- SetMem((VOID *)PrimaryGptHdr, Sz, 0x0);
+ gBS->SetMem((VOID *)PrimaryGptHdr, Sz, 0x0);
DEBUG((EFI_D_ERROR, "Updated Partition Table Successfully\n"));
return SUCCESS;