head	1.2;
access;
symbols
	perseant-exfatfs-base-20250801:1.2
	perseant-exfatfs-base-20240630:1.2
	perseant-exfatfs:1.2.0.144
	perseant-exfatfs-base:1.2
	bouyer-sunxi-drm:1.2.0.142
	bouyer-sunxi-drm-base:1.2
	cjep_sun2x:1.2.0.140
	cjep_sun2x-base:1.2
	cjep_staticlib_x-base1:1.2
	cjep_staticlib_x:1.2.0.138
	cjep_staticlib_x-base:1.2
	thorpej-futex-base:1.2
	bouyer-xenpvh-base2:1.2
	phil-wifi-20200421:1.2
	bouyer-xenpvh-base1:1.2
	phil-wifi-20200411:1.2
	bouyer-xenpvh:1.2.0.136
	bouyer-xenpvh-base:1.2
	phil-wifi-20200406:1.2
	ad-namecache-base3:1.2
	ad-namecache-base2:1.2
	ad-namecache-base1:1.2
	ad-namecache:1.2.0.134
	ad-namecache-base:1.2
	isaki-audio2:1.2.0.132
	isaki-audio2-base:1.2
	pgoyette-compat-merge-20190127:1.2
	pgoyette-compat-20190127:1.2
	pgoyette-compat-20190118:1.2
	pgoyette-compat-1226:1.2
	pgoyette-compat-1126:1.2
	pgoyette-compat-1020:1.2
	pgoyette-compat-0930:1.2
	pgoyette-compat-0906:1.2
	pgoyette-compat-0728:1.2
	pgoyette-compat-0625:1.2
	pgoyette-compat-0521:1.2
	pgoyette-compat-0502:1.2
	pgoyette-compat-0422:1.2
	pgoyette-compat-0415:1.2
	pgoyette-compat-0407:1.2
	pgoyette-compat-0330:1.2
	pgoyette-compat-0322:1.2
	pgoyette-compat-0315:1.2
	pgoyette-compat:1.2.0.12
	pgoyette-compat-base:1.2
	perseant-stdc-iso10646:1.2.0.130
	perseant-stdc-iso10646-base:1.2
	prg-localcount2-base3:1.2
	prg-localcount2-base2:1.2
	prg-localcount2-base1:1.2
	prg-localcount2:1.2.0.128
	prg-localcount2-base:1.2
	pgoyette-localcount-20170426:1.2
	bouyer-socketcan-base1:1.2
	pgoyette-localcount-20170320:1.2
	bouyer-socketcan:1.2.0.126
	bouyer-socketcan-base:1.2
	pgoyette-localcount-20170107:1.2
	pgoyette-localcount-20161104:1.2
	localcount-20160914:1.2
	pgoyette-localcount-20160806:1.2
	pgoyette-localcount-20160726:1.2
	pgoyette-localcount:1.2.0.124
	pgoyette-localcount-base:1.2
	netbsd-5-2-3-RELEASE:1.2
	netbsd-5-1-5-RELEASE:1.2
	yamt-pagecache-base9:1.2
	yamt-pagecache-tag8:1.2
	tls-earlyentropy:1.2.0.122
	tls-earlyentropy-base:1.2
	riastradh-xf86-video-intel-2-7-1-pre-2-21-15:1.2
	riastradh-drm2-base3:1.2
	netbsd-5-2-2-RELEASE:1.2
	netbsd-5-1-4-RELEASE:1.2
	netbsd-5-2-1-RELEASE:1.2
	netbsd-5-1-3-RELEASE:1.2
	rmind-smpnet-nbase:1.2
	rmind-smpnet:1.2.0.118
	rmind-smpnet-base:1.2
	agc-symver:1.2.0.120
	agc-symver-base:1.2
	tls-maxphys-base:1.2
	yamt-pagecache-base8:1.2
	netbsd-5-2:1.2.0.116
	yamt-pagecache-base7:1.2
	netbsd-5-2-RELEASE:1.2
	netbsd-5-2-RC1:1.2
	yamt-pagecache-base6:1.2
	yamt-pagecache-base5:1.2
	yamt-pagecache-base4:1.2
	netbsd-5-1-2-RELEASE:1.2
	netbsd-5-1-1-RELEASE:1.2
	jmcneill-usbmp:1.2.0.114
	jmcneill-usbmp-base:1.2
	jmcneill-audiomp3:1.2.0.112
	jmcneill-audiomp3-base:1.2
	yamt-pagecache-base3:1.2
	yamt-pagecache-base2:1.2
	yamt-pagecache:1.2.0.110
	yamt-pagecache-base:1.2
	rmind-uvmplock-nbase:1.2
	jym-xensuspend-nbase:1.2
	bouyer-quota2-nbase:1.2
	bouyer-quota2:1.2.0.108
	bouyer-quota2-base:1.2
	jruoho-x86intr:1.2.0.106
	jruoho-x86intr-base:1.2
	matt-nb5-pq3:1.2.0.104
	matt-nb5-pq3-base:1.2
	netbsd-5-1:1.2.0.102
	netbsd-5-1-RELEASE:1.2
	yamt-nfs-mp-base11:1.2
	netbsd-5-1-RC4:1.2
	uebayasi-xip-base2:1.2
	yamt-nfs-mp-base10:1.2
	netbsd-5-1-RC3:1.2
	netbsd-5-1-RC2:1.2
	netbsd-5-1-RC1:1.2
	rmind-uvmplock:1.2.0.100
	rmind-uvmplock-base:1.2
	yamt-nfs-mp-base9:1.2
	uebayasi-xip:1.2.0.98
	uebayasi-xip-base:1.2
	netbsd-5-0-2-RELEASE:1.2
	yamt-nfs-mp-base8:1.2
	yamt-nfs-mp-base7:1.2
	netbsd-5-0-1-RELEASE:1.2
	jymxensuspend-base:1.2
	yamt-nfs-mp-base6:1.2
	yamt-nfs-mp-base5:1.2
	yamt-nfs-mp-base4:1.2
	yamt-nfs-mp-base3:1.2
	netbsd-5-0:1.2.0.96
	netbsd-5-0-RELEASE:1.2
	netbsd-5-0-RC4:1.2
	netbsd-5-0-RC3:1.2
	netbsd-5-0-RC2:1.2
	jym-xensuspend:1.2.0.94
	jym-xensuspend-base:1.2
	netbsd-5-0-RC1:1.2
	haad-dm-base2:1.2
	haad-nbase2:1.2
	ad-audiomp2:1.2.0.92
	ad-audiomp2-base:1.2
	netbsd-5:1.2.0.90
	netbsd-5-base:1.2
	haad-dm-base1:1.2
	haad-dm:1.2.0.88
	haad-dm-base:1.2
	simonb-wapbl-nbase:1.2
	yamt-pf42-base4:1.2
	simonb-wapbl:1.2.0.86
	simonb-wapbl-base:1.2
	yamt-pf42-base3:1.2
	hpcarm-cleanup-nbase:1.2
	yamt-pf42-base2:1.2
	yamt-nfs-mp-base2:1.2
	yamt-nfs-mp:1.2.0.84
	yamt-nfs-mp-base:1.2
	yamt-pf42:1.2.0.82
	yamt-pf42-base:1.2
	ad-socklock-base1:1.2
	yamt-lazymbuf-base15:1.2
	yamt-lazymbuf-base14:1.2
	keiichi-mipv6-nbase:1.2
	mjf-devfs2:1.2.0.80
	mjf-devfs2-base:1.2
	keiichi-mipv6:1.2.0.78
	keiichi-mipv6-base:1.2
	bouyer-xeni386-merge1:1.2
	vmlocking2-base3:1.2
	bouyer-xeni386-nbase:1.2
	yamt-kmem-base3:1.2
	cube-autoconf:1.2.0.76
	cube-autoconf-base:1.2
	yamt-kmem-base2:1.2
	bouyer-xeni386:1.2.0.74
	bouyer-xeni386-base:1.2
	yamt-kmem:1.2.0.72
	yamt-kmem-base:1.2
	vmlocking2-base2:1.2
	reinoud-bufcleanup-nbase:1.2
	vmlocking2:1.2.0.70
	vmlocking2-base1:1.2
	jmcneill-base:1.2
	mjf-devfs:1.2.0.68
	mjf-devfs-base:1.2
	bouyer-xenamd64-base2:1.2
	vmlocking-nbase:1.2
	yamt-x86pmap-base4:1.2
	bouyer-xenamd64:1.2.0.66
	bouyer-xenamd64-base:1.2
	yamt-x86pmap-base3:1.2
	yamt-x86pmap-base2:1.2
	yamt-x86pmap:1.2.0.64
	yamt-x86pmap-base:1.2
	jmcneill-pm:1.2.0.62
	jmcneill-pm-base:1.2
	hpcarm-cleanup:1.2.0.60
	hpcarm-cleanup-base:1.2
	mjf-ufs-trans-base:1.2
	yamt-idlelwp-base8:1.2
	ppcoea-renovation:1.2.0.58
	ppcoea-renovation-base:1.2
	reinoud-bufcleanup-base:1.2
	vmlocking:1.2.0.56
	vmlocking-base:1.2
	ad-audiomp:1.2.0.54
	ad-audiomp-base:1.2
	yamt-idlelwp:1.2.0.52
	post-newlock2-merge:1.2
	newlock2-nbase:1.2
	yamt-splraiseipl-base5:1.2
	yamt-splraiseipl-base4:1.2
	yamt-splraiseipl-base3:1.2
	yamt-splraiseipl-base2:1.2
	yamt-splraiseipl:1.2.0.50
	yamt-splraiseipl-base:1.2
	newlock2:1.2.0.48
	newlock2-base:1.2
	yamt-pdpolicy-base8:1.2
	yamt-pdpolicy-base7:1.2
	yamt-pdpolicy-base6:1.2
	gdamore-uart:1.2.0.46
	gdamore-uart-base:1.2
	simonb-timcounters-final:1.2
	yamt-pdpolicy-base5:1.2
	elad-kernelauth-nbase:1.2
	yamt-pdpolicy-base4:1.2
	yamt-pdpolicy-base3:1.2
	yamt-pdpolicy-base2:1.2
	yamt-pdpolicy:1.2.0.44
	yamt-pdpolicy-base:1.2
	yamt-uio_vmspace-base5:1.2
	simonb-timecounters:1.2.0.42
	simonb-timecounters-base:1.2
	rpaulo-netinet-merge-pcb:1.2.0.40
	rpaulo-netinet-merge-pcb-base:1.2
	yamt-uio_vmspace:1.2.0.38
	yamt-readahead-base3:1.2
	yamt-readahead-base2:1.2
	yamt-readahead:1.2.0.36
	yamt-readahead-base:1.2
	yamt-vop-base3:1.2
	yamt-vop-base2:1.2
	thorpej-vnode-attr:1.2.0.34
	thorpej-vnode-attr-base:1.2
	yamt-vop:1.2.0.32
	yamt-vop-base:1.2
	yamt-lazymbuf:1.2.0.30
	yamt-km-base4:1.2
	yamt-km-base3:1.2
	yamt-km-base2:1.2
	yamt-km:1.2.0.28
	yamt-km-base:1.2
	kent-audio2:1.2.0.26
	kent-audio2-base:1.2
	ktrace-lwp:1.2.0.24
	ktrace-lwp-base:1.2
	nathanw_sa_before_merge:1.2
	gmcgarry_ctxsw:1.2.0.22
	gmcgarry_ctxsw_base:1.2
	gmcgarry_ucred:1.2.0.20
	gmcgarry_ucred_base:1.2
	nathanw_sa_base:1.2
	gehenna-devsw:1.2.0.18
	gehenna-devsw-base:1.2
	eeh-devprop:1.2.0.16
	eeh-devprop-base:1.2
	newlock:1.2.0.14
	newlock-base:1.2
	ifpoll-base:1.2
	thorpej-mips-cache:1.2.0.10
	thorpej-mips-cache-base:1.2
	thorpej-devvp:1.2.0.8
	thorpej-devvp-base:1.2
	kqueue:1.2.0.6
	kqueue-base:1.2
	thorpej_scsipi_beforemerge:1.2
	sommerfeld_i386mpnext:1.2
	thorpej_scsipi_nbase:1.2
	chs-ubc2-newbase:1.2
	fvdl-softdep-base:1.2
	thorpej_scsipi:1.2.0.4
	thorpej_scsipi_base:1.2
	thorpej-signal:1.2.0.2
	thorpej-signal-base:1.2
	marc-pcmcia-base:1.2
	magnum-base:1.1
	magnum:1.1.0.2;
