init.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * Copyright (C) 2009 Lemote Inc.
  3. * Author: Wu Zhangjin, wuzhangjin@gmail.com
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of the GNU General Public License as published by the
  7. * Free Software Foundation; either version 2 of the License, or (at your
  8. * option) any later version.
  9. */
  10. #include <linux/bootmem.h>
  11. #include <asm/bootinfo.h>
  12. #include <asm/traps.h>
  13. #include <asm/smp-ops.h>
  14. #include <asm/cacheflush.h>
  15. #include <loongson.h>
  16. /* Loongson CPU address windows config space base address */
  17. unsigned long __maybe_unused _loongson_addrwincfg_base;
  18. static void __init mips_nmi_setup(void)
  19. {
  20. void *base;
  21. extern char except_vec_nmi;
  22. base = (void *)(CAC_BASE + 0x380);
  23. memcpy(base, &except_vec_nmi, 0x80);
  24. flush_icache_range((unsigned long)base, (unsigned long)base + 0x80);
  25. }
  26. void __init prom_init(void)
  27. {
  28. #ifdef CONFIG_CPU_SUPPORTS_ADDRWINCFG
  29. _loongson_addrwincfg_base = (unsigned long)
  30. ioremap(LOONGSON_ADDRWINCFG_BASE, LOONGSON_ADDRWINCFG_SIZE);
  31. #endif
  32. prom_init_cmdline();
  33. prom_init_env();
  34. /* init base address of io space */
  35. set_io_port_base((unsigned long)
  36. ioremap(LOONGSON_PCIIO_BASE, LOONGSON_PCIIO_SIZE));
  37. #ifdef CONFIG_NUMA
  38. prom_init_numa_memory();
  39. #else
  40. prom_init_memory();
  41. #endif
  42. /*init the uart base address */
  43. prom_init_uart_base();
  44. register_smp_ops(&loongson3_smp_ops);
  45. board_nmi_handler_setup = mips_nmi_setup;
  46. }
  47. void __init prom_free_prom_memory(void)
  48. {
  49. }