From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mail-bk0-f49.google.com ([209.85.214.49]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1SWNee-0002kc-9m for barebox@lists.infradead.org; Mon, 21 May 2012 08:07:48 +0000 Received: by bkwj4 with SMTP id j4so4853225bkw.36 for ; Mon, 21 May 2012 01:07:47 -0700 (PDT) From: Antony Pavlov Date: Mon, 21 May 2012 12:07:11 +0400 Message-Id: <1337587631-16650-4-git-send-email-antonynpavlov@gmail.com> In-Reply-To: <1337587631-16650-1-git-send-email-antonynpavlov@gmail.com> References: <1337587631-16650-1-git-send-email-antonynpavlov@gmail.com> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: barebox-bounces@lists.infradead.org Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [RFC 3/3] MIPS: cpuinfo: import CPU message from Linux To: barebox@lists.infradead.org Signed-off-by: Antony Pavlov --- arch/mips/lib/cpuinfo.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/arch/mips/lib/cpuinfo.c b/arch/mips/lib/cpuinfo.c index fc8fb00..71477a8 100644 --- a/arch/mips/lib/cpuinfo.c +++ b/arch/mips/lib/cpuinfo.c @@ -23,11 +23,34 @@ #include #include #include +#include + +static char *way_string[] /* __cpuinitdata */= { NULL, "direct mapped", "2-way", + "3-way", "4-way", "5-way", "6-way", "7-way", "8-way" +}; static int do_cpuinfo(int argc, char *argv[]) { - printf("CP0_PRID = 0x%08x\n", read_c0_prid()); - printf("CP0_CONFIG = 0x%08x\n", read_c0_config()); + unsigned int icache_size, dcache_size; + struct cpuinfo_mips *c = ¤t_cpu_data; + + printk(KERN_INFO "CPU revision is: %08x (%s)\n", + current_cpu_data.processor_id, __cpu_name); + + icache_size = c->icache.sets * c->icache.ways * c->icache.linesz; + dcache_size = c->dcache.sets * c->dcache.ways * c->dcache.linesz; + + printk("Primary instruction cache %ldkB, %s, %s, linesize %d bytes.\n", + icache_size >> 10, + c->icache.flags & MIPS_CACHE_VTAG ? "VIVT" : "VIPT", + way_string[c->icache.ways], c->icache.linesz); + + printk("Primary data cache %ldkB, %s, %s, %s, linesize %d bytes\n", + dcache_size >> 10, way_string[c->dcache.ways], + (c->dcache.flags & MIPS_CACHE_PINDEX) ? "PIPT" : "VIPT", + (c->dcache.flags & MIPS_CACHE_ALIASES) ? + "cache aliases" : "no aliases", + c->dcache.linesz); return 0; } -- 1.7.10 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox