Re: [PATCH arm/aspeed/ast2500 v3 1/2] ipmi: add a KCS IPMI BMC driver

From: Corey Minyard
Date: Thu Feb 01 2018 - 19:25:36 EST


On 02/01/2018 05:56 PM, Wang, Haiyue wrote:


On 2018-02-02 04:32, Corey Minyard wrote:
+static void kcs_bmc_handle_cmd(struct kcs_bmc *kcs_bmc)
+{
+ÂÂÂ u8 cmd;
+
+ÂÂÂ set_state(kcs_bmc, WRITE_STATE);
+ÂÂÂ write_data(kcs_bmc, KCS_ZERO_DATA);
+
+ÂÂÂ cmd = read_data(kcs_bmc);
+ÂÂÂ switch (cmd) {
+ÂÂÂ case KCS_CMD_WRITE_START:
+ÂÂÂÂÂÂÂ if (kcs_bmc->phase != KCS_PHASE_IDLE &&
+ÂÂÂÂÂÂÂÂÂÂÂ kcs_bmc->phase != KCS_PHASE_ERROR) {
+ÂÂÂÂÂÂÂÂÂÂÂ kcs_force_abort(kcs_bmc);
+ÂÂÂÂÂÂÂÂÂÂÂ break;
+ÂÂÂÂÂÂÂ }
+

The spec says you can do a write start basically any time and the state machine starts over. I know I kind of went back and forth on this in my previous email, but what you had before is correct, I think.

So change it to the bellowing code is OK now? :-)

+ÂÂÂ case KCS_CMD_WRITE_START:
+ÂÂÂÂÂÂÂ kcs_bmc->data_in_avail = false;
+ÂÂÂÂÂÂÂ kcs_bmc->data_in_idxÂÂ = 0;
+ÂÂÂÂÂÂÂ kcs_bmc->phaseÂÂÂÂÂÂÂÂ = KCS_PHASE_WRITE;
+ÂÂÂÂÂÂÂ kcs_bmc->errorÂÂÂÂÂÂÂÂ = KCS_NO_ERROR;
+ÂÂÂÂÂÂÂ break;

Yes, that should be good. Sorry about the confusion.