summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2007-05-08 21:28:11 +0000
committerderaadt <deraadt@openbsd.org>2007-05-08 21:28:11 +0000
commit740ce6f30b8c73054c3a5ed0a212ba0413b1751f (patch)
treefa97dcb7b8ed1fed917bbf0ebd320f3d3ffccd42 /sys/dev
parentnon-static inline functions waste space (diff)
downloadwireguard-openbsd-740ce6f30b8c73054c3a5ed0a212ba0413b1751f.tar.xz
wireguard-openbsd-740ce6f30b8c73054c3a5ed0a212ba0413b1751f.zip
backout while the amd64 puc situation is rethought
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/cardbus/com_cardbus.c103
-rw-r--r--sys/dev/ic/com.c74
-rw-r--r--sys/dev/ic/comvar.h4
3 files changed, 82 insertions, 99 deletions
diff --git a/sys/dev/cardbus/com_cardbus.c b/sys/dev/cardbus/com_cardbus.c
index af7eda1b341..f55b55356c5 100644
--- a/sys/dev/cardbus/com_cardbus.c
+++ b/sys/dev/cardbus/com_cardbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: com_cardbus.c,v 1.29 2007/05/08 21:18:18 deraadt Exp $ */
+/* $OpenBSD: com_cardbus.c,v 1.30 2007/05/08 21:28:11 deraadt Exp $ */
/* $NetBSD: com_cardbus.c,v 1.4 2000/04/17 09:21:59 joda Exp $ */
/*
@@ -48,41 +48,26 @@
#include <sys/param.h>
#include <sys/systm.h>
-#include <sys/ioctl.h>
-#include <sys/selinfo.h>
#include <sys/tty.h>
-#include <sys/proc.h>
-#include <sys/user.h>
-#include <sys/conf.h>
-#include <sys/file.h>
-#include <sys/uio.h>
-#include <sys/kernel.h>
-#include <sys/syslog.h>
#include <sys/device.h>
-#include <sys/vnode.h>
#include <dev/cardbus/cardbusvar.h>
#include <dev/pci/pcidevs.h>
#include <dev/pcmcia/pcmciareg.h>
-#include <machine/bus.h>
-#if defined(__sparc64__) || !defined(__sparc__)
-#include <machine/intr.h>
-#endif
-
-#if !defined(__sparc__) || defined(__sparc64__)
-#define COM_CONSOLE
-#include <dev/cons.h>
-#endif
-
#include "com.h"
#ifdef i386
#include "pccom.h"
#endif
#include <dev/ic/comreg.h>
+#if NPCCOM > 0
+#include <i386/isa/pccomvar.h>
+#endif
+#if NCOM > 0
#include <dev/ic/comvar.h>
+#endif
#include <dev/ic/ns16550reg.h>
#define com_lcr com_cfcr
@@ -115,10 +100,6 @@ struct csdev *com_cardbus_find_csdev(struct cardbus_attach_args *);
int com_cardbus_gofigure(struct cardbus_attach_args *,
struct com_cardbus_softc *);
-int com_activate(struct device *, enum devact);
-int com_detach(struct device *, int);
-int comopen(dev_t dev, int flag, int mode, struct proc *p);
-
#if NCOM_CARDBUS
struct cfattach com_cardbus_ca = {
sizeof(struct com_cardbus_softc), com_cardbus_match,
@@ -391,78 +372,6 @@ com_cardbus_disable(struct com_softc *sc)
}
int
-com_detach(self, flags)
- struct device *self;
- int flags;
-{
- struct com_softc *sc = (struct com_softc *)self;
- int maj, mn;
-
- sc->sc_swflags |= COM_SW_DEAD;
-
- /* locate the major number */
- for (maj = 0; maj < nchrdev; maj++)
- if (cdevsw[maj].d_open == comopen)
- break;
-
- /* Nuke the vnodes for any open instances. */
- mn = self->dv_unit;
- vdevgone(maj, mn, mn, VCHR);
-
- /* XXX a symbolic constant for the cua bit would be nicer. */
- mn |= 0x80;
- vdevgone(maj, mn, mn, VCHR);
-
- /* Detach and free the tty. */
- if (sc->sc_tty) {
- ttyfree(sc->sc_tty);
- }
-
- timeout_del(&sc->sc_dtr_tmo);
- timeout_del(&sc->sc_diag_tmo);
-#ifdef __HAVE_GENERIC_SOFT_INTERRUPTS
- softintr_disestablish(sc->sc_si);
-#else
- timeout_del(&sc->sc_comsoft_tmo);
-#endif
-
- return (0);
-}
-
-int
-com_activate(self, act)
- struct device *self;
- enum devact act;
-{
- struct com_softc *sc = (struct com_softc *)self;
- int s, rv = 0;
-
- s = spltty();
- switch (act) {
- case DVACT_ACTIVATE:
- break;
-
- case DVACT_DEACTIVATE:
-#ifdef KGDB
- if (sc->sc_hwflags & (COM_HW_CONSOLE|COM_HW_KGDB)) {
-#else
- if (sc->sc_hwflags & COM_HW_CONSOLE) {
-#endif /* KGDB */
- rv = EBUSY;
- break;
- }
-
- if (sc->disable != NULL && sc->enabled != 0) {
- (*sc->disable)(sc);
- sc->enabled = 0;
- }
- break;
- }
- splx(s);
- return (rv);
-}
-
-int
com_cardbus_detach(struct device *self, int flags)
{
struct com_cardbus_softc *csc = (struct com_cardbus_softc *) self;
diff --git a/sys/dev/ic/com.c b/sys/dev/ic/com.c
index b38725ba57e..5ab1dc80afb 100644
--- a/sys/dev/ic/com.c
+++ b/sys/dev/ic/com.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: com.c,v 1.114 2007/05/08 21:18:18 deraadt Exp $ */
+/* $OpenBSD: com.c,v 1.115 2007/05/08 21:28:11 deraadt Exp $ */
/* $NetBSD: com.c,v 1.82.4.1 1996/06/02 09:08:00 mrg Exp $ */
/*
@@ -200,6 +200,78 @@ comprobe1(iot, ioh)
#endif
int
+com_detach(self, flags)
+ struct device *self;
+ int flags;
+{
+ struct com_softc *sc = (struct com_softc *)self;
+ int maj, mn;
+
+ sc->sc_swflags |= COM_SW_DEAD;
+
+ /* locate the major number */
+ for (maj = 0; maj < nchrdev; maj++)
+ if (cdevsw[maj].d_open == comopen)
+ break;
+
+ /* Nuke the vnodes for any open instances. */
+ mn = self->dv_unit;
+ vdevgone(maj, mn, mn, VCHR);
+
+ /* XXX a symbolic constant for the cua bit would be nicer. */
+ mn |= 0x80;
+ vdevgone(maj, mn, mn, VCHR);
+
+ /* Detach and free the tty. */
+ if (sc->sc_tty) {
+ ttyfree(sc->sc_tty);
+ }
+
+ timeout_del(&sc->sc_dtr_tmo);
+ timeout_del(&sc->sc_diag_tmo);
+#ifdef __HAVE_GENERIC_SOFT_INTERRUPTS
+ softintr_disestablish(sc->sc_si);
+#else
+ timeout_del(&sc->sc_comsoft_tmo);
+#endif
+
+ return (0);
+}
+
+int
+com_activate(self, act)
+ struct device *self;
+ enum devact act;
+{
+ struct com_softc *sc = (struct com_softc *)self;
+ int s, rv = 0;
+
+ s = spltty();
+ switch (act) {
+ case DVACT_ACTIVATE:
+ break;
+
+ case DVACT_DEACTIVATE:
+#ifdef KGDB
+ if (sc->sc_hwflags & (COM_HW_CONSOLE|COM_HW_KGDB)) {
+#else
+ if (sc->sc_hwflags & COM_HW_CONSOLE) {
+#endif /* KGDB */
+ rv = EBUSY;
+ break;
+ }
+
+ if (sc->disable != NULL && sc->enabled != 0) {
+ (*sc->disable)(sc);
+ sc->enabled = 0;
+ }
+ break;
+ }
+ splx(s);
+ return (rv);
+}
+
+int
comopen(dev, flag, mode, p)
dev_t dev;
int flag, mode;
diff --git a/sys/dev/ic/comvar.h b/sys/dev/ic/comvar.h
index acea583ce5a..0c22660f9c8 100644
--- a/sys/dev/ic/comvar.h
+++ b/sys/dev/ic/comvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: comvar.h,v 1.42 2007/05/08 21:18:18 deraadt Exp $ */
+/* $OpenBSD: comvar.h,v 1.43 2007/05/08 21:28:11 deraadt Exp $ */
/* $NetBSD: comvar.h,v 1.5 1996/05/05 19:50:47 christos Exp $ */
/*
@@ -140,6 +140,8 @@ struct com_softc {
int comprobe1(bus_space_tag_t, bus_space_handle_t);
int comstop(struct tty *, int);
int comintr(void *);
+int com_detach(struct device *, int);
+int com_activate(struct device *, enum devact);
void comdiag(void *);
int comspeed(long, long);