Lines Matching +full:cpu +full:- +full:map
1 // SPDX-License-Identifier: GPL-2.0-only
20 #include <asm/cell-regs.h>
23 * Current implementation uses "cpu" nodes. We build our own mapping
24 * array of cpu numbers to cpu nodes locally for now to allow interrupt
26 * we implement cpu hotplug, we'll have to install an appropriate notifier
27 * in order to release references to the cpu going away
49 static cpumask_t cbe_local_mask[MAX_CBE] = { [0 ... MAX_CBE-1] = {CPU_BITS_NONE} };
65 if (np->data) in cbe_find_map()
66 return np->data; in cbe_find_map()
68 /* walk up path until cpu or be node was found */ in cbe_find_map()
71 tmp_np = tmp_np->parent; in cbe_find_map()
74 } while (!of_node_is_type(tmp_np, "cpu") || in cbe_find_map()
77 np->data = cbe_find_map(tmp_np); in cbe_find_map()
79 return np->data; in cbe_find_map()
84 struct cbe_regs_map *map = cbe_find_map(np); in cbe_get_pmd_regs() local
85 if (map == NULL) in cbe_get_pmd_regs()
87 return map->pmd_regs; in cbe_get_pmd_regs()
91 struct cbe_pmd_regs __iomem *cbe_get_cpu_pmd_regs(int cpu) in cbe_get_cpu_pmd_regs() argument
93 struct cbe_regs_map *map = cbe_thread_map[cpu].regs; in cbe_get_cpu_pmd_regs() local
94 if (map == NULL) in cbe_get_cpu_pmd_regs()
96 return map->pmd_regs; in cbe_get_cpu_pmd_regs()
102 struct cbe_regs_map *map = cbe_find_map(np); in cbe_get_pmd_shadow_regs() local
103 if (map == NULL) in cbe_get_pmd_shadow_regs()
105 return &map->pmd_shadow_regs; in cbe_get_pmd_shadow_regs()
108 struct cbe_pmd_shadow_regs *cbe_get_cpu_pmd_shadow_regs(int cpu) in cbe_get_cpu_pmd_shadow_regs() argument
110 struct cbe_regs_map *map = cbe_thread_map[cpu].regs; in cbe_get_cpu_pmd_shadow_regs() local
111 if (map == NULL) in cbe_get_cpu_pmd_shadow_regs()
113 return &map->pmd_shadow_regs; in cbe_get_cpu_pmd_shadow_regs()
118 struct cbe_regs_map *map = cbe_find_map(np); in cbe_get_iic_regs() local
119 if (map == NULL) in cbe_get_iic_regs()
121 return map->iic_regs; in cbe_get_iic_regs()
124 struct cbe_iic_regs __iomem *cbe_get_cpu_iic_regs(int cpu) in cbe_get_cpu_iic_regs() argument
126 struct cbe_regs_map *map = cbe_thread_map[cpu].regs; in cbe_get_cpu_iic_regs() local
127 if (map == NULL) in cbe_get_cpu_iic_regs()
129 return map->iic_regs; in cbe_get_cpu_iic_regs()
134 struct cbe_regs_map *map = cbe_find_map(np); in cbe_get_mic_tm_regs() local
135 if (map == NULL) in cbe_get_mic_tm_regs()
137 return map->mic_tm_regs; in cbe_get_mic_tm_regs()
140 struct cbe_mic_tm_regs __iomem *cbe_get_cpu_mic_tm_regs(int cpu) in cbe_get_cpu_mic_tm_regs() argument
142 struct cbe_regs_map *map = cbe_thread_map[cpu].regs; in cbe_get_cpu_mic_tm_regs() local
143 if (map == NULL) in cbe_get_cpu_mic_tm_regs()
145 return map->mic_tm_regs; in cbe_get_cpu_mic_tm_regs()
149 u32 cbe_get_hw_thread_id(int cpu) in cbe_get_hw_thread_id() argument
151 return cbe_thread_map[cpu].thread_id; in cbe_get_hw_thread_id()
155 u32 cbe_cpu_to_node(int cpu) in cbe_cpu_to_node() argument
157 return cbe_thread_map[cpu].cbe_id; in cbe_cpu_to_node()
200 static void __init cbe_fill_regs_map(struct cbe_regs_map *map) in cbe_fill_regs_map() argument
202 if(map->be_node) { in cbe_fill_regs_map()
205 be = map->be_node; in cbe_fill_regs_map()
210 map->pmd_regs = of_iomap(np, 0); in cbe_fill_regs_map()
214 for_each_node_by_type(np, "CBEA-Internal-Interrupt-Controller") { in cbe_fill_regs_map()
217 map->iic_regs = of_iomap(np, 2); in cbe_fill_regs_map()
221 for_each_node_by_type(np, "mic-tm") { in cbe_fill_regs_map()
224 map->mic_tm_regs = of_iomap(np, 0); in cbe_fill_regs_map()
228 struct device_node *cpu; in cbe_fill_regs_map() local
235 cpu = map->cpu_node; in cbe_fill_regs_map()
237 prop = of_get_property(cpu, "pervasive", NULL); in cbe_fill_regs_map()
239 map->pmd_regs = ioremap(prop->address, prop->len); in cbe_fill_regs_map()
241 prop = of_get_property(cpu, "iic", NULL); in cbe_fill_regs_map()
243 map->iic_regs = ioremap(prop->address, prop->len); in cbe_fill_regs_map()
245 prop = of_get_property(cpu, "mic-tm", NULL); in cbe_fill_regs_map()
247 map->mic_tm_regs = ioremap(prop->address, prop->len); in cbe_fill_regs_map()
256 struct device_node *cpu; in cbe_regs_init() local
258 /* Build local fast map of CPUs */ in cbe_regs_init()
265 /* Find maps for each device tree CPU */ in cbe_regs_init()
266 for_each_node_by_type(cpu, "cpu") { in cbe_regs_init()
267 struct cbe_regs_map *map; in cbe_regs_init() local
271 map = &cbe_regs_maps[cbe_id]; in cbe_regs_init()
276 cbe_regs_map_count--; in cbe_regs_init()
277 of_node_put(cpu); in cbe_regs_init()
280 of_node_put(map->cpu_node); in cbe_regs_init()
281 map->cpu_node = of_node_get(cpu); in cbe_regs_init()
286 if (thread->cpu_node == cpu) { in cbe_regs_init()
287 thread->regs = map; in cbe_regs_init()
288 thread->cbe_id = cbe_id; in cbe_regs_init()
289 map->be_node = thread->be_node; in cbe_regs_init()
291 if(thread->thread_id == 0) in cbe_regs_init()
296 cbe_fill_regs_map(map); in cbe_regs_init()