]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Core/Dxe/FwVol/FwVolRead.c
Code Scrub for Dxe Core.
[mirror_edk2.git] / MdeModulePkg / Core / Dxe / FwVol / FwVolRead.c
index 7016ee5b9095419a7ab8f2a6a09b103a25af6604..734692893435ce2b4dd5a4a926ec3fa2b2cb3c82 100644 (file)
@@ -32,14 +32,14 @@ Required Alignment    Alignment Value in FFS       Alignment Value in
 \r
 --*/\r
 \r
-UINT8 mFvAttributes[] = {0, 4, 7, 9, 10, 12, 15, 16}; \r
+UINT8 mFvAttributes[] = {0, 4, 7, 9, 10, 12, 15, 16};\r
 \r
 \r
 \r
 /**\r
   Convert the FFS File Attributes to FV File Attributes\r
 \r
-  @param  FfsAttributes              The attributes of UINT8 type. \r
+  @param  FfsAttributes              The attributes of UINT8 type.\r
 \r
   @return The attributes of EFI_FV_FILE_ATTRIBUTES\r
 \r
@@ -60,46 +60,46 @@ FfsAttributes2FvFileAttributes (
 /**\r
   Given the input key, search for the next matching file in the volume.\r
 \r
-  @param  This                       Indicates the calling context. \r
-  @param  Key                        Key is a pointer to a caller allocated \r
-                                     buffer that contains implementation specific \r
-                                     data that is used to track where to begin \r
-                                     the search for the next file. The size of \r
-                                     the buffer must be at least This->KeySize \r
-                                     bytes long. To reinitialize the search and \r
-                                     begin from the beginning of the firmware \r
-                                     volume, the entire buffer must be cleared to \r
-                                     zero. Other than clearing the buffer to \r
-                                     initiate a new search, the caller must not \r
-                                     modify the data in the buffer between calls \r
-                                     to GetNextFile(). \r
-  @param  FileType                   FileType is a pointer to a caller allocated \r
-                                     EFI_FV_FILETYPE. The GetNextFile() API can \r
-                                     filter it's search for files based on the \r
-                                     value of *FileType input. A *FileType input \r
-                                     of 0 causes GetNextFile() to search for \r
-                                     files of all types.  If a file is found, the \r
-                                     file's type is returned in *FileType.  \r
-                                     *FileType is not modified if no file is \r
-                                     found. \r
-  @param  NameGuid                   NameGuid is a pointer to a caller allocated \r
-                                     EFI_GUID. If a file is found, the file's \r
-                                     name is returned in *NameGuid.  *NameGuid is \r
-                                     not modified if no file is found. \r
-  @param  Attributes                 Attributes is a pointer to a caller \r
-                                     allocated EFI_FV_FILE_ATTRIBUTES.  If a file \r
-                                     is found, the file's attributes are returned \r
-                                     in *Attributes. *Attributes is not modified \r
-                                     if no file is found. \r
-  @param  Size                       Size is a pointer to a caller allocated \r
-                                     UINTN. If a file is found, the file's size \r
-                                     is returned in *Size. *Size is not modified \r
-                                     if no file is found. \r
-\r
-  @retval EFI_SUCCESS                Successfully find the file. \r
-  @retval EFI_DEVICE_ERROR           Device error. \r
-  @retval EFI_ACCESS_DENIED          Fv could not read. \r
-  @retval EFI_NOT_FOUND              No matching file found. \r
+  @param  This                       Indicates the calling context.\r
+  @param  Key                        Key is a pointer to a caller allocated\r
+                                     buffer that contains implementation specific\r
+                                     data that is used to track where to begin\r
+                                     the search for the next file. The size of\r
+                                     the buffer must be at least This->KeySize\r
+                                     bytes long. To reinitialize the search and\r
+                                     begin from the beginning of the firmware\r
+                                     volume, the entire buffer must be cleared to\r
+                                     zero. Other than clearing the buffer to\r
+                                     initiate a new search, the caller must not\r
+                                     modify the data in the buffer between calls\r
+                                     to GetNextFile().\r
+  @param  FileType                   FileType is a pointer to a caller allocated\r
+                                     EFI_FV_FILETYPE. The GetNextFile() API can\r
+                                     filter it's search for files based on the\r
+                                     value of *FileType input. A *FileType input\r
+                                     of 0 causes GetNextFile() to search for\r
+                                     files of all types.  If a file is found, the\r
+                                     file's type is returned in *FileType.\r
+                                     *FileType is not modified if no file is\r
+                                     found.\r
+  @param  NameGuid                   NameGuid is a pointer to a caller allocated\r
+                                     EFI_GUID. If a file is found, the file's\r
+                                     name is returned in *NameGuid.  *NameGuid is\r
+                                     not modified if no file is found.\r
+  @param  Attributes                 Attributes is a pointer to a caller\r
+                                     allocated EFI_FV_FILE_ATTRIBUTES.  If a file\r
+                                     is found, the file's attributes are returned\r
+                                     in *Attributes. *Attributes is not modified\r
+                                     if no file is found.\r
+  @param  Size                       Size is a pointer to a caller allocated\r
+                                     UINTN. If a file is found, the file's size\r
+                                     is returned in *Size. *Size is not modified\r
+                                     if no file is found.\r
+\r
+  @retval EFI_SUCCESS                Successfully find the file.\r
+  @retval EFI_DEVICE_ERROR           Device error.\r
+  @retval EFI_ACCESS_DENIED          Fv could not read.\r
+  @retval EFI_NOT_FOUND              No matching file found.\r
   @retval EFI_INVALID_PARAMETER      Invalid parameter\r
 \r
 **/\r
