mirror of
https://github.com/acidanthera/audk.git
synced 2025-04-08 17:05:09 +02:00
Merge branch 'master' of https://github.com/tianocore/edk2
This commit is contained in:
commit
87f66b63d4
281
BaseTools/Scripts/MemoryProfileSymbolGen.py
Normal file
281
BaseTools/Scripts/MemoryProfileSymbolGen.py
Normal file
@ -0,0 +1,281 @@
|
||||
##
|
||||
# Generate symbal for memory profile info.
|
||||
#
|
||||
# This tool depends on DIA2Dump.exe (VS) or nm (gcc) to parse debug entry.
|
||||
#
|
||||
# Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
|
||||
# This program and the accompanying materials are licensed and made available under
|
||||
# the terms and conditions of the BSD License that accompanies this distribution.
|
||||
# The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php.
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#
|
||||
##
|
||||
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
from optparse import OptionParser
|
||||
|
||||
versionNumber = "1.0"
|
||||
__copyright__ = "Copyright (c) 2016, Intel Corporation. All rights reserved."
|
||||
|
||||
class Symbols:
|
||||
def __init__(self):
|
||||
self.listLineAddress = []
|
||||
self.pdbName = ""
|
||||
# Cache for function
|
||||
self.functionName = ""
|
||||
# Cache for line
|
||||
self.sourceName = ""
|
||||
|
||||
|
||||
def getSymbol (self, rva):
|
||||
index = 0
|
||||
lineName = 0
|
||||
sourceName = "??"
|
||||
while index + 1 < self.lineCount :
|
||||
if self.listLineAddress[index][0] <= rva and self.listLineAddress[index + 1][0] > rva :
|
||||
offset = rva - self.listLineAddress[index][0]
|
||||
functionName = self.listLineAddress[index][1]
|
||||
lineName = self.listLineAddress[index][2]
|
||||
sourceName = self.listLineAddress[index][3]
|
||||
if lineName == 0 :
|
||||
return " (" + self.listLineAddress[index][1] + "() - " + ")"
|
||||
else :
|
||||
return " (" + self.listLineAddress[index][1] + "() - " + sourceName + ":" + str(lineName) + ")"
|
||||
index += 1
|
||||
|
||||
return " (unknown)"
|
||||
|
||||
def parse_debug_file(self, driverName, pdbName):
|
||||
if cmp (pdbName, "") == 0 :
|
||||
return
|
||||
self.pdbName = pdbName;
|
||||
|
||||
try:
|
||||
nmCommand = "nm"
|
||||
nmLineOption = "-l"
|
||||
print "parsing (debug) - " + pdbName
|
||||
os.system ('%s %s %s > nmDump.line.log' % (nmCommand, nmLineOption, pdbName))
|
||||
except :
|
||||
print 'ERROR: nm command not available. Please verify PATH'
|
||||
return
|
||||
|
||||
#
|
||||
# parse line
|
||||
#
|
||||
linefile = open("nmDump.line.log")
|
||||
reportLines = linefile.readlines()
|
||||
linefile.close()
|
||||
|
||||
# 000113ca T AllocatePool c:\home\edk-ii\MdePkg\Library\UefiMemoryAllocationLib\MemoryAllocationLib.c:399
|
||||
patchLineFileMatchString = "([0-9a-fA-F]{8})\s+[T|D|t|d]\s+(\w+)\s*((?:[a-zA-Z]:)?[\w+\-./_a-zA-Z0-9\\\\]*):?([0-9]*)"
|
||||
|
||||
for reportLine in reportLines:
|
||||
#print "check - " + reportLine
|
||||
match = re.match(patchLineFileMatchString, reportLine)
|
||||
if match is not None:
|
||||
#print "match - " + reportLine[:-1]
|
||||
#print "0 - " + match.group(0)
|
||||
#print "1 - " + match.group(1)
|
||||
#print "2 - " + match.group(2)
|
||||
#print "3 - " + match.group(3)
|
||||
#print "4 - " + match.group(4)
|
||||
|
||||
rva = int (match.group(1), 16)
|
||||
functionName = match.group(2)
|
||||
sourceName = match.group(3)
|
||||
if cmp (match.group(4), "") != 0 :
|
||||
lineName = int (match.group(4))
|
||||
else :
|
||||
lineName = 0
|
||||
self.listLineAddress.append ([rva, functionName, lineName, sourceName])
|
||||
|
||||
self.lineCount = len (self.listLineAddress)
|
||||
|
||||
self.listLineAddress = sorted(self.listLineAddress, key=lambda symbolAddress:symbolAddress[0])
|
||||
|
||||
#for key in self.listLineAddress :
|
||||
#print "rva - " + "%x"%(key[0]) + ", func - " + key[1] + ", line - " + str(key[2]) + ", source - " + key[3]
|
||||
|
||||
def parse_pdb_file(self, driverName, pdbName):
|
||||
if cmp (pdbName, "") == 0 :
|
||||
return
|
||||
self.pdbName = pdbName;
|
||||
|
||||
try:
|
||||
#DIA2DumpCommand = "\"C:\\Program Files (x86)\Microsoft Visual Studio 14.0\\DIA SDK\\Samples\\DIA2Dump\\x64\\Debug\\Dia2Dump.exe\""
|
||||
DIA2DumpCommand = "Dia2Dump.exe"
|
||||
#DIA2SymbolOption = "-p"
|
||||
DIA2LinesOption = "-l"
|
||||
print "parsing (pdb) - " + pdbName
|
||||
#os.system ('%s %s %s > DIA2Dump.symbol.log' % (DIA2DumpCommand, DIA2SymbolOption, pdbName))
|
||||
os.system ('%s %s %s > DIA2Dump.line.log' % (DIA2DumpCommand, DIA2LinesOption, pdbName))
|
||||
except :
|
||||
print 'ERROR: DIA2Dump command not available. Please verify PATH'
|
||||
return
|
||||
|
||||
#
|
||||
# parse line
|
||||
#
|
||||
linefile = open("DIA2Dump.line.log")
|
||||
reportLines = linefile.readlines()
|
||||
linefile.close()
|
||||
|
||||
# ** GetDebugPrintErrorLevel
|
||||
# line 32 at [0000C790][0001:0000B790], len = 0x3 c:\home\edk-ii\mdepkg\library\basedebugprinterrorlevellib\basedebugprinterrorlevellib.c (MD5: 687C0AE564079D35D56ED5D84A6164CC)
|
||||
# line 36 at [0000C793][0001:0000B793], len = 0x5
|
||||
# line 37 at [0000C798][0001:0000B798], len = 0x2
|
||||
|
||||
patchLineFileMatchString = "\s+line ([0-9]+) at \[([0-9a-fA-F]{8})\]\[[0-9a-fA-F]{4}\:[0-9a-fA-F]{8}\], len = 0x[0-9a-fA-F]+\s*([\w+\-\:./_a-zA-Z0-9\\\\]*)\s*"
|
||||
patchLineFileMatchStringFunc = "\*\*\s+(\w+)\s*"
|
||||
|
||||
for reportLine in reportLines:
|
||||
#print "check line - " + reportLine
|
||||
match = re.match(patchLineFileMatchString, reportLine)
|
||||
if match is not None:
|
||||
#print "match - " + reportLine[:-1]
|
||||
#print "0 - " + match.group(0)
|
||||
#print "1 - " + match.group(1)
|
||||
#print "2 - " + match.group(2)
|
||||
if cmp (match.group(3), "") != 0 :
|
||||
self.sourceName = match.group(3)
|
||||
sourceName = self.sourceName
|
||||
functionName = self.functionName
|
||||
|
||||
rva = int (match.group(2), 16)
|
||||
lineName = int (match.group(1))
|
||||
self.listLineAddress.append ([rva, functionName, lineName, sourceName])
|
||||
else :
|
||||
match = re.match(patchLineFileMatchStringFunc, reportLine)
|
||||
if match is not None:
|
||||
self.functionName = match.group(1)
|
||||
|
||||
self.lineCount = len (self.listLineAddress)
|
||||
self.listLineAddress = sorted(self.listLineAddress, key=lambda symbolAddress:symbolAddress[0])
|
||||
|
||||
#for key in self.listLineAddress :
|
||||
#print "rva - " + "%x"%(key[0]) + ", func - " + key[1] + ", line - " + str(key[2]) + ", source - " + key[3]
|
||||
|
||||
class SymbolsFile:
|
||||
def __init__(self):
|
||||
self.symbolsTable = {}
|
||||
|
||||
symbolsFile = ""
|
||||
|
||||
driverName = ""
|
||||
rvaName = ""
|
||||
symbolName = ""
|
||||
|
||||
def getSymbolName(driverName, rva):
|
||||
global symbolsFile
|
||||
|
||||
#print "driverName - " + driverName
|
||||
|
||||
try :
|
||||
symbolList = symbolsFile.symbolsTable[driverName]
|
||||
if symbolList is not None:
|
||||
return symbolList.getSymbol (rva)
|
||||
else:
|
||||
return " (???)"
|
||||
except Exception:
|
||||
return " (???)"
|
||||
|
||||
def processLine(newline):
|
||||
global driverName
|
||||
global rvaName
|
||||
|
||||
driverPrefixLen = len("Driver - ")
|
||||
# get driver name
|
||||
if cmp(newline[0:driverPrefixLen],"Driver - ") == 0 :
|
||||
driverlineList = newline.split(" ")
|
||||
driverName = driverlineList[2]
|
||||
#print "Checking : ", driverName
|
||||
|
||||
# EDKII application output
|
||||
pdbMatchString = "Driver - \w* \(Usage - 0x[0-9a-fA-F]+\) \(Pdb - ([:\-.\w\\\\/]*)\)\s*"
|
||||
pdbName = ""
|
||||
match = re.match(pdbMatchString, newline)
|
||||
if match is not None:
|
||||
#print "match - " + newline
|
||||
#print "0 - " + match.group(0)
|
||||
#print "1 - " + match.group(1)
|
||||
pdbName = match.group(1)
|
||||
#print "PDB - " + pdbName
|
||||
|
||||
symbolsFile.symbolsTable[driverName] = Symbols()
|
||||
|
||||
if cmp (pdbName[-3:], "pdb") == 0 :
|
||||
symbolsFile.symbolsTable[driverName].parse_pdb_file (driverName, pdbName)
|
||||
else :
|
||||
symbolsFile.symbolsTable[driverName].parse_debug_file (driverName, pdbName)
|
||||
|
||||
elif cmp(newline,"") == 0 :
|
||||
driverName = ""
|
||||
|
||||
# check entry line
|
||||
if newline.find ("<==") != -1 :
|
||||
entry_list = newline.split(" ")
|
||||
rvaName = entry_list[4]
|
||||
#print "rva : ", rvaName
|
||||
symbolName = getSymbolName (driverName, int(rvaName, 16))
|
||||
else :
|
||||
rvaName = ""
|
||||
symbolName = ""
|
||||
|
||||
if cmp(rvaName,"") == 0 :
|
||||
return newline
|
||||
else :
|
||||
return newline + symbolName
|
||||
|
||||
def myOptionParser():
|
||||
usage = "%prog [--version] [-h] [--help] [-i inputfile [-o outputfile]]"
|
||||
Parser = OptionParser(usage=usage, description=__copyright__, version="%prog " + str(versionNumber))
|
||||
Parser.add_option("-i", "--inputfile", dest="inputfilename", type="string", help="The input memory profile info file output from MemoryProfileInfo application in MdeModulePkg")
|
||||
Parser.add_option("-o", "--outputfile", dest="outputfilename", type="string", help="The output memory profile info file with symbol, MemoryProfileInfoSymbol.txt will be used if it is not specified")
|
||||
|
||||
(Options, args) = Parser.parse_args()
|
||||
if Options.inputfilename is None:
|
||||
Parser.error("no input file specified")
|
||||
if Options.outputfilename is None:
|
||||
Options.outputfilename = "MemoryProfileInfoSymbol.txt"
|
||||
return Options
|
||||
|
||||
def main():
|
||||
global symbolsFile
|
||||
global Options
|
||||
Options = myOptionParser()
|
||||
|
||||
symbolsFile = SymbolsFile()
|
||||
|
||||
try :
|
||||
file = open(Options.inputfilename)
|
||||
except Exception:
|
||||
print "fail to open " + Options.inputfilename
|
||||
return 1
|
||||
try :
|
||||
newfile = open(Options.outputfilename, "w")
|
||||
except Exception:
|
||||
print "fail to open " + Options.outputfilename
|
||||
return 1
|
||||
|
||||
try:
|
||||
while 1:
|
||||
line = file.readline()
|
||||
if not line:
|
||||
break
|
||||
newline = line[:-1]
|
||||
|
||||
newline = processLine(newline)
|
||||
|
||||
newfile.write(newline)
|
||||
newfile.write("\n")
|
||||
finally:
|
||||
file.close()
|
||||
newfile.close()
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
@ -494,7 +494,7 @@ HiiGetSecondaryLanguages (
|
||||
UnicodeStrToAsciiStr (PrimaryLanguage, PrimaryLang639);
|
||||
|
||||
PrimaryLang4646 = ConvertLanguagesIso639ToRfc4646 (PrimaryLang639);
|
||||
ASSERT_EFI_ERROR (PrimaryLang4646 != NULL);
|
||||
ASSERT (PrimaryLang4646 != NULL);
|
||||
|
||||
SecLangCodes4646 = HiiGetSupportedSecondaryLanguages (UefiHiiHandle, PrimaryLang4646);
|
||||
|
||||
|
@ -153,7 +153,7 @@ ExportPackageLists (
|
||||
&Size,
|
||||
PackageListHdr
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status != EFI_BUFFER_TOO_SMALL);
|
||||
ASSERT (Status != EFI_BUFFER_TOO_SMALL);
|
||||
|
||||
if (Status == EFI_BUFFER_TOO_SMALL) {
|
||||
PackageListHdr = AllocateZeroPool (Size);
|
||||
|
@ -53,15 +53,6 @@ typedef struct {
|
||||
} DATAHUB_STATUSCODE_RECORD;
|
||||
|
||||
|
||||
//
|
||||
// Runtime memory status code worker definition
|
||||
//
|
||||
typedef struct {
|
||||
UINT32 RecordIndex;
|
||||
UINT32 NumberOfRecords;
|
||||
UINT32 MaxRecordsNumber;
|
||||
} RUNTIME_MEMORY_STATUSCODE_HEADER;
|
||||
|
||||
extern RUNTIME_MEMORY_STATUSCODE_HEADER *mRtMemoryStatusCodeTable;
|
||||
|
||||
/**
|
||||
|
@ -68,6 +68,11 @@ PeiFspMemoryInit (
|
||||
// Copy default FSP-M UPD data from Flash
|
||||
//
|
||||
FspmHeaderPtr = (FSP_INFO_HEADER *)FspFindFspHeader (PcdGet32 (PcdFspmBaseAddress));
|
||||
DEBUG ((DEBUG_INFO, "FspmHeaderPtr - 0x%x\n", FspmHeaderPtr));
|
||||
if (FspmHeaderPtr == NULL) {
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
FspmUpdDataPtr = (FSPM_UPD_COMMON *)AllocateZeroPool ((UINTN)FspmHeaderPtr->CfgRegionSize);
|
||||
ASSERT (FspmUpdDataPtr != NULL);
|
||||
SourceData = (UINTN *)((UINTN)FspmHeaderPtr->ImageBase + (UINTN)FspmHeaderPtr->CfgRegionOffset);
|
||||
|
@ -241,6 +241,11 @@ PeiMemoryDiscoveredNotify (
|
||||
// Copy default FSP-S UPD data from Flash
|
||||
//
|
||||
FspsHeaderPtr = (FSP_INFO_HEADER *)FspFindFspHeader (PcdGet32 (PcdFspsBaseAddress));
|
||||
DEBUG ((DEBUG_INFO, "FspsHeaderPtr - 0x%x\n", FspsHeaderPtr));
|
||||
if (FspsHeaderPtr == NULL) {
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
FspsUpdDataPtr = (FSPS_UPD_COMMON *)AllocateZeroPool ((UINTN)FspsHeaderPtr->CfgRegionSize);
|
||||
ASSERT (FspsUpdDataPtr != NULL);
|
||||
SourceData = (UINTN *)((UINTN)FspsHeaderPtr->ImageBase + (UINTN)FspsHeaderPtr->CfgRegionOffset);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -46,9 +46,8 @@
|
||||
UefiLib
|
||||
MemoryAllocationLib
|
||||
DxeServicesLib
|
||||
PeCoffGetEntryPointLib
|
||||
PrintLib
|
||||
|
||||
|
||||
[Guids]
|
||||
## SOMETIMES_CONSUMES ## GUID # Locate protocol
|
||||
## SOMETIMES_CONSUMES ## GUID # SmiHandlerRegister
|
||||
|
@ -104,6 +104,7 @@ PrintInfoFromSmm (
|
||||
}
|
||||
|
||||
CommBuffer = NULL;
|
||||
RealCommSize = 0;
|
||||
Status = EfiGetSystemConfigurationTable (
|
||||
&gEdkiiPiSmmCommunicationRegionTableGuid,
|
||||
(VOID **) &PiSmmCommunicationRegionTable
|
||||
|
@ -238,6 +238,7 @@ SdMmcPciHcEnumerateDevice (
|
||||
LIST_ENTRY *Link;
|
||||
LIST_ENTRY *NextLink;
|
||||
SD_MMC_HC_TRB *Trb;
|
||||
EFI_TPL OldTpl;
|
||||
|
||||
Private = (SD_MMC_HC_PRIVATE_DATA*)Context;
|
||||
|
||||
@ -251,6 +252,7 @@ SdMmcPciHcEnumerateDevice (
|
||||
//
|
||||
// Signal all async task events at the slot with EFI_NO_MEDIA status.
|
||||
//
|
||||
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
||||
for (Link = GetFirstNode (&Private->Queue);
|
||||
!IsNull (&Private->Queue, Link);
|
||||
Link = NextLink) {
|
||||
@ -263,6 +265,7 @@ SdMmcPciHcEnumerateDevice (
|
||||
SdMmcFreeTrb (Trb);
|
||||
}
|
||||
}
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
//
|
||||
// Notify the upper layer the connect state change through ReinstallProtocolInterface.
|
||||
//
|
||||
@ -665,7 +668,7 @@ SdMmcPciHcDriverBindingStart (
|
||||
//
|
||||
Status = gBS->CreateEvent (
|
||||
EVT_TIMER | EVT_NOTIFY_SIGNAL,
|
||||
TPL_CALLBACK,
|
||||
TPL_NOTIFY,
|
||||
ProcessAsyncTaskList,
|
||||
Private,
|
||||
&Private->TimerEvent
|
||||
@ -961,7 +964,7 @@ SdMmcPassThruPassThru (
|
||||
// Wait async I/O list is empty before execute sync I/O operation.
|
||||
//
|
||||
while (TRUE) {
|
||||
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
|
||||
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
||||
if (IsListEmpty (&Private->Queue)) {
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
break;
|
||||
@ -1273,7 +1276,7 @@ SdMmcPassThruResetDevice (
|
||||
//
|
||||
// Free all async I/O requests in the queue
|
||||
//
|
||||
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
|
||||
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
||||
|
||||
for (Link = GetFirstNode (&Private->Queue);
|
||||
!IsNull (&Private->Queue, Link);
|
||||
|
@ -1315,7 +1315,7 @@ SdMmcCreateTrb (
|
||||
}
|
||||
|
||||
if (Event != NULL) {
|
||||
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
|
||||
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
||||
InsertTailList (&Private->Queue, &Trb->TrbList);
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
}
|
||||
|
@ -339,7 +339,7 @@ EmmcSetExtCsd (
|
||||
}
|
||||
|
||||
SetExtCsdReq->Signature = EMMC_REQUEST_SIGNATURE;
|
||||
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
|
||||
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
||||
InsertTailList (&Partition->Queue, &SetExtCsdReq->Link);
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
SetExtCsdReq->Packet.SdMmcCmdBlk = &SetExtCsdReq->SdMmcCmdBlk;
|
||||
@ -361,7 +361,7 @@ EmmcSetExtCsd (
|
||||
if ((Token != NULL) && (Token->Event != NULL)) {
|
||||
Status = gBS->CreateEvent (
|
||||
EVT_NOTIFY_SIGNAL,
|
||||
TPL_CALLBACK,
|
||||
TPL_NOTIFY,
|
||||
AsyncIoCallback,
|
||||
SetExtCsdReq,
|
||||
&SetExtCsdReq->Event
|
||||
@ -382,7 +382,7 @@ Error:
|
||||
// The request and event will be freed in asynchronous callback for success case.
|
||||
//
|
||||
if (EFI_ERROR (Status) && (SetExtCsdReq != NULL)) {
|
||||
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
|
||||
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
||||
RemoveEntryList (&SetExtCsdReq->Link);
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
if (SetExtCsdReq->Event != NULL) {
|
||||
@ -395,7 +395,7 @@ Error:
|
||||
// For synchronous operation, free request whatever the execution result is.
|
||||
//
|
||||
if (SetExtCsdReq != NULL) {
|
||||
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
|
||||
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
||||
RemoveEntryList (&SetExtCsdReq->Link);
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
FreePool (SetExtCsdReq);
|
||||
@ -445,7 +445,7 @@ EmmcSetBlkCount (
|
||||
}
|
||||
|
||||
SetBlkCntReq->Signature = EMMC_REQUEST_SIGNATURE;
|
||||
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
|
||||
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
||||
InsertTailList (&Partition->Queue, &SetBlkCntReq->Link);
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
SetBlkCntReq->Packet.SdMmcCmdBlk = &SetBlkCntReq->SdMmcCmdBlk;
|
||||
@ -463,7 +463,7 @@ EmmcSetBlkCount (
|
||||
if ((Token != NULL) && (Token->Event != NULL)) {
|
||||
Status = gBS->CreateEvent (
|
||||
EVT_NOTIFY_SIGNAL,
|
||||
TPL_CALLBACK,
|
||||
TPL_NOTIFY,
|
||||
AsyncIoCallback,
|
||||
SetBlkCntReq,
|
||||
&SetBlkCntReq->Event
|
||||
@ -484,7 +484,7 @@ Error:
|
||||
// The request and event will be freed in asynchronous callback for success case.
|
||||
//
|
||||
if (EFI_ERROR (Status) && (SetBlkCntReq != NULL)) {
|
||||
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
|
||||
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
||||
RemoveEntryList (&SetBlkCntReq->Link);
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
if (SetBlkCntReq->Event != NULL) {
|
||||
@ -497,7 +497,7 @@ Error:
|
||||
// For synchronous operation, free request whatever the execution result is.
|
||||
//
|
||||
if (SetBlkCntReq != NULL) {
|
||||
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
|
||||
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
||||
RemoveEntryList (&SetBlkCntReq->Link);
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
FreePool (SetBlkCntReq);
|
||||
@ -562,7 +562,7 @@ EmmcProtocolInOut (
|
||||
}
|
||||
|
||||
ProtocolReq->Signature = EMMC_REQUEST_SIGNATURE;
|
||||
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
|
||||
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
||||
InsertTailList (&Partition->Queue, &ProtocolReq->Link);
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
ProtocolReq->Packet.SdMmcCmdBlk = &ProtocolReq->SdMmcCmdBlk;
|
||||
@ -596,7 +596,7 @@ EmmcProtocolInOut (
|
||||
if ((Token != NULL) && (Token->Event != NULL)) {
|
||||
Status = gBS->CreateEvent (
|
||||
EVT_NOTIFY_SIGNAL,
|
||||
TPL_CALLBACK,
|
||||
TPL_NOTIFY,
|
||||
AsyncIoCallback,
|
||||
ProtocolReq,
|
||||
&ProtocolReq->Event
|
||||
@ -617,7 +617,7 @@ Error:
|
||||
// The request and event will be freed in asynchronous callback for success case.
|
||||
//
|
||||
if (EFI_ERROR (Status) && (ProtocolReq != NULL)) {
|
||||
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
|
||||
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
||||
RemoveEntryList (&ProtocolReq->Link);
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
if (ProtocolReq->Event != NULL) {
|
||||
@ -630,7 +630,7 @@ Error:
|
||||
// For synchronous operation, free request whatever the execution result is.
|
||||
//
|
||||
if (ProtocolReq != NULL) {
|
||||
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
|
||||
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
||||
RemoveEntryList (&ProtocolReq->Link);
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
FreePool (ProtocolReq);
|
||||
@ -688,7 +688,7 @@ EmmcRwMultiBlocks (
|
||||
}
|
||||
|
||||
RwMultiBlkReq->Signature = EMMC_REQUEST_SIGNATURE;
|
||||
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
|
||||
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
||||
InsertTailList (&Partition->Queue, &RwMultiBlkReq->Link);
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
RwMultiBlkReq->Packet.SdMmcCmdBlk = &RwMultiBlkReq->SdMmcCmdBlk;
|
||||
@ -730,7 +730,7 @@ EmmcRwMultiBlocks (
|
||||
if ((Token != NULL) && (Token->Event != NULL)) {
|
||||
Status = gBS->CreateEvent (
|
||||
EVT_NOTIFY_SIGNAL,
|
||||
TPL_CALLBACK,
|
||||
TPL_NOTIFY,
|
||||
AsyncIoCallback,
|
||||
RwMultiBlkReq,
|
||||
&RwMultiBlkReq->Event
|
||||
@ -751,7 +751,7 @@ Error:
|
||||
// The request and event will be freed in asynchronous callback for success case.
|
||||
//
|
||||
if (EFI_ERROR (Status) && (RwMultiBlkReq != NULL)) {
|
||||
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
|
||||
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
||||
RemoveEntryList (&RwMultiBlkReq->Link);
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
if (RwMultiBlkReq->Event != NULL) {
|
||||
@ -764,7 +764,7 @@ Error:
|
||||
// For synchronous operation, free request whatever the execution result is.
|
||||
//
|
||||
if (RwMultiBlkReq != NULL) {
|
||||
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
|
||||
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
||||
RemoveEntryList (&RwMultiBlkReq->Link);
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
FreePool (RwMultiBlkReq);
|
||||
@ -901,7 +901,7 @@ EmmcReadWrite (
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
DEBUG ((EFI_D_INFO, "Emmc%a(): Lba 0x%x BlkNo 0x%x Event %p with %r\n", IsRead ? "Read" : "Write", Lba, BlockNum, Token->Event, Status));
|
||||
DEBUG ((EFI_D_INFO, "Emmc%a(): Part %d Lba 0x%x BlkNo 0x%x Event %p with %r\n", IsRead ? "Read " : "Write", Partition->PartitionType, Lba, BlockNum, Token ? Token->Event : NULL, Status));
|
||||
|
||||
Lba += BlockNum;
|
||||
Buffer = (UINT8*)Buffer + BufferSize;
|
||||
@ -1069,7 +1069,7 @@ EmmcResetEx (
|
||||
|
||||
Partition = EMMC_PARTITION_DATA_FROM_BLKIO2 (This);
|
||||
|
||||
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
|
||||
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
||||
for (Link = GetFirstNode (&Partition->Queue);
|
||||
!IsNull (&Partition->Queue, Link);
|
||||
Link = NextLink) {
|
||||
@ -1629,7 +1629,7 @@ EmmcEraseBlockStart (
|
||||
}
|
||||
|
||||
EraseBlockStart->Signature = EMMC_REQUEST_SIGNATURE;
|
||||
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
|
||||
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
||||
InsertTailList (&Partition->Queue, &EraseBlockStart->Link);
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
EraseBlockStart->Packet.SdMmcCmdBlk = &EraseBlockStart->SdMmcCmdBlk;
|
||||
@ -1652,7 +1652,7 @@ EmmcEraseBlockStart (
|
||||
if ((Token != NULL) && (Token->Event != NULL)) {
|
||||
Status = gBS->CreateEvent (
|
||||
EVT_NOTIFY_SIGNAL,
|
||||
TPL_CALLBACK,
|
||||
TPL_NOTIFY,
|
||||
AsyncIoCallback,
|
||||
EraseBlockStart,
|
||||
&EraseBlockStart->Event
|
||||
@ -1673,7 +1673,9 @@ Error:
|
||||
// The request and event will be freed in asynchronous callback for success case.
|
||||
//
|
||||
if (EFI_ERROR (Status) && (EraseBlockStart != NULL)) {
|
||||
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
||||
RemoveEntryList (&EraseBlockStart->Link);
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
if (EraseBlockStart->Event != NULL) {
|
||||
gBS->CloseEvent (EraseBlockStart->Event);
|
||||
}
|
||||
@ -1684,7 +1686,9 @@ Error:
|
||||
// For synchronous operation, free request whatever the execution result is.
|
||||
//
|
||||
if (EraseBlockStart != NULL) {
|
||||
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
||||
RemoveEntryList (&EraseBlockStart->Link);
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
FreePool (EraseBlockStart);
|
||||
}
|
||||
}
|
||||
@ -1732,7 +1736,7 @@ EmmcEraseBlockEnd (
|
||||
}
|
||||
|
||||
EraseBlockEnd->Signature = EMMC_REQUEST_SIGNATURE;
|
||||
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
|
||||
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
||||
InsertTailList (&Partition->Queue, &EraseBlockEnd->Link);
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
EraseBlockEnd->Packet.SdMmcCmdBlk = &EraseBlockEnd->SdMmcCmdBlk;
|
||||
@ -1755,7 +1759,7 @@ EmmcEraseBlockEnd (
|
||||
if ((Token != NULL) && (Token->Event != NULL)) {
|
||||
Status = gBS->CreateEvent (
|
||||
EVT_NOTIFY_SIGNAL,
|
||||
TPL_CALLBACK,
|
||||
TPL_NOTIFY,
|
||||
AsyncIoCallback,
|
||||
EraseBlockEnd,
|
||||
&EraseBlockEnd->Event
|
||||
@ -1776,7 +1780,9 @@ Error:
|
||||
// The request and event will be freed in asynchronous callback for success case.
|
||||
//
|
||||
if (EFI_ERROR (Status) && (EraseBlockEnd != NULL)) {
|
||||
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
||||
RemoveEntryList (&EraseBlockEnd->Link);
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
if (EraseBlockEnd->Event != NULL) {
|
||||
gBS->CloseEvent (EraseBlockEnd->Event);
|
||||
}
|
||||
@ -1787,7 +1793,9 @@ Error:
|
||||
// For synchronous operation, free request whatever the execution result is.
|
||||
//
|
||||
if (EraseBlockEnd != NULL) {
|
||||
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
||||
RemoveEntryList (&EraseBlockEnd->Link);
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
FreePool (EraseBlockEnd);
|
||||
}
|
||||
}
|
||||
@ -1833,7 +1841,7 @@ EmmcEraseBlock (
|
||||
}
|
||||
|
||||
EraseBlock->Signature = EMMC_REQUEST_SIGNATURE;
|
||||
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
|
||||
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
||||
InsertTailList (&Partition->Queue, &EraseBlock->Link);
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
EraseBlock->Packet.SdMmcCmdBlk = &EraseBlock->SdMmcCmdBlk;
|
||||
@ -1850,7 +1858,7 @@ EmmcEraseBlock (
|
||||
if ((Token != NULL) && (Token->Event != NULL)) {
|
||||
Status = gBS->CreateEvent (
|
||||
EVT_NOTIFY_SIGNAL,
|
||||
TPL_CALLBACK,
|
||||
TPL_NOTIFY,
|
||||
AsyncIoCallback,
|
||||
EraseBlock,
|
||||
&EraseBlock->Event
|
||||
@ -1871,7 +1879,9 @@ Error:
|
||||
// The request and event will be freed in asynchronous callback for success case.
|
||||
//
|
||||
if (EFI_ERROR (Status) && (EraseBlock != NULL)) {
|
||||
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
||||
RemoveEntryList (&EraseBlock->Link);
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
if (EraseBlock->Event != NULL) {
|
||||
gBS->CloseEvent (EraseBlock->Event);
|
||||
}
|
||||
@ -1882,7 +1892,9 @@ Error:
|
||||
// For synchronous operation, free request whatever the execution result is.
|
||||
//
|
||||
if (EraseBlock != NULL) {
|
||||
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
||||
RemoveEntryList (&EraseBlock->Link);
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
FreePool (EraseBlock);
|
||||
}
|
||||
}
|
||||
|
@ -443,77 +443,60 @@ InstallProtocolOnPartition (
|
||||
//
|
||||
// Install BlkIo/BlkIo2/Ssp for the specified partition
|
||||
//
|
||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||
&Partition->Handle,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
Partition->DevicePath,
|
||||
&gEfiBlockIoProtocolGuid,
|
||||
&Partition->BlockIo,
|
||||
&gEfiBlockIo2ProtocolGuid,
|
||||
&Partition->BlockIo2,
|
||||
NULL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto Error;
|
||||
}
|
||||
|
||||
if (Partition->PartitionType != EmmcPartitionRPMB) {
|
||||
Status = gBS->InstallProtocolInterface (
|
||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||
&Partition->Handle,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
Partition->DevicePath,
|
||||
&gEfiBlockIoProtocolGuid,
|
||||
&Partition->BlockIo,
|
||||
&gEfiBlockIo2ProtocolGuid,
|
||||
&Partition->BlockIo2,
|
||||
&gEfiEraseBlockProtocolGuid,
|
||||
EFI_NATIVE_INTERFACE,
|
||||
&Partition->EraseBlock
|
||||
&Partition->EraseBlock,
|
||||
NULL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
gBS->UninstallMultipleProtocolInterfaces (
|
||||
&Partition->Handle,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
Partition->DevicePath,
|
||||
&gEfiBlockIoProtocolGuid,
|
||||
&Partition->BlockIo,
|
||||
&gEfiBlockIo2ProtocolGuid,
|
||||
&Partition->BlockIo2,
|
||||
NULL
|
||||
);
|
||||
goto Error;
|
||||
}
|
||||
}
|
||||
|
||||
if (((Partition->PartitionType == EmmcPartitionUserData) ||
|
||||
(Partition->PartitionType == EmmcPartitionBoot1) ||
|
||||
(Partition->PartitionType == EmmcPartitionBoot2)) &&
|
||||
((Device->Csd.Ccc & BIT10) != 0)) {
|
||||
Status = gBS->InstallProtocolInterface (
|
||||
&Partition->Handle,
|
||||
&gEfiStorageSecurityCommandProtocolGuid,
|
||||
EFI_NATIVE_INTERFACE,
|
||||
&Partition->StorageSecurity
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
gBS->UninstallMultipleProtocolInterfaces (
|
||||
&Partition->Handle,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
Partition->DevicePath,
|
||||
&gEfiBlockIoProtocolGuid,
|
||||
&Partition->BlockIo,
|
||||
&gEfiBlockIo2ProtocolGuid,
|
||||
&Partition->BlockIo2,
|
||||
&gEfiEraseBlockProtocolGuid,
|
||||
&Partition->EraseBlock,
|
||||
NULL
|
||||
);
|
||||
goto Error;
|
||||
if (((Partition->PartitionType == EmmcPartitionUserData) ||
|
||||
(Partition->PartitionType == EmmcPartitionBoot1) ||
|
||||
(Partition->PartitionType == EmmcPartitionBoot2)) &&
|
||||
((Device->Csd.Ccc & BIT10) != 0)) {
|
||||
Status = gBS->InstallProtocolInterface (
|
||||
&Partition->Handle,
|
||||
&gEfiStorageSecurityCommandProtocolGuid,
|
||||
EFI_NATIVE_INTERFACE,
|
||||
&Partition->StorageSecurity
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
gBS->UninstallMultipleProtocolInterfaces (
|
||||
&Partition->Handle,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
Partition->DevicePath,
|
||||
&gEfiBlockIoProtocolGuid,
|
||||
&Partition->BlockIo,
|
||||
&gEfiBlockIo2ProtocolGuid,
|
||||
&Partition->BlockIo2,
|
||||
&gEfiEraseBlockProtocolGuid,
|
||||
&Partition->EraseBlock,
|
||||
NULL
|
||||
);
|
||||
goto Error;
|
||||
}
|
||||
}
|
||||
|
||||
gBS->OpenProtocol (
|
||||
Device->Private->Controller,
|
||||
&gEfiSdMmcPassThruProtocolGuid,
|
||||
(VOID **) &(Device->Private->PassThru),
|
||||
Device->Private->DriverBindingHandle,
|
||||
Partition->Handle,
|
||||
EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
|
||||
);
|
||||
}
|
||||
|
||||
gBS->OpenProtocol (
|
||||
Device->Private->Controller,
|
||||
&gEfiSdMmcPassThruProtocolGuid,
|
||||
(VOID **) &(Device->Private->PassThru),
|
||||
Device->Private->DriverBindingHandle,
|
||||
Partition->Handle,
|
||||
EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
|
||||
);
|
||||
} else {
|
||||
Status = EFI_INVALID_PARAMETER;
|
||||
}
|
||||
@ -993,7 +976,6 @@ EmmcDxeDriverBindingStop (
|
||||
EFI_BLOCK_IO_PROTOCOL *BlockIo;
|
||||
EFI_BLOCK_IO2_PROTOCOL *BlockIo2;
|
||||
EFI_STORAGE_SECURITY_COMMAND_PROTOCOL *StorageSecurity;
|
||||
EFI_ERASE_BLOCK_PROTOCOL *EraseBlock;
|
||||
LIST_ENTRY *Link;
|
||||
LIST_ENTRY *NextLink;
|
||||
EMMC_REQUEST *Request;
|
||||
@ -1120,6 +1102,8 @@ EmmcDxeDriverBindingStop (
|
||||
&Partition->BlockIo,
|
||||
&gEfiBlockIo2ProtocolGuid,
|
||||
&Partition->BlockIo2,
|
||||
&gEfiEraseBlockProtocolGuid,
|
||||
&Partition->EraseBlock,
|
||||
NULL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
@ -1135,38 +1119,6 @@ EmmcDxeDriverBindingStop (
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// If Erase Block Protocol is installed, then uninstall this protocol.
|
||||
//
|
||||
Status = gBS->OpenProtocol (
|
||||
ChildHandleBuffer[Index],
|
||||
&gEfiEraseBlockProtocolGuid,
|
||||
(VOID **) &EraseBlock,
|
||||
This->DriverBindingHandle,
|
||||
Controller,
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||
);
|
||||
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Status = gBS->UninstallProtocolInterface (
|
||||
ChildHandleBuffer[Index],
|
||||
&gEfiEraseBlockProtocolGuid,
|
||||
&Partition->EraseBlock
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
gBS->OpenProtocol (
|
||||
Controller,
|
||||
&gEfiSdMmcPassThruProtocolGuid,
|
||||
(VOID **) &Partition->Device->Private->PassThru,
|
||||
This->DriverBindingHandle,
|
||||
ChildHandleBuffer[Index],
|
||||
EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
|
||||
);
|
||||
AllChildrenStopped = FALSE;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// If Storage Security Command Protocol is installed, then uninstall this protocol.
|
||||
//
|
||||
|
@ -340,7 +340,7 @@ SdRwSingleBlock (
|
||||
}
|
||||
|
||||
RwSingleBlkReq->Signature = SD_REQUEST_SIGNATURE;
|
||||
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
|
||||
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
||||
InsertTailList (&Device->Queue, &RwSingleBlkReq->Link);
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
RwSingleBlkReq->Packet.SdMmcCmdBlk = &RwSingleBlkReq->SdMmcCmdBlk;
|
||||
@ -382,7 +382,7 @@ SdRwSingleBlock (
|
||||
if ((Token != NULL) && (Token->Event != NULL)) {
|
||||
Status = gBS->CreateEvent (
|
||||
EVT_NOTIFY_SIGNAL,
|
||||
TPL_CALLBACK,
|
||||
TPL_NOTIFY,
|
||||
AsyncIoCallback,
|
||||
RwSingleBlkReq,
|
||||
&RwSingleBlkReq->Event
|
||||
@ -403,7 +403,9 @@ Error:
|
||||
// The request and event will be freed in asynchronous callback for success case.
|
||||
//
|
||||
if (EFI_ERROR (Status) && (RwSingleBlkReq != NULL)) {
|
||||
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
||||
RemoveEntryList (&RwSingleBlkReq->Link);
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
if (RwSingleBlkReq->Event != NULL) {
|
||||
gBS->CloseEvent (RwSingleBlkReq->Event);
|
||||
}
|
||||
@ -414,7 +416,9 @@ Error:
|
||||
// For synchronous operation, free request whatever the execution result is.
|
||||
//
|
||||
if (RwSingleBlkReq != NULL) {
|
||||
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
||||
RemoveEntryList (&RwSingleBlkReq->Link);
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
FreePool (RwSingleBlkReq);
|
||||
}
|
||||
}
|
||||
@ -468,7 +472,7 @@ SdRwMultiBlocks (
|
||||
}
|
||||
|
||||
RwMultiBlkReq->Signature = SD_REQUEST_SIGNATURE;
|
||||
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
|
||||
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
||||
InsertTailList (&Device->Queue, &RwMultiBlkReq->Link);
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
RwMultiBlkReq->Packet.SdMmcCmdBlk = &RwMultiBlkReq->SdMmcCmdBlk;
|
||||
@ -510,7 +514,7 @@ SdRwMultiBlocks (
|
||||
if ((Token != NULL) && (Token->Event != NULL)) {
|
||||
Status = gBS->CreateEvent (
|
||||
EVT_NOTIFY_SIGNAL,
|
||||
TPL_CALLBACK,
|
||||
TPL_NOTIFY,
|
||||
AsyncIoCallback,
|
||||
RwMultiBlkReq,
|
||||
&RwMultiBlkReq->Event
|
||||
@ -531,7 +535,9 @@ Error:
|
||||
// The request and event will be freed in asynchronous callback for success case.
|
||||
//
|
||||
if (EFI_ERROR (Status) && (RwMultiBlkReq != NULL)) {
|
||||
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
||||
RemoveEntryList (&RwMultiBlkReq->Link);
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
if (RwMultiBlkReq->Event != NULL) {
|
||||
gBS->CloseEvent (RwMultiBlkReq->Event);
|
||||
}
|
||||
@ -542,7 +548,9 @@ Error:
|
||||
// For synchronous operation, free request whatever the execution result is.
|
||||
//
|
||||
if (RwMultiBlkReq != NULL) {
|
||||
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
||||
RemoveEntryList (&RwMultiBlkReq->Link);
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
FreePool (RwMultiBlkReq);
|
||||
}
|
||||
}
|
||||
@ -830,7 +838,7 @@ SdResetEx (
|
||||
|
||||
Device = SD_DEVICE_DATA_FROM_BLKIO2 (This);
|
||||
|
||||
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
|
||||
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
||||
for (Link = GetFirstNode (&Device->Queue);
|
||||
!IsNull (&Device->Queue, Link);
|
||||
Link = NextLink) {
|
||||
@ -1007,7 +1015,7 @@ SdEraseBlockStart (
|
||||
}
|
||||
|
||||
EraseBlockStart->Signature = SD_REQUEST_SIGNATURE;
|
||||
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
|
||||
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
||||
InsertTailList (&Device->Queue, &EraseBlockStart->Link);
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
EraseBlockStart->Packet.SdMmcCmdBlk = &EraseBlockStart->SdMmcCmdBlk;
|
||||
@ -1030,7 +1038,7 @@ SdEraseBlockStart (
|
||||
if ((Token != NULL) && (Token->Event != NULL)) {
|
||||
Status = gBS->CreateEvent (
|
||||
EVT_NOTIFY_SIGNAL,
|
||||
TPL_CALLBACK,
|
||||
TPL_NOTIFY,
|
||||
AsyncIoCallback,
|
||||
EraseBlockStart,
|
||||
&EraseBlockStart->Event
|
||||
@ -1051,7 +1059,9 @@ Error:
|
||||
// The request and event will be freed in asynchronous callback for success case.
|
||||
//
|
||||
if (EFI_ERROR (Status) && (EraseBlockStart != NULL)) {
|
||||
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
||||
RemoveEntryList (&EraseBlockStart->Link);
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
if (EraseBlockStart->Event != NULL) {
|
||||
gBS->CloseEvent (EraseBlockStart->Event);
|
||||
}
|
||||
@ -1062,7 +1072,9 @@ Error:
|
||||
// For synchronous operation, free request whatever the execution result is.
|
||||
//
|
||||
if (EraseBlockStart != NULL) {
|
||||
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
||||
RemoveEntryList (&EraseBlockStart->Link);
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
FreePool (EraseBlockStart);
|
||||
}
|
||||
}
|
||||
@ -1107,7 +1119,7 @@ SdEraseBlockEnd (
|
||||
}
|
||||
|
||||
EraseBlockEnd->Signature = SD_REQUEST_SIGNATURE;
|
||||
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
|
||||
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
||||
InsertTailList (&Device->Queue, &EraseBlockEnd->Link);
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
EraseBlockEnd->Packet.SdMmcCmdBlk = &EraseBlockEnd->SdMmcCmdBlk;
|
||||
@ -1130,7 +1142,7 @@ SdEraseBlockEnd (
|
||||
if ((Token != NULL) && (Token->Event != NULL)) {
|
||||
Status = gBS->CreateEvent (
|
||||
EVT_NOTIFY_SIGNAL,
|
||||
TPL_CALLBACK,
|
||||
TPL_NOTIFY,
|
||||
AsyncIoCallback,
|
||||
EraseBlockEnd,
|
||||
&EraseBlockEnd->Event
|
||||
@ -1151,7 +1163,9 @@ Error:
|
||||
// The request and event will be freed in asynchronous callback for success case.
|
||||
//
|
||||
if (EFI_ERROR (Status) && (EraseBlockEnd != NULL)) {
|
||||
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
||||
RemoveEntryList (&EraseBlockEnd->Link);
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
if (EraseBlockEnd->Event != NULL) {
|
||||
gBS->CloseEvent (EraseBlockEnd->Event);
|
||||
}
|
||||
@ -1162,7 +1176,9 @@ Error:
|
||||
// For synchronous operation, free request whatever the execution result is.
|
||||
//
|
||||
if (EraseBlockEnd != NULL) {
|
||||
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
||||
RemoveEntryList (&EraseBlockEnd->Link);
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
FreePool (EraseBlockEnd);
|
||||
}
|
||||
}
|
||||
@ -1205,7 +1221,7 @@ SdEraseBlock (
|
||||
}
|
||||
|
||||
EraseBlock->Signature = SD_REQUEST_SIGNATURE;
|
||||
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
|
||||
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
||||
InsertTailList (&Device->Queue, &EraseBlock->Link);
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
EraseBlock->Packet.SdMmcCmdBlk = &EraseBlock->SdMmcCmdBlk;
|
||||
@ -1222,7 +1238,7 @@ SdEraseBlock (
|
||||
if ((Token != NULL) && (Token->Event != NULL)) {
|
||||
Status = gBS->CreateEvent (
|
||||
EVT_NOTIFY_SIGNAL,
|
||||
TPL_CALLBACK,
|
||||
TPL_NOTIFY,
|
||||
AsyncIoCallback,
|
||||
EraseBlock,
|
||||
&EraseBlock->Event
|
||||
@ -1243,7 +1259,9 @@ Error:
|
||||
// The request and event will be freed in asynchronous callback for success case.
|
||||
//
|
||||
if (EFI_ERROR (Status) && (EraseBlock != NULL)) {
|
||||
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
||||
RemoveEntryList (&EraseBlock->Link);
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
if (EraseBlock->Event != NULL) {
|
||||
gBS->CloseEvent (EraseBlock->Event);
|
||||
}
|
||||
@ -1254,7 +1272,9 @@ Error:
|
||||
// For synchronous operation, free request whatever the execution result is.
|
||||
//
|
||||
if (EraseBlock != NULL) {
|
||||
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
||||
RemoveEntryList (&EraseBlock->Link);
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
FreePool (EraseBlock);
|
||||
}
|
||||
}
|
||||
|
@ -800,7 +800,7 @@ SdDxeDriverBindingStop (
|
||||
//
|
||||
// Free all on-going async tasks.
|
||||
//
|
||||
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
|
||||
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
||||
for (Link = GetFirstNode (&Device->Queue);
|
||||
!IsNull (&Device->Queue, Link);
|
||||
Link = NextLink) {
|
||||
|
@ -2780,11 +2780,13 @@ MemoryProfileInstallProtocol (
|
||||
@param DriverEntry Image info.
|
||||
@param FileType Image file type.
|
||||
|
||||
@retval TRUE Register success.
|
||||
@retval FALSE Register fail.
|
||||
@return EFI_SUCCESS Register successfully.
|
||||
@return EFI_UNSUPPORTED Memory profile unsupported,
|
||||
or memory profile for the image is not required.
|
||||
@return EFI_OUT_OF_RESOURCES No enough resource for this register.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
EFI_STATUS
|
||||
RegisterMemoryProfileImage (
|
||||
IN LOADED_IMAGE_PRIVATE_DATA *DriverEntry,
|
||||
IN EFI_FV_FILETYPE FileType
|
||||
@ -2795,11 +2797,13 @@ RegisterMemoryProfileImage (
|
||||
|
||||
@param DriverEntry Image info.
|
||||
|
||||
@retval TRUE Unregister success.
|
||||
@retval FALSE Unregister fail.
|
||||
@return EFI_SUCCESS Unregister successfully.
|
||||
@return EFI_UNSUPPORTED Memory profile unsupported,
|
||||
or memory profile for the image is not required.
|
||||
@return EFI_NOT_FOUND The image is not found.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
EFI_STATUS
|
||||
UnregisterMemoryProfileImage (
|
||||
IN LOADED_IMAGE_PRIVATE_DATA *DriverEntry
|
||||
);
|
||||
@ -2810,20 +2814,31 @@ UnregisterMemoryProfileImage (
|
||||
@param CallerAddress Address of caller who call Allocate or Free.
|
||||
@param Action This Allocate or Free action.
|
||||
@param MemoryType Memory type.
|
||||
EfiMaxMemoryType means the MemoryType is unknown.
|
||||
@param Size Buffer size.
|
||||
@param Buffer Buffer address.
|
||||
@param ActionString String for memory profile action.
|
||||
Only needed for user defined allocate action.
|
||||
|
||||
@retval TRUE Profile udpate success.
|
||||
@retval FALSE Profile update fail.
|
||||
@return EFI_SUCCESS Memory profile is updated.
|
||||
@return EFI_UNSUPPORTED Memory profile is unsupported,
|
||||
or memory profile for the image is not required,
|
||||
or memory profile for the memory type is not required.
|
||||
@return EFI_ACCESS_DENIED It is during memory profile data getting.
|
||||
@return EFI_ABORTED Memory profile recording is not enabled.
|
||||
@return EFI_OUT_OF_RESOURCES No enough resource to update memory profile for allocate action.
|
||||
@return EFI_NOT_FOUND No matched allocate info found for free action.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
CoreUpdateProfile (
|
||||
IN EFI_PHYSICAL_ADDRESS CallerAddress,
|
||||
IN MEMORY_PROFILE_ACTION Action,
|
||||
IN EFI_MEMORY_TYPE MemoryType,
|
||||
IN UINTN Size, // Valid for AllocatePages/FreePages/AllocatePool
|
||||
IN VOID *Buffer
|
||||
IN VOID *Buffer,
|
||||
IN CHAR8 *ActionString OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -187,6 +187,7 @@
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxEfiSystemTablePointerAddress ## CONSUMES
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdMemoryProfileMemoryType ## CONSUMES
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdMemoryProfilePropertyMask ## CONSUMES
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdMemoryProfileDriverPath ## CONSUMES
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdPropertiesTableEnable ## CONSUMES
|
||||
|
||||
# [Hob]
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1335,7 +1335,14 @@ CoreAllocatePages (
|
||||
|
||||
Status = CoreInternalAllocatePages (Type, MemoryType, NumberOfPages, Memory);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
CoreUpdateProfile ((EFI_PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS (0), MemoryProfileActionAllocatePages, MemoryType, EFI_PAGES_TO_SIZE (NumberOfPages), (VOID *) (UINTN) *Memory);
|
||||
CoreUpdateProfile (
|
||||
(EFI_PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS (0),
|
||||
MemoryProfileActionAllocatePages,
|
||||
MemoryType,
|
||||
EFI_PAGES_TO_SIZE (NumberOfPages),
|
||||
(VOID *) (UINTN) *Memory,
|
||||
NULL
|
||||
);
|
||||
InstallMemoryAttributesTableOnMemoryAllocation (MemoryType);
|
||||
}
|
||||
return Status;
|
||||
@ -1444,7 +1451,14 @@ CoreFreePages (
|
||||
|
||||
Status = CoreInternalFreePages (Memory, NumberOfPages, &MemoryType);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
CoreUpdateProfile ((EFI_PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS (0), MemoryProfileActionFreePages, MemoryType, EFI_PAGES_TO_SIZE (NumberOfPages), (VOID *) (UINTN) Memory);
|
||||
CoreUpdateProfile (
|
||||
(EFI_PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS (0),
|
||||
MemoryProfileActionFreePages,
|
||||
MemoryType,
|
||||
EFI_PAGES_TO_SIZE (NumberOfPages),
|
||||
(VOID *) (UINTN) Memory,
|
||||
NULL
|
||||
);
|
||||
InstallMemoryAttributesTableOnMemoryAllocation (MemoryType);
|
||||
}
|
||||
return Status;
|
||||
|
@ -276,7 +276,14 @@ CoreAllocatePool (
|
||||
|
||||
Status = CoreInternalAllocatePool (PoolType, Size, Buffer);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
CoreUpdateProfile ((EFI_PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS (0), MemoryProfileActionAllocatePool, PoolType, Size, *Buffer);
|
||||
CoreUpdateProfile (
|
||||
(EFI_PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS (0),
|
||||
MemoryProfileActionAllocatePool,
|
||||
PoolType,
|
||||
Size,
|
||||
*Buffer,
|
||||
NULL
|
||||
);
|
||||
InstallMemoryAttributesTableOnMemoryAllocation (PoolType);
|
||||
}
|
||||
return Status;
|
||||
@ -505,7 +512,14 @@ CoreFreePool (
|
||||
|
||||
Status = CoreInternalFreePool (Buffer, &PoolType);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
CoreUpdateProfile ((EFI_PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS (0), MemoryProfileActionFreePool, PoolType, 0, Buffer);
|
||||
CoreUpdateProfile (
|
||||
(EFI_PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS (0),
|
||||
MemoryProfileActionFreePool,
|
||||
PoolType,
|
||||
0,
|
||||
Buffer,
|
||||
NULL
|
||||
);
|
||||
InstallMemoryAttributesTableOnMemoryAllocation (PoolType);
|
||||
}
|
||||
return Status;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
SMM Memory page management functions.
|
||||
|
||||
Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials are licensed and made available
|
||||
under the terms and conditions of the BSD License which accompanies this
|
||||
distribution. The full text of the license may be found at
|
||||
@ -226,7 +226,14 @@ SmmAllocatePages (
|
||||
|
||||
Status = SmmInternalAllocatePages (Type, MemoryType, NumberOfPages, Memory);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
SmmCoreUpdateProfile ((EFI_PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS (0), MemoryProfileActionAllocatePages, MemoryType, EFI_PAGES_TO_SIZE (NumberOfPages), (VOID *) (UINTN) *Memory);
|
||||
SmmCoreUpdateProfile (
|
||||
(EFI_PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS (0),
|
||||
MemoryProfileActionAllocatePages,
|
||||
MemoryType,
|
||||
EFI_PAGES_TO_SIZE (NumberOfPages),
|
||||
(VOID *) (UINTN) *Memory,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
return Status;
|
||||
}
|
||||
@ -344,7 +351,14 @@ SmmFreePages (
|
||||
|
||||
Status = SmmInternalFreePages (Memory, NumberOfPages);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
SmmCoreUpdateProfile ((EFI_PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS (0), MemoryProfileActionFreePages, 0, EFI_PAGES_TO_SIZE (NumberOfPages), (VOID *) (UINTN) Memory);
|
||||
SmmCoreUpdateProfile (
|
||||
(EFI_PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS (0),
|
||||
MemoryProfileActionFreePages,
|
||||
EfiMaxMemoryType,
|
||||
EFI_PAGES_TO_SIZE (NumberOfPages),
|
||||
(VOID *) (UINTN) Memory,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
return Status;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
SMM Core Main Entry Point
|
||||
|
||||
Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials are licensed and made available
|
||||
under the terms and conditions of the BSD License which accompanies this
|
||||
distribution. The full text of the license may be found at
|
||||
@ -632,6 +632,7 @@ SmmMain (
|
||||
}
|
||||
|
||||
RegisterSmramProfileHandler ();
|
||||
SmramProfileInstallProtocol ();
|
||||
|
||||
SmmCoreInstallLoadedImage ();
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
The internal header file includes the common header files, defines
|
||||
internal structure and functions used by SmmCore module.
|
||||
|
||||
Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials are licensed and made available
|
||||
under the terms and conditions of the BSD License which accompanies this
|
||||
distribution. The full text of the license may be found at
|
||||
@ -42,6 +42,7 @@
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/PeCoffLib.h>
|
||||
#include <Library/PeCoffGetEntryPointLib.h>
|
||||
#include <Library/CacheMaintenanceLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/ReportStatusCodeLib.h>
|
||||
@ -884,17 +885,28 @@ SmramProfileInit (
|
||||
VOID
|
||||
);
|
||||
|
||||
/**
|
||||
Install SMRAM profile protocol.
|
||||
|
||||
**/
|
||||
VOID
|
||||
SmramProfileInstallProtocol (
|
||||
VOID
|
||||
);
|
||||
|
||||
/**
|
||||
Register SMM image to SMRAM profile.
|
||||
|
||||
@param DriverEntry SMM image info.
|
||||
@param RegisterToDxe Register image to DXE.
|
||||
|
||||
@retval TRUE Register success.
|
||||
@retval FALSE Register fail.
|
||||
@return EFI_SUCCESS Register successfully.
|
||||
@return EFI_UNSUPPORTED Memory profile unsupported,
|
||||
or memory profile for the image is not required.
|
||||
@return EFI_OUT_OF_RESOURCES No enough resource for this register.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
EFI_STATUS
|
||||
RegisterSmramProfileImage (
|
||||
IN EFI_SMM_DRIVER_ENTRY *DriverEntry,
|
||||
IN BOOLEAN RegisterToDxe
|
||||
@ -906,11 +918,13 @@ RegisterSmramProfileImage (
|
||||
@param DriverEntry SMM image info.
|
||||
@param UnregisterToDxe Unregister image from DXE.
|
||||
|
||||
@retval TRUE Unregister success.
|
||||
@retval FALSE Unregister fail.
|
||||
@return EFI_SUCCESS Unregister successfully.
|
||||
@return EFI_UNSUPPORTED Memory profile unsupported,
|
||||
or memory profile for the image is not required.
|
||||
@return EFI_NOT_FOUND The image is not found.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
EFI_STATUS
|
||||
UnregisterSmramProfileImage (
|
||||
IN EFI_SMM_DRIVER_ENTRY *DriverEntry,
|
||||
IN BOOLEAN UnregisterToDxe
|
||||
@ -922,20 +936,31 @@ UnregisterSmramProfileImage (
|
||||
@param CallerAddress Address of caller who call Allocate or Free.
|
||||
@param Action This Allocate or Free action.
|
||||
@param MemoryType Memory type.
|
||||
EfiMaxMemoryType means the MemoryType is unknown.
|
||||
@param Size Buffer size.
|
||||
@param Buffer Buffer address.
|
||||
@param ActionString String for memory profile action.
|
||||
Only needed for user defined allocate action.
|
||||
|
||||
@retval TRUE Profile udpate success.
|
||||
@retval FALSE Profile update fail.
|
||||
@return EFI_SUCCESS Memory profile is updated.
|
||||
@return EFI_UNSUPPORTED Memory profile is unsupported,
|
||||
or memory profile for the image is not required,
|
||||
or memory profile for the memory type is not required.
|
||||
@return EFI_ACCESS_DENIED It is during memory profile data getting.
|
||||
@return EFI_ABORTED Memory profile recording is not enabled.
|
||||
@return EFI_OUT_OF_RESOURCES No enough resource to update memory profile for allocate action.
|
||||
@return EFI_NOT_FOUND No matched allocate info found for free action.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SmmCoreUpdateProfile (
|
||||
IN EFI_PHYSICAL_ADDRESS CallerAddress,
|
||||
IN MEMORY_PROFILE_ACTION Action,
|
||||
IN EFI_MEMORY_TYPE MemoryType, // Valid for AllocatePages/AllocatePool
|
||||
IN UINTN Size, // Valid for AllocatePages/FreePages/AllocatePool
|
||||
IN VOID *Buffer
|
||||
IN PHYSICAL_ADDRESS CallerAddress,
|
||||
IN MEMORY_PROFILE_ACTION Action,
|
||||
IN EFI_MEMORY_TYPE MemoryType, // Valid for AllocatePages/AllocatePool
|
||||
IN UINTN Size, // Valid for AllocatePages/FreePages/AllocatePool
|
||||
IN VOID *Buffer,
|
||||
IN CHAR8 *ActionString OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -1,7 +1,7 @@
|
||||
## @file
|
||||
# This module provide an SMM CIS compliant implementation of SMM Core.
|
||||
#
|
||||
# Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
@ -48,6 +48,7 @@
|
||||
BaseLib
|
||||
BaseMemoryLib
|
||||
PeCoffLib
|
||||
PeCoffGetEntryPointLib
|
||||
CacheMaintenanceLib
|
||||
DebugLib
|
||||
ReportStatusCodeLib
|
||||
@ -81,6 +82,7 @@
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdLoadModuleAtFixAddressEnable ## CONSUMES
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdMemoryProfileMemoryType ## CONSUMES
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdMemoryProfilePropertyMask ## CONSUMES
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdMemoryProfileDriverPath ## CONSUMES
|
||||
|
||||
[Guids]
|
||||
gAprioriGuid ## SOMETIMES_CONSUMES ## File
|
||||
@ -92,6 +94,8 @@
|
||||
## SOMETIMES_CONSUMES ## GUID # Locate protocol
|
||||
## SOMETIMES_PRODUCES ## GUID # SmiHandlerRegister
|
||||
gEdkiiMemoryProfileGuid
|
||||
## SOMETIMES_PRODUCES ## GUID # Install protocol
|
||||
gEdkiiSmmMemoryProfileGuid
|
||||
gZeroGuid ## SOMETIMES_CONSUMES ## GUID
|
||||
|
||||
[UserExtensions.TianoCore."ExtraFiles"]
|
||||
|
@ -1556,7 +1556,7 @@ SmmIplEntry (
|
||||
}
|
||||
|
||||
if (gSmmCorePrivate->SmramRanges[Index].CpuStart >= BASE_1MB) {
|
||||
if ((gSmmCorePrivate->SmramRanges[Index].CpuStart + gSmmCorePrivate->SmramRanges[Index].PhysicalSize) <= BASE_4GB) {
|
||||
if ((gSmmCorePrivate->SmramRanges[Index].CpuStart + gSmmCorePrivate->SmramRanges[Index].PhysicalSize - 1) <= MAX_ADDRESS) {
|
||||
if (gSmmCorePrivate->SmramRanges[Index].PhysicalSize >= MaxSize) {
|
||||
MaxSize = gSmmCorePrivate->SmramRanges[Index].PhysicalSize;
|
||||
mCurrentSmramRange = &gSmmCorePrivate->SmramRanges[Index];
|
||||
|
@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
SMM Memory pool management functions.
|
||||
|
||||
Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials are licensed and made available
|
||||
under the terms and conditions of the BSD License which accompanies this
|
||||
distribution. The full text of the license may be found at
|
||||
@ -67,7 +67,7 @@ SmmInitializeMemoryServices (
|
||||
}
|
||||
|
||||
if (SmramRanges[Index].CpuStart >= BASE_1MB) {
|
||||
if ((SmramRanges[Index].CpuStart + SmramRanges[Index].PhysicalSize) <= BASE_4GB) {
|
||||
if ((SmramRanges[Index].CpuStart + SmramRanges[Index].PhysicalSize - 1) <= MAX_ADDRESS) {
|
||||
if (SmramRanges[Index].PhysicalSize >= MaxSize) {
|
||||
MaxSize = SmramRanges[Index].PhysicalSize;
|
||||
CurrentSmramRangesIndex = Index;
|
||||
@ -260,7 +260,14 @@ SmmAllocatePool (
|
||||
|
||||
Status = SmmInternalAllocatePool (PoolType, Size, Buffer);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
SmmCoreUpdateProfile ((EFI_PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS (0), MemoryProfileActionAllocatePool, PoolType, Size, *Buffer);
|
||||
SmmCoreUpdateProfile (
|
||||
(EFI_PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS (0),
|
||||
MemoryProfileActionAllocatePool,
|
||||
PoolType,
|
||||
Size,
|
||||
*Buffer,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
return Status;
|
||||
}
|
||||
@ -319,7 +326,14 @@ SmmFreePool (
|
||||
|
||||
Status = SmmInternalFreePool (Buffer);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
SmmCoreUpdateProfile ((EFI_PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS (0), MemoryProfileActionFreePool, 0, 0, Buffer);
|
||||
SmmCoreUpdateProfile (
|
||||
(EFI_PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS (0),
|
||||
MemoryProfileActionFreePool,
|
||||
EfiMaxMemoryType,
|
||||
0,
|
||||
Buffer,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
return Status;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -15,6 +15,8 @@
|
||||
#ifndef _MEMORY_PROFILE_H_
|
||||
#define _MEMORY_PROFILE_H_
|
||||
|
||||
#include <Pi/PiFirmwareFile.h>
|
||||
|
||||
//
|
||||
// For BIOS MemoryType (0 ~ EfiMaxMemoryType - 1), it is recorded in UsageByType[MemoryType]. (Each valid entry has one entry)
|
||||
// For OS MemoryType (0x80000000 ~ 0xFFFFFFFF), it is recorded in UsageByType[EfiMaxMemoryType]. (All types are combined into one entry)
|
||||
@ -42,7 +44,7 @@ typedef struct {
|
||||
} MEMORY_PROFILE_CONTEXT;
|
||||
|
||||
#define MEMORY_PROFILE_DRIVER_INFO_SIGNATURE SIGNATURE_32 ('M','P','D','I')
|
||||
#define MEMORY_PROFILE_DRIVER_INFO_REVISION 0x0002
|
||||
#define MEMORY_PROFILE_DRIVER_INFO_REVISION 0x0003
|
||||
|
||||
typedef struct {
|
||||
MEMORY_PROFILE_COMMON_HEADER Header;
|
||||
@ -58,6 +60,9 @@ typedef struct {
|
||||
UINT64 PeakUsage;
|
||||
UINT64 CurrentUsageByType[EfiMaxMemoryType + 2];
|
||||
UINT64 PeakUsageByType[EfiMaxMemoryType + 2];
|
||||
UINT16 PdbStringOffset;
|
||||
UINT8 Reserved2[6];
|
||||
//CHAR8 PdbString[];
|
||||
} MEMORY_PROFILE_DRIVER_INFO;
|
||||
|
||||
typedef enum {
|
||||
@ -67,8 +72,75 @@ typedef enum {
|
||||
MemoryProfileActionFreePool = 4,
|
||||
} MEMORY_PROFILE_ACTION;
|
||||
|
||||
//
|
||||
// Below is the detailed MEMORY_PROFILE_ACTION definition.
|
||||
//
|
||||
// 31 15 9 8 8 7 7 6 6 5-4 3 - 0
|
||||
// +----------------------------------------------+
|
||||
// |User | |Lib| |Re|Copy|Zero|Align|Type|Basic|
|
||||
// +----------------------------------------------+
|
||||
//
|
||||
|
||||
//
|
||||
// Basic Action
|
||||
// 1 : AllocatePages
|
||||
// 2 : FreePages
|
||||
// 3 : AllocatePool
|
||||
// 4 : FreePool
|
||||
//
|
||||
#define MEMORY_PROFILE_ACTION_BASIC_MASK 0xF
|
||||
|
||||
//
|
||||
// Extension
|
||||
//
|
||||
#define MEMORY_PROFILE_ACTION_EXTENSION_MASK 0xFFF0
|
||||
#define MEMORY_PROFILE_ACTION_EXTENSION_LIB_MASK 0x8000
|
||||
#define MEMORY_PROFILE_ACTION_EXTENSION_REALLOC_MASK 0x0200
|
||||
#define MEMORY_PROFILE_ACTION_EXTENSION_COPY_MASK 0x0100
|
||||
#define MEMORY_PROFILE_ACTION_EXTENSION_ZERO_MASK 0x0080
|
||||
#define MEMORY_PROFILE_ACTION_EXTENSION_ALIGN_MASK 0x0040
|
||||
#define MEMORY_PROFILE_ACTION_EXTENSION_MEM_TYPE_MASK 0x0030
|
||||
#define MEMORY_PROFILE_ACTION_EXTENSION_MEM_TYPE_BASIC 0x0000
|
||||
#define MEMORY_PROFILE_ACTION_EXTENSION_MEM_TYPE_RUNTIME 0x0010
|
||||
#define MEMORY_PROFILE_ACTION_EXTENSION_MEM_TYPE_RESERVED 0x0020
|
||||
|
||||
//
|
||||
// Extension (used by memory allocation lib)
|
||||
//
|
||||
#define MEMORY_PROFILE_ACTION_LIB_ALLOCATE_PAGES 0x8001
|
||||
#define MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RUNTIME_PAGES 0x8011
|
||||
#define MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RESERVED_PAGES 0x8021
|
||||
#define MEMORY_PROFILE_ACTION_LIB_FREE_PAGES 0x8002
|
||||
#define MEMORY_PROFILE_ACTION_LIB_ALLOCATE_ALIGNED_PAGES 0x8041
|
||||
#define MEMORY_PROFILE_ACTION_LIB_ALLOCATE_ALIGNED_RUNTIME_PAGES 0x8051
|
||||
#define MEMORY_PROFILE_ACTION_LIB_ALLOCATE_ALIGNED_RESERVED_PAGES 0x8061
|
||||
#define MEMORY_PROFILE_ACTION_LIB_FREE_ALIGNED_PAGES 0x8042
|
||||
#define MEMORY_PROFILE_ACTION_LIB_ALLOCATE_POOL 0x8003
|
||||
#define MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RUNTIME_POOL 0x8013
|
||||
#define MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RESERVED_POOL 0x8023
|
||||
#define MEMORY_PROFILE_ACTION_LIB_FREE_POOL 0x8004
|
||||
#define MEMORY_PROFILE_ACTION_LIB_ALLOCATE_ZERO_POOL 0x8083
|
||||
#define MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RUNTIME_ZERO_POOL 0x8093
|
||||
#define MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RESERVED_ZERO_POOL 0x80a3
|
||||
#define MEMORY_PROFILE_ACTION_LIB_ALLOCATE_COPY_POOL 0x8103
|
||||
#define MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RUNTIME_COPY_POOL 0x8113
|
||||
#define MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RESERVED_COPY_POOL 0x8123
|
||||
#define MEMORY_PROFILE_ACTION_LIB_REALLOCATE_POOL 0x8203
|
||||
#define MEMORY_PROFILE_ACTION_LIB_REALLOCATE_RUNTIME_POOL 0x8213
|
||||
#define MEMORY_PROFILE_ACTION_LIB_REALLOCATE_RESERVED_POOL 0x8223
|
||||
|
||||
//
|
||||
// User defined: 0x80000000~0xFFFFFFFF
|
||||
//
|
||||
// NOTE: User defined action MUST OR the basic action,
|
||||
// so that core can know the action is allocate or free,
|
||||
// and the type is pages (can be freed partially)
|
||||
// or pool (cannot be freed partially).
|
||||
//
|
||||
#define MEMORY_PROFILE_ACTION_USER_DEFINED_MASK 0x80000000
|
||||
|
||||
#define MEMORY_PROFILE_ALLOC_INFO_SIGNATURE SIGNATURE_32 ('M','P','A','I')
|
||||
#define MEMORY_PROFILE_ALLOC_INFO_REVISION 0x0001
|
||||
#define MEMORY_PROFILE_ALLOC_INFO_REVISION 0x0002
|
||||
|
||||
typedef struct {
|
||||
MEMORY_PROFILE_COMMON_HEADER Header;
|
||||
@ -79,6 +151,9 @@ typedef struct {
|
||||
EFI_MEMORY_TYPE MemoryType;
|
||||
PHYSICAL_ADDRESS Buffer;
|
||||
UINT64 Size;
|
||||
UINT16 ActionStringOffset;
|
||||
UINT8 Reserved2[6];
|
||||
//CHAR8 ActionString[];
|
||||
} MEMORY_PROFILE_ALLOC_INFO;
|
||||
|
||||
#define MEMORY_PROFILE_DESCRIPTOR_SIGNATURE SIGNATURE_32 ('M','P','D','R')
|
||||
@ -141,6 +216,7 @@ typedef struct _EDKII_MEMORY_PROFILE_PROTOCOL EDKII_MEMORY_PROFILE_PROTOCOL;
|
||||
@param[out] ProfileBuffer Profile buffer.
|
||||
|
||||
@return EFI_SUCCESS Get the memory profile data successfully.
|
||||
@return EFI_UNSUPPORTED Memory profile is unsupported.
|
||||
@return EFI_BUFFER_TO_SMALL The ProfileSize is too small for the resulting data.
|
||||
ProfileSize is updated with the size required.
|
||||
|
||||
@ -162,8 +238,10 @@ EFI_STATUS
|
||||
@param[in] ImageSize Image size.
|
||||
@param[in] FileType File type of the image.
|
||||
|
||||
@return EFI_SUCCESS Register success.
|
||||
@return EFI_OUT_OF_RESOURCE No enough resource for this register.
|
||||
@return EFI_SUCCESS Register successfully.
|
||||
@return EFI_UNSUPPORTED Memory profile is unsupported,
|
||||
or memory profile for the image is not required.
|
||||
@return EFI_OUT_OF_RESOURCES No enough resource for this register.
|
||||
|
||||
**/
|
||||
typedef
|
||||
@ -184,7 +262,9 @@ EFI_STATUS
|
||||
@param[in] ImageBase Image base address.
|
||||
@param[in] ImageSize Image size.
|
||||
|
||||
@return EFI_SUCCESS Unregister success.
|
||||
@return EFI_SUCCESS Unregister successfully.
|
||||
@return EFI_UNSUPPORTED Memory profile is unsupported,
|
||||
or memory profile for the image is not required.
|
||||
@return EFI_NOT_FOUND The image is not found.
|
||||
|
||||
**/
|
||||
@ -197,10 +277,86 @@ EFI_STATUS
|
||||
IN UINT64 ImageSize
|
||||
);
|
||||
|
||||
#define MEMORY_PROFILE_RECORDING_ENABLE TRUE
|
||||
#define MEMORY_PROFILE_RECORDING_DISABLE FALSE
|
||||
|
||||
/**
|
||||
Get memory profile recording state.
|
||||
|
||||
@param[in] This The EDKII_MEMORY_PROFILE_PROTOCOL instance.
|
||||
@param[out] RecordingState Recording state.
|
||||
|
||||
@return EFI_SUCCESS Memory profile recording state is returned.
|
||||
@return EFI_UNSUPPORTED Memory profile is unsupported.
|
||||
@return EFI_INVALID_PARAMETER RecordingState is NULL.
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EDKII_MEMORY_PROFILE_GET_RECORDING_STATE) (
|
||||
IN EDKII_MEMORY_PROFILE_PROTOCOL *This,
|
||||
OUT BOOLEAN *RecordingState
|
||||
);
|
||||
|
||||
/**
|
||||
Set memory profile recording state.
|
||||
|
||||
@param[in] This The EDKII_MEMORY_PROFILE_PROTOCOL instance.
|
||||
@param[in] RecordingState Recording state.
|
||||
|
||||
@return EFI_SUCCESS Set memory profile recording state successfully.
|
||||
@return EFI_UNSUPPORTED Memory profile is unsupported.
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EDKII_MEMORY_PROFILE_SET_RECORDING_STATE) (
|
||||
IN EDKII_MEMORY_PROFILE_PROTOCOL *This,
|
||||
IN BOOLEAN RecordingState
|
||||
);
|
||||
|
||||
/**
|
||||
Record memory profile of multilevel caller.
|
||||
|
||||
@param[in] This The EDKII_MEMORY_PROFILE_PROTOCOL instance.
|
||||
@param[in] CallerAddress Address of caller.
|
||||
@param[in] Action Memory profile action.
|
||||
@param[in] MemoryType Memory type.
|
||||
EfiMaxMemoryType means the MemoryType is unknown.
|
||||
@param[in] Buffer Buffer address.
|
||||
@param[in] Size Buffer size.
|
||||
@param[in] ActionString String for memory profile action.
|
||||
Only needed for user defined allocate action.
|
||||
|
||||
@return EFI_SUCCESS Memory profile is updated.
|
||||
@return EFI_UNSUPPORTED Memory profile is unsupported,
|
||||
or memory profile for the image is not required,
|
||||
or memory profile for the memory type is not required.
|
||||
@return EFI_ACCESS_DENIED It is during memory profile data getting.
|
||||
@return EFI_ABORTED Memory profile recording is not enabled.
|
||||
@return EFI_OUT_OF_RESOURCES No enough resource to update memory profile for allocate action.
|
||||
@return EFI_NOT_FOUND No matched allocate info found for free action.
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EDKII_MEMORY_PROFILE_RECORD) (
|
||||
IN EDKII_MEMORY_PROFILE_PROTOCOL *This,
|
||||
IN PHYSICAL_ADDRESS CallerAddress,
|
||||
IN MEMORY_PROFILE_ACTION Action,
|
||||
IN EFI_MEMORY_TYPE MemoryType,
|
||||
IN VOID *Buffer,
|
||||
IN UINTN Size,
|
||||
IN CHAR8 *ActionString OPTIONAL
|
||||
);
|
||||
|
||||
struct _EDKII_MEMORY_PROFILE_PROTOCOL {
|
||||
EDKII_MEMORY_PROFILE_GET_DATA GetData;
|
||||
EDKII_MEMORY_PROFILE_REGISTER_IMAGE RegisterImage;
|
||||
EDKII_MEMORY_PROFILE_UNREGISTER_IMAGE UnregisterImage;
|
||||
EDKII_MEMORY_PROFILE_GET_DATA GetData;
|
||||
EDKII_MEMORY_PROFILE_REGISTER_IMAGE RegisterImage;
|
||||
EDKII_MEMORY_PROFILE_UNREGISTER_IMAGE UnregisterImage;
|
||||
EDKII_MEMORY_PROFILE_GET_RECORDING_STATE GetRecordingState;
|
||||
EDKII_MEMORY_PROFILE_SET_RECORDING_STATE SetRecordingState;
|
||||
EDKII_MEMORY_PROFILE_RECORD Record;
|
||||
};
|
||||
|
||||
//
|
||||
@ -246,6 +402,8 @@ struct _EDKII_MEMORY_PROFILE_PROTOCOL {
|
||||
#define SMRAM_PROFILE_COMMAND_UNREGISTER_IMAGE 0x4
|
||||
|
||||
#define SMRAM_PROFILE_COMMAND_GET_PROFILE_DATA_BY_OFFSET 0x5
|
||||
#define SMRAM_PROFILE_COMMAND_GET_RECORDING_STATE 0x6
|
||||
#define SMRAM_PROFILE_COMMAND_SET_RECORDING_STATE 0x7
|
||||
|
||||
typedef struct {
|
||||
UINT32 Command;
|
||||
@ -279,6 +437,11 @@ typedef struct {
|
||||
UINT64 ProfileOffset;
|
||||
} SMRAM_PROFILE_PARAMETER_GET_PROFILE_DATA_BY_OFFSET;
|
||||
|
||||
typedef struct {
|
||||
SMRAM_PROFILE_PARAMETER_HEADER Header;
|
||||
BOOLEAN RecordingState;
|
||||
} SMRAM_PROFILE_PARAMETER_RECORDING_STATE;
|
||||
|
||||
typedef struct {
|
||||
SMRAM_PROFILE_PARAMETER_HEADER Header;
|
||||
EFI_GUID FileName;
|
||||
@ -295,10 +458,18 @@ typedef struct {
|
||||
|
||||
|
||||
#define EDKII_MEMORY_PROFILE_GUID { \
|
||||
0x821c9a09, 0x541a, 0x40f6, 0x9f, 0x43, 0xa, 0xd1, 0x93, 0xa1, 0x2c, 0xfe \
|
||||
0x821c9a09, 0x541a, 0x40f6, { 0x9f, 0x43, 0xa, 0xd1, 0x93, 0xa1, 0x2c, 0xfe } \
|
||||
}
|
||||
|
||||
extern EFI_GUID gEdkiiMemoryProfileGuid;
|
||||
|
||||
typedef EDKII_MEMORY_PROFILE_PROTOCOL EDKII_SMM_MEMORY_PROFILE_PROTOCOL;
|
||||
|
||||
#define EDKII_SMM_MEMORY_PROFILE_GUID { \
|
||||
0xe22bbcca, 0x516a, 0x46a8, { 0x80, 0xe2, 0x67, 0x45, 0xe8, 0x36, 0x93, 0xbd } \
|
||||
}
|
||||
|
||||
extern EFI_GUID gEdkiiSmmMemoryProfileGuid;
|
||||
|
||||
#endif
|
||||
|
||||
|
53
MdeModulePkg/Include/Library/MemoryProfileLib.h
Normal file
53
MdeModulePkg/Include/Library/MemoryProfileLib.h
Normal file
@ -0,0 +1,53 @@
|
||||
/** @file
|
||||
Provides services to record memory profile of multilevel caller.
|
||||
|
||||
Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php.
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _MEMORY_PROFILE_LIB_H_
|
||||
#define _MEMORY_PROFILE_LIB_H_
|
||||
|
||||
#include <Guid/MemoryProfile.h>
|
||||
|
||||
/**
|
||||
Record memory profile of multilevel caller.
|
||||
|
||||
@param[in] CallerAddress Address of caller.
|
||||
@param[in] Action Memory profile action.
|
||||
@param[in] MemoryType Memory type.
|
||||
EfiMaxMemoryType means the MemoryType is unknown.
|
||||
@param[in] Buffer Buffer address.
|
||||
@param[in] Size Buffer size.
|
||||
@param[in] ActionString String for memory profile action.
|
||||
Only needed for user defined allocate action.
|
||||
|
||||
@return EFI_SUCCESS Memory profile is updated.
|
||||
@return EFI_UNSUPPORTED Memory profile is unsupported,
|
||||
or memory profile for the image is not required,
|
||||
or memory profile for the memory type is not required.
|
||||
@return EFI_ACCESS_DENIED It is during memory profile data getting.
|
||||
@return EFI_ABORTED Memory profile recording is not enabled.
|
||||
@return EFI_OUT_OF_RESOURCES No enough resource to update memory profile for allocate action.
|
||||
@return EFI_NOT_FOUND No matched allocate info found for free action.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
MemoryProfileLibRecord (
|
||||
IN PHYSICAL_ADDRESS CallerAddress,
|
||||
IN MEMORY_PROFILE_ACTION Action,
|
||||
IN EFI_MEMORY_TYPE MemoryType,
|
||||
IN VOID *Buffer,
|
||||
IN UINTN Size,
|
||||
IN CHAR8 *ActionString OPTIONAL
|
||||
);
|
||||
|
||||
#endif
|
@ -1,10 +1,10 @@
|
||||
## @file
|
||||
# Memory Allocation Library instance dedicated to DXE Core.
|
||||
# The implementation borrows the DxeCore Memory Allocation services as the primitive
|
||||
# for memory allocation instead of using UEFI boot servces in an indirect way.
|
||||
# It is assumed that this library instance must be linked with DxeCore in this package.
|
||||
# for memory allocation instead of using UEFI boot services in an indirect way.
|
||||
# It is assumed that this library instance must be linked with DxeCore in this package.
|
||||
#
|
||||
# Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2008 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
@ -24,7 +24,7 @@
|
||||
MODULE_TYPE = DXE_CORE
|
||||
VERSION_STRING = 1.0
|
||||
LIBRARY_CLASS = MemoryAllocationLib|DXE_CORE
|
||||
|
||||
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
#
|
||||
@ -34,13 +34,12 @@
|
||||
[Sources]
|
||||
MemoryAllocationLib.c
|
||||
DxeCoreMemoryAllocationServices.h
|
||||
DxeCoreMemoryProfileLibNull.c
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
DebugLib
|
||||
BaseMemoryLib
|
||||
|
||||
|
||||
|
@ -2,10 +2,10 @@
|
||||
// Memory Allocation Library instance dedicated to DXE Core.
|
||||
//
|
||||
// The implementation borrows the DxeCore Memory Allocation services as the primitive
|
||||
// for memory allocation instead of using UEFI boot servces in an indirect way.
|
||||
// for memory allocation instead of using UEFI boot services in an indirect way.
|
||||
// It is assumed that this library instance must be linked with DxeCore in this package.
|
||||
//
|
||||
// Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
// Copyright (c) 2008 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||
//
|
||||
// This program and the accompanying materials
|
||||
// are licensed and made available under the terms and conditions of the BSD License
|
||||
|
@ -0,0 +1,48 @@
|
||||
## @file
|
||||
# Memory Allocation/Profile Library instance dedicated to DXE Core.
|
||||
# The implementation borrows the DxeCore Memory Allocation/profile services as the primitive
|
||||
# for memory allocation/profile instead of using UEFI boot services or memory profile protocol in an indirect way.
|
||||
# It is assumed that this library instance must be linked with DxeCore in this package.
|
||||
#
|
||||
# Copyright (c) 2008 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
# which accompanies this distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#
|
||||
#
|
||||
##
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = DxeCoreMemoryAllocationProfileLib
|
||||
MODULE_UNI_FILE = DxeCoreMemoryAllocationProfileLib.uni
|
||||
FILE_GUID = 7ADD7147-74E8-4583-BE34-B6BC45353BB5
|
||||
MODULE_TYPE = DXE_CORE
|
||||
VERSION_STRING = 1.0
|
||||
LIBRARY_CLASS = MemoryAllocationLib|DXE_CORE
|
||||
LIBRARY_CLASS = MemoryProfileLib|DXE_CORE
|
||||
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
|
||||
#
|
||||
|
||||
[Sources]
|
||||
MemoryAllocationLib.c
|
||||
DxeCoreMemoryAllocationServices.h
|
||||
DxeCoreMemoryProfileLib.c
|
||||
DxeCoreMemoryProfileServices.h
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
DebugLib
|
||||
BaseMemoryLib
|
||||
|
@ -0,0 +1,23 @@
|
||||
// /** @file
|
||||
// Memory Allocation/Profile Library instance dedicated to DXE Core.
|
||||
//
|
||||
// The implementation borrows the DxeCore Memory Allocation/Profile services as the primitive
|
||||
// for memory allocation/profile instead of using UEFI boot services or memory profile protocol in an indirect way.
|
||||
// It is assumed that this library instance must be linked with DxeCore in this package.
|
||||
//
|
||||
// Copyright (c) 2008 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||
//
|
||||
// This program and the accompanying materials
|
||||
// are licensed and made available under the terms and conditions of the BSD License
|
||||
// which accompanies this distribution. The full text of the license may be found at
|
||||
// http://opensource.org/licenses/bsd-license.php
|
||||
// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
//
|
||||
// **/
|
||||
|
||||
|
||||
#string STR_MODULE_ABSTRACT #language en-US "Memory Allocation/Profile Library instance dedicated to DXE Core"
|
||||
|
||||
#string STR_MODULE_DESCRIPTION #language en-US "The implementation borrows the DxeCore Memory Allocation/Profile services as the primitive for memory allocation/profile instead of using UEFI boot services or memory profile protocol in an indirect way. It is assumed that this library instance must be linked with DxeCore in this package."
|
||||
|
@ -0,0 +1,57 @@
|
||||
/** @file
|
||||
Support routines for memory profile for DxeCore.
|
||||
|
||||
Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php.
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
|
||||
#include <PiDxe.h>
|
||||
|
||||
#include <Guid/MemoryProfile.h>
|
||||
|
||||
#include "DxeCoreMemoryProfileServices.h"
|
||||
|
||||
/**
|
||||
Record memory profile of multilevel caller.
|
||||
|
||||
@param[in] CallerAddress Address of caller.
|
||||
@param[in] Action Memory profile action.
|
||||
@param[in] MemoryType Memory type.
|
||||
EfiMaxMemoryType means the MemoryType is unknown.
|
||||
@param[in] Buffer Buffer address.
|
||||
@param[in] Size Buffer size.
|
||||
@param[in] ActionString String for memory profile action.
|
||||
Only needed for user defined allocate action.
|
||||
|
||||
@return EFI_SUCCESS Memory profile is updated.
|
||||
@return EFI_UNSUPPORTED Memory profile is unsupported,
|
||||
or memory profile for the image is not required,
|
||||
or memory profile for the memory type is not required.
|
||||
@return EFI_ACCESS_DENIED It is during memory profile data getting.
|
||||
@return EFI_ABORTED Memory profile recording is not enabled.
|
||||
@return EFI_OUT_OF_RESOURCES No enough resource to update memory profile for allocate action.
|
||||
@return EFI_NOT_FOUND No matched allocate info found for free action.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
MemoryProfileLibRecord (
|
||||
IN PHYSICAL_ADDRESS CallerAddress,
|
||||
IN MEMORY_PROFILE_ACTION Action,
|
||||
IN EFI_MEMORY_TYPE MemoryType,
|
||||
IN VOID *Buffer,
|
||||
IN UINTN Size,
|
||||
IN CHAR8 *ActionString OPTIONAL
|
||||
)
|
||||
{
|
||||
return CoreUpdateProfile (CallerAddress, Action, MemoryType, Size, Buffer, ActionString);
|
||||
}
|
||||
|
@ -0,0 +1,55 @@
|
||||
/** @file
|
||||
Null routines for memory profile for DxeCore.
|
||||
|
||||
Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php.
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
|
||||
#include <PiDxe.h>
|
||||
|
||||
#include <Guid/MemoryProfile.h>
|
||||
|
||||
/**
|
||||
Record memory profile of multilevel caller.
|
||||
|
||||
@param[in] CallerAddress Address of caller.
|
||||
@param[in] Action Memory profile action.
|
||||
@param[in] MemoryType Memory type.
|
||||
EfiMaxMemoryType means the MemoryType is unknown.
|
||||
@param[in] Buffer Buffer address.
|
||||
@param[in] Size Buffer size.
|
||||
@param[in] ActionString String for memory profile action.
|
||||
Only needed for user defined allocate action.
|
||||
|
||||
@return EFI_SUCCESS Memory profile is updated.
|
||||
@return EFI_UNSUPPORTED Memory profile is unsupported,
|
||||
or memory profile for the image is not required,
|
||||
or memory profile for the memory type is not required.
|
||||
@return EFI_ACCESS_DENIED It is during memory profile data getting.
|
||||
@return EFI_ABORTED Memory profile recording is not enabled.
|
||||
@return EFI_OUT_OF_RESOURCES No enough resource to update memory profile for allocate action.
|
||||
@return EFI_NOT_FOUND No matched allocate info found for free action.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
MemoryProfileLibRecord (
|
||||
IN PHYSICAL_ADDRESS CallerAddress,
|
||||
IN MEMORY_PROFILE_ACTION Action,
|
||||
IN EFI_MEMORY_TYPE MemoryType,
|
||||
IN VOID *Buffer,
|
||||
IN UINTN Size,
|
||||
IN CHAR8 *ActionString OPTIONAL
|
||||
)
|
||||
{
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
@ -0,0 +1,54 @@
|
||||
/** @file
|
||||
Contains function prototypes for Memory Profile Services in DxeCore.
|
||||
|
||||
This header file borrows the DxeCore Memory Profile services as the primitive
|
||||
for memory profile.
|
||||
|
||||
Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _DXE_CORE_MEMORY_PROFILE_SERVICES_H_
|
||||
#define _DXE_CORE_MEMORY_PROFILE_SERVICES_H_
|
||||
|
||||
/**
|
||||
Update memory profile information.
|
||||
|
||||
@param CallerAddress Address of caller who call Allocate or Free.
|
||||
@param Action This Allocate or Free action.
|
||||
@param MemoryType Memory type.
|
||||
EfiMaxMemoryType means the MemoryType is unknown.
|
||||
@param Size Buffer size.
|
||||
@param Buffer Buffer address.
|
||||
@param ActionString String for memory profile action.
|
||||
Only needed for user defined allocate action.
|
||||
|
||||
@return EFI_SUCCESS Memory profile is updated.
|
||||
@return EFI_UNSUPPORTED Memory profile is unsupported,
|
||||
or memory profile for the image is not required,
|
||||
or memory profile for the memory type is not required.
|
||||
@return EFI_ACCESS_DENIED It is during memory profile data getting.
|
||||
@return EFI_ABORTED Memory profile recording is not enabled.
|
||||
@return EFI_OUT_OF_RESOURCES No enough resource to update memory profile for allocate action.
|
||||
@return EFI_NOT_FOUND No matched allocate info found for free action.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
CoreUpdateProfile (
|
||||
IN PHYSICAL_ADDRESS CallerAddress,
|
||||
IN MEMORY_PROFILE_ACTION Action,
|
||||
IN EFI_MEMORY_TYPE MemoryType,
|
||||
IN UINTN Size, // Valid for AllocatePages/FreePages/AllocatePool
|
||||
IN VOID *Buffer,
|
||||
IN CHAR8 *ActionString OPTIONAL
|
||||
);
|
||||
|
||||
#endif
|
@ -1,8 +1,9 @@
|
||||
/** @file
|
||||
Support routines for memory allocation routines based
|
||||
on boot services for Dxe phase drivers.
|
||||
on DxeCore Memory Allocation services for DxeCore,
|
||||
with memory profile support.
|
||||
|
||||
Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@ -22,6 +23,8 @@
|
||||
#include <Library/DebugLib.h>
|
||||
#include "DxeCoreMemoryAllocationServices.h"
|
||||
|
||||
#include <Library/MemoryProfileLib.h>
|
||||
|
||||
/**
|
||||
Allocates one or more 4KB pages of a certain memory type.
|
||||
|
||||
@ -74,7 +77,20 @@ AllocatePages (
|
||||
IN UINTN Pages
|
||||
)
|
||||
{
|
||||
return InternalAllocatePages (EfiBootServicesData, Pages);
|
||||
VOID *Buffer;
|
||||
|
||||
Buffer = InternalAllocatePages (EfiBootServicesData, Pages);
|
||||
if (Buffer != NULL) {
|
||||
MemoryProfileLibRecord (
|
||||
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
|
||||
MEMORY_PROFILE_ACTION_LIB_ALLOCATE_PAGES,
|
||||
EfiBootServicesData,
|
||||
Buffer,
|
||||
EFI_PAGES_TO_SIZE (Pages),
|
||||
NULL
|
||||
);
|
||||
}
|
||||
return Buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -96,7 +112,20 @@ AllocateRuntimePages (
|
||||
IN UINTN Pages
|
||||
)
|
||||
{
|
||||
return InternalAllocatePages (EfiRuntimeServicesData, Pages);
|
||||
VOID *Buffer;
|
||||
|
||||
Buffer = InternalAllocatePages (EfiRuntimeServicesData, Pages);
|
||||
if (Buffer != NULL) {
|
||||
MemoryProfileLibRecord (
|
||||
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
|
||||
MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RUNTIME_PAGES,
|
||||
EfiRuntimeServicesData,
|
||||
Buffer,
|
||||
EFI_PAGES_TO_SIZE (Pages),
|
||||
NULL
|
||||
);
|
||||
}
|
||||
return Buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -118,7 +147,20 @@ AllocateReservedPages (
|
||||
IN UINTN Pages
|
||||
)
|
||||
{
|
||||
return InternalAllocatePages (EfiReservedMemoryType, Pages);
|
||||
VOID *Buffer;
|
||||
|
||||
Buffer = InternalAllocatePages (EfiReservedMemoryType, Pages);
|
||||
if (Buffer != NULL) {
|
||||
MemoryProfileLibRecord (
|
||||
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
|
||||
MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RESERVED_PAGES,
|
||||
EfiReservedMemoryType,
|
||||
Buffer,
|
||||
EFI_PAGES_TO_SIZE (Pages),
|
||||
NULL
|
||||
);
|
||||
}
|
||||
return Buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -263,7 +305,20 @@ AllocateAlignedPages (
|
||||
IN UINTN Alignment
|
||||
)
|
||||
{
|
||||
return InternalAllocateAlignedPages (EfiBootServicesData, Pages, Alignment);
|
||||
VOID *Buffer;
|
||||
|
||||
Buffer = InternalAllocateAlignedPages (EfiBootServicesData, Pages, Alignment);
|
||||
if (Buffer != NULL) {
|
||||
MemoryProfileLibRecord (
|
||||
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
|
||||
MEMORY_PROFILE_ACTION_LIB_ALLOCATE_ALIGNED_PAGES,
|
||||
EfiBootServicesData,
|
||||
Buffer,
|
||||
EFI_PAGES_TO_SIZE (Pages),
|
||||
NULL
|
||||
);
|
||||
}
|
||||
return Buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -291,7 +346,20 @@ AllocateAlignedRuntimePages (
|
||||
IN UINTN Alignment
|
||||
)
|
||||
{
|
||||
return InternalAllocateAlignedPages (EfiRuntimeServicesData, Pages, Alignment);
|
||||
VOID *Buffer;
|
||||
|
||||
Buffer = InternalAllocateAlignedPages (EfiRuntimeServicesData, Pages, Alignment);
|
||||
if (Buffer != NULL) {
|
||||
MemoryProfileLibRecord (
|
||||
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
|
||||
MEMORY_PROFILE_ACTION_LIB_ALLOCATE_ALIGNED_RUNTIME_PAGES,
|
||||
EfiRuntimeServicesData,
|
||||
Buffer,
|
||||
EFI_PAGES_TO_SIZE (Pages),
|
||||
NULL
|
||||
);
|
||||
}
|
||||
return Buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -319,7 +387,20 @@ AllocateAlignedReservedPages (
|
||||
IN UINTN Alignment
|
||||
)
|
||||
{
|
||||
return InternalAllocateAlignedPages (EfiReservedMemoryType, Pages, Alignment);
|
||||
VOID *Buffer;
|
||||
|
||||
Buffer = InternalAllocateAlignedPages (EfiReservedMemoryType, Pages, Alignment);
|
||||
if (Buffer != NULL) {
|
||||
MemoryProfileLibRecord (
|
||||
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
|
||||
MEMORY_PROFILE_ACTION_LIB_ALLOCATE_ALIGNED_RESERVED_PAGES,
|
||||
EfiReservedMemoryType,
|
||||
Buffer,
|
||||
EFI_PAGES_TO_SIZE (Pages),
|
||||
NULL
|
||||
);
|
||||
}
|
||||
return Buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -402,7 +483,20 @@ AllocatePool (
|
||||
IN UINTN AllocationSize
|
||||
)
|
||||
{
|
||||
return InternalAllocatePool (EfiBootServicesData, AllocationSize);
|
||||
VOID *Buffer;
|
||||
|
||||
Buffer = InternalAllocatePool (EfiBootServicesData, AllocationSize);
|
||||
if (Buffer != NULL) {
|
||||
MemoryProfileLibRecord (
|
||||
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
|
||||
MEMORY_PROFILE_ACTION_LIB_ALLOCATE_POOL,
|
||||
EfiBootServicesData,
|
||||
Buffer,
|
||||
AllocationSize,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
return Buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -423,7 +517,20 @@ AllocateRuntimePool (
|
||||
IN UINTN AllocationSize
|
||||
)
|
||||
{
|
||||
return InternalAllocatePool (EfiRuntimeServicesData, AllocationSize);
|
||||
VOID *Buffer;
|
||||
|
||||
Buffer = InternalAllocatePool (EfiRuntimeServicesData, AllocationSize);
|
||||
if (Buffer != NULL) {
|
||||
MemoryProfileLibRecord (
|
||||
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
|
||||
MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RUNTIME_POOL,
|
||||
EfiRuntimeServicesData,
|
||||
Buffer,
|
||||
AllocationSize,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
return Buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -444,7 +551,20 @@ AllocateReservedPool (
|
||||
IN UINTN AllocationSize
|
||||
)
|
||||
{
|
||||
return InternalAllocatePool (EfiReservedMemoryType, AllocationSize);
|
||||
VOID *Buffer;
|
||||
|
||||
Buffer = InternalAllocatePool (EfiReservedMemoryType, AllocationSize);
|
||||
if (Buffer != NULL) {
|
||||
MemoryProfileLibRecord (
|
||||
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
|
||||
MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RESERVED_POOL,
|
||||
EfiReservedMemoryType,
|
||||
Buffer,
|
||||
AllocationSize,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
return Buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -495,7 +615,20 @@ AllocateZeroPool (
|
||||
IN UINTN AllocationSize
|
||||
)
|
||||
{
|
||||
return InternalAllocateZeroPool (EfiBootServicesData, AllocationSize);
|
||||
VOID *Buffer;
|
||||
|
||||
Buffer = InternalAllocateZeroPool (EfiBootServicesData, AllocationSize);
|
||||
if (Buffer != NULL) {
|
||||
MemoryProfileLibRecord (
|
||||
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
|
||||
MEMORY_PROFILE_ACTION_LIB_ALLOCATE_ZERO_POOL,
|
||||
EfiBootServicesData,
|
||||
Buffer,
|
||||
AllocationSize,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
return Buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -517,7 +650,20 @@ AllocateRuntimeZeroPool (
|
||||
IN UINTN AllocationSize
|
||||
)
|
||||
{
|
||||
return InternalAllocateZeroPool (EfiRuntimeServicesData, AllocationSize);
|
||||
VOID *Buffer;
|
||||
|
||||
Buffer = InternalAllocateZeroPool (EfiRuntimeServicesData, AllocationSize);
|
||||
if (Buffer != NULL) {
|
||||
MemoryProfileLibRecord (
|
||||
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
|
||||
MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RUNTIME_ZERO_POOL,
|
||||
EfiRuntimeServicesData,
|
||||
Buffer,
|
||||
AllocationSize,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
return Buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -539,7 +685,20 @@ AllocateReservedZeroPool (
|
||||
IN UINTN AllocationSize
|
||||
)
|
||||
{
|
||||
return InternalAllocateZeroPool (EfiReservedMemoryType, AllocationSize);
|
||||
VOID *Buffer;
|
||||
|
||||
Buffer = InternalAllocateZeroPool (EfiReservedMemoryType, AllocationSize);
|
||||
if (Buffer != NULL) {
|
||||
MemoryProfileLibRecord (
|
||||
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
|
||||
MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RESERVED_ZERO_POOL,
|
||||
EfiReservedMemoryType,
|
||||
Buffer,
|
||||
AllocationSize,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
return Buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -602,7 +761,20 @@ AllocateCopyPool (
|
||||
IN CONST VOID *Buffer
|
||||
)
|
||||
{
|
||||
return InternalAllocateCopyPool (EfiBootServicesData, AllocationSize, Buffer);
|
||||
VOID *NewBuffer;
|
||||
|
||||
NewBuffer = InternalAllocateCopyPool (EfiBootServicesData, AllocationSize, Buffer);
|
||||
if (NewBuffer != NULL) {
|
||||
MemoryProfileLibRecord (
|
||||
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
|
||||
MEMORY_PROFILE_ACTION_LIB_ALLOCATE_COPY_POOL,
|
||||
EfiBootServicesData,
|
||||
NewBuffer,
|
||||
AllocationSize,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
return NewBuffer;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -629,7 +801,20 @@ AllocateRuntimeCopyPool (
|
||||
IN CONST VOID *Buffer
|
||||
)
|
||||
{
|
||||
return InternalAllocateCopyPool (EfiRuntimeServicesData, AllocationSize, Buffer);
|
||||
VOID *NewBuffer;
|
||||
|
||||
NewBuffer = InternalAllocateCopyPool (EfiRuntimeServicesData, AllocationSize, Buffer);
|
||||
if (NewBuffer != NULL) {
|
||||
MemoryProfileLibRecord (
|
||||
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
|
||||
MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RUNTIME_COPY_POOL,
|
||||
EfiRuntimeServicesData,
|
||||
NewBuffer,
|
||||
AllocationSize,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
return NewBuffer;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -656,7 +841,20 @@ AllocateReservedCopyPool (
|
||||
IN CONST VOID *Buffer
|
||||
)
|
||||
{
|
||||
return InternalAllocateCopyPool (EfiReservedMemoryType, AllocationSize, Buffer);
|
||||
VOID *NewBuffer;
|
||||
|
||||
NewBuffer = InternalAllocateCopyPool (EfiReservedMemoryType, AllocationSize, Buffer);
|
||||
if (NewBuffer != NULL) {
|
||||
MemoryProfileLibRecord (
|
||||
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
|
||||
MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RESERVED_COPY_POOL,
|
||||
EfiRuntimeServicesData,
|
||||
NewBuffer,
|
||||
AllocationSize,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
return NewBuffer;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -728,7 +926,20 @@ ReallocatePool (
|
||||
IN VOID *OldBuffer OPTIONAL
|
||||
)
|
||||
{
|
||||
return InternalReallocatePool (EfiBootServicesData, OldSize, NewSize, OldBuffer);
|
||||
VOID *Buffer;
|
||||
|
||||
Buffer = InternalReallocatePool (EfiBootServicesData, OldSize, NewSize, OldBuffer);
|
||||
if (Buffer != NULL) {
|
||||
MemoryProfileLibRecord (
|
||||
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
|
||||
MEMORY_PROFILE_ACTION_LIB_REALLOCATE_POOL,
|
||||
EfiBootServicesData,
|
||||
Buffer,
|
||||
NewSize,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
return Buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -760,7 +971,20 @@ ReallocateRuntimePool (
|
||||
IN VOID *OldBuffer OPTIONAL
|
||||
)
|
||||
{
|
||||
return InternalReallocatePool (EfiRuntimeServicesData, OldSize, NewSize, OldBuffer);
|
||||
VOID *Buffer;
|
||||
|
||||
Buffer = InternalReallocatePool (EfiRuntimeServicesData, OldSize, NewSize, OldBuffer);
|
||||
if (Buffer != NULL) {
|
||||
MemoryProfileLibRecord (
|
||||
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
|
||||
MEMORY_PROFILE_ACTION_LIB_REALLOCATE_RUNTIME_POOL,
|
||||
EfiRuntimeServicesData,
|
||||
Buffer,
|
||||
NewSize,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
return Buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -792,7 +1016,20 @@ ReallocateReservedPool (
|
||||
IN VOID *OldBuffer OPTIONAL
|
||||
)
|
||||
{
|
||||
return InternalReallocatePool (EfiReservedMemoryType, OldSize, NewSize, OldBuffer);
|
||||
VOID *Buffer;
|
||||
|
||||
Buffer = InternalReallocatePool (EfiReservedMemoryType, OldSize, NewSize, OldBuffer);
|
||||
if (Buffer != NULL) {
|
||||
MemoryProfileLibRecord (
|
||||
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
|
||||
MEMORY_PROFILE_ACTION_LIB_REALLOCATE_RESERVED_POOL,
|
||||
EfiReservedMemoryType,
|
||||
Buffer,
|
||||
NewSize,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
return Buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,5 +1,6 @@
|
||||
/** @file
|
||||
Support routines for memory allocation routines based on SMM Core internal functions.
|
||||
Support routines for memory allocation routines based on SMM Core internal functions,
|
||||
with memory profile support.
|
||||
|
||||
The PI System Management Mode Core Interface Specification only allows the use
|
||||
of EfiRuntimeServicesCode and EfiRuntimeServicesData memory types for memory
|
||||
@ -10,7 +11,7 @@
|
||||
In addition, allocation for the Reserved memory types are not supported and will
|
||||
always return NULL.
|
||||
|
||||
Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@ -23,13 +24,14 @@
|
||||
|
||||
#include <PiSmm.h>
|
||||
|
||||
#include <Protocol/SmmAccess2.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include "PiSmmCoreMemoryAllocationServices.h"
|
||||
|
||||
#include <Library/MemoryProfileLib.h>
|
||||
|
||||
EFI_SMRAM_DESCRIPTOR *mSmmCoreMemoryAllocLibSmramRanges = NULL;
|
||||
UINTN mSmmCoreMemoryAllocLibSmramRangeCount = 0;
|
||||
|
||||
@ -111,7 +113,20 @@ AllocatePages (
|
||||
IN UINTN Pages
|
||||
)
|
||||
{
|
||||
return InternalAllocatePages (EfiRuntimeServicesData, Pages);
|
||||
VOID *Buffer;
|
||||
|
||||
Buffer = InternalAllocatePages (EfiRuntimeServicesData, Pages);
|
||||
if (Buffer != NULL) {
|
||||
MemoryProfileLibRecord (
|
||||
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
|
||||
MEMORY_PROFILE_ACTION_LIB_ALLOCATE_PAGES,
|
||||
EfiRuntimeServicesData,
|
||||
Buffer,
|
||||
EFI_PAGES_TO_SIZE(Pages),
|
||||
NULL
|
||||
);
|
||||
}
|
||||
return Buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -133,7 +148,20 @@ AllocateRuntimePages (
|
||||
IN UINTN Pages
|
||||
)
|
||||
{
|
||||
return InternalAllocatePages (EfiRuntimeServicesData, Pages);
|
||||
VOID *Buffer;
|
||||
|
||||
Buffer = InternalAllocatePages (EfiRuntimeServicesData, Pages);
|
||||
if (Buffer != NULL) {
|
||||
MemoryProfileLibRecord (
|
||||
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
|
||||
MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RUNTIME_PAGES,
|
||||
EfiRuntimeServicesData,
|
||||
Buffer,
|
||||
EFI_PAGES_TO_SIZE(Pages),
|
||||
NULL
|
||||
);
|
||||
}
|
||||
return Buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -312,7 +340,20 @@ AllocateAlignedPages (
|
||||
IN UINTN Alignment
|
||||
)
|
||||
{
|
||||
return InternalAllocateAlignedPages (EfiRuntimeServicesData, Pages, Alignment);
|
||||
VOID *Buffer;
|
||||
|
||||
Buffer = InternalAllocateAlignedPages (EfiRuntimeServicesData, Pages, Alignment);
|
||||
if (Buffer != NULL) {
|
||||
MemoryProfileLibRecord (
|
||||
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
|
||||
MEMORY_PROFILE_ACTION_LIB_ALLOCATE_ALIGNED_PAGES,
|
||||
EfiRuntimeServicesData,
|
||||
Buffer,
|
||||
EFI_PAGES_TO_SIZE(Pages),
|
||||
NULL
|
||||
);
|
||||
}
|
||||
return Buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -340,7 +381,20 @@ AllocateAlignedRuntimePages (
|
||||
IN UINTN Alignment
|
||||
)
|
||||
{
|
||||
return InternalAllocateAlignedPages (EfiRuntimeServicesData, Pages, Alignment);
|
||||
VOID *Buffer;
|
||||
|
||||
Buffer = InternalAllocateAlignedPages (EfiRuntimeServicesData, Pages, Alignment);
|
||||
if (Buffer != NULL) {
|
||||
MemoryProfileLibRecord (
|
||||
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
|
||||
MEMORY_PROFILE_ACTION_LIB_ALLOCATE_ALIGNED_RUNTIME_PAGES,
|
||||
EfiRuntimeServicesData,
|
||||
Buffer,
|
||||
EFI_PAGES_TO_SIZE(Pages),
|
||||
NULL
|
||||
);
|
||||
}
|
||||
return Buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -463,7 +517,20 @@ AllocatePool (
|
||||
IN UINTN AllocationSize
|
||||
)
|
||||
{
|
||||
return InternalAllocatePool (EfiRuntimeServicesData, AllocationSize);
|
||||
VOID *Buffer;
|
||||
|
||||
Buffer = InternalAllocatePool (EfiRuntimeServicesData, AllocationSize);
|
||||
if (Buffer != NULL) {
|
||||
MemoryProfileLibRecord (
|
||||
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
|
||||
MEMORY_PROFILE_ACTION_LIB_ALLOCATE_POOL,
|
||||
EfiRuntimeServicesData,
|
||||
Buffer,
|
||||
AllocationSize,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
return Buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -484,7 +551,20 @@ AllocateRuntimePool (
|
||||
IN UINTN AllocationSize
|
||||
)
|
||||
{
|
||||
return InternalAllocatePool (EfiRuntimeServicesData, AllocationSize);
|
||||
VOID *Buffer;
|
||||
|
||||
Buffer = InternalAllocatePool (EfiRuntimeServicesData, AllocationSize);
|
||||
if (Buffer != NULL) {
|
||||
MemoryProfileLibRecord (
|
||||
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
|
||||
MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RUNTIME_POOL,
|
||||
EfiRuntimeServicesData,
|
||||
Buffer,
|
||||
AllocationSize,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
return Buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -556,7 +636,20 @@ AllocateZeroPool (
|
||||
IN UINTN AllocationSize
|
||||
)
|
||||
{
|
||||
return InternalAllocateZeroPool (EfiRuntimeServicesData, AllocationSize);
|
||||
VOID *Buffer;
|
||||
|
||||
Buffer = InternalAllocateZeroPool (EfiRuntimeServicesData, AllocationSize);
|
||||
if (Buffer != NULL) {
|
||||
MemoryProfileLibRecord (
|
||||
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
|
||||
MEMORY_PROFILE_ACTION_LIB_ALLOCATE_ZERO_POOL,
|
||||
EfiRuntimeServicesData,
|
||||
Buffer,
|
||||
AllocationSize,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
return Buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -578,7 +671,20 @@ AllocateRuntimeZeroPool (
|
||||
IN UINTN AllocationSize
|
||||
)
|
||||
{
|
||||
return InternalAllocateZeroPool (EfiRuntimeServicesData, AllocationSize);
|
||||
VOID *Buffer;
|
||||
|
||||
Buffer = InternalAllocateZeroPool (EfiRuntimeServicesData, AllocationSize);
|
||||
if (Buffer != NULL) {
|
||||
MemoryProfileLibRecord (
|
||||
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
|
||||
MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RUNTIME_ZERO_POOL,
|
||||
EfiRuntimeServicesData,
|
||||
Buffer,
|
||||
AllocationSize,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
return Buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -663,7 +769,20 @@ AllocateCopyPool (
|
||||
IN CONST VOID *Buffer
|
||||
)
|
||||
{
|
||||
return InternalAllocateCopyPool (EfiRuntimeServicesData, AllocationSize, Buffer);
|
||||
VOID *NewBuffer;
|
||||
|
||||
NewBuffer = InternalAllocateCopyPool (EfiRuntimeServicesData, AllocationSize, Buffer);
|
||||
if (NewBuffer != NULL) {
|
||||
MemoryProfileLibRecord (
|
||||
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
|
||||
MEMORY_PROFILE_ACTION_LIB_ALLOCATE_COPY_POOL,
|
||||
EfiRuntimeServicesData,
|
||||
NewBuffer,
|
||||
AllocationSize,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
return NewBuffer;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -690,7 +809,20 @@ AllocateRuntimeCopyPool (
|
||||
IN CONST VOID *Buffer
|
||||
)
|
||||
{
|
||||
return InternalAllocateCopyPool (EfiRuntimeServicesData, AllocationSize, Buffer);
|
||||
VOID *NewBuffer;
|
||||
|
||||
NewBuffer = InternalAllocateCopyPool (EfiRuntimeServicesData, AllocationSize, Buffer);
|
||||
if (NewBuffer != NULL) {
|
||||
MemoryProfileLibRecord (
|
||||
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
|
||||
MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RUNTIME_COPY_POOL,
|
||||
EfiRuntimeServicesData,
|
||||
NewBuffer,
|
||||
AllocationSize,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
return NewBuffer;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -789,7 +921,20 @@ ReallocatePool (
|
||||
IN VOID *OldBuffer OPTIONAL
|
||||
)
|
||||
{
|
||||
return InternalReallocatePool (EfiRuntimeServicesData, OldSize, NewSize, OldBuffer);
|
||||
VOID *Buffer;
|
||||
|
||||
Buffer = InternalReallocatePool (EfiRuntimeServicesData, OldSize, NewSize, OldBuffer);
|
||||
if (Buffer != NULL) {
|
||||
MemoryProfileLibRecord (
|
||||
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
|
||||
MEMORY_PROFILE_ACTION_LIB_REALLOCATE_POOL,
|
||||
EfiRuntimeServicesData,
|
||||
Buffer,
|
||||
NewSize,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
return Buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -821,7 +966,20 @@ ReallocateRuntimePool (
|
||||
IN VOID *OldBuffer OPTIONAL
|
||||
)
|
||||
{
|
||||
return InternalReallocatePool (EfiRuntimeServicesData, OldSize, NewSize, OldBuffer);
|
||||
VOID *Buffer;
|
||||
|
||||
Buffer = InternalReallocatePool (EfiRuntimeServicesData, OldSize, NewSize, OldBuffer);
|
||||
if (Buffer != NULL) {
|
||||
MemoryProfileLibRecord (
|
||||
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
|
||||
MEMORY_PROFILE_ACTION_LIB_REALLOCATE_RUNTIME_POOL,
|
||||
EfiRuntimeServicesData,
|
||||
Buffer,
|
||||
NewSize,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
return Buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,10 +1,10 @@
|
||||
## @file
|
||||
# Memory Allocation Library instance dedicated to SMM Core.
|
||||
# The implementation borrows the SMM Core Memory Allocation services as the primitive
|
||||
# for memory allocation instead of using SMM System Table servces in an indirect way.
|
||||
# It is assumed that this library instance must be linked with SMM Cre in this package.
|
||||
# for memory allocation instead of using SMM System Table services in an indirect way.
|
||||
# It is assumed that this library instance must be linked with SMM Cre in this package.
|
||||
#
|
||||
# Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
@ -35,14 +35,13 @@
|
||||
[Sources]
|
||||
MemoryAllocationLib.c
|
||||
PiSmmCoreMemoryAllocationServices.h
|
||||
PiSmmCoreMemoryProfileLibNull.c
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
DebugLib
|
||||
BaseMemoryLib
|
||||
UefiBootServicesTableLib
|
||||
|
||||
[Protocols]
|
||||
gEfiSmmAccess2ProtocolGuid ## CONSUMES
|
||||
|
@ -2,10 +2,10 @@
|
||||
// Memory Allocation Library instance dedicated to SMM Core.
|
||||
//
|
||||
// The implementation borrows the SMM Core Memory Allocation services as the primitive
|
||||
// for memory allocation instead of using SMM System Table servces in an indirect way.
|
||||
// for memory allocation instead of using SMM System Table services in an indirect way.
|
||||
// It is assumed that this library instance must be linked with SMM Cre in this package.
|
||||
//
|
||||
// Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
// Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||
//
|
||||
// This program and the accompanying materials
|
||||
// are licensed and made available under the terms and conditions of the BSD License
|
||||
|
@ -0,0 +1,54 @@
|
||||
## @file
|
||||
# Memory Allocation/Profile Library instance dedicated to SMM Core.
|
||||
# The implementation borrows the SMM Core Memory Allocation/Profile services as the primitive
|
||||
# for memory allocation/profile instead of using SMM System Table servces or SMM memory profile protocol in an indirect way.
|
||||
# It is assumed that this library instance must be linked with SMM Cre in this package.
|
||||
#
|
||||
# Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
# which accompanies this distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#
|
||||
##
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = PiSmmCoreMemoryAllocationProfileLib
|
||||
MODULE_UNI_FILE = PiSmmCoreMemoryAllocationProfileLib.uni
|
||||
FILE_GUID = D55E42AD-3E63-4536-8281-82C0F1098C5E
|
||||
MODULE_TYPE = SMM_CORE
|
||||
VERSION_STRING = 1.0
|
||||
PI_SPECIFICATION_VERSION = 0x0001000A
|
||||
LIBRARY_CLASS = MemoryAllocationLib|SMM_CORE
|
||||
CONSTRUCTOR = PiSmmCoreMemoryAllocationLibConstructor
|
||||
LIBRARY_CLASS = MemoryProfileLib|SMM_CORE
|
||||
CONSTRUCTOR = PiSmmCoreMemoryProfileLibConstructor
|
||||
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32 X64
|
||||
#
|
||||
|
||||
[Sources]
|
||||
MemoryAllocationLib.c
|
||||
PiSmmCoreMemoryAllocationServices.h
|
||||
PiSmmCoreMemoryProfileLib.c
|
||||
PiSmmCoreMemoryProfileServices.h
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
DebugLib
|
||||
BaseMemoryLib
|
||||
UefiBootServicesTableLib
|
||||
|
||||
[Guids]
|
||||
gEdkiiMemoryProfileGuid ## SOMETIMES_CONSUMES ## GUID # Locate protocol
|
||||
|
@ -0,0 +1,23 @@
|
||||
// /** @file
|
||||
// Memory Allocation/Profile Library instance dedicated to SMM Core.
|
||||
//
|
||||
// The implementation borrows the SMM Core Memory Allocation/Profile services as the primitive
|
||||
// for memory allocation/profile instead of using SMM System Table servces or SMM memory profile protocol in an indirect way.
|
||||
// It is assumed that this library instance must be linked with SMM Cre in this package.
|
||||
//
|
||||
// Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||
//
|
||||
// This program and the accompanying materials
|
||||
// are licensed and made available under the terms and conditions of the BSD License
|
||||
// which accompanies this distribution. The full text of the license may be found at
|
||||
// http://opensource.org/licenses/bsd-license.php
|
||||
// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
//
|
||||
// **/
|
||||
|
||||
|
||||
#string STR_MODULE_ABSTRACT #language en-US "Memory Allocation/Profile Library instance dedicated to SMM Core"
|
||||
|
||||
#string STR_MODULE_DESCRIPTION #language en-US "The implementation borrows the SMM Core Memory Allocation/Profile services as the primitive for memory allocation/profile instead of using SMM System Table services or SMM memory profile protocol in an indirect way. This library is only intended to be linked with the SMM Core that resides in this same package."
|
||||
|
@ -0,0 +1,123 @@
|
||||
/** @file
|
||||
Support routines for memory profile for PiSmmCore.
|
||||
|
||||
Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php.
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#include <PiSmm.h>
|
||||
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
|
||||
#include <Guid/MemoryProfile.h>
|
||||
|
||||
#include "PiSmmCoreMemoryProfileServices.h"
|
||||
|
||||
EDKII_MEMORY_PROFILE_PROTOCOL *mLibProfileProtocol;
|
||||
|
||||
/**
|
||||
Check whether the start address of buffer is within any of the SMRAM ranges.
|
||||
|
||||
@param[in] Buffer The pointer to the buffer to be checked.
|
||||
|
||||
@retval TURE The buffer is in SMRAM ranges.
|
||||
@retval FALSE The buffer is out of SMRAM ranges.
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
BufferInSmram (
|
||||
IN VOID *Buffer
|
||||
);
|
||||
|
||||
/**
|
||||
The constructor function initializes memory profile for SMM phase.
|
||||
|
||||
@param ImageHandle The firmware allocated handle for the EFI image.
|
||||
@param SystemTable A pointer to the EFI System Table.
|
||||
|
||||
@retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PiSmmCoreMemoryProfileLibConstructor (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
//
|
||||
// Locate Profile Protocol
|
||||
//
|
||||
Status = gBS->LocateProtocol (
|
||||
&gEdkiiMemoryProfileGuid,
|
||||
NULL,
|
||||
(VOID **)&mLibProfileProtocol
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
mLibProfileProtocol = NULL;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
Record memory profile of multilevel caller.
|
||||
|
||||
@param[in] CallerAddress Address of caller.
|
||||
@param[in] Action Memory profile action.
|
||||
@param[in] MemoryType Memory type.
|
||||
EfiMaxMemoryType means the MemoryType is unknown.
|
||||
@param[in] Buffer Buffer address.
|
||||
@param[in] Size Buffer size.
|
||||
@param[in] ActionString String for memory profile action.
|
||||
Only needed for user defined allocate action.
|
||||
|
||||
@return EFI_SUCCESS Memory profile is updated.
|
||||
@return EFI_UNSUPPORTED Memory profile is unsupported,
|
||||
or memory profile for the image is not required,
|
||||
or memory profile for the memory type is not required.
|
||||
@return EFI_ACCESS_DENIED It is during memory profile data getting.
|
||||
@return EFI_ABORTED Memory profile recording is not enabled.
|
||||
@return EFI_OUT_OF_RESOURCES No enough resource to update memory profile for allocate action.
|
||||
@return EFI_NOT_FOUND No matched allocate info found for free action.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
MemoryProfileLibRecord (
|
||||
IN PHYSICAL_ADDRESS CallerAddress,
|
||||
IN MEMORY_PROFILE_ACTION Action,
|
||||
IN EFI_MEMORY_TYPE MemoryType,
|
||||
IN VOID *Buffer,
|
||||
IN UINTN Size,
|
||||
IN CHAR8 *ActionString OPTIONAL
|
||||
)
|
||||
{
|
||||
if (BufferInSmram (Buffer)) {
|
||||
return SmmCoreUpdateProfile (CallerAddress, Action, MemoryType, Size, Buffer, ActionString);
|
||||
} else {
|
||||
if (mLibProfileProtocol == NULL) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
return mLibProfileProtocol->Record (
|
||||
mLibProfileProtocol,
|
||||
CallerAddress,
|
||||
Action,
|
||||
MemoryType,
|
||||
Buffer,
|
||||
Size,
|
||||
ActionString
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,54 @@
|
||||
/** @file
|
||||
Null routines for memory profile for PiSmmCore.
|
||||
|
||||
Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php.
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#include <PiSmm.h>
|
||||
|
||||
#include <Guid/MemoryProfile.h>
|
||||
|
||||
/**
|
||||
Record memory profile of multilevel caller.
|
||||
|
||||
@param[in] CallerAddress Address of caller.
|
||||
@param[in] Action Memory profile action.
|
||||
@param[in] MemoryType Memory type.
|
||||
EfiMaxMemoryType means the MemoryType is unknown.
|
||||
@param[in] Buffer Buffer address.
|
||||
@param[in] Size Buffer size.
|
||||
@param[in] ActionString String for memory profile action.
|
||||
Only needed for user defined allocate action.
|
||||
|
||||
@return EFI_SUCCESS Memory profile is updated.
|
||||
@return EFI_UNSUPPORTED Memory profile is unsupported,
|
||||
or memory profile for the image is not required,
|
||||
or memory profile for the memory type is not required.
|
||||
@return EFI_ACCESS_DENIED It is during memory profile data getting.
|
||||
@return EFI_ABORTED Memory profile recording is not enabled.
|
||||
@return EFI_OUT_OF_RESOURCES No enough resource to update memory profile for allocate action.
|
||||
@return EFI_NOT_FOUND No matched allocate info found for free action.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
MemoryProfileLibRecord (
|
||||
IN PHYSICAL_ADDRESS CallerAddress,
|
||||
IN MEMORY_PROFILE_ACTION Action,
|
||||
IN EFI_MEMORY_TYPE MemoryType,
|
||||
IN VOID *Buffer,
|
||||
IN UINTN Size,
|
||||
IN CHAR8 *ActionString OPTIONAL
|
||||
)
|
||||
{
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
@ -0,0 +1,54 @@
|
||||
/** @file
|
||||
Contains function prototypes for Memory Profile Services in the SMM Core.
|
||||
|
||||
This header file borrows the PiSmmCore Memory Profile services as the primitive
|
||||
for memory profile.
|
||||
|
||||
Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _PI_SMM_CORE_MEMORY_PROFILE_SERVICES_H_
|
||||
#define _PI_SMM_CORE_MEMORY_PROFILE_SERVICES_H_
|
||||
|
||||
/**
|
||||
Update SMRAM profile information.
|
||||
|
||||
@param CallerAddress Address of caller who call Allocate or Free.
|
||||
@param Action This Allocate or Free action.
|
||||
@param MemoryType Memory type.
|
||||
EfiMaxMemoryType means the MemoryType is unknown.
|
||||
@param Size Buffer size.
|
||||
@param Buffer Buffer address.
|
||||
@param ActionString String for memory profile action.
|
||||
Only needed for user defined allocate action.
|
||||
|
||||
@return EFI_SUCCESS Memory profile is updated.
|
||||
@return EFI_UNSUPPORTED Memory profile is unsupported,
|
||||
or memory profile for the image is not required,
|
||||
or memory profile for the memory type is not required.
|
||||
@return EFI_ACCESS_DENIED It is during memory profile data getting.
|
||||
@return EFI_ABORTED Memory profile recording is not enabled.
|
||||
@return EFI_OUT_OF_RESOURCES No enough resource to update memory profile for allocate action.
|
||||
@return EFI_NOT_FOUND No matched allocate info found for free action.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SmmCoreUpdateProfile (
|
||||
IN PHYSICAL_ADDRESS CallerAddress,
|
||||
IN MEMORY_PROFILE_ACTION Action,
|
||||
IN EFI_MEMORY_TYPE MemoryType, // Valid for AllocatePages/AllocatePool
|
||||
IN UINTN Size, // Valid for AllocatePages/FreePages/AllocatePool
|
||||
IN VOID *Buffer,
|
||||
IN CHAR8 *ActionString OPTIONAL
|
||||
);
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,62 @@
|
||||
## @file
|
||||
# Instance of Memory Allocation Library using SMM Services Table,
|
||||
# with memory profile support.
|
||||
#
|
||||
# Memory Allocation Library that uses services from the SMM Services Table to
|
||||
# allocate and free memory, with memory profile support.
|
||||
#
|
||||
# The implementation of this instance is copied from UefiMemoryAllocationLib
|
||||
# in MdePkg and updated to support both MemoryAllocationLib and MemoryProfileLib.
|
||||
#
|
||||
# Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||
# This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
# which accompanies this distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php.
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#
|
||||
##
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = SmmMemoryAllocationProfileLib
|
||||
MODULE_UNI_FILE = SmmMemoryAllocationProfileLib.uni
|
||||
FILE_GUID = DC50729F-8633-47ab-8FD3-6939688CEE4C
|
||||
MODULE_TYPE = DXE_SMM_DRIVER
|
||||
VERSION_STRING = 1.0
|
||||
PI_SPECIFICATION_VERSION = 0x0001000A
|
||||
LIBRARY_CLASS = MemoryAllocationLib|DXE_SMM_DRIVER
|
||||
CONSTRUCTOR = SmmMemoryAllocationLibConstructor
|
||||
DESTRUCTOR = SmmMemoryAllocationLibDestructor
|
||||
LIBRARY_CLASS = MemoryProfileLib|DXE_SMM_DRIVER
|
||||
CONSTRUCTOR = SmmMemoryProfileLibConstructor
|
||||
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32 X64
|
||||
#
|
||||
|
||||
[Sources]
|
||||
MemoryAllocationLib.c
|
||||
SmmMemoryProfileLib.c
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
DebugLib
|
||||
BaseMemoryLib
|
||||
SmmServicesTableLib
|
||||
UefiBootServicesTableLib
|
||||
|
||||
[Protocols]
|
||||
gEfiSmmAccess2ProtocolGuid ## CONSUMES
|
||||
|
||||
[Guids]
|
||||
gEdkiiMemoryProfileGuid ## SOMETIMES_CONSUMES ## GUID # Locate protocol
|
||||
gEdkiiSmmMemoryProfileGuid ## SOMETIMES_CONSUMES ## GUID # Locate protocol
|
||||
|
||||
[Depex]
|
||||
gEfiSmmAccess2ProtocolGuid
|
||||
|
@ -0,0 +1,23 @@
|
||||
// /** @file
|
||||
// Instance of Memory Allocation Library using SMM Services Table,
|
||||
// with memory profile support.
|
||||
//
|
||||
// Memory Allocation Library that uses services from the SMM Services Table to
|
||||
// allocate and free memory, with memory profile support.
|
||||
//
|
||||
// Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||
//
|
||||
// This program and the accompanying materials
|
||||
// are licensed and made available under the terms and conditions of the BSD License
|
||||
// which accompanies this distribution. The full text of the license may be found at
|
||||
// http://opensource.org/licenses/bsd-license.php.
|
||||
// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
//
|
||||
// **/
|
||||
|
||||
|
||||
#string STR_MODULE_ABSTRACT #language en-US "Instance of Memory Allocation Library using SMM Services Table, with memory profile support"
|
||||
|
||||
#string STR_MODULE_DESCRIPTION #language en-US "This Memory Allocation Library uses services from the SMM Services Table to allocate and free memory, with memory profile support."
|
||||
|
@ -0,0 +1,143 @@
|
||||
/** @file
|
||||
Support routines for memory profile for Smm phase drivers.
|
||||
|
||||
Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php.
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#include <PiSmm.h>
|
||||
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/SmmServicesTableLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
|
||||
#include <Guid/MemoryProfile.h>
|
||||
|
||||
EDKII_MEMORY_PROFILE_PROTOCOL *mLibProfileProtocol;
|
||||
EDKII_SMM_MEMORY_PROFILE_PROTOCOL *mLibSmmProfileProtocol;
|
||||
|
||||
/**
|
||||
Check whether the start address of buffer is within any of the SMRAM ranges.
|
||||
|
||||
@param[in] Buffer The pointer to the buffer to be checked.
|
||||
|
||||
@retval TURE The buffer is in SMRAM ranges.
|
||||
@retval FALSE The buffer is out of SMRAM ranges.
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
BufferInSmram (
|
||||
IN VOID *Buffer
|
||||
);
|
||||
|
||||
/**
|
||||
The constructor function initializes memory profile for SMM phase.
|
||||
|
||||
@param ImageHandle The firmware allocated handle for the EFI image.
|
||||
@param SystemTable A pointer to the EFI System Table.
|
||||
|
||||
@retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SmmMemoryProfileLibConstructor (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
//
|
||||
// Locate Profile Protocol
|
||||
//
|
||||
Status = gBS->LocateProtocol (
|
||||
&gEdkiiMemoryProfileGuid,
|
||||
NULL,
|
||||
(VOID **)&mLibProfileProtocol
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
mLibProfileProtocol = NULL;
|
||||
}
|
||||
|
||||
Status = gSmst->SmmLocateProtocol (
|
||||
&gEdkiiSmmMemoryProfileGuid,
|
||||
NULL,
|
||||
(VOID **)&mLibSmmProfileProtocol
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
mLibSmmProfileProtocol = NULL;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
Record memory profile of multilevel caller.
|
||||
|
||||
@param[in] CallerAddress Address of caller.
|
||||
@param[in] Action Memory profile action.
|
||||
@param[in] MemoryType Memory type.
|
||||
EfiMaxMemoryType means the MemoryType is unknown.
|
||||
@param[in] Buffer Buffer address.
|
||||
@param[in] Size Buffer size.
|
||||
@param[in] ActionString String for memory profile action.
|
||||
Only needed for user defined allocate action.
|
||||
|
||||
@return EFI_SUCCESS Memory profile is updated.
|
||||
@return EFI_UNSUPPORTED Memory profile is unsupported,
|
||||
or memory profile for the image is not required,
|
||||
or memory profile for the memory type is not required.
|
||||
@return EFI_ACCESS_DENIED It is during memory profile data getting.
|
||||
@return EFI_ABORTED Memory profile recording is not enabled.
|
||||
@return EFI_OUT_OF_RESOURCES No enough resource to update memory profile for allocate action.
|
||||
@return EFI_NOT_FOUND No matched allocate info found for free action.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
MemoryProfileLibRecord (
|
||||
IN PHYSICAL_ADDRESS CallerAddress,
|
||||
IN MEMORY_PROFILE_ACTION Action,
|
||||
IN EFI_MEMORY_TYPE MemoryType,
|
||||
IN VOID *Buffer,
|
||||
IN UINTN Size,
|
||||
IN CHAR8 *ActionString OPTIONAL
|
||||
)
|
||||
{
|
||||
if (BufferInSmram (Buffer)) {
|
||||
if (mLibSmmProfileProtocol == NULL) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
return mLibSmmProfileProtocol->Record (
|
||||
mLibSmmProfileProtocol,
|
||||
CallerAddress,
|
||||
Action,
|
||||
MemoryType,
|
||||
Buffer,
|
||||
Size,
|
||||
ActionString
|
||||
);
|
||||
} else {
|
||||
if (mLibProfileProtocol == NULL) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
return mLibProfileProtocol->Record (
|
||||
mLibProfileProtocol,
|
||||
CallerAddress,
|
||||
Action,
|
||||
MemoryType,
|
||||
Buffer,
|
||||
Size,
|
||||
ActionString
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,102 @@
|
||||
/** @file
|
||||
Support routines for memory profile for Dxe phase drivers.
|
||||
|
||||
Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php.
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
|
||||
#include <Uefi.h>
|
||||
|
||||
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
|
||||
#include <Guid/MemoryProfile.h>
|
||||
|
||||
EDKII_MEMORY_PROFILE_PROTOCOL *mLibProfileProtocol;
|
||||
|
||||
/**
|
||||
The constructor function initializes memory profile for DXE phase.
|
||||
|
||||
@param ImageHandle The firmware allocated handle for the EFI image.
|
||||
@param SystemTable A pointer to the EFI System Table.
|
||||
|
||||
@retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
MemoryProfileLibConstructor (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
Status = gBS->LocateProtocol (
|
||||
&gEdkiiMemoryProfileGuid,
|
||||
NULL,
|
||||
(VOID **) &mLibProfileProtocol
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
mLibProfileProtocol = NULL;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
Record memory profile of multilevel caller.
|
||||
|
||||
@param[in] CallerAddress Address of caller.
|
||||
@param[in] Action Memory profile action.
|
||||
@param[in] MemoryType Memory type.
|
||||
EfiMaxMemoryType means the MemoryType is unknown.
|
||||
@param[in] Buffer Buffer address.
|
||||
@param[in] Size Buffer size.
|
||||
@param[in] ActionString String for memory profile action.
|
||||
Only needed for user defined allocate action.
|
||||
|
||||
@return EFI_SUCCESS Memory profile is updated.
|
||||
@return EFI_UNSUPPORTED Memory profile is unsupported,
|
||||
or memory profile for the image is not required,
|
||||
or memory profile for the memory type is not required.
|
||||
@return EFI_ACCESS_DENIED It is during memory profile data getting.
|
||||
@return EFI_ABORTED Memory profile recording is not enabled.
|
||||
@return EFI_OUT_OF_RESOURCES No enough resource to update memory profile for allocate action.
|
||||
@return EFI_NOT_FOUND No matched allocate info found for free action.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
MemoryProfileLibRecord (
|
||||
IN PHYSICAL_ADDRESS CallerAddress,
|
||||
IN MEMORY_PROFILE_ACTION Action,
|
||||
IN EFI_MEMORY_TYPE MemoryType,
|
||||
IN VOID *Buffer,
|
||||
IN UINTN Size,
|
||||
IN CHAR8 *ActionString OPTIONAL
|
||||
)
|
||||
{
|
||||
if (mLibProfileProtocol == NULL) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
return mLibProfileProtocol->Record (
|
||||
mLibProfileProtocol,
|
||||
CallerAddress,
|
||||
Action,
|
||||
MemoryType,
|
||||
Buffer,
|
||||
Size,
|
||||
ActionString
|
||||
);
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,53 @@
|
||||
## @file
|
||||
# Instance of Memory Allocation Library using EFI Boot Services,
|
||||
# with memory profile support.
|
||||
#
|
||||
# Memory Allocation Library that uses EFI Boot Services to allocate
|
||||
# and free memory, with memory profile support.
|
||||
#
|
||||
# The implementation of this instance is copied from UefiMemoryAllocationLib
|
||||
# in MdePkg and updated to support both MemoryAllocationLib and MemoryProfileLib.
|
||||
#
|
||||
# Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
# which accompanies this distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php.
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#
|
||||
#
|
||||
##
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = UefiMemoryAllocationProfileLib
|
||||
MODULE_UNI_FILE = UefiMemoryAllocationProfileLib.uni
|
||||
FILE_GUID = 9E8A380A-231E-41E4-AD40-5E706196B853
|
||||
MODULE_TYPE = UEFI_DRIVER
|
||||
VERSION_STRING = 1.0
|
||||
LIBRARY_CLASS = MemoryAllocationLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER
|
||||
LIBRARY_CLASS = MemoryProfileLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER
|
||||
CONSTRUCTOR = MemoryProfileLibConstructor
|
||||
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
|
||||
#
|
||||
|
||||
[Sources]
|
||||
MemoryAllocationLib.c
|
||||
DxeMemoryProfileLib.c
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
DebugLib
|
||||
BaseMemoryLib
|
||||
UefiBootServicesTableLib
|
||||
|
||||
[Guids]
|
||||
gEdkiiMemoryProfileGuid ## SOMETIMES_CONSUMES ## GUID # Locate protocol
|
||||
|
@ -0,0 +1,23 @@
|
||||
// /** @file
|
||||
// Instance of Memory Allocation Library using EFI Boot Services,
|
||||
// with memory profile support.
|
||||
//
|
||||
// Memory Allocation Library that uses EFI Boot Services to allocate
|
||||
// and free memory, with memory profile support.
|
||||
//
|
||||
// Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||
//
|
||||
// This program and the accompanying materials
|
||||
// are licensed and made available under the terms and conditions of the BSD License
|
||||
// which accompanies this distribution. The full text of the license may be found at
|
||||
// http://opensource.org/licenses/bsd-license.php.
|
||||
// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
//
|
||||
// **/
|
||||
|
||||
|
||||
#string STR_MODULE_ABSTRACT #language en-US "Instance of Memory Allocation Library using EFI Boot Services, with memory profile support"
|
||||
|
||||
#string STR_MODULE_DESCRIPTION #language en-US "This Memory Allocation Library uses EFI Boot Services to allocate and free memory, with memory profile support."
|
||||
|
@ -153,6 +153,10 @@
|
||||
#
|
||||
PciHostBridgeLib|Include/Library/PciHostBridgeLib.h
|
||||
|
||||
## @libraryclass Provides services to record memory profile of multilevel caller.
|
||||
#
|
||||
MemoryProfileLib|Include/Library/MemoryProfileLib.h
|
||||
|
||||
[Guids]
|
||||
## MdeModule package token space guid
|
||||
# Include/Guid/MdeModulePkgTokenSpace.h
|
||||
@ -327,6 +331,7 @@
|
||||
|
||||
## Include/Guid/MemoryProfile.h
|
||||
gEdkiiMemoryProfileGuid = { 0x821c9a09, 0x541a, 0x40f6, { 0x9f, 0x43, 0xa, 0xd1, 0x93, 0xa1, 0x2c, 0xfe }}
|
||||
gEdkiiSmmMemoryProfileGuid = { 0xe22bbcca, 0x516a, 0x46a8, { 0x80, 0xe2, 0x67, 0x45, 0xe8, 0x36, 0x93, 0xbd }}
|
||||
|
||||
## Include/Protocol/VarErrorFlag.h
|
||||
gEdkiiVarErrorFlagGuid = { 0x4b37fe8, 0xf6ae, 0x480b, { 0xbd, 0xd5, 0x37, 0xd9, 0x8c, 0x5e, 0x89, 0xaa } }
|
||||
@ -995,8 +1000,9 @@
|
||||
## The mask is used to control memory profile behavior.<BR><BR>
|
||||
# BIT0 - Enable UEFI memory profile.<BR>
|
||||
# BIT1 - Enable SMRAM profile.<BR>
|
||||
# BIT7 - Disable recording at the start.<BR>
|
||||
# @Prompt Memory Profile Property.
|
||||
# @Expression 0x80000002 | (gEfiMdeModulePkgTokenSpaceGuid.PcdMemoryProfilePropertyMask & 0xFC) == 0
|
||||
# @Expression 0x80000002 | (gEfiMdeModulePkgTokenSpaceGuid.PcdMemoryProfilePropertyMask & 0x7C) == 0
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdMemoryProfilePropertyMask|0x0|UINT8|0x30001041
|
||||
|
||||
## This flag is to control which memory types of alloc info will be recorded by DxeCore & SmmCore.<BR><BR>
|
||||
@ -1026,6 +1032,20 @@
|
||||
# @Prompt Memory profile memory type.
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdMemoryProfileMemoryType|0x0|UINT64|0x30001042
|
||||
|
||||
## This PCD is to control which drivers need memory profile data.<BR><BR>
|
||||
# For example:<BR>
|
||||
# One image only (Shell):<BR>
|
||||
# Header GUID<BR>
|
||||
# {0x04, 0x06, 0x14, 0x00, 0x83, 0xA5, 0x04, 0x7C, 0x3E, 0x9E, 0x1C, 0x4F, 0xAD, 0x65, 0xE0, 0x52, 0x68, 0xD0, 0xB4, 0xD1,<BR>
|
||||
# 0x7F, 0xFF, 0x04, 0x00}<BR>
|
||||
# Two or more images (Shell + WinNtSimpleFileSystem):<BR>
|
||||
# {0x04, 0x06, 0x14, 0x00, 0x83, 0xA5, 0x04, 0x7C, 0x3E, 0x9E, 0x1C, 0x4F, 0xAD, 0x65, 0xE0, 0x52, 0x68, 0xD0, 0xB4, 0xD1,<BR>
|
||||
# 0x7F, 0x01, 0x04, 0x00,<BR>
|
||||
# 0x04, 0x06, 0x14, 0x00, 0x8B, 0xE1, 0x25, 0x9C, 0xBA, 0x76, 0xDA, 0x43, 0xA1, 0x32, 0xDB, 0xB0, 0x99, 0x7C, 0xEF, 0xEF,<BR>
|
||||
# 0x7F, 0xFF, 0x04, 0x00}<BR>
|
||||
# @Prompt Memory profile driver path.
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdMemoryProfileDriverPath|{0x0}|VOID*|0x00001043
|
||||
|
||||
## PCI Serial Device Info. It is an array of Device, Function, and Power Management
|
||||
# information that describes the path that contains zero or more PCI to PCI briges
|
||||
# followed by a PCI serial device. Each array entry is 4-bytes in length. The
|
||||
|
@ -259,7 +259,9 @@
|
||||
MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
|
||||
|
||||
MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
|
||||
MdeModulePkg/Library/UefiMemoryAllocationProfileLib/UefiMemoryAllocationProfileLib.inf
|
||||
MdeModulePkg/Library/DxeCoreMemoryAllocationLib/DxeCoreMemoryAllocationLib.inf
|
||||
MdeModulePkg/Library/DxeCoreMemoryAllocationLib/DxeCoreMemoryAllocationProfileLib.inf
|
||||
MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
|
||||
MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf
|
||||
MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
|
||||
@ -432,6 +434,9 @@
|
||||
MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerSmm.inf
|
||||
MdeModulePkg/Universal/ReportStatusCodeRouter/Smm/ReportStatusCodeRouterSmm.inf
|
||||
MdeModulePkg/Universal/LockBox/SmmLockBox/SmmLockBox.inf
|
||||
MdeModulePkg/Library/SmmMemoryAllocationProfileLib/SmmMemoryAllocationProfileLib.inf
|
||||
MdeModulePkg/Library/PiSmmCoreMemoryAllocationLib/PiSmmCoreMemoryAllocationProfileLib.inf
|
||||
MdeModulePkg/Library/PiSmmCoreMemoryAllocationLib/PiSmmCoreMemoryAllocationLib.inf
|
||||
MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.inf
|
||||
MdeModulePkg/Library/SmmPerformanceLib/SmmPerformanceLib.inf
|
||||
MdeModulePkg/Library/DxeSmmPerformanceLib/DxeSmmPerformanceLib.inf
|
||||
|
@ -266,7 +266,8 @@
|
||||
|
||||
#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdMemoryProfilePropertyMask_HELP #language en-US "The mask is used to control memory profile behavior.<BR><BR>\n"
|
||||
"BIT0 - Enable UEFI memory profile.<BR>\n"
|
||||
"BIT1 - Enable SMRAM profile.<BR>"
|
||||
"BIT1 - Enable SMRAM profile.<BR>\n"
|
||||
"BIT7 - Disable recording at the start.<BR>"
|
||||
|
||||
#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdMemoryProfileMemoryType_PROMPT #language en-US "Memory profile memory type"
|
||||
|
||||
@ -292,6 +293,20 @@
|
||||
" OS Reserved 0x80000000<BR>\n"
|
||||
"e.g. Reserved+ACPINvs+ACPIReclaim+RuntimeCode+RuntimeData are needed, 0x661 should be used.<BR>\n"
|
||||
|
||||
#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdMemoryProfileDriverPath_PROMPT #language en-US "Memory profile driver path"
|
||||
|
||||
#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdMemoryProfileDriverPath_HELP #language en-US "This PCD is to control which drivers need memory profile data.<BR><BR>\n"
|
||||
"For example:<BR>\n"
|
||||
"One image only (Shell):<BR>\n"
|
||||
" Header GUID<BR>\n"
|
||||
" {0x04, 0x06, 0x14, 0x00, 0x83, 0xA5, 0x04, 0x7C, 0x3E, 0x9E, 0x1C, 0x4F, 0xAD, 0x65, 0xE0, 0x52, 0x68, 0xD0, 0xB4, 0xD1,<BR>\n"
|
||||
" 0x7F, 0xFF, 0x04, 0x00}<BR>\n"
|
||||
"Two or more images (Shell + WinNtSimpleFileSystem):<BR>\n"
|
||||
" {0x04, 0x06, 0x14, 0x00, 0x83, 0xA5, 0x04, 0x7C, 0x3E, 0x9E, 0x1C, 0x4F, 0xAD, 0x65, 0xE0, 0x52, 0x68, 0xD0, 0xB4, 0xD1,<BR>\n"
|
||||
" 0x7F, 0x01, 0x04, 0x00,<BR>\n"
|
||||
" 0x04, 0x06, 0x14, 0x00, 0x8B, 0xE1, 0x25, 0x9C, 0xBA, 0x76, 0xDA, 0x43, 0xA1, 0x32, 0xDB, 0xB0, 0x99, 0x7C, 0xEF, 0xEF,<BR>\n"
|
||||
" 0x7F, 0xFF, 0x04, 0x00}<BR>\n"
|
||||
|
||||
#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdSerialClockRate_PROMPT #language en-US "Serial Port Clock Rate"
|
||||
|
||||
#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdSerialClockRate_HELP #language en-US "UART clock frequency is for the baud rate configuration."
|
||||
|
@ -384,7 +384,7 @@ Ikev2InitPskParser (
|
||||
// 5. Generate Nr_b
|
||||
//
|
||||
IkeSaSession->NrBlock = IkeGenerateNonce (IKE_NONCE_SIZE);
|
||||
ASSERT_EFI_ERROR (IkeSaSession->NrBlock != NULL);
|
||||
ASSERT (IkeSaSession->NrBlock != NULL);
|
||||
IkeSaSession->NrBlkSize = IKE_NONCE_SIZE;
|
||||
|
||||
//
|
||||
|
@ -680,7 +680,7 @@ AcpiPlatformEntryPoint (
|
||||
// Init Pci Device PRT PRW information structure from PCD
|
||||
//
|
||||
mConfigData = (PCI_DEVICE_SETTING *)AllocateZeroPool (sizeof (PCI_DEVICE_SETTING));
|
||||
ASSERT_EFI_ERROR (mConfigData);
|
||||
ASSERT (mConfigData != NULL);
|
||||
InitPciDeviceInfoStructure (mConfigData);
|
||||
//
|
||||
// Get the Acpi SDT protocol for manipulation on acpi table
|
||||
|
@ -218,7 +218,7 @@ MadtTableInitialize (
|
||||
//ASSERT (NumberOfCPUs <= 2 && NumberOfCPUs > 0);
|
||||
MadtSize = GetAcutalMadtTableSize (&MadtConfigData, NumberOfCPUs);
|
||||
Madt = (EFI_ACPI_2_0_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER *)AllocateZeroPool (MadtSize);
|
||||
ASSERT_EFI_ERROR (Madt);
|
||||
ASSERT (Madt != NULL);
|
||||
//
|
||||
// Initialize MADT Header information
|
||||
//
|
||||
|
@ -174,7 +174,7 @@ PlatformFlashLockConfig (
|
||||
//
|
||||
|
||||
SpiProtocol = LocateSpiProtocol (NULL); // This routine will not be called in SMM.
|
||||
ASSERT_EFI_ERROR (SpiProtocol != NULL);
|
||||
ASSERT (SpiProtocol != NULL);
|
||||
if (SpiProtocol != NULL) {
|
||||
Status = SpiProtocol->Lock (SpiProtocol);
|
||||
|
||||
|
@ -1034,7 +1034,7 @@ InstallS3Memory (
|
||||
// memory above 1MB. So Memory Callback can set cache for the system memory
|
||||
// correctly on S3 boot path, just like it does on Normal boot path.
|
||||
//
|
||||
ASSERT_EFI_ERROR ((S3MemoryRangeData->SystemMemoryLength - 0x100000) > 0);
|
||||
ASSERT ((S3MemoryRangeData->SystemMemoryLength - 0x100000) > 0);
|
||||
BuildResourceDescriptorHob (
|
||||
EFI_RESOURCE_SYSTEM_MEMORY,
|
||||
(
|
||||
|
@ -1330,10 +1330,10 @@ Tcg2SubmitCommand (
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
if (InputParameterBlockSize >= mTcgDxeData.BsCap.MaxCommandSize) {
|
||||
if (InputParameterBlockSize > mTcgDxeData.BsCap.MaxCommandSize) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
if (OutputParameterBlockSize >= mTcgDxeData.BsCap.MaxResponseSize) {
|
||||
if (OutputParameterBlockSize > mTcgDxeData.BsCap.MaxResponseSize) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
|
@ -893,10 +893,10 @@ TreeSubmitCommand (
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
if (InputParameterBlockSize >= mTcgDxeData.BsCap.MaxCommandSize) {
|
||||
if (InputParameterBlockSize > mTcgDxeData.BsCap.MaxCommandSize) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
if (OutputParameterBlockSize >= mTcgDxeData.BsCap.MaxResponseSize) {
|
||||
if (OutputParameterBlockSize > mTcgDxeData.BsCap.MaxResponseSize) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
|
@ -2460,10 +2460,6 @@ ParseHandleDatabaseByRelationshipWithType (
|
||||
(*HandleType)[HandleIndex] |= (UINTN)HR_COMPONENT_NAME_HANDLE;
|
||||
} else if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiDevicePathProtocolGuid) ) {
|
||||
(*HandleType)[HandleIndex] |= (UINTN)HR_DEVICE_HANDLE;
|
||||
} else {
|
||||
DEBUG_CODE_BEGIN();
|
||||
ASSERT((*HandleType)[HandleIndex] == (*HandleType)[HandleIndex]);
|
||||
DEBUG_CODE_END();
|
||||
}
|
||||
//
|
||||
// Retrieve the list of agents that have opened each protocol
|
||||
|
@ -991,8 +991,11 @@ ShellCommandRunElse (
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
SCRIPT_FILE *CurrentScriptFile;
|
||||
ASSERT_EFI_ERROR(CommandInit());
|
||||
|
||||
Status = CommandInit ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
if (gEfiShellParametersProtocol->Argc > 1) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel1HiiHandle, L"if");
|
||||
@ -1066,8 +1069,11 @@ ShellCommandRunEndIf (
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
SCRIPT_FILE *CurrentScriptFile;
|
||||
ASSERT_EFI_ERROR(CommandInit());
|
||||
|
||||
Status = CommandInit ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
if (gEfiShellParametersProtocol->Argc > 1) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel1HiiHandle, L"if");
|
||||
|
@ -373,6 +373,8 @@ EFIAPI
|
||||
ShellInitialize (
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
//
|
||||
// if auto initialize is not false then skip
|
||||
//
|
||||
@ -383,7 +385,8 @@ ShellInitialize (
|
||||
//
|
||||
// deinit the current stuff
|
||||
//
|
||||
ASSERT_EFI_ERROR(ShellLibDestructor(gImageHandle, gST));
|
||||
Status = ShellLibDestructor (gImageHandle, gST);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// init the new stuff
|
||||
|
@ -78,7 +78,7 @@ InitPagesForPFHandler (
|
||||
//
|
||||
Address = NULL;
|
||||
Address = AllocatePages (MAX_PF_PAGE_COUNT);
|
||||
ASSERT_EFI_ERROR (Address != NULL);
|
||||
ASSERT (Address != NULL);
|
||||
|
||||
mPFPageBuffer = (UINT64)(UINTN) Address;
|
||||
mPFPageIndex = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user