Home | History | Annotate | Line # | Download | only in podulebus
if_ei.c revision 1.16.10.1
      1  1.16.10.1   cherry /* $NetBSD: if_ei.c,v 1.16.10.1 2011/06/23 14:20:08 cherry 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.16.10.1   cherry __KERNEL_RCSID(0, "$NetBSD: if_ei.c,v 1.16.10.1 2011/06/23 14:20:08 cherry 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.13       ad #include <sys/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.16   cegger static int ei_match(device_t, cfdata_t, void *);
     73       1.16   cegger static void ei_attach(device_t, device_t, 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.16.10.1   cherry CFATTACH_DECL_NEW(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.16   cegger ei_match(device_t parent, cfdata_t 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.16   cegger ei_attach(device_t parent, device_t self, void *aux)
    115        1.1    bjh21 {
    116        1.1    bjh21 	struct podulebus_attach_args *pa = aux;
    117       1.12  thorpej 	struct ei_softc *sc = device_private(self);
    118        1.1    bjh21 	int i;
    119        1.1    bjh21 	char descr[16];
    120        1.1    bjh21 
    121  1.16.10.1   cherry 	sc->sc_ie.sc_dev = self;
    122  1.16.10.1   cherry 
    123        1.1    bjh21 	/* Set up bus spaces */
    124        1.1    bjh21 	sc->sc_ctl_t = sc->sc_mem_t = pa->pa_fast_t;
    125        1.1    bjh21 	bus_space_map(pa->pa_fast_t, pa->pa_fast_base, EI_MEMOFF, 0,
    126        1.1    bjh21 	    &sc->sc_ctl_h);
    127        1.1    bjh21 	bus_space_map(pa->pa_fast_t, pa->pa_fast_base + EI_MEMOFF,
    128        1.1    bjh21 	    EI_PAGESIZE * 2, 0, &sc->sc_mem_h);
    129        1.1    bjh21 	sc->sc_rom_t = pa->pa_sync_t;
    130        1.1    bjh21 	bus_space_map(pa->pa_sync_t, pa->pa_sync_base, EI_ROMSIZE, 0,
    131        1.1    bjh21 	    &sc->sc_rom_h);
    132        1.1    bjh21 
    133        1.1    bjh21 	/* Set up callbacks */
    134        1.1    bjh21 	sc->sc_ie.hwinit = NULL;
    135        1.1    bjh21 	sc->sc_ie.intrhook = ei_intrhook;
    136        1.1    bjh21 	sc->sc_ie.hwreset = ei_hwreset;
    137        1.1    bjh21 	sc->sc_ie.chan_attn = ei_attn;
    138        1.1    bjh21 
    139        1.1    bjh21 	sc->sc_ie.memcopyin = ei_copyin;
    140        1.1    bjh21 	sc->sc_ie.memcopyout = ei_copyout;
    141        1.1    bjh21 
    142        1.1    bjh21 	sc->sc_ie.ie_bus_barrier = NULL;
    143        1.1    bjh21 	sc->sc_ie.ie_bus_read16 = ei_read16;
    144        1.1    bjh21 	sc->sc_ie.ie_bus_write16 = ei_write16;
    145        1.1    bjh21 	sc->sc_ie.ie_bus_write24 = ei_write24;
    146        1.1    bjh21 
    147        1.1    bjh21 	sc->sc_ie.do_xmitnopchain = 0; /* Does it listen? */
    148        1.1    bjh21 
    149        1.1    bjh21 	sc->sc_ie.sc_mediachange = NULL;
    150        1.1    bjh21 	sc->sc_ie.sc_mediastatus = NULL;
    151        1.1    bjh21 
    152        1.1    bjh21 	sc->sc_ie.bt = sc->sc_mem_t; /* XXX hope it doesn't use them */
    153        1.1    bjh21 	sc->sc_ie.bh = sc->sc_mem_h;
    154        1.1    bjh21 
    155        1.1    bjh21 	printf(":");
    156        1.1    bjh21 
    157        1.1    bjh21 	/* All Ether1s are 64k (I believe) */
    158        1.1    bjh21 	sc->sc_ie.sc_msize = EI_MEMSIZE;
    159        1.1    bjh21 
    160        1.1    bjh21 	/* set up pointers to important on-card control structures */
    161        1.1    bjh21 	sc->sc_ie.iscp = 0;
    162        1.1    bjh21 	sc->sc_ie.scb = IE_ISCP_SZ;
    163        1.1    bjh21 	sc->sc_ie.scp = sc->sc_ie.sc_msize + IE_SCP_ADDR - (1 << 24);
    164        1.1    bjh21 
    165        1.1    bjh21 	sc->sc_ie.buf_area = sc->sc_ie.scb + IE_SCB_SZ;
    166        1.1    bjh21 	sc->sc_ie.buf_area_sz =
    167        1.1    bjh21 	    sc->sc_ie.sc_msize - IE_ISCP_SZ - IE_SCB_SZ - IE_SCP_SZ;
    168        1.1    bjh21 
    169        1.1    bjh21 	/* Wipe the whole of the card's memory */
    170        1.1    bjh21 	for (i = 0; i < EI_NPAGES; i++) {
    171        1.1    bjh21 		ei_setpage(sc, i);
    172        1.1    bjh21 		bus_space_set_region_2(sc->sc_mem_t, sc->sc_mem_h,
    173        1.1    bjh21 				       0, 0,EI_PAGESIZE / 2);
    174        1.1    bjh21 	}
    175        1.1    bjh21 
    176        1.1    bjh21 	/* set up pointers to key structures */
    177        1.1    bjh21 	ei_write24(&sc->sc_ie, IE_SCP_ISCP((u_long)sc->sc_ie.scp),
    178        1.1    bjh21 		    (u_long) sc->sc_ie.iscp);
    179        1.1    bjh21 	ei_write16(&sc->sc_ie, IE_ISCP_SCB((u_long)sc->sc_ie.iscp),
    180        1.1    bjh21 		    (u_long) sc->sc_ie.scb);
    181        1.1    bjh21 	ei_write24(&sc->sc_ie, IE_ISCP_BASE((u_long)sc->sc_ie.iscp),
    182        1.1    bjh21 		    (u_long) sc->sc_ie.iscp);
    183        1.1    bjh21 
    184        1.1    bjh21 	/* check if chip answers */
    185        1.1    bjh21 	if (i82586_proberam(&sc->sc_ie) == 0) {
    186        1.1    bjh21 		printf(" memory probe failed\n");
    187        1.1    bjh21 		return;
    188        1.1    bjh21 	}
    189        1.1    bjh21 
    190        1.1    bjh21 	/* Read ROM */
    191        1.1    bjh21 	bus_space_read_region_1(sc->sc_rom_t, sc->sc_rom_h, 0,
    192        1.1    bjh21 				sc->sc_idrom, EI_ROMSIZE);
    193        1.1    bjh21 
    194        1.1    bjh21 	snprintf(descr, 15, "AKA25 iss. %d", sc->sc_idrom[EI_ROM_HWREV]);
    195        1.1    bjh21 	i82586_attach(&sc->sc_ie, descr, sc->sc_idrom + EI_ROM_EADDR,
    196        1.1    bjh21 		      NULL, 0, 0);
    197        1.1    bjh21 
    198        1.1    bjh21 	evcnt_attach_dynamic(&sc->sc_intrcnt, EVCNT_TYPE_INTR, NULL,
    199       1.14   cegger 	    device_xname(self), "intr");
    200        1.1    bjh21 	sc->sc_ih = podulebus_irq_establish(pa->pa_ih, IPL_NET, i82586_intr,
    201        1.1    bjh21 	    self, &sc->sc_intrcnt);
    202        1.1    bjh21 	ei_cli(sc);
    203        1.1    bjh21 }
    204        1.1    bjh21 
    205        1.1    bjh21 static void
    206        1.1    bjh21 ei_hwreset(struct ie_softc *sc_ie, int why)
    207        1.1    bjh21 {
    208        1.1    bjh21 	struct ei_softc *sc = (struct ei_softc *)sc_ie;
    209        1.1    bjh21 
    210        1.4    bjh21 	bus_space_write_1(sc->sc_ctl_t, sc->sc_ctl_h, EI_CONTROL, EI_CTL_RST);
    211        1.1    bjh21 	DELAY(1000);
    212        1.1    bjh21 	bus_space_write_1(sc->sc_ctl_t, sc->sc_ctl_h, EI_CONTROL, 0);
    213        1.1    bjh21 	DELAY(1000);
    214        1.1    bjh21 	ei_cli(sc);
    215        1.1    bjh21 }
    216        1.1    bjh21 
    217        1.1    bjh21 static int
    218        1.1    bjh21 ei_intrhook(struct ie_softc *sc_ie, int why)
    219        1.1    bjh21 {
    220        1.1    bjh21 	struct ei_softc *sc = (struct ei_softc *)sc_ie;
    221        1.1    bjh21 
    222        1.1    bjh21 	switch (why) {
    223        1.1    bjh21 	case INTR_EXIT:
    224        1.1    bjh21 	case INTR_ACK:
    225        1.1    bjh21 		ei_cli(sc);
    226        1.1    bjh21 		break;
    227        1.1    bjh21 	}
    228        1.1    bjh21 	return 0;
    229        1.1    bjh21 }
    230        1.1    bjh21 
    231        1.1    bjh21 static void
    232        1.1    bjh21 ei_attn(struct ie_softc *sc_ie, int why)
    233        1.1    bjh21 {
    234        1.1    bjh21 	struct ei_softc *sc = (void *)sc_ie;
    235        1.1    bjh21 
    236        1.4    bjh21 	bus_space_write_1(sc->sc_ctl_t, sc->sc_ctl_h, EI_CONTROL, EI_CTL_CA);
    237        1.1    bjh21 }
    238        1.1    bjh21 
    239        1.1    bjh21 /*
    240        1.1    bjh21  * Various access functions to allow the MI 82586 driver to get at the
    241        1.1    bjh21  * board's memory.  All memory accesses must go through these, as
    242        1.1    bjh21  * nothing else knows how to manipulate the page register.  Note that
    243        1.1    bjh21  * all addresses and lengths passed in are in bytes of actual data.
    244        1.1    bjh21  * The bus_space functions deal in words, though, so we have to
    245        1.1    bjh21  * convert on the way through.
    246        1.1    bjh21  */
    247        1.1    bjh21 
    248        1.1    bjh21 static void
    249        1.1    bjh21 ei_copyin(struct ie_softc *sc_ie, void *dest, int src, size_t size)
    250        1.1    bjh21 {
    251        1.1    bjh21 	struct ei_softc *sc = (struct ei_softc *)sc_ie;
    252        1.1    bjh21 	int cnt, s, extra_byte;
    253        1.1    bjh21 	u_int16_t *wptr;
    254        1.1    bjh21 
    255        1.1    bjh21 #ifdef DIAGNOSTIC
    256        1.1    bjh21 	if (src % 2 != 0 || !ALIGNED_POINTER(dest, u_int16_t))
    257  1.16.10.1   cherry 		panic("%s: unaligned copyin", device_xname(sc_ie->sc_dev));
    258        1.1    bjh21 #endif
    259        1.1    bjh21 	wptr = dest;
    260        1.1    bjh21 	extra_byte = size % 2;
    261        1.1    bjh21 	size -= extra_byte;
    262        1.1    bjh21 	while (size > 0) {
    263        1.1    bjh21 		cnt = EI_PAGESIZE - src % EI_PAGESIZE;
    264        1.1    bjh21 		if (cnt > size)
    265        1.1    bjh21 			cnt = size;
    266        1.1    bjh21 		s = splnet();
    267        1.1    bjh21 		ei_setpage(sc, ei_atop(src));
    268        1.1    bjh21 		/* bus ops are in words */
    269        1.1    bjh21 		bus_space_read_region_2(sc->sc_mem_t, sc->sc_mem_h,
    270        1.1    bjh21 					ei_atopo(src) / 2, wptr, cnt / 2);
    271        1.1    bjh21 		splx(s);
    272        1.1    bjh21 		src += cnt;
    273        1.1    bjh21 		wptr += cnt / 2;
    274        1.1    bjh21 		size -= cnt;
    275        1.1    bjh21 	}
    276        1.1    bjh21 	if (extra_byte) {
    277        1.1    bjh21 		/* Do we need to be this careful? */
    278        1.1    bjh21 		s = splnet();
    279        1.1    bjh21 		ei_setpage(sc, ei_atop(src));
    280        1.1    bjh21 		*(u_int8_t *)wptr =
    281        1.1    bjh21 		    bus_space_read_2(sc->sc_mem_t, sc->sc_mem_h,
    282        1.1    bjh21 				     ei_atopo(src) / 2) & 0xff;
    283        1.1    bjh21 		splx(s);
    284        1.1    bjh21 	}
    285        1.1    bjh21 }
    286        1.1    bjh21 
    287        1.1    bjh21 static void
    288        1.1    bjh21 ei_copyout(struct ie_softc *sc_ie, const void *src, int dest, size_t size)
    289        1.1    bjh21 {
    290        1.1    bjh21 	struct ei_softc *sc = (struct ei_softc *)sc_ie;
    291        1.1    bjh21 	int cnt, s;
    292        1.1    bjh21 	const u_int16_t *wptr;
    293        1.1    bjh21 	u_int16_t *bounce = NULL;
    294        1.1    bjh21 
    295        1.1    bjh21 #ifdef DIAGNOSTIC
    296        1.1    bjh21 	if (dest % 2 != 0)
    297  1.16.10.1   cherry 		panic("%s: unaligned copyout", device_xname(sc_ie->sc_dev));
    298        1.1    bjh21 #endif
    299        1.1    bjh21 	if (!ALIGNED_POINTER(src, u_int16_t)) {
    300       1.11       he 		bounce = (u_int16_t *) malloc(size, M_DEVBUF, M_NOWAIT);
    301        1.1    bjh21 		if (bounce == NULL)
    302        1.1    bjh21 			panic("%s: no memory to align copyout",
    303  1.16.10.1   cherry 			      device_xname(sc_ie->sc_dev));
    304        1.1    bjh21 		memcpy(bounce, src, size);
    305        1.1    bjh21 		src = bounce;
    306        1.1    bjh21 	}
    307        1.1    bjh21 	wptr = src;
    308        1.1    bjh21 	if (size % 2 != 0)
    309        1.1    bjh21 		size++; /* This is safe, since the buffer is 16bit aligned */
    310        1.1    bjh21 	while (size > 0) {
    311        1.1    bjh21 		cnt = EI_PAGESIZE - dest % EI_PAGESIZE;
    312        1.1    bjh21 		if (cnt > size)
    313        1.1    bjh21 			cnt = size;
    314        1.1    bjh21 		s = splnet();
    315        1.1    bjh21 		ei_setpage(sc, ei_atop(dest));
    316        1.1    bjh21 		/* bus ops are in words */
    317        1.1    bjh21 		bus_space_write_region_2(sc->sc_mem_t, sc->sc_mem_h,
    318        1.1    bjh21 					 ei_atopo(dest) / 2, wptr, cnt / 2);
    319        1.1    bjh21 		splx(s);
    320        1.1    bjh21 		wptr += cnt / 2;
    321        1.1    bjh21 		dest += cnt;
    322        1.1    bjh21 		size -= cnt;
    323        1.1    bjh21 	}
    324        1.1    bjh21 	if (bounce != NULL)
    325       1.11       he 		free(bounce, M_DEVBUF);
    326        1.1    bjh21 }
    327        1.1    bjh21 
    328        1.1    bjh21 static u_int16_t
    329        1.1    bjh21 ei_read16(struct ie_softc *sc_ie, int addr)
    330        1.1    bjh21 {
    331        1.1    bjh21 	struct ei_softc *sc = (struct ei_softc *)sc_ie;
    332        1.1    bjh21 	int result, s;
    333        1.1    bjh21 
    334        1.1    bjh21 #ifdef DIAGNOSTIC
    335        1.1    bjh21 	if (addr % 2 != 0)
    336  1.16.10.1   cherry 		panic("%s: unaligned read16", device_xname(sc_ie->sc_dev));
    337        1.1    bjh21 #endif
    338        1.1    bjh21 	s = splnet();
    339        1.1    bjh21 	ei_setpage(sc, ei_atop(addr));
    340        1.1    bjh21 	result = bus_space_read_2(sc->sc_mem_t, sc->sc_mem_h,
    341        1.1    bjh21 				  ei_atopo(addr) / 2);
    342        1.1    bjh21 	splx(s);
    343        1.1    bjh21 	return result;
    344        1.1    bjh21 }
    345        1.1    bjh21 
    346        1.1    bjh21 static void
    347        1.1    bjh21 ei_write16(struct ie_softc *sc_ie, int addr, u_int16_t value)
    348        1.1    bjh21 {
    349        1.1    bjh21 	struct ei_softc *sc = (struct ei_softc *)sc_ie;
    350        1.1    bjh21 	int s;
    351        1.1    bjh21 
    352        1.1    bjh21 #ifdef DIAGNOSTIC
    353        1.1    bjh21 	if (addr % 2 != 0)
    354  1.16.10.1   cherry 		panic("%s: unaligned write16", device_xname(sc_ie->sc_dev));
    355        1.1    bjh21 #endif
    356        1.1    bjh21 	s = splnet();
    357        1.1    bjh21 	ei_setpage(sc, ei_atop(addr));
    358        1.1    bjh21 	bus_space_write_2(sc->sc_mem_t, sc->sc_mem_h, ei_atopo(addr) / 2,
    359        1.1    bjh21 			  value);
    360        1.1    bjh21 	splx(s);
    361        1.1    bjh21 }
    362        1.1    bjh21 
    363        1.1    bjh21 static void
    364        1.1    bjh21 ei_write24(struct ie_softc *sc_ie, int addr, int value)
    365        1.1    bjh21 {
    366        1.1    bjh21 	int s;
    367        1.1    bjh21 
    368        1.1    bjh21 #ifdef DIAGNOSTIC
    369        1.1    bjh21 	if (addr % 2 != 0)
    370  1.16.10.1   cherry 		panic("%s: unaligned write24", device_xname(sc_ie->sc_dev));
    371        1.1    bjh21 #endif
    372        1.1    bjh21 	s = splnet();
    373        1.1    bjh21 	ei_write16(sc_ie, addr, value & 0xffff);
    374        1.1    bjh21 	ei_write16(sc_ie, addr + 2, (value >> 16) & 0xff);
    375        1.1    bjh21 	splx(s);
    376        1.1    bjh21 }
    377        1.1    bjh21 
    378