From patchwork Thu Oct 1 07:08:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 1374880 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4C247M4rk3z9sVN for ; Thu, 1 Oct 2020 17:11:59 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=ozlabs.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.a=rsa-sha256 header.s=201707 header.b=F3tbtg+N; 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 4C247M2vBbzDqVS for ; Thu, 1 Oct 2020 17:11:59 +1000 (AEST) X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Received: from ozlabs.org (bilbo.ozlabs.org [203.11.71.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4C247G3ynrzDqTR for ; Thu, 1 Oct 2020 17:11:54 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.a=rsa-sha256 header.s=201707 header.b=F3tbtg+N; dkim-atps=neutral Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (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 mail.ozlabs.org (Postfix) with ESMTPSA id 4C24795yqnz9sVT; Thu, 1 Oct 2020 17:11:49 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1601536314; bh=KcEIBZBBGB9tj9417fgh+hPlNqK/hfF20M65+PMywLI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F3tbtg+NTnd54TSIO6n7ChPx1NLCvXzGZBnJSLeVM4rSr0NZNOJ2hLsbm4uWLKA7p MQvrTb2LS/zPI/6BoNuOhaOpqCbguyUJPR/k+lUkpR20VL7djKuQsbqkAyNMq+CZgi RcqQ+eozOXopDQf2TeI5OisZOoT8q7spj4uzFX1eAcpEOyfsekj/leVSQ39cnU2bC7 uu2lcqniULIYBZRqRkrAtItS6qYisLumd4W2MXuk4OmVV0C+LwB2Uq7O/Qi1uX57RX r3syH+HVje2TKz38xYaM1VrTR6f5iInr5VUqs+irvvZ3B4x2k2j9SEnTD8Syly+YwS poDYCnzxYxEUQ== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Thu, 1 Oct 2020 17:08:08 +1000 Message-Id: <20201001070814.102735-15-amitay@ozlabs.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201001070814.102735-1-amitay@ozlabs.org> References: <20201001070814.102735-1-amitay@ozlabs.org> MIME-Version: 1.0 Subject: [Pdbg] [PATCH v2 14/20] libsbefifo: Use proper cast X-BeenThere: pdbg@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "mailing list for https://github.com/open-power/pdbg development" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Amitay Isaacs Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" Signed-off-by: Amitay Isaacs Reviewed-by: Joel Stanley --- libsbefifo/cmd_control.c | 2 +- libsbefifo/cmd_scom.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/libsbefifo/cmd_control.c b/libsbefifo/cmd_control.c index 4826b5d..e64f555 100644 --- a/libsbefifo/cmd_control.c +++ b/libsbefifo/cmd_control.c @@ -36,7 +36,7 @@ static int sbefifo_istep_execute_push(uint8_t major, uint8_t minor, uint8_t **bu cmd = SBEFIFO_CMD_CLASS_CONTROL | SBEFIFO_CMD_EXECUTE_ISTEP; - step = (major << 16) | minor; + step = ((uint32_t)major << 16) | (uint32_t)minor; msg[0] = htobe32(nwords); msg[1] = htobe32(cmd); diff --git a/libsbefifo/cmd_scom.c b/libsbefifo/cmd_scom.c index 935a00f..db8214d 100644 --- a/libsbefifo/cmd_scom.c +++ b/libsbefifo/cmd_scom.c @@ -139,7 +139,7 @@ int sbefifo_scom_put(struct sbefifo_context *sctx, uint64_t addr, uint64_t value static int sbefifo_scom_modify_push(uint64_t addr, uint64_t value, uint8_t operand, uint8_t **buf, uint32_t *buflen) { uint32_t *msg; - uint32_t nwords, cmd; + uint32_t nwords, cmd, oper; nwords = 7; *buflen = nwords * sizeof(uint32_t); @@ -149,9 +149,11 @@ static int sbefifo_scom_modify_push(uint64_t addr, uint64_t value, uint8_t opera cmd = SBEFIFO_CMD_CLASS_SCOM | SBEFIFO_CMD_MODIFY_SCOM; + oper = (uint32_t)operand; + msg[0] = htobe32(nwords); msg[1] = htobe32(cmd); - msg[2] = htobe32(operand); + msg[2] = htobe32(oper); msg[3] = htobe32(addr >> 32); msg[4] = htobe32(addr & 0xffffffff); msg[5] = htobe32(value >> 32);