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