setup_arch_post.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /* Hook for machine specific memory setup.
  2. *
  3. * This is included late in kernel/setup.c so that it can make use of all of
  4. * the static functions. */
  5. static char * __init machine_specific_memory_setup(void)
  6. {
  7. char *who;
  8. who = "NOT VOYAGER";
  9. if(voyager_level == 5) {
  10. __u32 addr, length;
  11. int i;
  12. who = "Voyager-SUS";
  13. e820.nr_map = 0;
  14. for(i=0; voyager_memory_detect(i, &addr, &length); i++) {
  15. add_memory_region(addr, length, E820_RAM);
  16. }
  17. return who;
  18. } else if(voyager_level == 4) {
  19. __u32 tom;
  20. __u16 catbase = inb(VOYAGER_SSPB_RELOCATION_PORT)<<8;
  21. /* select the DINO config space */
  22. outb(VOYAGER_DINO, VOYAGER_CAT_CONFIG_PORT);
  23. /* Read DINO top of memory register */
  24. tom = ((inb(catbase + 0x4) & 0xf0) << 16)
  25. + ((inb(catbase + 0x5) & 0x7f) << 24);
  26. if(inb(catbase) != VOYAGER_DINO) {
  27. printk(KERN_ERR "Voyager: Failed to get DINO for L4, setting tom to EXT_MEM_K\n");
  28. tom = (EXT_MEM_K)<<10;
  29. }
  30. who = "Voyager-TOM";
  31. add_memory_region(0, 0x9f000, E820_RAM);
  32. /* map from 1M to top of memory */
  33. add_memory_region(1*1024*1024, tom - 1*1024*1024, E820_RAM);
  34. /* FIXME: Should check the ASICs to see if I need to
  35. * take out the 8M window. Just do it at the moment
  36. * */
  37. add_memory_region(8*1024*1024, 8*1024*1024, E820_RESERVED);
  38. return who;
  39. }
  40. who = "BIOS-e820";
  41. /*
  42. * Try to copy the BIOS-supplied E820-map.
  43. *
  44. * Otherwise fake a memory map; one section from 0k->640k,
  45. * the next section from 1mb->appropriate_mem_k
  46. */
  47. sanitize_e820_map(E820_MAP, &E820_MAP_NR);
  48. if (copy_e820_map(E820_MAP, E820_MAP_NR) < 0) {
  49. unsigned long mem_size;
  50. /* compare results from other methods and take the greater */
  51. if (ALT_MEM_K < EXT_MEM_K) {
  52. mem_size = EXT_MEM_K;
  53. who = "BIOS-88";
  54. } else {
  55. mem_size = ALT_MEM_K;
  56. who = "BIOS-e801";
  57. }
  58. e820.nr_map = 0;
  59. add_memory_region(0, LOWMEMSIZE(), E820_RAM);
  60. add_memory_region(HIGH_MEMORY, mem_size << 10, E820_RAM);
  61. }
  62. return who;
  63. }