identify.c 2.4 KB

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