From: James S. <jsi...@us...> - 2001-12-26 17:28:14
|
Update of /cvsroot/linuxconsole/ruby/linux/arch/ia64/kernel In directory usw-pr-cvs1:/tmp/cvs-serv5113/arch/ia64/kernel Modified Files: setup.c Log Message: Synced to 2.5.0. Don't use. The default 2.5.0 has a nasty bug in it. Index: setup.c =================================================================== RCS file: /cvsroot/linuxconsole/ruby/linux/arch/ia64/kernel/setup.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- setup.c 2001/09/09 16:36:33 1.2 +++ setup.c 2001/12/26 17:28:11 1.3 @@ -2,12 +2,13 @@ * Architecture-specific setup. * * Copyright (C) 1998-2001 Hewlett-Packard Co - * Copyright (C) 1998-2001 David Mosberger-Tang <da...@hp...> + * David Mosberger-Tang <da...@hp...> * Copyright (C) 1998, 1999, 2001 Stephane Eranian <er...@hp...> * Copyright (C) 2000, Rohit Seth <roh...@in...> * Copyright (C) 1999 VA Linux Systems * Copyright (C) 1999 Walt Drummond <dru...@va...> * + * 11/12/01 D.Mosberger Convert get_cpuinfo() to seq_file based show_cpuinfo(). * 04/04/00 D.Mosberger renamed cpu_initialized to cpu_online_map * 03/31/00 R.Seth cpu_initialized and current->processor fixes * 02/04/00 D.Mosberger some more get_cpuinfo fixes... @@ -23,6 +24,7 @@ #include <linux/kernel.h> #include <linux/reboot.h> #include <linux/sched.h> +#include <linux/seq_file.h> #include <linux/string.h> #include <linux/threads.h> @@ -355,61 +357,89 @@ /* * Display cpu info for all cpu's. */ -int -get_cpuinfo (char *buffer) +static int +show_cpuinfo (struct seq_file *m, void *v) { #ifdef CONFIG_SMP # define lpj c->loops_per_jiffy #else # define lpj loops_per_jiffy #endif - char family[32], features[128], *cp, *p = buffer; - struct cpuinfo_ia64 *c; - unsigned long mask, cpu; + char family[32], features[128], *cp; + struct cpuinfo_ia64 *c = v; + unsigned long mask, cpu = c - cpu_data(0); - for (cpu = 0; cpu < smp_num_cpus; ++cpu) { - c = cpu_data(cpu); - mask = c->features; +#ifdef CONFIG_SMP + if (!(cpu_online_map & (1 << cpu))) + return 0; +#endif - switch (c->family) { - case 0x07: memcpy(family, "Itanium", 8); break; - case 0x1f: memcpy(family, "McKinley", 9); break; - default: sprintf(family, "%u", c->family); break; - } + mask = c->features; - /* build the feature string: */ - memcpy(features, " standard", 10); - cp = features; - if (mask & 1) { - strcpy(cp, " branchlong"); - cp = strchr(cp, '\0'); - mask &= ~1UL; - } - if (mask) - sprintf(cp, " 0x%lx", mask); + switch (c->family) { + case 0x07: memcpy(family, "Itanium", 8); break; + case 0x1f: memcpy(family, "McKinley", 9); break; + default: sprintf(family, "%u", c->family); break; + } - p += sprintf(p, - "processor : %lu\n" - "vendor : %s\n" - "arch : IA-64\n" - "family : %s\n" - "model : %u\n" - "revision : %u\n" - "archrev : %u\n" - "features :%s\n" /* don't change this---it _is_ right! */ - "cpu number : %lu\n" - "cpu regs : %u\n" - "cpu MHz : %lu.%06lu\n" - "itc MHz : %lu.%06lu\n" - "BogoMIPS : %lu.%02lu\n\n", - cpu, c->vendor, family, c->model, c->revision, c->archrev, features, - c->ppn, c->number, c->proc_freq / 1000000, c->proc_freq % 1000000, - c->itc_freq / 1000000, c->itc_freq % 1000000, - lpj*HZ/500000, (lpj*HZ/5000) % 100); + /* build the feature string: */ + memcpy(features, " standard", 10); + cp = features; + if (mask & 1) { + strcpy(cp, " branchlong"); + cp = strchr(cp, '\0'); + mask &= ~1UL; } - return p - buffer; + if (mask) + sprintf(cp, " 0x%lx", mask); + + seq_printf(m, + "processor : %lu\n" + "vendor : %s\n" + "arch : IA-64\n" + "family : %s\n" + "model : %u\n" + "revision : %u\n" + "archrev : %u\n" + "features :%s\n" /* don't change this---it _is_ right! */ + "cpu number : %lu\n" + "cpu regs : %u\n" + "cpu MHz : %lu.%06lu\n" + "itc MHz : %lu.%06lu\n" + "BogoMIPS : %lu.%02lu\n\n", + cpu, c->vendor, family, c->model, c->revision, c->archrev, + features, c->ppn, c->number, + c->proc_freq / 1000000, c->proc_freq % 1000000, + c->itc_freq / 1000000, c->itc_freq % 1000000, + lpj*HZ/500000, (lpj*HZ/5000) % 100); + return 0; } +static void * +c_start (struct seq_file *m, loff_t *pos) +{ + return *pos < NR_CPUS ? cpu_data(*pos) : NULL; +} + +static void * +c_next (struct seq_file *m, void *v, loff_t *pos) +{ + ++*pos; + return c_start(m, pos); +} + +static void +c_stop (struct seq_file *m, void *v) +{ +} + +struct seq_operations cpuinfo_op = { + start: c_start, + next: c_next, + stop: c_stop, + show: show_cpuinfo +}; + void identify_cpu (struct cpuinfo_ia64 *c) { @@ -525,10 +555,13 @@ /* * Initialize default control register to defer all speculative faults. The * kernel MUST NOT depend on a particular setting of these bits (in other words, - * the kernel must have recovery code for all speculative accesses). + * the kernel must have recovery code for all speculative accesses). Turn on + * dcr.lc as per recommendation by the architecture team. Most IA-32 apps + * shouldn't be affected by this (moral: keep your ia32 locks aligned and you'll + * be fine). */ ia64_set_dcr( IA64_DCR_DM | IA64_DCR_DP | IA64_DCR_DK | IA64_DCR_DX | IA64_DCR_DR - | IA64_DCR_DA | IA64_DCR_DD); + | IA64_DCR_DA | IA64_DCR_DD | IA64_DCR_LC); #ifndef CONFIG_SMP ia64_set_fpu_owner(0); #endif |