summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2010-09-20 02:46:51 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2010-09-20 02:46:51 +0000
commit157f786ffba38897086fd1939522ae520bf25253 (patch)
tree76a25644b174ccb2af4e7772f1c81f2ed3feaee5 /sys/arch
parentd3375625f7d9c2ed7cca76063f07949369e51d00 (diff)
Write the start of an activate function. QUIESCE should wait for the
current crypto operation to finish but doesn't do that yet. The suspend and resume operations assume that SB_GLD_MSR_CTRL gets trashed ok pirofti
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/i386/pci/glxsb.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/sys/arch/i386/pci/glxsb.c b/sys/arch/i386/pci/glxsb.c
index 754d500f551..c1e52d45cf5 100644
--- a/sys/arch/i386/pci/glxsb.c
+++ b/sys/arch/i386/pci/glxsb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: glxsb.c,v 1.19 2010/07/02 02:40:15 blambert Exp $ */
+/* $OpenBSD: glxsb.c,v 1.20 2010/09/20 02:46:50 deraadt Exp $ */
/*
* Copyright (c) 2006 Tom Cosgrove <tom@openbsd.org>
@@ -171,14 +171,18 @@ struct glxsb_softc {
int sc_nsessions;
struct glxsb_session *sc_sessions;
#endif /* CRYPTO */
+
+ uint64_t save_gld_msr;
};
int glxsb_match(struct device *, void *, void *);
void glxsb_attach(struct device *, struct device *, void *);
+int glxsb_activate(struct device *, int);
void glxsb_rnd(void *);
struct cfattach glxsb_ca = {
- sizeof(struct glxsb_softc), glxsb_match, glxsb_attach
+ sizeof(struct glxsb_softc), glxsb_match, glxsb_attach, NULL,
+ glxsb_activate
};
struct cfdriver glxsb_cd = {
@@ -285,6 +289,25 @@ glxsb_attach(struct device *parent, struct device *self, void *aux)
printf("\n");
}
+int
+glxsb_activate(struct device *self, int act)
+{
+ struct glxsb_softc *sc = (struct glxsb_softc *)self;
+
+ switch (act) {
+ case DVACT_QUIESCE:
+ /* XXX should wait for current crypto op to finish */
+ break;
+ case DVACT_SUSPEND:
+ sc->save_gld_msr = rdmsr(SB_GLD_MSR_CTRL);
+ break;
+ case DVACT_RESUME:
+ wrmsr(SB_GLD_MSR_CTRL, sc->save_gld_msr);
+ break;
+ }
+ return (0);
+}
+
void
glxsb_rnd(void *v)
{