psychovar.h revision 1.2 1 /* $NetBSD: psychovar.h,v 1.2 2000/04/10 16:11:23 mrg Exp $ */
2
3 /*
4 * Copyright (c) 1999, 2000 Matthew R. Green
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. The name of the author may not be used to endorse or promote products
16 * derived from this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
23 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
25 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
29 */
30
31 #ifndef _SPARC64_DEV_PSYCHOVAR_H_
32 #define _SPARC64_DEV_PSYCHOVAR_H_
33
34 /* per real PCI bus info */
35 struct psycho_softc;
36
37 struct psycho_pbm {
38 /* link to mum */
39 struct psycho_softc *pp_sc;
40
41 /*
42 * note that the sabre really only has one ranges property,
43 * used for both simba a and simba b (but the ranges for
44 * real psychos are the same for PCI A and PCI B anyway).
45 */
46 struct psycho_registers *pp_regs;
47 struct psycho_ranges *pp_range;
48 struct psycho_interrupt_map *pp_intmap;
49 struct psycho_interrupt_map_mask pp_intmapmask;
50
51 /* counts of above */
52 int pp_nregs;
53 int pp_nrange;
54 int pp_nintmap;
55
56 /* chipset tag for this instance */
57 pci_chipset_tag_t pp_pc;
58
59 /* our tags */
60 bus_space_tag_t pp_memt;
61 bus_space_tag_t pp_iot;
62 bus_dma_tag_t pp_dmat;
63 int pp_flags;
64
65 /* and pointers into the psycho regs for our bits */
66 struct pci_ctl *pp_pcictl;
67 };
68
69 /*
70 * per-PCI bus on mainbus softc structure; one for sabre, or two
71 * per pair of psycho's.
72 */
73 struct psycho_softc {
74 struct device sc_dev;
75
76 /*
77 * one sabre has two simba's. psycho's are separately attached,
78 * with the `other' psycho_pbm allocated at the first's attach.
79 */
80 struct psycho_pbm *sc_sabre;
81 struct psycho_pbm *__sc_psycho_this;
82 struct psycho_pbm *__sc_psycho_other;
83 #define sc_simba_a __sc_psycho_this
84 #define sc_simba_b __sc_psycho_other
85 #define sc_psycho_this __sc_psycho_this
86 #define sc_psycho_other __sc_psycho_other
87
88 /*
89 * PSYCHO register. we record the base physical address of these
90 * also as it is the base of the entire PSYCHO
91 */
92 struct psychoreg *sc_regs;
93 paddr_t sc_basepaddr;
94
95 /* our tags (from parent) */
96 bus_space_tag_t sc_bustag;
97 bus_dma_tag_t sc_dmatag;
98
99 /* config space */
100 bus_space_tag_t sc_configtag;
101 paddr_t sc_configaddr;
102
103 int sc_clockfreq;
104 int sc_node; /* prom node */
105 int sc_mode; /* (whatareya?) */
106 #define PSYCHO_MODE_SABRE 1 /* i'm a sabre (yob) */
107 #define PSYCHO_MODE_PSYCHO_A 2 /* i'm a psycho (w*nker) */
108 #define PSYCHO_MODE_PSYCHO_B 3 /* i'm another psycho (w*nker) */
109
110 struct iommu_state sc_is;
111 };
112
113 /* config space is per-psycho. mem/io/dma are per-pci bus */
114 bus_dma_tag_t psycho_alloc_dma_tag __P((struct psycho_pbm *));
115 bus_space_tag_t psycho_alloc_bus_tag __P((struct psycho_pbm *, int));
116
117 #define psycho_alloc_config_tag(pp) psycho_alloc_bus_tag((pp), PCI_CONFIG_BUS_SPACE)
118 #define psycho_alloc_mem_tag(pp) psycho_alloc_bus_tag((pp), PCI_MEMORY_BUS_SPACE)
119 #define psycho_alloc_io_tag(pp) psycho_alloc_bus_tag((pp), PCI_IO_BUS_SPACE)
120
121 int psycho_intr_map __P((pcitag_t, int, int, pci_intr_handle_t *));
122
123 #endif /* _SPARC64_DEV_PSYCHOVAR_H_ */
124