powerpc/139154: Patch for Altivec sysctl

View: New views
1 Messages — Rating Filter:   Alert me  

powerpc/139154: Patch for Altivec sysctl

by Justin Hibbits-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


>Number:         139154
>Category:       powerpc
>Synopsis:       Patch for Altivec sysctl
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ppc
>State:          open
>Quarter:        
>Keywords:      
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Sep 26 15:20:02 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator:     Justin Hibbits
>Release:        9.0-CURRENT
>Organization:
>Environment:
FreeBSD narn.knownspace 9.0-CURRENT FreeBSD 9.0-CURRENT #24 r197331M: Sun Sep 20 22:08:18 EDT 2009     root@...:/usr/obj/usr/src/sys/NARN  powerpc
>Description:
The attached patch adds a 'machdep.altivec' sysctl, similar to OpenBSD's.  This is necessary for ports that use altivec conditionally, including x264, the inspiration for this patch.
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

Index: powerpc/cpu.c
===================================================================
--- powerpc/cpu.c (revision 197331)
+++ powerpc/cpu.c (working copy)
@@ -67,6 +67,7 @@
 #include <sys/sysctl.h>
 
 #include <machine/bus.h>
+#include <machine/cpu.h>
 #include <machine/hid.h>
 #include <machine/md_var.h>
 #include <machine/spr.h>
@@ -110,7 +111,9 @@
 };
 
 static char model[64];
+static int ppc_altivec;
 SYSCTL_STRING(_hw, HW_MODEL, model, CTLFLAG_RD, model, 0, "");
+SYSCTL_INT(_machdep, CPU_ALTIVEC, altivec, CTLFLAG_RD, &ppc_altivec, 0, "");
 
 register_t l2cr_config = 0;
 register_t l3cr_config = 0;
@@ -288,6 +291,24 @@
  break;
  }
 
+ switch (vers) {
+ case MPC7400:
+ case MPC7450:
+ case MPC7455:
+ case MPC7457:
+ case MPC7447A:
+ case MPC7448:
+ case MPC7410:
+ case IBM970:
+ case IBM970FX:
+ case IBM970MP:
+ case IBM970GX:
+ ppc_altivec=1;
+ break;
+ default:
+ ppc_altivec=0;
+ }
+
  printf("cpu%d: HID0 %b\n", cpuid, hid0, bitmask);
 }
 
Index: include/cpu.h
===================================================================
--- include/cpu.h (revision 197331)
+++ include/cpu.h (working copy)
@@ -49,6 +49,7 @@
  * CTL_MACHDEP definitions.
  */
 #define CPU_CACHELINE 1
+#define CPU_ALTIVEC 2
 
 static __inline u_int64_t
 get_cyclecount(void)


>Release-Note:
>Audit-Trail:
>Unformatted:
_______________________________________________
freebsd-ppc@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ppc
To unsubscribe, send any mail to "freebsd-ppc-unsubscribe@..."