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