@@ -1364,6 +1364,75 @@ void IPlatformMapping::probeDeviceRange(std::vector<struct pci> &pci_devs, int d
1364
1364
}
1365
1365
}
1366
1366
1367
+ class BirchStreamPlatform : public IPlatformMapping {
1368
+ private:
1369
+ bool isPcieStack (int unit);
1370
+ bool isRootHcStack (int unit);
1371
+ bool isPartHcStack (int unit);
1372
+ bool isUboxStack (int unit);
1373
+
1374
+ bool stackProbe (int unit, const struct bdf &address, struct iio_stacks_on_socket &iio_on_socket);
1375
+ bool getRootBuses (std::map<int , std::map<int , struct bdf >> &root_buses);
1376
+ public:
1377
+ BirchStreamPlatform (int cpu_model, uint32_t sockets_count) : IPlatformMapping(cpu_model, sockets_count) {}
1378
+ ~BirchStreamPlatform () = default ;
1379
+ bool pciTreeDiscover (std::vector<struct iio_stacks_on_socket >& iios) override ;
1380
+ };
1381
+
1382
+ bool BirchStreamPlatform::isPcieStack (int unit)
1383
+ {
1384
+ return false ;
1385
+ }
1386
+
1387
+ bool BirchStreamPlatform::isRootHcStack (int unit)
1388
+ {
1389
+ return false ;
1390
+ }
1391
+
1392
+ bool BirchStreamPlatform::isPartHcStack (int unit)
1393
+ {
1394
+ return false ;
1395
+ }
1396
+
1397
+ bool BirchStreamPlatform::isUboxStack (int unit)
1398
+ {
1399
+ return false ;
1400
+ }
1401
+
1402
+ bool BirchStreamPlatform::stackProbe (int unit, const struct bdf &address, struct iio_stacks_on_socket &iio_on_socket)
1403
+ {
1404
+ return true ;
1405
+ }
1406
+
1407
+ bool BirchStreamPlatform::getRootBuses (std::map<int , std::map<int , struct bdf >> &root_buses)
1408
+ {
1409
+ return true ;
1410
+ }
1411
+
1412
+ bool BirchStreamPlatform::pciTreeDiscover (std::vector<struct iio_stacks_on_socket >& iios)
1413
+ {
1414
+ std::map<int , std::map<int , struct bdf >> root_buses;
1415
+ if (!getRootBuses (root_buses))
1416
+ {
1417
+ return false ;
1418
+ }
1419
+
1420
+ for (auto iter = root_buses.cbegin (); iter != root_buses.cend (); ++iter) {
1421
+ auto rbs_on_socket = iter->second ;
1422
+ struct iio_stacks_on_socket iio_on_socket;
1423
+ iio_on_socket.socket_id = iter->first ;
1424
+ for (auto rb = rbs_on_socket.cbegin (); rb != rbs_on_socket.cend (); ++rb) {
1425
+ if (!stackProbe (rb->first , rb->second , iio_on_socket)) {
1426
+ return false ;
1427
+ }
1428
+ }
1429
+ std::sort (iio_on_socket.stacks .begin (), iio_on_socket.stacks .end ());
1430
+ iios.push_back (iio_on_socket);
1431
+ }
1432
+
1433
+ return true ;
1434
+ }
1435
+
1367
1436
std::unique_ptr<IPlatformMapping> IPlatformMapping::getPlatformMapping (int cpu_model, uint32_t sockets_count)
1368
1437
{
1369
1438
switch (cpu_model) {
@@ -1376,6 +1445,8 @@ std::unique_ptr<IPlatformMapping> IPlatformMapping::getPlatformMapping(int cpu_m
1376
1445
case PCM::SPR:
1377
1446
case PCM::EMR:
1378
1447
return std::unique_ptr<IPlatformMapping>{new EagleStreamPlatformMapping (cpu_model, sockets_count)};
1448
+ case PCM::SRF:
1449
+ return std::unique_ptr<IPlatformMapping>{new BirchStreamPlatform (cpu_model, sockets_count)};
1379
1450
default :
1380
1451
return nullptr ;
1381
1452
}
0 commit comments