From patchwork Thu Jul 22 05:15:49 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Neuling X-Patchwork-Id: 59542 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from bilbo.ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 1A205100A0C for ; Thu, 22 Jul 2010 15:15:58 +1000 (EST) Received: by ozlabs.org (Postfix) id E818CB70E3; Thu, 22 Jul 2010 15:15:49 +1000 (EST) Delivered-To: linuxppc-dev@ozlabs.org Received: from localhost.localdomain (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id D6530B70C8; Thu, 22 Jul 2010 15:15:49 +1000 (EST) Received: by localhost.localdomain (Postfix, from userid 1000) id B301AC6A1C; Thu, 22 Jul 2010 15:15:49 +1000 (EST) Received: from neuling.org (localhost [127.0.0.1]) by localhost.localdomain (Postfix) with ESMTP id AE363C5744; Thu, 22 Jul 2010 15:15:49 +1000 (EST) From: Michael Neuling To: benh@kernel.crashing.org, linuxppc-dev@ozlabs.org X-GPG-Fingerprint: 9B25 DC2A C58D 2C8D 47C2 457E 0887 E86F 32E6 BE16 MIME-Version: 1.0 Subject: [PATCH] powerpc: print cores passed to firmware in decimal X-Mailer: MH-E 8.2; nmh 1.3; GNU Emacs 23.1.1 Date: Thu, 22 Jul 2010 15:15:49 +1000 Message-ID: <4553.1279775749@neuling.org> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Currently we look pretty stupid when printing out the number of cores passed to FW Max number of cores passed to firmware: 0x0000000000000080 So I've change this to print in decimal: Max number of cores passed to firmware: 128 (NR_CPUS = 256) This required adding a prom_print_dec() function. Signed-off-by: Michael Neuling --- Anton suggested printing it in EBCDIC, but I nixed that. arch/powerpc/kernel/prom_init.c | 32 +++++++++++++++++++++++++++++--- 1 files changed, 29 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c index 3b6f8ae..4428d26 100644 --- a/arch/powerpc/kernel/prom_init.c +++ b/arch/powerpc/kernel/prom_init.c @@ -311,6 +311,27 @@ static void __init prom_print_hex(unsigned long val) call_prom("write", 3, 1, _prom->stdout, buf, nibbles); } +/* max number of decimal digits in an unsigned long */ +#define UL_DIGITS 21 +static void __init prom_print_dec(unsigned long val) +{ + int i, size; + char buf[UL_DIGITS+1]; + struct prom_t *_prom = &RELOC(prom); + + for (i = UL_DIGITS-1; i >= 0; i--) { + buf[i] = (val % 10) + '0'; + val = val/10; + if (val == 0) + break; + } + /* shift stuff down */ + size = UL_DIGITS - i; + for (i = 0 ; i < size ; i++) + buf[i] = buf[i + UL_DIGITS - size]; + buf[size+1] = '\0'; + call_prom("write", 3, 1, _prom->stdout, buf, size); +} static void __init prom_printf(const char *format, ...) { @@ -350,6 +371,11 @@ static void __init prom_printf(const char *format, ...) v = va_arg(args, unsigned long); prom_print_hex(v); break; + case 'i': + ++q; + v = va_arg(args, unsigned long); + prom_print_dec(v); + break; } } } @@ -869,12 +895,12 @@ static void __init prom_send_capabilities(void) cores = (u32 *)PTRRELOC(&ibm_architecture_vec[IBM_ARCH_VEC_NRCORES_OFFSET]); if (*cores != NR_CPUS) { prom_printf("WARNING ! " - "ibm_architecture_vec structure inconsistent: 0x%x !\n", + "ibm_architecture_vec structure inconsistent: 0x%i !\n", *cores); } else { *cores = DIV_ROUND_UP(NR_CPUS, prom_count_smt_threads()); - prom_printf("Max number of cores passed to firmware: 0x%x\n", - (unsigned long)*cores); + prom_printf("Max number of cores passed to firmware: %i (NR_CPUS = %i)\n", + *cores, NR_CPUS); } /* try calling the ibm,client-architecture-support method */