unsigned long start_paddr, end_paddr; int i; 
unsigned long start_pfn, end_pfn, pages_present; 
void __init do_init_bootmem(void){	int nid;	int addr_cells, size_cells;	struct device_node *memory = NULL;	static struct notifier_block ppc64_numa_nb = {		.notifier_call = cpu_numa_callback,		.priority = 1 /* Must run before sched domains notifier. */	};	min_low_pfn = 0;	max_low_pfn = lmb_end_of_DRAM() >> PAGE_SHIFT;	max_pfn = max_low_pfn;	if (parse_numa_properties())		setup_nonnuma();	else		dump_numa_topology();	register_cpu_notifier(&ppc64_numa_nb);	for_each_online_node(nid) {		unsigned long start_paddr, end_paddr;		int i;		unsigned long bootmem_paddr;		unsigned long bootmap_pages;		start_paddr = init_node_data[nid].node_start_pfn * PAGE_SIZE;		end_paddr = init_node_data[nid].node_end_pfn * PAGE_SIZE;		/* Allocate the node structure node local if possible */		NODE_DATA(nid) = (struct pglist_data *)careful_allocation(nid,					sizeof(struct pglist_data),					SMP_CACHE_BYTES, end_paddr);		NODE_DATA(nid) = abs_to_virt(NODE_DATA(nid));		memset(NODE_DATA(nid), 0, sizeof(struct pglist_data));  		dbg("node %d\n", nid);		dbg("NODE_DATA() = %p\n", NODE_DATA(nid));		NODE_DATA(nid)->bdata = &plat_node_bdata[nid];		NODE_DATA(nid)->node_start_pfn =			init_node_data[nid].node_start_pfn;		NODE_DATA(nid)->node_spanned_pages =			end_paddr - start_paddr;		if (NODE_DATA(nid)->node_spanned_pages == 0)  			continue;  		dbg("start_paddr = %lx\n", start_paddr);  		dbg("end_paddr = %lx\n", end_paddr);		bootmap_pages = bootmem_bootmap_pages((end_paddr - start_paddr) >> PAGE_SHIFT);		bootmem_paddr = careful_allocation(nid,				bootmap_pages << PAGE_SHIFT,				PAGE_SIZE, end_paddr);		memset(abs_to_virt(bootmem_paddr), 0,		       bootmap_pages << PAGE_SHIFT);		dbg("bootmap_paddr = %lx\n", bootmem_paddr);		init_bootmem_node(NODE_DATA(nid), bootmem_paddr >> PAGE_SHIFT,				  start_paddr >> PAGE_SHIFT,				  end_paddr >> PAGE_SHIFT);		/*		 * We need to do another scan of all memory sections to		 * associate memory with the correct node.		 */		addr_cells = get_mem_addr_cells();		size_cells = get_mem_size_cells();		memory = NULL;		while ((memory = of_find_node_by_type(memory, "memory")) != NULL) {			unsigned long mem_start, mem_size;			int numa_domain, ranges;			unsigned int *memcell_buf;			unsigned int len;			memcell_buf = (unsigned int *)get_property(memory, "reg", &len);			if (!memcell_buf || len <= 0)				continue;			ranges = memory->n_addrs;	/* ranges in cell */new_range:			mem_start = read_n_cells(addr_cells, &memcell_buf);			mem_size = read_n_cells(size_cells, &memcell_buf);			if (numa_enabled) {				numa_domain = of_node_numa_domain(memory);				if (numa_domain  >= MAX_NUMNODES)					numa_domain = 0;			} else				numa_domain =  0;			if (numa_domain != nid)				continue;			mem_size = numa_enforce_memory_limit(mem_start, mem_size);  			if (mem_size) {  				dbg("free_bootmem %lx %lx\n", mem_start, mem_size);  				free_bootmem_node(NODE_DATA(nid), mem_start, mem_size);			}			if (--ranges)		/* process all ranges in cell */				goto new_range;		}		/*		 * Mark reserved regions on this node		 */		for (i = 0; i < lmb.reserved.cnt; i++) {			unsigned long physbase = lmb.reserved.region[i].base;			unsigned long size = lmb.reserved.region[i].size;			if (pa_to_nid(physbase) != nid &&			    pa_to_nid(physbase+size-1) != nid)				continue;			if (physbase < end_paddr &&			    (physbase+size) > start_paddr) {				/* overlaps */				if (physbase < start_paddr) {					size -= start_paddr - physbase;					physbase = start_paddr;				}				if (size > end_paddr - physbase)					size = end_paddr - physbase;				dbg("reserve_bootmem %lx %lx\n", physbase,				    size);				reserve_bootmem_node(NODE_DATA(nid), physbase,						     size);			}		}		/*		 * This loop may look famaliar, but we have to do it again		 * after marking our reserved memory to mark memory present		 * for sparsemem.		 */		addr_cells = get_mem_addr_cells();		size_cells = get_mem_size_cells();		memory = NULL;		while ((memory = of_find_node_by_type(memory, "memory")) != NULL) {			unsigned long mem_start, mem_size;			int numa_domain, ranges;			unsigned int *memcell_buf;			unsigned int len;			memcell_buf = (unsigned int *)get_property(memory, "reg", &len);			if (!memcell_buf || len <= 0)				continue;			ranges = memory->n_addrs;	/* ranges in cell */new_range2:			mem_start = read_n_cells(addr_cells, &memcell_buf);			mem_size = read_n_cells(size_cells, &memcell_buf);			if (numa_enabled) {				numa_domain = of_node_numa_domain(memory);				if (numa_domain  >= MAX_NUMNODES)					numa_domain = 0;			} else				numa_domain =  0;			if (numa_domain != nid)				continue;			mem_size = numa_enforce_memory_limit(mem_start, mem_size);			memory_present(numa_domain, mem_start >> PAGE_SHIFT,				       (mem_start + mem_size) >> PAGE_SHIFT);			if (--ranges)		/* process all ranges in cell */				goto new_range2;		}	}}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/45fb6cea09443b2066016f895937f9c2647a1507/numa.c/buggy/arch/powerpc/mm/numa.c