]> git.proxmox.com Git - mirror_edk2.git/blobdiff - FatPkg/EnhancedFatDxe/DiskCache.c
FatPkg/EnhancedFatDxe: Make the comments align with EDKIIcoding style
[mirror_edk2.git] / FatPkg / EnhancedFatDxe / DiskCache.c
index 7f1fcf48cb720e7bcd3736ce202a5ba54e379571..63f9c007d6cc06defdbb074cdb607c3b446e59c7 100644 (file)
@@ -1,4 +1,5 @@
-/*++\r
+/** @file\r
+  Cache implementation for EFI FAT File system driver.\r
 \r
 Copyright (c) 2005 - 2013, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials are licensed and made available\r
@@ -9,21 +10,29 @@ http://opensource.org/licenses/bsd-license.php
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
+**/\r
 \r
-Module Name:\r
-\r
-  DiskCache.c\r
+#include "Fat.h"\r
 \r
-Abstract:\r
+/**\r
 \r
-  Cache implementation for EFI FAT File system driver\r
+  This function is used by the Data Cache.\r
 \r
-Revision History\r
+  When this function is called by write command, all entries in this range\r
+  are older than the contents in disk, so they are invalid; just mark them invalid.\r
 \r
---*/\r
+  When this function is called by read command, if any entry in this range\r
+  is dirty, it means that the relative info directly readed from media is older than\r
+  than the info in the cache; So need to update the relative info in the Buffer.\r
 \r
-#include "Fat.h"\r
+  @param  Volume                - FAT file system volume.\r
+  @param  IoMode                - This function is called by read command or write command\r
+  @param  StartPageNo           - First PageNo to be checked in the cache.\r
+  @param  EndPageNo             - Last PageNo to be checked in the cache.\r
+  @param  Buffer                - The user buffer need to update. Only when doing the read command\r
+                          and there is dirty cache in the cache range, this parameter will be used.\r
 \r
