[PATCH] powerpc: Move pSeries firmware feature setup into platforms/pseries
authorMichael Ellerman <michael@ellerman.id.au>
Fri, 10 Feb 2006 04:47:36 +0000 (15:47 +1100)
committerPaul Mackerras <paulus@samba.org>
Fri, 10 Feb 2006 05:52:03 +0000 (16:52 +1100)
Currently we have some stuff in firmware.h and kernel/firmware.c that is
#ifdef CONFIG_PPC_PSERIES. Move it all into platforms/pseries.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/powerpc/kernel/firmware.c
arch/powerpc/platforms/pseries/Makefile
arch/powerpc/platforms/pseries/firmware.c [new file with mode: 0644]
arch/powerpc/platforms/pseries/firmware.h [new file with mode: 0644]
arch/powerpc/platforms/pseries/setup.c
include/asm-powerpc/firmware.h

index 65eae752a527ca9a3346c78826ffa7d15949b002..4d37a3cb80f64c786ac0cbf21f27f1318c1821c0 100644 (file)
 #include <asm/firmware.h>
 
 unsigned long ppc64_firmware_features;
-
-#ifdef CONFIG_PPC_PSERIES
-firmware_feature_t firmware_features_table[FIRMWARE_MAX_FEATURES] = {
-       {FW_FEATURE_PFT,                "hcall-pft"},
-       {FW_FEATURE_TCE,                "hcall-tce"},
-       {FW_FEATURE_SPRG0,              "hcall-sprg0"},
-       {FW_FEATURE_DABR,               "hcall-dabr"},
-       {FW_FEATURE_COPY,               "hcall-copy"},
-       {FW_FEATURE_ASR,                "hcall-asr"},
-       {FW_FEATURE_DEBUG,              "hcall-debug"},
-       {FW_FEATURE_PERF,               "hcall-perf"},
-       {FW_FEATURE_DUMP,               "hcall-dump"},
-       {FW_FEATURE_INTERRUPT,          "hcall-interrupt"},
-       {FW_FEATURE_MIGRATE,            "hcall-migrate"},
-       {FW_FEATURE_PERFMON,            "hcall-perfmon"},
-       {FW_FEATURE_CRQ,                "hcall-crq"},
-       {FW_FEATURE_VIO,                "hcall-vio"},
-       {FW_FEATURE_RDMA,               "hcall-rdma"},
-       {FW_FEATURE_LLAN,               "hcall-lLAN"},
-       {FW_FEATURE_BULK,               "hcall-bulk"},
-       {FW_FEATURE_XDABR,              "hcall-xdabr"},
-       {FW_FEATURE_MULTITCE,           "hcall-multi-tce"},
-       {FW_FEATURE_SPLPAR,             "hcall-splpar"},
-};
-#endif
index 61616d1440729371060f711226672852addf82b4..930898635c9ffa2c25d6d8afb04221768f36ce43 100644 (file)
@@ -1,5 +1,6 @@
 obj-y                  := pci.o lpar.o hvCall.o nvram.o reconfig.o \
-                          setup.o iommu.o ras.o rtasd.o pci_dlpar.o
+                          setup.o iommu.o ras.o rtasd.o pci_dlpar.o \
+                          firmware.o
 obj-$(CONFIG_SMP)      += smp.o
 obj-$(CONFIG_IBMVIO)   += vio.o
 obj-$(CONFIG_XICS)     += xics.o