locks; strict;
comment	@# @;


1.2
date	94.04.07.22.12.13;	author mycroft;	state dead;
branches;
next	1.1;

1.1
date	93.09.14.17.32.26;	author mycroft;	state Exp;
branches
	1.1.2.1;
next	;

1.1.2.1
date	93.09.14.17.32.26;	author mycroft;	state dead;
branches;
next	1.1.2.2;

1.1.2.2
date	93.09.14.17.32.27;	author mycroft;	state Exp;
branches;
next	;


desc
@@


1.2
log
@Clean up deleted files.
@
text
@/*
 * XXX This is going to go away!  It's still here as an example.
 */

/*
 * This driver is a bit of a hack.  For efficiency reasons, it is not
 * general enough to really be useful in itself.  The only useful
 * purpose in making it separate from the isa driver is to get attach
 * messages, and to check for addressing conflicts in the same way that
 * all other ISA drivers do.
 *
 * There are two minor advantages to making it a separate driver:
 *
 * 1) It allows you to put the slave at a different irq on the master.
 * Putting it at irq 5 might make the priorities do something more
 * reasonable on an average machine.
 *
 * 2) It hides all of the initialization gunk.
 */

#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
#include "icureg.h"
#include "icuvar.h"

struct icu_softc {
	struct device icu_dev;
	u_short icu_port;
	u_char icu_irq;
	u_char icu_slaves;
	u_char icu_mask;
};

