3 Copyright (c) 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
22 CHAR16
*OptionString
[4] = {
23 L
"Enable Primary Master (Y/N)? -->",
24 L
"Enable Primary Slave (Y/N)? -->",
25 L
"Enable Secondary Master (Y/N)? -->",
26 L
"Enable Secondary Slave (Y/N)? -->"
29 // EFI Driver Configuration Functions
32 IDEBusDriverConfigurationSetOptions (
33 IN EFI_DRIVER_CONFIGURATION_PROTOCOL
*This
,
34 IN EFI_HANDLE ControllerHandle
,
35 IN EFI_HANDLE ChildHandle OPTIONAL
,
37 OUT EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED
*ActionRequired
41 IDEBusDriverConfigurationOptionsValid (
42 IN EFI_DRIVER_CONFIGURATION_PROTOCOL
*This
,
43 IN EFI_HANDLE ControllerHandle
,
44 IN EFI_HANDLE ChildHandle OPTIONAL
48 IDEBusDriverConfigurationForceDefaults (
49 IN EFI_DRIVER_CONFIGURATION_PROTOCOL
*This
,
50 IN EFI_HANDLE ControllerHandle
,
51 IN EFI_HANDLE ChildHandle OPTIONAL
,
52 IN UINT32 DefaultType
,
53 OUT EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED
*ActionRequired
57 // EFI Driver Configuration Protocol
59 EFI_DRIVER_CONFIGURATION_PROTOCOL gIDEBusDriverConfiguration
= {
60 IDEBusDriverConfigurationSetOptions
,
61 IDEBusDriverConfigurationOptionsValid
,
62 IDEBusDriverConfigurationForceDefaults
,
74 TODO: Add function description
82 EFI_ABORTED - TODO: Add description for return value
83 EFI_SUCCESS - TODO: Add description for return value
84 EFI_NOT_FOUND - TODO: Add description for return value
92 Status
= gST
->ConIn
->ReadKeyStroke (gST
->ConIn
, &Key
);
93 if (!EFI_ERROR (Status
)) {
94 if (Key
.ScanCode
== SCAN_ESC
) {
98 switch (Key
.UnicodeChar
) {
105 gST
->ConOut
->OutputString (gST
->ConOut
, L
"Y\n");
113 gST
->ConOut
->OutputString (gST
->ConOut
, L
"N\n");
114 return EFI_NOT_FOUND
;
122 IDEBusDriverConfigurationSetOptions (
123 IN EFI_DRIVER_CONFIGURATION_PROTOCOL
*This
,
124 IN EFI_HANDLE ControllerHandle
,
125 IN EFI_HANDLE ChildHandle OPTIONAL
,
127 OUT EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED
*ActionRequired
132 Allows the user to set controller specific options for a controller that a
133 driver is currently managing.
136 This - A pointer to the EFI_DRIVER_CONFIGURATION_ PROTOCOL
138 ControllerHandle - The handle of the controller to set options on.
139 ChildHandle - The handle of the child controller to set options on.
140 This is an optional parameter that may be NULL.
141 It will be NULL for device drivers, and for a bus drivers
142 that wish to set options for the bus controller.
143 It will not be NULL for a bus driver that wishes to set
144 options for one of its child controllers.
145 Language - A pointer to a three character ISO 639-2 language
146 identifier. This is the language of the user interface
147 that should be presented to the user, and it must match
148 one of the languages specified in SupportedLanguages.
149 The number of languages supported by a driver is up to
151 ActionRequired - A pointer to the action that the calling agent is
152 required to perform when this function returns.
153 See "Related Definitions" for a list of the actions that
154 the calling agent is required to perform prior to
155 accessing ControllerHandle again.
158 EFI_SUCCESS - The driver specified by This successfully set the
159 configuration options for the controller specified
160 by ControllerHandle..
161 EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
162 EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a
164 EFI_INVALID_PARAMETER - ActionRequired is NULL.
165 EFI_UNSUPPORTED - The driver specified by This does not support
166 setting configuration options for the controller
167 specified by ControllerHandle and ChildHandle.
168 EFI_UNSUPPORTED - The driver specified by This does not support the
169 language specified by Language.
170 EFI_DEVICE_ERROR - A device error occurred while attempt to set the
171 configuration options for the controller specified
172 by ControllerHandle and ChildHandle.
173 EFI_OUT_RESOURCES - There are not enough resources available to set the
174 configuration options for the controller specified
175 by ControllerHandle and ChildHandle.
186 if (ChildHandle
!= NULL
) {
187 return EFI_UNSUPPORTED
;
190 *ActionRequired
= EfiDriverConfigurationActionNone
;
192 DataSize
= sizeof (Value
);
193 Status
= gRT
->GetVariable (
201 gST
->ConOut
->OutputString (gST
->ConOut
, L
"IDE Bus Driver Configuration\n");
202 gST
->ConOut
->OutputString (gST
->ConOut
, L
"===============================\n");
205 for (Index
= 0; Index
< 4; Index
++) {
206 gST
->ConOut
->OutputString (gST
->ConOut
, OptionString
[Index
]);
208 Status
= GetResponse ();
209 if (Status
== EFI_ABORTED
) {
213 if (!EFI_ERROR (Status
)) {
214 NewValue
|= (UINT8
) (1 << Index
);
218 if (EFI_ERROR (Status
) || (NewValue
!= Value
)) {
222 EFI_VARIABLE_NON_VOLATILE
| EFI_VARIABLE_BOOTSERVICE_ACCESS
,
227 *ActionRequired
= EfiDriverConfigurationActionRestartController
;
229 *ActionRequired
= EfiDriverConfigurationActionNone
;
236 IDEBusDriverConfigurationOptionsValid (
237 IN EFI_DRIVER_CONFIGURATION_PROTOCOL
*This
,
238 IN EFI_HANDLE ControllerHandle
,
239 IN EFI_HANDLE ChildHandle OPTIONAL
244 Tests to see if a controller's current configuration options are valid.
247 This - A pointer to the EFI_DRIVER_CONFIGURATION_PROTOCOL
249 ControllerHandle - The handle of the controller to test if it's current
250 configuration options are valid.
251 ChildHandle - The handle of the child controller to test if it's
253 configuration options are valid. This is an optional
254 parameter that may be NULL. It will be NULL for device
255 drivers. It will also be NULL for a bus drivers that
256 wish to test the configuration options for the bus
257 controller. It will not be NULL for a bus driver that
258 wishes to test configuration options for one of
259 its child controllers.
262 EFI_SUCCESS - The controller specified by ControllerHandle and
263 ChildHandle that is being managed by the driver
264 specified by This has a valid set of configuration
266 EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
267 EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid
269 EFI_UNSUPPORTED - The driver specified by This is not currently
270 managing the controller specified by
271 ControllerHandle and ChildHandle.
272 EFI_DEVICE_ERROR - The controller specified by ControllerHandle and
273 ChildHandle that is being managed by the driver
274 specified by This has an invalid set of
275 configuration options.
284 if (ChildHandle
!= NULL
) {
285 return EFI_UNSUPPORTED
;
288 DataSize
= sizeof (Value
);
289 Status
= gRT
->GetVariable (
296 if (EFI_ERROR (Status
) || Value
> 0x0f) {
297 return EFI_DEVICE_ERROR
;
304 IDEBusDriverConfigurationForceDefaults (
305 IN EFI_DRIVER_CONFIGURATION_PROTOCOL
*This
,
306 IN EFI_HANDLE ControllerHandle
,
307 IN EFI_HANDLE ChildHandle OPTIONAL
,
308 IN UINT32 DefaultType
,
309 OUT EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED
*ActionRequired
314 Forces a driver to set the default configuration options for a controller.
317 This - A pointer to the EFI_DRIVER_CONFIGURATION_ PROTOCOL
319 ControllerHandle - The handle of the controller to force default
320 configuration options on.
321 ChildHandle - The handle of the child controller to force default
322 configuration options on This is an optional parameter
323 that may be NULL. It will be NULL for device drivers.
324 It will also be NULL for a bus drivers that wish to
325 force default configuration options for the bus
326 controller. It will not be NULL for a bus driver that
327 wishes to force default configuration options for one
328 of its child controllers.
329 DefaultType - The type of default configuration options to force on
330 the controller specified by ControllerHandle and
331 ChildHandle. See Table 9-1 for legal values.
332 A DefaultType of 0x00000000 must be supported
334 ActionRequired - A pointer to the action that the calling agent
335 is required to perform when this function returns.
339 EFI_SUCCESS - The driver specified by This successfully forced
340 the default configuration options on the
341 controller specified by ControllerHandle and
343 EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
344 EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a
346 EFI_INVALID_PARAMETER - ActionRequired is NULL.
347 EFI_UNSUPPORTED - The driver specified by This does not support
348 forcing the default configuration options on
349 the controller specified by ControllerHandle
351 EFI_UNSUPPORTED - The driver specified by This does not support
352 the configuration type specified by DefaultType.
353 EFI_DEVICE_ERROR - A device error occurred while attempt to force
354 the default configuration options on the controller
355 specified by ControllerHandle and ChildHandle.
356 EFI_OUT_RESOURCES - There are not enough resources available to force
357 the default configuration options on the controller
358 specified by ControllerHandle and ChildHandle.
364 if (ChildHandle
!= NULL
) {
365 return EFI_UNSUPPORTED
;
372 EFI_VARIABLE_NON_VOLATILE
| EFI_VARIABLE_BOOTSERVICE_ACCESS
,
376 *ActionRequired
= EfiDriverConfigurationActionRestartController
;