AR# 19612


EDK, PCI device driver - PCI device driver Initialize() assumes device ID is zero


General Description:

In the PCI device driver, the Initialize() function configures the PCI BARs of the host bridge. When doing so, it assumes the device/function of the PCI bridge (e.g., OPB PCI bridge) is equal to zero. The device ID can be configured by the user using VHDL generics to a value other than zero. The device driver configuration would then result in a master abort write, and the application would need to take care of configuring the PCI BARs instead of letting the device driver do this.


There are several solutions to this issue:

1. The device ID of the host bridge could be passed into the "_g.c" driver configuration file, and the driver could use that to determine the correct device ID of the host bridge. The PCI BAR configuration in the Initialize() function could be removed altogether, since the application still needs to configure the host bridge with other items such as memory/master enables and latency timer. This latter solution is recommended.

2. The address bit generic (C_BRIDGE_IDSEL_ADDR_BIT) was passed to the configuration data of the driver to solve this problem. The driver calculates the device number from the address bit (e.g., bit 16 is device number 0, bit 17 is device number 1, etc., ...) and uses the correct device number to configure the PCI bar registers in its _Initialize() function.

3. The other solution of removing the PCI bar register init code from the driver altogether was considered. Since there are many changes upcoming to the PCI devices, including new and renamed generics as well as possibly new registers, it was thought best to leave this code in so that current PCI driver users are not affected --and evaluate the removal of this code in near-future versions of this driver.

This problem is fixed in the latest 6.2 EDK Service Pack, available at:
The first service pack containing the fix is EDK 6.2 Service Pack 2.

AR# 19612
Date 12/15/2012
Status Active
Type General Article
People Also Viewed