Пример #1
0
/**
 * Returns true if the source & plug passed are a master FSI unit
 */
bool isMasterFSI(Endpoint & i_source, Plug* i_plug, bool & o_cascadedMaster)
{
    bool master = false;
    string partId = mrwGetPartId(i_plug->card(), i_source.id());
    XMLElement part = mrwGetPart(partId);

    o_cascadedMaster = false;

    if (!part.empty())
    {
        XMLElement unit = part.findPath("units/fsi-master-units").find("fsi-master-unit", "id", i_source.unit());

        if (!unit.empty())
        {
            master = true;
        }
        else
        {
            //now try cascaded master units
            XMLElement unit = part.findPath("units/fsi-cascade-master-units").find("fsi-cascade-master-unit", "id", i_source.unit());

            if (!unit.empty())
            {
                master = true;
                o_cascadedMaster = true;
            }
        }
    }

    return master;
}
Пример #2
0
/**
 * Returns the MBA port.
 *
 * @param i_ddrEndpoint - the MBA endpoint of a DDRBus.
 * @param i_plug - the plug the bus is on
 */
string mrwMemGetMbaPort(Endpoint & i_ddrEndpoint, Plug* i_plug)
{
    string unitId    = i_ddrEndpoint.unit();
    string chip      = i_ddrEndpoint.id();
    string partId    = mrwGetPartId(i_plug->card(), chip);
    string pos       = mrwGetPartPos(i_plug->card(), chip);

    XMLElement unit  = mrwGetUnit(partId, "ddr-master-unit", unitId);

    return unit.getChildValue("port");
}
Пример #3
0
/**
 * Returns the MBA instance path.
 *
 * @param i_ddrEndpoint - the MBA endpoint of a DDRBus.
 * @param i_plug - the plug the bus is on
 */
string mrwMemGetMbaInstancePath(Endpoint & i_ddrEndpoint, Plug* i_plug)
{
    string unitId    = i_ddrEndpoint.unit();
    string chip      = i_ddrEndpoint.id();
    string partId    = mrwGetPartId(i_plug->card(), chip);
    string pos       = mrwGetPartPos(i_plug->card(), chip);

    XMLElement unit  = mrwGetUnit(partId, "ddr-master-unit", unitId);

    string chipPath  = i_plug->path() + "/" + partId + "-" + pos;
    string mbaPath   = chipPath + "/" + unit.getChildValue("chiplet-id");

    return mbaPath;
}
Пример #4
0
/**
 * Returns the MCS instance path
 *
 * @param i_dmiSource - the MCS source of a DMIBus
 * @param i_plug - the plug the bus is on
 */
string mrwMemGetMcsInstancePath(Endpoint & i_dmiSource, Plug* i_plug)
{
    string unitId    = i_dmiSource.unit();
    string chip      = i_dmiSource.id();
    string partId    = mrwGetPartId(i_plug->card(), chip);
    string pos       = mrwGetPartPos(i_plug->card(), chip);

    XMLElement dmiUnit = mrwGetUnit(partId, "dmi-master-unit", unitId);

    string chipPath  = i_plug->path() + "/" + partId + "-" + pos;
    string mcsPath   = chipPath + "/" + dmiUnit.getChildValue("chiplet-id");

    return mcsPath;
}
Пример #5
0
/**
 * Returns true if the source & plug passed are a slave FSI unit
 */
bool isSlaveFSI(Endpoint & i_source, Plug* i_plug)
{
    bool slave = false;
    string partId = mrwGetPartId(i_plug->card(), i_source.id());
    XMLElement part = mrwGetPart(partId);

    if (!part.empty())
    {
        XMLElement unit = part.findPath("units/fsi-slave-units").find("fsi-slave-unit", "id", i_source.unit());

        if (!unit.empty())
            slave = true;
    }

    return slave;
}
Пример #6
0
int saveIds(Endpoint& e)
{
    saveIds(*(e.parent()));
    string ieeeAddrStr = IntToHexStr(e.parent()->ieee_id());
    string epStr = IntToHexStr(e.id());

    JSON zar{ZDO::ARCHIVE::_ZDO_ARCHIVE_LOCATION};
    if (!zar.good()) {
        zar = JSON{JSONType::JSON_OBJECT};
    }

    JSON& endpointList = zar[ieeeAddrStr]["endpointList"];
    JSON& newDev = endpointList[epStr];
    newDev["Id"] = epStr;
    zar.toFile(ZDO::ARCHIVE::_ZDO_ARCHIVE_LOCATION);

    return 0;
}
Пример #7
0
/**
 * Walks the DMIBus passed in out past the Centaurs and over the DDR busses to the DIMMs
 */
