pdr: Stabilise pldm_pdr_add_check()

pldm_pdr_add_check() is a replacement for pldm_pdr_add(). The latter
used assert() to sanitize its arguments while the former instead returns
a value indicating success or failure.

Use of pldm_pdr_add_check() is demonstrated in the following patch:

https://gerrit.openbmc.org/c/openbmc/pldm/+/64630

Additionally, deprecate pldm_pdr_add() now that there is a stable
replacement.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: I3963c6f8bc869df5772e10e66e09e34b91776710
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d054969..5a54fa6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -120,6 +120,11 @@
     Users of pldm_entity_association_pdr_add_from_node() should migrate to
     pldm_entity_association_pdr_add_from_node_check()
 
+11. pdr: Stabilise pldm_pdr_add_check()
+
+    pldm_pdr_add() is deprecated by this change. Users of pldm_pdr_add() should
+    migrate to pldm_pdr_add_check()
+
 ### Removed
 
 1. bios_table: Remove deprecated APIs sanitized by assert():
diff --git a/abi/aarch64/gcc.dump b/abi/aarch64/gcc.dump
index dfd6c3a..b931b27 100644
--- a/abi/aarch64/gcc.dump
+++ b/abi/aarch64/gcc.dump
@@ -7102,6 +7102,37 @@
                                          'Return' => '81757',
                                          'ShortName' => 'pldm_pdr_init'
                                        },
+                            '92350' => {
+                                         'Header' => 'pdr.h',
+                                         'Param' => {
+                                                      '0' => {
+                                                               'name' => 'repo',
+                                                               'type' => '81757'
+                                                             },
+                                                      '1' => {
+                                                               'name' => 'data',
+                                                               'type' => '6087'
+                                                             },
+                                                      '2' => {
+                                                               'name' => 'size',
+                                                               'type' => '180'
+                                                             },
+                                                      '3' => {
+                                                               'name' => 'is_remote',
+                                                               'type' => '6265'
+                                                             },
+                                                      '4' => {
+                                                               'name' => 'terminus_handle',
+                                                               'type' => '4895'
+                                                             },
+                                                      '5' => {
+                                                               'name' => 'record_handle',
+                                                               'type' => '2039'
+                                                             }
+                                                    },
+                                         'Return' => '74',
+                                         'ShortName' => 'pldm_pdr_add_check'
+                                       },
                             '93213' => {
                                          'Header' => 'pdr.h',
                                          'Param' => {
@@ -7746,6 +7777,7 @@
                                                  'pldm_is_empty_entity_assoc_tree' => 1,
                                                  'pldm_open' => 1,
                                                  'pldm_pdr_add' => 1,
+                                                 'pldm_pdr_add_check' => 1,
                                                  'pldm_pdr_add_fru_record_set' => 1,
                                                  'pldm_pdr_destroy' => 1,
                                                  'pldm_pdr_find_record' => 1,
diff --git a/abi/x86_64/gcc.dump b/abi/x86_64/gcc.dump
index 4d70133..fc68fa4 100644
--- a/abi/x86_64/gcc.dump
+++ b/abi/x86_64/gcc.dump
@@ -7679,6 +7679,37 @@
                                          'Return' => '82972',
                                          'ShortName' => 'pldm_pdr_init'
                                        },
+                            '93654' => {
+                                         'Header' => 'pdr.h',
+                                         'Param' => {
+                                                      '0' => {
+                                                               'name' => 'repo',
+                                                               'type' => '82972'
+                                                             },
+                                                      '1' => {
+                                                               'name' => 'data',
+                                                               'type' => '6245'
+                                                             },
+                                                      '2' => {
+                                                               'name' => 'size',
+                                                               'type' => '180'
+                                                             },
+                                                      '3' => {
+                                                               'name' => 'is_remote',
+                                                               'type' => '6423'
+                                                             },
+                                                      '4' => {
+                                                               'name' => 'terminus_handle',
+                                                               'type' => '5053'
+                                                             },
+                                                      '5' => {
+                                                               'name' => 'record_handle',
+                                                               'type' => '2087'
+                                                             }
+                                                    },
+                                         'Return' => '74',
+                                         'ShortName' => 'pldm_pdr_add_check'
+                                       },
                             '94517' => {
                                          'Header' => 'pdr.h',
                                          'Param' => {
@@ -8242,6 +8273,7 @@
                                                  'pldm_is_empty_entity_assoc_tree' => 1,
                                                  'pldm_open' => 1,
                                                  'pldm_pdr_add' => 1,
+                                                 'pldm_pdr_add_check' => 1,
                                                  'pldm_pdr_add_fru_record_set' => 1,
                                                  'pldm_pdr_destroy' => 1,
                                                  'pldm_pdr_find_record' => 1,
diff --git a/src/pdr.c b/src/pdr.c
index 10beab0..e77a856 100644
--- a/src/pdr.c
+++ b/src/pdr.c
@@ -34,7 +34,7 @@
 	return record->next->record_handle;
 }
 
-LIBPLDM_ABI_STABLE
+LIBPLDM_ABI_DEPRECATED
 uint32_t pldm_pdr_add(pldm_pdr *repo, const uint8_t *data, uint32_t size,
 		      uint32_t record_handle, bool is_remote,
 		      uint16_t terminus_handle)
@@ -46,7 +46,7 @@
 	return record_handle;
 }
 
-LIBPLDM_ABI_TESTING
+LIBPLDM_ABI_STABLE
 int pldm_pdr_add_check(pldm_pdr *repo, const uint8_t *data, uint32_t size,
 		       bool is_remote, uint16_t terminus_handle,
 		       uint32_t *record_handle)