QuarkPlatformPkg: Add new package for Galileo boards

Changes for V4
==============
1) Move delete of QuarkSocPkg\QuarkNorthCluster\Binary\QuarkMicrocode
   from QuarkPlatformPkg commit to QuarkSocPkg commit
2) Fix incorrect license header in PlatformSecLibModStrs.uni

Changes for V3
==============
1) Set PcdResetOnMemoryTypeInformationChange FALSE in QuarkMin.dsc
   This is required because QuarkMin.dsc uses the emulated variable
   driver that does not preserve any non-volatile UEFI variables
   across reset.  If the condition is met where the memory type
   information variable needs to be updated, then the system will reset
   every time the UEFI Shell is run.  By setting this PCD to FALSE,
   then reset action is disabled.
2) Move one binary file to QuarkSocBinPkg
3) Change RMU.bin FILE statements to INF statement in DSC FD region
   to be compatible with PACKAGES_PATH search for QuarkSocBinPkg

Changes for V2
==============
1) Use new generic PCI serial driver PciSioSerialDxe in MdeModulePkg
2) Configure PcdPciSerialParameters for PCI serial driver for Quark
3) Use new MtrrLib API to reduce time to set MTRRs for all DRAM
4) Convert all UNI files to utf-8
5) Replace tabs with spaces and remove trailing spaces
6) Add License.txt

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <michael.d.kinney@intel.com>
Acked-by: Jordan Justen <jordan.l.justen@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19287 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Michael Kinney
2015-12-15 19:23:57 +00:00
committed by mdkinney
parent 9b6bbcdbfd
commit b303605e1b
190 changed files with 39436 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,395 @@
/** @file
The Header file of the Pci Host Bridge Driver.
Copyright (c) 2013-2015 Intel Corporation.
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 _PCI_HOST_BRIDGE_H_
#define _PCI_HOST_BRIDGE_H_
#include <PiDxe.h>
#include <IndustryStandard/Acpi.h>
#include <IndustryStandard/Pci.h>
#include <PciRootBridge.h>
#include <Library/UefiDriverEntryPoint.h>
#include <IndustryStandard/Pci22.h>
#include <Library/UefiLib.h>
#include <Guid/HobList.h>
#include <Library/UefiRuntimeServicesTableLib.h>
#include <Protocol/PciHostBridgeResourceAllocation.h>
#define PCI_HOST_BRIDGE_SIGNATURE SIGNATURE_32 ('e', 'h', 's', 't')
typedef struct {
UINTN Signature;
EFI_HANDLE HostBridgeHandle;
UINTN RootBridgeCount;
EFI_LIST_ENTRY Head;
BOOLEAN ResourceSubmited;
BOOLEAN CanRestarted;
EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL ResAlloc;
} PCI_HOST_BRIDGE_INSTANCE;
#define INSTANCE_FROM_RESOURCE_ALLOCATION_THIS(a) CR (a, PCI_HOST_BRIDGE_INSTANCE, ResAlloc, PCI_HOST_BRIDGE_SIGNATURE)
typedef enum {
SocketResourceRatioChanged,
SocketResourceRatioNotChanged,
SocketResourceAdjustMax
} SOCKET_RESOURCE_ADJUSTMENT_RESULT;
//
// Driver Entry Point
//
EFI_STATUS
EFIAPI
InitializePciHostBridge (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
/*++
Routine Description:
Entry point of this driver.
Arguments:
ImageHandle - Image handle of this driver.
SystemTable - Pointer to standard EFI system table.
Returns:
EFI_SUCCESS - Succeed.
EFI_DEVICE_ERROR - Fail to install PCI_ROOT_BRIDGE_IO protocol.
--*/
;
//
// HostBridge Resource Allocation interface
//
EFI_STATUS
EFIAPI
NotifyPhase (
IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,
IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PHASE Phase
)
/*++
Routine Description:
Enter a certain phase of the PCI enumeration process.
Arguments:
This - The EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL instance.
Phase - The phase during enumeration.
Returns:
EFI_SUCCESS - Succeed.
EFI_INVALID_PARAMETER - Wrong phase parameter passed in.
EFI_NOT_READY - Resources have not been submitted yet.
--*/
;
EFI_STATUS
EFIAPI
GetNextRootBridge (
IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,
IN OUT EFI_HANDLE *RootBridgeHandle
)
/*++
Routine Description:
Return the device handle of the next PCI root bridge that is associated with
this Host Bridge.
Arguments:
This - The EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_ PROTOCOL instance.
RootBridgeHandle - Returns the device handle of the next PCI Root Bridge.
On input, it holds the RootBridgeHandle returned by the most
recent call to GetNextRootBridge().The handle for the first
PCI Root Bridge is returned if RootBridgeHandle is NULL on input.
Returns:
EFI_SUCCESS - Succeed.
EFI_NOT_FOUND - Next PCI root bridge not found.
EFI_INVALID_PARAMETER - Wrong parameter passed in.
--*/
;
EFI_STATUS
EFIAPI
GetAttributes (
IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,
IN EFI_HANDLE RootBridgeHandle,
OUT UINT64 *Attributes
)
/*++
Routine Description:
Returns the attributes of a PCI Root Bridge.
Arguments:
This - The EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_ PROTOCOL instance
RootBridgeHandle - The device handle of the PCI Root Bridge
that the caller is interested in
Attributes - The pointer to attributes of the PCI Root Bridge
Returns:
EFI_SUCCESS - Succeed.
EFI_INVALID_PARAMETER - Attributes parameter passed in is NULL or
RootBridgeHandle is not an EFI_HANDLE
that was returned on a previous call to
GetNextRootBridge().
--*/
;
EFI_STATUS
EFIAPI
StartBusEnumeration (
IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,
IN EFI_HANDLE RootBridgeHandle,
OUT VOID **Configuration
)
/*++
Routine Description:
This is the request from the PCI enumerator to set up
the specified PCI Root Bridge for bus enumeration process.
Arguments:
This - The EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_ PROTOCOL instance.
RootBridgeHandle - The PCI Root Bridge to be set up.
Configuration - Pointer to the pointer to the PCI bus resource descriptor.
Returns:
EFI_SUCCESS - Succeed.
EFI_OUT_OF_RESOURCES - Not enough pool to be allocated.
EFI_INVALID_PARAMETER - RootBridgeHandle is not a valid handle.
--*/
;
EFI_STATUS
EFIAPI
SetBusNumbers (
IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,
IN EFI_HANDLE RootBridgeHandle,
IN VOID *Configuration
)
/*++
Routine Description:
This function programs the PCI Root Bridge hardware so that
it decodes the specified PCI bus range.
Arguments:
This - The EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_ PROTOCOL instance.
RootBridgeHandle - The PCI Root Bridge whose bus range is to be programmed.
Configuration - The pointer to the PCI bus resource descriptor.
Returns:
EFI_SUCCESS - Succeed.
EFI_INVALID_PARAMETER - Wrong parameters passed in.
--*/
;
EFI_STATUS
EFIAPI
SubmitResources (
IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,
IN EFI_HANDLE RootBridgeHandle,
IN VOID *Configuration
)
/*++
Routine Description:
Submits the I/O and memory resource requirements for the specified PCI Root Bridge.
Arguments:
This - The EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_ PROTOCOL instance
RootBridgeHandle - The PCI Root Bridge whose I/O and memory resource requirements
are being submitted
Configuration - The pointer to the PCI I/O and PCI memory resource descriptor
Returns:
EFI_SUCCESS - Succeed.
EFI_INVALID_PARAMETER - Wrong parameters passed in.
--*/
;
EFI_STATUS
EFIAPI
GetProposedResources (
IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,
IN EFI_HANDLE RootBridgeHandle,
OUT VOID **Configuration
)
/*++
Routine Description:
This function returns the proposed resource settings for the specified
PCI Root Bridge.
Arguments:
This - The EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_ PROTOCOL instance.
RootBridgeHandle - The PCI Root Bridge handle.
Configuration - The pointer to the pointer to the PCI I/O
and memory resource descriptor.
Returns:
EFI_SUCCESS - Succeed.
EFI_OUT_OF_RESOURCES - Not enough pool to be allocated.
EFI_INVALID_PARAMETER - RootBridgeHandle is not a valid handle.
--*/
;
EFI_STATUS
EFIAPI
PreprocessController (
IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,
IN EFI_HANDLE RootBridgeHandle,
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_PCI_ADDRESS PciAddress,
IN EFI_PCI_CONTROLLER_RESOURCE_ALLOCATION_PHASE Phase
)
/*++
Routine Description:
This function is called for all the PCI controllers that the PCI
bus driver finds. Can be used to Preprogram the controller.
Arguments:
This - The EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_ PROTOCOL instance.
RootBridgeHandle - The PCI Root Bridge handle.
PciAddress - Address of the controller on the PCI bus.
Phase - The Phase during resource allocation.
Returns:
EFI_SUCCESS - Succeed.
EFI_INVALID_PARAMETER - RootBridgeHandle is not a valid handle.
--*/
;
//
// Host Bridge Silicon specific hooks
//
UINT64
GetAllocAttributes (
IN UINTN RootBridgeIndex
)
/*++
Routine Description:
Returns the Allocation attributes for the BNB Root Bridge.
Arguments:
RootBridgeIndex - The root bridge number. 0 based.
Returns:
EFI_PCI_HOST_BRIDGE_COMBINE_MEM_PMEM | EFI_PCI_HOST_BRIDGE_MEM64_DECODE
--*/
;
EFI_STATUS
GetHostBridgeMemApertures (
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,
OUT UINT32 *Mem32Base,
OUT UINT32 *Mem32Limit,
OUT UINT64 *Mem64Base,
OUT UINT64 *Mem64Limit
)
/*++
Routine Description:
Returns memory apertures for the BNB Root Bridge.
Arguments:
PciRootBridgeIo - Pointer to Efi Pci root bridge Io protocol interface instance.
Mem32Base - Pointer to 32 bit memory base. This is the lowest 32 bit memory address
that is decoded by the Host Bridge.
Mem32Limit - Pointer to 32 bit memory limit.This is the highest 32 bit memory address
that is decoded by the Host Bridge. The size of the 32 bit window is
(Mem32Limit - Mem32base + 1).
Mem64Base - Pointer to 64 bit memory base. This is the lowest 64 bit memory address
that is decoded by the Host Bridge.
Mem64Limit - Pointer to 64 bit memory limit.This is the highest 64 bit memory address
that is decoded by the Host Bridge. The size of the 64 bit window is
(Mem64Limit - Mem64base + 1). Set Mem64Limit < Mem64Base if the host bridge
does not support 64 bit memory addresses.
Returns:
EFI_SUCCESS - Success.
--*/
;
UINT64
Power2MaxMemory (
IN UINT64 MemoryLength
)
/*++
Routine Description:
Calculate maximum memory length that can be fit to a mtrr.
Arguments:
MemoryLength - Input memory length.
Returns:
Returned Maximum length.
--*/
;
#endif

