identify.c 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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. #include <asm/sgialib.h>
  20. #include <asm/bootinfo.h>
  21. struct smatch {
  22. char *arcname;
  23. char *liname;
  24. int group;
  25. int type;
  26. int flags;
  27. };
  28. static struct smatch mach_table[] = {
  29. { "SGI-IP22",
  30. "SGI Indy",
  31. MACH_GROUP_SGI,
  32. MACH_SGI_IP22,
  33. PROM_FLAG_ARCS
  34. }, { "SGI-IP27",
  35. "SGI Origin",
  36. MACH_GROUP_SGI,
  37. MACH_SGI_IP27,
  38. PROM_FLAG_ARCS
  39. }, { "SGI-IP28",
  40. "SGI IP28",
  41. MACH_GROUP_SGI,
  42. MACH_SGI_IP28,
  43. PROM_FLAG_ARCS
  44. }, { "SGI-IP30",
  45. "SGI Octane",
  46. MACH_GROUP_SGI,
  47. MACH_SGI_IP30,
  48. PROM_FLAG_ARCS
  49. }, { "SGI-IP32",
  50. "SGI O2",
  51. MACH_GROUP_SGI,
  52. MACH_SGI_IP32,
  53. PROM_FLAG_ARCS
  54. }, { "Microsoft-Jazz",
  55. "Jazz MIPS_Magnum_4000",
  56. MACH_GROUP_JAZZ,
  57. MACH_MIPS_MAGNUM_4000,
  58. 0
  59. }, { "PICA-61",
  60. "Jazz Acer_PICA_61",
  61. MACH_GROUP_JAZZ,
  62. MACH_ACER_PICA_61,
  63. 0
  64. }, { "RM200PCI",
  65. "SNI RM200_PCI",
  66. MACH_GROUP_SNI_RM,
  67. MACH_SNI_RM200_PCI,
  68. PROM_FLAG_DONT_FREE_TEMP
  69. }
  70. };
  71. int prom_flags;
  72. static struct smatch * __init string_to_mach(const char *s)
  73. {
  74. int i;
  75. for (i = 0; i < (sizeof(mach_table) / sizeof (mach_table[0])); i++) {
  76. if (!strcmp(s, mach_table[i].arcname))
  77. return &mach_table[i];
  78. }
  79. panic("Yeee, could not determine architecture type <%s>", s);
  80. }
  81. char *system_type;
  82. const char *get_system_type(void)
  83. {
  84. return system_type;
  85. }
  86. void __init prom_identify_arch(void)
  87. {
  88. pcomponent *p;
  89. struct smatch *mach;
  90. const char *iname;
  91. /*
  92. * The root component tells us what machine architecture we have here.
  93. */
  94. p = ArcGetChild(PROM_NULL_COMPONENT);
  95. if (p == NULL) {
  96. #ifdef CONFIG_SGI_IP27
  97. /* IP27 PROM misbehaves, seems to not implement ARC
  98. GetChild(). So we just assume it's an IP27. */
  99. iname = "SGI-IP27";
  100. #else
  101. iname = "Unknown";
  102. #endif
  103. } else
  104. iname = (char *) (long) p->iname;
  105. printk("ARCH: %s\n", iname);
  106. mach = string_to_mach(iname);
  107. system_type = mach->liname;
  108. mips_machgroup = mach->group;
  109. mips_machtype = mach->type;
  110. prom_flags = mach->flags;
  111. }