aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/sysdev/mpic.c50
1 files changed, 21 insertions, 29 deletions
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index 8f24c6e8f535..59564dcaab14 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -1137,19 +1137,17 @@ struct mpic * __init mpic_alloc(struct device_node *node,
1137 unsigned int irq_count, 1137 unsigned int irq_count,
1138 const char *name) 1138 const char *name)
1139{ 1139{
1140 struct mpic *mpic; 1140 int i, psize, intvec_top;
1141 u32 greg_feature; 1141 struct mpic *mpic;
1142 const char *vers; 1142 u32 greg_feature;
1143 int i; 1143 const char *vers;
1144 int intvec_top; 1144 const u32 *psrc;
1145 1145
1146 /* 1146 /* This code assumes that a non-NULL device node is passed in */
1147 * If no phyiscal address was specified then all of the phyiscal 1147 BUG_ON(!node);
1148 * addressing parameters must come from the device-tree.
1149 */
1150 if (!phys_addr) {
1151 BUG_ON(!node);
1152 1148
1149 /* Pick the physical address from the device tree if unspecified */
1150 if (!phys_addr) {
1153 /* Check if it is DCR-based */ 1151 /* Check if it is DCR-based */
1154 if (of_get_property(node, "dcr-reg", NULL)) { 1152 if (of_get_property(node, "dcr-reg", NULL)) {
1155 flags |= MPIC_USES_DCR; 1153 flags |= MPIC_USES_DCR;
@@ -1211,28 +1209,22 @@ struct mpic * __init mpic_alloc(struct device_node *node,
1211 mpic->spurious_vec = intvec_top; 1209 mpic->spurious_vec = intvec_top;
1212 1210
1213 /* Check for "big-endian" in device-tree */ 1211 /* Check for "big-endian" in device-tree */
1214 if (node && of_get_property(node, "big-endian", NULL) != NULL) 1212 if (of_get_property(node, "big-endian", NULL) != NULL)
1215 mpic->flags |= MPIC_BIG_ENDIAN; 1213 mpic->flags |= MPIC_BIG_ENDIAN;
1216 if (node && of_device_is_compatible(node, "fsl,mpic")) 1214 if (of_device_is_compatible(node, "fsl,mpic"))
1217 mpic->flags |= MPIC_FSL; 1215 mpic->flags |= MPIC_FSL;
1218 1216
1219 /* Look for protected sources */ 1217 /* Look for protected sources */
1220 if (node) { 1218 psrc = of_get_property(node, "protected-sources", &psize);
1221 int psize; 1219 if (psrc) {
1222 unsigned int bits, mapsize; 1220 /* Allocate a bitmap with one bit per interrupt */
1223 const u32 *psrc = 1221 unsigned int mapsize = BITS_TO_LONGS(intvec_top + 1);
1224 of_get_property(node, "protected-sources", &psize); 1222 mpic->protected = kzalloc(mapsize*sizeof(long), GFP_KERNEL);
1225 if (psrc) { 1223 BUG_ON(mpic->protected == NULL);
1226 psize /= 4; 1224 for (i = 0; i < psize/sizeof(u32); i++) {
1227 bits = intvec_top + 1; 1225 if (psrc[i] > intvec_top)
1228 mapsize = BITS_TO_LONGS(bits) * sizeof(unsigned long); 1226 continue;
1229 mpic->protected = kzalloc(mapsize, GFP_KERNEL); 1227 __set_bit(psrc[i], mpic->protected);
1230 BUG_ON(mpic->protected == NULL);
1231 for (i = 0; i < psize; i++) {
1232 if (psrc[i] > intvec_top)
1233 continue;
1234 __set_bit(psrc[i], mpic->protected);
1235 }
1236 } 1228 }
1237 } 1229 }
1238 1230