static int icumatch __P((struct device *, struct cfdata *, void *));
static void icuattach __P((struct device *, struct device *, void *));

struct cfdriver icucd =
{ NULL, "icu", icu_match, icu_attach, DV_DULL, sizeof(struct icu_softc), 0, 0};

extern struct cfdriver isacd;

static int
icu_match(parent, cf, args)
	struct device *parent;
	struct cfdata *cf;
	void *aux;
{
#ifdef DIAGNOSTIC
	struct icu_attach_args *ia = aux;

	switch (cf->cf_unit) {
		case 0:
			if (ia->port != ICU0) {
				printf("%s0: must be at port 0x%x",
				    icucd.cd_name, ICU0);
				return 0;
			}
			break;
		case 1:
			if (ia->port != ICU1) {
				printf("%s1: must be at port 0x%x",
				    icucd.cd_name, ICU1);
				return 0;
			}
			break;
		default:
			return 0;
	}

	if (cf->cf_driver == &isacd) {
		/* master has no irq */
		if (ia->irq != -1) {
			printf("%s%d: irq not allowed\n", icucd.cd_name,
			    cf->cf_unit);
			return 0;
		}
	} else if (cf->cf_driver == &icucd) {
		/* slave must have irq; no wildcarding yet */
		if (ia->irq == -1) {
			printf("%s%d: no irq\n", icucd.cd_name, cf->cf_unit);
			return 0;
		}
		if (ia->irq > 7) {
			printf("%s%d: invalid irq\n", icucd.cf_name,
			    cf->cf_unit);
			return 0;
		}
		/* only one level of nesting allowed */
		if (parent->cf_driver == &icucd) {
			printf("%s%d: multiple nesting\n", icucd.cd_name,
			    cf->cf_unit);
			return 0;
		}
	}
#endif

	return 1;
}

