#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: xcvbus.c,v 1.4 2023/12/20 14:18:38 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/types.h>
#include <sys/device.h>
#include <sys/bus.h>
#include <powerpc/ibm4xx/dev/plbvar.h>
#include <evbppc/virtex/dev/xcvbusvar.h>
static int xcvbus_match(device_t, cfdata_t, void *);
static void xcvbus_attach(device_t, device_t, void *);
CFATTACH_DECL_NEW(xcvbus, 0,
xcvbus_match, xcvbus_attach, NULL, NULL);
static int
xcvbus_match(device_t parent, cfdata_t cf, void *aux)
{
struct plb_attach_args *paa = aux;
return (strcmp(paa->plb_name, cf->cf_name) == 0);
}
static void
xcvbus_attach(device_t parent, device_t self, void *aux)
{
struct plb_attach_args *paa = aux;
printf(": Xilinx Virtex FPGA\n");
virtex_autoconf(self, paa);
}
int
xcvbus_print(void *aux, const char *pnp)
{
struct xcvbus_attach_args *vaa = aux;
if (pnp)
aprint_normal("%s at %s", vaa->vaa_name, pnp);
if (vaa->vaa_addr != -1) {
if (vaa->_vaa_is_dcr)
aprint_normal(" dcr 0x%x", vaa->vaa_iot->pbs_base);
else
aprint_normal(" mem 0x%x", vaa->vaa_addr);
}
if (vaa->vaa_intr != -1)
aprint_normal(" intr %d", vaa->vaa_intr);
if (vaa->vaa_tx_dmac != NULL)
aprint_normal(" tx %d", vaa->vaa_tx_dmac->dmac_chan);
if (vaa->vaa_rx_dmac != NULL)
aprint_normal(" rx %d", vaa->vaa_rx_dmac->dmac_chan);
return (UNCONF);
}
int
xcvbus_child_match(device_t parent, cfdata_t cf, void *aux)
{
struct xcvbus_attach_args *vaa = aux;
return (strcmp(vaa->vaa_name, cf->cf_name) == 0);
}