+**/\r
 STATIC\r
 VOID\r
 FatFlushDataCacheRange (\r
@@ -33,33 +42,6 @@ FatFlushDataCacheRange (
   IN  UINTN              EndPageNo,\r
   OUT UINT8              *Buffer\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  This function is used by the Data Cache.\r
-\r
-  When this function is called by write command, all entries in this range\r
-  are older than the contents in disk, so they are invalid; just mark them invalid.\r
-\r
-  When this function is called by read command, if any entry in this range\r
-  is dirty, it means that the relative info directly readed from media is older than\r
-  than the info in the cache; So need to update the relative info in the Buffer.\r
-\r
-Arguments:\r
-\r
-  Volume                - FAT file system volume.\r
-  IoMode                - This function is called by read command or write command\r
-  StartPageNo           - First PageNo to be checked in the cache.\r
-  EndPageNo             - Last PageNo to be checked in the cache.\r
-  Buffer                - The user buffer need to update. Only when doing the read command\r
-                          and there is dirty cache in the cache range, this parameter will be used.\r
-\r
-Returns:\r
-\r
-  None.\r
-\r
---*/\r
 {\r
   UINTN       PageNo;\r
   UINTN       GroupNo;\r
@@ -103,6 +85,20 @@ Returns:
   }\r
 }\r
 \r
+/**\r
+\r
+  Exchange the cache page with the image on the disk\r
+\r
+  @param  Volume                - FAT file system volume.\r
+  @param  DataType              - Indicate the cache type.\r
+  @param  IoMode                - Indicate whether to load this page from disk or store this page to disk.\r
+  @param  CacheTag              - The Cache Tag for the current cache page.\r
+  @param  Task                    point to task instance.\r
+\r
+  @retval EFI_SUCCESS           - Cache page exchanged successfully.\r
+  @return Others                - An error occurred when exchanging cache page.\r
+\r
+**/\r
 STATIC\r
 EFI_STATUS\r
 FatExchangeCachePage (\r
@@ -112,25 +108,6 @@ FatExchangeCachePage (
   IN CACHE_TAG          *CacheTag,\r
   IN FAT_TASK           *Task\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Exchange the cache page with the image on the disk\r
-\r
-Arguments:\r
-\r
-  Volume                - FAT file system volume.\r
-  DataType              - Indicate the cache type.\r
-  IoMode                - Indicate whether to load this page from disk or store this page to disk.\r
-  CacheTag              - The Cache Tag for the current cache page.\r
-\r
-Returns:\r
-\r
-  EFI_SUCCESS           - Cache page exchanged successfully.\r
-  Others                - An error occurred when exchanging cache page.\r
-\r
---*/\r
 {\r
   EFI_STATUS  Status;\r
   UINTN       GroupNo;\r
@@ -181,6 +158,19 @@ Returns:
   return EFI_SUCCESS;\r
 }\r
 \r
+/**\r
+\r
+  Get one cache page by specified PageNo.\r
+\r
+  @param  Volume                - FAT file system volume.\r
+  @param  CacheDataType         - The cache type: CACHE_FAT or CACHE_DATA.\r
+  @param  PageNo                - PageNo to match with the cache.\r
+  @param  CacheTag              - The Cache Tag for the current cache page.\r
+\r
+  @retval EFI_SUCCESS           - Get the cache page successfully.\r
+  @return other                 - An error occurred when accessing data.\r
+\r
+**/\r
 STATIC\r
 EFI_STATUS\r
 FatGetCachePage (\r
@@ -189,25 +179,6 @@ FatGetCachePage (
   IN UINTN              PageNo,\r
   IN CACHE_TAG          *CacheTag\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Get one cache page by specified PageNo.\r
-\r
-Arguments:\r
-\r
-  Volume                - FAT file system volume.\r
-  CacheDataType         - The cache type: CACHE_FAT or CACHE_DATA.\r
-  PageNo                - PageNo to match with the cache.\r
-  CacheTag              - The Cache Tag for the current cache page.\r
-\r
-Returns:\r
-\r
-  EFI_SUCCESS           - Get the cache page successfully.\r
-  other                 - An error occurred when accessing data.\r
-\r
---*/\r
 {\r
   EFI_STATUS  Status;\r
   UINTN       OldPageNo;\r
@@ -238,6 +209,23 @@ Returns:
   return Status;\r
 }\r
 \r
+/**\r
+\r
+  Read Length bytes from the position of Offset into Buffer, or\r
+  write Length bytes from Buffer into the position of Offset.\r
+\r
+  @param  Volume                - FAT file system volume.\r
+  @param  CacheDataType         - The type of cache: CACHE_DATA or CACHE_FAT.\r
+  @param  IoMode                - Indicate the type of disk access.\r
+  @param  PageNo                - The number of unaligned cache page.\r
+  @param  Offset                - The starting byte of cache page.\r
+  @param  Length                - The number of bytes that is read or written\r
+  @param  Buffer                - Buffer containing cache data.\r
+\r
+  @retval EFI_SUCCESS           - The data was accessed correctly.\r
+  @return Others                - An error occurred when accessing unaligned cache page.\r
+\r
+**/\r
 STATIC\r
 EFI_STATUS\r
 FatAccessUnalignedCachePage (\r
@@ -249,28 +237,6 @@ FatAccessUnalignedCachePage (
   IN     UINTN             Length,\r
   IN OUT VOID              *Buffer\r
   )\r
-/*++\r
-Routine Description:\r
-\r
-  Read Length bytes from the position of Offset into Buffer, or\r
-  write Length bytes from Buffer into the position of Offset.\r
-\r
-Arguments:\r
-\r
-  Volume                - FAT file system volume.\r
-  CacheDataType         - The type of cache: CACHE_DATA or CACHE_FAT.\r
-  IoMode                - Indicate the type of disk access.\r
-  PageNo                - The number of unaligned cache page.\r
-  Offset                - The starting byte of cache page.\r
-  Length                - The number of bytes that is read or written\r
-  Buffer                - Buffer containing cache data.\r
-\r
-Returns:\r
-\r
-  EFI_SUCCESS           - The data was accessed correctly.\r
-  Others                - An error occurred when accessing unaligned cache page.\r
-\r
---*/\r
 {\r
   EFI_STATUS  Status;\r
   VOID        *Source;\r
@@ -299,18 +265,7 @@ Returns:
   return Status;\r
 }\r
 \r
-EFI_STATUS\r
-FatAccessCache (\r
-  IN     FAT_VOLUME         *Volume,\r
-  IN     CACHE_DATA_TYPE    CacheDataType,\r
-  IN     IO_MODE            IoMode,\r
-  IN     UINT64             Offset,\r
-  IN     UINTN              BufferSize,\r
-  IN OUT UINT8              *Buffer,\r
-  IN     FAT_TASK           *Task\r
-  )\r
-/*++\r
-Routine Description:\r
+/**\r
 \r
   Read BufferSize bytes from the position of Offset into Buffer,\r
   or write BufferSize bytes from Buffer into the position of Offset.\r
@@ -326,22 +281,29 @@ Routine Description:
      The UnderRun data and OverRun data will be accessed by the Data cache,\r
      but the Aligned data will be accessed with disk directly.\r
 \r
-Arguments:\r
-\r
-  Volume                - FAT file system volume.\r
-  CacheDataType         - The type of cache: CACHE_DATA or CACHE_FAT.\r
-  IoMode                - Indicate the type of disk access.\r
-  Offset                - The starting byte offset to read from.\r
-  BufferSize            - Size of Buffer.\r
-  Buffer                - Buffer containing cache data.\r
+  @param  Volume                - FAT file system volume.\r
+  @param  CacheDataType         - The type of cache: CACHE_DATA or CACHE_FAT.\r
+  @param  IoMode                - Indicate the type of disk access.\r
+  @param  Offset                - The starting byte offset to read from.\r
+  @param  BufferSize            - Size of Buffer.\r
+  @param  Buffer                - Buffer containing cache data.\r
+  @param  Task                    point to task instance.\r
 \r
-Returns:\r
+  @retval EFI_SUCCESS           - The data was accessed correctly.\r
+  @retval EFI_MEDIA_CHANGED     - The MediaId does not match the current device.\r
+  @return Others                - An error occurred when accessing cache.\r
 \r
-  EFI_SUCCESS           - The data was accessed correctly.\r
-  EFI_MEDIA_CHANGED     - The MediaId does not match the current device.\r
-  Others                - An error occurred when accessing cache.\r
-\r
---*/\r
+**/\r
+EFI_STATUS\r
+FatAccessCache (\r
+  IN     FAT_VOLUME         *Volume,\r
+  IN     CACHE_DATA_TYPE    CacheDataType,\r
+  IN     IO_MODE            IoMode,\r
+  IN     UINT64             Offset,\r
+  IN     UINTN              BufferSize,\r
+  IN OUT UINT8              *Buffer,\r
+  IN     FAT_TASK           *Task\r
+  )\r
 {\r
   EFI_STATUS  Status;\r
   UINTN       PageSize;\r
@@ -421,27 +383,22 @@ Returns:
   return Status;\r
 }\r
 \r
-EFI_STATUS\r
-FatVolumeFlushCache (\r
-  IN FAT_VOLUME         *Volume,\r
-  IN FAT_TASK           *Task\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
+/**\r
 \r
   Flush all the dirty cache back, include the FAT cache and the Data cache.\r
 \r
-Arguments:\r
-\r
-  Volume                - FAT file system volume.\r
+  @param  Volume                - FAT file system volume.\r
+  @param  Task                    point to task instance.\r
 \r
-Returns:\r
+  @retval EFI_SUCCESS           - Flush all the dirty cache back successfully\r
+  @return other                 - An error occurred when writing the data into the disk\r
 \r
-  EFI_SUCCESS           - Flush all the dirty cache back successfully\r
-  other                 - An error occurred when writing the data into the disk\r
-\r
---*/\r
+**/\r
+EFI_STATUS\r
+FatVolumeFlushCache (\r
+  IN FAT_VOLUME         *Volume,\r
+  IN FAT_TASK           *Task\r
+  )\r
 {\r
   EFI_STATUS      Status;\r
   CACHE_DATA_TYPE CacheDataType;\r
@@ -480,26 +437,20 @@ Returns:
   return Status;\r
 }\r
 \r
-EFI_STATUS\r
-FatInitializeDiskCache (\r
-  IN FAT_VOLUME         *Volume\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
+/**\r
 \r
   Initialize the disk cache according to Volume's FatType.\r
 \r
-Arguments:\r
-\r
-  Volume                - FAT file system volume.\r
+  @param  Volume                - FAT file system volume.\r
 \r
-Returns:\r
+  @retval EFI_SUCCESS           - The disk cache is successfully initialized.\r
+  @retval EFI_OUT_OF_RESOURCES  - Not enough memory to allocate disk cache.\r
 \r
-  EFI_SUCCESS           - The disk cache is successfully initialized.\r
-  EFI_OUT_OF_RESOURCES  - Not enough memory to allocate disk cache.\r
-\r
---*/\r
+**/\r
+EFI_STATUS\r
+FatInitializeDiskCache (\r
+  IN FAT_VOLUME         *Volume\r
+  )\r
 {\r
   DISK_CACHE  *DiskCache;\r
   UINTN       FatCacheGroupCount;\r