summaryrefslogtreecommitdiff
path: root/sys/arch/sparc64/dev/auxio.c
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2005-03-09 18:41:51 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2005-03-09 18:41:51 +0000
commit4eaca50d846d95e18b1f4b8bfac26b5043bd3eaf (patch)
tree4ae984f5c65bb10ccafd67d33474d3c954766c71 /sys/arch/sparc64/dev/auxio.c
parent1da8f26758611ca48a0d63bbc6ac0af99badda46 (diff)
Preliminary support for the floppy drive on Ultrasparcs. Only tested on
SBus machines so far, although EBus attachment glue is provided but not enabled by default. Also, fdformat(8) does not work correctly yet, although reading and writing is safe; this will hopefully be fixed in the near future. ok deraadt@
Diffstat (limited to 'sys/arch/sparc64/dev/auxio.c')
-rw-r--r--sys/arch/sparc64/dev/auxio.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/sys/arch/sparc64/dev/auxio.c b/sys/arch/sparc64/dev/auxio.c
index daf8ee3bbe5..e084b205452 100644
--- a/sys/arch/sparc64/dev/auxio.c
+++ b/sys/arch/sparc64/dev/auxio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: auxio.c,v 1.6 2004/10/01 18:18:49 jason Exp $ */
+/* $OpenBSD: auxio.c,v 1.7 2005/03/09 18:41:48 miod Exp $ */
/* $NetBSD: auxio.c,v 1.1 2000/04/15 03:08:13 mrg Exp $ */
/*
@@ -213,3 +213,33 @@ auxio_led_blink(void *vsc, int on)
splx(s);
}
+
+int
+auxio_fd_control(u_int32_t bits)
+{
+ struct auxio_softc *sc;
+ u_int32_t led;
+
+ if (auxio_cd.cd_ndevs == 0) {
+ return ENXIO;
+ }
+
+ /*
+ * XXX This does not handle > 1 auxio correctly.
+ * We'll assume the floppy drive is tied to first auxio found.
+ */
+ sc = (struct auxio_softc *)auxio_cd.cd_devs[0];
+ if (sc->sc_flags & AUXIO_EBUS)
+ led = letoh32(bus_space_read_4(sc->sc_tag, sc->sc_led, 0));
+ else
+ led = bus_space_read_1(sc->sc_tag, sc->sc_led, 0);
+
+ led = (led & ~AUXIO_LED_FLOPPY_MASK) | bits;
+
+ if (sc->sc_flags & AUXIO_EBUS)
+ bus_space_write_4(sc->sc_tag, sc->sc_led, 0, htole32(led));
+ else
+ bus_space_write_1(sc->sc_tag, sc->sc_led, 0, led);
+
+ return 0;
+}