common: service: support PLDM get PDR handler#1303
Conversation
|
@facebook-github-bot has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
| uint32_t next_data_transfer_handle; | ||
| uint8_t transfer_flag; | ||
| uint16_t response_count; | ||
| uint8_t record_data[108]; |
There was a problem hiding this comment.
Can you please do #define for size.
| struct pldm_get_pdr_info_resp { | ||
| uint8_t completion_code; | ||
| uint8_t repository_state; | ||
| uint8_t update_time[13]; |
There was a problem hiding this comment.
Can you please do #define for size.
| uint8_t completion_code; | ||
| uint8_t repository_state; | ||
| uint8_t update_time[13]; | ||
| uint8_t oem_update_time[13]; |
There was a problem hiding this comment.
Can you please do #define for size.
| #include <stdbool.h> | ||
| #include <stdint.h> | ||
|
|
||
| extern uint32_t pdr_count; |
There was a problem hiding this comment.
Any specific reason you want to expose these extern vars rather than using an API? I already see an API with name plat_get_pdr_size, better to expose that, rather defining extern vars being used outside which impacts code readability and maintainability.
Same goes for other extern vars defined in file.
There was a problem hiding this comment.
Since some vars need to be initialized in platform layer, the vars are declared as extern variable for platform code to access.
There was a problem hiding this comment.
My suggestion is to define get , set APIs rather than externs. With extern vars the code browsing is hard.
| extern PDR_numeric_sensor plat_pdr_table[]; | ||
| extern const int PDR_TABLE_SIZE; | ||
|
|
||
| uint32_t pdr_count = 0; |
There was a problem hiding this comment.
Can pdr_count and pdr_config_size have different values or always same?
There was a problem hiding this comment.
The pdr_config_size was planned to be another sensor config table size. Since we are not having sensor config table for PDR, I deleted it in this commit.
| if (numeric_sensor_table != NULL) { | ||
| pdr_init(); | ||
| } else { | ||
| LOG_ERR("numeric_sensor_table == NULL"); |
There was a problem hiding this comment.
Do you want to continue on failure?
There was a problem hiding this comment.
Most platforms don't have PDR table now, so we make this continue on failure. We plan to implement another sensor service for PLDM PDR sensors. I leaved a TODO for indication.
01f1c8d to
60d54cb
Compare
|
@BonnieLo has updated the pull request. You must reimport the pull request before landing. |
|
@facebook-github-bot has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
60d54cb to
0d86508
Compare
|
@BonnieLo has updated the pull request. You must reimport the pull request before landing. |
|
@facebook-github-bot has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Summary:
Description
Implement pldm get pdr info and get pdr handler.
Motivation
For implementing sensor monitoring, the BMC should get sensor information from the BIC.
Test Plan:
- Build code: Pass
- Add some PDR samples on platform and BMC get pdr from BIC: Pass
Log:
Get PDR info:
pldmtool raw -m 8 -d 0x80 0x02 0x50
pldmtool: Tx: 80 02 50
pldmtool: Rx: 00 02 50 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 03 00 00 00 44 01 00 00 6c 00 00 00 00
Get PDR:
pldmtool platform GetPDR -m 8 -a -v
[
pldmtool: Tx: 80 02 51 00 00 00 00 00 00 00 00 01 ff ff 00 00
Success in creating the socket : RC = 4
Write to socket successful : RC = 16
Total length:123
pldmtool: Rx: 00 02 51 00 01 00 00 00 00 00 00 00 05 6c 00 00 00 00 00 01 02 00 00 60 00 00 00 00 10 20 00 01 88 00 10 00
00 00 00 05 00 00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3f 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 04 7f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0d 00 90 08 0a 00 00 20 0a 00 a0 0d 0a 00 b0 1b 0e 00 4d
01 0a 00 5b 00
{
"nextRecordHandle": 1,
"responseCount": 108,
"recordHandle": 0,
"PDRHeaderVersion": 1,
"PDRType": "Numeric Sensor PDR",
"recordChangeNumber": 0,
"dataLength": 96
}
,pldmtool: Tx: 81 02 51 01 00 00 00 00 00 00 00 01 ff ff 00 00
Success in creating the socket : RC = 4
Write to socket successful : RC = 16
Total length:123
pldmtool: Rx: 01 02 51 00 02 00 00 00 00 00 00 00 05 6c 00 01 00 00 00 01 02 00 00 60 00 00 00 00 10 2d 00 01 88 00 10 00
00 00 00 05 00 00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 06 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 04 7f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 6e 03 01 00 ca 02 01 00 80 03 01 00 89 02 01 00 02 00 02
00 04 00 00 00
{
"nextRecordHandle": 2,
"responseCount": 108,
"recordHandle": 1,
"PDRHeaderVersion": 1,
"PDRType": "Numeric Sensor PDR",
"recordChangeNumber": 0,
"dataLength": 96
}
,pldmtool: Tx: 82 02 51 02 00 00 00 00 00 00 00 01 ff ff 00 00
Success in creating the socket : RC = 4
Write to socket successful : RC = 16
Total length:123
pldmtool: Rx: 02 02 51 00 00 00 00 00 00 00 00 00 05 6c 00 02 00 00 00 01 02 00 00 60 00 00 00 00 10 01 00 01 88 00 10 00
00 00 00 02 00 00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 06 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 04 29 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 34 00 00 00 96
00 00 00 00 00
{
"nextRecordHandle": 0,
"responseCount": 108,
"recordHandle": 2,
"PDRHeaderVersion": 1,
"PDRType": "Numeric Sensor PDR",
"recordChangeNumber": 0,
"dataLength": 96
}
]
0d86508 to
c0ee0c1
Compare
|
@BonnieLo has updated the pull request. You must reimport the pull request before landing. |
|
@facebook-github-bot has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
|
This pull request has been merged in 3ed7191. |
Summary:
Description
Implement pldm get pdr info and get pdr handler.
Motivation
For implementing sensor monitoring, the BMC should get sensor information from the BIC.
Test Plan:
Log:
Get PDR info:
pldmtool raw -m 8 -d 0x80 0x02 0x50
pldmtool: Tx: 80 02 50
pldmtool: Rx: 00 02 50 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 03 00 00 00 44 01 00 00 6c 00 00 00 00
Get PDR:
pldmtool platform GetPDR -m 8 -a -v
[
pldmtool: Tx: 80 02 51 00 00 00 00 00 00 00 00 01 ff ff 00 00 Success in creating the socket : RC = 4
Write to socket successful : RC = 16
Total length:123
pldmtool: Rx: 00 02 51 00 01 00 00 00 00 00 00 00 05 6c 00 00 00 00 00 01 02 00 00 60 00 00 00 00 10 20 00 01 88 00 10 00 00 00 00 05 00 00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 7f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0d 00 90 08 0a 00 00 20 0a 00 a0 0d 0a 00 b0 1b 0e 00 4d 01 0a 00 5b 00
{
"nextRecordHandle": 1,
"responseCount": 108,
"recordHandle": 0,
"PDRHeaderVersion": 1,
"PDRType": "Numeric Sensor PDR",
"recordChangeNumber": 0,
"dataLength": 96
}
,pldmtool: Tx: 81 02 51 01 00 00 00 00 00 00 00 01 ff ff 00 00 Success in creating the socket : RC = 4
Write to socket successful : RC = 16
Total length:123
pldmtool: Rx: 01 02 51 00 02 00 00 00 00 00 00 00 05 6c 00 01 00 00 00 01 02 00 00 60 00 00 00 00 10 2d 00 01 88 00 10 00 00 00 00 05 00 00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 7f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 6e 03 01 00 ca 02 01 00 80 03 01 00 89 02 01 00 02 00 02 00 04 00 00 00
{
"nextRecordHandle": 2,
"responseCount": 108,
"recordHandle": 1,
"PDRHeaderVersion": 1,
"PDRType": "Numeric Sensor PDR",
"recordChangeNumber": 0,
"dataLength": 96
}
,pldmtool: Tx: 82 02 51 02 00 00 00 00 00 00 00 01 ff ff 00 00 Success in creating the socket : RC = 4
Write to socket successful : RC = 16
Total length:123
pldmtool: Rx: 02 02 51 00 00 00 00 00 00 00 00 00 05 6c 00 02 00 00 00 01 02 00 00 60 00 00 00 00 10 01 00 01 88 00 10 00 00 00 00 02 00 00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 29 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 34 00 00 00 96 00 00 00 00 00
{
"nextRecordHandle": 0,
"responseCount": 108,
"recordHandle": 2,
"PDRHeaderVersion": 1,
"PDRType": "Numeric Sensor PDR",
"recordChangeNumber": 0,
"dataLength": 96
}
]