006-amp_support.patch 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. From 25a68b8cd8ea1553f8b56278418d6c1ecc12e247 Mon Sep 17 00:00:00 2001
  2. From: Daniel Hellstrom <[email protected]>
  3. Date: Wed, 22 Sep 2010 10:19:34 +0200
  4. Subject: [PATCH] SPARC/LEON: added support for AMP systems with IRQAMP IRQ Controller.
  5. Signed-off-by: Daniel Hellstrom <[email protected]>
  6. ---
  7. arch/sparc/include/asm/leon.h | 12 ++++++++++++
  8. arch/sparc/include/asm/leon_amba.h | 6 +++---
  9. arch/sparc/kernel/leon_kernel.c | 14 ++++++++++++++
  10. 3 files changed, 29 insertions(+), 3 deletions(-)
  11. --- a/arch/sparc/include/asm/leon.h
  12. +++ b/arch/sparc/include/asm/leon.h
  13. @@ -224,6 +224,18 @@ static inline void sparc_leon3_disable_c
  14. "sta %%l2, [%%g0] 2\n\t" : : : "l1", "l2");
  15. };
  16. +static inline unsigned long sparc_leon3_asr17(void)
  17. +{
  18. + u32 asr17;
  19. + __asm__ __volatile__ ("rd %%asr17, %0\n\t" : "=r"(asr17));
  20. + return asr17;
  21. +};
  22. +
  23. +static inline int sparc_leon3_cpuid(void)
  24. +{
  25. + return sparc_leon3_asr17() >> 28;
  26. +}
  27. +
  28. #endif /*!__ASSEMBLY__*/
  29. #ifdef CONFIG_SMP
  30. --- a/arch/sparc/include/asm/leon_amba.h
  31. +++ b/arch/sparc/include/asm/leon_amba.h
  32. @@ -100,9 +100,8 @@ struct leon3_irqctrl_regs_map {
  33. u32 mpbroadcast;
  34. u32 notused02;
  35. u32 notused03;
  36. - u32 notused10;
  37. - u32 notused11;
  38. - u32 notused12;
  39. + u32 ampctrl;
  40. + u32 icsel[2];
  41. u32 notused13;
  42. u32 notused20;
  43. u32 notused21;
  44. @@ -112,6 +111,7 @@ struct leon3_irqctrl_regs_map {
  45. u32 force[16];
  46. /* Extended IRQ registers */
  47. u32 intid[16]; /* 0xc0 */
  48. + u32 unused[(0x1000-0x100)/4];
  49. };
  50. struct leon3_apbuart_regs_map {
  51. --- a/arch/sparc/kernel/leon_kernel.c
  52. +++ b/arch/sparc/kernel/leon_kernel.c
  53. @@ -108,6 +108,7 @@ void __init leon_init_timers(irq_handler
  54. struct device_node *rootnp, *np;
  55. struct property *pp;
  56. int len;
  57. + int cpu, icsel;
  58. leondebug_irq_disable = 0;
  59. leon_debug_irqout = 0;
  60. @@ -153,6 +154,19 @@ void __init leon_init_timers(irq_handler
  61. LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[1].ctrl, 0);
  62. # endif
  63. + /* The IRQ controller may (if implemented) consist of multiple
  64. + * IRQ controllers, each mapped on a 4Kb boundary.
  65. + * Each CPU may be routed to different IRQCTRLs, however
  66. + * we assume that all CPUs (in SMP system) is routed to the
  67. + * same IRQ Controller, and for non-SMP only one IRQCTRL is
  68. + * accessed anyway.
  69. + * In AMP systems, Linux may not be run on CPU0.
  70. + */
  71. + cpu = sparc_leon3_cpuid();
  72. + icsel = LEON3_BYPASS_LOAD_PA(&leon3_irqctrl_regs->icsel[cpu/8]);
  73. + icsel = (icsel >> ((7 - (cpu&0x7)) * 4)) & 0xf;
  74. + leon3_irqctrl_regs += icsel;
  75. +
  76. LEON3_BYPASS_STORE_PA(&(leon3_irqctrl_regs->mask[0]), 0);
  77. eirq = (LEON3_BYPASS_LOAD_PA(&leon3_irqctrl_regs->mpstatus) >> 16) & 0xf;
  78. if ( eirq != 0 ) {