platsmp.c 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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/mach-types.h>
  17. #include <asm/smp_scu.h>
  18. #include <asm/unified.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_CPUS) {
  47. printk(KERN_WARNING
  48. "Realview: no. of cores (%d) greater than configured "
  49. "maximum of %d - clipping\n",
  50. ncores, NR_CPUS);
  51. ncores = NR_CPUS;
  52. }
  53. for (i = 0; i < ncores; i++)
  54. set_cpu_possible(i, true);
  55. }
  56. void __init platform_smp_prepare_cpus(unsigned int max_cpus)
  57. {
  58. int i;
  59. /*
  60. * Initialise the present map, which describes the set of CPUs
  61. * actually populated at the present time.
  62. */
  63. for (i = 0; i < max_cpus; i++)
  64. set_cpu_present(i, true);
  65. scu_enable(scu_base_addr());
  66. /*
  67. * Write the address of secondary startup into the
  68. * system-wide flags register. The BootMonitor waits
  69. * until it receives a soft interrupt, and then the
  70. * secondary CPU branches to this address.
  71. */
  72. __raw_writel(BSYM(virt_to_phys(versatile_secondary_startup)),
  73. __io_address(REALVIEW_SYS_FLAGSSET));
  74. }