Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * This file is subject to the terms and conditions of the GNU General Public
0003  * License.  See the file "COPYING" in the main directory of this archive
0004  * for more details.
0005  *
0006  * identify.c: identify machine by looking up system identifier
0007  *
0008  * Copyright (C) 1998 Thomas Bogendoerfer
0009  *
0010  * This code is based on arch/mips/sgi/kernel/system.c, which is
0011  *
0012  * Copyright (C) 1996 David S. Miller (davem@davemloft.net)
0013  */
0014 #include <linux/bug.h>
0015 #include <linux/init.h>
0016 #include <linux/kernel.h>
0017 #include <linux/types.h>
0018 #include <linux/string.h>
0019 
0020 #include <asm/sgialib.h>
0021 #include <asm/bootinfo.h>
0022 
0023 struct smatch {
0024     char *arcname;
0025     char *liname;
0026     int flags;
0027 };
0028 
0029 static struct smatch mach_table[] = {
0030     {
0031         .arcname    = "SGI-IP22",
0032         .liname     = "SGI Indy",
0033         .flags      = PROM_FLAG_ARCS,
0034     }, {
0035         .arcname    = "SGI-IP28",
0036         .liname     = "SGI IP28",
0037         .flags      = PROM_FLAG_ARCS,
0038     }, {
0039         .arcname    = "SGI-IP30",
0040         .liname     = "SGI Octane",
0041         .flags      = PROM_FLAG_ARCS,
0042     }, {
0043         .arcname    = "SGI-IP32",
0044         .liname     = "SGI O2",
0045         .flags      = PROM_FLAG_ARCS,
0046     }, {
0047         .arcname    = "Microsoft-Jazz",
0048         .liname     = "Jazz MIPS_Magnum_4000",
0049         .flags      = 0,
0050     }, {
0051         .arcname    = "PICA-61",
0052         .liname     = "Jazz Acer_PICA_61",
0053         .flags      = 0,
0054     }, {
0055         .arcname    = "RM200PCI",
0056         .liname     = "SNI RM200_PCI",
0057         .flags      = PROM_FLAG_DONT_FREE_TEMP,
0058     }, {
0059         .arcname    = "RM200PCI-R5K",
0060         .liname     = "SNI RM200_PCI-R5K",
0061         .flags      = PROM_FLAG_DONT_FREE_TEMP,
0062     }
0063 };
0064 
0065 int prom_flags;
0066 
0067 static struct smatch * __init string_to_mach(const char *s)
0068 {
0069     int i;
0070 
0071     for (i = 0; i < ARRAY_SIZE(mach_table); i++) {
0072         if (!strcmp(s, mach_table[i].arcname))
0073             return &mach_table[i];
0074     }
0075 
0076     panic("Yeee, could not determine architecture type <%s>", s);
0077 }
0078 
0079 char *system_type;
0080 
0081 const char *get_system_type(void)
0082 {
0083     return system_type;
0084 }
0085 
0086 static pcomponent * __init ArcGetChild(pcomponent *Current)
0087 {
0088     return (pcomponent *) ARC_CALL1(child_component, Current);
0089 }
0090 
0091 void __init prom_identify_arch(void)
0092 {
0093     pcomponent *p;
0094     struct smatch *mach;
0095     const char *iname;
0096 
0097     /*
0098      * The root component tells us what machine architecture we have here.
0099      */
0100     p = ArcGetChild(PROM_NULL_COMPONENT);
0101     if (p == NULL) {
0102         iname = "Unknown";
0103     } else
0104         iname = (char *) (long) p->iname;
0105 
0106     printk("ARCH: %s\n", iname);
0107     mach = string_to_mach(iname);
0108     system_type = mach->liname;
0109 
0110     prom_flags = mach->flags;
0111 }