TianoCore EDK2 master
Loading...
Searching...
No Matches
FatLiteAccess.c File Reference
#include "FatLitePeim.h"

Go to the source code of this file.

Functions

EFI_STATUS FatGetBpbInfo (IN PEI_FAT_PRIVATE_DATA *PrivateData, IN OUT PEI_FAT_VOLUME *Volume)
 
EFI_STATUS FatGetNextCluster (IN PEI_FAT_PRIVATE_DATA *PrivateData, IN PEI_FAT_VOLUME *Volume, IN UINT32 Cluster, OUT UINT32 *NextCluster)
 
EFI_STATUS FatSetFilePos (IN PEI_FAT_PRIVATE_DATA *PrivateData, IN PEI_FAT_FILE *File, IN UINT32 Pos)
 
EFI_STATUS FatReadFile (IN PEI_FAT_PRIVATE_DATA *PrivateData, IN PEI_FAT_FILE *File, IN UINTN Size, OUT VOID *Buffer)
 
EFI_STATUS FatReadNextDirectoryEntry (IN PEI_FAT_PRIVATE_DATA *PrivateData, IN PEI_FAT_FILE *ParentDir, OUT PEI_FAT_FILE *SubFile)
 

Detailed Description

FAT file system access routines for FAT recovery PEIM

Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.

SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file FatLiteAccess.c.

Function Documentation

◆ FatGetBpbInfo()

EFI_STATUS FatGetBpbInfo ( IN PEI_FAT_PRIVATE_DATA PrivateData,
IN OUT PEI_FAT_VOLUME Volume 
)

Check if there is a valid FAT in the corresponding Block device of the volume and if yes, fill in the relevant fields for the volume structure. Note there should be a valid Block device number already set.

Parameters
PrivateDataGlobal memory map for accessing global variables.
VolumeOn input, the BlockDeviceNumber field of the Volume should be a valid value. On successful output, all fields except the VolumeNumber field is initialized.
Return values
EFI_SUCCESSA FAT is found and the volume structure is initialized.
EFI_NOT_FOUNDThere is no FAT on the corresponding device.
EFI_DEVICE_ERRORThere is something error while accessing device.

Definition at line 32 of file FatLiteAccess.c.

◆ FatGetNextCluster()

EFI_STATUS FatGetNextCluster ( IN PEI_FAT_PRIVATE_DATA PrivateData,
IN PEI_FAT_VOLUME Volume,
IN UINT32  Cluster,
OUT UINT32 *  NextCluster 
)

Gets the next cluster in the cluster chain

Parameters
PrivateDataGlobal memory map for accessing global variables
VolumeThe volume
ClusterThe cluster
NextClusterThe cluster number of the next cluster
Return values
EFI_SUCCESSThe address is got
EFI_INVALID_PARAMETERClusterNo exceeds the MaxCluster of the volume.
EFI_DEVICE_ERRORRead disk error

Definition at line 187 of file FatLiteAccess.c.

◆ FatReadFile()

EFI_STATUS FatReadFile ( IN PEI_FAT_PRIVATE_DATA PrivateData,
IN PEI_FAT_FILE File,
IN UINTN  Size,
OUT VOID *  Buffer 
)

Reads file data. Updates the file's CurrentPos.

Parameters
PrivateDataGlobal memory map for accessing global variables
FileThe file.
SizeThe amount of data to read.
BufferThe buffer storing the data.
Return values
EFI_SUCCESSThe data is read.
EFI_INVALID_PARAMETERFile is invalid.
EFI_DEVICE_ERRORSomething error while accessing media.

Definition at line 349 of file FatLiteAccess.c.

◆ FatReadNextDirectoryEntry()

EFI_STATUS FatReadNextDirectoryEntry ( IN PEI_FAT_PRIVATE_DATA PrivateData,
IN PEI_FAT_FILE ParentDir,
OUT PEI_FAT_FILE SubFile 
)

This function reads the next item in the parent directory and initializes the output parameter SubFile (CurrentPos is initialized to 0). The function updates the CurrentPos of the parent dir to after the item read. If no more items were found, the function returns EFI_NOT_FOUND.

Parameters
PrivateDataGlobal memory map for accessing global variables
ParentDirThe parent directory.
SubFileThe File structure containing the sub file that is caught.
Return values
EFI_SUCCESSThe next sub file is obtained.
EFI_INVALID_PARAMETERThe ParentDir is not a directory.
EFI_NOT_FOUNDNo more sub file exists.
EFI_DEVICE_ERRORSomething error while accessing media.

Definition at line 437 of file FatLiteAccess.c.

◆ FatSetFilePos()

EFI_STATUS FatSetFilePos ( IN PEI_FAT_PRIVATE_DATA PrivateData,
IN PEI_FAT_FILE File,
IN UINT32  Pos 
)

Set a file's CurrentPos and CurrentCluster, then compute StraightReadAmount.

Parameters
PrivateDatathe global memory map
Filethe file
Posthe Position which is offset from the file's CurrentPos
Return values
EFI_SUCCESSSuccess.
EFI_INVALID_PARAMETERPos is beyond file's size.
EFI_DEVICE_ERRORSomething error while accessing media.

Definition at line 263 of file FatLiteAccess.c.