Commit 5fc4bcde authored by Linus Torvalds's avatar Linus Torvalds

v2.4.14.5 -> v2.4.14.6

  - Russell King: /proc/cpuinfo for ARM
  - Paul Mackerras: PPC update (cpuinfo etc)
  - Nicolas Aspert: fix Intel 8xx agptlb flush
  - Marko Myllynen: "Lindent" doesn't really need bash ;)
  - Alexander Viro: /proc/cpuinfo for s390/s390x/sh, /proc/pci cleanup
  - Alexander Viro: make lseek work on seqfiles
parent 2d46136d
...@@ -535,6 +535,12 @@ M: Remy.Card@linux.org ...@@ -535,6 +535,12 @@ M: Remy.Card@linux.org
L: linux-kernel@vger.kernel.org L: linux-kernel@vger.kernel.org
S: Maintained S: Maintained
EXT3 FILE SYSTEM
P: Remy Card, Stephen Tweedie
M: sct@redhat.com, akpm@zip.com.au, adilger@turbolinux.com
L: ext3-users@redhat.com
S: Maintained
FARSYNC SYNCHRONOUS DRIVER FARSYNC SYNCHRONOUS DRIVER
P: Bob Dunlop P: Bob Dunlop
M: rjd@xyzzy.clara.co.uk M: rjd@xyzzy.clara.co.uk
...@@ -1038,7 +1044,7 @@ S: Maintained ...@@ -1038,7 +1044,7 @@ S: Maintained
NETWORK DEVICE DRIVERS NETWORK DEVICE DRIVERS
P: Andrew Morton P: Andrew Morton
M: andrewm@uow.edu.au M: akpm@zip.com.au
P: Jeff Garzik P: Jeff Garzik
M: jgarzik@mandrakesoft.com M: jgarzik@mandrakesoft.com
L: linux-net@vger.kernel.org L: linux-net@vger.kernel.org
......
VERSION = 2 VERSION = 2
PATCHLEVEL = 4 PATCHLEVEL = 4
SUBLEVEL = 15 SUBLEVEL = 15
EXTRAVERSION =-pre5 EXTRAVERSION =-pre6
KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
......
...@@ -1064,8 +1064,6 @@ show_cpuinfo(struct seq_file *f, void *slot) ...@@ -1064,8 +1064,6 @@ show_cpuinfo(struct seq_file *f, void *slot)
char *sysvariation_name; char *sysvariation_name;
int nr_processors; int nr_processors;
if (!cpu)
return 1;
cpu_index = (unsigned) (cpu->type - 1); cpu_index = (unsigned) (cpu->type - 1);
cpu_name = "Unknown"; cpu_name = "Unknown";
if (cpu_index < N(cpu_names)) if (cpu_index < N(cpu_names))
......
...@@ -186,8 +186,8 @@ validate_cc_value(unsigned long cc) ...@@ -186,8 +186,8 @@ validate_cc_value(unsigned long cc)
[EV4_CPU] = { 150000000, 300000000 }, [EV4_CPU] = { 150000000, 300000000 },
[LCA4_CPU] = { 150000000, 300000000 }, /* guess */ [LCA4_CPU] = { 150000000, 300000000 }, /* guess */
[EV45_CPU] = { 200000000, 300000000 }, [EV45_CPU] = { 200000000, 300000000 },
[EV5_CPU] = { 266000000, 333333333 }, [EV5_CPU] = { 250000000, 433000000 },
[EV56_CPU] = { 366000000, 667000000 }, [EV56_CPU] = { 333000000, 667000000 },
[PCA56_CPU] = { 400000000, 600000000 }, /* guess */ [PCA56_CPU] = { 400000000, 600000000 }, /* guess */
[PCA57_CPU] = { 500000000, 600000000 }, /* guess */ [PCA57_CPU] = { 500000000, 600000000 }, /* guess */
[EV6_CPU] = { 466000000, 600000000 }, [EV6_CPU] = { 466000000, 600000000 },
......
/* /*
* linux/arch/arm/kernel/setup.c * linux/arch/arm/kernel/setup.c
* *
* Copyright (C) 1995-2000 Russell King * Copyright (C) 1995-2001 Russell King
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <linux/blk.h> #include <linux/blk.h>
#include <linux/console.h> #include <linux/console.h>
#include <linux/bootmem.h> #include <linux/bootmem.h>
#include <linux/seq_file.h>
#include <linux/init.h> #include <linux/init.h>
#include <asm/elf.h> #include <asm/elf.h>
...@@ -532,58 +533,53 @@ static const char *hwcap_str[] = { ...@@ -532,58 +533,53 @@ static const char *hwcap_str[] = {
NULL NULL
}; };
/* static int c_show(struct seq_file *m, void *v)
* get_cpuinfo - Get information on one CPU for use by the procfs.
*
* Prints info on the next CPU into buffer. Beware, doesn't check for
* buffer overflow. Current implementation of procfs assumes that the
* resulting data is <= 1K.
*
* Args:
* buffer -- you guessed it, the data buffer
* cpu_np -- Input: next cpu to get (start at 0). Output: Updated.
*
* Returns number of bytes written to buffer.
*/
int get_cpuinfo(char *buffer, unsigned *cpu_np)
{ {
char *p = buffer;
unsigned n;
int i; int i;
/* No SMP at the moment, so just toggle 0/1 */ seq_printf(m, "Processor\t: %s %s rev %d (%s)\n",
n = *cpu_np; proc_info.manufacturer, proc_info.cpu_name,
*cpu_np = 1; (int)processor_id & 15, elf_platform);
if (n != 0) {
return (0);
}
p += sprintf(p, "Processor\t: %s %s rev %d (%s)\n",
proc_info.manufacturer, proc_info.cpu_name,
(int)processor_id & 15, elf_platform);
p += sprintf(p, "BogoMIPS\t: %lu.%02lu\n", seq_printf(m, "BogoMIPS\t: %lu.%02lu\n",
loops_per_jiffy / (500000/HZ), loops_per_jiffy / (500000/HZ),
(loops_per_jiffy / (5000/HZ)) % 100); (loops_per_jiffy / (5000/HZ)) % 100);
/* dump out the processor features */ /* dump out the processor features */
p += sprintf(p, "Features\t: "); seq_puts(m, "Features\t: ");
for (i = 0; hwcap_str[i]; i++) for (i = 0; hwcap_str[i]; i++)
if (elf_hwcap & (1 << i)) if (elf_hwcap & (1 << i))
p += sprintf(p, "%s ", hwcap_str[i]); seq_printf(m, "%s ", hwcap_str[i]);
seq_puts(m, "\n\n");
p += sprintf(p, "\n\n"); seq_printf(m, "Hardware\t: %s\n", machine_name);
seq_printf(m, "Revision\t: %04x\n", system_rev);
seq_printf(m, "Serial\t\t: %08x%08x\n",
system_serial_high, system_serial_low);
p += sprintf(p, "Hardware\t: %s\n", machine_name); return 0;
}
p += sprintf(p, "Revision\t: %04x\n", static void *c_start(struct seq_file *m, loff_t *pos)
system_rev); {
return *pos < 1 ? (void *)1 : NULL;
}
p += sprintf(p, "Serial\t\t: %08x%08x\n", static void *c_next(struct seq_file *m, void *v, loff_t *pos)
system_serial_high, {
system_serial_low); ++*pos;
return NULL;
}
return p - buffer; 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: c_show
};
# BK Id: SCCS/s.config.in 1.43 10/16/01 15:18:50 trini # BK Id: SCCS/s.config.in 1.45 11/08/01 07:57:40 paulus
# #
# For a description of the syntax of this configuration file, # For a description of the syntax of this configuration file,
# see Documentation/kbuild/config-language.txt. # see Documentation/kbuild/config-language.txt.
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
define_bool CONFIG_UID16 n define_bool CONFIG_UID16 n
define_bool CONFIG_RWSEM_GENERIC_SPINLOCK n define_bool CONFIG_RWSEM_GENERIC_SPINLOCK n
define_bool CONFIG_RWSEM_XCHGADD_ALGORITHM y define_bool CONFIG_RWSEM_XCHGADD_ALGORITHM y
define_bool CONFIG_HAVE_DEC_LOCK y
mainmenu_name "Linux/PowerPC Kernel Configuration" mainmenu_name "Linux/PowerPC Kernel Configuration"
......
/* /*
* BK Id: SCCS/s.apus_setup.c 1.22 10/18/01 11:16:27 trini * BK Id: SCCS/s.apus_setup.c 1.24 11/13/01 21:26:07 paulus
*/ */
/* /*
* linux/arch/ppc/kernel/apus_setup.c * linux/arch/ppc/kernel/apus_setup.c
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <linux/hdreg.h> #include <linux/hdreg.h>
#include <linux/blk.h> #include <linux/blk.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/seq_file.h>
#ifdef CONFIG_APUS #ifdef CONFIG_APUS
#include <asm/logging.h> #include <asm/logging.h>
...@@ -263,24 +264,20 @@ void __init apus_setup_arch(void) ...@@ -263,24 +264,20 @@ void __init apus_setup_arch(void)
} }
int int
apus_get_cpuinfo(char *buffer) apus_show_cpuinfo(struct seq_file *m)
{ {
#ifdef CONFIG_APUS
extern int __map_without_bats; extern int __map_without_bats;
extern unsigned long powerup_PCI_present; extern unsigned long powerup_PCI_present;
int len;
seq_printf(m, "machine\t\t: Amiga\n");
len = sprintf(buffer, "machine\t\t: Amiga\n"); seq_printf(m, "bus speed\t: %d%s", __bus_speed,
len += sprintf(buffer+len, "bus speed\t: %d%s", __bus_speed, (__speed_test_failed) ? " [failed]\n" : "\n");
(__speed_test_failed) ? " [failed]\n" : "\n"); seq_printf(m, "using BATs\t: %s\n",
len += sprintf(buffer+len, "using BATs\t: %s\n", (__map_without_bats) ? "No" : "Yes");
(__map_without_bats) ? "No" : "Yes"); seq_printf(m, "ram speed\t: %dns\n", (__60nsram) ? 60 : 70);
len += sprintf(buffer+len, "ram speed\t: %dns\n", seq_printf(m, "PCI bridge\t: %s\n",
(__60nsram) ? 60 : 70); (powerup_PCI_present) ? "Yes" : "No");
len += sprintf(buffer+len, "PCI bridge\t: %s\n", return 0;
(powerup_PCI_present) ? "Yes" : "No");
return len;
#endif
} }
static void get_current_tb(unsigned long long *time) static void get_current_tb(unsigned long long *time)
...@@ -1069,8 +1066,7 @@ void platform_init(unsigned long r3, unsigned long r4, unsigned long r5, ...@@ -1069,8 +1066,7 @@ void platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
ISA_DMA_THRESHOLD = 0x00ffffff; ISA_DMA_THRESHOLD = 0x00ffffff;
ppc_md.setup_arch = apus_setup_arch; ppc_md.setup_arch = apus_setup_arch;
ppc_md.setup_residual = NULL; ppc_md.show_cpuinfo = apus_show_cpuinfo;
ppc_md.get_cpuinfo = apus_get_cpuinfo;
ppc_md.irq_cannonicalize = apus_irq_cannonicalize; ppc_md.irq_cannonicalize = apus_irq_cannonicalize;
ppc_md.init_IRQ = apus_init_IRQ; ppc_md.init_IRQ = apus_init_IRQ;
ppc_md.get_irq = apus_get_irq; ppc_md.get_irq = apus_get_irq;
......
/* /*
* BK Id: SCCS/s.chrp_setup.c 1.36 09/08/01 15:47:42 paulus * BK Id: SCCS/s.chrp_setup.c 1.38 11/13/01 21:26:07 paulus
*/ */
/* /*
* linux/arch/ppc/kernel/setup.c * linux/arch/ppc/kernel/setup.c
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/ide.h> #include <linux/ide.h>
#include <linux/seq_file.h>
#include <asm/mmu.h> #include <asm/mmu.h>
#include <asm/processor.h> #include <asm/processor.h>
...@@ -81,6 +82,7 @@ extern void pckbd_leds(unsigned char leds); ...@@ -81,6 +82,7 @@ extern void pckbd_leds(unsigned char leds);
extern void pckbd_init_hw(void); extern void pckbd_init_hw(void);
extern unsigned char pckbd_sysrq_xlate[128]; extern unsigned char pckbd_sysrq_xlate[128];
extern void select_adb_keyboard(void); extern void select_adb_keyboard(void);
extern int of_show_percpuinfo(struct seq_file *, int);
extern kdev_t boot_dev; extern kdev_t boot_dev;
...@@ -110,9 +112,9 @@ static const char *gg2_cachemodes[4] = { ...@@ -110,9 +112,9 @@ static const char *gg2_cachemodes[4] = {
}; };
int __chrp int __chrp
chrp_get_cpuinfo(char *buffer) chrp_show_cpuinfo(struct seq_file *m)
{ {
int i, len, sdramen; int i, sdramen;
unsigned int t; unsigned int t;
struct device_node *root; struct device_node *root;
const char *model = ""; const char *model = "";
...@@ -120,11 +122,10 @@ chrp_get_cpuinfo(char *buffer) ...@@ -120,11 +122,10 @@ chrp_get_cpuinfo(char *buffer)
root = find_path_device("/"); root = find_path_device("/");
if (root) if (root)
model = get_property(root, "model", NULL); model = get_property(root, "model", NULL);
len = sprintf(buffer,"machine\t\t: CHRP %s\n", model); seq_printf(m, "machine\t\t: CHRP %s\n", model);
/* longtrail (goldengate) stuff */ /* longtrail (goldengate) stuff */
if ( !strncmp( model, "IBM,LongTrail", 13 ) ) if (!strncmp(model, "IBM,LongTrail", 13)) {
{
/* VLSI VAS96011/12 `Golden Gate 2' */ /* VLSI VAS96011/12 `Golden Gate 2' */
/* Memory banks */ /* Memory banks */
sdramen = (in_le32((unsigned *)(GG2_PCI_CONFIG_BASE+ sdramen = (in_le32((unsigned *)(GG2_PCI_CONFIG_BASE+
...@@ -159,17 +160,17 @@ chrp_get_cpuinfo(char *buffer) ...@@ -159,17 +160,17 @@ chrp_get_cpuinfo(char *buffer)
model = "Reserved"; model = "Reserved";
break; break;
} }
len += sprintf(buffer+len, "memory bank %d\t: %s %s\n", i, model, seq_printf(m, "memory bank %d\t: %s %s\n", i, model,
gg2_memtypes[sdramen ? 1 : ((t>>1) & 3)]); gg2_memtypes[sdramen ? 1 : ((t>>1) & 3)]);
} }
/* L2 cache */ /* L2 cache */
t = in_le32((unsigned *)(GG2_PCI_CONFIG_BASE+GG2_PCI_CC_CTRL)); t = in_le32((unsigned *)(GG2_PCI_CONFIG_BASE+GG2_PCI_CC_CTRL));
len += sprintf(buffer+len, "board l2\t: %s %s (%s)\n", seq_printf(m, "board l2\t: %s %s (%s)\n",
gg2_cachesizes[(t>>7) & 3], gg2_cachesizes[(t>>7) & 3],
gg2_cachetypes[(t>>2) & 3], gg2_cachetypes[(t>>2) & 3],
gg2_cachemodes[t & 3]); gg2_cachemodes[t & 3]);
} }
return len; return 0;
} }
/* /*
...@@ -341,13 +342,8 @@ u_int __chrp ...@@ -341,13 +342,8 @@ u_int __chrp
chrp_irq_cannonicalize(u_int irq) chrp_irq_cannonicalize(u_int irq)
{ {
if (irq == 2) if (irq == 2)
{
return 9; return 9;
} return irq;
else
{
return irq;
}
} }
void __init chrp_init_IRQ(void) void __init chrp_init_IRQ(void)
...@@ -513,8 +509,8 @@ chrp_init(unsigned long r3, unsigned long r4, unsigned long r5, ...@@ -513,8 +509,8 @@ chrp_init(unsigned long r3, unsigned long r4, unsigned long r5,
isa_io_base = CHRP_ISA_IO_BASE; /* default value */ isa_io_base = CHRP_ISA_IO_BASE; /* default value */
ppc_md.setup_arch = chrp_setup_arch; ppc_md.setup_arch = chrp_setup_arch;
ppc_md.setup_residual = NULL; ppc_md.show_percpuinfo = of_show_percpuinfo;
ppc_md.get_cpuinfo = chrp_get_cpuinfo; ppc_md.show_cpuinfo = chrp_show_cpuinfo;
ppc_md.irq_cannonicalize = chrp_irq_cannonicalize; ppc_md.irq_cannonicalize = chrp_irq_cannonicalize;
#ifndef CONFIG_POWER4 #ifndef CONFIG_POWER4
ppc_md.init_IRQ = chrp_init_IRQ; ppc_md.init_IRQ = chrp_init_IRQ;
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <linux/major.h> #include <linux/major.h>
#include <linux/blk.h> #include <linux/blk.h>
#include <linux/console.h> #include <linux/console.h>
#include <linux/seq_file.h>
#include <asm/system.h> #include <asm/system.h>
#include <asm/pgtable.h> #include <asm/pgtable.h>
...@@ -82,9 +83,8 @@ prom_init(void) ...@@ -82,9 +83,8 @@ prom_init(void)
} }
int int
gemini_get_cpuinfo(char *buffer) gemini_show_cpuinfo(struct seq_file *m)
{ {
int len;
unsigned char reg, rev; unsigned char reg, rev;
char *family; char *family;
unsigned int type; unsigned int type;
...@@ -100,22 +100,20 @@ gemini_get_cpuinfo(char *buffer) ...@@ -100,22 +100,20 @@ gemini_get_cpuinfo(char *buffer)
reg = readb(GEMINI_BECO); reg = readb(GEMINI_BECO);
len = sprintf( buffer, "machine\t\t: Gemini %s%d, rev %c, eco %d\n", seq_printf(m, "machine\t\t: Gemini %s%d, rev %c, eco %d\n",
family, type, (rev + 'A'), (reg & 0xf)); family, type, (rev + 'A'), (reg & 0xf));
len = sprintf(buffer, "board\t\t: Gemini %s", family); seq_printf(m, "board\t\t: Gemini %s", family);
if (type > 9) if (type > 9)
len += sprintf(buffer+len, "%c", (type - 10) + 'A'); seq_printf(m, "%c", (type - 10) + 'A');
else else
len += sprintf(buffer+len, "%d", type); seq_printf(m, "%d", type);
len += sprintf(buffer+len, ", rev %c, eco %d\n", seq_printf(m, ", rev %c, eco %d\n", (rev + 'A'), (reg & 0xf));
(rev + 'A'), (reg & 0xf));
len += sprintf(buffer+len, "clock\t\t: %dMhz\n", seq_printf(m, "clock\t\t: %dMhz\n", gemini_get_clock_speed());
gemini_get_clock_speed());
return len; return 0;
} }
static u_char gemini_openpic_initsenses[] = { static u_char gemini_openpic_initsenses[] = {
...@@ -150,11 +148,12 @@ extern char cmd_line[]; ...@@ -150,11 +148,12 @@ extern char cmd_line[];
void void
gemini_heartbeat(void) gemini_heartbeat(void)
{ {
/* We only want to do this on 1 CPU */
if ( smp_processor_id() )
return;
static unsigned long led = GEMINI_LEDBASE+(4*8); static unsigned long led = GEMINI_LEDBASE+(4*8);
static char direction = 8; static char direction = 8;
/* We only want to do this on 1 CPU */
if (smp_processor_id())
return;
*(char *)led = 0; *(char *)led = 0;
if ( (led + direction) > (GEMINI_LEDBASE+(7*8)) || if ( (led + direction) > (GEMINI_LEDBASE+(7*8)) ||
(led + direction) < (GEMINI_LEDBASE+(4*8)) ) (led + direction) < (GEMINI_LEDBASE+(4*8)) )
...@@ -551,8 +550,7 @@ void __init platform_init(unsigned long r3, unsigned long r4, unsigned long r5, ...@@ -551,8 +550,7 @@ void __init platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
#endif #endif
ppc_md.setup_arch = gemini_setup_arch; ppc_md.setup_arch = gemini_setup_arch;
ppc_md.setup_residual = NULL; ppc_md.show_cpuinfo = gemini_show_cpuinfo;
ppc_md.get_cpuinfo = gemini_get_cpuinfo;
ppc_md.irq_cannonicalize = NULL; ppc_md.irq_cannonicalize = NULL;
ppc_md.init_IRQ = gemini_init_IRQ; ppc_md.init_IRQ = gemini_init_IRQ;
ppc_md.get_irq = openpic_get_irq; ppc_md.get_irq = openpic_get_irq;
......
/* /*
* BK Id: SCCS/s.m8260_setup.c 1.28 10/18/01 11:16:28 trini * BK Id: SCCS/s.m8260_setup.c 1.30 11/13/01 21:26:07 paulus
*/ */
/* /*
* linux/arch/ppc/kernel/setup.c * linux/arch/ppc/kernel/setup.c
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include <linux/blk.h> #include <linux/blk.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/ide.h> #include <linux/ide.h>
#include <linux/seq_file.h>
#include <asm/mmu.h> #include <asm/mmu.h>
#include <asm/processor.h> #include <asm/processor.h>
...@@ -144,21 +145,20 @@ m8260_halt(void) ...@@ -144,21 +145,20 @@ m8260_halt(void)
static int static int
m8260_setup_residual(char *buffer) m8260_show_percpuinfo(struct seq_file *m, int i)
{ {
int len = 0;
bd_t *bp; bd_t *bp;
bp = (bd_t *)__res; bp = (bd_t *)__res;
len += sprintf(len+buffer,"core clock\t: %d MHz\n" seq_printf(m, "core clock\t: %d MHz\n"
"CPM clock\t: %d MHz\n" "CPM clock\t: %d MHz\n"
"bus clock\t: %d MHz\n", "bus clock\t: %d MHz\n",
bp->bi_intfreq / 1000000, bp->bi_intfreq / 1000000,
bp->bi_cpmfreq / 1000000, bp->bi_cpmfreq / 1000000,
bp->bi_busfreq / 1000000); bp->bi_busfreq / 1000000);
return len; return 0;
} }
/* Initialize the internal interrupt controller. The number of /* Initialize the internal interrupt controller. The number of
...@@ -240,8 +240,7 @@ platform_init(unsigned long r3, unsigned long r4, unsigned long r5, ...@@ -240,8 +240,7 @@ platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
} }
ppc_md.setup_arch = m8260_setup_arch; ppc_md.setup_arch = m8260_setup_arch;
ppc_md.setup_residual = m8260_setup_residual; ppc_md.show_percpuinfo = m8260_show_percpuinfo;
ppc_md.get_cpuinfo = NULL;
ppc_md.irq_cannonicalize = NULL; ppc_md.irq_cannonicalize = NULL;
ppc_md.init_IRQ = m8260_init_IRQ; ppc_md.init_IRQ = m8260_init_IRQ;
ppc_md.get_irq = m8260_get_irq; ppc_md.get_irq = m8260_get_irq;
......
/* /*
* BK Id: SCCS/s.m8xx_setup.c 1.38 10/18/01 11:16:28 trini * BK Id: SCCS/s.m8xx_setup.c 1.40 11/13/01 21:26:07 paulus
* *
* linux/arch/ppc/kernel/setup.c * linux/arch/ppc/kernel/setup.c
* *
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include <linux/blk.h> #include <linux/blk.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/bootmem.h> #include <linux/bootmem.h>
#include <linux/seq_file.h>
#include <asm/mmu.h> #include <asm/mmu.h>
#include <asm/processor.h> #include <asm/processor.h>
...@@ -240,19 +241,18 @@ m8xx_halt(void) ...@@ -240,19 +241,18 @@ m8xx_halt(void)
static int static int
m8xx_setup_residual(char *buffer) m8xx_show_percpuinfo(struct seq_file *m, int i)
{ {
int len = 0;
bd_t *bp; bd_t *bp;
bp = (bd_t *)__res; bp = (bd_t *)__res;
len += sprintf(len+buffer,"clock\t\t: %ldMHz\n" seq_printf(m, "clock\t\t: %ldMHz\n"
"bus clock\t: %ldMHz\n", "bus clock\t: %ldMHz\n",
bp->bi_intfreq / 1000000, bp->bi_intfreq / 1000000,
bp->bi_busfreq / 1000000); bp->bi_busfreq / 1000000);
return len; return 0;
} }
/* Initialize the internal interrupt controller. The number of /* Initialize the internal interrupt controller. The number of
...@@ -372,8 +372,7 @@ platform_init(unsigned long r3, unsigned long r4, unsigned long r5, ...@@ -372,8 +372,7 @@ platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
} }
ppc_md.setup_arch = m8xx_setup_arch; ppc_md.setup_arch = m8xx_setup_arch;
ppc_md.setup_residual = m8xx_setup_residual; ppc_md.show_percpuinfo = m8xx_show_percpuinfo;
ppc_md.get_cpuinfo = NULL;
ppc_md.irq_cannonicalize = NULL; ppc_md.irq_cannonicalize = NULL;
ppc_md.init_IRQ = m8xx_init_IRQ; ppc_md.init_IRQ = m8xx_init_IRQ;
ppc_md.get_irq = m8xx_get_irq; ppc_md.get_irq = m8xx_get_irq;
......
/* /*
* BK Id: SCCS/s.oak_setup.c 1.10 10/18/01 11:16:28 trini * BK Id: SCCS/s.oak_setup.c 1.12 11/13/01 21:26:07 paulus
*/ */
/* /*
* *
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <linux/param.h> #include <linux/param.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/blk.h> #include <linux/blk.h>
#include <linux/seq_file.h>
#include <asm/processor.h> #include <asm/processor.h>
#include <asm/board.h> #include <asm/board.h>
...@@ -106,8 +107,7 @@ platform_init(unsigned long r3, unsigned long r4, unsigned long r5, ...@@ -106,8 +107,7 @@ platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
/* Initialize machine-dependency vectors */ /* Initialize machine-dependency vectors */
ppc_md.setup_arch = oak_setup_arch; ppc_md.setup_arch = oak_setup_arch;
ppc_md.setup_residual = oak_setup_residual; ppc_md.show_percpuinfo = oak_show_percpuinfo;
ppc_md.get_cpuinfo = NULL;
ppc_md.irq_cannonicalize = NULL; ppc_md.irq_cannonicalize = NULL;
ppc_md.init_IRQ = oak_init_IRQ; ppc_md.init_IRQ = oak_init_IRQ;
ppc_md.get_irq = oak_get_irq; ppc_md.get_irq = oak_get_irq;
...@@ -141,7 +141,7 @@ oak_setup_arch(void) ...@@ -141,7 +141,7 @@ oak_setup_arch(void)
} }
/* /*
* int oak_setup_residual() * int oak_show_percpuinfo()
* *
* Description: * Description:
* This routine pretty-prints the platform's internal CPU and bus clock * This routine pretty-prints the platform's internal CPU and bus clock
...@@ -159,18 +159,16 @@ oak_setup_arch(void) ...@@ -159,18 +159,16 @@ oak_setup_arch(void)
* on error. * on error.
*/ */
int int
oak_setup_residual(char *buffer) oak_show_percpuinfo(struct seq_file *m, int i)
{ {
int len = 0;
bd_t *bp = (bd_t *)__res; bd_t *bp = (bd_t *)__res;
len += sprintf(len + buffer, seq_printf(m, "clock\t\t: %dMHz\n"
"clock\t\t: %dMHz\n" "bus clock\t\t: %dMHz\n",
"bus clock\t\t: %dMHz\n", bp->bi_intfreq / 1000000,
bp->bi_intfreq / 1000000, bp->bi_busfreq / 1000000);
bp->bi_busfreq / 1000000);
return (len); return 0;
} }
/* /*
......
/* /*
* BK Id: SCCS/s.pci.c 1.31 11/01/01 12:24:55 trini * BK Id: SCCS/s.pci.c 1.35 11/13/01 08:19:57 trini
*/ */
/* /*
* Common pmac/prep/chrp pci routines. -- Cort * Common pmac/prep/chrp pci routines. -- Cort
...@@ -44,6 +44,7 @@ void pcibios_make_OF_bus_map(void); ...@@ -44,6 +44,7 @@ void pcibios_make_OF_bus_map(void);
static void pcibios_fixup_resources(struct pci_dev* dev); static void pcibios_fixup_resources(struct pci_dev* dev);
static void fixup_broken_pcnet32(struct pci_dev* dev); static void fixup_broken_pcnet32(struct pci_dev* dev);
static void fixup_rev1_53c810(struct pci_dev* dev);
#ifdef CONFIG_ALL_PPC #ifdef CONFIG_ALL_PPC
static void pcibios_fixup_cardbus(struct pci_dev* dev); static void pcibios_fixup_cardbus(struct pci_dev* dev);
static u8* pci_to_OF_bus_map; static u8* pci_to_OF_bus_map;
...@@ -60,15 +61,29 @@ struct pci_controller** hose_tail = &hose_head; ...@@ -60,15 +61,29 @@ struct pci_controller** hose_tail = &hose_head;
static int pci_bus_count; static int pci_bus_count;
struct pci_fixup pcibios_fixups[] = { struct pci_fixup pcibios_fixups[] = {
{ PCI_FIXUP_HEADER, PCI_VENDOR_ID_TRIDENT, PCI_ANY_ID, fixup_broken_pcnet32 }, { PCI_FIXUP_HEADER, PCI_VENDOR_ID_TRIDENT, PCI_ANY_ID, fixup_broken_pcnet32 },
{ PCI_FIXUP_HEADER, PCI_ANY_ID, PCI_ANY_ID, pcibios_fixup_resources }, { PCI_FIXUP_HEADER, PCI_VENDOR_ID_NCR, PCI_DEVICE_ID_NCR_53C810, fixup_rev1_53c810 },
{ PCI_FIXUP_HEADER, PCI_ANY_ID, PCI_ANY_ID, pcibios_fixup_resources },
#ifdef CONFIG_ALL_PPC #ifdef CONFIG_ALL_PPC
/* We should add per-machine fixup support in xxx_setup.c or xxx_pci.c */ /* We should add per-machine fixup support in xxx_setup.c or xxx_pci.c */
{ PCI_FIXUP_FINAL, PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1211, pcibios_fixup_cardbus }, { PCI_FIXUP_FINAL, PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1211, pcibios_fixup_cardbus },
#endif /* CONFIG_ALL_PPC */ #endif /* CONFIG_ALL_PPC */
{ 0 } { 0 }
}; };
static void
fixup_rev1_53c810(struct pci_dev* dev)
{
/* rev 1 ncr53c810 chips don't set the class at all which means
* they don't get their resources remapped. Fix that here.
*/
if ((dev->class == PCI_CLASS_NOT_DEFINED)) {
printk("NCR 53c810 rev 1 detected, setting PCI class.\n");
dev->class = PCI_CLASS_STORAGE_SCSI;
}
}
static void static void
fixup_broken_pcnet32(struct pci_dev* dev) fixup_broken_pcnet32(struct pci_dev* dev)
{ {
......
/* /*
* BK Id: SCCS/s.pmac_setup.c 1.41 10/18/01 11:16:28 trini * BK Id: SCCS/s.pmac_setup.c 1.43 11/13/01 21:26:07 paulus
*/ */
/* /*
* linux/arch/ppc/kernel/setup.c * linux/arch/ppc/kernel/setup.c
...@@ -49,6 +49,7 @@ ...@@ -49,6 +49,7 @@
#include <linux/adb.h> #include <linux/adb.h>
#include <linux/cuda.h> #include <linux/cuda.h>
#include <linux/pmu.h> #include <linux/pmu.h>
#include <linux/seq_file.h>
#include <asm/processor.h> #include <asm/processor.h>
#include <asm/sections.h> #include <asm/sections.h>
...@@ -157,36 +158,56 @@ core99_init_l2(void) ...@@ -157,36 +158,56 @@ core99_init_l2(void)
} }
#endif /* CONFIG_SMP */ #endif /* CONFIG_SMP */
/*
* Assume here that all clock rates are the same in a
* smp system. -- Cort
*/
int __openfirmware
of_show_percpuinfo(struct seq_file *m, int i)
{
struct device_node *cpu_node;
int *fp, s;
cpu_node = find_type_devices("cpu");
if (!cpu_node)
return 0;
for (s = 0; s < i && cpu_node->next; s++)
cpu_node = cpu_node->next;
fp = (int *) get_property(cpu_node, "clock-frequency", NULL);
if (fp)
seq_printf(m, "clock\t\t: %dMHz\n", *fp / 1000000);
return 0;
}
int __pmac int __pmac
pmac_get_cpuinfo(char *buffer) pmac_show_cpuinfo(struct seq_file *m)
{ {
int len;
struct device_node *np; struct device_node *np;
char *pp; char *pp;
int plen; int plen;
/* find motherboard type */ /* find motherboard type */
len = sprintf(buffer, "machine\t\t: "); seq_printf(m, "machine\t\t: ");
np = find_devices("device-tree"); np = find_devices("device-tree");
if (np != NULL) { if (np != NULL) {
pp = (char *) get_property(np, "model", NULL); pp = (char *) get_property(np, "model", NULL);
if (pp != NULL) if (pp != NULL)
len += sprintf(buffer+len, "%s\n", pp); seq_printf(m, "%s\n", pp);
else else
len += sprintf(buffer+len, "PowerMac\n"); seq_printf(m, "PowerMac\n");
pp = (char *) get_property(np, "compatible", &plen); pp = (char *) get_property(np, "compatible", &plen);
if (pp != NULL) { if (pp != NULL) {
len += sprintf(buffer+len, "motherboard\t:"); seq_printf(m, "motherboard\t:");
while (plen > 0) { while (plen > 0) {
int l = strlen(pp) + 1; int l = strlen(pp) + 1;
len += sprintf(buffer+len, " %s", pp); seq_printf(m, " %s", pp);
plen -= l; plen -= l;
pp += l; pp += l;
} }
buffer[len++] = '\n'; seq_printf(m, "\n");
} }
} else } else
len += sprintf(buffer+len, "PowerMac\n"); seq_printf(m, "PowerMac\n");
/* find l2 cache info */ /* find l2 cache info */
np = find_devices("l2-cache"); np = find_devices("l2-cache");
...@@ -197,22 +218,21 @@ pmac_get_cpuinfo(char *buffer) ...@@ -197,22 +218,21 @@ pmac_get_cpuinfo(char *buffer)
get_property(np, "i-cache-size", NULL); get_property(np, "i-cache-size", NULL);
unsigned int *dc = (unsigned int *) unsigned int *dc = (unsigned int *)
get_property(np, "d-cache-size", NULL); get_property(np, "d-cache-size", NULL);
len += sprintf(buffer+len, "L2 cache\t:"); seq_printf(m, "L2 cache\t:");
has_l2cache = 1; has_l2cache = 1;
if (get_property(np, "cache-unified", NULL) != 0 && dc) { if (get_property(np, "cache-unified", NULL) != 0 && dc) {
len += sprintf(buffer+len, " %dK unified", *dc / 1024); seq_printf(m, " %dK unified", *dc / 1024);
} else { } else {
if (ic) if (ic)
len += sprintf(buffer+len, " %dK instruction", seq_printf(m, " %dK instruction", *ic / 1024);
*ic / 1024);
if (dc) if (dc)
len += sprintf(buffer+len, "%s %dK data", seq_printf(m, "%s %dK data",
(ic? " +": ""), *dc / 1024); (ic? " +": ""), *dc / 1024);
} }
pp = get_property(np, "ram-type", NULL); pp = get_property(np, "ram-type", NULL);
if (pp) if (pp)
len += sprintf(buffer+len, " %s", pp); seq_printf(m, " %s", pp);
buffer[len++] = '\n'; seq_printf(m, "\n");
} }
/* find ram info */ /* find ram info */
...@@ -227,8 +247,7 @@ pmac_get_cpuinfo(char *buffer) ...@@ -227,8 +247,7 @@ pmac_get_cpuinfo(char *buffer)
for (n /= sizeof(struct reg_property); n > 0; --n) for (n /= sizeof(struct reg_property); n > 0; --n)
total += (reg++)->size; total += (reg++)->size;
len += sprintf(buffer+len, "memory\t\t: %luMB\n", seq_printf(m, "memory\t\t: %luMB\n", total >> 20);
total >> 20);
} }
} }
...@@ -240,16 +259,16 @@ pmac_get_cpuinfo(char *buffer) ...@@ -240,16 +259,16 @@ pmac_get_cpuinfo(char *buffer)
unsigned int *l2cr = (unsigned int *) unsigned int *l2cr = (unsigned int *)
get_property(np, "l2cr-value", NULL); get_property(np, "l2cr-value", NULL);
if (l2cr != 0) { if (l2cr != 0) {
len += sprintf(buffer+len, "l2cr override\t: 0x%x\n", *l2cr); seq_printf(m, "l2cr override\t: 0x%x\n", *l2cr);
} }
} }
/* Indicate newworld/oldworld */ /* Indicate newworld/oldworld */
len += sprintf(buffer+len, "pmac-generation\t: %s\n", seq_printf(m, "pmac-generation\t: %s\n",
pmac_newworld ? "NewWorld" : "OldWorld"); pmac_newworld ? "NewWorld" : "OldWorld");
return len; return 0;
} }
#ifdef CONFIG_SCSI #ifdef CONFIG_SCSI
...@@ -765,8 +784,8 @@ pmac_init(unsigned long r3, unsigned long r4, unsigned long r5, ...@@ -765,8 +784,8 @@ pmac_init(unsigned long r3, unsigned long r4, unsigned long r5,
DMA_MODE_WRITE = 2; DMA_MODE_WRITE = 2;
ppc_md.setup_arch = pmac_setup_arch; ppc_md.setup_arch = pmac_setup_arch;
ppc_md.setup_residual = NULL; ppc_md.show_cpuinfo = pmac_show_cpuinfo;
ppc_md.get_cpuinfo = pmac_get_cpuinfo; ppc_md.show_percpuinfo = of_show_percpuinfo;
ppc_md.irq_cannonicalize = NULL; ppc_md.irq_cannonicalize = NULL;
ppc_md.init_IRQ = pmac_pic_init; ppc_md.init_IRQ = pmac_pic_init;
ppc_md.get_irq = pmac_get_irq; /* Changed later on ... */ ppc_md.get_irq = pmac_get_irq; /* Changed later on ... */
......
/* /*
* BK Id: SCCS/s.ppc_ksyms.c 1.57 10/16/01 15:58:42 trini * BK Id: SCCS/s.ppc_ksyms.c 1.59 11/04/01 22:58:20 paulus
*/ */
#include <linux/config.h> #include <linux/config.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -58,6 +58,7 @@ ...@@ -58,6 +58,7 @@
/* Tell string.h we don't want memcpy etc. as cpp defines */ /* Tell string.h we don't want memcpy etc. as cpp defines */
#define EXPORT_SYMTAB_STROPS #define EXPORT_SYMTAB_STROPS
extern void ppc_generic_ide_fix_driveid(struct hd_driveid *id);
extern void transfer_to_handler(void); extern void transfer_to_handler(void);
extern void syscall_trace(void); extern void syscall_trace(void);
extern void do_IRQ(struct pt_regs *regs); extern void do_IRQ(struct pt_regs *regs);
...@@ -167,6 +168,7 @@ EXPORT_SYMBOL(iopa); ...@@ -167,6 +168,7 @@ EXPORT_SYMBOL(iopa);
EXPORT_SYMBOL(mm_ptov); EXPORT_SYMBOL(mm_ptov);
EXPORT_SYMBOL(ppc_ide_md); EXPORT_SYMBOL(ppc_ide_md);
EXPORT_SYMBOL(ppc_generic_ide_fix_driveid);
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
EXPORT_SYMBOL_NOVERS(isa_io_base); EXPORT_SYMBOL_NOVERS(isa_io_base);
......
/* /*
* BK Id: SCCS/s.prep_setup.c 1.41 10/18/01 11:16:28 trini * BK Id: SCCS/s.prep_setup.c 1.44 11/13/01 21:26:07 paulus
*/ */
/* /*
* linux/arch/ppc/kernel/setup.c * linux/arch/ppc/kernel/setup.c
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include <linux/timex.h> #include <linux/timex.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/ide.h> #include <linux/ide.h>
#include <linux/seq_file.h>
#include <asm/sections.h> #include <asm/sections.h>
#include <asm/mmu.h> #include <asm/mmu.h>
...@@ -122,107 +123,107 @@ EXPORT_SYMBOL(ppc_cs4232_dma2); ...@@ -122,107 +123,107 @@ EXPORT_SYMBOL(ppc_cs4232_dma2);
#endif #endif
static int __prep static int __prep
prep_get_cpuinfo(char *buffer) prep_show_cpuinfo(struct seq_file *m)
{ {
extern char *Motherboard_map_name; extern char *Motherboard_map_name;
int len; int cachew;
#ifdef CONFIG_PREP_RESIDUAL #ifdef CONFIG_PREP_RESIDUAL
int i; int i;
#endif #endif
#ifdef CONFIG_SMP seq_printf(m, "machine\t\t: PReP %s\n", Motherboard_map_name);
#define CD(X) (cpu_data[n].X)
#else
#define CD(X) (X)
#endif
len = sprintf(buffer,"machine\t\t: PReP %s\n",Motherboard_map_name); switch ( _prep_type ) {
switch ( _prep_type )
{
case _PREP_IBM: case _PREP_IBM:
if ((*(unsigned char *)0x8000080c) & (1<<6)) cachew = inw(0x80c);
len += sprintf(buffer+len,"Upgrade CPU\n"); if (cachew & (1<<6))
len += sprintf(buffer+len,"L2\t\t: "); seq_printf(m, "Upgrade CPU\n");
if ((*(unsigned char *)0x8000080c) & (1<<7)) seq_printf(m, "L2\t\t: ");
{ if (cachew & (1<<7)) {
len += sprintf(buffer+len,"not present\n"); seq_printf(m, "not present\n");
goto no_l2; goto no_l2;
} }
len += sprintf(buffer+len,"%sKb,", seq_printf(m, "%sKb,", (cachew & (1 << 10))? "512" : "256");
(((*(unsigned char *)0x8000080d)>>2)&1) seq_printf(m, "%ssync\n", (cachew & (1 << 15))? "" : "a");
? "512" : "256");
len += sprintf(buffer+len,"%ssync\n",
((*(unsigned char *)0x8000080d)>>7) ? "" : "a");
break; break;
case _PREP_Motorola: case _PREP_Motorola:
len += sprintf(buffer+len,"L2\t\t: "); cachew = *((unsigned char *)CACHECRBA);
switch(*((unsigned char *)CACHECRBA) & L2CACHE_MASK) seq_printf(m, "L2\t\t: ");
{ switch (cachew & L2CACHE_MASK) {
case L2CACHE_512KB: case L2CACHE_512KB:
len += sprintf(buffer+len,"512Kb"); seq_printf(m, "512Kb");
break; break;
case L2CACHE_256KB: case L2CACHE_256KB:
len += sprintf(buffer+len,"256Kb"); seq_printf(m, "256Kb");
break; break;
case L2CACHE_1MB: case L2CACHE_1MB:
len += sprintf(buffer+len,"1MB"); seq_printf(m, "1MB");
break; break;
case L2CACHE_NONE: case L2CACHE_NONE:
len += sprintf(buffer+len,"none\n"); seq_printf(m, "none\n");
goto no_l2; goto no_l2;
break; break;
default: default:
len += sprintf(buffer+len, "%x\n", seq_printf(m, "%x\n", cachew);
*((unsigned char *)CACHECRBA));
} }
len += sprintf(buffer+len,",parity %s", seq_printf(m, ", parity %s",
(*((unsigned char *)CACHECRBA) & L2CACHE_PARITY) (cachew & L2CACHE_PARITY)? "enabled" : "disabled");
? "enabled" : "disabled");
len += sprintf(buffer+len, " SRAM:"); seq_printf(m, " SRAM:");
switch ( ((*((unsigned char *)CACHECRBA) & 0xf0) >> 4) & ~(0x3) ) switch ( ((cachew & 0xf0) >> 4) & ~(0x3) ) {
{ case 1: seq_printf(m, "synchronous,parity,flow-through\n");
case 1: len += sprintf(buffer+len,
"synchronous,parity,flow-through\n");
break; break;
case 2: len += sprintf(buffer+len,"asynchronous,no parity\n"); case 2: seq_printf(m, "asynchronous,no parity\n");
break; break;
case 3: len += sprintf(buffer+len,"asynchronous,parity\n"); case 3: seq_printf(m, "asynchronous,parity\n");
break; break;
default:len += sprintf(buffer+len, default:seq_printf(m, "synchronous,pipelined,no parity\n");
"synchronous,pipelined,no parity\n");
break; break;
} }
break; break;
default: default:
break; break;
} }
no_l2: no_l2:
#ifndef CONFIG_PREP_RESIDUAL #ifdef CONFIG_PREP_RESIDUAL
return len; if (res->ResidualLength == 0) {
#else /* print info about SIMMs */
if ( res->ResidualLength == 0 ) seq_printf(m, "simms\t\t: ");
return len; for (i = 0; (res->ActualNumMemories) && (i < MAX_MEMS); i++) {
if (res->Memories[i].SIMMSize != 0)
/* print info about SIMMs */ seq_printf(m, "%d:%ldM ", i,
len += sprintf(buffer+len,"simms\t\t: ");
for ( i = 0 ; (res->ActualNumMemories) && (i < MAX_MEMS) ; i++ )
{
if ( res->Memories[i].SIMMSize != 0 )
len += sprintf(buffer+len,"%d:%ldM ", i,
(res->Memories[i].SIMMSize > 1024) ? (res->Memories[i].SIMMSize > 1024) ?
res->Memories[i].SIMMSize>>20 : res->Memories[i].SIMMSize>>20 :
res->Memories[i].SIMMSize); res->Memories[i].SIMMSize);
}
seq_printf(m, "\n");
} }
len += sprintf(buffer+len,"\n");
return len;
#endif #endif
return 0;
}
static int __prep
prep_show_percpuinfo(struct seq_file *m, int i)
{
int len = 0;
/* PREP's without residual data will give incorrect values here */
seq_printf(m, "clock\t\t: ");
#ifdef CONFIG_PREP_RESIDUAL
if (res->ResidualLength)
seq_printf(m, "%ldMHz\n",
(res->VitalProductData.ProcessorHz > 1024) ?
res->VitalProductData.ProcessorHz>>20 :
res->VitalProductData.ProcessorHz);
else
#endif /* CONFIG_PREP_RESIDUAL */
seq_printf(m, "???\n");
return 0;
} }
static void __init static void __init
...@@ -628,26 +629,6 @@ prep_power_off(void) ...@@ -628,26 +629,6 @@ prep_power_off(void)
} }
} }
static int __prep
prep_setup_residual(char *buffer)
{
int len = 0;
/* PREP's without residual data will give incorrect values here */
len += sprintf(len+buffer, "clock\t\t: ");
#ifdef CONFIG_PREP_RESIDUAL
if ( res->ResidualLength )
len += sprintf(len+buffer, "%ldMHz\n",
(res->VitalProductData.ProcessorHz > 1024) ?
res->VitalProductData.ProcessorHz>>20 :
res->VitalProductData.ProcessorHz);
else
#endif /* CONFIG_PREP_RESIDUAL */
len += sprintf(len+buffer, "???\n");
return len;
}
static unsigned int __prep static unsigned int __prep
prep_irq_cannonicalize(u_int irq) prep_irq_cannonicalize(u_int irq)
{ {
...@@ -852,11 +833,8 @@ prep_init(unsigned long r3, unsigned long r4, unsigned long r5, ...@@ -852,11 +833,8 @@ prep_init(unsigned long r3, unsigned long r4, unsigned long r5,
unsigned long r6, unsigned long r7) unsigned long r6, unsigned long r7)
{ {
#ifdef CONFIG_PREP_RESIDUAL #ifdef CONFIG_PREP_RESIDUAL
RESIDUAL *old_res = (RESIDUAL *)(r3 + KERNELBASE);
/* make a copy of residual data */ /* make a copy of residual data */
if ( r3 ) if ( r3 ) {
{
memcpy((void *)res,(void *)(r3+KERNELBASE), memcpy((void *)res,(void *)(r3+KERNELBASE),
sizeof(RESIDUAL)); sizeof(RESIDUAL));
} }
...@@ -900,8 +878,8 @@ prep_init(unsigned long r3, unsigned long r4, unsigned long r5, ...@@ -900,8 +878,8 @@ prep_init(unsigned long r3, unsigned long r4, unsigned long r5,
} }
ppc_md.setup_arch = prep_setup_arch; ppc_md.setup_arch = prep_setup_arch;
ppc_md.setup_residual = prep_setup_residual; ppc_md.show_percpuinfo = prep_show_percpuinfo;
ppc_md.get_cpuinfo = prep_get_cpuinfo; ppc_md.show_cpuinfo = prep_show_cpuinfo;
ppc_md.irq_cannonicalize = prep_irq_cannonicalize; ppc_md.irq_cannonicalize = prep_irq_cannonicalize;
ppc_md.init_IRQ = prep_init_IRQ; ppc_md.init_IRQ = prep_init_IRQ;
/* this gets changed later on if we have an OpenPIC -- Cort */ /* this gets changed later on if we have an OpenPIC -- Cort */
......
/* /*
* BK Id: SCCS/s.setup.c 1.61 10/12/01 16:35:34 trini * BK Id: SCCS/s.setup.c 1.63 11/13/01 21:26:07 paulus
*/ */
/* /*
* Common prep/pmac/chrp boot and setup code. * Common prep/pmac/chrp boot and setup code.
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <linux/ide.h> #include <linux/ide.h>
#include <linux/tty.h> #include <linux/tty.h>
#include <linux/bootmem.h> #include <linux/bootmem.h>
#include <linux/seq_file.h>
#include <asm/residual.h> #include <asm/residual.h>
#include <asm/io.h> #include <asm/io.h>
...@@ -136,150 +137,128 @@ extern u32 cpu_temp(unsigned long cpu); ...@@ -136,150 +137,128 @@ extern u32 cpu_temp(unsigned long cpu);
extern u32 cpu_temp_both(unsigned long cpu); extern u32 cpu_temp_both(unsigned long cpu);
#endif /* CONFIG_TAU */ #endif /* CONFIG_TAU */
int get_cpuinfo(char *buffer) int show_cpuinfo(struct seq_file *m, void *v)
{ {
unsigned long len = 0; int i = (int) v - 1;
unsigned long bogosum = 0; int err = 0;
unsigned long i;
unsigned int pvr; unsigned int pvr;
unsigned short maj, min; unsigned short maj, min;
unsigned long lpj;
if (i >= NR_CPUS) {
/* Show summary information */
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
#define CPU_PRESENT(x) (cpu_callin_map[(x)]) unsigned long bogosum = 0;
#define GET_PVR ((long int)(cpu_data[i].pvr)) for (i = 0; i < smp_num_cpus; ++i)
#define CD(x) (cpu_data[i].x) if (cpu_online_map & (1 << i))
bogosum += cpu_data[i].loops_per_jiffy;
seq_printf(m, "total bogomips\t: %lu.%02lu\n",
bogosum/(500000/HZ), bogosum/(5000/HZ) % 100);
#endif /* CONFIG_SMP */
if (ppc_md.show_cpuinfo != NULL)
err = ppc_md.show_cpuinfo(m);
return err;
}
#ifdef CONFIG_SMP
if (!(cpu_online_map & (1 << i)))
return 0;
pvr = cpu_data[i].pvr;
lpj = cpu_data[i].loops_per_jiffy;
seq_printf(m, "processor\t: %lu\n", i);
#else #else
#define CPU_PRESENT(x) ((x)==0) pvr = mfspr(PVR);
#define smp_num_cpus 1 lpj = loops_per_jiffy;
#define GET_PVR (mfspr(PVR)) #endif
#define CD(x) (x)
#endif
for ( i = 0; i < smp_num_cpus ; i++ ) seq_printf(m, "cpu\t\t: ");
{
if ( !CPU_PRESENT(i) ) if (cur_cpu_spec[i]->pvr_mask)
continue; seq_printf(m, "%s", cur_cpu_spec[i]->cpu_name);
if ( i ) else
len += sprintf(len+buffer,"\n"); seq_printf(m, "unknown (%08x)", pvr);
len += sprintf(len+buffer,"processor\t: %lu\n",i);
len += sprintf(len+buffer,"cpu\t\t: ");
pvr = GET_PVR;
if (cur_cpu_spec[i]->pvr_mask)
len += sprintf(len+buffer, "%s", cur_cpu_spec[i]->cpu_name);
else
len += sprintf(len+buffer, "unknown (%08x)", pvr);
#ifdef CONFIG_ALTIVEC #ifdef CONFIG_ALTIVEC
if (cur_cpu_spec[i]->cpu_features & CPU_FTR_ALTIVEC) if (cur_cpu_spec[i]->cpu_features & CPU_FTR_ALTIVEC)
len += sprintf(len+buffer, ", altivec supported"); seq_printf(m, ", altivec supported");
#endif #endif
len += sprintf(len+buffer, "\n"); seq_printf(m, "\n");
#ifdef CONFIG_TAU #ifdef CONFIG_TAU
if (cur_cpu_spec[i]->cpu_features & CPU_FTR_TAU) { if (cur_cpu_spec[i]->cpu_features & CPU_FTR_TAU) {
#ifdef CONFIG_TAU_AVERAGE /* more straightforward, but potentially misleading */ #ifdef CONFIG_TAU_AVERAGE
len += sprintf(len+buffer, "temperature \t: %u C (uncalibrated)\n", /* more straightforward, but potentially misleading */
cpu_temp(i)); seq_printf(m, "temperature \t: %u C (uncalibrated)\n",
cpu_temp(i));
#else #else
/* show the actual temp sensor range */ /* show the actual temp sensor range */
u32 temp; u32 temp;
temp = cpu_temp_both(i); temp = cpu_temp_both(i);
len += sprintf(len+buffer, "temperature \t: %u-%u C (uncalibrated)\n", seq_printf(m, "temperature \t: %u-%u C (uncalibrated)\n",
temp & 0xff, temp >> 16); temp & 0xff, temp >> 16);
#endif
}
#endif #endif
}
#endif /* CONFIG_TAU */
/* if (ppc_md.show_percpuinfo != NULL) {
* Assume here that all clock rates are the same in a err = ppc_md.show_percpuinfo(m, i);
* smp system. -- Cort if (err)
*/ return err;
#if defined(CONFIG_ALL_PPC) }
if ( have_of )
{
struct device_node *cpu_node;
int *fp;
cpu_node = find_type_devices("cpu");
if ( !cpu_node ) break;
{
int s;
for ( s = 0; (s < i) && cpu_node->next ;
s++, cpu_node = cpu_node->next )
/* nothing */ ;
#if 0 /* SMP Pmacs don't have all cpu nodes -- Cort */
if ( s != i )
printk("get_cpuinfo(): ran out of "
"cpu nodes.\n");
#endif
}
fp = (int *) get_property(cpu_node, "clock-frequency", NULL);
if ( !fp ) break;
len += sprintf(len+buffer, "clock\t\t: %dMHz\n",
*fp / 1000000);
}
#endif /* CONFIG_ALL_PPC */
if (ppc_md.setup_residual != NULL) switch (PVR_VER(pvr)) {
{ case 0x0020: /* 403 family */
len += ppc_md.setup_residual(buffer + len); maj = PVR_MAJ(pvr) + 1;
} min = PVR_MIN(pvr);
break;
switch (PVR_VER(pvr)) case 0x1008: /* 740P/750P ?? */
{ maj = ((pvr >> 8) & 0xFF) - 1;
case 0x0020: min = pvr & 0xFF;
maj = PVR_MAJ(pvr) + 1; break;
min = PVR_MIN(pvr); default:
break; maj = (pvr >> 8) & 0xFF;
case 0x1008: min = pvr & 0xFF;
maj = ((pvr >> 8) & 0xFF) - 1; break;
min = pvr & 0xFF; }
break;
default:
maj = (pvr >> 8) & 0xFF;
min = pvr & 0xFF;
break;
}
len += sprintf(len+buffer, "revision\t: %hd.%hd (pvr %04x %04x)\n", seq_printf(m, "revision\t: %hd.%hd (pvr %04x %04x)\n",
maj, min, PVR_VER(pvr), PVR_REV(pvr)); maj, min, PVR_VER(pvr), PVR_REV(pvr));
len += sprintf(buffer+len, "bogomips\t: %lu.%02lu\n", seq_printf(m, "bogomips\t: %lu.%02lu\n",
CD(loops_per_jiffy)/(500000/HZ), lpj / (500000/HZ), (lpj / (5000/HZ)) % 100);
CD(loops_per_jiffy)/(5000/HZ) % 100);
bogosum += CD(loops_per_jiffy);
}
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
if ( i && smp_num_cpus > 1) seq_printf(m, "\n");
len += sprintf(buffer+len, "\n"); #endif
len += sprintf(buffer+len,"total bogomips\t: %lu.%02lu\n",
bogosum/(500000/HZ),
bogosum/(5000/HZ) % 100);
#endif /* CONFIG_SMP */
/* return 0;
* Ooh's and aah's info about zero'd pages in idle task }
*/
len += sprintf(buffer+len,"zero pages\t: total: %u (%luKb) "
"current: %u (%luKb) hits: %u/%u (%u%%)\n", static void *c_start(struct seq_file *m, loff_t *pos)
atomic_read(&zero_cache_total), {
(atomic_read(&zero_cache_total)*PAGE_SIZE)>>10, int i = *pos;
atomic_read(&zero_cache_sz),
(atomic_read(&zero_cache_sz)*PAGE_SIZE)>>10,
atomic_read(&zero_cache_hits),atomic_read(&zero_cache_calls),
/* : 1 below is so we don't div by zero */
(atomic_read(&zero_cache_hits)*100) /
((atomic_read(&zero_cache_calls))?atomic_read(&zero_cache_calls):1));
if (ppc_md.get_cpuinfo != NULL)
{
len += ppc_md.get_cpuinfo(buffer+len);
}
return len; return i <= NR_CPUS? (void *) (i + 1): 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,
};
/* /*
* We're called here very early in the boot. We determine the machine * We're called here very early in the boot. We determine the machine
* type and call the appropriate low-level setup functions. * type and call the appropriate low-level setup functions.
...@@ -468,8 +447,7 @@ int parse_bootinfo(void) ...@@ -468,8 +447,7 @@ int parse_bootinfo(void)
extern char __bss_start[]; extern char __bss_start[];
rec = (struct bi_record *)_ALIGN((ulong)__bss_start+(1<<20)-1,(1<<20)); rec = (struct bi_record *)_ALIGN((ulong)__bss_start+(1<<20)-1,(1<<20));
if ( rec->tag != BI_FIRST ) if ( rec->tag != BI_FIRST ) {
{
/* /*
* This 0x10000 offset is a terrible hack but it will go away when * This 0x10000 offset is a terrible hack but it will go away when
* we have the bootloader handle all the relocation and * we have the bootloader handle all the relocation and
...@@ -483,8 +461,7 @@ int parse_bootinfo(void) ...@@ -483,8 +461,7 @@ int parse_bootinfo(void)
rec = (struct bi_record *)((ulong)rec + rec->size) ) rec = (struct bi_record *)((ulong)rec + rec->size) )
{ {
ulong *data = rec->data; ulong *data = rec->data;
switch (rec->tag) switch (rec->tag) {
{
case BI_CMD_LINE: case BI_CMD_LINE:
memcpy(cmd_line, (void *)data, rec->size); memcpy(cmd_line, (void *)data, rec->size);
break; break;
......
/* /*
* BK Id: SCCS/s.walnut_setup.c 1.8 10/18/01 11:16:28 trini * BK Id: SCCS/s.walnut_setup.c 1.10 11/13/01 21:26:07 paulus
*/ */
/* /*
* *
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <linux/param.h> #include <linux/param.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/blk.h> #include <linux/blk.h>
#include <linux/seq_file.h>
#include <asm/processor.h> #include <asm/processor.h>
#include <asm/board.h> #include <asm/board.h>
...@@ -101,8 +102,7 @@ walnut_init(unsigned long r3, unsigned long r4, unsigned long r5, ...@@ -101,8 +102,7 @@ walnut_init(unsigned long r3, unsigned long r4, unsigned long r5,
/* Initialize machine-dependency vectors */ /* Initialize machine-dependency vectors */
ppc_md.setup_arch = walnut_setup_arch; ppc_md.setup_arch = walnut_setup_arch;
ppc_md.setup_residual = walnut_setup_residual; ppc_md.show_percpuinfo = walnut_show_percpuinfo;
ppc_md.get_cpuinfo = NULL;
ppc_md.irq_cannonicalize = NULL; ppc_md.irq_cannonicalize = NULL;
ppc_md.init_IRQ = walnut_init_IRQ; ppc_md.init_IRQ = walnut_init_IRQ;
ppc_md.get_irq = walnut_get_irq; ppc_md.get_irq = walnut_get_irq;
...@@ -136,7 +136,7 @@ walnut_setup_arch(void) ...@@ -136,7 +136,7 @@ walnut_setup_arch(void)
} }
/* /*
* int walnut_setup_residual() * int walnut_show_percpuinfo()
* *
* Description: * Description:
* This routine pretty-prints the platform's internal CPU and bus clock * This routine pretty-prints the platform's internal CPU and bus clock
...@@ -154,18 +154,16 @@ walnut_setup_arch(void) ...@@ -154,18 +154,16 @@ walnut_setup_arch(void)
* on error. * on error.
*/ */
int int
walnut_setup_residual(char *buffer) walnut_show_percpuinfo(struct seq_file *m)
{ {
int len = 0;
bd_t *bp = (bd_t *)__res; bd_t *bp = (bd_t *)__res;
len += sprintf(len + buffer, seq_printf(m, "clock\t\t: %dMHz\n"
"clock\t\t: %dMHz\n" "bus clock\t\t: %dMHz\n",
"bus clock\t\t: %dMHz\n", bp->bi_intfreq / 1000000,
bp->bi_intfreq / 1000000, bp->bi_busfreq / 1000000);
bp->bi_busfreq / 1000000);
return (len); return 0;
} }
/* /*
......
# BK Id: SCCS/s.Makefile 1.7 05/17/01 18:14:22 cort # BK Id: SCCS/s.Makefile 1.10 11/08/01 07:57:40 paulus
# #
# #
# Makefile for ppc-specific library files.. # Makefile for ppc-specific library files..
...@@ -8,7 +8,9 @@ USE_STANDARD_AS_RULE := true ...@@ -8,7 +8,9 @@ USE_STANDARD_AS_RULE := true
O_TARGET := lib.o O_TARGET := lib.o
obj-y := checksum.o string.o strcase.o export-objs := dec_and_lock.o
obj-y := checksum.o string.o strcase.o dec_and_lock.o
obj-$(CONFIG_SMP) += locks.o obj-$(CONFIG_SMP) += locks.o
......
#include <linux/module.h>
#include <linux/spinlock.h>
#include <asm/atomic.h>
#include <asm/system.h>
/*
* This is an implementation of the notion of "decrement a
* reference count, and return locked if it decremented to zero".
*
* This implementation can be used on any architecture that
* has a cmpxchg, and where atomic->value is an int holding
* the value of the atomic (i.e. the high bits aren't used
* for a lock or anything like that).
*
* N.B. ATOMIC_DEC_AND_LOCK gets defined in include/linux/spinlock.h
* if spinlocks are empty and thus atomic_dec_and_lock is defined
* to be atomic_dec_and_test - in that case we don't need it
* defined here as well.
*/
#ifndef ATOMIC_DEC_AND_LOCK
int atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock)
{
int counter;
int newcount;
for (;;) {
counter = atomic_read(atomic);
newcount = counter - 1;
if (!newcount)
break; /* do it the slow way */
newcount = cmpxchg(&atomic->counter, counter, newcount);
if (newcount == counter)
return 0;
}
spin_lock(lock);
if (atomic_dec_and_test(atomic))
return 1;
spin_unlock(lock);
return 0;
}
EXPORT_SYMBOL(atomic_dec_and_lock);
#endif /* ATOMIC_DEC_AND_LOCK */
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#endif #endif
#include <linux/bootmem.h> #include <linux/bootmem.h>
#include <linux/console.h> #include <linux/console.h>
#include <linux/seq_file.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/system.h> #include <asm/system.h>
#include <asm/smp.h> #include <asm/smp.h>
...@@ -478,49 +479,48 @@ void print_cpu_info(struct cpuinfo_S390 *cpuinfo) ...@@ -478,49 +479,48 @@ void print_cpu_info(struct cpuinfo_S390 *cpuinfo)
} }
/* /*
* get_cpuinfo - Get information on one CPU for use by procfs. * show_cpuinfo - Get information on one CPU for use by procfs.
*
* Prints info on the next CPU into buffer. Beware, doesn't check for
* buffer overflow. Current implementation of procfs assumes that the
* resulting data is <= 1K.
*
* Args:
* buffer -- you guessed it, the data buffer
* cpu_np -- Input: next cpu to get (start at 0). Output: Updated.
*
* Returns number of bytes written to buffer.
*/ */
int get_cpuinfo(char *buffer, unsigned *cpu_np) static int show_cpuinfo(struct seq_file *m, void *v)
{ {
struct cpuinfo_S390 *cpuinfo; struct cpuinfo_S390 *cpuinfo;
char *p = buffer; unsigned n = v;
unsigned n;
n = *cpu_np;
while (n < NR_CPUS && (cpu_online_map & (1 << n)) == 0)
n++;
if (n >= NR_CPUS) {
*cpu_np = NR_CPUS;
return (0);
}
*cpu_np = n + 1;
if (n == 0) { if (!n--) {
p += sprintf(p,"vendor_id : IBM/S390\n" seq_printf(m, "vendor_id : IBM/S390\n"
"# processors : %i\n" "# processors : %i\n"
"bogomips per cpu: %lu.%02lu\n", "bogomips per cpu: %lu.%02lu\n",
smp_num_cpus, loops_per_jiffy/(500000/HZ), smp_num_cpus, loops_per_jiffy/(500000/HZ),
(loops_per_jiffy/(5000/HZ))%100); (loops_per_jiffy/(5000/HZ))%100);
} else if (cpu_online_map & (1 << n)) {
cpuinfo = &safe_get_cpu_lowcore(n).cpu_data;
seq_printf(m, "processor %i: "
"version = %02X, "
"identification = %06X, "
"machine = %04X\n",
n, cpuinfo->cpu_id.version,
cpuinfo->cpu_id.ident,
cpuinfo->cpu_id.machine);
} }
cpuinfo = &safe_get_cpu_lowcore(n).cpu_data; return 0;
p += sprintf(p,"processor %i: "
"version = %02X, "
"identification = %06X, "
"machine = %04X\n",
n, cpuinfo->cpu_id.version,
cpuinfo->cpu_id.ident,
cpuinfo->cpu_id.machine);
return p - buffer;
} }
static void *c_start(struct seq_file *m, loff_t *pos)
{
return *pos <= NR_CPUS ? (void)(*pos+1) : 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,
};
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#endif #endif
#include <linux/bootmem.h> #include <linux/bootmem.h>
#include <linux/console.h> #include <linux/console.h>
#include <linux/seq_file.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/system.h> #include <asm/system.h>
#include <asm/smp.h> #include <asm/smp.h>
...@@ -467,49 +468,48 @@ void print_cpu_info(struct cpuinfo_S390 *cpuinfo) ...@@ -467,49 +468,48 @@ void print_cpu_info(struct cpuinfo_S390 *cpuinfo)
} }
/* /*
* get_cpuinfo - Get information on one CPU for use by procfs. * show_cpuinfo - Get information on one CPU for use by procfs.
*
* Prints info on the next CPU into buffer. Beware, doesn't check for
* buffer overflow. Current implementation of procfs assumes that the
* resulting data is <= 1K.
*
* Args:
* buffer -- you guessed it, the data buffer
* cpu_np -- Input: next cpu to get (start at 0). Output: Updated.
*
* Returns number of bytes written to buffer.
*/ */
int get_cpuinfo(char *buffer, unsigned *cpu_np) static int show_cpuinfo(struct seq_file *m, void *v)
{ {
struct cpuinfo_S390 *cpuinfo; struct cpuinfo_S390 *cpuinfo;
char *p = buffer; unsigned n = v;
unsigned n;
n = *cpu_np;
while (n < NR_CPUS && (cpu_online_map & (1 << n)) == 0)
n++;
if (n >= NR_CPUS) {
*cpu_np = NR_CPUS;
return (0);
}
*cpu_np = n + 1;
if (n == 0) { if (!n--) {
p += sprintf(p, "vendor_id : IBM/S390\n" seq_printf(m, "vendor_id : IBM/S390\n"
"# processors : %i\n" "# processors : %i\n"
"bogomips per cpu: %lu.%02lu\n", "bogomips per cpu: %lu.%02lu\n",
smp_num_cpus, loops_per_jiffy/(500000/HZ), smp_num_cpus, loops_per_jiffy/(500000/HZ),
(loops_per_jiffy/(5000/HZ))%100); (loops_per_jiffy/(5000/HZ))%100);
} else if (cpu_online_map & (1 << n)) {
cpuinfo = &safe_get_cpu_lowcore(n).cpu_data;
seq_printf(m, "processor %i: "
"version = %02X, "
"identification = %06X, "
"machine = %04X\n",
n, cpuinfo->cpu_id.version,
cpuinfo->cpu_id.ident,
cpuinfo->cpu_id.machine);
} }
cpuinfo = &safe_get_cpu_lowcore(n).cpu_data; return 0;
p += sprintf(p, "processor %i: "
"version = %02X, "
"identification = %06X, "
"machine = %04X\n",
n, cpuinfo->cpu_id.version,
cpuinfo->cpu_id.ident,
cpuinfo->cpu_id.machine);
return p - buffer;
} }
static void *c_start(struct seq_file *m, loff_t *pos)
{
return *pos <= NR_CPUS ? (void)(*pos+1) : 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,
};
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <linux/bootmem.h> #include <linux/bootmem.h>
#include <linux/console.h> #include <linux/console.h>
#include <linux/ctype.h> #include <linux/ctype.h>
#include <linux/seq_file.h>
#include <asm/processor.h> #include <asm/processor.h>
#include <asm/page.h> #include <asm/page.h>
#include <asm/pgtable.h> #include <asm/pgtable.h>
...@@ -517,24 +518,22 @@ struct sh_machine_vector* __init get_mv_byname(const char* name) ...@@ -517,24 +518,22 @@ struct sh_machine_vector* __init get_mv_byname(const char* name)
* Get CPU information for use by the procfs. * Get CPU information for use by the procfs.
*/ */
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
int get_cpuinfo(char *buffer) static int show_cpuinfo(struct seq_file *m, void *v)
{ {
char *p = buffer;
#if defined(__sh3__) #if defined(__sh3__)
p += sprintf(p,"cpu family\t: SH-3\n" seq_printf(m, "cpu family\t: SH-3\n"
"cache size\t: 8K-byte\n"); "cache size\t: 8K-byte\n");
#elif defined(__SH4__) #elif defined(__SH4__)
p += sprintf(p,"cpu family\t: SH-4\n" seq_printf(m, "cpu family\t: SH-4\n"
"cache size\t: 8K-byte/16K-byte\n"); "cache size\t: 8K-byte/16K-byte\n");
#endif #endif
p += sprintf(p, "bogomips\t: %lu.%02lu\n\n", seq_printf(m, "bogomips\t: %lu.%02lu\n\n",
loops_per_jiffy/(500000/HZ), loops_per_jiffy/(500000/HZ),
(loops_per_jiffy/(5000/HZ)) % 100); (loops_per_jiffy/(5000/HZ)) % 100);
p += sprintf(p, "Machine: %s\n", sh_mv.mv_name); seq_printf(m, "Machine: %s\n", sh_mv.mv_name);
#define PRINT_CLOCK(name, value) \ #define PRINT_CLOCK(name, value) \
p += sprintf(p, name " clock: %d.%02dMHz\n", \ seq_printf(m, name " clock: %d.%02dMHz\n", \
((value) / 1000000), ((value) % 1000000)/10000) ((value) / 1000000), ((value) % 1000000)/10000)
PRINT_CLOCK("CPU", boot_cpu_data.cpu_clock); PRINT_CLOCK("CPU", boot_cpu_data.cpu_clock);
...@@ -544,6 +543,24 @@ int get_cpuinfo(char *buffer) ...@@ -544,6 +543,24 @@ int get_cpuinfo(char *buffer)
#endif #endif
PRINT_CLOCK("Peripheral module", boot_cpu_data.module_clock); PRINT_CLOCK("Peripheral module", boot_cpu_data.module_clock);
return p - buffer; return 0;
}
static void *c_start(struct seq_file *m, loff_t *pos)
{
return (void*)(*pos == 0);
} }
static void *c_next(struct seq_file *m, void *v, loff_t *pos)
{
return NULL;
}
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,
};
#endif #endif
...@@ -2625,7 +2625,8 @@ static int __init cdrom_init(void) ...@@ -2625,7 +2625,8 @@ static int __init cdrom_init(void)
#ifdef CONFIG_SYSCTL #ifdef CONFIG_SYSCTL
cdrom_sysctl_register(); cdrom_sysctl_register();
#endif #endif
devfs_handle = devfs_mk_dir(NULL, "cdroms", NULL); if (!devfs_handle)
devfs_handle = devfs_mk_dir(NULL, "cdroms", NULL);
return 0; return 0;
} }
......
...@@ -1462,7 +1462,7 @@ static void intel_8xx_tlbflush(agp_memory * mem) ...@@ -1462,7 +1462,7 @@ static void intel_8xx_tlbflush(agp_memory * mem)
pci_read_config_dword(agp_bridge.dev, INTEL_AGPCTRL, &temp); pci_read_config_dword(agp_bridge.dev, INTEL_AGPCTRL, &temp);
pci_write_config_dword(agp_bridge.dev, INTEL_AGPCTRL, temp & ~(1 << 7)); pci_write_config_dword(agp_bridge.dev, INTEL_AGPCTRL, temp & ~(1 << 7));
pci_read_config_dword(agp_bridge.dev, INTEL_AGPCTRL, &temp); pci_read_config_dword(agp_bridge.dev, INTEL_AGPCTRL, &temp);
pci_write_config_dword(agp_bridge.dev, INTEL_AGPCTRL, temp & (1 << 7)); pci_write_config_dword(agp_bridge.dev, INTEL_AGPCTRL, temp | (1 << 7));
} }
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#include <linux/major.h> #include <linux/major.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/console.h> #include <linux/console.h>
#include <linux/irq.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/seq_file.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/byteorder.h> #include <asm/byteorder.h>
...@@ -302,53 +303,72 @@ static struct file_operations proc_bus_pci_operations = { ...@@ -302,53 +303,72 @@ static struct file_operations proc_bus_pci_operations = {
#define LONG_FORMAT "\t%16lx" #define LONG_FORMAT "\t%16lx"
#endif #endif
static int /* iterator */
get_pci_dev_info(char *buf, char **start, off_t pos, int count) static void *pci_seq_start(struct seq_file *m, loff_t *pos)
{ {
struct list_head *p = &pci_devices;
loff_t n = *pos;
/* XXX: surely we need some locking for traversing the list? */
while (n--) {
p = p->next;
if (p == &pci_devices)
return NULL;
}
return p;
}
static void *pci_seq_next(struct seq_file *m, void *v, loff_t *pos)
{
struct list_head *p = v;
(*pos)++;
return p->next != &pci_devices ? p->next : NULL;
}
static void pci_seq_stop(struct seq_file *m, void *v)
{
/* release whatever locks we need */
}
static int show_device(struct seq_file *m, void *v)
{
struct list_head *p = v;
const struct pci_dev *dev; const struct pci_dev *dev;
off_t at = 0; const struct pci_driver *drv;
int len, i, cnt; int i;
cnt = 0; if (p == &pci_devices)
pci_for_each_dev(dev) { return 0;
const struct pci_driver *drv = pci_dev_driver(dev);
len = sprintf(buf, "%02x%02x\t%04x%04x\t%x", dev = pci_dev_g(p);
drv = pci_dev_driver(dev);
seq_printf(m, "%02x%02x\t%04x%04x\t%x",
dev->bus->number, dev->bus->number,
dev->devfn, dev->devfn,
dev->vendor, dev->vendor,
dev->device, dev->device,
dev->irq); dev->irq);
/* Here should be 7 and not PCI_NUM_RESOURCES as we need to preserve compatibility */ /* Here should be 7 and not PCI_NUM_RESOURCES as we need to preserve compatibility */
for(i=0; i<7; i++) for(i=0; i<7; i++)
len += sprintf(buf+len, LONG_FORMAT, seq_printf(m, LONG_FORMAT,
dev->resource[i].start | (dev->resource[i].flags & PCI_REGION_FLAG_MASK)); dev->resource[i].start |
for(i=0; i<7; i++) (dev->resource[i].flags & PCI_REGION_FLAG_MASK));
len += sprintf(buf+len, LONG_FORMAT, dev->resource[i].start < dev->resource[i].end ? for(i=0; i<7; i++)
dev->resource[i].end - dev->resource[i].start + 1 : 0); seq_printf(m, LONG_FORMAT,
buf[len++] = '\t'; dev->resource[i].start < dev->resource[i].end ?
if (drv) dev->resource[i].end - dev->resource[i].start + 1 : 0);
len += sprintf(buf+len, "%s", drv->name); seq_putc(m, '\t');
buf[len++] = '\n'; if (drv)
at += len; seq_printf(m, "%s", drv->name);
if (at >= pos) { seq_putc(m, '\n');
if (!*start) { return 0;
*start = buf + (pos - (at - len));
cnt = at - pos;
} else
cnt += len;
buf += len;
if (cnt >= count)
/*
* proc_file_read() gives us 1KB of slack so it's OK if the
* above printfs write a little beyond the buffer end (we
* never write more than 1KB beyond the buffer end).
*/
break;
}
}
return (count > cnt) ? cnt : count;
} }
static struct seq_operations proc_bus_pci_devices_op = {
start: pci_seq_start,
next: pci_seq_next,
stop: pci_seq_stop,
show: show_device
};
static struct proc_dir_entry *proc_bus_pci_dir; static struct proc_dir_entry *proc_bus_pci_dir;
int pci_proc_attach_device(struct pci_dev *dev) int pci_proc_attach_device(struct pci_dev *dev)
...@@ -388,10 +408,10 @@ int pci_proc_detach_device(struct pci_dev *dev) ...@@ -388,10 +408,10 @@ int pci_proc_detach_device(struct pci_dev *dev)
int pci_proc_attach_bus(struct pci_bus* bus) int pci_proc_attach_bus(struct pci_bus* bus)
{ {
struct proc_dir_entry *de; struct proc_dir_entry *de = bus->procdir;
char name[16];
if (!(de = bus->procdir)) { if (!de) {
char name[16];
sprintf(name, "%02x", bus->number); sprintf(name, "%02x", bus->number);
de = bus->procdir = proc_mkdir(name, proc_bus_pci_dir); de = bus->procdir = proc_mkdir(name, proc_bus_pci_dir);
if (!de) if (!de)
...@@ -402,11 +422,9 @@ int pci_proc_attach_bus(struct pci_bus* bus) ...@@ -402,11 +422,9 @@ int pci_proc_attach_bus(struct pci_bus* bus)
int pci_proc_detach_bus(struct pci_bus* bus) int pci_proc_detach_bus(struct pci_bus* bus)
{ {
struct proc_dir_entry *de; struct proc_dir_entry *de = bus->procdir;
if (de)
if (!(de = bus->procdir)) {
remove_proc_entry(de->name, proc_bus_pci_dir); remove_proc_entry(de->name, proc_bus_pci_dir);
}
return 0; return 0;
} }
...@@ -421,54 +439,56 @@ int pci_proc_detach_bus(struct pci_bus* bus) ...@@ -421,54 +439,56 @@ int pci_proc_detach_bus(struct pci_bus* bus)
* The configuration string is stored starting at buf[len]. If the * The configuration string is stored starting at buf[len]. If the
* string would exceed the size of the buffer (SIZE), 0 is returned. * string would exceed the size of the buffer (SIZE), 0 is returned.
*/ */
static int sprint_dev_config(struct pci_dev *dev, char *buf, int size) static int show_dev_config(struct seq_file *m, void *v)
{ {
struct list_head *p = v;
struct pci_dev *dev;
struct pci_driver *drv;
u32 class_rev; u32 class_rev;
unsigned char latency, min_gnt, max_lat, *class; unsigned char latency, min_gnt, max_lat, *class;
int reg, len = 0; int reg;
if (p == &pci_devices) {
seq_puts(m, "PCI devices found:\n");
return 0;
}
dev = pci_dev_g(p);
drv = pci_dev_driver(dev);
pci_read_config_dword(dev, PCI_CLASS_REVISION, &class_rev); pci_read_config_dword(dev, PCI_CLASS_REVISION, &class_rev);
pci_read_config_byte (dev, PCI_LATENCY_TIMER, &latency); pci_read_config_byte (dev, PCI_LATENCY_TIMER, &latency);
pci_read_config_byte (dev, PCI_MIN_GNT, &min_gnt); pci_read_config_byte (dev, PCI_MIN_GNT, &min_gnt);
pci_read_config_byte (dev, PCI_MAX_LAT, &max_lat); pci_read_config_byte (dev, PCI_MAX_LAT, &max_lat);
if (len + 160 > size) seq_printf(m, " Bus %2d, device %3d, function %2d:\n",
return -1; dev->bus->number, PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));
len += sprintf(buf + len, " Bus %2d, device %3d, function %2d:\n",
dev->bus->number, PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));
class = pci_class_name(class_rev >> 16); class = pci_class_name(class_rev >> 16);
if (class) if (class)
len += sprintf(buf+len, " %s", class); seq_printf(m, " %s", class);
else else
len += sprintf(buf+len, " Class %04x", class_rev >> 16); seq_printf(m, " Class %04x", class_rev >> 16);
len += sprintf(buf+len, ": %s (rev %d).\n", dev->name, class_rev & 0xff); seq_printf(m, ": %s (rev %d).\n", dev->name, class_rev & 0xff);
if (dev->irq) { if (dev->irq)
if (len + 40 > size) seq_printf(m, " IRQ %d.\n", dev->irq);
return -1;
len += sprintf(buf + len, " IRQ %d.\n", dev->irq);
}
if (latency || min_gnt || max_lat) { if (latency || min_gnt || max_lat) {
if (len + 80 > size) seq_printf(m, " Master Capable. ");
return -1;
len += sprintf(buf + len, " Master Capable. ");
if (latency) if (latency)
len += sprintf(buf + len, "Latency=%d. ", latency); seq_printf(m, "Latency=%d. ", latency);
else else
len += sprintf(buf + len, "No bursts. "); seq_puts(m, "No bursts. ");
if (min_gnt) if (min_gnt)
len += sprintf(buf + len, "Min Gnt=%d.", min_gnt); seq_printf(m, "Min Gnt=%d.", min_gnt);
if (max_lat) if (max_lat)
len += sprintf(buf + len, "Max Lat=%d.", max_lat); seq_printf(m, "Max Lat=%d.", max_lat);
len += sprintf(buf + len, "\n"); seq_putc(m, '\n');
} }
for (reg = 0; reg < 6; reg++) { for (reg = 0; reg < 6; reg++) {
struct resource *res = dev->resource + reg; struct resource *res = dev->resource + reg;
unsigned long base, end, flags; unsigned long base, end, flags;
if (len + 40 > size)
return -1;
base = res->start; base = res->start;
end = res->end; end = res->end;
flags = res->flags; flags = res->flags;
...@@ -476,9 +496,8 @@ static int sprint_dev_config(struct pci_dev *dev, char *buf, int size) ...@@ -476,9 +496,8 @@ static int sprint_dev_config(struct pci_dev *dev, char *buf, int size)
continue; continue;
if (flags & PCI_BASE_ADDRESS_SPACE_IO) { if (flags & PCI_BASE_ADDRESS_SPACE_IO) {
len += sprintf(buf + len, seq_printf(m, " I/O at 0x%lx [0x%lx].\n",
" I/O at 0x%lx [0x%lx].\n", base, end);
base, end);
} else { } else {
const char *pref, *type = "unknown"; const char *pref, *type = "unknown";
...@@ -494,65 +513,58 @@ static int sprint_dev_config(struct pci_dev *dev, char *buf, int size) ...@@ -494,65 +513,58 @@ static int sprint_dev_config(struct pci_dev *dev, char *buf, int size)
case PCI_BASE_ADDRESS_MEM_TYPE_64: case PCI_BASE_ADDRESS_MEM_TYPE_64:
type = "64 bit"; break; type = "64 bit"; break;
} }
len += sprintf(buf + len, seq_printf(m, " %srefetchable %s memory at "
" %srefetchable %s memory at "
"0x%lx [0x%lx].\n", pref, type, "0x%lx [0x%lx].\n", pref, type,
base, base,
end); end);
} }
} }
return 0;
return len;
} }
/* static struct seq_operations proc_pci_op = {
* Return list of PCI devices as a character string for /proc/pci. start: pci_seq_start,
* BUF is a buffer that is PAGE_SIZE bytes long. next: pci_seq_next,
*/ stop: pci_seq_stop,
static int pci_read_proc(char *buf, char **start, off_t off, show: show_dev_config
int count, int *eof, void *data) };
{
int nprinted, len, begin = 0;
struct pci_dev *dev;
len = sprintf(buf, "PCI devices found:\n");
*eof = 1; static int proc_bus_pci_dev_open(struct inode *inode, struct file *file)
pci_for_each_dev(dev) { {
nprinted = sprint_dev_config(dev, buf + len, PAGE_SIZE - len); return seq_open(file, &proc_bus_pci_devices_op);
if (nprinted < 0) {
*eof = 0;
break;
}
len += nprinted;
if (len+begin < off) {
begin += len;
len = 0;
}
if (len+begin >= off+count)
break;
}
off -= begin;
*start = buf + off;
len -= off;
if (len>count)
len = count;
if (len<0)
len = 0;
return len;
} }
static struct file_operations proc_bus_pci_dev_operations = {
open: proc_bus_pci_dev_open,
read: seq_read,
llseek: seq_lseek,
release: seq_release,
};
static int proc_pci_open(struct inode *inode, struct file *file)
{
return seq_open(file, &proc_pci_op);
}
static struct file_operations proc_pci_operations = {
open: proc_pci_open,
read: seq_read,
llseek: seq_lseek,
release: seq_release,
};
static int __init pci_proc_init(void) static int __init pci_proc_init(void)
{ {
if (pci_present()) { if (pci_present()) {
struct proc_dir_entry *entry;
struct pci_dev *dev; struct pci_dev *dev;
proc_bus_pci_dir = proc_mkdir("pci", proc_bus); proc_bus_pci_dir = proc_mkdir("pci", proc_bus);
create_proc_info_entry("devices", 0, proc_bus_pci_dir, entry = create_proc_entry("devices", 0, proc_bus_pci_dir);
get_pci_dev_info); if (entry)
entry->proc_fops = &proc_bus_pci_dev_operations;
pci_for_each_dev(dev) { pci_for_each_dev(dev) {
pci_proc_attach_device(dev); pci_proc_attach_device(dev);
} }
create_proc_read_entry("pci", 0, NULL, pci_read_proc, NULL); entry = create_proc_entry("pci", 0, NULL);
if (entry)
entry->proc_fops = &proc_pci_operations;
} }
return 0; return 0;
} }
......
...@@ -66,7 +66,7 @@ static LIST_HEAD(anon_hash_chain); /* for inodes with NULL i_sb */ ...@@ -66,7 +66,7 @@ static LIST_HEAD(anon_hash_chain); /* for inodes with NULL i_sb */
* NOTE! You also have to own the lock if you change * NOTE! You also have to own the lock if you change
* the i_state of an inode while it is in use.. * the i_state of an inode while it is in use..
*/ */
spinlock_t inode_lock = SPIN_LOCK_UNLOCKED; static spinlock_t inode_lock = SPIN_LOCK_UNLOCKED;
/* /*
* Statistics gathering.. * Statistics gathering..
......
...@@ -160,14 +160,12 @@ printk("proc_iget: using deleted entry %s, count=%d\n", de->name, atomic_read(&d ...@@ -160,14 +160,12 @@ printk("proc_iget: using deleted entry %s, count=%d\n", de->name, atomic_read(&d
inode->i_nlink = de->nlink; inode->i_nlink = de->nlink;
if (de->owner) if (de->owner)
__MOD_INC_USE_COUNT(de->owner); __MOD_INC_USE_COUNT(de->owner);
if (S_ISBLK(de->mode)||S_ISCHR(de->mode)||S_ISFIFO(de->mode)) if (de->proc_iops)
inode->i_op = de->proc_iops;
if (de->proc_fops)
inode->i_fop = de->proc_fops;
else if (S_ISBLK(de->mode)||S_ISCHR(de->mode)||S_ISFIFO(de->mode))
init_special_inode(inode,de->mode,kdev_t_to_nr(de->rdev)); init_special_inode(inode,de->mode,kdev_t_to_nr(de->rdev));
else {
if (de->proc_iops)
inode->i_op = de->proc_iops;
if (de->proc_fops)
inode->i_fop = de->proc_fops;
}
} }
out: out:
......
...@@ -519,6 +519,14 @@ static struct file_operations proc_mounts_operations = { ...@@ -519,6 +519,14 @@ static struct file_operations proc_mounts_operations = {
struct proc_dir_entry *proc_root_kcore; struct proc_dir_entry *proc_root_kcore;
static void create_seq_entry(char *name, mode_t mode, struct file_operations *f)
{
struct proc_dir_entry *entry;
entry = create_proc_entry(name, mode, NULL);
if (entry)
entry->proc_fops = f;
}
void __init proc_misc_init(void) void __init proc_misc_init(void)
{ {
struct proc_dir_entry *entry; struct proc_dir_entry *entry;
...@@ -568,16 +576,10 @@ void __init proc_misc_init(void) ...@@ -568,16 +576,10 @@ void __init proc_misc_init(void)
entry = create_proc_entry("kmsg", S_IRUSR, &proc_root); entry = create_proc_entry("kmsg", S_IRUSR, &proc_root);
if (entry) if (entry)
entry->proc_fops = &proc_kmsg_operations; entry->proc_fops = &proc_kmsg_operations;
entry = create_proc_entry("mounts", 0, NULL); create_seq_entry("mounts", 0, &proc_mounts_operations);
if (entry) create_seq_entry("cpuinfo", 0, &proc_cpuinfo_operations);
entry->proc_fops = &proc_mounts_operations;
entry = create_proc_entry("cpuinfo", 0, NULL);
if (entry)
entry->proc_fops = &proc_cpuinfo_operations;
#ifdef CONFIG_MODULES #ifdef CONFIG_MODULES
entry = create_proc_entry("ksyms", 0, NULL); create_seq_entry("ksyms", 0, &proc_ksyms_operations);
if (entry)
entry->proc_fops = &proc_ksyms_operations;
#endif #endif
proc_root_kcore = create_proc_entry("kcore", S_IRUSR, NULL); proc_root_kcore = create_proc_entry("kcore", S_IRUSR, NULL);
if (proc_root_kcore) { if (proc_root_kcore) {
......
...@@ -73,13 +73,13 @@ ssize_t seq_read(struct file *file, char *buf, size_t size, loff_t *ppos) ...@@ -73,13 +73,13 @@ ssize_t seq_read(struct file *file, char *buf, size_t size, loff_t *ppos)
buf += n; buf += n;
copied += n; copied += n;
if (!m->count) if (!m->count)
(*ppos)++; m->index++;
if (!size) if (!size)
goto Done; goto Done;
} }
/* we need at least one record in buffer */ /* we need at least one record in buffer */
while (1) { while (1) {
pos = *ppos; pos = m->index;
p = m->op->start(m, &pos); p = m->op->start(m, &pos);
err = PTR_ERR(p); err = PTR_ERR(p);
if (!p || IS_ERR(p)) if (!p || IS_ERR(p))
...@@ -125,10 +125,12 @@ ssize_t seq_read(struct file *file, char *buf, size_t size, loff_t *ppos) ...@@ -125,10 +125,12 @@ ssize_t seq_read(struct file *file, char *buf, size_t size, loff_t *ppos)
m->from = n; m->from = n;
else else
pos++; pos++;
*ppos = pos; m->index = pos;
Done: Done:
if (!copied) if (!copied)
copied = err; copied = err;
else
*ppos += copied;
up(&m->sem); up(&m->sem);
return copied; return copied;
Enomem: Enomem:
...@@ -139,6 +141,54 @@ ssize_t seq_read(struct file *file, char *buf, size_t size, loff_t *ppos) ...@@ -139,6 +141,54 @@ ssize_t seq_read(struct file *file, char *buf, size_t size, loff_t *ppos)
goto Done; goto Done;
} }
static int traverse(struct seq_file *m, loff_t offset)
{
loff_t pos = 0;
int error = 0;
void *p;
m->index = 0;
m->count = m->from = 0;
if (!offset)
return 0;
if (!m->buf) {
m->buf = kmalloc(m->size = PAGE_SIZE, GFP_KERNEL);
if (!m->buf)
return -ENOMEM;
}
p = m->op->start(m, &m->index);
while (p) {
error = PTR_ERR(p);
if (IS_ERR(p))
break;
error = m->op->show(m, p);
if (error)
break;
if (m->count == m->size)
goto Eoverflow;
if (pos + m->count > offset) {
m->from = offset - pos;
m->count -= m->from;
break;
}
pos += m->count;
m->count = 0;
if (pos == offset) {
m->index++;
break;
}
p = m->op->next(m, p, &m->index);
}
m->op->stop(m, p);
return error;
Eoverflow:
m->op->stop(m, p);
kfree(m->buf);
m->buf = kmalloc(m->size <<= 1, GFP_KERNEL);
return !m->buf ? -ENOMEM : -EAGAIN;
}
/** /**
* seq_lseek - ->llseek() method for sequential files. * seq_lseek - ->llseek() method for sequential files.
* @file, @offset, @origin: see file_operations method * @file, @offset, @origin: see file_operations method
...@@ -157,11 +207,19 @@ loff_t seq_lseek(struct file *file, loff_t offset, int origin) ...@@ -157,11 +207,19 @@ loff_t seq_lseek(struct file *file, loff_t offset, int origin)
case 0: case 0:
if (offset < 0) if (offset < 0)
break; break;
retval = offset;
if (offset != file->f_pos) { if (offset != file->f_pos) {
file->f_pos = offset; while ((retval=traverse(m, offset)) == -EAGAIN)
m->count = 0; ;
if (retval) {
/* with extreme perjudice... */
file->f_pos = 0;
m->index = 0;
m->count = 0;
} else {
retval = file->f_pos = offset;
}
} }
retval = offset;
} }
up(&m->sem); up(&m->sem);
return retval; return retval;
......
/* /*
* BK Id: SCCS/s.machdep.h 1.23 10/18/01 11:16:28 trini * BK Id: SCCS/s.machdep.h 1.25 11/13/01 21:26:07 paulus
*/ */
#ifdef __KERNEL__ #ifdef __KERNEL__
#ifndef _PPC_MACHDEP_H #ifndef _PPC_MACHDEP_H
...@@ -14,13 +14,13 @@ ...@@ -14,13 +14,13 @@
struct pt_regs; struct pt_regs;
struct pci_bus; struct pci_bus;
struct pci_dev; struct pci_dev;
struct seq_file;
struct machdep_calls { struct machdep_calls {
void (*setup_arch)(void); void (*setup_arch)(void);
/* Optional, may be NULL. */ /* Optional, may be NULL. */
int (*setup_residual)(char *buffer); int (*show_cpuinfo)(struct seq_file *m);
/* Optional, may be NULL. */ int (*show_percpuinfo)(struct seq_file *m, int i);
int (*get_cpuinfo)(char *buffer);
/* Optional, may be NULL. */ /* Optional, may be NULL. */
unsigned int (*irq_cannonicalize)(unsigned int irq); unsigned int (*irq_cannonicalize)(unsigned int irq);
void (*init_IRQ)(void); void (*init_IRQ)(void);
......
...@@ -109,12 +109,12 @@ typedef struct __wait_queue_head wait_queue_head_t; ...@@ -109,12 +109,12 @@ typedef struct __wait_queue_head wait_queue_head_t;
} while (0) } while (0)
#define WQ_CHECK_LIST_HEAD(list) \ #define WQ_CHECK_LIST_HEAD(list) \
do { \ do { \
if (!list->next || !list->prev) \ if (!(list)->next || !(list)->prev) \
WQ_BUG(); \ WQ_BUG(); \
} while(0) } while(0)
#define WQ_NOTE_WAKER(tsk) \ #define WQ_NOTE_WAKER(tsk) \
do { \ do { \
tsk->__waker = (long)__builtin_return_address(0); \ (tsk)->__waker = (long)__builtin_return_address(0); \
} while (0) } while (0)
#else #else
#define WQ_BUG() #define WQ_BUG()
......
#!/bin/bash #!/bin/sh
indent -kr -i8 -ts8 -sob -l80 -ss -bs -psl $@ indent -kr -i8 -ts8 -sob -l80 -ss -bs -psl "$@"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment