[Midnightbsd-cvs] src: i386/isa: Remove 3c501 isa based 3com nic.

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sat Dec 6 22:28:32 EST 2008


Log Message:
-----------
Remove 3c501 isa based 3com nic.  This is quite old and not entirely in line with the current development.  I don't even have a system with an ISA slot to test one in if i had one.  Also remove pcf which is replaced with i2c

Modified Files:
--------------
    src/sys/i386/isa:
        atpic.c (r1.2 -> r1.3)
        atpic_vector.s (r1.1.1.1 -> r1.2)
        clock.c (r1.1.1.1 -> r1.2)
        icu.h (r1.1.1.1 -> r1.2)
        isa.c (r1.1.1.1 -> r1.2)
        npx.c (r1.4 -> r1.5)
        pmtimer.c (r1.1.1.1 -> r1.2)
        prof_machdep.c (r1.1.1.1 -> r1.2)
        spic.c (r1.1.1.1 -> r1.2)
        vesa.c (r1.1.1.1 -> r1.2)

Removed Files:
-------------
    src/sys/i386/isa:
        if_el.c
        if_elreg.h
        pcf.c

-------------- next part --------------
--- sys/i386/isa/pcf.c
+++ /dev/null
@@ -1,633 +0,0 @@
-/*-
- * Copyright (c) 1998 Nicolas Souchu, Marc Bouget
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/i386/isa/pcf.c,v 1.23 2005/02/25 23:06:25 sam Exp $");
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/module.h>
-#include <sys/bus.h>
-
-#include <machine/bus.h>
-#include <machine/resource.h>
-#include <sys/rman.h>
-
-#include <isa/isareg.h>
-#include <isa/isavar.h>
-
-#include <dev/iicbus/iiconf.h>
-#include "iicbus_if.h"
-
-#define IO_PCFSIZE	2
-
-#define TIMEOUT	9999					/* XXX */
-
-/* Status bits of S1 register (read only) */
-#define nBB	0x01		/* busy when low set/reset by STOP/START*/
-#define LAB	0x02		/* lost arbitration bit in multi-master mode */
-#define AAS	0x04		/* addressed as slave */
-#define LRB	0x08		/* last received byte when not AAS */
-#define AD0	0x08		/* general call received when AAS */
-#define BER	0x10		/* bus error, misplaced START or STOP */
-#define STS	0x20		/* STOP detected in slave receiver mode */
-#define PIN	0x80		/* pending interrupt not (r/w) */
-
-/* Control bits of S1 register (write only) */
-#define ACK	0x01
-#define STO	0x02
-#define STA	0x04
-#define ENI	0x08
-#define ES2	0x10
-#define ES1	0x20
-#define ES0	0x40
-
-#define BUFSIZE 2048
-
-#define SLAVE_TRANSMITTER	0x1
-#define SLAVE_RECEIVER		0x2
-
-#define PCF_DEFAULT_ADDR	0xaa
-
-struct pcf_softc {
-
-	int pcf_base;			/* isa port */
-	int pcf_flags;
-	u_char pcf_addr;		/* interface I2C address */
-
-	int pcf_slave_mode;		/* receiver or transmitter */
-	int pcf_started;		/* 1 if start condition sent */
-
-	device_t iicbus;		/* the corresponding iicbus */
-
-  	int rid_irq, rid_ioport;
-	struct resource *res_irq, *res_ioport;
-	void *intr_cookie;
-};
-
-static int pcf_probe(device_t);
-static int pcf_attach(device_t);
-static void pcfintr(void *arg);
-
-static int pcf_print_child(device_t, device_t);
-
-static int pcf_repeated_start(device_t, u_char, int);
-static int pcf_start(device_t, u_char, int);
-static int pcf_stop(device_t);
-static int pcf_write(device_t, char *, int, int *, int);
-static int pcf_read(device_t, char *, int, int *, int, int);
-static int pcf_rst_card(device_t, u_char, u_char, u_char *);
-
-static device_method_t pcf_methods[] = {
-	/* device interface */
-	DEVMETHOD(device_probe,		pcf_probe),
-	DEVMETHOD(device_attach,	pcf_attach),
-
-	/* bus interface */
-	DEVMETHOD(bus_print_child,	pcf_print_child),
-
-	/* iicbus interface */
-	DEVMETHOD(iicbus_callback,	iicbus_null_callback),
-	DEVMETHOD(iicbus_repeated_start, pcf_repeated_start),
-	DEVMETHOD(iicbus_start,		pcf_start),
-	DEVMETHOD(iicbus_stop,		pcf_stop),
-	DEVMETHOD(iicbus_write,		pcf_write),
-	DEVMETHOD(iicbus_read,		pcf_read),
-	DEVMETHOD(iicbus_reset,		pcf_rst_card),
-
-	{ 0, 0 }
-};
-
-static driver_t pcf_driver = {
-	"pcf",
-	pcf_methods,
-	sizeof(struct pcf_softc),
-};
-
-static devclass_t pcf_devclass;
-
-#define DEVTOSOFTC(dev) ((struct pcf_softc *)device_get_softc(dev))
-
-static int
-pcf_probe(device_t pcfdev)
-{
-	struct pcf_softc *pcf;
-	device_t parent = device_get_parent(pcfdev);
-	uintptr_t base;
-
-	device_set_desc(pcfdev, "PCF8584 I2C bus controller");
-
-	pcf = DEVTOSOFTC(pcfdev);
-	bzero(pcf, sizeof(struct pcf_softc));
-
-	pcf->rid_irq = pcf->rid_ioport = 0;
-	pcf->res_irq = pcf->res_ioport = 0;
-
-	/* IO port is mandatory */
-	pcf->res_ioport = bus_alloc_resource(pcfdev, SYS_RES_IOPORT,
-					     &pcf->rid_ioport, 0ul, ~0ul, 
-					     IO_PCFSIZE, RF_ACTIVE);
-	if (pcf->res_ioport == 0) {
-		device_printf(pcfdev, "cannot reserve I/O port range\n");
-		goto error;
-	}
-	BUS_READ_IVAR(parent, pcfdev, ISA_IVAR_PORT, &base);
-	pcf->pcf_base = base;
-
-	pcf->pcf_flags = device_get_flags(pcfdev);
-
-	if (!(pcf->pcf_flags & IIC_POLLED)) {
-		pcf->res_irq = bus_alloc_resource(pcfdev, SYS_RES_IRQ, &pcf->rid_irq,
-						  0ul, ~0ul, 1, RF_ACTIVE);
-		if (pcf->res_irq == 0) {
-			device_printf(pcfdev, "can't reserve irq, polled mode.\n");
-			pcf->pcf_flags |= IIC_POLLED;
-		}
-	}
-
-	/* reset the chip */
-	pcf_rst_card(pcfdev, IIC_FASTEST, PCF_DEFAULT_ADDR, NULL);
-
-	return (0);
-error:
-	if (pcf->res_ioport != 0) {
-		bus_deactivate_resource(pcfdev, SYS_RES_IOPORT, pcf->rid_ioport,
-					pcf->res_ioport);
-		bus_release_resource(pcfdev, SYS_RES_IOPORT, pcf->rid_ioport,
-				     pcf->res_ioport);
-	}
-	return (ENXIO);
-}
-
-static int
-pcf_attach(device_t pcfdev)
-{
-	struct pcf_softc *pcf = DEVTOSOFTC(pcfdev);
-	device_t parent = device_get_parent(pcfdev);
-	int error = 0;
-
-	if (pcf->res_irq) {
-		/* default to the tty mask for registration */	/* XXX */
-		error = BUS_SETUP_INTR(parent, pcfdev, pcf->res_irq, INTR_TYPE_NET,
-					    pcfintr, pcfdev, &pcf->intr_cookie);
-		if (error)
-			return (error);
-	}
-
-	pcf->iicbus = device_add_child(pcfdev, "iicbus", -1);
-
-	/* probe and attach the iicbus */
-	bus_generic_attach(pcfdev);
-
-	return (0);
-}
-
-static int
-pcf_print_child(device_t bus, device_t dev)
-{
-	struct pcf_softc *pcf = (struct pcf_softc *)device_get_softc(bus);
-	int retval = 0;
-
-	retval += bus_print_child_header(bus, dev);
-	retval += printf(" on %s addr 0x%x\n", device_get_nameunit(bus),
-			 (int)pcf->pcf_addr);
-
-	return (retval);
-}
-
-/*
- * PCF8584 datasheet : when operate at 8 MHz or more, a minimun time of
- * 6 clocks cycles must be left between two consecutives access
- */
-#define pcf_nops()	DELAY(10)
-
-#define dummy_read(pcf)		PCF_GET_S0(pcf)
-#define dummy_write(pcf)	PCF_SET_S0(pcf, 0)
-
-/*
- * Specific register access to PCF8584
- */
-static void PCF_SET_S0(struct pcf_softc *pcf, int data)
-{
-	outb(pcf->pcf_base, data);
-	pcf_nops();
-}
-
-static void PCF_SET_S1(struct pcf_softc *pcf, int data)
-{
-	outb(pcf->pcf_base+1, data);
-	pcf_nops();
-}
-
-static char PCF_GET_S0(struct pcf_softc *pcf)
-{
-	char data;
-
-	data = inb(pcf->pcf_base);
-	pcf_nops();
-
-	return (data);
-}
-
-static char PCF_GET_S1(struct pcf_softc *pcf)
-{
-	char data;
-
-	data = inb(pcf->pcf_base+1);
-	pcf_nops();
-
-	return (data);
-}
-
-/*
- * Polling mode for master operations wait for a new
- * byte incomming or outgoing
- */
-static int pcf_wait_byte(struct pcf_softc *pcf)
-{
-	int counter = TIMEOUT;
-
-	while (counter--) {
-
-		if ((PCF_GET_S1(pcf) & PIN) == 0)
-			return (0);
-	}
-
-	return (IIC_ETIMEOUT);
-}
-
-static int pcf_stop(device_t pcfdev)
-{
-	struct pcf_softc *pcf = DEVTOSOFTC(pcfdev);
-
-	/*
-	 * Send STOP condition iff the START condition was previously sent.
-	 * STOP is sent only once even if an iicbus_stop() is called after
-	 * an iicbus_read()... see pcf_read(): the pcf needs to send the stop
-	 * before the last char is read.
-	 */
-	if (pcf->pcf_started) {
-		/* set stop condition and enable IT */
-		PCF_SET_S1(pcf, PIN|ES0|ENI|STO|ACK);
-
-		pcf->pcf_started = 0;
-	}
-
-	return (0);
-}
-
-
-static int pcf_noack(struct pcf_softc *pcf, int timeout)
-{
-	int noack;
-	int k = timeout/10;
-
-	do {
-		noack = PCF_GET_S1(pcf) & LRB;
-		if (!noack)
-			break;
-		DELAY(10);				/* XXX wait 10 us */
-	} while (k--);
-
-	return (noack);
-}
-
-static int pcf_repeated_start(device_t pcfdev, u_char slave, int timeout)
-{
-	struct pcf_softc *pcf = DEVTOSOFTC(pcfdev);
-	int error = 0;
-
-	/* repeated start */
-	PCF_SET_S1(pcf, ES0|STA|STO|ACK);
-
-	/* set slave address to PCF. Last bit (LSB) must be set correctly
-	 * according to transfer direction */
-	PCF_SET_S0(pcf, slave);
-
-	/* wait for address sent, polling */
-	if ((error = pcf_wait_byte(pcf)))
-		goto error;
-
-	/* check for ack */
-	if (pcf_noack(pcf, timeout)) {
-		error = IIC_ENOACK;
-		goto error;
-	}
-
-	return (0);
-
-error:
-	pcf_stop(pcfdev);
-	return (error);
-}
-
-static int pcf_start(device_t pcfdev, u_char slave, int timeout)
-{
-	struct pcf_softc *pcf = DEVTOSOFTC(pcfdev);
-	int error = 0;
-
-	if ((PCF_GET_S1(pcf) & nBB) == 0)
-		return (IIC_EBUSBSY);
-
-	/* set slave address to PCF. Last bit (LSB) must be set correctly
-	 * according to transfer direction */
-	PCF_SET_S0(pcf, slave);
-
-	/* START only */
-	PCF_SET_S1(pcf, PIN|ES0|STA|ACK);
-
-	pcf->pcf_started = 1;
-
-	/* wait for address sent, polling */
-	if ((error = pcf_wait_byte(pcf)))
-		goto error;
-
-	/* check for ACK */
-	if (pcf_noack(pcf, timeout)) {
-		error = IIC_ENOACK;
-		goto error;
-	}
-
-	return (0);
-
-error:
-	pcf_stop(pcfdev);
-	return (error);
-}
-
-static void
-pcfintr(void *arg)
-{
-	device_t pcfdev = (device_t)arg;
-	struct pcf_softc *pcf = DEVTOSOFTC(pcfdev);
-
-	char data, status, addr;
-	char error = 0;
-
-	status = PCF_GET_S1(pcf);
-
-	if (status & PIN) {
-		device_printf(pcfdev, "spurious interrupt, status=0x%x\n", status & 0xff);
-
-		goto error;
-	}	
-
-	if (status & LAB)
-		device_printf(pcfdev, "bus arbitration lost!\n");
-
-	if (status & BER) {
-		error = IIC_EBUSERR;
-		iicbus_intr(pcf->iicbus, INTR_ERROR, &error);
-
-		goto error;
-	}
-
-	do {
-		status = PCF_GET_S1(pcf);
-
-		switch(pcf->pcf_slave_mode) {
-
-		case SLAVE_TRANSMITTER:
-			if (status & LRB) {
-				/* ack interrupt line */
-				dummy_write(pcf);
-
-				/* no ack, don't send anymore */
-				pcf->pcf_slave_mode = SLAVE_RECEIVER;
-
-				iicbus_intr(pcf->iicbus, INTR_NOACK, NULL);
-				break;
-			}
-
-			/* get data from upper code */
-			iicbus_intr(pcf->iicbus, INTR_TRANSMIT, &data);
-
-			PCF_SET_S0(pcf, data);	
-			break;	
-		
-		case SLAVE_RECEIVER:
-			if (status & AAS) {
-				addr = PCF_GET_S0(pcf);
-
-				if (status & AD0)
-					iicbus_intr(pcf->iicbus, INTR_GENERAL, &addr);
-				else
-					iicbus_intr(pcf->iicbus, INTR_START, &addr);
-
-				if (addr & LSB) {
-					pcf->pcf_slave_mode = SLAVE_TRANSMITTER;
-
-					/* get the first char from upper code */
-					iicbus_intr(pcf->iicbus, INTR_TRANSMIT, &data);
-
-					/* send first data byte */
-					PCF_SET_S0(pcf, data);
-				}
-
-				break;
-			}
-
-			/* stop condition received? */
-			if (status & STS) {
-				/* ack interrupt line */
-				dummy_read(pcf);
-
-				/* emulate intr stop condition */
-				iicbus_intr(pcf->iicbus, INTR_STOP, NULL);
-
-			} else {
-				/* get data, ack interrupt line */
-				data = PCF_GET_S0(pcf);
-
-				/* deliver the character */
-				iicbus_intr(pcf->iicbus, INTR_RECEIVE, &data);
-			}
-			break;
-
-		    default:
-			panic("%s: unknown slave mode (%d)!", __func__,
-				pcf->pcf_slave_mode);
-		    }
-
-	} while ((PCF_GET_S1(pcf) & PIN) == 0);
-
-	return;
-
-error:
-	/* unknown event on bus...reset PCF */
-	PCF_SET_S1(pcf, PIN|ES0|ENI|ACK);
-
-	pcf->pcf_slave_mode = SLAVE_RECEIVER;
-
-	return;
-}
-
-static int pcf_rst_card(device_t pcfdev, u_char speed, u_char addr, u_char *oldaddr)
-{
-	struct pcf_softc *pcf = DEVTOSOFTC(pcfdev);
-
-	if (oldaddr)
-		*oldaddr = pcf->pcf_addr;
-
-	/* retrieve own address from bus level */
-	if (!addr)
-		pcf->pcf_addr = PCF_DEFAULT_ADDR;
-	else
-		pcf->pcf_addr = addr;
-	
-	PCF_SET_S1(pcf, PIN);				/* initialize S1 */
-
-	/* own address S'O<>0 */
-	PCF_SET_S0(pcf, pcf->pcf_addr >> 1);
-
-	/* select clock register */
-	PCF_SET_S1(pcf, PIN|ES1);
-
-	/* select bus speed : 18=90kb, 19=45kb, 1A=11kb, 1B=1.5kb */
-	switch (speed) {
-	case IIC_SLOW:
-		PCF_SET_S0(pcf,  0x1b);
-		break;
-
-	case IIC_FAST:
-		PCF_SET_S0(pcf,  0x19);
-		break;
-
-	case IIC_UNKNOWN:
-	case IIC_FASTEST:
-	default:
-		PCF_SET_S0(pcf,  0x18);
-		break;
-	}
-
-	/* set bus on, ack=yes, INT=yes */
-	PCF_SET_S1(pcf, PIN|ES0|ENI|ACK);
-
-	pcf->pcf_slave_mode = SLAVE_RECEIVER;
-
-	return (0);
-}
-
-static int
-pcf_write(device_t pcfdev, char *buf, int len, int *sent, int timeout /* us */)
-{
-	struct pcf_softc *pcf = DEVTOSOFTC(pcfdev);
-	int bytes, error = 0;
-
-#ifdef PCFDEBUG
-	printf("pcf%d: >> writing %d bytes\n", device_get_unit(pcfdev), len);
-#endif
-
-	bytes = 0;
-	while (len) {
-
-		PCF_SET_S0(pcf, *buf++);
-
-		/* wait for the byte to be send */
-		if ((error = pcf_wait_byte(pcf)))
-			goto error;
-
-		/* check if ack received */
-		if (pcf_noack(pcf, timeout)) {
-			error = IIC_ENOACK;
-			goto error;
-		}
-
-		len --;
-		bytes ++;
-	}
-
-error:
-	*sent = bytes;
-
-#ifdef PCFDEBUG
-	printf("pcf%d: >> %d bytes written (%d)\n",
-		device_get_unit(pcfdev), bytes, error);
-#endif
-
-	return (error);
-}
-
-static int
-pcf_read(device_t pcfdev, char *buf, int len, int *read, int last,
-							int delay /* us */)
-{
-	struct pcf_softc *pcf = DEVTOSOFTC(pcfdev);
-	int bytes, error = 0;
-
-#ifdef PCFDEBUG
-	printf("pcf%d: << reading %d bytes\n", device_get_unit(pcfdev), len);
-#endif
-
-	/* trig the bus to get the first data byte in S0 */
-	if (len) {
-		if (len == 1 && last)
-			/* just one byte to read */
-			PCF_SET_S1(pcf, ES0);		/* no ack */
-
-		dummy_read(pcf);
-	}
-
-	bytes = 0;
-	while (len) {
-
-		/* XXX delay needed here */
-
-		/* wait for trigged byte */
-		if ((error = pcf_wait_byte(pcf))) {
-			pcf_stop(pcfdev);
-			goto error;
-		}
-
-		if (len == 1 && last)
-			/* ok, last data byte already in S0, no I2C activity
-			 * on next PCF_GET_S0() */
-			pcf_stop(pcfdev);
-
-		else if (len == 2 && last)
-			/* next trigged byte with no ack */
-			PCF_SET_S1(pcf, ES0);
-
-		/* receive byte, trig next byte */
-		*buf++ = PCF_GET_S0(pcf);
-
-		len --;
-		bytes ++;
-	};
-
-error:
-	*read = bytes;
-
-#ifdef PCFDEBUG
-	printf("pcf%d: << %d bytes read (%d)\n",
-		device_get_unit(pcfdev), bytes, error);
-#endif
-
-	return (error);
-}
-
-DRIVER_MODULE(pcf, isa, pcf_driver, pcf_devclass, 0, 0);
--- sys/i386/isa/if_el.c
+++ /dev/null
@@ -1,774 +0,0 @@
-/*-
- * Copyright (c) 1994, Matthew E. Kimmel.  Permission is hereby granted
- * to use, copy, modify and distribute this software provided that both
- * the copyright notice and this permission notice appear in all copies
- * of the software, derivative works or modified versions, and any
- * portions thereof.
- *
- * Questions, comments, bug reports and fixes to kimmel at cs.umass.edu.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/i386/isa/if_el.c,v 1.67.2.1 2005/08/25 05:01:18 rwatson Exp $");
-
-/* Except of course for the portions of code lifted from other FreeBSD
- * drivers (mainly elread, elget and el_ioctl)
- */
-/* 3COM Etherlink 3C501 device driver for FreeBSD */
-/* Yeah, I know these cards suck, but you can also get them for free
- * really easily...
- */
-/* Bugs/possible improvements:
- *	- Does not currently support DMA
- *	- Does not currently support multicasts
- */
-#include "opt_inet.h"
-#include "opt_ipx.h"
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/module.h>
-#include <sys/sockio.h>
-#include <sys/mbuf.h>
-#include <sys/socket.h>
-#include <sys/syslog.h>
-#include <sys/bus.h>
-
-#include <net/ethernet.h>
-#include <net/if.h>
-#include <net/if_types.h>
-
-#include <netinet/in.h>
-#include <netinet/if_ether.h>
-
-#include <net/bpf.h>
-
-#include <machine/bus.h>
-#include <machine/resource.h>
-#include <sys/bus.h>
-#include <sys/rman.h>
-
-#include <isa/isavar.h>
-
-#include <i386/isa/if_elreg.h>
-
-/* For debugging convenience */
-#ifdef EL_DEBUG
-#define dprintf(x) printf x
-#else
-#define dprintf(x)
-#endif
-
-/* el_softc: per line info and status */
-struct el_softc {
-	struct ifnet		*el_ifp;
-	u_char			el_enaddr[6];
-	bus_space_handle_t	el_bhandle;
-	bus_space_tag_t		el_btag;
-	void			*el_intrhand;
-	struct resource		*el_irq;
-	struct resource		*el_res;
-	struct mtx		el_mtx;
-	char el_pktbuf[EL_BUFSIZ]; 	/* Frame buffer */
-};
-
-/* Prototypes */
-static int el_attach(device_t);
-static int el_detach(device_t);
-static void el_init(void *);
-static int el_ioctl(struct ifnet *,u_long,caddr_t);
-static int el_probe(device_t);
-static void el_start(struct ifnet *);
-static void el_reset(void *);
-static void el_watchdog(struct ifnet *);
-static int el_shutdown(device_t);
-
-static void el_stop(void *);
-static int el_xmit(struct el_softc *,int);
-static void elintr(void *);
-static __inline void elread(struct el_softc *,caddr_t,int);
-static struct mbuf *elget(caddr_t,int,struct ifnet *);
-static __inline void el_hardreset(void *);
-
-static device_method_t el_methods[] = {
-        /* Device interface */
-	DEVMETHOD(device_probe,		el_probe),
-	DEVMETHOD(device_attach,	el_attach),
-	DEVMETHOD(device_detach,	el_detach),
-	DEVMETHOD(device_shutdown,	el_shutdown),
-	{ 0, 0 }
-};
-
-static driver_t el_driver = {
-	"el",
-	el_methods,
-	sizeof(struct el_softc)
-};
-
-static devclass_t el_devclass;
-
-DRIVER_MODULE(if_el, isa, el_driver, el_devclass, 0, 0);
-
-#define CSR_WRITE_1(sc, reg, val)       \
-	bus_space_write_1(sc->el_btag, sc->el_bhandle, reg, val)
-#define CSR_READ_1(sc, reg)		\
-	bus_space_read_1(sc->el_btag, sc->el_bhandle, reg)
-
-#define EL_LOCK(_sc)		mtx_lock(&(_sc)->el_mtx)
-#define EL_UNLOCK(_sc)		mtx_unlock(&(_sc)->el_mtx)
-
-/* Probe routine.  See if the card is there and at the right place. */
-static int
-el_probe(device_t dev)
-{
-	struct el_softc *sc;
-	u_short base; /* Just for convenience */
-	int i, rid;
-
-	/* Grab some info for our structure */
-	sc = device_get_softc(dev);
-
-	if (isa_get_logicalid(dev))		/* skip PnP probes */
-		return (ENXIO);
-
-	if ((base = bus_get_resource_start(dev, SYS_RES_IOPORT, 0)) == 0)
-		return (ENXIO);
-
-	/* First check the base */
-	if((base < 0x280) || (base > 0x3f0)) {
-		device_printf(dev,
-		    "ioaddr must be between 0x280 and 0x3f0\n");
-		return(ENXIO);
-	}
-
-	/* Temporarily map the resources. */
-	rid = 0;
-	sc->el_res = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid,
-	    0, ~0, EL_IOSIZ, RF_ACTIVE);
-
-	if (sc->el_res == NULL)
-		return(ENXIO);
-
-	sc->el_btag = rman_get_bustag(sc->el_res);
-	sc->el_bhandle = rman_get_bushandle(sc->el_res);
-	mtx_init(&sc->el_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK,
-	    MTX_DEF | MTX_RECURSE);
-	EL_LOCK(sc);
-
-	/* Now attempt to grab the station address from the PROM
-	 * and see if it contains the 3com vendor code.
-	 */
-	dprintf(("Probing 3c501 at 0x%x...\n",base));
-
-	/* Reset the board */
-	dprintf(("Resetting board...\n"));
-	CSR_WRITE_1(sc,EL_AC,EL_AC_RESET);
-	DELAY(5);
-	CSR_WRITE_1(sc,EL_AC,0);
-	dprintf(("Reading station address...\n"));
-	/* Now read the address */
-	for(i=0;i<ETHER_ADDR_LEN;i++) {
-		CSR_WRITE_1(sc,EL_GPBL,i);
-		sc->el_enaddr[i] = CSR_READ_1(sc,EL_EAW);
-	}
-
-	/* Now release resources */
-	bus_release_resource(dev, SYS_RES_IOPORT, rid, sc->el_res);
-	EL_UNLOCK(sc);
-	mtx_destroy(&sc->el_mtx);
-
-	dprintf(("Address is %6D\n",sc->el_enaddr, ":"));
-
-	/* If the vendor code is ok, return a 1.  We'll assume that
-	 * whoever configured this system is right about the IRQ.
-	 */
-	if((sc->el_enaddr[0] != 0x02) || (sc->el_enaddr[1] != 0x60)
-	   || (sc->el_enaddr[2] != 0x8c)) {
-		dprintf(("Bad vendor code.\n"));
-		return(ENXIO);
-	} else {
-		dprintf(("Vendor code ok.\n"));
-	}
-
-	device_set_desc(dev, "3Com 3c501 Ethernet");
-
-	return(0);
-}
-
-/* Do a hardware reset of the 3c501.  Do not call until after el_probe()! */
-static __inline void
-el_hardreset(xsc)
-	void *xsc;
-{
-	register struct el_softc *sc = xsc;
-	register int j;
-
-	/* First reset the board */
-	CSR_WRITE_1(sc,EL_AC,EL_AC_RESET);
-	DELAY(5);
-	CSR_WRITE_1(sc,EL_AC,0);
-
-	/* Then give it back its ethernet address.  Thanks to the mach
-	 * source code for this undocumented goodie...
-	 */
-	for(j=0;j<ETHER_ADDR_LEN;j++)
-		CSR_WRITE_1(sc,j,IFP2ENADDR(sc->el_ifp)[j]);
-}
-
-/* Attach the interface to the kernel data structures.  By the time
- * this is called, we know that the card exists at the given I/O address.
- * We still assume that the IRQ given is correct.
- */
-static int
-el_attach(device_t dev)
-{
-	struct el_softc *sc;
-	struct ifnet *ifp;
-	int rid, error;
-
-	dprintf(("Attaching el%d...\n",device_get_unit(dev)));
-
-	/* Get things pointing to the right places. */
-	sc = device_get_softc(dev);
-	ifp = sc->el_ifp = if_alloc(IFT_ETHER);
-
-	if (ifp == NULL)
-		return (ENOSPC);
-
-	rid = 0;
-	sc->el_res = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid,
-	    0, ~0, EL_IOSIZ, RF_ACTIVE);
-
-	if (sc->el_res == NULL) {
-		if_free(ifp);
-		return(ENXIO);
-	}
-
-	rid = 0;
-	sc->el_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
-            RF_SHAREABLE | RF_ACTIVE);
-
-        if (sc->el_irq == NULL) {
-		if_free(ifp);
-                bus_release_resource(dev, SYS_RES_IOPORT, 0, sc->el_res);
-		return(ENXIO);
-	}
-
-	error = bus_setup_intr(dev, sc->el_irq, INTR_TYPE_NET,
-		elintr, sc, &sc->el_intrhand);
-
-	if (error) {
-		if_free(ifp);
-		bus_release_resource(dev, SYS_RES_IRQ, 0, sc->el_irq);
-		bus_release_resource(dev, SYS_RES_IOPORT, 0, sc->el_res);
-		return(ENXIO);
-	}
-
-	/* Initialize ifnet structure */
-	ifp->if_softc = sc;
-	if_initname(ifp, device_get_name(dev), device_get_unit(dev));
-	ifp->if_mtu = ETHERMTU;
-	ifp->if_start = el_start;
-	ifp->if_ioctl = el_ioctl;
-	ifp->if_watchdog = el_watchdog;
-	ifp->if_init = el_init;
-	ifp->if_flags = (IFF_BROADCAST | IFF_MULTICAST | IFF_SIMPLEX);
-	ifp->if_snd.ifq_maxlen = IFQ_MAXLEN;
-
-	/* Now we can attach the interface */
-	dprintf(("Attaching interface...\n"));
-	ether_ifattach(ifp, sc->el_enaddr);
-
-	/* Now reset the board */
-	dprintf(("Resetting board...\n"));
-	el_hardreset(sc);
-
-	dprintf(("el_attach() finished.\n"));
-	return(0);
-}
-
-static int el_detach(dev)
-	device_t dev;
-{
-	struct el_softc *sc;
-	struct ifnet *ifp;
-
-	sc = device_get_softc(dev);
-	ifp = sc->el_ifp;
-
-	el_stop(sc);
-	EL_LOCK(sc);
-	ether_ifdetach(ifp);
-	if_free(ifp);
-	bus_teardown_intr(dev, sc->el_irq, sc->el_intrhand);
-	bus_release_resource(dev, SYS_RES_IRQ, 0, sc->el_irq);
-	bus_release_resource(dev, SYS_RES_IOPORT, 0, sc->el_res);
-	EL_UNLOCK(sc);
-	mtx_destroy(&sc->el_mtx);
-
-	return(0);
-}
-
-static int
-el_shutdown(dev)
-	device_t dev;
-{
-	struct el_softc *sc;
-
-	sc = device_get_softc(dev);
-	el_stop(sc);
-	return(0);
-}
-
-/* This routine resets the interface. */
-static void 
-el_reset(xsc)
-	void *xsc;
-{
-	struct el_softc *sc = xsc;
-
-	dprintf(("elreset()\n"));
-	el_stop(sc);
-	el_init(sc);
-}
-
-static void el_stop(xsc)
-	void *xsc;
-{
-	struct el_softc *sc = xsc;
-
-	EL_LOCK(sc);
-	CSR_WRITE_1(sc,EL_AC,0);
-	el_hardreset(sc);
-	EL_UNLOCK(sc);
-}
-
-/* Initialize interface.  */
-static void 
-el_init(xsc)
-	void *xsc;
-{
-	struct el_softc *sc = xsc;
-	struct ifnet *ifp;
-
-	/* Set up pointers */
-	ifp = sc->el_ifp;
-
-	/* If address not known, do nothing. */
-	if(TAILQ_EMPTY(&ifp->if_addrhead)) /* XXX unlikely */
-		return;
-
-	EL_LOCK(sc);
-
-	/* First, reset the board. */
-	dprintf(("Resetting board...\n"));
-	el_hardreset(sc);
-
-	/* Configure rx */
-	dprintf(("Configuring rx...\n"));
-	if(ifp->if_flags & IFF_PROMISC)
-		CSR_WRITE_1(sc,EL_RXC,
-		    (EL_RXC_PROMISC|EL_RXC_ABROAD|EL_RXC_AMULTI|
-		    EL_RXC_AGF|EL_RXC_DSHORT|EL_RXC_DDRIB|EL_RXC_DOFLOW));
-	else
-		CSR_WRITE_1(sc,EL_RXC,
-		    (EL_RXC_ABROAD|EL_RXC_AMULTI|
-		    EL_RXC_AGF|EL_RXC_DSHORT|EL_RXC_DDRIB|EL_RXC_DOFLOW));
-	CSR_WRITE_1(sc,EL_RBC,0);
-
-	/* Configure TX */
-	dprintf(("Configuring tx...\n"));
-	CSR_WRITE_1(sc,EL_TXC,0);
-
-	/* Start reception */
-	dprintf(("Starting reception...\n"));
-	CSR_WRITE_1(sc,EL_AC,(EL_AC_IRQE|EL_AC_RX));
-
-	/* Set flags appropriately */
-	ifp->if_drv_flags |= IFF_DRV_RUNNING;
-	ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
-
-	/* And start output. */
-	el_start(ifp);
-
-	EL_UNLOCK(sc);
-}
-
-/* Start output on interface.  Get datagrams from the queue and output
- * them, giving the receiver a chance between datagrams.  Call only
- * from splimp or interrupt level!
- */
-static void
-el_start(struct ifnet *ifp)
-{
-	struct el_softc *sc;
-	struct mbuf *m, *m0;
-	int i, len, retries, done;
-
-	/* Get things pointing in the right directions */
-	sc = ifp->if_softc;
-
-	dprintf(("el_start()...\n"));
-	EL_LOCK(sc);
-
-	/* Don't do anything if output is active */
-	if(sc->el_ifp->if_drv_flags & IFF_DRV_OACTIVE)
-		return;
-	sc->el_ifp->if_drv_flags |= IFF_DRV_OACTIVE;
-
-	/* The main loop.  They warned me against endless loops, but
-	 * would I listen?  NOOO....
-	 */
-	while(1) {
-		/* Dequeue the next datagram */
-		IF_DEQUEUE(&sc->el_ifp->if_snd,m0);
-
-		/* If there's nothing to send, return. */
-		if(m0 == NULL) {
-			sc->el_ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
-			EL_UNLOCK(sc);
-			return;
-		}
-
-		/* Disable the receiver */
-		CSR_WRITE_1(sc,EL_AC,EL_AC_HOST);
-		CSR_WRITE_1(sc,EL_RBC,0);
-
-		/* Copy the datagram to the buffer. */
-		len = 0;
-		for(m = m0; m != NULL; m = m->m_next) {
-			if(m->m_len == 0)
-				continue;
-			bcopy(mtod(m,caddr_t),sc->el_pktbuf+len,m->m_len);
-			len += m->m_len;
-		}
-		m_freem(m0);
-
-		len = max(len,ETHER_MIN_LEN);
-
-		/* Give the packet to the bpf, if any */
-		BPF_TAP(sc->el_ifp, sc->el_pktbuf, len);
-
-		/* Transfer datagram to board */
-		dprintf(("el: xfr pkt length=%d...\n",len));
-		i = EL_BUFSIZ - len;
-		CSR_WRITE_1(sc,EL_GPBL,(i & 0xff));
-		CSR_WRITE_1(sc,EL_GPBH,((i>>8)&0xff));
-		bus_space_write_multi_1(sc->el_btag, sc->el_bhandle,
-		    EL_BUF, sc->el_pktbuf, len);
-
-		/* Now transmit the datagram */
-		retries=0;
-		done=0;
-		while(!done) {
-			if(el_xmit(sc,len)) { /* Something went wrong */
-				done = -1;
-				break;
-			}
-			/* Check out status */
-			i = CSR_READ_1(sc,EL_TXS);
-			dprintf(("tx status=0x%x\n",i));
-			if(!(i & EL_TXS_READY)) {
-				dprintf(("el: err txs=%x\n",i));
-				sc->el_ifp->if_oerrors++;
-				if(i & (EL_TXS_COLL|EL_TXS_COLL16)) {
-					if((!(i & EL_TXC_DCOLL16)) && retries < 15) {
-						retries++;
-						CSR_WRITE_1(sc,EL_AC,EL_AC_HOST);
-					}
-				}
-				else
-					done = 1;
-			}
-			else {
-				sc->el_ifp->if_opackets++;
-				done = 1;
-			}
-		}
-		if(done == -1)  /* Packet not transmitted */
-			continue;
-
-		/* Now give the card a chance to receive.
-		 * Gotta love 3c501s...
-		 */
-		(void)CSR_READ_1(sc,EL_AS);
-		CSR_WRITE_1(sc,EL_AC,(EL_AC_IRQE|EL_AC_RX));
-		EL_UNLOCK(sc);
-		/* Interrupt here */
-		EL_LOCK(sc);
-	}
-}
-
-/* This function actually attempts to transmit a datagram downloaded
- * to the board.  Call at splimp or interrupt, after downloading data!
- * Returns 0 on success, non-0 on failure
- */
-static int
-el_xmit(struct el_softc *sc,int len)
-{
-	int gpl;
-	int i;
-
-	gpl = EL_BUFSIZ - len;
-	dprintf(("el: xmit..."));
-	CSR_WRITE_1(sc,EL_GPBL,(gpl & 0xff));
-	CSR_WRITE_1(sc,EL_GPBH,((gpl>>8)&0xff));
-	CSR_WRITE_1(sc,EL_AC,EL_AC_TXFRX);
-	i = 20000;
-	while((CSR_READ_1(sc,EL_AS) & EL_AS_TXBUSY) && (i>0))
-		i--;
-	if(i == 0) {
-		dprintf(("tx not ready\n"));
-		sc->el_ifp->if_oerrors++;
-		return(-1);
-	}
-	dprintf(("%d cycles.\n",(20000-i)));
-	return(0);
-}
-
-/* Pass a packet up to the higher levels. */
-static __inline void
-elread(struct el_softc *sc,caddr_t buf,int len)
-{
-	struct ifnet *ifp = sc->el_ifp;
-	struct mbuf *m;
-
-	/*
-	 * Put packet into an mbuf chain
-	 */
-	m = elget(buf,len,ifp);
-	if(m == 0)
-		return;
-
-	(*ifp->if_input)(ifp,m);
-}
-
-/* controller interrupt */
-static void
-elintr(void *xsc)
-{
-	register struct el_softc *sc;
-	int stat, rxstat, len, done;
-
-
-	/* Get things pointing properly */
-	sc = xsc;
-	EL_LOCK(sc);
-	dprintf(("elintr: "));
-
-	/* Check board status */
-	stat = CSR_READ_1(sc,EL_AS);
-	if(stat & EL_AS_RXBUSY) {
-		(void)CSR_READ_1(sc,EL_RXC);
-		CSR_WRITE_1(sc,EL_AC,(EL_AC_IRQE|EL_AC_RX));
-		EL_UNLOCK(sc);
-		return;
-	}
-
-	done = 0;
-	while(!done) {
-		rxstat = CSR_READ_1(sc,EL_RXS);
-		if(rxstat & EL_RXS_STALE) {
-			(void)CSR_READ_1(sc,EL_RXC);
-			CSR_WRITE_1(sc,EL_AC,(EL_AC_IRQE|EL_AC_RX));
-			EL_UNLOCK(sc);
-			return;
-		}
-
-		/* If there's an overflow, reinit the board. */
-		if(!(rxstat & EL_RXS_NOFLOW)) {
-			dprintf(("overflow.\n"));
-			el_hardreset(sc);
-			/* Put board back into receive mode */
-			if(sc->el_ifp->if_flags & IFF_PROMISC)
-				CSR_WRITE_1(sc,EL_RXC,
-				    (EL_RXC_PROMISC|EL_RXC_ABROAD|
-		    		    EL_RXC_AMULTI|EL_RXC_AGF|EL_RXC_DSHORT|
-				    EL_RXC_DDRIB|EL_RXC_DOFLOW));
-			else
-				CSR_WRITE_1(sc,EL_RXC,
-				    (EL_RXC_ABROAD|
-		    		    EL_RXC_AMULTI|EL_RXC_AGF|EL_RXC_DSHORT|
-				    EL_RXC_DDRIB|EL_RXC_DOFLOW));
-			(void)CSR_READ_1(sc,EL_AS);
-			CSR_WRITE_1(sc,EL_RBC,0);
-			(void)CSR_READ_1(sc,EL_RXC);
-			CSR_WRITE_1(sc,EL_AC,(EL_AC_IRQE|EL_AC_RX));
-			EL_UNLOCK(sc);
-			return;
-		}
-
-		/* Incoming packet */
-		len = CSR_READ_1(sc,EL_RBL);
-		len |= CSR_READ_1(sc,EL_RBH) << 8;
-		dprintf(("receive len=%d rxstat=%x ",len,rxstat));
-		CSR_WRITE_1(sc,EL_AC,EL_AC_HOST);
-
-		/* If packet too short or too long, restore rx mode and return
-		 */
-		if((len <= sizeof(struct ether_header)) || (len > ETHER_MAX_LEN)) {
-			if(sc->el_ifp->if_flags & IFF_PROMISC)
-				CSR_WRITE_1(sc,EL_RXC,
-				    (EL_RXC_PROMISC|EL_RXC_ABROAD|
-		    		    EL_RXC_AMULTI|EL_RXC_AGF|EL_RXC_DSHORT|
-				    EL_RXC_DDRIB|EL_RXC_DOFLOW));
-			else
-				CSR_WRITE_1(sc,EL_RXC,
-				    (EL_RXC_ABROAD|
-		    		    EL_RXC_AMULTI|EL_RXC_AGF|EL_RXC_DSHORT|
-				    EL_RXC_DDRIB|EL_RXC_DOFLOW));
-			(void)CSR_READ_1(sc,EL_AS);
-			CSR_WRITE_1(sc,EL_RBC,0);
-			(void)CSR_READ_1(sc,EL_RXC);
-			CSR_WRITE_1(sc,EL_AC,(EL_AC_IRQE|EL_AC_RX));
-			EL_UNLOCK(sc);
-			return;
-		}
-
-		sc->el_ifp->if_ipackets++;
-
-		/* Copy the data into our buffer */
-		CSR_WRITE_1(sc,EL_GPBL,0);
-		CSR_WRITE_1(sc,EL_GPBH,0);
-		bus_space_read_multi_1(sc->el_btag, sc->el_bhandle,
-		    EL_BUF, sc->el_pktbuf, len);
-		CSR_WRITE_1(sc,EL_RBC,0);
-		CSR_WRITE_1(sc,EL_AC,EL_AC_RX);
-		dprintf(("%6D-->",sc->el_pktbuf+6,":"));
-		dprintf(("%6D\n",sc->el_pktbuf,":"));
-
-		/* Pass data up to upper levels */
-		elread(sc,(caddr_t)(sc->el_pktbuf),len);
-
-		/* Is there another packet? */
-		stat = CSR_READ_1(sc,EL_AS);
-
-		/* If so, do it all again (i.e. don't set done to 1) */
-		if(!(stat & EL_AS_RXBUSY))
-			dprintf(("<rescan> "));
-		else
-			done = 1;
-	}
-
-	(void)CSR_READ_1(sc,EL_RXC);
-	CSR_WRITE_1(sc,EL_AC,(EL_AC_IRQE|EL_AC_RX));
-	EL_UNLOCK(sc);
-	return;
-}
-
-/*
- * Pull read data off an interface.
- * Len is length of data, with local net header stripped.
- */
-static struct mbuf *
-elget(buf, totlen, ifp)
-        caddr_t buf;
-        int totlen;
-        struct ifnet *ifp;
-{
-        struct mbuf *top, **mp, *m;
-        int len;
-        register caddr_t cp;
-        char *epkt;
-
-        buf += sizeof(struct ether_header);
-        cp = buf;
-        epkt = cp + totlen;
-
-        MGETHDR(m, M_DONTWAIT, MT_DATA);
-        if (m == 0)
-                return (0);
-        m->m_pkthdr.rcvif = ifp;
-        m->m_pkthdr.len = totlen;
-        m->m_len = MHLEN;
-        top = 0;
-        mp = ⊤
-        while (totlen > 0) {
-                if (top) {
-                        MGET(m, M_DONTWAIT, MT_DATA);
-                        if (m == 0) {
-                                m_freem(top);
-                                return (0);
-                        }
-                        m->m_len = MLEN;
-                }
-                len = min(totlen, epkt - cp);
-                if (len >= MINCLSIZE) {
-                        MCLGET(m, M_DONTWAIT);
-                        if (m->m_flags & M_EXT)
-                                m->m_len = len = min(len, MCLBYTES);
-                        else
-                                len = m->m_len;
-                } else {
-                        /*
-                         * Place initial small packet/header at end of mbuf.
-                         */
-                        if (len < m->m_len) {
-                                if (top == 0 && len + max_linkhdr <= m->m_len)
-                                        m->m_data += max_linkhdr;
-                                m->m_len = len;
-                        } else
-                                len = m->m_len;
-                }
-                bcopy(cp, mtod(m, caddr_t), (unsigned)len);
-                cp += len;
-                *mp = m;
-                mp = &m->m_next;
-                totlen -= len;
-                if (cp == epkt)
-                        cp = buf;
-        }
-        return (top);
-}
-
-/*
- * Process an ioctl request. This code needs some work - it looks
- *	pretty ugly.
- */
-static int
-el_ioctl(ifp, command, data)
-	register struct ifnet *ifp;
-	u_long command;
-	caddr_t data;
-{
-	int error = 0;
-	struct el_softc *sc;
-
-	sc = ifp->if_softc;
-	EL_LOCK(sc);
-
-	switch (command) {
-	case SIOCSIFFLAGS:
-		/*
-		 * If interface is marked down and it is running, then stop it
-		 */
-		if (((ifp->if_flags & IFF_UP) == 0) &&
-		    (ifp->if_drv_flags & IFF_DRV_RUNNING)) {
-			el_stop(ifp->if_softc);
-			ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
-		} else {
-		/*
-		 * If interface is marked up and it is stopped, then start it
-		 */
-			if ((ifp->if_flags & IFF_UP) &&
-		    	    ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0))
-				el_init(ifp->if_softc);
-		}
-		break;
-	default:
-		error = ether_ioctl(ifp, command, data);
-		break;
-	}
-	EL_UNLOCK(sc);
-	return (error);
-}
-
-/* Device timeout routine */
-static void
-el_watchdog(struct ifnet *ifp)
-{
-	log(LOG_ERR,"%s: device timeout\n", ifp->if_xname);
-	ifp->if_oerrors++;
-	el_reset(ifp->if_softc);
-}
Index: vesa.c
===================================================================
RCS file: /home/cvs/src/sys/i386/isa/vesa.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/i386/isa/vesa.c -L sys/i386/isa/vesa.c -u -r1.1.1.1 -r1.2
--- sys/i386/isa/vesa.c
+++ sys/i386/isa/vesa.c
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/i386/isa/vesa.c,v 1.51.2.1 2005/10/05 21:48:03 marius Exp $");
+__FBSDID("$FreeBSD: src/sys/i386/isa/vesa.c,v 1.53 2005/12/05 11:58:33 ru Exp $");
 
 #include "opt_vga.h"
 #include "opt_vesa.h"
