X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=ShellPkg%2FLibrary%2FUefiShellDriver1CommandsLib%2FDisconnect.c;h=a33bed9dc82aec5e2194aa8efd187672b014fc02;hb=c173a7b9d6f239e3a002f4e9c37db98a8f98f771;hp=d10ce56806487fe2832c66b8a97fb881a45bf57b;hpb=4ba49616416ad8ce57c61d0bb0a80c7b5dbf434b;p=mirror_edk2.git diff --git a/ShellPkg/Library/UefiShellDriver1CommandsLib/Disconnect.c b/ShellPkg/Library/UefiShellDriver1CommandsLib/Disconnect.c index d10ce56806..a33bed9dc8 100644 --- a/ShellPkg/Library/UefiShellDriver1CommandsLib/Disconnect.c +++ b/ShellPkg/Library/UefiShellDriver1CommandsLib/Disconnect.c @@ -1,7 +1,7 @@ /** @file Main file for Disconnect shell Driver1 function. - Copyright (c) 2010, Intel Corporation. All rights reserved.
+ Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.
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 @@ -19,6 +19,11 @@ STATIC CONST SHELL_PARAM_ITEM ParamList[] = { {NULL, TypeMax} }; +/** + Disconnect everything. + + @retval EFI_SUCCESS The operation was successful. +**/ EFI_STATUS EFIAPI DisconnectAll( @@ -67,6 +72,12 @@ DisconnectAll( return (EFI_SUCCESS); } +/** + Function for 'disconnect' command. + + @param[in] ImageHandle Handle to the Image (NULL if Internal). + @param[in] SystemTable Pointer to the System Table (NULL if Internal). +**/ SHELL_STATUS EFIAPI ShellCommandRunDisconnect ( @@ -84,6 +95,9 @@ ShellCommandRunDisconnect ( EFI_HANDLE Handle1; EFI_HANDLE Handle2; EFI_HANDLE Handle3; + UINT64 Intermediate1; + UINT64 Intermediate2; + UINT64 Intermediate3; ShellStatus = SHELL_SUCCESS; @@ -133,9 +147,12 @@ ShellCommandRunDisconnect ( Param1 = ShellCommandLineGetRawValue(Package, 1); Param2 = ShellCommandLineGetRawValue(Package, 2); Param3 = ShellCommandLineGetRawValue(Package, 3); - Handle1 = Param1!=NULL?ConvertHandleIndexToHandle(StrHexToUintn(Param1)):NULL; - Handle2 = Param2!=NULL?ConvertHandleIndexToHandle(StrHexToUintn(Param2)):NULL; - Handle3 = Param3!=NULL?ConvertHandleIndexToHandle(StrHexToUintn(Param3)):NULL; + ShellConvertStringToUint64(Param1, &Intermediate1, TRUE, FALSE); + Handle1 = Param1!=NULL?ConvertHandleIndexToHandle((UINTN)Intermediate1):NULL; + ShellConvertStringToUint64(Param2, &Intermediate2, TRUE, FALSE); + Handle2 = Param2!=NULL?ConvertHandleIndexToHandle((UINTN)Intermediate2):NULL; + ShellConvertStringToUint64(Param3, &Intermediate3, TRUE, FALSE); + Handle3 = Param3!=NULL?ConvertHandleIndexToHandle((UINTN)Intermediate3):NULL; if (Param1 != NULL && Handle1 == NULL) { ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, Param1); @@ -146,20 +163,14 @@ ShellCommandRunDisconnect ( } else if (Param3 != NULL && Handle3 == NULL) { ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, Param3); ShellStatus = SHELL_INVALID_PARAMETER; - } else if (EFI_ERROR(gBS->OpenProtocol(Handle1, &gEfiDevicePathProtocolGuid, NULL, gImageHandle, NULL, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) { - ASSERT(Param1 != NULL); - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_HANDLE_NOT), gShellDriver1HiiHandle, StrHexToUintn(Param1), L"controller handle"); - ShellStatus = SHELL_INVALID_PARAMETER; } else if (Handle2 != NULL && EFI_ERROR(gBS->OpenProtocol(Handle2, &gEfiDriverBindingProtocolGuid, NULL, gImageHandle, NULL, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) { ASSERT(Param2 != NULL); - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_HANDLE_NOT), gShellDriver1HiiHandle, StrHexToUintn(Param2), L"driver handle"); + ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_HANDLE_NOT), gShellDriver1HiiHandle, ShellStrToUintn(Param2), L"driver handle"); ShellStatus = SHELL_INVALID_PARAMETER; } else { ASSERT(Param1 != NULL); - ASSERT(Param2 != NULL); - ASSERT(Param3 != NULL); Status = gBS->DisconnectController(Handle1, Handle2, Handle3); - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_3P_RESULT), gShellDriver1HiiHandle, L"Disconnect", Handle1, Handle2, Handle3, Status); + ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_3P_RESULT), gShellDriver1HiiHandle, L"Disconnect", (UINTN)Intermediate1, (UINTN)Intermediate2, (UINTN)Intermediate3, Status); } } }