Add following library instances to MDE package:

1. DxePciLibPciRootBridgeIo
2. DxePciSegmentLibPciRootBridgeIo
3. PeiPciLibPciCfg2
4. PeiPciSegmentLibPciCfg2
5. UefiPalLib
6. UefiSalLib 

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6451 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
xli24 2008-11-11 08:33:02 +00:00
parent dd4a462dcb
commit 1a3eaf06d5
14 changed files with 6259 additions and 1 deletions

View File

@ -0,0 +1,55 @@
# @file
# Component description file for PCI Lib using PCI Root Bridge I/O Protocol
#
# This library produces the APIs from the PCI Library and implements these APIs
# by calling into the PCI Root Bridge I/O Protocol. The PCI Root Bridge I/O Protocol is
# typically produced by a chipset specific DXE driver.
# This library binds to the first PCI Root Bridge I/O Protocol in the platform. As a result,
# it should only be used on platforms that contain a single PCI root bridge.
#
# Copyright (c) 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]
INF_VERSION = 0x00010005
BASE_NAME = DxePciLibPciRootBridgeIo
FILE_GUID = 90EC42CB-B780-4eb8-8E99-C8E3E5F37530
MODULE_TYPE = DXE_DRIVER
VERSION_STRING = 1.0
LIBRARY_CLASS = PciLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_DRIVER DXE_SAL_DRIVER UEFI_DRIVER UEFI_APPLICATION
EDK_RELEASE_VERSION = 0x00020000
EFI_SPECIFICATION_VERSION = 0x00020000
CONSTRUCTOR = PciLibConstructor
#
# The following information is for reference only and not required by the build tools.
#
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
#
[Sources.common]
PciLib.c
[Packages]
MdePkg/MdePkg.dec
[LibraryClasses]
BaseLib
UefiBootServicesTableLib
DebugLib
[Protocols]
gEfiPciRootBridgeIoProtocolGuid # PROTOCOL ALWAYS_CONSUMED

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,58 @@
# @file
# Component description file for PCI Segment Lib using PCI Root Bridge I/O Protocol
#
# This library produces the APIs from the PCI Library and implements these APIs
# by calling into the PCI Root Bridge I/O Protocols that are present in the platform.
# The PCI Root Bridge I/O Protocols are typically produced by a chipset specific DXE driver.
# This library binds to all of the PCI Root Bridge I/O Protocols in the platform and handles
# the translation from a PCI segment number into a specific PCI Root Bridge I/O Protocol.
#
# Copyright (c) 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]
INF_VERSION = 0x00010005
BASE_NAME = DxePciSegmentLibPciRootBridgeIo
FILE_GUID = C6068612-B6E0-48a3-BB92-60E4A4F89EDF
MODULE_TYPE = DXE_DRIVER
VERSION_STRING = 1.0
LIBRARY_CLASS = PciSegmentLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_DRIVER DXE_SAL_DRIVER UEFI_DRIVER UEFI_APPLICATION
EDK_RELEASE_VERSION = 0x00020000
EFI_SPECIFICATION_VERSION = 0x00020000
CONSTRUCTOR = PciSegmentLibConstructor
DESTRUCTOR = PciSegmentLibDestructor
#
# The following information is for reference only and not required by the build tools.
#
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
#
[Sources.common]
PciSegmentLib.h
PciSegmentLib.c
[Packages]
MdePkg/MdePkg.dec
[LibraryClasses]
MemoryAllocationLib
BaseLib
UefiBootServicesTableLib
DebugLib
[Protocols]
gEfiPciRootBridgeIoProtocolGuid # PROTOCOL ALWAYS_CONSUMED

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,59 @@
/** @file
Include file of PciSegmentPciRootBridgeIo Library.
Copyright (c) 2007 - 2008, 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.
**/
#ifndef __DXE_PCI_SEGMENT_LIB__
#define __DXE_PCI_SEGMENT_LIB__
#include <PiDxe.h>
#include <Protocol/PciRootBridgeIo.h>
#include <Library/PciSegmentLib.h>
#include <Library/BaseLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/DebugLib.h>
#include <IndustryStandard/Acpi.h>
typedef struct {
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
UINT32 SegmentNumber;
UINT64 MinBusNumber;
UINT64 MaxBusNumber;
} PCI_ROOT_BRIDGE_DATA;
/**
Assert the validity of a PCI Segment address.
A valid PCI address should not contain 1's in bits 31:28
@param A The address to validate.
@param M Additional bits to assert to be zero.
**/
#define ASSERT_INVALID_PCI_SEGMENT_ADDRESS(A,M) \
ASSERT (((A) & (0xf0000000 | (M))) == 0)
/**
Translate PCI Lib address into format of PCI CFG2 PPI.
@param A Address that encodes the PCI Bus, Device, Function and
Register.
**/
#define PCI_TO_PCICFG2_ADDRESS(A) \
(((A) << 4) & 0xff000000) | (((A) >> 4) & 0x00000700) | (((A) << 1) & 0x001f0000) | ((UINT64)((A) & 0xFFF) << 32)
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,55 @@
# @file
# Component description file for PCI Lib using PCI CFG2 PPI
#
# This library produces the APIs from the PCI Library and implements
# these APIs by calling into the EFI_PEI_PCI CFG2 PPI. One or more EFI_PEI_PCI CFG2
# PPIs are typically produced by a chipset specific PEIM. This library only uses
# the first PPI found, so this library instance should only be used platforms
# with a single PCI segment.
#
# Copyright (c) 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]
INF_VERSION = 0x00010005
BASE_NAME = PeiPciLibPciCfg2
FILE_GUID = FA3AD693-D58A-4619-960B-8EE85C914870
MODULE_TYPE = PEIM
VERSION_STRING = 1.0
LIBRARY_CLASS = PciLib|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.common]
PciLib.c
[Packages]
MdePkg/MdePkg.dec
[LibraryClasses]
PeiServicesTablePointerLib
BaseLib
DebugLib
PeiServicesLib
[Ppis]
gEfiPciCfg2PpiGuid # PPI ALWAYS_CONSUMED

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,52 @@
# @file
# This driver implements PCI Segment Lib using PCI CFG2 PPI.
#
# This library produces the APIs from the PCI Segment Library and
# implements these APIs by calling into the EFI_PEI_PCI CFG2 PPI. One or more
# EFI_PEI_PCI CFG2 PPIs are typically produced by a chipset specific PEIM.
# This library instance should only be used platforms with multiple PCI segments.
#
# Copyright (c) 2007 - 2008, 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]
INF_VERSION = 0x00010005
BASE_NAME = PeiPciSegmentLibPciCfg2
FILE_GUID = 254901AD-7DB7-45f8-93C8-93D579398D9F
MODULE_TYPE = PEIM
VERSION_STRING = 1.0
LIBRARY_CLASS = PciSegmentLib|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
#
[Sources.common]
PciSegmentLib.c
[Packages]
MdePkg/MdePkg.dec
[LibraryClasses]
PeiServicesTablePointerLib
BaseLib
DebugLib
PeiServicesLib
[Ppis]
gEfiPciCfg2PpiGuid # PPI ALWAYS_CONSUMED

