]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Include/Guid/SmiHandlerProfile.h
MdeModulePkg SmiHandlerProfile: Use fixed data type in data structure
[mirror_edk2.git] / MdeModulePkg / Include / Guid / SmiHandlerProfile.h
index b81631dcf4a504003625253e222911c2d9d69174..ba41393cf2e2f5b3593f4e04983bb9ad90149185 100644 (file)
@@ -25,12 +25,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Protocol/SmmSxDispatch2.h>\r
 #include <Protocol/SmmUsbDispatch2.h>\r
 \r
-#pragma pack(1)\r
-\r
 typedef struct {\r
   UINT32                       Signature;\r
   UINT32                       Length;\r
   UINT32                       Revision;\r
+  UINT8                        Reserved[4];\r
 } SMM_CORE_DATABASE_COMMON_HEADER;\r
 \r
 #define SMM_CORE_IMAGE_DATABASE_SIGNATURE SIGNATURE_32 ('S','C','I','D')\r
@@ -39,12 +38,12 @@ typedef struct {
 typedef struct {\r
   SMM_CORE_DATABASE_COMMON_HEADER     Header;\r
   EFI_GUID                            FileGuid;\r
-  UINTN                               ImageRef;\r
-  UINTN                               EntryPoint;\r
-  UINTN                               ImageBase;\r
-  UINTN                               ImageSize;\r
+  PHYSICAL_ADDRESS                    EntryPoint;\r
+  PHYSICAL_ADDRESS                    ImageBase;\r
+  UINT64                              ImageSize;\r
+  UINT32                              ImageRef;\r
   UINT16                              PdbStringOffset;\r
-  UINT8                               Reserved2[6];\r
+  UINT8                               Reserved[2];\r
 //CHAR8                               PdbString[];\r
 } SMM_CORE_IMAGE_DATABASE_STRUCTURE;\r
 \r
@@ -64,7 +63,7 @@ typedef enum {
 //   NULL\r
 // Context for SmmCoreSmiHandlerCategoryHardwareHandler:\r
 //   (NOTE: The context field should NOT include any data pointer.)\r
-//   gEfiSmmSwDispatch2ProtocolGuid:            EFI_SMM_SW_REGISTER_CONTEXT\r
+//   gEfiSmmSwDispatch2ProtocolGuid:            (EFI_SMM_SW_REGISTER_CONTEXT => SMI_HANDLER_PROFILE_SW_REGISTER_CONTEXT)\r
 //   gEfiSmmSxDispatch2ProtocolGuid:            EFI_SMM_SX_REGISTER_CONTEXT\r
 //   gEfiSmmPowerButtonDispatch2ProtocolGuid:   EFI_SMM_POWER_BUTTON_REGISTER_CONTEXT\r
 //   gEfiSmmStandbyButtonDispatch2ProtocolGuid: EFI_SMM_STANDBY_BUTTON_REGISTER_CONTEXT\r
@@ -81,21 +80,25 @@ typedef struct {
 } SMI_HANDLER_PROFILE_USB_REGISTER_CONTEXT;\r
 \r
 typedef struct {\r
-  UINT32     Length;\r
-  UINTN      CallerAddr;\r
-  UINTN      Handler;\r
-  UINTN      ImageRef;\r
-  UINT16     ContextBufferOffset;\r
-  UINT8      Reserved2[2];\r
-  UINT32     ContextBufferSize;\r
-//UINT8      ContextBuffer[];\r
+  UINT64                    SwSmiInputValue;\r
+} SMI_HANDLER_PROFILE_SW_REGISTER_CONTEXT;\r
+\r
+typedef struct {\r
+  UINT32                Length;\r
+  UINT32                ImageRef;\r
+  PHYSICAL_ADDRESS      CallerAddr;\r
+  PHYSICAL_ADDRESS      Handler;\r
+  UINT16                ContextBufferOffset;\r
+  UINT8                 Reserved[2];\r
+  UINT32                ContextBufferSize;\r
+//UINT8                 ContextBuffer[];\r
 } SMM_CORE_SMI_HANDLER_STRUCTURE;\r
 \r
 typedef struct {\r
   SMM_CORE_DATABASE_COMMON_HEADER     Header;\r
-  UINT32                              HandlerCategory;\r
   EFI_GUID                            HandlerType;\r
-  UINTN                               HandlerCount;\r
+  UINT32                              HandlerCategory;\r
+  UINT32                              HandlerCount;\r
 //SMM_CORE_SMI_HANDLER_STRUCTURE      Handler[HandlerCount];\r
 } SMM_CORE_SMI_DATABASE_STRUCTURE;\r
 \r
@@ -144,12 +147,30 @@ typedef struct {
 \r
 #define SMI_HANDLER_PROFILE_GUID {0x49174342, 0x7108, 0x409b, {0x8b, 0xbe, 0x65, 0xfd, 0xa8, 0x53, 0x89, 0xf5}}\r
 \r
-#pragma pack()\r
-\r
 extern EFI_GUID gSmiHandlerProfileGuid;\r
 \r
 typedef struct _SMI_HANDLER_PROFILE_PROTOCOL  SMI_HANDLER_PROFILE_PROTOCOL;\r
 \r
+/**\r
+  This function is called by SmmChildDispatcher module to report\r
+  a new SMI handler is registered, to SmmCore.\r
+\r
+  @param This            The protocol instance\r
+  @param HandlerGuid     The GUID to identify the type of the handler.\r
+                         For the SmmChildDispatch protocol, the HandlerGuid\r
+                         must be the GUID of SmmChildDispatch protocol.\r
+  @param Handler         The SMI handler.\r
+  @param CallerAddress   The address of the module who registers the SMI handler.\r
+  @param Context         The context of the SMI handler.\r
+                         For the SmmChildDispatch protocol, the Context\r
+                         must match the one defined for SmmChildDispatch protocol.\r
+  @param ContextSize     The size of the context in bytes.\r
+                         For the SmmChildDispatch protocol, the Context\r
+                         must match the one defined for SmmChildDispatch protocol.\r
+\r
+  @retval EFI_SUCCESS           The information is recorded.\r
+  @retval EFI_OUT_OF_RESOURCES  There is no enough resource to record the information.\r
+**/\r
 typedef\r
 EFI_STATUS\r
 (EFIAPI  *SMI_HANDLER_PROFILE_REGISTER_HANDLER) (\r
@@ -161,12 +182,31 @@ EFI_STATUS
   IN UINTN                          ContextSize OPTIONAL\r
   );\r
 \r
+/**\r
+  This function is called by SmmChildDispatcher module to report\r
+  an existing SMI handler is unregistered, to SmmCore.\r
+\r
+  @param This            The protocol instance\r
+  @param HandlerGuid     The GUID to identify the type of the handler.\r
+                         For the SmmChildDispatch protocol, the HandlerGuid\r
+                         must be the GUID of SmmChildDispatch protocol.\r
+  @param Handler         The SMI handler.\r
+  @param Context         The context of the SMI handler.\r
+                         If it is NOT NULL, it will be used to check what is registered.\r
+  @param ContextSize     The size of the context in bytes.\r
+                         If Context is NOT NULL, it will be used to check what is registered.\r
+\r
+  @retval EFI_SUCCESS           The original record is removed.\r
+  @retval EFI_NOT_FOUND         There is no record for the HandlerGuid and handler.\r
+**/\r
 typedef\r
 EFI_STATUS\r
 (EFIAPI  *SMI_HANDLER_PROFILE_UNREGISTER_HANDLER) (\r
   IN SMI_HANDLER_PROFILE_PROTOCOL   *This,\r
   IN EFI_GUID                       *HandlerGuid,\r
-  IN EFI_SMM_HANDLER_ENTRY_POINT2   Handler\r
+  IN EFI_SMM_HANDLER_ENTRY_POINT2   Handler,\r
+  IN VOID                           *Context, OPTIONAL\r
+  IN UINTN                          ContextSize OPTIONAL\r
   );\r
 \r
 struct _SMI_HANDLER_PROFILE_PROTOCOL {\r