removing incorrect files.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10891 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
jcarsey 2010-09-17 21:32:38 +00:00
parent e97233217e
commit 89fb1cf0db
7 changed files with 0 additions and 945 deletions

View File

@ -1,273 +0,0 @@
/** @file
Main file for connect shell Driver1 function.
Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "UefiShellDriver1CommandsLib.h"
#include <Guid/GlobalVariable.h>
#include <Guid/ConsoleInDevice.h>
#include <Guid/ConsoleOutDevice.h>
EFI_STATUS
EFIAPI
ConnectControllers (
IN CONST EFI_HANDLE ControllerHandle,
IN CONST EFI_HANDLE DriverHandle,
IN CONST BOOLEAN Recursive,
IN CONST BOOLEAN Output
){
EFI_STATUS Status;
EFI_HANDLE *ControllerHandleList;
EFI_HANDLE *DriverHandleList;
EFI_HANDLE *HandleWalker;
ControllerHandleList = NULL;
Status = EFI_NOT_FOUND;
//
// If we have a single handle to connect make that a 'list'
//
if (DriverHandle == NULL) {
DriverHandleList = NULL;
} else {
DriverHandleList = AllocatePool(2*sizeof(EFI_HANDLE));
DriverHandleList[0] = DriverHandle;
DriverHandleList[1] = NULL;
}
//
// do we connect all controllers (with a loop) or a single one...
// This is where we call the gBS->ConnectController function.
//
if (ControllerHandle == NULL) {
ControllerHandleList = GetHandleListByPotocol(&gEfiDevicePathProtocolGuid);
for (HandleWalker = ControllerHandleList
; HandleWalker != NULL && *HandleWalker != NULL
; HandleWalker++
){
Status = gBS->ConnectController(*HandleWalker, DriverHandleList, NULL, Recursive);
if (Output) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_CON_RESULT), gShellDriver1HiiHandle, *HandleWalker, Status);
}
}
} else {
Status = gBS->ConnectController(ControllerHandle, DriverHandleList, NULL, Recursive);
ASSERT(Output == FALSE);
}
//
// Free any memory we allocated.
//
if (ControllerHandleList != NULL) {
FreePool(ControllerHandleList);
}
if (DriverHandleList != NULL) {
FreePool(DriverHandleList);
}
return (Status);
}
EFI_STATUS
EFIAPI
ConnectFromDevPaths (
IN CONST CHAR16 *Key
){
EFI_DEVICE_PATH_PROTOCOL *DevPath;
EFI_DEVICE_PATH_PROTOCOL *DevPathWalker;
UINTN Length;
EFI_HANDLE Handle;
EFI_STATUS Status;
DevPath = NULL;
Length = 0;
//
// Get the DevicePath buffer from the variable...
//
Status = gRT->GetVariable((CHAR16*)Key, (EFI_GUID*)&gEfiGlobalVariableGuid, NULL, &Length, DevPath);
if (Status == EFI_BUFFER_TOO_SMALL) {
DevPath = AllocatePool(Length);
Status = gRT->GetVariable((CHAR16*)Key, (EFI_GUID*)&gEfiGlobalVariableGuid, NULL, &Length, DevPath);
}
//
// walk the list of devices and connect them
//
for (DevPathWalker = DevPath
; DevPathWalker < (DevPath + Length) && !EFI_ERROR(Status) && DevPath != NULL
; DevPathWalker += GetDevicePathSize(DevPathWalker)
){
//
// get the correct handle from a given device path
//
if (StrCmp(Key, L"ConInDev") == 0) {
Status = gBS->LocateDevicePath((EFI_GUID*)&gEfiConsoleInDeviceGuid, &DevPathWalker, &Handle);
} else if (StrCmp(Key, L"ConOutDev") == 0) {
Status = gBS->LocateDevicePath((EFI_GUID*)&gEfiConsoleOutDeviceGuid, &DevPathWalker, &Handle);
} else {
Handle = NULL;
Status = EFI_INVALID_PARAMETER;
ASSERT(FALSE);
}
if (!EFI_ERROR(Status)) {
Status = ConnectControllers(Handle, NULL, FALSE, FALSE);
}
}
if (DevPath != NULL) {
FreePool(DevPath);
}
return (Status);
}
EFI_STATUS
EFIAPI
ConvertAndConnectControllers (
IN CONST CHAR16 *StringHandle1,
IN CONST CHAR16 *StringHandle2 OPTIONAL,
IN CONST BOOLEAN Recursive,
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 = (EFI_HANDLE)StrHexToUintn(StringHandle1);
} else {
Handle1 = NULL;
}
if (StringHandle2 != NULL) {
Handle2 = (EFI_HANDLE)StrHexToUintn(StringHandle2);
} else {
Handle2 = NULL;
}
//
// if only one is NULL verify it's the proper one...
//
if ( (Handle1 == NULL && Handle2 != NULL)
|| (Handle1 != NULL && Handle2 == NULL)
){
//
// Figure out which one should be NULL and move the handle to the right place.
// If Handle1 is NULL then test Handle2 and vise versa.
// The one that DOES has driver binding must be Handle2
//
if (Handle1 == NULL) {
if (EFI_ERROR(gBS->OpenProtocol(Handle2, &gEfiDriverBindingProtocolGuid, NULL, NULL, gImageHandle, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) {
// swap
Handle1 = Handle2;
Handle2 = NULL;
} else {
// We're all good...
}
} else {
if (EFI_ERROR(gBS->OpenProtocol(Handle1, &gEfiDriverBindingProtocolGuid, NULL, NULL, gImageHandle, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) {
// We're all good...
} else {
// swap
Handle2 = Handle1;
Handle1 = NULL;
}
}
}
return (ConnectControllers(Handle1, Handle2, Recursive, Output));
}
STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
{L"-c", TypeFlag},
{L"-r", TypeFlag},
{NULL, TypeMax}
};
SHELL_STATUS
EFIAPI
ShellCommandRunConnect (
VOID *RESERVED
) {
EFI_STATUS Status;
LIST_ENTRY *Package;
CHAR16 *ProblemParam;
SHELL_STATUS ShellStatus;
ShellStatus = SHELL_SUCCESS;
//
// initialize the shell lib (we must be in non-auto-init...)
//
Status = ShellInitialize();
ASSERT_EFI_ERROR(Status);
Status = CommandInit();
ASSERT_EFI_ERROR(Status);
//
// parse the command line
//
Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);
if EFI_ERROR(Status) {
if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDriver1HiiHandle, ProblemParam);
FreePool(ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
ASSERT(FALSE);
}
} else {
//
// if more than 2 'value' parameters (plus the name one) or either -r or -c with any value parameters we have too many parameters
//
if ((ShellCommandLineGetCount() > 3)
||((ShellCommandLineGetFlag(Package, L"-r") != FALSE || ShellCommandLineGetFlag(Package, L"-c") != FALSE) && ShellCommandLineGetCount()!=0)
){
//
// error for too many parameters
//
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDriver1HiiHandle);
ShellStatus = SHELL_INVALID_PARAMETER;
} else if (ShellCommandLineGetFlag(Package, L"-c") != FALSE) {
//
// do the conin and conout from EFI variables
// if the first fails dont 'loose' the error
//
Status = ConnectFromDevPaths(L"ConInDev");
if (EFI_ERROR(Status)) {
ConnectFromDevPaths(L"ConOutDev");
} else {
Status = ConnectFromDevPaths(L"ConOutDev");
}
ShellStatus = Status & (~MAX_BIT);
} else {
//
// 0, 1, or 2 specific handles and possibly recursive
//
if (ShellCommandLineGetRawValue(Package, 1) != NULL && CommandLibGetHandleValue(StrHexToUintn(ShellCommandLineGetRawValue(Package, 1))) == NULL){
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, ShellCommandLineGetRawValue(Package, 1));
ShellStatus = SHELL_INVALID_PARAMETER;
} else if (ShellCommandLineGetRawValue(Package, 2) != NULL && CommandLibGetHandleValue(StrHexToUintn(ShellCommandLineGetRawValue(Package, 2))) == NULL) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, ShellCommandLineGetRawValue(Package, 2));
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
Status = ConvertAndConnectControllers(ShellCommandLineGetRawValue(Package, 1), ShellCommandLineGetRawValue(Package, 2), ShellCommandLineGetFlag(Package, L"-r"), (BOOLEAN)(ShellCommandLineGetCount()!=0));
ShellStatus = Status & (~MAX_BIT);
}
}
ShellCommandLineFreeVarList (Package);
}
return (ShellStatus);
}

View File

@ -1,164 +0,0 @@
/** @file
Main file for devices shell Driver1 function.
Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "UefiShellDriver1CommandsLib.h"
EFI_STATUS
EFIAPI
GetDeviceHandleInfo (
IN EFI_HANDLE TheHandle,
IN CHAR16 *Type,
IN BOOLEAN *Cfg,
IN BOOLEAN *Diag,
IN UINT8 *Parents,
IN UINT8 *Devices,
IN UINT8 *Children,
OUT CHAR16 **Name,
IN CONST CHAR8 *Language
){
*Name = NULL;
gEfiShellProtocol->GetDeviceName(TheHandle, EFI_DEVICE_NAME_USE_COMPONENT_NAME|EFI_DEVICE_NAME_USE_DEVICE_PATH, (CHAR8*)Language, Name);
return (EFI_SUCCESS);
}
STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
{L"-l", TypeValue},
{NULL, TypeMax}
};
SHELL_STATUS
EFIAPI
ShellCommandRunDevices (
VOID *RESERVED
) {
EFI_STATUS Status;
LIST_ENTRY *Package;
CHAR16 *ProblemParam;
SHELL_STATUS ShellStatus;
CHAR8 *Language;
EFI_HANDLE *HandleList;
EFI_HANDLE *HandleListWalker;
CHAR16 Type;
BOOLEAN Cfg;
BOOLEAN Diag;
UINT8 Parents;
UINT8 Devices;
UINT8 Children;
CHAR16 *Name;
ShellStatus = SHELL_SUCCESS;
Language = NULL;
//
// initialize the shell lib (we must be in non-auto-init...)
//
Status = ShellInitialize();
ASSERT_EFI_ERROR(Status);
Status = CommandInit();
ASSERT_EFI_ERROR(Status);
//
// parse the command line
//
Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);
if EFI_ERROR(Status) {
if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDriver1HiiHandle, ProblemParam);
FreePool(ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
ASSERT(FALSE);
}
} else {
//
// if more than 0 'value' parameters we have too many parameters
//
if (ShellCommandLineGetRawValue(Package, 1) != NULL){
//
// error for too many parameters
//
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDriver1HiiHandle);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
//
// get the language if necessary
//
if (ShellCommandLineGetFlag(Package, L"-l") != FALSE) {
Language = AllocateZeroPool(StrSize(ShellCommandLineGetValue(Package, L"-l")));
AsciiSPrint(Language, StrSize(ShellCommandLineGetValue(Package, L"-l")), "%S", ShellCommandLineGetValue(Package, L"-l"));
}
//
// Print Header
//
ShellPrintHiiEx(-1, -1, Language, STRING_TOKEN (STR_DEVICES_HEADER_LINES), gShellDriver1HiiHandle);
//
// loop through each handle
//
HandleList = GetHandleListByPotocol(NULL);
ASSERT(HandleList != NULL);
for (HandleListWalker = HandleList
; HandleListWalker != NULL && *HandleListWalker != NULL && !EFI_ERROR(Status)
; HandleListWalker++
){
//
// get all the info on each handle
//
Status = GetDeviceHandleInfo(*HandleListWalker, &Type, &Cfg, &Diag, &Parents, &Devices, &Children, &Name, Language);
if (Parents != 0 || Devices != 0 || Children != 0) {
ShellPrintHiiEx(
-1,
-1,
Language,
STRING_TOKEN (STR_DEVICES_ITEM_LINE),
gShellDriver1HiiHandle,
*HandleListWalker,
Type,
Cfg!=FALSE?L'X':L'-',
Diag!=FALSE?L'X':L'-',
Parents,
Devices,
Children,
Name);
}
if (Name != NULL) {
FreePool(Name);
}
}
if (HandleList != NULL) {
FreePool(HandleList);
}
}
ShellCommandLineFreeVarList (Package);
}
return (ShellStatus);
}

View File

@ -1,243 +0,0 @@
/** @file
Main file for OpenInfo shell Driver1 function.
Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "UefiShellDriver1CommandsLib.h"
EFI_STATUS
EFIAPI
TraverseHandleDatabase (
IN CONST EFI_HANDLE DriverBindingHandle OPTIONAL,
IN CONST EFI_HANDLE ControllerHandle OPTIONAL,
IN UINTN *HandleCount,
OUT EFI_HANDLE **HandleBuffer,
OUT UINTN **HandleType
){
EFI_STATUS Status;
UINTN HandleIndex;
EFI_GUID **ProtocolGuidArray;
UINTN ArrayCount;
UINTN ProtocolIndex;
EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *OpenInfo;
UINTN OpenInfoCount;
UINTN OpenInfoIndex;
UINTN ChildIndex;
ASSERT(HandleCount != NULL);
ASSERT(HandleBuffer != NULL);
ASSERT(HandleType != NULL);
ASSERT(DriverBindingHandle != NULL || ControllerHandle != NULL);
*HandleCount = 0;
*HandleBuffer = NULL;
*HandleType = NULL;
//
// Retrieve the list of all handles from the handle database
//
Status = gBS->LocateHandleBuffer (
AllHandles,
NULL,
NULL,
HandleCount,
HandleBuffer
);
if (EFI_ERROR (Status)) {
return (Status);
}
*HandleType = AllocateZeroPool (*HandleCount * sizeof (UINTN));
ASSERT(*HandleType != NULL);
for (HandleIndex = 0; HandleIndex < *HandleCount; HandleIndex++) {
//
// Retrieve the list of all the protocols on each handle
//
Status = gBS->ProtocolsPerHandle (
(*HandleBuffer)[HandleIndex],
&ProtocolGuidArray,
&ArrayCount
);
if (!EFI_ERROR (Status)) {
for (ProtocolIndex = 0; ProtocolIndex < ArrayCount; ProtocolIndex++) {
//
// Set the bit describing what this handle has
//
if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiLoadedImageProtocolGuid) != FALSE) {
(*HandleType)[HandleIndex] |= HANDLE_RELATIONSHIP_IMAGE_HANDLE;
} else if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiDriverBindingProtocolGuid) != FALSE) {
(*HandleType)[HandleIndex] |= HANDLE_RELATIONSHIP_DRIVER_BINDING_HANDLE;
} else if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiDriverConfiguration2ProtocolGuid) != FALSE) {
(*HandleType)[HandleIndex] |= HANDLE_RELATIONSHIP_DRIVER_CONFIGURATION_HANDLE;
} else if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiDriverConfigurationProtocolGuid) != FALSE) {
(*HandleType)[HandleIndex] |= HANDLE_RELATIONSHIP_DRIVER_CONFIGURATION_HANDLE;
} else if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiDriverDiagnostics2ProtocolGuid) != FALSE) {
(*HandleType)[HandleIndex] |= HANDLE_RELATIONSHIP_DRIVER_DIAGNOSTICS_HANDLE;
} else if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiDriverDiagnosticsProtocolGuid) != FALSE) {
(*HandleType)[HandleIndex] |= HANDLE_RELATIONSHIP_DRIVER_DIAGNOSTICS_HANDLE;
} else if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiComponentName2ProtocolGuid) != FALSE) {
(*HandleType)[HandleIndex] |= HANDLE_RELATIONSHIP_COMPONENT_NAME_HANDLE;
} else if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiComponentNameProtocolGuid) != FALSE) {
(*HandleType)[HandleIndex] |= HANDLE_RELATIONSHIP_COMPONENT_NAME_HANDLE;
} else if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiDevicePathProtocolGuid) != FALSE) {
(*HandleType)[HandleIndex] |= HANDLE_RELATIONSHIP_DEVICE_HANDLE;
} else {
DEBUG_CODE_BEGIN();
ASSERT((*HandleType)[HandleIndex] == (*HandleType)[HandleIndex]);
DEBUG_CODE_END();
}
//
// Retrieve the list of agents that have opened each protocol
//
Status = gBS->OpenProtocolInformation (
(*HandleBuffer)[HandleIndex],
ProtocolGuidArray[ProtocolIndex],
&OpenInfo,
&OpenInfoCount
);
if (!EFI_ERROR (Status)) {
for (OpenInfoIndex = 0; OpenInfoIndex < OpenInfoCount; OpenInfoIndex++) {
if (DriverBindingHandle != NULL && OpenInfo[OpenInfoIndex].AgentHandle == DriverBindingHandle) {
if ((OpenInfo[OpenInfoIndex].Attributes & EFI_OPEN_PROTOCOL_BY_DRIVER) == EFI_OPEN_PROTOCOL_BY_DRIVER) {
//
// Mark the device handle as being managed by the driver specified by DriverBindingHandle
//
(*HandleType)[HandleIndex] |= (HANDLE_RELATIONSHIP_DEVICE_HANDLE | HANDLE_RELATIONSHIP_CONTROLLER_HANDLE);
}
if (ControllerHandle != NULL && (*HandleBuffer)[HandleIndex] == ControllerHandle) {
if ((OpenInfo[OpenInfoIndex].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) == EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) {
for (ChildIndex = 0; ChildIndex < *HandleCount; ChildIndex++) {
if ((*HandleBuffer)[ChildIndex] == OpenInfo[OpenInfoIndex].ControllerHandle) {
(*HandleType)[ChildIndex] |= (HANDLE_RELATIONSHIP_DEVICE_HANDLE | HANDLE_RELATIONSHIP_CHILD_HANDLE);
}
}
}
}
} else if (DriverBindingHandle == NULL && OpenInfo[OpenInfoIndex].ControllerHandle == ControllerHandle) {
if ((OpenInfo[OpenInfoIndex].Attributes & EFI_OPEN_PROTOCOL_BY_DRIVER) == EFI_OPEN_PROTOCOL_BY_DRIVER) {
for (ChildIndex = 0; ChildIndex < *HandleCount; ChildIndex++) {
if ((*HandleBuffer)[ChildIndex] == OpenInfo[OpenInfoIndex].AgentHandle) {
//
// mark the handle who opened this as a device driver
//
(*HandleType)[ChildIndex] |= HANDLE_RELATIONSHIP_DEVICE_DRIVER;
}
}
}
if ((OpenInfo[OpenInfoIndex].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) == EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) {
//
// this handle has people opening by child so it must be a parent
//
(*HandleType)[HandleIndex] |= HANDLE_RELATIONSHIP_PARENT_HANDLE;
for (ChildIndex = 0; ChildIndex < *HandleCount; ChildIndex++) {
if ((*HandleBuffer)[ChildIndex] == OpenInfo[OpenInfoIndex].AgentHandle) {
(*HandleType)[ChildIndex] |= HANDLE_RELATIONSHIP_BUS_DRIVER;
}
}
}
}
}
FreePool (OpenInfo);
}
}
FreePool (ProtocolGuidArray);
}
}
if (EFI_ERROR(Status)) {
if (*HandleType != NULL) {
FreePool (*HandleType);
}
if (*HandleBuffer != NULL) {
FreePool (*HandleBuffer);
}
*HandleCount = 0;
*HandleBuffer = NULL;
*HandleType = NULL;
}
return Status;
}
SHELL_STATUS
EFIAPI
ShellCommandRunOpenInfo (
VOID *RESERVED
) {
EFI_STATUS Status;
LIST_ENTRY *Package;
CHAR16 *ProblemParam;
SHELL_STATUS ShellStatus;
EFI_HANDLE theHandle;
EFI_HANDLE *HandleList;
UINTN Count;
UINTN *Type;
ShellStatus = SHELL_SUCCESS;
//
// initialize the shell lib (we must be in non-auto-init...)
//
Status = ShellInitialize();
ASSERT_EFI_ERROR(Status);
Status = CommandInit();
ASSERT_EFI_ERROR(Status);
//
// parse the command line
//
Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE);
if EFI_ERROR(Status) {
if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDriver1HiiHandle, ProblemParam);
FreePool(ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
ASSERT(FALSE);
}
} else {
if (ShellCommandLineGetCount() > 2){
//
// error for too many parameters
//
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDriver1HiiHandle);
ShellStatus = SHELL_INVALID_PARAMETER;
} else if (ShellCommandLineGetCount() == 0) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDriver1HiiHandle);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
if (ShellCommandLineGetRawValue(Package, 1) != NULL && CommandLibGetHandleValue(StrHexToUintn(ShellCommandLineGetRawValue(Package, 1))) == NULL){
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, ShellCommandLineGetRawValue(Package, 1));
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
theHandle = CommandLibGetHandleValue(StrHexToUintn(ShellCommandLineGetRawValue(Package, 1)));
ASSERT(theHandle != NULL);
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_OPENINFO_HEADER_LINE), gShellDriver1HiiHandle, StrHexToUintn(ShellCommandLineGetRawValue(Package, 1)), theHandle);
Status = TraverseHandleDatabase (NULL, theHandle, &Count, &HandleList, &Type);
if (EFI_ERROR(Status) == FALSE && Count > 0) {
} else {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, ShellCommandLineGetRawValue(Package, 1));
ShellStatus = SHELL_NOT_FOUND;
}
}
}
}
return (ShellStatus);
}

View File

@ -1,137 +0,0 @@
/** @file
Main file for NULL named library for level 1 shell command functions.
Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "UefiShellDriver1CommandsLib.h"
STATIC CONST CHAR16 mFileName[] = L"Driver1Commands";
EFI_HANDLE gShellDriver1HiiHandle = NULL;
CONST EFI_GUID gShellDriver1HiiGuid = \
{ \
0xaf0b742, 0x63ec, 0x45bd, {0x8d, 0xb6, 0x71, 0xad, 0x7f, 0x2f, 0xe8, 0xe8} \
};
CONST CHAR16*
EFIAPI
ShellCommandGetManFileNameDriver1 (
VOID
){
return (mFileName);
}
/**
Constructor for the Shell Driver1 Commands library.
@param ImageHandle the image handle of the process
@param SystemTable the EFI System Table pointer
@retval EFI_SUCCESS the shell command handlers were installed sucessfully
@retval EFI_UNSUPPORTED the shell level required was not found.
**/
EFI_STATUS
EFIAPI
UefiShellDriver1CommandsLibConstructor (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
) {
//
// check or bit of the profiles mask
//
if (PcdGet8(PcdShellProfileMask) && BIT0 == 0) {
return (EFI_UNSUPPORTED);
}
//
// install our shell command handlers that are always installed
//
ShellCommandRegisterCommandName(L"connect", ShellCommandRunConnect , ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE);
ShellCommandRegisterCommandName(L"devices", ShellCommandRunDevices , ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE);
ShellCommandRegisterCommandName(L"openinfo", ShellCommandRunOpenInfo , ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE);
/*
ShellCommandRegisterCommandName(L"devtree", ShellCommandRunDevTree , ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE);
ShellCommandRegisterCommandName(L"dh", ShellCommandRunDH , ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE);
ShellCommandRegisterCommandName(L"disconnect", ShellCommandRunDisconnect , ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE);
ShellCommandRegisterCommandName(L"drivers", ShellCommandRunDrivers , ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE);
ShellCommandRegisterCommandName(L"drvcfg", ShellCommandRunDrvCfg , ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE);
ShellCommandRegisterCommandName(L"drvdiag", ShellCommandRunDrvDiag , ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE);
ShellCommandRegisterCommandName(L"reconnect", ShellCommandRunReconnect , ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE);
ShellCommandRegisterCommandName(L"unload", ShellCommandRunUnload , ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE);
*/
//
// install the HII stuff.
//
gShellDriver1HiiHandle = HiiAddPackages (&gShellDriver1HiiGuid, gImageHandle, UefiShellDriver1CommandsLibStrings, NULL);
if (gShellDriver1HiiHandle == NULL) {
return (EFI_DEVICE_ERROR);
}
return (EFI_SUCCESS);
}
/**
Destructory for the library. free any resources.
**/
EFI_STATUS
EFIAPI
UefiShellDriver1CommandsLibDestructor (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
if (gShellDriver1HiiHandle != NULL) {
HiiRemovePackages(gShellDriver1HiiHandle);
}
return (EFI_SUCCESS);
}
EFI_HANDLE*
EFIAPI
GetHandleListByPotocol (
IN CONST EFI_GUID *ProtocolGuid
){
EFI_HANDLE *HandleList;
UINTN Size;
EFI_STATUS Status;
Size = 0;
HandleList = NULL;
//
// We cannot use LocateHandleBuffer since we need that NULL item on the ends of the list!
//
if (ProtocolGuid == NULL) {
Status = gBS->LocateHandle(AllHandles, NULL, NULL, &Size, HandleList);
if (Status == EFI_BUFFER_TOO_SMALL) {
HandleList = AllocatePool(Size + sizeof(EFI_HANDLE));
Status = gBS->LocateHandle(AllHandles, NULL, NULL, &Size, HandleList);
HandleList[Size/sizeof(EFI_HANDLE)] = NULL;
}
} else {
Status = gBS->LocateHandle(ByProtocol, (EFI_GUID*)ProtocolGuid, NULL, &Size, HandleList);
if (Status == EFI_BUFFER_TOO_SMALL) {
HandleList = AllocatePool(Size + sizeof(EFI_HANDLE));
Status = gBS->LocateHandle(ByProtocol, (EFI_GUID*)ProtocolGuid, NULL, &Size, HandleList);
HandleList[Size/sizeof(EFI_HANDLE)] = NULL;
}
}
if (EFI_ERROR(Status)) {
if (HandleList != NULL) {
FreePool(HandleList);
}
return (NULL);
}
return (HandleList);
}

