1 /** @file 2 Main file for Reconnect shell Driver1 function. 3 4 Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR> 5 (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR> 6 (C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR> 7 This program and the accompanying materials 8 are licensed and made available under the terms and conditions of the BSD License 9 which accompanies this distribution. The full text of the license may be found at 10 http://opensource.org/licenses/bsd-license.php 11 12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 14 15 **/ 16 17 #include "UefiShellDriver1CommandsLib.h" 18 19 STATIC CONST SHELL_PARAM_ITEM ParamList[] = { 20 {L"-r", TypeFlag}, 21 {NULL, TypeMax} 22 }; 23 24 /** 25 Connect all the possible console devices. 26 27 **/ 28 VOID 29 ConnectAllConsoles ( 30 VOID 31 ) 32 { 33 ShellConnectFromDevPaths(L"ConInDev"); 34 ShellConnectFromDevPaths(L"ConOutDev"); 35 ShellConnectFromDevPaths(L"ErrOutDev"); 36 37 ShellConnectFromDevPaths(L"ErrOut"); 38 ShellConnectFromDevPaths(L"ConIn"); 39 ShellConnectFromDevPaths(L"ConOut"); 40 } 41 42 43 /** 44 Function for 'reconnect' command. 45 46 @param[in] ImageHandle Handle to the Image (NULL if Internal). 47 @param[in] SystemTable Pointer to the System Table (NULL if Internal). 48 **/ 49 SHELL_STATUS 50 EFIAPI 51 ShellCommandRunReconnect ( 52 IN EFI_HANDLE ImageHandle, 53 IN EFI_SYSTEM_TABLE *SystemTable 54 ) 55 { 56 SHELL_STATUS ShellStatus; 57 LIST_ENTRY *Package; 58 CHAR16 *ProblemParam; 59 EFI_STATUS Status; 60 61 gInReconnect = TRUE; 62 ShellStatus = SHELL_SUCCESS; 63 64 // 65 // initialize the shell lib (we must be in non-auto-init...) 66 // 67 Status = ShellInitialize(); 68 ASSERT_EFI_ERROR(Status); 69 70 Status = CommandInit(); 71 ASSERT_EFI_ERROR(Status); 72 73 // 74 // parse the command line 75 // 76 Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE); 77 if (EFI_ERROR(Status)) { 78 if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { 79 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDriver1HiiHandle, L"reconnect", ProblemParam); 80 FreePool(ProblemParam); 81 ShellStatus = SHELL_INVALID_PARAMETER; 82 } else { 83 ASSERT(FALSE); 84 } 85 } else { 86 ShellStatus = ShellCommandRunDisconnect(ImageHandle, SystemTable); 87 if (ShellStatus == SHELL_SUCCESS) { 88 if (ShellCommandLineGetFlag(Package, L"-r")) { 89 ConnectAllConsoles(); 90 } 91 ShellStatus = ShellCommandRunConnect(ImageHandle, SystemTable); 92 } 93 } 94 95 gInReconnect = FALSE; 96 97 return (ShellStatus); 98 } 99 100