01-05-2011 08:57 AM
I am facing a problem that involves too many things and I am not so sure where to put my attention.
Hope somebody of you could spread some light.
We built a custom board based on a spartan3A and a PCI bus.
If I program the FPGA and restart the PC the board is correctly seen and I can map the memory and so on.
But if I reprogram the bitstream on the fly and try to remap the memory I only read 0xff values.
I think I may need some sort of hot-pluggability in the FPGA PCI core implementation or the Linux system.
Are the PCI capabilities related (those output by lspci -vv)?
I am not using any particular driver in Linux, but simply remapping the physical address via mmap function.
In attachment I have uploaded the Linux application I am using to map memory.
Linux O.S. is Ubuntu 9.10 (kernel 2.6.32).
HW configuration on PCI core is as follows:
PARAMETER INSTANCE = PCI32_BRIDGE
PARAMETER HW_VER = 1.03.a
PARAMETER C_PCIBAR_LEN_0 = 22
PARAMETER C_PCIBAR2IPIFBAR_0 = 0x8FC00000
PARAMETER C_DEVICE_ID = 0x0300
PARAMETER C_VENDOR_ID = 0x10EE
PARAMETER C_CLASS_CODE = 0x060000
PARAMETER C_REV_ID = 0x1A
PARAMETER C_SUBSYSTEM_ID = 0xBEEF
PARAMETER C_SUBSYSTEM_VENDOR_ID = 0xB0DE
PARAMETER C_IPIFBAR_NUM = 1
PARAMETER C_PCIBAR2IPIFBAR_1 = 0x83400000
PARAMETER C_PCIBAR_LEN_2 = 24
PARAMETER C_PCIBAR2IPIFBAR_2 = 0x89000000
PARAMETER C_MAX_LAT = 0x54
PARAMETER C_MIN_GNT = 0x32
PARAMETER C_PCIBAR_LEN_1 = 18
PARAMETER C_INCLUDE_PCI_CONFIG = 0
PARAMETER C_NUM_IDSEL = 1
PARAMETER C_BASEADDR = 0x86c08000
PARAMETER C_HIGHADDR = 0x86c081ff
PARAMETER C_IPIFBAR_0 = 0x90000000
PARAMETER C_IPIF_HIGHADDR_0 = 0x9fffffff
BUS_INTERFACE SPLB = mb_plb
BUS_INTERFACE MPLB = mb_plb
PORT PAR = fpga_0_PCI32_BRIDGE_PAR
PORT PERR_N = fpga_0_PCI32_BRIDGE_PERR_N
PORT SERR_N = fpga_0_PCI32_BRIDGE_SERR_N
PORT IRDY_N = fpga_0_PCI32_BRIDGE_IRDY_N
PORT FRAME_N = fpga_0_PCI32_BRIDGE_FRAME_N
PORT DEVSEL_N = fpga_0_PCI32_BRIDGE_DEVSEL_N
PORT STOP_N = fpga_0_PCI32_BRIDGE_STOP_N
PORT TRDY_N = fpga_0_PCI32_BRIDGE_TRDY_N
PORT INTR_A = fpga_0_PCI32_BRIDGE_INTR_A
PORT GNT_N = fpga_0_PCI32_BRIDGE_GNT_N
PORT REQ_N = fpga_0_PCI32_BRIDGE_REQ_N
PORT IDSEL = fpga_0_PCI32_BRIDGE_IDSEL
PORT AD = fpga_0_PCI32_BRIDGE_AD
PORT CBE = fpga_0_PCI32_BRIDGE_CBE
PORT PCLK = fpga_0_PCI32_BRIDGE_CLK
PORT RST_N = fpga_0_PCI32_BRIDGE_RST_N
PORT Bus2PCI_INTR = counter_FILO_PPS_F
Many thanks for any help you could provide.
01-06-2011 06:24 AM
PCI registers are set by OS (Linux) at boot time. When you reconfigure the FPGA these registers are erased.
So you need to force OS to reload these register.
I don't know about hot plug capacities of Linux. However you can try to force Linux to rescan its PCI buses.
Log as root and type :
echo "1" > /sys/bus/pci/rescan
For me it works on the ML605 board.
PS : /sys/bus/pci/rescan appears in the lastest version of the kernel, I don't know if your kernel already support it