FreeBSD/sys/powerpc/ofw/ofw_machdep.c
/*
 * This is called during powerpc_init, before the system is really initialized.
 * It shall provide the total and the available regions of RAM.
 * The available regions need not take the kernel into account.
 */
This is called during powerpc_init, before the system is really initialized.
It shall provide the total and the available regions of RAM.
The available regions need not take the kernel into account.
This is called during powerpc_init before the system is really initialized . It shall provide the total and the available regions of RAM . The available regions need not take the kernel into account .
void
ofw_mem_regions(struct mem_region *memp, int *memsz,
		struct mem_region *availp, int *availsz)
{
	phandle_t phandle;
	int asz, msz;
	int res;
	char name[31];
	asz = msz = 0;
	for (phandle = OF_child(OF_peer(0)); phandle != 0;
	    phandle = OF_peer(phandle)) {
		if (OF_getprop(phandle, "name", name, sizeof(name)) <= 0)
			continue;
		if (strncmp(name, "memory", sizeof(name)) != 0 &&
		    strncmp(name, "memory@", strlen("memory@")) != 0)
			continue;
		res = parse_ofw_memory(phandle, "reg", &memp[msz]);
		msz += res/sizeof(struct mem_region);
		if (OF_getproplen(phandle, "available") >= 0)
			res = parse_ofw_memory(phandle, "available",
			    &availp[asz]);
		else
			res = parse_ofw_memory(phandle, "reg", &availp[asz]);
		asz += res/sizeof(struct mem_region);
	}
	phandle = OF_finddevice("/chosen");
	if (OF_hasprop(phandle, "fdtmemreserv"))
		asz = excise_fdt_reserved(availp, asz);
	*memsz = msz;
	*availsz = asz;
}
void ofw_mem_regions ( struct mem_region * memp , int * memsz , struct mem_region * availp , int * availsz ) { phandle_t phandle ; int asz , msz ; int res ; char name [ 31 ] ; asz = msz = 0 ; for ( phandle = OF_child ( OF_peer ( 0 ) ) ; phandle != 0 ; phandle = OF_peer ( phandle ) ) { if ( OF_getprop ( phandle , " " , name , sizeof ( name ) ) <= 0 ) continue ; if ( strncmp ( name , " " , sizeof ( name ) ) != 0 && strncmp ( name , " " , strlen ( " " ) ) != 0 ) continue ; res = parse_ofw_memory ( phandle , " " , & memp [ msz ] ) ; msz += res / sizeof ( struct mem_region ) ; if ( OF_getproplen ( phandle , " " ) >= 0 ) res = parse_ofw_memory ( phandle , " " , & availp [ asz ] ) ; else res = parse_ofw_memory ( phandle , " " , & availp [ asz ] ) ; asz += res / sizeof ( struct mem_region ) ; } phandle = OF_finddevice ( " " ) ; if ( OF_hasprop ( phandle , " " ) ) asz = excise_fdt_reserved ( availp , asz ) ; * memsz = msz ; * availsz = asz ; }
This is called during powerpc_init, before the system is really initialized.
This is called during powerpc_init before the system is really initialized .
/*
	 * Get memory from all the /memory nodes.
	 */