1 // SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 2 #ifndef LIBPLDM_SRC_DSP_BASE_H 3 #define LIBPLDM_SRC_DSP_BASE_H 4 5 /* Internal functions */ 6 7 #include "compiler.h" 8 #include <libpldm/base.h> 9 10 int pack_pldm_header_errno(const struct pldm_header_info *hdr, 11 struct pldm_msg_hdr *msg); 12 13 int unpack_pldm_header_errno(const struct pldm_msg_hdr *msg, 14 struct pldm_header_info *hdr); 15 16 int encode_pldm_header_only_errno(uint8_t msg_type, uint8_t instance_id, 17 uint8_t pldm_type, uint8_t command, 18 struct pldm_msg *msg); 19 20 LIBPLDM_CC_ALWAYS_INLINE 21 int pldm_msg_has_error(const struct pldm_msg *msg, size_t payload_length) 22 { 23 static_assert(PLDM_SUCCESS == 0, "Rework required"); 24 return payload_length < 1 ? 0 : msg->payload[0]; 25 } 26 27 #endif 28