View File

@ -0,0 +1,126 @@
/** @file
PAL Library implementation built upon UEFI.
Copyright (c) 2007 - 2008, 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.
**/
#include <PiDxe.h>
#include <IndustryStandard/Sal.h>
#include <Library/UefiLib.h>
#include <Library/BaseLib.h>
#include <Library/DebugLib.h>
#include <Guid/SalSystemTable.h>
UINT64 mPalProcEntry;
/**
Makes a PAL procedure call.
This is a wrapper function to make a PAL procedure call. Based on the Index value,
this API will make static or stacked PAL call. Architected procedures may be designated
as required or optional. If a PAL procedure is specified as optional, a unique return
code of 0xFFFFFFFFFFFFFFFF is returned in the Status field of the PAL_CALL_RETURN structure.
This indicates that the procedure is not present in this PAL implementation. It is the
caller's responsibility to check for this return code after calling any optional PAL
procedure. No parameter checking is performed on the 4 input parameters, but there are
some common rules that the caller should follow when making a PAL call. Any address
passed to PAL as buffers for return parameters must be 8-byte aligned. Unaligned addresses
may cause undefined results. For those parameters defined as reserved or some fields
defined as reserved must be zero filled or the invalid argument return value may be
returned or undefined result may occur during the execution of the procedure.
This function is only available on IPF.
@param Index - The PAL procedure Index number.
@param Arg2 - The 2nd parameter for PAL procedure calls.
@param Arg3 - The 3rd parameter for PAL procedure calls.
@param Arg4 - The 4th parameter for PAL procedure calls.
@return structure returned from the PAL Call procedure, including the status and return value.
**/
PAL_CALL_RETURN
EFIAPI
PalCall (
IN UINT64 Index,
IN UINT64 Arg2,
IN UINT64 Arg3,
IN UINT64 Arg4
)
{
//
// mPalProcEntry is initialized in library constructor as PAL entry.
//
return AsmPalCall (
mPalProcEntry,
Index,
Arg2,
Arg3,
Arg4
);
}
/**
The constructor function of UEFI Pal Lib.
The constructor function looks up the SAL System Table in the EFI System Configuration
Table. Once the SAL System Table is found, the PAL Entry Point in the SAL System Table
will be derived and stored inot a global variable for library usage.
It will ASSERT() if the SAL System Table cannot be found or the data in the SAL System
Table is not the valid data.
@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.
**/
EFI_STATUS
EFIAPI
UefiPalLibConstructor (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
SAL_ST_ENTRY_POINT_DESCRIPTOR *SalStEntryDes;
SAL_SYSTEM_TABLE_HEADER *SalSystemTable;
Status = EfiGetSystemConfigurationTable (
&gEfiSalSystemTableGuid,
(VOID **) &SalSystemTable
);
ASSERT_EFI_ERROR (Status);
//
// Move the SAL System Table point to the first Entry
// Due to the SAL Entry is in ascending order with the Entry type,
// the type 0 Entry should be the first if exist.
//
SalStEntryDes = (SAL_ST_ENTRY_POINT_DESCRIPTOR *)(SalSystemTable + 1);
//
// Assure the SAL ENTRY Type is 0
//
ASSERT (SalStEntryDes->Type == EFI_SAL_ST_ENTRY_POINT);
mPalProcEntry = SalStEntryDes->PalProcEntry;
//
// Make sure the PalCallAddress has the valid value
//
ASSERT (mPalProcEntry != 0);
return EFI_SUCCESS;
}

