• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /** @file
2   Provides the parent dispatch service for the USB SMI source generator.
3 
4 Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials are licensed and made available under
6 the terms and conditions of the BSD License that accompanies this distribution.
7 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 //
23 // Share some common definitions with PI SMM
24 //
25 #include <Protocol/SmmUsbDispatch2.h>
26 
27 //
28 // Global ID for the USB Protocol
29 //
30 #define EFI_SMM_USB_DISPATCH_PROTOCOL_GUID \
31   { \
32     0xa05b6ffd, 0x87af, 0x4e42, {0x95, 0xc9, 0x62, 0x28, 0xb6, 0x3c, 0xf3, 0xf3 } \
33   }
34 
35 typedef struct _EFI_SMM_USB_DISPATCH_PROTOCOL  EFI_SMM_USB_DISPATCH_PROTOCOL;
36 
37 typedef struct {
38   ///
39   /// Describes whether this child handler will be invoked in response to a USB legacy
40   /// emulation event, such as port-trap on the PS/2* keyboard control registers, or to a
41   /// USB wake event, such as resumption from a sleep state.
42   ///
43   EFI_USB_SMI_TYPE          Type;
44   ///
45   /// The device path is part of the context structure and describes the location of the
46   /// particular USB host controller in the system for which this register event will occur.
47   /// This location is important because of the possible integration of several USB host
48   /// controllers in a system.
49   ///
50   EFI_DEVICE_PATH_PROTOCOL  *Device;
51 } EFI_SMM_USB_DISPATCH_CONTEXT;
52 
53 //
54 // Member functions
55 //
56 /**
57   Dispatch function for a USB SMI handler.
58 
59   @param[in]  DispatchHandle    Handle of this dispatch function.
60   @param[in]  DispatchContext   Pointer to the dispatch function's context.
61                                 The DispatchContext fields are filled in
62                                 by the dispatching driver prior to
63                                 invoking this dispatch function.
64 
65 **/
66 typedef
67 VOID
68 (EFIAPI *EFI_SMM_USB_DISPATCH)(
69   IN  EFI_HANDLE                    DispatchHandle,
70   IN  EFI_SMM_USB_DISPATCH_CONTEXT  *DispatchContext
71   );
72 
73 /**
74   Register a child SMI source dispatch function with a parent SMM driver.
75 
76   @param[in]  This              The pointer to the EFI_SMM_USB_DISPATCH_PROTOCOL instance.
77   @param[in]  DispatchFunction  The pointer to dispatch function to be invoked
78                                 for this SMI source.
79   @param[in]  DispatchContext   The pointer to the dispatch function's context.
80                                 The caller fills this context in before calling
81                                 the register function to indicate to the register
82                                 function the USB SMI types for which the dispatch
83                                 function should be invoked.
84   @param[out] DispatchHandle    The handle generated by the dispatcher to track the
85                                 function instance.
86 
87   @retval EFI_SUCCESS           The dispatch function has been successfully
88                                 registered and the SMI source has been enabled.
89   @retval EFI_DEVICE_ERROR      The driver was unable to enable the SMI source.
90   @retval EFI_OUT_OF_RESOURCES  Not enough memory (system or SMM) to manage this
91                                 child.
92   @retval EFI_INVALID_PARAMETER DispatchContext is invalid. The USB SMI type
93                                 is not within valid range.
94 
95 **/
96 typedef
97 EFI_STATUS
98 (EFIAPI *EFI_SMM_USB_REGISTER)(
99   IN  EFI_SMM_USB_DISPATCH_PROTOCOL           *This,
100   IN  EFI_SMM_USB_DISPATCH                    DispatchFunction,
101   IN  EFI_SMM_USB_DISPATCH_CONTEXT            *DispatchContext,
102   OUT EFI_HANDLE                              *DispatchHandle
103   );
104 
105 /**
106   Unregisters a USB service.
107 
108   @param[in]  This              The pointer to the EFI_SMM_USB_DISPATCH_PROTOCOL instance.
109   @param[in]  DispatchHandle    Handle of the service to remove.
110 
111   @retval EFI_SUCCESS           The dispatch function has been successfully
112                                 unregistered and the SMI source has been disabled
113                                 if there are no other registered child dispatch
114                                 functions for this SMI source.
115   @retval EFI_INVALID_PARAMETER The DispatchHandle was not valid.
116 
117 **/
118 typedef
119 EFI_STATUS
120 (EFIAPI *EFI_SMM_USB_UNREGISTER)(
121   IN EFI_SMM_USB_DISPATCH_PROTOCOL            *This,
122   IN EFI_HANDLE                               DispatchHandle
123   );
124 
125 ///
126 /// The EFI_SMM_USB_DISPATCH_PROTOCOL provides the ability to install child handlers for the
127 /// given event types.
128 ///
129 struct _EFI_SMM_USB_DISPATCH_PROTOCOL {
130   EFI_SMM_USB_REGISTER    Register;
131   EFI_SMM_USB_UNREGISTER  UnRegister;
132 };
133 
134 extern EFI_GUID gEfiSmmUsbDispatchProtocolGuid;
135 
136 #endif
137