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