Code scrub for PCI Bus module and PciIncompatibleDeviceSupportLib module.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8662 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@ -1,13 +1,14 @@
|
|||||||
/** @file
|
/** @file
|
||||||
|
EFI Component Name functions implementation for PCI Bus module.
|
||||||
|
|
||||||
Copyright (c) 2006, Intel Corporation
|
Copyright (c) 2006 - 2009, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
/** @file
|
/** @file
|
||||||
|
EFI Component Name functions declaration for PCI Bus module.
|
||||||
|
|
||||||
Copyright (c) 2006, Intel Corporation
|
Copyright (c) 2006 - 2009, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
@ -1,14 +1,21 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Driver Binding functions for PCI Bus module.
|
Driver Binding functions for PCI Bus module.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2009, Intel Corporation
|
Single PCI bus driver instance will manager all PCI Root Bridges in one EFI based firmware,
|
||||||
All rights reserved. This program and the accompanying materials
|
since all PCI Root Bridges' resources need to be managed together.
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
Supported() function will try to get PCI Root Bridge IO Protocol.
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
Start() function will get PCI Host Bridge Resource Allocation Protocol to manage all
|
||||||
http://opensource.org/licenses/bsd-license.php
|
PCI Root Bridges. So it means platform needs install PCI Root Bridge IO protocol for each
|
||||||
|
PCI Root Bus and install PCI Host Bridge Resource Allocation Protocol.
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
Copyright (c) 2006 - 2009, 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.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
@ -51,7 +58,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_PCI_HOTPLUG_REQUEST_PROTOCOL mPciHotPlugReques
|
|||||||
@param[in] SystemTable A pointer to the EFI System Table.
|
@param[in] SystemTable A pointer to the EFI System Table.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The entry point is executed successfully.
|
@retval EFI_SUCCESS The entry point is executed successfully.
|
||||||
@retval other Some error occurs when executing this entry point.
|
@retval other Some error occurred when executing this entry point.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
@ -63,7 +70,7 @@ PciBusEntryPoint (
|
|||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_HANDLE Handle;
|
EFI_HANDLE Handle;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Initializes PCI devices pool
|
// Initializes PCI devices pool
|
||||||
//
|
//
|
||||||
@ -83,7 +90,7 @@ PciBusEntryPoint (
|
|||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
if (FeaturePcdGet (PcdPciBusHotplugDeviceSupport)) {
|
if (FeaturePcdGet (PcdPciBusHotplugDeviceSupport)) {
|
||||||
//
|
//
|
||||||
// If Hot Plug is supported, install EFI PCI Hot Plug Request protocol.
|
// If Hot Plug is supported, install EFI PCI Hot Plug Request protocol.
|
||||||
//
|
//
|
||||||
Handle = NULL;
|
Handle = NULL;
|
||||||
@ -159,6 +166,9 @@ PciBusDriverBindingSupported (
|
|||||||
Controller
|
Controller
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check if Pci Root Bridge IO protocol is installed by platform
|
||||||
|
//
|
||||||
Status = gBS->OpenProtocol (
|
Status = gBS->OpenProtocol (
|
||||||
Controller,
|
Controller,
|
||||||
&gEfiPciRootBridgeIoProtocolGuid,
|
&gEfiPciRootBridgeIoProtocolGuid,
|
||||||
@ -238,7 +248,7 @@ PciBusDriverBindingStart (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Start all the devices under the entire host bridge.
|
// Start all the devices under the entire host bridge.
|
||||||
//
|
//
|
||||||
|
@ -99,6 +99,26 @@ struct _PCI_BAR {
|
|||||||
UINT8 Offset;
|
UINT8 Offset;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//
|
||||||
|
// defined in PCI Card Specification, 8.0
|
||||||
|
//
|
||||||
|
#define PCI_CARD_MEMORY_BASE_0 0x1C
|
||||||
|
#define PCI_CARD_MEMORY_LIMIT_0 0x20
|
||||||
|
#define PCI_CARD_MEMORY_BASE_1 0x24
|
||||||
|
#define PCI_CARD_MEMORY_LIMIT_1 0x28
|
||||||
|
#define PCI_CARD_IO_BASE_0_LOWER 0x2C
|
||||||
|
#define PCI_CARD_IO_BASE_0_UPPER 0x2E
|
||||||
|
#define PCI_CARD_IO_LIMIT_0_LOWER 0x30
|
||||||
|
#define PCI_CARD_IO_LIMIT_0_UPPER 0x32
|
||||||
|
#define PCI_CARD_IO_BASE_1_LOWER 0x34
|
||||||
|
#define PCI_CARD_IO_BASE_1_UPPER 0x36
|
||||||
|
#define PCI_CARD_IO_LIMIT_1_LOWER 0x38
|
||||||
|
#define PCI_CARD_IO_LIMIT_1_UPPER 0x3A
|
||||||
|
#define PCI_CARD_BRIDGE_CONTROL 0x3E
|
||||||
|
|
||||||
|
#define PCI_CARD_PREFETCHABLE_MEMORY_0_ENABLE BIT8
|
||||||
|
#define PCI_CARD_PREFETCHABLE_MEMORY_1_ENABLE BIT9
|
||||||
|
|
||||||
#define PPB_BAR_0 0
|
#define PPB_BAR_0 0
|
||||||
#define PPB_BAR_1 1
|
#define PPB_BAR_1 1
|
||||||
#define PPB_IO_RANGE 2
|
#define PPB_IO_RANGE 2
|
||||||
@ -261,7 +281,7 @@ extern UINT64 gAllZero;
|
|||||||
extern EFI_PCI_PLATFORM_PROTOCOL *gPciPlatformProtocol;
|
extern EFI_PCI_PLATFORM_PROTOCOL *gPciPlatformProtocol;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Macro that checks whether device is a GFX device.
|
Macro that checks whether device is a GFX device.
|
||||||
|
|
||||||
@param _p Specified device.
|
@param _p Specified device.
|
||||||
|
@ -89,8 +89,8 @@
|
|||||||
[Protocols]
|
[Protocols]
|
||||||
gEfiPciHotPlugRequestProtocolGuid ## BY_START
|
gEfiPciHotPlugRequestProtocolGuid ## BY_START
|
||||||
gEfiPciIoProtocolGuid ## BY_START
|
gEfiPciIoProtocolGuid ## BY_START
|
||||||
gEfiDevicePathProtocolGuid ## BY_START
|
gEfiDevicePathProtocolGuid ## BY_START
|
||||||
gEfiBusSpecificDriverOverrideProtocolGuid ## CONSUMED
|
gEfiBusSpecificDriverOverrideProtocolGuid ## BY_START
|
||||||
gEfiLoadedImageProtocolGuid ## CONSUMED
|
gEfiLoadedImageProtocolGuid ## CONSUMED
|
||||||
gEfiDecompressProtocolGuid ## CONSUMED
|
gEfiDecompressProtocolGuid ## CONSUMED
|
||||||
gEfiPciHotPlugInitProtocolGuid ## CONSUMED
|
gEfiPciHotPlugInitProtocolGuid ## CONSUMED
|
||||||
@ -106,4 +106,10 @@
|
|||||||
[Pcd.common]
|
[Pcd.common]
|
||||||
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdPciIncompatibleDeviceSupportMask
|
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdPciIncompatibleDeviceSupportMask
|
||||||
|
|
||||||
|
# [Event]
|
||||||
|
# ##
|
||||||
|
# # Notify event set by CreateEventForHpc () for PCI Hot Plug controller.
|
||||||
|
# #
|
||||||
|
# EVT_NOTIFY_SIGNAL ## PRODUCES
|
||||||
|
#
|
||||||
|
#
|
||||||
|
@ -1,31 +1,30 @@
|
|||||||
/** @file
|
/** @file
|
||||||
This module implement Pci register operation interface for
|
PCI command register operations supporting functions implementation for PCI Bus module.
|
||||||
Pci device.
|
|
||||||
|
Copyright (c) 2006 - 2009, Intel Corporation
|
||||||
Copyright (c) 2006, Intel Corporation
|
All rights reserved. This program and the accompanying materials
|
||||||
All rights reserved. This program and the accompanying materials
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
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
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
http://opensource.org/licenses/bsd-license.php
|
||||||
http://opensource.org/licenses/bsd-license.php
|
|
||||||
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
|
||||||
#include "PciBus.h"
|
#include "PciBus.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Operate the PCI register via PciIo function interface.
|
Operate the PCI register via PciIo function interface.
|
||||||
|
|
||||||
@param PciIoDevice Pointer to instance of PCI_IO_DEVICE
|
@param PciIoDevice Pointer to instance of PCI_IO_DEVICE.
|
||||||
@param Command Operator command
|
@param Command Operator command.
|
||||||
@param Offset The address within the PCI configuration space for the PCI controller.
|
@param Offset The address within the PCI configuration space for the PCI controller.
|
||||||
@param Operation Type of Operation
|
@param Operation Type of Operation.
|
||||||
@param PtrCommand Return buffer holding old PCI command, if operation is not EFI_SET_REGISTER
|
@param PtrCommand Return buffer holding old PCI command, if operation is not EFI_SET_REGISTER.
|
||||||
|
|
||||||
@return status of PciIo operation
|
@return Status of PciIo operation.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
PciOperateRegister (
|
PciOperateRegister (
|
||||||
@ -76,19 +75,19 @@ PciOperateRegister (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
check the cpability of this device supports
|
Check the cpability supporting by given device.
|
||||||
|
|
||||||
@param PciIoDevice Pointer to instance of PCI_IO_DEVICE
|
@param PciIoDevice Pointer to instance of PCI_IO_DEVICE.
|
||||||
|
|
||||||
@retval TRUE Support
|
@retval TRUE Cpability supportted.
|
||||||
@retval FALSE Not support.
|
@retval FALSE Cpability not supportted.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
PciCapabilitySupport (
|
PciCapabilitySupport (
|
||||||
IN PCI_IO_DEVICE *PciIoDevice
|
IN PCI_IO_DEVICE *PciIoDevice
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
if ((PciIoDevice->Pci.Hdr.Status & EFI_PCI_STATUS_CAPABILITY) != 0) {
|
if ((PciIoDevice->Pci.Hdr.Status & EFI_PCI_STATUS_CAPABILITY) != 0) {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -97,16 +96,17 @@ PciCapabilitySupport (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Locate cap reg.
|
Locate capability register block per capability ID.
|
||||||
|
|
||||||
@param PciIoDevice - A pointer to the PCI_IO_DEVICE.
|
@param PciIoDevice A pointer to the PCI_IO_DEVICE.
|
||||||
@param CapId - The cap ID.
|
@param CapId The capability ID.
|
||||||
@param Offset - A pointer to the offset.
|
@param Offset A pointer to the offset returned.
|
||||||
@param NextRegBlock - A pointer to the next block.
|
@param NextRegBlock A pointer to the next block returned.
|
||||||
|
|
||||||
@retval EFI_UNSUPPORTED Pci device does not support
|
@retval EFI_SUCCESS Successfuly located capability register block.
|
||||||
|
@retval EFI_UNSUPPORTED Pci device does not support capability.
|
||||||
@retval EFI_NOT_FOUND Pci device support but can not find register block.
|
@retval EFI_NOT_FOUND Pci device support but can not find register block.
|
||||||
@retval EFI_SUCCESS Success to locate capability register block
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
LocateCapabilityRegBlock (
|
LocateCapabilityRegBlock (
|
||||||
@ -135,32 +135,32 @@ LocateCapabilityRegBlock (
|
|||||||
if (IS_CARDBUS_BRIDGE (&PciIoDevice->Pci)) {
|
if (IS_CARDBUS_BRIDGE (&PciIoDevice->Pci)) {
|
||||||
|
|
||||||
PciIoRead (
|
PciIoRead (
|
||||||
&PciIoDevice->PciIo,
|
&PciIoDevice->PciIo,
|
||||||
EfiPciIoWidthUint8,
|
EfiPciIoWidthUint8,
|
||||||
EFI_PCI_CARDBUS_BRIDGE_CAPABILITY_PTR,
|
EFI_PCI_CARDBUS_BRIDGE_CAPABILITY_PTR,
|
||||||
1,
|
1,
|
||||||
&CapabilityPtr
|
&CapabilityPtr
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
PciIoRead (
|
PciIoRead (
|
||||||
&PciIoDevice->PciIo,
|
&PciIoDevice->PciIo,
|
||||||
EfiPciIoWidthUint8,
|
EfiPciIoWidthUint8,
|
||||||
PCI_CAPBILITY_POINTER_OFFSET,
|
PCI_CAPBILITY_POINTER_OFFSET,
|
||||||
1,
|
1,
|
||||||
&CapabilityPtr
|
&CapabilityPtr
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((CapabilityPtr >= 0x40) && ((CapabilityPtr & 0x03) == 0x00)) {
|
while ((CapabilityPtr >= 0x40) && ((CapabilityPtr & 0x03) == 0x00)) {
|
||||||
PciIoRead (
|
PciIoRead (
|
||||||
&PciIoDevice->PciIo,
|
&PciIoDevice->PciIo,
|
||||||
EfiPciIoWidthUint16,
|
EfiPciIoWidthUint16,
|
||||||
CapabilityPtr,
|
CapabilityPtr,
|
||||||
1,
|
1,
|
||||||
&CapabilityEntry
|
&CapabilityEntry
|
||||||
);
|
);
|
||||||
|
|
||||||
CapabilityID = (UINT8) CapabilityEntry;
|
CapabilityID = (UINT8) CapabilityEntry;
|
||||||
|
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
/** @file
|
/** @file
|
||||||
|
PCI command register operations supporting functions declaration for PCI Bus module.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2009, Intel Corporation
|
Copyright (c) 2006 - 2009, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
@ -32,7 +33,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
|
|
||||||
//
|
//
|
||||||
// The PCI Bridge Control register bits owned by PCI Bus driver.
|
// The PCI Bridge Control register bits owned by PCI Bus driver.
|
||||||
//
|
//
|
||||||
// They should be cleared at the beginning. The other registers
|
// They should be cleared at the beginning. The other registers
|
||||||
// are owned by chipset, we should not touch them.
|
// are owned by chipset, we should not touch them.
|
||||||
//
|
//
|
||||||
@ -45,7 +46,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
|
|
||||||
//
|
//
|
||||||
// The PCCard Bridge Control register bits owned by PCI Bus driver.
|
// The PCCard Bridge Control register bits owned by PCI Bus driver.
|
||||||
//
|
//
|
||||||
// They should be cleared at the beginning. The other registers
|
// They should be cleared at the beginning. The other registers
|
||||||
// are owned by chipset, we should not touch them.
|
// are owned by chipset, we should not touch them.
|
||||||
//
|
//
|
||||||
@ -63,14 +64,15 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Operate the PCI register via PciIo function interface.
|
Operate the PCI register via PciIo function interface.
|
||||||
|
|
||||||
@param PciIoDevice Pointer to instance of PCI_IO_DEVICE
|
@param PciIoDevice Pointer to instance of PCI_IO_DEVICE.
|
||||||
@param Command Operator command
|
@param Command Operator command.
|
||||||
@param Offset The address within the PCI configuration space for the PCI controller.
|
@param Offset The address within the PCI configuration space for the PCI controller.
|
||||||
@param Operation Type of Operation
|
@param Operation Type of Operation.
|
||||||
@param PtrCommand Return buffer holding old PCI command, if operation is not EFI_SET_REGISTER
|
@param PtrCommand Return buffer holding old PCI command, if operation is not EFI_SET_REGISTER.
|
||||||
|
|
||||||
@return status of PciIo operation
|
@return Status of PciIo operation.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
PciOperateRegister (
|
PciOperateRegister (
|
||||||
@ -82,12 +84,13 @@ PciOperateRegister (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
check the cpability of this device supports
|
Check the cpability supporting by given device.
|
||||||
|
|
||||||
@param PciIoDevice Pointer to instance of PCI_IO_DEVICE
|
@param PciIoDevice Pointer to instance of PCI_IO_DEVICE.
|
||||||
|
|
||||||
@retval TRUE Support
|
@retval TRUE Cpability supportted.
|
||||||
@retval FALSE Not support.
|
@retval FALSE Cpability not supportted.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
PciCapabilitySupport (
|
PciCapabilitySupport (
|
||||||
@ -95,16 +98,17 @@ PciCapabilitySupport (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Locate cap reg.
|
Locate capability register block per capability ID.
|
||||||
|
|
||||||
@param PciIoDevice - A pointer to the PCI_IO_DEVICE.
|
@param PciIoDevice A pointer to the PCI_IO_DEVICE.
|
||||||
@param CapId - The cap ID.
|
@param CapId The capability ID.
|
||||||
@param Offset - A pointer to the offset.
|
@param Offset A pointer to the offset returned.
|
||||||
@param NextRegBlock - A pointer to the next block.
|
@param NextRegBlock A pointer to the next block returned.
|
||||||
|
|
||||||
@retval EFI_UNSUPPORTED Pci device does not support
|
@retval EFI_SUCCESS Successfuly located capability register block.
|
||||||
|
@retval EFI_UNSUPPORTED Pci device does not support capability.
|
||||||
@retval EFI_NOT_FOUND Pci device support but can not find register block.
|
@retval EFI_NOT_FOUND Pci device support but can not find register block.
|
||||||
@retval EFI_SUCCESS Success to locate capability register block
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
LocateCapabilityRegBlock (
|
LocateCapabilityRegBlock (
|
||||||
@ -114,99 +118,99 @@ LocateCapabilityRegBlock (
|
|||||||
OUT UINT8 *NextRegBlock OPTIONAL
|
OUT UINT8 *NextRegBlock OPTIONAL
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Macro that reads command register.
|
Macro that reads command register.
|
||||||
|
|
||||||
@param a[in] Pointer to instance of PCI_IO_DEVICE.
|
@param a[in] Pointer to instance of PCI_IO_DEVICE.
|
||||||
@param b[out] Pointer to the 16-bit value read from command register.
|
@param b[out] Pointer to the 16-bit value read from command register.
|
||||||
|
|
||||||
@return status of PciIo operation
|
@return status of PciIo operation
|
||||||
|
|
||||||
**/
|
**/
|
||||||
#define PCI_READ_COMMAND_REGISTER(a,b) \
|
#define PCI_READ_COMMAND_REGISTER(a,b) \
|
||||||
PciOperateRegister (a, 0, PCI_COMMAND_OFFSET, EFI_GET_REGISTER, b)
|
PciOperateRegister (a, 0, PCI_COMMAND_OFFSET, EFI_GET_REGISTER, b)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Macro that writes command register.
|
Macro that writes command register.
|
||||||
|
|
||||||
@param a[in] Pointer to instance of PCI_IO_DEVICE.
|
@param a[in] Pointer to instance of PCI_IO_DEVICE.
|
||||||
@param b[in] The 16-bit value written into command register.
|
@param b[in] The 16-bit value written into command register.
|
||||||
|
|
||||||
@return status of PciIo operation
|
@return status of PciIo operation
|
||||||
|
|
||||||
**/
|
**/
|
||||||
#define PCI_SET_COMMAND_REGISTER(a,b) \
|
#define PCI_SET_COMMAND_REGISTER(a,b) \
|
||||||
PciOperateRegister (a, b, PCI_COMMAND_OFFSET, EFI_SET_REGISTER, NULL)
|
PciOperateRegister (a, b, PCI_COMMAND_OFFSET, EFI_SET_REGISTER, NULL)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Macro that enables command register.
|
Macro that enables command register.
|
||||||
|
|
||||||
@param a[in] Pointer to instance of PCI_IO_DEVICE.
|
@param a[in] Pointer to instance of PCI_IO_DEVICE.
|
||||||
@param b[in] The enabled value written into command register.
|
@param b[in] The enabled value written into command register.
|
||||||
|
|
||||||
@return status of PciIo operation
|
@return status of PciIo operation
|
||||||
|
|
||||||
**/
|
**/
|
||||||
#define PCI_ENABLE_COMMAND_REGISTER(a,b) \
|
#define PCI_ENABLE_COMMAND_REGISTER(a,b) \
|
||||||
PciOperateRegister (a, b, PCI_COMMAND_OFFSET, EFI_ENABLE_REGISTER, NULL)
|
PciOperateRegister (a, b, PCI_COMMAND_OFFSET, EFI_ENABLE_REGISTER, NULL)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Macro that disalbes command register.
|
Macro that disalbes command register.
|
||||||
|
|
||||||
@param a[in] Pointer to instance of PCI_IO_DEVICE.
|
@param a[in] Pointer to instance of PCI_IO_DEVICE.
|
||||||
@param b[in] The disabled value written into command register.
|
@param b[in] The disabled value written into command register.
|
||||||
|
|
||||||
@return status of PciIo operation
|
@return status of PciIo operation
|
||||||
|
|
||||||
**/
|
**/
|
||||||
#define PCI_DISABLE_COMMAND_REGISTER(a,b) \
|
#define PCI_DISABLE_COMMAND_REGISTER(a,b) \
|
||||||
PciOperateRegister (a, b, PCI_COMMAND_OFFSET, EFI_DISABLE_REGISTER, NULL)
|
PciOperateRegister (a, b, PCI_COMMAND_OFFSET, EFI_DISABLE_REGISTER, NULL)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Macro that reads PCI bridge control register.
|
Macro that reads PCI bridge control register.
|
||||||
|
|
||||||
@param a[in] Pointer to instance of PCI_IO_DEVICE.
|
@param a[in] Pointer to instance of PCI_IO_DEVICE.
|
||||||
@param b[out] The 16-bit value read from control register.
|
@param b[out] The 16-bit value read from control register.
|
||||||
|
|
||||||
@return status of PciIo operation
|
@return status of PciIo operation
|
||||||
|
|
||||||
**/
|
**/
|
||||||
#define PCI_READ_BRIDGE_CONTROL_REGISTER(a,b) \
|
#define PCI_READ_BRIDGE_CONTROL_REGISTER(a,b) \
|
||||||
PciOperateRegister (a, 0, PCI_BRIDGE_CONTROL_REGISTER_OFFSET, EFI_GET_REGISTER, b)
|
PciOperateRegister (a, 0, PCI_BRIDGE_CONTROL_REGISTER_OFFSET, EFI_GET_REGISTER, b)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Macro that writes PCI bridge control register.
|
Macro that writes PCI bridge control register.
|
||||||
|
|
||||||
@param a[in] Pointer to instance of PCI_IO_DEVICE.
|
@param a[in] Pointer to instance of PCI_IO_DEVICE.
|
||||||
@param b[in] The 16-bit value written into control register.
|
@param b[in] The 16-bit value written into control register.
|
||||||
|
|
||||||
@return status of PciIo operation
|
@return status of PciIo operation
|
||||||
|
|
||||||
**/
|
**/
|
||||||
#define PCI_SET_BRIDGE_CONTROL_REGISTER(a,b) \
|
#define PCI_SET_BRIDGE_CONTROL_REGISTER(a,b) \
|
||||||
PciOperateRegister (a, b, PCI_BRIDGE_CONTROL_REGISTER_OFFSET, EFI_SET_REGISTER, NULL)
|
PciOperateRegister (a, b, PCI_BRIDGE_CONTROL_REGISTER_OFFSET, EFI_SET_REGISTER, NULL)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Macro that enables PCI bridge control register.
|
Macro that enables PCI bridge control register.
|
||||||
|
|
||||||
@param a[in] Pointer to instance of PCI_IO_DEVICE.
|
@param a[in] Pointer to instance of PCI_IO_DEVICE.
|
||||||
@param b[in] The enabled value written into command register.
|
@param b[in] The enabled value written into command register.
|
||||||
|
|
||||||
@return status of PciIo operation
|
@return status of PciIo operation
|
||||||
|
|
||||||
**/
|
**/
|
||||||
#define PCI_ENABLE_BRIDGE_CONTROL_REGISTER(a,b) \
|
#define PCI_ENABLE_BRIDGE_CONTROL_REGISTER(a,b) \
|
||||||
PciOperateRegister (a, b, PCI_BRIDGE_CONTROL_REGISTER_OFFSET, EFI_ENABLE_REGISTER, NULL)
|
PciOperateRegister (a, b, PCI_BRIDGE_CONTROL_REGISTER_OFFSET, EFI_ENABLE_REGISTER, NULL)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Macro that disalbes PCI bridge control register.
|
Macro that disalbes PCI bridge control register.
|
||||||
|
|
||||||
@param a[in] Pointer to instance of PCI_IO_DEVICE.
|
@param a[in] Pointer to instance of PCI_IO_DEVICE.
|
||||||
@param b[in] The disabled value written into command register.
|
@param b[in] The disabled value written into command register.
|
||||||
|
|
||||||
@return status of PciIo operation
|
@return status of PciIo operation
|
||||||
|
|
||||||
**/
|
**/
|
||||||
#define PCI_DISABLE_BRIDGE_CONTROL_REGISTER(a,b) \
|
#define PCI_DISABLE_BRIDGE_CONTROL_REGISTER(a,b) \
|
||||||
PciOperateRegister (a, b, PCI_BRIDGE_CONTROL_REGISTER_OFFSET, EFI_DISABLE_REGISTER, NULL)
|
PciOperateRegister (a, b, PCI_BRIDGE_CONTROL_REGISTER_OFFSET, EFI_DISABLE_REGISTER, NULL)
|
||||||
|
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Supporting functions implementaion for PCI devices management.
|
Supporting functions implementaion for PCI devices management.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2009, Intel Corporation
|
Copyright (c) 2006 - 2009, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
@ -66,9 +66,9 @@ InsertPciDevice (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Destroy root bridge and remove it from deivce tree.
|
Destroy root bridge and remove it from deivce tree.
|
||||||
|
|
||||||
@param RootBridge The bridge want to be removed.
|
@param RootBridge The bridge want to be removed.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
DestroyRootBridge (
|
DestroyRootBridge (
|
||||||
@ -187,10 +187,10 @@ DestroyRootBridgeByHandle (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This function registers the PCI IO device.
|
This function registers the PCI IO device.
|
||||||
|
|
||||||
It creates a handle for this PCI IO device (if the handle does not exist), attaches
|
It creates a handle for this PCI IO device (if the handle does not exist), attaches
|
||||||
appropriate protocols onto the handle, does necessary initialization, and sets up
|
appropriate protocols onto the handle, does necessary initialization, and sets up
|
||||||
parent/child relationship with its bus controller.
|
parent/child relationship with its bus controller.
|
||||||
|
|
||||||
@param Controller An EFI handle for the PCI bus controller.
|
@param Controller An EFI handle for the PCI bus controller.
|
||||||
@ -198,7 +198,7 @@ DestroyRootBridgeByHandle (
|
|||||||
@param Handle A pointer to hold the returned EFI handle for the PCI IO device.
|
@param Handle A pointer to hold the returned EFI handle for the PCI IO device.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The PCI device is successfully registered.
|
@retval EFI_SUCCESS The PCI device is successfully registered.
|
||||||
@retval Others An error occurred when registering the PCI device.
|
@retval other An error occurred when registering the PCI device.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
@ -244,7 +244,7 @@ RegisterPciDevice (
|
|||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
PciIoDevice->IsPciExp = TRUE;
|
PciIoDevice->IsPciExp = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Force Interrupt line to "Unknown" or "No Connection"
|
// Force Interrupt line to "Unknown" or "No Connection"
|
||||||
//
|
//
|
||||||
@ -330,7 +330,7 @@ RegisterPciDevice (
|
|||||||
|
|
||||||
if (PciIoDevice->BusOverride) {
|
if (PciIoDevice->BusOverride) {
|
||||||
//
|
//
|
||||||
// Install BusSpecificDriverOverride Protocol
|
// Install Bus Specific Driver Override Protocol
|
||||||
//
|
//
|
||||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||||
&PciIoDevice->Handle,
|
&PciIoDevice->Handle,
|
||||||
@ -437,7 +437,7 @@ RemoveAllPciDeviceOnBridge (
|
|||||||
@param Handle PCI device handle.
|
@param Handle PCI device handle.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The PCI device is successfully de-registered.
|
@retval EFI_SUCCESS The PCI device is successfully de-registered.
|
||||||
@retval Others An error occurred when de-registering the PCI device.
|
@retval other An error occurred when de-registering the PCI device.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
@ -503,7 +503,8 @@ DeRegisterPciDevice (
|
|||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Un-install the device path protocol and pci io protocol
|
// Un-install the Device Path protocol and PCI I/O protocol
|
||||||
|
// and Bus Specific Driver Override protocol if needed.
|
||||||
//
|
//
|
||||||
if (PciIoDevice->BusOverride) {
|
if (PciIoDevice->BusOverride) {
|
||||||
Status = gBS->UninstallMultipleProtocolInterfaces (
|
Status = gBS->UninstallMultipleProtocolInterfaces (
|
||||||
@ -595,8 +596,8 @@ DeRegisterPciDevice (
|
|||||||
|
|
||||||
@retval EFI_NOT_READY Device is not allocated.
|
@retval EFI_NOT_READY Device is not allocated.
|
||||||
@retval EFI_UNSUPPORTED Device only support PCI-PCI bridge.
|
@retval EFI_UNSUPPORTED Device only support PCI-PCI bridge.
|
||||||
@retval EFI_NOT_FOUND Can not find the specific device
|
@retval EFI_NOT_FOUND Can not find the specific device.
|
||||||
@retval EFI_SUCCESS Success to start Pci device on bridge
|
@retval EFI_SUCCESS Success to start Pci device on bridge.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
@ -625,7 +626,7 @@ StartPciDevicesOnBridge (
|
|||||||
|
|
||||||
Node.DevPath = RemainingDevicePath;
|
Node.DevPath = RemainingDevicePath;
|
||||||
|
|
||||||
if (Node.Pci->Device != PciIoDevice->DeviceNumber ||
|
if (Node.Pci->Device != PciIoDevice->DeviceNumber ||
|
||||||
Node.Pci->Function != PciIoDevice->FunctionNumber) {
|
Node.Pci->Function != PciIoDevice->FunctionNumber) {
|
||||||
CurrentLink = CurrentLink->ForwardLink;
|
CurrentLink = CurrentLink->ForwardLink;
|
||||||
continue;
|
continue;
|
||||||
@ -637,7 +638,7 @@ StartPciDevicesOnBridge (
|
|||||||
if (!PciIoDevice->Allocated) {
|
if (!PciIoDevice->Allocated) {
|
||||||
return EFI_NOT_READY;
|
return EFI_NOT_READY;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check if the current node has been registered before
|
// Check if the current node has been registered before
|
||||||
// If it is not, register it
|
// If it is not, register it
|
||||||
@ -655,7 +656,7 @@ StartPciDevicesOnBridge (
|
|||||||
ChildHandleBuffer[*NumberOfChildren] = PciIoDevice->Handle;
|
ChildHandleBuffer[*NumberOfChildren] = PciIoDevice->Handle;
|
||||||
(*NumberOfChildren)++;
|
(*NumberOfChildren)++;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get the next device path
|
// Get the next device path
|
||||||
//
|
//
|
||||||
@ -752,18 +753,21 @@ StartPciDevicesOnBridge (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Start to manage all the PCI devices it found previously under
|
Start to manage all the PCI devices it found previously under
|
||||||
the entire host bridge.
|
the entire host bridge.
|
||||||
|
|
||||||
@param Controller The root bridge handle.
|
@param Controller The root bridge handle.
|
||||||
|
|
||||||
|
@retval EFI_NOT_READY Device is not allocated.
|
||||||
|
@retval EFI_SUCCESS Success to start Pci device on host bridge.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
StartPciDevices (
|
StartPciDevices (
|
||||||
IN EFI_HANDLE Controller
|
IN EFI_HANDLE Controller
|
||||||
)
|
)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
PCI_IO_DEVICE *RootBridge;
|
PCI_IO_DEVICE *RootBridge;
|
||||||
EFI_HANDLE ThisHostBridge;
|
EFI_HANDLE ThisHostBridge;
|
||||||
LIST_ENTRY *CurrentLink;
|
LIST_ENTRY *CurrentLink;
|
||||||
@ -781,13 +785,16 @@ StartPciDevices (
|
|||||||
// Locate the right root bridge to start
|
// Locate the right root bridge to start
|
||||||
//
|
//
|
||||||
if (RootBridge->PciRootBridgeIo->ParentHandle == ThisHostBridge) {
|
if (RootBridge->PciRootBridgeIo->ParentHandle == ThisHostBridge) {
|
||||||
StartPciDevicesOnBridge (
|
Status = StartPciDevicesOnBridge (
|
||||||
RootBridge->Handle,
|
RootBridge->Handle,
|
||||||
RootBridge,
|
RootBridge,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CurrentLink = CurrentLink->ForwardLink;
|
CurrentLink = CurrentLink->ForwardLink;
|
||||||
@ -913,10 +920,10 @@ GetRootBridgeByHandle (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Judege whether Pci device existed.
|
Judege whether Pci device existed.
|
||||||
|
|
||||||
@param Bridge Parent bridege instance.
|
@param Bridge Parent bridege instance.
|
||||||
@param PciIoDevice Device instance.
|
@param PciIoDevice Device instance.
|
||||||
|
|
||||||
@retval TRUE Pci device existed.
|
@retval TRUE Pci device existed.
|
||||||
@retval FALSE Pci device did not exist.
|
@retval FALSE Pci device did not exist.
|
||||||
|
|
||||||
@ -955,9 +962,9 @@ PciDeviceExisted (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Get the active VGA device on the same segment.
|
Get the active VGA device on the same segment.
|
||||||
|
|
||||||
@param VgaDevice PCI IO instance for the VGA device.
|
@param VgaDevice PCI IO instance for the VGA device.
|
||||||
|
|
||||||
@return The active VGA device on the same segment.
|
@return The active VGA device on the same segment.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
@ -992,9 +999,9 @@ ActiveVGADeviceOnTheSameSegment (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Get the active VGA device on the root bridge.
|
Get the active VGA device on the root bridge.
|
||||||
|
|
||||||
@param RootBridge PCI IO instance for the root bridge.
|
@param RootBridge PCI IO instance for the root bridge.
|
||||||
|
|
||||||
@return The active VGA device.
|
@return The active VGA device.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
@ -1042,10 +1049,10 @@ ActiveVGADeviceOnTheRootBridge (
|
|||||||
@param RootBridge Root bridege Io instance.
|
@param RootBridge Root bridege Io instance.
|
||||||
@param RemainingDevicePath Given searching device path.
|
@param RemainingDevicePath Given searching device path.
|
||||||
@param PciAddress Buffer holding searched result.
|
@param PciAddress Buffer holding searched result.
|
||||||
|
|
||||||
@retval EFI_SUCCESS PCI address was stored in PciAddress
|
@retval EFI_SUCCESS PCI address was stored in PciAddress
|
||||||
@retval EFI_NOT_FOUND Can not find the specific device path.
|
@retval EFI_NOT_FOUND Can not find the specific device path.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
GetHpcPciAddressFromRootBridge (
|
GetHpcPciAddressFromRootBridge (
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Supporting functions declaration for PCI devices management.
|
Supporting functions declaration for PCI devices management.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2009, Intel Corporation
|
Copyright (c) 2006 - 2009, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
@ -51,9 +51,9 @@ InsertPciDevice (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Destroy root bridge and remove it from deivce tree.
|
Destroy root bridge and remove it from deivce tree.
|
||||||
|
|
||||||
@param RootBridge The bridge want to be removed.
|
@param RootBridge The bridge want to be removed.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
DestroyRootBridge (
|
DestroyRootBridge (
|
||||||
@ -91,10 +91,10 @@ DestroyRootBridgeByHandle (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This function registers the PCI IO device.
|
This function registers the PCI IO device.
|
||||||
|
|
||||||
It creates a handle for this PCI IO device (if the handle does not exist), attaches
|
It creates a handle for this PCI IO device (if the handle does not exist), attaches
|
||||||
appropriate protocols onto the handle, does necessary initialization, and sets up
|
appropriate protocols onto the handle, does necessary initialization, and sets up
|
||||||
parent/child relationship with its bus controller.
|
parent/child relationship with its bus controller.
|
||||||
|
|
||||||
@param Controller An EFI handle for the PCI bus controller.
|
@param Controller An EFI handle for the PCI bus controller.
|
||||||
@ -102,7 +102,7 @@ DestroyRootBridgeByHandle (
|
|||||||
@param Handle A pointer to hold the returned EFI handle for the PCI IO device.
|
@param Handle A pointer to hold the returned EFI handle for the PCI IO device.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The PCI device is successfully registered.
|
@retval EFI_SUCCESS The PCI device is successfully registered.
|
||||||
@retval Others An error occurred when registering the PCI device.
|
@retval other An error occurred when registering the PCI device.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
@ -136,7 +136,7 @@ RemoveAllPciDeviceOnBridge (
|
|||||||
@param Handle PCI device handle.
|
@param Handle PCI device handle.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The PCI device is successfully de-registered.
|
@retval EFI_SUCCESS The PCI device is successfully de-registered.
|
||||||
@retval Others An error occurred when de-registering the PCI device.
|
@retval other An error occurred when de-registering the PCI device.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
@ -148,7 +148,7 @@ DeRegisterPciDevice (
|
|||||||
/**
|
/**
|
||||||
Start to manage the PCI device on specified the root bridge or PCI-PCI Bridge
|
Start to manage the PCI device on specified the root bridge or PCI-PCI Bridge
|
||||||
|
|
||||||
@param Controller An efi handle.
|
@param Controller The root bridge handle.
|
||||||
@param RootBridge A pointer to the PCI_IO_DEVICE.
|
@param RootBridge A pointer to the PCI_IO_DEVICE.
|
||||||
@param RemainingDevicePath A pointer to the EFI_DEVICE_PATH_PROTOCOL.
|
@param RemainingDevicePath A pointer to the EFI_DEVICE_PATH_PROTOCOL.
|
||||||
@param NumberOfChildren Children number.
|
@param NumberOfChildren Children number.
|
||||||
@ -156,8 +156,8 @@ DeRegisterPciDevice (
|
|||||||
|
|
||||||
@retval EFI_NOT_READY Device is not allocated.
|
@retval EFI_NOT_READY Device is not allocated.
|
||||||
@retval EFI_UNSUPPORTED Device only support PCI-PCI bridge.
|
@retval EFI_UNSUPPORTED Device only support PCI-PCI bridge.
|
||||||
@retval EFI_NOT_FOUND Can not find the specific device
|
@retval EFI_NOT_FOUND Can not find the specific device.
|
||||||
@retval EFI_SUCCESS Success to start Pci device on bridge
|
@retval EFI_SUCCESS Success to start Pci device on bridge.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
@ -170,10 +170,13 @@ StartPciDevicesOnBridge (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Start to manage all the PCI devices it found previously under
|
Start to manage all the PCI devices it found previously under
|
||||||
the entire host bridge.
|
the entire host bridge.
|
||||||
|
|
||||||
@param Controller - root bridge handle.
|
@param Controller The root bridge handle.
|
||||||
|
|
||||||
|
@retval EFI_NOT_READY Device is not allocated.
|
||||||
|
@retval EFI_SUCCESS Success to start Pci device on host bridge.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
@ -212,10 +215,10 @@ GetRootBridgeByHandle (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Judege whether Pci device existed.
|
Judege whether Pci device existed.
|
||||||
|
|
||||||
@param Bridge Parent bridege instance.
|
@param Bridge Parent bridege instance.
|
||||||
@param PciIoDevice Device instance.
|
@param PciIoDevice Device instance.
|
||||||
|
|
||||||
@retval TRUE Pci device existed.
|
@retval TRUE Pci device existed.
|
||||||
@retval FALSE Pci device did not exist.
|
@retval FALSE Pci device did not exist.
|
||||||
|
|
||||||
@ -228,9 +231,9 @@ PciDeviceExisted (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Get the active VGA device on the same segment.
|
Get the active VGA device on the same segment.
|
||||||
|
|
||||||
@param VgaDevice PCI IO instance for the VGA device.
|
@param VgaDevice PCI IO instance for the VGA device.
|
||||||
|
|
||||||
@return The active VGA device on the same segment.
|
@return The active VGA device on the same segment.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
@ -241,9 +244,9 @@ ActiveVGADeviceOnTheSameSegment (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Get the active VGA device on the root bridge.
|
Get the active VGA device on the root bridge.
|
||||||
|
|
||||||
@param RootBridge PCI IO instance for the root bridge.
|
@param RootBridge PCI IO instance for the root bridge.
|
||||||
|
|
||||||
@return The active VGA device.
|
@return The active VGA device.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
@ -258,10 +261,10 @@ ActiveVGADeviceOnTheRootBridge (
|
|||||||
@param RootBridge Root bridege Io instance.
|
@param RootBridge Root bridege Io instance.
|
||||||
@param RemainingDevicePath Given searching device path.
|
@param RemainingDevicePath Given searching device path.
|
||||||
@param PciAddress Buffer holding searched result.
|
@param PciAddress Buffer holding searched result.
|
||||||
|
|
||||||
@retval EFI_SUCCESS PCI address was stored in PciAddress.
|
@retval EFI_SUCCESS PCI address was stored in PciAddress.
|
||||||
@retval EFI_NOT_FOUND Can not find the specific device path.
|
@retval EFI_NOT_FOUND Can not find the specific device path.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
GetHpcPciAddressFromRootBridge (
|
GetHpcPciAddressFromRootBridge (
|
||||||
|
@ -1,41 +1,49 @@
|
|||||||
/** @file
|
/** @file
|
||||||
|
Functions implementation for Bus Specific Driver Override protoocl.
|
||||||
|
|
||||||
Copyright (c) 2006, Intel Corporation
|
Copyright (c) 2006 - 2009, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
|
||||||
#include "PciBus.h"
|
#include "PciBus.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Initializes a PCI Driver Override Instance.
|
Initializes a PCI Driver Override Instance.
|
||||||
|
|
||||||
@param PciIoDevice Device instance.
|
@param PciIoDevice PCI Device instance.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
InitializePciDriverOverrideInstance (
|
InitializePciDriverOverrideInstance (
|
||||||
PCI_IO_DEVICE *PciIoDevice
|
IN OUT PCI_IO_DEVICE *PciIoDevice
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
PciIoDevice->PciDriverOverride.GetDriver = GetDriver;
|
PciIoDevice->PciDriverOverride.GetDriver = GetDriver;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get a overriding driver image.
|
Uses a bus specific algorithm to retrieve a driver image handle for a controller.
|
||||||
@param This Pointer to instance of EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL.
|
|
||||||
@param DriverImageHandle Override driver image.
|
@param This A pointer to the EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL instance.
|
||||||
|
@param DriverImageHandle On input, a pointer to the previous driver image handle returned
|
||||||
@retval EFI_SUCCESS Success to get driver image handle.
|
by GetDriver(). On output, a pointer to the next driver
|
||||||
@retval EFI_NOT_FOUND can not find override driver image.
|
image handle. Passing in a NULL, will return the first driver
|
||||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
image handle.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS A bus specific override driver is returned in DriverImageHandle.
|
||||||
|
@retval EFI_NOT_FOUND The end of the list of override drivers was reached.
|
||||||
|
A bus specific override driver is not returned in DriverImageHandle.
|
||||||
|
@retval EFI_INVALID_PARAMETER DriverImageHandle is not a handle that was returned on a
|
||||||
|
previous call to GetDriver().
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
@ -84,13 +92,15 @@ GetDriver (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Add an overriding driver image
|
Add an overriding driver image.
|
||||||
|
|
||||||
@param PciIoDevice Instance of PciIo device.
|
@param PciIoDevice Instance of PciIo device.
|
||||||
@param DriverImageHandle new added driver image.
|
@param DriverImageHandle new added driver image.
|
||||||
|
|
||||||
@retval EFI_OUT_OF_RESOURCES no memory resource for new driver instance.
|
@retval EFI_SUCCESS Successfully added driver.
|
||||||
@retval EFI_SUCCESS Success add driver.
|
@retval EFI_OUT_OF_RESOURCES No memory resource for new driver instance.
|
||||||
|
@retval other Some error occurred when locating gEfiLoadedImageProtocolGuid.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
AddDriver (
|
AddDriver (
|
||||||
@ -124,16 +134,9 @@ AddDriver (
|
|||||||
ImageContext.ImageRead = PeCoffLoaderImageReadFromMemory;
|
ImageContext.ImageRead = PeCoffLoaderImageReadFromMemory;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get information about the image
|
// Get information about the image
|
||||||
//
|
//
|
||||||
Status = PeCoffLoaderGetImageInfo (&ImageContext);
|
PeCoffLoaderGetImageInfo (&ImageContext);
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
return EFI_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ImageContext.Machine != EFI_IMAGE_MACHINE_EBC) {
|
|
||||||
return EFI_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
/** @file
|
/** @file
|
||||||
|
Functions declaration for Bus Specific Driver Override protoocl.
|
||||||
|
|
||||||
Copyright (c) 2006, Intel Corporation
|
Copyright (c) 2006 - 2009, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
@ -17,6 +18,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
|
|
||||||
#define DRIVER_OVERRIDE_SIGNATURE SIGNATURE_32 ('d', 'r', 'o', 'v')
|
#define DRIVER_OVERRIDE_SIGNATURE SIGNATURE_32 ('d', 'r', 'o', 'v')
|
||||||
|
|
||||||
|
//
|
||||||
|
// PCI driver override driver image list
|
||||||
|
//
|
||||||
typedef struct {
|
typedef struct {
|
||||||
UINT32 Signature;
|
UINT32 Signature;
|
||||||
LIST_ENTRY Link;
|
LIST_ENTRY Link;
|
||||||
@ -30,22 +34,24 @@ typedef struct {
|
|||||||
/**
|
/**
|
||||||
Initializes a PCI Driver Override Instance.
|
Initializes a PCI Driver Override Instance.
|
||||||
|
|
||||||
@param PciIoDevice Device instance.
|
@param PciIoDevice PCI Device instance.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
InitializePciDriverOverrideInstance (
|
InitializePciDriverOverrideInstance (
|
||||||
PCI_IO_DEVICE *PciIoDevice
|
IN OUT PCI_IO_DEVICE *PciIoDevice
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Add an overriding driver image.
|
Add an overriding driver image.
|
||||||
|
|
||||||
@param PciIoDevice Instance of PciIo device.
|
@param PciIoDevice Instance of PciIo device.
|
||||||
@param DriverImageHandle new added driver image.
|
@param DriverImageHandle new added driver image.
|
||||||
|
|
||||||
@retval EFI_OUT_OF_RESOURCES no memory resource for new driver instance.
|
@retval EFI_SUCCESS Successfully added driver.
|
||||||
@retval EFI_SUCCESS Success add driver.
|
@retval EFI_OUT_OF_RESOURCES No memory resource for new driver instance.
|
||||||
|
@retval other Some error occurred when locating gEfiLoadedImageProtocolGuid.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
AddDriver (
|
AddDriver (
|
||||||
@ -55,13 +61,20 @@ AddDriver (
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get a overriding driver image.
|
Uses a bus specific algorithm to retrieve a driver image handle for a controller.
|
||||||
@param This Pointer to instance of EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL.
|
|
||||||
@param DriverImageHandle Override driver image.
|
@param This A pointer to the EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL instance.
|
||||||
|
@param DriverImageHandle On input, a pointer to the previous driver image handle returned
|
||||||
@retval EFI_SUCCESS Success to get driver image handle.
|
by GetDriver(). On output, a pointer to the next driver
|
||||||
@retval EFI_NOT_FOUND can not find override driver image.
|
image handle. Passing in a NULL, will return the first driver
|
||||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
image handle.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS A bus specific override driver is returned in DriverImageHandle.
|
||||||
|
@retval EFI_NOT_FOUND The end of the list of override drivers was reached.
|
||||||
|
A bus specific override driver is not returned in DriverImageHandle.
|
||||||
|
@retval EFI_INVALID_PARAMETER DriverImageHandle is not a handle that was returned on a
|
||||||
|
previous call to GetDriver().
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
|
@ -1,28 +1,28 @@
|
|||||||
/** @file
|
/** @file
|
||||||
|
PCI eunmeration implementation on entire PCI bus system for PCI Bus module.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2009, Intel Corporation
|
Copyright (c) 2006 - 2009, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
|
||||||
#include "PciBus.h"
|
#include "PciBus.h"
|
||||||
#include "PciEnumerator.h"
|
|
||||||
#include "PciOptionRomSupport.h"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This routine is used to enumerate entire pci bus system
|
This routine is used to enumerate entire pci bus system
|
||||||
in a given platform.
|
in a given platform.
|
||||||
|
|
||||||
@param Controller Parent controller handle.
|
@param Controller Parent controller handle.
|
||||||
|
|
||||||
@return Status of enumerating.
|
@retval EFI_SUCCESS PCI enumeration finished successfully.
|
||||||
|
@retval other Some error occurred when enumerating the pci bus system.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
PciEnumerator (
|
PciEnumerator (
|
||||||
@ -125,14 +125,14 @@ PciEnumerator (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Enumerate PCI root bridge
|
Enumerate PCI root bridge.
|
||||||
|
|
||||||
@param PciResAlloc Pointer to protocol instance of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL.
|
@param PciResAlloc Pointer to protocol instance of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL.
|
||||||
@param RootBridgeDev Instance of root bridge device.
|
@param RootBridgeDev Instance of root bridge device.
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success to enumerate root bridge.
|
@retval EFI_SUCCESS Successfully enumerated root bridge.
|
||||||
@retval Others Fail to enumerate root bridge.
|
@retval other Failed to enumerate root bridge.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
PciRootBridgeEnumerator (
|
PciRootBridgeEnumerator (
|
||||||
@ -190,7 +190,7 @@ PciRootBridgeEnumerator (
|
|||||||
// Reset all assigned PCI bus number
|
// Reset all assigned PCI bus number
|
||||||
//
|
//
|
||||||
ResetAllPpbBusNumber (
|
ResetAllPpbBusNumber (
|
||||||
RootBridgeDev,
|
RootBridgeDev,
|
||||||
StartBusNumber
|
StartBusNumber
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -222,9 +222,9 @@ PciRootBridgeEnumerator (
|
|||||||
RootBridgeHandle,
|
RootBridgeHandle,
|
||||||
Configuration
|
Configuration
|
||||||
);
|
);
|
||||||
|
|
||||||
FreePool (Configuration);
|
FreePool (Configuration);
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
@ -233,15 +233,15 @@ PciRootBridgeEnumerator (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This routine is used to process option rom on a certain root bridge
|
This routine is used to process all PCI devices' Option Rom
|
||||||
|
on a certain root bridge.
|
||||||
@param Bridge Given parent's root bridge
|
|
||||||
@param RomBase Base address of ROM driver loaded from
|
@param Bridge Given parent's root bridge.
|
||||||
@param MaxLength Max rom size
|
@param RomBase Base address of ROM driver loaded from.
|
||||||
|
@param MaxLength Maximum rom size.
|
||||||
@retval EFI_SUCCESS Success to process option rom image.
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
VOID
|
||||||
ProcessOptionRom (
|
ProcessOptionRom (
|
||||||
IN PCI_IO_DEVICE *Bridge,
|
IN PCI_IO_DEVICE *Bridge,
|
||||||
IN UINT64 RomBase,
|
IN UINT64 RomBase,
|
||||||
@ -275,18 +275,18 @@ ProcessOptionRom (
|
|||||||
|
|
||||||
CurrentLink = CurrentLink->ForwardLink;
|
CurrentLink = CurrentLink->ForwardLink;
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This routine is used to assign bus number to the given PCI bus system
|
This routine is used to assign bus number to the given PCI bus system
|
||||||
|
|
||||||
@param Bridge Parent root bridge instance.
|
@param Bridge Parent root bridge instance.
|
||||||
@param StartBusNumber Number of beginning.
|
@param StartBusNumber Number of beginning.
|
||||||
@param SubBusNumber the number of sub bus.
|
@param SubBusNumber The number of sub bus.
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success to assign bus number.
|
@retval EFI_SUCCESS Successfully assigned bus number.
|
||||||
|
@retval EFI_DEVICE_ERROR Failed to assign bus number.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
PciAssignBusNumber (
|
PciAssignBusNumber (
|
||||||
@ -321,7 +321,6 @@ PciAssignBusNumber (
|
|||||||
//
|
//
|
||||||
// Check to see whether a pci device is present
|
// Check to see whether a pci device is present
|
||||||
//
|
//
|
||||||
|
|
||||||
Status = PciDevicePresent (
|
Status = PciDevicePresent (
|
||||||
PciRootBridgeIo,
|
PciRootBridgeIo,
|
||||||
&Pci,
|
&Pci,
|
||||||
@ -392,7 +391,6 @@ PciAssignBusNumber (
|
|||||||
//
|
//
|
||||||
// Set the current maximum bus number under the PPB
|
// Set the current maximum bus number under the PPB
|
||||||
//
|
//
|
||||||
|
|
||||||
Address = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, 0x1A);
|
Address = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, 0x1A);
|
||||||
|
|
||||||
Status = PciRootBridgeIoWrite (
|
Status = PciRootBridgeIoWrite (
|
||||||
@ -411,7 +409,6 @@ PciAssignBusNumber (
|
|||||||
//
|
//
|
||||||
// Skip sub functions, this is not a multi function device
|
// Skip sub functions, this is not a multi function device
|
||||||
//
|
//
|
||||||
|
|
||||||
Func = PCI_MAX_FUNC;
|
Func = PCI_MAX_FUNC;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -426,9 +423,10 @@ PciAssignBusNumber (
|
|||||||
|
|
||||||
@param PciResAlloc Protocol instance of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
|
@param PciResAlloc Protocol instance of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
|
||||||
@param RootBridgeDev Root bridge instance
|
@param RootBridgeDev Root bridge instance
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success to get root bridge's attribute
|
@retval EFI_SUCCESS Successfully got root bridge's attribute.
|
||||||
@retval Others Fail to get attribute
|
@retval other Failed to get attribute.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
DetermineRootBridgeAttributes (
|
DetermineRootBridgeAttributes (
|
||||||
@ -460,7 +458,6 @@ DetermineRootBridgeAttributes (
|
|||||||
// Here is the point where PCI bus driver calls HOST bridge allocation protocol
|
// Here is the point where PCI bus driver calls HOST bridge allocation protocol
|
||||||
// Currently we hardcoded for ea815
|
// Currently we hardcoded for ea815
|
||||||
//
|
//
|
||||||
|
|
||||||
if ((Attributes & EFI_PCI_HOST_BRIDGE_COMBINE_MEM_PMEM) != 0) {
|
if ((Attributes & EFI_PCI_HOST_BRIDGE_COMBINE_MEM_PMEM) != 0) {
|
||||||
RootBridgeDev->Decodes |= EFI_BRIDGE_PMEM_MEM_COMBINE_SUPPORTED;
|
RootBridgeDev->Decodes |= EFI_BRIDGE_PMEM_MEM_COMBINE_SUPPORTED;
|
||||||
}
|
}
|
||||||
@ -477,10 +474,12 @@ DetermineRootBridgeAttributes (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get Max Option Rom size on this bridge
|
Get Max Option Rom size on specified bridge.
|
||||||
|
|
||||||
@param Bridge Bridge device instance.
|
@param Bridge Given bridge device instance.
|
||||||
@return Max size of option rom.
|
|
||||||
|
@return Max size of option rom needed.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
UINT64
|
UINT64
|
||||||
GetMaxOptionRomSize (
|
GetMaxOptionRomSize (
|
||||||
@ -538,12 +537,13 @@ GetMaxOptionRomSize (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Process attributes of devices on this host bridge
|
Process attributes of devices on this host bridge
|
||||||
|
|
||||||
@param PciResAlloc Protocol instance of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL.
|
@param PciResAlloc Protocol instance of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Successfully process attribute.
|
||||||
@retval EFI_NOT_FOUND Can not find the specific root bridge device.
|
@retval EFI_NOT_FOUND Can not find the specific root bridge device.
|
||||||
@retval EFI_SUCCESS Success Process attribute.
|
@retval other Failed to determine the root bridge device's attribute.
|
||||||
@retval Others Can not determine the root bridge device's attribute.
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
PciHostBridgeDeviceAttribute (
|
PciHostBridgeDeviceAttribute (
|
||||||
@ -581,18 +581,17 @@ PciHostBridgeDeviceAttribute (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get resource allocation status from the ACPI pointer
|
Get resource allocation status from the ACPI resource descriptor.
|
||||||
|
|
||||||
|
@param AcpiConfig Point to Acpi configuration table.
|
||||||
|
@param IoResStatus Return the status of I/O resource.
|
||||||
|
@param Mem32ResStatus Return the status of 32-bit Memory resource.
|
||||||
|
@param PMem32ResStatus Return the status of 32-bit Prefetchable Memory resource.
|
||||||
|
@param Mem64ResStatus Return the status of 64-bit Memory resource.
|
||||||
|
@param PMem64ResStatus Return the status of 64-bit Prefetchable Memory resource.
|
||||||
|
|
||||||
@param AcpiConfig Point to Acpi configuration table
|
|
||||||
@param IoResStatus Return the status of I/O resource
|
|
||||||
@param Mem32ResStatus Return the status of 32-bit Memory resource
|
|
||||||
@param PMem32ResStatus Return the status of 32-bit PMemory resource
|
|
||||||
@param Mem64ResStatus Return the status of 64-bit Memory resource
|
|
||||||
@param PMem64ResStatus Return the status of 64-bit PMemory resource
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success to get resource allocation status from ACPI configuration table.
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
VOID
|
||||||
GetResourceAllocationStatus (
|
GetResourceAllocationStatus (
|
||||||
VOID *AcpiConfig,
|
VOID *AcpiConfig,
|
||||||
OUT UINT64 *IoResStatus,
|
OUT UINT64 *IoResStatus,
|
||||||
@ -602,7 +601,6 @@ GetResourceAllocationStatus (
|
|||||||
OUT UINT64 *PMem64ResStatus
|
OUT UINT64 *PMem64ResStatus
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
UINT8 *Temp;
|
UINT8 *Temp;
|
||||||
UINT64 ResStatus;
|
UINT64 ResStatus;
|
||||||
EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *ACPIAddressDesc;
|
EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *ACPIAddressDesc;
|
||||||
@ -659,17 +657,16 @@ GetResourceAllocationStatus (
|
|||||||
|
|
||||||
Temp += sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR);
|
Temp += sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Remove a PCI device from device pool and mark its bar
|
Remove a PCI device from device pool and mark its bar.
|
||||||
|
|
||||||
@param PciDevice Instance of Pci device.
|
@param PciDevice Instance of Pci device.
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success Operation.
|
@retval EFI_SUCCESS Successfully remove the PCI device.
|
||||||
@retval EFI_ABORTED Pci device is a root bridge.
|
@retval EFI_ABORTED Pci device is a root bridge or a PCI-PCI bridge.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
RejectPciDevice (
|
RejectPciDevice (
|
||||||
@ -683,7 +680,7 @@ RejectPciDevice (
|
|||||||
//
|
//
|
||||||
// Remove the padding resource from a bridge
|
// Remove the padding resource from a bridge
|
||||||
//
|
//
|
||||||
if ( IS_PCI_BRIDGE(&PciDevice->Pci) &&
|
if ( IS_PCI_BRIDGE(&PciDevice->Pci) &&
|
||||||
PciDevice->ResourcePaddingDescriptors != NULL ) {
|
PciDevice->ResourcePaddingDescriptors != NULL ) {
|
||||||
FreePool (PciDevice->ResourcePaddingDescriptors);
|
FreePool (PciDevice->ResourcePaddingDescriptors);
|
||||||
PciDevice->ResourcePaddingDescriptors = NULL;
|
PciDevice->ResourcePaddingDescriptors = NULL;
|
||||||
@ -736,10 +733,12 @@ RejectPciDevice (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Determine whethter a PCI device can be rejected.
|
Determine whethter a PCI device can be rejected.
|
||||||
|
|
||||||
@param PciResNode Pointer to Pci resource node instance.
|
@param PciResNode Pointer to Pci resource node instance.
|
||||||
|
|
||||||
@return whethter a PCI device can be rejected.
|
@retval TRUE The PCI device can be rejected.
|
||||||
|
@retval TRUE The PCI device cannot be rejected.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
IsRejectiveDevice (
|
IsRejectiveDevice (
|
||||||
@ -782,12 +781,13 @@ IsRejectiveDevice (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Compare two resource node and get the larger resource consumer
|
Compare two resource nodes and get the larger resource consumer.
|
||||||
|
|
||||||
@param PciResNode1 resource node 1 want to be compared
|
@param PciResNode1 resource node 1 want to be compared
|
||||||
@param PciResNode2 resource node 2 want to be compared
|
@param PciResNode2 resource node 2 want to be compared
|
||||||
|
|
||||||
@return Larger resource consumer.
|
@return Larger resource node.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
PCI_RESOURCE_NODE *
|
PCI_RESOURCE_NODE *
|
||||||
GetLargerConsumerDevice (
|
GetLargerConsumerDevice (
|
||||||
@ -814,16 +814,16 @@ GetLargerConsumerDevice (
|
|||||||
}
|
}
|
||||||
|
|
||||||
return PciResNode2;
|
return PciResNode2;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get the max resource consumer in the host resource pool.
|
Get the max resource consumer in the host resource pool.
|
||||||
|
|
||||||
@param ResPool Pointer to resource pool node.
|
@param ResPool Pointer to resource pool node.
|
||||||
|
|
||||||
@return the max resource consumer in the host resource pool.
|
@return The max resource consumer in the host resource pool.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
PCI_RESOURCE_NODE *
|
PCI_RESOURCE_NODE *
|
||||||
GetMaxResourceConsumerDevice (
|
GetMaxResourceConsumerDevice (
|
||||||
@ -864,17 +864,21 @@ GetMaxResourceConsumerDevice (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Adjust host bridge allocation so as to reduce resource requirement
|
Adjust host bridge allocation so as to reduce resource requirement
|
||||||
|
|
||||||
@param IoPool Pointer to instance of I/O resource Node.
|
@param IoPool Pointer to instance of I/O resource Node.
|
||||||
@param Mem32Pool Pointer to instance of 32-bit memory resource Node.
|
@param Mem32Pool Pointer to instance of 32-bit memory resource Node.
|
||||||
@param PMem32Pool Pointer to instance of 32-bit Pmemory resource node.
|
@param PMem32Pool Pointer to instance of 32-bit Prefetchable memory resource node.
|
||||||
@param Mem64Pool Pointer to instance of 64-bit memory resource node.
|
@param Mem64Pool Pointer to instance of 64-bit memory resource node.
|
||||||
@param PMem64Pool Pointer to instance of 64-bit Pmemory resource node.
|
@param PMem64Pool Pointer to instance of 64-bit Prefetchable memory resource node.
|
||||||
@param IoResStatus Status of I/O resource Node.
|
@param IoResStatus Status of I/O resource Node.
|
||||||
@param Mem32ResStatus Status of 32-bit memory resource Node.
|
@param Mem32ResStatus Status of 32-bit memory resource Node.
|
||||||
@param PMem32ResStatus Status of 32-bit Pmemory resource node.
|
@param PMem32ResStatus Status of 32-bit Prefetchable memory resource node.
|
||||||
@param Mem64ResStatus Status of 64-bit memory resource node.
|
@param Mem64ResStatus Status of 64-bit memory resource node.
|
||||||
@param PMem64ResStatus Status of 64-bit Pmemory resource node.
|
@param PMem64ResStatus Status of 64-bit Prefetchable memory resource node.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Successfully adjusted resoruce on host bridge.
|
||||||
|
@retval EFI_ABORTED Host bridge hasn't this resource type or no resource be adjusted.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
PciHostBridgeAdjustAllocation (
|
PciHostBridgeAdjustAllocation (
|
||||||
@ -927,7 +931,7 @@ PciHostBridgeAdjustAllocation (
|
|||||||
|
|
||||||
if (ResStatus[ResType] == EFI_RESOURCE_NOT_SATISFIED) {
|
if (ResStatus[ResType] == EFI_RESOURCE_NOT_SATISFIED) {
|
||||||
//
|
//
|
||||||
// Hostbridge hasn't this resource type
|
// Host bridge hasn't this resource type
|
||||||
//
|
//
|
||||||
return EFI_ABORTED;
|
return EFI_ABORTED;
|
||||||
}
|
}
|
||||||
@ -998,7 +1002,7 @@ PciHostBridgeAdjustAllocation (
|
|||||||
/**
|
/**
|
||||||
Summary requests for all resource type, and contruct ACPI resource
|
Summary requests for all resource type, and contruct ACPI resource
|
||||||
requestor instance.
|
requestor instance.
|
||||||
|
|
||||||
@param Bridge detecting bridge
|
@param Bridge detecting bridge
|
||||||
@param IoNode Pointer to instance of I/O resource Node
|
@param IoNode Pointer to instance of I/O resource Node
|
||||||
@param Mem32Node Pointer to instance of 32-bit memory resource Node
|
@param Mem32Node Pointer to instance of 32-bit memory resource Node
|
||||||
@ -1006,6 +1010,10 @@ PciHostBridgeAdjustAllocation (
|
|||||||
@param Mem64Node Pointer to instance of 64-bit memory resource node
|
@param Mem64Node Pointer to instance of 64-bit memory resource node
|
||||||
@param PMem64Node Pointer to instance of 64-bit Pmemory resource node
|
@param PMem64Node Pointer to instance of 64-bit Pmemory resource node
|
||||||
@param Config Output buffer holding new constructed APCI resource requestor
|
@param Config Output buffer holding new constructed APCI resource requestor
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Successfully constructed ACPI resource.
|
||||||
|
@retval EFI_OUT_OF_RESOURCES No memory availabe.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
ConstructAcpiResourceRequestor (
|
ConstructAcpiResourceRequestor (
|
||||||
@ -1235,18 +1243,16 @@ ConstructAcpiResourceRequestor (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Get resource base from an acpi configuration descriptor.
|
Get resource base from an acpi configuration descriptor.
|
||||||
|
|
||||||
@param Config an acpi configuration descriptor.
|
@param Config An acpi configuration descriptor.
|
||||||
@param IoBase output of I/O resource base address.
|
@param IoBase Output of I/O resource base address.
|
||||||
@param Mem32Base output of 32-bit memory base address.
|
@param Mem32Base Output of 32-bit memory base address.
|
||||||
@param PMem32Base output of 32-bit pmemory base address.
|
@param PMem32Base Output of 32-bit prefetchable memory base address.
|
||||||
@param Mem64Base output of 64-bit memory base address.
|
@param Mem64Base Output of 64-bit memory base address.
|
||||||
@param PMem64Base output of 64-bit pmemory base address.
|
@param PMem64Base Output of 64-bit prefetchable memory base address.
|
||||||
|
|
||||||
@return EFI_SUCCESS Get resource base address successfully.
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
VOID
|
||||||
GetResourceBase (
|
GetResourceBase (
|
||||||
IN VOID *Config,
|
IN VOID *Config,
|
||||||
OUT UINT64 *IoBase,
|
OUT UINT64 *IoBase,
|
||||||
@ -1325,18 +1331,17 @@ GetResourceBase (
|
|||||||
//
|
//
|
||||||
Temp += sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR);
|
Temp += sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Enumerate pci bridge, allocate resource and determine attribute
|
Enumerate pci bridge, allocate resource and determine attribute
|
||||||
for devices on this bridge
|
for devices on this bridge.
|
||||||
|
|
||||||
@param BridgeDev Pointer to instance of bridge device.
|
@param BridgeDev Pointer to instance of bridge device.
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success operation.
|
@retval EFI_SUCCESS Successfully enumerated PCI bridge.
|
||||||
@retval Others Fail to enumerate.
|
@retval other Failed to enumerate.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
PciBridgeEnumerator (
|
PciBridgeEnumerator (
|
||||||
@ -1390,12 +1395,13 @@ PciBridgeEnumerator (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Allocate all kinds of resource for bridge
|
Allocate all kinds of resource for PCI bridge.
|
||||||
|
|
||||||
@param Bridge Pointer to bridge instance.
|
@param Bridge Pointer to bridge instance.
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success operation.
|
@retval EFI_SUCCESS Successfully allocated resource for PCI bridge.
|
||||||
@retval Others Fail to allocate resource for bridge.
|
@retval other Failed to allocate resource for bridge.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
PciBridgeResourceAllocator (
|
PciBridgeResourceAllocator (
|
||||||
@ -1415,13 +1421,13 @@ PciBridgeResourceAllocator (
|
|||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
IoBridge = CreateResourceNode (
|
IoBridge = CreateResourceNode (
|
||||||
Bridge,
|
Bridge,
|
||||||
0,
|
0,
|
||||||
0xFFF,
|
0xFFF,
|
||||||
0,
|
0,
|
||||||
PciBarTypeIo16,
|
PciBarTypeIo16,
|
||||||
PciResUsageTypical
|
PciResUsageTypical
|
||||||
);
|
);
|
||||||
|
|
||||||
Mem32Bridge = CreateResourceNode (
|
Mem32Bridge = CreateResourceNode (
|
||||||
Bridge,
|
Bridge,
|
||||||
@ -1433,13 +1439,13 @@ PciBridgeResourceAllocator (
|
|||||||
);
|
);
|
||||||
|
|
||||||
PMem32Bridge = CreateResourceNode (
|
PMem32Bridge = CreateResourceNode (
|
||||||
Bridge,
|
Bridge,
|
||||||
0,
|
0,
|
||||||
0xFFFFF,
|
0xFFFFF,
|
||||||
0,
|
0,
|
||||||
PciBarTypePMem32,
|
PciBarTypePMem32,
|
||||||
PciResUsageTypical
|
PciResUsageTypical
|
||||||
);
|
);
|
||||||
|
|
||||||
Mem64Bridge = CreateResourceNode (
|
Mem64Bridge = CreateResourceNode (
|
||||||
Bridge,
|
Bridge,
|
||||||
@ -1451,38 +1457,34 @@ PciBridgeResourceAllocator (
|
|||||||
);
|
);
|
||||||
|
|
||||||
PMem64Bridge = CreateResourceNode (
|
PMem64Bridge = CreateResourceNode (
|
||||||
Bridge,
|
Bridge,
|
||||||
0,
|
0,
|
||||||
0xFFFFF,
|
0xFFFFF,
|
||||||
0,
|
0,
|
||||||
PciBarTypePMem64,
|
PciBarTypePMem64,
|
||||||
PciResUsageTypical
|
PciResUsageTypical
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Create resourcemap by going through all the devices subject to this root bridge
|
// Create resourcemap by going through all the devices subject to this root bridge
|
||||||
//
|
//
|
||||||
Status = CreateResourceMap (
|
CreateResourceMap (
|
||||||
Bridge,
|
Bridge,
|
||||||
IoBridge,
|
IoBridge,
|
||||||
Mem32Bridge,
|
Mem32Bridge,
|
||||||
PMem32Bridge,
|
PMem32Bridge,
|
||||||
Mem64Bridge,
|
Mem64Bridge,
|
||||||
PMem64Bridge
|
PMem64Bridge
|
||||||
);
|
);
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
Status = GetResourceBaseFromBridge (
|
Status = GetResourceBaseFromBridge (
|
||||||
Bridge,
|
Bridge,
|
||||||
&IoBase,
|
&IoBase,
|
||||||
&Mem32Base,
|
&Mem32Base,
|
||||||
&PMem32Base,
|
&PMem32Base,
|
||||||
&Mem64Base,
|
&Mem64Base,
|
||||||
&PMem64Base
|
&PMem64Base
|
||||||
);
|
);
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
@ -1544,16 +1546,18 @@ PciBridgeResourceAllocator (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get resource base address for a pci bridge device
|
Get resource base address for a pci bridge device.
|
||||||
|
|
||||||
@param Bridge Given Pci driver instance.
|
@param Bridge Given Pci driver instance.
|
||||||
@param IoBase output for base address of I/O type resource.
|
@param IoBase Output for base address of I/O type resource.
|
||||||
@param Mem32Base output for base address of 32-bit memory type resource.
|
@param Mem32Base Output for base address of 32-bit memory type resource.
|
||||||
@param PMem32Base output for base address of 32-bit Pmemory type resource.
|
@param PMem32Base Ooutput for base address of 32-bit Pmemory type resource.
|
||||||
@param Mem64Base output for base address of 64-bit memory type resource.
|
@param Mem64Base Output for base address of 64-bit memory type resource.
|
||||||
@param PMem64Base output for base address of 64-bit Pmemory type resource.
|
@param PMem64Base Output for base address of 64-bit Pmemory type resource.
|
||||||
|
|
||||||
@retval EFI_SUCCESS Succes to get resource base address.
|
@retval EFI_SUCCESS Successfully got resource base address.
|
||||||
|
@retval EFI_OUT_OF_RESOURCES PCI bridge is not available.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
GetResourceBaseFromBridge (
|
GetResourceBaseFromBridge (
|
||||||
@ -1631,53 +1635,55 @@ GetResourceBaseFromBridge (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
These are the notifications from the PCI bus driver that it is about to enter a certain
|
These are the notifications from the PCI bus driver that it is about to enter a certain
|
||||||
phase of the PCI enumeration process.
|
phase of the PCI enumeration process.
|
||||||
|
|
||||||
This member function can be used to notify the host bridge driver to perform specific actions,
|
This member function can be used to notify the host bridge driver to perform specific actions,
|
||||||
including any chipset-specific initialization, so that the chipset is ready to enter the next phase.
|
including any chipset-specific initialization, so that the chipset is ready to enter the next phase.
|
||||||
Eight notification points are defined at this time. See belows:
|
Eight notification points are defined at this time. See belows:
|
||||||
EfiPciHostBridgeBeginEnumeration - Resets the host bridge PCI apertures and internal data
|
EfiPciHostBridgeBeginEnumeration Resets the host bridge PCI apertures and internal data
|
||||||
structures. The PCI enumerator should issue this notification
|
structures. The PCI enumerator should issue this notification
|
||||||
before starting a fresh enumeration process. Enumeration cannot
|
before starting a fresh enumeration process. Enumeration cannot
|
||||||
be restarted after sending any other notification such as
|
be restarted after sending any other notification such as
|
||||||
EfiPciHostBridgeBeginBusAllocation.
|
EfiPciHostBridgeBeginBusAllocation.
|
||||||
EfiPciHostBridgeBeginBusAllocation - The bus allocation phase is about to begin. No specific action is
|
EfiPciHostBridgeBeginBusAllocation The bus allocation phase is about to begin. No specific action is
|
||||||
required here. This notification can be used to perform any
|
required here. This notification can be used to perform any
|
||||||
chipset-specific programming.
|
chipset-specific programming.
|
||||||
EfiPciHostBridgeEndBusAllocation - The bus allocation and bus programming phase is complete. No
|
EfiPciHostBridgeEndBusAllocation The bus allocation and bus programming phase is complete. No
|
||||||
specific action is required here. This notification can be used to
|
specific action is required here. This notification can be used to
|
||||||
perform any chipset-specific programming.
|
perform any chipset-specific programming.
|
||||||
EfiPciHostBridgeBeginResourceAllocation - The resource allocation phase is about to begin. No specific
|
EfiPciHostBridgeBeginResourceAllocation
|
||||||
action is required here. This notification can be used to perform
|
The resource allocation phase is about to begin. No specific
|
||||||
any chipset-specific programming.
|
action is required here. This notification can be used to perform
|
||||||
EfiPciHostBridgeAllocateResources - Allocates resources per previously submitted requests for all the PCI
|
any chipset-specific programming.
|
||||||
|
EfiPciHostBridgeAllocateResources Allocates resources per previously submitted requests for all the PCI
|
||||||
root bridges. These resource settings are returned on the next call to
|
root bridges. These resource settings are returned on the next call to
|
||||||
GetProposedResources(). Before calling NotifyPhase() with a Phase of
|
GetProposedResources(). Before calling NotifyPhase() with a Phase of
|
||||||
EfiPciHostBridgeAllocateResource, the PCI bus enumerator is responsible for gathering I/O and memory requests for
|
EfiPciHostBridgeAllocateResource, the PCI bus enumerator is responsible
|
||||||
|
for gathering I/O and memory requests for
|
||||||
all the PCI root bridges and submitting these requests using
|
all the PCI root bridges and submitting these requests using
|
||||||
SubmitResources(). This function pads the resource amount
|
SubmitResources(). This function pads the resource amount
|
||||||
to suit the root bridge hardware, takes care of dependencies between
|
to suit the root bridge hardware, takes care of dependencies between
|
||||||
the PCI root bridges, and calls the Global Coherency Domain (GCD)
|
the PCI root bridges, and calls the Global Coherency Domain (GCD)
|
||||||
with the allocation request. In the case of padding, the allocated range
|
with the allocation request. In the case of padding, the allocated range
|
||||||
could be bigger than what was requested.
|
could be bigger than what was requested.
|
||||||
EfiPciHostBridgeSetResources - Programs the host bridge hardware to decode previously allocated
|
EfiPciHostBridgeSetResources Programs the host bridge hardware to decode previously allocated
|
||||||
resources (proposed resources) for all the PCI root bridges. After the
|
resources (proposed resources) for all the PCI root bridges. After the
|
||||||
hardware is programmed, reassigning resources will not be supported.
|
hardware is programmed, reassigning resources will not be supported.
|
||||||
The bus settings are not affected.
|
The bus settings are not affected.
|
||||||
EfiPciHostBridgeFreeResources - Deallocates resources that were previously allocated for all the PCI
|
EfiPciHostBridgeFreeResources Deallocates resources that were previously allocated for all the PCI
|
||||||
root bridges and resets the I/O and memory apertures to their initial
|
root bridges and resets the I/O and memory apertures to their initial
|
||||||
state. The bus settings are not affected. If the request to allocate
|
state. The bus settings are not affected. If the request to allocate
|
||||||
resources fails, the PCI enumerator can use this notification to
|
resources fails, the PCI enumerator can use this notification to
|
||||||
deallocate previous resources, adjust the requests, and retry
|
deallocate previous resources, adjust the requests, and retry
|
||||||
allocation.
|
allocation.
|
||||||
EfiPciHostBridgeEndResourceAllocation- The resource allocation phase is completed. No specific action is
|
EfiPciHostBridgeEndResourceAllocation The resource allocation phase is completed. No specific action is
|
||||||
required here. This notification can be used to perform any chipsetspecific
|
required here. This notification can be used to perform any chipsetspecific
|
||||||
programming.
|
programming.
|
||||||
|
|
||||||
@param[in] PciResAlloc The instance pointer of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
|
@param[in] PciResAlloc The instance pointer of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
|
||||||
@param[in] Phase The phase during enumeration
|
@param[in] Phase The phase during enumeration
|
||||||
|
|
||||||
@retval EFI_NOT_READY This phase cannot be entered at this time. For example, this error
|
@retval EFI_NOT_READY This phase cannot be entered at this time. For example, this error
|
||||||
is valid for a Phase of EfiPciHostBridgeAllocateResources if
|
is valid for a Phase of EfiPciHostBridgeAllocateResources if
|
||||||
SubmitResources() has not been called for one or more
|
SubmitResources() has not been called for one or more
|
||||||
@ -1759,27 +1765,27 @@ NotifyPhase (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Provides the hooks from the PCI bus driver to every PCI controller (device/function) at various
|
Provides the hooks from the PCI bus driver to every PCI controller (device/function) at various
|
||||||
stages of the PCI enumeration process that allow the host bridge driver to preinitialize individual
|
stages of the PCI enumeration process that allow the host bridge driver to preinitialize individual
|
||||||
PCI controllers before enumeration.
|
PCI controllers before enumeration.
|
||||||
|
|
||||||
This function is called during the PCI enumeration process. No specific action is expected from this
|
This function is called during the PCI enumeration process. No specific action is expected from this
|
||||||
member function. It allows the host bridge driver to preinitialize individual PCI controllers before
|
member function. It allows the host bridge driver to preinitialize individual PCI controllers before
|
||||||
enumeration.
|
enumeration.
|
||||||
|
|
||||||
@param Bridge Pointer to the EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL instance.
|
@param Bridge Pointer to the EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL instance.
|
||||||
@param Bus The bus number of the pci device.
|
@param Bus The bus number of the pci device.
|
||||||
@param Device The device number of the pci device.
|
@param Device The device number of the pci device.
|
||||||
@param Func The function number of the pci device.
|
@param Func The function number of the pci device.
|
||||||
@param Phase The phase of the PCI device enumeration.
|
@param Phase The phase of the PCI device enumeration.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The requested parameters were returned.
|
@retval EFI_SUCCESS The requested parameters were returned.
|
||||||
@retval EFI_INVALID_PARAMETER RootBridgeHandle is not a valid root bridge handle.
|
@retval EFI_INVALID_PARAMETER RootBridgeHandle is not a valid root bridge handle.
|
||||||
@retval EFI_INVALID_PARAMETER Phase is not a valid phase that is defined in
|
@retval EFI_INVALID_PARAMETER Phase is not a valid phase that is defined in
|
||||||
EFI_PCI_CONTROLLER_RESOURCE_ALLOCATION_PHASE.
|
EFI_PCI_CONTROLLER_RESOURCE_ALLOCATION_PHASE.
|
||||||
@retval EFI_DEVICE_ERROR Programming failed due to a hardware error. The PCI enumerator should
|
@retval EFI_DEVICE_ERROR Programming failed due to a hardware error. The PCI enumerator should
|
||||||
not enumerate this device, including its child devices if it is a PCI-to-PCI
|
not enumerate this device, including its child devices if it is a PCI-to-PCI
|
||||||
bridge.
|
bridge.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
@ -1872,17 +1878,27 @@ PreprocessController (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Hot plug request notify.
|
This function allows the PCI bus driver to be notified to act as requested when a hot-plug event has
|
||||||
|
happened on the hot-plug controller. Currently, the operations include add operation and remove operation..
|
||||||
@param This - A pointer to the hot plug request protocol.
|
|
||||||
@param Operation - The operation.
|
@param This A pointer to the hot plug request protocol.
|
||||||
@param Controller - A pointer to the controller.
|
@param Operation The operation the PCI bus driver is requested to make.
|
||||||
@param RemainingDevicePath - A pointer to the device path.
|
@param Controller The handle of the hot-plug controller.
|
||||||
@param NumberOfChildren - A the number of child handle in the ChildHandleBuffer.
|
@param RemainingDevicePath The remaining device path for the PCI-like hot-plug device.
|
||||||
@param ChildHandleBuffer - A pointer to the array contain the child handle.
|
@param NumberOfChildren The number of child handles.
|
||||||
|
For a add operation, it is an output parameter.
|
||||||
@retval EFI_NOT_FOUND Can not find bridge according to controller handle.
|
For a remove operation, it?<3F><>s an input parameter.
|
||||||
@retval EFI_SUCCESS Success operating.
|
@param ChildHandleBuffer The buffer which contains the child handles.
|
||||||
|
|
||||||
|
@retval EFI_INVALID_PARAMETER Operation is not a legal value.
|
||||||
|
Controller is NULL or not a valid handle.
|
||||||
|
NumberOfChildren is NULL.
|
||||||
|
ChildHandleBuffer is NULL while Operation is add.
|
||||||
|
@retval EFI_OUT_OF_RESOURCES There are no enough resources to start the devices.
|
||||||
|
@retval EFI_NOT_FOUND Can not find bridge according to controller handle.
|
||||||
|
@retval EFI_SUCCESS The handles for the specified device have been created or destroyed
|
||||||
|
as requested, and for an add operation, the new handles are
|
||||||
|
returned in ChildHandleBuffer.
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
@ -1986,11 +2002,12 @@ PciHotPlugRequestNotify (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Search hostbridge according to given handle
|
Search hostbridge according to given handle
|
||||||
|
|
||||||
@param RootBridgeHandle - Host bridge handle.
|
|
||||||
|
|
||||||
@return TRUE Found.
|
@param RootBridgeHandle Host bridge handle.
|
||||||
@return FALSE Not found.
|
|
||||||
|
@retval TRUE Found host bridge handle.
|
||||||
|
@retval FALSE Not found hot bridge handle.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
SearchHostBridgeHandle (
|
SearchHostBridgeHandle (
|
||||||
@ -2029,9 +2046,14 @@ SearchHostBridgeHandle (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Add host bridge handle to global variable for enumating.
|
Add host bridge handle to global variable for enumerating.
|
||||||
|
|
||||||
@param HostBridgeHandle host bridge handle.
|
@param HostBridgeHandle Host bridge handle.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Successfully added host bridge.
|
||||||
|
@retval EFI_ABORTED Host bridge is NULL, or given host bridge
|
||||||
|
has been in host bridge list.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
AddHostBridgeEnumerator (
|
AddHostBridgeEnumerator (
|
||||||
|
@ -1,18 +1,17 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Header file declares all logic function for PCI bus enumeration.
|
PCI bus enumeration logic function declaration for PCI bus module.
|
||||||
|
|
||||||
Copyright (c) 2006, Intel Corporation
|
Copyright (c) 2006 - 2009, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
|
||||||
#ifndef _EFI_PCI_ENUMERATOR_H_
|
#ifndef _EFI_PCI_ENUMERATOR_H_
|
||||||
#define _EFI_PCI_ENUMERATOR_H_
|
#define _EFI_PCI_ENUMERATOR_H_
|
||||||
|
|
||||||
@ -20,11 +19,13 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
This routine is used to enumerate entire pci bus system
|
This routine is used to enumerate entire pci bus system
|
||||||
in a given platform
|
in a given platform.
|
||||||
|
|
||||||
@param Controller Parent controller handle.
|
@param Controller Parent controller handle.
|
||||||
|
|
||||||
@return Status of enumerating.
|
@retval EFI_SUCCESS PCI enumeration finished successfully.
|
||||||
|
@retval other Some error occurred when enumerating the pci bus system.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
PciEnumerator (
|
PciEnumerator (
|
||||||
@ -32,14 +33,14 @@ PciEnumerator (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Enumerate PCI root bridge
|
Enumerate PCI root bridge.
|
||||||
|
|
||||||
@param PciResAlloc Pointer to protocol instance of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
|
@param PciResAlloc Pointer to protocol instance of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL.
|
||||||
@param RootBridgeDev Instance of root bridge device.
|
@param RootBridgeDev Instance of root bridge device.
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success to enumerate root bridge.
|
@retval EFI_SUCCESS Successfully enumerated root bridge.
|
||||||
@retval Others Fail to enumerate root bridge.
|
@retval other Failed to enumerate root bridge.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
PciRootBridgeEnumerator (
|
PciRootBridgeEnumerator (
|
||||||
@ -48,15 +49,15 @@ PciRootBridgeEnumerator (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This routine is used to process option rom on a certain root bridge
|
This routine is used to process all PCI devices' Option Rom
|
||||||
|
on a certain root bridge.
|
||||||
|
|
||||||
@param Bridge Given parent's root bridge.
|
@param Bridge Given parent's root bridge.
|
||||||
@param RomBase Base address of ROM driver loaded from.
|
@param RomBase Base address of ROM driver loaded from.
|
||||||
@param MaxLength Max rom size.
|
@param MaxLength Maximum rom size.
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success to process option rom image.
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
VOID
|
||||||
ProcessOptionRom (
|
ProcessOptionRom (
|
||||||
IN PCI_IO_DEVICE *Bridge,
|
IN PCI_IO_DEVICE *Bridge,
|
||||||
IN UINT64 RomBase,
|
IN UINT64 RomBase,
|
||||||
@ -65,12 +66,14 @@ ProcessOptionRom (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
This routine is used to assign bus number to the given PCI bus system
|
This routine is used to assign bus number to the given PCI bus system
|
||||||
|
|
||||||
@param Bridge Parent root bridge instance.
|
@param Bridge Parent root bridge instance.
|
||||||
@param StartBusNumber Number of beginning.
|
@param StartBusNumber Number of beginning.
|
||||||
@param SubBusNumber the number of sub bus.
|
@param SubBusNumber The number of sub bus.
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success to assign bus number.
|
@retval EFI_SUCCESS Successfully assigned bus number.
|
||||||
|
@retval EFI_DEVICE_ERROR Failed to assign bus number.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
PciAssignBusNumber (
|
PciAssignBusNumber (
|
||||||
@ -83,11 +86,12 @@ PciAssignBusNumber (
|
|||||||
This routine is used to determine the root bridge attribute by interfacing
|
This routine is used to determine the root bridge attribute by interfacing
|
||||||
the host bridge resource allocation protocol.
|
the host bridge resource allocation protocol.
|
||||||
|
|
||||||
@param PciResAlloc Protocol instance of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL.
|
@param PciResAlloc Protocol instance of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
|
||||||
@param RootBridgeDev Root bridge instance.
|
@param RootBridgeDev Root bridge instance
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success to get root bridge's attribute.
|
@retval EFI_SUCCESS Successfully got root bridge's attribute.
|
||||||
@retval Others Fail to get attribute.
|
@retval other Failed to get attribute.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
DetermineRootBridgeAttributes (
|
DetermineRootBridgeAttributes (
|
||||||
@ -96,10 +100,12 @@ DetermineRootBridgeAttributes (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get Max Option Rom size on this bridge
|
Get Max Option Rom size on specified bridge.
|
||||||
|
|
||||||
@param Bridge Bridge device instance.
|
@param Bridge Given bridge device instance.
|
||||||
@return Max size of option rom.
|
|
||||||
|
@return Max size of option rom needed.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
UINT64
|
UINT64
|
||||||
GetMaxOptionRomSize (
|
GetMaxOptionRomSize (
|
||||||
@ -108,12 +114,13 @@ GetMaxOptionRomSize (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Process attributes of devices on this host bridge
|
Process attributes of devices on this host bridge
|
||||||
|
|
||||||
@param PciResAlloc Protocol instance of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
|
@param PciResAlloc Protocol instance of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Successfully process attribute.
|
||||||
@retval EFI_NOT_FOUND Can not find the specific root bridge device.
|
@retval EFI_NOT_FOUND Can not find the specific root bridge device.
|
||||||
@retval EFI_SUCCESS Success Process attribute.
|
@retval other Failed to determine the root bridge device's attribute.
|
||||||
@retval Others Can not determine the root bridge device's attribute.
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
PciHostBridgeDeviceAttribute (
|
PciHostBridgeDeviceAttribute (
|
||||||
@ -121,18 +128,17 @@ PciHostBridgeDeviceAttribute (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get resource allocation status from the ACPI pointer
|
Get resource allocation status from the ACPI resource descriptor.
|
||||||
|
|
||||||
@param AcpiConfig Point to Acpi configuration table.
|
@param AcpiConfig Point to Acpi configuration table.
|
||||||
@param IoResStatus Return the status of I/O resource.
|
@param IoResStatus Return the status of I/O resource.
|
||||||
@param Mem32ResStatus Return the status of 32-bit Memory resource.
|
@param Mem32ResStatus Return the status of 32-bit Memory resource.
|
||||||
@param PMem32ResStatus Return the status of 32-bit PMemory resource.
|
@param PMem32ResStatus Return the status of 32-bit Prefetchable Memory resource.
|
||||||
@param Mem64ResStatus Return the status of 64-bit Memory resource.
|
@param Mem64ResStatus Return the status of 64-bit Memory resource.
|
||||||
@param PMem64ResStatus Return the status of 64-bit PMemory resource.
|
@param PMem64ResStatus Return the status of 64-bit Prefetchable Memory resource.
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success to get resource allocation status from ACPI configuration table.
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
VOID
|
||||||
GetResourceAllocationStatus (
|
GetResourceAllocationStatus (
|
||||||
VOID *AcpiConfig,
|
VOID *AcpiConfig,
|
||||||
OUT UINT64 *IoResStatus,
|
OUT UINT64 *IoResStatus,
|
||||||
@ -143,12 +149,13 @@ GetResourceAllocationStatus (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Remove a PCI device from device pool and mark its bar
|
Remove a PCI device from device pool and mark its bar.
|
||||||
|
|
||||||
@param PciDevice Instance of Pci device.
|
@param PciDevice Instance of Pci device.
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success Operation.
|
@retval EFI_SUCCESS Successfully remove the PCI device.
|
||||||
@retval EFI_ABORTED Pci device is a root bridge.
|
@retval EFI_ABORTED Pci device is a root bridge or a PCI-PCI bridge.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
RejectPciDevice (
|
RejectPciDevice (
|
||||||
@ -156,11 +163,13 @@ RejectPciDevice (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Determine whethter a PCI device can be rejected
|
Determine whethter a PCI device can be rejected.
|
||||||
|
|
||||||
@param PciResNode Pointer to Pci resource node instance.
|
@param PciResNode Pointer to Pci resource node instance.
|
||||||
|
|
||||||
@return whethter a PCI device can be rejected.
|
@retval TRUE The PCI device can be rejected.
|
||||||
|
@retval TRUE The PCI device cannot be rejected.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
IsRejectiveDevice (
|
IsRejectiveDevice (
|
||||||
@ -168,12 +177,13 @@ IsRejectiveDevice (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Compare two resource node and get the larger resource consumer
|
Compare two resource nodes and get the larger resource consumer.
|
||||||
|
|
||||||
@param PciResNode1 resource node 1 want to be compared.
|
@param PciResNode1 resource node 1 want to be compared
|
||||||
@param PciResNode2 resource node 2 want to be compared.
|
@param PciResNode2 resource node 2 want to be compared
|
||||||
|
|
||||||
@return Larger resource consumer.
|
@return Larger resource node.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
PCI_RESOURCE_NODE *
|
PCI_RESOURCE_NODE *
|
||||||
GetLargerConsumerDevice (
|
GetLargerConsumerDevice (
|
||||||
@ -182,11 +192,12 @@ GetLargerConsumerDevice (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get the max resource consumer in the host resource pool
|
Get the max resource consumer in the host resource pool.
|
||||||
|
|
||||||
@param ResPool Pointer to resource pool node.
|
@param ResPool Pointer to resource pool node.
|
||||||
|
|
||||||
@return the max resource consumer in the host resource pool.
|
@return The max resource consumer in the host resource pool.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
PCI_RESOURCE_NODE *
|
PCI_RESOURCE_NODE *
|
||||||
GetMaxResourceConsumerDevice (
|
GetMaxResourceConsumerDevice (
|
||||||
@ -195,17 +206,21 @@ GetMaxResourceConsumerDevice (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Adjust host bridge allocation so as to reduce resource requirement
|
Adjust host bridge allocation so as to reduce resource requirement
|
||||||
|
|
||||||
@param IoPool Pointer to instance of I/O resource Node.
|
@param IoPool Pointer to instance of I/O resource Node.
|
||||||
@param Mem32Pool Pointer to instance of 32-bit memory resource Node.
|
@param Mem32Pool Pointer to instance of 32-bit memory resource Node.
|
||||||
@param PMem32Pool Pointer to instance of 32-bit Pmemory resource node.
|
@param PMem32Pool Pointer to instance of 32-bit Prefetchable memory resource node.
|
||||||
@param Mem64Pool Pointer to instance of 64-bit memory resource node.
|
@param Mem64Pool Pointer to instance of 64-bit memory resource node.
|
||||||
@param PMem64Pool Pointer to instance of 64-bit Pmemory resource node.
|
@param PMem64Pool Pointer to instance of 64-bit Prefetchable memory resource node.
|
||||||
@param IoResStatus Status of I/O resource Node.
|
@param IoResStatus Status of I/O resource Node.
|
||||||
@param Mem32ResStatus Status of 32-bit memory resource Node.
|
@param Mem32ResStatus Status of 32-bit memory resource Node.
|
||||||
@param PMem32ResStatus Status of 32-bit Pmemory resource node.
|
@param PMem32ResStatus Status of 32-bit Prefetchable memory resource node.
|
||||||
@param Mem64ResStatus Status of 64-bit memory resource node.
|
@param Mem64ResStatus Status of 64-bit memory resource node.
|
||||||
@param PMem64ResStatus Status of 64-bit Pmemory resource node.
|
@param PMem64ResStatus Status of 64-bit Prefetchable memory resource node.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Successfully adjusted resoruce on host bridge.
|
||||||
|
@retval EFI_ABORTED Host bridge hasn't this resource type or no resource be adjusted.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
PciHostBridgeAdjustAllocation (
|
PciHostBridgeAdjustAllocation (
|
||||||
@ -224,14 +239,18 @@ PciHostBridgeAdjustAllocation (
|
|||||||
/**
|
/**
|
||||||
Summary requests for all resource type, and contruct ACPI resource
|
Summary requests for all resource type, and contruct ACPI resource
|
||||||
requestor instance.
|
requestor instance.
|
||||||
|
|
||||||
@param Bridge detecting bridge.
|
@param Bridge detecting bridge
|
||||||
@param IoNode Pointer to instance of I/O resource Node.
|
@param IoNode Pointer to instance of I/O resource Node
|
||||||
@param Mem32Node Pointer to instance of 32-bit memory resource Node.
|
@param Mem32Node Pointer to instance of 32-bit memory resource Node
|
||||||
@param PMem32Node Pointer to instance of 32-bit Pmemory resource node.
|
@param PMem32Node Pointer to instance of 32-bit Pmemory resource node
|
||||||
@param Mem64Node Pointer to instance of 64-bit memory resource node.
|
@param Mem64Node Pointer to instance of 64-bit memory resource node
|
||||||
@param PMem64Node Pointer to instance of 64-bit Pmemory resource node.
|
@param PMem64Node Pointer to instance of 64-bit Pmemory resource node
|
||||||
@param Config Output buffer holding new constructed APCI resource requestor.
|
@param Config Output buffer holding new constructed APCI resource requestor
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Successfully constructed ACPI resource.
|
||||||
|
@retval EFI_OUT_OF_RESOURCES No memory availabe.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
ConstructAcpiResourceRequestor (
|
ConstructAcpiResourceRequestor (
|
||||||
@ -246,18 +265,16 @@ ConstructAcpiResourceRequestor (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Get resource base from an acpi configuration descriptor.
|
Get resource base from an acpi configuration descriptor.
|
||||||
|
|
||||||
@param Config an acpi configuration descriptor.
|
@param Config An acpi configuration descriptor.
|
||||||
@param IoBase output of I/O resource base address.
|
@param IoBase Output of I/O resource base address.
|
||||||
@param Mem32Base output of 32-bit memory base address.
|
@param Mem32Base Output of 32-bit memory base address.
|
||||||
@param PMem32Base output of 32-bit pmemory base address.
|
@param PMem32Base Output of 32-bit prefetchable memory base address.
|
||||||
@param Mem64Base output of 64-bit memory base address.
|
@param Mem64Base Output of 64-bit memory base address.
|
||||||
@param PMem64Base output of 64-bit pmemory base address.
|
@param PMem64Base Output of 64-bit prefetchable memory base address.
|
||||||
|
|
||||||
@return EFI_SUCCESS Get resource base address successfully.
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
VOID
|
||||||
GetResourceBase (
|
GetResourceBase (
|
||||||
IN VOID *Config,
|
IN VOID *Config,
|
||||||
OUT UINT64 *IoBase,
|
OUT UINT64 *IoBase,
|
||||||
@ -269,12 +286,13 @@ GetResourceBase (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Enumerate pci bridge, allocate resource and determine attribute
|
Enumerate pci bridge, allocate resource and determine attribute
|
||||||
for devices on this bridge
|
for devices on this bridge.
|
||||||
|
|
||||||
@param BridgeDev Pointer to instance of bridge device.
|
@param BridgeDev Pointer to instance of bridge device.
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success operation.
|
@retval EFI_SUCCESS Successfully enumerated PCI bridge.
|
||||||
@retval Others Fail to enumerate.
|
@retval other Failed to enumerate.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
PciBridgeEnumerator (
|
PciBridgeEnumerator (
|
||||||
@ -282,12 +300,13 @@ PciBridgeEnumerator (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Allocate all kinds of resource for bridge
|
Allocate all kinds of resource for PCI bridge.
|
||||||
|
|
||||||
@param Bridge Pointer to bridge instance.
|
@param Bridge Pointer to bridge instance.
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success operation.
|
@retval EFI_SUCCESS Successfully allocated resource for PCI bridge.
|
||||||
@retval Others Fail to allocate resource for bridge.
|
@retval other Failed to allocate resource for bridge.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
PciBridgeResourceAllocator (
|
PciBridgeResourceAllocator (
|
||||||
@ -295,16 +314,18 @@ PciBridgeResourceAllocator (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get resource base address for a pci bridge device
|
Get resource base address for a pci bridge device.
|
||||||
|
|
||||||
@param Bridge Given Pci driver instance.
|
@param Bridge Given Pci driver instance.
|
||||||
@param IoBase output for base address of I/O type resource.
|
@param IoBase Output for base address of I/O type resource.
|
||||||
@param Mem32Base output for base address of 32-bit memory type resource.
|
@param Mem32Base Output for base address of 32-bit memory type resource.
|
||||||
@param PMem32Base output for base address of 32-bit Pmemory type resource.
|
@param PMem32Base Ooutput for base address of 32-bit Pmemory type resource.
|
||||||
@param Mem64Base output for base address of 64-bit memory type resource.
|
@param Mem64Base Output for base address of 64-bit memory type resource.
|
||||||
@param PMem64Base output for base address of 64-bit Pmemory type resource.
|
@param PMem64Base Output for base address of 64-bit Pmemory type resource.
|
||||||
|
|
||||||
@retval EFI_SUCCESS Succes to get resource base address.
|
@retval EFI_SUCCESS Successfully got resource base address.
|
||||||
|
@retval EFI_OUT_OF_RESOURCES PCI bridge is not available.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
GetResourceBaseFromBridge (
|
GetResourceBaseFromBridge (
|
||||||
@ -318,9 +339,9 @@ GetResourceBaseFromBridge (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Process Option Rom on this host bridge
|
Process Option Rom on this host bridge
|
||||||
|
|
||||||
@param PciResAlloc Pointer to instance of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL.
|
@param PciResAlloc Pointer to instance of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL.
|
||||||
|
|
||||||
@retval EFI_NOT_FOUND Can not find the root bridge instance.
|
@retval EFI_NOT_FOUND Can not find the root bridge instance.
|
||||||
@retval EFI_SUCCESS Success process.
|
@retval EFI_SUCCESS Success process.
|
||||||
**/
|
**/
|
||||||
@ -330,53 +351,55 @@ PciHostBridgeP2CProcess (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
These are the notifications from the PCI bus driver that it is about to enter a certain
|
These are the notifications from the PCI bus driver that it is about to enter a certain
|
||||||
phase of the PCI enumeration process.
|
phase of the PCI enumeration process.
|
||||||
|
|
||||||
This member function can be used to notify the host bridge driver to perform specific actions,
|
This member function can be used to notify the host bridge driver to perform specific actions,
|
||||||
including any chipset-specific initialization, so that the chipset is ready to enter the next phase.
|
including any chipset-specific initialization, so that the chipset is ready to enter the next phase.
|
||||||
Eight notification points are defined at this time. See belows:
|
Eight notification points are defined at this time. See belows:
|
||||||
EfiPciHostBridgeBeginEnumeration - Resets the host bridge PCI apertures and internal data
|
EfiPciHostBridgeBeginEnumeration Resets the host bridge PCI apertures and internal data
|
||||||
structures. The PCI enumerator should issue this notification
|
structures. The PCI enumerator should issue this notification
|
||||||
before starting a fresh enumeration process. Enumeration cannot
|
before starting a fresh enumeration process. Enumeration cannot
|
||||||
be restarted after sending any other notification such as
|
be restarted after sending any other notification such as
|
||||||
EfiPciHostBridgeBeginBusAllocation.
|
EfiPciHostBridgeBeginBusAllocation.
|
||||||
EfiPciHostBridgeBeginBusAllocation - The bus allocation phase is about to begin. No specific action is
|
EfiPciHostBridgeBeginBusAllocation The bus allocation phase is about to begin. No specific action is
|
||||||
required here. This notification can be used to perform any
|
required here. This notification can be used to perform any
|
||||||
chipset-specific programming.
|
chipset-specific programming.
|
||||||
EfiPciHostBridgeEndBusAllocation - The bus allocation and bus programming phase is complete. No
|
EfiPciHostBridgeEndBusAllocation The bus allocation and bus programming phase is complete. No
|
||||||
specific action is required here. This notification can be used to
|
specific action is required here. This notification can be used to
|
||||||
perform any chipset-specific programming.
|
perform any chipset-specific programming.
|
||||||
EfiPciHostBridgeBeginResourceAllocation - The resource allocation phase is about to begin. No specific
|
EfiPciHostBridgeBeginResourceAllocation
|
||||||
action is required here. This notification can be used to perform
|
The resource allocation phase is about to begin. No specific
|
||||||
any chipset-specific programming.
|
action is required here. This notification can be used to perform
|
||||||
EfiPciHostBridgeAllocateResources - Allocates resources per previously submitted requests for all the PCI
|
any chipset-specific programming.
|
||||||
|
EfiPciHostBridgeAllocateResources Allocates resources per previously submitted requests for all the PCI
|
||||||
root bridges. These resource settings are returned on the next call to
|
root bridges. These resource settings are returned on the next call to
|
||||||
GetProposedResources(). Before calling NotifyPhase() with a Phase of
|
GetProposedResources(). Before calling NotifyPhase() with a Phase of
|
||||||
EfiPciHostBridgeAllocateResource, the PCI bus enumerator is responsible for gathering I/O and memory requests for
|
EfiPciHostBridgeAllocateResource, the PCI bus enumerator is responsible
|
||||||
|
for gathering I/O and memory requests for
|
||||||
all the PCI root bridges and submitting these requests using
|
all the PCI root bridges and submitting these requests using
|
||||||
SubmitResources(). This function pads the resource amount
|
SubmitResources(). This function pads the resource amount
|
||||||
to suit the root bridge hardware, takes care of dependencies between
|
to suit the root bridge hardware, takes care of dependencies between
|
||||||
the PCI root bridges, and calls the Global Coherency Domain (GCD)
|
the PCI root bridges, and calls the Global Coherency Domain (GCD)
|
||||||
with the allocation request. In the case of padding, the allocated range
|
with the allocation request. In the case of padding, the allocated range
|
||||||
could be bigger than what was requested.
|
could be bigger than what was requested.
|
||||||
EfiPciHostBridgeSetResources - Programs the host bridge hardware to decode previously allocated
|
EfiPciHostBridgeSetResources Programs the host bridge hardware to decode previously allocated
|
||||||
resources (proposed resources) for all the PCI root bridges. After the
|
resources (proposed resources) for all the PCI root bridges. After the
|
||||||
hardware is programmed, reassigning resources will not be supported.
|
hardware is programmed, reassigning resources will not be supported.
|
||||||
The bus settings are not affected.
|
The bus settings are not affected.
|
||||||
EfiPciHostBridgeFreeResources - Deallocates resources that were previously allocated for all the PCI
|
EfiPciHostBridgeFreeResources Deallocates resources that were previously allocated for all the PCI
|
||||||
root bridges and resets the I/O and memory apertures to their initial
|
root bridges and resets the I/O and memory apertures to their initial
|
||||||
state. The bus settings are not affected. If the request to allocate
|
state. The bus settings are not affected. If the request to allocate
|
||||||
resources fails, the PCI enumerator can use this notification to
|
resources fails, the PCI enumerator can use this notification to
|
||||||
deallocate previous resources, adjust the requests, and retry
|
deallocate previous resources, adjust the requests, and retry
|
||||||
allocation.
|
allocation.
|
||||||
EfiPciHostBridgeEndResourceAllocation- The resource allocation phase is completed. No specific action is
|
EfiPciHostBridgeEndResourceAllocation The resource allocation phase is completed. No specific action is
|
||||||
required here. This notification can be used to perform any chipsetspecific
|
required here. This notification can be used to perform any chipsetspecific
|
||||||
programming.
|
programming.
|
||||||
|
|
||||||
@param[in] PciResAlloc The instance pointer of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
|
@param[in] PciResAlloc The instance pointer of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
|
||||||
@param[in] Phase The phase during enumeration
|
@param[in] Phase The phase during enumeration
|
||||||
|
|
||||||
@retval EFI_NOT_READY This phase cannot be entered at this time. For example, this error
|
@retval EFI_NOT_READY This phase cannot be entered at this time. For example, this error
|
||||||
is valid for a Phase of EfiPciHostBridgeAllocateResources if
|
is valid for a Phase of EfiPciHostBridgeAllocateResources if
|
||||||
SubmitResources() has not been called for one or more
|
SubmitResources() has not been called for one or more
|
||||||
@ -398,25 +421,25 @@ NotifyPhase (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Provides the hooks from the PCI bus driver to every PCI controller (device/function) at various
|
Provides the hooks from the PCI bus driver to every PCI controller (device/function) at various
|
||||||
stages of the PCI enumeration process that allow the host bridge driver to preinitialize individual
|
stages of the PCI enumeration process that allow the host bridge driver to preinitialize individual
|
||||||
PCI controllers before enumeration.
|
PCI controllers before enumeration.
|
||||||
|
|
||||||
This function is called during the PCI enumeration process. No specific action is expected from this
|
This function is called during the PCI enumeration process. No specific action is expected from this
|
||||||
member function. It allows the host bridge driver to preinitialize individual PCI controllers before
|
member function. It allows the host bridge driver to preinitialize individual PCI controllers before
|
||||||
enumeration.
|
enumeration.
|
||||||
|
|
||||||
@param Bridge Pointer to the EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL instance.
|
@param Bridge Pointer to the EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL instance.
|
||||||
@param Bus The bus number of the pci device.
|
@param Bus The bus number of the pci device.
|
||||||
@param Device The device number of the pci device.
|
@param Device The device number of the pci device.
|
||||||
@param Func The function number of the pci device.
|
@param Func The function number of the pci device.
|
||||||
@param Phase The phase of the PCI device enumeration.
|
@param Phase The phase of the PCI device enumeration.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The requested parameters were returned.
|
@retval EFI_SUCCESS The requested parameters were returned.
|
||||||
@retval EFI_INVALID_PARAMETER RootBridgeHandle is not a valid root bridge handle.
|
@retval EFI_INVALID_PARAMETER RootBridgeHandle is not a valid root bridge handle.
|
||||||
@retval EFI_INVALID_PARAMETER Phase is not a valid phase that is defined in
|
@retval EFI_INVALID_PARAMETER Phase is not a valid phase that is defined in
|
||||||
EFI_PCI_CONTROLLER_RESOURCE_ALLOCATION_PHASE.
|
EFI_PCI_CONTROLLER_RESOURCE_ALLOCATION_PHASE.
|
||||||
@retval EFI_DEVICE_ERROR Programming failed due to a hardware error. The PCI enumerator should
|
@retval EFI_DEVICE_ERROR Programming failed due to a hardware error. The PCI enumerator should
|
||||||
not enumerate this device, including its child devices if it is a PCI-to-PCI
|
not enumerate this device, including its child devices if it is a PCI-to-PCI
|
||||||
bridge.
|
bridge.
|
||||||
|
|
||||||
@ -431,17 +454,27 @@ PreprocessController (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Hot plug request notify.
|
This function allows the PCI bus driver to be notified to act as requested when a hot-plug event has
|
||||||
|
happened on the hot-plug controller. Currently, the operations include add operation and remove operation..
|
||||||
@param This - A pointer to the hot plug request protocol.
|
|
||||||
@param Operation - The operation.
|
@param This A pointer to the hot plug request protocol.
|
||||||
@param Controller - A pointer to the controller.
|
@param Operation The operation the PCI bus driver is requested to make.
|
||||||
@param RemainingDevicePath - A pointer to the device path.
|
@param Controller The handle of the hot-plug controller.
|
||||||
@param NumberOfChildren - A the number of child handle in the ChildHandleBuffer.
|
@param RemainingDevicePath The remaining device path for the PCI-like hot-plug device.
|
||||||
@param ChildHandleBuffer - A pointer to the array contain the child handle.
|
@param NumberOfChildren The number of child handles.
|
||||||
|
For a add operation, it is an output parameter.
|
||||||
@retval EFI_NOT_FOUND Can not find bridge according to controller handle.
|
For a remove operation, it?<3F><>s an input parameter.
|
||||||
@retval EFI_SUCCESS Success operating.
|
@param ChildHandleBuffer The buffer which contains the child handles.
|
||||||
|
|
||||||
|
@retval EFI_INVALID_PARAMETER Operation is not a legal value.
|
||||||
|
Controller is NULL or not a valid handle.
|
||||||
|
NumberOfChildren is NULL.
|
||||||
|
ChildHandleBuffer is NULL while Operation is add.
|
||||||
|
@retval EFI_OUT_OF_RESOURCES There are no enough resources to start the devices.
|
||||||
|
@retval EFI_NOT_FOUND Can not find bridge according to controller handle.
|
||||||
|
@retval EFI_SUCCESS The handles for the specified device have been created or destroyed
|
||||||
|
as requested, and for an add operation, the new handles are
|
||||||
|
returned in ChildHandleBuffer.
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
@ -456,11 +489,12 @@ PciHotPlugRequestNotify (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Search hostbridge according to given handle
|
Search hostbridge according to given handle
|
||||||
|
|
||||||
@param RootBridgeHandle - Host bridge handle.
|
|
||||||
|
|
||||||
@return TRUE Found.
|
@param RootBridgeHandle Host bridge handle.
|
||||||
@return FALSE Not found.
|
|
||||||
|
@retval TRUE Found host bridge handle.
|
||||||
|
@retval FALSE Not found hot bridge handle.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
SearchHostBridgeHandle (
|
SearchHostBridgeHandle (
|
||||||
@ -468,9 +502,14 @@ SearchHostBridgeHandle (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Add host bridge handle to global variable for enumating.
|
Add host bridge handle to global variable for enumerating.
|
||||||
|
|
||||||
@param HostBridgeHandle host bridge handle.
|
@param HostBridgeHandle Host bridge handle.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Successfully added host bridge.
|
||||||
|
@retval EFI_ABORTED Host bridge is NULL, or given host bridge
|
||||||
|
has been in host bridge list.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
AddHostBridgeEnumerator (
|
AddHostBridgeEnumerator (
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/** @file
|
/** @file
|
||||||
|
PCI emumeration support functions implementation for PCI Bus module.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2009, Intel Corporation
|
Copyright (c) 2006 - 2009, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
@ -11,31 +12,28 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
|
||||||
#include "PciBus.h"
|
#include "PciBus.h"
|
||||||
#include "PciEnumeratorSupport.h"
|
|
||||||
#include "PciCommand.h"
|
|
||||||
#include "PciIo.h"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This routine is used to check whether the pci device is present.
|
This routine is used to check whether the pci device is present.
|
||||||
|
|
||||||
@param PciRootBridgeIo Pointer to instance of EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
|
@param PciRootBridgeIo Pointer to instance of EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
|
||||||
@param Pci Output buffer for PCI device structure.
|
@param Pci Output buffer for PCI device configuration space.
|
||||||
@param Bus PCI bus NO.
|
@param Bus PCI bus NO.
|
||||||
@param Device PCI device NO.
|
@param Device PCI device NO.
|
||||||
@param Func PCI Func NO.
|
@param Func PCI Func NO.
|
||||||
|
|
||||||
@retval EFI_NOT_FOUND device not present.
|
@retval EFI_NOT_FOUND PCI device not present.
|
||||||
@retval EFI_SUCCESS device is found.
|
@retval EFI_SUCCESS PCI device is found.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
PciDevicePresent (
|
PciDevicePresent (
|
||||||
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,
|
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,
|
||||||
PCI_TYPE00 *Pci,
|
OUT PCI_TYPE00 *Pci,
|
||||||
UINT8 Bus,
|
IN UINT8 Bus,
|
||||||
UINT8 Device,
|
IN UINT8 Device,
|
||||||
UINT8 Func
|
IN UINT8 Func
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINT64 Address;
|
UINT64 Address;
|
||||||
@ -47,31 +45,29 @@ PciDevicePresent (
|
|||||||
Address = EFI_PCI_ADDRESS (Bus, Device, Func, 0);
|
Address = EFI_PCI_ADDRESS (Bus, Device, Func, 0);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Read the Vendor Id register
|
// Read the Vendor ID register
|
||||||
//
|
//
|
||||||
Status = PciRootBridgeIoRead (
|
Status = PciRootBridgeIoRead (
|
||||||
PciRootBridgeIo,
|
PciRootBridgeIo,
|
||||||
NULL,
|
NULL,
|
||||||
EfiPciWidthUint32,
|
EfiPciWidthUint32,
|
||||||
Address,
|
Address,
|
||||||
1,
|
1,
|
||||||
Pci
|
Pci
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!EFI_ERROR (Status) && (Pci->Hdr).VendorId != 0xffff) {
|
if (!EFI_ERROR (Status) && (Pci->Hdr).VendorId != 0xffff) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Read the entire config header for the device
|
// Read the entire config header for the device
|
||||||
//
|
//
|
||||||
|
|
||||||
Status = PciRootBridgeIoRead (
|
Status = PciRootBridgeIoRead (
|
||||||
PciRootBridgeIo,
|
PciRootBridgeIo,
|
||||||
NULL,
|
NULL,
|
||||||
EfiPciWidthUint32,
|
EfiPciWidthUint32,
|
||||||
Address,
|
Address,
|
||||||
sizeof (PCI_TYPE00) / sizeof (UINT32),
|
sizeof (PCI_TYPE00) / sizeof (UINT32),
|
||||||
Pci
|
Pci
|
||||||
);
|
);
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -80,17 +76,22 @@ PciDevicePresent (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Collect all the resource information under this root bridge
|
Collect all the resource information under this root bridge.
|
||||||
|
|
||||||
A database that records all the information about pci device subject to this
|
A database that records all the information about pci device subject to this
|
||||||
root bridge will then be created.
|
root bridge will then be created.
|
||||||
|
|
||||||
@param Bridge Parent bridge instance.
|
@param Bridge Parent bridge instance.
|
||||||
@param StartBusNumber Bus number of begining.
|
@param StartBusNumber Bus number of begining.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS PCI device is found.
|
||||||
|
@retval other Some error occurred when reading PCI bridge information.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
PciPciDeviceInfoCollector (
|
PciPciDeviceInfoCollector (
|
||||||
IN PCI_IO_DEVICE *Bridge,
|
IN PCI_IO_DEVICE *Bridge,
|
||||||
UINT8 StartBusNumber
|
IN UINT8 StartBusNumber
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
@ -111,15 +112,13 @@ PciPciDeviceInfoCollector (
|
|||||||
//
|
//
|
||||||
// Check to see whether PCI device is present
|
// Check to see whether PCI device is present
|
||||||
//
|
//
|
||||||
|
|
||||||
Status = PciDevicePresent (
|
Status = PciDevicePresent (
|
||||||
Bridge->PciRootBridgeIo,
|
Bridge->PciRootBridgeIo,
|
||||||
&Pci,
|
&Pci,
|
||||||
(UINT8) StartBusNumber,
|
(UINT8) StartBusNumber,
|
||||||
(UINT8) Device,
|
(UINT8) Device,
|
||||||
(UINT8) Func
|
(UINT8) Func
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -131,19 +130,18 @@ PciPciDeviceInfoCollector (
|
|||||||
// Collect all the information about the PCI device discovered
|
// Collect all the information about the PCI device discovered
|
||||||
//
|
//
|
||||||
Status = PciSearchDevice (
|
Status = PciSearchDevice (
|
||||||
Bridge,
|
Bridge,
|
||||||
&Pci,
|
&Pci,
|
||||||
(UINT8) StartBusNumber,
|
(UINT8) StartBusNumber,
|
||||||
Device,
|
Device,
|
||||||
Func,
|
Func,
|
||||||
&PciIoDevice
|
&PciIoDevice
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Recursively scan PCI busses on the other side of PCI-PCI bridges
|
// Recursively scan PCI busses on the other side of PCI-PCI bridges
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
|
||||||
if (!EFI_ERROR (Status) && (IS_PCI_BRIDGE (&Pci) || IS_CARDBUS_BRIDGE (&Pci))) {
|
if (!EFI_ERROR (Status) && (IS_PCI_BRIDGE (&Pci) || IS_CARDBUS_BRIDGE (&Pci))) {
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -151,7 +149,7 @@ PciPciDeviceInfoCollector (
|
|||||||
//
|
//
|
||||||
PciIo = &(PciIoDevice->PciIo);
|
PciIo = &(PciIoDevice->PciIo);
|
||||||
|
|
||||||
Status = PciIoRead (PciIo, EfiPciIoWidthUint8, 0x19, 1, &SecBus);
|
Status = PciIoRead (PciIo, EfiPciIoWidthUint8, PCI_BRIDGE_SECONDARY_BUS_REGISTER_OFFSET, 1, &SecBus);
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
@ -166,9 +164,9 @@ PciPciDeviceInfoCollector (
|
|||||||
// Deep enumerate the next level bus
|
// Deep enumerate the next level bus
|
||||||
//
|
//
|
||||||
Status = PciPciDeviceInfoCollector (
|
Status = PciPciDeviceInfoCollector (
|
||||||
PciIoDevice,
|
PciIoDevice,
|
||||||
(UINT8) (SecBus)
|
(UINT8) (SecBus)
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,14 +186,18 @@ PciPciDeviceInfoCollector (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Seach required device and get PCI device info block
|
Seach required device and create PCI device instance.
|
||||||
|
|
||||||
@param Bridge Parent bridge instance.
|
@param Bridge Parent bridge instance.
|
||||||
@param Pci Output of PCI device info block.
|
@param Pci Input PCI device information block.
|
||||||
@param Bus PCI bus NO.
|
@param Bus PCI bus NO.
|
||||||
@param Device PCI device NO.
|
@param Device PCI device NO.
|
||||||
@param Func PCI func NO.
|
@param Func PCI func NO.
|
||||||
@param PciDevice output of searched PCI device instance.
|
@param PciDevice Output of searched PCI device instance.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Successfully created PCI device instance.
|
||||||
|
@retval EFI_OUT_OF_RESOURCES Cannot get PCI device information.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
PciSearchDevice (
|
PciSearchDevice (
|
||||||
@ -305,23 +307,24 @@ PciSearchDevice (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Create PCI private data for PCI device
|
Create PCI device instance for PCI device.
|
||||||
|
|
||||||
@param Bridge Parent bridge instance.
|
@param Bridge Parent bridge instance.
|
||||||
@param Pci PCI bar block
|
@param Pci Input PCI device information block.
|
||||||
@param Bus PCI device Bus NO.
|
@param Bus PCI device Bus NO.
|
||||||
@param Device PCI device DeviceNO.
|
@param Device PCI device Device NO.
|
||||||
@param Func PCI device's func NO.
|
@param Func PCI device's func NO.
|
||||||
|
|
||||||
@return new PCI device's private date structure.
|
@return Created PCI device instance.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
PCI_IO_DEVICE *
|
PCI_IO_DEVICE *
|
||||||
GatherDeviceInfo (
|
GatherDeviceInfo (
|
||||||
IN PCI_IO_DEVICE *Bridge,
|
IN PCI_IO_DEVICE *Bridge,
|
||||||
IN PCI_TYPE00 *Pci,
|
IN PCI_TYPE00 *Pci,
|
||||||
UINT8 Bus,
|
IN UINT8 Bus,
|
||||||
UINT8 Device,
|
IN UINT8 Device,
|
||||||
UINT8 Func
|
IN UINT8 Func
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINTN Offset;
|
UINTN Offset;
|
||||||
@ -370,23 +373,24 @@ GatherDeviceInfo (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Create private data for bridge device's PPB.
|
Create PCI device instance for PCI-PCI bridge.
|
||||||
|
|
||||||
@param Bridge Parent bridge
|
@param Bridge Parent bridge instance.
|
||||||
@param Pci Pci device block
|
@param Pci Input PCI device information block.
|
||||||
@param Bus Bridge device's bus NO.
|
@param Bus PCI device Bus NO.
|
||||||
@param Device Bridge device's device NO.
|
@param Device PCI device Device NO.
|
||||||
@param Func Bridge device's func NO.
|
@param Func PCI device's func NO.
|
||||||
|
|
||||||
@return bridge device instance.
|
@return Created PCI device instance.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
PCI_IO_DEVICE *
|
PCI_IO_DEVICE *
|
||||||
GatherPpbInfo (
|
GatherPpbInfo (
|
||||||
IN PCI_IO_DEVICE *Bridge,
|
IN PCI_IO_DEVICE *Bridge,
|
||||||
IN PCI_TYPE00 *Pci,
|
IN PCI_TYPE00 *Pci,
|
||||||
UINT8 Bus,
|
IN UINT8 Bus,
|
||||||
UINT8 Device,
|
IN UINT8 Device,
|
||||||
UINT8 Func
|
IN UINT8 Func
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
|
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
|
||||||
@ -463,7 +467,7 @@ GatherPpbInfo (
|
|||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// test if it supports 64 memory or not
|
// Test if it supports 64 memory or not
|
||||||
//
|
//
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
|
|
||||||
@ -492,24 +496,26 @@ GatherPpbInfo (
|
|||||||
return PciIoDevice;
|
return PciIoDevice;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Create private data for hotplug bridge device
|
Create PCI device instance for PCI Card bridge device.
|
||||||
|
|
||||||
@param Bridge Parent bridge instance
|
@param Bridge Parent bridge instance.
|
||||||
@param Pci PCI bar block
|
@param Pci Input PCI device information block.
|
||||||
@param Bus hotplug bridge device's bus NO.
|
@param Bus PCI device Bus NO.
|
||||||
@param Device hotplug bridge device's device NO.
|
@param Device PCI device Device NO.
|
||||||
@param Func hotplug bridge device's Func NO.
|
@param Func PCI device's func NO.
|
||||||
|
|
||||||
@return hotplug bridge device instance.
|
@return Created PCI device instance.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
PCI_IO_DEVICE *
|
PCI_IO_DEVICE *
|
||||||
GatherP2CInfo (
|
GatherP2CInfo (
|
||||||
IN PCI_IO_DEVICE *Bridge,
|
IN PCI_IO_DEVICE *Bridge,
|
||||||
IN PCI_TYPE00 *Pci,
|
IN PCI_TYPE00 *Pci,
|
||||||
UINT8 Bus,
|
IN UINT8 Bus,
|
||||||
UINT8 Device,
|
IN UINT8 Device,
|
||||||
UINT8 Func
|
IN UINT8 Func
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
|
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
|
||||||
@ -543,8 +549,8 @@ GatherP2CInfo (
|
|||||||
// Initalize the bridge control register
|
// Initalize the bridge control register
|
||||||
//
|
//
|
||||||
PCI_DISABLE_BRIDGE_CONTROL_REGISTER (PciIoDevice, EFI_PCCARD_BRIDGE_CONTROL_BITS_OWNED);
|
PCI_DISABLE_BRIDGE_CONTROL_REGISTER (PciIoDevice, EFI_PCCARD_BRIDGE_CONTROL_BITS_OWNED);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// P2C only has one bar that is in 0x10
|
// P2C only has one bar that is in 0x10
|
||||||
//
|
//
|
||||||
@ -562,12 +568,13 @@ GatherP2CInfo (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Create device path for pci deivce
|
Create device path for pci deivce.
|
||||||
|
|
||||||
@param ParentDevicePath Parent bridge's path.
|
@param ParentDevicePath Parent bridge's path.
|
||||||
@param PciIoDevice Pci device instance.
|
@param PciIoDevice Pci device instance.
|
||||||
|
|
||||||
@return device path protocol instance for specific pci device.
|
@return Device path protocol instance for specific pci device.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_DEVICE_PATH_PROTOCOL *
|
EFI_DEVICE_PATH_PROTOCOL *
|
||||||
CreatePciDevicePath (
|
CreatePciDevicePath (
|
||||||
@ -593,25 +600,24 @@ CreatePciDevicePath (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Check the bar is existed or not.
|
Check whether the bar is existed or not.
|
||||||
|
|
||||||
@param PciIoDevice - A pointer to the PCI_IO_DEVICE.
|
@param PciIoDevice A pointer to the PCI_IO_DEVICE.
|
||||||
@param Offset - The offset.
|
@param Offset The offset.
|
||||||
@param BarLengthValue - The bar length value.
|
@param BarLengthValue The bar length value returned.
|
||||||
@param OriginalBarValue - The original bar value.
|
@param OriginalBarValue The original bar value returned.
|
||||||
|
|
||||||
@retval EFI_NOT_FOUND - The bar don't exist.
|
@retval EFI_NOT_FOUND The bar doesn't exist.
|
||||||
@retval EFI_SUCCESS - The bar exist.
|
@retval EFI_SUCCESS The bar exist.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
BarExisted (
|
BarExisted (
|
||||||
IN PCI_IO_DEVICE *PciIoDevice,
|
IN PCI_IO_DEVICE *PciIoDevice,
|
||||||
IN UINTN Offset,
|
IN UINTN Offset,
|
||||||
OUT UINT32 *BarLengthValue,
|
OUT UINT32 *BarLengthValue,
|
||||||
OUT UINT32 *OriginalBarValue
|
OUT UINT32 *OriginalBarValue
|
||||||
)
|
)
|
||||||
|
|
||||||
{
|
{
|
||||||
EFI_PCI_IO_PROTOCOL *PciIo;
|
EFI_PCI_IO_PROTOCOL *PciIo;
|
||||||
UINT32 OriginalValue;
|
UINT32 OriginalValue;
|
||||||
@ -623,7 +629,6 @@ BarExisted (
|
|||||||
//
|
//
|
||||||
// Preserve the original value
|
// Preserve the original value
|
||||||
//
|
//
|
||||||
|
|
||||||
PciIoRead (PciIo, EfiPciIoWidthUint32, (UINT8) Offset, 1, &OriginalValue);
|
PciIoRead (PciIo, EfiPciIoWidthUint32, (UINT8) Offset, 1, &OriginalValue);
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -660,23 +665,24 @@ BarExisted (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Test whether the device can support attributes
|
Test whether the device can support given attributes.
|
||||||
|
|
||||||
@param PciIoDevice Pci device instance.
|
@param PciIoDevice Pci device instance.
|
||||||
@param Command Command register value.
|
@param Command Input command register value, and
|
||||||
@param BridgeControl Bridge control value for PPB or P2C.
|
returned supported register value.
|
||||||
@param OldCommand Old command register offset.
|
@param BridgeControl Inout bridge control value for PPB or P2C, and
|
||||||
@param OldBridgeControl Old Bridge control value for PPB or P2C.
|
returned supported bridge control value.
|
||||||
|
@param OldCommand Returned and stored old command register offset.
|
||||||
@return EFI_SUCCESS.
|
@param OldBridgeControl Returned and stored old Bridge control value for PPB or P2C.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
VOID
|
||||||
PciTestSupportedAttribute (
|
PciTestSupportedAttribute (
|
||||||
IN PCI_IO_DEVICE *PciIoDevice,
|
IN PCI_IO_DEVICE *PciIoDevice,
|
||||||
IN UINT16 *Command,
|
IN OUT UINT16 *Command,
|
||||||
IN UINT16 *BridgeControl,
|
IN OUT UINT16 *BridgeControl,
|
||||||
IN UINT16 *OldCommand,
|
OUT UINT16 *OldCommand,
|
||||||
IN UINT16 *OldBridgeControl
|
OUT UINT16 *OldBridgeControl
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_TPL OldTpl;
|
EFI_TPL OldTpl;
|
||||||
@ -733,20 +739,18 @@ PciTestSupportedAttribute (
|
|||||||
*OldBridgeControl = 0;
|
*OldBridgeControl = 0;
|
||||||
*BridgeControl = 0;
|
*BridgeControl = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Set the supported or current attributes of a PCI device
|
Set the supported or current attributes of a PCI device.
|
||||||
|
|
||||||
@param PciIoDevice - Structure pointer for PCI device.
|
@param PciIoDevice Structure pointer for PCI device.
|
||||||
@param Command - Command register value.
|
@param Command Command register value.
|
||||||
@param BridgeControl - Bridge control value for PPB or P2C.
|
@param BridgeControl Bridge control value for PPB or P2C.
|
||||||
@param Option - Make a choice of EFI_SET_SUPPORTS or EFI_SET_ATTRIBUTES.
|
@param Option Make a choice of EFI_SET_SUPPORTS or EFI_SET_ATTRIBUTES.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
VOID
|
||||||
PciSetDeviceAttribute (
|
PciSetDeviceAttribute (
|
||||||
IN PCI_IO_DEVICE *PciIoDevice,
|
IN PCI_IO_DEVICE *PciIoDevice,
|
||||||
IN UINT16 Command,
|
IN UINT16 Command,
|
||||||
@ -830,15 +834,17 @@ PciSetDeviceAttribute (
|
|||||||
} else {
|
} else {
|
||||||
PciIoDevice->Attributes = Attributes;
|
PciIoDevice->Attributes = Attributes;
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Determine if the device can support Fast Back to Back attribute.
|
Determine if the device can support Fast Back to Back attribute.
|
||||||
|
|
||||||
@param PciIoDevice Pci device instance.
|
@param PciIoDevice Pci device instance.
|
||||||
@param StatusIndex Status register value.
|
@param StatusIndex Status register value.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS This device support Fast Back to Back attribute.
|
||||||
|
@retval EFI_UNSUPPORTED This device doesn't support Fast Back to Back attribute.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
GetFastBackToBackSupport (
|
GetFastBackToBackSupport (
|
||||||
@ -867,7 +873,6 @@ GetFastBackToBackSupport (
|
|||||||
} else {
|
} else {
|
||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -875,10 +880,9 @@ GetFastBackToBackSupport (
|
|||||||
It can only be used after the first full Option ROM process.
|
It can only be used after the first full Option ROM process.
|
||||||
|
|
||||||
@param PciIoDevice Pci device instance.
|
@param PciIoDevice Pci device instance.
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success Operation.
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
VOID
|
||||||
ProcessOptionRomLight (
|
ProcessOptionRomLight (
|
||||||
IN PCI_IO_DEVICE *PciIoDevice
|
IN PCI_IO_DEVICE *PciIoDevice
|
||||||
)
|
)
|
||||||
@ -907,15 +911,13 @@ ProcessOptionRomLight (
|
|||||||
|
|
||||||
CurrentLink = CurrentLink->ForwardLink;
|
CurrentLink = CurrentLink->ForwardLink;
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Determine the related attributes of all devices under a Root Bridge
|
Determine the related attributes of all devices under a Root Bridge.
|
||||||
|
|
||||||
@param PciIoDevice PCI device instance.
|
@param PciIoDevice PCI device instance.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
DetermineDeviceAttribute (
|
DetermineDeviceAttribute (
|
||||||
@ -927,11 +929,6 @@ DetermineDeviceAttribute (
|
|||||||
UINT16 OldCommand;
|
UINT16 OldCommand;
|
||||||
UINT16 OldBridgeControl;
|
UINT16 OldBridgeControl;
|
||||||
BOOLEAN FastB2BSupport;
|
BOOLEAN FastB2BSupport;
|
||||||
|
|
||||||
/*
|
|
||||||
UINT8 IdePI;
|
|
||||||
EFI_PCI_IO_PROTOCOL *PciIo;
|
|
||||||
*/
|
|
||||||
PCI_IO_DEVICE *Temp;
|
PCI_IO_DEVICE *Temp;
|
||||||
LIST_ENTRY *CurrentLink;
|
LIST_ENTRY *CurrentLink;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
@ -982,38 +979,6 @@ DetermineDeviceAttribute (
|
|||||||
// Enable other supported attributes but not defined in PCI_IO_PROTOCOL
|
// Enable other supported attributes but not defined in PCI_IO_PROTOCOL
|
||||||
//
|
//
|
||||||
PCI_ENABLE_COMMAND_REGISTER (PciIoDevice, EFI_PCI_COMMAND_MEMORY_WRITE_AND_INVALIDATE);
|
PCI_ENABLE_COMMAND_REGISTER (PciIoDevice, EFI_PCI_COMMAND_MEMORY_WRITE_AND_INVALIDATE);
|
||||||
|
|
||||||
//
|
|
||||||
// Enable IDE native mode
|
|
||||||
//
|
|
||||||
/*
|
|
||||||
if (IS_PCI_IDE(&PciIoDevice->Pci)) {
|
|
||||||
|
|
||||||
PciIo = &PciIoDevice->PciIo;
|
|
||||||
|
|
||||||
PciIoRead (
|
|
||||||
PciIo,
|
|
||||||
EfiPciIoWidthUint8,
|
|
||||||
0x09,
|
|
||||||
1,
|
|
||||||
&IdePI
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Set native mode if it can be supported
|
|
||||||
//
|
|
||||||
IdePI |= (((IdePI & 0x0F) >> 1) & 0x05);
|
|
||||||
|
|
||||||
PciIoWrite (
|
|
||||||
PciIo,
|
|
||||||
EfiPciIoWidthUint8,
|
|
||||||
0x09,
|
|
||||||
1,
|
|
||||||
&IdePI
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FastB2BSupport = TRUE;
|
FastB2BSupport = TRUE;
|
||||||
@ -1082,10 +1047,14 @@ DetermineDeviceAttribute (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This routine is used to update the bar information for those incompatible PCI device
|
This routine is used to update the bar information for those incompatible PCI device.
|
||||||
|
|
||||||
@param PciIoDevice Pci device instance.
|
@param PciIoDevice Pci device instance.
|
||||||
@return EFI_UNSUPPORTED failed to update Pci Info.
|
|
||||||
|
@retval EFI_SUCCESS Successfully updated bar information.
|
||||||
|
@retval EFI_UNSUPPORTED Given PCI device doesn't belong to incompatible PCI device list.
|
||||||
|
@retval other Failed to check incompatibility device.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
UpdatePciInfo (
|
UpdatePciInfo (
|
||||||
@ -1227,21 +1196,21 @@ UpdatePciInfo (
|
|||||||
if (Configuration != NULL) {
|
if (Configuration != NULL) {
|
||||||
FreePool (Configuration);
|
FreePool (Configuration);
|
||||||
}
|
}
|
||||||
return Status;
|
|
||||||
|
|
||||||
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This routine will update the alignment with the new alignment
|
This routine will update the alignment with the new alignment.
|
||||||
|
|
||||||
@param Alignment old alignment.
|
@param Alignment Old alignment.
|
||||||
@param NewAlignment new alignment.
|
@param NewAlignment New alignment.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
SetNewAlign (
|
SetNewAlign (
|
||||||
IN UINT64 *Alignment,
|
IN UINT64 *Alignment,
|
||||||
IN UINT64 NewAlignment
|
IN UINT64 NewAlignment
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINT64 OldAlignment;
|
UINT64 OldAlignment;
|
||||||
@ -1302,13 +1271,14 @@ SetNewAlign (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Parse PCI bar bit.
|
Parse PCI bar information and fill them into PCI device instance.
|
||||||
|
|
||||||
@param PciIoDevice Pci device instance.
|
@param PciIoDevice Pci device instance.
|
||||||
@param Offset bar offset.
|
@param Offset Bar offset.
|
||||||
@param BarIndex bar index.
|
@param BarIndex Bar index.
|
||||||
|
|
||||||
@return next bar offset.
|
@return Next bar offset.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
UINTN
|
UINTN
|
||||||
PciParseBar (
|
PciParseBar (
|
||||||
@ -1490,13 +1460,15 @@ PciParseBar (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
This routine is used to initialize the bar of a PCI device.
|
This routine is used to initialize the bar of a PCI device.
|
||||||
It can be called typically when a device is going to be rejected.
|
|
||||||
|
|
||||||
@param PciIoDevice Pci device instance.
|
@param PciIoDevice Pci device instance.
|
||||||
|
|
||||||
|
@note It can be called typically when a device is going to be rejected.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
VOID
|
||||||
InitializePciDevice (
|
InitializePciDevice (
|
||||||
IN PCI_IO_DEVICE *PciIoDevice
|
IN PCI_IO_DEVICE *PciIoDevice
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_PCI_IO_PROTOCOL *PciIo;
|
EFI_PCI_IO_PROTOCOL *PciIo;
|
||||||
@ -1512,18 +1484,17 @@ InitializePciDevice (
|
|||||||
for (Offset = 0x10; Offset <= 0x24; Offset += sizeof (UINT32)) {
|
for (Offset = 0x10; Offset <= 0x24; Offset += sizeof (UINT32)) {
|
||||||
PciIoWrite (PciIo, EfiPciIoWidthUint32, Offset, 1, &gAllOne);
|
PciIoWrite (PciIo, EfiPciIoWidthUint32, Offset, 1, &gAllOne);
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Init PPB for bridge device
|
This routine is used to initialize the bar of a PCI-PCI Bridge device.
|
||||||
|
|
||||||
@param PciIoDevice Pci device instance.
|
@param PciIoDevice PCI-PCI bridge device instance.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
VOID
|
||||||
InitializePpb (
|
InitializePpb (
|
||||||
IN PCI_IO_DEVICE *PciIoDevice
|
IN PCI_IO_DEVICE *PciIoDevice
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_PCI_IO_PROTOCOL *PciIo;
|
EFI_PCI_IO_PROTOCOL *PciIo;
|
||||||
@ -1557,18 +1528,17 @@ InitializePpb (
|
|||||||
// Force Interrupt line to zero for cards that come up randomly
|
// Force Interrupt line to zero for cards that come up randomly
|
||||||
//
|
//
|
||||||
PciIoWrite (PciIo, EfiPciIoWidthUint8, 0x3C, 1, &gAllZero);
|
PciIoWrite (PciIo, EfiPciIoWidthUint8, 0x3C, 1, &gAllZero);
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Init private data for Hotplug bridge device
|
This routine is used to initialize the bar of a PCI Card Bridge device.
|
||||||
|
|
||||||
@param PciIoDevice hotplug bridge device.
|
@param PciIoDevice PCI Card bridge device.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
VOID
|
||||||
InitializeP2C (
|
InitializeP2C (
|
||||||
IN PCI_IO_DEVICE *PciIoDevice
|
IN PCI_IO_DEVICE *PciIoDevice
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_PCI_IO_PROTOCOL *PciIo;
|
EFI_PCI_IO_PROTOCOL *PciIo;
|
||||||
@ -1596,28 +1566,28 @@ InitializeP2C (
|
|||||||
// Force Interrupt line to zero for cards that come up randomly
|
// Force Interrupt line to zero for cards that come up randomly
|
||||||
//
|
//
|
||||||
PciIoWrite (PciIo, EfiPciIoWidthUint8, 0x3C, 1, &gAllZero);
|
PciIoWrite (PciIo, EfiPciIoWidthUint8, 0x3C, 1, &gAllZero);
|
||||||
return EFI_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Create and initiliaze general PCI I/O device instance for
|
Create and initiliaze general PCI I/O device instance for
|
||||||
PCI device/bridge device/hotplug bridge device.
|
PCI device/bridge device/hotplug bridge device.
|
||||||
|
|
||||||
@param PciRootBridgeIo Pointer to instance of EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
|
@param PciRootBridgeIo Pointer to instance of EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
|
||||||
@param Pci Pci bar block.
|
@param Pci Input Pci information block.
|
||||||
@param Bus device Bus NO.
|
@param Bus Device Bus NO.
|
||||||
@param Device device device NO.
|
@param Device Device device NO.
|
||||||
@param Func device func NO.
|
@param Func Device func NO.
|
||||||
|
|
||||||
@return instance of PCI device.
|
@return Instance of PCI device. NULL means no instance created.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
PCI_IO_DEVICE *
|
PCI_IO_DEVICE *
|
||||||
CreatePciIoDevice (
|
CreatePciIoDevice (
|
||||||
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,
|
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,
|
||||||
IN PCI_TYPE00 *Pci,
|
IN PCI_TYPE00 *Pci,
|
||||||
UINT8 Bus,
|
IN UINT8 Bus,
|
||||||
UINT8 Device,
|
IN UINT8 Device,
|
||||||
UINT8 Func
|
IN UINT8 Func
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
PCI_IO_DEVICE *PciIoDevice;
|
PCI_IO_DEVICE *PciIoDevice;
|
||||||
@ -1659,7 +1629,6 @@ CreatePciIoDevice (
|
|||||||
InitializePciDriverOverrideInstance (PciIoDevice);
|
InitializePciDriverOverrideInstance (PciIoDevice);
|
||||||
InitializePciLoadFile2 (PciIoDevice);
|
InitializePciLoadFile2 (PciIoDevice);
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Initialize the reserved resource list
|
// Initialize the reserved resource list
|
||||||
//
|
//
|
||||||
@ -1680,12 +1649,15 @@ CreatePciIoDevice (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
This routine is used to enumerate entire pci bus system
|
This routine is used to enumerate entire pci bus system
|
||||||
in a given platform
|
in a given platform.
|
||||||
|
|
||||||
It is only called on the second start on the same Root Bridge.
|
It is only called on the second start on the same Root Bridge.
|
||||||
|
|
||||||
@param Controller Parent bridge handler.
|
@param Controller Parent bridge handler.
|
||||||
|
|
||||||
@return status of operation.
|
@retval EFI_SUCCESS PCI enumeration finished successfully.
|
||||||
|
@retval other Some error occurred when enumerating the pci bus system.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
PciEnumeratorLight (
|
PciEnumeratorLight (
|
||||||
@ -1745,7 +1717,7 @@ PciEnumeratorLight (
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Record the root bridge io protocol
|
// Record the root bridgeio protocol
|
||||||
//
|
//
|
||||||
RootBridgeDev->PciRootBridgeIo = PciRootBridgeIo;
|
RootBridgeDev->PciRootBridgeIo = PciRootBridgeIo;
|
||||||
|
|
||||||
@ -1790,15 +1762,16 @@ PciEnumeratorLight (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get bus range.
|
Get bus range from PCI resource descriptor list.
|
||||||
|
|
||||||
@param Descriptors A pointer to the address space descriptor.
|
@param Descriptors A pointer to the address space descriptor.
|
||||||
@param MinBus The min bus.
|
@param MinBus The min bus returned.
|
||||||
@param MaxBus The max bus.
|
@param MaxBus The max bus returned.
|
||||||
@param BusRange The bus range.
|
@param BusRange The bus range returned.
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success operation.
|
@retval EFI_SUCCESS Successfully got bus range.
|
||||||
@retval EFI_NOT_FOUND can not find the specific bus.
|
@retval EFI_NOT_FOUND Can not find the specific bus.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
PciGetBusRange (
|
PciGetBusRange (
|
||||||
@ -1808,7 +1781,6 @@ PciGetBusRange (
|
|||||||
OUT UINT16 *BusRange
|
OUT UINT16 *BusRange
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
while ((*Descriptors)->Desc != ACPI_END_TAG_DESCRIPTOR) {
|
while ((*Descriptors)->Desc != ACPI_END_TAG_DESCRIPTOR) {
|
||||||
if ((*Descriptors)->ResType == ACPI_ADDRESS_SPACE_TYPE_BUS) {
|
if ((*Descriptors)->ResType == ACPI_ADDRESS_SPACE_TYPE_BUS) {
|
||||||
if (MinBus != NULL) {
|
if (MinBus != NULL) {
|
||||||
@ -1838,7 +1810,8 @@ PciGetBusRange (
|
|||||||
@param RootBridgeDev Pci device instance.
|
@param RootBridgeDev Pci device instance.
|
||||||
|
|
||||||
@retval EFI_SUCCESS This device started.
|
@retval EFI_SUCCESS This device started.
|
||||||
|
@retval other Failed to get PCI Root Bridge I/O protocol.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
StartManagingRootBridge (
|
StartManagingRootBridge (
|
||||||
@ -1852,8 +1825,8 @@ StartManagingRootBridge (
|
|||||||
//
|
//
|
||||||
// Get the root bridge handle
|
// Get the root bridge handle
|
||||||
//
|
//
|
||||||
RootBridgeHandle = RootBridgeDev->Handle;
|
RootBridgeHandle = RootBridgeDev->Handle;
|
||||||
PciRootBridgeIo = NULL;
|
PciRootBridgeIo = NULL;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get the pci root bridge io protocol
|
// Get the pci root bridge io protocol
|
||||||
@ -1881,13 +1854,13 @@ StartManagingRootBridge (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This routine can be used to check whether a PCI device should be rejected when light enumeration
|
This routine can be used to check whether a PCI device should be rejected when light enumeration.
|
||||||
|
|
||||||
@param PciIoDevice Pci device instance.
|
@param PciIoDevice Pci device instance.
|
||||||
|
|
||||||
@retval TRUE This device should be rejected.
|
@retval TRUE This device should be rejected.
|
||||||
@retval FALSE This device shouldn't be rejected.
|
@retval FALSE This device shouldn't be rejected.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
IsPciDeviceRejected (
|
IsPciDeviceRejected (
|
||||||
@ -1945,7 +1918,6 @@ IsPciDeviceRejected (
|
|||||||
//
|
//
|
||||||
// IO Bar
|
// IO Bar
|
||||||
//
|
//
|
||||||
|
|
||||||
Mask = 0xFFFFFFFC;
|
Mask = 0xFFFFFFFC;
|
||||||
TestValue = TestValue & Mask;
|
TestValue = TestValue & Mask;
|
||||||
if ((TestValue != 0) && (TestValue == (OldValue & Mask))) {
|
if ((TestValue != 0) && (TestValue == (OldValue & Mask))) {
|
||||||
@ -1957,7 +1929,6 @@ IsPciDeviceRejected (
|
|||||||
//
|
//
|
||||||
// Mem Bar
|
// Mem Bar
|
||||||
//
|
//
|
||||||
|
|
||||||
Mask = 0xFFFFFFF0;
|
Mask = 0xFFFFFFF0;
|
||||||
TestValue = TestValue & Mask;
|
TestValue = TestValue & Mask;
|
||||||
|
|
||||||
@ -1972,7 +1943,6 @@ IsPciDeviceRejected (
|
|||||||
//
|
//
|
||||||
// Test its high 32-Bit BAR
|
// Test its high 32-Bit BAR
|
||||||
//
|
//
|
||||||
|
|
||||||
Status = BarExisted (PciIoDevice, BarOffset, &TestValue, &OldValue);
|
Status = BarExisted (PciIoDevice, BarOffset, &TestValue, &OldValue);
|
||||||
if (TestValue == OldValue) {
|
if (TestValue == OldValue) {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -1995,12 +1965,13 @@ IsPciDeviceRejected (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Reset and all bus number from specific bridge.
|
Reset all bus number from specific bridge.
|
||||||
|
|
||||||
@param Bridge Parent specific bridge.
|
@param Bridge Parent specific bridge.
|
||||||
@param StartBusNumber start bus number.
|
@param StartBusNumber Start bus number.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
VOID
|
||||||
ResetAllPpbBusNumber (
|
ResetAllPpbBusNumber (
|
||||||
IN PCI_IO_DEVICE *Bridge,
|
IN PCI_IO_DEVICE *Bridge,
|
||||||
IN UINT8 StartBusNumber
|
IN UINT8 StartBusNumber
|
||||||
@ -2071,7 +2042,5 @@ ResetAllPpbBusNumber (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,64 +1,74 @@
|
|||||||
/** @file
|
/** @file
|
||||||
|
PCI emumeration support functions declaration for PCI Bus module.
|
||||||
|
|
||||||
Copyright (c) 2006, Intel Corporation
|
Copyright (c) 2006 - 2009, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
|
||||||
#ifndef _EFI_PCI_ENUMERATOR_SUPPORT_H_
|
#ifndef _EFI_PCI_ENUMERATOR_SUPPORT_H_
|
||||||
#define _EFI_PCI_ENUMERATOR_SUPPORT_H_
|
#define _EFI_PCI_ENUMERATOR_SUPPORT_H_
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This routine is used to check whether the pci device is present.
|
This routine is used to check whether the pci device is present.
|
||||||
|
|
||||||
@param PciRootBridgeIo Pointer to instance of EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL
|
@param PciRootBridgeIo Pointer to instance of EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
|
||||||
@param Pci Output buffer for PCI device structure
|
@param Pci Output buffer for PCI device configuration space.
|
||||||
@param Bus PCI bus NO
|
@param Bus PCI bus NO.
|
||||||
@param Device PCI device NO
|
@param Device PCI device NO.
|
||||||
@param Func PCI Func NO
|
@param Func PCI Func NO.
|
||||||
|
|
||||||
@retval EFI_NOT_FOUND device not present
|
@retval EFI_NOT_FOUND PCI device not present.
|
||||||
@retval EFI_SUCCESS device is found.
|
@retval EFI_SUCCESS PCI device is found.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
PciDevicePresent (
|
PciDevicePresent (
|
||||||
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,
|
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,
|
||||||
PCI_TYPE00 *Pci,
|
OUT PCI_TYPE00 *Pci,
|
||||||
UINT8 Bus,
|
IN UINT8 Bus,
|
||||||
UINT8 Device,
|
IN UINT8 Device,
|
||||||
UINT8 Func
|
IN UINT8 Func
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Collect all the resource information under this root bridge
|
Collect all the resource information under this root bridge.
|
||||||
|
|
||||||
A database that records all the information about pci device subject to this
|
A database that records all the information about pci device subject to this
|
||||||
root bridge will then be created.
|
root bridge will then be created.
|
||||||
|
|
||||||
@param Bridge Parent bridge instance
|
@param Bridge Parent bridge instance.
|
||||||
@param StartBusNumber Bus number of begining
|
@param StartBusNumber Bus number of begining.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS PCI device is found.
|
||||||
|
@retval other Some error occurred when reading PCI bridge information.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
PciPciDeviceInfoCollector (
|
PciPciDeviceInfoCollector (
|
||||||
IN PCI_IO_DEVICE *Bridge,
|
IN PCI_IO_DEVICE *Bridge,
|
||||||
UINT8 StartBusNumber
|
IN UINT8 StartBusNumber
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Seach required device and get PCI device info block
|
Seach required device and create PCI device instance.
|
||||||
|
|
||||||
@param Bridge Parent bridge instance
|
@param Bridge Parent bridge instance.
|
||||||
@param Pci Output of PCI device info block
|
@param Pci Input PCI device information block.
|
||||||
@param Bus PCI bus NO.
|
@param Bus PCI bus NO.
|
||||||
@param Device PCI device NO.
|
@param Device PCI device NO.
|
||||||
@param Func PCI func NO.
|
@param Func PCI func NO.
|
||||||
@param PciDevice output of searched PCI device instance
|
@param PciDevice Output of searched PCI device instance.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Successfully created PCI device instance.
|
||||||
|
@retval EFI_OUT_OF_RESOURCES Cannot get PCI device information.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
PciSearchDevice (
|
PciSearchDevice (
|
||||||
@ -71,129 +81,134 @@ PciSearchDevice (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Create PCI private data for PCI device
|
Create PCI device instance for PCI device.
|
||||||
|
|
||||||
@param Bridge Parent bridge instance
|
@param Bridge Parent bridge instance.
|
||||||
@param Pci PCI bar block
|
@param Pci Input PCI device information block.
|
||||||
@param Bus PCI device Bus NO.
|
@param Bus PCI device Bus NO.
|
||||||
@param Device PCI device DeviceNO.
|
@param Device PCI device Device NO.
|
||||||
@param Func PCI device's func NO.
|
@param Func PCI device's func NO.
|
||||||
|
|
||||||
@return new PCI device's private date structure.
|
@return Created PCI device instance.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
PCI_IO_DEVICE *
|
PCI_IO_DEVICE *
|
||||||
GatherDeviceInfo (
|
GatherDeviceInfo (
|
||||||
IN PCI_IO_DEVICE *Bridge,
|
IN PCI_IO_DEVICE *Bridge,
|
||||||
IN PCI_TYPE00 *Pci,
|
IN PCI_TYPE00 *Pci,
|
||||||
UINT8 Bus,
|
IN UINT8 Bus,
|
||||||
UINT8 Device,
|
IN UINT8 Device,
|
||||||
UINT8 Func
|
IN UINT8 Func
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Create private data for bridge device's PPB.
|
Create PCI device instance for PCI-PCI bridge.
|
||||||
|
|
||||||
@param Bridge Parent bridge
|
@param Bridge Parent bridge instance.
|
||||||
@param Pci Pci device block
|
@param Pci Input PCI device information block.
|
||||||
@param Bus Bridge device's bus NO.
|
@param Bus PCI device Bus NO.
|
||||||
@param Device Bridge device's device NO.
|
@param Device PCI device Device NO.
|
||||||
@param Func Bridge device's func NO.
|
@param Func PCI device's func NO.
|
||||||
|
|
||||||
@return bridge device instance.
|
@return Created PCI device instance.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
PCI_IO_DEVICE *
|
PCI_IO_DEVICE *
|
||||||
GatherPpbInfo (
|
GatherPpbInfo (
|
||||||
IN PCI_IO_DEVICE *Bridge,
|
IN PCI_IO_DEVICE *Bridge,
|
||||||
IN PCI_TYPE00 *Pci,
|
IN PCI_TYPE00 *Pci,
|
||||||
UINT8 Bus,
|
IN UINT8 Bus,
|
||||||
UINT8 Device,
|
IN UINT8 Device,
|
||||||
UINT8 Func
|
IN UINT8 Func
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Create private data for hotplug bridge device
|
Create PCI device instance for PCI Card bridge device.
|
||||||
|
|
||||||
@param Bridge Parent bridge instance
|
@param Bridge Parent bridge instance.
|
||||||
@param Pci PCI bar block
|
@param Pci Input PCI device information block.
|
||||||
@param Bus hotplug bridge device's bus NO.
|
@param Bus PCI device Bus NO.
|
||||||
@param Device hotplug bridge device's device NO.
|
@param Device PCI device Device NO.
|
||||||
@param Func hotplug bridge device's Func NO.
|
@param Func PCI device's func NO.
|
||||||
|
|
||||||
@return hotplug bridge device instance
|
@return Created PCI device instance.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
PCI_IO_DEVICE *
|
PCI_IO_DEVICE *
|
||||||
GatherP2CInfo (
|
GatherP2CInfo (
|
||||||
IN PCI_IO_DEVICE *Bridge,
|
IN PCI_IO_DEVICE *Bridge,
|
||||||
IN PCI_TYPE00 *Pci,
|
IN PCI_TYPE00 *Pci,
|
||||||
UINT8 Bus,
|
IN UINT8 Bus,
|
||||||
UINT8 Device,
|
IN UINT8 Device,
|
||||||
UINT8 Func
|
IN UINT8 Func
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Create device path for pci deivce
|
Create device path for pci deivce.
|
||||||
|
|
||||||
@param ParentDevicePath Parent bridge's path.
|
@param ParentDevicePath Parent bridge's path.
|
||||||
@param PciIoDevice Pci device instance.
|
@param PciIoDevice Pci device instance.
|
||||||
|
|
||||||
@return device path protocol instance for specific pci device.
|
@return device path protocol instance for specific pci device.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_DEVICE_PATH_PROTOCOL *
|
EFI_DEVICE_PATH_PROTOCOL *
|
||||||
CreatePciDevicePath (
|
CreatePciDevicePath (
|
||||||
IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath,
|
IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath,
|
||||||
IN PCI_IO_DEVICE *PciIoDevice
|
IN PCI_IO_DEVICE *PciIoDevice
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Check the bar is existed or not.
|
Check whether the bar is existed or not.
|
||||||
|
|
||||||
@param PciIoDevice - A pointer to the PCI_IO_DEVICE.
|
@param PciIoDevice A pointer to the PCI_IO_DEVICE.
|
||||||
@param Offset - The offset.
|
@param Offset The offset.
|
||||||
@param BarLengthValue - The bar length value.
|
@param BarLengthValue The bar length value returned.
|
||||||
@param OriginalBarValue - The original bar value.
|
@param OriginalBarValue The original bar value returned.
|
||||||
|
|
||||||
@retval EFI_NOT_FOUND - The bar don't exist.
|
@retval EFI_NOT_FOUND The bar doesn't exist.
|
||||||
@retval EFI_SUCCESS - The bar exist.
|
@retval EFI_SUCCESS The bar exist.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
BarExisted (
|
BarExisted (
|
||||||
IN PCI_IO_DEVICE *PciIoDevice,
|
IN PCI_IO_DEVICE *PciIoDevice,
|
||||||
IN UINTN Offset,
|
IN UINTN Offset,
|
||||||
OUT UINT32 *BarLengthValue,
|
OUT UINT32 *BarLengthValue,
|
||||||
OUT UINT32 *OriginalBarValue
|
OUT UINT32 *OriginalBarValue
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Test whether the device can support attributes
|
Test whether the device can support given attributes.
|
||||||
|
|
||||||
@param PciIoDevice Pci device instance
|
@param PciIoDevice Pci device instance.
|
||||||
@param Command Command register value.
|
@param Command Input command register value, and
|
||||||
@param BridgeControl Bridge control value for PPB or P2C.
|
returned supported register value.
|
||||||
@param OldCommand Old command register offset
|
@param BridgeControl Inout bridge control value for PPB or P2C, and
|
||||||
@param OldBridgeControl Old Bridge control value for PPB or P2C.
|
returned supported bridge control value.
|
||||||
|
@param OldCommand Returned and stored old command register offset.
|
||||||
@return EFI_SUCCESS.
|
@param OldBridgeControl Returned and stored old Bridge control value for PPB or P2C.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
VOID
|
||||||
PciTestSupportedAttribute (
|
PciTestSupportedAttribute (
|
||||||
IN PCI_IO_DEVICE *PciIoDevice,
|
IN PCI_IO_DEVICE *PciIoDevice,
|
||||||
IN UINT16 *Command,
|
IN OUT UINT16 *Command,
|
||||||
IN UINT16 *BridgeControl,
|
IN OUT UINT16 *BridgeControl,
|
||||||
IN UINT16 *OldCommand,
|
OUT UINT16 *OldCommand,
|
||||||
IN UINT16 *OldBridgeControl
|
OUT UINT16 *OldBridgeControl
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Set the supported or current attributes of a PCI device
|
Set the supported or current attributes of a PCI device.
|
||||||
|
|
||||||
@param PciIoDevice - Structure pointer for PCI device.
|
@param PciIoDevice Structure pointer for PCI device.
|
||||||
@param Command - Command register value.
|
@param Command Command register value.
|
||||||
@param BridgeControl - Bridge control value for PPB or P2C.
|
@param BridgeControl Bridge control value for PPB or P2C.
|
||||||
@param Option - Make a choice of EFI_SET_SUPPORTS or EFI_SET_ATTRIBUTES.
|
@param Option Make a choice of EFI_SET_SUPPORTS or EFI_SET_ATTRIBUTES.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
VOID
|
||||||
PciSetDeviceAttribute (
|
PciSetDeviceAttribute (
|
||||||
IN PCI_IO_DEVICE *PciIoDevice,
|
IN PCI_IO_DEVICE *PciIoDevice,
|
||||||
IN UINT16 Command,
|
IN UINT16 Command,
|
||||||
@ -202,10 +217,14 @@ PciSetDeviceAttribute (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Determine if the device can support Fast Back to Back attribute
|
Determine if the device can support Fast Back to Back attribute.
|
||||||
|
|
||||||
@param PciIoDevice Pci device instance.
|
@param PciIoDevice Pci device instance.
|
||||||
@param StatusIndex Status register value.
|
@param StatusIndex Status register value.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS This device support Fast Back to Back attribute.
|
||||||
|
@retval EFI_UNSUPPORTED This device doesn't support Fast Back to Back attribute.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
GetFastBackToBackSupport (
|
GetFastBackToBackSupport (
|
||||||
@ -214,10 +233,10 @@ GetFastBackToBackSupport (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Determine the related attributes of all devices under a Root Bridge
|
Determine the related attributes of all devices under a Root Bridge.
|
||||||
|
|
||||||
@param PciIoDevice PCI device instance.
|
@param PciIoDevice PCI device instance.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
DetermineDeviceAttribute (
|
DetermineDeviceAttribute (
|
||||||
@ -225,10 +244,14 @@ DetermineDeviceAttribute (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This routine is used to update the bar information for those incompatible PCI device
|
This routine is used to update the bar information for those incompatible PCI device.
|
||||||
|
|
||||||
@param PciIoDevice Pci device instance.
|
@param PciIoDevice Pci device instance.
|
||||||
@return EFI_UNSUPPORTED failed to update Pci Info.
|
|
||||||
|
@retval EFI_SUCCESS Successfully updated bar information.
|
||||||
|
@retval EFI_UNSUPPORTED Given PCI device doesn't belong to incompatible PCI device list.
|
||||||
|
@retval other Failed to check incompatibility device.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
UpdatePciInfo (
|
UpdatePciInfo (
|
||||||
@ -236,26 +259,27 @@ UpdatePciInfo (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This routine will update the alignment with the new alignment
|
This routine will update the alignment with the new alignment.
|
||||||
|
|
||||||
@param Alignment old alignment.
|
@param Alignment Old alignment.
|
||||||
@param NewAlignment new alignment.
|
@param NewAlignment New alignment.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
SetNewAlign (
|
SetNewAlign (
|
||||||
IN UINT64 *Alignment,
|
IN UINT64 *Alignment,
|
||||||
IN UINT64 NewAlignment
|
IN UINT64 NewAlignment
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Parse PCI bar bit.
|
Parse PCI bar information and fill them into PCI device instance.
|
||||||
|
|
||||||
@param PciIoDevice Pci device instance.
|
@param PciIoDevice Pci device instance.
|
||||||
@param Offset bar offset.
|
@param Offset Bar offset.
|
||||||
@param BarIndex bar index.
|
@param BarIndex Bar index.
|
||||||
|
|
||||||
@return next bar offset.
|
@return Next bar offset.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
UINTN
|
UINTN
|
||||||
PciParseBar (
|
PciParseBar (
|
||||||
@ -265,65 +289,73 @@ PciParseBar (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This routine is used to initialize the bar of a PCI device
|
This routine is used to initialize the bar of a PCI device.
|
||||||
It can be called typically when a device is going to be rejected.
|
|
||||||
|
|
||||||
@param PciIoDevice Pci device instance.
|
@param PciIoDevice Pci device instance.
|
||||||
|
|
||||||
|
@note It can be called typically when a device is going to be rejected.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
VOID
|
||||||
InitializePciDevice (
|
InitializePciDevice (
|
||||||
IN PCI_IO_DEVICE *PciIoDevice
|
IN PCI_IO_DEVICE *PciIoDevice
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Init PPB for bridge device
|
This routine is used to initialize the bar of a PCI-PCI Bridge device.
|
||||||
|
|
||||||
@param PciIoDevice Pci device instance.
|
@param PciIoDevice PCI-PCI bridge device instance.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
VOID
|
||||||
InitializePpb (
|
InitializePpb (
|
||||||
IN PCI_IO_DEVICE *PciIoDevice
|
IN PCI_IO_DEVICE *PciIoDevice
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Init private data for Hotplug bridge device
|
This routine is used to initialize the bar of a PCI Card Bridge device.
|
||||||
|
|
||||||
@param PciIoDevice hotplug bridge device.
|
@param PciIoDevice PCI Card bridge device.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
VOID
|
||||||
InitializeP2C (
|
InitializeP2C (
|
||||||
IN PCI_IO_DEVICE *PciIoDevice
|
IN PCI_IO_DEVICE *PciIoDevice
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Create and initiliaze general PCI I/O device instance for
|
Create and initiliaze general PCI I/O device instance for
|
||||||
PCI device/bridge device/hotplug bridge device.
|
PCI device/bridge device/hotplug bridge device.
|
||||||
|
|
||||||
@param PciRootBridgeIo Pointer to instance of EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
|
@param PciRootBridgeIo Pointer to instance of EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
|
||||||
@param Pci Pci bar block
|
@param Pci Input Pci information block.
|
||||||
@param Bus device Bus NO.
|
@param Bus Device Bus NO.
|
||||||
@param Device device device NO.
|
@param Device Device device NO.
|
||||||
@param Func device func NO.
|
@param Func Device func NO.
|
||||||
|
|
||||||
@return instance of PCI device.
|
@return Instance of PCI device. NULL means no instance created.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
PCI_IO_DEVICE *
|
PCI_IO_DEVICE *
|
||||||
CreatePciIoDevice (
|
CreatePciIoDevice (
|
||||||
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,
|
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,
|
||||||
IN PCI_TYPE00 *Pci,
|
IN PCI_TYPE00 *Pci,
|
||||||
UINT8 Bus,
|
IN UINT8 Bus,
|
||||||
UINT8 Device,
|
IN UINT8 Device,
|
||||||
UINT8 Func
|
IN UINT8 Func
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This routine is used to enumerate entire pci bus system
|
This routine is used to enumerate entire pci bus system
|
||||||
in a given platform
|
in a given platform.
|
||||||
|
|
||||||
It is only called on the second start on the same Root Bridge.
|
It is only called on the second start on the same Root Bridge.
|
||||||
|
|
||||||
@param Controller Parent bridge handler.
|
@param Controller Parent bridge handler.
|
||||||
|
|
||||||
@return status of operation.
|
@retval EFI_SUCCESS PCI enumeration finished successfully.
|
||||||
|
@retval other Some error occurred when enumerating the pci bus system.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
PciEnumeratorLight (
|
PciEnumeratorLight (
|
||||||
@ -331,15 +363,16 @@ PciEnumeratorLight (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get bus range.
|
Get bus range from PCI resource descriptor list.
|
||||||
|
|
||||||
@param Descriptors A pointer to the address space descriptor.
|
@param Descriptors A pointer to the address space descriptor.
|
||||||
@param MinBus The min bus.
|
@param MinBus The min bus returned.
|
||||||
@param MaxBus The max bus.
|
@param MaxBus The max bus returned.
|
||||||
@param BusRange The bus range.
|
@param BusRange The bus range returned.
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success operation.
|
@retval EFI_SUCCESS Successfully got bus range.
|
||||||
@retval EFI_NOT_FOUND can not find the specific bus.
|
@retval EFI_NOT_FOUND Can not find the specific bus.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
PciGetBusRange (
|
PciGetBusRange (
|
||||||
@ -355,7 +388,8 @@ PciGetBusRange (
|
|||||||
@param RootBridgeDev Pci device instance.
|
@param RootBridgeDev Pci device instance.
|
||||||
|
|
||||||
@retval EFI_SUCCESS This device started.
|
@retval EFI_SUCCESS This device started.
|
||||||
|
@retval other Failed to get PCI Root Bridge I/O protocol.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
StartManagingRootBridge (
|
StartManagingRootBridge (
|
||||||
@ -363,17 +397,30 @@ StartManagingRootBridge (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This routine can be used to check whether a PCI device should be rejected when light enumeration
|
This routine can be used to check whether a PCI device should be rejected when light enumeration.
|
||||||
|
|
||||||
@param PciIoDevice Pci device instance.
|
@param PciIoDevice Pci device instance.
|
||||||
|
|
||||||
@retval TRUE This device should be rejected.
|
@retval TRUE This device should be rejected.
|
||||||
@retval FALSE This device shouldn't be rejected.
|
@retval FALSE This device shouldn't be rejected.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
IsPciDeviceRejected (
|
IsPciDeviceRejected (
|
||||||
IN PCI_IO_DEVICE *PciIoDevice
|
IN PCI_IO_DEVICE *PciIoDevice
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Reset all bus number from specific bridge.
|
||||||
|
|
||||||
|
@param Bridge Parent specific bridge.
|
||||||
|
@param StartBusNumber Start bus number.
|
||||||
|
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
ResetAllPpbBusNumber (
|
||||||
|
IN PCI_IO_DEVICE *Bridge,
|
||||||
|
IN UINT8 StartBusNumber
|
||||||
|
);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,31 +1,31 @@
|
|||||||
/** @file
|
/** @file
|
||||||
This module provide support function for hot plug device.
|
PCI Hot Plug support functions implementation for PCI Bus module..
|
||||||
|
|
||||||
Copyright (c) 2006, Intel Corporation
|
Copyright (c) 2006 - 2009, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
|
||||||
#include "PciBus.h"
|
#include "PciBus.h"
|
||||||
#include "PciHotPlugSupport.h"
|
|
||||||
|
|
||||||
EFI_PCI_HOT_PLUG_INIT_PROTOCOL *gPciHotPlugInit;
|
EFI_PCI_HOT_PLUG_INIT_PROTOCOL *gPciHotPlugInit = NULL;
|
||||||
EFI_HPC_LOCATION *gPciRootHpcPool;
|
EFI_HPC_LOCATION *gPciRootHpcPool = NULL;
|
||||||
UINTN gPciRootHpcCount;
|
UINTN gPciRootHpcCount = 0;
|
||||||
ROOT_HPC_DATA *gPciRootHpcData;
|
ROOT_HPC_DATA *gPciRootHpcData = NULL;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Init HPC private data.
|
Event notification function to set Hot Plug controller status.
|
||||||
|
|
||||||
@param Event event object
|
@param Event The event that invoke this function.
|
||||||
@param Context HPC private data.
|
@param Context The calling context, pointer to ROOT_HPC_DATA.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
EFIAPI
|
EFIAPI
|
||||||
@ -34,21 +34,21 @@ PciHPCInitialized (
|
|||||||
IN VOID *Context
|
IN VOID *Context
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ROOT_HPC_DATA *HpcData;
|
ROOT_HPC_DATA *HpcData;
|
||||||
|
|
||||||
HpcData = (ROOT_HPC_DATA *) Context;
|
HpcData = (ROOT_HPC_DATA *) Context;
|
||||||
HpcData->Initialized = TRUE;
|
HpcData->Initialized = TRUE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Compare two device path
|
Compare two device pathes to check if they are exactly same.
|
||||||
|
|
||||||
@param DevicePath1 the first device path want to be compared.
|
@param DevicePath1 A pointer to the first device path data structure.
|
||||||
@param DevicePath2 the first device path want to be compared.
|
@param DevicePath2 A pointer to the second device path data structure.
|
||||||
|
|
||||||
@retval TRUE equal.
|
@retval TRUE They are same.
|
||||||
@retval FALSE different.
|
@retval FALSE They are not same.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
EfiCompareDevicePath (
|
EfiCompareDevicePath (
|
||||||
@ -74,8 +74,17 @@ EfiCompareDevicePath (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Init hot plug support and root hot plug private data.
|
Check hot plug support and initialize root hot plug private data.
|
||||||
|
|
||||||
|
If Hot Plug is supported by the platform, call PCI Hot Plug Init protocol
|
||||||
|
to get PCI Hot Plug controller's information and constructor the root hot plug
|
||||||
|
private data structure.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS They are same.
|
||||||
|
@retval EFI_UNSUPPORTED No PCI Hot Plug controler on the platform.
|
||||||
|
@retval EFI_OUT_OF_RESOURCES No memory to constructor root hot plug private
|
||||||
|
data structure.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
InitializeHotPlugSupport (
|
InitializeHotPlugSupport (
|
||||||
@ -92,13 +101,8 @@ InitializeHotPlugSupport (
|
|||||||
// hot plug controller supported on the platform
|
// hot plug controller supported on the platform
|
||||||
// the PCI Bus driver is running on. HotPlug Support
|
// the PCI Bus driver is running on. HotPlug Support
|
||||||
// is an optional feature, so absence of the protocol
|
// is an optional feature, so absence of the protocol
|
||||||
// won't incur the penalty
|
// won't incur the penalty.
|
||||||
//
|
//
|
||||||
gPciHotPlugInit = NULL;
|
|
||||||
gPciRootHpcPool = NULL;
|
|
||||||
gPciRootHpcCount = 0;
|
|
||||||
gPciRootHpcData = NULL;
|
|
||||||
|
|
||||||
Status = gBS->LocateProtocol (
|
Status = gBS->LocateProtocol (
|
||||||
&gEfiPciHotPlugInitProtocolGuid,
|
&gEfiPciHotPlugInitProtocolGuid,
|
||||||
NULL,
|
NULL,
|
||||||
@ -129,18 +133,20 @@ InitializeHotPlugSupport (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Test whether device path is for root pci hot plug bus
|
Test whether device path is for root pci hot plug bus.
|
||||||
|
|
||||||
@param HpbDevicePath tested device path.
|
@param HpbDevicePath A pointer to device path data structure to be tested.
|
||||||
@param HpIndex Return the index of root hot plug in global array.
|
@param HpIndex If HpIndex is not NULL, return the index of root hot
|
||||||
|
plug in global array when TRUE is retuned.
|
||||||
@retval TRUE device path is for root pci hot plug.
|
|
||||||
@retval FALSE device path is not for root pci hot plug.
|
@retval TRUE The device path is for root pci hot plug bus.
|
||||||
|
@retval FALSE The device path is not for root pci hot plug bus.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
IsRootPciHotPlugBus (
|
IsRootPciHotPlugBus (
|
||||||
IN EFI_DEVICE_PATH_PROTOCOL *HpbDevicePath,
|
IN EFI_DEVICE_PATH_PROTOCOL *HpbDevicePath,
|
||||||
OUT UINTN *HpIndex
|
OUT UINTN *HpIndex OPTIONAL
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINTN Index;
|
UINTN Index;
|
||||||
@ -161,13 +167,15 @@ IsRootPciHotPlugBus (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Test whether device path is for root pci hot plug controller
|
Test whether device path is for root pci hot plug controller.
|
||||||
|
|
||||||
@param HpcDevicePath tested device path.
|
@param HpbDevicePath A pointer to device path data structure to be tested.
|
||||||
@param HpIndex Return the index of root hot plug in global array.
|
@param HpIndex If HpIndex is not NULL, return the index of root hot
|
||||||
|
plug in global array when TRUE is retuned.
|
||||||
@retval TRUE device path is for root pci hot plug controller.
|
|
||||||
@retval FALSE device path is not for root pci hot plug controller.
|
@retval TRUE The device path is for root pci hot plug controller.
|
||||||
|
@retval FALSE The device path is not for root pci hot plug controller.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
IsRootPciHotPlugController (
|
IsRootPciHotPlugController (
|
||||||
@ -193,23 +201,24 @@ IsRootPciHotPlugController (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Wrapper for creating event object for HPC
|
Creating event object for PCI Hot Plug controller.
|
||||||
|
|
||||||
@param HpIndex index of hot plug device in global array.
|
@param HpIndex Index of hot plug device in global array.
|
||||||
@param Event event object.
|
@param Event The retuned event that invoke this function.
|
||||||
|
|
||||||
@return status of create event invoken.
|
@return Status of create event invoken.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
CreateEventForHpc (
|
CreateEventForHpc (
|
||||||
IN UINTN HpIndex,
|
IN UINTN HpIndex,
|
||||||
OUT EFI_EVENT *Event
|
OUT EFI_EVENT *Event
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
Status = gBS->CreateEvent (
|
Status = gBS->CreateEvent (
|
||||||
EVT_NOTIFY_SIGNAL,
|
EVT_NOTIFY_SIGNAL,
|
||||||
TPL_CALLBACK,
|
TPL_CALLBACK,
|
||||||
PciHPCInitialized,
|
PciHPCInitialized,
|
||||||
gPciRootHpcData + HpIndex,
|
gPciRootHpcData + HpIndex,
|
||||||
@ -224,9 +233,13 @@ CreateEventForHpc (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Wait for all root HPC initialized.
|
Wait for all root PCI Hot Plug controller finished initializing.
|
||||||
|
|
||||||
@param TimeoutInMicroSeconds microseconds to wait for all root hpc's initialization.
|
@param TimeoutInMicroSeconds Microseconds to wait for all root HPCs' initialization.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS All HPCs initialization finished.
|
||||||
|
@retval EFI_TIMEOUT Not ALL HPCs initialization finished in Microseconds.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
AllRootHPCInitialized (
|
AllRootHPCInitialized (
|
||||||
@ -237,8 +250,8 @@ AllRootHPCInitialized (
|
|||||||
UINTN Index;
|
UINTN Index;
|
||||||
|
|
||||||
Delay = (UINT32) ((TimeoutInMicroSeconds / 30) + 1);
|
Delay = (UINT32) ((TimeoutInMicroSeconds / 30) + 1);
|
||||||
do {
|
|
||||||
|
|
||||||
|
do {
|
||||||
for (Index = 0; Index < gPciRootHpcCount; Index++) {
|
for (Index = 0; Index < gPciRootHpcCount; Index++) {
|
||||||
|
|
||||||
if (!gPciRootHpcData[Index].Initialized) {
|
if (!gPciRootHpcData[Index].Initialized) {
|
||||||
@ -251,7 +264,7 @@ AllRootHPCInitialized (
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Stall for 30 us
|
// Stall for 30 microseconds..
|
||||||
//
|
//
|
||||||
gBS->Stall (30);
|
gBS->Stall (30);
|
||||||
|
|
||||||
@ -263,16 +276,17 @@ AllRootHPCInitialized (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Check HPC capability register block
|
Check whether PCI-PCI bridge has PCI Hot Plug capability register block.
|
||||||
|
|
||||||
@param PciIoDevice PCI device instance.
|
@param PciIoDevice A Pointer to the PCI-PCI bridge.
|
||||||
|
|
||||||
@retval EFI_SUCCESS PCI device is HPC.
|
@retval TRUE PCI device is HPC.
|
||||||
@retval EFI_NOT_FOUND PCI device is not HPC.
|
@retval FALSE PCI device is not HPC.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
BOOLEAN
|
||||||
IsSHPC (
|
IsSHPC (
|
||||||
PCI_IO_DEVICE *PciIoDevice
|
IN PCI_IO_DEVICE *PciIoDevice
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -280,7 +294,7 @@ IsSHPC (
|
|||||||
UINT8 Offset;
|
UINT8 Offset;
|
||||||
|
|
||||||
if (PciIoDevice == NULL) {
|
if (PciIoDevice == NULL) {
|
||||||
return EFI_NOT_FOUND;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Offset = 0;
|
Offset = 0;
|
||||||
@ -292,42 +306,26 @@ IsSHPC (
|
|||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// If the PPB has the hot plug controller build-in,
|
// If the PCI-PCI bridge has the hot plug controller build-in,
|
||||||
// then return TRUE;
|
// then return TRUE;
|
||||||
//
|
//
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
return EFI_SUCCESS;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_NOT_FOUND;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get resource padding for hot plug bus
|
Get resource padding if the specified PCI bridge is a hot plug bus.
|
||||||
|
|
||||||
@param PciIoDevice PCI device instance
|
@param PciIoDevice PCI bridge instance.
|
||||||
|
|
||||||
@retval EFI_SUCCESS success get padding and set it into PCI device instance
|
|
||||||
@retval EFI_NOT_FOUND PCI device is not a hot plug bus.
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
VOID
|
||||||
GetResourcePaddingForHpb (
|
GetResourcePaddingForHpb (
|
||||||
IN PCI_IO_DEVICE *PciIoDevice
|
IN PCI_IO_DEVICE *PciIoDevice
|
||||||
)
|
)
|
||||||
/**
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
None
|
|
||||||
|
|
||||||
**/
|
|
||||||
// TODO: PciIoDevice - add argument and description to function comment
|
|
||||||
// TODO: EFI_SUCCESS - add return value to function comment
|
|
||||||
// TODO: EFI_NOT_FOUND - add return value to function comment
|
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_HPC_STATE State;
|
EFI_HPC_STATE State;
|
||||||
@ -335,9 +333,10 @@ Returns:
|
|||||||
EFI_HPC_PADDING_ATTRIBUTES Attributes;
|
EFI_HPC_PADDING_ATTRIBUTES Attributes;
|
||||||
EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Descriptors;
|
EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Descriptors;
|
||||||
|
|
||||||
Status = IsPciHotPlugBus (PciIoDevice);
|
if (IsPciHotPlugBus (PciIoDevice)) {
|
||||||
|
//
|
||||||
if (!EFI_ERROR (Status)) {
|
// If PCI-PCI bridge device is PCI Hot Plug bus.
|
||||||
|
//
|
||||||
PciAddress = EFI_PCI_ADDRESS (PciIoDevice->BusNumber, PciIoDevice->DeviceNumber, PciIoDevice->FunctionNumber, 0);
|
PciAddress = EFI_PCI_ADDRESS (PciIoDevice->BusNumber, PciIoDevice->DeviceNumber, PciIoDevice->FunctionNumber, 0);
|
||||||
Status = gPciHotPlugInit->GetResourcePadding (
|
Status = gPciHotPlugInit->GetResourcePadding (
|
||||||
gPciHotPlugInit,
|
gPciHotPlugInit,
|
||||||
@ -349,7 +348,7 @@ Returns:
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((State & EFI_HPC_STATE_ENABLED) != 0 && (State & EFI_HPC_STATE_INITIALIZED) != 0) {
|
if ((State & EFI_HPC_STATE_ENABLED) != 0 && (State & EFI_HPC_STATE_INITIALIZED) != 0) {
|
||||||
@ -357,47 +356,39 @@ Returns:
|
|||||||
PciIoDevice->PaddingAttributes = Attributes;
|
PciIoDevice->PaddingAttributes = Attributes;
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_NOT_FOUND;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Test whether PCI device is hot plug bus.
|
Test whether PCI device is hot plug bus.
|
||||||
|
|
||||||
@param PciIoDevice PCI device instance.
|
@param PciIoDevice PCI device instance.
|
||||||
|
|
||||||
@retval EFI_SUCCESS PCI device is hot plug bus.
|
@retval TRUE PCI device is a hot plug bus.
|
||||||
@retval EFI_NOT_FOUND PCI device is not hot plug bus.
|
@retval FALSE PCI device is not a hot plug bus.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
BOOLEAN
|
||||||
IsPciHotPlugBus (
|
IsPciHotPlugBus (
|
||||||
PCI_IO_DEVICE *PciIoDevice
|
PCI_IO_DEVICE *PciIoDevice
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
BOOLEAN Result;
|
if (IsSHPC (PciIoDevice)) {
|
||||||
EFI_STATUS Status;
|
//
|
||||||
|
// If the PPB has the hot plug controller build-in,
|
||||||
Status = IsSHPC (PciIoDevice);
|
// then return TRUE;
|
||||||
|
//
|
||||||
//
|
return TRUE;
|
||||||
// If the PPB has the hot plug controller build-in,
|
|
||||||
// then return TRUE;
|
|
||||||
//
|
|
||||||
if (!EFI_ERROR (Status)) {
|
|
||||||
return EFI_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Otherwise, see if it is a Root HPC
|
// Otherwise, see if it is a Root HPC
|
||||||
//
|
//
|
||||||
Result = IsRootPciHotPlugBus (PciIoDevice->DevicePath, NULL);
|
if(IsRootPciHotPlugBus (PciIoDevice->DevicePath, NULL)) {
|
||||||
|
return TRUE;
|
||||||
if (Result) {
|
|
||||||
return EFI_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_NOT_FOUND;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,42 +1,47 @@
|
|||||||
/** @file
|
/** @file
|
||||||
|
PCI Hot Plug support functions declaration for PCI Bus module.
|
||||||
|
|
||||||
Copyright (c) 2006, Intel Corporation
|
Copyright (c) 2006 - 2009, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
|
||||||
#ifndef _EFI_PCI_HOT_PLUG_SUPPORT_H_
|
#ifndef _EFI_PCI_HOT_PLUG_SUPPORT_H_
|
||||||
#define _EFI_PCI_HOT_PLUG_SUPPORT_H_
|
#define _EFI_PCI_HOT_PLUG_SUPPORT_H_
|
||||||
|
|
||||||
|
//
|
||||||
|
// stall 1 second, its unit is 100ns
|
||||||
|
//
|
||||||
|
#define STALL_1_SECOND 1000000
|
||||||
|
|
||||||
//
|
//
|
||||||
// stall 1 second
|
// PCI Hot Plug controller private data
|
||||||
//
|
//
|
||||||
#define STALL_1_SECOND 1000000
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
EFI_EVENT Event;
|
EFI_EVENT Event;
|
||||||
BOOLEAN Initialized;
|
BOOLEAN Initialized;
|
||||||
VOID *Padding;
|
VOID *Padding;
|
||||||
} ROOT_HPC_DATA;
|
} ROOT_HPC_DATA;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Reference of some global variabes
|
||||||
|
//
|
||||||
extern EFI_PCI_HOT_PLUG_INIT_PROTOCOL *gPciHotPlugInit;
|
extern EFI_PCI_HOT_PLUG_INIT_PROTOCOL *gPciHotPlugInit;
|
||||||
extern EFI_HPC_LOCATION *gPciRootHpcPool;
|
extern EFI_HPC_LOCATION *gPciRootHpcPool;
|
||||||
extern UINTN gPciRootHpcCount;
|
|
||||||
extern ROOT_HPC_DATA *gPciRootHpcData;
|
extern ROOT_HPC_DATA *gPciRootHpcData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Init HPC private data.
|
Event notification function to set Hot Plug controller status.
|
||||||
|
|
||||||
@param Event event object
|
@param Event The event that invoke this function.
|
||||||
@param Context HPC private data.
|
@param Context The calling context, pointer to ROOT_HPC_DATA.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
EFIAPI
|
EFIAPI
|
||||||
@ -46,13 +51,14 @@ PciHPCInitialized (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Compare two device path
|
Compare two device pathes to check if they are exactly same.
|
||||||
|
|
||||||
@param DevicePath1 the first device path want to be compared.
|
@param DevicePath1 A pointer to the first device path data structure.
|
||||||
@param DevicePath2 the first device path want to be compared.
|
@param DevicePath2 A pointer to the second device path data structure.
|
||||||
|
|
||||||
@retval TRUE equal.
|
@retval TRUE They are same.
|
||||||
@retval FALSE different.
|
@retval FALSE They are not same.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
EfiCompareDevicePath (
|
EfiCompareDevicePath (
|
||||||
@ -61,8 +67,17 @@ EfiCompareDevicePath (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Init hot plug support and root hot plug private data.
|
Check hot plug support and initialize root hot plug private data.
|
||||||
|
|
||||||
|
If Hot Plug is supported by the platform, call PCI Hot Plug Init protocol
|
||||||
|
to get PCI Hot Plug controller's information and constructor the root hot plug
|
||||||
|
private data structure.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS They are same.
|
||||||
|
@retval EFI_UNSUPPORTED No PCI Hot Plug controler on the platform.
|
||||||
|
@retval EFI_OUT_OF_RESOURCES No memory to constructor root hot plug private
|
||||||
|
data structure.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
InitializeHotPlugSupport (
|
InitializeHotPlugSupport (
|
||||||
@ -71,40 +86,45 @@ InitializeHotPlugSupport (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Test whether PCI device is hot plug bus.
|
Test whether PCI device is hot plug bus.
|
||||||
|
|
||||||
@param PciIoDevice PCI device instance.
|
@param PciIoDevice PCI device instance.
|
||||||
|
|
||||||
@retval EFI_SUCCESS PCI device is hot plug bus.
|
@retval TRUE PCI device is a hot plug bus.
|
||||||
@retval EFI_NOT_FOUND PCI device is not hot plug bus.
|
@retval FALSE PCI device is not a hot plug bus.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
BOOLEAN
|
||||||
IsPciHotPlugBus (
|
IsPciHotPlugBus (
|
||||||
PCI_IO_DEVICE *PciIoDevice
|
PCI_IO_DEVICE *PciIoDevice
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Test whether device path is for root pci hot plug bus
|
Test whether device path is for root pci hot plug bus.
|
||||||
|
|
||||||
@param HpbDevicePath tested device path
|
@param HpbDevicePath A pointer to device path data structure to be tested.
|
||||||
@param HpIndex Return the index of root hot plug in global array.
|
@param HpIndex If HpIndex is not NULL, return the index of root hot
|
||||||
|
plug in global array when TRUE is retuned.
|
||||||
@retval TRUE device path is for root pci hot plug
|
|
||||||
@retval FALSE device path is not for root pci hot plug
|
@retval TRUE The device path is for root pci hot plug bus.
|
||||||
|
@retval FALSE The device path is not for root pci hot plug bus.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
IsRootPciHotPlugBus (
|
IsRootPciHotPlugBus (
|
||||||
IN EFI_DEVICE_PATH_PROTOCOL *HpbDevicePath,
|
IN EFI_DEVICE_PATH_PROTOCOL *HpbDevicePath,
|
||||||
OUT UINTN *HpIndex
|
OUT UINTN *HpIndex OPTIONAL
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Test whether device path is for root pci hot plug controller
|
Test whether device path is for root pci hot plug controller.
|
||||||
|
|
||||||
@param HpcDevicePath tested device path.
|
@param HpbDevicePath A pointer to device path data structure to be tested.
|
||||||
@param HpIndex Return the index of root hot plug in global array.
|
@param HpIndex If HpIndex is not NULL, return the index of root hot
|
||||||
|
plug in global array when TRUE is retuned.
|
||||||
@retval TRUE device path is for root pci hot plug controller.
|
|
||||||
@retval FALSE device path is not for root pci hot plug controller.
|
@retval TRUE The device path is for root pci hot plug controller.
|
||||||
|
@retval FALSE The device path is not for root pci hot plug controller.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
IsRootPciHotPlugController (
|
IsRootPciHotPlugController (
|
||||||
@ -113,23 +133,28 @@ IsRootPciHotPlugController (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Wrapper for creating event object for HPC
|
Creating event object for PCI Hot Plug controller.
|
||||||
|
|
||||||
@param HpIndex index of hot plug device in global array.
|
@param HpIndex Index of hot plug device in global array.
|
||||||
@param Event event object.
|
@param Event The retuned event that invoke this function.
|
||||||
|
|
||||||
@return status of create event invoken.
|
@return Status of create event invoken.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
CreateEventForHpc (
|
CreateEventForHpc (
|
||||||
IN UINTN HpIndex,
|
IN UINTN HpIndex,
|
||||||
OUT EFI_EVENT *Event
|
OUT EFI_EVENT *Event
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Wait for all root HPC initialized.
|
Wait for all root PCI Hot Plug controller finished initializing.
|
||||||
|
|
||||||
@param TimeoutInMicroSeconds microseconds to wait for all root hpc's initialization.
|
@param TimeoutInMicroSeconds Microseconds to wait for all root HPCs' initialization.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS All HPCs initialization finished.
|
||||||
|
@retval EFI_TIMEOUT Not ALL HPCs initialization finished in Microseconds.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
AllRootHPCInitialized (
|
AllRootHPCInitialized (
|
||||||
@ -137,29 +162,28 @@ AllRootHPCInitialized (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Check HPC capability register block
|
Check whether PCI-PCI bridge has PCI Hot Plug capability register block.
|
||||||
|
|
||||||
@param PciIoDevice PCI device instance.
|
@param PciIoDevice A Pointer to the PCI-PCI bridge.
|
||||||
|
|
||||||
@retval EFI_SUCCESS PCI device is HPC.
|
@retval TRUE PCI device is HPC.
|
||||||
@retval EFI_NOT_FOUND PCI device is not HPC.
|
@retval FALSE PCI device is not HPC.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
BOOLEAN
|
||||||
IsSHPC (
|
IsSHPC (
|
||||||
PCI_IO_DEVICE *PciIoDevice
|
IN PCI_IO_DEVICE *PciIoDevice
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get resource padding for hot plug bus
|
Get resource padding if the specified PCI bridge is a hot plug bus.
|
||||||
|
|
||||||
@param PciIoDevice PCI device instance.
|
@param PciIoDevice PCI bridge instance.
|
||||||
|
|
||||||
@retval EFI_SUCCESS success get padding and set it into PCI device instance.
|
|
||||||
@retval EFI_NOT_FOUND PCI device is not a hot plug bus.
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
VOID
|
||||||
GetResourcePaddingForHpb (
|
GetResourcePaddingForHpb (
|
||||||
IN PCI_IO_DEVICE *PciIoDevice
|
IN PCI_IO_DEVICE *PciIoDevice
|
||||||
);
|
);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,94 +1,98 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Header file of EFI PCI IO protocol.
|
EFI PCI IO protocol functions declaration for PCI Bus module.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2009, Intel Corporation
|
Copyright (c) 2006 - 2009, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
|
||||||
#ifndef _EFI_PCI_IO_PROTOCOL_H_
|
#ifndef _EFI_PCI_IO_PROTOCOL_H_
|
||||||
#define _EFI_PCI_IO_PROTOCOL_H_
|
#define _EFI_PCI_IO_PROTOCOL_H_
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Initializes a PCI I/O Instance.
|
Initializes a PCI I/O Instance.
|
||||||
|
|
||||||
@param PciIoDevice Pci device instance.
|
@param PciIoDevice Pci device instance.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
InitializePciIoInstance (
|
InitializePciIoInstance (
|
||||||
PCI_IO_DEVICE *PciIoDevice
|
IN PCI_IO_DEVICE *PciIoDevice
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Verifies access to a PCI Base Address Register (BAR)
|
Verifies access to a PCI Base Address Register (BAR).
|
||||||
|
|
||||||
@param PciIoDevice Pci device instance
|
@param PciIoDevice Pci device instance.
|
||||||
@param BarIndex The BAR index of the standard PCI Configuration header to use as the
|
@param BarIndex The BAR index of the standard PCI Configuration header to use as the
|
||||||
base address for the memory or I/O operation to perform.
|
base address for the memory or I/O operation to perform.
|
||||||
@param Type Operation type could be memory or I/O
|
@param Type Operation type could be memory or I/O.
|
||||||
@param Width Signifies the width of the memory or I/O operations.
|
@param Width Signifies the width of the memory or I/O operations.
|
||||||
@param Count The number of memory or I/O operations to perform.
|
@param Count The number of memory or I/O operations to perform.
|
||||||
@param Offset The offset within the PCI configuration space for the PCI controller.
|
@param Offset The offset within the PCI configuration space for the PCI controller.
|
||||||
|
|
||||||
@retval EFI_INVALID_PARAMETER Invalid Width/BarIndex or Bar type.
|
@retval EFI_INVALID_PARAMETER Invalid Width/BarIndex or Bar type.
|
||||||
@retval EFI_SUCCESS Success Operation.
|
@retval EFI_SUCCESS Successfully verified.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
PciIoVerifyBarAccess (
|
PciIoVerifyBarAccess (
|
||||||
PCI_IO_DEVICE *PciIoDevice,
|
IN PCI_IO_DEVICE *PciIoDevice,
|
||||||
UINT8 BarIndex,
|
IN UINT8 BarIndex,
|
||||||
PCI_BAR_TYPE Type,
|
IN PCI_BAR_TYPE Type,
|
||||||
IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
|
IN IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
|
||||||
IN UINTN Count,
|
IN IN UINTN Count,
|
||||||
UINT64 *Offset
|
IN UINT64 *Offset
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Verifies access to a PCI Config Header
|
Verifies access to a PCI Configuration Header.
|
||||||
|
|
||||||
@param PciIoDevice Pci device instance
|
@param PciIoDevice Pci device instance.
|
||||||
@param Width Signifies the width of the memory or I/O operations.
|
@param Width Signifies the width of the memory or I/O operations.
|
||||||
@param Count The number of memory or I/O operations to perform.
|
@param Count The number of memory or I/O operations to perform.
|
||||||
@param Offset The offset within the PCI configuration space for the PCI controller.
|
@param Offset The offset within the PCI configuration space for the PCI controller.
|
||||||
|
|
||||||
@retval EFI_INVALID_PARAMETER Invalid Width.
|
@retval EFI_INVALID_PARAMETER Invalid Width
|
||||||
@retval EFI_UNSUPPORTED Offset overflow.
|
@retval EFI_UNSUPPORTED Offset overflowed.
|
||||||
@retval EFI_SUCCESS Success operation.
|
@retval EFI_SUCCESS Successfully verified.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
PciIoVerifyConfigAccess (
|
PciIoVerifyConfigAccess (
|
||||||
PCI_IO_DEVICE *PciIoDevice,
|
IN PCI_IO_DEVICE *PciIoDevice,
|
||||||
IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
|
IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
|
||||||
IN UINTN Count,
|
IN UINTN Count,
|
||||||
IN UINT64 *Offset
|
IN UINT64 *Offset
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Reads from the I/O space of a PCI Root Bridge. Returns when either the polling exit criteria is
|
Reads from the memory space of a PCI controller. Returns either when the polling exit criteria is
|
||||||
satisfied or after a defined duration.
|
satisfied or after a defined duration.
|
||||||
|
|
||||||
@param This Pointer to protocol instance of EFI_PCI_IO_PROTOCOL
|
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
|
||||||
@param Width Signifies the width of the memory or I/O operations.
|
@param Width Signifies the width of the memory or I/O operations.
|
||||||
@param BarIndex The BAR index of the standard PCI Configuration header to use as the
|
@param BarIndex The BAR index of the standard PCI Configuration header to use as the
|
||||||
base address for the memory or I/O operation to perform.
|
base address for the memory operation to perform.
|
||||||
@param Offset The offset within the PCI configuration space for the PCI controller.
|
@param Offset The offset within the selected BAR to start the memory operation.
|
||||||
@param Mask Mask used for the polling criteria.
|
@param Mask Mask used for the polling criteria.
|
||||||
@param Value The comparison value used for the polling exit criteria.
|
@param Value The comparison value used for the polling exit criteria.
|
||||||
@param Delay The number of 100 ns units to poll.
|
@param Delay The number of 100 ns units to poll.
|
||||||
@param Result Pointer to the last value read from the memory location.
|
@param Result Pointer to the last value read from the memory location.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The last data returned from the access matched the poll exit criteria.
|
@retval EFI_SUCCESS The last data returned from the access matched the poll exit criteria.
|
||||||
|
@retval EFI_UNSUPPORTED BarIndex not valid for this PCI controller.
|
||||||
|
@retval EFI_UNSUPPORTED Offset is not valid for the BarIndex of this PCI controller.
|
||||||
@retval EFI_TIMEOUT Delay expired before a match occurred.
|
@retval EFI_TIMEOUT Delay expired before a match occurred.
|
||||||
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
|
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
|
||||||
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
|
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
@ -103,25 +107,27 @@ PciIoPollMem (
|
|||||||
OUT UINT64 *Result
|
OUT UINT64 *Result
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Reads from the I/O space of a PCI Root Bridge. Returns when either the polling exit criteria is
|
Reads from the memory space of a PCI controller. Returns either when the polling exit criteria is
|
||||||
satisfied or after a defined duration.
|
satisfied or after a defined duration.
|
||||||
|
|
||||||
@param This A pointer to the EFI_PCI_IO_PROTOCOL.
|
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
|
||||||
@param Width Signifies the width of the memory or I/O operations.
|
@param Width Signifies the width of the memory or I/O operations.
|
||||||
@param BarIndex The BAR index of the standard PCI Configuration header to use as the
|
@param BarIndex The BAR index of the standard PCI Configuration header to use as the
|
||||||
base address for the memory or I/O operation to perform.
|
base address for the memory operation to perform.
|
||||||
@param Offset The offset within the selected BAR to start the memory or I/O operation.
|
@param Offset The offset within the selected BAR to start the memory operation.
|
||||||
@param Mask Mask used for the polling criteria.
|
@param Mask Mask used for the polling criteria.
|
||||||
@param Value The comparison value used for the polling exit criteria.
|
@param Value The comparison value used for the polling exit criteria.
|
||||||
@param Delay The number of 100 ns units to poll.
|
@param Delay The number of 100 ns units to poll.
|
||||||
@param Result Pointer to the last value read from the memory location.
|
@param Result Pointer to the last value read from the memory location.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The last data returned from the access matched the poll exit criteria.
|
@retval EFI_SUCCESS The last data returned from the access matched the poll exit criteria.
|
||||||
|
@retval EFI_UNSUPPORTED BarIndex not valid for this PCI controller.
|
||||||
|
@retval EFI_UNSUPPORTED Offset is not valid for the BarIndex of this PCI controller.
|
||||||
@retval EFI_TIMEOUT Delay expired before a match occurred.
|
@retval EFI_TIMEOUT Delay expired before a match occurred.
|
||||||
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
|
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
|
||||||
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
|
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
@ -136,25 +142,25 @@ PciIoPollIo (
|
|||||||
OUT UINT64 *Result
|
OUT UINT64 *Result
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Enable a PCI driver to access PCI controller registers in the PCI memory or I/O space.
|
Enable a PCI driver to access PCI controller registers in the PCI memory or I/O space.
|
||||||
|
|
||||||
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
|
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
|
||||||
@param Width Signifies the width of the memory or I/O operations.
|
@param Width Signifies the width of the memory or I/O operations.
|
||||||
@param BarIndex The BAR index of the standard PCI Configuration header to use as the
|
@param BarIndex The BAR index of the standard PCI Configuration header to use as the
|
||||||
base address for the memory or I/O operation to perform.
|
base address for the memory or I/O operation to perform.
|
||||||
@param Offset The offset within the selected BAR to start the memory or I/O operation.
|
@param Offset The offset within the selected BAR to start the memory or I/O operation.
|
||||||
@param Count The number of memory or I/O operations to perform.
|
@param Count The number of memory or I/O operations to perform.
|
||||||
@param Buffer For read operations, the destination buffer to store the results. For write
|
@param Buffer For read operations, the destination buffer to store the results. For write
|
||||||
operations, the source buffer to write data from.
|
operations, the source buffer to write data from.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The data was read from or written to the PCI controller.
|
@retval EFI_SUCCESS The data was read from or written to the PCI controller.
|
||||||
@retval EFI_UNSUPPORTED BarIndex not valid for this PCI controller.
|
@retval EFI_UNSUPPORTED BarIndex not valid for this PCI controller.
|
||||||
@retval EFI_UNSUPPORTED The address range specified by Offset, Width, and Count is not
|
@retval EFI_UNSUPPORTED The address range specified by Offset, Width, and Count is not
|
||||||
valid for the PCI BAR specified by BarIndex.
|
valid for the PCI BAR specified by BarIndex.
|
||||||
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
|
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
|
||||||
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
|
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
@ -167,25 +173,25 @@ PciIoMemRead (
|
|||||||
IN OUT VOID *Buffer
|
IN OUT VOID *Buffer
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Enable a PCI driver to access PCI controller registers in the PCI memory or I/O space.
|
Enable a PCI driver to access PCI controller registers in the PCI memory or I/O space.
|
||||||
|
|
||||||
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
|
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
|
||||||
@param Width Signifies the width of the memory or I/O operations.
|
@param Width Signifies the width of the memory or I/O operations.
|
||||||
@param BarIndex The BAR index of the standard PCI Configuration header to use as the
|
@param BarIndex The BAR index of the standard PCI Configuration header to use as the
|
||||||
base address for the memory or I/O operation to perform.
|
base address for the memory or I/O operation to perform.
|
||||||
@param Offset The offset within the selected BAR to start the memory or I/O operation.
|
@param Offset The offset within the selected BAR to start the memory or I/O operation.
|
||||||
@param Count The number of memory or I/O operations to perform.
|
@param Count The number of memory or I/O operations to perform.
|
||||||
@param Buffer For read operations, the destination buffer to store the results. For write
|
@param Buffer For read operations, the destination buffer to store the results. For write
|
||||||
operations, the source buffer to write data from.
|
operations, the source buffer to write data from.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The data was read from or written to the PCI controller.
|
@retval EFI_SUCCESS The data was read from or written to the PCI controller.
|
||||||
@retval EFI_UNSUPPORTED BarIndex not valid for this PCI controller.
|
@retval EFI_UNSUPPORTED BarIndex not valid for this PCI controller.
|
||||||
@retval EFI_UNSUPPORTED The address range specified by Offset, Width, and Count is not
|
@retval EFI_UNSUPPORTED The address range specified by Offset, Width, and Count is not
|
||||||
valid for the PCI BAR specified by BarIndex.
|
valid for the PCI BAR specified by BarIndex.
|
||||||
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
|
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
|
||||||
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
|
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
@ -198,25 +204,25 @@ PciIoMemWrite (
|
|||||||
IN OUT VOID *Buffer
|
IN OUT VOID *Buffer
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Enable a PCI driver to access PCI controller registers in the PCI memory or I/O space.
|
Enable a PCI driver to access PCI controller registers in the PCI memory or I/O space.
|
||||||
|
|
||||||
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
|
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
|
||||||
@param Width Signifies the width of the memory or I/O operations.
|
@param Width Signifies the width of the memory or I/O operations.
|
||||||
@param BarIndex The BAR index of the standard PCI Configuration header to use as the
|
@param BarIndex The BAR index of the standard PCI Configuration header to use as the
|
||||||
base address for the memory or I/O operation to perform.
|
base address for the memory or I/O operation to perform.
|
||||||
@param Offset The offset within the selected BAR to start the memory or I/O operation.
|
@param Offset The offset within the selected BAR to start the memory or I/O operation.
|
||||||
@param Count The number of memory or I/O operations to perform.
|
@param Count The number of memory or I/O operations to perform.
|
||||||
@param Buffer For read operations, the destination buffer to store the results. For write
|
@param Buffer For read operations, the destination buffer to store the results. For write
|
||||||
operations, the source buffer to write data from.
|
operations, the source buffer to write data from.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The data was read from or written to the PCI controller.
|
@retval EFI_SUCCESS The data was read from or written to the PCI controller.
|
||||||
@retval EFI_UNSUPPORTED BarIndex not valid for this PCI controller.
|
@retval EFI_UNSUPPORTED BarIndex not valid for this PCI controller.
|
||||||
@retval EFI_UNSUPPORTED The address range specified by Offset, Width, and Count is not
|
@retval EFI_UNSUPPORTED The address range specified by Offset, Width, and Count is not
|
||||||
valid for the PCI BAR specified by BarIndex.
|
valid for the PCI BAR specified by BarIndex.
|
||||||
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
|
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
|
||||||
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
|
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
@ -229,25 +235,25 @@ PciIoIoRead (
|
|||||||
IN OUT VOID *Buffer
|
IN OUT VOID *Buffer
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Enable a PCI driver to access PCI controller registers in the PCI memory or I/O space.
|
Enable a PCI driver to access PCI controller registers in the PCI memory or I/O space.
|
||||||
|
|
||||||
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
|
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
|
||||||
@param Width Signifies the width of the memory or I/O operations.
|
@param Width Signifies the width of the memory or I/O operations.
|
||||||
@param BarIndex The BAR index of the standard PCI Configuration header to use as the
|
@param BarIndex The BAR index of the standard PCI Configuration header to use as the
|
||||||
base address for the memory or I/O operation to perform.
|
base address for the memory or I/O operation to perform.
|
||||||
@param Offset The offset within the selected BAR to start the memory or I/O operation.
|
@param Offset The offset within the selected BAR to start the memory or I/O operation.
|
||||||
@param Count The number of memory or I/O operations to perform.
|
@param Count The number of memory or I/O operations to perform.
|
||||||
@param Buffer For read operations, the destination buffer to store the results. For write
|
@param Buffer For read operations, the destination buffer to store the results. For write
|
||||||
operations, the source buffer to write data from.
|
operations, the source buffer to write data from.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The data was read from or written to the PCI controller.
|
@retval EFI_SUCCESS The data was read from or written to the PCI controller.
|
||||||
@retval EFI_UNSUPPORTED BarIndex not valid for this PCI controller.
|
@retval EFI_UNSUPPORTED BarIndex not valid for this PCI controller.
|
||||||
@retval EFI_UNSUPPORTED The address range specified by Offset, Width, and Count is not
|
@retval EFI_UNSUPPORTED The address range specified by Offset, Width, and Count is not
|
||||||
valid for the PCI BAR specified by BarIndex.
|
valid for the PCI BAR specified by BarIndex.
|
||||||
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
|
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
|
||||||
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
|
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
@ -260,23 +266,23 @@ PciIoIoWrite (
|
|||||||
IN OUT VOID *Buffer
|
IN OUT VOID *Buffer
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Enable a PCI driver to access PCI controller registers in PCI configuration space.
|
Enable a PCI driver to access PCI controller registers in PCI configuration space.
|
||||||
|
|
||||||
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
|
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
|
||||||
@param Width Signifies the width of the memory operations.
|
@param Width Signifies the width of the memory operations.
|
||||||
@param Offset The offset within the PCI configuration space for the PCI controller.
|
@param Offset The offset within the PCI configuration space for the PCI controller.
|
||||||
@param Count The number of PCI configuration operations to perform.
|
@param Count The number of PCI configuration operations to perform.
|
||||||
@param Buffer For read operations, the destination buffer to store the results. For write
|
@param Buffer For read operations, the destination buffer to store the results. For write
|
||||||
operations, the source buffer to write data from.
|
operations, the source buffer to write data from.
|
||||||
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS The data was read from or written to the PCI controller.
|
@retval EFI_SUCCESS The data was read from or written to the PCI controller.
|
||||||
@retval EFI_UNSUPPORTED The address range specified by Offset, Width, and Count is not
|
@retval EFI_UNSUPPORTED The address range specified by Offset, Width, and Count is not
|
||||||
valid for the PCI configuration header of the PCI controller.
|
valid for the PCI configuration header of the PCI controller.
|
||||||
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
|
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
|
||||||
@retval EFI_INVALID_PARAMETER Buffer is NULL or Width is invalid.
|
@retval EFI_INVALID_PARAMETER Buffer is NULL or Width is invalid.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
@ -288,23 +294,23 @@ PciIoConfigRead (
|
|||||||
IN OUT VOID *Buffer
|
IN OUT VOID *Buffer
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Enable a PCI driver to access PCI controller registers in PCI configuration space.
|
Enable a PCI driver to access PCI controller registers in PCI configuration space.
|
||||||
|
|
||||||
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
|
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
|
||||||
@param Width Signifies the width of the memory operations.
|
@param Width Signifies the width of the memory operations.
|
||||||
@param Offset The offset within the PCI configuration space for the PCI controller.
|
@param Offset The offset within the PCI configuration space for the PCI controller.
|
||||||
@param Count The number of PCI configuration operations to perform.
|
@param Count The number of PCI configuration operations to perform.
|
||||||
@param Buffer For read operations, the destination buffer to store the results. For write
|
@param Buffer For read operations, the destination buffer to store the results. For write
|
||||||
operations, the source buffer to write data from.
|
operations, the source buffer to write data from.
|
||||||
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS The data was read from or written to the PCI controller.
|
@retval EFI_SUCCESS The data was read from or written to the PCI controller.
|
||||||
@retval EFI_UNSUPPORTED The address range specified by Offset, Width, and Count is not
|
@retval EFI_UNSUPPORTED The address range specified by Offset, Width, and Count is not
|
||||||
valid for the PCI configuration header of the PCI controller.
|
valid for the PCI configuration header of the PCI controller.
|
||||||
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
|
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
|
||||||
@retval EFI_INVALID_PARAMETER Buffer is NULL or Width is invalid.
|
@retval EFI_INVALID_PARAMETER Buffer is NULL or Width is invalid.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
@ -316,33 +322,33 @@ PciIoConfigWrite (
|
|||||||
IN OUT VOID *Buffer
|
IN OUT VOID *Buffer
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Enables a PCI driver to copy one region of PCI memory space to another region of PCI
|
Enables a PCI driver to copy one region of PCI memory space to another region of PCI
|
||||||
memory space.
|
memory space.
|
||||||
|
|
||||||
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
|
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
|
||||||
@param Width Signifies the width of the memory operations.
|
@param Width Signifies the width of the memory operations.
|
||||||
@param DestBarIndex The BAR index in the standard PCI Configuration header to use as the
|
@param DestBarIndex The BAR index in the standard PCI Configuration header to use as the
|
||||||
base address for the memory operation to perform.
|
base address for the memory operation to perform.
|
||||||
@param DestOffset The destination offset within the BAR specified by DestBarIndex to
|
@param DestOffset The destination offset within the BAR specified by DestBarIndex to
|
||||||
start the memory writes for the copy operation.
|
start the memory writes for the copy operation.
|
||||||
@param SrcBarIndex The BAR index in the standard PCI Configuration header to use as the
|
@param SrcBarIndex The BAR index in the standard PCI Configuration header to use as the
|
||||||
base address for the memory operation to perform.
|
base address for the memory operation to perform.
|
||||||
@param SrcOffset The source offset within the BAR specified by SrcBarIndex to start
|
@param SrcOffset The source offset within the BAR specified by SrcBarIndex to start
|
||||||
the memory reads for the copy operation.
|
the memory reads for the copy operation.
|
||||||
@param Count The number of memory operations to perform. Bytes moved is Width
|
@param Count The number of memory operations to perform. Bytes moved is Width
|
||||||
size * Count, starting at DestOffset and SrcOffset.
|
size * Count, starting at DestOffset and SrcOffset.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The data was copied from one memory region to another memory region.
|
@retval EFI_SUCCESS The data was copied from one memory region to another memory region.
|
||||||
@retval EFI_UNSUPPORTED DestBarIndex not valid for this PCI controller.
|
@retval EFI_UNSUPPORTED DestBarIndex not valid for this PCI controller.
|
||||||
@retval EFI_UNSUPPORTED SrcBarIndex not valid for this PCI controller.
|
@retval EFI_UNSUPPORTED SrcBarIndex not valid for this PCI controller.
|
||||||
@retval EFI_UNSUPPORTED The address range specified by DestOffset, Width, and Count
|
@retval EFI_UNSUPPORTED The address range specified by DestOffset, Width, and Count
|
||||||
is not valid for the PCI BAR specified by DestBarIndex.
|
is not valid for the PCI BAR specified by DestBarIndex.
|
||||||
@retval EFI_UNSUPPORTED The address range specified by SrcOffset, Width, and Count is
|
@retval EFI_UNSUPPORTED The address range specified by SrcOffset, Width, and Count is
|
||||||
not valid for the PCI BAR specified by SrcBarIndex.
|
not valid for the PCI BAR specified by SrcBarIndex.
|
||||||
@retval EFI_INVALID_PARAMETER Width is invalid.
|
@retval EFI_INVALID_PARAMETER Width is invalid.
|
||||||
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
|
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
@ -356,24 +362,24 @@ PciIoCopyMem (
|
|||||||
IN UINTN Count
|
IN UINTN Count
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Provides the PCI controller-Cspecific addresses needed to access system memory.
|
Provides the PCI controller-specific addresses needed to access system memory.
|
||||||
|
|
||||||
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
|
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
|
||||||
@param Operation Indicates if the bus master is going to read or write to system memory.
|
@param Operation Indicates if the bus master is going to read or write to system memory.
|
||||||
@param HostAddress The system memory address to map to the PCI controller.
|
@param HostAddress The system memory address to map to the PCI controller.
|
||||||
@param NumberOfBytes On input the number of bytes to map. On output the number of bytes
|
@param NumberOfBytes On input the number of bytes to map. On output the number of bytes
|
||||||
that were mapped.
|
that were mapped.
|
||||||
@param DeviceAddress The resulting map address for the bus master PCI controller to use to
|
@param DeviceAddress The resulting map address for the bus master PCI controller to use to
|
||||||
access the hosts HostAddress.
|
access the hosts HostAddress.
|
||||||
@param Mapping A resulting value to pass to Unmap().
|
@param Mapping A resulting value to pass to Unmap().
|
||||||
|
|
||||||
@retval EFI_SUCCESS The range was mapped for the returned NumberOfBytes.
|
@retval EFI_SUCCESS The range was mapped for the returned NumberOfBytes.
|
||||||
@retval EFI_UNSUPPORTED The HostAddress cannot be mapped as a common buffer.
|
@retval EFI_UNSUPPORTED The HostAddress cannot be mapped as a common buffer.
|
||||||
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
|
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
|
||||||
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
|
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
|
||||||
@retval EFI_DEVICE_ERROR The system hardware could not map the requested address.
|
@retval EFI_DEVICE_ERROR The system hardware could not map the requested address.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
@ -386,15 +392,15 @@ PciIoMap (
|
|||||||
OUT VOID **Mapping
|
OUT VOID **Mapping
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Completes the Map() operation and releases any corresponding resources.
|
Completes the Map() operation and releases any corresponding resources.
|
||||||
|
|
||||||
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
|
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
|
||||||
@param Mapping The mapping value returned from Map().
|
@param Mapping The mapping value returned from Map().
|
||||||
|
|
||||||
@retval EFI_SUCCESS The range was unmapped.
|
@retval EFI_SUCCESS The range was unmapped.
|
||||||
@retval EFI_DEVICE_ERROR The data was not committed to the target system memory.
|
@retval EFI_DEVICE_ERROR The data was not committed to the target system memory.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
@ -403,25 +409,25 @@ PciIoUnmap (
|
|||||||
IN VOID *Mapping
|
IN VOID *Mapping
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Allocates pages that are suitable for an EfiPciIoOperationBusMasterCommonBuffer
|
Allocates pages that are suitable for an EfiPciIoOperationBusMasterCommonBuffer
|
||||||
mapping.
|
mapping.
|
||||||
|
|
||||||
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
|
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
|
||||||
@param Type This parameter is not used and must be ignored.
|
@param Type This parameter is not used and must be ignored.
|
||||||
@param MemoryType The type of memory to allocate, EfiBootServicesData or
|
@param MemoryType The type of memory to allocate, EfiBootServicesData or
|
||||||
EfiRuntimeServicesData.
|
EfiRuntimeServicesData.
|
||||||
@param Pages The number of pages to allocate.
|
@param Pages The number of pages to allocate.
|
||||||
@param HostAddress A pointer to store the base system memory address of the
|
@param HostAddress A pointer to store the base system memory address of the
|
||||||
allocated range.
|
allocated range.
|
||||||
@param Attributes The requested bit mask of attributes for the allocated range.
|
@param Attributes The requested bit mask of attributes for the allocated range.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The requested memory pages were allocated.
|
@retval EFI_SUCCESS The requested memory pages were allocated.
|
||||||
@retval EFI_UNSUPPORTED Attributes is unsupported. The only legal attribute bits are
|
@retval EFI_UNSUPPORTED Attributes is unsupported. The only legal attribute bits are
|
||||||
MEMORY_WRITE_COMBINE and MEMORY_CACHED.
|
MEMORY_WRITE_COMBINE and MEMORY_CACHED.
|
||||||
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
|
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
|
||||||
@retval EFI_OUT_OF_RESOURCES The memory pages could not be allocated.
|
@retval EFI_OUT_OF_RESOURCES The memory pages could not be allocated.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
@ -434,17 +440,17 @@ PciIoAllocateBuffer (
|
|||||||
IN UINT64 Attributes
|
IN UINT64 Attributes
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Frees memory that was allocated with AllocateBuffer().
|
Frees memory that was allocated with AllocateBuffer().
|
||||||
|
|
||||||
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
|
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
|
||||||
@param Pages The number of pages to free.
|
@param Pages The number of pages to free.
|
||||||
@param HostAddress The base system memory address of the allocated range.
|
@param HostAddress The base system memory address of the allocated range.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The requested memory pages were freed.
|
@retval EFI_SUCCESS The requested memory pages were freed.
|
||||||
@retval EFI_INVALID_PARAMETER The memory range specified by HostAddress and Pages
|
@retval EFI_INVALID_PARAMETER The memory range specified by HostAddress and Pages
|
||||||
was not allocated with AllocateBuffer().
|
was not allocated with AllocateBuffer().
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
@ -454,16 +460,16 @@ PciIoFreeBuffer (
|
|||||||
IN VOID *HostAddress
|
IN VOID *HostAddress
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Flushes all PCI posted write transactions from a PCI host bridge to system memory.
|
Flushes all PCI posted write transactions from a PCI host bridge to system memory.
|
||||||
|
|
||||||
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
|
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The PCI posted write transactions were flushed from the PCI host
|
@retval EFI_SUCCESS The PCI posted write transactions were flushed from the PCI host
|
||||||
bridge to system memory.
|
bridge to system memory.
|
||||||
@retval EFI_DEVICE_ERROR The PCI posted write transactions were not flushed from the PCI
|
@retval EFI_DEVICE_ERROR The PCI posted write transactions were not flushed from the PCI
|
||||||
host bridge due to a hardware error.
|
host bridge due to a hardware error.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
@ -471,18 +477,18 @@ PciIoFlush (
|
|||||||
IN EFI_PCI_IO_PROTOCOL *This
|
IN EFI_PCI_IO_PROTOCOL *This
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Retrieves this PCI controller's current PCI bus number, device number, and function number.
|
Retrieves this PCI controller's current PCI bus number, device number, and function number.
|
||||||
|
|
||||||
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
|
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
|
||||||
@param SegmentNumber The PCI controller's current PCI segment number.
|
@param SegmentNumber The PCI controller's current PCI segment number.
|
||||||
@param BusNumber The PCI controller's current PCI bus number.
|
@param BusNumber The PCI controller's current PCI bus number.
|
||||||
@param DeviceNumber The PCI controller's current PCI device number.
|
@param DeviceNumber The PCI controller's current PCI device number.
|
||||||
@param FunctionNumber The PCI controller's current PCI function number.
|
@param FunctionNumber The PCI controller's current PCI function number.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The PCI controller location was returned.
|
@retval EFI_SUCCESS The PCI controller location was returned.
|
||||||
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
|
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
@ -496,30 +502,33 @@ PciIoGetLocation (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Check BAR type for PCI resource.
|
Check BAR type for PCI resource.
|
||||||
|
|
||||||
@param PciIoDevice PCI device instance
|
@param PciIoDevice PCI device instance.
|
||||||
@param BarIndex The BAR index of the standard PCI Configuration header to use as the
|
@param BarIndex The BAR index of the standard PCI Configuration header to use as the
|
||||||
base address for the memory or I/O operation to perform.
|
base address for the memory or I/O operation to perform.
|
||||||
@param BarType Memory or I/O
|
@param BarType Memory or I/O.
|
||||||
|
|
||||||
@return whether Pci device's bar type is same with input BarType.
|
@retval TRUE Pci device's bar type is same with input BarType.
|
||||||
|
@retval TRUE Pci device's bar type is not same with input BarType.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
CheckBarType (
|
CheckBarType (
|
||||||
IN PCI_IO_DEVICE *PciIoDevice,
|
IN PCI_IO_DEVICE *PciIoDevice,
|
||||||
UINT8 BarIndex,
|
IN UINT8 BarIndex,
|
||||||
PCI_BAR_TYPE BarType
|
IN PCI_BAR_TYPE BarType
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Set/Disable new attributes to a Root Bridge
|
Set/Disable new attributes to a Root Bridge.
|
||||||
|
|
||||||
@param PciIoDevice Pci device instance
|
@param PciIoDevice Pci device instance.
|
||||||
@param Attributes New attribute want to be set
|
@param Attributes New attribute want to be set.
|
||||||
@param Operation Set or Disable
|
@param Operation Set or Disable.
|
||||||
|
|
||||||
@retval EFI_UNSUPPORTED If root bridge does not support change attribute
|
@retval EFI_UNSUPPORTED If root bridge does not support change attribute.
|
||||||
@retval EFI_SUCCESS Success operation.
|
@retval EFI_SUCCESS Successfully set new attributs.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
ModifyRootBridgeAttributes (
|
ModifyRootBridgeAttributes (
|
||||||
@ -529,38 +538,39 @@ ModifyRootBridgeAttributes (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Check whether this device can be enable/disable to snoop
|
Check whether this device can be enable/disable to snoop.
|
||||||
|
|
||||||
@param PciIoDevice Pci device instance
|
@param PciIoDevice Pci device instance.
|
||||||
@param Operation Enable/Disable
|
@param Operation Enable/Disable.
|
||||||
|
|
||||||
@retval EFI_UNSUPPORTED Pci device is not GFX device or not support snoop
|
@retval EFI_UNSUPPORTED Pci device is not GFX device or not support snoop.
|
||||||
@retval EFI_SUCCESS Snoop can be supported.
|
@retval EFI_SUCCESS Snoop can be supported.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
SupportPaletteSnoopAttributes (
|
SupportPaletteSnoopAttributes (
|
||||||
IN PCI_IO_DEVICE *PciIoDevice,
|
IN PCI_IO_DEVICE *PciIoDevice,
|
||||||
IN EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION Operation
|
IN EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION Operation
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Performs an operation on the attributes that this PCI controller supports. The operations include
|
Performs an operation on the attributes that this PCI controller supports. The operations include
|
||||||
getting the set of supported attributes, retrieving the current attributes, setting the current
|
getting the set of supported attributes, retrieving the current attributes, setting the current
|
||||||
attributes, enabling attributes, and disabling attributes.
|
attributes, enabling attributes, and disabling attributes.
|
||||||
|
|
||||||
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
|
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
|
||||||
@param Operation The operation to perform on the attributes for this PCI controller.
|
@param Operation The operation to perform on the attributes for this PCI controller.
|
||||||
@param Attributes The mask of attributes that are used for Set, Enable, and Disable
|
@param Attributes The mask of attributes that are used for Set, Enable, and Disable
|
||||||
operations.
|
operations.
|
||||||
@param Result A pointer to the result mask of attributes that are returned for the Get
|
@param Result A pointer to the result mask of attributes that are returned for the Get
|
||||||
and Supported operations.
|
and Supported operations.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The operation on the PCI controller's attributes was completed.
|
@retval EFI_SUCCESS The operation on the PCI controller's attributes was completed.
|
||||||
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
|
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
|
||||||
@retval EFI_UNSUPPORTED one or more of the bits set in
|
@retval EFI_UNSUPPORTED one or more of the bits set in
|
||||||
Attributes are not supported by this PCI controller or one of
|
Attributes are not supported by this PCI controller or one of
|
||||||
its parent bridges when Operation is Set, Enable or Disable.
|
its parent bridges when Operation is Set, Enable or Disable.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
@ -571,27 +581,27 @@ PciIoAttributes (
|
|||||||
OUT UINT64 *Result OPTIONAL
|
OUT UINT64 *Result OPTIONAL
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Gets the attributes that this PCI controller supports setting on a BAR using
|
Gets the attributes that this PCI controller supports setting on a BAR using
|
||||||
SetBarAttributes(), and retrieves the list of resource descriptors for a BAR.
|
SetBarAttributes(), and retrieves the list of resource descriptors for a BAR.
|
||||||
|
|
||||||
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
|
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
|
||||||
@param BarIndex The BAR index of the standard PCI Configuration header to use as the
|
@param BarIndex The BAR index of the standard PCI Configuration header to use as the
|
||||||
base address for resource range. The legal range for this field is 0..5.
|
base address for resource range. The legal range for this field is 0..5.
|
||||||
@param Supports A pointer to the mask of attributes that this PCI controller supports
|
@param Supports A pointer to the mask of attributes that this PCI controller supports
|
||||||
setting for this BAR with SetBarAttributes().
|
setting for this BAR with SetBarAttributes().
|
||||||
@param Resources A pointer to the ACPI 2.0 resource descriptors that describe the current
|
@param Resources A pointer to the ACPI 2.0 resource descriptors that describe the current
|
||||||
configuration of this BAR of the PCI controller.
|
configuration of this BAR of the PCI controller.
|
||||||
|
|
||||||
@retval EFI_SUCCESS If Supports is not NULL, then the attributes that the PCI
|
@retval EFI_SUCCESS If Supports is not NULL, then the attributes that the PCI
|
||||||
controller supports are returned in Supports. If Resources
|
controller supports are returned in Supports. If Resources
|
||||||
is not NULL, then the ACPI 2.0 resource descriptors that the PCI
|
is not NULL, then the ACPI 2.0 resource descriptors that the PCI
|
||||||
controller is currently using are returned in Resources.
|
controller is currently using are returned in Resources.
|
||||||
@retval EFI_INVALID_PARAMETER Both Supports and Attributes are NULL.
|
@retval EFI_INVALID_PARAMETER Both Supports and Attributes are NULL.
|
||||||
@retval EFI_UNSUPPORTED BarIndex not valid for this PCI controller.
|
@retval EFI_UNSUPPORTED BarIndex not valid for this PCI controller.
|
||||||
@retval EFI_OUT_OF_RESOURCES There are not enough resources available to allocate
|
@retval EFI_OUT_OF_RESOURCES There are not enough resources available to allocate
|
||||||
Resources.
|
Resources.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
@ -602,29 +612,29 @@ PciIoGetBarAttributes (
|
|||||||
OUT VOID **Resources OPTIONAL
|
OUT VOID **Resources OPTIONAL
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Sets the attributes for a range of a BAR on a PCI controller.
|
Sets the attributes for a range of a BAR on a PCI controller.
|
||||||
|
|
||||||
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
|
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
|
||||||
@param Attributes The mask of attributes to set for the resource range specified by
|
@param Attributes The mask of attributes to set for the resource range specified by
|
||||||
BarIndex, Offset, and Length.
|
BarIndex, Offset, and Length.
|
||||||
@param BarIndex The BAR index of the standard PCI Configuration header to use as the
|
@param BarIndex The BAR index of the standard PCI Configuration header to use as the
|
||||||
base address for resource range. The legal range for this field is 0..5.
|
base address for resource range. The legal range for this field is 0..5.
|
||||||
@param Offset A pointer to the BAR relative base address of the resource range to be
|
@param Offset A pointer to the BAR relative base address of the resource range to be
|
||||||
modified by the attributes specified by Attributes.
|
modified by the attributes specified by Attributes.
|
||||||
@param Length A pointer to the length of the resource range to be modified by the
|
@param Length A pointer to the length of the resource range to be modified by the
|
||||||
attributes specified by Attributes.
|
attributes specified by Attributes.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The set of attributes specified by Attributes for the resource
|
@retval EFI_SUCCESS The set of attributes specified by Attributes for the resource
|
||||||
range specified by BarIndex, Offset, and Length were
|
range specified by BarIndex, Offset, and Length were
|
||||||
set on the PCI controller, and the actual resource range is returned
|
set on the PCI controller, and the actual resource range is returned
|
||||||
in Offset and Length.
|
in Offset and Length.
|
||||||
@retval EFI_INVALID_PARAMETER Offset or Length is NULL.
|
@retval EFI_INVALID_PARAMETER Offset or Length is NULL.
|
||||||
@retval EFI_UNSUPPORTED BarIndex not valid for this PCI controller.
|
@retval EFI_UNSUPPORTED BarIndex not valid for this PCI controller.
|
||||||
@retval EFI_OUT_OF_RESOURCES There are not enough resources to set the attributes on the
|
@retval EFI_OUT_OF_RESOURCES There are not enough resources to set the attributes on the
|
||||||
resource range specified by BarIndex, Offset, and
|
resource range specified by BarIndex, Offset, and
|
||||||
Length.
|
Length.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
@ -638,33 +648,35 @@ PciIoSetBarAttributes (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Program parent bridge's attribute recurrently.
|
Program parent bridge's attribute recurrently.
|
||||||
|
|
||||||
@param PciIoDevice Child Pci device instance
|
@param PciIoDevice Child Pci device instance
|
||||||
@param Operation The operation to perform on the attributes for this PCI controller.
|
@param Operation The operation to perform on the attributes for this PCI controller.
|
||||||
@param Attributes The mask of attributes that are used for Set, Enable, and Disable
|
@param Attributes The mask of attributes that are used for Set, Enable, and Disable
|
||||||
operations.
|
operations.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The operation on the PCI controller's attributes was completed.
|
@retval EFI_SUCCESS The operation on the PCI controller's attributes was completed.
|
||||||
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
|
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
|
||||||
@retval EFI_UNSUPPORTED one or more of the bits set in
|
@retval EFI_UNSUPPORTED one or more of the bits set in
|
||||||
Attributes are not supported by this PCI controller or one of
|
Attributes are not supported by this PCI controller or one of
|
||||||
its parent bridges when Operation is Set, Enable or Disable.
|
its parent bridges when Operation is Set, Enable or Disable.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
UpStreamBridgesAttributes (
|
UpStreamBridgesAttributes (
|
||||||
IN PCI_IO_DEVICE *PciIoDevice,
|
IN PCI_IO_DEVICE *PciIoDevice,
|
||||||
IN EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION Operation,
|
IN EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION Operation,
|
||||||
IN UINT64 Attributes
|
IN UINT64 Attributes
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Test whether two Pci device has same parent bridge.
|
Test whether two Pci devices has same parent bridge.
|
||||||
|
|
||||||
@param PciDevice1 the frist pci device for testing
|
@param PciDevice1 The first pci device for testing.
|
||||||
@param PciDevice2 the second pci device for testing
|
@param PciDevice2 The second pci device for testing.
|
||||||
|
|
||||||
@return whether two Pci device has same parent bridge.
|
@retval TRUE Two Pci device has the same parent bridge.
|
||||||
|
@retval FALSE Two Pci device has not the same parent bridge.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
PciDevicesOnTheSamePath (
|
PciDevicesOnTheSamePath (
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
|
Internal library declaration for PCI Bus module.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2007, Intel Corporation
|
Copyright (c) 2006 - 2009, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -9,18 +10,6 @@ http://opensource.org/licenses/bsd-license.php
|
|||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
Module Name:
|
|
||||||
|
|
||||||
PciLib.h
|
|
||||||
|
|
||||||
Abstract:
|
|
||||||
|
|
||||||
PCI Bus Driver Lib header file.
|
|
||||||
Please use PCD feature flag PcdPciBusHotplugDeviceSupport to enable
|
|
||||||
support hot plug.
|
|
||||||
|
|
||||||
Revision History
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#ifndef _EFI_PCI_LIB_H_
|
#ifndef _EFI_PCI_LIB_H_
|
||||||
@ -51,9 +40,10 @@ typedef struct {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Retrieve the BAR information via PciIo interface.
|
Retrieve the PCI Card device BAR information via PciIo interface.
|
||||||
|
|
||||||
@param PciIoDevice Pci device instance.
|
@param PciIoDevice PCI Card device instance.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
GetBackPcCardBar (
|
GetBackPcCardBar (
|
||||||
@ -63,23 +53,29 @@ GetBackPcCardBar (
|
|||||||
/**
|
/**
|
||||||
Remove rejected pci device from specific root bridge
|
Remove rejected pci device from specific root bridge
|
||||||
handle.
|
handle.
|
||||||
|
|
||||||
@param RootBridgeHandle specific parent root bridge handle.
|
@param RootBridgeHandle Specific parent root bridge handle.
|
||||||
@param Bridge Bridge device instance.
|
@param Bridge Bridge device instance.
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success operation.
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
VOID
|
||||||
RemoveRejectedPciDevices (
|
RemoveRejectedPciDevices (
|
||||||
EFI_HANDLE RootBridgeHandle,
|
IN EFI_HANDLE RootBridgeHandle,
|
||||||
IN PCI_IO_DEVICE *Bridge
|
IN PCI_IO_DEVICE *Bridge
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Wrapper function for allocating resource for pci host bridge.
|
Submits the I/O and memory resource requirements for the specified PCI Host Bridge.
|
||||||
|
|
||||||
@param PciResAlloc Point to protocol instance EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL.
|
@param PciResAlloc Point to protocol instance of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Successfully finished resource allocation.
|
||||||
|
@retval EFI_NOT_FOUND Cannot get root bridge instance.
|
||||||
|
@retval EFI_OUT_OF_RESOURCES Platform failed to program the resources if no hot plug supported.
|
||||||
|
@retval other Some error occurred when allocating resources for the PCI Host Bridge.
|
||||||
|
|
||||||
|
@note Feature flag PcdPciBusHotplugDeviceSupport determine whether need support hotplug.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
PciHostBridgeResourceAllocator (
|
PciHostBridgeResourceAllocator (
|
||||||
@ -87,38 +83,18 @@ PciHostBridgeResourceAllocator (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Wrapper function for allocating resource for pci host bridge without hotplug device support.
|
Scan pci bus and assign bus number to the given PCI bus system.
|
||||||
|
|
||||||
@param PciResAlloc Point to protocol instance EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
PciHostBridgeResourceAllocator_WithoutHotPlugDeviceSupport (
|
|
||||||
IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
@param Bridge Bridge device instance.
|
||||||
Wrapper function for allocating resource for pci host bridge with hotplug device support.
|
@param StartBusNumber start point.
|
||||||
|
@param SubBusNumber Point to sub bus number.
|
||||||
@param PciResAlloc Point to protocol instance EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL.
|
@param PaddedBusRange Customized bus number.
|
||||||
|
|
||||||
**/
|
@retval EFI_SUCCESS Successfully scanned and assigned bus number.
|
||||||
EFI_STATUS
|
@retval other Some error occurred when scanning pci bus.
|
||||||
PciHostBridgeResourceAllocator_WithHotPlugDeviceSupport (
|
|
||||||
IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc
|
@note Feature flag PcdPciBusHotplugDeviceSupport determine whether need support hotplug.
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
Wapper function of scanning pci bus and assign bus number to the given PCI bus system
|
|
||||||
Feature flag PcdPciBusHotplugDeviceSupport determine whether need support hotplug.
|
|
||||||
|
|
||||||
@param Bridge Bridge device instance.
|
|
||||||
@param StartBusNumber start point.
|
|
||||||
@param SubBusNumber Point to sub bus number.
|
|
||||||
@param PaddedBusRange Customized bus number.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success.
|
|
||||||
@retval EFI_DEVICE_ERROR Fail to scan bus.
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
PciScanBus (
|
PciScanBus (
|
||||||
@ -129,51 +105,13 @@ PciScanBus (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Wapper function of scanning pci bus and assign bus number to the given PCI bus system
|
Process Option Rom on the specified root bridge.
|
||||||
Feature flag PcdPciBusHotplugDeviceSupport determine whether need support hotplug.
|
|
||||||
|
|
||||||
@param Bridge Bridge device instance.
|
|
||||||
@param StartBusNumber start point.
|
|
||||||
@param SubBusNumber Point to sub bus number.
|
|
||||||
@param PaddedBusRange Customized bus number.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success.
|
|
||||||
@retval EFI_DEVICE_ERROR Fail to scan bus.
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
PciScanBus_WithHotPlugDeviceSupport (
|
|
||||||
IN PCI_IO_DEVICE *Bridge,
|
|
||||||
IN UINT8 StartBusNumber,
|
|
||||||
OUT UINT8 *SubBusNumber,
|
|
||||||
OUT UINT8 *PaddedBusRange
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
@param Bridge Pci root bridge device instance.
|
||||||
Wapper function of scanning pci bus and assign bus number to the given PCI bus system
|
|
||||||
Feature flag PcdPciBusHotplugDeviceSupport determine whether need support hotplug.
|
@retval EFI_SUCCESS Success process.
|
||||||
|
@retval other Some error occurred when processing Option Rom on the root bridge.
|
||||||
@param Bridge Bridge device instance.
|
|
||||||
@param StartBusNumber start point.
|
|
||||||
@param SubBusNumber Point to sub bus number.
|
|
||||||
@param PaddedBusRange Customized bus number.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success.
|
|
||||||
@retval EFI_DEVICE_ERROR Fail to scan bus.
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
PciScanBus_WithoutHotPlugDeviceSupport (
|
|
||||||
IN PCI_IO_DEVICE *Bridge,
|
|
||||||
IN UINT8 StartBusNumber,
|
|
||||||
OUT UINT8 *SubBusNumber,
|
|
||||||
OUT UINT8 *PaddedBusRange
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
Process Option Rom on this host bridge.
|
|
||||||
|
|
||||||
@param Bridge Pci bridge device instance.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success.
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
PciRootBridgeP2CProcess (
|
PciRootBridgeP2CProcess (
|
||||||
@ -181,12 +119,14 @@ PciRootBridgeP2CProcess (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Process Option Rom on this host bridge.
|
Process Option Rom on the specified host bridge.
|
||||||
|
|
||||||
@param PciResAlloc Pointer to instance of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL.
|
@param PciResAlloc Pointer to instance of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL.
|
||||||
|
|
||||||
@retval EFI_NOT_FOUND Can not find the root bridge instance.
|
|
||||||
@retval EFI_SUCCESS Success process.
|
@retval EFI_SUCCESS Success process.
|
||||||
|
@retval EFI_NOT_FOUND Can not find the root bridge instance.
|
||||||
|
@retval other Some error occurred when processing Option Rom on the host bridge.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
PciHostBridgeP2CProcess (
|
PciHostBridgeP2CProcess (
|
||||||
@ -197,10 +137,11 @@ PciHostBridgeP2CProcess (
|
|||||||
This function is used to enumerate the entire host bridge
|
This function is used to enumerate the entire host bridge
|
||||||
in a given platform.
|
in a given platform.
|
||||||
|
|
||||||
@param PciResAlloc A pointer to the resource allocate protocol.
|
@param PciResAlloc A pointer to the PCI Host Resource Allocation protocol.
|
||||||
|
|
||||||
@retval EFI_OUT_OF_RESOURCES no enough resource.
|
@retval EFI_SUCCESS Successfully enumerated the host bridge.
|
||||||
@retval EFI_SUCCESS Success.
|
@retval EFI_OUT_OF_RESOURCES No enough memory available.
|
||||||
|
@retval other Some error occurred when enumerating the host bridge.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
@ -218,10 +159,11 @@ PciHostBridgeEnumerator (
|
|||||||
@param Buffer For read operations, the destination buffer to store the results. For
|
@param Buffer For read operations, the destination buffer to store the results. For
|
||||||
write operations, the source buffer to write data from.
|
write operations, the source buffer to write data from.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The data was read from or written to the PCI root bridge.
|
@retval EFI_SUCCESS The data was read from or written to the PCI controller.
|
||||||
@retval EFI_INVALID_PARAMETER Width is invalid for this PCI root bridge.
|
@retval EFI_UNSUPPORTED The address range specified by Offset, Width, and Count is not
|
||||||
@retval EFI_INVALID_PARAMETER Buffer is NULL.
|
valid for the PCI configuration header of the PCI controller.
|
||||||
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
|
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
|
||||||
|
@retval EFI_INVALID_PARAMETER Buffer is NULL or Width is invalid.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
@ -236,17 +178,20 @@ PciIoRead (
|
|||||||
/**
|
/**
|
||||||
Write PCI configuration space through EFI_PCI_IO_PROTOCOL.
|
Write PCI configuration space through EFI_PCI_IO_PROTOCOL.
|
||||||
|
|
||||||
@param PciIo A pointer to the EFI_PCI_O_PROTOCOL.
|
If PCI incompatibility check is enabled, do incompatibility check.
|
||||||
@param Width Signifies the width of the memory operations.
|
|
||||||
@param Address The address within the PCI configuration space for the PCI controller.
|
|
||||||
@param Count The number of unit to be write.
|
|
||||||
@param Buffer For read operations, the destination buffer to store the results. For
|
|
||||||
write operations, the source buffer to write data from.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS The data was read from or written to the PCI root bridge.
|
@param PciIo A pointer to the EFI_PCI_IO_PROTOCOL instance.
|
||||||
@retval EFI_INVALID_PARAMETER Width is invalid for this PCI root bridge.
|
@param Width Signifies the width of the memory operations.
|
||||||
@retval EFI_INVALID_PARAMETER Buffer is NULL.
|
@param Offset The offset within the PCI configuration space for the PCI controller.
|
||||||
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
|
@param Count The number of PCI configuration operations to perform.
|
||||||
|
@param Buffer For read operations, the destination buffer to store the results. For write
|
||||||
|
operations, the source buffer to write data from.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS The data was read from or written to the PCI controller.
|
||||||
|
@retval EFI_UNSUPPORTED The address range specified by Offset, Width, and Count is not
|
||||||
|
valid for the PCI configuration header of the PCI controller.
|
||||||
|
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
|
||||||
|
@retval EFI_INVALID_PARAMETER Buffer is NULL or Width is invalid.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
@ -265,14 +210,13 @@ PciIoWrite (
|
|||||||
@param Pci A pointer to PCI_TYPE00.
|
@param Pci A pointer to PCI_TYPE00.
|
||||||
@param Width Signifies the width of the memory operations.
|
@param Width Signifies the width of the memory operations.
|
||||||
@param Address The address within the PCI configuration space for the PCI controller.
|
@param Address The address within the PCI configuration space for the PCI controller.
|
||||||
@param Count The number of unit to be write.
|
@param Count The number of unit to be read.
|
||||||
@param Buffer For read operations, the destination buffer to store the results. For
|
@param Buffer For read operations, the destination buffer to store the results. For
|
||||||
write operations, the source buffer to write data from.
|
write operations, the source buffer to write data from.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The data was read from or written to the PCI root bridge.
|
@retval EFI_SUCCESS The data was read from or written to the PCI root bridge.
|
||||||
@retval EFI_INVALID_PARAMETER Width is invalid for this PCI root bridge.
|
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
|
||||||
@retval EFI_INVALID_PARAMETER Buffer is NULL.
|
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
|
||||||
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
@ -296,16 +240,15 @@ PciRootBridgeIoWrite (
|
|||||||
@param Buffer For read operations, the destination buffer to store the results. For
|
@param Buffer For read operations, the destination buffer to store the results. For
|
||||||
write operations, the source buffer to write data from.
|
write operations, the source buffer to write data from.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The data was read from or written to the PCI root bridge.
|
@retval EFI_SUCCESS The data was read from or written to the PCI root bridge.
|
||||||
@retval EFI_INVALID_PARAMETER Width is invalid for this PCI root bridge.
|
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
|
||||||
@retval EFI_INVALID_PARAMETER Buffer is NULL.
|
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
|
||||||
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
PciRootBridgeIoRead (
|
PciRootBridgeIoRead (
|
||||||
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,
|
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,
|
||||||
IN PCI_TYPE00 *Pci, OPTIONAL
|
IN PCI_TYPE00 *Pci, OPTIONAL
|
||||||
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
|
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
|
||||||
IN UINT64 Address,
|
IN UINT64 Address,
|
||||||
IN UINTN Count,
|
IN UINTN Count,
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/** @file
|
/** @file
|
||||||
|
PCI Rom supporting funtions implementation for PCI Bus module.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2009, Intel Corporation
|
Copyright (c) 2006 - 2009, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
@ -12,24 +13,24 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
#include "PciBus.h"
|
#include "PciBus.h"
|
||||||
#include "PciResourceSupport.h"
|
|
||||||
|
|
||||||
#include <IndustryStandard/Pci23.h>
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Load the EFI Image from Option ROM
|
Load the EFI Image from Option ROM
|
||||||
|
|
||||||
@param PciIoDevice PCI IO Device
|
@param PciIoDevice PCI IO device instance.
|
||||||
@param FilePath The file path of the EFI Image
|
@param FilePath The file path of the EFI Image
|
||||||
@param BufferSize On input the size of Buffer in bytes. On output with a return
|
@param BufferSize On input the size of Buffer in bytes. On output with a return
|
||||||
code of EFI_SUCCESS, the amount of data transferred to Buffer.
|
code of EFI_SUCCESS, the amount of data transferred to Buffer.
|
||||||
On output with a return code of EFI_BUFFER_TOO_SMALL,
|
On output with a return code of EFI_BUFFER_TOO_SMALL,
|
||||||
the size of Buffer required to retrieve the requested file.
|
the size of Buffer required to retrieve the requested file.
|
||||||
@param Buffer The memory buffer to transfer the file to. If Buffer is NULL,
|
@param Buffer The memory buffer to transfer the file to. If Buffer is NULL,
|
||||||
then no the size of the requested file is returned in BufferSize.
|
then no the size of the requested file is returned in BufferSize.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The file was loaded.
|
@retval EFI_SUCCESS The file was loaded.
|
||||||
@retval EFI_UNSUPPORTED BootPolicy is TRUE.
|
@retval EFI_INVALID_PARAMETER FilePath is not a valid device path, or
|
||||||
|
BufferSize is NULL.
|
||||||
|
@retval EFI_NOT_FOUND Not found PCI Option Rom on PCI device.
|
||||||
|
@retval EFI_DEVICE_ERROR Failed to decompress PCI Option Rom image.
|
||||||
@retval EFI_BUFFER_TOO_SMALL The BufferSize is too small to read the current directory entry.
|
@retval EFI_BUFFER_TOO_SMALL The BufferSize is too small to read the current directory entry.
|
||||||
BufferSize has been updated with the size needed to complete the request.
|
BufferSize has been updated with the size needed to complete the request.
|
||||||
**/
|
**/
|
||||||
@ -65,7 +66,7 @@ LocalLoadFile2 (
|
|||||||
) {
|
) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
EfiRomHeader = (EFI_PCI_EXPANSION_ROM_HEADER *) (
|
EfiRomHeader = (EFI_PCI_EXPANSION_ROM_HEADER *) (
|
||||||
(UINT8 *) PciIoDevice->PciIo.RomImage + EfiOpRomImageNode->StartingOffset
|
(UINT8 *) PciIoDevice->PciIo.RomImage + EfiOpRomImageNode->StartingOffset
|
||||||
);
|
);
|
||||||
@ -73,11 +74,11 @@ LocalLoadFile2 (
|
|||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Pcir = (PCI_DATA_STRUCTURE *) ((UINT8 *) EfiRomHeader + EfiRomHeader->PcirOffset);
|
Pcir = (PCI_DATA_STRUCTURE *) ((UINT8 *) EfiRomHeader + EfiRomHeader->PcirOffset);
|
||||||
|
|
||||||
|
|
||||||
if ((Pcir->CodeType == PCI_CODE_TYPE_EFI_IMAGE) &&
|
if ((Pcir->CodeType == PCI_CODE_TYPE_EFI_IMAGE) &&
|
||||||
(EfiRomHeader->EfiSignature == EFI_PCI_EXPANSION_ROM_HEADER_EFISIGNATURE) &&
|
(EfiRomHeader->EfiSignature == EFI_PCI_EXPANSION_ROM_HEADER_EFISIGNATURE) &&
|
||||||
((EfiRomHeader->EfiSubsystem == EFI_IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER) ||
|
((EfiRomHeader->EfiSubsystem == EFI_IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER) ||
|
||||||
(EfiRomHeader->EfiSubsystem == EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER)) &&
|
(EfiRomHeader->EfiSubsystem == EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER)) &&
|
||||||
@ -118,19 +119,19 @@ LocalLoadFile2 (
|
|||||||
);
|
);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return EFI_DEVICE_ERROR;
|
return EFI_DEVICE_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Buffer == NULL || *BufferSize < DestinationSize) {
|
if (Buffer == NULL || *BufferSize < DestinationSize) {
|
||||||
*BufferSize = DestinationSize;
|
*BufferSize = DestinationSize;
|
||||||
return EFI_BUFFER_TOO_SMALL;
|
return EFI_BUFFER_TOO_SMALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
*BufferSize = DestinationSize;
|
*BufferSize = DestinationSize;
|
||||||
Scratch = AllocatePool (ScratchSize);
|
Scratch = AllocatePool (ScratchSize);
|
||||||
if (Scratch == NULL) {
|
if (Scratch == NULL) {
|
||||||
return EFI_DEVICE_ERROR;
|
return EFI_DEVICE_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = Decompress->Decompress (
|
Status = Decompress->Decompress (
|
||||||
Decompress,
|
Decompress,
|
||||||
ImageBuffer,
|
ImageBuffer,
|
||||||
@ -141,7 +142,7 @@ LocalLoadFile2 (
|
|||||||
ScratchSize
|
ScratchSize
|
||||||
);
|
);
|
||||||
FreePool (Scratch);
|
FreePool (Scratch);
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return EFI_DEVICE_ERROR;
|
return EFI_DEVICE_ERROR;
|
||||||
}
|
}
|
||||||
@ -154,13 +155,13 @@ LocalLoadFile2 (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Initialize a PCI LoadFile2 instance.
|
Initialize a PCI LoadFile2 instance.
|
||||||
|
|
||||||
@param PciIoDevice PCI IO Device.
|
@param PciIoDevice PCI IO Device.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
InitializePciLoadFile2 (
|
InitializePciLoadFile2 (
|
||||||
PCI_IO_DEVICE *PciIoDevice
|
IN PCI_IO_DEVICE *PciIoDevice
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
PciIoDevice->LoadFile2.LoadFile = LoadFile2;
|
PciIoDevice->LoadFile2.LoadFile = LoadFile2;
|
||||||
@ -168,22 +169,26 @@ InitializePciLoadFile2 (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Causes the driver to load a specified file.
|
Causes the driver to load a specified file.
|
||||||
|
|
||||||
@param This Indicates a pointer to the calling context.
|
@param This Indicates a pointer to the calling context.
|
||||||
@param FilePath The device specific path of the file to load.
|
@param FilePath The device specific path of the file to load.
|
||||||
@param BootPolicy Should always be FALSE.
|
@param BootPolicy Should always be FALSE.
|
||||||
@param BufferSize On input the size of Buffer in bytes. On output with a return
|
@param BufferSize On input the size of Buffer in bytes. On output with a return
|
||||||
code of EFI_SUCCESS, the amount of data transferred to Buffer.
|
code of EFI_SUCCESS, the amount of data transferred to Buffer.
|
||||||
On output with a return code of EFI_BUFFER_TOO_SMALL,
|
On output with a return code of EFI_BUFFER_TOO_SMALL,
|
||||||
the size of Buffer required to retrieve the requested file.
|
the size of Buffer required to retrieve the requested file.
|
||||||
@param Buffer The memory buffer to transfer the file to. If Buffer is NULL,
|
@param Buffer The memory buffer to transfer the file to. If Buffer is NULL,
|
||||||
then no the size of the requested file is returned in BufferSize.
|
then no the size of the requested file is returned in BufferSize.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The file was loaded.
|
@retval EFI_SUCCESS The file was loaded.
|
||||||
@retval EFI_UNSUPPORTED BootPolicy is TRUE.
|
@retval EFI_UNSUPPORTED BootPolicy is TRUE.
|
||||||
|
@retval EFI_INVALID_PARAMETER FilePath is not a valid device path, or
|
||||||
|
BufferSize is NULL.
|
||||||
|
@retval EFI_NOT_FOUND Not found PCI Option Rom on PCI device.
|
||||||
|
@retval EFI_DEVICE_ERROR Failed to decompress PCI Option Rom image.
|
||||||
@retval EFI_BUFFER_TOO_SMALL The BufferSize is too small to read the current directory entry.
|
@retval EFI_BUFFER_TOO_SMALL The BufferSize is too small to read the current directory entry.
|
||||||
BufferSize has been updated with the size needed to complete the request.
|
BufferSize has been updated with the size needed to complete the request.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
@ -210,31 +215,14 @@ LoadFile2 (
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// Module global for a template of the PCI option ROM Image Device Path Node
|
|
||||||
//
|
|
||||||
MEMMAP_DEVICE_PATH mPciOptionRomImageDevicePathNodeTemplate = {
|
|
||||||
{
|
|
||||||
HARDWARE_DEVICE_PATH,
|
|
||||||
HW_MEMMAP_DP,
|
|
||||||
{
|
|
||||||
(UINT8) (sizeof (MEMMAP_DEVICE_PATH)),
|
|
||||||
(UINT8) ((sizeof (MEMMAP_DEVICE_PATH)) >> 8)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
EfiMemoryMappedIO,
|
|
||||||
0,
|
|
||||||
0
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get Pci device's oprom infor bits.
|
Get Pci device's oprom infor bits.
|
||||||
|
|
||||||
@param PciIoDevice Pci device instance
|
|
||||||
|
|
||||||
@retval EFI_NOT_FOUND Pci device has not oprom
|
@param PciIoDevice Pci device instance.
|
||||||
@retval EFI_SUCCESS Pci device has oprom
|
|
||||||
|
@retval EFI_NOT_FOUND Pci device has not Option Rom.
|
||||||
|
@retval EFI_SUCCESS Pci device has Option Rom.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
GetOpRomInfo (
|
GetOpRomInfo (
|
||||||
@ -257,7 +245,7 @@ GetOpRomInfo (
|
|||||||
PciRootBridgeIo = PciIoDevice->PciRootBridgeIo;
|
PciRootBridgeIo = PciIoDevice->PciRootBridgeIo;
|
||||||
|
|
||||||
//
|
//
|
||||||
// offset is 0x30 if is not ppb
|
// Offset is 0x30 if is not ppb
|
||||||
//
|
//
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -267,7 +255,7 @@ GetOpRomInfo (
|
|||||||
|
|
||||||
if (IS_PCI_BRIDGE (&PciIoDevice->Pci)) {
|
if (IS_PCI_BRIDGE (&PciIoDevice->Pci)) {
|
||||||
//
|
//
|
||||||
// if is ppb
|
// If is ppb
|
||||||
//
|
//
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -276,7 +264,7 @@ GetOpRomInfo (
|
|||||||
RomBarIndex = PCI_BRIDGE_ROMBAR;
|
RomBarIndex = PCI_BRIDGE_ROMBAR;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// the bit0 is 0 to prevent the enabling of the Rom address decoder
|
// The bit0 is 0 to prevent the enabling of the Rom address decoder
|
||||||
//
|
//
|
||||||
AllOnes = 0xfffffffe;
|
AllOnes = 0xfffffffe;
|
||||||
Address = EFI_PCI_ADDRESS (Bus, Device, Function, RomBarIndex);
|
Address = EFI_PCI_ADDRESS (Bus, Device, Function, RomBarIndex);
|
||||||
@ -290,11 +278,11 @@ GetOpRomInfo (
|
|||||||
&AllOnes
|
&AllOnes
|
||||||
);
|
);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// read back
|
// Read back
|
||||||
//
|
//
|
||||||
Status = PciRootBridgeIoRead (
|
Status = PciRootBridgeIoRead (
|
||||||
PciRootBridgeIo,
|
PciRootBridgeIo,
|
||||||
@ -305,7 +293,7 @@ GetOpRomInfo (
|
|||||||
&AllOnes
|
&AllOnes
|
||||||
);
|
);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// Bits [1, 10] are reserved
|
// Bits [1, 10] are reserved
|
||||||
@ -320,21 +308,20 @@ GetOpRomInfo (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
Check if the RomImage contains EFI Images.
|
Check if the RomImage contains EFI Images.
|
||||||
|
|
||||||
@param RomImage The ROM address of Image for check.
|
@param RomImage The ROM address of Image for check.
|
||||||
@param RomSize Size of ROM for check.
|
@param RomSize Size of ROM for check.
|
||||||
|
|
||||||
@retval TRUE ROM contain EFI Image.
|
@retval TRUE ROM contain EFI Image.
|
||||||
@retval FALSE ROM not contain EFI Image.
|
@retval FALSE ROM not contain EFI Image.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
ContainEfiImage (
|
ContainEfiImage (
|
||||||
IN VOID *RomImage,
|
IN VOID *RomImage,
|
||||||
IN UINT64 RomSize
|
IN UINT64 RomSize
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
PCI_EXPANSION_ROM_HEADER *RomHeader;
|
PCI_EXPANSION_ROM_HEADER *RomHeader;
|
||||||
PCI_DATA_STRUCTURE *RomPcir;
|
PCI_DATA_STRUCTURE *RomPcir;
|
||||||
@ -342,7 +329,7 @@ ContainEfiImage (
|
|||||||
|
|
||||||
FirstCheck = TRUE;
|
FirstCheck = TRUE;
|
||||||
RomHeader = RomImage;
|
RomHeader = RomImage;
|
||||||
|
|
||||||
while ((UINT8 *) RomHeader < (UINT8 *) RomImage + RomSize) {
|
while ((UINT8 *) RomHeader < (UINT8 *) RomImage + RomSize) {
|
||||||
if (RomHeader->Signature != PCI_EXPANSION_ROM_HEADER_SIGNATURE) {
|
if (RomHeader->Signature != PCI_EXPANSION_ROM_HEADER_SIGNATURE) {
|
||||||
if (FirstCheck) {
|
if (FirstCheck) {
|
||||||
@ -355,7 +342,7 @@ ContainEfiImage (
|
|||||||
|
|
||||||
FirstCheck = FALSE;
|
FirstCheck = FALSE;
|
||||||
RomPcir = (PCI_DATA_STRUCTURE *) ((UINT8 *) RomHeader + RomHeader->PcirOffset);
|
RomPcir = (PCI_DATA_STRUCTURE *) ((UINT8 *) RomHeader + RomHeader->PcirOffset);
|
||||||
|
|
||||||
if (RomPcir->CodeType == PCI_CODE_TYPE_EFI_IMAGE) {
|
if (RomPcir->CodeType == PCI_CODE_TYPE_EFI_IMAGE) {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -368,13 +355,14 @@ ContainEfiImage (
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Load option rom image for specified PCI device
|
Load Option Rom image for specified PCI device.
|
||||||
|
|
||||||
@param PciDevice Pci device instance
|
@param PciDevice Pci device instance.
|
||||||
@param RomBase Base address of oprom.
|
@param RomBase Base address of Option Rom.
|
||||||
|
|
||||||
@retval EFI_OUT_OF_RESOURCES not enough memory to hold image
|
@retval EFI_OUT_OF_RESOURCES No enough memory to hold image.
|
||||||
@retval EFI_SUCESS Success
|
@retval EFI_SUCESS Successfully loaded Option Rom.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
LoadOpRomImage (
|
LoadOpRomImage (
|
||||||
@ -543,17 +531,16 @@ LoadOpRomImage (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
enable/disable oprom decode
|
Enable/Disable Option Rom decode.
|
||||||
|
|
||||||
@param PciDevice pci device instance
|
@param PciDevice Pci device instance.
|
||||||
@param RomBarIndex The BAR index of the standard PCI Configuration header to use as the
|
@param RomBarIndex The BAR index of the standard PCI Configuration header to use as the
|
||||||
base address for resource range. The legal range for this field is 0..5.
|
base address for resource range. The legal range for this field is 0..5.
|
||||||
@param RomBar Base address of rom
|
@param RomBar Base address of Option Rom.
|
||||||
@param Enable Flag for enable/disable decode.
|
@param Enable Flag for enable/disable decode.
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
VOID
|
||||||
RomDecode (
|
RomDecode (
|
||||||
IN PCI_IO_DEVICE *PciDevice,
|
IN PCI_IO_DEVICE *PciDevice,
|
||||||
IN UINT8 RomBarIndex,
|
IN UINT8 RomBarIndex,
|
||||||
@ -622,41 +609,41 @@ RomDecode (
|
|||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Process the oprom image.
|
Load and start the Option Rom image.
|
||||||
|
|
||||||
@param PciDevice Pci device instance
|
@param PciDevice Pci device instance.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Successfully loaded and started PCI Option Rom image.
|
||||||
|
@retval EFI_NOT_FOUND Failed to process PCI Option Rom image.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
ProcessOpRomImage (
|
ProcessOpRomImage (
|
||||||
PCI_IO_DEVICE *PciDevice
|
IN PCI_IO_DEVICE *PciDevice
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINT8 Indicator;
|
UINT8 Indicator;
|
||||||
UINT32 ImageSize;
|
UINT32 ImageSize;
|
||||||
VOID *RomBar;
|
VOID *RomBar;
|
||||||
UINT8 *RomBarOffset;
|
UINT8 *RomBarOffset;
|
||||||
EFI_HANDLE ImageHandle;
|
EFI_HANDLE ImageHandle;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_STATUS RetStatus;
|
EFI_STATUS RetStatus;
|
||||||
BOOLEAN FirstCheck;
|
BOOLEAN FirstCheck;
|
||||||
EFI_PCI_EXPANSION_ROM_HEADER *EfiRomHeader;
|
EFI_PCI_EXPANSION_ROM_HEADER *EfiRomHeader;
|
||||||
PCI_DATA_STRUCTURE *Pcir;
|
PCI_DATA_STRUCTURE *Pcir;
|
||||||
EFI_DEVICE_PATH_PROTOCOL *PciOptionRomImageDevicePath;
|
EFI_DEVICE_PATH_PROTOCOL *PciOptionRomImageDevicePath;
|
||||||
|
MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH EfiOpRomImageNode;
|
||||||
MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH EfiOpRomImageNode;
|
VOID *Buffer;
|
||||||
VOID *Buffer;
|
UINTN BufferSize;
|
||||||
UINTN BufferSize;
|
|
||||||
|
|
||||||
Indicator = 0;
|
Indicator = 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get the Address of the Rom image
|
// Get the Address of the Option Rom image
|
||||||
//
|
//
|
||||||
RomBar = PciDevice->PciIo.RomImage;
|
RomBar = PciDevice->PciIo.RomImage;
|
||||||
RomBarOffset = (UINT8 *) RomBar;
|
RomBarOffset = (UINT8 *) RomBar;
|
||||||
@ -694,7 +681,6 @@ ProcessOpRomImage (
|
|||||||
//
|
//
|
||||||
// load image and start image
|
// load image and start image
|
||||||
//
|
//
|
||||||
|
|
||||||
BufferSize = 0;
|
BufferSize = 0;
|
||||||
Buffer = NULL;
|
Buffer = NULL;
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
@ -749,6 +735,5 @@ ProcessOpRomImage (
|
|||||||
} while (((Indicator & 0x80) == 0x00) && ((UINTN) (RomBarOffset - (UINT8 *) RomBar) < PciDevice->RomSize));
|
} while (((Indicator & 0x80) == 0x00) && ((UINTN) (RomBarOffset - (UINT8 *) RomBar) < PciDevice->RomSize));
|
||||||
|
|
||||||
return RetStatus;
|
return RetStatus;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,50 +1,54 @@
|
|||||||
/** @file
|
/** @file
|
||||||
|
PCI Rom supporting funtions declaration for PCI Bus module.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2009, Intel Corporation
|
Copyright (c) 2006 - 2009, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#ifndef _EFI_PCI_OP_ROM_SUPPORT_H_
|
#ifndef _EFI_PCI_OPTION_ROM_SUPPORT_H_
|
||||||
#define _EFI_PCI_OP_ROM_SUPPORT_H_
|
#define _EFI_PCI_OPTION_ROM_SUPPORT_H_
|
||||||
|
|
||||||
#include <Protocol/LoadFile2.h>
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Initialize a PCI LoadFile2 instance.
|
Initialize a PCI LoadFile2 instance.
|
||||||
|
|
||||||
@param PciIoDevice PCI IO Device.
|
@param PciIoDevice PCI IO Device.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
InitializePciLoadFile2 (
|
InitializePciLoadFile2 (
|
||||||
PCI_IO_DEVICE *PciIoDevice
|
IN PCI_IO_DEVICE *PciIoDevice
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Causes the driver to load a specified file.
|
Causes the driver to load a specified file.
|
||||||
|
|
||||||
@param This Indicates a pointer to the calling context.
|
@param This Indicates a pointer to the calling context.
|
||||||
@param FilePath The device specific path of the file to load.
|
@param FilePath The device specific path of the file to load.
|
||||||
@param BootPolicy Should always be FALSE.
|
@param BootPolicy Should always be FALSE.
|
||||||
@param BufferSize On input the size of Buffer in bytes. On output with a return
|
@param BufferSize On input the size of Buffer in bytes. On output with a return
|
||||||
code of EFI_SUCCESS, the amount of data transferred to Buffer.
|
code of EFI_SUCCESS, the amount of data transferred to Buffer.
|
||||||
On output with a return code of EFI_BUFFER_TOO_SMALL,
|
On output with a return code of EFI_BUFFER_TOO_SMALL,
|
||||||
the size of Buffer required to retrieve the requested file.
|
the size of Buffer required to retrieve the requested file.
|
||||||
@param Buffer The memory buffer to transfer the file to. If Buffer is NULL,
|
@param Buffer The memory buffer to transfer the file to. If Buffer is NULL,
|
||||||
then no the size of the requested file is returned in BufferSize.
|
then no the size of the requested file is returned in BufferSize.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The file was loaded.
|
@retval EFI_SUCCESS The file was loaded.
|
||||||
@retval EFI_UNSUPPORTED BootPolicy is TRUE.
|
@retval EFI_UNSUPPORTED BootPolicy is TRUE.
|
||||||
|
@retval EFI_INVALID_PARAMETER FilePath is not a valid device path, or
|
||||||
|
BufferSize is NULL.
|
||||||
|
@retval EFI_NOT_FOUND Not found PCI Option Rom on PCI device.
|
||||||
|
@retval EFI_DEVICE_ERROR Failed to decompress PCI Option Rom image.
|
||||||
@retval EFI_BUFFER_TOO_SMALL The BufferSize is too small to read the current directory entry.
|
@retval EFI_BUFFER_TOO_SMALL The BufferSize is too small to read the current directory entry.
|
||||||
BufferSize has been updated with the size needed to complete the request.
|
BufferSize has been updated with the size needed to complete the request.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
@ -57,30 +61,30 @@ LoadFile2 (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
Check if the RomImage contains EFI Images.
|
Check if the RomImage contains EFI Images.
|
||||||
|
|
||||||
@param RomImage The ROM address of Image for check.
|
@param RomImage The ROM address of Image for check.
|
||||||
@param RomSize Size of ROM for check.
|
@param RomSize Size of ROM for check.
|
||||||
|
|
||||||
@retval TRUE ROM contain EFI Image.
|
@retval TRUE ROM contain EFI Image.
|
||||||
@retval FALSE ROM not contain EFI Image.
|
@retval FALSE ROM not contain EFI Image.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
ContainEfiImage (
|
ContainEfiImage (
|
||||||
IN VOID *RomImage,
|
IN VOID *RomImage,
|
||||||
IN UINT64 RomSize
|
IN UINT64 RomSize
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get Pci device's oprom infor bits.
|
Get Pci device's oprom infor bits.
|
||||||
|
|
||||||
@param PciIoDevice Pci device instance
|
|
||||||
|
|
||||||
@retval EFI_NOT_FOUND Pci device has not oprom
|
@param PciIoDevice Pci device instance.
|
||||||
@retval EFI_SUCCESS Pci device has oprom
|
|
||||||
|
@retval EFI_NOT_FOUND Pci device has not Option Rom.
|
||||||
|
@retval EFI_SUCCESS Pci device has Option Rom.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
GetOpRomInfo (
|
GetOpRomInfo (
|
||||||
@ -88,13 +92,14 @@ GetOpRomInfo (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Load option rom image for specified PCI device
|
Load Option Rom image for specified PCI device.
|
||||||
|
|
||||||
@param PciDevice Pci device instance
|
@param PciDevice Pci device instance.
|
||||||
@param RomBase Base address of oprom.
|
@param RomBase Base address of Option Rom.
|
||||||
|
|
||||||
@retval EFI_OUT_OF_RESOURCES not enough memory to hold image
|
@retval EFI_OUT_OF_RESOURCES No enough memory to hold image.
|
||||||
@retval EFI_SUCESS Success
|
@retval EFI_SUCESS Successfully loaded Option Rom.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
LoadOpRomImage (
|
LoadOpRomImage (
|
||||||
@ -103,17 +108,16 @@ LoadOpRomImage (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
enable/disable oprom decode
|
Enable/Disable Option Rom decode.
|
||||||
|
|
||||||
@param PciDevice pci device instance
|
@param PciDevice Pci device instance.
|
||||||
@param RomBarIndex The BAR index of the standard PCI Configuration header to use as the
|
@param RomBarIndex The BAR index of the standard PCI Configuration header to use as the
|
||||||
base address for resource range. The legal range for this field is 0..5.
|
base address for resource range. The legal range for this field is 0..5.
|
||||||
@param RomBar Base address of rom
|
@param RomBar Base address of Option Rom.
|
||||||
@param Enable Flag for enable/disable decode.
|
@param Enable Flag for enable/disable decode.
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
VOID
|
||||||
RomDecode (
|
RomDecode (
|
||||||
IN PCI_IO_DEVICE *PciDevice,
|
IN PCI_IO_DEVICE *PciDevice,
|
||||||
IN UINT8 RomBarIndex,
|
IN UINT8 RomBarIndex,
|
||||||
@ -122,13 +126,17 @@ RomDecode (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Process the oprom image.
|
Load and start the Option Rom image.
|
||||||
|
|
||||||
@param PciDevice Pci device instance
|
@param PciDevice Pci device instance.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Successfully loaded and started PCI Option Rom image.
|
||||||
|
@retval EFI_NOT_FOUND Failed to process PCI Option Rom image.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
ProcessOpRomImage (
|
ProcessOpRomImage (
|
||||||
PCI_IO_DEVICE *PciDevice
|
IN PCI_IO_DEVICE *PciDevice
|
||||||
);
|
);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
/** @file
|
/** @file
|
||||||
|
Power management support fucntions implementation for PCI Bus module.
|
||||||
|
|
||||||
Copyright (c) 2006, Intel Corporation
|
Copyright (c) 2006 - 2009, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
@ -18,10 +19,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
put the device to D0 state if the device supports
|
put the device to D0 state if the device supports
|
||||||
PCI Power Management.
|
PCI Power Management.
|
||||||
|
|
||||||
@param PciIoDevice Pci device instance
|
@param PciIoDevice PCI device instance.
|
||||||
|
|
||||||
|
@retval EFI_UNSUPPORTED PCI Device does not support power management.
|
||||||
|
@retval EFI_SUCCESS Turned off PWE successfully.
|
||||||
|
|
||||||
@retval EFI_UNSUPPORTED Device do not support power management
|
|
||||||
@retval EFI_SUCCESS Success
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
ResetPowerManagementFeature (
|
ResetPowerManagementFeature (
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
/** @file
|
/** @file
|
||||||
|
Power management support fucntions delaration for PCI Bus module.
|
||||||
|
|
||||||
Copyright (c) 2006, Intel Corporation
|
Copyright (c) 2006 - 2009, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
@ -19,10 +20,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
put the device to D0 state if the device supports
|
put the device to D0 state if the device supports
|
||||||
PCI Power Management.
|
PCI Power Management.
|
||||||
|
|
||||||
@param PciIoDevice Pci device instance
|
@param PciIoDevice PCI device instance.
|
||||||
|
|
||||||
|
@retval EFI_UNSUPPORTED PCI Device does not support power management.
|
||||||
|
@retval EFI_SUCCESS Turned off PWE successfully.
|
||||||
|
|
||||||
@retval EFI_UNSUPPORTED Device do not support power management
|
|
||||||
@retval EFI_SUCCESS Success
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
ResetPowerManagementFeature (
|
ResetPowerManagementFeature (
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,39 +1,20 @@
|
|||||||
/** @file
|
/** @file
|
||||||
|
PCI resouces support functions declaration for PCI Bus module.
|
||||||
|
|
||||||
Copyright (c) 2006, Intel Corporation
|
Copyright (c) 2006 - 2009, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#ifndef _EFI_PCI_RESOURCE_SUPPORT_H_
|
#ifndef _EFI_PCI_RESOURCE_SUPPORT_H_
|
||||||
#define _EFI_PCI_RESOURCE_SUPPORT_H_
|
#define _EFI_PCI_RESOURCE_SUPPORT_H_
|
||||||
|
|
||||||
#define RESERVED_RESOURCE_SIGNATURE SIGNATURE_32 ('r', 's', 'v', 'd')
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
UINT64 Base;
|
|
||||||
UINT64 Length;
|
|
||||||
PCI_BAR_TYPE ResType;
|
|
||||||
} PCI_RESERVED_RESOURCE_NODE;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
UINT32 Signature;
|
|
||||||
LIST_ENTRY Link;
|
|
||||||
PCI_RESERVED_RESOURCE_NODE Node;
|
|
||||||
} PCI_RESERVED_RESOURCE_LIST;
|
|
||||||
|
|
||||||
#define RESOURCED_LIST_FROM_NODE(a) \
|
|
||||||
CR (a, PCI_RESERVED_RESOURCE_LIST, Node, RESERVED_RESOURCE_SIGNATURE)
|
|
||||||
|
|
||||||
#define RESOURCED_LIST_FROM_LINK(a) \
|
|
||||||
CR (a, PCI_RESERVED_RESOURCE_LIST, Link, RESERVED_RESOURCE_SIGNATURE)
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
PciResUsageTypical = 0,
|
PciResUsageTypical = 0,
|
||||||
PciResUsagePadding,
|
PciResUsagePadding,
|
||||||
@ -60,14 +41,13 @@ typedef struct {
|
|||||||
CR (a, PCI_RESOURCE_NODE, Link, PCI_RESOURCE_SIGNATURE)
|
CR (a, PCI_RESOURCE_NODE, Link, PCI_RESOURCE_SIGNATURE)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The function is used to skip VGA range
|
The function is used to skip VGA range.
|
||||||
|
|
||||||
@param Start address including VGA range
|
@param Start Returned start address including VGA range.
|
||||||
@param Length length of VGA range.
|
@param Length The length of VGA range.
|
||||||
|
|
||||||
@retval EFI_SUCCESS success.
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
VOID
|
||||||
SkipVGAAperture (
|
SkipVGAAperture (
|
||||||
OUT UINT64 *Start,
|
OUT UINT64 *Start,
|
||||||
IN UINT64 Length
|
IN UINT64 Length
|
||||||
@ -75,13 +55,12 @@ SkipVGAAperture (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
This function is used to skip ISA aliasing aperture.
|
This function is used to skip ISA aliasing aperture.
|
||||||
|
|
||||||
@param Start address including ISA aliasing aperture.
|
@param Start Returned start address including ISA aliasing aperture.
|
||||||
@param Length length of ISA aliasing aperture.
|
@param Length The length of ISA aliasing aperture.
|
||||||
|
|
||||||
@retval EFI_SUCCESS success.
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
VOID
|
||||||
SkipIsaAliasAperture (
|
SkipIsaAliasAperture (
|
||||||
OUT UINT64 *Start,
|
OUT UINT64 *Start,
|
||||||
IN UINT64 Length
|
IN UINT64 Length
|
||||||
@ -93,88 +72,82 @@ SkipIsaAliasAperture (
|
|||||||
|
|
||||||
@param Bridge PCI resource node for bridge.
|
@param Bridge PCI resource node for bridge.
|
||||||
@param ResNode Resource node want to be inserted.
|
@param ResNode Resource node want to be inserted.
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success.
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
VOID
|
||||||
InsertResourceNode (
|
InsertResourceNode (
|
||||||
PCI_RESOURCE_NODE *Bridge,
|
IN PCI_RESOURCE_NODE *Bridge,
|
||||||
PCI_RESOURCE_NODE *ResNode
|
IN PCI_RESOURCE_NODE *ResNode
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
This routine is used to merge two different resource trees in need of
|
||||||
|
resoure degradation.
|
||||||
|
|
||||||
Routine Description:
|
For example, if an upstream PPB doesn't support,
|
||||||
|
|
||||||
This routine is used to merge two different resource tree in need of
|
|
||||||
resoure degradation. For example, if a upstream PPB doesn't support,
|
|
||||||
prefetchable memory decoding, the PCI bus driver will choose to call this function
|
prefetchable memory decoding, the PCI bus driver will choose to call this function
|
||||||
to merge prefectchable memory resource list into normal memory list.
|
to merge prefectchable memory resource list into normal memory list.
|
||||||
|
|
||||||
If the TypeMerge is TRUE, Res resource type is changed to the type of destination resource
|
If the TypeMerge is TRUE, Res resource type is changed to the type of destination resource
|
||||||
type.
|
type.
|
||||||
|
If Dst is NULL or Res is NULL, ASSERT ().
|
||||||
|
|
||||||
@param Dst Point to destination resource tree.
|
@param Dst Point to destination resource tree.
|
||||||
@param Res Point to source resource tree.
|
@param Res Point to source resource tree.
|
||||||
@param TypeMerge If the TypeMerge is TRUE, Res resource type is changed to the type of
|
@param TypeMerge If the TypeMerge is TRUE, Res resource type is changed to the type of
|
||||||
destination resource type.
|
destination resource type.
|
||||||
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
VOID
|
||||||
MergeResourceTree (
|
MergeResourceTree (
|
||||||
PCI_RESOURCE_NODE *Dst,
|
IN PCI_RESOURCE_NODE *Dst,
|
||||||
PCI_RESOURCE_NODE *Res,
|
IN PCI_RESOURCE_NODE *Res,
|
||||||
BOOLEAN TypeMerge
|
IN BOOLEAN TypeMerge
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This function is used to calculate the IO16 aperture
|
This function is used to calculate the IO16 aperture
|
||||||
for a bridge.
|
for a bridge.
|
||||||
|
|
||||||
@param Bridge PCI resource node for bridge.
|
@param Bridge PCI resource node for bridge.
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success.
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
VOID
|
||||||
CalculateApertureIo16 (
|
CalculateApertureIo16 (
|
||||||
IN PCI_RESOURCE_NODE *Bridge
|
IN PCI_RESOURCE_NODE *Bridge
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This function is used to calculate the resource aperture
|
This function is used to calculate the resource aperture
|
||||||
for a given bridge device.
|
for a given bridge device.
|
||||||
|
|
||||||
@param Bridge Give bridge device.
|
@param Bridge PCI resouce node for given bridge device.
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success.
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
VOID
|
||||||
CalculateResourceAperture (
|
CalculateResourceAperture (
|
||||||
IN PCI_RESOURCE_NODE *Bridge
|
IN PCI_RESOURCE_NODE *Bridge
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get IO/Memory resource infor for given PCI device.
|
Get IO/Memory resource infor for given PCI device.
|
||||||
|
|
||||||
@param PciDev Pci device instance.
|
@param PciDev Pci device instance.
|
||||||
@param IoNode Resource info node for IO .
|
@param IoNode Resource info node for IO .
|
||||||
@param Mem32Node Resource info node for 32-bit memory.
|
@param Mem32Node Resource info node for 32-bit memory.
|
||||||
@param PMem32Node Resource info node for 32-bit PMemory.
|
@param PMem32Node Resource info node for 32-bit Prefetchable Memory.
|
||||||
@param Mem64Node Resource info node for 64-bit memory.
|
@param Mem64Node Resource info node for 64-bit memory.
|
||||||
@param PMem64Node Resource info node for 64-bit PMemory.
|
@param PMem64Node Resource info node for 64-bit Prefetchable Memory.
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success.
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
VOID
|
||||||
GetResourceFromDevice (
|
GetResourceFromDevice (
|
||||||
PCI_IO_DEVICE *PciDev,
|
IN PCI_IO_DEVICE *PciDev,
|
||||||
PCI_RESOURCE_NODE *IoNode,
|
IN PCI_RESOURCE_NODE *IoNode,
|
||||||
PCI_RESOURCE_NODE *Mem32Node,
|
IN PCI_RESOURCE_NODE *Mem32Node,
|
||||||
PCI_RESOURCE_NODE *PMem32Node,
|
IN PCI_RESOURCE_NODE *PMem32Node,
|
||||||
PCI_RESOURCE_NODE *Mem64Node,
|
IN PCI_RESOURCE_NODE *Mem64Node,
|
||||||
PCI_RESOURCE_NODE *PMem64Node
|
IN PCI_RESOURCE_NODE *PMem64Node
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -186,6 +159,10 @@ GetResourceFromDevice (
|
|||||||
@param Bar Bar index.
|
@param Bar Bar index.
|
||||||
@param ResType Type of resource: IO/Memory.
|
@param ResType Type of resource: IO/Memory.
|
||||||
@param ResUsage Resource usage.
|
@param ResUsage Resource usage.
|
||||||
|
|
||||||
|
@return PCI resource node created for given PCI device.
|
||||||
|
NULL means PCI resource node is not created.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
PCI_RESOURCE_NODE *
|
PCI_RESOURCE_NODE *
|
||||||
CreateResourceNode (
|
CreateResourceNode (
|
||||||
@ -198,19 +175,18 @@ CreateResourceNode (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This routine is used to extract resource request from
|
This function is used to extract resource request from
|
||||||
device node list.
|
device node list.
|
||||||
|
|
||||||
@param Bridge Pci device instance.
|
@param Bridge Pci device instance.
|
||||||
@param IoNode Resource info node for IO.
|
@param IoNode Resource info node for IO.
|
||||||
@param Mem32Node Resource info node for 32-bit memory.
|
@param Mem32Node Resource info node for 32-bit memory.
|
||||||
@param PMem32Node Resource info node for 32-bit PMemory.
|
@param PMem32Node Resource info node for 32-bit Prefetchable Memory.
|
||||||
@param Mem64Node Resource info node for 64-bit memory.
|
@param Mem64Node Resource info node for 64-bit memory.
|
||||||
@param PMem64Node Resource info node for 64-bit PMemory.
|
@param PMem64Node Resource info node for 64-bit Prefetchable Memory.
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success.
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
VOID
|
||||||
CreateResourceMap (
|
CreateResourceMap (
|
||||||
IN PCI_IO_DEVICE *Bridge,
|
IN PCI_IO_DEVICE *Bridge,
|
||||||
IN PCI_RESOURCE_NODE *IoNode,
|
IN PCI_RESOURCE_NODE *IoNode,
|
||||||
@ -224,40 +200,38 @@ CreateResourceMap (
|
|||||||
This function is used to do the resource padding for a specific platform.
|
This function is used to do the resource padding for a specific platform.
|
||||||
|
|
||||||
@param PciDev Pci device instance.
|
@param PciDev Pci device instance.
|
||||||
@param IoNode Resource info node for IO.
|
@param IoNode Resource info node for IO.
|
||||||
@param Mem32Node Resource info node for 32-bit memory.
|
@param Mem32Node Resource info node for 32-bit memory.
|
||||||
@param PMem32Node Resource info node for 32-bit PMemory.
|
@param PMem32Node Resource info node for 32-bit Prefetchable Memory.
|
||||||
@param Mem64Node Resource info node for 64-bit memory.
|
@param Mem64Node Resource info node for 64-bit memory.
|
||||||
@param PMem64Node Resource info node for 64-bit PMemory.
|
@param PMem64Node Resource info node for 64-bit Prefetchable Memory.
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success.
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
VOID
|
||||||
ResourcePaddingPolicy (
|
ResourcePaddingPolicy (
|
||||||
PCI_IO_DEVICE *PciDev,
|
IN PCI_IO_DEVICE *PciDev,
|
||||||
PCI_RESOURCE_NODE *IoNode,
|
IN PCI_RESOURCE_NODE *IoNode,
|
||||||
PCI_RESOURCE_NODE *Mem32Node,
|
IN PCI_RESOURCE_NODE *Mem32Node,
|
||||||
PCI_RESOURCE_NODE *PMem32Node,
|
IN PCI_RESOURCE_NODE *PMem32Node,
|
||||||
PCI_RESOURCE_NODE *Mem64Node,
|
IN PCI_RESOURCE_NODE *Mem64Node,
|
||||||
PCI_RESOURCE_NODE *PMem64Node
|
IN PCI_RESOURCE_NODE *PMem64Node
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This function is used to degrade resource if the upstream bridge
|
This function is used to degrade resource if the upstream bridge
|
||||||
doesn't support certain resource. Degradation path is
|
doesn't support certain resource. Degradation path is
|
||||||
PMEM64 -> MEM64 -> MEM32
|
PMEM64 -> MEM64 -> MEM32
|
||||||
PMEM64 -> PMEM32 -> MEM32
|
PMEM64 -> PMEM32 -> MEM32
|
||||||
IO32 -> IO16
|
IO32 -> IO16.
|
||||||
|
|
||||||
@param Bridge Pci device instance.
|
@param Bridge Pci device instance.
|
||||||
@param Mem32Node Resource info node for 32-bit memory.
|
@param Mem32Node Resource info node for 32-bit memory.
|
||||||
@param PMem32Node Resource info node for 32-bit PMemory.
|
@param PMem32Node Resource info node for 32-bit Prefetchable Memory.
|
||||||
@param Mem64Node Resource info node for 64-bit memory.
|
@param Mem64Node Resource info node for 64-bit memory.
|
||||||
@param PMem64Node Resource info node for 64-bit PMemory.
|
@param PMem64Node Resource info node for 64-bit Prefetchable Memory.
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success.
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
VOID
|
||||||
DegradeResource (
|
DegradeResource (
|
||||||
IN PCI_IO_DEVICE *Bridge,
|
IN PCI_IO_DEVICE *Bridge,
|
||||||
IN PCI_RESOURCE_NODE *Mem32Node,
|
IN PCI_RESOURCE_NODE *Mem32Node,
|
||||||
@ -268,12 +242,13 @@ DegradeResource (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Test whether bridge device support decode resource.
|
Test whether bridge device support decode resource.
|
||||||
|
|
||||||
@param Bridge Bridge device instance.
|
@param Bridge Bridge device instance.
|
||||||
@param Decode Decode type according to resource type.
|
@param Decode Decode type according to resource type.
|
||||||
|
|
||||||
@return whether bridge device support decode resource.
|
@return TRUE The bridge device support decode resource.
|
||||||
|
@return FALSE The bridge device don't support decode resource.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
BridgeSupportResourceDecode (
|
BridgeSupportResourceDecode (
|
||||||
@ -282,14 +257,16 @@ BridgeSupportResourceDecode (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This function is used to program the resource allocated
|
This function is used to program the resource allocated
|
||||||
for each resource node.
|
for each resource node under specified bridge.
|
||||||
|
|
||||||
|
@param Base Base address of resource to be progammed.
|
||||||
|
@param Bridge PCI resource node for the bridge device.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Successfully to program all resouces
|
||||||
|
on given PCI bridge device.
|
||||||
|
@retval EFI_OUT_OF_RESOURCES Base is all one.
|
||||||
|
|
||||||
|
|
||||||
@param Base Base address of resource.
|
|
||||||
@param Bridge Bridge device instance.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success.
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
ProgramResource (
|
ProgramResource (
|
||||||
@ -298,43 +275,40 @@ ProgramResource (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Program Bar register.
|
Program Bar register for PCI device.
|
||||||
|
|
||||||
@param Base Base address for resource.
|
@param Base Base address for PCI device resource to be progammed.
|
||||||
@param Node Point to resoure node structure.
|
@param Node Point to resoure node structure.
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success.
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
VOID
|
||||||
ProgramBar (
|
ProgramBar (
|
||||||
IN UINT64 Base,
|
IN UINT64 Base,
|
||||||
IN PCI_RESOURCE_NODE *Node
|
IN PCI_RESOURCE_NODE *Node
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Program PPB apperture.
|
Program PCI-PCI bridge apperture.
|
||||||
|
|
||||||
@param Base Base address for resource.
|
@param Base Base address for resource.
|
||||||
@param Node Point to resoure node structure.
|
@param Node Point to resoure node structure.
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success.
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
VOID
|
||||||
ProgramPpbApperture (
|
ProgramPpbApperture (
|
||||||
IN UINT64 Base,
|
IN UINT64 Base,
|
||||||
IN PCI_RESOURCE_NODE *Node
|
IN PCI_RESOURCE_NODE *Node
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Program parent bridge for oprom.
|
Program parent bridge for Option Rom.
|
||||||
|
|
||||||
@param PciDevice Pci deivce instance.
|
@param PciDevice Pci deivce instance.
|
||||||
@param OptionRomBase Base address for oprom.
|
@param OptionRomBase Base address for Optiona Rom.
|
||||||
@param Enable Enable/Disable.
|
@param Enable Enable or disable PCI memory.
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success.
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
VOID
|
||||||
ProgrameUpstreamBridgeForRom (
|
ProgrameUpstreamBridgeForRom (
|
||||||
IN PCI_IO_DEVICE *PciDevice,
|
IN PCI_IO_DEVICE *PciDevice,
|
||||||
IN UINT32 OptionRomBase,
|
IN UINT32 OptionRomBase,
|
||||||
@ -343,31 +317,35 @@ ProgrameUpstreamBridgeForRom (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Test whether resource exists for a bridge.
|
Test whether resource exists for a bridge.
|
||||||
|
|
||||||
@param Bridge Point to resource node for a bridge.
|
@param Bridge Point to resource node for a bridge.
|
||||||
|
|
||||||
@return whether resource exists.
|
@retval TRUE There is resource on the given bridge.
|
||||||
|
@retval FALSE There isn't resource on the given bridge.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
ResourceRequestExisted (
|
ResourceRequestExisted (
|
||||||
IN PCI_RESOURCE_NODE *Bridge
|
IN PCI_RESOURCE_NODE *Bridge
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Initialize resource pool structure.
|
Initialize resource pool structure.
|
||||||
|
|
||||||
@param ResourcePool Point to resource pool structure.
|
@param ResourcePool Point to resource pool structure. This pool
|
||||||
|
is reset to all zero when returned.
|
||||||
@param ResourceType Type of resource.
|
@param ResourceType Type of resource.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
VOID
|
||||||
InitializeResourcePool (
|
InitializeResourcePool (
|
||||||
PCI_RESOURCE_NODE *ResourcePool,
|
IN OUT PCI_RESOURCE_NODE *ResourcePool,
|
||||||
PCI_BAR_TYPE ResourceType
|
IN PCI_BAR_TYPE ResourceType
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get all resource information for given Pci device.
|
Get all resource information for given Pci device.
|
||||||
|
|
||||||
@param PciDev Pci device instance.
|
@param PciDev Pci device instance.
|
||||||
@param IoBridge Io resource node.
|
@param IoBridge Io resource node.
|
||||||
@param Mem32Bridge 32-bit memory node.
|
@param Mem32Bridge 32-bit memory node.
|
||||||
@ -376,86 +354,66 @@ InitializeResourcePool (
|
|||||||
@param PMem64Bridge 64-bit PMemory node.
|
@param PMem64Bridge 64-bit PMemory node.
|
||||||
@param IoPool Link list header for Io resource.
|
@param IoPool Link list header for Io resource.
|
||||||
@param Mem32Pool Link list header for 32-bit memory.
|
@param Mem32Pool Link list header for 32-bit memory.
|
||||||
@param PMem32Pool Link list header for 32-bit Pmemory.
|
@param PMem32Pool Link list header for 32-bit Prefetchable memory.
|
||||||
@param Mem64Pool Link list header for 64-bit memory.
|
@param Mem64Pool Link list header for 64-bit memory.
|
||||||
@param PMem64Pool Link list header for 64-bit Pmemory.
|
@param PMem64Pool Link list header for 64-bit Prefetchable memory.
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success.
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
VOID
|
||||||
GetResourceMap (
|
GetResourceMap (
|
||||||
PCI_IO_DEVICE *PciDev,
|
IN PCI_IO_DEVICE *PciDev,
|
||||||
PCI_RESOURCE_NODE **IoBridge,
|
IN PCI_RESOURCE_NODE **IoBridge,
|
||||||
PCI_RESOURCE_NODE **Mem32Bridge,
|
IN PCI_RESOURCE_NODE **Mem32Bridge,
|
||||||
PCI_RESOURCE_NODE **PMem32Bridge,
|
IN PCI_RESOURCE_NODE **PMem32Bridge,
|
||||||
PCI_RESOURCE_NODE **Mem64Bridge,
|
IN PCI_RESOURCE_NODE **Mem64Bridge,
|
||||||
PCI_RESOURCE_NODE **PMem64Bridge,
|
IN PCI_RESOURCE_NODE **PMem64Bridge,
|
||||||
PCI_RESOURCE_NODE *IoPool,
|
IN PCI_RESOURCE_NODE *IoPool,
|
||||||
PCI_RESOURCE_NODE *Mem32Pool,
|
IN PCI_RESOURCE_NODE *Mem32Pool,
|
||||||
PCI_RESOURCE_NODE *PMem32Pool,
|
IN PCI_RESOURCE_NODE *PMem32Pool,
|
||||||
PCI_RESOURCE_NODE *Mem64Pool,
|
IN PCI_RESOURCE_NODE *Mem64Pool,
|
||||||
PCI_RESOURCE_NODE *PMem64Pool
|
IN PCI_RESOURCE_NODE *PMem64Pool
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Destory given resource tree.
|
Destory given resource tree.
|
||||||
|
|
||||||
@param Bridge root node of resource tree.
|
@param Bridge PCI resource root node of resource tree.
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success.
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
VOID
|
||||||
DestroyResourceTree (
|
DestroyResourceTree (
|
||||||
IN PCI_RESOURCE_NODE *Bridge
|
IN PCI_RESOURCE_NODE *Bridge
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
|
||||||
Record the reserved resource and insert to reserved list.
|
|
||||||
|
|
||||||
@param Base Base address of reserved resourse.
|
|
||||||
@param Length Length of reserved resource.
|
|
||||||
@param ResType Resource type.
|
|
||||||
@param Bridge Pci device instance.
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
RecordReservedResource (
|
|
||||||
IN UINT64 Base,
|
|
||||||
IN UINT64 Length,
|
|
||||||
IN PCI_BAR_TYPE ResType,
|
|
||||||
IN PCI_IO_DEVICE *Bridge
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Insert resource padding for P2C.
|
Insert resource padding for P2C.
|
||||||
|
|
||||||
@param PciDev Pci device instance.
|
@param PciDev Pci device instance.
|
||||||
@param IoNode Resource info node for IO.
|
@param IoNode Resource info node for IO.
|
||||||
@param Mem32Node Resource info node for 32-bit memory.
|
@param Mem32Node Resource info node for 32-bit memory.
|
||||||
@param PMem32Node Resource info node for 32-bit PMemory.
|
@param PMem32Node Resource info node for 32-bit Prefetchable Memory.
|
||||||
@param Mem64Node Resource info node for 64-bit memory.
|
@param Mem64Node Resource info node for 64-bit memory.
|
||||||
@param PMem64Node Resource info node for 64-bit PMemory.
|
@param PMem64Node Resource info node for 64-bit Prefetchable Memory.
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success.
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
VOID
|
||||||
ResourcePaddingForCardBusBridge (
|
ResourcePaddingForCardBusBridge (
|
||||||
PCI_IO_DEVICE *PciDev,
|
IN PCI_IO_DEVICE *PciDev,
|
||||||
PCI_RESOURCE_NODE *IoNode,
|
IN PCI_RESOURCE_NODE *IoNode,
|
||||||
PCI_RESOURCE_NODE *Mem32Node,
|
IN PCI_RESOURCE_NODE *Mem32Node,
|
||||||
PCI_RESOURCE_NODE *PMem32Node,
|
IN PCI_RESOURCE_NODE *PMem32Node,
|
||||||
PCI_RESOURCE_NODE *Mem64Node,
|
IN PCI_RESOURCE_NODE *Mem64Node,
|
||||||
PCI_RESOURCE_NODE *PMem64Node
|
IN PCI_RESOURCE_NODE *PMem64Node
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Program P2C register for given resource node.
|
Program PCI Card device register for given resource node.
|
||||||
|
|
||||||
@param Base Base address of P2C device.
|
@param Base Base address of PCI Card device to be programmed.
|
||||||
@param Node Given resource node.
|
@param Node Given resource node.
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success.
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
VOID
|
||||||
ProgramP2C (
|
ProgramP2C (
|
||||||
IN UINT64 Base,
|
IN UINT64 Base,
|
||||||
IN PCI_RESOURCE_NODE *Node
|
IN PCI_RESOURCE_NODE *Node
|
||||||
@ -463,49 +421,36 @@ ProgramP2C (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Create padding resource node.
|
Create padding resource node.
|
||||||
|
|
||||||
@param PciDev Pci device instance.
|
@param PciDev Pci device instance.
|
||||||
@param IoNode Resource info node for IO.
|
@param IoNode Resource info node for IO.
|
||||||
@param Mem32Node Resource info node for 32-bit memory.
|
@param Mem32Node Resource info node for 32-bit memory.
|
||||||
@param PMem32Node Resource info node for 32-bit PMemory.
|
@param PMem32Node Resource info node for 32-bit Prefetchable Memory.
|
||||||
@param Mem64Node Resource info node for 64-bit memory.
|
@param Mem64Node Resource info node for 64-bit memory.
|
||||||
@param PMem64Node Resource info node for 64-bit PMemory.
|
@param PMem64Node Resource info node for 64-bit Prefetchable Memory.
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
VOID
|
||||||
ApplyResourcePadding (
|
ApplyResourcePadding (
|
||||||
PCI_IO_DEVICE *PciDev,
|
IN PCI_IO_DEVICE *PciDev,
|
||||||
PCI_RESOURCE_NODE *IoNode,
|
IN PCI_RESOURCE_NODE *IoNode,
|
||||||
PCI_RESOURCE_NODE *Mem32Node,
|
IN PCI_RESOURCE_NODE *Mem32Node,
|
||||||
PCI_RESOURCE_NODE *PMem32Node,
|
IN PCI_RESOURCE_NODE *PMem32Node,
|
||||||
PCI_RESOURCE_NODE *Mem64Node,
|
IN PCI_RESOURCE_NODE *Mem64Node,
|
||||||
PCI_RESOURCE_NODE *PMem64Node
|
IN PCI_RESOURCE_NODE *PMem64Node
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get padding resource for PPB
|
Get padding resource for PCI-PCI bridge.
|
||||||
Light PCI bus driver woundn't support hotplug root device
|
|
||||||
So no need to pad resource for them.
|
|
||||||
|
|
||||||
@param PciIoDevice Pci device instance.
|
@param PciIoDevice PCI-PCI bridge device instance.
|
||||||
|
|
||||||
|
@note Feature flag PcdPciBusHotplugDeviceSupport determines
|
||||||
|
whether need to pad resource for them.
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
GetResourcePaddingPpb (
|
GetResourcePaddingPpb (
|
||||||
IN PCI_IO_DEVICE *PciIoDevice
|
IN PCI_IO_DEVICE *PciIoDevice
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
|
||||||
Reset and all bus number from specific bridge.
|
|
||||||
|
|
||||||
@param Bridge Parent specific bridge.
|
|
||||||
@param StartBusNumber start bus number.
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
ResetAllPpbBusNumber (
|
|
||||||
IN PCI_IO_DEVICE *Bridge,
|
|
||||||
IN UINT8 StartBusNumber
|
|
||||||
);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,20 +1,22 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Option Rom Support for PCI Bus Driver
|
Set up ROM Table for PCI Bus module.
|
||||||
|
|
||||||
Copyright (c) 2006, Intel Corporation
|
Copyright (c) 2006 - 2009, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#include "PciBus.h"
|
#include "PciBus.h"
|
||||||
#include "PciRomTable.h"
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// PCI ROM image information
|
||||||
|
//
|
||||||
typedef struct {
|
typedef struct {
|
||||||
EFI_HANDLE ImageHandle;
|
EFI_HANDLE ImageHandle;
|
||||||
UINTN Seg;
|
UINTN Seg;
|
||||||
@ -31,7 +33,7 @@ EFI_PCI_ROM_IMAGE_MAPPING *mRomImageTable = NULL;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Add the Rom Image to internal database for later PCI light enumeration.
|
Add the Rom Image to internal database for later PCI light enumeration.
|
||||||
|
|
||||||
@param ImageHandle Option Rom image handle.
|
@param ImageHandle Option Rom image handle.
|
||||||
@param Seg Segment of PCI space.
|
@param Seg Segment of PCI space.
|
||||||
@param Bus Bus NO of PCI space.
|
@param Bus Bus NO of PCI space.
|
||||||
@ -39,16 +41,17 @@ EFI_PCI_ROM_IMAGE_MAPPING *mRomImageTable = NULL;
|
|||||||
@param Func Func NO of PCI space.
|
@param Func Func NO of PCI space.
|
||||||
@param RomAddress Base address of OptionRom.
|
@param RomAddress Base address of OptionRom.
|
||||||
@param RomLength Length of rom image.
|
@param RomLength Length of rom image.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
PciRomAddImageMapping (
|
PciRomAddImageMapping (
|
||||||
IN EFI_HANDLE ImageHandle,
|
IN EFI_HANDLE ImageHandle,
|
||||||
IN UINTN Seg,
|
IN UINTN Seg,
|
||||||
IN UINT8 Bus,
|
IN UINT8 Bus,
|
||||||
IN UINT8 Dev,
|
IN UINT8 Dev,
|
||||||
IN UINT8 Func,
|
IN UINT8 Func,
|
||||||
IN UINT64 RomAddress,
|
IN UINT64 RomAddress,
|
||||||
IN UINT64 RomLength
|
IN UINT64 RomLength
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_PCI_ROM_IMAGE_MAPPING *TempMapping;
|
EFI_PCI_ROM_IMAGE_MAPPING *TempMapping;
|
||||||
@ -84,16 +87,16 @@ PciRomAddImageMapping (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Get Option rom driver's mapping for PCI device.
|
Get Option rom driver's mapping for PCI device.
|
||||||
|
|
||||||
@param PciIoDevice Device instance.
|
@param PciIoDevice Device instance.
|
||||||
|
|
||||||
@retval TRUE Found Image mapping.
|
@retval TRUE Found Image mapping.
|
||||||
@retval FALSE
|
@retval FALSE Cannot found image mapping.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
PciRomGetImageMapping (
|
PciRomGetImageMapping (
|
||||||
PCI_IO_DEVICE *PciIoDevice
|
IN PCI_IO_DEVICE *PciIoDevice
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
|
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Option Rom Support for PCI Bus Driver
|
Set up ROM Table for PCI Bus module.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2009, Intel Corporation
|
Copyright (c) 2006 - 2009, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Add the Rom Image to internal database for later PCI light enumeration.
|
Add the Rom Image to internal database for later PCI light enumeration.
|
||||||
|
|
||||||
@param ImageHandle Option Rom image handle.
|
@param ImageHandle Option Rom image handle.
|
||||||
@param Seg Segment of PCI space.
|
@param Seg Segment of PCI space.
|
||||||
@param Bus Bus NO of PCI space.
|
@param Bus Bus NO of PCI space.
|
||||||
@ -25,30 +25,31 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
@param Func Func NO of PCI space.
|
@param Func Func NO of PCI space.
|
||||||
@param RomAddress Base address of OptionRom.
|
@param RomAddress Base address of OptionRom.
|
||||||
@param RomLength Length of rom image.
|
@param RomLength Length of rom image.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
PciRomAddImageMapping (
|
PciRomAddImageMapping (
|
||||||
IN EFI_HANDLE ImageHandle,
|
IN EFI_HANDLE ImageHandle,
|
||||||
IN UINTN Seg,
|
IN UINTN Seg,
|
||||||
IN UINT8 Bus,
|
IN UINT8 Bus,
|
||||||
IN UINT8 Dev,
|
IN UINT8 Dev,
|
||||||
IN UINT8 Func,
|
IN UINT8 Func,
|
||||||
IN UINT64 RomAddress,
|
IN UINT64 RomAddress,
|
||||||
IN UINT64 RomLength
|
IN UINT64 RomLength
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get Option rom driver's mapping for PCI device.
|
Get Option rom driver's mapping for PCI device.
|
||||||
|
|
||||||
@param PciIoDevice Device instance.
|
@param PciIoDevice Device instance.
|
||||||
|
|
||||||
@retval TRUE Found Image mapping.
|
@retval TRUE Found Image mapping.
|
||||||
@retval FALSE
|
@retval FALSE Cannot found image mapping.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
PciRomGetImageMapping (
|
PciRomGetImageMapping (
|
||||||
PCI_IO_DEVICE *PciIoDevice
|
IN PCI_IO_DEVICE *PciIoDevice
|
||||||
);
|
);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
/** @file
|
/** @file
|
||||||
PCI Incompatible device support Libary. Platform can implement an
|
PCI Incompatible device support Libary. Platform can implement an
|
||||||
instance to support the incompatible PCI devices.
|
instance to support the incompatible PCI devices.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2009, Intel Corporation
|
Copyright (c) 2006 - 2009, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
@ -65,20 +65,23 @@ typedef struct {
|
|||||||
} EFI_PCI_RESOUCE_DESCRIPTOR;
|
} EFI_PCI_RESOUCE_DESCRIPTOR;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Checks the incompatible device list for ACPI resource update and return
|
Check the incompatible device list for ACPI resource update and return
|
||||||
the configuration.
|
the configuration.
|
||||||
|
|
||||||
This function searches the incompatible device list according to request
|
This function searches the incompatible device list according to request
|
||||||
information. If the PCI device belongs to the devices list, corresponding
|
information. If the PCI device belongs to the devices list, corresponding
|
||||||
configuration informtion will be returned, in the meantime return EFI_SUCCESS.
|
configuration informtion will be returned, in the meantime return EFI_SUCCESS.
|
||||||
|
|
||||||
@param PciDeviceInfo A pointer to PCI device information.
|
@param PciDeviceInfo A pointer to PCI device information.
|
||||||
@param Configuration Returned information.
|
@param Configuration Returned information.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS If check incompatible device successfully.
|
||||||
|
@retval EFI_ABORTED No any resource type.
|
||||||
|
@retval EFI_OUT_OF_RESOURCES No memory available.
|
||||||
|
@retval EFI_UNSUPPORTED Invalid Tag encounted.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The incompatible device is supported.
|
|
||||||
@retval EFI_UNSUPPORTED The incompatible device is not supported.
|
|
||||||
**/
|
**/
|
||||||
RETURN_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
PciResourceUpdateCheck (
|
PciResourceUpdateCheck (
|
||||||
IN EFI_PCI_DEVICE_INFO *PciDeviceInfo,
|
IN EFI_PCI_DEVICE_INFO *PciDeviceInfo,
|
||||||
@ -86,7 +89,7 @@ PciResourceUpdateCheck (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Checks the incompatible device list and return configuration register mask values.
|
Check the incompatible device list and return configuraton register mask values.
|
||||||
|
|
||||||
This function searches the incompatible device list according to request
|
This function searches the incompatible device list according to request
|
||||||
information. If the PCI device belongs to the devices list, corresponding
|
information. If the PCI device belongs to the devices list, corresponding
|
||||||
@ -97,10 +100,11 @@ PciResourceUpdateCheck (
|
|||||||
@param Offset The address within the PCI configuration space.
|
@param Offset The address within the PCI configuration space.
|
||||||
@param Configuration Returned information.
|
@param Configuration Returned information.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The incompatible device is supported.
|
@retval EFI_SUCCESS If check incompatible device successfully.
|
||||||
@retval EFI_UNSUPPORTED The incompatible device is not supported.
|
@retval EFI_UNSUPPORTED Failed to check incompatibility device.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
RETURN_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
PciRegisterUpdateCheck (
|
PciRegisterUpdateCheck (
|
||||||
IN EFI_PCI_DEVICE_INFO *PciDeviceInfo,
|
IN EFI_PCI_DEVICE_INFO *PciDeviceInfo,
|
||||||
@ -110,7 +114,7 @@ PciRegisterUpdateCheck (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Checks the incompatible device list for access width incompatibility and
|
Check the incompatible device list for access width incompatibility and
|
||||||
return the configuration
|
return the configuration
|
||||||
|
|
||||||
This function searches the incompatible device list for access width
|
This function searches the incompatible device list for access width
|
||||||
@ -124,10 +128,11 @@ PciRegisterUpdateCheck (
|
|||||||
@param AccessWidth Access width needs to check incompatibility.
|
@param AccessWidth Access width needs to check incompatibility.
|
||||||
@param Configuration Returned information.
|
@param Configuration Returned information.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The incompatible device is supported.
|
@retval EFI_SUCCESS If check incompatible device successfully.
|
||||||
@retval EFI_UNSUPPORTED The incompatible device is not supported.
|
@retval EFI_UNSUPPORTED Failed to check incompatibility device.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
RETURN_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
PciRegisterAccessCheck (
|
PciRegisterAccessCheck (
|
||||||
IN EFI_PCI_DEVICE_INFO *PciDeviceInfo,
|
IN EFI_PCI_DEVICE_INFO *PciDeviceInfo,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
The incompatible PCI device list
|
The incompatible PCI device list template.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2007, Intel Corporation
|
Copyright (c) 2006 - 2009, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -19,7 +19,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
#include <Library/MemoryAllocationLib.h>
|
#include <Library/MemoryAllocationLib.h>
|
||||||
#include <Library/DebugLib.h>
|
#include <Library/DebugLib.h>
|
||||||
|
|
||||||
#include <IndustryStandard/Pci22.h>
|
#include <IndustryStandard/Pci.h>
|
||||||
#include <IndustryStandard/Acpi.h>
|
#include <IndustryStandard/Acpi.h>
|
||||||
|
|
||||||
|
|
||||||
@ -51,11 +51,10 @@ typedef struct {
|
|||||||
EFI_PCI_REGISTER_VALUE_DATA PciRegisterValueData;
|
EFI_PCI_REGISTER_VALUE_DATA PciRegisterValueData;
|
||||||
} EFI_PCI_REGISTER_VALUE_DESCRIPTOR;
|
} EFI_PCI_REGISTER_VALUE_DESCRIPTOR;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// the incompatible PCI devices list for ACPI resource
|
// the incompatible PCI devices list for ACPI resource
|
||||||
//
|
//
|
||||||
GLOBAL_REMOVE_IF_UNREFERENCED UINT64 IncompatiblePciDeviceListForResource[] = {
|
GLOBAL_REMOVE_IF_UNREFERENCED UINT64 gIncompatiblePciDeviceListForResource[] = {
|
||||||
//
|
//
|
||||||
// DEVICE_INF_TAG,
|
// DEVICE_INF_TAG,
|
||||||
// PCI_DEVICE_ID (VendorID, DeviceID, Revision, SubVendorId, SubDeviceId),
|
// PCI_DEVICE_ID (VendorID, DeviceID, Revision, SubVendorId, SubDeviceId),
|
||||||
@ -63,76 +62,37 @@ GLOBAL_REMOVE_IF_UNREFERENCED UINT64 IncompatiblePciDeviceListForResource[] = {
|
|||||||
// ResType, GFlag , SFlag, Granularity, RangeMin,
|
// ResType, GFlag , SFlag, Granularity, RangeMin,
|
||||||
// RangeMax, Offset, AddrLen
|
// RangeMax, Offset, AddrLen
|
||||||
//
|
//
|
||||||
|
|
||||||
//
|
//
|
||||||
// Device Adaptec 9004
|
// Sample Device 1
|
||||||
//
|
//
|
||||||
DEVICE_INF_TAG,
|
//DEVICE_INF_TAG,
|
||||||
PCI_DEVICE_ID(0x9004, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),
|
//PCI_DEVICE_ID(0xXXXX, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),
|
||||||
DEVICE_RES_TAG,
|
//DEVICE_RES_TAG,
|
||||||
PCI_BAR_TYPE_IO,
|
//PCI_BAR_TYPE_IO,
|
||||||
PCI_ACPI_UNUSED,
|
//PCI_ACPI_UNUSED,
|
||||||
PCI_ACPI_UNUSED,
|
//PCI_ACPI_UNUSED,
|
||||||
PCI_ACPI_UNUSED,
|
//PCI_ACPI_UNUSED,
|
||||||
PCI_ACPI_UNUSED,
|
//PCI_ACPI_UNUSED,
|
||||||
PCI_BAR_EVEN_ALIGN,
|
//PCI_BAR_EVEN_ALIGN,
|
||||||
PCI_BAR_ALL,
|
//PCI_BAR_ALL,
|
||||||
PCI_BAR_NOCHANGE,
|
//PCI_BAR_NOCHANGE,
|
||||||
|
|
||||||
//
|
//
|
||||||
// Device Adaptec 9005
|
// Sample Device 2
|
||||||
//
|
//
|
||||||
DEVICE_INF_TAG,
|
//DEVICE_INF_TAG,
|
||||||
PCI_DEVICE_ID(0x9005, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),
|
//PCI_DEVICE_ID(0xXXXX, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),
|
||||||
DEVICE_RES_TAG,
|
//DEVICE_RES_TAG,
|
||||||
PCI_BAR_TYPE_IO,
|
//PCI_BAR_TYPE_IO,
|
||||||
PCI_ACPI_UNUSED,
|
//PCI_ACPI_UNUSED,
|
||||||
PCI_ACPI_UNUSED,
|
//PCI_ACPI_UNUSED,
|
||||||
PCI_ACPI_UNUSED,
|
//PCI_ACPI_UNUSED,
|
||||||
PCI_ACPI_UNUSED,
|
//PCI_ACPI_UNUSED,
|
||||||
PCI_BAR_EVEN_ALIGN,
|
//PCI_BAR_EVEN_ALIGN,
|
||||||
PCI_BAR_ALL,
|
//PCI_BAR_ALL,
|
||||||
PCI_BAR_NOCHANGE,
|
//PCI_BAR_NOCHANGE,
|
||||||
//
|
|
||||||
// Device QLogic 1007
|
|
||||||
//
|
|
||||||
DEVICE_INF_TAG,
|
|
||||||
PCI_DEVICE_ID(0x1077, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),
|
|
||||||
DEVICE_RES_TAG,
|
|
||||||
PCI_BAR_TYPE_IO,
|
|
||||||
PCI_ACPI_UNUSED,
|
|
||||||
PCI_ACPI_UNUSED,
|
|
||||||
PCI_ACPI_UNUSED,
|
|
||||||
PCI_ACPI_UNUSED,
|
|
||||||
PCI_BAR_EVEN_ALIGN,
|
|
||||||
PCI_BAR_ALL,
|
|
||||||
PCI_BAR_NOCHANGE,
|
|
||||||
//
|
|
||||||
// Device Agilent 103C
|
|
||||||
//
|
|
||||||
DEVICE_INF_TAG,
|
|
||||||
PCI_DEVICE_ID(0x103C, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),
|
|
||||||
DEVICE_RES_TAG,
|
|
||||||
PCI_BAR_TYPE_IO,
|
|
||||||
PCI_ACPI_UNUSED,
|
|
||||||
PCI_ACPI_UNUSED,
|
|
||||||
PCI_ACPI_UNUSED,
|
|
||||||
PCI_ACPI_UNUSED,
|
|
||||||
PCI_BAR_EVEN_ALIGN,
|
|
||||||
PCI_BAR_ALL,
|
|
||||||
PCI_BAR_NOCHANGE,
|
|
||||||
//
|
|
||||||
// Device Agilent 15BC
|
|
||||||
//
|
|
||||||
DEVICE_INF_TAG,
|
|
||||||
PCI_DEVICE_ID(0x15BC, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),
|
|
||||||
DEVICE_RES_TAG,
|
|
||||||
PCI_BAR_TYPE_IO,
|
|
||||||
PCI_ACPI_UNUSED,
|
|
||||||
PCI_ACPI_UNUSED,
|
|
||||||
PCI_ACPI_UNUSED,
|
|
||||||
PCI_ACPI_UNUSED,
|
|
||||||
PCI_BAR_EVEN_ALIGN,
|
|
||||||
PCI_BAR_ALL,
|
|
||||||
PCI_BAR_NOCHANGE,
|
|
||||||
//
|
//
|
||||||
// The end of the list
|
// The end of the list
|
||||||
//
|
//
|
||||||
@ -142,7 +102,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED UINT64 IncompatiblePciDeviceListForResource[] = {
|
|||||||
//
|
//
|
||||||
// the incompatible PCI devices list for the values of configuration registers
|
// the incompatible PCI devices list for the values of configuration registers
|
||||||
//
|
//
|
||||||
GLOBAL_REMOVE_IF_UNREFERENCED UINT64 IncompatiblePciDeviceListForRegister[] = {
|
GLOBAL_REMOVE_IF_UNREFERENCED UINT64 gIncompatiblePciDeviceListForRegister[] = {
|
||||||
//
|
//
|
||||||
// DEVICE_INF_TAG,
|
// DEVICE_INF_TAG,
|
||||||
// PCI_DEVICE_ID (VendorID, DeviceID, Revision, SubVendorId, SubDeviceId),
|
// PCI_DEVICE_ID (VendorID, DeviceID, Revision, SubVendorId, SubDeviceId),
|
||||||
@ -151,26 +111,26 @@ GLOBAL_REMOVE_IF_UNREFERENCED UINT64 IncompatiblePciDeviceListForRegister[] = {
|
|||||||
// AND_VALUE, OR_VALUE
|
// AND_VALUE, OR_VALUE
|
||||||
|
|
||||||
//
|
//
|
||||||
// Device Lava 0x1407, DeviceId 0x0110
|
// Sample Device 1
|
||||||
//
|
//
|
||||||
DEVICE_INF_TAG,
|
//DEVICE_INF_TAG,
|
||||||
PCI_DEVICE_ID(0x1407, 0x0110, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),
|
//PCI_DEVICE_ID(0xXXXX, 0xXXXX, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),
|
||||||
DEVICE_RES_TAG,
|
//DEVICE_RES_TAG,
|
||||||
PCI_REGISTER_READ,
|
//PCI_REGISTER_READ,
|
||||||
PCI_CAPBILITY_POINTER_OFFSET,
|
//PCI_CAPBILITY_POINTER_OFFSET,
|
||||||
0xffffff00,
|
//0xffffff00,
|
||||||
VALUE_NOCARE,
|
//VALUE_NOCARE,
|
||||||
|
|
||||||
//
|
//
|
||||||
// Device Lava 0x1407, DeviceId 0x0111
|
// Sample Device 2
|
||||||
//
|
//
|
||||||
DEVICE_INF_TAG,
|
//DEVICE_INF_TAG,
|
||||||
PCI_DEVICE_ID(0x1407, 0x0111, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),
|
//PCI_DEVICE_ID(0xXXXX, 0xXXXX, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),
|
||||||
DEVICE_RES_TAG,
|
//DEVICE_RES_TAG,
|
||||||
PCI_REGISTER_READ,
|
//PCI_REGISTER_READ,
|
||||||
PCI_CAPBILITY_POINTER_OFFSET,
|
//PCI_CAPBILITY_POINTER_OFFSET,
|
||||||
0xffffff00,
|
//0xffffff00,
|
||||||
VALUE_NOCARE,
|
//VALUE_NOCARE,
|
||||||
|
|
||||||
//
|
//
|
||||||
// The end of the list
|
// The end of the list
|
||||||
@ -181,7 +141,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED UINT64 IncompatiblePciDeviceListForRegister[] = {
|
|||||||
//
|
//
|
||||||
// the incompatible PCI devices list for the access width of configuration registers
|
// the incompatible PCI devices list for the access width of configuration registers
|
||||||
//
|
//
|
||||||
GLOBAL_REMOVE_IF_UNREFERENCED UINT64 DeviceListForAccessWidth[] = {
|
GLOBAL_REMOVE_IF_UNREFERENCED UINT64 gDeviceListForAccessWidth[] = {
|
||||||
//
|
//
|
||||||
// DEVICE_INF_TAG,
|
// DEVICE_INF_TAG,
|
||||||
// PCI_DEVICE_ID (VendorID, DeviceID, Revision, SubVendorId, SubDeviceId),
|
// PCI_DEVICE_ID (VendorID, DeviceID, Revision, SubVendorId, SubDeviceId),
|
||||||
|
@ -1,26 +1,32 @@
|
|||||||
/** @file
|
/** @file
|
||||||
The implementation of PCI incompatible device support libary.
|
The template of PCI incompatible device support libary.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2007, Intel Corporation
|
Copyright (c) 2006 - 2009, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#include "IncompatiblePciDeviceList.h"
|
#include "IncompatiblePciDeviceList.h"
|
||||||
|
|
||||||
|
EFI_PCI_REGISTER_ACCESS_DATA mPciRegisterAccessData = {0, 0, 0};
|
||||||
|
EFI_PCI_REGISTER_VALUE_DATA mPciRegisterValueData = {0, 0};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Check whether two PCI devices matched
|
Check whether two PCI devices matched.
|
||||||
|
|
||||||
@param PciDeviceInfo A pointer to EFI_PCI_DEVICE_INFO.
|
@param PciDeviceInfo A pointer to EFI_PCI_DEVICE_INFO.
|
||||||
@param Header A pointer to EFI_PCI_DEVICE_INFO.
|
@param Header A pointer to EFI_PCI_DEVICE_INFO.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Two PCI devices matched.
|
||||||
|
@retval EFI_UNSUPPORTED Two PCI devices don't match.
|
||||||
|
|
||||||
@retval returns EFI_SUCCESS if two PCI device matched.
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
DeviceCheck (
|
DeviceCheck (
|
||||||
@ -67,19 +73,22 @@ DeviceCheck (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Check the incompatible device list for ACPI resource update and return
|
Check the incompatible device list for ACPI resource update and return
|
||||||
the configuration
|
the configuration.
|
||||||
|
|
||||||
This function searches the incompatible device list according to request
|
This function searches the incompatible device list according to request
|
||||||
information. If the PCI device belongs to the devices list, corresponding
|
information. If the PCI device belongs to the devices list, corresponding
|
||||||
configuration informtion will be returned, in the meantime return EFI_SUCCESS.
|
configuration informtion will be returned, in the meantime return EFI_SUCCESS.
|
||||||
|
|
||||||
@param PciDeviceInfo A pointer to PCI device information.
|
@param PciDeviceInfo A pointer to PCI device information.
|
||||||
@param Configuration Returned information.
|
@param Configuration Returned information.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS If check incompatible device successfully.
|
||||||
|
@retval EFI_ABORTED No any resource type.
|
||||||
|
@retval EFI_OUT_OF_RESOURCES No memory available.
|
||||||
|
@retval EFI_UNSUPPORTED Invalid Tag encounted.
|
||||||
|
|
||||||
@retval returns EFI_SUCCESS if check incompatible device ok.
|
|
||||||
Otherwise return EFI_UNSUPPORTED.
|
|
||||||
**/
|
**/
|
||||||
RETURN_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
PciResourceUpdateCheck (
|
PciResourceUpdateCheck (
|
||||||
IN EFI_PCI_DEVICE_INFO *PciDeviceInfo,
|
IN EFI_PCI_DEVICE_INFO *PciDeviceInfo,
|
||||||
@ -103,7 +112,7 @@ PciResourceUpdateCheck (
|
|||||||
//
|
//
|
||||||
* (VOID **) Configuration = NULL;
|
* (VOID **) Configuration = NULL;
|
||||||
|
|
||||||
ListPtr = IncompatiblePciDeviceListForResource;
|
ListPtr = gIncompatiblePciDeviceListForResource;
|
||||||
while (*ListPtr != LIST_END_TAG) {
|
while (*ListPtr != LIST_END_TAG) {
|
||||||
|
|
||||||
Tag = *ListPtr;
|
Tag = *ListPtr;
|
||||||
@ -136,7 +145,7 @@ PciResourceUpdateCheck (
|
|||||||
|
|
||||||
AcpiPtr = AllocateZeroPool (
|
AcpiPtr = AllocateZeroPool (
|
||||||
sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR) * Index + sizeof (EFI_ACPI_END_TAG_DESCRIPTOR)
|
sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR) * Index + sizeof (EFI_ACPI_END_TAG_DESCRIPTOR)
|
||||||
);
|
);
|
||||||
if (AcpiPtr == NULL) {
|
if (AcpiPtr == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
@ -204,10 +213,11 @@ PciResourceUpdateCheck (
|
|||||||
@param Offset The address within the PCI configuration space.
|
@param Offset The address within the PCI configuration space.
|
||||||
@param Configuration Returned information.
|
@param Configuration Returned information.
|
||||||
|
|
||||||
@retval returns EFI_SUCCESS if check incompatible device ok.
|
@retval EFI_SUCCESS If check incompatible device successfully.
|
||||||
Otherwise return EFI_UNSUPPORTED.
|
@retval EFI_UNSUPPORTED Failed to check incompatibility device.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
RETURN_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
PciRegisterUpdateCheck (
|
PciRegisterUpdateCheck (
|
||||||
IN EFI_PCI_DEVICE_INFO *PciDeviceInfo,
|
IN EFI_PCI_DEVICE_INFO *PciDeviceInfo,
|
||||||
@ -224,7 +234,7 @@ PciRegisterUpdateCheck (
|
|||||||
|
|
||||||
ASSERT (PciDeviceInfo != NULL);
|
ASSERT (PciDeviceInfo != NULL);
|
||||||
|
|
||||||
ListPtr = IncompatiblePciDeviceListForRegister;
|
ListPtr = gIncompatiblePciDeviceListForRegister;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Initialize the return value to NULL
|
// Initialize the return value to NULL
|
||||||
@ -257,10 +267,8 @@ PciRegisterUpdateCheck (
|
|||||||
if (((EFI_PCI_REGISTER_VALUE_DESCRIPTOR *)ListPtr)->AccessType == AccessType) {
|
if (((EFI_PCI_REGISTER_VALUE_DESCRIPTOR *)ListPtr)->AccessType == AccessType) {
|
||||||
|
|
||||||
Dsc = (EFI_PCI_REGISTER_VALUE_DATA *) (ListPtr + 2);
|
Dsc = (EFI_PCI_REGISTER_VALUE_DATA *) (ListPtr + 2);
|
||||||
RegisterPtr = AllocateZeroPool (sizeof (EFI_PCI_REGISTER_VALUE_DATA));
|
|
||||||
if (RegisterPtr == NULL) {
|
RegisterPtr = &mPciRegisterValueData;
|
||||||
return EFI_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
RegisterPtr->AndValue = Dsc->AndValue;
|
RegisterPtr->AndValue = Dsc->AndValue;
|
||||||
RegisterPtr->OrValue = Dsc->OrValue;
|
RegisterPtr->OrValue = Dsc->OrValue;
|
||||||
@ -304,10 +312,11 @@ PciRegisterUpdateCheck (
|
|||||||
@param AccessWidth Access width needs to check incompatibility.
|
@param AccessWidth Access width needs to check incompatibility.
|
||||||
@param Configuration Returned information.
|
@param Configuration Returned information.
|
||||||
|
|
||||||
@retval returns EFI_SUCCESS if check incompatible device ok.
|
@retval EFI_SUCCESS If check incompatible device successfully.
|
||||||
Otherwise return EFI_UNSUPPORTED.
|
@retval EFI_UNSUPPORTED Failed to check incompatibility device.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
RETURN_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
PciRegisterAccessCheck (
|
PciRegisterAccessCheck (
|
||||||
IN EFI_PCI_DEVICE_INFO *PciDeviceInfo,
|
IN EFI_PCI_DEVICE_INFO *PciDeviceInfo,
|
||||||
@ -325,7 +334,7 @@ PciRegisterAccessCheck (
|
|||||||
|
|
||||||
ASSERT (PciDeviceInfo != NULL);
|
ASSERT (PciDeviceInfo != NULL);
|
||||||
|
|
||||||
ListPtr = DeviceListForAccessWidth;
|
ListPtr = gDeviceListForAccessWidth;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Initialize the return value to NULL
|
// Initialize the return value to NULL
|
||||||
@ -361,10 +370,7 @@ PciRegisterAccessCheck (
|
|||||||
|
|
||||||
if((Dsc->StartOffset <= Offset) && (Dsc->EndOffset > Offset)) {
|
if((Dsc->StartOffset <= Offset) && (Dsc->EndOffset > Offset)) {
|
||||||
|
|
||||||
RegisterPtr = AllocateZeroPool (sizeof (EFI_PCI_REGISTER_ACCESS_DATA));
|
RegisterPtr = &mPciRegisterAccessData;
|
||||||
if (RegisterPtr == NULL) {
|
|
||||||
return EFI_OUT_OF_RESOURCES;
|
|
||||||
}
|
|
||||||
|
|
||||||
RegisterPtr->StartOffset = Dsc->StartOffset;
|
RegisterPtr->StartOffset = Dsc->StartOffset;
|
||||||
RegisterPtr->EndOffset = Dsc->EndOffset;
|
RegisterPtr->EndOffset = Dsc->EndOffset;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#/** @file
|
#/** @file
|
||||||
# PCI Incompatible device support Library
|
# PCI Incompatible device support Library template.
|
||||||
#
|
#
|
||||||
# Check PCI incompatible devices and set necessary configuration
|
# Check PCI incompatible devices and set necessary configuration.
|
||||||
# Copyright (c) 2007 - 2009, Intel Corporation.
|
# Copyright (c) 2007 - 2009, Intel Corporation.
|
||||||
#
|
#
|
||||||
# All rights reserved. This program and the accompanying materials
|
# All rights reserved. This program and the accompanying materials
|
||||||
|
Reference in New Issue
Block a user