1/* 2 * ip22-system.c: Probe the system type using ARCS prom interface library. 3 * 4 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com) 5 */ 6#include <linux/init.h> 7#include <linux/kernel.h> 8#include <linux/types.h> 9#include <linux/string.h> 10 11#include <asm/cpu.h> 12#include <asm/sgi/sgi.h> 13#include <asm/sgialib.h> 14 15enum sgi_mach sgimach; 16 17struct smatch { 18 char *name; 19 int type; 20}; 21 22static struct smatch sgi_cputable[] = {{ 23 .name = "MIPS-R2000", 24 .type = CPU_R2000, 25},{ 26 .name = "MIPS-R3000", 27 .type = CPU_R3000, 28},{ 29 .name = "MIPS-R3000A", 30 .type = CPU_R3000A, 31},{ 32 .name = "MIPS-4000", 33 .type = CPU_R4000SC, 34},{ 35 .name = "MIPS-R4400", 36 .type = CPU_R4400SC, 37},{ 38 .name = "MIPS-R4600", 39 .type = CPU_R4600, 40},{ 41 .name = "MIPS-R8000", 42 .type = CPU_R8000, 43},{ 44 .name = "MIPS-R5000", 45 .type = CPU_R5000, 46},{ 47 .name = "MIPS-R5000A", 48 .type = CPU_R5000A, 49},{ 50 .name = "MIPS-R10000", 51 .type = CPU_R10000, 52}}; 53 54static int __init string_to_cpu(char *s) 55{ 56 ULONG cnt; 57 char c; 58 int i; 59 60 for(i = 0; i < (sizeof(sgi_cputable) / sizeof(struct smatch)); i++) { 61 if(!strcmp(s, sgi_cputable[i].name)) 62 return sgi_cputable[i].type; 63 } 64 prom_printf("\nYeee, could not determine MIPS cpu type <%s>\n", s); 65 prom_printf("press a key to reboot\n"); 66 ArcRead(0, &c, 1, &cnt); 67 ArcEnterInteractiveMode(); 68 return 0; 69} 70 71/* 72 * We' call this early before loadmmu(). If we do the other way around 73 * the firmware will crash and burn. 74 */ 75void __init sgi_sysinit(void) 76{ 77 pcomponent *p, *toplev, *cpup = 0; 78 int cputype = -1; 79 ULONG cnt; 80 char c; 81 82 83 /* The root component tells us what machine architecture we 84 * have here. 85 */ 86 p = ArcGetChild(PROM_NULL_COMPONENT); 87 88 /* Now scan for cpu(s). */ 89 printk(KERN_INFO); 90 toplev = p = ArcGetChild(p); 91 while(p) { 92 int ncpus = 0; 93 94 if(p->type == Cpu) { 95 if(++ncpus > 1) { 96 prom_printf("\nYeee, SGI MP not ready yet\n"); 97 prom_printf("press a key to reboot\n"); 98 ArcRead(0, &c, 1, &cnt); 99 ArcEnterInteractiveMode(); 100 } 101 printk("CPU: %s ", (char *)p->iname); 102 cpup = p; 103 cputype = string_to_cpu((char *)cpup->iname); 104 } 105 p = ArcGetPeer(p); 106 } 107 if (cputype == -1) { 108 prom_printf("\nYeee, could not find cpu ARCS component\n"); 109 prom_printf("press a key to reboot\n"); 110 ArcRead(0, &c, 1, &cnt); 111 ArcEnterInteractiveMode(); 112 } 113 p = ArcGetChild(cpup); 114 while(p) { 115 switch(p->class) { 116 case processor: 117 switch(p->type) { 118 case Fpu: 119 printk("FPU<%s> ", (char *)p->iname); 120 break; 121 122 default: 123 break; 124 }; 125 break; 126 127 case cache: 128 switch(p->type) { 129 case picache: 130 printk("ICACHE "); 131 break; 132 133 case pdcache: 134 printk("DCACHE "); 135 break; 136 137 case sccache: 138 printk("SCACHE "); 139 break; 140 141 default: 142 break; 143 144 }; 145 break; 146 147 default: 148 break; 149 }; 150 p = ArcGetPeer(p); 151 } 152 printk("\n"); 153} 154