aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/hardware/eicon/os_4bri.c
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2012-02-19 22:52:38 -0500
committerJoe Perches <joe@perches.com>2012-02-21 12:04:01 -0500
commit475be4d85a274d0961593db41cf85689db1d583c (patch)
treeb2b8931eb747794730522c3cf1898e46948527b9 /drivers/isdn/hardware/eicon/os_4bri.c
parent0b0a635f79f91f3755b6518627ea06dd0dbfd523 (diff)
isdn: whitespace coding style cleanup
isdn source code uses a not-current coding style. Update the coding style used on a per-line basis so that git diff -w shows only elided blank lines at EOF. Done with emacs and some scripts and some typing. Built x86 allyesconfig. No detected change in objdump -d or size. Signed-off-by: Joe Perches <joe@perches.com>
Diffstat (limited to 'drivers/isdn/hardware/eicon/os_4bri.c')
-rw-r--r--drivers/isdn/hardware/eicon/os_4bri.c352
1 files changed, 176 insertions, 176 deletions
diff --git a/drivers/isdn/hardware/eicon/os_4bri.c b/drivers/isdn/hardware/eicon/os_4bri.c
index cb7616c5b60a..1891246807ed 100644
--- a/drivers/isdn/hardware/eicon/os_4bri.c
+++ b/drivers/isdn/hardware/eicon/os_4bri.c
@@ -27,12 +27,12 @@ static dword diva_xdiLoadFileLength = 0;
27extern void prepare_qBri_functions(PISDN_ADAPTER IoAdapter); 27extern void prepare_qBri_functions(PISDN_ADAPTER IoAdapter);
28extern void prepare_qBri2_functions(PISDN_ADAPTER IoAdapter); 28extern void prepare_qBri2_functions(PISDN_ADAPTER IoAdapter);
29extern void diva_xdi_display_adapter_features(int card); 29extern void diva_xdi_display_adapter_features(int card);
30extern void diva_add_slave_adapter(diva_os_xdi_adapter_t * a); 30extern void diva_add_slave_adapter(diva_os_xdi_adapter_t *a);
31 31
32extern int qBri_FPGA_download(PISDN_ADAPTER IoAdapter); 32extern int qBri_FPGA_download(PISDN_ADAPTER IoAdapter);
33extern void start_qBri_hardware(PISDN_ADAPTER IoAdapter); 33extern void start_qBri_hardware(PISDN_ADAPTER IoAdapter);
34 34
35extern int diva_card_read_xlog(diva_os_xdi_adapter_t * a); 35extern int diva_card_read_xlog(diva_os_xdi_adapter_t *a);
36 36
37/* 37/*
38** LOCALS 38** LOCALS
@@ -57,23 +57,23 @@ static unsigned long _4bri_v2_bri_bar_length[4] = {
57}; 57};
58 58
59 59
60static int diva_4bri_cleanup_adapter(diva_os_xdi_adapter_t * a); 60static int diva_4bri_cleanup_adapter(diva_os_xdi_adapter_t *a);
61static int _4bri_get_serial_number(diva_os_xdi_adapter_t * a); 61static int _4bri_get_serial_number(diva_os_xdi_adapter_t *a);
62static int diva_4bri_cmd_card_proc(struct _diva_os_xdi_adapter *a, 62static int diva_4bri_cmd_card_proc(struct _diva_os_xdi_adapter *a,
63 diva_xdi_um_cfg_cmd_t * cmd, 63 diva_xdi_um_cfg_cmd_t *cmd,
64 int length); 64 int length);
65static int diva_4bri_cleanup_slave_adapters(diva_os_xdi_adapter_t * a); 65static int diva_4bri_cleanup_slave_adapters(diva_os_xdi_adapter_t *a);
66static int diva_4bri_write_fpga_image(diva_os_xdi_adapter_t * a, 66static int diva_4bri_write_fpga_image(diva_os_xdi_adapter_t *a,
67 byte * data, dword length); 67 byte *data, dword length);
68static int diva_4bri_reset_adapter(PISDN_ADAPTER IoAdapter); 68static int diva_4bri_reset_adapter(PISDN_ADAPTER IoAdapter);
69static int diva_4bri_write_sdram_block(PISDN_ADAPTER IoAdapter, 69static int diva_4bri_write_sdram_block(PISDN_ADAPTER IoAdapter,
70 dword address, 70 dword address,
71 const byte * data, 71 const byte *data,
72 dword length, dword limit); 72 dword length, dword limit);
73static int diva_4bri_start_adapter(PISDN_ADAPTER IoAdapter, 73static int diva_4bri_start_adapter(PISDN_ADAPTER IoAdapter,
74 dword start_address, dword features); 74 dword start_address, dword features);
75static int check_qBri_interrupt(PISDN_ADAPTER IoAdapter); 75static int check_qBri_interrupt(PISDN_ADAPTER IoAdapter);
76static int diva_4bri_stop_adapter(diva_os_xdi_adapter_t * a); 76static int diva_4bri_stop_adapter(diva_os_xdi_adapter_t *a);
77 77
78static int _4bri_is_rev_2_card(int card_ordinal) 78static int _4bri_is_rev_2_card(int card_ordinal)
79{ 79{
@@ -112,8 +112,8 @@ static void diva_4bri_set_addresses(diva_os_xdi_adapter_t *a)
112 a->resources.pci.mem_type_id[MEM_TYPE_PROM] = 0; 112 a->resources.pci.mem_type_id[MEM_TYPE_PROM] = 0;
113 113
114 /* 114 /*
115 Set up hardware related pointers 115 Set up hardware related pointers
116 */ 116 */
117 a->xdi_adapter.Address = a->resources.pci.addr[2]; /* BAR2 SDRAM */ 117 a->xdi_adapter.Address = a->resources.pci.addr[2]; /* BAR2 SDRAM */
118 a->xdi_adapter.Address += c_offset; 118 a->xdi_adapter.Address += c_offset;
119 119
@@ -121,15 +121,15 @@ static void diva_4bri_set_addresses(diva_os_xdi_adapter_t *a)
121 121
122 a->xdi_adapter.ram = a->resources.pci.addr[2]; /* BAR2 SDRAM */ 122 a->xdi_adapter.ram = a->resources.pci.addr[2]; /* BAR2 SDRAM */
123 a->xdi_adapter.ram += c_offset + (offset - MQ_SHARED_RAM_SIZE); 123 a->xdi_adapter.ram += c_offset + (offset - MQ_SHARED_RAM_SIZE);
124 124
125 a->xdi_adapter.reset = a->resources.pci.addr[0]; /* BAR0 CONFIG */ 125 a->xdi_adapter.reset = a->resources.pci.addr[0]; /* BAR0 CONFIG */
126 /* 126 /*
127 ctlReg contains the register address for the MIPS CPU reset control 127 ctlReg contains the register address for the MIPS CPU reset control
128 */ 128 */
129 a->xdi_adapter.ctlReg = a->resources.pci.addr[3]; /* BAR3 CNTRL */ 129 a->xdi_adapter.ctlReg = a->resources.pci.addr[3]; /* BAR3 CNTRL */
130 /* 130 /*
131 prom contains the register address for FPGA and EEPROM programming 131 prom contains the register address for FPGA and EEPROM programming
132 */ 132 */
133 a->xdi_adapter.prom = &a->xdi_adapter.reset[0x6E]; 133 a->xdi_adapter.prom = &a->xdi_adapter.reset[0x6E];
134} 134}
135 135
@@ -141,7 +141,7 @@ static void diva_4bri_set_addresses(diva_os_xdi_adapter_t *a)
141** 141**
142** Called by master adapter, that will initialize and add slave adapters 142** Called by master adapter, that will initialize and add slave adapters
143*/ 143*/
144int diva_4bri_init_card(diva_os_xdi_adapter_t * a) 144int diva_4bri_init_card(diva_os_xdi_adapter_t *a)
145{ 145{
146 int bar, i; 146 int bar, i;
147 byte __iomem *p; 147 byte __iomem *p;
@@ -168,48 +168,48 @@ int diva_4bri_init_card(diva_os_xdi_adapter_t * a)
168 DBG_TRC(("SDRAM_LENGTH=%08x, tasks=%d, factor=%d", 168 DBG_TRC(("SDRAM_LENGTH=%08x, tasks=%d, factor=%d",
169 bar_length[2], tasks, factor)) 169 bar_length[2], tasks, factor))
170 170
171 /* 171 /*
172 Get Serial Number 172 Get Serial Number
173 The serial number of 4BRI is accessible in accordance with PCI spec 173 The serial number of 4BRI is accessible in accordance with PCI spec
174 via command register located in configuration space, also we do not 174 via command register located in configuration space, also we do not
175 have to map any BAR before we can access it 175 have to map any BAR before we can access it
176 */ 176 */
177 if (!_4bri_get_serial_number(a)) { 177 if (!_4bri_get_serial_number(a)) {
178 DBG_ERR(("A: 4BRI can't get Serial Number")) 178 DBG_ERR(("A: 4BRI can't get Serial Number"))
179 diva_4bri_cleanup_adapter(a); 179 diva_4bri_cleanup_adapter(a);
180 return (-1); 180 return (-1);
181 } 181 }
182 182
183 /* 183 /*
184 Set properties 184 Set properties
185 */ 185 */
186 a->xdi_adapter.Properties = CardProperties[a->CardOrdinal]; 186 a->xdi_adapter.Properties = CardProperties[a->CardOrdinal];
187 DBG_LOG(("Load %s, SN:%ld, bus:%02x, func:%02x", 187 DBG_LOG(("Load %s, SN:%ld, bus:%02x, func:%02x",
188 a->xdi_adapter.Properties.Name, 188 a->xdi_adapter.Properties.Name,
189 a->xdi_adapter.serialNo, 189 a->xdi_adapter.serialNo,
190 a->resources.pci.bus, a->resources.pci.func)) 190 a->resources.pci.bus, a->resources.pci.func))
191 191
192 /* 192 /*
193 First initialization step: get and check hardware resoures. 193 First initialization step: get and check hardware resoures.
194 Do not map resources and do not access card at this step 194 Do not map resources and do not access card at this step
195 */ 195 */
196 for (bar = 0; bar < 4; bar++) { 196 for (bar = 0; bar < 4; bar++) {
197 a->resources.pci.bar[bar] = 197 a->resources.pci.bar[bar] =
198 divasa_get_pci_bar(a->resources.pci.bus, 198 divasa_get_pci_bar(a->resources.pci.bus,
199 a->resources.pci.func, bar, 199 a->resources.pci.func, bar,
200 a->resources.pci.hdev); 200 a->resources.pci.hdev);
201 if (!a->resources.pci.bar[bar] 201 if (!a->resources.pci.bar[bar]
202 || (a->resources.pci.bar[bar] == 0xFFFFFFF0)) { 202 || (a->resources.pci.bar[bar] == 0xFFFFFFF0)) {
203 DBG_ERR( 203 DBG_ERR(
204 ("A: invalid bar[%d]=%08x", bar, 204 ("A: invalid bar[%d]=%08x", bar,
205 a->resources.pci.bar[bar])) 205 a->resources.pci.bar[bar]))
206 return (-1); 206 return (-1);
207 }
207 } 208 }
208 }
209 a->resources.pci.irq = 209 a->resources.pci.irq =
210 (byte) divasa_get_pci_irq(a->resources.pci.bus, 210 (byte) divasa_get_pci_irq(a->resources.pci.bus,
211 a->resources.pci.func, 211 a->resources.pci.func,
212 a->resources.pci.hdev); 212 a->resources.pci.hdev);
213 if (!a->resources.pci.irq) { 213 if (!a->resources.pci.irq) {
214 DBG_ERR(("A: invalid irq")); 214 DBG_ERR(("A: invalid irq"));
215 return (-1); 215 return (-1);
@@ -218,30 +218,30 @@ int diva_4bri_init_card(diva_os_xdi_adapter_t * a)
218 a->xdi_adapter.sdram_bar = a->resources.pci.bar[2]; 218 a->xdi_adapter.sdram_bar = a->resources.pci.bar[2];
219 219
220 /* 220 /*
221 Map all MEMORY BAR's 221 Map all MEMORY BAR's
222 */ 222 */
223 for (bar = 0; bar < 4; bar++) { 223 for (bar = 0; bar < 4; bar++) {
224 if (bar != 1) { /* ignore I/O */ 224 if (bar != 1) { /* ignore I/O */
225 a->resources.pci.addr[bar] = 225 a->resources.pci.addr[bar] =
226 divasa_remap_pci_bar(a, bar, a->resources.pci.bar[bar], 226 divasa_remap_pci_bar(a, bar, a->resources.pci.bar[bar],
227 bar_length[bar]); 227 bar_length[bar]);
228 if (!a->resources.pci.addr[bar]) { 228 if (!a->resources.pci.addr[bar]) {
229 DBG_ERR(("A: 4BRI: can't map bar[%d]", bar)) 229 DBG_ERR(("A: 4BRI: can't map bar[%d]", bar))
230 diva_4bri_cleanup_adapter(a); 230 diva_4bri_cleanup_adapter(a);
231 return (-1); 231 return (-1);
232 } 232 }
233 } 233 }
234 } 234 }
235 235
236 /* 236 /*
237 Register I/O port 237 Register I/O port
238 */ 238 */
239 sprintf(&a->port_name[0], "DIVA 4BRI %ld", (long) a->xdi_adapter.serialNo); 239 sprintf(&a->port_name[0], "DIVA 4BRI %ld", (long) a->xdi_adapter.serialNo);
240 240
241 if (diva_os_register_io_port(a, 1, a->resources.pci.bar[1], 241 if (diva_os_register_io_port(a, 1, a->resources.pci.bar[1],
242 bar_length[1], &a->port_name[0], 1)) { 242 bar_length[1], &a->port_name[0], 1)) {
243 DBG_ERR(("A: 4BRI: can't register bar[1]")) 243 DBG_ERR(("A: 4BRI: can't register bar[1]"))
244 diva_4bri_cleanup_adapter(a); 244 diva_4bri_cleanup_adapter(a);
245 return (-1); 245 return (-1);
246 } 246 }
247 247
@@ -249,23 +249,23 @@ int diva_4bri_init_card(diva_os_xdi_adapter_t * a)
249 (void *) (unsigned long) a->resources.pci.bar[1]; 249 (void *) (unsigned long) a->resources.pci.bar[1];
250 250
251 /* 251 /*
252 Set cleanup pointer for base adapter only, so slave adapter 252 Set cleanup pointer for base adapter only, so slave adapter
253 will be unable to get cleanup 253 will be unable to get cleanup
254 */ 254 */
255 a->interface.cleanup_adapter_proc = diva_4bri_cleanup_adapter; 255 a->interface.cleanup_adapter_proc = diva_4bri_cleanup_adapter;
256 256
257 /* 257 /*
258 Create slave adapters 258 Create slave adapters
259 */ 259 */
260 if (tasks > 1) { 260 if (tasks > 1) {
261 if (!(a->slave_adapters[0] = 261 if (!(a->slave_adapters[0] =
262 (diva_os_xdi_adapter_t *) diva_os_malloc(0, sizeof(*a)))) 262 (diva_os_xdi_adapter_t *) diva_os_malloc(0, sizeof(*a))))
263 { 263 {
264 diva_4bri_cleanup_adapter(a); 264 diva_4bri_cleanup_adapter(a);
265 return (-1); 265 return (-1);
266 } 266 }
267 if (!(a->slave_adapters[1] = 267 if (!(a->slave_adapters[1] =
268 (diva_os_xdi_adapter_t *) diva_os_malloc(0, sizeof(*a)))) 268 (diva_os_xdi_adapter_t *) diva_os_malloc(0, sizeof(*a))))
269 { 269 {
270 diva_os_free(0, a->slave_adapters[0]); 270 diva_os_free(0, a->slave_adapters[0]);
271 a->slave_adapters[0] = NULL; 271 a->slave_adapters[0] = NULL;
@@ -273,7 +273,7 @@ int diva_4bri_init_card(diva_os_xdi_adapter_t * a)
273 return (-1); 273 return (-1);
274 } 274 }
275 if (!(a->slave_adapters[2] = 275 if (!(a->slave_adapters[2] =
276 (diva_os_xdi_adapter_t *) diva_os_malloc(0, sizeof(*a)))) 276 (diva_os_xdi_adapter_t *) diva_os_malloc(0, sizeof(*a))))
277 { 277 {
278 diva_os_free(0, a->slave_adapters[0]); 278 diva_os_free(0, a->slave_adapters[0]);
279 diva_os_free(0, a->slave_adapters[1]); 279 diva_os_free(0, a->slave_adapters[1]);
@@ -293,10 +293,10 @@ int diva_4bri_init_card(diva_os_xdi_adapter_t * a)
293 adapter_list[3] = a->slave_adapters[2]; 293 adapter_list[3] = a->slave_adapters[2];
294 294
295 /* 295 /*
296 Allocate slave list 296 Allocate slave list
297 */ 297 */
298 quadro_list = 298 quadro_list =
299 (PADAPTER_LIST_ENTRY) diva_os_malloc(0, sizeof(*quadro_list)); 299 (PADAPTER_LIST_ENTRY) diva_os_malloc(0, sizeof(*quadro_list));
300 if (!(a->slave_list = quadro_list)) { 300 if (!(a->slave_list = quadro_list)) {
301 for (i = 0; i < (tasks - 1); i++) { 301 for (i = 0; i < (tasks - 1); i++) {
302 diva_os_free(0, a->slave_adapters[i]); 302 diva_os_free(0, a->slave_adapters[i]);
@@ -308,14 +308,14 @@ int diva_4bri_init_card(diva_os_xdi_adapter_t * a)
308 memset(quadro_list, 0x00, sizeof(*quadro_list)); 308 memset(quadro_list, 0x00, sizeof(*quadro_list));
309 309
310 /* 310 /*
311 Set interfaces 311 Set interfaces
312 */ 312 */
313 a->xdi_adapter.QuadroList = quadro_list; 313 a->xdi_adapter.QuadroList = quadro_list;
314 for (i = 0; i < tasks; i++) { 314 for (i = 0; i < tasks; i++) {
315 adapter_list[i]->xdi_adapter.ControllerNumber = i; 315 adapter_list[i]->xdi_adapter.ControllerNumber = i;
316 adapter_list[i]->xdi_adapter.tasks = tasks; 316 adapter_list[i]->xdi_adapter.tasks = tasks;
317 quadro_list->QuadroAdapter[i] = 317 quadro_list->QuadroAdapter[i] =
318 &adapter_list[i]->xdi_adapter; 318 &adapter_list[i]->xdi_adapter;
319 } 319 }
320 320
321 for (i = 0; i < tasks; i++) { 321 for (i = 0; i < tasks; i++) {
@@ -324,21 +324,21 @@ int diva_4bri_init_card(diva_os_xdi_adapter_t * a)
324 diva_current->dsp_mask = 0x00000003; 324 diva_current->dsp_mask = 0x00000003;
325 325
326 diva_current->xdi_adapter.a.io = 326 diva_current->xdi_adapter.a.io =
327 &diva_current->xdi_adapter; 327 &diva_current->xdi_adapter;
328 diva_current->xdi_adapter.DIRequest = request; 328 diva_current->xdi_adapter.DIRequest = request;
329 diva_current->interface.cmd_proc = diva_4bri_cmd_card_proc; 329 diva_current->interface.cmd_proc = diva_4bri_cmd_card_proc;
330 diva_current->xdi_adapter.Properties = 330 diva_current->xdi_adapter.Properties =
331 CardProperties[a->CardOrdinal]; 331 CardProperties[a->CardOrdinal];
332 diva_current->CardOrdinal = a->CardOrdinal; 332 diva_current->CardOrdinal = a->CardOrdinal;
333 333
334 diva_current->xdi_adapter.Channels = 334 diva_current->xdi_adapter.Channels =
335 CardProperties[a->CardOrdinal].Channels; 335 CardProperties[a->CardOrdinal].Channels;
336 diva_current->xdi_adapter.e_max = 336 diva_current->xdi_adapter.e_max =
337 CardProperties[a->CardOrdinal].E_info; 337 CardProperties[a->CardOrdinal].E_info;
338 diva_current->xdi_adapter.e_tbl = 338 diva_current->xdi_adapter.e_tbl =
339 diva_os_malloc(0, 339 diva_os_malloc(0,
340 diva_current->xdi_adapter.e_max * 340 diva_current->xdi_adapter.e_max *
341 sizeof(E_INFO)); 341 sizeof(E_INFO));
342 342
343 if (!diva_current->xdi_adapter.e_tbl) { 343 if (!diva_current->xdi_adapter.e_tbl) {
344 diva_4bri_cleanup_slave_adapters(a); 344 diva_4bri_cleanup_slave_adapters(a);
@@ -370,8 +370,8 @@ int diva_4bri_init_card(diva_os_xdi_adapter_t * a)
370 370
371 strcpy(diva_current->xdi_adapter.req_soft_isr. dpc_thread_name, "kdivas4brid"); 371 strcpy(diva_current->xdi_adapter.req_soft_isr. dpc_thread_name, "kdivas4brid");
372 372
373 if (diva_os_initialize_soft_isr (&diva_current->xdi_adapter.req_soft_isr, DIDpcRoutine, 373 if (diva_os_initialize_soft_isr(&diva_current->xdi_adapter.req_soft_isr, DIDpcRoutine,
374 &diva_current->xdi_adapter)) { 374 &diva_current->xdi_adapter)) {
375 diva_4bri_cleanup_slave_adapters(a); 375 diva_4bri_cleanup_slave_adapters(a);
376 diva_4bri_cleanup_adapter(a); 376 diva_4bri_cleanup_adapter(a);
377 for (i = 1; i < (tasks - 1); i++) { 377 for (i = 1; i < (tasks - 1); i++) {
@@ -381,10 +381,10 @@ int diva_4bri_init_card(diva_os_xdi_adapter_t * a)
381 } 381 }
382 382
383 /* 383 /*
384 Do not initialize second DPC - only one thread will be created 384 Do not initialize second DPC - only one thread will be created
385 */ 385 */
386 diva_current->xdi_adapter.isr_soft_isr.object = 386 diva_current->xdi_adapter.isr_soft_isr.object =
387 diva_current->xdi_adapter.req_soft_isr.object; 387 diva_current->xdi_adapter.req_soft_isr.object;
388 } 388 }
389 389
390 if (v2) { 390 if (v2) {
@@ -397,12 +397,12 @@ int diva_4bri_init_card(diva_os_xdi_adapter_t * a)
397 diva_current = adapter_list[i]; 397 diva_current = adapter_list[i];
398 if (i) 398 if (i)
399 memcpy(&diva_current->resources, &a->resources, sizeof(divas_card_resources_t)); 399 memcpy(&diva_current->resources, &a->resources, sizeof(divas_card_resources_t));
400 diva_current->resources.pci.qoffset = (a->xdi_adapter.MemorySize >> factor); 400 diva_current->resources.pci.qoffset = (a->xdi_adapter.MemorySize >> factor);
401 } 401 }
402 402
403 /* 403 /*
404 Set up hardware related pointers 404 Set up hardware related pointers
405 */ 405 */
406 a->xdi_adapter.cfg = (void *) (unsigned long) a->resources.pci.bar[0]; /* BAR0 CONFIG */ 406 a->xdi_adapter.cfg = (void *) (unsigned long) a->resources.pci.bar[0]; /* BAR0 CONFIG */
407 a->xdi_adapter.port = (void *) (unsigned long) a->resources.pci.bar[1]; /* BAR1 */ 407 a->xdi_adapter.port = (void *) (unsigned long) a->resources.pci.bar[1]; /* BAR1 */
408 a->xdi_adapter.ctlReg = (void *) (unsigned long) a->resources.pci.bar[3]; /* BAR3 CNTRL */ 408 a->xdi_adapter.ctlReg = (void *) (unsigned long) a->resources.pci.bar[3]; /* BAR3 CNTRL */
@@ -415,21 +415,21 @@ int diva_4bri_init_card(diva_os_xdi_adapter_t * a)
415 Slave->sdram_bar = a->xdi_adapter.sdram_bar; 415 Slave->sdram_bar = a->xdi_adapter.sdram_bar;
416 if (i) { 416 if (i) {
417 Slave->serialNo = ((dword) (Slave->ControllerNumber << 24)) | 417 Slave->serialNo = ((dword) (Slave->ControllerNumber << 24)) |
418 a->xdi_adapter.serialNo; 418 a->xdi_adapter.serialNo;
419 Slave->cardType = a->xdi_adapter.cardType; 419 Slave->cardType = a->xdi_adapter.cardType;
420 } 420 }
421 } 421 }
422 422
423 /* 423 /*
424 reset contains the base address for the PLX 9054 register set 424 reset contains the base address for the PLX 9054 register set
425 */ 425 */
426 p = DIVA_OS_MEM_ATTACH_RESET(&a->xdi_adapter); 426 p = DIVA_OS_MEM_ATTACH_RESET(&a->xdi_adapter);
427 WRITE_BYTE(&p[PLX9054_INTCSR], 0x00); /* disable PCI interrupts */ 427 WRITE_BYTE(&p[PLX9054_INTCSR], 0x00); /* disable PCI interrupts */
428 DIVA_OS_MEM_DETACH_RESET(&a->xdi_adapter, p); 428 DIVA_OS_MEM_DETACH_RESET(&a->xdi_adapter, p);
429 429
430 /* 430 /*
431 Set IRQ handler 431 Set IRQ handler
432 */ 432 */
433 a->xdi_adapter.irq_info.irq_nr = a->resources.pci.irq; 433 a->xdi_adapter.irq_info.irq_nr = a->resources.pci.irq;
434 sprintf(a->xdi_adapter.irq_info.irq_name, "DIVA 4BRI %ld", 434 sprintf(a->xdi_adapter.irq_info.irq_name, "DIVA 4BRI %ld",
435 (long) a->xdi_adapter.serialNo); 435 (long) a->xdi_adapter.serialNo);
@@ -447,8 +447,8 @@ int diva_4bri_init_card(diva_os_xdi_adapter_t * a)
447 a->xdi_adapter.irq_info.registered = 1; 447 a->xdi_adapter.irq_info.registered = 1;
448 448
449 /* 449 /*
450 Add three slave adapters 450 Add three slave adapters
451 */ 451 */
452 if (tasks > 1) { 452 if (tasks > 1) {
453 diva_add_slave_adapter(adapter_list[1]); 453 diva_add_slave_adapter(adapter_list[1]);
454 diva_add_slave_adapter(adapter_list[2]); 454 diva_add_slave_adapter(adapter_list[2]);
@@ -466,33 +466,33 @@ int diva_4bri_init_card(diva_os_xdi_adapter_t * a)
466** this is guaranteed by design: cleanup callback is set 466** this is guaranteed by design: cleanup callback is set
467** by master adapter only 467** by master adapter only
468*/ 468*/
469static int diva_4bri_cleanup_adapter(diva_os_xdi_adapter_t * a) 469static int diva_4bri_cleanup_adapter(diva_os_xdi_adapter_t *a)
470{ 470{
471 int bar; 471 int bar;
472 472
473 /* 473 /*
474 Stop adapter if running 474 Stop adapter if running
475 */ 475 */
476 if (a->xdi_adapter.Initialized) { 476 if (a->xdi_adapter.Initialized) {
477 diva_4bri_stop_adapter(a); 477 diva_4bri_stop_adapter(a);
478 } 478 }
479 479
480 /* 480 /*
481 Remove IRQ handler 481 Remove IRQ handler
482 */ 482 */
483 if (a->xdi_adapter.irq_info.registered) { 483 if (a->xdi_adapter.irq_info.registered) {
484 diva_os_remove_irq(a, a->xdi_adapter.irq_info.irq_nr); 484 diva_os_remove_irq(a, a->xdi_adapter.irq_info.irq_nr);
485 } 485 }
486 a->xdi_adapter.irq_info.registered = 0; 486 a->xdi_adapter.irq_info.registered = 0;
487 487
488 /* 488 /*
489 Free DPC's and spin locks on all adapters 489 Free DPC's and spin locks on all adapters
490 */ 490 */
491 diva_4bri_cleanup_slave_adapters(a); 491 diva_4bri_cleanup_slave_adapters(a);
492 492
493 /* 493 /*
494 Unmap all BARS 494 Unmap all BARS
495 */ 495 */
496 for (bar = 0; bar < 4; bar++) { 496 for (bar = 0; bar < 4; bar++) {
497 if (bar != 1) { 497 if (bar != 1) {
498 if (a->resources.pci.bar[bar] 498 if (a->resources.pci.bar[bar]
@@ -505,8 +505,8 @@ static int diva_4bri_cleanup_adapter(diva_os_xdi_adapter_t * a)
505 } 505 }
506 506
507 /* 507 /*
508 Unregister I/O 508 Unregister I/O
509 */ 509 */
510 if (a->resources.pci.bar[1] && a->resources.pci.addr[1]) { 510 if (a->resources.pci.bar[1] && a->resources.pci.addr[1]) {
511 diva_os_register_io_port(a, 0, a->resources.pci.bar[1], 511 diva_os_register_io_port(a, 0, a->resources.pci.bar[1],
512 _4bri_is_rev_2_card(a-> 512 _4bri_is_rev_2_card(a->
@@ -526,7 +526,7 @@ static int diva_4bri_cleanup_adapter(diva_os_xdi_adapter_t * a)
526 return (0); 526 return (0);
527} 527}
528 528
529static int _4bri_get_serial_number(diva_os_xdi_adapter_t * a) 529static int _4bri_get_serial_number(diva_os_xdi_adapter_t *a)
530{ 530{
531 dword data[64]; 531 dword data[64];
532 dword serNo; 532 dword serNo;
@@ -551,13 +551,13 @@ static int _4bri_get_serial_number(diva_os_xdi_adapter_t * a)
551 } 551 }
552 if (j >= 5) { 552 if (j >= 5) {
553 DBG_ERR(("EEPROM[%d] read failed (0x%x)", i * 4, addr)) 553 DBG_ERR(("EEPROM[%d] read failed (0x%x)", i * 4, addr))
554 return (0); 554 return (0);
555 } 555 }
556 PCIread(Bus, Slot, 0x50, &data[i], sizeof(data[i]), hdev); 556 PCIread(Bus, Slot, 0x50, &data[i], sizeof(data[i]), hdev);
557 } 557 }
558 DBG_BLK(((char *) &data[0], sizeof(data))) 558 DBG_BLK(((char *) &data[0], sizeof(data)))
559 559
560 serNo = data[32]; 560 serNo = data[32];
561 if (serNo == 0 || serNo == 0xffffffff) 561 if (serNo == 0 || serNo == 0xffffffff)
562 serNo = data[63]; 562 serNo = data[63];
563 563
@@ -572,13 +572,13 @@ static int _4bri_get_serial_number(diva_os_xdi_adapter_t * a)
572 572
573 DBG_REG(("Serial No. : %ld", a->xdi_adapter.serialNo)) 573 DBG_REG(("Serial No. : %ld", a->xdi_adapter.serialNo))
574 574
575 return (serNo); 575 return (serNo);
576} 576}
577 577
578/* 578/*
579** Release resources of slave adapters 579** Release resources of slave adapters
580*/ 580*/
581static int diva_4bri_cleanup_slave_adapters(diva_os_xdi_adapter_t * a) 581static int diva_4bri_cleanup_slave_adapters(diva_os_xdi_adapter_t *a)
582{ 582{
583 diva_os_xdi_adapter_t *adapter_list[4]; 583 diva_os_xdi_adapter_t *adapter_list[4];
584 diva_os_xdi_adapter_t *diva_current; 584 diva_os_xdi_adapter_t *diva_current;
@@ -625,24 +625,24 @@ static int diva_4bri_cleanup_slave_adapters(diva_os_xdi_adapter_t * a)
625 625
626static int 626static int
627diva_4bri_cmd_card_proc(struct _diva_os_xdi_adapter *a, 627diva_4bri_cmd_card_proc(struct _diva_os_xdi_adapter *a,
628 diva_xdi_um_cfg_cmd_t * cmd, int length) 628 diva_xdi_um_cfg_cmd_t *cmd, int length)
629{ 629{
630 int ret = -1; 630 int ret = -1;
631 631
632 if (cmd->adapter != a->controller) { 632 if (cmd->adapter != a->controller) {
633 DBG_ERR(("A: 4bri_cmd, invalid controller=%d != %d", 633 DBG_ERR(("A: 4bri_cmd, invalid controller=%d != %d",
634 cmd->adapter, a->controller)) 634 cmd->adapter, a->controller))
635 return (-1); 635 return (-1);
636 } 636 }
637 637
638 switch (cmd->command) { 638 switch (cmd->command) {
639 case DIVA_XDI_UM_CMD_GET_CARD_ORDINAL: 639 case DIVA_XDI_UM_CMD_GET_CARD_ORDINAL:
640 a->xdi_mbox.data_length = sizeof(dword); 640 a->xdi_mbox.data_length = sizeof(dword);
641 a->xdi_mbox.data = 641 a->xdi_mbox.data =
642 diva_os_malloc(0, a->xdi_mbox.data_length); 642 diva_os_malloc(0, a->xdi_mbox.data_length);
643 if (a->xdi_mbox.data) { 643 if (a->xdi_mbox.data) {
644 *(dword *) a->xdi_mbox.data = 644 *(dword *) a->xdi_mbox.data =
645 (dword) a->CardOrdinal; 645 (dword) a->CardOrdinal;
646 a->xdi_mbox.status = DIVA_XDI_MBOX_BUSY; 646 a->xdi_mbox.status = DIVA_XDI_MBOX_BUSY;
647 ret = 0; 647 ret = 0;
648 } 648 }
@@ -651,10 +651,10 @@ diva_4bri_cmd_card_proc(struct _diva_os_xdi_adapter *a,
651 case DIVA_XDI_UM_CMD_GET_SERIAL_NR: 651 case DIVA_XDI_UM_CMD_GET_SERIAL_NR:
652 a->xdi_mbox.data_length = sizeof(dword); 652 a->xdi_mbox.data_length = sizeof(dword);
653 a->xdi_mbox.data = 653 a->xdi_mbox.data =
654 diva_os_malloc(0, a->xdi_mbox.data_length); 654 diva_os_malloc(0, a->xdi_mbox.data_length);
655 if (a->xdi_mbox.data) { 655 if (a->xdi_mbox.data) {
656 *(dword *) a->xdi_mbox.data = 656 *(dword *) a->xdi_mbox.data =
657 (dword) a->xdi_adapter.serialNo; 657 (dword) a->xdi_adapter.serialNo;
658 a->xdi_mbox.status = DIVA_XDI_MBOX_BUSY; 658 a->xdi_mbox.status = DIVA_XDI_MBOX_BUSY;
659 ret = 0; 659 ret = 0;
660 } 660 }
@@ -663,11 +663,11 @@ diva_4bri_cmd_card_proc(struct _diva_os_xdi_adapter *a,
663 case DIVA_XDI_UM_CMD_GET_PCI_HW_CONFIG: 663 case DIVA_XDI_UM_CMD_GET_PCI_HW_CONFIG:
664 if (!a->xdi_adapter.ControllerNumber) { 664 if (!a->xdi_adapter.ControllerNumber) {
665 /* 665 /*
666 Only master adapter can access hardware config 666 Only master adapter can access hardware config
667 */ 667 */
668 a->xdi_mbox.data_length = sizeof(dword) * 9; 668 a->xdi_mbox.data_length = sizeof(dword) * 9;
669 a->xdi_mbox.data = 669 a->xdi_mbox.data =
670 diva_os_malloc(0, a->xdi_mbox.data_length); 670 diva_os_malloc(0, a->xdi_mbox.data_length);
671 if (a->xdi_mbox.data) { 671 if (a->xdi_mbox.data) {
672 int i; 672 int i;
673 dword *data = (dword *) a->xdi_mbox.data; 673 dword *data = (dword *) a->xdi_mbox.data;
@@ -686,7 +686,7 @@ diva_4bri_cmd_card_proc(struct _diva_os_xdi_adapter *a,
686 if (!a->xdi_adapter.ControllerNumber) { 686 if (!a->xdi_adapter.ControllerNumber) {
687 a->xdi_mbox.data_length = sizeof(dword); 687 a->xdi_mbox.data_length = sizeof(dword);
688 a->xdi_mbox.data = 688 a->xdi_mbox.data =
689 diva_os_malloc(0, a->xdi_mbox.data_length); 689 diva_os_malloc(0, a->xdi_mbox.data_length);
690 if (a->xdi_mbox.data) { 690 if (a->xdi_mbox.data) {
691 dword *data = (dword *) a->xdi_mbox.data; 691 dword *data = (dword *) a->xdi_mbox.data;
692 if (!a->xdi_adapter.ram 692 if (!a->xdi_adapter.ram
@@ -709,11 +709,11 @@ diva_4bri_cmd_card_proc(struct _diva_os_xdi_adapter *a,
709 case DIVA_XDI_UM_CMD_WRITE_FPGA: 709 case DIVA_XDI_UM_CMD_WRITE_FPGA:
710 if (!a->xdi_adapter.ControllerNumber) { 710 if (!a->xdi_adapter.ControllerNumber) {
711 ret = 711 ret =
712 diva_4bri_write_fpga_image(a, 712 diva_4bri_write_fpga_image(a,
713 (byte *) & cmd[1], 713 (byte *)&cmd[1],
714 cmd->command_data. 714 cmd->command_data.
715 write_fpga. 715 write_fpga.
716 image_length); 716 image_length);
717 } 717 }
718 break; 718 break;
719 719
@@ -754,12 +754,12 @@ diva_4bri_cmd_card_proc(struct _diva_os_xdi_adapter *a,
754 case DIVA_XDI_UM_CMD_SET_PROTOCOL_FEATURES: 754 case DIVA_XDI_UM_CMD_SET_PROTOCOL_FEATURES:
755 if (!a->xdi_adapter.ControllerNumber) { 755 if (!a->xdi_adapter.ControllerNumber) {
756 a->xdi_adapter.features = 756 a->xdi_adapter.features =
757 cmd->command_data.features.features; 757 cmd->command_data.features.features;
758 a->xdi_adapter.a.protocol_capabilities = 758 a->xdi_adapter.a.protocol_capabilities =
759 a->xdi_adapter.features; 759 a->xdi_adapter.features;
760 DBG_TRC(("Set raw protocol features (%08x)", 760 DBG_TRC(("Set raw protocol features (%08x)",
761 a->xdi_adapter.features)) 761 a->xdi_adapter.features))
762 ret = 0; 762 ret = 0;
763 } 763 }
764 break; 764 break;
765 765
@@ -777,16 +777,16 @@ diva_4bri_cmd_card_proc(struct _diva_os_xdi_adapter *a,
777 if (!a->xdi_adapter.ControllerNumber 777 if (!a->xdi_adapter.ControllerNumber
778 && a->xdi_adapter.Address) { 778 && a->xdi_adapter.Address) {
779 if ( 779 if (
780 (a->xdi_mbox.data_length = 780 (a->xdi_mbox.data_length =
781 cmd->command_data.read_sdram.length)) { 781 cmd->command_data.read_sdram.length)) {
782 if ( 782 if (
783 (a->xdi_mbox.data_length + 783 (a->xdi_mbox.data_length +
784 cmd->command_data.read_sdram.offset) < 784 cmd->command_data.read_sdram.offset) <
785 a->xdi_adapter.MemorySize) { 785 a->xdi_adapter.MemorySize) {
786 a->xdi_mbox.data = 786 a->xdi_mbox.data =
787 diva_os_malloc(0, 787 diva_os_malloc(0,
788 a->xdi_mbox. 788 a->xdi_mbox.
789 data_length); 789 data_length);
790 if (a->xdi_mbox.data) { 790 if (a->xdi_mbox.data) {
791 byte __iomem *p = DIVA_OS_MEM_ATTACH_ADDRESS(&a->xdi_adapter); 791 byte __iomem *p = DIVA_OS_MEM_ATTACH_ADDRESS(&a->xdi_adapter);
792 byte __iomem *src = p; 792 byte __iomem *src = p;
@@ -810,7 +810,7 @@ diva_4bri_cmd_card_proc(struct _diva_os_xdi_adapter *a,
810 default: 810 default:
811 DBG_ERR(("A: A(%d) invalid cmd=%d", a->controller, 811 DBG_ERR(("A: A(%d) invalid cmd=%d", a->controller,
812 cmd->command)) 812 cmd->command))
813 } 813 }
814 814
815 return (ret); 815 return (ret);
816} 816}
@@ -838,7 +838,7 @@ void diva_os_set_qBri2_functions(PISDN_ADAPTER IoAdapter)
838} 838}
839 839
840static int 840static int
841diva_4bri_write_fpga_image(diva_os_xdi_adapter_t * a, byte * data, 841diva_4bri_write_fpga_image(diva_os_xdi_adapter_t *a, byte *data,
842 dword length) 842 dword length)
843{ 843{
844 int ret; 844 int ret;
@@ -865,12 +865,12 @@ static int diva_4bri_reset_adapter(PISDN_ADAPTER IoAdapter)
865 if (IoAdapter->Initialized) { 865 if (IoAdapter->Initialized) {
866 DBG_ERR(("A: A(%d) can't reset 4BRI adapter - please stop first", 866 DBG_ERR(("A: A(%d) can't reset 4BRI adapter - please stop first",
867 IoAdapter->ANum)) 867 IoAdapter->ANum))
868 return (-1); 868 return (-1);
869 } 869 }
870 870
871 /* 871 /*
872 Forget all entities on all adapters 872 Forget all entities on all adapters
873 */ 873 */
874 for (i = 0; ((i < IoAdapter->tasks) && IoAdapter->QuadroList); i++) { 874 for (i = 0; ((i < IoAdapter->tasks) && IoAdapter->QuadroList); i++) {
875 Slave = IoAdapter->QuadroList->QuadroAdapter[i]; 875 Slave = IoAdapter->QuadroList->QuadroAdapter[i];
876 Slave->e_count = 0; 876 Slave->e_count = 0;
@@ -908,7 +908,7 @@ static int diva_4bri_reset_adapter(PISDN_ADAPTER IoAdapter)
908static int 908static int
909diva_4bri_write_sdram_block(PISDN_ADAPTER IoAdapter, 909diva_4bri_write_sdram_block(PISDN_ADAPTER IoAdapter,
910 dword address, 910 dword address,
911 const byte * data, dword length, dword limit) 911 const byte *data, dword length, dword limit)
912{ 912{
913 byte __iomem *p = DIVA_OS_MEM_ATTACH_ADDRESS(IoAdapter); 913 byte __iomem *p = DIVA_OS_MEM_ATTACH_ADDRESS(IoAdapter);
914 byte __iomem *mem = p; 914 byte __iomem *mem = p;
@@ -917,7 +917,7 @@ diva_4bri_write_sdram_block(PISDN_ADAPTER IoAdapter,
917 DIVA_OS_MEM_DETACH_ADDRESS(IoAdapter, p); 917 DIVA_OS_MEM_DETACH_ADDRESS(IoAdapter, p);
918 DBG_ERR(("A: A(%d) write 4BRI address=0x%08lx", 918 DBG_ERR(("A: A(%d) write 4BRI address=0x%08lx",
919 IoAdapter->ANum, address + length)) 919 IoAdapter->ANum, address + length))
920 return (-1); 920 return (-1);
921 } 921 }
922 mem += address; 922 mem += address;
923 923
@@ -939,14 +939,14 @@ diva_4bri_start_adapter(PISDN_ADAPTER IoAdapter,
939 byte __iomem *p; 939 byte __iomem *p;
940 940
941 /* 941 /*
942 start adapter 942 start adapter
943 */ 943 */
944 start_qBri_hardware(IoAdapter); 944 start_qBri_hardware(IoAdapter);
945 945
946 p = DIVA_OS_MEM_ATTACH_RAM(IoAdapter); 946 p = DIVA_OS_MEM_ATTACH_RAM(IoAdapter);
947 /* 947 /*
948 wait for signature in shared memory (max. 3 seconds) 948 wait for signature in shared memory (max. 3 seconds)
949 */ 949 */
950 signature = (volatile word __iomem *) (&p[0x1E]); 950 signature = (volatile word __iomem *) (&p[0x1E]);
951 951
952 for (i = 0; i < 300; ++i) { 952 for (i = 0; i < 300; ++i) {
@@ -954,23 +954,23 @@ diva_4bri_start_adapter(PISDN_ADAPTER IoAdapter,
954 if (READ_WORD(&signature[0]) == 0x4447) { 954 if (READ_WORD(&signature[0]) == 0x4447) {
955 DBG_TRC(("Protocol startup time %d.%02d seconds", 955 DBG_TRC(("Protocol startup time %d.%02d seconds",
956 (i / 100), (i % 100))) 956 (i / 100), (i % 100)))
957 started = 1; 957 started = 1;
958 break; 958 break;
959 } 959 }
960 } 960 }
961 961
962 for (i = 1; i < IoAdapter->tasks; i++) { 962 for (i = 1; i < IoAdapter->tasks; i++) {
963 IoAdapter->QuadroList->QuadroAdapter[i]->features = 963 IoAdapter->QuadroList->QuadroAdapter[i]->features =
964 IoAdapter->features; 964 IoAdapter->features;
965 IoAdapter->QuadroList->QuadroAdapter[i]->a. 965 IoAdapter->QuadroList->QuadroAdapter[i]->a.
966 protocol_capabilities = IoAdapter->features; 966 protocol_capabilities = IoAdapter->features;
967 } 967 }
968 968
969 if (!started) { 969 if (!started) {
970 DBG_FTL(("%s: Adapter selftest failed, signature=%04x", 970 DBG_FTL(("%s: Adapter selftest failed, signature=%04x",
971 IoAdapter->Properties.Name, 971 IoAdapter->Properties.Name,
972 READ_WORD(&signature[0]))) 972 READ_WORD(&signature[0])))
973 DIVA_OS_MEM_DETACH_RAM(IoAdapter, p); 973 DIVA_OS_MEM_DETACH_RAM(IoAdapter, p);
974 (*(IoAdapter->trapFnc)) (IoAdapter); 974 (*(IoAdapter->trapFnc)) (IoAdapter);
975 IoAdapter->stop(IoAdapter); 975 IoAdapter->stop(IoAdapter);
976 return (-1); 976 return (-1);
@@ -985,9 +985,9 @@ diva_4bri_start_adapter(PISDN_ADAPTER IoAdapter,
985 if (check_qBri_interrupt(IoAdapter)) { 985 if (check_qBri_interrupt(IoAdapter)) {
986 DBG_ERR(("A: A(%d) interrupt test failed", 986 DBG_ERR(("A: A(%d) interrupt test failed",
987 IoAdapter->ANum)) 987 IoAdapter->ANum))
988 for (i = 0; i < IoAdapter->tasks; i++) { 988 for (i = 0; i < IoAdapter->tasks; i++) {
989 IoAdapter->QuadroList->QuadroAdapter[i]->Initialized = 0; 989 IoAdapter->QuadroList->QuadroAdapter[i]->Initialized = 0;
990 } 990 }
991 IoAdapter->stop(IoAdapter); 991 IoAdapter->stop(IoAdapter);
992 return (-1); 992 return (-1);
993 } 993 }
@@ -999,7 +999,7 @@ diva_4bri_start_adapter(PISDN_ADAPTER IoAdapter,
999 DBG_LOG(("A(%d) %s adapter successfully started", 999 DBG_LOG(("A(%d) %s adapter successfully started",
1000 IoAdapter->QuadroList->QuadroAdapter[i]->ANum, 1000 IoAdapter->QuadroList->QuadroAdapter[i]->ANum,
1001 (IoAdapter->tasks == 1) ? "BRI 2.0" : "4BRI")) 1001 (IoAdapter->tasks == 1) ? "BRI 2.0" : "4BRI"))
1002 diva_xdi_didd_register_adapter(IoAdapter->QuadroList->QuadroAdapter[i]->ANum); 1002 diva_xdi_didd_register_adapter(IoAdapter->QuadroList->QuadroAdapter[i]->ANum);
1003 IoAdapter->QuadroList->QuadroAdapter[i]->Properties.Features = (word) features; 1003 IoAdapter->QuadroList->QuadroAdapter[i]->Properties.Features = (word) features;
1004 } 1004 }
1005 1005
@@ -1022,8 +1022,8 @@ static int check_qBri_interrupt(PISDN_ADAPTER IoAdapter)
1022 WRITE_BYTE(&p[PLX9054_INTCSR], PLX9054_INT_ENABLE); 1022 WRITE_BYTE(&p[PLX9054_INTCSR], PLX9054_INT_ENABLE);
1023 DIVA_OS_MEM_DETACH_RESET(IoAdapter, p); 1023 DIVA_OS_MEM_DETACH_RESET(IoAdapter, p);
1024 /* 1024 /*
1025 interrupt test 1025 interrupt test
1026 */ 1026 */
1027 a->ReadyInt = 1; 1027 a->ReadyInt = 1;
1028 a->ram_out(a, &PR_RAM->ReadyInt, 1); 1028 a->ram_out(a, &PR_RAM->ReadyInt, 1);
1029 1029
@@ -1034,14 +1034,14 @@ static int check_qBri_interrupt(PISDN_ADAPTER IoAdapter)
1034 dword volatile __iomem *qBriIrq; 1034 dword volatile __iomem *qBriIrq;
1035 byte __iomem *p; 1035 byte __iomem *p;
1036 /* 1036 /*
1037 Reset on-board interrupt register 1037 Reset on-board interrupt register
1038 */ 1038 */
1039 IoAdapter->IrqCount = 0; 1039 IoAdapter->IrqCount = 0;
1040 p = DIVA_OS_MEM_ATTACH_CTLREG(IoAdapter); 1040 p = DIVA_OS_MEM_ATTACH_CTLREG(IoAdapter);
1041 qBriIrq = (dword volatile __iomem *) (&p[_4bri_is_rev_2_card 1041 qBriIrq = (dword volatile __iomem *) (&p[_4bri_is_rev_2_card
1042 (IoAdapter-> 1042 (IoAdapter->
1043 cardType) ? (MQ2_BREG_IRQ_TEST) 1043 cardType) ? (MQ2_BREG_IRQ_TEST)
1044 : (MQ_BREG_IRQ_TEST)]); 1044 : (MQ_BREG_IRQ_TEST)]);
1045 1045
1046 WRITE_DWORD(qBriIrq, MQ_IRQ_REQ_OFF); 1046 WRITE_DWORD(qBriIrq, MQ_IRQ_REQ_OFF);
1047 DIVA_OS_MEM_DETACH_CTLREG(IoAdapter, p); 1047 DIVA_OS_MEM_DETACH_CTLREG(IoAdapter, p);
@@ -1056,13 +1056,13 @@ static int check_qBri_interrupt(PISDN_ADAPTER IoAdapter)
1056#endif /* SUPPORT_INTERRUPT_TEST_ON_4BRI */ 1056#endif /* SUPPORT_INTERRUPT_TEST_ON_4BRI */
1057} 1057}
1058 1058
1059static void diva_4bri_clear_interrupts(diva_os_xdi_adapter_t * a) 1059static void diva_4bri_clear_interrupts(diva_os_xdi_adapter_t *a)
1060{ 1060{
1061 PISDN_ADAPTER IoAdapter = &a->xdi_adapter; 1061 PISDN_ADAPTER IoAdapter = &a->xdi_adapter;
1062 1062
1063 /* 1063 /*
1064 clear any pending interrupt 1064 clear any pending interrupt
1065 */ 1065 */
1066 IoAdapter->disIrq(IoAdapter); 1066 IoAdapter->disIrq(IoAdapter);
1067 1067
1068 IoAdapter->tst_irq(&IoAdapter->a); 1068 IoAdapter->tst_irq(&IoAdapter->a);
@@ -1070,13 +1070,13 @@ static void diva_4bri_clear_interrupts(diva_os_xdi_adapter_t * a)
1070 IoAdapter->tst_irq(&IoAdapter->a); 1070 IoAdapter->tst_irq(&IoAdapter->a);
1071 1071
1072 /* 1072 /*
1073 kill pending dpcs 1073 kill pending dpcs
1074 */ 1074 */
1075 diva_os_cancel_soft_isr(&IoAdapter->req_soft_isr); 1075 diva_os_cancel_soft_isr(&IoAdapter->req_soft_isr);
1076 diva_os_cancel_soft_isr(&IoAdapter->isr_soft_isr); 1076 diva_os_cancel_soft_isr(&IoAdapter->isr_soft_isr);
1077} 1077}
1078 1078
1079static int diva_4bri_stop_adapter(diva_os_xdi_adapter_t * a) 1079static int diva_4bri_stop_adapter(diva_os_xdi_adapter_t *a)
1080{ 1080{
1081 PISDN_ADAPTER IoAdapter = &a->xdi_adapter; 1081 PISDN_ADAPTER IoAdapter = &a->xdi_adapter;
1082 int i; 1082 int i;
@@ -1088,7 +1088,7 @@ static int diva_4bri_stop_adapter(diva_os_xdi_adapter_t * a)
1088 if (!IoAdapter->Initialized) { 1088 if (!IoAdapter->Initialized) {
1089 DBG_ERR(("A: A(%d) can't stop PRI adapter - not running", 1089 DBG_ERR(("A: A(%d) can't stop PRI adapter - not running",
1090 IoAdapter->ANum)) 1090 IoAdapter->ANum))
1091 return (-1); /* nothing to stop */ 1091 return (-1); /* nothing to stop */
1092 } 1092 }
1093 1093
1094 for (i = 0; i < IoAdapter->tasks; i++) { 1094 for (i = 0; i < IoAdapter->tasks; i++) {
@@ -1096,8 +1096,8 @@ static int diva_4bri_stop_adapter(diva_os_xdi_adapter_t * a)
1096 } 1096 }
1097 1097
1098 /* 1098 /*
1099 Disconnect Adapters from DIDD 1099 Disconnect Adapters from DIDD
1100 */ 1100 */
1101 for (i = 0; i < IoAdapter->tasks; i++) { 1101 for (i = 0; i < IoAdapter->tasks; i++) {
1102 diva_xdi_didd_remove_adapter(IoAdapter->QuadroList->QuadroAdapter[i]->ANum); 1102 diva_xdi_didd_remove_adapter(IoAdapter->QuadroList->QuadroAdapter[i]->ANum);
1103 } 1103 }
@@ -1105,8 +1105,8 @@ static int diva_4bri_stop_adapter(diva_os_xdi_adapter_t * a)
1105 i = 100; 1105 i = 100;
1106 1106
1107 /* 1107 /*
1108 Stop interrupts 1108 Stop interrupts
1109 */ 1109 */
1110 a->clear_interrupts_proc = diva_4bri_clear_interrupts; 1110 a->clear_interrupts_proc = diva_4bri_clear_interrupts;
1111 IoAdapter->a.ReadyInt = 1; 1111 IoAdapter->a.ReadyInt = 1;
1112 IoAdapter->a.ram_inc(&IoAdapter->a, &PR_RAM->ReadyInt); 1112 IoAdapter->a.ram_inc(&IoAdapter->a, &PR_RAM->ReadyInt);
@@ -1119,12 +1119,12 @@ static int diva_4bri_stop_adapter(diva_os_xdi_adapter_t * a)
1119 a->clear_interrupts_proc = NULL; 1119 a->clear_interrupts_proc = NULL;
1120 DBG_ERR(("A: A(%d) no final interrupt from 4BRI adapter", 1120 DBG_ERR(("A: A(%d) no final interrupt from 4BRI adapter",
1121 IoAdapter->ANum)) 1121 IoAdapter->ANum))
1122 } 1122 }
1123 IoAdapter->a.ReadyInt = 0; 1123 IoAdapter->a.ReadyInt = 0;
1124 1124
1125 /* 1125 /*
1126 Stop and reset adapter 1126 Stop and reset adapter
1127 */ 1127 */
1128 IoAdapter->stop(IoAdapter); 1128 IoAdapter->stop(IoAdapter);
1129 1129
1130 return (0); 1130 return (0);