root/arch/sparc/kernel/idprom.c

/* [previous][next][first][last][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. sparc_display_systype
  2. get_idprom
  3. find_vac_size
  4. find_vac_linesize
  5. find_vac_hwflushes

   1 /* idprom.c: Routines to load the idprom into kernel addresses and
   2  *           interpret the data contained within.
   3  *
   4  * Because they use the IDPROM's machine type field, some of the
   5  * virtual address cache probings on the sun4c are done here.
   6  *
   7  * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
   8  */
   9 
  10 #include <linux/kernel.h>
  11 
  12 #include <asm/types.h>
  13 #include <asm/oplib.h>
  14 #include <asm/idprom.h>
  15 #include <asm/machines.h>  /* Fun with Sun released architectures. */
  16 #include <asm/system.h>    /* For halt() macro */
  17 
  18 struct idp_struct *idprom;
  19 static struct idp_struct idprom_buff;
  20 
  21 /* Here is the master table of Sun machines which use some implementation
  22  * of the Sparc CPU and have a meaningful IDPROM machtype value that we
  23  * know about.  See asm-sparc/machines.h for imperical constants.
  24  */
  25 struct Sun_Machine_Models Sun_Machines[NUM_SUN_MACHINES] = {
  26 /* First, Sun4's */
  27 { "Sun 4/100 Series", (SM_SUN4 | SM_4_110) },
  28 { "Sun 4/200 Series", (SM_SUN4 | SM_4_260) },
  29 { "Sun 4/300 Series", (SM_SUN4 | SM_4_330) },
  30 { "Sun 4/400 Series", (SM_SUN4 | SM_4_470) },
  31 /* Now, Sun4c's */
  32 { "Sun4c SparcStation 1", (SM_SUN4C | SM_4C_SS1) },
  33 { "Sun4c SparcStation IPC", (SM_SUN4C | SM_4C_IPC) },
  34 { "Sun4c SparcStation 1+", (SM_SUN4C | SM_4C_SS1PLUS) },
  35 { "Sun4c SparcStation SLC", (SM_SUN4C | SM_4C_SLC) },
  36 { "Sun4c SparcStation 2", (SM_SUN4C | SM_4C_SS2) },
  37 { "Sun4c SparcStation ELC", (SM_SUN4C | SM_4C_ELC) },
  38 { "Sun4c SparcStation IPX", (SM_SUN4C | SM_4C_IPX) },
  39 /* Finally, early Sun4m's */
  40 { "Sun4m SparcSystem600", (SM_SUN4M | SM_4M_SS60) },
  41 { "Sun4m SparcStation10", (SM_SUN4M | SM_4M_SS50) },
  42 { "Sun4m SparcStation5", (SM_SUN4M | SM_4M_SS40) },
  43 /* One entry for the OBP arch's which are sun4d, sun4e, and newer sun4m's */
  44 { "Sun4M OBP based system", (SM_SUN4M_OBP | 0x0) } };
  45 
  46 void
  47 sparc_display_systype(unsigned char machtyp)
     /* [previous][next][first][last][top][bottom][index][help] */
  48 {
  49         char system_name[128];
  50         int i;
  51 
  52         for(i = 0; i<NUM_SUN_MACHINES; i++) {
  53                 if(Sun_Machines[i].id_machtype == machtyp) {
  54                         if(machtyp!=(SM_SUN4M_OBP | 0x0)) {
  55                                 printk("TYPE: %s\n", Sun_Machines[i].name);
  56                                 break;
  57                         } else {
  58                                 prom_getproperty(prom_root_node, "banner-name",
  59                                                  system_name, sizeof(system_name));
  60                                 printk("TYPE: %s\n", system_name);
  61                                 break;
  62                         }
  63                 }
  64         }
  65         if(i == NUM_SUN_MACHINES)
  66                 printk("Uh oh, IDPROM had bogus id_machtype value <%x>\n", machtyp);
  67         return;
  68 }
  69 
  70 void
  71 get_idprom(void)
     /* [previous][next][first][last][top][bottom][index][help] */
  72 {
  73         prom_getidp((char *) &idprom_buff, sizeof(idprom_buff));
  74 
  75         idprom = &idprom_buff;
  76 
  77         sparc_display_systype(idprom->id_machtype);
  78 
  79         printk("Ethernet address: %x:%x:%x:%x:%x:%x\n",
  80                idprom->id_eaddr[0], idprom->id_eaddr[1], idprom->id_eaddr[2],
  81                idprom->id_eaddr[3], idprom->id_eaddr[4], idprom->id_eaddr[5]);
  82 
  83         return;
  84 }
  85 
  86 /* find_vac_size() returns the number of bytes in the VAC (virtual
  87  * address cache) on this machine.
  88  */
  89 
  90 int
  91 find_vac_size(void)
     /* [previous][next][first][last][top][bottom][index][help] */
  92 {
  93         int vac_prop_len;
  94         int vacsize = 0;
  95 
  96         vac_prop_len = prom_getproplen(prom_root_node, "vac-size");
  97         if(vac_prop_len != -1) {
  98                 vacsize = prom_getint(prom_root_node, "vac-size");
  99                 return vacsize;
 100         } else {
 101                 switch(idprom->id_machtype) {
 102                 case (SM_SUN4C | SM_4C_SS1):     /* SparcStation1 */
 103                 case (SM_SUN4C | SM_4C_IPC):     /* SparcStation IPX */
 104                 case (SM_SUN4C | SM_4C_SS1PLUS): /* SparcStation1+ */
 105                 case (SM_SUN4C | SM_4C_SLC):     /* SparcStation SLC */
 106                 case (SM_SUN4C | SM_4C_SS2):     /* SparcStation2 Cache-Chip BUG! */
 107                 case (SM_SUN4C | SM_4C_ELC):     /* SparcStation ELC */
 108                 case (SM_SUN4C | SM_4C_IPX):     /* SparcStation IPX */
 109                         return 65536;
 110                 default:
 111                         printk("find_vac_size: Can't determine size of VAC, bailing out...\n");
 112                         halt();
 113                         break;
 114                 };
 115         };
 116         return -1;
 117 }
 118 
 119 /* find_vac_linesize() returns the size in bytes of the VAC linesize */ 
 120 
 121 int
 122 find_vac_linesize(void)
     /* [previous][next][first][last][top][bottom][index][help] */
 123 {
 124         int vac_prop_len;
 125 
 126         vac_prop_len = prom_getproplen(prom_root_node, "vac-linesize");
 127 
 128         if(vac_prop_len != -1)
 129                 return prom_getint(prom_root_node, "vac-linesize");
 130         else {
 131                 switch(idprom->id_machtype) {
 132                 case (SM_SUN4C | SM_4C_SS1):     /* SparcStation1 */
 133                 case (SM_SUN4C | SM_4C_IPC):     /* SparcStation IPC */
 134                 case (SM_SUN4C | SM_4C_SS1PLUS): /* SparcStation1+ */
 135                 case (SM_SUN4C | SM_4C_SLC):     /* SparcStation SLC */
 136                         return 16;
 137                 case (SM_SUN4C | SM_4C_SS2):     /* SparcStation2 Cache-Chip BUG! */
 138                 case (SM_SUN4C | SM_4C_ELC):     /* SparcStation ELC */
 139                 case (SM_SUN4C | SM_4C_IPX):     /* SparcStation IPX */
 140                         return 32;
 141                 default:
 142                         printk("find_vac_linesize: Can't determine VAC linesize, bailing out...\n");
 143                         halt();
 144                         break;
 145                 };
 146         };
 147         return -1;
 148 }
 149 
 150 int
 151 find_vac_hwflushes(void)
     /* [previous][next][first][last][top][bottom][index][help] */
 152 {
 153         register int len;
 154         int tmp1, tmp2;
 155 
 156         /* Sun 4/75 has typo in prom_node, it's a dash instead of an underscore
 157          * in the property name. :-(
 158          */
 159         len = prom_getproperty(prom_root_node, "vac_hwflush",
 160                                (char *) &tmp1, sizeof(int));
 161         if(len != 4) tmp1=0;
 162 
 163         len = prom_getproperty(prom_root_node, "vac-hwflush",
 164                                (char *) &tmp2, sizeof(int));
 165         if(len != 4) tmp2=0;
 166 
 167         return (tmp1|tmp2);
 168 }
 169 

/* [previous][next][first][last][top][bottom][index][help] */