identify.c 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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 ([email protected])
  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-IP28",
  33. .liname = "SGI IP28",
  34. .flags = PROM_FLAG_ARCS,
  35. }, {
  36. .arcname = "SGI-IP30",
  37. .liname = "SGI Octane",
  38. .flags = PROM_FLAG_ARCS,
  39. }, {
  40. .arcname = "SGI-IP32",
  41. .liname = "SGI O2",
  42. .flags = PROM_FLAG_ARCS,
  43. }, {
  44. .arcname = "Microsoft-Jazz",
  45. .liname = "Jazz MIPS_Magnum_4000",
  46. .flags = 0,
  47. }, {
  48. .arcname = "PICA-61",
  49. .liname = "Jazz Acer_PICA_61",
  50. .flags = 0,
  51. }, {
  52. .arcname = "RM200PCI",
  53. .liname = "SNI RM200_PCI",
  54. .flags = PROM_FLAG_DONT_FREE_TEMP,
  55. }, {
  56. .arcname = "RM200PCI-R5K",
  57. .liname = "SNI RM200_PCI-R5K",
  58. .flags = PROM_FLAG_DONT_FREE_TEMP,
  59. }
  60. };
  61. int prom_flags;
  62. static struct smatch * __init string_to_mach(const char *s)
  63. {
  64. int i;
  65. for (i = 0; i < ARRAY_SIZE(mach_table); i++) {
  66. if (!strcmp(s, mach_table[i].arcname))
  67. return &mach_table[i];
  68. }
  69. panic("Yeee, could not determine architecture type <%s>", s);
  70. }
  71. char *system_type;
  72. const char *get_system_type(void)
  73. {
  74. return system_type;
  75. }
  76. static pcomponent * __init ArcGetChild(pcomponent *Current)
  77. {
  78. return (pcomponent *) ARC_CALL1(child_component, Current);
  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. iname = "Unknown";
  91. } else
  92. iname = (char *) (long) p->iname;
  93. printk("ARCH: %s\n", iname);
  94. mach = string_to_mach(iname);
  95. system_type = mach->liname;
  96. prom_flags = mach->flags;
  97. }