1 /*        $NetBSD: autoconf.h,v 1.27 2012/10/13 06:37:16 tsutsui Exp $          */
2 
3 /*-
4  * Copyright (c) 1996 The NetBSD Foundation, Inc.
5  * All rights reserved.
6  *
7  * This code is derived from software contributed to The NetBSD Foundation
8  * by Adam Glass and Gordon W. Ross.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 /*
33  * Autoconfiguration information.
34  * (machdep parts of driver/kernel interface)
35  */
36 
37 #include <machine/bus.h>
38 
39 /*
40  * These are the "bus" types, in attach order.
41  * Note tables in bus_subr.c and vme.c that
42  * care about the order of these.
43  */
44 #define   BUS_OBIO            0         /* on-board I/O */
45 #define   BUS_OBMEM           1         /* on-board memory */
46 #define   BUS_VME16D16        2         /* VME A16/D16 */
47 #define   BUS_VME16D32        3         /* VME A16/D32 */
48 #define   BUS_VME24D16        4         /* VME A24/D16 */
49 #define   BUS_VME24D32        5         /* VME A24/D32 */
50 #define   BUS_VME32D16        6         /* VME A32/D16 */
51 #define   BUS_VME32D32        7         /* VME A32/D32 */
52 #define BUS__NTYPES           8         /* not a valid bus type */
53 
54 /*
55  * This is the "args" parameter to the bus match/attach functions.
56  */
57 struct confargs {
58           bus_space_tag_t ca_bustag;
59           bus_dma_tag_t ca_dmatag;
60           const char *ca_name;
61           int ca_bustype;               /* BUS_OBIO, ... */
62           paddr_t ca_paddr;   /* physical address */
63           int ca_intpri;                /* interrupt priority level */
64           int ca_intvec;                /* interrupt vector index */
65 };
66 
67 extern struct sun68k_bus_dma_tag mainbus_dma_tag;
68 extern struct sun68k_bus_space_tag mainbus_space_tag;
69 
70 /* Locator aliases */
71 #define cf_paddr    cf_loc[0]
72 #define cf_intpri   cf_loc[1]
73 #define cf_intvec   cf_loc[2]
74 
75 int bus_scan(device_t, cfdata_t, const int *, void *);
76 int bus_print(void *, const char *);
77 int bus_peek(int, int, int);
78 void *bus_mapin(int, int, int);
79 void bus_mapout(void *, int);
80 void *bus_tmapin(int, int);
81 void bus_tmapout(void *);
82 
83 /* Bus-error tolerant access to mapped address. */
84 int       peek_byte(void *);
85 int       peek_word(void *);
86 int       peek_long(void *);
87