7993b724f2b81f7e232ade1c929956ebd7318682
[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 - 2009, 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 @par Revision Reference:
14 This Protocol is defined in Framework of EFI SMM Core Interface Spec
15 Version 0.9.
16
17 **/
18
19 #ifndef _EFI_SMM_USB_DISPATCH_H_
20 #define _EFI_SMM_USB_DISPATCH_H_
21
22 #include <PiDxe.h>
23
24 //
25 // Global ID for the USB Protocol
26 //
27 #define EFI_SMM_USB_DISPATCH_PROTOCOL_GUID \
28 { \
29 0xa05b6ffd, 0x87af, 0x4e42, {0x95, 0xc9, 0x62, 0x28, 0xb6, 0x3c, 0xf3, 0xf3 } \
30 }
31
32 typedef struct _EFI_SMM_USB_DISPATCH_PROTOCOL EFI_SMM_USB_DISPATCH_PROTOCOL;
33
34 //
35 // Related Definitions
36 //
37 typedef enum {
38 UsbLegacy,
39 UsbWake
40 } EFI_USB_SMI_TYPE;
41
42 typedef struct {
43 ///
44 /// Describes whether this child handler will be invoked in response to a USB legacy
45 /// emulation event, such as port-trap on the PS/2* keyboard control registers, or to a
46 /// USB wake event, such as resumption from a sleep state.
47 ///
48 EFI_USB_SMI_TYPE Type;
49 ///
50 /// The device path is part of the context structure and describes the location of the
51 /// particular USB host controller in the system for which this register event will occur.
52 /// This location is important because of the possible integration of several USB host
53 /// controllers in a system.
54 ///
55 EFI_DEVICE_PATH_PROTOCOL *Device;
56 } EFI_SMM_USB_DISPATCH_CONTEXT;
57
58 //
59 // Member functions
60 //
61 /**
62 Dispatch function for a USB SMI handler.
63
64 @param DispatchHandle Handle of this dispatch function.
65 @param DispatchContext Pointer to the dispatch function's context.
66 The DispatchContext fields are filled in
67 by the dispatching driver prior to
68 invoking this dispatch function.
69
70 **/
71 typedef
72 VOID
73 (EFIAPI *EFI_SMM_USB_DISPATCH)(
74 IN EFI_HANDLE DispatchHandle,
75 IN EFI_SMM_USB_DISPATCH_CONTEXT *DispatchContext
76 );
77
78 /**
79 Register a child SMI source dispatch function with a parent SMM driver.
80
81 @param This Pointer to the EFI_SMM_USB_DISPATCH_PROTOCOL instance.
82 @param DispatchFunction Pointer to dispatch function to be invoked
83 for this SMI source.
84 @param DispatchContext Pointer to the dispatch function's context.
85 The caller fills this context in before calling
86 the register function to indicate to the register
87 function the USB SMI types for which the dispatch
88 function should be invoked.
89 @param DispatchHandle Handle generated by the dispatcher to track the
90 function instance.
91
92 @retval EFI_SUCCESS The dispatch function has been successfully
93 registered and the SMI source has been enabled.
94 @retval EFI_DEVICE_ERROR The driver was unable to enable the SMI source.
95 @retval EFI_OUT_OF_RESOURCES Not enough memory (system or SMM) to manage this
96 child.
97 @retval EFI_INVALID_PARAMETER DispatchContext is invalid. The USB SMI type
98 is not within valid range.
99
100 **/
101 typedef
102 EFI_STATUS
103 (EFIAPI *EFI_SMM_USB_REGISTER)(
104 IN EFI_SMM_USB_DISPATCH_PROTOCOL *This,
105 IN EFI_SMM_USB_DISPATCH DispatchFunction,
106 IN EFI_SMM_USB_DISPATCH_CONTEXT *DispatchContext,
107 OUT EFI_HANDLE *DispatchHandle
108 );
109
110 /**
111 Unregisters a USB service.
112
113 @param This Pointer to the EFI_SMM_USB_DISPATCH_PROTOCOL instance.
114 @param DispatchHandle Handle of the service to remove.
115
116 @retval EFI_SUCCESS The dispatch function has been successfully
117 unregistered and the SMI source has been disabled
118 if there are no other registered child dispatch
119 functions for this SMI source.
120 @retval EFI_INVALID_PARAMETER The DispatchHandle was not valid.
121
122 **/
123 typedef
124 EFI_STATUS
125 (EFIAPI *EFI_SMM_USB_UNREGISTER)(
126 IN EFI_SMM_USB_DISPATCH_PROTOCOL *This,
127 IN EFI_HANDLE DispatchHandle
128 );
129
130 ///
131 /// The EFI_SMM_USB_DISPATCH_PROTOCOL provides the ability to install child handlers for the
132 /// given event types.
133 ///
134 struct _EFI_SMM_USB_DISPATCH_PROTOCOL {
135 EFI_SMM_USB_REGISTER Register;
136 EFI_SMM_USB_UNREGISTER UnRegister;
137 };
138
139 extern EFI_GUID gEfiSmmUsbDispatchProtocolGuid;
140
141 #endif