bootparse.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. #include <linux/string.h>
  2. #include <linux/kernel.h>
  3. #include <linux/sched.h>
  4. #include <asm/irq.h>
  5. #include <asm/setup.h>
  6. #include <asm/bootinfo.h>
  7. #include <asm/macintosh.h>
  8. /*
  9. * Booter vars
  10. */
  11. int boothowto;
  12. int _boothowto;
  13. /*
  14. * Called early to parse the environment (passed to us from the booter)
  15. * into a bootinfo struct. Will die as soon as we have our own booter
  16. */
  17. #define atol(x) simple_strtoul(x,NULL,0)
  18. void parse_booter(char *env)
  19. {
  20. char *name;
  21. char *value;
  22. #if 0
  23. while(0 && *env)
  24. #else
  25. while(*env)
  26. #endif
  27. {
  28. name=env;
  29. value=name;
  30. while(*value!='='&&*value)
  31. value++;
  32. if(*value=='=')
  33. *value++=0;
  34. env=value;
  35. while(*env)
  36. env++;
  37. env++;
  38. #if 0
  39. if(strcmp(name,"VIDEO_ADDR")==0)
  40. mac_mch.videoaddr=atol(value);
  41. if(strcmp(name,"ROW_BYTES")==0)
  42. mac_mch.videorow=atol(value);
  43. if(strcmp(name,"SCREEN_DEPTH")==0)
  44. mac_mch.videodepth=atol(value);
  45. if(strcmp(name,"DIMENSIONS")==0)
  46. mac_mch.dimensions=atol(value);
  47. #endif
  48. if(strcmp(name,"BOOTTIME")==0)
  49. mac_bi_data.boottime=atol(value);
  50. if(strcmp(name,"GMTBIAS")==0)
  51. mac_bi_data.gmtbias=atol(value);
  52. if(strcmp(name,"BOOTERVER")==0)
  53. mac_bi_data.bootver=atol(value);
  54. if(strcmp(name,"MACOS_VIDEO")==0)
  55. mac_bi_data.videological=atol(value);
  56. if(strcmp(name,"MACOS_SCC")==0)
  57. mac_bi_data.sccbase=atol(value);
  58. if(strcmp(name,"MACHINEID")==0)
  59. mac_bi_data.id=atol(value);
  60. if(strcmp(name,"MEMSIZE")==0)
  61. mac_bi_data.memsize=atol(value);
  62. if(strcmp(name,"SERIAL_MODEM_FLAGS")==0)
  63. mac_bi_data.serialmf=atol(value);
  64. if(strcmp(name,"SERIAL_MODEM_HSKICLK")==0)
  65. mac_bi_data.serialhsk=atol(value);
  66. if(strcmp(name,"SERIAL_MODEM_GPICLK")==0)
  67. mac_bi_data.serialgpi=atol(value);
  68. if(strcmp(name,"SERIAL_PRINT_FLAGS")==0)
  69. mac_bi_data.printmf=atol(value);
  70. if(strcmp(name,"SERIAL_PRINT_HSKICLK")==0)
  71. mac_bi_data.printhsk=atol(value);
  72. if(strcmp(name,"SERIAL_PRINT_GPICLK")==0)
  73. mac_bi_data.printgpi=atol(value);
  74. if(strcmp(name,"PROCESSOR")==0)
  75. mac_bi_data.cpuid=atol(value);
  76. if(strcmp(name,"ROMBASE")==0)
  77. mac_bi_data.rombase=atol(value);
  78. if(strcmp(name,"TIMEDBRA")==0)
  79. mac_bi_data.timedbra=atol(value);
  80. if(strcmp(name,"ADBDELAY")==0)
  81. mac_bi_data.adbdelay=atol(value);
  82. }
  83. #if 0 /* XXX: TODO with m68k_mach_* */
  84. /* Fill in the base stuff */
  85. boot_info.machtype=MACH_MAC;
  86. /* Read this from the macinfo we got ! */
  87. /* boot_info.cputype=CPU_68020|FPUB_68881;*/
  88. /* boot_info.memory[0].addr=0;*/
  89. /* boot_info.memory[0].size=((mac_bi_data.id>>7)&31)<<20;*/
  90. boot_info.num_memory=1; /* On a MacII */
  91. boot_info.ramdisk_size=0; /* For now */
  92. *boot_info.command_line=0;
  93. #endif
  94. }
  95. void print_booter(char *env)
  96. {
  97. char *name;
  98. char *value;
  99. while(*env)
  100. {
  101. name=env;
  102. value=name;
  103. while(*value!='='&&*value)
  104. value++;
  105. if(*value=='=')
  106. *value++=0;
  107. env=value;
  108. while(*env)
  109. env++;
  110. env++;
  111. printk("%s=%s\n", name,value);
  112. }
  113. }