libpldm: Explicit deprecated, stable and testing ABI classes

Experimenting with new APIs is important, but ABI stability of the
library is also important. We wish to have the freedom to add APIs
without being burdened by them being immediately set in stone.

We implement this wish by introducing three classes of ABI:

1. deprecated
2. stable
3. testing

These are enforced by corresponding function attributes:

1. LIBPLDM_ABI_DEPRECATED
2. LIBPLDM_ABI_STABLE
3. LIBPLDM_ABI_TESTING

Symbol visibility in the library is flipped to 'hidden' by default, so
one of these annotations must be used for the symbol to be exposed.

With these classes in place there are now clear points in time at which
we update the ABI dumps captured under the abi/ directory: When an API
is migrated from the 'testing' class to the 'stable' class, or when
removed from the 'deprecated' class.

Which classes of functions are exposed by the build is controlled by the
new 'abi' meson option. The option is of array type which contains the
list of ABI classes the build should consider. It defaults to enabling
all classes to provide test coverage in CI. The classes used should be
constrained to deprecated and stable (and not test) in any dependent
projects.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: I25402e20c7be9c9f264f9ccd7ac36b384823734c
diff --git a/src/bios.c b/src/bios.c
index 70f4d28..d833293 100644
--- a/src/bios.c
+++ b/src/bios.c
@@ -1,9 +1,11 @@
+#include "config.h"
 #include "bios.h"
 #include "base.h"
 #include "utils.h"
 #include <endian.h>
 #include <string.h>
 
+LIBPLDM_ABI_STABLE
 int encode_get_date_time_req(uint8_t instance_id, struct pldm_msg *msg)
 {
 	if (msg == NULL) {
@@ -18,6 +20,7 @@
 	return pack_pldm_header(&header, &(msg->hdr));
 }
 
+LIBPLDM_ABI_STABLE
 int encode_get_date_time_resp(uint8_t instance_id, uint8_t completion_code,
 			      uint8_t seconds, uint8_t minutes, uint8_t hours,
 			      uint8_t day, uint8_t month, uint16_t year,
@@ -53,6 +56,7 @@
 	return PLDM_SUCCESS;
 }
 
+LIBPLDM_ABI_STABLE
 int decode_get_date_time_resp(const struct pldm_msg *msg, size_t payload_length,
 			      uint8_t *completion_code, uint8_t *seconds,
 			      uint8_t *minutes, uint8_t *hours, uint8_t *day,
@@ -86,6 +90,7 @@
 	return PLDM_SUCCESS;
 }
 
+LIBPLDM_ABI_STABLE
 int encode_set_date_time_req(uint8_t instance_id, uint8_t seconds,
 			     uint8_t minutes, uint8_t hours, uint8_t day,
 			     uint8_t month, uint16_t year, struct pldm_msg *msg,
@@ -125,6 +130,7 @@
 	return PLDM_SUCCESS;
 }
 
+LIBPLDM_ABI_STABLE
 int decode_set_date_time_req(const struct pldm_msg *msg, size_t payload_length,
 			     uint8_t *seconds, uint8_t *minutes, uint8_t *hours,
 			     uint8_t *day, uint8_t *month, uint16_t *year)
@@ -154,6 +160,7 @@
 	return PLDM_SUCCESS;
 }
 
+LIBPLDM_ABI_STABLE
 int encode_set_date_time_resp(uint8_t instance_id, uint8_t completion_code,
 			      struct pldm_msg *msg, size_t payload_length)
 {
@@ -182,6 +189,7 @@
 	return PLDM_SUCCESS;
 }
 
+LIBPLDM_ABI_STABLE
 int decode_set_date_time_resp(const struct pldm_msg *msg, size_t payload_length,
 			      uint8_t *completion_code)
 {
@@ -201,6 +209,7 @@
 	return PLDM_SUCCESS;
 }
 
+LIBPLDM_ABI_STABLE
 int encode_get_bios_table_resp(uint8_t instance_id, uint8_t completion_code,
 			       uint32_t next_transfer_handle,
 			       uint8_t transfer_flag, uint8_t *table_data,
@@ -239,6 +248,7 @@
 	return PLDM_SUCCESS;
 }
 
+LIBPLDM_ABI_STABLE
 int encode_get_bios_table_req(uint8_t instance_id, uint32_t transfer_handle,
 			      uint8_t transfer_op_flag, uint8_t table_type,
 			      struct pldm_msg *msg)
@@ -267,6 +277,7 @@
 	return PLDM_SUCCESS;
 }
 
