patch-2.3.20 linux/arch/ppc/kernel/ppc_htab.c
Next file: linux/arch/ppc/kernel/ppc_ksyms.c
Previous file: linux/arch/ppc/kernel/ppc8xx_pic.h
Back to the patch index
Back to the overall index
- Lines: 102
- Date:
Thu Oct 7 10:17:08 1999
- Orig file:
v2.3.19/linux/arch/ppc/kernel/ppc_htab.c
- Orig date:
Mon Jun 28 13:40:39 1999
diff -u --recursive --new-file v2.3.19/linux/arch/ppc/kernel/ppc_htab.c linux/arch/ppc/kernel/ppc_htab.c
@@ -1,5 +1,5 @@
/*
- * $Id: ppc_htab.c,v 1.28 1999/06/27 10:53:32 davem Exp $
+ * $Id: ppc_htab.c,v 1.29 1999/09/10 05:05:50 paulus Exp $
*
* PowerPC hash table management proc entry. Will show information
* about the current hash table and will allow changes to it.
@@ -256,6 +256,8 @@
return 0;
if (n > strlen(buffer) - *ppos)
n = strlen(buffer) - *ppos;
+ if (n > count)
+ n = count;
copy_to_user(buf, buffer + *ppos, n);
*ppos += n;
return n;
@@ -533,7 +535,21 @@
int vleft, first=1, len, left, val;
#define TMPBUFLEN 256
char buf[TMPBUFLEN], *p;
-
+ static const char *sizestrings[4] = {
+ "unknown size", "256KB", "512KB", "1MB"
+ };
+ static const char *clockstrings[8] = {
+ "clock disabled", "+1 clock", "+1.5 clock", "reserved(3)",
+ "+2 clock", "+2.5 clock", "+3 clock", "reserved(7)"
+ };
+ static const char *typestrings[4] = {
+ "flow-through burst SRAM", "reserved SRAM",
+ "pipelined burst SRAM", "pipelined late-write SRAM"
+ };
+ static const char *holdstrings[4] = {
+ "0.5", "1.0", "(reserved2)", "(reserved3)"
+ };
+
if ( (_get_PVR() >> 16) != 8) return -EFAULT;
if ( /*!table->maxlen ||*/ (filp->f_pos && !write)) {
@@ -586,55 +602,13 @@
p += sprintf(p, " %s",
(val&0x80000000)?"enabled":"disabled");
p += sprintf(p,",%sparity",(val&0x40000000)?"":"no ");
-
- switch( (val >> 28) & 0x3 )
- {
- case 1: p += sprintf(p,",256Kb");
- break;
- case 2: p += sprintf(p,",512Kb");
- break;
- case 3: p += sprintf(p,",1M");
- break;
- default: p += sprintf(p,",unknown size");
- break;
- }
-
-
- switch( (val >> 25) & 0x7 )
- {
- case 0: p += sprintf(p,",clock disabled");
- break;
- case 1: p += sprintf(p,",+1 clock");
- break;
- case 2: p += sprintf(p,",+1.5 clock");
- break;
- case 7:
- case 3: p += sprintf(p,",reserved clock");
- break;
- case 4: p += sprintf(p,",+2 clock");
- break;
- case 5: p += sprintf(p,",+2.5 clock");
- break;
- case 6: p += sprintf(p,",+3 clock");
- break;
- }
-
- switch( (val >> 23) & 0x2 )
- {
- case 0: p += sprintf(p,",flow-through burst SRAM");
- break;
- case 1: p += sprintf(p,",reserved SRAM");
- break;
- case 2: p += sprintf(p,",pipelined burst SRAM");
- break;
- case 3: p += sprintf(p,",pipelined late-write SRAM");
- break;
- }
-
- p += sprintf(p,"%s",(val>>22)?"":",data only");
- p += sprintf(p,"%s",(val>>20)?",ZZ enabled":"");
- p += sprintf(p,",%s",(val>>19)?"write-through":"copy-back");
- p += sprintf(p,",%sns hold",(val>>16)?"1.0":"0.5");
+ p += sprintf(p, ",%s", sizestrings[(val >> 28) & 3]);
+ p += sprintf(p, ",%s", clockstrings[(val >> 25) & 7]);
+ p += sprintf(p, ",%s", typestrings[(val >> 23) & 0x2]);
+ p += sprintf(p,"%s",(val>>22)&1?"":",data only");
+ p += sprintf(p,"%s",(val>>20)&1?",ZZ enabled":"");
+ p += sprintf(p,",%s",(val>>19)&1?"write-through":"copy-back");
+ p += sprintf(p,",%sns hold", holdstrings[(val>>16)&3]);
p += sprintf(p,"\n");
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)