@@ -1173,7 +1173,7 @@
 static int
 vesa_load_palette(video_adapter_t *adp, u_char *palette)
 {
-#if notyet
+#ifdef notyet
 	int bits;
 	int error;
 
@@ -1393,7 +1393,7 @@
 	    u_char *red, u_char *green, u_char *blue, u_char *trans)
 {
 	return 1;
-#if notyet
+#ifdef notyet
 	u_char *r;
 	u_char *g;
 	u_char *b;
Index: isa.c
===================================================================
RCS file: /home/cvs/src/sys/i386/isa/isa.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/i386/isa/isa.c -L sys/i386/isa/isa.c -u -r1.1.1.1 -r1.2
--- sys/i386/isa/isa.c
+++ sys/i386/isa/isa.c
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/i386/isa/isa.c,v 1.148 2005/01/06 22:18:16 imp Exp $");
+__FBSDID("$FreeBSD: src/sys/i386/isa/isa.c,v 1.151 2007/09/01 12:18:28 nyan Exp $");
 
 /*-
  * Modifications for Intel architecture by Garrett A. Wollman.
@@ -57,9 +57,6 @@
  * SUCH DAMAGE.
  */
 
-#ifdef PC98 
-#define __RMAN_RESOURCE_VISIBLE
-#endif
 #include <sys/param.h>
 #include <sys/bus.h>
 #include <sys/kernel.h>
@@ -247,11 +244,13 @@
 
 	if (type == SYS_RES_MEMORY || type == SYS_RES_IOPORT) {
 		bh = rman_get_bushandle(r);
-		for (i = 1; i < bh->bsh_ressz; i++)
-			resource_list_release(rl, bus, child, type, rid + i,
-					      bh->bsh_res[i]);
-		if (bh->bsh_res != NULL)
-			free(bh->bsh_res, M_DEVBUF);
+		if (bh != NULL) {
+			for (i = 1; i < bh->bsh_ressz; i++)
+				resource_list_release(rl, bus, child, type,
+						      rid + i, bh->bsh_res[i]);
+			if (bh->bsh_res != NULL)
+				free(bh->bsh_res, M_DEVBUF);
+		}
 	}
 #endif
 	return resource_list_release(rl, bus, child, type, rid, r);
@@ -265,10 +264,11 @@
  */
 int
 isa_setup_intr(device_t bus, device_t child, struct resource *r, int flags,
-	       void (*ihand)(void *), void *arg, void **cookiep)
+	       driver_filter_t filter, void (*ihand)(void *), void *arg,
+	       void **cookiep)
 {
 	return (BUS_SETUP_INTR(device_get_parent(bus), child, r, flags,
-			       ihand, arg, cookiep));
+			       filter, ihand, arg, cookiep));
 }
 
 int
