identify.c 2.4 KB

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