Expand PMF_FN_* macros.
[netbsd-mini2440.git] / sys / dev / pci / n8 / common / displayRegs.c
blob700a132b36239d13b2a476d5ed1f82a9fdf4c59f
1 /*-
2 * Copyright (C) 2001-2003 by NBMK Encryption Technologies.
3 * All rights reserved.
5 * NBMK Encryption Technologies provides no support of any kind for
6 * this software. Questions or concerns about it may be addressed to
7 * the members of the relevant open-source community at
8 * <tech-crypto@netbsd.org>.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions are
12 * met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above
18 * copyright notice, this list of conditions and the following
19 * disclaimer in the documentation and/or other materials provided
20 * with the distribution.
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 static char const n8_id[] = "$Id: displayRegs.c,v 1.1 2008/10/30 12:02:14 darran Exp $";
36 /*****************************************************************************/
37 /** @file displayRegs.c
38 * @brief NSP2000 Device Driver register display functions
40 * This file displays the register set of the NSP2000 device for debugging
41 * purposes.
43 *****************************************************************************/
45 /*****************************************************************************
46 * Revision history:
47 * 11/25/02 brr Added banner to display software version.
48 * 10/23/02 brr Do not display RNG registers by default (locks up RNH).
49 * 10/25/02 brr Clean up function prototypes & include files.
50 * 03/19/02 brr Modifed N8_DisplayRegisters to dump all registers for all
51 * devices.
52 * 02/25/02 brr Use N8_PRINT.
53 * 11/10/01 brr Modified to support static allocations of persistant data
54 * by the driver.
55 * 09/07/01 mmd Further removal of references to "simon", and added support
56 * for displaying PKH registers.
57 * 08/16/01 mmd Now includes nsp2000_regs.h instead of simon.h.
58 * 08/08/01 brr Moved all OS kernel specific macros to helper.h.
59 * 07/26/01 brr Original version.
60 ****************************************************************************/
61 /** @defgroup NSP2000Driver NSP2000 Device Driver
65 #include "n8_OS_intf.h"
66 #include "helper.h"
67 #include "nsp2000_regs.h"
68 #include "n8_driver_main.h"
69 #include "nsp_ioctl.h"
70 #include "n8_driver_api.h"
71 #include "displayRegs.h"
72 #include "n8_version.h"
75 extern int NSPcount_g;
76 extern NspInstance_t NSPDeviceTable_g [DEF_MAX_SIMON_INSTANCES];
77 /*****************************************************************************
78 * N8_DisplayRegisters
79 *****************************************************************************/
80 /** @ingroup NSP2000Driver
81 * @brief Displays the contents of all NSP2000 control registers.
83 * This routine displays the contents of all NSP2000 control registers to the
84 * kernel log. This routine is intended for debugging purposes.
86 * @return
87 * N/A
89 * @par Errors:
90 * See return section for error information.
91 *****************************************************************************/
92 void N8_DisplayRegisters(void)
94 int nspIdx;
95 NspInstance_t *NSPinstance_p;
96 NSP2000REGS_t *nsp;
98 N8_PRINT(KERN_CRIT "\nN8_DisplayRegisters: " N8_VERSION_STRING);
100 for (nspIdx = 0; nspIdx < NSPcount_g; nspIdx++)
102 NSPinstance_p = &NSPDeviceTable_g[nspIdx];
103 nsp = (NSP2000REGS_t *)NSPinstance_p->NSPregs_p;
106 N8_PRINT(KERN_CRIT "\n");
107 N8_PRINT(KERN_CRIT "NSP2000: Displaying AMBA registers for chip %d:\n",
108 NSPinstance_p->chip);
109 N8_PRINT(KERN_CRIT " Timer preset = %08lx\n",
110 (unsigned long)nsp->amba_pci_timer_preset);
111 N8_PRINT(KERN_CRIT " Status = %08lx\n",
112 (unsigned long)nsp->amba_pci_status);
113 N8_PRINT(KERN_CRIT " Control = %08lx\n",
114 (unsigned long)nsp->amba_pci_control);
115 N8_PRINT(KERN_CRIT " Timer value = %08lx\n",
116 (unsigned long)nsp->amba_pci_timer_value);
118 N8_PRINT(KERN_CRIT "\n");
119 N8_PRINT(KERN_CRIT "NSP2000: Displaying CCH registers :\n");
120 N8_PRINT(KERN_CRIT " Test1 = %08lx\n",
121 (unsigned long)nsp->cch_test1);
122 N8_PRINT(KERN_CRIT " Test0 = %08lx\n",
123 (unsigned long)nsp->cch_test0);
124 N8_PRINT(KERN_CRIT " QueueLgth = %08lx\n",
125 (unsigned long)nsp->cch_q_length);
126 N8_PRINT(KERN_CRIT " QueuePtrs = %08lx\n",
127 (unsigned long)nsp->cch_q_ptr);
128 N8_PRINT(KERN_CRIT " QueueBase1 = %08lx\n",
129 (unsigned long)nsp->cch_q_bar1);
130 N8_PRINT(KERN_CRIT " QueueBase0 = %08lx\n",
131 (unsigned long)nsp->cch_q_bar0);
132 N8_PRINT(KERN_CRIT " IRQ Enable = %08lx\n",
133 (unsigned long)nsp->cch_intr_enable);
134 N8_PRINT(KERN_CRIT " Ctrl-Stat = %08lx\n",
135 (unsigned long)nsp->cch_control_status);
136 N8_PRINT(KERN_CRIT " Cntx Data1 = %08lx\n",
137 (unsigned long)nsp->cch_context_data1);
138 N8_PRINT(KERN_CRIT " Cntx Data0 = %08lx\n",
139 (unsigned long)nsp->cch_context_data0);
140 N8_PRINT(KERN_CRIT " Cntx Addr = %08lx\n",
141 (unsigned long)nsp->cch_context_addr);
143 #ifdef DISPLAY_RNG_REGISTERS
144 N8_PRINT(KERN_CRIT "\n");
145 N8_PRINT(KERN_CRIT "NSP2000: Displaying RNG registers :\n");
146 N8_PRINT(KERN_CRIT " TOD Seconds = %08lx\n",
147 (unsigned long)nsp->rng_tod_seconds);
148 N8_PRINT(KERN_CRIT " TOD Prescale = %08lx\n",
149 (unsigned long)nsp->rng_tod_prescale);
150 N8_PRINT(KERN_CRIT " TOD MSW = %08lx\n",
151 (unsigned long)nsp->rng_tod_msw);
152 N8_PRINT(KERN_CRIT " TOD LSW = %08lx\n",
153 (unsigned long)nsp->rng_tod_lsw);
154 N8_PRINT(KERN_CRIT " Key 1 MSW = %08lx\n",
155 (unsigned long)nsp->rng_key1_msw);
156 N8_PRINT(KERN_CRIT " Key 1 LSW = %08lx\n",
157 (unsigned long)nsp->rng_key1_lsw);
158 N8_PRINT(KERN_CRIT " Key 2 MSW = %08lx\n",
159 (unsigned long)nsp->rng_key2_msw);
160 N8_PRINT(KERN_CRIT " Key 2 LSW = %08lx\n",
161 (unsigned long)nsp->rng_key2_lsw);
162 N8_PRINT(KERN_CRIT " Host Seed MSW = %08lx\n",
163 (unsigned long)nsp->rng_hostseed_msw);
164 N8_PRINT(KERN_CRIT " Host Seed LSW = %08lx\n",
165 (unsigned long)nsp->rng_hostseed_lsw);
166 N8_PRINT(KERN_CRIT " Sample Interval = %08lx\n",
167 (unsigned long)nsp->rng_sample_interval);
168 N8_PRINT(KERN_CRIT " Ext. Clk Scalar = %08lx\n",
169 (unsigned long)nsp->rng_external_clock_scalar);
170 N8_PRINT(KERN_CRIT " Buff Write Ptr = %08lx\n",
171 (unsigned long)nsp->rng_buffer_write_ptr);
172 N8_PRINT(KERN_CRIT " Sample Seed MSW = %08lx\n",
173 (unsigned long)nsp->rng_sample_seed_msw);
174 N8_PRINT(KERN_CRIT " Sample Seed LSW = %08lx\n",
175 (unsigned long)nsp->rng_sample_seed_lsw);
176 N8_PRINT(KERN_CRIT " LSFR Diag = %08lx\n",
177 (unsigned long)nsp->rng_lsfr_diag);
178 N8_PRINT(KERN_CRIT " LSFR Hist 1 MSW = %08lx\n",
179 (unsigned long)nsp->rng_lsfr1_history_msw);
180 N8_PRINT(KERN_CRIT " LSFR Hist 1 LSW = %08lx\n",
181 (unsigned long)nsp->rng_lsfr1_history_lsw);
182 N8_PRINT(KERN_CRIT " LSFR Hist 2 MSW = %08lx\n",
183 (unsigned long)nsp->rng_lsfr2_history_msw);
184 N8_PRINT(KERN_CRIT " LSFR Hist 2 LSW = %08lx\n",
185 (unsigned long)nsp->rng_lsfr2_history_lsw);
186 N8_PRINT(KERN_CRIT " LSFR Hist 3 MSW = %08lx\n",
187 (unsigned long)nsp->rng_lsfr3_history_msw);
188 N8_PRINT(KERN_CRIT " LSFR Hist 3 LSW = %08lx\n",
189 (unsigned long)nsp->rng_lsfr3_history_lsw);
190 N8_PRINT(KERN_CRIT " LSFR Hist 4 MSW = %08lx\n",
191 (unsigned long)nsp->rng_lsfr4_history_msw);
192 N8_PRINT(KERN_CRIT " LSFR Hist 4 LSW = %08lx\n",
193 (unsigned long)nsp->rng_lsfr4_history_lsw);
194 N8_PRINT(KERN_CRIT " CtrlStatus = %08lx\n",
195 (unsigned long)nsp->rng_control_status);
196 #endif
198 N8_PRINT(KERN_CRIT "\n");
199 N8_PRINT(KERN_CRIT "NSP2000: Displaying RNH registers :\n");
200 N8_PRINT(KERN_CRIT " Test 0 = %08lx\n",
201 (unsigned long)nsp->rnh_test0);
202 N8_PRINT(KERN_CRIT " Test 1 = %08lx\n",
203 (unsigned long)nsp->rnh_test1);
204 N8_PRINT(KERN_CRIT " QueueLgth = %08lx\n",
205 (unsigned long)nsp->rnh_q_length);
206 N8_PRINT(KERN_CRIT " QueuePtrs = %08lx\n",
207 (unsigned long)nsp->rnh_q_ptr);
208 N8_PRINT(KERN_CRIT " QueueBase0 = %08lx\n",
209 (unsigned long)nsp->rnh_q_bar0);
210 N8_PRINT(KERN_CRIT " QueueBase1 = %08lx\n",
211 (unsigned long)nsp->rnh_q_bar1);
212 N8_PRINT(KERN_CRIT " CtrlStatus = %08lx\n",
213 (unsigned long)nsp->rnh_control_status);
215 N8_PRINT(KERN_CRIT "\n");
216 N8_PRINT(KERN_CRIT "NSP2000: Displaying PKH registers :\n");
217 N8_PRINT(KERN_CRIT " Test 0 = %08lx\n",
218 (unsigned long)nsp->pkh_test0);
219 N8_PRINT(KERN_CRIT " Test 1 = %08lx\n",
220 (unsigned long)nsp->pkh_test1);
221 N8_PRINT(KERN_CRIT " Cmd Q Length = %08lx\n",
222 (unsigned long)nsp->pkh_q_length);
223 N8_PRINT(KERN_CRIT " Cmd Q Pointers = %08lx\n",
224 (unsigned long)nsp->pkh_q_ptr);
225 N8_PRINT(KERN_CRIT " Cmd Q Base 1 = %08lx\n",
226 (unsigned long)nsp->pkh_q_bar1);
227 N8_PRINT(KERN_CRIT " Cmd Q Base 0 = %08lx\n",
228 (unsigned long)nsp->pkh_q_bar0);
229 N8_PRINT(KERN_CRIT " IRQ Enables = %08lx\n",
230 (unsigned long)nsp->pkh_intr_enable);
231 N8_PRINT(KERN_CRIT " Control/Status = %08lx\n",
232 (unsigned long)nsp->pkh_control_status);
233 N8_PRINT(KERN_CRIT " SKS Data = %08lx\n",
234 (unsigned long)nsp->pkh_secure_key_storage_data);
235 N8_PRINT(KERN_CRIT " SKS Control = %08lx\n",
236 (unsigned long)nsp->pkh_secure_key_storage_control);
238 return;