]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Protocol/MmSwDispatch.h
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Include / Protocol / MmSwDispatch.h
1 /** @file
2 MM Software Dispatch Protocol introduced from PI 1.5 Specification
3 Volume 4 Management Mode Core Interface.
4
5 This protocol provides the parent dispatch service for a given MMI source generator.
6
7 Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
8 SPDX-License-Identifier: BSD-2-Clause-Patent
9
10 **/
11
12 #ifndef _MM_SW_DISPATCH_H_
13 #define _MM_SW_DISPATCH_H_
14
15 #include <Pi/PiMmCis.h>
16
17 #define EFI_MM_SW_DISPATCH_PROTOCOL_GUID \
18 { \
19 0x18a3c6dc, 0x5eea, 0x48c8, {0xa1, 0xc1, 0xb5, 0x33, 0x89, 0xf9, 0x89, 0x99 } \
20 }
21
22 ///
23 /// A particular chipset may not support all possible software MMI input values.
24 /// For example, the ICH supports only values 00h to 0FFh. The parent only allows a single
25 /// child registration for each SwMmiInputValue.
26 ///
27 typedef struct {
28 UINTN SwMmiInputValue;
29 } EFI_MM_SW_REGISTER_CONTEXT;
30
31 ///
32 /// The DispatchFunction will be called with Context set to the same value as was passed into
33 /// this function in RegisterContext and with CommBuffer (and CommBufferSize) pointing
34 /// to an instance of EFI_MM_SW_CONTEXT indicating the index of the CPU which generated the
35 /// software MMI.
36 ///
37 typedef struct {
38 ///
39 /// The 0-based index of the CPU which generated the software MMI.
40 ///
41 UINTN SwMmiCpuIndex;
42 ///
43 /// This value corresponds directly to the CommandPort parameter used in the call to Trigger().
44 ///
45 UINT8 CommandPort;
46 ///
47 /// This value corresponds directly to the DataPort parameter used in the call to Trigger().
48 ///
49 UINT8 DataPort;
50 } EFI_MM_SW_CONTEXT;
51
52 typedef struct _EFI_MM_SW_DISPATCH_PROTOCOL EFI_MM_SW_DISPATCH_PROTOCOL;
53
54 /**
55 Register a child MMI source dispatch function for the specified software MMI.
56
57 This service registers a function (DispatchFunction) which will be called when the software
58 MMI source specified by RegisterContext->SwMmiCpuIndex is detected. On return,
59 DispatchHandle contains a unique handle which may be used later to unregister the function
60 using UnRegister().
61
62 @param[in] This Pointer to the EFI_MM_SW_DISPATCH_PROTOCOL instance.
63 @param[in] DispatchFunction Function to register for handler when the specified software
64 MMI is generated.
65 @param[in, out] RegisterContext Pointer to the dispatch function's context.
66 The caller fills this context in before calling
67 the register function to indicate to the register
68 function which Software MMI input value the
69 dispatch function should be invoked for.
70 @param[out] DispatchHandle Handle generated by the dispatcher to track the
71 function instance.
72
73 @retval EFI_SUCCESS The dispatch function has been successfully
74 registered and the MMI source has been enabled.
75 @retval EFI_DEVICE_ERROR The SW driver was unable to enable the MMI source.
76 @retval EFI_INVALID_PARAMETER RegisterContext is invalid. The SW MMI input value
77 is not within a valid range or is already in use.
78 @retval EFI_OUT_OF_RESOURCES There is not enough memory (system or MM) to manage this
79 child.
80 @retval EFI_OUT_OF_RESOURCES A unique software MMI value could not be assigned
81 for this dispatch.
82 **/
83 typedef
84 EFI_STATUS
85 (EFIAPI *EFI_MM_SW_REGISTER)(
86 IN CONST EFI_MM_SW_DISPATCH_PROTOCOL *This,
87 IN EFI_MM_HANDLER_ENTRY_POINT DispatchFunction,
88 IN OUT EFI_MM_SW_REGISTER_CONTEXT *RegisterContext,
89 OUT EFI_HANDLE *DispatchHandle
90 );
91
92 /**
93 Unregister a child MMI source dispatch function for the specified software MMI.
94
95 This service removes the handler associated with DispatchHandle so that it will no longer be
96 called in response to a software MMI.
97
98 @param[in] This Pointer to the EFI_MM_SW_DISPATCH_PROTOCOL instance.
99 @param[in] DispatchHandle Handle of dispatch function to deregister.
100
101 @retval EFI_SUCCESS The dispatch function has been successfully unregistered.
102 @retval EFI_INVALID_PARAMETER The DispatchHandle was not valid.
103 **/
104 typedef
105 EFI_STATUS
106 (EFIAPI *EFI_MM_SW_UNREGISTER)(
107 IN CONST EFI_MM_SW_DISPATCH_PROTOCOL *This,
108 IN EFI_HANDLE DispatchHandle
109 );
110
111 ///
112 /// Interface structure for the MM Software MMI Dispatch Protocol.
113 ///
114 /// The EFI_MM_SW_DISPATCH_PROTOCOL provides the ability to install child handlers for the
115 /// given software. These handlers will respond to software interrupts, and the maximum software
116 /// interrupt in the EFI_MM_SW_REGISTER_CONTEXT is denoted by MaximumSwiValue.
117 ///
118 struct _EFI_MM_SW_DISPATCH_PROTOCOL {
119 EFI_MM_SW_REGISTER Register;
120 EFI_MM_SW_UNREGISTER UnRegister;
121 ///
122 /// A read-only field that describes the maximum value that can be used in the
123 /// EFI_MM_SW_DISPATCH_PROTOCOL.Register() service.
124 ///
125 UINTN MaximumSwiValue;
126 };
127
128 extern EFI_GUID gEfiMmSwDispatchProtocolGuid;
129
130 #endif