summaryrefslogtreecommitdiffstats
path: root/sys/powerpc/aim
diff options
context:
space:
mode:
authornwhitehorn <nwhitehorn@FreeBSD.org>2009-11-28 17:33:19 +0000
committernwhitehorn <nwhitehorn@FreeBSD.org>2009-11-28 17:33:19 +0000
commit451e17ae417f8768d8a5830a3a6080a2694b1781 (patch)
tree5e1aecc143405242d9ce520741a856e42d351fda /sys/powerpc/aim
parentfe50e0c755f8c366fef5ff65f3eb1911345ef4df (diff)
downloadFreeBSD-src-451e17ae417f8768d8a5830a3a6080a2694b1781.zip
FreeBSD-src-451e17ae417f8768d8a5830a3a6080a2694b1781.tar.gz
Add a CPU features framework on PowerPC and simplify CPU setup a little
more. This provides three new sysctls to user space: hw.cpu_features - A bitmask of available CPU features hw.floatingpoint - Whether or not there is hardware FP support hw.altivec - Whether or not Altivec is available PR: powerpc/139154 MFC after: 10 days
Diffstat (limited to 'sys/powerpc/aim')
-rw-r--r--sys/powerpc/aim/machdep.c9
-rw-r--r--sys/powerpc/aim/ofw_machdep.c3
2 files changed, 8 insertions, 4 deletions
diff --git a/sys/powerpc/aim/machdep.c b/sys/powerpc/aim/machdep.c
index 01272b4..7c36543 100644
--- a/sys/powerpc/aim/machdep.c
+++ b/sys/powerpc/aim/machdep.c
@@ -130,7 +130,6 @@ extern vm_offset_t ksym_start, ksym_end;
int cold = 1;
int cacheline_size = 32;
-int ppc64 = 0;
int hw_direct_map = 1;
struct pcpu __pcpu[MAXCPU];
@@ -256,6 +255,7 @@ powerpc_init(u_int startkernel, u_int endkernel, u_int basekernel, void *mdp)
char *env;
uint32_t msr, scratch;
uint8_t *cache_check;
+ int ppc64;
end = 0;
kmdp = NULL;
@@ -405,12 +405,15 @@ powerpc_init(u_int startkernel, u_int endkernel, u_int basekernel, void *mdp)
mfsprg2 %1;"
: "=r"(scratch), "=r"(ppc64));
+ if (ppc64)
+ cpu_features |= PPC_FEATURE_64;
+
/*
* Now copy restorebridge into all the handlers, if necessary,
* and set up the trap tables.
*/
- if (ppc64) {
+ if (cpu_features & PPC_FEATURE_64) {
/* Patch the two instances of rfi -> rfid */
bcopy(&rfid_patch,&rfi_patch1,4);
#ifdef KDB
@@ -489,7 +492,7 @@ powerpc_init(u_int startkernel, u_int endkernel, u_int basekernel, void *mdp)
* in case the platform module had a better idea of what we
* should do.
*/
- if (ppc64)
+ if (cpu_features & PPC_FEATURE_64)
pmap_mmu_install(MMU_TYPE_G5, BUS_PROBE_GENERIC);
else
pmap_mmu_install(MMU_TYPE_OEA, BUS_PROBE_GENERIC);
diff --git a/sys/powerpc/aim/ofw_machdep.c b/sys/powerpc/aim/ofw_machdep.c
index 773d229..6e27697 100644
--- a/sys/powerpc/aim/ofw_machdep.c
+++ b/sys/powerpc/aim/ofw_machdep.c
@@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$");
#include <vm/vm_page.h>
#include <machine/bus.h>
+#include <machine/cpu.h>
#include <machine/md_var.h>
#include <machine/platform.h>
#include <machine/ofw_machdep.h>
@@ -336,7 +337,7 @@ openfirmware(void *args)
/*
* Clear battable[] translations
*/
- if (!ppc64) {
+ if (!(cpu_features & PPC_FEATURE_64)) {
__asm __volatile("mtdbatu 2, %0\n"
"mtdbatu 3, %0" : : "r" (0));
}
OpenPOWER on IntegriCloud