platsmp.c 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /*
  2. * linux/arch/arm/mach-realview/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 <mach/hardware.h>
  16. #include <asm/hardware/gic.h>
  17. #include <asm/mach-types.h>
  18. #include <asm/smp_scu.h>
  19. #include <asm/unified.h>
  20. #include <mach/board-eb.h>
  21. #include <mach/board-pb11mp.h>
  22. #include <mach/board-pbx.h>
  23. #include "core.h"
  24. extern void versatile_secondary_startup(void);
  25. static void __iomem *scu_base_addr(void)
  26. {
  27. if (machine_is_realview_eb_mp())
  28. return __io_address(REALVIEW_EB11MP_SCU_BASE);
  29. else if (machine_is_realview_pb11mp())
  30. return __io_address(REALVIEW_TC11MP_SCU_BASE);
  31. else if (machine_is_realview_pbx() &&
  32. (core_tile_pbx11mp() || core_tile_pbxa9mp()))
  33. return __io_address(REALVIEW_PBX_TILE_SCU_BASE);
  34. else
  35. return (void __iomem *)0;
  36. }
  37. /*
  38. * Initialise the CPU possible map early - this describes the CPUs
  39. * which may be present or become present in the system.
  40. */
  41. void __init smp_init_cpus(void)
  42. {
  43. void __iomem *scu_base = scu_base_addr();
  44. unsigned int i, ncores;
  45. ncores = scu_base ? scu_get_core_count(scu_base) : 1;
  46. /* sanity check */
  47. if (ncores > NR_CPUS) {
  48. printk(KERN_WARNING
  49. "Realview: no. of cores (%d) greater than configured "
  50. "maximum of %d - clipping\n",
  51. ncores, NR_CPUS);
  52. ncores = NR_CPUS;
  53. }
  54. for (i = 0; i < ncores; i++)
  55. set_cpu_possible(i, true);
  56. set_smp_cross_call(gic_raise_softirq);
  57. }
  58. void __init platform_smp_prepare_cpus(unsigned int max_cpus)
  59. {
  60. int i;
  61. /*
  62. * Initialise the present map, which describes the set of CPUs
  63. * actually populated at the present time.
  64. */
  65. for (i = 0; i < max_cpus; i++)
  66. set_cpu_present(i, true);
  67. scu_enable(scu_base_addr());
  68. /*
  69. * Write the address of secondary startup into the
  70. * system-wide flags register. The BootMonitor waits
  71. * until it receives a soft interrupt, and then the
  72. * secondary CPU branches to this address.
  73. */
  74. __raw_writel(BSYM(virt_to_phys(versatile_secondary_startup)),
  75. __io_address(REALVIEW_SYS_FLAGSSET));
  76. }