summaryrefslogtreecommitdiffstats
path: root/extensions/openpower-pels/pce_identity.cpp
blob: 12b21ae5ce748e5c75d4631e11aa2207e7d2e093 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include "pce_identity.hpp"

namespace openpower
{
namespace pels
{
namespace src
{

PCEIdentity::PCEIdentity(Stream& pel)
{
    pel >> _type >> _size >> _flags >> _mtms;

    // Whatever is left is the enclosure name.
    if (_size < (4 + _mtms.flattenedSize()))
    {
        throw std::runtime_error("PCE identity structure size field too small");
    }

    size_t pceNameSize = _size - (4 + _mtms.flattenedSize());

    _pceName.resize(pceNameSize);
    pel >> _pceName;
}

void PCEIdentity::flatten(Stream& pel)
{
    pel << _type << _size << _flags << _mtms << _pceName;
}

} // namespace src
} // namespace pels
} // namespace openpower
OpenPOWER on IntegriCloud