Re-sync with -current. Should be in 2.2.
Submitted by: The FreeBSD(98) Development Team
This commit is contained in:
parent
634e26af7a
commit
6b2f48440f
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=19551
@ -3,7 +3,7 @@
|
||||
# Makefile.i386 -- with config changes.
|
||||
# Copyright 1990 W. Jolitz
|
||||
# from: @(#)Makefile.i386 7.1 5/10/91
|
||||
# $Id: Makefile.pc98,v 1.6 1996/10/09 21:45:45 asami Exp $
|
||||
# $Id: Makefile.pc98,v 1.7 1996/10/23 07:24:48 asami Exp $
|
||||
#
|
||||
# Makefile for FreeBSD
|
||||
#
|
||||
@ -124,7 +124,7 @@ genassym.o: ${I386}/i386/genassym.c Makefile
|
||||
${CC} -c ${CFLAGS} ${PARAM} -UKERNEL ${I386}/i386/genassym.c
|
||||
|
||||
genassym: genassym.o
|
||||
${CC} -static ${CFLAGS} ${PARAM} genassym.o -o $@
|
||||
${CC} ${CFLAGS} ${PARAM} genassym.o -o $@
|
||||
|
||||
# XXX this assumes that the options for NORMAL_C* and DRIVER_C* are identical.
|
||||
depend: assym.s param.c vnode_if.h ${BEFORE_DEPEND}
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
# modified for PC-9801
|
||||
#
|
||||
# $Id: files.pc98,v 1.9 1996/10/30 22:39:31 asami Exp $
|
||||
# $Id: files.pc98,v 1.10 1996/11/02 10:38:45 asami Exp $
|
||||
#
|
||||
aic7xxx_asm optional ahc device-driver \
|
||||
dependency "$S/dev/aic7xxx/aic7xxx_asm.c" \
|
||||
@ -19,12 +19,12 @@ aic7xxx_seq.h optional ahc device-driver \
|
||||
#
|
||||
linux_genassym optional compat_linux \
|
||||
dependency "$S/i386/linux/linux_genassym.c $S/i386/linux/linux.h" \
|
||||
compile-with "${CC} ${CFLAGS} -o $@ $<" \
|
||||
compile-with "${CC} ${CFLAGS} ${PARAM} -UKERNEL -o $@ $<" \
|
||||
no-obj no-implicit-rule \
|
||||
clean "linux_genassym"
|
||||
#
|
||||
linux_assym.h optional compat_linux \
|
||||
dependency "linux_genassym" \
|
||||
dependency "linux_genassym" \
|
||||
compile-with "./linux_genassym > $@" \
|
||||
no-obj no-implicit-rule before-depend \
|
||||
clean "linux_assym.h"
|
||||
@ -37,6 +37,7 @@ i386/apm/apm_setup.s optional apm
|
||||
#i386/eisa/aha1742.c optional ahb device-driver
|
||||
#i386/eisa/bt74x.c optional bt device-driver
|
||||
i386/eisa/eisaconf.c optional eisa
|
||||
i386/eisa/if_vx_eisa.c optional vx device-driver
|
||||
i386/i386/autoconf.c standard device-driver
|
||||
i386/i386/cons.c standard
|
||||
i386/i386/db_disasm.c optional ddb
|
||||
|
@ -43,7 +43,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)fd.c 7.4 (Berkeley) 5/25/91
|
||||
* $Id: fd.c,v 1.7 1996/10/23 07:25:15 asami Exp $
|
||||
* $Id: fd.c,v 1.8 1996/11/02 10:39:13 asami Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@ -91,8 +91,6 @@
|
||||
#include <sys/devfsext.h>
|
||||
#endif
|
||||
|
||||
#define b_cylin b_resid /* XXX now spelled b_cylinder elsewhere */
|
||||
|
||||
/* misuse a flag to identify format operation */
|
||||
#define B_FORMAT B_XXX
|
||||
|
||||
@ -1321,7 +1319,7 @@ fdclose(dev_t dev, int flags, int mode, struct proc *p)
|
||||
void
|
||||
fdstrategy(struct buf *bp)
|
||||
{
|
||||
long nblocks, blknum;
|
||||
unsigned nblocks, blknum, cando;
|
||||
int s;
|
||||
fdcu_t fdcu;
|
||||
fdu_t fdu;
|
||||
@ -1368,8 +1366,18 @@ fdstrategy(struct buf *bp)
|
||||
/*
|
||||
* Set up block calculations.
|
||||
*/
|
||||
blknum = (unsigned long) bp->b_blkno * DEV_BSIZE/fdblk;
|
||||
if (bp->b_blkno > 20000000) {
|
||||
/*
|
||||
* Reject unreasonably high block number, prevent the
|
||||
* multiplication below from overflowing.
|
||||
*/
|
||||
bp->b_error = EINVAL;
|
||||
bp->b_flags |= B_ERROR;
|
||||
goto bad;
|
||||
}
|
||||
blknum = (unsigned) bp->b_blkno * DEV_BSIZE/fdblk;
|
||||
nblocks = fd->ft->size;
|
||||
bp->b_resid = 0;
|
||||
#ifdef PC98
|
||||
#define B_XXX2 0x8000000
|
||||
if (bp->b_flags & B_XXX2) {
|
||||
@ -1379,15 +1387,17 @@ fdstrategy(struct buf *bp)
|
||||
}
|
||||
#endif
|
||||
if (blknum + (bp->b_bcount / fdblk) > nblocks) {
|
||||
if (blknum == nblocks) {
|
||||
bp->b_resid = bp->b_bcount;
|
||||
if (blknum <= nblocks) {
|
||||
cando = (nblocks - blknum) * fdblk;
|
||||
bp->b_resid = bp->b_bcount - cando;
|
||||
if (cando == 0)
|
||||
goto bad; /* not actually bad but EOF */
|
||||
} else {
|
||||
bp->b_error = ENOSPC;
|
||||
bp->b_error = EINVAL;
|
||||
bp->b_flags |= B_ERROR;
|
||||
goto bad;
|
||||
}
|
||||
goto bad;
|
||||
}
|
||||
bp->b_cylin = blknum / (fd->ft->sectrac * fd->ft->heads);
|
||||
bp->b_pblkno = bp->b_blkno;
|
||||
s = splbio();
|
||||
tqdisksort(&fdc->head, bp);
|
||||
@ -1512,7 +1522,7 @@ static int
|
||||
fdstate(fdcu_t fdcu, fdc_p fdc)
|
||||
{
|
||||
int read, format, head, sec = 0, sectrac, st0, cyl, st3;
|
||||
unsigned long blknum;
|
||||
unsigned blknum = 0, b_cylinder = 0;
|
||||
fdu_t fdu = fdc->fdu;
|
||||
fd_p fd;
|
||||
register struct buf *bp;
|
||||
@ -1545,8 +1555,16 @@ fdstate(fdcu_t fdcu, fdc_p fdc)
|
||||
}
|
||||
read = bp->b_flags & B_READ;
|
||||
format = bp->b_flags & B_FORMAT;
|
||||
if(format)
|
||||
if(format) {
|
||||
finfo = (struct fd_formb *)bp->b_un.b_addr;
|
||||
fd->skip = (char *)&(finfo->fd_formb_cylno(0))
|
||||
- (char *)finfo;
|
||||
}
|
||||
if (fdc->state == DOSEEK || fdc->state == SEEKCOMPLETE) {
|
||||
blknum = (unsigned) bp->b_blkno * DEV_BSIZE/fdblk +
|
||||
fd->skip/fdblk;
|
||||
b_cylinder = blknum / (fd->ft->sectrac * fd->ft->heads);
|
||||
}
|
||||
TRACE1("fd%d", fdu);
|
||||
TRACE1("[%s]", fdstates[fdc->state]);
|
||||
TRACE1("(0x%x)", fd->flags);
|
||||
@ -1624,7 +1642,7 @@ fdstate(fdcu_t fdcu, fdc_p fdc)
|
||||
fdc->state = DOSEEK;
|
||||
break;
|
||||
case DOSEEK:
|
||||
if (bp->b_cylin == fd->track)
|
||||
if (b_cylinder == (unsigned)fd->track)
|
||||
{
|
||||
fdc->state = SEEKCOMPLETE;
|
||||
break;
|
||||
@ -1633,7 +1651,7 @@ fdstate(fdcu_t fdcu, fdc_p fdc)
|
||||
pc98_fd_check_ready(fdu);
|
||||
#endif
|
||||
if (fd_cmd(fdcu, 3, NE7CMD_SEEK,
|
||||
fd->fdsu, bp->b_cylin * fd->ft->steptrac,
|
||||
fd->fdsu, b_cylinder * fd->ft->steptrac,
|
||||
0))
|
||||
{
|
||||
/*
|
||||
@ -1655,7 +1673,7 @@ fdstate(fdcu_t fdcu, fdc_p fdc)
|
||||
/* Make sure seek really happened*/
|
||||
if(fd->track == FD_NO_TRACK)
|
||||
{
|
||||
int descyl = bp->b_cylin * fd->ft->steptrac;
|
||||
int descyl = b_cylinder * fd->ft->steptrac;
|
||||
do {
|
||||
/*
|
||||
* This might be a "ready changed" interrupt,
|
||||
@ -1725,17 +1743,12 @@ fdstate(fdcu_t fdcu, fdc_p fdc)
|
||||
}
|
||||
}
|
||||
|
||||
fd->track = bp->b_cylin;
|
||||
if(format)
|
||||
fd->skip = (char *)&(finfo->fd_formb_cylno(0))
|
||||
- (char *)finfo;
|
||||
fd->track = b_cylinder;
|
||||
#ifdef EPSON_NRDISK
|
||||
if (fdu != nrdu) {
|
||||
#endif /* EPSON_NRDISK */
|
||||
isa_dmastart(bp->b_flags, bp->b_un.b_addr+fd->skip,
|
||||
format ? bp->b_bcount : fdblk, fdc->dmachan);
|
||||
blknum = (unsigned long)bp->b_blkno*DEV_BSIZE/fdblk
|
||||
+ fd->skip/fdblk;
|
||||
sectrac = fd->ft->sectrac;
|
||||
sec = blknum % (sectrac * fd->ft->heads);
|
||||
head = sec / sectrac;
|
||||
@ -1893,24 +1906,15 @@ fdstate(fdcu_t fdcu, fdc_p fdc)
|
||||
}
|
||||
/* All OK */
|
||||
fd->skip += fdblk;
|
||||
if (!format && fd->skip < bp->b_bcount)
|
||||
if (!format && fd->skip < bp->b_bcount - bp->b_resid)
|
||||
{
|
||||
/* set up next transfer */
|
||||
blknum = (unsigned long)bp->b_blkno*DEV_BSIZE/fdblk
|
||||
+ fd->skip/fdblk;
|
||||
#ifdef EPSON_NRDISK
|
||||
nrdblkn = (unsigned long)bp->b_blkno*DEV_BSIZE/fdblk
|
||||
+ fd->skip/fdblk;
|
||||
#endif
|
||||
bp->b_cylin =
|
||||
(blknum / (fd->ft->sectrac * fd->ft->heads));
|
||||
fdc->state = DOSEEK;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* ALL DONE */
|
||||
fd->skip = 0;
|
||||
bp->b_resid = 0;
|
||||
TAILQ_REMOVE(&fdc->head, bp, b_act);
|
||||
biodone(bp);
|
||||
fdc->fd = (fd_p) 0;
|
||||
@ -2073,7 +2077,7 @@ retrier(fdcu)
|
||||
}
|
||||
bp->b_flags |= B_ERROR;
|
||||
bp->b_error = EIO;
|
||||
bp->b_resid = bp->b_bcount - fdc->fd->skip;
|
||||
bp->b_resid += bp->b_bcount - fdc->fd->skip;
|
||||
TAILQ_REMOVE(&fdc->head, bp, b_act);
|
||||
fdc->fd->skip = 0;
|
||||
biodone(bp);
|
||||
|
@ -3,7 +3,7 @@
|
||||
# Makefile.i386 -- with config changes.
|
||||
# Copyright 1990 W. Jolitz
|
||||
# from: @(#)Makefile.i386 7.1 5/10/91
|
||||
# $Id: Makefile.pc98,v 1.6 1996/10/09 21:45:45 asami Exp $
|
||||
# $Id: Makefile.pc98,v 1.7 1996/10/23 07:24:48 asami Exp $
|
||||
#
|
||||
# Makefile for FreeBSD
|
||||
#
|
||||
@ -124,7 +124,7 @@ genassym.o: ${I386}/i386/genassym.c Makefile
|
||||
${CC} -c ${CFLAGS} ${PARAM} -UKERNEL ${I386}/i386/genassym.c
|
||||
|
||||
genassym: genassym.o
|
||||
${CC} -static ${CFLAGS} ${PARAM} genassym.o -o $@
|
||||
${CC} ${CFLAGS} ${PARAM} genassym.o -o $@
|
||||
|
||||
# XXX this assumes that the options for NORMAL_C* and DRIVER_C* are identical.
|
||||
depend: assym.s param.c vnode_if.h ${BEFORE_DEPEND}
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
# modified for PC-9801
|
||||
#
|
||||
# $Id: files.pc98,v 1.9 1996/10/30 22:39:31 asami Exp $
|
||||
# $Id: files.pc98,v 1.10 1996/11/02 10:38:45 asami Exp $
|
||||
#
|
||||
aic7xxx_asm optional ahc device-driver \
|
||||
dependency "$S/dev/aic7xxx/aic7xxx_asm.c" \
|
||||
@ -19,12 +19,12 @@ aic7xxx_seq.h optional ahc device-driver \
|
||||
#
|
||||
linux_genassym optional compat_linux \
|
||||
dependency "$S/i386/linux/linux_genassym.c $S/i386/linux/linux.h" \
|
||||
compile-with "${CC} ${CFLAGS} -o $@ $<" \
|
||||
compile-with "${CC} ${CFLAGS} ${PARAM} -UKERNEL -o $@ $<" \
|
||||
no-obj no-implicit-rule \
|
||||
clean "linux_genassym"
|
||||
#
|
||||
linux_assym.h optional compat_linux \
|
||||
dependency "linux_genassym" \
|
||||
dependency "linux_genassym" \
|
||||
compile-with "./linux_genassym > $@" \
|
||||
no-obj no-implicit-rule before-depend \
|
||||
clean "linux_assym.h"
|
||||
@ -37,6 +37,7 @@ i386/apm/apm_setup.s optional apm
|
||||
#i386/eisa/aha1742.c optional ahb device-driver
|
||||
#i386/eisa/bt74x.c optional bt device-driver
|
||||
i386/eisa/eisaconf.c optional eisa
|
||||
i386/eisa/if_vx_eisa.c optional vx device-driver
|
||||
i386/i386/autoconf.c standard device-driver
|
||||
i386/i386/cons.c standard
|
||||
i386/i386/db_disasm.c optional ddb
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)locore.s 7.3 (Berkeley) 5/13/91
|
||||
* $Id: locore.s,v 1.4 1996/10/09 21:45:53 asami Exp $
|
||||
* $Id: locore.s,v 1.5 1996/10/23 07:24:59 asami Exp $
|
||||
*
|
||||
* originally from: locore.s, by William F. Jolitz
|
||||
*
|
||||
@ -690,7 +690,7 @@ olddiskboot:
|
||||
movl %eax,R(_bootdev)
|
||||
|
||||
#if defined(USERCONFIG_BOOT) && defined(USERCONFIG)
|
||||
movl $0x10200, %esi
|
||||
movl $0x90200, %esi
|
||||
movl $R(_userconfig_from_boot),%edi
|
||||
movl $512,%ecx
|
||||
cld
|
||||
|
@ -46,7 +46,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: userconfig.c,v 1.10 1996/10/30 22:39:36 asami Exp $
|
||||
** $Id: userconfig.c,v 1.11 1996/11/02 10:39:03 asami Exp $
|
||||
**/
|
||||
|
||||
/**
|
||||
@ -323,6 +323,7 @@ static DEV_INFO device_info[] = {
|
||||
{"lkm", "Loadable PCI driver support", FLG_INVISIBLE, CLS_MISC},
|
||||
{"vga", "Catchall PCI VGA driver", FLG_INVISIBLE, CLS_MISC},
|
||||
{"chip", "PCI chipset support", FLG_INVISIBLE, CLS_MISC},
|
||||
{"piix", "Intel 82371 Bus-master IDE controller", FLG_INVISIBLE, CLS_MISC},
|
||||
{"","",0,0}};
|
||||
|
||||
|
||||
@ -706,6 +707,10 @@ savelist(DEV_LIST *list, int active)
|
||||
{
|
||||
if ((list->comment == DEV_DEVICE) && list->changed)
|
||||
{
|
||||
if ((list->iobase == -2) || /* is a PCI device; can't save */
|
||||
(list->device == NULL)) /* no isa_device associated at all?! */
|
||||
continue;
|
||||
|
||||
setdev(list,active); /* set the device itself */
|
||||
|
||||
id_pn = NULL;
|
||||
@ -2249,7 +2254,7 @@ visuserconfig(void)
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: userconfig.c,v 1.63 1996/10/30 21:40:15 julian Exp $
|
||||
* $Id: userconfig.c,v 1.11 1996/11/02 10:39:03 asami Exp $
|
||||
*/
|
||||
|
||||
#include "scbus.h"
|
||||
|
@ -35,7 +35,7 @@
|
||||
*
|
||||
* from: @(#)ufs_disksubr.c 7.16 (Berkeley) 5/4/91
|
||||
* from: ufs_disksubr.c,v 1.8 1994/06/07 01:21:39 phk Exp $
|
||||
* $Id: atcompat_diskslice.c,v 1.1.1.1 1996/06/14 10:04:42 asami Exp $
|
||||
* $Id: atcompat_diskslice.c,v 1.2 1996/10/09 21:46:08 asami Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -259,12 +259,13 @@ atcompat_dsinit(dname, dev, strat, lp, sspp)
|
||||
max_nsectors = 0;
|
||||
max_ntracks = 0;
|
||||
for (dospart = 0, dp = dp0; dospart < NDOSPART; dospart++, dp++) {
|
||||
int ncyls;
|
||||
int nsectors;
|
||||
int ntracks;
|
||||
|
||||
max_ncyls = DPCYL(dp->dp_ecyl, dp->dp_esect);
|
||||
if (max_ncyls < max_ncyls)
|
||||
max_ncyls = max_ncyls;
|
||||
ncyls = DPCYL(dp->dp_ecyl, dp->dp_esect) + 1;
|
||||
if (max_ncyls < ncyls)
|
||||
max_ncyls = ncyls;
|
||||
nsectors = DPSECT(dp->dp_esect);
|
||||
if (max_nsectors < nsectors)
|
||||
max_nsectors = nsectors;
|
||||
@ -273,7 +274,10 @@ atcompat_dsinit(dname, dev, strat, lp, sspp)
|
||||
max_ntracks = ntracks;
|
||||
}
|
||||
|
||||
/* Check the geometry. */
|
||||
/*
|
||||
* Check that we have guessed the geometry right by checking the
|
||||
* partition entries.
|
||||
*/
|
||||
/*
|
||||
* TODO:
|
||||
* As above.
|
||||
@ -281,7 +285,6 @@ atcompat_dsinit(dname, dev, strat, lp, sspp)
|
||||
* Check against d_secperunit if the latter is reliable.
|
||||
*/
|
||||
error = 0;
|
||||
secpercyl = (u_long)max_nsectors * max_ntracks;
|
||||
for (dospart = 0, dp = dp0; dospart < NDOSPART; dospart++, dp++) {
|
||||
if (dp->dp_scyl == 0 && dp->dp_shd == 0 && dp->dp_ssect == 0
|
||||
&& dp->dp_start == 0 && dp->dp_size == 0)
|
||||
@ -307,6 +310,7 @@ atcompat_dsinit(dname, dev, strat, lp, sspp)
|
||||
* First adjust the label (we have been careful not to change it
|
||||
* before we can guarantee success).
|
||||
*/
|
||||
secpercyl = (u_long)max_nsectors * max_ntracks;
|
||||
if (secpercyl != 0) {
|
||||
u_long secperunit;
|
||||
|
||||
|
@ -35,7 +35,7 @@
|
||||
*
|
||||
* from: @(#)ufs_disksubr.c 7.16 (Berkeley) 5/4/91
|
||||
* from: ufs_disksubr.c,v 1.8 1994/06/07 01:21:39 phk Exp $
|
||||
* $Id: diskslice_machdep.c,v 1.2 1996/07/23 07:46:09 asami Exp $
|
||||
* $Id: diskslice_machdep.c,v 1.3 1996/10/09 21:46:15 asami Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -386,17 +386,18 @@ dsinit(dname, dev, strat, lp, sspp)
|
||||
max_nsectors = 0;
|
||||
max_ntracks = 0;
|
||||
for (dospart = 0, dp = dp0; dospart < NDOSPART; dospart++, dp++) {
|
||||
int ncyls;
|
||||
int nsectors;
|
||||
int ntracks;
|
||||
|
||||
|
||||
#ifdef PC98
|
||||
max_ncyls = lp->d_secpercyl;
|
||||
ncyls = lp->d_secpercyl;
|
||||
#else
|
||||
max_ncyls = DPCYL(dp->dp_ecyl, dp->dp_esect);
|
||||
ncyls = DPCYL(dp->dp_ecyl, dp->dp_esect) + 1;
|
||||
#endif
|
||||
if (max_ncyls < max_ncyls)
|
||||
max_ncyls = max_ncyls;
|
||||
if (max_ncyls < ncyls)
|
||||
max_ncyls = ncyls;
|
||||
#ifdef PC98
|
||||
nsectors = lp->d_nsectors;
|
||||
#else
|
||||
@ -413,7 +414,10 @@ dsinit(dname, dev, strat, lp, sspp)
|
||||
max_ntracks = ntracks;
|
||||
}
|
||||
|
||||
/* Check the geometry. */
|
||||
/*
|
||||
* Check that we have guessed the geometry right by checking the
|
||||
* partition entries.
|
||||
*/
|
||||
/*
|
||||
* TODO:
|
||||
* As above.
|
||||
@ -421,7 +425,6 @@ dsinit(dname, dev, strat, lp, sspp)
|
||||
* Check against d_secperunit if the latter is reliable.
|
||||
*/
|
||||
error = 0;
|
||||
secpercyl = (u_long)max_nsectors * max_ntracks;
|
||||
#ifdef PC98
|
||||
for (dospart = 0, dp = dp0; dospart < NDOSPART; dospart++, dp++) {
|
||||
if (dp->dp_scyl == 0 && dp->dp_shd == 0 && dp->dp_ssect == 0)
|
||||
@ -454,6 +457,7 @@ dsinit(dname, dev, strat, lp, sspp)
|
||||
* First adjust the label (we have been careful not to change it
|
||||
* before we can guarantee success).
|
||||
*/
|
||||
secpercyl = (u_long)max_nsectors * max_ntracks;
|
||||
if (secpercyl != 0) {
|
||||
u_long secperunit;
|
||||
|
||||
|
@ -43,7 +43,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)fd.c 7.4 (Berkeley) 5/25/91
|
||||
* $Id: fd.c,v 1.7 1996/10/23 07:25:15 asami Exp $
|
||||
* $Id: fd.c,v 1.8 1996/11/02 10:39:13 asami Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@ -91,8 +91,6 @@
|
||||
#include <sys/devfsext.h>
|
||||
#endif
|
||||
|
||||
#define b_cylin b_resid /* XXX now spelled b_cylinder elsewhere */
|
||||
|
||||
/* misuse a flag to identify format operation */
|
||||
#define B_FORMAT B_XXX
|
||||
|
||||
@ -1321,7 +1319,7 @@ fdclose(dev_t dev, int flags, int mode, struct proc *p)
|
||||
void
|
||||
fdstrategy(struct buf *bp)
|
||||
{
|
||||
long nblocks, blknum;
|
||||
unsigned nblocks, blknum, cando;
|
||||
int s;
|
||||
fdcu_t fdcu;
|
||||
fdu_t fdu;
|
||||
@ -1368,8 +1366,18 @@ fdstrategy(struct buf *bp)
|
||||
/*
|
||||
* Set up block calculations.
|
||||
*/
|
||||
blknum = (unsigned long) bp->b_blkno * DEV_BSIZE/fdblk;
|
||||
if (bp->b_blkno > 20000000) {
|
||||
/*
|
||||
* Reject unreasonably high block number, prevent the
|
||||
* multiplication below from overflowing.
|
||||
*/
|
||||
bp->b_error = EINVAL;
|
||||
bp->b_flags |= B_ERROR;
|
||||
goto bad;
|
||||
}
|
||||
blknum = (unsigned) bp->b_blkno * DEV_BSIZE/fdblk;
|
||||
nblocks = fd->ft->size;
|
||||
bp->b_resid = 0;
|
||||
#ifdef PC98
|
||||
#define B_XXX2 0x8000000
|
||||
if (bp->b_flags & B_XXX2) {
|
||||
@ -1379,15 +1387,17 @@ fdstrategy(struct buf *bp)
|
||||
}
|
||||
#endif
|
||||
if (blknum + (bp->b_bcount / fdblk) > nblocks) {
|
||||
if (blknum == nblocks) {
|
||||
bp->b_resid = bp->b_bcount;
|
||||
if (blknum <= nblocks) {
|
||||
cando = (nblocks - blknum) * fdblk;
|
||||
bp->b_resid = bp->b_bcount - cando;
|
||||
if (cando == 0)
|
||||
goto bad; /* not actually bad but EOF */
|
||||
} else {
|
||||
bp->b_error = ENOSPC;
|
||||
bp->b_error = EINVAL;
|
||||
bp->b_flags |= B_ERROR;
|
||||
goto bad;
|
||||
}
|
||||
goto bad;
|
||||
}
|
||||
bp->b_cylin = blknum / (fd->ft->sectrac * fd->ft->heads);
|
||||
bp->b_pblkno = bp->b_blkno;
|
||||
s = splbio();
|
||||
tqdisksort(&fdc->head, bp);
|
||||
@ -1512,7 +1522,7 @@ static int
|
||||
fdstate(fdcu_t fdcu, fdc_p fdc)
|
||||
{
|
||||
int read, format, head, sec = 0, sectrac, st0, cyl, st3;
|
||||
unsigned long blknum;
|
||||
unsigned blknum = 0, b_cylinder = 0;
|
||||
fdu_t fdu = fdc->fdu;
|
||||
fd_p fd;
|
||||
register struct buf *bp;
|
||||
@ -1545,8 +1555,16 @@ fdstate(fdcu_t fdcu, fdc_p fdc)
|
||||
}
|
||||
read = bp->b_flags & B_READ;
|
||||
format = bp->b_flags & B_FORMAT;
|
||||
if(format)
|
||||
if(format) {
|
||||
finfo = (struct fd_formb *)bp->b_un.b_addr;
|
||||
fd->skip = (char *)&(finfo->fd_formb_cylno(0))
|
||||
- (char *)finfo;
|
||||
}
|
||||
if (fdc->state == DOSEEK || fdc->state == SEEKCOMPLETE) {
|
||||
blknum = (unsigned) bp->b_blkno * DEV_BSIZE/fdblk +
|
||||
fd->skip/fdblk;
|
||||
b_cylinder = blknum / (fd->ft->sectrac * fd->ft->heads);
|
||||
}
|
||||
TRACE1("fd%d", fdu);
|
||||
TRACE1("[%s]", fdstates[fdc->state]);
|
||||
TRACE1("(0x%x)", fd->flags);
|
||||
@ -1624,7 +1642,7 @@ fdstate(fdcu_t fdcu, fdc_p fdc)
|
||||
fdc->state = DOSEEK;
|
||||
break;
|
||||
case DOSEEK:
|
||||
if (bp->b_cylin == fd->track)
|
||||
if (b_cylinder == (unsigned)fd->track)
|
||||
{
|
||||
fdc->state = SEEKCOMPLETE;
|
||||
break;
|
||||
@ -1633,7 +1651,7 @@ fdstate(fdcu_t fdcu, fdc_p fdc)
|
||||
pc98_fd_check_ready(fdu);
|
||||
#endif
|
||||
if (fd_cmd(fdcu, 3, NE7CMD_SEEK,
|
||||
fd->fdsu, bp->b_cylin * fd->ft->steptrac,
|
||||
fd->fdsu, b_cylinder * fd->ft->steptrac,
|
||||
0))
|
||||
{
|
||||
/*
|
||||
@ -1655,7 +1673,7 @@ fdstate(fdcu_t fdcu, fdc_p fdc)
|
||||
/* Make sure seek really happened*/
|
||||
if(fd->track == FD_NO_TRACK)
|
||||
{
|
||||
int descyl = bp->b_cylin * fd->ft->steptrac;
|
||||
int descyl = b_cylinder * fd->ft->steptrac;
|
||||
do {
|
||||
/*
|
||||
* This might be a "ready changed" interrupt,
|
||||
@ -1725,17 +1743,12 @@ fdstate(fdcu_t fdcu, fdc_p fdc)
|
||||
}
|
||||
}
|
||||
|
||||
fd->track = bp->b_cylin;
|
||||
if(format)
|
||||
fd->skip = (char *)&(finfo->fd_formb_cylno(0))
|
||||
- (char *)finfo;
|
||||
fd->track = b_cylinder;
|
||||
#ifdef EPSON_NRDISK
|
||||
if (fdu != nrdu) {
|
||||
#endif /* EPSON_NRDISK */
|
||||
isa_dmastart(bp->b_flags, bp->b_un.b_addr+fd->skip,
|
||||
format ? bp->b_bcount : fdblk, fdc->dmachan);
|
||||
blknum = (unsigned long)bp->b_blkno*DEV_BSIZE/fdblk
|
||||
+ fd->skip/fdblk;
|
||||
sectrac = fd->ft->sectrac;
|
||||
sec = blknum % (sectrac * fd->ft->heads);
|
||||
head = sec / sectrac;
|
||||
@ -1893,24 +1906,15 @@ fdstate(fdcu_t fdcu, fdc_p fdc)
|
||||
}
|
||||
/* All OK */
|
||||
fd->skip += fdblk;
|
||||
if (!format && fd->skip < bp->b_bcount)
|
||||
if (!format && fd->skip < bp->b_bcount - bp->b_resid)
|
||||
{
|
||||
/* set up next transfer */
|
||||
blknum = (unsigned long)bp->b_blkno*DEV_BSIZE/fdblk
|
||||
+ fd->skip/fdblk;
|
||||
#ifdef EPSON_NRDISK
|
||||
nrdblkn = (unsigned long)bp->b_blkno*DEV_BSIZE/fdblk
|
||||
+ fd->skip/fdblk;
|
||||
#endif
|
||||
bp->b_cylin =
|
||||
(blknum / (fd->ft->sectrac * fd->ft->heads));
|
||||
fdc->state = DOSEEK;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* ALL DONE */
|
||||
fd->skip = 0;
|
||||
bp->b_resid = 0;
|
||||
TAILQ_REMOVE(&fdc->head, bp, b_act);
|
||||
biodone(bp);
|
||||
fdc->fd = (fd_p) 0;
|
||||
@ -2073,7 +2077,7 @@ retrier(fdcu)
|
||||
}
|
||||
bp->b_flags |= B_ERROR;
|
||||
bp->b_error = EIO;
|
||||
bp->b_resid = bp->b_bcount - fdc->fd->skip;
|
||||
bp->b_resid += bp->b_bcount - fdc->fd->skip;
|
||||
TAILQ_REMOVE(&fdc->head, bp, b_act);
|
||||
fdc->fd->skip = 0;
|
||||
biodone(bp);
|
||||
|
@ -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.12 1996/10/29 08:36:27 asami Exp $
|
||||
* $Id: syscons.c,v 1.13 1996/10/30 22:40:15 asami Exp $
|
||||
*/
|
||||
|
||||
#include "sc.h"
|
||||
@ -699,35 +699,40 @@ scintr(int unit)
|
||||
mark_all(cur_console);
|
||||
}
|
||||
|
||||
c = scgetc(SCGETC_NONBLOCK);
|
||||
/*
|
||||
* Loop while there is still input to get from the keyboard.
|
||||
* I don't think this is nessesary, and it doesn't fix
|
||||
* the Xaccel-2.1 keyboard hang, but it can't hurt. XXX
|
||||
*/
|
||||
while ((c = scgetc(SCGETC_NONBLOCK)) != NOKEY) {
|
||||
|
||||
cur_tty = VIRTUAL_TTY(get_scr_num());
|
||||
if (!(cur_tty->t_state & TS_ISOPEN))
|
||||
if (!((cur_tty = CONSOLE_TTY)->t_state & TS_ISOPEN))
|
||||
return;
|
||||
cur_tty = VIRTUAL_TTY(get_scr_num());
|
||||
if (!(cur_tty->t_state & TS_ISOPEN))
|
||||
if (!((cur_tty = CONSOLE_TTY)->t_state & TS_ISOPEN))
|
||||
return;
|
||||
|
||||
switch (c & 0xff00) {
|
||||
case 0x0000: /* normal key */
|
||||
(*linesw[cur_tty->t_line].l_rint)(c & 0xFF, cur_tty);
|
||||
switch (c & 0xff00) {
|
||||
case 0x0000: /* normal key */
|
||||
(*linesw[cur_tty->t_line].l_rint)(c & 0xFF, cur_tty);
|
||||
break;
|
||||
case FKEY: /* function key, return string */
|
||||
if (cp = get_fstr((u_int)c, (u_int *)&len)) {
|
||||
while (len-- > 0)
|
||||
(*linesw[cur_tty->t_line].l_rint)(*cp++ & 0xFF, cur_tty);
|
||||
}
|
||||
break;
|
||||
case NOKEY: /* nothing there */
|
||||
return;
|
||||
case FKEY: /* function key, return string */
|
||||
if (cp = get_fstr((u_int)c, (u_int *)&len)) {
|
||||
while (len-- > 0)
|
||||
(*linesw[cur_tty->t_line].l_rint)(*cp++ & 0xFF, cur_tty);
|
||||
case MKEY: /* meta is active, prepend ESC */
|
||||
(*linesw[cur_tty->t_line].l_rint)(0x1b, cur_tty);
|
||||
(*linesw[cur_tty->t_line].l_rint)(c & 0xFF, cur_tty);
|
||||
break;
|
||||
case BKEY: /* backtab fixed sequence (esc [ Z) */
|
||||
(*linesw[cur_tty->t_line].l_rint)(0x1b, cur_tty);
|
||||
(*linesw[cur_tty->t_line].l_rint)('[', cur_tty);
|
||||
(*linesw[cur_tty->t_line].l_rint)('Z', cur_tty);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case MKEY: /* meta is active, prepend ESC */
|
||||
(*linesw[cur_tty->t_line].l_rint)(0x1b, cur_tty);
|
||||
(*linesw[cur_tty->t_line].l_rint)(c & 0xFF, cur_tty);
|
||||
break;
|
||||
case BKEY: /* backtab fixed sequence (esc [ Z) */
|
||||
(*linesw[cur_tty->t_line].l_rint)(0x1b, cur_tty);
|
||||
(*linesw[cur_tty->t_line].l_rint)('[', cur_tty);
|
||||
(*linesw[cur_tty->t_line].l_rint)('Z', cur_tty);
|
||||
break;
|
||||
}
|
||||
|
||||
if (cur_console->status & MOUSE_ENABLED) {
|
||||
cur_console->status &= ~MOUSE_VISIBLE;
|
||||
remove_mouse_image(cur_console);
|
||||
@ -1677,6 +1682,16 @@ scrn_timer()
|
||||
scr_stat *scp = cur_console;
|
||||
int s = spltty();
|
||||
|
||||
/*
|
||||
* With release 2.1 of the Xaccel server, the keyboard is left
|
||||
* hanging pretty often. Apparently the interrupt from the
|
||||
* keyboard is lost, and I don't know why (yet).
|
||||
* This Ugly hack calls scintr if input is ready and
|
||||
* conveniently hides the problem. XXX
|
||||
*/
|
||||
if (inb(KB_STAT) & KB_BUF_FULL)
|
||||
scintr(0);
|
||||
|
||||
/* should we just return ? */
|
||||
if ((scp->status&UNKNOWN_MODE) || blink_in_progress || switch_in_progress) {
|
||||
timeout((timeout_func_t)scrn_timer, 0, hz/10);
|
||||
@ -3284,18 +3299,12 @@ scgetc(u_int flags)
|
||||
static u_int chr = 0;
|
||||
|
||||
next_code:
|
||||
kbd_wait();
|
||||
/* first see if there is something in the keyboard port */
|
||||
if (inb(KB_STAT) & KB_BUF_FULL)
|
||||
#ifdef PC98
|
||||
{
|
||||
kbd_wait();
|
||||
scancode = inb(KB_DATA);
|
||||
} else if (flags & SCGETC_NONBLOCK)
|
||||
#else
|
||||
/* check if there is anything in the keyboard buffer */
|
||||
if (inb(KB_STAT) & KB_BUF_FULL) {
|
||||
DELAY(25);
|
||||
scancode = inb(KB_DATA);
|
||||
}
|
||||
else if (flags & SCGETC_NONBLOCK)
|
||||
#endif
|
||||
return(NOKEY);
|
||||
else
|
||||
goto next_code;
|
||||
@ -3738,7 +3747,6 @@ scgetc(u_int flags)
|
||||
console[0]->smode.mode == VT_AUTO)
|
||||
switch_scr(cur_console, 0);
|
||||
Debugger("manual escape to debugger");
|
||||
return(NOKEY);
|
||||
#else
|
||||
printf("No debugger in kernel\n");
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user