diff options
author | phk <phk@FreeBSD.org> | 1995-12-10 13:40:44 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 1995-12-10 13:40:44 +0000 |
commit | e7008a284eab826ab8cc8f3cdadd22a325c67196 (patch) | |
tree | aaefb89a560ab76e15fa576ab1458dd020b6e04e /sys/isa | |
parent | 6a1611e3f8697d6b86f0ce460a09f863f0645323 (diff) | |
download | FreeBSD-src-e7008a284eab826ab8cc8f3cdadd22a325c67196.zip FreeBSD-src-e7008a284eab826ab8cc8f3cdadd22a325c67196.tar.gz |
Staticize and cleanup.
Diffstat (limited to 'sys/isa')
-rw-r--r-- | sys/isa/atrtc.c | 10 | ||||
-rw-r--r-- | sys/isa/fd.c | 16 | ||||
-rw-r--r-- | sys/isa/joy.c | 7 | ||||
-rw-r--r-- | sys/isa/kbdtables.h | 16 | ||||
-rw-r--r-- | sys/isa/sio.c | 102 | ||||
-rw-r--r-- | sys/isa/sioreg.h | 10 | ||||
-rw-r--r-- | sys/isa/syscons.c | 23 | ||||
-rw-r--r-- | sys/isa/syscons.h | 6 |
8 files changed, 86 insertions, 104 deletions
diff --git a/sys/isa/atrtc.c b/sys/isa/atrtc.c index 82e0b18..86a1eec 100644 --- a/sys/isa/atrtc.c +++ b/sys/isa/atrtc.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)clock.c 7.2 (Berkeley) 5/12/91 - * $Id: clock.c,v 1.38 1995/10/28 15:38:49 phk Exp $ + * $Id: clock.c,v 1.39 1995/11/29 19:57:22 wollman Exp $ */ /* @@ -130,7 +130,7 @@ clkintr(struct clockframe frame) setdelayed(); } #else -void +static void clkintr(struct clockframe frame) { timer_func(&frame); @@ -245,7 +245,7 @@ release_timer2() * The RTC chip requires that we read status register C (RTC_INTR) * to acknowledge an interrupt, before it will generate the next one. */ -void +static void rtcintr(struct clockframe frame) { u_char stat; @@ -256,8 +256,8 @@ rtcintr(struct clockframe frame) } #ifdef DDB -static void -printrtc(void) +void +DDB_printrtc(void) { printf("%02x/%02x/%02x %02x:%02x:%02x, A = %02x, B = %02x, C = %02x\n", rtcin(RTC_YEAR), rtcin(RTC_MONTH), rtcin(RTC_DAY), diff --git a/sys/isa/fd.c b/sys/isa/fd.c index 4e9c091..e394e13 100644 --- a/sys/isa/fd.c +++ b/sys/isa/fd.c @@ -43,7 +43,7 @@ * SUCH DAMAGE. * * from: @(#)fd.c 7.4 (Berkeley) 5/25/91 - * $Id: fd.c,v 1.74 1995/12/08 23:20:26 phk Exp $ + * $Id: fd.c,v 1.75 1995/12/09 09:10:12 julian Exp $ * */ @@ -200,7 +200,7 @@ fd_goaway(struct kern_devconf *kdc, int force) #define FD_360in5_25 14 -struct fd_type fd_types[NUMTYPES] = +static struct fd_type fd_types[NUMTYPES] = { { 21,2,0xFF,0x04,82,3444,1,FDC_500KBPS,2,0x0C,2 }, /* 1.72M in HD 3.5in */ { 18,2,0xFF,0x1B,82,2952,1,FDC_500KBPS,2,0x6C,1 }, /* 1.48M in HD 3.5in */ @@ -230,7 +230,7 @@ struct fdc_data fdc_data[NFDC]; * Per drive structure. * * N per controller (DRVS_PER_CTLR) * \***********************************************************************/ -struct fd_data { +static struct fd_data { struct fdc_data *fdc; /* pointer to controller structure */ int fdsu; /* this units number on this controller */ int type; /* Drive type (FD_1440...) */ @@ -360,7 +360,7 @@ static struct cdevsw fd_cdevsw = seltrue, nommap, fdstrategy, "fd", &fd_bdevsw, -1 }; -struct isa_device *fdcdevs[NFDC]; +static struct isa_device *fdcdevs[NFDC]; /* * Provide hw.devconf information. @@ -393,7 +393,7 @@ fdc_err(fdcu_t fdcu, const char *s) * # of input bytes, input bytes as ints ... */ -int +static int fd_cmd(fdcu_t fdcu, int n_out, ...) { u_char cmd; @@ -433,7 +433,7 @@ fd_cmd(fdcu_t fdcu, int n_out, ...) return 0; } -int +static int fd_sense_drive_status(fdc_p fdc, int *st3p) { int st3; @@ -448,7 +448,7 @@ fd_sense_drive_status(fdc_p fdc, int *st3p) return 0; } -int +static int fd_sense_int(fdc_p fdc, int *st0p, int *cylp) { int st0, cyl; @@ -485,7 +485,7 @@ fd_sense_int(fdc_p fdc, int *st0p, int *cylp) } -int +static int fd_read_status(fdc_p fdc, int fdsu) { int i, ret; diff --git a/sys/isa/joy.c b/sys/isa/joy.c index 99008ad..351c456 100644 --- a/sys/isa/joy.c +++ b/sys/isa/joy.c @@ -81,7 +81,8 @@ static struct { extern int timer0_max_count; -int joyprobe (struct isa_device *), joyattach (struct isa_device *); +static int joyprobe (struct isa_device *); +static int joyattach (struct isa_device *); struct isa_driver joydriver = {joyprobe, joyattach, "joy"}; @@ -99,7 +100,7 @@ static struct cdevsw joy_cdevsw = static int get_tick (); -int +static int joyprobe (struct isa_device *dev) { #ifdef WANT_JOYSTICK_CONNECTED @@ -111,7 +112,7 @@ joyprobe (struct isa_device *dev) #endif } -int +static int joyattach (struct isa_device *dev) { int unit = dev->id_unit; diff --git a/sys/isa/kbdtables.h b/sys/isa/kbdtables.h index a761053..9130c78 100644 --- a/sys/isa/kbdtables.h +++ b/sys/isa/kbdtables.h @@ -25,13 +25,13 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: kbdtables.h,v 1.28 1995/03/27 19:41:11 sos Exp $ + * $Id: kbdtables.h,v 1.29 1995/03/28 21:30:13 sos Exp $ */ #define SET8 0x80 /* set eight bit on */ #ifdef DKKEYMAP -keymap_t key_map = { 0x6C, /* DK iso8859 keymap */ +static keymap_t key_map = { 0x6C, /* DK iso8859 keymap */ /* alt * scan cntrl alt alt cntrl * code base shift cntrl shift alt shift cntrl shift spcl flgs @@ -149,7 +149,7 @@ keymap_t key_map = { 0x6C, /* DK iso8859 keymap */ #endif #ifdef UKKEYMAP -keymap_t key_map = { 0x6C, /* uk iso8859 keymap */ +static keymap_t key_map = { 0x6C, /* uk iso8859 keymap */ /* alt * scan cntrl alt alt cntrl * code base shift cntrl shift alt shift cntrl shift spcl flgs @@ -267,7 +267,7 @@ keymap_t key_map = { 0x6C, /* uk iso8859 keymap */ #endif #ifdef GRKEYMAP -keymap_t key_map = { 0x6C, /* german iso8859 keymap */ +static keymap_t key_map = { 0x6C, /* german iso8859 keymap */ /* alt * scan cntrl alt alt cntrl * code base shift cntrl shift alt shift cntrl shift spcl flgs @@ -385,7 +385,7 @@ keymap_t key_map = { 0x6C, /* german iso8859 keymap */ #endif #ifdef SWKEYMAP -keymap_t key_map = { 0x6C, /* swedish iso8859 keymap */ +static keymap_t key_map = { 0x6C, /* swedish iso8859 keymap */ /* alt * scan cntrl alt alt cntrl * code base shift cntrl shift alt shift cntrl shift spcl flgs @@ -503,7 +503,7 @@ keymap_t key_map = { 0x6C, /* swedish iso8859 keymap */ #endif #ifdef RUKEYMAP -keymap_t key_map = { 0xEC, /* keys number */ +static keymap_t key_map = { 0xEC, /* keys number */ /* alt * scan cntrl alt alt cntrl * code base shift cntrl shift alt shift cntrl shift spcl flgs @@ -751,7 +751,7 @@ keymap_t key_map = { 0xEC, /* keys number */ #endif #if !defined(DKKEYMAP) && !defined(UKKEYMAP) && !defined(GRKEYMAP) && !defined(SWKEYMAP) && !defined(RUKEYMAP) -keymap_t key_map = { 0x6C, /* US iso8859 keymap */ +static keymap_t key_map = { 0x6C, /* US iso8859 keymap */ /* alt * scan cntrl alt alt cntrl * code base shift cntrl shift alt shift cntrl shift spcl flgs @@ -869,7 +869,7 @@ keymap_t key_map = { 0x6C, /* US iso8859 keymap */ #endif -fkeytab_t fkey_tab[96] = { +static fkeytab_t fkey_tab[96] = { /* 01-04 */ {"\033[M", 3}, {"\033[N", 3}, {"\033[O", 3}, {"\033[P", 3}, /* 05-08 */ {"\033[Q", 3}, {"\033[R", 3}, {"\033[S", 3}, {"\033[T", 3}, /* 09-12 */ {"\033[U", 3}, {"\033[V", 3}, {"\033[W", 3}, {"\033[X", 3}, diff --git a/sys/isa/sio.c b/sys/isa/sio.c index 61cd485..b3a01b9 100644 --- a/sys/isa/sio.c +++ b/sys/isa/sio.c @@ -31,11 +31,10 @@ * SUCH DAMAGE. * * from: @(#)com.c 7.5 (Berkeley) 5/16/91 - * $Id: sio.c,v 1.125 1995/12/08 11:15:12 julian Exp $ + * $Id: sio.c,v 1.126 1995/12/08 23:20:44 phk Exp $ */ #include "sio.h" -#if NSIO > 0 /* * Serial driver, based on 386BSD-0.1 com driver. * Mostly rewritten to use pseudo-DMA. @@ -174,8 +173,6 @@ struct com_s { bool_t active_out; /* nonzero if the callout device is open */ u_char cfcr_image; /* copy of value written to CFCR */ u_char ftl; /* current rx fifo trigger level */ - u_char ftl_init; /* ftl_max for next open() */ - u_char ftl_max; /* maximum ftl for curent open() */ bool_t hasfifo; /* nonzero for 16550 UARTs */ bool_t loses_outints; /* nonzero if device loses output interrupts */ u_char mcr_image; /* copy of value written to MCR */ @@ -320,7 +317,6 @@ static struct cdevsw sio_cdevsw = static int comconsole = -1; static speed_t comdefaultrate = TTYDEF_SPEED; static u_int com_events; /* input chars + weighted output completions */ -static int commajor; static int sio_timeout; static int sio_timeouts_until_log; #if 0 /* XXX */ @@ -376,8 +372,8 @@ static struct kern_devconf kdc_sio[NSIO] = { { * PC-Card (PCMCIA) specific code. */ static int card_intr(struct pccard_dev *); /* Interrupt handler */ -void siounload(struct pccard_dev *); /* Disable driver */ -void siosuspend(struct pccard_dev *); /* Suspend driver */ +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 struct pccard_drv sio_info = @@ -398,7 +394,7 @@ static struct pccard_drv sio_info = * sioinit with first=0. This is called when the user suspends * the system, or the APM code suspends the system. */ -void +static void siosuspend(struct pccard_dev *dp) { printf("sio%d: suspending\n", dp->isahd.id_unit); @@ -451,12 +447,10 @@ sioinit(struct pccard_dev *dp, int first) * and ensure that any driver entry points such as * read and write do not hang. */ -void +static void siounload(struct pccard_dev *dp) { struct com_s *com; - struct tty *tp; - int s,unit,nowhere; com = com_addr(dp->isahd.id_unit); if (!com->iobase) { @@ -815,37 +809,60 @@ sioattach(isdp) goto determined_type; } } - outb(iobase + com_fifo, FIFO_ENABLE | FIFO_TRIGGER_14); + outb(iobase + com_fifo, FIFO_ENABLE | FIFO_RX_HIGH); DELAY(100); switch (inb(com->int_id_port) & IIR_FIFO_MASK) { - case FIFO_TRIGGER_1: + case FIFO_RX_LOW: printf(" 16450"); kdc_sio[unit].kdc_description = "Serial port: National 16450 or compatible"; break; - case FIFO_TRIGGER_4: + case FIFO_RX_MEDL: printf(" 16450?"); kdc_sio[unit].kdc_description = "Serial port: maybe National 16450"; break; - case FIFO_TRIGGER_8: + case FIFO_RX_MEDH: printf(" 16550?"); kdc_sio[unit].kdc_description = "Serial port: maybe National 16550"; break; - case FIFO_TRIGGER_14: - printf(" 16550A"); + case FIFO_RX_HIGH: if (COM_NOFIFO(isdp)) { printf(" fifo disabled"); kdc_sio[unit].kdc_description = "Serial port: National 16550A, FIFO disabled"; } else { com->hasfifo = TRUE; - com->ftl_init = FIFO_TRIGGER_14; com->tx_fifo_size = 16; kdc_sio[unit].kdc_description = "Serial port: National 16550A or compatible"; } + /* + * Check for the Startech ST16C650 chip. + * it has a shadow register under the com_iir, + * which can only be accessed when cfcr == 0xff + */ + { + u_char i, j; + + i = inb(iobase + com_iir); + outb(iobase + com_cfcr, 0xff); + outb(iobase + com_iir, 0x0); + outb(iobase + com_cfcr, CFCR_8BITS); + j = inb(iobase + com_iir); + outb(iobase + com_iir, i); + if (i != j) { + printf(" 16550A"); + } else { + com->tx_fifo_size = 32; + printf(" 16650"); + kdc_sio[unit].kdc_description = + "Serial port: Startech 16C650 or similar"; + } + if (!com->tx_fifo_size) + printf(" fifo disabled"); + } break; } outb(iobase + com_fifo, 0); @@ -867,7 +884,7 @@ determined_type: ; kdc_sio[unit].kdc_state = (unit == comconsole) ? DC_BUSY : DC_IDLE; #ifdef KGDB - if (kgdb_dev == makedev(commajor, unit)) { + if (kgdb_dev == makedev(CDEV_MAJOR, unit)) { if (unit == comconsole) kgdb_dev = -1; /* can't debug over console port */ else { @@ -1018,7 +1035,6 @@ open_top: tp->t_termios = mynor & CALLOUT_MASK ? com->it_out : com->it_in; (void)commctl(com, TIOCM_DTR | TIOCM_RTS, DMSET); - com->ftl_max = com->ftl_init; com->poll = com->no_irq; com->poll_output = com->loses_outints; ++com->wopeners; @@ -1045,8 +1061,7 @@ open_top: */ while (TRUE) { outb(iobase + com_fifo, - FIFO_RCV_RST | FIFO_XMT_RST - | FIFO_ENABLE | com->ftl); + FIFO_RCV_RST | FIFO_XMT_RST | com->ftl); DELAY(100); if (!(inb(com->line_status_port) & LSR_RXRDY)) break; @@ -1161,7 +1176,7 @@ comhardclose(com) outb(iobase + com_cfcr, com->cfcr_image &= ~CFCR_SBREAK); #ifdef KGDB /* do not disable interrupts or hang up if debugging */ - if (kgdb_dev != makedev(commajor, unit)) + if (kgdb_dev != makedev(CDEV_MAJOR, unit)) #endif { outb(iobase + com_ier, 0); @@ -1373,7 +1388,7 @@ siointr1(com) if (recv_data == FRAME_END && ( com->tp == NULL || !(com->tp->t_state & TS_ISOPEN)) - && kgdb_dev == makedev(commajor, unit)) { + && kgdb_dev == makedev(CDEV_MAJOR, unit)) { kgdb_connect(0); continue; } @@ -1882,10 +1897,8 @@ comparam(tp, t) * latencies are larger. */ com->ftl = t->c_ospeed <= 4800 - ? FIFO_TRIGGER_1 : FIFO_TRIGGER_14; - if (com->ftl > com->ftl_max) - com->ftl = com->ftl_max; - outb(iobase + com_fifo, FIFO_ENABLE | com->ftl); + ? 0 : FIFO_ENABLE | FIFO_RX_HIGH; + outb(iobase + com_fifo, com->ftl); } /* @@ -2252,30 +2265,6 @@ comwakeup(chan) log(LOG_ERR, "sio%d: %u more %s%s (total %lu)\n", unit, delta, error_desc[errnum], delta == 1 ? "" : "s", total); -#if 0 - /* - * XXX if we resurrect this then we should move - * the dropping of the ftl to somewhere with less - * latency. - */ - if (errnum == CE_OVERRUN && com->hasfifo - && com->ftl > FIFO_TRIGGER_1) { - static u_char ftl_in_bytes[] = - { 1, 4, 8, 14, }; - - com->ftl_init = FIFO_TRIGGER_8; -#define FIFO_TRIGGER_DELTA FIFO_TRIGGER_4 - com->ftl_max = - com->ftl -= FIFO_TRIGGER_DELTA; - outb(com->iobase + com_fifo, - FIFO_ENABLE | com->ftl); - log(LOG_DEBUG, - "sio%d: reduced fifo trigger level to %d\n", - unit, - ftl_in_bytes[com->ftl - / FIFO_TRIGGER_DELTA]); - } -#endif } } } @@ -2403,12 +2392,6 @@ siocnprobe(cp) { int unit; - /* locate the major number */ - /* XXX - should be elsewhere since KGDB uses it */ - for (commajor = 0; commajor < nchrdev; commajor++) - if (cdevsw[commajor].d_open == sioopen) - break; - /* XXX: ick */ unit = DEV_TO_UNIT(CONUNIT); siocniobase = CONADDR; @@ -2416,7 +2399,7 @@ siocnprobe(cp) /* make sure hardware exists? XXX */ /* initialize required fields */ - cp->cn_dev = makedev(commajor, unit); + cp->cn_dev = makedev(CDEV_MAJOR, unit); #ifdef COMCONSOLE cp->cn_pri = CN_REMOTE; /* Force a serial port console */ #else @@ -2625,4 +2608,3 @@ static void sio_drvinit(void *unused) SYSINIT(siodev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,sio_drvinit,NULL) -#endif /* NSIO > 0 */ diff --git a/sys/isa/sioreg.h b/sys/isa/sioreg.h index d43bcdf..bc77dd6 100644 --- a/sys/isa/sioreg.h +++ b/sys/isa/sioreg.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)comreg.h 7.2 (Berkeley) 5/9/91 - * $Id: sioreg.h,v 1.2 1993/10/16 19:17:18 rgrimes Exp $ + * $Id: sioreg.h,v 1.3 1995/01/20 07:34:18 wpaul Exp $ */ @@ -59,10 +59,10 @@ #define FIFO_RCV_RST 0x02 #define FIFO_XMT_RST 0x04 #define FIFO_DMA_MODE 0x08 -#define FIFO_TRIGGER_1 0x00 -#define FIFO_TRIGGER_4 0x40 -#define FIFO_TRIGGER_8 0x80 -#define FIFO_TRIGGER_14 0xc0 +#define FIFO_RX_LOW 0x00 +#define FIFO_RX_MEDL 0x40 +#define FIFO_RX_MEDH 0x80 +#define FIFO_RX_HIGH 0xc0 /* character format control register */ #define CFCR_DLAB 0x80 diff --git a/sys/isa/syscons.c b/sys/isa/syscons.c index db7c92d..6c3634d 100644 --- a/sys/isa/syscons.c +++ b/sys/isa/syscons.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: syscons.c,v 1.134 1995/12/07 12:46:08 davidg Exp $ + * $Id: syscons.c,v 1.135 1995/12/08 11:15:28 julian Exp $ */ #include "sc.h" @@ -109,7 +109,6 @@ static const u_int n_fkey_tab = sizeof(fkey_tab) / sizeof(*fkey_tab); static int delayed_next_scr = FALSE; static long scrn_blank_time = 0; /* screen saver timeout value */ int scrn_blanked = FALSE; /* screen saver active flag */ -static int scrn_saver = 0; /* screen saver routine */ static long scrn_time_stamp; u_char scr_map[256]; static char *video_mode_ptr = NULL; @@ -126,10 +125,15 @@ static u_short mouse_or_mask[16] = { 0x0c00, 0x0c00, 0x0600, 0x0600, 0x0000, 0x0000, 0x0000, 0x0000 }; -extern void none_saver(int blank); -void none_saver(int blank) { } +static void none_saver(int blank) { } + void (*current_saver) __P((int blank)) = none_saver; +static int scattach(struct isa_device *dev); +static int scparam(struct tty *tp, struct termios *t); +static int scprobe(struct isa_device *dev); +static void scstart(struct tty *tp); + /* OS specific stuff */ #ifdef not_yet_done #define VIRTUAL_TTY(x) (sccons[x] = ttymalloc(sccons[x])) @@ -138,8 +142,7 @@ struct tty *sccons[MAXCONS+1]; #else #define VIRTUAL_TTY(x) &sccons[x] #define CONSOLE_TTY &sccons[MAXCONS] -struct tty sccons[MAXCONS+1]; -int nsccons = MAXCONS+1; +static struct tty sccons[MAXCONS+1]; #endif #define MONO_BUF pa_to_va(0xB0000) #define CGA_BUF pa_to_va(0xB8000) @@ -195,7 +198,7 @@ mask2attr(struct term_stat *term) return attr; } -int +static int scprobe(struct isa_device *dev) { int i, retries = 5; @@ -284,7 +287,7 @@ scresume(void *dummy) } #endif -int +static int scattach(struct isa_device *dev) { scr_stat *scp; @@ -528,7 +531,7 @@ scintr(int unit) } } -int +static int scparam(struct tty *tp, struct termios *t) { tp->t_ispeed = t->c_ispeed; @@ -1147,7 +1150,7 @@ set_mouse_pos: return(ENOTTY); } -void +static void scstart(struct tty *tp) { struct clist *rbp; diff --git a/sys/isa/syscons.h b/sys/isa/syscons.h index ab928ac..6c895e2 100644 --- a/sys/isa/syscons.h +++ b/sys/isa/syscons.h @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: syscons.h,v 1.12 1995/11/04 17:07:52 bde Exp $ + * $Id: syscons.h,v 1.13 1995/11/28 00:17:32 ache Exp $ */ #ifndef _I386_ISA_SYSCONS_H_ @@ -177,10 +177,6 @@ typedef struct default_attr { } default_attr; /* function prototypes */ -int scprobe(struct isa_device *dev); -int scattach(struct isa_device *dev); -int scparam(struct tty *tp, struct termios *t); -void scstart(struct tty *tp); static void scinit(void); static u_int scgetc(int noblock); static scr_stat *get_scr_stat(dev_t dev); |