aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc64/kernel/prom.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sparc64/kernel/prom.c')
-rw-r--r--arch/sparc64/kernel/prom.c91
1 files changed, 61 insertions, 30 deletions
diff --git a/arch/sparc64/kernel/prom.c b/arch/sparc64/kernel/prom.c
index 7151513f156e..dbba82f9b142 100644
--- a/arch/sparc64/kernel/prom.c
+++ b/arch/sparc64/kernel/prom.c
@@ -38,7 +38,7 @@ struct device_node *of_find_node_by_phandle(phandle handle)
38{ 38{
39 struct device_node *np; 39 struct device_node *np;
40 40
41 for (np = allnodes; np != 0; np = np->allnext) 41 for (np = allnodes; np; np = np->allnext)
42 if (np->node == handle) 42 if (np->node == handle)
43 break; 43 break;
44 44
@@ -59,6 +59,9 @@ int of_getintprop_default(struct device_node *np, const char *name, int def)
59} 59}
60EXPORT_SYMBOL(of_getintprop_default); 60EXPORT_SYMBOL(of_getintprop_default);
61 61
62DEFINE_MUTEX(of_set_property_mutex);
63EXPORT_SYMBOL(of_set_property_mutex);
64
62int of_set_property(struct device_node *dp, const char *name, void *val, int len) 65int of_set_property(struct device_node *dp, const char *name, void *val, int len)
63{ 66{
64 struct property **prevp; 67 struct property **prevp;
@@ -82,7 +85,10 @@ int of_set_property(struct device_node *dp, const char *name, void *val, int len
82 void *old_val = prop->value; 85 void *old_val = prop->value;
83 int ret; 86 int ret;
84 87
88 mutex_lock(&of_set_property_mutex);
85 ret = prom_setprop(dp->node, name, val, len); 89 ret = prom_setprop(dp->node, name, val, len);
90 mutex_unlock(&of_set_property_mutex);
91
86 err = -EINVAL; 92 err = -EINVAL;
87 if (ret >= 0) { 93 if (ret >= 0) {
88 prop->value = new_val; 94 prop->value = new_val;
@@ -945,22 +951,30 @@ static void __init irq_trans_init(struct device_node *dp)
945 for (i = 0; i < ARRAY_SIZE(pci_irq_trans_table); i++) { 951 for (i = 0; i < ARRAY_SIZE(pci_irq_trans_table); i++) {
946 struct irq_trans *t = &pci_irq_trans_table[i]; 952 struct irq_trans *t = &pci_irq_trans_table[i];
947 953
948 if (!strcmp(model, t->name)) 954 if (!strcmp(model, t->name)) {
949 return t->init(dp); 955 t->init(dp);
956 return;
957 }
950 } 958 }
951 } 959 }
952#endif 960#endif
953#ifdef CONFIG_SBUS 961#ifdef CONFIG_SBUS
954 if (!strcmp(dp->name, "sbus") || 962 if (!strcmp(dp->name, "sbus") ||
955 !strcmp(dp->name, "sbi")) 963 !strcmp(dp->name, "sbi")) {
956 return sbus_irq_trans_init(dp); 964 sbus_irq_trans_init(dp);
965 return;
966 }
957#endif 967#endif
958 if (!strcmp(dp->name, "fhc") && 968 if (!strcmp(dp->name, "fhc") &&
959 !strcmp(dp->parent->name, "central")) 969 !strcmp(dp->parent->name, "central")) {
960 return central_irq_trans_init(dp); 970 central_irq_trans_init(dp);
971 return;
972 }
961 if (!strcmp(dp->name, "virtual-devices") || 973 if (!strcmp(dp->name, "virtual-devices") ||
962 !strcmp(dp->name, "niu")) 974 !strcmp(dp->name, "niu")) {
963 return sun4v_vdev_irq_trans_init(dp); 975 sun4v_vdev_irq_trans_init(dp);
976 return;
977 }
964} 978}
965 979
966static int is_root_node(const struct device_node *dp) 980static int is_root_node(const struct device_node *dp)
@@ -1231,32 +1245,49 @@ static void __init __build_path_component(struct device_node *dp, char *tmp_buf)
1231 1245
1232 if (parent != NULL) { 1246 if (parent != NULL) {
1233 if (!strcmp(parent->type, "pci") || 1247 if (!strcmp(parent->type, "pci") ||
1234 !strcmp(parent->type, "pciex")) 1248 !strcmp(parent->type, "pciex")) {
1235 return pci_path_component(dp, tmp_buf); 1249 pci_path_component(dp, tmp_buf);
1236 if (!strcmp(parent->type, "sbus")) 1250 return;
1237 return sbus_path_component(dp, tmp_buf); 1251 }
1238 if (!strcmp(parent->type, "upa")) 1252 if (!strcmp(parent->type, "sbus")) {
1239 return upa_path_component(dp, tmp_buf); 1253 sbus_path_component(dp, tmp_buf);
1240 if (!strcmp(parent->type, "ebus")) 1254 return;
1241 return ebus_path_component(dp, tmp_buf); 1255 }
1256 if (!strcmp(parent->type, "upa")) {
1257 upa_path_component(dp, tmp_buf);
1258 return;
1259 }
1260 if (!strcmp(parent->type, "ebus")) {
1261 ebus_path_component(dp, tmp_buf);
1262 return;
1263 }
1242 if (!strcmp(parent->name, "usb") || 1264 if (!strcmp(parent->name, "usb") ||
1243 !strcmp(parent->name, "hub")) 1265 !strcmp(parent->name, "hub")) {
1244 return usb_path_component(dp, tmp_buf); 1266 usb_path_component(dp, tmp_buf);
1245 if (!strcmp(parent->type, "i2c")) 1267 return;
1246 return i2c_path_component(dp, tmp_buf); 1268 }
1247 if (!strcmp(parent->type, "firewire")) 1269 if (!strcmp(parent->type, "i2c")) {
1248 return ieee1394_path_component(dp, tmp_buf); 1270 i2c_path_component(dp, tmp_buf);
1249 if (!strcmp(parent->type, "virtual-devices")) 1271 return;
1250 return vdev_path_component(dp, tmp_buf); 1272 }
1251 1273 if (!strcmp(parent->type, "firewire")) {
1274 ieee1394_path_component(dp, tmp_buf);
1275 return;
1276 }
1277 if (!strcmp(parent->type, "virtual-devices")) {
1278 vdev_path_component(dp, tmp_buf);
1279 return;
1280 }
1252 /* "isa" is handled with platform naming */ 1281 /* "isa" is handled with platform naming */
1253 } 1282 }
1254 1283
1255 /* Use platform naming convention. */ 1284 /* Use platform naming convention. */
1256 if (tlb_type == hypervisor) 1285 if (tlb_type == hypervisor) {
1257 return sun4v_path_component(dp, tmp_buf); 1286 sun4v_path_component(dp, tmp_buf);
1258 else 1287 return;
1259 return sun4u_path_component(dp, tmp_buf); 1288 } else {
1289 sun4u_path_component(dp, tmp_buf);
1290 }
1260} 1291}
1261 1292
1262static char * __init build_path_component(struct device_node *dp) 1293static char * __init build_path_component(struct device_node *dp)