diff options
Diffstat (limited to 'arch/powerpc/sysdev/mpic.c')
-rw-r--r-- | arch/powerpc/sysdev/mpic.c | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c index 9c3af5045495..3981ae4cb58e 100644 --- a/arch/powerpc/sysdev/mpic.c +++ b/arch/powerpc/sysdev/mpic.c | |||
@@ -279,28 +279,29 @@ static void _mpic_map_mmio(struct mpic *mpic, phys_addr_t phys_addr, | |||
279 | } | 279 | } |
280 | 280 | ||
281 | #ifdef CONFIG_PPC_DCR | 281 | #ifdef CONFIG_PPC_DCR |
282 | static void _mpic_map_dcr(struct mpic *mpic, struct mpic_reg_bank *rb, | 282 | static void _mpic_map_dcr(struct mpic *mpic, struct device_node *node, |
283 | struct mpic_reg_bank *rb, | ||
283 | unsigned int offset, unsigned int size) | 284 | unsigned int offset, unsigned int size) |
284 | { | 285 | { |
285 | const u32 *dbasep; | 286 | const u32 *dbasep; |
286 | 287 | ||
287 | dbasep = of_get_property(mpic->irqhost->of_node, "dcr-reg", NULL); | 288 | dbasep = of_get_property(node, "dcr-reg", NULL); |
288 | 289 | ||
289 | rb->dhost = dcr_map(mpic->irqhost->of_node, *dbasep + offset, size); | 290 | rb->dhost = dcr_map(node, *dbasep + offset, size); |
290 | BUG_ON(!DCR_MAP_OK(rb->dhost)); | 291 | BUG_ON(!DCR_MAP_OK(rb->dhost)); |
291 | } | 292 | } |
292 | 293 | ||
293 | static inline void mpic_map(struct mpic *mpic, phys_addr_t phys_addr, | 294 | static inline void mpic_map(struct mpic *mpic, struct device_node *node, |
294 | struct mpic_reg_bank *rb, unsigned int offset, | 295 | phys_addr_t phys_addr, struct mpic_reg_bank *rb, |
295 | unsigned int size) | 296 | unsigned int offset, unsigned int size) |
296 | { | 297 | { |
297 | if (mpic->flags & MPIC_USES_DCR) | 298 | if (mpic->flags & MPIC_USES_DCR) |
298 | _mpic_map_dcr(mpic, rb, offset, size); | 299 | _mpic_map_dcr(mpic, node, rb, offset, size); |
299 | else | 300 | else |
300 | _mpic_map_mmio(mpic, phys_addr, rb, offset, size); | 301 | _mpic_map_mmio(mpic, phys_addr, rb, offset, size); |
301 | } | 302 | } |
302 | #else /* CONFIG_PPC_DCR */ | 303 | #else /* CONFIG_PPC_DCR */ |
303 | #define mpic_map(m,p,b,o,s) _mpic_map_mmio(m,p,b,o,s) | 304 | #define mpic_map(m,n,p,b,o,s) _mpic_map_mmio(m,p,b,o,s) |
304 | #endif /* !CONFIG_PPC_DCR */ | 305 | #endif /* !CONFIG_PPC_DCR */ |
305 | 306 | ||
306 | 307 | ||
@@ -507,9 +508,8 @@ static void __init mpic_scan_ht_pics(struct mpic *mpic) | |||
507 | printk(KERN_INFO "mpic: Setting up HT PICs workarounds for U3/U4\n"); | 508 | printk(KERN_INFO "mpic: Setting up HT PICs workarounds for U3/U4\n"); |
508 | 509 | ||
509 | /* Allocate fixups array */ | 510 | /* Allocate fixups array */ |
510 | mpic->fixups = alloc_bootmem(128 * sizeof(struct mpic_irq_fixup)); | 511 | mpic->fixups = kzalloc(128 * sizeof(*mpic->fixups), GFP_KERNEL); |
511 | BUG_ON(mpic->fixups == NULL); | 512 | BUG_ON(mpic->fixups == NULL); |
512 | memset(mpic->fixups, 0, 128 * sizeof(struct mpic_irq_fixup)); | ||
513 | 513 | ||
514 | /* Init spinlock */ | 514 | /* Init spinlock */ |
515 | spin_lock_init(&mpic->fixup_lock); | 515 | spin_lock_init(&mpic->fixup_lock); |
@@ -1052,11 +1052,10 @@ struct mpic * __init mpic_alloc(struct device_node *node, | |||
1052 | int intvec_top; | 1052 | int intvec_top; |
1053 | u64 paddr = phys_addr; | 1053 | u64 paddr = phys_addr; |
1054 | 1054 | ||
1055 | mpic = alloc_bootmem(sizeof(struct mpic)); | 1055 | mpic = kzalloc(sizeof(struct mpic), GFP_KERNEL); |
1056 | if (mpic == NULL) | 1056 | if (mpic == NULL) |
1057 | return NULL; | 1057 | return NULL; |
1058 | 1058 | ||
1059 | memset(mpic, 0, sizeof(struct mpic)); | ||
1060 | mpic->name = name; | 1059 | mpic->name = name; |
1061 | 1060 | ||
1062 | mpic->hc_irq = mpic_irq_chip; | 1061 | mpic->hc_irq = mpic_irq_chip; |
@@ -1109,9 +1108,8 @@ struct mpic * __init mpic_alloc(struct device_node *node, | |||
1109 | psize /= 4; | 1108 | psize /= 4; |
1110 | bits = intvec_top + 1; | 1109 | bits = intvec_top + 1; |
1111 | mapsize = BITS_TO_LONGS(bits) * sizeof(unsigned long); | 1110 | mapsize = BITS_TO_LONGS(bits) * sizeof(unsigned long); |
1112 | mpic->protected = alloc_bootmem(mapsize); | 1111 | mpic->protected = kzalloc(mapsize, GFP_KERNEL); |
1113 | BUG_ON(mpic->protected == NULL); | 1112 | BUG_ON(mpic->protected == NULL); |
1114 | memset(mpic->protected, 0, mapsize); | ||
1115 | for (i = 0; i < psize; i++) { | 1113 | for (i = 0; i < psize; i++) { |
1116 | if (psrc[i] > intvec_top) | 1114 | if (psrc[i] > intvec_top) |
1117 | continue; | 1115 | continue; |
@@ -1152,8 +1150,8 @@ struct mpic * __init mpic_alloc(struct device_node *node, | |||
1152 | } | 1150 | } |
1153 | 1151 | ||
1154 | /* Map the global registers */ | 1152 | /* Map the global registers */ |
1155 | mpic_map(mpic, paddr, &mpic->gregs, MPIC_INFO(GREG_BASE), 0x1000); | 1153 | mpic_map(mpic, node, paddr, &mpic->gregs, MPIC_INFO(GREG_BASE), 0x1000); |
1156 | mpic_map(mpic, paddr, &mpic->tmregs, MPIC_INFO(TIMER_BASE), 0x1000); | 1154 | mpic_map(mpic, node, paddr, &mpic->tmregs, MPIC_INFO(TIMER_BASE), 0x1000); |
1157 | 1155 | ||
1158 | /* Reset */ | 1156 | /* Reset */ |
1159 | if (flags & MPIC_WANTS_RESET) { | 1157 | if (flags & MPIC_WANTS_RESET) { |
@@ -1194,7 +1192,7 @@ struct mpic * __init mpic_alloc(struct device_node *node, | |||
1194 | 1192 | ||
1195 | /* Map the per-CPU registers */ | 1193 | /* Map the per-CPU registers */ |
1196 | for (i = 0; i < mpic->num_cpus; i++) { | 1194 | for (i = 0; i < mpic->num_cpus; i++) { |
1197 | mpic_map(mpic, paddr, &mpic->cpuregs[i], | 1195 | mpic_map(mpic, node, paddr, &mpic->cpuregs[i], |
1198 | MPIC_INFO(CPU_BASE) + i * MPIC_INFO(CPU_STRIDE), | 1196 | MPIC_INFO(CPU_BASE) + i * MPIC_INFO(CPU_STRIDE), |
1199 | 0x1000); | 1197 | 0x1000); |
1200 | } | 1198 | } |
@@ -1202,7 +1200,7 @@ struct mpic * __init mpic_alloc(struct device_node *node, | |||
1202 | /* Initialize main ISU if none provided */ | 1200 | /* Initialize main ISU if none provided */ |
1203 | if (mpic->isu_size == 0) { | 1201 | if (mpic->isu_size == 0) { |
1204 | mpic->isu_size = mpic->num_sources; | 1202 | mpic->isu_size = mpic->num_sources; |
1205 | mpic_map(mpic, paddr, &mpic->isus[0], | 1203 | mpic_map(mpic, node, paddr, &mpic->isus[0], |
1206 | MPIC_INFO(IRQ_BASE), MPIC_INFO(IRQ_STRIDE) * mpic->isu_size); | 1204 | MPIC_INFO(IRQ_BASE), MPIC_INFO(IRQ_STRIDE) * mpic->isu_size); |
1207 | } | 1205 | } |
1208 | mpic->isu_shift = 1 + __ilog2(mpic->isu_size - 1); | 1206 | mpic->isu_shift = 1 + __ilog2(mpic->isu_size - 1); |
@@ -1256,8 +1254,10 @@ void __init mpic_assign_isu(struct mpic *mpic, unsigned int isu_num, | |||
1256 | 1254 | ||
1257 | BUG_ON(isu_num >= MPIC_MAX_ISU); | 1255 | BUG_ON(isu_num >= MPIC_MAX_ISU); |
1258 | 1256 | ||
1259 | mpic_map(mpic, paddr, &mpic->isus[isu_num], 0, | 1257 | mpic_map(mpic, mpic->irqhost->of_node, |
1258 | paddr, &mpic->isus[isu_num], 0, | ||
1260 | MPIC_INFO(IRQ_STRIDE) * mpic->isu_size); | 1259 | MPIC_INFO(IRQ_STRIDE) * mpic->isu_size); |
1260 | |||
1261 | if ((isu_first + mpic->isu_size) > mpic->num_sources) | 1261 | if ((isu_first + mpic->isu_size) > mpic->num_sources) |
1262 | mpic->num_sources = isu_first + mpic->isu_size; | 1262 | mpic->num_sources = isu_first + mpic->isu_size; |
1263 | } | 1263 | } |
@@ -1351,7 +1351,8 @@ void __init mpic_init(struct mpic *mpic) | |||
1351 | 1351 | ||
1352 | #ifdef CONFIG_PM | 1352 | #ifdef CONFIG_PM |
1353 | /* allocate memory to save mpic state */ | 1353 | /* allocate memory to save mpic state */ |
1354 | mpic->save_data = alloc_bootmem(mpic->num_sources * sizeof(struct mpic_irq_save)); | 1354 | mpic->save_data = kmalloc(mpic->num_sources * sizeof(*mpic->save_data), |
1355 | GFP_KERNEL); | ||
1355 | BUG_ON(mpic->save_data == NULL); | 1356 | BUG_ON(mpic->save_data == NULL); |
1356 | #endif | 1357 | #endif |
1357 | } | 1358 | } |