diff options
author | Dale Rahn <drahn@cvs.openbsd.org> | 2005-10-09 14:17:33 +0000 |
---|---|---|
committer | Dale Rahn <drahn@cvs.openbsd.org> | 2005-10-09 14:17:33 +0000 |
commit | 36c25a8ab1d6e43602688f9bae4f24c65106c6e9 (patch) | |
tree | f7eb00e177da6aa9b4665f60bde3943a46cef19e /sys/arch | |
parent | 395f0ee15c63f65382729c43f538d5564ffb2177 (diff) |
Provide a machdep sysctl to determine if altivec is avaliable on macppc
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/macppc/include/cpu.h | 8 | ||||
-rw-r--r-- | sys/arch/macppc/macppc/cpu.c | 9 | ||||
-rw-r--r-- | sys/arch/macppc/macppc/machdep.c | 4 |
3 files changed, 17 insertions, 4 deletions
diff --git a/sys/arch/macppc/include/cpu.h b/sys/arch/macppc/include/cpu.h index 99c79deeb5a..88d10bfd766 100644 --- a/sys/arch/macppc/include/cpu.h +++ b/sys/arch/macppc/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.7 2002/09/15 09:01:58 deraadt Exp $ */ +/* $OpenBSD: cpu.h,v 1.8 2005/10/09 14:17:32 drahn Exp $ */ /* $NetBSD: cpu.h,v 1.1 1996/09/30 16:34:21 ws Exp $ */ /* @@ -40,11 +40,15 @@ * CTL_MACHDEP definitions. */ #define CPU_ALLOWAPERTURE 1 /* allow mmap of /dev/xf86 */ -#define CPU_MAXID 2 /* number of valid machdep ids */ +#define CPU_ALTIVEC 2 /* altivec is present */ +#define CPU_MAXID 3 /* number of valid machdep ids */ #define CTL_MACHDEP_NAMES { \ { 0, 0 }, \ { "allowaperture", CTLTYPE_INT }, \ + { "altivec", CTLTYPE_INT }, \ } +extern int ppc_altivec; + #endif /* _MACHINE_CPU_H_ */ diff --git a/sys/arch/macppc/macppc/cpu.c b/sys/arch/macppc/macppc/cpu.c index ff6b9458ac3..ccfcc79c171 100644 --- a/sys/arch/macppc/macppc/cpu.c +++ b/sys/arch/macppc/macppc/cpu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.c,v 1.28 2005/10/03 19:34:46 drahn Exp $ */ +/* $OpenBSD: cpu.c,v 1.29 2005/10/09 14:17:32 drahn Exp $ */ /* * Copyright (c) 1997 Per Fogelstrom @@ -87,6 +87,7 @@ cpumatch(parent, cfdata, aux) } static u_int32_t ppc_curfreq; +int ppc_altivec; int @@ -176,27 +177,33 @@ cpuattach(struct device *parent, struct device *dev, void *aux) snprintf(cpu_model, sizeof(cpu_model), "604ev"); break; case PPC_CPU_MPC7400: + ppc_altivec = 1; snprintf(cpu_model, sizeof(cpu_model), "7400"); break; case PPC_CPU_MPC7447A: + ppc_altivec = 1; snprintf(cpu_model, sizeof(cpu_model), "7447A"); break; case PPC_CPU_IBM970: + ppc_altivec = 1; snprintf(cpu_model, sizeof(cpu_model), "970"); break; case PPC_CPU_IBM750FX: snprintf(cpu_model, sizeof(cpu_model), "750FX"); break; case PPC_CPU_MPC7410: + ppc_altivec = 1; snprintf(cpu_model, sizeof(cpu_model), "7410"); break; case PPC_CPU_MPC7450: + ppc_altivec = 1; if ((pvr & 0xf) < 3) snprintf(cpu_model, sizeof(cpu_model), "7450"); else snprintf(cpu_model, sizeof(cpu_model), "7451"); break; case PPC_CPU_MPC7455: + ppc_altivec = 1; snprintf(cpu_model, sizeof(cpu_model), "7455"); break; default: diff --git a/sys/arch/macppc/macppc/machdep.c b/sys/arch/macppc/macppc/machdep.c index fe1ec99a0bc..713f346e033 100644 --- a/sys/arch/macppc/macppc/machdep.c +++ b/sys/arch/macppc/macppc/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.75 2005/10/09 14:01:11 drahn Exp $ */ +/* $OpenBSD: machdep.c,v 1.76 2005/10/09 14:17:32 drahn Exp $ */ /* $NetBSD: machdep.c,v 1.4 1996/10/16 19:33:11 ws Exp $ */ /* @@ -774,6 +774,8 @@ cpu_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, #else return (sysctl_rdint(oldp, oldlenp, newp, 0)); #endif + case CPU_ALTIVEC: + return (sysctl_rdint(oldp, oldlenp, newp, ppc_altivec)); default: return EOPNOTSUPP; } |