/*-
* Copyright (c) 2000, 2001 Ben Harris
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* if_ei.c -- driver for Acorn AKA25 Ether1 card
*/
/*
* This is not directly based on the arm32 ie driver, as that doesn't
* use the MI 82586 driver, and generally looks a mess (not to mention
* having dodgy copyright status). Let's try again.
*/
sc->sc_ie.bt = sc->sc_mem_t; /* XXX hope it doesn't use them */
sc->sc_ie.bh = sc->sc_mem_h;
printf(":");
/* All Ether1s are 64k (I believe) */
sc->sc_ie.sc_msize = EI_MEMSIZE;
/* set up pointers to important on-card control structures */
sc->sc_ie.iscp = 0;
sc->sc_ie.scb = IE_ISCP_SZ;
sc->sc_ie.scp = sc->sc_ie.sc_msize + IE_SCP_ADDR - (1 << 24);
/* Wipe the whole of the card's memory */
for (i = 0; i < EI_NPAGES; i++) {
ei_setpage(sc, i);
bus_space_set_region_2(sc->sc_mem_t, sc->sc_mem_h,
0, 0,EI_PAGESIZE / 2);
}
/* set up pointers to key structures */
ei_write24(&sc->sc_ie, IE_SCP_ISCP((u_long)sc->sc_ie.scp),
(u_long) sc->sc_ie.iscp);
ei_write16(&sc->sc_ie, IE_ISCP_SCB((u_long)sc->sc_ie.iscp),
(u_long) sc->sc_ie.scb);
ei_write24(&sc->sc_ie, IE_ISCP_BASE((u_long)sc->sc_ie.iscp),
(u_long) sc->sc_ie.iscp);
/* check if chip answers */
if (i82586_proberam(&sc->sc_ie) == 0) {
printf(" memory probe failed\n");
return;
}
/* Read ROM */
bus_space_read_region_1(sc->sc_rom_t, sc->sc_rom_h, 0,
sc->sc_idrom, EI_ROMSIZE);
/*
* Various access functions to allow the MI 82586 driver to get at the
* board's memory. All memory accesses must go through these, as
* nothing else knows how to manipulate the page register. Note that
* all addresses and lengths passed in are in bytes of actual data.
* The bus_space functions deal in words, though, so we have to
* convert on the way through.
*/