summaryrefslogtreecommitdiffstats
path: root/sys/powerpc
diff options
context:
space:
mode:
authorattilio <attilio@FreeBSD.org>2011-05-26 17:38:00 +0000
committerattilio <attilio@FreeBSD.org>2011-05-26 17:38:00 +0000
commit867c6223e7e4f6682389d40926782fd537ffc3ad (patch)
tree87423ad4498424494102d7b58615c0df44019d32 /sys/powerpc
parentc0038ec50d088a2152d05e1da7d5b4cec45e8d27 (diff)
parentd7214daa609442aa65fdbb054db56a3ffc1ee75a (diff)
downloadFreeBSD-src-867c6223e7e4f6682389d40926782fd537ffc3ad.zip
FreeBSD-src-867c6223e7e4f6682389d40926782fd537ffc3ad.tar.gz
MFC
Diffstat (limited to 'sys/powerpc')
-rw-r--r--sys/powerpc/aim/trap_subr64.S1
-rw-r--r--sys/powerpc/ps3/ps3bus.c34
2 files changed, 34 insertions, 1 deletions
diff --git a/sys/powerpc/aim/trap_subr64.S b/sys/powerpc/aim/trap_subr64.S
index 64e4ac1..7156edb 100644
--- a/sys/powerpc/aim/trap_subr64.S
+++ b/sys/powerpc/aim/trap_subr64.S
@@ -519,6 +519,7 @@ CNAME(trapexit):
mfmsr %r3
andi. %r3,%r3,~PSL_EE@l
mtmsr %r3
+ isync
/* Test AST pending: */
ld %r5,FRAME_SRR1+48(%r1)
mtcr %r5
diff --git a/sys/powerpc/ps3/ps3bus.c b/sys/powerpc/ps3/ps3bus.c
index 11dbba5..6a5120a 100644
--- a/sys/powerpc/ps3/ps3bus.c
+++ b/sys/powerpc/ps3/ps3bus.c
@@ -31,6 +31,7 @@
#include <sys/module.h>
#include <sys/malloc.h>
#include <sys/bus.h>
+#include <sys/clock.h>
#include <sys/cpu.h>
#include <sys/resource.h>
#include <sys/rman.h>
@@ -46,6 +47,7 @@
#include "ps3bus.h"
#include "ps3-hvcall.h"
#include "iommu_if.h"
+#include "clock_if.h"
static void ps3bus_identify(driver_t *, device_t);
static int ps3bus_probe(device_t);
@@ -63,6 +65,8 @@ static int ps3_iommu_map(device_t dev, bus_dma_segment_t *segs, int *nsegs,
bus_size_t boundary, void *cookie);
static int ps3_iommu_unmap(device_t dev, bus_dma_segment_t *segs,
int nsegs, void *cookie);
+static int ps3_gettime(device_t dev, struct timespec *ts);
+static int ps3_settime(device_t dev, struct timespec *ts);
struct ps3bus_devinfo {
int bus;
@@ -106,6 +110,10 @@ static device_method_t ps3bus_methods[] = {
DEVMETHOD(iommu_map, ps3_iommu_map),
DEVMETHOD(iommu_unmap, ps3_iommu_unmap),
+ /* Clock interface */
+ DEVMETHOD(clock_gettime, ps3_gettime),
+ DEVMETHOD(clock_settime, ps3_settime),
+
{ 0, 0 }
};
@@ -312,6 +320,8 @@ ps3bus_attach(device_t self)
device_set_ivars(cdev, dinfo);
}
}
+
+ clock_register(self, 1000);
return (bus_generic_attach(self));
}
@@ -551,7 +561,6 @@ ps3_iommu_map(device_t dev, bus_dma_segment_t *segs, int *nsegs,
return (0);
}
-
static int
ps3_iommu_unmap(device_t dev, bus_dma_segment_t *segs, int nsegs, void *cookie)
{
@@ -559,3 +568,26 @@ ps3_iommu_unmap(device_t dev, bus_dma_segment_t *segs, int nsegs, void *cookie)
return (0);
}
+#define Y2K 946684800
+
+static int
+ps3_gettime(device_t dev, struct timespec *ts)
+{
+ uint64_t rtc, tb;
+ int result;
+
+ result = lv1_get_rtc(&rtc, &tb);
+ if (result)
+ return (result);
+
+ ts->tv_sec = rtc + Y2K;
+ ts->tv_nsec = 0;
+ return (0);
+}
+
+static int
+ps3_settime(device_t dev, struct timespec *ts)
+{
+ return (-1);
+}
+
OpenPOWER on IntegriCloud