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