Home | History | Annotate | Line # | Download | only in podulebus
if_ei.c revision 1.1
      1  1.1  bjh21 /* $NetBSD: if_ei.c,v 1.1 2001/03/19 23:58:12 bjh21 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.1  bjh21  *
     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.1  bjh21 #include <sys/param.h>
     39  1.1  bjh21 
     40  1.1  bjh21 __RCSID("$NetBSD: if_ei.c,v 1.1 2001/03/19 23:58:12 bjh21 Exp $");
     41  1.1  bjh21 
     42  1.1  bjh21 #include <sys/device.h>
     43  1.1  bjh21 #include <sys/malloc.h>
     44  1.1  bjh21 #include <sys/reboot.h>	/* For bootverbose */
     45  1.1  bjh21 #include <sys/socket.h>
     46  1.1  bjh21 #include <sys/syslog.h>
     47  1.1  bjh21 #include <sys/systm.h>
     48  1.1  bjh21 #include <net/if.h>
     49  1.1  bjh21 #include <net/if_ether.h>
     50  1.1  bjh21 #include <net/if_media.h>
     51  1.1  bjh21 #include <machine/bus.h>
     52  1.1  bjh21 #include <dev/ic/i82586reg.h>
     53  1.1  bjh21 #include <dev/ic/i82586var.h>
     54  1.1  bjh21 #include <dev/podulebus/podulebus.h>
     55  1.1  bjh21 #include <dev/podulebus/podules.h>
     56  1.1  bjh21 #include <dev/podulebus/if_eireg.h>
     57  1.1  bjh21 
     58  1.1  bjh21 /* Callbacks from the MI 82586 driver */
     59  1.1  bjh21 static void ei_hwreset(struct ie_softc *, int);
     60  1.1  bjh21 /* static void ei_hwinit(struct ie_softc *); */
     61  1.1  bjh21 static void ei_attn(struct ie_softc *, int);
     62  1.1  bjh21 static int ei_intrhook(struct ie_softc *, int);
     63  1.1  bjh21 
     64  1.1  bjh21 static void ei_copyin(struct ie_softc *, void *, int, size_t);
     65  1.1  bjh21 static void ei_copyout(struct ie_softc *, const void *, int, size_t);
     66  1.1  bjh21 static u_int16_t ei_read16(struct ie_softc *, int);
     67  1.1  bjh21 static void ei_write16(struct ie_softc *, int, u_int16_t);
     68  1.1  bjh21 static void ei_write24(struct ie_softc *, int, int);
     69  1.1  bjh21 
     70  1.1  bjh21 /* autoconfiguration glue */
     71  1.1  bjh21 static int ei_match(struct device *, struct cfdata *, void *);
     72  1.1  bjh21 static void ei_attach(struct device *, struct device *, void *);
     73  1.1  bjh21 
     74  1.1  bjh21 struct ei_softc {
     75  1.1  bjh21 	struct	ie_softc sc_ie;
     76  1.1  bjh21 	bus_space_tag_t		sc_ctl_t;
     77  1.1  bjh21 	bus_space_handle_t	sc_ctl_h;
     78  1.1  bjh21 	bus_space_tag_t		sc_mem_t;
     79  1.1  bjh21 	bus_space_handle_t	sc_mem_h;
     80  1.1  bjh21 	bus_space_tag_t		sc_rom_t;
     81  1.1  bjh21 	bus_space_handle_t	sc_rom_h;
     82  1.1  bjh21 	u_int8_t	sc_idrom[EI_ROMSIZE];
     83  1.1  bjh21 	void			*sc_ih;
     84  1.1  bjh21 	struct		evcnt	sc_intrcnt;
     85  1.1  bjh21 };
     86  1.1  bjh21 
     87  1.1  bjh21 struct cfattach ei_ca = {
     88  1.1  bjh21 	sizeof(struct ei_softc), ei_match, ei_attach
     89  1.1  bjh21 };
     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.1  bjh21 	return IS_PODULE(pa, MANUFACTURER_ACORN, PODULE_ACORN_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.1  bjh21 	bus_space_write_1(sc->sc_ctl_t, sc->sc_ctl_h,
    209  1.1  bjh21 			  EI_CONTROL, EI_CTL_RESET);
    210  1.1  bjh21 	DELAY(1000);
    211  1.1  bjh21 	bus_space_write_1(sc->sc_ctl_t, sc->sc_ctl_h, EI_CONTROL, 0);
    212  1.1  bjh21 	DELAY(1000);
    213  1.1  bjh21 	ei_cli(sc);
    214  1.1  bjh21 }
    215  1.1  bjh21 
    216  1.1  bjh21 static int
    217  1.1  bjh21 ei_intrhook(struct ie_softc *sc_ie, int why)
    218  1.1  bjh21 {
    219  1.1  bjh21 	struct ei_softc *sc = (struct ei_softc *)sc_ie;
    220  1.1  bjh21 
    221  1.1  bjh21 	switch (why) {
    222  1.1  bjh21 	case INTR_EXIT:
    223  1.1  bjh21 	case INTR_ACK:
    224  1.1  bjh21 		ei_cli(sc);
    225  1.1  bjh21 		break;
    226  1.1  bjh21 	}
    227  1.1  bjh21 	return 0;
    228  1.1  bjh21 }
    229  1.1  bjh21 
    230  1.1  bjh21 static void
    231  1.1  bjh21 ei_attn(struct ie_softc *sc_ie, int why)
    232  1.1  bjh21 {
    233  1.1  bjh21 	struct ei_softc *sc = (void *)sc_ie;
    234  1.1  bjh21 
    235  1.1  bjh21 	bus_space_write_1(sc->sc_ctl_t, sc->sc_ctl_h, EI_CONTROL, EI_CTL_ATTN);
    236  1.1  bjh21 }
    237  1.1  bjh21 
    238  1.1  bjh21 /*
    239  1.1  bjh21  * Various access functions to allow the MI 82586 driver to get at the
    240  1.1  bjh21  * board's memory.  All memory accesses must go through these, as
    241  1.1  bjh21  * nothing else knows how to manipulate the page register.  Note that
    242  1.1  bjh21  * all addresses and lengths passed in are in bytes of actual data.
    243  1.1  bjh21  * The bus_space functions deal in words, though, so we have to
    244  1.1  bjh21  * convert on the way through.
    245  1.1  bjh21  */
    246  1.1  bjh21 
    247  1.1  bjh21 static void
    248  1.1  bjh21 ei_copyin(struct ie_softc *sc_ie, void *dest, int src, size_t size)
    249  1.1  bjh21 {
    250  1.1  bjh21 	struct ei_softc *sc = (struct ei_softc *)sc_ie;
    251  1.1  bjh21 	int cnt, s, extra_byte;
    252  1.1  bjh21 	u_int16_t *wptr;
    253  1.1  bjh21 
    254  1.1  bjh21 #ifdef DIAGNOSTIC
    255  1.1  bjh21 	if (src % 2 != 0 || !ALIGNED_POINTER(dest, u_int16_t))
    256  1.1  bjh21 		panic("%s: unaligned copyin", sc_ie->sc_dev.dv_xname);
    257  1.1  bjh21 #endif
    258  1.1  bjh21 	wptr = dest;
    259  1.1  bjh21 	extra_byte = size % 2;
    260  1.1  bjh21 	size -= extra_byte;
    261  1.1  bjh21 	while (size > 0) {
    262  1.1  bjh21 		cnt = EI_PAGESIZE - src % EI_PAGESIZE;
    263  1.1  bjh21 		if (cnt > size)
    264  1.1  bjh21 			cnt = size;
    265  1.1  bjh21 		s = splnet();
    266  1.1  bjh21 		ei_setpage(sc, ei_atop(src));
    267  1.1  bjh21 		/* bus ops are in words */
    268  1.1  bjh21 		bus_space_read_region_2(sc->sc_mem_t, sc->sc_mem_h,
    269  1.1  bjh21 					ei_atopo(src) / 2, wptr, cnt / 2);
    270  1.1  bjh21 		splx(s);
    271  1.1  bjh21 		src += cnt;
    272  1.1  bjh21 		wptr += cnt / 2;
    273  1.1  bjh21 		size -= cnt;
    274  1.1  bjh21 	}
    275  1.1  bjh21 	if (extra_byte) {
    276  1.1  bjh21 		/* Do we need to be this careful? */
    277  1.1  bjh21 		s = splnet();
    278  1.1  bjh21 		ei_setpage(sc, ei_atop(src));
    279  1.1  bjh21 		*(u_int8_t *)wptr =
    280  1.1  bjh21 		    bus_space_read_2(sc->sc_mem_t, sc->sc_mem_h,
    281  1.1  bjh21 				     ei_atopo(src) / 2) & 0xff;
    282  1.1  bjh21 		splx(s);
    283  1.1  bjh21 	}
    284  1.1  bjh21 }
    285  1.1  bjh21 
    286  1.1  bjh21 static void
    287  1.1  bjh21 ei_copyout(struct ie_softc *sc_ie, const void *src, int dest, size_t size)
    288  1.1  bjh21 {
    289  1.1  bjh21 	struct ei_softc *sc = (struct ei_softc *)sc_ie;
    290  1.1  bjh21 	int cnt, s;
    291  1.1  bjh21 	const u_int16_t *wptr;
    292  1.1  bjh21 	u_int16_t *bounce = NULL;
    293  1.1  bjh21 
    294  1.1  bjh21 #ifdef DIAGNOSTIC
    295  1.1  bjh21 	if (dest % 2 != 0)
    296  1.1  bjh21 		panic("%s: unaligned copyout", sc_ie->sc_dev.dv_xname);
    297  1.1  bjh21 #endif
    298  1.1  bjh21 	if (!ALIGNED_POINTER(src, u_int16_t)) {
    299  1.1  bjh21 		MALLOC(bounce, u_int16_t *, size, M_DEVBUF, M_NOWAIT);
    300  1.1  bjh21 		if (bounce == NULL)
    301  1.1  bjh21 			panic("%s: no memory to align copyout",
    302  1.1  bjh21 			      sc_ie->sc_dev.dv_xname);
    303  1.1  bjh21 		memcpy(bounce, src, size);
    304  1.1  bjh21 		src = bounce;
    305  1.1  bjh21 	}
    306  1.1  bjh21 	wptr = src;
    307  1.1  bjh21 	if (size % 2 != 0)
    308  1.1  bjh21 		size++; /* This is safe, since the buffer is 16bit aligned */
    309  1.1  bjh21 	while (size > 0) {
    310  1.1  bjh21 		cnt = EI_PAGESIZE - dest % EI_PAGESIZE;
    311  1.1  bjh21 		if (cnt > size)
    312  1.1  bjh21 			cnt = size;
    313  1.1  bjh21 		s = splnet();
    314  1.1  bjh21 		ei_setpage(sc, ei_atop(dest));
    315  1.1  bjh21 		/* bus ops are in words */
    316  1.1  bjh21 		bus_space_write_region_2(sc->sc_mem_t, sc->sc_mem_h,
    317  1.1  bjh21 					 ei_atopo(dest) / 2, wptr, cnt / 2);
    318  1.1  bjh21 		splx(s);
    319  1.1  bjh21 		wptr += cnt / 2;
    320  1.1  bjh21 		dest += cnt;
    321  1.1  bjh21 		size -= cnt;
    322  1.1  bjh21 	}
    323  1.1  bjh21 	if (bounce != NULL)
    324  1.1  bjh21 		FREE(bounce, M_DEVBUF);
    325  1.1  bjh21 }
    326  1.1  bjh21 
    327  1.1  bjh21 static u_int16_t
    328  1.1  bjh21 ei_read16(struct ie_softc *sc_ie, int addr)
    329  1.1  bjh21 {
    330  1.1  bjh21 	struct ei_softc *sc = (struct ei_softc *)sc_ie;
    331  1.1  bjh21 	int result, s;
    332  1.1  bjh21 
    333  1.1  bjh21 #ifdef DIAGNOSTIC
    334  1.1  bjh21 	if (addr % 2 != 0)
    335  1.1  bjh21 		panic("%s: unaligned read16", sc_ie->sc_dev.dv_xname);
    336  1.1  bjh21 #endif
    337  1.1  bjh21 	s = splnet();
    338  1.1  bjh21 	ei_setpage(sc, ei_atop(addr));
    339  1.1  bjh21 	result = bus_space_read_2(sc->sc_mem_t, sc->sc_mem_h,
    340  1.1  bjh21 				  ei_atopo(addr) / 2);
    341  1.1  bjh21 	splx(s);
    342  1.1  bjh21 	return result;
    343  1.1  bjh21 }
    344  1.1  bjh21 
    345  1.1  bjh21 static void
    346  1.1  bjh21 ei_write16(struct ie_softc *sc_ie, int addr, u_int16_t value)
    347  1.1  bjh21 {
    348  1.1  bjh21 	struct ei_softc *sc = (struct ei_softc *)sc_ie;
    349  1.1  bjh21 	int s;
    350  1.1  bjh21 
    351  1.1  bjh21 #ifdef DIAGNOSTIC
    352  1.1  bjh21 	if (addr % 2 != 0)
    353  1.1  bjh21 		panic("%s: unaligned write16", sc_ie->sc_dev.dv_xname);
    354  1.1  bjh21 #endif
    355  1.1  bjh21 	s = splnet();
    356  1.1  bjh21 	ei_setpage(sc, ei_atop(addr));
    357  1.1  bjh21 	bus_space_write_2(sc->sc_mem_t, sc->sc_mem_h, ei_atopo(addr) / 2,
    358  1.1  bjh21 			  value);
    359  1.1  bjh21 	splx(s);
    360  1.1  bjh21 }
    361  1.1  bjh21 
    362  1.1  bjh21 static void
    363  1.1  bjh21 ei_write24(struct ie_softc *sc_ie, int addr, int value)
    364  1.1  bjh21 {
    365  1.1  bjh21 	int s;
    366  1.1  bjh21 
    367  1.1  bjh21 #ifdef DIAGNOSTIC
    368  1.1  bjh21 	if (addr % 2 != 0)
    369  1.1  bjh21 		panic("%s: unaligned write24", sc_ie->sc_dev.dv_xname);
    370  1.1  bjh21 #endif
    371  1.1  bjh21 	s = splnet();
    372  1.1  bjh21 	ei_write16(sc_ie, addr, value & 0xffff);
    373  1.1  bjh21 	ei_write16(sc_ie, addr + 2, (value >> 16) & 0xff);
    374  1.1  bjh21 	splx(s);
    375  1.1  bjh21 }
    376  1.1  bjh21 
    377