static void
icu_reset(sc)
	struct icu_softc *sc;
{
	/* initialization command words */
	outb(sc->icu_port + 0, 0x11);		/* 1) reset; program device */
	outb(sc->icu_port + 1,
	    ICU_VEC + 8 * sc->icu_dev->cf_unit);/* 2) base interrupt vector */
	outb(sc->icu_port + 1, sc->icu_slaves);	/* 3) slave mask */
	outb(sc->icu_port + 1, 0x01);		/* 4) 8086 mode */
	/* operation control words */
	outb(sc->icu_port + 1, sc->icu_mask);	/* 1) interrupt mask */
	outb(sc->icu_port + 0, 0x0a);		/* 3) return IRR on read */
}

static void
icu_attach(parent, self, aux)
	struct device *parent, *self;
	void *aux;
{
	struct icu_softc *sc = (struct icu_softc *)self, *csc;
	struct icu_attach_args *ia = aux;
	struct cfdata *child;

	sc->icu_port = ia->port;
	sc->icu_irq = ia->irq;
	sc->icu_slaves = 0;
	sc->icu_mask = 0xff;

	printf("\n");
	while (1) {
		child = config_search(NULL, self, NULL);
		if (!child)
			break;
		config_attach(self, child, NULL, NULL);
		csc = (struct icu_softc *)child->cf_aux;
#ifdef DIAGNOSTIC
		if (child->cf_driver != &icucd) {
			printf("%s%d: child %s%d is not an %s\n",
			    self->cf_driver->cd_name, self->cf_unit,
			    child->cf_driver->cd_name, child->cf_unit,
			    self->cf_driver->cd_name);
			continue;
		}
#endif
		if (csc->icu_irq != -1)
			sc->icu_slaves |= 1 << csc->icu_irq;
	}

	icu_reset(sc);
}
@


1.1
log
@New i386 code.
@
text
@@


1.1.2.1
log
@file icu.c.old was added on branch magnum on 1993-09-14 17:32:27 +0000
@
text
@d1 151
@


