[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: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
This commit is contained in:

committed by
Paul Mackerras

parent
056cb48a2f
commit
e8222502ee
@@ -1018,7 +1018,7 @@ static int __init eeh_init_proc(void)
|
||||
{
|
||||
struct proc_dir_entry *e;
|
||||
|
||||
if (platform_is_pseries()) {
|
||||
if (machine_is(pseries)) {
|
||||
e = create_proc_entry("ppc64/eeh", 0, NULL);
|
||||
if (e)
|
||||
e->proc_fops = &proc_eeh_operations;
|
||||
|
@@ -120,7 +120,7 @@ static void fixup_winbond_82c105(struct pci_dev* dev)
|
||||
int i;
|
||||
unsigned int reg;
|
||||
|
||||
if (!platform_is_pseries())
|
||||
if (!machine_is(pseries))
|
||||
return;
|
||||
|
||||
printk("Using INTC for W82c105 IDE controller.\n");
|
||||
|
@@ -28,6 +28,7 @@
|
||||
#include <linux/pci.h>
|
||||
#include <asm/pci-bridge.h>
|
||||
#include <asm/ppc-pci.h>
|
||||
#include <asm/firmware.h>
|
||||
|
||||
static struct pci_bus *
|
||||
find_bus_among_children(struct pci_bus *bus,
|
||||
|
@@ -17,8 +17,9 @@
|
||||
#include <linux/proc_fs.h>
|
||||
|
||||
#include <asm/prom.h>
|
||||
#include <asm/pSeries_reconfig.h>
|
||||
#include <asm/machdep.h>
|
||||
#include <asm/uaccess.h>
|
||||
#include <asm/pSeries_reconfig.h>
|
||||
|
||||
|
||||
|
||||
@@ -508,7 +509,7 @@ static int proc_ppc64_create_ofdt(void)
|
||||
{
|
||||
struct proc_dir_entry *ent;
|
||||
|
||||
if (!platform_is_pseries())
|
||||
if (!machine_is(pseries))
|
||||
return 0;
|
||||
|
||||
ent = create_proc_entry("ppc64/ofdt", S_IWUSR, NULL);
|
||||
|
@@ -27,6 +27,7 @@
|
||||
#include <asm/prom.h>
|
||||
#include <asm/nvram.h>
|
||||
#include <asm/atomic.h>
|
||||
#include <asm/machdep.h>
|
||||
|
||||
#if 0
|
||||
#define DEBUG(A...) printk(KERN_ERR A)
|
||||
@@ -481,7 +482,7 @@ static int __init rtas_init(void)
|
||||
{
|
||||
struct proc_dir_entry *entry;
|
||||
|
||||
if (!platform_is_pseries())
|
||||
if (!machine_is(pseries))
|
||||
return 0;
|
||||
|
||||
/* No RTAS */
|
||||
|
@@ -372,24 +372,42 @@ static int pSeries_check_legacy_ioport(unsigned int baseport)
|
||||
/*
|
||||
* Called very early, MMU is off, device-tree isn't unflattened
|
||||
*/
|
||||
extern struct machdep_calls pSeries_md;
|
||||
|
||||
static int __init pSeries_probe(int platform)
|
||||
static int __init pSeries_probe_hypertas(unsigned long node,
|
||||
const char *uname, int depth,
|
||||
void *data)
|
||||
{
|
||||
if (platform != PLATFORM_PSERIES &&
|
||||
platform != PLATFORM_PSERIES_LPAR)
|
||||
if (depth != 1 ||
|
||||
(strcmp(uname, "rtas") != 0 && strcmp(uname, "rtas@0") != 0))
|
||||
return 0;
|
||||
|
||||
if (of_get_flat_dt_prop(node, "ibm,hypertas-functions", NULL) != NULL)
|
||||
powerpc_firmware_features |= FW_FEATURE_LPAR;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int __init pSeries_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;
|
||||
|
||||
/* if we have some ppc_md fixups for LPAR to do, do
|
||||
* it here ...
|
||||
*/
|
||||
DBG("pSeries detected, looking for LPAR capability...\n");
|
||||
|
||||
if (platform == PLATFORM_PSERIES_LPAR)
|
||||
powerpc_firmware_features |= FW_FEATURE_LPAR;
|
||||
/* Now try to figure out if we are running on LPAR */
|
||||
of_scan_flat_dt(pSeries_probe_hypertas, NULL);
|
||||
|
||||
DBG("Machine is%s LPAR !\n",
|
||||
(powerpc_firmware_features & FW_FEATURE_LPAR) ? "" : " not");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
DECLARE_PER_CPU(unsigned long, smt_snooze_delay);
|
||||
|
||||
static void pseries_dedicated_idle_sleep(void)
|
||||
@@ -501,7 +519,8 @@ static void pseries_kexec_cpu_down(int crash_shutdown, int secondary)
|
||||
}
|
||||
#endif
|
||||
|
||||
struct machdep_calls __initdata pSeries_md = {
|
||||
define_machine(pseries) {
|
||||
.name = "pSeries",
|
||||
.probe = pSeries_probe,
|
||||
.setup_arch = pSeries_setup_arch,
|
||||
.init_early = pSeries_init_early,
|
||||
|
Reference in New Issue
Block a user