static int __init export_htab_values(void) { struct device_node *node; struct property *prop; /* On machines with no htab htab_address is NULL */ if (!htab_address) return -ENODEV; node = of_find_node_by_path("/chosen"); if (!node) return -ENODEV; /* remove any stale propertys so ours can be found */ prop = of_find_property(node, htab_base_prop.name, NULL); if (prop) prom_remove_property(node, prop); prop = of_find_property(node, htab_size_prop.name, NULL); if (prop) prom_remove_property(node, prop); htab_base = __pa(htab_address); prom_add_property(node, &htab_base_prop); prom_add_property(node, &htab_size_prop); of_node_put(node); return 0; }
static void __init export_crashk_values(void) { struct device_node *node; struct property *prop; node = of_find_node_by_path("/chosen"); if (!node) return; /* There might be existing crash kernel properties, but we can't * be sure what's in them, so remove them. */ prop = of_find_property(node, "linux,crashkernel-base", NULL); if (prop) prom_remove_property(node, prop); prop = of_find_property(node, "linux,crashkernel-size", NULL); if (prop) prom_remove_property(node, prop); if (crashk_res.start != 0) { prom_add_property(node, &crashk_base_prop); crashk_size = crashk_res.end - crashk_res.start + 1; prom_add_property(node, &crashk_size_prop); } of_node_put(node); }
static void __init export_htab_values(void) { struct device_node *node; struct property *prop; node = of_find_node_by_path("/chosen"); if (!node) return; /* remove any stale propertys so ours can be found */ prop = of_find_property(node, kernel_end_prop.name, NULL); if (prop) prom_remove_property(node, prop); prop = of_find_property(node, htab_base_prop.name, NULL); if (prop) prom_remove_property(node, prop); prop = of_find_property(node, htab_size_prop.name, NULL); if (prop) prom_remove_property(node, prop); /* information needed by userspace when using default_machine_kexec */ kernel_end = __pa(_end); prom_add_property(node, &kernel_end_prop); /* On machines with no htab htab_address is NULL */ if (NULL == htab_address) goto out; htab_base = __pa(htab_address); prom_add_property(node, &htab_base_prop); prom_add_property(node, &htab_size_prop); out: of_node_put(node); }
static int update_dt_node(u32 phandle) { struct update_props_workarea *upwa; struct device_node *dn; struct property *prop = NULL; int i, rc; char *prop_data; char *rtas_buf; int update_properties_token; update_properties_token = rtas_token("ibm,update-properties"); if (update_properties_token == RTAS_UNKNOWN_SERVICE) return -EINVAL; rtas_buf = kzalloc(RTAS_DATA_BUF_SIZE, GFP_KERNEL); if (!rtas_buf) return -ENOMEM; dn = of_find_node_by_phandle(phandle); if (!dn) { kfree(rtas_buf); return -ENOENT; } upwa = (struct update_props_workarea *)&rtas_buf[0]; upwa->phandle = phandle; do { rc = mobility_rtas_call(update_properties_token, rtas_buf); if (rc < 0) break; prop_data = rtas_buf + sizeof(*upwa); for (i = 0; i < upwa->nprops; i++) { char *prop_name; u32 vd; prop_name = prop_data + 1; prop_data += strlen(prop_name) + 1; vd = *prop_data++; switch (vd) { case 0x00000000: /* */ break; case 0x80000000: prop = of_find_property(dn, prop_name, NULL); prom_remove_property(dn, prop); prop = NULL; break; default: rc = update_dt_property(dn, &prop, prop_name, vd, prop_data); if (rc) { printk(KERN_ERR "Could not update %s" " property\n", prop_name); } prop_data += vd; } } } while (rc == 1); of_node_put(dn); kfree(rtas_buf); return 0; }