4 * Copyright (c) 2006 Jachym Holecek
7 * Written for DFC Design, s.r.o.
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
20 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 #include <sys/cdefs.h>
33 __KERNEL_RCSID(0, "$NetBSD$");
35 #include <sys/param.h>
36 #include <sys/systm.h>
37 #include <sys/types.h>
38 #include <sys/device.h>
39 #include <sys/extent.h>
40 #include <sys/malloc.h>
42 #include <machine/bus.h>
43 #include <powerpc/ibm4xx/dev/plbvar.h>
45 #include <evbppc/virtex/dev/xcvbusvar.h>
48 static int xcvbus_match(device_t
, cfdata_t
, void *);
49 static void xcvbus_attach(device_t
, device_t
, void *);
52 CFATTACH_DECL(xcvbus
, sizeof(struct device
),
53 xcvbus_match
, xcvbus_attach
, NULL
, NULL
);
57 xcvbus_match(device_t parent
, cfdata_t cf
, void *aux
)
59 struct plb_attach_args
*paa
= aux
;
61 return (strcmp(paa
->plb_name
, cf
->cf_name
) == 0);
65 xcvbus_attach(device_t parent
, device_t self
, void *aux
)
67 struct plb_attach_args
*paa
= aux
;
69 printf(": Xilinx Virtex FPGA\n");
71 virtex_autoconf(self
, paa
);
79 xcvbus_print(void *aux
, const char *pnp
)
81 struct xcvbus_attach_args
*vaa
= aux
;
84 aprint_normal("%s at %s", vaa
->vaa_name
, pnp
);
86 if (vaa
->vaa_addr
!= -1) {
88 aprint_normal(" dcr 0x%x", vaa
->vaa_iot
->pbs_base
);
90 aprint_normal(" mem 0x%x", vaa
->vaa_addr
);
93 if (vaa
->vaa_intr
!= -1)
94 aprint_normal(" intr %d", vaa
->vaa_intr
);
95 if (vaa
->vaa_tx_dmac
!= NULL
)
96 aprint_normal(" tx %d", vaa
->vaa_tx_dmac
->dmac_chan
);
97 if (vaa
->vaa_rx_dmac
!= NULL
)
98 aprint_normal(" rx %d", vaa
->vaa_rx_dmac
->dmac_chan
);
104 xcvbus_child_match(struct device
*parent
, struct cfdata
*cf
, void *aux
)
106 struct xcvbus_attach_args
*vaa
= aux
;
108 return (strcmp(vaa
->vaa_name
, cf
->cf_name
) == 0);