+LIBPLDM_ABI_STABLE
 int decode_get_bios_table_req(const struct pldm_msg *msg, size_t payload_length,
 			      uint32_t *transfer_handle,
 			      uint8_t *transfer_op_flag, uint8_t *table_type)
@@ -289,6 +300,7 @@
 	return PLDM_SUCCESS;
 }
 
+LIBPLDM_ABI_STABLE
 int decode_get_bios_table_resp(const struct pldm_msg *msg,
 			       size_t payload_length, uint8_t *completion_code,
 			       uint32_t *next_transfer_handle,
@@ -323,6 +335,7 @@
 	return PLDM_SUCCESS;
 }
 
+LIBPLDM_ABI_STABLE
 int encode_get_bios_attribute_current_value_by_handle_req(
 	uint8_t instance_id, uint32_t transfer_handle, uint8_t transfer_op_flag,
 	uint16_t attribute_handle, struct pldm_msg *msg)
@@ -352,6 +365,7 @@
 	return PLDM_SUCCESS;
 }
 
+LIBPLDM_ABI_STABLE
 int decode_get_bios_attribute_current_value_by_handle_resp(
 	const struct pldm_msg *msg, size_t payload_length,
 	uint8_t *completion_code, uint32_t *next_transfer_handle,
@@ -386,6 +400,7 @@
 	return PLDM_SUCCESS;
 }
 
+LIBPLDM_ABI_STABLE
 int decode_get_bios_attribute_current_value_by_handle_req(
 	const struct pldm_msg *msg, size_t payload_length,
 	uint32_t *transfer_handle, uint8_t *transfer_op_flag,
@@ -410,6 +425,7 @@
 	return PLDM_SUCCESS;
 }
 
+LIBPLDM_ABI_STABLE
 int encode_get_bios_current_value_by_handle_resp(uint8_t instance_id,
 						 uint8_t completion_code,
 						 uint32_t next_transfer_handle,
@@ -447,6 +463,8 @@
 	}
 	return PLDM_SUCCESS;
 }
+
+LIBPLDM_ABI_STABLE
 int encode_set_bios_attribute_current_value_req(
 	uint8_t instance_id, uint32_t transfer_handle, uint8_t transfer_flag,
 	const uint8_t *attribute_data, size_t attribute_length,
@@ -479,6 +497,7 @@
 	return PLDM_SUCCESS;
 }
 
+LIBPLDM_ABI_STABLE
 int decode_set_bios_attribute_current_value_resp(const struct pldm_msg *msg,
 						 size_t payload_length,
 						 uint8_t *completion_code,
@@ -507,6 +526,7 @@
 	return PLDM_SUCCESS;
 }
 
+LIBPLDM_ABI_STABLE
 int decode_set_bios_attribute_current_value_req(
 	const struct pldm_msg *msg, size_t payload_length,
 	uint32_t *transfer_handle, uint8_t *transfer_flag,
@@ -530,6 +550,7 @@
 	return PLDM_SUCCESS;
 }
 
+LIBPLDM_ABI_STABLE
 int encode_set_bios_attribute_current_value_resp(uint8_t instance_id,
 						 uint8_t completion_code,
 						 uint32_t next_transfer_handle,
@@ -558,6 +579,7 @@
 	return PLDM_SUCCESS;
 }
 
+LIBPLDM_ABI_STABLE
 int encode_set_bios_table_req(uint8_t instance_id, uint32_t transfer_handle,
 			      uint8_t transfer_flag, uint8_t table_type,
 			      const uint8_t *table_data, size_t table_length,
@@ -593,6 +615,7 @@
 	return PLDM_SUCCESS;
 }
 
+LIBPLDM_ABI_STABLE
 int decode_set_bios_table_resp(const struct pldm_msg *msg,
 			       size_t payload_length, uint8_t *completion_code,
 			       uint32_t *next_transfer_handle)
@@ -619,6 +642,7 @@
 	return PLDM_SUCCESS;
 }
 
+LIBPLDM_ABI_STABLE
 int encode_set_bios_table_resp(uint8_t instance_id, uint8_t completion_code,
 			       uint32_t next_transfer_handle,
 			       struct pldm_msg *msg)
@@ -646,6 +670,7 @@
 	return PLDM_SUCCESS;
 }
 
+LIBPLDM_ABI_STABLE
 int decode_set_bios_table_req(const struct pldm_msg *msg, size_t payload_length,
 			      uint32_t *transfer_handle, uint8_t *transfer_flag,
 			      uint8_t *table_type, struct variable_field *table)