/*
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe and Steve C. Woodford.
*
* 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.
*
* 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.
*/
/*
* Copyright (c) 1995 Charles D. Cranor
* 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.
*
* 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 pccintr(void *);
static int pccsoftintr(void *);
#ifdef notyet
static void pccsoftintrassert(void);
#endif
/*
* Structure used to describe a device for autoconfiguration purposes.
*/
struct pcc_device {
const char *pcc_name; /* name of device (e.g. "clock") */
bus_addr_t pcc_offset; /* offset from PCC base */
};
/*
* Devices that live on the PCC, attached in this order.
*/
static const struct pcc_device pcc_devices[] = {
{"clock", 0},
{"zsc", PCC_ZS0_OFF},
{"zsc", PCC_ZS1_OFF},
{"le", PCC_LE_OFF},
{"wdsc", PCC_WDSC_OFF},
{"lpt", PCC_LPT_OFF},
{"vmepcc", PCC_VME_OFF},
{NULL, 0},
};
/* Hook up interrupt handler for abort button, and enable it */
pccintr_establish(PCCV_ABORT, pccintr, 7, NULL, &sc->sc_evcnt);
pcc_reg_write(sc, PCCREG_ABORT_INTR_CTRL,
PCC_ABORT_IEN | PCC_ABORT_ACK);
/*
* Install a handler for Software Interrupt 1
* and arrange to schedule soft interrupts on demand.
*/
pccintr_establish(PCCV_SOFT1, pccsoftintr, 1, sc, &sc->sc_evcnt);
#ifdef notyet
_softintr_chipset_assert = pccsoftintrassert;
#endif
/* Make sure the global interrupt line is hot. */
reg = pcc_reg_read(sc, PCCREG_GENERAL_CONTROL) | PCC_GENCR_IEN;
pcc_reg_write(sc, PCCREG_GENERAL_CONTROL, reg);
/*
* Calculate the board's VMEbus slave base address, for the
* benefit of the VMEchip driver.
* (Weird that this register is in the PCC ...)
*/
reg = pcc_reg_read(sc, PCCREG_SLAVE_BASE_ADDR) & PCC_SLAVE_BASE_MASK;
pcc_slave_base_addr = (bus_addr_t)reg * mem_clusters[0].size;
/*
* Attach configured children.
*/
npa._pa_base = ma->ma_offset;
for (i = 0; pcc_devices[i].pcc_name != NULL; ++i) {
/*
* Note that IPL is filled in by match function.
*/
npa.pa_name = pcc_devices[i].pcc_name;
npa.pa_ipl = -1;
npa.pa_dmat = ma->ma_dmat;
npa.pa_bust = ma->ma_bust;
npa.pa_offset = pcc_devices[i].pcc_offset + ma->ma_offset;
/* Attach the device if configured. */
(void)config_found(self, &npa, pccprint, CFARGS_NONE);
}
}
int
pccprint(void *aux, const char *cp)
{
struct pcc_attach_args *pa;
pa = aux;
if (cp)
aprint_normal("%s at %s", pa->pa_name, cp);