Add inf files for PeiSmbusLibSmbus2, PeiDxePostCodeLibReportStatusCode, PeiMemoryLib and DxeSmbusLib

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@3066 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
vanjeff 2007-07-05 06:59:50 +00:00
parent af05f8b667
commit bad463843c
24 changed files with 535 additions and 132 deletions

View File

@ -2,37 +2,37 @@
Implementation of SmBusLib class library for PEI phase.
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name: DxeSmbusLib.c
**/
#include "InternalSmbusLib.h"
#include <Protocol/SmbusHc.h>
//
// Globle varible to cache pointer to Smbus protocol.
//
STATIC EFI_SMBUS_HC_PROTOCOL *mSmbus = NULL;
STATIC EFI_SMBUS_HC_PROTOCOL *mSmbus = NULL;
/**
The constructor function caches the pointer to Smbus protocol.
The constructor function locates Smbus protocol from protocol database.
It will ASSERT() if that operation fails and it will always return EFI_SUCCESS.
It will ASSERT() if that operation fails and it will always return EFI_SUCCESS.
@param ImageHandle The firmware allocated handle for the EFI image.
@param SystemTable A pointer to the EFI System Table.
@retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
**/
@ -44,7 +44,7 @@ SmbusLibConstructor (
)
{
EFI_STATUS Status;
Status = gBS->LocateProtocol (&gEfiSmbusHcProtocolGuid, NULL, (VOID**) &mSmbus);
ASSERT_EFI_ERROR (Status);
ASSERT (mSmbus != NULL);
@ -53,7 +53,7 @@ SmbusLibConstructor (
}
/**
Executes an SMBus operation to an SMBus controller.
Executes an SMBus operation to an SMBus controller.
This function provides a standard way to execute Smbus script
as defined in the SmBus Specification. The data can either be of
@ -92,7 +92,7 @@ InternalSmBusExec (
SmbusDeviceAddress,
SMBUS_LIB_COMMAND (SmBusAddress),
SmbusOperation,
SMBUS_LIB_PEC (SmBusAddress),
SMBUS_LIB_PEC (SmBusAddress),
&Length,
Buffer
);

View File

@ -0,0 +1,84 @@
#/** @file
# Component description file for Dxe Smbus Library.
#
# SMBUS Library that layers on top of the SMBUS Protocol.
# Copyright (c) 2006, Intel Corporation
#
# All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#
#
#**/
################################################################################
#
# Defines Section - statements that will be processed to create a Makefile.
#
################################################################################
[Defines]
INF_VERSION = 0x00010005
BASE_NAME = DxeSmbusLib
FILE_GUID = 4F369FB1-31A7-423c-960E-B3EFD337894F
MODULE_TYPE = DXE_DRIVER
VERSION_STRING = 1.0
LIBRARY_CLASS = SmbusLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER
EDK_RELEASE_VERSION = 0x00020000
EFI_SPECIFICATION_VERSION = 0x00020000
CONSTRUCTOR = SmbusLibConstructor
#
# The following information is for reference only and not required by the build tools.
#
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
#
################################################################################
#
# Sources Section - list of files that are required for the build to succeed.
#
################################################################################
[Sources.common]
SmbusLib.c
DxeSmbusLib.c
InternalSmbusLib.h
################################################################################
#
# Package Dependency Section - list of Package files that are required for
# this module.
#
################################################################################
[Packages]
MdePkg/MdePkg.dec
################################################################################
#
# Library Class Section - list of Library Classes that are required for
# this module.
#
################################################################################
[LibraryClasses]
BaseMemoryLib
UefiBootServicesTableLib
DebugLib
################################################################################
#
# Protocol C Name Section - list of Protocol and Protocol Notify C Names
# that this module uses or produces.
#
################################################################################
[Protocols]
gEfiSmbusHcProtocolGuid # PROTOCOL ALWAYS_CONSUMED

View File

@ -3,7 +3,7 @@
<MsaHeader>
<ModuleName>DxeSmbusLib</ModuleName>
<ModuleType>DXE_DRIVER</ModuleType>
<GuidValue>07720769-A7D0-4a8d-BE41-71CC18EB3338</GuidValue>
<GuidValue>4F369FB1-31A7-423c-960E-B3EFD337894F</GuidValue>
<Version>1.0</Version>
<Abstract>Component description file for Dxe Smbus Library.</Abstract>
<Description>SMBUS Library that layers on top of the SMBUS Protocol.</Description>
@ -45,7 +45,7 @@
</PackageDependencies>
<Protocols>
<Protocol Usage="ALWAYS_CONSUMED">
<ProtocolCName>gEfiSmbusProtocolGuid</ProtocolCName>
<ProtocolCName>gEfiSmbusHcProtocolGuid</ProtocolCName>
</Protocol>
</Protocols>
<Externs>

View File

@ -2,13 +2,13 @@
Internal header file for Smbus library.
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
@ -16,6 +16,22 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#ifndef __INTERNAL_SMBUS_LIB_H
#define __INTERNAL_SMBUS_LIB_H
//
// The package level header files this module uses
//
#include <PiDxe.h>
//
// The protocols, PPI and GUID defintions for this module
//
#include <Protocol/SmbusHc.h>
//
// The Library classes this module consumes
//
#include <Library/SmbusLib.h>
#include <Library/DebugLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/BaseMemoryLib.h>
#include <IndustryStandard/Smbus.h>
#define SMBUS_LIB_SLAVE_ADDRESS(SmBusAddress) (((SmBusAddress) >> 1) & 0x7f)
@ -28,7 +44,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
// Declaration for internal functions
//
/**
Executes an SMBus operation to an SMBus controller.
Executes an SMBus operation to an SMBus controller.
This function provides a standard way to execute Smbus script
as defined in the SmBus Specification. The data can either be of

View File

@ -2,13 +2,13 @@
Implementation of SmBusLib class library for PEI phase.
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name: SmbusLib.c
@ -189,7 +189,7 @@ SmBusReadDataByte (
ASSERT (SMBUS_LIB_RESEARVED (SmBusAddress) == 0);
InternalSmBusExec (EfiSmbusReadByte, SmBusAddress, 1, &Byte, Status);
return Byte;
}
@ -228,7 +228,7 @@ SmBusWriteDataByte (
Byte = Value;
InternalSmBusExec (EfiSmbusWriteByte, SmBusAddress, 1, &Byte, Status);
return Value;
}
@ -241,7 +241,7 @@ SmBusWriteDataByte (
If Status is not NULL, then the status of the executed command is returned in Status.
If Length in SmBusAddress is not zero, 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 Status Return status for the executed command.
@ -263,7 +263,7 @@ SmBusReadDataWord (
ASSERT (SMBUS_LIB_RESEARVED (SmBusAddress) == 0);
InternalSmBusExec (EfiSmbusReadWord, SmBusAddress, 2, &Word, Status);
return Word;
}
@ -338,7 +338,7 @@ SmBusProcessCall (
ASSERT (SMBUS_LIB_RESEARVED (SmBusAddress) == 0);
InternalSmBusExec (EfiSmbusProcessCall, SmBusAddress, 2, &Value, Status);
return Value;
}
@ -387,7 +387,7 @@ SmBusReadBlock (
The SMBUS slave address, SMBUS command, and SMBUS length fields of SmBusAddress are required.
Bytes are written to the SMBUS from Buffer.
The number of bytes written 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.
If Status is not NULL, then the status of the executed command is returned in Status.
If Length in SmBusAddress is zero or greater than 32, then ASSERT().
If Buffer is NULL, then ASSERT().
If any reserved bits of SmBusAddress are set, then ASSERT().

View File

@ -2,22 +2,33 @@
HII Library implementation that uses DXE protocols and services.
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name: HiiLib.c
**/
//
// The package level header files this module uses
//
#include <PiDxe.h>
//
// The Library classes this module consumes
//
#include <Library/HiiLib.h>
#include <Library/DebugLib.h>
#include <Library/MemoryAllocationLib.h>
/**
This function allocates pool for an EFI_HII_PACKAGES structure
with enough space for the variable argument list of package pointers.
The allocated structure is initialized using NumberOfPackages, Guid,
The allocated structure is initialized using NumberOfPackages, Guid,
and the variable length argument list of package pointers.
@param NumberOfPackages The number of HII packages to prepare.
@ -36,7 +47,7 @@ PreparePackages (
{
//
// BugBug: Need more detail on UEFI spec.
//
//
ASSERT (FALSE);
return NULL;
return NULL;
}

View File

@ -0,0 +1,80 @@
#/** @file
# Post code library based on report status code library
#
# PostCode Library for PEIMs and DXE drivers that send PostCode to ReportStatusCode
# Copyright (c) 2006, Intel Corporation.
#
# All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#
#
#**/
################################################################################
#
# Defines Section - statements that will be processed to create a Makefile.
#
################################################################################
[Defines]
INF_VERSION = 0x00010005
BASE_NAME = PeiDxePostCodeLibReportStatusCode
FILE_GUID = e062c52d-78dc-4cc5-b246-b13497a8123c
MODULE_TYPE = PEIM
VERSION_STRING = 1.0
LIBRARY_CLASS = PostCodeLib|DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER PEIM PEI_CORE UEFI_APPLICATION UEFI_DRIVER
EDK_RELEASE_VERSION = 0x00020000
EFI_SPECIFICATION_VERSION = 0x00020000
#
# The following information is for reference only and not required by the build tools.
#
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
#
################################################################################
#
# Sources Section - list of files that are required for the build to succeed.
#
################################################################################
[Sources.common]
PostCode.c
################################################################################
#
# Package Dependency Section - list of Package files that are required for
# this module.
#
################################################################################
[Packages]
MdePkg/MdePkg.dec
################################################################################
#
# Library Class Section - list of Library Classes that are required for
# this module.
#
################################################################################
[LibraryClasses]
BaseLib
PcdLib
ReportStatusCodeLib
################################################################################
#
# Pcd FIXED_AT_BUILD - list of PCDs that this module is coded for.
#
################################################################################
[PcdsFixedAtBuild.common]
PcdPostCodePropertyMask|gEfiMdePkgTokenSpaceGuid

View File

@ -2,24 +2,36 @@
Report Status Code Library Post Code functions for DXE Phase.
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
//
// The package level header files this module uses
//
#include <PiPei.h>
//
// The Library classes this module consumes
//
#include <Library/PostCodeLib.h>
#include <Library/ReportStatusCodeLib.h>
#include <Library/PcdLib.h>
#include <Library/BaseLib.h>
/**
Converts POST code value to status code value.
This macro converts the post code to status code value. Bits 0..4 of PostCode
are mapped to bits 16..20 of status code value, and bits 5..7 of PostCode are mapped to bits
24..26 of status code value.
This macro converts the post code to status code value. Bits 0..4 of PostCode
are mapped to bits 16..20 of status code value, and bits 5..7 of PostCode are mapped to bits
24..26 of status code value.
@param PostCode POST code value.
@param PostCode POST code value.
@return The converted status code value.
@ -30,14 +42,14 @@
/**
Sends an 32-bit value to a POST card.
Sends the 32-bit value specified by Value to a POST card, and returns Value.
Some implementations of this library function may perform I/O operations
directly to a POST card device. Other implementations may send Value to
ReportStatusCode(), and the status code reporting mechanism will eventually
Sends the 32-bit value specified by Value to a POST card, and returns Value.
Some implementations of this library function may perform I/O operations
directly to a POST card device. Other implementations may send Value to
ReportStatusCode(), and the status code reporting mechanism will eventually
display the 32-bit value on the status reporting device.
PostCode() must actively prevent recursion. If PostCode() is called while
processing another any other Report Status Code Library function, then
PostCode() must actively prevent recursion. If PostCode() is called while
processing another any other Report Status Code Library function, then
PostCode() must return Value immediately.
@param Value The 32-bit value to write to the POST card.
@ -60,21 +72,21 @@ PostCode (
Sends an 32-bit value to a POST and associated ASCII string.
Sends the 32-bit value specified by Value to a POST card, and returns Value.
If Description is not NULL, then the ASCII string specified by Description is
also passed to the handler that displays the POST card value. Some
implementations of this library function may perform I/O operations directly
to a POST card device. Other implementations may send Value to ReportStatusCode(),
and the status code reporting mechanism will eventually display the 32-bit
value on the status reporting device.
If Description is not NULL, then the ASCII string specified by Description is
also passed to the handler that displays the POST card value. Some
implementations of this library function may perform I/O operations directly
to a POST card device. Other implementations may send Value to ReportStatusCode(),
and the status code reporting mechanism will eventually display the 32-bit
value on the status reporting device.
PostCodeWithDescription()must actively prevent recursion. If
PostCodeWithDescription() is called while processing another any other Report
Status Code Library function, then PostCodeWithDescription() must return Value
PostCodeWithDescription()must actively prevent recursion. If
PostCodeWithDescription() is called while processing another any other Report
Status Code Library function, then PostCodeWithDescription() must return Value
immediately.
@param Value The 32-bit value to write to the POST card.
@param Description Pointer to an ASCII string that is a description of the
POST code value. This is an optional parameter that may
@param Description Pointer to an ASCII string that is a description of the
POST code value. This is an optional parameter that may
be NULL.
@return Value
@ -87,7 +99,7 @@ PostCodeWithDescription (
IN CONST CHAR8 *Description OPTIONAL
)
{
if (Description == NULL) {
if (Description == NULL) {
REPORT_STATUS_CODE (
EFI_PROGRESS_CODE,
POST_CODE_TO_STATUS_CODE_VALUE (Value)
@ -108,12 +120,12 @@ PostCodeWithDescription (
/**
Returns TRUE if POST Codes are enabled.
This function returns TRUE if the POST_CODE_PROPERTY_POST_CODE_ENABLED
This function returns TRUE if the POST_CODE_PROPERTY_POST_CODE_ENABLED
bit of PcdPostCodePropertyMask is set. Otherwise FALSE is returned.
@retval TRUE The POST_CODE_PROPERTY_POST_CODE_ENABLED bit of
@retval TRUE The POST_CODE_PROPERTY_POST_CODE_ENABLED bit of
PcdPostCodeProperyMask is set.
@retval FALSE The POST_CODE_PROPERTY_POST_CODE_ENABLED bit of
@retval FALSE The POST_CODE_PROPERTY_POST_CODE_ENABLED bit of
PcdPostCodeProperyMask is clear.
**/
@ -130,13 +142,13 @@ PostCodeEnabled (
/**
Returns TRUE if POST code descriptions are enabled.
This function returns TRUE if the
POST_CODE_PROPERTY_POST_CODE_ENABLED bit of
This function returns TRUE if the
POST_CODE_PROPERTY_POST_CODE_ENABLED bit of
PcdPostCodePropertyMask is set. Otherwise FALSE is returned.
@retval TRUE The POST_CODE_PROPERTY_POST_CODE_ENABLED
@retval TRUE The POST_CODE_PROPERTY_POST_CODE_ENABLED
bit of PcdPostCodeProperyMask is set.
@retval FALSE The POST_CODE_PROPERTY_POST_CODE_ENABLED
@retval FALSE The POST_CODE_PROPERTY_POST_CODE_ENABLED
bit of PcdPostCodeProperyMask is clear.
**/

View File

@ -34,8 +34,8 @@
mismatched byte in DestinationBuffer.
If Length > 0 and DestinationBuffer is NULL and Length > 0, then ASSERT().
If Length > 0 and SourceBuffer is NULL and Length > 0, then ASSERT().
If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then ASSERT().
If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT().
If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then ASSERT().
If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT().
@param DestinationBuffer Pointer to the destination buffer to compare.

View File

@ -31,8 +31,8 @@
This function copies Length bytes from SourceBuffer to DestinationBuffer, and returns
DestinationBuffer. The implementation must be reentrant, and it must handle the case
where SourceBuffer overlaps DestinationBuffer.
If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then ASSERT().
If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT().
If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then ASSERT().
If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT().
@param DestinationBuffer Pointer to the destination buffer of the memory copy.
@param SourceBuffer Pointer to the source buffer of the memory copy.

View File

@ -23,6 +23,8 @@
**/
#include "MemLibInternals.h"
/**
Copies a source GUID to a destination GUID.
@ -102,7 +104,7 @@ CompareGuid (
If Length > 0 and Buffer is NULL, then ASSERT().
If Buffer is not aligned on a 32-bit boundary, then ASSERT().
If Length is not aligned on a 128-bit boundary, then ASSERT().
If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().
If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().
@param Buffer Pointer to the target buffer to scan.
@param Length Number of bytes in Buffer to scan.

View File

@ -26,6 +26,18 @@
#ifndef __MEM_LIB_INTERNALS__
#define __MEM_LIB_INTERNALS__
//
// The package level header files this module uses
//
#include <PiPei.h>
//
// The Library classes this module consumes
//
#include <Library/BaseMemoryLib.h>
#include <Library/PeiServicesTablePointerLib.h>
#include <Library/DebugLib.h>
#include <Library/BaseLib.h>
/**
Copy Length bytes from Source to Destination.

View File

@ -0,0 +1,86 @@
#/** @file
# Component description file for Pei Memory Library
#
# Base Memory Library implementation that uses PEI Services
# where possible for size reduction.
# Copyright (c) 2006, Intel Corporation
#
# All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#
#
#**/
################################################################################
#
# Defines Section - statements that will be processed to create a Makefile.
#
################################################################################
[Defines]
INF_VERSION = 0x00010005
BASE_NAME = PeiMemoryLib
FILE_GUID = 3a9759d2-53bc-4eb2-abcd-c93099419063
MODULE_TYPE = PEIM
VERSION_STRING = 1.0
LIBRARY_CLASS = BaseMemoryLib|PEIM
EDK_RELEASE_VERSION = 0x00020000
EFI_SPECIFICATION_VERSION = 0x00020000
#
# The following information is for reference only and not required by the build tools.
#
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
#
################################################################################
#
# Sources Section - list of files that are required for the build to succeed.
#
################################################################################
[Sources.common]
ScanMem64Wrapper.c
ScanMem32Wrapper.c
ScanMem16Wrapper.c
ScanMem8Wrapper.c
ZeroMemWrapper.c
CompareMemWrapper.c
SetMem64Wrapper.c
SetMem32Wrapper.c
SetMem16Wrapper.c
SetMemWrapper.c
CopyMemWrapper.c
MemLibGeneric.c
MemLibGuid.c
MemLib.c
MemLibInternals.h
################################################################################
#
# Package Dependency Section - list of Package files that are required for
# this module.
#
################################################################################
[Packages]
MdePkg/MdePkg.dec
################################################################################
#
# Library Class Section - list of Library Classes that are required for
# this module.
#
################################################################################
[LibraryClasses]
BaseLib
DebugLib
PeiServicesTablePointerLib

View File

@ -36,7 +36,7 @@
If Length > 0 and Buffer is NULL, then ASSERT().
If Buffer is not aligned on a 16-bit boundary, then ASSERT().
If Length is not aligned on a 16-bit boundary, then ASSERT().
If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().
If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().
@param Buffer Pointer to the target buffer to scan.
@param Length Number of bytes in Buffer to scan.

View File

@ -36,7 +36,7 @@
If Length > 0 and Buffer is NULL, then ASSERT().
If Buffer is not aligned on a 32-bit boundary, then ASSERT().
If Length is not aligned on a 32-bit boundary, then ASSERT().
If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().
If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().
@param Buffer Pointer to the target buffer to scan.
@param Length Number of bytes in Buffer to scan.

View File

@ -36,7 +36,7 @@
If Length > 0 and Buffer is NULL, then ASSERT().
If Buffer is not aligned on a 64-bit boundary, then ASSERT().
If Length is not aligned on a 64-bit boundary, then ASSERT().
If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().
If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().
@param Buffer Pointer to the target buffer to scan.
@param Length Number of bytes in Buffer to scan.

View File

@ -34,7 +34,7 @@
then a pointer to the matching byte in the target buffer is returned. If no match is found,
then NULL is returned. If Length is 0, then NULL is returned.
If Length > 0 and Buffer is NULL, then ASSERT().
If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().
If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().
@param Buffer Pointer to the target buffer to scan.
@param Length Number of bytes in Buffer to scan.
@ -56,6 +56,6 @@ ScanMem8 (
}
ASSERT (Buffer != NULL);
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
return (VOID*)InternalMemScanMem8 (Buffer, Length, Value);
}

View File

@ -29,7 +29,7 @@
Fills a target buffer with a byte value, and returns the target buffer.
This function fills Length bytes of Buffer with Value, and returns Buffer.
If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().
If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().
@param Buffer Memory to set.
@param Length Number of bytes to set.

View File

@ -2,13 +2,13 @@
Internal header file for Smbus library.
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
@ -16,6 +16,22 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#ifndef __INTERNAL_SMBUS_LIB_H
#define __INTERNAL_SMBUS_LIB_H
//
// The package level header files this module uses
//
#include <PiPei.h>
//
// The protocols, PPI and GUID defintions for this module
//
#include <Ppi/Smbus2.h>
//
// The Library classes this module consumes
//
#include <Library/SmbusLib.h>
#include <Library/DebugLib.h>
#include <Library/PeiServicesTablePointerLib.h>
#include <Library/BaseMemoryLib.h>
#define SMBUS_LIB_SLAVE_ADDRESS(SmBusAddress) (((SmBusAddress) >> 1) & 0x7f)
#define SMBUS_LIB_COMMAND(SmBusAddress) (((SmBusAddress) >> 8) & 0xff)
#define SMBUS_LIB_LENGTH(SmBusAddress) (((SmBusAddress) >> 16) & 0x3f)
@ -42,7 +58,7 @@ InternalGetSmbusPpi (
);
/**
Executes an SMBus operation to an SMBus controller.
Executes an SMBus operation to an SMBus controller.
This function provides a standard way to execute Smbus script
as defined in the SmBus Specification. The data can either be of

View File

@ -2,21 +2,19 @@
Implementation of SmBusLib class library for PEI phase.
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name: PeiSmbusLib.c
**/
#include <Ppi/Smbus2.h>
#include "InternalSmbusLib.h"
/**
@ -32,7 +30,7 @@ Module Name: PeiSmbusLib.c
EFI_PEI_SMBUS2_PPI *
InternalGetSmbusPpi (
EFI_PEI_SERVICES **PeiServices
)
)
{
EFI_STATUS Status;
EFI_PEI_SMBUS2_PPI *SmbusPpi;
@ -45,7 +43,7 @@ InternalGetSmbusPpi (
}
/**
Executes an SMBus operation to an SMBus controller.
Executes an SMBus operation to an SMBus controller.
This function provides a standard way to execute Smbus script
as defined in the SmBus Specification. The data can either be of
@ -88,7 +86,7 @@ InternalSmBusExec (
SmbusDeviceAddress,
SMBUS_LIB_COMMAND (SmBusAddress),
SmbusOperation,
SMBUS_LIB_PEC (SmBusAddress),
SMBUS_LIB_PEC (SmBusAddress),
&Length,
Buffer
);

View File

@ -0,0 +1,84 @@
#/** @file
# Component description file for Pei Smbus Library.
#
# SMBUS library that layers on top of the SMBUS PPI.
# Copyright (c) 2006 - 2007, Intel Corporation
#
# All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#
#
#**/
################################################################################
#
# Defines Section - statements that will be processed to create a Makefile.
#
################################################################################
[Defines]
INF_VERSION = 0x00010005
BASE_NAME = PeiSmbusLib
FILE_GUID = 2A1E1C92-AABA-4d62-AC40-F3A4C3387356
MODULE_TYPE = PEIM
VERSION_STRING = 1.0
LIBRARY_CLASS = SmbusLib|PEIM
EDK_RELEASE_VERSION = 0x00020000
EFI_SPECIFICATION_VERSION = 0x00020000
#
# The following information is for reference only and not required by the build tools.
#
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
#
################################################################################
#
# Sources Section - list of files that are required for the build to succeed.
#
################################################################################
[Sources.common]
SmbusLib.c
PeiSmbusLib.c
InternalSmbusLib.h
################################################################################
#
# Package Dependency Section - list of Package files that are required for
# this module.
#
################################################################################
[Packages]
MdePkg/MdePkg.dec
################################################################################
#
# Library Class Section - list of Library Classes that are required for
# this module.
#
################################################################################
[LibraryClasses]
BaseMemoryLib
PeiServicesTablePointerLib
DebugLib
################################################################################
#
# PPI C Name Section - list of PPI and PPI Notify C Names that this module
# uses or produces.
#
################################################################################
[Ppis]
gEfiPeiSmbus2PpiGuid # PPI ALWAYS_CONSUMED

View File

@ -3,7 +3,7 @@
<MsaHeader>
<ModuleName>PeiSmbusLib</ModuleName>
<ModuleType>PEIM</ModuleType>
<GuidValue>51C4C059-67F0-4e3c-9A55-FF42A8291C8C</GuidValue>
<GuidValue>2A1E1C92-AABA-4d62-AC40-F3A4C3387356</GuidValue>
<Version>1.0</Version>
<Abstract>Component description file for Pei Smbus Library.</Abstract>
<Description>SMBUS library that layers on top of the SMBUS PPI.</Description>
@ -45,7 +45,7 @@
</PackageDependencies>
<PPIs>
<Ppi Usage="ALWAYS_CONSUMED">
<PpiCName>gEfiPeiSmbusPpiGuid</PpiCName>
<PpiCName>gEfiPeiSmbusPpi2Guid</PpiCName>
</Ppi>
</PPIs>
<Externs>

View File

@ -2,20 +2,19 @@
Implementation of SmBusLib class library for PEI phase.
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name: SmbusLib.c
**/
#include <Ppi/Smbus2.h>
#include "InternalSmbusLib.h"
/**
@ -190,7 +189,7 @@ SmBusReadDataByte (
ASSERT (SMBUS_LIB_RESEARVED (SmBusAddress) == 0);
InternalSmBusExec (EfiSmbusReadByte, SmBusAddress, 1, &Byte, Status);
return Byte;
}
@ -229,7 +228,7 @@ SmBusWriteDataByte (
Byte = Value;
InternalSmBusExec (EfiSmbusWriteByte, SmBusAddress, 1, &Byte, Status);
return Value;
}
@ -242,7 +241,7 @@ SmBusWriteDataByte (
If Status is not NULL, then the status of the executed command is returned in Status.
If Length in SmBusAddress is not zero, 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 Status Return status for the executed command.
@ -264,7 +263,7 @@ SmBusReadDataWord (
ASSERT (SMBUS_LIB_RESEARVED (SmBusAddress) == 0);
InternalSmBusExec (EfiSmbusReadWord, SmBusAddress, 2, &Word, Status);
return Word;
}
@ -339,7 +338,7 @@ SmBusProcessCall (
ASSERT (SMBUS_LIB_RESEARVED (SmBusAddress) == 0);
InternalSmBusExec (EfiSmbusProcessCall, SmBusAddress, 2, &Value, Status);
return Value;
}
@ -388,7 +387,7 @@ SmBusReadBlock (
The SMBUS slave address, SMBUS command, and SMBUS length fields of SmBusAddress are required.
Bytes are written to the SMBUS from Buffer.
The number of bytes written 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.
If Status is not NULL, then the status of the executed command is returned in Status.
If Length in SmBusAddress is zero or greater than 32, then ASSERT().
If Buffer is NULL, then ASSERT().
If any reserved bits of SmBusAddress are set, then ASSERT().

View File

@ -98,16 +98,19 @@
${WORKSPACE}/MdePkg/Library/DxeMemoryAllocationLib/DxeMemoryAllocationLib.inf
${WORKSPACE}/MdePkg/Library/DxePcdLib/DxePcdLib.inf
${WORKSPACE}/MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
# ${WORKSPACE}/MdePkg/Library/DxeSmbusLib/DxeSmbusLib.inf
${WORKSPACE}/MdePkg/Library/DxeSmbusLib/DxeSmbusLib.inf
#${WORKSPACE}/MdePkg/Library/HiiLib/HiiLib.inf
${WORKSPACE}/MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf
${WORKSPACE}/MdePkg/Library/PeiDxePostCodeLibReportStatusCode/PeiDxePostCodeLibReportStatusCode.inf
${WORKSPACE}/MdePkg/Library/PeiHobLib/PeiHobLib.inf
${WORKSPACE}/MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
${WORKSPACE}/MdePkg/Library/PeiMemoryLib/PeiMemoryLib.inf
${WORKSPACE}/MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf
${WORKSPACE}/MdePkg/Library/PeiPcdLib/PeiPcdLib.inf
${WORKSPACE}/MdePkg/Library/PeiResourcePublicationLib/PeiResourcePublicationLib.inf
${WORKSPACE}/MdePkg/Library/PeiServicesLib/PeiServicesLib.inf
${WORKSPACE}/MdePkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf
# ${WORKSPACE}/MdePkg/Library/PeiSmbusLib/PeiSmbusLib.inf
${WORKSPACE}/MdePkg/Library/PeiSmbusLibSmbus2/PeiSmbusLib.inf
${WORKSPACE}/MdePkg/Library/SerialPortLibNull/SerialPortLibNull.inf
${WORKSPACE}/MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
${WORKSPACE}/MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf