|
From: James S. <jsi...@us...> - 2001-12-26 17:28:14
|
Update of /cvsroot/linuxconsole/ruby/linux/arch/ppc/kernel
In directory usw-pr-cvs1:/tmp/cvs-serv5113/arch/ppc/kernel
Modified Files:
apus_setup.c chrp_setup.c pmac_setup.c prep_setup.c
Log Message:
Synced to 2.5.0. Don't use. The default 2.5.0 has a nasty bug in it.
Index: apus_setup.c
===================================================================
RCS file: /cvsroot/linuxconsole/ruby/linux/arch/ppc/kernel/apus_setup.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- apus_setup.c 2001/10/06 16:11:12 1.4
+++ apus_setup.c 2001/12/26 17:28:11 1.5
@@ -1,5 +1,5 @@
/*
- * BK Id: SCCS/s.apus_setup.c 1.20 09/08/01 15:47:42 paulus
+ * BK Id: SCCS/s.apus_setup.c 1.24 11/13/01 21:26:07 paulus
*/
/*
* linux/arch/ppc/kernel/apus_setup.c
@@ -24,6 +24,7 @@
#include <linux/hdreg.h>
#include <linux/blk.h>
#include <linux/pci.h>
+#include <linux/seq_file.h>
#ifdef CONFIG_APUS
#include <asm/logging.h>
@@ -218,24 +219,20 @@
}
int
-apus_get_cpuinfo(char *buffer)
+apus_show_cpuinfo(struct seq_file *m)
{
-#ifdef CONFIG_APUS
extern int __map_without_bats;
extern unsigned long powerup_PCI_present;
- int len;
- len = sprintf(buffer, "machine\t\t: Amiga\n");
- len += sprintf(buffer+len, "bus speed\t: %d%s", __bus_speed,
- (__speed_test_failed) ? " [failed]\n" : "\n");
- len += sprintf(buffer+len, "using BATs\t: %s\n",
- (__map_without_bats) ? "No" : "Yes");
- len += sprintf(buffer+len, "ram speed\t: %dns\n",
- (__60nsram) ? 60 : 70);
- len += sprintf(buffer+len, "PCI bridge\t: %s\n",
- (powerup_PCI_present) ? "Yes" : "No");
- return len;
-#endif
+ seq_printf(m, "machine\t\t: Amiga\n");
+ seq_printf(m, "bus speed\t: %d%s", __bus_speed,
+ (__speed_test_failed) ? " [failed]\n" : "\n");
+ seq_printf(m, "using BATs\t: %s\n",
+ (__map_without_bats) ? "No" : "Yes");
+ seq_printf(m, "ram speed\t: %dns\n", (__60nsram) ? 60 : 70);
+ seq_printf(m, "PCI bridge\t: %s\n",
+ (powerup_PCI_present) ? "Yes" : "No");
+ return 0;
}
static void get_current_tb(unsigned long long *time)
@@ -348,7 +345,6 @@
#endif
}
-
/*********************************************************** FLOPPY */
#if defined(CONFIG_AMIGA_FLOPPY)
__init
@@ -982,8 +978,7 @@
ISA_DMA_THRESHOLD = 0x00ffffff;
ppc_md.setup_arch = apus_setup_arch;
- ppc_md.setup_residual = NULL;
- ppc_md.get_cpuinfo = apus_get_cpuinfo;
+ ppc_md.show_cpuinfo = apus_show_cpuinfo;
ppc_md.irq_cannonicalize = apus_irq_cannonicalize;
ppc_md.init_IRQ = apus_init_IRQ;
ppc_md.get_irq = apus_get_irq;
Index: chrp_setup.c
===================================================================
RCS file: /cvsroot/linuxconsole/ruby/linux/arch/ppc/kernel/chrp_setup.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- chrp_setup.c 2001/10/06 16:11:12 1.3
+++ chrp_setup.c 2001/12/26 17:28:11 1.4
@@ -1,5 +1,5 @@
/*
- * 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
@@ -37,6 +37,7 @@
#include <linux/module.h>
#include <linux/delay.h>
#include <linux/ide.h>
+#include <linux/seq_file.h>
#include <asm/mmu.h>
#include <asm/processor.h>
@@ -68,8 +69,8 @@
void rtas_display_progress(char *, unsigned short);
void rtas_indicator_progress(char *, unsigned short);
void btext_progress(char *, unsigned short);
-
extern unsigned long pmac_find_end_of_memory(void);
+
extern kdev_t boot_dev;
extern PTE *Hash, *Hash_end;
extern unsigned long Hash_size, Hash_mask;
@@ -97,9 +98,9 @@
};
int __chrp
-chrp_get_cpuinfo(char *buffer)
+chrp_show_cpuinfo(struct seq_file *m)
{
- int i, len, sdramen;
+ int i, sdramen;
unsigned int t;
struct device_node *root;
const char *model = "";
@@ -107,11 +108,10 @@
root = find_path_device("/");
if (root)
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 */
- if ( !strncmp( model, "IBM,LongTrail", 13 ) )
- {
+ if (!strncmp(model, "IBM,LongTrail", 13)) {
/* VLSI VAS96011/12 `Golden Gate 2' */
/* Memory banks */
sdramen = (in_le32((unsigned *)(GG2_PCI_CONFIG_BASE+
@@ -146,17 +146,17 @@
model = "Reserved";
break;
}
- len += sprintf(buffer+len, "memory bank %d\t: %s %s\n", i, model,
- gg2_memtypes[sdramen ? 1 : ((t>>1) & 3)]);
+ seq_printf(m, "memory bank %d\t: %s %s\n", i, model,
+ gg2_memtypes[sdramen ? 1 : ((t>>1) & 3)]);
}
/* L2 cache */
t = in_le32((unsigned *)(GG2_PCI_CONFIG_BASE+GG2_PCI_CC_CTRL));
- len += sprintf(buffer+len, "board l2\t: %s %s (%s)\n",
- gg2_cachesizes[(t>>7) & 3],
- gg2_cachetypes[(t>>2) & 3],
- gg2_cachemodes[t & 3]);
+ seq_printf(m, "board l2\t: %s %s (%s)\n",
+ gg2_cachesizes[(t>>7) & 3],
+ gg2_cachetypes[(t>>2) & 3],
+ gg2_cachemodes[t & 3]);
}
- return len;
+ return 0;
}
/*
@@ -263,13 +263,6 @@
*/
sio_init();
- /*
- * Setup the console operations
- */
-#ifdef CONFIG_DUMMY_CONSOLE
- conswitchp = &dummy_con;
-#endif
-
/* Get the event scan rate for the rtas so we know how
* often it expects a heartbeat. -- Cort
*/
@@ -328,13 +321,8 @@
chrp_irq_cannonicalize(u_int irq)
{
if (irq == 2)
- {
return 9;
- }
- else
- {
- return irq;
- }
+ return irq;
}
void __init chrp_init_IRQ(void)
@@ -471,8 +459,8 @@
isa_io_base = CHRP_ISA_IO_BASE; /* default value */
ppc_md.setup_arch = chrp_setup_arch;
- ppc_md.setup_residual = NULL;
- ppc_md.get_cpuinfo = chrp_get_cpuinfo;
+ ppc_md.show_percpuinfo = of_show_percpuinfo;
+ ppc_md.show_cpuinfo = chrp_show_cpuinfo;
ppc_md.irq_cannonicalize = chrp_irq_cannonicalize;
#ifndef CONFIG_POWER4
ppc_md.init_IRQ = chrp_init_IRQ;
Index: pmac_setup.c
===================================================================
RCS file: /cvsroot/linuxconsole/ruby/linux/arch/ppc/kernel/pmac_setup.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- pmac_setup.c 2001/10/06 16:11:13 1.5
+++ pmac_setup.c 2001/12/26 17:28:11 1.6
@@ -1,5 +1,5 @@
/*
- * BK Id: SCCS/s.pmac_setup.c 1.39 09/08/01 15:47:42 paulus
+ * BK Id: SCCS/s.pmac_setup.c 1.43 11/13/01 21:26:07 paulus
*/
/*
* linux/arch/ppc/kernel/setup.c
@@ -47,6 +47,7 @@
#include <linux/adb.h>
#include <linux/cuda.h>
#include <linux/pmu.h>
+#include <linux/seq_file.h>
#include <asm/processor.h>
#include <asm/sections.h>
@@ -133,36 +134,56 @@
}
#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
-pmac_get_cpuinfo(char *buffer)
+pmac_show_cpuinfo(struct seq_file *m)
{
- int len;
struct device_node *np;
char *pp;
int plen;
/* find motherboard type */
- len = sprintf(buffer, "machine\t\t: ");
+ seq_printf(m, "machine\t\t: ");
np = find_devices("device-tree");
if (np != NULL) {
pp = (char *) get_property(np, "model", NULL);
if (pp != NULL)
- len += sprintf(buffer+len, "%s\n", pp);
+ seq_printf(m, "%s\n", pp);
else
- len += sprintf(buffer+len, "PowerMac\n");
+ seq_printf(m, "PowerMac\n");
pp = (char *) get_property(np, "compatible", &plen);
if (pp != NULL) {
- len += sprintf(buffer+len, "motherboard\t:");
+ seq_printf(m, "motherboard\t:");
while (plen > 0) {
int l = strlen(pp) + 1;
- len += sprintf(buffer+len, " %s", pp);
+ seq_printf(m, " %s", pp);
plen -= l;
pp += l;
}
- buffer[len++] = '\n';
+ seq_printf(m, "\n");
}
} else
- len += sprintf(buffer+len, "PowerMac\n");
+ seq_printf(m, "PowerMac\n");
/* find l2 cache info */
np = find_devices("l2-cache");
@@ -173,22 +194,21 @@
get_property(np, "i-cache-size", NULL);
unsigned int *dc = (unsigned int *)
get_property(np, "d-cache-size", NULL);
- len += sprintf(buffer+len, "L2 cache\t:");
+ seq_printf(m, "L2 cache\t:");
has_l2cache = 1;
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 {
if (ic)
- len += sprintf(buffer+len, " %dK instruction",
- *ic / 1024);
+ seq_printf(m, " %dK instruction", *ic / 1024);
if (dc)
- len += sprintf(buffer+len, "%s %dK data",
- (ic? " +": ""), *dc / 1024);
+ seq_printf(m, "%s %dK data",
+ (ic? " +": ""), *dc / 1024);
}
pp = get_property(np, "ram-type", NULL);
if (pp)
- len += sprintf(buffer+len, " %s", pp);
- buffer[len++] = '\n';
+ seq_printf(m, " %s", pp);
+ seq_printf(m, "\n");
}
/* find ram info */
@@ -203,8 +223,7 @@
for (n /= sizeof(struct reg_property); n > 0; --n)
total += (reg++)->size;
- len += sprintf(buffer+len, "memory\t\t: %luMB\n",
- total >> 20);
+ seq_printf(m, "memory\t\t: %luMB\n", total >> 20);
}
}
@@ -216,16 +235,16 @@
unsigned int *l2cr = (unsigned int *)
get_property(np, "l2cr-value", NULL);
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 */
- len += sprintf(buffer+len, "pmac-generation\t: %s\n",
- pmac_newworld ? "NewWorld" : "OldWorld");
+ seq_printf(m, "pmac-generation\t: %s\n",
+ pmac_newworld ? "NewWorld" : "OldWorld");
- return len;
+ return 0;
}
#ifdef CONFIG_SCSI
@@ -238,6 +257,17 @@
#endif
+#ifdef CONFIG_VT
+/*
+ * Dummy mksound function that does nothing.
+ * The real one is in the dmasound driver.
+ */
+static void __pmac
+pmac_mksound(unsigned int hz, unsigned int ticks)
+{
+}
+#endif /* CONFIG_VT */
+
static volatile u32 *sysctrl_regs;
void __init
@@ -686,8 +716,8 @@
DMA_MODE_WRITE = 2;
ppc_md.setup_arch = pmac_setup_arch;
- ppc_md.setup_residual = NULL;
- ppc_md.get_cpuinfo = pmac_get_cpuinfo;
+ ppc_md.show_cpuinfo = pmac_show_cpuinfo;
+ ppc_md.show_percpuinfo = of_show_percpuinfo;
ppc_md.irq_cannonicalize = NULL;
ppc_md.init_IRQ = pmac_pic_init;
ppc_md.get_irq = pmac_get_irq; /* Changed later on ... */
Index: prep_setup.c
===================================================================
RCS file: /cvsroot/linuxconsole/ruby/linux/arch/ppc/kernel/prep_setup.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- prep_setup.c 2001/11/13 19:38:22 1.7
+++ prep_setup.c 2001/12/26 17:28:11 1.8
@@ -1,5 +1,5 @@
/*
- * 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
@@ -39,6 +39,7 @@
#include <linux/timex.h>
#include <linux/pci.h>
#include <linux/ide.h>
+#include <linux/seq_file.h>
#include <asm/sections.h>
#include <asm/mmu.h>
@@ -79,7 +80,6 @@
extern void rs_nvram_write_val(int addr,
unsigned char val);
extern void ibm_prep_init(void);
-
extern void prep_find_bridges(void);
extern char saved_command_line[];
@@ -110,107 +110,107 @@
#endif
static int __prep
-prep_get_cpuinfo(char *buffer)
+prep_show_cpuinfo(struct seq_file *m)
{
extern char *Motherboard_map_name;
- int len;
+ int cachew;
#ifdef CONFIG_PREP_RESIDUAL
int i;
#endif
-
-#ifdef CONFIG_SMP
-#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);
+ seq_printf(m, "machine\t\t: PReP %s\n", Motherboard_map_name);
-
- switch ( _prep_type )
- {
+ switch ( _prep_type ) {
case _PREP_IBM:
- if ((*(unsigned char *)0x8000080c) & (1<<6))
- len += sprintf(buffer+len,"Upgrade CPU\n");
- len += sprintf(buffer+len,"L2\t\t: ");
- if ((*(unsigned char *)0x8000080c) & (1<<7))
- {
- len += sprintf(buffer+len,"not present\n");
+ cachew = inw(0x80c);
+ if (cachew & (1<<6))
+ seq_printf(m, "Upgrade CPU\n");
+ seq_printf(m, "L2\t\t: ");
+ if (cachew & (1<<7)) {
+ seq_printf(m, "not present\n");
goto no_l2;
}
- len += sprintf(buffer+len,"%sKb,",
- (((*(unsigned char *)0x8000080d)>>2)&1)
- ? "512" : "256");
- len += sprintf(buffer+len,"%ssync\n",
- ((*(unsigned char *)0x8000080d)>>7) ? "" : "a");
+ seq_printf(m, "%sKb,", (cachew & (1 << 10))? "512" : "256");
+ seq_printf(m, "%ssync\n", (cachew & (1 << 15))? "" : "a");
break;
case _PREP_Motorola:
- len += sprintf(buffer+len,"L2\t\t: ");
- switch(*((unsigned char *)CACHECRBA) & L2CACHE_MASK)
- {
+ cachew = *((unsigned char *)CACHECRBA);
+ seq_printf(m, "L2\t\t: ");
+ switch (cachew & L2CACHE_MASK) {
case L2CACHE_512KB:
- len += sprintf(buffer+len,"512Kb");
+ seq_printf(m, "512Kb");
break;
case L2CACHE_256KB:
- len += sprintf(buffer+len,"256Kb");
+ seq_printf(m, "256Kb");
break;
case L2CACHE_1MB:
- len += sprintf(buffer+len,"1MB");
+ seq_printf(m, "1MB");
break;
case L2CACHE_NONE:
- len += sprintf(buffer+len,"none\n");
+ seq_printf(m, "none\n");
goto no_l2;
break;
default:
- len += sprintf(buffer+len, "%x\n",
- *((unsigned char *)CACHECRBA));
+ seq_printf(m, "%x\n", cachew);
}
- len += sprintf(buffer+len,",parity %s",
- (*((unsigned char *)CACHECRBA) & L2CACHE_PARITY)
- ? "enabled" : "disabled");
+ seq_printf(m, ", parity %s",
+ (cachew & L2CACHE_PARITY)? "enabled" : "disabled");
- len += sprintf(buffer+len, " SRAM:");
+ seq_printf(m, " SRAM:");
- switch ( ((*((unsigned char *)CACHECRBA) & 0xf0) >> 4) & ~(0x3) )
- {
- case 1: len += sprintf(buffer+len,
- "synchronous,parity,flow-through\n");
+ switch ( ((cachew & 0xf0) >> 4) & ~(0x3) ) {
+ case 1: seq_printf(m, "synchronous,parity,flow-through\n");
break;
- case 2: len += sprintf(buffer+len,"asynchronous,no parity\n");
+ case 2: seq_printf(m, "asynchronous,no parity\n");
break;
- case 3: len += sprintf(buffer+len,"asynchronous,parity\n");
+ case 3: seq_printf(m, "asynchronous,parity\n");
break;
- default:len += sprintf(buffer+len,
- "synchronous,pipelined,no parity\n");
+ default:seq_printf(m, "synchronous,pipelined,no parity\n");
break;
}
break;
default:
break;
}
-
-
+
no_l2:
-#ifndef CONFIG_PREP_RESIDUAL
- return len;
-#else
- if ( res->ResidualLength == 0 )
- return len;
-
- /* print info about SIMMs */
- 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,
+#ifdef CONFIG_PREP_RESIDUAL
+ if (res->ResidualLength == 0) {
+ /* print info about SIMMs */
+ seq_printf(m, "simms\t\t: ");
+ for (i = 0; (res->ActualNumMemories) && (i < MAX_MEMS); i++) {
+ if (res->Memories[i].SIMMSize != 0)
+ seq_printf(m, "%d:%ldM ", i,
(res->Memories[i].SIMMSize > 1024) ?
res->Memories[i].SIMMSize>>20 :
res->Memories[i].SIMMSize);
+ }
+ seq_printf(m, "\n");
}
- len += sprintf(buffer+len,"\n");
- return len;
#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
@@ -607,26 +607,6 @@
}
}
-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
prep_irq_cannonicalize(u_int irq)
{
@@ -831,11 +811,8 @@
unsigned long r6, unsigned long r7)
{
#ifdef CONFIG_PREP_RESIDUAL
- RESIDUAL *old_res = (RESIDUAL *)(r3 + KERNELBASE);
-
/* make a copy of residual data */
- if ( r3 )
- {
+ if ( r3 ) {
memcpy((void *)res,(void *)(r3+KERNELBASE),
sizeof(RESIDUAL));
}
@@ -879,8 +856,8 @@
}
ppc_md.setup_arch = prep_setup_arch;
- ppc_md.setup_residual = prep_setup_residual;
- ppc_md.get_cpuinfo = prep_get_cpuinfo;
+ ppc_md.show_percpuinfo = prep_show_percpuinfo;
+ ppc_md.show_cpuinfo = prep_show_cpuinfo;
ppc_md.irq_cannonicalize = prep_irq_cannonicalize;
ppc_md.init_IRQ = prep_init_IRQ;
/* this gets changed later on if we have an OpenPIC -- Cort */
|