summaryrefslogtreecommitdiff
path: root/MdePkg/Library/PeiSmbusLib/SmbusLib.c
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/Library/PeiSmbusLib/SmbusLib.c
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/Library/PeiSmbusLib/SmbusLib.c')
-rw-r--r--MdePkg/Library/PeiSmbusLib/SmbusLib.c38
1 files changed, 21 insertions, 17 deletions
diff --git a/MdePkg/Library/PeiSmbusLib/SmbusLib.c b/MdePkg/Library/PeiSmbusLib/SmbusLib.c
index e71f11bef8..93fadb6598 100644
--- a/MdePkg/Library/PeiSmbusLib/SmbusLib.c
+++ b/MdePkg/Library/PeiSmbusLib/SmbusLib.c
@@ -350,7 +350,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().
@@ -412,9 +412,11 @@ SmBusWriteBlock (
UINTN Length;
ASSERT (Buffer != NULL);
+ ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) >= 1);
+ ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) <= 32);
ASSERT (SMBUS_LIB_RESEARVED (SmBusAddress) == 0);
- Length = SMBUS_LIB_LENGTH (SmBusAddress) + 1;
+ Length = SMBUS_LIB_LENGTH (SmBusAddress);
return InternalSmBusExec (EfiSmbusWriteBlock, SmBusAddress, Length, Buffer, Status);
}
@@ -423,19 +425,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.
@@ -446,21 +448,23 @@ UINTN
EFIAPI
SmBusBlockProcessCall (
IN UINTN SmBusAddress,
- IN VOID *OutBuffer,
- OUT VOID *InBuffer,
+ IN VOID *WriteBuffer,
+ OUT VOID *ReadBuffer,
OUT RETURN_STATUS *Status OPTIONAL
)
{
UINTN Length;
- ASSERT (InBuffer != NULL);
- ASSERT (OutBuffer != NULL);
+ ASSERT (WriteBuffer != NULL);
+ ASSERT (ReadBuffer != NULL);
+ ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) >= 1);
+ ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) <= 32);
ASSERT (SMBUS_LIB_RESEARVED (SmBusAddress) == 0);
- Length = SMBUS_LIB_LENGTH (SmBusAddress) + 1;
+ Length = SMBUS_LIB_LENGTH (SmBusAddress);
//
- // Assuming that InBuffer is large enough to save another memory copy.
+ // Assuming that ReadBuffer is large enough to save another memory copy.
//
- InBuffer = CopyMem (InBuffer, OutBuffer, Length);
- return InternalSmBusExec (EfiSmbusBWBRProcessCall, SmBusAddress, Length, InBuffer, Status);
+ ReadBuffer = CopyMem (ReadBuffer, WriteBuffer, Length);
+ return InternalSmBusExec (EfiSmbusBWBRProcessCall, SmBusAddress, Length, ReadBuffer, Status);
}