Index: npx.c
===================================================================
RCS file: /home/cvs/src/sys/i386/isa/npx.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -L sys/i386/isa/npx.c -L sys/i386/isa/npx.c -u -r1.4 -r1.5
--- sys/i386/isa/npx.c
+++ sys/i386/isa/npx.c
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/i386/isa/npx.c,v 1.162.2.1 2005/12/12 19:36:50 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/i386/isa/npx.c,v 1.172 2007/06/05 00:00:52 jeff Exp $");
 
 #include "opt_cpu.h"
 #include "opt_isa.h"
@@ -62,7 +62,6 @@
 #include <machine/md_var.h>
 #include <machine/pcb.h>
 #include <machine/psl.h>
-#include <machine/clock.h>
 #include <machine/resource.h>
 #include <machine/specialreg.h>
 #include <machine/segments.h>
@@ -150,7 +149,7 @@
 static	void	fpurstor(union savefpu *);
 static	int	npx_attach(device_t dev);
 static	void	npx_identify(driver_t *driver, device_t parent);
-static	void	npx_intr(void *);
+static	int	npx_intr(void *);
 static	int	npx_probe(device_t dev);
 #ifdef I586_CPU_XXX
 static	long	timezero(const char *funcname,
@@ -202,7 +201,7 @@
 /*
  * Do minimal handling of npx interrupts to convert them to traps.
  */
-static void
+static int
 npx_intr(dummy)
 	void *dummy;
 {
@@ -231,17 +230,16 @@
 	td = PCPU_GET(fpcurthread);
 	if (td != NULL) {
 		td->td_pcb->pcb_flags |= PCB_NPXTRAP;
-		mtx_lock_spin(&sched_lock);
+		thread_lock(td);
 		td->td_flags |= TDF_ASTPENDING;
-		mtx_unlock_spin(&sched_lock);
+		thread_unlock(td);
 	}
+	return (FILTER_HANDLED);
 }
 
 /*
- * Probe routine.  Initialize cr0 to give correct behaviour for [f]wait
- * whether the device exists or not (XXX should be elsewhere).  Set flags
- * to tell npxattach() what to do.  Modify device struct if npx doesn't
- * need to use interrupts.  Return 0 if device exists.
+ * Probe routine.  Set flags to tell npxattach() what to do.  Set up an
+ * interrupt handler if npx needs to use interrupts.
  */
 static int
 npx_probe(dev)
@@ -265,7 +263,7 @@
 		hw_float = npx_exists = 1;
 		npx_ex16 = 1;
 		device_quiet(dev);
-		return 0;
+		return (0);
 	}
 
 	save_idt_npxtrap = idt[IDT_MF];
