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().