/* $NetBSD: if_sn_obio.c,v 1.29 2021/02/20 09:36:30 rin Exp $ */
/*
* Copyright (C) 1997 Allen Briggs
* 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. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Allen Briggs
* 4. 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.
*/
switch (current_mac_model->machineid) {
case MACH_MACC610:
case MACH_MACC650:
case MACH_MACQ610:
case MACH_MACQ650:
case MACH_MACQ700:
case MACH_MACQ800:
case MACH_MACQ900:
case MACH_MACQ950:
sc->sc_dcr |= DCR_EXBUS;
sc->sc_32bit = 1;
break;
case MACH_MACLC575:
case MACH_MACP580:
case MACH_MACQ630:
/* Apple Comm Slot cards; assume they are 32 bit */
sc->sc_dcr |= DCR_EXBUS | DCR_USR1 | DCR_USR0;
sc->sc_32bit = 1;
break;
case MACH_MACPB500:
sc->sc_dcr |= DCR_SBUS | DCR_LBR;
sc->sc_32bit = 0; /* 16 bit interface */
break;
static int
sn_obio_getaddr(struct sonic_softc *sc, uint8_t *lladdr)
{
bus_space_handle_t bsh;
if (bus_space_map(sc->sc_st, SONIC_PROM_BASE, PAGE_SIZE, 0, &bsh)) {
aprint_error(": failed to map space to read SONIC address.\n");
aprint_normal("%s:", device_xname(sc->sc_dev));
return -1;
}
/*
* Assume that the SONIC was initialized in MacOS. This should go away
* when we can properly get the MAC address on the PBs.
*/
static int
sn_obio_getaddr_kludge(struct sonic_softc *sc, u_int8_t *lladdr)
{
int i, ors = 0;
/* Shut down NIC */
CSR_WRITE(sc, SONIC_CR, CR_RST);
/* For some reason, Apple fills top first. */
CSR_WRITE(sc, SONIC_CEP, 15);