if you really really need to know that your cpu cache has 48 fully 
associative entries, go consult the spec sheet.  otherwise, save some 
electrons.

i'm running i386 atm (which doesn't print this junk btw), so diff is 
untested.

Index: cacheinfo.c
===================================================================
RCS file: /home/tedu/cvs/src/sys/arch/amd64/amd64/cacheinfo.c,v
retrieving revision 1.5
diff -u -r1.5 cacheinfo.c
--- cacheinfo.c 16 Feb 2009 15:50:05 -0000      1.5
+++ cacheinfo.c 28 Nov 2010 02:11:02 -0000
@@ -35,94 +35,6 @@
 #include <machine/cpu.h>
 #include <machine/specialreg.h>
 
-static char *print_cache_config(struct cpu_info *, int, char *, char *);
-static char *print_tlb_config(struct cpu_info *, int, char *, char *);
-
-static char *
-print_cache_config(struct cpu_info *ci, int cache_tag, char *name, char *sep)
-{
-       struct x86_cache_info *cai = &ci->ci_cinfo[cache_tag];
-
-       if (cai->cai_totalsize == 0)
-               return sep;
-
-       if (sep == NULL)
-               printf("%s: ", ci->ci_dev->dv_xname);
-       else
-               printf("%s", sep);
-
-       if (cai->cai_string != NULL)
-               printf("%s ", cai->cai_string);
-       else if (cai->cai_totalsize >= 1024*1024)
-               printf("%dMB %db/line ", cai->cai_totalsize / 1024 / 1024,
-                   cai->cai_linesize);
-       else
-               printf("%dKB %db/line ", cai->cai_totalsize / 1024,
-                   cai->cai_linesize);
-
-       switch (cai->cai_associativity) {
-       case    0:
-               printf("disabled");
-               break;
-       case    1:
-               printf("direct-mapped");
-               break;
-       case 0xff:
-               printf("fully associative");
-               break;
-       default:
-               printf("%d-way", cai->cai_associativity);
-               break;
-       }
-
-       if (name != NULL)
-               printf(" %s", name);
-
-       return ", ";
-}
-
-static char *
-print_tlb_config(struct cpu_info *ci, int cache_tag, char *name, char *sep)
-{
-       struct x86_cache_info *cai = &ci->ci_cinfo[cache_tag];
-
-       if (cai->cai_totalsize == 0)
-               return sep;
-
-       if (sep == NULL)
-               printf("%s: ", ci->ci_dev->dv_xname);
-       else
-               printf("%s", sep);
-       if (name != NULL)
-               printf("%s ", name);
-
-       if (cai->cai_string != NULL) {
-               printf("%s", cai->cai_string);
-       } else {
-               if (cai->cai_linesize >= 1024*1024)
-                       printf("%d %dMB entries ", cai->cai_totalsize,
-                           cai->cai_linesize / 1024 / 1024);
-               else
-                       printf("%d %dKB entries ", cai->cai_totalsize,
-                           cai->cai_linesize / 1024);
-               switch (cai->cai_associativity) {
-               case 0:
-                       printf("disabled");
-                       break;
-               case 1:
-                       printf("direct-mapped");
-                       break;
-               case 0xff:
-                       printf("fully associative");
-                       break;
-               default:
-                       printf("%d-way", cai->cai_associativity);
-                       break;
-               }
-       }
-       return ", ";
-}
-
 const struct x86_cache_info *
 cache_info_lookup(const struct x86_cache_info *cai, u_int8_t desc)
 {
@@ -237,34 +149,4 @@
                cai->cai_associativity = cp->cai_associativity;
        else
                cai->cai_associativity = 0;     /* XXX Unknown/reserved */
-}
-
-void
-x86_print_cacheinfo(struct cpu_info *ci)
-{
-       char *sep;
-
-       sep = NULL;
-       if (ci->ci_cinfo[CAI_ICACHE].cai_totalsize != 0 ||
-           ci->ci_cinfo[CAI_DCACHE].cai_totalsize != 0) {
-               sep = print_cache_config(ci, CAI_ICACHE, "I-cache", NULL);
-               sep = print_cache_config(ci, CAI_DCACHE, "D-cache", sep);
-       }
-       if (ci->ci_cinfo[CAI_L2CACHE].cai_totalsize != 0) {
-               sep = print_cache_config(ci, CAI_L2CACHE, "L2 cache", sep);
-               if (sep != NULL)
-                       printf("\n");
-       }
-       if (ci->ci_cinfo[CAI_ITLB].cai_totalsize != 0) {
-               sep = print_tlb_config(ci, CAI_ITLB, "ITLB", NULL);
-               sep = print_tlb_config(ci, CAI_ITLB2, NULL, sep);
-               if (sep != NULL)
-                       printf("\n");
-       }
-       if (ci->ci_cinfo[CAI_DTLB].cai_totalsize != 0) {
-               sep = print_tlb_config(ci, CAI_DTLB, "DTLB", NULL);
-               sep = print_tlb_config(ci, CAI_DTLB2, NULL, sep);
-               if (sep != NULL)
-                       printf("\n");
-       }
 }
Index: identcpu.c
===================================================================
RCS file: /home/tedu/cvs/src/sys/arch/amd64/amd64/identcpu.c,v
retrieving revision 1.30
diff -u -r1.30 identcpu.c
--- identcpu.c  7 Sep 2010 16:22:48 -0000       1.30
+++ identcpu.c  28 Nov 2010 02:10:44 -0000
@@ -354,8 +354,6 @@
                        printf(",%s", cpu_ecpuid_features[i].str);
        printf("\n");
 
-       x86_print_cacheinfo(ci);
-
 #ifndef SMALL_KERNEL
        if (pnfeatset > 0x80000007) {
                CPUID(0x80000007, dummy, dummy, dummy, pnfeatset);

Reply via email to