blob: 8629ecea199345cd82edb124d64d10e18212a69c [file] [log] [blame]
Alexander Hansen40fb5492025-10-28 17:56:12 +01001// SPDX-License-Identifier: Apache-2.0
2// SPDX-FileCopyrightText: Copyright 2019 IBM Corporation
3
Matt Spinler5b3a11d2019-10-08 14:13:31 -05004#include "pce_identity.hpp"
5
6namespace openpower
7{
8namespace pels
9{
10namespace src
11{
12
13PCEIdentity::PCEIdentity(Stream& pel)
14{
15 pel >> _type >> _size >> _flags >> _mtms;
16
17 // Whatever is left is the enclosure name.
18 if (_size < (4 + _mtms.flattenedSize()))
19 {
20 throw std::runtime_error("PCE identity structure size field too small");
21 }
22
23 size_t pceNameSize = _size - (4 + _mtms.flattenedSize());
24
25 _pceName.resize(pceNameSize);
26 pel >> _pceName;
27}
28
Matt Spinler724d0d82019-11-06 10:05:36 -060029void PCEIdentity::flatten(Stream& pel) const
Matt Spinler5b3a11d2019-10-08 14:13:31 -050030{
31 pel << _type << _size << _flags << _mtms << _pceName;
32}
33
34} // namespace src
35} // namespace pels
36} // namespace openpower