c2f70aceebaa73be3aeeec6b9f22f221b94c0f3a
[mirror_edk2.git] / IntelFrameworkPkg / Include / Protocol / SmmUsbDispatch.h
1 /** @file
2 Provides the parent dispatch service for the USB SMI source generator.
3
4 Copyright (c) 2007, Intel Corporation
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 Module Name: SmmUsbDispatch.h
14
15 @par Revision Reference:
16 This Protocol is defined in Framework of EFI SMM Core Interface Spec
17 Version 0.9.
18 **/
19
20 #ifndef _EFI_SMM_USB_DISPATCH_H_
21 #define _EFI_SMM_USB_DISPATCH_H_
22
23 #include <PiDxe.h>
24
25 //
26 // Global ID for the USB Protocol
27 //
28 #define EFI_SMM_USB_DISPATCH_PROTOCOL_GUID \
29 { \
30 0xa05b6ffd, 0x87af, 0x4e42, {0x95, 0xc9, 0x62, 0x28, 0xb6, 0x3c, 0xf3, 0xf3 } \
31 }
32
33 typedef struct _EFI_SMM_USB_DISPATCH_PROTOCOL EFI_SMM_USB_DISPATCH_PROTOCOL;
34
35 //
36 // Related Definitions
37 //
38 typedef enum {
39 UsbLegacy,
40 UsbWake
41 } EFI_USB_SMI_TYPE;
42
43 typedef struct {
44 ///
45 /// Describes whether this child handler will be invoked in response to a USB legacy
46 /// emulation event, such as port-trap on the PS/2* keyboard control registers, or to a
47 /// USB wake event, such as resumption from a sleep state.
48 ///
49 EFI_USB_SMI_TYPE Type;
50 ///
51 /// The device path is part of the context structure and describes the location of the
52 /// particular USB host controller in the system for which this register event will occur.
53 /// This location is important because of the possible integration of several USB host
54 /// controllers in a system.
55 ///
56 EFI_DEVICE_PATH_PROTOCOL *Device;
57 } EFI_SMM_USB_DISPATCH_CONTEXT;
58
59 //
60 // Member functions
61 //
62 /**
63 Dispatch function for a USB SMI handler.
64
65 @param DispatchHandle Handle of this dispatch function.
66 @param DispatchContext Pointer to the dispatch function's context.
67 The DispatchContext fields are filled in
68 by the dispatching driver prior to
69 invoking this dispatch function.
70
71 @return None
72
73 **/
74 typedef
75 VOID
76 (EFIAPI *EFI_SMM_USB_DISPATCH)(
77 IN EFI_HANDLE DispatchHandle,
78 IN EFI_SMM_USB_DISPATCH_CONTEXT *DispatchContext
79 );
80
81 /**
82 Register a child SMI source dispatch function with a parent SMM driver
83
84 @param This Pointer to the EFI_SMM_USB_DISPATCH_PROTOCOL instance.
85 @param DispatchFunction Pointer to dispatch function to be invoked
86 for this SMI source.
87 @param DispatchContext Pointer to the dispatch function's context.
88 The caller fills this context in before calling
89 the register function to indicate to the register
90 function the USB SMI types for which the dispatch
91 function should be invoked.
92 @param DispatchHandle Handle generated by the dispatcher to track the
93 function instance.
94
95 @retval EFI_SUCCESS The dispatch function has been successfully
96 registered and the SMI source has been enabled.
97 @retval EFI_DEVICE_ERROR The driver was unable to enable the SMI source.
98 @retval EFI_OUT_OF_RESOURCES Not enough memory (system or SMM) to manage this
99 child.
100 @retval EFI_INVALID_PARAMETER DispatchContext is invalid. The USB SMI type
101 is not within valid range.
102
103 **/
104 typedef
105 EFI_STATUS
106 (EFIAPI *EFI_SMM_USB_REGISTER)(
107 IN EFI_SMM_USB_DISPATCH_PROTOCOL *This,
108 IN EFI_SMM_USB_DISPATCH DispatchFunction,
109 IN EFI_SMM_USB_DISPATCH_CONTEXT *DispatchContext,
110 OUT EFI_HANDLE *DispatchHandle
111 );
112
113 /**
114 Unregisters a USB service
115
116 @param This Pointer to the EFI_SMM_USB_DISPATCH_PROTOCOL instance.
117 @param DispatchHandle Handle of the service to remove.
118
119 @retval EFI_SUCCESS The dispatch function has been successfully
120 unregistered and the SMI source has been disabled
121 if there are no other registered child dispatch
122 functions for this SMI source.
123 @retval EFI_INVALID_PARAMETER Handle is invalid.
124
125 **/
126 typedef
127 EFI_STATUS
128 (EFIAPI *EFI_SMM_USB_UNREGISTER)(
129 IN EFI_SMM_USB_DISPATCH_PROTOCOL *This,
130 IN EFI_HANDLE DispatchHandle
131 );
132
133 //
134 // Interface structure for the SMM USB SMI Dispatch Protocol
135 //
136 /**
137 @par Protocol Description:
138 Provides the parent dispatch service for the USB SMI source generator.
139
140 @param Register
141 Installs a child service to be dispatched by this protocol.
142
143 @param UnRegister
144 Removes a child service dispatched by this protocol.
145
146 **/
147 struct _EFI_SMM_USB_DISPATCH_PROTOCOL {
148 EFI_SMM_USB_REGISTER Register;
149 EFI_SMM_USB_UNREGISTER UnRegister;
150 };
151
152 extern EFI_GUID gEfiSmmUsbDispatchProtocolGuid;
153
154 #endif