s = os = (char *)bootx_dt_strbase;
s += 4; while (s < (char *)bootx_dt_strend) { if (strcmp(s, str) == 0) return s - os;
s += strlen(s) + 1;
} return 0;
}
staticvoid __init bootx_dt_add_prop(char *name, void *data, int size, unsignedlong *mem_end)
{ unsignedlong soff = bootx_dt_find_string(name); if (data == NULL)
size = 0; if (soff == 0) {
bootx_printf("WARNING: Can't find string index for <%s>\n",
name); return;
} if (size > 0x20000) {
bootx_printf("WARNING: ignoring large property ");
bootx_printf("%s length 0x%x\n", name, size); return;
}
dt_push_token(OF_DT_PROP, mem_end);
dt_push_token(size, mem_end);
dt_push_token(soff, mem_end);
/* get the node's full name */
namep = np->full_name ? (char *)(base + np->full_name) : NULL; if (namep == NULL)
namep = "";
l = strlen(namep);
DBG("* struct: %s\n", namep);
/* Fixup an Apple bug where they have bogus \0 chars in the * middle of the path in some properties, and extract * the unit name (everything after the last '/').
*/
memcpy((void *)*mem_end, namep, l + 1);
namep = (char *)*mem_end; for (lp = p = namep, ep = namep + l; p < ep; p++) { if (*p == '/')
lp = namep; elseif (*p != 0)
*lp++ = *p;
}
*lp = 0;
*mem_end = ALIGN((unsignedlong)lp + 1, 4);
/* get and store all properties */ while (*ppp) { struct bootx_dt_prop *pp =
(struct bootx_dt_prop *)(base + *ppp);
namep = pp->name ? (char *)(base + pp->name) : NULL; /* Skip "name" */ if (namep == NULL || !strcmp(namep, "name")) goto next; /* Skip "bootargs" in /chosen too as we replace it */ if (node == bootx_node_chosen && !strcmp(namep, "bootargs")) goto next;
/* We haven't cleared any bss at this point, make sure * what we need is initialized
*/
bootx_dt_strbase = bootx_dt_strend = 0;
bootx_node_chosen = 0;
bootx_disp_path[0] = 0;
if (!BOOT_INFO_IS_V2_COMPATIBLE(bi))
bi->logicalDisplayBase = bi->dispDeviceBase;
/* Fixup depth 16 -> 15 as that's what MacOS calls 16bpp */ if (bi->dispDeviceDepth == 16)
bi->dispDeviceDepth = 15;
/* * Test if boot-info is compatible. Done only in config * CONFIG_BOOTX_TEXT since there is nothing much we can do * with an incompatible version, except display a message * and eventually hang the processor... * * I'll try to keep enough of boot-info compatible in the * future to always allow display of this message;
*/ if (!BOOT_INFO_IS_COMPATIBLE(bi)) {
bootx_printf(" !!! WARNING - Incompatible version" " of BootX !!!\n\n\n"); for (;;)
;
} if (bi->architecture != BOOT_ARCH_PCI) {
bootx_printf(" !!! WARNING - Unsupported machine" " architecture !\n"); for (;;)
;
}
/* New BootX enters kernel with MMU off, i/os are not allowed * here. This hack will have been done by the boostrap anyway.
*/ if (bi->version < 4) { /* * XXX If this is an iMac, turn off the USB controller.
*/
model = (char *) bootx_early_getprop(r4 + bi->deviceTreeOffset,
4, "model"); if (model
&& (strcmp(model, "iMac,1") == 0
|| strcmp(model, "PowerMac1,1") == 0)) {
bootx_printf("iMac,1 detected, shutting down USB\n");
out_le32((unsigned __iomem *)0x80880008, 1); /* XXX */
}
}
/* Get a pointer that points above the device tree, args, ramdisk, * etc... to use for generating the flattened tree
*/ if (bi->version < 5) {
space = bi->deviceTreeOffset + bi->deviceTreeSize; if (bi->ramDisk >= space)
space = bi->ramDisk + bi->ramDiskSize;
} else
space = bi->totalParamsSize;
bootx_printf("Total space used by parameters & ramdisk: 0x%x\n", space);
/* New BootX will have flushed all TLBs and enters kernel with * MMU switched OFF, so this should not be useful anymore.
*/ if (bi->version < 4) { unsignedlong x __maybe_unused;
bootx_printf("Touching pages...\n");
/* * Touch each page to make sure the PTEs for them * are in the hash table - the aim is to try to avoid * getting DSI exceptions while copying the kernel image.
*/ for (ptr = ((unsignedlong) &_stext) & PAGE_MASK;
ptr < (unsignedlong)bi + space; ptr += PAGE_SIZE)
x = *(volatileunsignedlong *)ptr;
}
/* Ok, now we need to generate a flattened device-tree to pass * to the kernel
*/
bootx_printf("Preparing boot params...\n");
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.