identify.c
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:3k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. /*
  2.  * identify.c: machine identification code.
  3.  *
  4.  * Copyright (C) 1998 Harald Koerfgen and Paul M. Antoine
  5.  */
  6. #include <linux/init.h>
  7. #include <linux/kernel.h>
  8. #include <linux/string.h>
  9. #include <asm/bootinfo.h>
  10. #include "dectypes.h"
  11. #include "prom.h"
  12. extern char *(*prom_getenv)(char *);
  13. extern int (*prom_printf)(char *, ...);
  14. extern int (*rex_getsysid)(void);
  15. extern unsigned long mips_machgroup;
  16. extern unsigned long mips_machtype;
  17. extern unsigned long mips_machtype;
  18. const char *get_system_type(void)
  19. {
  20. static char system[32];
  21. int called = 0;
  22. const char *dec_system_strings[] = { "unknown", "DECstation 2100/3100",
  23.          "DECstation 5100", "DECstation 5000/200", "DECstation 5000/1xx",
  24. "Personal DECstation 5000/xx", "DECstation 5000/2x0",
  25. "DECstation 5400", "DECstation 5500", "DECstation 5800"
  26. };
  27. if (called == 0) {
  28. called = 1;
  29. strcpy(system, "Digital ");
  30. strcat(system, dec_system_strings[mips_machtype]);
  31. }
  32. return system;
  33. }
  34. void __init prom_identify_arch (unsigned int magic)
  35. {
  36. unsigned char dec_cpunum, dec_firmrev, dec_etc;
  37. int dec_systype;
  38. unsigned long dec_sysid;
  39. if (magic != REX_PROM_MAGIC) {
  40. dec_sysid = simple_strtoul(prom_getenv("systype"), (char **)0, 0);
  41. } else {
  42. dec_sysid = rex_getsysid();
  43. if (dec_sysid == 0) {
  44. prom_printf("Zero sysid returned from PROMs! Assuming PMAX-like machine.n");
  45. dec_sysid = 1;
  46. }
  47. }
  48. dec_cpunum = (dec_sysid & 0xff000000) >> 24;
  49. dec_systype = (dec_sysid & 0xff0000) >> 16;
  50. dec_firmrev = (dec_sysid & 0xff00) >> 8;
  51. dec_etc = dec_sysid & 0xff;
  52. /* We're obviously one of the DEC machines */
  53. mips_machgroup = MACH_GROUP_DEC;
  54. /*
  55.  * FIXME: This may not be an exhaustive list of DECStations/Servers!
  56.  * Put all model-specific initialisation calls here.
  57.  */
  58. prom_printf("This DECstation is a ");
  59. switch (dec_systype) {
  60. case DS2100_3100:
  61. prom_printf("DS2100/3100n");
  62. mips_machtype = MACH_DS23100;
  63. break;
  64. case DS5100: /* DS5100 MIPSMATE */
  65. prom_printf("DS5100n");
  66. mips_machtype = MACH_DS5100;
  67. break;
  68. case DS5000_200: /* DS5000 3max */
  69. prom_printf("DS5000/200n");
  70. mips_machtype = MACH_DS5000_200;
  71. break;
  72. case DS5000_1XX: /* DS5000/100 3min */
  73. prom_printf("DS5000/1xxn");
  74. mips_machtype = MACH_DS5000_1XX;
  75. break;
  76. case DS5000_2X0: /* DS5000/240 3max+ */
  77. prom_printf("DS5000/2x0n");
  78. mips_machtype = MACH_DS5000_2X0;
  79. break;
  80. case DS5000_XX: /* Personal DS5000/2x */
  81. prom_printf("Personal DS5000/xxn");
  82. mips_machtype = MACH_DS5000_XX;
  83. break;
  84. case DS5800: /* DS5800 Isis */
  85. prom_printf("DS5800n");
  86. mips_machtype = MACH_DS5800;
  87. break;
  88. case DS5400: /* DS5400 MIPSfair */
  89. prom_printf("DS5400n");
  90. mips_machtype = MACH_DS5400;
  91. break;
  92. case DS5500: /* DS5500 MIPSfair-2 */
  93. prom_printf("DS5500n");
  94. mips_machtype = MACH_DS5500;
  95. break;
  96. default:
  97. prom_printf("unknown, id is %x", dec_systype);
  98. mips_machtype = MACH_DSUNKNOWN;
  99. break;
  100. }
  101. }