ShellPkg/HandleParsingLib: Add new API GetAllMappingGuids
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Signed-off-by: Chen A Chen <chen.a.chen@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
This commit is contained in:
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Provides interface to advanced shell functionality for parsing both handle and protocol database.
|
Provides interface to advanced shell functionality for parsing both handle and protocol database.
|
||||||
|
|
||||||
Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2010 - 2017, 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
|
||||||
@ -388,4 +388,23 @@ GetHandleListByProtocolList (
|
|||||||
IN CONST EFI_GUID **ProtocolGuids
|
IN CONST EFI_GUID **ProtocolGuids
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Return all supported GUIDs.
|
||||||
|
|
||||||
|
@param[out] Guids The buffer to return all supported GUIDs.
|
||||||
|
@param[in out] Count On input, the count of GUIDs the buffer can hold,
|
||||||
|
On output, the count of GUIDs to return.
|
||||||
|
|
||||||
|
@retval EFI_INVALID_PARAMETER Count is NULL.
|
||||||
|
@retval EFI_BUFFER_TOO_SMALL Buffer is not enough to hold all GUIDs.
|
||||||
|
@retval EFI_SUCCESS GUIDs are returned successfully.
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
GetAllMappingGuids (
|
||||||
|
OUT EFI_GUID *Guids,
|
||||||
|
IN OUT UINTN *Count
|
||||||
|
);
|
||||||
|
|
||||||
#endif // __HANDLE_PARSING_LIB__
|
#endif // __HANDLE_PARSING_LIB__
|
||||||
|
@ -3079,3 +3079,55 @@ GetHandleListByProtocolList (
|
|||||||
|
|
||||||
return (HandleList);
|
return (HandleList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Return all supported GUIDs.
|
||||||
|
|
||||||
|
@param[out] Guids The buffer to return all supported GUIDs.
|
||||||
|
@param[in, out] Count On input, the count of GUIDs the buffer can hold,
|
||||||
|
On output, the count of GUIDs to return.
|
||||||
|
|
||||||
|
@retval EFI_INVALID_PARAMETER Count is NULL.
|
||||||
|
@retval EFI_BUFFER_TOO_SMALL Buffer is not enough to hold all GUIDs.
|
||||||
|
@retval EFI_SUCCESS GUIDs are returned successfully.
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
GetAllMappingGuids (
|
||||||
|
OUT EFI_GUID *Guids,
|
||||||
|
IN OUT UINTN *Count
|
||||||
|
)
|
||||||
|
{
|
||||||
|
UINTN GuidCount;
|
||||||
|
UINTN NtGuidCount
|
||||||
|
UINTN Index;
|
||||||
|
|
||||||
|
if (Count == NULL) {
|
||||||
|
return EFI_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
NtGuidCount = 0;
|
||||||
|
if (PcdGetBool (PcdShellIncludeNtGuids)) {
|
||||||
|
NtGuidCount = ARRAY_SIZE (mGuidStringListNT) - 1;
|
||||||
|
}
|
||||||
|
GuidCount = ARRAY_SIZE (mGuidStringList) - 1;
|
||||||
|
|
||||||
|
if (*Count < NtGuidCount + GuidCount + mGuidListCount) {
|
||||||
|
*Count = NtGuidCount + GuidCount + mGuidListCount;
|
||||||
|
return EFI_BUFFER_TOO_SMALL;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Index = 0; Index < NtGuidCount; Index++) {
|
||||||
|
CopyGuid (&Guids[Index], mGuidStringListNT[Index].GuidId);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Index = 0; Index < GuidCount; Index++) {
|
||||||
|
CopyGuid (&Guids[NtGuidCount + Index], mGuidStringList[Index].GuidId);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Index = 0; Index < mGuidListCount; Index++) {
|
||||||
|
CopyGuid (&Guids[NtGuidCount + GuidCount + Index], mGuidList[Index].GuidId);
|
||||||
|
}
|
||||||
|
|
||||||
|
return EFI_SUCCESS;
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user