1.1.2.2
log
@New i386 code.
@
text
@a0 151
/*
 * XXX This is going to go away!  It's still here as an example.
 */

/*
 * This driver is a bit of a hack.  For efficiency reasons, it is not
 * general enough to really be useful in itself.  The only useful
 * purpose in making it separate from the isa driver is to get attach
 * messages, and to check for addressing conflicts in the same way that
 * all other ISA drivers do.
 *
 * There are two minor advantages to making it a separate driver:
 *
 * 1) It allows you to put the slave at a different irq on the master.
 * Putting it at irq 5 might make the priorities do something more
 * reasonable on an average machine.
 *
 * 2) It hides all of the initialization gunk.
 */

#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
#include "icureg.h"
#include "icuvar.h"

struct icu_softc {
	struct device icu_dev;
	u_short icu_port;
	u_char icu_irq;
	u_char icu_slaves;
	u_char icu_mask;
};

static int icumatch __P((struct device *, struct cfdata *, void *));
static void icuattach __P((struct device *, struct device *, void *));

struct cfdriver icucd =
{ NULL, "icu", icu_match, icu_attach, DV_DULL, sizeof(struct icu_softc), 0, 0};

extern struct cfdriver isacd;

static int
icu_match(parent, cf, args)
	struct device *parent;
	struct cfdata *cf;
	void *aux;
{
#ifdef DIAGNOSTIC
	struct icu_attach_args *ia = aux;

	switch (cf->cf_unit) {
		case 0:
			if (ia->port != ICU0) {
				printf("%s0: must be at port 0x%x",
				    icucd.cd_name, ICU0);
				return 0;
			}
			break;
		case 1:
			if (ia->port != ICU1) {
				printf("%s1: must be at port 0x%x",
				    icucd.cd_name, ICU1);
				return 0;
			}
			break;
		default:
			return 0;
	}

	if (cf->cf_driver == &isacd) {
		/* master has no irq */
		if (ia->irq != -1) {
			printf("%s%d: irq not allowed\n", icucd.cd_name,
			    cf->cf_unit);
			return 0;
		}
	} else if (cf->cf_driver == &icucd) {
		/* slave must have irq; no wildcarding yet */
		if (ia->irq == -1) {
			printf("%s%d: no irq\n", icucd.cd_name, cf->cf_unit);
			return 0;
		}
		if (ia->irq > 7) {
			printf("%s%d: invalid irq\n", icucd.cf_name,
			    cf->cf_unit);
			return 0;
		}
		/* only one level of nesting allowed */
		if (parent->cf_driver == &icucd) {
			printf("%s%d: multiple nesting\n", icucd.cd_name,
			    cf->cf_unit);
			return 0;
		}
	}
#endif

	return 1;
}

static void
icu_reset(sc)
	struct icu_softc *sc;
{
	/* initialization command words */
	outb(sc->icu_port + 0, 0x11);		/* 1) reset; program device */
	outb(sc->icu_port + 1,
	    ICU_VEC + 8 * sc->icu_dev->cf_unit);/* 2) base interrupt vector */
	outb(sc->icu_port + 1, sc->icu_slaves);	/* 3) slave mask */
	outb(sc->icu_port + 1, 0x01);		/* 4) 8086 mode */
	/* operation control words */
	outb(sc->icu_port + 1, sc->icu_mask);	/* 1) interrupt mask */
	outb(sc->icu_port + 0, 0x0a);		/* 3) return IRR on read */
}

static void
icu_attach(parent, self, aux)
	struct device *parent, *self;
	void *aux;
{
	struct icu_softc *sc = (struct icu_softc *)self, *csc;
	struct icu_attach_args *ia = aux;
	struct cfdata *child;

	sc->icu_port = ia->port;
	sc->icu_irq = ia->irq;
	sc->icu_slaves = 0;
	sc->icu_mask = 0xff;

	printf("\n");
	while (1) {
		child = config_search(NULL, self, NULL);
		if (!child)
			break;
		config_attach(self, child, NULL, NULL);
		csc = (struct icu_softc *)child->cf_aux;
#ifdef DIAGNOSTIC
		if (child->cf_driver != &icucd) {
			printf("%s%d: child %s%d is not an %s\n",
			    self->cf_driver->cd_name, self->cf_unit,
			    child->cf_driver->cd_name, child->cf_unit,
			    self->cf_driver->cd_name);
			continue;
		}
#endif
		if (csc->icu_irq != -1)
			sc->icu_slaves |= 1 << csc->icu_irq;
	}

	icu_reset(sc);
}
@
