~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/powerpc/platforms/86xx/mpc86xx_smp.c

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0-or-later
  2 /*
  3  * Author: Xianghua Xiao <x.xiao@freescale.com>
  4  *         Zhang Wei <wei.zhang@freescale.com>
  5  *
  6  * Copyright 2006 Freescale Semiconductor Inc.
  7  */
  8 
  9 #include <linux/stddef.h>
 10 #include <linux/kernel.h>
 11 #include <linux/init.h>
 12 #include <linux/delay.h>
 13 #include <linux/pgtable.h>
 14 
 15 #include <asm/code-patching.h>
 16 #include <asm/page.h>
 17 #include <asm/pci-bridge.h>
 18 #include <asm/mpic.h>
 19 #include <asm/cacheflush.h>
 20 #include <asm/inst.h>
 21 
 22 #include <sysdev/fsl_soc.h>
 23 
 24 #include "mpc86xx.h"
 25 
 26 extern void __secondary_start_mpc86xx(void);
 27 
 28 #define MCM_PORT_CONFIG_OFFSET  0x10
 29 
 30 /* Offset from CCSRBAR */
 31 #define MPC86xx_MCM_OFFSET      (0x1000)
 32 #define MPC86xx_MCM_SIZE        (0x1000)
 33 
 34 static void __init
 35 smp_86xx_release_core(int nr)
 36 {
 37         __be32 __iomem *mcm_vaddr;
 38         unsigned long pcr;
 39 
 40         if (nr < 0 || nr >= NR_CPUS)
 41                 return;
 42 
 43         /*
 44          * Startup Core #nr.
 45          */
 46         mcm_vaddr = ioremap(get_immrbase() + MPC86xx_MCM_OFFSET,
 47                             MPC86xx_MCM_SIZE);
 48         pcr = in_be32(mcm_vaddr + (MCM_PORT_CONFIG_OFFSET >> 2));
 49         pcr |= 1 << (nr + 24);
 50         out_be32(mcm_vaddr + (MCM_PORT_CONFIG_OFFSET >> 2), pcr);
 51 
 52         iounmap(mcm_vaddr);
 53 }
 54 
 55 
 56 static int __init
 57 smp_86xx_kick_cpu(int nr)
 58 {
 59         unsigned int save_vector;
 60         unsigned long target, flags;
 61         int n = 0;
 62         unsigned int *vector = (unsigned int *)(KERNELBASE + 0x100);
 63 
 64         if (nr < 0 || nr >= NR_CPUS)
 65                 return -ENOENT;
 66 
 67         pr_debug("smp_86xx_kick_cpu: kick CPU #%d\n", nr);
 68 
 69         local_irq_save(flags);
 70 
 71         /* Save reset vector */
 72         save_vector = *vector;
 73 
 74         /* Setup fake reset vector to call __secondary_start_mpc86xx. */
 75         target = (unsigned long) __secondary_start_mpc86xx;
 76         patch_branch(vector, target, BRANCH_SET_LINK);
 77 
 78         /* Kick that CPU */
 79         smp_86xx_release_core(nr);
 80 
 81         /* Wait a bit for the CPU to take the exception. */
 82         while ((__secondary_hold_acknowledge != nr) && (n++, n < 1000))
 83                 mdelay(1);
 84 
 85         /* Restore the exception vector */
 86         patch_instruction(vector, ppc_inst(save_vector));
 87 
 88         local_irq_restore(flags);
 89 
 90         pr_debug("wait CPU #%d for %d msecs.\n", nr, n);
 91 
 92         return 0;
 93 }
 94 
 95 
 96 static void __init
 97 smp_86xx_setup_cpu(int cpu_nr)
 98 {
 99         mpic_setup_this_cpu();
100 }
101 
102 
103 struct smp_ops_t smp_86xx_ops = {
104         .cause_nmi_ipi = NULL,
105         .message_pass = smp_mpic_message_pass,
106         .probe = smp_mpic_probe,
107         .kick_cpu = smp_86xx_kick_cpu,
108         .setup_cpu = smp_86xx_setup_cpu,
109         .take_timebase = smp_generic_take_timebase,
110         .give_timebase = smp_generic_give_timebase,
111 };
112 
113 
114 void __init
115 mpc86xx_smp_init(void)
116 {
117         smp_ops = &smp_86xx_ops;
118 }
119 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php