[Skiboot] [PATCH V6 14/21] core/pldm: PLDM for BIOS Control and Configuration Specification
Christophe Lombard
clombard at linux.vnet.ibm.com
Thu Apr 13 22:44:04 AEST 2023
Le 12/04/2023 à 17:30, Frederic Barrat a écrit :
>
>
> On 13/09/2022 12:26, Christophe Lombard wrote:
>
>> +/*
>> + * Send/receive a PLDM GetBIOSTable request message
>> + */
>> +static int get_bios_table_req(enum pldm_bios_table_types table_type,
>> + void **bios_table, size_t *bios_length)
>> +{
>> + char request_msg[PKT_SIZE(struct pldm_get_bios_table_req)];
>> + size_t response_len, payload_len, bios_table_offset;
>> + uint8_t completion_code, transfer_flag;
>> + uint32_t next_transfer_handle;
>> + void *response_msg;
>> + int rc;
>> +
>> + struct pldm_get_bios_table_req bios_table_req = {
>> + .transfer_handle = 0, /* (0 if transfer op is FIRSTPART) */
>> + .transfer_op_flag = PLDM_GET_FIRSTPART,
>> + .table_type = table_type
>> + };
>> +
>> + prlog(PR_DEBUG, "%s - table type: %d\n", __func__, table_type);
>> +
>> + /* Encode the bios table request */
>> + rc = encode_get_bios_table_req(
>> + DEFAULT_INSTANCE_ID,
>> + bios_table_req.transfer_handle,
>> + bios_table_req.transfer_op_flag,
>> + bios_table_req.table_type,
>> + (struct pldm_msg *)request_msg);
>> + if (rc != PLDM_SUCCESS) {
>> + prlog(PR_ERR, "Encode GetBIOSTableReq Error, type: %d, rc:
>> %d\n",
>> + table_type, rc);
>> + return OPAL_PARAMETER;
>> + }
>> +
>> + /* Send and get the response message bytes */
>> + rc = pldm_requester_queue_and_wait(request_msg,
>> sizeof(request_msg),
>> + &response_msg, &response_len);
>> + if (rc) {
>> + prlog(PR_ERR, "Communication Error, req: GetBIOSTableReq,
>> rc: %d\n", rc);
>> + return rc;
>> + }
>> +
>> + /* Decode the message */
>> + payload_len = response_len - sizeof(struct pldm_msg_hdr);
>> + rc = decode_get_bios_table_resp(
>> + response_msg,
>> + payload_len,
>> + &completion_code,
>> + &next_transfer_handle,
>> + &transfer_flag,
>> + &bios_table_offset);
>> + if (rc != PLDM_SUCCESS || completion_code != PLDM_SUCCESS) {
>> + prlog(PR_ERR, "Decode GetBIOSTableResp Error, rc: %d, cc:
>> %d\n",
>> + rc, completion_code);
>> + free(response_msg);
>> + return OPAL_PARAMETER;
>> + }
>> +
>> + /* we do not support multipart transfer */
>> + if ((next_transfer_handle != PLDM_GET_NEXTPART) ||
>> + (transfer_flag != PLDM_START_AND_END)) {
>> + prlog(PR_ERR, "Transfert GetBIOSTable not complete "
>> + "transfer_hndl: %d, transfer_flag: %d\n",
>> + next_transfer_handle,
>> + transfer_flag);
>> + }
>> +
>> + *bios_length = payload_len -
>> + sizeof(next_transfer_handle) -
>> + sizeof(transfer_flag) -
>> + sizeof(completion_code);
>
>
> Can be replaced with:
> *bios_length = payload_len - bios_table_offset;
>
ok. Thanks
> Fred
More information about the Skiboot
mailing list