// SPDX-License-Identifier: GPL-2.0-or-later /* * OLPC-specific OFW device tree support code. * * Paul Mackerras August 1996. * Copyright (C) 1996-2005 Paul Mackerras. * * Adapted for 64bit PowerPC by Dave Engebretsen and Peter Bergner. * {engebret|bergner}@us.ibm.com * * Adapted for sparc by David S. Miller davem@davemloft.net * Adapted for x86/OLPC by Andres Salomon <dilinger@queued.net>
*/
/* * To minimize the number of allocations, grab at least * PAGE_SIZE of memory (that's an arbitrary choice that's * fast enough on the platforms we care about while minimizing * wasted bootmem) and hand off chunks of it to callers.
*/
res = memblock_alloc_or_panic(chunk_size, SMP_CACHE_BYTES);
prom_early_allocated += chunk_size;
memset(res, 0, chunk_size);
free_mem = chunk_size;
mem = res;
}
/* allocate from the local cache */
free_mem -= size;
res = mem;
mem += size; return res;
}
/* * Extract board revision directly from OFW device tree. * We can't use olpc_platform_info because that hasn't been set up yet.
*/ static u32 __init olpc_dt_get_board_revision(void)
{
phandle node;
__be32 rev; int r;
node = olpc_dt_finddevice("/"); if (!node) return 0;
r = olpc_dt_getproperty(node, "board-revision-int",
(char *) &rev, sizeof(rev)); if (r < 0) return 0;
if (olpc_dt_compatible_match(node, "olpc,xo1-battery")) { /* * If we have a olpc,xo1-battery compatible, then we're * running a new enough firmware that already has * the dcon node.
*/ return;
}
if (olpc_dt_compatible_match(node, "olpc,xo1-battery")) { /* * If we have a olpc,xo1-battery compatible, then we're * running a new enough firmware that already has * the dcon and RTC nodes.
*/ return;
}
root = olpc_dt_getsibling(0); if (!root) {
pr_err("PROM: unable to get root node from OFW!\n"); return;
}
of_pdt_build_devicetree(root, &prom_olpc_ops);
pr_info("PROM DT: Built device tree with %u bytes of memory.\n",
prom_early_allocated);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.