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