2 Copyright (c) 2006, Intel Corporation
3 All rights reserved. This program and the accompanying materials
4 are licensed and made available under the terms and conditions of the BSD License
5 which accompanies this distribution. The full text of the license may be found at
6 http://opensource.org/licenses/bsd-license.php
8 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
9 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 CHAR16
*OptionString
[4] = {
16 L
"Enable Primary Master (Y/N)? -->",
17 L
"Enable Primary Slave (Y/N)? -->",
18 L
"Enable Secondary Master (Y/N)? -->",
19 L
"Enable Secondary Slave (Y/N)? -->"
22 // EFI Driver Configuration Functions
25 IDEBusDriverConfigurationSetOptions (
26 IN EFI_DRIVER_CONFIGURATION_PROTOCOL
*This
,
27 IN EFI_HANDLE ControllerHandle
,
28 IN EFI_HANDLE ChildHandle OPTIONAL
,
30 OUT EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED
*ActionRequired
34 IDEBusDriverConfigurationOptionsValid (
35 IN EFI_DRIVER_CONFIGURATION_PROTOCOL
*This
,
36 IN EFI_HANDLE ControllerHandle
,
37 IN EFI_HANDLE ChildHandle OPTIONAL
41 IDEBusDriverConfigurationForceDefaults (
42 IN EFI_DRIVER_CONFIGURATION_PROTOCOL
*This
,
43 IN EFI_HANDLE ControllerHandle
,
44 IN EFI_HANDLE ChildHandle OPTIONAL
,
45 IN UINT32 DefaultType
,
46 OUT EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED
*ActionRequired
50 // EFI Driver Configuration Protocol
52 EFI_DRIVER_CONFIGURATION_PROTOCOL gIDEBusDriverConfiguration
= {
53 IDEBusDriverConfigurationSetOptions
,
54 IDEBusDriverConfigurationOptionsValid
,
55 IDEBusDriverConfigurationForceDefaults
,
60 TODO: Add function description
62 @retval EFI_ABORTED TODO: Add description for return value
63 @retval EFI_SUCCESS TODO: Add description for return value
64 @retval EFI_NOT_FOUND TODO: Add description for return value
76 Status
= gST
->ConIn
->ReadKeyStroke (gST
->ConIn
, &Key
);
77 if (!EFI_ERROR (Status
)) {
78 if (Key
.ScanCode
== SCAN_ESC
) {
82 switch (Key
.UnicodeChar
) {
89 gST
->ConOut
->OutputString (gST
->ConOut
, L
"Y\n");
97 gST
->ConOut
->OutputString (gST
->ConOut
, L
"N\n");
106 Allows the user to set controller specific options for a controller that a
107 driver is currently managing.
109 @param This A pointer to the EFI_DRIVER_CONFIGURATION_ PROTOCOL
111 @param ControllerHandle The handle of the controller to set options on.
112 @param ChildHandle The handle of the child controller to set options on.
113 This is an optional parameter that may be NULL.
114 It will be NULL for device drivers, and for a bus drivers
115 that wish to set options for the bus controller.
116 It will not be NULL for a bus driver that wishes to set
117 options for one of its child controllers.
118 @param Language A pointer to a three character ISO 639-2 language
119 identifier. This is the language of the user interface
120 that should be presented to the user, and it must match
121 one of the languages specified in SupportedLanguages.
122 The number of languages supported by a driver is up to
124 @param ActionRequired A pointer to the action that the calling agent is
125 required to perform when this function returns.
126 See "Related Definitions" for a list of the actions that
127 the calling agent is required to perform prior to
128 accessing ControllerHandle again.
130 @retval EFI_SUCCESS The driver specified by This successfully set the
131 configuration options for the controller specified
132 by ControllerHandle..
133 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
134 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a
136 @retval EFI_INVALID_PARAMETER ActionRequired is NULL.
137 @retval EFI_UNSUPPORTED The driver specified by This does not support
138 setting configuration options for the controller
139 specified by ControllerHandle and ChildHandle.
140 @retval EFI_UNSUPPORTED The driver specified by This does not support the
141 language specified by Language.
142 @retval EFI_DEVICE_ERROR A device error occurred while attempt to set the
143 configuration options for the controller specified
144 by ControllerHandle and ChildHandle.
145 @retval EFI_OUT_RESOURCES There are not enough resources available to set the
146 configuration options for the controller specified
147 by ControllerHandle and ChildHandle.
151 IDEBusDriverConfigurationSetOptions (
152 IN EFI_DRIVER_CONFIGURATION_PROTOCOL
*This
,
153 IN EFI_HANDLE ControllerHandle
,
154 IN EFI_HANDLE ChildHandle OPTIONAL
,
156 OUT EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED
*ActionRequired
165 if (ChildHandle
!= NULL
) {
166 return EFI_UNSUPPORTED
;
169 *ActionRequired
= EfiDriverConfigurationActionNone
;
171 DataSize
= sizeof (Value
);
172 Status
= gRT
->GetVariable (
180 gST
->ConOut
->OutputString (gST
->ConOut
, L
"IDE Bus Driver Configuration\n");
181 gST
->ConOut
->OutputString (gST
->ConOut
, L
"===============================\n");
184 for (Index
= 0; Index
< 4; Index
++) {
185 gST
->ConOut
->OutputString (gST
->ConOut
, OptionString
[Index
]);
187 Status
= GetResponse ();
188 if (Status
== EFI_ABORTED
) {
192 if (!EFI_ERROR (Status
)) {
193 NewValue
|= (UINT8
) (1 << Index
);
197 if (EFI_ERROR (Status
) || (NewValue
!= Value
)) {
201 EFI_VARIABLE_NON_VOLATILE
| EFI_VARIABLE_BOOTSERVICE_ACCESS
,
206 *ActionRequired
= EfiDriverConfigurationActionRestartController
;
208 *ActionRequired
= EfiDriverConfigurationActionNone
;
215 Tests to see if a controller's current configuration options are valid.
217 @param This A pointer to the EFI_DRIVER_CONFIGURATION_PROTOCOL
219 @param ControllerHandle The handle of the controller to test if it's current
220 configuration options are valid.
221 @param ChildHandle The handle of the child controller to test if it's
223 configuration options are valid. This is an optional
224 parameter that may be NULL. It will be NULL for device
225 drivers. It will also be NULL for a bus drivers that
226 wish to test the configuration options for the bus
227 controller. It will not be NULL for a bus driver that
228 wishes to test configuration options for one of
229 its child controllers.
231 @retval EFI_SUCCESS The controller specified by ControllerHandle and
232 ChildHandle that is being managed by the driver
233 specified by This has a valid set of configuration
235 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
236 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
238 @retval EFI_UNSUPPORTED The driver specified by This is not currently
239 managing the controller specified by
240 ControllerHandle and ChildHandle.
241 @retval EFI_DEVICE_ERROR The controller specified by ControllerHandle and
242 ChildHandle that is being managed by the driver
243 specified by This has an invalid set of
244 configuration options.
248 IDEBusDriverConfigurationOptionsValid (
249 IN EFI_DRIVER_CONFIGURATION_PROTOCOL
*This
,
250 IN EFI_HANDLE ControllerHandle
,
251 IN EFI_HANDLE ChildHandle OPTIONAL
258 if (ChildHandle
!= NULL
) {
259 return EFI_UNSUPPORTED
;
262 DataSize
= sizeof (Value
);
263 Status
= gRT
->GetVariable (
270 if (EFI_ERROR (Status
) || Value
> 0x0f) {
271 return EFI_DEVICE_ERROR
;
278 Forces a driver to set the default configuration options for a controller.
280 @param This A pointer to the EFI_DRIVER_CONFIGURATION_ PROTOCOL
282 @param ControllerHandle The handle of the controller to force default
283 configuration options on.
284 @param ChildHandle The handle of the child controller to force default
285 configuration options on This is an optional parameter
286 that may be NULL. It will be NULL for device drivers.
287 It will also be NULL for a bus drivers that wish to
288 force default configuration options for the bus
289 controller. It will not be NULL for a bus driver that
290 wishes to force default configuration options for one
291 of its child controllers.
292 @param DefaultType The type of default configuration options to force on
293 the controller specified by ControllerHandle and
294 ChildHandle. See Table 9-1 for legal values.
295 A DefaultType of 0x00000000 must be supported
297 @param ActionRequired A pointer to the action that the calling agent
298 is required to perform when this function returns.
300 @retval EFI_SUCCESS The driver specified by This successfully forced
301 the default configuration options on the
302 controller specified by ControllerHandle and
304 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
305 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a
307 @retval EFI_INVALID_PARAMETER ActionRequired is NULL.
308 @retval EFI_UNSUPPORTED The driver specified by This does not support
309 forcing the default configuration options on
310 the controller specified by ControllerHandle
312 @retval EFI_UNSUPPORTED The driver specified by This does not support
313 the configuration type specified by DefaultType.
314 @retval EFI_DEVICE_ERROR A device error occurred while attempt to force
315 the default configuration options on the controller
316 specified by ControllerHandle and ChildHandle.
317 @retval EFI_OUT_RESOURCES There are not enough resources available to force
318 the default configuration options on the controller
319 specified by ControllerHandle and ChildHandle.
323 IDEBusDriverConfigurationForceDefaults (
324 IN EFI_DRIVER_CONFIGURATION_PROTOCOL
*This
,
325 IN EFI_HANDLE ControllerHandle
,
326 IN EFI_HANDLE ChildHandle OPTIONAL
,
327 IN UINT32 DefaultType
,
328 OUT EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED
*ActionRequired
333 if (ChildHandle
!= NULL
) {
334 return EFI_UNSUPPORTED
;
341 EFI_VARIABLE_NON_VOLATILE
| EFI_VARIABLE_BOOTSERVICE_ACCESS
,
345 *ActionRequired
= EfiDriverConfigurationActionRestartController
;