@@ -67,7 +67,7 @@ PciAddress addressFromDevice(PciDevice* pciDevice)
6767
6868CardDescriptor defaultDescriptor ()
6969{
70- return { CardType::Unknown, SerialId (-1 , 0 ), { " unknown" , " unknown" }, PciAddress (0 , 0 , 0 ), -1 };
70+ return { CardType::Unknown, SerialId (-1 , 0 ), { " unknown" , " unknown" }, PciAddress (0 , 0 , 0 ), -1 , - 1 };
7171}
7272} // Anonymous namespace
7373
@@ -91,6 +91,7 @@ RocPciDevice::~RocPciDevice()
9191
9292void RocPciDevice::initWithSerialId (const SerialId& serialId)
9393{
94+ int sequenceCounter = 0 ;
9495 try {
9596 for (const auto & typedPciDevice : Pda::PdaDevice::getPciDevices ()) {
9697 PciDevice* pciDevice = typedPciDevice.pciDevice ;
@@ -112,9 +113,10 @@ void RocPciDevice::initWithSerialId(const SerialId& serialId)
112113
113114 if (serial == serialId.getSerial () && endpoint == serialId.getEndpoint ()) {
114115 mPciDevice = pciDevice;
115- mDescriptor = CardDescriptor{ type.cardType , serialId, type.pciId , addressFromDevice (pciDevice), PciDevice_getNumaNode (pciDevice) };
116+ mDescriptor = CardDescriptor{ type.cardType , serialId, type.pciId , addressFromDevice (pciDevice), PciDevice_getNumaNode (pciDevice), sequenceCounter };
116117 return ;
117118 }
119+ sequenceCounter++;
118120 }
119121 BOOST_THROW_EXCEPTION (Exception () << ErrorInfo::Message (" Could not find card" ));
120122 } catch (boost::exception& e) {
@@ -126,6 +128,7 @@ void RocPciDevice::initWithSerialId(const SerialId& serialId)
126128
127129void RocPciDevice::initWithAddress (const PciAddress& address)
128130{
131+ int sequenceCounter = 0 ;
129132 try {
130133 for (const auto & typedPciDevice : Pda::PdaDevice::getPciDevices ()) {
131134 PciDevice* pciDevice = typedPciDevice.pciDevice ;
@@ -146,9 +149,10 @@ void RocPciDevice::initWithAddress(const PciAddress& address)
146149 endpoint = type.getEndpoint (mPdaBar0 );
147150
148151 mPciDevice = pciDevice;
149- mDescriptor = CardDescriptor{ type.cardType , SerialId{ serial, endpoint }, type.pciId , address, PciDevice_getNumaNode (pciDevice) };
152+ mDescriptor = CardDescriptor{ type.cardType , SerialId{ serial, endpoint }, type.pciId , address, PciDevice_getNumaNode (pciDevice), sequenceCounter };
150153 return ;
151154 }
155+ sequenceCounter++;
152156 }
153157 BOOST_THROW_EXCEPTION (Exception () << ErrorInfo::Message (" Could not find card" ));
154158 } catch (boost::exception& e) {
@@ -181,7 +185,7 @@ void RocPciDevice::initWithSequenceNumber(const PciSequenceNumber& sequenceNumbe
181185 endpoint = type.getEndpoint (mPdaBar0 );
182186
183187 mPciDevice = pciDevice;
184- mDescriptor = CardDescriptor{ type.cardType , SerialId{ serial, endpoint }, type.pciId , addressFromDevice (pciDevice), PciDevice_getNumaNode (pciDevice) };
188+ mDescriptor = CardDescriptor{ type.cardType , SerialId{ serial, endpoint }, type.pciId , addressFromDevice (pciDevice), PciDevice_getNumaNode (pciDevice), sequenceCounter };
185189 return ;
186190 }
187191 sequenceCounter++;
@@ -196,6 +200,7 @@ void RocPciDevice::initWithSequenceNumber(const PciSequenceNumber& sequenceNumbe
196200
197201std::vector<CardDescriptor> RocPciDevice::findSystemDevices ()
198202{
203+ int sequenceCounter = 0 ;
199204 std::vector<CardDescriptor> cards;
200205 for (const auto & typedPciDevice : Pda::PdaDevice::getPciDevices ()) {
201206 PciDevice* pciDevice = typedPciDevice.pciDevice ;
@@ -218,10 +223,11 @@ std::vector<CardDescriptor> RocPciDevice::findSystemDevices()
218223 endpoint = type.getEndpoint (pdaBar0);
219224
220225 try {
221- cards.push_back (CardDescriptor{ type.cardType , SerialId{ serial, endpoint }, type.pciId , addressFromDevice (pciDevice), PciDevice_getNumaNode (pciDevice) });
226+ cards.push_back (CardDescriptor{ type.cardType , SerialId{ serial, endpoint }, type.pciId , addressFromDevice (pciDevice), PciDevice_getNumaNode (pciDevice), sequenceCounter });
222227 } catch (boost::exception& e) {
223228 std::cout << boost::diagnostic_information (e);
224229 }
230+ sequenceCounter++;
225231 }
226232 return cards;
227233}
0 commit comments