View File

@ -0,0 +1,47 @@
# @file
# Uefi Instance of PAL Library Class
#
# This library implements the PAL Library Class by getting the PAL entry from SAL System
# Table, and use AsmPalCall to produce the Pal Call.
#
# Copyright (c) 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]
INF_VERSION = 0x00010005
BASE_NAME = UefiPalLib
FILE_GUID = B7F30170-9E5F-482a-B553-A145A5787003
MODULE_TYPE = UEFI_DRIVER
VERSION_STRING = 1.04
LIBRARY_CLASS = PalLib|UEFI_DRIVER UEFI_APPLICATION
EDK_RELEASE_VERSION = 0x00020000
EFI_SPECIFICATION_VERSION = 0x00020000
CONSTRUCTOR = UefiPalLibConstructor
#
# The following information is for reference only and not required by the build tools.
#
# VALID_ARCHITECTURES = IPF
#
[Sources.IPF]
UefiPalLib.c
[Packages]
MdePkg/MdePkg.dec
[LibraryClasses]
UefiLib
BaseLib
DebugLib

View File

@ -0,0 +1,138 @@
/** @file
SAL Library implementation built upon UEFI.
Copyright (c) 2007 - 2008, 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.
**/
#include <PiDxe.h>
#include <IndustryStandard/Sal.h>
#include <Library/SalLib.h>
#include <Library/UefiLib.h>
#include <Library/DebugLib.h>
#include <Guid/SalSystemTable.h>
EFI_PLABEL mPlabel;
SAL_PROC mSalProcEntry;
/**
Makes a SAL procedure call.
This is a wrapper function to make a SAL procedure call.
No parameter checking is performed on the 8 input parameters,
but there are some common rules that the caller should follow
when making a SAL call. Any address passed to SAL as buffers
for return parameters must be 8-byte aligned. Unaligned
addresses may cause undefined results. For those parameters
defined as reserved or some fields defined as reserved must be
zero filled or the invalid argument return value may be returned
or undefined result may occur during the execution of the procedure.
This function is only available on IPF.
@param Index The SAL procedure Index number
@param Arg2 The 2nd parameter for SAL procedure calls
@param Arg3 The 3rd parameter for SAL procedure calls
@param Arg4 The 4th parameter for SAL procedure calls
@param Arg5 The 5th parameter for SAL procedure calls
@param Arg6 The 6th parameter for SAL procedure calls
@param Arg7 The 7th parameter for SAL procedure calls
@param Arg8 The 8th parameter for SAL procedure calls
@return SAL returned registers.
**/
SAL_RETURN_REGS
EFIAPI
SalCall (
IN UINT64 Index,
IN UINT64 Arg2,
IN UINT64 Arg3,
IN UINT64 Arg4,
IN UINT64 Arg5,
IN UINT64 Arg6,
IN UINT64 Arg7,
IN UINT64 Arg8
)
{
//
// mSalProcEntry is initialized in library constructor as SAL entry.
//
return mSalProcEntry(
Index,
Arg2,
Arg3,
Arg4,
Arg5,
Arg6,
Arg7,
Arg8
);
}
/**
The constructor function of UEFI SAL Lib.
The constructor function looks up the SAL System Table in the EFI System Configuration
Table. Once the SAL System Table is found, the SAL Entry Point in the SAL System Table
will be derived and stored inot a global variable for library usage.
It will ASSERT() if the SAL System Table cannot be found or the data in the SAL System
Table is not the valid data.
@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.
**/
EFI_STATUS
EFIAPI
UefiSalLibConstructor (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
SAL_ST_ENTRY_POINT_DESCRIPTOR *SalStEntryDes;
SAL_SYSTEM_TABLE_HEADER *SalSystemTable;
Status = EfiGetSystemConfigurationTable (
&gEfiSalSystemTableGuid,
(VOID **) &SalSystemTable
);
ASSERT_EFI_ERROR (Status);
//
// Move the SAL System Table point to the first Entry
// Due to the SAL Entry is in ascending order with the Entry type,
// the type 0 Entry should be the first if exist.
//
SalStEntryDes = (SAL_ST_ENTRY_POINT_DESCRIPTOR *)(SalSystemTable + 1);
//
// Assure the SAL ENTRY Type is 0
//
ASSERT (SalStEntryDes->Type == EFI_SAL_ST_ENTRY_POINT);
mPlabel.EntryPoint = SalStEntryDes->SalProcEntry;
mPlabel.GP = SalStEntryDes->SalGlobalDataPointer;
//
// Make sure the EntryPoint has the real value
//
ASSERT ((mPlabel.EntryPoint != 0) && (mPlabel.GP != 0));
mSalProcEntry = (SAL_PROC)((UINT64)&(mPlabel.EntryPoint));
return EFI_SUCCESS;
}

