rmixlvar.h revision 1.2.4.2 1 1.2.4.2 yamt /* $NetBSD: rmixlvar.h,v 1.2.4.2 2010/03/11 15:02:42 yamt Exp $ */
2 1.2.4.2 yamt
3 1.2.4.2 yamt /*
4 1.2.4.2 yamt * Copyright 2002 Wasabi Systems, Inc.
5 1.2.4.2 yamt * All rights reserved.
6 1.2.4.2 yamt *
7 1.2.4.2 yamt * Written by Simon Burge for Wasabi Systems, Inc.
8 1.2.4.2 yamt *
9 1.2.4.2 yamt * Redistribution and use in source and binary forms, with or without
10 1.2.4.2 yamt * modification, are permitted provided that the following conditions
11 1.2.4.2 yamt * are met:
12 1.2.4.2 yamt * 1. Redistributions of source code must retain the above copyright
13 1.2.4.2 yamt * notice, this list of conditions and the following disclaimer.
14 1.2.4.2 yamt * 2. Redistributions in binary form must reproduce the above copyright
15 1.2.4.2 yamt * notice, this list of conditions and the following disclaimer in the
16 1.2.4.2 yamt * documentation and/or other materials provided with the distribution.
17 1.2.4.2 yamt * 3. All advertising materials mentioning features or use of this software
18 1.2.4.2 yamt * must display the following acknowledgement:
19 1.2.4.2 yamt * This product includes software developed for the NetBSD Project by
20 1.2.4.2 yamt * Wasabi Systems, Inc.
21 1.2.4.2 yamt * 4. The name of Wasabi Systems, Inc. may not be used to endorse
22 1.2.4.2 yamt * or promote products derived from this software without specific prior
23 1.2.4.2 yamt * written permission.
24 1.2.4.2 yamt *
25 1.2.4.2 yamt * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
26 1.2.4.2 yamt * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
27 1.2.4.2 yamt * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 1.2.4.2 yamt * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
29 1.2.4.2 yamt * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 1.2.4.2 yamt * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 1.2.4.2 yamt * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 1.2.4.2 yamt * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 1.2.4.2 yamt * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 1.2.4.2 yamt * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 1.2.4.2 yamt * POSSIBILITY OF SUCH DAMAGE.
36 1.2.4.2 yamt */
37 1.2.4.2 yamt
38 1.2.4.2 yamt #ifndef _MIPS_RMI_RMIXLVAR_H_
39 1.2.4.2 yamt #define _MIPS_RMI_RMIXLVAR_H_
40 1.2.4.2 yamt
41 1.2.4.2 yamt #include <mips/cpu.h>
42 1.2.4.2 yamt #include <dev/pci/pcivar.h>
43 1.2.4.2 yamt #include <machine/bus.h>
44 1.2.4.2 yamt
45 1.2.4.2 yamt static inline bool
46 1.2.4.2 yamt cpu_rmixl(const struct pridtab *ct)
47 1.2.4.2 yamt {
48 1.2.4.2 yamt if (ct->cpu_cid == MIPS_PRID_CID_RMI)
49 1.2.4.2 yamt return true;
50 1.2.4.2 yamt return false;
51 1.2.4.2 yamt }
52 1.2.4.2 yamt
53 1.2.4.2 yamt static inline bool
54 1.2.4.2 yamt cpu_rmixlr(const struct pridtab *ct)
55 1.2.4.2 yamt {
56 1.2.4.2 yamt u_int type = ct->cpu_cidflags & MIPS_CIDFL_RMI_TYPE;
57 1.2.4.2 yamt if (cpu_rmixl(ct) && type == CIDFL_RMI_TYPE_XLR)
58 1.2.4.2 yamt return true;
59 1.2.4.2 yamt return false;
60 1.2.4.2 yamt }
61 1.2.4.2 yamt
62 1.2.4.2 yamt static inline bool
63 1.2.4.2 yamt cpu_rmixls(const struct pridtab *ct)
64 1.2.4.2 yamt {
65 1.2.4.2 yamt u_int type = ct->cpu_cidflags & MIPS_CIDFL_RMI_TYPE;
66 1.2.4.2 yamt if (cpu_rmixl(ct) && type == CIDFL_RMI_TYPE_XLS)
67 1.2.4.2 yamt return true;
68 1.2.4.2 yamt return false;
69 1.2.4.2 yamt }
70 1.2.4.2 yamt
71 1.2.4.2 yamt static inline bool
72 1.2.4.2 yamt cpu_rmixlp(const struct pridtab *ct)
73 1.2.4.2 yamt {
74 1.2.4.2 yamt u_int type = ct->cpu_cidflags & MIPS_CIDFL_RMI_TYPE;
75 1.2.4.2 yamt if (cpu_rmixl(ct) && type == CIDFL_RMI_TYPE_XLP)
76 1.2.4.2 yamt return true;
77 1.2.4.2 yamt return false;
78 1.2.4.2 yamt }
79 1.2.4.2 yamt
80 1.2.4.2 yamt
81 1.2.4.2 yamt typedef enum {
82 1.2.4.2 yamt RMIXL_INTR_EDGE=0,
83 1.2.4.2 yamt RMIXL_INTR_LEVEL,
84 1.2.4.2 yamt } rmixl_intr_trigger_t;
85 1.2.4.2 yamt
86 1.2.4.2 yamt typedef enum {
87 1.2.4.2 yamt RMIXL_INTR_RISING=0,
88 1.2.4.2 yamt RMIXL_INTR_HIGH,
89 1.2.4.2 yamt RMIXL_INTR_FALLING,
90 1.2.4.2 yamt RMIXL_INTR_LOW,
91 1.2.4.2 yamt } rmixl_intr_polarity_t;
92 1.2.4.2 yamt
93 1.2.4.2 yamt struct rmixl_config {
94 1.2.4.2 yamt uint64_t rc_io_pbase;
95 1.2.4.2 yamt bus_addr_t rc_pcie_cfg_pbase;
96 1.2.4.2 yamt bus_size_t rc_pcie_cfg_size;
97 1.2.4.2 yamt bus_addr_t rc_pcie_ecfg_pbase;
98 1.2.4.2 yamt bus_size_t rc_pcie_ecfg_size;
99 1.2.4.2 yamt bus_addr_t rc_pci_mem_pbase;
100 1.2.4.2 yamt bus_size_t rc_pci_mem_size;
101 1.2.4.2 yamt bus_addr_t rc_pci_io_pbase;
102 1.2.4.2 yamt bus_size_t rc_pci_io_size;
103 1.2.4.2 yamt struct mips_bus_space rc_obio_memt; /* DEVIO */
104 1.2.4.2 yamt struct mips_bus_space rc_pcie_cfg_memt; /* PCI CFG */
105 1.2.4.2 yamt struct mips_bus_space rc_pcie_ecfg_memt; /* PCI ECFG */
106 1.2.4.2 yamt struct mips_bus_space rc_pci_memt; /* PCI MEM */
107 1.2.4.2 yamt struct mips_bus_space rc_pci_iot; /* PCI IO */
108 1.2.4.2 yamt struct mips_bus_dma_tag rc_29bit_dmat;
109 1.2.4.2 yamt struct mips_bus_dma_tag rc_32bit_dmat;
110 1.2.4.2 yamt struct mips_bus_dma_tag rc_64bit_dmat;
111 1.2.4.2 yamt struct extent *rc_phys_ex; /* Note: MB units */
112 1.2.4.2 yamt struct extent *rc_obio_ex;
113 1.2.4.2 yamt struct extent *rc_pcie_cfg_ex;
114 1.2.4.2 yamt struct extent *rc_pcie_ecfg_ex;
115 1.2.4.2 yamt struct extent *rc_pcie_mem_ex;
116 1.2.4.2 yamt struct extent *rc_pcie_io_ex;
117 1.2.4.2 yamt int rc_mallocsafe;
118 1.2.4.2 yamt };
119 1.2.4.2 yamt
120 1.2.4.2 yamt extern struct rmixl_config rmixl_configuration;
121 1.2.4.2 yamt
122 1.2.4.2 yamt extern void rmixl_obio_bus_mem_init(bus_space_tag_t, void *);
123 1.2.4.2 yamt extern void rmixl_pcie_cfg_bus_mem_init(bus_space_tag_t, void *);
124 1.2.4.2 yamt extern void rmixl_pcie_ecfg_bus_mem_init(bus_space_tag_t, void *);
125 1.2.4.2 yamt extern void rmixl_pcie_bus_mem_init(bus_space_tag_t, void *);
126 1.2.4.2 yamt extern void rmixl_pcie_bus_io_init(bus_space_tag_t, void *);
127 1.2.4.2 yamt
128 1.2.4.2 yamt extern const char *rmixl_intr_string(int);
129 1.2.4.2 yamt extern void *rmixl_intr_establish(int, int,
130 1.2.4.2 yamt rmixl_intr_trigger_t, rmixl_intr_polarity_t,
131 1.2.4.2 yamt int (*)(void *), void *);
132 1.2.4.2 yamt extern void rmixl_intr_disestablish(void *);
133 1.2.4.2 yamt
134 1.2.4.2 yamt extern void rmixl_addr_error_init(void);
135 1.2.4.2 yamt extern int rmixl_addr_error_check(void);
136 1.2.4.2 yamt
137 1.2.4.2 yamt extern uint64_t rmixl_mfcr(u_int);
138 1.2.4.2 yamt extern void rmixl_mtcr(uint64_t, u_int);
139 1.2.4.2 yamt
140 1.2.4.2 yamt #endif /* _MIPS_RMI_RMIXLVAR_H_ */
141