- \r
- \r
-\r
-//\r
-// Local prototypes\r
-//\r
-\r
-/**\r
- Worker function. Determine if the input stream:child matches the input type.\r
-\r
- @param Stream Indicates the section stream associated with the \r
- child \r
- @param Child Indicates the child to check \r
- @param SearchType Indicates the type of section to check against \r
- for \r
- @param SectionDefinitionGuid Indicates the GUID to check against if the type \r
- is EFI_SECTION_GUID_DEFINED \r
-\r
- @retval TRUE The child matches \r
- @retval FALSE The child doesn't match\r
-\r
-**/\r
-STATIC\r
-BOOLEAN\r
-ChildIsType (\r
- IN CORE_SECTION_STREAM_NODE *Stream,\r
- IN CORE_SECTION_CHILD_NODE *Child,\r
- IN EFI_SECTION_TYPE SearchType,\r
- IN EFI_GUID *SectionDefinitionGuid\r
- );\r
-\r
-#if 0\r
-/**\r
- RPN callback function. Removes a stale section stream and re-initializes it\r
- with an updated AuthenticationStatus.\r
-\r
- @param Event The event that fired \r
- @param RpnContext A pointer to the context that allows us to \r
- identify the relevent encapsulation...\r
-\r
-**/\r
-STATIC\r
-VOID\r
-EFIAPI\r
-NotifyGuidedExtraction (\r
- IN EFI_EVENT Event,\r
- IN VOID *RpnContext\r
- );\r
-#endif\r
-\r
-#if 0\r
-/**\r
- Worker function. Constructor for RPN event if needed to keep AuthenticationStatus\r
- cache correct when a missing GUIDED_SECTION_EXTRACTION_PROTOCOL appears.\r
-\r
- @param ParentStream Indicates the parent of the ecnapsulation \r
- section (child) \r
- @param ChildNode Indicates the child node that is the \r
- encapsulation section.\r
-\r
-**/\r
-STATIC\r
-VOID\r
-CreateGuidedExtractionRpnEvent (\r
- IN CORE_SECTION_STREAM_NODE *ParentStream,\r
- IN CORE_SECTION_CHILD_NODE *ChildNode\r
- );\r
-#endif\r
-\r
-/**\r
- Worker function. Search stream database for requested stream handle.\r
-\r
- @param SearchHandle Indicates which stream to look for. \r
- @param FoundStream Output pointer to the found stream. \r
-\r
- @retval EFI_SUCCESS StreamHandle was found and *FoundStream contains \r
- the stream node. \r
- @retval EFI_NOT_FOUND SearchHandle was not found in the stream \r
- database.\r
-\r
-**/\r
-STATIC\r
-EFI_STATUS\r
-FindStreamNode (\r
- IN UINTN SearchHandle,\r
- OUT CORE_SECTION_STREAM_NODE **FoundStream\r
- );\r
- \r
-/**\r
- Worker function Recursively searches / builds section stream database\r
- looking for requested section.\r
-\r
- @param SourceStream Indicates the section stream in which to do the \r
- search. \r
- @param SearchType Indicates the type of section to search for. \r
- @param SectionInstance Indicates which instance of section to find. \r
- This is an in/out parameter to deal with \r
- recursions. \r
- @param SectionDefinitionGuid Guid of section definition \r
- @param FoundChild Output indicating the child node that is found. \r
- @param FoundStream Output indicating which section stream the child \r
- was found in. If this stream was generated as a \r
- result of an encapsulation section, the \r
- streamhandle is visible within the SEP driver \r
- only.\r
- @param AuthenticationStatus Indicates the authentication status of the found section. \r
-\r
- @retval EFI_SUCCESS Child node was found and returned. \r
- EFI_OUT_OF_RESOURCES- Memory allocation failed. \r
- @retval EFI_NOT_FOUND Requested child node does not exist. \r
- @retval EFI_PROTOCOL_ERROR a required GUIDED section extraction protocol \r
- does not exist\r
-\r
-**/\r
-STATIC\r
-EFI_STATUS\r
-FindChildNode (\r
- IN CORE_SECTION_STREAM_NODE *SourceStream,\r
- IN EFI_SECTION_TYPE SearchType,\r
- IN UINTN *SectionInstance,\r
- IN EFI_GUID *SectionDefinitionGuid,\r
- OUT CORE_SECTION_CHILD_NODE **FoundChild,\r
- OUT CORE_SECTION_STREAM_NODE **FoundStream,\r
- OUT UINT32 *AuthenticationStatus\r
- );\r
- \r
-/**\r
- Worker function. Constructor for new child nodes.\r
-\r
- @param Stream Indicates the section stream in which to add the \r
- child. \r
- @param ChildOffset Indicates the offset in Stream that is the \r
- beginning of the child section. \r
- @param ChildNode Indicates the Callee allocated and initialized \r
- child. \r
-\r
- @retval EFI_SUCCESS Child node was found and returned. \r
- EFI_OUT_OF_RESOURCES- Memory allocation failed. \r
- @retval EFI_PROTOCOL_ERROR Encapsulation sections produce new stream \r
- handles when the child node is created. If the \r
- section type is GUID defined, and the extraction \r
- GUID does not exist, and producing the stream \r
- requires the GUID, then a protocol error is \r
- generated and no child is produced. Values \r
- returned by OpenSectionStreamEx.\r
-\r
-**/\r
-STATIC\r
-EFI_STATUS\r
-CreateChildNode (\r
- IN CORE_SECTION_STREAM_NODE *Stream,\r
- IN UINT32 ChildOffset,\r
- OUT CORE_SECTION_CHILD_NODE **ChildNode\r
- );\r
- \r
-/**\r
- Worker function. Destructor for child nodes.\r
-\r
- @param ChildNode Indicates the node to destroy\r
-\r
-**/\r
-STATIC\r
-VOID\r
-FreeChildNode (\r
- IN CORE_SECTION_CHILD_NODE *ChildNode\r
- );\r
- \r
-/**\r
- Worker function. Constructor for section streams.\r
-\r
- @param SectionStreamLength Size in bytes of the section stream. \r
- @param SectionStream Buffer containing the new section stream. \r
- @param AllocateBuffer Indicates whether the stream buffer is to be \r
- copied or the input buffer is to be used in \r
- place. AuthenticationStatus- Indicates the \r
- default authentication status for the new \r
- stream. \r
- @param AuthenticationStatus A pointer to a caller-allocated UINT32 that\r
- indicates the authentication status of the\r
- output buffer. If the input section's\r
- GuidedSectionHeader.Attributes field\r
- has the EFI_GUIDED_SECTION_AUTH_STATUS_VALID\r
- bit as clear, AuthenticationStatus must return\r
- zero. Both local bits (19:16) and aggregate\r
- bits (3:0) in AuthenticationStatus are returned\r
- by ExtractSection(). These bits reflect the\r
- status of the extraction operation. The bit\r
- pattern in both regions must be the same, as\r
- the local and aggregate authentication statuses\r
- have equivalent meaning at this level. If the\r
- function returns anything other than\r
- EFI_SUCCESS, the value of *AuthenticationStatus\r
- is undefined.\r
- @param SectionStreamHandle A pointer to a caller allocated section stream \r
- handle. \r
-\r
- @retval EFI_SUCCESS Stream was added to stream database. \r
- @retval EFI_OUT_OF_RESOURCES memory allocation failed.\r
-\r
-**/\r
-STATIC\r
-EFI_STATUS\r
-OpenSectionStreamEx (\r
- IN UINTN SectionStreamLength,\r
- IN VOID *SectionStream,\r
- IN BOOLEAN AllocateBuffer,\r
- IN UINT32 AuthenticationStatus, \r
- OUT UINTN *SectionStreamHandle\r
- );\r
- \r
-/**\r
- Check if a stream is valid.\r
-\r
- @param SectionStream The section stream to be checked \r
- @param SectionStreamLength The length of section stream \r
-\r
- @return A boolean value indicating the validness of the section stream.\r