mirror of https://github.com/acidanthera/audk.git
consist mapping - add comments and change variable names.
UefiShellCommandLib - add comments and zero out memory allocations. add guid to inf file. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11433 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
b0475f1289
commit
1a63ec8f82
|
@ -1,7 +1,7 @@
|
||||||
/** @file
|
/** @file
|
||||||
Main file for support of shell consist mapping.
|
Main file for support of shell consist mapping.
|
||||||
|
|
||||||
Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2005 - 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
|
||||||
|
@ -29,9 +29,9 @@ typedef struct {
|
||||||
} POOL_PRINT;
|
} POOL_PRINT;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
UINTN HI;
|
UINTN Hi;
|
||||||
MTD_TYPE MTD;
|
MTD_TYPE Mtd;
|
||||||
POOL_PRINT CSD;
|
POOL_PRINT Csd;
|
||||||
BOOLEAN Digital;
|
BOOLEAN Digital;
|
||||||
} DEVICE_CONSIST_MAPPING_INFO;
|
} DEVICE_CONSIST_MAPPING_INFO;
|
||||||
|
|
||||||
|
@ -43,8 +43,8 @@ typedef struct {
|
||||||
typedef struct {
|
typedef struct {
|
||||||
UINT8 Type;
|
UINT8 Type;
|
||||||
UINT8 SubType;
|
UINT8 SubType;
|
||||||
VOID (EFIAPI *SerialFun) (EFI_DEVICE_PATH_PROTOCOL *, DEVICE_CONSIST_MAPPING_INFO *);
|
VOID (EFIAPI *SerialFun) (EFI_DEVICE_PATH_PROTOCOL *DevPath, DEVICE_CONSIST_MAPPING_INFO *MapInfo);
|
||||||
INTN (EFIAPI *CompareFun) (EFI_DEVICE_PATH_PROTOCOL *, EFI_DEVICE_PATH_PROTOCOL *);
|
INTN (EFIAPI *CompareFun) (EFI_DEVICE_PATH_PROTOCOL *DevPath, EFI_DEVICE_PATH_PROTOCOL *DevPath2);
|
||||||
} DEV_PATH_CONSIST_MAPPING_TABLE;
|
} DEV_PATH_CONSIST_MAPPING_TABLE;
|
||||||
|
|
||||||
|
|
||||||
|
@ -128,7 +128,17 @@ MTD_NAME mMTDName[] = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
VOID
|
/**
|
||||||
|
Function to append a 64 bit number / 25 onto the string.
|
||||||
|
|
||||||
|
@param[in,out] Str The string so append onto.
|
||||||
|
@param[in] Num The number to divide and append.
|
||||||
|
|
||||||
|
@retval EFI_INVALID_PARAMETER A parameter was NULL.
|
||||||
|
@retval EFI_SUCCESS The appending was successful.
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
AppendCSDNum2 (
|
AppendCSDNum2 (
|
||||||
IN OUT POOL_PRINT *Str,
|
IN OUT POOL_PRINT *Str,
|
||||||
IN UINT64 Num
|
IN UINT64 Num
|
||||||
|
@ -137,7 +147,9 @@ AppendCSDNum2 (
|
||||||
UINT64 Result;
|
UINT64 Result;
|
||||||
UINT32 Rem;
|
UINT32 Rem;
|
||||||
|
|
||||||
ASSERT(Str != NULL);
|
if (Str == NULL) {
|
||||||
|
return (EFI_INVALID_PARAMETER);
|
||||||
|
}
|
||||||
|
|
||||||
Result = DivU64x32Remainder (Num, 25, &Rem);
|
Result = DivU64x32Remainder (Num, 25, &Rem);
|
||||||
if (Result > 0) {
|
if (Result > 0) {
|
||||||
|
@ -145,35 +157,61 @@ AppendCSDNum2 (
|
||||||
}
|
}
|
||||||
|
|
||||||
CatPrint (Str, L"%c", Rem + 'a');
|
CatPrint (Str, L"%c", Rem + 'a');
|
||||||
|
return (EFI_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
/**
|
||||||
|
Function to append a 64 bit number onto the mapping info.
|
||||||
|
|
||||||
|
@param[in,out] MappingItem The mapping info object to append onto.
|
||||||
|
@param[in] Num The info to append.
|
||||||
|
|
||||||
|
@retval EFI_INVALID_PARAMETER A parameter was NULL.
|
||||||
|
@retval EFI_SUCCESS The appending was successful.
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
AppendCSDNum (
|
AppendCSDNum (
|
||||||
DEVICE_CONSIST_MAPPING_INFO *MappingItem,
|
IN OUT DEVICE_CONSIST_MAPPING_INFO *MappingItem,
|
||||||
UINT64 Num
|
IN UINT64 Num
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ASSERT(MappingItem != NULL);
|
if (MappingItem == NULL) {
|
||||||
|
return EFI_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
if (MappingItem->Digital) {
|
if (MappingItem->Digital) {
|
||||||
CatPrint (&MappingItem->CSD, L"%ld", Num);
|
CatPrint (&MappingItem->Csd, L"%ld", Num);
|
||||||
} else {
|
} else {
|
||||||
AppendCSDNum2 (&MappingItem->CSD, Num);
|
AppendCSDNum2 (&MappingItem->Csd, Num);
|
||||||
}
|
}
|
||||||
|
|
||||||
MappingItem->Digital = (BOOLEAN)!(MappingItem->Digital);
|
MappingItem->Digital = (BOOLEAN)!(MappingItem->Digital);
|
||||||
|
|
||||||
|
return (EFI_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
/**
|
||||||
|
Function to append string into the mapping info.
|
||||||
|
|
||||||
|
@param[in,out] MappingItem The mapping info object to append onto.
|
||||||
|
@param[in] Str The info to append.
|
||||||
|
|
||||||
|
@retval EFI_INVALID_PARAMETER A parameter was NULL.
|
||||||
|
@retval EFI_SUCCESS The appending was successful.
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
AppendCSDStr (
|
AppendCSDStr (
|
||||||
DEVICE_CONSIST_MAPPING_INFO *MappingItem,
|
IN OUT DEVICE_CONSIST_MAPPING_INFO *MappingItem,
|
||||||
CHAR16 *Str
|
IN CHAR16 *Str
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
CHAR16 *Index;
|
CHAR16 *Index;
|
||||||
|
|
||||||
ASSERT(Str != NULL);
|
if (Str == NULL || MappingItem == NULL) {
|
||||||
ASSERT(MappingItem != NULL);
|
return (EFI_INVALID_PARAMETER);
|
||||||
|
}
|
||||||
|
|
||||||
if (MappingItem->Digital) {
|
if (MappingItem->Digital) {
|
||||||
//
|
//
|
||||||
|
@ -192,11 +230,11 @@ AppendCSDStr (
|
||||||
case '7':
|
case '7':
|
||||||
case '8':
|
case '8':
|
||||||
case '9':
|
case '9':
|
||||||
CatPrint (&MappingItem->CSD, L"%c", *Index);
|
CatPrint (&MappingItem->Csd, L"%c", *Index);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '1':
|
case '1':
|
||||||
CatPrint (&MappingItem->CSD, L"16");
|
CatPrint (&MappingItem->Csd, L"16");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'a':
|
case 'a':
|
||||||
|
@ -205,7 +243,7 @@ AppendCSDStr (
|
||||||
case 'd':
|
case 'd':
|
||||||
case 'e':
|
case 'e':
|
||||||
case 'f':
|
case 'f':
|
||||||
CatPrint (&MappingItem->CSD, L"1%c", *Index - 'a' + '0');
|
CatPrint (&MappingItem->Csd, L"1%c", *Index - 'a' + '0');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'A':
|
case 'A':
|
||||||
|
@ -214,7 +252,7 @@ AppendCSDStr (
|
||||||
case 'D':
|
case 'D':
|
||||||
case 'E':
|
case 'E':
|
||||||
case 'F':
|
case 'F':
|
||||||
CatPrint (&MappingItem->CSD, L"1%c", *Index - 'A' + '0');
|
CatPrint (&MappingItem->Csd, L"1%c", *Index - 'A' + '0');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -226,27 +264,41 @@ AppendCSDStr (
|
||||||
// a b c d e f g h i j k l m n o p
|
// a b c d e f g h i j k l m n o p
|
||||||
//
|
//
|
||||||
if (*Index >= '0' && *Index <= '9') {
|
if (*Index >= '0' && *Index <= '9') {
|
||||||
CatPrint (&MappingItem->CSD, L"%c", *Index - '0' + 'a');
|
CatPrint (&MappingItem->Csd, L"%c", *Index - '0' + 'a');
|
||||||
} else if (*Index >= 'a' && *Index <= 'f') {
|
} else if (*Index >= 'a' && *Index <= 'f') {
|
||||||
CatPrint (&MappingItem->CSD, L"%c", *Index - 'a' + 'k');
|
CatPrint (&MappingItem->Csd, L"%c", *Index - 'a' + 'k');
|
||||||
} else if (*Index >= 'A' && *Index <= 'F') {
|
} else if (*Index >= 'A' && *Index <= 'F') {
|
||||||
CatPrint (&MappingItem->CSD, L"%c", *Index - 'A' + 'k');
|
CatPrint (&MappingItem->Csd, L"%c", *Index - 'A' + 'k');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MappingItem->Digital = (BOOLEAN)!(MappingItem->Digital);
|
MappingItem->Digital = (BOOLEAN)!(MappingItem->Digital);
|
||||||
|
|
||||||
|
return (EFI_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
/**
|
||||||
|
Function to append a Guid to the mapping item.
|
||||||
|
|
||||||
|
@param[in,out] MappingItem The item to append onto.
|
||||||
|
@param[in] Guid The guid to append.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS The appending operation was successful.
|
||||||
|
@retval EFI_INVALID_PARAMETER A parameter was NULL.
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
AppendCSDGuid (
|
AppendCSDGuid (
|
||||||
DEVICE_CONSIST_MAPPING_INFO *MappingItem,
|
DEVICE_CONSIST_MAPPING_INFO *MappingItem,
|
||||||
EFI_GUID *Guid
|
EFI_GUID *Guid
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
CHAR16 Buffer[64];
|
CHAR16 Buffer[64];
|
||||||
ASSERT(Guid != NULL);
|
|
||||||
ASSERT(MappingItem != NULL);
|
if (Guid == NULL || MappingItem == NULL) {
|
||||||
|
return (EFI_INVALID_PARAMETER);
|
||||||
|
}
|
||||||
|
|
||||||
UnicodeSPrint (
|
UnicodeSPrint (
|
||||||
Buffer,
|
Buffer,
|
||||||
|
@ -254,13 +306,24 @@ AppendCSDGuid (
|
||||||
L"%g",
|
L"%g",
|
||||||
Guid
|
Guid
|
||||||
);
|
);
|
||||||
// StrLwr (Buffer);
|
|
||||||
AppendCSDStr (MappingItem, Buffer);
|
AppendCSDStr (MappingItem, Buffer);
|
||||||
|
|
||||||
|
return (EFI_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Function to compare 2 APCI device paths.
|
||||||
|
|
||||||
|
@param[in] DevicePath1 The first device path to compare.
|
||||||
|
@param[in] DevicePath2 The second device path to compare.
|
||||||
|
|
||||||
|
@retval 0 The device paths represent the same device.
|
||||||
|
@return Non zero if the devices are different, zero otherwise.
|
||||||
|
**/
|
||||||
INTN
|
INTN
|
||||||
EFIAPI
|
EFIAPI
|
||||||
_DevPathCompareAcpi (
|
DevPathCompareAcpi (
|
||||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath1,
|
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath1,
|
||||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath2
|
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath2
|
||||||
)
|
)
|
||||||
|
@ -268,8 +331,9 @@ _DevPathCompareAcpi (
|
||||||
ACPI_HID_DEVICE_PATH *Acpi1;
|
ACPI_HID_DEVICE_PATH *Acpi1;
|
||||||
ACPI_HID_DEVICE_PATH *Acpi2;
|
ACPI_HID_DEVICE_PATH *Acpi2;
|
||||||
|
|
||||||
ASSERT(DevicePath1 != NULL);
|
if (DevicePath1 == NULL || DevicePath2 == NULL) {
|
||||||
ASSERT(DevicePath2 != NULL);
|
return (-2);
|
||||||
|
}
|
||||||
|
|
||||||
Acpi1 = (ACPI_HID_DEVICE_PATH *) DevicePath1;
|
Acpi1 = (ACPI_HID_DEVICE_PATH *) DevicePath1;
|
||||||
Acpi2 = (ACPI_HID_DEVICE_PATH *) DevicePath2;
|
Acpi2 = (ACPI_HID_DEVICE_PATH *) DevicePath2;
|
||||||
|
@ -284,9 +348,18 @@ _DevPathCompareAcpi (
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Function to compare 2 PCI device paths.
|
||||||
|
|
||||||
|
@param[in] DevicePath1 The first device path to compare.
|
||||||
|
@param[in] DevicePath2 The second device path to compare.
|
||||||
|
|
||||||
|
@retval 0 The device paths represent the same device.
|
||||||
|
@return Non zero if the devices are different, zero otherwise.
|
||||||
|
**/
|
||||||
INTN
|
INTN
|
||||||
EFIAPI
|
EFIAPI
|
||||||
_DevPathComparePci (
|
DevPathComparePci (
|
||||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath1,
|
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath1,
|
||||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath2
|
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath2
|
||||||
)
|
)
|
||||||
|
@ -363,8 +436,8 @@ DevPathSerialHardDrive (
|
||||||
ASSERT(MappingItem != NULL);
|
ASSERT(MappingItem != NULL);
|
||||||
|
|
||||||
Hd = (HARDDRIVE_DEVICE_PATH *) DevicePathNode;
|
Hd = (HARDDRIVE_DEVICE_PATH *) DevicePathNode;
|
||||||
if (MappingItem->MTD == MTDTypeUnknown) {
|
if (MappingItem->Mtd == MTDTypeUnknown) {
|
||||||
MappingItem->MTD = MTDTypeHardDisk;
|
MappingItem->Mtd = MTDTypeHardDisk;
|
||||||
}
|
}
|
||||||
|
|
||||||
AppendCSDNum (MappingItem, Hd->PartitionNumber);
|
AppendCSDNum (MappingItem, Hd->PartitionNumber);
|
||||||
|
@ -411,7 +484,7 @@ DevPathSerialCdRom (
|
||||||
ASSERT(MappingItem != NULL);
|
ASSERT(MappingItem != NULL);
|
||||||
|
|
||||||
Cd = (CDROM_DEVICE_PATH *) DevicePathNode;
|
Cd = (CDROM_DEVICE_PATH *) DevicePathNode;
|
||||||
MappingItem->MTD = MTDTypeCDRom;
|
MappingItem->Mtd = MTDTypeCDRom;
|
||||||
AppendCSDNum (MappingItem, Cd->BootEntry);
|
AppendCSDNum (MappingItem, Cd->BootEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -491,6 +564,7 @@ DevPathSerialUsb (
|
||||||
|
|
||||||
@param[in] DevicePathNode The node to get info on.
|
@param[in] DevicePathNode The node to get info on.
|
||||||
@param[in] MappingItem The info item to populate.
|
@param[in] MappingItem The info item to populate.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
EFIAPI
|
EFIAPI
|
||||||
|
@ -501,15 +575,15 @@ DevPathSerialVendor (
|
||||||
{
|
{
|
||||||
VENDOR_DEVICE_PATH *Vendor;
|
VENDOR_DEVICE_PATH *Vendor;
|
||||||
SAS_DEVICE_PATH *Sas;
|
SAS_DEVICE_PATH *Sas;
|
||||||
EFI_GUID SasVendorGuid = DEVICE_PATH_MESSAGING_SAS;
|
|
||||||
|
|
||||||
ASSERT(DevicePathNode != NULL);
|
if (DevicePathNode == NULL || MappingItem == NULL) {
|
||||||
ASSERT(MappingItem != NULL);
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Vendor = (VENDOR_DEVICE_PATH *) DevicePathNode;
|
Vendor = (VENDOR_DEVICE_PATH *) DevicePathNode;
|
||||||
AppendCSDGuid (MappingItem, &Vendor->Guid);
|
AppendCSDGuid (MappingItem, &Vendor->Guid);
|
||||||
|
|
||||||
if (CompareGuid (&SasVendorGuid, &Vendor->Guid) == 0) {
|
if (CompareGuid (&gEfiSasDevicePathGuid, &Vendor->Guid)) {
|
||||||
Sas = (SAS_DEVICE_PATH *) Vendor;
|
Sas = (SAS_DEVICE_PATH *) Vendor;
|
||||||
AppendCSDNum (MappingItem, Sas->SasAddress);
|
AppendCSDNum (MappingItem, Sas->SasAddress);
|
||||||
AppendCSDNum (MappingItem, Sas->Lun);
|
AppendCSDNum (MappingItem, Sas->Lun);
|
||||||
|
@ -579,7 +653,7 @@ DevPathSerialIScsi (
|
||||||
{
|
{
|
||||||
///@todo make this a PCD
|
///@todo make this a PCD
|
||||||
//
|
//
|
||||||
// As CSD of ISCSI node is quite long, we comment
|
// As Csd of ISCSI node is quite long, we comment
|
||||||
// the code below to keep the consistent mapping
|
// the code below to keep the consistent mapping
|
||||||
// short. Uncomment if you really need it.
|
// short. Uncomment if you really need it.
|
||||||
//
|
//
|
||||||
|
@ -626,13 +700,13 @@ DevPathSerialI2O (
|
||||||
IN DEVICE_CONSIST_MAPPING_INFO *MappingItem
|
IN DEVICE_CONSIST_MAPPING_INFO *MappingItem
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
I2O_DEVICE_PATH *I2O;
|
I2O_DEVICE_PATH *DevicePath_I20;
|
||||||
|
|
||||||
ASSERT(DevicePathNode != NULL);
|
ASSERT(DevicePathNode != NULL);
|
||||||
ASSERT(MappingItem != NULL);
|
ASSERT(MappingItem != NULL);
|
||||||
|
|
||||||
I2O = (I2O_DEVICE_PATH *) DevicePathNode;
|
DevicePath_I20 = (I2O_DEVICE_PATH *) DevicePathNode;
|
||||||
AppendCSDNum (MappingItem, I2O->Tid);
|
AppendCSDNum (MappingItem, DevicePath_I20->Tid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -819,14 +893,14 @@ DevPathSerial1394 (
|
||||||
IN DEVICE_CONSIST_MAPPING_INFO *MappingItem
|
IN DEVICE_CONSIST_MAPPING_INFO *MappingItem
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
F1394_DEVICE_PATH *F1394;
|
F1394_DEVICE_PATH *DevicePath_F1394;
|
||||||
CHAR16 Buffer[20];
|
CHAR16 Buffer[20];
|
||||||
|
|
||||||
ASSERT(DevicePathNode != NULL);
|
ASSERT(DevicePathNode != NULL);
|
||||||
ASSERT(MappingItem != NULL);
|
ASSERT(MappingItem != NULL);
|
||||||
|
|
||||||
F1394 = (F1394_DEVICE_PATH *) DevicePathNode;
|
DevicePath_F1394 = (F1394_DEVICE_PATH *) DevicePathNode;
|
||||||
UnicodeSPrint (Buffer, 0, L"%lx", F1394->Guid);
|
UnicodeSPrint (Buffer, 0, L"%lx", DevicePath_F1394->Guid);
|
||||||
AppendCSDStr (MappingItem, Buffer);
|
AppendCSDStr (MappingItem, Buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -851,7 +925,7 @@ DevPathSerialAcpi (
|
||||||
Acpi = (ACPI_HID_DEVICE_PATH *) DevicePathNode;
|
Acpi = (ACPI_HID_DEVICE_PATH *) DevicePathNode;
|
||||||
if ((Acpi->HID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) {
|
if ((Acpi->HID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) {
|
||||||
if (EISA_ID_TO_NUM (Acpi->HID) == 0x0604) {
|
if (EISA_ID_TO_NUM (Acpi->HID) == 0x0604) {
|
||||||
MappingItem->MTD = MTDTypeFloppy;
|
MappingItem->Mtd = MTDTypeFloppy;
|
||||||
AppendCSDNum (MappingItem, Acpi->UID);
|
AppendCSDNum (MappingItem, Acpi->UID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -860,6 +934,9 @@ DevPathSerialAcpi (
|
||||||
/**
|
/**
|
||||||
Empty function used for unknown devices.
|
Empty function used for unknown devices.
|
||||||
|
|
||||||
|
@param[in] DevicePathNode Ignored.
|
||||||
|
@param[in] MappingItem Ignored.
|
||||||
|
|
||||||
Does nothing.
|
Does nothing.
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
|
@ -869,17 +946,18 @@ DevPathSerialDefault (
|
||||||
IN DEVICE_CONSIST_MAPPING_INFO *MappingItem
|
IN DEVICE_CONSIST_MAPPING_INFO *MappingItem
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEV_PATH_CONSIST_MAPPING_TABLE DevPathConsistMappingTable[] = {
|
DEV_PATH_CONSIST_MAPPING_TABLE DevPathConsistMappingTable[] = {
|
||||||
HARDWARE_DEVICE_PATH,
|
HARDWARE_DEVICE_PATH,
|
||||||
HW_PCI_DP,
|
HW_PCI_DP,
|
||||||
DevPathSerialDefault,
|
DevPathSerialDefault,
|
||||||
_DevPathComparePci,
|
DevPathComparePci,
|
||||||
ACPI_DEVICE_PATH,
|
ACPI_DEVICE_PATH,
|
||||||
ACPI_DP,
|
ACPI_DP,
|
||||||
DevPathSerialAcpi,
|
DevPathSerialAcpi,
|
||||||
_DevPathCompareAcpi,
|
DevPathCompareAcpi,
|
||||||
MESSAGING_DEVICE_PATH,
|
MESSAGING_DEVICE_PATH,
|
||||||
MSG_ATAPI_DP,
|
MSG_ATAPI_DP,
|
||||||
DevPathSerialAtapi,
|
DevPathSerialAtapi,
|
||||||
|
@ -963,8 +1041,8 @@ DEV_PATH_CONSIST_MAPPING_TABLE DevPathConsistMappingTable[] = {
|
||||||
|
|
||||||
@param[in] DevicePathNode The node to check.
|
@param[in] DevicePathNode The node to check.
|
||||||
|
|
||||||
@retval TRUE The node is HI.
|
@retval TRUE The node is Hi.
|
||||||
@retval FALSE The node is not HI.
|
@retval FALSE The node is not Hi.
|
||||||
**/
|
**/
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
EFIAPI
|
EFIAPI
|
||||||
|
@ -997,11 +1075,11 @@ IsHIDevicePathNode (
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Function to convert a standard device path structure into a HI version.
|
Function to convert a standard device path structure into a Hi version.
|
||||||
|
|
||||||
@param[in] DevicePath The device path to convert.
|
@param[in] DevicePath The device path to convert.
|
||||||
|
|
||||||
@return the device path portion that is HI.
|
@return the device path portion that is Hi.
|
||||||
**/
|
**/
|
||||||
EFI_DEVICE_PATH_PROTOCOL *
|
EFI_DEVICE_PATH_PROTOCOL *
|
||||||
EFIAPI
|
EFIAPI
|
||||||
|
@ -1019,7 +1097,7 @@ GetHIDevicePath (
|
||||||
|
|
||||||
NonHIDevicePathNodeCount = 0;
|
NonHIDevicePathNodeCount = 0;
|
||||||
|
|
||||||
HIDevicePath = AllocatePool (sizeof (EFI_DEVICE_PATH_PROTOCOL));
|
HIDevicePath = AllocateZeroPool (sizeof (EFI_DEVICE_PATH_PROTOCOL));
|
||||||
SetDevicePathEndNode (HIDevicePath);
|
SetDevicePathEndNode (HIDevicePath);
|
||||||
|
|
||||||
Node.DevPath.Type = END_DEVICE_PATH_TYPE;
|
Node.DevPath.Type = END_DEVICE_PATH_TYPE;
|
||||||
|
@ -1072,7 +1150,7 @@ GetDeviceConsistMappingInfo (
|
||||||
ASSERT(DevicePath != NULL);
|
ASSERT(DevicePath != NULL);
|
||||||
ASSERT(MappingItem != NULL);
|
ASSERT(MappingItem != NULL);
|
||||||
|
|
||||||
SetMem (&MappingItem->CSD, sizeof (POOL_PRINT), 0);
|
SetMem (&MappingItem->Csd, sizeof (POOL_PRINT), 0);
|
||||||
|
|
||||||
while (!IsDevicePathEnd (DevicePath)) {
|
while (!IsDevicePathEnd (DevicePath)) {
|
||||||
//
|
//
|
||||||
|
@ -1212,7 +1290,7 @@ ShellCommandConsistMappingUnInitialize (
|
||||||
This must be called after ShellCommandConsistMappingInitialize() and
|
This must be called after ShellCommandConsistMappingInitialize() and
|
||||||
before ShellCommandConsistMappingUnInitialize() is called.
|
before ShellCommandConsistMappingUnInitialize() is called.
|
||||||
|
|
||||||
@param[in] DeviecPath The pointer to the dev path for the device.
|
@param[in] DevicePath The pointer to the dev path for the device.
|
||||||
@param[in] Table The Table of mapping information.
|
@param[in] Table The Table of mapping information.
|
||||||
|
|
||||||
@retval NULL A consistent mapped name could not be created.
|
@retval NULL A consistent mapped name could not be created.
|
||||||
|
@ -1221,8 +1299,8 @@ ShellCommandConsistMappingUnInitialize (
|
||||||
CHAR16 *
|
CHAR16 *
|
||||||
EFIAPI
|
EFIAPI
|
||||||
ShellCommandConsistMappingGenMappingName (
|
ShellCommandConsistMappingGenMappingName (
|
||||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
||||||
EFI_DEVICE_PATH_PROTOCOL **Table
|
IN EFI_DEVICE_PATH_PROTOCOL **Table
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
POOL_PRINT Str;
|
POOL_PRINT Str;
|
||||||
|
@ -1250,15 +1328,15 @@ ShellCommandConsistMappingGenMappingName (
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
MappingInfo.HI = Index;
|
MappingInfo.Hi = Index;
|
||||||
MappingInfo.MTD = MTDTypeUnknown;
|
MappingInfo.Mtd = MTDTypeUnknown;
|
||||||
MappingInfo.Digital = FALSE;
|
MappingInfo.Digital = FALSE;
|
||||||
|
|
||||||
GetDeviceConsistMappingInfo (&MappingInfo, DevicePath);
|
GetDeviceConsistMappingInfo (&MappingInfo, DevicePath);
|
||||||
|
|
||||||
SetMem (&Str, sizeof (Str), 0);
|
SetMem (&Str, sizeof (Str), 0);
|
||||||
for (Index = 0; mMTDName[Index].MTDType != MTDTypeEnd; Index++) {
|
for (Index = 0; mMTDName[Index].MTDType != MTDTypeEnd; Index++) {
|
||||||
if (MappingInfo.MTD == mMTDName[Index].MTDType) {
|
if (MappingInfo.Mtd == mMTDName[Index].MTDType) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1267,10 +1345,10 @@ ShellCommandConsistMappingGenMappingName (
|
||||||
CatPrint (&Str, L"%s", mMTDName[Index].Name);
|
CatPrint (&Str, L"%s", mMTDName[Index].Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
CatPrint (&Str, L"%d", (UINTN) MappingInfo.HI);
|
CatPrint (&Str, L"%d", (UINTN) MappingInfo.Hi);
|
||||||
if (MappingInfo.CSD.Str != NULL) {
|
if (MappingInfo.Csd.Str != NULL) {
|
||||||
CatPrint (&Str, L"%s", MappingInfo.CSD.Str);
|
CatPrint (&Str, L"%s", MappingInfo.Csd.Str);
|
||||||
FreePool (MappingInfo.CSD.Str);
|
FreePool (MappingInfo.Csd.Str);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Str.Str != NULL) {
|
if (Str.Str != NULL) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/** @file
|
/** @file
|
||||||
Provides interface to shell internal functions for shell commands.
|
Provides interface to shell internal functions for shell commands.
|
||||||
|
|
||||||
Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2009 - 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
|
||||||
|
@ -17,7 +17,7 @@
|
||||||
/// The tag for use in identifying UNICODE files.
|
/// The tag for use in identifying UNICODE files.
|
||||||
/// If the file is UNICODE, the first 16 bits of the file will equal this value.
|
/// If the file is UNICODE, the first 16 bits of the file will equal this value.
|
||||||
enum {
|
enum {
|
||||||
UnicodeFileTag = 0xFEFF
|
gUnicodeFileTag = 0xFEFF
|
||||||
};
|
};
|
||||||
|
|
||||||
// STATIC local variables
|
// STATIC local variables
|
||||||
|
@ -207,6 +207,12 @@ ShellCommandLibDestructor (
|
||||||
FreePool(mProfileList);
|
FreePool(mProfileList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gEfiShellProtocol = NULL;
|
||||||
|
gEfiShellParametersProtocol = NULL;
|
||||||
|
gUnicodeCollation = NULL;
|
||||||
|
gDevPathToText = NULL;
|
||||||
|
gShellCurDir = NULL;
|
||||||
|
|
||||||
return (RETURN_SUCCESS);
|
return (RETURN_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -374,9 +380,9 @@ ShellCommandRegisterCommandName (
|
||||||
//
|
//
|
||||||
// allocate memory for new struct
|
// allocate memory for new struct
|
||||||
//
|
//
|
||||||
Node = AllocatePool(sizeof(SHELL_COMMAND_INTERNAL_LIST_ENTRY));
|
Node = AllocateZeroPool(sizeof(SHELL_COMMAND_INTERNAL_LIST_ENTRY));
|
||||||
ASSERT(Node != NULL);
|
ASSERT(Node != NULL);
|
||||||
Node->CommandString = AllocatePool(StrSize(CommandString));
|
Node->CommandString = AllocateZeroPool(StrSize(CommandString));
|
||||||
ASSERT(Node->CommandString != NULL);
|
ASSERT(Node->CommandString != NULL);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -440,8 +446,6 @@ ShellCommandGetProfileList (
|
||||||
information will be returned. If Sections is NULL, then all help text information
|
information will be returned. If Sections is NULL, then all help text information
|
||||||
available will be returned.
|
available will be returned.
|
||||||
|
|
||||||
@param Sections pointer to string representing which section to get help on.
|
|
||||||
|
|
||||||
@param[in] CommandString Pointer to the command name. This is the name
|
@param[in] CommandString Pointer to the command name. This is the name
|
||||||
found on the command line in the shell.
|
found on the command line in the shell.
|
||||||
@param[in,out] RetVal Pointer to the return vaule from the command handler.
|
@param[in,out] RetVal Pointer to the return vaule from the command handler.
|
||||||
|
@ -546,13 +550,19 @@ ShellCommandGetManFileNameHandler (
|
||||||
(via LIST_ENTRY structure). enumerate through it using the BaseLib linked
|
(via LIST_ENTRY structure). enumerate through it using the BaseLib linked
|
||||||
list functions. do not modify the values.
|
list functions. do not modify the values.
|
||||||
|
|
||||||
|
@param[in] Sort TRUE to alphabetically sort the values first. FALSE otherwise.
|
||||||
|
|
||||||
@return a Linked list of all available shell commands.
|
@return a Linked list of all available shell commands.
|
||||||
**/
|
**/
|
||||||
CONST COMMAND_LIST*
|
CONST COMMAND_LIST*
|
||||||
EFIAPI
|
EFIAPI
|
||||||
ShellCommandGetCommandList (
|
ShellCommandGetCommandList (
|
||||||
|
IN CONST BOOLEAN Sort
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
// if (!Sort) {
|
||||||
|
// return ((COMMAND_LIST*)(&mCommandList));
|
||||||
|
// }
|
||||||
return ((COMMAND_LIST*)(&mCommandList));
|
return ((COMMAND_LIST*)(&mCommandList));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -587,10 +597,10 @@ ShellCommandRegisterAlias (
|
||||||
//
|
//
|
||||||
// allocate memory for new struct
|
// allocate memory for new struct
|
||||||
//
|
//
|
||||||
Node = AllocatePool(sizeof(ALIAS_LIST));
|
Node = AllocateZeroPool(sizeof(ALIAS_LIST));
|
||||||
ASSERT(Node != NULL);
|
ASSERT(Node != NULL);
|
||||||
Node->CommandString = AllocatePool(StrSize(Command));
|
Node->CommandString = AllocateZeroPool(StrSize(Command));
|
||||||
Node->Alias = AllocatePool(StrSize(Alias));
|
Node->Alias = AllocateZeroPool(StrSize(Alias));
|
||||||
ASSERT(Node->CommandString != NULL);
|
ASSERT(Node->CommandString != NULL);
|
||||||
ASSERT(Node->Alias != NULL);
|
ASSERT(Node->Alias != NULL);
|
||||||
|
|
||||||
|
@ -625,7 +635,7 @@ ShellCommandGetInitAliasList (
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Determine if a given alias is on the list of built in alias'
|
Determine if a given alias is on the list of built in alias'.
|
||||||
|
|
||||||
@param[in] Alias The alias to test for
|
@param[in] Alias The alias to test for
|
||||||
|
|
||||||
|
@ -694,6 +704,8 @@ ShellCommandGetEchoState(
|
||||||
|
|
||||||
If State is TRUE, Echo will be enabled.
|
If State is TRUE, Echo will be enabled.
|
||||||
If State is FALSE, Echo will be disabled.
|
If State is FALSE, Echo will be disabled.
|
||||||
|
|
||||||
|
@param[in] State How to set echo.
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
EFIAPI
|
EFIAPI
|
||||||
|
@ -1040,7 +1052,7 @@ ShellCommandCreateInitialMappingsAndPaths(
|
||||||
//
|
//
|
||||||
// Get all Device Paths
|
// Get all Device Paths
|
||||||
//
|
//
|
||||||
DevicePathList = AllocatePool(sizeof(EFI_DEVICE_PATH_PROTOCOL*) * Count);
|
DevicePathList = AllocateZeroPool(sizeof(EFI_DEVICE_PATH_PROTOCOL*) * Count);
|
||||||
ASSERT(DevicePathList != NULL);
|
ASSERT(DevicePathList != NULL);
|
||||||
|
|
||||||
for (Count = 0 ; HandleList[Count] != NULL ; Count++) {
|
for (Count = 0 ; HandleList[Count] != NULL ; Count++) {
|
||||||
|
@ -1097,7 +1109,7 @@ ShellCommandCreateInitialMappingsAndPaths(
|
||||||
//
|
//
|
||||||
// Get all Device Paths
|
// Get all Device Paths
|
||||||
//
|
//
|
||||||
DevicePathList = AllocatePool(sizeof(EFI_DEVICE_PATH_PROTOCOL*) * Count);
|
DevicePathList = AllocateZeroPool(sizeof(EFI_DEVICE_PATH_PROTOCOL*) * Count);
|
||||||
ASSERT(DevicePathList != NULL);
|
ASSERT(DevicePathList != NULL);
|
||||||
|
|
||||||
for (Count = 0 ; HandleList[Count] != NULL ; Count++) {
|
for (Count = 0 ; HandleList[Count] != NULL ; Count++) {
|
||||||
|
@ -1132,6 +1144,13 @@ ShellCommandCreateInitialMappingsAndPaths(
|
||||||
return (EFI_SUCCESS);
|
return (EFI_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Function to make sure all directory delimeters are backslashes.
|
||||||
|
|
||||||
|
@param[in,out] Path The path to modify.
|
||||||
|
|
||||||
|
@return Path.
|
||||||
|
**/
|
||||||
CHAR16*
|
CHAR16*
|
||||||
EFIAPI
|
EFIAPI
|
||||||
ShellCommandCleanPath (
|
ShellCommandCleanPath (
|
||||||
|
@ -1189,7 +1208,7 @@ ConvertEfiFileProtocolToShellHandle(
|
||||||
if (Buffer == NULL) {
|
if (Buffer == NULL) {
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
NewNode = AllocatePool(sizeof(BUFFER_LIST));
|
NewNode = AllocateZeroPool(sizeof(BUFFER_LIST));
|
||||||
if (NewNode == NULL) {
|
if (NewNode == NULL) {
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
@ -1232,7 +1251,7 @@ ShellFileHandleGetPath(
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Remove a SHELL_FILE_HANDLE frmo the list of SHELL_FILE_HANDLES.
|
Remove a SHELL_FILE_HANDLE from the list of SHELL_FILE_HANDLES.
|
||||||
|
|
||||||
@param[in] Handle The SHELL_FILE_HANDLE to remove.
|
@param[in] Handle The SHELL_FILE_HANDLE to remove.
|
||||||
|
|
||||||
|
@ -1340,7 +1359,7 @@ ShellFileHandleReturnLine(
|
||||||
|
|
||||||
Status = ShellFileHandleReadLine(Handle, RetVal, &Size, FALSE, Ascii);
|
Status = ShellFileHandleReadLine(Handle, RetVal, &Size, FALSE, Ascii);
|
||||||
if (Status == EFI_BUFFER_TOO_SMALL) {
|
if (Status == EFI_BUFFER_TOO_SMALL) {
|
||||||
RetVal = AllocatePool(Size);
|
RetVal = AllocateZeroPool(Size);
|
||||||
Status = ShellFileHandleReadLine(Handle, RetVal, &Size, FALSE, Ascii);
|
Status = ShellFileHandleReadLine(Handle, RetVal, &Size, FALSE, Ascii);
|
||||||
}
|
}
|
||||||
ASSERT_EFI_ERROR(Status);
|
ASSERT_EFI_ERROR(Status);
|
||||||
|
@ -1409,7 +1428,7 @@ ShellFileHandleReadLine(
|
||||||
CharSize = sizeof(CHAR16);
|
CharSize = sizeof(CHAR16);
|
||||||
Status = gEfiShellProtocol->ReadFile(Handle, &CharSize, &CharBuffer);
|
Status = gEfiShellProtocol->ReadFile(Handle, &CharSize, &CharBuffer);
|
||||||
ASSERT_EFI_ERROR(Status);
|
ASSERT_EFI_ERROR(Status);
|
||||||
if (CharBuffer == UnicodeFileTag) {
|
if (CharBuffer == gUnicodeFileTag) {
|
||||||
*Ascii = FALSE;
|
*Ascii = FALSE;
|
||||||
} else {
|
} else {
|
||||||
*Ascii = TRUE;
|
*Ascii = TRUE;
|
||||||
|
@ -1462,6 +1481,8 @@ ShellFileHandleReadLine(
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
Frees any BUFFER_LIST defined type.
|
Frees any BUFFER_LIST defined type.
|
||||||
|
|
||||||
|
@param[in] List The BUFFER_LIST object to free.
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
EFIAPI
|
EFIAPI
|
||||||
|
@ -1493,7 +1514,7 @@ FreeBufferList (
|
||||||
/**
|
/**
|
||||||
Chops off last directory or file entry in a path leaving the trailing slash
|
Chops off last directory or file entry in a path leaving the trailing slash
|
||||||
|
|
||||||
@param[in,out] Path
|
@param[in,out] PathToReturn The path to modify.
|
||||||
|
|
||||||
@retval FALSE No directory was found to chop off.
|
@retval FALSE No directory was found to chop off.
|
||||||
@retval TRUE A directory was chopped off.
|
@retval TRUE A directory was chopped off.
|
||||||
|
@ -1505,11 +1526,11 @@ ChopLastSlash(
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
CHAR16 *Walker;
|
CHAR16 *Walker;
|
||||||
CHAR16 *LastSlash = NULL;
|
CHAR16 *LastSlash;
|
||||||
//
|
//
|
||||||
// get directory name from path... ('chop' off extra)
|
// get directory name from path... ('chop' off extra)
|
||||||
//
|
//
|
||||||
for ( Walker = PathToReturn
|
for ( Walker = PathToReturn, LastSlash = NULL
|
||||||
; Walker != NULL && *Walker != CHAR_NULL
|
; Walker != NULL && *Walker != CHAR_NULL
|
||||||
; Walker++
|
; Walker++
|
||||||
){
|
){
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
## @file
|
## @file
|
||||||
# Provides interface to shell internal functions for shell commands.
|
# Provides interface to shell internal functions for shell commands.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved. <BR>
|
# Copyright (c) 2006 - 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
|
||||||
|
@ -54,7 +54,7 @@
|
||||||
gEfiDevicePathToTextProtocolGuid # ALWAYS_CONSUMED
|
gEfiDevicePathToTextProtocolGuid # ALWAYS_CONSUMED
|
||||||
|
|
||||||
[Guids]
|
[Guids]
|
||||||
|
gEfiSasDevicePathGuid # ALWAYS_CONSUMED
|
||||||
|
|
||||||
[Pcd.common]
|
[Pcd.common]
|
||||||
gEfiShellPkgTokenSpaceGuid.PcdShellSupportLevel ## ALWAYS_CONSUMED
|
gEfiShellPkgTokenSpaceGuid.PcdShellSupportLevel ## ALWAYS_CONSUMED
|
||||||
|
|
Loading…
Reference in New Issue