diff options
author | nate <nate@FreeBSD.org> | 1997-10-26 04:36:24 +0000 |
---|---|---|
committer | nate <nate@FreeBSD.org> | 1997-10-26 04:36:24 +0000 |
commit | c68183d0b8cb8cb595c0fac05b6d989132543595 (patch) | |
tree | 3e3880b90341465871c326ce768b275780757e2d /sys/dev/sio | |
parent | bc21da1f3f59930a96cd6829bfaf0147d28b7754 (diff) | |
download | FreeBSD-src-c68183d0b8cb8cb595c0fac05b6d989132543595.zip FreeBSD-src-c68183d0b8cb8cb595c0fac05b6d989132543595.tar.gz |
- Do a bunch of gratuitous changes intended to make the code easier to
follow.
* Rename/reorder all of the pccard structures, change many of the member
names to be descriptive, and follow more closely other 'bus' drivers
naming schemes.
* Rename a bunch of parameter and local variable names to be more
consistant in the code.
* Renamed the PCCARD 'crd' device to be the 'card' device
* KNF and make the code consistant where it was obvious.
* ifdef'd out some unused code
Diffstat (limited to 'sys/dev/sio')
-rw-r--r-- | sys/dev/sio/sio.c | 82 |
1 files changed, 41 insertions, 41 deletions
diff --git a/sys/dev/sio/sio.c b/sys/dev/sio/sio.c index 39c6470..9697556 100644 --- a/sys/dev/sio/sio.c +++ b/sys/dev/sio/sio.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)com.c 7.5 (Berkeley) 5/16/91 - * $Id: sio.c,v 1.183 1997/09/21 21:41:40 gibbs Exp $ + * $Id: sio.c,v 1.184 1997/10/12 20:23:30 phk Exp $ */ #include "opt_comconsole.h" @@ -87,8 +87,8 @@ #endif #include <i386/isa/ic/ns16550.h> -#include "crd.h" -#if NCRD > 0 +#include "card.h" +#if NCARD > 0 #include <pccard/card.h> #include <pccard/driver.h> #include <pccard/slot.h> @@ -470,63 +470,50 @@ sysctl_machdep_comdefaultrate SYSCTL_HANDLER_ARGS SYSCTL_PROC(_machdep, OID_AUTO, conspeed, CTLTYPE_INT | CTLFLAG_RW, 0, 0, sysctl_machdep_comdefaultrate, "I", ""); -#if NCRD > 0 +#if NCARD > 0 /* * PC-Card (PCMCIA) specific code. */ -static int card_intr(struct pccard_dev *); /* Interrupt handler */ -static void siounload(struct pccard_dev *); /* Disable driver */ -static void siosuspend(struct pccard_dev *); /* Suspend driver */ -static int sioinit(struct pccard_dev *, int); /* init device */ +static int sioinit(struct pccard_devinfo *, int); /* init device */ +static void siounload(struct pccard_devinfo *); /* Disable driver */ +static int card_intr(struct pccard_devinfo *); /* Interrupt handler */ +static void siosuspend(struct pccard_devinfo *); /* Suspend driver */ -static struct pccard_drv sio_info = { +static struct pccard_device sio_info = { driver_name, - card_intr, + sioinit, siounload, + card_intr, siosuspend, - sioinit, 0, /* Attributes - presently unused */ &tty_imask /* Interrupt mask for device */ /* XXX - Should this also include net_imask? */ }; /* - * Called when a power down is requested. Shuts down the - * device and configures the device as unavailable (but - * still loaded...). A resume is done by calling - * sioinit with first=0. This is called when the user suspends - * the system, or the APM code suspends the system. - */ -static void -siosuspend(struct pccard_dev *dp) -{ - printf("sio%d: suspending\n", dp->isahd.id_unit); -} - -/* * Initialize the device - called from Slot manager. + * * If first is set, then check for the device's existence * before initializing it. Once initialized, the device table may * be set up. */ int -sioinit(struct pccard_dev *dp, int first) +sioinit(struct pccard_devinfo *devi, int first) { - /* validate unit number. */ if (first) { - if (dp->isahd.id_unit >= (NSIOTOT)) + if (devi->isahd.id_unit >= (NSIOTOT)) return(ENODEV); /* Make sure it isn't already probed. */ - if (com_addr(dp->isahd.id_unit)) + if (com_addr(devi->isahd.id_unit)) return(EBUSY); /* * Probe the device. If a value is returned, the * device was found at the location. */ - if (sioprobe(&dp->isahd)==0) + if (sioprobe(&devi->isahd) == 0) return(ENXIO); - if (sioattach(&dp->isahd)==0) + if (sioattach(&devi->isahd) == 0) return(ENXIO); } /* @@ -549,18 +536,18 @@ sioinit(struct pccard_dev *dp, int first) * read and write do not hang. */ static void -siounload(struct pccard_dev *dp) +siounload(struct pccard_devinfo *devi) { struct com_s *com; - com = com_addr(dp->isahd.id_unit); + com = com_addr(devi->isahd.id_unit); if (!com->iobase) { - printf("sio%d already unloaded!\n",dp->isahd.id_unit); + printf("sio%d already unloaded!\n",devi->isahd.id_unit); return; } if (com->tp && (com->tp->t_state & TS_ISOPEN)) { com->gone = 1; - printf("sio%d: unload\n", dp->isahd.id_unit); + printf("sio%d: unload\n", devi->isahd.id_unit); com->tp->t_gen++; ttyclose(com->tp); ttwakeup(com->tp); @@ -569,7 +556,7 @@ siounload(struct pccard_dev *dp) com_addr(com->unit) = NULL; bzero(com, sizeof *com); free(com,M_TTYS); - printf("sio%d: unload,gone\n", dp->isahd.id_unit); + printf("sio%d: unload,gone\n", devi->isahd.id_unit); } } @@ -578,17 +565,30 @@ siounload(struct pccard_dev *dp) * front end of PC-Card handler. */ static int -card_intr(struct pccard_dev *dp) +card_intr(struct pccard_devinfo *devi) { struct com_s *com; COM_LOCK(); - com = com_addr(dp->isahd.id_unit); - if (com && !com_addr(dp->isahd.id_unit)->gone) - siointr1(com_addr(dp->isahd.id_unit)); + com = com_addr(devi->isahd.id_unit); + if (com && !com_addr(devi->isahd.id_unit)->gone) + siointr1(com_addr(devi->isahd.id_unit)); COM_UNLOCK(); return(1); } -#endif /* NCRD > 0 */ + +/* + * Called when a power down is requested. Shuts down the + * device and configures the device as unavailable (but + * still loaded...). A resume is done by calling + * sioinit with first=0. This is called when the user suspends + * the system, or the APM code suspends the system. + */ +static void +siosuspend(struct pccard_devinfo *devi) +{ + printf("sio%d: suspending\n", devi->isahd.id_unit); +} +#endif /* NCARD > 0 */ static int sioprobe(dev) @@ -613,7 +613,7 @@ sioprobe(dev) for (xdev = isa_devtab_tty; xdev->id_driver != NULL; xdev++) if (xdev->id_driver == &siodriver && xdev->id_enabled) outb(xdev->id_iobase + com_mcr, 0); -#if NCRD > 0 +#if NCARD > 0 /* * If PC-Card probe required, then register driver with * slot manager. |