From 428e5e3f08e35e52dafd27c30a256f5d254148db Mon Sep 17 00:00:00 2001 From: nyan Date: Wed, 13 Apr 2005 13:26:48 +0000 Subject: - Remove ifdef PC98. - Reduce diffs from i386. --- sys/pc98/cbus/cbus_dma.c | 190 +++++++-------------------------------------- sys/pc98/cbus/olpt.c | 167 +-------------------------------------- sys/pc98/cbus/scterm-sck.c | 2 - 3 files changed, 30 insertions(+), 329 deletions(-) (limited to 'sys/pc98/cbus') diff --git a/sys/pc98/cbus/cbus_dma.c b/sys/pc98/cbus/cbus_dma.c index 82e02ee..5bf2c88 100644 --- a/sys/pc98/cbus/cbus_dma.c +++ b/sys/pc98/cbus/cbus_dma.c @@ -30,9 +30,11 @@ * SUCH DAMAGE. * * from: @(#)isa.c 7.2 (Berkeley) 5/13/91 - * $FreeBSD$ */ +#include +__FBSDID("$FreeBSD$"); + /* * code to manage AT bus * @@ -43,9 +45,7 @@ * isa_dmastart() */ -#ifdef PC98 #include "opt_pc98.h" -#endif #include #include @@ -56,17 +56,11 @@ #include #include #include -#ifdef PC98 #include -#endif #include #include #include -#ifdef PC98 #include -#else -#include -#endif #include #include @@ -81,30 +75,17 @@ static int isa_dmarangecheck(caddr_t va, u_int length, int chan); -#ifdef PC98 static caddr_t dma_bouncebuf[4]; static u_int dma_bouncebufsize[4]; -#else -static caddr_t dma_bouncebuf[8]; -static u_int dma_bouncebufsize[8]; -#endif static u_int8_t dma_bounced = 0; static u_int8_t dma_busy = 0; /* Used in isa_dmastart() */ static u_int8_t dma_inuse = 0; /* User for acquire/release */ static u_int8_t dma_auto_mode = 0; -#ifdef PC98 #define VALID_DMA_MASK (3) -#else -#define VALID_DMA_MASK (7) -#endif /* high byte of address is stored in this port for i-th dma channel */ -#ifdef PC98 static int dmapageport[4] = { 0x27, 0x21, 0x23, 0x25 }; -#else -static int dmapageport[8] = { 0x87, 0x83, 0x81, 0x82, 0x8f, 0x8b, 0x89, 0x8a }; -#endif /* * Setup a DMA channel's bounce buffer. @@ -114,27 +95,12 @@ isa_dma_init(int chan, u_int bouncebufsize, int flag) { void *buf; -#ifndef PC98 - /* - * If a DMA channel is shared, both drivers have to call isa_dma_init - * since they don't know that the other driver will do it. - * Just return if we're already set up good. - * XXX: this only works if they agree on the bouncebuf size. This - * XXX: is typically the case since they are multiple instances of - * XXX: the same driver. - */ - if (dma_bouncebuf[chan] != NULL) - return (0); -#endif - #ifdef DIAGNOSTIC if (chan & ~VALID_DMA_MASK) panic("isa_dma_init: channel out of range"); -#ifdef PC98 if (dma_bouncebuf[chan] != NULL) panic("isa_dma_init: impossible request"); #endif -#endif dma_bouncebufsize[chan] = bouncebufsize; @@ -208,31 +174,6 @@ isa_dma_release(chan) dma_auto_mode &= ~(1 << chan); } -#ifndef PC98 -/* - * isa_dmacascade(): program 8237 DMA controller channel to accept - * external dma control by a board. - */ -void -isa_dmacascade(chan) - int chan; -{ -#ifdef DIAGNOSTIC - if (chan & ~VALID_DMA_MASK) - panic("isa_dmacascade: channel out of range"); -#endif - - /* set dma channel mode, and set dma channel mode */ - if ((chan & 4) == 0) { - outb(DMA1_MODE, DMA37MD_CASCADE | chan); - outb(DMA1_SMSK, chan); - } else { - outb(DMA2_MODE, DMA37MD_CASCADE | (chan & 3)); - outb(DMA2_SMSK, chan & 3); - } -} -#endif - /* * isa_dmastart(): program 8237 DMA controller channel, avoid page alignment * problems by using a bounce buffer. @@ -240,7 +181,7 @@ isa_dmacascade(chan) void isa_dmastart(int flags, caddr_t addr, u_int nbytes, int chan) { - vm_offset_t phys; + vm_paddr_t phys; int waport; caddr_t newaddr; @@ -292,100 +233,48 @@ isa_dmastart(int flags, caddr_t addr, u_int nbytes, int chan) dma_auto_mode &= ~(1 << chan); } -#ifdef PC98 if (need_pre_dma_flush) wbinvd(); /* wbinvd (WB cache flush) */ -#endif -#ifndef PC98 - if ((chan & 4) == 0) { - /* - * Program one of DMA channels 0..3. These are - * byte mode channels. - */ -#endif - /* set dma channel mode, and reset address ff */ + /* set dma channel mode, and reset address ff */ - /* If ISADMA_RAW flag is set, then use autoinitialise mode */ - if (flags & ISADMA_RAW) { - if (flags & ISADMA_READ) + /* If ISADMA_RAW flag is set, then use autoinitialise mode */ + if (flags & ISADMA_RAW) { + if (flags & ISADMA_READ) outb(DMA1_MODE, DMA37MD_AUTO|DMA37MD_WRITE|chan); - else - outb(DMA1_MODE, DMA37MD_AUTO|DMA37MD_READ|chan); - } else + outb(DMA1_MODE, DMA37MD_AUTO|DMA37MD_READ|chan); + } else { if (flags & ISADMA_READ) outb(DMA1_MODE, DMA37MD_SINGLE|DMA37MD_WRITE|chan); else outb(DMA1_MODE, DMA37MD_SINGLE|DMA37MD_READ|chan); - outb(DMA1_FFC, 0); - - /* send start address */ - waport = DMA1_CHN(chan); - outb(waport, phys); - outb(waport, phys>>8); - outb(dmapageport[chan], phys>>16); - - /* send count */ -#ifdef PC98 - outb(waport + 2, --nbytes); - outb(waport + 2, nbytes>>8); -#else - outb(waport + 1, --nbytes); - outb(waport + 1, nbytes>>8); -#endif - - /* unmask channel */ - outb(DMA1_SMSK, chan); -#ifndef PC98 - } else { - /* - * Program one of DMA channels 4..7. These are - * word mode channels. - */ - /* set dma channel mode, and reset address ff */ - - /* If ISADMA_RAW flag is set, then use autoinitialise mode */ - if (flags & ISADMA_RAW) { - if (flags & ISADMA_READ) - outb(DMA2_MODE, DMA37MD_AUTO|DMA37MD_WRITE|(chan&3)); - else - outb(DMA2_MODE, DMA37MD_AUTO|DMA37MD_READ|(chan&3)); - } - else - if (flags & ISADMA_READ) - outb(DMA2_MODE, DMA37MD_SINGLE|DMA37MD_WRITE|(chan&3)); - else - outb(DMA2_MODE, DMA37MD_SINGLE|DMA37MD_READ|(chan&3)); - outb(DMA2_FFC, 0); - - /* send start address */ - waport = DMA2_CHN(chan - 4); - outb(waport, phys>>1); - outb(waport, phys>>9); - outb(dmapageport[chan], phys>>16); - - /* send count */ - nbytes >>= 1; - outb(waport + 2, --nbytes); - outb(waport + 2, nbytes>>8); - - /* unmask channel */ - outb(DMA2_SMSK, chan & 3); } -#endif + outb(DMA1_FFC, 0); + + /* send start address */ + waport = DMA1_CHN(chan); + outb(waport, phys); + outb(waport, phys>>8); + outb(dmapageport[chan], phys>>16); + + /* send count */ + outb(waport + 2, --nbytes); + outb(waport + 2, nbytes>>8); + + /* unmask channel */ + outb(DMA1_SMSK, chan); } void isa_dmadone(int flags, caddr_t addr, int nbytes, int chan) { -#ifdef PC98 + if (flags & ISADMA_READ) { /* cache flush only after reading 92/12/9 by A.Kojima */ if (need_post_dma_flush) invd(); } -#endif #ifdef DIAGNOSTIC if (chan & ~VALID_DMA_MASK) @@ -399,13 +288,8 @@ isa_dmadone(int flags, caddr_t addr, int nbytes, int chan) (dma_auto_mode & (1 << chan)) == 0 ) printf("isa_dmadone: channel %d not busy\n", chan); -#ifdef PC98 if ((dma_auto_mode & (1 << chan)) == 0) outb(DMA1_SMSK, (chan & 3) | 4); -#else - if ((dma_auto_mode & (1 << chan)) == 0) - outb(chan & 4 ? DMA2_SMSK : DMA1_SMSK, (chan & 3) | 4); -#endif if (dma_bounced & (1 << chan)) { /* copy bounce buffer on read */ @@ -427,7 +311,8 @@ isa_dmadone(int flags, caddr_t addr, int nbytes, int chan) static int isa_dmarangecheck(caddr_t va, u_int length, int chan) { - vm_offset_t phys, priorpage = 0, endva; + vm_paddr_t phys, priorpage = 0; + vm_offset_t endva; u_int dma_pgmsk = (chan & 4) ? ~(128*1024-1) : ~(64*1024-1); GIANT_REQUIRED; @@ -507,18 +392,8 @@ isa_dmastatus(int chan) printf("chan %d not busy\n", chan); return -2 ; } -#ifdef PC98 ffport = DMA1_FFC; waport = DMA1_CHN(chan) + 2; -#else - if (chan < 4) { /* low DMA controller */ - ffport = DMA1_FFC; - waport = DMA1_CHN(chan) + 1; - } else { /* high DMA controller */ - ffport = DMA2_FFC; - waport = DMA2_CHN(chan - 4) + 2; - } -#endif disable_intr(); /* no interrupts Mr Jones! */ outb(ffport, 0); /* clear register LSB flipflop */ @@ -570,13 +445,9 @@ isa_dmastop(int chan) return -2 ; } - if ((chan & 4) == 0) { + if ((chan & 4) == 0) outb(DMA1_SMSK, (chan & 3) | 4 /* disable mask */); - } else { -#ifndef PC98 - outb(DMA2_SMSK, (chan & 3) | 4 /* disable mask */); -#endif - } + return(isa_dmastatus(chan)); } @@ -624,6 +495,3 @@ static driver_t atdma_driver = { static devclass_t atdma_devclass; DRIVER_MODULE(atdma, isa, atdma_driver, atdma_devclass, 0, 0); -#ifndef PC98 -DRIVER_MODULE(atdma, acpi, atdma_driver, atdma_devclass, 0, 0); -#endif diff --git a/sys/pc98/cbus/olpt.c b/sys/pc98/cbus/olpt.c index 5172c74..494eb04 100644 --- a/sys/pc98/cbus/olpt.c +++ b/sys/pc98/cbus/olpt.c @@ -127,14 +127,6 @@ #define LPPRI (PZERO+8) #define BUFSIZE 1024 -#ifndef PC98 -/* BIOS printer list - used by BIOS probe*/ -#define BIOS_LPT_PORTS 0x408 -#define BIOS_PORTS (short *)(KERNBASE+BIOS_LPT_PORTS) -#define BIOS_MAX_LPT 4 -#endif - - #ifndef DEBUG #define lprintf(args) #else @@ -193,13 +185,7 @@ struct lpt_softc { /* Printer Ready condition - from lpa.c */ /* Only used in polling code */ -#ifdef PC98 #define NOT_READY(x) ((inb(x) & LPS_NBSY) != LPS_NBSY) -#else /* IBM-PC */ -#define LPS_INVERT (LPS_NBSY | LPS_NACK | LPS_SEL | LPS_NERR) -#define LPS_MASK (LPS_NBSY | LPS_NACK | LPS_OUT | LPS_SEL | LPS_NERR) -#define NOT_READY(x) ((inb(x)^LPS_INVERT)&LPS_MASK) -#endif #define MAX_SLEEP (hz*5) /* Timeout while waiting for device ready */ #define MAX_SPIN 20 /* Max delay for device ready in usecs */ @@ -242,29 +228,6 @@ static struct cdevsw lpt_cdevsw = { static bus_addr_t lpt_iat[] = {0, 2, 4, 6}; -#ifndef PC98 -/* - * Internal routine to lptprobe to do port tests of one byte value - */ -static int -lpt_port_test (int port, u_char data, u_char mask) -{ - int temp, timeout; - - data = data & mask; - outb(port, data); - timeout = 10000; - do { - DELAY(10); - temp = inb(port) & mask; - } - while (temp != data && --timeout); - lprintf(("Port 0x%x\tout=%x\tin=%x\ttout=%d\n", - port, data, temp, timeout)); - return (temp == data); -} -#endif /* PC98 */ - /* * New lpt port probe Geoff Rehmet - Rhodes University - 14/2/94 * Based partially on Rod Grimes' printer probe @@ -313,7 +276,6 @@ lpt_port_test (int port, u_char data, u_char mask) int lpt_probe(device_t dev) { -#ifdef PC98 #define PC98_OLD_LPT 0x40 #define PC98_IEEE_1284_FUNCTION 0x149 int rid; @@ -349,55 +311,6 @@ lpt_probe(device_t dev) bus_release_resource(dev, SYS_RES_IOPORT, rid, res); return 0; -#else - int port; - static short next_bios_lpt = 0; - int status; - static u_char testbyte[18] = { - 0x55, /* alternating zeros */ - 0xaa, /* alternating ones */ - 0xfe, 0xfd, 0xfb, 0xf7, - 0xef, 0xdf, 0xbf, 0x7f, /* walking zero */ - 0x01, 0x02, 0x04, 0x08, - 0x10, 0x20, 0x40, 0x80 /* walking one */ - }; - int i; - - /* - * Make sure there is some way for lptopen to see that - * the port is not configured - * This 0 will remain if the port isn't attached - */ - (lpt_sc + dvp->id_unit)->sc_port = 0; - - status = IO_LPTSIZE; - /* If port not specified, use bios list */ - if(dvp->id_iobase < 0) { /* port? */ - if((next_bios_lpt < BIOS_MAX_LPT) && - (*(BIOS_PORTS+next_bios_lpt) != 0) ) { - dvp->id_iobase = *(BIOS_PORTS+next_bios_lpt++); - goto end_probe; - } else - return (0); - } - - /* Port was explicitly specified */ - /* This allows probing of ports unknown to the BIOS */ - port = dvp->id_iobase + lpt_data; - for (i = 0; i < 18; i++) { - if (!lpt_port_test(port, testbyte[i], 0xff)) { - status = 0; - goto end_probe; - } - } - -end_probe: - /* write 0's to control and data ports */ - outb(dvp->id_iobase+lpt_data, 0); - outb(dvp->id_iobase+lpt_control, 0); - - return (status); -#endif } /* XXX Todo - try and detect if interrupt is working */ @@ -419,15 +332,12 @@ lpt_attach(device_t dev) sc->sc_port = rman_get_start(sc->res_port); sc->sc_primed = 0; /* not primed yet */ -#ifdef PC98 + outb(sc->sc_port+lpt_pstb_ctrl, LPC_DIS_PSTB); /* PSTB disable */ outb(sc->sc_port+lpt_control, LPC_MODE8255); /* 8255 mode set */ outb(sc->sc_port+lpt_control, LPC_NIRQ8); /* IRQ8 inactive */ outb(sc->sc_port+lpt_control, LPC_NPSTB); /* PSTB inactive */ outb(sc->sc_port+lpt_pstb_ctrl, LPC_EN_PSTB); /* PSTB enable */ -#else - outb(sc->sc_port+lpt_control, LPC_NINIT); -#endif sc->sc_irq = 0; if (isa_get_irq(dev) != -1) { @@ -470,11 +380,7 @@ lptopen (struct cdev *dev, int flags, int fmt, struct thread *td) { struct lpt_softc *sc; int s; -#ifdef PC98 int port; -#else - int trys, port; -#endif sc = devclass_get_softc(olpt_devclass, LPTUNIT(minor(dev))); if (sc->sc_port == 0) @@ -505,51 +411,6 @@ lptopen (struct cdev *dev, int flags, int fmt, struct thread *td) sc->sc_irq &= ~LP_USE_IRQ; /* init printer */ -#ifndef PC98 - if ((sc->sc_flags & LP_NO_PRIME) == 0) { - if((sc->sc_flags & LP_PRIMEOPEN) || sc->sc_primed == 0) { - outb(port+lpt_control, 0); - sc->sc_primed++; - DELAY(500); - } - } - - outb (port+lpt_control, LPC_SEL|LPC_NINIT); - - /* wait till ready (printer running diagnostics) */ - trys = 0; - do { - /* ran out of waiting for the printer */ - if (trys++ >= LPINITRDY*4) { - splx(s); - sc->sc_state = 0; - lprintf(("status %x\n", inb(port+lpt_status))); - return (EBUSY); - } - - /* wait 1/4 second, give up if we get a signal */ - if (tsleep (sc, LPPRI|PCATCH, "lptinit", hz/4) != - EWOULDBLOCK) { - sc->sc_state = 0; - splx(s); - return (EBUSY); - } - - /* is printer online and ready for output */ - } while ((inb(port+lpt_status) & (LPS_SEL|LPS_OUT|LPS_NBSY|LPS_NERR)) != - (LPS_SEL|LPS_NBSY|LPS_NERR)); - - sc->sc_control = LPC_SEL|LPC_NINIT; - if (sc->sc_flags & LP_AUTOLF) - sc->sc_control |= LPC_AUTOL; - - /* enable interrupt if interrupt-driven */ - if (sc->sc_irq & LP_USE_IRQ) - sc->sc_control |= LPC_ENA; - - outb(port+lpt_control, sc->sc_control); -#endif - sc->sc_state = OPEN; sc->sc_inbuf = malloc(BUFSIZE, M_DEVBUF, M_WAITOK); sc->sc_xfercnt = 0; @@ -608,31 +469,12 @@ static int lptclose(struct cdev *dev, int flags, int fmt, struct thread *td) { struct lpt_softc *sc; -#ifndef PC98 - int port; -#endif sc = devclass_get_softc(olpt_devclass, LPTUNIT(minor(dev))); if(sc->sc_flags & LP_BYPASS) goto end_close; -#ifndef PC98 - port = sc->sc_port; -#endif sc->sc_state &= ~OPEN; - -#ifndef PC98 - /* if the last write was interrupted, don't complete it */ - if((!(sc->sc_state & INTERRUPTED)) && (sc->sc_irq & LP_USE_IRQ)) - while ((inb(port+lpt_status) & (LPS_SEL|LPS_OUT|LPS_NBSY|LPS_NERR)) != - (LPS_SEL|LPS_NBSY|LPS_NERR) || sc->sc_xfercnt) - /* wait 1/4 second, give up if we get a signal */ - if (tsleep (sc, LPPRI|PCATCH, - "lpclose", hz) != EWOULDBLOCK) - break; - - outb(sc->sc_port+lpt_control, LPC_NINIT); -#endif free(sc->sc_inbuf, M_DEVBUF); end_close: @@ -695,17 +537,10 @@ pushbytes(struct lpt_softc * sc) /* output data */ outb(port+lpt_data, ch); -#ifdef PC98 DELAY(1); outb(port+lpt_control, LPC_PSTB); DELAY(1); outb(port+lpt_control, LPC_NPSTB); -#else - /* strobe */ - outb(port+lpt_control, sc->sc_control|LPC_STB); - outb(port+lpt_control, sc->sc_control); -#endif - } return(0); } diff --git a/sys/pc98/cbus/scterm-sck.c b/sys/pc98/cbus/scterm-sck.c index b1e006a..7029c07 100644 --- a/sys/pc98/cbus/scterm-sck.c +++ b/sys/pc98/cbus/scterm-sck.c @@ -1080,7 +1080,6 @@ ascii_end: scp->xpos = 0; break; -#ifdef PC98 case 0x0e: /* ^N */ tcp->kanji_type = KTYPE_JKANA; tcp->esc = 0; @@ -1092,7 +1091,6 @@ ascii_end: tcp->esc = 0; tcp->kanji_1st_char = 0; break; -#endif /* PC98 */ case 0x1b: /* start escape sequence */ tcp->esc = 1; -- cgit v1.1