diff mbox series

[V2,06/15] core/pldm: Find PDR record by record handle

Message ID 20220429094744.72855-7-clombard@linux.vnet.ibm.com
State Superseded
Headers show
Series Complete PLDM responder and enable PLDM support | expand

Commit Message

Christophe Lombard April 29, 2022, 9:47 a.m. UTC
Add a wrapper for the libpldm api: pldm_pdr_find_record()

Signed-off-by: Christophe Lombard <clombard@linux.vnet.ibm.com>
---
 core/pldm/pldm-platform-requests.c | 22 ++++++++++++++++++++++
 core/pldm/pldm.h                   |  4 ++++
 2 files changed, 26 insertions(+)

Comments

Frederic Barrat April 26, 2023, 1:39 p.m. UTC | #1
On 29/04/2022 11:47, Christophe Lombard wrote:
> Add a wrapper for the libpldm api: pldm_pdr_find_record()
> 
> Signed-off-by: Christophe Lombard <clombard@linux.vnet.ibm.com>
> ---
>   core/pldm/pldm-platform-requests.c | 22 ++++++++++++++++++++++
>   core/pldm/pldm.h                   |  4 ++++
>   2 files changed, 26 insertions(+)
> 
> diff --git a/core/pldm/pldm-platform-requests.c b/core/pldm/pldm-platform-requests.c
> index c3baad54..a84712d0 100644
> --- a/core/pldm/pldm-platform-requests.c
> +++ b/core/pldm/pldm-platform-requests.c
> @@ -32,6 +32,28 @@ static void pdr_init_complete(bool success)
>   	pdr_ready = true;
>   }
>   
> +/*
> + * Find PDR record by record handle.
> + */
> +int pldm_platform_pdr_find_record(uint32_t record_handle,
> +				  uint8_t **pdr_data,
> +				  uint32_t *pdr_data_size,
> +				  uint32_t *next_record_handle)
> +{
> +	const pldm_pdr_record *pdr_record;
> +


We should test for the validity of "repo" here.

   Fred


> +	pdr_record = pldm_pdr_find_record(repo,
> +					  record_handle,
> +					  pdr_data,
> +					  pdr_data_size,
> +					  next_record_handle);
> +
> +	if (!pdr_record)
> +		return OPAL_PARAMETER;
> +
> +	return OPAL_SUCCESS;
> +}
> +
>   /*
>    * Search the matching record and return the effecter id.
>    * PDR type = PLDM_STATE_EFFECTER_PDR
> diff --git a/core/pldm/pldm.h b/core/pldm/pldm.h
> index 938a554c..bc399271 100644
> --- a/core/pldm/pldm.h
> +++ b/core/pldm/pldm.h
> @@ -80,6 +80,10 @@ int pldm_bios_init(void);
>   
>   int pldm_base_get_tid_req(void);
>   
> +int pldm_platform_pdr_find_record(uint32_t record_handle,
> +				  uint8_t **pdr_data,
> +				  uint32_t *pdr_data_size,
> +				  uint32_t *next_record_handle);
>   int plmd_platform_reload_pdrs(void);
>   int pldm_platform_init(void);
>   void pldm_platform_exit(void);
Christophe Lombard May 16, 2023, 2:14 p.m. UTC | #2
Le 26/04/2023 à 15:39, Frederic Barrat a écrit :
>
>
> On 29/04/2022 11:47, Christophe Lombard wrote:
>> Add a wrapper for the libpldm api: pldm_pdr_find_record()
>>
>> Signed-off-by: Christophe Lombard <clombard@linux.vnet.ibm.com>
>> ---
>>   core/pldm/pldm-platform-requests.c | 22 ++++++++++++++++++++++
>>   core/pldm/pldm.h                   |  4 ++++
>>   2 files changed, 26 insertions(+)
>>
>> diff --git a/core/pldm/pldm-platform-requests.c 
>> b/core/pldm/pldm-platform-requests.c
>> index c3baad54..a84712d0 100644
>> --- a/core/pldm/pldm-platform-requests.c
>> +++ b/core/pldm/pldm-platform-requests.c
>> @@ -32,6 +32,28 @@ static void pdr_init_complete(bool success)
>>       pdr_ready = true;
>>   }
>>   +/*
>> + * Find PDR record by record handle.
>> + */
>> +int pldm_platform_pdr_find_record(uint32_t record_handle,
>> +                  uint8_t **pdr_data,
>> +                  uint32_t *pdr_data_size,
>> +                  uint32_t *next_record_handle)
>> +{
>> +    const pldm_pdr_record *pdr_record;
>> +
>
>
> We should test for the validity of "repo" here.
>

Correct. Thanks

> Fred
>
>
>> +    pdr_record = pldm_pdr_find_record(repo,
>> +                      record_handle,
>> +                      pdr_data,
>> +                      pdr_data_size,
>> +                      next_record_handle);
>> +
>> +    if (!pdr_record)
>> +        return OPAL_PARAMETER;
>> +
>> +    return OPAL_SUCCESS;
>> +}
>> +
>>   /*
>>    * Search the matching record and return the effecter id.
>>    * PDR type = PLDM_STATE_EFFECTER_PDR
>> diff --git a/core/pldm/pldm.h b/core/pldm/pldm.h
>> index 938a554c..bc399271 100644
>> --- a/core/pldm/pldm.h
>> +++ b/core/pldm/pldm.h
>> @@ -80,6 +80,10 @@ int pldm_bios_init(void);
>>     int pldm_base_get_tid_req(void);
>>   +int pldm_platform_pdr_find_record(uint32_t record_handle,
>> +                  uint8_t **pdr_data,
>> +                  uint32_t *pdr_data_size,
>> +                  uint32_t *next_record_handle);
>>   int plmd_platform_reload_pdrs(void);
>>   int pldm_platform_init(void);
>>   void pldm_platform_exit(void);
diff mbox series

Patch

diff --git a/core/pldm/pldm-platform-requests.c b/core/pldm/pldm-platform-requests.c
index c3baad54..a84712d0 100644
--- a/core/pldm/pldm-platform-requests.c
+++ b/core/pldm/pldm-platform-requests.c
@@ -32,6 +32,28 @@  static void pdr_init_complete(bool success)
 	pdr_ready = true;
 }
 
+/*
+ * Find PDR record by record handle.
+ */
+int pldm_platform_pdr_find_record(uint32_t record_handle,
+				  uint8_t **pdr_data,
+				  uint32_t *pdr_data_size,
+				  uint32_t *next_record_handle)
+{
+	const pldm_pdr_record *pdr_record;
+
+	pdr_record = pldm_pdr_find_record(repo,
+					  record_handle,
+					  pdr_data,
+					  pdr_data_size,
+					  next_record_handle);
+
+	if (!pdr_record)
+		return OPAL_PARAMETER;
+
+	return OPAL_SUCCESS;
+}
+
 /*
  * Search the matching record and return the effecter id.
  * PDR type = PLDM_STATE_EFFECTER_PDR
diff --git a/core/pldm/pldm.h b/core/pldm/pldm.h
index 938a554c..bc399271 100644
--- a/core/pldm/pldm.h
+++ b/core/pldm/pldm.h
@@ -80,6 +80,10 @@  int pldm_bios_init(void);
 
 int pldm_base_get_tid_req(void);
 
+int pldm_platform_pdr_find_record(uint32_t record_handle,
+				  uint8_t **pdr_data,
+				  uint32_t *pdr_data_size,
+				  uint32_t *next_record_handle);
 int plmd_platform_reload_pdrs(void);
 int pldm_platform_init(void);
 void pldm_platform_exit(void);