From patchwork Sat May 26 07:20:11 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 161455 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 981A9B6FA0 for ; Sat, 26 May 2012 17:20:26 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751227Ab2EZHUY (ORCPT ); Sat, 26 May 2012 03:20:24 -0400 Received: from smtp.snhosting.dk ([87.238.248.203]:54528 "EHLO smtp.domainteam.dk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751237Ab2EZHUW (ORCPT ); Sat, 26 May 2012 03:20:22 -0400 Received: from localhost.localdomain (unknown [188.228.89.252]) by smtp.domainteam.dk (Postfix) with ESMTPA id 48160F1C6A; Sat, 26 May 2012 09:20:21 +0200 (CEST) From: Sam Ravnborg To: "David S. Miller" Cc: sparclinux , Daniel Hellstrom , Konrad Eisele , Sam Ravnborg Subject: [PATCH 07/15] sparc32: handle leon in cpu.c Date: Sat, 26 May 2012 09:20:11 +0200 Message-Id: <1338016819-22245-7-git-send-email-sam@ravnborg.org> X-Mailer: git-send-email 1.6.0.6 In-Reply-To: <20120526071749.GA22144@merkur.ravnborg.org> References: <20120526071749.GA22144@merkur.ravnborg.org> Sender: sparclinux-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: sparclinux@vger.kernel.org A few hardcoded constant were replaced by symbolic versions to improve readability Signed-off-by: Sam Ravnborg Cc: Daniel Hellstrom Cc: Konrad Eisele --- arch/sparc/include/asm/psr.h | 2 ++ arch/sparc/kernel/cpu.c | 18 +++++++++--------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/arch/sparc/include/asm/psr.h b/arch/sparc/include/asm/psr.h index c02c735..cee7ed9 100644 --- a/arch/sparc/include/asm/psr.h +++ b/arch/sparc/include/asm/psr.h @@ -35,7 +35,9 @@ #define PSR_VERS 0x0f000000 /* cpu-version field */ #define PSR_IMPL 0xf0000000 /* cpu-implementation field */ +#define PSR_VERS_SHIFT 24 #define PSR_IMPL_SHIFT 28 +#define PSR_VERS_SHIFTED_MASK 0xf #define PSR_IMPL_SHIFTED_MASK 0xf #define PSR_IMPL_TI 0x4 diff --git a/arch/sparc/kernel/cpu.c b/arch/sparc/kernel/cpu.c index 2d18196..a6c94a2 100644 --- a/arch/sparc/kernel/cpu.c +++ b/arch/sparc/kernel/cpu.c @@ -121,7 +121,7 @@ static const struct manufacturer_info __initconst manufacturer_info[] = { FPU(-1, NULL) } },{ - 4, + PSR_IMPL_TI, .cpu_info = { CPU(0, "Texas Instruments, Inc. - SuperSparc-(II)"), /* SparcClassic -- borned STP1010TAB-50*/ @@ -191,7 +191,7 @@ static const struct manufacturer_info __initconst manufacturer_info[] = { FPU(-1, NULL) } },{ - 0xF, /* Aeroflex Gaisler */ + PSR_IMPL_LEON, /* Aeroflex Gaisler */ .cpu_info = { CPU(3, "LEON"), CPU(-1, NULL) @@ -440,16 +440,16 @@ static int __init cpu_type_probe(void) int psr_impl, psr_vers, fpu_vers; int psr; - psr_impl = ((get_psr() >> 28) & 0xf); - psr_vers = ((get_psr() >> 24) & 0xf); + psr_impl = ((get_psr() >> PSR_IMPL_SHIFT) & PSR_IMPL_SHIFTED_MASK); + psr_vers = ((get_psr() >> PSR_VERS_SHIFT) & PSR_VERS_SHIFTED_MASK); psr = get_psr(); put_psr(psr | PSR_EF); -#ifdef CONFIG_SPARC_LEON - fpu_vers = get_psr() & PSR_EF ? ((get_fsr() >> 17) & 0x7) : 7; -#else - fpu_vers = ((get_fsr() >> 17) & 0x7); -#endif + + if (psr_impl == PSR_IMPL_LEON) + fpu_vers = get_psr() & PSR_EF ? ((get_fsr() >> 17) & 0x7) : 7; + else + fpu_vers = ((get_fsr() >> 17) & 0x7); put_psr(psr);