Locates a section within a series of sections\r
with the specified section type.\r
\r
+ The Instance parameter indicates which instance of the section\r
+ type to return. (0 is first instance, 1 is second...)\r
+\r
@param[in] Sections The sections to search\r
@param[in] SizeOfSections Total size of all sections\r
@param[in] SectionType The section type to locate\r
+ @param[in] Instance The section instance number\r
@param[out] FoundSection The FFS section if found\r
\r
@retval EFI_SUCCESS The file and section was found\r
\r
**/\r
EFI_STATUS\r
-FindFfsSectionInSections (\r
+FindFfsSectionInstance (\r
IN VOID *Sections,\r
IN UINTN SizeOfSections,\r
IN EFI_SECTION_TYPE SectionType,\r
+ IN UINTN Instance,\r
OUT EFI_COMMON_SECTION_HEADER **FoundSection\r
)\r
{\r
// Look for the requested section type\r
//\r
if (Section->Type == SectionType) {\r
- *FoundSection = Section;\r
- return EFI_SUCCESS;\r
+ if (Instance == 0) {\r
+ *FoundSection = Section;\r
+ return EFI_SUCCESS;\r
+ } else {\r
+ Instance--;\r
+ }\r
}\r
}\r
\r
return EFI_NOT_FOUND;\r
}\r
\r
+/**\r
+ Locates a section within a series of sections\r
+ with the specified section type.\r
+\r
+ @param[in] Sections The sections to search\r
+ @param[in] SizeOfSections Total size of all sections\r
+ @param[in] SectionType The section type to locate\r
+ @param[out] FoundSection The FFS section if found\r
+\r
+ @retval EFI_SUCCESS The file and section was found\r
+ @retval EFI_NOT_FOUND The file and section was not found\r
+ @retval EFI_VOLUME_CORRUPTED The firmware volume was corrupted\r
+\r
+**/\r
+EFI_STATUS\r
+FindFfsSectionInSections (\r
+ IN VOID *Sections,\r
+ IN UINTN SizeOfSections,\r
+ IN EFI_SECTION_TYPE SectionType,\r
+ OUT EFI_COMMON_SECTION_HEADER **FoundSection\r
+ )\r
+{\r
+ return FindFfsSectionInstance (\r
+ Sections,\r
+ SizeOfSections,\r
+ SectionType,\r
+ 0,\r
+ FoundSection\r
+ );\r
+}\r
+\r
/**\r
Locates a FFS file with the specified file type and a section\r
within that file with the specified section type.\r