init.c 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. /*
  3. * Copyright (C) 2009 Lemote Inc.
  4. * Author: Wu Zhangjin, [email protected]
  5. */
  6. #include <linux/memblock.h>
  7. #include <asm/bootinfo.h>
  8. #include <asm/traps.h>
  9. #include <asm/smp-ops.h>
  10. #include <asm/cacheflush.h>
  11. #include <asm/fw/fw.h>
  12. #include <loongson.h>
  13. /* Loongson CPU address windows config space base address */
  14. unsigned long __maybe_unused _loongson_addrwincfg_base;
  15. static void __init mips_nmi_setup(void)
  16. {
  17. void *base;
  18. base = (void *)(CAC_BASE + 0x380);
  19. memcpy(base, except_vec_nmi, 0x80);
  20. flush_icache_range((unsigned long)base, (unsigned long)base + 0x80);
  21. }
  22. void __init prom_init(void)
  23. {
  24. #ifdef CONFIG_CPU_SUPPORTS_ADDRWINCFG
  25. _loongson_addrwincfg_base = (unsigned long)
  26. ioremap(LOONGSON_ADDRWINCFG_BASE, LOONGSON_ADDRWINCFG_SIZE);
  27. #endif
  28. fw_init_cmdline();
  29. prom_init_machtype();
  30. prom_init_env();
  31. /* init base address of io space */
  32. set_io_port_base((unsigned long)
  33. ioremap(LOONGSON_PCIIO_BASE, LOONGSON_PCIIO_SIZE));
  34. prom_init_memory();
  35. /*init the uart base address */
  36. prom_init_uart_base();
  37. board_nmi_handler_setup = mips_nmi_setup;
  38. }