diff --git a/arch/powerpc/platforms/pseries/firmware.c b/arch/powerpc/platforms/pseries/firmware.c
new file mode 100644 (file)
index 0000000..989f4bc
--- /dev/null
@@ -0,0 +1,103 @@
+/*
+ *  pSeries firmware setup code.
+ *
+ *  Portions from arch/powerpc/platforms/pseries/setup.c:
+ *   Copyright (C) 1995  Linus Torvalds
+ *   Adapted from 'alpha' version by Gary Thomas
+ *   Modified by Cort Dougan (cort@cs.nmt.edu)
+ *   Modified by PPC64 Team, IBM Corp
+ *
+ *  Portions from arch/powerpc/kernel/firmware.c
+ *   Copyright (C) 2001 Ben. Herrenschmidt (benh@kernel.crashing.org)
+ *   Modifications for ppc64:
+ *    Copyright (C) 2003 Dave Engebretsen <engebret@us.ibm.com>
+ *    Copyright (C) 2005 Stephen Rothwell, IBM Corporation
+ *
+ *  Copyright 2006 IBM Corporation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#undef DEBUG
+
+#include <asm/firmware.h>
+#include <asm/prom.h>
+
+#ifdef DEBUG
+#define DBG(fmt...) udbg_printf(fmt)
+#else
+#define DBG(fmt...)
+#endif
+
+typedef struct {
+    unsigned long val;
+    char * name;
+} firmware_feature_t;
+
+static __initdata firmware_feature_t
+firmware_features_table[FIRMWARE_MAX_FEATURES] = {
+       {FW_FEATURE_PFT,                "hcall-pft"},
+       {FW_FEATURE_TCE,                "hcall-tce"},
+       {FW_FEATURE_SPRG0,              "hcall-sprg0"},
+       {FW_FEATURE_DABR,               "hcall-dabr"},
+       {FW_FEATURE_COPY,               "hcall-copy"},
+       {FW_FEATURE_ASR,                "hcall-asr"},
+       {FW_FEATURE_DEBUG,              "hcall-debug"},
+       {FW_FEATURE_PERF,               "hcall-perf"},
+       {FW_FEATURE_DUMP,               "hcall-dump"},
+       {FW_FEATURE_INTERRUPT,          "hcall-interrupt"},
+       {FW_FEATURE_MIGRATE,            "hcall-migrate"},
+       {FW_FEATURE_PERFMON,            "hcall-perfmon"},
+       {FW_FEATURE_CRQ,                "hcall-crq"},
+       {FW_FEATURE_VIO,                "hcall-vio"},
+       {FW_FEATURE_RDMA,               "hcall-rdma"},
+       {FW_FEATURE_LLAN,               "hcall-lLAN"},
+       {FW_FEATURE_BULK,               "hcall-bulk"},
+       {FW_FEATURE_XDABR,              "hcall-xdabr"},
+       {FW_FEATURE_MULTITCE,           "hcall-multi-tce"},
+       {FW_FEATURE_SPLPAR,             "hcall-splpar"},
+};
+
+/* Build up the firmware features bitmask using the contents of
+ * device-tree/ibm,hypertas-functions.  Ultimately this functionality may
+ * be moved into prom.c prom_init().
+ */
+void __init fw_feature_init(void)
+{
+       struct device_node *dn;
+       char *hypertas, *s;
+       int len, i;
+
+       DBG(" -> fw_feature_init()\n");
+
+       dn = of_find_node_by_path("/rtas");
+       if (dn == NULL) {
+               printk(KERN_ERR "WARNING! Cannot find RTAS in device-tree!\n");
+               goto out;
+       }
+
+       hypertas = get_property(dn, "ibm,hypertas-functions", &len);
+       if (hypertas == NULL)
+               goto out;
+
+       for (s = hypertas; s < hypertas + len; s += strlen(s) + 1) {
+               for (i = 0; i < FIRMWARE_MAX_FEATURES; i++) {
+                       /* check value against table of strings */
+                       if (!firmware_features_table[i].name ||
+                           strcmp(firmware_features_table[i].name, s))
+                               continue;
+
+                       /* we have a match */
+                       ppc64_firmware_features |=
+                               firmware_features_table[i].val;
+                       break;
+               }
+       }
+
+out:
+       of_node_put(dn);
+       DBG(" <- fw_feature_init()\n");
+}
diff --git a/arch/powerpc/platforms/pseries/firmware.h b/arch/powerpc/platforms/pseries/firmware.h
new file mode 100644 (file)
index 0000000..714f56f
--- /dev/null
@@ -0,0 +1,17 @@
+/*
+ * Copyright 2006 IBM Corporation.
+ *
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU General Public License
+ *  as published by the Free Software Foundation; either version
+ *  2 of the License, or (at your option) any later version.
+ */
+
+#ifndef _PSERIES_FIRMWARE_H
+#define _PSERIES_FIRMWARE_H
+
+#include <asm/firmware.h>
+
+extern void __init fw_feature_init(void);
+
+#endif /* _PSERIES_FIRMWARE_H */
index 984241bb776c222c76b6e9d1ab8c939fb7391565..b5996a7060f43d52c3bbd85a1861431bf756507d 100644 (file)
@@ -60,7 +60,6 @@
 #include <asm/time.h>
 #include <asm/nvram.h>
 #include "xics.h"
-#include <asm/firmware.h>
 #include <asm/pmc.h>
 #include <asm/mpic.h>
 #include <asm/ppc-pci.h>
@@ -70,6 +69,7 @@
 
 #include "plpar_wrappers.h"
 #include "ras.h"
+#include "firmware.h"
 
 #ifdef DEBUG
 #define DBG(fmt...) udbg_printf(fmt)
@@ -262,49 +262,6 @@ static int __init pSeries_init_panel(void)
 }
 arch_initcall(pSeries_init_panel);
 
-
-/* Build up the firmware features bitmask using the contents of
- * device-tree/ibm,hypertas-functions.  Ultimately this functionality may
- * be moved into prom.c prom_init().
- */
-static void __init fw_feature_init(void)
-{
-       struct device_node *dn;
-       char *hypertas, *s;
-       int len, i;
-
-       DBG(" -> fw_feature_init()\n");
-
-       dn = of_find_node_by_path("/rtas");
-       if (dn == NULL) {
-               printk(KERN_ERR "WARNING! Cannot find RTAS in device-tree!\n");
-               goto out;
-       }
-
-       hypertas = get_property(dn, "ibm,hypertas-functions", &len);
-       if (hypertas == NULL)
-               goto out;
-
-       for (s = hypertas; s < hypertas + len; s += strlen(s) + 1) {
-               for (i = 0; i < FIRMWARE_MAX_FEATURES; i++) {
-                       /* check value against table of strings */
-                       if (!firmware_features_table[i].name ||
-                           strcmp(firmware_features_table[i].name, s))
-                               continue;
-
-                       /* we have a match */
-                       ppc64_firmware_features |=
-                               firmware_features_table[i].val;
-                       break;
-               }
-       }
-
-out:
-       of_node_put(dn);
-       DBG(" <- fw_feature_init()\n");
-}
-
-
 static  void __init pSeries_discover_pic(void)
 {
        struct device_node *np;
index f804b34cf06a6f63136955e315407a456107ce44..b7791a1b05db872010acb36a6b6d4aace80f4aab 100644 (file)
@@ -89,15 +89,6 @@ static inline unsigned long firmware_has_feature(unsigned long feature)
                (FW_FEATURE_POSSIBLE & ppc64_firmware_features & feature);
 }
 
-#ifdef CONFIG_PPC_PSERIES
-typedef struct {
-    unsigned long val;
-    char * name;
-} firmware_feature_t;
-
-extern firmware_feature_t firmware_features_table[];
-#endif
-
 extern void system_reset_fwnmi(void);
 extern void machine_check_fwnmi(void);