20#include <Library/HardwareInfoLib.h>
23CreateHardwareInfoList (
26 IN HARDWARE_INFO_TYPE TypeFilter,
34 if ((Blob ==
NULL) || (BlobSize <= 0) ||
37 return EFI_INVALID_PARAMETER;
41 BlobEnd = Blob + BlobSize;
42 while (Index < BlobEnd) {
45 if (HwComponent ==
NULL) {
49 HwComponent->Header.Type.Uint64 = *((UINT64 *)Index);
50 Index +=
sizeof (HwComponent->Header.Type);
51 HwComponent->Header.Size = *((UINT64 *)(Index));
52 Index +=
sizeof (HwComponent->Header.Size);
54 if ((HwComponent->Header.Size > MAX_UINTN) || (Index < Blob) || ((Index + HwComponent->Header.Size) > BlobEnd)) {
63 if ((TypeFilter != HardwareInfoTypeUndefined) &&
64 (HwComponent->Header.Type.Value != TypeFilter))
67 Index += HwComponent->Header.Size;
72 if (HwComponent->Data.Raw ==
NULL) {
76 CopyMem (HwComponent->Data.Raw, Index, (
UINTN)HwComponent->Header.Size);
77 Index += HwComponent->Header.Size;
93 "%a: Failed to allocate memory for hardware info\n",
97 return EFI_OUT_OF_RESOURCES;
101FreeHardwareInfoList (
112 CurrentLink = ListHead->ForwardLink;
113 while (CurrentLink !=
NULL && CurrentLink != ListHead) {
114 HwComponent = HARDWARE_INFO_FROM_LINK (CurrentLink);
BOOLEAN EFIAPI IsListEmpty(IN CONST LIST_ENTRY *ListHead)
LIST_ENTRY *EFIAPI RemoveEntryList(IN CONST LIST_ENTRY *Entry)
LIST_ENTRY *EFIAPI InsertTailList(IN OUT LIST_ENTRY *ListHead, IN OUT LIST_ENTRY *Entry)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
#define DEBUG(Expression)