platsmp.c 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * linux/arch/arm/mach-vexpress/platsmp.c
  3. *
  4. * Copyright (C) 2002 ARM Ltd.
  5. * All Rights Reserved
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. */
  11. #include <linux/init.h>
  12. #include <linux/errno.h>
  13. #include <linux/smp.h>
  14. #include <linux/io.h>
  15. #include <asm/smp_scu.h>
  16. #include <asm/unified.h>
  17. #include <mach/ct-ca9x4.h>
  18. #include <mach/motherboard.h>
  19. #define V2M_PA_CS7 0x10000000
  20. #include "core.h"
  21. extern void versatile_secondary_startup(void);
  22. static void __iomem *scu_base_addr(void)
  23. {
  24. return MMIO_P2V(A9_MPCORE_SCU);
  25. }
  26. /*
  27. * Initialise the CPU possible map early - this describes the CPUs
  28. * which may be present or become present in the system.
  29. */
  30. void __init smp_init_cpus(void)
  31. {
  32. void __iomem *scu_base = scu_base_addr();
  33. unsigned int i, ncores;
  34. ncores = scu_base ? scu_get_core_count(scu_base) : 1;
  35. /* sanity check */
  36. if (ncores > NR_CPUS) {
  37. printk(KERN_WARNING
  38. "vexpress: no. of cores (%d) greater than configured "
  39. "maximum of %d - clipping\n",
  40. ncores, NR_CPUS);
  41. ncores = NR_CPUS;
  42. }
  43. for (i = 0; i < ncores; i++)
  44. set_cpu_possible(i, true);
  45. }
  46. void __init platform_smp_prepare_cpus(unsigned int max_cpus)
  47. {
  48. int i;
  49. /*
  50. * Initialise the present map, which describes the set of CPUs
  51. * actually populated at the present time.
  52. */
  53. for (i = 0; i < max_cpus; i++)
  54. set_cpu_present(i, true);
  55. scu_enable(scu_base_addr());
  56. /*
  57. * Write the address of secondary startup into the
  58. * system-wide flags register. The boot monitor waits
  59. * until it receives a soft interrupt, and then the
  60. * secondary CPU branches to this address.
  61. */
  62. writel(~0, MMIO_P2V(V2M_SYS_FLAGSCLR));
  63. writel(BSYM(virt_to_phys(versatile_secondary_startup)),
  64. MMIO_P2V(V2M_SYS_FLAGSSET));
  65. }