@@ -282,8 +280,8 @@
 	irq_res = bus_alloc_resource(dev, SYS_RES_IRQ, &irq_rid, irq_num,
 	    irq_num, 1, RF_ACTIVE);
 	if (irq_res != NULL) {
-		if (bus_setup_intr(dev, irq_res, INTR_TYPE_MISC | INTR_FAST,
-			npx_intr, NULL, &irq_cookie) != 0)
+		if (bus_setup_intr(dev, irq_res, INTR_TYPE_MISC,
+			npx_intr, NULL, NULL, &irq_cookie) != 0)
 			panic("npx: can't create intr");
 	}
 
@@ -298,6 +296,7 @@
 	 * Don't trap while we're probing.
 	 */
 	stop_emulating();
+
 	/*
 	 * Finish resetting the coprocessor, if any.  If there is an error
 	 * pending, then we may get a bogus IRQ13, but npx_intr() will handle
@@ -423,7 +422,7 @@
 		if (cpu_fxsr) {
 			if (npx_cleanstate.sv_xmm.sv_env.en_mxcsr_mask)
 				cpu_mxcsr_mask = 
-					npx_cleanstate.sv_xmm.sv_env.en_mxcsr_mask;
+			    	    npx_cleanstate.sv_xmm.sv_env.en_mxcsr_mask;
 			else
 				cpu_mxcsr_mask = 0xFFBF;
 		}
Index: clock.c
===================================================================
RCS file: /home/cvs/src/sys/i386/isa/clock.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/i386/isa/clock.c -L sys/i386/isa/clock.c -u -r1.1.1.1 -r1.2
--- sys/i386/isa/clock.c
+++ sys/i386/isa/clock.c
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/i386/isa/clock.c,v 1.222.2.1 2005/07/18 19:52:04 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/i386/isa/clock.c,v 1.239.2.1 2007/10/29 22:26:35 peter Exp $");
 
 /*
  * Routines to handle clock hardware.
@@ -50,24 +50,31 @@
 #include "opt_clock.h"
 #include "opt_isa.h"
 #include "opt_mca.h"
+#include "opt_xbox.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/bus.h>
+#include <sys/clock.h>
+#include <sys/conf.h>
+#include <sys/fcntl.h>
 #include <sys/lock.h>
 #include <sys/kdb.h>
 #include <sys/mutex.h>
 #include <sys/proc.h>
 #include <sys/time.h>
 #include <sys/timetc.h>
+#include <sys/uio.h>
 #include <sys/kernel.h>
 #include <sys/limits.h>
 #include <sys/module.h>
+#include <sys/sched.h>
 #include <sys/sysctl.h>
 #include <sys/cons.h>
 #include <sys/power.h>
 
 #include <machine/clock.h>
+#include <machine/cpu.h>
 #include <machine/cputypes.h>
 #include <machine/frame.h>
 #include <machine/intr_machdep.h>
@@ -90,18 +97,9 @@
 #include <i386/bios/mca_machdep.h>
 #endif
 
-/*
- * 32-bit time_t's can't reach leap years before 1904 or after 2036, so we
- * can use a simple formula for leap years.
- */
-#define	LEAPYEAR(y) (((u_int)(y) % 4 == 0) ? 1 : 0)
-#define DAYSPERYEAR   (31+28+31+30+31+30+31+31+30+31+30+31)
-
 #define	TIMER_DIV(x) ((timer_freq + (x) / 2) / (x))
 
