diff options
author | nyan <nyan@FreeBSD.org> | 2000-07-11 12:50:34 +0000 |
---|---|---|
committer | nyan <nyan@FreeBSD.org> | 2000-07-11 12:50:34 +0000 |
commit | b5738d479e0eaad924b34c5d0b2d67227187006f (patch) | |
tree | cc0ed6121e6e56a5498b37cea5f448af592d36c6 /sys/pc98 | |
parent | 7716c5370ad4c724650bb6def35750d561bc11d2 (diff) | |
download | FreeBSD-src-b5738d479e0eaad924b34c5d0b2d67227187006f.zip FreeBSD-src-b5738d479e0eaad924b34c5d0b2d67227187006f.tar.gz |
Merge from the following changes.
sys/conf/files.i386 1.321
sys/dev/syscons/syscons.c 1.343
sys/i386/isa/spkr.c 1.46
sys/isa/fd.c 1.183 and 1.185
sys/isa/syscons_isa.c 1.14
sys/isa/vga_isa.c 1.18
Diffstat (limited to 'sys/pc98')
-rw-r--r-- | sys/pc98/cbus/fdc.c | 42 | ||||
-rw-r--r-- | sys/pc98/cbus/gdc.c | 40 | ||||
-rw-r--r-- | sys/pc98/cbus/syscons_cbus.c | 37 | ||||
-rw-r--r-- | sys/pc98/pc98/fd.c | 42 | ||||
-rw-r--r-- | sys/pc98/pc98/pc98gdc.c | 40 | ||||
-rw-r--r-- | sys/pc98/pc98/spkr.c | 11 | ||||
-rw-r--r-- | sys/pc98/pc98/syscons.c | 4 | ||||
-rw-r--r-- | sys/pc98/pc98/syscons_pc98.c | 37 |
8 files changed, 136 insertions, 117 deletions
diff --git a/sys/pc98/cbus/fdc.c b/sys/pc98/cbus/fdc.c index 76ae815..beb2c98 100644 --- a/sys/pc98/cbus/fdc.c +++ b/sys/pc98/cbus/fdc.c @@ -58,7 +58,6 @@ #include <sys/systm.h> #include <sys/kernel.h> #include <sys/bio.h> -#include <sys/buf.h> #include <sys/bus.h> #include <sys/conf.h> #include <sys/disklabel.h> @@ -846,7 +845,7 @@ static struct isa_pnp_id fdc_ids[] = { }; static int -fdc_read_ivar(device_t dev, device_t child, int which, u_long *result) +fdc_read_ivar(device_t dev, device_t child, int which, uintptr_t *result) { struct fdc_ivars *ivars = device_get_ivars(child); @@ -2627,6 +2626,12 @@ retrier(struct fdc_data *fdc) return (1); } +static void +fdbiodone(struct bio *bp) +{ + wakeup(bp); +} + static int fdformat(dev, finfo, p) dev_t dev; @@ -2636,7 +2641,7 @@ fdformat(dev, finfo, p) fdu_t fdu; fd_p fd; - struct buf *bp; + struct bio *bp; int rv = 0, s; size_t fdblk; @@ -2645,36 +2650,34 @@ fdformat(dev, finfo, p) fdblk = 128 << fd->ft->secsize; /* set up a buffer header for fdstrategy() */ - bp = (struct buf *)malloc(sizeof(struct bio), M_TEMP, M_NOWAIT); + bp = (struct bio *)malloc(sizeof(struct bio), M_TEMP, M_NOWAIT); if(bp == 0) - return ENOBUFS; + return ENOMEM; /* * keep the process from being swapped */ PHOLD(p); - bzero((void *)bp, sizeof(struct buf)); - BUF_LOCKINIT(bp); - BUF_LOCK(bp, LK_EXCLUSIVE); - bp->b_flags = B_PHYS; - bp->b_iocmd = BIO_FORMAT; + bzero((void *)bp, sizeof(*bp)); + bp->bio_cmd = BIO_FORMAT; /* * calculate a fake blkno, so fdstrategy() would initiate a * seek to the requested cylinder */ - bp->b_blkno = (finfo->cyl * (fd->ft->sectrac * fd->ft->heads) + bp->bio_blkno = (finfo->cyl * (fd->ft->sectrac * fd->ft->heads) + finfo->head * fd->ft->sectrac) * fdblk / DEV_BSIZE; - bp->b_bcount = sizeof(struct fd_idfield_data) * finfo->fd_formb_nsecs; - bp->b_data = (caddr_t)finfo; + bp->bio_bcount = sizeof(struct fd_idfield_data) * finfo->fd_formb_nsecs; + bp->bio_data = (caddr_t)finfo; /* now do the format */ - bp->b_dev = dev; - DEV_STRATEGY(bp, 0); + bp->bio_dev = dev; + bp->bio_done = fdbiodone; + fdstrategy(bp); /* ...and wait for it to complete */ s = splbio(); - while(!(bp->b_flags & B_DONE)) { + while(!(bp->bio_flags & BIO_DONE)) { rv = tsleep((caddr_t)bp, PRIBIO, "fdform", 20 * hz); if (rv == EWOULDBLOCK) break; @@ -2685,16 +2688,13 @@ fdformat(dev, finfo, p) /* timed out */ rv = EIO; device_unbusy(fd->dev); - bufdone(bp); } - if (bp->b_flags & BIO_ERROR) - rv = bp->b_error; + if (bp->bio_flags & BIO_ERROR) + rv = bp->bio_error; /* * allow the process to be swapped */ PRELE(p); - BUF_UNLOCK(bp); - BUF_LOCKFREE(bp); free(bp, M_TEMP); return rv; } diff --git a/sys/pc98/cbus/gdc.c b/sys/pc98/cbus/gdc.c index a1522e7..a3f8afb 100644 --- a/sys/pc98/cbus/gdc.c +++ b/sys/pc98/cbus/gdc.c @@ -70,23 +70,6 @@ typedef struct gdc_softc { static devclass_t gdc_devclass; -static int gdcprobe(device_t dev); -static int gdc_attach(device_t dev); - -static device_method_t gdc_methods[] = { - DEVMETHOD(device_probe, gdcprobe), - DEVMETHOD(device_attach, gdc_attach), - { 0, 0 } -}; - -static driver_t gdcdriver = { - DRIVER_NAME, - gdc_methods, - sizeof(gdc_softc_t), -}; - -DRIVER_MODULE(gdc, isa, gdcdriver, gdc_devclass, 0, 0); - static int gdc_probe_unit(int unit, gdc_softc_t *sc, int flags); static int gdc_attach_unit(int unit, gdc_softc_t *sc, int flags); @@ -118,8 +101,14 @@ static struct cdevsw gdc_cdevsw = { #endif /* FB_INSTALL_CDEV */ +static void +gdc_identify(driver_t *driver, device_t parent) +{ + BUS_ADD_CHILD(parent, ISA_ORDER_SPECULATIVE, DRIVER_NAME, 0); +} + static int -gdcprobe(device_t dev) +gdc_probe(device_t dev) { gdc_softc_t *sc; @@ -244,6 +233,21 @@ gdcmmap(dev_t dev, vm_offset_t offset, int prot) #endif /* FB_INSTALL_CDEV */ +static device_method_t gdc_methods[] = { + DEVMETHOD(device_identify, gdc_identify), + DEVMETHOD(device_probe, gdc_probe), + DEVMETHOD(device_attach, gdc_attach), + { 0, 0 } +}; + +static driver_t gdcdriver = { + DRIVER_NAME, + gdc_methods, + sizeof(gdc_softc_t), +}; + +DRIVER_MODULE(gdc, isa, gdcdriver, gdc_devclass, 0, 0); + /* LOW-LEVEL */ #include <machine/clock.h> diff --git a/sys/pc98/cbus/syscons_cbus.c b/sys/pc98/cbus/syscons_cbus.c index 28f26d4..c461b0a 100644 --- a/sys/pc98/cbus/syscons_cbus.c +++ b/sys/pc98/cbus/syscons_cbus.c @@ -49,25 +49,14 @@ static devclass_t sc_devclass; -static int scprobe(device_t dev); -static int scattach(device_t dev); -static int scresume(device_t dev); - -static device_method_t sc_methods[] = { - DEVMETHOD(device_probe, scprobe), - DEVMETHOD(device_attach, scattach), - DEVMETHOD(device_resume, scresume), - { 0, 0 } -}; - -static driver_t sc_driver = { - SC_DRIVER_NAME, - sc_methods, - sizeof(sc_softc_t), -}; - static sc_softc_t main_softc; +static void +scidentify (driver_t *driver, device_t parent) +{ + BUS_ADD_CHILD(parent, ISA_ORDER_SPECULATIVE, "sc", 0); +} + static int scprobe(device_t dev) { @@ -212,4 +201,18 @@ sc_tone(int herz) return 0; } +static device_method_t sc_methods[] = { + DEVMETHOD(device_identify, scidentify), + DEVMETHOD(device_probe, scprobe), + DEVMETHOD(device_attach, scattach), + DEVMETHOD(device_resume, scresume), + { 0, 0 } +}; + +static driver_t sc_driver = { + SC_DRIVER_NAME, + sc_methods, + sizeof(sc_softc_t), +}; + DRIVER_MODULE(sc, isa, sc_driver, sc_devclass, 0, 0); diff --git a/sys/pc98/pc98/fd.c b/sys/pc98/pc98/fd.c index 76ae815..beb2c98 100644 --- a/sys/pc98/pc98/fd.c +++ b/sys/pc98/pc98/fd.c @@ -58,7 +58,6 @@ #include <sys/systm.h> #include <sys/kernel.h> #include <sys/bio.h> -#include <sys/buf.h> #include <sys/bus.h> #include <sys/conf.h> #include <sys/disklabel.h> @@ -846,7 +845,7 @@ static struct isa_pnp_id fdc_ids[] = { }; static int -fdc_read_ivar(device_t dev, device_t child, int which, u_long *result) +fdc_read_ivar(device_t dev, device_t child, int which, uintptr_t *result) { struct fdc_ivars *ivars = device_get_ivars(child); @@ -2627,6 +2626,12 @@ retrier(struct fdc_data *fdc) return (1); } +static void +fdbiodone(struct bio *bp) +{ + wakeup(bp); +} + static int fdformat(dev, finfo, p) dev_t dev; @@ -2636,7 +2641,7 @@ fdformat(dev, finfo, p) fdu_t fdu; fd_p fd; - struct buf *bp; + struct bio *bp; int rv = 0, s; size_t fdblk; @@ -2645,36 +2650,34 @@ fdformat(dev, finfo, p) fdblk = 128 << fd->ft->secsize; /* set up a buffer header for fdstrategy() */ - bp = (struct buf *)malloc(sizeof(struct bio), M_TEMP, M_NOWAIT); + bp = (struct bio *)malloc(sizeof(struct bio), M_TEMP, M_NOWAIT); if(bp == 0) - return ENOBUFS; + return ENOMEM; /* * keep the process from being swapped */ PHOLD(p); - bzero((void *)bp, sizeof(struct buf)); - BUF_LOCKINIT(bp); - BUF_LOCK(bp, LK_EXCLUSIVE); - bp->b_flags = B_PHYS; - bp->b_iocmd = BIO_FORMAT; + bzero((void *)bp, sizeof(*bp)); + bp->bio_cmd = BIO_FORMAT; /* * calculate a fake blkno, so fdstrategy() would initiate a * seek to the requested cylinder */ - bp->b_blkno = (finfo->cyl * (fd->ft->sectrac * fd->ft->heads) + bp->bio_blkno = (finfo->cyl * (fd->ft->sectrac * fd->ft->heads) + finfo->head * fd->ft->sectrac) * fdblk / DEV_BSIZE; - bp->b_bcount = sizeof(struct fd_idfield_data) * finfo->fd_formb_nsecs; - bp->b_data = (caddr_t)finfo; + bp->bio_bcount = sizeof(struct fd_idfield_data) * finfo->fd_formb_nsecs; + bp->bio_data = (caddr_t)finfo; /* now do the format */ - bp->b_dev = dev; - DEV_STRATEGY(bp, 0); + bp->bio_dev = dev; + bp->bio_done = fdbiodone; + fdstrategy(bp); /* ...and wait for it to complete */ s = splbio(); - while(!(bp->b_flags & B_DONE)) { + while(!(bp->bio_flags & BIO_DONE)) { rv = tsleep((caddr_t)bp, PRIBIO, "fdform", 20 * hz); if (rv == EWOULDBLOCK) break; @@ -2685,16 +2688,13 @@ fdformat(dev, finfo, p) /* timed out */ rv = EIO; device_unbusy(fd->dev); - bufdone(bp); } - if (bp->b_flags & BIO_ERROR) - rv = bp->b_error; + if (bp->bio_flags & BIO_ERROR) + rv = bp->bio_error; /* * allow the process to be swapped */ PRELE(p); - BUF_UNLOCK(bp); - BUF_LOCKFREE(bp); free(bp, M_TEMP); return rv; } diff --git a/sys/pc98/pc98/pc98gdc.c b/sys/pc98/pc98/pc98gdc.c index a1522e7..a3f8afb 100644 --- a/sys/pc98/pc98/pc98gdc.c +++ b/sys/pc98/pc98/pc98gdc.c @@ -70,23 +70,6 @@ typedef struct gdc_softc { static devclass_t gdc_devclass; -static int gdcprobe(device_t dev); -static int gdc_attach(device_t dev); - -static device_method_t gdc_methods[] = { - DEVMETHOD(device_probe, gdcprobe), - DEVMETHOD(device_attach, gdc_attach), - { 0, 0 } -}; - -static driver_t gdcdriver = { - DRIVER_NAME, - gdc_methods, - sizeof(gdc_softc_t), -}; - -DRIVER_MODULE(gdc, isa, gdcdriver, gdc_devclass, 0, 0); - static int gdc_probe_unit(int unit, gdc_softc_t *sc, int flags); static int gdc_attach_unit(int unit, gdc_softc_t *sc, int flags); @@ -118,8 +101,14 @@ static struct cdevsw gdc_cdevsw = { #endif /* FB_INSTALL_CDEV */ +static void +gdc_identify(driver_t *driver, device_t parent) +{ + BUS_ADD_CHILD(parent, ISA_ORDER_SPECULATIVE, DRIVER_NAME, 0); +} + static int -gdcprobe(device_t dev) +gdc_probe(device_t dev) { gdc_softc_t *sc; @@ -244,6 +233,21 @@ gdcmmap(dev_t dev, vm_offset_t offset, int prot) #endif /* FB_INSTALL_CDEV */ +static device_method_t gdc_methods[] = { + DEVMETHOD(device_identify, gdc_identify), + DEVMETHOD(device_probe, gdc_probe), + DEVMETHOD(device_attach, gdc_attach), + { 0, 0 } +}; + +static driver_t gdcdriver = { + DRIVER_NAME, + gdc_methods, + sizeof(gdc_softc_t), +}; + +DRIVER_MODULE(gdc, isa, gdcdriver, gdc_devclass, 0, 0); + /* LOW-LEVEL */ #include <machine/clock.h> diff --git a/sys/pc98/pc98/spkr.c b/sys/pc98/pc98/spkr.c index 2b47828..476e414 100644 --- a/sys/pc98/pc98/spkr.c +++ b/sys/pc98/pc98/spkr.c @@ -17,7 +17,6 @@ #include <sys/kernel.h> #include <sys/module.h> #include <sys/bio.h> -#include <sys/buf.h> #include <sys/uio.h> #include <sys/conf.h> #include <sys/ctype.h> @@ -55,6 +54,8 @@ static struct cdevsw spkr_cdevsw = { /* bmaj */ -1 }; +MALLOC_DEFINE(M_SPKR, "spkr", "Speaker buffer"); + /**************** MACHINE DEPENDENT PART STARTS HERE ************************* * * This section defines a function tone() which causes a tone of given @@ -491,7 +492,7 @@ playstring(cp, slen) */ static int spkr_active = FALSE; /* exclusion flag */ -static struct buf *spkr_inbuf; /* incoming buf */ +static char *spkr_inbuf; /* incoming buf */ int spkropen(dev, flags, fmt, p) @@ -514,7 +515,7 @@ spkropen(dev, flags, fmt, p) (void) printf("spkropen: about to perform play initialization\n"); #endif /* DEBUG */ playinit(); - spkr_inbuf = geteblk(DEV_BSIZE); + spkr_inbuf = malloc(DEV_BSIZE, M_SPKR, M_WAITOK); spkr_active = TRUE; return(0); } @@ -542,7 +543,7 @@ spkrwrite(dev, uio, ioflag) int error; n = uio->uio_resid; - cp = spkr_inbuf->b_data; + cp = spkr_inbuf; error = uiomove(cp, n, uio); if (!error) { cp[n] = '\0'; @@ -569,7 +570,7 @@ spkrclose(dev, flags, fmt, p) { wakeup((caddr_t)&endtone); wakeup((caddr_t)&endrest); - brelse(spkr_inbuf); + free(spkr_inbuf, M_SPKR); spkr_active = FALSE; return(0); } diff --git a/sys/pc98/pc98/syscons.c b/sys/pc98/pc98/syscons.c index 30de92d..1330c33 100644 --- a/sys/pc98/pc98/syscons.c +++ b/sys/pc98/pc98/syscons.c @@ -47,6 +47,7 @@ #include <sys/kernel.h> #include <sys/malloc.h> #include <sys/cons.h> +#include <sys/random.h> #include <machine/clock.h> #include <machine/console.h> @@ -2974,6 +2975,9 @@ next_code: if (!(c & RELKEY)) sc_touch_scrn_saver(); + /* do the /dev/random device a favour */ + random_harvest((u_int64_t)c, 1, 0, RANDOM_KEYBOARD); + if (scp->kbd_mode != K_XLATE) return KEYCHAR(c); diff --git a/sys/pc98/pc98/syscons_pc98.c b/sys/pc98/pc98/syscons_pc98.c index 28f26d4..c461b0a 100644 --- a/sys/pc98/pc98/syscons_pc98.c +++ b/sys/pc98/pc98/syscons_pc98.c @@ -49,25 +49,14 @@ static devclass_t sc_devclass; -static int scprobe(device_t dev); -static int scattach(device_t dev); -static int scresume(device_t dev); - -static device_method_t sc_methods[] = { - DEVMETHOD(device_probe, scprobe), - DEVMETHOD(device_attach, scattach), - DEVMETHOD(device_resume, scresume), - { 0, 0 } -}; - -static driver_t sc_driver = { - SC_DRIVER_NAME, - sc_methods, - sizeof(sc_softc_t), -}; - static sc_softc_t main_softc; +static void +scidentify (driver_t *driver, device_t parent) +{ + BUS_ADD_CHILD(parent, ISA_ORDER_SPECULATIVE, "sc", 0); +} + static int scprobe(device_t dev) { @@ -212,4 +201,18 @@ sc_tone(int herz) return 0; } +static device_method_t sc_methods[] = { + DEVMETHOD(device_identify, scidentify), + DEVMETHOD(device_probe, scprobe), + DEVMETHOD(device_attach, scattach), + DEVMETHOD(device_resume, scresume), + { 0, 0 } +}; + +static driver_t sc_driver = { + SC_DRIVER_NAME, + sc_methods, + sizeof(sc_softc_t), +}; + DRIVER_MODULE(sc, isa, sc_driver, sc_devclass, 0, 0); |