Add function doxygen header for PciBus module.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5066 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
klu2 2008-04-15 08:52:18 +00:00
parent 4e4a057b72
commit a3b8e25782
12 changed files with 1471 additions and 2540 deletions

View File

@ -1,5 +1,7 @@
/**@file
This module implement Pci register operation interface for
Pci device.
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@ -14,6 +16,17 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include "pcibus.h"
/**
Operate the PCI register via PciIo function interface.
@param PciIoDevice Pointer to instance of PCI_IO_DEVICE
@param Command Operator command
@param Offset The address within the PCI configuration space for the PCI controller.
@param Operation Type of Operation
@param PtrCommand Return buffer holding old PCI command, if operation is not EFI_SET_REGISTER
@return status of PciIo operation
**/
EFI_STATUS
PciOperateRegister (
IN PCI_IO_DEVICE *PciIoDevice,
@ -22,22 +35,6 @@ PciOperateRegister (
IN UINT8 Operation,
OUT UINT16 *PtrCommand
)
/**
Routine Description:
Arguments:
Returns:
None
**/
// TODO: PciIoDevice - add argument and description to function comment
// TODO: Command - add argument and description to function comment
// TODO: Offset - add argument and description to function comment
// TODO: Operation - add argument and description to function comment
// TODO: PtrCommand - add argument and description to function comment
{
UINT16 OldCommand;
EFI_STATUS Status;
@ -48,12 +45,12 @@ Returns:
if (Operation != EFI_SET_REGISTER) {
Status = PciIoRead (
PciIo,
EfiPciIoWidthUint16,
Offset,
1,
&OldCommand
);
PciIo,
EfiPciIoWidthUint16,
Offset,
1,
&OldCommand
);
if (Operation == EFI_GET_REGISTER) {
*PtrCommand = OldCommand;
@ -70,30 +67,26 @@ Returns:
}
return PciIoWrite (
PciIo,
EfiPciIoWidthUint16,
Offset,
1,
&OldCommand
);
PciIo,
EfiPciIoWidthUint16,
Offset,
1,
&OldCommand
);
}
/**
check the cpability of this device supports
@param PciIoDevice Pointer to instance of PCI_IO_DEVICE
@retval TRUE Support
@retval FALSE Not support
**/
BOOLEAN
PciCapabilitySupport (
IN PCI_IO_DEVICE *PciIoDevice
)
/**
Routine Description:
Arguments:
Returns:
None
**/
// TODO: PciIoDevice - add argument and description to function comment
{
if (PciIoDevice->Pci.Hdr.Status & EFI_PCI_STATUS_CAPABILITY) {
@ -103,6 +96,18 @@ Returns:
return FALSE;
}
/**
Locate cap reg.
@param PciIoDevice - A pointer to the PCI_IO_DEVICE.
@param CapId - The cap ID.
@param Offset - A pointer to the offset.
@param NextRegBlock - A pointer to the next block.
@retval EFI_UNSUPPORTED Pci device does not support
@retval EFI_NOT_FOUND Pci device support but can not find register block.
@retval EFI_SUCCESS Success to locate capability register block
**/
EFI_STATUS
LocateCapabilityRegBlock (
IN PCI_IO_DEVICE *PciIoDevice,
@ -110,25 +115,6 @@ LocateCapabilityRegBlock (
IN OUT UINT8 *Offset,
OUT UINT8 *NextRegBlock OPTIONAL
)
/**
Routine Description:
Locate cap reg.
Arguments:
PciIoDevice - A pointer to the PCI_IO_DEVICE.
CapId - The cap ID.
Offset - A pointer to the offset.
NextRegBlock - A pointer to the next block.
Returns:
None
**/
// TODO: EFI_UNSUPPORTED - add return value to function comment
// TODO: EFI_SUCCESS - add return value to function comment
// TODO: EFI_NOT_FOUND - add return value to function comment
{
UINT8 CapabilityPtr;
UINT16 CapabilityEntry;
@ -196,3 +182,4 @@ Returns:
return EFI_NOT_FOUND;
}

View File

@ -61,6 +61,17 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#define EFI_ENABLE_REGISTER 3
#define EFI_DISABLE_REGISTER 4
/**
Operate the PCI register via PciIo function interface.
@param PciIoDevice Pointer to instance of PCI_IO_DEVICE
@param Command Operator command
@param Offset The address within the PCI configuration space for the PCI controller.
@param Operation Type of Operation
@param PtrCommand Return buffer holding old PCI command, if operation is not EFI_SET_REGISTER
@return status of PciIo operation
**/
EFI_STATUS
PciOperateRegister (
IN PCI_IO_DEVICE *PciIoDevice,
@ -69,48 +80,34 @@ PciOperateRegister (
IN UINT8 Operation,
OUT UINT16 *PtrCommand
)
/**
Routine Description:
TODO: Add function description
Arguments:
PciIoDevice - TODO: add argument description
Command - TODO: add argument description
Offset - TODO: add argument description
Operation - TODO: add argument description
PtrCommand - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
check the cpability of this device supports
@param PciIoDevice Pointer to instance of PCI_IO_DEVICE
@retval TRUE Support
@retval FALSE Not support
**/
BOOLEAN
PciCapabilitySupport (
IN PCI_IO_DEVICE *PciIoDevice
)
/**
Routine Description:
TODO: Add function description
Arguments:
PciIoDevice - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
Locate cap reg.
@param PciIoDevice - A pointer to the PCI_IO_DEVICE.
@param CapId - The cap ID.
@param Offset - A pointer to the offset.
@param NextRegBlock - A pointer to the next block.
@retval EFI_UNSUPPORTED Pci device does not support
@retval EFI_NOT_FOUND Pci device support but can not find register block.
@retval EFI_SUCCESS Success to locate capability register block
**/
EFI_STATUS
LocateCapabilityRegBlock (
IN PCI_IO_DEVICE *PciIoDevice,
@ -118,24 +115,6 @@ LocateCapabilityRegBlock (
IN OUT UINT8 *Offset,
OUT UINT8 *NextRegBlock OPTIONAL
)
/**
Routine Description:
TODO: Add function description
Arguments:
PciIoDevice - TODO: add argument description
CapId - TODO: add argument description
Offset - TODO: add argument description
NextRegBlock - TODO: add argument description
Returns:
TODO: add return values
**/
;

View File

@ -21,50 +21,29 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
//
LIST_ENTRY gPciDevicePool;
/**
Initialize the gPciDevicePool
**/
EFI_STATUS
InitializePciDevicePool (
VOID
)
/**
Routine Description:
Initialize the gPciDevicePool
Arguments:
Returns:
None
**/
// TODO: EFI_SUCCESS - add return value to function comment
{
InitializeListHead (&gPciDevicePool);
return EFI_SUCCESS;
}
/**
Insert a root bridge into PCI device pool
@param RootBridge - A pointer to the PCI_IO_DEVICE.
**/
EFI_STATUS
InsertRootBridge (
PCI_IO_DEVICE *RootBridge
)
/**
Routine Description:
Insert a root bridge into PCI device pool
Arguments:
RootBridge - A pointer to the PCI_IO_DEVICE.
Returns:
None
**/
// TODO: EFI_SUCCESS - add return value to function comment
{
InsertTailList (&gPciDevicePool, &(RootBridge->Link));
@ -72,28 +51,19 @@ Returns:
return EFI_SUCCESS;
}
/**
This function is used to insert a PCI device node under
a bridge
@param Bridge A pointer to the PCI_IO_DEVICE.
@param PciDeviceNode A pointer to the PCI_IO_DEVICE.
**/
EFI_STATUS
InsertPciDevice (
PCI_IO_DEVICE *Bridge,
PCI_IO_DEVICE *PciDeviceNode
)
/**
Routine Description:
This function is used to insert a PCI device node under
a bridge
Arguments:
Bridge - A pointer to the PCI_IO_DEVICE.
PciDeviceNode - A pointer to the PCI_IO_DEVICE.
Returns:
None
**/
// TODO: EFI_SUCCESS - add return value to function comment
{
InsertTailList (&Bridge->ChildList, &(PciDeviceNode->Link));
@ -102,25 +72,16 @@ Returns:
return EFI_SUCCESS;
}
/**
Destroy root bridge and remove it from deivce tree.
@param RootBridge The bridge want to be removed
**/
EFI_STATUS
DestroyRootBridge (
IN PCI_IO_DEVICE *RootBridge
)
/**
Routine Description:
Arguments:
RootBridge - A pointer to the PCI_IO_DEVICE.
Returns:
None
**/
// TODO: EFI_SUCCESS - add return value to function comment
{
DestroyPciDeviceTree (RootBridge);
@ -129,27 +90,17 @@ Returns:
return EFI_SUCCESS;
}
/**
Destroy a pci device node.
Also all direct or indirect allocated resource for this node will be freed.
@param PciIoDevice A pointer to the PCI_IO_DEVICE.
**/
EFI_STATUS
FreePciDevice (
IN PCI_IO_DEVICE *PciIoDevice
)
/**
Routine Description:
Destroy a pci device node.
Also all direct or indirect allocated resource for this node will be freed.
Arguments:
PciIoDevice - A pointer to the PCI_IO_DEVICE.
Returns:
None
**/
// TODO: EFI_SUCCESS - add return value to function comment
{
//
@ -168,27 +119,17 @@ Returns:
return EFI_SUCCESS;
}
/**
Destroy all the pci device node under the bridge.
Bridge itself is not included.
@param Bridge A pointer to the PCI_IO_DEVICE.
**/
EFI_STATUS
DestroyPciDeviceTree (
IN PCI_IO_DEVICE *Bridge
)
/**
Routine Description:
Destroy all the pci device node under the bridge.
Bridge itself is not included.
Arguments:
Bridge - A pointer to the PCI_IO_DEVICE.
Returns:
None
**/
// TODO: EFI_SUCCESS - add return value to function comment
{
LIST_ENTRY *CurrentLink;
PCI_IO_DEVICE *Temp;
@ -214,29 +155,18 @@ Returns:
return EFI_SUCCESS;
}
EFI_STATUS
DestroyRootBridgeByHandle (
EFI_HANDLE Controller
)
/**
Routine Description:
Destroy all device nodes under the root bridge
specified by Controller.
The root bridge itself is also included.
Arguments:
Controller - An efi handle.
Returns:
None
@param Controller An efi handle.
**/
// TODO: EFI_SUCCESS - add return value to function comment
// TODO: EFI_NOT_FOUND - add return value to function comment
EFI_STATUS
DestroyRootBridgeByHandle (
EFI_HANDLE Controller
)
{
LIST_ENTRY *CurrentLink;
@ -264,32 +194,25 @@ Returns:
return EFI_NOT_FOUND;
}
/**
This function registers the PCI IO device. 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 parent/child relationship with its bus controller.
@param Controller - An EFI handle for the PCI bus controller.
@param PciIoDevice - A PCI_IO_DEVICE pointer to the PCI IO device to be registered.
@param Handle - A pointer to hold the EFI handle for the PCI IO device.
@retval EFI_SUCCESS - The PCI device is successfully registered.
@retval Others - An error occurred when registering the PCI device.
**/
EFI_STATUS
RegisterPciDevice (
IN EFI_HANDLE Controller,
IN PCI_IO_DEVICE *PciIoDevice,
OUT EFI_HANDLE *Handle OPTIONAL
)
/**
Routine Description:
This function registers the PCI IO device. 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 parent/child relationship with its bus controller.
Arguments:
Controller - An EFI handle for the PCI bus controller.
PciIoDevice - A PCI_IO_DEVICE pointer to the PCI IO device to be registered.
Handle - A pointer to hold the EFI handle for the PCI IO device.
Returns:
EFI_SUCCESS - The PCI device is successfully registered.
Others - An error occurred when registering the PCI device.
**/
{
EFI_STATUS Status;
VOID *PlatformOpRomBuffer;
@ -435,28 +358,20 @@ Returns:
return EFI_SUCCESS;
}
/**
This function is used to remove the whole PCI devices from the bridge.
@param RootBridgeHandle An efi handle.
@param Bridge A pointer to the PCI_IO_DEVICE.
@retval EFI_SUCCESS
**/
EFI_STATUS
RemoveAllPciDeviceOnBridge (
EFI_HANDLE RootBridgeHandle,
PCI_IO_DEVICE *Bridge
)
/**
Routine Description:
This function is used to remove the whole PCI devices from the bridge.
Arguments:
RootBridgeHandle - An efi handle.
Bridge - A pointer to the PCI_IO_DEVICE.
Returns:
None
**/
// TODO: EFI_SUCCESS - add return value to function comment
{
LIST_ENTRY *CurrentLink;
@ -490,32 +405,23 @@ Returns:
return EFI_SUCCESS;
}
EFI_STATUS
DeRegisterPciDevice (
IN EFI_HANDLE Controller,
IN EFI_HANDLE Handle
)
/**
Routine Description:
This function is used to de-register the PCI device from the EFI,
That includes un-installing PciIo protocol from the specified PCI
device handle.
Arguments:
Controller - An efi handle.
Handle - An efi handle.
Returns:
None
@param Controller - controller handle
@param Handle - device handle
@return Status of de-register pci device
**/
// TODO: EFI_SUCCESS - add return value to function comment
// TODO: EFI_SUCCESS - add return value to function comment
// TODO: EFI_SUCCESS - add return value to function comment
EFI_STATUS
DeRegisterPciDevice (
IN EFI_HANDLE Controller,
IN EFI_HANDLE Handle
)
{
EFI_PCI_IO_PROTOCOL *PciIo;
EFI_STATUS Status;
@ -631,6 +537,21 @@ Returns:
return EFI_SUCCESS;
}
/**
Start to manage the PCI device on specified the root bridge or PCI-PCI Bridge
@param Controller An efi handle.
@param RootBridge A pointer to the PCI_IO_DEVICE.
@param RemainingDevicePath A pointer to the EFI_DEVICE_PATH_PROTOCOL.
@param NumberOfChildren Children number.
@param ChildHandleBuffer A pointer to the child handle buffer.
@retval EFI_NOT_READY Device is not allocated
@retval EFI_UNSUPPORTED Device only support PCI-PCI bridge.
@retval EFI_NOT_FOUND Can not find the specific device
@retval EFI_SUCCESS Success to start Pci device on bridge
**/
EFI_STATUS
StartPciDevicesOnBridge (
IN EFI_HANDLE Controller,
@ -639,29 +560,7 @@ StartPciDevicesOnBridge (
IN OUT UINT8 *NumberOfChildren,
IN OUT EFI_HANDLE *ChildHandleBuffer
)
/**
Routine Description:
Start to manage the PCI device on specified the root bridge or PCI-PCI Bridge
Arguments:
Controller - An efi handle.
RootBridge - A pointer to the PCI_IO_DEVICE.
RemainingDevicePath - A pointer to the EFI_DEVICE_PATH_PROTOCOL.
NumberOfChildren - Children number.
ChildHandleBuffer - A pointer to the child handle buffer.
Returns:
None
**/
// TODO: EFI_NOT_READY - add return value to function comment
// TODO: EFI_SUCCESS - add return value to function comment
// TODO: EFI_UNSUPPORTED - add return value to function comment
// TODO: EFI_NOT_FOUND - add return value to function comment
{
PCI_IO_DEVICE *PciIoDevice;
EFI_DEV_PATH_PTR Node;
@ -806,25 +705,18 @@ Returns:
return EFI_NOT_FOUND;
}
/**
Start to manage all the PCI devices it found previously under
the entire host bridge.
@param Controller - root bridge handle.
**/
EFI_STATUS
StartPciDevices (
IN EFI_HANDLE Controller
)
/**
Routine Description:
Start to manage all the PCI devices it found previously under
the entire host bridge.
Arguments:
Controller - root bridge handle.
Returns:
None
**/
{
PCI_IO_DEVICE *RootBridge;
EFI_HANDLE ThisHostBridge;
@ -858,23 +750,17 @@ Returns:
return EFI_SUCCESS;
}
/**
Create root bridge device
@param RootBridgeHandle - Parent bridge handle.
@return pointer to new root bridge
**/
PCI_IO_DEVICE *
CreateRootBridge (
IN EFI_HANDLE RootBridgeHandle
)
/**
Routine Description:
Arguments:
RootBridgeHandle - An efi handle.
Returns:
None
**/
{
EFI_STATUS Status;
@ -952,24 +838,17 @@ Returns:
return Dev;
}
/**
Get root bridge device instance by specific handle
@param RootBridgeHandle Given root bridge handle
@return root bridge device instance
**/
PCI_IO_DEVICE *
GetRootBridgeByHandle (
EFI_HANDLE RootBridgeHandle
)
/**
Routine Description:
Arguments:
RootBridgeHandle - An efi handle.
Returns:
None
**/
{
PCI_IO_DEVICE *RootBridgeDev;
LIST_ENTRY *CurrentLink;
@ -989,25 +868,19 @@ Returns:
return NULL;
}
/**
Judege whether Pci device existed
@param Bridge Parent bridege instance
@param PciIoDevice Device instance
@return whether Pci device existed
**/
BOOLEAN
PciDeviceExisted (
IN PCI_IO_DEVICE *Bridge,
IN PCI_IO_DEVICE *PciIoDevice
)
/**
Routine Description:
Arguments:
Bridge - A pointer to the PCI_IO_DEVICE.
PciIoDevice - A pointer to the PCI_IO_DEVICE.
Returns:
None
**/
{
PCI_IO_DEVICE *Temp;
@ -1035,23 +908,17 @@ Returns:
return FALSE;
}
/**
Active VGA device
@param VgaDevice device instance for VGA
@return device instance
**/
PCI_IO_DEVICE *
ActiveVGADeviceOnTheSameSegment (
IN PCI_IO_DEVICE *VgaDevice
)
/**
Routine Description:
Arguments:
VgaDevice - A pointer to the PCI_IO_DEVICE.
Returns:
None
**/
{
LIST_ENTRY *CurrentLink;
PCI_IO_DEVICE *Temp;
@ -1077,23 +944,17 @@ Returns:
return NULL;
}
/**
Active VGA device on root bridge
@param RootBridge Root bridge device instance
@return VGA device instance
**/
PCI_IO_DEVICE *
ActiveVGADeviceOnTheRootBridge (
IN PCI_IO_DEVICE *RootBridge
)
/**
Routine Description:
Arguments:
RootBridge - A pointer to the PCI_IO_DEVICE.
Returns:
None
**/
{
LIST_ENTRY *CurrentLink;
PCI_IO_DEVICE *Temp;
@ -1127,31 +988,21 @@ Returns:
return NULL;
}
/**
Get HPC PCI address according to its device path
@param PciRootBridgeIo Root bridege Io instance
@param HpcDevicePath Given searching device path
@param PciAddress Buffer holding searched result
@retval EFI_NOT_FOUND Can not find the specific device path.
@retval EFI_SUCCESS Success to get the device path
**/
EFI_STATUS
GetHpcPciAddress (
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,
IN EFI_DEVICE_PATH_PROTOCOL *HpcDevicePath,
OUT UINT64 *PciAddress
)
/**
Routine Description:
Arguments:
PciRootBridgeIo - A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
HpcDevicePath - A pointer to the EFI_DEVICE_PATH_PROTOCL.
PciAddress - A pointer to the pci address.
Returns:
None
**/
// TODO: EFI_NOT_FOUND - add return value to function comment
// TODO: EFI_NOT_FOUND - add return value to function comment
// TODO: EFI_SUCCESS - add return value to function comment
// TODO: EFI_NOT_FOUND - add return value to function comment
{
EFI_DEVICE_PATH_PROTOCOL *CurrentDevicePath;
EFI_DEV_PATH_PTR Node;
@ -1216,32 +1067,20 @@ Returns:
return EFI_NOT_FOUND;
}
/**
Get HPC PCI address according to its device path
@param RootBridge Root bridege Io instance
@param RemainingDevicePath Given searching device path
@param PciAddress Buffer holding searched result
@retval EFI_NOT_FOUND Can not find the specific device path.
**/
EFI_STATUS
GetHpcPciAddressFromRootBridge (
IN PCI_IO_DEVICE *RootBridge,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath,
OUT UINT64 *PciAddress
)
/**
Routine Description:
Arguments:
PciRootBridgeIo - A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
HpcDevicePath - A pointer to the EFI_DEVICE_PATH_PROTOCL.
PciAddress - A pointer to the pci address.
Returns:
None
**/
// TODO: RootBridge - add argument and description to function comment
// TODO: RemainingDevicePath - 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
// TODO: EFI_SUCCESS - add return value to function comment
{
EFI_DEV_PATH_PTR Node;
PCI_IO_DEVICE *Temp;
@ -1302,3 +1141,4 @@ Returns:
return EFI_SUCCESS;
}

View File

@ -14,205 +14,150 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#ifndef _EFI_PCI_DEVICE_SUPPORT_H
#define _EFI_PCI_DEVICE_SUPPORT_H
/**
Initialize the gPciDevicePool
**/
EFI_STATUS
InitializePciDevicePool (
VOID
)
/**
Routine Description:
TODO: Add function description
Arguments:
None
Returns:
TODO: add return values
**/
;
/**
Insert a root bridge into PCI device pool
@param RootBridge - A pointer to the PCI_IO_DEVICE.
**/
EFI_STATUS
InsertRootBridge (
PCI_IO_DEVICE *RootBridge
)
/**
Routine Description:
TODO: Add function description
Arguments:
RootBridge - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
This function is used to insert a PCI device node under
a bridge
@param Bridge A pointer to the PCI_IO_DEVICE.
@param PciDeviceNode A pointer to the PCI_IO_DEVICE.
**/
EFI_STATUS
InsertPciDevice (
PCI_IO_DEVICE *Bridge,
PCI_IO_DEVICE *PciDeviceNode
)
/**
Routine Description:
TODO: Add function description
Arguments:
Bridge - TODO: add argument description
PciDeviceNode - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
Destroy root bridge and remove it from deivce tree.
@param RootBridge The bridge want to be removed
**/
EFI_STATUS
DestroyRootBridge (
IN PCI_IO_DEVICE *RootBridge
)
/**
Routine Description:
TODO: Add function description
Arguments:
RootBridge - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
Destroy all the pci device node under the bridge.
Bridge itself is not included.
@param Bridge A pointer to the PCI_IO_DEVICE.
**/
EFI_STATUS
DestroyPciDeviceTree (
IN PCI_IO_DEVICE *Bridge
)
/**
Routine Description:
TODO: Add function description
Arguments:
Bridge - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
Destroy all device nodes under the root bridge
specified by Controller.
The root bridge itself is also included.
@param Controller An efi handle.
**/
EFI_STATUS
DestroyRootBridgeByHandle (
EFI_HANDLE Controller
)
/**
Routine Description:
TODO: Add function description
Arguments:
Controller - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
This function registers the PCI IO device. 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 parent/child relationship with its bus controller.
@param Controller - An EFI handle for the PCI bus controller.
@param PciIoDevice - A PCI_IO_DEVICE pointer to the PCI IO device to be registered.
@param Handle - A pointer to hold the EFI handle for the PCI IO device.
@retval EFI_SUCCESS - The PCI device is successfully registered.
@retval Others - An error occurred when registering the PCI device.
**/
EFI_STATUS
RegisterPciDevice (
IN EFI_HANDLE Controller,
IN PCI_IO_DEVICE *PciIoDevice,
OUT EFI_HANDLE *Handle OPTIONAL
)
/**
Routine Description:
TODO: Add function description
Arguments:
Controller - TODO: add argument description
PciIoDevice - TODO: add argument description
Handle - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
This function is used to remove the whole PCI devices from the bridge.
@param RootBridgeHandle An efi handle.
@param Bridge A pointer to the PCI_IO_DEVICE.
@retval EFI_SUCCESS
**/
EFI_STATUS
RemoveAllPciDeviceOnBridge (
EFI_HANDLE RootBridgeHandle,
PCI_IO_DEVICE *Bridge
)
/**
Routine Description:
TODO: Add function description
Arguments:
RootBridgeHandle - TODO: add argument description
Bridge - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
This function is used to de-register the PCI device from the EFI,
That includes un-installing PciIo protocol from the specified PCI
device handle.
@param Controller - controller handle
@param Handle - device handle
@return Status of de-register pci device
**/
EFI_STATUS
DeRegisterPciDevice (
IN EFI_HANDLE Controller,
IN EFI_HANDLE Handle
)
/**
Routine Description:
TODO: Add function description
Arguments:
Controller - TODO: add argument description
Handle - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
Start to manage the PCI device on specified the root bridge or PCI-PCI Bridge
@param Controller An efi handle.
@param RootBridge A pointer to the PCI_IO_DEVICE.
@param RemainingDevicePath A pointer to the EFI_DEVICE_PATH_PROTOCOL.
@param NumberOfChildren Children number.
@param ChildHandleBuffer A pointer to the child handle buffer.
@retval EFI_NOT_READY Device is not allocated
@retval EFI_UNSUPPORTED Device only support PCI-PCI bridge.
@retval EFI_NOT_FOUND Can not find the specific device
@retval EFI_SUCCESS Success to start Pci device on bridge
**/
EFI_STATUS
StartPciDevicesOnBridge (
IN EFI_HANDLE Controller,
@ -221,245 +166,138 @@ StartPciDevicesOnBridge (
IN OUT UINT8 *NumberOfChildren,
IN OUT EFI_HANDLE *ChildHandleBuffer
)
/**
Routine Description:
TODO: Add function description
Arguments:
Controller - TODO: add argument description
RootBridge - TODO: add argument description
RemainingDevicePath - TODO: add argument description
NumberOfChildren - TODO: add argument description
ChildHandleBuffer - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
Start to manage all the PCI devices it found previously under
the entire host bridge.
@param Controller - root bridge handle.
**/
EFI_STATUS
StartPciDevices (
IN EFI_HANDLE Controller
)
/**
Routine Description:
TODO: Add function description
Arguments:
Controller - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
Create root bridge device
@param RootBridgeHandle - Parent bridge handle.
@return pointer to new root bridge
**/
PCI_IO_DEVICE *
CreateRootBridge (
IN EFI_HANDLE RootBridgeHandle
)
/**
Routine Description:
TODO: Add function description
Arguments:
RootBridgeHandle - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
Get root bridge device instance by specific handle
@param RootBridgeHandle Given root bridge handle
@return root bridge device instance
**/
PCI_IO_DEVICE *
GetRootBridgeByHandle (
EFI_HANDLE RootBridgeHandle
)
/**
Routine Description:
TODO: Add function description
Arguments:
RootBridgeHandle - TODO: add argument description
Returns:
TODO: add return values
**/
;
BOOLEAN
RootBridgeExisted (
IN EFI_HANDLE RootBridgeHandle
)
/**
Routine Description:
TODO: Add function description
Arguments:
RootBridgeHandle - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
Judege whether Pci device existed
@param Bridge Parent bridege instance
@param PciIoDevice Device instance
@return whether Pci device existed
**/
BOOLEAN
PciDeviceExisted (
IN PCI_IO_DEVICE *Bridge,
IN PCI_IO_DEVICE *PciIoDevice
)
/**
Routine Description:
TODO: Add function description
Arguments:
Bridge - TODO: add argument description
PciIoDevice - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
Active VGA device
@param VgaDevice device instance for VGA
@return device instance
**/
PCI_IO_DEVICE *
ActiveVGADeviceOnTheSameSegment (
IN PCI_IO_DEVICE *VgaDevice
)
/**
Routine Description:
TODO: Add function description
Arguments:
VgaDevice - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
Active VGA device on root bridge
@param RootBridge Root bridge device instance
@return VGA device instance
**/
PCI_IO_DEVICE *
ActiveVGADeviceOnTheRootBridge (
IN PCI_IO_DEVICE *RootBridge
)
/**
Routine Description:
TODO: Add function description
Arguments:
RootBridge - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
Get HPC PCI address according to its device path
@param PciRootBridgeIo Root bridege Io instance
@param HpcDevicePath Given searching device path
@param PciAddress Buffer holding searched result
@retval EFI_NOT_FOUND Can not find the specific device path.
@retval EFI_SUCCESS Success to get the device path
**/
EFI_STATUS
GetHpcPciAddress (
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,
IN EFI_DEVICE_PATH_PROTOCOL *HpcDevicePath,
OUT UINT64 *PciAddress
)
/**
Routine Description:
TODO: Add function description
Arguments:
PciRootBridgeIo - TODO: add argument description
HpcDevicePath - TODO: add argument description
PciAddress - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
Get HPC PCI address according to its device path
@param RootBridge Root bridege Io instance
@param RemainingDevicePath Given searching device path
@param PciAddress Buffer holding searched result
@retval EFI_NOT_FOUND Can not find the specific device path.
**/
EFI_STATUS
GetHpcPciAddressFromRootBridge (
IN PCI_IO_DEVICE *RootBridge,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath,
OUT UINT64 *PciAddress
)
/**
Routine Description:
TODO: Add function description
Arguments:
RootBridge - TODO: add argument description
RemainingDevicePath - TODO: add argument description
PciAddress - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
Destroy a pci device node.
Also all direct or indirect allocated resource for this node will be freed.
@param PciIoDevice A pointer to the PCI_IO_DEVICE.
**/
EFI_STATUS
FreePciDevice (
IN PCI_IO_DEVICE *PciIoDevice
)
/**
Routine Description:
TODO: Add function description
Arguments:
PciIoDevice - TODO: add argument description
Returns:
TODO: add return values
**/
;
#endif

View File

@ -14,55 +14,37 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include "pcibus.h"
/**
Initializes a PCI Driver Override Instance
@param PciIoDevice Device instance
@retval EFI_SUCCESS Operation success
**/
EFI_STATUS
InitializePciDriverOverrideInstance (
PCI_IO_DEVICE *PciIoDevice
)
/**
Routine Description:
Initializes a PCI Driver Override Instance
Arguments:
Returns:
None
**/
// TODO: PciIoDevice - add argument and description to function comment
// TODO: EFI_SUCCESS - add return value to function comment
{
PciIoDevice->PciDriverOverride.GetDriver = GetDriver;
return EFI_SUCCESS;
}
/**
Get a overriding driver image
@param This Pointer to instance of EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL
@param DriverImageHandle Override driver image,
@retval EFI_SUCCESS Success to get driver image handle
@retval EFI_NOT_FOUND can not find override driver image
@retval EFI_INVALID_PARAMETER Invalid parameter
**/
EFI_STATUS
EFIAPI
GetDriver (
IN EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL *This,
IN OUT EFI_HANDLE *DriverImageHandle
)
/**
Routine Description:
Get a overriding driver image
Arguments:
Returns:
None
**/
// TODO: This - add argument and description to function comment
// TODO: DriverImageHandle - 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
// TODO: EFI_SUCCESS - add return value to function comment
// TODO: EFI_INVALID_PARAMETER - add return value to function comment
{
PCI_IO_DEVICE *PciIoDevice;
LIST_ENTRY *CurrentLink;
@ -103,31 +85,20 @@ Returns:
return EFI_INVALID_PARAMETER;
}
/**
Add an overriding driver image
@param PciIoDevice Instance of PciIo device
@param DriverImageHandle new added driver image
@retval EFI_OUT_OF_RESOURCES no memory resource for new driver instance
@retval EFI_SUCCESS Success add driver
**/
EFI_STATUS
AddDriver (
IN PCI_IO_DEVICE *PciIoDevice,
IN EFI_HANDLE DriverImageHandle
)
/**
Routine Description:
Add a overriding driver image
Arguments:
Returns:
None
**/
// TODO: PciIoDevice - add argument and description to function comment
// TODO: DriverImageHandle - add argument and description to function comment
// TODO: EFI_OUT_OF_RESOURCES - add return value to function comment
// TODO: EFI_SUCCESS - add return value to function comment
// TODO: EFI_SUCCESS - add return value to function comment
// TODO: EFI_SUCCESS - add return value to function comment
// TODO: EFI_SUCCESS - add return value to function comment
{
EFI_STATUS Status;
EFI_IMAGE_DOS_HEADER *DosHdr;
@ -164,3 +135,4 @@ Returns:
}
return EFI_SUCCESS;
}

View File

@ -27,73 +27,51 @@ typedef struct {
#define DRIVER_OVERRIDE_FROM_LINK(a) \
CR (a, PCI_DRIVER_OVERRIDE_LIST, Link, DRIVER_OVERRIDE_SIGNATURE)
/**
Initializes a PCI Driver Override Instance
@param PciIoDevice Device instance
@retval EFI_SUCCESS Operation success
**/
EFI_STATUS
InitializePciDriverOverrideInstance (
PCI_IO_DEVICE *PciIoDevice
)
/**
Routine Description:
TODO: Add function description
Arguments:
PciIoDevice - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
Add an overriding driver image
@param PciIoDevice Instance of PciIo device
@param DriverImageHandle new added driver image
@retval EFI_OUT_OF_RESOURCES no memory resource for new driver instance
@retval EFI_SUCCESS Success add driver
**/
EFI_STATUS
AddDriver (
IN PCI_IO_DEVICE *PciIoDevice,
IN EFI_HANDLE DriverImageHandle
)
/**
Routine Description:
TODO: Add function description
Arguments:
PciIoDevice - TODO: add argument description
DriverImageHandle - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
Get a overriding driver image
@param This Pointer to instance of EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL
@param DriverImageHandle Override driver image,
@retval EFI_SUCCESS Success to get driver image handle
@retval EFI_NOT_FOUND can not find override driver image
@retval EFI_INVALID_PARAMETER Invalid parameter
**/
EFI_STATUS
EFIAPI
GetDriver (
IN EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL *This,
IN OUT EFI_HANDLE *DriverImageHandle
)
/**
Routine Description:
TODO: Add function description
Arguments:
This - TODO: add argument description
DriverImageHandle - TODO: add argument description
Returns:
TODO: add return values
**/
;
#endif

View File

@ -17,27 +17,18 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include "PciResourceSupport.h"
#include "PciOptionRomSupport.h"
/**
This routine is used to enumerate entire pci bus system
in a given platform
@param Controller Parent controller handle
@return Status of enumerating
**/
EFI_STATUS
PciEnumerator (
IN EFI_HANDLE Controller
)
/**
Routine Description:
This routine is used to enumerate entire pci bus system
in a given platform
Arguments:
Returns:
None
**/
// TODO: Controller - add argument and description to function comment
// TODO: EFI_SUCCESS - add return value to function comment
// TODO: EFI_SUCCESS - add return value to function comment
{
EFI_HANDLE HostBridgeHandle;
@ -134,25 +125,21 @@ Returns:
return EFI_SUCCESS;
}
/**
Enumerate PCI root bridge
@param PciResAlloc Pointer to protocol instance of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
@param RootBridgeDev Instance of root bridge device
@retval EFI_SUCCESS Success to enumerate root bridge
@retval Others Fail to enumerate root bridge
**/
EFI_STATUS
PciRootBridgeEnumerator (
IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc,
IN PCI_IO_DEVICE *RootBridgeDev
)
/**
Routine Description:
Arguments:
Returns:
None
**/
// TODO: PciResAlloc - add argument and description to function comment
// TODO: RootBridgeDev - add argument and description to function comment
// TODO: EFI_SUCCESS - add return value to function comment
{
EFI_STATUS Status;
EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *pConfiguration;
@ -246,29 +233,21 @@ Returns:
return EFI_SUCCESS;
}
/**
This routine is used to process option rom on a certain root bridge
@param Bridge Given parent's root bridge
@param RomBase Base address of ROM driver loaded from
@param MaxLength Max rom size
@retval EFI_SUCCESS Success to process option rom image.
**/
EFI_STATUS
ProcessOptionRom (
IN PCI_IO_DEVICE *Bridge,
IN UINT64 RomBase,
IN UINT64 MaxLength
)
/**
Routine Description:
This routine is used to process option rom on a certain root bridge
Arguments:
Returns:
None
**/
// TODO: Bridge - add argument and description to function comment
// TODO: RomBase - add argument and description to function comment
// TODO: MaxLength - add argument and description to function comment
// TODO: EFI_SUCCESS - add return value to function comment
{
LIST_ENTRY *CurrentLink;
PCI_IO_DEVICE *Temp;
@ -301,30 +280,21 @@ Returns:
return EFI_SUCCESS;
}
/**
This routine is used to assign bus number to the given PCI bus system
@param Bridge Parent root bridge instance
@param StartBusNumber Number of beginning
@param SubBusNumber the number of sub bus
@retval EFI_SUCCESS Success to assign bus number
**/
EFI_STATUS
PciAssignBusNumber (
IN PCI_IO_DEVICE *Bridge,
IN UINT8 StartBusNumber,
OUT UINT8 *SubBusNumber
)
/**
Routine Description:
This routine is used to assign bus number to the given PCI bus system
Arguments:
Returns:
None
**/
// TODO: Bridge - add argument and description to function comment
// TODO: StartBusNumber - add argument and description to function comment
// TODO: SubBusNumber - add argument and description to function comment
// TODO: EFI_DEVICE_ERROR - add return value to function comment
// TODO: EFI_SUCCESS - add return value to function comment
{
EFI_STATUS Status;
PCI_TYPE00 Pci;
@ -451,28 +421,21 @@ Returns:
return EFI_SUCCESS;
}
/**
This routine is used to determine the root bridge attribute by interfacing
the host bridge resource allocation protocol.
@param PciResAlloc Protocol instance of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
@param RootBridgeDev Root bridge instance
@retval EFI_SUCCESS Success to get root bridge's attribute
@retval Others Fail to get attribute
**/
EFI_STATUS
DetermineRootBridgeAttributes (
IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc,
IN PCI_IO_DEVICE *RootBridgeDev
)
/**
Routine Description:
This routine is used to determine the root bridge attribute by interfacing
the host bridge resource allocation protocol.
Arguments:
Returns:
None
**/
// TODO: PciResAlloc - add argument and description to function comment
// TODO: RootBridgeDev - add argument and description to function comment
// TODO: EFI_SUCCESS - add return value to function comment
{
UINT64 Attributes;
EFI_STATUS Status;
@ -514,24 +477,16 @@ Returns:
return EFI_SUCCESS;
}
/**
Get Max Option Rom size on this bridge
@param Bridge Bridge device instance
@return Max size of option rom
**/
UINT64
GetMaxOptionRomSize (
IN PCI_IO_DEVICE *Bridge
)
/**
Routine Description:
Get Max Option Rom size on this bridge
Arguments:
Returns:
None
**/
// TODO: Bridge - add argument and description to function comment
{
LIST_ENTRY *CurrentLink;
PCI_IO_DEVICE *Temp;
@ -582,26 +537,19 @@ Returns:
return MaxOptionRomSize;
}
/**
Process attributes of devices on this host bridge
@param PciResAlloc Protocol instance of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
@retval EFI_NOT_FOUND Can not find the specific root bridge device
@retval EFI_SUCCESS Success Process attribute
@retval Others Can not determine the root bridge device's attribute
**/
EFI_STATUS
PciHostBridgeDeviceAttribute (
IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc
)
/**
Routine Description:
Process attributes of devices on this host bridge
Arguments:
Returns:
None
**/
// TODO: PciResAlloc - add argument and description to function comment
// TODO: EFI_NOT_FOUND - add return value to function comment
// TODO: EFI_SUCCESS - add return value to function comment
{
EFI_HANDLE RootBridgeHandle;
PCI_IO_DEVICE *RootBridgeDev;
@ -633,6 +581,18 @@ Returns:
return EFI_SUCCESS;
}
/**
Get resource allocation status from the ACPI pointer
@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
GetResourceAllocationStatus (
VOID *AcpiConfig,
@ -642,26 +602,6 @@ GetResourceAllocationStatus (
OUT UINT64 *Mem64ResStatus,
OUT UINT64 *PMem64ResStatus
)
/**
Routine Description:
Get resource allocation status from the ACPI pointer
Arguments:
Returns:
None
**/
// TODO: AcpiConfig - add argument and description to function comment
// TODO: IoResStatus - add argument and description to function comment
// TODO: Mem32ResStatus - add argument and description to function comment
// TODO: PMem32ResStatus - add argument and description to function comment
// TODO: Mem64ResStatus - add argument and description to function comment
// TODO: PMem64ResStatus - add argument and description to function comment
// TODO: EFI_SUCCESS - add return value to function comment
{
UINT8 *Temp;
@ -724,28 +664,18 @@ Returns:
return EFI_SUCCESS;
}
/**
Remove a PCI device from device pool and mark its bar
@param PciDevice Instance of Pci device
@retval EFI_SUCCESS Success Operation
@retval EFI_ABORTED Pci device is a root bridge
**/
EFI_STATUS
RejectPciDevice (
IN PCI_IO_DEVICE *PciDevice
)
/**
Routine Description:
Remove a PCI device from device pool and mark its bar
Arguments:
Returns:
None
**/
// TODO: PciDevice - add argument and description to function comment
// TODO: EFI_SUCCESS - add return value to function comment
// TODO: EFI_ABORTED - add return value to function comment
// TODO: EFI_SUCCESS - add return value to function comment
// TODO: EFI_ABORTED - add return value to function comment
{
PCI_IO_DEVICE *Bridge;
PCI_IO_DEVICE *Temp;
@ -805,24 +735,17 @@ Returns:
return EFI_ABORTED;
}
/**
Determine whethter a PCI device can be rejected
@param PciResNode Pointer to Pci resource node instance
@return whethter a PCI device can be rejected
**/
BOOLEAN
IsRejectiveDevice (
IN PCI_RESOURCE_NODE *PciResNode
)
/**
Routine Description:
Determine whethter a PCI device can be rejected
Arguments:
Returns:
None
**/
// TODO: PciResNode - add argument and description to function comment
{
PCI_IO_DEVICE *Temp;
@ -859,26 +782,19 @@ Returns:
return TRUE;
}
/**
Compare two resource node and get the larger resource consumer
@param PciResNode1 resource node 1 want to be compared
@param PciResNode2 resource node 2 want to be compared
@return Larger resource consumer.
**/
PCI_RESOURCE_NODE *
GetLargerConsumerDevice (
IN PCI_RESOURCE_NODE *PciResNode1,
IN PCI_RESOURCE_NODE *PciResNode2
)
/**
Routine Description:
Get the larger resource consumer
Arguments:
Returns:
None
**/
// TODO: PciResNode1 - add argument and description to function comment
// TODO: PciResNode2 - add argument and description to function comment
{
if (!PciResNode2) {
return PciResNode1;
@ -902,24 +818,18 @@ Returns:
}
/**
Get the max resource consumer in the host resource pool
@param ResPool Pointer to resource pool node
@return the max resource consumer in the host resource pool
**/
PCI_RESOURCE_NODE *
GetMaxResourceConsumerDevice (
IN PCI_RESOURCE_NODE *ResPool
)
/**
Routine Description:
Get the max resource consumer in the host resource pool
Arguments:
Returns:
None
**/
// TODO: ResPool - add argument and description to function comment
{
PCI_RESOURCE_NODE *Temp;
LIST_ENTRY *CurrentLink;
@ -953,6 +863,20 @@ Returns:
return PciResNode;
}
/**
Adjust host bridge allocation so as to reduce resource requirement
@param IoPool Pointer to instance of I/O 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 Mem64Pool Pointer to instance of 64-bit memory resource node
@param PMem64Pool Pointer to instance of 64-bit Pmemory resource node
@param IoResStatus Status of I/O resource Node
@param Mem32ResStatus Status of 32-bit memory resource Node
@param PMem32ResStatus Status of 32-bit Pmemory resource node
@param Mem64ResStatus Status of 64-bit memory resource node
@param PMem64ResStatus Status of 64-bit Pmemory resource node
**/
EFI_STATUS
PciHostBridgeAdjustAllocation (
IN PCI_RESOURCE_NODE *IoPool,
@ -966,32 +890,6 @@ PciHostBridgeAdjustAllocation (
IN UINT64 Mem64ResStatus,
IN UINT64 PMem64ResStatus
)
/**
Routine Description:
Adjust host bridge allocation so as to reduce resource requirement
Arguments:
Returns:
None
**/
// TODO: IoPool - add argument and description to function comment
// TODO: Mem32Pool - add argument and description to function comment
// TODO: PMem32Pool - add argument and description to function comment
// TODO: Mem64Pool - add argument and description to function comment
// TODO: PMem64Pool - add argument and description to function comment
// TODO: IoResStatus - add argument and description to function comment
// TODO: Mem32ResStatus - add argument and description to function comment
// TODO: PMem32ResStatus - add argument and description to function comment
// TODO: Mem64ResStatus - add argument and description to function comment
// TODO: PMem64ResStatus - add argument and description to function comment
// TODO: EFI_ABORTED - add return value to function comment
// TODO: EFI_SUCCESS - add return value to function comment
// TODO: EFI_ABORTED - add return value to function comment
{
BOOLEAN AllocationAjusted;
PCI_RESOURCE_NODE *PciResNode;
@ -1098,6 +996,18 @@ Returns:
}
}
/**
Summary requests for all resource type, and contruct ACPI resource
requestor instance.
@param Bridge detecting bridge
@param IoNode Pointer to instance of I/O 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 Mem64Node Pointer to instance of 64-bit memory resource node
@param PMem64Node Pointer to instance of 64-bit Pmemory resource node
@param pConfig outof buffer holding new constructed APCI resource requestor
**/
EFI_STATUS
ConstructAcpiResourceRequestor (
IN PCI_IO_DEVICE *Bridge,
@ -1108,27 +1018,6 @@ ConstructAcpiResourceRequestor (
IN PCI_RESOURCE_NODE *PMem64Node,
OUT VOID **pConfig
)
/**
Routine Description:
Arguments:
Returns:
None
**/
// TODO: Bridge - add argument and description to function comment
// TODO: IoNode - add argument and description to function comment
// TODO: Mem32Node - add argument and description to function comment
// TODO: PMem32Node - add argument and description to function comment
// TODO: Mem64Node - add argument and description to function comment
// TODO: PMem64Node - add argument and description to function comment
// TODO: pConfig - add argument and description to function comment
// TODO: EFI_OUT_OF_RESOURCES - add return value to function comment
// TODO: EFI_OUT_OF_RESOURCES - add return value to function comment
// TODO: EFI_SUCCESS - add return value to function comment
{
UINT8 NumConfig;
UINT8 Aperture;
@ -1345,6 +1234,18 @@ Returns:
return EFI_SUCCESS;
}
/**
Get resource base from a acpi configuration descriptor.
@param pConfig an acpi configuration descriptor.
@param IoBase output of I/O resource base address
@param Mem32Base output of 32-bit memory base address
@param PMem32Base output of 32-bit pmemory base address
@param Mem64Base output of 64-bit memory base address
@param PMem64Base output of 64-bit pmemory base address
@return EFI_SUCCESS Success operation
**/
EFI_STATUS
GetResourceBase (
IN VOID *pConfig,
@ -1354,24 +1255,6 @@ GetResourceBase (
OUT UINT64 *Mem64Base,
OUT UINT64 *PMem64Base
)
/**
Routine Description:
Arguments:
Returns:
None
**/
// TODO: pConfig - add argument and description to function comment
// TODO: IoBase - add argument and description to function comment
// TODO: Mem32Base - add argument and description to function comment
// TODO: PMem32Base - add argument and description to function comment
// TODO: Mem64Base - add argument and description to function comment
// TODO: PMem64Base - add argument and description to function comment
// TODO: EFI_SUCCESS - add return value to function comment
{
UINT8 *Temp;
EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Ptr;
@ -1444,23 +1327,19 @@ Returns:
return EFI_SUCCESS;
}
/**
Enumerate pci bridge, allocate resource and determine attribute
for devices on this bridge
@param BridgeDev Pointer to instance of bridge device
@retval EFI_SUCCESS Success operation
@retval Others Fail to enumerate
**/
EFI_STATUS
PciBridgeEnumerator (
IN PCI_IO_DEVICE *BridgeDev
)
/**
Routine Description:
Arguments:
Returns:
None
**/
// TODO: BridgeDev - add argument and description to function comment
// TODO: EFI_SUCCESS - add return value to function comment
{
UINT8 SubBusNumber;
UINT8 StartBusNumber;
@ -1508,23 +1387,18 @@ Returns:
}
/**
Allocate all kinds of resource for bridge
@param Bridge Pointer to bridge instance
@retval EFI_SUCCESS Success operation.
@retval Others Fail to allocate resource for bridge
**/
EFI_STATUS
PciBridgeResourceAllocator (
IN PCI_IO_DEVICE *Bridge
)
/**
Routine Description:
Arguments:
Returns:
None
**/
// TODO: Bridge - add argument and description to function comment
// TODO: EFI_SUCCESS - add return value to function comment
{
PCI_RESOURCE_NODE *IoBridge;
PCI_RESOURCE_NODE *Mem32Bridge;
@ -1667,6 +1541,18 @@ Returns:
return EFI_SUCCESS;
}
/**
Get resource base address for a pci bridge device
@param Bridge Given Pci driver instance
@param IoBase output for base address of I/O 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 Mem64Base output for base address of 64-bit memory type resource
@param PMem64Base output for base address of 64-bit Pmemory type resource
@retval EFI_SUCCESS Succes to get resource base address
**/
EFI_STATUS
GetResourceBaseFromBridge (
IN PCI_IO_DEVICE *Bridge,
@ -1676,25 +1562,6 @@ GetResourceBaseFromBridge (
OUT UINT64 *Mem64Base,
OUT UINT64 *PMem64Base
)
/**
Routine Description:
Arguments:
Returns:
None
**/
// TODO: Bridge - add argument and description to function comment
// TODO: IoBase - add argument and description to function comment
// TODO: Mem32Base - add argument and description to function comment
// TODO: PMem32Base - add argument and description to function comment
// TODO: Mem64Base - add argument and description to function comment
// TODO: PMem64Base - add argument and description to function comment
// TODO: EFI_OUT_OF_RESOURCES - add return value to function comment
// TODO: EFI_SUCCESS - add return value to function comment
{
if (!Bridge->Allocated) {
return EFI_OUT_OF_RESOURCES;
@ -1761,26 +1628,73 @@ Returns:
return EFI_SUCCESS;
}
/**
These are the notifications from the PCI bus driver that it is about to enter a certain
phase of the PCI enumeration process.
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.
Eight notification points are defined at this time. See belows:
EfiPciHostBridgeBeginEnumeration - Resets the host bridge PCI apertures and internal data
structures. The PCI enumerator should issue this notification
before starting a fresh enumeration process. Enumeration cannot
be restarted after sending any other notification such as
EfiPciHostBridgeBeginBusAllocation.
EfiPciHostBridgeBeginBusAllocation - The bus allocation phase is about to begin. No specific action is
required here. This notification can be used to perform any
chipset-specific programming.
EfiPciHostBridgeEndBusAllocation - The bus allocation and bus programming phase is complete. No
specific action is required here. This notification can be used to
perform any chipset-specific programming.
EfiPciHostBridgeBeginResourceAllocation - The resource allocation phase is about to begin. No specific
action is required here. This notification can be used to perform
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
GetProposedResources(). Before calling NotifyPhase() with a Phase of
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
SubmitResources(). This function pads the resource amount
to suit the root bridge hardware, takes care of dependencies between
the PCI root bridges, and calls the Global Coherency Domain (GCD)
with the allocation request. In the case of padding, the allocated range
could be bigger than what was requested.
EfiPciHostBridgeSetResources - Programs the host bridge hardware to decode previously allocated
resources (proposed resources) for all the PCI root bridges. After the
hardware is programmed, reassigning resources will not be supported.
The bus settings are not affected.
EfiPciHostBridgeFreeResources - Deallocates resources that were previously allocated for all the PCI
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
resources fails, the PCI enumerator can use this notification to
deallocate previous resources, adjust the requests, and retry
allocation.
EfiPciHostBridgeEndResourceAllocation- The resource allocation phase is completed. No specific action is
required here. This notification can be used to perform any chipsetspecific
programming.
@param[in] This The instance pointer of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
@param[in] Phase The phase during enumeration
@retval EFI_NOT_READY This phase cannot be entered at this time. For example, this error
is valid for a Phase of EfiPciHostBridgeAllocateResources if
SubmitResources() has not been called for one or more
PCI root bridges before this call
@retval EFI_DEVICE_ERROR Programming failed due to a hardware error. This error is valid
for a Phase of EfiPciHostBridgeSetResources.
@retval EFI_INVALID_PARAMETER Invalid phase parameter
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
This error is valid for a Phase of EfiPciHostBridgeAllocateResources if the
previously submitted resource requests cannot be fulfilled or
were only partially fulfilled.
@retval EFI_SUCCESS The notification was accepted without any errors.
**/
EFI_STATUS
NotifyPhase (
IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc,
EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PHASE Phase
)
/**
Routine Description:
Arguments:
Returns:
None
**/
// TODO: PciResAlloc - add argument and description to function comment
// TODO: Phase - add argument and description to function comment
// TODO: EFI_NOT_FOUND - add return value to function comment
// TODO: EFI_SUCCESS - add return value to function comment
{
EFI_HANDLE HostBridgeHandle;
EFI_HANDLE RootBridgeHandle;
@ -1842,6 +1756,33 @@ Returns:
return EFI_SUCCESS;
}
/**
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
PCI controllers before enumeration.
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
enumeration.
@param This Pointer to the EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL instance.
@param RootBridgeHandle The associated PCI root bridge handle. Type EFI_HANDLE is defined in
InstallProtocolInterface() in the UEFI 2.0 Specification.
@param PciAddress The address of the PCI device on the PCI bus. This address can be passed to the
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL member functions to access the PCI
configuration space of the device. See Table 12-1 in the UEFI 2.0 Specification for
the definition of EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_PCI_ADDRESS.
@param Phase The phase of the PCI device enumeration.
@retval EFI_SUCCESS The requested parameters were returned.
@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
EFI_PCI_CONTROLLER_RESOURCE_ALLOCATION_PHASE.
@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
bridge.
**/
EFI_STATUS
PreprocessController (
IN PCI_IO_DEVICE *Bridge,
@ -1850,24 +1791,6 @@ PreprocessController (
IN UINT8 Func,
IN EFI_PCI_CONTROLLER_RESOURCE_ALLOCATION_PHASE Phase
)
/**
Routine Description:
Arguments:
Returns:
None
**/
// TODO: Bridge - add argument and description to function comment
// TODO: Bus - add argument and description to function comment
// TODO: Device - add argument and description to function comment
// TODO: Func - add argument and description to function comment
// TODO: Phase - add argument and description to function comment
// TODO: EFI_UNSUPPORTED - add return value to function comment
// TODO: EFI_SUCCESS - add return value to function comment
{
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_PCI_ADDRESS RootBridgePciAddress;
EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc;
@ -1949,6 +1872,19 @@ Returns:
return EFI_SUCCESS;
}
/**
Hot plug request notify.
@param This - A pointer to the hot plug request protocol.
@param Operation - The operation.
@param Controller - A pointer to the controller.
@param RemainningDevicePath - A pointer to the device path.
@param NumberOfChildren - A the number of child handle in the ChildHandleBuffer.
@param ChildHandleBuffer - A pointer to the array contain the child handle.
@retval EFI_NOT_FOUND Can not find bridge according to controller handle
@retval EFI_SUCCESS Success operating
**/
EFI_STATUS
EFIAPI
PciHotPlugRequestNotify (
@ -1959,31 +1895,6 @@ PciHotPlugRequestNotify (
IN OUT UINT8 *NumberOfChildren,
IN OUT EFI_HANDLE * ChildHandleBuffer
)
/**
Routine Description:
Hot plug request notify.
Arguments:
This - A pointer to the hot plug request protocol.
Operation - The operation.
Controller - A pointer to the controller.
RemainningDevicePath - A pointer to the device path.
NumberOfChildren - A the number of child handle in the ChildHandleBuffer.
ChildHandleBuffer - A pointer to the array contain the child handle.
Returns:
Status code.
**/
// TODO: RemainingDevicePath - add argument and description to function comment
// TODO: EFI_NOT_FOUND - add return value to function comment
// TODO: EFI_SUCCESS - add return value to function comment
// TODO: EFI_SUCCESS - add return value to function comment
// TODO: EFI_SUCCESS - add return value to function comment
{
PCI_IO_DEVICE *Bridge;
PCI_IO_DEVICE *Temp;
@ -2074,22 +1985,15 @@ Returns:
return EFI_SUCCESS;
}
/**
Search hostbridge according to given handle
@return whether found
**/
BOOLEAN
SearchHostBridgeHandle (
IN EFI_HANDLE RootBridgeHandle
)
/**
Routine Description:
Arguments:
Returns:
None
**/
// TODO: RootBridgeHandle - add argument and description to function comment
{
EFI_HANDLE HostBridgeHandle;
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
@ -2122,25 +2026,15 @@ Returns:
return FALSE;
}
/**
Add host bridge handle to global variable for enumating.
@param HostBridgeHandle host bridge handle
**/
EFI_STATUS
AddHostBridgeEnumerator (
IN EFI_HANDLE HostBridgeHandle
)
/**
Routine Description:
Arguments:
Returns:
None
**/
// TODO: HostBridgeHandle - add argument and description to function comment
// TODO: EFI_ABORTED - add return value to function comment
// TODO: EFI_ABORTED - add return value to function comment
// TODO: EFI_SUCCESS - add return value to function comment
{
UINTN Index;
@ -2161,3 +2055,4 @@ Returns:
return EFI_SUCCESS;
}

View File

@ -1,5 +1,6 @@
/**@file
Header file declares all logic function for PCI bus enumeration.
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@ -17,165 +18,127 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include "PciResourceSupport.h"
/**
This routine is used to enumerate entire pci bus system
in a given platform
@param Controller Parent controller handle
@return Status of enumerating
**/
EFI_STATUS
PciEnumerator (
IN EFI_HANDLE Controller
)
/**
Routine Description:
TODO: Add function description
Arguments:
Controller - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
Enumerate PCI root bridge
@param PciResAlloc Pointer to protocol instance of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
@param RootBridgeDev Instance of root bridge device
@retval EFI_SUCCESS Success to enumerate root bridge
@retval Others Fail to enumerate root bridge
**/
EFI_STATUS
PciRootBridgeEnumerator (
IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc,
IN PCI_IO_DEVICE *RootBridgeDev
)
/**
Routine Description:
TODO: Add function description
Arguments:
PciResAlloc - TODO: add argument description
RootBridgeDev - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
This routine is used to process option rom on a certain root bridge
@param Bridge Given parent's root bridge
@param RomBase Base address of ROM driver loaded from
@param MaxLength Max rom size
@retval EFI_SUCCESS Success to process option rom image.
**/
EFI_STATUS
ProcessOptionRom (
IN PCI_IO_DEVICE *Bridge,
IN UINT64 RomBase,
IN UINT64 MaxLength
)
/**
Routine Description:
TODO: Add function description
Arguments:
Bridge - TODO: add argument description
RomBase - TODO: add argument description
MaxLength - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
This routine is used to assign bus number to the given PCI bus system
@param Bridge Parent root bridge instance
@param StartBusNumber Number of beginning
@param SubBusNumber the number of sub bus
@retval EFI_SUCCESS Success to assign bus number
**/
EFI_STATUS
PciAssignBusNumber (
IN PCI_IO_DEVICE *Bridge,
IN UINT8 StartBusNumber,
OUT UINT8 *SubBusNumber
)
/**
Routine Description:
TODO: Add function description
Arguments:
Bridge - TODO: add argument description
StartBusNumber - TODO: add argument description
SubBusNumber - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
This routine is used to determine the root bridge attribute by interfacing
the host bridge resource allocation protocol.
@param PciResAlloc Protocol instance of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
@param RootBridgeDev Root bridge instance
@retval EFI_SUCCESS Success to get root bridge's attribute
@retval Others Fail to get attribute
**/
EFI_STATUS
DetermineRootBridgeAttributes (
IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc,
IN PCI_IO_DEVICE *RootBridgeDev
)
/**
Routine Description:
TODO: Add function description
Arguments:
PciResAlloc - TODO: add argument description
RootBridgeDev - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
Get Max Option Rom size on this bridge
@param Bridge Bridge device instance
@return Max size of option rom
**/
UINT64
GetMaxOptionRomSize (
IN PCI_IO_DEVICE *Bridge
)
/**
Routine Description:
TODO: Add function description
Arguments:
Bridge - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
Process attributes of devices on this host bridge
@param PciResAlloc Protocol instance of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
@retval EFI_NOT_FOUND Can not find the specific root bridge device
@retval EFI_SUCCESS Success Process attribute
@retval Others Can not determine the root bridge device's attribute
**/
EFI_STATUS
PciHostBridgeDeviceAttribute (
IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc
)
/**
Routine Description:
TODO: Add function description
Arguments:
PciResAlloc - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
Get resource allocation status from the ACPI pointer
@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
GetResourceAllocationStatus (
VOID *AcpiConfig,
@ -185,114 +148,77 @@ GetResourceAllocationStatus (
OUT UINT64 *Mem64ResStatus,
OUT UINT64 *PMem64ResStatus
)
/**
Routine Description:
TODO: Add function description
Arguments:
AcpiConfig - TODO: add argument description
IoResStatus - TODO: add argument description
Mem32ResStatus - TODO: add argument description
PMem32ResStatus - TODO: add argument description
Mem64ResStatus - TODO: add argument description
PMem64ResStatus - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
Remove a PCI device from device pool and mark its bar
@param PciDevice Instance of Pci device
@retval EFI_SUCCESS Success Operation
@retval EFI_ABORTED Pci device is a root bridge
**/
EFI_STATUS
RejectPciDevice (
IN PCI_IO_DEVICE *PciDevice
)
/**
Routine Description:
TODO: Add function description
Arguments:
PciDevice - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
Determine whethter a PCI device can be rejected
@param PciResNode Pointer to Pci resource node instance
@return whethter a PCI device can be rejected
**/
BOOLEAN
IsRejectiveDevice (
IN PCI_RESOURCE_NODE *PciResNode
)
/**
Routine Description:
TODO: Add function description
Arguments:
PciResNode - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
Compare two resource node and get the larger resource consumer
@param PciResNode1 resource node 1 want to be compared
@param PciResNode2 resource node 2 want to be compared
@return Larger resource consumer.
**/
PCI_RESOURCE_NODE *
GetLargerConsumerDevice (
IN PCI_RESOURCE_NODE *PciResNode1,
IN PCI_RESOURCE_NODE *PciResNode2
)
/**
Routine Description:
TODO: Add function description
Arguments:
PciResNode1 - TODO: add argument description
PciResNode2 - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
Get the max resource consumer in the host resource pool
@param ResPool Pointer to resource pool node
@return the max resource consumer in the host resource pool
**/
PCI_RESOURCE_NODE *
GetMaxResourceConsumerDevice (
IN PCI_RESOURCE_NODE *ResPool
)
/**
Routine Description:
TODO: Add function description
Arguments:
ResPool - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
Adjust host bridge allocation so as to reduce resource requirement
@param IoPool Pointer to instance of I/O 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 Mem64Pool Pointer to instance of 64-bit memory resource node
@param PMem64Pool Pointer to instance of 64-bit Pmemory resource node
@param IoResStatus Status of I/O resource Node
@param Mem32ResStatus Status of 32-bit memory resource Node
@param PMem32ResStatus Status of 32-bit Pmemory resource node
@param Mem64ResStatus Status of 64-bit memory resource node
@param PMem64ResStatus Status of 64-bit Pmemory resource node
**/
EFI_STATUS
PciHostBridgeAdjustAllocation (
IN PCI_RESOURCE_NODE *IoPool,
@ -306,32 +232,20 @@ PciHostBridgeAdjustAllocation (
IN UINT64 Mem64ResStatus,
IN UINT64 PMem64ResStatus
)
/**
Routine Description:
TODO: Add function description
Arguments:
IoPool - TODO: add argument description
Mem32Pool - TODO: add argument description
PMem32Pool - TODO: add argument description
Mem64Pool - TODO: add argument description
PMem64Pool - TODO: add argument description
IoResStatus - TODO: add argument description
Mem32ResStatus - TODO: add argument description
PMem32ResStatus - TODO: add argument description
Mem64ResStatus - TODO: add argument description
PMem64ResStatus - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
Summary requests for all resource type, and contruct ACPI resource
requestor instance.
@param Bridge detecting bridge
@param IoNode Pointer to instance of I/O 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 Mem64Node Pointer to instance of 64-bit memory resource node
@param PMem64Node Pointer to instance of 64-bit Pmemory resource node
@param pConfig outof buffer holding new constructed APCI resource requestor
**/
EFI_STATUS
ConstructAcpiResourceRequestor (
IN PCI_IO_DEVICE *Bridge,
@ -342,29 +256,20 @@ ConstructAcpiResourceRequestor (
IN PCI_RESOURCE_NODE *PMem64Node,
OUT VOID **pConfig
)
/**
Routine Description:
TODO: Add function description
Arguments:
Bridge - TODO: add argument description
IoNode - TODO: add argument description
Mem32Node - TODO: add argument description
PMem32Node - TODO: add argument description
Mem64Node - TODO: add argument description
PMem64Node - TODO: add argument description
pConfig - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
Get resource base from a acpi configuration descriptor.
@param pConfig an acpi configuration descriptor.
@param IoBase output of I/O resource base address
@param Mem32Base output of 32-bit memory base address
@param PMem32Base output of 32-bit pmemory base address
@param Mem64Base output of 64-bit memory base address
@param PMem64Base output of 64-bit pmemory base address
@return EFI_SUCCESS Success operation
**/
EFI_STATUS
GetResourceBase (
IN VOID *pConfig,
@ -374,70 +279,49 @@ GetResourceBase (
OUT UINT64 *Mem64Base,
OUT UINT64 *PMem64Base
)
/**
Routine Description:
TODO: Add function description
Arguments:
pConfig - TODO: add argument description
IoBase - TODO: add argument description
Mem32Base - TODO: add argument description
PMem32Base - TODO: add argument description
Mem64Base - TODO: add argument description
PMem64Base - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
Enumerate pci bridge, allocate resource and determine attribute
for devices on this bridge
@param BridgeDev Pointer to instance of bridge device
@retval EFI_SUCCESS Success operation
@retval Others Fail to enumerate
**/
EFI_STATUS
PciBridgeEnumerator (
IN PCI_IO_DEVICE *BridgeDev
)
/**
Routine Description:
TODO: Add function description
Arguments:
BridgeDev - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
Allocate all kinds of resource for bridge
@param Bridge Pointer to bridge instance
@retval EFI_SUCCESS Success operation.
@retval Others Fail to allocate resource for bridge
**/
EFI_STATUS
PciBridgeResourceAllocator (
IN PCI_IO_DEVICE *Bridge
)
/**
Routine Description:
TODO: Add function description
Arguments:
Bridge - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
Get resource base address for a pci bridge device
@param Bridge Given Pci driver instance
@param IoBase output for base address of I/O 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 Mem64Base output for base address of 64-bit memory type resource
@param PMem64Base output for base address of 64-bit Pmemory type resource
@retval EFI_SUCCESS Succes to get resource base address
**/
EFI_STATUS
GetResourceBaseFromBridge (
IN PCI_IO_DEVICE *Bridge,
@ -447,72 +331,118 @@ GetResourceBaseFromBridge (
OUT UINT64 *Mem64Base,
OUT UINT64 *PMem64Base
)
/**
Routine Description:
TODO: Add function description
Arguments:
Bridge - TODO: add argument description
IoBase - TODO: add argument description
Mem32Base - TODO: add argument description
PMem32Base - TODO: add argument description
Mem64Base - TODO: add argument description
PMem64Base - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
Process Option Rom on this host bridge
@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
**/
EFI_STATUS
PciHostBridgeP2CProcess (
IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc
)
/**
Routine Description:
TODO: Add function description
Arguments:
PciResAlloc - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
These are the notifications from the PCI bus driver that it is about to enter a certain
phase of the PCI enumeration process.
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.
Eight notification points are defined at this time. See belows:
EfiPciHostBridgeBeginEnumeration - Resets the host bridge PCI apertures and internal data
structures. The PCI enumerator should issue this notification
before starting a fresh enumeration process. Enumeration cannot
be restarted after sending any other notification such as
EfiPciHostBridgeBeginBusAllocation.
EfiPciHostBridgeBeginBusAllocation - The bus allocation phase is about to begin. No specific action is
required here. This notification can be used to perform any
chipset-specific programming.
EfiPciHostBridgeEndBusAllocation - The bus allocation and bus programming phase is complete. No
specific action is required here. This notification can be used to
perform any chipset-specific programming.
EfiPciHostBridgeBeginResourceAllocation - The resource allocation phase is about to begin. No specific
action is required here. This notification can be used to perform
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
GetProposedResources(). Before calling NotifyPhase() with a Phase of
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
SubmitResources(). This function pads the resource amount
to suit the root bridge hardware, takes care of dependencies between
the PCI root bridges, and calls the Global Coherency Domain (GCD)
with the allocation request. In the case of padding, the allocated range
could be bigger than what was requested.
EfiPciHostBridgeSetResources - Programs the host bridge hardware to decode previously allocated
resources (proposed resources) for all the PCI root bridges. After the
hardware is programmed, reassigning resources will not be supported.
The bus settings are not affected.
EfiPciHostBridgeFreeResources - Deallocates resources that were previously allocated for all the PCI
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
resources fails, the PCI enumerator can use this notification to
deallocate previous resources, adjust the requests, and retry
allocation.
EfiPciHostBridgeEndResourceAllocation- The resource allocation phase is completed. No specific action is
required here. This notification can be used to perform any chipsetspecific
programming.
@param[in] This The instance pointer of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
@param[in] Phase The phase during enumeration
@retval EFI_NOT_READY This phase cannot be entered at this time. For example, this error
is valid for a Phase of EfiPciHostBridgeAllocateResources if
SubmitResources() has not been called for one or more
PCI root bridges before this call
@retval EFI_DEVICE_ERROR Programming failed due to a hardware error. This error is valid
for a Phase of EfiPciHostBridgeSetResources.
@retval EFI_INVALID_PARAMETER Invalid phase parameter
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
This error is valid for a Phase of EfiPciHostBridgeAllocateResources if the
previously submitted resource requests cannot be fulfilled or
were only partially fulfilled.
@retval EFI_SUCCESS The notification was accepted without any errors.
**/
EFI_STATUS
NotifyPhase (
IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc,
EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PHASE Phase
)
/**
Routine Description:
TODO: Add function description
Arguments:
PciResAlloc - TODO: add argument description
Phase - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
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
PCI controllers before enumeration.
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
enumeration.
@param This Pointer to the EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL instance.
@param RootBridgeHandle The associated PCI root bridge handle. Type EFI_HANDLE is defined in
InstallProtocolInterface() in the UEFI 2.0 Specification.
@param PciAddress The address of the PCI device on the PCI bus. This address can be passed to the
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL member functions to access the PCI
configuration space of the device. See Table 12-1 in the UEFI 2.0 Specification for
the definition of EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_PCI_ADDRESS.
@param Phase The phase of the PCI device enumeration.
@retval EFI_SUCCESS The requested parameters were returned.
@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
EFI_PCI_CONTROLLER_RESOURCE_ALLOCATION_PHASE.
@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
bridge.
**/
EFI_STATUS
PreprocessController (
IN PCI_IO_DEVICE *Bridge,
@ -521,27 +451,21 @@ PreprocessController (
IN UINT8 Func,
IN EFI_PCI_CONTROLLER_RESOURCE_ALLOCATION_PHASE Phase
)
/**
Routine Description:
TODO: Add function description
Arguments:
Bridge - TODO: add argument description
Bus - TODO: add argument description
Device - TODO: add argument description
Func - TODO: add argument description
Phase - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
Hot plug request notify.
@param This - A pointer to the hot plug request protocol.
@param Operation - The operation.
@param Controller - A pointer to the controller.
@param RemainningDevicePath - A pointer to the device path.
@param NumberOfChildren - A the number of child handle in the ChildHandleBuffer.
@param ChildHandleBuffer - A pointer to the array contain the child handle.
@retval EFI_NOT_FOUND Can not find bridge according to controller handle
@retval EFI_SUCCESS Success operating
**/
EFI_STATUS
EFIAPI
PciHotPlugRequestNotify (
@ -552,68 +476,28 @@ PciHotPlugRequestNotify (
IN OUT UINT8 *NumberOfChildren,
IN OUT EFI_HANDLE * ChildHandleBuffer
)
/**
Routine Description:
TODO: Add function description
Arguments:
This - TODO: add argument description
Operation - TODO: add argument description
Controller - TODO: add argument description
RemainingDevicePath - TODO: add argument description
NumberOfChildren - TODO: add argument description
ChildHandleBuffer - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
Search hostbridge according to given handle
@return whether found
**/
BOOLEAN
SearchHostBridgeHandle (
IN EFI_HANDLE RootBridgeHandle
)
/**
Routine Description:
TODO: Add function description
Arguments:
RootBridgeHandle - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
Add host bridge handle to global variable for enumating.
@param HostBridgeHandle host bridge handle
**/
EFI_STATUS
AddHostBridgeEnumerator (
IN EFI_HANDLE HostBridgeHandle
)
/**
Routine Description:
TODO: Add function description
Arguments:
HostBridgeHandle - TODO: add argument description
Returns:
TODO: add return values
**/
;
#endif

View File

@ -17,6 +17,18 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include "PciCommand.h"
#include "PciIo.h"
/**
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 Pci Output buffer for PCI device structure
@param Bus PCI bus NO
@param Device PCI device NO
@param Func PCI Func NO
@retval EFI_NOT_FOUND device not present
@retval EFI_SUCCESS device is found.
**/
EFI_STATUS
PciDevicePresent (
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,
@ -25,26 +37,6 @@ PciDevicePresent (
UINT8 Device,
UINT8 Func
)
/**
Routine Description:
This routine is used to check whether the pci device is present
Arguments:
Returns:
None
**/
// TODO: PciRootBridgeIo - add argument and description to function comment
// TODO: Pci - add argument and description to function comment
// TODO: Bus - add argument and description to function comment
// TODO: Device - add argument and description to function comment
// TODO: Func - 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
{
UINT64 Address;
EFI_STATUS Status;
@ -87,25 +79,19 @@ Returns:
return EFI_NOT_FOUND;
}
/**
Collect all the resource information under this root bridge
A database that records all the information about pci device subject to this
root bridge will then be created.
@param Bridge Parent bridge instance
@param StartBusNumer Bus number of begining
**/
EFI_STATUS
PciPciDeviceInfoCollector (
IN PCI_IO_DEVICE *Bridge,
UINT8 StartBusNumber
)
/**
Routine Description:
Arguments:
Returns:
None
**/
// TODO: Bridge - add argument and description to function comment
// TODO: StartBusNumber - add argument and description to function comment
// TODO: EFI_SUCCESS - add return value to function comment
{
EFI_STATUS Status;
PCI_TYPE00 Pci;
@ -201,6 +187,16 @@ Returns:
return EFI_SUCCESS;
}
/**
Seach required device and get PCI device info block
@param Bridge Parent bridge instance
@param Pci Output of PCI device info block
@param Bus PCI bus NO.
@param Device PCI device NO.
@param Func PCI func NO.
@param PciDevice output of searched PCI device instance
**/
EFI_STATUS
PciSearchDevice (
IN PCI_IO_DEVICE *Bridge,
@ -210,29 +206,6 @@ PciSearchDevice (
IN UINT8 Func,
OUT PCI_IO_DEVICE **PciDevice
)
/**
Routine Description:
Search required device.
Arguments:
Bridge - A pointer to the PCI_IO_DEVICE.
Pci - A pointer to the PCI_TYPE00.
Bus - Bus number.
Device - Device number.
Func - Function number.
PciDevice - The Required pci device.
Returns:
Status code.
**/
// TODO: EFI_OUT_OF_RESOURCES - add return value to function comment
// TODO: EFI_OUT_OF_RESOURCES - add return value to function comment
// TODO: EFI_SUCCESS - add return value to function comment
{
PCI_IO_DEVICE *PciIoDevice;
@ -331,6 +304,17 @@ Returns:
return EFI_SUCCESS;
}
/**
Create PCI private data for PCI device
@param Bridge Parent bridge instance
@param Pci PCI bar block
@param Bus PCI device Bus NO.
@param Device PCI device DeviceNO.
@param Func PCI device's func NO.
@return new PCI device's private date structure.
**/
PCI_IO_DEVICE *
GatherDeviceInfo (
IN PCI_IO_DEVICE *Bridge,
@ -339,22 +323,6 @@ GatherDeviceInfo (
UINT8 Device,
UINT8 Func
)
/**
Routine Description:
Arguments:
Returns:
None
**/
// TODO: Bridge - add argument and description to function comment
// TODO: Pci - add argument and description to function comment
// TODO: Bus - add argument and description to function comment
// TODO: Device - add argument and description to function comment
// TODO: Func - add argument and description to function comment
{
UINTN Offset;
UINTN BarIndex;
@ -401,6 +369,17 @@ Returns:
return PciIoDevice;
}
/**
Create private data for bridge device's PPB.
@param Bridge Parent bridge
@param Pci Pci device block
@param Bus Bridge device's bus NO.
@param Device Bridge device's device NO.
@param Func Bridge device's func NO.
@return bridge device instance
**/
PCI_IO_DEVICE *
GatherPpbInfo (
IN PCI_IO_DEVICE *Bridge,
@ -409,22 +388,6 @@ GatherPpbInfo (
UINT8 Device,
UINT8 Func
)
/**
Routine Description:
Arguments:
Returns:
None
**/
// TODO: Bridge - add argument and description to function comment
// TODO: Pci - add argument and description to function comment
// TODO: Bus - add argument and description to function comment
// TODO: Device - add argument and description to function comment
// TODO: Func - add argument and description to function comment
{
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
PCI_IO_DEVICE *PciIoDevice;
@ -535,6 +498,17 @@ Returns:
return PciIoDevice;
}
/**
Create private data for hotplug bridge device
@param Bridge Parent bridge instance
@param Pci PCI bar block
@param Bus hotplug bridge device's bus NO.
@param Device hotplug bridge device's device NO.
@param Func hotplug bridge device's Func NO.
@return hotplug bridge device instance
**/
PCI_IO_DEVICE *
GatherP2CInfo (
IN PCI_IO_DEVICE *Bridge,
@ -543,22 +517,6 @@ GatherP2CInfo (
UINT8 Device,
UINT8 Func
)
/**
Routine Description:
Arguments:
Returns:
None
**/
// TODO: Bridge - add argument and description to function comment
// TODO: Pci - add argument and description to function comment
// TODO: Bus - add argument and description to function comment
// TODO: Device - add argument and description to function comment
// TODO: Func - add argument and description to function comment
{
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
PCI_IO_DEVICE *PciIoDevice;
@ -609,24 +567,19 @@ Returns:
return PciIoDevice;
}
/**
Create device path for pci deivce
@param ParentDevicePath Parent bridge's path
@param PciIoDevice Pci device instance
@return device path protocol instance for specific pci device.
**/
EFI_DEVICE_PATH_PROTOCOL *
CreatePciDevicePath (
IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath,
IN PCI_IO_DEVICE *PciIoDevice
)
/**
Routine Description:
Arguments:
Returns:
None
**/
// TODO: ParentDevicePath - add argument and description to function comment
// TODO: PciIoDevice - add argument and description to function comment
{
PCI_DEVICE_PATH PciNode;
@ -645,6 +598,18 @@ Returns:
return PciIoDevice->DevicePath;
}
/**
Check the bar is existed or not.
@param PciIoDevice - A pointer to the PCI_IO_DEVICE.
@param Offset - The offset.
@param BarLengthValue - The bar length value.
@param OriginalBarValue - The original bar value.
@retval EFI_NOT_FOUND - The bar don't exist.
@retval EFI_SUCCESS - The bar exist.
**/
EFI_STATUS
BarExisted (
IN PCI_IO_DEVICE *PciIoDevice,
@ -652,25 +617,7 @@ BarExisted (
OUT UINT32 *BarLengthValue,
OUT UINT32 *OriginalBarValue
)
/**
Routine Description:
Check the bar is existed or not.
Arguments:
PciIoDevice - A pointer to the PCI_IO_DEVICE.
Offset - The offset.
BarLengthValue - The bar length value.
OriginalBarValue - The original bar value.
Returns:
EFI_NOT_FOUND - The bar don't exist.
EFI_SUCCESS - The bar exist.
**/
{
EFI_PCI_IO_PROTOCOL *PciIo;
UINT32 OriginalValue;
@ -718,6 +665,17 @@ Returns:
}
}
/**
Test whether the device can support attributes
@param PciIoDevice Pci device instance
@param Command Command register value.
@param BridgeControl Bridge control value for PPB or P2C.
@param OldCommand Old command register offset
@param OldBridgeControl Old Bridge control value for PPB or P2C.
@return EFI_SUCCESS
**/
EFI_STATUS
PciTestSupportedAttribute (
IN PCI_IO_DEVICE *PciIoDevice,
@ -726,23 +684,6 @@ PciTestSupportedAttribute (
IN UINT16 *OldCommand,
IN UINT16 *OldBridgeControl
)
/**
Routine Description:
Arguments:
Returns:
None
**/
// TODO: PciIoDevice - add argument and description to function comment
// TODO: Command - add argument and description to function comment
// TODO: BridgeControl - add argument and description to function comment
// TODO: OldCommand - add argument and description to function comment
// TODO: OldBridgeControl - add argument and description to function comment
// TODO: EFI_SUCCESS - add return value to function comment
{
EFI_TPL OldTpl;
@ -802,6 +743,15 @@ Returns:
return EFI_SUCCESS;
}
/**
Set the supported or current attributes of a PCI device
@param PciIoDevice - Structure pointer for PCI device.
@param Command - Command register value.
@param BridgeControl - Bridge control value for PPB or P2C.
@param Option - Make a choice of EFI_SET_SUPPORTS or EFI_SET_ATTRIBUTES.
**/
EFI_STATUS
PciSetDeviceAttribute (
IN PCI_IO_DEVICE *PciIoDevice,
@ -809,36 +759,6 @@ PciSetDeviceAttribute (
IN UINT16 BridgeControl,
IN UINTN Option
)
/**
Routine Description:
Set the supported or current attributes of a PCI device
Arguments:
PciIoDevice - Structure pointer for PCI device.
Command - Command register value.
BridgeControl - Bridge control value for PPB or P2C.
Option - Make a choice of EFI_SET_SUPPORTS or EFI_SET_ATTRIBUTES.
Returns:
**/
/**
Routine Description:
Arguments:
Returns:
EFI_SUCCESS Always success
**/
{
UINT64 Attributes;
@ -920,29 +840,17 @@ Returns:
return EFI_SUCCESS;
}
/**
Determine if the device can support Fast Back to Back attribute
@param PciIoDevice Pci device instance
@param StatusIndex Status register value
**/
EFI_STATUS
GetFastBackToBackSupport (
IN PCI_IO_DEVICE *PciIoDevice,
IN UINT8 StatusIndex
)
/**
Routine Description:
Determine if the device can support Fast Back to Back attribute
Arguments:
Returns:
None
**/
// TODO: PciIoDevice - add argument and description to function comment
// TODO: StatusIndex - add argument and description to function comment
// TODO: EFI_UNSUPPORTED - add return value to function comment
// TODO: EFI_SUCCESS - add return value to function comment
// TODO: EFI_UNSUPPORTED - add return value to function comment
{
EFI_PCI_IO_PROTOCOL *PciIo;
EFI_STATUS Status;
@ -968,27 +876,19 @@ Returns:
}
/**
Process the option ROM for all the children of the specified parent PCI device.
It can only be used after the first full Option ROM process.
@param PciIoDevice Pci device instance
@retval EFI_SUCCESS Success Operation.
**/
STATIC
EFI_STATUS
ProcessOptionRomLight (
IN PCI_IO_DEVICE *PciIoDevice
)
/**
Routine Description:
Process the option ROM for all the children of the specified parent PCI device.
It can only be used after the first full Option ROM process.
Arguments:
Returns:
None
**/
// TODO: PciIoDevice - add argument and description to function comment
// TODO: EFI_SUCCESS - add return value to function comment
{
PCI_IO_DEVICE *Temp;
LIST_ENTRY *CurrentLink;
@ -1018,25 +918,16 @@ Returns:
return EFI_SUCCESS;
}
/**
Determine the related attributes of all devices under a Root Bridge
@param PciIoDevice PCI device instance
**/
EFI_STATUS
DetermineDeviceAttribute (
IN PCI_IO_DEVICE *PciIoDevice
)
/**
Routine Description:
Determine the related attributes of all devices under a Root Bridge
Arguments:
Returns:
None
**/
// TODO: PciIoDevice - add argument and description to function comment
// TODO: EFI_SUCCESS - add return value to function comment
{
UINT16 Command;
UINT16 BridgeControl;
@ -1197,25 +1088,16 @@ Returns:
return EFI_SUCCESS;
}
/**
This routine is used to update the bar information for those incompatible PCI device
@param PciIoDevice Pci device instance
@return EFI_UNSUPPORTED failed to update Pci Info
**/
EFI_STATUS
UpdatePciInfo (
IN PCI_IO_DEVICE *PciIoDevice
)
/**
Routine Description:
This routine is used to update the bar information for those incompatible PCI device
Arguments:
Returns:
None
**/
// TODO: PciIoDevice - add argument and description to function comment
// TODO: EFI_UNSUPPORTED - add return value to function comment
{
EFI_STATUS Status;
UINTN BarIndex;
@ -1354,26 +1236,18 @@ Returns:
}
/**
This routine will update the alignment with the new alignment
@param Alignment old alignment
@param NewAlignment new alignment
**/
VOID
SetNewAlign (
IN UINT64 *Alignment,
IN UINT64 NewAlignment
)
/**
Routine Description:
This routine will update the alignment with the new alignment
Arguments:
Returns:
None
**/
// TODO: Alignment - add argument and description to function comment
// TODO: NewAlignment - add argument and description to function comment
{
UINT64 OldAlignment;
UINTN ShiftBit;
@ -1432,26 +1306,21 @@ Returns:
return ;
}
/**
Parse PCI bar bit.
@param PciIoDevice Pci device instance
@param Offset bar offset
@param BarIndex bar index
@return next bar offset.
**/
UINTN
PciParseBar (
IN PCI_IO_DEVICE *PciIoDevice,
IN UINTN Offset,
IN UINTN BarIndex
)
/**
Routine Description:
Arguments:
Returns:
None
**/
// TODO: PciIoDevice - add argument and description to function comment
// TODO: Offset - add argument and description to function comment
// TODO: BarIndex - add argument and description to function comment
{
UINT32 Value;
UINT32 OriginalValue;
@ -1582,7 +1451,7 @@ Returns:
Data = Value;
Index = 0;
for (Data = Value; Data != 0; Data >>= 1) {
Index ++;
Index ++;
}
Value |= ((UINT32)(-1) << Index);
@ -1624,26 +1493,16 @@ Returns:
return Offset + 4;
}
/**
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
**/
EFI_STATUS
InitializePciDevice (
IN PCI_IO_DEVICE *PciIoDevice
)
/**
Routine Description:
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
Arguments:
Returns:
None
**/
// TODO: PciIoDevice - add argument and description to function comment
// TODO: EFI_SUCCESS - add return value to function comment
{
EFI_PCI_IO_PROTOCOL *PciIo;
UINT8 Offset;
@ -1662,23 +1521,15 @@ Returns:
return EFI_SUCCESS;
}
/**
Init PPB for bridge device
@param PciIoDevice Pci device instance
**/
EFI_STATUS
InitializePpb (
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
{
EFI_PCI_IO_PROTOCOL *PciIo;
@ -1715,23 +1566,15 @@ Returns:
return EFI_SUCCESS;
}
/**
Init private data for Hotplug bridge device
@param PciIoDevice hotplug bridge device
**/
EFI_STATUS
InitializeP2C (
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
{
EFI_PCI_IO_PROTOCOL *PciIo;
@ -1761,6 +1604,18 @@ Returns:
return EFI_SUCCESS;
}
/**
Create and initiliaze general PCI I/O device instance for
PCI device/bridge device/hotplug bridge device.
@param PciRootBridgeIo Pointer to instance of EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL
@param Pci Pci bar block
@param Bus device Bus NO.
@param Device device device NO.
@param Func device func NO.
@return instance of PCI device
**/
PCI_IO_DEVICE *
CreatePciIoDevice (
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,
@ -1769,22 +1624,6 @@ CreatePciIoDevice (
UINT8 Device,
UINT8 Func
)
/**
Routine Description:
Arguments:
Returns:
None
**/
// TODO: PciRootBridgeIo - add argument and description to function comment
// TODO: Pci - add argument and description to function comment
// TODO: Bus - add argument and description to function comment
// TODO: Device - add argument and description to function comment
// TODO: Func - add argument and description to function comment
{
EFI_STATUS Status;
@ -1858,28 +1697,19 @@ Returns:
return PciIoDevice;
}
EFI_STATUS
PciEnumeratorLight (
IN EFI_HANDLE Controller
)
/**
Routine Description:
This routine is used to enumerate entire pci bus system
in a given platform
It is only called on the second start on the same Root Bridge.
Arguments:
Returns:
None
@param Controller Parent bridge handler
@return status of operation.
**/
// TODO: Controller - add argument and description to function comment
// TODO: EFI_SUCCESS - add return value to function comment
// TODO: EFI_SUCCESS - add return value to function comment
EFI_STATUS
PciEnumeratorLight (
IN EFI_HANDLE Controller
)
{
EFI_STATUS Status;
@ -1978,6 +1808,17 @@ Returns:
return EFI_SUCCESS;
}
/**
Get bus range.
@param Descriptors A pointer to the address space descriptor.
@param MinBus The min bus.
@param MaxBus The max bus.
@param BusRange The bus range.
@retval EFI_SUCCESS Success operation.
@retval EFI_NOT_FOUND can not find the specific bus.
**/
EFI_STATUS
PciGetBusRange (
IN EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR **Descriptors,
@ -1985,26 +1826,6 @@ PciGetBusRange (
OUT UINT16 *MaxBus,
OUT UINT16 *BusRange
)
/**
Routine Description:
Get the bus range.
Arguments:
Descriptors - A pointer to the address space descriptor.
MinBus - The min bus.
MaxBus - The max bus.
BusRange - The bus range.
Returns:
Status Code.
**/
// TODO: EFI_SUCCESS - add return value to function comment
// TODO: EFI_NOT_FOUND - add return value to function comment
{
while ((*Descriptors)->Desc != ACPI_END_TAG_DESCRIPTOR) {
@ -2034,20 +1855,6 @@ EFI_STATUS
StartManagingRootBridge (
IN PCI_IO_DEVICE *RootBridgeDev
)
/**
Routine Description:
Arguments:
Returns:
None
**/
// TODO: RootBridgeDev - add argument and description to function comment
// TODO: EFI_SUCCESS - add return value to function comment
{
EFI_HANDLE RootBridgeHandle;
EFI_STATUS Status;
@ -2084,25 +1891,19 @@ Returns:
}
/**
This routine can be used to check whether a PCI device should be rejected when light enumeration
@param PciIoDevice Pci device instance
@retval TRUE This device should be rejected
@retval FALSE This device shouldn't be rejected
**/
BOOLEAN
IsPciDeviceRejected (
IN PCI_IO_DEVICE *PciIoDevice
)
/**
Routine Description:
This routine can be used to check whether a PCI device should be rejected when light enumeration
Arguments:
Returns:
TRUE This device should be rejected
FALSE This device shouldn't be rejected
**/
// TODO: PciIoDevice - add argument and description to function comment
{
EFI_STATUS Status;
UINT32 TestValue;
@ -2204,27 +2005,17 @@ Returns:
return FALSE;
}
/**
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
)
/**
Routine Description:
TODO: Add function description
Arguments:
Bridge - TODO: add argument description
StartBusNumber - TODO: add argument description
Returns:
EFI_SUCCESS - TODO: Add description for return value
**/
{
EFI_STATUS Status;
PCI_TYPE00 Pci;

View File

@ -15,6 +15,18 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#ifndef _EFI_PCI_ENUMERATOR_SUPPORT_H
#define _EFI_PCI_ENUMERATOR_SUPPORT_H
/**
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 Pci Output buffer for PCI device structure
@param Bus PCI bus NO
@param Device PCI device NO
@param Func PCI Func NO
@retval EFI_NOT_FOUND device not present
@retval EFI_SUCCESS device is found.
**/
EFI_STATUS
PciDevicePresent (
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,
@ -23,50 +35,33 @@ PciDevicePresent (
UINT8 Device,
UINT8 Func
)
/**
Routine Description:
TODO: Add function description
Arguments:
PciRootBridgeIo - TODO: add argument description
Pci - TODO: add argument description
Bus - TODO: add argument description
Device - TODO: add argument description
Func - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
Collect all the resource information under this root bridge
A database that records all the information about pci device subject to this
root bridge will then be created.
@param Bridge Parent bridge instance
@param StartBusNumer Bus number of begining
**/
EFI_STATUS
PciPciDeviceInfoCollector (
IN PCI_IO_DEVICE *Bridge,
UINT8 StartBusNumber
)
/**
Routine Description:
TODO: Add function description
Arguments:
Bridge - TODO: add argument description
StartBusNumber - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
Seach required device and get PCI device info block
@param Bridge Parent bridge instance
@param Pci Output of PCI device info block
@param Bus PCI bus NO.
@param Device PCI device NO.
@param Func PCI func NO.
@param PciDevice output of searched PCI device instance
**/
EFI_STATUS
PciSearchDevice (
IN PCI_IO_DEVICE *Bridge,
@ -76,28 +71,19 @@ PciSearchDevice (
UINT8 Func,
PCI_IO_DEVICE **PciDevice
)
/**
Routine Description:
TODO: Add function description
Arguments:
Bridge - TODO: add argument description
Pci - TODO: add argument description
Bus - TODO: add argument description
Device - TODO: add argument description
Func - TODO: add argument description
PciDevice - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
Create PCI private data for PCI device
@param Bridge Parent bridge instance
@param Pci PCI bar block
@param Bus PCI device Bus NO.
@param Device PCI device DeviceNO.
@param Func PCI device's func NO.
@return new PCI device's private date structure.
**/
PCI_IO_DEVICE *
GatherDeviceInfo (
IN PCI_IO_DEVICE *Bridge,
@ -106,27 +92,19 @@ GatherDeviceInfo (
UINT8 Device,
UINT8 Func
)
/**
Routine Description:
TODO: Add function description
Arguments:
Bridge - TODO: add argument description
Pci - TODO: add argument description
Bus - TODO: add argument description
Device - TODO: add argument description
Func - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
Create private data for bridge device's PPB.
@param Bridge Parent bridge
@param Pci Pci device block
@param Bus Bridge device's bus NO.
@param Device Bridge device's device NO.
@param Func Bridge device's func NO.
@return bridge device instance
**/
PCI_IO_DEVICE *
GatherPpbInfo (
IN PCI_IO_DEVICE *Bridge,
@ -135,27 +113,19 @@ GatherPpbInfo (
UINT8 Device,
UINT8 Func
)
/**
Routine Description:
TODO: Add function description
Arguments:
Bridge - TODO: add argument description
Pci - TODO: add argument description
Bus - TODO: add argument description
Device - TODO: add argument description
Func - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
Create private data for hotplug bridge device
@param Bridge Parent bridge instance
@param Pci PCI bar block
@param Bus hotplug bridge device's bus NO.
@param Device hotplug bridge device's device NO.
@param Func hotplug bridge device's Func NO.
@return hotplug bridge device instance
**/
PCI_IO_DEVICE *
GatherP2CInfo (
IN PCI_IO_DEVICE *Bridge,
@ -164,50 +134,35 @@ GatherP2CInfo (
UINT8 Device,
UINT8 Func
)
/**
Routine Description:
TODO: Add function description
Arguments:
Bridge - TODO: add argument description
Pci - TODO: add argument description
Bus - TODO: add argument description
Device - TODO: add argument description
Func - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
Create device path for pci deivce
@param ParentDevicePath Parent bridge's path
@param PciIoDevice Pci device instance
@return device path protocol instance for specific pci device.
**/
EFI_DEVICE_PATH_PROTOCOL *
CreatePciDevicePath (
IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath,
IN PCI_IO_DEVICE *PciIoDevice
)
/**
Routine Description:
TODO: Add function description
Arguments:
ParentDevicePath - TODO: add argument description
PciIoDevice - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
Check the bar is existed or not.
@param PciIoDevice - A pointer to the PCI_IO_DEVICE.
@param Offset - The offset.
@param BarLengthValue - The bar length value.
@param OriginalBarValue - The original bar value.
@retval EFI_NOT_FOUND - The bar don't exist.
@retval EFI_SUCCESS - The bar exist.
**/
EFI_STATUS
BarExisted (
IN PCI_IO_DEVICE *PciIoDevice,
@ -215,26 +170,19 @@ BarExisted (
OUT UINT32 *BarLengthValue,
OUT UINT32 *OriginalBarValue
)
/**
Routine Description:
TODO: Add function description
Arguments:
PciIoDevice - TODO: add argument description
Offset - TODO: add argument description
BarLengthValue - TODO: add argument description
OriginalBarValue - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
Test whether the device can support attributes
@param PciIoDevice Pci device instance
@param Command Command register value.
@param BridgeControl Bridge control value for PPB or P2C.
@param OldCommand Old command register offset
@param OldBridgeControl Old Bridge control value for PPB or P2C.
@return EFI_SUCCESS
**/
EFI_STATUS
PciTestSupportedAttribute (
IN PCI_IO_DEVICE *PciIoDevice,
@ -243,27 +191,17 @@ PciTestSupportedAttribute (
IN UINT16 *OldCommand,
IN UINT16 *OldBridgeControl
)
/**
Routine Description:
TODO: Add function description
Arguments:
PciIoDevice - TODO: add argument description
Command - TODO: add argument description
BridgeControl - TODO: add argument description
OldCommand - TODO: add argument description
OldBridgeControl - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
Set the supported or current attributes of a PCI device
@param PciIoDevice - Structure pointer for PCI device.
@param Command - Command register value.
@param BridgeControl - Bridge control value for PPB or P2C.
@param Option - Make a choice of EFI_SET_SUPPORTS or EFI_SET_ATTRIBUTES.
**/
EFI_STATUS
PciSetDeviceAttribute (
IN PCI_IO_DEVICE *PciIoDevice,
@ -271,202 +209,122 @@ PciSetDeviceAttribute (
IN UINT16 BridgeControl,
IN UINTN Option
)
/**
Routine Description:
TODO: Add function description
Arguments:
PciIoDevice - TODO: add argument description
Command - TODO: add argument description
BridgeControl - TODO: add argument description
Option - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
Determine if the device can support Fast Back to Back attribute
@param PciIoDevice Pci device instance
@param StatusIndex Status register value
**/
EFI_STATUS
GetFastBackToBackSupport (
IN PCI_IO_DEVICE *PciIoDevice,
IN UINT8 StatusIndex
)
/**
Routine Description:
TODO: Add function description
Arguments:
PciIoDevice - TODO: add argument description
StatusIndex - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
Determine the related attributes of all devices under a Root Bridge
@param PciIoDevice PCI device instance
**/
EFI_STATUS
DetermineDeviceAttribute (
IN PCI_IO_DEVICE *PciIoDevice
)
/**
Routine Description:
TODO: Add function description
Arguments:
PciIoDevice - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
This routine is used to update the bar information for those incompatible PCI device
@param PciIoDevice Pci device instance
@return EFI_UNSUPPORTED failed to update Pci Info
**/
EFI_STATUS
UpdatePciInfo (
IN PCI_IO_DEVICE *PciIoDevice
)
/**
Routine Description:
TODO: Add function description
Arguments:
PciIoDevice - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
This routine will update the alignment with the new alignment
@param Alignment old alignment
@param NewAlignment new alignment
**/
VOID
SetNewAlign (
IN UINT64 *Alignment,
IN UINT64 NewAlignment
)
/**
Routine Description:
TODO: Add function description
Arguments:
Alignment - TODO: add argument description
NewAlignment - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
Parse PCI bar bit.
@param PciIoDevice Pci device instance
@param Offset bar offset
@param BarIndex bar index
@return next bar offset.
**/
UINTN
PciParseBar (
IN PCI_IO_DEVICE *PciIoDevice,
IN UINTN Offset,
IN UINTN BarIndex
)
/**
Routine Description:
TODO: Add function description
Arguments:
PciIoDevice - TODO: add argument description
Offset - TODO: add argument description
BarIndex - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
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
**/
EFI_STATUS
InitializePciDevice (
IN PCI_IO_DEVICE *PciIoDevice
)
/**
Routine Description:
TODO: Add function description
Arguments:
PciIoDevice - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
Init PPB for bridge device
@param PciIoDevice Pci device instance
**/
EFI_STATUS
InitializePpb (
IN PCI_IO_DEVICE *PciIoDevice
)
/**
Routine Description:
TODO: Add function description
Arguments:
PciIoDevice - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
Init private data for Hotplug bridge device
@param PciIoDevice hotplug bridge device
**/
EFI_STATUS
InitializeP2C (
IN PCI_IO_DEVICE *PciIoDevice
)
/**
Routine Description:
TODO: Add function description
Arguments:
PciIoDevice - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
Create and initiliaze general PCI I/O device instance for
PCI device/bridge device/hotplug bridge device.
@param PciRootBridgeIo Pointer to instance of EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL
@param Pci Pci bar block
@param Bus device Bus NO.
@param Device device device NO.
@param Func device func NO.
@return instance of PCI device
**/
PCI_IO_DEVICE *
CreatePciIoDevice (
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,
@ -475,48 +333,34 @@ CreatePciIoDevice (
UINT8 Device,
UINT8 Func
)
/**
Routine Description:
TODO: Add function description
Arguments:
PciRootBridgeIo - TODO: add argument description
Pci - TODO: add argument description
Bus - TODO: add argument description
Device - TODO: add argument description
Func - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
This routine is used to enumerate entire pci bus system
in a given platform
It is only called on the second start on the same Root Bridge.
@param Controller Parent bridge handler
@return status of operation.
**/
EFI_STATUS
PciEnumeratorLight (
IN EFI_HANDLE Controller
)
/**
Routine Description:
TODO: Add function description
Arguments:
Controller - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
Get bus range.
@param Descriptors A pointer to the address space descriptor.
@param MinBus The min bus.
@param MaxBus The max bus.
@param BusRange The bus range.
@retval EFI_SUCCESS Success operation.
@retval EFI_NOT_FOUND can not find the specific bus.
**/
EFI_STATUS
PciGetBusRange (
IN EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR **Descriptors,
@ -524,66 +368,27 @@ PciGetBusRange (
OUT UINT16 *MaxBus,
OUT UINT16 *BusRange
)
/**
Routine Description:
TODO: Add function description
Arguments:
Descriptors - TODO: add argument description
MinBus - TODO: add argument description
MaxBus - TODO: add argument description
BusRange - TODO: add argument description
Returns:
TODO: add return values
**/
;
EFI_STATUS
StartManagingRootBridge (
IN PCI_IO_DEVICE *RootBridgeDev
)
/**
Routine Description:
TODO: Add function description
Arguments:
RootBridgeDev - TODO: add argument description
Returns:
TODO: add return values
**/
;
/**
This routine can be used to check whether a PCI device should be rejected when light enumeration
@param PciIoDevice Pci device instance
@retval TRUE This device should be rejected
@retval FALSE This device shouldn't be rejected
**/
BOOLEAN
IsPciDeviceRejected (
IN PCI_IO_DEVICE *PciIoDevice
)
/**
Routine Description:
TODO: Add function description
Arguments:
PciIoDevice - TODO: add argument description
Returns:
TODO: add return values
**/
;
#endif

View File

@ -1297,7 +1297,7 @@ Returns:
//
// Add feature to support customized secondary bus number
//
if (*SubBusNumber == 0) {
if (*SubBusNumber == 0) {
*SubBusNumber = *PaddedBusRange;
*PaddedBusRange = 0;
}
@ -1594,7 +1594,7 @@ Returns:
//
// Add feature to support customized secondary bus number
//
if (*SubBusNumber == 0) {
if (*SubBusNumber == 0) {
*SubBusNumber = *PaddedBusRange;
*PaddedBusRange = 0;
}
@ -1778,24 +1778,18 @@ Returns:
return EFI_SUCCESS;
}
/**
Process Option Rom on this host bridge
@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
**/
EFI_STATUS
PciHostBridgeP2CProcess (
IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc
)
/**
Routine Description:
Arguments:
Returns:
None
**/
// TODO: PciResAlloc - add argument and description to function comment
// TODO: EFI_NOT_FOUND - add return value to function comment
// TODO: EFI_SUCCESS - add return value to function comment
{
EFI_HANDLE RootBridgeHandle;
PCI_IO_DEVICE *RootBridgeDev;

View File

@ -1,5 +1,6 @@
/**@file
Driver Binding functions for PCI bus module.
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@ -39,32 +40,22 @@ EFI_PCI_PLATFORM_PROTOCOL *gPciPlatformProtocol;
//
// PCI Bus Driver Support Functions
//
/**
Initialize the global variables
publish the driver binding protocol
@param[IN] ImageHandle,
@param[IN] *SystemTable
@retval status of installing driver binding component name protocol.
**/
EFI_STATUS
EFIAPI
PciBusEntryPoint (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
/**
Routine Description:
Initialize the global variables
publish the driver binding protocol
Arguments:
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
Returns:
EFI_SUCCESS
EFI_DEVICE_ERROR
**/
// TODO: ImageHandle - add argument and description to function comment
// TODO: SystemTable - add argument and description to function comment
{
EFI_STATUS Status;
@ -92,6 +83,20 @@ Returns:
return Status;
}
/**
Test to see if this driver supports ControllerHandle. Any ControllerHandle
than contains a gEfiPciRootBridgeIoProtocolGuid protocol can be supported.
@param This Protocol instance pointer.
@param ControllerHandle Handle of device to test
@param RemainingDevicePath Optional parameter use to pick a specific child
device to start.
@retval EFI_SUCCESS This driver supports this device
@retval EFI_ALREADY_STARTED This driver is already running on this device
@retval other This driver does not support this device
**/
EFI_STATUS
EFIAPI
PciBusDriverBindingSupported (
@ -99,27 +104,6 @@ PciBusDriverBindingSupported (
IN EFI_HANDLE Controller,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
)
/**
Routine Description:
Check to see if pci bus driver supports the given controller
Arguments:
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
Returns:
EFI_SUCCESS
**/
// TODO: This - add argument and description to function comment
// TODO: Controller - add argument and description to function comment
// TODO: RemainingDevicePath - add argument and description to function comment
// TODO: EFI_UNSUPPORTED - add return value to function comment
{
EFI_STATUS Status;
EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
@ -186,6 +170,20 @@ Returns:
return EFI_SUCCESS;
}
/**
Start this driver on ControllerHandle and enumerate Pci bus and start
all device under PCI bus.
@param This Protocol instance pointer.
@param ControllerHandle Handle of device to bind driver to
@param RemainingDevicePath Optional parameter use to pick a specific child
device to start.
@retval EFI_SUCCESS This driver is added to ControllerHandle
@retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle
@retval other This driver does not support this device
**/
EFI_STATUS
EFIAPI
PciBusDriverBindingStart (
@ -193,26 +191,6 @@ PciBusDriverBindingStart (
IN EFI_HANDLE Controller,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
)
/**
Routine Description:
Start to management the controller passed in
Arguments:
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
Returns:
**/
// TODO: This - add argument and description to function comment
// TODO: Controller - add argument and description to function comment
// TODO: RemainingDevicePath - add argument and description to function comment
// TODO: EFI_SUCCESS - add return value to function comment
{
EFI_STATUS Status;
@ -254,6 +232,20 @@ Returns:
return EFI_SUCCESS;
}
/**
Stop this driver on ControllerHandle. Support stoping any child handles
created by this driver.
@param This Protocol instance pointer.
@param ControllerHandle Handle of device to stop driver on
@param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of
children is zero stop the entire bus driver.
@param ChildHandleBuffer List of Child Handles to Stop.
@retval EFI_SUCCESS This driver is removed ControllerHandle
@retval other This driver was not removed from this device
**/
EFI_STATUS
EFIAPI
PciBusDriverBindingStop (
@ -262,31 +254,6 @@ PciBusDriverBindingStop (
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
)
/**
Routine Description:
Stop one or more children created at start of pci bus driver
if all the the children get closed, close the protocol
Arguments:
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
Returns:
**/
// TODO: This - add argument and description to function comment
// TODO: Controller - add argument and description to function comment
// TODO: NumberOfChildren - add argument and description to function comment
// TODO: ChildHandleBuffer - add argument and description to function comment
// TODO: EFI_SUCCESS - add return value to function comment
// TODO: EFI_DEVICE_ERROR - add return value to function comment
// TODO: EFI_SUCCESS - add return value to function comment
{
EFI_STATUS Status;
UINTN Index;
@ -340,3 +307,4 @@ Returns:
return EFI_SUCCESS;
}