fby4: sd: Initial commit for yv4-sd pdr implementation#1304
Conversation
|
@facebook-github-bot has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
| @@ -0,0 +1,326 @@ | |||
| /* | |||
There was a problem hiding this comment.
The mctp code seems to be generic and better to keep it in common layer, so other platforms can also use it.
There was a problem hiding this comment.
It is a lot more complicate to put the code in common layer, since every platform is using the same common code. We need to make sure that ongoing projects won't be affected. Therefore, we plan to put this on platform like other project in this stage.
There was a problem hiding this comment.
@PeterHo-wiwynn can you move it to common and change meta-facebook/gt-cc/src/platform/plat_mctp.c as well. I can help with testing GTT/GTI which are the only other platforms which use this.
Preferably I would like to see plat_*.c contain just configuration data structures not functions which do actions.
There was a problem hiding this comment.
Sure, I will move it to common. However, there are still some functions which implemented differently between platforms. I will try to move the functions doing same behavior, and list the others for disscusion.
| } | ||
|
|
||
| static void set_endpoint_resp_handler(void *args, uint8_t *buf, uint16_t len) | ||
| { |
There was a problem hiding this comment.
The API is not setting any resp_handler as suggested by name or are you going to populate this in next commit? If so, better to leave a TODO for indications.
There was a problem hiding this comment.
It doesn't set device endpoint in this commit. I leaved a TODO for indication.
|
|
||
| static void set_endpoint_resp_timeout(void *args) | ||
| { | ||
| CHECK_NULL_ARG(args); |
There was a problem hiding this comment.
The API is not setting any timeout or are you going to populate it in next commit? If so, better to leave a TODO for indications.
There was a problem hiding this comment.
It doesn't set device endpoint in this commit. I leaved a TODO for indication.
| msg.timeout_cb_fn = set_endpoint_resp_timeout; | ||
| msg.timeout_cb_fn_args = p; | ||
|
|
||
| mctp_ctrl_send_msg(find_mctp_by_smbus(p->bus), &msg); |
There was a problem hiding this comment.
Is mctp_ctrl_send_msg NULL safe for in_arg?
There was a problem hiding this comment.
It will check the input args.
https://github.com/facebook/OpenBIC/blob/main/common/service/mctp/mctp_ctrl.c#L276
|
|
||
| switch (msg_type) { | ||
| case MCTP_MSG_TYPE_CTRL: | ||
| LOG_ERR("type: mctp_ctrl"); |
There was a problem hiding this comment.
LOG_INFO or DEBUG rather than LOG_ERR?
There was a problem hiding this comment.
Sorry, it was supposed to be delete.
| medium_type = MCTP_MEDIUM_TYPE_SMBUS; | ||
| break; | ||
| default: | ||
| medium_type = -1; |
| target = I2C_BUS_BMC; | ||
| break; | ||
| default: | ||
| target = -1; |
|
|
||
| uint8_t rc = mctp_set_medium_configure(p->mctp_inst, MCTP_MEDIUM_TYPE_SMBUS, p->conf); | ||
| if (rc != MCTP_SUCCESS) { | ||
| LOG_INF("mctp set medium configure failed"); |
|
|
||
| mctp_reg_msg_rx_func(p->mctp_inst, mctp_msg_recv); | ||
|
|
||
| ret = mctp_start(p->mctp_inst); |
There was a problem hiding this comment.
Better to print some error if start fails?
There was a problem hiding this comment.
The mctp_start will print error itself.
https://github.com/facebook/OpenBIC/blob/main/common/service/mctp/mctp.c#L481
| #define MAX_SENSOR_SIZE 60 | ||
|
|
||
| uint8_t plat_get_pdr_size(); | ||
| void load_pdr_table(void); |
There was a problem hiding this comment.
Better to use consistent plat_ prefix (if possible, i.e. doesn't involve much change in other places).
f6e9b46 to
4a5c066
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. |
4a5c066 to
c2660f6
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. |
c2660f6 to
6b59787
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. |
6b59787 to
4f3d950
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
- Support pldm over mctp over i2c on yv4-sd.
- Add platform code for pdr implementation.
Motivation
For implementing sensor monitoring, the BMC should get sensor information from the BIC.
Test Plan:
- Build code: Pass
- Add some PDR samples in BIC 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
}
]
4f3d950 to
cb45878
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 77ab5fd. |
Description
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
}
]