]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Protocol/SmmSwDispatch2.h
IntelFrameworkModulePkg: Add DxeCapsuleLib
[mirror_edk2.git] / MdePkg / Include / Protocol / SmmSwDispatch2.h
1 /** @file
2 SMM Software Dispatch Protocol as defined in PI 1.2 Specification
3 Volume 4 System Management Mode Core Interface.
4
5 This protocol provides the parent dispatch service for a given SMI source generator.
6
7 Copyright (c) 2009 - 2010, 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 _SMM_SW_DISPATCH2_H_
19 #define _SMM_SW_DISPATCH2_H_
20
21 #include <Pi/PiSmmCis.h>
22
23 #define EFI_SMM_SW_DISPATCH2_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 SMI input values.
30 /// For example, the ICH supports only values 00h to 0FFh. The parent only allows a single
31 /// child registration for each SwSmiInputValue.
32 ///
33 typedef struct {
34 UINTN SwSmiInputValue;
35 } EFI_SMM_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_SMM_SW_CONTEXT indicating the index of the CPU which generated the
41 /// software SMI.
42 ///
43 typedef struct {
44 ///
45 /// The 0-based index of the CPU which generated the software SMI.
46 ///
47 UINTN SwSmiCpuIndex;
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_SMM_SW_CONTEXT;
57
58 typedef struct _EFI_SMM_SW_DISPATCH2_PROTOCOL EFI_SMM_SW_DISPATCH2_PROTOCOL;
59
60 /**
61 Register a child SMI source dispatch function for the specified software SMI.
62
63 This service registers a function (DispatchFunction) which will be called when the software
64 SMI source specified by RegisterContext->SwSmiCpuIndex is detected. On return,
65 DispatchHandle contains a unique handle which may be used later to unregister the function
66 using UnRegister().
67
68 Note that the modifiers for the parameter RegisterContext are IN, OUT, while they are IN, CONST
69 in the PI 1.2 errta B spec. This in-consistency is for support for the case where SwSmiInputValue
70 is set to -1, a unique value will be returned in the RegisterContext structure.
71
72 @param[in] This Pointer to the EFI_SMM_SW_DISPATCH2_PROTOCOL instance.
73 @param[in] DispatchFunction Function to register for handler when the specified software
74 SMI is generated.
75 @param[in, out] RegisterContext Pointer to the dispatch function's context.
76 The caller fills this context in before calling
77 the register function to indicate to the register
78 function which Software SMI input value the
79 dispatch function should be invoked for.
80 @param[out] DispatchHandle Handle generated by the dispatcher to track the
81 function instance.
82
83 @retval EFI_SUCCESS The dispatch function has been successfully
84 registered and the SMI source has been enabled.
85 @retval EFI_DEVICE_ERROR The SW driver was unable to enable the SMI source.
86 @retval EFI_INVALID_PARAMETER RegisterContext is invalid. The SW SMI input value
87 is not within valid range.
88 @retval EFI_OUT_OF_RESOURCES There is not enough memory (system or SMM) to manage this
89 child.
90 @retval EFI_OUT_OF_RESOURCES A unique software SMI value could not be assigned
91 for this dispatch.
92 **/
93 typedef
94 EFI_STATUS
95 (EFIAPI *EFI_SMM_SW_REGISTER2)(
96 IN CONST EFI_SMM_SW_DISPATCH2_PROTOCOL *This,
97 IN EFI_SMM_HANDLER_ENTRY_POINT2 DispatchFunction,
98 IN OUT EFI_SMM_SW_REGISTER_CONTEXT *RegisterContext,
99 OUT EFI_HANDLE *DispatchHandle
100 );
101
102 /**
103 Unregister a child SMI source dispatch function for the specified software SMI.
104
105 This service removes the handler associated with DispatchHandle so that it will no longer be
106 called in response to a software SMI.
107
108 @param[in] This Pointer to the EFI_SMM_SW_DISPATCH2_PROTOCOL instance.
109 @param[in] DispatchHandle Handle of dispatch function to deregister.
110
111 @retval EFI_SUCCESS The dispatch function has been successfully unregistered.
112 @retval EFI_INVALID_PARAMETER The DispatchHandle was not valid.
113 **/
114 typedef
115 EFI_STATUS
116 (EFIAPI *EFI_SMM_SW_UNREGISTER2)(
117 IN CONST EFI_SMM_SW_DISPATCH2_PROTOCOL *This,
118 IN EFI_HANDLE DispatchHandle
119 );
120
121 ///
122 /// Interface structure for the SMM Software SMI Dispatch Protocol.
123 ///
124 /// The EFI_SMM_SW_DISPATCH2_PROTOCOL provides the ability to install child handlers for the
125 /// given software. These handlers will respond to software interrupts, and the maximum software
126 /// interrupt in the EFI_SMM_SW_REGISTER_CONTEXT is denoted by MaximumSwiValue.
127 ///
128 struct _EFI_SMM_SW_DISPATCH2_PROTOCOL {
129 EFI_SMM_SW_REGISTER2 Register;
130 EFI_SMM_SW_UNREGISTER2 UnRegister;
131 ///
132 /// A read-only field that describes the maximum value that can be used in the
133 /// EFI_SMM_SW_DISPATCH2_PROTOCOL.Register() service.
134 ///
135 UINTN MaximumSwiValue;
136 };
137
138 extern EFI_GUID gEfiSmmSwDispatch2ProtocolGuid;
139
140 #endif