blob: babdae04820c14ddb27d3ca0ec2227633fdcda80 [file] [log] [blame]
Andrew Jefferyd861a682024-06-03 21:43:09 +09301// 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
Andrew Jeffery0a1be3c2024-08-11 08:34:10 +00007#include "compiler.h"
Andrew Jefferyd861a682024-06-03 21:43:09 +09308#include <libpldm/base.h>
9
10int pack_pldm_header_errno(const struct pldm_header_info *hdr,
11 struct pldm_msg_hdr *msg);
12
13int unpack_pldm_header_errno(const struct pldm_msg_hdr *msg,
14 struct pldm_header_info *hdr);
15
Unive Tieneb8bb172024-11-25 16:57:42 +080016int 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
Andrew Jeffery0a1be3c2024-08-11 08:34:10 +000020LIBPLDM_CC_ALWAYS_INLINE
21int 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
Andrew Jefferyd861a682024-06-03 21:43:09 +093027#endif