prom.c 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. * OpenRISC prom.c
  3. *
  4. * Linux architectural port borrowing liberally from similar works of
  5. * others. All original copyrights apply as per the original source
  6. * declaration.
  7. *
  8. * Modifications for the OpenRISC architecture:
  9. * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
  10. *
  11. * This program is free software; you can redistribute it and/or
  12. * modify it under the terms of the GNU General Public License
  13. * as published by the Free Software Foundation; either version
  14. * 2 of the License, or (at your option) any later version.
  15. *
  16. * Architecture specific procedures for creating, accessing and
  17. * interpreting the device tree.
  18. *
  19. */
  20. #include <stdarg.h>
  21. #include <linux/kernel.h>
  22. #include <linux/string.h>
  23. #include <linux/init.h>
  24. #include <linux/threads.h>
  25. #include <linux/spinlock.h>
  26. #include <linux/types.h>
  27. #include <linux/pci.h>
  28. #include <linux/stringify.h>
  29. #include <linux/delay.h>
  30. #include <linux/initrd.h>
  31. #include <linux/bitops.h>
  32. #include <linux/module.h>
  33. #include <linux/kexec.h>
  34. #include <linux/debugfs.h>
  35. #include <linux/irq.h>
  36. #include <linux/memblock.h>
  37. #include <linux/of_fdt.h>
  38. #include <asm/prom.h>
  39. #include <asm/page.h>
  40. #include <asm/processor.h>
  41. #include <asm/irq.h>
  42. #include <linux/io.h>
  43. #include <asm/mmu.h>
  44. #include <asm/pgtable.h>
  45. #include <asm/sections.h>
  46. #include <asm/setup.h>
  47. void __init early_init_dt_add_memory_arch(u64 base, u64 size)
  48. {
  49. size &= PAGE_MASK;
  50. memblock_add(base, size);
  51. }
  52. void __init early_init_devtree(void *params)
  53. {
  54. /* Setup flat device-tree pointer */
  55. initial_boot_params = params;
  56. /* Retrieve various informations from the /chosen node of the
  57. * device-tree, including the platform type, initrd location and
  58. * size, TCE reserve, and more ...
  59. */
  60. of_scan_flat_dt(early_init_dt_scan_chosen, boot_command_line);
  61. /* Scan memory nodes and rebuild MEMBLOCKs */
  62. of_scan_flat_dt(early_init_dt_scan_root, NULL);
  63. of_scan_flat_dt(early_init_dt_scan_memory, NULL);
  64. memblock_allow_resize();
  65. }
  66. #ifdef CONFIG_BLK_DEV_INITRD
  67. void __init early_init_dt_setup_initrd_arch(u64 start, u64 end)
  68. {
  69. initrd_start = (unsigned long)__va(start);
  70. initrd_end = (unsigned long)__va(end);
  71. initrd_below_start_ok = 1;
  72. }
  73. #endif