FreeBSD/sys/dev/ofw/ofw_fdt.c
/* Get the length of a property of a package. */
Get the length of a property of a package.
Get the length of a property of a package .
static ssize_t
ofw_fdt_getproplen(ofw_t ofw, phandle_t package, const char *propname)
{
	const struct fdt_property *prop;
	int offset, len;
	offset = fdt_phandle_offset(package);
	if (offset < 0)
		return (-1);
	len = -1;
	prop = fdt_get_property(fdtp, offset, propname, &len);
	if (prop == NULL && strcmp(propname, "name") == 0) {
		fdt_get_name(fdtp, offset, &len);
		return (len + 1);
	}
	if (prop == NULL && offset == fdt_path_offset(fdtp, "/chosen")) {
		if (strcmp(propname, "fdtbootcpu") == 0)
			return (sizeof(cell_t));
		if (strcmp(propname, "fdtmemreserv") == 0)
			return (sizeof(uint64_t)*2*fdt_num_mem_rsv(fdtp));
	}
	if (prop == NULL)
		return (-1);
	return (len);
}
static ssize_t ofw_fdt_getproplen ( ofw_t ofw , phandle_t package , const char * propname ) { const struct fdt_property * prop ; int offset , len ; offset = fdt_phandle_offset ( package ) ; if ( offset < 0 ) return ( -1 ) ; len = -1 ; prop = fdt_get_property ( fdtp , offset , propname , & len ) ; if ( prop == NULL && strcmp ( propname , " " ) == 0 ) { fdt_get_name ( fdtp , offset , & len ) ; return ( len + 1 ) ; } if ( prop == NULL && offset == fdt_path_offset ( fdtp , " " ) ) { if ( strcmp ( propname , " " ) == 0 ) return ( sizeof ( cell_t ) ) ; if ( strcmp ( propname , " " ) == 0 ) return ( sizeof ( uint64_t ) * 2 * fdt_num_mem_rsv ( fdtp ) ) ; } if ( prop == NULL ) return ( -1 ) ; return ( len ) ; }
Get the length of a property of a package.
Get the length of a property of a package .
/* Emulate the 'name' property */