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