identify.c 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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-IP32",
  45. "SGI O2",
  46. MACH_GROUP_SGI,
  47. MACH_SGI_IP32,
  48. PROM_FLAG_ARCS
  49. }, { "Microsoft-Jazz",
  50. "Jazz MIPS_Magnum_4000",
  51. MACH_GROUP_JAZZ,
  52. MACH_MIPS_MAGNUM_4000,
  53. 0
  54. }, { "PICA-61",
  55. "Jazz Acer_PICA_61",
  56. MACH_GROUP_JAZZ,
  57. MACH_ACER_PICA_61,
  58. 0
  59. }, { "RM200PCI",
  60. "SNI RM200_PCI",
  61. MACH_GROUP_SNI_RM,
  62. MACH_SNI_RM200_PCI,
  63. PROM_FLAG_DONT_FREE_TEMP
  64. }
  65. };
  66. int prom_flags;
  67. static struct smatch * __init string_to_mach(const char *s)
  68. {
  69. int i;
  70. for (i = 0; i < (sizeof(mach_table) / sizeof (mach_table[0])); i++) {
  71. if (!strcmp(s, mach_table[i].arcname))
  72. return &mach_table[i];
  73. }
  74. panic("Yeee, could not determine architecture type <%s>", s);
  75. }
  76. char *system_type;
  77. const char *get_system_type(void)
  78. {
  79. return system_type;
  80. }
  81. void __init prom_identify_arch(void)
  82. {
  83. pcomponent *p;
  84. struct smatch *mach;
  85. const char *iname;
  86. /*
  87. * The root component tells us what machine architecture we have here.
  88. */
  89. p = ArcGetChild(PROM_NULL_COMPONENT);
  90. if (p == NULL) {
  91. #ifdef CONFIG_SGI_IP27
  92. /* IP27 PROM misbehaves, seems to not implement ARC
  93. GetChild(). So we just assume it's an IP27. */
  94. iname = "SGI-IP27";
  95. #else
  96. iname = "Unknown";
  97. #endif
  98. } else
  99. iname = (char *) (long) p->iname;
  100. printk("ARCH: %s\n", iname);
  101. mach = string_to_mach(iname);
  102. system_type = mach->liname;
  103. mips_machgroup = mach->group;
  104. mips_machtype = mach->type;
  105. prom_flags = mach->flags;
  106. }