qemu_e500.c 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. * Paravirt target for a generic QEMU e500 machine
  3. *
  4. * This is intended to be a flexible device-tree-driven platform, not fixed
  5. * to a particular piece of hardware or a particular spec of virtual hardware,
  6. * beyond the assumption of an e500-family CPU. Some things are still hardcoded
  7. * here, such as MPIC, but this is a limitation of the current code rather than
  8. * an interface contract with QEMU.
  9. *
  10. * Copyright 2012 Freescale Semiconductor Inc.
  11. *
  12. * This program is free software; you can redistribute it and/or modify it
  13. * under the terms of the GNU General Public License as published by the
  14. * Free Software Foundation; either version 2 of the License, or (at your
  15. * option) any later version.
  16. */
  17. #include <linux/kernel.h>
  18. #include <linux/of_fdt.h>
  19. #include <asm/machdep.h>
  20. #include <asm/time.h>
  21. #include <asm/udbg.h>
  22. #include <asm/mpic.h>
  23. #include <sysdev/fsl_soc.h>
  24. #include <sysdev/fsl_pci.h>
  25. #include "smp.h"
  26. #include "mpc85xx.h"
  27. void __init qemu_e500_pic_init(void)
  28. {
  29. struct mpic *mpic;
  30. mpic = mpic_alloc(NULL, 0, MPIC_BIG_ENDIAN | MPIC_SINGLE_DEST_CPU,
  31. 0, 256, " OpenPIC ");
  32. BUG_ON(mpic == NULL);
  33. mpic_init(mpic);
  34. }
  35. static void __init qemu_e500_setup_arch(void)
  36. {
  37. ppc_md.progress("qemu_e500_setup_arch()", 0);
  38. fsl_pci_init();
  39. mpc85xx_smp_init();
  40. }
  41. /*
  42. * Called very early, device-tree isn't unflattened
  43. */
  44. static int __init qemu_e500_probe(void)
  45. {
  46. unsigned long root = of_get_flat_dt_root();
  47. return !!of_flat_dt_is_compatible(root, "fsl,qemu-e500");
  48. }
  49. machine_device_initcall(qemu_e500, mpc85xx_common_publish_devices);
  50. define_machine(qemu_e500) {
  51. .name = "QEMU e500",
  52. .probe = qemu_e500_probe,
  53. .setup_arch = qemu_e500_setup_arch,
  54. .init_IRQ = qemu_e500_pic_init,
  55. #ifdef CONFIG_PCI
  56. .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
  57. #endif
  58. .get_irq = mpic_get_irq,
  59. .restart = fsl_rstcr_restart,
  60. .calibrate_decr = generic_calibrate_decr,
  61. .progress = udbg_progress,
  62. };