Vishal Bhoj | 82c8071 | 2015-12-15 21:13:33 +0530 | [diff] [blame^] | 1 | /** @file
|
| 2 | Main file for DrvCfg shell Driver1 function.
|
| 3 |
|
| 4 | (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
|
| 5 | Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>
|
| 6 | This program and the accompanying materials
|
| 7 | are licensed and made available under the terms and conditions of the BSD License
|
| 8 | which accompanies this distribution. The full text of the license may be found at
|
| 9 | http://opensource.org/licenses/bsd-license.php
|
| 10 |
|
| 11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
| 12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
| 13 |
|
| 14 | **/
|
| 15 |
|
| 16 | #include "UefiShellDriver1CommandsLib.h"
|
| 17 | #include <Protocol/HiiConfigAccess.h>
|
| 18 | #include <Protocol/HiiDatabase.h>
|
| 19 |
|
| 20 | STATIC CONST EFI_GUID *CfgGuidList[] = {&gEfiDriverConfigurationProtocolGuid, &gEfiDriverConfiguration2ProtocolGuid, NULL};
|
| 21 |
|
| 22 | /**
|
| 23 | Find the EFI_HII_HANDLE by device path.
|
| 24 |
|
| 25 | @param[in] DevPath1 The Device Path to match.
|
| 26 | @param[out] HiiHandle The EFI_HII_HANDLE after the converstion.
|
| 27 | @param[in] HiiDb The Hii database protocol
|
| 28 |
|
| 29 | @retval EFI_SUCCESS The operation was successful.
|
| 30 | @retval EFI_NOT_FOUND There was no EFI_HII_HANDLE found for that deviec path.
|
| 31 | **/
|
| 32 | EFI_STATUS
|
| 33 | EFIAPI
|
| 34 | FindHiiHandleViaDevPath(
|
| 35 | IN CONST EFI_DEVICE_PATH_PROTOCOL *DevPath1,
|
| 36 | OUT EFI_HII_HANDLE *HiiHandle,
|
| 37 | IN EFI_HII_DATABASE_PROTOCOL *HiiDb
|
| 38 | )
|
| 39 | {
|
| 40 | EFI_HII_HANDLE *HandleBuffer;
|
| 41 | UINTN HandleBufferSize;
|
| 42 | VOID *MainBuffer;
|
| 43 | UINTN MainBufferSize;
|
| 44 | EFI_HII_PACKAGE_LIST_HEADER *PackageListHeader;
|
| 45 | EFI_HII_PACKAGE_HEADER *PackageHeader;
|
| 46 | UINTN LoopVariable;
|
| 47 | EFI_DEVICE_PATH_PROTOCOL *DevPath2;
|
| 48 | EFI_STATUS Status;
|
| 49 |
|
| 50 | ASSERT(DevPath1 != NULL);
|
| 51 | ASSERT(HiiHandle != NULL);
|
| 52 | ASSERT(*HiiHandle == NULL);
|
| 53 | ASSERT(HiiDb != NULL);
|
| 54 |
|
| 55 | HandleBufferSize = 0;
|
| 56 | HandleBuffer = NULL;
|
| 57 | Status = HiiDb->ListPackageLists(HiiDb, EFI_HII_PACKAGE_DEVICE_PATH, NULL, &HandleBufferSize, HandleBuffer);
|
| 58 | if (Status == EFI_BUFFER_TOO_SMALL) {
|
| 59 | HandleBuffer = AllocateZeroPool(HandleBufferSize);
|
| 60 | ASSERT (HandleBuffer != NULL);
|
| 61 | Status = HiiDb->ListPackageLists(HiiDb, EFI_HII_PACKAGE_DEVICE_PATH, NULL, &HandleBufferSize, HandleBuffer);
|
| 62 | }
|
| 63 | if (EFI_ERROR(Status)) {
|
| 64 | SHELL_FREE_NON_NULL(HandleBuffer);
|
| 65 | return (Status);
|
| 66 | }
|
| 67 |
|
| 68 | if (HandleBuffer == NULL) {
|
| 69 | return EFI_NOT_FOUND;
|
| 70 | }
|
| 71 |
|
| 72 | for (LoopVariable = 0 ; LoopVariable < (HandleBufferSize/sizeof(HandleBuffer[0])) && *HiiHandle == NULL ; LoopVariable++) {
|
| 73 | MainBufferSize = 0;
|
| 74 | MainBuffer = NULL;
|
| 75 | Status = HiiDb->ExportPackageLists(HiiDb, HandleBuffer[LoopVariable], &MainBufferSize, MainBuffer);
|
| 76 | if (Status == EFI_BUFFER_TOO_SMALL) {
|
| 77 | MainBuffer = AllocateZeroPool(MainBufferSize);
|
| 78 | ASSERT (MainBuffer != NULL);
|
| 79 | Status = HiiDb->ExportPackageLists(HiiDb, HandleBuffer[LoopVariable], &MainBufferSize, MainBuffer);
|
| 80 | }
|
| 81 | //
|
| 82 | // Enumerate through the block of returned memory.
|
| 83 | // This should actually be a small block, but we need to be sure.
|
| 84 | //
|
| 85 | for (PackageListHeader = (EFI_HII_PACKAGE_LIST_HEADER*)MainBuffer
|
| 86 | ; PackageListHeader != NULL && ((CHAR8*)PackageListHeader) < (((CHAR8*)MainBuffer)+MainBufferSize) && *HiiHandle == NULL
|
| 87 | ; PackageListHeader = (EFI_HII_PACKAGE_LIST_HEADER*)(((CHAR8*)(PackageListHeader)) + PackageListHeader->PackageLength )) {
|
| 88 | for (PackageHeader = (EFI_HII_PACKAGE_HEADER*)(((CHAR8*)(PackageListHeader))+sizeof(EFI_HII_PACKAGE_LIST_HEADER))
|
| 89 | ; PackageHeader != NULL && ((CHAR8*)PackageHeader) < (((CHAR8*)MainBuffer)+MainBufferSize) && PackageHeader->Type != EFI_HII_PACKAGE_END && *HiiHandle == NULL
|
| 90 | ; PackageHeader = (EFI_HII_PACKAGE_HEADER*)(((CHAR8*)(PackageHeader))+PackageHeader->Length)) {
|
| 91 | if (PackageHeader->Type == EFI_HII_PACKAGE_DEVICE_PATH) {
|
| 92 | DevPath2 = (EFI_DEVICE_PATH_PROTOCOL*)(((CHAR8*)PackageHeader) + sizeof(EFI_HII_PACKAGE_HEADER));
|
| 93 | if (DevicePathCompare(&DevPath1, &DevPath2) == 0) {
|
| 94 | *HiiHandle = HandleBuffer[LoopVariable];
|
| 95 | break;
|
| 96 | }
|
| 97 | }
|
| 98 | }
|
| 99 | }
|
| 100 | SHELL_FREE_NON_NULL(MainBuffer);
|
| 101 | }
|
| 102 | SHELL_FREE_NON_NULL(HandleBuffer);
|
| 103 |
|
| 104 | if (*HiiHandle == NULL) {
|
| 105 | return (EFI_NOT_FOUND);
|
| 106 | }
|
| 107 | return (EFI_SUCCESS);
|
| 108 | }
|
| 109 |
|
| 110 | /**
|
| 111 | Convert a EFI_HANDLE to a EFI_HII_HANDLE.
|
| 112 |
|
| 113 | @param[in] Handle The EFI_HANDLE to convert.
|
| 114 | @param[out] HiiHandle The EFI_HII_HANDLE after the converstion.
|
| 115 | @param[in] HiiDb The Hii database protocol
|
| 116 |
|
| 117 | @retval EFI_SUCCESS The operation was successful.
|
| 118 | **/
|
| 119 | EFI_STATUS
|
| 120 | EFIAPI
|
| 121 | ConvertHandleToHiiHandle(
|
| 122 | IN CONST EFI_HANDLE Handle,
|
| 123 | OUT EFI_HII_HANDLE *HiiHandle,
|
| 124 | IN EFI_HII_DATABASE_PROTOCOL *HiiDb
|
| 125 | )
|
| 126 | {
|
| 127 | EFI_STATUS Status;
|
| 128 | EFI_DEVICE_PATH_PROTOCOL *DevPath1;
|
| 129 |
|
| 130 | if (HiiHandle == NULL || HiiDb == NULL) {
|
| 131 | return (EFI_INVALID_PARAMETER);
|
| 132 | }
|
| 133 | *HiiHandle = NULL;
|
| 134 |
|
| 135 | if (Handle == NULL) {
|
| 136 | return (EFI_SUCCESS);
|
| 137 | }
|
| 138 |
|
| 139 | DevPath1 = NULL;
|
| 140 | Status = gBS->OpenProtocol(Handle, &gEfiDevicePathProtocolGuid, (VOID**)&DevPath1, gImageHandle, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
|
| 141 | if (EFI_ERROR(Status) || DevPath1 == NULL) {
|
| 142 | return (EFI_NOT_FOUND);
|
| 143 | }
|
| 144 |
|
| 145 | return (FindHiiHandleViaDevPath(DevPath1, HiiHandle, HiiDb));
|
| 146 | }
|
| 147 |
|
| 148 | /**
|
| 149 | Function to print out all HII configuration information to a file.
|
| 150 |
|
| 151 | @param[in] Handle The handle to get info on. NULL to do all handles.
|
| 152 | @param[in] FileName The filename to rwite the info to.
|
| 153 | **/
|
| 154 | SHELL_STATUS
|
| 155 | EFIAPI
|
| 156 | ConfigToFile(
|
| 157 | IN CONST EFI_HANDLE Handle,
|
| 158 | IN CONST CHAR16 *FileName
|
| 159 | )
|
| 160 | {
|
| 161 | EFI_HII_DATABASE_PROTOCOL *HiiDatabase;
|
| 162 | EFI_STATUS Status;
|
| 163 | VOID *MainBuffer;
|
| 164 | UINTN MainBufferSize;
|
| 165 | EFI_HII_HANDLE HiiHandle;
|
| 166 | SHELL_FILE_HANDLE FileHandle;
|
| 167 |
|
| 168 | HiiDatabase = NULL;
|
| 169 | MainBufferSize = 0;
|
| 170 | MainBuffer = NULL;
|
| 171 | FileHandle = NULL;
|
| 172 |
|
| 173 | Status = ShellOpenFileByName(FileName, &FileHandle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE|EFI_FILE_MODE_CREATE, 0);
|
| 174 | if (EFI_ERROR(Status)) {
|
| 175 | ShellPrintHiiEx(
|
| 176 | -1,
|
| 177 | -1,
|
| 178 | NULL,
|
| 179 | STRING_TOKEN(STR_GEN_FILE_OPEN_FAIL),
|
| 180 | gShellDriver1HiiHandle,
|
| 181 | L"drvcfg",
|
| 182 | FileName,
|
| 183 | Status);
|
| 184 | return (SHELL_DEVICE_ERROR);
|
| 185 | }
|
| 186 |
|
| 187 | //
|
| 188 | // Locate HII Database protocol
|
| 189 | //
|
| 190 | Status = gBS->LocateProtocol (
|
| 191 | &gEfiHiiDatabaseProtocolGuid,
|
| 192 | NULL,
|
| 193 | (VOID **) &HiiDatabase
|
| 194 | );
|
| 195 |
|
| 196 | if (EFI_ERROR(Status) || HiiDatabase == NULL) {
|
| 197 | ShellPrintHiiEx(
|
| 198 | -1,
|
| 199 | -1,
|
| 200 | NULL,
|
| 201 | STRING_TOKEN(STR_GEN_PROTOCOL_NF),
|
| 202 | gShellDriver1HiiHandle,
|
| 203 | L"drvcfg",
|
| 204 | L"EfiHiiDatabaseProtocol",
|
| 205 | &gEfiHiiDatabaseProtocolGuid);
|
| 206 | ShellCloseFile(&FileHandle);
|
| 207 | return (SHELL_NOT_FOUND);
|
| 208 | }
|
| 209 |
|
| 210 | Status = ConvertHandleToHiiHandle(Handle, &HiiHandle, HiiDatabase);
|
| 211 | if (EFI_ERROR(Status)) {
|
| 212 | ShellPrintHiiEx(
|
| 213 | -1,
|
| 214 | -1,
|
| 215 | NULL,
|
| 216 | STRING_TOKEN(STR_GEN_HANDLE_NOT),
|
| 217 | gShellDriver1HiiHandle,
|
| 218 | L"drvcfg",
|
| 219 | ConvertHandleToHandleIndex(Handle),
|
| 220 | L"Device");
|
| 221 | ShellCloseFile(&FileHandle);
|
| 222 | return (SHELL_DEVICE_ERROR);
|
| 223 | }
|
| 224 |
|
| 225 | Status = HiiDatabase->ExportPackageLists(HiiDatabase, HiiHandle, &MainBufferSize, MainBuffer);
|
| 226 | if (Status == EFI_BUFFER_TOO_SMALL) {
|
| 227 | MainBuffer = AllocateZeroPool(MainBufferSize);
|
| 228 | Status = HiiDatabase->ExportPackageLists(HiiDatabase, HiiHandle, &MainBufferSize, MainBuffer);
|
| 229 | }
|
| 230 |
|
| 231 | Status = ShellWriteFile(FileHandle, &MainBufferSize, MainBuffer);
|
| 232 |
|
| 233 | ShellCloseFile(&FileHandle);
|
| 234 | SHELL_FREE_NON_NULL(MainBuffer);
|
| 235 |
|
| 236 | if (EFI_ERROR(Status)) {
|
| 237 | ShellPrintHiiEx(
|
| 238 | -1,
|
| 239 | -1,
|
| 240 | NULL,
|
| 241 | STRING_TOKEN(STR_FILE_WRITE_FAIL),
|
| 242 | gShellDriver1HiiHandle,
|
| 243 | L"drvcfg",
|
| 244 | FileName);
|
| 245 | return (SHELL_DEVICE_ERROR);
|
| 246 | }
|
| 247 | ShellPrintHiiEx(
|
| 248 | -1,
|
| 249 | -1,
|
| 250 | NULL,
|
| 251 | STRING_TOKEN(STR_DRVCFG_COMP),
|
| 252 | gShellDriver1HiiHandle);
|
| 253 |
|
| 254 | return (SHELL_SUCCESS);
|
| 255 | }
|
| 256 |
|
| 257 | /**
|
| 258 | Function to read in HII configuration information from a file.
|
| 259 |
|
| 260 | @param[in] Handle The handle to get info for.
|
| 261 | @param[in] FileName The filename to read the info from.
|
| 262 | **/
|
| 263 | SHELL_STATUS
|
| 264 | EFIAPI
|
| 265 | ConfigFromFile(
|
| 266 | IN EFI_HANDLE Handle,
|
| 267 | IN CONST CHAR16 *FileName
|
| 268 | )
|
| 269 | {
|
| 270 | EFI_HII_DATABASE_PROTOCOL *HiiDatabase;
|
| 271 | EFI_STATUS Status;
|
| 272 | VOID *MainBuffer;
|
| 273 | UINT64 Temp;
|
| 274 | UINTN MainBufferSize;
|
| 275 | EFI_HII_HANDLE HiiHandle;
|
| 276 | SHELL_FILE_HANDLE FileHandle;
|
| 277 | CHAR16 *TempDevPathString;
|
| 278 | EFI_HII_PACKAGE_LIST_HEADER *PackageListHeader;
|
| 279 | EFI_HII_PACKAGE_HEADER *PackageHeader;
|
| 280 | EFI_DEVICE_PATH_PROTOCOL *DevPath;
|
| 281 | UINTN HandleIndex;
|
| 282 |
|
| 283 | HiiDatabase = NULL;
|
| 284 | MainBufferSize = 0;
|
| 285 | MainBuffer = NULL;
|
| 286 | FileHandle = NULL;
|
| 287 |
|
| 288 | Status = ShellOpenFileByName(FileName, &FileHandle, EFI_FILE_MODE_READ, 0);
|
| 289 | if (EFI_ERROR(Status)) {
|
| 290 | ShellPrintHiiEx(
|
| 291 | -1,
|
| 292 | -1,
|
| 293 | NULL,
|
| 294 | STRING_TOKEN(STR_GEN_FILE_OPEN_FAIL),
|
| 295 | gShellDriver1HiiHandle,
|
| 296 | L"drvcfg",
|
| 297 | FileName,
|
| 298 | Status);
|
| 299 | return (SHELL_DEVICE_ERROR);
|
| 300 | }
|
| 301 |
|
| 302 | //
|
| 303 | // Locate HII Database protocol
|
| 304 | //
|
| 305 | Status = gBS->LocateProtocol (
|
| 306 | &gEfiHiiDatabaseProtocolGuid,
|
| 307 | NULL,
|
| 308 | (VOID **) &HiiDatabase
|
| 309 | );
|
| 310 |
|
| 311 | if (EFI_ERROR(Status) || HiiDatabase == NULL) {
|
| 312 | ShellPrintHiiEx(
|
| 313 | -1,
|
| 314 | -1,
|
| 315 | NULL,
|
| 316 | STRING_TOKEN(STR_GEN_PROTOCOL_NF),
|
| 317 | gShellDriver1HiiHandle,
|
| 318 | L"drvcfg",
|
| 319 | L"EfiHiiDatabaseProtocol",
|
| 320 | &gEfiHiiDatabaseProtocolGuid);
|
| 321 | ShellCloseFile(&FileHandle);
|
| 322 | return (SHELL_NOT_FOUND);
|
| 323 | }
|
| 324 |
|
| 325 | Status = ShellGetFileSize(FileHandle, &Temp);
|
| 326 | MainBufferSize = (UINTN)Temp;
|
| 327 | if (EFI_ERROR(Status)) {
|
| 328 | ShellPrintHiiEx(
|
| 329 | -1,
|
| 330 | -1,
|
| 331 | NULL,
|
| 332 | STRING_TOKEN(STR_FILE_READ_FAIL),
|
| 333 | gShellDriver1HiiHandle,
|
| 334 | L"drvcfg",
|
| 335 | FileName);
|
| 336 |
|
| 337 | ShellCloseFile(&FileHandle);
|
| 338 | return (SHELL_DEVICE_ERROR);
|
| 339 | }
|
| 340 | MainBuffer = AllocateZeroPool((UINTN)MainBufferSize);
|
| 341 | if (EFI_ERROR(Status)) {
|
| 342 | ShellPrintHiiEx(
|
| 343 | -1,
|
| 344 | -1,
|
| 345 | NULL,
|
| 346 | STRING_TOKEN(STR_GEN_OUT_MEM),
|
| 347 | gShellDriver1HiiHandle, L"drvcfg");
|
| 348 | ShellCloseFile(&FileHandle);
|
| 349 | return (SHELL_DEVICE_ERROR);
|
| 350 | }
|
| 351 | Status = ShellReadFile(FileHandle, &MainBufferSize, MainBuffer);
|
| 352 | if (EFI_ERROR(Status)) {
|
| 353 | ShellPrintHiiEx(
|
| 354 | -1,
|
| 355 | -1,
|
| 356 | NULL,
|
| 357 | STRING_TOKEN(STR_FILE_READ_FAIL),
|
| 358 | gShellDriver1HiiHandle,
|
| 359 | L"drvcfg",
|
| 360 | FileName);
|
| 361 |
|
| 362 | ShellCloseFile(&FileHandle);
|
| 363 | SHELL_FREE_NON_NULL(MainBuffer);
|
| 364 | return (SHELL_DEVICE_ERROR);
|
| 365 | }
|
| 366 |
|
| 367 | ShellCloseFile(&FileHandle);
|
| 368 |
|
| 369 | if (Handle != NULL) {
|
| 370 | //
|
| 371 | // User override in place. Just do it.
|
| 372 | //
|
| 373 | HiiHandle = NULL;
|
| 374 | Status = ConvertHandleToHiiHandle(Handle, &HiiHandle, HiiDatabase);
|
| 375 | if (EFI_ERROR(Status)) {
|
| 376 | ShellPrintHiiEx(
|
| 377 | -1,
|
| 378 | -1,
|
| 379 | NULL,
|
| 380 | STRING_TOKEN(STR_GEN_HANDLE_NOT),
|
| 381 | gShellDriver1HiiHandle, L"drvcfg",
|
| 382 | ConvertHandleToHandleIndex(Handle),
|
| 383 | L"Device");
|
| 384 | ShellCloseFile(&FileHandle);
|
| 385 | return (SHELL_DEVICE_ERROR);
|
| 386 | }
|
| 387 | Status = HiiDatabase->UpdatePackageList(HiiDatabase, HiiHandle, MainBuffer);
|
| 388 | if (EFI_ERROR(Status)) {
|
| 389 | ShellPrintHiiEx(
|
| 390 | -1,
|
| 391 | -1,
|
| 392 | NULL,
|
| 393 | STRING_TOKEN(STR_GEN_UEFI_FUNC_WARN),
|
| 394 | gShellDriver1HiiHandle,
|
| 395 | L"drvcfg",
|
| 396 | L"HiiDatabase->UpdatePackageList",
|
| 397 | Status);
|
| 398 | return (SHELL_DEVICE_ERROR);
|
| 399 | }
|
| 400 | } else {
|
| 401 | //
|
| 402 | // we need to parse the buffer and try to match the device paths for each item to try to find it's device path.
|
| 403 | //
|
| 404 |
|
| 405 | for (PackageListHeader = (EFI_HII_PACKAGE_LIST_HEADER*)MainBuffer
|
| 406 | ; PackageListHeader != NULL && ((CHAR8*)PackageListHeader) < (((CHAR8*)MainBuffer)+MainBufferSize)
|
| 407 | ; PackageListHeader = (EFI_HII_PACKAGE_LIST_HEADER*)(((CHAR8*)(PackageListHeader)) + PackageListHeader->PackageLength )) {
|
| 408 | for (PackageHeader = (EFI_HII_PACKAGE_HEADER*)(((CHAR8*)(PackageListHeader))+sizeof(EFI_HII_PACKAGE_LIST_HEADER))
|
| 409 | ; PackageHeader != NULL && ((CHAR8*)PackageHeader) < (((CHAR8*)MainBuffer)+MainBufferSize) && PackageHeader->Type != EFI_HII_PACKAGE_END
|
| 410 | ; PackageHeader = (EFI_HII_PACKAGE_HEADER*)(((CHAR8*)(PackageHeader))+PackageHeader->Length)) {
|
| 411 | if (PackageHeader->Type == EFI_HII_PACKAGE_DEVICE_PATH) {
|
| 412 | HiiHandle = NULL;
|
| 413 | Status = FindHiiHandleViaDevPath((EFI_DEVICE_PATH_PROTOCOL*)(((CHAR8*)PackageHeader) + sizeof(EFI_HII_PACKAGE_HEADER)), &HiiHandle, HiiDatabase);
|
| 414 | if (EFI_ERROR(Status)) {
|
| 415 | //
|
| 416 | // print out an error.
|
| 417 | //
|
| 418 | TempDevPathString = ConvertDevicePathToText((EFI_DEVICE_PATH_PROTOCOL*)(((CHAR8*)PackageHeader) + sizeof(EFI_HII_PACKAGE_HEADER)), TRUE, TRUE);
|
| 419 | ShellPrintHiiEx(
|
| 420 | -1,
|
| 421 | -1,
|
| 422 | NULL,
|
| 423 | STRING_TOKEN(STR_DRVCFG_IN_FILE_NF),
|
| 424 | gShellDriver1HiiHandle,
|
| 425 | TempDevPathString);
|
| 426 | SHELL_FREE_NON_NULL(TempDevPathString);
|
| 427 | } else {
|
| 428 | Status = HiiDatabase->UpdatePackageList(HiiDatabase, HiiHandle, PackageListHeader);
|
| 429 | if (EFI_ERROR(Status)) {
|
| 430 | ShellPrintHiiEx(
|
| 431 | -1,
|
| 432 | -1,
|
| 433 | NULL,
|
| 434 | STRING_TOKEN(STR_GEN_UEFI_FUNC_WARN),
|
| 435 | gShellDriver1HiiHandle,
|
| 436 | L"drvcfg",
|
| 437 | L"HiiDatabase->UpdatePackageList",
|
| 438 | Status);
|
| 439 | return (SHELL_DEVICE_ERROR);
|
| 440 | } else {
|
| 441 | DevPath = (EFI_DEVICE_PATH_PROTOCOL*)(((CHAR8*)PackageHeader) + sizeof(EFI_HII_PACKAGE_HEADER));
|
| 442 | gBS->LocateDevicePath(&gEfiHiiConfigAccessProtocolGuid, &DevPath, &Handle);
|
| 443 | HandleIndex = ConvertHandleToHandleIndex(Handle);
|
| 444 | ShellPrintHiiEx(
|
| 445 | -1,
|
| 446 | -1,
|
| 447 | NULL,
|
| 448 | STRING_TOKEN(STR_DRVCFG_DONE_HII),
|
| 449 | gShellDriver1HiiHandle,
|
| 450 | HandleIndex);
|
| 451 | }
|
| 452 | }
|
| 453 | }
|
| 454 | }
|
| 455 | }
|
| 456 | }
|
| 457 |
|
| 458 | SHELL_FREE_NON_NULL(MainBuffer);
|
| 459 |
|
| 460 |
|
| 461 | ShellPrintHiiEx(
|
| 462 | -1,
|
| 463 | -1,
|
| 464 | NULL,
|
| 465 | STRING_TOKEN(STR_DRVCFG_COMP),
|
| 466 | gShellDriver1HiiHandle);
|
| 467 | return (SHELL_SUCCESS);
|
| 468 | }
|
| 469 |
|
| 470 | /**
|
| 471 | Present a requested action to the user.
|
| 472 |
|
| 473 | @param[in] DriverImageHandle The handle for the driver to configure.
|
| 474 | @param[in] ControllerHandle The handle of the device being managed by the Driver specified.
|
| 475 | @param[in] ChildHandle The handle of a child device of the specified device.
|
| 476 | @param[in] ActionRequired The required HII action.
|
| 477 |
|
| 478 | @retval SHELL_INVALID_PARAMETER A parameter has a invalid value.
|
| 479 | **/
|
| 480 | EFI_STATUS
|
| 481 | EFIAPI
|
| 482 | ShellCmdDriverConfigurationProcessActionRequired (
|
| 483 | EFI_HANDLE DriverImageHandle,
|
| 484 | EFI_HANDLE ControllerHandle,
|
| 485 | EFI_HANDLE ChildHandle,
|
| 486 | EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED ActionRequired
|
| 487 | )
|
| 488 | {
|
| 489 | EFI_HANDLE ConnectControllerContextOverride[2];
|
| 490 |
|
| 491 | switch (ActionRequired) {
|
| 492 | case EfiDriverConfigurationActionNone:
|
| 493 | ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_DRVCFG_NONE), gShellDriver1HiiHandle);
|
| 494 | break;
|
| 495 |
|
| 496 | case EfiDriverConfigurationActionStopController:
|
| 497 | ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_DRVCFG_STOP), gShellDriver1HiiHandle);
|
| 498 | ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_DRVCFG_ENTER_S), gShellDriver1HiiHandle, L"stop controller");
|
| 499 | ShellPromptForResponse(ShellPromptResponseTypeEnterContinue, NULL, NULL);
|
| 500 |
|
| 501 | gBS->DisconnectController (ControllerHandle, DriverImageHandle, ChildHandle);
|
| 502 | ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_DRVCFG_CTLR_S), gShellDriver1HiiHandle, L"stopped");
|
| 503 | break;
|
| 504 |
|
| 505 | case EfiDriverConfigurationActionRestartController:
|
| 506 | ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_DRVCFG_RESTART_S), gShellDriver1HiiHandle, L"controller");
|
| 507 | ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_DRVCFG_ENTER_S), gShellDriver1HiiHandle, L"restart controller");
|
| 508 | ShellPromptForResponse(ShellPromptResponseTypeEnterContinue, NULL, NULL);
|
| 509 |
|
| 510 | gBS->DisconnectController (ControllerHandle, DriverImageHandle, ChildHandle);
|
| 511 | ConnectControllerContextOverride[0] = DriverImageHandle;
|
| 512 | ConnectControllerContextOverride[1] = NULL;
|
| 513 | gBS->ConnectController (ControllerHandle, ConnectControllerContextOverride, NULL, TRUE);
|
| 514 | ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_DRVCFG_CTLR_S), gShellDriver1HiiHandle, L"restarted");
|
| 515 | break;
|
| 516 |
|
| 517 | case EfiDriverConfigurationActionRestartPlatform:
|
| 518 | ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_DRVCFG_RESTART_S), gShellDriver1HiiHandle, L"platform");
|
| 519 | ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_DRVCFG_ENTER_S), gShellDriver1HiiHandle, L"restart platform");
|
| 520 | ShellPromptForResponse(ShellPromptResponseTypeEnterContinue, NULL, NULL);
|
| 521 |
|
| 522 | gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);
|
| 523 | break;
|
| 524 |
|
| 525 | default:
|
| 526 | return (EFI_INVALID_PARAMETER);
|
| 527 | }
|
| 528 |
|
| 529 | return EFI_SUCCESS;
|
| 530 | }
|
| 531 |
|
| 532 | /**
|
| 533 | Do the configuration in an environment without HII.
|
| 534 |
|
| 535 | @param[in] Language The language code.
|
| 536 | @param[in] ForceDefaults TRUE to force defaults, FALSE otherwise.
|
| 537 | @param[in] DefaultType If ForceDefaults is TRUE, specifies the default type.
|
| 538 | @param[in] AllChildren TRUE to configure all children, FALSE otherwise.
|
| 539 | @param[in] ValidateOptions TRUE to validate existing options, FALSE otherwise.
|
| 540 | @param[in] SetOptions TRUE to set options, FALSE otherwise.
|
| 541 | @param[in] DriverImageHandle The handle for the driver to configure.
|
| 542 | @param[in] DeviceHandle The handle of the device being managed by the Driver specified.
|
| 543 | @param[in] ChildHandle The handle of a child device of the specified device.
|
| 544 |
|
| 545 | @retval SHELL_NOT_FOUND A specified handle could not be found.
|
| 546 | @retval SHELL_INVALID_PARAMETER A parameter has a invalid value.
|
| 547 | **/
|
| 548 | SHELL_STATUS
|
| 549 | EFIAPI
|
| 550 | PreHiiDrvCfg (
|
| 551 | IN CONST CHAR8 *Language,
|
| 552 | IN BOOLEAN ForceDefaults,
|
| 553 | IN UINT32 DefaultType,
|
| 554 | IN BOOLEAN AllChildren,
|
| 555 | IN BOOLEAN ValidateOptions,
|
| 556 | IN BOOLEAN SetOptions,
|
| 557 | IN EFI_HANDLE DriverImageHandle,
|
| 558 | IN EFI_HANDLE DeviceHandle,
|
| 559 | IN EFI_HANDLE ChildHandle
|
| 560 | )
|
| 561 | {
|
| 562 | EFI_STATUS Status;
|
| 563 | SHELL_STATUS ShellStatus;
|
| 564 | UINTN OuterLoopCounter;
|
| 565 | CHAR8 *BestLanguage;
|
| 566 | UINTN DriverImageHandleCount;
|
| 567 | EFI_HANDLE *DriverImageHandleBuffer;
|
| 568 | UINTN HandleCount;
|
| 569 | EFI_HANDLE *HandleBuffer;
|
| 570 | UINTN *HandleType;
|
| 571 | UINTN LoopCounter;
|
| 572 | UINTN ChildIndex;
|
| 573 | UINTN ChildHandleCount;
|
| 574 | EFI_HANDLE *ChildHandleBuffer;
|
| 575 | UINTN *ChildHandleType;
|
| 576 | EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED ActionRequired;
|
| 577 | EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration;
|
| 578 | BOOLEAN Iso639Language;
|
| 579 | UINTN HandleIndex1;
|
| 580 | UINTN HandleIndex2;
|
| 581 | UINTN HandleIndex3;
|
| 582 |
|
| 583 | ShellStatus = SHELL_SUCCESS;
|
| 584 |
|
| 585 | if (ChildHandle == NULL && AllChildren) {
|
| 586 | SetOptions = FALSE;
|
| 587 | }
|
| 588 |
|
| 589 | if (ForceDefaults) {
|
| 590 | ShellPrintHiiEx(
|
| 591 | -1,
|
| 592 | -1,
|
| 593 | NULL,
|
| 594 | STRING_TOKEN (STR_DRVCFG_FORCE_D),
|
| 595 | gShellDriver1HiiHandle,
|
| 596 | DefaultType);
|
| 597 | } else if (ValidateOptions) {
|
| 598 | ShellPrintHiiEx(
|
| 599 | -1,
|
| 600 | -1,
|
| 601 | NULL,
|
| 602 | STRING_TOKEN (STR_DRVCFG_VALIDATE),
|
| 603 | gShellDriver1HiiHandle);
|
| 604 | } else if (SetOptions) {
|
| 605 | ShellPrintHiiEx(
|
| 606 | -1,
|
| 607 | -1,
|
| 608 | NULL,
|
| 609 | STRING_TOKEN (STR_DRVCFG_SET),
|
| 610 | gShellDriver1HiiHandle);
|
| 611 | }
|
| 612 |
|
| 613 | if (DriverImageHandle == 0) {
|
| 614 | DriverImageHandleBuffer = GetHandleListByProtocolList(CfgGuidList);
|
| 615 | if (DriverImageHandleBuffer == NULL) {
|
| 616 | ShellStatus = SHELL_NOT_FOUND;
|
| 617 | goto Done;
|
| 618 | }
|
| 619 | for (
|
| 620 | HandleBuffer = DriverImageHandleBuffer, DriverImageHandleCount = 0
|
| 621 | ; HandleBuffer != NULL && *HandleBuffer != NULL
|
| 622 | ; HandleBuffer++,DriverImageHandleCount++);
|
| 623 | } else {
|
| 624 | DriverImageHandleCount = 1;
|
| 625 | //
|
| 626 | // Allocate buffer to hold the image handle so as to
|
| 627 | // keep consistent with the above clause
|
| 628 | //
|
| 629 | DriverImageHandleBuffer = AllocatePool (sizeof (EFI_HANDLE));
|
| 630 | ASSERT (DriverImageHandleBuffer);
|
| 631 | DriverImageHandleBuffer[0] = DriverImageHandle;
|
| 632 | }
|
| 633 |
|
| 634 | for (OuterLoopCounter = 0; OuterLoopCounter < DriverImageHandleCount; OuterLoopCounter++) {
|
| 635 | Iso639Language = FALSE;
|
| 636 | Status = gBS->OpenProtocol (
|
| 637 | DriverImageHandleBuffer[OuterLoopCounter],
|
| 638 | &gEfiDriverConfiguration2ProtocolGuid,
|
| 639 | (VOID **) &DriverConfiguration,
|
| 640 | NULL,
|
| 641 | NULL,
|
| 642 | EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
| 643 | );
|
| 644 | if (EFI_ERROR (Status)) {
|
| 645 | Iso639Language = TRUE;
|
| 646 | Status = gBS->OpenProtocol (
|
| 647 | DriverImageHandleBuffer[OuterLoopCounter],
|
| 648 | &gEfiDriverConfigurationProtocolGuid,
|
| 649 | (VOID **) &DriverConfiguration,
|
| 650 | NULL,
|
| 651 | NULL,
|
| 652 | EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
| 653 | );
|
| 654 | }
|
| 655 | if (EFI_ERROR (Status)) {
|
| 656 | // ShellPrintHiiEx(
|
| 657 | // -1,
|
| 658 | // -1,
|
| 659 | // NULL,
|
| 660 | // STRING_TOKEN (STR_DRVCFG_NOT_SUPPORT),
|
| 661 | // gShellDriver1HiiHandle,
|
| 662 | // ConvertHandleToHandleIndex (DriverImageHandleBuffer[OuterLoopCounter])
|
| 663 | // );
|
| 664 | ShellStatus = SHELL_UNSUPPORTED;
|
| 665 | continue;
|
| 666 | }
|
| 667 |
|
| 668 | BestLanguage = GetBestLanguage (
|
| 669 | DriverConfiguration->SupportedLanguages,
|
| 670 | Iso639Language,
|
| 671 | Language!=NULL?Language:"",
|
| 672 | DriverConfiguration->SupportedLanguages,
|
| 673 | NULL
|
| 674 | );
|
| 675 | if (BestLanguage == NULL) {
|
| 676 | ShellPrintHiiEx(
|
| 677 | -1,
|
| 678 | -1,
|
| 679 | NULL,
|
| 680 | STRING_TOKEN (STR_GEN_NO_VALUE),
|
| 681 | gShellDriver1HiiHandle,
|
| 682 | L"drvcfg",
|
| 683 | L"-l"
|
| 684 | );
|
| 685 | ShellStatus = SHELL_INVALID_PARAMETER;
|
| 686 | continue;
|
| 687 | }
|
| 688 |
|
| 689 | Status = ParseHandleDatabaseByRelationshipWithType (
|
| 690 | DriverImageHandleBuffer[OuterLoopCounter],
|
| 691 | NULL,
|
| 692 | &HandleCount,
|
| 693 | &HandleBuffer,
|
| 694 | &HandleType
|
| 695 | );
|
| 696 | if (EFI_ERROR (Status)) {
|
| 697 | continue;
|
| 698 | }
|
| 699 |
|
| 700 | if (SetOptions && DeviceHandle == NULL) {
|
| 701 |
|
| 702 | gST->ConOut->ClearScreen (gST->ConOut);
|
| 703 | Status = DriverConfiguration->SetOptions (
|
| 704 | DriverConfiguration,
|
| 705 | NULL,
|
| 706 | NULL,
|
| 707 | BestLanguage,
|
| 708 | &ActionRequired
|
| 709 | );
|
| 710 | gST->ConOut->ClearScreen (gST->ConOut);
|
| 711 |
|
| 712 | ShellPrintHiiEx(
|
| 713 | -1,
|
| 714 | -1,
|
| 715 | NULL,
|
| 716 | STRING_TOKEN (STR_DRVCFG_ALL_LANG),
|
| 717 | gShellDriver1HiiHandle,
|
| 718 | ConvertHandleToHandleIndex (DriverImageHandleBuffer[OuterLoopCounter]),
|
| 719 | DriverConfiguration->SupportedLanguages
|
| 720 | );
|
| 721 | if (!EFI_ERROR (Status)) {
|
| 722 | ShellPrintHiiEx(
|
| 723 | -1,
|
| 724 | -1,
|
| 725 | NULL,
|
| 726 | STRING_TOKEN (STR_DRVCFG_OPTIONS_SET),
|
| 727 | gShellDriver1HiiHandle);
|
| 728 | for (LoopCounter = 0; LoopCounter < HandleCount; LoopCounter++) {
|
| 729 | if ((HandleType[LoopCounter] & HR_CONTROLLER_HANDLE) == HR_CONTROLLER_HANDLE) {
|
| 730 | ShellCmdDriverConfigurationProcessActionRequired (
|
| 731 | DriverImageHandleBuffer[OuterLoopCounter],
|
| 732 | HandleBuffer[LoopCounter],
|
| 733 | NULL,
|
| 734 | ActionRequired
|
| 735 | );
|
| 736 | }
|
| 737 | }
|
| 738 | } else {
|
| 739 | ShellPrintHiiEx(
|
| 740 | -1,
|
| 741 | -1,
|
| 742 | NULL,
|
| 743 | STRING_TOKEN (STR_DRVCFG_NOT_SET),
|
| 744 | gShellDriver1HiiHandle,
|
| 745 | Status);
|
| 746 | }
|
| 747 | continue;
|
| 748 | }
|
| 749 |
|
| 750 | for (LoopCounter = 0; LoopCounter < HandleCount; LoopCounter++) {
|
| 751 | if ((HandleType[LoopCounter] & HR_CONTROLLER_HANDLE) != HR_CONTROLLER_HANDLE) {
|
| 752 | continue;
|
| 753 | }
|
| 754 | if (DeviceHandle != NULL && DeviceHandle != HandleBuffer[LoopCounter]) {
|
| 755 | continue;
|
| 756 | }
|
| 757 | if (ChildHandle == NULL) {
|
| 758 | HandleIndex1 = ConvertHandleToHandleIndex (DriverImageHandleBuffer[OuterLoopCounter]);
|
| 759 | HandleIndex2 = ConvertHandleToHandleIndex (HandleBuffer[LoopCounter]);
|
| 760 | ShellPrintHiiEx(
|
| 761 | -1,
|
| 762 | -1,
|
| 763 | NULL,
|
| 764 | STRING_TOKEN (STR_DRVCFG_CTRL_LANG),
|
| 765 | gShellDriver1HiiHandle,
|
| 766 | HandleIndex1,
|
| 767 | HandleIndex2,
|
| 768 | DriverConfiguration->SupportedLanguages
|
| 769 | );
|
| 770 |
|
| 771 | if (ForceDefaults) {
|
| 772 | Status = DriverConfiguration->ForceDefaults (
|
| 773 | DriverConfiguration,
|
| 774 | HandleBuffer[LoopCounter],
|
| 775 | NULL,
|
| 776 | DefaultType,
|
| 777 | &ActionRequired
|
| 778 | );
|
| 779 |
|
| 780 | if (!EFI_ERROR (Status)) {
|
| 781 | ShellPrintHiiEx(
|
| 782 | -1,
|
| 783 | -1,
|
| 784 | NULL,
|
| 785 | STRING_TOKEN (STR_DRVCFG_DEF_FORCED),
|
| 786 | gShellDriver1HiiHandle);
|
| 787 | ShellCmdDriverConfigurationProcessActionRequired (
|
| 788 | DriverImageHandleBuffer[OuterLoopCounter],
|
| 789 | HandleBuffer[LoopCounter],
|
| 790 | NULL,
|
| 791 | ActionRequired
|
| 792 | );
|
| 793 | } else {
|
| 794 | ShellPrintHiiEx(
|
| 795 | -1,
|
| 796 | -1,
|
| 797 | NULL,
|
| 798 | STRING_TOKEN (STR_DRVCFG_FORCE_FAILED),
|
| 799 | gShellDriver1HiiHandle,
|
| 800 | Status);
|
| 801 | ShellStatus = SHELL_DEVICE_ERROR;
|
| 802 | }
|
| 803 | } else if (ValidateOptions) {
|
| 804 | Status = DriverConfiguration->OptionsValid (
|
| 805 | DriverConfiguration,
|
| 806 | HandleBuffer[LoopCounter],
|
| 807 | NULL
|
| 808 | );
|
| 809 |
|
| 810 | if (!EFI_ERROR (Status)) {
|
| 811 | ShellPrintHiiEx(
|
| 812 | -1,
|
| 813 | -1,
|
| 814 | NULL,
|
| 815 | STRING_TOKEN (STR_DRVCFG_OPTIONS_VALID),
|
| 816 | gShellDriver1HiiHandle);
|
| 817 | } else {
|
| 818 | ShellPrintHiiEx(
|
| 819 | -1,
|
| 820 | -1,
|
| 821 | NULL,
|
| 822 | STRING_TOKEN (STR_DRVCFG_OPTIONS_INV),
|
| 823 | gShellDriver1HiiHandle,
|
| 824 | Status);
|
| 825 | ShellStatus = SHELL_DEVICE_ERROR;
|
| 826 | }
|
| 827 | } else if (SetOptions) {
|
| 828 | gST->ConOut->ClearScreen (gST->ConOut);
|
| 829 | Status = DriverConfiguration->SetOptions (
|
| 830 | DriverConfiguration,
|
| 831 | HandleBuffer[LoopCounter],
|
| 832 | NULL,
|
| 833 | BestLanguage,
|
| 834 | &ActionRequired
|
| 835 | );
|
| 836 | gST->ConOut->ClearScreen (gST->ConOut);
|
| 837 | HandleIndex1 = ConvertHandleToHandleIndex (DriverImageHandleBuffer[OuterLoopCounter]);
|
| 838 | HandleIndex2 = ConvertHandleToHandleIndex (HandleBuffer[LoopCounter]);
|
| 839 | ShellPrintHiiEx(
|
| 840 | -1,
|
| 841 | -1,
|
| 842 | NULL,
|
| 843 | STRING_TOKEN (STR_DRVCFG_CTRL_LANG),
|
| 844 | gShellDriver1HiiHandle,
|
| 845 | HandleIndex1,
|
| 846 | HandleIndex2,
|
| 847 | DriverConfiguration->SupportedLanguages
|
| 848 | );
|
| 849 | if (!EFI_ERROR (Status)) {
|
| 850 | ShellPrintHiiEx(
|
| 851 | -1,
|
| 852 | -1,
|
| 853 | NULL,
|
| 854 | STRING_TOKEN (STR_DRVCFG_OPTIONS_SET),
|
| 855 | gShellDriver1HiiHandle);
|
| 856 |
|
| 857 | ShellCmdDriverConfigurationProcessActionRequired (
|
| 858 | DriverImageHandleBuffer[OuterLoopCounter],
|
| 859 | HandleBuffer[LoopCounter],
|
| 860 | NULL,
|
| 861 | ActionRequired
|
| 862 | );
|
| 863 |
|
| 864 | } else {
|
| 865 | ShellPrintHiiEx(
|
| 866 | -1,
|
| 867 | -1,
|
| 868 | NULL,
|
| 869 | STRING_TOKEN (STR_DRVCFG_NOT_SET),
|
| 870 | gShellDriver1HiiHandle,
|
| 871 | Status);
|
| 872 | ShellStatus = SHELL_DEVICE_ERROR;
|
| 873 | }
|
| 874 | } else {
|
| 875 | Print (L"\n");
|
| 876 | }
|
| 877 | }
|
| 878 |
|
| 879 | if (ChildHandle == NULL && !AllChildren) {
|
| 880 | continue;
|
| 881 | }
|
| 882 |
|
| 883 | Status = ParseHandleDatabaseByRelationshipWithType (
|
| 884 | DriverImageHandleBuffer[OuterLoopCounter],
|
| 885 | HandleBuffer[LoopCounter],
|
| 886 | &ChildHandleCount,
|
| 887 | &ChildHandleBuffer,
|
| 888 | &ChildHandleType
|
| 889 | );
|
| 890 | if (EFI_ERROR (Status)) {
|
| 891 | continue;
|
| 892 | }
|
| 893 |
|
| 894 | for (ChildIndex = 0; ChildIndex < ChildHandleCount; ChildIndex++) {
|
| 895 |
|
| 896 | if ((ChildHandleType[ChildIndex] & HR_CHILD_HANDLE) != HR_CHILD_HANDLE) {
|
| 897 | continue;
|
| 898 | }
|
| 899 |
|
| 900 | if (ChildHandle != NULL && ChildHandle != ChildHandleBuffer[ChildIndex]) {
|
| 901 | continue;
|
| 902 | }
|
| 903 |
|
| 904 | HandleIndex1 = ConvertHandleToHandleIndex (DriverImageHandleBuffer[OuterLoopCounter]);
|
| 905 | HandleIndex2 = ConvertHandleToHandleIndex (HandleBuffer[LoopCounter]);
|
| 906 | HandleIndex3 = ConvertHandleToHandleIndex (ChildHandleBuffer[ChildIndex]);
|
| 907 | ShellPrintHiiEx(
|
| 908 | -1,
|
| 909 | -1,
|
| 910 | NULL,
|
| 911 | STRING_TOKEN (STR_DRVCFG_CHILD_LANG),
|
| 912 | gShellDriver1HiiHandle,
|
| 913 | HandleIndex1,
|
| 914 | HandleIndex2,
|
| 915 | HandleIndex3,
|
| 916 | DriverConfiguration->SupportedLanguages);
|
| 917 |
|
| 918 | if (ForceDefaults) {
|
| 919 | Status = DriverConfiguration->ForceDefaults (
|
| 920 | DriverConfiguration,
|
| 921 | HandleBuffer[LoopCounter],
|
| 922 | ChildHandleBuffer[ChildIndex],
|
| 923 | DefaultType,
|
| 924 | &ActionRequired
|
| 925 | );
|
| 926 |
|
| 927 | if (!EFI_ERROR (Status)) {
|
| 928 | ShellPrintHiiEx(
|
| 929 | -1,
|
| 930 | -1,
|
| 931 | NULL,
|
| 932 | STRING_TOKEN (STR_DRVCFG_DEF_FORCED),
|
| 933 | gShellDriver1HiiHandle);
|
| 934 |
|
| 935 | ShellCmdDriverConfigurationProcessActionRequired (
|
| 936 | DriverImageHandleBuffer[OuterLoopCounter],
|
| 937 | HandleBuffer[LoopCounter],
|
| 938 | ChildHandleBuffer[ChildIndex],
|
| 939 | ActionRequired
|
| 940 | );
|
| 941 |
|
| 942 | } else {
|
| 943 | ShellPrintHiiEx(
|
| 944 | -1,
|
| 945 | -1,
|
| 946 | NULL,
|
| 947 | STRING_TOKEN (STR_DRVCFG_FORCE_FAILED),
|
| 948 | gShellDriver1HiiHandle,
|
| 949 | Status);
|
| 950 | ShellStatus = SHELL_DEVICE_ERROR;
|
| 951 | }
|
| 952 | } else if (ValidateOptions) {
|
| 953 | Status = DriverConfiguration->OptionsValid (
|
| 954 | DriverConfiguration,
|
| 955 | HandleBuffer[LoopCounter],
|
| 956 | ChildHandleBuffer[ChildIndex]
|
| 957 | );
|
| 958 |
|
| 959 | if (!EFI_ERROR (Status)) {
|
| 960 | ShellPrintHiiEx(
|
| 961 | -1,
|
| 962 | -1,
|
| 963 | NULL,
|
| 964 | STRING_TOKEN (STR_DRVCFG_OPTIONS_VALID),
|
| 965 | gShellDriver1HiiHandle);
|
| 966 | } else {
|
| 967 | ShellPrintHiiEx(
|
| 968 | -1,
|
| 969 | -1,
|
| 970 | NULL,
|
| 971 | STRING_TOKEN (STR_DRVCFG_OPTIONS_INV),
|
| 972 | gShellDriver1HiiHandle,
|
| 973 | Status);
|
| 974 | ShellStatus = SHELL_DEVICE_ERROR;
|
| 975 | }
|
| 976 | } else if (SetOptions) {
|
| 977 | gST->ConOut->ClearScreen (gST->ConOut);
|
| 978 | Status = DriverConfiguration->SetOptions (
|
| 979 | DriverConfiguration,
|
| 980 | HandleBuffer[LoopCounter],
|
| 981 | ChildHandleBuffer[ChildIndex],
|
| 982 | BestLanguage,
|
| 983 | &ActionRequired
|
| 984 | );
|
| 985 | gST->ConOut->ClearScreen (gST->ConOut);
|
| 986 | HandleIndex1 = ConvertHandleToHandleIndex (DriverImageHandleBuffer[OuterLoopCounter]);
|
| 987 | HandleIndex2 = ConvertHandleToHandleIndex (HandleBuffer[LoopCounter]);
|
| 988 | HandleIndex3 = ConvertHandleToHandleIndex (ChildHandleBuffer[ChildIndex]);
|
| 989 | ShellPrintHiiEx(
|
| 990 | -1,
|
| 991 | -1,
|
| 992 | NULL,
|
| 993 | STRING_TOKEN (STR_DRVCFG_CHILD_LANG),
|
| 994 | gShellDriver1HiiHandle,
|
| 995 | HandleIndex1,
|
| 996 | HandleIndex2,
|
| 997 | HandleIndex3,
|
| 998 | DriverConfiguration->SupportedLanguages
|
| 999 | );
|
| 1000 | if (!EFI_ERROR (Status)) {
|
| 1001 | ShellPrintHiiEx(
|
| 1002 | -1,
|
| 1003 | -1,
|
| 1004 | NULL,
|
| 1005 | STRING_TOKEN (STR_DRVCFG_OPTIONS_SET),
|
| 1006 | gShellDriver1HiiHandle);
|
| 1007 |
|
| 1008 | ShellCmdDriverConfigurationProcessActionRequired (
|
| 1009 | DriverImageHandleBuffer[OuterLoopCounter],
|
| 1010 | HandleBuffer[LoopCounter],
|
| 1011 | ChildHandleBuffer[ChildIndex],
|
| 1012 | ActionRequired
|
| 1013 | );
|
| 1014 |
|
| 1015 | } else {
|
| 1016 | ShellPrintHiiEx(
|
| 1017 | -1,
|
| 1018 | -1,
|
| 1019 | NULL,
|
| 1020 | STRING_TOKEN (STR_DRVCFG_NOT_SET),
|
| 1021 | gShellDriver1HiiHandle,
|
| 1022 | Status);
|
| 1023 | ShellStatus = SHELL_DEVICE_ERROR;
|
| 1024 | }
|
| 1025 | } else {
|
| 1026 | Print (L"\n");
|
| 1027 | }
|
| 1028 | }
|
| 1029 |
|
| 1030 | FreePool (ChildHandleBuffer);
|
| 1031 | FreePool (ChildHandleType);
|
| 1032 | }
|
| 1033 |
|
| 1034 | FreePool (BestLanguage);
|
| 1035 | FreePool (HandleBuffer);
|
| 1036 | FreePool (HandleType);
|
| 1037 | }
|
| 1038 |
|
| 1039 | if (DriverImageHandle != NULL && DriverImageHandleCount != 0) {
|
| 1040 | FreePool (DriverImageHandleBuffer);
|
| 1041 | }
|
| 1042 |
|
| 1043 | Done:
|
| 1044 | return ShellStatus;
|
| 1045 | }
|
| 1046 |
|
| 1047 | /**
|
| 1048 | Function to print out configuration information on all configurable handles.
|
| 1049 |
|
| 1050 | @param[in] ChildrenToo TRUE to tewst for children.
|
| 1051 | @param[in] Language ASCII string for language code.
|
| 1052 | @param[in] UseHii TRUE to check for Hii and DPC, FALSE for DCP only.
|
| 1053 |
|
| 1054 | @retval SHELL_SUCCESS The operation was successful.
|
| 1055 | **/
|
| 1056 | SHELL_STATUS
|
| 1057 | EFIAPI
|
| 1058 | PrintConfigInfoOnAll(
|
| 1059 | IN CONST BOOLEAN ChildrenToo,
|
| 1060 | IN CONST CHAR8 *Language,
|
| 1061 | IN CONST BOOLEAN UseHii
|
| 1062 | )
|
| 1063 | {
|
| 1064 | EFI_HANDLE *HandleList;
|
| 1065 | EFI_HANDLE *CurrentHandle;
|
| 1066 | BOOLEAN Found;
|
| 1067 | UINTN Index2;
|
| 1068 |
|
| 1069 |
|
| 1070 | Found = FALSE;
|
| 1071 | HandleList = NULL;
|
| 1072 | CurrentHandle = NULL;
|
| 1073 |
|
| 1074 | if (UseHii) {
|
| 1075 | //
|
| 1076 | // HII method
|
| 1077 | //
|
| 1078 | HandleList = GetHandleListByProtocol(&gEfiHiiConfigAccessProtocolGuid);
|
| 1079 | for (CurrentHandle = HandleList ; CurrentHandle != NULL && *CurrentHandle != NULL; CurrentHandle++){
|
| 1080 | Found = TRUE;
|
| 1081 | Index2 = *CurrentHandle == NULL ? 0 : ConvertHandleToHandleIndex(*CurrentHandle);
|
| 1082 | ShellPrintHiiEx(
|
| 1083 | -1,
|
| 1084 | -1,
|
| 1085 | NULL,
|
| 1086 | STRING_TOKEN (STR_DRVCFG_LINE_HII),
|
| 1087 | gShellDriver1HiiHandle,
|
| 1088 | Index2
|
| 1089 | );
|
| 1090 | }
|
| 1091 | SHELL_FREE_NON_NULL(HandleList);
|
| 1092 | }
|
| 1093 |
|
| 1094 | if (PreHiiDrvCfg (
|
| 1095 | Language,
|
| 1096 | FALSE,
|
| 1097 | 0,
|
| 1098 | ChildrenToo,
|
| 1099 | FALSE,
|
| 1100 | FALSE,
|
| 1101 | 0,
|
| 1102 | 0,
|
| 1103 | 0) == SHELL_SUCCESS) {
|
| 1104 | Found = TRUE;
|
| 1105 | }
|
| 1106 |
|
| 1107 | if (!Found) {
|
| 1108 | ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_DRVCFG_NONE_FOUND), gShellDriver1HiiHandle);
|
| 1109 | return (SHELL_SUCCESS);
|
| 1110 | }
|
| 1111 |
|
| 1112 | return (SHELL_SUCCESS);
|
| 1113 | }
|
| 1114 |
|
| 1115 | STATIC CONST SHELL_PARAM_ITEM ParamListHii[] = {
|
| 1116 | {L"-s", TypeFlag},
|
| 1117 | {L"-l", TypeValue},
|
| 1118 | {L"-f", TypeValue},
|
| 1119 | {L"-o", TypeValue},
|
| 1120 | {L"-i", TypeValue},
|
| 1121 | {NULL, TypeMax}
|
| 1122 | };
|
| 1123 | STATIC CONST SHELL_PARAM_ITEM ParamListPreHii[] = {
|
| 1124 | {L"-c", TypeFlag},
|
| 1125 | {L"-s", TypeFlag},
|
| 1126 | {L"-v", TypeFlag},
|
| 1127 | {L"-l", TypeValue},
|
| 1128 | {L"-f", TypeValue},
|
| 1129 | {NULL, TypeMax}
|
| 1130 | };
|
| 1131 |
|
| 1132 | /**
|
| 1133 | Function for 'drvcfg' command.
|
| 1134 |
|
| 1135 | @param[in] ImageHandle Handle to the Image (NULL if Internal).
|
| 1136 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
| 1137 | **/
|
| 1138 | SHELL_STATUS
|
| 1139 | EFIAPI
|
| 1140 | ShellCommandRunDrvCfg (
|
| 1141 | IN EFI_HANDLE ImageHandle,
|
| 1142 | IN EFI_SYSTEM_TABLE *SystemTable
|
| 1143 | )
|
| 1144 | {
|
| 1145 | EFI_STATUS Status;
|
| 1146 | LIST_ENTRY *Package;
|
| 1147 | CHAR16 *ProblemParam;
|
| 1148 | SHELL_STATUS ShellStatus;
|
| 1149 | CHAR8 *Language;
|
| 1150 | CONST CHAR16 *Lang;
|
| 1151 | CONST CHAR16 *HandleIndex1;
|
| 1152 | CONST CHAR16 *HandleIndex2;
|
| 1153 | CONST CHAR16 *HandleIndex3;
|
| 1154 | CONST CHAR16 *ForceTypeString;
|
| 1155 | BOOLEAN Force;
|
| 1156 | BOOLEAN Set;
|
| 1157 | BOOLEAN Validate;
|
| 1158 | BOOLEAN InFromFile;
|
| 1159 | BOOLEAN OutToFile;
|
| 1160 | BOOLEAN AllChildren;
|
| 1161 | BOOLEAN UseHii;
|
| 1162 | UINT32 ForceType;
|
| 1163 | UINT64 Intermediate;
|
| 1164 | EFI_HANDLE Handle1;
|
| 1165 | EFI_HANDLE Handle2;
|
| 1166 | EFI_HANDLE Handle3;
|
| 1167 | CONST CHAR16 *FileName;
|
| 1168 |
|
| 1169 | ShellStatus = SHELL_SUCCESS;
|
| 1170 | Status = EFI_SUCCESS;
|
| 1171 | Language = NULL;
|
| 1172 | UseHii = TRUE;
|
| 1173 |
|
| 1174 | //
|
| 1175 | // initialize the shell lib (we must be in non-auto-init...)
|
| 1176 | //
|
| 1177 | Status = ShellInitialize();
|
| 1178 | ASSERT_EFI_ERROR(Status);
|
| 1179 |
|
| 1180 | Status = CommandInit();
|
| 1181 | ASSERT_EFI_ERROR(Status);
|
| 1182 |
|
| 1183 | //
|
| 1184 | // parse the command line
|
| 1185 | //
|
| 1186 | Status = ShellCommandLineParse (ParamListHii, &Package, &ProblemParam, TRUE);
|
| 1187 | if (EFI_ERROR(Status) || ShellCommandLineGetCount(Package) > 2) {
|
| 1188 | UseHii = FALSE;
|
| 1189 | if (Package != NULL) {
|
| 1190 | ShellCommandLineFreeVarList (Package);
|
| 1191 | }
|
| 1192 | SHELL_FREE_NON_NULL(ProblemParam);
|
| 1193 | Status = ShellCommandLineParse (ParamListPreHii, &Package, &ProblemParam, TRUE);
|
| 1194 | if (EFI_ERROR(Status)) {
|
| 1195 | if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
|
| 1196 | ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDriver1HiiHandle, L"drvcfg", ProblemParam);
|
| 1197 | FreePool(ProblemParam);
|
| 1198 | ShellStatus = SHELL_INVALID_PARAMETER;
|
| 1199 | goto Done;
|
| 1200 | } else {
|
| 1201 | ASSERT(FALSE);
|
| 1202 | }
|
| 1203 | }
|
| 1204 | }
|
| 1205 | if (ShellStatus == SHELL_SUCCESS) {
|
| 1206 | Lang = ShellCommandLineGetValue(Package, L"-l");
|
| 1207 | if (Lang != NULL) {
|
| 1208 | Language = AllocateZeroPool(StrSize(Lang));
|
| 1209 | AsciiSPrint(Language, StrSize(Lang), "%S", Lang);
|
| 1210 | } else if (ShellCommandLineGetFlag(Package, L"-l")){
|
| 1211 | ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDriver1HiiHandle, L"drvcfg", L"-l");
|
| 1212 | ShellStatus = SHELL_INVALID_PARAMETER;
|
| 1213 | goto Done;
|
| 1214 | }
|
| 1215 | Set = ShellCommandLineGetFlag (Package, L"-s");
|
| 1216 | Validate = ShellCommandLineGetFlag (Package, L"-v");
|
| 1217 | InFromFile = ShellCommandLineGetFlag (Package, L"-i");
|
| 1218 | OutToFile = ShellCommandLineGetFlag (Package, L"-o");
|
| 1219 | AllChildren = ShellCommandLineGetFlag (Package, L"-c");
|
| 1220 | Force = ShellCommandLineGetFlag (Package, L"-f");
|
| 1221 | ForceTypeString = ShellCommandLineGetValue(Package, L"-f");
|
| 1222 |
|
| 1223 | if (OutToFile) {
|
| 1224 | FileName = ShellCommandLineGetValue(Package, L"-o");
|
| 1225 | } else if (InFromFile) {
|
| 1226 | FileName = ShellCommandLineGetValue(Package, L"-i");
|
| 1227 | } else {
|
| 1228 | FileName = NULL;
|
| 1229 | }
|
| 1230 |
|
| 1231 | if (InFromFile && EFI_ERROR(ShellFileExists(FileName))) {
|
| 1232 | ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FIND_FAIL), gShellDriver1HiiHandle, L"drvcfg", FileName);
|
| 1233 | ShellStatus = SHELL_INVALID_PARAMETER;
|
| 1234 | goto Done;
|
| 1235 | }
|
| 1236 | if (OutToFile && !EFI_ERROR(ShellFileExists(FileName))) {
|
| 1237 | ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_EXIST), gShellDriver1HiiHandle, L"drvcfg", FileName);
|
| 1238 | ShellStatus = SHELL_INVALID_PARAMETER;
|
| 1239 | goto Done;
|
| 1240 | }
|
| 1241 | if (Force && ForceTypeString == NULL) {
|
| 1242 | ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDriver1HiiHandle, L"drvcfg", L"-f");
|
| 1243 | ShellStatus = SHELL_INVALID_PARAMETER;
|
| 1244 | goto Done;
|
| 1245 | }
|
| 1246 | if (Force) {
|
| 1247 | Status = ShellConvertStringToUint64(ForceTypeString, &Intermediate, FALSE, FALSE);
|
| 1248 | if (EFI_ERROR(Status)) {
|
| 1249 | ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_VAL), gShellDriver1HiiHandle, L"drvcfg", ForceTypeString, L"-f");
|
| 1250 | ShellStatus = SHELL_INVALID_PARAMETER;
|
| 1251 | goto Done;
|
| 1252 | }
|
| 1253 | ForceType = (UINT32)Intermediate;
|
| 1254 | } else {
|
| 1255 | ForceType = 0;
|
| 1256 | }
|
| 1257 | HandleIndex1 = ShellCommandLineGetRawValue(Package, 1);
|
| 1258 | Handle1 = NULL;
|
| 1259 | if (HandleIndex1 != NULL && !EFI_ERROR(ShellConvertStringToUint64(HandleIndex1, &Intermediate, TRUE, FALSE))) {
|
| 1260 | Handle1 = ConvertHandleIndexToHandle((UINTN)Intermediate);
|
| 1261 | if (Handle1 == NULL || (UINT64)(UINTN)Intermediate != Intermediate) {
|
| 1262 | ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"drvcfg", HandleIndex1);
|
| 1263 | ShellStatus = SHELL_INVALID_PARAMETER;
|
| 1264 | goto Done;
|
| 1265 | }
|
| 1266 | }
|
| 1267 | HandleIndex2 = ShellCommandLineGetRawValue(Package, 2);
|
| 1268 | Handle2 = NULL;
|
| 1269 | if (HandleIndex2 != NULL && !EFI_ERROR(ShellConvertStringToUint64(HandleIndex2, &Intermediate, TRUE, FALSE))) {
|
| 1270 | Handle2 = ConvertHandleIndexToHandle((UINTN)Intermediate);
|
| 1271 | if (Handle2 == NULL || (UINT64)(UINTN)Intermediate != Intermediate) {
|
| 1272 | ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"drvcfg", HandleIndex2);
|
| 1273 | ShellStatus = SHELL_INVALID_PARAMETER;
|
| 1274 | goto Done;
|
| 1275 | }
|
| 1276 | }
|
| 1277 | HandleIndex3 = ShellCommandLineGetRawValue(Package, 3);
|
| 1278 | Handle3 = NULL;
|
| 1279 | if (HandleIndex3 != NULL && !EFI_ERROR(ShellConvertStringToUint64(HandleIndex3, &Intermediate, TRUE, FALSE))) {
|
| 1280 | Handle3 = ConvertHandleIndexToHandle((UINTN)Intermediate);
|
| 1281 | if (Handle3 == NULL || (UINT64)(UINTN)Intermediate != Intermediate) {
|
| 1282 | ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"drvcfg", HandleIndex3);
|
| 1283 | ShellStatus = SHELL_INVALID_PARAMETER;
|
| 1284 | goto Done;
|
| 1285 | }
|
| 1286 | }
|
| 1287 |
|
| 1288 | if ((InFromFile || OutToFile) && (FileName == NULL)) {
|
| 1289 | if (FileName == NULL) {
|
| 1290 | ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDriver1HiiHandle, L"drvcfg", InFromFile?L"-i":L"-o");
|
| 1291 | } else {
|
| 1292 | ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_HANDLE_REQ), gShellDriver1HiiHandle, L"drvcfg");
|
| 1293 | }
|
| 1294 | ShellStatus = SHELL_INVALID_PARAMETER;
|
| 1295 | goto Done;
|
| 1296 | }
|
| 1297 | if (!UseHii && (InFromFile || OutToFile)) {
|
| 1298 | if (InFromFile) {
|
| 1299 | ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDriver1HiiHandle, L"drvcfg", L"-i");
|
| 1300 | ShellStatus = SHELL_INVALID_PARAMETER;
|
| 1301 | goto Done;
|
| 1302 | }
|
| 1303 | if (OutToFile) {
|
| 1304 | ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDriver1HiiHandle, L"drvcfg", L"-o");
|
| 1305 | ShellStatus = SHELL_INVALID_PARAMETER;
|
| 1306 | goto Done;
|
| 1307 | }
|
| 1308 | }
|
| 1309 | if (Validate && Force) {
|
| 1310 | ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CONFLICT), gShellDriver1HiiHandle, L"drvcfg", L"-v", L"-f");
|
| 1311 | ShellStatus = SHELL_INVALID_PARAMETER;
|
| 1312 | goto Done;
|
| 1313 | }
|
| 1314 | if (Validate && Set) {
|
| 1315 | ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CONFLICT), gShellDriver1HiiHandle, L"drvcfg", L"-v", L"-s");
|
| 1316 | ShellStatus = SHELL_INVALID_PARAMETER;
|
| 1317 | goto Done;
|
| 1318 | }
|
| 1319 | if (Set && Force) {
|
| 1320 | ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CONFLICT), gShellDriver1HiiHandle, L"drvcfg", L"-s", L"-f");
|
| 1321 | ShellStatus = SHELL_INVALID_PARAMETER;
|
| 1322 | goto Done;
|
| 1323 | }
|
| 1324 | if (OutToFile && InFromFile) {
|
| 1325 | ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CONFLICT), gShellDriver1HiiHandle, L"drvcfg", L"-i", L"-o");
|
| 1326 | ShellStatus = SHELL_INVALID_PARAMETER;
|
| 1327 | goto Done;
|
| 1328 | }
|
| 1329 |
|
| 1330 | //
|
| 1331 | // We do HII first.
|
| 1332 | //
|
| 1333 | if (UseHii) {
|
| 1334 | if (Handle1 != NULL && EFI_ERROR(gBS->OpenProtocol(Handle1, &gEfiHiiConfigAccessProtocolGuid, NULL, gImageHandle, NULL, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) {
|
| 1335 | //
|
| 1336 | // no HII on this handle.
|
| 1337 | //
|
| 1338 | ShellStatus = SHELL_UNSUPPORTED;
|
| 1339 | } else if (Validate) {
|
| 1340 | } else if (Force) {
|
| 1341 | } else if (Set) {
|
| 1342 | } else if (InFromFile) {
|
| 1343 | ShellStatus = ConfigFromFile(Handle1, FileName);
|
| 1344 | if (Handle1 != NULL && ShellStatus == SHELL_SUCCESS) {
|
| 1345 | goto Done;
|
| 1346 | }
|
| 1347 | } else if (OutToFile) {
|
| 1348 | ShellStatus = ConfigToFile(Handle1, FileName);
|
| 1349 | if (Handle1 != NULL && ShellStatus == SHELL_SUCCESS) {
|
| 1350 | goto Done;
|
| 1351 | }
|
| 1352 | } else if (HandleIndex1 == NULL) {
|
| 1353 | //
|
| 1354 | // display all that are configurable
|
| 1355 | //
|
| 1356 | ShellStatus = PrintConfigInfoOnAll(AllChildren, Language, UseHii);
|
| 1357 | goto Done;
|
| 1358 | } else {
|
| 1359 | if (!EFI_ERROR(gBS->OpenProtocol(Handle1, &gEfiHiiConfigAccessProtocolGuid, NULL, gImageHandle, NULL, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) {
|
| 1360 | ShellPrintHiiEx(
|
| 1361 | -1,
|
| 1362 | -1,
|
| 1363 | NULL,
|
| 1364 | STRING_TOKEN (STR_DRVCFG_LINE_HII),
|
| 1365 | gShellDriver1HiiHandle,
|
| 1366 | ConvertHandleToHandleIndex(Handle1)
|
| 1367 | );
|
| 1368 | goto Done;
|
| 1369 | }
|
| 1370 | }
|
| 1371 | }
|
| 1372 |
|
| 1373 | //
|
| 1374 | // We allways need to do this one since it does both by default.
|
| 1375 | //
|
| 1376 | if (!InFromFile && !OutToFile) {
|
| 1377 | ShellStatus = PreHiiDrvCfg (
|
| 1378 | Language,
|
| 1379 | Force,
|
| 1380 | ForceType,
|
| 1381 | AllChildren,
|
| 1382 | Validate,
|
| 1383 | Set,
|
| 1384 | Handle1,
|
| 1385 | Handle2,
|
| 1386 | Handle3);
|
| 1387 | }
|
| 1388 |
|
| 1389 | if (ShellStatus == SHELL_UNSUPPORTED) {
|
| 1390 | ShellPrintHiiEx(
|
| 1391 | -1,
|
| 1392 | -1,
|
| 1393 | NULL,
|
| 1394 | STRING_TOKEN (STR_DRVCFG_NOT_SUPPORT),
|
| 1395 | gShellDriver1HiiHandle,
|
| 1396 | ConvertHandleToHandleIndex(Handle1)
|
| 1397 | );
|
| 1398 | }
|
| 1399 | }
|
| 1400 |
|
| 1401 | Done:
|
| 1402 | ShellCommandLineFreeVarList (Package);
|
| 1403 | SHELL_FREE_NON_NULL(Language);
|
| 1404 | return (ShellStatus);
|
| 1405 | }
|