Skip to content

Commit fe547f3

Browse files
Alexander Antonovrdementi
authored andcommitted
Add skeleton for BirchStreamPlatform class
1 parent fbcea48 commit fe547f3

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed

src/pcm-iio.cpp

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1364,6 +1364,75 @@ void IPlatformMapping::probeDeviceRange(std::vector<struct pci> &pci_devs, int d
13641364
}
13651365
}
13661366

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+
13671436
std::unique_ptr<IPlatformMapping> IPlatformMapping::getPlatformMapping(int cpu_model, uint32_t sockets_count)
13681437
{
13691438
switch (cpu_model) {
@@ -1376,6 +1445,8 @@ std::unique_ptr<IPlatformMapping> IPlatformMapping::getPlatformMapping(int cpu_m
13761445
case PCM::SPR:
13771446
case PCM::EMR:
13781447
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)};
13791450
default:
13801451
return nullptr;
13811452
}

0 commit comments

Comments
 (0)