From patchwork Wed Jun 14 04:11:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Mendoza-Jonas X-Patchwork-Id: 775591 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.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wnY990Y0dz9s7t for ; Wed, 14 Jun 2017 14:11:25 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=mendozajonas.com header.i=@mendozajonas.com header.b="mhtDhkrn"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3wnY986H8VzDqLM for ; Wed, 14 Jun 2017 14:11:24 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=mendozajonas.com header.i=@mendozajonas.com header.b="mhtDhkrn"; dkim-atps=neutral X-Original-To: petitboot@lists.ozlabs.org Delivered-To: petitboot@lists.ozlabs.org Received: from mendozajonas.com (mendozajonas.com [188.166.185.233]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3wnY926xSpzDqKy for ; Wed, 14 Jun 2017 14:11:18 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=mendozajonas.com header.i=@mendozajonas.com header.b="mhtDhkrn"; dkim-atps=neutral Received: from v4.ozlabs.ibm.com (unknown [122.99.82.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: sam@mendozajonas.com) by mendozajonas.com (Postfix) with ESMTPSA id D8DB1143FC8; Wed, 14 Jun 2017 12:11:13 +0800 (SGT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mendozajonas.com; s=mail; t=1497413474; bh=lYTz09EmQqkRqsJulRR+QDdTFomwnrhz0Mh4aUFdnNU=; h=From:To:Cc:Subject:Date:From; b=mhtDhkrnTcBfp6KVy56G2ZMLYMKq6YVe3sT346ZJoBsb50HBErJgL1ANmfov6M/ch PamsX5OXIuDftWgkxs0pZmVgIdvTWM3Y5RRlujfzSvKVp+/xNjjvh2zpypftcN1RhB 0oqLaF6bp9jVryFDDvfisebNbcQXsx77rXD8E1mE= From: Samuel Mendoza-Jonas To: petitboot@lists.ozlabs.org Subject: [PATCH] discover/platform-powerpc: Handle optional Get Device ID section Date: Wed, 14 Jun 2017 14:11:07 +1000 Message-Id: <20170614041107.22333-1-sam@mendozajonas.com> X-Mailer: git-send-email 2.13.1 X-BeenThere: petitboot@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Petitboot bootloader development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Samuel Mendoza-Jonas MIME-Version: 1.0 Errors-To: petitboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Petitboot" The 'auxiliary' section of the 'Get Device ID' response is optional, and some platforms exclude it from the response entirely. However Petitboot only recognises the response as valid if it includes the full 16 bytes. Update get_ipmi_bmc_versions() to also handle responses of only 12 bytes. Signed-off-by: Samuel Mendoza-Jonas --- discover/platform-powerpc.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/discover/platform-powerpc.c b/discover/platform-powerpc.c index c2e2233..1426078 100644 --- a/discover/platform-powerpc.c +++ b/discover/platform-powerpc.c @@ -1050,7 +1050,7 @@ static void get_ipmi_bmc_versions(struct platform *p, struct system_info *info) pb_debug("\n"); } - if (rc == 0 && resp_len == 16) { + if (rc == 0 && (resp_len == 12 || resp_len == 16)) { info->bmc_current = talloc_array(info, char *, 4); info->n_bmc_current = 4; @@ -1062,9 +1062,13 @@ static void get_ipmi_bmc_versions(struct platform *p, struct system_info *info) bcd += 10 * (resp[4] >> 4); /* rev1.rev2.aux_revision */ info->bmc_current[2] = talloc_asprintf(info, - "Firmware version: %u.%02u.%x%x%x%x", - resp[3], bcd, resp[12], - resp[13], resp[14], resp[15]); + "Firmware version: %u.%02u", + resp[3], bcd); + if (resp_len == 16) { + info->bmc_current[2] = talloc_asprintf_append( + info->bmc_current[2], ".%x%x%x%x", + resp[12], resp[13], resp[14], resp[15]); + } bcd = resp[5] & 0x0f; bcd += 10 * (resp[5] >> 4); info->bmc_current[3] = talloc_asprintf(info, "IPMI version: %u", @@ -1089,7 +1093,7 @@ static void get_ipmi_bmc_versions(struct platform *p, struct system_info *info) pb_debug("\n"); } - if (rc == 0 && resp_len == 16) { + if (rc == 0 && (resp_len == 12 || resp_len == 16)) { info->bmc_golden = talloc_array(info, char *, 4); info->n_bmc_golden = 4; @@ -1101,9 +1105,13 @@ static void get_ipmi_bmc_versions(struct platform *p, struct system_info *info) bcd += 10 * (resp[4] >> 4); /* rev1.rev2.aux_revision */ info->bmc_golden[2] = talloc_asprintf(info, - "Firmware version: %u.%02u.%x%x%x%x", - resp[3], bcd, resp[12], - resp[13], resp[14], resp[15]); + "Firmware version: %u.%02u", + resp[3], bcd); + if (resp_len == 16) { + info->bmc_golden[2] = talloc_asprintf_append( + info->bmc_golden[2], ".%x%x%x%x", + resp[12], resp[13], resp[14], resp[15]); + } bcd = resp[5] & 0x0f; bcd += 10 * (resp[5] >> 4); info->bmc_golden[3] = talloc_asprintf(info, "IPMI version: %u",