summaryrefslogtreecommitdiff
path: root/MdePkg/Include/Library
diff options
context:
space:
mode:
authorqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>2006-06-22 06:08:00 +0000
committerqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>2006-06-22 06:08:00 +0000
commit4ba61e5e2a1b3cec7faaad36c252738f6f57f8a6 (patch)
treeee885b41f6738849dbe28aa291c2e4df0d1fb98f /MdePkg/Include/Library
parentf7c3054530a4603d3d611e7433ed8768a6076909 (diff)
downloadedk2-platforms-4ba61e5e2a1b3cec7faaad36c252738f6f57f8a6.tar.xz
1. UINTN & INTN issue for EBC architecture:
The MAX_BIT of EBC will no longer be fixed to bit 63. It is defined as (1ULL << (sizeof (INTN) * 8 - 1)). Make EdkModulePkg & MdePkg EBC compiler clean: treat all EFI_STATUS error code as variable. 2. PrintLib Complete all missing ASSERT()s. Fix “\n” & “%\n” issue thanks to the clarification of MWG 0.56d. Adjust StatusString array to support EBC build. 3. BaseMemoryLib Adjust ASSERT () & function header of ComparaMem, SetMemXX, ScanMemXX to synchronize with MWG 0.56d. 4.SmbusLib Change Pec bit to bit 22 SmBusAddress to synchronize MWG 0.56d. Add ASSERT()s to check if length is illegal for SmBusBlockWrite() & SmBusProcessBlock() since it is 6 bit now. 5. PerformanceLib Rename “EdkDxePerformanceLib” & “EdkPeiPerformanceLib” to “DxePerformanceLib” & “PeiPerformanceLib” respectively. Synchronize the function header of GetPerformanceMeasurement() with MWG 0.56d. 6. BasePeCoffLoaderLib. Make PeCoffLoaderLoadImage () Assert() if ImageContext is NULL> Make PeCoffLoaderLoadImage () return RETURN_INVALID_PARAMETER if the ImageAddress in ImageContext is 0. Adjust some coding style. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@593 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdePkg/Include/Library')
-rw-r--r--MdePkg/Include/Library/PeCoffLib.h69
-rw-r--r--MdePkg/Include/Library/PerformanceLib.h53
-rw-r--r--MdePkg/Include/Library/SmbusLib.h29
3 files changed, 98 insertions, 53 deletions
diff --git a/MdePkg/Include/Library/PeCoffLib.h b/MdePkg/Include/Library/PeCoffLib.h
index 08e8195a8a..0a68ae640f 100644
--- a/MdePkg/Include/Library/PeCoffLib.h
+++ b/MdePkg/Include/Library/PeCoffLib.h
@@ -75,15 +75,22 @@ typedef struct {
/**
- Retrieves information on a PE/COFF image
+ Retrieves information about a PE/COFF image.
- @param ImageContext The context of the image being loaded
+ Computes the PeCoffHeaderOffset, ImageAddress, ImageSize, DestinationAddress, CodeView,
+ PdbPointer, RelocationsStripped, SectionAlignment, SizeOfHeaders, and DebugDirectoryEntryRva
+ fields of the ImageContext structure. If ImageContext is NULL, then return RETURN_INVALID_PARAMETER.
+ If the PE/COFF image accessed through the ImageRead service in the ImageContext structure is not
+ a supported PE/COFF image type, then return RETURN_UNSUPPORTED. If any errors occur while
+ computing the fields of ImageContext, then the error status is returned in the ImageError field of
+ ImageContext.
- @retval EFI_SUCCESS The information on the PE/COFF image was collected.
- @retval EFI_INVALID_PARAMETER ImageContext is NULL.
- @retval EFI_UNSUPPORTED The PE/COFF image is not supported.
- @retval Otherwise The error status from reading the PE/COFF image using the
- ImageContext->ImageRead() function
+ @param ImageContext Pointer to the image context structure that describes the PE/COFF
+ image that needs to be examined by this function.
+
+ @retval RETURN_SUCCESS The information on the PE/COFF image was collected.
+ @retval RETURN_INVALID_PARAMETER ImageContext is NULL.
+ @retval RETURN_UNSUPPORTED The PE/COFF image is not supported.
**/
RETURN_STATUS
@@ -94,13 +101,23 @@ PeCoffLoaderGetImageInfo (
;
/**
- Relocates a PE/COFF image in memory
+ Applies relocation fixups to a PE/COFF image that was loaded with PeCoffLoaderLoadImage().
+
+ If the DestinationAddress field of ImageContext is 0, then use the ImageAddress field of
+ ImageContext as the relocation base address. Otherwise, use the DestinationAddress field
+ of ImageContext as the relocation base address. The caller must allocate the relocation
+ fixup log buffer and fill in the FixupData field of ImageContext prior to calling this function.
+ If ImageContext is NULL, then ASSERT().
- @param ImageContext Contains information on the loaded image to relocate
+ @param ImageContext Pointer to the image context structure that describes the PE/COFF
+ image that is being relocated.
- @retval EFI_SUCCESS if the PE/COFF image was relocated
- @retval EFI_LOAD_ERROR if the image is not a valid PE/COFF image
- @retval EFI_UNSUPPORTED not support
+ @retval RETURN_SUCCESS The PE/COFF image was relocated.
+ Extended status information is in the ImageError field of ImageContext.
+ @retval RETURN_LOAD_ERROR The image in not a valid PE/COFF image.
+ Extended status information is in the ImageError field of ImageContext.
+ @retval RETURN_UNSUPPORTED A relocation record type is not supported.
+ Extended status information is in the ImageError field of ImageContext.
**/
RETURN_STATUS
@@ -111,14 +128,26 @@ PeCoffLoaderRelocateImage (
;
/**
- Loads a PE/COFF image into memory
-
- @param ImageContext Contains information on image to load into memory
-
- @retval EFI_SUCCESS if the PE/COFF image was loaded
- @retval EFI_BUFFER_TOO_SMALL if the caller did not provide a large enough buffer
- @retval EFI_LOAD_ERROR if the image is a runtime driver with no relocations
- @retval EFI_INVALID_PARAMETER if the image address is invalid
+ Loads a PE/COFF image into memory.
+
+ Loads the PE/COFF image accessed through the ImageRead service of ImageContext into the buffer
+ specified by the ImageAddress and ImageSize fields of ImageContext. The caller must allocate
+ the load buffer and fill in the ImageAddress and ImageSize fields prior to calling this function.
+ The EntryPoint, FixupDataSize, CodeView, and PdbPointer fields of ImageContext are computed.
+ If ImageContext is NULL, then ASSERT().
+
+ @param ImageContext Pointer to the image context structure that describes the PE/COFF
+ image that is being loaded.
+
+ @retval RETURN_SUCCESS The PE/COFF image was loaded into the buffer specified by
+ the ImageAddress and ImageSize fields of ImageContext.
+ Extended status information is in the ImageError field of ImageContext.
+ @retval RETURN_BUFFER_TOO_SMALL The caller did not provide a large enough buffer.
+ Extended status information is in the ImageError field of ImageContext.
+ @retval RETURN_LOAD_ERROR The PE/COFF image is an EFI Runtime image with no relocations.
+ Extended status information is in the ImageError field of ImageContext.
+ @retval RETURN_INVALID_PARAMETER The image address is invalid.
+ Extended status information is in the ImageError field of ImageContext.
**/
RETURN_STATUS
diff --git a/MdePkg/Include/Library/PerformanceLib.h b/MdePkg/Include/Library/PerformanceLib.h
index 36564095e9..ca32d98b1d 100644
--- a/MdePkg/Include/Library/PerformanceLib.h
+++ b/MdePkg/Include/Library/PerformanceLib.h
@@ -84,31 +84,46 @@ EndPerformanceMeasurement (
);
/**
- Retrieves a previously logged performance measurement.
+ Attempts to retrieve a performance measurement log entry from the performance measurement log.
- Looks up the record that matches Handle, Token, and Module.
- If the record can not be found then return RETURN_NOT_FOUND.
- If the record is found then the start of the measurement is returned in StartTimeStamp,
- and the end of the measurement is returned in EndTimeStamp.
-
- @param LogEntryKey The key for the previous performance measurement log entry.
- If 0, then the first performance measurement log entry is retrieved.
- @param Handle Pointer to environment specific context used
- to identify the component being measured.
- @param Token Pointer to a Null-terminated ASCII string
- that identifies the component being measured.
- @param Module Pointer to a Null-terminated ASCII string
- that identifies the module being measured.
- @param StartTimeStamp The 64-bit time stamp that was recorded when the measurement was started.
- @param EndTimeStamp The 64-bit time stamp that was recorded when the measurement was ended.
-
- @return The key for the current performance log entry.
+ Attempts to retrieve the performance log entry specified by LogEntryKey. If LogEntryKey is
+ zero on entry, then an attempt is made to retrieve the first entry from the performance log,
+ and the key for the second entry in the log is returned. If the performance log is empty,
+ then no entry is retrieved and zero is returned. If LogEntryKey is not zero, then the performance
+ log entry associated with LogEntryKey is retrieved, and the key for the next entry in the log is
+ returned. If LogEntryKey is the key for the last entry in the log, then the last log entry is
+ retrieved and an implementation specific non-zero key value that specifies the end of the performance
+ log is returned. If LogEntryKey is equal this implementation specific non-zero key value, then no entry
+ is retrieved and zero is returned. In the cases where a performance log entry can be returned,
+ the log entry is returned in Handle, Token, Module, StartTimeStamp, and EndTimeStamp.
+ If LogEntryKey is not a valid log entry key for the performance measurement log, then ASSERT().
+ If Handle is NULL, then ASSERT().
+ If Token is NULL, then ASSERT().
+ If Module is NULL, then ASSERT().
+ If StartTimeStamp is NULL, then ASSERT().
+ If EndTimeStamp is NULL, then ASSERT().
+
+ @param LogEntryKey On entry, the key of the performance measurement log entry to retrieve.
+ 0, then the first performance measurement log entry is retrieved.
+ On exit, the key of the next performance lof entry entry.
+ @param Handle Pointer to environment specific context used to identify the component
+ being measured.
+ @param Token Pointer to a Null-terminated ASCII string that identifies the component
+ being measured.
+ @param Module Pointer to a Null-terminated ASCII string that identifies the module
+ being measured.
+ @param StartTimeStamp Pointer to the 64-bit time stamp that was recorded when the measurement
+ was started.
+ @param EndTimeStamp Pointer to the 64-bit time stamp that was recorded when the measurement
+ was ended.
+
+ @return The key for the next performance log entry (in general case).
**/
UINTN
EFIAPI
GetPerformanceMeasurement (
- UINTN LogEntryKey,
+ IN UINTN LogEntryKey,
OUT CONST VOID **Handle,
OUT CONST CHAR8 **Token,
OUT CONST CHAR8 **Module,
diff --git a/MdePkg/Include/Library/SmbusLib.h b/MdePkg/Include/Library/SmbusLib.h
index 484ab90144..6d214aaa8e 100644
--- a/MdePkg/Include/Library/SmbusLib.h
+++ b/MdePkg/Include/Library/SmbusLib.h
@@ -18,9 +18,9 @@
#define __SMBUS_LIB__
//
-// PEC BIT is bit 21 in SMBUS address
+// PEC BIT is bit 22 in SMBUS address
//
-#define SMBUS_LIB_PEC_BIT (1 << 21)
+#define SMBUS_LIB_PEC_BIT (1 << 22)
/**
Macro that converts SMBUS slave address, SMBUS command, SMBUS data length,
@@ -32,7 +32,7 @@
@param SlaveAddress SMBUS Slave Address. Range 0..127.
@param Command SMBUS Command. Range 0..255.
- @param Length SMBUS Data Length. Range 0..31.
+ @param Length SMBUS Data Length. Range 0..32.
@param Pec TRUE if Packet Error Checking is enabled. Otherwise FALSE.
**/
@@ -40,7 +40,7 @@
( ((Pec) ? SMBUS_LIB_PEC_BIT: 0) | \
(((SlaveAddress) & 0x7f) << 1) | \
(((Command) & 0xff) << 8) | \
- (((Length) & 0x1f) << 16) \
+ (((Length) & 0x3f) << 16) \
)
/**
@@ -296,7 +296,7 @@ SmBusProcessCall (
Bytes are read from the SMBUS and stored in Buffer.
The number of bytes read is returned, and will never return a value larger than 32-bytes.
If Status is not NULL, then the status of the executed command is returned in Status.
- It is the callers responsibility to make sure Buffer is large enough for the total number of bytes read.
+ It is the caller's responsibility to make sure Buffer is large enough for the total number of bytes read.
SMBUS supports a maximum transfer size of 32 bytes, so Buffer does not need to be any larger than 32 bytes.
If Length in SmBusAddress is not zero, then ASSERT().
If Buffer is NULL, then ASSERT().
@@ -355,19 +355,19 @@ SmBusWriteBlock (
Executes an SMBUS block process call command on the SMBUS device specified by SmBusAddress.
The SMBUS slave address, SMBUS command, and SMBUS length fields of SmBusAddress are required.
- Bytes are written to the SMBUS from OutBuffer. Bytes are then read from the SMBUS into InBuffer.
+ Bytes are written to the SMBUS from WriteBuffer. Bytes are then read from the SMBUS into ReadBuffer.
If Status is not NULL, then the status of the executed command is returned in Status.
- It is the callers responsibility to make sure InBuffer is large enough for the total number of bytes read.
+ It is the caller's responsibility to make sure ReadBuffer is large enough for the total number of bytes read.
SMBUS supports a maximum transfer size of 32 bytes, so Buffer does not need to be any larger than 32 bytes.
- If OutBuffer is NULL, then ASSERT().
- If InBuffer is NULL, then ASSERT().
+ If Length in SmBusAddress is zero or greater than 32, then ASSERT().
+ If WriteBuffer is NULL, then ASSERT().
+ If ReadBuffer is NULL, then ASSERT().
If any reserved bits of SmBusAddress are set, then ASSERT().
-
@param SmBusAddress Address that encodes the SMBUS Slave Address,
SMBUS Command, SMBUS Data Length, and PEC.
- @param OutBuffer Pointer to the buffer of bytes to write to the SMBUS.
- @param InBuffer Pointer to the buffer of bytes to read from the SMBUS.
+ @param WriteBuffer Pointer to the buffer of bytes to write to the SMBUS.
+ @param ReadBuffer Pointer to the buffer of bytes to read from the SMBUS.
@param Status Return status for the executed command.
This is an optional parameter and may be NULL.
@@ -378,10 +378,11 @@ UINTN
EFIAPI
SmBusBlockProcessCall (
IN UINTN SmBusAddress,
- IN VOID *OutBuffer,
- OUT VOID *InBuffer,
+ IN VOID *WriteBuffer,
+ OUT VOID *ReadBuffer,
OUT RETURN_STATUS *Status OPTIONAL
)
;
+
#endif