[1/4] hdat: Make is_power9n() global

Submitted by Michael Neuling on Aug. 10, 2017, 6:02 a.m.

Details

Message ID 20170810060253.11928-1-mikey@neuling.org
State Accepted
Headers show

Commit Message

Michael Neuling Aug. 10, 2017, 6:02 a.m.
This splits out is_power9n() so it can be used elsewhere.  It also
adds a check for for POWER9 so the function does more of what it's
name suggests (and so the caller doesn't need to do it).

Signed-off-by: Michael Neuling <mikey@neuling.org>
---
 hdata/cpu-common.c | 12 ------------
 hdata/hdata.h      | 16 ++++++++++++++++
 2 files changed, 16 insertions(+), 12 deletions(-)

Comments

Stewart Smith Aug. 15, 2017, 12:52 a.m.
Michael Neuling <mikey@neuling.org> writes:
> This splits out is_power9n() so it can be used elsewhere.  It also
> adds a check for for POWER9 so the function does more of what it's
> name suggests (and so the caller doesn't need to do it).
>
> Signed-off-by: Michael Neuling <mikey@neuling.org>

Series merged to master as of 961547bceed3276415e1a8505093a818a44001e7

Patch hide | download patch | download mbox

diff --git a/hdata/cpu-common.c b/hdata/cpu-common.c
index a1a9312184..f40d08b398 100644
--- a/hdata/cpu-common.c
+++ b/hdata/cpu-common.c
@@ -21,18 +21,6 @@ 
 
 #include "hdata.h"
 
-static bool is_power9n(uint32_t version)
-{
-	/*
-	 * Bit 13 tells us:
-	 *   0 = Scale out (aka Nimbus)
-	 *   1 = Scale up  (aka Cumulus)
-	 */
-	if ((version >> 13) & 1)
-		return false;
-	return true;
-}
-
 struct dt_node * add_core_common(struct dt_node *cpus,
 				 const struct sppcia_cpu_cache *cache,
 				 const struct sppaca_cpu_timebase *tb,
diff --git a/hdata/hdata.h b/hdata/hdata.h
index e3871860ae..6da9b55c4d 100644
--- a/hdata/hdata.h
+++ b/hdata/hdata.h
@@ -17,6 +17,8 @@ 
 #ifndef __HDATA_H
 #define __HDATA_H
 
+#include <processor.h>
+
 struct dt_node;
 
 extern void memory_parse(void);
@@ -32,6 +34,20 @@  extern void vpd_parse(void);
 extern struct dt_node *find_xscom_for_chip(uint32_t chip_id);
 extern uint32_t pcid_to_chip_id(uint32_t proc_chip_id);
 
+static __unused bool is_power9n(uint32_t version)
+{
+	if (PVR_TYPE(version) != PVR_TYPE_P9)
+		return false;
+	/*
+	 * Bit 13 tells us:
+	 *   0 = Scale out (aka Nimbus)
+	 *   1 = Scale up  (aka Cumulus)
+	 */
+	if ((version >> 13) & 1)
+		return false;
+	return true;
+}
+
 extern struct dt_node *add_core_common(struct dt_node *cpus,
 				       const struct sppaca_cpu_cache *cache,
 				       const struct sppaca_cpu_timebase *tb,