]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Protocol/MmSwDispatch.h
MdePkg: Update MmSwDispatch.h's references to SmmSw2Dispatch.
[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 This program and the accompanying materials
9 are licensed and made available under the terms and conditions of the BSD License
10 which accompanies this distribution. The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php
12
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15
16 **/
17
18 #ifndef _MM_SW_DISPATCH_H_
19 #define _MM_SW_DISPATCH_H_
20
21 #include <Pi/PiMmCis.h>
22
23 #define EFI_MM_SW_DISPATCH_PROTOCOL_GUID \
24 { \
25 0x18a3c6dc, 0x5eea, 0x48c8, {0xa1, 0xc1, 0xb5, 0x33, 0x89, 0xf9, 0x89, 0x99 } \
26 }
27
28 ///
29 /// A particular chipset may not support all possible software MMI input values.
30 /// For example, the ICH supports only values 00h to 0FFh. The parent only allows a single
31 /// child registration for each SwMmiInputValue.
32 ///
33 typedef struct {
34 UINTN SwMmiInputValue;
35 } EFI_MM_SW_REGISTER_CONTEXT;
36
37 ///
38 /// The DispatchFunction will be called with Context set to the same value as was passed into
39 /// this function in RegisterContext and with CommBuffer (and CommBufferSize) pointing
40 /// to an instance of EFI_MM_SW_CONTEXT indicating the index of the CPU which generated the
41 /// software MMI.
42 ///
43 typedef struct {
44 ///
45 /// The 0-based index of the CPU which generated the software MMI.
46 ///
47 UINTN SwMmiCpuIndex;
48 ///
49 /// This value corresponds directly to the CommandPort parameter used in the call to Trigger().
50 ///
51 UINT8 CommandPort;
52 ///
53 /// This value corresponds directly to the DataPort parameter used in the call to Trigger().
54 ///
55 UINT8 DataPort;
56 } EFI_MM_SW_CONTEXT;
57
58 typedef struct _EFI_MM_SW_DISPATCH_PROTOCOL EFI_MM_SW_DISPATCH_PROTOCOL;
59
60 /**
61 Register a child MMI source dispatch function for the specified software MMI.
62
63 This service registers a function (DispatchFunction) which will be called when the software
64 MMI source specified by RegisterContext->SwMmiCpuIndex is detected. On return,
65 DispatchHandle contains a unique handle which may be used later to unregister the function
66 using UnRegister().
67
68 @param[in] This Pointer to the EFI_MM_SW_DISPATCH_PROTOCOL instance.
69 @param[in] DispatchFunction Function to register for handler when the specified software
70 MMI is generated.
71 @param[in, out] RegisterContext Pointer to the dispatch function's context.
72 The caller fills this context in before calling
73 the register function to indicate to the register
74 function which Software MMI input value the
75 dispatch function should be invoked for.
76 @param[out] DispatchHandle Handle generated by the dispatcher to track the
77 function instance.
78
79 @retval EFI_SUCCESS The dispatch function has been successfully
80 registered and the MMI source has been enabled.
81 @retval EFI_DEVICE_ERROR The SW driver was unable to enable the MMI source.
82 @retval EFI_INVALID_PARAMETER RegisterContext is invalid. The SW MMI input value
83 is not within a valid range or is already in use.
84 @retval EFI_OUT_OF_RESOURCES There is not enough memory (system or MM) to manage this
85 child.
86 @retval EFI_OUT_OF_RESOURCES A unique software MMI value could not be assigned
87 for this dispatch.
88 **/
89 typedef
90 EFI_STATUS
91 (EFIAPI *EFI_MM_SW_REGISTER)(
92 IN CONST EFI_MM_SW_DISPATCH_PROTOCOL *This,
93 IN EFI_MM_HANDLER_ENTRY_POINT DispatchFunction,
94 IN OUT EFI_MM_SW_REGISTER_CONTEXT *RegisterContext,
95 OUT EFI_HANDLE *DispatchHandle
96 );
97
98 /**
99 Unregister a child MMI source dispatch function for the specified software MMI.
100
101 This service removes the handler associated with DispatchHandle so that it will no longer be
102 called in response to a software MMI.
103
104 @param[in] This Pointer to the EFI_MM_SW_DISPATCH_PROTOCOL instance.
105 @param[in] DispatchHandle Handle of dispatch function to deregister.
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_SW_UNREGISTER)(
113 IN CONST EFI_MM_SW_DISPATCH_PROTOCOL *This,
114 IN EFI_HANDLE DispatchHandle
115 );
116
117 ///
118 /// Interface structure for the MM Software MMI Dispatch Protocol.
119 ///
120 /// The EFI_MM_SW_DISPATCH_PROTOCOL provides the ability to install child handlers for the
121 /// given software. These handlers will respond to software interrupts, and the maximum software
122 /// interrupt in the EFI_MM_SW_REGISTER_CONTEXT is denoted by MaximumSwiValue.
123 ///
124 struct _EFI_MM_SW_DISPATCH_PROTOCOL {
125 EFI_MM_SW_REGISTER Register;
126 EFI_MM_SW_UNREGISTER UnRegister;
127 ///
128 /// A read-only field that describes the maximum value that can be used in the
129 /// EFI_MM_SW_DISPATCH_PROTOCOL.Register() service.
130 ///
131 UINTN MaximumSwiValue;
132 };
133
134 extern EFI_GUID gEfiMmSwDispatchProtocolGuid;
135
136 #endif