0001
0002
0003
0004
0005
0006
0007
0008 #include <linux/init.h>
0009 #include <linux/kernel.h>
0010 #include <linux/mc146818rtc.h>
0011 #include <linux/export.h>
0012 #include <linux/string.h>
0013 #include <linux/types.h>
0014
0015 #include <asm/bootinfo.h>
0016
0017 #include <asm/dec/ioasic.h>
0018 #include <asm/dec/ioasic_addrs.h>
0019 #include <asm/dec/kn01.h>
0020 #include <asm/dec/kn02.h>
0021 #include <asm/dec/kn02ba.h>
0022 #include <asm/dec/kn02ca.h>
0023 #include <asm/dec/kn03.h>
0024 #include <asm/dec/kn230.h>
0025 #include <asm/dec/prom.h>
0026 #include <asm/dec/system.h>
0027
0028 #include "dectypes.h"
0029
0030 static const char *dec_system_strings[] = {
0031 [MACH_DSUNKNOWN] "unknown DECstation",
0032 [MACH_DS23100] "DECstation 2100/3100",
0033 [MACH_DS5100] "DECsystem 5100",
0034 [MACH_DS5000_200] "DECstation 5000/200",
0035 [MACH_DS5000_1XX] "DECstation 5000/1xx",
0036 [MACH_DS5000_XX] "Personal DECstation 5000/xx",
0037 [MACH_DS5000_2X0] "DECstation 5000/2x0",
0038 [MACH_DS5400] "DECsystem 5400",
0039 [MACH_DS5500] "DECsystem 5500",
0040 [MACH_DS5800] "DECsystem 5800",
0041 [MACH_DS5900] "DECsystem 5900",
0042 };
0043
0044 const char *get_system_type(void)
0045 {
0046 #define STR_BUF_LEN 64
0047 static char system[STR_BUF_LEN];
0048 static int called = 0;
0049
0050 if (called == 0) {
0051 called = 1;
0052 snprintf(system, STR_BUF_LEN, "Digital %s",
0053 dec_system_strings[mips_machtype]);
0054 }
0055
0056 return system;
0057 }
0058
0059
0060
0061
0062
0063
0064
0065 volatile u8 *dec_rtc_base;
0066
0067 EXPORT_SYMBOL(dec_rtc_base);
0068
0069 static inline void prom_init_kn01(void)
0070 {
0071 dec_kn_slot_base = KN01_SLOT_BASE;
0072 dec_kn_slot_size = KN01_SLOT_SIZE;
0073
0074 dec_rtc_base = (void *)CKSEG1ADDR(dec_kn_slot_base + KN01_RTC);
0075 }
0076
0077 static inline void prom_init_kn230(void)
0078 {
0079 dec_kn_slot_base = KN01_SLOT_BASE;
0080 dec_kn_slot_size = KN01_SLOT_SIZE;
0081
0082 dec_rtc_base = (void *)CKSEG1ADDR(dec_kn_slot_base + KN01_RTC);
0083 }
0084
0085 static inline void prom_init_kn02(void)
0086 {
0087 dec_kn_slot_base = KN02_SLOT_BASE;
0088 dec_kn_slot_size = KN02_SLOT_SIZE;
0089 dec_tc_bus = 1;
0090
0091 dec_rtc_base = (void *)CKSEG1ADDR(dec_kn_slot_base + KN02_RTC);
0092 }
0093
0094 static inline void prom_init_kn02xa(void)
0095 {
0096 dec_kn_slot_base = KN02XA_SLOT_BASE;
0097 dec_kn_slot_size = IOASIC_SLOT_SIZE;
0098 dec_tc_bus = 1;
0099
0100 ioasic_base = (void *)CKSEG1ADDR(dec_kn_slot_base + IOASIC_IOCTL);
0101 dec_rtc_base = (void *)CKSEG1ADDR(dec_kn_slot_base + IOASIC_TOY);
0102 }
0103
0104 static inline void prom_init_kn03(void)
0105 {
0106 dec_kn_slot_base = KN03_SLOT_BASE;
0107 dec_kn_slot_size = IOASIC_SLOT_SIZE;
0108 dec_tc_bus = 1;
0109
0110 ioasic_base = (void *)CKSEG1ADDR(dec_kn_slot_base + IOASIC_IOCTL);
0111 dec_rtc_base = (void *)CKSEG1ADDR(dec_kn_slot_base + IOASIC_TOY);
0112 }
0113
0114
0115 void __init prom_identify_arch(u32 magic)
0116 {
0117 unsigned char dec_cpunum, dec_firmrev, dec_etc, dec_systype;
0118 u32 dec_sysid;
0119
0120 if (!prom_is_rex(magic)) {
0121 dec_sysid = simple_strtoul(prom_getenv("systype"),
0122 (char **)0, 0);
0123 } else {
0124 dec_sysid = rex_getsysid();
0125 if (dec_sysid == 0) {
0126 printk("Zero sysid returned from PROM! "
0127 "Assuming a PMAX-like machine.\n");
0128 dec_sysid = 1;
0129 }
0130 }
0131
0132 dec_cpunum = (dec_sysid & 0xff000000) >> 24;
0133 dec_systype = (dec_sysid & 0xff0000) >> 16;
0134 dec_firmrev = (dec_sysid & 0xff00) >> 8;
0135 dec_etc = dec_sysid & 0xff;
0136
0137
0138
0139
0140
0141 switch (dec_systype) {
0142 case DS2100_3100:
0143 mips_machtype = MACH_DS23100;
0144 prom_init_kn01();
0145 break;
0146 case DS5100:
0147 mips_machtype = MACH_DS5100;
0148 prom_init_kn230();
0149 break;
0150 case DS5000_200:
0151 mips_machtype = MACH_DS5000_200;
0152 prom_init_kn02();
0153 break;
0154 case DS5000_1XX:
0155 mips_machtype = MACH_DS5000_1XX;
0156 prom_init_kn02xa();
0157 break;
0158 case DS5000_2X0:
0159 mips_machtype = MACH_DS5000_2X0;
0160 prom_init_kn03();
0161 if (!(ioasic_read(IO_REG_SIR) & KN03_IO_INR_3MAXP))
0162 mips_machtype = MACH_DS5900;
0163 break;
0164 case DS5000_XX:
0165 mips_machtype = MACH_DS5000_XX;
0166 prom_init_kn02xa();
0167 break;
0168 case DS5800:
0169 mips_machtype = MACH_DS5800;
0170 break;
0171 case DS5400:
0172 mips_machtype = MACH_DS5400;
0173 break;
0174 case DS5500:
0175 mips_machtype = MACH_DS5500;
0176 break;
0177 default:
0178 mips_machtype = MACH_DSUNKNOWN;
0179 break;
0180 }
0181
0182 if (mips_machtype == MACH_DSUNKNOWN)
0183 printk("This is an %s, id is %x\n",
0184 dec_system_strings[mips_machtype], dec_systype);
0185 else
0186 printk("This is a %s\n", dec_system_strings[mips_machtype]);
0187 }