1 // SPDX-License-Identifier: Apache-2.0 2 // SPDX-FileCopyrightText: Copyright 2019 IBM Corporation 3 4 #include "pce_identity.hpp" 5 6 namespace openpower 7 { 8 namespace pels 9 { 10 namespace src 11 { 12 PCEIdentity(Stream & pel)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 flatten(Stream & pel) const29void PCEIdentity::flatten(Stream& pel) const 30 { 31 pel << _type << _size << _flags << _mtms << _pceName; 32 } 33 34 } // namespace src 35 } // namespace pels 36 } // namespace openpower 37