From patchwork Thu Mar 27 05:20:56 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Blanchard X-Patchwork-Id: 334221 X-Patchwork-Delegate: benh@kernel.crashing.org Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [IPv6:::1]) by ozlabs.org (Postfix) with ESMTP id 2D856141496 for ; Thu, 27 Mar 2014 16:21:31 +1100 (EST) Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPSA id 2549B1413C8; Thu, 27 Mar 2014 16:20:52 +1100 (EST) Date: Thu, 27 Mar 2014 16:20:56 +1100 From: Anton Blanchard To: stewart@linux.vnet.ibm.com, benh@kernel.crashing.org, paulus@samba.org Subject: [PATCH 4/4] powerpc/powernv: Fix little endian issues OPAL error log code Message-ID: <20140327162056.5a57c4c9@kryten> In-Reply-To: <20140327161849.791432d0@kryten> References: <20140327161849.791432d0@kryten> X-Mailer: Claws Mail 3.8.1 (GTK+ 2.24.20; x86_64-pc-linux-gnu) Mime-Version: 1.0 Cc: linuxppc-dev@lists.ozlabs.org X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Fix little endian issues with the OPAL error log code. Signed-off-by: Anton Blanchard Reviewed-by: Stewart Smith Index: b/arch/powerpc/platforms/powernv/opal-elog.c =================================================================== --- a/arch/powerpc/platforms/powernv/opal-elog.c +++ b/arch/powerpc/platforms/powernv/opal-elog.c @@ -243,18 +243,25 @@ static struct elog_obj *create_elog_obj( static void elog_work_fn(struct work_struct *work) { + __be64 size; + __be64 id; + __be64 type; uint64_t elog_size; uint64_t log_id; uint64_t elog_type; int rc; char name[2+16+1]; - rc = opal_get_elog_size(&log_id, &elog_size, &elog_type); + rc = opal_get_elog_size(&id, &size, &type); if (rc != OPAL_SUCCESS) { pr_err("ELOG: Opal log read failed\n"); return; } + elog_size = be64_to_cpu(size); + log_id = be64_to_cpu(id); + elog_type = be64_to_cpu(type); + BUG_ON(elog_size > OPAL_MAX_ERRLOG_SIZE); if (elog_size >= OPAL_MAX_ERRLOG_SIZE) Index: b/arch/powerpc/include/asm/opal.h =================================================================== --- a/arch/powerpc/include/asm/opal.h +++ b/arch/powerpc/include/asm/opal.h @@ -851,7 +851,7 @@ int64_t opal_lpc_read(uint32_t chip_id, uint32_t addr, __be32 *data, uint32_t sz); int64_t opal_read_elog(uint64_t buffer, uint64_t size, uint64_t log_id); -int64_t opal_get_elog_size(uint64_t *log_id, uint64_t *size, uint64_t *elog_type); +int64_t opal_get_elog_size(__be64 *log_id, __be64 *size, __be64 *elog_type); int64_t opal_write_elog(uint64_t buffer, uint64_t size, uint64_t offset); int64_t opal_send_ack_elog(uint64_t log_id); void opal_resend_pending_logs(void);