identify.c 2.5 KB

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