2 Copyright (c) 2006 - 2008, 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.
16 CHAR16
*OptionString
[4] = {
17 L
"Enable Primary Master (Y/N)? -->",
18 L
"Enable Primary Slave (Y/N)? -->",
19 L
"Enable Secondary Master (Y/N)? -->",
20 L
"Enable Secondary Slave (Y/N)? -->"
24 // EFI Driver Configuration Protocol
26 EFI_DRIVER_CONFIGURATION_PROTOCOL gIDEBusDriverConfiguration
= {
27 IDEBusDriverConfigurationSetOptions
,
28 IDEBusDriverConfigurationOptionsValid
,
29 IDEBusDriverConfigurationForceDefaults
,
34 TODO: Add function description
36 @retval EFI_ABORTED TODO: Add description for return value.
37 @retval EFI_SUCCESS TODO: Add description for return value.
38 @retval EFI_NOT_FOUND TODO: Add description for return value.
50 Status
= gST
->ConIn
->ReadKeyStroke (gST
->ConIn
, &Key
);
51 if (!EFI_ERROR (Status
)) {
52 if (Key
.ScanCode
== SCAN_ESC
) {
56 switch (Key
.UnicodeChar
) {
63 gST
->ConOut
->OutputString (gST
->ConOut
, L
"Y\n");
71 gST
->ConOut
->OutputString (gST
->ConOut
, L
"N\n");
80 Allows the user to set controller specific options for a controller that a
81 driver is currently managing.
83 @param This A pointer to the EFI_DRIVER_CONFIGURATION_ PROTOCOL
85 @param ControllerHandle The handle of the controller to set options on.
86 @param ChildHandle The handle of the child controller to set options on.
87 This is an optional parameter that may be NULL.
88 It will be NULL for device drivers, and for a bus drivers
89 that wish to set options for the bus controller.
90 It will not be NULL for a bus driver that wishes to set
91 options for one of its child controllers.
92 @param Language A pointer to a three character ISO 639-2 language
93 identifier. This is the language of the user interface
94 that should be presented to the user, and it must match
95 one of the languages specified in SupportedLanguages.
96 The number of languages supported by a driver is up to
98 @param ActionRequired A pointer to the action that the calling agent is
99 required to perform when this function returns.
100 See "Related Definitions" for a list of the actions that
101 the calling agent is required to perform prior to
102 accessing ControllerHandle again.
104 @retval EFI_SUCCESS The driver specified by This successfully set the
105 configuration options for the controller specified
106 by ControllerHandle..
107 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
108 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a
110 @retval EFI_INVALID_PARAMETER ActionRequired is NULL.
111 @retval EFI_UNSUPPORTED The driver specified by This does not support
112 setting configuration options for the controller
113 specified by ControllerHandle and ChildHandle.
114 @retval EFI_UNSUPPORTED The driver specified by This does not support the
115 language specified by Language.
116 @retval EFI_DEVICE_ERROR A device error occurred while attempt to set the
117 configuration options for the controller specified
118 by ControllerHandle and ChildHandle.
119 @retval EFI_OUT_RESOURCES There are not enough resources available to set the
120 configuration options for the controller specified
121 by ControllerHandle and ChildHandle.
126 IDEBusDriverConfigurationSetOptions (
127 IN EFI_DRIVER_CONFIGURATION_PROTOCOL
*This
,
128 IN EFI_HANDLE ControllerHandle
,
129 IN EFI_HANDLE ChildHandle OPTIONAL
,
131 OUT EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED
*ActionRequired
140 if (ChildHandle
!= NULL
) {
141 return EFI_UNSUPPORTED
;
144 *ActionRequired
= EfiDriverConfigurationActionNone
;
146 DataSize
= sizeof (Value
);
147 Status
= gRT
->GetVariable (
155 gST
->ConOut
->OutputString (gST
->ConOut
, L
"IDE Bus Driver Configuration\n");
156 gST
->ConOut
->OutputString (gST
->ConOut
, L
"===============================\n");
159 for (Index
= 0; Index
< 4; Index
++) {
160 gST
->ConOut
->OutputString (gST
->ConOut
, OptionString
[Index
]);
162 Status
= GetResponse ();
163 if (Status
== EFI_ABORTED
) {
167 if (!EFI_ERROR (Status
)) {
168 NewValue
= (UINT8
) (NewValue
| (1 << Index
));
172 if (EFI_ERROR (Status
) || (NewValue
!= Value
)) {
176 EFI_VARIABLE_NON_VOLATILE
| EFI_VARIABLE_BOOTSERVICE_ACCESS
,
181 *ActionRequired
= EfiDriverConfigurationActionRestartController
;
183 *ActionRequired
= EfiDriverConfigurationActionNone
;
190 Tests to see if a controller's current configuration options are valid.
192 @param This A pointer to the EFI_DRIVER_CONFIGURATION_PROTOCOL
194 @param ControllerHandle The handle of the controller to test if it's current
195 configuration options are valid.
196 @param ChildHandle The handle of the child controller to test if it's
198 configuration options are valid. This is an optional
199 parameter that may be NULL. It will be NULL for device
200 drivers. It will also be NULL for a bus drivers that
201 wish to test the configuration options for the bus
202 controller. It will not be NULL for a bus driver that
203 wishes to test configuration options for one of
204 its child controllers.
206 @retval EFI_SUCCESS The controller specified by ControllerHandle and
207 ChildHandle that is being managed by the driver
208 specified by This has a valid set of configuration
210 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
211 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
213 @retval EFI_UNSUPPORTED The driver specified by This is not currently
214 managing the controller specified by
215 ControllerHandle and ChildHandle.
216 @retval EFI_DEVICE_ERROR The controller specified by ControllerHandle and
217 ChildHandle that is being managed by the driver
218 specified by This has an invalid set of
219 configuration options.
224 IDEBusDriverConfigurationOptionsValid (
225 IN EFI_DRIVER_CONFIGURATION_PROTOCOL
*This
,
226 IN EFI_HANDLE ControllerHandle
,
227 IN EFI_HANDLE ChildHandle OPTIONAL
234 if (ChildHandle
!= NULL
) {
235 return EFI_UNSUPPORTED
;
238 DataSize
= sizeof (Value
);
239 Status
= gRT
->GetVariable (
246 if (EFI_ERROR (Status
) || Value
> 0x0f) {
247 return EFI_DEVICE_ERROR
;
254 Forces a driver to set the default configuration options for a controller.
256 @param This A pointer to the EFI_DRIVER_CONFIGURATION_ PROTOCOL
258 @param ControllerHandle The handle of the controller to force default
259 configuration options on.
260 @param ChildHandle The handle of the child controller to force default
261 configuration options on This is an optional parameter
262 that may be NULL. It will be NULL for device drivers.
263 It will also be NULL for a bus drivers that wish to
264 force default configuration options for the bus
265 controller. It will not be NULL for a bus driver that
266 wishes to force default configuration options for one
267 of its child controllers.
268 @param DefaultType The type of default configuration options to force on
269 the controller specified by ControllerHandle and
270 ChildHandle. See Table 9-1 for legal values.
271 A DefaultType of 0x00000000 must be supported
273 @param ActionRequired A pointer to the action that the calling agent
274 is required to perform when this function returns.
276 @retval EFI_SUCCESS The driver specified by This successfully forced
277 the default configuration options on the
278 controller specified by ControllerHandle and
280 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
281 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a
283 @retval EFI_INVALID_PARAMETER ActionRequired is NULL.
284 @retval EFI_UNSUPPORTED The driver specified by This does not support
285 forcing the default configuration options on
286 the controller specified by ControllerHandle
288 @retval EFI_UNSUPPORTED The driver specified by This does not support
289 the configuration type specified by DefaultType.
290 @retval EFI_DEVICE_ERROR A device error occurred while attempt to force
291 the default configuration options on the controller
292 specified by ControllerHandle and ChildHandle.
293 @retval EFI_OUT_RESOURCES There are not enough resources available to force
294 the default configuration options on the controller
295 specified by ControllerHandle and ChildHandle.
300 IDEBusDriverConfigurationForceDefaults (
301 IN EFI_DRIVER_CONFIGURATION_PROTOCOL
*This
,
302 IN EFI_HANDLE ControllerHandle
,
303 IN EFI_HANDLE ChildHandle OPTIONAL
,
304 IN UINT32 DefaultType
,
305 OUT EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED
*ActionRequired
310 if (ChildHandle
!= NULL
) {
311 return EFI_UNSUPPORTED
;
318 EFI_VARIABLE_NON_VOLATILE
| EFI_VARIABLE_BOOTSERVICE_ACCESS
,
322 *ActionRequired
= EfiDriverConfigurationActionRestartController
;