malta-memory.c 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * This file is subject to the terms and conditions of the GNU General Public
  3. * License. See the file "COPYING" in the main directory of this archive
  4. * for more details.
  5. *
  6. * PROM library functions for acquiring/using memory descriptors given to
  7. * us from the YAMON.
  8. *
  9. * Copyright (C) 1999,2000,2012 MIPS Technologies, Inc.
  10. * All rights reserved.
  11. * Authors: Carsten Langgaard <carstenl@mips.com>
  12. * Steven J. Hill <sjhill@mips.com>
  13. */
  14. #include <linux/init.h>
  15. #include <linux/bootmem.h>
  16. #include <linux/string.h>
  17. #include <asm/bootinfo.h>
  18. #include <asm/cdmm.h>
  19. #include <asm/maar.h>
  20. #include <asm/sections.h>
  21. #include <asm/fw/fw.h>
  22. /* determined physical memory size, not overridden by command line args */
  23. unsigned long physical_memsize = 0L;
  24. static void free_init_pages_eva_malta(void *begin, void *end)
  25. {
  26. free_init_pages("unused kernel", __pa_symbol((unsigned long *)begin),
  27. __pa_symbol((unsigned long *)end));
  28. }
  29. void __init fw_meminit(void)
  30. {
  31. bool eva = IS_ENABLED(CONFIG_EVA);
  32. free_init_pages_eva = eva ? free_init_pages_eva_malta : NULL;
  33. }
  34. void __init prom_free_prom_memory(void)
  35. {
  36. unsigned long addr;
  37. int i;
  38. for (i = 0; i < boot_mem_map.nr_map; i++) {
  39. if (boot_mem_map.map[i].type != BOOT_MEM_ROM_DATA)
  40. continue;
  41. addr = boot_mem_map.map[i].addr;
  42. free_init_pages("YAMON memory",
  43. addr, addr + boot_mem_map.map[i].size);
  44. }
  45. }
  46. phys_addr_t mips_cdmm_phys_base(void)
  47. {
  48. /* This address is "typically unused" */
  49. return 0x1fc10000;
  50. }