Lines Matching +full:cpu +full:- +full:map
1 // SPDX-License-Identifier: GPL-2.0-only
19 #include <asm/cell-regs.h>
22 * Current implementation uses "cpu" nodes. We build our own mapping
23 * array of cpu numbers to cpu nodes locally for now to allow interrupt
25 * we implement cpu hotplug, we'll have to install an appropriate notifier
26 * in order to release references to the cpu going away
48 static cpumask_t cbe_local_mask[MAX_CBE] = { [0 ... MAX_CBE-1] = {CPU_BITS_NONE} };
64 if (np->data) in cbe_find_map()
65 return np->data; in cbe_find_map()
67 /* walk up path until cpu or be node was found */ in cbe_find_map()
70 tmp_np = tmp_np->parent; in cbe_find_map()
73 } while (!of_node_is_type(tmp_np, "cpu") || in cbe_find_map()
76 np->data = cbe_find_map(tmp_np); in cbe_find_map()
78 return np->data; in cbe_find_map()
83 struct cbe_regs_map *map = cbe_find_map(np); in cbe_get_pmd_regs() local
84 if (map == NULL) in cbe_get_pmd_regs()
86 return map->pmd_regs; in cbe_get_pmd_regs()
90 struct cbe_pmd_regs __iomem *cbe_get_cpu_pmd_regs(int cpu) in cbe_get_cpu_pmd_regs() argument
92 struct cbe_regs_map *map = cbe_thread_map[cpu].regs; in cbe_get_cpu_pmd_regs() local
93 if (map == NULL) in cbe_get_cpu_pmd_regs()
95 return map->pmd_regs; in cbe_get_cpu_pmd_regs()
101 struct cbe_regs_map *map = cbe_find_map(np); in cbe_get_pmd_shadow_regs() local
102 if (map == NULL) in cbe_get_pmd_shadow_regs()
104 return &map->pmd_shadow_regs; in cbe_get_pmd_shadow_regs()
107 struct cbe_pmd_shadow_regs *cbe_get_cpu_pmd_shadow_regs(int cpu) in cbe_get_cpu_pmd_shadow_regs() argument
109 struct cbe_regs_map *map = cbe_thread_map[cpu].regs; in cbe_get_cpu_pmd_shadow_regs() local
110 if (map == NULL) in cbe_get_cpu_pmd_shadow_regs()
112 return &map->pmd_shadow_regs; in cbe_get_cpu_pmd_shadow_regs()
117 struct cbe_regs_map *map = cbe_find_map(np); in cbe_get_iic_regs() local
118 if (map == NULL) in cbe_get_iic_regs()
120 return map->iic_regs; in cbe_get_iic_regs()
123 struct cbe_iic_regs __iomem *cbe_get_cpu_iic_regs(int cpu) in cbe_get_cpu_iic_regs() argument
125 struct cbe_regs_map *map = cbe_thread_map[cpu].regs; in cbe_get_cpu_iic_regs() local
126 if (map == NULL) in cbe_get_cpu_iic_regs()
128 return map->iic_regs; in cbe_get_cpu_iic_regs()
133 struct cbe_regs_map *map = cbe_find_map(np); in cbe_get_mic_tm_regs() local
134 if (map == NULL) in cbe_get_mic_tm_regs()
136 return map->mic_tm_regs; in cbe_get_mic_tm_regs()
139 struct cbe_mic_tm_regs __iomem *cbe_get_cpu_mic_tm_regs(int cpu) in cbe_get_cpu_mic_tm_regs() argument
141 struct cbe_regs_map *map = cbe_thread_map[cpu].regs; in cbe_get_cpu_mic_tm_regs() local
142 if (map == NULL) in cbe_get_cpu_mic_tm_regs()
144 return map->mic_tm_regs; in cbe_get_cpu_mic_tm_regs()
148 u32 cbe_get_hw_thread_id(int cpu) in cbe_get_hw_thread_id() argument
150 return cbe_thread_map[cpu].thread_id; in cbe_get_hw_thread_id()
154 u32 cbe_cpu_to_node(int cpu) in cbe_cpu_to_node() argument
156 return cbe_thread_map[cpu].cbe_id; in cbe_cpu_to_node()
199 static void __init cbe_fill_regs_map(struct cbe_regs_map *map) in cbe_fill_regs_map() argument
201 if(map->be_node) { in cbe_fill_regs_map()
204 be = map->be_node; in cbe_fill_regs_map()
209 map->pmd_regs = of_iomap(np, 0); in cbe_fill_regs_map()
213 for_each_node_by_type(np, "CBEA-Internal-Interrupt-Controller") { in cbe_fill_regs_map()
216 map->iic_regs = of_iomap(np, 2); in cbe_fill_regs_map()
220 for_each_node_by_type(np, "mic-tm") { in cbe_fill_regs_map()
223 map->mic_tm_regs = of_iomap(np, 0); in cbe_fill_regs_map()
227 struct device_node *cpu; in cbe_fill_regs_map() local
234 cpu = map->cpu_node; in cbe_fill_regs_map()
236 prop = of_get_property(cpu, "pervasive", NULL); in cbe_fill_regs_map()
238 map->pmd_regs = ioremap(prop->address, prop->len); in cbe_fill_regs_map()
240 prop = of_get_property(cpu, "iic", NULL); in cbe_fill_regs_map()
242 map->iic_regs = ioremap(prop->address, prop->len); in cbe_fill_regs_map()
244 prop = of_get_property(cpu, "mic-tm", NULL); in cbe_fill_regs_map()
246 map->mic_tm_regs = ioremap(prop->address, prop->len); in cbe_fill_regs_map()
255 struct device_node *cpu; in cbe_regs_init() local
257 /* Build local fast map of CPUs */ in cbe_regs_init()
264 /* Find maps for each device tree CPU */ in cbe_regs_init()
265 for_each_node_by_type(cpu, "cpu") { in cbe_regs_init()
266 struct cbe_regs_map *map; in cbe_regs_init() local
270 map = &cbe_regs_maps[cbe_id]; in cbe_regs_init()
275 cbe_regs_map_count--; in cbe_regs_init()
276 of_node_put(cpu); in cbe_regs_init()
279 of_node_put(map->cpu_node); in cbe_regs_init()
280 map->cpu_node = of_node_get(cpu); in cbe_regs_init()
285 if (thread->cpu_node == cpu) { in cbe_regs_init()
286 thread->regs = map; in cbe_regs_init()
287 thread->cbe_id = cbe_id; in cbe_regs_init()
288 map->be_node = thread->be_node; in cbe_regs_init()
290 if(thread->thread_id == 0) in cbe_regs_init()
295 cbe_fill_regs_map(map); in cbe_regs_init()