Home | History | Annotate | Line # | Download | only in podulebus
if_ei.c revision 1.9
      1  1.9    perry /* $NetBSD: if_ei.c,v 1.9 2005/02/27 00:27:44 perry Exp $ */
      2  1.1    bjh21 
      3  1.1    bjh21 /*-
      4  1.1    bjh21  * Copyright (c) 2000, 2001 Ben Harris
      5  1.1    bjh21  * All rights reserved.
      6  1.1    bjh21  *
      7  1.1    bjh21  * Redistribution and use in source and binary forms, with or without
      8  1.1    bjh21  * modification, are permitted provided that the following conditions
      9  1.1    bjh21  * are met:
     10  1.1    bjh21  * 1. Redistributions of source code must retain the above copyright
     11  1.1    bjh21  *    notice, this list of conditions and the following disclaimer.
     12  1.1    bjh21  * 2. Redistributions in binary form must reproduce the above copyright
     13  1.1    bjh21  *    notice, this list of conditions and the following disclaimer in the
     14  1.1    bjh21  *    documentation and/or other materials provided with the distribution.
     15  1.1    bjh21  * 3. The name of the author may not be used to endorse or promote products
     16  1.1    bjh21  *    derived from this software without specific prior written permission.
     17  1.9    perry  *
     18  1.1    bjh21  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     19  1.1    bjh21  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     20  1.1    bjh21  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     21  1.1    bjh21  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     22  1.1    bjh21  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     23  1.1    bjh21  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     24  1.1    bjh21  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     25  1.1    bjh21  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     26  1.1    bjh21  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     27  1.1    bjh21  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     28  1.1    bjh21  */
     29  1.1    bjh21 /*
     30  1.1    bjh21  * if_ei.c -- driver for Acorn AKA25 Ether1 card
     31  1.1    bjh21  */
     32  1.1    bjh21 /*
     33  1.1    bjh21  * This is not directly based on the arm32 ie driver, as that doesn't
     34  1.1    bjh21  * use the MI 82586 driver, and generally looks a mess (not to mention
     35  1.1    bjh21  * having dodgy copyright status).  Let's try again.
     36  1.1    bjh21  */
     37  1.1    bjh21 
     38  1.2    lukem #include <sys/cdefs.h>
     39  1.9    perry __KERNEL_RCSID(0, "$NetBSD: if_ei.c,v 1.9 2005/02/27 00:27:44 perry Exp $");
     40  1.2    lukem 
     41  1.1    bjh21 #include <sys/param.h>
     42  1.1    bjh21 
     43  1.1    bjh21 #include <sys/device.h>
     44  1.1    bjh21 #include <sys/malloc.h>
     45  1.1    bjh21 #include <sys/reboot.h>	/* For bootverbose */
     46  1.1    bjh21 #include <sys/socket.h>
     47  1.1    bjh21 #include <sys/syslog.h>
     48  1.1    bjh21 #include <sys/systm.h>
     49  1.1    bjh21 #include <net/if.h>
     50  1.1    bjh21 #include <net/if_ether.h>
     51  1.1    bjh21 #include <net/if_media.h>
     52  1.1    bjh21 #include <machine/bus.h>
     53  1.1    bjh21 #include <dev/ic/i82586reg.h>
     54  1.1    bjh21 #include <dev/ic/i82586var.h>
     55  1.1    bjh21 #include <dev/podulebus/podulebus.h>
     56  1.1    bjh21 #include <dev/podulebus/podules.h>
     57  1.1    bjh21 #include <dev/podulebus/if_eireg.h>
     58  1.1    bjh21 
     59  1.1    bjh21 /* Callbacks from the MI 82586 driver */
     60  1.1    bjh21 static void ei_hwreset(struct ie_softc *, int);
     61  1.1    bjh21 /* static void ei_hwinit(struct ie_softc *); */
     62  1.1    bjh21 static void ei_attn(struct ie_softc *, int);
     63  1.1    bjh21 static int ei_intrhook(struct ie_softc *, int);
     64  1.1    bjh21 
     65  1.1    bjh21 static void ei_copyin(struct ie_softc *, void *, int, size_t);
     66  1.1    bjh21 static void ei_copyout(struct ie_softc *, const void *, int, size_t);
     67  1.1    bjh21 static u_int16_t ei_read16(struct ie_softc *, int);
     68  1.1    bjh21 static void ei_write16(struct ie_softc *, int, u_int16_t);
     69  1.1    bjh21 static void ei_write24(struct ie_softc *, int, int);
     70  1.1    bjh21 
     71  1.1    bjh21 /* autoconfiguration glue */
     72  1.1    bjh21 static int ei_match(struct device *, struct cfdata *, void *);
     73  1.1    bjh21 static void ei_attach(struct device *, struct device *, void *);
     74  1.1    bjh21 
     75  1.1    bjh21 struct ei_softc {
     76  1.1    bjh21 	struct	ie_softc sc_ie;
     77  1.1    bjh21 	bus_space_tag_t		sc_ctl_t;
     78  1.1    bjh21 	bus_space_handle_t	sc_ctl_h;
     79  1.1    bjh21 	bus_space_tag_t		sc_mem_t;
     80  1.1    bjh21 	bus_space_handle_t	sc_mem_h;
     81  1.1    bjh21 	bus_space_tag_t		sc_rom_t;
     82  1.1    bjh21 	bus_space_handle_t	sc_rom_h;
     83  1.1    bjh21 	u_int8_t	sc_idrom[EI_ROMSIZE];
     84  1.1    bjh21 	void			*sc_ih;
     85  1.1    bjh21 	struct		evcnt	sc_intrcnt;
     86  1.1    bjh21 };
     87  1.1    bjh21 
     88  1.7  thorpej CFATTACH_DECL(ei, sizeof(struct ei_softc),
     89  1.8  thorpej     ei_match, ei_attach, NULL, NULL);
     90  1.1    bjh21 
     91  1.1    bjh21 static inline void
     92  1.1    bjh21 ei_setpage(struct ei_softc *sc, int page)
     93  1.1    bjh21 {
     94  1.1    bjh21 
     95  1.1    bjh21 	bus_space_write_1(sc->sc_ctl_t, sc->sc_ctl_h, EI_PAGE, page);
     96  1.1    bjh21 }
     97  1.1    bjh21 
     98  1.1    bjh21 static inline void
     99  1.1    bjh21 ei_cli(struct ei_softc *sc)
    100  1.1    bjh21 {
    101  1.1    bjh21 
    102  1.1    bjh21 	bus_space_write_1(sc->sc_ctl_t, sc->sc_ctl_h, EI_CONTROL, EI_CTL_CLI);
    103  1.1    bjh21 }
    104  1.1    bjh21 
    105  1.1    bjh21 static int
    106  1.1    bjh21 ei_match(struct device *parent, struct cfdata *cf, void *aux)
    107  1.1    bjh21 {
    108  1.1    bjh21 	struct podulebus_attach_args *pa = aux;
    109  1.1    bjh21 
    110  1.5    bjh21 	return pa->pa_product == PODULE_ETHER1;
    111  1.1    bjh21 }
    112  1.1    bjh21 
    113  1.1    bjh21 static void
    114  1.1    bjh21 ei_attach(struct device *parent, struct device *self, void *aux)
    115  1.1    bjh21 {
    116  1.1    bjh21 	struct podulebus_attach_args *pa = aux;
    117  1.1    bjh21 	struct ei_softc *sc = (struct ei_softc *)self;
    118  1.1    bjh21 	int i;
    119  1.1    bjh21 	char descr[16];
    120  1.1    bjh21 
    121  1.1    bjh21 	/* Set up bus spaces */
    122  1.1    bjh21 	sc->sc_ctl_t = sc->sc_mem_t = pa->pa_fast_t;
    123  1.1    bjh21 	bus_space_map(pa->pa_fast_t, pa->pa_fast_base, EI_MEMOFF, 0,
    124  1.1    bjh21 	    &sc->sc_ctl_h);
    125  1.1    bjh21 	bus_space_map(pa->pa_fast_t, pa->pa_fast_base + EI_MEMOFF,
    126  1.1    bjh21 	    EI_PAGESIZE * 2, 0, &sc->sc_mem_h);
    127  1.1    bjh21 	sc->sc_rom_t = pa->pa_sync_t;
    128  1.1    bjh21 	bus_space_map(pa->pa_sync_t, pa->pa_sync_base, EI_ROMSIZE, 0,
    129  1.1    bjh21 	    &sc->sc_rom_h);
    130  1.1    bjh21 
    131  1.1    bjh21 	/* Set up callbacks */
    132  1.1    bjh21 	sc->sc_ie.hwinit = NULL;
    133  1.1    bjh21 	sc->sc_ie.intrhook = ei_intrhook;
    134  1.1    bjh21 	sc->sc_ie.hwreset = ei_hwreset;
    135  1.1    bjh21 	sc->sc_ie.chan_attn = ei_attn;
    136  1.1    bjh21 
    137  1.1    bjh21 	sc->sc_ie.memcopyin = ei_copyin;
    138  1.1    bjh21 	sc->sc_ie.memcopyout = ei_copyout;
    139  1.1    bjh21 
    140  1.1    bjh21 	sc->sc_ie.ie_bus_barrier = NULL;
    141  1.1    bjh21 	sc->sc_ie.ie_bus_read16 = ei_read16;
    142  1.1    bjh21 	sc->sc_ie.ie_bus_write16 = ei_write16;
    143  1.1    bjh21 	sc->sc_ie.ie_bus_write24 = ei_write24;
    144  1.1    bjh21 
    145  1.1    bjh21 	sc->sc_ie.do_xmitnopchain = 0; /* Does it listen? */
    146  1.1    bjh21 
    147  1.1    bjh21 	sc->sc_ie.sc_mediachange = NULL;
    148  1.1    bjh21 	sc->sc_ie.sc_mediastatus = NULL;
    149  1.1    bjh21 
    150  1.1    bjh21 	sc->sc_ie.bt = sc->sc_mem_t; /* XXX hope it doesn't use them */
    151  1.1    bjh21 	sc->sc_ie.bh = sc->sc_mem_h;
    152  1.1    bjh21 
    153  1.1    bjh21 	printf(":");
    154  1.1    bjh21 
    155  1.1    bjh21 	/* All Ether1s are 64k (I believe) */
    156  1.1    bjh21 	sc->sc_ie.sc_msize = EI_MEMSIZE;
    157  1.1    bjh21 
    158  1.1    bjh21 	/* set up pointers to important on-card control structures */
    159  1.1    bjh21 	sc->sc_ie.iscp = 0;
    160  1.1    bjh21 	sc->sc_ie.scb = IE_ISCP_SZ;
    161  1.1    bjh21 	sc->sc_ie.scp = sc->sc_ie.sc_msize + IE_SCP_ADDR - (1 << 24);
    162  1.1    bjh21 
    163  1.1    bjh21 	sc->sc_ie.buf_area = sc->sc_ie.scb + IE_SCB_SZ;
    164  1.1    bjh21 	sc->sc_ie.buf_area_sz =
    165  1.1    bjh21 	    sc->sc_ie.sc_msize - IE_ISCP_SZ - IE_SCB_SZ - IE_SCP_SZ;
    166  1.1    bjh21 
    167  1.1    bjh21 	/* Wipe the whole of the card's memory */
    168  1.1    bjh21 	for (i = 0; i < EI_NPAGES; i++) {
    169  1.1    bjh21 		ei_setpage(sc, i);
    170  1.1    bjh21 		bus_space_set_region_2(sc->sc_mem_t, sc->sc_mem_h,
    171  1.1    bjh21 				       0, 0,EI_PAGESIZE / 2);
    172  1.1    bjh21 	}
    173  1.1    bjh21 
    174  1.1    bjh21 	/* set up pointers to key structures */
    175  1.1    bjh21 	ei_write24(&sc->sc_ie, IE_SCP_ISCP((u_long)sc->sc_ie.scp),
    176  1.1    bjh21 		    (u_long) sc->sc_ie.iscp);
    177  1.1    bjh21 	ei_write16(&sc->sc_ie, IE_ISCP_SCB((u_long)sc->sc_ie.iscp),
    178  1.1    bjh21 		    (u_long) sc->sc_ie.scb);
    179  1.1    bjh21 	ei_write24(&sc->sc_ie, IE_ISCP_BASE((u_long)sc->sc_ie.iscp),
    180  1.1    bjh21 		    (u_long) sc->sc_ie.iscp);
    181  1.1    bjh21 
    182  1.1    bjh21 	/* check if chip answers */
    183  1.1    bjh21 	if (i82586_proberam(&sc->sc_ie) == 0) {
    184  1.1    bjh21 		printf(" memory probe failed\n");
    185  1.1    bjh21 		return;
    186  1.1    bjh21 	}
    187  1.1    bjh21 
    188  1.1    bjh21 	/* Read ROM */
    189  1.1    bjh21 	bus_space_read_region_1(sc->sc_rom_t, sc->sc_rom_h, 0,
    190  1.1    bjh21 				sc->sc_idrom, EI_ROMSIZE);
    191  1.1    bjh21 
    192  1.1    bjh21 	snprintf(descr, 15, "AKA25 iss. %d", sc->sc_idrom[EI_ROM_HWREV]);
    193  1.1    bjh21 	i82586_attach(&sc->sc_ie, descr, sc->sc_idrom + EI_ROM_EADDR,
    194  1.1    bjh21 		      NULL, 0, 0);
    195  1.1    bjh21 
    196  1.1    bjh21 	evcnt_attach_dynamic(&sc->sc_intrcnt, EVCNT_TYPE_INTR, NULL,
    197  1.1    bjh21 	    self->dv_xname, "intr");
    198  1.1    bjh21 	sc->sc_ih = podulebus_irq_establish(pa->pa_ih, IPL_NET, i82586_intr,
    199  1.1    bjh21 	    self, &sc->sc_intrcnt);
    200  1.1    bjh21 	ei_cli(sc);
    201  1.1    bjh21 }
    202  1.1    bjh21 
    203  1.1    bjh21 static void
    204  1.1    bjh21 ei_hwreset(struct ie_softc *sc_ie, int why)
    205  1.1    bjh21 {
    206  1.1    bjh21 	struct ei_softc *sc = (struct ei_softc *)sc_ie;
    207  1.1    bjh21 
    208  1.4    bjh21 	bus_space_write_1(sc->sc_ctl_t, sc->sc_ctl_h, EI_CONTROL, EI_CTL_RST);
    209  1.1    bjh21 	DELAY(1000);
    210  1.1    bjh21 	bus_space_write_1(sc->sc_ctl_t, sc->sc_ctl_h, EI_CONTROL, 0);
    211  1.1    bjh21 	DELAY(1000);
    212  1.1    bjh21 	ei_cli(sc);
    213  1.1    bjh21 }
    214  1.1    bjh21 
    215  1.1    bjh21 static int
    216  1.1    bjh21 ei_intrhook(struct ie_softc *sc_ie, int why)
    217  1.1    bjh21 {
    218  1.1    bjh21 	struct ei_softc *sc = (struct ei_softc *)sc_ie;
    219  1.1    bjh21 
    220  1.1    bjh21 	switch (why) {
    221  1.1    bjh21 	case INTR_EXIT:
    222  1.1    bjh21 	case INTR_ACK:
    223  1.1    bjh21 		ei_cli(sc);
    224  1.1    bjh21 		break;
    225  1.1    bjh21 	}
    226  1.1    bjh21 	return 0;
    227  1.1    bjh21 }
    228  1.1    bjh21 
    229  1.1    bjh21 static void
    230  1.1    bjh21 ei_attn(struct ie_softc *sc_ie, int why)
    231  1.1    bjh21 {
    232  1.1    bjh21 	struct ei_softc *sc = (void *)sc_ie;
    233  1.1    bjh21 
    234  1.4    bjh21 	bus_space_write_1(sc->sc_ctl_t, sc->sc_ctl_h, EI_CONTROL, EI_CTL_CA);
    235  1.1    bjh21 }
    236  1.1    bjh21 
    237  1.1    bjh21 /*
    238  1.1    bjh21  * Various access functions to allow the MI 82586 driver to get at the
    239  1.1    bjh21  * board's memory.  All memory accesses must go through these, as
    240  1.1    bjh21  * nothing else knows how to manipulate the page register.  Note that
    241  1.1    bjh21  * all addresses and lengths passed in are in bytes of actual data.
    242  1.1    bjh21  * The bus_space functions deal in words, though, so we have to
    243  1.1    bjh21  * convert on the way through.
    244  1.1    bjh21  */
    245  1.1    bjh21 
    246  1.1    bjh21 static void
    247  1.1    bjh21 ei_copyin(struct ie_softc *sc_ie, void *dest, int src, size_t size)
    248  1.1    bjh21 {
    249  1.1    bjh21 	struct ei_softc *sc = (struct ei_softc *)sc_ie;
    250  1.1    bjh21 	int cnt, s, extra_byte;
    251  1.1    bjh21 	u_int16_t *wptr;
    252  1.1    bjh21 
    253  1.1    bjh21 #ifdef DIAGNOSTIC
    254  1.1    bjh21 	if (src % 2 != 0 || !ALIGNED_POINTER(dest, u_int16_t))
    255  1.1    bjh21 		panic("%s: unaligned copyin", sc_ie->sc_dev.dv_xname);
    256  1.1    bjh21 #endif
    257  1.1    bjh21 	wptr = dest;
    258  1.1    bjh21 	extra_byte = size % 2;
    259  1.1    bjh21 	size -= extra_byte;
    260  1.1    bjh21 	while (size > 0) {
    261  1.1    bjh21 		cnt = EI_PAGESIZE - src % EI_PAGESIZE;
    262  1.1    bjh21 		if (cnt > size)
    263  1.1    bjh21 			cnt = size;
    264  1.1    bjh21 		s = splnet();
    265  1.1    bjh21 		ei_setpage(sc, ei_atop(src));
    266  1.1    bjh21 		/* bus ops are in words */
    267  1.1    bjh21 		bus_space_read_region_2(sc->sc_mem_t, sc->sc_mem_h,
    268  1.1    bjh21 					ei_atopo(src) / 2, wptr, cnt / 2);
    269  1.1    bjh21 		splx(s);
    270  1.1    bjh21 		src += cnt;
    271  1.1    bjh21 		wptr += cnt / 2;
    272  1.1    bjh21 		size -= cnt;
    273  1.1    bjh21 	}
    274  1.1    bjh21 	if (extra_byte) {
    275  1.1    bjh21 		/* Do we need to be this careful? */
    276  1.1    bjh21 		s = splnet();
    277  1.1    bjh21 		ei_setpage(sc, ei_atop(src));
    278  1.1    bjh21 		*(u_int8_t *)wptr =
    279  1.1    bjh21 		    bus_space_read_2(sc->sc_mem_t, sc->sc_mem_h,
    280  1.1    bjh21 				     ei_atopo(src) / 2) & 0xff;
    281  1.1    bjh21 		splx(s);
    282  1.1    bjh21 	}
    283  1.1    bjh21 }
    284  1.1    bjh21 
    285  1.1    bjh21 static void
    286  1.1    bjh21 ei_copyout(struct ie_softc *sc_ie, const void *src, int dest, size_t size)
    287  1.1    bjh21 {
    288  1.1    bjh21 	struct ei_softc *sc = (struct ei_softc *)sc_ie;
    289  1.1    bjh21 	int cnt, s;
    290  1.1    bjh21 	const u_int16_t *wptr;
    291  1.1    bjh21 	u_int16_t *bounce = NULL;
    292  1.1    bjh21 
    293  1.1    bjh21 #ifdef DIAGNOSTIC
    294  1.1    bjh21 	if (dest % 2 != 0)
    295  1.1    bjh21 		panic("%s: unaligned copyout", sc_ie->sc_dev.dv_xname);
    296  1.1    bjh21 #endif
    297  1.1    bjh21 	if (!ALIGNED_POINTER(src, u_int16_t)) {
    298  1.1    bjh21 		MALLOC(bounce, u_int16_t *, size, M_DEVBUF, M_NOWAIT);
    299  1.1    bjh21 		if (bounce == NULL)
    300  1.1    bjh21 			panic("%s: no memory to align copyout",
    301  1.1    bjh21 			      sc_ie->sc_dev.dv_xname);
    302  1.1    bjh21 		memcpy(bounce, src, size);
    303  1.1    bjh21 		src = bounce;
    304  1.1    bjh21 	}
    305  1.1    bjh21 	wptr = src;
    306  1.1    bjh21 	if (size % 2 != 0)
    307  1.1    bjh21 		size++; /* This is safe, since the buffer is 16bit aligned */
    308  1.1    bjh21 	while (size > 0) {
    309  1.1    bjh21 		cnt = EI_PAGESIZE - dest % EI_PAGESIZE;
    310  1.1    bjh21 		if (cnt > size)
    311  1.1    bjh21 			cnt = size;
    312  1.1    bjh21 		s = splnet();
    313  1.1    bjh21 		ei_setpage(sc, ei_atop(dest));
    314  1.1    bjh21 		/* bus ops are in words */
    315  1.1    bjh21 		bus_space_write_region_2(sc->sc_mem_t, sc->sc_mem_h,
    316  1.1    bjh21 					 ei_atopo(dest) / 2, wptr, cnt / 2);
    317  1.1    bjh21 		splx(s);
    318  1.1    bjh21 		wptr += cnt / 2;
    319  1.1    bjh21 		dest += cnt;
    320  1.1    bjh21 		size -= cnt;
    321  1.1    bjh21 	}
    322  1.1    bjh21 	if (bounce != NULL)
    323  1.1    bjh21 		FREE(bounce, M_DEVBUF);
    324  1.1    bjh21 }
    325  1.1    bjh21 
    326  1.1    bjh21 static u_int16_t
    327  1.1    bjh21 ei_read16(struct ie_softc *sc_ie, int addr)
    328  1.1    bjh21 {
    329  1.1    bjh21 	struct ei_softc *sc = (struct ei_softc *)sc_ie;
    330  1.1    bjh21 	int result, s;
    331  1.1    bjh21 
    332  1.1    bjh21 #ifdef DIAGNOSTIC
    333  1.1    bjh21 	if (addr % 2 != 0)
    334  1.1    bjh21 		panic("%s: unaligned read16", sc_ie->sc_dev.dv_xname);
    335  1.1    bjh21 #endif
    336  1.1    bjh21 	s = splnet();
    337  1.1    bjh21 	ei_setpage(sc, ei_atop(addr));
    338  1.1    bjh21 	result = bus_space_read_2(sc->sc_mem_t, sc->sc_mem_h,
    339  1.1    bjh21 				  ei_atopo(addr) / 2);
    340  1.1    bjh21 	splx(s);
    341  1.1    bjh21 	return result;
    342  1.1    bjh21 }
    343  1.1    bjh21 
    344  1.1    bjh21 static void
    345  1.1    bjh21 ei_write16(struct ie_softc *sc_ie, int addr, u_int16_t value)
    346  1.1    bjh21 {
    347  1.1    bjh21 	struct ei_softc *sc = (struct ei_softc *)sc_ie;
    348  1.1    bjh21 	int s;
    349  1.1    bjh21 
    350  1.1    bjh21 #ifdef DIAGNOSTIC
    351  1.1    bjh21 	if (addr % 2 != 0)
    352  1.1    bjh21 		panic("%s: unaligned write16", sc_ie->sc_dev.dv_xname);
    353  1.1    bjh21 #endif
    354  1.1    bjh21 	s = splnet();
    355  1.1    bjh21 	ei_setpage(sc, ei_atop(addr));
    356  1.1    bjh21 	bus_space_write_2(sc->sc_mem_t, sc->sc_mem_h, ei_atopo(addr) / 2,
    357  1.1    bjh21 			  value);
    358  1.1    bjh21 	splx(s);
    359  1.1    bjh21 }
    360  1.1    bjh21 
    361  1.1    bjh21 static void
    362  1.1    bjh21 ei_write24(struct ie_softc *sc_ie, int addr, int value)
    363  1.1    bjh21 {
    364  1.1    bjh21 	int s;
    365  1.1    bjh21 
    366  1.1    bjh21 #ifdef DIAGNOSTIC
    367  1.1    bjh21 	if (addr % 2 != 0)
    368  1.1    bjh21 		panic("%s: unaligned write24", sc_ie->sc_dev.dv_xname);
    369  1.1    bjh21 #endif
    370  1.1    bjh21 	s = splnet();
    371  1.1    bjh21 	ei_write16(sc_ie, addr, value & 0xffff);
    372  1.1    bjh21 	ei_write16(sc_ie, addr + 2, (value >> 16) & 0xff);
    373  1.1    bjh21 	splx(s);
    374  1.1    bjh21 }
    375  1.1    bjh21 
    376