PERFORCE change 55930 for review

Robert Watson rwatson at FreeBSD.org
Sun Jun 27 09:40:17 PDT 2004


http://perforce.freebsd.org/chv.cgi?CH=55930

Change 55930 by rwatson at rwatson_tislabs on 2004/06/27 16:39:18

	Integrate netperf_socket.  Netperf-related changes include:
	
	- Loop back accept_mtx description.
	- Loop back so_global_mtx and description.
	- Loop back socket buffer lock over unp_scan() in unp_gc().

Affected files ...

.. //depot/projects/netperf_socket/sys/conf/NOTES#24 integrate
.. //depot/projects/netperf_socket/sys/conf/files#32 integrate
.. //depot/projects/netperf_socket/sys/conf/options#16 integrate
.. //depot/projects/netperf_socket/sys/dev/acpica/acpi.c#28 integrate
.. //depot/projects/netperf_socket/sys/dev/bktr/bktr_tuner.c#2 integrate
.. //depot/projects/netperf_socket/sys/dev/cardbus/cardbus.c#3 integrate
.. //depot/projects/netperf_socket/sys/dev/ex/if_ex.c#6 integrate
.. //depot/projects/netperf_socket/sys/dev/ex/if_ex_isa.c#2 integrate
.. //depot/projects/netperf_socket/sys/dev/ex/if_ex_pccard.c#3 integrate
.. //depot/projects/netperf_socket/sys/dev/ex/if_exvar.h#2 integrate
.. //depot/projects/netperf_socket/sys/dev/sio/sio.c#14 integrate
.. //depot/projects/netperf_socket/sys/dev/usb/if_aue.c#7 integrate
.. //depot/projects/netperf_socket/sys/dev/usb/if_axe.c#7 integrate
.. //depot/projects/netperf_socket/sys/dev/usb/if_cue.c#6 integrate
.. //depot/projects/netperf_socket/sys/dev/usb/if_kue.c#5 integrate
.. //depot/projects/netperf_socket/sys/dev/usb/if_rue.c#7 integrate
.. //depot/projects/netperf_socket/sys/dev/usb/if_udav.c#6 integrate
.. //depot/projects/netperf_socket/sys/dev/usb/ubsa.c#3 integrate
.. //depot/projects/netperf_socket/sys/dev/usb/ubser.c#7 integrate
.. //depot/projects/netperf_socket/sys/dev/usb/ucom.c#9 integrate
.. //depot/projects/netperf_socket/sys/dev/usb/udbp.c#4 integrate
.. //depot/projects/netperf_socket/sys/dev/usb/ufm.c#4 integrate
.. //depot/projects/netperf_socket/sys/dev/usb/uftdi.c#7 integrate
.. //depot/projects/netperf_socket/sys/dev/usb/ugen.c#5 integrate
.. //depot/projects/netperf_socket/sys/dev/usb/uhid.c#6 integrate
.. //depot/projects/netperf_socket/sys/dev/usb/ukbd.c#3 integrate
.. //depot/projects/netperf_socket/sys/dev/usb/ulpt.c#5 integrate
.. //depot/projects/netperf_socket/sys/dev/usb/umass.c#7 integrate
.. //depot/projects/netperf_socket/sys/dev/usb/umct.c#3 integrate
.. //depot/projects/netperf_socket/sys/dev/usb/umodem.c#4 integrate
.. //depot/projects/netperf_socket/sys/dev/usb/ums.c#5 integrate
.. //depot/projects/netperf_socket/sys/dev/usb/uplcom.c#3 integrate
.. //depot/projects/netperf_socket/sys/dev/usb/urio.c#4 integrate
.. //depot/projects/netperf_socket/sys/dev/usb/usb_quirks.c#3 integrate
.. //depot/projects/netperf_socket/sys/dev/usb/usb_subr.c#7 integrate
.. //depot/projects/netperf_socket/sys/dev/usb/uscanner.c#5 integrate
.. //depot/projects/netperf_socket/sys/dev/usb/uvisor.c#5 integrate
.. //depot/projects/netperf_socket/sys/dev/usb/uvscom.c#4 integrate
.. //depot/projects/netperf_socket/sys/dev/xe/if_xe_pccard.c#5 integrate
.. //depot/projects/netperf_socket/sys/geom/gate/g_gate.c#5 integrate
.. //depot/projects/netperf_socket/sys/geom/geom_io.c#5 integrate
.. //depot/projects/netperf_socket/sys/kern/kern_jail.c#7 integrate
.. //depot/projects/netperf_socket/sys/kern/uipc_socket.c#26 integrate
.. //depot/projects/netperf_socket/sys/kern/uipc_usrreq.c#18 integrate
.. //depot/projects/netperf_socket/sys/modules/aue/Makefile#2 integrate
.. //depot/projects/netperf_socket/sys/modules/axe/Makefile#2 integrate
.. //depot/projects/netperf_socket/sys/modules/cue/Makefile#2 integrate
.. //depot/projects/netperf_socket/sys/modules/ep/Makefile#3 integrate
.. //depot/projects/netperf_socket/sys/modules/kue/Makefile#2 integrate
.. //depot/projects/netperf_socket/sys/modules/rue/Makefile#2 integrate
.. //depot/projects/netperf_socket/sys/modules/ubsa/Makefile#2 integrate
.. //depot/projects/netperf_socket/sys/modules/ubser/Makefile#2 integrate
.. //depot/projects/netperf_socket/sys/modules/ucom/Makefile#2 integrate
.. //depot/projects/netperf_socket/sys/modules/udav/Makefile#2 integrate
.. //depot/projects/netperf_socket/sys/modules/udbp/Makefile#2 integrate
.. //depot/projects/netperf_socket/sys/modules/ufm/Makefile#2 integrate
.. //depot/projects/netperf_socket/sys/modules/uftdi/Makefile#2 integrate
.. //depot/projects/netperf_socket/sys/modules/ugen/Makefile#2 integrate
.. //depot/projects/netperf_socket/sys/modules/uhid/Makefile#2 integrate
.. //depot/projects/netperf_socket/sys/modules/ukbd/Makefile#2 integrate
.. //depot/projects/netperf_socket/sys/modules/ulpt/Makefile#2 integrate
.. //depot/projects/netperf_socket/sys/modules/umass/Makefile#2 integrate
.. //depot/projects/netperf_socket/sys/modules/umct/Makefile#2 integrate
.. //depot/projects/netperf_socket/sys/modules/umodem/Makefile#2 integrate
.. //depot/projects/netperf_socket/sys/modules/ums/Makefile#2 integrate
.. //depot/projects/netperf_socket/sys/modules/uplcom/Makefile#2 integrate
.. //depot/projects/netperf_socket/sys/modules/urio/Makefile#2 integrate
.. //depot/projects/netperf_socket/sys/modules/usb/Makefile#2 integrate
.. //depot/projects/netperf_socket/sys/modules/uscanner/Makefile#3 integrate
.. //depot/projects/netperf_socket/sys/modules/uvisor/Makefile#2 integrate
.. //depot/projects/netperf_socket/sys/modules/uvscom/Makefile#2 integrate
.. //depot/projects/netperf_socket/sys/net/if_fwsubr.c#5 integrate
.. //depot/projects/netperf_socket/sys/net/if_loop.c#6 integrate
.. //depot/projects/netperf_socket/sys/netgraph/ng_bridge.c#5 integrate
.. //depot/projects/netperf_socket/sys/netgraph/ng_etf.c#3 integrate
.. //depot/projects/netperf_socket/sys/netgraph/ng_ether.c#6 integrate
.. //depot/projects/netperf_socket/sys/netgraph/ng_gif.c#4 integrate
.. //depot/projects/netperf_socket/sys/netgraph/ng_hub.c#2 integrate
.. //depot/projects/netperf_socket/sys/netgraph/ng_iface.c#5 integrate
.. //depot/projects/netperf_socket/sys/netgraph/ng_l2tp.c#5 integrate
.. //depot/projects/netperf_socket/sys/netgraph/ng_one2many.c#4 integrate
.. //depot/projects/netperf_socket/sys/netgraph/ng_ppp.c#3 integrate
.. //depot/projects/netperf_socket/sys/netgraph/ng_pppoe.c#4 integrate
.. //depot/projects/netperf_socket/sys/netgraph/ng_sample.c#3 integrate
.. //depot/projects/netperf_socket/sys/netgraph/ng_tee.c#6 integrate
.. //depot/projects/netperf_socket/sys/netinet/ip_fastfwd.c#7 integrate
.. //depot/projects/netperf_socket/sys/sys/socketvar.h#20 integrate
.. //depot/projects/netperf_socket/sys/vm/vm_glue.c#9 integrate

