MdeModulePkg/include: Add SmiHandlerProfile header file.
authorJiewen Yao <jiewen.yao@intel.com>
Fri, 20 Jan 2017 14:09:35 +0000 (06:09 -0800)
committerJiewen Yao <jiewen.yao@intel.com>
Wed, 22 Feb 2017 07:28:13 +0000 (15:28 +0800)
This header file defines:
1) An SMI handler profile protocol. So that SmmChildDispatch
module can register the hardware SMI handler information.
2) The SMI handler profile communication buffer. So that
a shell application can use SMM communication to get the
SMI handler profile info.

Cc: Feng Tian <feng.tian@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
MdeModulePkg/Include/Guid/SmiHandlerProfile.h [new file with mode: 0644]
MdeModulePkg/MdeModulePkg.dec

diff --git a/MdeModulePkg/Include/Guid/SmiHandlerProfile.h b/MdeModulePkg/Include/Guid/SmiHandlerProfile.h
new file mode 100644 (file)
index 0000000..b81631d
--- /dev/null
@@ -0,0 +1,177 @@
+/** @file\r
+  Header file for SMI handler profile definition.\r
+\r
+Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution.  The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#ifndef  _SMI_HANDLER_PROFILE_H_\r
+#define  _SMI_HANDLER_PROFILE_H_\r
+\r
+#include <PiSmm.h>\r
+#include <Protocol/SmmGpiDispatch2.h>\r
+#include <Protocol/SmmIoTrapDispatch2.h>\r
+#include <Protocol/SmmPeriodicTimerDispatch2.h>\r
+#include <Protocol/SmmPowerButtonDispatch2.h>\r
+#include <Protocol/SmmStandbyButtonDispatch2.h>\r
+#include <Protocol/SmmSwDispatch2.h>\r
+#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
+} SMM_CORE_DATABASE_COMMON_HEADER;\r
+\r
+#define SMM_CORE_IMAGE_DATABASE_SIGNATURE SIGNATURE_32 ('S','C','I','D')\r
+#define SMM_CORE_IMAGE_DATABASE_REVISION  0x0001\r
+\r
+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
+  UINT16                              PdbStringOffset;\r
+  UINT8                               Reserved2[6];\r
+//CHAR8                               PdbString[];\r
+} SMM_CORE_IMAGE_DATABASE_STRUCTURE;\r
+\r
+#define SMM_CORE_SMI_DATABASE_SIGNATURE SIGNATURE_32 ('S','C','S','D')\r
+#define SMM_CORE_SMI_DATABASE_REVISION  0x0001\r
+\r
+typedef enum {\r
+  SmmCoreSmiHandlerCategoryRootHandler,\r
+  SmmCoreSmiHandlerCategoryGuidHandler,\r
+  SmmCoreSmiHandlerCategoryHardwareHandler,\r
+} SMM_CORE_SMI_HANDLER_CATEGORY;\r
+\r
+//\r
+// Context for SmmCoreSmiHandlerCategoryRootHandler:\r
+//   NULL\r
+// Context for SmmCoreSmiHandlerCategoryGuidHandler:\r
+//   NULL\r
+// Context for SmmCoreSmiHandlerCategoryHardwareHandler:\r
+//   (NOTE: The context field should NOT include any data pointer.)\r
+//   gEfiSmmSwDispatch2ProtocolGuid:            EFI_SMM_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
+//   gEfiSmmPeriodicTimerDispatch2ProtocolGuid: EFI_SMM_PERIODIC_TIMER_CONTEXT\r
+//   gEfiSmmGpiDispatch2ProtocolGuid:           EFI_SMM_GPI_REGISTER_CONTEXT\r
+//   gEfiSmmIoTrapDispatch2ProtocolGuid:        EFI_SMM_IO_TRAP_REGISTER_CONTEXT\r
+//   gEfiSmmUsbDispatch2ProtocolGuid:           (EFI_SMM_USB_REGISTER_CONTEXT => SMI_HANDLER_PROFILE_USB_REGISTER_CONTEXT)\r
+//   Other:                                     GUID specific\r
+\r
+typedef struct {\r
+  EFI_USB_SMI_TYPE          Type;\r
+  UINT32                    DevicePathSize;\r
+//UINT8                     DevicePath[DevicePathSize];\r
+} 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
+} 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
+//SMM_CORE_SMI_HANDLER_STRUCTURE      Handler[HandlerCount];\r
+} SMM_CORE_SMI_DATABASE_STRUCTURE;\r
+\r
+//\r
+// Layout:\r
+// +-------------------------------------+\r
+// | SMM_CORE_IMAGE_DATABASE_STRUCTURE   |\r
+// +-------------------------------------+\r
+// | SMM_CORE_SMI_DATABASE_STRUCTURE     |\r
+// +-------------------------------------+\r
+//\r
+\r
+\r
+\r
+//\r
+// SMM_CORE dump command\r
+//\r
+#define SMI_HANDLER_PROFILE_COMMAND_GET_INFO           0x1\r
+#define SMI_HANDLER_PROFILE_COMMAND_GET_DATA_BY_OFFSET 0x2\r
+\r
+typedef struct {\r
+  UINT32                            Command;\r
+  UINT32                            DataLength;\r
+  UINT64                            ReturnStatus;\r
+} SMI_HANDLER_PROFILE_PARAMETER_HEADER;\r
+\r
+typedef struct {\r
+  SMI_HANDLER_PROFILE_PARAMETER_HEADER    Header;\r
+  UINT64                                  DataSize;\r
+} SMI_HANDLER_PROFILE_PARAMETER_GET_INFO;\r
+\r
+typedef struct {\r
+  SMI_HANDLER_PROFILE_PARAMETER_HEADER    Header;\r
+  //\r
+  // On input, data buffer size.\r
+  // On output, actual data buffer size copied.\r
+  //\r
+  UINT64                                  DataSize;\r
+  PHYSICAL_ADDRESS                        DataBuffer;\r
+  //\r
+  // On input, data buffer offset to copy.\r
+  // On output, next time data buffer offset to copy.\r
+  //\r
+  UINT64                                  DataOffset;\r
+} SMI_HANDLER_PROFILE_PARAMETER_GET_DATA_BY_OFFSET;\r
+\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
+typedef\r
+EFI_STATUS\r
+(EFIAPI  *SMI_HANDLER_PROFILE_REGISTER_HANDLER) (\r
+  IN SMI_HANDLER_PROFILE_PROTOCOL   *This,\r
+  IN EFI_GUID                       *HandlerGuid,\r
+  IN EFI_SMM_HANDLER_ENTRY_POINT2   Handler,\r
+  IN PHYSICAL_ADDRESS               CallerAddress,\r
+  IN VOID                           *Context, OPTIONAL\r
+  IN UINTN                          ContextSize OPTIONAL\r
+  );\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
+  );\r
+\r
+struct _SMI_HANDLER_PROFILE_PROTOCOL {\r
+  SMI_HANDLER_PROFILE_REGISTER_HANDLER     RegisterHandler;\r
+  SMI_HANDLER_PROFILE_UNREGISTER_HANDLER   UnregisterHandler;\r
+};\r
+\r
+#endif\r
index 9b7fb63..1e5c24a 100644 (file)
   ## Include/Guid/PiSmmMemoryAttributesTable.h\r
   gEdkiiPiSmmMemoryAttributesTableGuid = { 0x6b9fd3f7, 0x16df, 0x45e8, {0xbd, 0x39, 0xb9, 0x4a, 0x66, 0x54, 0x1a, 0x5d}}\r
 \r
+  ## Include/Guid/SmiHandlerProfile.h\r
+  gSmiHandlerProfileGuid = {0x49174342, 0x7108, 0x409b, {0x8b, 0xbe, 0x65, 0xfd, 0xa8, 0x53, 0x89, 0xf5}}\r
+\r
   ## Include/Guid/NonDiscoverableDevice.h\r
   gEdkiiNonDiscoverableAhciDeviceGuid = { 0xC7D35798, 0xE4D2, 0x4A93, {0xB1, 0x45, 0x54, 0x88, 0x9F, 0x02, 0x58, 0x4B } }\r
   gEdkiiNonDiscoverableAmbaDeviceGuid = { 0x94440339, 0xCC93, 0x4506, {0xB4, 0xC6, 0xEE, 0x8D, 0x0F, 0x4C, 0xA1, 0x91 } }\r