void walkMemoryBus(DMIBus* i_bus, endpointType i_type)
{
    DMIBus* dmiBus = i_bus;
    bool unitEmpty = false;
    endpointType type;


    //First walk the DMI bus from the CPU unit out to the membuf unit,
    //then walk the DDR bus from the membuf unit to the DIMM unit

    if (i_type == SOURCE)
    {
        unitEmpty = dmiBus->endpoint().unit().empty();
        type = ENDPOINT;
    }
    else
    {
        unitEmpty = dmiBus->source().unit().empty();
        type = SOURCE;
    }

    if (unitEmpty)
    {

        do
        {
            dmiBus = mrwGetNextBus(dmiBus, type);

            if (!dmiBus)
                break;

            //Our ending unit could be on the source or endpoint of a bus
            if (!dmiBus->source().unit().empty() || !dmiBus->endpoint().unit().empty())
                unitEmpty = false;

        }  while (unitEmpty);
    }

    if (!dmiBus)
    {
        Endpoint* e = (i_type == SOURCE) ? &i_bus->source() : &i_bus->endpoint();

        ostringstream msg;
        msg << "No endpoint found for a DMI bus path that starts at " <<
                i_bus->plug()->path() << "/" << e->id() << "/" << e->unit();
        mrwInfo(msg.str());

        return;
    }


    //////////////////////////////////////////////////////////////////

    //Now that we we have the ending unit of the DMI bus,
    //we look for DDR busses going out from that same part and
    //walk them out to the DIMMs

    //Create the system bus source - the endpoint that has the DMI unit on the CPU
    MemMcs* mcs;

    //The MCS needs to know the endpoint/unit of the cent on the far end
    Endpoint centEndpoint = (type == SOURCE) ? dmiBus->source() : dmiBus->endpoint();

    if (i_type == SOURCE)
        mcs = new MemMcs(i_bus->plug(), i_bus->source(), centEndpoint);
    else
        mcs = new MemMcs(i_bus->plug(), i_bus->endpoint(), centEndpoint);

    if (mrwLogger::getDebugMode())
    {
        string m = "Found DMI endpoint " + mrwUnitPath(dmiBus->plug(), mcs->centEndpoint());
        mrwLogger::debug(m);
    }


    walkDDRBusses(centEndpoint.id(), dmiBus->plug(), mcs);

}
Пример #8
0
/**
 * Walks an FSI bus from the source unit in i_sourceBus out to the endpoint unit
 * in possibly another FSIBus, and creates a FSISingleHopBus object for the path.
 */
void walkFSIBus(FSIBus* i_sourceBus, endpointType i_type)
{
    FSIMaster* master = NULL;
    FSIBus* bus = i_sourceBus;
    Endpoint* source = (i_type == SOURCE) ? &i_sourceBus->source() : &i_sourceBus->endpoint();
    Endpoint* endpoint = (i_type == SOURCE) ? &i_sourceBus->endpoint() : &i_sourceBus->source();
    endpointType type = (i_type == SOURCE) ? ENDPOINT : SOURCE;
    bool isSlave = false;
    bool cascaded = false;
    vector<FSIConnector*> connectors;
    Cable* cable = NULL;

    //Walk the FSIs from a master or cascaded master out to a slave.
    //Cascading will be done later.

    if (isMasterFSI(*source, bus->plug(), cascaded))
        master = new FSIMaster(*source, bus->plug(), cascaded);

    //Walk the bus if necessary to find the slave
    if (!isSlaveFSI(*endpoint, bus->plug()))
    {
        //save the connector in the path
        connectors.push_back(new FSIConnector(endpoint->id(), bus->plug()));

        do
        {
            cable = NULL;
            bus = mrwGetNextBus<FSIBus>(bus, type, &cable);

            if (!bus)
                break;

            //If the source is a slave, flag it, otherwise save the connector in the path
            if (isSlaveFSI(bus->source(), bus->plug()))
                isSlave = true;
            else
            {
                if (cable)
                    connectors.push_back(new FSICable(cable));
                else
                    connectors.push_back(new FSIConnector(bus->source().id(), bus->plug()));
            }


            //If the endpoint is a slave, flag it, otherwise save the connector in the path
            if (isSlaveFSI(bus->endpoint(), bus->plug()))
                isSlave = true;
            else
            {
                if (cable)
                    connectors.push_back(new FSICable(cable));
                else
                    connectors.push_back(new FSIConnector(bus->endpoint().id(), bus->plug()));
            }

        } while (!isSlave);
    }


    if (!bus)
    {
#if 0 //let's not trace this, we see it everywhere
        ostringstream msg;
        msg << "No endpoint found for FSI bus path that starts at " <<
                i_sourceBus->plug()->path() << "/" << i_sourceBus->source().id() << "/" <<i_sourceBus->source().unit();
        mrwInfo(msg.str());
#endif

        return;
    }

    //Create the full single hop bus

    FSISlave* slave;

    if (type == SOURCE)
        slave = new FSISlave(bus->source(), bus->plug());
    else
        slave = new FSISlave(bus->endpoint(), bus->plug());


	if (mrwLogger::getDebugMode()) {
		string m = "Creating FSI slave: " + mrwUnitPath(slave->plug(), slave->source());
		mrwLogger::debug(m);
	}

	FSISingleHopBus* fsi = new FSISingleHopBus(master, slave, connectors);

	g_singleHopBusses.push_back(fsi);

}