This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] PPC Add Power6x Support to dl-procinfo


On Sun, Nov 12, 2006 at 11:22:33PM -0600, Steven Munroe wrote:
> The POWER6 processor includes addtional instructions beyond the 2.05 ISA 
> (Move Float to GRP, Move Float from GRP) which are available as the 
> default on unmanaged systems (single partition systems identified  by 
> the AT_PLATFORM="power6x"). For Partitioned systems those instructions 
> are disabled by default (AT_PLATFORM="power6"). Paul Mackerras recently 
> posted the power6, power6x kernel support: 
> http://patchwork.ozlabs.org/linuxppc/patch?id=7989
> 
> Also we need to add the hardware Decimal Floating Point feature to 
> AT_HWCAP and update the HWCAP_IMPORTANT to include PPC_FEATURE_HAS_DFP).

Ulrich asked me to avoid using hardcoded constants for the platform bits
and instead use macros, here is a patch that does that on top of
your 2006-11-11 patch.

But, before both can be applied I guess we need the
http://patchwork.ozlabs.org/linuxppc/patch?id=7989
patch to hit Linus' tree, any ETA when that will happen?

2006-11-28  Jakub Jelinek  <jakub@redhat.com>

	* elf/dl-support.c: Include dl-procinfo.h.
	* sysdeps/powerpc/dl-procinfo.h (PPC_PLATFORM_POWER4,
	PPC_PLATFORM_PPC970, PPC_PLATFORM_POWER5, PPC_PLATFORM_POWER5_PLUS,
	PPC_PLATFORM_POWER6, PPC_PLATFORM_CELL_BE, PPC_PLATFORM_POWER6X):
	Define.
	(_dl_string_platform): Use PPC_PLATFORM_* macros instead of
	hardcoded constants.
	* sysdeps/powerpc/dl-procinfo.c (_dl_powerpc_platform): Use
	PPC_PLATFORM_* macros for array designators.

--- libc/elf/dl-support.c.jj	2006-11-28 11:25:13.000000000 +0100
+++ libc/elf/dl-support.c	2006-11-28 23:25:05.000000000 +0100
@@ -29,6 +29,7 @@
 #include <bits/libc-lock.h>
 #include <dl-cache.h>
 #include <dl-librecon.h>
+#include <dl-procinfo.h>
 #include <unsecvars.h>
 #include <hp-timing.h>
 
--- libc/sysdeps/powerpc/dl-procinfo.c.jj	2006-11-28 23:01:45.000000000 +0100
+++ libc/sysdeps/powerpc/dl-procinfo.c	2006-11-28 23:01:50.000000000 +0100
@@ -71,8 +71,13 @@ PROCINFO_CLASS const char _dl_powerpc_pl
 #endif
 #ifndef PROCINFO_DECL
 = {
-    "power4", "ppc970", "power5", "power5+", "power6", "ppc-cell-be",
-    "power6x"
+    [PPC_PLATFORM_POWER4] = "power4",
+    [PPC_PLATFORM_PPC970] = "ppc970",
+    [PPC_PLATFORM_POWER5] = "power5",
+    [PPC_PLATFORM_POWER5_PLUS] = "power5+",
+    [PPC_PLATFORM_POWER6] = "power6",
+    [PPC_PLATFORM_CELL_BE] = "ppc-cell-be",
+    [PPC_PLATFORM_POWER6X] = "power6x"
   }
 #endif
 #if !defined SHARED || defined PROCINFO_DECL
--- libc/sysdeps/powerpc/dl-procinfo.h.jj	2006-11-28 23:01:45.000000000 +0100
+++ libc/sysdeps/powerpc/dl-procinfo.h	2006-11-28 23:23:45.000000000 +0100
@@ -38,6 +38,15 @@
 #define _DL_HWCAP_PLATFORM      (((1ULL << _DL_PLATFORMS_COUNT) - 1) \
                                  << _DL_FIRST_PLATFORM)
 
+/* Platform bits (relative to _DL_FIRST_PLATFORM).  */
+#define PPC_PLATFORM_POWER4		0
+#define PPC_PLATFORM_PPC970		1
+#define PPC_PLATFORM_POWER5		2
+#define PPC_PLATFORM_POWER5_PLUS	3
+#define PPC_PLATFORM_POWER6		4
+#define PPC_PLATFORM_CELL_BE		5
+#define PPC_PLATFORM_POWER6X		6
+
 static inline const char *
 __attribute__ ((unused))
 _dl_hwcap_string (int idx)
@@ -69,24 +78,24 @@ _dl_string_platform (const char *str)
   if (str == NULL)
     return -1;
 
-  if (strncmp (str, GLRO(dl_powerpc_platforms)[0], 5) == 0)
+  if (strncmp (str, GLRO(dl_powerpc_platforms)[PPC_PLATFORM_POWER4], 5) == 0)
     {
       int ret;
       str += 5;
       switch (*str)
 	{
 	case '4':
-	  ret = _DL_FIRST_PLATFORM + 0;
+	  ret = _DL_FIRST_PLATFORM + PPC_PLATFORM_POWER4;
 	  break;
 	case '5':
-	  ret = _DL_FIRST_PLATFORM + 2;
+	  ret = _DL_FIRST_PLATFORM + PPC_PLATFORM_POWER5;
 	  if (str[1] == '+')
-	    ++ret, ++str;
+	    ret = _DL_FIRST_PLATFORM + PPC_PLATFORM_POWER5_PLUS, ++str;
 	  break;
 	case '6':
-	  ret = _DL_FIRST_PLATFORM + 4;
+	  ret = _DL_FIRST_PLATFORM + PPC_PLATFORM_POWER6;
 	  if (str[1] == 'x')
-	    ret+=2, ++str;
+	    ret = _DL_FIRST_PLATFORM + PPC_PLATFORM_POWER6X, ++str;
 	  break;
 	default:
 	  return -1;
@@ -94,12 +103,16 @@ _dl_string_platform (const char *str)
       if (str[1] == '\0')
 	return ret;
     }
-  else if (strncmp (str, GLRO(dl_powerpc_platforms)[1], 3) == 0)
+  else if (strncmp (str, GLRO(dl_powerpc_platforms)[PPC_PLATFORM_PPC970],
+		    3) == 0)
     {
-      if (strcmp (str + 3, GLRO(dl_powerpc_platforms)[1] + 3) == 0)
-	return _DL_FIRST_PLATFORM + 1;
-      else if (strcmp (str + 3, GLRO(dl_powerpc_platforms)[5] + 3) == 0)
-	return _DL_FIRST_PLATFORM + 5;
+      if (strcmp (str + 3, GLRO(dl_powerpc_platforms)[PPC_PLATFORM_PPC970]
+			   + 3) == 0)
+	return _DL_FIRST_PLATFORM + PPC_PLATFORM_PPC970;
+      else if (strcmp (str + 3,
+		       GLRO(dl_powerpc_platforms)[PPC_PLATFORM_CELL_BE] + 3)
+	       == 0)
+	return _DL_FIRST_PLATFORM + PPC_PLATFORM_CELL_BE;
     }
 
   return -1;


	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]