summaryrefslogtreecommitdiffstats
path: root/sys/pc98
diff options
context:
space:
mode:
authorasami <asami@FreeBSD.org>1996-09-03 10:24:29 +0000
committerasami <asami@FreeBSD.org>1996-09-03 10:24:29 +0000
commitbbb6994e507486b942d268c5f28330727a4d2e49 (patch)
tree25143600bc63d63f429c367f5868528bf984e44a /sys/pc98
parentf8bde85e2062bc43410f42137dd79e2359fc78c1 (diff)
downloadFreeBSD-src-bbb6994e507486b942d268c5f28330727a4d2e49.zip
FreeBSD-src-bbb6994e507486b942d268c5f28330727a4d2e49.tar.gz
Second phase of merge, get rid of more machine-independent-dependencies.
Get rid of pc98/pc98/pc98_device.h. Submitted by: The FreeBSD(98) Development Team
Diffstat (limited to 'sys/pc98')
-rw-r--r--sys/pc98/apm/apm.c920
-rw-r--r--sys/pc98/boot/biosboot/io.c2
-rw-r--r--sys/pc98/cbus/cbus.h48
-rw-r--r--sys/pc98/cbus/clock.c6
-rw-r--r--sys/pc98/cbus/fdc.c29
-rw-r--r--sys/pc98/cbus/pcrtc.c6
-rw-r--r--sys/pc98/cbus/sio.c46
-rw-r--r--sys/pc98/conf/Makefile.pc986
-rw-r--r--sys/pc98/conf/files.pc986
-rw-r--r--sys/pc98/conf/majors.pc983
-rw-r--r--sys/pc98/i386/autoconf.c6
-rw-r--r--sys/pc98/i386/machdep.c44
-rw-r--r--sys/pc98/i386/trap.c12
-rw-r--r--sys/pc98/i386/userconfig.c40
-rw-r--r--sys/pc98/i386/vm_machdep.c3
-rw-r--r--sys/pc98/pc98/aic6360.c12
-rw-r--r--sys/pc98/pc98/clock.c6
-rw-r--r--sys/pc98/pc98/fd.c29
-rw-r--r--sys/pc98/pc98/ft.c21
-rw-r--r--sys/pc98/pc98/if_ed.c11
-rw-r--r--sys/pc98/pc98/if_ep.c1680
-rw-r--r--sys/pc98/pc98/if_epreg.h464
-rw-r--r--sys/pc98/pc98/if_fe.c11
-rw-r--r--sys/pc98/pc98/if_zp.c1163
-rw-r--r--sys/pc98/pc98/if_zpreg.h293
-rw-r--r--sys/pc98/pc98/lpt.c14
-rw-r--r--sys/pc98/pc98/machdep.c44
-rw-r--r--sys/pc98/pc98/matcd/matcd.c12
-rw-r--r--sys/pc98/pc98/mse.c16
-rw-r--r--sys/pc98/pc98/npx.c14
-rw-r--r--sys/pc98/pc98/pc98.c139
-rw-r--r--sys/pc98/pc98/pc98.h48
-rw-r--r--sys/pc98/pc98/pc98_device.h248
-rw-r--r--sys/pc98/pc98/pc98_machdep.c3
-rw-r--r--sys/pc98/pc98/pcaudio.c14
-rw-r--r--sys/pc98/pc98/pcibus.c5
-rw-r--r--sys/pc98/pc98/pcicx.c3
-rw-r--r--sys/pc98/pc98/random_machdep.c4
-rw-r--r--sys/pc98/pc98/sbic55.c12
-rw-r--r--sys/pc98/pc98/sbic55.c.new8
-rw-r--r--sys/pc98/pc98/scd.c16
-rw-r--r--sys/pc98/pc98/sio.c46
-rw-r--r--sys/pc98/pc98/sound/dmabuf.c16
-rw-r--r--sys/pc98/pc98/sound/os.h4
-rw-r--r--sys/pc98/pc98/sound/soundcard.c10
-rw-r--r--sys/pc98/pc98/syscons.c14
-rw-r--r--sys/pc98/pc98/wd.c12
47 files changed, 310 insertions, 5259 deletions
diff --git a/sys/pc98/apm/apm.c b/sys/pc98/apm/apm.c
deleted file mode 100644
index 008282d..0000000
--- a/sys/pc98/apm/apm.c
+++ /dev/null
@@ -1,920 +0,0 @@
-/*
- * APM (Advanced Power Management) BIOS Device Driver
- *
- * Copyright (c) 1994 UKAI, Fumitoshi.
- * Copyright (c) 1994-1995 by HOSOKAWA, Tatsumi <hosokawa@mt.cs.keio.ac.jp>
- * Copyright (c) 1996 Nate Williams <nate@FreeBSD.org>
- *
- * This software may be used, modified, copied, and distributed, in
- * both source and binary form provided that the above copyright and
- * these terms are retained. Under no circumstances is the author
- * responsible for the proper functioning of this software, nor does
- * the author assume any responsibility for damages incurred with its
- * use.
- *
- * Sep, 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD)
- *
- * $Id: apm.c,v 1.2 1996/07/23 07:45:29 asami Exp $
- */
-
-#include "apm.h"
-
-#if NAPM > 1
-#error only one APM device may be configured
-#endif
-
-#include <sys/param.h>
-#include <sys/conf.h>
-#include <sys/kernel.h>
-#ifdef DEVFS
-#include <sys/devfsext.h>
-#endif /*DEVFS*/
-#include <sys/systm.h>
-#include <sys/malloc.h>
-#include <sys/ioctl.h>
-#include <sys/file.h>
-#include <sys/proc.h>
-#include <sys/vnode.h>
-#ifdef PC98
-#include <pc98/pc98/pc98_device.h>
-#else
-#include <i386/isa/isa_device.h>
-#endif
-#include <machine/apm_bios.h>
-#include <machine/segments.h>
-#include <machine/clock.h>
-#include <vm/vm.h>
-#include <vm/vm_param.h>
-#include <vm/pmap.h>
-#include <sys/syslog.h>
-#include <sys/devconf.h>
-#include <i386/apm/apm_setup.h>
-
-static int apm_display_off __P((void));
-static int apm_int __P((u_long *eax, u_long *ebx, u_long *ecx));
-static void apm_resume __P((void));
-
-/* static data */
-struct apm_softc {
- int initialized, active;
- int always_halt_cpu, slow_idle_cpu;
- int disabled, disengaged;
- u_int minorversion, majorversion;
- u_int cs32_base, cs16_base, ds_base;
- u_int cs_limit, ds_limit;
- u_int cs_entry;
- u_int intversion;
- struct apmhook sc_suspend;
- struct apmhook sc_resume;
-#ifdef DEVFS
- void *sc_devfs_token;
-#endif
-};
-
-static struct kern_devconf kdc_apm = {
- 0, 0, 0, /* filled in by dev_attach */
- "apm", 0, { MDDT_ISA, 0 },
- isa_generic_externalize, 0, 0, ISA_EXTERNALLEN,
- &kdc_isa0, /* parent */
- 0, /* parentdata */
- DC_UNCONFIGURED, /* state */
- "Advanced Power Management BIOS",
- DC_CLS_MISC /* class */
-};
-
-
-static struct apm_softc apm_softc;
-static struct apmhook *hook[NAPM_HOOK]; /* XXX */
-
-#define is_enabled(foo) ((foo) ? "enabled" : "disabled")
-
-/* Map version number to integer (keeps ordering of version numbers) */
-#define INTVERSION(major, minor) ((major)*100 + (minor))
-
-static timeout_t apm_timeout;
-static d_open_t apmopen;
-static d_close_t apmclose;
-static d_ioctl_t apmioctl;
-
-#define CDEV_MAJOR 39
-static struct cdevsw apm_cdevsw =
- { apmopen, apmclose, noread, nowrite, /*39*/
- apmioctl, nostop, nullreset, nodevtotty,/* APM */
- seltrue, nommap, NULL , "apm" ,NULL, -1};
-
-static void
-apm_registerdev(struct isa_device *id)
-{
- if (kdc_apm.kdc_isa)
- return;
- kdc_apm.kdc_state = DC_UNCONFIGURED;
- kdc_apm.kdc_unit = 0;
- kdc_apm.kdc_isa = id;
- dev_attach(&kdc_apm);
-}
-
-/* setup APM GDT discriptors */
-static void
-setup_apm_gdt(u_int code32_base, u_int code16_base, u_int data_base, u_int code_limit, u_int data_limit)
-{
- /* setup 32bit code segment */
- gdt_segs[GAPMCODE32_SEL].ssd_base = code32_base;
- gdt_segs[GAPMCODE32_SEL].ssd_limit = code_limit;
-
- /* setup 16bit code segment */
- gdt_segs[GAPMCODE16_SEL].ssd_base = code16_base;
- gdt_segs[GAPMCODE16_SEL].ssd_limit = code_limit;
-
- /* setup data segment */
- gdt_segs[GAPMDATA_SEL ].ssd_base = data_base;
- gdt_segs[GAPMDATA_SEL ].ssd_limit = data_limit;
-
- /* reflect these changes on physical GDT */
- ssdtosd(gdt_segs + GAPMCODE32_SEL, &gdt[GAPMCODE32_SEL].sd);
- ssdtosd(gdt_segs + GAPMCODE16_SEL, &gdt[GAPMCODE16_SEL].sd);
- ssdtosd(gdt_segs + GAPMDATA_SEL , &gdt[GAPMDATA_SEL ].sd);
-}
-
-/* 48bit far pointer */
-static struct addr48 {
- u_long offset;
- u_short segment;
-} apm_addr;
-
-static int apm_errno;
-
-inline
-int
-apm_int(u_long *eax, u_long *ebx, u_long *ecx)
-{
- u_long cf;
- __asm __volatile("
- pushfl
- cli
- lcall _apm_addr
- movl $0, %3
- jnc 1f
- incl %3
- 1:
- popfl
- "
- : "=a" (*eax), "=b" (*ebx), "=c" (*ecx), "=D" (cf)
- : "0" (*eax), "1" (*ebx), "2" (*ecx)
- : "dx", "si", "memory"
- );
- apm_errno = ((*eax) >> 8) & 0xff;
- return cf;
-}
-
-
-/* enable/disable power management */
-static int
-apm_enable_disable_pm(struct apm_softc *sc, int enable)
-{
- u_long eax, ebx, ecx;
-
- eax = (APM_BIOS << 8) | APM_ENABLEDISABLEPM;
-
- if (sc->intversion >= INTVERSION(1, 1)) {
- ebx = PMDV_ALLDEV;
- } else {
- ebx = 0xffff; /* APM version 1.0 only */
- }
- ecx = enable;
- return apm_int(&eax, &ebx, &ecx);
-}
-
-/* Tell APM-BIOS that WE will do 1.1 and see what they say... */
-static void
-apm_driver_version(void)
-{
- u_long eax, ebx, ecx;
-
- eax = (APM_BIOS << 8) | APM_DRVVERSION;
- ebx = 0x0;
- ecx = 0x0101;
- if(!apm_int(&eax, &ebx, &ecx))
- apm_version = eax & 0xffff;
-}
-
-/* engage/disengage power management (APM 1.1 or later) */
-static int
-apm_engage_disengage_pm(struct apm_softc *sc, int engage)
-{
- u_long eax, ebx, ecx;
-
- eax = (APM_BIOS << 8) | APM_ENGAGEDISENGAGEPM;
- ebx = PMDV_ALLDEV;
- ecx = engage;
- return(apm_int(&eax, &ebx, &ecx));
-}
-
-/* get PM event */
-static u_int
-apm_getevent(struct apm_softc *sc)
-{
- u_long eax, ebx, ecx;
-
- eax = (APM_BIOS << 8) | APM_GETPMEVENT;
-
- ebx = 0;
- ecx = 0;
- if (apm_int(&eax, &ebx, &ecx))
- return PMEV_NOEVENT;
-
- return ebx & 0xffff;
-}
-
-/* suspend entire system */
-static int
-apm_suspend_system(struct apm_softc *sc)
-{
- u_long eax, ebx, ecx;
-
- eax = (APM_BIOS << 8) | APM_SETPWSTATE;
- ebx = PMDV_ALLDEV;
- ecx = PMST_SUSPEND;
-
- if (apm_int(&eax, &ebx, &ecx)) {
- printf("Entire system suspend failure: errcode = %ld\n",
- 0xff & (eax >> 8));
- return 1;
- }
- return 0;
-}
-
-/* Display control */
-/*
- * Experimental implementation: My laptop machine can't handle this function
- * If your laptop can control the display via APM, please inform me.
- * HOSOKAWA, Tatsumi <hosokawa@mt.cs.keio.ac.jp>
- */
-static int
-apm_display_off(void)
-{
- u_long eax, ebx, ecx;
-
- eax = (APM_BIOS << 8) | APM_SETPWSTATE;
- ebx = PMDV_2NDSTORAGE0;
- ecx = PMST_STANDBY;
- if (apm_int(&eax, &ebx, &ecx)) {
- printf("Display off failure: errcode = %ld\n",
- 0xff & (eax >> 8));
- return 1;
- }
-
- return 0;
-}
-
-/* APM Battery low handler */
-static void
-apm_battery_low(struct apm_softc *sc)
-{
- printf("\007\007 * * * BATTERY IS LOW * * * \007\007");
-}
-
-/* APM hook manager */
-static struct apmhook *
-apm_add_hook(struct apmhook **list, struct apmhook *ah)
-{
- int s;
- struct apmhook *p, *prev;
-
-#ifdef APM_DEBUG
- printf("Add hook \"%s\"\n", ah->ah_name);
-#endif
-
- s = splhigh();
- if (ah == NULL) {
- panic("illegal apm_hook!");
- }
- prev = NULL;
- for (p = *list; p != NULL; prev = p, p = p->ah_next) {
- if (p->ah_order > ah->ah_order) {
- break;
- }
- }
-
- if (prev == NULL) {
- ah->ah_next = *list;
- *list = ah;
- } else {
- ah->ah_next = prev->ah_next;
- prev->ah_next = ah;
- }
- splx(s);
- return ah;
-}
-
-static void
-apm_del_hook(struct apmhook **list, struct apmhook *ah)
-{
- int s;
- struct apmhook *p, *prev;
-
- s = splhigh();
- prev = NULL;
- for (p = *list; p != NULL; prev = p, p = p->ah_next) {
- if (p == ah) {
- goto deleteit;
- }
- }
- panic("Tried to delete unregistered apm_hook.");
- goto nosuchnode;
-deleteit:
- if (prev != NULL) {
- prev->ah_next = p->ah_next;
- } else {
- *list = p->ah_next;
- }
-nosuchnode:
- splx(s);
-}
-
-
-/* APM driver calls some functions automatically */
-static void
-apm_execute_hook(struct apmhook *list)
-{
- struct apmhook *p;
-
- for (p = list; p != NULL; p = p->ah_next) {
-#ifdef APM_DEBUG
- printf("Execute APM hook \"%s.\"\n", p->ah_name);
-#endif
- if ((*(p->ah_fun))(p->ah_arg)) {
- printf("Warning: APM hook \"%s\" failed", p->ah_name);
- }
- }
-}
-
-
-/* establish an apm hook */
-struct apmhook *
-apm_hook_establish(int apmh, struct apmhook *ah)
-{
- if (apmh < 0 || apmh >= NAPM_HOOK)
- return NULL;
-
- return apm_add_hook(&hook[apmh], ah);
-}
-
-/* disestablish an apm hook */
-void
-apm_hook_disestablish(int apmh, struct apmhook *ah)
-{
- if (apmh < 0 || apmh >= NAPM_HOOK)
- return;
-
- apm_del_hook(&hook[apmh], ah);
-}
-
-
-static struct timeval suspend_time;
-static struct timeval diff_time;
-
-static int
-apm_default_resume(void *arg)
-{
- int pl;
- u_int second, minute, hour;
- struct timeval resume_time, tmp_time;
-
- /* modified for adjkerntz */
- pl = splsoftclock();
- inittodr(0); /* adjust time to RTC */
- microtime(&resume_time);
- tmp_time = time; /* because 'time' is volatile */
- timevaladd(&tmp_time, &diff_time);
- time = tmp_time;
- splx(pl);
- second = resume_time.tv_sec - suspend_time.tv_sec;
- hour = second / 3600;
- second %= 3600;
- minute = second / 60;
- second %= 60;
- log(LOG_NOTICE, "resumed from suspended mode (slept %02d:%02d:%02d)\n",
- hour, minute, second);
- return 0;
-}
-
-static int
-apm_default_suspend(void *arg)
-{
- int pl;
-
- pl = splsoftclock();
- microtime(&diff_time);
- inittodr(0);
- microtime(&suspend_time);
- timevalsub(&diff_time, &suspend_time);
- splx(pl);
- return 0;
-}
-
-static void apm_processevent(struct apm_softc *);
-
-/*
- * Public interface to the suspend/resume:
- *
- * Execute suspend and resume hook before and after sleep, respectively.
- *
- */
-
-void
-apm_suspend(void)
-{
- struct apm_softc *sc = &apm_softc;
-
- if (!sc)
- return;
-
- if (sc->initialized) {
- apm_execute_hook(hook[APM_HOOK_SUSPEND]);
- apm_suspend_system(sc);
- apm_processevent(sc);
- }
-}
-
-void
-apm_resume(void)
-{
- struct apm_softc *sc = &apm_softc;
-
- if (!sc)
- return;
-
- if (sc->initialized) {
- apm_execute_hook(hook[APM_HOOK_RESUME]);
- }
-}
-
-
-/* get APM information */
-static int
-apm_get_info(struct apm_softc *sc, apm_info_t aip)
-{
- u_long eax, ebx, ecx;
-
- eax = (APM_BIOS << 8) | APM_GETPWSTATUS;
- ebx = PMDV_ALLDEV;
- ecx = 0;
-
- if (apm_int(&eax, &ebx, &ecx))
- return 1;
-
- aip->ai_acline = (ebx >> 8) & 0xff;
- aip->ai_batt_stat = ebx & 0xff;
- aip->ai_batt_life = ecx & 0xff;
- aip->ai_major = (u_int)sc->majorversion;
- aip->ai_minor = (u_int)sc->minorversion;
- aip->ai_status = (u_int)sc->active;
-
- return 0;
-}
-
-
-/* inform APM BIOS that CPU is idle */
-void
-apm_cpu_idle(void)
-{
- struct apm_softc *sc = &apm_softc;
-
- if (sc->active) {
- u_long eax, ebx, ecx;
-
- eax = (APM_BIOS <<8) | APM_CPUIDLE;
- ecx = ebx = 0;
- apm_int(&eax, &ebx, &ecx);
- }
- /*
- * Some APM implementation halts CPU in BIOS, whenever
- * "CPU-idle" function are invoked, but swtch() of
- * FreeBSD halts CPU, therefore, CPU is halted twice
- * in the sched loop. It makes the interrupt latency
- * terribly long and be able to cause a serious problem
- * in interrupt processing. We prevent it by removing
- * "hlt" operation from swtch() and managed it under
- * APM driver.
- */
- if (!sc->active || sc->always_halt_cpu) {
- __asm("hlt"); /* wait for interrupt */
- }
-}
-
-/* inform APM BIOS that CPU is busy */
-void
-apm_cpu_busy(void)
-{
- struct apm_softc *sc = &apm_softc;
-
- /*
- * The APM specification says this is only necessary if your BIOS
- * slows down the processor in the idle task, otherwise it's not
- * necessary.
- */
- if (sc->slow_idle_cpu && sc->active) {
- u_long eax, ebx, ecx;
-
- eax = (APM_BIOS <<8) | APM_CPUBUSY;
- ecx = ebx = 0;
- apm_int(&eax, &ebx, &ecx);
- }
-}
-
-
-/*
- * APM timeout routine:
- *
- * This routine is automatically called by timer once per second.
- */
-
-static void
-apm_timeout(void *arg)
-{
- struct apm_softc *sc = arg;
-
- apm_processevent(sc);
- if (sc->active == 1) {
- timeout(apm_timeout, (void *)sc, hz - 1 ); /* More than 1 Hz */
- }
-}
-
-/* enable APM BIOS */
-static void
-apm_event_enable(struct apm_softc *sc)
-{
-#ifdef APM_DEBUG
- printf("called apm_event_enable()\n");
-#endif
- if (sc->initialized) {
- sc->active = 1;
- apm_timeout(sc);
- }
-}
-
-/* disable APM BIOS */
-static void
-apm_event_disable(struct apm_softc *sc)
-{
-#ifdef APM_DEBUG
- printf("called apm_event_disable()\n");
-#endif
- if (sc->initialized) {
- untimeout(apm_timeout, NULL);
- sc->active = 0;
- }
-}
-
-/* halt CPU in scheduling loop */
-static void
-apm_halt_cpu(struct apm_softc *sc)
-{
- if (sc->initialized) {
- sc->always_halt_cpu = 1;
- }
-}
-
-/* don't halt CPU in scheduling loop */
-static void
-apm_not_halt_cpu(struct apm_softc *sc)
-{
- if (sc->initialized) {
- sc->always_halt_cpu = 0;
- }
-}
-
-/* device driver definitions */
-static int apmprobe (struct isa_device *);
-static int apmattach(struct isa_device *);
-struct isa_driver apmdriver = {
- apmprobe, apmattach, "apm" };
-
-/*
- * probe APM (dummy):
- *
- * APM probing routine is placed on locore.s and apm_init.S because
- * this process forces the CPU to turn to real mode or V86 mode.
- * Current version uses real mode, but on future version, we want
- * to use V86 mode in APM initialization.
- */
-
-static int
-apmprobe(struct isa_device *dvp)
-{
- if ( dvp->id_unit > 0 ) {
- printf("apm: Only one APM driver supported.\n");
- return 0;
- }
- apm_registerdev(dvp);
- switch (apm_version) {
- case APMINI_CANTFIND:
- /* silent */
- return 0;
- case APMINI_NOT32BIT:
- printf("apm: 32bit connection is not supported.\n");
- return 0;
- case APMINI_CONNECTERR:
- printf("apm: 32-bit connection error.\n");
- return 0;
- }
-#ifdef APM_BROKEN_STATCLOCK
- statclock_disable = 1;
-#endif
-
- return -1;
-}
-
-
-/* Process APM event */
-static void
-apm_processevent(struct apm_softc *sc)
-{
- int apm_event;
-
-#ifdef APM_DEBUG
-# define OPMEV_DEBUGMESSAGE(symbol) case symbol: \
- printf("Received APM Event: " #symbol "\n");
-#else
-# define OPMEV_DEBUGMESSAGE(symbol) case symbol:
-#endif
- do {
- apm_event = apm_getevent(sc);
- switch (apm_event) {
- OPMEV_DEBUGMESSAGE(PMEV_STANDBYREQ);
- apm_suspend();
- break;
- OPMEV_DEBUGMESSAGE(PMEV_SUSPENDREQ);
- apm_suspend();
- break;
- OPMEV_DEBUGMESSAGE(PMEV_USERSUSPENDREQ);
- apm_suspend();
- break;
- OPMEV_DEBUGMESSAGE(PMEV_CRITSUSPEND);
- apm_suspend();
- break;
- OPMEV_DEBUGMESSAGE(PMEV_NORMRESUME);
- apm_resume();
- break;
- OPMEV_DEBUGMESSAGE(PMEV_CRITRESUME);
- apm_resume();
- break;
- OPMEV_DEBUGMESSAGE(PMEV_STANDBYRESUME);
- apm_resume();
- break;
- OPMEV_DEBUGMESSAGE(PMEV_BATTERYLOW);
- apm_battery_low(sc);
- apm_suspend();
- break;
- OPMEV_DEBUGMESSAGE(PMEV_POWERSTATECHANGE);
- break;
- OPMEV_DEBUGMESSAGE(PMEV_UPDATETIME);
- inittodr(0); /* adjust time to RTC */
- break;
- OPMEV_DEBUGMESSAGE(PMEV_NOEVENT);
- break;
- default:
- printf("Unknown Original APM Event 0x%x\n", apm_event);
- break;
- }
- } while (apm_event != PMEV_NOEVENT);
-}
-
-/*
- * Attach APM:
- *
- * Initialize APM driver (APM BIOS itself has been initialized in locore.s)
- */
-
-static int
-apmattach(struct isa_device *dvp)
-{
-#define APM_KERNBASE KERNBASE
- struct apm_softc *sc = &apm_softc;
-#ifdef APM_DSVALUE_BUG
- caddr_t apm_bios_work;
-
- /*
- * XXX - Malloc enough space for the APM DS, and then copy the
- * current DS into the new space since the DS setup by the
- * APM bios is going to get wiped out.
- */
- apm_bios_work = (caddr_t)malloc(apm_ds_limit, M_DEVBUF, M_NOWAIT);
- bcopy((caddr_t)((apm_ds_base << 4) + APM_KERNBASE), apm_bios_work,
- apm_ds_limit);
-#endif /* APM_DSVALUE_BUG */
-
- sc->initialized = 0;
-
- /* Must be externally enabled */
- sc->active = 0;
-
- /* setup APM parameters */
- sc->cs16_base = (apm_cs16_base << 4) + APM_KERNBASE;
- sc->cs32_base = (apm_cs32_base << 4) + APM_KERNBASE;
- sc->ds_base = (apm_ds_base << 4) + APM_KERNBASE;
- sc->cs_limit = apm_cs_limit;
- sc->ds_limit = apm_ds_limit;
- sc->cs_entry = apm_cs_entry;
-
-#ifdef APM_DSVALUE_BUG
- /* Set the DS base to point to the newly made copy of the APM DS */
- sc->ds_base = (u_int)apm_bios_work;
-#endif /* APM_DSVALUE_BUG */
-
- /* Always call HLT in idle loop */
- sc->always_halt_cpu = 1;
-
- sc->slow_idle_cpu = ((apm_flags & APM_CPUIDLE_SLOW) != 0);
- sc->disabled = ((apm_flags & APM_DISABLED) != 0);
- sc->disengaged = ((apm_flags & APM_DISENGAGED) != 0);
-
- /* print bootstrap messages */
-#ifdef APM_DEBUG
- printf("apm: APM BIOS version %04x\n", apm_version);
- printf("apm: Code32 0x%08x, Code16 0x%08x, Data 0x%08x\n",
- sc->cs32_base, sc->cs16_base, sc->ds_base);
- printf("apm: Code entry 0x%08x, Idling CPU %s, Management %s\n",
- sc->cs_entry, is_enabled(sc->slow_idle_cpu),
- is_enabled(!sc->disabled));
- printf("apm: CS_limit=0x%x, DS_limit=0x%x\n",
- sc->cs_limit, sc->ds_limit);
-#endif /* APM_DEBUG */
-
-#ifdef 0
- /* Workaround for some buggy APM BIOS implementations */
- sc->cs_limit = 0xffff;
- sc->ds_limit = 0xffff;
-#endif
-
- /* setup GDT */
- setup_apm_gdt(sc->cs32_base, sc->cs16_base, sc->ds_base,
- sc->cs_limit, sc->ds_limit);
-
- /* setup entry point 48bit pointer */
- apm_addr.segment = GSEL(GAPMCODE32_SEL, SEL_KPL);
- apm_addr.offset = sc->cs_entry;
-
-#ifdef FORCE_APM10
- apm_version = 0x100;
- sc->majorversion = 1;
- sc->minorversion = 0;
- sc->intversion = INTVERSION(sc->majorversion, sc->minorversion);
- printf("apm: running in APM 1.0 compatible mode\n");
- kcd_apm.kdc_description =
- "Advanced Power Management BIOS (1.0 compatability mode)",
-#else
- /* Try to kick bios into 1.1 or greater mode */
- apm_driver_version();
- sc->minorversion = ((apm_version & 0x00f0) >> 4) * 10 +
- ((apm_version & 0x000f) >> 0);
- sc->majorversion = ((apm_version & 0xf000) >> 12) * 10 +
- ((apm_version & 0x0f00) >> 8);
-
- sc->intversion = INTVERSION(sc->majorversion, sc->minorversion);
-
- if (sc->intversion >= INTVERSION(1, 1)) {
-#ifdef APM_DEBUG
- printf("apm: Engaged control %s\n", is_enabled(!sc->disengaged));
-#endif
- }
-
- printf("apm: found APM BIOS version %d.%d\n",
- sc->majorversion, sc->minorversion);
-#endif /* FORCE_APM10 */
-
-#ifdef APM_DEBUG
- printf("apm: Slow Idling CPU %s\n", is_enabled(sc->slow_idle_cpu));
-#endif
-
- /* enable power management */
- if (sc->disabled) {
- if (apm_enable_disable_pm(sc, 1)) {
-#ifdef APM_DEBUG
- printf("apm: *Warning* enable function failed! [%x]\n",
- apm_errno);
-#endif
- }
- }
-
- /* engage power managment (APM 1.1 or later) */
- if (sc->intversion >= INTVERSION(1, 1) && sc->disengaged) {
- if (apm_engage_disengage_pm(sc, 1)) {
-#ifdef APM_DEBUG
- printf("apm: *Warning* engage function failed err=[%x]",
- apm_errno);
- printf(" (Docked or using external power?).\n");
-#endif
- }
- }
-
- /* default suspend hook */
- sc->sc_suspend.ah_fun = apm_default_suspend;
- sc->sc_suspend.ah_arg = sc;
- sc->sc_suspend.ah_name = "default suspend";
- sc->sc_suspend.ah_order = APM_MAX_ORDER;
-
- /* default resume hook */
- sc->sc_resume.ah_fun = apm_default_resume;
- sc->sc_resume.ah_arg = sc;
- sc->sc_resume.ah_name = "default resume";
- sc->sc_resume.ah_order = APM_MIN_ORDER;
-
- apm_hook_establish(APM_HOOK_SUSPEND, &sc->sc_suspend);
- apm_hook_establish(APM_HOOK_RESUME , &sc->sc_resume);
-
- apm_event_enable(sc);
- kdc_apm.kdc_state = DC_IDLE;
-
- sc->initialized = 1;
-
-#ifdef DEVFS
- sc->sc_devfs_token =
- devfs_add_devswf(&apm_cdevsw, 0, DV_CHR, 0, 0, 0600, "apm");
-#endif
- return 0;
-}
-
-static int
-apmopen(dev_t dev, int flag, int fmt, struct proc *p)
-{
- struct apm_softc *sc = &apm_softc;
-
- if (minor(dev) != 0 || !sc->initialized)
- return (ENXIO);
-
- return 0;
-}
-
-static int
-apmclose(dev_t dev, int flag, int fmt, struct proc *p)
-{
- return 0;
-}
-
-static int
-apmioctl(dev_t dev, int cmd, caddr_t addr, int flag, struct proc *p)
-{
- struct apm_softc *sc = &apm_softc;
- int error = 0;
-
- if (minor(dev) != 0 || !sc->initialized)
- return (ENXIO);
-#ifdef APM_DEBUG
- printf("APM ioctl: cmd = 0x%x\n", cmd);
-#endif
- switch (cmd) {
- case APMIO_SUSPEND:
- if ( sc->active) {
- apm_suspend();
- } else {
- error = EINVAL;
- }
- break;
- case APMIO_GETINFO:
- if (apm_get_info(sc, (apm_info_t)addr)) {
- error = ENXIO;
- }
- break;
- case APMIO_ENABLE:
- kdc_apm.kdc_state = DC_BUSY;
- apm_event_enable(sc);
- break;
- case APMIO_DISABLE:
- kdc_apm.kdc_state = DC_IDLE;
- apm_event_disable(sc);
- break;
- case APMIO_HALTCPU:
- apm_halt_cpu(sc);
- break;
- case APMIO_NOTHALTCPU:
- apm_not_halt_cpu(sc);
- break;
- case APMIO_DISPLAYOFF:
- if (apm_display_off()) {
- error = ENXIO;
- }
- break;
- default:
- error = EINVAL;
- break;
- }
- return error;
-}
-
-
-static apm_devsw_installed = 0;
-
-static void
-apm_drvinit(void *unused)
-{
- dev_t dev;
-
- if( ! apm_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&apm_cdevsw,NULL);
- apm_devsw_installed = 1;
- }
-}
-
-SYSINIT(apmdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,apm_drvinit,NULL)
diff --git a/sys/pc98/boot/biosboot/io.c b/sys/pc98/boot/biosboot/io.c
index b11fc7c..7f09b24 100644
--- a/sys/pc98/boot/biosboot/io.c
+++ b/sys/pc98/boot/biosboot/io.c
@@ -31,7 +31,7 @@
#include <machine/cpufunc.h>
#include <sys/reboot.h>
#ifdef PC98
-#include "../../pc98/pc98_device.h"
+#include "../../pc98/pc98_bios.h"
#endif
diff --git a/sys/pc98/cbus/cbus.h b/sys/pc98/cbus/cbus.h
index 806c840..9630778 100644
--- a/sys/pc98/cbus/cbus.h
+++ b/sys/pc98/cbus/cbus.h
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)isa.h 5.7 (Berkeley) 5/9/91
- * $Id: isa.h,v 1.18 1996/01/30 22:55:57 mpp Exp $
+ * $Id: pc98.h,v 1.1.1.1 1996/06/14 10:04:45 asami Exp $
*/
#ifndef _PC98_PC98_PC98_H_
@@ -182,4 +182,50 @@
*/
#define MADDRUNK -1
+#define PC98_VECTOR_SIZE (0x400)
+#define PC98_SYSTEM_PARAMETER_SIZE (0x230)
+
+#define PC98_SAVE_AREA(highreso_flag) (0xa1000)
+#define PC98_SAVE_AREA_ADDRESS (0x10)
+
+#define OFS_BOOT_boothowto 0x210
+#define OFS_BOOT_bootdev 0x214
+#define OFS_BOOT_cyloffset 0x218
+#define OFS_WD_BIOS_SECSIZE(i) (0x200+(i)*6)
+#define OFS_WD_BIOS_NCYL(i) (0x202+(i)*6)
+#define OFS_WD_BIOS_HEAD(i) (0x205+(i)*6)
+#define OFS_WD_BIOS_SEC(i) (0x204+(i)*6)
+#define OFS_pc98_machine_type 0x220
+#define OFS_epson_machine_id 0x224
+#define OFS_epson_bios_id 0x225
+#define OFS_epson_system_type 0x226
+
+#define M_NEC_PC98 0x0001
+#define M_EPSON_PC98 0x0002
+#define M_NOT_H98 0x0010
+#define M_H98 0x0020
+#define M_NOTE 0x0040
+#define M_NORMAL 0x1000
+#define M_HIGHRESO 0x2000
+#define M_8M 0x8000
+
+#if defined(KERNEL) && !defined(LOCORE)
+/* BIOS parameter block */
+extern unsigned char pc98_system_parameter[]; /* in locore.c */
+#define PC98_SYSTEM_PARAMETER(x) pc98_system_parameter[(x)-0x400]
+#define BOOT_boothowto (*(unsigned long*)(&pc98_system_parameter[OFS_BOOT_boothowto]))
+#define BOOT_bootdev (*(unsigned long*)(&pc98_system_parameter[OFS_BOOT_bootdev]))
+#define BOOT_cyloffset (*(unsigned long*)(&pc98_system_parameter[OFS_BOOT_cyloffset]))
+#define WD_BIOS_SECSIZE(i) (*(unsigned short*)(&pc98_system_parameter[OFS_WD_BIOS_SECSIZE(i)]))
+#define WD_BIOS_NCYL(i) (*(unsigned short*)(&pc98_system_parameter[OFS_WD_BIOS_NCYL(i)]))
+#define WD_BIOS_HEAD(i) (pc98_system_parameter[OFS_WD_BIOS_HEAD(i)])
+#define WD_BIOS_SEC(i) (pc98_system_parameter[OFS_WD_BIOS_SEC(i)])
+#define pc98_machine_type (*(unsigned long*)&pc98_system_parameter[OFS_pc98_machine_type])
+#define epson_machine_id (pc98_system_parameter[OFS_epson_machine_id])
+#define epson_bios_id (pc98_system_parameter[OFS_epson_bios_id])
+#define epson_system_type (pc98_system_parameter[OFS_epson_system_type])
+
+# define PC98_TYPE_CHECK(x) ((pc98_machine_type & (x)) == (x))
+#endif /* KERNEL */
+
#endif /* !_PC98_PC98_PC98_H_ */
diff --git a/sys/pc98/cbus/clock.c b/sys/pc98/cbus/clock.c
index 166ba2a..b9547fd 100644
--- a/sys/pc98/cbus/clock.c
+++ b/sys/pc98/cbus/clock.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)clock.c 7.2 (Berkeley) 5/12/91
- * $Id: clock.c,v 1.2 1996/07/23 07:46:07 asami Exp $
+ * $Id: clock.c,v 1.3 1996/08/30 10:42:58 asami Exp $
*/
/*
@@ -46,7 +46,7 @@
/*
* modified for PC98
- * $Id: clock.c,v 1.2 1996/07/23 07:46:07 asami Exp $
+ * $Id: clock.c,v 1.3 1996/08/30 10:42:58 asami Exp $
*/
/*
@@ -72,7 +72,7 @@
#include <sys/syslog.h>
#include <pc98/pc98/icu.h>
#include <pc98/pc98/pc98.h>
-#include <pc98/pc98/pc98_device.h>
+#include <i386/isa/isa_device.h>
#include <pc98/pc98/timerreg.h>
#else
#include <i386/isa/icu.h>
diff --git a/sys/pc98/cbus/fdc.c b/sys/pc98/cbus/fdc.c
index c4ec6ff..df520db 100644
--- a/sys/pc98/cbus/fdc.c
+++ b/sys/pc98/cbus/fdc.c
@@ -43,7 +43,7 @@
* SUCH DAMAGE.
*
* from: @(#)fd.c 7.4 (Berkeley) 5/25/91
- * $Id: fd.c,v 1.3 1996/07/30 18:55:58 asami Exp $
+ * $Id: fd.c,v 1.4 1996/08/31 15:06:42 asami Exp $
*
*/
@@ -73,7 +73,7 @@
#include <sys/dkstat.h>
#ifdef PC98
#include <pc98/pc98/pc98.h>
-#include <pc98/pc98/pc98_device.h>
+#include <i386/isa/isa_device.h>
#include <pc98/pc98/fdreg.h>
#include <pc98/pc98/fdc.h>
#else
@@ -117,13 +117,8 @@ static struct kern_devconf kdc_fd[NFD] = { {
struct kern_devconf kdc_fdc[NFDC] = { {
0, 0, 0, /* filled in by kern_devconf.c */
-#ifdef PC98
- "fdc", 0, { MDDT_PC98, 0, "bio" },
- pc98_generic_externalize, 0, fdc_goaway, PC98_EXTERNALLEN,
-#else
"fdc", 0, { MDDT_ISA, 0, "bio" },
isa_generic_externalize, 0, fdc_goaway, ISA_EXTERNALLEN,
-#endif
0, /* parent */
0, /* parentdata */
DC_UNCONFIGURED, /* state */
@@ -152,11 +147,7 @@ fdc_registerdev(struct isa_device *dvp)
kdc_fdc[unit] = kdc_fdc[0];
kdc_fdc[unit].kdc_unit = unit;
-#ifdef PC98
- kdc_fdc[unit].kdc_parent = &kdc_nec0;
-#else
kdc_fdc[unit].kdc_parent = &kdc_isa0;
-#endif
kdc_fdc[unit].kdc_parentdata = dvp;
dev_attach(&kdc_fdc[unit]);
}
@@ -772,8 +763,8 @@ fdattach(struct isa_device *dev)
printf(" [dma is changed to #%d]", fdc->dmachan);
}
/* Acquire the DMA channel forever, The driver will do the rest */
- pc98_dma_acquire(fdc->dmachan);
- pc98_dmainit(fdc->dmachan, 128 << 3 /* XXX max secsize */);
+ isa_dma_acquire(fdc->dmachan);
+ isa_dmainit(fdc->dmachan, 128 << 3 /* XXX max secsize */);
fdc->state = DEVIDLE;
fdc_reset(fdc);
#else
@@ -788,11 +779,7 @@ fdattach(struct isa_device *dev)
TAILQ_INIT(&fdc->head);
/* check for each floppy drive */
-#ifdef PC98
- for (fdup = pc98_biotab_fdc; fdup->id_driver != 0; fdup++) {
-#else
for (fdup = isa_biotab_fdc; fdup->id_driver != 0; fdup++) {
-#endif
if (fdup->id_iobase != dev->id_iobase)
continue;
fdu = fdup->id_unit;
@@ -1869,11 +1856,7 @@ fdstate(fdcu_t fdcu, fdc_p fdc)
#ifdef EPSON_NRDISK
if (fdu != nrdu) {
#endif /* EPSON_NRDISK */
-#ifdef PC98
- pc98_dmastart(bp->b_flags, bp->b_un.b_addr+fd->skip,
-#else
isa_dmastart(bp->b_flags, bp->b_un.b_addr+fd->skip,
-#endif
format ? bp->b_bcount : fdblk, fdc->dmachan);
blknum = (unsigned long)bp->b_blkno*DEV_BSIZE/fdblk
+ fd->skip/fdblk;
@@ -2003,11 +1986,7 @@ fdstate(fdcu_t fdcu, fdc_p fdc)
#ifdef EPSON_NRDISK
if (fdu != nrdu) {
#endif /* EPSON_NRDISK */
-#ifdef PC98
- pc98_dmadone(bp->b_flags, bp->b_un.b_addr+fd->skip,
-#else
isa_dmadone(bp->b_flags, bp->b_un.b_addr+fd->skip,
-#endif
format ? bp->b_bcount : fdblk, fdc->dmachan);
#ifdef EPSON_NRDISK
}
diff --git a/sys/pc98/cbus/pcrtc.c b/sys/pc98/cbus/pcrtc.c
index 166ba2a..b9547fd 100644
--- a/sys/pc98/cbus/pcrtc.c
+++ b/sys/pc98/cbus/pcrtc.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)clock.c 7.2 (Berkeley) 5/12/91
- * $Id: clock.c,v 1.2 1996/07/23 07:46:07 asami Exp $
+ * $Id: clock.c,v 1.3 1996/08/30 10:42:58 asami Exp $
*/
/*
@@ -46,7 +46,7 @@
/*
* modified for PC98
- * $Id: clock.c,v 1.2 1996/07/23 07:46:07 asami Exp $
+ * $Id: clock.c,v 1.3 1996/08/30 10:42:58 asami Exp $
*/
/*
@@ -72,7 +72,7 @@
#include <sys/syslog.h>
#include <pc98/pc98/icu.h>
#include <pc98/pc98/pc98.h>
-#include <pc98/pc98/pc98_device.h>
+#include <i386/isa/isa_device.h>
#include <pc98/pc98/timerreg.h>
#else
#include <i386/isa/icu.h>
diff --git a/sys/pc98/cbus/sio.c b/sys/pc98/cbus/sio.c
index 461a4e6..98feda2 100644
--- a/sys/pc98/cbus/sio.c
+++ b/sys/pc98/cbus/sio.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* from: @(#)com.c 7.5 (Berkeley) 5/16/91
- * $Id: sio.c,v 1.2 1996/07/23 07:46:38 asami Exp $
+ * $Id: sio.c,v 1.3 1996/08/31 15:07:20 asami Exp $
*/
#include "opt_comconsole.h"
@@ -140,7 +140,7 @@
#ifdef PC98
#include <pc98/pc98/pc98.h>
#include <pc98/pc98/icu.h>
-#include <pc98/pc98/pc98_device.h>
+#include <i386/isa/isa_device.h>
#include <pc98/pc98/sioreg.h>
#include <pc98/pc98/ic/i8251.h>
#include <pc98/pc98/ic/ns16550.h>
@@ -597,15 +597,9 @@ static struct speedtab comspeedtab[] = {
static struct kern_devconf kdc_sio[NSIO] = { {
0, 0, 0, /* filled in by dev_attach */
-#ifdef PC98
- driver_name, 0, { MDDT_PC98, 0, "tty" },
- pc98_generic_externalize, 0, 0, PC98_EXTERNALLEN,
- &kdc_nec0, /* parent */
-#else
driver_name, 0, { MDDT_ISA, 0, "tty" },
isa_generic_externalize, 0, 0, ISA_EXTERNALLEN,
&kdc_isa0, /* parent */
-#endif
0, /* parentdata */
DC_UNCONFIGURED, /* state */
"Serial port",
@@ -748,22 +742,14 @@ sioregisterdev(id)
/*
* If already registered, don't try to re-register.
*/
-#ifdef PC98
- if (kdc_sio[unit].kdc_pc98)
-#else
if (kdc_sio[unit].kdc_isa)
-#endif
return;
if (unit != 0)
kdc_sio[unit] = kdc_sio[0];
kdc_sio[unit].kdc_state = DC_UNCONFIGURED;
kdc_sio[unit].kdc_description = "Serial port";
kdc_sio[unit].kdc_unit = unit;
-#ifdef PC98
- kdc_sio[unit].kdc_pc98 = id;
-#else
kdc_sio[unit].kdc_isa = id;
-#endif
dev_attach(&kdc_sio[unit]);
}
@@ -797,11 +783,7 @@ sioprobe(dev)
* from any used port that shares the interrupt vector.
* XXX the gate enable is elsewhere for some multiports.
*/
-#ifdef PC98
- for (xdev = pc98_devtab_tty; xdev->id_driver != NULL; xdev++)
-#else
for (xdev = isa_devtab_tty; xdev->id_driver != NULL; xdev++)
-#endif
if (xdev->id_driver == &siodriver && xdev->id_enabled)
#ifdef PC98
if (IS_PC98IN(xdev->id_iobase))
@@ -849,7 +831,7 @@ sioprobe(dev)
COM_INT_DISABLE
tmp = ( inb( iod.ctrl ) & ~(IEN_Rx|IEN_TxEMP|IEN_Tx));
outb( iod.ctrl, tmp|IEN_TxEMP );
- ret = pc98_irq_pending(dev) ? 4 : 0;
+ ret = isa_irq_pending(dev) ? 4 : 0;
outb( iod.ctrl, tmp );
COM_INT_ENABLE
break;
@@ -879,11 +861,7 @@ sioprobe(dev)
mcr_image = MCR_IENABLE;
#ifdef COM_MULTIPORT
if (COM_ISMULTIPORT(dev)) {
-#ifdef PC98
- idev = find_pc98dev(pc98_devtab_tty, &siodriver,
-#else
idev = find_isadev(isa_devtab_tty, &siodriver,
-#endif
COM_MPMASTER(dev));
if (idev == NULL) {
printf("sio%d: master device %d not configured\n",
@@ -1001,20 +979,11 @@ sioprobe(dev)
failures[2] = inb(iobase + com_mcr) - mcr_image;
DELAY(10000); /* Some internal modems need this time */
if (idev->id_irq != 0)
-#ifdef PC98
- failures[3] = pc98_irq_pending(idev) ? 0 : 1;
-#else
failures[3] = isa_irq_pending(idev) ? 0 : 1;
-#endif
failures[4] = (inb(iobase + com_iir) & IIR_IMASK) - IIR_TXRDY;
DELAY(1000); /* XXX */
-#ifdef PC98
- if (idev->id_irq != 0)
- failures[5] = pc98_irq_pending(idev) ? 1 : 0;
-#else
if (idev->id_irq != 0)
failures[5] = isa_irq_pending(idev) ? 1 : 0;
-#endif
failures[6] = (inb(iobase + com_iir) & IIR_IMASK) - IIR_NOPEND;
/*
@@ -1030,13 +999,8 @@ sioprobe(dev)
outb(iobase + com_cfcr, CFCR_8BITS); /* dummy to avoid bus echo */
failures[7] = inb(iobase + com_ier);
DELAY(1000); /* XXX */
-#ifdef PC98
- if (idev->id_irq != 0)
- failures[8] = pc98_irq_pending(idev) ? 1 : 0;
-#else
if (idev->id_irq != 0)
failures[8] = isa_irq_pending(idev) ? 1 : 0;
-#endif
failures[9] = (inb(iobase + com_iir) & IIR_IMASK) - IIR_NOPEND;
enable_intr();
@@ -1384,11 +1348,7 @@ determined_type: ;
if (unit == COM_MPMASTER(isdp))
printf(" master");
printf(")");
-#ifdef PC98
- com->no_irq = find_pc98dev(pc98_devtab_tty, &siodriver,
-#else
com->no_irq = find_isadev(isa_devtab_tty, &siodriver,
-#endif
COM_MPMASTER(isdp))->id_irq == 0;
}
#endif /* COM_MULTIPORT */
diff --git a/sys/pc98/conf/Makefile.pc98 b/sys/pc98/conf/Makefile.pc98
index 9c95812..bc262d2 100644
--- a/sys/pc98/conf/Makefile.pc98
+++ b/sys/pc98/conf/Makefile.pc98
@@ -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.2 1996/07/23 07:45:48 asami Exp $
+# $Id: Makefile.pc98,v 1.3 1996/08/30 10:42:49 asami Exp $
#
# Makefile for FreeBSD
#
@@ -31,7 +31,7 @@ I386= ${S}/i386
CWARNFLAGS?= -W -Wreturn-type -Wcomment -Wredundant-decls -Wimplicit \
-Wnested-externs -Wstrict-prototypes -Wmissing-prototypes \
- -Winline -Wunused
+ -Winline -Wunused -Wpointer-arith
#
# The following flags are next up for working on:
# -Wall
@@ -172,7 +172,7 @@ install:
install -c -m 555 -o root -g wheel -fschg kernel /
ioconf.o: ioconf.c $S/sys/param.h $S/sys/buf.h \
- ${PC98}/pc98/pc98_device.h ${PC98}/pc98/pc98.h ${PC98}/pc98/icu.h
+ ${I386}/isa/isa_device.h ${PC98}/pc98/pc98.h ${PC98}/pc98/icu.h
${CC} -c ${CFLAGS} ioconf.c
param.c: $S/conf/param.c
diff --git a/sys/pc98/conf/files.pc98 b/sys/pc98/conf/files.pc98
index 1e1168b..c8c0b52 100644
--- a/sys/pc98/conf/files.pc98
+++ b/sys/pc98/conf/files.pc98
@@ -2,7 +2,7 @@
# files marked standard are always included.
#
# modified for PC-9801 after:
-# $Id: files.pc98,v 1.2 1996/07/23 07:45:49 asami Exp $
+# $Id: files.pc98,v 1.3 1996/08/31 15:06:30 asami Exp $
#
aic7xxx_asm optional ahc device-driver \
dependency "$S/dev/aic7xxx/aic7xxx_asm.c" \
@@ -109,7 +109,7 @@ pc98/isa/if_ar.c optional ar device-driver
pc98/isa/if_cx.c optional cx device-driver
pc98/pc98/if_ed.c optional ed device-driver
pc98/pc98/if_el.c optional el device-driver
-pc98/pc98/if_ep.c optional ep device-driver
+i386/isa/if_ep.c optional ep device-driver
pc98/pc98/if_fe.c optional fe device-driver
#pc98/isa/if_ie.c optional ie device-driver
#pc98/isa/if_ix.c optional ix device-driver
@@ -117,7 +117,7 @@ pc98/pc98/if_fe.c optional fe device-driver
#pc98/isa/if_lnc.c optional lnc device-driver
#i386/isa/if_sr.c optional sr device-driver
#pc98/isa/if_ze.c optional ze device-driver
-pc98/pc98/if_zp.c optional zp device-driver
+i386/isa/if_zp.c optional zp device-driver
pc98/pc98/pc98.c optional nec device-driver
pc98/pc98/pc98.c optional epson device-driver
pc98/isa/istallion.c optional stli device-driver
diff --git a/sys/pc98/conf/majors.pc98 b/sys/pc98/conf/majors.pc98
index 8659630..702c9ad 100644
--- a/sys/pc98/conf/majors.pc98
+++ b/sys/pc98/conf/majors.pc98
@@ -1,4 +1,4 @@
-$Id: majors.pc98,v 1.1.1.1 1996/06/14 10:04:40 asami Exp $
+$Id: majors.pc98,v 1.2 1996/07/23 07:45:50 asami Exp $
Hopefully, this list will one day be obsoleted by DEVFS, but for now
this is the current allocation of device major numbers.
@@ -114,3 +114,4 @@ chrdev name comments
74 ccd concatenated disk
75 stli Stallion (intelligent cdk based) (gerg@stallion.oz.au)
76 scc IBM Smart Capture Card (ohashi@mickey.ai.kyutech.ac.jp)
+77 cyy Cyclades Ye/PCI serial card
diff --git a/sys/pc98/i386/autoconf.c b/sys/pc98/i386/autoconf.c
index 6474650..9e0ac01 100644
--- a/sys/pc98/i386/autoconf.c
+++ b/sys/pc98/i386/autoconf.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)autoconf.c 7.1 (Berkeley) 5/9/91
- * $Id: autoconf.c,v 1.1.1.1 1996/06/14 10:04:40 asami Exp $
+ * $Id: autoconf.c,v 1.2 1996/08/30 10:42:51 asami Exp $
*/
/*
@@ -67,7 +67,7 @@
#include "nec.h"
#include "epson.h"
#if NNEC > 0 || NEPSON > 0
-#include <pc98/pc98/pc98_device.h>
+#include <i386/isa/isa_device.h>
#endif
#else /* !PC98 */
#include "isa.h"
@@ -192,7 +192,7 @@ configure(dummy)
#endif
#ifdef PC98
#if NNEC > 0 || NEPSON > 0
- pc98_configure();
+ isa_configure();
#endif
#else /* IBM-PC */
#if NEISA > 0
diff --git a/sys/pc98/i386/machdep.c b/sys/pc98/i386/machdep.c
index 9b439cf..4486b65 100644
--- a/sys/pc98/i386/machdep.c
+++ b/sys/pc98/i386/machdep.c
@@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
- * $Id: machdep.c,v 1.2 1996/07/23 07:45:54 asami Exp $
+ * $Id: machdep.c,v 1.3 1996/08/30 10:42:53 asami Exp $
*/
#include "npx.h"
@@ -113,11 +113,10 @@
#include <machine/perfmon.h>
#endif
+#include <i386/isa/isa_device.h>
#ifdef PC98
-#include <pc98/pc98/pc98_device.h>
#include <pc98/pc98/pc98_machdep.h>
#else
-#include <i386/isa/isa_device.h>
#include <i386/isa/rtc.h>
#endif
#include <machine/random.h>
@@ -1073,7 +1072,7 @@ init386(first)
#include "nec.h"
#include "epson.h"
#if NNEC > 0 || NEPSON > 0
- pc98_defaultirq();
+ isa_defaultirq();
#endif
#else /* IBM-PC */
#include "isa.h"
@@ -1115,14 +1114,41 @@ init386(first)
biosextmem = rtcin(RTC_EXTLO)+ (rtcin(RTC_EXTHI)<<8);
/*
- * Print a warning if the official BIOS interface disagrees
- * with the hackish interface used above. Eventually only
- * the official interface should be used.
+ * Print a warning and set it to the safest value if the official
+ * BIOS interface (bootblock supplied) disagrees with the
+ * hackish interface used above. Eventually only the official
+ * interface should be used. This is necessary for some machines
+ * who 'steal' memory from the basemem for use as BIOS memory.
*/
if (bootinfo.bi_memsizes_valid) {
- if (bootinfo.bi_basemem != biosbasemem)
- printf("BIOS basemem (%ldK) != RTC basemem (%dK)\n",
+ if (bootinfo.bi_basemem != biosbasemem) {
+ vm_offset_t pa, va, tmpva;
+ vm_size_t size;
+ unsigned *pte;
+
+ printf("BIOS basemem (%ldK) != RTC basemem (%dK), ",
bootinfo.bi_basemem, biosbasemem);
+ printf("setting to BIOS value.\n");
+ biosbasemem = bootinfo.bi_basemem;
+ /*
+ * XXX - Map this 'hole' of memory in the same manner
+ * as the ISA_HOLE (read/write/non-cacheable), since
+ * the BIOS 'fudges' it to become part of the ISA_HOLE.
+ * This code is similar to the code used in
+ * pmap_mapdev, but since no memory needs to be
+ * allocated we simply change the mapping.
+ */
+ pa = biosbasemem * 1024;
+ va = pa + KERNBASE;
+ size = roundup(ISA_HOLE_START - pa, PAGE_SIZE);
+ for (tmpva = va; size > 0;) {
+ pte = (unsigned *)vtopte(tmpva);
+ *pte = pa | PG_RW | PG_V | PG_N;
+ size -= PAGE_SIZE;
+ tmpva += PAGE_SIZE;
+ pa += PAGE_SIZE;
+ }
+ }
if (bootinfo.bi_extmem != biosextmem)
printf("BIOS extmem (%ldK) != RTC extmem (%dK)\n",
bootinfo.bi_extmem, biosextmem);
diff --git a/sys/pc98/i386/trap.c b/sys/pc98/i386/trap.c
index 727a36e..c55daf4 100644
--- a/sys/pc98/i386/trap.c
+++ b/sys/pc98/i386/trap.c
@@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* from: @(#)trap.c 7.4 (Berkeley) 5/13/91
- * $Id: trap.c,v 1.2 1996/07/23 07:45:59 asami Exp $
+ * $Id: trap.c,v 1.3 1996/08/30 10:42:54 asami Exp $
*/
/*
@@ -76,7 +76,7 @@
#include <machine/reg.h>
#include <machine/trap.h>
#ifdef PC98
-#include <pc98/pc98/pc98_device.h>
+#include <machine/../isa/isa_device.h>
#include "nec.h"
#include "epson.h"
@@ -294,11 +294,7 @@ trap(frame)
return;
#endif /* DDB */
/* machine/parity/power fail/"kitchen sink" faults */
-#ifdef PC98
- if (pc98_nmi(code) == 0) return;
-#else
if (isa_nmi(code) == 0) return;
-#endif
panic("NMI indicates hardware failure");
#endif /* POWERFAIL_NMI */
#endif /* NNEC > 0 */
@@ -471,11 +467,7 @@ trap(frame)
return;
#endif /* DDB */
/* machine/parity/power fail/"kitchen sink" faults */
-#ifdef PC98
- if (pc98_nmi(code) == 0) return;
-#else
if (isa_nmi(code) == 0) return;
-#endif
/* FALL THROUGH */
#endif /* POWERFAIL_NMI */
#endif /* NNEC > 0 */
diff --git a/sys/pc98/i386/userconfig.c b/sys/pc98/i386/userconfig.c
index f3ba327..9c2c12f 100644
--- a/sys/pc98/i386/userconfig.c
+++ b/sys/pc98/i386/userconfig.c
@@ -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.2 1996/08/30 10:42:55 asami Exp $
+ ** $Id: userconfig.c,v 1.3 1996/08/31 15:06:33 asami Exp $
**/
/**
@@ -118,25 +118,14 @@
#include <machine/cons.h>
#include <machine/md_var.h>
-#ifdef PC98
-#include <pc98/pc98/pc98_device.h>
-#else
#include <i386/isa/isa_device.h>
-#endif
#include <pci/pcivar.h>
-#ifdef PC98
-static struct isa_device *devtabs[] = { pc98_devtab_bio, pc98_devtab_tty, pc98_devtab_net,
- pc98_devtab_null, NULL };
-
-static struct isa_device *isa_devlist; /* list read by dset to extract changes */
-#else
static struct isa_device *devtabs[] = { isa_devtab_bio, isa_devtab_tty, isa_devtab_net,
isa_devtab_null, NULL };
static struct isa_device *isa_devlist; /* list read by dset to extract changes */
-#endif
#define putchar(x) cnputc(x)
#define getchar() cngetc()
@@ -2205,7 +2194,7 @@ visuserconfig(void)
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: userconfig.c,v 1.2 1996/08/30 10:42:55 asami Exp $
+ * $Id: userconfig.c,v 1.43 1996/08/10 22:06:09 joerg Exp $
*/
#include "scbus.h"
@@ -2425,17 +2414,10 @@ static int
list_devices(CmdParm *parms)
{
lineno = 0;
-#ifdef PC98
- lsdevtab(&pc98_devtab_bio[0]);
- lsdevtab(&pc98_devtab_tty[0]);
- lsdevtab(&pc98_devtab_net[0]);
- lsdevtab(&pc98_devtab_null[0]);
-#else
lsdevtab(&isa_devtab_bio[0]);
lsdevtab(&isa_devtab_tty[0]);
lsdevtab(&isa_devtab_net[0]);
lsdevtab(&isa_devtab_null[0]);
-#endif
return 0;
}
@@ -2599,23 +2581,6 @@ lsdevtab(struct isa_device *dt)
}
}
-#ifdef PC98
-static struct isa_device *
-find_device(char *devname, int unit)
-{
- struct isa_device *ret;
-
- if ((ret = search_devtable(&pc98_devtab_bio[0], devname, unit)) != NULL)
- return ret;
- if ((ret = search_devtable(&pc98_devtab_tty[0], devname, unit)) != NULL)
- return ret;
- if ((ret = search_devtable(&pc98_devtab_net[0], devname, unit)) != NULL)
- return ret;
- if ((ret = search_devtable(&pc98_devtab_null[0], devname, unit)) != NULL)
- return ret;
- return NULL;
-}
-#else
static struct isa_device *
find_device(char *devname, int unit)
{
@@ -2631,7 +2596,6 @@ find_device(char *devname, int unit)
return ret;
return NULL;
}
-#endif
static struct isa_device *
search_devtable(struct isa_device *dt, char *devname, int unit)
diff --git a/sys/pc98/i386/vm_machdep.c b/sys/pc98/i386/vm_machdep.c
index 828191d..3b14248 100644
--- a/sys/pc98/i386/vm_machdep.c
+++ b/sys/pc98/i386/vm_machdep.c
@@ -38,7 +38,7 @@
*
* from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91
* Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$
- * $Id: vm_machdep.c,v 1.1.1.1 1996/06/14 10:04:42 asami Exp $
+ * $Id: vm_machdep.c,v 1.2 1996/07/23 07:46:03 asami Exp $
*/
#include "npx.h"
@@ -68,7 +68,6 @@
#ifdef PC98
#include <pc98/pc98/pc98.h>
-#include <pc98/pc98/pc98_device.h>
#else
#include <i386/isa/isa.h>
#endif
diff --git a/sys/pc98/pc98/aic6360.c b/sys/pc98/pc98/aic6360.c
index c035599..a84284d 100644
--- a/sys/pc98/pc98/aic6360.c
+++ b/sys/pc98/pc98/aic6360.c
@@ -31,7 +31,7 @@
*/
/*
- * $Id: aic6360.c,v 1.1.1.1 1996/06/14 10:04:42 asami Exp $
+ * $Id: aic6360.c,v 1.2 1996/08/31 15:06:38 asami Exp $
*
* Acknowledgements: Many of the algorithms used in this driver are
* inspired by the work of Julian Elischer (julian@tfs.com) and
@@ -130,11 +130,7 @@
#include <sys/devconf.h>
#include <machine/clock.h>
-#ifdef PC98
-#include <pc98/pc98/pc98_device.h>
-#else
#include <i386/isa/isa_device.h>
-#endif
#include <sys/kernel.h>
@@ -740,15 +736,9 @@ static struct scsi_device aic_dev = {
static struct kern_devconf kdc_aic[NAIC] = { {
0, 0, 0, /* filled in by dev_attach */
-#ifdef PC98
- "aic", 0, { MDDT_PC98, 0, "bio" },
- pc98_generic_externalize, 0, 0, PC98_EXTERNALLEN,
- &kdc_nec0, /* parent */
-#else
"aic", 0, { MDDT_ISA, 0, "bio" },
isa_generic_externalize, 0, 0, ISA_EXTERNALLEN,
&kdc_isa0, /* parent */
-#endif
0, /* parentdata */
DC_UNCONFIGURED, /* start out in unconfig state */
"Adaptec AIC-6360 SCSI host adapter chipset",
diff --git a/sys/pc98/pc98/clock.c b/sys/pc98/pc98/clock.c
index 166ba2a..b9547fd 100644
--- a/sys/pc98/pc98/clock.c
+++ b/sys/pc98/pc98/clock.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)clock.c 7.2 (Berkeley) 5/12/91
- * $Id: clock.c,v 1.2 1996/07/23 07:46:07 asami Exp $
+ * $Id: clock.c,v 1.3 1996/08/30 10:42:58 asami Exp $
*/
/*
@@ -46,7 +46,7 @@
/*
* modified for PC98
- * $Id: clock.c,v 1.2 1996/07/23 07:46:07 asami Exp $
+ * $Id: clock.c,v 1.3 1996/08/30 10:42:58 asami Exp $
*/
/*
@@ -72,7 +72,7 @@
#include <sys/syslog.h>
#include <pc98/pc98/icu.h>
#include <pc98/pc98/pc98.h>
-#include <pc98/pc98/pc98_device.h>
+#include <i386/isa/isa_device.h>
#include <pc98/pc98/timerreg.h>
#else
#include <i386/isa/icu.h>
diff --git a/sys/pc98/pc98/fd.c b/sys/pc98/pc98/fd.c
index c4ec6ff..df520db 100644
--- a/sys/pc98/pc98/fd.c
+++ b/sys/pc98/pc98/fd.c
@@ -43,7 +43,7 @@
* SUCH DAMAGE.
*
* from: @(#)fd.c 7.4 (Berkeley) 5/25/91
- * $Id: fd.c,v 1.3 1996/07/30 18:55:58 asami Exp $
+ * $Id: fd.c,v 1.4 1996/08/31 15:06:42 asami Exp $
*
*/
@@ -73,7 +73,7 @@
#include <sys/dkstat.h>
#ifdef PC98
#include <pc98/pc98/pc98.h>
-#include <pc98/pc98/pc98_device.h>
+#include <i386/isa/isa_device.h>
#include <pc98/pc98/fdreg.h>
#include <pc98/pc98/fdc.h>
#else
@@ -117,13 +117,8 @@ static struct kern_devconf kdc_fd[NFD] = { {
struct kern_devconf kdc_fdc[NFDC] = { {
0, 0, 0, /* filled in by kern_devconf.c */
-#ifdef PC98
- "fdc", 0, { MDDT_PC98, 0, "bio" },
- pc98_generic_externalize, 0, fdc_goaway, PC98_EXTERNALLEN,
-#else
"fdc", 0, { MDDT_ISA, 0, "bio" },
isa_generic_externalize, 0, fdc_goaway, ISA_EXTERNALLEN,
-#endif
0, /* parent */
0, /* parentdata */
DC_UNCONFIGURED, /* state */
@@ -152,11 +147,7 @@ fdc_registerdev(struct isa_device *dvp)
kdc_fdc[unit] = kdc_fdc[0];
kdc_fdc[unit].kdc_unit = unit;
-#ifdef PC98
- kdc_fdc[unit].kdc_parent = &kdc_nec0;
-#else
kdc_fdc[unit].kdc_parent = &kdc_isa0;
-#endif
kdc_fdc[unit].kdc_parentdata = dvp;
dev_attach(&kdc_fdc[unit]);
}
@@ -772,8 +763,8 @@ fdattach(struct isa_device *dev)
printf(" [dma is changed to #%d]", fdc->dmachan);
}
/* Acquire the DMA channel forever, The driver will do the rest */
- pc98_dma_acquire(fdc->dmachan);
- pc98_dmainit(fdc->dmachan, 128 << 3 /* XXX max secsize */);
+ isa_dma_acquire(fdc->dmachan);
+ isa_dmainit(fdc->dmachan, 128 << 3 /* XXX max secsize */);
fdc->state = DEVIDLE;
fdc_reset(fdc);
#else
@@ -788,11 +779,7 @@ fdattach(struct isa_device *dev)
TAILQ_INIT(&fdc->head);
/* check for each floppy drive */
-#ifdef PC98
- for (fdup = pc98_biotab_fdc; fdup->id_driver != 0; fdup++) {
-#else
for (fdup = isa_biotab_fdc; fdup->id_driver != 0; fdup++) {
-#endif
if (fdup->id_iobase != dev->id_iobase)
continue;
fdu = fdup->id_unit;
@@ -1869,11 +1856,7 @@ fdstate(fdcu_t fdcu, fdc_p fdc)
#ifdef EPSON_NRDISK
if (fdu != nrdu) {
#endif /* EPSON_NRDISK */
-#ifdef PC98
- pc98_dmastart(bp->b_flags, bp->b_un.b_addr+fd->skip,
-#else
isa_dmastart(bp->b_flags, bp->b_un.b_addr+fd->skip,
-#endif
format ? bp->b_bcount : fdblk, fdc->dmachan);
blknum = (unsigned long)bp->b_blkno*DEV_BSIZE/fdblk
+ fd->skip/fdblk;
@@ -2003,11 +1986,7 @@ fdstate(fdcu_t fdcu, fdc_p fdc)
#ifdef EPSON_NRDISK
if (fdu != nrdu) {
#endif /* EPSON_NRDISK */
-#ifdef PC98
- pc98_dmadone(bp->b_flags, bp->b_un.b_addr+fd->skip,
-#else
isa_dmadone(bp->b_flags, bp->b_un.b_addr+fd->skip,
-#endif
format ? bp->b_bcount : fdblk, fdc->dmachan);
#ifdef EPSON_NRDISK
}
diff --git a/sys/pc98/pc98/ft.c b/sys/pc98/pc98/ft.c
index f92aa35..1786fd4 100644
--- a/sys/pc98/pc98/ft.c
+++ b/sys/pc98/pc98/ft.c
@@ -17,7 +17,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*
* ft.c - QIC-40/80 floppy tape driver
- * $Id: ft.c,v 1.2 1996/07/23 07:46:13 asami Exp $
+ * $Id: ft.c,v 1.3 1996/08/31 15:06:44 asami Exp $
*
* 01/19/95 ++sg
* Cleaned up recalibrate/seek code at attach time for FreeBSD 2.x.
@@ -82,13 +82,12 @@
#include <machine/clock.h>
+#include <i386/isa/isa_device.h>
#ifdef PC98
-#include <pc98/pc98/pc98_device.h>
#include <pc98/pc98/fdreg.h>
#include <pc98/pc98/fdc.h>
#include <pc98/pc98/ftreg.h>
#else
-#include <i386/isa/isa_device.h>
#include <i386/isa/fdreg.h>
#include <i386/isa/fdc.h>
#include <i386/isa/rtc.h>
@@ -1184,11 +1183,7 @@ restate:
case 1: /* Start DMA */
/* Tape is now moving and in position-- start DMA now! */
-#ifdef PC98
- pc98_dmastart(B_READ, ft->xptr, QCV_BLKSIZE, 2);
-#else
isa_dmastart(B_READ, ft->xptr, QCV_BLKSIZE, 2);
-#endif
out_fdc(fdcu, 0x66); /* read */
#ifdef PC98
out_fdc(fdcu, 3);
@@ -1208,11 +1203,7 @@ restate:
case 2: /* DMA completed */
/* Transfer complete, get status */
for (i = 0; i < 7; i++) rddta[i] = in_fdc(fdcu);
-#ifdef PC98
- pc98_dmadone(B_READ, ft->xptr, QCV_BLKSIZE, 2);
-#else
isa_dmadone(B_READ, ft->xptr, QCV_BLKSIZE, 2);
-#endif
#if FTDBGALL
/* Compute where the controller thinks we are */
@@ -1317,11 +1308,7 @@ restate:
case 1: /* Start DMA */
/* Tape is now moving and in position-- start DMA now! */
-#ifdef PC98
- pc98_dmastart(B_WRITE, ft->xptr, QCV_BLKSIZE, 2);
-#else
isa_dmastart(B_WRITE, ft->xptr, QCV_BLKSIZE, 2);
-#endif
out_fdc(fdcu, 0x45); /* write */
#ifdef PC98
out_fdc(fdcu, 3);
@@ -1341,11 +1328,7 @@ restate:
case 2: /* DMA completed */
/* Transfer complete, get status */
for (i = 0; i < 7; i++) rddta[i] = in_fdc(fdcu);
-#ifdef PC98
- pc98_dmadone(B_WRITE, ft->xptr, QCV_BLKSIZE, 2);
-#else
isa_dmadone(B_WRITE, ft->xptr, QCV_BLKSIZE, 2);
-#endif
#if FTDBGALL
/* Compute where the controller thinks we are */
diff --git a/sys/pc98/pc98/if_ed.c b/sys/pc98/pc98/if_ed.c
index 70e757d..d65a91c 100644
--- a/sys/pc98/pc98/if_ed.c
+++ b/sys/pc98/pc98/if_ed.c
@@ -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.3 1996/08/30 10:42:59 asami Exp $
+ * $Id: if_ed.c,v 1.4 1996/08/31 15:06:47 asami Exp $
*/
/*
@@ -100,11 +100,10 @@
#include <machine/clock.h>
#include <machine/md_var.h>
+#include <i386/isa/isa_device.h>
#ifdef PC98
-#include <pc98/pc98/pc98_device.h>
#include <pc98/pc98/icu.h>
#else
-#include <i386/isa/isa_device.h>
#include <i386/isa/icu.h>
#endif
#include <i386/isa/if_edreg.h>
@@ -399,15 +398,9 @@ static unsigned short ed_hpp_intr_mask[] = {
static struct kern_devconf kdc_ed_template = {
0, 0, 0, /* filled in by dev_attach */
-#ifdef PC98
- "ed", 0, { MDDT_PC98, 0, "net" },
- pc98_generic_externalize, 0, 0, PC98_EXTERNALLEN,
- &kdc_nec0, /* parent */
-#else
"ed", 0, { MDDT_ISA, 0, "net" },
isa_generic_externalize, 0, 0, ISA_EXTERNALLEN,
&kdc_isa0, /* parent */
-#endif
0, /* parentdata */
DC_UNCONFIGURED, /* state */
"", /* description */
diff --git a/sys/pc98/pc98/if_ep.c b/sys/pc98/pc98/if_ep.c
deleted file mode 100644
index 9c74878..0000000
--- a/sys/pc98/pc98/if_ep.c
+++ /dev/null
@@ -1,1680 +0,0 @@
-/*
- * Copyright (c) 1994 Herb Peyerl <hpeyerl@novatel.ca>
- * All rights reserved.
- *
- * 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 Herb Peyerl.
- * 4. The name of Herb Peyerl may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
- *
- * if_ep.c,v 1.19 1995/01/24 20:53:45 davidg Exp
- */
-
-/*
- * Modified from the FreeBSD 1.1.5.1 version by:
- * Andres Vega Garcia
- * INRIA - Sophia Antipolis, France
- * avega@sophia.inria.fr
- */
-
-/*
- * $Id: if_ep.c,v 1.3 1996/07/30 18:56:03 asami Exp $
- *
- * Promiscuous mode added and interrupt logic slightly changed
- * to reduce the number of adapter failures. Transceiver select
- * logic changed to use value from EEPROM. Autoconfiguration
- * features added.
- * Done by:
- * Serge Babkin
- * Chelindbank (Chelyabinsk, Russia)
- * babkin@hq.icb.chel.su
- */
-
-/*
- * Pccard support for 3C589 by:
- * HAMADA Naoki
- * nao@tom-yam.or.jp
- */
-
-#include "ep.h"
-#if NEP > 0
-
-#include "bpfilter.h"
-
-#include <sys/param.h>
-#if defined(__FreeBSD__)
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/conf.h>
-#include <sys/devconf.h>
-#endif
-#include <sys/mbuf.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <sys/errno.h>
-#include <sys/syslog.h>
-#if defined(__NetBSD__)
-#include <sys/select.h>
-#endif
-
-#include <net/if.h>
-#include <net/if_dl.h>
-#include <net/if_types.h>
-
-#ifdef INET
-#include <netinet/in.h>
-#include <netinet/in_systm.h>
-#include <netinet/in_var.h>
-#include <netinet/ip.h>
-#include <netinet/if_ether.h>
-#endif
-
-#ifdef IPX
-#include <netipx/ipx.h>
-#include <netipx/ipx_if.h>
-#endif
-
-#ifdef NS
-#include <netns/ns.h>
-#include <netns/ns_if.h>
-#endif
-
-#if NBPFILTER > 0
-#include <net/bpf.h>
-#include <net/bpfdesc.h>
-#endif
-
-#if defined(__FreeBSD__)
-#include <machine/clock.h>
-#endif
-
-#ifdef PC98
-#include <pc98/pc98/pc98_device.h>
-#include <pc98/pc98/if_epreg.h>
-#else
-#include <i386/isa/isa_device.h>
-#include <i386/isa/if_epreg.h>
-#endif
-#include <i386/isa/elink.h>
-
-/* Exported variables */
-u_long ep_unit;
-int ep_boards;
-struct ep_board ep_board[EP_MAX_BOARDS + 1];
-
-static int eeprom_rdy __P((struct ep_softc *sc));
-
-static int ep_isa_probe __P((struct isa_device *));
-static struct ep_board * ep_look_for_board_at __P((struct isa_device *is));
-static int ep_isa_attach __P((struct isa_device *));
-static void ep_isa_registerdev __P((struct ep_softc *sc,
- struct isa_device *id));
-static int epioctl __P((struct ifnet * ifp, int, caddr_t));
-static void epmbuffill __P((caddr_t, int));
-static void epmbufempty __P((struct ep_softc *));
-
-static void epinit __P((struct ep_softc *));
-static void epread __P((struct ep_softc *));
-void epreset __P((int));
-static void epstart __P((struct ifnet *));
-static void epstop __P((struct ep_softc *));
-static void epwatchdog __P((struct ifnet *));
-
-#if 0
-static int send_ID_sequence __P((int));
-#endif
-static int get_eeprom_data __P((int, int));
-
-static struct ep_softc* ep_softc[NEP];
-static int ep_current_tag = EP_LAST_TAG + 1;
-static char *ep_conn_type[] = {"UTP", "AUI", "???", "BNC"};
-
-#define ep_ftst(f) (sc->stat&(f))
-#define ep_fset(f) (sc->stat|=(f))
-#define ep_frst(f) (sc->stat&=~(f))
-
-struct isa_driver epdriver = {
- ep_isa_probe,
- ep_isa_attach,
- "ep",
- 0
-};
-
-static struct kern_devconf kdc_isa_ep = {
- 0, 0, 0, /* filled in by dev_attach */
-#ifdef PC98
- "ep", 0, { MDDT_PC98, 0, "net" },
- pc98_generic_externalize, 0, 0, PC98_EXTERNALLEN,
- &kdc_nec0, /* parent */
-#else
- "ep", 0, { MDDT_ISA, 0, "net" },
- isa_generic_externalize, 0, 0, ISA_EXTERNALLEN,
- &kdc_isa0, /* parent */
-#endif
- 0, /* parentdata */
- DC_UNCONFIGURED, /* state */
- "3Com 3C509 Ethernet adapter",
- DC_CLS_NETIF /* class */
-};
-
-#include "crd.h"
-
-#if NCRD > 0
-#include "apm.h"
-#include <sys/select.h>
-#include <pccard/card.h>
-#include <pccard/driver.h>
-#include <pccard/slot.h>
-
-/*
- * PC-Card (PCMCIA) specific code.
- */
-static int card_intr __P((struct pccard_dev *));
-static void ep_unload __P((struct pccard_dev *));
-static void ep_suspend __P((struct pccard_dev *));
-static int ep_pccard_init __P((struct pccard_dev *, int));
-static int ep_pccard_attach __P((struct pccard_dev *));
-
-static struct pccard_drv ep_info = {
- "ep",
- card_intr,
- ep_unload,
- ep_suspend,
- ep_pccard_init,
- 0, /* Attributes - presently unused */
- &net_imask
-};
-
-/* Resume is done by executing ep_pccard_init(dp, 0). */
-static void
-ep_suspend(dp)
- struct pccard_dev *dp;
-{
- struct ep_softc *sc = ep_softc[dp->isahd.id_unit];
-
- printf("ep%d: suspending\n", dp->isahd.id_unit);
- sc->gone = 1;
-}
-
-/*
- *
- */
-static int
-ep_pccard_init(dp, first)
- struct pccard_dev *dp;
- int first;
-{
- struct isa_device *is = &dp->isahd;
- struct ep_softc *sc = ep_softc[is->id_unit];
- struct ep_board *epb;
- int i;
-
- epb = &ep_board[is->id_unit];
-
- if (sc == 0) {
- if ((sc = ep_alloc(is->id_unit, epb)) == 0) {
- return (ENXIO);
- }
- ep_unit++;
- ep_isa_registerdev(sc, is);
- }
-
- /* get_e() requires these. */
- sc->ep_io_addr = is->id_iobase;
- sc->unit = is->id_unit;
-
- epb->epb_addr = is->id_iobase;
- epb->epb_used = 1;
- epb->prod_id = get_e(sc, EEPROM_PROD_ID);
-
- if (epb->prod_id != 0x9058) { /* 3C589's product id */
- if (first) {
- printf("ep%d: failed to come ready.\n", is->id_unit);
- } else {
- printf("ep%d: failed to resume.\n", is->id_unit);
- }
- return (ENXIO);
- }
-
- epb->res_cfg = get_e(sc, EEPROM_RESOURCE_CFG);
- for (i = 0; i < 3; i++) {
- sc->epb->eth_addr[i] = get_e(sc, EEPROM_NODE_ADDR_0 + i);
- }
-
- if (first) {
- if (ep_pccard_attach(dp) == 0) {
- return (ENXIO);
- }
- sc->arpcom.ac_if.if_snd.ifq_maxlen = ifqmaxlen;
- }
-
- if (!first) {
- sc->kdc->kdc_state = DC_IDLE;
- sc->gone = 0;
- printf("ep%d: resumed.\n", is->id_unit);
- epinit(sc);
- }
-
- return (0);
-}
-
-static int
-ep_pccard_attach(dp)
- struct pccard_dev *dp;
-{
- struct isa_device *is = &dp->isahd;
- struct ep_softc *sc = ep_softc[is->id_unit];
- u_short config;
-
- sc->ep_connectors = 0;
- config = inw(IS_BASE + EP_W0_CONFIG_CTRL);
- if (config & IS_BNC) {
- sc->ep_connectors |= BNC;
- }
- if (config & IS_UTP) {
- sc->ep_connectors |= UTP;
- }
- if (!(sc->ep_connectors & 7))
- printf("no connectors!");
- sc->ep_connector = inw(BASE + EP_W0_ADDRESS_CFG) >> ACF_CONNECTOR_BITS;
-
- /* ROM size = 0, ROM base = 0 */
- /* For now, ignore AUTO SELECT feature of 3C589B and later. */
- outw(BASE + EP_W0_ADDRESS_CFG, get_e(sc, EEPROM_ADDR_CFG) & 0xc000);
-
- /* Fake IRQ must be 3 */
- outw(BASE + EP_W0_RESOURCE_CFG, (sc->epb->res_cfg & 0x0fff) | 0x3000);
-
- outw(BASE + EP_W0_PRODUCT_ID, sc->epb->prod_id);
-
- ep_attach(sc);
-
- return 1;
-}
-
-static void
-ep_unload(dp)
- struct pccard_dev *dp;
-{
- struct ep_softc *sc = ep_softc[dp->isahd.id_unit];
-
- if (sc->kdc->kdc_state == DC_UNCONFIGURED) {
- printf("ep%d: already unloaded\n", dp->isahd.id_unit);
- return;
- }
- sc->kdc->kdc_state = DC_UNCONFIGURED;
- sc->arpcom.ac_if.if_flags &= ~IFF_RUNNING;
- sc->gone = 1;
- printf("ep%d: unload\n", dp->isahd.id_unit);
-}
-
-/*
- * card_intr - Shared interrupt called from
- * front end of PC-Card handler.
- */
-static int
-card_intr(dp)
- struct pccard_dev *dp;
-{
- epintr(dp->isahd.id_unit);
- return(1);
-}
-
-#endif /* NCRD > 0 */
-
-static void
-ep_isa_registerdev(sc, id)
- struct ep_softc *sc;
- struct isa_device *id;
-{
- sc->kdc = (struct kern_devconf *)malloc(sizeof(struct kern_devconf),
- M_DEVBUF, M_NOWAIT);
- if (!sc->kdc) {
- printf("WARNING: ep_isa_registerdev unable to malloc! "
- "Device kdc will not be registerd\n");
- return;
- }
- bcopy(&kdc_isa_ep, sc->kdc, sizeof(kdc_isa_ep));
- sc->kdc->kdc_unit = sc->unit;
- sc->kdc->kdc_parentdata = id;
- dev_attach(sc->kdc);
-}
-
-static int
-eeprom_rdy(sc)
- struct ep_softc *sc;
-{
- int i;
-
- for (i = 0; is_eeprom_busy(BASE) && i < MAX_EEPROMBUSY; i++);
- if (i >= MAX_EEPROMBUSY) {
- printf("ep%d: eeprom failed to come ready.\n", sc->unit);
- return (0);
- }
- return (1);
-}
-
-static struct ep_board *
-ep_look_for_board_at(is)
- struct isa_device *is;
-{
- int data, i, j, id_port = ELINK_ID_PORT;
- int count = 0;
-
- if (ep_current_tag == (EP_LAST_TAG + 1)) {
- /* Come here just one time */
-
- ep_current_tag--;
-
- /* Look for the ISA boards. Init and leave them actived */
- outb(id_port, 0);
- outb(id_port, 0);
-
- elink_idseq(0xCF);
-
- elink_reset();
- DELAY(10000);
- for (i = 0; i < EP_MAX_BOARDS; i++) {
- outb(id_port, 0);
- outb(id_port, 0);
- elink_idseq(0xCF);
-
- data = get_eeprom_data(id_port, EEPROM_MFG_ID);
- if (data != MFG_ID)
- break;
-
- /* resolve contention using the Ethernet address */
-
- for (j = 0; j < 3; j++)
- get_eeprom_data(id_port, j);
-
- /* and save this address for later use */
-
- for (j = 0; j < 3; j++)
- ep_board[ep_boards].eth_addr[j] = get_eeprom_data(id_port, j);
-
- ep_board[ep_boards].res_cfg =
- get_eeprom_data(id_port, EEPROM_RESOURCE_CFG);
-
- ep_board[ep_boards].prod_id =
- get_eeprom_data(id_port, EEPROM_PROD_ID);
-
- ep_board[ep_boards].epb_used = 0;
- ep_board[ep_boards].epb_addr =
- (get_eeprom_data(id_port, EEPROM_ADDR_CFG) & 0x1f) * 0x10 + 0x200;
-
- if(ep_board[ep_boards].epb_addr > 0x3E0)
- /* Board in EISA configuration mode */
- continue;
-
- outb(id_port, ep_current_tag); /* tags board */
- outb(id_port, ACTIVATE_ADAPTER_TO_CONFIG);
- ep_boards++;
- count++;
- ep_current_tag--;
- }
-
- ep_board[ep_boards].epb_addr = 0;
- if (count) {
- printf("%d 3C5x9 board(s) on ISA found at", count);
- for (j = 0; ep_board[j].epb_addr; j++)
- if (ep_board[j].epb_addr <= 0x3E0)
- printf(" 0x%x", ep_board[j].epb_addr);
- printf("\n");
- }
- }
-
- /* we have two cases:
- *
- * 1. Device was configured with 'port ?'
- * In this case we search for the first unused card in list
- *
- * 2. Device was configured with 'port xxx'
- * In this case we search for the unused card with that address
- *
- */
-
- if(IS_BASE==-1) { /* port? */
- for (i = 0; ep_board[i].epb_addr && ep_board[i].epb_used; i++);
- if(ep_board[i].epb_addr==0)
- return 0;
-
- IS_BASE=ep_board[i].epb_addr;
- ep_board[i].epb_used=1;
-
- return &ep_board[i];
- } else {
- for (i=0; ep_board[i].epb_addr && ep_board[i].epb_addr != IS_BASE; i++);
-
- if( ep_board[i].epb_used || ep_board[i].epb_addr != IS_BASE)
- return 0;
-
- if (inw(IS_BASE + EP_W0_EEPROM_COMMAND) & EEPROM_TST_MODE)
- printf("ep%d: 3c5x9 at 0x%x in PnP mode. Disable PnP mode!\n",
- is->id_unit, IS_BASE);
- ep_board[i].epb_used=1;
-
- return &ep_board[i];
- }
-}
-
-/*
- * get_e: gets a 16 bits word from the EEPROM. we must have set the window
- * before
- */
-u_int16_t
-get_e(sc, offset)
- struct ep_softc *sc;
- int offset;
-{
- if (!eeprom_rdy(sc))
- return (0xffff);
- outw(BASE + EP_W0_EEPROM_COMMAND, EEPROM_CMD_RD | offset);
- if (!eeprom_rdy(sc))
- return (0xffff);
- return (inw(BASE + EP_W0_EEPROM_DATA));
-}
-
-struct ep_softc *
-ep_alloc(unit, epb)
- int unit;
- struct ep_board *epb;
-{
- struct ep_softc *sc;
-
- if (unit >= NEP) {
- printf("ep: unit number (%d) too high\n", unit);
- return NULL;
- }
-
- /*
- * Allocate a storage area for us
- */
- if (ep_softc[unit]) {
- printf("ep%d: unit number already allocated to another "
- "adaptor\n", unit);
- return NULL;
- }
-
- sc = malloc(sizeof(struct ep_softc), M_DEVBUF, M_NOWAIT);
- if(!sc) {
- printf("ep%d: cannot malloc!\n", unit);
- return NULL;
- }
- bzero(sc, sizeof(struct ep_softc));
- ep_softc[unit] = sc;
- sc->unit = unit;
- sc->ep_io_addr = epb->epb_addr;
- sc->epb = epb;
-
- return(sc);
-}
-
-void
-ep_free(sc)
- struct ep_softc *sc;
-{
- ep_softc[sc->unit] = NULL;
- free(sc, M_DEVBUF);
- return;
-}
-
-int
-ep_isa_probe(is)
- struct isa_device *is;
-{
- struct ep_softc *sc;
- struct ep_board *epb;
- u_short k;
-
-#if NCRD > 0
- pccard_add_driver(&ep_info);
-#endif /* NCRD > 0 */
-
- if(( epb=ep_look_for_board_at(is) )==0)
- return (0);
-
- /*
- * Allocate a storage area for us
- */
- sc = ep_alloc(ep_unit, epb);
- if( !sc )
- return (0);
-
- is->id_unit = ep_unit++;
-
- ep_isa_registerdev(sc, is);
-
- /*
- * The iobase was found and MFG_ID was 0x6d50. PROD_ID should be
- * 0x9[0-f]50
- */
- GO_WINDOW(0);
- k = sc->epb->prod_id;
- if ((k & 0xf0ff) != (PROD_ID & 0xf0ff)) {
- printf("ep_isa_probe: ignoring model %04x\n", k);
- ep_free(sc);
- return (0);
- }
-
- k = sc->epb->res_cfg;
-
- k >>= 12;
-
- /* Now we have two cases again:
- *
- * 1. Device was configured with 'irq?'
- * In this case we use irq read from the board
- *
- * 2. Device was configured with 'irq xxx'
- * In this case we set up the board to use specified interrupt
- *
- */
-
- if(is->id_irq==0) { /* irq? */
- is->id_irq= 1 << ( (k==2) ? 9 : k );
- }
-
- sc->stat = 0; /* 16 bit access */
-
- /* By now, the adapter is already activated */
-
- return (EP_IOSIZE); /* 16 bytes of I/O space used. */
-}
-
-static int
-ep_isa_attach(is)
- struct isa_device *is;
-{
- struct ep_softc *sc = ep_softc[is->id_unit];
- u_short config;
- int irq;
-
- sc->ep_connectors = 0;
- config = inw(IS_BASE + EP_W0_CONFIG_CTRL);
- if (config & IS_AUI) {
- sc->ep_connectors |= AUI;
- }
- if (config & IS_BNC) {
- sc->ep_connectors |= BNC;
- }
- if (config & IS_UTP) {
- sc->ep_connectors |= UTP;
- }
- if (!(sc->ep_connectors & 7))
- printf("no connectors!");
- sc->ep_connector = inw(BASE + EP_W0_ADDRESS_CFG) >> ACF_CONNECTOR_BITS;
- /*
- * Write IRQ value to board
- */
-
- irq = ffs(is->id_irq) - 1;
- if(irq == -1) {
- printf(" invalid irq... cannot attach\n");
- return 0;
- }
-
- GO_WINDOW(0);
- if(irq == 9)
- irq = 2;
- SET_IRQ(BASE, irq);
-
- ep_attach(sc);
- return 1;
-}
-
-int
-ep_attach(sc)
- struct ep_softc *sc;
-{
- struct ifaddr *ifa;
- struct ifnet *ifp = &sc->arpcom.ac_if;
- struct sockaddr_dl *sdl;
- u_short *p;
- int i;
- int attached;
-
- sc->gone = 0;
- attached = (ifp->if_softc != 0);
-
- printf("ep%d: ", sc->unit);
- /*
- * Current media type
- */
- if(sc->ep_connectors & AUI) {
- printf("aui");
- if(sc->ep_connectors & ~AUI)
- printf("/");
- }
- if(sc->ep_connectors & UTP) {
- printf("utp");
- if(sc->ep_connectors & BNC)
- printf("/");
- }
- if(sc->ep_connectors & BNC) {
- printf("bnc");
- }
-
- printf("[*%s*]", ep_conn_type[sc->ep_connector]);
-
- /*
- * Setup the station address
- */
- p = (u_short *) & sc->arpcom.ac_enaddr;
- GO_WINDOW(2);
- for (i = 0; i < 3; i++) {
- p[i] = htons(sc->epb->eth_addr[i]);
- outw(BASE + EP_W2_ADDR_0 + (i * 2), ntohs(p[i]));
- }
- printf(" address %6D\n", sc->arpcom.ac_enaddr, ":");
-
- ifp->if_softc = sc;
- ifp->if_unit = sc->unit;
- ifp->if_name = "ep";
- ifp->if_mtu = ETHERMTU;
- ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
- ifp->if_output = ether_output;
- ifp->if_start = epstart;
- ifp->if_ioctl = epioctl;
- ifp->if_watchdog = epwatchdog;
-
- if (!attached) {
- if_attach(ifp);
- ether_ifattach(ifp);
- }
-
- /* device attach does transition from UNCONFIGURED to IDLE state */
- sc->kdc->kdc_state=DC_IDLE;
-
- /*
- * Fill the hardware address into ifa_addr if we find an AF_LINK entry.
- * We need to do this so bpf's can get the hardware addr of this card.
- * netstat likes this too!
- */
- ifa = ifp->if_addrlist;
- while ((ifa != 0) && (ifa->ifa_addr != 0) &&
- (ifa->ifa_addr->sa_family != AF_LINK))
- ifa = ifa->ifa_next;
-
- if ((ifa != 0) && (ifa->ifa_addr != 0)) {
- sdl = (struct sockaddr_dl *) ifa->ifa_addr;
- sdl->sdl_type = IFT_ETHER;
- sdl->sdl_alen = ETHER_ADDR_LEN;
- sdl->sdl_slen = 0;
- bcopy(sc->arpcom.ac_enaddr, LLADDR(sdl), ETHER_ADDR_LEN);
- }
- /* we give some initial parameters */
- sc->rx_avg_pkt = 128;
-
- /*
- * NOTE: In all this I multiply everything by 64.
- * W_s = the speed the CPU is able to write to the TX FIFO.
- * T_s = the speed the board sends the info to the Ether.
- * W_s/T_s = 16 (represents 16/64) => W_s = 25 % of T_s.
- * This will give us for a packet of 1500 bytes
- * tx_start_thresh=1125 and for a pkt of 64 bytes tx_start_threshold=48.
- * We prefer to start thinking the CPU is much slower than the Ethernet
- * transmission.
- */
- sc->tx_rate = TX_INIT_RATE;
- sc->tx_counter = 0;
- sc->rx_latency = RX_INIT_LATENCY;
- sc->rx_early_thresh = RX_INIT_EARLY_THRESH;
-#ifdef EP_LOCAL_STATS
- sc->rx_no_first = sc->rx_no_mbuf =
- sc->rx_bpf_disc = sc->rx_overrunf = sc->rx_overrunl =
- sc->tx_underrun = 0;
-#endif
- ep_fset(F_RX_FIRST);
- sc->top = sc->mcur = 0;
-
-#if NBPFILTER > 0
- if (!attached) {
- bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
- }
-#endif
- return 0;
-}
-
-
-/*
- * The order in here seems important. Otherwise we may not receive
- * interrupts. ?!
- */
-static void
-epinit(sc)
- struct ep_softc *sc;
-{
- register struct ifnet *ifp = &sc->arpcom.ac_if;
- int s, i, j;
-
- if (sc->gone)
- return;
-
- /*
- if (ifp->if_addrlist == (struct ifaddr *) 0)
- return;
- */
-
- s = splimp();
- while (inw(BASE + EP_STATUS) & S_COMMAND_IN_PROGRESS);
-
- GO_WINDOW(0);
- outw(BASE + EP_COMMAND, STOP_TRANSCEIVER);
- GO_WINDOW(4);
- outw(BASE + EP_W4_MEDIA_TYPE, DISABLE_UTP);
- GO_WINDOW(0);
-
- /* Disable the card */
- outw(BASE + EP_W0_CONFIG_CTRL, 0);
-
- /* Enable the card */
- outw(BASE + EP_W0_CONFIG_CTRL, ENABLE_DRQ_IRQ);
-
- GO_WINDOW(2);
-
- /* Reload the ether_addr. */
- for (i = 0; i < 6; i++)
- outb(BASE + EP_W2_ADDR_0 + i, sc->arpcom.ac_enaddr[i]);
-
- outw(BASE + EP_COMMAND, RX_RESET);
- outw(BASE + EP_COMMAND, TX_RESET);
-
- /* Window 1 is operating window */
- GO_WINDOW(1);
- for (i = 0; i < 31; i++)
- inb(BASE + EP_W1_TX_STATUS);
-
- /* get rid of stray intr's */
- outw(BASE + EP_COMMAND, ACK_INTR | 0xff);
-
- outw(BASE + EP_COMMAND, SET_RD_0_MASK | S_5_INTS);
-
- outw(BASE + EP_COMMAND, SET_INTR_MASK | S_5_INTS);
-
- if(ifp->if_flags & IFF_PROMISC)
- outw(BASE + EP_COMMAND, SET_RX_FILTER | FIL_INDIVIDUAL |
- FIL_GROUP | FIL_BRDCST | FIL_ALL);
- else
- outw(BASE + EP_COMMAND, SET_RX_FILTER | FIL_INDIVIDUAL |
- FIL_GROUP | FIL_BRDCST);
-
- /*
- * S.B.
- *
- * Now behavior was slightly changed:
- *
- * if any of flags link[0-2] is used and its connector is
- * physically present the following connectors are used:
- *
- * link0 - AUI * highest precedence
- * link1 - BNC
- * link2 - UTP * lowest precedence
- *
- * If none of them is specified then
- * connector specified in the EEPROM is used
- * (if present on card or AUI if not).
- *
- */
-
- /* Set the xcvr. */
- if(ifp->if_flags & IFF_LINK0 && sc->ep_connectors & AUI) {
- i = ACF_CONNECTOR_AUI;
- } else if(ifp->if_flags & IFF_LINK1 && sc->ep_connectors & BNC) {
- i = ACF_CONNECTOR_BNC;
- } else if(ifp->if_flags & IFF_LINK2 && sc->ep_connectors & UTP) {
- i = ACF_CONNECTOR_UTP;
- } else {
- i = sc->ep_connector;
- }
- GO_WINDOW(0);
- j = inw(BASE + EP_W0_ADDRESS_CFG) & 0x3fff;
- outw(BASE + EP_W0_ADDRESS_CFG, j | (i << ACF_CONNECTOR_BITS));
-
- switch(i) {
- case ACF_CONNECTOR_UTP:
- if(sc->ep_connectors & UTP) {
- GO_WINDOW(4);
- outw(BASE + EP_W4_MEDIA_TYPE, ENABLE_UTP);
- }
- break;
- case ACF_CONNECTOR_BNC:
- if(sc->ep_connectors & BNC) {
- outw(BASE + EP_COMMAND, START_TRANSCEIVER);
- DELAY(1000);
- }
- break;
- case ACF_CONNECTOR_AUI:
- /* nothing to do */
- break;
- default:
- printf("ep%d: strange connector type in EEPROM: assuming AUI\n",
- sc->unit);
- break;
- }
-
- outw(BASE + EP_COMMAND, RX_ENABLE);
- outw(BASE + EP_COMMAND, TX_ENABLE);
-
- ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE; /* just in case */
-
- sc->tx_rate = TX_INIT_RATE;
- sc->tx_counter = 0;
- sc->rx_latency = RX_INIT_LATENCY;
- sc->rx_early_thresh = RX_INIT_EARLY_THRESH;
-#ifdef EP_LOCAL_STATS
- sc->rx_no_first = sc->rx_no_mbuf =
- sc->rx_bpf_disc = sc->rx_overrunf = sc->rx_overrunl =
- sc->tx_underrun = 0;
-#endif
- ep_fset(F_RX_FIRST);
- ep_frst(F_RX_TRAILER);
- if (sc->top) {
- m_freem(sc->top);
- sc->top = sc->mcur = 0;
- }
- outw(BASE + EP_COMMAND, SET_RX_EARLY_THRESH | sc->rx_early_thresh);
-
- /*
- * These clever computations look very interesting
- * but the fixed threshold gives near no output errors
- * and if it as low as 16 bytes it gives the max. throughput.
- * We think that processor is anyway quicker than Ethernet
- * (and this should be true for any 386 and higher)
- */
-
- outw(BASE + EP_COMMAND, SET_TX_START_THRESH | 16);
-
- /*
- * Store up a bunch of mbuf's for use later. (MAX_MBS). First we free up
- * any that we had in case we're being called from intr or somewhere
- * else.
- */
- sc->last_mb = 0;
- sc->next_mb = 0;
- epmbuffill((caddr_t) sc, 0);
-
- GO_WINDOW(1);
- epstart(ifp);
-
- splx(s);
-}
-
-static const char padmap[] = {0, 3, 2, 1};
-
-static void
-epstart(ifp)
- struct ifnet *ifp;
-{
- register struct ep_softc *sc = ifp->if_softc;
- register u_int len;
- register struct mbuf *m;
- struct mbuf *top;
- int s, pad;
-
- if (sc->gone) {
- return;
- }
-
- s = splimp();
- if (ifp->if_flags & IFF_OACTIVE) {
- splx(s);
- return;
- }
-startagain:
- /* Sneak a peek at the next packet */
- m = ifp->if_snd.ifq_head;
- if (m == 0) {
- splx(s);
- return;
- }
- for (len = 0, top = m; m; m = m->m_next)
- len += m->m_len;
-
- pad = padmap[len & 3];
-
- /*
- * The 3c509 automatically pads short packets to minimum ethernet length,
- * but we drop packets that are too large. Perhaps we should truncate
- * them instead?
- */
- if (len + pad > ETHER_MAX_LEN) {
- /* packet is obviously too large: toss it */
- ++ifp->if_oerrors;
- IF_DEQUEUE(&ifp->if_snd, m);
- m_freem(m);
- goto readcheck;
- }
- if (inw(BASE + EP_W1_FREE_TX) < len + pad + 4) {
- /* no room in FIFO */
- outw(BASE + EP_COMMAND, SET_TX_AVAIL_THRESH | (len + pad + 4));
- ifp->if_flags |= IFF_OACTIVE;
- splx(s);
- return;
- }
- IF_DEQUEUE(&ifp->if_snd, m);
-
- outw(BASE + EP_W1_TX_PIO_WR_1, len);
- outw(BASE + EP_W1_TX_PIO_WR_1, 0x0); /* Second dword meaningless */
-
- /* compute the Tx start threshold for this packet */
- sc->tx_start_thresh = len =
- (((len * (64 - sc->tx_rate)) >> 6) & ~3) + 16;
-#if 0
- /*
- * The following string does something strange with the card and
- * we get a lot of output errors due to it so it's commented out
- * and we use fixed threshold (see above)
- */
-
- outw(BASE + EP_COMMAND, SET_TX_START_THRESH | len);
-#endif
-
- for (top = m; m != 0; m = m->m_next)
- if(ep_ftst(F_ACCESS_32_BITS)) {
- outsl(BASE + EP_W1_TX_PIO_WR_1, mtod(m, caddr_t),
- m->m_len / 4);
- if (m->m_len & 3)
- outsb(BASE + EP_W1_TX_PIO_WR_1,
- mtod(m, caddr_t) + (m->m_len & (~3)),
- m->m_len & 3);
- } else {
- outsw(BASE + EP_W1_TX_PIO_WR_1, mtod(m, caddr_t), m->m_len / 2);
- if (m->m_len & 1)
- outb(BASE + EP_W1_TX_PIO_WR_1,
- *(mtod(m, caddr_t) + m->m_len - 1));
- }
-
- while (pad--)
- outb(BASE + EP_W1_TX_PIO_WR_1, 0); /* Padding */
-
-#if NBPFILTER > 0
- if (ifp->if_bpf) {
- bpf_mtap(ifp, top);
- }
-#endif
-
- ifp->if_timer=2;
- ifp->if_opackets++;
- m_freem(top);
- /*
- * Every 1024*4 packets we increment the tx_rate if we haven't had
- * errors, that in the case it has abnormaly goten too low
- */
- if (!(++sc->tx_counter & (1024 * 4 - 1)) &&
- sc->tx_rate < TX_INIT_MAX_RATE)
- sc->tx_rate++;
-
- /*
- * Is another packet coming in? We don't want to overflow the tiny RX
- * fifo.
- */
-readcheck:
- if (inw(BASE + EP_W1_RX_STATUS) & RX_BYTES_MASK) {
- /*
- * we check if we have packets left, in that case we prepare to come
- * back later
- */
- if (ifp->if_snd.ifq_head) {
- outw(BASE + EP_COMMAND, SET_TX_AVAIL_THRESH |
- sc->tx_start_thresh);
- }
- splx(s);
- return;
- }
- goto startagain;
-}
-
-void
-epintr(unit)
- int unit;
-{
- register struct ep_softc *sc = ep_softc[unit];
-
- if (sc->gone) {
- return;
- }
-
- ep_intr(sc);
-}
-
-void
-ep_intr(arg)
- void *arg;
-{
- struct ep_softc *sc;
- register int status;
- struct ifnet *ifp;
- int x;
-
- x=splbio();
-
- sc = (struct ep_softc *)arg;
-
- ifp = &sc->arpcom.ac_if;
-
- outw(BASE + EP_COMMAND, SET_INTR_MASK); /* disable all Ints */
-
-rescan:
-
- while ((status = inw(BASE + EP_STATUS)) & S_5_INTS) {
-
- /* first acknowledge all interrupt sources */
- outw(BASE + EP_COMMAND, ACK_INTR | (status & S_MASK));
-
- if (status & (S_RX_COMPLETE | S_RX_EARLY)) {
- epread(sc);
- continue;
- }
- if (status & S_TX_AVAIL) {
- /* we need ACK */
- ifp->if_timer=0;
- ifp->if_flags &= ~IFF_OACTIVE;
- GO_WINDOW(1);
- inw(BASE + EP_W1_FREE_TX);
- epstart(ifp);
- }
- if (status & S_CARD_FAILURE) {
- ifp->if_timer=0;
-#ifdef EP_LOCAL_STATS
- printf("\nep%d:\n\tStatus: %x\n", sc->unit, status);
- GO_WINDOW(4);
- printf("\tFIFO Diagnostic: %x\n", inw(BASE + EP_W4_FIFO_DIAG));
- printf("\tStat: %x\n", sc->stat);
- printf("\tIpackets=%d, Opackets=%d\n",
- ifp->if_ipackets, ifp->if_opackets);
- printf("\tNOF=%d, NOMB=%d, BPFD=%d, RXOF=%d, RXOL=%d, TXU=%d\n",
- sc->rx_no_first, sc->rx_no_mbuf, sc->rx_bpf_disc, sc->rx_overrunf,
- sc->rx_overrunl, sc->tx_underrun);
-#else
-
-#ifdef DIAGNOSTIC
- printf("ep%d: Status: %x (input buffer overflow)\n", sc->unit, status);
-#else
- ++ifp->if_ierrors;
-#endif
-
-#endif
- epinit(sc);
- splx(x);
- return;
- }
- if (status & S_TX_COMPLETE) {
- ifp->if_timer=0;
- /* we need ACK. we do it at the end */
- /*
- * We need to read TX_STATUS until we get a 0 status in order to
- * turn off the interrupt flag.
- */
- while ((status = inb(BASE + EP_W1_TX_STATUS)) & TXS_COMPLETE) {
- if (status & TXS_SUCCES_INTR_REQ);
- else if (status & (TXS_UNDERRUN | TXS_JABBER | TXS_MAX_COLLISION)) {
- outw(BASE + EP_COMMAND, TX_RESET);
- if (status & TXS_UNDERRUN) {
- if (sc->tx_rate > 1) {
- sc->tx_rate--; /* Actually in steps of 1/64 */
- sc->tx_counter = 0; /* We reset it */
- }
-#ifdef EP_LOCAL_STATS
- sc->tx_underrun++;
-#endif
- } else {
- if (status & TXS_JABBER);
- else /* TXS_MAX_COLLISION - we shouldn't get here */
- ++ifp->if_collisions;
- }
- ++ifp->if_oerrors;
- outw(BASE + EP_COMMAND, TX_ENABLE);
- /*
- * To have a tx_avail_int but giving the chance to the
- * Reception
- */
- if (ifp->if_snd.ifq_head) {
- outw(BASE + EP_COMMAND, SET_TX_AVAIL_THRESH | 8);
- }
- }
- outb(BASE + EP_W1_TX_STATUS, 0x0); /* pops up the next
- * status */
- } /* while */
- ifp->if_flags &= ~IFF_OACTIVE;
- GO_WINDOW(1);
- inw(BASE + EP_W1_FREE_TX);
- epstart(ifp);
- } /* end TX_COMPLETE */
- }
-
- outw(BASE + EP_COMMAND, C_INTR_LATCH); /* ACK int Latch */
-
- if ((status = inw(BASE + EP_STATUS)) & S_5_INTS)
- goto rescan;
-
- /* re-enable Ints */
- outw(BASE + EP_COMMAND, SET_INTR_MASK | S_5_INTS);
-
- splx(x);
-}
-
-static void
-epread(sc)
- register struct ep_softc *sc;
-{
- struct ether_header *eh;
- struct mbuf *top, *mcur, *m;
- struct ifnet *ifp;
- int lenthisone;
-
- short rx_fifo2, status;
- register short delta;
- register short rx_fifo;
-
- ifp = &sc->arpcom.ac_if;
- status = inw(BASE + EP_W1_RX_STATUS);
-
-read_again:
-
- if (status & ERR_RX) {
- ++ifp->if_ierrors;
- if (status & ERR_RX_OVERRUN) {
- /*
- * we can think the rx latency is actually greather than we
- * expect
- */
-#ifdef EP_LOCAL_STATS
- if (ep_ftst(F_RX_FIRST))
- sc->rx_overrunf++;
- else
- sc->rx_overrunl++;
-#endif
- if (sc->rx_latency < ETHERMTU)
- sc->rx_latency += 16;
- }
- goto out;
- }
- rx_fifo = rx_fifo2 = status & RX_BYTES_MASK;
-
- if (ep_ftst(F_RX_FIRST)) {
- if (m = sc->mb[sc->next_mb]) {
- sc->mb[sc->next_mb] = 0;
- sc->next_mb = (sc->next_mb + 1) % MAX_MBS;
- m->m_data = m->m_pktdat;
- m->m_flags = M_PKTHDR;
- } else {
- MGETHDR(m, M_DONTWAIT, MT_DATA);
- if (!m)
- goto out;
- }
- sc->top = sc->mcur = top = m;
-#define EROUND ((sizeof(struct ether_header) + 3) & ~3)
-#define EOFF (EROUND - sizeof(struct ether_header))
- top->m_data += EOFF;
-
- /* Read what should be the header. */
- insw(BASE + EP_W1_RX_PIO_RD_1,
- mtod(top, caddr_t), sizeof(struct ether_header) / 2);
- top->m_len = sizeof(struct ether_header);
- rx_fifo -= sizeof(struct ether_header);
- sc->cur_len = rx_fifo2;
- } else {
- /* come here if we didn't have a complete packet last time */
- top = sc->top;
- m = sc->mcur;
- sc->cur_len += rx_fifo2;
- if (ep_ftst(F_RX_TRAILER))
- /* We don't read the trailer */
- rx_fifo -= sizeof(struct ether_header);
- }
-
- /* Reads what is left in the RX FIFO */
- while (rx_fifo > 0) {
- lenthisone = min(rx_fifo, M_TRAILINGSPACE(m));
- if (lenthisone == 0) { /* no room in this one */
- mcur = m;
- if (m = sc->mb[sc->next_mb]) {
- sc->mb[sc->next_mb] = 0;
- sc->next_mb = (sc->next_mb + 1) % MAX_MBS;
- } else {
- MGET(m, M_DONTWAIT, MT_DATA);
- if (!m)
- goto out;
- }
-
- if (rx_fifo >= MINCLSIZE)
- MCLGET(m, M_DONTWAIT);
- m->m_len = 0;
- mcur->m_next = m;
- lenthisone = min(rx_fifo, M_TRAILINGSPACE(m));
- }
- if (ep_ftst(F_ACCESS_32_BITS)) { /* default for EISA configured cards*/
- insl(BASE + EP_W1_RX_PIO_RD_1, mtod(m, caddr_t) + m->m_len,
- lenthisone / 4);
- m->m_len += (lenthisone & ~3);
- if (lenthisone & 3)
- insb(BASE + EP_W1_RX_PIO_RD_1,
- mtod(m, caddr_t) + m->m_len,
- lenthisone & 3);
- m->m_len += (lenthisone & 3);
- } else {
- insw(BASE + EP_W1_RX_PIO_RD_1, mtod(m, caddr_t) + m->m_len,
- lenthisone / 2);
- m->m_len += lenthisone;
- if (lenthisone & 1)
- *(mtod(m, caddr_t) + m->m_len - 1) = inb(BASE + EP_W1_RX_PIO_RD_1);
- }
- rx_fifo -= lenthisone;
- }
-
- if (ep_ftst(F_RX_TRAILER)) {/* reads the trailer */
- if (m = sc->mb[sc->next_mb]) {
- sc->mb[sc->next_mb] = 0;
- sc->next_mb = (sc->next_mb + 1) % MAX_MBS;
- m->m_data = m->m_pktdat;
- m->m_flags = M_PKTHDR;
- } else {
- MGETHDR(m, M_DONTWAIT, MT_DATA);
- if (!m)
- goto out;
- }
- insw(BASE + EP_W1_RX_PIO_RD_1, mtod(m, caddr_t),
- sizeof(struct ether_header));
- m->m_len = sizeof(struct ether_header);
- m->m_next = top;
- sc->top = top = m;
- /* XXX Accomodate for type and len from beginning of trailer */
- sc->cur_len -= (2 * sizeof(u_short));
- ep_frst(F_RX_TRAILER);
- goto all_pkt;
- }
-
- if (status & ERR_RX_INCOMPLETE) { /* we haven't received the complete
- * packet */
- sc->mcur = m;
-#ifdef EP_LOCAL_STATS
- sc->rx_no_first++; /* to know how often we come here */
-#endif
- /*
- * Re-compute rx_latency, the factor used is 1/4 to go up and 1/32 to
- * go down
- */
- delta = rx_fifo2 - sc->rx_early_thresh; /* last latency seen LLS */
- delta -= sc->rx_latency;/* LLS - estimated_latency */
- if (delta >= 0)
- sc->rx_latency += (delta / 4);
- else
- sc->rx_latency += (delta / 32);
- ep_frst(F_RX_FIRST);
- if (!((status = inw(BASE + EP_W1_RX_STATUS)) & ERR_RX_INCOMPLETE)) {
- /* we see if by now, the packet has completly arrived */
- goto read_again;
- }
- /* compute rx_early_threshold */
- delta = (sc->rx_avg_pkt - sc->cur_len - sc->rx_latency - 16) & ~3;
- if (delta < MIN_RX_EARLY_THRESHL)
- delta = MIN_RX_EARLY_THRESHL;
-
- outw(BASE + EP_COMMAND, SET_RX_EARLY_THRESH |
- (sc->rx_early_thresh = delta));
- return;
- }
-all_pkt:
- outw(BASE + EP_COMMAND, RX_DISCARD_TOP_PACK);
- /*
- * recompute average packet's length, the factor used is 1/8 to go down
- * and 1/32 to go up
- */
- delta = sc->cur_len - sc->rx_avg_pkt;
- if (delta > 0)
- sc->rx_avg_pkt += (delta / 32);
- else
- sc->rx_avg_pkt += (delta / 8);
- delta = (sc->rx_avg_pkt - sc->rx_latency - 16) & ~3;
- if (delta < MIN_RX_EARLY_THRESHF)
- delta = MIN_RX_EARLY_THRESHF;
- sc->rx_early_thresh = delta;
- ++ifp->if_ipackets;
- ep_fset(F_RX_FIRST);
- ep_frst(F_RX_TRAILER);
- top->m_pkthdr.rcvif = &sc->arpcom.ac_if;
- top->m_pkthdr.len = sc->cur_len;
-
-#if NBPFILTER > 0
- if (ifp->if_bpf) {
- bpf_mtap(ifp, top);
-
- /*
- * Note that the interface cannot be in promiscuous mode if there are
- * no BPF listeners. And if we are in promiscuous mode, we have to
- * check if this packet is really ours.
- */
- eh = mtod(top, struct ether_header *);
- if ((ifp->if_flags & IFF_PROMISC) &&
- (eh->ether_dhost[0] & 1) == 0 &&
- bcmp(eh->ether_dhost, sc->arpcom.ac_enaddr,
- sizeof(eh->ether_dhost)) != 0 &&
- bcmp(eh->ether_dhost, etherbroadcastaddr,
- sizeof(eh->ether_dhost)) != 0) {
- if (sc->top) {
- m_freem(sc->top);
- sc->top = 0;
- }
- ep_fset(F_RX_FIRST);
- ep_frst(F_RX_TRAILER);
-#ifdef EP_LOCAL_STATS
- sc->rx_bpf_disc++;
-#endif
- while (inw(BASE + EP_STATUS) & S_COMMAND_IN_PROGRESS);
- outw(BASE + EP_COMMAND, SET_RX_EARLY_THRESH | delta);
- return;
- }
- }
-#endif
-
- eh = mtod(top, struct ether_header *);
- m_adj(top, sizeof(struct ether_header));
- ether_input(ifp, eh, top);
- if (!sc->mb[sc->next_mb])
- epmbuffill((caddr_t) sc, 0);
- sc->top = 0;
- while (inw(BASE + EP_STATUS) & S_COMMAND_IN_PROGRESS);
- outw(BASE + EP_COMMAND, SET_RX_EARLY_THRESH | delta);
- return;
-
-out:
- outw(BASE + EP_COMMAND, RX_DISCARD_TOP_PACK);
- if (sc->top) {
- m_freem(sc->top);
- sc->top = 0;
-#ifdef EP_LOCAL_STATS
- sc->rx_no_mbuf++;
-#endif
- }
- delta = (sc->rx_avg_pkt - sc->rx_latency - 16) & ~3;
- if (delta < MIN_RX_EARLY_THRESHF)
- delta = MIN_RX_EARLY_THRESHF;
- ep_fset(F_RX_FIRST);
- ep_frst(F_RX_TRAILER);
- while (inw(BASE + EP_STATUS) & S_COMMAND_IN_PROGRESS);
- outw(BASE + EP_COMMAND, SET_RX_EARLY_THRESH |
- (sc->rx_early_thresh = delta));
-}
-
-/*
- * Look familiar?
- */
-static int
-epioctl(ifp, cmd, data)
- register struct ifnet *ifp;
- int cmd;
- caddr_t data;
-{
- register struct ifaddr *ifa = (struct ifaddr *) data;
- struct ep_softc *sc = ifp->if_softc;
- struct ifreq *ifr = (struct ifreq *) data;
- int s, error = 0;
-
- s = splimp();
-
- switch (cmd) {
- case SIOCSIFADDR:
- ifp->if_flags |= IFF_UP;
-
- /* netifs are BUSY when UP */
- sc->kdc->kdc_state=DC_BUSY;
-
- switch (ifa->ifa_addr->sa_family) {
-#ifdef INET
- case AF_INET:
- epinit(sc); /* before arpwhohas */
- arp_ifinit((struct arpcom *)ifp, ifa);
- break;
-#endif
-#ifdef IPX
- case AF_IPX:
- {
- register struct ipx_addr *ina = &(IA_SIPX(ifa)->sipx_addr);
-
- if (ipx_nullhost(*ina))
- ina->x_host =
- *(union ipx_host *) (sc->arpcom.ac_enaddr);
- else {
- ifp->if_flags &= ~IFF_RUNNING;
- bcopy((caddr_t) ina->x_host.c_host,
- (caddr_t) sc->arpcom.ac_enaddr,
- sizeof(sc->arpcom.ac_enaddr));
- }
- epinit(sc);
- break;
- }
-#endif
-#ifdef NS
- case AF_NS:
- {
- register struct ns_addr *ina = &(IA_SNS(ifa)->sns_addr);
-
- if (ns_nullhost(*ina))
- ina->x_host =
- *(union ns_host *) (sc->arpcom.ac_enaddr);
- else {
- ifp->if_flags &= ~IFF_RUNNING;
- bcopy((caddr_t) ina->x_host.c_host,
- (caddr_t) sc->arpcom.ac_enaddr,
- sizeof(sc->arpcom.ac_enaddr));
- }
- epinit(sc);
- break;
- }
-#endif
- default:
- epinit(sc);
- break;
- }
- break;
- case SIOCGIFADDR:
- {
- struct sockaddr *sa;
-
- sa = (struct sockaddr *) & ifr->ifr_data;
- bcopy((caddr_t) sc->arpcom.ac_enaddr,
- (caddr_t) sa->sa_data, ETHER_ADDR_LEN);
- }
- break;
- case SIOCSIFFLAGS:
- /* UP controls BUSY/IDLE */
- sc->kdc->kdc_state= ( (ifp->if_flags & IFF_UP)
- ? DC_BUSY
- : DC_IDLE );
-
- if ((ifp->if_flags & IFF_UP) == 0 && ifp->if_flags & IFF_RUNNING) {
- ifp->if_flags &= ~IFF_RUNNING;
- epstop(sc);
- epmbufempty(sc);
- break;
- } else {
- /* reinitialize card on any parameter change */
- epinit(sc);
- break;
- }
-
- /* NOTREACHED */
- break;
-#ifdef notdef
- case SIOCGHWADDR:
- bcopy((caddr_t) sc->sc_addr, (caddr_t) & ifr->ifr_data,
- sizeof(sc->sc_addr));
- break;
-#endif
- case SIOCSIFMTU:
-
- /*
- * Set the interface MTU.
- */
- if (ifr->ifr_mtu > ETHERMTU) {
- error = EINVAL;
- } else {
- ifp->if_mtu = ifr->ifr_mtu;
- }
- break;
- case SIOCADDMULTI:
- case SIOCDELMULTI:
- /* Now this driver has no support for programmable
- * multicast filters. If some day it will gain this
- * support this part of code must be extended.
- */
- error=0;
- break;
- default:
- error = EINVAL;
- }
-
- splx(s);
-
- return (error);
-}
-
-static void
-epwatchdog(ifp)
- struct ifnet *ifp;
-{
- struct ep_softc *sc = ifp->if_softc;
-
- /*
- printf("ep: watchdog\n");
-
- log(LOG_ERR, "ep%d: watchdog\n", ifp->if_unit);
- ifp->if_oerrors++;
- */
-
- if (sc->gone) {
- return;
- }
-
- ifp->if_flags &= ~IFF_OACTIVE;
- epstart(ifp);
- ep_intr(ifp->if_softc);
-}
-
-static void
-epstop(sc)
- struct ep_softc *sc;
-{
- if (sc->gone) {
- return;
- }
-
- outw(BASE + EP_COMMAND, RX_DISABLE);
- outw(BASE + EP_COMMAND, RX_DISCARD_TOP_PACK);
- while (inw(BASE + EP_STATUS) & S_COMMAND_IN_PROGRESS);
- outw(BASE + EP_COMMAND, TX_DISABLE);
- outw(BASE + EP_COMMAND, STOP_TRANSCEIVER);
- outw(BASE + EP_COMMAND, RX_RESET);
- outw(BASE + EP_COMMAND, TX_RESET);
- outw(BASE + EP_COMMAND, C_INTR_LATCH);
- outw(BASE + EP_COMMAND, SET_RD_0_MASK);
- outw(BASE + EP_COMMAND, SET_INTR_MASK);
- outw(BASE + EP_COMMAND, SET_RX_FILTER);
-}
-
-
-#if 0
-static int
-send_ID_sequence(port)
- int port;
-{
- int cx, al;
-
- for (al = 0xff, cx = 0; cx < 255; cx++) {
- outb(port, al);
- al <<= 1;
- if (al & 0x100)
- al ^= 0xcf;
- }
- return (1);
-}
-#endif
-
-
-/*
- * We get eeprom data from the id_port given an offset into the eeprom.
- * Basically; after the ID_sequence is sent to all of the cards; they enter
- * the ID_CMD state where they will accept command requests. 0x80-0xbf loads
- * the eeprom data. We then read the port 16 times and with every read; the
- * cards check for contention (ie: if one card writes a 0 bit and another
- * writes a 1 bit then the host sees a 0. At the end of the cycle; each card
- * compares the data on the bus; if there is a difference then that card goes
- * into ID_WAIT state again). In the meantime; one bit of data is returned in
- * the AX register which is conveniently returned to us by inb(). Hence; we
- * read 16 times getting one bit of data with each read.
- */
-static int
-get_eeprom_data(id_port, offset)
- int id_port;
- int offset;
-{
- int i, data = 0;
- outb(id_port, 0x80 + offset);
- DELAY(1000);
- for (i = 0; i < 16; i++)
- data = (data << 1) | (inw(id_port) & 1);
- return (data);
-}
-
-/*
- * We suppose this is always called inside a splimp(){...}splx() region
- */
-static void
-epmbuffill(sp, dummy_arg)
- caddr_t sp;
- int dummy_arg;
-{
- struct ep_softc *sc = (struct ep_softc *) sp;
- int i;
-
- i = sc->last_mb;
- do {
- if (sc->mb[i] == NULL)
- MGET(sc->mb[i], M_DONTWAIT, MT_DATA);
- if (sc->mb[i] == NULL)
- break;
- i = (i + 1) % MAX_MBS;
- } while (i != sc->next_mb);
- sc->last_mb = i;
-}
-
-static void
-epmbufempty(sc)
- struct ep_softc *sc;
-{
- int s, i;
-
- s = splimp();
- for (i = 0; i < MAX_MBS; i++) {
- if (sc->mb[i]) {
- m_freem(sc->mb[i]);
- sc->mb[i] = NULL;
- }
- }
- sc->last_mb = sc->next_mb = 0;
- splx(s);
-}
-
-#endif /* NEP > 0 */
diff --git a/sys/pc98/pc98/if_epreg.h b/sys/pc98/pc98/if_epreg.h
deleted file mode 100644
index d27f1b6..0000000
--- a/sys/pc98/pc98/if_epreg.h
+++ /dev/null
@@ -1,464 +0,0 @@
-/*
- * Copyright (c) 1993 Herb Peyerl (hpeyerl@novatel.ca) All rights reserved.
- *
- * 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. The name
- * of the author may not be used to endorse or promote products derived from
- * this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
- *
- * if_epreg.h,v 1.4 1994/11/13 10:12:37 gibbs Exp Modified by:
- *
- October 2, 1994
-
- Modified by: Andres Vega Garcia
-
- INRIA - Sophia Antipolis, France
- e-mail: avega@sophia.inria.fr
- finger: avega@pax.inria.fr
-
- */
-/*
- * $Id: if_epreg.h,v 1.2 1996/07/23 07:46:18 asami Exp $
- *
- * Promiscuous mode added and interrupt logic slightly changed
- * to reduce the number of adapter failures. Transceiver select
- * logic changed to use value from EEPROM. Autoconfiguration
- * features added.
- * Done by:
- * Serge Babkin
- * Chelindbank (Chelyabinsk, Russia)
- * babkin@hq.icb.chel.su
- */
-
-/*
- * Pccard support for 3C589 by:
- * HAMADA Naoki
- * nao@tom-yam.or.jp
- */
-
-/*
- * Ethernet software status per interface.
- */
-struct ep_softc {
- struct arpcom arpcom; /* Ethernet common part */
- short ep_io_addr; /* i/o bus address */
-#define MAX_MBS 8 /* # of mbufs we keep around */
- struct mbuf *mb[MAX_MBS]; /* spare mbuf storage. */
- int next_mb; /* Which mbuf to use next. */
- int last_mb; /* Last mbuf. */
- struct mbuf *top, *mcur;
- short tx_start_thresh; /* Current TX_start_thresh. */
- short tx_rate;
- short tx_counter;
- short rx_early_thresh; /* Current RX_early_thresh. */
- short rx_latency;
- short rx_avg_pkt;
- short cur_len;
- u_short ep_connectors; /* Connectors on this card. */
- u_char ep_connector; /* Configured connector. */
- int stat; /* some flags */
- int gone; /* adapter is not present (for PCCARD) */
-#define F_RX_FIRST 0x1
-#define F_WAIT_TRAIL 0x2
-#define F_RX_TRAILER 0x4
-#define F_PROMISC 0x8
-
-#define F_ACCESS_32_BITS 0x100
-
- struct ep_board *epb;
-
- int unit;
-
- struct kern_devconf* kdc;
-
-#ifdef EP_LOCAL_STATS
- short tx_underrun;
- short rx_no_first;
- short rx_no_mbuf;
- short rx_bpf_disc;
- short rx_overrunf;
- short rx_overrunl;
-#endif
-};
-
-struct ep_board {
- int epb_addr; /* address of this board */
- char epb_used; /* was this entry already used for configuring ? */
- /* data from EEPROM for later use */
- u_short eth_addr[3]; /* Ethernet address */
- u_short prod_id; /* product ID */
- u_short res_cfg; /* resource configuration */
-};
-
-
-/*
- * Some global constants
- */
-#define TX_INIT_RATE 16
-#define TX_INIT_MAX_RATE 64
-#define RX_INIT_LATENCY 64
-#define RX_INIT_EARLY_THRESH 64
-#define MIN_RX_EARLY_THRESHF 16 /* not less than ether_header */
-#define MIN_RX_EARLY_THRESHL 4
-
-#define EEPROMSIZE 0x40
-#define MAX_EEPROMBUSY 1000
-#define EP_LAST_TAG 0xd7
-#define EP_MAX_BOARDS 16
-#define EP_ID_PORT 0x100
-#define EP_IOSIZE 16 /* 16 bytes of I/O space used. */
-
-/*
- * some macros to acces long named fields
- */
-#define IS_BASE (is->id_iobase)
-#define BASE (sc->ep_io_addr)
-
-/*
- * Commands to read/write EEPROM trough EEPROM command register (Window 0,
- * Offset 0xa)
- */
-#define EEPROM_CMD_RD 0x0080 /* Read: Address required (5 bits) */
-#define EEPROM_CMD_WR 0x0040 /* Write: Address required (5 bits) */
-#define EEPROM_CMD_ERASE 0x00c0 /* Erase: Address required (5 bits) */
-#define EEPROM_CMD_EWEN 0x0030 /* Erase/Write Enable: No data required */
-
-#define EEPROM_BUSY (1<<15)
-#define EEPROM_TST_MODE (1<<14)
-
-/*
- * Some short functions, worth to let them be a macro
- */
-#define is_eeprom_busy(b) (inw((b)+EP_W0_EEPROM_COMMAND)&EEPROM_BUSY)
-#define GO_WINDOW(x) outw(BASE+EP_COMMAND, WINDOW_SELECT|(x))
-
-/**************************************************************************
- * *
- * These define the EEPROM data structure. They are used in the probe
- * function to verify the existence of the adapter after having sent
- * the ID_Sequence.
- *
- * There are others but only the ones we use are defined here.
- *
- **************************************************************************/
-
-#define EEPROM_NODE_ADDR_0 0x0 /* Word */
-#define EEPROM_NODE_ADDR_1 0x1 /* Word */
-#define EEPROM_NODE_ADDR_2 0x2 /* Word */
-#define EEPROM_PROD_ID 0x3 /* 0x9[0-f]50 */
-#define EEPROM_MFG_ID 0x7 /* 0x6d50 */
-#define EEPROM_ADDR_CFG 0x8 /* Base addr */
-#define EEPROM_RESOURCE_CFG 0x9 /* IRQ. Bits 12-15 */
-
-/**************************************************************************
- * *
- * These are the registers for the 3Com 3c509 and their bit patterns when *
- * applicable. They have been taken out the the "EtherLink III Parallel *
- * Tasking EISA and ISA Technical Reference" "Beta Draft 10/30/92" manual *
- * from 3com. *
- * *
- **************************************************************************/
-
-#define EP_COMMAND 0x0e /* Write. BASE+0x0e is always a
- * command reg. */
-#define EP_STATUS 0x0e /* Read. BASE+0x0e is always status
- * reg. */
-#define EP_WINDOW 0x0f /* Read. BASE+0x0f is always window
- * reg. */
-/*
- * Window 0 registers. Setup.
- */
-/* Write */
-#define EP_W0_EEPROM_DATA 0x0c
-#define EP_W0_EEPROM_COMMAND 0x0a
-#define EP_W0_RESOURCE_CFG 0x08
-#define EP_W0_ADDRESS_CFG 0x06
-#define EP_W0_CONFIG_CTRL 0x04
-/* Read */
-#define EP_W0_PRODUCT_ID 0x02
-#define EP_W0_MFG_ID 0x00
-
-/*
- * Window 1 registers. Operating Set.
- */
-/* Write */
-#define EP_W1_TX_PIO_WR_2 0x02
-#define EP_W1_TX_PIO_WR_1 0x00
-/* Read */
-#define EP_W1_FREE_TX 0x0c
-#define EP_W1_TX_STATUS 0x0b /* byte */
-#define EP_W1_TIMER 0x0a /* byte */
-#define EP_W1_RX_STATUS 0x08
-#define EP_W1_RX_PIO_RD_2 0x02
-#define EP_W1_RX_PIO_RD_1 0x00
-
-/*
- * Window 2 registers. Station Address Setup/Read
- */
-/* Read/Write */
-#define EP_W2_ADDR_5 0x05
-#define EP_W2_ADDR_4 0x04
-#define EP_W2_ADDR_3 0x03
-#define EP_W2_ADDR_2 0x02
-#define EP_W2_ADDR_1 0x01
-#define EP_W2_ADDR_0 0x00
-
-/*
- * Window 3 registers. FIFO Management.
- */
-/* Read */
-#define EP_W3_FREE_TX 0x0c
-#define EP_W3_FREE_RX 0x0a
-
-/*
- * Window 4 registers. Diagnostics.
- */
-/* Read/Write */
-#define EP_W4_MEDIA_TYPE 0x0a
-#define EP_W4_CTRLR_STATUS 0x08
-#define EP_W4_NET_DIAG 0x06
-#define EP_W4_FIFO_DIAG 0x04
-#define EP_W4_HOST_DIAG 0x02
-#define EP_W4_TX_DIAG 0x00
-
-/*
- * Window 5 Registers. Results and Internal status.
- */
-/* Read */
-#define EP_W5_READ_0_MASK 0x0c
-#define EP_W5_INTR_MASK 0x0a
-#define EP_W5_RX_FILTER 0x08
-#define EP_W5_RX_EARLY_THRESH 0x06
-#define EP_W5_TX_AVAIL_THRESH 0x02
-#define EP_W5_TX_START_THRESH 0x00
-
-/*
- * Window 6 registers. Statistics.
- */
-/* Read/Write */
-#define TX_TOTAL_OK 0x0c
-#define RX_TOTAL_OK 0x0a
-#define TX_DEFERRALS 0x08
-#define RX_FRAMES_OK 0x07
-#define TX_FRAMES_OK 0x06
-#define RX_OVERRUNS 0x05
-#define TX_COLLISIONS 0x04
-#define TX_AFTER_1_COLLISION 0x03
-#define TX_AFTER_X_COLLISIONS 0x02
-#define TX_NO_SQE 0x01
-#define TX_CD_LOST 0x00
-
-/****************************************
- *
- * Register definitions.
- *
- ****************************************/
-
-/*
- * Command register. All windows.
- *
- * 16 bit register.
- * 15-11: 5-bit code for command to be executed.
- * 10-0: 11-bit arg if any. For commands with no args;
- * this can be set to anything.
- */
-#define GLOBAL_RESET (u_short) 0x0000 /* Wait at least 1ms
- * after issuing */
-#define WINDOW_SELECT (u_short) (0x1<<11)
-#define START_TRANSCEIVER (u_short) (0x2<<11) /* Read ADDR_CFG reg to
- * determine whether
- * this is needed. If
- * so; wait 800 uSec
- * before using trans-
- * ceiver. */
-#define RX_DISABLE (u_short) (0x3<<11) /* state disabled on
- * power-up */
-#define RX_ENABLE (u_short) (0x4<<11)
-#define RX_RESET (u_short) (0x5<<11)
-#define RX_DISCARD_TOP_PACK (u_short) (0x8<<11)
-#define TX_ENABLE (u_short) (0x9<<11)
-#define TX_DISABLE (u_short) (0xa<<11)
-#define TX_RESET (u_short) (0xb<<11)
-#define REQ_INTR (u_short) (0xc<<11)
-#define SET_INTR_MASK (u_short) (0xe<<11)
-#define SET_RD_0_MASK (u_short) (0xf<<11)
-#define SET_RX_FILTER (u_short) (0x10<<11)
-#define FIL_INDIVIDUAL (u_short) (0x1)
-#define FIL_GROUP (u_short) (0x2)
-#define FIL_BRDCST (u_short) (0x4)
-#define FIL_ALL (u_short) (0x8)
-#define SET_RX_EARLY_THRESH (u_short) (0x11<<11)
-#define SET_TX_AVAIL_THRESH (u_short) (0x12<<11)
-#define SET_TX_START_THRESH (u_short) (0x13<<11)
-#define STATS_ENABLE (u_short) (0x15<<11)
-#define STATS_DISABLE (u_short) (0x16<<11)
-#define STOP_TRANSCEIVER (u_short) (0x17<<11)
-/*
- * The following C_* acknowledge the various interrupts. Some of them don't
- * do anything. See the manual.
- */
-#define ACK_INTR (u_short) (0x6800)
-#define C_INTR_LATCH (u_short) (ACK_INTR|0x1)
-#define C_CARD_FAILURE (u_short) (ACK_INTR|0x2)
-#define C_TX_COMPLETE (u_short) (ACK_INTR|0x4)
-#define C_TX_AVAIL (u_short) (ACK_INTR|0x8)
-#define C_RX_COMPLETE (u_short) (ACK_INTR|0x10)
-#define C_RX_EARLY (u_short) (ACK_INTR|0x20)
-#define C_INT_RQD (u_short) (ACK_INTR|0x40)
-#define C_UPD_STATS (u_short) (ACK_INTR|0x80)
-#define C_MASK (u_short) 0xFF /* mask of C_* */
-
-/*
- * Status register. All windows.
- *
- * 15-13: Window number(0-7).
- * 12: Command_in_progress.
- * 11: reserved.
- * 10: reserved.
- * 9: reserved.
- * 8: reserved.
- * 7: Update Statistics.
- * 6: Interrupt Requested.
- * 5: RX Early.
- * 4: RX Complete.
- * 3: TX Available.
- * 2: TX Complete.
- * 1: Adapter Failure.
- * 0: Interrupt Latch.
- */
-#define S_INTR_LATCH (u_short) (0x1)
-#define S_CARD_FAILURE (u_short) (0x2)
-#define S_TX_COMPLETE (u_short) (0x4)
-#define S_TX_AVAIL (u_short) (0x8)
-#define S_RX_COMPLETE (u_short) (0x10)
-#define S_RX_EARLY (u_short) (0x20)
-#define S_INT_RQD (u_short) (0x40)
-#define S_UPD_STATS (u_short) (0x80)
-#define S_MASK (u_short) 0xFF /* mask of S_* */
-#define S_5_INTS (S_CARD_FAILURE|S_TX_COMPLETE|\
- S_TX_AVAIL|S_RX_COMPLETE|S_RX_EARLY)
-#define S_COMMAND_IN_PROGRESS (u_short) (0x1000)
-
-/* Address Config. Register.
- * Window 0/Port 06
- */
-
-#define ACF_CONNECTOR_BITS 14
-#define ACF_CONNECTOR_UTP 0
-#define ACF_CONNECTOR_AUI 1
-#define ACF_CONNECTOR_BNC 3
-
-/* Resource configuration register.
- * Window 0/Port 08
- *
- */
-
-#define SET_IRQ(base,irq) outw((base) + EP_W0_RESOURCE_CFG, \
- ((inw((base) + EP_W0_RESOURCE_CFG) & 0x0fff) | \
- ((u_short)(irq)<<12)) ) /* set IRQ i */
-
-/*
- * FIFO Registers.
- * RX Status. Window 1/Port 08
- *
- * 15: Incomplete or FIFO empty.
- * 14: 1: Error in RX Packet 0: Incomplete or no error.
- * 13-11: Type of error.
- * 1000 = Overrun.
- * 1011 = Run Packet Error.
- * 1100 = Alignment Error.
- * 1101 = CRC Error.
- * 1001 = Oversize Packet Error (>1514 bytes)
- * 0010 = Dribble Bits.
- * (all other error codes, no errors.)
- *
- * 10-0: RX Bytes (0-1514)
- */
-#define ERR_RX_INCOMPLETE (u_short) (0x1<<15)
-#define ERR_RX (u_short) (0x1<<14)
-#define ERR_RX_OVERRUN (u_short) (0x8<<11)
-#define ERR_RX_RUN_PKT (u_short) (0xb<<11)
-#define ERR_RX_ALIGN (u_short) (0xc<<11)
-#define ERR_RX_CRC (u_short) (0xd<<11)
-#define ERR_RX_OVERSIZE (u_short) (0x9<<11)
-#define ERR_RX_DRIBBLE (u_short) (0x2<<11)
-
-/*
- * FIFO Registers.
- * TX Status. Window 1/Port 0B
- *
- * Reports the transmit status of a completed transmission. Writing this
- * register pops the transmit completion stack.
- *
- * Window 1/Port 0x0b.
- *
- * 7: Complete
- * 6: Interrupt on successful transmission requested.
- * 5: Jabber Error (TP Only, TX Reset required. )
- * 4: Underrun (TX Reset required. )
- * 3: Maximum Collisions.
- * 2: TX Status Overflow.
- * 1-0: Undefined.
- *
- */
-#define TXS_COMPLETE 0x80
-#define TXS_SUCCES_INTR_REQ 0x40
-#define TXS_JABBER 0x20
-#define TXS_UNDERRUN 0x10
-#define TXS_MAX_COLLISION 0x8
-#define TXS_STATUS_OVERFLOW 0x4
-
-/*
- * Configuration control register.
- * Window 0/Port 04
- */
-/* Read */
-#define IS_AUI (1<<13)
-#define IS_BNC (1<<12)
-#define IS_UTP (1<<9)
-/* Write */
-#define ENABLE_DRQ_IRQ 0x0001
-#define W0_P4_CMD_RESET_ADAPTER 0x4
-#define W0_P4_CMD_ENABLE_ADAPTER 0x1
-/*
- * Media type and status.
- * Window 4/Port 0A
- */
-#define ENABLE_UTP 0xc0
-#define DISABLE_UTP 0x0
-
-/*
- * Misc defines for various things.
- */
-#define ACTIVATE_ADAPTER_TO_CONFIG 0xff /* to the id_port */
-#define MFG_ID 0x6d50 /* in EEPROM and W0 ADDR_CONFIG */
-#define PROD_ID 0x9150
-
-#define AUI 0x1
-#define BNC 0x2
-#define UTP 0x4
-
-#define RX_BYTES_MASK (u_short) (0x07ff)
-
-extern struct ep_board ep_board[];
-extern int ep_boards;
-extern u_long ep_unit;
-extern struct ep_softc *ep_alloc __P((int unit, struct ep_board *epb));
-extern void ep_free __P((struct ep_softc *sc));
-extern void ep_intr __P((void *sc));
-extern int ep_attach __P((struct ep_softc *sc));
-
-extern u_int16_t get_e __P((struct ep_softc *sc, int offset));
diff --git a/sys/pc98/pc98/if_fe.c b/sys/pc98/pc98/if_fe.c
index 5f911f0..690849c 100644
--- a/sys/pc98/pc98/if_fe.c
+++ b/sys/pc98/pc98/if_fe.c
@@ -21,7 +21,7 @@
*/
/*
- * $Id: if_fe.c,v 1.3 1996/08/30 10:43:02 asami Exp $
+ * $Id: if_fe.c,v 1.4 1996/08/31 15:06:55 asami Exp $
*
* Device driver for Fujitsu MB86960A/MB86965A based Ethernet cards.
* To be used with FreeBSD 2.x
@@ -127,11 +127,10 @@
#include <machine/clock.h>
+#include <i386/isa/isa_device.h>
#ifdef PC98
-#include <pc98/pc98/pc98_device.h>
#include <pc98/pc98/icu.h>
#else
-#include <i386/isa/isa_device.h>
#include <i386/isa/icu.h>
#endif
@@ -305,15 +304,9 @@ struct isa_driver fedriver =
static struct kern_devconf const fe_kdc_template =
{
0, 0, 0,
-#ifdef PC98
- "fe", 0, { MDDT_PC98, 0, "net" },
- pc98_generic_externalize, 0, 0, PC98_EXTERNALLEN,
- &kdc_nec0, /* This is an ISA device. */
-#else
"fe", 0, { MDDT_ISA, 0, "net" },
isa_generic_externalize, 0, 0, ISA_EXTERNALLEN,
&kdc_isa0, /* This is an ISA device. */
-#endif
0,
DC_UNCONFIGURED, /* Not yet configured. */
"Ethernet (MB8696x)", /* Tentative description (filled in later.) */
diff --git a/sys/pc98/pc98/if_zp.c b/sys/pc98/pc98/if_zp.c
deleted file mode 100644
index 568ccf8..0000000
--- a/sys/pc98/pc98/if_zp.c
+++ /dev/null
@@ -1,1163 +0,0 @@
-/*
- * This code is based on
- * (1) FreeBSD implementation on ISA/EISA Ethelink III by Herb Peyerl
- * (2) Linux implementation on PCMCIA Etherlink III by Devid Hinds
- * (3) FreeBSD implementation on PCMCIA IBM Ethernet Card I/II
- * by David Greenman
- * (4) RT-Mach implementation on PCMCIA/ISA/EISA Etherlink III
- * by Seiji Murata
- *
- * Copyright (c) by HOSOKAWA, Tatsumi <hosokawa@mt.cs.keio.ac.jp>
- * Copyright (c) by Seiji Murata <seiji@mt.cs.keio.ac.jp>
- */
-/*
- * Copyright (c) 1993 Herb Peyerl <hpeyerl@novatel.ca>
- * All rights reserved.
- *
- * 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. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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: if_ep.c,v 1.9 1994/01/25 10:46:29 deraadt Exp $
- * $Id: if_zp.c,v 1.3 1996/08/30 10:43:03 asami Exp $
- */
-/*-
- * TODO:
- * [1] integrate into current if_ed.c
- * [2] parse tuples to find out where to map the shared memory buffer,
- * and what to write into the configuration register
- * [3] move pcic-specific code into a separate module.
- *
- * Device driver for IBM PCMCIA Credit Card Adapter for Ethernet,
- * if_ze.c
- *
- * Based on the Device driver for National Semiconductor DS8390 ethernet
- * adapters by David Greenman. Modifications for PCMCIA by Keith Moore.
- * Adapted for FreeBSD 1.1.5 by Jordan Hubbard.
- *
- * Currently supports only the IBM Credit Card Adapter for Ethernet, but
- * could probably work with other PCMCIA cards also, if it were modified
- * to get the locations of the PCMCIA configuration option register (COR)
- * by parsing the configuration tuples, rather than by hard-coding in
- * the value expected by IBM's card.
- *
- * Sources for data on the PCMCIA/IBM CCAE specific portions of the driver:
- *
- * [1] _Local Area Network Credit Card Adapters Technical Reference_,
- * IBM Corp., SC30-3585-00, part # 33G9243.
- * [2] "pre-alpha" PCMCIA support code for Linux by Barry Jaspan.
- * [3] Intel 82536SL PC Card Interface Controller Data Sheet, Intel
- * Order Number 290423-002
- * [4] National Semiconductor DP83902A ST-NIC (tm) Serial Network
- * Interface Controller for Twisted Pair data sheet.
- *
- *
- * Copyright (C) 1993, David Greenman. This software may be used, modified,
- * copied, distributed, and sold, in both source and binary form provided
- * that the above copyright and these terms are retained. Under no
- * circumstances is the author responsible for the proper functioning
- * of this software, nor does the author assume any responsibility
- * for damages incurred with its use.
- */
-/*======================================================================
-
- A PCMCIA ethernet driver for the 3com 3c589 card.
-
- Written by David Hinds, dhinds@allegro.stanford.edu
-
- The network driver code is based on Donald Becker's 3c589 code:
-
- Written 1994 by Donald Becker.
- Copyright 1993 United States Government as represented by the
- Director, National Security Agency. This software may be used and
- distributed according to the terms of the GNU Public License,
- incorporated herein by reference.
- Donald Becker may be reached at becker@cesdis1.gsfc.nasa.gov
-
-======================================================================*/
-/*
- * I doubled delay loops in this file because it is not enough for some
- * laptop machines' PCIC (especially, on my Chaplet ILFA 350 ^^;).
- * HOSOKAWA, Tatsumi <hosokawa@mt.cs.keio.ac.jp>
- */
-/*
- * Very small patch for IBM Ethernet PCMCIA Card II and IBM ThinkPad230Cs.
- * ETO, Toshihisa <eto@osl.fujitsu.co.jp>
- */
-
-#include "zp.h"
-
-#include "bpfilter.h"
-
-#include <sys/param.h>
-#if defined(__FreeBSD__)
-#include <sys/systm.h>
-#include <sys/conf.h>
-#include <sys/kernel.h>
-#endif
-#include <sys/mbuf.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <sys/errno.h>
-#include <sys/syslog.h>
-
-#include <net/if.h>
-#include <net/if_dl.h>
-#include <net/if_types.h>
-
-#ifdef INET
-#include <netinet/in.h>
-#include <netinet/in_systm.h>
-#include <netinet/in_var.h>
-#include <netinet/ip.h>
-#include <netinet/if_ether.h>
-#endif
-
-#ifdef IPX
-#include <netipx/ipx.h>
-#include <netipx/ipx_if.h>
-#endif
-
-#ifdef NS
-#include <netns/ns.h>
-#include <netns/ns_if.h>
-#endif
-
-#if NBPFILTER > 0
-#include <net/bpf.h>
-#include <net/bpfdesc.h>
-#endif
-
-#include <machine/clock.h>
-#include <machine/md_var.h>
-
-#ifdef PC98
-#include <pc98/pc98/pc98_device.h>
-#include <pc98/pc98/if_zpreg.h>
-#include <pc98/pc98/pcic.h>
-#else
-#include <i386/isa/isa_device.h>
-#include <i386/isa/if_zpreg.h>
-#include <i386/isa/pcic.h>
-#endif
-
-#include "apm.h"
-#if NAPM > 0
-#include <machine/apm_bios.h>
-#endif /* NAPM > 0 */
-
-
-/*****************************************************************************
- * Driver for Ethernet Adapter *
- *****************************************************************************/
-/*
- * zp_softc: per line info and status
- */
-static struct zp_softc {
- struct arpcom arpcom; /* Ethernet common part */
-#define MAX_MBS 8 /* # of mbufs we keep around */
- struct mbuf *mb[MAX_MBS]; /* spare mbuf storage. */
- int next_mb; /* Which mbuf to use next. */
- int last_mb; /* Last mbuf. */
- short ep_io_addr; /* i/o bus address */
- char ep_connectors; /* Connectors on this card. */
- int tx_start_thresh;/* Current TX_start_thresh. */
- char bus32bit; /* 32bit access possible */
- u_short if_port;
- u_char last_alive; /* information for reconfiguration */
- u_char last_up; /* information for reconfiguration */
- int slot; /* PCMCIA slot */
-#if NAPM > 0
- struct apmhook s_hook; /* reconfiguration support */
- struct apmhook r_hook; /* reconfiguration support */
-#endif /* NAPM > 0 */
-} zp_softc[NZP];
-
-static int zpprobe __P((struct isa_device *));
-static int zpattach __P((struct isa_device *));
-static int zp_suspend __P((void *visa_dev));
-static int zp_resume __P((void *visa_dev));
-static int zpioctl __P((struct ifnet * ifp, int, caddr_t));
-static u_short read_eeprom_data __P((int, int));
-
-static void zpinit __P((int));
-static void zpmbuffill __P((void *));
-static void zpmbufempty __P((struct zp_softc *));
-static void zpread __P((struct zp_softc *));
-static void zpreset __P((int));
-static void zpstart __P((struct ifnet *));
-static void zpstop __P((int));
-static void zpwatchdog __P((struct ifnet *));
-
-struct isa_driver zpdriver = {
- zpprobe,
- zpattach,
- "zp"
-};
-#define CARD_INFO "3Com Corporation~3C589"
-
-static unsigned char card_info[256];
-
-/*
- * scan the card information structure looking for the version/product info
- * tuple. when we find it, compare it to the string we are looking for.
- * return 1 if we find it, 0 otherwise.
- */
-
-static int
-zp_check_cis(unsigned char *scratch)
-{
- int i, j, k;
-
- card_info[0] = '\0';
- i = 0;
- while (scratch[i] != 0xff && i < 1024) {
- unsigned char link = scratch[i + 2];
-
- if (scratch[i] == 0x15) {
- /* level 1 version/product info copy to card_info,
- * translating '\0' to '~' */
- k = 0;
- for (j = i + 8; scratch[j] != 0xff; j += 2)
- card_info[k++] = scratch[j] == '\0' ? '~' : scratch[j];
- card_info[k++] = '\0';
- return (bcmp(card_info, CARD_INFO, sizeof(CARD_INFO) - 1) == 0);
- }
- i += 4 + 2 * link;
- }
- return 0;
-}
-/*
- * Probe each slot looking for an IBM Credit Card Adapter for Ethernet
- * For each card that we find, map its card information structure
- * into system memory at 'scratch' and see whether it's one of ours.
- * Return the slot number if we find a card, or -1 otherwise.
- *
- * Side effects:
- * + On success, leaves CIS mapped into memory at 'scratch';
- * caller must free it.
- * + On success, leaves ethernet address in enet_addr.
- * + Leaves product/vendor id of last card probed in 'card_info'
- */
-
-static int prev_slot = 0;
-
-static int
-zp_find_adapter(unsigned char *scratch, int reconfig)
-{
- int slot;
-
- for (slot = prev_slot; slot < MAXSLOT; ++slot) {
- /* see if there's a PCMCIA controller here Intel PCMCIA
- * controllers use 0x82 and 0x83 IBM clone chips use 0x88 and
- * 0x89, apparently */
- /* IBM ThinkPad230Cs use 0x84. */
- unsigned char idbyte = pcic_getb(slot, PCIC_ID_REV);
-
- if (idbyte != 0x82 && idbyte != 0x83 &&
- idbyte != 0x84 && /* for IBM ThinkPad 230Cs */
- idbyte != 0x88 && idbyte != 0x89) {
- continue;
- }
- if ((pcic_getb(slot, PCIC_STATUS) & PCIC_CD) != PCIC_CD) {
- if (!reconfig) {
- printf("zp: slot %d: no card in slot\n", slot);
- } else {
- log(LOG_NOTICE, "zp: slot %d: no card in slot\n", slot);
- }
- /* no card in slot */
- continue;
- }
- pcic_power_on(slot);
- pcic_reset(slot);
- /* map the card's attribute memory and examine its card
- * information structure tuples for something we recognize. */
- pcic_map_memory(slot, 0, kvtop(scratch), 0L,
- 0xFFFL, ATTRIBUTE, 1);
-
- if ((zp_check_cis(scratch)) > 0) {
- /* found it */
- if (!reconfig) {
- printf("zp: found card in slot %d\n", slot);
- } else {
- log(LOG_NOTICE, "zp: found card in slot %d\n", slot);
- }
- prev_slot = (prev_slot == MAXSLOT - 1) ? 0 : prev_slot + 1;
-
- return slot;
- } else {
- if (!reconfig) {
- printf("zp: pcmcia slot %d: %s\n", slot, card_info);
- } else {
- log(LOG_NOTICE, "zp: pcmcia slot %d: %s\n", slot, card_info);
- }
- }
- pcic_unmap_memory(slot, 0);
- }
- prev_slot = 0;
- return -1;
-}
-
-
-/*
- * macros to handle casting unsigned long to (char *) so we can
- * read/write into physical memory space.
- */
-
-#define PEEK(addr) (*((unsigned char *)(addr)))
-#define POKE(addr,val) do { PEEK(addr) = (val); } while (0)
-
-/*
- * Determine if the device is present
- *
- * on entry:
- * a pointer to an isa_device struct
- * on exit:
- * NULL if device not found
- * or # of i/o addresses used (if found)
- */
-static int
-zpprobe(struct isa_device * isa_dev)
-{
- struct zp_softc *sc = &zp_softc[isa_dev->id_unit];
- int slot;
- u_short k;
- int re_init_flag;
-
- if ((slot = zp_find_adapter(isa_dev->id_maddr, isa_dev->id_reconfig)) < 0)
- return 0;
-
- /* okay, we found a card, so set it up */
- /* Inhibit 16 bit memory delay. POINTETH.SYS apparently does this, for
- * what reason I don't know. */
- pcic_putb(slot, PCIC_CDGC,
- pcic_getb(slot, PCIC_CDGC) | PCIC_16_DL_INH);
- /* things to map (1) card's EEPROM is already mapped by the
- * find_adapter routine but we still need to get the card's ethernet
- * address. after that we unmap that part of attribute memory. (2)
- * card configuration registers need to be mapped in so we can set the
- * configuration and socket # registers. (3) shared memory packet
- * buffer (4) i/o ports (5) IRQ */
-#ifdef notdef
- /* Sigh. Location of the ethernet address isn't documented in [1]. It
- * was derived by doing a hex dump of all of attribute memory and
- * looking for the IBM vendor prefix. */
- enet_addr[0] = PEEK(isa_dev->id_maddr + 0xff0);
- enet_addr[1] = PEEK(isa_dev->id_maddr + 0xff2);
- enet_addr[2] = PEEK(isa_dev->id_maddr + 0xff4);
- enet_addr[3] = PEEK(isa_dev->id_maddr + 0xff6);
- enet_addr[4] = PEEK(isa_dev->id_maddr + 0xff8);
- enet_addr[5] = PEEK(isa_dev->id_maddr + 0xffa);
-#endif
- re_init_flag = 0;
-re_init:
- /* (2) map card configuration registers. these are offset in card
- * memory space by 0x20000. normally we could get this offset from
- * the card information structure, but I'm too lazy and am not quite
- * sure if I understand the CIS anyway.
- *
- * XXX IF YOU'RE TRYING TO PORT THIS DRIVER FOR A DIFFERENT PCMCIA CARD,
- * the most likely thing to change is the constant 0x20000 in the next
- * statement. Oh yes, also change the card id string that we probe
- * for. */
- pcic_map_memory(slot, 0, kvtop(isa_dev->id_maddr), 0x10000, 8L,
- ATTRIBUTE, 1);
-#if OLD_3C589B_CARDS
- POKE(isa_dev->id_maddr, 0x80); /* reset the card (how long?) */
- DELAY(40000);
-#endif
- /* Set the configuration index. According to [1], the adapter won't
- * respond to any i/o signals until we do this; it uses the Memory
- * Only interface (whatever that is; it's not documented). Also turn
- * on "level" (not pulse) interrupts.
- *
- * XXX probably should init the socket and copy register also, so that we
- * can deal with multiple instances of the same card. */
- POKE(isa_dev->id_maddr, 0x41);
- pcic_unmap_memory(slot, 0);
-
- /* (4) map i/o ports.
- *
- * XXX is it possible that the config file leaves this unspecified, in
- * which case we have to pick one?
- *
- * At least one PCMCIA device driver I'v seen maps a block of 32
- * consecutive i/o ports as two windows of 16 ports each. Maybe some
- * other pcic chips are restricted to 16-port windows; the 82365SL
- * doesn't seem to have that problem. But since we have an extra
- * window anyway... */
- pcic_map_io(slot, 0, isa_dev->id_iobase, 16, 2);
-
- /* (5) configure the card for the desired interrupt
- *
- * XXX is it possible that the config file leaves this unspecified? */
- pcic_map_irq(slot, ffs(isa_dev->id_irq) - 1);
-
- /* tell the PCIC that this is an I/O card (not memory) */
- pcic_putb(slot, PCIC_INT_GEN,
- pcic_getb(slot, PCIC_INT_GEN) | PCIC_CARDTYPE);
-
- sc->ep_io_addr = isa_dev->id_iobase;
- GO_WINDOW(0);
- k = read_eeprom_data(BASE, EEPROM_ADDR_CFG); /* get addr cfg */
- sc->if_port = k >> 14;
- k = (k & 0x1f) * 0x10 + 0x200; /* decode base addr. */
- if (k != (u_short) isa_dev->id_iobase) {
- if (!re_init_flag) {
- re_init_flag++;
- goto re_init;
- }
- return (0);
- }
- k = read_eeprom_data(BASE, EEPROM_RESOURCE_CFG);
-
- k >>= 12;
-
- if (isa_dev->id_irq != (1 << ((k == 2) ? 9 : k)))
- return (0);
-
- outb(BASE, ACTIVATE_ADAPTER_TO_CONFIG);
-
-
- /* information for reconfiguration */
- sc->last_alive = 0;
- sc->last_up = 0;
- sc->slot = slot;
-
- return (0x10); /* 16 bytes of I/O space used. */
-}
-#if NAPM > 0
-static int
-zp_suspend(visa_dev)
- void *visa_dev;
-{
- struct isa_device *isa_dev = visa_dev;
- struct zp_softc *sc = &zp_softc[isa_dev->id_unit];
-
- pcic_power_off(sc->slot);
- return 0;
-}
-
-static int
-zp_resume(visa_dev)
- void *visa_dev;
-{
- struct isa_device *isa_dev = visa_dev;
-
- prev_slot = 0;
- reconfig_isadev(isa_dev, &net_imask);
- return 0;
-}
-#endif /* NAPM > 0 */
-
-
-/*
- * Install interface into kernel networking data structures
- */
-
-static int
-zpattach(isa_dev)
- struct isa_device *isa_dev;
-{
- struct zp_softc *sc = &zp_softc[isa_dev->id_unit];
- struct ifnet *ifp = &sc->arpcom.ac_if;
- u_short i;
- int pl;
-
- /* PCMCIA card can be offlined. Reconfiguration is required */
- if (isa_dev->id_reconfig) {
- if (!isa_dev->id_alive && sc->last_alive) {
- pl = splimp();
- sc->last_up = (ifp->if_flags & IFF_UP);
- if_down(ifp);
- splx(pl);
- sc->last_alive = 0;
- }
- if (isa_dev->id_alive && !sc->last_alive) {
- zpreset(isa_dev->id_unit);
- if (sc->last_up) {
- pl = splimp();
- if_up(ifp);
- splx(pl);
- }
- sc->last_alive = 1;
- }
- return 1;
- } else {
- sc->last_alive = 1;
- }
-
-
- sc->ep_io_addr = isa_dev->id_iobase;
- printf("zp%d: ", isa_dev->id_unit);
-
- sc->ep_connectors = 0;
-
- i = inw(isa_dev->id_iobase + EP_W0_CONFIG_CTRL);
-
- if (i & IS_AUI) {
- printf("aui");
- sc->ep_connectors |= AUI;
- }
- if (i & IS_BNC) {
- if (sc->ep_connectors)
- printf("/");
- printf("bnc");
- sc->ep_connectors |= BNC;
- }
- if (i & IS_UTP) {
- if (sc->ep_connectors)
- printf("/");
- printf("utp");
- sc->ep_connectors |= UTP;
- }
- if (!sc->ep_connectors)
- printf("no connectors!");
-
- GO_WINDOW(0);
- {
- short tmp_addr[3];
- int i;
- for (i = 0; i < 3; i++) {
- tmp_addr[i] = htons(read_eeprom_data(BASE, i));
- }
- bcopy(tmp_addr, sc->arpcom.ac_enaddr, 6);
- }
-
- printf(" address %6D\n", sc->arpcom.ac_enaddr, ":");
-
- ifp->if_softc = sc;
- ifp->if_mtu = ETHERMTU;
- ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX;
- ifp->if_unit = isa_dev->id_unit;
- ifp->if_name = "zp";
- ifp->if_output = ether_output;
- ifp->if_start = zpstart;
- ifp->if_ioctl = zpioctl;
- ifp->if_watchdog = zpwatchdog;
- /* Select connector according to board setting. */
- ifp->if_flags |= IFF_LINK0;
-
- if_attach(ifp);
- ether_ifattach(ifp);
-
-#if NBPFILTER > 0
- bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
-#endif
-#if NAPM > 0
- sc->s_hook.ah_fun = zp_suspend;
- sc->s_hook.ah_arg = (void *) isa_dev;
- sc->s_hook.ah_name = "3Com PCMCIA Etherlink III 3C589";
- sc->s_hook.ah_order = APM_MID_ORDER;
- apm_hook_establish(APM_HOOK_SUSPEND, &sc->s_hook);
- sc->r_hook.ah_fun = zp_resume;
- sc->r_hook.ah_arg = (void *) isa_dev;
- sc->r_hook.ah_name = "3Com PCMCIA Etherlink III 3C589";
- sc->r_hook.ah_order = APM_MID_ORDER;
- apm_hook_establish(APM_HOOK_RESUME, &sc->r_hook);
-#endif /* NAPM > 0 */
- return 1;
-}
-/*
- * The order in here seems important. Otherwise we may not receive
- * interrupts. ?!
- */
-static void
-zpinit(unit)
- int unit;
-{
- register struct zp_softc *sc = &zp_softc[unit];
- register struct ifnet *ifp = &sc->arpcom.ac_if;
- int s, i;
-
- if (ifp->if_addrlist == (struct ifaddr *) 0)
- return;
-
- s = splimp();
- while (inw(BASE + EP_STATUS) & S_COMMAND_IN_PROGRESS);
-
- GO_WINDOW(0);
-
- /* Disable the card */
- outw(BASE + EP_W0_CONFIG_CTRL, 0);
-
- /* Enable the card */
- outw(BASE + EP_W0_CONFIG_CTRL, ENABLE_DRQ_IRQ);
-
- GO_WINDOW(2);
-
- /* Reload the ether_addr. */
- for (i = 0; i < 6; i++)
- outb(BASE + EP_W2_ADDR_0 + i, sc->arpcom.ac_enaddr[i]);
-
- outw(BASE + EP_COMMAND, RX_RESET);
- outw(BASE + EP_COMMAND, TX_RESET);
-
- /* Window 1 is operating window */
- GO_WINDOW(1);
- for (i = 0; i < 31; i++)
- inb(BASE + EP_W1_TX_STATUS);
-
- /* get rid of stray intr's */
- outw(BASE + EP_COMMAND, ACK_INTR | 0xff);
-
- outw(BASE + EP_COMMAND, SET_RD_0_MASK | S_CARD_FAILURE | S_RX_COMPLETE |
- S_TX_COMPLETE | S_TX_AVAIL);
- outw(BASE + EP_COMMAND, SET_INTR_MASK | S_CARD_FAILURE | S_RX_COMPLETE |
- S_TX_COMPLETE | S_TX_AVAIL);
-
-#ifndef IFF_MULTICAST
-#define IFF_MULTICAST 0x10000
-#endif
-
- outw(BASE + EP_COMMAND, SET_RX_FILTER | FIL_INDIVIDUAL |
- ((sc->arpcom.ac_if.if_flags & IFF_MULTICAST) ? FIL_GROUP : 0) |
- FIL_BRDCST |
- ((sc->arpcom.ac_if.if_flags & IFF_PROMISC) ? FIL_ALL : 0));
- /* you can `ifconfig (link0|-link0) ep0' to get the following
- * behaviour: -link0 disable AUI/UTP. enable BNC. link0 disable
- * BNC. enable AUI. if the card has a UTP connector, that is enabled
- * too. not sure, but it seems you have to be careful to not plug
- * things into both AUI & UTP. */
-
- if (!(ifp->if_flags & IFF_LINK0) && (sc->ep_connectors & BNC)) {
- GO_WINDOW(0);
- /* set the xcvr */
- outw(BASE + EP_W0_ADDRESS_CFG, 3 << 14);
- GO_WINDOW(2);
- outw(BASE + EP_COMMAND, START_TRANSCEIVER);
- GO_WINDOW(1);
- }
-#if defined(__NetBSD__) || defined(__FreeBSD__)
- if ((ifp->if_flags & IFF_LINK0) && (sc->ep_connectors & UTP)) {
-#else
- if ((ifp->if_flags & IFF_ALTPHYS) && (sc->ep_connectors & UTP)) {
-#endif
- GO_WINDOW(4);
- outw(BASE + EP_W4_MEDIA_TYPE, ENABLE_UTP);
- GO_WINDOW(1);
- }
- outw(BASE + EP_COMMAND, RX_ENABLE);
- outw(BASE + EP_COMMAND, TX_ENABLE);
-
- ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE; /* just in case */
- sc->tx_start_thresh = 20; /* probably a good starting point. */
- /* Store up a bunch of mbuf's for use later. (MAX_MBS). First we free
- * up any that we had in case we're being called from intr or
- * somewhere else. */
- sc->last_mb = 0;
- sc->next_mb = 0;
- zpmbuffill(sc);
- zpstart(ifp);
- splx(s);
-}
-
-static const char padmap[] = {0, 3, 2, 1};
-static void
-zpstart(ifp)
- struct ifnet *ifp;
-{
- register struct zp_softc *sc = ifp->if_softc;
- struct mbuf *m, *top;
-
- int s, len, pad;
-
- s = splimp();
-
- if (sc->arpcom.ac_if.if_flags & IFF_OACTIVE) {
- splx(s);
- return;
- }
-startagain:
-
- /* Sneak a peek at the next packet */
- m = sc->arpcom.ac_if.if_snd.ifq_head;
- if (m == 0) {
- splx(s);
- return;
- }
- for (len = 0, top = m; m; m = m->m_next)
- len += m->m_len;
-
- pad = padmap[len & 3];
-
- /* The 3c509 automatically pads short packets to minimum ethernet
- * length, but we drop packets that are too large. Perhaps we should
- * truncate them instead? */
- if (len + pad > ETHER_MAX_LEN) {
- /* packet is obviously too large: toss it */
- ++sc->arpcom.ac_if.if_oerrors;
- IF_DEQUEUE(&sc->arpcom.ac_if.if_snd, m);
- m_freem(m);
- goto readcheck;
- }
- if (inw(BASE + EP_W1_FREE_TX) < len + pad + 4) {
- /* no room in FIFO */
- outw(BASE + EP_COMMAND, SET_TX_AVAIL_THRESH | (len + pad + 4));
- sc->arpcom.ac_if.if_flags |= IFF_OACTIVE;
- splx(s);
-
- return;
- }
- IF_DEQUEUE(&sc->arpcom.ac_if.if_snd, m);
-
- if (m == 0) { /* not really needed */
- splx(s);
- return;
- }
- outw(BASE + EP_COMMAND, SET_TX_START_THRESH |
- (len / 4 + sc->tx_start_thresh));
-
- outw(BASE + EP_W1_TX_PIO_WR_1, len);
- outw(BASE + EP_W1_TX_PIO_WR_1, 0xffff); /* Second dword meaningless */
-
- for (top = m; m != 0; m = m->m_next) {
- if (sc->bus32bit) {
- outsl(BASE + EP_W1_TX_PIO_WR_1, mtod(m, caddr_t),
- m->m_len / 4);
- if (m->m_len & 3)
- outsb(BASE + EP_W1_TX_PIO_WR_1,
- mtod(m, caddr_t) + (m->m_len & (~3)),
- m->m_len & 3);
- } else {
- outsw(BASE + EP_W1_TX_PIO_WR_1, mtod(m, caddr_t), m->m_len / 2);
- if (m->m_len & 1)
- outb(BASE + EP_W1_TX_PIO_WR_1,
- *(mtod(m, caddr_t) + m->m_len - 1));
- }
- }
- while (pad--)
- outb(BASE + EP_W1_TX_PIO_WR_1, 0); /* Padding */
-
-#if NBPFILTER > 0
- if (sc->arpcom.ac_if.if_bpf) {
- bpf_mtap(&sc->arpcom.ac_if, top);
- }
-#endif
-
- m_freem(top);
- ++sc->arpcom.ac_if.if_opackets;
- /* Is another packet coming in? We don't want to overflow the tiny RX
- * fifo. */
-readcheck:
- if (inw(BASE + EP_W1_RX_STATUS) & RX_BYTES_MASK) {
- splx(s);
- return;
- }
- goto startagain;
-}
-void
-zpintr(unit)
- int unit;
-{
- int status, i;
- register struct zp_softc *sc = &zp_softc[unit];
-
- struct ifnet *ifp = &sc->arpcom.ac_if;
-
-
- status = 0;
-checkintr:
- status = inw(BASE + EP_STATUS) &
- (S_TX_COMPLETE | S_TX_AVAIL | S_RX_COMPLETE | S_CARD_FAILURE);
-checkintr2:
- if (status == 0) {
- /* No interrupts. */
- outw(BASE + EP_COMMAND, C_INTR_LATCH);
-
- status = inw(BASE + EP_STATUS) &
- (S_TX_COMPLETE | S_TX_AVAIL | S_RX_COMPLETE |
- S_CARD_FAILURE);
- if (status)
- goto checkintr2;
-
- return;
- }
- /* important that we do this first. */
- outw(BASE + EP_COMMAND, ACK_INTR | status);
-
- if (status & S_TX_AVAIL) {
- status &= ~S_TX_AVAIL;
- inw(BASE + EP_W1_FREE_TX);
- sc->arpcom.ac_if.if_flags &= ~IFF_OACTIVE;
- zpstart(&sc->arpcom.ac_if);
-
- }
- if (status & S_RX_COMPLETE) {
- status &= ~S_RX_COMPLETE;
- zpread(sc);
- }
- if (status & S_CARD_FAILURE) {
- printf("zp%d: reset (status: %x)\n", unit, status);
- outw(BASE + EP_COMMAND, C_INTR_LATCH);
- zpinit(unit);
- return;
- }
- if (status & S_TX_COMPLETE) {
- status &= ~S_TX_COMPLETE;
- /* We need to read TX_STATUS until we get a 0 status in order
- * to turn off the interrupt flag. */
- while ((i = inb(BASE + EP_W1_TX_STATUS)) & TXS_COMPLETE) {
- outw(BASE + EP_W1_TX_STATUS, 0x0);
- if (i & (TXS_MAX_COLLISION | TXS_JABBER | TXS_UNDERRUN)) {
- if (i & TXS_MAX_COLLISION)
- ++sc->arpcom.ac_if.if_collisions;
- if (i & (TXS_JABBER | TXS_UNDERRUN)) {
- outw(BASE + EP_COMMAND, TX_RESET);
- if (i & TXS_UNDERRUN) {
- if (sc->tx_start_thresh < ETHER_MAX_LEN) {
- sc->tx_start_thresh += 20;
- outw(BASE + EP_COMMAND,
- SET_TX_START_THRESH |
- sc->tx_start_thresh);
- }
- }
- }
- outw(BASE + EP_COMMAND, TX_ENABLE);
- ++sc->arpcom.ac_if.if_oerrors;
- }
- }
- zpstart(ifp);
- }
- goto checkintr;
-}
-
-static void
-zpread(sc)
- register struct zp_softc *sc;
-{
- struct ether_header *eh;
- struct mbuf *mcur, *m, *m0, *top;
- int totlen, lenthisone;
- int save_totlen;
- int off;
-
-
- totlen = inw(BASE + EP_W1_RX_STATUS);
- off = 0;
- top = 0;
-
- if (totlen & ERR_RX) {
- ++sc->arpcom.ac_if.if_ierrors;
- goto out;
- }
- save_totlen = totlen &= RX_BYTES_MASK; /* Lower 11 bits = RX bytes. */
-
- m = sc->mb[sc->next_mb];
- sc->mb[sc->next_mb] = 0;
-
- if (m == 0) {
- MGETHDR(m, M_DONTWAIT, MT_DATA);
- if (m == 0)
- goto out;
- } else {
- /* Convert one of our saved mbuf's */
- sc->next_mb = (sc->next_mb + 1) % MAX_MBS;
- m->m_data = m->m_pktdat;
- m->m_flags = M_PKTHDR;
- }
-
- top = m0 = m; /* We assign top so we can "goto out" */
-#define EROUND ((sizeof(struct ether_header) + 3) & ~3)
-#define EOFF (EROUND - sizeof(struct ether_header))
- m0->m_data += EOFF;
- /* Read what should be the header. */
- insw(BASE + EP_W1_RX_PIO_RD_1,
- mtod(m0, caddr_t), sizeof(struct ether_header) / 2);
- m->m_len = sizeof(struct ether_header);
- totlen -= sizeof(struct ether_header);
- /* mostly deal with trailer here. (untested) We do this in a couple
- * of parts. First we check for a trailer, if we have one we convert
- * the mbuf back to a regular mbuf and set the offset and subtract
- * sizeof(struct ether_header) from the pktlen. After we've read the
- * packet off the interface (all except for the trailer header, we
- * then get a header mbuf, read the trailer into it, and fix up the
- * mbuf pointer chain. */
- eh = mtod(m, struct ether_header *);
- while (totlen > 0) {
- lenthisone = min(totlen, M_TRAILINGSPACE(m));
- if (lenthisone == 0) { /* no room in this one */
- mcur = m;
- m = sc->mb[sc->next_mb];
- sc->mb[sc->next_mb] = 0;
- if (!m) {
- MGET(m, M_DONTWAIT, MT_DATA);
- if (m == 0)
- goto out;
- } else {
- timeout(zpmbuffill, sc, 0);
- sc->next_mb = (sc->next_mb + 1) % MAX_MBS;
- }
- if (totlen >= MINCLSIZE)
- MCLGET(m, M_DONTWAIT);
- m->m_len = 0;
- mcur->m_next = m;
- lenthisone = min(totlen, M_TRAILINGSPACE(m));
- }
- if (sc->bus32bit) {
- insl(BASE + EP_W1_RX_PIO_RD_1, mtod(m, caddr_t) + m->m_len,
- lenthisone / 4);
- m->m_len += (lenthisone & ~3);
- if (lenthisone & 3)
- insb(BASE + EP_W1_RX_PIO_RD_1,
- mtod(m, caddr_t) + m->m_len,
- lenthisone & 3);
- m->m_len += (lenthisone & 3);
- } else {
- insw(BASE + EP_W1_RX_PIO_RD_1, mtod(m, caddr_t) + m->m_len,
- lenthisone / 2);
- m->m_len += lenthisone;
- if (lenthisone & 1)
- *(mtod(m, caddr_t) + m->m_len - 1) = inb(BASE + EP_W1_RX_PIO_RD_1);
- }
- totlen -= lenthisone;
- }
- if (off) {
- top = sc->mb[sc->next_mb];
- sc->mb[sc->next_mb] = 0;
- if (top == 0) {
- MGETHDR(m, M_DONTWAIT, MT_DATA);
- if (top == 0) {
- top = m0;
- goto out;
- }
- } else {
- /* Convert one of our saved mbuf's */
- sc->next_mb = (sc->next_mb + 1) % MAX_MBS;
- top->m_data = top->m_pktdat;
- top->m_flags = M_PKTHDR;
- }
- insw(BASE + EP_W1_RX_PIO_RD_1, mtod(top, caddr_t),
- sizeof(struct ether_header));
- top->m_next = m0;
- top->m_len = sizeof(struct ether_header);
- /* XXX Accomodate for type and len from beginning of trailer */
- top->m_pkthdr.len = save_totlen - (2 * sizeof(u_short));
- } else {
- top = m0;
- top->m_pkthdr.len = save_totlen;
- }
-
- top->m_pkthdr.rcvif = &sc->arpcom.ac_if;
- outw(BASE + EP_COMMAND, RX_DISCARD_TOP_PACK);
- while (inw(BASE + EP_STATUS) & S_COMMAND_IN_PROGRESS);
- ++sc->arpcom.ac_if.if_ipackets;
-#if NBPFILTER > 0
- if (sc->arpcom.ac_if.if_bpf) {
- bpf_mtap(&sc->arpcom.ac_if, top);
-
- /* Note that the interface cannot be in promiscuous mode if
- * there are no BPF listeners. And if we are in promiscuous
- * mode, we have to check if this packet is really ours. */
- if ((sc->arpcom.ac_if.if_flags & IFF_PROMISC) &&
- (eh->ether_dhost[0] & 1) == 0 &&
- bcmp(eh->ether_dhost, sc->arpcom.ac_enaddr,
- sizeof(eh->ether_dhost)) != 0 &&
- bcmp(eh->ether_dhost, etherbroadcastaddr,
- sizeof(eh->ether_dhost)) != 0) {
- m_freem(top);
- return;
- }
- }
-#endif
- m_adj(top, sizeof(struct ether_header));
- ether_input(&sc->arpcom.ac_if, eh, top);
- return;
-
-out: outw(BASE + EP_COMMAND, RX_DISCARD_TOP_PACK);
- while (inw(BASE + EP_STATUS) & S_COMMAND_IN_PROGRESS);
- if (top)
- m_freem(top);
-
-}
-
-
-/*
- * Look familiar?
- */
-static int
-zpioctl(ifp, cmd, data)
- register struct ifnet *ifp;
- int cmd;
- caddr_t data;
-{
- register struct ifaddr *ifa = (struct ifaddr *) data;
- struct zp_softc *sc = ifp->if_softc;
- int error = 0;
-
-
- switch (cmd) {
- case SIOCSIFADDR:
- ifp->if_flags |= IFF_UP;
- switch (ifa->ifa_addr->sa_family) {
-#ifdef INET
- case AF_INET:
- zpinit(ifp->if_unit); /* before arpwhohas */
- arp_ifinit((struct arpcom *) ifp, ifa);
- break;
-#endif
-#ifdef IPX
- case AF_IPX:
- {
- register struct ipx_addr *ina = &(IA_SIPX(ifa)->sipx_addr);
-
- if (ipx_nullhost(*ina))
- ina->x_host =
- *(union ipx_host *) (sc->arpcom.ac_enaddr);
- else {
- ifp->if_flags &= ~IFF_RUNNING;
- bcopy((caddr_t) ina->x_host.c_host,
- (caddr_t) sc->arpcom.ac_enaddr,
- sizeof(sc->arpcom.ac_enaddr));
- }
- zpinit(ifp->if_unit);
- break;
- }
-#endif
-#ifdef NS
- case AF_NS:
- {
- register struct ns_addr *ina = &(IA_SNS(ifa)->sns_addr);
-
- if (ns_nullhost(*ina))
- ina->x_host =
- *(union ns_host *) (sc->arpcom.ac_enaddr);
- else {
- ifp->if_flags &= ~IFF_RUNNING;
- bcopy((caddr_t) ina->x_host.c_host,
- (caddr_t) sc->arpcom.ac_enaddr,
- sizeof(sc->arpcom.ac_enaddr));
- }
- zpinit(ifp->if_unit);
- break;
- }
-#endif
- default:
- zpinit(ifp->if_unit);
- break;
- }
- break;
- case SIOCSIFFLAGS:
- if ((ifp->if_flags & IFF_UP) == 0 && ifp->if_flags & IFF_RUNNING) {
- ifp->if_flags &= ~IFF_RUNNING;
- zpstop(ifp->if_unit);
- zpmbufempty(sc);
- break;
- }
- if (ifp->if_flags & IFF_UP && (ifp->if_flags & IFF_RUNNING) == 0)
- zpinit(ifp->if_unit);
- break;
- default:
- error = EINVAL;
- }
- return (error);
-}
-
-static void
-zpreset(unit)
- int unit;
-{
- int s = splimp();
-
- zpstop(unit);
- zpinit(unit);
- splx(s);
-}
-
-static void
-zpwatchdog(ifp)
- struct ifnet *ifp;
-{
- log(LOG_ERR, "zp%d: watchdog\n", ifp->if_unit);
- ifp->if_oerrors++;
- zpreset(ifp->if_unit);
-}
-
-static void
-zpstop(unit)
- int unit;
-{
- struct zp_softc *sc = &zp_softc[unit];
-
- outw(BASE + EP_COMMAND, RX_DISABLE);
- outw(BASE + EP_COMMAND, RX_DISCARD_TOP_PACK);
- while (inw(BASE + EP_STATUS) & S_COMMAND_IN_PROGRESS);
- outw(BASE + EP_COMMAND, TX_DISABLE);
- outw(BASE + EP_COMMAND, STOP_TRANSCEIVER);
- outw(BASE + EP_COMMAND, RX_RESET);
- outw(BASE + EP_COMMAND, TX_RESET);
- outw(BASE + EP_COMMAND, C_INTR_LATCH);
- outw(BASE + EP_COMMAND, SET_RD_0_MASK);
- outw(BASE + EP_COMMAND, SET_INTR_MASK);
- outw(BASE + EP_COMMAND, SET_RX_FILTER);
-}
-
-
-
-static u_short
-read_eeprom_data(id_port, offset)
- int id_port;
- int offset;
-{
-
- outb(id_port + 10, 0x80 + offset);
- DELAY(1000);
- return inw(id_port + 12);
-}
-
-
-
-
-static void
-zpmbuffill(sp)
- void *sp;
-{
- struct zp_softc *sc = (struct zp_softc *) sp;
- int s, i;
-
- s = splimp();
- i = sc->last_mb;
- do {
- if (sc->mb[i] == NULL)
- MGET(sc->mb[i], M_DONTWAIT, MT_DATA);
- if (sc->mb[i] == NULL)
- break;
- i = (i + 1) % MAX_MBS;
- } while (i != sc->next_mb);
- sc->last_mb = i;
- splx(s);
-}
-
-static void
-zpmbufempty(sc)
- struct zp_softc *sc;
-{
- int s, i;
-
- s = splimp();
- for (i = 0; i < MAX_MBS; i++) {
- if (sc->mb[i]) {
- m_freem(sc->mb[i]);
- sc->mb[i] = NULL;
- }
- }
- sc->last_mb = sc->next_mb = 0;
- untimeout(zpmbuffill, sc);
- splx(s);
-}
diff --git a/sys/pc98/pc98/if_zpreg.h b/sys/pc98/pc98/if_zpreg.h
deleted file mode 100644
index ef0215d..0000000
--- a/sys/pc98/pc98/if_zpreg.h
+++ /dev/null
@@ -1,293 +0,0 @@
-/*
- * Copyright (c) 1993 Herb Peyerl (hpeyerl@novatel.ca)
- * All rights reserved.
- *
- * 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. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
- *
- * $Id: if_zpreg.h,v 1.1.1.1 1996/06/14 10:04:44 asami Exp $
- */
-/**************************************************************************
- * *
- * These define the EEPROM data structure. They are used in the probe
- * function to verify the existence of the adapter after having sent
- * the ID_Sequence.
- *
- * There are others but only the ones we use are defined here.
- *
- **************************************************************************/
-
-#define EEPROM_NODE_ADDR_0 0x0 /* Word */
-#define EEPROM_NODE_ADDR_1 0x1 /* Word */
-#define EEPROM_NODE_ADDR_2 0x2 /* Word */
-#define EEPROM_PROD_ID 0x3 /* 0x9[0-f]50 */
-#define EEPROM_MFG_ID 0x7 /* 0x6d50 */
-#define EEPROM_ADDR_CFG 0x8 /* Base addr */
-#define EEPROM_RESOURCE_CFG 0x9 /* IRQ. Bits 12-15 */
-
-/**************************************************************************
- * *
- * These are the registers for the 3Com 3c509 and their bit patterns when *
- * applicable. They have been taken out the the "EtherLink III Parallel *
- * Tasking EISA and ISA Technical Reference" "Beta Draft 10/30/92" manual *
- * from 3com. *
- * *
- **************************************************************************/
-
-#define EP_COMMAND 0x0e /* Write. BASE+0x0e is always a command reg. */
-#define EP_STATUS 0x0e /* Read. BASE+0x0e is always status reg. */
-#define EP_WINDOW 0x0f /* Read. BASE+0x0f is always window reg. */
-/*
- * Window 0 registers. Setup.
- */
- /* Write */
-#define EP_W0_EEPROM_DATA 0x0c
-#define EP_W0_EEPROM_COMMAND 0x0a
-#define EP_W0_RESOURCE_CFG 0x08
-#define EP_W0_ADDRESS_CFG 0x06
-#define EP_W0_CONFIG_CTRL 0x04
- /* Read */
-#define EP_W0_PRODUCT_ID 0x02
-#define EP_W0_MFG_ID 0x00
-
-/*
- * Window 1 registers. Operating Set.
- */
- /* Write */
-#define EP_W1_TX_PIO_WR_2 0x02
-#define EP_W1_TX_PIO_WR_1 0x00
- /* Read */
-#define EP_W1_FREE_TX 0x0c
-#define EP_W1_TX_STATUS 0x0b /* byte */
-#define EP_W1_TIMER 0x0a /* byte */
-#define EP_W1_RX_STATUS 0x08
-#define EP_W1_RX_PIO_RD_2 0x02
-#define EP_W1_RX_PIO_RD_1 0x00
-
-/*
- * Window 2 registers. Station Address Setup/Read
- */
- /* Read/Write */
-#define EP_W2_ADDR_5 0x05
-#define EP_W2_ADDR_4 0x04
-#define EP_W2_ADDR_3 0x03
-#define EP_W2_ADDR_2 0x02
-#define EP_W2_ADDR_1 0x01
-#define EP_W2_ADDR_0 0x00
-
-/*
- * Window 3 registers. FIFO Management.
- */
- /* Read */
-#define EP_W3_FREE_TX 0x0c
-#define EP_W3_FREE_RX 0x0a
-
-/*
- * Window 4 registers. Diagnostics.
- */
- /* Read/Write */
-#define EP_W4_MEDIA_TYPE 0x0a
-#define EP_W4_CTRLR_STATUS 0x08
-#define EP_W4_NET_DIAG 0x06
-#define EP_W4_FIFO_DIAG 0x04
-#define EP_W4_HOST_DIAG 0x02
-#define EP_W4_TX_DIAG 0x00
-
-/*
- * Window 5 Registers. Results and Internal status.
- */
- /* Read */
-#define EP_W5_READ_0_MASK 0x0c
-#define EP_W5_INTR_MASK 0x0a
-#define EP_W5_RX_FILTER 0x08
-#define EP_W5_RX_EARLY_THRESH 0x06
-#define EP_W5_TX_AVAIL_THRESH 0x02
-#define EP_W5_TX_START_THRESH 0x00
-
-/*
- * Window 6 registers. Statistics.
- */
- /* Read/Write */
-#define TX_TOTAL_OK 0x0c
-#define RX_TOTAL_OK 0x0a
-#define TX_DEFERRALS 0x08
-#define RX_FRAMES_OK 0x07
-#define TX_FRAMES_OK 0x06
-#define RX_OVERRUNS 0x05
-#define TX_COLLISIONS 0x04
-#define TX_AFTER_1_COLLISION 0x03
-#define TX_AFTER_X_COLLISIONS 0x02
-#define TX_NO_SQE 0x01
-#define TX_CD_LOST 0x00
-
-/****************************************
- *
- * Register definitions.
- *
- ****************************************/
-
-/*
- * Command register. All windows.
- *
- * 16 bit register.
- * 15-11: 5-bit code for command to be executed.
- * 10-0: 11-bit arg if any. For commands with no args;
- * this can be set to anything.
- */
-#define GLOBAL_RESET (u_short) 0x0000 /* Wait at least 1ms after issuing */
-#define WINDOW_SELECT (u_short) (0x1<<11)
-#define START_TRANSCEIVER (u_short) (0x2<<11) /* Read ADDR_CFG reg to determine
- whether this is needed. If so;
- wait 800 uSec before using trans-
- ceiver. */
-#define RX_DISABLE (u_short) (0x3<<11) /* state disabled on power-up */
-#define RX_ENABLE (u_short) (0x4<<11)
-#define RX_RESET (u_short) (0x5<<11)
-#define RX_DISCARD_TOP_PACK (u_short) (0x8<<11)
-#define TX_ENABLE (u_short) (0x9<<11)
-#define TX_DISABLE (u_short) (0xa<<11)
-#define TX_RESET (u_short) (0xb<<11)
-#define REQ_INTR (u_short) (0xc<<11)
- /*
- * The following C_* acknowledge the various interrupts.
- * Some of them don't do anything. See the manual.
- */
-#define ACK_INTR (u_short) (0x6800)
-# define C_INTR_LATCH (u_short) (ACK_INTR|0x1)
-# define C_CARD_FAILURE (u_short) (ACK_INTR|0x2)
-# define C_TX_COMPLETE (u_short) (ACK_INTR|0x4)
-# define C_TX_AVAIL (u_short) (ACK_INTR|0x8)
-# define C_RX_COMPLETE (u_short) (ACK_INTR|0x10)
-# define C_RX_EARLY (u_short) (ACK_INTR|0x20)
-# define C_INT_RQD (u_short) (ACK_INTR|0x40)
-# define C_UPD_STATS (u_short) (ACK_INTR|0x80)
-#define SET_INTR_MASK (u_short) (0xe<<11)
-#define SET_RD_0_MASK (u_short) (0xf<<11)
-#define SET_RX_FILTER (u_short) (0x10<<11)
-# define FIL_INDIVIDUAL (u_short) (0x1)
-# define FIL_GROUP (u_short) (0x2)
-# define FIL_BRDCST (u_short) (0x4)
-# define FIL_ALL (u_short) (0x8)
-#define SET_RX_EARLY_THRESH (u_short) (0x11<<11)
-#define SET_TX_AVAIL_THRESH (u_short) (0x12<<11)
-#define SET_TX_START_THRESH (u_short) (0x13<<11)
-#define STATS_ENABLE (u_short) (0x15<<11)
-#define STATS_DISABLE (u_short) (0x16<<11)
-#define STOP_TRANSCEIVER (u_short) (0x17<<11)
-
-/*
- * Status register. All windows.
- *
- * 15-13: Window number(0-7).
- * 12: Command_in_progress.
- * 11: reserved.
- * 10: reserved.
- * 9: reserved.
- * 8: reserved.
- * 7: Update Statistics.
- * 6: Interrupt Requested.
- * 5: RX Early.
- * 4: RX Complete.
- * 3: TX Available.
- * 2: TX Complete.
- * 1: Adapter Failure.
- * 0: Interrupt Latch.
- */
-#define S_INTR_LATCH (u_short) (0x1)
-#define S_CARD_FAILURE (u_short) (0x2)
-#define S_TX_COMPLETE (u_short) (0x4)
-#define S_TX_AVAIL (u_short) (0x8)
-#define S_RX_COMPLETE (u_short) (0x10)
-#define S_RX_EARLY (u_short) (0x20)
-#define S_INT_RQD (u_short) (0x40)
-#define S_UPD_STATS (u_short) (0x80)
-#define S_COMMAND_IN_PROGRESS (u_short) (0x1000)
-
-/*
- * FIFO Registers. RX Status.
- *
- * 15: Incomplete or FIFO empty.
- * 14: 1: Error in RX Packet 0: Incomplete or no error.
- * 13-11: Type of error.
- * 1000 = Overrun.
- * 1011 = Run Packet Error.
- * 1100 = Alignment Error.
- * 1101 = CRC Error.
- * 1001 = Oversize Packet Error (>1514 bytes)
- * 0010 = Dribble Bits.
- * (all other error codes, no errors.)
- *
- * 10-0: RX Bytes (0-1514)
- */
-#define ERR_INCOMPLETE (u_short) (0x8000)
-#define ERR_RX (u_short) (0x4000)
-#define ERR_RX_PACKET (u_short) (0x2000)
-#define ERR_OVERRUN (u_short) (0x1000)
-#define ERR_RUNT (u_short) (0x1300)
-#define ERR_ALIGNMENT (u_short) (0x1400)
-#define ERR_CRC (u_short) (0x1500)
-#define ERR_OVERSIZE (u_short) (0x1100)
-#define ERR_DRIBBLE (u_short) (0x200)
-
-/*
- * TX Status
- *
- * Reports the transmit status of a completed transmission. Writing this
- * register pops the transmit completion stack.
- *
- * Window 1/Port 0x0b.
- *
- * 7: Complete
- * 6: Interrupt on successful transmission requested.
- * 5: Jabber Error (TP Only, TX Reset required. )
- * 4: Underrun (TX Reset required. )
- * 3: Maximum Collisions.
- * 2: TX Status Overflow.
- * 1-0: Undefined.
- *
- */
-#define TXS_COMPLETE 0x80
-#define TXS_INTR_REQ 0x40
-#define TXS_JABBER 0x20
-#define TXS_UNDERRUN 0x10
-#define TXS_MAX_COLLISION 0x8
-#define TXS_STATUS_OVERFLOW 0x4
-
-/*
- * Misc defines for various things.
- */
-#define TAG_ADAPTER_0 0xd0
-#define ACTIVATE_ADAPTER_TO_CONFIG 0xff
-#define ENABLE_DRQ_IRQ 0x0001
-#define MFG_ID 0x6d50
-#define PROD_ID 0x9150
-#define BASE sc->ep_io_addr
-#define GO_WINDOW(x) outw(BASE+EP_COMMAND, WINDOW_SELECT|x)
-#define AUI 0x1
-#define BNC 0x2
-#define UTP 0x4
-#define IS_AUI (1<<13)
-#define IS_BNC (1<<12)
-#define IS_UTP (1<<9)
-#define EEPROM_BUSY (1<<15)
-#define EEPROM_TST_MODE (1<<14)
-#define READ_EEPROM (1<<7)
-#define ENABLE_UTP 0xc0
-#define DISABLE_UTP 0x0
-#define RX_BYTES_MASK (u_short) (0x07ff)
diff --git a/sys/pc98/pc98/lpt.c b/sys/pc98/pc98/lpt.c
index 967910e..1dba7a4 100644
--- a/sys/pc98/pc98/lpt.c
+++ b/sys/pc98/pc98/lpt.c
@@ -46,7 +46,7 @@
* SUCH DAMAGE.
*
* from: unknown origin, 386BSD 0.1
- * $Id: lpt.c,v 1.2 1996/07/23 07:46:24 asami Exp $
+ * $Id: lpt.c,v 1.3 1996/08/31 15:06:59 asami Exp $
*/
/*
@@ -126,7 +126,7 @@
#ifdef PC98
#include <pc98/pc98/pc98.h>
-#include <pc98/pc98/pc98_device.h>
+#include <i386/isa/isa_device.h>
#include <pc98/pc98/lptreg.h>
#else /* !PC98 */
#include <i386/isa/isa.h>
@@ -321,15 +321,9 @@ static struct cdevsw lpt_cdevsw =
static struct kern_devconf kdc_lpt[NLPT] = { {
0, 0, 0, /* filled in by dev_attach */
-#ifdef PC98
- "lpt", 0, { MDDT_PC98, 0, "tty" },
- pc98_generic_externalize, 0, 0, PC98_EXTERNALLEN,
- &kdc_nec0, /* parent */
-#else
"lpt", 0, { MDDT_ISA, 0, "tty" },
isa_generic_externalize, 0, 0, ISA_EXTERNALLEN,
&kdc_isa0, /* parent */
-#endif
0, /* parentdata */
DC_UNCONFIGURED, /* state */
"Parallel printer adapter",
@@ -342,11 +336,7 @@ lpt_registerdev(struct isa_device *id)
if(id->id_unit)
kdc_lpt[id->id_unit] = kdc_lpt[0];
kdc_lpt[id->id_unit].kdc_unit = id->id_unit;
-#ifdef PC98
- kdc_lpt[id->id_unit].kdc_pc98 = id;
-#else
kdc_lpt[id->id_unit].kdc_isa = id;
-#endif
dev_attach(&kdc_lpt[id->id_unit]);
}
diff --git a/sys/pc98/pc98/machdep.c b/sys/pc98/pc98/machdep.c
index 9b439cf..4486b65 100644
--- a/sys/pc98/pc98/machdep.c
+++ b/sys/pc98/pc98/machdep.c
@@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
- * $Id: machdep.c,v 1.2 1996/07/23 07:45:54 asami Exp $
+ * $Id: machdep.c,v 1.3 1996/08/30 10:42:53 asami Exp $
*/
#include "npx.h"
@@ -113,11 +113,10 @@
#include <machine/perfmon.h>
#endif
+#include <i386/isa/isa_device.h>
#ifdef PC98
-#include <pc98/pc98/pc98_device.h>
#include <pc98/pc98/pc98_machdep.h>
#else
-#include <i386/isa/isa_device.h>
#include <i386/isa/rtc.h>
#endif
#include <machine/random.h>
@@ -1073,7 +1072,7 @@ init386(first)
#include "nec.h"
#include "epson.h"
#if NNEC > 0 || NEPSON > 0
- pc98_defaultirq();
+ isa_defaultirq();
#endif
#else /* IBM-PC */
#include "isa.h"
@@ -1115,14 +1114,41 @@ init386(first)
biosextmem = rtcin(RTC_EXTLO)+ (rtcin(RTC_EXTHI)<<8);
/*
- * Print a warning if the official BIOS interface disagrees
- * with the hackish interface used above. Eventually only
- * the official interface should be used.
+ * Print a warning and set it to the safest value if the official
+ * BIOS interface (bootblock supplied) disagrees with the
+ * hackish interface used above. Eventually only the official
+ * interface should be used. This is necessary for some machines
+ * who 'steal' memory from the basemem for use as BIOS memory.
*/
if (bootinfo.bi_memsizes_valid) {
- if (bootinfo.bi_basemem != biosbasemem)
- printf("BIOS basemem (%ldK) != RTC basemem (%dK)\n",
+ if (bootinfo.bi_basemem != biosbasemem) {
+ vm_offset_t pa, va, tmpva;
+ vm_size_t size;
+ unsigned *pte;
+
+ printf("BIOS basemem (%ldK) != RTC basemem (%dK), ",
bootinfo.bi_basemem, biosbasemem);
+ printf("setting to BIOS value.\n");
+ biosbasemem = bootinfo.bi_basemem;
+ /*
+ * XXX - Map this 'hole' of memory in the same manner
+ * as the ISA_HOLE (read/write/non-cacheable), since
+ * the BIOS 'fudges' it to become part of the ISA_HOLE.
+ * This code is similar to the code used in
+ * pmap_mapdev, but since no memory needs to be
+ * allocated we simply change the mapping.
+ */
+ pa = biosbasemem * 1024;
+ va = pa + KERNBASE;
+ size = roundup(ISA_HOLE_START - pa, PAGE_SIZE);
+ for (tmpva = va; size > 0;) {
+ pte = (unsigned *)vtopte(tmpva);
+ *pte = pa | PG_RW | PG_V | PG_N;
+ size -= PAGE_SIZE;
+ tmpva += PAGE_SIZE;
+ pa += PAGE_SIZE;
+ }
+ }
if (bootinfo.bi_extmem != biosextmem)
printf("BIOS extmem (%ldK) != RTC extmem (%dK)\n",
bootinfo.bi_extmem, biosextmem);
diff --git a/sys/pc98/pc98/matcd/matcd.c b/sys/pc98/pc98/matcd/matcd.c
index 38dde6a..26c25e7 100644
--- a/sys/pc98/pc98/matcd/matcd.c
+++ b/sys/pc98/pc98/matcd/matcd.c
@@ -337,7 +337,7 @@ static char MATCDVERSION[]="Version 1(26) 18-Oct-95";
static char MATCDCOPYRIGHT[] = "Matsushita CD-ROM driver, Copr. 1994,1995 Frank Durda IV";
/* The proceeding strings may not be changed*/
-/* $Id: matcd.c,v 1.2 1996/07/30 18:56:16 asami Exp $ */
+/* $Id: matcd.c,v 1.3 1996/08/31 15:07:38 asami Exp $ */
/*---------------------------------------------------------------------------
Include declarations
@@ -493,15 +493,9 @@ struct matcd_read2 {
static struct kern_devconf kdc_matcd[TOTALDRIVES] = { {
0,0,0, /*Filled in by dev_attach*/
-#ifdef PC98
- "matcdc",0,{MDDT_PC98,0,"bio"},
- pc98_generic_externalize,0,0,PC98_EXTERNALLEN,
- &kdc_nec0, /*<12>Parent*/
-#else
"matcdc",0,{MDDT_ISA,0,"bio"},
isa_generic_externalize,0,0,ISA_EXTERNALLEN,
&kdc_isa0, /*<12>Parent*/
-#endif
0, /*<12>Parent Data*/
DC_IDLE, /*<12>Status*/
"Matsushita CD-ROM Controller" /*<12>This is the description*/
@@ -1360,11 +1354,7 @@ static inline void matcd_register(struct isa_device *id)
kdc_matcd[id->id_unit]=kdc_matcd[0];
}
kdc_matcd[id->id_unit].kdc_unit=id->id_unit;
-#ifdef PC98
- kdc_matcd[id->id_unit].kdc_pc98=id;
-#else
kdc_matcd[id->id_unit].kdc_isa=id;
-#endif
dev_attach(&kdc_matcd[id->id_unit]);
return;
}
diff --git a/sys/pc98/pc98/mse.c b/sys/pc98/pc98/mse.c
index be2f02d..4450bbe 100644
--- a/sys/pc98/pc98/mse.c
+++ b/sys/pc98/pc98/mse.c
@@ -11,7 +11,7 @@
* this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
- * $Id: mse.c,v 1.1.1.1 1996/06/14 10:04:45 asami Exp $
+ * $Id: mse.c,v 1.2 1996/08/31 15:07:01 asami Exp $
*/
/*
* Driver for the Logitech and ATI Inport Bus mice for use with 386bsd and
@@ -61,11 +61,9 @@
#include <machine/clock.h>
+#include <i386/isa/isa_device.h>
#ifdef PC98
-#include <pc98/pc98/pc98_device.h>
#include <pc98/pc98/icu.h>
-#else
-#include <i386/isa/isa_device.h>
#endif
@@ -261,15 +259,9 @@ static struct mse_types {
static struct kern_devconf kdc_mse[NMSE] = { {
0, 0, 0, /* filled in by dev_attach */
-#ifdef PC98
- "mse", 0, { MDDT_PC98, 0, "tty" },
- pc98_generic_externalize, 0, 0, PC98_EXTERNALLEN,
- &kdc_nec0, /* parent */
-#else
"mse", 0, { MDDT_ISA, 0, "tty" },
isa_generic_externalize, 0, 0, ISA_EXTERNALLEN,
&kdc_isa0, /* parent */
-#endif
0, /* parentdata */
DC_UNCONFIGURED, /* state */
"ATI or Logitech bus mouse adapter",
@@ -282,11 +274,7 @@ mse_registerdev(struct isa_device *id)
if(id->id_unit)
kdc_mse[id->id_unit] = kdc_mse[0];
kdc_mse[id->id_unit].kdc_unit = id->id_unit;
-#ifdef PC98
- kdc_mse[id->id_unit].kdc_pc98 = id;
-#else
kdc_mse[id->id_unit].kdc_isa = id;
-#endif
dev_attach(&kdc_mse[id->id_unit]);
}
diff --git a/sys/pc98/pc98/npx.c b/sys/pc98/pc98/npx.c
index 3a033ca..8687f34 100644
--- a/sys/pc98/pc98/npx.c
+++ b/sys/pc98/pc98/npx.c
@@ -32,7 +32,7 @@
* SUCH DAMAGE.
*
* from: @(#)npx.c 7.2 (Berkeley) 5/12/91
- * $Id: npx.c,v 1.2 1996/07/23 07:46:26 asami Exp $
+ * $Id: npx.c,v 1.3 1996/08/31 15:07:03 asami Exp $
*/
#include "npx.h"
@@ -61,7 +61,7 @@
#ifdef PC98
#include <pc98/pc98/icu.h>
-#include <pc98/pc98/pc98_device.h>
+#include <i386/isa/isa_device.h>
#include <pc98/pc98/pc98.h>
#else
#include <i386/isa/icu.h>
@@ -175,15 +175,9 @@ _probetrap:
static struct kern_devconf kdc_npx[NNPX] = { {
0, 0, 0, /* filled in by dev_attach */
-#ifdef PC98
- "npx", 0, { MDDT_PC98, 0 },
- pc98_generic_externalize, 0, 0, PC98_EXTERNALLEN,
- &kdc_nec0, /* parent */
-#else
"npx", 0, { MDDT_ISA, 0 },
isa_generic_externalize, 0, 0, ISA_EXTERNALLEN,
&kdc_isa0, /* parent */
-#endif
0, /* parentdata */
DC_UNCONFIGURED, /* state */
"Floating-point unit",
@@ -199,11 +193,7 @@ npx_registerdev(struct isa_device *id)
if (unit != 0)
kdc_npx[unit] = kdc_npx[0];
kdc_npx[unit].kdc_unit = unit;
-#ifdef PC98
- kdc_npx[unit].kdc_pc98 = id;
-#else
kdc_npx[unit].kdc_isa = id;
-#endif
dev_attach(&kdc_npx[unit]);
}
diff --git a/sys/pc98/pc98/pc98.c b/sys/pc98/pc98/pc98.c
index e213ce0..670fc18 100644
--- a/sys/pc98/pc98/pc98.c
+++ b/sys/pc98/pc98/pc98.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)isa.c 7.2 (Berkeley) 5/13/91
- * $Id: pc98.c,v 1.2 1996/07/23 07:46:28 asami Exp $
+ * $Id: pc98.c,v 1.3 1996/08/31 15:07:05 asami Exp $
*/
/*
@@ -42,7 +42,7 @@
*
* 92/08/18 Frank P. MacLachlan (fpm@crash.cts.com):
* Fixed uninitialized variable problem and added code to deal
- * with DMA page boundaries in pc98_dmarangecheck(). Fixed word
+ * with DMA page boundaries in isa_dmarangecheck(). Fixed word
* mode DMA count compution and reorganized DMA setup code in
* isa_dmastart()
*/
@@ -50,7 +50,7 @@
/*
* modified for PC9801 by A.Kojima F.Ukai M.Ishii
* Kyoto University Microcomputer Club (KMC)
- * $Id: pc98.c,v 1.2 1996/07/23 07:46:28 asami Exp $
+ * $Id: pc98.c,v 1.3 1994/03/17 23:24:40 kakefuda Exp $
*/
#include "opt_auto_eoi.h"
@@ -67,13 +67,12 @@
#include <vm/vm.h>
#include <vm/vm_param.h>
#include <vm/pmap.h>
+#include <i386/isa/isa_device.h>
#ifdef PC98
-#include <pc98/pc98/pc98_device.h>
#include <pc98/pc98/pc98.h>
#include <pc98/pc98/icu.h>
#include <pc98/pc98/ic/i8237.h>
#else
-#include <i386/isa/isa_device.h>
#include <i386/isa/isa.h>
#include <i386/isa/icu.h>
#include <i386/isa/ic/i8237.h>
@@ -115,7 +114,7 @@ void ddb_outb __P((unsigned int addr, unsigned char dt));
extern struct kern_devconf kdc_cpu0;
#ifdef PC98
-struct kern_devconf kdc_nec0 = {
+struct kern_devconf kdc_isa0 = {
0, 0, 0, /* filled in by dev_attach */
"nec", 0, { MDDT_BUS, 0 },
0, 0, 0, BUS_EXTERNALLEN,
@@ -165,7 +164,7 @@ static void conflict __P((struct isa_device *dvp, struct isa_device *tmpdvp,
char const *format));
static int haveseen __P((struct isa_device *dvp, struct isa_device *tmpdvp,
u_int checkbits));
-static int pc98_dmarangecheck __P((caddr_t va, u_int length, int chan));
+static int isa_dmarangecheck __P((caddr_t va, u_int length, int chan));
static inthand2_t pc98_strayintr;
#else
static void config_isadev __P((struct isa_device *isdp, u_int *mp));
@@ -281,29 +280,29 @@ haveseen(dvp, tmpdvp, checkbits)
* conflicts with the current device.
*/
int
-haveseen_pc98dev(dvp, checkbits)
+haveseen_isadev(dvp, checkbits)
struct isa_device *dvp;
u_int checkbits;
{
struct isa_device *tmpdvp;
int status = 0;
- for (tmpdvp = pc98_devtab_tty; tmpdvp->id_driver; tmpdvp++) {
+ for (tmpdvp = isa_devtab_tty; tmpdvp->id_driver; tmpdvp++) {
status |= haveseen(dvp, tmpdvp, checkbits);
if (status)
return status;
}
- for (tmpdvp = pc98_devtab_bio; tmpdvp->id_driver; tmpdvp++) {
+ for (tmpdvp = isa_devtab_bio; tmpdvp->id_driver; tmpdvp++) {
status |= haveseen(dvp, tmpdvp, checkbits);
if (status)
return status;
}
- for (tmpdvp = pc98_devtab_net; tmpdvp->id_driver; tmpdvp++) {
+ for (tmpdvp = isa_devtab_net; tmpdvp->id_driver; tmpdvp++) {
status |= haveseen(dvp, tmpdvp, checkbits);
if (status)
return status;
}
- for (tmpdvp = pc98_devtab_null; tmpdvp->id_driver; tmpdvp++) {
+ for (tmpdvp = isa_devtab_null; tmpdvp->id_driver; tmpdvp++) {
status |= haveseen(dvp, tmpdvp, checkbits);
if (status)
return status;
@@ -315,38 +314,38 @@ haveseen_pc98dev(dvp, checkbits)
* Configure all PC98 devices
*/
void
-pc98_configure() {
+isa_configure() {
struct isa_device *dvp;
- dev_attach(&kdc_nec0);
+ dev_attach(&kdc_isa0);
splhigh();
printf("Probing for devices on the PC98 bus:\n");
/* First probe all the sensitive probes */
- for (dvp = pc98_devtab_tty; dvp->id_driver; dvp++)
+ for (dvp = isa_devtab_tty; dvp->id_driver; dvp++)
if (dvp->id_driver->sensitive_hw)
config_pc98dev(dvp, &tty_imask);
- for (dvp = pc98_devtab_bio; dvp->id_driver; dvp++)
+ for (dvp = isa_devtab_bio; dvp->id_driver; dvp++)
if (dvp->id_driver->sensitive_hw)
config_pc98dev(dvp, &bio_imask);
- for (dvp = pc98_devtab_net; dvp->id_driver; dvp++)
+ for (dvp = isa_devtab_net; dvp->id_driver; dvp++)
if (dvp->id_driver->sensitive_hw)
config_pc98dev(dvp, &net_imask);
- for (dvp = pc98_devtab_null; dvp->id_driver; dvp++)
+ for (dvp = isa_devtab_null; dvp->id_driver; dvp++)
if (dvp->id_driver->sensitive_hw)
config_pc98dev(dvp, (u_int *)NULL);
/* Then all the bad ones */
- for (dvp = pc98_devtab_tty; dvp->id_driver; dvp++)
+ for (dvp = isa_devtab_tty; dvp->id_driver; dvp++)
if (!dvp->id_driver->sensitive_hw)
config_pc98dev(dvp, &tty_imask);
- for (dvp = pc98_devtab_bio; dvp->id_driver; dvp++)
+ for (dvp = isa_devtab_bio; dvp->id_driver; dvp++)
if (!dvp->id_driver->sensitive_hw)
config_pc98dev(dvp, &bio_imask);
- for (dvp = pc98_devtab_net; dvp->id_driver; dvp++)
+ for (dvp = isa_devtab_net; dvp->id_driver; dvp++)
if (!dvp->id_driver->sensitive_hw)
config_pc98dev(dvp, &net_imask);
- for (dvp = pc98_devtab_null; dvp->id_driver; dvp++)
+ for (dvp = isa_devtab_null; dvp->id_driver; dvp++)
if (!dvp->id_driver->sensitive_hw)
config_pc98dev(dvp, (u_int *)NULL);
@@ -384,13 +383,13 @@ pc98_configure() {
* unregister_intr() will have to adjust the masks for _all_
* interrupts and for tty_imask, etc.
*/
- for (dvp = pc98_devtab_tty; dvp->id_driver; dvp++)
+ for (dvp = isa_devtab_tty; dvp->id_driver; dvp++)
register_imask(dvp, tty_imask);
- for (dvp = pc98_devtab_bio; dvp->id_driver; dvp++)
+ for (dvp = isa_devtab_bio; dvp->id_driver; dvp++)
register_imask(dvp, bio_imask);
- for (dvp = pc98_devtab_net; dvp->id_driver; dvp++)
+ for (dvp = isa_devtab_net; dvp->id_driver; dvp++)
register_imask(dvp, net_imask);
- for (dvp = pc98_devtab_null; dvp->id_driver; dvp++)
+ for (dvp = isa_devtab_null; dvp->id_driver; dvp++)
register_imask(dvp, SWI_CLOCK_MASK);
spl0();
}
@@ -409,7 +408,7 @@ config_pc98dev(isdp, mp)
}
void
-reconfig_pc98dev(isdp, mp)
+reconfig_isadev(isdp, mp)
struct isa_device *isdp;
u_int *mp;
{
@@ -433,7 +432,7 @@ config_pc98dev_c(isdp, mp, reconfig)
return;
}
checkbits = CC_DRQ | CC_IOADDR | CC_MEMADDR;
- if (!reconfig && haveseen_pc98dev(isdp, checkbits))
+ if (!reconfig && haveseen_isadev(isdp, checkbits))
return;
if (!reconfig && isdp->id_maddr) {
isdp->id_maddr -= 0xa0000; /* XXX should be a define */
@@ -501,7 +500,7 @@ config_pc98dev_c(isdp, mp, reconfig)
* a check for IRQs in the next group of checks.
*/
checkbits |= CC_IRQ;
- if (haveseen_pc98dev(isdp, checkbits))
+ if (haveseen_isadev(isdp, checkbits))
return;
isdp->id_alive = id_alive;
}
@@ -546,7 +545,7 @@ config_pc98dev_c(isdp, mp, reconfig)
* hw.devconf interface.
*/
int
-pc98_externalize(struct isa_device *id, struct sysctl_req *req)
+isa_externalize(struct isa_device *id, struct sysctl_req *req)
{
return (SYSCTL_OUT(req, id, sizeof *id));
}
@@ -557,7 +556,7 @@ pc98_externalize(struct isa_device *id, struct sysctl_req *req)
* what the `internalize' routine is supposed to do.
*/
int
-pc98_internalize(struct isa_device *id, struct sysctl_req *req)
+isa_internalize(struct isa_device *id, struct sysctl_req *req)
{
struct isa_device myid;
int rv;
@@ -573,9 +572,9 @@ pc98_internalize(struct isa_device *id, struct sysctl_req *req)
}
int
-pc98_generic_externalize(struct kern_devconf *kdc, struct sysctl_req *req)
+isa_generic_externalize(struct kern_devconf *kdc, struct sysctl_req *req)
{
- return pc98_externalize(kdc->kdc_pc98, req);
+ return isa_externalize(kdc->kdc_isa, req);
}
/*
@@ -583,7 +582,7 @@ pc98_generic_externalize(struct kern_devconf *kdc, struct sysctl_req *req)
* during configuration of kernel, setup interrupt control unit
*/
void
-pc98_defaultirq()
+isa_defaultirq()
{
int i;
@@ -666,7 +665,7 @@ static short dmapageport[8] =
* Setup a DMA channel's bounce buffer.
*/
void
-pc98_dmainit(chan, bouncebufsize)
+isa_dmainit(chan, bouncebufsize)
int chan;
u_int bouncebufsize;
{
@@ -674,10 +673,10 @@ pc98_dmainit(chan, bouncebufsize)
#ifdef DIAGNOSTIC
if (chan & ~VALID_DMA_MASK)
- panic("pc98_dmainit: channel out of range");
+ panic("isa_dmainit: channel out of range");
if (dma_bouncebuf[chan] != NULL)
- panic("pc98_dmainit: impossible request");
+ panic("isa_dmainit: impossible request");
#endif
dma_bouncebufsize[chan] = bouncebufsize;
@@ -685,7 +684,7 @@ pc98_dmainit(chan, bouncebufsize)
/* Try malloc() first. It works better if it works. */
buf = malloc(bouncebufsize, M_DEVBUF, M_NOWAIT);
if (buf != NULL) {
- if (pc98_dmarangecheck(buf, bouncebufsize, chan) == 0) {
+ if (isa_dmarangecheck(buf, bouncebufsize, chan) == 0) {
dma_bouncebuf[chan] = buf;
return;
}
@@ -694,7 +693,7 @@ pc98_dmainit(chan, bouncebufsize)
buf = contigmalloc(bouncebufsize, M_DEVBUF, M_NOWAIT, 0ul, 0xfffffful,
1ul, chan & 4 ? 0x20000ul : 0x10000ul);
if (buf == NULL)
- printf("pc98_dmainit(%d, %d) failed\n", chan, bouncebufsize);
+ printf("isa_dmainit(%d, %d) failed\n", chan, bouncebufsize);
else
dma_bouncebuf[chan] = buf;
}
@@ -704,16 +703,16 @@ pc98_dmainit(chan, bouncebufsize)
* in open() or during it's initialization.
*/
int
-pc98_dma_acquire(chan)
+isa_dma_acquire(chan)
int chan;
{
#ifdef DIAGNOSTIC
if (chan & ~VALID_DMA_MASK)
- panic("pc98_dma_acquire: channel out of range");
+ panic("isa_dma_acquire: channel out of range");
#endif
if (dma_inuse & (1 << chan)) {
- printf("pc98_dma_acquire: channel %d already in use\n", chan);
+ printf("isa_dma_acquire: channel %d already in use\n", chan);
return (EBUSY);
}
dma_inuse |= (1 << chan);
@@ -726,15 +725,15 @@ pc98_dma_acquire(chan)
* during close() or during it's shutdown.
*/
void
-pc98_dma_release(chan)
+isa_dma_release(chan)
int chan;
{
#ifdef DIAGNOSTIC
if (chan & ~VALID_DMA_MASK)
- panic("pc98_dma_release: channel out of range");
+ panic("isa_dma_release: channel out of range");
if (dma_inuse & (1 << chan) == 0)
- printf("pc98_dma_release: channel %d not in use\n", chan);
+ printf("isa_dma_release: channel %d not in use\n", chan);
#endif
if (dma_busy & (1 << chan)) {
@@ -752,15 +751,15 @@ pc98_dma_release(chan)
#ifndef PC98
/*
- * pc98_dmacascade(): program 8237 DMA controller channel to accept
+ * isa_dmacascade(): program 8237 DMA controller channel to accept
* external dma control by a board.
*/
-void pc98_dmacascade(chan)
+void isa_dmacascade(chan)
int chan;
{
#ifdef DIAGNOSTIC
if (chan & ~VALID_DMA_MASK)
- panic("pc98_dmacascade: channel out of range");
+ panic("isa_dmacascade: channel out of range");
#endif
/* set dma channel mode, and set dma channel mode */
@@ -775,10 +774,10 @@ void pc98_dmacascade(chan)
#endif
/*
- * pc98_dmastart(): program 8237 DMA controller channel, avoid page alignment
+ * isa_dmastart(): program 8237 DMA controller channel, avoid page alignment
* problems by using a bounce buffer.
*/
-void pc98_dmastart(int flags, caddr_t addr, u_int nbytes, int chan)
+void isa_dmastart(int flags, caddr_t addr, u_int nbytes, int chan)
{
vm_offset_t phys;
int modeport, waport, mskport;
@@ -787,25 +786,25 @@ void pc98_dmastart(int flags, caddr_t addr, u_int nbytes, int chan)
#ifdef DIAGNOSTIC
if (chan & ~VALID_DMA_MASK)
- panic("pc98_dmastart: channel out of range");
+ panic("isa_dmastart: channel out of range");
if ((chan < 4 && nbytes > (1<<16))
|| (chan >= 4 && (nbytes > (1<<17) || (u_int)addr & 1)))
- panic("pc98_dmastart: impossible request");
+ panic("isa_dmastart: impossible request");
if (dma_inuse & (1 << chan) == 0)
- printf("pc98_dmastart: channel %d not acquired\n", chan);
+ printf("isa_dmastart: channel %d not acquired\n", chan);
#endif
if (dma_busy & (1 << chan))
- printf("pc98_dmastart: channel %d busy\n", chan);
+ printf("isa_dmastart: channel %d busy\n", chan);
dma_busy |= (1 << chan);
- if (pc98_dmarangecheck(addr, nbytes, chan)) {
+ if (isa_dmarangecheck(addr, nbytes, chan)) {
if (dma_bouncebuf[chan] == NULL
|| dma_bouncebufsize[chan] < nbytes)
- panic("pc98_dmastart: bad bounce buffer");
+ panic("isa_dmastart: bad bounce buffer");
dma_bounced |= (1 << chan);
newaddr = dma_bouncebuf[chan];
@@ -861,7 +860,7 @@ void pc98_dmastart(int flags, caddr_t addr, u_int nbytes, int chan)
splx(s); /* mask off */
}
-void pc98_dmadone(int flags, caddr_t addr, int nbytes, int chan)
+void isa_dmadone(int flags, caddr_t addr, int nbytes, int chan)
{
#if defined(CYRIX_486DLC) || defined(IBM_486SLC)
if (flags & B_READ) {
@@ -872,10 +871,10 @@ void pc98_dmadone(int flags, caddr_t addr, int nbytes, int chan)
#ifdef DIAGNOSTIC
if (chan & ~VALID_DMA_MASK)
- panic("pc98_dmadone: channel out of range");
+ panic("isa_dmadone: channel out of range");
if (dma_inuse & (1 << chan) == 0)
- printf("pc98_dmadone: channel %d not acquired\n", chan);
+ printf("isa_dmadone: channel %d not acquired\n", chan);
#endif
#if 0
@@ -885,7 +884,7 @@ void pc98_dmadone(int flags, caddr_t addr, int nbytes, int chan)
* leave this in, drivers that do this will print this continuously.
*/
if (dma_busy & (1 << chan) == 0)
- printf("pc98_dmadone: channel %d not busy\n", chan);
+ printf("isa_dmadone: channel %d not busy\n", chan);
#endif
if (dma_bounced & (1 << chan)) {
@@ -906,7 +905,7 @@ void pc98_dmadone(int flags, caddr_t addr, int nbytes, int chan)
*/
int
-pc98_dmarangecheck(caddr_t va, u_int length, int chan) {
+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);
@@ -919,7 +918,7 @@ pc98_dmarangecheck(caddr_t va, u_int length, int chan) {
#define PC98RAM_END RAM_END
#endif
if (phys == 0)
- panic("pc98_dmacheck: no physical page present");
+ panic("isa_dmacheck: no physical page present");
if (phys >= PC98RAM_END)
return (1);
if (priorpage) {
@@ -950,7 +949,7 @@ pc98_dmarangecheck(caddr_t va, u_int length, int chan) {
* return true to panic system, false to ignore.
*/
int
-pc98_nmi(cd)
+isa_nmi(cd)
int cd;
{
#ifdef PC98
@@ -1028,31 +1027,25 @@ pc98_strayintr(d)
struct isa_device *
find_display()
{
-#ifdef PC98
- struct isa_device *dvp;
-
- for (dvp = pc98_devtab_tty; dvp->id_driver != NULL; dvp++)
-#else
struct isa_device *dvp;
for (dvp = isa_devtab_tty; dvp->id_driver != NULL; dvp++)
-#endif
if (dvp->id_driver->sensitive_hw && dvp->id_enabled)
return (dvp);
return (NULL);
}
/*
- * find an PC98 device in a given pc98_devtab_* table, given
+ * find an PC98 device in a given isa_devtab_* table, given
* the table to search, the expected id_driver entry, and the unit number.
*
- * this function is defined in pc98_device.h, and this location is debatable;
+ * this function is defined in isa_device.h, and this location is debatable;
* i put it there because it's useless w/o, and directly operates on
* the other stuff in that file.
*
*/
-struct isa_device *find_pc98dev(table, driverp, unit)
+struct isa_device *find_isadev(table, driverp, unit)
struct isa_device *table;
struct isa_driver *driverp;
int unit;
@@ -1074,7 +1067,7 @@ struct isa_device *find_pc98dev(table, driverp, unit)
* Return nonzero if a (masked) irq is pending for a given device.
*/
int
-pc98_irq_pending(dvp)
+isa_irq_pending(dvp)
struct isa_device *dvp;
{
unsigned id_irq;
diff --git a/sys/pc98/pc98/pc98.h b/sys/pc98/pc98/pc98.h
index 806c840..9630778 100644
--- a/sys/pc98/pc98/pc98.h
+++ b/sys/pc98/pc98/pc98.h
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)isa.h 5.7 (Berkeley) 5/9/91
- * $Id: isa.h,v 1.18 1996/01/30 22:55:57 mpp Exp $
+ * $Id: pc98.h,v 1.1.1.1 1996/06/14 10:04:45 asami Exp $
*/
#ifndef _PC98_PC98_PC98_H_
@@ -182,4 +182,50 @@
*/
#define MADDRUNK -1
+#define PC98_VECTOR_SIZE (0x400)
+#define PC98_SYSTEM_PARAMETER_SIZE (0x230)
+
+#define PC98_SAVE_AREA(highreso_flag) (0xa1000)
+#define PC98_SAVE_AREA_ADDRESS (0x10)
+
+#define OFS_BOOT_boothowto 0x210
+#define OFS_BOOT_bootdev 0x214
+#define OFS_BOOT_cyloffset 0x218
+#define OFS_WD_BIOS_SECSIZE(i) (0x200+(i)*6)
+#define OFS_WD_BIOS_NCYL(i) (0x202+(i)*6)
+#define OFS_WD_BIOS_HEAD(i) (0x205+(i)*6)
+#define OFS_WD_BIOS_SEC(i) (0x204+(i)*6)
+#define OFS_pc98_machine_type 0x220
+#define OFS_epson_machine_id 0x224
+#define OFS_epson_bios_id 0x225
+#define OFS_epson_system_type 0x226
+
+#define M_NEC_PC98 0x0001
+#define M_EPSON_PC98 0x0002
+#define M_NOT_H98 0x0010
+#define M_H98 0x0020
+#define M_NOTE 0x0040
+#define M_NORMAL 0x1000
+#define M_HIGHRESO 0x2000
+#define M_8M 0x8000
+
+#if defined(KERNEL) && !defined(LOCORE)
+/* BIOS parameter block */
+extern unsigned char pc98_system_parameter[]; /* in locore.c */
+#define PC98_SYSTEM_PARAMETER(x) pc98_system_parameter[(x)-0x400]
+#define BOOT_boothowto (*(unsigned long*)(&pc98_system_parameter[OFS_BOOT_boothowto]))
+#define BOOT_bootdev (*(unsigned long*)(&pc98_system_parameter[OFS_BOOT_bootdev]))
+#define BOOT_cyloffset (*(unsigned long*)(&pc98_system_parameter[OFS_BOOT_cyloffset]))
+#define WD_BIOS_SECSIZE(i) (*(unsigned short*)(&pc98_system_parameter[OFS_WD_BIOS_SECSIZE(i)]))
+#define WD_BIOS_NCYL(i) (*(unsigned short*)(&pc98_system_parameter[OFS_WD_BIOS_NCYL(i)]))
+#define WD_BIOS_HEAD(i) (pc98_system_parameter[OFS_WD_BIOS_HEAD(i)])
+#define WD_BIOS_SEC(i) (pc98_system_parameter[OFS_WD_BIOS_SEC(i)])
+#define pc98_machine_type (*(unsigned long*)&pc98_system_parameter[OFS_pc98_machine_type])
+#define epson_machine_id (pc98_system_parameter[OFS_epson_machine_id])
+#define epson_bios_id (pc98_system_parameter[OFS_epson_bios_id])
+#define epson_system_type (pc98_system_parameter[OFS_epson_system_type])
+
+# define PC98_TYPE_CHECK(x) ((pc98_machine_type & (x)) == (x))
+#endif /* KERNEL */
+
#endif /* !_PC98_PC98_PC98_H_ */
diff --git a/sys/pc98/pc98/pc98_device.h b/sys/pc98/pc98/pc98_device.h
deleted file mode 100644
index d242e79..0000000
--- a/sys/pc98/pc98/pc98_device.h
+++ /dev/null
@@ -1,248 +0,0 @@
-/*-
- * Copyright (c) 1991 The Regents of the University of California.
- * All rights reserved.
- *
- * 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_device.h 7.1 (Berkeley) 5/9/91
- * $Id: pc98_device.h,v 1.1.1.1 1996/06/14 10:04:45 asami Exp $
- */
-
-#ifndef _PC98_PC98_PC98_DEVICE_H_
-#define _PC98_PC98_PC98_DEVICE_H_
-
-/*
- * PC98 Bus Autoconfiguration
- */
-/*
- * modified for PC9801 by A.Kojima F.Ukai M.Ishii
- * Kyoto University Microcomputer Club (KMC)
- */
-
-#define IDTVEC(name) __CONCAT(X,name)
-
-/*
- * Type of the first (asm) part of an interrupt handler.
- */
-typedef void inthand_t __P((u_int cs, u_int ef, u_int esp, u_int ss));
-
-/*
- * Usual type of the second (C) part of an interrupt handler. Some bogus
- * ones need the arg to be the interrupt frame (and not a copy of it, which
- * is all that is possible in C).
- */
-typedef void inthand2_t __P((int unit));
-
-/*
- * Bits to specify the type and amount of conflict checking.
- */
-#define CC_ATTACH (1 << 0)
-#define CC_DRQ (1 << 1)
-#define CC_IOADDR (1 << 2)
-#define CC_IRQ (1 << 3)
-#define CC_MEMADDR (1 << 4)
-
-/*
- * Per device structure.
- *
- * XXX Note: id_conflicts should either become an array of things we're
- * specifically allowed to conflict with or be subsumed into some
- * more powerful mechanism for detecting and dealing with multiple types
- * of non-fatal conflict. -jkh XXX
- */
-struct isa_device {
- int id_id; /* device id */
- struct isa_driver *id_driver;
- int id_iobase; /* base i/o address */
- u_short id_irq; /* interrupt request */
- short id_drq; /* DMA request */
- caddr_t id_maddr; /* physical i/o memory address on bus (if any)*/
- int id_msize; /* size of i/o memory */
- inthand2_t *id_intr; /* interrupt interface routine */
- int id_unit; /* unit number */
- int id_flags; /* flags */
- int id_scsiid; /* scsi id if needed */
- int id_alive; /* device is present */
-#define RI_FAST 1 /* fast interrupt handler */
- u_int id_ri_flags; /* flags for register_intr() */
- int id_reconfig; /* hot eject device support (such as PCMCIA) */
- int id_enabled; /* is device enabled */
- int id_conflicts; /* we're allowed to conflict with things */
- struct isa_device *id_next; /* used in isa_devlist in userconfig() */
-};
-
-/*
- * Per-driver structure.
- *
- * Each device driver defines entries for a set of routines
- * as well as an array of types which are acceptable to it.
- * These are used at boot time by the configuration program.
- */
-struct isa_driver {
- int (*probe) __P((struct isa_device *idp));
- /* test whether device is present */
- int (*attach) __P((struct isa_device *idp));
- /* setup driver for a device */
- char *name; /* device name */
- int sensitive_hw; /* true if other probes confuse us */
-};
-
-#define PC98_EXTERNALLEN (sizeof(struct isa_device))
-
-#ifdef KERNEL
-
-extern char eintrnames[]; /* end of intrnames[] */
-extern u_long intrcnt[]; /* counts for for each device and stray */
-extern char intrnames[]; /* string table containing device names */
-extern u_long *intr_countp[]; /* pointers into intrcnt[] */
-extern inthand2_t *intr_handler[]; /* C entry points of intr handlers */
-extern u_int intr_mask[]; /* sets of intrs masked during handling of 1 */
-extern int intr_unit[]; /* cookies to pass to intr handlers */
-
-extern struct isa_device pc98_biotab_fdc[];
-extern struct isa_device pc98_biotab_wdc[];
-extern struct isa_device pc98_devtab_bio[];
-extern struct isa_device pc98_devtab_net[];
-extern struct isa_device pc98_devtab_null[];
-extern struct isa_device pc98_devtab_tty[];
-extern struct kern_devconf kdc_nec0;
-
-struct kern_devconf;
-struct sysctl_req;
-
-inthand_t
- IDTVEC(fastintr0), IDTVEC(fastintr1),
- IDTVEC(fastintr2), IDTVEC(fastintr3),
- IDTVEC(fastintr4), IDTVEC(fastintr5),
- IDTVEC(fastintr6), IDTVEC(fastintr7),
- IDTVEC(fastintr8), IDTVEC(fastintr9),
- IDTVEC(fastintr10), IDTVEC(fastintr11),
- IDTVEC(fastintr12), IDTVEC(fastintr13),
- IDTVEC(fastintr14), IDTVEC(fastintr15);
-inthand_t
- IDTVEC(intr0), IDTVEC(intr1), IDTVEC(intr2), IDTVEC(intr3),
- IDTVEC(intr4), IDTVEC(intr5), IDTVEC(intr6), IDTVEC(intr7),
- IDTVEC(intr8), IDTVEC(intr9), IDTVEC(intr10), IDTVEC(intr11),
- IDTVEC(intr12), IDTVEC(intr13), IDTVEC(intr14), IDTVEC(intr15);
-
-struct isa_device *
- find_display __P((void));
-struct isa_device *
- find_pc98dev __P((struct isa_device *table, struct isa_driver *driverp,
- int unit));
-int haveseen_pc98dev __P((struct isa_device *dvp, u_int checkbits));
-void pc98_configure __P((void));
-void pc98_defaultirq __P((void));
-void pc98_dmacascade __P((int chan));
-void pc98_dmadone __P((int flags, caddr_t addr, int nbytes, int chan));
-void pc98_dmainit __P((int chan, u_int bouncebufsize));
-void pc98_dmastart __P((int flags, caddr_t addr, u_int nbytes, int chan));
-int pc98_dma_acquire __P((int chan));
-void pc98_dma_release __P((int chan));
-int pc98_externalize __P((struct isa_device *id, struct sysctl_req *req));
-int pc98_generic_externalize __P((struct kern_devconf *kdc,
- struct sysctl_req *req));
-int pc98_internalize __P((struct isa_device *id, struct sysctl_req *req));
-int pc98_irq_pending __P((struct isa_device *dvp));
-int pc98_nmi __P((int cd));
-void reconfig_pc98dev __P((struct isa_device *isdp, u_int *mp));
-int register_intr __P((int intr, int device_id, u_int flags,
- inthand2_t *handler, u_int *maskptr, int unit));
-int unregister_intr __P((int intr, inthand2_t *handler));
-int update_intr_masks __P((void));
-
-#endif /* KERNEL */
-
-#ifdef PC98
-#if 1
-#define PC98_VECTOR_SIZE (0x400)
-#define PC98_SYSTEM_PARAMETER_SIZE (0x230)
-
-#define PC98_SAVE_AREA(highreso_flag) (0xa1000)
-#define PC98_SAVE_AREA_ADDRESS (0x10)
-
-#define OFS_BOOT_boothowto 0x210
-#define OFS_BOOT_bootdev 0x214
-#define OFS_BOOT_cyloffset 0x218
-#define OFS_WD_BIOS_SECSIZE(i) (0x200+(i)*6)
-#define OFS_WD_BIOS_NCYL(i) (0x202+(i)*6)
-#define OFS_WD_BIOS_HEAD(i) (0x205+(i)*6)
-#define OFS_WD_BIOS_SEC(i) (0x204+(i)*6)
-#define OFS_pc98_machine_type 0x220
-#define OFS_epson_machine_id 0x224
-#define OFS_epson_bios_id 0x225
-#define OFS_epson_system_type 0x226
-
-#define M_NEC_PC98 0x0001
-#define M_EPSON_PC98 0x0002
-#define M_NOT_H98 0x0010
-#define M_H98 0x0020
-#define M_NOTE 0x0040
-#define M_NORMAL 0x1000
-#define M_HIGHRESO 0x2000
-#define M_8M 0x8000
-
-# ifdef KERNEL
-
-extern unsigned char pc98_system_parameter[]; /* in locore.c */
-
-#define PC98_SYSTEM_PARAMETER(x) pc98_system_parameter[(x)-0x400]
-#define BOOT_boothowto (*(unsigned long*)(&pc98_system_parameter[OFS_BOOT_boothowto]))
-#define BOOT_bootdev (*(unsigned long*)(&pc98_system_parameter[OFS_BOOT_bootdev]))
-#define BOOT_cyloffset (*(unsigned long*)(&pc98_system_parameter[OFS_BOOT_cyloffset]))
-#define WD_BIOS_SECSIZE(i) (*(unsigned short*)(&pc98_system_parameter[OFS_WD_BIOS_SECSIZE(i)]))
-#define WD_BIOS_NCYL(i) (*(unsigned short*)(&pc98_system_parameter[OFS_WD_BIOS_NCYL(i)]))
-#define WD_BIOS_HEAD(i) (pc98_system_parameter[OFS_WD_BIOS_HEAD(i)])
-#define WD_BIOS_SEC(i) (pc98_system_parameter[OFS_WD_BIOS_SEC(i)])
-#define pc98_machine_type (*(unsigned long*)&pc98_system_parameter[OFS_pc98_machine_type])
-#define epson_machine_id (pc98_system_parameter[OFS_epson_machine_id])
-#define epson_bios_id (pc98_system_parameter[OFS_epson_bios_id])
-#define epson_system_type (pc98_system_parameter[OFS_epson_system_type])
-
-# define PC98_TYPE_CHECK(x) ((pc98_machine_type & (x)) == (x))
-
-# endif /* KERNEL */
-
-extern u_char hireso;
-
-#else
- /* OLD:386bsd-0.1-pc98-a&b */
-extern unsigned char pc98_system_parameter[0x214]; /* in pc98.c */
-#define WD_BIOS_NCYL(i) (*(unsigned short*)(&pc98_system_parameter[0x206+(i)*6]))
-#define WD_BIOS_HEAD(i) (pc98_system_parameter[0x209+(i)*6])
-#define WD_BIOS_SEC(i) (pc98_system_parameter[0x208+(i)*6])
-#define PC98_SYSTEM_PARAMETER(x) pc98_system_parameter[(x)-0x400]
-#define pc98_machine_type (pc98_system_parameter[0x210])
-#define NEC_PC98 1
-#define EPSON_PC98 2
-#define epson_machine_id (pc98_system_parameter[0x211])
-#endif
-#endif
-
-#endif /* !_PC98_PC98_PC98_DEVICE_H_ */
diff --git a/sys/pc98/pc98/pc98_machdep.c b/sys/pc98/pc98/pc98_machdep.c
index 8e481a3..cea08da 100644
--- a/sys/pc98/pc98/pc98_machdep.c
+++ b/sys/pc98/pc98/pc98_machdep.c
@@ -40,7 +40,8 @@
#include <vm/vm_pager.h>
#include <vm/vm_extern.h>
-#include <pc98/pc98/pc98_device.h>
+#include <pc98/pc98/pc98.h>
+#include <i386/isa/isa_device.h>
extern int Maxmem;
extern int Maxmem_under16M;
diff --git a/sys/pc98/pc98/pcaudio.c b/sys/pc98/pc98/pcaudio.c
index 4e02cb2..162062f 100644
--- a/sys/pc98/pc98/pcaudio.c
+++ b/sys/pc98/pc98/pcaudio.c
@@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: pcaudio.c,v 1.2 1996/07/23 07:46:29 asami Exp $
+ * $Id: pcaudio.c,v 1.3 1996/08/31 15:07:08 asami Exp $
*/
#include "pca.h"
@@ -46,7 +46,7 @@
#ifdef PC98
#include <pc98/pc98/pc98.h>
-#include <pc98/pc98/pc98_device.h>
+#include <i386/isa/isa_device.h>
#include <pc98/pc98/timerreg.h>
#include <pc98/pc98/sound/ulaw.h>
@@ -298,15 +298,9 @@ pcaprobe(struct isa_device *dvp)
static struct kern_devconf kdc_pca[NPCA] = { {
0, 0, 0, /* filled in by dev_attach */
-#ifdef PC98
- "pca", 0, { MDDT_PC98, 0, "tty" },
- pc98_generic_externalize, 0, 0, PC98_EXTERNALLEN,
- &kdc_nec0, /* parent */
-#else
"pca", 0, { MDDT_ISA, 0, "tty" },
isa_generic_externalize, 0, 0, ISA_EXTERNALLEN,
&kdc_isa0, /* parent */
-#endif
0, /* parentdata */
DC_UNKNOWN, /* not supported */
"PC speaker audio driver"
@@ -319,11 +313,7 @@ pca_registerdev(struct isa_device *id)
if(id->id_unit)
kdc_pca[id->id_unit] = kdc_pca[0];
kdc_pca[id->id_unit].kdc_unit = id->id_unit;
-#ifdef PC98
- kdc_pca[id->id_unit].kdc_pc98 = id;
-#else
kdc_pca[id->id_unit].kdc_isa = id;
-#endif
dev_attach(&kdc_pca[id->id_unit]);
}
diff --git a/sys/pc98/pc98/pcibus.c b/sys/pc98/pc98/pcibus.c
index 7a22655..2aba4a3 100644
--- a/sys/pc98/pc98/pcibus.c
+++ b/sys/pc98/pc98/pcibus.c
@@ -1,6 +1,6 @@
/**************************************************************************
**
-** $Id: pcibus.c,v 1.1.1.1 1996/06/14 10:04:45 asami Exp $
+** $Id: pcibus.c,v 1.2 1996/07/23 07:46:30 asami Exp $
**
** pci bus subroutines for i386 architecture.
**
@@ -43,11 +43,10 @@
#ifdef PC98
#include <pc98/pc98/icu.h>
-#include <pc98/pc98/pc98_device.h>
#else
#include <i386/isa/icu.h>
-#include <i386/isa/isa_device.h>
#endif
+#include <i386/isa/isa_device.h>
#include <pci/pcivar.h>
#include <pci/pcireg.h>
diff --git a/sys/pc98/pc98/pcicx.c b/sys/pc98/pc98/pcicx.c
index 28afae9..757e2d7 100644
--- a/sys/pc98/pc98/pcicx.c
+++ b/sys/pc98/pc98/pcicx.c
@@ -42,11 +42,10 @@
#include <sys/kernel.h>
#include <machine/clock.h>
#endif
+#include <i386/isa/isa_device.h>
#ifdef PC98
-#include <pc98/pc98/pc98_device.h>
#include <pc98/pc98/pcic.h>
#else
-#include <i386/isa/isa_device.h>
#include <i386/isa/pcic.h>
#endif
diff --git a/sys/pc98/pc98/random_machdep.c b/sys/pc98/pc98/random_machdep.c
index c48b1c9..21de608 100644
--- a/sys/pc98/pc98/random_machdep.c
+++ b/sys/pc98/pc98/random_machdep.c
@@ -1,7 +1,7 @@
/*
* random_machdep.c -- A strong random number generator
*
- * $Id: random_machdep.c,v 1.2 1996/07/23 07:46:32 asami Exp $
+ * $Id: random_machdep.c,v 1.3 1996/08/30 10:43:08 asami Exp $
*
* Version 0.95, last modified 18-Oct-95
*
@@ -55,7 +55,7 @@
#ifdef PC98
#include <pc98/pc98/icu.h>
#include <pc98/pc98/pc98.h>
-#include <pc98/pc98/pc98_device.h>
+#include <i386/isa/isa_device.h>
#include <pc98/pc98/timerreg.h>
#else
#include <i386/isa/icu.h>
diff --git a/sys/pc98/pc98/sbic55.c b/sys/pc98/pc98/sbic55.c
index c990320..b1b9b8a 100644
--- a/sys/pc98/pc98/sbic55.c
+++ b/sys/pc98/pc98/sbic55.c
@@ -24,7 +24,7 @@
#include <vm/pmap.h>
#include <pc98/pc98/pc98.h>
-#include <pc98/pc98/pc98_device.h>
+#include <i386/isa/isa_device.h>
#include <pc98/pc98/icu.h>
#include <pc98/pc98/ic/i8237.h>
#include <pc98/pc98/scsireg.h>
@@ -209,9 +209,9 @@ struct isa_driver sbicdriver = {
static struct kern_devconf kdc_sbic[NSBIC] = { {
0, 0, 0, /* filled in by dev_attach */
- "sbic", 0, { MDDT_PC98, 0, "bio" },
- pc98_generic_externalize, 0, 0, PC98_EXTERNALLEN,
- &kdc_nec0, /* parent */
+ "sbic", 0, { MDDT_ISA, 0, "bio" },
+ isa_generic_externalize, 0, 0, ISA_EXTERNALLEN,
+ &kdc_isa0, /* parent */
0, /* parentdata */
DC_UNCONFIGURED, /* always start out here in probe */
"55 compatible SCSI board host adapter",
@@ -235,7 +235,7 @@ static int sbicunit = 0;
/*
* Check if the device can be found at the port given
* and if so, set it up ready for further work
- * as an argument, takes the pc98_device structure from
+ * as an argument, takes the isa_device structure from
* autoconf.c
*/
static int
@@ -869,7 +869,7 @@ sbic_request_sense(struct sbic_data *sbic, struct sbic_ccb *ccb)
chan = sbic->sbic_dma;
len = ccb->sense_len;
#ifndef ALLWAYS_BOUNCE
- if(pc98_dmarangecheck((caddr_t)ccb->sense_addr,len)) {
+ if(isa_dmarangecheck((caddr_t)ccb->sense_addr,len)) {
ccb->sense_addr = (int)(sbic_bounce);
ccb->flags |= CCB_BOUNCE;
}
diff --git a/sys/pc98/pc98/sbic55.c.new b/sys/pc98/pc98/sbic55.c.new
index 3c82c1e..7c5fbf3 100644
--- a/sys/pc98/pc98/sbic55.c.new
+++ b/sys/pc98/pc98/sbic55.c.new
@@ -72,7 +72,7 @@
#include <pc98/pc98/icu.h>
#include <pc98/pc98/pc98.h>
-#include <pc98/pc98/pc98_device.h>
+#include <i386/isa/isa_device.h>
#include <pc98/pc98/ic/i8237.h>
#include <scsi/scsi_all.h>
#include <scsi/scsiconf.h>
@@ -212,9 +212,9 @@ static int sbicunit = 0;
static struct kern_devconf kdc_sbic[NSBIC] = { {
0, 0, 0, /* filled in by dev_attach */
- "sbic", 0, { MDDT_PC98, 0, "bio" },
- pc98_generic_externalize, 0, 0, PC98_EXTERNALLEN,
- &kdc_nec0, /* parent */
+ "sbic", 0, { MDDT_ISA, 0, "bio" },
+ isa_generic_externalize, 0, 0, ISA_EXTERNALLEN,
+ &kdc_isa0, /* parent */
0, /* parentdata */
DC_UNCONFIGURED, /* always start out here in probe */
"WD33C93A based SCSI host adapter",
diff --git a/sys/pc98/pc98/scd.c b/sys/pc98/pc98/scd.c
index 22e5971..fa29cc9 100644
--- a/sys/pc98/pc98/scd.c
+++ b/sys/pc98/pc98/scd.c
@@ -41,7 +41,7 @@
*/
-/* $Id: scd.c,v 1.3 1996/07/30 18:56:08 asami Exp $ */
+/* $Id: scd.c,v 1.4 1996/08/31 15:07:16 asami Exp $ */
/* Please send any comments to micke@dynas.se */
@@ -72,11 +72,7 @@
#include <machine/clock.h>
#include <machine/stdarg.h>
-#ifdef PC98
-#include <pc98/pc98/pc98_device.h>
-#else
#include <i386/isa/isa_device.h>
-#endif
#include <i386/isa/scdreg.h>
@@ -205,15 +201,9 @@ static struct bdevsw scd_bdevsw =
static struct kern_devconf kdc_scd[NSCD] = { {
0, 0, 0, /* filled in by dev_attach */
-#ifdef PC98
- "scd", 0, { MDDT_PC98, 0, "bio" },
- pc98_generic_externalize, 0, 0, PC98_EXTERNALLEN,
- &kdc_nec0, /* parent */
-#else
"scd", 0, { MDDT_ISA, 0, "bio" },
isa_generic_externalize, 0, 0, ISA_EXTERNALLEN,
&kdc_isa0, /* parent */
-#endif
0, /* parentdata */
DC_UNCONFIGURED, /* status */
"Sony CD-ROM drive", /* properly filled later */
@@ -226,11 +216,7 @@ scd_registerdev(struct isa_device *id)
if(id->id_unit)
kdc_scd[id->id_unit] = kdc_scd[0];
kdc_scd[id->id_unit].kdc_unit = id->id_unit;
-#ifdef PC98
- kdc_scd[id->id_unit].kdc_pc98 = id;
-#else
kdc_scd[id->id_unit].kdc_isa = id;
-#endif
dev_attach(&kdc_scd[id->id_unit]);
}
diff --git a/sys/pc98/pc98/sio.c b/sys/pc98/pc98/sio.c
index 461a4e6..98feda2 100644
--- a/sys/pc98/pc98/sio.c
+++ b/sys/pc98/pc98/sio.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* from: @(#)com.c 7.5 (Berkeley) 5/16/91
- * $Id: sio.c,v 1.2 1996/07/23 07:46:38 asami Exp $
+ * $Id: sio.c,v 1.3 1996/08/31 15:07:20 asami Exp $
*/
#include "opt_comconsole.h"
@@ -140,7 +140,7 @@
#ifdef PC98
#include <pc98/pc98/pc98.h>
#include <pc98/pc98/icu.h>
-#include <pc98/pc98/pc98_device.h>
+#include <i386/isa/isa_device.h>
#include <pc98/pc98/sioreg.h>
#include <pc98/pc98/ic/i8251.h>
#include <pc98/pc98/ic/ns16550.h>
@@ -597,15 +597,9 @@ static struct speedtab comspeedtab[] = {
static struct kern_devconf kdc_sio[NSIO] = { {
0, 0, 0, /* filled in by dev_attach */
-#ifdef PC98
- driver_name, 0, { MDDT_PC98, 0, "tty" },
- pc98_generic_externalize, 0, 0, PC98_EXTERNALLEN,
- &kdc_nec0, /* parent */
-#else
driver_name, 0, { MDDT_ISA, 0, "tty" },
isa_generic_externalize, 0, 0, ISA_EXTERNALLEN,
&kdc_isa0, /* parent */
-#endif
0, /* parentdata */
DC_UNCONFIGURED, /* state */
"Serial port",
@@ -748,22 +742,14 @@ sioregisterdev(id)
/*
* If already registered, don't try to re-register.
*/
-#ifdef PC98
- if (kdc_sio[unit].kdc_pc98)
-#else
if (kdc_sio[unit].kdc_isa)
-#endif
return;
if (unit != 0)
kdc_sio[unit] = kdc_sio[0];
kdc_sio[unit].kdc_state = DC_UNCONFIGURED;
kdc_sio[unit].kdc_description = "Serial port";
kdc_sio[unit].kdc_unit = unit;
-#ifdef PC98
- kdc_sio[unit].kdc_pc98 = id;
-#else
kdc_sio[unit].kdc_isa = id;
-#endif
dev_attach(&kdc_sio[unit]);
}
@@ -797,11 +783,7 @@ sioprobe(dev)
* from any used port that shares the interrupt vector.
* XXX the gate enable is elsewhere for some multiports.
*/
-#ifdef PC98
- for (xdev = pc98_devtab_tty; xdev->id_driver != NULL; xdev++)
-#else
for (xdev = isa_devtab_tty; xdev->id_driver != NULL; xdev++)
-#endif
if (xdev->id_driver == &siodriver && xdev->id_enabled)
#ifdef PC98
if (IS_PC98IN(xdev->id_iobase))
@@ -849,7 +831,7 @@ sioprobe(dev)
COM_INT_DISABLE
tmp = ( inb( iod.ctrl ) & ~(IEN_Rx|IEN_TxEMP|IEN_Tx));
outb( iod.ctrl, tmp|IEN_TxEMP );
- ret = pc98_irq_pending(dev) ? 4 : 0;
+ ret = isa_irq_pending(dev) ? 4 : 0;
outb( iod.ctrl, tmp );
COM_INT_ENABLE
break;
@@ -879,11 +861,7 @@ sioprobe(dev)
mcr_image = MCR_IENABLE;
#ifdef COM_MULTIPORT
if (COM_ISMULTIPORT(dev)) {
-#ifdef PC98
- idev = find_pc98dev(pc98_devtab_tty, &siodriver,
-#else
idev = find_isadev(isa_devtab_tty, &siodriver,
-#endif
COM_MPMASTER(dev));
if (idev == NULL) {
printf("sio%d: master device %d not configured\n",
@@ -1001,20 +979,11 @@ sioprobe(dev)
failures[2] = inb(iobase + com_mcr) - mcr_image;
DELAY(10000); /* Some internal modems need this time */
if (idev->id_irq != 0)
-#ifdef PC98
- failures[3] = pc98_irq_pending(idev) ? 0 : 1;
-#else
failures[3] = isa_irq_pending(idev) ? 0 : 1;
-#endif
failures[4] = (inb(iobase + com_iir) & IIR_IMASK) - IIR_TXRDY;
DELAY(1000); /* XXX */
-#ifdef PC98
- if (idev->id_irq != 0)
- failures[5] = pc98_irq_pending(idev) ? 1 : 0;
-#else
if (idev->id_irq != 0)
failures[5] = isa_irq_pending(idev) ? 1 : 0;
-#endif
failures[6] = (inb(iobase + com_iir) & IIR_IMASK) - IIR_NOPEND;
/*
@@ -1030,13 +999,8 @@ sioprobe(dev)
outb(iobase + com_cfcr, CFCR_8BITS); /* dummy to avoid bus echo */
failures[7] = inb(iobase + com_ier);
DELAY(1000); /* XXX */
-#ifdef PC98
- if (idev->id_irq != 0)
- failures[8] = pc98_irq_pending(idev) ? 1 : 0;
-#else
if (idev->id_irq != 0)
failures[8] = isa_irq_pending(idev) ? 1 : 0;
-#endif
failures[9] = (inb(iobase + com_iir) & IIR_IMASK) - IIR_NOPEND;
enable_intr();
@@ -1384,11 +1348,7 @@ determined_type: ;
if (unit == COM_MPMASTER(isdp))
printf(" master");
printf(")");
-#ifdef PC98
- com->no_irq = find_pc98dev(pc98_devtab_tty, &siodriver,
-#else
com->no_irq = find_isadev(isa_devtab_tty, &siodriver,
-#endif
COM_MPMASTER(isdp))->id_irq == 0;
}
#endif /* COM_MULTIPORT */
diff --git a/sys/pc98/pc98/sound/dmabuf.c b/sys/pc98/pc98/sound/dmabuf.c
index 259f781..bb64d7d 100644
--- a/sys/pc98/pc98/sound/dmabuf.c
+++ b/sys/pc98/pc98/sound/dmabuf.c
@@ -708,11 +708,7 @@ DMAbuf_start_dma (int dev, unsigned long physaddr, int count, int dma_mode)
#if defined(__FreeBSD__)
-#ifdef PC98
- pc98_dmastart (B_RAW | ((dma_mode == DMA_MODE_READ) ? B_READ : B_WRITE),
-#else
isa_dmastart (B_RAW | ((dma_mode == DMA_MODE_READ) ? B_READ : B_WRITE),
-#endif
(caddr_t)dmap->raw_buf_phys[0],
dmap->bytes_in_use,
chan);
@@ -759,11 +755,7 @@ DMAbuf_start_dma (int dev, unsigned long physaddr, int count, int dma_mode)
RESTORE_INTR (flags);
#else
#if defined(__FreeBSD__)
-#ifdef PC98
- pc98_dmastart ((dma_mode == DMA_MODE_READ) ? B_READ : B_WRITE,
-#else
isa_dmastart ((dma_mode == DMA_MODE_READ) ? B_READ : B_WRITE,
-#endif
(caddr_t)physaddr,
count,
chan);
@@ -842,12 +834,8 @@ DMAbuf_outputintr (int dev, int event_type)
dmap->flags &= ~DMA_ACTIVE;
#ifdef __FreeBSD__
-#ifdef PC98
- pc98_dmadone(0, 0, 0, audio_devs[dev]->dmachan);
-#else
isa_dmadone(0, 0, 0, audio_devs[dev]->dmachan);
#endif
-#endif
if (dmap->qlen)
{
@@ -891,12 +879,8 @@ DMAbuf_inputintr (int dev)
#endif /* SVR42 */
#ifdef __FreeBSD__
-#ifdef PC98
- pc98_dmadone(0, 0, 0, audio_devs[dev]->dmachan);
-#else
isa_dmadone(0, 0, 0, audio_devs[dev]->dmachan);
#endif
-#endif
if (dmap->qlen == (dmap->nbufs - 1))
{
diff --git a/sys/pc98/pc98/sound/os.h b/sys/pc98/pc98/sound/os.h
index 980163b..ea73478 100644
--- a/sys/pc98/pc98/sound/os.h
+++ b/sys/pc98/pc98/sound/os.h
@@ -30,11 +30,7 @@
#include <sys/errno.h>
#include <sys/malloc.h>
#include <sys/buf.h>
-#ifdef PC98
-#include <pc98/pc98/pc98_device.h>
-#else
#include <i386/isa/isa_device.h>
-#endif
#include <machine/cpufunc.h>
#include <sys/signalvar.h>
diff --git a/sys/pc98/pc98/sound/soundcard.c b/sys/pc98/pc98/sound/soundcard.c
index 77eedc7..3d80d59 100644
--- a/sys/pc98/pc98/sound/soundcard.c
+++ b/sys/pc98/pc98/sound/soundcard.c
@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: soundcard.c,v 1.1.1.1 1996/06/14 10:04:54 asami Exp $
+ * $Id: soundcard.c,v 1.2 1996/08/31 15:07:42 asami Exp $
*/
#include "sound_config.h"
@@ -36,11 +36,7 @@
#ifdef CONFIGURE_SOUNDCARD
#include "dev_table.h"
-#ifdef PC98
-#include <pc98/pc98/pc98_device.h>
-#else
#include <i386/isa/isa_device.h>
-#endif
#include <sys/conf.h>
#include <sys/kernel.h>
#ifdef DEVFS
@@ -112,11 +108,7 @@ adintr(INT_HANDLER_PARMS(unit,dummy))
if (unit_to_irq [unit] > 0)
ad1848_interrupt(INT_HANDLER_CALL (unit_to_irq [unit]));
else {
-#ifdef PC98
- dev = find_pc98dev (pc98_devtab_null, &mssdriver, unit);
-#else
dev = find_isadev (isa_devtab_null, &mssdriver, unit);
-#endif
if (!dev)
printk ("ad1848: Couldn't determine unit\n");
else {
diff --git a/sys/pc98/pc98/syscons.c b/sys/pc98/pc98/syscons.c
index 35ba376..bf9672b 100644
--- a/sys/pc98/pc98/syscons.c
+++ b/sys/pc98/pc98/syscons.c
@@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: syscons.c,v 1.3 1996/08/30 10:43:09 asami Exp $
+ * $Id: syscons.c,v 1.4 1996/08/31 15:07:23 asami Exp $
*/
#include "sc.h"
@@ -68,7 +68,7 @@
#ifdef PC98
#define KANJI
#include <pc98/pc98/pc98.h>
-#include <pc98/pc98/pc98_device.h>
+#include <i386/isa/isa_device.h>
#include <pc98/pc98/timerreg.h>
#include <pc98/pc98/kbdtables.h>
#include <pc98/pc98/syscons.h>
@@ -459,15 +459,9 @@ gotack:
static struct kern_devconf kdc_sc[NSC] = {
0, 0, 0, /* filled in by dev_attach */
-#ifdef PC98
- "sc", 0, { MDDT_PC98, 0, "tty" },
- pc98_generic_externalize, 0, 0, PC98_EXTERNALLEN,
- &kdc_nec0, /* parent */
-#else
"sc", 0, { MDDT_ISA, 0, "tty" },
isa_generic_externalize, 0, 0, ISA_EXTERNALLEN,
&kdc_isa0, /* parent */
-#endif
0, /* parentdata */
DC_BUSY, /* the console is almost always busy */
"Graphics console",
@@ -480,11 +474,7 @@ sc_registerdev(struct isa_device *id)
if(id->id_unit)
kdc_sc[id->id_unit] = kdc_sc[0];
kdc_sc[id->id_unit].kdc_unit = id->id_unit;
-#ifdef PC98
- kdc_sc[id->id_unit].kdc_pc98 = id;
-#else
kdc_sc[id->id_unit].kdc_isa = id;
-#endif
dev_attach(&kdc_sc[id->id_unit]);
}
diff --git a/sys/pc98/pc98/wd.c b/sys/pc98/pc98/wd.c
index 12f1199..768f171 100644
--- a/sys/pc98/pc98/wd.c
+++ b/sys/pc98/pc98/wd.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)wd.c 7.2 (Berkeley) 5/9/91
- * $Id: wd.c,v 1.4 1996/08/30 10:43:11 asami Exp $
+ * $Id: wd.c,v 1.5 1996/08/31 15:07:25 asami Exp $
*/
/* TODO:
@@ -87,7 +87,7 @@
#include <machine/md_var.h>
#ifdef PC98
#include <pc98/pc98/pc98.h>
-#include <pc98/pc98/pc98_device.h>
+#include <i386/isa/isa_device.h>
#include <pc98/pc98/wdreg.h>
#else
#include <i386/i386/cons.h>
@@ -148,15 +148,9 @@ static struct kern_devconf kdc_wd[NWD] = { {
static struct kern_devconf kdc_wdc[NWDC] = { {
0, 0, 0, /* filled in by kern_devconf.c */
-#ifdef PC98
- "wdc", 0, { MDDT_PC98, 0 },
- pc98_generic_externalize, 0, wdc_goaway, PC98_EXTERNALLEN,
- &kdc_nec0, /* parent */
-#else
"wdc", 0, { MDDT_ISA, 0 },
isa_generic_externalize, 0, wdc_goaway, ISA_EXTERNALLEN,
&kdc_isa0, /* parent */
-#endif
0, /* parentdata */
DC_UNCONFIGURED, /* state */
#ifdef PC98
@@ -529,7 +523,7 @@ wdattach(struct isa_device *dvp)
kdc_wdc[dvp->id_unit].kdc_state = DC_UNKNOWN; /* XXX */
TAILQ_INIT( &wdtab[dvp->id_unit].controller_queue);
- for (wdup = pc98_biotab_wdc; wdup->id_driver != 0; wdup++) {
+ for (wdup = isa_biotab_wdc; wdup->id_driver != 0; wdup++) {
if (!old_epson_note) {
if (wdup->id_iobase != dvp->id_iobase)
continue;
OpenPOWER on IntegriCloud