identify.c 2.4 KB

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