-int	adjkerntz;		/* local offset from GMT in seconds */
 int	clkintr_pending;
-int	disable_rtc_set;	/* disable resettodr() if != 0 */
 int	pscnt = 1;
 int	psdiv = 1;
 int	statclock_disable;
@@ -111,19 +109,18 @@
 u_int	timer_freq = TIMER_FREQ;
 int	timer0_max_count;
 int	timer0_real_max_count;
-int	wall_cmos_clock;	/* wall CMOS clock assumed if != 0 */
-struct mtx clock_lock;
 #define	RTC_LOCK	mtx_lock_spin(&clock_lock)
 #define	RTC_UNLOCK	mtx_unlock_spin(&clock_lock)
 
 static	int	beeping = 0;
-static	const u_char daysinmonth[] = {31,28,31,30,31,30,31,31,30,31,30,31};
+static	struct mtx clock_lock;
 static	struct intsrc *i8254_intsrc;
 static	u_int32_t i8254_lastcount;
 static	u_int32_t i8254_offset;
 static	int	(*i8254_pending)(struct intsrc *);
 static	int	i8254_ticked;
 static	int	using_lapic_timer;
+static	int	rtc_reg = -1;
 static	u_char	rtc_statusa = RTCSA_DIVIDER | RTCSA_NOPROF;
 static	u_char	rtc_statusb = RTCSB_24HR;
 
@@ -148,8 +145,8 @@
 	0			/* quality */
 };
 
-static void
-clkintr(struct clockframe *frame)
+static int
+clkintr(struct trapframe *frame)
 {
 
 	if (timecounter->tc_get_timecount == i8254_get_timecount) {
@@ -163,13 +160,14 @@
 		clkintr_pending = 0;
 		mtx_unlock_spin(&clock_lock);
 	}
-	if (!using_lapic_timer)
-		hardclock(frame);
+	KASSERT(!using_lapic_timer, ("clk interrupt enabled with lapic timer"));
+	hardclock(TRAPF_USERMODE(frame), TRAPF_PC(frame));
 #ifdef DEV_MCA
 	/* Reset clock interrupt by asserting bit 7 of port 0x61 */
 	if (MCA_system)
 		outb(0x61, inb(0x61) | 0x80);
 #endif
+	return (FILTER_HANDLED);
 }
 
 int
@@ -224,19 +222,20 @@
  * Stat clock ticks can still be lost, causing minor loss of accuracy
  * in the statistics, but the stat clock will no longer stop.
  */
-static void
-rtcintr(struct clockframe *frame)
+static int
+rtcintr(struct trapframe *frame)
 {
 
 	while (rtcin(RTC_INTR) & RTCIR_PERIOD) {
 		if (profprocs != 0) {
 			if (--pscnt == 0)
 				pscnt = psdiv;
-			profclock(frame);
+			profclock(TRAPF_USERMODE(frame), TRAPF_PC(frame));
 		}
 		if (pscnt == psdiv)
-			statclock(frame);
+			statclock(TRAPF_USERMODE(frame));
 	}
+	return (FILTER_HANDLED);
 }
 
 #include "opt_ddb.h"
@@ -283,7 +282,21 @@
 	int getit_calls = 1;
 	int n1;
 	static int state = 0;