Differences ...

==== //depot/projects/netperf_socket/sys/conf/NOTES#24 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/NOTES,v 1.1234 2004/06/26 17:19:44 mpp Exp $
+# $FreeBSD: src/sys/conf/NOTES,v 1.1236 2004/06/27 02:36:33 rwatson Exp $
 #
 # NOTES -- Lines that can be cut/pasted into kernel and hints configs.
 #
@@ -434,7 +434,9 @@
 options 	NETGRAPH_BRIDGE
 options 	NETGRAPH_CISCO
 options 	NETGRAPH_ECHO
+options 	NETGRAPH_EIFACE
 options 	NETGRAPH_ETHER
+options 	NETGRAPH_FEC
 options 	NETGRAPH_FRAME_RELAY
 options 	NETGRAPH_GIF
 options 	NETGRAPH_GIF_DEMUX

==== //depot/projects/netperf_socket/sys/conf/files#32 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/files,v 1.910 2004/06/26 05:58:43 imp Exp $
+# $FreeBSD: src/sys/conf/files,v 1.912 2004/06/27 02:36:33 rwatson Exp $
 #
 # The long compile-with and dependency lines are required because of
 # limitations in config: backslash-newline doesn't work in strings, and
@@ -1413,7 +1413,9 @@
 netgraph/ng_cisco.c	optional netgraph_cisco
 netgraph/ng_device.c	optional netgraph_device
 netgraph/ng_echo.c	optional netgraph_echo
+netgraph/ng_eiface.c	optional netgraph_eiface
 netgraph/ng_ether.c	optional netgraph_ether
+netgraph/ng_fec.c	optional netgraph_fec
 netgraph/ng_frame_relay.c	optional netgraph_frame_relay
 netgraph/ng_gif.c	optional netgraph_gif
 netgraph/ng_gif_demux.c	optional netgraph_gif_demux

==== //depot/projects/netperf_socket/sys/conf/options#16 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/options,v 1.454 2004/06/23 21:04:37 ps Exp $
+# $FreeBSD: src/sys/conf/options,v 1.456 2004/06/27 02:36:33 rwatson Exp $
 #
 #        On the handling of kernel options
 #
@@ -378,7 +378,9 @@
 NETGRAPH_BRIDGE		opt_netgraph.h
 NETGRAPH_CISCO		opt_netgraph.h
 NETGRAPH_ECHO		opt_netgraph.h
+NETGRAPH_EIFACE		opt_netgraph.h
 NETGRAPH_ETHER		opt_netgraph.h
+NETGRAPH_FEC		opt_netgraph.h
 NETGRAPH_FRAME_RELAY	opt_netgraph.h
 NETGRAPH_GIF		opt_netgraph.h
 NETGRAPH_GIF_DEMUX	opt_netgraph.h

==== //depot/projects/netperf_socket/sys/dev/acpica/acpi.c#28 (text+ko) ====

@@ -26,7 +26,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *	$FreeBSD: src/sys/dev/acpica/acpi.c,v 1.165 2004/06/24 00:48:45 njl Exp $
+ *	$FreeBSD: src/sys/dev/acpica/acpi.c,v 1.166 2004/06/27 13:04:19 imp Exp $
  */
 
 #include "opt_acpi.h"
@@ -891,10 +891,9 @@
 	if (res == NULL)
 	    return (NULL);
 
-	/* Copy the bus tag from the pre-allocated resource. */
+	/* Copy the bus tag and handle from the pre-allocated resource. */
 	rman_set_bustag(res, rman_get_bustag(rle->res));
-	if (type == SYS_RES_IOPORT)
-	    rman_set_bushandle(res, res->r_start);
+	rman_set_bushandle(res, rman_get_bushandle(res));
 
 	/* If requested, activate the resource using the parent's method. */
 	if (flags & RF_ACTIVE)

==== //depot/projects/netperf_socket/sys/dev/bktr/bktr_tuner.c#2 (text+ko) ====

