Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 1 | #ifndef BIOS_H |
| 2 | #define BIOS_H |
| 3 | |
| 4 | #ifdef __cplusplus |
| 5 | extern "C" { |
| 6 | #endif |
| 7 | |
Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 8 | #include <stddef.h> |
| 9 | #include <stdint.h> |
| 10 | |
Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 11 | /* Response lengths are inclusive of completion code */ |
| 12 | #define PLDM_GET_DATE_TIME_RESP_BYTES 8 |
| 13 | |
Andrew Jeffery | 37dd6a3 | 2023-05-12 16:04:06 +0930 | [diff] [blame] | 14 | #define PLDM_GET_BIOS_TABLE_REQ_BYTES 6 |
| 15 | #define PLDM_GET_BIOS_TABLE_MIN_RESP_BYTES 6 |
| 16 | #define PLDM_SET_BIOS_TABLE_MIN_REQ_BYTES 6 |
| 17 | #define PLDM_SET_BIOS_TABLE_RESP_BYTES 5 |
| 18 | #define PLDM_SET_BIOS_ATTR_CURR_VAL_MIN_REQ_BYTES 5 |
| 19 | #define PLDM_SET_BIOS_ATTR_CURR_VAL_RESP_BYTES 5 |
| 20 | #define PLDM_GET_BIOS_ATTR_CURR_VAL_BY_HANDLE_REQ_BYTES 7 |
Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 21 | #define PLDM_GET_BIOS_ATTR_CURR_VAL_BY_HANDLE_MIN_RESP_BYTES 6 |
| 22 | |
| 23 | enum pldm_bios_completion_codes { |
| 24 | PLDM_BIOS_TABLE_UNAVAILABLE = 0x83, |
| 25 | PLDM_INVALID_BIOS_TABLE_DATA_INTEGRITY_CHECK = 0x84, |
| 26 | PLDM_INVALID_BIOS_TABLE_TYPE = 0x85, |
| 27 | PLDM_INVALID_BIOS_ATTR_HANDLE = 0x88, |
| 28 | }; |
| 29 | enum pldm_bios_commands { |
| 30 | PLDM_GET_BIOS_TABLE = 0x01, |
| 31 | PLDM_SET_BIOS_TABLE = 0x02, |
| 32 | PLDM_SET_BIOS_ATTRIBUTE_CURRENT_VALUE = 0x07, |
| 33 | PLDM_GET_BIOS_ATTRIBUTE_CURRENT_VALUE_BY_HANDLE = 0x08, |
| 34 | PLDM_GET_DATE_TIME = 0x0c, |
| 35 | PLDM_SET_DATE_TIME = 0x0d, |
| 36 | }; |
| 37 | |
| 38 | enum pldm_bios_table_types { |
| 39 | PLDM_BIOS_STRING_TABLE, |
| 40 | PLDM_BIOS_ATTR_TABLE, |
| 41 | PLDM_BIOS_ATTR_VAL_TABLE, |
| 42 | }; |
| 43 | |
Manojkiran Eda | 9a8e497 | 2022-11-28 16:38:21 +0530 | [diff] [blame] | 44 | struct pldm_msg; |
| 45 | struct variable_field; |
| 46 | |
Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 47 | struct pldm_bios_string_table_entry { |
| 48 | uint16_t string_handle; |
| 49 | uint16_t string_length; |
| 50 | char name[1]; |
| 51 | } __attribute__((packed)); |
| 52 | |
| 53 | struct pldm_bios_attr_table_entry { |
| 54 | uint16_t attr_handle; |
| 55 | uint8_t attr_type; |
| 56 | uint16_t string_handle; |
| 57 | uint8_t metadata[1]; |
| 58 | } __attribute__((packed)); |
| 59 | |
| 60 | struct pldm_bios_enum_attr { |
| 61 | uint8_t num_possible_values; |
| 62 | uint16_t indices[1]; |
| 63 | } __attribute__((packed)); |
| 64 | |
| 65 | struct pldm_bios_attr_val_table_entry { |
| 66 | uint16_t attr_handle; |
| 67 | uint8_t attr_type; |
| 68 | uint8_t value[1]; |
| 69 | } __attribute__((packed)); |
| 70 | |
| 71 | enum pldm_bios_attribute_type { |
| 72 | PLDM_BIOS_ENUMERATION = 0x0, |
| 73 | PLDM_BIOS_STRING = 0x1, |
| 74 | PLDM_BIOS_PASSWORD = 0x2, |
| 75 | PLDM_BIOS_INTEGER = 0x3, |
| 76 | PLDM_BIOS_ENUMERATION_READ_ONLY = 0x80, |
| 77 | PLDM_BIOS_STRING_READ_ONLY = 0x81, |
| 78 | PLDM_BIOS_PASSWORD_READ_ONLY = 0x82, |
| 79 | PLDM_BIOS_INTEGER_READ_ONLY = 0x83, |
| 80 | }; |
| 81 | |
| 82 | /** @struct pldm_get_bios_table_req |
| 83 | * |
| 84 | * structure representing GetBIOSTable request packet |
| 85 | */ |
| 86 | struct pldm_get_bios_table_req { |
| 87 | uint32_t transfer_handle; |
| 88 | uint8_t transfer_op_flag; |
| 89 | uint8_t table_type; |
| 90 | } __attribute__((packed)); |
| 91 | |
| 92 | /** @struct pldm_get_bios_table_resp |
| 93 | * |
| 94 | * structure representing GetBIOSTable response packet |
| 95 | */ |
| 96 | struct pldm_get_bios_table_resp { |
| 97 | uint8_t completion_code; |
| 98 | uint32_t next_transfer_handle; |
| 99 | uint8_t transfer_flag; |
| 100 | uint8_t table_data[1]; |
| 101 | } __attribute__((packed)); |
| 102 | |
| 103 | /** @struct pldm_get_date_time_resp |
| 104 | * |
| 105 | * Structure representing PLDM get date time response |
| 106 | */ |
| 107 | struct pldm_get_date_time_resp { |
| 108 | uint8_t completion_code; //!< completion code |
| 109 | uint8_t seconds; //!< Seconds in BCD format |
| 110 | uint8_t minutes; //!< Minutes in BCD format |
| 111 | uint8_t hours; //!< Hours in BCD format |
| 112 | uint8_t day; //!< Day of the month in BCD format |
| 113 | uint8_t month; //!< Month in BCD format |
| 114 | uint16_t year; //!< Year in BCD format |
| 115 | } __attribute__((packed)); |
| 116 | |
| 117 | /** @struct pldm_set_date_time_req |
| 118 | * |
| 119 | * structure representing SetDateTime request packet |
| 120 | * |
| 121 | */ |
| 122 | struct pldm_set_date_time_req { |
| 123 | uint8_t seconds; //!< Seconds in BCD format |
| 124 | uint8_t minutes; //!< Minutes in BCD format |
| 125 | uint8_t hours; //!< Hours in BCD format |
| 126 | uint8_t day; //!< Day of the month in BCD format |
| 127 | uint8_t month; //!< Month in BCD format |
| 128 | uint16_t year; //!< Year in BCD format |
| 129 | } __attribute__((packed)); |
| 130 | |
| 131 | /** @struct pldm_only_cc_resp |
| 132 | * |
| 133 | * Structure representing PLDM responses only have completion code |
| 134 | */ |
| 135 | struct pldm_only_cc_resp { |
| 136 | uint8_t completion_code; |
| 137 | } __attribute__((packed)); |
| 138 | |
| 139 | /** @struct pldm_get_bios_attribute_current_value_by_handle_req |
| 140 | * |
| 141 | * structure representing GetBIOSAttributeCurrentValueByHandle request packet |
| 142 | */ |
| 143 | struct pldm_get_bios_attribute_current_value_by_handle_req { |
| 144 | uint32_t transfer_handle; |
| 145 | uint8_t transfer_op_flag; |
| 146 | uint16_t attribute_handle; |
| 147 | } __attribute__((packed)); |
| 148 | |
| 149 | /** @struct pldm_get_bios_attribute_current_value_by_handle_resp |
| 150 | * |
| 151 | * structure representing GetBIOSAttributeCurrentValueByHandle response |
| 152 | */ |
| 153 | struct pldm_get_bios_attribute_current_value_by_handle_resp { |
| 154 | uint8_t completion_code; |
| 155 | uint32_t next_transfer_handle; |
| 156 | uint8_t transfer_flag; |
| 157 | uint8_t attribute_data[1]; |
| 158 | } __attribute__((packed)); |
| 159 | |
| 160 | /** @struct pldm_set_bios_attribute_current_value_req |
| 161 | * |
| 162 | * structure representing SetBiosAttributeCurrentValue request packet |
| 163 | * |
| 164 | */ |
| 165 | struct pldm_set_bios_attribute_current_value_req { |
| 166 | uint32_t transfer_handle; |
| 167 | uint8_t transfer_flag; |
| 168 | uint8_t attribute_data[1]; |
| 169 | } __attribute__((packed)); |
| 170 | |
| 171 | /** @struct pldm_set_bios_attribute_current_value_resp |
| 172 | * |
| 173 | * structure representing SetBiosCurrentValue response packet |
| 174 | * |
| 175 | */ |
| 176 | struct pldm_set_bios_attribute_current_value_resp { |
| 177 | uint8_t completion_code; |
| 178 | uint32_t next_transfer_handle; |
| 179 | } __attribute__((packed)); |
| 180 | |
| 181 | /** @struct pldm_set_bios_table_req |
| 182 | * |
| 183 | * structure representing SetBIOSTable request packet |
| 184 | * |
| 185 | */ |
| 186 | struct pldm_set_bios_table_req { |
| 187 | uint32_t transfer_handle; |
| 188 | uint8_t transfer_flag; |
| 189 | uint8_t table_type; |
| 190 | uint8_t table_data[1]; |
| 191 | } __attribute__((packed)); |
| 192 | |
| 193 | /** @struct pldm_set_bios_table_resp |
| 194 | * |
| 195 | * structure representing SetBIOSTable response packet |
| 196 | * |
| 197 | */ |
| 198 | struct pldm_set_bios_table_resp { |
| 199 | uint8_t completion_code; |
| 200 | uint32_t next_transfer_handle; |
| 201 | } __attribute__((packed)); |
| 202 | |
| 203 | /* Requester */ |
| 204 | |
| 205 | /* GetDateTime */ |
| 206 | |
| 207 | /** @brief Create a PLDM request message for GetDateTime |
| 208 | * |
| 209 | * @param[in] instance_id - Message's instance id |
| 210 | * @param[out] msg - Message will be written to this |
| 211 | * @return pldm_completion_codes |
| 212 | * @note Caller is responsible for memory alloc and dealloc of param |
| 213 | * 'msg.body.payload' |
| 214 | */ |
| 215 | |
| 216 | int encode_get_date_time_req(uint8_t instance_id, struct pldm_msg *msg); |
| 217 | |
| 218 | /** @brief Decode a GetDateTime response message |
| 219 | * |
| 220 | * Note: |
| 221 | * * If the return value is not PLDM_SUCCESS, it represents a |
| 222 | * transport layer error. |
| 223 | * * If the completion_code value is not PLDM_SUCCESS, it represents a |
| 224 | * protocol layer error and all the out-parameters are invalid. |
| 225 | * |
| 226 | * @param[in] msg - Response message |
| 227 | * @param[in] payload_length - Length of response message payload |
| 228 | * @param[out] completion_code - Pointer to response msg's PLDM completion code |
| 229 | * @param[out] seconds - Seconds in BCD format |
| 230 | * @param[out] minutes - minutes in BCD format |
| 231 | * @param[out] hours - hours in BCD format |
| 232 | * @param[out] day - day of month in BCD format |
| 233 | * @param[out] month - number of month in BCD format |
| 234 | * @param[out] year - year in BCD format |
| 235 | * @return pldm_completion_codes |
| 236 | */ |
| 237 | int decode_get_date_time_resp(const struct pldm_msg *msg, size_t payload_length, |
| 238 | uint8_t *completion_code, uint8_t *seconds, |
| 239 | uint8_t *minutes, uint8_t *hours, uint8_t *day, |
| 240 | uint8_t *month, uint16_t *year); |
| 241 | |
| 242 | /* SetBiosAttributeCurrentValue */ |
| 243 | |
| 244 | /** @brief Create a PLDM request message for SetBiosAttributeCurrentValue |
| 245 | * |
| 246 | * @param[in] instance_id - Message's instance id |
| 247 | * @param[in] transfer_handle - Handle to identify a BIOS table transfer |
| 248 | * @param[in] transfer_flag - Flag to indicate what part of the transfer |
| 249 | * this request represents |
| 250 | * @param[in] attribute_data - Contains current value of attribute |
| 251 | * @param[in] attribute_length - Length of attribute |
| 252 | * @param[out] msg - Message will be written to this |
| 253 | * @param[in] payload_length - Length of message payload |
| 254 | * @return pldm_completion_codes |
| 255 | * @note Caller is responsible for memory alloc and dealloc of params |
| 256 | * 'msg.payload' |
| 257 | */ |
| 258 | int encode_set_bios_attribute_current_value_req( |
Andrew Jeffery | 37dd6a3 | 2023-05-12 16:04:06 +0930 | [diff] [blame] | 259 | uint8_t instance_id, uint32_t transfer_handle, uint8_t transfer_flag, |
| 260 | const uint8_t *attribute_data, size_t attribute_length, |
| 261 | struct pldm_msg *msg, size_t payload_length); |
Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 262 | |
| 263 | /** @brief Decode a SetBiosAttributeCurrentValue response message |
| 264 | * |
| 265 | * Note: |
| 266 | * * If the return value is not PLDM_SUCCESS, it represents a |
| 267 | * transport layer error. |
| 268 | * * If the completion_code value is not PLDM_SUCCESS, it represents a |
| 269 | * protocol layer error and all the out-parameters are invalid. |
| 270 | * |
| 271 | * @param[in] msg - Response message |
| 272 | * @param[in] payload_length - Length of response message payload |
| 273 | * @param[out] completion_code - Pointer to response msg's PLDM completion code |
| 274 | * @param[out] next_transfer_handle - Pointer to a handle that identify the |
| 275 | * next portion of the transfer |
| 276 | * @return pldm_completion_codes |
| 277 | */ |
| 278 | int decode_set_bios_attribute_current_value_resp( |
Andrew Jeffery | 37dd6a3 | 2023-05-12 16:04:06 +0930 | [diff] [blame] | 279 | const struct pldm_msg *msg, size_t payload_length, |
| 280 | uint8_t *completion_code, uint32_t *next_transfer_handle); |
Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 281 | |
| 282 | /* SetBIOSTable */ |
| 283 | |
| 284 | /** @brief Create a PLDM request message for SetBIOSTable |
| 285 | * |
| 286 | * @param[in] instance_id - Message's instance id |
| 287 | * @param[in] transfer_handle - Handle to identify a BIOS table transfer |
| 288 | * @param[in] transfer_flag - Flag to indicate what part of the transfer |
| 289 | * this request represents |
| 290 | * @param[in] table_type - Indicates what table is being transferred |
| 291 | * {BIOSStringTable=0x0, BIOSAttributeTable=0x1, |
| 292 | * BIOSAttributeValueTable=0x2} |
| 293 | * @param[in] table_data - Contains data specific to the table type |
| 294 | * @param[in] table_length - Length of table data |
| 295 | * @param[out] msg - Message will be written to this |
| 296 | * @param[in] payload_length - Length of message payload |
| 297 | * @return pldm_completion_codes |
| 298 | * @note Caller is responsible for memory alloc and dealloc of params |
| 299 | * 'msg.payload' |
| 300 | */ |
| 301 | int encode_set_bios_table_req(uint8_t instance_id, uint32_t transfer_handle, |
| 302 | uint8_t transfer_flag, uint8_t table_type, |
| 303 | const uint8_t *table_data, size_t table_length, |
| 304 | struct pldm_msg *msg, size_t payload_length); |
| 305 | |
| 306 | /** @brief Decode a SetBIOSTable response message |
| 307 | * |
| 308 | * Note: |
| 309 | * * If the return value is not PLDM_SUCCESS, it represents a |
| 310 | * transport layer error. |
| 311 | * * If the completion_code value is not PLDM_SUCCESS, it represents a |
| 312 | * protocol layer error and all the out-parameters are invalid. |
| 313 | * |
| 314 | * @param[in] msg - Response message |
| 315 | * @param[in] payload_length - Length of response message payload |
| 316 | * @param[out] completion_code - Pointer to response msg's PLDM completion code |
| 317 | * @param[out] next_transfer_handle - Pointer to a handle that identify the |
| 318 | * next portion of the transfer |
| 319 | * @return pldm_completion_codes |
| 320 | */ |
| 321 | int decode_set_bios_table_resp(const struct pldm_msg *msg, |
| 322 | size_t payload_length, uint8_t *completion_code, |
| 323 | uint32_t *next_transfer_handle); |
| 324 | |
| 325 | /* Responder */ |
| 326 | |
| 327 | /* GetDateTime */ |
| 328 | |
| 329 | /** @brief Create a PLDM response message for GetDateTime |
| 330 | * |
| 331 | * @param[in] instance_id - Message's instance id |
| 332 | * @param[in] completion_code - PLDM completion code |
| 333 | * @param[in] seconds - seconds in BCD format |
| 334 | * @param[in] minutes - minutes in BCD format |
| 335 | * @param[in] hours - hours in BCD format |
| 336 | * @param[in] day - day of the month in BCD format |
| 337 | * @param[in] month - number of month in BCD format |
| 338 | * @param[in] year - year in BCD format |
| 339 | * @param[out] msg - Message will be written to this |
| 340 | * @return pldm_completion_codes |
| 341 | * @note Caller is responsible for memory alloc and dealloc of param |
| 342 | * 'msg.body.payload' |
| 343 | */ |
| 344 | |
| 345 | int encode_get_date_time_resp(uint8_t instance_id, uint8_t completion_code, |
| 346 | uint8_t seconds, uint8_t minutes, uint8_t hours, |
| 347 | uint8_t day, uint8_t month, uint16_t year, |
| 348 | struct pldm_msg *msg); |
| 349 | |
| 350 | /* GetBIOSTable */ |
| 351 | |
| 352 | /** @brief Create a PLDM response message for GetBIOSTable |
| 353 | * |
| 354 | * @param[in] instance_id - Message's instance id |
| 355 | * @param[in] completion_code - PLDM completion code |
| 356 | * @param[in] next_transfer_handle - handle to identify the next portion of the |
| 357 | * transfer |
| 358 | * @param[in] transfer_flag - To indicate what part of the transfer this |
| 359 | * response represents |
| 360 | * @param[in] table_data - BIOS Table type specific data |
| 361 | * @param[in] payload_length - Length of payload message |
| 362 | * @param[out] msg - Message will be written to this |
| 363 | * @return pldm_completion_codes |
| 364 | */ |
| 365 | int encode_get_bios_table_resp(uint8_t instance_id, uint8_t completion_code, |
| 366 | uint32_t next_transfer_handle, |
| 367 | uint8_t transfer_flag, uint8_t *table_data, |
| 368 | size_t payload_length, struct pldm_msg *msg); |
| 369 | |
| 370 | /** @brief Encode GetBIOSTable request packet |
| 371 | * |
| 372 | * @param[in] instance_id - Message's instance id |
| 373 | * @param[in] transfer_handle - Handle to identify a BIOS table transfer |
| 374 | * @param[in] transfer_op_flag - Flag to indicate the start of a multipart |
| 375 | * transfer |
| 376 | * @param[in] table_type - BIOS table type |
| 377 | * @param[out] msg - Message will be written to this |
| 378 | * @return pldm_completion_codes |
| 379 | */ |
| 380 | int encode_get_bios_table_req(uint8_t instance_id, uint32_t transfer_handle, |
| 381 | uint8_t transfer_op_flag, uint8_t table_type, |
| 382 | struct pldm_msg *msg); |
| 383 | |
| 384 | /** @brief Decode GetBIOSTable request packet |
| 385 | * |
| 386 | * @param[in] msg - Request message |
| 387 | * @param[in] payload_length - Length of request message payload |
| 388 | * @param[out] transfer_handle - Handle to identify a BIOS table transfer |
| 389 | * @param[out] transfer_op_flag - Flag to indicate the start of a multipart |
| 390 | * transfer |
| 391 | * @param[out] table_type - BIOS table type |
| 392 | * @return pldm_completion_codes |
| 393 | */ |
| 394 | int decode_get_bios_table_req(const struct pldm_msg *msg, size_t payload_length, |
| 395 | uint32_t *transfer_handle, |
| 396 | uint8_t *transfer_op_flag, uint8_t *table_type); |
| 397 | |
| 398 | /** @brief Decode GetBIOSTable response packet |
| 399 | * |
| 400 | * @param[in] msg - Response message |
| 401 | * @param[in] payload_length - Length of response message payload |
| 402 | * @param[in] completion_code - PLDM completion code |
| 403 | * @param[in] next_transfer_handle - handle to identify the next portion of the |
| 404 | * transfer |
| 405 | * @param[in] transfer_flag - To indicate what part of the transfer this |
| 406 | * response represents |
| 407 | * @param[out] bios_table_offset - Offset where bios table data should be read |
| 408 | * in pldm msg |
| 409 | * @return pldm_completion_codes |
| 410 | */ |
| 411 | int decode_get_bios_table_resp(const struct pldm_msg *msg, |
| 412 | size_t payload_length, uint8_t *completion_code, |
| 413 | uint32_t *next_transfer_handle, |
| 414 | uint8_t *transfer_flag, |
| 415 | size_t *bios_table_offset); |
| 416 | |
| 417 | /* GetBIOSAttributeCurrentValueByHandle */ |
| 418 | |
| 419 | /** @brief Decode GetBIOSAttributeCurrentValueByHandle request packet |
| 420 | * |
| 421 | * @param[in] instance_id - Message's instance id |
| 422 | * @param[in] transfer_handle - Handle to identify a BIOS attribute transfer |
| 423 | * @param[in] transfer_op_flag - Flag to indicate the start of a multipart |
| 424 | * transfer |
| 425 | * @param[in] attribute_handle - Handle to identify the BIOS attribute |
| 426 | * @param[out] msg - Message will be written to this |
| 427 | * @return pldm_completion_codes |
| 428 | */ |
| 429 | int encode_get_bios_attribute_current_value_by_handle_req( |
Andrew Jeffery | 37dd6a3 | 2023-05-12 16:04:06 +0930 | [diff] [blame] | 430 | uint8_t instance_id, uint32_t transfer_handle, uint8_t transfer_op_flag, |
| 431 | uint16_t attribute_handle, struct pldm_msg *msg); |
Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 432 | |
| 433 | /** @brief Decode GetBIOSAttributeCurrentValueByHandle response packet |
| 434 | * |
| 435 | * @param[in] msg - Response message |
| 436 | * @param[in] payload_length - Length of response message payload |
| 437 | * @param[out] completion_code - PLDM completion code |
| 438 | * @param[out] next_transfer_handle - handle to identify the next portion of |
| 439 | * the transfer |
| 440 | * @param[out] transfer_flag - To indicate what part of the transfer this |
| 441 | * response represents |
| 442 | * @param[out] attribute_data - contains current value of attribute |
| 443 | * @return pldm_completion_codes |
| 444 | */ |
| 445 | int decode_get_bios_attribute_current_value_by_handle_resp( |
Andrew Jeffery | 37dd6a3 | 2023-05-12 16:04:06 +0930 | [diff] [blame] | 446 | const struct pldm_msg *msg, size_t payload_length, |
| 447 | uint8_t *completion_code, uint32_t *next_transfer_handle, |
| 448 | uint8_t *transfer_flag, struct variable_field *attribute_data); |
Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 449 | |
| 450 | /** @brief Decode GetBIOSAttributeCurrentValueByHandle request packet |
| 451 | * |
| 452 | * @param[in] msg - Request message |
| 453 | * @param[in] payload_length - Length of request message payload |
| 454 | * @param[out] transfer_handle - Handle to identify a BIOS table transfer |
| 455 | * @param[out] transfer_op_flag - Flag to indicate the start of a multipart |
| 456 | * transfer |
| 457 | * @param[out] attribute_handle - Handle to identify the BIOS attribute |
| 458 | * @return pldm_completion_codes |
| 459 | */ |
| 460 | int decode_get_bios_attribute_current_value_by_handle_req( |
Andrew Jeffery | 37dd6a3 | 2023-05-12 16:04:06 +0930 | [diff] [blame] | 461 | const struct pldm_msg *msg, size_t payload_length, |
| 462 | uint32_t *transfer_handle, uint8_t *transfer_op_flag, |
| 463 | uint16_t *attribute_handle); |
Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 464 | |
| 465 | /** @brief Create a PLDM response message for |
| 466 | * GetBIOSAttributeCurrentValueByHandle |
| 467 | * |
| 468 | * @param[in] instance_id - Message's instance id |
| 469 | * @param[in] completion_code - PLDM completion code |
| 470 | * @param[in] next_transfer_handle - handle to identify the next portion of the |
| 471 | * transfer |
| 472 | * @param[in] transfer_flag - To indicate what part of the transfer this |
| 473 | * response represents |
| 474 | * @param[in] attribute_data - contains current value of attribute |
| 475 | * @param[in] attribute_length - Length of attribute |
| 476 | * @param[out] msg - Message will be written to this |
| 477 | * @return pldm_completion_codes |
| 478 | */ |
Andrew Jeffery | 37dd6a3 | 2023-05-12 16:04:06 +0930 | [diff] [blame] | 479 | int encode_get_bios_current_value_by_handle_resp(uint8_t instance_id, |
| 480 | uint8_t completion_code, |
| 481 | uint32_t next_transfer_handle, |
| 482 | uint8_t transfer_flag, |
| 483 | const uint8_t *attribute_data, |
| 484 | size_t attribute_length, |
| 485 | struct pldm_msg *msg); |
Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 486 | |
| 487 | /* SetBiosAttributeCurrentValue */ |
| 488 | |
| 489 | /** @brief Decode SetBIOSAttributeCurrentValue request packet |
| 490 | * |
| 491 | * @param[in] msg - Request message |
| 492 | * @param[in] payload_length - Length of request message payload |
| 493 | * @param[out] transfer_handle - Handle to identify a BIOS table transfer |
| 494 | * @param[out] transfer_flag - Flag to indicate what part of the transfer |
| 495 | * this request represents |
| 496 | * @param[out] attribute - Struct variable_field, contains a pointer to the |
| 497 | * attribute field in the buffer of \p msg, \p msg must |
| 498 | * be valid when \p attribute is used. |
| 499 | * @return pldm_completion_codes |
| 500 | */ |
| 501 | int decode_set_bios_attribute_current_value_req( |
Andrew Jeffery | 37dd6a3 | 2023-05-12 16:04:06 +0930 | [diff] [blame] | 502 | const struct pldm_msg *msg, size_t payload_length, |
| 503 | uint32_t *transfer_handle, uint8_t *transfer_flag, |
| 504 | struct variable_field *attribute); |
Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 505 | |
| 506 | /** @brief Create a PLDM response message for SetBiosAttributeCurrentValue |
| 507 | * |
| 508 | * @param[in] instance_id - Message's instance id |
| 509 | * @param[in] completion_code - PLDM completion code |
| 510 | * @param[in] next_transfer_handle - handle to identify the next portion of the |
| 511 | * @param[out] msg - Message will be written to this |
| 512 | */ |
| 513 | int encode_set_bios_attribute_current_value_resp(uint8_t instance_id, |
| 514 | uint8_t completion_code, |
| 515 | uint32_t next_transfer_handle, |
| 516 | struct pldm_msg *msg); |
| 517 | |
| 518 | /** @brief Create a PLDM request message for SetDateTime |
| 519 | * |
| 520 | * @param[in] instance_id - Message's instance id |
| 521 | * @param[in] seconds - Seconds in decimal format. Value range 0~59 |
| 522 | * @param[in] minutes - minutes in decimal format. Value range 0~59 |
| 523 | * @param[in] hours - hours in decimal format. Value range 0~23 |
| 524 | * @param[in] day - day of month in decimal format. Value range 1~31 |
| 525 | * @param[in] month - number of month in decimal format. Value range 1~12 |
| 526 | * @param[in] year - year in decimal format. Value range 1970~ |
| 527 | * @param[out] msg - Message will be written to this |
| 528 | * @param[in] payload_length - Length of request message payload |
| 529 | * @return pldm_completion_codes |
| 530 | * @note Caller is responsible for memory alloc and dealloc of param |
| 531 | * 'msg.body.payload' |
| 532 | */ |
| 533 | int encode_set_date_time_req(uint8_t instance_id, uint8_t seconds, |
| 534 | uint8_t minutes, uint8_t hours, uint8_t day, |
| 535 | uint8_t month, uint16_t year, struct pldm_msg *msg, |
| 536 | size_t payload_length); |
| 537 | |
| 538 | /** @brief Decode a SetDateTime request message |
| 539 | * |
| 540 | * @param[in] msg - Response message |
| 541 | * @param[in] payload_length - Length of request message payload |
| 542 | * @param[out] seconds - seconds in BCD format |
| 543 | * @param[out] minutes - minutes in BCD format |
| 544 | * @param[out] hours - hours in BCD format |
| 545 | * @param[out] day - day of the month in BCD format |
| 546 | * @param[out] month - number of month in BCD format |
| 547 | * @param[out] year - year in BCD format |
| 548 | * @return pldm_completion_codes |
| 549 | */ |
| 550 | int decode_set_date_time_req(const struct pldm_msg *msg, size_t payload_length, |
| 551 | uint8_t *seconds, uint8_t *minutes, uint8_t *hours, |
| 552 | uint8_t *day, uint8_t *month, uint16_t *year); |
| 553 | |
| 554 | /** @brief Create a PLDM response message for SetDateTime |
| 555 | * |
| 556 | * @param[in] instance_id - Message's instance id |
| 557 | * @param[in] completion_code - PLDM completion code |
| 558 | * @param[out] msg - Message will be written to this |
| 559 | * @param[in] payload_length - Length of response message payload |
| 560 | * @return pldm_completion_codes |
| 561 | * @note Caller is responsible for memory alloc and dealloc of param |
| 562 | * 'msg.body.payload' |
| 563 | */ |
| 564 | int encode_set_date_time_resp(uint8_t instance_id, uint8_t completion_code, |
| 565 | struct pldm_msg *msg, size_t payload_length); |
| 566 | |
| 567 | /** @brief Decode a SetDateTime response message |
| 568 | * |
| 569 | * Note: |
| 570 | * * If the return value is not PLDM_SUCCESS, it represents a |
| 571 | * transport layer error. |
| 572 | * * If the completion_code value is not PLDM_SUCCESS, it represents a |
| 573 | * protocol layer error and all the out-parameters are invalid. |
| 574 | * |
| 575 | * @param[in] msg - Response message |
| 576 | * @param[in] payload_length - Length of response message payload |
| 577 | * @param[out] completion_code - Pointer to response msg's PLDM completion code |
| 578 | * @return pldm_completion_codes |
| 579 | */ |
| 580 | int decode_set_date_time_resp(const struct pldm_msg *msg, size_t payload_length, |
| 581 | uint8_t *completion_code); |
| 582 | |
| 583 | /* SetBIOSTable */ |
| 584 | |
| 585 | /** @brief Create a PLDM response message for SetBIOSTable |
| 586 | * |
| 587 | * @param[in] instance_id - Message's instance id |
| 588 | * @param[in] completion_code - PLDM completion code |
| 589 | * @param[in] next_transfer_handle - handle to identify the next portion of the |
| 590 | * transfer |
| 591 | * @param[out] msg - Message will be written to this |
| 592 | */ |
| 593 | int encode_set_bios_table_resp(uint8_t instance_id, uint8_t completion_code, |
| 594 | uint32_t next_transfer_handle, |
| 595 | struct pldm_msg *msg); |
| 596 | |
| 597 | /** @brief Decode SetBIOSTable request packet |
| 598 | * |
| 599 | * @param[in] msg - Request message |
| 600 | * @param[in] payload_length - Length of request message payload |
| 601 | * @param[out] transfer_handle - Handle to identify a BIOS table transfer |
| 602 | * @param[out] transfer_flag - Flag to indicate what part of the transfer |
| 603 | * this request represents |
| 604 | * @param[out] table_type - Indicates what table is being transferred |
| 605 | * {BIOSStringTable=0x0, BIOSAttributeTable=0x1, |
| 606 | * BIOSAttributeValueTable=0x2} |
| 607 | * @param[out] table - Struct variable_field, contains data specific to the |
| 608 | * table type and the length of table data. |
| 609 | * @return pldm_completion_codes |
| 610 | */ |
| 611 | int decode_set_bios_table_req(const struct pldm_msg *msg, size_t payload_length, |
| 612 | uint32_t *transfer_handle, uint8_t *transfer_flag, |
| 613 | uint8_t *table_type, |
| 614 | struct variable_field *table); |
| 615 | |
| 616 | #ifdef __cplusplus |
| 617 | } |
| 618 | #endif |
| 619 | |
| 620 | #endif /* BIOS_H */ |