]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/MmIoTrapDispatch.h
MdePkg FirmwareManagement.h: Fix typo EFI_SECURITY_VIOLATIO
[mirror_edk2.git] / MdePkg / Include / Protocol / MmIoTrapDispatch.h
CommitLineData
07c6a47e
ED
1/** @file\r
2 MM IO Trap Dispatch Protocol as defined in PI 1.5 Specification\r
3 Volume 4 Management Mode Core Interface.\r
4\r
5 This protocol provides a parent dispatch service for IO trap MMI sources.\r
6\r
7 Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>\r
8 This program and the accompanying materials\r
9 are licensed and made available under the terms and conditions of the BSD License\r
10 which accompanies this distribution. The full text of the license may be found at\r
11 http://opensource.org/licenses/bsd-license.php\r
12\r
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
15\r
16 @par Revision Reference:\r
17 This protocol is from PI Version 1.5.\r
18\r
19**/\r
20\r
21#ifndef _MM_IO_TRAP_DISPATCH_H_\r
22#define _MM_IO_TRAP_DISPATCH_H_\r
23\r
24#include <Pi/PiMmCis.h>\r
25\r
26#define EFI_MM_IO_TRAP_DISPATCH_PROTOCOL_GUID \\r
27 { \\r
28 0x58dc368d, 0x7bfa, 0x4e77, {0xab, 0xbc, 0xe, 0x29, 0x41, 0x8d, 0xf9, 0x30 } \\r
29 }\r
30\r
31///\r
32/// IO Trap valid types\r
33///\r
34typedef enum {\r
35 WriteTrap,\r
36 ReadTrap,\r
37 ReadWriteTrap,\r
38 IoTrapTypeMaximum\r
39} EFI_MM_IO_TRAP_DISPATCH_TYPE;\r
40\r
41///\r
42/// IO Trap context structure containing information about the\r
43/// IO trap event that should invoke the handler\r
44///\r
45typedef struct {\r
46 UINT16 Address;\r
47 UINT16 Length;\r
48 EFI_MM_IO_TRAP_DISPATCH_TYPE Type;\r
49} EFI_MM_IO_TRAP_REGISTER_CONTEXT;\r
50\r
51///\r
52/// IO Trap context structure containing information about the IO trap that occurred\r
53///\r
54typedef struct {\r
55 UINT32 WriteData;\r
56} EFI_MM_IO_TRAP_CONTEXT;\r
57\r
58typedef struct _EFI_MM_IO_TRAP_DISPATCH_PROTOCOL EFI_MM_IO_TRAP_DISPATCH_PROTOCOL;\r
59\r
60/**\r
61 Register an IO trap MMI child handler for a specified MMI.\r
62\r
63 This service registers a function (DispatchFunction) which will be called when an MMI is\r
64 generated because of an access to an I/O port specified by RegisterContext. On return,\r
65 DispatchHandle contains a unique handle which may be used later to unregister the function\r
66 using UnRegister(). If the base of the I/O range specified is zero, then an I/O range with the\r
67 specified length and characteristics will be allocated and the Address field in RegisterContext\r
68 updated. If no range could be allocated, then EFI_OUT_OF_RESOURCES will be returned.\r
69\r
70 The service will not perform GCD allocation if the base address is non-zero or\r
71 EFI_MM_READY_TO_LOCK has been installed. In this case, the caller is responsible for the\r
72 existence and allocation of the specific IO range.\r
73 An error may be returned if some or all of the requested resources conflict with an existing IO trap\r
74 child handler.\r
75\r
76 It is not required that implementations will allow multiple children for a single IO trap MMI source.\r
77 Some implementations may support multiple children.\r
78 The DispatchFunction will be called with Context updated to contain information\r
79 concerning the I/O action that actually happened and is passed in RegisterContext, with\r
80 CommBuffer pointing to the data actually written and CommBufferSize pointing to the size of\r
81 the data in CommBuffer.\r
82\r
83 @param[in] This Pointer to the EFI_MM_IO_TRAP_DISPATCH_PROTOCOL instance.\r
84 @param[in] DispatchFunction Function to register for handler when I/O trap location is accessed.\r
85 @param[in] RegisterContext Pointer to the dispatch function's context. The caller fills this\r
86 context in before calling the register function to indicate to the register\r
87 function the IO trap MMI source for which the dispatch function should be invoked.\r
88 @param[out] DispatchHandle Handle of the dispatch function, for when interfacing with the parent MM driver.\r
89\r
90 @retval EFI_SUCCESS The dispatch function has been successfully registered.\r
91 @retval EFI_DEVICE_ERROR The driver was unable to complete due to hardware error.\r
92 @retval EFI_OUT_OF_RESOURCES Insufficient resources are available to fulfill the IO trap range request.\r
93 @retval EFI_INVALID_PARAMETER RegisterContext is invalid. The input value is not within a valid range.\r
94**/\r
95typedef\r
96EFI_STATUS\r
97(EFIAPI *EFI_MM_IO_TRAP_DISPATCH_REGISTER)(\r
98 IN CONST EFI_MM_IO_TRAP_DISPATCH_PROTOCOL *This,\r
99 IN EFI_MM_HANDLER_ENTRY_POINT DispatchFunction,\r
100 IN OUT EFI_MM_IO_TRAP_REGISTER_CONTEXT *RegisterContext,\r
101 OUT EFI_HANDLE *DispatchHandle\r
102 );\r
103\r
104/**\r
105 Unregister a child MMI source dispatch function with a parent MM driver.\r
106\r
107 This service removes a previously installed child dispatch handler. This does not guarantee that the\r
108 system resources will be freed from the GCD.\r
109\r
110 @param[in] This Pointer to the EFI_MM_IO_TRAP_DISPATCH_PROTOCOL instance.\r
111 @param[in] DispatchHandle Handle of the child service to remove.\r
112\r
113 @retval EFI_SUCCESS The dispatch function has been successfully unregistered.\r
114 @retval EFI_INVALID_PARAMETER The DispatchHandle was not valid.\r
115**/\r
116typedef\r
117EFI_STATUS\r
118(EFIAPI *EFI_MM_IO_TRAP_DISPATCH_UNREGISTER)(\r
119 IN CONST EFI_MM_IO_TRAP_DISPATCH_PROTOCOL *This,\r
120 IN EFI_HANDLE DispatchHandle\r
121 );\r
122\r
123///\r
124/// Interface structure for the MM IO Trap Dispatch Protocol.\r
125///\r
126/// This protocol provides a parent dispatch service for IO trap MMI sources.\r
127///\r
128struct _EFI_MM_IO_TRAP_DISPATCH_PROTOCOL {\r
129 EFI_MM_IO_TRAP_DISPATCH_REGISTER Register;\r
130 EFI_MM_IO_TRAP_DISPATCH_UNREGISTER UnRegister;\r
131};\r
132\r
133extern EFI_GUID gEfiMmIoTrapDispatchProtocolGuid;\r
134\r
135#endif\r
136\r