View File

@ -1,71 +0,0 @@
/** @file
Main file for NULL named library for Profile1 shell command functions.
Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include <Uefi.h>
#include <ShellBase.h>
#include <Protocol/EfiShell.h>
#include <Protocol/EfiShellParameters.h>
#include <Protocol/DevicePath.h>
#include <Protocol/LoadedImage.h>
#include <Protocol/UnicodeCollation.h>
#include <Protocol/DevicePathToText.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/PcdLib.h>
#include <Library/ShellCommandLib.h>
#include <Library/ShellLib.h>
#include <Library/SortLib.h>
#include <Library/UefiLib.h>
#include <Library/UefiRuntimeServicesTableLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/HiiLib.h>
#include <Library/FileHandleLib.h>
#include <Library/DevicePathLib.h>
#include <Library/PrintLib.h>
extern EFI_HANDLE gShellDriver1HiiHandle;
extern CONST EFI_GUID gShellDriver1HiiGuid;
EFI_HANDLE*
EFIAPI
GetHandleListByPotocol (
IN CONST EFI_GUID *ProtocolGuid
);
SHELL_STATUS
EFIAPI
ShellCommandRunConnect (
VOID *RESERVED
);
SHELL_STATUS
EFIAPI
ShellCommandRunDevices (
VOID *RESERVED
);
SHELL_STATUS
EFIAPI
ShellCommandRunOpenInfo (
VOID *RESERVED
);

View File

@ -1,57 +0,0 @@
#/** @file
# Provides shell driver1 profile functions
#
# Copyright (c) 2010, Intel Corporation. All rights reserved. <BR>
#
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#
#
#**/
[Defines]
INF_VERSION = 0x00010006
BASE_NAME = UefiShellDriver1CommandsLib
FILE_GUID = 313D3674-3ED4-48fd-BF97-7DB35D4190D1
MODULE_TYPE = UEFI_DRIVER
VERSION_STRING = 1.0
LIBRARY_CLASS = NULL|UEFI_APPLICATION UEFI_DRIVER
CONSTRUCTOR = UefiShellDriver1CommandsLibConstructor
DESTRUCTOR = UefiShellDriver1CommandsLibDestructor
[Sources]
Connect.c
Devices.c
OpenInfo.c
UefiShellDriver1CommandsLib.c
UefiShellDriver1CommandsLib.h
UefiShellDriver1CommandsLib.uni
[Packages]
MdePkg/MdePkg.dec
ShellPkg/ShellPkg.dec
MdeModulePkg/MdeModulePkg.dec
[LibraryClasses]
MemoryAllocationLib
BaseLib
BaseMemoryLib
DebugLib
ShellCommandLib
ShellLib
UefiLib
UefiRuntimeServicesTableLib
UefiBootServicesTableLib
SortLib
PrintLib
[Pcd]
gEfiShellPkgTokenSpaceGuid.PcdShellProfileMask # ALWAYS_CONSUMED
[Guids]
gEfiGlobalVariableGuid
gEfiConsoleInDeviceGuid
gEfiConsoleOutDeviceGuid