xref: /openbmc/libpldm/src/dsp/base.h (revision 0a1be3cb)
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 LIBPLDM_CC_ALWAYS_INLINE
pldm_msg_has_error(const struct pldm_msg * msg,size_t payload_length)17 int pldm_msg_has_error(const struct pldm_msg *msg, size_t payload_length)
18 {
19 	static_assert(PLDM_SUCCESS == 0, "Rework required");
20 	return payload_length < 1 ? 0 : msg->payload[0];
21 }
22 
23 #endif
24