View File

@@ -0,0 +1,67 @@
## @file
# Component description file for PciHostBridge module
#
# Copyright (c) 2013-2015 Intel Corporation.
#
# 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 = PciHostBridge
FILE_GUID = D58EBCE1-AF26-488d-BE66-C164417F8C13
MODULE_TYPE = DXE_DRIVER
VERSION_STRING = 1.0
ENTRY_POINT = InitializePciHostBridge
[Sources]
PciHostBridge.h
PciRootBridge.h
PciHostBridge.c
PciRootBridgeIo.c
PciHostBridgeSupport.c
PciHostResource.h
[Packages]
MdePkg/MdePkg.dec
QuarkSocPkg/QuarkSocPkg.dec
QuarkPlatformPkg/QuarkPlatformPkg.dec
[LibraryClasses]
UefiDriverEntryPoint
UefiBootServicesTableLib
DebugLib
UefiLib
DxeServicesTableLib
UefiRuntimeServicesTableLib
DevicePathLib
BaseMemoryLib
BaseLib
[Protocols]
gEfiMetronomeArchProtocolGuid
gEfiCpuIo2ProtocolGuid
gEfiDevicePathProtocolGuid
gEfiPciRootBridgeIoProtocolGuid
gEfiPciHostBridgeResourceAllocationProtocolGuid
[Pcd]
gEfiQuarkNcSocIdTokenSpaceGuid.PcdPciHostBridgeIoBase
gEfiQuarkNcSocIdTokenSpaceGuid.PcdPciHostBridgeIoSize
gEfiQuarkNcSocIdTokenSpaceGuid.PcdPciHostBridgeMemory32Base
gEfiQuarkNcSocIdTokenSpaceGuid.PcdPciHostBridgeMemory32Size
gEfiQuarkNcSocIdTokenSpaceGuid.PcdPciHostBridgeMemory64Base
gEfiQuarkNcSocIdTokenSpaceGuid.PcdPciHostBridgeMemory64Size
gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress
gEfiQuarkNcSocIdTokenSpaceGuid.PcdPciExpressSize
[Depex]
gEfiCpuIo2ProtocolGuid AND gEfiMetronomeArchProtocolGuid

