30#define GET_OCCUPIED_SIZE(ActualSize, Alignment) \
31 ((ActualSize) + (((Alignment) - ((ActualSize) & ((Alignment) - 1))) & ((Alignment) - 1)))
35 PHYSICAL_ADDRESS EntryPoint;
36 PHYSICAL_ADDRESS ImageBase;
129 for (Index = 0; Index < Size; Index++) {
130 DEBUG ((DEBUG_INFO,
"%02x ", (
UINTN)Data[Index]));
149 if ((
DevicePathType (LoadedImage->FilePath) == MEDIA_DEVICE_PATH) &&
155 if (FileName !=
NULL) {
173 IN PHYSICAL_ADDRESS ImageBase,
175 IN PHYSICAL_ADDRESS EntryPoint,
182 if (mImageStructCount >= mImageStructCountMax) {
187 CopyGuid (&mImageStruct[mImageStructCount].FileGuid, Guid);
188 mImageStruct[mImageStructCount].ImageRef = mImageStructCount;
189 mImageStruct[mImageStructCount].ImageBase = ImageBase;
190 mImageStruct[mImageStructCount].ImageSize = ImageSize;
191 mImageStruct[mImageStructCount].EntryPoint = EntryPoint;
192 if (PdbString !=
NULL) {
194 mImageStruct[mImageStructCount].PdbString =
AllocateCopyPool (PdbStringSize, PdbString);
195 if (mImageStruct[mImageStructCount].PdbString !=
NULL) {
196 mImageStruct[mImageStructCount].PdbStringSize = (UINT16)PdbStringSize;
217 for (Index = 0; Index < mImageStructCount; Index++) {
218 if ((Address >= mImageStruct[Index].ImageBase) &&
219 (Address < mImageStruct[Index].ImageBase + mImageStruct[Index].ImageSize))
221 return &mImageStruct[Index];
243 if (ImageStruct !=
NULL) {
244 return ImageStruct->ImageRef;
260 UINTN HandleBufferSize;
266 PHYSICAL_ADDRESS EntryPoint;
267 VOID *EntryPointInImage;
270 PHYSICAL_ADDRESS RealImageBase;
272 HandleBufferSize = 0;
274 Status =
gSmst->SmmLocateHandle (
276 &gEfiLoadedImageProtocolGuid,
281 if (Status != EFI_BUFFER_TOO_SMALL) {
286 if (HandleBuffer ==
NULL) {
290 Status =
gSmst->SmmLocateHandle (
292 &gEfiLoadedImageProtocolGuid,
297 if (EFI_ERROR (Status)) {
301 NoHandles = HandleBufferSize/
sizeof (
EFI_HANDLE);
302 mImageStructCountMax = (UINT32)NoHandles;
304 if (mImageStruct ==
NULL) {
308 for (Index = 0; Index < NoHandles; Index++) {
309 Status =
gSmst->SmmHandleProtocol (
311 &gEfiLoadedImageProtocolGuid,
312 (VOID **)&LoadedImage
314 if (EFI_ERROR (Status)) {
320 DEBUG ((DEBUG_INFO,
"Image: %g ", &Guid));
324 RealImageBase = (
UINTN)LoadedImage->ImageBase;
325 if (LoadedImagePrivate->Signature == EFI_SMM_DRIVER_ENTRY_SIGNATURE) {
326 EntryPoint = LoadedImagePrivate->ImageEntryPoint;
327 if ((EntryPoint != 0) && ((EntryPoint < (
UINTN)LoadedImage->ImageBase) || (EntryPoint >= ((
UINTN)LoadedImage->ImageBase + LoadedImage->ImageSize)))) {
334 RealImageBase = (
UINTN)LoadedImage->ImageBase + EntryPoint - (
UINTN)EntryPointInImage;
338 DEBUG ((DEBUG_INFO,
"(0x%lx - 0x%lx", RealImageBase, LoadedImage->ImageSize));
339 if (EntryPoint != 0) {
340 DEBUG ((DEBUG_INFO,
", EntryPoint:0x%lx", EntryPoint));
343 DEBUG ((DEBUG_INFO,
")\n"));
345 if (RealImageBase != 0) {
346 PdbString = PeCoffLoaderGetPdbPointer ((VOID *)(
UINTN)RealImageBase);
347 DEBUG ((DEBUG_INFO,
" pdb - %a\n", PdbString));
352 DEBUG ((DEBUG_INFO,
" (%s)\n", PathStr));
354 AddImageStruct (RealImageBase, LoadedImage->ImageSize, EntryPoint, &Guid, PdbString);
378 if (
CompareGuid (HandlerType, &gEfiSmmSwDispatch2ProtocolGuid)) {
380 }
else if (
CompareGuid (HandlerType, &gEfiSmmSxDispatch2ProtocolGuid)) {
383 }
else if (
CompareGuid (HandlerType, &gEfiSmmPowerButtonDispatch2ProtocolGuid)) {
385 }
else if (
CompareGuid (HandlerType, &gEfiSmmStandbyButtonDispatch2ProtocolGuid)) {
387 }
else if (
CompareGuid (HandlerType, &gEfiSmmPeriodicTimerDispatch2ProtocolGuid)) {
390 }
else if (
CompareGuid (HandlerType, &gEfiSmmGpiDispatch2ProtocolGuid)) {
392 }
else if (
CompareGuid (HandlerType, &gEfiSmmIoTrapDispatch2ProtocolGuid)) {
396 }
else if (
CompareGuid (HandlerType, &gEfiSmmUsbDispatch2ProtocolGuid)) {
399 DEBUG ((DEBUG_INFO,
" UsbDevicePath - %s\n", Str));
404 DEBUG ((DEBUG_INFO,
" Context - "));
406 DEBUG ((DEBUG_INFO,
"\n"));
424 ListEntry = &SmiEntry->SmiHandlers;
425 for (ListEntry = ListEntry->ForwardLink;
426 ListEntry != &SmiEntry->SmiHandlers;
427 ListEntry = ListEntry->ForwardLink)
429 SmiHandler =
CR (ListEntry,
SMI_HANDLER, Link, SMI_HANDLER_SIGNATURE);
431 if (ImageStruct !=
NULL) {
432 DEBUG ((DEBUG_INFO,
" Module - %g", &ImageStruct->FileGuid));
435 if ((ImageStruct !=
NULL) && (ImageStruct->PdbString[0] != 0)) {
436 DEBUG ((DEBUG_INFO,
" (Pdb - %a)", ImageStruct->PdbString));
439 DEBUG ((DEBUG_INFO,
"\n"));
440 if (SmiHandler->ContextSize != 0) {
441 DumpSmiChildContext (&SmiEntry->HandlerType, SmiHandler->Context, SmiHandler->ContextSize);
444 DEBUG ((DEBUG_INFO,
" Handler - 0x%x", SmiHandler->Handler));
445 if (ImageStruct !=
NULL) {
446 DEBUG ((DEBUG_INFO,
" <== RVA - 0x%x", (
UINTN)SmiHandler->Handler - (
UINTN)ImageStruct->ImageBase));
449 DEBUG ((DEBUG_INFO,
"\n"));
450 DEBUG ((DEBUG_INFO,
" CallerAddr - 0x%x", SmiHandler->CallerAddr));
451 if (ImageStruct !=
NULL) {
452 DEBUG ((DEBUG_INFO,
" <== RVA - 0x%x", SmiHandler->CallerAddr - (
UINTN)ImageStruct->ImageBase));
455 DEBUG ((DEBUG_INFO,
"\n"));
474 ListEntry = SmiEntryList;
475 for (ListEntry = ListEntry->ForwardLink;
476 ListEntry != SmiEntryList;
477 ListEntry = ListEntry->ForwardLink)
479 SmiEntry =
CR (ListEntry,
SMI_ENTRY, AllEntries, SMI_ENTRY_SIGNATURE);
480 DEBUG ((DEBUG_INFO,
"SmiEntry - %g\n", &SmiEntry->HandlerType));
512 DEBUG ((DEBUG_INFO,
"##################\n"));
513 DEBUG ((DEBUG_INFO,
"# IMAGE DATABASE #\n"));
514 DEBUG ((DEBUG_INFO,
"##################\n"));
516 DEBUG ((DEBUG_INFO,
"\n"));
521 DEBUG ((DEBUG_INFO,
"########################\n"));
522 DEBUG ((DEBUG_INFO,
"# SMI Handler DATABASE #\n"));
523 DEBUG ((DEBUG_INFO,
"########################\n"));
525 DEBUG ((DEBUG_INFO,
"# 1. ROOT SMI Handler #\n"));
530 DEBUG ((DEBUG_INFO,
"# 2. GUID SMI Handler #\n"));
535 DEBUG ((DEBUG_INFO,
"# 3. Hardware SMI Handler #\n"));
540 DEBUG ((DEBUG_INFO,
"\n"));
544 if (mImageStruct !=
NULL) {
565 for (Index = 0; Index < mImageStructCount; Index++) {
589 ListEntry = &SmiEntry->SmiHandlers;
590 for (ListEntry = ListEntry->ForwardLink;
591 ListEntry != &SmiEntry->SmiHandlers;
592 ListEntry = ListEntry->ForwardLink)
594 SmiHandler =
CR (ListEntry,
SMI_HANDLER, Link, SMI_HANDLER_SIGNATURE);
618 ListEntry = SmiEntryList;
619 for (ListEntry = ListEntry->ForwardLink;
620 ListEntry != SmiEntryList;
621 ListEntry = ListEntry->ForwardLink)
623 SmiEntry =
CR (ListEntry,
SMI_ENTRY, AllEntries, SMI_ENTRY_SIGNATURE);
646 return mSmmImageDatabaseSize + mSmmSmiDatabaseSize + mSmmRootSmiDatabaseSize + mSmmHardwareSmiDatabaseSize;
669 for (Index = 0; Index < mImageStructCount; Index++) {
670 if (Size >= ExpectedSize) {
678 ImageStruct->Header.Signature = SMM_CORE_IMAGE_DATABASE_SIGNATURE;
680 ImageStruct->Header.Revision = SMM_CORE_IMAGE_DATABASE_REVISION;
681 CopyGuid (&ImageStruct->FileGuid, &mImageStruct[Index].FileGuid);
682 ImageStruct->ImageRef = mImageStruct[Index].ImageRef;
683 ImageStruct->EntryPoint = mImageStruct[Index].EntryPoint;
684 ImageStruct->ImageBase = mImageStruct[Index].ImageBase;
685 ImageStruct->ImageSize = mImageStruct[Index].ImageSize;
686 if (mImageStruct[Index].PdbStringSize != 0) {
688 CopyMem ((VOID *)((
UINTN)ImageStruct + ImageStruct->PdbStringOffset), mImageStruct[Index].PdbString, mImageStruct[Index].PdbStringSize);
690 ImageStruct->PdbStringOffset = 0;
697 if (ExpectedSize != Size) {
727 SmiHandlerStruct = Data;
730 ListEntry = &SmiEntry->SmiHandlers;
731 for (ListEntry = ListEntry->ForwardLink;
732 ListEntry != &SmiEntry->SmiHandlers;
733 ListEntry = ListEntry->ForwardLink)
735 SmiHandler =
CR (ListEntry,
SMI_HANDLER, Link, SMI_HANDLER_SIGNATURE);
736 if (Size >= MaxSize) {
747 SmiHandlerStruct->CallerAddr = (
UINTN)SmiHandler->CallerAddr;
748 SmiHandlerStruct->Handler = (
UINTN)SmiHandler->Handler;
750 SmiHandlerStruct->ContextBufferSize = (UINT32)SmiHandler->ContextSize;
751 if (SmiHandler->ContextSize != 0) {
753 CopyMem ((UINT8 *)SmiHandlerStruct + SmiHandlerStruct->ContextBufferOffset, SmiHandler->Context, SmiHandler->ContextSize);
755 SmiHandlerStruct->ContextBufferOffset = 0;
779 IN UINT32 HandlerCategory,
788 UINTN SmiHandlerSize;
789 UINT32 SmiHandlerCount;
793 ListEntry = SmiEntryList;
794 for (ListEntry = ListEntry->ForwardLink;
795 ListEntry != SmiEntryList;
796 ListEntry = ListEntry->ForwardLink)
798 SmiEntry =
CR (ListEntry,
SMI_ENTRY, AllEntries, SMI_ENTRY_SIGNATURE);
799 if (Size >= ExpectedSize) {
807 SmiStruct->Header.Signature = SMM_CORE_SMI_DATABASE_SIGNATURE;
809 SmiStruct->Header.Revision = SMM_CORE_SMI_DATABASE_REVISION;
810 SmiStruct->HandlerCategory = HandlerCategory;
811 CopyGuid (&SmiStruct->HandlerType, &SmiEntry->HandlerType);
814 SmiStruct->HandlerCount = SmiHandlerCount;
815 Size += SmiHandlerSize;
816 SmiStruct->Header.Length += (UINT32)SmiHandlerSize;
817 SmiStruct = (VOID *)((
UINTN)SmiStruct + SmiStruct->Header.Length);
820 if (ExpectedSize != Size) {
840 UINTN SmmImageDatabaseSize;
841 UINTN SmmSmiDatabaseSize;
842 UINTN SmmRootSmiDatabaseSize;
843 UINTN SmmHardwareSmiDatabaseSize;
845 DEBUG ((DEBUG_VERBOSE,
"GetSmiHandlerProfileDatabaseData\n"));
847 if (SmmImageDatabaseSize != mSmmImageDatabaseSize) {
848 DEBUG ((DEBUG_ERROR,
"GetSmiHandlerProfileDatabaseData - SmmImageDatabaseSize mismatch!\n"));
849 return EFI_INVALID_PARAMETER;
852 SmmRootSmiDatabaseSize =
GetSmmSmiDatabaseData (mSmmCoreRootSmiEntryList, SmmCoreSmiHandlerCategoryRootHandler, (UINT8 *)Data + SmmImageDatabaseSize, mSmmRootSmiDatabaseSize);
853 if (SmmRootSmiDatabaseSize != mSmmRootSmiDatabaseSize) {
854 DEBUG ((DEBUG_ERROR,
"GetSmiHandlerProfileDatabaseData - SmmRootSmiDatabaseSize mismatch!\n"));
855 return EFI_INVALID_PARAMETER;
858 SmmSmiDatabaseSize =
GetSmmSmiDatabaseData (mSmmCoreSmiEntryList, SmmCoreSmiHandlerCategoryGuidHandler, (UINT8 *)Data + SmmImageDatabaseSize + mSmmRootSmiDatabaseSize, mSmmSmiDatabaseSize);
859 if (SmmSmiDatabaseSize != mSmmSmiDatabaseSize) {
860 DEBUG ((DEBUG_ERROR,
"GetSmiHandlerProfileDatabaseData - SmmSmiDatabaseSize mismatch!\n"));
861 return EFI_INVALID_PARAMETER;
864 SmmHardwareSmiDatabaseSize =
GetSmmSmiDatabaseData (mSmmCoreHardwareSmiEntryList, SmmCoreSmiHandlerCategoryHardwareHandler, (UINT8 *)Data + SmmImageDatabaseSize + SmmRootSmiDatabaseSize + SmmSmiDatabaseSize, mSmmHardwareSmiDatabaseSize);
865 if (SmmHardwareSmiDatabaseSize != mSmmHardwareSmiDatabaseSize) {
866 DEBUG ((DEBUG_ERROR,
"GetSmiHandlerProfileDatabaseData - SmmHardwareSmiDatabaseSize mismatch!\n"));
867 return EFI_INVALID_PARAMETER;
884 mSmiHandlerProfileDatabase =
AllocatePool (mSmiHandlerProfileDatabaseSize);
885 if (mSmiHandlerProfileDatabase ==
NULL) {
890 if (EFI_ERROR (Status)) {
891 FreePool (mSmiHandlerProfileDatabase);
892 mSmiHandlerProfileDatabase =
NULL;
908 OUT VOID *DataBuffer,
909 IN OUT UINT64 *DataSize,
910 IN OUT UINT64 *DataOffset
913 if (*DataOffset >= mSmiHandlerProfileDatabaseSize) {
914 *DataOffset = mSmiHandlerProfileDatabaseSize;
918 if (mSmiHandlerProfileDatabaseSize - *DataOffset < *DataSize) {
919 *DataSize = mSmiHandlerProfileDatabaseSize - *DataOffset;
924 (UINT8 *)mSmiHandlerProfileDatabase + *DataOffset,
927 *DataOffset = *DataOffset + *DataSize;
941 BOOLEAN SmiHandlerProfileRecordingStatus;
943 SmiHandlerProfileRecordingStatus = mSmiHandlerProfileRecordingStatus;
944 mSmiHandlerProfileRecordingStatus =
FALSE;
946 SmiHandlerProfileParameterGetInfo->DataSize = mSmiHandlerProfileDatabaseSize;
947 SmiHandlerProfileParameterGetInfo->Header.ReturnStatus = 0;
949 mSmiHandlerProfileRecordingStatus = SmiHandlerProfileRecordingStatus;
964 BOOLEAN SmiHandlerProfileRecordingStatus;
966 SmiHandlerProfileRecordingStatus = mSmiHandlerProfileRecordingStatus;
967 mSmiHandlerProfileRecordingStatus =
FALSE;
969 CopyMem (&SmiHandlerProfileGetDataByOffset, SmiHandlerProfileParameterGetDataByOffset,
sizeof (SmiHandlerProfileGetDataByOffset));
975 DEBUG ((DEBUG_ERROR,
"SmiHandlerProfileHandlerGetDataByOffset: SMI handler profile get data in SMRAM or overflow!\n"));
976 SmiHandlerProfileParameterGetDataByOffset->Header.ReturnStatus = (UINT64)(INT64)(
INTN)EFI_ACCESS_DENIED;
980 SmiHandlerProfileCopyData ((VOID *)(
UINTN)SmiHandlerProfileGetDataByOffset.DataBuffer, &SmiHandlerProfileGetDataByOffset.DataSize, &SmiHandlerProfileGetDataByOffset.DataOffset);
981 CopyMem (SmiHandlerProfileParameterGetDataByOffset, &SmiHandlerProfileGetDataByOffset,
sizeof (SmiHandlerProfileGetDataByOffset));
982 SmiHandlerProfileParameterGetDataByOffset->Header.ReturnStatus = 0;
985 mSmiHandlerProfileRecordingStatus = SmiHandlerProfileRecordingStatus;
1007 IN CONST VOID *Context OPTIONAL,
1008 IN OUT VOID *CommBuffer OPTIONAL,
1013 UINTN TempCommBufferSize;
1015 DEBUG ((DEBUG_ERROR,
"SmiHandlerProfileHandler Enter\n"));
1017 if (mSmiHandlerProfileDatabase ==
NULL) {
1024 if ((CommBuffer ==
NULL) || (CommBufferSize ==
NULL)) {
1028 TempCommBufferSize = *CommBufferSize;
1031 DEBUG ((DEBUG_ERROR,
"SmiHandlerProfileHandler: SMM communication buffer size invalid!\n"));
1036 DEBUG ((DEBUG_ERROR,
"SmiHandlerProfileHandler: SMM communication buffer in SMRAM or overflow!\n"));
1041 SmiHandlerProfileParameterHeader->ReturnStatus = (UINT64)-1;
1043 switch (SmiHandlerProfileParameterHeader->Command) {
1044 case SMI_HANDLER_PROFILE_COMMAND_GET_INFO:
1045 DEBUG ((DEBUG_ERROR,
"SmiHandlerProfileHandlerGetInfo\n"));
1047 DEBUG ((DEBUG_ERROR,
"SmiHandlerProfileHandler: SMM communication buffer size invalid!\n"));
1053 case SMI_HANDLER_PROFILE_COMMAND_GET_DATA_BY_OFFSET:
1054 DEBUG ((DEBUG_ERROR,
"SmiHandlerProfileHandlerGetDataByOffset\n"));
1056 DEBUG ((DEBUG_ERROR,
"SmiHandlerProfileHandler: SMM communication buffer size invalid!\n"));
1066 DEBUG ((DEBUG_ERROR,
"SmiHandlerProfileHandler Exit\n"));
1082 Status =
gSmst->SmiHandlerRegister (
1084 &gSmiHandlerProfileGuid,
1112 for (Link = mHardwareSmiEntryList.ForwardLink;
1113 Link != &mHardwareSmiEntryList;
1114 Link = Link->ForwardLink)
1116 Item =
CR (Link,
SMI_ENTRY, AllEntries, SMI_ENTRY_SIGNATURE);
1117 if (
CompareGuid (&Item->HandlerType, HandlerType)) {
1130 if ((SmiEntry ==
NULL) && Create) {
1132 if (SmiEntry !=
NULL) {
1136 SmiEntry->Signature = SMI_ENTRY_SIGNATURE;
1137 CopyGuid ((VOID *)&SmiEntry->HandlerType, HandlerType);
1163 OUT UINTN *SmiHandlerUsbContextSize
1166 UINTN DevicePathSize;
1173 if (SmiHandlerUsbContext ==
NULL) {
1174 *SmiHandlerUsbContextSize = 0;
1178 SmiHandlerUsbContext->Type = UsbContext->Type;
1179 SmiHandlerUsbContext->DevicePathSize = (UINT32)DevicePathSize;
1180 CopyMem (SmiHandlerUsbContext + 1, UsbContext->Device, DevicePathSize);
1182 return SmiHandlerUsbContext;
1206 if (SmiHandlerSwContext ==
NULL) {
1207 *SmiHandlerSwContextSize = 0;
1211 SmiHandlerSwContext->SwSmiInputValue = SwContext->SwSmiInputValue;
1213 return SmiHandlerSwContext;
1241 IN EFI_SMM_HANDLER_ENTRY_POINT2 Handler,
1242 IN PHYSICAL_ADDRESS CallerAddress,
1243 IN VOID *Context OPTIONAL,
1251 if (((ContextSize == 0) && (Context !=
NULL)) ||
1252 ((ContextSize != 0) && (Context ==
NULL)))
1254 return EFI_INVALID_PARAMETER;
1258 if (SmiHandler ==
NULL) {
1259 return EFI_OUT_OF_RESOURCES;
1262 SmiHandler->Signature = SMI_HANDLER_SIGNATURE;
1263 SmiHandler->Handler = Handler;
1264 SmiHandler->CallerAddr = (
UINTN)CallerAddress;
1265 SmiHandler->Context = Context;
1266 SmiHandler->ContextSize = ContextSize;
1268 if (Context !=
NULL) {
1269 if (
CompareGuid (HandlerGuid, &gEfiSmmUsbDispatch2ProtocolGuid)) {
1271 }
else if (
CompareGuid (HandlerGuid, &gEfiSmmSwDispatch2ProtocolGuid)) {
1278 if (SmiHandler->Context ==
NULL) {
1279 SmiHandler->ContextSize = 0;
1283 if (SmiEntry ==
NULL) {
1284 if (SmiHandler->Context !=
NULL) {
1289 return EFI_OUT_OF_RESOURCES;
1292 List = &SmiEntry->SmiHandlers;
1294 SmiHandler->SmiEntry = SmiEntry;
1322 IN EFI_SMM_HANDLER_ENTRY_POINT2 Handler,
1323 IN VOID *Context OPTIONAL,
1332 VOID *SearchContext;
1333 UINTN SearchContextSize;
1335 if (((ContextSize == 0) && (Context !=
NULL)) ||
1336 ((ContextSize != 0) && (Context ==
NULL)))
1338 return EFI_INVALID_PARAMETER;
1342 if (SmiEntry ==
NULL) {
1343 return EFI_NOT_FOUND;
1346 SearchContext = Context;
1347 SearchContextSize = ContextSize;
1348 if (Context !=
NULL) {
1349 if (
CompareGuid (HandlerGuid, &gEfiSmmUsbDispatch2ProtocolGuid)) {
1351 }
else if (
CompareGuid (HandlerGuid, &gEfiSmmSwDispatch2ProtocolGuid)) {
1356 TargetSmiHandler =
NULL;
1357 Head = &SmiEntry->SmiHandlers;
1358 for (Link = Head->ForwardLink; Link != Head; Link = Link->ForwardLink) {
1359 SmiHandler =
CR (Link,
SMI_HANDLER, Link, SMI_HANDLER_SIGNATURE);
1360 if (SmiHandler->Handler == Handler) {
1361 if ((SearchContext ==
NULL) ||
1362 ((SearchContextSize == SmiHandler->ContextSize) && (
CompareMem (SearchContext, SmiHandler->Context, SearchContextSize) == 0)))
1364 TargetSmiHandler = SmiHandler;
1370 if (SearchContext !=
NULL) {
1371 if (
CompareGuid (HandlerGuid, &gEfiSmmUsbDispatch2ProtocolGuid)) {
1376 if (TargetSmiHandler ==
NULL) {
1377 return EFI_NOT_FOUND;
1380 SmiHandler = TargetSmiHandler;
1383 if (SmiHandler->Context !=
NULL) {
1409 if ((
PcdGet8 (PcdSmiHandlerProfilePropertyMask) & 0x1) != 0) {
1412 Status =
gSmst->SmmRegisterProtocolNotify (
1413 &gEfiSmmReadyToLockProtocolGuid,
1422 &gSmiHandlerProfileGuid,
BOOLEAN EFIAPI IsListEmpty(IN CONST LIST_ENTRY *ListHead)
LIST_ENTRY *EFIAPI RemoveEntryList(IN CONST LIST_ENTRY *Entry)
LIST_ENTRY *EFIAPI InitializeListHead(IN OUT LIST_ENTRY *ListHead)
#define INITIALIZE_LIST_HEAD_VARIABLE(ListHead)
UINTN EFIAPI AsciiStrSize(IN CONST CHAR8 *String)
LIST_ENTRY *EFIAPI InsertTailList(IN OUT LIST_ENTRY *ListHead, IN OUT LIST_ENTRY *Entry)
INTN EFIAPI CompareMem(IN CONST VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
BOOLEAN EFIAPI CompareGuid(IN CONST GUID *Guid1, IN CONST GUID *Guid2)
GUID *EFIAPI CopyGuid(OUT GUID *DestinationGuid, IN CONST GUID *SourceGuid)
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
#define MEDIA_PIWG_FW_FILE_DP
UINT8 EFIAPI DevicePathType(IN CONST VOID *Node)
UINT8 EFIAPI DevicePathSubType(IN CONST VOID *Node)
CHAR16 *EFIAPI ConvertDevicePathToText(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN BOOLEAN DisplayOnly, IN BOOLEAN AllowShortcuts)
UINTN EFIAPI GetDevicePathSize(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
VOID *EFIAPI AllocateCopyPool(IN UINTN AllocationSize, IN CONST VOID *Buffer)
#define GLOBAL_REMOVE_IF_UNREFERENCED
#define BASE_CR(Record, TYPE, Field)
#define ASSERT_EFI_ERROR(StatusParameter)
#define DEBUG(Expression)
#define CR(Record, TYPE, Field, TestSignature)
#define DEBUG_CODE(Expression)
#define PcdGet8(TokenName)
EFI_SMM_SYSTEM_TABLE2 * gSmst
VOID *EFIAPI AllocatePool(IN UINTN AllocationSize)
VOID InternalDumpData(IN UINT8 *Data, IN UINTN Size)
UINTN GetSmmSmiDatabaseSize(IN LIST_ENTRY *SmiEntryList)
VOID RegisterSmiHandlerProfileHandler(VOID)
VOID SmmCoreInitializeSmiHandlerProfile(VOID)
SMI_ENTRY * SmmCoreFindHardwareSmiEntry(IN EFI_GUID *HandlerType, IN BOOLEAN Create)
SMI_HANDLER_PROFILE_SW_REGISTER_CONTEXT * ConvertSmiHandlerSwContext(IN EFI_SMM_SW_REGISTER_CONTEXT *SwContext, IN UINTN SwContextSize, OUT UINTN *SmiHandlerSwContextSize)
UINTN GetSmiHandlerProfileDatabaseSize(VOID)
UINT32 AddressToImageRef(IN UINTN Address)
VOID GetSmmLoadedImage(VOID)
VOID SmiHandlerProfileHandlerGetDataByOffset(IN SMI_HANDLER_PROFILE_PARAMETER_GET_DATA_BY_OFFSET *SmiHandlerProfileParameterGetDataByOffset)
EFI_STATUS GetSmiHandlerProfileDatabaseData(IN OUT VOID *Data)
SMI_HANDLER_PROFILE_USB_REGISTER_CONTEXT * ConvertSmiHandlerUsbContext(IN EFI_SMM_USB_REGISTER_CONTEXT *UsbContext, IN UINTN UsbContextSize, OUT UINTN *SmiHandlerUsbContextSize)
EFI_STATUS EFIAPI SmiHandlerProfileRegisterHandler(IN SMI_HANDLER_PROFILE_PROTOCOL *This, IN EFI_GUID *HandlerGuid, IN EFI_SMM_HANDLER_ENTRY_POINT2 Handler, IN PHYSICAL_ADDRESS CallerAddress, IN VOID *Context OPTIONAL, IN UINTN ContextSize OPTIONAL)
UINTN GetSmmSmiDatabaseData(IN LIST_ENTRY *SmiEntryList, IN UINT32 HandlerCategory, IN OUT VOID *Data, IN UINTN ExpectedSize)
VOID AddImageStruct(IN PHYSICAL_ADDRESS ImageBase, IN UINT64 ImageSize, IN PHYSICAL_ADDRESS EntryPoint, IN EFI_GUID *Guid, IN CHAR8 *PdbString)
UINTN GetSmmSmiHandlerDataOnSmiEntry(IN SMI_ENTRY *SmiEntry, IN OUT VOID *Data, IN UINTN MaxSize, OUT UINT32 *Count)
VOID DumpSmiHandlerOnSmiEntry(IN SMI_ENTRY *SmiEntry)
UINTN GetSmmImageDatabaseData(IN OUT VOID *Data, IN UINTN ExpectedSize)
VOID DumpSmiEntryList(IN LIST_ENTRY *SmiEntryList)
UINTN GetSmmSmiHandlerSizeOnSmiEntry(IN SMI_ENTRY *SmiEntry)
VOID SmiHandlerProfileCopyData(OUT VOID *DataBuffer, IN OUT UINT64 *DataSize, IN OUT UINT64 *DataOffset)
UINTN GetSmmImageDatabaseSize(VOID)
VOID BuildSmiHandlerProfileDatabase(VOID)
VOID SmiHandlerProfileHandlerGetInfo(IN SMI_HANDLER_PROFILE_PARAMETER_GET_INFO *SmiHandlerProfileParameterGetInfo)
EFI_STATUS EFIAPI SmiHandlerProfileUnregisterHandler(IN SMI_HANDLER_PROFILE_PROTOCOL *This, IN EFI_GUID *HandlerGuid, IN EFI_SMM_HANDLER_ENTRY_POINT2 Handler, IN VOID *Context OPTIONAL, IN UINTN ContextSize OPTIONAL)
RETURN_STATUS InternalPeCoffGetEntryPoint(IN VOID *Pe32Data, OUT VOID **EntryPoint)
VOID DumpSmiChildContext(IN EFI_GUID *HandlerType, IN VOID *Context, IN UINTN ContextSize)
IMAGE_STRUCT * AddressToImageStruct(IN UINTN Address)
EFI_STATUS EFIAPI SmmReadyToLockInSmiHandlerProfile(IN CONST EFI_GUID *Protocol, IN VOID *Interface, IN EFI_HANDLE Handle)
EFI_STATUS EFIAPI SmiHandlerProfileHandler(IN EFI_HANDLE DispatchHandle, IN CONST VOID *Context OPTIONAL, IN OUT VOID *CommBuffer OPTIONAL, IN OUT UINTN *CommBufferSize OPTIONAL)
VOID GetDriverGuid(IN EFI_LOADED_IMAGE_PROTOCOL *LoadedImage, OUT EFI_GUID *Guid)
BOOLEAN EFIAPI SmmIsBufferOutsideSmmValid(IN EFI_PHYSICAL_ADDRESS Buffer, IN UINT64 Length)
EFI_INSTALL_PROTOCOL_INTERFACE SmmInstallProtocolInterface