--- /dev/null
+/** @file\r
+ SMM IO Trap Dispatch2 Protocol as defined in PI 1.1 Specification\r
+ Volume 4 System Management Mode Core Interface.\r
+\r
+ This protocol provides a parent dispatch service for IO trap SMI sources.\r
+\r
+ Copyright (c) 2009, Intel Corporation\r
+ All rights reserved. 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
+ @par Revision Reference:\r
+ This protocol is from PI Version 1.1.\r
+\r
+**/\r
+\r
+#ifndef _SMM_IO_TRAP_DISPATCH2_H_\r
+#define _SMM_IO_TRAP_DISPATCH2_H_\r
+\r
+#include <Pi/PiSmmCis.h>\r
+\r
+#define EFI_SMM_IO_TRAP_DISPATCH2_PROTOCOL_GUID \\r
+ { \\r
+ 0x58dc368d, 0x7bfa, 0x4e77, {0xab, 0xbc, 0xe, 0x29, 0x41, 0x8d, 0xf9, 0x30 } \\r
+ }\r
+\r
+///\r
+/// IO Trap valid types\r
+///\r
+typedef enum {\r
+ WriteTrap,\r
+ ReadTrap,\r
+ ReadWriteTrap,\r
+ IoTrapTypeMaximum\r
+} EFI_SMM_IO_TRAP_DISPATCH_TYPE;\r
+\r
+///\r
+/// IO Trap context structure containing information about the\r
+/// IO trap event that should invoke the handler\r
+///\r
+typedef struct {\r
+ UINT16 Address;\r
+ UINT16 Length;\r
+ EFI_SMM_IO_TRAP_DISPATCH_TYPE Type;\r
+} EFI_SMM_IO_TRAP_REGISTER_CONTEXT;\r
+\r
+///\r
+/// IO Trap context structure containing information about the IO trap that occurred\r
+///\r
+typedef struct {\r
+ UINT32 WriteData;\r
+} EFI_SMM_IO_TRAP_CONTEXT;\r
+\r
+typedef struct _EFI_SMM_IO_TRAP_DISPATCH2_PROTOCOL EFI_SMM_IO_TRAP_DISPATCH2_PROTOCOL;\r
+\r
+/**\r
+ Register an IO trap SMI child handler for a specified SMI.\r
+\r
+ This service registers a function (DispatchFunction) which will be called when an SMI is \r
+ generated because of an access to an I/O port specified by RegisterContext. On return, \r
+ DispatchHandle contains a unique handle which may be used later to unregister the function \r
+ using UnRegister(). If the base of the I/O range specified is zero, then an I/O range with the \r
+ specified length and characteristics will be allocated and the Address field in RegisterContext \r
+ updated. If no range could be allocated, then EFI_OUT_OF_RESOURCES will be returned. \r
+\r
+ The service will not perform GCD allocation if the base address is non-zero or \r
+ EFI_SMM_READY_TO_LOCK has been installed. In this case, the caller is responsible for the \r
+ existence and allocation of the specific IO range.\r
+ An error may be returned if some or all of the requested resources conflict with an existing IO trap \r
+ child handler.\r
+\r
+ It is not required that implementations will allow multiple children for a single IO trap SMI source. \r
+ Some implementations may support multiple children.\r
+ The DispatchFunction will be called with Context updated to contain information \r
+ concerning the I/O action that actually happened and is passed in RegisterContext, with \r
+ CommBuffer pointing to the data actually written and CommBufferSize pointing to the size of \r
+ the data in CommBuffer.\r
+\r
+ @param[in] This Pointer to the EFI_SMM_IO_TRAP_DISPATCH2_PROTOCOL instance.\r
+ @param[in] DispatchFunction Function to register for handler when I/O trap location is accessed.\r
+ @param[in] RegisterContext Pointer to the dispatch function's context. The caller fills this\r
+ context in before calling the register function to indicate to the register\r
+ function the IO trap SMI source for which the dispatch function should be invoked.\r
+ @param[out] DispatchHandle Handle of the dispatch function, for when interfacing with the parent SMM driver.\r
+\r
+ @retval EFI_SUCCESS The dispatch function has been successfully registered.\r
+ @retval EFI_DEVICE_ERROR The driver was unable to complete due to hardware error.\r
+ @retval EFI_OUT_OF_RESOURCES Insufficient resources are available to fulfill the IO trap range request.\r
+ @retval EFI_INVALID_PARAMETER RegisterContext is invalid. The input value is not within a valid range.\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SMM_IO_TRAP_DISPATCH2_REGISTER)(\r
+ IN CONST EFI_SMM_IO_TRAP_DISPATCH2_PROTOCOL *This,\r
+ IN EFI_SMM_HANDLER_ENTRY_POINT2 DispatchFunction,\r
+ IN OUT EFI_SMM_IO_TRAP_REGISTER_CONTEXT *RegisterContext,\r
+ OUT EFI_HANDLE *DispatchHandle\r
+ );\r
+\r
+/**\r
+ Unregister a child SMI source dispatch function with a parent SMM driver.\r
+\r
+ This service removes a previously installed child dispatch handler. This does not guarantee that the \r
+ system resources will be freed from the GCD.\r
+\r
+ @param[in] This Pointer to the EFI_SMM_IO_TRAP_DISPATCH2_PROTOCOL instance. \r
+ @param[in] DispatchHandle Handle of the child service to remove.\r
+\r
+ @retval EFI_SUCCESS The dispatch function has been successfully unregistered.\r
+ @retval EFI_INVALID_PARAMETER The DispatchHandle was not valid.\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SMM_IO_TRAP_DISPATCH2_UNREGISTER)(\r
+ IN CONST EFI_SMM_IO_TRAP_DISPATCH2_PROTOCOL *This,\r
+ IN EFI_HANDLE DispatchHandle\r
+ );\r
+\r
+///\r
+/// Interface structure for the SMM IO Trap Dispatch2 Protocol.\r
+///\r
+/// This protocol provides a parent dispatch service for IO trap SMI sources.\r
+///\r
+struct _EFI_SMM_IO_TRAP_DISPATCH2_PROTOCOL {\r
+ EFI_SMM_IO_TRAP_DISPATCH2_REGISTER Register;\r
+ EFI_SMM_IO_TRAP_DISPATCH2_UNREGISTER UnRegister;\r
+};\r
+\r
+extern EFI_GUID gEfiSmmIoTrapDispatch2ProtocolGuid;\r
+\r
+#endif\r
+\r