prom.c 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*
  2. * Copyright (C) 2000, 2001 Broadcom Corporation
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation; either version 2
  7. * of the License, or (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  17. */
  18. #include <linux/init.h>
  19. #include <linux/kernel.h>
  20. #include <linux/mm.h>
  21. #include <linux/blkdev.h>
  22. #include <linux/bootmem.h>
  23. #include <linux/smp.h>
  24. #include <linux/initrd.h>
  25. #include <linux/pm.h>
  26. #include <asm/bootinfo.h>
  27. #include <asm/reboot.h>
  28. #define MAX_RAM_SIZE ((CONFIG_SIBYTE_STANDALONE_RAM_SIZE * 1024 * 1024) - 1)
  29. static __init void prom_meminit(void)
  30. {
  31. #ifdef CONFIG_BLK_DEV_INITRD
  32. unsigned long initrd_pstart;
  33. unsigned long initrd_pend;
  34. initrd_pstart = __pa(initrd_start);
  35. initrd_pend = __pa(initrd_end);
  36. if (initrd_start &&
  37. ((initrd_pstart > MAX_RAM_SIZE)
  38. || (initrd_pend > MAX_RAM_SIZE))) {
  39. panic("initrd out of addressable memory");
  40. }
  41. add_memory_region(0, initrd_pstart,
  42. BOOT_MEM_RAM);
  43. add_memory_region(initrd_pstart, initrd_pend - initrd_pstart,
  44. BOOT_MEM_RESERVED);
  45. add_memory_region(initrd_pend,
  46. (CONFIG_SIBYTE_STANDALONE_RAM_SIZE * 1024 * 1024) - initrd_pend,
  47. BOOT_MEM_RAM);
  48. #else
  49. add_memory_region(0, CONFIG_SIBYTE_STANDALONE_RAM_SIZE * 1024 * 1024,
  50. BOOT_MEM_RAM);
  51. #endif
  52. }
  53. void prom_cpu0_exit(void *unused)
  54. {
  55. while (1) ;
  56. }
  57. static void prom_linux_exit(void)
  58. {
  59. #ifdef CONFIG_SMP
  60. if (smp_processor_id()) {
  61. smp_call_function(prom_cpu0_exit, NULL, 1);
  62. }
  63. #endif
  64. while(1);
  65. }
  66. /*
  67. * prom_init is called just after the cpu type is determined, from setup_arch()
  68. */
  69. void __init prom_init(void)
  70. {
  71. _machine_restart = (void (*)(char *))prom_linux_exit;
  72. _machine_halt = prom_linux_exit;
  73. pm_power_off = prom_linux_exit;
  74. strcpy(arcs_cmdline, "root=/dev/ram0 ");
  75. prom_meminit();
  76. }
  77. void __init prom_free_prom_memory(void)
  78. {
  79. /* Not sure what I'm supposed to do here. Nothing, I think */
  80. }
  81. void prom_putchar(char c)
  82. {
  83. }