Received: by 10.223.176.5 with SMTP id f5csp104571wra; Thu, 1 Feb 2018 16:26:44 -0800 (PST) X-Google-Smtp-Source: AH8x224EevcaFuLxrOyud4Ub1EtYQ/nyJmb91Zc7IeNhkE8OLaBKO1JxkSa80zIpm6xiXBgLcV7j X-Received: by 10.101.88.138 with SMTP id d10mr31178264pgu.52.1517531204704; Thu, 01 Feb 2018 16:26:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517531204; cv=none; d=google.com; s=arc-20160816; b=XpvYd7gd48/Ifs8hMrgvT0b020kbQRAcBiqQJAOo92SCDR8nOQuxVqC4C9KUDK+8IH h85rRbtrq3/H3QCKW+dua7C9OkBEjPVxE9bxnfELv33umKl3sFj6RjjPlltS0KHGbtxB 8VriUf63cygIr1oaiLnpMQxpdL2gyKDaB1YfAgeq4fFsEGup8YPwYv1mqUE4Nu5hXPUl AoEfBFYkkzJi5YRp/OpnMgP1ptUgmmhSeVmsSkdLYrMjvuwOEjn+zpuNvXuCc4ow0haX FqlzLEcYJj9L29vmLyFQ76X2bQPpu4VXw4Yn2ndCIg51ZrjWKTbX8Zo+ASV37qcaMNEl BCHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:reply-to:dkim-signature :arc-authentication-results; bh=eobFmH5JytXkTrmXt5mRn6/mcYlilNZ6ZDiMv7LQRRI=; b=Yji1JG8fDFzUeQEeocsMLNwVApF/7JfB5FjSAiKU6v4QgL8AKKQrBs5TSkofJjCSKD 4nv0fGYYnuaZCPC4kzZ4l06iUeg7TZ650Q2sv6vn/AEnWjUCIew0+WrsrCloXgWLYax1 4c7jolbw1bO4ikr+4lFatcgxr+Djt1NlmHRBsad13X3bbR6DTmXBSBE78lxgxmVWW4dA 3gZqMrrB92OS1UQ60GjCMdKqoBXWwEnCIns9vTEslbWdZ/sBi3I4Nh71KWe++oTiK+mP 3es105yMZwXyppGJqJYUSUN9m9A5ffF+Xcr1qL/MFMaGfLdLvZHPO2jUA7BzUCa9+3GL ovPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Qu1qFT7U; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m15-v6si670170pln.714.2018.02.01.16.26.30; Thu, 01 Feb 2018 16:26:44 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Qu1qFT7U; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751787AbeBBAZd (ORCPT + 99 others); Thu, 1 Feb 2018 19:25:33 -0500 Received: from mail-ot0-f196.google.com ([74.125.82.196]:38153 "EHLO mail-ot0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751736AbeBBAZ1 (ORCPT ); Thu, 1 Feb 2018 19:25:27 -0500 Received: by mail-ot0-f196.google.com with SMTP id v5so18721351oth.5 for ; Thu, 01 Feb 2018 16:25:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=reply-to:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=eobFmH5JytXkTrmXt5mRn6/mcYlilNZ6ZDiMv7LQRRI=; b=Qu1qFT7UWnCIfF2pj+D2klE0oz4PSYlNQGbx77veazIlxp4kPA+ECGsS3yrJ/PnTDL TNlVFzOKMO1+XsjFGcK/Rc6rak4zpUdE2nwytt6io1zdrTcBN5eKON5t1abVrUJD6AZ1 dZaNzN4kb9sLmYs+V6EF2G+NfIQwe0z/pc0RyTj8M6mLGJcDxF8yvaQ/e9nZsLX7nvU3 gTD0Q1B6oZOi2OsmeYZRuqxUlfa0b9bcbqolVNS5z/njGqUt8EZdTlvEPTu/bfmaDSkE WpVkHMv9kATQaBJ5uUASQOICWeVSmLmGHe6LYG41nlXB/WJ//4FxILTeIiH1FQXoR3RB IcCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:reply-to:subject:to:cc:references:from :message-id:date:user-agent:mime-version:in-reply-to :content-transfer-encoding:content-language; bh=eobFmH5JytXkTrmXt5mRn6/mcYlilNZ6ZDiMv7LQRRI=; b=WuyvK5/XuGb/JQ8LSOac3uEBhdcP7UvRHsMhKH2kDbc9h1p97Cszu7ZkP9GEHvbxVV SbC45js0pIglKHD3aBxQDojfwgA0Q5xPA36/23bgXIs2W+Qbf/4XDdyjaAGST0bAiwFk lLHJNIiLqYYK1P1kqw00mPxHgl5MWZ1fxY72NmZjDGEOrkBqtPks7q+UAUo48hIiSYf4 IUNCBgra9nLpHISmTlG4z330VnD1MQoU96WNju96QkItDvh/T1/YOdmpC68578+YLfmq AY03ixfJKho8/fNDMDVvlDTZTuO2A6AoJFFzGmTsQzbJtOrlVGjA1Zs0iR5Dh7IF7n4q jv0g== X-Gm-Message-State: AKwxyteKAVy9Y6ypRbOQt8EvrJTbBSJIjZ9fygZef8KJrhRVTEhZ1dst phCJqmkY9Esll2x9dmKNng== X-Received: by 10.157.51.154 with SMTP id u26mr10611246otc.119.1517531126529; Thu, 01 Feb 2018 16:25:26 -0800 (PST) Received: from [192.168.27.3] ([47.184.168.85]) by smtp.gmail.com with ESMTPSA id m9sm453963otc.5.2018.02.01.16.25.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Feb 2018 16:25:25 -0800 (PST) Reply-To: minyard@acm.org Subject: Re: [PATCH arm/aspeed/ast2500 v3 1/2] ipmi: add a KCS IPMI BMC driver To: "Wang, Haiyue" , minyard@acm.org, joel@jms.id.au, openbmc@lists.ozlabs.org, openipmi-developer@lists.sourceforge.net, linux-kernel@vger.kernel.org Cc: andriy.shevchenko@intel.com References: <1517474936-15308-1-git-send-email-haiyue.wang@linux.intel.com> <66b3a8f8-b477-6ada-5ced-944a5b67edd3@acm.org> <062c4b58-960a-5023-be75-9b7cd1163783@linux.intel.com> From: Corey Minyard Message-ID: Date: Thu, 1 Feb 2018 18:25:24 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <062c4b58-960a-5023-be75-9b7cd1163783@linux.intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-GB Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.