@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/bktr/bktr_tuner.c,v 1.12 2003/12/08 07:59:18 obrien Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/bktr/bktr_tuner.c,v 1.13 2004/06/27 09:59:02 schweikh Exp $");
 
 /*
  * This is part of the Driver for Video Capture Cards (Frame grabbers)
@@ -698,7 +698,9 @@
 #undef TBL_CHNL
 
 
-#define TBL_IF	freqTable[ bktr->tuner.chnlset ].ptr[ 1 ]
+#define	TBL_IF	(bktr->format_params == BT848_IFORM_F_NTSCJ || \
+                 bktr->format_params == BT848_IFORM_F_NTSCM ? \
+                 nabcst[1] : weurope[1])
 
 
 /* Initialise the tuner structures in the bktr_softc */

==== //depot/projects/netperf_socket/sys/dev/cardbus/cardbus.c#3 (text+ko) ====

@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/cardbus/cardbus.c,v 1.43 2004/05/30 17:57:40 phk Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/cardbus/cardbus.c,v 1.44 2004/06/27 13:07:02 imp Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -155,25 +155,11 @@
 {
 	device_t brdev = device_get_parent(cbdev);
 	int cardattached = 0;
-	static int curr_bus_number = 2; /* XXX EVILE BAD (see below) */
 	int bus, slot, func;
 
 	cardbus_detach_card(cbdev); /* detach existing cards */
-
 	POWER_ENABLE_SOCKET(brdev, cbdev);
 	bus = pcib_get_bus(cbdev);
-	if (bus == 0) {
-		/*
-		 * XXX EVILE BAD XXX
-		 * Not all BIOSes initialize the secondary bus number properly,
-		 * so if the default is bad, we just put one in and hope it
-		 * works.
-		 */
-		bus = curr_bus_number;
-		pci_write_config(brdev, PCIR_SECBUS_2, curr_bus_number, 1);
-		pci_write_config(brdev, PCIR_SUBBUS_2, curr_bus_number + 2, 1);
-		curr_bus_number += 3;
-	}
 	/* For each function, set it up and try to attach a driver to it */
 	for (slot = 0; slot <= CARDBUS_SLOTMAX; slot++) {
 		int cardbusfunchigh = 0;

==== //depot/projects/netperf_socket/sys/dev/ex/if_ex.c#6 (text+ko) ====

@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/ex/if_ex.c,v 1.51 2004/05/23 16:11:47 mux Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/ex/if_ex.c,v 1.52 2004/06/27 13:10:20 imp Exp $");
 
 /*
  * Intel EtherExpress Pro/10, Pro/10+ Ethernet driver
@@ -78,7 +78,6 @@
 # define Sent_Pkts 4
 # define Status    8
 static int debug_mask = 0;
-static int exintr_count = 0;
 # define DODEBUG(level, action) if (level & debug_mask) action
 #else
 # define DODEBUG(level, action)
@@ -97,53 +96,35 @@
 	{ 3, 4, 5, 7, 9, 10, 11, 12 };
 
 /* Network Interface Functions */
-static void	ex_init		(void *);
-static void	ex_start	(struct ifnet *);
-static int	ex_ioctl	(struct ifnet *, u_long, caddr_t);
-static void	ex_watchdog	(struct ifnet *);
+static void	ex_init(void *);
+static void	ex_start(struct ifnet *);
+static int	ex_ioctl(struct ifnet *, u_long, caddr_t);
+static void	ex_watchdog(struct ifnet *);
 
 /* ifmedia Functions	*/
-static int	ex_ifmedia_upd	(struct ifnet *);
-static void	ex_ifmedia_sts	(struct ifnet *, struct ifmediareq *);
+static int	ex_ifmedia_upd(struct ifnet *);
+static void	ex_ifmedia_sts(struct ifnet *, struct ifmediareq *);
 
-static int	ex_get_media	(u_int32_t iobase);
+static int	ex_get_media(struct ex_softc *);
 
-static void	ex_reset	(struct ex_softc *);
-static void	ex_setmulti	(struct ex_softc *);
+static void	ex_reset(struct ex_softc *);
+static void	ex_setmulti(struct ex_softc *);
 
-static void	ex_tx_intr	(struct ex_softc *);
-static void	ex_rx_intr	(struct ex_softc *);
-
-int
-look_for_card (u_int32_t iobase)
-{
-	int count1, count2;
-
-	/*
-	 * Check for the i82595 signature, and check that the round robin
-	 * counter actually advances.
-	 */
-	if (((count1 = inb(iobase + ID_REG)) & Id_Mask) != Id_Sig)
-		return(0);
-	count2 = inb(iobase + ID_REG);
-	count2 = inb(iobase + ID_REG);
-	count2 = inb(iobase + ID_REG);
+static void	ex_tx_intr(struct ex_softc *);
+static void	ex_rx_intr(struct ex_softc *);
 
-	return((count2 & Counter_bits) == ((count1 + 0xc0) & Counter_bits));
-}
-
 void
-ex_get_address (u_int32_t iobase, u_char *enaddr)
+ex_get_address(struct ex_softc *sc, u_char *enaddr)
 {
-	u_int16_t	eaddr_tmp;
+	uint16_t	eaddr_tmp;
 
-	eaddr_tmp = eeprom_read(iobase, EE_Eth_Addr_Lo);
+	eaddr_tmp = ex_eeprom_read(sc, EE_Eth_Addr_Lo);
 	enaddr[5] = eaddr_tmp & 0xff;
 	enaddr[4] = eaddr_tmp >> 8;
-	eaddr_tmp = eeprom_read(iobase, EE_Eth_Addr_Mid);
+	eaddr_tmp = ex_eeprom_read(sc, EE_Eth_Addr_Mid);
 	enaddr[3] = eaddr_tmp & 0xff;
 	enaddr[2] = eaddr_tmp >> 8;
-	eaddr_tmp = eeprom_read(iobase, EE_Eth_Addr_Hi);
+	eaddr_tmp = ex_eeprom_read(sc, EE_Eth_Addr_Hi);
 	enaddr[1] = eaddr_tmp & 0xff;
 	enaddr[0] = eaddr_tmp >> 8;
 	
@@ -151,7 +132,7 @@
 }
 
 int
-ex_card_type (u_char *enaddr)
+ex_card_type(u_char *enaddr)
 {
 	if ((enaddr[0] == 0x00) && (enaddr[1] == 0xA0) && (enaddr[2] == 0xC9))
 		return (CARD_TYPE_EX_10_PLUS);
@@ -164,7 +145,7 @@
  * ex_release_resources() on failure.
  */
 int
-ex_alloc_resources (device_t dev)
+ex_alloc_resources(device_t dev)
 {
 	struct ex_softc *	sc = device_get_softc(dev);
 	int			error = 0;
@@ -176,6 +157,8 @@
 		error = ENOMEM;
 		goto bad;
 	}
+	sc->bst = rman_get_bustag(sc->ioport);
+	sc->bsh = rman_get_bushandle(sc->ioport);
 
 	sc->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &sc->irq_rid,
 					RF_ACTIVE);
@@ -191,7 +174,7 @@
 }
 
 void
-ex_release_resources (device_t dev)
+ex_release_resources(device_t dev)
 {
 	struct ex_softc *	sc = device_get_softc(dev);
 
@@ -221,7 +204,7 @@
 	struct ex_softc *	sc = device_get_softc(dev);
 	struct ifnet *		ifp = &sc->arpcom.ac_if;
 	struct ifmedia *	ifm;
-	u_int16_t		temp;
+	uint16_t		temp;
 
 	/* work out which set of irq <-> internal tables to use */
 	if (ex_card_type(sc->arpcom.ac_enaddr) == CARD_TYPE_EX_10_PLUS) {
@@ -249,7 +232,7 @@
 
 	ifmedia_init(&sc->ifmedia, 0, ex_ifmedia_upd, ex_ifmedia_sts);
 
-	temp = eeprom_read(sc->iobase, EE_W5);
+	temp = ex_eeprom_read(sc, EE_W5);
 	if (temp & EE_W5_PORT_TPE)
 		ifmedia_add(&sc->ifmedia, IFM_ETHER|IFM_10_T, 0, NULL);
 	if (temp & EE_W5_PORT_BNC)
@@ -259,7 +242,7 @@
 
 	ifmedia_add(&sc->ifmedia, IFM_ETHER|IFM_AUTO, 0, NULL);
 	ifmedia_add(&sc->ifmedia, IFM_ETHER|IFM_NONE, 0, NULL);
-	ifmedia_set(&sc->ifmedia, ex_get_media(sc->iobase));
+	ifmedia_set(&sc->ifmedia, ex_get_media(sc));
 
 	ifm = &sc->ifmedia;
 	ifm->ifm_media = ifm->ifm_cur->ifm_media;
@@ -274,7 +257,7 @@
 }
 
 int
-ex_detach (device_t dev)
+ex_detach(device_t dev)
 {
 	struct ex_softc	*sc;
 	struct ifnet	*ifp;
@@ -299,7 +282,6 @@
 	struct ifnet *		ifp = &sc->arpcom.ac_if;
 	int			s;
 	int			i;
-	register int		iobase = sc->iobase;
 	unsigned short		temp_reg;
 
 	DODEBUG(Start_End, printf("%s: ex_init: start\n", ifp->if_xname););
@@ -310,13 +292,13 @@
 	/*
 	 * Load the ethernet address into the card.
 	 */
-	outb(iobase + CMD_REG, Bank2_Sel);
-	temp_reg = inb(iobase + EEPROM_REG);
+	CSR_WRITE_1(sc, CMD_REG, Bank2_Sel);
+	temp_reg = CSR_READ_1(sc, EEPROM_REG);
 	if (temp_reg & Trnoff_Enable) {
-		outb(iobase + EEPROM_REG, temp_reg & ~Trnoff_Enable);
+		CSR_WRITE_1(sc, EEPROM_REG, temp_reg & ~Trnoff_Enable);
 	}
 	for (i = 0; i < ETHER_ADDR_LEN; i++) {
-		outb(iobase + I_ADDR_REG0 + i, sc->arpcom.ac_enaddr[i]);
+		CSR_WRITE_1(sc, I_ADDR_REG0 + i, sc->arpcom.ac_enaddr[i]);
 	}
 	/*
 	 * - Setup transmit chaining and discard bad received frames.
@@ -325,11 +307,11 @@
 	 * - Set receiving mode.
 	 * - Set IRQ number.
 	 */
-	outb(iobase + REG1, inb(iobase + REG1) | Tx_Chn_Int_Md | Tx_Chn_ErStp | Disc_Bad_Fr);
-	outb(iobase + REG2, inb(iobase + REG2) | No_SA_Ins | RX_CRC_InMem);
-	outb(iobase + REG3, inb(iobase + REG3) & 0x3f /* XXX constants. */ );
-	outb(iobase + CMD_REG, Bank1_Sel);
-	outb(iobase + INT_NO_REG, (inb(iobase + INT_NO_REG) & 0xf8) | sc->irq2ee[sc->irq_no]);
+	CSR_WRITE_1(sc, REG1, CSR_READ_1(sc, REG1) | Tx_Chn_Int_Md | Tx_Chn_ErStp | Disc_Bad_Fr);
+	CSR_WRITE_1(sc, REG2, CSR_READ_1(sc, REG2) | No_SA_Ins | RX_CRC_InMem);
+	CSR_WRITE_1(sc, REG3, CSR_READ_1(sc, REG3) & 0x3f /* XXX constants. */ );
+	CSR_WRITE_1(sc, CMD_REG, Bank1_Sel);
+	CSR_WRITE_1(sc, INT_NO_REG, (CSR_READ_1(sc, INT_NO_REG) & 0xf8) | sc->irq2ee[sc->irq_no]);
 
 	/*
 	 * Divide the available memory in the card into rcv and xmt buffers.
@@ -342,26 +324,26 @@
 	sc->rx_upper_limit = sc->rx_mem_size - 2;
 	sc->tx_lower_limit = sc->rx_mem_size;
 	sc->tx_upper_limit = sc->mem_size - 2;
-	outb(iobase + RCV_LOWER_LIMIT_REG, sc->rx_lower_limit >> 8);
-	outb(iobase + RCV_UPPER_LIMIT_REG, sc->rx_upper_limit >> 8);
-	outb(iobase + XMT_LOWER_LIMIT_REG, sc->tx_lower_limit >> 8);
-	outb(iobase + XMT_UPPER_LIMIT_REG, sc->tx_upper_limit >> 8);
+	CSR_WRITE_1(sc, RCV_LOWER_LIMIT_REG, sc->rx_lower_limit >> 8);
+	CSR_WRITE_1(sc, RCV_UPPER_LIMIT_REG, sc->rx_upper_limit >> 8);
+	CSR_WRITE_1(sc, XMT_LOWER_LIMIT_REG, sc->tx_lower_limit >> 8);
+	CSR_WRITE_1(sc, XMT_UPPER_LIMIT_REG, sc->tx_upper_limit >> 8);
 	
 	/*
 	 * Enable receive and transmit interrupts, and clear any pending int.
 	 */
-	outb(iobase + REG1, inb(iobase + REG1) | TriST_INT);
-	outb(iobase + CMD_REG, Bank0_Sel);
-	outb(iobase + MASK_REG, All_Int & ~(Rx_Int | Tx_Int));
-	outb(iobase + STATUS_REG, All_Int);
+	CSR_WRITE_1(sc, REG1, CSR_READ_1(sc, REG1) | TriST_INT);
+	CSR_WRITE_1(sc, CMD_REG, Bank0_Sel);
+	CSR_WRITE_1(sc, MASK_REG, All_Int & ~(Rx_Int | Tx_Int));
+	CSR_WRITE_1(sc, STATUS_REG, All_Int);
 
 	/*
 	 * Initialize receive and transmit ring buffers.
 	 */
-	outw(iobase + RCV_BAR, sc->rx_lower_limit);
+	CSR_WRITE_2(sc, RCV_BAR, sc->rx_lower_limit);
 	sc->rx_head = sc->rx_lower_limit;
-	outw(iobase + RCV_STOP_REG, sc->rx_upper_limit | 0xfe);
-	outw(iobase + XMT_BAR, sc->tx_lower_limit);
+	CSR_WRITE_2(sc, RCV_STOP_REG, sc->rx_upper_limit | 0xfe);
+	CSR_WRITE_2(sc, XMT_BAR, sc->tx_lower_limit);
 	sc->tx_head = sc->tx_tail = sc->tx_lower_limit;
 
 	ifp->if_flags |= IFF_RUNNING;
@@ -373,9 +355,9 @@
 	/*
 	 * Final reset of the board, and enable operation.
 	 */
-	outb(iobase + CMD_REG, Sel_Reset_CMD);
+	CSR_WRITE_1(sc, CMD_REG, Sel_Reset_CMD);
 	DELAY(2);
-	outb(iobase + CMD_REG, Rcv_Enable_CMD);
+	CSR_WRITE_1(sc, CMD_REG, Rcv_Enable_CMD);
 
 	ex_start(ifp);
 	splx(s);
@@ -388,7 +370,6 @@
 ex_start(struct ifnet *ifp)
 {
 	struct ex_softc *	sc = ifp->if_softc;
-	int			iobase = sc->iobase;
 	int			i, s, len, data_len, avail, dest, next;
 	unsigned char		tmp16[2];
 	struct mbuf *		opkt;
@@ -445,7 +426,7 @@
 			 * routines.
 			 * XXX Is this necessary with splimp() enabled?
 			 */
-			outb(iobase + MASK_REG, All_Int);
+			CSR_WRITE_1(sc, MASK_REG, All_Int);
 #endif
 
 			/*
@@ -471,52 +452,51 @@
 			 */
 			DODEBUG(Sent_Pkts, printf("2. dest=%d, next=%d. ", dest, next););
 
-			outw(iobase + HOST_ADDR_REG, dest);
-			outw(iobase + IO_PORT_REG, Transmit_CMD);
-			outw(iobase + IO_PORT_REG, 0);
-			outw(iobase + IO_PORT_REG, next);
-			outw(iobase + IO_PORT_REG, data_len);
+			CSR_WRITE_2(sc, HOST_ADDR_REG, dest);
+			CSR_WRITE_2(sc, IO_PORT_REG, Transmit_CMD);
+			CSR_WRITE_2(sc, IO_PORT_REG, 0);
+			CSR_WRITE_2(sc, IO_PORT_REG, next);
+			CSR_WRITE_2(sc, IO_PORT_REG, data_len);
 
 			/*
 			 * Output the packet data to the card. Ensure all
 			 * transfers are 16-bit wide, even if individual
 			 * mbufs have odd length.
 			 */
-
 			for (m = opkt, i = 0; m != NULL; m = m->m_next) {
 				DODEBUG(Sent_Pkts, printf("[%d]", m->m_len););
 				if (i) {
 					tmp16[1] = *(mtod(m, caddr_t));
-					outsw(iobase + IO_PORT_REG, tmp16, 1);
+					CSR_WRITE_MULTI_2(sc, IO_PORT_REG,
+					    (uint16_t *) tmp16, 1);
 				}
-				outsw(iobase + IO_PORT_REG,
-				      mtod(m, caddr_t) + i, (m->m_len - i) / 2);
-
+				CSR_WRITE_MULTI_2(sc, IO_PORT_REG,
+				    (uint16_t *) (mtod(m, caddr_t) + i),
+				    (m->m_len - i) / 2);
 				if ((i = (m->m_len - i) & 1) != 0) {
 					tmp16[0] = *(mtod(m, caddr_t) +
 						   m->m_len - 1);
 				}
 			}
-			if (i) {
-				outsw(iobase + IO_PORT_REG, tmp16, 1);
-			}
-	
+			if (i)
+				CSR_WRITE_MULTI_2(sc, IO_PORT_REG, 
+				    (uint16_t *) tmp16, 1);
 			/*
 			 * If there were other frames chained, update the
 			 * chain in the last one.
 			 */
 			if (sc->tx_head != sc->tx_tail) {
 				if (sc->tx_tail != dest) {
-					outw(iobase + HOST_ADDR_REG,
+					CSR_WRITE_2(sc, HOST_ADDR_REG,
 					     sc->tx_last + XMT_Chain_Point);
-					outw(iobase + IO_PORT_REG, dest);
+					CSR_WRITE_2(sc, IO_PORT_REG, dest);
 				}
-				outw(iobase + HOST_ADDR_REG,
+				CSR_WRITE_2(sc, HOST_ADDR_REG,
 				     sc->tx_last + XMT_Byte_Count);
-				i = inw(iobase + IO_PORT_REG);
-				outw(iobase + HOST_ADDR_REG,
+				i = CSR_READ_2(sc, IO_PORT_REG);
+				CSR_WRITE_2(sc, HOST_ADDR_REG,
 				     sc->tx_last + XMT_Byte_Count);
-				outw(iobase + IO_PORT_REG, i | Ch_bit);
+				CSR_WRITE_2(sc, IO_PORT_REG, i | Ch_bit);
 			}
 	
 			/*
@@ -527,17 +507,17 @@
 			 * - Send Transmit or Resume_XMT command, as
 			 *   appropriate.
 			 */
-			inw(iobase + IO_PORT_REG);
+			CSR_READ_2(sc, IO_PORT_REG);
 #ifdef EX_PSA_INTR
-			outb(iobase + MASK_REG, All_Int & ~(Rx_Int | Tx_Int));
+			CSR_WRITE_1(sc, MASK_REG, All_Int & ~(Rx_Int | Tx_Int));
 #endif
 			if (sc->tx_head == sc->tx_tail) {
-				outw(iobase + XMT_BAR, dest);
-				outb(iobase + CMD_REG, Transmit_CMD);
+				CSR_WRITE_2(sc, XMT_BAR, dest);
+				CSR_WRITE_1(sc, CMD_REG, Transmit_CMD);
 				sc->tx_head = dest;
 				DODEBUG(Sent_Pkts, printf("Transmit\n"););
 			} else {
-				outb(iobase + CMD_REG, Resume_XMT_List_CMD);
+				CSR_WRITE_1(sc, CMD_REG, Resume_XMT_List_CMD);
 				DODEBUG(Sent_Pkts, printf("Resume\n"););
 			}
 	
@@ -563,8 +543,7 @@
 void
 ex_stop(struct ex_softc *sc)
 {
-	int iobase = sc->iobase;
-
+	
 	DODEBUG(Start_End, printf("ex_stop%d: start\n", unit););
 
 	/*
@@ -574,15 +553,15 @@
 	 * - Mask and clear all interrupts.
 	 * - Reset the 82595.
 	 */
-	outb(iobase + CMD_REG, Bank1_Sel);
-	outb(iobase + REG1, inb(iobase + REG1) & ~TriST_INT);
-	outb(iobase + CMD_REG, Bank0_Sel);
-	outb(iobase + CMD_REG, Rcv_Stop);
+	CSR_WRITE_1(sc, CMD_REG, Bank1_Sel);
+	CSR_WRITE_1(sc, REG1, CSR_READ_1(sc, REG1) & ~TriST_INT);
+	CSR_WRITE_1(sc, CMD_REG, Bank0_Sel);
+	CSR_WRITE_1(sc, CMD_REG, Rcv_Stop);
 	sc->tx_head = sc->tx_tail = sc->tx_lower_limit;
 	sc->tx_last = 0; /* XXX I think these two lines are not necessary, because ex_init will always be called again to reinit the interface. */
-	outb(iobase + MASK_REG, All_Int);
-	outb(iobase + STATUS_REG, All_Int);
-	outb(iobase + CMD_REG, Reset_CMD);
+	CSR_WRITE_1(sc, MASK_REG, All_Int);
+	CSR_WRITE_1(sc, STATUS_REG, All_Int);
+	CSR_WRITE_1(sc, CMD_REG, Reset_CMD);
 	DELAY(200);
 
 	DODEBUG(Start_End, printf("ex_stop%d: finish\n", unit););
@@ -593,44 +572,37 @@
 void
 ex_intr(void *arg)
 {
-	struct ex_softc *	sc = (struct ex_softc *)arg;
-	struct ifnet *	ifp = &sc->arpcom.ac_if;
-	int			iobase = sc->iobase;
-	int			int_status, send_pkts;
+	struct ex_softc *sc = (struct ex_softc *)arg;
+	struct ifnet 	*ifp = &sc->arpcom.ac_if;
+	int		int_status, send_pkts;
+	int		loops = 100;
 
 	DODEBUG(Start_End, printf("ex_intr%d: start\n", unit););
 
-#ifdef EXDEBUG
-	if (++exintr_count != 1)
-		printf("WARNING: nested interrupt (%d). Mail the author.\n", exintr_count);
-#endif
-
 	send_pkts = 0;
-	while ((int_status = inb(iobase + STATUS_REG)) & (Tx_Int | Rx_Int)) {
+	while (loops-- > 0 &&
+	    (int_status = CSR_READ_1(sc, STATUS_REG)) & (Tx_Int | Rx_Int)) {
+		/* don't loop forever */
+		if (int_status == 0xff)
+			break;
 		if (int_status & Rx_Int) {
-			outb(iobase + STATUS_REG, Rx_Int);
-
+			CSR_WRITE_1(sc, STATUS_REG, Rx_Int);
 			ex_rx_intr(sc);
 		} else if (int_status & Tx_Int) {
-			outb(iobase + STATUS_REG, Tx_Int);
-
+			CSR_WRITE_1(sc, STATUS_REG, Tx_Int);
 			ex_tx_intr(sc);
 			send_pkts = 1;
 		}
 	}
+	if (loops == 0)
+		printf("100 loops are not enough\n");
 
 	/*
 	 * If any packet has been transmitted, and there are queued packets to
 	 * be sent, attempt to send more packets to the network card.
 	 */
-
-	if (send_pkts && (ifp->if_snd.ifq_head != NULL)) {
+	if (send_pkts && (ifp->if_snd.ifq_head != NULL))
 		ex_start(ifp);
-	}
-
-#ifdef EXDEBUG
-	exintr_count--;
-#endif
 
 	DODEBUG(Start_End, printf("ex_intr%d: finish\n", unit););
 
@@ -641,7 +613,6 @@
 ex_tx_intr(struct ex_softc *sc)
 {
 	struct ifnet *	ifp = &sc->arpcom.ac_if;
-	int		iobase = sc->iobase;
 	int		tx_status;
 
 	DODEBUG(Start_End, printf("ex_tx_intr%d: start\n", unit););
@@ -656,13 +627,13 @@
 	ifp->if_timer = 0;
 
 	while (sc->tx_head != sc->tx_tail) {
-		outw(iobase + HOST_ADDR_REG, sc->tx_head);
+		CSR_WRITE_2(sc, HOST_ADDR_REG, sc->tx_head);
 
-		if (! inw(iobase + IO_PORT_REG) & Done_bit)
+		if (! CSR_READ_2(sc, IO_PORT_REG) & Done_bit)
 			break;
 
-		tx_status = inw(iobase + IO_PORT_REG);
-		sc->tx_head = inw(iobase + IO_PORT_REG);
+		tx_status = CSR_READ_2(sc, IO_PORT_REG);
+		sc->tx_head = CSR_READ_2(sc, IO_PORT_REG);
 
 		if (tx_status & TX_OK_bit) {
 			ifp->if_opackets++;
@@ -689,7 +660,6 @@
 ex_rx_intr(struct ex_softc *sc)
 {
 	struct ifnet *		ifp = &sc->arpcom.ac_if;
-	int			iobase = sc->iobase;
 	int			rx_status;
 	int			pkt_len;
 	int			QQQ;
@@ -707,13 +677,13 @@
 	 * Finally, advance receive stop limit in card's memory to new location.
 	 */
 
-	outw(iobase + HOST_ADDR_REG, sc->rx_head);
+	CSR_WRITE_2(sc, HOST_ADDR_REG, sc->rx_head);
 
-	while (inw(iobase + IO_PORT_REG) == RCV_Done) {
+	while (CSR_READ_2(sc, IO_PORT_REG) == RCV_Done) {
 
-		rx_status = inw(iobase + IO_PORT_REG);
-		sc->rx_head = inw(iobase + IO_PORT_REG);
-		QQQ = pkt_len = inw(iobase + IO_PORT_REG);
+		rx_status = CSR_READ_2(sc, IO_PORT_REG);
+		sc->rx_head = CSR_READ_2(sc, IO_PORT_REG);
+		QQQ = pkt_len = CSR_READ_2(sc, IO_PORT_REG);
 
 		if (rx_status & RCV_OK_bit) {
 			MGETHDR(m, M_DONTWAIT, MT_DATA);
@@ -743,11 +713,11 @@
 	   * except for the last one in an odd-length packet.
 	   */
 
-					insw(iobase + IO_PORT_REG,
-					     mtod(m, caddr_t), m->m_len / 2);
+					CSR_READ_MULTI_2(sc, IO_PORT_REG,
+					    mtod(m, uint16_t *), m->m_len / 2);
 
 					if (m->m_len & 1) {
-						*(mtod(m, caddr_t) + m->m_len - 1) = inb(iobase + IO_PORT_REG);
+						*(mtod(m, caddr_t) + m->m_len - 1) = CSR_READ_1(sc, IO_PORT_REG);
 					}
 					pkt_len -= m->m_len;
 
@@ -777,14 +747,14 @@
 		} else {
 			ifp->if_ierrors++;
 		}
-		outw(iobase + HOST_ADDR_REG, sc->rx_head);
+		CSR_WRITE_2(sc, HOST_ADDR_REG, sc->rx_head);
 rx_another: ;
 	}
 
 	if (sc->rx_head < sc->rx_lower_limit + 2)
-		outw(iobase + RCV_STOP_REG, sc->rx_upper_limit);
+		CSR_WRITE_2(sc, RCV_STOP_REG, sc->rx_upper_limit);
 	else
-		outw(iobase + RCV_STOP_REG, sc->rx_head - 2);
+		CSR_WRITE_2(sc, RCV_STOP_REG, sc->rx_head - 2);
 
 	DODEBUG(Start_End, printf("ex_rx_intr%d: finish\n", unit););
 
@@ -855,8 +825,7 @@
 {
 	struct ifnet *ifp;
 	struct ifmultiaddr *maddr;
-	u_int16_t *addr;
-	int iobase = sc->iobase;
+	uint16_t *addr;
 	int count;
 	int timeout, status;
 	
@@ -873,61 +842,61 @@
 			|| count > 63) {
 		/* Interface is in promiscuous mode or there are too many
 		 * multicast addresses for the card to handle */
-		outb(iobase + CMD_REG, Bank2_Sel);
-		outb(iobase + REG2, inb(iobase + REG2) | Promisc_Mode);
-		outb(iobase + REG3, inb(iobase + REG3));
-		outb(iobase + CMD_REG, Bank0_Sel);
+		CSR_WRITE_1(sc, CMD_REG, Bank2_Sel);
+		CSR_WRITE_1(sc, REG2, CSR_READ_1(sc, REG2) | Promisc_Mode);
+		CSR_WRITE_1(sc, REG3, CSR_READ_1(sc, REG3));
+		CSR_WRITE_1(sc, CMD_REG, Bank0_Sel);
 	}
 	else if ((ifp->if_flags & IFF_MULTICAST) && (count > 0)) {
 		/* Program multicast addresses plus our MAC address
 		 * into the filter */
-		outb(iobase + CMD_REG, Bank2_Sel);
-		outb(iobase + REG2, inb(iobase + REG2) | Multi_IA);
-		outb(iobase + REG3, inb(iobase + REG3));
-		outb(iobase + CMD_REG, Bank0_Sel);
+		CSR_WRITE_1(sc, CMD_REG, Bank2_Sel);
+		CSR_WRITE_1(sc, REG2, CSR_READ_1(sc, REG2) | Multi_IA);
+		CSR_WRITE_1(sc, REG3, CSR_READ_1(sc, REG3));
+		CSR_WRITE_1(sc, CMD_REG, Bank0_Sel);
 
 		/* Borrow space from TX buffer; this should be safe
 		 * as this is only called from ex_init */
 		
-		outw(iobase + HOST_ADDR_REG, sc->tx_lower_limit);
-		outw(iobase + IO_PORT_REG, MC_Setup_CMD);
-		outw(iobase + IO_PORT_REG, 0);
-		outw(iobase + IO_PORT_REG, 0);
-		outw(iobase + IO_PORT_REG, (count + 1) * 6);
+		CSR_WRITE_2(sc, HOST_ADDR_REG, sc->tx_lower_limit);
+		CSR_WRITE_2(sc, IO_PORT_REG, MC_Setup_CMD);
+		CSR_WRITE_2(sc, IO_PORT_REG, 0);
+		CSR_WRITE_2(sc, IO_PORT_REG, 0);
+		CSR_WRITE_2(sc, IO_PORT_REG, (count + 1) * 6);
 		
 		TAILQ_FOREACH(maddr, &ifp->if_multiaddrs, ifma_link) {
 			if (maddr->ifma_addr->sa_family != AF_LINK)
 				continue;
 
-			addr = (u_int16_t*)LLADDR((struct sockaddr_dl *)
+			addr = (uint16_t*)LLADDR((struct sockaddr_dl *)
 					maddr->ifma_addr);
-			outw(iobase + IO_PORT_REG, *addr++);
-			outw(iobase + IO_PORT_REG, *addr++);
-			outw(iobase + IO_PORT_REG, *addr++);
+			CSR_WRITE_2(sc, IO_PORT_REG, *addr++);
+			CSR_WRITE_2(sc, IO_PORT_REG, *addr++);
+			CSR_WRITE_2(sc, IO_PORT_REG, *addr++);
 		}
 
 		/* Program our MAC address as well */
 		/* XXX: Is this necessary?  The Linux driver does this
 		 * but the NetBSD driver does not */
-		addr = (u_int16_t*)(&sc->arpcom.ac_enaddr);
-		outw(iobase + IO_PORT_REG, *addr++);
-		outw(iobase + IO_PORT_REG, *addr++);
-		outw(iobase + IO_PORT_REG, *addr++);
+		addr = (uint16_t*)(&sc->arpcom.ac_enaddr);
+		CSR_WRITE_2(sc, IO_PORT_REG, *addr++);
+		CSR_WRITE_2(sc, IO_PORT_REG, *addr++);
+		CSR_WRITE_2(sc, IO_PORT_REG, *addr++);
 
-		inw(iobase + IO_PORT_REG);
-		outw(iobase + XMT_BAR, sc->tx_lower_limit);
-		outb(iobase + CMD_REG, MC_Setup_CMD);
+		CSR_READ_2(sc, IO_PORT_REG);
+		CSR_WRITE_2(sc, XMT_BAR, sc->tx_lower_limit);
+		CSR_WRITE_1(sc, CMD_REG, MC_Setup_CMD);
 
 		sc->tx_head = sc->tx_lower_limit;
 		sc->tx_tail = sc->tx_head + XMT_HEADER_LEN + (count + 1) * 6;
 
 		for (timeout=0; timeout<100; timeout++) {
 			DELAY(2);
-			if ((inb(iobase + STATUS_REG) & Exec_Int) == 0)
+			if ((CSR_READ_1(sc, STATUS_REG) & Exec_Int) == 0)
 				continue;
 
-			status = inb(iobase + CMD_REG);
-			outb(iobase + STATUS_REG, Exec_Int);
+			status = CSR_READ_1(sc, CMD_REG);
+			CSR_WRITE_1(sc, STATUS_REG, Exec_Int);
 			break;
 		}
 
@@ -936,11 +905,11 @@
 	else
 	{
 		/* No multicast or promiscuous mode */
-		outb(iobase + CMD_REG, Bank2_Sel);
-		outb(iobase + REG2, inb(iobase + REG2) & 0xDE);
+		CSR_WRITE_1(sc, CMD_REG, Bank2_Sel);
+		CSR_WRITE_1(sc, REG2, CSR_READ_1(sc, REG2) & 0xDE);
 			/* ~(Multi_IA | Promisc_Mode) */
-		outb(iobase + REG3, inb(iobase + REG3));
-		outb(iobase + CMD_REG, Bank0_Sel);
+		CSR_WRITE_1(sc, REG3, CSR_READ_1(sc, REG3));
+		CSR_WRITE_1(sc, CMD_REG, Bank0_Sel);
 	}
 }
 
@@ -984,16 +953,16 @@
 }
 
 static int
-ex_get_media (u_int32_t iobase)
+ex_get_media(struct ex_softc *sc)
 {
 	int	current;
 	int	media;
 
-	media = eeprom_read(iobase, EE_W5);
+	media = ex_eeprom_read(sc, EE_W5);
 
-	outb(iobase + CMD_REG, Bank2_Sel);
-	current = inb(iobase + REG3);
-	outb(iobase + CMD_REG, Bank0_Sel);
+	CSR_WRITE_1(sc, CMD_REG, Bank2_Sel);
+	current = CSR_READ_1(sc, REG3);
+	CSR_WRITE_1(sc, CMD_REG, Bank0_Sel);
 
 	if ((current & TPE_bit) && (media & EE_W5_PORT_TPE))
 		return(IFM_ETHER|IFM_10_T);
@@ -1007,7 +976,7 @@
 }
 
 static int
-ex_ifmedia_upd (ifp)
+ex_ifmedia_upd(ifp)
 	struct ifnet *		ifp;
 {
 	struct ex_softc *       sc = ifp->if_softc;
@@ -1025,47 +994,46 @@
 {
 	struct ex_softc *       sc = ifp->if_softc;
 
-	ifmr->ifm_active = ex_get_media(sc->iobase);
+	ifmr->ifm_active = ex_get_media(sc);
 	ifmr->ifm_status = IFM_AVALID | IFM_ACTIVE;
 
 	return;
 }
 
 u_short
-eeprom_read(u_int32_t iobase, int location)
+ex_eeprom_read(struct ex_softc *sc, int location)
 {
 	int i;
 	u_short data = 0;
-	int ee_addr;
 	int read_cmd = location | EE_READ_CMD;
 	short ctrl_val = EECS;
 
-	ee_addr = iobase + EEPROM_REG;
-	outb(iobase + CMD_REG, Bank2_Sel);
-	outb(ee_addr, EECS);
+	CSR_WRITE_1(sc, CMD_REG, Bank2_Sel);
+	CSR_WRITE_1(sc, EEPROM_REG, EECS);
 	for (i = 8; i >= 0; i--) {
 		short outval = (read_cmd & (1 << i)) ? ctrl_val | EEDI : ctrl_val;
-		outb(ee_addr, outval);
-		outb(ee_addr, outval | EESK);
+		CSR_WRITE_1(sc, EEPROM_REG, outval);
+		CSR_WRITE_1(sc, EEPROM_REG, outval | EESK);
 		DELAY(3);
-		outb(ee_addr, outval);
+		CSR_WRITE_1(sc, EEPROM_REG, outval);
 		DELAY(2);
 	}
-	outb(ee_addr, ctrl_val);
+	CSR_WRITE_1(sc, EEPROM_REG, ctrl_val);
 
 	for (i = 16; i > 0; i--) {
-		outb(ee_addr, ctrl_val | EESK);
+		CSR_WRITE_1(sc, EEPROM_REG, ctrl_val | EESK);
 		DELAY(3);
-		data = (data << 1) | ((inb(ee_addr) & EEDO) ? 1 : 0);
-		outb(ee_addr, ctrl_val);
+		data = (data << 1) | 
+		    ((CSR_READ_1(sc, EEPROM_REG) & EEDO) ? 1 : 0);
+		CSR_WRITE_1(sc, EEPROM_REG, ctrl_val);
 		DELAY(2);
 	}
 
 	ctrl_val &= ~EECS;
-	outb(ee_addr, ctrl_val | EESK);
+	CSR_WRITE_1(sc, EEPROM_REG, ctrl_val | EESK);
 	DELAY(3);
-	outb(ee_addr, ctrl_val);
+	CSR_WRITE_1(sc, EEPROM_REG, ctrl_val);
 	DELAY(2);
-	outb(iobase + CMD_REG, Bank0_Sel);
+	CSR_WRITE_1(sc, CMD_REG, Bank0_Sel);
 	return(data);
 }

==== //depot/projects/netperf_socket/sys/dev/ex/if_ex_isa.c#2 (text+ko) ====


>>> TRUNCATED FOR MAIL (1000 lines) <<<


More information about the p4-projects mailing list