Code Scrub for Dxe Core.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5560 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
qhuang8
2008-07-24 02:54:45 +00:00
parent 11c11e4ecf
commit 022c6d45ef
38 changed files with 2499 additions and 2504 deletions

View File

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