+#endif
+
+	if (tsc_freq != 0 && !tsc_is_broken) {
+		uint64_t start, end, now;
 
+		sched_pin();
+		start = rdtsc();
+		end = start + (tsc_freq * n) / 1000000;
+		do {
+			now = rdtsc();
+		} while (now < end || (now > start && end < start));
+		sched_unpin();
+		return;
+	}
+#ifdef DELAYDEBUG
 	if (state == 0) {
 		state = 1;
 		for (n1 = 1; n1 <= 10000000; n1 *= 10)
@@ -294,13 +307,6 @@
 		printf("DELAY(%d)...", n);
 #endif
 	/*
-	 * Guard against the timer being uninitialized if we are called
-	 * early for console i/o.
-	 */
-	if (timer0_max_count == 0)
-		set_timer_freq(timer_freq, hz);
-
-	/*
 	 * Read the counter first, so that the rest of the setup overhead is
 	 * counted.  Guess the initial overhead is 20 usec (on most systems it
 	 * takes about 1.5 usec for each of the i/o's in getit().  The loop
@@ -421,24 +427,30 @@
 	u_char val;
 
 	RTC_LOCK;
-	outb(IO_RTC, reg);
-	inb(0x84);
+	if (rtc_reg != reg) {
+		inb(0x84);
+		outb(IO_RTC, reg);
+		rtc_reg = reg;
+		inb(0x84);
+	}
 	val = inb(IO_RTC + 1);
-	inb(0x84);
 	RTC_UNLOCK;
 	return (val);
 }
 
-static __inline void
-writertc(u_char reg, u_char val)
+void
+writertc(int reg, u_char val)
 {
 
 	RTC_LOCK;
-	inb(0x84);
-	outb(IO_RTC, reg);
-	inb(0x84);
+	if (rtc_reg != reg) {
+		inb(0x84);
+		outb(IO_RTC, reg);
+		rtc_reg = reg;
+		inb(0x84);
+	}
 	outb(IO_RTC + 1, val);
-	inb(0x84);		/* XXX work around wrong order in rtcin() */
+	inb(0x84);
 	RTC_UNLOCK;
 }
 
@@ -570,6 +582,7 @@
 
 	/* Restore all of the RTC's "status" (actually, control) registers. */
 	/* XXX locking is needed for RTC access. */
+	rtc_reg = -1;
 	writertc(RTC_STATUSB, RTCSB_24HR);
 	writertc(RTC_STATUSA, rtc_statusa);
 	writertc(RTC_STATUSB, rtc_statusb);
@@ -591,10 +604,15 @@
 	rtc_restore();			/* reenable RTC interrupts */
 }
 
