uval ofd_devtree_init(uval mem, uval *space) { uval sz; uval mapped; /* map the first page, there may be more */ mapped = map_pages(mem, mem, PGSIZE); sz = ofd_size(mem); *space = ofd_space(mem); if (sz > mapped) { /* map the rest */ map_pages(mem + mapped, mem + mapped, sz - mapped); } #ifdef OFD_DEBUG ofd_walk((void *)mem, OFD_ROOT, ofd_dump_props, OFD_DUMP_VALUES); #endif /* scan the tree and identify resources */ ofd_pci_addr(mem); ofd_proc_dev_probe((void *)mem); if (ofd_platform_probe) ofd_platform_probe((void *)mem); *space -= 8; return mem; }
ulong ofd_dom0_fixup(struct domain *d, ulong mem, const char *cmdline, ulong shared_info) { const char compat[] = "Hypervisor,Maple"; const char d0[] = "dom0"; void *m; const ofdn_t n = OFD_ROOT; ofdn_t r; u32 did; m = (void *)mem; #ifdef PAPR_VDEVICE printk("Add /vdevice\n"); ofd_vdevice(m, d); printk("Add /aliases props\n"); ofd_aliases_props(m); #endif printk("Add /openprom props\n"); ofd_openprom_props(m); printk("Add /options props\n"); ofd_options_props(m); printk("Add /cpus props\n"); ofd_cpus_props(m, d); printk("Add /chosen props\n"); ofd_chosen_props(m, cmdline); printk("fix /memory props\n"); ofd_memory_props(m, d); printk("fix /xen props\n"); ofd_xen_props(m, d, shared_info); printk("Remove original /dart\n"); ofd_prune_path(m, "/dart"); printk("Remove original /rtas\n"); ofd_prune_path(m, "/rtas"); rtas_proxy_init(m); #ifdef FIX_COMPAT r = ofd_prop_add(m, n, "compatible", compat, sizeof (compat)); ASSERT( r > 0 ); #else (void)compat; #endif did = d->domain_id; r = ofd_prop_add(m, n, "ibm,partition-no", &did, sizeof(did)); ASSERT( r > 0 ); r = ofd_prop_add(m, n, "ibm,partition-name", d0, sizeof (d0)); ASSERT( r > 0 ); #ifdef DEBUG ofd_walk(m, __func__, OFD_ROOT, ofd_dump_props, OFD_DUMP_ALL); #endif return ofd_size(m); }