View File

@@ -0,0 +1,146 @@
/** @file
Do platform initialization for PCI bridge.
Copyright (c) 2013-2015 Intel Corporation.
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 "PciHostBridge.h"
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *mPciRootBridgeIo;
EFI_STATUS
ChipsetPreprocessController (
IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,
IN EFI_HANDLE RootBridgeHandle,
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_PCI_ADDRESS PciAddress,
IN EFI_PCI_CONTROLLER_RESOURCE_ALLOCATION_PHASE Phase
)
/*++
Routine Description:
This function is called for all the PCI controllers that the PCI
bus driver finds. Can be used to Preprogram the controller.
Arguments:
This -- The EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_ PROTOCOL instance
RootBridgeHandle -- The PCI Root Bridge handle
PciBusAddress -- Address of the controller on the PCI bus
Phase -- The Phase during resource allocation
Returns:
EFI_SUCCESS
--*/
// GC_TODO: PciAddress - add argument and description to function comment
//
// GC_TODO: PciAddress - add argument and description to function comment
//
// GC_TODO: PciAddress - add argument and description to function comment
//
// GC_TODO: PciAddress - add argument and description to function comment
//
{
EFI_STATUS Status;
UINT8 Latency;
UINT8 CacheLineSize;
if (mPciRootBridgeIo == NULL) {
//
// Get root bridge in the system.
//
Status = gBS->HandleProtocol (RootBridgeHandle, &gEfiPciRootBridgeIoProtocolGuid, (VOID **) &mPciRootBridgeIo);
ASSERT_EFI_ERROR (Status);
}
if (Phase == EfiPciBeforeResourceCollection) {
//
// Program the latency register, CLS register
//
PciAddress.Register = PCI_LATENCY_TIMER_OFFSET;
mPciRootBridgeIo->Pci.Read (
mPciRootBridgeIo,
EfiPciWidthUint8,
*((UINT64 *) &PciAddress),
1,
&Latency
);
//
// PCI-x cards come up with a default latency of 0x40. Don't touch them.
//
if (Latency == 0) {
Latency = DEFAULT_PCI_LATENCY;
mPciRootBridgeIo->Pci.Write (
mPciRootBridgeIo,
EfiPciWidthUint8,
*((UINT64 *) &PciAddress),
1,
&Latency
);
}
//
// Program Cache Line Size as 64bytes
// 16 of DWORDs = 64bytes (0x10)
//
PciAddress.Register = PCI_CACHELINE_SIZE_OFFSET;
CacheLineSize = 0x10;
mPciRootBridgeIo->Pci.Write (
mPciRootBridgeIo,
EfiPciWidthUint8,
*((UINT64 *) &PciAddress),
1,
&CacheLineSize
);
}
return EFI_SUCCESS;
}
UINT64
GetAllocAttributes (
IN UINTN RootBridgeIndex
)
/*++
Routine Description:
Returns the Allocation attributes for the BNB Root Bridge.
Arguments:
RootBridgeIndex - The root bridge number. 0 based.
Returns:
EFI_PCI_HOST_BRIDGE_COMBINE_MEM_PMEM | EFI_PCI_HOST_BRIDGE_MEM64_DECODE
--*/
{
//
// Cannot have more than one Root bridge
//
//ASSERT (RootBridgeIndex == 0);
//
// PCI Root Bridge does not support separate windows for Non-prefetchable
// and Prefetchable memory. A PCI bus driver needs to include requests for
// Prefetchable memory in the Non-prefetchable memory pool.
// Further TNB does not support 64 bit memory apertures for PCI. BNB
// can only have system memory above 4 GB,
//
return EFI_PCI_HOST_BRIDGE_COMBINE_MEM_PMEM | EFI_PCI_HOST_BRIDGE_MEM64_DECODE;
}

