Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * This file is subject to the terms and conditions of the GNU General Public |
| 3 | * License. See the file "COPYING" in the main directory of this archive |
| 4 | * for more details. |
| 5 | * |
| 6 | * identify.c: identify machine by looking up system identifier |
| 7 | * |
| 8 | * Copyright (C) 1998 Thomas Bogendoerfer |
| 9 | * |
| 10 | * This code is based on arch/mips/sgi/kernel/system.c, which is |
| 11 | * |
| 12 | * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com) |
| 13 | */ |
| 14 | #include <linux/config.h> |
| 15 | #include <linux/init.h> |
| 16 | #include <linux/kernel.h> |
| 17 | #include <linux/types.h> |
| 18 | #include <linux/string.h> |
| 19 | |
| 20 | #include <asm/sgialib.h> |
| 21 | #include <asm/bootinfo.h> |
| 22 | |
| 23 | struct smatch { |
| 24 | char *arcname; |
| 25 | char *liname; |
| 26 | int group; |
| 27 | int type; |
| 28 | int flags; |
| 29 | }; |
| 30 | |
| 31 | static struct smatch mach_table[] = { |
| 32 | { "SGI-IP22", |
| 33 | "SGI Indy", |
| 34 | MACH_GROUP_SGI, |
| 35 | MACH_SGI_IP22, |
| 36 | PROM_FLAG_ARCS |
| 37 | }, { "SGI-IP27", |
| 38 | "SGI Origin", |
| 39 | MACH_GROUP_SGI, |
| 40 | MACH_SGI_IP27, |
| 41 | PROM_FLAG_ARCS |
| 42 | }, { "SGI-IP28", |
| 43 | "SGI IP28", |
| 44 | MACH_GROUP_SGI, |
| 45 | MACH_SGI_IP28, |
| 46 | PROM_FLAG_ARCS |
Thiemo Seufer | 4552074 | 2005-07-08 07:36:51 +0000 | [diff] [blame] | 47 | }, { "SGI-IP30", |
| 48 | "SGI Octane", |
| 49 | MACH_GROUP_SGI, |
| 50 | MACH_SGI_IP30, |
| 51 | PROM_FLAG_ARCS |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | }, { "SGI-IP32", |
| 53 | "SGI O2", |
| 54 | MACH_GROUP_SGI, |
| 55 | MACH_SGI_IP32, |
| 56 | PROM_FLAG_ARCS |
| 57 | }, { "Microsoft-Jazz", |
| 58 | "Jazz MIPS_Magnum_4000", |
| 59 | MACH_GROUP_JAZZ, |
| 60 | MACH_MIPS_MAGNUM_4000, |
| 61 | 0 |
| 62 | }, { "PICA-61", |
| 63 | "Jazz Acer_PICA_61", |
| 64 | MACH_GROUP_JAZZ, |
| 65 | MACH_ACER_PICA_61, |
| 66 | 0 |
| 67 | }, { "RM200PCI", |
| 68 | "SNI RM200_PCI", |
| 69 | MACH_GROUP_SNI_RM, |
| 70 | MACH_SNI_RM200_PCI, |
| 71 | PROM_FLAG_DONT_FREE_TEMP |
| 72 | } |
| 73 | }; |
| 74 | |
| 75 | int prom_flags; |
| 76 | |
| 77 | static struct smatch * __init string_to_mach(const char *s) |
| 78 | { |
| 79 | int i; |
| 80 | |
| 81 | for (i = 0; i < (sizeof(mach_table) / sizeof (mach_table[0])); i++) { |
| 82 | if (!strcmp(s, mach_table[i].arcname)) |
| 83 | return &mach_table[i]; |
| 84 | } |
| 85 | |
| 86 | panic("Yeee, could not determine architecture type <%s>", s); |
| 87 | } |
| 88 | |
| 89 | char *system_type; |
| 90 | |
| 91 | const char *get_system_type(void) |
| 92 | { |
| 93 | return system_type; |
| 94 | } |
| 95 | |
| 96 | void __init prom_identify_arch(void) |
| 97 | { |
| 98 | pcomponent *p; |
| 99 | struct smatch *mach; |
| 100 | const char *iname; |
| 101 | |
| 102 | /* |
| 103 | * The root component tells us what machine architecture we have here. |
| 104 | */ |
| 105 | p = ArcGetChild(PROM_NULL_COMPONENT); |
| 106 | if (p == NULL) { |
| 107 | #ifdef CONFIG_SGI_IP27 |
| 108 | /* IP27 PROM misbehaves, seems to not implement ARC |
| 109 | GetChild(). So we just assume it's an IP27. */ |
| 110 | iname = "SGI-IP27"; |
| 111 | #else |
| 112 | iname = "Unknown"; |
| 113 | #endif |
| 114 | } else |
| 115 | iname = (char *) (long) p->iname; |
| 116 | |
| 117 | printk("ARCH: %s\n", iname); |
| 118 | mach = string_to_mach(iname); |
| 119 | system_type = mach->liname; |
| 120 | |
| 121 | mips_machgroup = mach->group; |
| 122 | mips_machtype = mach->type; |
| 123 | prom_flags = mach->flags; |
| 124 | } |