1 /* $NetBSD: findcpu.c,v 1.11 2001/05/01 13:18:27 ragge Exp $ */ 2 /* 3 * Copyright (c) 1994, 1998 Ludd, University of Lule}, Sweden. 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 3. All advertising materials mentioning features or use of this software 15 * must display the following acknowledgement: 16 * This product includes software developed at Ludd, University of Lule}. 17 * 4. The name of the author may not be used to endorse or promote products 18 * derived from this software without specific prior written permission 19 * 20 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 21 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 22 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 23 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 24 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 25 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 */ 31 32 33 #include <sys/param.h> 34 #include <sys/device.h> 35 36 #include <machine/sid.h> 37 #include <machine/nexus.h> 38 #include <machine/mtpr.h> 39 #include <machine/cpu.h> 40 41 /* 42 * We set up some information about the machine we're 43 * running on and thus initializes/uses vax_cputype and vax_boardtype. 44 * There should be no need to change/reinitialize these variables 45 * outside of this routine, they should be read only! 46 */ 47 int vax_cputype; /* highest byte of SID register */ 48 int vax_bustype; /* holds/defines all busses on this machine */ 49 int vax_boardtype; /* machine dependend, combination of SID and SIE */ 50 51 int vax_cpudata; /* contents of the SID register */ 52 int vax_siedata; /* contents of the SIE register */ 53 int vax_confdata; /* machine dependend, configuration/setup data */ 54 55 /* 56 * Try to figure out which type of system this is. 57 */ 58 void 59 findcpu(void) 60 { 61 vax_cpudata = mfpr(PR_SID); 62 vax_cputype = vax_cpudata >> 24; 63 vax_boardtype = vax_cputype << 24; 64 65 switch (vax_cputype) { 66 case VAX_TYP_780: 67 vax_bustype = VAX_SBIBUS; 68 break; 69 case VAX_TYP_750: 70 vax_bustype = VAX_CMIBUS; 71 break; 72 case VAX_TYP_790: 73 vax_bustype = VAX_ABUS; 74 break; 75 76 case VAX_TYP_UV1: 77 vax_bustype = VAX_IBUS; 78 break; 79 80 case VAX_TYP_UV2: 81 case VAX_TYP_CVAX: 82 case VAX_TYP_RIGEL: 83 case VAX_TYP_MARIAH: 84 case VAX_TYP_NVAX: 85 case VAX_TYP_SOC: 86 vax_siedata = *(int *)(0x20040004); /* SIE address */ 87 vax_boardtype |= vax_siedata >> 24; 88 89 switch (vax_boardtype) { 90 case VAX_BTYP_420: /* They are very similar */ 91 case VAX_BTYP_410: 92 case VAX_BTYP_43: 93 case VAX_BTYP_46: 94 case VAX_BTYP_48: 95 case VAX_BTYP_IS1: 96 vax_confdata = *(int *)(0x20020000); 97 case VAX_BTYP_49: 98 vax_bustype = VAX_VSBUS; 99 break; 100 101 case VAX_BTYP_9CC: 102 case VAX_BTYP_9RR: 103 case VAX_BTYP_1202: 104 case VAX_BTYP_1302: 105 vax_bustype = VAX_XMIBUS; 106 break; 107 108 case VAX_BTYP_670: 109 case VAX_BTYP_660: 110 case VAX_BTYP_60: 111 case VAX_BTYP_680: 112 case VAX_BTYP_681: 113 case VAX_BTYP_630: 114 case VAX_BTYP_650: 115 case VAX_BTYP_53: 116 vax_bustype = VAX_IBUS; 117 break; 118 119 } 120 break; 121 122 case VAX_TYP_8SS: 123 vax_boardtype = VAX_BTYP_8000; 124 vax_bustype = VAX_BIBUS; 125 break; 126 127 case VAX_TYP_8NN: 128 vax_boardtype = VAX_BTYP_8800; /* subversion later */ 129 vax_bustype = VAX_NBIBUS; 130 break; 131 132 case VAX_TYP_8PS: 133 vax_boardtype = VAX_BTYP_8PS; 134 vax_bustype = VAX_NBIBUS; 135 break; 136 137 default: 138 /* CPU not supported, just give up */ 139 asm("halt"); 140 } 141 } 142