-/*
- * Initialize 8254 timer 0 early so that it can be used in DELAY().
- * XXX initialization of other timers is unintentionally left blank.
- */
+/* This is separate from startrtclock() so that it can be called early. */
+void
+i8254_init(void)
+{
+
+	mtx_init(&clock_lock, "clk", NULL, MTX_SPIN | MTX_NOPROFILE);
+	set_timer_freq(timer_freq, hz);
+}
+
 void
 startrtclock()
 {
@@ -603,7 +621,6 @@
 	writertc(RTC_STATUSA, rtc_statusa);
 	writertc(RTC_STATUSB, RTCSB_24HR);
 
-	set_timer_freq(timer_freq, hz);
 	freq = calibrate_clocks();
 #ifdef CLK_CALIBRATION_LOOP
 	if (bootverbose) {
@@ -648,10 +665,9 @@
 void
 inittodr(time_t base)
 {
-	unsigned long	sec, days;
-	int		year, month;
-	int		y, m, s;
+	int s;
 	struct timespec ts;
+	struct clocktime ct;
 
 	if (base) {
 		s = splclock();
@@ -662,8 +678,10 @@
 	}
 
 	/* Look if we have a RTC present and the time is valid */
-	if (!(rtcin(RTC_STATUSD) & RTCSD_PWR))
-		goto wrong_time;
+	if (!(rtcin(RTC_STATUSD) & RTCSD_PWR)) {
+		printf("Invalid time in clock: check and reset the date!\n");
+		return;
+	}
 
 	/* wait for time update to complete */
 	/* If RTCSA_TUP is zero, we have at least 244us before next update */
@@ -672,49 +690,27 @@
 		splx(s);
 		s = splhigh();
 	}
-
-	days = 0;
+	ct.nsec = 0;
+	ct.sec = readrtc(RTC_SEC);
+	ct.min = readrtc(RTC_MIN);
+	ct.hour = readrtc(RTC_HRS);
+	ct.day = readrtc(RTC_DAY);
+	ct.dow = readrtc(RTC_WDAY) - 1;
+	ct.mon = readrtc(RTC_MONTH);
+	ct.year = readrtc(RTC_YEAR);
 #ifdef USE_RTC_CENTURY
-	year = readrtc(RTC_YEAR) + readrtc(RTC_CENTURY) * 100;
+	ct.year += readrtc(RTC_CENTURY) * 100;
 #else
-	year = readrtc(RTC_YEAR) + 1900;
-	if (year < 1970)
-		year += 100;
+	ct.year += 2000;
 #endif
-	if (year < 1970) {
-		splx(s);
-		goto wrong_time;
-	}
-	month = readrtc(RTC_MONTH);
-	for (m = 1; m < month; m++)
-		days += daysinmonth[m-1];
-	if ((month > 2) && LEAPYEAR(year))
-		days ++;
-	days += readrtc(RTC_DAY) - 1;
-	for (y = 1970; y < year; y++)
-		days += DAYSPERYEAR + LEAPYEAR(y);
-	sec = ((( days * 24 +
-		  readrtc(RTC_HRS)) * 60 +
-		  readrtc(RTC_MIN)) * 60 +
-		  readrtc(RTC_SEC));
-	/* sec now contains the number of seconds, since Jan 1 1970,
-	   in the local time zone */
-
-	sec += tz_minuteswest * 60 + (wall_cmos_clock ? adjkerntz : 0);
-
-	y = time_second - sec;
-	if (y <= -2 || y >= 2) {
-		/* badly off, adjust it */
-		ts.tv_sec = sec;
-		ts.tv_nsec = 0;
-		tc_setclock(&ts);
+	/* Set dow = -1 because some clocks don't set it correctly. */
+	ct.dow = -1;
+	if (clock_ct_to_ts(&ct, &ts)) {
+		printf("Invalid time in clock: check and reset the date!\n");
+		return;
 	}
-	splx(s);
-	return;
-
-wrong_time:
-	printf("Invalid time in real time clock.\n");
-	printf("Check and reset the date immediately!\n");
+	ts.tv_sec += utc_offset();
+	tc_setclock(&ts);
 }
 
 /*
@@ -723,52 +719,30 @@
 void
 resettodr()
 {
-	unsigned long	tm;
-	int		y, m, s;
+	struct timespec	ts;
+	struct clocktime ct;
 
 	if (disable_rtc_set)
 		return;
 
-	s = splclock();
-	tm = time_second;
-	splx(s);
+	getnanotime(&ts);
+	ts.tv_sec -= utc_offset();
+	clock_ts_to_ct(&ts, &ct);
 
 	/* Disable RTC updates and interrupts. */
 	writertc(RTC_STATUSB, RTCSB_HALT | RTCSB_24HR);
 
-	/* Calculate local time to put in RTC */
-
-	tm -= tz_minuteswest * 60 + (wall_cmos_clock ? adjkerntz : 0);
-
-	writertc(RTC_SEC, bin2bcd(tm%60)); tm /= 60;	/* Write back Seconds */
-	writertc(RTC_MIN, bin2bcd(tm%60)); tm /= 60;	/* Write back Minutes */
-	writertc(RTC_HRS, bin2bcd(tm%24)); tm /= 24;	/* Write back Hours   */
-
-	/* We have now the days since 01-01-1970 in tm */
-	writertc(RTC_WDAY, (tm + 4) % 7 + 1);		/* Write back Weekday */
-	for (y = 1970, m = DAYSPERYEAR + LEAPYEAR(y);
-	     tm >= m;
-	     y++,      m = DAYSPERYEAR + LEAPYEAR(y))
-	     tm -= m;
-
-	/* Now we have the years in y and the day-of-the-year in tm */
-	writertc(RTC_YEAR, bin2bcd(y%100));		/* Write back Year    */
+	writertc(RTC_SEC, bin2bcd(ct.sec)); 		/* Write back Seconds */
+	writertc(RTC_MIN, bin2bcd(ct.min)); 		/* Write back Minutes */
+	writertc(RTC_HRS, bin2bcd(ct.hour));		/* Write back Hours   */
+
+	writertc(RTC_WDAY, ct.dow + 1);			/* Write back Weekday */
+	writertc(RTC_DAY, bin2bcd(ct.day));		/* Write back Day */
+	writertc(RTC_MONTH, bin2bcd(ct.mon));           /* Write back Month   */
+	writertc(RTC_YEAR, bin2bcd(ct.year % 100));	/* Write back Year    */
 #ifdef USE_RTC_CENTURY
-	writertc(RTC_CENTURY, bin2bcd(y/100));		/* ... and Century    */
+	writertc(RTC_CENTURY, bin2bcd(ct.year / 100));	/* ... and Century    */
 #endif
-	for (m = 0; ; m++) {
-		int ml;
-
-		ml = daysinmonth[m];
-		if (m == 1 && LEAPYEAR(y))
-			ml++;
-		if (tm < ml)
-			break;
-		tm -= ml;
-	}
-
-	writertc(RTC_MONTH, bin2bcd(m + 1));            /* Write back Month   */
-	writertc(RTC_DAY, bin2bcd(tm + 1));             /* Write back Month Day */
 
 	/* Reenable RTC updates and interrupts. */
 	writertc(RTC_STATUSB, rtc_statusb);
@@ -794,8 +768,8 @@
 	 * timecounter to user a simpler algorithm.
 	 */
 	if (!using_lapic_timer) {
-		intr_add_handler("clk", 0, (driver_intr_t *)clkintr, NULL,
-		    INTR_TYPE_CLK | INTR_FAST, NULL);
+		intr_add_handler("clk", 0, (driver_filter_t *)clkintr, NULL,
+		    NULL, INTR_TYPE_CLK, NULL);
 		i8254_intsrc = intr_lookup_source(0);
 		if (i8254_intsrc != NULL)
 			i8254_pending =
@@ -828,8 +802,8 @@
 
 		/* Enable periodic interrupts from the RTC. */
 		rtc_statusb |= RTCSB_PINTR;
-		intr_add_handler("rtc", 8, (driver_intr_t *)rtcintr, NULL,
-		    INTR_TYPE_CLK | INTR_FAST, NULL);
+		intr_add_handler("rtc", 8, (driver_filter_t *)rtcintr, NULL, NULL,
+		    INTR_TYPE_CLK, NULL);
 
 		writertc(RTC_STATUSB, rtc_statusb);
 		rtcin(RTC_INTR);
@@ -871,7 +845,7 @@
 	 * is is too generic.  Should use it everywhere.
 	 */
 	freq = timer_freq;
-	error = sysctl_handle_int(oidp, &freq, sizeof(freq), req);
+	error = sysctl_handle_int(oidp, &freq, 0, req);
 	if (error == 0 && req->newptr != NULL)
 		set_timer_freq(freq, hz);
 	return (error);
@@ -963,4 +937,5 @@
 
 DRIVER_MODULE(attimer, isa, attimer_driver, attimer_devclass, 0, 0);
 DRIVER_MODULE(attimer, acpi, attimer_driver, attimer_devclass, 0, 0);
+
 #endif /* DEV_ISA */
Index: prof_machdep.c
===================================================================
RCS file: /home/cvs/src/sys/i386/isa/prof_machdep.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/i386/isa/prof_machdep.c -L sys/i386/isa/prof_machdep.c -u -r1.1.1.1 -r1.2
--- sys/i386/isa/prof_machdep.c
+++ sys/i386/isa/prof_machdep.c
@@ -25,33 +25,25 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/i386/isa/prof_machdep.c,v 1.25 2005/05/20 17:16:24 njl Exp $");
-
-#include <sys/param.h>
-#include <sys/systm.h>
-
-#include <machine/asmacros.h>
-#include <machine/timerreg.h>
-
-/*
- * There are 2 definitions of MCOUNT to have a C version and an asm version
- * with the same name and not have LOCORE #ifdefs to distinguish them.
- * <machine/profile.h> provides a C version, and <machine/asmacros.h>
- * provides an asm version.  To avoid conflicts, #undef the asm version.
- */
-#undef MCOUNT
+__FBSDID("$FreeBSD: src/sys/i386/isa/prof_machdep.c,v 1.30 2007/03/26 18:03:29 njl Exp $");
 
 #ifdef GUPROF
 #include "opt_i586_guprof.h"
 #include "opt_perfmon.h"
 
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/bus.h>
+#include <sys/cpu.h>
+#include <sys/eventhandler.h>
 #include <sys/gmon.h>
 #include <sys/kernel.h>
+#include <sys/smp.h>
 #include <sys/sysctl.h>
 
 #include <machine/clock.h>
 #include <machine/perfmon.h>
-#include <machine/profile.h>
+#include <machine/timerreg.h>
 
 #define	CPUTIME_CLOCK_UNINITIALIZED	0
 #define	CPUTIME_CLOCK_I8254		1
@@ -62,11 +54,14 @@
 int	cputime_bias = 1;	/* initialize for locality of reference */
 
 static int	cputime_clock = CPUTIME_CLOCK_UNINITIALIZED;
-#ifdef I586_PMC_GUPROF
+#if defined(PERFMON) && defined(I586_PMC_GUPROF)
 static u_int	cputime_clock_pmc_conf = I586_PMC_GUPROF;
 static int	cputime_clock_pmc_init;
 static struct gmonparam saved_gmp;
 #endif
+#if defined(I586_CPU) || defined(I686_CPU)
+static int	cputime_prof_active;
+#endif
 #endif /* GUPROF */
 
 #ifdef __GNUCLIKE_ASM
@@ -82,22 +77,22 @@
 	#							\n\
 	# Check that we are profiling.  Do it early for speed.	\n\
 	#							\n\
-	cmpl	$GMON_PROF_OFF," __XSTRING(CNAME(_gmonparam)) "+GM_STATE \n\
- 	je	.mcount_exit					\n\
- 	#							\n\
- 	# __mcount is the same as [.]mcount except the caller	\n\
- 	# hasn't changed the stack except to call here, so the	\n\
+	cmpl	$GMON_PROF_OFF,_gmonparam+GM_STATE		\n\
+	je	.mcount_exit					\n\
+	#							\n\
+	# __mcount is the same as [.]mcount except the caller	\n\
+	# hasn't changed the stack except to call here, so the	\n\
 	# caller's raddr is above our raddr.			\n\
 	#							\n\
- 	movl	4(%esp),%edx					\n\
- 	jmp	.got_frompc					\n\
- 								\n\
- 	.p2align 4,0x90						\n\
- 	.globl	" __XSTRING(HIDENAME(mcount)) "			\n\
-" __XSTRING(HIDENAME(mcount)) ":				\n\
- 	.globl	__cyg_profile_func_enter			\n\
+	movl	4(%esp),%edx					\n\
+	jmp	.got_frompc					\n\
+								\n\
+	.p2align 4,0x90						\n\
+	.globl	.mcount						\n\
+.mcount:							\n\
+	.globl	__cyg_profile_func_enter			\n\
 __cyg_profile_func_enter:					\n\
-	cmpl	$GMON_PROF_OFF," __XSTRING(CNAME(_gmonparam)) "+GM_STATE \n\
+	cmpl	$GMON_PROF_OFF,_gmonparam+GM_STATE		\n\
 	je	.mcount_exit					\n\
 	#							\n\
 	# The caller's stack frame has already been built, so	\n\
@@ -116,14 +111,14 @@
 	pushl	%eax						\n\
 	pushl	%edx						\n\
 	cli							\n\
-	call	" __XSTRING(CNAME(mcount)) "			\n\
+	call	mcount						\n\
 	addl	$8,%esp						\n\
 	popfl							\n\
 .mcount_exit:							\n\
 	ret							\n\
 ");
 #else /* !__GNUCLIKE_ASM */
-#error this file needs to be ported to your compiler
+#error "this file needs to be ported to your compiler"
 #endif /* __GNUCLIKE_ASM */
 
 #ifdef GUPROF
@@ -148,11 +143,11 @@
 GMON_PROF_HIRES	=	4					\n\
 								\n\
 	.p2align 4,0x90						\n\
-	.globl	" __XSTRING(HIDENAME(mexitcount)) "		\n\
-" __XSTRING(HIDENAME(mexitcount)) ":				\n\
- 	.globl	__cyg_profile_func_exit				\n\
+	.globl	.mexitcount					\n\
+.mexitcount:							\n\
+	.globl	__cyg_profile_func_exit				\n\
 __cyg_profile_func_exit:					\n\
-	cmpl	$GMON_PROF_HIRES," __XSTRING(CNAME(_gmonparam)) "+GM_STATE \n\
+	cmpl	$GMON_PROF_HIRES,_gmonparam+GM_STATE		\n\
 	jne	.mexitcount_exit				\n\
 	pushl	%edx						\n\
 	pushl	%eax						\n\
@@ -160,7 +155,7 @@
 	pushfl							\n\
 	pushl	%eax						\n\
 	cli							\n\
-	call	" __XSTRING(CNAME(mexitcount)) "		\n\
+	call	mexitcount					\n\
 	addl	$4,%esp						\n\
 	popfl							\n\
 	popl	%eax						\n\
@@ -186,7 +181,7 @@
 	u_char high, low;
 	static u_int prev_count;
 
-#if (defined(I586_CPU) || defined(I686_CPU)) && !defined(SMP)
+#if defined(I586_CPU) || defined(I686_CPU)
 	if (cputime_clock == CPUTIME_CLOCK_TSC) {
 		/*
 		 * Scale the TSC a little to make cputime()'s frequency
@@ -200,7 +195,7 @@
 		prev_count = count;
 		return (delta);
 	}
-#if defined(PERFMON) && defined(I586_PMC_GUPROF)
+#if defined(PERFMON) && defined(I586_PMC_GUPROF) && !defined(SMP)
 	if (cputime_clock == CPUTIME_CLOCK_I586_PMC) {
 		/*
 		 * XXX permon_read() should be inlined so that the
@@ -214,8 +209,8 @@
 		prev_count = count;
 		return (delta);
 	}
-#endif /* PERFMON && I586_PMC_GUPROF */
-#endif /* (I586_CPU || I686_CPU) && !SMP */
+#endif /* PERFMON && I586_PMC_GUPROF && !SMP */
+#endif /* I586_CPU || I686_CPU */
 
 	/*
 	 * Read the current value of the 8254 timer counter 0.
@@ -297,15 +292,17 @@
 {
 	if (cputime_clock == CPUTIME_CLOCK_UNINITIALIZED) {
 		cputime_clock = CPUTIME_CLOCK_I8254;
-#if (defined(I586_CPU) || defined(I686_CPU)) && !defined(SMP)
-		if (tsc_freq != 0)
+#if defined(I586_CPU) || defined(I686_CPU)
+		if (tsc_freq != 0 && !tsc_is_broken && mp_ncpus == 1)
 			cputime_clock = CPUTIME_CLOCK_TSC;
 #endif
 	}
 	gp->profrate = timer_freq << CPUTIME_CLOCK_I8254_SHIFT;
-#if (defined(I586_CPU) || defined(I686_CPU)) && !defined(SMP)
-	if (cputime_clock == CPUTIME_CLOCK_TSC)
+#if defined(I586_CPU) || defined(I686_CPU)
+	if (cputime_clock == CPUTIME_CLOCK_TSC) {
 		gp->profrate = tsc_freq >> 1;
+		cputime_prof_active = 1;
+	}
 #if defined(PERFMON) && defined(I586_PMC_GUPROF)
 	else if (cputime_clock == CPUTIME_CLOCK_I586_PMC) {
 		if (perfmon_avail() &&
@@ -332,7 +329,7 @@
 		}
 	}
 #endif /* PERFMON && I586_PMC_GUPROF */
-#endif /* (I586_CPU || I686_CPU) && !SMP */
+#endif /* I586_CPU || I686_CPU */
 	cputime_bias = 0;
 	cputime();
 }
@@ -348,16 +345,27 @@
 		cputime_clock_pmc_init = FALSE;
 	}
 #endif
+#if defined(I586_CPU) || defined(I686_CPU)
+	if (cputime_clock == CPUTIME_CLOCK_TSC)
+		cputime_prof_active = 0;
+#endif
 }
 
-#else /* !GUPROF */
-#ifdef __GNUCLIKE_ASM
-__asm("								\n\
-	.text							\n\
-	.p2align 4,0x90						\n\
-	.globl	" __XSTRING(HIDENAME(mexitcount)) "		\n\
-" __XSTRING(HIDENAME(mexitcount)) ":				\n\
-	ret							\n\
-");
-#endif /* __GNUCLIKE_ASM */
+#if defined(I586_CPU) || defined(I686_CPU)
+/* If the cpu frequency changed while profiling, report a warning. */
+static void
+tsc_freq_changed(void *arg, const struct cf_level *level, int status)
+{
+
+	/* If there was an error during the transition, don't do anything. */
+	if (status != 0)
+		return;
+	if (cputime_prof_active && cputime_clock == CPUTIME_CLOCK_TSC)
+		printf("warning: cpu freq changed while profiling active\n");
+}
+
+EVENTHANDLER_DEFINE(cpufreq_post_change, tsc_freq_changed, NULL,
+    EVENTHANDLER_PRI_ANY);
+#endif /* I586_CPU || I686_CPU */
+
 #endif /* GUPROF */
--- sys/i386/isa/if_elreg.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*-
- * Copyright (c) 1994, Matthew E. Kimmel.  Permission is hereby granted
- * to use, copy, modify and distribute this software provided that both
- * the copyright notice and this permission notice appear in all copies
- * of the software, derivative works or modified versions, and any
- * portions thereof.
- *
- * $FreeBSD: src/sys/i386/isa/if_elreg.h,v 1.9 2005/01/06 22:18:16 imp Exp $
- */
-/* 3COM Etherlink 3C501 Register Definitions */
-
-/* I/O Ports */
-#define EL_RXS	0x6	/* Receive status register */
-#define EL_RXC	0x6	/* Receive command register */
-#define EL_TXS	0x7	/* Transmit status register */
-#define EL_TXC	0x7	/* Transmit command register */
-#define EL_GPBL	0x8	/* GP buffer ptr low byte */
-#define EL_GPBH	0x9	/* GP buffer ptr high byte */
-#define EL_RBL	0xa	/* Receive buffer ptr low byte */
-#define EL_RBC	0xa	/* Receive buffer clear */
-#define EL_RBH	0xb	/* Receive buffer ptr high byte */
-#define EL_EAW	0xc	/* Ethernet address window */
-#define EL_AS	0xe	/* Auxiliary status register */
-#define EL_AC	0xe	/* Auxiliary command register */
-#define EL_BUF	0xf	/* Data buffer */
-
-/* Receive status register bits */
-#define EL_RXS_OFLOW	0x01	/* Overflow error */
-#define EL_RXS_FCS	0x02	/* FCS error */
-#define EL_RXS_DRIB	0x04	/* Dribble error */
-#define EL_RXS_SHORT	0x08	/* Short frame */
-#define EL_RXS_NOFLOW	0x10	/* No overflow */
-#define	EL_RXS_GOOD	0x20	/* Received good frame */
-#define EL_RXS_STALE	0x80	/* Stale receive status */
-
-/* Receive command register bits */
-#define EL_RXC_DISABLE	0x00	/* Receiver disabled */
-#define EL_RXC_DOFLOW	0x01	/* Detect overflow */
-#define EL_RXC_DFCS	0x02	/* Detect FCS errs */
-#define EL_RXC_DDRIB	0x04	/* Detect dribble errors */
-#define EL_RXC_DSHORT	0x08	/* Detect short frames */
-#define EL_RXC_DNOFLOW	0x10	/* Detect frames w/o overflow ??? */
-#define EL_RXC_AGF	0x20	/* Accept Good Frames */
-#define EL_RXC_PROMISC	0x40	/* Promiscuous mode */
-#define EL_RXC_ABROAD	0x80	/* Accept address, broadcast */
-#define EL_RXC_AMULTI	0xc0	/* Accept address, multicast */
-
-/* Transmit status register bits */
-#define EL_TXS_UFLOW	0x01	/* Underflow */
-#define EL_TXS_COLL	0x02	/* Collision */
-#define EL_TXS_COLL16	0x04	/* Collision 16 */
-#define EL_TXS_READY	0x08	/* Ready for new frame */
-
-/* Transmit command register bits */
-#define EL_TXC_DUFLOW	0x01	/* Detect underflow */
-#define EL_TXC_DCOLL	0x02	/* Detect collisions */
-#define EL_TXC_DCOLL16	0x04	/* Detect collision 16 */
-#define EL_TXC_DSUCCESS	0x08	/* Detect success */
-
-/* Auxiliary status register bits */
-#define EL_AS_RXBUSY	0x01	/* Receive busy */
-#define EL_AS_DMADONE	0x10	/* DMA finished */
-#define EL_AS_TXBUSY	0x80	/* Transmit busy */
-
-/* Auxiliary command register bits */
-#define EL_AC_HOST	0x00	/* System bus can access buffer */
-#define EL_AC_IRQE	0x01	/* IRQ enable */
-#define EL_AC_TXBAD	0x02	/* Transmit frames with bad FCS */
-#define EL_AC_TXFRX	0x04	/* Transmit followed by receive */
-#define EL_AC_RX	0x08	/* Receive */
-#define EL_AC_LB	0x0c	/* Loopback */
-#define EL_AC_DRQ	0x20	/* DMA request */
-#define EL_AC_RIDE	0x40	/* DRQ and IRQ enabled */
-#define EL_AC_RESET	0x80	/* Reset */
-
-/* Packet buffer size */
-#define EL_BUFSIZ	2048
-#define EL_IOSIZ	16
Index: spic.c
===================================================================
RCS file: /home/cvs/src/sys/i386/isa/spic.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/i386/isa/spic.c -L sys/i386/isa/spic.c -u -r1.1.1.1 -r1.2
--- sys/i386/isa/spic.c
+++ sys/i386/isa/spic.c
@@ -50,7 +50,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/i386/isa/spic.c,v 1.16 2005/01/06 22:18:16 imp Exp $");
+__FBSDID("$FreeBSD: src/sys/i386/isa/spic.c,v 1.17 2006/05/16 14:32:16 phk Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -63,7 +63,6 @@
 #include <isa/isavar.h>
 #include <sys/poll.h>
 #include <machine/pci_cfgreg.h>
-#include <machine/clock.h>
 #include <sys/tty.h>
 #include <sys/conf.h>
 #include <sys/fcntl.h>
Index: atpic_vector.s
===================================================================
RCS file: /home/cvs/src/sys/i386/isa/atpic_vector.s,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/i386/isa/atpic_vector.s -L sys/i386/isa/atpic_vector.s -u -r1.1.1.1 -r1.2
--- sys/i386/isa/atpic_vector.s
+++ sys/i386/isa/atpic_vector.s
@@ -28,7 +28,7 @@
  * SUCH DAMAGE.
  *
  *	from: vector.s, 386BSD 0.1 unknown origin
- * $FreeBSD: src/sys/i386/isa/atpic_vector.s,v 1.47 2004/05/26 07:43:41 bde Exp $
+ * $FreeBSD: src/sys/i386/isa/atpic_vector.s,v 1.50 2006/12/17 05:07:01 kmacy Exp $
  */
 
 /*
@@ -41,28 +41,20 @@
 #include "assym.s"
 
 /*
- * Macros for interrupt interrupt entry, call to handler, and exit.
+ * Macros for interrupt entry, call to handler, and exit.
  */
 #define	INTR(irq_num, vec_name) \
 	.text ;								\
 	SUPERALIGN_TEXT ;						\
 IDTVEC(vec_name) ;							\
-	pushl	$0 ;		/* dummy error code */			\
-	pushl	$0 ;		/* dummy trap type */			\
-	pushal ;		/* 8 ints */				\
-	pushl	%ds ;		/* save data and extra segments ... */	\
-	pushl	%es ;							\
-	pushl	%fs ;							\
-	movl	$KDSEL, %eax ;	/* reload with kernel's data segment */	\
-	movl	%eax, %ds ;						\
-	movl	%eax, %es ;						\
-	movl	$KPSEL, %eax ;	/* reload with per-CPU data segment */	\
-	movl	%eax, %fs ;						\
+	PUSH_FRAME ;							\
+	SET_KERNEL_SREGS ;						\
 ;									\
 	FAKE_MCOUNT(TF_EIP(%esp)) ;					\
+	pushl	%esp		;                                       \
 	pushl	$irq_num; 	/* pass the IRQ */			\
 	call	atpic_handle_intr ;					\
-	addl	$4, %esp ;	/* discard the parameter */		\
+	addl	$8, %esp ;	/* discard the parameters */		\
 ;									\
 	MEXITCOUNT ;							\
 	jmp	doreti
Index: pmtimer.c
===================================================================
RCS file: /home/cvs/src/sys/i386/isa/pmtimer.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/i386/isa/pmtimer.c -L sys/i386/isa/pmtimer.c -u -r1.1.1.1 -r1.2
--- sys/i386/isa/pmtimer.c
+++ sys/i386/isa/pmtimer.c
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/i386/isa/pmtimer.c,v 1.5 2004/05/30 17:57:43 phk Exp $");
+__FBSDID("$FreeBSD: src/sys/i386/isa/pmtimer.c,v 1.6 2006/10/02 12:59:57 phk Exp $");
 
 /*
  * Timer device driver for power management events.
@@ -35,6 +35,7 @@
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/bus.h>
+#include <sys/clock.h>
 #include <sys/kernel.h>
 #include <sys/module.h>
 #include <sys/syslog.h>
Index: atpic.c
===================================================================
RCS file: /home/cvs/src/sys/i386/isa/atpic.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L sys/i386/isa/atpic.c -L sys/i386/isa/atpic.c -u -r1.2 -r1.3
--- sys/i386/isa/atpic.c
+++ sys/i386/isa/atpic.c
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/i386/isa/atpic.c,v 1.20.2.3 2006/03/10 19:37:33 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/i386/isa/atpic.c,v 1.28 2007/05/08 21:29:14 jhb Exp $");
 
 #include "opt_auto_eoi.h"
 #include "opt_isa.h"
@@ -125,9 +125,10 @@
 
 #define	ATPIC(io, base, eoi, imenptr)					\
      	{ { atpic_enable_source, atpic_disable_source, (eoi),		\
-	    atpic_enable_intr, atpic_vector, atpic_source_pending, NULL, \
-	    atpic_resume, atpic_config_intr, atpic_assign_cpu }, (io),  \
-	    (base), IDT_IO_INTS + (base), (imenptr) }
+	    atpic_enable_intr, atpic_disable_intr, atpic_vector,	\
+	    atpic_source_pending, NULL,	atpic_resume, atpic_config_intr,\
+	    atpic_assign_cpu }, (io), (base), IDT_IO_INTS + (base),	\
+	    (imenptr) }
 
 #define	INTSRC(irq)							\
 	{ { &atpics[(irq) / 8].at_pic }, IDTVEC(atpic_intr ## irq ),	\
@@ -155,8 +156,9 @@
 static void atpic_eoi_master(struct intsrc *isrc);
 static void atpic_eoi_slave(struct intsrc *isrc);
 static void atpic_enable_intr(struct intsrc *isrc);
+static void atpic_disable_intr(struct intsrc *isrc);
 static int atpic_vector(struct intsrc *isrc);
-static void atpic_resume(struct intsrc *isrc);
+static void atpic_resume(struct pic *pic);
 static int atpic_source_pending(struct intsrc *isrc);
 static int atpic_config_intr(struct intsrc *isrc, enum intr_trigger trig,
     enum intr_polarity pol);
@@ -284,6 +286,12 @@
 {
 }
 
+static void
+atpic_disable_intr(struct intsrc *isrc)
+{
+}
+
+
 static int
 atpic_vector(struct intsrc *isrc)
 {
@@ -303,18 +311,15 @@
 }
 
 static void
-atpic_resume(struct intsrc *isrc)
+atpic_resume(struct pic *pic)
 {
-	struct atpic_intsrc *ai = (struct atpic_intsrc *)isrc;
-	struct atpic *ap = (struct atpic *)isrc->is_pic;
+	struct atpic *ap = (struct atpic *)pic;
 
-	if (ai->at_irq == 0) {
-		i8259_init(ap, ap == &atpics[SLAVE]);
+	i8259_init(ap, ap == &atpics[SLAVE]);
 #ifndef PC98
-		if (ap == &atpics[SLAVE] && elcr_found)
-			elcr_resume();
+	if (ap == &atpics[SLAVE] && elcr_found)
+		elcr_resume();
 #endif
-	}
 }
 
 static int
@@ -529,6 +534,14 @@
 	int i;
 
 	/*
+	 * Register our PICs, even if we aren't going to use any of their
+	 * pins so that they are suspended and resumed.
+	 */
+	if (intr_register_pic(&atpics[0].at_pic) != 0 ||
+	    intr_register_pic(&atpics[1].at_pic) != 0)
+		panic("Unable to register ATPICs");
+
+	/*
 	 * If any of the ISA IRQs have an interrupt source already, then
 	 * assume that the APICs are being used and don't register any
 	 * of our interrupt sources.  This makes sure we don't accidentally
@@ -553,20 +566,18 @@
 SYSINIT(atpic_init, SI_SUB_INTR, SI_ORDER_SECOND + 1, atpic_init, NULL)
 
 void
-atpic_handle_intr(struct intrframe iframe)
+atpic_handle_intr(u_int vector, struct trapframe *frame)
 {
 	struct intsrc *isrc;
 
-	KASSERT((u_int)iframe.if_vec < NUM_ISA_IRQS,
-	    ("unknown int %d\n", iframe.if_vec));
-	isrc = &atintrs[iframe.if_vec].at_intsrc;
+	KASSERT(vector < NUM_ISA_IRQS, ("unknown int %u\n", vector));
+	isrc = &atintrs[vector].at_intsrc;
 
 	/*
 	 * If we don't have an event, see if this is a spurious
 	 * interrupt.
 	 */
-	if (isrc->is_event == NULL &&
-	    (iframe.if_vec == 7 || iframe.if_vec == 15)) {
+	if (isrc->is_event == NULL && (vector == 7 || vector == 15)) {
 		int port, isr;
 
 		/*
@@ -582,7 +593,7 @@
 		if ((isr & IRQ_MASK(7)) == 0)
 			return;
 	}
-	intr_execute_handlers(isrc, &iframe);
+	intr_execute_handlers(isrc, frame);
 }
 
 #ifdef DEV_ISA
Index: icu.h
===================================================================
RCS file: /home/cvs/src/sys/i386/isa/icu.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/i386/isa/icu.h -L sys/i386/isa/icu.h -u -r1.1.1.1 -r1.2
--- sys/i386/isa/icu.h
+++ sys/i386/isa/icu.h
@@ -30,7 +30,7 @@
  * SUCH DAMAGE.
  *
  *	from: @(#)icu.h	5.6 (Berkeley) 5/9/91
- * $FreeBSD: src/sys/i386/isa/icu.h,v 1.33 2004/05/11 20:23:24 jhb Exp $
+ * $FreeBSD: src/sys/i386/isa/icu.h,v 1.35 2006/12/17 05:07:01 kmacy Exp $
  */
 
 /*
@@ -47,7 +47,7 @@
 #define	ICU_IMR_OFFSET	1
 #endif
 
-void	atpic_handle_intr(struct intrframe iframe);
+void	atpic_handle_intr(u_int vector, struct trapframe *frame);
 void	atpic_startup(void);
 
 #endif /* !_I386_ISA_ICU_H_ */


More information about the Midnightbsd-cvs mailing list