1 /** @file
2   UEFI Driver Configuration2 Protocol
3 
4   Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
5   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 **/
14 
15 #ifndef __EFI_DRIVER_CONFIGURATION2_H__
16 #define __EFI_DRIVER_CONFIGURATION2_H__
17 
18 ///
19 /// Global ID for the Driver Configuration Protocol defined in UEFI 2.0
20 ///
21 #define EFI_DRIVER_CONFIGURATION2_PROTOCOL_GUID \
22   { \
23     0xbfd7dc1d, 0x24f1, 0x40d9, {0x82, 0xe7, 0x2e, 0x09, 0xbb, 0x6b, 0x4e, 0xbe } \
24   }
25 
26 typedef struct _EFI_DRIVER_CONFIGURATION2_PROTOCOL  EFI_DRIVER_CONFIGURATION2_PROTOCOL;
27 
28 typedef enum {
29   ///
30   /// The controller is still in a usable state. No actions
31   /// are required before this controller can be used again.
32   ///
33   EfiDriverConfigurationActionNone              = 0,
34   ///
35   /// The driver has detected that the controller is not in a
36   /// usable state, and it needs to be stopped.
37   ///
38   EfiDriverConfigurationActionStopController    = 1,
39   ///
40   /// This controller needs to be stopped and restarted
41   /// before it can be used again.
42   ///
43   EfiDriverConfigurationActionRestartController = 2,
44   ///
45   /// A configuration change has been made that requires the platform to be restarted before
46   /// the controller can be used again.
47   ///
48   EfiDriverConfigurationActionRestartPlatform   = 3,
49   EfiDriverConfigurationActionMaximum
50 } EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED;
51 
52 #define EFI_DRIVER_CONFIGURATION_SAFE_DEFAULTS          0x00000000
53 #define EFI_DRIVER_CONFIGURATION_MANUFACTURING_DEFAULTS 0x00000001
54 #define EFI_DRIVER_CONFIGURATION_CUSTOM_DEFAULTS        0x00000002
55 #define EFI_DRIVER_CONFIGURATION_PERORMANCE_DEFAULTS    0x00000003
56 
57 /**
58   Allows the user to set controller specific options for a controller that a
59   driver is currently managing.
60 
61   @param  This             A pointer to the EFI_DRIVER_CONFIGURATION2_PROTOCOL instance.
62   @param  ControllerHandle The handle of the controller to set options on.
63   @param  ChildHandle      The handle of the child controller to set options on.  This
64                            is an optional parameter that may be NULL.  It will be NULL
65                            for device drivers, and for bus drivers that wish to set
66                            options for the bus controller.  It will not be NULL for a
67                            bus driver that wishes to set options for one of its child
68                            controllers.
69   @param  Language         A Null-terminated ASCII string that contains one or more RFC 4646
70                            language codes. This is the list of language codes that this
71                            protocol supports. The number of languages
72                            supported by a driver is up to the driver writer.
73   @param  ActionRequired   A pointer to the action that the calling agent is required
74                            to perform when this function returns.  See "Related
75                            Definitions" for a list of the actions that the calling
76                            agent is required to perform prior to accessing
77                            ControllerHandle again.
78 
79   @retval EFI_SUCCESS           The driver specified by This successfully set the
80                                 configuration options for the controller specified
81                                 by ControllerHandle.
82   @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
83   @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid EFI_HANDLE.
84   @retval EFI_INVALID_PARAMETER ActionRequired is NULL.
85   @retval EFI_UNSUPPORTED       The driver specified by This does not support setting
86                                 configuration options for the controller specified by
87                                 ControllerHandle and ChildHandle.
88   @retval EFI_UNSUPPORTED       The driver specified by This does not support the
89                                 language specified by Language.
90   @retval EFI_DEVICE_ERROR      A device error occurred while attempting to set the
91                                 configuration options for the controller specified
92                                 by ControllerHandle and ChildHandle.
93   @retval EFI_OUT_RESOURCES     There are not enough resources available to set the
94                                 configuration options for the controller specified
95                                 by ControllerHandle and ChildHandle.
96 
97 **/
98 typedef
99 EFI_STATUS
100 (EFIAPI *EFI_DRIVER_CONFIGURATION2_SET_OPTIONS)(
101   IN EFI_DRIVER_CONFIGURATION2_PROTOCOL                       *This,
102   IN  EFI_HANDLE                                              ControllerHandle,
103   IN  EFI_HANDLE                                              ChildHandle  OPTIONAL,
104   IN  CHAR8                                                   *Language,
105   OUT EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED                *ActionRequired
106   );
107 
108 /**
109   Tests to see if a controller's current configuration options are valid.
110 
111   @param  This             A pointer to the EFI_DRIVER_CONFIGURATION2_PROTOCOL instance.
112   @param  ControllerHandle The handle of the controller to test if it's current
113                            configuration options are valid.
114   @param  ChildHandle      The handle of the child controller to test if it's current
115                            configuration options are valid.  This is an optional
116                            parameter that may be NULL.  It will be NULL for device
117                            drivers.  It will also be NULL for bus drivers that wish
118                            to test the configuration options for the bus controller.
119                            It will not be NULL for a bus driver that wishes to test
120                            configuration options for one of its child controllers.
121 
122   @retval EFI_SUCCESS           The controller specified by ControllerHandle and
123                                 ChildHandle that is being managed by the driver
124                                 specified by This has a valid set of  configuration
125                                 options.
126   @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
127   @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid EFI_HANDLE.
128   @retval EFI_UNSUPPORTED       The driver specified by This is not currently
129                                 managing the controller specified by ControllerHandle
130                                 and ChildHandle.
131   @retval EFI_DEVICE_ERROR      The controller specified by ControllerHandle and
132                                 ChildHandle that is being managed by the driver
133                                 specified by This has an invalid set of configuration
134                                 options.
135 
136 **/
137 typedef
138 EFI_STATUS
139 (EFIAPI *EFI_DRIVER_CONFIGURATION2_OPTIONS_VALID)(
140   IN EFI_DRIVER_CONFIGURATION2_PROTOCOL                       *This,
141   IN  EFI_HANDLE                                              ControllerHandle,
142   IN  EFI_HANDLE                                              ChildHandle  OPTIONAL
143   );
144 
145 /**
146   Forces a driver to set the default configuration options for a controller.
147 
148   @param  This             A pointer to the EFI_DRIVER_CONFIGURATION2_PROTOCOL instance.
149   @param  ControllerHandle The handle of the controller to force default configuration options on.
150   @param  ChildHandle      The handle of the child controller to force default configuration options on  This is an optional parameter that may be NULL.  It will be NULL for device drivers.  It will also be NULL for bus drivers that wish to force default configuration options for the bus controller.  It will not be NULL for a bus driver that wishes to force default configuration options for one of its child controllers.
151   @param  DefaultType      The type of default configuration options to force on the controller specified by ControllerHandle and ChildHandle.  See Table 9-1 for legal values.  A DefaultType of 0x00000000 must be supported by this protocol.
152   @param  ActionRequired   A pointer to the action that the calling agent is required to perform when this function returns.  See "Related Definitions" in Section 9.1 for a list of the actions that the calling agent is required to perform prior to accessing ControllerHandle again.
153 
154   @retval EFI_SUCCESS           The driver specified by This successfully forced the default configuration options on the controller specified by ControllerHandle and ChildHandle.
155   @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
156   @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid EFI_HANDLE.
157   @retval EFI_INVALID_PARAMETER ActionRequired is NULL.
158   @retval EFI_UNSUPPORTED       The driver specified by This does not support forcing the default configuration options on the controller specified by ControllerHandle and ChildHandle.
159   @retval EFI_UNSUPPORTED       The driver specified by This does not support the configuration type specified by DefaultType.
160   @retval EFI_DEVICE_ERROR      A device error occurred while attempt to force the default configuration options on the controller specified by  ControllerHandle and ChildHandle.
161   @retval EFI_OUT_RESOURCES     There are not enough resources available to force the default configuration options on the controller specified by ControllerHandle and ChildHandle.
162 
163 **/
164 typedef
165 EFI_STATUS
166 (EFIAPI *EFI_DRIVER_CONFIGURATION2_FORCE_DEFAULTS)(
167   IN EFI_DRIVER_CONFIGURATION2_PROTOCOL                        *This,
168   IN  EFI_HANDLE                                              ControllerHandle,
169   IN  EFI_HANDLE                                              ChildHandle  OPTIONAL,
170   IN  UINT32                                                  DefaultType,
171   OUT EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED                *ActionRequired
172   );
173 
174 ///
175 /// Used to set configuration options for a controller that an EFI Driver is managing.
176 ///
177 struct _EFI_DRIVER_CONFIGURATION2_PROTOCOL {
178   EFI_DRIVER_CONFIGURATION2_SET_OPTIONS     SetOptions;
179   EFI_DRIVER_CONFIGURATION2_OPTIONS_VALID   OptionsValid;
180   EFI_DRIVER_CONFIGURATION2_FORCE_DEFAULTS  ForceDefaults;
181   ///
182   /// A Null-terminated ASCII string that contains one or more RFC 4646
183   /// language codes.  This is the list of language codes that this protocol supports.
184   ///
185   CHAR8                                     *SupportedLanguages;
186 };
187 
188 extern EFI_GUID gEfiDriverConfiguration2ProtocolGuid;
189 
190 #endif
191