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