/*
* Copyright (c) 1999
* Matthias Drochner. 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.
*
*/
static int
vmeprint(struct vme_attach_args *v, char *dummy)
{
int i;
for (i = 0; i < v->numcfranges; i++) {
aprint_normal(" addr %x", v->r[i].offset);
if (v->r[i].size != -1)
aprint_normal("-%x", v->r[i].offset + v->r[i].size - 1);
if (v->r[i].am != -1)
aprint_normal(" am %02x", v->r[i].am);
}
if (v->ilevel != -1) {
aprint_normal(" irq %d", v->ilevel);
if (v->ivector != -1)
aprint_normal(" vector %x", v->ivector);
}
return (UNCONF);
}
/*
* This looks for a (dummy) vme device "VME_SLAVE_DUMMYDRV".
* A callback provided by the bus's parent is called for every such
* entry in the config database.
* This is a special hack allowing to communicate the address settings
* of the VME master's slave side to its driver via the normal
* configuration mechanism.
* Needed in following cases:
* -DMA windows are hardware settable but not readable by software
* (driver gets offsets for DMA address calculations this way)
* -DMA windows are software settable, but not persistent
* (hardware is set up from config file entry)
* -other adapter VME slave ranges which should be kept track of
* for address space accounting
* In any case, the adapter driver must get the data before VME
* devices are attached.
*/
static int
vmesubmatch1(device_t bus, cfdata_t dev, const int *ldesc, void *aux)
{
struct vmebus_softc *sc = device_private(bus);
struct vme_attach_args v;
if (strcmp(dev->cf_name, VME_SLAVE_DUMMYDRV))
return (0);
if (sc->slaveconfig) {
/* first get info about the bus master's slave side,
if present */
config_search(self, NULL,
CFARGS(.search = vmesubmatch1));
}
config_search(self, NULL,
CFARGS(.search = vmesubmatch));
#if 0 /* XXX VMEDEBUG */
if (sc->vme32_arena)
vmem_print(sc->vme32_arena);
if (sc->vme24_arena)
vmem_print(sc->vme24_arena);
if (sc->vme16_arena)
vmem_print(sc->vme16_arena);
#endif
}