platsmp.c 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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 <mach/board-eb.h>
  20. #include <mach/board-pb11mp.h>
  21. #include <mach/board-pbx.h>
  22. #include "core.h"
  23. extern void versatile_secondary_startup(void);
  24. static void __iomem *scu_base_addr(void)
  25. {
  26. if (machine_is_realview_eb_mp())
  27. return __io_address(REALVIEW_EB11MP_SCU_BASE);
  28. else if (machine_is_realview_pb11mp())
  29. return __io_address(REALVIEW_TC11MP_SCU_BASE);
  30. else if (machine_is_realview_pbx() &&
  31. (core_tile_pbx11mp() || core_tile_pbxa9mp()))
  32. return __io_address(REALVIEW_PBX_TILE_SCU_BASE);
  33. else
  34. return (void __iomem *)0;
  35. }
  36. /*
  37. * Initialise the CPU possible map early - this describes the CPUs
  38. * which may be present or become present in the system.
  39. */
  40. void __init smp_init_cpus(void)
  41. {
  42. void __iomem *scu_base = scu_base_addr();
  43. unsigned int i, ncores;
  44. ncores = scu_base ? scu_get_core_count(scu_base) : 1;
  45. /* sanity check */
  46. if (ncores > nr_cpu_ids) {
  47. pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
  48. ncores, nr_cpu_ids);
  49. ncores = nr_cpu_ids;
  50. }
  51. for (i = 0; i < ncores; i++)
  52. set_cpu_possible(i, true);
  53. set_smp_cross_call(gic_raise_softirq);
  54. }
  55. void __init platform_smp_prepare_cpus(unsigned int max_cpus)
  56. {
  57. scu_enable(scu_base_addr());
  58. /*
  59. * Write the address of secondary startup into the
  60. * system-wide flags register. The BootMonitor waits
  61. * until it receives a soft interrupt, and then the
  62. * secondary CPU branches to this address.
  63. */
  64. __raw_writel(virt_to_phys(versatile_secondary_startup),
  65. __io_address(REALVIEW_SYS_FLAGSSET));
  66. }