@@ -194,7 +194,7 @@ FvGetNextFile (
       break;\r
     }\r
 \r
-  } \r
+  }\r
 \r
   //\r
   // Return FileType, NameGuid, and Attributes\r
@@ -222,39 +222,39 @@ FvGetNextFile (
   Locates a file in the firmware volume and\r
   copies it to the supplied buffer.\r
 \r
-  @param  This                       Indicates the calling context. \r
-  @param  NameGuid                   Pointer to an EFI_GUID, which is the \r
-                                     filename. \r
-  @param  Buffer                     Buffer is a pointer to pointer to a buffer \r
-                                     in which the file or section contents or are \r
-                                     returned. \r
-  @param  BufferSize                 BufferSize is a pointer to caller allocated \r
-                                     UINTN. On input *BufferSize indicates the \r
-                                     size in bytes of the memory region pointed \r
-                                     to by Buffer. On output, *BufferSize \r
-                                     contains the number of bytes required to \r
-                                     read the file. \r
-  @param  FoundType                  FoundType is a pointer to a caller allocated \r
-                                     EFI_FV_FILETYPE that on successful return \r
-                                     from Read() contains the type of file read.  \r
-                                     This output reflects the file type \r
-                                     irrespective of the value of the SectionType \r
-                                     input. \r
-  @param  FileAttributes             FileAttributes is a pointer to a caller \r
-                                     allocated EFI_FV_FILE_ATTRIBUTES.  On \r
-                                     successful return from Read(), \r
-                                     *FileAttributes contains the attributes of \r
-                                     the file read. \r
-  @param  AuthenticationStatus       AuthenticationStatus is a pointer to a \r
-                                     caller allocated UINTN in which the \r
-                                     authentication status is returned. \r
-\r
-  @retval EFI_SUCCESS                Successfully read to memory buffer. \r
-  @retval EFI_WARN_BUFFER_TOO_SMALL  Buffer too small. \r
-  @retval EFI_NOT_FOUND              Not found. \r
-  @retval EFI_DEVICE_ERROR           Device error. \r
-  @retval EFI_ACCESS_DENIED          Could not read. \r
-  @retval EFI_INVALID_PARAMETER      Invalid parameter. \r
+  @param  This                       Indicates the calling context.\r
+  @param  NameGuid                   Pointer to an EFI_GUID, which is the\r
+                                     filename.\r
+  @param  Buffer                     Buffer is a pointer to pointer to a buffer\r
+                                     in which the file or section contents or are\r
+                                     returned.\r
+  @param  BufferSize                 BufferSize is a pointer to caller allocated\r
+                                     UINTN. On input *BufferSize indicates the\r
+                                     size in bytes of the memory region pointed\r
+                                     to by Buffer. On output, *BufferSize\r
+                                     contains the number of bytes required to\r
+                                     read the file.\r
+  @param  FoundType                  FoundType is a pointer to a caller allocated\r
+                                     EFI_FV_FILETYPE that on successful return\r
+                                     from Read() contains the type of file read.\r
+                                     This output reflects the file type\r
+                                     irrespective of the value of the SectionType\r
+                                     input.\r
+  @param  FileAttributes             FileAttributes is a pointer to a caller\r
+                                     allocated EFI_FV_FILE_ATTRIBUTES.  On\r
+                                     successful return from Read(),\r
+                                     *FileAttributes contains the attributes of\r
+                                     the file read.\r
+  @param  AuthenticationStatus       AuthenticationStatus is a pointer to a\r
+                                     caller allocated UINTN in which the\r
+                                     authentication status is returned.\r
+\r
+  @retval EFI_SUCCESS                Successfully read to memory buffer.\r
+  @retval EFI_WARN_BUFFER_TOO_SMALL  Buffer too small.\r
+  @retval EFI_NOT_FOUND              Not found.\r
+  @retval EFI_DEVICE_ERROR           Device error.\r
+  @retval EFI_ACCESS_DENIED          Could not read.\r
+  @retval EFI_INVALID_PARAMETER      Invalid parameter.\r
   @retval EFI_OUT_OF_RESOURCES       Not enough buffer to be allocated.\r
 \r
 **/\r
@@ -279,13 +279,13 @@ FvReadFile (
   UINT8                             *SrcPtr;\r
   EFI_FFS_FILE_HEADER               *FfsHeader;\r
   UINTN                             InputBufferSize;\r
-  \r
+\r
   if (NameGuid == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
   FvDevice = FV_DEVICE_FROM_THIS (This);\r
-  \r
+\r
 \r
   //\r
   // Keep looking until we find the matching NameGuid.\r
@@ -349,13 +349,13 @@ FvReadFile (
   } else if (FileSize > InputBufferSize) {\r
     //\r
     // Callers buffer was not big enough\r
-    // \r
+    //\r
     Status = EFI_WARN_BUFFER_TOO_SMALL;\r
     FileSize = InputBufferSize;\r
   }\r
-  \r
+\r
   //\r
-  // Copy data into callers buffer \r
+  // Copy data into callers buffer\r
   //\r
   CopyMem (*Buffer, SrcPtr, FileSize);\r
 \r
@@ -368,27 +368,27 @@ FvReadFile (
   Locates a section in a given FFS File and\r
   copies it to the supplied buffer (not including section header).\r
 \r
-  @param  This                       Indicates the calling context. \r
-  @param  NameGuid                   Pointer to an EFI_GUID, which is the \r
-                                     filename. \r
-  @param  SectionType                Indicates the section type to return. \r
-  @param  SectionInstance            Indicates which instance of sections with a \r
-                                     type of SectionType to return. \r
-  @param  Buffer                     Buffer is a pointer to pointer to a buffer \r
-                                     in which the file or section contents or are \r
-                                     returned. \r
-  @param  BufferSize                 BufferSize is a pointer to caller allocated \r
+  @param  This                       Indicates the calling context.\r
+  @param  NameGuid                   Pointer to an EFI_GUID, which is the\r
+                                     filename.\r
+  @param  SectionType                Indicates the section type to return.\r
+  @param  SectionInstance            Indicates which instance of sections with a\r
+                                     type of SectionType to return.\r
+  @param  Buffer                     Buffer is a pointer to pointer to a buffer\r
+                                     in which the file or section contents or are\r
+                                     returned.\r
+  @param  BufferSize                 BufferSize is a pointer to caller allocated\r
                                      UINTN.\r
-  @param  AuthenticationStatus       AuthenticationStatus is a pointer to a \r
-                                     caller allocated UINT32 in which the \r
-                                     authentication status is returned. \r
-\r
-  @retval EFI_SUCCESS                Successfully read the file section into \r
-                                     buffer. \r
-  @retval EFI_WARN_BUFFER_TOO_SMALL  Buffer too small. \r
-  @retval EFI_NOT_FOUND              Section not found. \r
-  @retval EFI_DEVICE_ERROR           Device error. \r
-  @retval EFI_ACCESS_DENIED          Could not read. \r
+  @param  AuthenticationStatus       AuthenticationStatus is a pointer to a\r
+                                     caller allocated UINT32 in which the\r
+                                     authentication status is returned.\r
+\r
+  @retval EFI_SUCCESS                Successfully read the file section into\r
+                                     buffer.\r
+  @retval EFI_WARN_BUFFER_TOO_SMALL  Buffer too small.\r
+  @retval EFI_NOT_FOUND              Section not found.\r
+  @retval EFI_DEVICE_ERROR           Device error.\r
+  @retval EFI_ACCESS_DENIED          Could not read.\r
   @retval EFI_INVALID_PARAMETER      Invalid parameter.\r
 \r
 **/\r
@@ -411,7 +411,7 @@ FvReadFileSection (
   UINTN                             FileSize;\r
   UINT8                             *FileBuffer;\r
   FFS_FILE_LIST_ENTRY               *FfsEntry;\r
\r
+\r
   if (NameGuid == NULL || Buffer == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
@@ -430,16 +430,16 @@ FvReadFileSection (
             &FileType,\r
             &FileAttributes,\r
             AuthenticationStatus\r
-            );             \r
+            );\r
   //\r
   // Get the last key used by our call to FvReadFile as it is the FfsEntry for this file.\r
-  //  \r
+  //\r
   FfsEntry = (FFS_FILE_LIST_ENTRY *) FvDevice->LastKey;\r
 \r
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
-  \r
+\r
   //\r
   // Check to see that the file actually HAS sections before we go any further.\r
   //\r