FreeBSD/sys/boot/powerpc/kboot/kbootfdt.c
/* Fix up wrong values added to the device tree by prom_init() in Linux */
Fix up wrong values added to the device tree by prom_init() in Linux
Fix up wrong values added to the device tree by prom_init () in Linux
static void
fdt_linux_fixups(void *fdtp)
{
	int offset, len;
	const void *prop;
	offset = fdt_path_offset(fdtp, "/memory@0");
	if (offset > 0)
		fdt_delprop(fdtp, offset, "available");
	offset = fdt_path_offset(fdtp, "/ibm,opal");
	if (offset > 0) {
		uint64_t *base, *size;
		base = fdt_getprop(fdtp, offset, "opal-base-address",
		    &len);
		size = fdt_getprop(fdtp, offset, "opal-runtime-size",
		    &len);
		if (base != NULL && size != NULL)
			fdt_add_mem_rsv(fdtp, fdt64_to_cpu(*base),
			    fdt64_to_cpu(*size));
	}
	offset = fdt_path_offset(fdtp, "/rtas");
	if (offset > 0) {
		uint32_t *base, *size;
		base = fdt_getprop(fdtp, offset, "linux,rtas-base", &len);
		size = fdt_getprop(fdtp, offset, "rtas-size", &len);
		if (base != NULL && size != NULL)
			fdt_add_mem_rsv(fdtp, fdt32_to_cpu(*base),
			    fdt32_to_cpu(*size));
	}
	offset = fdt_path_offset(fdtp, "/chosen");
	if (offset > 0) {
		fdt_delprop(fdtp, offset, "cpu"); 
		offset = fdt_path_offset(fdtp, "/chosen");
		prop = fdt_getprop(fdtp, offset, "linux,stdout-package", &len);
		if (prop != NULL) {
			fdt_setprop(fdtp, offset, "stdout", prop, len);
			offset = fdt_path_offset(fdtp, "/chosen");
			fdt_setprop(fdtp, offset, "stdin", prop, len);
		}
	}
}
static void fdt_linux_fixups ( void * fdtp ) { int offset , len ; const void * prop ; offset = fdt_path_offset ( fdtp , " " ) ; if ( offset > 0 ) fdt_delprop ( fdtp , offset , " " ) ; offset = fdt_path_offset ( fdtp , " " ) ; if ( offset > 0 ) { uint64_t * base , * size ; base = fdt_getprop ( fdtp , offset , " " , & len ) ; size = fdt_getprop ( fdtp , offset , " " , & len ) ; if ( base != NULL && size != NULL ) fdt_add_mem_rsv ( fdtp , fdt64_to_cpu ( * base ) , fdt64_to_cpu ( * size ) ) ; } offset = fdt_path_offset ( fdtp , " " ) ; if ( offset > 0 ) { uint32_t * base , * size ; base = fdt_getprop ( fdtp , offset , " " , & len ) ; size = fdt_getprop ( fdtp , offset , " " , & len ) ; if ( base != NULL && size != NULL ) fdt_add_mem_rsv ( fdtp , fdt32_to_cpu ( * base ) , fdt32_to_cpu ( * size ) ) ; } offset = fdt_path_offset ( fdtp , " " ) ; if ( offset > 0 ) { fdt_delprop ( fdtp , offset , " " ) ; offset = fdt_path_offset ( fdtp , " " ) ; prop = fdt_getprop ( fdtp , offset , " " , & len ) ; if ( prop != NULL ) { fdt_setprop ( fdtp , offset , " " , prop , len ) ; offset = fdt_path_offset ( fdtp , " " ) ; fdt_setprop ( fdtp , offset , " " , prop , len ) ; } } }
Fix up wrong values added to the device tree by prom_init() in Linux
Fix up wrong values added to the device tree by prom_init () in Linux
/*
	 * Remove /memory/available properties, which reflect long-gone OF
	 * state
	 */ /*
	 * Add reservations for OPAL and RTAS state if present
	 */ /*
	 * Patch up /chosen nodes so that the stored handles mean something,
	 * where possible.
	 */ /* This node not meaningful */