From patchwork Thu Oct 17 10:05:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Polyakov X-Patchwork-Id: 1178439 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46v4YJ07Rkz9sPJ for ; Thu, 17 Oct 2019 21:05:40 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=yadro.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=yadro.com header.i=@yadro.com header.b="dG0KNH2G"; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 46v4YH5MYvzDrGp for ; Thu, 17 Oct 2019 21:05:39 +1100 (AEDT) X-Original-To: petitboot@lists.ozlabs.org Delivered-To: petitboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=yadro.com (client-ip=89.207.88.252; helo=mta-01.yadro.com; envelope-from=m.polyakov@yadro.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=yadro.com Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=yadro.com header.i=@yadro.com header.b="dG0KNH2G"; dkim-atps=neutral Received: from mta-01.yadro.com (mta-02.yadro.com [89.207.88.252]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 46v4Y84DSFzDrDg for ; Thu, 17 Oct 2019 21:05:29 +1100 (AEDT) Received: from localhost (unknown [127.0.0.1]) by mta-01.yadro.com (Postfix) with ESMTP id E6BF842F14; Thu, 17 Oct 2019 10:05:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yadro.com; h= user-agent:content-disposition:content-type:content-type :mime-version:message-id:subject:subject:from:from:date:date :received:received:received; s=mta-01; t=1571306723; x= 1573121124; bh=jKu7exXujQNyQGHqYA30kszx9oPt918RnvbplF7fc24=; b=d G0KNH2GO6+pK0OKUXQoAc4c/YN/oO6PEDMe/HDOOTh7tryzBZZ5hQZNaaa+aQDjE MexBEiWiL3vLDnq6OfUXvgu/6hooh6Y6kbjDTBu8JABVAF+qcu0qMFQvSBPjpJVR 4Wbzyfydc/+dJUGWAtcOE803WWIPuDO1VD/WvfaSRQ= X-Virus-Scanned: amavisd-new at yadro.com Received: from mta-01.yadro.com ([127.0.0.1]) by localhost (mta-01.yadro.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id w2oEeMKJf5cy; Thu, 17 Oct 2019 13:05:23 +0300 (MSK) Received: from T-EXCH-02.corp.yadro.com (t-exch-02.corp.yadro.com [172.17.10.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mta-01.yadro.com (Postfix) with ESMTPS id 9AB484122E; Thu, 17 Oct 2019 13:05:23 +0300 (MSK) Received: from localhost (172.17.15.1) by T-EXCH-02.corp.yadro.com (172.17.10.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.32; Thu, 17 Oct 2019 13:05:22 +0300 Date: Thu, 17 Oct 2019 13:05:22 +0300 From: Maxim Polyakov To: Jeremy Kerr , , Maxim Polyakov Subject: [PATCH v3 1/5] discover/platform-powerpc: add missing mbox block selector Message-ID: <20191017100521.GA6611@gmail.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-Originating-IP: [172.17.15.1] X-ClientProxiedBy: T-EXCH-01.corp.yadro.com (172.17.10.101) To T-EXCH-02.corp.yadro.com (172.17.10.102) X-BeenThere: petitboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Petitboot bootloader development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: petitboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Petitboot" According to IPMI Specification, in the IPMI response message with boot initiator mailbox information block, byte 4 should be used as the block selector (1). However, this parameter isn`t taken into account in the code and bytes 4-6 in the block 0 are defined as the IANA enterprise ID number. Thus, IANA contains an invalid value and doesn`t match the IBM ID. For this reason, the get_ipmi_boot_mailbox() procedure fails with error and the boot options from mailbox doesn`t apply. /var/log/petitboot/pb-discover.log: IANA number unrecognised: 0x00:0x02:0x00 This patch adds the missing block selector parameter. It has been tested on the YADRO Vesnin P8 Server with the Openbmc [1] page 398, IPMI Specification v2.0, Revision 1.1, October 1, 2013 Signed-off-by: Maxim Polyakov --- discover/platform-powerpc.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/discover/platform-powerpc.c b/discover/platform-powerpc.c index 5d7cc59..6651e3f 100644 --- a/discover/platform-powerpc.c +++ b/discover/platform-powerpc.c @@ -440,7 +440,7 @@ static int get_ipmi_boot_mailbox_block(struct platform_powerpc *platform, char *buf, uint8_t block) { size_t blocksize = 16; - uint8_t resp[3 + 16]; + uint8_t resp[3 + 1 + 16]; uint16_t resp_len; char *debug_buf; int rc; @@ -462,7 +462,7 @@ static int get_ipmi_boot_mailbox_block(struct platform_powerpc *platform, } if (resp_len < sizeof(resp)) { - if (resp_len < 3) { + if (resp_len < 4) { pb_log("platform: unexpected length (%d) in " "boot options mailbox response\n", resp_len); @@ -474,7 +474,7 @@ static int get_ipmi_boot_mailbox_block(struct platform_powerpc *platform, return 0; } - blocksize = sizeof(resp) - 3; + blocksize = sizeof(resp) - 4; pb_debug_fn("Mailbox block %hu returns only %zu bytes in block\n", block, blocksize); } @@ -502,7 +502,14 @@ static int get_ipmi_boot_mailbox_block(struct platform_powerpc *platform, return -1; } - memcpy(buf, &resp[3], blocksize); + /* check for block number */ + if (resp[3] != block) { + pb_debug("platform: returned boot mailbox block doesn't match " + "requested\n"); + return -1; + } + + memcpy(buf, &resp[4], blocksize); return blocksize; }