Nios® II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
Announcements
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.
12436 Discussions

Reading PCIe Rootport Configuration Space

Altera_Forum
Honored Contributor II
856 Views

Hi! 

 

I try to read configuration space of the HIP rootport from NiosII. I looked through linux sources and got some functions for handling the HIP by writing and reading the Root Port TLP Data Registers through CRA interface. 

 

The system is in L0 state and data link is started. 

 

 

pcie-altera.c 

 

static int tlp_cfg_dword_read(struct altera_pcie *pcie, u8 bus, u32 devfn, 

int where, u8 byte_en, u32 *value) 

u32 headers[TLP_HDR_SIZE]; 

 

 

if (bus == pcie->root_bus_nr) 

headers[0] = TLP_CFG_DW0(TLP_FMTTYPE_CFGRD0); 

else 

headers[0] = TLP_CFG_DW0(TLP_FMTTYPE_CFGRD1); 

 

 

headers[1] = TLP_CFG_DW1(TLP_REQ_ID(pcie->root_bus_nr, RP_DEVFN), 

TLP_READ_TAG, byte_en); 

headers[2] = TLP_CFG_DW2(bus, devfn, where); 

 

 

tlp_write_packet(pcie, headers, 0, false); 

 

 

return tlp_read_packet(pcie, value); 

 

 

 

I send config read request type 0 for bus 0, dev 0, func 0 (what RootPort is). 

 

TLP header is: 

 

[0] 0x04000001 

[1] 0x00001D0F 

[2] 0x00000000 

 

The function returns PCIBIOS_DEVICE_NOT_FOUND. 

 

Is my TLP correct? 

 

Thanks in advance!!! 

 

Ilya.
0 Kudos
0 Replies
Reply