Skip to content
Snippets Groups Projects
Commit e8222502 authored by Benjamin Herrenschmidt's avatar Benjamin Herrenschmidt Committed by Paul Mackerras
Browse files

[PATCH] powerpc: Kill _machine and hard-coded platform numbers


This removes statically assigned platform numbers and reworks the
powerpc platform probe code to use a better mechanism.  With this,
board support files can simply declare a new machine type with a
macro, and implement a probe() function that uses the flattened
device-tree to detect if they apply for a given machine.

We now have a machine_is() macro that replaces the comparisons of
_machine with the various PLATFORM_* constants.  This commit also
changes various drivers to use the new macro instead of looking at
_machine.

Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent 056cb48a
No related merge requests found
Showing
with 365 additions and 404 deletions
...@@ -719,6 +719,11 @@ address which can extend beyond that limit. ...@@ -719,6 +719,11 @@ address which can extend beyond that limit.
- model : this is your board name/model - model : this is your board name/model
- #address-cells : address representation for "root" devices - #address-cells : address representation for "root" devices
- #size-cells: the size representation for "root" devices - #size-cells: the size representation for "root" devices
- device_type : This property shouldn't be necessary. However, if
you decide to create a device_type for your root node, make sure it
is _not_ "chrp" unless your platform is a pSeries or PAPR compliant
one for 64-bit, or a CHRP-type machine for 32-bit as this will
matched by the kernel this way.
Additionally, some recommended properties are: Additionally, some recommended properties are:
......
...@@ -105,8 +105,6 @@ int main(void) ...@@ -105,8 +105,6 @@ int main(void)
DEFINE(ICACHEL1LINESIZE, offsetof(struct ppc64_caches, iline_size)); DEFINE(ICACHEL1LINESIZE, offsetof(struct ppc64_caches, iline_size));
DEFINE(ICACHEL1LOGLINESIZE, offsetof(struct ppc64_caches, log_iline_size)); DEFINE(ICACHEL1LOGLINESIZE, offsetof(struct ppc64_caches, log_iline_size));
DEFINE(ICACHEL1LINESPERPAGE, offsetof(struct ppc64_caches, ilines_per_page)); DEFINE(ICACHEL1LINESPERPAGE, offsetof(struct ppc64_caches, ilines_per_page));
DEFINE(PLATFORM_LPAR, PLATFORM_LPAR);
/* paca */ /* paca */
DEFINE(PACA_SIZE, sizeof(struct paca_struct)); DEFINE(PACA_SIZE, sizeof(struct paca_struct));
DEFINE(PACAPACAINDEX, offsetof(struct paca_struct, paca_index)); DEFINE(PACAPACAINDEX, offsetof(struct paca_struct, paca_index));
......
...@@ -160,7 +160,7 @@ static int dev_nvram_ioctl(struct inode *inode, struct file *file, ...@@ -160,7 +160,7 @@ static int dev_nvram_ioctl(struct inode *inode, struct file *file,
case IOC_NVRAM_GET_OFFSET: { case IOC_NVRAM_GET_OFFSET: {
int part, offset; int part, offset;
if (_machine != PLATFORM_POWERMAC) if (!machine_is(powermac))
return -EINVAL; return -EINVAL;
if (copy_from_user(&part, (void __user*)arg, sizeof(part)) != 0) if (copy_from_user(&part, (void __user*)arg, sizeof(part)) != 0)
return -EFAULT; return -EFAULT;
...@@ -444,7 +444,7 @@ static int nvram_setup_partition(void) ...@@ -444,7 +444,7 @@ static int nvram_setup_partition(void)
* in our nvram, as Apple defined partitions use pretty much * in our nvram, as Apple defined partitions use pretty much
* all of the space * all of the space
*/ */
if (_machine == PLATFORM_POWERMAC) if (machine_is(powermac))
return -ENOSPC; return -ENOSPC;
/* see if we have an OS partition that meets our needs. /* see if we have an OS partition that meets our needs.
......
...@@ -787,7 +787,7 @@ pci_busdev_to_OF_node(struct pci_bus *bus, int devfn) ...@@ -787,7 +787,7 @@ pci_busdev_to_OF_node(struct pci_bus *bus, int devfn)
* fix has to be done by making the remapping per-host and always * fix has to be done by making the remapping per-host and always
* filling the pci_to_OF map. --BenH * filling the pci_to_OF map. --BenH
*/ */
if (_machine == _MACH_Pmac && busnr >= 0xf0) if (machine_is(powermac) && busnr >= 0xf0)
busnr -= 0xf0; busnr -= 0xf0;
else else
#endif #endif
...@@ -1728,7 +1728,7 @@ long sys_pciconfig_iobase(long which, unsigned long bus, unsigned long devfn) ...@@ -1728,7 +1728,7 @@ long sys_pciconfig_iobase(long which, unsigned long bus, unsigned long devfn)
* (bus 0 is HT root), we return the AGP one instead. * (bus 0 is HT root), we return the AGP one instead.
*/ */
#ifdef CONFIG_PPC_PMAC #ifdef CONFIG_PPC_PMAC
if (_machine == _MACH_Pmac && machine_is_compatible("MacRISC4")) if (machine_is(powermac) && machine_is_compatible("MacRISC4"))
if (bus == 0) if (bus == 0)
bus = 0xf0; bus = 0xf0;
#endif /* CONFIG_PPC_PMAC */ #endif /* CONFIG_PPC_PMAC */
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <asm/machdep.h>
#include <asm/vdso_datapage.h> #include <asm/vdso_datapage.h>
#include <asm/rtas.h> #include <asm/rtas.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
...@@ -51,7 +52,7 @@ static int __init proc_ppc64_create(void) ...@@ -51,7 +52,7 @@ static int __init proc_ppc64_create(void)
if (!root) if (!root)
return 1; return 1;
if (!(platform_is_pseries() || _machine == PLATFORM_CELL)) if (!machine_is(pseries) && !machine_is(cell))
return 0; return 0;
if (!proc_mkdir("rtas", root)) if (!proc_mkdir("rtas", root))
......
...@@ -383,14 +383,14 @@ static int __devinit finish_node_interrupts(struct device_node *np, ...@@ -383,14 +383,14 @@ static int __devinit finish_node_interrupts(struct device_node *np,
/* Apple uses bits in there in a different way, let's /* Apple uses bits in there in a different way, let's
* only keep the real sense bit on macs * only keep the real sense bit on macs
*/ */
if (_machine == PLATFORM_POWERMAC) if (machine_is(powermac))
sense &= 0x1; sense &= 0x1;
np->intrs[intrcount].sense = map_mpic_senses[sense]; np->intrs[intrcount].sense = map_mpic_senses[sense];
} }
#ifdef CONFIG_PPC64 #ifdef CONFIG_PPC64
/* We offset irq numbers for the u3 MPIC by 128 in PowerMac */ /* We offset irq numbers for the u3 MPIC by 128 in PowerMac */
if (_machine == PLATFORM_POWERMAC && ic && ic->parent) { if (machine_is(powermac) && ic && ic->parent) {
char *name = get_property(ic->parent, "name", NULL); char *name = get_property(ic->parent, "name", NULL);
if (name && !strcmp(name, "u3")) if (name && !strcmp(name, "u3"))
np->intrs[intrcount].line += 128; np->intrs[intrcount].line += 128;
...@@ -570,6 +570,18 @@ int __init of_scan_flat_dt(int (*it)(unsigned long node, ...@@ -570,6 +570,18 @@ int __init of_scan_flat_dt(int (*it)(unsigned long node,
return rc; return rc;
} }
unsigned long __init of_get_flat_dt_root(void)
{
unsigned long p = ((unsigned long)initial_boot_params) +
initial_boot_params->off_dt_struct;
while(*((u32 *)p) == OF_DT_NOP)
p += 4;
BUG_ON (*((u32 *)p) != OF_DT_BEGIN_NODE);
p += 4;
return _ALIGN(p + strlen((char *)p) + 1, 4);
}
/** /**
* This function can be used within scan_flattened_dt callback to get * This function can be used within scan_flattened_dt callback to get
* access to properties * access to properties
...@@ -612,6 +624,25 @@ void* __init of_get_flat_dt_prop(unsigned long node, const char *name, ...@@ -612,6 +624,25 @@ void* __init of_get_flat_dt_prop(unsigned long node, const char *name,
} while(1); } while(1);
} }
int __init of_flat_dt_is_compatible(unsigned long node, const char *compat)
{
const char* cp;
unsigned long cplen, l;
cp = of_get_flat_dt_prop(node, "compatible", &cplen);
if (cp == NULL)
return 0;
while (cplen > 0) {
if (strncasecmp(cp, compat, strlen(compat)) == 0)
return 1;
l = strlen(cp) + 1;
cp += l;
cplen -= l;
}
return 0;
}
static void *__init unflatten_dt_alloc(unsigned long *mem, unsigned long size, static void *__init unflatten_dt_alloc(unsigned long *mem, unsigned long size,
unsigned long align) unsigned long align)
{ {
...@@ -686,7 +717,7 @@ static unsigned long __init unflatten_dt_node(unsigned long mem, ...@@ -686,7 +717,7 @@ static unsigned long __init unflatten_dt_node(unsigned long mem,
#ifdef DEBUG #ifdef DEBUG
if ((strlen(p) + l + 1) != allocl) { if ((strlen(p) + l + 1) != allocl) {
DBG("%s: p: %d, l: %d, a: %d\n", DBG("%s: p: %d, l: %d, a: %d\n",
pathp, strlen(p), l, allocl); pathp, (int)strlen(p), l, allocl);
} }
#endif #endif
p += strlen(p); p += strlen(p);
...@@ -951,7 +982,6 @@ static int __init early_init_dt_scan_cpus(unsigned long node, ...@@ -951,7 +982,6 @@ static int __init early_init_dt_scan_cpus(unsigned long node,
static int __init early_init_dt_scan_chosen(unsigned long node, static int __init early_init_dt_scan_chosen(unsigned long node,
const char *uname, int depth, void *data) const char *uname, int depth, void *data)
{ {
u32 *prop;
unsigned long *lprop; unsigned long *lprop;
unsigned long l; unsigned long l;
char *p; char *p;
...@@ -962,14 +992,6 @@ static int __init early_init_dt_scan_chosen(unsigned long node, ...@@ -962,14 +992,6 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
(strcmp(uname, "chosen") != 0 && strcmp(uname, "chosen@0") != 0)) (strcmp(uname, "chosen") != 0 && strcmp(uname, "chosen@0") != 0))
return 0; return 0;
/* get platform type */
prop = (u32 *)of_get_flat_dt_prop(node, "linux,platform", NULL);
if (prop == NULL)
return 0;
#ifdef CONFIG_PPC_MULTIPLATFORM
_machine = *prop;
#endif
#ifdef CONFIG_PPC64 #ifdef CONFIG_PPC64
/* check if iommu is forced on or off */ /* check if iommu is forced on or off */
if (of_get_flat_dt_prop(node, "linux,iommu-off", NULL) != NULL) if (of_get_flat_dt_prop(node, "linux,iommu-off", NULL) != NULL)
...@@ -996,15 +1018,15 @@ static int __init early_init_dt_scan_chosen(unsigned long node, ...@@ -996,15 +1018,15 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
* set of RTAS infos now if available * set of RTAS infos now if available
*/ */
{ {
u64 *basep, *entryp; u64 *basep, *entryp, *sizep;
basep = of_get_flat_dt_prop(node, "linux,rtas-base", NULL); basep = of_get_flat_dt_prop(node, "linux,rtas-base", NULL);
entryp = of_get_flat_dt_prop(node, "linux,rtas-entry", NULL); entryp = of_get_flat_dt_prop(node, "linux,rtas-entry", NULL);
prop = of_get_flat_dt_prop(node, "linux,rtas-size", NULL); sizep = of_get_flat_dt_prop(node, "linux,rtas-size", NULL);
if (basep && entryp && prop) { if (basep && entryp && sizep) {
rtas.base = *basep; rtas.base = *basep;
rtas.entry = *entryp; rtas.entry = *entryp;
rtas.size = *prop; rtas.size = *sizep;
} }
} }
#endif /* CONFIG_PPC_RTAS */ #endif /* CONFIG_PPC_RTAS */
...@@ -1775,7 +1797,7 @@ static int of_finish_dynamic_node(struct device_node *node) ...@@ -1775,7 +1797,7 @@ static int of_finish_dynamic_node(struct device_node *node)
/* We don't support that function on PowerMac, at least /* We don't support that function on PowerMac, at least
* not yet * not yet
*/ */
if (_machine == PLATFORM_POWERMAC) if (machine_is(powermac))
return -ENODEV; return -ENODEV;
/* fix up new node's linux_phandle field */ /* fix up new node's linux_phandle field */
......
...@@ -180,6 +180,16 @@ static unsigned long __initdata prom_tce_alloc_start; ...@@ -180,6 +180,16 @@ static unsigned long __initdata prom_tce_alloc_start;
static unsigned long __initdata prom_tce_alloc_end; static unsigned long __initdata prom_tce_alloc_end;
#endif #endif
/* Platforms codes are now obsolete in the kernel. Now only used within this
* file and ultimately gone too. Feel free to change them if you need, they
* are not shared with anything outside of this file anymore
*/
#define PLATFORM_PSERIES 0x0100
#define PLATFORM_PSERIES_LPAR 0x0101
#define PLATFORM_LPAR 0x0001
#define PLATFORM_POWERMAC 0x0400
#define PLATFORM_GENERIC 0x0500
static int __initdata of_platform; static int __initdata of_platform;
static char __initdata prom_cmd_line[COMMAND_LINE_SIZE]; static char __initdata prom_cmd_line[COMMAND_LINE_SIZE];
...@@ -1492,7 +1502,10 @@ static int __init prom_find_machine_type(void) ...@@ -1492,7 +1502,10 @@ static int __init prom_find_machine_type(void)
int len, i = 0; int len, i = 0;
#ifdef CONFIG_PPC64 #ifdef CONFIG_PPC64
phandle rtas; phandle rtas;
int x;
#endif #endif
/* Look for a PowerMac */
len = prom_getprop(_prom->root, "compatible", len = prom_getprop(_prom->root, "compatible",
compat, sizeof(compat)-1); compat, sizeof(compat)-1);
if (len > 0) { if (len > 0) {
...@@ -1505,28 +1518,36 @@ static int __init prom_find_machine_type(void) ...@@ -1505,28 +1518,36 @@ static int __init prom_find_machine_type(void)
if (strstr(p, RELOC("Power Macintosh")) || if (strstr(p, RELOC("Power Macintosh")) ||
strstr(p, RELOC("MacRISC"))) strstr(p, RELOC("MacRISC")))
return PLATFORM_POWERMAC; return PLATFORM_POWERMAC;
#ifdef CONFIG_PPC64
if (strstr(p, RELOC("Momentum,Maple")))
return PLATFORM_MAPLE;
if (strstr(p, RELOC("IBM,CPB")))
return PLATFORM_CELL;
#endif
i += sl + 1; i += sl + 1;
} }
} }
#ifdef CONFIG_PPC64 #ifdef CONFIG_PPC64
/* If not a mac, try to figure out if it's an IBM pSeries or any other
* PAPR compliant platform. We assume it is if :
* - /device_type is "chrp" (please, do NOT use that for future
* non-IBM designs !
* - it has /rtas
*/
len = prom_getprop(_prom->root, "model",
compat, sizeof(compat)-1);
if (len <= 0)
return PLATFORM_GENERIC;
compat[len] = 0;
if (strcmp(compat, "chrp"))
return PLATFORM_GENERIC;
/* Default to pSeries. We need to know if we are running LPAR */ /* Default to pSeries. We need to know if we are running LPAR */
rtas = call_prom("finddevice", 1, 1, ADDR("/rtas")); rtas = call_prom("finddevice", 1, 1, ADDR("/rtas"));
if (PHANDLE_VALID(rtas)) { if (!PHANDLE_VALID(rtas))
int x = prom_getproplen(rtas, "ibm,hypertas-functions"); return PLATFORM_GENERIC;
if (x != PROM_ERROR) { x = prom_getproplen(rtas, "ibm,hypertas-functions");
prom_printf("Hypertas detected, assuming LPAR !\n"); if (x != PROM_ERROR) {
return PLATFORM_PSERIES_LPAR; prom_printf("Hypertas detected, assuming LPAR !\n");
} return PLATFORM_PSERIES_LPAR;
} }
return PLATFORM_PSERIES; return PLATFORM_PSERIES;
#else #else
return PLATFORM_CHRP; return PLATFORM_GENERIC;
#endif #endif
} }
...@@ -2034,7 +2055,6 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4, ...@@ -2034,7 +2055,6 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4,
{ {
struct prom_t *_prom; struct prom_t *_prom;
unsigned long hdr; unsigned long hdr;
u32 getprop_rval;
unsigned long offset = reloc_offset(); unsigned long offset = reloc_offset();
#ifdef CONFIG_PPC32 #ifdef CONFIG_PPC32
...@@ -2070,9 +2090,6 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4, ...@@ -2070,9 +2090,6 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4,
* between pSeries SMP and pSeries LPAR * between pSeries SMP and pSeries LPAR
*/ */
RELOC(of_platform) = prom_find_machine_type(); RELOC(of_platform) = prom_find_machine_type();
getprop_rval = RELOC(of_platform);
prom_setprop(_prom->chosen, "/chosen", "linux,platform",
&getprop_rval, sizeof(getprop_rval));
/* Bail if this is a kdump kernel. */ /* Bail if this is a kdump kernel. */
if (PHYSICAL_START > 0) if (PHYSICAL_START > 0)
......
...@@ -257,7 +257,7 @@ static int __init proc_rtas_init(void) ...@@ -257,7 +257,7 @@ static int __init proc_rtas_init(void)
{ {
struct proc_dir_entry *entry; struct proc_dir_entry *entry;
if (_machine != PLATFORM_PSERIES && _machine != PLATFORM_PSERIES_LPAR) if (!machine_is(pseries))
return 1; return 1;
rtas_node = of_find_node_by_name(NULL, "rtas"); rtas_node = of_find_node_by_name(NULL, "rtas");
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <asm/hvcall.h> #include <asm/hvcall.h>
#include <asm/semaphore.h> #include <asm/semaphore.h>
#include <asm/machdep.h> #include <asm/machdep.h>
#include <asm/firmware.h>
#include <asm/page.h> #include <asm/page.h>
#include <asm/param.h> #include <asm/param.h>
#include <asm/system.h> #include <asm/system.h>
...@@ -768,7 +769,7 @@ void __init rtas_initialize(void) ...@@ -768,7 +769,7 @@ void __init rtas_initialize(void)
* the stop-self token if any * the stop-self token if any
*/ */
#ifdef CONFIG_PPC64 #ifdef CONFIG_PPC64
if (_machine == PLATFORM_PSERIES_LPAR) { if (machine_is(pseries) && firmware_has_feature(FW_FEATURE_LPAR)) {
rtas_region = min(lmb.rmo_size, RTAS_INSTANTIATE_MAX); rtas_region = min(lmb.rmo_size, RTAS_INSTANTIATE_MAX);
ibm_suspend_me_token = rtas_token("ibm,suspend-me"); ibm_suspend_me_token = rtas_token("ibm,suspend-me");
} }
......
...@@ -9,6 +9,9 @@ ...@@ -9,6 +9,9 @@
* as published by the Free Software Foundation; either version * as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version. * 2 of the License, or (at your option) any later version.
*/ */
#undef DEBUG
#include <linux/config.h> #include <linux/config.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/string.h> #include <linux/string.h>
...@@ -41,6 +44,7 @@ ...@@ -41,6 +44,7 @@
#include <asm/time.h> #include <asm/time.h>
#include <asm/cputable.h> #include <asm/cputable.h>
#include <asm/sections.h> #include <asm/sections.h>
#include <asm/firmware.h>
#include <asm/btext.h> #include <asm/btext.h>
#include <asm/nvram.h> #include <asm/nvram.h>
#include <asm/setup.h> #include <asm/setup.h>
...@@ -56,8 +60,6 @@ ...@@ -56,8 +60,6 @@
#include "setup.h" #include "setup.h"
#undef DEBUG
#ifdef DEBUG #ifdef DEBUG
#include <asm/udbg.h> #include <asm/udbg.h>
#define DBG(fmt...) udbg_printf(fmt) #define DBG(fmt...) udbg_printf(fmt)
...@@ -65,10 +67,12 @@ ...@@ -65,10 +67,12 @@
#define DBG(fmt...) #define DBG(fmt...)
#endif #endif
#ifdef CONFIG_PPC_MULTIPLATFORM /* The main machine-dep calls structure
int _machine = 0; */
EXPORT_SYMBOL(_machine); struct machdep_calls ppc_md;
#endif EXPORT_SYMBOL(ppc_md);
struct machdep_calls *machine_id;
EXPORT_SYMBOL(machine_id);
unsigned long klimit = (unsigned long) _end; unsigned long klimit = (unsigned long) _end;
...@@ -168,7 +172,8 @@ static int show_cpuinfo(struct seq_file *m, void *v) ...@@ -168,7 +172,8 @@ static int show_cpuinfo(struct seq_file *m, void *v)
bogosum/(500000/HZ), bogosum/(5000/HZ) % 100); bogosum/(500000/HZ), bogosum/(5000/HZ) % 100);
#endif /* CONFIG_SMP && CONFIG_PPC32 */ #endif /* CONFIG_SMP && CONFIG_PPC32 */
seq_printf(m, "timebase\t: %lu\n", ppc_tb_freq); seq_printf(m, "timebase\t: %lu\n", ppc_tb_freq);
if (ppc_md.name)
seq_printf(m, "platform\t: %s\n", ppc_md.name);
if (ppc_md.show_cpuinfo != NULL) if (ppc_md.show_cpuinfo != NULL)
ppc_md.show_cpuinfo(m); ppc_md.show_cpuinfo(m);
...@@ -387,7 +392,7 @@ void __init smp_setup_cpu_maps(void) ...@@ -387,7 +392,7 @@ void __init smp_setup_cpu_maps(void)
* On pSeries LPAR, we need to know how many cpus * On pSeries LPAR, we need to know how many cpus
* could possibly be added to this partition. * could possibly be added to this partition.
*/ */
if (_machine == PLATFORM_PSERIES_LPAR && if (machine_is(pseries) && firmware_has_feature(FW_FEATURE_LPAR) &&
(dn = of_find_node_by_path("/rtas"))) { (dn = of_find_node_by_path("/rtas"))) {
int num_addr_cell, num_size_cell, maxcpus; int num_addr_cell, num_size_cell, maxcpus;
unsigned int *ireg; unsigned int *ireg;
...@@ -456,3 +461,34 @@ static int __init early_xmon(char *p) ...@@ -456,3 +461,34 @@ static int __init early_xmon(char *p)
} }
early_param("xmon", early_xmon); early_param("xmon", early_xmon);
#endif #endif
void probe_machine(void)
{
extern struct machdep_calls __machine_desc_start;
extern struct machdep_calls __machine_desc_end;
/*
* Iterate all ppc_md structures until we find the proper
* one for the current machine type
*/
DBG("Probing machine type ...\n");
for (machine_id = &__machine_desc_start;
machine_id < &__machine_desc_end;
machine_id++) {
DBG(" %s ...", machine_id->name);
memcpy(&ppc_md, machine_id, sizeof(struct machdep_calls));
if (ppc_md.probe()) {
DBG(" match !\n");
break;
}
DBG("\n");
}
/* What can we do if we didn't find ? */
if (machine_id >= &__machine_desc_end) {
DBG("No suitable machine found !\n");
for (;;);
}
printk(KERN_INFO "Using %s machine description\n", ppc_md.name);
}
...@@ -67,10 +67,6 @@ unsigned int DMA_MODE_WRITE; ...@@ -67,10 +67,6 @@ unsigned int DMA_MODE_WRITE;
int have_of = 1; int have_of = 1;
#ifdef CONFIG_PPC_MULTIPLATFORM #ifdef CONFIG_PPC_MULTIPLATFORM
extern void prep_init(void);
extern void pmac_init(void);
extern void chrp_init(void);
dev_t boot_dev; dev_t boot_dev;
#endif /* CONFIG_PPC_MULTIPLATFORM */ #endif /* CONFIG_PPC_MULTIPLATFORM */
...@@ -82,9 +78,6 @@ unsigned long SYSRQ_KEY = 0x54; ...@@ -82,9 +78,6 @@ unsigned long SYSRQ_KEY = 0x54;
unsigned long vgacon_remap_base; unsigned long vgacon_remap_base;
#endif #endif
struct machdep_calls ppc_md;
EXPORT_SYMBOL(ppc_md);
/* /*
* These are used in binfmt_elf.c to put aux entries on the stack * These are used in binfmt_elf.c to put aux entries on the stack
* for each elf executable being started. * for each elf executable being started.
...@@ -120,48 +113,6 @@ unsigned long __init early_init(unsigned long dt_ptr) ...@@ -120,48 +113,6 @@ unsigned long __init early_init(unsigned long dt_ptr)
return KERNELBASE + offset; return KERNELBASE + offset;
} }
#ifdef CONFIG_PPC_MULTIPLATFORM
/*
* The PPC_MULTIPLATFORM version of platform_init...
*/
void __init platform_init(void)
{
/* if we didn't get any bootinfo telling us what we are... */
if (_machine == 0) {
/* prep boot loader tells us if we're prep or not */
if ( *(unsigned long *)(KERNELBASE) == (0xdeadc0de) )
_machine = _MACH_prep;
}
#ifdef CONFIG_PPC_PREP
/* not much more to do here, if prep */
if (_machine == _MACH_prep) {
prep_init();
return;
}
#endif
#ifdef CONFIG_ADB
if (strstr(cmd_line, "adb_sync")) {
extern int __adb_probe_sync;
__adb_probe_sync = 1;
}
#endif /* CONFIG_ADB */
switch (_machine) {
#ifdef CONFIG_PPC_PMAC
case _MACH_Pmac:
pmac_init();
break;
#endif
#ifdef CONFIG_PPC_CHRP
case _MACH_chrp:
chrp_init();
break;
#endif
}
}
#endif
/* /*
* Find out what kind of machine we're on and save any data we need * Find out what kind of machine we're on and save any data we need
...@@ -187,8 +138,12 @@ void __init machine_init(unsigned long dt_ptr, unsigned long phys) ...@@ -187,8 +138,12 @@ void __init machine_init(unsigned long dt_ptr, unsigned long phys)
strlcpy(cmd_line, CONFIG_CMDLINE, sizeof(cmd_line)); strlcpy(cmd_line, CONFIG_CMDLINE, sizeof(cmd_line));
#endif /* CONFIG_CMDLINE */ #endif /* CONFIG_CMDLINE */
/* Base init based on machine type */ #ifdef CONFIG_PPC_MULTIPLATFORM
probe_machine();
#else
/* Base init based on machine type. Obsoloete, please kill ! */
platform_init(); platform_init();
#endif
#ifdef CONFIG_6xx #ifdef CONFIG_6xx
if (cpu_has_feature(CPU_FTR_CAN_DOZE) || if (cpu_has_feature(CPU_FTR_CAN_DOZE) ||
...@@ -359,7 +314,4 @@ void __init setup_arch(char **cmdline_p) ...@@ -359,7 +314,4 @@ void __init setup_arch(char **cmdline_p)
if ( ppc_md.progress ) ppc_md.progress("arch: exit", 0x3eab); if ( ppc_md.progress ) ppc_md.progress("arch: exit", 0x3eab);
paging_init(); paging_init();
/* this is for modules since _machine can be a define -- Cort */
ppc_md.ppc_machine = _machine;
} }
...@@ -95,11 +95,6 @@ int dcache_bsize; ...@@ -95,11 +95,6 @@ int dcache_bsize;
int icache_bsize; int icache_bsize;
int ucache_bsize; int ucache_bsize;
/* The main machine-dep calls structure
*/
struct machdep_calls ppc_md;
EXPORT_SYMBOL(ppc_md);
#ifdef CONFIG_MAGIC_SYSRQ #ifdef CONFIG_MAGIC_SYSRQ
unsigned long SYSRQ_KEY; unsigned long SYSRQ_KEY;
#endif /* CONFIG_MAGIC_SYSRQ */ #endif /* CONFIG_MAGIC_SYSRQ */
...@@ -160,32 +155,6 @@ early_param("smt-enabled", early_smt_enabled); ...@@ -160,32 +155,6 @@ early_param("smt-enabled", early_smt_enabled);
#define check_smt_enabled() #define check_smt_enabled()
#endif /* CONFIG_SMP */ #endif /* CONFIG_SMP */
extern struct machdep_calls pSeries_md;
extern struct machdep_calls pmac_md;
extern struct machdep_calls maple_md;
extern struct machdep_calls cell_md;
extern struct machdep_calls iseries_md;
/* Ultimately, stuff them in an elf section like initcalls... */
static struct machdep_calls __initdata *machines[] = {
#ifdef CONFIG_PPC_PSERIES
&pSeries_md,
#endif /* CONFIG_PPC_PSERIES */
#ifdef CONFIG_PPC_PMAC
&pmac_md,
#endif /* CONFIG_PPC_PMAC */
#ifdef CONFIG_PPC_MAPLE
&maple_md,
#endif /* CONFIG_PPC_MAPLE */
#ifdef CONFIG_PPC_CELL
&cell_md,
#endif
#ifdef CONFIG_PPC_ISERIES
&iseries_md,
#endif
NULL
};
/* /*
* Early initialization entry point. This is called by head.S * Early initialization entry point. This is called by head.S
* with MMU translation disabled. We rely on the "feature" of * with MMU translation disabled. We rely on the "feature" of
...@@ -207,12 +176,10 @@ static struct machdep_calls __initdata *machines[] = { ...@@ -207,12 +176,10 @@ static struct machdep_calls __initdata *machines[] = {
void __init early_setup(unsigned long dt_ptr) void __init early_setup(unsigned long dt_ptr)
{ {
static struct machdep_calls **mach;
/* Enable early debugging if any specified (see udbg.h) */ /* Enable early debugging if any specified (see udbg.h) */
udbg_early_init(); udbg_early_init();
DBG(" -> early_setup()\n"); DBG(" -> early_setup(), dt_ptr: 0x%lx\n", dt_ptr);
/* /*
* Do early initializations using the flattened device * Do early initializations using the flattened device
...@@ -229,22 +196,8 @@ void __init early_setup(unsigned long dt_ptr) ...@@ -229,22 +196,8 @@ void __init early_setup(unsigned long dt_ptr)
get_paca()->stab_real = __pa((u64)&initial_stab); get_paca()->stab_real = __pa((u64)&initial_stab);
get_paca()->stab_addr = (u64)&initial_stab; get_paca()->stab_addr = (u64)&initial_stab;
/* /* Probe the machine type */
* Iterate all ppc_md structures until we find the proper probe_machine();
* one for the current machine type
*/
DBG("Probing machine type for platform %x...\n", _machine);
for (mach = machines; *mach; mach++) {
if ((*mach)->probe(_machine))
break;
}
/* What can we do if we didn't find ? */
if (*mach == NULL) {
DBG("No suitable machine found !\n");
for (;;);
}
ppc_md = **mach;
#ifdef CONFIG_CRASH_DUMP #ifdef CONFIG_CRASH_DUMP
kdump_setup(); kdump_setup();
...@@ -346,7 +299,7 @@ static void __init initialize_cache_info(void) ...@@ -346,7 +299,7 @@ static void __init initialize_cache_info(void)
const char *dc, *ic; const char *dc, *ic;
/* Then read cache informations */ /* Then read cache informations */
if (_machine == PLATFORM_POWERMAC) { if (machine_is(powermac)) {
dc = "d-cache-block-size"; dc = "d-cache-block-size";
ic = "i-cache-block-size"; ic = "i-cache-block-size";
} else { } else {
...@@ -490,7 +443,6 @@ void __init setup_system(void) ...@@ -490,7 +443,6 @@ void __init setup_system(void)
printk("ppc64_pft_size = 0x%lx\n", ppc64_pft_size); printk("ppc64_pft_size = 0x%lx\n", ppc64_pft_size);
printk("ppc64_interrupt_controller = 0x%ld\n", printk("ppc64_interrupt_controller = 0x%ld\n",
ppc64_interrupt_controller); ppc64_interrupt_controller);
printk("platform = 0x%x\n", _machine);
printk("physicalMemorySize = 0x%lx\n", lmb_phys_mem_size()); printk("physicalMemorySize = 0x%lx\n", lmb_phys_mem_size());
printk("ppc64_caches.dcache_line_size = 0x%x\n", printk("ppc64_caches.dcache_line_size = 0x%x\n",
ppc64_caches.dline_size); ppc64_caches.dline_size);
......
...@@ -97,7 +97,6 @@ static DEFINE_SPINLOCK(die_lock); ...@@ -97,7 +97,6 @@ static DEFINE_SPINLOCK(die_lock);
int die(const char *str, struct pt_regs *regs, long err) int die(const char *str, struct pt_regs *regs, long err)
{ {
static int die_counter, crash_dump_start = 0; static int die_counter, crash_dump_start = 0;
int nl = 0;
if (debugger(regs)) if (debugger(regs))
return 1; return 1;
...@@ -106,7 +105,7 @@ int die(const char *str, struct pt_regs *regs, long err) ...@@ -106,7 +105,7 @@ int die(const char *str, struct pt_regs *regs, long err)
spin_lock_irq(&die_lock); spin_lock_irq(&die_lock);
bust_spinlocks(1); bust_spinlocks(1);
#ifdef CONFIG_PMAC_BACKLIGHT #ifdef CONFIG_PMAC_BACKLIGHT
if (_machine == _MACH_Pmac) { if (machine_is(powermac)) {
set_backlight_enable(1); set_backlight_enable(1);
set_backlight_level(BACKLIGHT_MAX); set_backlight_level(BACKLIGHT_MAX);
} }
...@@ -114,46 +113,18 @@ int die(const char *str, struct pt_regs *regs, long err) ...@@ -114,46 +113,18 @@ int die(const char *str, struct pt_regs *regs, long err)
printk("Oops: %s, sig: %ld [#%d]\n", str, err, ++die_counter); printk("Oops: %s, sig: %ld [#%d]\n", str, err, ++die_counter);
#ifdef CONFIG_PREEMPT #ifdef CONFIG_PREEMPT
printk("PREEMPT "); printk("PREEMPT ");
nl = 1;
#endif #endif
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
printk("SMP NR_CPUS=%d ", NR_CPUS); printk("SMP NR_CPUS=%d ", NR_CPUS);
nl = 1;
#endif #endif
#ifdef CONFIG_DEBUG_PAGEALLOC #ifdef CONFIG_DEBUG_PAGEALLOC
printk("DEBUG_PAGEALLOC "); printk("DEBUG_PAGEALLOC ");
nl = 1;
#endif #endif
#ifdef CONFIG_NUMA #ifdef CONFIG_NUMA
printk("NUMA "); printk("NUMA ");
nl = 1;
#endif #endif
#ifdef CONFIG_PPC64 printk("%s\n", ppc_md.name ? "" : ppc_md.name);
switch (_machine) {
case PLATFORM_PSERIES:
printk("PSERIES ");
nl = 1;
break;
case PLATFORM_PSERIES_LPAR:
printk("PSERIES LPAR ");
nl = 1;
break;
case PLATFORM_ISERIES_LPAR:
printk("ISERIES LPAR ");
nl = 1;
break;
case PLATFORM_POWERMAC:
printk("POWERMAC ");
nl = 1;
break;
case PLATFORM_CELL:
printk("CELL ");
nl = 1;
break;
}
#endif
if (nl)
printk("\n");
print_modules(); print_modules();
show_regs(regs); show_regs(regs);
bust_spinlocks(0); bust_spinlocks(0);
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include <asm/machdep.h> #include <asm/machdep.h>
#include <asm/cputable.h> #include <asm/cputable.h>
#include <asm/sections.h> #include <asm/sections.h>
#include <asm/firmware.h>
#include <asm/vdso.h> #include <asm/vdso.h>
#include <asm/vdso_datapage.h> #include <asm/vdso_datapage.h>
...@@ -667,7 +668,13 @@ void __init vdso_init(void) ...@@ -667,7 +668,13 @@ void __init vdso_init(void)
vdso_data->version.major = SYSTEMCFG_MAJOR; vdso_data->version.major = SYSTEMCFG_MAJOR;
vdso_data->version.minor = SYSTEMCFG_MINOR; vdso_data->version.minor = SYSTEMCFG_MINOR;
vdso_data->processor = mfspr(SPRN_PVR); vdso_data->processor = mfspr(SPRN_PVR);
vdso_data->platform = _machine; /*
* Fake the old platform number for pSeries and iSeries and add
* in LPAR bit if necessary
*/
vdso_data->platform = machine_is(iseries) ? 0x200 : 0x100;
if (firmware_has_feature(FW_FEATURE_LPAR))
vdso_data->platform |= 1;
vdso_data->physicalMemorySize = lmb_phys_mem_size(); vdso_data->physicalMemorySize = lmb_phys_mem_size();
vdso_data->dcache_size = ppc64_caches.dsize; vdso_data->dcache_size = ppc64_caches.dsize;
vdso_data->dcache_line_size = ppc64_caches.dline_size; vdso_data->dcache_line_size = ppc64_caches.dline_size;
......
#include <linux/config.h> #include <linux/config.h>
#ifdef CONFIG_PPC64 #ifdef CONFIG_PPC64
#include <asm/page.h> #include <asm/page.h>
#define PROVIDE32(x) PROVIDE(__unused__##x)
#else #else
#define PAGE_SIZE 4096 #define PAGE_SIZE 4096
#define KERNELBASE CONFIG_KERNEL_START #define KERNELBASE CONFIG_KERNEL_START
#define PROVIDE32(x) PROVIDE(x)
#endif #endif
#include <asm-generic/vmlinux.lds.h> #include <asm-generic/vmlinux.lds.h>
...@@ -18,43 +20,42 @@ jiffies = jiffies_64 + 4; ...@@ -18,43 +20,42 @@ jiffies = jiffies_64 + 4;
#endif #endif
SECTIONS SECTIONS
{ {
/* Sections to be discarded. */ /* Sections to be discarded. */
/DISCARD/ : { /DISCARD/ : {
*(.exitcall.exit) *(.exitcall.exit)
*(.exit.data) *(.exit.data)
} }
. = KERNELBASE;
/* Read-only sections, merged into text segment: */
.text : {
*(.text .text.*)
SCHED_TEXT
LOCK_TEXT
KPROBES_TEXT
*(.fixup)
#ifdef CONFIG_PPC32
*(.got1)
__got2_start = .;
*(.got2)
__got2_end = .;
#else
. = ALIGN(PAGE_SIZE);
_etext = .;
#endif
}
#ifdef CONFIG_PPC32
_etext = .;
PROVIDE (etext = .);
RODATA . = KERNELBASE;
.fini : { *(.fini) } =0
.ctors : { *(.ctors) }
.dtors : { *(.dtors) }
.fixup : { *(.fixup) } /*
#endif * Text, read only data and other permanent read-only sections
*/
/* Text and gots */
.text : {
*(.text .text.*)
SCHED_TEXT
LOCK_TEXT
KPROBES_TEXT
*(.fixup)
#ifdef CONFIG_PPC32
*(.got1)
__got2_start = .;
*(.got2)
__got2_end = .;
#endif /* CONFIG_PPC32 */
. = ALIGN(PAGE_SIZE);
_etext = .;
PROVIDE32 (etext = .);
}
/* Read-only data */
RODATA
/* Exception & bug tables */
__ex_table : { __ex_table : {
__start___ex_table = .; __start___ex_table = .;
*(__ex_table) *(__ex_table)
...@@ -67,192 +68,172 @@ SECTIONS ...@@ -67,192 +68,172 @@ SECTIONS
__stop___bug_table = .; __stop___bug_table = .;
} }
#ifdef CONFIG_PPC64 /*
* Init sections discarded at runtime
*/
. = ALIGN(PAGE_SIZE);
__init_begin = .;
.init.text : {
_sinittext = .;
*(.init.text)
_einittext = .;
}
/* .exit.text is discarded at runtime, not link time,
* to deal with references from __bug_table
*/
.exit.text : { *(.exit.text) }
.init.data : {
*(.init.data);
__vtop_table_begin = .;
*(.vtop_fixup);
__vtop_table_end = .;
__ptov_table_begin = .;
*(.ptov_fixup);
__ptov_table_end = .;
}
. = ALIGN(16);
.init.setup : {
__setup_start = .;
*(.init.setup)
__setup_end = .;
}
.initcall.init : {
__initcall_start = .;
*(.initcall1.init)
*(.initcall2.init)
*(.initcall3.init)
*(.initcall4.init)
*(.initcall5.init)
*(.initcall6.init)
*(.initcall7.init)
__initcall_end = .;
}
.con_initcall.init : {
__con_initcall_start = .;
*(.con_initcall.init)
__con_initcall_end = .;
}
SECURITY_INIT
. = ALIGN(8);
__ftr_fixup : { __ftr_fixup : {
__start___ftr_fixup = .; __start___ftr_fixup = .;
*(__ftr_fixup) *(__ftr_fixup)
__stop___ftr_fixup = .; __stop___ftr_fixup = .;
} }
RODATA . = ALIGN(PAGE_SIZE);
#endif .init.ramfs : {
__initramfs_start = .;
*(.init.ramfs)
__initramfs_end = .;
}
#ifdef CONFIG_PPC32 #ifdef CONFIG_PPC32
/* Read-write section, merged into data segment: */ . = ALIGN(32);
. = ALIGN(PAGE_SIZE); #else
_sdata = .; . = ALIGN(128);
.data :
{
*(.data)
*(.data1)
*(.sdata)
*(.sdata2)
*(.got.plt) *(.got)
*(.dynamic)
CONSTRUCTORS
}
. = ALIGN(PAGE_SIZE);
__nosave_begin = .;
.data_nosave : { *(.data.nosave) }
. = ALIGN(PAGE_SIZE);
__nosave_end = .;
. = ALIGN(32);
.data.cacheline_aligned : { *(.data.cacheline_aligned) }
_edata = .;
PROVIDE (edata = .);
. = ALIGN(8192);
.data.init_task : { *(.data.init_task) }
#endif #endif
.data.percpu : {
__per_cpu_start = .;
*(.data.percpu)
__per_cpu_end = .;
}
/* will be freed after init */ . = ALIGN(8);
. = ALIGN(PAGE_SIZE); .machine.desc : {
__init_begin = .; __machine_desc_start = . ;
.init.text : { *(.machine.desc)
_sinittext = .; __machine_desc_end = . ;
*(.init.text) }
_einittext = .;
} /* freed after init ends here */
#ifdef CONFIG_PPC32 . = ALIGN(PAGE_SIZE);
/* .exit.text is discarded at runtime, not link time, __init_end = .;
to deal with references from __bug_table */
.exit.text : { *(.exit.text) } /*
#endif * And now the various read/write data
.init.data : { */
*(.init.data);
__vtop_table_begin = .; . = ALIGN(PAGE_SIZE);
*(.vtop_fixup); _sdata = .;
__vtop_table_end = .;
__ptov_table_begin = .;
*(.ptov_fixup);
__ptov_table_end = .;
}
. = ALIGN(16);
.init.setup : {
__setup_start = .;
*(.init.setup)
__setup_end = .;
}
.initcall.init : {
__initcall_start = .;
*(.initcall1.init)
*(.initcall2.init)
*(.initcall3.init)
*(.initcall4.init)
*(.initcall5.init)
*(.initcall6.init)
*(.initcall7.init)
__initcall_end = .;
}
.con_initcall.init : {
__con_initcall_start = .;
*(.con_initcall.init)
__con_initcall_end = .;
}
SECURITY_INIT
#ifdef CONFIG_PPC32 #ifdef CONFIG_PPC32
__start___ftr_fixup = .; .data :
__ftr_fixup : { *(__ftr_fixup) } {
__stop___ftr_fixup = .; *(.data)
*(.sdata)
*(.got.plt) *(.got)
}
#else #else
. = ALIGN(PAGE_SIZE); .data : {
.init.ramfs : { *(.data .data.rel* .toc1)
__initramfs_start = .; *(.branch_lt)
*(.init.ramfs) }
__initramfs_end = .;
}
#endif
#ifdef CONFIG_PPC32 .opd : {
. = ALIGN(32); *(.opd)
}
.got : {
__toc_start = .;
*(.got)
*(.toc)
}
#endif #endif
.data.percpu : {
__per_cpu_start = .;
*(.data.percpu)
__per_cpu_end = .;
}
. = ALIGN(PAGE_SIZE); . = ALIGN(PAGE_SIZE);
#ifdef CONFIG_PPC64 _edata = .;
. = ALIGN(16384); PROVIDE32 (edata = .);
__init_end = .;
/* freed after init ends here */ /* The initial task and kernel stack */
#ifdef CONFIG_PPC32
/* Read/write sections */ . = ALIGN(8192);
. = ALIGN(PAGE_SIZE);
. = ALIGN(16384);
_sdata = .;
/* The initial task and kernel stack */
.data.init_task : {
*(.data.init_task)
}
. = ALIGN(PAGE_SIZE);
.data.page_aligned : {
*(.data.page_aligned)
}
.data.cacheline_aligned : {
*(.data.cacheline_aligned)
}
.data : {
*(.data .data.rel* .toc1)
*(.branch_lt)
}
.opd : {
*(.opd)
}
.got : {
__toc_start = .;
*(.got)
*(.toc)
. = ALIGN(PAGE_SIZE);
_edata = .;
}
. = ALIGN(PAGE_SIZE);
#else #else
__initramfs_start = .; . = ALIGN(16384);
.init.ramfs : { #endif
*(.init.ramfs) .data.init_task : {
} *(.data.init_task)
__initramfs_end = .; }
. = ALIGN(4096); . = ALIGN(PAGE_SIZE);
__init_end = .; .data.page_aligned : {
*(.data.page_aligned)
}
. = ALIGN(4096); .data.cacheline_aligned : {
_sextratext = .; *(.data.cacheline_aligned)
_eextratext = .; }
__bss_start = .; . = ALIGN(PAGE_SIZE);
#endif __data_nosave : {
__nosave_begin = .;
*(.data.nosave)
. = ALIGN(PAGE_SIZE);
__nosave_end = .;
}
.bss : { /*
__bss_start = .; * And finally the bss
*(.sbss) *(.scommon) */
*(.dynbss)
*(.bss) .bss : {
*(COMMON) __bss_start = .;
__bss_stop = .; *(.sbss) *(.scommon)
} *(.dynbss)
*(.bss)
*(COMMON)
__bss_stop = .;
}
#ifdef CONFIG_PPC64 . = ALIGN(PAGE_SIZE);
. = ALIGN(PAGE_SIZE); _end = . ;
#endif PROVIDE32 (end = .);
_end = . ;
#ifdef CONFIG_PPC32
PROVIDE (end = .);
#endif
} }
...@@ -167,7 +167,7 @@ int htab_bolt_mapping(unsigned long vstart, unsigned long vend, ...@@ -167,7 +167,7 @@ int htab_bolt_mapping(unsigned long vstart, unsigned long vend,
* normal insert callback here. * normal insert callback here.
*/ */
#ifdef CONFIG_PPC_ISERIES #ifdef CONFIG_PPC_ISERIES
if (_machine == PLATFORM_ISERIES_LPAR) if (machine_is(iseries))
ret = iSeries_hpte_insert(hpteg, va, ret = iSeries_hpte_insert(hpteg, va,
paddr, paddr,
tmp_mode, tmp_mode,
...@@ -176,7 +176,7 @@ int htab_bolt_mapping(unsigned long vstart, unsigned long vend, ...@@ -176,7 +176,7 @@ int htab_bolt_mapping(unsigned long vstart, unsigned long vend,
else else
#endif #endif
#ifdef CONFIG_PPC_PSERIES #ifdef CONFIG_PPC_PSERIES
if (_machine & PLATFORM_LPAR) if (machine_is(pseries) && firmware_has_feature(FW_FEATURE_LPAR))
ret = pSeries_lpar_hpte_insert(hpteg, va, ret = pSeries_lpar_hpte_insert(hpteg, va,
paddr, paddr,
tmp_mode, tmp_mode,
...@@ -295,8 +295,7 @@ static void __init htab_init_page_sizes(void) ...@@ -295,8 +295,7 @@ static void __init htab_init_page_sizes(void)
* Not in the device-tree, let's fallback on known size * Not in the device-tree, let's fallback on known size
* list for 16M capable GP & GR * list for 16M capable GP & GR
*/ */
if ((_machine != PLATFORM_ISERIES_LPAR) && if (cpu_has_feature(CPU_FTR_16M_PAGE) && !machine_is(iseries))
cpu_has_feature(CPU_FTR_16M_PAGE))
memcpy(mmu_psize_defs, mmu_psize_defaults_gp, memcpy(mmu_psize_defs, mmu_psize_defaults_gp,
sizeof(mmu_psize_defaults_gp)); sizeof(mmu_psize_defaults_gp));
found: found:
......
...@@ -195,9 +195,13 @@ static void __init cell_init_early(void) ...@@ -195,9 +195,13 @@ static void __init cell_init_early(void)
} }
static int __init cell_probe(int platform) static int __init cell_probe(void)
{ {
if (platform != PLATFORM_CELL) /* XXX This is temporary, the Cell maintainer will come up with
* more appropriate detection logic
*/
unsigned long root = of_get_flat_dt_root();
if (!of_flat_dt_is_compatible(root, "IBM,CPBW-1.0"))
return 0; return 0;
return 1; return 1;
...@@ -212,7 +216,8 @@ static int cell_check_legacy_ioport(unsigned int baseport) ...@@ -212,7 +216,8 @@ static int cell_check_legacy_ioport(unsigned int baseport)
return -ENODEV; return -ENODEV;
} }
struct machdep_calls __initdata cell_md = { define_machine(cell) {
.name = "Cell",
.probe = cell_probe, .probe = cell_probe,
.setup_arch = cell_setup_arch, .setup_arch = cell_setup_arch,
.init_early = cell_init_early, .init_early = cell_init_early,
......
...@@ -292,6 +292,10 @@ void __init chrp_setup_arch(void) ...@@ -292,6 +292,10 @@ void __init chrp_setup_arch(void)
pci_create_OF_bus_map(); pci_create_OF_bus_map();
#ifdef CONFIG_SMP
smp_ops = &chrp_smp_ops;
#endif /* CONFIG_SMP */
/* /*
* Print the banner, then scroll down so boot progress * Print the banner, then scroll down so boot progress
* can be printed. -- Cort * can be printed. -- Cort
...@@ -506,8 +510,15 @@ chrp_init2(void) ...@@ -506,8 +510,15 @@ chrp_init2(void)
ppc_md.progress(" Have fun! ", 0x7777); ppc_md.progress(" Have fun! ", 0x7777);
} }
void __init chrp_init(void) static int __init chrp_probe(void)
{ {
char *dtype = of_get_flat_dt_prop(of_get_flat_dt_root(),
"device_type", NULL);
if (dtype == NULL)
return 0;
if (strcmp(dtype, "chrp"))
return 0;
ISA_DMA_THRESHOLD = ~0L; ISA_DMA_THRESHOLD = ~0L;
DMA_MODE_READ = 0x44; DMA_MODE_READ = 0x44;
DMA_MODE_WRITE = 0x48; DMA_MODE_WRITE = 0x48;
......
...@@ -675,9 +675,10 @@ static void iseries_dedicated_idle(void) ...@@ -675,9 +675,10 @@ static void iseries_dedicated_idle(void)
void __init iSeries_init_IRQ(void) { } void __init iSeries_init_IRQ(void) { }
#endif #endif
static int __init iseries_probe(int platform) static int __init iseries_probe(void)
{ {
if (PLATFORM_ISERIES_LPAR != platform) unsigned long root = of_get_flat_dt_root();
if (!of_flat_dt_is_compatible(root, "IBM,iSeries"))
return 0; return 0;
powerpc_firmware_features |= FW_FEATURE_ISERIES; powerpc_firmware_features |= FW_FEATURE_ISERIES;
...@@ -686,7 +687,8 @@ static int __init iseries_probe(int platform) ...@@ -686,7 +687,8 @@ static int __init iseries_probe(int platform)
return 1; return 1;
} }
struct machdep_calls __initdata iseries_md = { define_machine(iseries) {
.name = "iSeries",
.setup_arch = iSeries_setup_arch, .setup_arch = iSeries_setup_arch,
.show_cpuinfo = iSeries_show_cpuinfo, .show_cpuinfo = iSeries_show_cpuinfo,
.init_IRQ = iSeries_init_IRQ, .init_IRQ = iSeries_init_IRQ,
...@@ -930,7 +932,6 @@ void build_flat_dt(struct iseries_flat_dt *dt, unsigned long phys_mem_size) ...@@ -930,7 +932,6 @@ void build_flat_dt(struct iseries_flat_dt *dt, unsigned long phys_mem_size)
/* /chosen */ /* /chosen */
dt_start_node(dt, "chosen"); dt_start_node(dt, "chosen");
dt_prop_u32(dt, "linux,platform", PLATFORM_ISERIES_LPAR);
dt_prop_str(dt, "bootargs", cmd_line); dt_prop_str(dt, "bootargs", cmd_line);
if (cmd_mem_limit) if (cmd_mem_limit)
dt_prop_u64(dt, "linux,memory-limit", cmd_mem_limit); dt_prop_u64(dt, "linux,memory-limit", cmd_mem_limit);
......
...@@ -259,9 +259,10 @@ static void __init maple_progress(char *s, unsigned short hex) ...@@ -259,9 +259,10 @@ static void __init maple_progress(char *s, unsigned short hex)
/* /*
* Called very early, MMU is off, device-tree isn't unflattened * Called very early, MMU is off, device-tree isn't unflattened
*/ */
static int __init maple_probe(int platform) static int __init maple_probe(void)
{ {
if (platform != PLATFORM_MAPLE) unsigned long root = of_get_flat_dt_root();
if (!of_flat_dt_is_compatible(root, "Momentum,Maple"))
return 0; return 0;
/* /*
* On U3, the DART (iommu) must be allocated now since it * On U3, the DART (iommu) must be allocated now since it
...@@ -274,7 +275,8 @@ static int __init maple_probe(int platform) ...@@ -274,7 +275,8 @@ static int __init maple_probe(int platform)
return 1; return 1;
} }
struct machdep_calls __initdata maple_md = { define_machine(maple_md) {
.name = "Maple",
.probe = maple_probe, .probe = maple_probe,
.setup_arch = maple_setup_arch, .setup_arch = maple_setup_arch,
.init_early = maple_init_early, .init_early = maple_init_early,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment