summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Include/Guid
diff options
context:
space:
mode:
authorJiewen Yao <jiewen.yao@intel.com>2017-01-20 06:09:35 -0800
committerJiewen Yao <jiewen.yao@intel.com>2017-02-22 15:28:13 +0800
commit65fb940adb68fdc0108daf33036b5bebe6169f4b (patch)
treeca657c0bae757caf5772498b873c45cf8cae41bd /MdeModulePkg/Include/Guid
parent0466aac877e5c0666c4db6c072196f3e4bff9020 (diff)
downloadedk2-65fb940adb68fdc0108daf33036b5bebe6169f4b.tar.gz
edk2-65fb940adb68fdc0108daf33036b5bebe6169f4b.tar.bz2
edk2-65fb940adb68fdc0108daf33036b5bebe6169f4b.zip
MdeModulePkg/include: Add SmiHandlerProfile header file.
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>
Diffstat (limited to 'MdeModulePkg/Include/Guid')
-rw-r--r--MdeModulePkg/Include/Guid/SmiHandlerProfile.h177
1 files changed, 177 insertions, 0 deletions
diff --git a/MdeModulePkg/Include/Guid/SmiHandlerProfile.h b/MdeModulePkg/Include/Guid/SmiHandlerProfile.h
new file mode 100644
index 0000000000..b81631dcf4
--- /dev/null
+++ b/MdeModulePkg/Include/Guid/SmiHandlerProfile.h
@@ -0,0 +1,177 @@
+/** @file
+ Header file for SMI handler profile definition.
+
+Copyright (c) 2017, 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 _SMI_HANDLER_PROFILE_H_
+#define _SMI_HANDLER_PROFILE_H_
+
+#include <PiSmm.h>
+#include <Protocol/SmmGpiDispatch2.h>
+#include <Protocol/SmmIoTrapDispatch2.h>
+#include <Protocol/SmmPeriodicTimerDispatch2.h>
+#include <Protocol/SmmPowerButtonDispatch2.h>
+#include <Protocol/SmmStandbyButtonDispatch2.h>
+#include <Protocol/SmmSwDispatch2.h>
+#include <Protocol/SmmSxDispatch2.h>
+#include <Protocol/SmmUsbDispatch2.h>
+
+#pragma pack(1)
+
+typedef struct {
+ UINT32 Signature;
+ UINT32 Length;
+ UINT32 Revision;
+} SMM_CORE_DATABASE_COMMON_HEADER;
+
+#define SMM_CORE_IMAGE_DATABASE_SIGNATURE SIGNATURE_32 ('S','C','I','D')
+#define SMM_CORE_IMAGE_DATABASE_REVISION 0x0001
+
+typedef struct {
+ SMM_CORE_DATABASE_COMMON_HEADER Header;
+ EFI_GUID FileGuid;
+ UINTN ImageRef;
+ UINTN EntryPoint;
+ UINTN ImageBase;
+ UINTN ImageSize;
+ UINT16 PdbStringOffset;
+ UINT8 Reserved2[6];
+//CHAR8 PdbString[];
+} SMM_CORE_IMAGE_DATABASE_STRUCTURE;
+
+#define SMM_CORE_SMI_DATABASE_SIGNATURE SIGNATURE_32 ('S','C','S','D')
+#define SMM_CORE_SMI_DATABASE_REVISION 0x0001
+
+typedef enum {
+ SmmCoreSmiHandlerCategoryRootHandler,
+ SmmCoreSmiHandlerCategoryGuidHandler,
+ SmmCoreSmiHandlerCategoryHardwareHandler,
+} SMM_CORE_SMI_HANDLER_CATEGORY;
+
+//
+// Context for SmmCoreSmiHandlerCategoryRootHandler:
+// NULL
+// Context for SmmCoreSmiHandlerCategoryGuidHandler:
+// NULL
+// Context for SmmCoreSmiHandlerCategoryHardwareHandler:
+// (NOTE: The context field should NOT include any data pointer.)
+// gEfiSmmSwDispatch2ProtocolGuid: EFI_SMM_SW_REGISTER_CONTEXT
+// gEfiSmmSxDispatch2ProtocolGuid: EFI_SMM_SX_REGISTER_CONTEXT
+// gEfiSmmPowerButtonDispatch2ProtocolGuid: EFI_SMM_POWER_BUTTON_REGISTER_CONTEXT
+// gEfiSmmStandbyButtonDispatch2ProtocolGuid: EFI_SMM_STANDBY_BUTTON_REGISTER_CONTEXT
+// gEfiSmmPeriodicTimerDispatch2ProtocolGuid: EFI_SMM_PERIODIC_TIMER_CONTEXT
+// gEfiSmmGpiDispatch2ProtocolGuid: EFI_SMM_GPI_REGISTER_CONTEXT
+// gEfiSmmIoTrapDispatch2ProtocolGuid: EFI_SMM_IO_TRAP_REGISTER_CONTEXT
+// gEfiSmmUsbDispatch2ProtocolGuid: (EFI_SMM_USB_REGISTER_CONTEXT => SMI_HANDLER_PROFILE_USB_REGISTER_CONTEXT)
+// Other: GUID specific
+
+typedef struct {
+ EFI_USB_SMI_TYPE Type;
+ UINT32 DevicePathSize;
+//UINT8 DevicePath[DevicePathSize];
+} SMI_HANDLER_PROFILE_USB_REGISTER_CONTEXT;
+
+typedef struct {
+ UINT32 Length;
+ UINTN CallerAddr;
+ UINTN Handler;
+ UINTN ImageRef;
+ UINT16 ContextBufferOffset;
+ UINT8 Reserved2[2];
+ UINT32 ContextBufferSize;
+//UINT8 ContextBuffer[];
+} SMM_CORE_SMI_HANDLER_STRUCTURE;
+
+typedef struct {
+ SMM_CORE_DATABASE_COMMON_HEADER Header;
+ UINT32 HandlerCategory;
+ EFI_GUID HandlerType;
+ UINTN HandlerCount;
+//SMM_CORE_SMI_HANDLER_STRUCTURE Handler[HandlerCount];
+} SMM_CORE_SMI_DATABASE_STRUCTURE;
+
+//
+// Layout:
+// +-------------------------------------+
+// | SMM_CORE_IMAGE_DATABASE_STRUCTURE |
+// +-------------------------------------+
+// | SMM_CORE_SMI_DATABASE_STRUCTURE |
+// +-------------------------------------+
+//
+
+
+
+//
+// SMM_CORE dump command
+//
+#define SMI_HANDLER_PROFILE_COMMAND_GET_INFO 0x1
+#define SMI_HANDLER_PROFILE_COMMAND_GET_DATA_BY_OFFSET 0x2
+
+typedef struct {
+ UINT32 Command;
+ UINT32 DataLength;
+ UINT64 ReturnStatus;
+} SMI_HANDLER_PROFILE_PARAMETER_HEADER;
+
+typedef struct {
+ SMI_HANDLER_PROFILE_PARAMETER_HEADER Header;
+ UINT64 DataSize;
+} SMI_HANDLER_PROFILE_PARAMETER_GET_INFO;
+
+typedef struct {
+ SMI_HANDLER_PROFILE_PARAMETER_HEADER Header;
+ //
+ // On input, data buffer size.
+ // On output, actual data buffer size copied.
+ //
+ UINT64 DataSize;
+ PHYSICAL_ADDRESS DataBuffer;
+ //
+ // On input, data buffer offset to copy.
+ // On output, next time data buffer offset to copy.
+ //
+ UINT64 DataOffset;
+} SMI_HANDLER_PROFILE_PARAMETER_GET_DATA_BY_OFFSET;
+
+#define SMI_HANDLER_PROFILE_GUID {0x49174342, 0x7108, 0x409b, {0x8b, 0xbe, 0x65, 0xfd, 0xa8, 0x53, 0x89, 0xf5}}
+
+#pragma pack()
+
+extern EFI_GUID gSmiHandlerProfileGuid;
+
+typedef struct _SMI_HANDLER_PROFILE_PROTOCOL SMI_HANDLER_PROFILE_PROTOCOL;
+
+typedef
+EFI_STATUS
+(EFIAPI *SMI_HANDLER_PROFILE_REGISTER_HANDLER) (
+ 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
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *SMI_HANDLER_PROFILE_UNREGISTER_HANDLER) (
+ IN SMI_HANDLER_PROFILE_PROTOCOL *This,
+ IN EFI_GUID *HandlerGuid,
+ IN EFI_SMM_HANDLER_ENTRY_POINT2 Handler
+ );
+
+struct _SMI_HANDLER_PROFILE_PROTOCOL {
+ SMI_HANDLER_PROFILE_REGISTER_HANDLER RegisterHandler;
+ SMI_HANDLER_PROFILE_UNREGISTER_HANDLER UnregisterHandler;
+};
+
+#endif