rmixl_fmn.c revision 1.1.4.1 1 1.1.4.1 jruoho /* $NetBSD: rmixl_fmn.c,v 1.1.4.1 2011/06/06 09:06:09 jruoho Exp $ */
2 1.1.4.1 jruoho /*-
3 1.1.4.1 jruoho * Copyright (c) 2010 The NetBSD Foundation, Inc.
4 1.1.4.1 jruoho * All rights reserved.
5 1.1.4.1 jruoho *
6 1.1.4.1 jruoho * This code is derived from software contributed to The NetBSD Foundation
7 1.1.4.1 jruoho * by Cliff Neighbors.
8 1.1.4.1 jruoho *
9 1.1.4.1 jruoho * Redistribution and use in source and binary forms, with or without
10 1.1.4.1 jruoho * modification, are permitted provided that the following conditions
11 1.1.4.1 jruoho * are met:
12 1.1.4.1 jruoho * 1. Redistributions of source code must retain the above copyright
13 1.1.4.1 jruoho * notice, this list of conditions and the following disclaimer.
14 1.1.4.1 jruoho * 2. Redistributions in binary form must reproduce the above copyright
15 1.1.4.1 jruoho * notice, this list of conditions and the following disclaimer in the
16 1.1.4.1 jruoho * documentation and/or other materials provided with the distribution.
17 1.1.4.1 jruoho *
18 1.1.4.1 jruoho * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19 1.1.4.1 jruoho * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 1.1.4.1 jruoho * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 1.1.4.1 jruoho * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22 1.1.4.1 jruoho * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 1.1.4.1 jruoho * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 1.1.4.1 jruoho * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 1.1.4.1 jruoho * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 1.1.4.1 jruoho * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 1.1.4.1 jruoho * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 1.1.4.1 jruoho * POSSIBILITY OF SUCH DAMAGE.
29 1.1.4.1 jruoho */
30 1.1.4.1 jruoho
31 1.1.4.1 jruoho #include "opt_ddb.h"
32 1.1.4.1 jruoho
33 1.1.4.1 jruoho #include <sys/cdefs.h>
34 1.1.4.1 jruoho #include <sys/param.h>
35 1.1.4.1 jruoho #include <sys/systm.h>
36 1.1.4.1 jruoho #include <sys/cpu.h>
37 1.1.4.1 jruoho #include <mips/cpuregs.h>
38 1.1.4.1 jruoho #include <mips/rmi/rmixlreg.h>
39 1.1.4.1 jruoho #include <mips/rmi/rmixlvar.h>
40 1.1.4.1 jruoho #include <mips/rmi/rmixl_intr.h>
41 1.1.4.1 jruoho #include <mips/rmi/rmixl_fmnvar.h>
42 1.1.4.1 jruoho
43 1.1.4.1 jruoho #ifdef FMN_DEBUG
44 1.1.4.1 jruoho # define DPRINTF(x) do { printf x ; } while(0)
45 1.1.4.1 jruoho #else
46 1.1.4.1 jruoho # define DPRINTF(x)
47 1.1.4.1 jruoho #endif
48 1.1.4.1 jruoho
49 1.1.4.1 jruoho #ifdef DIAGNOSTIC
50 1.1.4.1 jruoho # define DIAG_PRF(x) do { printf x ; } while(0)
51 1.1.4.1 jruoho #else
52 1.1.4.1 jruoho # define DIAG_PRF(x)
53 1.1.4.1 jruoho #endif
54 1.1.4.1 jruoho
55 1.1.4.1 jruoho
56 1.1.4.1 jruoho
57 1.1.4.1 jruoho /*
58 1.1.4.1 jruoho * index CPU-dependent table by (global) bucket ID to obtain logical Station ID
59 1.1.4.1 jruoho * see Table 12.1 in the XLS PRM
60 1.1.4.1 jruoho */
61 1.1.4.1 jruoho /* use this table for XLS6xx, XLS4xx */
62 1.1.4.1 jruoho static const int station_xls_4xx[] = {
63 1.1.4.1 jruoho [0 ... 7] = RMIXLS_FMN_STID_CORE0,
64 1.1.4.1 jruoho [8 ... 15] = RMIXLS_FMN_STID_CORE1,
65 1.1.4.1 jruoho [16 ... 23] = RMIXLS_FMN_STID_CORE2,
66 1.1.4.1 jruoho [24 ... 31] = RMIXLS_FMN_STID_CORE3,
67 1.1.4.1 jruoho [32 ... 63] = RMIXLS_FMN_STID_RESERVED,
68 1.1.4.1 jruoho [64 ... 71] = RMIXLS_FMN_STID_PCIE,
69 1.1.4.1 jruoho [72 ... 79] = RMIXLS_FMN_STID_RESERVED,
70 1.1.4.1 jruoho [80 ... 87] = RMIXLS_FMN_STID_GMAC_Q1,
71 1.1.4.1 jruoho [88 ... 95] = RMIXLS_FMN_STID_RESERVED,
72 1.1.4.1 jruoho [96 ... 103] = RMIXLS_FMN_STID_GMAC_Q0,
73 1.1.4.1 jruoho [104 ... 107] = RMIXLS_FMN_STID_DMA,
74 1.1.4.1 jruoho [108 ... 109] = RMIXLS_FMN_STID_CDE,
75 1.1.4.1 jruoho [110 ... 119] = RMIXLS_FMN_STID_RESERVED,
76 1.1.4.1 jruoho [120 ... 127] = RMIXLS_FMN_STID_SAE,
77 1.1.4.1 jruoho };
78 1.1.4.1 jruoho
79 1.1.4.1 jruoho /* use this table for XLS408Lite, XLS404Lite */
80 1.1.4.1 jruoho static const int station_xls_4xx_lite[] = {
81 1.1.4.1 jruoho [0 ... 7] = RMIXLS_FMN_STID_CORE0,
82 1.1.4.1 jruoho [8 ... 15] = RMIXLS_FMN_STID_CORE1,
83 1.1.4.1 jruoho [16 ... 23] = RMIXLS_FMN_STID_CORE2,
84 1.1.4.1 jruoho [24 ... 31] = RMIXLS_FMN_STID_CORE3,
85 1.1.4.1 jruoho [32 ... 79] = RMIXLS_FMN_STID_RESERVED,
86 1.1.4.1 jruoho [80 ... 87] = RMIXLS_FMN_STID_GMAC_Q1,
87 1.1.4.1 jruoho [88 ... 95] = RMIXLS_FMN_STID_RESERVED,
88 1.1.4.1 jruoho [96 ... 103] = RMIXLS_FMN_STID_GMAC_Q0,
89 1.1.4.1 jruoho [104 ... 107] = RMIXLS_FMN_STID_DMA,
90 1.1.4.1 jruoho [108 ... 109] = RMIXLS_FMN_STID_CDE,
91 1.1.4.1 jruoho [110 ... 115] = RMIXLS_FMN_STID_RESERVED,
92 1.1.4.1 jruoho [116 ... 119] = RMIXLS_FMN_STID_PCIE,
93 1.1.4.1 jruoho [120 ... 127] = RMIXLS_FMN_STID_SAE,
94 1.1.4.1 jruoho };
95 1.1.4.1 jruoho
96 1.1.4.1 jruoho /* use this table for XLS2xx */
97 1.1.4.1 jruoho static const int station_xls_2xx[] = {
98 1.1.4.1 jruoho [0 ... 7] = RMIXLS_FMN_STID_CORE0,
99 1.1.4.1 jruoho [8 ... 15] = RMIXLS_FMN_STID_CORE1,
100 1.1.4.1 jruoho [16 ... 23] = RMIXLS_FMN_STID_CORE2,
101 1.1.4.1 jruoho [24 ... 31] = RMIXLS_FMN_STID_CORE3,
102 1.1.4.1 jruoho [32 ... 63] = RMIXLS_FMN_STID_RESERVED,
103 1.1.4.1 jruoho [64 ... 71] = RMIXLS_FMN_STID_PCIE,
104 1.1.4.1 jruoho [72 ... 95] = RMIXLS_FMN_STID_RESERVED,
105 1.1.4.1 jruoho [96 ... 103] = RMIXLS_FMN_STID_GMAC_Q0,
106 1.1.4.1 jruoho [104 ... 107] = RMIXLS_FMN_STID_DMA,
107 1.1.4.1 jruoho [108 ... 119] = RMIXLS_FMN_STID_RESERVED,
108 1.1.4.1 jruoho [120 ... 127] = RMIXLS_FMN_STID_SAE,
109 1.1.4.1 jruoho };
110 1.1.4.1 jruoho
111 1.1.4.1 jruoho /* use this table for XLS1xx */
112 1.1.4.1 jruoho static const int station_xls_1xx[] = {
113 1.1.4.1 jruoho [0 ... 7] = RMIXLS_FMN_STID_CORE0,
114 1.1.4.1 jruoho [8 ... 15] = RMIXLS_FMN_STID_CORE1,
115 1.1.4.1 jruoho [16 ... 23] = RMIXLS_FMN_STID_CORE2,
116 1.1.4.1 jruoho [24 ... 31] = RMIXLS_FMN_STID_CORE3,
117 1.1.4.1 jruoho [32 ... 63] = RMIXLS_FMN_STID_RESERVED,
118 1.1.4.1 jruoho [64 ... 71] = RMIXLS_FMN_STID_PCIE,
119 1.1.4.1 jruoho [72 ... 95] = RMIXLS_FMN_STID_RESERVED,
120 1.1.4.1 jruoho [96 ... 101] = RMIXLS_FMN_STID_GMAC_Q0,
121 1.1.4.1 jruoho [102 ... 103] = RMIXLS_FMN_STID_RESERVED,
122 1.1.4.1 jruoho [104 ... 107] = RMIXLS_FMN_STID_DMA,
123 1.1.4.1 jruoho [108 ... 119] = RMIXLS_FMN_STID_RESERVED,
124 1.1.4.1 jruoho [120 ... 127] = RMIXLS_FMN_STID_SAE,
125 1.1.4.1 jruoho };
126 1.1.4.1 jruoho
127 1.1.4.1 jruoho /* use this table for XLRxxx */
128 1.1.4.1 jruoho static const int station_xlr_xxx[] = {
129 1.1.4.1 jruoho [0 ... 7] = RMIXLR_FMN_STID_CORE0,
130 1.1.4.1 jruoho [8 ... 15] = RMIXLR_FMN_STID_CORE1,
131 1.1.4.1 jruoho [16 ... 23] = RMIXLR_FMN_STID_CORE2,
132 1.1.4.1 jruoho [24 ... 31] = RMIXLR_FMN_STID_CORE3,
133 1.1.4.1 jruoho [32 ... 39] = RMIXLR_FMN_STID_CORE4,
134 1.1.4.1 jruoho [40 ... 47] = RMIXLR_FMN_STID_CORE5,
135 1.1.4.1 jruoho [48 ... 55] = RMIXLR_FMN_STID_CORE6,
136 1.1.4.1 jruoho [56 ... 63] = RMIXLR_FMN_STID_CORE7,
137 1.1.4.1 jruoho [64 ... 79] = RMIXLR_FMN_STID_TXRX_0,
138 1.1.4.1 jruoho [80 ... 95] = RMIXLR_FMN_STID_TXRX_1,
139 1.1.4.1 jruoho [96 ... 103] = RMIXLR_FMN_STID_RGMII,
140 1.1.4.1 jruoho [104 ... 107] = RMIXLR_FMN_STID_DMA,
141 1.1.4.1 jruoho [108 ... 111] = RMIXLR_FMN_STID_RESERVED,
142 1.1.4.1 jruoho [112 ... 113] = RMIXLR_FMN_STID_FREE_0,
143 1.1.4.1 jruoho [114 ... 115] = RMIXLR_FMN_STID_FREE_0,
144 1.1.4.1 jruoho [116 ... 119] = RMIXLR_FMN_STID_RESERVED,
145 1.1.4.1 jruoho [120 ... 127] = RMIXLR_FMN_STID_SAE,
146 1.1.4.1 jruoho };
147 1.1.4.1 jruoho
148 1.1.4.1 jruoho typedef struct fmn_station_info {
149 1.1.4.1 jruoho const char *si_name;
150 1.1.4.1 jruoho const u_int si_buckets_max;
151 1.1.4.1 jruoho const u_int si_stid_first;
152 1.1.4.1 jruoho const u_int si_stid_last;
153 1.1.4.1 jruoho const u_int si_bucket_size_dflt;
154 1.1.4.1 jruoho const u_int si_credits_min;
155 1.1.4.1 jruoho const u_int si_regbase;
156 1.1.4.1 jruoho } fmn_station_info_t;
157 1.1.4.1 jruoho
158 1.1.4.1 jruoho /* use this table for XLS6xx, XLS4xx */
159 1.1.4.1 jruoho static const fmn_station_info_t station_info_xls_4xx[RMIXLS_FMN_NSTID] = {
160 1.1.4.1 jruoho [RMIXLS_FMN_STID_CORE0] = { "core0", 8, 0, 7, 32, 4, 0 },
161 1.1.4.1 jruoho [RMIXLS_FMN_STID_CORE1] = { "core1", 8, 8, 15, 32, 4, 0 },
162 1.1.4.1 jruoho [RMIXLS_FMN_STID_CORE2] = { "core2", 8, 16, 23, 32, 4, 0 },
163 1.1.4.1 jruoho [RMIXLS_FMN_STID_CORE3] = { "core3", 8, 24, 31, 32, 4, 0 },
164 1.1.4.1 jruoho [RMIXLS_FMN_STID_GMAC_Q0] = { "gmac_q0", 3, 80, 87, 32, 0, RMIXL_IO_DEV_GMAC_0 },
165 1.1.4.1 jruoho [RMIXLS_FMN_STID_GMAC_Q1] = { "gmac_q1", 3, 96, 103, 32, 0, RMIXL_IO_DEV_GMAC_4 },
166 1.1.4.1 jruoho [RMIXLS_FMN_STID_DMA] = { "dma", 4, 104, 107, 64, 0, RMIXL_IO_DEV_DMA },
167 1.1.4.1 jruoho [RMIXLS_FMN_STID_CDE] = { "cde", 4, 108, 109, 128, 0, RMIXL_IO_DEV_CDE },
168 1.1.4.1 jruoho [RMIXLS_FMN_STID_PCIE] = { "pcie", 8, 64, 71, 32, 0, RMIXL_IO_DEV_PCIE_BE },
169 1.1.4.1 jruoho [RMIXLS_FMN_STID_SAE] = { "sae", 2, 120, 121, 128, 0, RMIXL_IO_DEV_SAE },
170 1.1.4.1 jruoho };
171 1.1.4.1 jruoho
172 1.1.4.1 jruoho /* use this table for XLS4xxLite */
173 1.1.4.1 jruoho static const fmn_station_info_t station_info_xls_4xx_lite[RMIXLS_FMN_NSTID] = {
174 1.1.4.1 jruoho [RMIXLS_FMN_STID_CORE0] = { "core0", 8, 0, 7, 32, 4, 0 },
175 1.1.4.1 jruoho [RMIXLS_FMN_STID_CORE1] = { "core1", 8, 8, 15, 32, 4, 0 },
176 1.1.4.1 jruoho [RMIXLS_FMN_STID_CORE2] = { "core2", 8, 16, 23, 32, 4, 0 },
177 1.1.4.1 jruoho [RMIXLS_FMN_STID_CORE3] = { "core3", 8, 24, 31, 32, 4, 0 },
178 1.1.4.1 jruoho [RMIXLS_FMN_STID_GMAC_Q0] = { "gmac_q0", 3, 80, 87, 32, 0, RMIXL_IO_DEV_GMAC_0 },
179 1.1.4.1 jruoho [RMIXLS_FMN_STID_GMAC_Q1] = { "gmac_q1", 3, 96, 103, 32, 0, RMIXL_IO_DEV_GMAC_4 },
180 1.1.4.1 jruoho [RMIXLS_FMN_STID_DMA] = { "dma", 4, 104, 107, 64, 0, RMIXL_IO_DEV_DMA },
181 1.1.4.1 jruoho [RMIXLS_FMN_STID_CDE] = { "cde", 4, 108, 109, 128, 0, RMIXL_IO_DEV_CDE },
182 1.1.4.1 jruoho [RMIXLS_FMN_STID_PCIE] = { "pcie", 4, 116, 119, 64, 0, RMIXL_IO_DEV_PCIE_BE },
183 1.1.4.1 jruoho [RMIXLS_FMN_STID_SAE] = { "sae", 2, 120, 121, 128, 0, RMIXL_IO_DEV_SAE },
184 1.1.4.1 jruoho };
185 1.1.4.1 jruoho
186 1.1.4.1 jruoho /* use this table for XLS2xx */
187 1.1.4.1 jruoho static const fmn_station_info_t station_info_xls_2xx[RMIXLS_FMN_NSTID] = {
188 1.1.4.1 jruoho [RMIXLS_FMN_STID_CORE0] = { "core0", 8, 0, 7, 32, 4, 0 },
189 1.1.4.1 jruoho [RMIXLS_FMN_STID_CORE1] = { "core1", 8, 8, 15, 32, 4, 0 },
190 1.1.4.1 jruoho [RMIXLS_FMN_STID_CORE2] = { "core2", 8, 16, 23, 32, 4, 0 },
191 1.1.4.1 jruoho [RMIXLS_FMN_STID_CORE3] = { "core3", 8, 24, 31, 32, 4, 0 },
192 1.1.4.1 jruoho [RMIXLS_FMN_STID_GMAC_Q0] = { "gmac_q0", 3, 96, 103, 32, 0, RMIXL_IO_DEV_GMAC_0 },
193 1.1.4.1 jruoho [RMIXLS_FMN_STID_DMA] = { "dma", 4, 104, 107, 64, 0, RMIXL_IO_DEV_DMA },
194 1.1.4.1 jruoho [RMIXLS_FMN_STID_PCIE] = { "pcie", 8, 64, 71, 32, 0, RMIXL_IO_DEV_PCIE_BE },
195 1.1.4.1 jruoho [RMIXLS_FMN_STID_SAE] = { "sae", 2, 120, 121, 128, 0, RMIXL_IO_DEV_SAE },
196 1.1.4.1 jruoho };
197 1.1.4.1 jruoho
198 1.1.4.1 jruoho /* use this table for XLS1xx */
199 1.1.4.1 jruoho static const fmn_station_info_t station_info_xls_1xx[RMIXLS_FMN_NSTID] = {
200 1.1.4.1 jruoho [RMIXLS_FMN_STID_CORE0] = { "core0", 8, 0, 7, 32, 4, 0 },
201 1.1.4.1 jruoho [RMIXLS_FMN_STID_CORE1] = { "core1", 8, 8, 15, 32, 4, 0 },
202 1.1.4.1 jruoho [RMIXLS_FMN_STID_CORE2] = { "core2", 8, 16, 23, 32, 4, 0 },
203 1.1.4.1 jruoho [RMIXLS_FMN_STID_CORE3] = { "core3", 8, 24, 31, 32, 4, 0 },
204 1.1.4.1 jruoho [RMIXLS_FMN_STID_GMAC_Q0] = { "gmac_q0", 3, 96, 101, 32, 0, RMIXL_IO_DEV_GMAC_0 },
205 1.1.4.1 jruoho [RMIXLS_FMN_STID_DMA] = { "dma", 4, 104, 107, 64, 0, RMIXL_IO_DEV_PCIE_BE },
206 1.1.4.1 jruoho [RMIXLS_FMN_STID_PCIE] = { "pcie", 4, 64, 67, 32, 0, RMIXL_IO_DEV_PCIE_BE },
207 1.1.4.1 jruoho [RMIXLS_FMN_STID_SAE] = { "sae", 2, 120, 121, 128, 0, RMIXL_IO_DEV_SAE },
208 1.1.4.1 jruoho };
209 1.1.4.1 jruoho
210 1.1.4.1 jruoho /*
211 1.1.4.1 jruoho * use this table for XLRxxx
212 1.1.4.1 jruoho * caution:
213 1.1.4.1 jruoho * - the XGMII/SPI4 stations si_regbase are 'special'
214 1.1.4.1 jruoho * - the RGMII station si_regbase is 'special'
215 1.1.4.1 jruoho */
216 1.1.4.1 jruoho static const fmn_station_info_t station_info_xlr_xxx[RMIXLR_FMN_NSTID] = {
217 1.1.4.1 jruoho [RMIXLR_FMN_STID_CORE0] = { "core0", 8, 0, 7, 32, 4, 0 },
218 1.1.4.1 jruoho [RMIXLR_FMN_STID_CORE1] = { "core1", 8, 8, 15, 32, 4, 0 },
219 1.1.4.1 jruoho [RMIXLR_FMN_STID_CORE2] = { "core2", 8, 16, 23, 32, 4, 0 },
220 1.1.4.1 jruoho [RMIXLR_FMN_STID_CORE3] = { "core3", 8, 24, 31, 32, 4, 0 },
221 1.1.4.1 jruoho [RMIXLR_FMN_STID_CORE4] = { "core4", 8, 32, 39, 32, 4, 0 },
222 1.1.4.1 jruoho [RMIXLR_FMN_STID_CORE5] = { "core5", 8, 40, 47, 32, 4, 0 },
223 1.1.4.1 jruoho [RMIXLR_FMN_STID_CORE6] = { "core6", 8, 48, 55, 32, 4, 0 },
224 1.1.4.1 jruoho [RMIXLR_FMN_STID_CORE7] = { "core7", 8, 56, 63, 32, 4, 0 },
225 1.1.4.1 jruoho [RMIXLR_FMN_STID_TXRX_0] = { "txrx0", 1, 64, 79, 16, 0, RMIXL_IO_DEV_XGMAC_A },
226 1.1.4.1 jruoho [RMIXLR_FMN_STID_TXRX_1] = { "txrx1", 1, 80, 95, 16, 0, RMIXL_IO_DEV_XGMAC_B },
227 1.1.4.1 jruoho [RMIXLR_FMN_STID_RGMII] = { "rgmii", 8, 96, 103, 32, 0, RMIXL_IO_DEV_GMAC_A },
228 1.1.4.1 jruoho [RMIXLR_FMN_STID_DMA] = { "dma", 4, 104, 107, 64, 0, RMIXL_IO_DEV_DMA },
229 1.1.4.1 jruoho [RMIXLR_FMN_STID_FREE_0] = { "free0", 2, 112, 113, 128, 0, RMIXL_IO_DEV_XGMAC_A },
230 1.1.4.1 jruoho [RMIXLR_FMN_STID_FREE_1] = { "free1", 2, 114, 115, 128, 0, RMIXL_IO_DEV_XGMAC_B },
231 1.1.4.1 jruoho [RMIXLR_FMN_STID_SAE] = { "sae", 5, 120, 124, 32, 0, RMIXL_IO_DEV_SAE },
232 1.1.4.1 jruoho };
233 1.1.4.1 jruoho
234 1.1.4.1 jruoho
235 1.1.4.1 jruoho typedef struct fmn_intrhand {
236 1.1.4.1 jruoho int (*ih_func)(void *, rmixl_fmn_rxmsg_t *);
237 1.1.4.1 jruoho void *ih_arg;
238 1.1.4.1 jruoho struct evcnt ih_count;
239 1.1.4.1 jruoho } fmn_intrhand_t;
240 1.1.4.1 jruoho
241 1.1.4.1 jruoho /*
242 1.1.4.1 jruoho * per-core FMN structure
243 1.1.4.1 jruoho */
244 1.1.4.1 jruoho typedef struct fmn {
245 1.1.4.1 jruoho kmutex_t *fmn_lock;
246 1.1.4.1 jruoho u_int fmn_core;
247 1.1.4.1 jruoho u_int fmn_thread;
248 1.1.4.1 jruoho u_int fmn_nstid;
249 1.1.4.1 jruoho const int *fmn_stidtab;
250 1.1.4.1 jruoho const fmn_station_info_t *fmn_stinfo;
251 1.1.4.1 jruoho void *fmn_ih;
252 1.1.4.1 jruoho fmn_intrhand_t fmn_intrhand[RMIXL_FMN_NSTID];
253 1.1.4.1 jruoho } fmn_t;
254 1.1.4.1 jruoho
255 1.1.4.1 jruoho static fmn_t fmn_store[1 << 10]; /* index by cpuid) *//* XXX assumes 1 node */
256 1.1.4.1 jruoho #define NFMN (sizeof(fmn_store) / sizeof(fmn_store[0]))
257 1.1.4.1 jruoho
258 1.1.4.1 jruoho static fmn_t *
259 1.1.4.1 jruoho fmn_lookup(cpuid_t cpuid)
260 1.1.4.1 jruoho {
261 1.1.4.1 jruoho KASSERT(cpuid < (cpuid_t)NFMN);
262 1.1.4.1 jruoho return &fmn_store[cpuid];
263 1.1.4.1 jruoho }
264 1.1.4.1 jruoho
265 1.1.4.1 jruoho static void rmixl_fmn_init_core_xlr(fmn_t *);
266 1.1.4.1 jruoho static void rmixl_fmn_init_core_xls(fmn_t *);
267 1.1.4.1 jruoho static void rmixl_fmn_config_noncore(fmn_t *);
268 1.1.4.1 jruoho static void rmixl_fmn_config_core(fmn_t *);
269 1.1.4.1 jruoho #ifdef NOTYET
270 1.1.4.1 jruoho static int rmixl_fmn_intr_dispatch(void *);
271 1.1.4.1 jruoho #endif /* NOTYET */
272 1.1.4.1 jruoho static int rmixl_fmn_msg_recv_subr(u_int, rmixl_fmn_rxmsg_t *);
273 1.1.4.1 jruoho
274 1.1.4.1 jruoho #ifdef FMN_DEBUG
275 1.1.4.1 jruoho void rmixl_fmn_cp2_dump(void);
276 1.1.4.1 jruoho void rmixl_fmn_cc_dump(void);
277 1.1.4.1 jruoho #endif
278 1.1.4.1 jruoho
279 1.1.4.1 jruoho /*
280 1.1.4.1 jruoho * macros used because mtc2, mfc2, dmtc2, dmfc2 instructions
281 1.1.4.1 jruoho * must use literal values for rd and sel operands
282 1.1.4.1 jruoho * so let the compiler sort it out
283 1.1.4.1 jruoho */
284 1.1.4.1 jruoho
285 1.1.4.1 jruoho /*
286 1.1.4.1 jruoho * write v to all 8 SELs for given RD
287 1.1.4.1 jruoho */
288 1.1.4.1 jruoho #define FMN_CP2_4SEL_READ(rd, sel, vp) \
289 1.1.4.1 jruoho do { \
290 1.1.4.1 jruoho uint32_t *rp = vp; \
291 1.1.4.1 jruoho RMIXL_MFC2(rd, sel, rp[0]); \
292 1.1.4.1 jruoho RMIXL_MFC2(rd, sel+1, rp[1]); \
293 1.1.4.1 jruoho RMIXL_MFC2(rd, sel+2, rp[2]); \
294 1.1.4.1 jruoho RMIXL_MFC2(rd, sel+3, rp[3]); \
295 1.1.4.1 jruoho } while (0)
296 1.1.4.1 jruoho
297 1.1.4.1 jruoho /*
298 1.1.4.1 jruoho * write v to all 8 SELs for given RD
299 1.1.4.1 jruoho */
300 1.1.4.1 jruoho #define FMN_CP2_4SEL_WRITE(rd, sel, v) \
301 1.1.4.1 jruoho do { \
302 1.1.4.1 jruoho RMIXL_MTC2(rd, sel, v); \
303 1.1.4.1 jruoho RMIXL_MTC2(rd, sel+1, v); \
304 1.1.4.1 jruoho RMIXL_MTC2(rd, sel+2, v); \
305 1.1.4.1 jruoho RMIXL_MTC2(rd, sel+3, v); \
306 1.1.4.1 jruoho } while (0)
307 1.1.4.1 jruoho
308 1.1.4.1 jruoho #define FMN_CP2_8SEL_WRITE(rd, v) \
309 1.1.4.1 jruoho do { \
310 1.1.4.1 jruoho RMIXL_MTC2(rd, 0, v); \
311 1.1.4.1 jruoho RMIXL_MTC2(rd, 1, v); \
312 1.1.4.1 jruoho RMIXL_MTC2(rd, 2, v); \
313 1.1.4.1 jruoho RMIXL_MTC2(rd, 3, v); \
314 1.1.4.1 jruoho RMIXL_MTC2(rd, 4, v); \
315 1.1.4.1 jruoho RMIXL_MTC2(rd, 5, v); \
316 1.1.4.1 jruoho RMIXL_MTC2(rd, 6, v); \
317 1.1.4.1 jruoho RMIXL_MTC2(rd, 7, v); \
318 1.1.4.1 jruoho } while (0)
319 1.1.4.1 jruoho
320 1.1.4.1 jruoho
321 1.1.4.1 jruoho #define FMN_CP2_SEL_CASE_READ(rd, sel, v) \
322 1.1.4.1 jruoho case sel: \
323 1.1.4.1 jruoho RMIXL_MFC2(rd, sel, v); \
324 1.1.4.1 jruoho break
325 1.1.4.1 jruoho #define FMN_CP2_SEL_CASE_WRITE(rd, sel, v) \
326 1.1.4.1 jruoho case sel: \
327 1.1.4.1 jruoho RMIXL_MTC2(rd, sel, v); \
328 1.1.4.1 jruoho break
329 1.1.4.1 jruoho /*
330 1.1.4.1 jruoho * read/write a single arbitrary sel for the given rd
331 1.1.4.1 jruoho */
332 1.1.4.1 jruoho #define FMN_CP2_SEL_SWITCH_RW(rw, rd, sel, val) \
333 1.1.4.1 jruoho do { \
334 1.1.4.1 jruoho switch (sel) { \
335 1.1.4.1 jruoho FMN_CP2_SEL_CASE_ ## rw(rd, 0, val); \
336 1.1.4.1 jruoho FMN_CP2_SEL_CASE_ ## rw(rd, 1, val); \
337 1.1.4.1 jruoho FMN_CP2_SEL_CASE_ ## rw(rd, 2, val); \
338 1.1.4.1 jruoho FMN_CP2_SEL_CASE_ ## rw(rd, 3, val); \
339 1.1.4.1 jruoho FMN_CP2_SEL_CASE_ ## rw(rd, 4, val); \
340 1.1.4.1 jruoho FMN_CP2_SEL_CASE_ ## rw(rd, 5, val); \
341 1.1.4.1 jruoho FMN_CP2_SEL_CASE_ ## rw(rd, 6, val); \
342 1.1.4.1 jruoho FMN_CP2_SEL_CASE_ ## rw(rd, 7, val); \
343 1.1.4.1 jruoho default: \
344 1.1.4.1 jruoho panic("%s:%d: bad sel %d\n", \
345 1.1.4.1 jruoho __func__, __LINE__, sel); \
346 1.1.4.1 jruoho } \
347 1.1.4.1 jruoho } while (0)
348 1.1.4.1 jruoho
349 1.1.4.1 jruoho #define FMN_CP2_RD_CASE_RW(rw, rd, sel, val) \
350 1.1.4.1 jruoho case rd: \
351 1.1.4.1 jruoho FMN_CP2_SEL_SWITCH_RW(rw, rd, sel, val); \
352 1.1.4.1 jruoho break
353 1.1.4.1 jruoho /*
354 1.1.4.1 jruoho * read/write a single arbitrary Credit Counter at (rd, sel)
355 1.1.4.1 jruoho * eg:
356 1.1.4.1 jruoho * FMN_CP2_RD_SWITCH_RW(READ, 16, 2, val)
357 1.1.4.1 jruoho * FMN_CP2_RD_SWITCH_RW(WRITE, 18, 0, val)
358 1.1.4.1 jruoho */
359 1.1.4.1 jruoho #define FMN_CP2_RD_SWITCH_RW(rw, rd, sel, val) \
360 1.1.4.1 jruoho do { \
361 1.1.4.1 jruoho switch(rd) { \
362 1.1.4.1 jruoho FMN_CP2_RD_CASE_RW(rw, 0, sel, val); \
363 1.1.4.1 jruoho FMN_CP2_RD_CASE_RW(rw, 1, sel, val); \
364 1.1.4.1 jruoho FMN_CP2_RD_CASE_RW(rw, 2, sel, val); \
365 1.1.4.1 jruoho FMN_CP2_RD_CASE_RW(rw, 3, sel, val); \
366 1.1.4.1 jruoho FMN_CP2_RD_CASE_RW(rw, 4, sel, val); \
367 1.1.4.1 jruoho FMN_CP2_RD_CASE_RW(rw, 5, sel, val); \
368 1.1.4.1 jruoho FMN_CP2_RD_CASE_RW(rw, 6, sel, val); \
369 1.1.4.1 jruoho FMN_CP2_RD_CASE_RW(rw, 7, sel, val); \
370 1.1.4.1 jruoho FMN_CP2_RD_CASE_RW(rw, 8, sel, val); \
371 1.1.4.1 jruoho FMN_CP2_RD_CASE_RW(rw, 9, sel, val); \
372 1.1.4.1 jruoho FMN_CP2_RD_CASE_RW(rw, 10, sel, val); \
373 1.1.4.1 jruoho FMN_CP2_RD_CASE_RW(rw, 11, sel, val); \
374 1.1.4.1 jruoho FMN_CP2_RD_CASE_RW(rw, 12, sel, val); \
375 1.1.4.1 jruoho FMN_CP2_RD_CASE_RW(rw, 13, sel, val); \
376 1.1.4.1 jruoho FMN_CP2_RD_CASE_RW(rw, 14, sel, val); \
377 1.1.4.1 jruoho FMN_CP2_RD_CASE_RW(rw, 15, sel, val); \
378 1.1.4.1 jruoho FMN_CP2_RD_CASE_RW(rw, 16, sel, val); \
379 1.1.4.1 jruoho FMN_CP2_RD_CASE_RW(rw, 17, sel, val); \
380 1.1.4.1 jruoho FMN_CP2_RD_CASE_RW(rw, 18, sel, val); \
381 1.1.4.1 jruoho FMN_CP2_RD_CASE_RW(rw, 19, sel, val); \
382 1.1.4.1 jruoho FMN_CP2_RD_CASE_RW(rw, 20, sel, val); \
383 1.1.4.1 jruoho FMN_CP2_RD_CASE_RW(rw, 21, sel, val); \
384 1.1.4.1 jruoho FMN_CP2_RD_CASE_RW(rw, 22, sel, val); \
385 1.1.4.1 jruoho FMN_CP2_RD_CASE_RW(rw, 23, sel, val); \
386 1.1.4.1 jruoho FMN_CP2_RD_CASE_RW(rw, 24, sel, val); \
387 1.1.4.1 jruoho FMN_CP2_RD_CASE_RW(rw, 25, sel, val); \
388 1.1.4.1 jruoho FMN_CP2_RD_CASE_RW(rw, 26, sel, val); \
389 1.1.4.1 jruoho FMN_CP2_RD_CASE_RW(rw, 27, sel, val); \
390 1.1.4.1 jruoho FMN_CP2_RD_CASE_RW(rw, 28, sel, val); \
391 1.1.4.1 jruoho FMN_CP2_RD_CASE_RW(rw, 29, sel, val); \
392 1.1.4.1 jruoho FMN_CP2_RD_CASE_RW(rw, 30, sel, val); \
393 1.1.4.1 jruoho FMN_CP2_RD_CASE_RW(rw, 31, sel, val); \
394 1.1.4.1 jruoho default: \
395 1.1.4.1 jruoho panic("%s:%d: bad regno %d\n", \
396 1.1.4.1 jruoho __func__, __LINE__, rd); \
397 1.1.4.1 jruoho } \
398 1.1.4.1 jruoho } while (0)
399 1.1.4.1 jruoho
400 1.1.4.1 jruoho
401 1.1.4.1 jruoho void
402 1.1.4.1 jruoho rmixl_fmn_init(void)
403 1.1.4.1 jruoho {
404 1.1.4.1 jruoho int cpu;
405 1.1.4.1 jruoho fmn_t *fmnp;
406 1.1.4.1 jruoho static bool once=false;
407 1.1.4.1 jruoho
408 1.1.4.1 jruoho KASSERTMSG((CPU_IS_PRIMARY(curcpu())), ("ci=%p, index=%d\n",
409 1.1.4.1 jruoho curcpu(), cpu_index(curcpu())));
410 1.1.4.1 jruoho fmnp = fmn_lookup(curcpu()->ci_cpuid);
411 1.1.4.1 jruoho
412 1.1.4.1 jruoho if (once == true)
413 1.1.4.1 jruoho panic("%s: call only once!", __func__);
414 1.1.4.1 jruoho once = true;
415 1.1.4.1 jruoho
416 1.1.4.1 jruoho for (cpu=0; cpu < NFMN; cpu++) {
417 1.1.4.1 jruoho fmnp[cpu].fmn_core = RMIXL_CPU_CORE(cpu);
418 1.1.4.1 jruoho fmnp[cpu].fmn_thread = RMIXL_CPU_THREAD(cpu);
419 1.1.4.1 jruoho }
420 1.1.4.1 jruoho
421 1.1.4.1 jruoho rmixl_fmn_init_core(); /* for initial boot cpu (#0) */
422 1.1.4.1 jruoho rmixl_fmn_config_noncore(fmnp); /* boot cpu initializes noncore */
423 1.1.4.1 jruoho }
424 1.1.4.1 jruoho
425 1.1.4.1 jruoho /*
426 1.1.4.1 jruoho * link to TX station ID table for RMI XLR type chip
427 1.1.4.1 jruoho */
428 1.1.4.1 jruoho static void
429 1.1.4.1 jruoho rmixl_fmn_init_core_xlr(fmn_t *fmnp)
430 1.1.4.1 jruoho {
431 1.1.4.1 jruoho fmnp->fmn_nstid = RMIXLR_FMN_NSTID;
432 1.1.4.1 jruoho fmnp->fmn_stidtab = station_xlr_xxx;
433 1.1.4.1 jruoho fmnp->fmn_stinfo = station_info_xlr_xxx;
434 1.1.4.1 jruoho }
435 1.1.4.1 jruoho
436 1.1.4.1 jruoho /*
437 1.1.4.1 jruoho * link to TX station ID table for RMI XLS type chip
438 1.1.4.1 jruoho */
439 1.1.4.1 jruoho static void
440 1.1.4.1 jruoho rmixl_fmn_init_core_xls(fmn_t *fmnp)
441 1.1.4.1 jruoho {
442 1.1.4.1 jruoho const fmn_station_info_t *info = NULL;
443 1.1.4.1 jruoho const int *tab = NULL;
444 1.1.4.1 jruoho
445 1.1.4.1 jruoho switch (MIPS_PRID_IMPL(mips_options.mips_cpu_id)) {
446 1.1.4.1 jruoho case MIPS_XLS104:
447 1.1.4.1 jruoho case MIPS_XLS108:
448 1.1.4.1 jruoho tab = station_xls_1xx;
449 1.1.4.1 jruoho info = station_info_xls_1xx;
450 1.1.4.1 jruoho break;
451 1.1.4.1 jruoho case MIPS_XLS204:
452 1.1.4.1 jruoho case MIPS_XLS208:
453 1.1.4.1 jruoho tab = station_xls_2xx;
454 1.1.4.1 jruoho info = station_info_xls_2xx;
455 1.1.4.1 jruoho break;
456 1.1.4.1 jruoho case MIPS_XLS404:
457 1.1.4.1 jruoho case MIPS_XLS408:
458 1.1.4.1 jruoho case MIPS_XLS416:
459 1.1.4.1 jruoho case MIPS_XLS608:
460 1.1.4.1 jruoho case MIPS_XLS616:
461 1.1.4.1 jruoho tab = station_xls_4xx;
462 1.1.4.1 jruoho info = station_info_xls_4xx;
463 1.1.4.1 jruoho break;
464 1.1.4.1 jruoho case MIPS_XLS404LITE:
465 1.1.4.1 jruoho case MIPS_XLS408LITE:
466 1.1.4.1 jruoho tab = station_xls_4xx_lite;
467 1.1.4.1 jruoho info = station_info_xls_4xx_lite;
468 1.1.4.1 jruoho break;
469 1.1.4.1 jruoho default:
470 1.1.4.1 jruoho panic("%s: unknown PRID IMPL %#x\n", __func__,
471 1.1.4.1 jruoho MIPS_PRID_IMPL(mips_options.mips_cpu_id));
472 1.1.4.1 jruoho }
473 1.1.4.1 jruoho
474 1.1.4.1 jruoho fmnp->fmn_nstid = RMIXLS_FMN_NSTID;
475 1.1.4.1 jruoho fmnp->fmn_stidtab = tab;
476 1.1.4.1 jruoho fmnp->fmn_stinfo = info;
477 1.1.4.1 jruoho }
478 1.1.4.1 jruoho
479 1.1.4.1 jruoho void
480 1.1.4.1 jruoho rmixl_fmn_init_core(void)
481 1.1.4.1 jruoho {
482 1.1.4.1 jruoho fmn_t *fmnp;
483 1.1.4.1 jruoho kmutex_t *lk;
484 1.1.4.1 jruoho
485 1.1.4.1 jruoho fmnp = fmn_lookup(curcpu()->ci_cpuid);
486 1.1.4.1 jruoho KASSERT(fmnp != NULL);
487 1.1.4.1 jruoho KASSERT(fmnp->fmn_core == RMIXL_CPU_CORE(curcpu()->ci_cpuid));
488 1.1.4.1 jruoho KASSERT(fmnp->fmn_thread == RMIXL_CPU_THREAD(curcpu()->ci_cpuid));
489 1.1.4.1 jruoho
490 1.1.4.1 jruoho lk = mutex_obj_alloc(MUTEX_DEFAULT, RMIXL_FMN_INTR_IPL);
491 1.1.4.1 jruoho if (lk == NULL)
492 1.1.4.1 jruoho panic("%s: mutex_obj_alloc failed", __func__);
493 1.1.4.1 jruoho fmnp->fmn_lock = lk;
494 1.1.4.1 jruoho
495 1.1.4.1 jruoho mutex_enter(fmnp->fmn_lock);
496 1.1.4.1 jruoho
497 1.1.4.1 jruoho /*
498 1.1.4.1 jruoho * do chip-dependent per-core FMN initialization
499 1.1.4.1 jruoho */
500 1.1.4.1 jruoho switch(cpu_rmixl_chip_type(mips_options.mips_cpu)) {
501 1.1.4.1 jruoho case CIDFL_RMI_TYPE_XLR:
502 1.1.4.1 jruoho rmixl_fmn_init_core_xlr(fmnp);
503 1.1.4.1 jruoho break;
504 1.1.4.1 jruoho case CIDFL_RMI_TYPE_XLS:
505 1.1.4.1 jruoho rmixl_fmn_init_core_xls(fmnp);
506 1.1.4.1 jruoho break;
507 1.1.4.1 jruoho case CIDFL_RMI_TYPE_XLP:
508 1.1.4.1 jruoho panic("%s: RMI XLP not yet supported", __func__);
509 1.1.4.1 jruoho default:
510 1.1.4.1 jruoho panic("%s: RMI chip type %#x unknown", __func__,
511 1.1.4.1 jruoho cpu_rmixl_chip_type(mips_options.mips_cpu));
512 1.1.4.1 jruoho }
513 1.1.4.1 jruoho
514 1.1.4.1 jruoho /*
515 1.1.4.1 jruoho * thread #0 for each core owns 'global' CP2 regs
516 1.1.4.1 jruoho */
517 1.1.4.1 jruoho if (fmnp->fmn_thread == 0)
518 1.1.4.1 jruoho rmixl_fmn_config_core(fmnp);
519 1.1.4.1 jruoho
520 1.1.4.1 jruoho mutex_exit(fmnp->fmn_lock);
521 1.1.4.1 jruoho }
522 1.1.4.1 jruoho
523 1.1.4.1 jruoho /*
524 1.1.4.1 jruoho * rmixl_fmn_config_noncore
525 1.1.4.1 jruoho *
526 1.1.4.1 jruoho * initialize bucket sizes and (minimum) credits for non-core stations to ZERO
527 1.1.4.1 jruoho * configured through memory write operations instead of CP2
528 1.1.4.1 jruoho */
529 1.1.4.1 jruoho static void
530 1.1.4.1 jruoho rmixl_fmn_config_noncore(fmn_t *fmnp)
531 1.1.4.1 jruoho {
532 1.1.4.1 jruoho for (u_int sid=0; sid < fmnp->fmn_nstid; sid++) {
533 1.1.4.1 jruoho u_int regoff = fmnp->fmn_stinfo[sid].si_regbase;
534 1.1.4.1 jruoho if (regoff != 0) {
535 1.1.4.1 jruoho u_int buckets_max = fmnp->fmn_stinfo[sid].si_buckets_max;
536 1.1.4.1 jruoho regoff += RMIXL_FMN_BS_FIRST;
537 1.1.4.1 jruoho for (u_int bucket=0; bucket < buckets_max; bucket++) {
538 1.1.4.1 jruoho RMIXL_IOREG_WRITE(regoff, 0);
539 1.1.4.1 jruoho regoff += sizeof(uint32_t);
540 1.1.4.1 jruoho }
541 1.1.4.1 jruoho }
542 1.1.4.1 jruoho }
543 1.1.4.1 jruoho }
544 1.1.4.1 jruoho
545 1.1.4.1 jruoho /*
546 1.1.4.1 jruoho * rmixl_fmn_config_core
547 1.1.4.1 jruoho *
548 1.1.4.1 jruoho * - assumes fmn_mutex is owned
549 1.1.4.1 jruoho * - configure FMN
550 1.1.4.1 jruoho * - initialize bucket sizes and (minimum) credits for a core
551 1.1.4.1 jruoho */
552 1.1.4.1 jruoho static void
553 1.1.4.1 jruoho rmixl_fmn_config_core(fmn_t *fmnp)
554 1.1.4.1 jruoho {
555 1.1.4.1 jruoho const fmn_station_info_t *info = fmnp->fmn_stinfo;
556 1.1.4.1 jruoho uint32_t sts1;
557 1.1.4.1 jruoho uint32_t cfg;
558 1.1.4.1 jruoho uint32_t cp0_status;
559 1.1.4.1 jruoho
560 1.1.4.1 jruoho KASSERT(mutex_owned(fmnp->fmn_lock) != 0);
561 1.1.4.1 jruoho KASSERT(fmnp->fmn_thread == 0);
562 1.1.4.1 jruoho cp0_status = rmixl_cp2_enable();
563 1.1.4.1 jruoho
564 1.1.4.1 jruoho /* check/clear any pre-existing status1 error(s) */
565 1.1.4.1 jruoho RMIXL_MFC2(RMIXL_COP_2_MSG_STS, 1, sts1);
566 1.1.4.1 jruoho if ((sts1 & RMIXL_MSG_STS1_ERRS) != 0)
567 1.1.4.1 jruoho RMIXL_MTC2(RMIXL_COP_2_MSG_STS, 1, sts1);
568 1.1.4.1 jruoho
569 1.1.4.1 jruoho /* set up MsgConfig reg */
570 1.1.4.1 jruoho cfg = ((1 << RMIXL_MSG_CFG0_WMSHIFT) /* watermark */
571 1.1.4.1 jruoho | (RMIXL_INTRVEC_FMN << RMIXL_MSG_CFG0_IV_SHIFT) /* irq */
572 1.1.4.1 jruoho | (1 << RMIXL_MSG_CFG0_ITM_SHIFT) /* thread mask */
573 1.1.4.1 jruoho | RMIXL_MSG_CFG0_WIE /* watermark intr enb */
574 1.1.4.1 jruoho | RMIXL_MSG_CFG0_EIE); /* rx not empty intr enb */
575 1.1.4.1 jruoho RMIXL_DMTC2(RMIXL_COP_2_MSG_CFG, 0, cfg);
576 1.1.4.1 jruoho
577 1.1.4.1 jruoho /* disable trace mode, credit overrun intr, messaging errors intr */
578 1.1.4.1 jruoho RMIXL_DMTC2(RMIXL_COP_2_MSG_CFG, 0, 0);
579 1.1.4.1 jruoho
580 1.1.4.1 jruoho /* XXX using 4 buckets per core */
581 1.1.4.1 jruoho KASSERT(4 <= info->si_buckets_max);
582 1.1.4.1 jruoho
583 1.1.4.1 jruoho /*
584 1.1.4.1 jruoho * initialize default sizes for core buckets
585 1.1.4.1 jruoho * zero sizes for unused buckets
586 1.1.4.1 jruoho */
587 1.1.4.1 jruoho KASSERT(info->si_buckets_max == 8);
588 1.1.4.1 jruoho uint32_t sz = info->si_bucket_size_dflt;
589 1.1.4.1 jruoho KASSERT((sz & ~RMIXL_MSG_BSZ_SIZE) == 0);
590 1.1.4.1 jruoho RMIXL_MTC2(RMIXL_COP_2_MSG_BSZ, 0, sz);
591 1.1.4.1 jruoho RMIXL_MTC2(RMIXL_COP_2_MSG_BSZ, 1, sz);
592 1.1.4.1 jruoho RMIXL_MTC2(RMIXL_COP_2_MSG_BSZ, 2, sz);
593 1.1.4.1 jruoho RMIXL_MTC2(RMIXL_COP_2_MSG_BSZ, 3, sz);
594 1.1.4.1 jruoho RMIXL_MTC2(RMIXL_COP_2_MSG_BSZ, 4, 0);
595 1.1.4.1 jruoho RMIXL_MTC2(RMIXL_COP_2_MSG_BSZ, 5, 0);
596 1.1.4.1 jruoho RMIXL_MTC2(RMIXL_COP_2_MSG_BSZ, 6, 0);
597 1.1.4.1 jruoho RMIXL_MTC2(RMIXL_COP_2_MSG_BSZ, 7, 0);
598 1.1.4.1 jruoho
599 1.1.4.1 jruoho /*
600 1.1.4.1 jruoho * configure minimum credits for each core, 4 buckets
601 1.1.4.1 jruoho * zero all unused credit counters for this core
602 1.1.4.1 jruoho */
603 1.1.4.1 jruoho uint32_t cr = info->si_credits_min;
604 1.1.4.1 jruoho
605 1.1.4.1 jruoho FMN_CP2_4SEL_WRITE(RMIXL_COP_2_CREDITS, 0, cr);
606 1.1.4.1 jruoho FMN_CP2_4SEL_WRITE(RMIXL_COP_2_CREDITS, 4, 0);
607 1.1.4.1 jruoho FMN_CP2_4SEL_WRITE(RMIXL_COP_2_CREDITS+1, 0, cr);
608 1.1.4.1 jruoho FMN_CP2_4SEL_WRITE(RMIXL_COP_2_CREDITS+1, 4, 0);
609 1.1.4.1 jruoho FMN_CP2_4SEL_WRITE(RMIXL_COP_2_CREDITS+2, 0, cr);
610 1.1.4.1 jruoho FMN_CP2_4SEL_WRITE(RMIXL_COP_2_CREDITS+2, 4, 0);
611 1.1.4.1 jruoho FMN_CP2_4SEL_WRITE(RMIXL_COP_2_CREDITS+3, 0, cr);
612 1.1.4.1 jruoho FMN_CP2_4SEL_WRITE(RMIXL_COP_2_CREDITS+3, 4, 0);
613 1.1.4.1 jruoho
614 1.1.4.1 jruoho FMN_CP2_8SEL_WRITE(RMIXL_COP_2_CREDITS+4, 0);
615 1.1.4.1 jruoho FMN_CP2_8SEL_WRITE(RMIXL_COP_2_CREDITS+5, 0);
616 1.1.4.1 jruoho FMN_CP2_8SEL_WRITE(RMIXL_COP_2_CREDITS+6, 0);
617 1.1.4.1 jruoho FMN_CP2_8SEL_WRITE(RMIXL_COP_2_CREDITS+7, 0);
618 1.1.4.1 jruoho FMN_CP2_8SEL_WRITE(RMIXL_COP_2_CREDITS+8, 0);
619 1.1.4.1 jruoho FMN_CP2_8SEL_WRITE(RMIXL_COP_2_CREDITS+9, 0);
620 1.1.4.1 jruoho FMN_CP2_8SEL_WRITE(RMIXL_COP_2_CREDITS+10, 0);
621 1.1.4.1 jruoho FMN_CP2_8SEL_WRITE(RMIXL_COP_2_CREDITS+11, 0);
622 1.1.4.1 jruoho FMN_CP2_8SEL_WRITE(RMIXL_COP_2_CREDITS+12, 0);
623 1.1.4.1 jruoho FMN_CP2_8SEL_WRITE(RMIXL_COP_2_CREDITS+13, 0);
624 1.1.4.1 jruoho FMN_CP2_8SEL_WRITE(RMIXL_COP_2_CREDITS+14, 0);
625 1.1.4.1 jruoho FMN_CP2_8SEL_WRITE(RMIXL_COP_2_CREDITS+15, 0);
626 1.1.4.1 jruoho
627 1.1.4.1 jruoho RMIXL_MFC2(RMIXL_COP_2_MSG_STS, 1, sts1);
628 1.1.4.1 jruoho KASSERT((sts1 & RMIXL_MSG_STS1_ERRS) == 0);
629 1.1.4.1 jruoho
630 1.1.4.1 jruoho rmixl_cp2_restore(cp0_status);
631 1.1.4.1 jruoho }
632 1.1.4.1 jruoho
633 1.1.4.1 jruoho void
634 1.1.4.1 jruoho rmixl_fmn_init_cpu_intr(void)
635 1.1.4.1 jruoho {
636 1.1.4.1 jruoho fmn_t *fmnp;
637 1.1.4.1 jruoho
638 1.1.4.1 jruoho fmnp = fmn_lookup(curcpu()->ci_cpuid);
639 1.1.4.1 jruoho mutex_enter(fmnp->fmn_lock);
640 1.1.4.1 jruoho
641 1.1.4.1 jruoho for (int i=0; i < fmnp->fmn_nstid; i++)
642 1.1.4.1 jruoho evcnt_attach_dynamic(&fmnp->fmn_intrhand[i].ih_count,
643 1.1.4.1 jruoho EVCNT_TYPE_INTR, NULL, "rmixl_fmn", fmnp->fmn_stinfo[i].si_name);
644 1.1.4.1 jruoho
645 1.1.4.1 jruoho #ifdef NOTYET
646 1.1.4.1 jruoho /*
647 1.1.4.1 jruoho * establish dispatcher for FMN interrupt
648 1.1.4.1 jruoho */
649 1.1.4.1 jruoho extern kmutex_t rmixl_intr_lock;
650 1.1.4.1 jruoho void *ih;
651 1.1.4.1 jruoho
652 1.1.4.1 jruoho mutex_enter(&rmixl_intr_lock);
653 1.1.4.1 jruoho ih = rmixl_vec_establish(RMIXL_INTRVEC_FMN, -1, RMIXL_FMN_INTR_IPL,
654 1.1.4.1 jruoho rmixl_fmn_intr_dispatch, fmnp, "fmn");
655 1.1.4.1 jruoho if (ih == NULL)
656 1.1.4.1 jruoho panic("%s: rmixl_vec_establish failed", __func__);
657 1.1.4.1 jruoho mutex_exit(&rmixl_intr_lock);
658 1.1.4.1 jruoho fmnp->fmn_ih = ih;
659 1.1.4.1 jruoho #endif
660 1.1.4.1 jruoho
661 1.1.4.1 jruoho mutex_exit(fmnp->fmn_lock);
662 1.1.4.1 jruoho }
663 1.1.4.1 jruoho
664 1.1.4.1 jruoho void *
665 1.1.4.1 jruoho rmixl_fmn_intr_establish(int txstid, int (*func)(void *, rmixl_fmn_rxmsg_t *), void *arg)
666 1.1.4.1 jruoho {
667 1.1.4.1 jruoho fmn_t *fmnp;
668 1.1.4.1 jruoho fmn_intrhand_t *ih;
669 1.1.4.1 jruoho
670 1.1.4.1 jruoho fmnp = fmn_lookup(curcpu()->ci_cpuid);
671 1.1.4.1 jruoho
672 1.1.4.1 jruoho mutex_enter(fmnp->fmn_lock);
673 1.1.4.1 jruoho
674 1.1.4.1 jruoho ih = &fmnp->fmn_intrhand[txstid];
675 1.1.4.1 jruoho
676 1.1.4.1 jruoho if (ih->ih_func != NULL) {
677 1.1.4.1 jruoho #ifdef DEBUG
678 1.1.4.1 jruoho panic("%s: intrhand[%d] busy", __func__, txstid);
679 1.1.4.1 jruoho #endif
680 1.1.4.1 jruoho ih = NULL;
681 1.1.4.1 jruoho } else {
682 1.1.4.1 jruoho ih->ih_func = func;
683 1.1.4.1 jruoho ih->ih_arg = arg;
684 1.1.4.1 jruoho }
685 1.1.4.1 jruoho
686 1.1.4.1 jruoho mutex_exit(fmnp->fmn_lock);
687 1.1.4.1 jruoho
688 1.1.4.1 jruoho return ih;
689 1.1.4.1 jruoho }
690 1.1.4.1 jruoho
691 1.1.4.1 jruoho void
692 1.1.4.1 jruoho rmixl_fmn_intr_disestablish(void *cookie)
693 1.1.4.1 jruoho {
694 1.1.4.1 jruoho fmn_t *fmnp;
695 1.1.4.1 jruoho fmn_intrhand_t *ih = cookie;
696 1.1.4.1 jruoho
697 1.1.4.1 jruoho fmnp = fmn_lookup(curcpu()->ci_cpuid);
698 1.1.4.1 jruoho mutex_enter(fmnp->fmn_lock);
699 1.1.4.1 jruoho
700 1.1.4.1 jruoho if (ih->ih_func != NULL) {
701 1.1.4.1 jruoho ih->ih_func = NULL;
702 1.1.4.1 jruoho ih->ih_arg = NULL;
703 1.1.4.1 jruoho }
704 1.1.4.1 jruoho #ifdef DEBUG
705 1.1.4.1 jruoho else {
706 1.1.4.1 jruoho panic("%s: intrhand[%ld] not in use",
707 1.1.4.1 jruoho __func__, ih - &fmnp->fmn_intrhand[0]);
708 1.1.4.1 jruoho }
709 1.1.4.1 jruoho #endif
710 1.1.4.1 jruoho
711 1.1.4.1 jruoho mutex_exit(fmnp->fmn_lock);
712 1.1.4.1 jruoho }
713 1.1.4.1 jruoho
714 1.1.4.1 jruoho void
715 1.1.4.1 jruoho rmixl_fmn_intr_poll(u_int bucket, rmixl_fmn_rxmsg_t *rxmsg)
716 1.1.4.1 jruoho {
717 1.1.4.1 jruoho uint32_t bit = 1 << bucket;
718 1.1.4.1 jruoho uint32_t cp0_status;
719 1.1.4.1 jruoho
720 1.1.4.1 jruoho KASSERT(bucket < 8);
721 1.1.4.1 jruoho
722 1.1.4.1 jruoho cp0_status = rmixl_cp2_enable();
723 1.1.4.1 jruoho
724 1.1.4.1 jruoho for(;;) {
725 1.1.4.1 jruoho rmixl_fmn_msgwait(bit);
726 1.1.4.1 jruoho if (rmixl_fmn_msg_recv(bucket, rxmsg) == 0)
727 1.1.4.1 jruoho break;
728 1.1.4.1 jruoho DELAY(10); /* XXX */
729 1.1.4.1 jruoho }
730 1.1.4.1 jruoho
731 1.1.4.1 jruoho rmixl_cp2_restore(cp0_status);
732 1.1.4.1 jruoho }
733 1.1.4.1 jruoho
734 1.1.4.1 jruoho #ifdef NOTYET
735 1.1.4.1 jruoho static int
736 1.1.4.1 jruoho rmixl_fmn_intr_dispatch(void *arg)
737 1.1.4.1 jruoho {
738 1.1.4.1 jruoho fmn_t *fmnp = arg;
739 1.1.4.1 jruoho uint32_t msg_status;
740 1.1.4.1 jruoho uint32_t cp0_status;
741 1.1.4.1 jruoho uint32_t rfbne;
742 1.1.4.1 jruoho int txstid;
743 1.1.4.1 jruoho int rv = 0;
744 1.1.4.1 jruoho
745 1.1.4.1 jruoho mutex_enter(fmnp->fmn_lock);
746 1.1.4.1 jruoho cp0_status = rmixl_cp2_enable();
747 1.1.4.1 jruoho
748 1.1.4.1 jruoho RMIXL_MFC2(RMIXL_COP_2_MSG_STS, 0, msg_status);
749 1.1.4.1 jruoho rfbne = (~msg_status) >> RMIXL_MSG_STS0_RFBE_SHIFT;
750 1.1.4.1 jruoho
751 1.1.4.1 jruoho if (rfbne != 0) {
752 1.1.4.1 jruoho DPRINTF(("%s: rfbne %#x\n", __func__, rfbne));
753 1.1.4.1 jruoho for (u_int bucket=0; bucket < 8; bucket++) {
754 1.1.4.1 jruoho rmixl_fmn_rxmsg_t rxmsg;
755 1.1.4.1 jruoho fmn_intrhand_t *ih;
756 1.1.4.1 jruoho
757 1.1.4.1 jruoho if ((rfbne & (1 << bucket)) == 0)
758 1.1.4.1 jruoho continue;
759 1.1.4.1 jruoho if (rmixl_fmn_msg_recv_subr(bucket, &rxmsg) != 0)
760 1.1.4.1 jruoho continue;
761 1.1.4.1 jruoho rv = 1;
762 1.1.4.1 jruoho txstid = fmnp->fmn_stidtab[rxmsg.rxsid];
763 1.1.4.1 jruoho ih = &fmnp->fmn_intrhand[txstid];
764 1.1.4.1 jruoho if (ih->ih_func != NULL)
765 1.1.4.1 jruoho if ((ih->ih_func)(ih->ih_arg, &rxmsg) != 0)
766 1.1.4.1 jruoho ih->ih_count.ev_count++;
767 1.1.4.1 jruoho }
768 1.1.4.1 jruoho
769 1.1.4.1 jruoho }
770 1.1.4.1 jruoho rmixl_cp2_restore(cp0_status);
771 1.1.4.1 jruoho mutex_exit(fmnp->fmn_lock);
772 1.1.4.1 jruoho
773 1.1.4.1 jruoho return rv;
774 1.1.4.1 jruoho }
775 1.1.4.1 jruoho #endif /* NOTYET */
776 1.1.4.1 jruoho
777 1.1.4.1 jruoho int
778 1.1.4.1 jruoho rmixl_fmn_msg_send(u_int size, u_int code, u_int dest_id, rmixl_fmn_msg_t *msg)
779 1.1.4.1 jruoho {
780 1.1.4.1 jruoho fmn_t *fmnp;
781 1.1.4.1 jruoho uint32_t cp0_status;
782 1.1.4.1 jruoho uint32_t msg_status;
783 1.1.4.1 jruoho uint32_t msg_status1;
784 1.1.4.1 jruoho uint32_t desc;
785 1.1.4.1 jruoho int rv = 0;
786 1.1.4.1 jruoho
787 1.1.4.1 jruoho KASSERT((size >= 1) && size <= 4);
788 1.1.4.1 jruoho KASSERT(code <= 0xff);
789 1.1.4.1 jruoho KASSERT(dest_id <= 0xff);
790 1.1.4.1 jruoho
791 1.1.4.1 jruoho fmnp = fmn_lookup(curcpu()->ci_cpuid);
792 1.1.4.1 jruoho mutex_enter(fmnp->fmn_lock);
793 1.1.4.1 jruoho cp0_status = rmixl_cp2_enable();
794 1.1.4.1 jruoho
795 1.1.4.1 jruoho switch(size) {
796 1.1.4.1 jruoho case 1:
797 1.1.4.1 jruoho RMIXL_DMTC2(RMIXL_COP_2_TXBUF, 0, msg->data[0]);
798 1.1.4.1 jruoho break;
799 1.1.4.1 jruoho case 2:
800 1.1.4.1 jruoho RMIXL_DMTC2(RMIXL_COP_2_TXBUF, 0, msg->data[0]);
801 1.1.4.1 jruoho RMIXL_DMTC2(RMIXL_COP_2_TXBUF, 1, msg->data[1]);
802 1.1.4.1 jruoho break;
803 1.1.4.1 jruoho case 3:
804 1.1.4.1 jruoho RMIXL_DMTC2(RMIXL_COP_2_TXBUF, 0, msg->data[0]);
805 1.1.4.1 jruoho RMIXL_DMTC2(RMIXL_COP_2_TXBUF, 1, msg->data[1]);
806 1.1.4.1 jruoho RMIXL_DMTC2(RMIXL_COP_2_TXBUF, 2, msg->data[2]);
807 1.1.4.1 jruoho break;
808 1.1.4.1 jruoho case 4:
809 1.1.4.1 jruoho RMIXL_DMTC2(RMIXL_COP_2_TXBUF, 0, msg->data[0]);
810 1.1.4.1 jruoho RMIXL_DMTC2(RMIXL_COP_2_TXBUF, 1, msg->data[1]);
811 1.1.4.1 jruoho RMIXL_DMTC2(RMIXL_COP_2_TXBUF, 2, msg->data[2]);
812 1.1.4.1 jruoho RMIXL_DMTC2(RMIXL_COP_2_TXBUF, 3, msg->data[3]);
813 1.1.4.1 jruoho break;
814 1.1.4.1 jruoho default:
815 1.1.4.1 jruoho DIAG_PRF(("%s: bad size %d", __func__, size));
816 1.1.4.1 jruoho rv = -1;
817 1.1.4.1 jruoho goto out;
818 1.1.4.1 jruoho }
819 1.1.4.1 jruoho
820 1.1.4.1 jruoho for (int try=16; try--; ) {
821 1.1.4.1 jruoho RMIXL_MFC2(RMIXL_COP_2_MSG_STS, 0, msg_status);
822 1.1.4.1 jruoho if ((msg_status & (RMIXL_MSG_STS0_LPF|RMIXL_MSG_STS0_SPF|RMIXL_MSG_STS0_SMP)) == 0)
823 1.1.4.1 jruoho goto send;
824 1.1.4.1 jruoho DELAY(10); /* XXX ??? */
825 1.1.4.1 jruoho }
826 1.1.4.1 jruoho DIAG_PRF(("%s: cpu%u, msg %p, dst_id=%d, sts=%#x: can't send\n",
827 1.1.4.1 jruoho __func__, cpu_number(), msg, dest_id, msg_status));
828 1.1.4.1 jruoho rv = -1;
829 1.1.4.1 jruoho goto out;
830 1.1.4.1 jruoho send:
831 1.1.4.1 jruoho desc = RMIXL_MSGSND_DESC(size, code, dest_id);
832 1.1.4.1 jruoho DPRINTF(("%s: cpu%u, desc %#x\n", __func__, cpu_number(), desc));
833 1.1.4.1 jruoho for (int try=16; try--; ) {
834 1.1.4.1 jruoho rmixl_msgsnd(desc);
835 1.1.4.1 jruoho RMIXL_MFC2(RMIXL_COP_2_MSG_STS, 0, msg_status);
836 1.1.4.1 jruoho RMIXL_MFC2(RMIXL_COP_2_MSG_STS, 1, msg_status1);
837 1.1.4.1 jruoho if (((msg_status & RMIXL_MSG_STS0_SCF) == 0)
838 1.1.4.1 jruoho && ((msg_status1 & RMIXL_MSG_STS1_ERRS) == 0))
839 1.1.4.1 jruoho goto out;
840 1.1.4.1 jruoho #if 0
841 1.1.4.1 jruoho #ifdef DEBUG
842 1.1.4.1 jruoho if ((msg_status & RMIXL_MSG_STS0_SCF) != 0) {
843 1.1.4.1 jruoho uint32_t r;
844 1.1.4.1 jruoho u_int regno = RMIXL_COP_2_CREDITS+fmnp->fmn_core;
845 1.1.4.1 jruoho u_int sel = fmnp->fmn_thread;
846 1.1.4.1 jruoho printf("%s: CC[%d,%d]=", __func__, regno, sel);
847 1.1.4.1 jruoho FMN_CP2_RD_SWITCH_RW(READ, regno, sel, r);
848 1.1.4.1 jruoho printf("%s: CC[%d,%d]=%d\n", __func__, regno, sel, r);
849 1.1.4.1 jruoho }
850 1.1.4.1 jruoho #endif /* DEBUG */
851 1.1.4.1 jruoho #endif /* 0 */
852 1.1.4.1 jruoho /* clear status1 error(s) */
853 1.1.4.1 jruoho if ((msg_status1 & RMIXL_MSG_STS1_ERRS) != 0) {
854 1.1.4.1 jruoho RMIXL_MFC2(RMIXL_COP_2_MSG_STS, 1, msg_status1);
855 1.1.4.1 jruoho RMIXL_MTC2(RMIXL_COP_2_MSG_STS, 1, msg_status1);
856 1.1.4.1 jruoho }
857 1.1.4.1 jruoho DIAG_PRF(("%s: src=%ld, dst=%d, sts=%#x, %#x: send error, try %d\n",
858 1.1.4.1 jruoho __func__, curcpu()->ci_cpuid, dest_id, msg_status, msg_status1, try));
859 1.1.4.1 jruoho DELAY(10);
860 1.1.4.1 jruoho }
861 1.1.4.1 jruoho rv = -1;
862 1.1.4.1 jruoho out:
863 1.1.4.1 jruoho rmixl_cp2_restore(cp0_status);
864 1.1.4.1 jruoho mutex_exit(fmnp->fmn_lock);
865 1.1.4.1 jruoho
866 1.1.4.1 jruoho return rv;
867 1.1.4.1 jruoho }
868 1.1.4.1 jruoho
869 1.1.4.1 jruoho /*
870 1.1.4.1 jruoho * rmixl_fmn_msg_recv
871 1.1.4.1 jruoho *
872 1.1.4.1 jruoho * - grab fmn_lock and call rmixl_fmn_msg_recv_subr to do the real work
873 1.1.4.1 jruoho * - assume cp2 access is already enabled
874 1.1.4.1 jruoho */
875 1.1.4.1 jruoho int
876 1.1.4.1 jruoho rmixl_fmn_msg_recv(u_int bucket, rmixl_fmn_rxmsg_t *rxmsg)
877 1.1.4.1 jruoho {
878 1.1.4.1 jruoho fmn_t *fmnp;
879 1.1.4.1 jruoho int rv;
880 1.1.4.1 jruoho
881 1.1.4.1 jruoho fmnp = fmn_lookup(curcpu()->ci_cpuid);
882 1.1.4.1 jruoho mutex_enter(fmnp->fmn_lock);
883 1.1.4.1 jruoho rv = rmixl_fmn_msg_recv_subr(bucket, rxmsg);
884 1.1.4.1 jruoho mutex_exit(fmnp->fmn_lock);
885 1.1.4.1 jruoho
886 1.1.4.1 jruoho return rv;
887 1.1.4.1 jruoho }
888 1.1.4.1 jruoho
889 1.1.4.1 jruoho /*
890 1.1.4.1 jruoho * rmixl_fmn_msg_recv_subr
891 1.1.4.1 jruoho *
892 1.1.4.1 jruoho * - assume fmn_lock is owned
893 1.1.4.1 jruoho * - assume cp2 access is already enabled
894 1.1.4.1 jruoho */
895 1.1.4.1 jruoho static int
896 1.1.4.1 jruoho rmixl_fmn_msg_recv_subr(u_int bucket, rmixl_fmn_rxmsg_t *rxmsg)
897 1.1.4.1 jruoho {
898 1.1.4.1 jruoho fmn_t *fmnp;
899 1.1.4.1 jruoho uint32_t msg_status;
900 1.1.4.1 jruoho int rv;
901 1.1.4.1 jruoho
902 1.1.4.1 jruoho fmnp = fmn_lookup(curcpu()->ci_cpuid);
903 1.1.4.1 jruoho KASSERT(mutex_owned(fmnp->fmn_lock) != 0);
904 1.1.4.1 jruoho
905 1.1.4.1 jruoho for (int try=16; try--; ) {
906 1.1.4.1 jruoho RMIXL_MFC2(RMIXL_COP_2_MSG_STS, 0, msg_status);
907 1.1.4.1 jruoho if ((msg_status & (RMIXL_MSG_STS0_LPF)) == 0)
908 1.1.4.1 jruoho goto recv;
909 1.1.4.1 jruoho }
910 1.1.4.1 jruoho DIAG_PRF(("%s: cpu%u, bucket=%d, sts=%#x: Load Pending Fail\n",
911 1.1.4.1 jruoho __func__, cpu_number(), bucket, msg_status));
912 1.1.4.1 jruoho rv = -1;
913 1.1.4.1 jruoho goto out;
914 1.1.4.1 jruoho recv:
915 1.1.4.1 jruoho rmixl_msgld(bucket);
916 1.1.4.1 jruoho RMIXL_MFC2(RMIXL_COP_2_MSG_STS, 0, msg_status);
917 1.1.4.1 jruoho DPRINTF(("%s: cpu%u, bucket=%d, sts=%#x\n",
918 1.1.4.1 jruoho __func__, cpu_number(), bucket, msg_status));
919 1.1.4.1 jruoho rv = msg_status & (RMIXL_MSG_STS0_LEF|RMIXL_MSG_STS0_LPF);
920 1.1.4.1 jruoho if (rv == 0) {
921 1.1.4.1 jruoho rxmsg->rxsid = (msg_status & RMIXL_MSG_STS0_RMSID)
922 1.1.4.1 jruoho >> RMIXL_MSG_STS0_RMSID_SHIFT;
923 1.1.4.1 jruoho rxmsg->code = (msg_status & RMIXL_MSG_STS0_RMSC)
924 1.1.4.1 jruoho >> RMIXL_MSG_STS0_RMSC_SHIFT;
925 1.1.4.1 jruoho rxmsg->size = ((msg_status & RMIXL_MSG_STS0_RMS)
926 1.1.4.1 jruoho >> RMIXL_MSG_STS0_RMS_SHIFT) + 1;
927 1.1.4.1 jruoho switch(rxmsg->size) {
928 1.1.4.1 jruoho case 1:
929 1.1.4.1 jruoho RMIXL_DMFC2(RMIXL_COP_2_RXBUF, 0, rxmsg->msg.data[0]);
930 1.1.4.1 jruoho break;
931 1.1.4.1 jruoho case 2:
932 1.1.4.1 jruoho RMIXL_DMFC2(RMIXL_COP_2_RXBUF, 0, rxmsg->msg.data[0]);
933 1.1.4.1 jruoho RMIXL_DMFC2(RMIXL_COP_2_RXBUF, 1, rxmsg->msg.data[1]);
934 1.1.4.1 jruoho break;
935 1.1.4.1 jruoho case 3:
936 1.1.4.1 jruoho RMIXL_DMFC2(RMIXL_COP_2_RXBUF, 0, rxmsg->msg.data[0]);
937 1.1.4.1 jruoho RMIXL_DMFC2(RMIXL_COP_2_RXBUF, 1, rxmsg->msg.data[1]);
938 1.1.4.1 jruoho RMIXL_DMFC2(RMIXL_COP_2_RXBUF, 2, rxmsg->msg.data[2]);
939 1.1.4.1 jruoho break;
940 1.1.4.1 jruoho case 4:
941 1.1.4.1 jruoho RMIXL_DMFC2(RMIXL_COP_2_RXBUF, 0, rxmsg->msg.data[0]);
942 1.1.4.1 jruoho RMIXL_DMFC2(RMIXL_COP_2_RXBUF, 1, rxmsg->msg.data[1]);
943 1.1.4.1 jruoho RMIXL_DMFC2(RMIXL_COP_2_RXBUF, 2, rxmsg->msg.data[2]);
944 1.1.4.1 jruoho RMIXL_DMFC2(RMIXL_COP_2_RXBUF, 3, rxmsg->msg.data[3]);
945 1.1.4.1 jruoho break;
946 1.1.4.1 jruoho default:
947 1.1.4.1 jruoho /* "impossible" due to bitfield width */
948 1.1.4.1 jruoho panic("%s: bad size %d", __func__, rxmsg->size);
949 1.1.4.1 jruoho }
950 1.1.4.1 jruoho }
951 1.1.4.1 jruoho out:
952 1.1.4.1 jruoho
953 1.1.4.1 jruoho return rv;
954 1.1.4.1 jruoho }
955 1.1.4.1 jruoho
956 1.1.4.1 jruoho #ifdef FMN_DEBUG
957 1.1.4.1 jruoho void
958 1.1.4.1 jruoho rmixl_fmn_cp2_dump(void)
959 1.1.4.1 jruoho {
960 1.1.4.1 jruoho uint32_t cp0_status;
961 1.1.4.1 jruoho
962 1.1.4.1 jruoho cp0_status = rmixl_cp2_enable();
963 1.1.4.1 jruoho
964 1.1.4.1 jruoho CPU2_PRINT_8(RMIXL_COP_2_TXBUF, 0);
965 1.1.4.1 jruoho CPU2_PRINT_8(RMIXL_COP_2_TXBUF, 1);
966 1.1.4.1 jruoho CPU2_PRINT_8(RMIXL_COP_2_TXBUF, 2);
967 1.1.4.1 jruoho CPU2_PRINT_8(RMIXL_COP_2_TXBUF, 3);
968 1.1.4.1 jruoho
969 1.1.4.1 jruoho CPU2_PRINT_8(RMIXL_COP_2_RXBUF, 0);
970 1.1.4.1 jruoho CPU2_PRINT_8(RMIXL_COP_2_RXBUF, 1);
971 1.1.4.1 jruoho CPU2_PRINT_8(RMIXL_COP_2_RXBUF, 2);
972 1.1.4.1 jruoho CPU2_PRINT_8(RMIXL_COP_2_RXBUF, 3);
973 1.1.4.1 jruoho
974 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_MSG_STS, 0);
975 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_MSG_STS, 1);
976 1.1.4.1 jruoho
977 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_MSG_CFG, 0);
978 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_MSG_CFG, 1);
979 1.1.4.1 jruoho
980 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_MSG_BSZ, 0);
981 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_MSG_BSZ, 1);
982 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_MSG_BSZ, 2);
983 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_MSG_BSZ, 3);
984 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_MSG_BSZ, 4);
985 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_MSG_BSZ, 5);
986 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_MSG_BSZ, 6);
987 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_MSG_BSZ, 7);
988 1.1.4.1 jruoho
989 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 0, 0);
990 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 0, 1);
991 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 0, 2);
992 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 0, 3);
993 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 0, 4);
994 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 0, 5);
995 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 0, 6);
996 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 0, 7);
997 1.1.4.1 jruoho
998 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 1, 0);
999 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 1, 1);
1000 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 1, 2);
1001 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 1, 3);
1002 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 1, 4);
1003 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 1, 5);
1004 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 1, 6);
1005 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 1, 7);
1006 1.1.4.1 jruoho
1007 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 2, 0);
1008 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 2, 1);
1009 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 2, 2);
1010 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 2, 3);
1011 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 2, 4);
1012 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 2, 5);
1013 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 2, 6);
1014 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 2, 7);
1015 1.1.4.1 jruoho
1016 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 3, 0);
1017 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 3, 1);
1018 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 3, 2);
1019 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 3, 3);
1020 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 3, 4);
1021 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 3, 5);
1022 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 3, 6);
1023 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 3, 7);
1024 1.1.4.1 jruoho
1025 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 4, 0);
1026 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 4, 1);
1027 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 4, 2);
1028 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 4, 3);
1029 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 4, 4);
1030 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 4, 5);
1031 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 4, 6);
1032 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 4, 7);
1033 1.1.4.1 jruoho
1034 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 5, 0);
1035 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 5, 1);
1036 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 5, 2);
1037 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 5, 3);
1038 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 5, 4);
1039 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 5, 5);
1040 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 5, 6);
1041 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 5, 7);
1042 1.1.4.1 jruoho
1043 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 6, 0);
1044 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 6, 1);
1045 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 6, 2);
1046 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 6, 3);
1047 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 6, 4);
1048 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 6, 5);
1049 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 6, 6);
1050 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 6, 7);
1051 1.1.4.1 jruoho
1052 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 7, 0);
1053 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 7, 1);
1054 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 7, 2);
1055 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 7, 3);
1056 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 7, 4);
1057 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 7, 5);
1058 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 7, 6);
1059 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 7, 7);
1060 1.1.4.1 jruoho
1061 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 8, 0);
1062 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 8, 1);
1063 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 8, 2);
1064 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 8, 3);
1065 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 8, 4);
1066 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 8, 5);
1067 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 8, 6);
1068 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 8, 7);
1069 1.1.4.1 jruoho
1070 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 9, 0);
1071 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 9, 1);
1072 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 9, 2);
1073 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 9, 3);
1074 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 9, 4);
1075 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 9, 5);
1076 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 9, 6);
1077 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 9, 7);
1078 1.1.4.1 jruoho
1079 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 10, 0);
1080 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 10, 1);
1081 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 10, 2);
1082 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 10, 3);
1083 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 10, 4);
1084 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 10, 5);
1085 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 10, 6);
1086 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 10, 7);
1087 1.1.4.1 jruoho
1088 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 11, 0);
1089 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 11, 1);
1090 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 11, 2);
1091 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 11, 3);
1092 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 11, 4);
1093 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 11, 5);
1094 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 11, 6);
1095 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 11, 7);
1096 1.1.4.1 jruoho
1097 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 12, 0);
1098 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 12, 1);
1099 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 12, 2);
1100 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 12, 3);
1101 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 12, 4);
1102 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 12, 5);
1103 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 12, 6);
1104 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 12, 7);
1105 1.1.4.1 jruoho
1106 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 13, 0);
1107 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 13, 1);
1108 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 13, 2);
1109 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 13, 3);
1110 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 13, 4);
1111 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 13, 5);
1112 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 13, 6);
1113 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 13, 7);
1114 1.1.4.1 jruoho
1115 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 14, 0);
1116 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 14, 1);
1117 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 14, 2);
1118 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 14, 3);
1119 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 14, 4);
1120 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 14, 5);
1121 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 14, 6);
1122 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 14, 7);
1123 1.1.4.1 jruoho
1124 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 15, 0);
1125 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 15, 1);
1126 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 15, 2);
1127 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 15, 3);
1128 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 15, 4);
1129 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 15, 5);
1130 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 15, 6);
1131 1.1.4.1 jruoho CPU2_PRINT_4(RMIXL_COP_2_CREDITS + 15, 7);
1132 1.1.4.1 jruoho
1133 1.1.4.1 jruoho rmixl_cp2_restore(cp0_status);
1134 1.1.4.1 jruoho }
1135 1.1.4.1 jruoho
1136 1.1.4.1 jruoho
1137 1.1.4.1 jruoho void
1138 1.1.4.1 jruoho rmixl_fmn_cc_dump(void)
1139 1.1.4.1 jruoho {
1140 1.1.4.1 jruoho uint32_t cc[4][8];
1141 1.1.4.1 jruoho
1142 1.1.4.1 jruoho FMN_CP2_4SEL_READ(RMIXL_COP_2_CREDITS, 0, &cc[0][0]);
1143 1.1.4.1 jruoho FMN_CP2_4SEL_READ(RMIXL_COP_2_CREDITS, 4, &cc[0][4]);
1144 1.1.4.1 jruoho FMN_CP2_4SEL_READ(RMIXL_COP_2_CREDITS+1, 0, &cc[1][0]);
1145 1.1.4.1 jruoho FMN_CP2_4SEL_READ(RMIXL_COP_2_CREDITS+1, 4, &cc[1][4]);
1146 1.1.4.1 jruoho FMN_CP2_4SEL_READ(RMIXL_COP_2_CREDITS+2, 0, &cc[2][0]);
1147 1.1.4.1 jruoho FMN_CP2_4SEL_READ(RMIXL_COP_2_CREDITS+2, 4, &cc[2][4]);
1148 1.1.4.1 jruoho FMN_CP2_4SEL_READ(RMIXL_COP_2_CREDITS+3, 0, &cc[3][0]);
1149 1.1.4.1 jruoho FMN_CP2_4SEL_READ(RMIXL_COP_2_CREDITS+3, 4, &cc[3][4]);
1150 1.1.4.1 jruoho
1151 1.1.4.1 jruoho printf("%s: cpu%u\n", __func__, cpu_number());
1152 1.1.4.1 jruoho for (int i=0; i < 4; i++) {
1153 1.1.4.1 jruoho for (int j=0; j < 8; j++)
1154 1.1.4.1 jruoho printf(" %#x,", cc[i][j]);
1155 1.1.4.1 jruoho printf("\n");
1156 1.1.4.1 jruoho }
1157 1.1.4.1 jruoho }
1158 1.1.4.1 jruoho
1159 1.1.4.1 jruoho #endif /* FMN_DEBUG */
1160