return ReturnResourceHob;\r
}\r
\r
+/**\r
+ Check the HOB and decide if it is need inside Payload\r
+\r
+ Payload maintainer may make decision which HOB is need or needn't\r
+ Then add the check logic in the function.\r
+\r
+ @param[in] Hob The HOB to check\r
+\r
+ @retval TRUE If HOB is need inside Payload\r
+ @retval FALSE If HOB is needn't inside Payload\r
+**/\r
+BOOLEAN\r
+IsHobNeed (\r
+ EFI_PEI_HOB_POINTERS Hob\r
+ )\r
+{\r
+ if (Hob.Header->HobType == EFI_HOB_TYPE_HANDOFF) {\r
+ return FALSE;\r
+ }\r
+\r
+ if (Hob.Header->HobType == EFI_HOB_TYPE_MEMORY_ALLOCATION) {\r
+ if (CompareGuid (&Hob.MemoryAllocationModule->MemoryAllocationHeader.Name, &gEfiHobMemoryAllocModuleGuid)) {\r
+ return FALSE;\r
+ }\r
+ }\r
+\r
+ // Arrive here mean the HOB is need\r
+ return TRUE;\r
+}\r
+\r
/**\r
It will build HOBs based on information from bootloaders.\r
\r
// Since payload created new Hob, move all hobs except PHIT from boot loader hob list.\r
//\r
while (!END_OF_HOB_LIST (Hob)) {\r
- if (Hob.Header->HobType != EFI_HOB_TYPE_HANDOFF) {\r
+ if (IsHobNeed (Hob)) {\r
// Add this hob to payload HOB\r
AddNewHob (&Hob);\r
}\r