View File

@@ -0,0 +1,66 @@
/** @file
The Header file of the Pci Host Bridge Driver.
Copyright (c) 2013-2015 Intel Corporation.
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 _PCI_HOST_RESOURCE_H_
#define _PCI_HOST_RESOURCE_H_
#include <PiDxe.h>
#define EFI_RESOURCE_NONEXISTENT 0xFFFFFFFFFFFFFFFFULL
#define EFI_RESOURCE_LESS 0xFFFFFFFFFFFFFFFEULL
typedef struct {
UINTN BusBase;
UINTN BusLimit;
UINTN BusReserve;
UINT32 Mem32Base;
UINT32 Mem32Limit;
UINT64 Mem64Base;
UINT64 Mem64Limit;
UINTN IoBase;
UINTN IoLimit;
} PCI_ROOT_BRIDGE_RESOURCE_APERTURE;
typedef enum {
TypeIo = 0,
TypeMem32,
TypePMem32,
TypeMem64,
TypePMem64,
TypeBus,
TypeMax
} PCI_RESOURCE_TYPE;
typedef enum {
ResNone = 0,
ResSubmitted,
ResRequested,
ResAllocated,
ResStatusMax
} RES_STATUS;
typedef struct {
PCI_RESOURCE_TYPE Type;
UINT64 Base;
UINT64 Length;
UINT64 Alignment;
RES_STATUS Status;
} PCI_RES_NODE;
#endif

View File

@@ -0,0 +1,699 @@
/** @file
The PCI Root Bridge header file.
Copyright (c) 2013-2015 Intel Corporation.
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 _PCI_ROOT_BRIDGE_H_
#define _PCI_ROOT_BRIDGE_H_
#include <PiDxe.h>
#include <IndustryStandard/Acpi.h>
#include <IndustryStandard/Pci.h>
#include <PciHostResource.h>
//
// Driver Consumed Protocol Prototypes
//
#include <Protocol/Metronome.h>
#include <Protocol/CpuIo2.h>
#include <Protocol/DevicePath.h>
#include <Protocol/Runtime.h>
#include <Protocol/PciRootBridgeIo.h>
#include <Library/UefiLib.h>
#include <Library/DebugLib.h>
#include <Library/DevicePathLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DxeServicesTableLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/BaseLib.h>
//
// Define the region of memory used for DMA memory
//
#define DMA_MEMORY_TOP 0x0000000001FFFFFFULL
//
// The number of PCI root bridges
//
#define ROOT_BRIDGE_COUNT 1
//
// The default latency for controllers
//
#define DEFAULT_PCI_LATENCY 0x20
//
// Define resource status constant
//
typedef struct {
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_OPERATION Operation;
UINTN NumberOfBytes;
UINTN NumberOfPages;
EFI_PHYSICAL_ADDRESS HostAddress;
EFI_PHYSICAL_ADDRESS MappedHostAddress;
} MAP_INFO;
typedef struct {
ACPI_HID_DEVICE_PATH AcpiDevicePath;
EFI_DEVICE_PATH_PROTOCOL EndDevicePath;
} EFI_PCI_ROOT_BRIDGE_DEVICE_PATH;
#define PCI_ROOT_BRIDGE_SIGNATURE SIGNATURE_32 ('e', '2', 'p', 'b')
typedef struct {
UINT32 Signature;
EFI_LIST_ENTRY Link;
EFI_HANDLE Handle;
UINT64 RootBridgeAllocAttrib;
UINT64 Attributes;
UINT64 Supports;
PCI_RES_NODE ResAllocNode[6];
PCI_ROOT_BRIDGE_RESOURCE_APERTURE Aperture;
EFI_LOCK PciLock;
UINTN PciAddress;
UINTN PciData;
UINT32 HecBase;
UINT32 HecLen;
UINTN BusScanCount;
BOOLEAN BusNumberAssigned;
VOID *ConfigBuffer;
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL Io;
} PCI_ROOT_BRIDGE_INSTANCE;
//
// Driver Instance Data Macros
//
#define DRIVER_INSTANCE_FROM_PCI_ROOT_BRIDGE_IO_THIS(a) CR (a, PCI_ROOT_BRIDGE_INSTANCE, Io, PCI_ROOT_BRIDGE_SIGNATURE)
#define DRIVER_INSTANCE_FROM_LIST_ENTRY(a) CR (a, PCI_ROOT_BRIDGE_INSTANCE, Link, PCI_ROOT_BRIDGE_SIGNATURE)
EFI_STATUS
SimpleIioRootBridgeConstructor (
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *Protocol,
IN EFI_HANDLE HostBridgeHandle,
IN PCI_ROOT_BRIDGE_RESOURCE_APERTURE *ResAppeture,
IN UINT64 AllocAttributes
)
/*++
Routine Description:
Construct the Pci Root Bridge Io protocol.
Arguments:
Protocol - Protocol to initialize.
HostBridgeHandle - Handle to the HostBridge.
ResAppeture - Resource apperture of the root bridge.
AllocAttributes - Attribute of resouce allocated.
Returns:
EFI_SUCCESS - Success.
Others - Fail.
--*/
;
//
// Protocol Member Function Prototypes
//
EFI_STATUS
EFIAPI
RootBridgeIoPollMem (
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
IN UINT64 Address,
IN UINT64 Mask,
IN UINT64 Value,
IN UINT64 Delay,
OUT UINT64 *Result
)
/*++
Routine Description:
Poll an address in memory mapped space until an exit condition is met
or a timeout occurs.
Arguments:
This - Pointer to EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL instance.
Width - Width of the memory operation.
Address - The base address of the memory operation.
Mask - Mask used for polling criteria.
Value - Comparison value used for polling exit criteria.
Delay - Number of 100ns units to poll.
Result - Pointer to the last value read from memory location.
Returns:
EFI_SUCCESS - Success.
EFI_INVALID_PARAMETER - Invalid parameter found.
EFI_TIMEOUT - Delay expired before a match occurred.
EFI_OUT_OF_RESOURCES - Fail due to lack of resources.
--*/
;
EFI_STATUS
EFIAPI
RootBridgeIoPollIo (
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
IN UINT64 Address,
IN UINT64 Mask,
IN UINT64 Value,
IN UINT64 Delay,
OUT UINT64 *Result
)
/*++
Routine Description:
Poll an address in I/O space until an exit condition is met
or a timeout occurs.
Arguments:
This - Pointer to EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL instance.
Width - Width of I/O operation.
Address - The base address of the I/O operation.
Mask - Mask used for polling criteria.
Value - Comparison value used for polling exit criteria.
Delay - Number of 100ns units to poll.
Result - Pointer to the last value read from memory location.
Returns:
EFI_SUCCESS - Success.
EFI_INVALID_PARAMETER - Invalid parameter found.
EFI_TIMEOUT - Delay expired before a match occurred.
EFI_OUT_OF_RESOURCES - Fail due to lack of resources.
--*/
;
EFI_STATUS
EFIAPI
RootBridgeIoMemRead (
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
IN UINT64 Address,
IN UINTN Count,
IN OUT VOID *Buffer
)
/*++
Routine Description:
Allow read from memory mapped I/O space.
Arguments:
This - Pointer to EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL instance.
Width - The width of memory operation.
Address - Base address of the memory operation.
Count - Number of memory opeartion to perform.
Buffer - The destination buffer to store data.
Returns:
EFI_SUCCESS - Success.
EFI_INVALID_PARAMETER - Invalid parameter found.
EFI_OUT_OF_RESOURCES - Fail due to lack of resources.
--*/
;
EFI_STATUS
EFIAPI
RootBridgeIoMemWrite (
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
IN UINT64 Address,
IN UINTN Count,
IN OUT VOID *Buffer
)
/*++
Routine Description:
Allow write to memory mapped I/O space.
Arguments:
This - Pointer to EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL instance.
Width - The width of memory operation.
Address - Base address of the memory operation.
Count - Number of memory opeartion to perform.
Buffer - The source buffer to write data from.
Returns:
EFI_SUCCESS - Success.
EFI_INVALID_PARAMETER - Invalid parameter found.
EFI_OUT_OF_RESOURCES - Fail due to lack of resources.
--*/
;
EFI_STATUS
EFIAPI
RootBridgeIoIoRead (
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
IN UINT64 UserAddress,
IN UINTN Count,
IN OUT VOID *UserBuffer
)
/*++
Routine Description:
Enable a PCI driver to read PCI controller registers in the
PCI root bridge I/O space.
Arguments:
This - A pointer to EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL
Width - Signifies the width of the memory operation.
UserAddress - The base address of the I/O operation.
Count - The number of I/O operations to perform.
UserBuffer - The destination buffer to store the results.
Returns:
EFI_SUCCESS - The data was read from the PCI root bridge.
EFI_INVALID_PARAMETER - Invalid parameters found.
EFI_OUT_OF_RESOURCES - The request could not be completed due to a lack of
resources.
--*/
;
EFI_STATUS
EFIAPI
RootBridgeIoIoWrite (
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
IN UINT64 UserAddress,
IN UINTN Count,
IN OUT VOID *UserBuffer
)
/*++
Routine Description:
Enable a PCI driver to write to PCI controller registers in the
PCI root bridge I/O space.
Arguments:
This - A pointer to EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL
Width - Signifies the width of the memory operation.
UserAddress - The base address of the I/O operation.
Count - The number of I/O operations to perform.
UserBuffer - The source buffer to write data from.
Returns:
EFI_SUCCESS - The data was written to the PCI root bridge.
EFI_INVALID_PARAMETER - Invalid parameters found.
EFI_OUT_OF_RESOURCES - The request could not be completed due to a lack of
resources.
--*/
;
EFI_STATUS
EFIAPI
RootBridgeIoCopyMem (
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
IN UINT64 DestAddress,
IN UINT64 SrcAddress,
IN UINTN Count
)
/*++
Routine Description:
Copy one region of PCI root bridge memory space to be copied to
another region of PCI root bridge memory space.
Arguments:
This - A pointer to EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL instance.
Width - Signifies the width of the memory operation.
DestAddress - Destination address of the memory operation.
SrcAddress - Source address of the memory operation.
Count - Number of memory operations to perform.
Returns:
EFI_SUCCESS - The data was copied successfully.
EFI_INVALID_PARAMETER - Invalid parameters found.
EFI_OUT_OF_RESOURCES - The request could not be completed due to a lack of
resources.
--*/
;
EFI_STATUS
EFIAPI
RootBridgeIoPciRead (
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
IN UINT64 Address,
IN UINTN Count,
IN OUT VOID *Buffer
)
/*++
Routine Description:
Allows read from PCI configuration space.
Arguments:
This - A pointer to EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL
Width - Signifies the width of the memory operation.
Address - The address within the PCI configuration space
for the PCI controller.
Count - The number of PCI configuration operations
to perform.
Buffer - The destination buffer to store the results.
Returns:
EFI_SUCCESS - The data was read from the PCI root bridge.
EFI_INVALID_PARAMETER - Invalid parameters found.
EFI_OUT_OF_RESOURCES - The request could not be completed due to a lack of
resources.
--*/
;
EFI_STATUS
EFIAPI
RootBridgeIoPciWrite (
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
IN UINT64 Address,
IN UINTN Count,
IN OUT VOID *Buffer
)
/*++
Routine Description:
Allows write to PCI configuration space.
Arguments:
This - A pointer to EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL
Width - Signifies the width of the memory operation.
Address - The address within the PCI configuration space
for the PCI controller.
Count - The number of PCI configuration operations
to perform.
Buffer - The source buffer to get the results.
Returns:
EFI_SUCCESS - The data was written to the PCI root bridge.
EFI_INVALID_PARAMETER - Invalid parameters found.
EFI_OUT_OF_RESOURCES - The request could not be completed due to a lack of
resources.
--*/
;
EFI_STATUS
EFIAPI
RootBridgeIoMap (
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_OPERATION Operation,
IN VOID *HostAddress,
IN OUT UINTN *NumberOfBytes,
OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,
OUT VOID **Mapping
)
/*++
Routine Description:
Provides the PCI controller-specific address needed to access
system memory for DMA.
Arguments:
This - A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
Operation - Indicate if the bus master is going to read or write
to system memory.
HostAddress - The system memory address to map on the PCI controller.
NumberOfBytes - On input the number of bytes to map.
On output the number of bytes that were mapped.
DeviceAddress - The resulting map address for the bus master PCI
controller to use to access the system memory's HostAddress.
Mapping - The value to pass to Unmap() when the bus master DMA
operation is complete.
Returns:
EFI_SUCCESS - Success.
EFI_INVALID_PARAMETER - Invalid parameters found.
EFI_UNSUPPORTED - The HostAddress cannot be mapped as a common
buffer.
EFI_DEVICE_ERROR - The System hardware could not map the requested
address.
EFI_OUT_OF_RESOURCES - The request could not be completed due to
lack of resources.
--*/
;
EFI_STATUS
EFIAPI
RootBridgeIoUnmap (
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
IN VOID *Mapping
)
/*++
Routine Description:
Completes the Map() operation and releases any corresponding resources.
Arguments:
This - Pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL instance.
Mapping - The value returned from Map() operation.
Returns:
EFI_SUCCESS - The range was unmapped successfully.
EFI_INVALID_PARAMETER - Mapping is not a value that was returned
by Map operation.
EFI_DEVICE_ERROR - The data was not committed to the target
system memory.
--*/
;
EFI_STATUS
EFIAPI
RootBridgeIoAllocateBuffer (
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
IN EFI_ALLOCATE_TYPE Type,
IN EFI_MEMORY_TYPE MemoryType,
IN UINTN Pages,
OUT VOID **HostAddress,
IN UINT64 Attributes
)
/*++
Routine Description:
Allocates pages that are suitable for a common buffer mapping.
Arguments:
This - Pointer to EFI_ROOT_BRIDGE_IO_PROTOCOL instance.
Type - Not used and can be ignored.
MemoryType - Type of memory to allocate.
Pages - Number of pages to allocate.
HostAddress - Pointer to store the base system memory address
of the allocated range.
Attributes - Requested bit mask of attributes of the allocated
range.
Returns:
EFI_SUCCESS - The requested memory range were allocated.
EFI_INVALID_PARAMETER - Invalid parameter found.
EFI_UNSUPPORTED - Attributes is unsupported.
--*/
;
EFI_STATUS
EFIAPI
RootBridgeIoFreeBuffer (
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
IN UINTN Pages,
OUT VOID *HostAddress
)
/*++
Routine Description:
Free memory allocated in AllocateBuffer.
Arguments:
This - Pointer to EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL
instance.
Pages - Number of pages to free.
HostAddress - The base system memory address of the
allocated range.
Returns:
EFI_SUCCESS - Requested memory pages were freed.
EFI_INVALID_PARAMETER - Invalid parameter found.
--*/
;
EFI_STATUS
EFIAPI
RootBridgeIoFlush (
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This
)
/*++
Routine Description:
Flushes all PCI posted write transactions from a PCI host
bridge to system memory.
Arguments:
This - Pointer to EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL instance.
Returns:
EFI_SUCCESS - PCI posted write transactions were flushed
from PCI host bridge to system memory.
EFI_DEVICE_ERROR - Fail due to hardware error.
--*/
;
EFI_STATUS
EFIAPI
RootBridgeIoGetAttributes (
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
OUT UINT64 *Supported,
OUT UINT64 *Attributes
)
/*++
Routine Description:
Get the attributes that a PCI root bridge supports and
the attributes the PCI root bridge is currently using.
Arguments:
This - Pointer to EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL
instance.
Supports - A pointer to the mask of attributes that
this PCI root bridge supports.
Attributes - A pointer to the mask of attributes that
this PCI root bridge is currently using.
Returns:
EFI_SUCCESS - Success.
EFI_INVALID_PARAMETER - Invalid parameter found.
--*/
// GC_TODO: Supported - add argument and description to function comment
//
// GC_TODO: Supported - add argument and description to function comment
//
// GC_TODO: Supported - add argument and description to function comment
//
;
EFI_STATUS
EFIAPI
RootBridgeIoSetAttributes (
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
IN UINT64 Attributes,
IN OUT UINT64 *ResourceBase,
IN OUT UINT64 *ResourceLength
)
/*++
Routine Description:
Sets the attributes for a resource range on a PCI root bridge.
Arguments:
This - Pointer to EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL instance.
Attributes - The mask of attributes to set.
ResourceBase - Pointer to the base address of the resource range
to be modified by the attributes specified by Attributes.
ResourceLength - Pointer to the length of the resource range to be modified.
Returns:
EFI_SUCCESS - Success.
EFI_INVALID_PARAMETER - Invalid parameter found.
EFI_OUT_OF_RESOURCES - Not enough resources to set the attributes upon.
--*/
;
EFI_STATUS
EFIAPI
RootBridgeIoConfiguration (
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
OUT VOID **Resources
)
/*++
Routine Description:
Retrieves the current resource settings of this PCI root bridge
in the form of a set of ACPI 2.0 resource descriptor.
Arguments:
This - Pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL instance.
Resources - Pointer to the ACPI 2.0 resource descriptor that
describe the current configuration of this PCI root
bridge.
Returns:
EFI_SUCCESS - Success.
EFI_UNSUPPORTED - Current configuration of the PCI root bridge
could not be retrieved.
--*/
;
#endif

File diff suppressed because it is too large Load Diff