Sync with follwing files:
Path Revision i386/conf/GENERIC 1.162 i386/conf/Makefile.i386 1.146 i386/conf/files.i386 1.236 i386/conf/options.i386 1.111 i386/i386/machdep.c 1.329 i386/i386/userconfig.c 1.134 i386/isa/fd.c 1.135 i386/isa/if_ed.c 1.151 i386/isa/isa_dam.c 1.1 i386/isa/npx.c 1.67 isa/sio.c 1.224 dev/syscons/syscons.c 1.300 i386/isa/wd.c 1.194 isa/vga_isa.c 1.5 isa/atkbd_isa.c 1.3 isa/syscons_isa.c 1.2 Submitted by: Takahashi Yoshihiro <nyan@wyvern.cc.kogakuin.ac.jp>
This commit is contained in:
parent
c6f819b927
commit
c55a92c639
@ -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.58 1999/04/07 09:28:03 grog Exp $
|
||||
# $Id: Makefile.pc98,v 1.59 1999/04/11 03:40:11 grog Exp $
|
||||
#
|
||||
# Makefile for FreeBSD
|
||||
#
|
||||
@ -19,7 +19,7 @@
|
||||
#
|
||||
|
||||
# Which version of config(8) is required.
|
||||
%VERSREQ= 300010
|
||||
%VERSREQ= 400013
|
||||
|
||||
KERNFORMAT?= elf
|
||||
|
||||
@ -89,6 +89,7 @@ SYSTEM_DEP= Makefile symbols.exclude symbols.sort ${SYSTEM_OBJS}
|
||||
SYMORDER_EXCLUDE=-x symbols.exclude
|
||||
.endif
|
||||
SYSTEM_LD_HEAD= @echo loading ${.TARGET}; rm -f ${.TARGET}
|
||||
|
||||
.if ${KERNFORMAT} == aout || ${KERNFORMAT} == aoutkld
|
||||
SYSTEM_OBJS= locore.o vnode_if.o ${OBJS} ioconf.o param.o config.o
|
||||
SYSTEM_LD= @${LD} -aout -Bforcedynamic -Z -T ${LOAD_ADDRESS} -o ${.TARGET} -X ${SYSTEM_OBJS} vers.o
|
||||
@ -96,6 +97,7 @@ SYSTEM_LD_TAIL= @echo rearranging symbols; \
|
||||
symorder -m ${SYMORDER_EXCLUDE} symbols.sort ${.TARGET}; \
|
||||
size -aout ${.TARGET} ; chmod 755 ${.TARGET}
|
||||
.endif
|
||||
|
||||
.if ${KERNFORMAT} == elf
|
||||
SYSTEM_OBJS= locore.o setdef0.o vnode_if.o ${OBJS} ioconf.o param.o config.o \
|
||||
setdef1.o hack.So
|
||||
@ -106,6 +108,12 @@ SYSTEM_LD_TAIL= @size -elf ${.TARGET} ; chmod 755 ${.TARGET}
|
||||
SYSTEM_DEP+= $S/i386/conf/kernel.script
|
||||
.endif
|
||||
|
||||
.if defined(DEBUG)
|
||||
FULLKERNEL= ${KERNEL}.debug
|
||||
.else
|
||||
FULLKERNEL= ${KERNEL}
|
||||
.endif
|
||||
|
||||
%BEFORE_DEPEND
|
||||
|
||||
%OBJS
|
||||
@ -209,17 +217,20 @@ tags:
|
||||
@echo "see $S/kern/Makefile for tags"
|
||||
|
||||
.if defined(DEBUG)
|
||||
install: ${KERNEL}
|
||||
.if ${KERNFORMAT} == "elf" && !defined(FORCE)
|
||||
@if [ -f /${KERNEL} -a "`file /${KERNEL} 2>/dev/null | grep ELF`" = "" ]; then \
|
||||
echo "WARNING: You are about to install an ELF kernel for the first time!" ; \
|
||||
echo "Please be sure you have upgraded your bootblocks and/or /boot/loader so" ; \
|
||||
echo "that you can boot it. Old bootblocks WILL NOT WORK! Please read:" ; \
|
||||
echo "http://www.freebsd.org/~peter/elfday.html for information." ; \
|
||||
echo "If you are satisfied you can boot an ELF kernel, type: make -DFORCE install" ; \
|
||||
${KERNEL}: ${FULLKERNEL}
|
||||
.if ${KERNFORMAT} == "elf"
|
||||
objcopy --strip-debug ${FULLKERNEL} ${KERNEL}
|
||||
.else
|
||||
cp ${FULLKERNEL} ${KERNEL}
|
||||
strip -d kernel
|
||||
.endif
|
||||
.endif
|
||||
|
||||
install install.debug:
|
||||
@if [ ! -f ${KERNEL}${.TARGET:S/install//} ] ; then \
|
||||
echo "You must first build a kernel first." ; \
|
||||
exit 1 ; \
|
||||
fi
|
||||
.endif
|
||||
.if exists(${DESTDIR}/${KERNEL})
|
||||
-chflags noschg ${DESTDIR}/${KERNEL}
|
||||
mv ${DESTDIR}/${KERNEL} ${DESTDIR}/${KERNEL}.old
|
||||
@ -231,37 +242,8 @@ install: ${KERNEL}
|
||||
mv -f /var/db/kvm_kernel.db /var/db/kvm_kernel.old.db ; \
|
||||
fi \
|
||||
fi
|
||||
install -c -m 555 -o root -g wheel -fschg ${KERNEL} ${DESTDIR}/
|
||||
|
||||
.endif
|
||||
|
||||
${INSTALL}:
|
||||
@if [ ! -f ${KERNEL} ] ; then \
|
||||
echo "You must first build your kernel before trying to install." ; \
|
||||
exit 1 ; \
|
||||
fi
|
||||
.if ${KERNFORMAT} == "elf" && !defined(FORCE)
|
||||
@if [ -f /${KERNEL} -a "`file /${KERNEL} 2>/dev/null | grep ELF`" = "" ]; then \
|
||||
echo "WARNING: You are about to install an ELF kernel for the first time!" ; \
|
||||
echo "Please be sure you have upgraded your bootblocks and/or /boot/loader so" ; \
|
||||
echo "that you can boot it. Old bootblocks WILL NOT WORK! Please read:" ; \
|
||||
echo "http://www.freebsd.org/~peter/elfday.html for information." ; \
|
||||
echo "If you are satisfied you can boot an ELF kernel, type: make -DFORCE install" ; \
|
||||
exit 1 ; \
|
||||
fi
|
||||
.endif
|
||||
.if exists(${DESTDIR}/${KERNEL})
|
||||
-chflags noschg ${DESTDIR}/${KERNEL}
|
||||
mv ${DESTDIR}/${KERNEL} ${DESTDIR}/${KERNEL}.old
|
||||
.endif
|
||||
PATH=$${PATH}:/sbin:/usr/sbin; \
|
||||
if [ `sysctl -n kern.bootfile` = ${DESTDIR}/${KERNEL} ] ; then \
|
||||
sysctl -w kern.bootfile=${DESTDIR}/${KERNEL}.old ; \
|
||||
if [ -f /var/db/kvm_kernel.db ] ; then \
|
||||
mv -f /var/db/kvm_kernel.db /var/db/kvm_kernel.old.db ; \
|
||||
fi \
|
||||
fi
|
||||
install -c -m 555 -o root -g wheel -fschg ${FULLKERNEL} ${DESTDIR}/${KERNEL}
|
||||
install -c -m 555 -o root -g wheel -fschg \
|
||||
${KERNEL}${.TARGET:S/install//} ${DESTDIR}/${KERNEL}
|
||||
|
||||
config.o:
|
||||
${NORMAL_C}
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
# modified for PC-9801
|
||||
#
|
||||
# $Id: files.pc98,v 1.88 1999/04/02 08:51:06 kato Exp $
|
||||
# $Id: files.pc98,v 1.89 1999/04/10 04:42:46 kato Exp $
|
||||
#
|
||||
# The long compile-with and dependency lines are required because of
|
||||
# limitations in config: backslash-newline doesn't work in strings, and
|
||||
@ -26,6 +26,16 @@ font8x16.o optional std8x16font \
|
||||
no-implicit-rule before-depend \
|
||||
clean "${STD8X16FONT}-8x16 font8x16.c"
|
||||
#
|
||||
atkbdmap.h optional atkbd_dflt_keymap \
|
||||
compile-with "kbdcontrol -L ${ATKBD_DFLT_KEYMAP} | sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static accentmap_t.* = /static accentmap_t accent_map = /' > atkbdmap.h" \
|
||||
no-obj no-implicit-rule before-depend \
|
||||
clean "atkbdmap.h"
|
||||
#
|
||||
ukbdmap.h optional ukbd_dflt_keymap \
|
||||
compile-with "kbdcontrol -L ${UKBD_DFLT_KEYMAP} | sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static accentmap_t.* = /static accentmap_t accent_map = /' > ukbdmap.h" \
|
||||
no-obj no-implicit-rule before-depend \
|
||||
clean "ukbdmap.h"
|
||||
#
|
||||
dev/ata/ata-all.c optional ata device-driver
|
||||
dev/ata/ata-dma.c optional ata device-driver
|
||||
dev/ata/atapi-all.c optional ata device-driver
|
||||
@ -43,7 +53,7 @@ i386/apm/apm_setup.s optional apm
|
||||
i386/eisa/dpt_eisa.c optional eisa dpt device-driver
|
||||
i386/eisa/3c5x9.c optional ep device-driver
|
||||
#i386/eisa/adv_eisa.c optional adv device-driver
|
||||
i386/eisa/ahc_eisa.c optional ahc device-driver \
|
||||
i386/eisa/ahc_eisa.c optional eisa ahc device-driver \
|
||||
dependency "aic7xxx_reg.h $S/i386/eisa/ahc_eisa.c"
|
||||
i386/eisa/ahb.c optional ahb device-driver
|
||||
i386/eisa/bt_eisa.c optional bt device-driver
|
||||
@ -76,12 +86,14 @@ i386/i386/mp_machdep.c optional smp
|
||||
i386/i386/mpapic.c optional smp
|
||||
i386/i386/mpboot.s optional smp
|
||||
i386/i386/mplock.s optional smp
|
||||
i386/i386/nexus.c standard
|
||||
i386/i386/perfmon.c optional perfmon profiling-routine
|
||||
i386/i386/perfmon.c optional perfmon
|
||||
i386/i386/pmap.c standard
|
||||
i386/i386/procfs_machdep.c standard
|
||||
i386/i386/simplelock.s optional smp
|
||||
i386/i386/support.s standard
|
||||
i386/i386/swapgeneric.c standard
|
||||
i386/i386/swtch.s standard
|
||||
i386/i386/sys_machdep.c standard
|
||||
i386/i386/trap.c standard
|
||||
@ -112,7 +124,7 @@ i386/isa/bs/bs.c optional bs device-driver
|
||||
i386/isa/bs/bsfunc.c optional bs device-driver
|
||||
i386/isa/bs/bshw.c optional bs device-driver
|
||||
i386/isa/bs/bsif.c optional bs device-driver
|
||||
#i386/isa/adv_isa.c optional adv device-driver
|
||||
i386/isa/adv_isa.c optional adv device-driver
|
||||
#i386/isa/aha1542.c optional aha device-driver
|
||||
i386/isa/aha_isa.c optional aha device-driver
|
||||
i386/isa/bt_isa.c optional bt device-driver
|
||||
@ -156,7 +168,7 @@ contrib/dev/oltr/trlldbm.c optional oltr device-driver
|
||||
i386/isa/ipl_funcs.c standard \
|
||||
compile-with "${CC} -c ${CFLAGS} ${DEFINED_PROF:S/^$/-fomit-frame-pointer/} $<"
|
||||
i386/isa/intr_machdep.c standard
|
||||
pc98/pc98/pc98.c optional isa device-driver
|
||||
i386/isa/isa.c optional isa device-driver
|
||||
i386/isa/istallion.c optional stli device-driver
|
||||
i386/isa/joy.c optional joy device-driver
|
||||
pc98/pc98/pc98kbd.c optional pckbd device-driver
|
||||
@ -169,20 +181,22 @@ pc98/pc98/npx.c mandatory npx device-driver
|
||||
pc98/pc98/pc98gdc.c optional gdc device-driver
|
||||
pc98/pc98/pcaudio.c optional pca device-driver
|
||||
i386/isa/matcd/matcd.c optional matcd device-driver
|
||||
i386/isa/isa_compat.c optional isa device-driver
|
||||
pc98/pc98/isa_dma.c optional isa device-driver
|
||||
i386/isa/pcibus.c optional pci device-driver
|
||||
i386/isa/pcicx.c optional ze device-driver
|
||||
i386/isa/pcicx.c optional zp device-driver
|
||||
#i386/isa/pcvt/pcvt_drv.c optional vt device-driver
|
||||
#i386/isa/pcvt/pcvt_ext.c optional vt device-driver
|
||||
#i386/isa/pcvt/pcvt_kbd.c optional vt device-driver
|
||||
#i386/isa/pcvt/pcvt_out.c optional vt device-driver
|
||||
#i386/isa/pcvt/pcvt_sup.c optional vt device-driver
|
||||
#i386/isa/pcvt/pcvt_vtf.c optional vt device-driver
|
||||
i386/isa/pcvt/pcvt_drv.c optional vt device-driver
|
||||
i386/isa/pcvt/pcvt_ext.c optional vt device-driver
|
||||
i386/isa/pcvt/pcvt_kbd.c optional vt device-driver
|
||||
i386/isa/pcvt/pcvt_out.c optional vt device-driver
|
||||
i386/isa/pcvt/pcvt_sup.c optional vt device-driver
|
||||
i386/isa/pcvt/pcvt_vtf.c optional vt device-driver
|
||||
i386/isa/pnp.c optional pnp device-driver
|
||||
i386/isa/prof_machdep.c optional profiling-routine
|
||||
i386/isa/ppc.c optional ppc device-driver
|
||||
i386/isa/pcf.c optional pcf device-driver
|
||||
i386/isa/psm.c optional psm device-driver
|
||||
isa/psm.c optional psm device-driver
|
||||
i386/isa/random_machdep.c standard
|
||||
i386/isa/rc.c optional rc device-driver
|
||||
i386/isa/rp.c optional rp device-driver
|
||||
@ -264,13 +278,10 @@ pc98/pc98/spkr.c optional speaker device-driver
|
||||
i386/isa/stallion.c optional stl device-driver
|
||||
pc98/pc98/syscons.c optional sc device-driver
|
||||
pc98/pc98/scvidctl.c optional sc device-driver
|
||||
#i386/isa/scvesactl.c optional sc device-driver
|
||||
#i386/isa/videoio.c optional sc device-driver
|
||||
#i386/isa/vesa.c optional sc device-driver
|
||||
i386/isa/tw.c optional tw device-driver
|
||||
pc98/pc98/wd.c optional wdc device-driver
|
||||
pc98/pc98/wd.c optional wd device-driver
|
||||
i386/isa/atapi.c optional atapi device-driver
|
||||
i386/isa/atapi.c optional wdc device-driver
|
||||
i386/isa/atapi-cd.c optional wcd device-driver
|
||||
i386/isa/wfd.c optional wfd device-driver
|
||||
i386/isa/wst.c optional wst device-driver
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $Id: options.pc98,v 1.82 1999/03/10 14:51:52 kato Exp $
|
||||
# $Id: options.pc98,v 1.83 1999/03/17 09:00:33 kato Exp $
|
||||
|
||||
DISABLE_PSE
|
||||
IDE_DELAY
|
||||
@ -75,8 +75,6 @@ SC_MOUSE_CHAR opt_syscons.h
|
||||
|
||||
FB_INSTALL_CDEV opt_fb.h
|
||||
|
||||
VESA opt_vesa.h
|
||||
|
||||
GDC opt_gdc.h
|
||||
|
||||
PSM_HOOKAPM opt_psm.h
|
||||
@ -92,11 +90,6 @@ KBD_MAXWAIT opt_kbd.h
|
||||
KBD_RESETDELAY opt_kbd.h
|
||||
KBDIO_DEBUG opt_kbd.h
|
||||
|
||||
ATAPI opt_atapi.h
|
||||
ATAPI_STATIC opt_atapi.h
|
||||
|
||||
CMD640 opt_wd.h
|
||||
|
||||
USERCONFIG opt_userconfig.h
|
||||
VISUAL_USERCONFIG opt_userconfig.h
|
||||
INTRO_USERCONFIG opt_userconfig.h
|
||||
|
560
sys/pc98/cbus/cbus_dma.c
Normal file
560
sys/pc98/cbus/cbus_dma.c
Normal file
@ -0,0 +1,560 @@
|
||||
/*-
|
||||
* Copyright (c) 1991 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* William Jolitz.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)isa.c 7.2 (Berkeley) 5/13/91
|
||||
* $Id: isa_dma.c,v 1.1 1999/04/16 21:22:24 peter Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* code to manage AT bus
|
||||
*
|
||||
* 92/08/18 Frank P. MacLachlan (fpm@crash.cts.com):
|
||||
* Fixed uninitialized variable problem and added code to deal
|
||||
* with DMA page boundaries in isa_dmarangecheck(). Fixed word
|
||||
* mode DMA count compution and reorganized DMA setup code in
|
||||
* isa_dmastart()
|
||||
*/
|
||||
|
||||
#ifdef PC98
|
||||
#include "opt_pc98.h"
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/buf.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <machine/ipl.h>
|
||||
#include <machine/md_var.h>
|
||||
#ifdef APIC_IO
|
||||
#include <machine/smp.h>
|
||||
#endif /* APIC_IO */
|
||||
#include <vm/vm.h>
|
||||
#include <vm/vm_param.h>
|
||||
#include <vm/pmap.h>
|
||||
#include <i386/isa/isa_device.h>
|
||||
#include <i386/isa/intr_machdep.h>
|
||||
#ifdef PC98
|
||||
#include <pc98/pc98/pc98.h>
|
||||
#else
|
||||
#include <i386/isa/isa.h>
|
||||
#endif
|
||||
#include <i386/isa/ic/i8237.h>
|
||||
|
||||
#include <sys/interrupt.h>
|
||||
|
||||
#include "pnp.h"
|
||||
#if NPNP > 0
|
||||
#include <i386/isa/pnp.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Register definitions for DMA controller 1 (channels 0..3):
|
||||
*/
|
||||
#ifdef PC98
|
||||
#define DMA1_CHN(c) (IO_DMA + (4*(c))) /* addr reg for channel c */
|
||||
#define DMA1_SMSK (IO_DMA + 0x14) /* single mask register */
|
||||
#define DMA1_MODE (IO_DMA + 0x16) /* mode register */
|
||||
#define DMA1_FFC (IO_DMA + 0x18) /* clear first/last FF */
|
||||
#else
|
||||
#define DMA1_CHN(c) (IO_DMA1 + 1*(2*(c))) /* addr reg for channel c */
|
||||
#define DMA1_SMSK (IO_DMA1 + 1*10) /* single mask register */
|
||||
#define DMA1_MODE (IO_DMA1 + 1*11) /* mode register */
|
||||
#define DMA1_FFC (IO_DMA1 + 1*12) /* clear first/last FF */
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Register definitions for DMA controller 2 (channels 4..7):
|
||||
*/
|
||||
#define DMA2_CHN(c) (IO_DMA2 + 2*(2*(c))) /* addr reg for channel c */
|
||||
#define DMA2_SMSK (IO_DMA2 + 2*10) /* single mask register */
|
||||
#define DMA2_MODE (IO_DMA2 + 2*11) /* mode register */
|
||||
#define DMA2_FFC (IO_DMA2 + 2*12) /* clear first/last FF */
|
||||
|
||||
static int isa_dmarangecheck __P((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[8] = { 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.
|
||||
*/
|
||||
void
|
||||
isa_dmainit(chan, bouncebufsize)
|
||||
int chan;
|
||||
u_int bouncebufsize;
|
||||
{
|
||||
void *buf;
|
||||
|
||||
#ifdef DIAGNOSTIC
|
||||
if (chan & ~VALID_DMA_MASK)
|
||||
panic("isa_dmainit: channel out of range");
|
||||
|
||||
if (dma_bouncebuf[chan] != NULL)
|
||||
panic("isa_dmainit: impossible request");
|
||||
#endif
|
||||
|
||||
dma_bouncebufsize[chan] = bouncebufsize;
|
||||
|
||||
/* Try malloc() first. It works better if it works. */
|
||||
buf = malloc(bouncebufsize, M_DEVBUF, M_NOWAIT);
|
||||
if (buf != NULL) {
|
||||
if (isa_dmarangecheck(buf, bouncebufsize, chan) == 0) {
|
||||
dma_bouncebuf[chan] = buf;
|
||||
return;
|
||||
}
|
||||
free(buf, M_DEVBUF);
|
||||
}
|
||||
buf = contigmalloc(bouncebufsize, M_DEVBUF, M_NOWAIT, 0ul, 0xfffffful,
|
||||
1ul, chan & 4 ? 0x20000ul : 0x10000ul);
|
||||
if (buf == NULL)
|
||||
printf("isa_dmainit(%d, %d) failed\n", chan, bouncebufsize);
|
||||
else
|
||||
dma_bouncebuf[chan] = buf;
|
||||
}
|
||||
|
||||
/*
|
||||
* Register a DMA channel's usage. Usually called from a device driver
|
||||
* in open() or during its initialization.
|
||||
*/
|
||||
int
|
||||
isa_dma_acquire(chan)
|
||||
int chan;
|
||||
{
|
||||
#ifdef DIAGNOSTIC
|
||||
if (chan & ~VALID_DMA_MASK)
|
||||
panic("isa_dma_acquire: channel out of range");
|
||||
#endif
|
||||
|
||||
if (dma_inuse & (1 << chan)) {
|
||||
printf("isa_dma_acquire: channel %d already in use\n", chan);
|
||||
return (EBUSY);
|
||||
}
|
||||
dma_inuse |= (1 << chan);
|
||||
dma_auto_mode &= ~(1 << chan);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Unregister a DMA channel's usage. Usually called from a device driver
|
||||
* during close() or during its shutdown.
|
||||
*/
|
||||
void
|
||||
isa_dma_release(chan)
|
||||
int chan;
|
||||
{
|
||||
#ifdef DIAGNOSTIC
|
||||
if (chan & ~VALID_DMA_MASK)
|
||||
panic("isa_dma_release: channel out of range");
|
||||
|
||||
if ((dma_inuse & (1 << chan)) == 0)
|
||||
printf("isa_dma_release: channel %d not in use\n", chan);
|
||||
#endif
|
||||
|
||||
if (dma_busy & (1 << chan)) {
|
||||
dma_busy &= ~(1 << chan);
|
||||
/*
|
||||
* XXX We should also do "dma_bounced &= (1 << chan);"
|
||||
* because we are acting on behalf of isa_dmadone() which
|
||||
* was not called to end the last DMA operation. This does
|
||||
* not matter now, but it may in the future.
|
||||
*/
|
||||
}
|
||||
|
||||
dma_inuse &= ~(1 << 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.
|
||||
*/
|
||||
void
|
||||
isa_dmastart(int flags, caddr_t addr, u_int nbytes, int chan)
|
||||
{
|
||||
vm_offset_t phys;
|
||||
int waport;
|
||||
caddr_t newaddr;
|
||||
|
||||
#ifdef DIAGNOSTIC
|
||||
if (chan & ~VALID_DMA_MASK)
|
||||
panic("isa_dmastart: channel out of range");
|
||||
|
||||
if ((chan < 4 && nbytes > (1<<16))
|
||||
|| (chan >= 4 && (nbytes > (1<<17) || (u_int)addr & 1)))
|
||||
panic("isa_dmastart: impossible request");
|
||||
|
||||
if ((dma_inuse & (1 << chan)) == 0)
|
||||
printf("isa_dmastart: channel %d not acquired\n", chan);
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* XXX This should be checked, but drivers like ad1848 only call
|
||||
* isa_dmastart() once because they use Auto DMA mode. If we
|
||||
* leave this in, drivers that do this will print this continuously.
|
||||
*/
|
||||
if (dma_busy & (1 << chan))
|
||||
printf("isa_dmastart: channel %d busy\n", chan);
|
||||
#endif
|
||||
|
||||
dma_busy |= (1 << chan);
|
||||
|
||||
if (isa_dmarangecheck(addr, nbytes, chan)) {
|
||||
if (dma_bouncebuf[chan] == NULL
|
||||
|| dma_bouncebufsize[chan] < nbytes)
|
||||
panic("isa_dmastart: bad bounce buffer");
|
||||
dma_bounced |= (1 << chan);
|
||||
newaddr = dma_bouncebuf[chan];
|
||||
|
||||
/* copy bounce buffer on write */
|
||||
if (!(flags & B_READ))
|
||||
bcopy(addr, newaddr, nbytes);
|
||||
addr = newaddr;
|
||||
}
|
||||
|
||||
/* translate to physical */
|
||||
phys = pmap_extract(pmap_kernel(), (vm_offset_t)addr);
|
||||
|
||||
if (flags & B_RAW) {
|
||||
dma_auto_mode |= (1 << chan);
|
||||
} else {
|
||||
dma_auto_mode &= ~(1 << chan);
|
||||
}
|
||||
|
||||
#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 */
|
||||
|
||||
/* If B_RAW flag is set, then use autoinitialise mode */
|
||||
if (flags & B_RAW) {
|
||||
if (flags & B_READ)
|
||||
outb(DMA1_MODE, DMA37MD_AUTO|DMA37MD_WRITE|chan);
|
||||
else
|
||||
outb(DMA1_MODE, DMA37MD_AUTO|DMA37MD_READ|chan);
|
||||
}
|
||||
else
|
||||
if (flags & B_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 */
|
||||
outb(waport + 1, --nbytes);
|
||||
outb(waport + 1, nbytes>>8);
|
||||
|
||||
/* 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 B_RAW flag is set, then use autoinitialise mode */
|
||||
if (flags & B_RAW) {
|
||||
if (flags & B_READ)
|
||||
outb(DMA2_MODE, DMA37MD_AUTO|DMA37MD_WRITE|(chan&3));
|
||||
else
|
||||
outb(DMA2_MODE, DMA37MD_AUTO|DMA37MD_READ|(chan&3));
|
||||
}
|
||||
else
|
||||
if (flags & B_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
|
||||
}
|
||||
|
||||
void
|
||||
isa_dmadone(int flags, caddr_t addr, int nbytes, int chan)
|
||||
{
|
||||
#ifdef DIAGNOSTIC
|
||||
if (chan & ~VALID_DMA_MASK)
|
||||
panic("isa_dmadone: channel out of range");
|
||||
|
||||
if ((dma_inuse & (1 << chan)) == 0)
|
||||
printf("isa_dmadone: channel %d not acquired\n", chan);
|
||||
#endif
|
||||
|
||||
if (((dma_busy & (1 << chan)) == 0) &&
|
||||
(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 */
|
||||
if (flags & B_READ)
|
||||
bcopy(dma_bouncebuf[chan], addr, nbytes);
|
||||
|
||||
dma_bounced &= ~(1 << chan);
|
||||
}
|
||||
dma_busy &= ~(1 << chan);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check for problems with the address range of a DMA transfer
|
||||
* (non-contiguous physical pages, outside of bus address space,
|
||||
* crossing DMA page boundaries).
|
||||
* Return true if special handling needed.
|
||||
*/
|
||||
|
||||
static int
|
||||
isa_dmarangecheck(caddr_t va, u_int length, int chan)
|
||||
{
|
||||
vm_offset_t phys, priorpage = 0, endva;
|
||||
u_int dma_pgmsk = (chan & 4) ? ~(128*1024-1) : ~(64*1024-1);
|
||||
|
||||
endva = (vm_offset_t)round_page((vm_offset_t)va + length);
|
||||
for (; va < (caddr_t) endva ; va += PAGE_SIZE) {
|
||||
phys = trunc_page(pmap_extract(pmap_kernel(), (vm_offset_t)va));
|
||||
#ifdef EPSON_BOUNCEDMA
|
||||
#define ISARAM_END 0xf00000
|
||||
#else
|
||||
#define ISARAM_END RAM_END
|
||||
#endif
|
||||
if (phys == 0)
|
||||
panic("isa_dmacheck: no physical page present");
|
||||
if (phys >= ISARAM_END)
|
||||
return (1);
|
||||
if (priorpage) {
|
||||
if (priorpage + PAGE_SIZE != phys)
|
||||
return (1);
|
||||
/* check if crossing a DMA page boundary */
|
||||
if (((u_int)priorpage ^ (u_int)phys) & dma_pgmsk)
|
||||
return (1);
|
||||
}
|
||||
priorpage = phys;
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Query the progress of a transfer on a DMA channel.
|
||||
*
|
||||
* To avoid having to interrupt a transfer in progress, we sample
|
||||
* each of the high and low databytes twice, and apply the following
|
||||
* logic to determine the correct count.
|
||||
*
|
||||
* Reads are performed with interrupts disabled, thus it is to be
|
||||
* expected that the time between reads is very small. At most
|
||||
* one rollover in the low count byte can be expected within the
|
||||
* four reads that are performed.
|
||||
*
|
||||
* There are three gaps in which a rollover can occur :
|
||||
*
|
||||
* - read low1
|
||||
* gap1
|
||||
* - read high1
|
||||
* gap2
|
||||
* - read low2
|
||||
* gap3
|
||||
* - read high2
|
||||
*
|
||||
* If a rollover occurs in gap1 or gap2, the low2 value will be
|
||||
* greater than the low1 value. In this case, low2 and high2 are a
|
||||
* corresponding pair.
|
||||
*
|
||||
* In any other case, low1 and high1 can be considered to be correct.
|
||||
*
|
||||
* The function returns the number of bytes remaining in the transfer,
|
||||
* or -1 if the channel requested is not active.
|
||||
*
|
||||
*/
|
||||
int
|
||||
isa_dmastatus(int chan)
|
||||
{
|
||||
u_long cnt = 0;
|
||||
int ffport, waport;
|
||||
u_long low1, high1, low2, high2;
|
||||
|
||||
/* channel active? */
|
||||
if ((dma_inuse & (1 << chan)) == 0) {
|
||||
printf("isa_dmastatus: channel %d not active\n", chan);
|
||||
return(-1);
|
||||
}
|
||||
/* channel busy? */
|
||||
|
||||
if (((dma_busy & (1 << chan)) == 0) &&
|
||||
(dma_auto_mode & (1 << chan)) == 0 ) {
|
||||
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 */
|
||||
low1 = inb(waport);
|
||||
high1 = inb(waport);
|
||||
outb(ffport, 0); /* clear again */
|
||||
low2 = inb(waport);
|
||||
high2 = inb(waport);
|
||||
enable_intr(); /* enable interrupts again */
|
||||
|
||||
/*
|
||||
* Now decide if a wrap has tried to skew our results.
|
||||
* Note that after TC, the count will read 0xffff, while we want
|
||||
* to return zero, so we add and then mask to compensate.
|
||||
*/
|
||||
if (low1 >= low2) {
|
||||
cnt = (low1 + (high1 << 8) + 1) & 0xffff;
|
||||
} else {
|
||||
cnt = (low2 + (high2 << 8) + 1) & 0xffff;
|
||||
}
|
||||
|
||||
if (chan >= 4) /* high channels move words */
|
||||
cnt *= 2;
|
||||
return(cnt);
|
||||
}
|
||||
|
||||
/*
|
||||
* Stop a DMA transfer currently in progress.
|
||||
*/
|
||||
int
|
||||
isa_dmastop(int chan)
|
||||
{
|
||||
if ((dma_inuse & (1 << chan)) == 0)
|
||||
printf("isa_dmastop: channel %d not acquired\n", chan);
|
||||
|
||||
if (((dma_busy & (1 << chan)) == 0) &&
|
||||
((dma_auto_mode & (1 << chan)) == 0)) {
|
||||
printf("chan %d not busy\n", chan);
|
||||
return -2 ;
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
1453
sys/pc98/cbus/fdc.c
1453
sys/pc98/cbus/fdc.c
File diff suppressed because it is too large
Load Diff
@ -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: pc98gdc.c,v 1.5 1999/02/06 09:30:19 kato Exp $
|
||||
* $Id: pc98gdc.c,v 1.6 1999/03/02 12:34:24 kato Exp $
|
||||
*/
|
||||
|
||||
#include "gdc.h"
|
||||
@ -52,8 +52,7 @@
|
||||
|
||||
#include <pc98/pc98/pc98.h>
|
||||
#include <pc98/pc98/pc98_machdep.h>
|
||||
|
||||
#include <i386/isa/isa_device.h>
|
||||
#include <isa/isavar.h>
|
||||
|
||||
#define TEXT_GDC IO_GDC1 /* 0x60 */
|
||||
#define ROW 25
|
||||
@ -66,27 +65,36 @@
|
||||
#define GDC_UNIT(dev) minor(dev)
|
||||
#define GDC_MKMINOR(unit) (unit)
|
||||
|
||||
static int gdcprobe(struct isa_device *dev);
|
||||
static int gdc_attach(struct isa_device *dev);
|
||||
|
||||
struct isa_driver gdcdriver = {
|
||||
gdcprobe,
|
||||
gdc_attach,
|
||||
DRIVER_NAME,
|
||||
0,
|
||||
};
|
||||
|
||||
typedef struct gdc_softc {
|
||||
video_adapter_t *adp;
|
||||
} gdc_softc_t;
|
||||
|
||||
#define GDC_SOFTC(unit) \
|
||||
((gdc_softc_t *)devclass_get_softc(gdc_devclass, unit))
|
||||
|
||||
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,
|
||||
DRIVER_TYPE_TTY,
|
||||
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);
|
||||
|
||||
#define GDC_SOFTC(unit) (gdc_softc[unit])
|
||||
|
||||
static gdc_softc_t *gdc_softc[NGDC];
|
||||
|
||||
#if FB_INSTALL_CDEV
|
||||
|
||||
static d_open_t gdcopen;
|
||||
@ -104,44 +112,22 @@ static struct cdevsw vga_cdevsw = {
|
||||
#endif /* FB_INSTALL_CDEV */
|
||||
|
||||
static int
|
||||
gdcprobe(struct isa_device *dev)
|
||||
gdcprobe(device_t dev)
|
||||
{
|
||||
gdc_softc_t *sc;
|
||||
int error;
|
||||
|
||||
if (dev->id_unit >= sizeof(gdc_softc)/sizeof(gdc_softc[0]))
|
||||
return 0;
|
||||
sc = gdc_softc[dev->id_unit]
|
||||
= malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT);
|
||||
if (sc == NULL)
|
||||
return 0;
|
||||
|
||||
error = gdc_probe_unit(dev->id_unit, sc, dev->id_flags);
|
||||
if (error) {
|
||||
gdc_softc[dev->id_unit] = NULL;
|
||||
free(sc, M_DEVBUF);
|
||||
return 0;
|
||||
}
|
||||
|
||||
dev->id_iobase = sc->adp->va_io_base;
|
||||
dev->id_maddr = (caddr_t)BIOS_PADDRTOVADDR(sc->adp->va_mem_base);
|
||||
dev->id_msize = sc->adp->va_mem_size;
|
||||
|
||||
return sc->adp->va_io_size;
|
||||
device_set_desc(dev, "Generic GDC");
|
||||
sc = device_get_softc(dev);
|
||||
return gdc_probe_unit(device_get_unit(dev), sc, isa_get_flags(dev));
|
||||
}
|
||||
|
||||
static int
|
||||
gdc_attach(struct isa_device *dev)
|
||||
gdc_attach(device_t dev)
|
||||
{
|
||||
gdc_softc_t *sc;
|
||||
|
||||
if (dev->id_unit >= sizeof(gdc_softc)/sizeof(gdc_softc[0]))
|
||||
return 0;
|
||||
sc = gdc_softc[dev->id_unit];
|
||||
if (sc == NULL)
|
||||
return 0;
|
||||
|
||||
return ((gdc_attach_unit(dev->id_unit, sc, dev->id_flags)) ? 0 : 1);
|
||||
sc = device_get_softc(dev);
|
||||
return gdc_attach_unit(device_get_unit(dev), sc, isa_get_flags(dev));
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -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: pc98kbd.c,v 1.4 1999/01/19 14:08:04 kato Exp $
|
||||
* $Id: pc98kbd.c,v 1.5 1999/03/10 14:51:53 kato Exp $
|
||||
*/
|
||||
|
||||
#include "pckbd.h"
|
||||
@ -39,10 +39,13 @@
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/tty.h>
|
||||
#include <sys/fcntl.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/bus.h>
|
||||
#include <machine/bus.h>
|
||||
#include <sys/rman.h>
|
||||
|
||||
#include <machine/resource.h>
|
||||
|
||||
@ -51,6 +54,9 @@
|
||||
#include <pc98/pc98/pc98.h>
|
||||
#include <pc98/pc98/pc98_machdep.h>
|
||||
|
||||
#include <isa/isavar.h>
|
||||
#include <machine/lock.h>
|
||||
|
||||
#ifdef __i386__
|
||||
#include <i386/isa/isa_device.h>
|
||||
#endif
|
||||
@ -76,23 +82,30 @@ typedef struct pckbd_softc {
|
||||
} pckbd_softc_t;
|
||||
|
||||
#define PC98KBD_SOFTC(unit) \
|
||||
(((unit) >= NPCKBD) ? NULL : pckbd_softc[(unit)])
|
||||
((pckbd_softc_t)devclass_get_softc(pckbd_devclass, unit))
|
||||
|
||||
static pckbd_softc_t *pckbd_softc[NPCKBD];
|
||||
static devclass_t pckbd_devclass;
|
||||
|
||||
static int pckbdprobe(struct isa_device *dev);
|
||||
static int pckbdattach(struct isa_device *dev);
|
||||
static int pckbdprobe(device_t dev);
|
||||
static int pckbdattach(device_t dev);
|
||||
static void pckbd_isa_intr(void *arg);
|
||||
|
||||
static ointhand2_t pckbd_isa_intr;
|
||||
|
||||
/* driver declaration for isa_devtab_tty[] */
|
||||
struct isa_driver pckbddriver = {
|
||||
pckbdprobe,
|
||||
pckbdattach,
|
||||
DRIVER_NAME,
|
||||
0,
|
||||
static device_method_t pckbd_methods[] = {
|
||||
/* Device interface */
|
||||
DEVMETHOD(device_probe, pckbdprobe),
|
||||
DEVMETHOD(device_attach, pckbdattach),
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static driver_t pckbd_driver = {
|
||||
DRIVER_NAME,
|
||||
pckbd_methods,
|
||||
DRIVER_TYPE_TTY,
|
||||
sizeof(pckbd_softc_t),
|
||||
};
|
||||
|
||||
DRIVER_MODULE(pckbd, isa, pckbd_driver, pckbd_devclass, 0, 0);
|
||||
|
||||
static int pckbd_probe_unit(int unit, int port, int irq,
|
||||
int flags);
|
||||
static int pckbd_attach_unit(int unit, pckbd_softc_t *sc,
|
||||
@ -117,36 +130,41 @@ static struct cdevsw pckbd_cdevsw = {
|
||||
#endif /* KBD_INSTALL_CDEV */
|
||||
|
||||
static int
|
||||
pckbdprobe(struct isa_device *dev)
|
||||
pckbdprobe(device_t dev)
|
||||
{
|
||||
return ((pckbd_probe_unit(dev->id_unit, dev->id_iobase, dev->id_irq,
|
||||
dev->id_flags)) ? 0 : IO_KBDSIZE);
|
||||
device_set_desc(dev, "PC-98 Keyboard");
|
||||
|
||||
return pckbd_probe_unit(device_get_unit(dev), isa_get_port(dev),
|
||||
(1 << isa_get_irq(dev)), isa_get_flags(dev));
|
||||
}
|
||||
|
||||
static int
|
||||
pckbdattach(struct isa_device *dev)
|
||||
pckbdattach(device_t dev)
|
||||
{
|
||||
pckbd_softc_t *sc;
|
||||
void *ih;
|
||||
struct resource *res;
|
||||
int zero = 0;
|
||||
|
||||
if (dev->id_unit >= sizeof(pckbd_softc)/sizeof(pckbd_softc[0]))
|
||||
return 0;
|
||||
sc = pckbd_softc[dev->id_unit]
|
||||
= malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT);
|
||||
if (sc == NULL)
|
||||
return 0;
|
||||
pckbd_softc_t *sc = device_get_softc(dev);
|
||||
bzero(sc, sizeof(*sc));
|
||||
|
||||
dev->id_ointr = pckbd_isa_intr;
|
||||
return ((pckbd_attach_unit(dev->id_unit, sc, dev->id_iobase,
|
||||
dev->id_irq, dev->id_flags)) ? 0 : 1);
|
||||
pckbd_attach_unit(device_get_unit(dev), sc, isa_get_port(dev),
|
||||
(1 << isa_get_irq(dev)), isa_get_flags(dev));
|
||||
|
||||
res = bus_alloc_resource(dev, SYS_RES_IRQ, &zero, 0ul, ~0ul, 1,
|
||||
RF_SHAREABLE | RF_ACTIVE);
|
||||
BUS_SETUP_INTR(device_get_parent(dev), dev, res, pckbd_isa_intr,
|
||||
sc, &ih);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void
|
||||
pckbd_isa_intr(int unit)
|
||||
pckbd_isa_intr(void *arg)
|
||||
{
|
||||
keyboard_t *kbd;
|
||||
pckbd_softc_t *sc = arg;
|
||||
keyboard_t *kbd = sc->kbd;
|
||||
|
||||
kbd = pckbd_softc[unit]->kbd;
|
||||
(*kbdsw[kbd->kb_index]->intr)(kbd, NULL);
|
||||
}
|
||||
|
||||
@ -414,15 +432,14 @@ pckbd_configure(int flags)
|
||||
{
|
||||
keyboard_t *kbd;
|
||||
int arg[2];
|
||||
struct isa_device *dev;
|
||||
int i;
|
||||
|
||||
/* XXX: a kludge to obtain the device configuration flags */
|
||||
dev = find_isadev(isa_devtab_tty, &pckbddriver, 0);
|
||||
if (dev != NULL) {
|
||||
flags |= dev->id_flags;
|
||||
if (resource_int_value(DRIVER_NAME, 0, "flags", &i) == 0) {
|
||||
flags |= i;
|
||||
/* if the driver is disabled, unregister the keyboard if any */
|
||||
if (!dev->id_enabled) {
|
||||
if (resource_int_value(DRIVER_NAME, 0, "disabled", &i) == 0
|
||||
&& i != 0) {
|
||||
i = kbd_find_keyboard(DRIVER_NAME, PC98KBD_DEFAULT);
|
||||
if (i >= 0) {
|
||||
kbd = kbd_get_keyboard(i);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -11,7 +11,7 @@
|
||||
# device lines is present in the ./LINT configuration file. If you are
|
||||
# in doubt as to the purpose or necessity of a line, check first in LINT.
|
||||
#
|
||||
# $Id: GENERIC98,v 1.69 1999/03/17 08:56:28 kato Exp $
|
||||
# $Id: GENERIC98,v 1.70 1999/04/01 13:39:27 kato Exp $
|
||||
|
||||
# GENERIC98 -- Generic PC98 machine with WD/SCSI disks
|
||||
|
||||
@ -23,6 +23,8 @@ cpu "I686_CPU"
|
||||
ident "GENERIC98"
|
||||
maxusers 32
|
||||
|
||||
#makeoptions DEBUG="-g" #Build kernel with gdb(1) debug symbols
|
||||
|
||||
options "PC98" #PC98
|
||||
options MATH_EMULATE #Support for x87 emulation
|
||||
options INET #InterNETworking
|
||||
@ -46,10 +48,6 @@ options FAILSAFE #Be conservative
|
||||
options USERCONFIG #boot -c editor
|
||||
options VISUAL_USERCONFIG #visual boot -c editor
|
||||
|
||||
options SYSVSHM
|
||||
options SYSVSEM
|
||||
options SYSVMSG
|
||||
|
||||
options COM_MULTIPORT
|
||||
|
||||
#
|
||||
@ -67,9 +65,9 @@ config kernel root on wd0
|
||||
#options NAPIC=1 # number of IO APICs
|
||||
#options NINTR=24 # number of INTs
|
||||
|
||||
controller isa0
|
||||
controller pnp0 # PnP support for ISA
|
||||
controller pci0
|
||||
controller isa0 at nexus?
|
||||
#controller pnp0 # PnP support for ISA
|
||||
controller pci0 at nexus?
|
||||
|
||||
controller fdc0 at isa? port "IO_FD1" bio irq 11 drq 2
|
||||
disk fd0 at fdc0 drive 0
|
||||
@ -84,9 +82,8 @@ disk wd0 at wdc0 drive 0
|
||||
#disk wd2 at wdc0 drive 2
|
||||
#disk wd3 at wdc0 drive 3
|
||||
|
||||
options ATAPI #Enable ATAPI support for IDE bus
|
||||
options ATAPI_STATIC #Don't do it as an LKM
|
||||
device wcd0 #IDE CD-ROM
|
||||
#device wfd0 #IDE Floppy (e.g. LS-120)
|
||||
|
||||
# A single entry for any of these controllers (ncr, ahb, ahc) is
|
||||
# sufficient for any number of installed devices.
|
||||
@ -132,16 +129,17 @@ device pckbd0 at isa? port IO_KBD tty irq 1
|
||||
|
||||
device gdc0 at isa?
|
||||
|
||||
#pseudo-device splash
|
||||
# splash screen/screen saver
|
||||
pseudo-device splash
|
||||
|
||||
device sc0 at isa? tty
|
||||
|
||||
device npx0 at isa? port IO_NPX irq 8
|
||||
device npx0 at nexus? port IO_NPX irq 8
|
||||
|
||||
#
|
||||
# Laptop support (see LINT for more options)
|
||||
#
|
||||
device apm0 at isa? disable flags 0x31 # Advanced Power Management
|
||||
device apm0 at nexus? disable flags 0x31 # Advanced Power Management
|
||||
|
||||
# PCCARD (PCMCIA) support
|
||||
#controller card0
|
||||
@ -179,22 +177,21 @@ device sio1 at isa? port 0x238 tty irq 5 flags 0x12000000
|
||||
#device lpt0 at isa? port IO_LPT tty
|
||||
device mse0 at isa? port IO_MSE tty irq 13
|
||||
|
||||
# Order is important here due to intrusive probes, do *not* alphabetize
|
||||
# this list of network interfaces until the probes have been fixed.
|
||||
# Right now it appears that the ie0 must be probed before ep0. See
|
||||
# revision 1.20 of this file.
|
||||
device ax0
|
||||
device de0
|
||||
device fxp0
|
||||
device mx0
|
||||
device pn0
|
||||
device rl0
|
||||
device tl0
|
||||
device tx0
|
||||
device vr0
|
||||
device vx0
|
||||
device wb0
|
||||
device xl0
|
||||
#
|
||||
# The following Ethernet NICs are all PCI devices.
|
||||
#
|
||||
device ax0 # ASIX AX88140A
|
||||
device de0 # DEC/Intel DC21x4x (``Tulip'')
|
||||
device fxp0 # Intel EtherExpress PRO/100B (82557, 82558)
|
||||
device mx0 # Macronix 98713/98715/98725 (``PMAC'')
|
||||
device pn0 # Lite-On 82c168/82c169 (``PNIC'')
|
||||
device rl0 # RealTek 8129/8139
|
||||
device tl0 # Texas Instruments ThunderLAN
|
||||
device tx0 # SMC 9432TX (83c170 ``EPIC'')
|
||||
device vr0 # VIA Rhine, Rhine II
|
||||
device vx0 # 3Com 3c590, 3c595 (``Vortex'')
|
||||
device wb0 # Winbond W89C840F
|
||||
device xl0 # 3Com 3c90x (``Boomerang'', ``Cyclone'')
|
||||
|
||||
#
|
||||
# DP8390 NIC
|
||||
@ -228,7 +225,7 @@ device ep0 at isa? port 0x40d0 net irq 3
|
||||
device fe0 at isa? port 0x00d0 net irq 3
|
||||
device fe1 at isa? port 0x73d0 net irq 5
|
||||
device lnc0 at isa? port 0x03d0 net irq 6
|
||||
device zp0 at isa? port 0x00d0 net irq 10 iomem 0xe0000
|
||||
#device zp0 at isa? port 0x00d0 net irq 10 iomem 0xe0000
|
||||
|
||||
options "FE_8BIT_SUPPORT" # LAC-98 support
|
||||
|
||||
@ -253,6 +250,13 @@ pseudo-device gzip # Exec gzipped a.out's
|
||||
# the costs of each syscall.
|
||||
options KTRACE #kernel tracing
|
||||
|
||||
# This provides support for System V shared memory and message queues.
|
||||
#
|
||||
options SYSVSHM
|
||||
options SYSVMSG
|
||||
options SYSVSEM
|
||||
|
||||
|
||||
# The `bpfilter' pseudo-device enables the Berkeley Packet Filter. Be
|
||||
# aware of the legal and administrative consequences of enabling this
|
||||
# option. The number of devices determines the maximum number of
|
||||
|
@ -11,7 +11,7 @@
|
||||
# device lines is present in the ./LINT configuration file. If you are
|
||||
# in doubt as to the purpose or necessity of a line, check first in LINT.
|
||||
#
|
||||
# $Id: GENERIC98,v 1.69 1999/03/17 08:56:28 kato Exp $
|
||||
# $Id: GENERIC98,v 1.70 1999/04/01 13:39:27 kato Exp $
|
||||
|
||||
# GENERIC98 -- Generic PC98 machine with WD/SCSI disks
|
||||
|
||||
@ -23,6 +23,8 @@ cpu "I686_CPU"
|
||||
ident "GENERIC98"
|
||||
maxusers 32
|
||||
|
||||
#makeoptions DEBUG="-g" #Build kernel with gdb(1) debug symbols
|
||||
|
||||
options "PC98" #PC98
|
||||
options MATH_EMULATE #Support for x87 emulation
|
||||
options INET #InterNETworking
|
||||
@ -46,10 +48,6 @@ options FAILSAFE #Be conservative
|
||||
options USERCONFIG #boot -c editor
|
||||
options VISUAL_USERCONFIG #visual boot -c editor
|
||||
|
||||
options SYSVSHM
|
||||
options SYSVSEM
|
||||
options SYSVMSG
|
||||
|
||||
options COM_MULTIPORT
|
||||
|
||||
#
|
||||
@ -67,9 +65,9 @@ config kernel root on wd0
|
||||
#options NAPIC=1 # number of IO APICs
|
||||
#options NINTR=24 # number of INTs
|
||||
|
||||
controller isa0
|
||||
controller pnp0 # PnP support for ISA
|
||||
controller pci0
|
||||
controller isa0 at nexus?
|
||||
#controller pnp0 # PnP support for ISA
|
||||
controller pci0 at nexus?
|
||||
|
||||
controller fdc0 at isa? port "IO_FD1" bio irq 11 drq 2
|
||||
disk fd0 at fdc0 drive 0
|
||||
@ -84,9 +82,8 @@ disk wd0 at wdc0 drive 0
|
||||
#disk wd2 at wdc0 drive 2
|
||||
#disk wd3 at wdc0 drive 3
|
||||
|
||||
options ATAPI #Enable ATAPI support for IDE bus
|
||||
options ATAPI_STATIC #Don't do it as an LKM
|
||||
device wcd0 #IDE CD-ROM
|
||||
#device wfd0 #IDE Floppy (e.g. LS-120)
|
||||
|
||||
# A single entry for any of these controllers (ncr, ahb, ahc) is
|
||||
# sufficient for any number of installed devices.
|
||||
@ -132,16 +129,17 @@ device pckbd0 at isa? port IO_KBD tty irq 1
|
||||
|
||||
device gdc0 at isa?
|
||||
|
||||
#pseudo-device splash
|
||||
# splash screen/screen saver
|
||||
pseudo-device splash
|
||||
|
||||
device sc0 at isa? tty
|
||||
|
||||
device npx0 at isa? port IO_NPX irq 8
|
||||
device npx0 at nexus? port IO_NPX irq 8
|
||||
|
||||
#
|
||||
# Laptop support (see LINT for more options)
|
||||
#
|
||||
device apm0 at isa? disable flags 0x31 # Advanced Power Management
|
||||
device apm0 at nexus? disable flags 0x31 # Advanced Power Management
|
||||
|
||||
# PCCARD (PCMCIA) support
|
||||
#controller card0
|
||||
@ -179,22 +177,21 @@ device sio1 at isa? port 0x238 tty irq 5 flags 0x12000000
|
||||
#device lpt0 at isa? port IO_LPT tty
|
||||
device mse0 at isa? port IO_MSE tty irq 13
|
||||
|
||||
# Order is important here due to intrusive probes, do *not* alphabetize
|
||||
# this list of network interfaces until the probes have been fixed.
|
||||
# Right now it appears that the ie0 must be probed before ep0. See
|
||||
# revision 1.20 of this file.
|
||||
device ax0
|
||||
device de0
|
||||
device fxp0
|
||||
device mx0
|
||||
device pn0
|
||||
device rl0
|
||||
device tl0
|
||||
device tx0
|
||||
device vr0
|
||||
device vx0
|
||||
device wb0
|
||||
device xl0
|
||||
#
|
||||
# The following Ethernet NICs are all PCI devices.
|
||||
#
|
||||
device ax0 # ASIX AX88140A
|
||||
device de0 # DEC/Intel DC21x4x (``Tulip'')
|
||||
device fxp0 # Intel EtherExpress PRO/100B (82557, 82558)
|
||||
device mx0 # Macronix 98713/98715/98725 (``PMAC'')
|
||||
device pn0 # Lite-On 82c168/82c169 (``PNIC'')
|
||||
device rl0 # RealTek 8129/8139
|
||||
device tl0 # Texas Instruments ThunderLAN
|
||||
device tx0 # SMC 9432TX (83c170 ``EPIC'')
|
||||
device vr0 # VIA Rhine, Rhine II
|
||||
device vx0 # 3Com 3c590, 3c595 (``Vortex'')
|
||||
device wb0 # Winbond W89C840F
|
||||
device xl0 # 3Com 3c90x (``Boomerang'', ``Cyclone'')
|
||||
|
||||
#
|
||||
# DP8390 NIC
|
||||
@ -228,7 +225,7 @@ device ep0 at isa? port 0x40d0 net irq 3
|
||||
device fe0 at isa? port 0x00d0 net irq 3
|
||||
device fe1 at isa? port 0x73d0 net irq 5
|
||||
device lnc0 at isa? port 0x03d0 net irq 6
|
||||
device zp0 at isa? port 0x00d0 net irq 10 iomem 0xe0000
|
||||
#device zp0 at isa? port 0x00d0 net irq 10 iomem 0xe0000
|
||||
|
||||
options "FE_8BIT_SUPPORT" # LAC-98 support
|
||||
|
||||
@ -253,6 +250,13 @@ pseudo-device gzip # Exec gzipped a.out's
|
||||
# the costs of each syscall.
|
||||
options KTRACE #kernel tracing
|
||||
|
||||
# This provides support for System V shared memory and message queues.
|
||||
#
|
||||
options SYSVSHM
|
||||
options SYSVMSG
|
||||
options SYSVSEM
|
||||
|
||||
|
||||
# The `bpfilter' pseudo-device enables the Berkeley Packet Filter. Be
|
||||
# aware of the legal and administrative consequences of enabling this
|
||||
# option. The number of devices determines the maximum number of
|
||||
|
@ -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.58 1999/04/07 09:28:03 grog Exp $
|
||||
# $Id: Makefile.pc98,v 1.59 1999/04/11 03:40:11 grog Exp $
|
||||
#
|
||||
# Makefile for FreeBSD
|
||||
#
|
||||
@ -19,7 +19,7 @@
|
||||
#
|
||||
|
||||
# Which version of config(8) is required.
|
||||
%VERSREQ= 300010
|
||||
%VERSREQ= 400013
|
||||
|
||||
KERNFORMAT?= elf
|
||||
|
||||
@ -89,6 +89,7 @@ SYSTEM_DEP= Makefile symbols.exclude symbols.sort ${SYSTEM_OBJS}
|
||||
SYMORDER_EXCLUDE=-x symbols.exclude
|
||||
.endif
|
||||
SYSTEM_LD_HEAD= @echo loading ${.TARGET}; rm -f ${.TARGET}
|
||||
|
||||
.if ${KERNFORMAT} == aout || ${KERNFORMAT} == aoutkld
|
||||
SYSTEM_OBJS= locore.o vnode_if.o ${OBJS} ioconf.o param.o config.o
|
||||
SYSTEM_LD= @${LD} -aout -Bforcedynamic -Z -T ${LOAD_ADDRESS} -o ${.TARGET} -X ${SYSTEM_OBJS} vers.o
|
||||
@ -96,6 +97,7 @@ SYSTEM_LD_TAIL= @echo rearranging symbols; \
|
||||
symorder -m ${SYMORDER_EXCLUDE} symbols.sort ${.TARGET}; \
|
||||
size -aout ${.TARGET} ; chmod 755 ${.TARGET}
|
||||
.endif
|
||||
|
||||
.if ${KERNFORMAT} == elf
|
||||
SYSTEM_OBJS= locore.o setdef0.o vnode_if.o ${OBJS} ioconf.o param.o config.o \
|
||||
setdef1.o hack.So
|
||||
@ -106,6 +108,12 @@ SYSTEM_LD_TAIL= @size -elf ${.TARGET} ; chmod 755 ${.TARGET}
|
||||
SYSTEM_DEP+= $S/i386/conf/kernel.script
|
||||
.endif
|
||||
|
||||
.if defined(DEBUG)
|
||||
FULLKERNEL= ${KERNEL}.debug
|
||||
.else
|
||||
FULLKERNEL= ${KERNEL}
|
||||
.endif
|
||||
|
||||
%BEFORE_DEPEND
|
||||
|
||||
%OBJS
|
||||
@ -209,17 +217,20 @@ tags:
|
||||
@echo "see $S/kern/Makefile for tags"
|
||||
|
||||
.if defined(DEBUG)
|
||||
install: ${KERNEL}
|
||||
.if ${KERNFORMAT} == "elf" && !defined(FORCE)
|
||||
@if [ -f /${KERNEL} -a "`file /${KERNEL} 2>/dev/null | grep ELF`" = "" ]; then \
|
||||
echo "WARNING: You are about to install an ELF kernel for the first time!" ; \
|
||||
echo "Please be sure you have upgraded your bootblocks and/or /boot/loader so" ; \
|
||||
echo "that you can boot it. Old bootblocks WILL NOT WORK! Please read:" ; \
|
||||
echo "http://www.freebsd.org/~peter/elfday.html for information." ; \
|
||||
echo "If you are satisfied you can boot an ELF kernel, type: make -DFORCE install" ; \
|
||||
${KERNEL}: ${FULLKERNEL}
|
||||
.if ${KERNFORMAT} == "elf"
|
||||
objcopy --strip-debug ${FULLKERNEL} ${KERNEL}
|
||||
.else
|
||||
cp ${FULLKERNEL} ${KERNEL}
|
||||
strip -d kernel
|
||||
.endif
|
||||
.endif
|
||||
|
||||
install install.debug:
|
||||
@if [ ! -f ${KERNEL}${.TARGET:S/install//} ] ; then \
|
||||
echo "You must first build a kernel first." ; \
|
||||
exit 1 ; \
|
||||
fi
|
||||
.endif
|
||||
.if exists(${DESTDIR}/${KERNEL})
|
||||
-chflags noschg ${DESTDIR}/${KERNEL}
|
||||
mv ${DESTDIR}/${KERNEL} ${DESTDIR}/${KERNEL}.old
|
||||
@ -231,37 +242,8 @@ install: ${KERNEL}
|
||||
mv -f /var/db/kvm_kernel.db /var/db/kvm_kernel.old.db ; \
|
||||
fi \
|
||||
fi
|
||||
install -c -m 555 -o root -g wheel -fschg ${KERNEL} ${DESTDIR}/
|
||||
|
||||
.endif
|
||||
|
||||
${INSTALL}:
|
||||
@if [ ! -f ${KERNEL} ] ; then \
|
||||
echo "You must first build your kernel before trying to install." ; \
|
||||
exit 1 ; \
|
||||
fi
|
||||
.if ${KERNFORMAT} == "elf" && !defined(FORCE)
|
||||
@if [ -f /${KERNEL} -a "`file /${KERNEL} 2>/dev/null | grep ELF`" = "" ]; then \
|
||||
echo "WARNING: You are about to install an ELF kernel for the first time!" ; \
|
||||
echo "Please be sure you have upgraded your bootblocks and/or /boot/loader so" ; \
|
||||
echo "that you can boot it. Old bootblocks WILL NOT WORK! Please read:" ; \
|
||||
echo "http://www.freebsd.org/~peter/elfday.html for information." ; \
|
||||
echo "If you are satisfied you can boot an ELF kernel, type: make -DFORCE install" ; \
|
||||
exit 1 ; \
|
||||
fi
|
||||
.endif
|
||||
.if exists(${DESTDIR}/${KERNEL})
|
||||
-chflags noschg ${DESTDIR}/${KERNEL}
|
||||
mv ${DESTDIR}/${KERNEL} ${DESTDIR}/${KERNEL}.old
|
||||
.endif
|
||||
PATH=$${PATH}:/sbin:/usr/sbin; \
|
||||
if [ `sysctl -n kern.bootfile` = ${DESTDIR}/${KERNEL} ] ; then \
|
||||
sysctl -w kern.bootfile=${DESTDIR}/${KERNEL}.old ; \
|
||||
if [ -f /var/db/kvm_kernel.db ] ; then \
|
||||
mv -f /var/db/kvm_kernel.db /var/db/kvm_kernel.old.db ; \
|
||||
fi \
|
||||
fi
|
||||
install -c -m 555 -o root -g wheel -fschg ${FULLKERNEL} ${DESTDIR}/${KERNEL}
|
||||
install -c -m 555 -o root -g wheel -fschg \
|
||||
${KERNEL}${.TARGET:S/install//} ${DESTDIR}/${KERNEL}
|
||||
|
||||
config.o:
|
||||
${NORMAL_C}
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
# modified for PC-9801
|
||||
#
|
||||
# $Id: files.pc98,v 1.88 1999/04/02 08:51:06 kato Exp $
|
||||
# $Id: files.pc98,v 1.89 1999/04/10 04:42:46 kato Exp $
|
||||
#
|
||||
# The long compile-with and dependency lines are required because of
|
||||
# limitations in config: backslash-newline doesn't work in strings, and
|
||||
@ -26,6 +26,16 @@ font8x16.o optional std8x16font \
|
||||
no-implicit-rule before-depend \
|
||||
clean "${STD8X16FONT}-8x16 font8x16.c"
|
||||
#
|
||||
atkbdmap.h optional atkbd_dflt_keymap \
|
||||
compile-with "kbdcontrol -L ${ATKBD_DFLT_KEYMAP} | sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static accentmap_t.* = /static accentmap_t accent_map = /' > atkbdmap.h" \
|
||||
no-obj no-implicit-rule before-depend \
|
||||
clean "atkbdmap.h"
|
||||
#
|
||||
ukbdmap.h optional ukbd_dflt_keymap \
|
||||
compile-with "kbdcontrol -L ${UKBD_DFLT_KEYMAP} | sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static accentmap_t.* = /static accentmap_t accent_map = /' > ukbdmap.h" \
|
||||
no-obj no-implicit-rule before-depend \
|
||||
clean "ukbdmap.h"
|
||||
#
|
||||
dev/ata/ata-all.c optional ata device-driver
|
||||
dev/ata/ata-dma.c optional ata device-driver
|
||||
dev/ata/atapi-all.c optional ata device-driver
|
||||
@ -43,7 +53,7 @@ i386/apm/apm_setup.s optional apm
|
||||
i386/eisa/dpt_eisa.c optional eisa dpt device-driver
|
||||
i386/eisa/3c5x9.c optional ep device-driver
|
||||
#i386/eisa/adv_eisa.c optional adv device-driver
|
||||
i386/eisa/ahc_eisa.c optional ahc device-driver \
|
||||
i386/eisa/ahc_eisa.c optional eisa ahc device-driver \
|
||||
dependency "aic7xxx_reg.h $S/i386/eisa/ahc_eisa.c"
|
||||
i386/eisa/ahb.c optional ahb device-driver
|
||||
i386/eisa/bt_eisa.c optional bt device-driver
|
||||
@ -76,12 +86,14 @@ i386/i386/mp_machdep.c optional smp
|
||||
i386/i386/mpapic.c optional smp
|
||||
i386/i386/mpboot.s optional smp
|
||||
i386/i386/mplock.s optional smp
|
||||
i386/i386/nexus.c standard
|
||||
i386/i386/perfmon.c optional perfmon profiling-routine
|
||||
i386/i386/perfmon.c optional perfmon
|
||||
i386/i386/pmap.c standard
|
||||
i386/i386/procfs_machdep.c standard
|
||||
i386/i386/simplelock.s optional smp
|
||||
i386/i386/support.s standard
|
||||
i386/i386/swapgeneric.c standard
|
||||
i386/i386/swtch.s standard
|
||||
i386/i386/sys_machdep.c standard
|
||||
i386/i386/trap.c standard
|
||||
@ -112,7 +124,7 @@ i386/isa/bs/bs.c optional bs device-driver
|
||||
i386/isa/bs/bsfunc.c optional bs device-driver
|
||||
i386/isa/bs/bshw.c optional bs device-driver
|
||||
i386/isa/bs/bsif.c optional bs device-driver
|
||||
#i386/isa/adv_isa.c optional adv device-driver
|
||||
i386/isa/adv_isa.c optional adv device-driver
|
||||
#i386/isa/aha1542.c optional aha device-driver
|
||||
i386/isa/aha_isa.c optional aha device-driver
|
||||
i386/isa/bt_isa.c optional bt device-driver
|
||||
@ -156,7 +168,7 @@ contrib/dev/oltr/trlldbm.c optional oltr device-driver
|
||||
i386/isa/ipl_funcs.c standard \
|
||||
compile-with "${CC} -c ${CFLAGS} ${DEFINED_PROF:S/^$/-fomit-frame-pointer/} $<"
|
||||
i386/isa/intr_machdep.c standard
|
||||
pc98/pc98/pc98.c optional isa device-driver
|
||||
i386/isa/isa.c optional isa device-driver
|
||||
i386/isa/istallion.c optional stli device-driver
|
||||
i386/isa/joy.c optional joy device-driver
|
||||
pc98/pc98/pc98kbd.c optional pckbd device-driver
|
||||
@ -169,20 +181,22 @@ pc98/pc98/npx.c mandatory npx device-driver
|
||||
pc98/pc98/pc98gdc.c optional gdc device-driver
|
||||
pc98/pc98/pcaudio.c optional pca device-driver
|
||||
i386/isa/matcd/matcd.c optional matcd device-driver
|
||||
i386/isa/isa_compat.c optional isa device-driver
|
||||
pc98/pc98/isa_dma.c optional isa device-driver
|
||||
i386/isa/pcibus.c optional pci device-driver
|
||||
i386/isa/pcicx.c optional ze device-driver
|
||||
i386/isa/pcicx.c optional zp device-driver
|
||||
#i386/isa/pcvt/pcvt_drv.c optional vt device-driver
|
||||
#i386/isa/pcvt/pcvt_ext.c optional vt device-driver
|
||||
#i386/isa/pcvt/pcvt_kbd.c optional vt device-driver
|
||||
#i386/isa/pcvt/pcvt_out.c optional vt device-driver
|
||||
#i386/isa/pcvt/pcvt_sup.c optional vt device-driver
|
||||
#i386/isa/pcvt/pcvt_vtf.c optional vt device-driver
|
||||
i386/isa/pcvt/pcvt_drv.c optional vt device-driver
|
||||
i386/isa/pcvt/pcvt_ext.c optional vt device-driver
|
||||
i386/isa/pcvt/pcvt_kbd.c optional vt device-driver
|
||||
i386/isa/pcvt/pcvt_out.c optional vt device-driver
|
||||
i386/isa/pcvt/pcvt_sup.c optional vt device-driver
|
||||
i386/isa/pcvt/pcvt_vtf.c optional vt device-driver
|
||||
i386/isa/pnp.c optional pnp device-driver
|
||||
i386/isa/prof_machdep.c optional profiling-routine
|
||||
i386/isa/ppc.c optional ppc device-driver
|
||||
i386/isa/pcf.c optional pcf device-driver
|
||||
i386/isa/psm.c optional psm device-driver
|
||||
isa/psm.c optional psm device-driver
|
||||
i386/isa/random_machdep.c standard
|
||||
i386/isa/rc.c optional rc device-driver
|
||||
i386/isa/rp.c optional rp device-driver
|
||||
@ -264,13 +278,10 @@ pc98/pc98/spkr.c optional speaker device-driver
|
||||
i386/isa/stallion.c optional stl device-driver
|
||||
pc98/pc98/syscons.c optional sc device-driver
|
||||
pc98/pc98/scvidctl.c optional sc device-driver
|
||||
#i386/isa/scvesactl.c optional sc device-driver
|
||||
#i386/isa/videoio.c optional sc device-driver
|
||||
#i386/isa/vesa.c optional sc device-driver
|
||||
i386/isa/tw.c optional tw device-driver
|
||||
pc98/pc98/wd.c optional wdc device-driver
|
||||
pc98/pc98/wd.c optional wd device-driver
|
||||
i386/isa/atapi.c optional atapi device-driver
|
||||
i386/isa/atapi.c optional wdc device-driver
|
||||
i386/isa/atapi-cd.c optional wcd device-driver
|
||||
i386/isa/wfd.c optional wfd device-driver
|
||||
i386/isa/wst.c optional wst device-driver
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $Id: options.pc98,v 1.82 1999/03/10 14:51:52 kato Exp $
|
||||
# $Id: options.pc98,v 1.83 1999/03/17 09:00:33 kato Exp $
|
||||
|
||||
DISABLE_PSE
|
||||
IDE_DELAY
|
||||
@ -75,8 +75,6 @@ SC_MOUSE_CHAR opt_syscons.h
|
||||
|
||||
FB_INSTALL_CDEV opt_fb.h
|
||||
|
||||
VESA opt_vesa.h
|
||||
|
||||
GDC opt_gdc.h
|
||||
|
||||
PSM_HOOKAPM opt_psm.h
|
||||
@ -92,11 +90,6 @@ KBD_MAXWAIT opt_kbd.h
|
||||
KBD_RESETDELAY opt_kbd.h
|
||||
KBDIO_DEBUG opt_kbd.h
|
||||
|
||||
ATAPI opt_atapi.h
|
||||
ATAPI_STATIC opt_atapi.h
|
||||
|
||||
CMD640 opt_wd.h
|
||||
|
||||
USERCONFIG opt_userconfig.h
|
||||
VISUAL_USERCONFIG opt_userconfig.h
|
||||
INTRO_USERCONFIG opt_userconfig.h
|
||||
|
@ -35,7 +35,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
|
||||
* $Id: machdep.c,v 1.110 1999/03/06 09:43:01 kato Exp $
|
||||
* $Id: machdep.c,v 1.111 1999/04/03 22:20:02 jdp Exp $
|
||||
*/
|
||||
|
||||
#include "apm.h"
|
||||
@ -71,6 +71,7 @@
|
||||
#include <sys/sysent.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/vmmeter.h>
|
||||
#include <sys/bus.h>
|
||||
|
||||
#ifdef SYSVSHM
|
||||
#include <sys/shm.h>
|
||||
@ -125,7 +126,9 @@
|
||||
#include <machine/perfmon.h>
|
||||
#endif
|
||||
|
||||
#ifdef OLD_BUS_ARCH
|
||||
#include <i386/isa/isa_device.h>
|
||||
#endif
|
||||
#include <i386/isa/intr_machdep.h>
|
||||
#ifdef PC98
|
||||
#include <pc98/pc98/pc98_machdep.h>
|
||||
@ -153,7 +156,7 @@ SYSINIT(cpu, SI_SUB_CPU, SI_ORDER_FIRST, cpu_startup, NULL)
|
||||
static MALLOC_DEFINE(M_MBUF, "mbuf", "mbuf");
|
||||
|
||||
#ifdef PC98
|
||||
int need_pre_dma_flush; /* If 1, use wbinvd befor DMA transfer. */
|
||||
int need_pre_dma_flush; /* If 1, use wbinvd befor DMA transfer. */
|
||||
int need_post_dma_flush; /* If 1, use invd after DMA transfer. */
|
||||
#endif
|
||||
|
||||
@ -169,9 +172,9 @@ SYSCTL_INT(_debug, OID_AUTO, tlb_flush_count,
|
||||
#endif
|
||||
|
||||
#ifdef PC98
|
||||
int ispc98 = 1;
|
||||
static int ispc98 = 1;
|
||||
#else
|
||||
int ispc98 = 0;
|
||||
static int ispc98 = 0;
|
||||
#endif
|
||||
SYSCTL_INT(_machdep, OID_AUTO, ispc98, CTLFLAG_RD, &ispc98, 0, "");
|
||||
|
||||
@ -850,6 +853,9 @@ setregs(p, entry, stack, ps_strings)
|
||||
regs->tf_es = _udatasel;
|
||||
regs->tf_cs = _ucodesel;
|
||||
|
||||
/* PS_STRINGS value for BSD/OS binaries. It is 0 for non-BSD/OS. */
|
||||
regs->tf_ebx = ps_strings;
|
||||
|
||||
/* reset %fs and %gs as well */
|
||||
pcb->pcb_fs = _udatasel;
|
||||
pcb->pcb_gs = _udatasel;
|
||||
@ -1174,8 +1180,10 @@ init386(first)
|
||||
unsigned biosbasemem, biosextmem;
|
||||
struct gate_descriptor *gdp;
|
||||
int gsel_tss;
|
||||
#if NNPX > 0
|
||||
int msize;
|
||||
#endif
|
||||
|
||||
struct isa_device *idp;
|
||||
#ifndef SMP
|
||||
/* table descriptors - used to load tables by microp */
|
||||
struct region_descriptor r_gdt, r_idt;
|
||||
@ -1478,10 +1486,11 @@ init386(first)
|
||||
#endif
|
||||
|
||||
#if NNPX > 0
|
||||
idp = find_isadev(isa_devtab_null, &npxdriver, 0);
|
||||
if (idp != NULL && idp->id_msize != 0) {
|
||||
Maxmem = idp->id_msize / 4;
|
||||
speculative_mprobe = FALSE;
|
||||
if (resource_int_value("npx", 0, "msize", &msize) == 0) {
|
||||
if (msize != 0) {
|
||||
Maxmem = msize / 4;
|
||||
speculative_mprobe = FALSE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
** Copyright (c) 1995
|
||||
** Michael Smith, msmith@atrad.adelaide.edu.au. All rights reserved.
|
||||
** Michael Smith, msmith@freebsd.org. All rights reserved.
|
||||
**
|
||||
** This code contains a module marked :
|
||||
|
||||
@ -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.70 1999/02/25 11:05:50 kato Exp $
|
||||
** $Id: userconfig.c,v 1.71 1999/04/10 04:44:33 kato Exp $
|
||||
**/
|
||||
|
||||
/**
|
||||
@ -119,11 +119,13 @@
|
||||
#include <sys/reboot.h>
|
||||
#include <sys/linker.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/bus.h>
|
||||
|
||||
#include <machine/cons.h>
|
||||
#include <machine/md_var.h>
|
||||
#include <machine/limits.h>
|
||||
|
||||
|
||||
#include <i386/isa/isa_device.h>
|
||||
#include "pnp.h"
|
||||
|
||||
@ -136,11 +138,17 @@
|
||||
static MALLOC_DEFINE(M_DEVL, "isa_devlist", "isa_device lists in userconfig()");
|
||||
|
||||
static struct isa_device *isa_devlist; /* list read by kget to extract changes */
|
||||
static struct isa_device *isa_devtab; /* fake isa_device table */
|
||||
static struct isa_driver *isa_drvtab; /* fake driver list */
|
||||
|
||||
static int userconfig_boot_parsing; /* set if we are reading from the boot instructions */
|
||||
|
||||
#define putchar(x) cnputc(x)
|
||||
|
||||
static void load_devtab(void);
|
||||
static void free_devtab(void);
|
||||
static void save_resource(struct isa_device *);
|
||||
|
||||
static int
|
||||
sysctl_machdep_uc_devlist SYSCTL_HANDLER_ARGS
|
||||
{
|
||||
@ -283,8 +291,6 @@ getchar(void)
|
||||
#endif
|
||||
|
||||
#ifdef VISUAL_USERCONFIG
|
||||
static struct isa_device *devtabs[] = { isa_devtab_bio, isa_devtab_tty, isa_devtab_net,
|
||||
isa_devtab_cam, isa_devtab_null, NULL };
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@ -403,6 +409,7 @@ static DEV_INFO device_info[] = {
|
||||
{"vr", "VIA Rhine/Rhine II ethernet adapter", FLG_FIXED, CLS_NETWORK},
|
||||
{"wb", "Winbond W89C840F ethernet adapter", FLG_FIXED, CLS_NETWORK},
|
||||
{"xl", "3COM 3C90x PCI ethernet adapter", FLG_FIXED, CLS_NETWORK},
|
||||
{"rdp", "RealTek RTL8002 Pocket Ethernet", 0, CLS_NETWORK},
|
||||
|
||||
{"sio", "8250/16450/16550 Serial port", 0, CLS_COMMS},
|
||||
{"cx", "Cronyx/Sigma multiport sync/async adapter",0, CLS_COMMS},
|
||||
@ -431,11 +438,7 @@ static DEV_INFO device_info[] = {
|
||||
{"sc", "Syscons console driver", FLG_IMMUTABLE, CLS_INPUT},
|
||||
|
||||
{"bktr", "Brooktree BT848 based frame grabber/tuner card", 0,CLS_MMEDIA},
|
||||
#ifdef PC98
|
||||
{"pcm", "PC-9801-86 Sound Board", 0, CLS_MMEDIA},
|
||||
#else
|
||||
{"pcm", "New Luigi audio driver for all supported sound cards", 0,CLS_MMEDIA},
|
||||
#endif
|
||||
{"sb", "Soundblaster PCM (SB, SBPro, SB16, ProAudio Spectrum)",0,CLS_MMEDIA},
|
||||
{"sbxvi", "Soundblaster 16", 0, CLS_MMEDIA},
|
||||
{"sbmidi", "Soundblaster MIDI interface", 0, CLS_MMEDIA},
|
||||
@ -445,6 +448,7 @@ static DEV_INFO device_info[] = {
|
||||
{"gusxvi", "Gravis Ultrasound 16-bit PCM", 0, CLS_MMEDIA},
|
||||
{"gusmax", "Gravis Ultrasound MAX", 0, CLS_MMEDIA},
|
||||
{"mss", "Microsoft Sound System", 0, CLS_MMEDIA},
|
||||
{"nss", "PC-9801-86 Sound Board", 0, CLS_MMEDIA},
|
||||
{"opl", "OPL-2/3 FM, Soundblaster, SBPro, SB16, ProAudio Spectrum",0,CLS_MMEDIA},
|
||||
{"mpu", "Roland MPU401 MIDI", 0, CLS_MMEDIA},
|
||||
{"sscape", "Ensoniq Soundscape MIDI interface", 0, CLS_MMEDIA},
|
||||
@ -556,12 +560,10 @@ setdev(DEV_LIST *dev, int enabled)
|
||||
static void
|
||||
getdevs(void)
|
||||
{
|
||||
int i,j;
|
||||
int i;
|
||||
struct isa_device *ap;
|
||||
|
||||
for (j = 0; devtabs[j]; j++) /* ISA devices */
|
||||
{
|
||||
ap = devtabs[j]; /* pointer to array of devices */
|
||||
ap = isa_devtab; /* pointer to array of devices */
|
||||
for (i = 0; ap[i].id_id; i++) /* for each device in this table */
|
||||
{
|
||||
scratch.unit = ap[i].id_unit; /* device parameters */
|
||||
@ -581,7 +583,6 @@ getdevs(void)
|
||||
if (!devinfo(&scratch)) /* get more info on the device */
|
||||
insdev(&scratch,ap[i].id_enabled?active:inactive);
|
||||
}
|
||||
}
|
||||
#if NPCI > 0
|
||||
for (i = 0; i < pcidevice_set.ls_length; i++)
|
||||
{
|
||||
@ -865,6 +866,7 @@ savelist(DEV_LIST *list, int active)
|
||||
{
|
||||
id_pn = id_p->id_next;
|
||||
bcopy(list->device,id_p,sizeof(struct isa_device));
|
||||
save_resource(list->device);
|
||||
id_p->id_next = id_pn;
|
||||
break;
|
||||
}
|
||||
@ -873,6 +875,7 @@ savelist(DEV_LIST *list, int active)
|
||||
{
|
||||
id_pn = malloc(sizeof(struct isa_device),M_DEVL,M_WAITOK);
|
||||
bcopy(list->device,id_pn,sizeof(struct isa_device));
|
||||
save_resource(list->device);
|
||||
id_pn->id_next = isa_devlist;
|
||||
isa_devlist = id_pn; /* park at top of list */
|
||||
}
|
||||
@ -2528,7 +2531,7 @@ visuserconfig(void)
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: userconfig.c,v 1.70 1999/02/25 11:05:50 kato Exp $
|
||||
* $Id: userconfig.c,v 1.71 1999/04/10 04:44:33 kato Exp $
|
||||
*/
|
||||
|
||||
#include "scbus.h"
|
||||
@ -2677,6 +2680,7 @@ userconfig(void)
|
||||
int rval;
|
||||
Cmd *cmd;
|
||||
|
||||
load_devtab();
|
||||
init_config_script();
|
||||
while (1) {
|
||||
|
||||
@ -2711,8 +2715,10 @@ userconfig(void)
|
||||
continue;
|
||||
}
|
||||
rval = (*cmd->handler)(cmd->parms);
|
||||
if (rval)
|
||||
if (rval) {
|
||||
free_devtab();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2810,11 +2816,7 @@ static int
|
||||
list_devices(CmdParm *parms)
|
||||
{
|
||||
lineno = 0;
|
||||
if (lsdevtab(&isa_devtab_bio[0])) return 0;
|
||||
if (lsdevtab(&isa_devtab_tty[0])) return 0;
|
||||
if (lsdevtab(&isa_devtab_net[0])) return 0;
|
||||
if (lsdevtab(&isa_devtab_cam[0])) return 0;
|
||||
if (lsdevtab(&isa_devtab_null[0])) return 0;
|
||||
if (lsdevtab(isa_devtab)) return 0;
|
||||
#if NPNP > 0
|
||||
if (lspnp()) return 0;
|
||||
#endif
|
||||
@ -3334,20 +3336,65 @@ lsdevtab(struct isa_device *dt)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static void
|
||||
load_devtab(void)
|
||||
{
|
||||
int i, val;
|
||||
int count = resource_count();
|
||||
int id = 1;
|
||||
int dt;
|
||||
char *name;
|
||||
int unit;
|
||||
|
||||
isa_devtab = malloc(sizeof(struct isa_device)*(count + 1),M_DEVL,M_WAITOK);
|
||||
isa_drvtab = malloc(sizeof(struct isa_driver)*(count + 1),M_DEVL,M_WAITOK);
|
||||
bzero(isa_devtab, sizeof(struct isa_device) * (count + 1));
|
||||
bzero(isa_drvtab, sizeof(struct isa_driver) * (count + 1));
|
||||
dt = 0;
|
||||
for (i = 0; i < count; i++) {
|
||||
name = resource_query_name(i);
|
||||
unit = resource_query_unit(i);
|
||||
if (unit < 0)
|
||||
continue; /* skip wildcards */
|
||||
isa_devtab[dt].id_id = id++;
|
||||
isa_devtab[dt].id_driver = &isa_drvtab[dt];
|
||||
resource_int_value(name, unit, "port", &isa_devtab[dt].id_iobase);
|
||||
val = 0;
|
||||
resource_int_value(name, unit, "irq", &val);
|
||||
isa_devtab[dt].id_irq = (1 << val);
|
||||
resource_int_value(name, unit, "drq", &isa_devtab[dt].id_drq);
|
||||
resource_int_value(name, unit, "maddr",(int *)&isa_devtab[dt].id_maddr);
|
||||
resource_int_value(name, unit, "msize", &isa_devtab[dt].id_msize);
|
||||
isa_devtab[dt].id_unit = unit;
|
||||
resource_int_value(name, unit, "flags", &isa_devtab[dt].id_flags);
|
||||
val = 0;
|
||||
resource_int_value(name, unit, "disabled", &val);
|
||||
isa_devtab[dt].id_enabled = !val;
|
||||
isa_drvtab[dt].name = malloc(strlen(name) + 1, M_DEVL,M_WAITOK);
|
||||
strcpy(isa_drvtab[dt].name, name);
|
||||
dt++;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
free_devtab(void)
|
||||
{
|
||||
int i;
|
||||
int count = resource_count();
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
if (isa_drvtab[i].name)
|
||||
free(isa_drvtab[i].name, M_DEVL);
|
||||
free(isa_drvtab, M_DEVL);
|
||||
free(isa_devtab, M_DEVL);
|
||||
}
|
||||
|
||||
static struct isa_device *
|
||||
find_device(char *devname, int unit)
|
||||
{
|
||||
struct isa_device *ret;
|
||||
|
||||
if ((ret = search_devtable(&isa_devtab_bio[0], devname, unit)) != NULL)
|
||||
return ret;
|
||||
if ((ret = search_devtable(&isa_devtab_tty[0], devname, unit)) != NULL)
|
||||
return ret;
|
||||
if ((ret = search_devtable(&isa_devtab_net[0], devname, unit)) != NULL)
|
||||
return ret;
|
||||
if ((ret = search_devtable(&isa_devtab_cam[0], devname, unit)) != NULL)
|
||||
return ret;
|
||||
if ((ret = search_devtable(&isa_devtab_null[0], devname, unit)) != NULL)
|
||||
if ((ret = search_devtable(isa_devtab, devname, unit)) != NULL)
|
||||
return ret;
|
||||
return NULL;
|
||||
}
|
||||
@ -3554,6 +3601,29 @@ list_scsi(CmdParm *parms)
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
save_resource(struct isa_device *idev)
|
||||
{
|
||||
int i;
|
||||
char *name;
|
||||
int unit;
|
||||
int count = resource_count();
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
name = resource_query_name(i);
|
||||
unit = resource_query_unit(i);
|
||||
if (strcmp(name, idev->id_driver->name) || unit != idev->id_unit)
|
||||
continue;
|
||||
resource_set_int(i, "port", isa_devtab[i].id_iobase);
|
||||
resource_set_int(i, "irq", (1 << isa_devtab[i].id_irq));
|
||||
resource_set_int(i, "drq", isa_devtab[i].id_drq);
|
||||
resource_set_int(i, "maddr", (int)isa_devtab[i].id_maddr);
|
||||
resource_set_int(i, "msize", isa_devtab[i].id_msize);
|
||||
resource_set_int(i, "flags", isa_devtab[i].id_flags);
|
||||
resource_set_int(i, "disabled", !isa_devtab[i].id_enabled);
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
save_dev(idev)
|
||||
struct isa_device *idev;
|
||||
@ -3566,6 +3636,7 @@ struct isa_device *idev;
|
||||
if (id_p->id_id == idev->id_id) {
|
||||
id_pn = id_p->id_next;
|
||||
bcopy(idev,id_p,sizeof(struct isa_device));
|
||||
save_resource(idev);
|
||||
id_p->id_next = id_pn;
|
||||
return 1;
|
||||
}
|
||||
|
1453
sys/pc98/pc98/fd.c
1453
sys/pc98/pc98/fd.c
File diff suppressed because it is too large
Load Diff
@ -24,7 +24,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: if_ed.c,v 1.60 1999/01/28 09:19:16 kato Exp $
|
||||
* $Id: if_ed.c,v 1.61 1999/03/19 16:01:34 kato Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -4300,7 +4300,6 @@ static void
|
||||
edpnp_attach(u_long csn, u_long vend_id, char *name, struct isa_device *dev)
|
||||
{
|
||||
struct pnp_cinfo d;
|
||||
struct isa_device *dvp;
|
||||
|
||||
if (dev->id_unit >= NEDTOT)
|
||||
return;
|
||||
@ -4321,9 +4320,7 @@ edpnp_attach(u_long csn, u_long vend_id, char *name, struct isa_device *dev)
|
||||
|
||||
if (dev->id_driver == NULL) {
|
||||
dev->id_driver = &eddriver;
|
||||
dvp = find_isadev(isa_devtab_net, &eddriver, 0);
|
||||
if (dvp != NULL)
|
||||
dev->id_id = dvp->id_id;
|
||||
dev->id_id = isa_compat_nextid();
|
||||
}
|
||||
|
||||
if ((dev->id_alive = ed_probe(dev)) != 0)
|
||||
|
560
sys/pc98/pc98/isa_dma.c
Normal file
560
sys/pc98/pc98/isa_dma.c
Normal file
@ -0,0 +1,560 @@
|
||||
/*-
|
||||
* Copyright (c) 1991 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* William Jolitz.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)isa.c 7.2 (Berkeley) 5/13/91
|
||||
* $Id: isa_dma.c,v 1.1 1999/04/16 21:22:24 peter Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* code to manage AT bus
|
||||
*
|
||||
* 92/08/18 Frank P. MacLachlan (fpm@crash.cts.com):
|
||||
* Fixed uninitialized variable problem and added code to deal
|
||||
* with DMA page boundaries in isa_dmarangecheck(). Fixed word
|
||||
* mode DMA count compution and reorganized DMA setup code in
|
||||
* isa_dmastart()
|
||||
*/
|
||||
|
||||
#ifdef PC98
|
||||
#include "opt_pc98.h"
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/buf.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <machine/ipl.h>
|
||||
#include <machine/md_var.h>
|
||||
#ifdef APIC_IO
|
||||
#include <machine/smp.h>
|
||||
#endif /* APIC_IO */
|
||||
#include <vm/vm.h>
|
||||
#include <vm/vm_param.h>
|
||||
#include <vm/pmap.h>
|
||||
#include <i386/isa/isa_device.h>
|
||||
#include <i386/isa/intr_machdep.h>
|
||||
#ifdef PC98
|
||||
#include <pc98/pc98/pc98.h>
|
||||
#else
|
||||
#include <i386/isa/isa.h>
|
||||
#endif
|
||||
#include <i386/isa/ic/i8237.h>
|
||||
|
||||
#include <sys/interrupt.h>
|
||||
|
||||
#include "pnp.h"
|
||||
#if NPNP > 0
|
||||
#include <i386/isa/pnp.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Register definitions for DMA controller 1 (channels 0..3):
|
||||
*/
|
||||
#ifdef PC98
|
||||
#define DMA1_CHN(c) (IO_DMA + (4*(c))) /* addr reg for channel c */
|
||||
#define DMA1_SMSK (IO_DMA + 0x14) /* single mask register */
|
||||
#define DMA1_MODE (IO_DMA + 0x16) /* mode register */
|
||||
#define DMA1_FFC (IO_DMA + 0x18) /* clear first/last FF */
|
||||
#else
|
||||
#define DMA1_CHN(c) (IO_DMA1 + 1*(2*(c))) /* addr reg for channel c */
|
||||
#define DMA1_SMSK (IO_DMA1 + 1*10) /* single mask register */
|
||||
#define DMA1_MODE (IO_DMA1 + 1*11) /* mode register */
|
||||
#define DMA1_FFC (IO_DMA1 + 1*12) /* clear first/last FF */
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Register definitions for DMA controller 2 (channels 4..7):
|
||||
*/
|
||||
#define DMA2_CHN(c) (IO_DMA2 + 2*(2*(c))) /* addr reg for channel c */
|
||||
#define DMA2_SMSK (IO_DMA2 + 2*10) /* single mask register */
|
||||
#define DMA2_MODE (IO_DMA2 + 2*11) /* mode register */
|
||||
#define DMA2_FFC (IO_DMA2 + 2*12) /* clear first/last FF */
|
||||
|
||||
static int isa_dmarangecheck __P((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[8] = { 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.
|
||||
*/
|
||||
void
|
||||
isa_dmainit(chan, bouncebufsize)
|
||||
int chan;
|
||||
u_int bouncebufsize;
|
||||
{
|
||||
void *buf;
|
||||
|
||||
#ifdef DIAGNOSTIC
|
||||
if (chan & ~VALID_DMA_MASK)
|
||||
panic("isa_dmainit: channel out of range");
|
||||
|
||||
if (dma_bouncebuf[chan] != NULL)
|
||||
panic("isa_dmainit: impossible request");
|
||||
#endif
|
||||
|
||||
dma_bouncebufsize[chan] = bouncebufsize;
|
||||
|
||||
/* Try malloc() first. It works better if it works. */
|
||||
buf = malloc(bouncebufsize, M_DEVBUF, M_NOWAIT);
|
||||
if (buf != NULL) {
|
||||
if (isa_dmarangecheck(buf, bouncebufsize, chan) == 0) {
|
||||
dma_bouncebuf[chan] = buf;
|
||||
return;
|
||||
}
|
||||
free(buf, M_DEVBUF);
|
||||
}
|
||||
buf = contigmalloc(bouncebufsize, M_DEVBUF, M_NOWAIT, 0ul, 0xfffffful,
|
||||
1ul, chan & 4 ? 0x20000ul : 0x10000ul);
|
||||
if (buf == NULL)
|
||||
printf("isa_dmainit(%d, %d) failed\n", chan, bouncebufsize);
|
||||
else
|
||||
dma_bouncebuf[chan] = buf;
|
||||
}
|
||||
|
||||
/*
|
||||
* Register a DMA channel's usage. Usually called from a device driver
|
||||
* in open() or during its initialization.
|
||||
*/
|
||||
int
|
||||
isa_dma_acquire(chan)
|
||||
int chan;
|
||||
{
|
||||
#ifdef DIAGNOSTIC
|
||||
if (chan & ~VALID_DMA_MASK)
|
||||
panic("isa_dma_acquire: channel out of range");
|
||||
#endif
|
||||
|
||||
if (dma_inuse & (1 << chan)) {
|
||||
printf("isa_dma_acquire: channel %d already in use\n", chan);
|
||||
return (EBUSY);
|
||||
}
|
||||
dma_inuse |= (1 << chan);
|
||||
dma_auto_mode &= ~(1 << chan);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Unregister a DMA channel's usage. Usually called from a device driver
|
||||
* during close() or during its shutdown.
|
||||
*/
|
||||
void
|
||||
isa_dma_release(chan)
|
||||
int chan;
|
||||
{
|
||||
#ifdef DIAGNOSTIC
|
||||
if (chan & ~VALID_DMA_MASK)
|
||||
panic("isa_dma_release: channel out of range");
|
||||
|
||||
if ((dma_inuse & (1 << chan)) == 0)
|
||||
printf("isa_dma_release: channel %d not in use\n", chan);
|
||||
#endif
|
||||
|
||||
if (dma_busy & (1 << chan)) {
|
||||
dma_busy &= ~(1 << chan);
|
||||
/*
|
||||
* XXX We should also do "dma_bounced &= (1 << chan);"
|
||||
* because we are acting on behalf of isa_dmadone() which
|
||||
* was not called to end the last DMA operation. This does
|
||||
* not matter now, but it may in the future.
|
||||
*/
|
||||
}
|
||||
|
||||
dma_inuse &= ~(1 << 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.
|
||||
*/
|
||||
void
|
||||
isa_dmastart(int flags, caddr_t addr, u_int nbytes, int chan)
|
||||
{
|
||||
vm_offset_t phys;
|
||||
int waport;
|
||||
caddr_t newaddr;
|
||||
|
||||
#ifdef DIAGNOSTIC
|
||||
if (chan & ~VALID_DMA_MASK)
|
||||
panic("isa_dmastart: channel out of range");
|
||||
|
||||
if ((chan < 4 && nbytes > (1<<16))
|
||||
|| (chan >= 4 && (nbytes > (1<<17) || (u_int)addr & 1)))
|
||||
panic("isa_dmastart: impossible request");
|
||||
|
||||
if ((dma_inuse & (1 << chan)) == 0)
|
||||
printf("isa_dmastart: channel %d not acquired\n", chan);
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* XXX This should be checked, but drivers like ad1848 only call
|
||||
* isa_dmastart() once because they use Auto DMA mode. If we
|
||||
* leave this in, drivers that do this will print this continuously.
|
||||
*/
|
||||
if (dma_busy & (1 << chan))
|
||||
printf("isa_dmastart: channel %d busy\n", chan);
|
||||
#endif
|
||||
|
||||
dma_busy |= (1 << chan);
|
||||
|
||||
if (isa_dmarangecheck(addr, nbytes, chan)) {
|
||||
if (dma_bouncebuf[chan] == NULL
|
||||
|| dma_bouncebufsize[chan] < nbytes)
|
||||
panic("isa_dmastart: bad bounce buffer");
|
||||
dma_bounced |= (1 << chan);
|
||||
newaddr = dma_bouncebuf[chan];
|
||||
|
||||
/* copy bounce buffer on write */
|
||||
if (!(flags & B_READ))
|
||||
bcopy(addr, newaddr, nbytes);
|
||||
addr = newaddr;
|
||||
}
|
||||
|
||||
/* translate to physical */
|
||||
phys = pmap_extract(pmap_kernel(), (vm_offset_t)addr);
|
||||
|
||||
if (flags & B_RAW) {
|
||||
dma_auto_mode |= (1 << chan);
|
||||
} else {
|
||||
dma_auto_mode &= ~(1 << chan);
|
||||
}
|
||||
|
||||
#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 */
|
||||
|
||||
/* If B_RAW flag is set, then use autoinitialise mode */
|
||||
if (flags & B_RAW) {
|
||||
if (flags & B_READ)
|
||||
outb(DMA1_MODE, DMA37MD_AUTO|DMA37MD_WRITE|chan);
|
||||
else
|
||||
outb(DMA1_MODE, DMA37MD_AUTO|DMA37MD_READ|chan);
|
||||
}
|
||||
else
|
||||
if (flags & B_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 */
|
||||
outb(waport + 1, --nbytes);
|
||||
outb(waport + 1, nbytes>>8);
|
||||
|
||||
/* 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 B_RAW flag is set, then use autoinitialise mode */
|
||||
if (flags & B_RAW) {
|
||||
if (flags & B_READ)
|
||||
outb(DMA2_MODE, DMA37MD_AUTO|DMA37MD_WRITE|(chan&3));
|
||||
else
|
||||
outb(DMA2_MODE, DMA37MD_AUTO|DMA37MD_READ|(chan&3));
|
||||
}
|
||||
else
|
||||
if (flags & B_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
|
||||
}
|
||||
|
||||
void
|
||||
isa_dmadone(int flags, caddr_t addr, int nbytes, int chan)
|
||||
{
|
||||
#ifdef DIAGNOSTIC
|
||||
if (chan & ~VALID_DMA_MASK)
|
||||
panic("isa_dmadone: channel out of range");
|
||||
|
||||
if ((dma_inuse & (1 << chan)) == 0)
|
||||
printf("isa_dmadone: channel %d not acquired\n", chan);
|
||||
#endif
|
||||
|
||||
if (((dma_busy & (1 << chan)) == 0) &&
|
||||
(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 */
|
||||
if (flags & B_READ)
|
||||
bcopy(dma_bouncebuf[chan], addr, nbytes);
|
||||
|
||||
dma_bounced &= ~(1 << chan);
|
||||
}
|
||||
dma_busy &= ~(1 << chan);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check for problems with the address range of a DMA transfer
|
||||
* (non-contiguous physical pages, outside of bus address space,
|
||||
* crossing DMA page boundaries).
|
||||
* Return true if special handling needed.
|
||||
*/
|
||||
|
||||
static int
|
||||
isa_dmarangecheck(caddr_t va, u_int length, int chan)
|
||||
{
|
||||
vm_offset_t phys, priorpage = 0, endva;
|
||||
u_int dma_pgmsk = (chan & 4) ? ~(128*1024-1) : ~(64*1024-1);
|
||||
|
||||
endva = (vm_offset_t)round_page((vm_offset_t)va + length);
|
||||
for (; va < (caddr_t) endva ; va += PAGE_SIZE) {
|
||||
phys = trunc_page(pmap_extract(pmap_kernel(), (vm_offset_t)va));
|
||||
#ifdef EPSON_BOUNCEDMA
|
||||
#define ISARAM_END 0xf00000
|
||||
#else
|
||||
#define ISARAM_END RAM_END
|
||||
#endif
|
||||
if (phys == 0)
|
||||
panic("isa_dmacheck: no physical page present");
|
||||
if (phys >= ISARAM_END)
|
||||
return (1);
|
||||
if (priorpage) {
|
||||
if (priorpage + PAGE_SIZE != phys)
|
||||
return (1);
|
||||
/* check if crossing a DMA page boundary */
|
||||
if (((u_int)priorpage ^ (u_int)phys) & dma_pgmsk)
|
||||
return (1);
|
||||
}
|
||||
priorpage = phys;
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Query the progress of a transfer on a DMA channel.
|
||||
*
|
||||
* To avoid having to interrupt a transfer in progress, we sample
|
||||
* each of the high and low databytes twice, and apply the following
|
||||
* logic to determine the correct count.
|
||||
*
|
||||
* Reads are performed with interrupts disabled, thus it is to be
|
||||
* expected that the time between reads is very small. At most
|
||||
* one rollover in the low count byte can be expected within the
|
||||
* four reads that are performed.
|
||||
*
|
||||
* There are three gaps in which a rollover can occur :
|
||||
*
|
||||
* - read low1
|
||||
* gap1
|
||||
* - read high1
|
||||
* gap2
|
||||
* - read low2
|
||||
* gap3
|
||||
* - read high2
|
||||
*
|
||||
* If a rollover occurs in gap1 or gap2, the low2 value will be
|
||||
* greater than the low1 value. In this case, low2 and high2 are a
|
||||
* corresponding pair.
|
||||
*
|
||||
* In any other case, low1 and high1 can be considered to be correct.
|
||||
*
|
||||
* The function returns the number of bytes remaining in the transfer,
|
||||
* or -1 if the channel requested is not active.
|
||||
*
|
||||
*/
|
||||
int
|
||||
isa_dmastatus(int chan)
|
||||
{
|
||||
u_long cnt = 0;
|
||||
int ffport, waport;
|
||||
u_long low1, high1, low2, high2;
|
||||
|
||||
/* channel active? */
|
||||
if ((dma_inuse & (1 << chan)) == 0) {
|
||||
printf("isa_dmastatus: channel %d not active\n", chan);
|
||||
return(-1);
|
||||
}
|
||||
/* channel busy? */
|
||||
|
||||
if (((dma_busy & (1 << chan)) == 0) &&
|
||||
(dma_auto_mode & (1 << chan)) == 0 ) {
|
||||
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 */
|
||||
low1 = inb(waport);
|
||||
high1 = inb(waport);
|
||||
outb(ffport, 0); /* clear again */
|
||||
low2 = inb(waport);
|
||||
high2 = inb(waport);
|
||||
enable_intr(); /* enable interrupts again */
|
||||
|
||||
/*
|
||||
* Now decide if a wrap has tried to skew our results.
|
||||
* Note that after TC, the count will read 0xffff, while we want
|
||||
* to return zero, so we add and then mask to compensate.
|
||||
*/
|
||||
if (low1 >= low2) {
|
||||
cnt = (low1 + (high1 << 8) + 1) & 0xffff;
|
||||
} else {
|
||||
cnt = (low2 + (high2 << 8) + 1) & 0xffff;
|
||||
}
|
||||
|
||||
if (chan >= 4) /* high channels move words */
|
||||
cnt *= 2;
|
||||
return(cnt);
|
||||
}
|
||||
|
||||
/*
|
||||
* Stop a DMA transfer currently in progress.
|
||||
*/
|
||||
int
|
||||
isa_dmastop(int chan)
|
||||
{
|
||||
if ((dma_inuse & (1 << chan)) == 0)
|
||||
printf("isa_dmastop: channel %d not acquired\n", chan);
|
||||
|
||||
if (((dma_busy & (1 << chan)) == 0) &&
|
||||
((dma_auto_mode & (1 << chan)) == 0)) {
|
||||
printf("chan %d not busy\n", chan);
|
||||
return -2 ;
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
@ -35,7 +35,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
|
||||
* $Id: machdep.c,v 1.110 1999/03/06 09:43:01 kato Exp $
|
||||
* $Id: machdep.c,v 1.111 1999/04/03 22:20:02 jdp Exp $
|
||||
*/
|
||||
|
||||
#include "apm.h"
|
||||
@ -71,6 +71,7 @@
|
||||
#include <sys/sysent.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/vmmeter.h>
|
||||
#include <sys/bus.h>
|
||||
|
||||
#ifdef SYSVSHM
|
||||
#include <sys/shm.h>
|
||||
@ -125,7 +126,9 @@
|
||||
#include <machine/perfmon.h>
|
||||
#endif
|
||||
|
||||
#ifdef OLD_BUS_ARCH
|
||||
#include <i386/isa/isa_device.h>
|
||||
#endif
|
||||
#include <i386/isa/intr_machdep.h>
|
||||
#ifdef PC98
|
||||
#include <pc98/pc98/pc98_machdep.h>
|
||||
@ -153,7 +156,7 @@ SYSINIT(cpu, SI_SUB_CPU, SI_ORDER_FIRST, cpu_startup, NULL)
|
||||
static MALLOC_DEFINE(M_MBUF, "mbuf", "mbuf");
|
||||
|
||||
#ifdef PC98
|
||||
int need_pre_dma_flush; /* If 1, use wbinvd befor DMA transfer. */
|
||||
int need_pre_dma_flush; /* If 1, use wbinvd befor DMA transfer. */
|
||||
int need_post_dma_flush; /* If 1, use invd after DMA transfer. */
|
||||
#endif
|
||||
|
||||
@ -169,9 +172,9 @@ SYSCTL_INT(_debug, OID_AUTO, tlb_flush_count,
|
||||
#endif
|
||||
|
||||
#ifdef PC98
|
||||
int ispc98 = 1;
|
||||
static int ispc98 = 1;
|
||||
#else
|
||||
int ispc98 = 0;
|
||||
static int ispc98 = 0;
|
||||
#endif
|
||||
SYSCTL_INT(_machdep, OID_AUTO, ispc98, CTLFLAG_RD, &ispc98, 0, "");
|
||||
|
||||
@ -850,6 +853,9 @@ setregs(p, entry, stack, ps_strings)
|
||||
regs->tf_es = _udatasel;
|
||||
regs->tf_cs = _ucodesel;
|
||||
|
||||
/* PS_STRINGS value for BSD/OS binaries. It is 0 for non-BSD/OS. */
|
||||
regs->tf_ebx = ps_strings;
|
||||
|
||||
/* reset %fs and %gs as well */
|
||||
pcb->pcb_fs = _udatasel;
|
||||
pcb->pcb_gs = _udatasel;
|
||||
@ -1174,8 +1180,10 @@ init386(first)
|
||||
unsigned biosbasemem, biosextmem;
|
||||
struct gate_descriptor *gdp;
|
||||
int gsel_tss;
|
||||
#if NNPX > 0
|
||||
int msize;
|
||||
#endif
|
||||
|
||||
struct isa_device *idp;
|
||||
#ifndef SMP
|
||||
/* table descriptors - used to load tables by microp */
|
||||
struct region_descriptor r_gdt, r_idt;
|
||||
@ -1478,10 +1486,11 @@ init386(first)
|
||||
#endif
|
||||
|
||||
#if NNPX > 0
|
||||
idp = find_isadev(isa_devtab_null, &npxdriver, 0);
|
||||
if (idp != NULL && idp->id_msize != 0) {
|
||||
Maxmem = idp->id_msize / 4;
|
||||
speculative_mprobe = FALSE;
|
||||
if (resource_int_value("npx", 0, "msize", &msize) == 0) {
|
||||
if (msize != 0) {
|
||||
Maxmem = msize / 4;
|
||||
speculative_mprobe = FALSE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -32,7 +32,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)npx.c 7.2 (Berkeley) 5/12/91
|
||||
* $Id: npx.c,v 1.42 1999/01/16 11:41:18 kato Exp $
|
||||
* $Id: npx.c,v 1.43 1999/04/01 13:41:40 kato Exp $
|
||||
*/
|
||||
|
||||
#include "npx.h"
|
||||
@ -44,10 +44,14 @@
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/proc.h>
|
||||
#include <machine/bus.h>
|
||||
#include <sys/rman.h>
|
||||
#ifdef NPX_DEBUG
|
||||
#include <sys/syslog.h>
|
||||
#endif
|
||||
@ -65,6 +69,7 @@
|
||||
#ifndef SMP
|
||||
#include <machine/clock.h>
|
||||
#endif
|
||||
#include <machine/resource.h>
|
||||
#include <machine/specialreg.h>
|
||||
#include <machine/segments.h>
|
||||
|
||||
@ -77,7 +82,6 @@
|
||||
#include <i386/isa/isa.h>
|
||||
#endif
|
||||
#endif
|
||||
#include <i386/isa/isa_device.h>
|
||||
|
||||
/*
|
||||
* 387 and 287 Numeric Coprocessor Extension (NPX) Driver.
|
||||
@ -88,9 +92,6 @@
|
||||
#define NPX_DISABLE_I586_OPTIMIZED_BZERO (1 << 1)
|
||||
#define NPX_DISABLE_I586_OPTIMIZED_COPYIO (1 << 2)
|
||||
|
||||
/* XXX - should be in header file. */
|
||||
ointhand2_t npxintr;
|
||||
|
||||
#ifdef __GNUC__
|
||||
|
||||
#define fldcw(addr) __asm("fldcw %0" : : "m" (*(addr)))
|
||||
@ -124,18 +125,17 @@ void stop_emulating __P((void));
|
||||
|
||||
typedef u_char bool_t;
|
||||
|
||||
static int npxattach __P((struct isa_device *dvp));
|
||||
static int npxprobe __P((struct isa_device *dvp));
|
||||
static int npxprobe1 __P((struct isa_device *dvp));
|
||||
#define NPXIRQ 8
|
||||
|
||||
static int npx_attach __P((device_t dev));
|
||||
void npx_intr __P((void *));
|
||||
static int npx_probe __P((device_t dev));
|
||||
static int npx_probe1 __P((device_t dev));
|
||||
#ifdef I586_CPU
|
||||
static long timezero __P((const char *funcname,
|
||||
void (*func)(void *buf, size_t len)));
|
||||
#endif /* I586_CPU */
|
||||
|
||||
struct isa_driver npxdriver = {
|
||||
npxprobe, npxattach, "npx",
|
||||
};
|
||||
|
||||
int hw_float; /* XXX currently just alias for npx_exists */
|
||||
|
||||
SYSCTL_INT(_hw,HW_FLOATINGPT, floatingpoint,
|
||||
@ -206,12 +206,13 @@ __asm(" \n\
|
||||
* need to use interrupts. Return 1 if device exists.
|
||||
*/
|
||||
static int
|
||||
npxprobe(dvp)
|
||||
struct isa_device *dvp;
|
||||
npx_probe(dev)
|
||||
device_t dev;
|
||||
{
|
||||
#ifdef SMP
|
||||
/*#ifdef SMP*/
|
||||
#if 1
|
||||
|
||||
return npxprobe1(dvp);
|
||||
return npx_probe1(dev);
|
||||
|
||||
#else /* SMP */
|
||||
|
||||
@ -228,7 +229,11 @@ npxprobe(dvp)
|
||||
* install suitable handlers and run with interrupts enabled so we
|
||||
* won't need to do so much here.
|
||||
*/
|
||||
npx_intrno = NRSVIDT + ffs(dvp->id_irq) - 1;
|
||||
#ifdef PC98
|
||||
npx_intrno = NRSVIDT + NPXIRQ;
|
||||
#else
|
||||
npx_intrno = NRSVIDT + 13;
|
||||
#endif
|
||||
save_eflags = read_eflags();
|
||||
disable_intr();
|
||||
#ifdef PC98
|
||||
@ -241,17 +246,17 @@ npxprobe(dvp)
|
||||
save_idt_npxintr = idt[npx_intrno];
|
||||
save_idt_npxtrap = idt[16];
|
||||
#ifdef PC98
|
||||
outb(IO_ICU1 + 2, ~(IRQ_SLAVE | dvp->id_irq));
|
||||
outb(IO_ICU2 + 2, ~(dvp->id_irq >> 8));
|
||||
outb(IO_ICU1 + 2, ~IRQ_SLAVE);
|
||||
outb(IO_ICU2 + 2, ~(1 << (NPXIRQ - 8)));
|
||||
#else
|
||||
outb(IO_ICU1 + 1, ~(IRQ_SLAVE | dvp->id_irq));
|
||||
outb(IO_ICU2 + 1, ~(dvp->id_irq >> 8));
|
||||
outb(IO_ICU1 + 1, ~IRQ_SLAVE);
|
||||
outb(IO_ICU2 + 1, ~(1 << (13 - 8)));
|
||||
#endif
|
||||
setidt(16, probetrap, SDT_SYS386TGT, SEL_KPL, GSEL(GCODE_SEL, SEL_KPL));
|
||||
setidt(npx_intrno, probeintr, SDT_SYS386IGT, SEL_KPL, GSEL(GCODE_SEL, SEL_KPL));
|
||||
npx_idt_probeintr = idt[npx_intrno];
|
||||
enable_intr();
|
||||
result = npxprobe1(dvp);
|
||||
result = npx_probe1(dev);
|
||||
disable_intr();
|
||||
#ifdef PC98
|
||||
outb(IO_ICU1 + 2, save_icu1_mask);
|
||||
@ -269,8 +274,8 @@ npxprobe(dvp)
|
||||
}
|
||||
|
||||
static int
|
||||
npxprobe1(dvp)
|
||||
struct isa_device *dvp;
|
||||
npx_probe1(dev)
|
||||
device_t dev;
|
||||
{
|
||||
#ifndef SMP
|
||||
u_short control;
|
||||
@ -314,21 +319,18 @@ npxprobe1(dvp)
|
||||
*/
|
||||
fninit();
|
||||
|
||||
#ifdef SMP
|
||||
|
||||
/*#ifdef SMP*/
|
||||
#if 1
|
||||
/*
|
||||
* Exception 16 MUST work for SMP.
|
||||
*/
|
||||
npx_irq13 = 0;
|
||||
npx_ex16 = hw_float = npx_exists = 1;
|
||||
dvp->id_irq = 0; /* zap the interrupt */
|
||||
/*
|
||||
* special return value to flag that we do not
|
||||
* actually use any I/O registers
|
||||
*/
|
||||
return (-1);
|
||||
device_set_desc(dev, "math processor");
|
||||
return (0);
|
||||
|
||||
#else /* SMP */
|
||||
#else /* !SMP */
|
||||
device_set_desc(dev, "math processor");
|
||||
|
||||
/*
|
||||
* Don't use fwait here because it might hang.
|
||||
@ -378,14 +380,12 @@ npxprobe1(dvp)
|
||||
* Good, exception 16 works.
|
||||
*/
|
||||
npx_ex16 = 1;
|
||||
dvp->id_irq = 0; /* zap the interrupt */
|
||||
/*
|
||||
* special return value to flag that we do not
|
||||
* actually use any I/O registers
|
||||
*/
|
||||
return (-1);
|
||||
return (0);
|
||||
}
|
||||
if (npx_intrs_while_probing != 0) {
|
||||
int rid;
|
||||
struct resource *r;
|
||||
void *intr;
|
||||
/*
|
||||
* Bad, we are stuck with IRQ13.
|
||||
*/
|
||||
@ -393,8 +393,40 @@ npxprobe1(dvp)
|
||||
/*
|
||||
* npxattach would be too late to set npx0_imask.
|
||||
*/
|
||||
npx0_imask |= dvp->id_irq;
|
||||
return (IO_NPXSIZE);
|
||||
#ifdef PC98
|
||||
npx0_imask |= (1 << NPXIRQ);
|
||||
#else
|
||||
npx0_imask |= (1 << 13);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* We allocate these resources permanently,
|
||||
* so there is no need to keep track of them.
|
||||
*/
|
||||
rid = 0;
|
||||
r = bus_alloc_resource(dev, SYS_RES_IOPORT,
|
||||
&rid, IO_NPX, IO_NPX,
|
||||
IO_NPXSIZE, RF_ACTIVE);
|
||||
if (r == 0)
|
||||
panic("npx: can't get ports");
|
||||
rid = 0;
|
||||
#ifdef PC98
|
||||
r = bus_alloc_resource(dev, SYS_RES_IRQ,
|
||||
&rid, NPXIRQ, NPXIRQ,
|
||||
1, RF_ACTIVE);
|
||||
#else
|
||||
r = bus_alloc_resource(dev, SYS_RES_IRQ,
|
||||
&rid, 13, 13,
|
||||
1, RF_ACTIVE);
|
||||
#endif
|
||||
if (r == 0)
|
||||
panic("npx: can't get IRQ");
|
||||
BUS_SETUP_INTR(device_get_parent(dev),
|
||||
dev, r, npx_intr, 0, &intr);
|
||||
if (intr == 0)
|
||||
panic("npx: can't create intr");
|
||||
|
||||
return (0);
|
||||
}
|
||||
/*
|
||||
* Worse, even IRQ13 is broken. Use emulator.
|
||||
@ -406,13 +438,7 @@ npxprobe1(dvp)
|
||||
* emulator and say that it has been installed. XXX handle devices
|
||||
* that aren't really devices better.
|
||||
*/
|
||||
dvp->id_irq = 0;
|
||||
/*
|
||||
* special return value to flag that we do not
|
||||
* actually use any I/O registers
|
||||
*/
|
||||
return (-1);
|
||||
|
||||
return (0);
|
||||
#endif /* SMP */
|
||||
}
|
||||
|
||||
@ -420,14 +446,15 @@ npxprobe1(dvp)
|
||||
* Attach routine - announce which it is, and wire into system
|
||||
*/
|
||||
int
|
||||
npxattach(dvp)
|
||||
struct isa_device *dvp;
|
||||
npx_attach(dev)
|
||||
device_t dev;
|
||||
{
|
||||
dvp->id_ointr = npxintr;
|
||||
int flags;
|
||||
|
||||
/* The caller has printed "irq 13" for the npx_irq13 case. */
|
||||
if (!npx_irq13) {
|
||||
printf("npx%d: ", dvp->id_unit);
|
||||
device_print_prettyname(dev);
|
||||
if (npx_irq13) {
|
||||
printf("using IRQ 13 interface\n");
|
||||
} else {
|
||||
if (npx_ex16)
|
||||
printf("INT 16 interface\n");
|
||||
#if defined(MATH_EMULATE) || defined(GPL_MATH_EMULATE)
|
||||
@ -444,23 +471,26 @@ npxattach(dvp)
|
||||
npxinit(__INITIAL_NPXCW__);
|
||||
|
||||
#ifdef I586_CPU
|
||||
if (resource_int_value("npx", 0, "flags", &flags) != 0)
|
||||
flags = 0;
|
||||
|
||||
if (cpu_class == CPUCLASS_586 && npx_ex16 &&
|
||||
timezero("i586_bzero()", i586_bzero) <
|
||||
timezero("bzero()", bzero) * 4 / 5) {
|
||||
if (!(dvp->id_flags & NPX_DISABLE_I586_OPTIMIZED_BCOPY)) {
|
||||
if (!(flags & NPX_DISABLE_I586_OPTIMIZED_BCOPY)) {
|
||||
bcopy_vector = i586_bcopy;
|
||||
ovbcopy_vector = i586_bcopy;
|
||||
}
|
||||
if (!(dvp->id_flags & NPX_DISABLE_I586_OPTIMIZED_BZERO))
|
||||
if (!(flags & NPX_DISABLE_I586_OPTIMIZED_BZERO))
|
||||
bzero = i586_bzero;
|
||||
if (!(dvp->id_flags & NPX_DISABLE_I586_OPTIMIZED_COPYIO)) {
|
||||
if (!(flags & NPX_DISABLE_I586_OPTIMIZED_COPYIO)) {
|
||||
copyin_vector = i586_copyin;
|
||||
copyout_vector = i586_copyout;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return (1); /* XXX unused */
|
||||
return (0); /* XXX unused */
|
||||
}
|
||||
|
||||
/*
|
||||
@ -537,8 +567,8 @@ npxexit(p)
|
||||
* solution for signals other than SIGFPE.
|
||||
*/
|
||||
void
|
||||
npxintr(unit)
|
||||
int unit;
|
||||
npx_intr(dummy)
|
||||
void *dummy;
|
||||
{
|
||||
int code;
|
||||
struct intrframe *frame;
|
||||
@ -565,7 +595,7 @@ npxintr(unit)
|
||||
/*
|
||||
* Pass exception to process.
|
||||
*/
|
||||
frame = (struct intrframe *)&unit; /* XXX */
|
||||
frame = (struct intrframe *)&dummy; /* XXX */
|
||||
if ((ISPL(frame->if_cs) == SEL_UPL) || (frame->if_eflags & PSL_VM)) {
|
||||
/*
|
||||
* Interrupt is essentially a trap, so we can afford to call
|
||||
@ -753,4 +783,31 @@ timezero(funcname, func)
|
||||
}
|
||||
#endif /* I586_CPU */
|
||||
|
||||
static device_method_t npx_methods[] = {
|
||||
/* Device interface */
|
||||
DEVMETHOD(device_probe, npx_probe),
|
||||
DEVMETHOD(device_attach, npx_attach),
|
||||
DEVMETHOD(device_detach, bus_generic_detach),
|
||||
DEVMETHOD(device_shutdown, bus_generic_shutdown),
|
||||
DEVMETHOD(device_suspend, bus_generic_suspend),
|
||||
DEVMETHOD(device_resume, bus_generic_resume),
|
||||
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static driver_t npx_driver = {
|
||||
"npx",
|
||||
npx_methods,
|
||||
DRIVER_TYPE_MISC,
|
||||
1, /* no softc */
|
||||
};
|
||||
|
||||
static devclass_t npx_devclass;
|
||||
|
||||
/*
|
||||
* We prefer to attach to the root nexus so that the usual case (exception 16)
|
||||
* doesn't describe the processor as being `on isa'.
|
||||
*/
|
||||
DRIVER_MODULE(npx, nexus, npx_driver, npx_devclass, 0, 0);
|
||||
|
||||
#endif /* NNPX > 0 */
|
||||
|
@ -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: pc98gdc.c,v 1.5 1999/02/06 09:30:19 kato Exp $
|
||||
* $Id: pc98gdc.c,v 1.6 1999/03/02 12:34:24 kato Exp $
|
||||
*/
|
||||
|
||||
#include "gdc.h"
|
||||
@ -52,8 +52,7 @@
|
||||
|
||||
#include <pc98/pc98/pc98.h>
|
||||
#include <pc98/pc98/pc98_machdep.h>
|
||||
|
||||
#include <i386/isa/isa_device.h>
|
||||
#include <isa/isavar.h>
|
||||
|
||||
#define TEXT_GDC IO_GDC1 /* 0x60 */
|
||||
#define ROW 25
|
||||
@ -66,27 +65,36 @@
|
||||
#define GDC_UNIT(dev) minor(dev)
|
||||
#define GDC_MKMINOR(unit) (unit)
|
||||
|
||||
static int gdcprobe(struct isa_device *dev);
|
||||
static int gdc_attach(struct isa_device *dev);
|
||||
|
||||
struct isa_driver gdcdriver = {
|
||||
gdcprobe,
|
||||
gdc_attach,
|
||||
DRIVER_NAME,
|
||||
0,
|
||||
};
|
||||
|
||||
typedef struct gdc_softc {
|
||||
video_adapter_t *adp;
|
||||
} gdc_softc_t;
|
||||
|
||||
#define GDC_SOFTC(unit) \
|
||||
((gdc_softc_t *)devclass_get_softc(gdc_devclass, unit))
|
||||
|
||||
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,
|
||||
DRIVER_TYPE_TTY,
|
||||
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);
|
||||
|
||||
#define GDC_SOFTC(unit) (gdc_softc[unit])
|
||||
|
||||
static gdc_softc_t *gdc_softc[NGDC];
|
||||
|
||||
#if FB_INSTALL_CDEV
|
||||
|
||||
static d_open_t gdcopen;
|
||||
@ -104,44 +112,22 @@ static struct cdevsw vga_cdevsw = {
|
||||
#endif /* FB_INSTALL_CDEV */
|
||||
|
||||
static int
|
||||
gdcprobe(struct isa_device *dev)
|
||||
gdcprobe(device_t dev)
|
||||
{
|
||||
gdc_softc_t *sc;
|
||||
int error;
|
||||
|
||||
if (dev->id_unit >= sizeof(gdc_softc)/sizeof(gdc_softc[0]))
|
||||
return 0;
|
||||
sc = gdc_softc[dev->id_unit]
|
||||
= malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT);
|
||||
if (sc == NULL)
|
||||
return 0;
|
||||
|
||||
error = gdc_probe_unit(dev->id_unit, sc, dev->id_flags);
|
||||
if (error) {
|
||||
gdc_softc[dev->id_unit] = NULL;
|
||||
free(sc, M_DEVBUF);
|
||||
return 0;
|
||||
}
|
||||
|
||||
dev->id_iobase = sc->adp->va_io_base;
|
||||
dev->id_maddr = (caddr_t)BIOS_PADDRTOVADDR(sc->adp->va_mem_base);
|
||||
dev->id_msize = sc->adp->va_mem_size;
|
||||
|
||||
return sc->adp->va_io_size;
|
||||
device_set_desc(dev, "Generic GDC");
|
||||
sc = device_get_softc(dev);
|
||||
return gdc_probe_unit(device_get_unit(dev), sc, isa_get_flags(dev));
|
||||
}
|
||||
|
||||
static int
|
||||
gdc_attach(struct isa_device *dev)
|
||||
gdc_attach(device_t dev)
|
||||
{
|
||||
gdc_softc_t *sc;
|
||||
|
||||
if (dev->id_unit >= sizeof(gdc_softc)/sizeof(gdc_softc[0]))
|
||||
return 0;
|
||||
sc = gdc_softc[dev->id_unit];
|
||||
if (sc == NULL)
|
||||
return 0;
|
||||
|
||||
return ((gdc_attach_unit(dev->id_unit, sc, dev->id_flags)) ? 0 : 1);
|
||||
sc = device_get_softc(dev);
|
||||
return gdc_attach_unit(device_get_unit(dev), sc, isa_get_flags(dev));
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -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: pc98kbd.c,v 1.4 1999/01/19 14:08:04 kato Exp $
|
||||
* $Id: pc98kbd.c,v 1.5 1999/03/10 14:51:53 kato Exp $
|
||||
*/
|
||||
|
||||
#include "pckbd.h"
|
||||
@ -39,10 +39,13 @@
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/tty.h>
|
||||
#include <sys/fcntl.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/bus.h>
|
||||
#include <machine/bus.h>
|
||||
#include <sys/rman.h>
|
||||
|
||||
#include <machine/resource.h>
|
||||
|
||||
@ -51,6 +54,9 @@
|
||||
#include <pc98/pc98/pc98.h>
|
||||
#include <pc98/pc98/pc98_machdep.h>
|
||||
|
||||
#include <isa/isavar.h>
|
||||
#include <machine/lock.h>
|
||||
|
||||
#ifdef __i386__
|
||||
#include <i386/isa/isa_device.h>
|
||||
#endif
|
||||
@ -76,23 +82,30 @@ typedef struct pckbd_softc {
|
||||
} pckbd_softc_t;
|
||||
|
||||
#define PC98KBD_SOFTC(unit) \
|
||||
(((unit) >= NPCKBD) ? NULL : pckbd_softc[(unit)])
|
||||
((pckbd_softc_t)devclass_get_softc(pckbd_devclass, unit))
|
||||
|
||||
static pckbd_softc_t *pckbd_softc[NPCKBD];
|
||||
static devclass_t pckbd_devclass;
|
||||
|
||||
static int pckbdprobe(struct isa_device *dev);
|
||||
static int pckbdattach(struct isa_device *dev);
|
||||
static int pckbdprobe(device_t dev);
|
||||
static int pckbdattach(device_t dev);
|
||||
static void pckbd_isa_intr(void *arg);
|
||||
|
||||
static ointhand2_t pckbd_isa_intr;
|
||||
|
||||
/* driver declaration for isa_devtab_tty[] */
|
||||
struct isa_driver pckbddriver = {
|
||||
pckbdprobe,
|
||||
pckbdattach,
|
||||
DRIVER_NAME,
|
||||
0,
|
||||
static device_method_t pckbd_methods[] = {
|
||||
/* Device interface */
|
||||
DEVMETHOD(device_probe, pckbdprobe),
|
||||
DEVMETHOD(device_attach, pckbdattach),
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static driver_t pckbd_driver = {
|
||||
DRIVER_NAME,
|
||||
pckbd_methods,
|
||||
DRIVER_TYPE_TTY,
|
||||
sizeof(pckbd_softc_t),
|
||||
};
|
||||
|
||||
DRIVER_MODULE(pckbd, isa, pckbd_driver, pckbd_devclass, 0, 0);
|
||||
|
||||
static int pckbd_probe_unit(int unit, int port, int irq,
|
||||
int flags);
|
||||
static int pckbd_attach_unit(int unit, pckbd_softc_t *sc,
|
||||
@ -117,36 +130,41 @@ static struct cdevsw pckbd_cdevsw = {
|
||||
#endif /* KBD_INSTALL_CDEV */
|
||||
|
||||
static int
|
||||
pckbdprobe(struct isa_device *dev)
|
||||
pckbdprobe(device_t dev)
|
||||
{
|
||||
return ((pckbd_probe_unit(dev->id_unit, dev->id_iobase, dev->id_irq,
|
||||
dev->id_flags)) ? 0 : IO_KBDSIZE);
|
||||
device_set_desc(dev, "PC-98 Keyboard");
|
||||
|
||||
return pckbd_probe_unit(device_get_unit(dev), isa_get_port(dev),
|
||||
(1 << isa_get_irq(dev)), isa_get_flags(dev));
|
||||
}
|
||||
|
||||
static int
|
||||
pckbdattach(struct isa_device *dev)
|
||||
pckbdattach(device_t dev)
|
||||
{
|
||||
pckbd_softc_t *sc;
|
||||
void *ih;
|
||||
struct resource *res;
|
||||
int zero = 0;
|
||||
|
||||
if (dev->id_unit >= sizeof(pckbd_softc)/sizeof(pckbd_softc[0]))
|
||||
return 0;
|
||||
sc = pckbd_softc[dev->id_unit]
|
||||
= malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT);
|
||||
if (sc == NULL)
|
||||
return 0;
|
||||
pckbd_softc_t *sc = device_get_softc(dev);
|
||||
bzero(sc, sizeof(*sc));
|
||||
|
||||
dev->id_ointr = pckbd_isa_intr;
|
||||
return ((pckbd_attach_unit(dev->id_unit, sc, dev->id_iobase,
|
||||
dev->id_irq, dev->id_flags)) ? 0 : 1);
|
||||
pckbd_attach_unit(device_get_unit(dev), sc, isa_get_port(dev),
|
||||
(1 << isa_get_irq(dev)), isa_get_flags(dev));
|
||||
|
||||
res = bus_alloc_resource(dev, SYS_RES_IRQ, &zero, 0ul, ~0ul, 1,
|
||||
RF_SHAREABLE | RF_ACTIVE);
|
||||
BUS_SETUP_INTR(device_get_parent(dev), dev, res, pckbd_isa_intr,
|
||||
sc, &ih);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void
|
||||
pckbd_isa_intr(int unit)
|
||||
pckbd_isa_intr(void *arg)
|
||||
{
|
||||
keyboard_t *kbd;
|
||||
pckbd_softc_t *sc = arg;
|
||||
keyboard_t *kbd = sc->kbd;
|
||||
|
||||
kbd = pckbd_softc[unit]->kbd;
|
||||
(*kbdsw[kbd->kb_index]->intr)(kbd, NULL);
|
||||
}
|
||||
|
||||
@ -414,15 +432,14 @@ pckbd_configure(int flags)
|
||||
{
|
||||
keyboard_t *kbd;
|
||||
int arg[2];
|
||||
struct isa_device *dev;
|
||||
int i;
|
||||
|
||||
/* XXX: a kludge to obtain the device configuration flags */
|
||||
dev = find_isadev(isa_devtab_tty, &pckbddriver, 0);
|
||||
if (dev != NULL) {
|
||||
flags |= dev->id_flags;
|
||||
if (resource_int_value(DRIVER_NAME, 0, "flags", &i) == 0) {
|
||||
flags |= i;
|
||||
/* if the driver is disabled, unregister the keyboard if any */
|
||||
if (!dev->id_enabled) {
|
||||
if (resource_int_value(DRIVER_NAME, 0, "disabled", &i) == 0
|
||||
&& i != 0) {
|
||||
i = kbd_find_keyboard(DRIVER_NAME, PC98KBD_DEFAULT);
|
||||
if (i >= 0) {
|
||||
kbd = kbd_get_keyboard(i);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -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.114 1999/03/10 14:51:53 kato Exp $
|
||||
* $Id: syscons.c,v 1.115 1999/04/04 02:53:08 kato Exp $
|
||||
*/
|
||||
|
||||
#include "sc.h"
|
||||
@ -33,7 +33,6 @@
|
||||
#include "apm.h"
|
||||
#include "opt_ddb.h"
|
||||
#include "opt_devfs.h"
|
||||
#include "opt_vesa.h"
|
||||
#include "opt_vm86.h"
|
||||
#include "opt_syscons.h"
|
||||
|
||||
@ -42,6 +41,8 @@
|
||||
#include <sys/systm.h>
|
||||
#include <sys/reboot.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/signalvar.h>
|
||||
#include <sys/tty.h>
|
||||
@ -79,6 +80,7 @@
|
||||
#include <i386/isa/isa_device.h>
|
||||
#include <i386/isa/timerreg.h>
|
||||
#include <pc98/pc98/syscons.h>
|
||||
#include <isa/isavar.h>
|
||||
#else
|
||||
#include <dev/fb/vgareg.h>
|
||||
#include <dev/syscons/syscons.h>
|
||||
@ -282,10 +284,10 @@ static const int nsccons = MAXCONS+2;
|
||||
(*kbdsw[(kbd)->kb_index]->poll)((kbd), (on))
|
||||
|
||||
/* prototypes */
|
||||
static int scattach(struct isa_device *dev);
|
||||
static int scattach(device_t dev);
|
||||
static kbd_callback_func_t sckbdevent;
|
||||
static int scparam(struct tty *tp, struct termios *t);
|
||||
static int scprobe(struct isa_device *dev);
|
||||
static int scprobe(device_t dev);
|
||||
static int scvidprobe(int unit, int flags, int cons);
|
||||
static int sckbdprobe(int unit, int flags, int cons);
|
||||
static void scstart(struct tty *tp);
|
||||
@ -357,10 +359,23 @@ static cn_putc_t sccnputc;
|
||||
|
||||
CONS_DRIVER(sc, sccnprobe, sccninit, sccngetc, sccncheckc, sccnputc);
|
||||
|
||||
struct isa_driver scdriver = {
|
||||
scprobe, scattach, "sc", 1
|
||||
devclass_t sc_devclass;
|
||||
|
||||
static device_method_t sc_methods[] = {
|
||||
DEVMETHOD(device_probe, scprobe),
|
||||
DEVMETHOD(device_attach, scattach),
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static driver_t sc_driver = {
|
||||
"sc",
|
||||
sc_methods,
|
||||
DRIVER_TYPE_TTY,
|
||||
1, /* XXX */
|
||||
};
|
||||
|
||||
DRIVER_MODULE(sc, isa, sc_driver, sc_devclass, 0, 0);
|
||||
|
||||
static d_open_t scopen;
|
||||
static d_close_t scclose;
|
||||
static d_read_t scread;
|
||||
@ -511,15 +526,20 @@ move_crsr(scr_stat *scp, int x, int y)
|
||||
}
|
||||
|
||||
static int
|
||||
scprobe(struct isa_device *dev)
|
||||
scprobe(device_t dev)
|
||||
{
|
||||
if (!scvidprobe(dev->id_unit, dev->id_flags, FALSE)) {
|
||||
int unit = device_get_unit(dev);
|
||||
int flags = isa_get_flags(dev);
|
||||
|
||||
device_set_desc(dev, "System console");
|
||||
|
||||
if (!scvidprobe(unit, flags, FALSE)) {
|
||||
if (bootverbose)
|
||||
printf("sc%d: no video adapter is found.\n", dev->id_unit);
|
||||
return (0);
|
||||
printf("sc%d: no video adapter is found.\n", unit);
|
||||
return ENXIO;
|
||||
}
|
||||
|
||||
return ((sckbdprobe(dev->id_unit, dev->id_flags, FALSE)) ? -1 : 0);
|
||||
return ((sckbdprobe(unit, flags, FALSE)) ? 0 : ENXIO);
|
||||
}
|
||||
|
||||
/* probe video adapters, return TRUE if found */
|
||||
@ -583,7 +603,7 @@ scresume(void *dummy)
|
||||
#endif
|
||||
|
||||
static int
|
||||
scattach(struct isa_device *dev)
|
||||
scattach(device_t dev)
|
||||
{
|
||||
scr_stat *scp;
|
||||
#if defined(VESA) && defined(VM86)
|
||||
@ -596,7 +616,7 @@ scattach(struct isa_device *dev)
|
||||
|
||||
scinit();
|
||||
scp = console[0];
|
||||
sc_flags = dev->id_flags;
|
||||
sc_flags = isa_get_flags(dev);
|
||||
if (!ISFONTAVAIL(scp->adp->va_flags))
|
||||
sc_flags &= ~CHAR_CURSOR;
|
||||
|
||||
@ -646,14 +666,14 @@ scattach(struct isa_device *dev)
|
||||
update_kbd_state(scp->status, LOCK_MASK);
|
||||
|
||||
if (bootverbose) {
|
||||
printf("sc%d:", dev->id_unit);
|
||||
printf("sc%d:", device_get_unit(dev));
|
||||
if (adapter >= 0)
|
||||
printf(" fb%d", adapter);
|
||||
if (keyboard >= 0)
|
||||
printf(" kbd%d", keyboard);
|
||||
printf("\n");
|
||||
}
|
||||
printf("sc%d: ", dev->id_unit);
|
||||
printf("sc%d: ", device_get_unit(dev));
|
||||
switch(scp->adp->va_type) {
|
||||
#ifdef PC98
|
||||
case KD_PC98:
|
||||
@ -1923,6 +1943,7 @@ scmousestart(struct tty *tp)
|
||||
static void
|
||||
sccnprobe(struct consdev *cp)
|
||||
{
|
||||
#if 0
|
||||
struct isa_device *dvp;
|
||||
|
||||
/*
|
||||
@ -1939,6 +1960,13 @@ sccnprobe(struct consdev *cp)
|
||||
return;
|
||||
}
|
||||
sckbdprobe(dvp->id_unit, dvp->id_flags, TRUE);
|
||||
#else
|
||||
if (!scvidprobe(0, 0, TRUE)) {
|
||||
cp->cn_pri = CN_DEAD;
|
||||
return;
|
||||
}
|
||||
sckbdprobe(0, 0, TRUE);
|
||||
#endif
|
||||
|
||||
/* initialize required fields */
|
||||
cp->cn_dev = makedev(CDEV_MAJOR, SC_CONSOLE);
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)wd.c 7.2 (Berkeley) 5/9/91
|
||||
* $Id: wd.c,v 1.76 1999/03/25 08:29:32 kato Exp $
|
||||
* $Id: wd.c,v 1.77 1999/04/03 15:51:54 kato Exp $
|
||||
*/
|
||||
|
||||
/* TODO:
|
||||
@ -64,17 +64,16 @@
|
||||
|
||||
#if NWDC > 0
|
||||
|
||||
#include "opt_atapi.h"
|
||||
#include "opt_devfs.h"
|
||||
#include "opt_hw_wdog.h"
|
||||
#include "opt_ide_delay.h"
|
||||
#include "opt_wd.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/dkbad.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/disklabel.h>
|
||||
#include <sys/diskslice.h>
|
||||
#include <sys/buf.h>
|
||||
@ -505,10 +504,10 @@ wdattach(struct isa_device *dvp)
|
||||
#if defined(DEVFS)
|
||||
int mynor;
|
||||
#endif
|
||||
u_int unit, lunit;
|
||||
struct isa_device *wdup;
|
||||
int unit, lunit, flags, i;
|
||||
struct disk *du;
|
||||
struct wdparams *wp;
|
||||
static char buf[] = "wdcXXX";
|
||||
|
||||
dvp->id_intr = wdintr;
|
||||
|
||||
@ -528,16 +527,17 @@ wdattach(struct isa_device *dvp)
|
||||
bufq_init(&wdtab[dvp->id_unit].controller_queue);
|
||||
#endif
|
||||
|
||||
for (wdup = isa_biotab_wdc; wdup->id_driver != 0; wdup++) {
|
||||
if (!old_epson_note) {
|
||||
if (wdup->id_iobase != dvp->id_iobase)
|
||||
continue;
|
||||
}
|
||||
lunit = wdup->id_unit;
|
||||
if (lunit >= NWD)
|
||||
sprintf(buf, "wdc%d", dvp->id_unit);
|
||||
for (i = resource_query_string(-1, "at", buf);
|
||||
i != -1;
|
||||
i = resource_query_string(i, "at", buf)) {
|
||||
if (strcmp(resource_query_name(i), "wd"))
|
||||
/* Avoid a bit of foot shooting. */
|
||||
continue;
|
||||
|
||||
unit = wdup->id_physid;
|
||||
lunit = resource_query_unit(i);
|
||||
if (lunit >= NWD)
|
||||
continue;
|
||||
#ifdef PC98
|
||||
if ((lunit%2)!=0) {
|
||||
if ((PC98_SYSTEM_PARAMETER(0x457) & 0x40)==0) {
|
||||
@ -546,6 +546,11 @@ wdattach(struct isa_device *dvp)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (resource_int_value("wd", lunit, "drive", &unit) != 0)
|
||||
continue;
|
||||
if (resource_int_value("wd", lunit, "flags", &flags) != 0)
|
||||
flags = 0;
|
||||
|
||||
du = malloc(sizeof *du, M_TEMP, M_NOWAIT);
|
||||
if (du == NULL)
|
||||
continue;
|
||||
@ -571,7 +576,7 @@ wdattach(struct isa_device *dvp)
|
||||
* Use the individual device flags or the controller
|
||||
* flags.
|
||||
*/
|
||||
du->cfg_flags = wdup->id_flags |
|
||||
du->cfg_flags = flags |
|
||||
((dvp->id_flags) >> (16 * unit));
|
||||
|
||||
if (wdgetctlr(du) == 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user