Improve MemoryTacker. Use gBS->FreePool() instead of FreePool for
firmware allocated memory.
This commit is contained in:
parent
8b2d5934fd
commit
38564b2870
|
@ -1 +1 @@
|
|||
Subproject commit 0fcc050a44f6fa06788b349e65b4e10fcdabde67
|
||||
Subproject commit 8270a6fb81b95abf957d2b7acd945fcc039ffde6
|
|
@ -390,15 +390,10 @@ EFI_STATUS ScanDeviceHandles(EFI_HANDLE ControllerHandle,
|
|||
}
|
||||
}
|
||||
|
||||
//MsgLog("ScanDeviceHandles FreePool(OpenInfo)\n");
|
||||
FreePool(OpenInfo);
|
||||
//MsgLog("ScanDeviceHandles FreePool(OpenInfo) after\n");
|
||||
gBS->FreePool(OpenInfo); // use gBS->FreePool instead of FreePool to avoid message from MemoryTracker
|
||||
}
|
||||
}
|
||||
//MsgLog("ScanDeviceHandles FreePool(ProtocolGuidArray)\n");
|
||||
|
||||
FreePool(ProtocolGuidArray);
|
||||
//MsgLog("ScanDeviceHandles FreePool(ProtocolGuidArray) after\n");
|
||||
gBS->FreePool(ProtocolGuidArray); // use gBS->FreePool instead of FreePool to avoid message from MemoryTracker
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -410,7 +405,7 @@ Error:
|
|||
}
|
||||
|
||||
if (*HandleBuffer != NULL) {
|
||||
FreePool(*HandleBuffer);
|
||||
gBS->FreePool(*HandleBuffer); // use gBS->FreePool instead of FreePool to avoid message from MemoryTracker
|
||||
}
|
||||
|
||||
*HandleCount = 0;
|
||||
|
@ -477,12 +472,12 @@ EFI_STATUS BdsLibConnectMostlyAllEfi()
|
|||
}
|
||||
}
|
||||
|
||||
FreePool(HandleBuffer);
|
||||
gBS->FreePool(HandleBuffer); // use gBS->FreePool instead of FreePool to avoid message from MemoryTracker
|
||||
FreePool(HandleType);
|
||||
}
|
||||
|
||||
Done:
|
||||
FreePool(AllHandleBuffer);
|
||||
gBS->FreePool(AllHandleBuffer); // use gBS->FreePool instead of FreePool to avoid message from MemoryTracker
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
|
|
@ -501,7 +501,6 @@ AddSMCkey(SMC_KEY Key, SMC_DATA_SIZE Size, SMC_KEY_TYPE Type, SMC_DATA *Data)
|
|||
{
|
||||
if (gAppleSmc && (gAppleSmc->Signature == NON_APPLE_SMC_SIGNATURE))
|
||||
{
|
||||
MemoryStopRecord msr; // Do not record allocation made by SmcAddKey
|
||||
gAppleSmc->SmcAddKey(gAppleSmc, Key, Size, Type, 0xC0);
|
||||
gAppleSmc->SmcWriteValue(gAppleSmc, Key, Size, Data);
|
||||
}
|
||||
|
|
|
@ -558,24 +558,21 @@ GetSmcKeys (XBool WriteToSMC)
|
|||
NKey[2] = (NumKey >> 8) & 0xFF; //key, size, type, attr
|
||||
DBG("Registered %lld SMC keys\n", NumKey);
|
||||
|
||||
{
|
||||
MemoryStopRecord msr;
|
||||
Status = gAppleSmc->SmcAddKey(gAppleSmc, FourCharKey("#KEY"), 4, SmcKeyTypeUint32, 0xC0);
|
||||
if (!EFI_ERROR(Status)) {
|
||||
Status = gAppleSmc->SmcWriteValue(gAppleSmc, FourCharKey("#KEY"), 4, (SMC_DATA *)&NKey);
|
||||
}
|
||||
Status = gAppleSmc->SmcAddKey(gAppleSmc, FourCharKey("$Adr"), 4, SmcKeyTypeUint32, 0x08);
|
||||
if (!EFI_ERROR(Status)) {
|
||||
Status = gAppleSmc->SmcWriteValue(gAppleSmc, FourCharKey("$Adr"), 4, (SMC_DATA *)&SAdr);
|
||||
}
|
||||
Status = gAppleSmc->SmcAddKey(gAppleSmc, FourCharKey("$Num"), 1, SmcKeyTypeUint8, 0x08);
|
||||
if (!EFI_ERROR(Status)) {
|
||||
Status = gAppleSmc->SmcWriteValue(gAppleSmc, FourCharKey("$Num"), 1, (SMC_DATA *)&SNum);
|
||||
}
|
||||
Status = gAppleSmc->SmcAddKey(gAppleSmc, FourCharKey("RMde"), 1, SmcKeyTypeChar, 0xC0);
|
||||
if (!EFI_ERROR(Status)) {
|
||||
Status = gAppleSmc->SmcWriteValue(gAppleSmc, FourCharKey("RMde"), 1, (SMC_DATA *)&Mode);
|
||||
}
|
||||
Status = gAppleSmc->SmcAddKey(gAppleSmc, FourCharKey("#KEY"), 4, SmcKeyTypeUint32, 0xC0);
|
||||
if (!EFI_ERROR(Status)) {
|
||||
Status = gAppleSmc->SmcWriteValue(gAppleSmc, FourCharKey("#KEY"), 4, (SMC_DATA *)&NKey);
|
||||
}
|
||||
Status = gAppleSmc->SmcAddKey(gAppleSmc, FourCharKey("$Adr"), 4, SmcKeyTypeUint32, 0x08);
|
||||
if (!EFI_ERROR(Status)) {
|
||||
Status = gAppleSmc->SmcWriteValue(gAppleSmc, FourCharKey("$Adr"), 4, (SMC_DATA *)&SAdr);
|
||||
}
|
||||
Status = gAppleSmc->SmcAddKey(gAppleSmc, FourCharKey("$Num"), 1, SmcKeyTypeUint8, 0x08);
|
||||
if (!EFI_ERROR(Status)) {
|
||||
Status = gAppleSmc->SmcWriteValue(gAppleSmc, FourCharKey("$Num"), 1, (SMC_DATA *)&SNum);
|
||||
}
|
||||
Status = gAppleSmc->SmcAddKey(gAppleSmc, FourCharKey("RMde"), 1, SmcKeyTypeChar, 0xC0);
|
||||
if (!EFI_ERROR(Status)) {
|
||||
Status = gAppleSmc->SmcWriteValue(gAppleSmc, FourCharKey("RMde"), 1, (SMC_DATA *)&Mode);
|
||||
}
|
||||
}
|
||||
FreePool(Name);
|
||||
|
|
|
@ -1023,7 +1023,7 @@ void ScanVolumes(void)
|
|||
FreePool(Volume);
|
||||
}
|
||||
}
|
||||
FreePool(Handles);
|
||||
gBS->FreePool(Handles); // use gBS->FreePool instead of FreePool to avoid message from MemoryTracker
|
||||
// DBG("Found %d volumes\n", VolumesCount);
|
||||
if (SelfVolume == NULL){
|
||||
DBG(" WARNING: SelfVolume not found"); //Slice - and what?
|
||||
|
|
|
@ -1860,8 +1860,6 @@ void LOADER_ENTRY::StartLoader()
|
|||
if (SavePreBootLog) {
|
||||
Status = SaveBooterLog(&self.getCloverDir(), PREBOOT_LOG);
|
||||
}
|
||||
gBS->FreePages (ExtraSpace, 90000);
|
||||
|
||||
AllocSmallBlocks(); // shrink memory map;
|
||||
|
||||
#ifdef JIEF_DEBUG
|
||||
|
@ -2262,9 +2260,9 @@ void DisconnectInvalidDiskIoChildDrivers(void)
|
|||
DBG(" - Handle %llx with DiskIo, is Partition, no Fs, BY_DRIVER Agent: %llx, Disconnect: %s\n", (uintptr_t)Handles[Index], (uintptr_t)(OpenInfo[OpenInfoIndex].AgentHandle), efiStrError(Status));
|
||||
}
|
||||
}
|
||||
FreePool(OpenInfo);
|
||||
gBS->FreePool(OpenInfo); // use gBS->FreePool instead of FreePool to avoid message from MemoryTracker
|
||||
}
|
||||
FreePool(Handles);
|
||||
gBS->FreePool(Handles); // use gBS->FreePool instead of FreePool to avoid message from MemoryTracker
|
||||
|
||||
if (!Found) {
|
||||
DBG(" not found, all ok\n");
|
||||
|
@ -2371,10 +2369,10 @@ void DisconnectSomeDevices(void)
|
|||
}
|
||||
}
|
||||
}
|
||||
FreePool(Handles);
|
||||
gBS->FreePool(Handles); // use gBS->FreePool instead of FreePool to avoid message from MemoryTracker
|
||||
}
|
||||
// DBG("\n");
|
||||
FreePool(ControllerHandles);
|
||||
gBS->FreePool(ControllerHandles); // use gBS->FreePool instead of FreePool to avoid message from MemoryTracker
|
||||
}
|
||||
|
||||
|
||||
|
@ -2851,11 +2849,6 @@ RefitMainMain (IN EFI_HANDLE ImageHandle,
|
|||
/*Status = */EfiGetSystemConfigurationTable (&gEfiDxeServicesTableGuid, (void **) &gDS);
|
||||
|
||||
|
||||
Status = gBS->AllocatePages(AllocateMaxAddress,
|
||||
EfiACPIReclaimMemory,
|
||||
90000,
|
||||
&ExtraSpace);
|
||||
|
||||
InitBooterLog();
|
||||
|
||||
// ConsoleInHandle = SystemTable->ConsoleInHandle;
|
||||
|
@ -3004,7 +2997,7 @@ RefitMainMain (IN EFI_HANDLE ImageHandle,
|
|||
gConf.InitialisePlatform();
|
||||
|
||||
#ifdef JIEF_DEBUG
|
||||
DumpNvram();
|
||||
//DumpNvram();
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue