1 /* $NetBSD: vme.c,v 1.2 1998/02/04 00:38:34 pk Exp $ */ 2 /*- 3 * Copyright (c) 1997 The NetBSD Foundation, Inc. 4 * All rights reserved. 5 * 6 * This code is derived from software contributed to The NetBSD Foundation 7 * by Paul Kranenburg. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions 11 * are met: 12 * 1. Redistributions of source code must retain the above copyright 13 * notice, this list of conditions and the following disclaimer. 14 * 2. Redistributions in binary form must reproduce the above copyright 15 * notice, this list of conditions and the following disclaimer in the 16 * documentation and/or other materials provided with the distribution. 17 * 3. All advertising materials mentioning features or use of this software 18 * must display the following acknowledgement: 19 * This product includes software developed by the NetBSD 20 * Foundation, Inc. and its contributors. 21 * 4. Neither the name of The NetBSD Foundation nor the names of its 22 * contributors may be used to endorse or promote products derived 23 * from this software without specific prior written permission. 24 * 25 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 26 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 27 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 28 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 29 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 * POSSIBILITY OF SUCH DAMAGE. 36 */ 37 38 #include <sys/param.h> 39 #include <sys/systm.h> 40 #include <sys/device.h> 41 #include <sys/malloc.h> 42 43 #include <vm/vm.h> 44 45 #include <dev/vme/vmevar.h> 46 47 #include "locators.h" 48 49 int vmeprint __P((void *, const char *)); 50 51 int 52 vmeprint(args, name) 53 void *args; 54 const char *name; 55 { 56 struct vme_attach_args *va = args; 57 58 if (name) 59 printf("[%s at %s]", "???", name); 60 61 printf(" addr %lx", va->vma_reg[0]); 62 printf(" pri %x", va->vma_pri); 63 printf(" vec %x", va->vma_vec); 64 return (UNCONF); 65 } 66 67 68 int 69 vmesearch(parent, cf, aux) 70 struct device *parent; 71 struct cfdata *cf; 72 void *aux; 73 { 74 struct vme_busattach_args *vba = (struct vme_busattach_args *)aux; 75 struct vme_attach_args vma; 76 int i; 77 78 vma.vma_bustag = vba->vba_bustag; 79 vma.vma_dmatag = vba->vba_dmatag; 80 vma.vma_chipset_tag = vba->vba_chipset_tag; 81 82 vma.vma_nreg = 1; 83 for (i = 0; i < vma.vma_nreg; i++) 84 /* XXX - or whatever shape this config enhancement takes on */ 85 vma.vma_reg[0] = cf->cf_loc[VMECF_ADDR + i]; 86 87 vma.vma_vec = cf->cf_loc[VMECF_VEC]; 88 vma.vma_pri = cf->cf_loc[VMECF_PRI]; 89 90 if ((*cf->cf_attach->ca_match)(parent, cf, &vma) == 0) 91 return (0); 92 93 config_attach(parent, cf, &vma, vmeprint); 94 return (0); 95 } 96