ShellPkg: Clean up source files
1. Do not use tab characters 2. No trailing white space in one line 3. All files must end with CRLF Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
Main file for connect shell Driver1 function.
|
||||
|
||||
(C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
|
||||
Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@ -36,16 +36,16 @@ ShellConnectDevicePath (
|
||||
EFI_STATUS Status;
|
||||
EFI_HANDLE Handle;
|
||||
EFI_HANDLE PreviousHandle;
|
||||
|
||||
|
||||
if (DevicePathToConnect == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
PreviousHandle = NULL;
|
||||
do{
|
||||
do{
|
||||
RemainingDevicePath = DevicePathToConnect;
|
||||
Status = gBS->LocateDevicePath (&gEfiDevicePathProtocolGuid, &RemainingDevicePath, &Handle);
|
||||
|
||||
|
||||
if (!EFI_ERROR (Status) && (Handle != NULL)) {
|
||||
if (PreviousHandle == Handle) {
|
||||
Status = EFI_NOT_FOUND;
|
||||
@ -54,16 +54,16 @@ ShellConnectDevicePath (
|
||||
Status = gBS->ConnectController (Handle, NULL, RemainingDevicePath, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} while (!EFI_ERROR (Status) && !IsDevicePathEnd (RemainingDevicePath) );
|
||||
|
||||
|
||||
return Status;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
Connect drivers for PCI root bridge.
|
||||
|
||||
|
||||
@retval EFI_SUCCESS Connect drivers successfully.
|
||||
@retval EFI_NOT_FOUND Cannot find PCI root bridge device.
|
||||
|
||||
@ -72,31 +72,31 @@ EFI_STATUS
|
||||
ShellConnectPciRootBridge (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
{
|
||||
UINTN RootBridgeHandleCount;
|
||||
EFI_HANDLE *RootBridgeHandleBuffer;
|
||||
UINTN RootBridgeIndex;
|
||||
EFI_STATUS Status;
|
||||
|
||||
|
||||
RootBridgeHandleCount = 0;
|
||||
|
||||
Status = gBS->LocateHandleBuffer (
|
||||
ByProtocol,
|
||||
&gEfiPciRootBridgeIoProtocolGuid,
|
||||
NULL,
|
||||
&RootBridgeHandleCount,
|
||||
&RootBridgeHandleBuffer
|
||||
|
||||
Status = gBS->LocateHandleBuffer (
|
||||
ByProtocol,
|
||||
&gEfiPciRootBridgeIoProtocolGuid,
|
||||
NULL,
|
||||
&RootBridgeHandleCount,
|
||||
&RootBridgeHandleBuffer
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
for (RootBridgeIndex = 0; RootBridgeIndex < RootBridgeHandleCount; RootBridgeIndex++) {
|
||||
gBS->ConnectController (RootBridgeHandleBuffer[RootBridgeIndex], NULL, NULL, FALSE);
|
||||
}
|
||||
|
||||
for (RootBridgeIndex = 0; RootBridgeIndex < RootBridgeHandleCount; RootBridgeIndex++) {
|
||||
gBS->ConnectController (RootBridgeHandleBuffer[RootBridgeIndex], NULL, NULL, FALSE);
|
||||
}
|
||||
|
||||
FreePool (RootBridgeHandleBuffer);
|
||||
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
@ -199,7 +199,7 @@ ShellConnectFromDevPaths (
|
||||
{
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevPath;
|
||||
EFI_DEVICE_PATH_PROTOCOL *CopyOfDevPath;
|
||||
EFI_DEVICE_PATH_PROTOCOL *Instance;
|
||||
EFI_DEVICE_PATH_PROTOCOL *Instance;
|
||||
EFI_DEVICE_PATH_PROTOCOL *Next;
|
||||
UINTN Length;
|
||||
UINTN Index;
|
||||
@ -210,7 +210,7 @@ ShellConnectFromDevPaths (
|
||||
BOOLEAN AtLeastOneConnected;
|
||||
EFI_PCI_IO_PROTOCOL *PciIo;
|
||||
UINT8 Class[3];
|
||||
|
||||
|
||||
DevPath = NULL;
|
||||
Length = 0;
|
||||
AtLeastOneConnected = FALSE;
|
||||
@ -266,14 +266,14 @@ ShellConnectFromDevPaths (
|
||||
((DevicePathSubType (Instance) == MSG_USB_CLASS_DP)
|
||||
|| (DevicePathSubType (Instance) == MSG_USB_WWID_DP)
|
||||
)) {
|
||||
|
||||
|
||||
Status = ShellConnectPciRootBridge ();
|
||||
if (EFI_ERROR(Status)) {
|
||||
FreePool(Instance);
|
||||
FreePool(DevPath);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
Status = gBS->LocateHandleBuffer (
|
||||
ByProtocol,
|
||||
&gEfiPciIoProtocolGuid,
|
||||
@ -281,7 +281,7 @@ ShellConnectFromDevPaths (
|
||||
&HandleArrayCount,
|
||||
&HandleArray
|
||||
);
|
||||
|
||||
|
||||
if (!EFI_ERROR (Status)) {
|
||||
for (Index = 0; Index < HandleArrayCount; Index++) {
|
||||
Status = gBS->HandleProtocol (
|
||||
@ -289,7 +289,7 @@ ShellConnectFromDevPaths (
|
||||
&gEfiPciIoProtocolGuid,
|
||||
(VOID **)&PciIo
|
||||
);
|
||||
|
||||
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Status = PciIo->Pci.Read (PciIo, EfiPciIoWidthUint8, 0x09, 3, &Class);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
@ -313,7 +313,7 @@ ShellConnectFromDevPaths (
|
||||
if (HandleArray != NULL) {
|
||||
FreePool (HandleArray);
|
||||
}
|
||||
} else {
|
||||
} else {
|
||||
//
|
||||
// connect the entire device path
|
||||
//
|
||||
@ -323,9 +323,9 @@ ShellConnectFromDevPaths (
|
||||
}
|
||||
}
|
||||
FreePool (Instance);
|
||||
|
||||
|
||||
} while (CopyOfDevPath != NULL);
|
||||
|
||||
|
||||
if (DevPath != NULL) {
|
||||
FreePool(DevPath);
|
||||
}
|
||||
@ -335,7 +335,7 @@ ShellConnectFromDevPaths (
|
||||
} else {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -437,7 +437,7 @@ ShellCommandRunConnect (
|
||||
Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);
|
||||
if (EFI_ERROR(Status)) {
|
||||
if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDriver1HiiHandle, L"connect", ProblemParam);
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDriver1HiiHandle, L"connect", ProblemParam);
|
||||
FreePool(ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
@ -456,7 +456,7 @@ ShellCommandRunConnect (
|
||||
//
|
||||
// error for too many parameters
|
||||
//
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDriver1HiiHandle, L"connect");
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDriver1HiiHandle, L"connect");
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else if (ShellCommandLineGetFlag(Package, L"-c")) {
|
||||
//
|
||||
@ -504,7 +504,7 @@ ShellCommandRunConnect (
|
||||
Status = ShellConvertStringToUint64(Param1, &Intermediate, TRUE, FALSE);
|
||||
Handle1 = ConvertHandleIndexToHandle((UINTN)Intermediate);
|
||||
if (EFI_ERROR(Status)) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"connect", Param1);
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"connect", Param1);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
}
|
||||
} else {
|
||||
@ -515,22 +515,22 @@ ShellCommandRunConnect (
|
||||
Status = ShellConvertStringToUint64(Param2, &Intermediate, TRUE, FALSE);
|
||||
Handle2 = ConvertHandleIndexToHandle((UINTN)Intermediate);
|
||||
if (EFI_ERROR(Status)) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"connect", Param2);
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"connect", Param2);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
}
|
||||
} else {
|
||||
Handle2 = NULL;
|
||||
}
|
||||
|
||||
|
||||
if (ShellStatus == SHELL_SUCCESS) {
|
||||
if (Param1 != NULL && Handle1 == NULL){
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"connect", Param1);
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"connect", Param1);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else if (Param2 != NULL && Handle2 == NULL) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"connect", Param2);
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"connect", Param2);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else if (Handle2 != NULL && Handle1 != NULL && EFI_ERROR(gBS->OpenProtocol(Handle2, &gEfiDriverBindingProtocolGuid, NULL, gImageHandle, NULL, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"connect", Param2);
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"connect", Param2);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
Status = ConvertAndConnectControllers(Handle1, Handle2, ShellCommandLineGetFlag(Package, L"-r"), (BOOLEAN)(Count!=0));
|
||||
|
Reference in New Issue
Block a user