]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Protocol/SmmUsbDispatch2.h
Rename PI SMM definitions which has same name with those of Framework SMM spec but...
[mirror_edk2.git] / MdePkg / Include / Protocol / SmmUsbDispatch2.h
1 /** @file
2 SMM USB Dispatch2 Protocol as defined in PI 1.1 Specification
3 Volume 4 System Management Mode Core Interface.
4
5 Provides the parent dispatch service for the USB 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 @par Revision Reference:
17 This protocol is from PI Version 1.1.
18
19 **/
20
21 #ifndef _SMM_USB_DISPATCH2_H_
22 #define _SMM_USB_DISPATCH2_H_
23
24 #include <Pi/PiSmmCis.h>
25
26 ///
27 /// Note:
28 /// To avoid name conflict between PI and Framework SMM spec, the following names defined
29 /// in PI 1.2 SMM spec are renamed. These renamings are not yet in a public PI spec and errta.
30 ///
31 /// EFI_SMM_USB_REGISTER -> EFI_SMM_USB_REGISTER2
32 /// EFI_SMM_USB_UNREGISTER -> EFI_SMM_USB_UNREGISTER2
33 ///
34
35 #define EFI_SMM_USB_DISPATCH2_PROTOCOL_GUID \
36 { \
37 0xee9b8d90, 0xc5a6, 0x40a2, {0xbd, 0xe2, 0x52, 0x55, 0x8d, 0x33, 0xcc, 0xa1 } \
38 }
39
40 ///
41 /// USB SMI event types
42 ///
43 typedef enum {
44 UsbLegacy,
45 UsbWake
46 } EFI_USB_SMI_TYPE;
47
48 ///
49 /// The dispatch function's context.
50 ///
51 typedef struct {
52 ///
53 /// Describes whether this child handler will be invoked in response to a USB legacy
54 /// emulation event, such as port-trap on the PS/2* keyboard control registers, or to a
55 /// USB wake event, such as resumption from a sleep state.
56 ///
57 EFI_USB_SMI_TYPE Type;
58 ///
59 /// The device path is part of the context structure and describes the location of the
60 /// particular USB host controller in the system for which this register event will occur.
61 /// This location is important because of the possible integration of several USB host
62 /// controllers in a system.
63 ///
64 EFI_DEVICE_PATH_PROTOCOL *Device;
65 } EFI_SMM_USB_REGISTER_CONTEXT;
66
67 typedef struct _EFI_SMM_USB_DISPATCH2_PROTOCOL EFI_SMM_USB_DISPATCH2_PROTOCOL;
68
69 /**
70 Provides the parent dispatch service for the USB SMI source generator.
71
72 This service registers a function (DispatchFunction) which will be called when the USB-
73 related SMI specified by RegisterContext has occurred. On return, DispatchHandle
74 contains a unique handle which may be used later to unregister the function using UnRegister().
75 The DispatchFunction will be called with Context set to the same value as was passed into
76 this function in RegisterContext and with CommBuffer containing NULL and
77 CommBufferSize containing zero.
78
79 @param[in] This Pointer to the EFI_SMM_USB_DISPATCH2_PROTOCOL instance.
80 @param[in] DispatchFunction Function to register for handler when a USB-related SMI occurs.
81 @param[in] RegisterContext Pointer to the dispatch function's context.
82 The caller fills this context in before calling
83 the register function to indicate to the register
84 function the USB SMI types for which the dispatch
85 function should be invoked.
86 @param[out] DispatchHandle Handle generated by the dispatcher to track the 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 driver was unable to enable the SMI source.
91 @retval EFI_INVALID_PARAMETER RegisterContext is invalid. The USB SMI type
92 is not within valid range.
93 @retval EFI_OUT_OF_RESOURCES There is not enough memory (system or SMM) to manage this child.
94 **/
95 typedef
96 EFI_STATUS
97 (EFIAPI *EFI_SMM_USB_REGISTER2)(
98 IN CONST EFI_SMM_USB_DISPATCH2_PROTOCOL *This,
99 IN EFI_SMM_HANDLER_ENTRY_POINT2 DispatchFunction,
100 IN CONST EFI_SMM_USB_REGISTER_CONTEXT *RegisterContext,
101 OUT EFI_HANDLE *DispatchHandle
102 );
103
104 /**
105 Unregisters a USB service.
106
107 This service removes the handler associated with DispatchHandle so that it will no longer be
108 called when the USB event occurs.
109
110 @param[in] This Pointer to the EFI_SMM_USB_DISPATCH2_PROTOCOL instance.
111 @param[in] DispatchHandle Handle of the service to remove.
112
113 @retval EFI_SUCCESS The dispatch function has been successfully
114 unregistered and the SMI source has been disabled
115 if there are no other registered child dispatch
116 functions for this SMI source.
117 @retval EFI_INVALID_PARAMETER The DispatchHandle was not valid.
118 **/
119 typedef
120 EFI_STATUS
121 (EFIAPI *EFI_SMM_USB_UNREGISTER2)(
122 IN CONST EFI_SMM_USB_DISPATCH2_PROTOCOL *This,
123 IN EFI_HANDLE DispatchHandle
124 );
125
126 ///
127 /// Interface structure for the SMM USB SMI Dispatch2 Protocol
128 ///
129 /// This protocol provides the parent dispatch service for the USB SMI source generator.
130 ///
131 struct _EFI_SMM_USB_DISPATCH2_PROTOCOL {
132 EFI_SMM_USB_REGISTER2 Register;
133 EFI_SMM_USB_UNREGISTER2 UnRegister;
134 };
135
136 extern EFI_GUID gEfiSmmUsbDispatch2ProtocolGuid;
137
138 #endif
139