summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorJason Wright <jason@cvs.openbsd.org>2002-07-21 19:55:34 +0000
committerJason Wright <jason@cvs.openbsd.org>2002-07-21 19:55:34 +0000
commit15702db563cf3bb27b73add23931b4e5ad1b1e1f (patch)
tree94b67965219a78abe170888a21038733ba071ebc /sys/dev
parent6faa223dbb0f327534666064b9724786052b2cdd (diff)
Flip on the LEDs on a 7811 when each of the rings is active (and turn them
off when not), I should really get a life.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/hifn7751.c11
-rw-r--r--sys/dev/pci/hifn7751var.h12
2 files changed, 20 insertions, 3 deletions
diff --git a/sys/dev/pci/hifn7751.c b/sys/dev/pci/hifn7751.c
index 51387d280f4..a789660a96b 100644
--- a/sys/dev/pci/hifn7751.c
+++ b/sys/dev/pci/hifn7751.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hifn7751.c,v 1.124 2002/07/21 19:08:26 jason Exp $ */
+/* $OpenBSD: hifn7751.c,v 1.125 2002/07/21 19:55:33 jason Exp $ */
/*
* Invertex AEON / Hifn 7751 driver
@@ -161,7 +161,7 @@ hifn_attach(parent, self, aux)
if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_HIFN &&
PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_HIFN_7811)
- sc->sc_flags |= HIFN_IS_7811 | HIFN_HAS_RNG;
+ sc->sc_flags |= HIFN_IS_7811 | HIFN_HAS_RNG | HIFN_HAS_LEDS;
cmd = pci_conf_read(pc, pa->pa_tag, PCI_COMMAND_STATUS_REG);
cmd |= PCI_COMMAND_MEM_ENABLE | PCI_COMMAND_MASTER_ENABLE;
@@ -754,6 +754,7 @@ hifn_init_pci_registers(sc)
HIFN_DMAIER_ILLW | HIFN_DMAIER_ILLR : 0);
sc->sc_dmaier &= ~HIFN_DMAIER_C_WAIT;
WRITE_REG_1(sc, HIFN_1_DMA_IER, sc->sc_dmaier);
+ CLR_LED(sc, HIFN_MIPSRST_LED0 | HIFN_MIPSRST_LED1 | HIFN_MIPSRST_LED2);
WRITE_REG_0(sc, HIFN_0_PUCNFG, HIFN_PUCNFG_COMPSING |
HIFN_PUCNFG_DRFR_128 | HIFN_PUCNFG_TCALLPHASES |
@@ -1514,6 +1515,7 @@ hifn_crypto(sc, cmd, crp)
if (sc->sc_c_busy == 0) {
WRITE_REG_1(sc, HIFN_1_DMA_CSR, HIFN_DMACSR_C_CTRL_ENA);
sc->sc_c_busy = 1;
+ SET_LED(sc, HIFN_MIPSRST_LED0);
}
/*
@@ -1533,6 +1535,7 @@ hifn_crypto(sc, cmd, crp)
if (sc->sc_s_busy == 0) {
WRITE_REG_1(sc, HIFN_1_DMA_CSR, HIFN_DMACSR_S_CTRL_ENA);
sc->sc_s_busy = 1;
+ SET_LED(sc, HIFN_MIPSRST_LED1);
}
/*
@@ -1560,6 +1563,7 @@ hifn_crypto(sc, cmd, crp)
if (sc->sc_r_busy == 0) {
WRITE_REG_1(sc, HIFN_1_DMA_CSR, HIFN_DMACSR_R_CTRL_ENA);
sc->sc_r_busy = 1;
+ SET_LED(sc, HIFN_MIPSRST_LED2);
}
if (cmd->sloplen)
@@ -1613,10 +1617,12 @@ hifn_tick(vsc)
if (dma->cmdu == 0 && sc->sc_c_busy) {
sc->sc_c_busy = 0;
r |= HIFN_DMACSR_C_CTRL_DIS;
+ CLR_LED(sc, HIFN_MIPSRST_LED0);
}
if (dma->srcu == 0 && sc->sc_s_busy) {
sc->sc_s_busy = 0;
r |= HIFN_DMACSR_S_CTRL_DIS;
+ CLR_LED(sc, HIFN_MIPSRST_LED1);
}
if (dma->dstu == 0 && sc->sc_d_busy) {
sc->sc_d_busy = 0;
@@ -1625,6 +1631,7 @@ hifn_tick(vsc)
if (dma->resu == 0 && sc->sc_r_busy) {
sc->sc_r_busy = 0;
r |= HIFN_DMACSR_R_CTRL_DIS;
+ CLR_LED(sc, HIFN_MIPSRST_LED2);
}
if (r)
WRITE_REG_1(sc, HIFN_1_DMA_CSR, r);
diff --git a/sys/dev/pci/hifn7751var.h b/sys/dev/pci/hifn7751var.h
index 6f672fe4330..9424c182b40 100644
--- a/sys/dev/pci/hifn7751var.h
+++ b/sys/dev/pci/hifn7751var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: hifn7751var.h,v 1.43 2002/07/21 19:08:26 jason Exp $ */
+/* $OpenBSD: hifn7751var.h,v 1.44 2002/07/21 19:55:33 jason Exp $ */
/*
* Invertex AEON / Hifn 7751 driver
@@ -156,6 +156,7 @@ struct hifn_softc {
#define HIFN_HAS_PUBLIC 2
#define HIFN_IS_7811 4
#define HIFN_NO_BURSTWRITE 8
+#define HIFN_HAS_LEDS 16
struct timeout sc_rngto, sc_tickto;
int sc_rngfirst;
int sc_rnghz;
@@ -190,6 +191,15 @@ struct hifn_softc {
#define READ_REG_1(sc,reg) \
bus_space_read_4((sc)->sc_st1, (sc)->sc_sh1, reg)
+#define SET_LED(sc,v) \
+ if (sc->sc_flags & HIFN_HAS_LEDS) \
+ WRITE_REG_1(sc, HIFN_1_7811_MIPSRST, \
+ READ_REG_1(sc, HIFN_1_7811_MIPSRST) | (v))
+#define CLR_LED(sc,v) \
+ if (sc->sc_flags & HIFN_HAS_LEDS) \
+ WRITE_REG_1(sc, HIFN_1_7811_MIPSRST, \
+ READ_REG_1(sc, HIFN_1_7811_MIPSRST) & ~(v))
+
/*
* hifn_command_t
*