2 * Copyright 2009 Freescale Semiconductor, Inc.
4 * This file is derived from arch/powerpc/cpu/mpc85xx/cpu.c and
5 * arch/powerpc/cpu/mpc86xx/cpu.c. Basically this file contains
6 * cpu specific common code for 85xx/86xx processors.
7 * See file CREDITS for list of people who contributed to this
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License as
12 * published by the Free Software Foundation; either version 2 of
13 * the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
28 #include <fdt_support.h>
30 void ft_fixup_num_cores(void *blob) {
31 int off, num_cores, del_cores;
34 num_cores = cpu_numcores();
36 off = fdt_node_offset_by_prop_value(blob, -1, "device_type", "cpu", 4);
37 while (off != -FDT_ERR_NOTFOUND) {
38 u32 *reg = (u32 *)fdt_getprop(blob, off, "reg", 0);
40 /* if we find a cpu node outside of what we expect delete it
41 * and reset the offset back to the start since we can't
42 * trust the offsets anymore
44 if (*reg > num_cores-1) {
45 fdt_del_node(blob, off);
49 off = fdt_node_offset_by_prop_value(blob, off,
50 "device_type", "cpu", 4);
52 debug ("%x core system found\n", num_cores);
53 debug ("deleted %d extra core entry entries from device tree\n",