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