Move on-board I/O and NuBus drivers to their own directories
via repository copy, and make the necessary adjustments to reflect the moved files.
This commit is contained in:
parent
ea4bc98c9f
commit
9dfbdab6ec
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: files.mac68k,v 1.80 1998/04/24 05:15:25 scottr Exp $
|
||||
# $NetBSD: files.mac68k,v 1.81 1998/05/02 16:45:27 scottr Exp $
|
||||
|
||||
# mac68k-specific configuration info
|
||||
|
||||
|
@ -18,11 +18,11 @@ define obio_norm { [addr = -1], ["no drq" = -1], ["no hsk" = -1] }
|
|||
define obio_scsi5380 { [addr = -1], [drq = -1], [hsk = -1] }
|
||||
device obio: obio_norm, obio_scsi5380
|
||||
attach obio at mainbus
|
||||
file arch/mac68k/dev/obio.c obio
|
||||
file arch/mac68k/obio/obio.c obio
|
||||
|
||||
device nubus { }
|
||||
attach nubus at mainbus
|
||||
file arch/mac68k/dev/nubus.c nubus
|
||||
file arch/mac68k/nubus/nubus.c nubus
|
||||
|
||||
device adb
|
||||
attach adb at obio_norm
|
||||
|
@ -34,18 +34,18 @@ file arch/mac68k/dev/pm_direct.c
|
|||
|
||||
device asc
|
||||
attach asc at obio_norm
|
||||
file arch/mac68k/dev/asc.c asc needs-flag
|
||||
file arch/mac68k/obio/asc.c asc needs-flag
|
||||
|
||||
define grfbus { }
|
||||
file arch/mac68k/dev/grf_subr.c grfbus
|
||||
|
||||
device intvid: grfbus
|
||||
attach intvid at obio_norm
|
||||
file arch/mac68k/dev/grf_iv.c intvid
|
||||
file arch/mac68k/obio/grf_obio.c intvid
|
||||
|
||||
device macvid: grfbus
|
||||
attach macvid at nubus
|
||||
file arch/mac68k/dev/grf_mv.c macvid
|
||||
file arch/mac68k/nubus/grf_nubus.c macvid
|
||||
|
||||
device grf { }
|
||||
attach grf at grfbus
|
||||
|
@ -57,20 +57,20 @@ file arch/mac68k/dev/ite.c ite needs-flag
|
|||
|
||||
device ae: ifnet, ether, arp, dp8390nic
|
||||
attach ae at nubus with ae_nubus
|
||||
file arch/mac68k/dev/if_ae_nubus.c ae_nubus
|
||||
file arch/mac68k/nubus/if_ae_nubus.c ae_nubus
|
||||
file arch/mac68k/dev/if_ae.c ae
|
||||
|
||||
device mc: ifnet, ether, arp
|
||||
attach mc at obio_norm with mc_obio
|
||||
file arch/mac68k/dev/if_mc.c mc
|
||||
file arch/mac68k/dev/if_mc_obio.c mc_obio
|
||||
file arch/mac68k/obio/if_mc_obio.c mc_obio
|
||||
|
||||
device sn: ifnet, ether, arp
|
||||
attach sn at obio_norm with sn_obio
|
||||
attach sn at nubus with sn_nubus
|
||||
file arch/mac68k/dev/if_sn.c sn
|
||||
file arch/mac68k/dev/if_sn_obio.c sn_obio
|
||||
file arch/mac68k/dev/if_sn_nubus.c sn_nubus
|
||||
file arch/mac68k/obio/if_sn_obio.c sn_obio
|
||||
file arch/mac68k/nubus/if_sn_nubus.c sn_nubus
|
||||
|
||||
include "dev/scsipi/files.scsipi"
|
||||
|
||||
|
@ -82,12 +82,12 @@ file arch/mac68k/dev/mac68k5380.c ncrscsi needs-flag
|
|||
# Option 2 for ncr5380 support
|
||||
device sbc: scsi, ncr5380sbc
|
||||
attach sbc at obio_scsi5380 with sbc_obio
|
||||
file arch/mac68k/dev/sbc_obio.c sbc_obio
|
||||
file arch/mac68k/dev/sbc.c sbc
|
||||
file arch/mac68k/obio/sbc_obio.c sbc_obio
|
||||
|
||||
device esp: scsi, ncr53c9x
|
||||
attach esp at obio_norm
|
||||
file arch/mac68k/dev/esp.c esp needs-flag
|
||||
file arch/mac68k/obio/esp.c esp needs-flag
|
||||
|
||||
device zsc { channel = -1 }
|
||||
attach zsc at obio_norm
|
||||
|
|
|
@ -1,350 +0,0 @@
|
|||
/* $NetBSD: asc.c,v 1.26 1998/01/13 19:24:50 scottr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1997 Scott Reynolds
|
||||
* 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.
|
||||
*/
|
||||
/*-
|
||||
* Copyright (C) 1993 Allen K. Briggs, Chris P. Caputo,
|
||||
* Michael L. Finch, Bradley A. Grantham, and
|
||||
* Lawrence A. Kesteloot
|
||||
* 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 the Alice Group.
|
||||
* 4. The names of the Alice Group or any of its members may not be used
|
||||
* to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE ALICE GROUP ``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 ALICE GROUP 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* ASC driver code and console bell support
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/poll.h>
|
||||
|
||||
#include <vm/vm.h>
|
||||
#include <vm/pmap.h>
|
||||
|
||||
#include <machine/autoconf.h>
|
||||
#include <machine/cpu.h>
|
||||
#include <machine/bus.h>
|
||||
|
||||
#include <mac68k/dev/ascvar.h>
|
||||
#include <mac68k/dev/obiovar.h>
|
||||
|
||||
#define MAC68K_ASC_BASE 0x50f14000
|
||||
#define MAC68K_IIFX_ASC_BASE 0x50f10000
|
||||
#define MAC68K_ASC_LEN 0x01000
|
||||
|
||||
static u_int8_t asc_wave_tab[0x800];
|
||||
|
||||
static int asc_ring_bell __P((void *, int, int, int));
|
||||
static void asc_stop_bell __P((void *));
|
||||
|
||||
static int ascmatch __P((struct device *, struct cfdata *, void *));
|
||||
static void ascattach __P((struct device *, struct device *, void *));
|
||||
|
||||
struct cfattach asc_ca = {
|
||||
sizeof(struct asc_softc), ascmatch, ascattach
|
||||
};
|
||||
|
||||
extern struct cfdriver asc_cd;
|
||||
|
||||
static int
|
||||
ascmatch(parent, cf, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *cf;
|
||||
void *aux;
|
||||
{
|
||||
struct obio_attach_args *oa = (struct obio_attach_args *)aux;
|
||||
bus_addr_t addr;
|
||||
bus_space_handle_t bsh;
|
||||
int rval = 0;
|
||||
|
||||
if (oa->oa_addr != (-1))
|
||||
addr = (bus_addr_t)oa->oa_addr;
|
||||
else if (current_mac_model->machineid == MACH_MACIIFX)
|
||||
addr = (bus_addr_t)MAC68K_IIFX_ASC_BASE;
|
||||
else
|
||||
addr = (bus_addr_t)MAC68K_ASC_BASE;
|
||||
|
||||
if (bus_space_map(oa->oa_tag, addr, MAC68K_ASC_LEN, 0, &bsh))
|
||||
return (0);
|
||||
|
||||
if (mac68k_bus_space_probe(oa->oa_tag, bsh, 0, 1))
|
||||
rval = 1;
|
||||
else
|
||||
rval = 0;
|
||||
|
||||
bus_space_unmap(oa->oa_tag, bsh, MAC68K_ASC_LEN);
|
||||
|
||||
return rval;
|
||||
}
|
||||
|
||||
static void
|
||||
ascattach(parent, self, aux)
|
||||
struct device *parent, *self;
|
||||
void *aux;
|
||||
{
|
||||
struct asc_softc *sc = (struct asc_softc *)self;
|
||||
struct obio_attach_args *oa = (struct obio_attach_args *)aux;
|
||||
bus_addr_t addr;
|
||||
int i;
|
||||
|
||||
sc->sc_tag = oa->oa_tag;
|
||||
if (oa->oa_addr != (-1))
|
||||
addr = (bus_addr_t)oa->oa_addr;
|
||||
else if (current_mac_model->machineid == MACH_MACIIFX)
|
||||
addr = (bus_addr_t)MAC68K_IIFX_ASC_BASE;
|
||||
else
|
||||
addr = (bus_addr_t)MAC68K_ASC_BASE;
|
||||
if (bus_space_map(sc->sc_tag, addr, MAC68K_ASC_LEN, 0,
|
||||
&sc->sc_handle)) {
|
||||
printf(": can't map memory space\n");
|
||||
return;
|
||||
}
|
||||
sc->sc_open = 0;
|
||||
sc->sc_ringing = 0;
|
||||
|
||||
for (i = 0; i < 256; i++) { /* up part of wave, four voices? */
|
||||
asc_wave_tab[i] = i / 4;
|
||||
asc_wave_tab[i + 512] = i / 4;
|
||||
asc_wave_tab[i + 1024] = i / 4;
|
||||
asc_wave_tab[i + 1536] = i / 4;
|
||||
}
|
||||
for (i = 0; i < 256; i++) { /* down part of wave, four voices? */
|
||||
asc_wave_tab[i + 256] = 0x3f - (i / 4);
|
||||
asc_wave_tab[i + 768] = 0x3f - (i / 4);
|
||||
asc_wave_tab[i + 1280] = 0x3f - (i / 4);
|
||||
asc_wave_tab[i + 1792] = 0x3f - (i / 4);
|
||||
}
|
||||
|
||||
printf(": Apple Sound Chip");
|
||||
if (oa->oa_addr != (-1))
|
||||
printf(" at %x", oa->oa_addr);
|
||||
printf("\n");
|
||||
|
||||
mac68k_set_bell_callback(asc_ring_bell, sc);
|
||||
}
|
||||
|
||||
int
|
||||
ascopen(dev, flag, mode, p)
|
||||
dev_t dev;
|
||||
int flag;
|
||||
int mode;
|
||||
struct proc *p;
|
||||
{
|
||||
struct asc_softc *sc;
|
||||
int unit;
|
||||
|
||||
unit = ASCUNIT(dev);
|
||||
sc = asc_cd.cd_devs[unit];
|
||||
if (unit >= asc_cd.cd_ndevs)
|
||||
return (ENXIO);
|
||||
if (sc->sc_open)
|
||||
return (EBUSY);
|
||||
sc->sc_open = 1;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
ascclose(dev, flag, mode, p)
|
||||
dev_t dev;
|
||||
int flag;
|
||||
int mode;
|
||||
struct proc *p;
|
||||
{
|
||||
struct asc_softc *sc;
|
||||
|
||||
sc = asc_cd.cd_devs[ASCUNIT(dev)];
|
||||
sc->sc_open = 0;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
ascread(dev, uio, ioflag)
|
||||
dev_t dev;
|
||||
struct uio *uio;
|
||||
int ioflag;
|
||||
{
|
||||
return (ENXIO);
|
||||
}
|
||||
|
||||
int
|
||||
ascwrite(dev, uio, ioflag)
|
||||
dev_t dev;
|
||||
struct uio *uio;
|
||||
int ioflag;
|
||||
{
|
||||
return (ENXIO);
|
||||
}
|
||||
|
||||
int
|
||||
ascioctl(dev, cmd, data, flag, p)
|
||||
dev_t dev;
|
||||
int cmd;
|
||||
caddr_t data;
|
||||
int flag;
|
||||
struct proc *p;
|
||||
{
|
||||
struct asc_softc *sc;
|
||||
int error;
|
||||
int unit = ASCUNIT(dev);
|
||||
|
||||
sc = asc_cd.cd_devs[unit];
|
||||
error = 0;
|
||||
|
||||
switch (cmd) {
|
||||
default:
|
||||
error = EINVAL;
|
||||
break;
|
||||
}
|
||||
return (error);
|
||||
}
|
||||
|
||||
int
|
||||
ascpoll(dev, events, p)
|
||||
dev_t dev;
|
||||
int events;
|
||||
struct proc *p;
|
||||
{
|
||||
return (events & (POLLOUT | POLLWRNORM));
|
||||
}
|
||||
|
||||
int
|
||||
ascmmap(dev, off, prot)
|
||||
dev_t dev;
|
||||
int off;
|
||||
int prot;
|
||||
{
|
||||
int unit = ASCUNIT(dev);
|
||||
struct asc_softc *sc;
|
||||
vm_offset_t pa;
|
||||
|
||||
sc = asc_cd.cd_devs[unit];
|
||||
if (off < MAC68K_ASC_LEN) {
|
||||
pa = pmap_extract(pmap_kernel(), (vm_offset_t)sc->sc_handle);
|
||||
return m68k_btop(pa + off);
|
||||
}
|
||||
|
||||
return (-1);
|
||||
}
|
||||
|
||||
static int
|
||||
asc_ring_bell(arg, freq, length, volume)
|
||||
void *arg;
|
||||
int freq, length, volume;
|
||||
{
|
||||
struct asc_softc *sc = (struct asc_softc *)arg;
|
||||
unsigned long cfreq;
|
||||
int i;
|
||||
|
||||
if (!sc)
|
||||
return (ENODEV);
|
||||
|
||||
if (sc->sc_ringing == 0) {
|
||||
|
||||
bus_space_write_multi_1(sc->sc_tag, sc->sc_handle,
|
||||
0, 0, 0x800);
|
||||
bus_space_write_region_1(sc->sc_tag, sc->sc_handle,
|
||||
0, asc_wave_tab, 0x800);
|
||||
|
||||
/* Fix this. Need to find exact ASC sampling freq */
|
||||
cfreq = 65536 * freq / 466;
|
||||
|
||||
/* printf("beep: from %d, %02x %02x %02x %02x\n",
|
||||
* cur_beep.freq, (cfreq >> 24) & 0xff, (cfreq >> 16) & 0xff,
|
||||
* (cfreq >> 8) & 0xff, (cfreq) & 0xff); */
|
||||
for (i = 0; i < 8; i++) {
|
||||
bus_space_write_1(sc->sc_tag, sc->sc_handle,
|
||||
0x814 + 8 * i, (cfreq >> 24) & 0xff);
|
||||
bus_space_write_1(sc->sc_tag, sc->sc_handle,
|
||||
0x815 + 8 * i, (cfreq >> 16) & 0xff);
|
||||
bus_space_write_1(sc->sc_tag, sc->sc_handle,
|
||||
0x816 + 8 * i, (cfreq >> 8) & 0xff);
|
||||
bus_space_write_1(sc->sc_tag, sc->sc_handle,
|
||||
0x817 + 8 * i, (cfreq) & 0xff);
|
||||
} /* frequency; should put cur_beep.freq in here
|
||||
* somewhere. */
|
||||
|
||||
bus_space_write_1(sc->sc_tag, sc->sc_handle, 0x807, 3); /* 44 ? */
|
||||
bus_space_write_1(sc->sc_tag, sc->sc_handle, 0x806,
|
||||
255 * volume / 100);
|
||||
bus_space_write_1(sc->sc_tag, sc->sc_handle, 0x805, 0);
|
||||
bus_space_write_1(sc->sc_tag, sc->sc_handle, 0x80f, 0);
|
||||
bus_space_write_1(sc->sc_tag, sc->sc_handle, 0x802, 2); /* sampled */
|
||||
bus_space_write_1(sc->sc_tag, sc->sc_handle, 0x801, 2); /* enable sampled */
|
||||
}
|
||||
sc->sc_ringing++;
|
||||
timeout(asc_stop_bell, sc, length);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void
|
||||
asc_stop_bell(arg)
|
||||
void *arg;
|
||||
{
|
||||
struct asc_softc *sc = (struct asc_softc *)arg;
|
||||
|
||||
if (!sc)
|
||||
return;
|
||||
|
||||
if (sc->sc_ringing > 1000 || sc->sc_ringing < 0)
|
||||
panic("bell got out of sync?");
|
||||
|
||||
if (--sc->sc_ringing == 0) /* disable ASC */
|
||||
bus_space_write_1(sc->sc_tag, sc->sc_handle, 0x801, 0);
|
||||
}
|
|
@ -1,45 +0,0 @@
|
|||
/* $NetBSD: ascvar.h,v 1.4 1997/10/10 05:54:57 scottr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1997 Scott Reynolds. 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.
|
||||
*/
|
||||
|
||||
#define ASCUNIT(d) ((d) & 0x7)
|
||||
|
||||
struct asc_softc {
|
||||
struct device sc_dev;
|
||||
bus_space_tag_t sc_tag;
|
||||
bus_space_handle_t sc_handle;
|
||||
int sc_open;
|
||||
int sc_ringing;
|
||||
};
|
||||
|
||||
int ascopen __P((dev_t dev, int flag, int mode, struct proc *p));
|
||||
int ascclose __P((dev_t dev, int flag, int mode, struct proc *p));
|
||||
int ascread __P((dev_t, struct uio *, int));
|
||||
int ascwrite __P((dev_t, struct uio *, int));
|
||||
int ascioctl __P((dev_t, int, caddr_t, int, struct proc *p));
|
||||
int ascpoll __P((dev_t dev, int events, struct proc *p));
|
||||
int ascmmap __P((dev_t dev, int off, int prot));
|
|
@ -1,692 +0,0 @@
|
|||
/* $NetBSD: esp.c,v 1.14 1998/01/12 19:22:02 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Jason R. Thorpe.
|
||||
* 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 for the NetBSD Project
|
||||
* by Jason R. Thorpe.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 Peter Galbavy
|
||||
* Copyright (c) 1995 Paul Kranenburg
|
||||
* 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 Peter Galbavy
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Based on aic6360 by Jarle Greipsland
|
||||
*
|
||||
* Acknowledgements: Many of the algorithms used in this driver are
|
||||
* inspired by the work of Julian Elischer (julian@tfs.com) and
|
||||
* Charles Hannum (mycroft@duality.gnu.ai.mit.edu). Thanks a million!
|
||||
*/
|
||||
|
||||
/*
|
||||
* Initial m68k mac support from Allen Briggs <briggs@macbsd.com>
|
||||
* (basically consisting of the match, a bit of the attach, and the
|
||||
* "DMA" glue functions).
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/buf.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/user.h>
|
||||
#include <sys/queue.h>
|
||||
|
||||
#include <dev/scsipi/scsi_all.h>
|
||||
#include <dev/scsipi/scsipi_all.h>
|
||||
#include <dev/scsipi/scsiconf.h>
|
||||
#include <dev/scsipi/scsi_message.h>
|
||||
|
||||
#include <machine/cpu.h>
|
||||
#include <machine/bus.h>
|
||||
#include <machine/param.h>
|
||||
|
||||
#include <dev/ic/ncr53c9xreg.h>
|
||||
#include <dev/ic/ncr53c9xvar.h>
|
||||
|
||||
#include <machine/viareg.h>
|
||||
|
||||
#include <mac68k/dev/espvar.h>
|
||||
#include <mac68k/dev/obiovar.h>
|
||||
|
||||
void espattach __P((struct device *, struct device *, void *));
|
||||
int espmatch __P((struct device *, struct cfdata *, void *));
|
||||
|
||||
/* Linkup to the rest of the kernel */
|
||||
struct cfattach esp_ca = {
|
||||
sizeof(struct esp_softc), espmatch, espattach
|
||||
};
|
||||
|
||||
struct scsipi_adapter esp_switch = {
|
||||
ncr53c9x_scsi_cmd,
|
||||
minphys, /* no max at this level; handled by DMA code */
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
struct scsipi_device esp_dev = {
|
||||
NULL, /* Use default error handler */
|
||||
NULL, /* have a queue, served by this */
|
||||
NULL, /* have no async handler */
|
||||
NULL, /* Use default 'done' routine */
|
||||
};
|
||||
|
||||
/*
|
||||
* Functions and the switch for the MI code.
|
||||
*/
|
||||
u_char esp_read_reg __P((struct ncr53c9x_softc *, int));
|
||||
void esp_write_reg __P((struct ncr53c9x_softc *, int, u_char));
|
||||
int esp_dma_isintr __P((struct ncr53c9x_softc *));
|
||||
void esp_dma_reset __P((struct ncr53c9x_softc *));
|
||||
int esp_dma_intr __P((struct ncr53c9x_softc *));
|
||||
int esp_dma_setup __P((struct ncr53c9x_softc *, caddr_t *,
|
||||
size_t *, int, size_t *));
|
||||
void esp_dma_go __P((struct ncr53c9x_softc *));
|
||||
void esp_dma_stop __P((struct ncr53c9x_softc *));
|
||||
int esp_dma_isactive __P((struct ncr53c9x_softc *));
|
||||
void esp_quick_write_reg __P((struct ncr53c9x_softc *, int, u_char));
|
||||
int esp_quick_dma_intr __P((struct ncr53c9x_softc *));
|
||||
int esp_quick_dma_setup __P((struct ncr53c9x_softc *, caddr_t *,
|
||||
size_t *, int, size_t *));
|
||||
void esp_quick_dma_go __P((struct ncr53c9x_softc *));
|
||||
|
||||
static __inline__ int esp_dafb_have_dreq __P((struct esp_softc *esc));
|
||||
static __inline__ int esp_iosb_have_dreq __P((struct esp_softc *esc));
|
||||
int (*esp_have_dreq) __P((struct esp_softc *esc));
|
||||
|
||||
struct ncr53c9x_glue esp_glue = {
|
||||
esp_read_reg,
|
||||
esp_write_reg,
|
||||
esp_dma_isintr,
|
||||
esp_dma_reset,
|
||||
esp_dma_intr,
|
||||
esp_dma_setup,
|
||||
esp_dma_go,
|
||||
esp_dma_stop,
|
||||
esp_dma_isactive,
|
||||
NULL, /* gl_clear_latched_intr */
|
||||
};
|
||||
|
||||
int
|
||||
espmatch(parent, cf, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *cf;
|
||||
void *aux;
|
||||
{
|
||||
int found = 0;
|
||||
|
||||
if ((cf->cf_unit == 0) && mac68k_machine.scsi96) {
|
||||
found = 1;
|
||||
}
|
||||
if ((cf->cf_unit == 1) && mac68k_machine.scsi96_2) {
|
||||
found = 1;
|
||||
}
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
/*
|
||||
* Attach this instance, and then all the sub-devices
|
||||
*/
|
||||
void
|
||||
espattach(parent, self, aux)
|
||||
struct device *parent, *self;
|
||||
void *aux;
|
||||
{
|
||||
struct obio_attach_args *oa = (struct obio_attach_args *)aux;
|
||||
extern vm_offset_t SCSIBase;
|
||||
struct esp_softc *esc = (void *)self;
|
||||
struct ncr53c9x_softc *sc = &esc->sc_ncr53c9x;
|
||||
int quick = 0;
|
||||
unsigned long reg_offset;
|
||||
|
||||
reg_offset = SCSIBase - IOBase;
|
||||
esc->sc_tag = oa->oa_tag;
|
||||
/*
|
||||
* For Wombat, Primus and Optimus motherboards, DREQ is
|
||||
* visible on bit 0 of the IOSB's emulated VIA2 vIFR (and
|
||||
* the scsi registers are offset 0x1000 bytes from IOBase).
|
||||
*
|
||||
* For the Q700/900/950 it's at f9800024 for bus 0 and
|
||||
* f9800028 for bus 1 (900/950). For these machines, that is also
|
||||
* a (12-bit) configuration register for DAFB's control of the
|
||||
* pseudo-DMA timing. The default value is 0x1d1.
|
||||
*/
|
||||
esp_have_dreq = esp_dafb_have_dreq;
|
||||
if (sc->sc_dev.dv_unit == 0) {
|
||||
if (reg_offset == 0x10000) {
|
||||
quick = 1;
|
||||
esp_have_dreq = esp_iosb_have_dreq;
|
||||
} else if (reg_offset == 0x18000) {
|
||||
quick = 0;
|
||||
} else {
|
||||
if (bus_space_map(esc->sc_tag, 0xf9800024,
|
||||
4, 0, &esc->sc_bsh)) {
|
||||
printf("failed to map 4 at 0xf9800024.\n");
|
||||
} else {
|
||||
quick = 1;
|
||||
bus_space_write_4(esc->sc_tag,
|
||||
esc->sc_bsh, 0, 0x1d1);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (bus_space_map(esc->sc_tag, 0xf9800028,
|
||||
4, 0, &esc->sc_bsh)) {
|
||||
printf("failed to map 4 at 0xf9800028.\n");
|
||||
} else {
|
||||
quick = 1;
|
||||
bus_space_write_4(esc->sc_tag, esc->sc_bsh, 0, 0x1d1);
|
||||
}
|
||||
}
|
||||
if (quick) {
|
||||
esp_glue.gl_write_reg = esp_quick_write_reg;
|
||||
esp_glue.gl_dma_intr = esp_quick_dma_intr;
|
||||
esp_glue.gl_dma_setup = esp_quick_dma_setup;
|
||||
esp_glue.gl_dma_go = esp_quick_dma_go;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set up the glue for MI code early; we use some of it here.
|
||||
*/
|
||||
sc->sc_glue = &esp_glue;
|
||||
|
||||
/*
|
||||
* Save the regs
|
||||
*/
|
||||
if (sc->sc_dev.dv_unit == 0) {
|
||||
|
||||
esc->sc_reg = (volatile u_char *) SCSIBase;
|
||||
via2_register_irq(VIA2_SCSIIRQ,
|
||||
(void (*)(void *))ncr53c9x_intr, esc);
|
||||
esc->irq_mask = V2IF_SCSIIRQ;
|
||||
if (reg_offset == 0x10000) {
|
||||
sc->sc_freq = 16500000;
|
||||
} else {
|
||||
sc->sc_freq = 25000000;
|
||||
}
|
||||
|
||||
if (esp_glue.gl_dma_go == esp_quick_dma_go) {
|
||||
printf(" (quick)");
|
||||
}
|
||||
} else {
|
||||
esc->sc_reg = (volatile u_char *) SCSIBase + 0x402;
|
||||
via2_register_irq(VIA2_SCSIDRQ,
|
||||
(void (*)(void *))ncr53c9x_intr, esc);
|
||||
esc->irq_mask = V2IF_SCSIDRQ; /* V2IF_T1? */
|
||||
sc->sc_freq = 25000000;
|
||||
|
||||
if (esp_glue.gl_dma_go == esp_quick_dma_go) {
|
||||
printf(" (quick)");
|
||||
}
|
||||
}
|
||||
|
||||
printf(": address %p", esc->sc_reg);
|
||||
|
||||
sc->sc_id = 7;
|
||||
|
||||
/* gimme Mhz */
|
||||
sc->sc_freq /= 1000000;
|
||||
|
||||
/*
|
||||
* It is necessary to try to load the 2nd config register here,
|
||||
* to find out what rev the esp chip is, else the esp_reset
|
||||
* will not set up the defaults correctly.
|
||||
*/
|
||||
sc->sc_cfg1 = sc->sc_id; /* | NCRCFG1_PARENB; */
|
||||
sc->sc_cfg2 = NCRCFG2_SCSI2;
|
||||
sc->sc_cfg3 = 0;
|
||||
sc->sc_rev = NCR_VARIANT_NCR53C96;
|
||||
|
||||
/*
|
||||
* This is the value used to start sync negotiations
|
||||
* Note that the NCR register "SYNCTP" is programmed
|
||||
* in "clocks per byte", and has a minimum value of 4.
|
||||
* The SCSI period used in negotiation is one-fourth
|
||||
* of the time (in nanoseconds) needed to transfer one byte.
|
||||
* Since the chip's clock is given in MHz, we have the following
|
||||
* formula: 4 * period = (1000 / freq) * 4
|
||||
*/
|
||||
sc->sc_minsync = 1000 / sc->sc_freq;
|
||||
|
||||
sc->sc_minsync = 0; /* No synchronous xfers w/o DMA */
|
||||
/* Really no limit, but since we want to fit into the TCR... */
|
||||
sc->sc_maxxfer = 8 * 1024; /*64 * 1024; XXX */
|
||||
|
||||
/*
|
||||
* Now try to attach all the sub-devices
|
||||
*/
|
||||
ncr53c9x_attach(sc, &esp_switch, &esp_dev);
|
||||
|
||||
/*
|
||||
* Configure interrupts.
|
||||
*/
|
||||
via2_reg(vPCR) = 0x22;
|
||||
via2_reg(vIFR) = esc->irq_mask;
|
||||
via2_reg(vIER) = 0x80 | esc->irq_mask;
|
||||
}
|
||||
|
||||
/*
|
||||
* Glue functions.
|
||||
*/
|
||||
|
||||
u_char
|
||||
esp_read_reg(sc, reg)
|
||||
struct ncr53c9x_softc *sc;
|
||||
int reg;
|
||||
{
|
||||
struct esp_softc *esc = (struct esp_softc *)sc;
|
||||
|
||||
return esc->sc_reg[reg * 16];
|
||||
}
|
||||
|
||||
void
|
||||
esp_write_reg(sc, reg, val)
|
||||
struct ncr53c9x_softc *sc;
|
||||
int reg;
|
||||
u_char val;
|
||||
{
|
||||
struct esp_softc *esc = (struct esp_softc *)sc;
|
||||
u_char v = val;
|
||||
|
||||
if (reg == NCR_CMD && v == (NCRCMD_TRANS|NCRCMD_DMA)) {
|
||||
v = NCRCMD_TRANS;
|
||||
}
|
||||
esc->sc_reg[reg * 16] = v;
|
||||
}
|
||||
|
||||
void
|
||||
esp_dma_stop(sc)
|
||||
struct ncr53c9x_softc *sc;
|
||||
{
|
||||
}
|
||||
|
||||
int
|
||||
esp_dma_isactive(sc)
|
||||
struct ncr53c9x_softc *sc;
|
||||
{
|
||||
struct esp_softc *esc = (struct esp_softc *)sc;
|
||||
|
||||
return esc->sc_active;
|
||||
}
|
||||
|
||||
int
|
||||
esp_dma_isintr(sc)
|
||||
struct ncr53c9x_softc *sc;
|
||||
{
|
||||
struct esp_softc *esc = (struct esp_softc *)sc;
|
||||
|
||||
return esc->sc_reg[NCR_STAT * 16] & 0x80;
|
||||
}
|
||||
|
||||
void
|
||||
esp_dma_reset(sc)
|
||||
struct ncr53c9x_softc *sc;
|
||||
{
|
||||
struct esp_softc *esc = (struct esp_softc *)sc;
|
||||
|
||||
esc->sc_active = 0;
|
||||
esc->sc_tc = 0;
|
||||
}
|
||||
|
||||
int
|
||||
esp_dma_intr(sc)
|
||||
struct ncr53c9x_softc *sc;
|
||||
{
|
||||
register struct esp_softc *esc = (struct esp_softc *)sc;
|
||||
register u_char *p;
|
||||
volatile u_char *cmdreg, *intrreg, *statreg, *fiforeg;
|
||||
register u_int espphase, espstat, espintr;
|
||||
register int cnt;
|
||||
|
||||
if (esc->sc_active == 0) {
|
||||
printf("dma_intr--inactive DMA\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((sc->sc_espintr & NCRINTR_BS) == 0) {
|
||||
esc->sc_active = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
cnt = *esc->sc_dmalen;
|
||||
if (*esc->sc_dmalen == 0) {
|
||||
printf("data interrupt, but no count left.");
|
||||
}
|
||||
|
||||
p = *esc->sc_dmaaddr;
|
||||
espphase = sc->sc_phase;
|
||||
espstat = (u_int) sc->sc_espstat;
|
||||
espintr = (u_int) sc->sc_espintr;
|
||||
cmdreg = esc->sc_reg + NCR_CMD * 16;
|
||||
fiforeg = esc->sc_reg + NCR_FIFO * 16;
|
||||
statreg = esc->sc_reg + NCR_STAT * 16;
|
||||
intrreg = esc->sc_reg + NCR_INTR * 16;
|
||||
do {
|
||||
if (esc->sc_datain) {
|
||||
*p++ = *fiforeg;
|
||||
cnt--;
|
||||
if (espphase == DATA_IN_PHASE) {
|
||||
*cmdreg = NCRCMD_TRANS;
|
||||
} else {
|
||||
esc->sc_active = 0;
|
||||
}
|
||||
} else {
|
||||
if ( (espphase == DATA_OUT_PHASE)
|
||||
|| (espphase == MESSAGE_OUT_PHASE)) {
|
||||
*fiforeg = *p++;
|
||||
cnt--;
|
||||
*cmdreg = NCRCMD_TRANS;
|
||||
} else {
|
||||
esc->sc_active = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (esc->sc_active) {
|
||||
while (!(*statreg & 0x80));
|
||||
espstat = *statreg;
|
||||
espintr = *intrreg;
|
||||
espphase = (espintr & NCRINTR_DIS)
|
||||
? /* Disconnected */ BUSFREE_PHASE
|
||||
: espstat & PHASE_MASK;
|
||||
}
|
||||
} while (esc->sc_active && (espintr & NCRINTR_BS));
|
||||
sc->sc_phase = espphase;
|
||||
sc->sc_espstat = (u_char) espstat;
|
||||
sc->sc_espintr = (u_char) espintr;
|
||||
*esc->sc_dmaaddr = p;
|
||||
*esc->sc_dmalen = cnt;
|
||||
|
||||
if (*esc->sc_dmalen == 0) {
|
||||
esc->sc_tc = NCRSTAT_TC;
|
||||
}
|
||||
sc->sc_espstat |= esc->sc_tc;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
esp_dma_setup(sc, addr, len, datain, dmasize)
|
||||
struct ncr53c9x_softc *sc;
|
||||
caddr_t *addr;
|
||||
size_t *len;
|
||||
int datain;
|
||||
size_t *dmasize;
|
||||
{
|
||||
struct esp_softc *esc = (struct esp_softc *)sc;
|
||||
|
||||
esc->sc_dmaaddr = addr;
|
||||
esc->sc_dmalen = len;
|
||||
esc->sc_datain = datain;
|
||||
esc->sc_dmasize = *dmasize;
|
||||
esc->sc_tc = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
esp_dma_go(sc)
|
||||
struct ncr53c9x_softc *sc;
|
||||
{
|
||||
struct esp_softc *esc = (struct esp_softc *)sc;
|
||||
|
||||
if (esc->sc_datain == 0) {
|
||||
esc->sc_reg[NCR_FIFO * 16] = **esc->sc_dmaaddr;
|
||||
(*esc->sc_dmalen)--;
|
||||
(*esc->sc_dmaaddr)++;
|
||||
}
|
||||
esc->sc_active = 1;
|
||||
}
|
||||
|
||||
void
|
||||
esp_quick_write_reg(sc, reg, val)
|
||||
struct ncr53c9x_softc *sc;
|
||||
int reg;
|
||||
u_char val;
|
||||
{
|
||||
struct esp_softc *esc = (struct esp_softc *)sc;
|
||||
u_char v = val;
|
||||
|
||||
esc->sc_reg[reg * 16] = v;
|
||||
}
|
||||
|
||||
int
|
||||
esp_quick_dma_intr(sc)
|
||||
struct ncr53c9x_softc *sc;
|
||||
{
|
||||
struct esp_softc *esc = (struct esp_softc *)sc;
|
||||
int trans=0, resid=0;
|
||||
|
||||
if (esc->sc_active == 0)
|
||||
panic("dma_intr--inactive DMA\n");
|
||||
|
||||
esc->sc_active = 0;
|
||||
|
||||
if (esc->sc_dmasize == 0) {
|
||||
int res;
|
||||
|
||||
res = 65536;
|
||||
res -= NCR_READ_REG(sc, NCR_TCL);
|
||||
res -= NCR_READ_REG(sc, NCR_TCM) << 8;
|
||||
printf("dmaintr: discarded %d b (last transfer was %d b).\n",
|
||||
res, esc->sc_prevdmasize);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (esc->sc_datain &&
|
||||
(resid = (NCR_READ_REG(sc, NCR_FFLAG) & NCRFIFO_FF)) != 0) {
|
||||
printf("dmaintr: empty FIFO of %d\n", resid);
|
||||
DELAY(1);
|
||||
}
|
||||
|
||||
if ((sc->sc_espstat & NCRSTAT_TC) == 0) {
|
||||
resid += NCR_READ_REG(sc, NCR_TCL);
|
||||
resid += NCR_READ_REG(sc, NCR_TCM) << 8;
|
||||
|
||||
if (resid == 0)
|
||||
resid = 65536;
|
||||
}
|
||||
|
||||
trans = esc->sc_dmasize - resid;
|
||||
if (trans < 0) {
|
||||
printf("dmaintr: trans < 0????");
|
||||
trans = esc->sc_dmasize;
|
||||
}
|
||||
|
||||
NCR_DMA(("dmaintr: trans %d, resid %d.\n", trans, resid));
|
||||
*esc->sc_dmaaddr += trans;
|
||||
*esc->sc_dmalen -= trans;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
esp_quick_dma_setup(sc, addr, len, datain, dmasize)
|
||||
struct ncr53c9x_softc *sc;
|
||||
caddr_t *addr;
|
||||
size_t *len;
|
||||
int datain;
|
||||
size_t *dmasize;
|
||||
{
|
||||
struct esp_softc *esc = (struct esp_softc *)sc;
|
||||
|
||||
esc->sc_dmaaddr = addr;
|
||||
esc->sc_dmalen = len;
|
||||
|
||||
esc->sc_pdmaddr = (u_int16_t *) *addr;
|
||||
esc->sc_pdmalen = *len;
|
||||
if (esc->sc_pdmalen & 1) {
|
||||
esc->sc_pdmalen--;
|
||||
esc->sc_pad = 1;
|
||||
} else {
|
||||
esc->sc_pad = 0;
|
||||
}
|
||||
|
||||
esc->sc_datain = datain;
|
||||
esc->sc_prevdmasize = esc->sc_dmasize;
|
||||
esc->sc_dmasize = *dmasize;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
esp_dafb_have_dreq(esc)
|
||||
struct esp_softc *esc;
|
||||
{
|
||||
u_int32_t r;
|
||||
|
||||
r = bus_space_read_4(esc->sc_tag, esc->sc_bsh, 0);
|
||||
return (r & 0x200);
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
esp_iosb_have_dreq(esc)
|
||||
struct esp_softc *esc;
|
||||
{
|
||||
return (via2_reg(vIFR) & V2IF_SCSIDRQ);
|
||||
}
|
||||
|
||||
static int espspl=-1;
|
||||
#define __splx(s) __asm __volatile ("movew %0,sr" : : "di" (s));
|
||||
#define __spl2() __splx(PSL_S|PSL_IPL2)
|
||||
#define __spl4() __splx(PSL_S|PSL_IPL4)
|
||||
|
||||
void
|
||||
esp_quick_dma_go(sc)
|
||||
struct ncr53c9x_softc *sc;
|
||||
{
|
||||
struct esp_softc *esc = (struct esp_softc *)sc;
|
||||
extern int *nofault;
|
||||
label_t faultbuf;
|
||||
u_int16_t volatile *pdma;
|
||||
u_char volatile *statreg;
|
||||
|
||||
esc->sc_active = 1;
|
||||
|
||||
espspl = spl2();
|
||||
|
||||
restart_dmago:
|
||||
nofault = (int *) &faultbuf;
|
||||
if (setjmp((label_t *) nofault)) {
|
||||
int i=0;
|
||||
|
||||
nofault = (int *) 0;
|
||||
statreg = esc->sc_reg + NCR_STAT * 16;
|
||||
for (;;) {
|
||||
if (*statreg & 0x80) {
|
||||
goto gotintr;
|
||||
}
|
||||
|
||||
if (esp_have_dreq(esc)) {
|
||||
break;
|
||||
}
|
||||
|
||||
DELAY(1);
|
||||
if (i++ > 10000)
|
||||
panic("esp_dma_go: Argh!");
|
||||
}
|
||||
goto restart_dmago;
|
||||
}
|
||||
|
||||
statreg = esc->sc_reg + NCR_STAT * 16;
|
||||
pdma = (u_int16_t *) (esc->sc_reg + 0x100);
|
||||
|
||||
#define WAIT while (!esp_have_dreq(esc)) if (*statreg & 0x80) goto gotintr
|
||||
|
||||
if (esc->sc_datain == 0) {
|
||||
while (esc->sc_pdmalen) {
|
||||
WAIT;
|
||||
__spl4(); *pdma = *(esc->sc_pdmaddr)++; __spl2()
|
||||
esc->sc_pdmalen -= 2;
|
||||
}
|
||||
if (esc->sc_pad) {
|
||||
unsigned short us;
|
||||
unsigned char *c;
|
||||
c = (unsigned char *) esc->sc_pdmaddr;
|
||||
us = *c;
|
||||
WAIT;
|
||||
__spl4(); *pdma = us; __spl2()
|
||||
}
|
||||
} else {
|
||||
while (esc->sc_pdmalen) {
|
||||
WAIT;
|
||||
__spl4(); *(esc->sc_pdmaddr)++ = *pdma; __spl2()
|
||||
esc->sc_pdmalen -= 2;
|
||||
}
|
||||
if (esc->sc_pad) {
|
||||
unsigned short us;
|
||||
unsigned char *c;
|
||||
WAIT;
|
||||
__spl4(); us = *pdma; __spl2()
|
||||
c = (unsigned char *) esc->sc_pdmaddr;
|
||||
*c = us & 0xff;
|
||||
}
|
||||
}
|
||||
#undef WAIT
|
||||
|
||||
nofault = (int *) 0;
|
||||
|
||||
if ((*statreg & 0x80) == 0) {
|
||||
if (espspl != -1) splx(espspl); espspl = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
gotintr:
|
||||
ncr53c9x_intr(sc);
|
||||
if (espspl != -1) splx(espspl); espspl = -1;
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
/* $NetBSD: espvar.h,v 1.5 1997/11/25 03:54:56 briggs 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 Peter Galbavy.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
struct esp_softc {
|
||||
struct ncr53c9x_softc sc_ncr53c9x; /* glue to MI code */
|
||||
bus_space_tag_t sc_tag;
|
||||
bus_space_handle_t sc_bsh;
|
||||
|
||||
volatile u_char *sc_reg; /* the registers */
|
||||
|
||||
u_char irq_mask; /* mask for clearing IRQ */
|
||||
|
||||
int sc_active; /* Pseudo-DMA state vars */
|
||||
int sc_datain;
|
||||
size_t sc_dmasize;
|
||||
char **sc_dmaaddr;
|
||||
size_t *sc_dmalen;
|
||||
int sc_tc; /* only used in non-quick */
|
||||
u_int16_t *sc_pdmaddr; /* only used in quick */
|
||||
int sc_pdmalen; /* only used in quick */
|
||||
size_t sc_prevdmasize; /* only used in quick */
|
||||
int sc_pad; /* only used in quick */
|
||||
};
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: grf.c,v 1.51 1998/04/24 05:27:24 scottr Exp $ */
|
||||
/* $NetBSD: grf.c,v 1.52 1998/05/02 16:45:28 scottr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
|
@ -77,7 +77,7 @@
|
|||
#include <uvm/uvm.h>
|
||||
#endif
|
||||
|
||||
#include <mac68k/dev/nubus.h>
|
||||
#include <mac68k/nubus/nubus.h>
|
||||
#include <mac68k/dev/itevar.h>
|
||||
#include <mac68k/dev/grfvar.h>
|
||||
|
||||
|
|
|
@ -1,244 +0,0 @@
|
|||
/* $NetBSD: grf_iv.c,v 1.31 1998/03/22 23:40:52 scottr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 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.
|
||||
*/
|
||||
/*
|
||||
* Graphics display driver for the Macintosh internal video for machines
|
||||
* that don't map it into a fake nubus card.
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
#include <sys/device.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#include <machine/autoconf.h>
|
||||
#include <machine/bus.h>
|
||||
#include <machine/cpu.h>
|
||||
#include <machine/grfioctl.h>
|
||||
#include <machine/viareg.h>
|
||||
|
||||
#include <mac68k/dev/nubus.h>
|
||||
#include <mac68k/dev/obiovar.h>
|
||||
#include <mac68k/dev/grfvar.h>
|
||||
|
||||
extern u_int32_t mac68k_vidlog;
|
||||
extern u_int32_t mac68k_vidphys;
|
||||
extern long videorowbytes;
|
||||
extern long videobitdepth;
|
||||
extern u_long videosize;
|
||||
|
||||
static int grfiv_mode __P((struct grf_softc *gp, int cmd, void *arg));
|
||||
static caddr_t grfiv_phys __P((struct grf_softc *gp));
|
||||
static int grfiv_match __P((struct device *, struct cfdata *, void *));
|
||||
static void grfiv_attach __P((struct device *, struct device *, void *));
|
||||
|
||||
struct cfattach intvid_ca = {
|
||||
sizeof(struct grfbus_softc), grfiv_match, grfiv_attach
|
||||
};
|
||||
|
||||
#define QUADRA_DAFB_BASE 0xF9800000
|
||||
#define CIVIC_CONTROL_BASE 0x50036000
|
||||
#define VALKYRIE_CONTROL_BASE 0x50f2A000
|
||||
|
||||
static int
|
||||
grfiv_match(parent, cf, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *cf;
|
||||
void *aux;
|
||||
{
|
||||
struct obio_attach_args *oa = (struct obio_attach_args *)aux;
|
||||
bus_space_handle_t bsh;
|
||||
int found, sense;
|
||||
u_int base;
|
||||
|
||||
found = 1;
|
||||
|
||||
switch (current_mac_model->class) {
|
||||
case MACH_CLASSQ:
|
||||
/*
|
||||
* Assume DAFB for all of these, unless we can't
|
||||
* access the memory.
|
||||
*/
|
||||
base = QUADRA_DAFB_BASE;
|
||||
|
||||
if (bus_space_map(oa->oa_tag, base, 0x1000, 0, &bsh)) {
|
||||
panic("failed to map space for DAFB regs.\n");
|
||||
}
|
||||
|
||||
if (mac68k_bus_space_probe(oa->oa_tag, bsh, 0x1C, 4) == 0) {
|
||||
bus_space_unmap(oa->oa_tag, bsh, 0x1000);
|
||||
found = 0;
|
||||
goto nodafb;
|
||||
}
|
||||
|
||||
sense = (bus_space_read_4(oa->oa_tag, bsh, 0x1C) & 7);
|
||||
|
||||
#if 0 /* XXX - fails on Quadras with certain 17" monitors */
|
||||
if (sense == 0)
|
||||
found = 0;
|
||||
#endif
|
||||
|
||||
/* Set "Turbo SCSI" configuration to default */
|
||||
bus_space_write_4(oa->oa_tag, bsh, 0x24, 0x1d1); /* ch0 */
|
||||
bus_space_write_4(oa->oa_tag, bsh, 0x28, 0x1d1); /* ch1 */
|
||||
|
||||
/* Disable interrupts */
|
||||
bus_space_write_4(oa->oa_tag, bsh, 0x104, 0);
|
||||
|
||||
/* Clear any interrupts */
|
||||
bus_space_write_4(oa->oa_tag, bsh, 0x10C, 0);
|
||||
bus_space_write_4(oa->oa_tag, bsh, 0x110, 0);
|
||||
bus_space_write_4(oa->oa_tag, bsh, 0x114, 0);
|
||||
|
||||
bus_space_unmap(oa->oa_tag, bsh, 0x1000);
|
||||
break;
|
||||
|
||||
case MACH_CLASSAV:
|
||||
base = CIVIC_CONTROL_BASE;
|
||||
|
||||
if (bus_space_map(oa->oa_tag, base, 0x1000, 0, &bsh)) {
|
||||
panic("failed to map space for CIVIC control regs.\n");
|
||||
}
|
||||
|
||||
/* Disable interrupts */
|
||||
bus_space_write_1(oa->oa_tag, bsh, 0x120, 0);
|
||||
|
||||
bus_space_unmap(oa->oa_tag, bsh, 0x1000);
|
||||
break;
|
||||
|
||||
case MACH_CLASSQ2:
|
||||
if (current_mac_model->machineid == MACH_MACQ630) {
|
||||
base = VALKYRIE_CONTROL_BASE;
|
||||
|
||||
if (bus_space_map(oa->oa_tag, base, 0x40, 0, &bsh)) {
|
||||
panic("failed to map space for Valkyrie regs.\n");
|
||||
}
|
||||
|
||||
/* Disable interrupts */
|
||||
bus_space_write_1(oa->oa_tag, bsh, 0x18, 0x1);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
nodafb:
|
||||
if (mac68k_vidlog == 0) {
|
||||
found = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
#define R4(sc, o) (bus_space_read_4((sc)->sc_tag, (sc)->sc_regh, o) & 0xfff)
|
||||
|
||||
static void
|
||||
grfiv_attach(parent, self, aux)
|
||||
struct device *parent, *self;
|
||||
void *aux;
|
||||
{
|
||||
struct obio_attach_args *oa = (struct obio_attach_args *)aux;
|
||||
struct grfbus_softc *sc;
|
||||
struct grfmode *gm;
|
||||
u_int base;
|
||||
|
||||
sc = (struct grfbus_softc *)self;
|
||||
|
||||
sc->card_id = 0;
|
||||
|
||||
switch (current_mac_model->class) {
|
||||
case MACH_CLASSQ:
|
||||
base = QUADRA_DAFB_BASE;
|
||||
sc->sc_tag = oa->oa_tag;
|
||||
if (bus_space_map(sc->sc_tag, base, 0x1000, 0, &sc->sc_regh)) {
|
||||
panic("failed to map space for DAFB regs.\n");
|
||||
}
|
||||
printf(": DAFB: Monitor sense %x.\n", R4(sc,0x1C)&7);
|
||||
bus_space_unmap(sc->sc_tag, sc->sc_regh, 0x1000);
|
||||
break;
|
||||
case MACH_CLASSQ2:
|
||||
case MACH_CLASSAV:
|
||||
default:
|
||||
printf(": Internal Video\n");
|
||||
break;
|
||||
}
|
||||
|
||||
gm = &(sc->curr_mode);
|
||||
gm->mode_id = 0;
|
||||
gm->psize = videobitdepth;
|
||||
gm->ptype = 0;
|
||||
gm->width = videosize & 0xffff;
|
||||
gm->height = (videosize >> 16) & 0xffff;
|
||||
gm->rowbytes = videorowbytes;
|
||||
gm->hres = 80; /* XXX Hack */
|
||||
gm->vres = 80; /* XXX Hack */
|
||||
gm->fbsize = gm->rowbytes * gm->height;
|
||||
gm->fbbase = (caddr_t)m68k_trunc_page(mac68k_vidlog);
|
||||
gm->fboff = mac68k_vidlog & PGOFSET;
|
||||
|
||||
/* Perform common video attachment. */
|
||||
grf_establish(sc, NULL, grfiv_mode, grfiv_phys);
|
||||
}
|
||||
|
||||
static int
|
||||
grfiv_mode(sc, cmd, arg)
|
||||
struct grf_softc *sc;
|
||||
int cmd;
|
||||
void *arg;
|
||||
{
|
||||
switch (cmd) {
|
||||
case GM_GRFON:
|
||||
case GM_GRFOFF:
|
||||
return 0;
|
||||
case GM_CURRMODE:
|
||||
break;
|
||||
case GM_NEWMODE:
|
||||
break;
|
||||
case GM_LISTMODES:
|
||||
break;
|
||||
}
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
static caddr_t
|
||||
grfiv_phys(gp)
|
||||
struct grf_softc *gp;
|
||||
{
|
||||
/*
|
||||
* If we're using IIsi or similar, this will be 0.
|
||||
* If we're using IIvx or similar, this will be correct.
|
||||
*/
|
||||
return (caddr_t)mac68k_vidphys;
|
||||
}
|
|
@ -1,656 +0,0 @@
|
|||
/* $NetBSD: grf_mv.c,v 1.42 1998/04/26 16:47:39 briggs Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 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.
|
||||
*/
|
||||
/*
|
||||
* Device-specific routines for handling Nubus-based video cards.
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
#include <sys/device.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/cpu.h>
|
||||
#include <machine/grfioctl.h>
|
||||
#include <machine/viareg.h>
|
||||
|
||||
#include <mac68k/dev/nubus.h>
|
||||
#include <mac68k/dev/grfvar.h>
|
||||
|
||||
static void load_image_data __P((caddr_t data, struct image_data *image));
|
||||
|
||||
static void grfmv_intr_generic_write1 __P((void *vsc));
|
||||
static void grfmv_intr_generic_write4 __P((void *vsc));
|
||||
static void grfmv_intr_generic_or4 __P((void *vsc));
|
||||
|
||||
static void grfmv_intr_cb264 __P((void *vsc));
|
||||
static void grfmv_intr_cb364 __P((void *vsc));
|
||||
static void grfmv_intr_cmax __P((void *vsc));
|
||||
static void grfmv_intr_cti __P((void *vsc));
|
||||
static void grfmv_intr_radius __P((void *vsc));
|
||||
static void grfmv_intr_radius24 __P((void *vsc));
|
||||
static void grfmv_intr_supermacgfx __P((void *vsc));
|
||||
static void grfmv_intr_lapis __P((void *vsc));
|
||||
static void grfmv_intr_formac __P((void *vsc));
|
||||
|
||||
static int grfmv_mode __P((struct grf_softc *gp, int cmd, void *arg));
|
||||
static caddr_t grfmv_phys __P((struct grf_softc *gp));
|
||||
static int grfmv_match __P((struct device *, struct cfdata *, void *));
|
||||
static void grfmv_attach __P((struct device *, struct device *, void *));
|
||||
|
||||
struct cfattach macvid_ca = {
|
||||
sizeof(struct grfbus_softc), grfmv_match, grfmv_attach
|
||||
};
|
||||
|
||||
static void
|
||||
load_image_data(data, image)
|
||||
caddr_t data;
|
||||
struct image_data *image;
|
||||
{
|
||||
bcopy(data , &image->size, 4);
|
||||
bcopy(data + 4, &image->offset, 4);
|
||||
bcopy(data + 8, &image->rowbytes, 2);
|
||||
bcopy(data + 10, &image->top, 2);
|
||||
bcopy(data + 12, &image->left, 2);
|
||||
bcopy(data + 14, &image->bottom, 2);
|
||||
bcopy(data + 16, &image->right, 2);
|
||||
bcopy(data + 18, &image->version, 2);
|
||||
bcopy(data + 20, &image->packType, 2);
|
||||
bcopy(data + 22, &image->packSize, 4);
|
||||
bcopy(data + 26, &image->hRes, 4);
|
||||
bcopy(data + 30, &image->vRes, 4);
|
||||
bcopy(data + 34, &image->pixelType, 2);
|
||||
bcopy(data + 36, &image->pixelSize, 2);
|
||||
bcopy(data + 38, &image->cmpCount, 2);
|
||||
bcopy(data + 40, &image->cmpSize, 2);
|
||||
bcopy(data + 42, &image->planeBytes, 4);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
grfmv_match(parent, cf, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *cf;
|
||||
void *aux;
|
||||
{
|
||||
struct nubus_attach_args *na = (struct nubus_attach_args *)aux;
|
||||
|
||||
if (na->category != NUBUS_CATEGORY_DISPLAY)
|
||||
return 0;
|
||||
|
||||
if (na->type != NUBUS_TYPE_VIDEO)
|
||||
return 0;
|
||||
|
||||
if (na->drsw != NUBUS_DRSW_APPLE)
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* If we've gotten this far, then we're dealing with a real-live
|
||||
* Apple QuickDraw-compatible display card resource. Now, how to
|
||||
* determine that this is an active resource??? Dunno. But we'll
|
||||
* proceed like it is.
|
||||
*/
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
grfmv_attach(parent, self, aux)
|
||||
struct device *parent, *self;
|
||||
void *aux;
|
||||
{
|
||||
struct grfbus_softc *sc = (struct grfbus_softc *)self;
|
||||
struct nubus_attach_args *na = (struct nubus_attach_args *)aux;
|
||||
struct image_data image_store, image;
|
||||
struct grfmode *gm;
|
||||
char cardname[CARD_NAME_LEN];
|
||||
nubus_dirent dirent;
|
||||
nubus_dir dir, mode_dir;
|
||||
int mode;
|
||||
|
||||
sc->sc_tag = na->na_tag;
|
||||
sc->card_id = na->drhw;
|
||||
|
||||
bcopy(na->fmt, &sc->sc_slot, sizeof(nubus_slot));
|
||||
|
||||
if (bus_space_map(sc->sc_tag,
|
||||
NUBUS_SLOT2PA(na->slot), NBMEMSIZE, 0, &sc->sc_handle)) {
|
||||
printf(": grfmv_attach: failed to map slot %d\n", na->slot);
|
||||
return;
|
||||
}
|
||||
|
||||
nubus_get_main_dir(&sc->sc_slot, &dir);
|
||||
|
||||
if (nubus_find_rsrc(sc->sc_tag, sc->sc_handle,
|
||||
&sc->sc_slot, &dir, na->rsrcid, &dirent) <= 0) {
|
||||
bad:
|
||||
bus_space_unmap(sc->sc_tag, sc->sc_handle, NBMEMSIZE);
|
||||
return;
|
||||
}
|
||||
|
||||
nubus_get_dir_from_rsrc(&sc->sc_slot, &dirent, &sc->board_dir);
|
||||
|
||||
if (nubus_find_rsrc(sc->sc_tag, sc->sc_handle,
|
||||
&sc->sc_slot, &sc->board_dir, NUBUS_RSRC_TYPE, &dirent) <= 0)
|
||||
if ((na->rsrcid != 128) ||
|
||||
(nubus_find_rsrc(sc->sc_tag, sc->sc_handle,
|
||||
&sc->sc_slot, &dir, 129, &dirent) <= 0))
|
||||
goto bad;
|
||||
|
||||
mode = NUBUS_RSRC_FIRSTMODE;
|
||||
if (nubus_find_rsrc(sc->sc_tag, sc->sc_handle,
|
||||
&sc->sc_slot, &sc->board_dir, mode, &dirent) <= 0) {
|
||||
printf(": probe failed to get board rsrc.\n");
|
||||
goto bad;
|
||||
}
|
||||
|
||||
nubus_get_dir_from_rsrc(&sc->sc_slot, &dirent, &mode_dir);
|
||||
|
||||
if (nubus_find_rsrc(sc->sc_tag, sc->sc_handle,
|
||||
&sc->sc_slot, &mode_dir, VID_PARAMS, &dirent) <= 0) {
|
||||
printf(": probe failed to get mode dir.\n");
|
||||
goto bad;
|
||||
}
|
||||
|
||||
if (nubus_get_ind_data(sc->sc_tag, sc->sc_handle, &sc->sc_slot,
|
||||
&dirent, (caddr_t)&image_store, sizeof(struct image_data)) <= 0) {
|
||||
printf(": probe failed to get indirect mode data.\n");
|
||||
goto bad;
|
||||
}
|
||||
|
||||
/* Need to load display info (and driver?), etc... (?) */
|
||||
|
||||
load_image_data((caddr_t)&image_store, &image);
|
||||
|
||||
gm = &sc->curr_mode;
|
||||
gm->mode_id = mode;
|
||||
gm->fbbase = (caddr_t)sc->sc_handle; /* XXX evil! */
|
||||
gm->fboff = image.offset;
|
||||
gm->rowbytes = image.rowbytes;
|
||||
gm->width = image.right - image.left;
|
||||
gm->height = image.bottom - image.top;
|
||||
gm->fbsize = gm->height * gm->rowbytes;
|
||||
gm->hres = image.hRes;
|
||||
gm->vres = image.vRes;
|
||||
gm->ptype = image.pixelType;
|
||||
gm->psize = image.pixelSize;
|
||||
|
||||
strncpy(cardname, nubus_get_card_name(sc->sc_tag, sc->sc_handle,
|
||||
&sc->sc_slot), CARD_NAME_LEN);
|
||||
cardname[CARD_NAME_LEN-1] = '\0';
|
||||
printf(": %s\n", cardname);
|
||||
|
||||
if (sc->card_id == NUBUS_DRHW_TFB) {
|
||||
/*
|
||||
* This is the Toby card, but apparently some manufacturers
|
||||
* (like Cornerstone) didn't bother to get/use their own
|
||||
* value here, even though the cards are different, so we
|
||||
* so we try to differentiate here.
|
||||
*/
|
||||
if (strncmp(cardname, "Samsung 768", 11) == 0)
|
||||
sc->card_id = NUBUS_DRHW_SAM768;
|
||||
else if (strncmp(cardname, "Toby frame", 10) != 0)
|
||||
printf("%s: This display card pretends to be a TFB!\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
}
|
||||
|
||||
switch (sc->card_id) {
|
||||
case NUBUS_DRHW_TFB:
|
||||
case NUBUS_DRHW_M2HRVC:
|
||||
case NUBUS_DRHW_PVC:
|
||||
sc->cli_offset = 0xa0000;
|
||||
sc->cli_value = 0;
|
||||
add_nubus_intr(na->slot, grfmv_intr_generic_write1, sc);
|
||||
break;
|
||||
case NUBUS_DRHW_WVC:
|
||||
sc->cli_offset = 0xa00000;
|
||||
sc->cli_value = 0;
|
||||
add_nubus_intr(na->slot, grfmv_intr_generic_write1, sc);
|
||||
break;
|
||||
case NUBUS_DRHW_COLORMAX:
|
||||
add_nubus_intr(na->slot, grfmv_intr_cmax, sc);
|
||||
break;
|
||||
case NUBUS_DRHW_SE30:
|
||||
/* Do nothing--SE/30 interrupts are disabled */
|
||||
break;
|
||||
case NUBUS_DRHW_MDC:
|
||||
sc->cli_offset = 0x200148;
|
||||
sc->cli_value = 1;
|
||||
add_nubus_intr(na->slot, grfmv_intr_generic_write4, sc);
|
||||
|
||||
/* Enable interrupts; to disable, write 0x7 to this location */
|
||||
bus_space_write_4(sc->sc_tag, sc->sc_handle, 0x20013C, 5);
|
||||
break;
|
||||
case NUBUS_DRHW_CB264:
|
||||
add_nubus_intr(na->slot, grfmv_intr_cb264, sc);
|
||||
break;
|
||||
case NUBUS_DRHW_CB364:
|
||||
add_nubus_intr(na->slot, grfmv_intr_cb364, sc);
|
||||
break;
|
||||
case NUBUS_DRHW_RPC8:
|
||||
sc->cli_offset = 0xfdff8f;
|
||||
sc->cli_value = 0xff;
|
||||
add_nubus_intr(na->slot, grfmv_intr_generic_write1, sc);
|
||||
break;
|
||||
case NUBUS_DRHW_RPC8XJ:
|
||||
add_nubus_intr(na->slot, grfmv_intr_radius, sc);
|
||||
break;
|
||||
case NUBUS_DRHW_RPC24XP:
|
||||
add_nubus_intr(na->slot, grfmv_intr_radius24, sc);
|
||||
break;
|
||||
case NUBUS_DRHW_FIILX:
|
||||
case NUBUS_DRHW_FIISXDSP:
|
||||
case NUBUS_DRHW_FUTURASX:
|
||||
sc->cli_offset = 0xf05000;
|
||||
sc->cli_value = 0x80;
|
||||
add_nubus_intr(na->slot, grfmv_intr_generic_write1, sc);
|
||||
break;
|
||||
case NUBUS_DRHW_SAM768:
|
||||
add_nubus_intr(na->slot, grfmv_intr_cti, sc);
|
||||
break;
|
||||
case NUBUS_DRHW_SUPRGFX:
|
||||
add_nubus_intr(na->slot, grfmv_intr_supermacgfx, sc);
|
||||
break;
|
||||
case NUBUS_DRHW_SPECTRM8:
|
||||
sc->cli_offset = 0x0de178;
|
||||
sc->cli_value = 0x80;
|
||||
add_nubus_intr(na->slot, grfmv_intr_generic_or4, sc);
|
||||
break;
|
||||
case NUBUS_DRHW_LAPIS:
|
||||
add_nubus_intr(na->slot, grfmv_intr_lapis, sc);
|
||||
break;
|
||||
case NUBUS_DRHW_FORMAC:
|
||||
add_nubus_intr(na->slot, grfmv_intr_formac, sc);
|
||||
break;
|
||||
case NUBUS_DRHW_ROPS24LXI:
|
||||
sc->cli_offset = 0xfb0010;
|
||||
sc->cli_value = 0x00;
|
||||
add_nubus_intr(na->slot, grfmv_intr_generic_write4, sc);
|
||||
break;
|
||||
case NUBUS_DRHW_MICRON:
|
||||
/* What do we know about this one? */
|
||||
default:
|
||||
printf("%s: Unknown video card ID 0x%x --",
|
||||
sc->sc_dev.dv_xname, sc->card_id);
|
||||
printf(" Not installing interrupt routine.\n");
|
||||
break;
|
||||
}
|
||||
|
||||
/* Perform common video attachment. */
|
||||
grf_establish(sc, &sc->sc_slot, grfmv_mode, grfmv_phys);
|
||||
}
|
||||
|
||||
static int
|
||||
grfmv_mode(gp, cmd, arg)
|
||||
struct grf_softc *gp;
|
||||
int cmd;
|
||||
void *arg;
|
||||
{
|
||||
switch (cmd) {
|
||||
case GM_GRFON:
|
||||
case GM_GRFOFF:
|
||||
return 0;
|
||||
case GM_CURRMODE:
|
||||
break;
|
||||
case GM_NEWMODE:
|
||||
break;
|
||||
case GM_LISTMODES:
|
||||
break;
|
||||
}
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
static caddr_t
|
||||
grfmv_phys(gp)
|
||||
struct grf_softc *gp;
|
||||
{
|
||||
return (caddr_t)NUBUS_SLOT2PA(gp->sc_slot->slot);
|
||||
}
|
||||
|
||||
/* Interrupt handlers... */
|
||||
/*
|
||||
* Generic routine to clear interrupts for cards where it simply takes
|
||||
* a MOV.B to clear the interrupt. The offset and value of this byte
|
||||
* varies between cards.
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
static void
|
||||
grfmv_intr_generic_write1(vsc)
|
||||
void *vsc;
|
||||
{
|
||||
struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
|
||||
|
||||
bus_space_write_1(sc->sc_tag, sc->sc_handle,
|
||||
sc->cli_offset, (u_int8_t)sc->cli_value);
|
||||
}
|
||||
|
||||
/*
|
||||
* Generic routine to clear interrupts for cards where it simply takes
|
||||
* a MOV.L to clear the interrupt. The offset and value of this byte
|
||||
* varies between cards.
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
static void
|
||||
grfmv_intr_generic_write4(vsc)
|
||||
void *vsc;
|
||||
{
|
||||
struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
|
||||
|
||||
bus_space_write_4(sc->sc_tag, sc->sc_handle,
|
||||
sc->cli_offset, sc->cli_value);
|
||||
}
|
||||
|
||||
/*
|
||||
* Generic routine to clear interrupts for cards where it simply takes
|
||||
* an OR.L to clear the interrupt. The offset and value of this byte
|
||||
* varies between cards.
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
static void
|
||||
grfmv_intr_generic_or4(vsc)
|
||||
void *vsc;
|
||||
{
|
||||
struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
|
||||
unsigned long scratch;
|
||||
|
||||
scratch = bus_space_read_4(sc->sc_tag, sc->sc_handle, sc->cli_offset);
|
||||
scratch |= 0x80;
|
||||
bus_space_write_4(sc->sc_tag, sc->sc_handle, sc->cli_offset, scratch);
|
||||
}
|
||||
|
||||
/*
|
||||
* Routine to clear interrupts for the Radius PrecisionColor 8xj card.
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
static void
|
||||
grfmv_intr_radius(vsc)
|
||||
void *vsc;
|
||||
{
|
||||
struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
|
||||
u_int8_t c;
|
||||
|
||||
/*
|
||||
* The value 0x66 was the observed value on one card. It is read
|
||||
* from the driver's information block, so this may not be sufficient.
|
||||
* Then again, we're not setting up any other interrupts...
|
||||
*/
|
||||
c = 0x66;
|
||||
|
||||
c |= 0x80;
|
||||
bus_space_write_1(sc->sc_tag, sc->sc_handle, 0xd00403, c);
|
||||
c &= 0x7f;
|
||||
bus_space_write_1(sc->sc_tag, sc->sc_handle, 0xd00403, c);
|
||||
}
|
||||
|
||||
/*
|
||||
* Routine to clear interrupts for the Radius PrecisionColor 24Xp card.
|
||||
* Is this what the 8xj routine is doing, too?
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
static void
|
||||
grfmv_intr_radius24(vsc)
|
||||
void *vsc;
|
||||
{
|
||||
struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
|
||||
u_int8_t c;
|
||||
|
||||
c = 0x80 | bus_space_read_1(sc->sc_tag, sc->sc_handle, 0xfffd8);
|
||||
bus_space_write_1(sc->sc_tag, sc->sc_handle, 0xd00403, c);
|
||||
c &= 0x7f;
|
||||
bus_space_write_1(sc->sc_tag, sc->sc_handle, 0xd00403, c);
|
||||
}
|
||||
|
||||
/*
|
||||
* Routine to clear interrupts on Samsung 768x1006 video controller.
|
||||
* This controller was manufactured by Cornerstone Technology, Inc.,
|
||||
* now known as Cornerstone Imaging.
|
||||
*
|
||||
* To clear this interrupt, we apparently have to set, then clear,
|
||||
* bit 2 at byte offset 0x80000 from the card's base.
|
||||
* Information for this provided by Brad Salai <bsalai@servtech.com>
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
static void
|
||||
grfmv_intr_cti(vsc)
|
||||
void *vsc;
|
||||
{
|
||||
struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
|
||||
u_int8_t c;
|
||||
|
||||
c = bus_space_read_1(sc->sc_tag, sc->sc_handle, 0x80000);
|
||||
c |= 0x02;
|
||||
bus_space_write_1(sc->sc_tag, sc->sc_handle, 0x80000, c);
|
||||
c &= 0xfd;
|
||||
bus_space_write_1(sc->sc_tag, sc->sc_handle, 0x80000, c);
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
static void
|
||||
grfmv_intr_cb264(vsc)
|
||||
void *vsc;
|
||||
{
|
||||
struct grfbus_softc *sc;
|
||||
volatile char *slotbase;
|
||||
|
||||
sc = (struct grfbus_softc *)vsc;
|
||||
slotbase = (volatile char *)sc->sc_handle; /* XXX evil hack */
|
||||
asm volatile(" movl %0,a0
|
||||
movl a0@(0xff6028),d0
|
||||
andl #0x2,d0
|
||||
beq _mv_intr0
|
||||
movql #0x3,d0
|
||||
_mv_intr0:
|
||||
movl a0@(0xff600c),d1
|
||||
andl #0x3,d1
|
||||
cmpl d1,d0
|
||||
beq _mv_intr_fin
|
||||
movl d0,a0@(0xff600c)
|
||||
nop
|
||||
tstb d0
|
||||
beq _mv_intr1
|
||||
movl #0x0002,a0@(0xff6040)
|
||||
movl #0x0102,a0@(0xff6044)
|
||||
movl #0x0105,a0@(0xff6048)
|
||||
movl #0x000e,a0@(0xff604c)
|
||||
movl #0x001c,a0@(0xff6050)
|
||||
movl #0x00bc,a0@(0xff6054)
|
||||
movl #0x00c3,a0@(0xff6058)
|
||||
movl #0x0061,a0@(0xff605c)
|
||||
movl #0x0012,a0@(0xff6060)
|
||||
bra _mv_intr_fin
|
||||
_mv_intr1:
|
||||
movl #0x0002,a0@(0xff6040)
|
||||
movl #0x0209,a0@(0xff6044)
|
||||
movl #0x020c,a0@(0xff6048)
|
||||
movl #0x000f,a0@(0xff604c)
|
||||
movl #0x0027,a0@(0xff6050)
|
||||
movl #0x00c7,a0@(0xff6054)
|
||||
movl #0x00d7,a0@(0xff6058)
|
||||
movl #0x006b,a0@(0xff605c)
|
||||
movl #0x0029,a0@(0xff6060)
|
||||
_mv_intr_fin:
|
||||
movl #0x1,a0@(0xff6014)"
|
||||
: : "g" (slotbase) : "a0","d0","d1");
|
||||
}
|
||||
|
||||
/*
|
||||
* Support for the Colorboard 364 might be more complex than it needs to
|
||||
* be. If we can find more information about this card, this might be
|
||||
* significantly simplified. Contributions welcome... :-)
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
static void
|
||||
grfmv_intr_cb364(vsc)
|
||||
void *vsc;
|
||||
{
|
||||
struct grfbus_softc *sc;
|
||||
volatile char *slotbase;
|
||||
|
||||
sc = (struct grfbus_softc *)vsc;
|
||||
slotbase = (volatile char *)sc->sc_handle; /* XXX evil hack */
|
||||
asm volatile(" movl %0,a0
|
||||
movl a0@(0xfe6028),d0
|
||||
andl #0x2,d0
|
||||
beq _cb364_intr4
|
||||
movql #0x3,d0
|
||||
movl a0@(0xfe6018),d1
|
||||
movl #0x3,a0@(0xfe6018)
|
||||
movw a0@(0xfe7010),d2
|
||||
movl d1,a0@(0xfe6018)
|
||||
movl a0@(0xfe6020),d1
|
||||
btst #0x06,d2
|
||||
beq _cb364_intr0
|
||||
btst #0x00,d1
|
||||
beq _cb364_intr5
|
||||
bsr _cb364_intr1
|
||||
bra _cb364_intr_out
|
||||
_cb364_intr0:
|
||||
btst #0x00,d1
|
||||
bne _cb364_intr5
|
||||
bsr _cb364_intr1
|
||||
bra _cb364_intr_out
|
||||
_cb364_intr1:
|
||||
movl d0,a0@(0xfe600c)
|
||||
nop
|
||||
tstb d0
|
||||
beq _cb364_intr3
|
||||
movl #0x0002,a0@(0xfe6040)
|
||||
movl #0x0105,a0@(0xfe6048)
|
||||
movl #0x000e,a0@(0xfe604c)
|
||||
movl #0x00c3,a0@(0xfe6058)
|
||||
movl #0x0061,a0@(0xfe605c)
|
||||
btst #0x06,d2
|
||||
beq _cb364_intr2
|
||||
movl #0x001c,a0@(0xfe6050)
|
||||
movl #0x00bc,a0@(0xfe6054)
|
||||
movl #0x0012,a0@(0xfe6060)
|
||||
movl #0x000e,a0@(0xfe6044)
|
||||
movl #0x00c3,a0@(0xfe6064)
|
||||
movl #0x0061,a0@(0xfe6020)
|
||||
rts
|
||||
_cb364_intr2:
|
||||
movl #0x0016,a0@(0xfe6050)
|
||||
movl #0x00b6,a0@(0xfe6054)
|
||||
movl #0x0011,a0@(0xfe6060)
|
||||
movl #0x0101,a0@(0xfe6044)
|
||||
movl #0x00bf,a0@(0xfe6064)
|
||||
movl #0x0001,a0@(0xfe6020)
|
||||
rts
|
||||
_cb364_intr3:
|
||||
movl #0x0002,a0@(0xfe6040)
|
||||
movl #0x0209,a0@(0xfe6044)
|
||||
movl #0x020c,a0@(0xfe6048)
|
||||
movl #0x000f,a0@(0xfe604c)
|
||||
movl #0x0027,a0@(0xfe6050)
|
||||
movl #0x00c7,a0@(0xfe6054)
|
||||
movl #0x00d7,a0@(0xfe6058)
|
||||
movl #0x006b,a0@(0xfe605c)
|
||||
movl #0x0029,a0@(0xfe6060)
|
||||
oril #0x0040,a0@(0xfe6064)
|
||||
movl #0x0000,a0@(0xfe6020)
|
||||
rts
|
||||
_cb364_intr4:
|
||||
movq #0x00,d0
|
||||
_cb364_intr5:
|
||||
movl a0@(0xfe600c),d1
|
||||
andl #0x3,d1
|
||||
cmpl d1,d0
|
||||
beq _cb364_intr_out
|
||||
bsr _cb364_intr1
|
||||
_cb364_intr_out:
|
||||
movl #0x1,a0@(0xfe6014)
|
||||
_cb364_intr_quit:
|
||||
" : : "g" (slotbase) : "a0","d0","d1","d2");
|
||||
}
|
||||
|
||||
/*
|
||||
* Interrupt clearing routine for SuperMac GFX card.
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
static void
|
||||
grfmv_intr_supermacgfx(vsc)
|
||||
void *vsc;
|
||||
{
|
||||
struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
|
||||
u_int8_t dummy;
|
||||
|
||||
dummy = bus_space_read_1(sc->sc_tag, sc->sc_handle, 0xE70D3);
|
||||
}
|
||||
|
||||
/*
|
||||
* Routine to clear interrupts for the Sigma Designs ColorMax card.
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
static void
|
||||
grfmv_intr_cmax(vsc)
|
||||
void *vsc;
|
||||
{
|
||||
struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
|
||||
u_int32_t dummy;
|
||||
|
||||
dummy = bus_space_read_4(sc->sc_tag, sc->sc_handle, 0xf501c);
|
||||
dummy = bus_space_read_4(sc->sc_tag, sc->sc_handle, 0xf5018);
|
||||
}
|
||||
|
||||
/*
|
||||
* Routine to clear interrupts for the Lapis ProColorServer 8 PDS card
|
||||
* (for the SE/30).
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
static void
|
||||
grfmv_intr_lapis(vsc)
|
||||
void *vsc;
|
||||
{
|
||||
struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
|
||||
|
||||
bus_space_write_1(sc->sc_tag, sc->sc_handle, 0xff7000, 0x08);
|
||||
bus_space_write_1(sc->sc_tag, sc->sc_handle, 0xff7000, 0x0C);
|
||||
}
|
||||
|
||||
/*
|
||||
* Routine to clear interrupts for the Formac Color Card II
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
static void
|
||||
grfmv_intr_formac(vsc)
|
||||
void *vsc;
|
||||
{
|
||||
struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
|
||||
u_int8_t dummy;
|
||||
|
||||
dummy = bus_space_read_1(sc->sc_tag, sc->sc_handle, 0xde80db);
|
||||
dummy = bus_space_read_1(sc->sc_tag, sc->sc_handle, 0xde80d3);
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: grf_subr.c,v 1.10 1997/10/09 08:46:35 jtc Exp $ */
|
||||
/* $NetBSD: grf_subr.c,v 1.11 1998/05/02 16:45:28 scottr Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996 The NetBSD Foundation, Inc.
|
||||
|
@ -43,7 +43,7 @@
|
|||
#include <machine/bus.h>
|
||||
#include <machine/grfioctl.h>
|
||||
|
||||
#include <mac68k/dev/nubus.h>
|
||||
#include <mac68k/nubus/nubus.h>
|
||||
#include <mac68k/dev/grfvar.h>
|
||||
|
||||
void
|
||||
|
|
|
@ -1,475 +0,0 @@
|
|||
/* $NetBSD: if_ae_nubus.c,v 1.25 1998/04/25 21:27:40 scottr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1997 Scott Reynolds
|
||||
* 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.
|
||||
*/
|
||||
/*
|
||||
* Some parts are derived from code adapted for MacBSD by Brad Parker
|
||||
* <brad@fcr.com>.
|
||||
*
|
||||
* Currently supports:
|
||||
* Apple NB Ethernet Card
|
||||
* Apple NB Ethernet Card II
|
||||
* Interlan A310 NuBus Ethernet card
|
||||
* Cayman Systems GatorCard
|
||||
* Asante MacCon II/E
|
||||
* Kinetics EtherPort SE/30
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/syslog.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/if_media.h>
|
||||
#include <net/if_ether.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/viareg.h>
|
||||
|
||||
#include <dev/ic/dp8390reg.h>
|
||||
#include <dev/ic/dp8390var.h>
|
||||
#include <mac68k/dev/nubus.h>
|
||||
#include <mac68k/dev/if_aevar.h>
|
||||
#include <mac68k/dev/if_aereg.h>
|
||||
|
||||
static int ae_nubus_match __P((struct device *, struct cfdata *, void *));
|
||||
static void ae_nubus_attach __P((struct device *, struct device *, void *));
|
||||
static int ae_nb_card_vendor __P((bus_space_tag_t, bus_space_handle_t,
|
||||
struct nubus_attach_args *));
|
||||
static int ae_nb_get_enaddr __P((bus_space_tag_t, bus_space_handle_t,
|
||||
struct nubus_attach_args *, u_int8_t *));
|
||||
#ifdef DEBUG
|
||||
static void ae_nb_watchdog __P((struct ifnet *));
|
||||
#endif
|
||||
|
||||
void ae_nubus_intr __P((void *));
|
||||
|
||||
struct cfattach ae_nubus_ca = {
|
||||
sizeof(struct dp8390_softc), ae_nubus_match, ae_nubus_attach
|
||||
};
|
||||
|
||||
static int
|
||||
ae_nubus_match(parent, cf, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *cf;
|
||||
void *aux;
|
||||
{
|
||||
struct nubus_attach_args *na = (struct nubus_attach_args *)aux;
|
||||
bus_space_handle_t bsh;
|
||||
int rv;
|
||||
|
||||
if (bus_space_map(na->na_tag, NUBUS_SLOT2PA(na->slot), NBMEMSIZE,
|
||||
0, &bsh))
|
||||
return (0);
|
||||
|
||||
rv = 0;
|
||||
|
||||
if (na->category == NUBUS_CATEGORY_NETWORK &&
|
||||
na->type == NUBUS_TYPE_ETHERNET) {
|
||||
switch (ae_nb_card_vendor(na->na_tag, bsh, na)) {
|
||||
case DP8390_VENDOR_APPLE:
|
||||
case DP8390_VENDOR_ASANTE:
|
||||
case DP8390_VENDOR_FARALLON:
|
||||
case DP8390_VENDOR_INTERLAN:
|
||||
case DP8390_VENDOR_KINETICS:
|
||||
rv = 1;
|
||||
break;
|
||||
case DP8390_VENDOR_DAYNA:
|
||||
case DP8390_VENDOR_FOCUS:
|
||||
rv = UNSUPP;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bus_space_unmap(na->na_tag, bsh, NBMEMSIZE);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
/*
|
||||
* Install interface into kernel networking data structures
|
||||
*/
|
||||
static void
|
||||
ae_nubus_attach(parent, self, aux)
|
||||
struct device *parent, *self;
|
||||
void *aux;
|
||||
{
|
||||
struct dp8390_softc *sc = (struct dp8390_softc *)self;
|
||||
struct nubus_attach_args *na = (struct nubus_attach_args *)aux;
|
||||
#ifdef DEBUG
|
||||
struct ifnet *ifp = &sc->sc_ec.ec_if;
|
||||
#endif
|
||||
bus_space_tag_t bst;
|
||||
bus_space_handle_t bsh;
|
||||
int i, success;
|
||||
char *cardtype;
|
||||
|
||||
bst = na->na_tag;
|
||||
if (bus_space_map(bst, NUBUS_SLOT2PA(na->slot), NBMEMSIZE,
|
||||
0, &bsh)) {
|
||||
printf(": can't map memory space\n");
|
||||
return;
|
||||
}
|
||||
|
||||
sc->sc_regt = sc->sc_buft = bst;
|
||||
sc->sc_flags = self->dv_cfdata->cf_flags;
|
||||
|
||||
cardtype = nubus_get_card_name(bst, bsh, na->fmt);
|
||||
|
||||
sc->is790 = 0;
|
||||
|
||||
sc->mem_start = 0;
|
||||
sc->mem_size = 0;
|
||||
|
||||
success = 0;
|
||||
|
||||
switch (ae_nb_card_vendor(bst, bsh, na)) {
|
||||
case DP8390_VENDOR_APPLE: /* Apple-compatible cards */
|
||||
case DP8390_VENDOR_ASANTE:
|
||||
/* Map register offsets */
|
||||
for (i = 0; i < 16; i++) /* reverse order, longword aligned */
|
||||
sc->sc_reg_map[i] = (15 - i) << 2;
|
||||
|
||||
sc->dcr_reg = (ED_DCR_FT1 | ED_DCR_WTS | ED_DCR_LS);
|
||||
if (bus_space_subregion(bst, bsh,
|
||||
AE_REG_OFFSET, AE_REG_SIZE, &sc->sc_regh)) {
|
||||
printf(": failed to map register space\n");
|
||||
break;
|
||||
}
|
||||
if ((sc->mem_size = ae_size_card_memory(bst, bsh,
|
||||
AE_DATA_OFFSET)) == 0) {
|
||||
printf(": failed to determine size of RAM.\n");
|
||||
break;
|
||||
}
|
||||
if (bus_space_subregion(bst, bsh,
|
||||
AE_DATA_OFFSET, sc->mem_size, &sc->sc_bufh)) {
|
||||
printf(": failed to map register space\n");
|
||||
break;
|
||||
}
|
||||
#ifdef AE_OLD_GET_ENADDR
|
||||
/* Get station address from on-board ROM */
|
||||
for (i = 0; i < ETHER_ADDR_LEN; ++i)
|
||||
sc->sc_enaddr[i] =
|
||||
bus_space_read_1(bst, bsh, (AE_ROM_OFFSET + i * 2));
|
||||
#else
|
||||
if (ae_nb_get_enaddr(bst, bsh, na, sc->sc_enaddr)) {
|
||||
printf(": can't find MAC address\n");
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
success = 1;
|
||||
break;
|
||||
|
||||
case DP8390_VENDOR_DAYNA:
|
||||
/* Map register offsets */
|
||||
for (i = 0; i < 16; i++) /* normal order, longword aligned */
|
||||
sc->sc_reg_map[i] = i << 2;
|
||||
|
||||
sc->dcr_reg = (ED_DCR_FT1 | ED_DCR_WTS | ED_DCR_LS);
|
||||
if (bus_space_subregion(bst, bsh,
|
||||
DP_REG_OFFSET, AE_REG_SIZE, &sc->sc_regh)) {
|
||||
printf(": failed to map register space\n");
|
||||
break;
|
||||
}
|
||||
sc->mem_size = 8192;
|
||||
if (bus_space_subregion(bst, bsh,
|
||||
DP_DATA_OFFSET, sc->mem_size, &sc->sc_bufh)) {
|
||||
printf(": failed to map register space\n");
|
||||
break;
|
||||
}
|
||||
#ifdef AE_OLD_GET_ENADDR
|
||||
/* Get station address from on-board ROM */
|
||||
for (i = 0; i < ETHER_ADDR_LEN; ++i)
|
||||
sc->sc_enaddr[i] =
|
||||
bus_space_read_1(bst, bsh, (DP_ROM_OFFSET + i * 2));
|
||||
#else
|
||||
if (ae_nb_get_enaddr(bst, bsh, na, sc->sc_enaddr)) {
|
||||
printf(": can't find MAC address\n");
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
printf(": unsupported Dayna hardware\n");
|
||||
break;
|
||||
|
||||
case DP8390_VENDOR_FARALLON:
|
||||
/* Map register offsets */
|
||||
for (i = 0; i < 16; i++) /* reverse order, longword aligned */
|
||||
sc->sc_reg_map[i] = (15 - i) << 2;
|
||||
|
||||
sc->dcr_reg = (ED_DCR_FT1 | ED_DCR_WTS | ED_DCR_LS);
|
||||
if (bus_space_subregion(bst, bsh,
|
||||
AE_REG_OFFSET, AE_REG_SIZE, &sc->sc_regh)) {
|
||||
printf(": failed to map register space\n");
|
||||
break;
|
||||
}
|
||||
if ((sc->mem_size = ae_size_card_memory(bst, bsh,
|
||||
AE_DATA_OFFSET)) == 0) {
|
||||
printf(": failed to determine size of RAM.\n");
|
||||
break;
|
||||
}
|
||||
if (bus_space_subregion(bst, bsh,
|
||||
AE_DATA_OFFSET, sc->mem_size, &sc->sc_bufh)) {
|
||||
printf(": failed to map register space\n");
|
||||
break;
|
||||
}
|
||||
#ifdef AE_OLD_GET_ENADDR
|
||||
/* Get station address from on-board ROM */
|
||||
for (i = 0; i < ETHER_ADDR_LEN; ++i)
|
||||
sc->sc_enaddr[i] =
|
||||
bus_space_read_1(bst, bsh, (FE_ROM_OFFSET + i));
|
||||
#else
|
||||
if (ae_nb_get_enaddr(bst, bsh, na, sc->sc_enaddr)) {
|
||||
printf(": can't find MAC address\n");
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
success = 1;
|
||||
break;
|
||||
|
||||
case DP8390_VENDOR_FOCUS:
|
||||
printf(": unsupported Focus hardware\n");
|
||||
break;
|
||||
|
||||
case DP8390_VENDOR_INTERLAN:
|
||||
/* Map register offsets */
|
||||
for (i = 0; i < 16; i++) /* normal order, longword aligned */
|
||||
sc->sc_reg_map[i] = i << 2;
|
||||
|
||||
sc->dcr_reg = (ED_DCR_FT1 | ED_DCR_WTS | ED_DCR_LS);
|
||||
if (bus_space_subregion(bst, bsh,
|
||||
GC_REG_OFFSET, AE_REG_SIZE, &sc->sc_regh)) {
|
||||
printf(": failed to map register space\n");
|
||||
break;
|
||||
}
|
||||
if ((sc->mem_size = ae_size_card_memory(bst, bsh,
|
||||
GC_DATA_OFFSET)) == 0) {
|
||||
printf(": failed to determine size of RAM.\n");
|
||||
break;
|
||||
}
|
||||
if (bus_space_subregion(bst, bsh,
|
||||
GC_DATA_OFFSET, sc->mem_size, &sc->sc_bufh)) {
|
||||
printf(": failed to map register space\n");
|
||||
break;
|
||||
}
|
||||
|
||||
/* reset the NIC chip */
|
||||
bus_space_write_1(bst, bsh, GC_RESET_OFFSET, 0);
|
||||
|
||||
if (ae_nb_get_enaddr(bst, bsh, na, sc->sc_enaddr)) {
|
||||
/* Fall back to snarf directly from ROM. Ick. */
|
||||
for (i = 0; i < ETHER_ADDR_LEN; ++i)
|
||||
sc->sc_enaddr[i] =
|
||||
bus_space_read_1(bst, bsh,
|
||||
(GC_ROM_OFFSET + i * 4));
|
||||
}
|
||||
|
||||
success = 1;
|
||||
break;
|
||||
|
||||
case DP8390_VENDOR_KINETICS:
|
||||
/* Map register offsets */
|
||||
for (i = 0; i < 16; i++) /* normal order, longword aligned */
|
||||
sc->sc_reg_map[i] = i << 2;
|
||||
|
||||
if (bus_space_subregion(bst, bsh,
|
||||
KE_REG_OFFSET, AE_REG_SIZE, &sc->sc_regh)) {
|
||||
printf(": failed to map register space\n");
|
||||
break;
|
||||
}
|
||||
if ((sc->mem_size = ae_size_card_memory(bst, bsh,
|
||||
KE_DATA_OFFSET)) == 0) {
|
||||
printf(": failed to determine size of RAM.\n");
|
||||
break;
|
||||
}
|
||||
if (bus_space_subregion(bst, bsh,
|
||||
KE_DATA_OFFSET, sc->mem_size, &sc->sc_bufh)) {
|
||||
printf(": failed to map register space\n");
|
||||
break;
|
||||
}
|
||||
if (ae_nb_get_enaddr(bst, bsh, na, sc->sc_enaddr)) {
|
||||
printf(": can't find MAC address\n");
|
||||
break;
|
||||
}
|
||||
|
||||
success = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (!success) {
|
||||
bus_space_unmap(bst, bsh, NBMEMSIZE);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Override test_mem and write_mbuf functions; other defaults
|
||||
* already work properly.
|
||||
*/
|
||||
sc->test_mem = ae_test_mem;
|
||||
sc->write_mbuf = ae_write_mbuf;
|
||||
#ifdef DEBUG
|
||||
ifp->if_watchdog = ae_nb_watchdog; /* Override watchdog */
|
||||
#endif
|
||||
|
||||
/* Interface is always enabled. */
|
||||
sc->sc_enabled = 1;
|
||||
|
||||
printf(": %s, %dKB memory\n", cardtype, sc->mem_size / 1024);
|
||||
|
||||
if (dp8390_config(sc, NULL, 0, 0)) {
|
||||
bus_space_unmap(bst, bsh, NBMEMSIZE);
|
||||
return;
|
||||
}
|
||||
|
||||
/* make sure interrupts are vectored to us */
|
||||
add_nubus_intr(na->slot, ae_nubus_intr, sc);
|
||||
}
|
||||
|
||||
void
|
||||
ae_nubus_intr(arg)
|
||||
void *arg;
|
||||
{
|
||||
struct dp8390_softc *sc = (struct dp8390_softc *)arg;
|
||||
|
||||
(void)dp8390_intr(sc);
|
||||
}
|
||||
|
||||
static int
|
||||
ae_nb_card_vendor(bst, bsh, na)
|
||||
bus_space_tag_t bst;
|
||||
bus_space_handle_t bsh;
|
||||
struct nubus_attach_args *na;
|
||||
{
|
||||
int vendor;
|
||||
|
||||
switch (na->drsw) {
|
||||
case NUBUS_DRSW_3COM:
|
||||
switch (na->drhw) {
|
||||
case NUBUS_DRHW_APPLE_SN:
|
||||
case NUBUS_DRHW_APPLE_SNT:
|
||||
vendor = DP8390_VENDOR_UNKNOWN;
|
||||
break;
|
||||
default:
|
||||
vendor = DP8390_VENDOR_APPLE;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case NUBUS_DRSW_APPLE:
|
||||
case NUBUS_DRSW_DAYNA2:
|
||||
case NUBUS_DRSW_TECHWORKS:
|
||||
vendor = DP8390_VENDOR_APPLE;
|
||||
break;
|
||||
case NUBUS_DRSW_ASANTE:
|
||||
vendor = DP8390_VENDOR_ASANTE;
|
||||
break;
|
||||
case NUBUS_DRSW_FARALLON:
|
||||
vendor = DP8390_VENDOR_FARALLON;
|
||||
break;
|
||||
case NUBUS_DRSW_FOCUS:
|
||||
vendor = DP8390_VENDOR_FOCUS;
|
||||
break;
|
||||
case NUBUS_DRSW_GATOR:
|
||||
switch (na->drhw) {
|
||||
default:
|
||||
case NUBUS_DRHW_INTERLAN:
|
||||
vendor = DP8390_VENDOR_INTERLAN;
|
||||
break;
|
||||
case NUBUS_DRHW_KINETICS:
|
||||
if (strncmp(nubus_get_card_name(bst, bsh, na->fmt),
|
||||
"EtherPort", 9) == 0)
|
||||
vendor = DP8390_VENDOR_KINETICS;
|
||||
else
|
||||
vendor = DP8390_VENDOR_DAYNA;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
vendor = DP8390_VENDOR_UNKNOWN;
|
||||
}
|
||||
return vendor;
|
||||
}
|
||||
|
||||
static int
|
||||
ae_nb_get_enaddr(bst, bsh, na, ep)
|
||||
bus_space_tag_t bst;
|
||||
bus_space_handle_t bsh;
|
||||
struct nubus_attach_args *na;
|
||||
u_int8_t *ep;
|
||||
{
|
||||
nubus_dir dir;
|
||||
nubus_dirent dirent;
|
||||
|
||||
/*
|
||||
* XXX - note hardwired resource IDs here (0x80); these are
|
||||
* assumed to be used by all cards, but should be fixed when
|
||||
* we find out more about Ethernet card resources.
|
||||
*/
|
||||
nubus_get_main_dir(na->fmt, &dir);
|
||||
if (nubus_find_rsrc(bst, bsh, na->fmt, &dir, 0x80, &dirent) <= 0)
|
||||
return 1;
|
||||
nubus_get_dir_from_rsrc(na->fmt, &dirent, &dir);
|
||||
if (nubus_find_rsrc(bst, bsh, na->fmt, &dir, 0x80, &dirent) <= 0)
|
||||
return 1;
|
||||
if (nubus_get_ind_data(bst, bsh,
|
||||
na->fmt, &dirent, ep, ETHER_ADDR_LEN) <= 0)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
static void
|
||||
ae_nb_watchdog(ifp)
|
||||
struct ifnet *ifp;
|
||||
{
|
||||
struct dp8390_softc *sc = ifp->if_softc;
|
||||
|
||||
/*
|
||||
* This is a kludge! The via code seems to miss slot interrupts
|
||||
* sometimes. This kludges around that by calling the handler
|
||||
* by hand if the watchdog is activated. -- XXX (akb)
|
||||
*/
|
||||
(*via2itab[1])((void *)1);
|
||||
|
||||
log(LOG_ERR, "%s: device timeout\n", sc->sc_dev.dv_xname);
|
||||
++ifp->if_oerrors;
|
||||
|
||||
dp8390_reset(sc);
|
||||
}
|
||||
#endif
|
|
@ -1,408 +0,0 @@
|
|||
/* $NetBSD: if_mc_obio.c,v 1.4 1998/01/13 19:24:54 scottr Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997 David Huang <khym@bga.com>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Portions of this code are based on code by Denton Gentry <denny1@home.com>
|
||||
* and Yanagisawa Takeshi <yanagisw@aa.ap.titech.ac.jp>.
|
||||
*
|
||||
* 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. 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Bus attachment and DMA routines for the mc driver (Centris/Quadra
|
||||
* 660av and Quadra 840av onboard ethernet, based on the AMD Am79C940
|
||||
* MACE ethernet chip). Also uses the PSC (Peripheral Subsystem
|
||||
* Controller) for DMA to and from the MACE.
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/if_ether.h>
|
||||
|
||||
#include <vm/vm.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/psc.h>
|
||||
|
||||
#include <mac68k/dev/obiovar.h>
|
||||
#include <mac68k/dev/if_mcreg.h>
|
||||
#include <mac68k/dev/if_mcvar.h>
|
||||
|
||||
#define MACE_REG_BASE 0x50F1C000
|
||||
#define MACE_PROM_BASE 0x50F08000
|
||||
|
||||
hide int mc_obio_match __P((struct device *, struct cfdata *, void *));
|
||||
hide void mc_obio_attach __P((struct device *, struct device *, void *));
|
||||
hide void mc_obio_init __P((struct mc_softc *sc));
|
||||
hide void mc_obio_put __P((struct mc_softc *sc, u_int len));
|
||||
hide int mc_dmaintr __P((void *arg));
|
||||
hide void mc_reset_rxdma __P((struct mc_softc *sc));
|
||||
hide void mc_reset_rxdma_set __P((struct mc_softc *, int set));
|
||||
hide void mc_reset_txdma __P((struct mc_softc *sc));
|
||||
hide int mc_obio_getaddr __P((struct mc_softc *, u_int8_t *));
|
||||
|
||||
extern int kvtop __P((register caddr_t addr));
|
||||
|
||||
struct cfattach mc_obio_ca = {
|
||||
sizeof(struct mc_softc), mc_obio_match, mc_obio_attach
|
||||
};
|
||||
|
||||
hide int
|
||||
mc_obio_match(parent, cf, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *cf;
|
||||
void *aux;
|
||||
{
|
||||
struct obio_attach_args *oa = aux;
|
||||
bus_space_handle_t bsh;
|
||||
int found = 0;
|
||||
|
||||
if (current_mac_model->class != MACH_CLASSAV)
|
||||
return 0;
|
||||
|
||||
if (bus_space_map(oa->oa_tag, MACE_REG_BASE, MC_REGSIZE, 0, &bsh))
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* Make sure the MACE's I/O space is readable, and if it is,
|
||||
* try to read the CHIPID register. A MACE will always have
|
||||
* 0x?940, where the ? depends on the chip version.
|
||||
*/
|
||||
if (mac68k_bus_space_probe(oa->oa_tag, bsh, 0, 1)) {
|
||||
if ((bus_space_read_1(
|
||||
oa->oa_tag, bsh, MACE_REG(MACE_CHIPIDL)) == 0x40) &&
|
||||
((bus_space_read_1(
|
||||
oa->oa_tag, bsh, MACE_REG(MACE_CHIPIDH)) & 0xf) == 9))
|
||||
found = 1;
|
||||
}
|
||||
|
||||
bus_space_unmap(oa->oa_tag, bsh, MC_REGSIZE);
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
hide void
|
||||
mc_obio_attach(parent, self, aux)
|
||||
struct device *parent, *self;
|
||||
void *aux;
|
||||
{
|
||||
struct obio_attach_args *oa = (struct obio_attach_args *)aux;
|
||||
struct mc_softc *sc = (void *)self;
|
||||
u_int8_t myaddr[ETHER_ADDR_LEN];
|
||||
int i, noncontig = 0;
|
||||
|
||||
sc->sc_regt = oa->oa_tag;
|
||||
sc->sc_biucc = XMTSP_64;
|
||||
sc->sc_fifocc = XMTFW_16 | RCVFW_64 | XMTFWU | RCVFWU |
|
||||
XMTBRST | RCVBRST;
|
||||
sc->sc_plscc = PORTSEL_AUI;
|
||||
|
||||
if (bus_space_map(sc->sc_regt, MACE_REG_BASE, MC_REGSIZE, 0,
|
||||
&sc->sc_regh)) {
|
||||
printf(": failed to map space for MACE regs.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (mc_obio_getaddr(sc, myaddr)) {
|
||||
printf(": failed to get MAC address.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* allocate memory for transmit buffer and mark it non-cacheable */
|
||||
sc->sc_txbuf = malloc(NBPG, M_DEVBUF, M_WAITOK);
|
||||
sc->sc_txbuf_phys = kvtop(sc->sc_txbuf);
|
||||
physaccess (sc->sc_txbuf, (caddr_t)sc->sc_txbuf_phys, NBPG,
|
||||
PG_V | PG_RW | PG_CI);
|
||||
|
||||
/*
|
||||
* allocate memory for receive buffer and mark it non-cacheable
|
||||
* XXX This should use the bus_dma interface, since the buffer
|
||||
* needs to be physically contiguous. However, it seems that
|
||||
* at least on my system, malloc() does allocate contiguous
|
||||
* memory. If it's not, suggest reducing the number of buffers
|
||||
* to 2, which will fit in one 4K page.
|
||||
*/
|
||||
sc->sc_rxbuf = malloc(MC_NPAGES * NBPG, M_DEVBUF, M_WAITOK);
|
||||
sc->sc_rxbuf_phys = kvtop(sc->sc_rxbuf);
|
||||
for (i = 0; i < MC_NPAGES; i++) {
|
||||
int pa;
|
||||
|
||||
pa = kvtop(sc->sc_rxbuf + NBPG*i);
|
||||
physaccess (sc->sc_rxbuf + NBPG*i, (caddr_t)pa, NBPG,
|
||||
PG_V | PG_RW | PG_CI);
|
||||
if (pa != sc->sc_rxbuf_phys + NBPG*i)
|
||||
noncontig = 1;
|
||||
}
|
||||
|
||||
if (noncontig) {
|
||||
printf("%s: receive DMA buffer not contiguous! "
|
||||
"Try compiling with \"options MC_RXDMABUFS=2\"\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
return;
|
||||
}
|
||||
|
||||
sc->sc_bus_init = mc_obio_init;
|
||||
sc->sc_putpacket = mc_obio_put;
|
||||
|
||||
/* disable receive DMA */
|
||||
psc_reg2(PSC_ENETRD_CTL) = 0x8800;
|
||||
psc_reg2(PSC_ENETRD_CTL) = 0x1000;
|
||||
psc_reg2(PSC_ENETRD_CMD + PSC_SET0) = 0x1100;
|
||||
psc_reg2(PSC_ENETRD_CMD + PSC_SET1) = 0x1100;
|
||||
|
||||
/* disable transmit DMA */
|
||||
psc_reg2(PSC_ENETWR_CTL) = 0x8800;
|
||||
psc_reg2(PSC_ENETWR_CTL) = 0x1000;
|
||||
psc_reg2(PSC_ENETWR_CMD + PSC_SET0) = 0x1100;
|
||||
psc_reg2(PSC_ENETWR_CMD + PSC_SET1) = 0x1100;
|
||||
|
||||
/* install interrupt handlers */
|
||||
add_psc_lev4_intr(PSCINTR_ENET_DMA, mc_dmaintr, sc);
|
||||
add_psc_lev3_intr(mcintr, sc);
|
||||
|
||||
/* enable MACE DMA interrupts */
|
||||
psc_reg1(PSC_LEV4_IER) = 0x80 | (1 << PSCINTR_ENET_DMA);
|
||||
|
||||
/* don't know what this does */
|
||||
psc_reg2(PSC_ENETWR_CTL) = 0x9000;
|
||||
psc_reg2(PSC_ENETRD_CTL) = 0x9000;
|
||||
psc_reg2(PSC_ENETWR_CTL) = 0x0400;
|
||||
psc_reg2(PSC_ENETRD_CTL) = 0x0400;
|
||||
|
||||
/* enable MACE interrupts */
|
||||
psc_reg1(PSC_LEV3_IER) = 0x80 | (1 << PSCINTR_ENET);
|
||||
|
||||
/* mcsetup returns 1 if something fails */
|
||||
if (mcsetup(sc, myaddr)) {
|
||||
/* disable interrupts */
|
||||
psc_reg1(PSC_LEV4_IER) = (1 << PSCINTR_ENET_DMA);
|
||||
psc_reg1(PSC_LEV3_IER) = (1 << PSCINTR_ENET);
|
||||
/* remove interrupt handlers */
|
||||
remove_psc_lev4_intr(PSCINTR_ENET_DMA);
|
||||
remove_psc_lev3_intr();
|
||||
|
||||
bus_space_unmap(sc->sc_regt, sc->sc_regh, MC_REGSIZE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* Bus-specific initialization */
|
||||
hide void
|
||||
mc_obio_init(sc)
|
||||
struct mc_softc *sc;
|
||||
{
|
||||
mc_reset_rxdma(sc);
|
||||
mc_reset_txdma(sc);
|
||||
}
|
||||
|
||||
hide void
|
||||
mc_obio_put(sc, len)
|
||||
struct mc_softc *sc;
|
||||
u_int len;
|
||||
{
|
||||
psc_reg4(PSC_ENETWR_ADDR + sc->sc_txset) = sc->sc_txbuf_phys;
|
||||
psc_reg4(PSC_ENETWR_LEN + sc->sc_txset) = len;
|
||||
psc_reg2(PSC_ENETWR_CMD + sc->sc_txset) = 0x9800;
|
||||
|
||||
sc->sc_txset ^= 0x10;
|
||||
}
|
||||
|
||||
/*
|
||||
* Interrupt handler for the MACE DMA completion interrupts
|
||||
*/
|
||||
int
|
||||
mc_dmaintr(arg)
|
||||
void *arg;
|
||||
{
|
||||
struct mc_softc *sc = arg;
|
||||
u_int16_t status;
|
||||
u_int32_t bufsleft, which;
|
||||
int head;
|
||||
|
||||
/*
|
||||
* Not sure what this does... figure out if this interrupt is
|
||||
* really ours?
|
||||
*/
|
||||
while ((which = psc_reg4(0x804)) != psc_reg4(0x804))
|
||||
;
|
||||
if ((which & 0x60000000) == 0)
|
||||
return 0;
|
||||
|
||||
/* Get the read channel status */
|
||||
status = psc_reg2(PSC_ENETRD_CTL);
|
||||
if (status & 0x2000) {
|
||||
/* I think this is an exceptional condition. Reset the DMA */
|
||||
mc_reset_rxdma(sc);
|
||||
#ifdef MCDEBUG
|
||||
printf("%s: resetting receive DMA channel (status 0x%04x)\n",
|
||||
sc->sc_dev.dv_xname, status);
|
||||
#endif
|
||||
} else if (status & 0x100) {
|
||||
/* We've received some packets from the MACE */
|
||||
int offset;
|
||||
|
||||
/* Clear the interrupt */
|
||||
psc_reg2(PSC_ENETRD_CMD + sc->sc_rxset) = 0x1100;
|
||||
|
||||
/* See how may receive buffers are left */
|
||||
bufsleft = psc_reg4(PSC_ENETRD_LEN + sc->sc_rxset);
|
||||
head = MC_RXDMABUFS - bufsleft;
|
||||
|
||||
#if 0 /* I don't think this should ever happen */
|
||||
if (head == sc->sc_tail) {
|
||||
#ifdef MCDEBUG
|
||||
printf("%s: head == tail: suspending DMA?\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
#endif
|
||||
psc_reg2(PSC_ENETRD_CMD + sc->sc_rxset) = 0x9000;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Loop through, processing each of the packets */
|
||||
for (; sc->sc_tail < head; sc->sc_tail++) {
|
||||
offset = sc->sc_tail * 0x800;
|
||||
sc->sc_rxframe.rx_rcvcnt = sc->sc_rxbuf[offset];
|
||||
sc->sc_rxframe.rx_rcvsts = sc->sc_rxbuf[offset+2];
|
||||
sc->sc_rxframe.rx_rntpc = sc->sc_rxbuf[offset+4];
|
||||
sc->sc_rxframe.rx_rcvcc = sc->sc_rxbuf[offset+6];
|
||||
sc->sc_rxframe.rx_frame = sc->sc_rxbuf + offset + 16;
|
||||
|
||||
mc_rint(sc);
|
||||
}
|
||||
|
||||
/*
|
||||
* If we're out of buffers, reset this register set
|
||||
* and switch to the other one. Otherwise, reactivate
|
||||
* this set.
|
||||
*/
|
||||
if (bufsleft == 0) {
|
||||
mc_reset_rxdma_set(sc, sc->sc_rxset);
|
||||
sc->sc_rxset ^= 0x10;
|
||||
} else
|
||||
psc_reg2(PSC_ENETRD_CMD + sc->sc_rxset) = 0x9800;
|
||||
}
|
||||
|
||||
/* Get the write channel status */
|
||||
status = psc_reg2(PSC_ENETWR_CTL);
|
||||
if (status & 0x2000) {
|
||||
/* I think this is an exceptional condition. Reset the DMA */
|
||||
mc_reset_txdma(sc);
|
||||
#ifdef MCDEBUG
|
||||
printf("%s: resetting transmit DMA channel (status 0x%04x)\n",
|
||||
sc->sc_dev.dv_xname, status);
|
||||
#endif
|
||||
} else if (status & 0x100) {
|
||||
/* Clear the interrupt and switch register sets */
|
||||
psc_reg2(PSC_ENETWR_CMD + sc->sc_txseti) = 0x100;
|
||||
sc->sc_txseti ^= 0x10;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
hide void
|
||||
mc_reset_rxdma(sc)
|
||||
struct mc_softc *sc;
|
||||
{
|
||||
u_int8_t maccc;
|
||||
|
||||
/* Disable receiver, reset the DMA channels */
|
||||
maccc = NIC_GET(sc, MACE_MACCC);
|
||||
NIC_PUT(sc, MACE_MACCC, maccc & ~ENRCV);
|
||||
psc_reg2(PSC_ENETRD_CTL) = 0x8800;
|
||||
mc_reset_rxdma_set(sc, 0);
|
||||
psc_reg2(PSC_ENETRD_CTL) = 0x400;
|
||||
|
||||
psc_reg2(PSC_ENETRD_CTL) = 0x8800;
|
||||
mc_reset_rxdma_set(sc, 0x10);
|
||||
psc_reg2(PSC_ENETRD_CTL) = 0x400;
|
||||
|
||||
/* Reenable receiver, reenable DMA */
|
||||
NIC_PUT(sc, MACE_MACCC, maccc);
|
||||
sc->sc_rxset = 0;
|
||||
|
||||
psc_reg2(PSC_ENETRD_CMD + PSC_SET0) = 0x9800;
|
||||
psc_reg2(PSC_ENETRD_CMD + PSC_SET1) = 0x9800;
|
||||
}
|
||||
|
||||
hide void
|
||||
mc_reset_rxdma_set(sc, set)
|
||||
struct mc_softc *sc;
|
||||
int set;
|
||||
{
|
||||
/* disable DMA while modifying the registers, then reenable DMA */
|
||||
psc_reg2(PSC_ENETRD_CMD + set) = 0x0100;
|
||||
psc_reg4(PSC_ENETRD_ADDR + set) = sc->sc_rxbuf_phys;
|
||||
psc_reg4(PSC_ENETRD_LEN + set) = MC_RXDMABUFS;
|
||||
psc_reg2(PSC_ENETRD_CMD + set) = 0x9800;
|
||||
sc->sc_tail = 0;
|
||||
}
|
||||
|
||||
hide void
|
||||
mc_reset_txdma(sc)
|
||||
struct mc_softc *sc;
|
||||
{
|
||||
u_int8_t maccc;
|
||||
|
||||
psc_reg2(PSC_ENETWR_CTL) = 0x8800;
|
||||
maccc = NIC_GET(sc, MACE_MACCC);
|
||||
NIC_PUT(sc, MACE_MACCC, maccc & ~ENXMT);
|
||||
sc->sc_txset = sc->sc_txseti = 0;
|
||||
psc_reg2(PSC_ENETWR_CTL) = 0x400;
|
||||
NIC_PUT(sc, MACE_MACCC, maccc);
|
||||
}
|
||||
|
||||
hide int
|
||||
mc_obio_getaddr(sc, lladdr)
|
||||
struct mc_softc *sc;
|
||||
u_int8_t *lladdr;
|
||||
{
|
||||
bus_space_handle_t bsh;
|
||||
u_char csum;
|
||||
|
||||
if (bus_space_map(sc->sc_regt, MACE_PROM_BASE, 8*16, 0, &bsh)) {
|
||||
printf(": failed to map space to read MACE address.\n%s",
|
||||
sc->sc_dev.dv_xname);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if (!mac68k_bus_space_probe(sc->sc_regt, bsh, 0, 1)) {
|
||||
bus_space_unmap(sc->sc_regt, bsh, 8*16);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
csum = mc_get_enaddr(sc->sc_regt, bsh, 1, lladdr);
|
||||
if (csum != 0xff)
|
||||
printf(": ethernet PROM checksum failed (0x%x != 0xff)\n%s",
|
||||
(int)csum, sc->sc_dev.dv_xname);
|
||||
|
||||
bus_space_unmap(sc->sc_regt, bsh, 8*16);
|
||||
|
||||
return (csum == 0xff ? 0 : -1);
|
||||
}
|
|
@ -1,271 +0,0 @@
|
|||
/* $NetBSD: if_sn_nubus.c,v 1.17 1997/10/26 03:17:15 briggs 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.
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/syslog.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/if_ether.h>
|
||||
|
||||
#if 0 /* XXX this shouldn't be necessary; else reinsert */
|
||||
#ifdef INET
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/if_inarp.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/viareg.h>
|
||||
|
||||
#include <mac68k/dev/nubus.h>
|
||||
#include <mac68k/dev/if_snreg.h>
|
||||
#include <mac68k/dev/if_snvar.h>
|
||||
|
||||
static int sn_nubus_match __P((struct device *, struct cfdata *, void *));
|
||||
static void sn_nubus_attach __P((struct device *, struct device *, void *));
|
||||
static int sn_nb_card_vendor __P((bus_space_tag_t, bus_space_handle_t,
|
||||
struct nubus_attach_args *));
|
||||
|
||||
struct cfattach sn_nubus_ca = {
|
||||
sizeof(struct sn_softc), sn_nubus_match, sn_nubus_attach
|
||||
};
|
||||
|
||||
|
||||
static int
|
||||
sn_nubus_match(parent, cf, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *cf;
|
||||
void *aux;
|
||||
{
|
||||
struct nubus_attach_args *na = (struct nubus_attach_args *) aux;
|
||||
bus_space_handle_t bsh;
|
||||
int rv;
|
||||
|
||||
if (bus_space_map(na->na_tag,
|
||||
NUBUS_SLOT2PA(na->slot), NBMEMSIZE, 0, &bsh))
|
||||
return (0);
|
||||
|
||||
rv = 0;
|
||||
|
||||
if (na->category == NUBUS_CATEGORY_NETWORK &&
|
||||
na->type == NUBUS_TYPE_ETHERNET) {
|
||||
switch (sn_nb_card_vendor(na->na_tag, bsh, na)) {
|
||||
default:
|
||||
break;
|
||||
|
||||
case SN_VENDOR_APPLE:
|
||||
case SN_VENDOR_APPLE16:
|
||||
case SN_VENDOR_DAYNA:
|
||||
rv = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bus_space_unmap(na->na_tag, bsh, NBMEMSIZE);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
/*
|
||||
* Install interface into kernel networking data structures
|
||||
*/
|
||||
static void
|
||||
sn_nubus_attach(parent, self, aux)
|
||||
struct device *parent, *self;
|
||||
void *aux;
|
||||
{
|
||||
struct sn_softc *sc = (void *)self;
|
||||
struct nubus_attach_args *na = (struct nubus_attach_args *)aux;
|
||||
int i, success, offset;
|
||||
bus_space_tag_t bst;
|
||||
bus_space_handle_t bsh, tmp_bsh;
|
||||
u_int8_t myaddr[ETHER_ADDR_LEN];
|
||||
|
||||
(void)(&offset); /* Work around lame gcc initialization bug */
|
||||
|
||||
bst = na->na_tag;
|
||||
if (bus_space_map(bst, NUBUS_SLOT2PA(na->slot), NBMEMSIZE, 0, &bsh)) {
|
||||
printf(": failed to map memory space.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
sc->sc_regt = bst;
|
||||
|
||||
success = 0;
|
||||
|
||||
sc->slotno = na->slot;
|
||||
|
||||
switch (sn_nb_card_vendor(bst, bsh, na)) {
|
||||
case SN_VENDOR_DAYNA:
|
||||
sc->snr_dcr = DCR_ASYNC | DCR_WAIT0 |
|
||||
DCR_DMABLOCK | DCR_RFT16 | DCR_TFT16;
|
||||
sc->snr_dcr2 = 0;
|
||||
sc->bitmode = 1; /* 32 bit card */
|
||||
|
||||
if (bus_space_subregion(bst, bsh,
|
||||
0x00180000, SN_REGSIZE, &sc->sc_regh)) {
|
||||
printf(": failed to map register space.\n");
|
||||
break;
|
||||
}
|
||||
|
||||
if (bus_space_subregion(bst, bsh,
|
||||
0x00ffe004, ETHER_ADDR_LEN, &tmp_bsh)) {
|
||||
printf(": failed to map ROM space.\n");
|
||||
break;
|
||||
}
|
||||
|
||||
sn_get_enaddr(bst, tmp_bsh, 0, myaddr);
|
||||
|
||||
offset = 2;
|
||||
success = 1;
|
||||
break;
|
||||
|
||||
case SN_VENDOR_APPLE:
|
||||
sc->snr_dcr = DCR_ASYNC | DCR_WAIT0 |
|
||||
DCR_DMABLOCK | DCR_RFT16 | DCR_TFT16;
|
||||
sc->snr_dcr2 = 0;
|
||||
sc->bitmode = 1; /* 32 bit card */
|
||||
|
||||
if (bus_space_subregion(bst, bsh,
|
||||
0x0, SN_REGSIZE, &sc->sc_regh)) {
|
||||
printf(": failed to map register space.\n");
|
||||
break;
|
||||
}
|
||||
|
||||
if (bus_space_subregion(bst, bsh,
|
||||
0x40000, ETHER_ADDR_LEN, &tmp_bsh)) {
|
||||
printf(": failed to map ROM space.\n");
|
||||
break;
|
||||
}
|
||||
|
||||
sn_get_enaddr(bst, tmp_bsh, 0, myaddr);
|
||||
|
||||
offset = 0;
|
||||
success = 1;
|
||||
break;
|
||||
|
||||
case SN_VENDOR_APPLE16:
|
||||
sc->snr_dcr = DCR_ASYNC | DCR_WAIT0 | DCR_EXBUS |
|
||||
DCR_DMABLOCK | DCR_PO1 | DCR_RFT16 | DCR_TFT16;
|
||||
sc->snr_dcr2 = 0;
|
||||
sc->bitmode = 0; /* 16 bit card */
|
||||
|
||||
if (bus_space_subregion(bst, bsh,
|
||||
0x0, SN_REGSIZE, &sc->sc_regh)) {
|
||||
printf(": failed to map register space.\n");
|
||||
break;
|
||||
}
|
||||
|
||||
if (bus_space_subregion(bst, bsh,
|
||||
0x40000, ETHER_ADDR_LEN, &tmp_bsh)) {
|
||||
printf(": failed to map ROM space.\n");
|
||||
break;
|
||||
}
|
||||
|
||||
sn_get_enaddr(bst, tmp_bsh, 0, myaddr);
|
||||
|
||||
offset = 0;
|
||||
success = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
/*
|
||||
* You can't actually get this default, the snmatch
|
||||
* will fail for unknown hardware. If you're adding support
|
||||
* for a new card, the following defaults are a
|
||||
* good starting point.
|
||||
*/
|
||||
sc->snr_dcr = DCR_SYNC | DCR_WAIT0 | DCR_DW32 |
|
||||
DCR_DMABLOCK | DCR_RFT16 | DCR_TFT16;
|
||||
sc->snr_dcr2 = 0;
|
||||
success = 0;
|
||||
printf(": unknown card: attachment incomplete.\n");
|
||||
}
|
||||
|
||||
if (!success) {
|
||||
bus_space_unmap(bst, bsh, NBMEMSIZE);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Regs are addressed as words, big endian. */
|
||||
for (i = 0; i < SN_NREGS; i++) {
|
||||
sc->sc_reg_map[i] = (bus_size_t)((i * 4) + offset);
|
||||
}
|
||||
|
||||
/* snsetup returns 1 if something fails */
|
||||
if (snsetup(sc, myaddr)) {
|
||||
bus_space_unmap(bst, bsh, NBMEMSIZE);
|
||||
return;
|
||||
}
|
||||
|
||||
add_nubus_intr(sc->slotno, snintr, (void *)sc);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static int
|
||||
sn_nb_card_vendor(bst, bsh, na)
|
||||
bus_space_tag_t bst;
|
||||
bus_space_handle_t bsh;
|
||||
struct nubus_attach_args *na;
|
||||
{
|
||||
int vendor = SN_VENDOR_UNKNOWN;
|
||||
|
||||
switch (na->drsw) {
|
||||
case NUBUS_DRSW_3COM:
|
||||
if (na->drhw == NUBUS_DRHW_APPLE_SNT)
|
||||
vendor = SN_VENDOR_APPLE;
|
||||
else if (na->drhw == NUBUS_DRHW_APPLE_SN)
|
||||
vendor = SN_VENDOR_APPLE16;
|
||||
break;
|
||||
case NUBUS_DRSW_APPLE:
|
||||
case NUBUS_DRSW_TECHWORKS:
|
||||
vendor = SN_VENDOR_APPLE;
|
||||
break;
|
||||
case NUBUS_DRSW_GATOR:
|
||||
if (na->drhw == NUBUS_DRHW_KINETICS &&
|
||||
strncmp(nubus_get_card_name(bst, bsh, na->fmt),
|
||||
"EtherPort", 9) != 0)
|
||||
vendor = SN_VENDOR_DAYNA;
|
||||
break;
|
||||
case NUBUS_DRSW_DAYNA:
|
||||
vendor = SN_VENDOR_DAYNA;
|
||||
break;
|
||||
}
|
||||
|
||||
return vendor;
|
||||
}
|
|
@ -1,258 +0,0 @@
|
|||
/* $NetBSD: if_sn_obio.c,v 1.14 1998/01/13 19:24:55 scottr 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.
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/syslog.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/if_ether.h>
|
||||
|
||||
#if 0 /* XXX this shouldn't be necessary... else reinsert */
|
||||
#ifdef INET
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/if_ether.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/cpu.h>
|
||||
#include <machine/viareg.h>
|
||||
|
||||
#include <mac68k/dev/obiovar.h>
|
||||
#include <mac68k/dev/if_snreg.h>
|
||||
#include <mac68k/dev/if_snvar.h>
|
||||
|
||||
#define SONIC_REG_BASE 0x50F0A000
|
||||
#define SONIC_PROM_BASE 0x50F08000
|
||||
|
||||
static int sn_obio_match __P((struct device *, struct cfdata *, void *));
|
||||
static void sn_obio_attach __P((struct device *, struct device *, void *));
|
||||
static int sn_obio_getaddr __P((struct sn_softc *, u_int8_t *));
|
||||
static int sn_obio_getaddr_kludge __P((struct sn_softc *, u_int8_t *));
|
||||
|
||||
struct cfattach sn_obio_ca = {
|
||||
sizeof(struct sn_softc), sn_obio_match, sn_obio_attach
|
||||
};
|
||||
|
||||
static int
|
||||
sn_obio_match(parent, cf, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *cf;
|
||||
void *aux;
|
||||
{
|
||||
struct obio_attach_args *oa = (struct obio_attach_args *)aux;
|
||||
bus_space_handle_t bsh;
|
||||
int found = 0;
|
||||
|
||||
if (!mac68k_machine.sonic)
|
||||
return 0;
|
||||
|
||||
if (bus_space_map(oa->oa_tag,
|
||||
SONIC_REG_BASE, SN_REGSIZE, 0, &bsh))
|
||||
return 0;
|
||||
|
||||
if (mac68k_bus_space_probe(oa->oa_tag, bsh, 0, 4))
|
||||
found = 1;
|
||||
|
||||
bus_space_unmap(oa->oa_tag, bsh, SN_REGSIZE);
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
/*
|
||||
* Install interface into kernel networking data structures
|
||||
*/
|
||||
static void
|
||||
sn_obio_attach(parent, self, aux)
|
||||
struct device *parent, *self;
|
||||
void *aux;
|
||||
{
|
||||
struct obio_attach_args *oa = (struct obio_attach_args *)aux;
|
||||
struct sn_softc *sc = (void *)self;
|
||||
u_int8_t myaddr[ETHER_ADDR_LEN];
|
||||
int i;
|
||||
|
||||
sc->snr_dcr = DCR_WAIT0 | DCR_DMABLOCK | DCR_RFT16 | DCR_TFT16;
|
||||
sc->snr_dcr2 = 0;
|
||||
|
||||
sc->slotno = 9;
|
||||
|
||||
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->snr_dcr |= DCR_EXBUS;
|
||||
sc->bitmode = 1;
|
||||
break;
|
||||
|
||||
case MACH_MACLC575:
|
||||
case MACH_MACQ630:
|
||||
break;
|
||||
|
||||
case MACH_MACPB500:
|
||||
sc->snr_dcr |= DCR_SYNC | DCR_LBR;
|
||||
sc->bitmode = 0; /* 16 bit interface */
|
||||
break;
|
||||
|
||||
default:
|
||||
printf(": unsupported machine type\n");
|
||||
return;
|
||||
}
|
||||
|
||||
sc->sc_regt = oa->oa_tag;
|
||||
|
||||
if (bus_space_map(sc->sc_regt,
|
||||
SONIC_REG_BASE, SN_REGSIZE, 0, &sc->sc_regh)) {
|
||||
printf(": failed to map space for SONIC regs.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* regs are addressed as words, big-endian. */
|
||||
for (i = 0; i < SN_NREGS; i++) {
|
||||
sc->sc_reg_map[i] = (bus_size_t)((i * 4) + 2);
|
||||
}
|
||||
|
||||
/*
|
||||
* Kind of kludge this. Comm-slot cards do not really
|
||||
* have a visible type, as far as I can tell at this time,
|
||||
* so assume that MacOS had it properly configured and use
|
||||
* that configuration.
|
||||
*/
|
||||
switch (current_mac_model->machineid) {
|
||||
case MACH_MACLC575:
|
||||
case MACH_MACQ630:
|
||||
NIC_PUT(sc, SNR_CR, CR_RST); wbflush();
|
||||
i = NIC_GET(sc, SNR_DCR);
|
||||
sc->snr_dcr |= (i & 0xfff0);
|
||||
sc->bitmode = (i & DCR_DW) ? 1 : 0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (sn_obio_getaddr(sc, myaddr) &&
|
||||
sn_obio_getaddr_kludge(sc, myaddr)) { /* XXX kludge for PB */
|
||||
printf(": failed to get MAC address.\n");
|
||||
bus_space_unmap(sc->sc_regt, sc->sc_regh, SN_REGSIZE);
|
||||
return;
|
||||
}
|
||||
|
||||
/* snsetup returns 1 if something fails */
|
||||
if (snsetup(sc, myaddr)) {
|
||||
bus_space_unmap(sc->sc_regt, sc->sc_regh, SN_REGSIZE);
|
||||
return;
|
||||
}
|
||||
|
||||
add_nubus_intr(sc->slotno, snintr, (void *)sc);
|
||||
}
|
||||
|
||||
static int
|
||||
sn_obio_getaddr(sc, lladdr)
|
||||
struct sn_softc *sc;
|
||||
u_int8_t *lladdr;
|
||||
{
|
||||
bus_space_handle_t bsh;
|
||||
|
||||
if (bus_space_map(sc->sc_regt, SONIC_PROM_BASE, NBPG, 0, &bsh)) {
|
||||
printf(": failed to map space to read SONIC address.\n%s",
|
||||
sc->sc_dev.dv_xname);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if (!mac68k_bus_space_probe(sc->sc_regt, bsh, 0, 1)) {
|
||||
bus_space_unmap(sc->sc_regt, bsh, NBPG);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
sn_get_enaddr(sc->sc_regt, bsh, 0, lladdr);
|
||||
|
||||
bus_space_unmap(sc->sc_regt, bsh, NBPG);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* 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(sc, lladdr)
|
||||
struct sn_softc *sc;
|
||||
u_int8_t *lladdr;
|
||||
{
|
||||
int i, ors = 0;
|
||||
|
||||
/* Shut down NIC */
|
||||
NIC_PUT(sc, SNR_CR, CR_RST);
|
||||
wbflush();
|
||||
|
||||
NIC_PUT(sc, SNR_CEP, 15); /* For some reason, Apple fills top first. */
|
||||
wbflush();
|
||||
i = NIC_GET(sc, SNR_CAP2);
|
||||
wbflush();
|
||||
|
||||
ors |= i;
|
||||
lladdr[5] = i >> 8;
|
||||
lladdr[4] = i;
|
||||
|
||||
i = NIC_GET(sc, SNR_CAP1);
|
||||
wbflush();
|
||||
|
||||
ors |= i;
|
||||
lladdr[3] = i >> 8;
|
||||
lladdr[2] = i;
|
||||
|
||||
i = NIC_GET(sc, SNR_CAP0);
|
||||
wbflush();
|
||||
|
||||
ors |= i;
|
||||
lladdr[1] = i >> 8;
|
||||
lladdr[0] = i;
|
||||
|
||||
NIC_PUT(sc, SNR_CR, 0);
|
||||
wbflush();
|
||||
|
||||
if (ors == 0)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ite.c,v 1.42 1998/01/12 19:22:11 thorpej Exp $ */
|
||||
/* $NetBSD: ite.c,v 1.43 1998/05/02 16:45:29 scottr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
|
@ -79,7 +79,7 @@
|
|||
#include <vm/pmap.h>
|
||||
|
||||
#include <mac68k/mac68k/macrom.h>
|
||||
#include <mac68k/dev/nubus.h>
|
||||
#include <mac68k/nubus/nubus.h>
|
||||
#include <mac68k/dev/itevar.h>
|
||||
#include <mac68k/dev/grfvar.h>
|
||||
|
||||
|
|
|
@ -1,784 +0,0 @@
|
|||
/* $NetBSD: nubus.c,v 1.43 1998/01/13 19:24:56 scottr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995, 1996 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.
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/buf.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/dmap.h>
|
||||
|
||||
#include <vm/vm.h>
|
||||
#include <vm/vm_kern.h>
|
||||
#include <vm/vm_map.h>
|
||||
|
||||
#include <machine/autoconf.h>
|
||||
#include <machine/bus.h>
|
||||
#include <machine/vmparam.h>
|
||||
#include <machine/param.h>
|
||||
#include <machine/cpu.h>
|
||||
#include <machine/pte.h>
|
||||
#include <machine/viareg.h>
|
||||
|
||||
#include <vm/vm.h>
|
||||
|
||||
#include <mac68k/dev/nubus.h>
|
||||
|
||||
#ifdef DEBUG
|
||||
#define NDB_PROBE 0x1
|
||||
#define NDB_FOLLOW 0x2
|
||||
#define NDB_ARITH 0x4
|
||||
static int nubus_debug = 0 /* | NDB_PROBE */;
|
||||
#endif
|
||||
|
||||
static int nubus_print __P((void *, const char *));
|
||||
static int nubus_match __P((struct device *, struct cfdata *, void *));
|
||||
static void nubus_attach __P((struct device *, struct device *, void *));
|
||||
static int nubus_video_resource __P((int));
|
||||
|
||||
static int nubus_probe_slot __P((bus_space_tag_t, bus_space_handle_t,
|
||||
int, nubus_slot *));
|
||||
static u_int32_t nubus_calc_CRC __P((bus_space_tag_t, bus_space_handle_t,
|
||||
nubus_slot *));
|
||||
|
||||
static u_long nubus_adjust_ptr __P((u_int8_t, u_long, long));
|
||||
static u_int8_t nubus_read_1 __P((bus_space_tag_t, bus_space_handle_t,
|
||||
u_int8_t, u_long));
|
||||
#ifdef notyet
|
||||
static u_int16_t nubus_read_2 __P((bus_space_tag_t, bus_space_handle_t,
|
||||
u_int8_t, u_long));
|
||||
#endif
|
||||
static u_int32_t nubus_read_4 __P((bus_space_tag_t, bus_space_handle_t,
|
||||
u_int8_t, u_long));
|
||||
|
||||
struct cfattach nubus_ca = {
|
||||
sizeof(struct nubus_softc), nubus_match, nubus_attach
|
||||
};
|
||||
|
||||
static int
|
||||
nubus_match(parent, cf, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *cf;
|
||||
void *aux;
|
||||
{
|
||||
static int nubus_matched = 0;
|
||||
|
||||
/* Allow only one instance. */
|
||||
if (nubus_matched)
|
||||
return (0);
|
||||
|
||||
nubus_matched = 1;
|
||||
return (1);
|
||||
}
|
||||
|
||||
static void
|
||||
nubus_attach(parent, self, aux)
|
||||
struct device *parent, *self;
|
||||
void *aux;
|
||||
{
|
||||
struct nubus_attach_args na_args;
|
||||
bus_space_tag_t bst;
|
||||
bus_space_handle_t bsh;
|
||||
nubus_slot fmtblock;
|
||||
nubus_dir dir;
|
||||
nubus_dirent dirent;
|
||||
nubus_type slottype;
|
||||
u_long entry;
|
||||
int i, rsrcid;
|
||||
u_int8_t lanes;
|
||||
|
||||
printf("\n");
|
||||
|
||||
for (i = NUBUS_MIN_SLOT; i <= NUBUS_MAX_SLOT; i++) {
|
||||
na_args.slot = i;
|
||||
na_args.na_tag = bst = MAC68K_BUS_SPACE_MEM;
|
||||
|
||||
if (bus_space_map(bst,
|
||||
NUBUS_SLOT2PA(na_args.slot), NBMEMSIZE, 0, &bsh)) {
|
||||
#ifdef DIAGNOSTIC
|
||||
printf("%s: failed to map slot %x, address %p\n",
|
||||
self->dv_xname, i, (void *)NUBUS_SLOT2PA(i));
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
|
||||
if (nubus_probe_slot(bst, bsh, i, &fmtblock) <= 0) {
|
||||
notfound:
|
||||
bus_space_unmap(bst, bsh, NBMEMSIZE);
|
||||
continue;
|
||||
}
|
||||
|
||||
rsrcid = 0x80;
|
||||
lanes = fmtblock.bytelanes;
|
||||
|
||||
nubus_get_main_dir(&fmtblock, &dir);
|
||||
|
||||
/*
|
||||
* Get the resource for the first function on the card.
|
||||
* This is assumed to be at resource ID 0x80. If we can
|
||||
* not find this entry (as we can not on some video cards),
|
||||
* check to see if we can get a different ID from the list
|
||||
* of video resources given to us by the booter. If that
|
||||
* doesn't work either, take the first resource following
|
||||
* the board resource.
|
||||
*/
|
||||
if (nubus_find_rsrc(bst, bsh,
|
||||
&fmtblock, &dir, rsrcid, &dirent) <= 0) {
|
||||
if ((rsrcid = nubus_video_resource(i)) == -1) {
|
||||
/*
|
||||
* Since nubus_find_rsrc failed, the directory
|
||||
* is back at its base.
|
||||
*/
|
||||
entry = dir.curr_ent;
|
||||
|
||||
/*
|
||||
* All nubus cards should have a board
|
||||
* resource, but be sure that's what it
|
||||
* is before we skip it.
|
||||
*/
|
||||
rsrcid = nubus_read_1(bst, bsh,
|
||||
lanes, entry);
|
||||
if (rsrcid == 0x1)
|
||||
entry = nubus_adjust_ptr(lanes,
|
||||
dir.curr_ent, 4);
|
||||
|
||||
rsrcid = nubus_read_1(bst, bsh, lanes, entry);
|
||||
#ifdef DEBUG
|
||||
if (nubus_debug & NDB_FOLLOW)
|
||||
printf("\tUsing rsrc 0x%x.\n", rsrcid);
|
||||
#endif
|
||||
if (rsrcid == 0xff) /* end of chain */
|
||||
goto notfound;
|
||||
}
|
||||
/*
|
||||
* Try to find the resource passed by the booter
|
||||
* or the one we just tracked down.
|
||||
*/
|
||||
if (nubus_find_rsrc(bst, bsh,
|
||||
&fmtblock, &dir, rsrcid, &dirent) <= 0)
|
||||
goto notfound;
|
||||
}
|
||||
|
||||
nubus_get_dir_from_rsrc(&fmtblock, &dirent, &dir);
|
||||
|
||||
if (nubus_find_rsrc(bst, bsh,
|
||||
&fmtblock, &dir, NUBUS_RSRC_TYPE, &dirent) <= 0)
|
||||
goto notfound;
|
||||
|
||||
if (nubus_get_ind_data(bst, bsh, &fmtblock, &dirent,
|
||||
(caddr_t)&slottype, sizeof(nubus_type)) <= 0)
|
||||
goto notfound;
|
||||
|
||||
/*
|
||||
* If this is a display card, try to pull out the correct
|
||||
* display mode as passed by the booter.
|
||||
*/
|
||||
if (slottype.category == NUBUS_CATEGORY_DISPLAY) {
|
||||
int r;
|
||||
|
||||
if ((r = nubus_video_resource(i)) != -1) {
|
||||
|
||||
nubus_get_main_dir(&fmtblock, &dir);
|
||||
|
||||
if (nubus_find_rsrc(bst, bsh,
|
||||
&fmtblock, &dir, r, &dirent) <= 0)
|
||||
goto notfound;
|
||||
|
||||
nubus_get_dir_from_rsrc(&fmtblock,
|
||||
&dirent, &dir);
|
||||
|
||||
if (nubus_find_rsrc(bst, bsh, &fmtblock, &dir,
|
||||
NUBUS_RSRC_TYPE, &dirent) <= 0)
|
||||
goto notfound;
|
||||
|
||||
if (nubus_get_ind_data(bst, bsh,
|
||||
&fmtblock, &dirent, (caddr_t)&slottype,
|
||||
sizeof(nubus_type)) <= 0)
|
||||
goto notfound;
|
||||
|
||||
rsrcid = r;
|
||||
}
|
||||
}
|
||||
|
||||
na_args.slot = i;
|
||||
na_args.rsrcid = rsrcid;
|
||||
na_args.category = slottype.category;
|
||||
na_args.type = slottype.type;
|
||||
na_args.drsw = slottype.drsw;
|
||||
na_args.drhw = slottype.drhw;
|
||||
na_args.fmt = &fmtblock;
|
||||
|
||||
bus_space_unmap(bst, bsh, NBMEMSIZE);
|
||||
|
||||
config_found(self, &na_args, nubus_print);
|
||||
}
|
||||
|
||||
enable_nubus_intr();
|
||||
}
|
||||
|
||||
static int
|
||||
nubus_print(aux, pnp)
|
||||
void *aux;
|
||||
const char *pnp;
|
||||
{
|
||||
struct nubus_attach_args *na = (struct nubus_attach_args *)aux;
|
||||
bus_space_tag_t bst = na->na_tag;
|
||||
bus_space_handle_t bsh;
|
||||
|
||||
if (pnp) {
|
||||
printf("%s slot %x", pnp, na->slot);
|
||||
if (bus_space_map(bst,
|
||||
NUBUS_SLOT2PA(na->slot), NBMEMSIZE, 0, &bsh) == 0) {
|
||||
printf(": %s", nubus_get_card_name(bst, bsh, na->fmt));
|
||||
printf(" (Vendor: %s,", nubus_get_vendor(bst, bsh,
|
||||
na->fmt, NUBUS_RSRC_VEND_ID));
|
||||
printf(" Part: %s)", nubus_get_vendor(bst, bsh,
|
||||
na->fmt, NUBUS_RSRC_VEND_PART));
|
||||
bus_space_unmap(bst, bsh, NBMEMSIZE);
|
||||
}
|
||||
#ifdef DIAGNOSTIC
|
||||
else
|
||||
printf(":");
|
||||
printf(" Type: %04x %04x %04x %04x",
|
||||
na->category, na->type, na->drsw, na->drhw);
|
||||
#endif
|
||||
} else {
|
||||
printf(" slot %x", na->slot);
|
||||
}
|
||||
return (UNCONF);
|
||||
}
|
||||
|
||||
static int
|
||||
nubus_video_resource(slot)
|
||||
int slot;
|
||||
{
|
||||
extern u_int16_t mac68k_vrsrc_vec[];
|
||||
int i;
|
||||
|
||||
for (i = 0 ; i < 6 ; i++)
|
||||
if ((mac68k_vrsrc_vec[i] & 0xff) == slot)
|
||||
return ((mac68k_vrsrc_vec[i] >> 8) & 0xff);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Probe a given nubus slot. If a card is there and we can get the
|
||||
* format block from it's clutching decl. ROMs, fill the format block
|
||||
* and return non-zero. If we can't find a card there with a valid
|
||||
* decl. ROM, return 0.
|
||||
*
|
||||
* First, we check to see if we can access the memory at the tail
|
||||
* end of the slot. If so, then we check for a bytelanes byte. We
|
||||
* could probably just return a failure status if we bus error on
|
||||
* the first try, but there really is little reason not to go ahead
|
||||
* and check the other three locations in case there's a wierd card
|
||||
* out there.
|
||||
*
|
||||
* Checking for a card involves locating the "bytelanes" byte which
|
||||
* tells us how to interpret the declaration ROM's data. The format
|
||||
* block is at the top of the card's standard memory space and the
|
||||
* bytelanes byte is at the end of that block.
|
||||
*
|
||||
* After some inspection of the bytelanes byte, it appears that it
|
||||
* takes the form 0xXY where Y is a bitmask of the bytelanes in use
|
||||
* and X is a bitmask of the lanes to ignore. Hence, (X ^ Y) == 0
|
||||
* and (less obviously), Y will have the upper N bits clear if it is
|
||||
* found N bytes from the last possible location. Both that and
|
||||
* the exclusive-or check are made.
|
||||
*
|
||||
* If a valid
|
||||
*/
|
||||
static u_int8_t nbits[] = {0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4};
|
||||
static int
|
||||
nubus_probe_slot(bst, bsh, slot, fmt)
|
||||
bus_space_tag_t bst;
|
||||
bus_space_handle_t bsh;
|
||||
int slot;
|
||||
nubus_slot *fmt;
|
||||
{
|
||||
u_long ofs, hdr;
|
||||
int i, j, found, hdr_size;
|
||||
u_int8_t lanes;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (nubus_debug & NDB_PROBE)
|
||||
printf("probing slot %x\n", slot);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The idea behind this glorious work of art is to probe for only
|
||||
* valid bytelanes values at appropriate locations (see DC&D p. 159
|
||||
* for a list). Note the pattern: the first 8 values are at offset
|
||||
* 0xffffff in the slot's space; the next 4 values at 0xfffffe; the
|
||||
* next 2 values at 0xfffffd; and the last one at 0xfffffc.
|
||||
*
|
||||
* The nested loops implement an efficient search of this space,
|
||||
* probing first for a valid address, then checking for each of the
|
||||
* valid bytelanes values at that address.
|
||||
*/
|
||||
ofs = NBMEMSIZE;
|
||||
lanes = 0xf;
|
||||
|
||||
for (j = 8, found = 0; j > 0 && !found; j >>= 1) {
|
||||
ofs--;
|
||||
for (i = j; i > 0; i--, lanes--) {
|
||||
if (!mac68k_bus_space_probe(bst, bsh, ofs, 1)) {
|
||||
lanes -= i;
|
||||
break;
|
||||
}
|
||||
if (bus_space_read_1(bst, bsh, ofs) ==
|
||||
(((~lanes & 0xf) << 4) | lanes)) {
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
#ifdef DEBUG
|
||||
if (nubus_debug & NDB_PROBE)
|
||||
printf("bytelanes not found for slot %x\n", slot);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
fmt->bytelanes = lanes;
|
||||
fmt->step = nbits[(lanes & 0x0f)];
|
||||
fmt->slot = slot; /* XXX redundant; get rid of this someday */
|
||||
|
||||
#ifdef DEBUG
|
||||
if (nubus_debug & NDB_PROBE)
|
||||
printf("bytelanes of 0x%x found for slot 0x%x.\n",
|
||||
fmt->bytelanes, slot);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Go ahead and attempt to load format header.
|
||||
* First, we need to find the first byte beyond memory that
|
||||
* would be valid. This is necessary for NUBUS_ROM_offset()
|
||||
* to work.
|
||||
*/
|
||||
hdr = NBMEMSIZE;
|
||||
hdr_size = 20;
|
||||
|
||||
i = 0x10 | (lanes & 0x0f);
|
||||
while ((i & 1) == 0) {
|
||||
hdr++;
|
||||
i >>= 1;
|
||||
}
|
||||
fmt->top = hdr;
|
||||
hdr = nubus_adjust_ptr(lanes, hdr, -hdr_size);
|
||||
#ifdef DEBUG
|
||||
if (nubus_debug & NDB_PROBE)
|
||||
printf("fmt->top is 0x%lx, that minus 0x%x puts us at 0x%lx.\n",
|
||||
fmt->top, hdr_size, hdr);
|
||||
if (nubus_debug & NDB_ARITH)
|
||||
for (i = 1 ; i < 8 ; i++)
|
||||
printf("0x%lx - 0x%x = 0x%lx, + 0x%x = 0x%lx.\n",
|
||||
hdr, i, nubus_adjust_ptr(lanes, hdr, -i),
|
||||
i, nubus_adjust_ptr(lanes, hdr, i));
|
||||
#endif
|
||||
|
||||
fmt->directory_offset =
|
||||
0xff000000 | nubus_read_4(bst, bsh, lanes, hdr);
|
||||
hdr = nubus_adjust_ptr(lanes, hdr, 4);
|
||||
fmt->length = nubus_read_4(bst, bsh, lanes, hdr);
|
||||
hdr = nubus_adjust_ptr(lanes, hdr, 4);
|
||||
fmt->crc = nubus_read_4(bst, bsh, lanes, hdr);
|
||||
hdr = nubus_adjust_ptr(lanes, hdr, 4);
|
||||
fmt->revision_level = nubus_read_1(bst, bsh, lanes, hdr);
|
||||
hdr = nubus_adjust_ptr(lanes, hdr, 1);
|
||||
fmt->format = nubus_read_1(bst, bsh, lanes, hdr);
|
||||
hdr = nubus_adjust_ptr(lanes, hdr, 1);
|
||||
fmt->test_pattern = nubus_read_4(bst, bsh, lanes, hdr);
|
||||
|
||||
#ifdef DEBUG
|
||||
if (nubus_debug & NDB_PROBE) {
|
||||
printf("Directory offset 0x%x\t", fmt->directory_offset);
|
||||
printf("Length 0x%x\t", fmt->length);
|
||||
printf("CRC 0x%x\n", fmt->crc);
|
||||
printf("Revision level 0x%x\t", fmt->revision_level);
|
||||
printf("Format 0x%x\t", fmt->format);
|
||||
printf("Test Pattern 0x%x\n", fmt->test_pattern);
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((fmt->directory_offset & 0x00ff0000) == 0) {
|
||||
printf("Invalid looking directory offset (0x%x)!\n",
|
||||
fmt->directory_offset);
|
||||
return 0;
|
||||
}
|
||||
if (fmt->test_pattern != NUBUS_ROM_TEST_PATTERN) {
|
||||
printf("Nubus--test pattern invalid:\n");
|
||||
printf(" slot 0x%x, bytelanes 0x%x?\n", fmt->slot, lanes);
|
||||
printf(" read test 0x%x, compare with 0x%x.\n",
|
||||
fmt->test_pattern, NUBUS_ROM_TEST_PATTERN);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Perform CRC */
|
||||
if (fmt->crc != nubus_calc_CRC(bst, bsh, fmt)) {
|
||||
printf("Nubus--crc check failed, slot 0x%x.\n", fmt->slot);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static u_int32_t
|
||||
nubus_calc_CRC(bst, bsh, fmt)
|
||||
bus_space_tag_t bst;
|
||||
bus_space_handle_t bsh;
|
||||
nubus_slot *fmt;
|
||||
{
|
||||
#if 0
|
||||
u_long base, ptr, crc_loc;
|
||||
u_int32_t sum;
|
||||
u_int8_t lanes = fmt->bytelanes;
|
||||
|
||||
base = fmt->top;
|
||||
crc_loc = NUBUS_ROM_offset(fmt, base, -12);
|
||||
ptr = NUBUS_ROM_offset(fmt, base, -fmt->length);
|
||||
|
||||
sum = 0;
|
||||
while (ptr < base)
|
||||
roll #1, sum
|
||||
if (ptr == crc_loc) {
|
||||
roll #3, sum
|
||||
ptr = nubus_adjust_ptr(lanes, ptr, 3);
|
||||
} else {
|
||||
sum += nubus_read_1(bst, bsh, lanes, ptr);
|
||||
}
|
||||
ptr = nubus_adjust_ptr(lanes, ptr, 1);
|
||||
}
|
||||
|
||||
return sum;
|
||||
#endif
|
||||
return fmt->crc;
|
||||
}
|
||||
|
||||
/*
|
||||
* Compute byte offset on card, taking into account bytelanes.
|
||||
* Base must be on a valid bytelane for this function to work.
|
||||
* Return the new address.
|
||||
*
|
||||
* XXX -- There has GOT to be a better way to do this.
|
||||
*/
|
||||
static u_long
|
||||
nubus_adjust_ptr(lanes, base, amt)
|
||||
u_int8_t lanes;
|
||||
u_long base;
|
||||
long amt;
|
||||
{
|
||||
u_int8_t b, t;
|
||||
|
||||
if (!amt)
|
||||
return base;
|
||||
|
||||
if (amt < 0) {
|
||||
amt = -amt;
|
||||
b = lanes;
|
||||
t = (b << 4);
|
||||
b <<= (3 - (base & 0x3));
|
||||
while (amt) {
|
||||
b <<= 1;
|
||||
if (b == t)
|
||||
b = lanes;
|
||||
if (b & 0x08)
|
||||
amt--;
|
||||
base--;
|
||||
}
|
||||
return base;
|
||||
}
|
||||
|
||||
t = (lanes & 0xf) | 0x10;
|
||||
b = t >> (base & 0x3);
|
||||
while (amt) {
|
||||
b >>= 1;
|
||||
if (b == 1)
|
||||
b = t;
|
||||
if (b & 1)
|
||||
amt--;
|
||||
base++;
|
||||
}
|
||||
|
||||
return base;
|
||||
}
|
||||
|
||||
static u_int8_t
|
||||
nubus_read_1(bst, bsh, lanes, ofs)
|
||||
bus_space_tag_t bst;
|
||||
bus_space_handle_t bsh;
|
||||
u_int8_t lanes;
|
||||
u_long ofs;
|
||||
{
|
||||
return bus_space_read_1(bst, bsh, ofs);
|
||||
}
|
||||
|
||||
#ifdef notyet
|
||||
/* Nothing uses this, yet */
|
||||
static u_int16_t
|
||||
nubus_read_2(bst, bsh, lanes, ofs)
|
||||
bus_space_tag_t bst;
|
||||
bus_space_handle_t bsh;
|
||||
u_int8_t lanes;
|
||||
u_long ofs;
|
||||
{
|
||||
u_int16_t s;
|
||||
|
||||
s = (nubus_read_1(bst, bsh, lanes, ofs) << 8);
|
||||
ofs = nubus_adjust_ptr(lanes, ofs, 1);
|
||||
s |= nubus_read_1(bst, bsh, lanes, ofs);
|
||||
return s;
|
||||
}
|
||||
#endif
|
||||
|
||||
static u_int32_t
|
||||
nubus_read_4(bst, bsh, lanes, ofs)
|
||||
bus_space_tag_t bst;
|
||||
bus_space_handle_t bsh;
|
||||
u_int8_t lanes;
|
||||
u_long ofs;
|
||||
{
|
||||
u_int32_t l;
|
||||
int i;
|
||||
|
||||
l = 0;
|
||||
for (i = 0; i < 4; i++) {
|
||||
l = (l << 8) | nubus_read_1(bst, bsh, lanes, ofs);
|
||||
ofs = nubus_adjust_ptr(lanes, ofs, 1);
|
||||
}
|
||||
return l;
|
||||
}
|
||||
|
||||
void
|
||||
nubus_get_main_dir(fmt, dir_return)
|
||||
nubus_slot *fmt;
|
||||
nubus_dir *dir_return;
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if (nubus_debug & NDB_FOLLOW)
|
||||
printf("nubus_get_main_dir(%p, %p)\n",
|
||||
fmt, dir_return);
|
||||
#endif
|
||||
dir_return->dirbase = nubus_adjust_ptr(fmt->bytelanes, fmt->top,
|
||||
fmt->directory_offset - 20);
|
||||
dir_return->curr_ent = dir_return->dirbase;
|
||||
}
|
||||
|
||||
void
|
||||
nubus_get_dir_from_rsrc(fmt, dirent, dir_return)
|
||||
nubus_slot *fmt;
|
||||
nubus_dirent *dirent;
|
||||
nubus_dir *dir_return;
|
||||
{
|
||||
u_long loc;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (nubus_debug & NDB_FOLLOW)
|
||||
printf("nubus_get_dir_from_rsrc(%p, %p, %p).\n",
|
||||
fmt, dirent, dir_return);
|
||||
#endif
|
||||
if ((loc = dirent->offset) & 0x800000) {
|
||||
loc |= 0xff000000;
|
||||
}
|
||||
dir_return->dirbase =
|
||||
nubus_adjust_ptr(fmt->bytelanes, dirent->myloc, loc);
|
||||
dir_return->curr_ent = dir_return->dirbase;
|
||||
}
|
||||
|
||||
int
|
||||
nubus_find_rsrc(bst, bsh, fmt, dir, rsrcid, dirent_return)
|
||||
bus_space_tag_t bst;
|
||||
bus_space_handle_t bsh;
|
||||
nubus_slot *fmt;
|
||||
nubus_dir *dir;
|
||||
u_int8_t rsrcid;
|
||||
nubus_dirent *dirent_return;
|
||||
{
|
||||
u_long entry;
|
||||
u_int8_t byte, lanes = fmt->bytelanes;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (nubus_debug & NDB_FOLLOW)
|
||||
printf("nubus_find_rsrc(%p, %p, 0x%x, %p)\n",
|
||||
fmt, dir, rsrcid, dirent_return);
|
||||
#endif
|
||||
if (fmt->test_pattern != NUBUS_ROM_TEST_PATTERN)
|
||||
return -1;
|
||||
|
||||
entry = dir->curr_ent;
|
||||
do {
|
||||
byte = nubus_read_1(bst, bsh, lanes, entry);
|
||||
#ifdef DEBUG
|
||||
if (nubus_debug & NDB_FOLLOW)
|
||||
printf("\tFound rsrc 0x%x.\n", byte);
|
||||
#endif
|
||||
if (byte == rsrcid) {
|
||||
dirent_return->myloc = entry;
|
||||
dirent_return->rsrc_id = rsrcid;
|
||||
entry = nubus_read_4(bst, bsh, lanes, entry);
|
||||
dirent_return->offset = (entry & 0x00ffffff);
|
||||
return 1;
|
||||
}
|
||||
if (byte == 0xff) {
|
||||
entry = dir->dirbase;
|
||||
} else {
|
||||
entry = nubus_adjust_ptr(lanes, entry, 4);
|
||||
}
|
||||
} while (entry != (u_long)dir->curr_ent);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
nubus_get_ind_data(bst, bsh, fmt, dirent, data_return, nbytes)
|
||||
bus_space_tag_t bst;
|
||||
bus_space_handle_t bsh;
|
||||
nubus_slot *fmt;
|
||||
nubus_dirent *dirent;
|
||||
caddr_t data_return;
|
||||
int nbytes;
|
||||
{
|
||||
u_long loc;
|
||||
u_int8_t lanes = fmt->bytelanes;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (nubus_debug & NDB_FOLLOW)
|
||||
printf("nubus_get_ind_data(%p, %p, %p, %d).\n",
|
||||
fmt, dirent, data_return, nbytes);
|
||||
#endif
|
||||
if ((loc = dirent->offset) & 0x800000) {
|
||||
loc |= 0xff000000;
|
||||
}
|
||||
loc = nubus_adjust_ptr(lanes, dirent->myloc, loc);
|
||||
|
||||
while (nbytes--) {
|
||||
*data_return++ = nubus_read_1(bst, bsh, lanes, loc);
|
||||
loc = nubus_adjust_ptr(lanes, loc, 1);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
nubus_get_c_string(bst, bsh, fmt, dirent, data_return, max_bytes)
|
||||
bus_space_tag_t bst;
|
||||
bus_space_handle_t bsh;
|
||||
nubus_slot *fmt;
|
||||
nubus_dirent *dirent;
|
||||
caddr_t data_return;
|
||||
int max_bytes;
|
||||
{
|
||||
u_long loc;
|
||||
u_int8_t lanes = fmt->bytelanes;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (nubus_debug & NDB_FOLLOW)
|
||||
printf("nubus_get_c_string(%p, %p, %p, %d).\n",
|
||||
fmt, dirent, data_return, max_bytes);
|
||||
#endif
|
||||
if ((loc = dirent->offset) & 0x800000)
|
||||
loc |= 0xff000000;
|
||||
|
||||
loc = nubus_adjust_ptr(lanes, dirent->myloc, loc);
|
||||
|
||||
*data_return = '\0';
|
||||
while (max_bytes--) {
|
||||
if ((*data_return++ =
|
||||
nubus_read_1(bst, bsh, lanes, loc)) == 0)
|
||||
return 1;
|
||||
loc = nubus_adjust_ptr(lanes, loc, 1);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static char *huh = "???";
|
||||
|
||||
char *
|
||||
nubus_get_vendor(bst, bsh, fmt, rsrc)
|
||||
bus_space_tag_t bst;
|
||||
bus_space_handle_t bsh;
|
||||
nubus_slot *fmt;
|
||||
int rsrc;
|
||||
{
|
||||
static char str_ret[64];
|
||||
nubus_dir dir;
|
||||
nubus_dirent ent;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (nubus_debug & NDB_FOLLOW)
|
||||
printf("nubus_get_vendor(%p, 0x%x).\n", fmt, rsrc);
|
||||
#endif
|
||||
nubus_get_main_dir(fmt, &dir);
|
||||
if (nubus_find_rsrc(bst, bsh, fmt, &dir, 1, &ent) <= 0)
|
||||
return huh;
|
||||
nubus_get_dir_from_rsrc(fmt, &ent, &dir);
|
||||
|
||||
if (nubus_find_rsrc(bst, bsh, fmt, &dir, NUBUS_RSRC_VENDORINFO, &ent)
|
||||
<= 0)
|
||||
return huh;
|
||||
nubus_get_dir_from_rsrc(fmt, &ent, &dir);
|
||||
|
||||
if (nubus_find_rsrc(bst, bsh, fmt, &dir, rsrc, &ent) <= 0)
|
||||
return huh;
|
||||
|
||||
nubus_get_c_string(bst, bsh, fmt, &ent, str_ret, 64);
|
||||
|
||||
return str_ret;
|
||||
}
|
||||
|
||||
char *
|
||||
nubus_get_card_name(bst, bsh, fmt)
|
||||
bus_space_tag_t bst;
|
||||
bus_space_handle_t bsh;
|
||||
nubus_slot *fmt;
|
||||
{
|
||||
static char name_ret[64];
|
||||
nubus_dir dir;
|
||||
nubus_dirent ent;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (nubus_debug & NDB_FOLLOW)
|
||||
printf("nubus_get_card_name(%p).\n", fmt);
|
||||
#endif
|
||||
nubus_get_main_dir(fmt, &dir);
|
||||
|
||||
if (nubus_find_rsrc(bst, bsh, fmt, &dir, 1, &ent) <= 0)
|
||||
return huh;
|
||||
|
||||
nubus_get_dir_from_rsrc(fmt, &ent, &dir);
|
||||
|
||||
if (nubus_find_rsrc(bst, bsh, fmt, &dir, NUBUS_RSRC_NAME, &ent) <= 0)
|
||||
return huh;
|
||||
|
||||
nubus_get_c_string(bst, bsh, fmt, &ent, name_ret, 64);
|
||||
|
||||
return name_ret;
|
||||
}
|
|
@ -1,287 +0,0 @@
|
|||
/* $NetBSD: nubus.h,v 1.37 1998/04/26 16:47:40 briggs Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Nubus cards in Macintoshes are identified by 4 16-bit numbers:
|
||||
* Category: What is the main purpose of this card?
|
||||
* Type: Within this overall category, what kind of card?
|
||||
* DrSW: What software interface does it use?
|
||||
* DrHW: What specific hardware is it?
|
||||
*
|
||||
* For example, the "Toby Frame Buffer" display card is
|
||||
* Category 3 (display)
|
||||
* Type 1 (video)
|
||||
* DrSW 1 (Apple)
|
||||
* and DrHW 1 (TFB).
|
||||
*/
|
||||
|
||||
#include <machine/cpu.h>
|
||||
|
||||
#define NUBUS_CATEGORY_BOARD 0x0001
|
||||
|
||||
#define NUBUS_CATEGORY_DISPLAY 0x0003
|
||||
#define NUBUS_TYPE_VIDEO 0x0001
|
||||
#define NUBUS_TYPE_LCD 0x0002
|
||||
#define NUBUS_DRSW_APPLE 0x0001
|
||||
#define NUBUS_DRHW_TFB 0x0001 /* Apple Toby Frame Buffer */
|
||||
#define NUBUS_DRHW_WVC 0x0006 /* Apple Workstation Video Card */
|
||||
#define NUBUS_DRHW_COLORMAX 0x0007 /* Sigma Designs ColorMax */
|
||||
#define NUBUS_DRHW_SE30 0x0009 /* Apple SE/30 pseudo-slot video */
|
||||
#define NUBUS_DRHW_M2HRVC 0x0013 /* Apple Mac II High-Res Video Card */
|
||||
#define NUBUS_DRHW_PVC 0x0017 /* Apple Mac II Portrait Video Card */
|
||||
#define NUBUS_DRHW_MDC 0x0019 /* Apple Macintosh Display Card */
|
||||
#define NUBUS_DRHW_SUPRGFX 0x0105 /* SuperMac GFX */
|
||||
#define NUBUS_DRHW_FORMAC 0x013A /* Formac color card II */
|
||||
#define NUBUS_DRHW_CB264 0x013B /* RasterOps ColorBoard 264 */
|
||||
#define NUBUS_DRHW_MICRON 0x0146
|
||||
#define NUBUS_DRHW_SPECTRM8 0x017b /* SuperMac Spectrum/8 Series III */
|
||||
#define NUBUS_DRHW_SPECTRUM 0x017c /* SuperMac Spectrum/24 Series III */
|
||||
#define NUBUS_DRHW_CB364 0x026F /* RasterOps ColorBoard 364 */
|
||||
#define NUBUS_DRHW_RPC8 0x0291 /* Radius PrecisionColor 8 */
|
||||
#define NUBUS_DRHW_LAPIS 0x0292 /* SE/30 Lapis ProColorServer 8 PDS */
|
||||
#define NUBUS_DRHW_ROPS24LXI 0x02A0 /* RasterOps 8/24 XLi */
|
||||
#define NUBUS_DRHW_FUTURASX 0x02AE /* E-Machines Futura-SX */
|
||||
#define NUBUS_DRHW_THUNDER24 0x02CB /* SuperMac Thunder/24 */
|
||||
#define NUBUS_DRHW_RPC24XP 0x0406 /* Radius PrecisionColor 24Xp */
|
||||
#define NUBUS_DRHW_RPC8XJ 0x040B /* Radius PrecisionColor 8xj */
|
||||
#define NUBUS_DRHW_FIILX 0x0417 /* Futura II LX */
|
||||
#define NUBUS_DRHW_FIISXDSP 0x042F /* Futura II SX/DSP */
|
||||
|
||||
/* False DrHW values for video cards masquerading as other cards */
|
||||
#define NUBUS_DRHW_SAM768 0x10000 /* Cornerstone/Samsung 768x1006 */
|
||||
|
||||
#define NUBUS_CATEGORY_NETWORK 0x0004
|
||||
#define NUBUS_TYPE_ETHERNET 0x0001
|
||||
#define NUBUS_DRSW_3COM 0x0000
|
||||
#define NUBUS_DRSW_GATOR 0x0103
|
||||
#define NUBUS_DRSW_ASANTE 0x0104
|
||||
#define NUBUS_DRSW_TECHWORKS 0x0109
|
||||
#define NUBUS_DRSW_DAYNA 0x010B
|
||||
#define NUBUS_DRSW_FARALLON 0x010C
|
||||
#define NUBUS_DRSW_DAYNA2 0x0115
|
||||
#define NUBUS_DRSW_FOCUS 0x011A
|
||||
#define NUBUS_DRHW_INTERLAN 0x0100
|
||||
#define NUBUS_DRHW_KINETICS 0x0106
|
||||
#define NUBUS_DRHW_CABLETRON 0x0109
|
||||
#define NUBUS_DRHW_SONIC 0x0110
|
||||
#define NUBUS_DRHW_APPLE_SNT 0x0118
|
||||
#define NUBUS_DRHW_APPLE_SN 0x0119
|
||||
|
||||
#define NUBUS_CATEGORY_COMMUNICATIONS 0x0006
|
||||
#define NUBUS_TYPE_RS232 0x0002
|
||||
#define NUBUS_DRSW_HDS 0x0102
|
||||
#define NUBUS_DRHW_HDS 0x0102
|
||||
|
||||
#define NUBUS_CATEGORY_FONT 0x0009 /* KanjiTalk Font Card? */
|
||||
|
||||
#define NUBUS_CATEGORY_CPU 0x000A
|
||||
#define NUBUS_TYPE_68000 0x0002
|
||||
#define NUBUS_TYPE_68020 0x0003
|
||||
#define NUBUS_TYPE_68030 0x0004
|
||||
#define NUBUS_TYPE_68040 0x0005
|
||||
|
||||
/*
|
||||
* This is the same as Apple's Format Block for a card, with the
|
||||
* addition of a pointer to the base of the NuBUS slot.
|
||||
*
|
||||
* This basically describes a nubus card--this structure is held in the last
|
||||
* N bytes of each valid card's declaration ROM.
|
||||
*/
|
||||
typedef struct _nubus_slot {
|
||||
u_long top;
|
||||
u_int8_t slot;
|
||||
u_int8_t bytelanes;
|
||||
u_int8_t step;
|
||||
u_int32_t test_pattern;
|
||||
u_int8_t format;
|
||||
u_int8_t revision_level;
|
||||
u_int32_t crc;
|
||||
u_int32_t length;
|
||||
u_int32_t directory_offset;
|
||||
} nubus_slot;
|
||||
|
||||
/*
|
||||
* Just a structure to ease comparison of type for drivers, etc.
|
||||
*/
|
||||
typedef struct _nubus_type {
|
||||
u_int16_t category;
|
||||
u_int16_t type;
|
||||
u_int16_t drsw;
|
||||
u_int16_t drhw;
|
||||
} nubus_type;
|
||||
|
||||
/*
|
||||
* nubus_dir is a structure that describes a nubus directory.
|
||||
* The nubus*dir() functions should be used to traverse this.
|
||||
*/
|
||||
typedef struct _nubus_dir {
|
||||
u_int32_t dirbase;
|
||||
u_int32_t curr_ent;
|
||||
} nubus_dir;
|
||||
|
||||
/*
|
||||
* This is the equivalent of an Apple sResource directory entry
|
||||
* with the addition of a pointer to itself (essentially) for easy
|
||||
* calculation of jump to indirect data.
|
||||
*/
|
||||
typedef struct _nubus_dirent {
|
||||
u_int32_t myloc;
|
||||
u_int8_t rsrc_id;
|
||||
u_int32_t offset;
|
||||
} nubus_dirent;
|
||||
|
||||
/*
|
||||
* This is the equivalent of an Apple sResource with the addition of
|
||||
* a pointer back to the sResource directory from whence we came.
|
||||
*
|
||||
* According to the Apple documentation, each sResource is of one of the
|
||||
* following forms:
|
||||
* all: bits 31-24 Identification number
|
||||
*
|
||||
* offset: bits 23-0 Offset to long data, cString, sBlock, etc.
|
||||
* word: bits 23-16 0x00
|
||||
* bits 15-0 word data
|
||||
* byte: bits 23-8 0x0000
|
||||
* bits 7-0 byte data
|
||||
*
|
||||
* The last resource has id = 0xff and data = 0x000000.
|
||||
*/
|
||||
typedef struct _nubus_rsrc {
|
||||
u_int32_t myloc;
|
||||
u_int8_t id;
|
||||
u_int32_t data;
|
||||
} nubus_rsrc;
|
||||
|
||||
/* Resource IDs for NUBUS_CATEGORY_* (All) */
|
||||
#define NUBUS_RSRC_TYPE 0x01 /* Type (required) */
|
||||
#define NUBUS_RSRC_NAME 0x02 /* Name (required) */
|
||||
#define NUBUS_RSRC_ICON 0x03 /* Icon */
|
||||
#define NUBUS_RSRC_DRVRDIR 0x04 /* Driver directory */
|
||||
#define NUBUS_RSRC_LOADREC 0x05 /* Load record for resource */
|
||||
#define NUBUS_RSRC_BOOTREC 0x06 /* Boot record */
|
||||
#define NUBUS_RSRC_FLAGS 0x07 /* sResource Flags */
|
||||
#define NUBUS_RSRC_HWDEVID 0x08 /* Hardware device ID */
|
||||
#define NUBUS_RSRC_MINOR_BASEOS 0x0A /* Offset to hw in std space */
|
||||
#define NUBUS_RSRC_MINOR_LENGTH 0x0B /* Length of std space */
|
||||
#define NUBUS_RSRC_MAJOR_BASEOS 0x0C /* Offset to hw in super space */
|
||||
#define NUBUS_RSRC_MAJOR_LENGTH 0x0D /* Length of super space */
|
||||
#define NUBUS_RSRC_CICN 0x0F /* Color icon */
|
||||
#define NUBUS_RSRC_ICL8 0x10 /* 8-bit icon data */
|
||||
#define NUBUS_RSRC_ICL4 0x11 /* 4-bit icon data */
|
||||
|
||||
/* Resource IDs for NUBUS_CATEGORY_DISPLAY */
|
||||
#define NUBUS_RSRC_GAMMADIR 0x40 /* ID for gamma directory */
|
||||
#define NUBUS_RSRC_VIDNAMES 0x41 /* ID for video name directory */
|
||||
#define NUBUS_RSRC_FIRSTMODE 0x80 /* ID for first mode (1-bit) */
|
||||
#define NUBUS_RSRC_SECONDMODE 0x81 /* ID for 2nd mode (2-bit) */
|
||||
#define NUBUS_RSRC_THIRDMODE 0x82 /* ID for 3rd mode (4-bit) */
|
||||
#define NUBUS_RSRC_FOURTHMODE 0x83 /* ID for 4th mode (8-bit) */
|
||||
#define NUBUS_RSRC_FIFTHMODE 0x84 /* ID for 5th mode (16-bit) */
|
||||
#define NUBUS_RSRC_SIXTHMODE 0x85 /* ID for 6th mode (32-bit) */
|
||||
|
||||
/* Resource IDs for NUBUS_CATEGORY_BOARD */
|
||||
#define NUBUS_RSRC_BOARDID 0x20 /* Board ID */
|
||||
#define NUBUS_RSRC_PRAMINITDATA 0x21 /* Private board data for PRAM */
|
||||
#define NUBUS_RSRC_PRIMARYINIT 0x22 /* Primary init record */
|
||||
#define NUBUS_RSRC_TIMEOUTCONST 0x23 /* Timeout constant */
|
||||
#define NUBUS_RSRC_VENDORINFO 0x24 /* Vendor info list */
|
||||
#define NUBUS_RSRC_BOARDFLAGS 0x25 /* Board flags */
|
||||
#define NUBUS_RSRC_SECONDINIT 0x26 /* Secondary init record */
|
||||
|
||||
#define NUBUS_RSRC_VEND_ID 0x01 /* Card vendor's design ID */
|
||||
#define NUBUS_RSRC_VEND_SERIAL 0x02 /* Card's serial number */
|
||||
#define NUBUS_RSRC_VEND_REV 0x03 /* Card design's revision level */
|
||||
#define NUBUS_RSRC_VEND_PART 0x04 /* Card part number */
|
||||
#define NUBUS_RSRC_VEND_DATE 0x05 /* Card revision date */
|
||||
|
||||
typedef struct _NUBUS_DRIVER {
|
||||
u_int8_t drvr_id;
|
||||
u_int32_t offset;
|
||||
} NUBUS_DRIVER;
|
||||
|
||||
typedef struct _NUBUS_BLOCK {
|
||||
u_int32_t size; /* Size of block of data */
|
||||
caddr_t data; /* Pointer to data */
|
||||
} NUBUS_BLOCK;
|
||||
|
||||
typedef struct _NUBUS_EXEC_BLOCK {
|
||||
u_int32_t size; /* Size of total block - 4 */
|
||||
u_int8_t revision; /* Always 0x2 */
|
||||
u_int8_t cpu; /* Which processor? */
|
||||
u_int32_t code_offset; /* Offset base to start of code */
|
||||
caddr_t code; /* pointer to base of code. */
|
||||
} NUBUS_EXEC_BLOCK;
|
||||
|
||||
#define NUBUS_EXEC_CPU_68000 1
|
||||
#define NUBUS_EXEC_CPU_68020 2
|
||||
#define NUBUS_EXEC_CPU_68030 3
|
||||
#define NUBUS_EXEC_CPU_68040 4
|
||||
|
||||
#define NUBUS_MIN_SLOT 0x9
|
||||
#define NUBUS_MAX_SLOT 0xE
|
||||
#define NUBUS_ROM_TEST_PATTERN 0x5A932BC7
|
||||
|
||||
#define NUBUS_SLOT2PA(x) (0xf9000000 + \
|
||||
((((x) - NUBUS_MIN_SLOT) & 0xf) << 24))
|
||||
|
||||
struct nubus_attach_args {
|
||||
bus_space_tag_t na_tag;
|
||||
int slot;
|
||||
int rsrcid;
|
||||
u_int16_t category;
|
||||
u_int16_t type;
|
||||
u_int16_t drsw;
|
||||
u_int16_t drhw;
|
||||
nubus_slot *fmt;
|
||||
};
|
||||
|
||||
struct nubus_softc {
|
||||
struct device sc_dev;
|
||||
};
|
||||
|
||||
void nubus_get_main_dir __P((nubus_slot *slot, nubus_dir *dir_return));
|
||||
void nubus_get_dir_from_rsrc __P((nubus_slot *slot, nubus_dirent *dirent,
|
||||
nubus_dir *dir_return));
|
||||
|
||||
int nubus_find_rsrc __P((bus_space_tag_t, bus_space_handle_t,
|
||||
nubus_slot *slot, nubus_dir *dir, u_int8_t rsrcid,
|
||||
nubus_dirent *dirent_return));
|
||||
int nubus_get_ind_data __P((bus_space_tag_t, bus_space_handle_t,
|
||||
nubus_slot *slot, nubus_dirent *dirent,
|
||||
caddr_t data_return, int nbytes));
|
||||
int nubus_get_c_string __P((bus_space_tag_t, bus_space_handle_t,
|
||||
nubus_slot *slot, nubus_dirent *dirent,
|
||||
caddr_t data_return, int max_bytes));
|
||||
|
||||
char *nubus_get_vendor __P((bus_space_tag_t, bus_space_handle_t,
|
||||
nubus_slot *slot, int rsrc));
|
||||
char *nubus_get_card_name __P((bus_space_tag_t, bus_space_handle_t,
|
||||
nubus_slot *slot));
|
|
@ -1,114 +0,0 @@
|
|||
/* $NetBSD: obio.c,v 1.9 1998/01/12 19:22:16 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Jason R. Thorpe.
|
||||
*
|
||||
* 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 the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``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 FOUNDATION OR CONTRIBUTORS
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/device.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
|
||||
#include <mac68k/dev/obiovar.h>
|
||||
|
||||
static int obio_match __P((struct device *, struct cfdata *, void *));
|
||||
static void obio_attach __P((struct device *, struct device *, void *));
|
||||
static int obio_print __P((void *, const char *));
|
||||
static int obio_search __P((struct device *, struct cfdata *, void *));
|
||||
|
||||
struct cfattach obio_ca = {
|
||||
sizeof(struct device), obio_match, obio_attach
|
||||
};
|
||||
|
||||
static int
|
||||
obio_match(parent, cf, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *cf;
|
||||
void *aux;
|
||||
{
|
||||
static int obio_matched = 0;
|
||||
|
||||
/* Allow only one instance. */
|
||||
if (obio_matched)
|
||||
return (0);
|
||||
|
||||
obio_matched = 1;
|
||||
return (1);
|
||||
}
|
||||
|
||||
static void
|
||||
obio_attach(parent, self, aux)
|
||||
struct device *parent;
|
||||
struct device *self;
|
||||
void *aux;
|
||||
{
|
||||
printf("\n");
|
||||
|
||||
/* Search for and attach children. */
|
||||
(void)config_search(obio_search, self, aux);
|
||||
}
|
||||
|
||||
int
|
||||
obio_print(args, name)
|
||||
void *args;
|
||||
const char *name;
|
||||
{
|
||||
struct obio_attach_args *oa = (struct obio_attach_args *)args;
|
||||
|
||||
if (oa->oa_addr != (-1))
|
||||
printf(" addr %x", oa->oa_addr);
|
||||
|
||||
return (UNCONF);
|
||||
}
|
||||
|
||||
int
|
||||
obio_search(parent, cf, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *cf;
|
||||
void *aux;
|
||||
{
|
||||
struct obio_attach_args oa;
|
||||
|
||||
oa.oa_addr = cf->cf_loc[0];
|
||||
oa.oa_drq = cf->cf_loc[1];
|
||||
oa.oa_hsk = cf->cf_loc[2];
|
||||
oa.oa_tag = MAC68K_BUS_SPACE_MEM;
|
||||
|
||||
if ((*cf->cf_attach->ca_match)(parent, cf, &oa) > 0)
|
||||
config_attach(parent, cf, &oa, obio_print);
|
||||
|
||||
return (0);
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
/* $NetBSD: obiovar.h,v 1.4 1997/10/09 08:46:36 jtc Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Jason R. Thorpe.
|
||||
*
|
||||
* 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 the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``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 FOUNDATION OR CONTRIBUTORS
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Autoconfiguration definitions and prototypes for the mac68k
|
||||
* on-board i/o space.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Arguments used to attach a device to the internal i/o space.
|
||||
*/
|
||||
struct obio_attach_args {
|
||||
int oa_addr; /* physical address */
|
||||
int oa_drq; /* SCSI DRQ physical address */
|
||||
int oa_hsk; /* SCSI HSK physical address */
|
||||
bus_space_tag_t oa_tag; /* bus space tag */
|
||||
};
|
|
@ -1,300 +0,0 @@
|
|||
/* $NetBSD: sbc_obio.c,v 1.7 1997/12/16 19:44:19 scottr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1996,1997 Scott Reynolds. 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.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/buf.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/user.h>
|
||||
|
||||
#include <dev/scsipi/scsi_all.h>
|
||||
#include <dev/scsipi/scsipi_all.h>
|
||||
#include <dev/scsipi/scsipi_debug.h>
|
||||
#include <dev/scsipi/scsiconf.h>
|
||||
|
||||
#include <dev/ic/ncr5380reg.h>
|
||||
#include <dev/ic/ncr5380var.h>
|
||||
|
||||
#include <machine/cpu.h>
|
||||
#include <machine/viareg.h>
|
||||
|
||||
#include <mac68k/dev/sbcreg.h>
|
||||
#include <mac68k/dev/sbcvar.h>
|
||||
|
||||
/*
|
||||
* From Guide to the Macintosh Family Hardware, pp. 137-143
|
||||
* These are offsets from SCSIBase (see pmap_bootstrap.c)
|
||||
*/
|
||||
#define SBC_REG_OFS 0x10000
|
||||
#define SBC_DMA_OFS 0x12000
|
||||
#define SBC_HSK_OFS 0x06000
|
||||
|
||||
#define SBC_DMA_OFS_PB500 0x06000
|
||||
|
||||
#define SBC_REG_OFS_IIFX 0x08000 /* Just guessing... */
|
||||
#define SBC_DMA_OFS_IIFX 0x0c000
|
||||
#define SBC_HSK_OFS_IIFX 0x0e000
|
||||
|
||||
#define SBC_REG_OFS_DUO2 0x00000
|
||||
#define SBC_DMA_OFS_DUO2 0x02000
|
||||
#define SBC_HSK_OFS_DUO2 0x04000
|
||||
|
||||
static int sbc_obio_match __P((struct device *, struct cfdata *, void *));
|
||||
static void sbc_obio_attach __P((struct device *, struct device *, void *));
|
||||
|
||||
void sbc_intr_enable __P((struct ncr5380_softc *));
|
||||
void sbc_intr_disable __P((struct ncr5380_softc *));
|
||||
void sbc_obio_clrintr __P((struct ncr5380_softc *));
|
||||
|
||||
struct cfattach sbc_obio_ca = {
|
||||
sizeof(struct sbc_softc), sbc_obio_match, sbc_obio_attach
|
||||
};
|
||||
|
||||
static int
|
||||
sbc_obio_match(parent, cf, args)
|
||||
struct device *parent;
|
||||
struct cfdata *cf;
|
||||
void *args;
|
||||
{
|
||||
switch (current_mac_model->machineid) {
|
||||
case MACH_MACIIFX: /* Note: the IIfx isn't (yet) supported. */
|
||||
break;
|
||||
case MACH_MACPB210:
|
||||
case MACH_MACPB230:
|
||||
case MACH_MACPB250:
|
||||
case MACH_MACPB270:
|
||||
case MACH_MACPB280:
|
||||
case MACH_MACPB280C:
|
||||
if (cf->cf_unit == 1)
|
||||
return 1;
|
||||
/*FALLTHROUGH*/
|
||||
default:
|
||||
if (cf->cf_unit == 0 && mac68k_machine.scsi80)
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
sbc_obio_attach(parent, self, args)
|
||||
struct device *parent, *self;
|
||||
void *args;
|
||||
{
|
||||
struct sbc_softc *sc = (struct sbc_softc *) self;
|
||||
struct ncr5380_softc *ncr_sc = (struct ncr5380_softc *) sc;
|
||||
char bits[64];
|
||||
extern vm_offset_t SCSIBase;
|
||||
|
||||
/* Pull in the options flags. */
|
||||
sc->sc_options = ((ncr_sc->sc_dev.dv_cfdata->cf_flags | sbc_options)
|
||||
& SBC_OPTIONS_MASK);
|
||||
|
||||
/*
|
||||
* Set up offsets to 5380 registers and GLUE I/O space, and turn
|
||||
* off options we know we can't support on certain models.
|
||||
*/
|
||||
switch (current_mac_model->machineid) {
|
||||
case MACH_MACIIFX: /* Note: the IIfx isn't (yet) supported. */
|
||||
sc->sc_regs = (struct sbc_regs *)(SCSIBase + SBC_REG_OFS_IIFX);
|
||||
sc->sc_drq_addr = (vm_offset_t)(SCSIBase + SBC_HSK_OFS_IIFX);
|
||||
sc->sc_nodrq_addr = (vm_offset_t)(SCSIBase + SBC_DMA_OFS_IIFX);
|
||||
sc->sc_options &= ~(SBC_INTR | SBC_RESELECT);
|
||||
break;
|
||||
case MACH_MACPB500:
|
||||
sc->sc_regs = (struct sbc_regs *)(SCSIBase + SBC_REG_OFS);
|
||||
sc->sc_drq_addr = (vm_offset_t)(SCSIBase + SBC_HSK_OFS); /*??*/
|
||||
sc->sc_nodrq_addr = (vm_offset_t)(SCSIBase + SBC_DMA_OFS_PB500);
|
||||
sc->sc_options &= ~(SBC_INTR | SBC_RESELECT);
|
||||
break;
|
||||
case MACH_MACPB210:
|
||||
case MACH_MACPB230:
|
||||
case MACH_MACPB250:
|
||||
case MACH_MACPB270:
|
||||
case MACH_MACPB280:
|
||||
case MACH_MACPB280C:
|
||||
if (ncr_sc->sc_dev.dv_unit == 1) {
|
||||
sc->sc_regs = (struct sbc_regs *)(0xfee00000 + SBC_REG_OFS_DUO2);
|
||||
sc->sc_drq_addr = (vm_offset_t)(0xfee00000 + SBC_HSK_OFS_DUO2);
|
||||
sc->sc_nodrq_addr = (vm_offset_t)(0xfee00000 + SBC_DMA_OFS_DUO2);
|
||||
break;
|
||||
}
|
||||
/*FALLTHROUGH*/
|
||||
default:
|
||||
sc->sc_regs = (struct sbc_regs *)(SCSIBase + SBC_REG_OFS);
|
||||
sc->sc_drq_addr = (vm_offset_t)(SCSIBase + SBC_HSK_OFS);
|
||||
sc->sc_nodrq_addr = (vm_offset_t)(SCSIBase + SBC_DMA_OFS);
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Fill in the prototype scsi_link.
|
||||
*/
|
||||
ncr_sc->sc_link.scsipi_scsi.channel = SCSI_CHANNEL_ONLY_ONE;
|
||||
ncr_sc->sc_link.adapter_softc = sc;
|
||||
ncr_sc->sc_link.scsipi_scsi.adapter_target = 7;
|
||||
ncr_sc->sc_link.adapter = &sbc_ops;
|
||||
ncr_sc->sc_link.device = &sbc_dev;
|
||||
ncr_sc->sc_link.type = BUS_SCSI;
|
||||
|
||||
/*
|
||||
* Initialize fields used by the MI code
|
||||
*/
|
||||
ncr_sc->sci_r0 = &sc->sc_regs->sci_pr0.sci_reg;
|
||||
ncr_sc->sci_r1 = &sc->sc_regs->sci_pr1.sci_reg;
|
||||
ncr_sc->sci_r2 = &sc->sc_regs->sci_pr2.sci_reg;
|
||||
ncr_sc->sci_r3 = &sc->sc_regs->sci_pr3.sci_reg;
|
||||
ncr_sc->sci_r4 = &sc->sc_regs->sci_pr4.sci_reg;
|
||||
ncr_sc->sci_r5 = &sc->sc_regs->sci_pr5.sci_reg;
|
||||
ncr_sc->sci_r6 = &sc->sc_regs->sci_pr6.sci_reg;
|
||||
ncr_sc->sci_r7 = &sc->sc_regs->sci_pr7.sci_reg;
|
||||
|
||||
/*
|
||||
* MD function pointers used by the MI code.
|
||||
*/
|
||||
if (sc->sc_options & SBC_PDMA) {
|
||||
ncr_sc->sc_pio_out = sbc_pdma_out;
|
||||
ncr_sc->sc_pio_in = sbc_pdma_in;
|
||||
} else {
|
||||
ncr_sc->sc_pio_out = ncr5380_pio_out;
|
||||
ncr_sc->sc_pio_in = ncr5380_pio_in;
|
||||
}
|
||||
ncr_sc->sc_dma_alloc = NULL;
|
||||
ncr_sc->sc_dma_free = NULL;
|
||||
ncr_sc->sc_dma_poll = NULL;
|
||||
ncr_sc->sc_intr_on = NULL;
|
||||
ncr_sc->sc_intr_off = NULL;
|
||||
ncr_sc->sc_dma_setup = NULL;
|
||||
ncr_sc->sc_dma_start = NULL;
|
||||
ncr_sc->sc_dma_eop = NULL;
|
||||
ncr_sc->sc_dma_stop = NULL;
|
||||
ncr_sc->sc_flags = 0;
|
||||
ncr_sc->sc_min_dma_len = MIN_DMA_LEN;
|
||||
|
||||
if (sc->sc_options & SBC_INTR) {
|
||||
ncr_sc->sc_dma_alloc = sbc_dma_alloc;
|
||||
ncr_sc->sc_dma_free = sbc_dma_free;
|
||||
ncr_sc->sc_dma_poll = sbc_dma_poll;
|
||||
ncr_sc->sc_dma_setup = sbc_dma_setup;
|
||||
ncr_sc->sc_dma_start = sbc_dma_start;
|
||||
ncr_sc->sc_dma_eop = sbc_dma_eop;
|
||||
ncr_sc->sc_dma_stop = sbc_dma_stop;
|
||||
via2_register_irq(VIA2_SCSIDRQ, sbc_drq_intr, ncr_sc);
|
||||
}
|
||||
|
||||
via2_register_irq(VIA2_SCSIIRQ, sbc_irq_intr, ncr_sc);
|
||||
sc->sc_clrintr = sbc_obio_clrintr;
|
||||
|
||||
if ((sc->sc_options & SBC_RESELECT) == 0)
|
||||
ncr_sc->sc_no_disconnect = 0xff;
|
||||
|
||||
if (sc->sc_options)
|
||||
printf(": options=%s", bitmask_snprintf(sc->sc_options,
|
||||
SBC_OPTIONS_BITS, bits, sizeof(bits)));
|
||||
printf("\n");
|
||||
|
||||
if (sc->sc_options & (SBC_INTR|SBC_RESELECT)) {
|
||||
/* Enable SCSI interrupts through VIA2 */
|
||||
sbc_intr_enable(ncr_sc);
|
||||
}
|
||||
|
||||
#ifdef SBC_DEBUG
|
||||
if (sbc_debug)
|
||||
printf("%s: softc=%p regs=%p\n", ncr_sc->sc_dev.dv_xname,
|
||||
sc, sc->sc_regs);
|
||||
ncr_sc->sc_link.flags |= sbc_link_flags;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Initialize the SCSI controller itself.
|
||||
*/
|
||||
ncr5380_init(ncr_sc);
|
||||
ncr5380_reset_scsibus(ncr_sc);
|
||||
config_found(self, &(ncr_sc->sc_link), scsiprint);
|
||||
}
|
||||
|
||||
/*
|
||||
* Interrupt support routines.
|
||||
*/
|
||||
void
|
||||
sbc_intr_enable(ncr_sc)
|
||||
struct ncr5380_softc *ncr_sc;
|
||||
{
|
||||
struct sbc_softc *sc = (struct sbc_softc *)ncr_sc;
|
||||
int s, flags;
|
||||
|
||||
flags = V2IF_SCSIIRQ;
|
||||
if (sc->sc_options & SBC_INTR)
|
||||
flags |= V2IF_SCSIDRQ;
|
||||
|
||||
s = splhigh();
|
||||
if (VIA2 == VIA2OFF)
|
||||
via2_reg(vIER) = 0x80 | flags;
|
||||
else
|
||||
via2_reg(rIER) = 0x80 | flags;
|
||||
splx(s);
|
||||
}
|
||||
|
||||
void
|
||||
sbc_intr_disable(ncr_sc)
|
||||
struct ncr5380_softc *ncr_sc;
|
||||
{
|
||||
struct sbc_softc *sc = (struct sbc_softc *)ncr_sc;
|
||||
int s, flags;
|
||||
|
||||
flags = V2IF_SCSIIRQ;
|
||||
if (sc->sc_options & SBC_INTR)
|
||||
flags |= V2IF_SCSIDRQ;
|
||||
|
||||
s = splhigh();
|
||||
if (VIA2 == VIA2OFF)
|
||||
via2_reg(vIER) = flags;
|
||||
else
|
||||
via2_reg(rIER) = flags;
|
||||
splx(s);
|
||||
}
|
||||
|
||||
void
|
||||
sbc_obio_clrintr(ncr_sc)
|
||||
struct ncr5380_softc *ncr_sc;
|
||||
{
|
||||
struct sbc_softc *sc = (struct sbc_softc *)ncr_sc;
|
||||
int flags;
|
||||
|
||||
flags = V2IF_SCSIIRQ;
|
||||
if (sc->sc_options & SBC_INTR)
|
||||
flags |= V2IF_SCSIDRQ;
|
||||
|
||||
if (VIA2 == VIA2OFF)
|
||||
via2_reg(vIFR) = 0x80 | flags;
|
||||
else
|
||||
via2_reg(rIFR) = 0x80 | flags;
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: grf_nubus.c,v 1.42 1998/04/26 16:47:39 briggs Exp $ */
|
||||
/* $NetBSD: grf_nubus.c,v 1.43 1998/05/02 16:45:30 scottr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Allen Briggs. All rights reserved.
|
||||
|
@ -47,7 +47,7 @@
|
|||
#include <machine/grfioctl.h>
|
||||
#include <machine/viareg.h>
|
||||
|
||||
#include <mac68k/dev/nubus.h>
|
||||
#include <mac68k/nubus/nubus.h>
|
||||
#include <mac68k/dev/grfvar.h>
|
||||
|
||||
static void load_image_data __P((caddr_t data, struct image_data *image));
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_ae_nubus.c,v 1.25 1998/04/25 21:27:40 scottr Exp $ */
|
||||
/* $NetBSD: if_ae_nubus.c,v 1.26 1998/05/02 16:45:30 scottr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1997 Scott Reynolds
|
||||
|
@ -57,7 +57,7 @@
|
|||
|
||||
#include <dev/ic/dp8390reg.h>
|
||||
#include <dev/ic/dp8390var.h>
|
||||
#include <mac68k/dev/nubus.h>
|
||||
#include <mac68k/nubus/nubus.h>
|
||||
#include <mac68k/dev/if_aevar.h>
|
||||
#include <mac68k/dev/if_aereg.h>
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_sn_nubus.c,v 1.17 1997/10/26 03:17:15 briggs Exp $ */
|
||||
/* $NetBSD: if_sn_nubus.c,v 1.18 1998/05/02 16:45:30 scottr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1997 Allen Briggs
|
||||
|
@ -51,7 +51,7 @@
|
|||
#include <machine/bus.h>
|
||||
#include <machine/viareg.h>
|
||||
|
||||
#include <mac68k/dev/nubus.h>
|
||||
#include <mac68k/nubus/nubus.h>
|
||||
#include <mac68k/dev/if_snreg.h>
|
||||
#include <mac68k/dev/if_snvar.h>
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: nubus.c,v 1.43 1998/01/13 19:24:56 scottr Exp $ */
|
||||
/* $NetBSD: nubus.c,v 1.44 1998/05/02 16:45:30 scottr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995, 1996 Allen Briggs. All rights reserved.
|
||||
|
@ -50,7 +50,7 @@
|
|||
|
||||
#include <vm/vm.h>
|
||||
|
||||
#include <mac68k/dev/nubus.h>
|
||||
#include <mac68k/nubus/nubus.h>
|
||||
|
||||
#ifdef DEBUG
|
||||
#define NDB_PROBE 0x1
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: asc.c,v 1.26 1998/01/13 19:24:50 scottr Exp $ */
|
||||
/* $NetBSD: asc.c,v 1.27 1998/05/02 16:45:30 scottr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1997 Scott Reynolds
|
||||
|
@ -79,8 +79,8 @@
|
|||
#include <machine/cpu.h>
|
||||
#include <machine/bus.h>
|
||||
|
||||
#include <mac68k/dev/ascvar.h>
|
||||
#include <mac68k/dev/obiovar.h>
|
||||
#include <mac68k/obio/ascvar.h>
|
||||
#include <mac68k/obio/obiovar.h>
|
||||
|
||||
#define MAC68K_ASC_BASE 0x50f14000
|
||||
#define MAC68K_IIFX_ASC_BASE 0x50f10000
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: esp.c,v 1.14 1998/01/12 19:22:02 thorpej Exp $ */
|
||||
/* $NetBSD: esp.c,v 1.15 1998/05/02 16:45:30 scottr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Jason R. Thorpe.
|
||||
|
@ -103,8 +103,8 @@
|
|||
|
||||
#include <machine/viareg.h>
|
||||
|
||||
#include <mac68k/dev/espvar.h>
|
||||
#include <mac68k/dev/obiovar.h>
|
||||
#include <mac68k/obio/espvar.h>
|
||||
#include <mac68k/obio/obiovar.h>
|
||||
|
||||
void espattach __P((struct device *, struct device *, void *));
|
||||
int espmatch __P((struct device *, struct cfdata *, void *));
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: grf_obio.c,v 1.31 1998/03/22 23:40:52 scottr Exp $ */
|
||||
/* $NetBSD: grf_obio.c,v 1.32 1998/05/02 16:45:31 scottr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Allen Briggs. All rights reserved.
|
||||
|
@ -49,8 +49,8 @@
|
|||
#include <machine/grfioctl.h>
|
||||
#include <machine/viareg.h>
|
||||
|
||||
#include <mac68k/dev/nubus.h>
|
||||
#include <mac68k/dev/obiovar.h>
|
||||
#include <mac68k/nubus/nubus.h>
|
||||
#include <mac68k/obio/obiovar.h>
|
||||
#include <mac68k/dev/grfvar.h>
|
||||
|
||||
extern u_int32_t mac68k_vidlog;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_mc_obio.c,v 1.4 1998/01/13 19:24:54 scottr Exp $ */
|
||||
/* $NetBSD: if_mc_obio.c,v 1.5 1998/05/02 16:45:31 scottr Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997 David Huang <khym@bga.com>
|
||||
|
@ -49,7 +49,7 @@
|
|||
#include <machine/bus.h>
|
||||
#include <machine/psc.h>
|
||||
|
||||
#include <mac68k/dev/obiovar.h>
|
||||
#include <mac68k/obio/obiovar.h>
|
||||
#include <mac68k/dev/if_mcreg.h>
|
||||
#include <mac68k/dev/if_mcvar.h>
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_sn_obio.c,v 1.14 1998/01/13 19:24:55 scottr Exp $ */
|
||||
/* $NetBSD: if_sn_obio.c,v 1.15 1998/05/02 16:45:31 scottr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1997 Allen Briggs
|
||||
|
@ -52,7 +52,7 @@
|
|||
#include <machine/cpu.h>
|
||||
#include <machine/viareg.h>
|
||||
|
||||
#include <mac68k/dev/obiovar.h>
|
||||
#include <mac68k/obio/obiovar.h>
|
||||
#include <mac68k/dev/if_snreg.h>
|
||||
#include <mac68k/dev/if_snvar.h>
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: obio.c,v 1.9 1998/01/12 19:22:16 thorpej Exp $ */
|
||||
/* $NetBSD: obio.c,v 1.10 1998/05/02 16:45:31 scottr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 The NetBSD Foundation, Inc.
|
||||
|
@ -42,7 +42,7 @@
|
|||
|
||||
#include <machine/bus.h>
|
||||
|
||||
#include <mac68k/dev/obiovar.h>
|
||||
#include <mac68k/obio/obiovar.h>
|
||||
|
||||
static int obio_match __P((struct device *, struct cfdata *, void *));
|
||||
static void obio_attach __P((struct device *, struct device *, void *));
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: sbc_obio.c,v 1.7 1997/12/16 19:44:19 scottr Exp $ */
|
||||
/* $NetBSD: sbc_obio.c,v 1.8 1998/05/02 16:45:31 scottr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1996,1997 Scott Reynolds. All rights reserved.
|
||||
|
@ -87,6 +87,10 @@ sbc_obio_match(parent, cf, args)
|
|||
{
|
||||
switch (current_mac_model->machineid) {
|
||||
case MACH_MACIIFX: /* Note: the IIfx isn't (yet) supported. */
|
||||
/*
|
||||
if (cf->cf_unit == 0)
|
||||
return 1;
|
||||
*/
|
||||
break;
|
||||
case MACH_MACPB210:
|
||||
case MACH_MACPB230:
|
||||
|
|
Loading…
Reference in New Issue