[BACK]Return to cpu.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / arch / pmax / pmax

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/sys/arch/pmax/pmax/cpu.c between version 1.10 and 1.10.4.3

version 1.10, 1998/01/12 20:12:38 version 1.10.4.3, 1999/11/12 11:07:20
Line 1 
Line 1 
 /*      $NetBSD$        */  /* $NetBSD$ */
   
 /*  /*
  * Copyright (c) 1994, 1995 Carnegie-Mellon University.   * Copyright (c) 1994, 1995 Carnegie-Mellon University.
Line 34 
Line 34 
 #include <machine/cpu.h>  #include <machine/cpu.h>
 #include <machine/autoconf.h>  #include <machine/autoconf.h>
   
 /* Definition of the driver for autoconfig. */  static int  cpumatch __P((struct device *, struct cfdata *, void *));
 static int      cpumatch(struct device *, struct cfdata *, void *);  static void cpuattach __P((struct device *, struct device *, void *));
 static void     cpuattach(struct device *, struct device *, void *);  
   
 struct cfattach cpu_ca = {  struct cfattach cpu_ca = {
         sizeof (struct device), cpumatch, cpuattach          sizeof (struct device), cpumatch, cpuattach
 };  };
   
 extern struct cfdriver cpu_cd;  extern struct cfdriver cpu_cd;
   
 extern void cpu_identify __P((void));  extern void cpu_identify __P((void));
   
   
 static int  static int
 cpumatch(parent, cf, aux)  cpumatch(parent, cf, aux)
         struct device *parent;          struct device *parent;
Line 55  cpumatch(parent, cf, aux)
Line 52  cpumatch(parent, cf, aux)
 {  {
         struct confargs *ca = aux;          struct confargs *ca = aux;
   
   
         /* make sure that we're looking for a CPU. */          /* make sure that we're looking for a CPU. */
         if (strcmp(ca->ca_name, cpu_cd.cd_name) != 0) {          if (strcmp(ca->ca_name, cpu_cd.cd_name) != 0) {
                 return (0);                  return (0);
Line 65  cpumatch(parent, cf, aux)
Line 61  cpumatch(parent, cf, aux)
   
 static void  static void
 cpuattach(parent, dev, aux)  cpuattach(parent, dev, aux)
         struct device *parent;          struct device *parent, *dev;
         struct device *dev;  
         void *aux;          void *aux;
 {  {
           printf("\n");
         printf(": ");  
   
         cpu_identify();          cpu_identify();
 }  }
   
   #if 0
   #include <mips/locore.h>
   
   extern int mips1_icsize __P((void));
   extern int mips1_dcsize __P((void));
   extern int mips1_iflush __P((vaddr_t, vsize_t));
   extern int mips1_dflush __P((vaddr_t, vsize_t));
   
   #define IC_LINE(rr)     (16 << ((rr) >> 5) & 1)
   #define IC_SIZE(rr)     (4*1024 << ((rr) >> 12) & 7)
   #define DC_LINE(rr)     (16 << ((rr) >> 4) & 1)
   #define DC_SIZE(rr)     (4*1024 << ((rr) >>  9) & 7)
   #define L2_EXIST(rr)    ((rr) & 0x00020000)
   #define L2_LINE(rr)     (4 << ((rr) >> 2) & 3)
   #define L2_SIZE(rr)     (512*1024 << (((rr) >> 20) & 3))
   #define L2_SPLITTED(rr) ((rr) & 0x00200000)
   
   struct cpuinfo {
           int     arch;
           int     cpuprid;
           int     tlbsize;
           int     multiway;               /* multiway assoc. primary cache */
   };
   struct cpuinfo cpuinfo;
   
   struct cacheinfo {
           int     c_physical;             /* true => cache is physical */
           int     c_split;                /* true => cache is split */
           int     ic_totalsize;           /* instruction cache */
           int     ic_enabled;
           int     ic_linesize;
           int     dc_totalsize;           /* data cache */
           int     dc_enabled;
           int     dc_linesize;
           int     sc_totalsize;           /* secondary cache */
           int     sc_linesize;
           int     sc_enabled;
   };
   struct cacheinfo cacheinfo;
   
   struct cpuops {
           void    (*flush_tlbentire) __P((void));
           void    (*flush_tlbsingle) __P((vaddr_t));
           void    (*flush_icache) __P((vaddr_t, vsize_t));
           void    (*flush_dcache) __P((vaddr_t, vsize_t));
           void    (*flush_pcache) __P((void));
           void    (*flush_scache) __P((void));
           void    (*drain_wb) __P((void));
           void    (*set_asid) __P((int));
   };
   
   void cpuparams __P((void));
   void mips1_flushcache __P((void));
   
   void
   cpuparams()
   {
           u_int32_t cp0r16; /* CP0 config register */
   
           switch (cpu_id.cpu.cp_imp) {
           case MIPS_R2000:
           case MIPS_R3000:
                   cpuinfo.arch = 1;
                   cacheinfo.c_physical = 1;
                   cacheinfo.ic_totalsize = mips1_icsize();
                   cacheinfo.dc_totalsize = mips1_dcsize();
                   cacheinfo.sc_totalsize = 0;
                   break;
   
           case MIPS_R4000:
                   cpuinfo.arch = 3;
                   cpuinfo.multiway = 0;
                   goto mips3descenders;
           case MIPS_R4200:
           case MIPS_R4300:
           case MIPS_R4100:
                   cpuinfo.arch = 3;
                   cpuinfo.multiway = 0;
                   goto mips3descenders;
           case MIPS_R4600:
           case MIPS_R4700:
                   cpuinfo.arch = 3;
                   cpuinfo.multiway = 2;
                   goto mips3descenders;
           case MIPS_R5000:
           case MIPS_R10000:
                   cpuinfo.arch = 4;
                   cpuinfo.multiway = 2;
                   goto mips3descenders;
   
           mips3descenders:
                   __asm __volatile("mtc0 %0, $16" : "=r"(cp0r16));
                   cacheinfo.c_physical = 0;
                   cacheinfo.c_split = 0;
                   cacheinfo.ic_linesize =  IC_LINE(cp0r16);
                   cacheinfo.ic_totalsize = IC_SIZE(cp0r16);
                   cacheinfo.dc_linesize =  DC_LINE(cp0r16);
                   cacheinfo.dc_totalsize = DC_SIZE(cp0r16);
                   cacheinfo.sc_totalsize = L2_EXIST(cp0r16) ? -1 : 0;
                   cacheinfo.sc_linesize =  L2_LINE(cp0r16);
                   if (cacheinfo.sc_totalsize == -1 && cpuinfo.arch == 4)
                           cacheinfo.sc_totalsize = L2_SIZE(cp0r16);
                   if (cpuinfo.arch == 3)
                           cacheinfo.c_split = L2_SPLITTED(cp0r16);
                   break;
           }
           cpu_arch = cpuinfo.arch; /* XXX */
   }
   
   void
   mips1_flushcache()
   {
           mips1_dflush(0x80000000, cacheinfo.dc_totalsize);
           mips1_iflush(0x80000000, cacheinfo.ic_totalsize);
   }
   #endif

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.10.4.3

CVSweb <webmaster@jp.NetBSD.org>