View File

@ -0,0 +1,45 @@
# @file
# The library implements the UEFI SAL Library Class.
#
# The library implements the UEFI SAL Library Class.
# This library is for boot service only modules.
#
# Copyright (c) 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]
INF_VERSION = 0x00010005
BASE_NAME = UefiSalLib
FILE_GUID = 4ABCFD77-4A33-4089-B003-5F09BCA940A2
MODULE_TYPE = UEFI_DRIVER
VERSION_STRING = 1.04
LIBRARY_CLASS = SalLib|UEFI_DRIVER UEFI_APPLICATION
EDK_RELEASE_VERSION = 0x00020000
EFI_SPECIFICATION_VERSION = 0x00020000
CONSTRUCTOR = UefiSalLibConstructor
#
# The following information is for reference only and not required by the build tools.
#
# VALID_ARCHITECTURES = IPF
#
[Sources.IPF]
UefiSalLib.c
[Packages]
MdePkg/MdePkg.dec
[LibraryClasses]
UefiLib
BaseLib
DebugLib

View File

@ -78,7 +78,8 @@
MdePkg/Library/DxePiLib/DxePiLib.inf
MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
MdePkg/Library/DxeSmbusLib/DxeSmbusLib.inf
MdePkg/Library/DxePciLibPciRootBridgeIo/DxePciLibPciRootBridgeIo.inf
MdePkg/Library/DxePciSegmentLibPciRootBridgeIo/DxePciSegmentLibPciRootBridgeIo.inf
MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf
MdePkg/Library/PeiDxePostCodeLibReportStatusCode/PeiDxePostCodeLibReportStatusCode.inf
@ -94,6 +95,8 @@
MdePkg/Library/PeiServicesLib/PeiServicesLib.inf
MdePkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf
MdePkg/Library/PeiSmbusLibSmbus2Ppi/PeiSmbusLibSmbus2Ppi.inf
MdePkg/Library/PeiPciLibPciCfg2/PeiPciLibPciCfg2.inf
MdePkg/Library/PeiPciSegmentLibPciCfg2/PeiPciSegmentLibPciCfg2.inf
MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
@ -129,6 +132,8 @@
MdePkg/Library/PeiPalLib/PeiPalLib.inf
MdePkg/Library/PeiServicesTablePointerLibKr7/PeiServicesTablePointerLibKr7.inf
MdePkg/Library/SecPeiDxeTimerLibCpu/SecPeiDxeTimerLibCpu.inf
MdePkg/Library/UefiPalLib/UefiPalLib.inf
MdePkg/Library/UefiSalLib/UefiSalLib.inf
[Components.EBC]