@@ -67,6 +67,8 @@ CruBar::CruBar(const Parameters& parameters, std::unique_ptr<RocPciDevice> rocPc
6767 } else {
6868 mAllowRejection = 0x0 ;
6969 }
70+
71+ mEndpoint = mRocPciDevice ->getSerialId ().getEndpoint ();
7072}
7173
7274CruBar::CruBar (std::shared_ptr<Pda::PdaBar> bar)
@@ -141,7 +143,6 @@ uint32_t CruBar::getSuperpageSize(uint32_t link)
141143 uint32_t superpageSizeIndex = Utilities::getBits (superpageSizeFifo, 24 , 31 ); // [24-31] -> superpage index (0-255)
142144
143145 while (superpageSizeIndex != mSuperpageSizeIndexCounter [link]) { // In case the PCIe bus wasn't fast enough
144- // std::cout << "[SP INDEX] link " << link << " : " << superpageSizeIndex << " instead of " << mSuperpageSizeIndexCounter[link] << std::endl;
145146 superpageSizeFifo = readRegister (Cru::Registers::LINK_SUPERPAGE_SIZE.get (link).index );
146147 superpageSize = Utilities::getBits (superpageSizeFifo, 0 , 23 );
147148 superpageSizeIndex = Utilities::getBits (superpageSizeFifo, 24 , 31 );
@@ -606,7 +607,10 @@ std::map<int, Link> CruBar::initializeLinkMap()
606607 uint32_t address = Cru::getWrapperBaseAddress (wrapper) + Cru::Registers::GBT_WRAPPER_CONF0.address ;
607608 uint32_t wrapperConfig = readRegister (address / 4 );
608609
609- for (int bank = 0 ; bank < 6 ; bank++) {
610+ for (int bank = mEndpoint * 2 ; bank < (mEndpoint * 2 + 2 ); bank++) {
611+ // for (int bank = 0; bank < 4; bank++) { //for 0-23 range
612+ // endpoint 0 -> banks {0,1}
613+ // endpoint 1 -> banks {2,3}
610614 int dwrapper = (bank < 2 ) ? 0 : 1 ;
611615 int lpbLSB = (4 * bank) + 4 ;
612616 int lpbMSB = lpbLSB + 4 - 1 ;
@@ -638,7 +642,8 @@ std::map<int, Link> CruBar::initializeLinkMap()
638642 std::map<int , Link> newLinkMap;
639643 for (std::size_t i = 0 ; i < links.size (); i++) {
640644 Link link = links.at (i);
641- int newPos = (i - link.bank * 6 ) * 2 + 12 * (int )(link.bank / 2 ) + (link.bank % 2 );
645+ int newPos = (i - (link.bank - mEndpoint * 2 ) * 6 ) * 2 + (link.bank % 2 );
646+ // int newPos = (i - link.bank * 6) * 2 + + 12 * (int)(link.bank/2) + (link.bank % 2); //for 0-23 range
642647 link.dwrapperId = newPos % 12 ;
643648 newLinkMap.insert ({ newPos, link });
644649 }
0 commit comments