mem = (unsigned long)abs_to_virt(lmb_alloc(size + 4, __alignof__(struct device_node)));
mem = lmb_alloc(size + 4, __alignof__(struct device_node)); if (!mem) { DBG("Couldn't allocate memory with lmb_alloc()!\n"); panic("Couldn't allocate memory with lmb_alloc()!\n"); } mem = (unsigned long)abs_to_virt(mem);
void __init unflatten_device_tree(void){	unsigned long start, mem, size;	struct device_node **allnextp = &allnodes;	char *p = NULL;	int l = 0;	DBG(" -> unflatten_device_tree()\n");	/* First pass, scan for size */	start = ((unsigned long)initial_boot_params) +		initial_boot_params->off_dt_struct;	size = unflatten_dt_node(0, &start, NULL, NULL, 0);	size = (size | 3) + 1;	DBG("  size is %lx, allocating...\n", size);	/* Allocate memory for the expanded device tree */	mem = (unsigned long)abs_to_virt(lmb_alloc(size + 4,						   __alignof__(struct device_node)));	((u32 *)mem)[size / 4] = 0xdeadbeef;	DBG("  unflattening...\n", mem);	/* Second pass, do actual unflattening */	start = ((unsigned long)initial_boot_params) +		initial_boot_params->off_dt_struct;	unflatten_dt_node(mem, &start, NULL, &allnextp, 0);	if (*((u32 *)start) != OF_DT_END)		printk(KERN_WARNING "Weird tag at end of tree: %08x\n", *((u32 *)start));	if (((u32 *)mem)[size / 4] != 0xdeadbeef)		printk(KERN_WARNING "End of tree marker overwritten: %08x\n",		       ((u32 *)mem)[size / 4] );	*allnextp = NULL;	/* Get pointer to OF "/chosen" node for use everywhere */	of_chosen = of_find_node_by_path("/chosen");	/* Retreive command line */	if (of_chosen != NULL) {		p = (char *)get_property(of_chosen, "bootargs", &l);		if (p != NULL && l > 0)			strlcpy(cmd_line, p, min(l, COMMAND_LINE_SIZE));	}#ifdef CONFIG_CMDLINE	if (l == 0 || (l == 1 && (*p) == 0))		strlcpy(cmd_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);#endif /* CONFIG_CMDLINE */	DBG("Command line is: %s\n", cmd_line);	DBG(" <- unflatten_device_tree()\n");}