Annotation of sys/arch/sparc64/dev/psychovar.h, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: psychovar.h,v 1.6 2003/05/16 06:59:12 henric Exp $ */
2: /* $NetBSD: psychovar.h,v 1.6 2001/07/20 00:07:13 eeh Exp $ */
3:
4: /*
5: * Copyright (c) 1999, 2000 Matthew R. Green
6: * All rights reserved.
7: *
8: * Redistribution and use in source and binary forms, with or without
9: * modification, are permitted provided that the following conditions
10: * are met:
11: * 1. Redistributions of source code must retain the above copyright
12: * notice, this list of conditions and the following disclaimer.
13: * 2. Redistributions in binary form must reproduce the above copyright
14: * notice, this list of conditions and the following disclaimer in the
15: * documentation and/or other materials provided with the distribution.
16: * 3. The name of the author may not be used to endorse or promote products
17: * derived from this software without specific prior written permission.
18: *
19: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
24: * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25: * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
26: * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27: * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29: * SUCH DAMAGE.
30: */
31:
32: #ifndef _SPARC64_DEV_PSYCHOVAR_H_
33: #define _SPARC64_DEV_PSYCHOVAR_H_
34:
35: /* per real PCI bus info */
36: struct psycho_softc;
37:
38: struct psycho_pbm {
39: /* link to mum */
40: struct psycho_softc *pp_sc;
41:
42: /*
43: * note that the sabre really only has one ranges property,
44: * used for both simba a and simba b (but the ranges for
45: * real psychos are the same for PCI A and PCI B anyway).
46: */
47: struct psycho_registers *pp_regs;
48: struct psycho_ranges *pp_range;
49:
50: /* counts of above */
51: int pp_nregs;
52: int pp_nrange;
53: int pp_nintmap;
54:
55: /* PCI Bus Module A or PCI Bus Module B */
56: int pp_id;
57: #define PSYCHO_PBM_UNKNOWN 0
58: #define PSYCHO_PBM_A 1
59: #define PSYCHO_PBM_B 2
60:
61: /* chipset tag for this instance */
62: pci_chipset_tag_t pp_pc;
63:
64: /* our tags */
65: bus_space_tag_t pp_memt;
66: bus_space_tag_t pp_iot;
67: bus_dma_tag_t pp_dmat;
68: int pp_bus;
69: int pp_flags;
70:
71: /* and pointers into the psycho regs for our bits */
72: bus_space_handle_t pp_pcictl;
73: struct strbuf_ctl pp_sb;
74: /* area we can use for flushing our streaming buffer */
75: char pp_flush[0x80];
76: };
77:
78: /*
79: * per-PCI bus on mainbus softc structure; one for sabre, or two
80: * per pair of psycho's.
81: */
82: struct psycho_softc {
83: struct device sc_dev;
84:
85: /*
86: * one sabre has two simba's. psycho's are separately attached,
87: * with the `other' psycho_pbm allocated at the first's attach.
88: */
89: struct psycho_pbm *__sc_psycho_this;
90: struct psycho_pbm *__sc_psycho_other;
91: #define sc_psycho_this __sc_psycho_this
92: #define sc_psycho_other __sc_psycho_other
93:
94: /*
95: * PSYCHO register. we record the base physical address of these
96: * also as it is the base of the entire PSYCHO
97: */
98: bus_space_handle_t sc_regsh;
99: bus_space_handle_t sc_pcictl;
100: paddr_t sc_basepaddr;
101:
102: /* Interrupt Group Number for this device */
103: int sc_ign;
104:
105: /* our tags (from parent) */
106: bus_space_tag_t sc_bustag;
107: bus_dma_tag_t sc_dmatag;
108:
109: /* config space */
110: bus_space_tag_t sc_configtag;
111: bus_space_handle_t sc_configaddr;
112:
113: int sc_clockfreq;
114: int sc_node; /* prom node */
115: int sc_mode; /* (whatareya?) */
116: #define PSYCHO_MODE_SABRE 1 /* i'm a sabre (yob) */
117: #define PSYCHO_MODE_PSYCHO 2 /* i'm a psycho (w*nker) */
118:
119: struct iommu_state *sc_is;
120: };
121:
122: /* config space is per-psycho. mem/io/dma are per-pci bus */
123: bus_dma_tag_t psycho_alloc_dma_tag(struct psycho_pbm *);
124:
125: bus_space_tag_t psycho_alloc_mem_tag(struct psycho_pbm *);
126: bus_space_tag_t psycho_alloc_io_tag(struct psycho_pbm *);
127: bus_space_tag_t psycho_alloc_config_tag(struct psycho_pbm *);
128:
129: /* uperf attachment to psycho's */
130: struct uperf_psycho_attach_args {
131: char *upaa_name;
132: struct perfmon *upaa_regs;
133: };
134:
135: #define psycho_psychoreg_read(sc, reg) \
136: bus_space_read_8((sc)->sc_bustag, (sc)->sc_regsh, \
137: offsetof(struct psychoreg, reg))
138:
139: #define psycho_psychoreg_write(sc, reg, v) \
140: bus_space_write_8((sc)->sc_bustag, (sc)->sc_regsh, \
141: offsetof(struct psychoreg, reg), (v))
142:
143: #define psycho_psychoreg_vaddr(sc, reg) \
144: (bus_space_vaddr((sc)->sc_bustag, (sc)->sc_regsh) + \
145: offsetof(struct psychoreg, reg))
146:
147: #define psycho_pcictl_read(sc, reg) \
148: bus_space_read_8((sc)->sc_bustag, (sc)->sc_pcictl, \
149: offsetof(struct pci_ctl, reg))
150:
151: #define psycho_pcictl_write(sc, reg, v) \
152: bus_space_write_8((sc)->sc_bustag, (sc)->sc_pcictl, \
153: offsetof(struct pci_ctl, reg), (v))
154:
155: #endif /* _SPARC64_DEV_PSYCHOVAR_H_ */
CVSweb