connect - add comments and add input verification
devices - add comments and add input verification devtree - add comments and add input verification dh - add comments, add input verification, add support for "-d" disconnect - add comments and add input verification drivers - add comments drvcfg - add comment drvdiag - add comments, add input verification, and fix language use openinfo - add comments and add input verification reconnect - add comment unload - add input verification. main library files: add comments, #define protection, and more output to the user. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11434 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Main file for connect shell Driver1 function.
|
Main file for connect shell Driver1 function.
|
||||||
|
|
||||||
Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -15,6 +15,15 @@
|
|||||||
#include "UefiShellDriver1CommandsLib.h"
|
#include "UefiShellDriver1CommandsLib.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Connect controller(s) and driver(s).
|
||||||
|
|
||||||
|
@param[in] ControllerHandle The handle to the controller. Should have driver binding on it.
|
||||||
|
@param[in] DriverHandle The handle to the driver. Should have driver binding.
|
||||||
|
@param[in] Recursive TRUE to connect recursively, FALSE otherwise.
|
||||||
|
@param[in] Output TRUE to have info on the screen, FALSE otherwise.
|
||||||
|
@param[in] AlwaysOutput Override Output for errors.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS The operation was successful.
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
@ -42,7 +51,7 @@ ConnectControllers (
|
|||||||
if (DriverHandle == NULL) {
|
if (DriverHandle == NULL) {
|
||||||
DriverHandleList = NULL;
|
DriverHandleList = NULL;
|
||||||
} else {
|
} else {
|
||||||
DriverHandleList = AllocatePool(2*sizeof(EFI_HANDLE));
|
DriverHandleList = AllocateZeroPool(2*sizeof(EFI_HANDLE));
|
||||||
if (DriverHandleList == NULL) {
|
if (DriverHandleList == NULL) {
|
||||||
return (EFI_OUT_OF_RESOURCES);
|
return (EFI_OUT_OF_RESOURCES);
|
||||||
}
|
}
|
||||||
@ -90,6 +99,13 @@ ConnectControllers (
|
|||||||
return (Status2);
|
return (Status2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Do a connect from an EFI variable via it's key name.
|
||||||
|
|
||||||
|
@param[in] Key The name of the EFI Variable.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS The operation was successful.
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
ConnectFromDevPaths (
|
ConnectFromDevPaths (
|
||||||
@ -110,7 +126,7 @@ ConnectFromDevPaths (
|
|||||||
//
|
//
|
||||||
Status = gRT->GetVariable((CHAR16*)Key, (EFI_GUID*)&gEfiGlobalVariableGuid, NULL, &Length, DevPath);
|
Status = gRT->GetVariable((CHAR16*)Key, (EFI_GUID*)&gEfiGlobalVariableGuid, NULL, &Length, DevPath);
|
||||||
if (Status == EFI_BUFFER_TOO_SMALL) {
|
if (Status == EFI_BUFFER_TOO_SMALL) {
|
||||||
DevPath = AllocatePool(Length);
|
DevPath = AllocateZeroPool(Length);
|
||||||
Status = gRT->GetVariable((CHAR16*)Key, (EFI_GUID*)&gEfiGlobalVariableGuid, NULL, &Length, DevPath);
|
Status = gRT->GetVariable((CHAR16*)Key, (EFI_GUID*)&gEfiGlobalVariableGuid, NULL, &Length, DevPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,32 +166,27 @@ ConnectFromDevPaths (
|
|||||||
return (Status);
|
return (Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Convert the handle identifiers from strings and then connect them.
|
||||||
|
|
||||||
|
One of them should have driver binding and either can be NULL.
|
||||||
|
|
||||||
|
@param[in] Handle1 The first handle.
|
||||||
|
@param[in] Handle2 The second handle.
|
||||||
|
@param[in] Recursive TRUE to do connect recursively. FALSE otherwise.
|
||||||
|
@param[in] Output TRUE to have output to screen. FALSE otherwise.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS The operation was successful.
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
ConvertAndConnectControllers (
|
ConvertAndConnectControllers (
|
||||||
IN CONST CHAR16 *StringHandle1 OPTIONAL,
|
IN EFI_HANDLE *Handle1 OPTIONAL,
|
||||||
IN CONST CHAR16 *StringHandle2 OPTIONAL,
|
IN EFI_HANDLE *Handle2 OPTIONAL,
|
||||||
IN CONST BOOLEAN Recursive,
|
IN CONST BOOLEAN Recursive,
|
||||||
IN CONST BOOLEAN Output
|
IN CONST BOOLEAN Output
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_HANDLE Handle1;
|
|
||||||
EFI_HANDLE Handle2;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Convert the command line parameters to HANDLES. They must be in HEX according to spec.
|
|
||||||
//
|
|
||||||
if (StringHandle1 != NULL) {
|
|
||||||
Handle1 = ConvertHandleIndexToHandle(StrHexToUintn(StringHandle1));
|
|
||||||
} else {
|
|
||||||
Handle1 = NULL;
|
|
||||||
}
|
|
||||||
if (StringHandle2 != NULL) {
|
|
||||||
Handle2 = ConvertHandleIndexToHandle(StrHexToUintn(StringHandle2));
|
|
||||||
} else {
|
|
||||||
Handle2 = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// if only one is NULL verify it's the proper one...
|
// if only one is NULL verify it's the proper one...
|
||||||
//
|
//
|
||||||
@ -206,7 +217,7 @@ ConvertAndConnectControllers (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (ConnectControllers(Handle1, Handle2, Recursive, Output, FALSE));
|
return (ConnectControllers(Handle1, Handle2, Recursive, Output, (BOOLEAN)(Handle2 != NULL && Handle1 != NULL)));
|
||||||
}
|
}
|
||||||
|
|
||||||
STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
|
STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
|
||||||
@ -235,6 +246,9 @@ ShellCommandRunConnect (
|
|||||||
CONST CHAR16 *Param1;
|
CONST CHAR16 *Param1;
|
||||||
CONST CHAR16 *Param2;
|
CONST CHAR16 *Param2;
|
||||||
UINTN Count;
|
UINTN Count;
|
||||||
|
EFI_HANDLE Handle1;
|
||||||
|
EFI_HANDLE Handle2;
|
||||||
|
UINT64 Intermediate;
|
||||||
|
|
||||||
ShellStatus = SHELL_SUCCESS;
|
ShellStatus = SHELL_SUCCESS;
|
||||||
|
|
||||||
@ -310,19 +324,36 @@ ShellCommandRunConnect (
|
|||||||
//
|
//
|
||||||
// 0, 1, or 2 specific handles and possibly recursive
|
// 0, 1, or 2 specific handles and possibly recursive
|
||||||
//
|
//
|
||||||
Param1 = ShellCommandLineGetRawValue(Package, 1);
|
Param1 = ShellCommandLineGetRawValue(Package, 1);
|
||||||
Param2 = ShellCommandLineGetRawValue(Package, 2);
|
Param2 = ShellCommandLineGetRawValue(Package, 2);
|
||||||
Count = ShellCommandLineGetCount(Package);
|
Count = ShellCommandLineGetCount(Package);
|
||||||
if (Param1 != NULL && ConvertHandleIndexToHandle(StrHexToUintn(Param1)) == NULL){
|
|
||||||
|
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, Param1);
|
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, Param1);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
} else if (Param2 != NULL && ConvertHandleIndexToHandle(StrHexToUintn(Param2)) == NULL) {
|
}
|
||||||
|
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, Param2);
|
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, Param2);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
} else {
|
}
|
||||||
Status = ConvertAndConnectControllers(Param1, Param2, ShellCommandLineGetFlag(Package, L"-r"), (BOOLEAN)(Count!=0));
|
|
||||||
if (EFI_ERROR(Status)) {
|
if (ShellStatus == SHELL_SUCCESS) {
|
||||||
ShellStatus = SHELL_DEVICE_ERROR;
|
if (Param1 != NULL && Handle1 == NULL){
|
||||||
|
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, Param1);
|
||||||
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
|
} else if (Param2 != NULL && Handle2 == NULL) {
|
||||||
|
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, Param2);
|
||||||
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
|
} else {
|
||||||
|
Status = ConvertAndConnectControllers(Handle1, Handle2, ShellCommandLineGetFlag(Package, L"-r"), (BOOLEAN)(Count!=0));
|
||||||
|
if (EFI_ERROR(Status)) {
|
||||||
|
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_CONNECT_NONE), gShellDriver1HiiHandle);
|
||||||
|
ShellStatus = SHELL_DEVICE_ERROR;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Main file for DevTree shell Driver1 function.
|
Main file for DevTree shell Driver1 function.
|
||||||
|
|
||||||
Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -20,6 +20,18 @@ STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
|
|||||||
{NULL, TypeMax}
|
{NULL, TypeMax}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
Display a tree starting from this handle.
|
||||||
|
|
||||||
|
@param[in] TheHandle The handle to start with.
|
||||||
|
@param[in] Lang Optionally, a UEFI defined language code.
|
||||||
|
@param[in] UseDevPaths TRUE to display info from DevPath as identifiers.
|
||||||
|
FALSE will use component name protocol instead.
|
||||||
|
@param[in] IndentCharCount How many characters to indent (allows for recursion).
|
||||||
|
@param[in] HiiString The string from HII to use for output.
|
||||||
|
|
||||||
|
@retval SHELL_SUCCESS The operation was successful.
|
||||||
|
**/
|
||||||
SHELL_STATUS
|
SHELL_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
DoDevTreeForHandle(
|
DoDevTreeForHandle(
|
||||||
@ -156,6 +168,7 @@ ShellCommandRunDevTree (
|
|||||||
UINTN LoopVar;
|
UINTN LoopVar;
|
||||||
EFI_HANDLE TheHandle;
|
EFI_HANDLE TheHandle;
|
||||||
BOOLEAN FlagD;
|
BOOLEAN FlagD;
|
||||||
|
UINT64 Intermediate;
|
||||||
|
|
||||||
ShellStatus = SHELL_SUCCESS;
|
ShellStatus = SHELL_SUCCESS;
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
@ -216,11 +229,12 @@ ShellCommandRunDevTree (
|
|||||||
ShellStatus = DoDevTreeForHandle(TheHandle, Language, FlagD, 0, HiiString);
|
ShellStatus = DoDevTreeForHandle(TheHandle, Language, FlagD, 0, HiiString);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!ShellIsHexOrDecimalNumber(Lang, TRUE, FALSE) || ConvertHandleIndexToHandle(StrHexToUintn(Lang)) == NULL) {
|
Status = ShellConvertStringToUint64(Lang, &Intermediate, TRUE, FALSE);
|
||||||
|
if (EFI_ERROR(Status) || ConvertHandleIndexToHandle((UINTN)Intermediate) == NULL) {
|
||||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, Lang);
|
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, Lang);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
} else {
|
} else {
|
||||||
ShellStatus = DoDevTreeForHandle(ConvertHandleIndexToHandle(StrHexToUintn(Lang)), Language, FlagD, 0, HiiString);
|
ShellStatus = DoDevTreeForHandle(ConvertHandleIndexToHandle((UINTN)Intermediate), Language, FlagD, 0, HiiString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Main file for devices shell Driver1 function.
|
Main file for devices shell Driver1 function.
|
||||||
|
|
||||||
Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -14,16 +14,42 @@
|
|||||||
|
|
||||||
#include "UefiShellDriver1CommandsLib.h"
|
#include "UefiShellDriver1CommandsLib.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
Get lots of info about a device from its handle.
|
||||||
|
|
||||||
|
@param[in] TheHandle The device handle to get info on.
|
||||||
|
@param[in,out] Type On successful return R, B, or D (root, bus, or
|
||||||
|
device) will be placed in this buffer.
|
||||||
|
@param[in,out] Cfg On successful return this buffer will be
|
||||||
|
TRUE if the handle has configuration, FALSE
|
||||||
|
otherwise.
|
||||||
|
@param[in,out] Diag On successful return this buffer will be
|
||||||
|
TRUE if the handle has disgnostics, FALSE
|
||||||
|
otherwise.
|
||||||
|
@param[in,out] Parents On successful return this buffer will be
|
||||||
|
contain the number of parent handles.
|
||||||
|
@param[in,out] Devices On successful return this buffer will be
|
||||||
|
contain the number of devices controlled.
|
||||||
|
@param[in,out] Children On successful return this buffer will be
|
||||||
|
contain the number of child handles.
|
||||||
|
@param[out] Name The pointer to a buffer that will be allocated
|
||||||
|
and contain the string name of the handle.
|
||||||
|
The caller must free this memory.
|
||||||
|
@param[in] Language The language code as defined by the UEFI spec.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS The info is there.
|
||||||
|
@retval EFI_INVALID_PARAMETER A parameter was invalid.
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
GetDeviceHandleInfo (
|
GetDeviceHandleInfo (
|
||||||
IN EFI_HANDLE TheHandle,
|
IN EFI_HANDLE TheHandle,
|
||||||
IN CHAR16 *Type,
|
IN OUT CHAR16 *Type,
|
||||||
IN BOOLEAN *Cfg,
|
IN OUT BOOLEAN *Cfg,
|
||||||
IN BOOLEAN *Diag,
|
IN OUT BOOLEAN *Diag,
|
||||||
IN UINTN *Parents,
|
IN OUT UINTN *Parents,
|
||||||
IN UINTN *Devices,
|
IN OUT UINTN *Devices,
|
||||||
IN UINTN *Children,
|
IN OUT UINTN *Children,
|
||||||
OUT CHAR16 **Name,
|
OUT CHAR16 **Name,
|
||||||
IN CONST CHAR8 *Language
|
IN CONST CHAR8 *Language
|
||||||
)
|
)
|
||||||
@ -32,6 +58,8 @@ GetDeviceHandleInfo (
|
|||||||
EFI_HANDLE *HandleBuffer;
|
EFI_HANDLE *HandleBuffer;
|
||||||
UINTN Count;
|
UINTN Count;
|
||||||
|
|
||||||
|
UINTN TestHandle = 0x43;
|
||||||
|
|
||||||
if (TheHandle == NULL
|
if (TheHandle == NULL
|
||||||
|| Type == NULL
|
|| Type == NULL
|
||||||
|| Cfg == NULL
|
|| Cfg == NULL
|
||||||
@ -43,6 +71,10 @@ GetDeviceHandleInfo (
|
|||||||
return (EFI_INVALID_PARAMETER);
|
return (EFI_INVALID_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ConvertHandleToHandleIndex(TheHandle) == TestHandle) {
|
||||||
|
TestHandle = TestHandle;
|
||||||
|
}
|
||||||
|
|
||||||
*Cfg = FALSE;
|
*Cfg = FALSE;
|
||||||
*Diag = FALSE;
|
*Diag = FALSE;
|
||||||
*Children = 0;
|
*Children = 0;
|
||||||
@ -56,7 +88,7 @@ GetDeviceHandleInfo (
|
|||||||
gEfiShellProtocol->GetDeviceName(TheHandle, EFI_DEVICE_NAME_USE_COMPONENT_NAME|EFI_DEVICE_NAME_USE_DEVICE_PATH, (CHAR8*)Language, Name);
|
gEfiShellProtocol->GetDeviceName(TheHandle, EFI_DEVICE_NAME_USE_COMPONENT_NAME|EFI_DEVICE_NAME_USE_DEVICE_PATH, (CHAR8*)Language, Name);
|
||||||
|
|
||||||
Status = ParseHandleDatabaseForChildControllers(TheHandle, Children, NULL);
|
Status = ParseHandleDatabaseForChildControllers(TheHandle, Children, NULL);
|
||||||
if (!EFI_ERROR(Status)) {
|
// if (!EFI_ERROR(Status)) {
|
||||||
Status = PARSE_HANDLE_DATABASE_PARENTS(TheHandle, Parents, NULL);
|
Status = PARSE_HANDLE_DATABASE_PARENTS(TheHandle, Parents, NULL);
|
||||||
if (/*!EFI_ERROR(Status) && */Parents != NULL && Children != NULL) {
|
if (/*!EFI_ERROR(Status) && */Parents != NULL && Children != NULL) {
|
||||||
if (*Parents == 0) {
|
if (*Parents == 0) {
|
||||||
@ -67,7 +99,7 @@ GetDeviceHandleInfo (
|
|||||||
*Type = L'D';
|
*Type = L'D';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
// }
|
||||||
Status = PARSE_HANDLE_DATABASE_UEFI_DRIVERS(TheHandle, Devices, &HandleBuffer);
|
Status = PARSE_HANDLE_DATABASE_UEFI_DRIVERS(TheHandle, Devices, &HandleBuffer);
|
||||||
if (!EFI_ERROR(Status) && Devices != NULL && HandleBuffer != NULL) {
|
if (!EFI_ERROR(Status) && Devices != NULL && HandleBuffer != NULL) {
|
||||||
for (Count = 0 ; Count < *Devices ; Count++) {
|
for (Count = 0 ; Count < *Devices ; Count++) {
|
||||||
@ -195,7 +227,7 @@ ShellCommandRunDevices (
|
|||||||
//
|
//
|
||||||
Name = NULL;
|
Name = NULL;
|
||||||
Status = GetDeviceHandleInfo(*HandleListWalker, &Type, &Cfg, &Diag, &Parents, &Devices, &Children, &Name, Language);
|
Status = GetDeviceHandleInfo(*HandleListWalker, &Type, &Cfg, &Diag, &Parents, &Devices, &Children, &Name, Language);
|
||||||
if (Parents != 0 || Devices != 0 || Children != 0) {
|
if (Name != NULL && (Parents != 0 || Devices != 0 || Children != 0)) {
|
||||||
ShellPrintHiiEx(
|
ShellPrintHiiEx(
|
||||||
-1,
|
-1,
|
||||||
-1,
|
-1,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Main file for Dh shell Driver1 function.
|
Main file for Dh shell Driver1 function.
|
||||||
|
|
||||||
Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -40,6 +40,88 @@ STATIC CONST EFI_GUID *UefiDriverModelProtocolsGuidArray[] = {
|
|||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
Get the name of a driver by it's handle.
|
||||||
|
|
||||||
|
If a name is found the memory must be callee freed.
|
||||||
|
|
||||||
|
@param[in] TheHandle The driver's handle.
|
||||||
|
@param[in] Language The language to use.
|
||||||
|
@param[in] NameFound Upon a successful return the name found.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS The name was found.
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
GetDriverName (
|
||||||
|
IN EFI_HANDLE TheHandle,
|
||||||
|
IN CONST CHAR8 *Language,
|
||||||
|
IN CHAR16 **NameFound
|
||||||
|
)
|
||||||
|
{
|
||||||
|
CHAR8 *Lang;
|
||||||
|
CHAR8 *TempChar;
|
||||||
|
EFI_STATUS Status;
|
||||||
|
EFI_COMPONENT_NAME2_PROTOCOL *CompName2;
|
||||||
|
CHAR16 *NameToReturn;
|
||||||
|
//
|
||||||
|
// Go through those handles until we get one that passes for GetComponentName
|
||||||
|
//
|
||||||
|
Status = gBS->OpenProtocol(
|
||||||
|
TheHandle,
|
||||||
|
&gEfiComponentName2ProtocolGuid,
|
||||||
|
(VOID**)&CompName2,
|
||||||
|
gImageHandle,
|
||||||
|
NULL,
|
||||||
|
EFI_OPEN_PROTOCOL_GET_PROTOCOL);
|
||||||
|
if (EFI_ERROR(Status)) {
|
||||||
|
Status = gBS->OpenProtocol(
|
||||||
|
TheHandle,
|
||||||
|
&gEfiComponentNameProtocolGuid,
|
||||||
|
(VOID**)&CompName2,
|
||||||
|
gImageHandle,
|
||||||
|
NULL,
|
||||||
|
EFI_OPEN_PROTOCOL_GET_PROTOCOL);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (EFI_ERROR(Status)) {
|
||||||
|
return (EFI_NOT_FOUND);
|
||||||
|
}
|
||||||
|
if (Language == NULL) {
|
||||||
|
Lang = AllocateZeroPool(AsciiStrSize(CompName2->SupportedLanguages));
|
||||||
|
if (Lang == NULL) {
|
||||||
|
return (EFI_OUT_OF_RESOURCES);
|
||||||
|
}
|
||||||
|
AsciiStrCpy(Lang, CompName2->SupportedLanguages);
|
||||||
|
TempChar = AsciiStrStr(Lang, ";");
|
||||||
|
if (TempChar != NULL){
|
||||||
|
*TempChar = CHAR_NULL;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Lang = AllocateZeroPool(AsciiStrSize(Language));
|
||||||
|
if (Lang == NULL) {
|
||||||
|
return (EFI_OUT_OF_RESOURCES);
|
||||||
|
}
|
||||||
|
AsciiStrCpy(Lang, Language);
|
||||||
|
}
|
||||||
|
Status = CompName2->GetDriverName(CompName2, Lang, &NameToReturn);
|
||||||
|
FreePool(Lang);
|
||||||
|
|
||||||
|
if (!EFI_ERROR(Status) && NameToReturn != NULL) {
|
||||||
|
*NameFound = NULL;
|
||||||
|
StrnCatGrow(NameFound, NULL, NameToReturn, 0);
|
||||||
|
}
|
||||||
|
return (Status);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Discover if a protocol guid is one of the UEFI Driver Model Protocols.
|
||||||
|
|
||||||
|
@param[in] Guid The guid to test.
|
||||||
|
|
||||||
|
@retval TRUE The guid does represent a driver model protocol.
|
||||||
|
@retval FALSE The guid does not represent a driver model protocol.
|
||||||
|
**/
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
EFIAPI
|
EFIAPI
|
||||||
IsDriverProt (
|
IsDriverProt (
|
||||||
@ -61,13 +143,24 @@ IsDriverProt (
|
|||||||
return (GuidFound);
|
return (GuidFound);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Get information for a handle.
|
||||||
|
|
||||||
|
@param[in] TheHandle The handles to show info on.
|
||||||
|
@param[in] Language Language string per UEFI specification.
|
||||||
|
@param[in] Seperator Separator string between information blocks.
|
||||||
|
@param[in] Verbose TRUE for extra info, FALSE otherwise.
|
||||||
|
@param[in] ExtraInfo TRUE for extra info, FALSE otherwise.
|
||||||
|
|
||||||
|
@retval SHELL_SUCCESS The operation was successful.
|
||||||
|
@retval SHELL_INVALID_PARAMETER ProtocolName was NULL or invalid.
|
||||||
|
**/
|
||||||
CHAR16*
|
CHAR16*
|
||||||
EFIAPI
|
EFIAPI
|
||||||
GetProtocolInfoString(
|
GetProtocolInfoString(
|
||||||
IN CONST EFI_HANDLE TheHandle,
|
IN CONST EFI_HANDLE TheHandle,
|
||||||
IN CONST CHAR8 *Language,
|
IN CONST CHAR8 *Language,
|
||||||
IN CONST CHAR16 *Seperator,
|
IN CONST CHAR16 *Seperator,
|
||||||
IN CONST BOOLEAN DriverInfo,
|
|
||||||
IN CONST BOOLEAN Verbose,
|
IN CONST BOOLEAN Verbose,
|
||||||
IN CONST BOOLEAN ExtraInfo
|
IN CONST BOOLEAN ExtraInfo
|
||||||
)
|
)
|
||||||
@ -81,6 +174,8 @@ GetProtocolInfoString(
|
|||||||
CHAR16 *Temp;
|
CHAR16 *Temp;
|
||||||
|
|
||||||
ProtocolGuidArray = NULL;
|
ProtocolGuidArray = NULL;
|
||||||
|
RetVal = NULL;
|
||||||
|
Size = 0;
|
||||||
|
|
||||||
Status = gBS->ProtocolsPerHandle (
|
Status = gBS->ProtocolsPerHandle (
|
||||||
TheHandle,
|
TheHandle,
|
||||||
@ -88,8 +183,6 @@ GetProtocolInfoString(
|
|||||||
&ArrayCount
|
&ArrayCount
|
||||||
);
|
);
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
RetVal = NULL;
|
|
||||||
Size = 0;
|
|
||||||
for (ProtocolIndex = 0; ProtocolIndex < ArrayCount; ProtocolIndex++) {
|
for (ProtocolIndex = 0; ProtocolIndex < ArrayCount; ProtocolIndex++) {
|
||||||
Temp = GetStringNameFromGuid(ProtocolGuidArray[ProtocolIndex], Language);
|
Temp = GetStringNameFromGuid(ProtocolGuidArray[ProtocolIndex], Language);
|
||||||
if (Temp != NULL) {
|
if (Temp != NULL) {
|
||||||
@ -118,18 +211,448 @@ GetProtocolInfoString(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
SHELL_FREE_NON_NULL(ProtocolGuidArray);
|
||||||
|
|
||||||
|
if (RetVal == NULL) {
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ProtocolGuidArray != NULL) {
|
|
||||||
FreePool(ProtocolGuidArray);
|
|
||||||
}
|
|
||||||
ASSERT((RetVal == NULL && Size == 0) || (RetVal != NULL));
|
ASSERT((RetVal == NULL && Size == 0) || (RetVal != NULL));
|
||||||
StrnCatGrow(&RetVal, &Size, Seperator, 0);
|
StrnCatGrow(&RetVal, &Size, Seperator, 0);
|
||||||
return (RetVal);
|
return (RetVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the name of the loaded image.
|
||||||
|
|
||||||
|
@param[in] TheHandle The handle of the driver to get info on.
|
||||||
|
@param[out] Name The pointer to the pointer. Valid upon a successful return.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS The operation was successful.
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
GetDriverImageName (
|
||||||
|
IN EFI_HANDLE TheHandle,
|
||||||
|
OUT CHAR16 **Name
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// get loaded image and devicepathtotext on image->Filepath
|
||||||
|
EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
|
||||||
|
EFI_STATUS Status;
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||||
|
|
||||||
|
if (TheHandle == NULL || Name == NULL) {
|
||||||
|
return (EFI_INVALID_PARAMETER);
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = gBS->OpenProtocol (
|
||||||
|
TheHandle,
|
||||||
|
&gEfiLoadedImageProtocolGuid,
|
||||||
|
(VOID **) &LoadedImage,
|
||||||
|
gImageHandle,
|
||||||
|
NULL,
|
||||||
|
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||||
|
);
|
||||||
|
if (EFI_ERROR(Status)) {
|
||||||
|
return (Status);
|
||||||
|
}
|
||||||
|
DevicePath = LoadedImage->FilePath;
|
||||||
|
*Name = gDevPathToText->ConvertDevicePathToText(DevicePath, TRUE, TRUE);
|
||||||
|
return (EFI_SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Display driver model information for a given handle.
|
||||||
|
|
||||||
|
@param[in] Handle The handle to display info on.
|
||||||
|
@param[in] BestName Use the best name?
|
||||||
|
@param[in] Language The language to output in.
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
DisplayDriverModelHandle (
|
||||||
|
IN EFI_HANDLE Handle,
|
||||||
|
IN BOOLEAN BestName,
|
||||||
|
IN CONST CHAR8 *Language OPTIONAL
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
|
BOOLEAN ConfigurationStatus;
|
||||||
|
BOOLEAN DiagnosticsStatus;
|
||||||
|
UINTN DriverBindingHandleCount;
|
||||||
|
EFI_HANDLE *DriverBindingHandleBuffer;
|
||||||
|
UINTN ParentControllerHandleCount;
|
||||||
|
EFI_HANDLE *ParentControllerHandleBuffer;
|
||||||
|
UINTN ChildControllerHandleCount;
|
||||||
|
EFI_HANDLE *ChildControllerHandleBuffer;
|
||||||
|
CHAR16 *TempStringPointer;
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||||
|
UINTN Index;
|
||||||
|
CHAR16 *DriverName;
|
||||||
|
EFI_DRIVER_BINDING_PROTOCOL *DriverBinding;
|
||||||
|
UINTN NumberOfChildren;
|
||||||
|
UINTN HandleIndex;
|
||||||
|
UINTN ControllerHandleCount;
|
||||||
|
EFI_HANDLE *ControllerHandleBuffer;
|
||||||
|
UINTN ChildIndex;
|
||||||
|
BOOLEAN Image;
|
||||||
|
|
||||||
|
//
|
||||||
|
// See if Handle is a device handle and display its details.
|
||||||
|
//
|
||||||
|
DriverBindingHandleBuffer = NULL;
|
||||||
|
Status = PARSE_HANDLE_DATABASE_UEFI_DRIVERS (
|
||||||
|
Handle,
|
||||||
|
&DriverBindingHandleCount,
|
||||||
|
&DriverBindingHandleBuffer
|
||||||
|
);
|
||||||
|
|
||||||
|
ParentControllerHandleBuffer = NULL;
|
||||||
|
Status = PARSE_HANDLE_DATABASE_PARENTS (
|
||||||
|
Handle,
|
||||||
|
&ParentControllerHandleCount,
|
||||||
|
&ParentControllerHandleBuffer
|
||||||
|
);
|
||||||
|
|
||||||
|
ChildControllerHandleBuffer = NULL;
|
||||||
|
Status = ParseHandleDatabaseForChildControllers (
|
||||||
|
Handle,
|
||||||
|
&ChildControllerHandleCount,
|
||||||
|
&ChildControllerHandleBuffer
|
||||||
|
);
|
||||||
|
|
||||||
|
DiagnosticsStatus = FALSE;
|
||||||
|
ConfigurationStatus = FALSE;
|
||||||
|
|
||||||
|
if (!EFI_ERROR(gBS->OpenProtocol(Handle, &gEfiDriverConfigurationProtocolGuid, NULL, NULL, gImageHandle, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) {
|
||||||
|
ConfigurationStatus = TRUE;
|
||||||
|
}
|
||||||
|
if (!EFI_ERROR(gBS->OpenProtocol(Handle, &gEfiDriverConfiguration2ProtocolGuid, NULL, NULL, gImageHandle, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) {
|
||||||
|
ConfigurationStatus = TRUE;
|
||||||
|
}
|
||||||
|
if (!EFI_ERROR(gBS->OpenProtocol(Handle, &gEfiDriverDiagnosticsProtocolGuid, NULL, NULL, gImageHandle, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) {
|
||||||
|
DiagnosticsStatus = TRUE;
|
||||||
|
}
|
||||||
|
if (!EFI_ERROR(gBS->OpenProtocol(Handle, &gEfiDriverDiagnostics2ProtocolGuid, NULL, NULL, gImageHandle, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) {
|
||||||
|
DiagnosticsStatus = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = EFI_SUCCESS;
|
||||||
|
|
||||||
|
if (DriverBindingHandleCount > 0 || ParentControllerHandleCount > 0 || ChildControllerHandleCount > 0) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
DevicePath = NULL;
|
||||||
|
TempStringPointer = NULL;
|
||||||
|
Status = gBS->HandleProtocol (Handle, &gEfiDevicePathProtocolGuid, (VOID**)&DevicePath);
|
||||||
|
|
||||||
|
Status = gEfiShellProtocol->GetDeviceName(Handle, EFI_DEVICE_NAME_USE_COMPONENT_NAME|EFI_DEVICE_NAME_USE_DEVICE_PATH, (CHAR8*)Language, &TempStringPointer);
|
||||||
|
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_DH_OUTPUT_DRIVER1), gShellDriver1HiiHandle, TempStringPointer!=NULL?TempStringPointer:L"<Unknown>");
|
||||||
|
SHELL_FREE_NON_NULL(TempStringPointer);
|
||||||
|
|
||||||
|
TempStringPointer = gDevPathToText->ConvertDevicePathToText(DevicePath, TRUE, FALSE);
|
||||||
|
ShellPrintHiiEx(
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_DH_OUTPUT_DRIVER2),
|
||||||
|
gShellDriver1HiiHandle,
|
||||||
|
TempStringPointer!=NULL?TempStringPointer:L"<None>",
|
||||||
|
ParentControllerHandleCount == 0?L"ROOT":(ChildControllerHandleCount > 0)?L"BUS":L"DEVICE",
|
||||||
|
ConfigurationStatus?L"YES":L"NO",
|
||||||
|
DiagnosticsStatus?L"YES":L"NO"
|
||||||
|
);
|
||||||
|
|
||||||
|
SHELL_FREE_NON_NULL(TempStringPointer);
|
||||||
|
|
||||||
|
if (DriverBindingHandleCount == 0) {
|
||||||
|
ShellPrintHiiEx(
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_DH_OUTPUT_DRIVER3),
|
||||||
|
gShellDriver1HiiHandle,
|
||||||
|
L"<None>"
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
ShellPrintHiiEx(
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_DH_OUTPUT_DRIVER3),
|
||||||
|
gShellDriver1HiiHandle,
|
||||||
|
L""
|
||||||
|
);
|
||||||
|
for (Index = 0; Index < DriverBindingHandleCount; Index++) {
|
||||||
|
Image = FALSE;
|
||||||
|
Status = GetDriverName (
|
||||||
|
DriverBindingHandleBuffer[Index],
|
||||||
|
Language,
|
||||||
|
&DriverName
|
||||||
|
);
|
||||||
|
if (DriverName == NULL) {
|
||||||
|
Status = GetDriverImageName (
|
||||||
|
DriverBindingHandleBuffer[Index],
|
||||||
|
&DriverName
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Image) {
|
||||||
|
ShellPrintHiiEx(
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_DH_OUTPUT_DRIVER4A),
|
||||||
|
gShellDriver1HiiHandle,
|
||||||
|
ConvertHandleToHandleIndex (DriverBindingHandleBuffer[Index]),
|
||||||
|
DriverName!=NULL?DriverName:L"<Unknown>"
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
ShellPrintHiiEx(
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_DH_OUTPUT_DRIVER4B),
|
||||||
|
gShellDriver1HiiHandle,
|
||||||
|
ConvertHandleToHandleIndex (DriverBindingHandleBuffer[Index]),
|
||||||
|
DriverName!=NULL?DriverName:L"<Unknown>"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
SHELL_FREE_NON_NULL(DriverName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ParentControllerHandleCount == 0) {
|
||||||
|
ShellPrintHiiEx(
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_DH_OUTPUT_DRIVER5),
|
||||||
|
gShellDriver1HiiHandle,
|
||||||
|
L"<None>"
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
ShellPrintHiiEx(
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_DH_OUTPUT_DRIVER5),
|
||||||
|
gShellDriver1HiiHandle,
|
||||||
|
L""
|
||||||
|
);
|
||||||
|
for (Index = 0; Index < ParentControllerHandleCount; Index++) {
|
||||||
|
Status = gEfiShellProtocol->GetDeviceName(ParentControllerHandleBuffer[Index], EFI_DEVICE_NAME_USE_COMPONENT_NAME|EFI_DEVICE_NAME_USE_DEVICE_PATH, (CHAR8*)Language, &TempStringPointer);
|
||||||
|
ShellPrintHiiEx(
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_DH_OUTPUT_DRIVER5B),
|
||||||
|
gShellDriver1HiiHandle,
|
||||||
|
ConvertHandleToHandleIndex (ParentControllerHandleBuffer[Index]),
|
||||||
|
TempStringPointer!=NULL?TempStringPointer:L"<Unknown>"
|
||||||
|
);
|
||||||
|
SHELL_FREE_NON_NULL(TempStringPointer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ChildControllerHandleCount == 0) {
|
||||||
|
ShellPrintHiiEx(
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_DH_OUTPUT_DRIVER6),
|
||||||
|
gShellDriver1HiiHandle,
|
||||||
|
L"<None>"
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
ShellPrintHiiEx(
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_DH_OUTPUT_DRIVER6),
|
||||||
|
gShellDriver1HiiHandle,
|
||||||
|
L""
|
||||||
|
);
|
||||||
|
for (Index = 0; Index < ChildControllerHandleCount; Index++) {
|
||||||
|
Status = gEfiShellProtocol->GetDeviceName(ChildControllerHandleBuffer[Index], EFI_DEVICE_NAME_USE_COMPONENT_NAME|EFI_DEVICE_NAME_USE_DEVICE_PATH, (CHAR8*)Language, &TempStringPointer);
|
||||||
|
ShellPrintHiiEx(
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_DH_OUTPUT_DRIVER6B),
|
||||||
|
gShellDriver1HiiHandle,
|
||||||
|
ConvertHandleToHandleIndex (ChildControllerHandleBuffer[Index]),
|
||||||
|
TempStringPointer!=NULL?TempStringPointer:L"<Unknown>"
|
||||||
|
);
|
||||||
|
SHELL_FREE_NON_NULL(TempStringPointer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SHELL_FREE_NON_NULL(DriverBindingHandleBuffer);
|
||||||
|
|
||||||
|
SHELL_FREE_NON_NULL(ParentControllerHandleBuffer);
|
||||||
|
|
||||||
|
SHELL_FREE_NON_NULL(ChildControllerHandleBuffer);
|
||||||
|
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// See if Handle is a driver binding handle and display its details.
|
||||||
|
//
|
||||||
|
Status = gBS->OpenProtocol (
|
||||||
|
Handle,
|
||||||
|
&gEfiDriverBindingProtocolGuid,
|
||||||
|
(VOID **) &DriverBinding,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
return EFI_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
NumberOfChildren = 0;
|
||||||
|
ControllerHandleBuffer = NULL;
|
||||||
|
Status = PARSE_HANDLE_DATABASE_DEVICES (
|
||||||
|
Handle,
|
||||||
|
&ControllerHandleCount,
|
||||||
|
&ControllerHandleBuffer
|
||||||
|
);
|
||||||
|
if (ControllerHandleCount > 0) {
|
||||||
|
for (HandleIndex = 0; HandleIndex < ControllerHandleCount; HandleIndex++) {
|
||||||
|
Status = PARSE_HANDLE_DATABASE_MANAGED_CHILDREN (
|
||||||
|
Handle,
|
||||||
|
ControllerHandleBuffer[HandleIndex],
|
||||||
|
&ChildControllerHandleCount,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
NumberOfChildren += ChildControllerHandleCount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = GetDriverName (Handle, Language, &DriverName);
|
||||||
|
|
||||||
|
ShellPrintHiiEx(
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_DH_OUTPUT_DRIVER6B),
|
||||||
|
gShellDriver1HiiHandle,
|
||||||
|
ConvertHandleToHandleIndex(Handle),
|
||||||
|
DriverName!=NULL?DriverName:L"<Unknown>"
|
||||||
|
);
|
||||||
|
SHELL_FREE_NON_NULL(DriverName);
|
||||||
|
DriverName = NULL;
|
||||||
|
Status = GetDriverImageName (
|
||||||
|
Handle,
|
||||||
|
&DriverName
|
||||||
|
);
|
||||||
|
ShellPrintHiiEx(
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_DH_OUTPUT_DRIVER7B),
|
||||||
|
gShellDriver1HiiHandle,
|
||||||
|
DriverName!=NULL?DriverName:L"<Unknown>"
|
||||||
|
);
|
||||||
|
SHELL_FREE_NON_NULL(DriverName);
|
||||||
|
|
||||||
|
ShellPrintHiiEx(
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_DH_OUTPUT_DRIVER8),
|
||||||
|
gShellDriver1HiiHandle,
|
||||||
|
DriverBinding->Version,
|
||||||
|
NumberOfChildren > 0?L"Bus":ControllerHandleCount > 0?L"Device":L"<Unknown>",
|
||||||
|
ConfigurationStatus?L"YES":L"NO",
|
||||||
|
DiagnosticsStatus?L"YES":L"NO"
|
||||||
|
);
|
||||||
|
|
||||||
|
if (ControllerHandleCount == 0) {
|
||||||
|
ShellPrintHiiEx(
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_DH_OUTPUT_DRIVER6),
|
||||||
|
gShellDriver1HiiHandle,
|
||||||
|
L"None"
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
ShellPrintHiiEx(
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_DH_OUTPUT_DRIVER6),
|
||||||
|
gShellDriver1HiiHandle,
|
||||||
|
L""
|
||||||
|
);
|
||||||
|
for (HandleIndex = 0; HandleIndex < ControllerHandleCount; HandleIndex++) {
|
||||||
|
Status = gEfiShellProtocol->GetDeviceName(ControllerHandleBuffer[HandleIndex], EFI_DEVICE_NAME_USE_COMPONENT_NAME|EFI_DEVICE_NAME_USE_DEVICE_PATH, (CHAR8*)Language, &TempStringPointer);
|
||||||
|
|
||||||
|
ShellPrintHiiEx(
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_DH_OUTPUT_DRIVER9B),
|
||||||
|
gShellDriver1HiiHandle,
|
||||||
|
ConvertHandleToHandleIndex(ControllerHandleBuffer[HandleIndex]),
|
||||||
|
TempStringPointer!=NULL?TempStringPointer:L"<Unknown>"
|
||||||
|
);
|
||||||
|
SHELL_FREE_NON_NULL(TempStringPointer);
|
||||||
|
|
||||||
|
Status = PARSE_HANDLE_DATABASE_MANAGED_CHILDREN (
|
||||||
|
Handle,
|
||||||
|
ControllerHandleBuffer[HandleIndex],
|
||||||
|
&ChildControllerHandleCount,
|
||||||
|
&ChildControllerHandleBuffer
|
||||||
|
);
|
||||||
|
if (!EFI_ERROR (Status)) {
|
||||||
|
for (ChildIndex = 0; ChildIndex < ChildControllerHandleCount; ChildIndex++) {
|
||||||
|
Status = gEfiShellProtocol->GetDeviceName(ChildControllerHandleBuffer[ChildIndex], EFI_DEVICE_NAME_USE_COMPONENT_NAME|EFI_DEVICE_NAME_USE_DEVICE_PATH, (CHAR8*)Language, &TempStringPointer);
|
||||||
|
|
||||||
|
ShellPrintHiiEx(
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_DH_OUTPUT_DRIVER6B),
|
||||||
|
gShellDriver1HiiHandle,
|
||||||
|
ConvertHandleToHandleIndex(ChildControllerHandleBuffer[ChildIndex]),
|
||||||
|
TempStringPointer!=NULL?TempStringPointer:L"<Unknown>"
|
||||||
|
);
|
||||||
|
SHELL_FREE_NON_NULL(TempStringPointer);
|
||||||
|
}
|
||||||
|
|
||||||
|
SHELL_FREE_NON_NULL (ChildControllerHandleBuffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SHELL_FREE_NON_NULL (ControllerHandleBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
return EFI_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Display information for a handle.
|
||||||
|
|
||||||
|
@param[in] TheHandle The handles to show info on.
|
||||||
|
@param[in] Verbose TRUE for extra info, FALSE otherwise.
|
||||||
|
@param[in] Sfo TRUE to output in standard format output (spec).
|
||||||
|
@param[in] Language Language string per UEFI specification.
|
||||||
|
@param[in] DriverInfo TRUE to show all info about the handle.
|
||||||
|
@param[in] Multiple TRUE indicates more than will be output,
|
||||||
|
FALSE for a single one.
|
||||||
|
|
||||||
|
@retval SHELL_SUCCESS The operation was successful.
|
||||||
|
@retval SHELL_INVALID_PARAMETER ProtocolName was NULL or invalid.
|
||||||
|
**/
|
||||||
SHELL_STATUS
|
SHELL_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
DoDhByHandle(
|
DoDhByHandle(
|
||||||
@ -151,7 +674,7 @@ DoDhByHandle(
|
|||||||
|
|
||||||
if (!Sfo) {
|
if (!Sfo) {
|
||||||
if (Multiple) {
|
if (Multiple) {
|
||||||
ProtocolInfoString = GetProtocolInfoString(TheHandle, Language, L" ", DriverInfo, Verbose, TRUE);
|
ProtocolInfoString = GetProtocolInfoString(TheHandle, Language, L" ", Verbose, TRUE);
|
||||||
ShellPrintHiiEx(
|
ShellPrintHiiEx(
|
||||||
-1,
|
-1,
|
||||||
-1,
|
-1,
|
||||||
@ -161,7 +684,7 @@ DoDhByHandle(
|
|||||||
ConvertHandleToHandleIndex(TheHandle),
|
ConvertHandleToHandleIndex(TheHandle),
|
||||||
ProtocolInfoString==NULL?L"":ProtocolInfoString);
|
ProtocolInfoString==NULL?L"":ProtocolInfoString);
|
||||||
} else {
|
} else {
|
||||||
ProtocolInfoString = GetProtocolInfoString(TheHandle, Language, L"\r\n", DriverInfo, Verbose, TRUE);
|
ProtocolInfoString = GetProtocolInfoString(TheHandle, Language, L"\r\n", Verbose, TRUE);
|
||||||
ShellPrintHiiEx(
|
ShellPrintHiiEx(
|
||||||
-1,
|
-1,
|
||||||
-1,
|
-1,
|
||||||
@ -172,9 +695,12 @@ DoDhByHandle(
|
|||||||
TheHandle,
|
TheHandle,
|
||||||
ProtocolInfoString==NULL?L"":ProtocolInfoString);
|
ProtocolInfoString==NULL?L"":ProtocolInfoString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (DriverInfo) {
|
||||||
|
DisplayDriverModelHandle ((EFI_HANDLE)TheHandle, TRUE, Language);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
//#string STR_DH_OUTPUT_SFO #language en-US "%s, %s, %s, %H%02x%N, %s, %s\r\n"
|
ProtocolInfoString = GetProtocolInfoString(TheHandle, Language, L";", FALSE, FALSE);
|
||||||
ProtocolInfoString = GetProtocolInfoString(TheHandle, Language, L";", DriverInfo, FALSE, FALSE);
|
|
||||||
ShellPrintHiiEx(
|
ShellPrintHiiEx(
|
||||||
-1,
|
-1,
|
||||||
-1,
|
-1,
|
||||||
@ -198,6 +724,17 @@ DoDhByHandle(
|
|||||||
return (ShellStatus);
|
return (ShellStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Display information for all handles on a list.
|
||||||
|
|
||||||
|
@param[in] HandleList The NULL-terminated list of handles.
|
||||||
|
@param[in] Sfo TRUE to output in standard format output (spec).
|
||||||
|
@param[in] Language Language string per UEFI specification.
|
||||||
|
@param[in] DriverInfo TRUE to show all info about the handle.
|
||||||
|
|
||||||
|
@retval SHELL_SUCCESS The operation was successful.
|
||||||
|
@retval SHELL_INVALID_PARAMETER ProtocolName was NULL or invalid.
|
||||||
|
**/
|
||||||
SHELL_STATUS
|
SHELL_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
DoDhForHandleList(
|
DoDhForHandleList(
|
||||||
@ -225,6 +762,16 @@ DoDhForHandleList(
|
|||||||
return (ShellStatus);
|
return (ShellStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Display information for all handles.
|
||||||
|
|
||||||
|
@param[in] Sfo TRUE to output in standard format output (spec).
|
||||||
|
@param[in] Language Language string per UEFI specification.
|
||||||
|
@param[in] DriverInfo TRUE to show all info about the handle.
|
||||||
|
|
||||||
|
@retval SHELL_SUCCESS The operation was successful.
|
||||||
|
@retval SHELL_INVALID_PARAMETER ProtocolName was NULL or invalid.
|
||||||
|
**/
|
||||||
SHELL_STATUS
|
SHELL_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
DoDhForAll(
|
DoDhForAll(
|
||||||
@ -249,6 +796,17 @@ DoDhForAll(
|
|||||||
return (ShellStatus);
|
return (ShellStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Display information for all handles which have a specific protocol.
|
||||||
|
|
||||||
|
@param[in] ProtocolName The pointer to the name of the protocol.
|
||||||
|
@param[in] Sfo TRUE to output in standard format output (spec).
|
||||||
|
@param[in] Language Language string per UEFI specification.
|
||||||
|
@param[in] DriverInfo TRUE to show all info about the handle.
|
||||||
|
|
||||||
|
@retval SHELL_SUCCESS The operation was successful.
|
||||||
|
@retval SHELL_INVALID_PARAMETER ProtocolName was NULL or invalid.
|
||||||
|
**/
|
||||||
SHELL_STATUS
|
SHELL_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
DoDhByProtocol(
|
DoDhByProtocol(
|
||||||
@ -263,7 +821,9 @@ DoDhByProtocol(
|
|||||||
EFI_HANDLE *HandleList;
|
EFI_HANDLE *HandleList;
|
||||||
SHELL_STATUS ShellStatus;
|
SHELL_STATUS ShellStatus;
|
||||||
|
|
||||||
ASSERT(ProtocolName != NULL);
|
if (ProtocolName == NULL) {
|
||||||
|
return (SHELL_INVALID_PARAMETER);
|
||||||
|
}
|
||||||
|
|
||||||
Status = GetGuidFromStringName(ProtocolName, Language, &Guid);
|
Status = GetGuidFromStringName(ProtocolName, Language, &Guid);
|
||||||
if (EFI_ERROR(Status)) {
|
if (EFI_ERROR(Status)) {
|
||||||
@ -284,6 +844,12 @@ DoDhByProtocol(
|
|||||||
return (ShellStatus);
|
return (ShellStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Function for 'dh' command.
|
||||||
|
|
||||||
|
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
||||||
|
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
||||||
|
**/
|
||||||
SHELL_STATUS
|
SHELL_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
ShellCommandRunDh (
|
ShellCommandRunDh (
|
||||||
@ -301,6 +867,7 @@ ShellCommandRunDh (
|
|||||||
BOOLEAN SfoMode;
|
BOOLEAN SfoMode;
|
||||||
BOOLEAN FlagD;
|
BOOLEAN FlagD;
|
||||||
BOOLEAN Verbose;
|
BOOLEAN Verbose;
|
||||||
|
UINT64 Intermediate;
|
||||||
|
|
||||||
ShellStatus = SHELL_SUCCESS;
|
ShellStatus = SHELL_SUCCESS;
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
@ -350,11 +917,7 @@ ShellCommandRunDh (
|
|||||||
|
|
||||||
SfoMode = ShellCommandLineGetFlag(Package, L"-sfo");
|
SfoMode = ShellCommandLineGetFlag(Package, L"-sfo");
|
||||||
FlagD = ShellCommandLineGetFlag(Package, L"-d");
|
FlagD = ShellCommandLineGetFlag(Package, L"-d");
|
||||||
if (ShellCommandLineGetFlag(Package, L"-v") || ShellCommandLineGetFlag(Package, L"-verbose")) {
|
Verbose = (BOOLEAN)(ShellCommandLineGetFlag(Package, L"-v") || ShellCommandLineGetFlag(Package, L"-verbose"));
|
||||||
Verbose = TRUE;
|
|
||||||
} else {
|
|
||||||
Verbose = FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ShellCommandLineGetFlag(Package, L"-p")) {
|
if (ShellCommandLineGetFlag(Package, L"-p")) {
|
||||||
if (ShellCommandLineGetCount(Package) > 1) {
|
if (ShellCommandLineGetCount(Package) > 1) {
|
||||||
@ -386,7 +949,8 @@ ShellCommandRunDh (
|
|||||||
FlagD
|
FlagD
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
if (!ShellIsHexOrDecimalNumber(Temp2, TRUE, FALSE) || ConvertHandleIndexToHandle(StrHexToUintn(Temp2)) == NULL) {
|
Status = ShellConvertStringToUint64(Temp2, &Intermediate, TRUE, FALSE);
|
||||||
|
if (EFI_ERROR(Status) || ConvertHandleIndexToHandle((UINTN)Intermediate) == NULL) {
|
||||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, Temp2);
|
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, Temp2);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
} else {
|
} else {
|
||||||
@ -394,7 +958,7 @@ ShellCommandRunDh (
|
|||||||
// print 1 handle
|
// print 1 handle
|
||||||
//
|
//
|
||||||
ShellStatus = DoDhByHandle(
|
ShellStatus = DoDhByHandle(
|
||||||
ConvertHandleIndexToHandle(StrHexToUintn(Temp2)),
|
ConvertHandleIndexToHandle((UINTN)Intermediate),
|
||||||
Verbose,
|
Verbose,
|
||||||
SfoMode,
|
SfoMode,
|
||||||
Lang==NULL?NULL:Language,
|
Lang==NULL?NULL:Language,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Main file for Disconnect shell Driver1 function.
|
Main file for Disconnect shell Driver1 function.
|
||||||
|
|
||||||
Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
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}
|
{NULL, TypeMax}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
Disconnect everything.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS The operation was successful.
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
DisconnectAll(
|
DisconnectAll(
|
||||||
@ -67,6 +72,12 @@ DisconnectAll(
|
|||||||
return (EFI_SUCCESS);
|
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
|
SHELL_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
ShellCommandRunDisconnect (
|
ShellCommandRunDisconnect (
|
||||||
@ -84,6 +95,9 @@ ShellCommandRunDisconnect (
|
|||||||
EFI_HANDLE Handle1;
|
EFI_HANDLE Handle1;
|
||||||
EFI_HANDLE Handle2;
|
EFI_HANDLE Handle2;
|
||||||
EFI_HANDLE Handle3;
|
EFI_HANDLE Handle3;
|
||||||
|
UINT64 Intermediate1;
|
||||||
|
UINT64 Intermediate2;
|
||||||
|
UINT64 Intermediate3;
|
||||||
|
|
||||||
ShellStatus = SHELL_SUCCESS;
|
ShellStatus = SHELL_SUCCESS;
|
||||||
|
|
||||||
@ -133,9 +147,12 @@ ShellCommandRunDisconnect (
|
|||||||
Param1 = ShellCommandLineGetRawValue(Package, 1);
|
Param1 = ShellCommandLineGetRawValue(Package, 1);
|
||||||
Param2 = ShellCommandLineGetRawValue(Package, 2);
|
Param2 = ShellCommandLineGetRawValue(Package, 2);
|
||||||
Param3 = ShellCommandLineGetRawValue(Package, 3);
|
Param3 = ShellCommandLineGetRawValue(Package, 3);
|
||||||
Handle1 = Param1!=NULL?ConvertHandleIndexToHandle(StrHexToUintn(Param1)):NULL;
|
ShellConvertStringToUint64(Param1, &Intermediate1, TRUE, FALSE);
|
||||||
Handle2 = Param2!=NULL?ConvertHandleIndexToHandle(StrHexToUintn(Param2)):NULL;
|
Handle1 = Param1!=NULL?ConvertHandleIndexToHandle((UINTN)Intermediate1):NULL;
|
||||||
Handle3 = Param3!=NULL?ConvertHandleIndexToHandle(StrHexToUintn(Param3)):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) {
|
if (Param1 != NULL && Handle1 == NULL) {
|
||||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, Param1);
|
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, Param1);
|
||||||
@ -148,18 +165,16 @@ ShellCommandRunDisconnect (
|
|||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
} else if (EFI_ERROR(gBS->OpenProtocol(Handle1, &gEfiDevicePathProtocolGuid, NULL, gImageHandle, NULL, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) {
|
} else if (EFI_ERROR(gBS->OpenProtocol(Handle1, &gEfiDevicePathProtocolGuid, NULL, gImageHandle, NULL, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) {
|
||||||
ASSERT(Param1 != NULL);
|
ASSERT(Param1 != NULL);
|
||||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_HANDLE_NOT), gShellDriver1HiiHandle, StrHexToUintn(Param1), L"controller handle");
|
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_HANDLE_NOT), gShellDriver1HiiHandle, ShellStrToUintn(Param1), L"controller handle");
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
} else if (Handle2 != NULL && EFI_ERROR(gBS->OpenProtocol(Handle2, &gEfiDriverBindingProtocolGuid, NULL, gImageHandle, NULL, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) {
|
} else if (Handle2 != NULL && EFI_ERROR(gBS->OpenProtocol(Handle2, &gEfiDriverBindingProtocolGuid, NULL, gImageHandle, NULL, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) {
|
||||||
ASSERT(Param2 != NULL);
|
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;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
} else {
|
} else {
|
||||||
ASSERT(Param1 != NULL);
|
ASSERT(Param1 != NULL);
|
||||||
ASSERT(Param2 != NULL);
|
|
||||||
ASSERT(Param3 != NULL);
|
|
||||||
Status = gBS->DisconnectController(Handle1, Handle2, Handle3);
|
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", Intermediate1, Intermediate2, Intermediate3, Status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Main file for Drivers shell Driver1 function.
|
Main file for Drivers shell Driver1 function.
|
||||||
|
|
||||||
Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -20,6 +20,15 @@ STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
|
|||||||
{NULL, TypeMax}
|
{NULL, TypeMax}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
Get a device path (in text format) for a given handle.
|
||||||
|
|
||||||
|
@param[in] TheHandle The handle to get the device path for.
|
||||||
|
|
||||||
|
@retval NULL An error occured.
|
||||||
|
@return A pointer to the driver path as a string. The callee must
|
||||||
|
free this memory.
|
||||||
|
**/
|
||||||
CHAR16*
|
CHAR16*
|
||||||
EFIAPI
|
EFIAPI
|
||||||
GetDevicePathTextForHandle(
|
GetDevicePathTextForHandle(
|
||||||
@ -77,6 +86,14 @@ GetDevicePathTextForHandle(
|
|||||||
return (RetVal);
|
return (RetVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Determine if the given handle has Driver Configuration protocol.
|
||||||
|
|
||||||
|
@param[in] TheHandle The handle to the driver to test.
|
||||||
|
|
||||||
|
@retval TRUE The driver does have Driver Configuration.
|
||||||
|
@retval FALSE The driver does not have Driver Configuration.
|
||||||
|
**/
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
EFIAPI
|
EFIAPI
|
||||||
ReturnDriverConfig(
|
ReturnDriverConfig(
|
||||||
@ -91,6 +108,14 @@ ReturnDriverConfig(
|
|||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Determine if the given handle has DriverDiagnostics protocol.
|
||||||
|
|
||||||
|
@param[in] TheHandle The handle to the driver to test.
|
||||||
|
|
||||||
|
@retval TRUE The driver does have Driver Diasgnostics.
|
||||||
|
@retval FALSE The driver does not have Driver Diagnostics.
|
||||||
|
**/
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
EFIAPI
|
EFIAPI
|
||||||
ReturnDriverDiag(
|
ReturnDriverDiag(
|
||||||
@ -108,6 +133,14 @@ ReturnDriverDiag(
|
|||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Finds and returns the version of the driver specified by TheHandle.
|
||||||
|
|
||||||
|
@param[in] TheHandle The driver handle to get the version of.
|
||||||
|
|
||||||
|
@return The version of the driver.
|
||||||
|
@retval 0xFFFFFFFF An error ocurred.
|
||||||
|
**/
|
||||||
UINT32
|
UINT32
|
||||||
EFIAPI
|
EFIAPI
|
||||||
ReturnDriverVersion(
|
ReturnDriverVersion(
|
||||||
@ -128,6 +161,12 @@ ReturnDriverVersion(
|
|||||||
return (RetVal);
|
return (RetVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Function for 'drivers' command.
|
||||||
|
|
||||||
|
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
||||||
|
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
||||||
|
**/
|
||||||
SHELL_STATUS
|
SHELL_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
ShellCommandRunDrivers (
|
ShellCommandRunDrivers (
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Main file for DrvCfg shell Driver1 function.
|
Main file for DrvCfg shell Driver1 function.
|
||||||
|
|
||||||
Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -300,6 +300,12 @@ STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
|
|||||||
{NULL, TypeMax}
|
{NULL, TypeMax}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
Function for 'drvcfg' command.
|
||||||
|
|
||||||
|
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
||||||
|
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
||||||
|
**/
|
||||||
SHELL_STATUS
|
SHELL_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
ShellCommandRunDrvCfg (
|
ShellCommandRunDrvCfg (
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Main file for DrvDiag shell Driver1 function.
|
Main file for DrvDiag shell Driver1 function.
|
||||||
|
|
||||||
Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -19,13 +19,27 @@ STATIC CONST EFI_GUID *DiagGuidList[] = {&gEfiDriverDiagnosticsProtocolGuid, &gE
|
|||||||
// We need 1 more item on the list...
|
// We need 1 more item on the list...
|
||||||
//
|
//
|
||||||
typedef enum {
|
typedef enum {
|
||||||
TEST_MODE_STANDARD = EfiDriverDiagnosticTypeStandard,
|
TestModeStandard = EfiDriverDiagnosticTypeStandard,
|
||||||
TEST_MODE_EXTENDED = EfiDriverDiagnosticTypeExtended,
|
TestModeExtended = EfiDriverDiagnosticTypeExtended,
|
||||||
TEST_MODE_MANUFACTURING = EfiDriverDiagnosticTypeManufacturing,
|
TestModeManufacturing = EfiDriverDiagnosticTypeManufacturing,
|
||||||
TEST_MODE_LIST,
|
TestModeList,
|
||||||
TEST_MODE_MAX
|
TestModeMax
|
||||||
} DRV_DIAG_TEST_MODE;
|
} DRV_DIAG_TEST_MODE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Do the diagnostics call for some set of handles.
|
||||||
|
|
||||||
|
@param[in] Mode The type of diagnostic test to run.
|
||||||
|
@param[in] Lang The language code to use.
|
||||||
|
@param[in] AllChilds Should the test be on all children.
|
||||||
|
@param[in] DriverHandle The driver handle to test with.
|
||||||
|
@param[in] ControllerHandle The specific controller handle to test.
|
||||||
|
@param[in] ChildHandle The specific child handle to test.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS The operation was successful.
|
||||||
|
@retval EFI_INVALID_PARAMETER A parameter had an invalid value.
|
||||||
|
@retval EFI_NOT_FOUND No diagnostic handle could be found.
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
DoDiagnostics (
|
DoDiagnostics (
|
||||||
@ -56,13 +70,11 @@ DoDiagnostics (
|
|||||||
CHAR16 *OutBuffer;
|
CHAR16 *OutBuffer;
|
||||||
UINTN HandleIndex1;
|
UINTN HandleIndex1;
|
||||||
UINTN HandleIndex2;
|
UINTN HandleIndex2;
|
||||||
|
CHAR8 *Language;
|
||||||
|
CHAR8 *TempChar;
|
||||||
|
BOOLEAN Found;
|
||||||
|
|
||||||
if ((ChildHandle != NULL && AllChilds) || (Mode >= TEST_MODE_MAX)){
|
if ((ChildHandle != NULL && AllChilds) || (Mode >= TestModeMax)){
|
||||||
return (EFI_INVALID_PARAMETER);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Lang == NULL || AsciiStrLen(Lang) < 3) {
|
|
||||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDriver1HiiHandle, L"-l <value>");
|
|
||||||
return (EFI_INVALID_PARAMETER);
|
return (EFI_INVALID_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,6 +85,7 @@ DoDiagnostics (
|
|||||||
DriverHandleList = NULL;
|
DriverHandleList = NULL;
|
||||||
ControllerHandleList = NULL;
|
ControllerHandleList = NULL;
|
||||||
ChildHandleList = NULL;
|
ChildHandleList = NULL;
|
||||||
|
Language = NULL;
|
||||||
OutBuffer = NULL;
|
OutBuffer = NULL;
|
||||||
ErrorType = NULL;
|
ErrorType = NULL;
|
||||||
DriverHandleListCount = 0;
|
DriverHandleListCount = 0;
|
||||||
@ -87,7 +100,8 @@ DoDiagnostics (
|
|||||||
} else {
|
} else {
|
||||||
DriverHandleList = GetHandleListByProtocolList(DiagGuidList);
|
DriverHandleList = GetHandleListByProtocolList(DiagGuidList);
|
||||||
if (DriverHandleList == NULL) {
|
if (DriverHandleList == NULL) {
|
||||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_DRVCFG_NONE), gShellDriver1HiiHandle);
|
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROTOCOL_NF), gShellDriver1HiiHandle, L"gEfiDriverDiagnosticsProtocolGuid", &gEfiDriverDiagnosticsProtocolGuid);
|
||||||
|
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROTOCOL_NF), gShellDriver1HiiHandle, L"gEfiDriverDiagnostics2ProtocolGuid", &gEfiDriverDiagnostics2ProtocolGuid);
|
||||||
return (EFI_NOT_FOUND);
|
return (EFI_NOT_FOUND);
|
||||||
}
|
}
|
||||||
for (Walker = DriverHandleList ; Walker != NULL && *Walker != NULL ; DriverHandleListCount++, Walker++);
|
for (Walker = DriverHandleList ; Walker != NULL && *Walker != NULL ; DriverHandleListCount++, Walker++);
|
||||||
@ -116,132 +130,186 @@ DoDiagnostics (
|
|||||||
ChildHandleList = NULL;
|
ChildHandleList = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Mode == TestModeList) {
|
||||||
|
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_DRVDIAG_HEADER), gShellDriver1HiiHandle);
|
||||||
|
}
|
||||||
for (DriverHandleListLoop = 0
|
for (DriverHandleListLoop = 0
|
||||||
; DriverHandleListLoop < DriverHandleListCount
|
; DriverHandleListLoop < DriverHandleListCount
|
||||||
; DriverHandleListLoop++
|
; DriverHandleListLoop++
|
||||||
){
|
){
|
||||||
|
if (Mode == TestModeList) {
|
||||||
|
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_DRVDIAG_DRIVER_HEADER), gShellDriver1HiiHandle, ConvertHandleToHandleIndex(DriverHandleList[DriverHandleListLoop]));
|
||||||
|
}
|
||||||
if (ControllerHandle == NULL) {
|
if (ControllerHandle == NULL) {
|
||||||
PARSE_HANDLE_DATABASE_DEVICES(DriverHandleList[DriverHandleListLoop], &ControllerHandleListCount, &ControllerHandleList);
|
PARSE_HANDLE_DATABASE_DEVICES(DriverHandleList[DriverHandleListLoop], &ControllerHandleListCount, &ControllerHandleList);
|
||||||
}
|
}
|
||||||
for (ControllerHandleListLoop = 0
|
if (ControllerHandleListCount == 0) {
|
||||||
; ControllerHandleListLoop < ControllerHandleListCount
|
if (Mode == TestModeList) {
|
||||||
; ControllerHandleListLoop++
|
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_DRVDIAG_DRIVER_NO_HANDLES), gShellDriver1HiiHandle);
|
||||||
){
|
|
||||||
if (AllChilds) {
|
|
||||||
ASSERT(ChildHandleList == NULL);
|
|
||||||
PARSE_HANDLE_DATABASE_MANAGED_CHILDREN(
|
|
||||||
DriverHandleList[DriverHandleListLoop],
|
|
||||||
ControllerHandleList[ControllerHandleListLoop],
|
|
||||||
&ChildHandleListCount,
|
|
||||||
&ChildHandleList);
|
|
||||||
}
|
}
|
||||||
for (ChildHandleListLoop = 0
|
} else {
|
||||||
; (ChildHandleListLoop < ChildHandleListCount || ChildHandleList == NULL)
|
if (Mode == TestModeList) {
|
||||||
; ChildHandleListLoop++
|
ShellPrintEx(-1, -1, L"\r\n");
|
||||||
|
}
|
||||||
|
for (ControllerHandleListLoop = 0
|
||||||
|
; ControllerHandleListLoop < ControllerHandleListCount
|
||||||
|
; ControllerHandleListLoop++
|
||||||
){
|
){
|
||||||
if (Mode != TEST_MODE_LIST) {
|
if (AllChilds) {
|
||||||
if (Lang[2] == '-') {
|
ASSERT(ChildHandleList == NULL);
|
||||||
//
|
PARSE_HANDLE_DATABASE_MANAGED_CHILDREN(
|
||||||
// Get the protocol pointer and call the function
|
DriverHandleList[DriverHandleListLoop],
|
||||||
//
|
ControllerHandleList[ControllerHandleListLoop],
|
||||||
Status = gBS->OpenProtocol(
|
&ChildHandleListCount,
|
||||||
DriverHandleList[DriverHandleListLoop],
|
&ChildHandleList);
|
||||||
&gEfiDriverDiagnostics2ProtocolGuid,
|
}
|
||||||
(VOID**)&DriverDiagnostics2,
|
for (ChildHandleListLoop = 0
|
||||||
gImageHandle,
|
; (ChildHandleListLoop < ChildHandleListCount || ChildHandleList == NULL)
|
||||||
|
; ChildHandleListLoop++
|
||||||
|
){
|
||||||
|
Found = FALSE;
|
||||||
|
if (Mode != TestModeList) {
|
||||||
|
if (Lang == NULL || Lang[2] == '-') {
|
||||||
|
//
|
||||||
|
// Get the protocol pointer and call the function
|
||||||
|
//
|
||||||
|
Status = gBS->OpenProtocol(
|
||||||
|
DriverHandleList[DriverHandleListLoop],
|
||||||
|
&gEfiDriverDiagnostics2ProtocolGuid,
|
||||||
|
(VOID**)&DriverDiagnostics2,
|
||||||
|
gImageHandle,
|
||||||
|
NULL,
|
||||||
|
EFI_OPEN_PROTOCOL_GET_PROTOCOL);
|
||||||
|
if (!EFI_ERROR(Status)) {
|
||||||
|
if (Lang == NULL) {
|
||||||
|
Language = AllocateZeroPool(AsciiStrSize(DriverDiagnostics2->SupportedLanguages));
|
||||||
|
if (Language == NULL) {
|
||||||
|
return (EFI_OUT_OF_RESOURCES);
|
||||||
|
}
|
||||||
|
AsciiStrCpy(Language, DriverDiagnostics2->SupportedLanguages);
|
||||||
|
TempChar = AsciiStrStr(Language, ";");
|
||||||
|
if (TempChar != NULL){
|
||||||
|
*TempChar = CHAR_NULL;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Language = AllocateZeroPool(AsciiStrSize(Lang));
|
||||||
|
if (Language == NULL) {
|
||||||
|
return (EFI_OUT_OF_RESOURCES);
|
||||||
|
}
|
||||||
|
AsciiStrCpy(Language, Lang);
|
||||||
|
}
|
||||||
|
Found = TRUE;
|
||||||
|
Status = DriverDiagnostics2->RunDiagnostics(
|
||||||
|
DriverDiagnostics2,
|
||||||
|
ControllerHandleList[ControllerHandleListLoop],
|
||||||
|
ChildHandleList == NULL?NULL:ChildHandleList[ChildHandleListLoop],
|
||||||
|
(EFI_DRIVER_DIAGNOSTIC_TYPE)Mode,
|
||||||
|
Language,
|
||||||
|
&ErrorType,
|
||||||
|
&OutBufferSize,
|
||||||
|
&OutBuffer);
|
||||||
|
FreePool(Language);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (Found == FALSE && (Lang == NULL||(Lang!=NULL&&Lang[2]!='-'))){
|
||||||
|
Status = gBS->OpenProtocol(
|
||||||
|
DriverHandleList[DriverHandleListLoop],
|
||||||
|
&gEfiDriverDiagnosticsProtocolGuid,
|
||||||
|
(VOID**)&DriverDiagnostics,
|
||||||
|
gImageHandle,
|
||||||
|
NULL,
|
||||||
|
EFI_OPEN_PROTOCOL_GET_PROTOCOL);
|
||||||
|
if (!EFI_ERROR(Status)) {
|
||||||
|
if (Lang == NULL) {
|
||||||
|
Language = AllocateZeroPool(AsciiStrSize(DriverDiagnostics2->SupportedLanguages));
|
||||||
|
if (Language == NULL) {
|
||||||
|
return (EFI_OUT_OF_RESOURCES);
|
||||||
|
}
|
||||||
|
AsciiStrCpy(Language, DriverDiagnostics2->SupportedLanguages);
|
||||||
|
TempChar = AsciiStrStr(Language, ";");
|
||||||
|
if (TempChar != NULL){
|
||||||
|
*TempChar = CHAR_NULL;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Language = AllocateZeroPool(AsciiStrSize(Lang));
|
||||||
|
if (Language == NULL) {
|
||||||
|
return (EFI_OUT_OF_RESOURCES);
|
||||||
|
}
|
||||||
|
AsciiStrCpy(Language, Lang);
|
||||||
|
}
|
||||||
|
Status = DriverDiagnostics->RunDiagnostics(
|
||||||
|
DriverDiagnostics,
|
||||||
|
ControllerHandleList[ControllerHandleListLoop],
|
||||||
|
ChildHandleList == NULL?NULL:ChildHandleList[ChildHandleListLoop],
|
||||||
|
(EFI_DRIVER_DIAGNOSTIC_TYPE)Mode,
|
||||||
|
Language,
|
||||||
|
&ErrorType,
|
||||||
|
&OutBufferSize,
|
||||||
|
&OutBuffer);
|
||||||
|
FreePool(Language);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (EFI_ERROR(Status)) {
|
||||||
|
Status2 = Status;
|
||||||
|
}
|
||||||
|
HandleIndex1 = ConvertHandleToHandleIndex(DriverHandleList[DriverHandleListLoop]);
|
||||||
|
HandleIndex2 = ConvertHandleToHandleIndex(ControllerHandleList[ControllerHandleListLoop]);
|
||||||
|
ShellPrintHiiEx(
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
NULL,
|
NULL,
|
||||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL);
|
STRING_TOKEN (STR_3P_RESULT),
|
||||||
if (!EFI_ERROR(Status)) {
|
gShellDriver1HiiHandle,
|
||||||
Status = DriverDiagnostics2->RunDiagnostics(
|
L"DrvDiag",
|
||||||
DriverDiagnostics2,
|
HandleIndex1,
|
||||||
ControllerHandleList[ControllerHandleListLoop],
|
HandleIndex2,
|
||||||
ChildHandleList == NULL?NULL:ChildHandleList[ChildHandleListLoop],
|
ChildHandleList == NULL?0:ConvertHandleToHandleIndex(ChildHandleList[ChildHandleListLoop]),
|
||||||
(EFI_DRIVER_DIAGNOSTIC_TYPE)Mode,
|
Status);
|
||||||
(CHAR8*)Lang,
|
if (OutBuffer!=NULL) {
|
||||||
&ErrorType,
|
FreePool(OutBuffer);
|
||||||
&OutBufferSize,
|
OutBuffer = NULL;
|
||||||
&OutBuffer);
|
}
|
||||||
|
if (ErrorType!=NULL) {
|
||||||
|
FreePool(ErrorType);
|
||||||
|
ErrorType = NULL;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Status = gBS->OpenProtocol(
|
HandleIndex1 = ConvertHandleToHandleIndex(DriverHandleList[DriverHandleListLoop]);
|
||||||
DriverHandleList[DriverHandleListLoop],
|
HandleIndex2 = ConvertHandleToHandleIndex(ControllerHandleList[ControllerHandleListLoop]);
|
||||||
&gEfiDriverDiagnosticsProtocolGuid,
|
//
|
||||||
(VOID**)&DriverDiagnostics,
|
// Print out the information that this set can be tested
|
||||||
gImageHandle,
|
//
|
||||||
|
ShellPrintHiiEx(
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
NULL,
|
NULL,
|
||||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL);
|
STRING_TOKEN (STR_DRV_DIAG_ITEM_LINE),
|
||||||
if (!EFI_ERROR(Status)) {
|
gShellDriver1HiiHandle,
|
||||||
Status = DriverDiagnostics->RunDiagnostics(
|
HandleIndex1,
|
||||||
DriverDiagnostics,
|
HandleIndex2,
|
||||||
ControllerHandleList[ControllerHandleListLoop],
|
ChildHandleList == NULL?0:ConvertHandleToHandleIndex(ChildHandleList[ChildHandleListLoop])
|
||||||
ChildHandleList == NULL?NULL:ChildHandleList[ChildHandleListLoop],
|
);
|
||||||
(EFI_DRIVER_DIAGNOSTIC_TYPE)Mode,
|
|
||||||
(CHAR8*)Lang,
|
|
||||||
&ErrorType,
|
|
||||||
&OutBufferSize,
|
|
||||||
&OutBuffer);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (EFI_ERROR(Status)) {
|
|
||||||
Status2 = Status;
|
|
||||||
}
|
|
||||||
HandleIndex1 = ConvertHandleToHandleIndex(DriverHandleList[DriverHandleListLoop]);
|
|
||||||
HandleIndex2 = ConvertHandleToHandleIndex(ControllerHandleList[ControllerHandleListLoop]);
|
|
||||||
ShellPrintHiiEx(
|
|
||||||
-1,
|
|
||||||
-1,
|
|
||||||
NULL,
|
|
||||||
STRING_TOKEN (STR_3P_RESULT),
|
|
||||||
gShellDriver1HiiHandle,
|
|
||||||
L"DrvDiag",
|
|
||||||
HandleIndex1,
|
|
||||||
HandleIndex2,
|
|
||||||
ChildHandleList == NULL?0:ConvertHandleToHandleIndex(ChildHandleList[ChildHandleListLoop]),
|
|
||||||
Status);
|
|
||||||
if (OutBuffer!=NULL) {
|
|
||||||
FreePool(OutBuffer);
|
|
||||||
OutBuffer = NULL;
|
|
||||||
}
|
|
||||||
if (ErrorType!=NULL) {
|
|
||||||
FreePool(ErrorType);
|
|
||||||
ErrorType = NULL;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
HandleIndex1 = ConvertHandleToHandleIndex(DriverHandleList[DriverHandleListLoop]);
|
|
||||||
HandleIndex2 = ConvertHandleToHandleIndex(ControllerHandleList[ControllerHandleListLoop]);
|
|
||||||
//
|
|
||||||
// Print out the information that this set can be tested
|
|
||||||
//
|
|
||||||
ShellPrintHiiEx(
|
|
||||||
-1,
|
|
||||||
-1,
|
|
||||||
NULL,
|
|
||||||
STRING_TOKEN (STR_DRV_DIAG_ITEM_LINE),
|
|
||||||
gShellDriver1HiiHandle,
|
|
||||||
HandleIndex1,
|
|
||||||
HandleIndex2,
|
|
||||||
ChildHandleList == NULL?0:ConvertHandleToHandleIndex(ChildHandleList[ChildHandleListLoop])
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// If we are doing a single pass with NULL child jump out after a single loop
|
// If we are doing a single pass with NULL child jump out after a single loop
|
||||||
//
|
//
|
||||||
if (ChildHandleList == NULL) {
|
if (ChildHandleList == NULL) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (AllChilds) {
|
||||||
|
SHELL_FREE_NON_NULL(ChildHandleList);
|
||||||
|
ChildHandleList = NULL;
|
||||||
|
ChildHandleListCount = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (AllChilds) {
|
if (ControllerHandle == NULL) {
|
||||||
SHELL_FREE_NON_NULL(ChildHandleList);
|
SHELL_FREE_NON_NULL(ControllerHandleList);
|
||||||
ChildHandleList = NULL;
|
ControllerHandleList = NULL;
|
||||||
ChildHandleListCount = 0;
|
ControllerHandleListCount = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (ControllerHandle == NULL) {
|
|
||||||
SHELL_FREE_NON_NULL(ControllerHandleList);
|
|
||||||
ControllerHandleList = NULL;
|
|
||||||
ControllerHandleListCount = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DriverHandleList != NULL) {
|
if (DriverHandleList != NULL) {
|
||||||
@ -266,6 +334,12 @@ STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
|
|||||||
{NULL, TypeMax}
|
{NULL, TypeMax}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
Function for 'drvdiag' command.
|
||||||
|
|
||||||
|
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
||||||
|
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
||||||
|
**/
|
||||||
SHELL_STATUS
|
SHELL_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
ShellCommandRunDrvDiag (
|
ShellCommandRunDrvDiag (
|
||||||
@ -286,9 +360,10 @@ ShellCommandRunDrvDiag (
|
|||||||
EFI_HANDLE Handle1;
|
EFI_HANDLE Handle1;
|
||||||
EFI_HANDLE Handle2;
|
EFI_HANDLE Handle2;
|
||||||
EFI_HANDLE Handle3;
|
EFI_HANDLE Handle3;
|
||||||
|
UINT64 Intermediate;
|
||||||
|
|
||||||
ShellStatus = SHELL_SUCCESS;
|
ShellStatus = SHELL_SUCCESS;
|
||||||
Mode = TEST_MODE_MAX;
|
Mode = TestModeMax;
|
||||||
Language = NULL;
|
Language = NULL;
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -334,11 +409,11 @@ ShellCommandRunDrvDiag (
|
|||||||
// Run the apropriate test
|
// Run the apropriate test
|
||||||
//
|
//
|
||||||
if (ShellCommandLineGetFlag(Package, L"-s")) {
|
if (ShellCommandLineGetFlag(Package, L"-s")) {
|
||||||
Mode = TEST_MODE_STANDARD;
|
Mode = TestModeStandard;
|
||||||
} else if (ShellCommandLineGetFlag(Package, L"-e")) {
|
} else if (ShellCommandLineGetFlag(Package, L"-e")) {
|
||||||
Mode = TEST_MODE_EXTENDED;
|
Mode = TestModeExtended;
|
||||||
} else if (ShellCommandLineGetFlag(Package, L"-m")) {
|
} else if (ShellCommandLineGetFlag(Package, L"-m")) {
|
||||||
Mode = TEST_MODE_MANUFACTURING;
|
Mode = TestModeManufacturing;
|
||||||
} else {
|
} else {
|
||||||
ASSERT(FALSE);
|
ASSERT(FALSE);
|
||||||
}
|
}
|
||||||
@ -346,21 +421,18 @@ ShellCommandRunDrvDiag (
|
|||||||
//
|
//
|
||||||
// Do a listing of what's available to test
|
// Do a listing of what's available to test
|
||||||
//
|
//
|
||||||
Mode = TEST_MODE_LIST;
|
Mode = TestModeList;
|
||||||
}
|
}
|
||||||
|
|
||||||
Lang = ShellCommandLineGetValue(Package, L"-l");
|
Lang = ShellCommandLineGetValue(Package, L"-l");
|
||||||
if (Lang != NULL) {
|
if (ShellCommandLineGetFlag(Package, L"-l") && Lang == NULL) {
|
||||||
Language = AllocateZeroPool(StrSize(Lang));
|
|
||||||
AsciiSPrint(Language, StrSize(Lang), "%S", Lang);
|
|
||||||
} else if (!ShellCommandLineGetFlag(Package, L"-l")){
|
|
||||||
Language = AllocateZeroPool(10);
|
|
||||||
AsciiSPrint(Language, 10, "en-us");
|
|
||||||
} else {
|
|
||||||
ASSERT(Language == NULL);
|
ASSERT(Language == NULL);
|
||||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDriver1HiiHandle, L"-l");
|
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDriver1HiiHandle, L"-l");
|
||||||
ShellCommandLineFreeVarList (Package);
|
ShellCommandLineFreeVarList (Package);
|
||||||
return (SHELL_INVALID_PARAMETER);
|
return (SHELL_INVALID_PARAMETER);
|
||||||
|
} else if (Lang != NULL) {
|
||||||
|
Language = AllocateZeroPool(StrSize(Lang));
|
||||||
|
AsciiSPrint(Language, StrSize(Lang), "%S", Lang);
|
||||||
}
|
}
|
||||||
|
|
||||||
DriverHandleStr = ShellCommandLineGetRawValue(Package, 1);
|
DriverHandleStr = ShellCommandLineGetRawValue(Package, 1);
|
||||||
@ -370,17 +442,20 @@ ShellCommandRunDrvDiag (
|
|||||||
if (DriverHandleStr == NULL) {
|
if (DriverHandleStr == NULL) {
|
||||||
Handle1 = NULL;
|
Handle1 = NULL;
|
||||||
} else {
|
} else {
|
||||||
Handle1 = ConvertHandleIndexToHandle(StrHexToUintn(DriverHandleStr ));
|
ShellConvertStringToUint64(DriverHandleStr, &Intermediate, TRUE, FALSE);
|
||||||
|
Handle1 = ConvertHandleIndexToHandle((UINTN)Intermediate);
|
||||||
}
|
}
|
||||||
if (ControllerHandleStr == NULL) {
|
if (ControllerHandleStr == NULL) {
|
||||||
Handle2 = NULL;
|
Handle2 = NULL;
|
||||||
} else {
|
} else {
|
||||||
Handle2 = ConvertHandleIndexToHandle(StrHexToUintn(ControllerHandleStr));
|
ShellConvertStringToUint64(ControllerHandleStr, &Intermediate, TRUE, FALSE);
|
||||||
|
Handle2 = ConvertHandleIndexToHandle((UINTN)Intermediate);
|
||||||
}
|
}
|
||||||
if (ChildHandleStr == NULL) {
|
if (ChildHandleStr == NULL) {
|
||||||
Handle3 = NULL;
|
Handle3 = NULL;
|
||||||
} else {
|
} else {
|
||||||
Handle3 = ConvertHandleIndexToHandle(StrHexToUintn(ChildHandleStr ));
|
ShellConvertStringToUint64(ChildHandleStr, &Intermediate, TRUE, FALSE);
|
||||||
|
Handle3 = ConvertHandleIndexToHandle((UINTN)Intermediate);
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = DoDiagnostics (
|
Status = DoDiagnostics (
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Main file for OpenInfo shell Driver1 function.
|
Main file for OpenInfo shell Driver1 function.
|
||||||
|
|
||||||
Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -23,6 +23,14 @@ STATIC CONST CHAR16 StringExclusive[] = L"Exclusive";
|
|||||||
STATIC CONST CHAR16 StringDriverEx[] = L"DriverEx ";
|
STATIC CONST CHAR16 StringDriverEx[] = L"DriverEx ";
|
||||||
STATIC CONST CHAR16 StringUnknown[] = L"Unknown ";
|
STATIC CONST CHAR16 StringUnknown[] = L"Unknown ";
|
||||||
|
|
||||||
|
/**
|
||||||
|
Open the database and print out all the info about TheHandle.
|
||||||
|
|
||||||
|
@param[in] TheHandle The handle to print info on.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS The operation was successful.
|
||||||
|
@retval EFI_INVALID_PARAMETER TheHandle was NULL.
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
TraverseHandleDatabase (
|
TraverseHandleDatabase (
|
||||||
@ -41,7 +49,9 @@ TraverseHandleDatabase (
|
|||||||
UINTN HandleIndex;
|
UINTN HandleIndex;
|
||||||
CONST CHAR16 *Name;
|
CONST CHAR16 *Name;
|
||||||
|
|
||||||
ASSERT(TheHandle != NULL);
|
if (TheHandle == NULL) {
|
||||||
|
return (EFI_INVALID_PARAMETER);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Retrieve the list of all the protocols on the handle
|
// Retrieve the list of all the protocols on the handle
|
||||||
@ -145,6 +155,7 @@ ShellCommandRunOpenInfo (
|
|||||||
SHELL_STATUS ShellStatus;
|
SHELL_STATUS ShellStatus;
|
||||||
EFI_HANDLE TheHandle;
|
EFI_HANDLE TheHandle;
|
||||||
CONST CHAR16 *Param1;
|
CONST CHAR16 *Param1;
|
||||||
|
UINT64 Intermediate;
|
||||||
|
|
||||||
ShellStatus = SHELL_SUCCESS;
|
ShellStatus = SHELL_SUCCESS;
|
||||||
|
|
||||||
@ -181,13 +192,14 @@ ShellCommandRunOpenInfo (
|
|||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
} else {
|
} else {
|
||||||
Param1 = ShellCommandLineGetRawValue(Package, 1);
|
Param1 = ShellCommandLineGetRawValue(Package, 1);
|
||||||
if (Param1 == NULL || ConvertHandleIndexToHandle(StrHexToUintn(Param1)) == NULL){
|
Status = ShellConvertStringToUint64(Param1, &Intermediate, TRUE, FALSE);
|
||||||
|
if (EFI_ERROR(Status) || Param1 == NULL || ConvertHandleIndexToHandle((UINTN)Intermediate) == NULL){
|
||||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, Param1);
|
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, Param1);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
} else {
|
} else {
|
||||||
TheHandle = ConvertHandleIndexToHandle(StrHexToUintn(Param1));
|
TheHandle = ConvertHandleIndexToHandle((UINTN)Intermediate);
|
||||||
ASSERT(TheHandle != NULL);
|
ASSERT(TheHandle != NULL);
|
||||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_OPENINFO_HEADER_LINE), gShellDriver1HiiHandle, StrHexToUintn(Param1), TheHandle);
|
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_OPENINFO_HEADER_LINE), gShellDriver1HiiHandle, (UINTN)Intermediate, TheHandle);
|
||||||
|
|
||||||
Status = TraverseHandleDatabase (TheHandle);
|
Status = TraverseHandleDatabase (TheHandle);
|
||||||
if (!EFI_ERROR(Status)) {
|
if (!EFI_ERROR(Status)) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Main file for Reconnect shell Driver1 function.
|
Main file for Reconnect shell Driver1 function.
|
||||||
|
|
||||||
Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -14,6 +14,12 @@
|
|||||||
|
|
||||||
#include "UefiShellDriver1CommandsLib.h"
|
#include "UefiShellDriver1CommandsLib.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
Function for 'reconnect' command.
|
||||||
|
|
||||||
|
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
||||||
|
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
||||||
|
**/
|
||||||
SHELL_STATUS
|
SHELL_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
ShellCommandRunReconnect (
|
ShellCommandRunReconnect (
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Main file for NULL named library for level 1 shell command functions.
|
Main file for NULL named library for level 1 shell command functions.
|
||||||
|
|
||||||
Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -21,6 +21,11 @@ CONST EFI_GUID gShellDriver1HiiGuid = \
|
|||||||
0xaf0b742, 0x63ec, 0x45bd, {0x8d, 0xb6, 0x71, 0xad, 0x7f, 0x2f, 0xe8, 0xe8} \
|
0xaf0b742, 0x63ec, 0x45bd, {0x8d, 0xb6, 0x71, 0xad, 0x7f, 0x2f, 0xe8, 0xe8} \
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
Function to return the name of the file containing help if HII will not be used.
|
||||||
|
|
||||||
|
@return The filename.
|
||||||
|
**/
|
||||||
CONST CHAR16*
|
CONST CHAR16*
|
||||||
EFIAPI
|
EFIAPI
|
||||||
ShellCommandGetManFileNameDriver1 (
|
ShellCommandGetManFileNameDriver1 (
|
||||||
@ -81,6 +86,9 @@ UefiShellDriver1CommandsLibConstructor (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Destructor for the library. free any resources.
|
Destructor for the library. free any resources.
|
||||||
|
|
||||||
|
@param ImageHandle The image handle of the process.
|
||||||
|
@param SystemTable The EFI System Table pointer.
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Main file for NULL named library for Profile1 shell command functions.
|
Main file for NULL named library for Profile1 shell command functions.
|
||||||
|
|
||||||
Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -12,6 +12,9 @@
|
|||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
#if !defined (_UEFI_SHELL_DRIVER1_COMMANDS_LIB_H_)
|
||||||
|
#define _UEFI_SHELL_DRIVER1_COMMANDS_LIB_H_
|
||||||
|
|
||||||
#include <Uefi.h>
|
#include <Uefi.h>
|
||||||
#include <ShellBase.h>
|
#include <ShellBase.h>
|
||||||
|
|
||||||
@ -199,3 +202,5 @@ ShellCommandRunUnload (
|
|||||||
IN EFI_SYSTEM_TABLE *SystemTable
|
IN EFI_SYSTEM_TABLE *SystemTable
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
Binary file not shown.
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Main file for Unload shell Driver1 function.
|
Main file for Unload shell Driver1 function.
|
||||||
|
|
||||||
Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -145,10 +145,13 @@ ShellCommandRunUnload (
|
|||||||
EFI_HANDLE TheHandle;
|
EFI_HANDLE TheHandle;
|
||||||
CONST CHAR16 *Param1;
|
CONST CHAR16 *Param1;
|
||||||
SHELL_PROMPT_RESPONSE *Resp;
|
SHELL_PROMPT_RESPONSE *Resp;
|
||||||
|
UINT64 Value;
|
||||||
|
|
||||||
ShellStatus = SHELL_SUCCESS;
|
ShellStatus = SHELL_SUCCESS;
|
||||||
Package = NULL;
|
Package = NULL;
|
||||||
Resp = NULL;
|
Resp = NULL;
|
||||||
|
Value = 0;
|
||||||
|
TheHandle = NULL;
|
||||||
|
|
||||||
//
|
//
|
||||||
// initialize the shell lib (we must be in non-auto-init...)
|
// initialize the shell lib (we must be in non-auto-init...)
|
||||||
@ -179,24 +182,28 @@ ShellCommandRunUnload (
|
|||||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDriver1HiiHandle);
|
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDriver1HiiHandle);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
} else {
|
} else {
|
||||||
Param1 = ShellCommandLineGetRawValue(Package, 1);
|
Param1 = ShellCommandLineGetRawValue(Package, 1);
|
||||||
if (Param1 == NULL || ConvertHandleIndexToHandle(StrHexToUintn(Param1)) == NULL){
|
if (Param1 != NULL) {
|
||||||
|
Status = ShellConvertStringToUint64(Param1, &Value, TRUE, FALSE);
|
||||||
|
TheHandle = ConvertHandleIndexToHandle((UINTN)Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (EFI_ERROR(Status) || Param1 == NULL || TheHandle == NULL){
|
||||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, Param1);
|
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, Param1);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
} else {
|
} else {
|
||||||
TheHandle = ConvertHandleIndexToHandle(StrHexToUintn(Param1));
|
|
||||||
ASSERT(TheHandle != NULL);
|
ASSERT(TheHandle != NULL);
|
||||||
if (ShellCommandLineGetFlag(Package, L"-v") || ShellCommandLineGetFlag(Package, L"-verbose")) {
|
if (ShellCommandLineGetFlag(Package, L"-v") || ShellCommandLineGetFlag(Package, L"-verbose")) {
|
||||||
DumpLoadedImageProtocolInfo(TheHandle);
|
DumpLoadedImageProtocolInfo(TheHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ShellCommandLineGetFlag(Package, L"-n")) {
|
if (!ShellCommandLineGetFlag(Package, L"-n")) {
|
||||||
Status = ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_UNLOAD_CONF), gShellDriver1HiiHandle, StrHexToUintn(Param1));
|
Status = ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_UNLOAD_CONF), gShellDriver1HiiHandle, (UINTN)TheHandle);
|
||||||
Status = ShellPromptForResponse(ShellPromptResponseTypeYesNo, NULL, (VOID**)&Resp);
|
Status = ShellPromptForResponse(ShellPromptResponseTypeYesNo, NULL, (VOID**)&Resp);
|
||||||
}
|
}
|
||||||
if (ShellCommandLineGetFlag(Package, L"-n") || (Resp != NULL && *Resp == ShellPromptResponseYes)) {
|
if (ShellCommandLineGetFlag(Package, L"-n") || (Resp != NULL && *Resp == ShellPromptResponseYes)) {
|
||||||
Status = gBS->UnloadImage(TheHandle);
|
Status = gBS->UnloadImage(TheHandle);
|
||||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HANDLE_RESULT), gShellDriver1HiiHandle, L"Unload", StrHexToUintn(Param1), Status);
|
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HANDLE_RESULT), gShellDriver1HiiHandle, L"Unload", (UINTN)TheHandle, Status);
|
||||||
}
|
}
|
||||||
SHELL_FREE_NON_NULL(Resp);
|
SHELL_FREE_NON_NULL(Resp);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user