Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

scsi: atp870u: Whitespace cleanup

Link: https://lore.kernel.org/r/20210113090500.129644-6-hare@suse.de
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Hannes Reinecke and committed by
Martin K. Petersen
bcd5c59f 1789671d

+258 -187
+251 -180
drivers/scsi/atp870u.c
··· 42 42 43 43 static struct scsi_host_template atp870u_template; 44 44 static void send_s870(struct atp_unit *dev,unsigned char c); 45 - static void atp_is(struct atp_unit *dev, unsigned char c, bool wide_chip, unsigned char lvdmode); 45 + static void atp_is(struct atp_unit *dev, unsigned char c, bool wide_chip, 46 + unsigned char lvdmode); 46 47 47 48 static inline void atp_writeb_base(struct atp_unit *atp, u8 reg, u8 val) 48 49 { ··· 138 137 } 139 138 if ((j & 0x80) == 0) 140 139 return IRQ_NONE; 141 - #ifdef ED_DBGP 140 + #ifdef ED_DBGP 142 141 printk("atp870u_intr_handle enter\n"); 143 - #endif 142 + #endif 144 143 dev->in_int[c] = 1; 145 144 cmdp = atp_readb_io(dev, c, 0x10); 146 145 if (dev->working[c] != 0) { 147 146 if (is885(dev)) { 148 147 if ((atp_readb_io(dev, c, 0x16) & 0x80) == 0) 149 - atp_writeb_io(dev, c, 0x16, (atp_readb_io(dev, c, 0x16) | 0x80)); 150 - } 148 + atp_writeb_io(dev, c, 0x16, 149 + (atp_readb_io(dev, c, 0x16) | 0x80)); 150 + } 151 151 if ((atp_readb_pci(dev, c, 0x00) & 0x08) != 0) 152 152 { 153 153 for (k=0; k < 1000; k++) { ··· 159 157 } 160 158 } 161 159 atp_writeb_pci(dev, c, 0, 0x00); 162 - 160 + 163 161 i = atp_readb_io(dev, c, 0x17); 164 - 162 + 165 163 if (is885(dev)) 166 164 atp_writeb_pci(dev, c, 2, 0x06); 167 165 ··· 187 185 dev->r1f[c][target_id] |= j; 188 186 #ifdef ED_DBGP 189 187 printk("atp870u_intr_handle status = %x\n",i); 190 - #endif 188 + #endif 191 189 if (i == 0x85) { 192 190 if ((dev->last_cmd[c] & 0xf0) != 0x40) { 193 191 dev->last_cmd[c] = 0xff; 194 192 } 195 193 if (is885(dev)) { 196 194 adrcnt = 0; 197 - ((unsigned char *) &adrcnt)[2] = atp_readb_io(dev, c, 0x12); 198 - ((unsigned char *) &adrcnt)[1] = atp_readb_io(dev, c, 0x13); 199 - ((unsigned char *) &adrcnt)[0] = atp_readb_io(dev, c, 0x14); 195 + ((unsigned char *) &adrcnt)[2] = 196 + atp_readb_io(dev, c, 0x12); 197 + ((unsigned char *) &adrcnt)[1] = 198 + atp_readb_io(dev, c, 0x13); 199 + ((unsigned char *) &adrcnt)[0] = 200 + atp_readb_io(dev, c, 0x14); 200 201 if (dev->id[c][target_id].last_len != adrcnt) { 201 202 k = dev->id[c][target_id].last_len; 202 - k -= adrcnt; 203 - dev->id[c][target_id].tran_len = k; 203 + k -= adrcnt; 204 + dev->id[c][target_id].tran_len = k; 204 205 dev->id[c][target_id].last_len = adrcnt; 205 206 } 206 207 #ifdef ED_DBGP 207 - printk("dev->id[c][target_id].last_len = %d dev->id[c][target_id].tran_len = %d\n",dev->id[c][target_id].last_len,dev->id[c][target_id].tran_len); 208 - #endif 208 + printk("dev->id[c][target_id].last_len = %d " 209 + "dev->id[c][target_id].tran_len = %d\n", 210 + dev->id[c][target_id].last_len, 211 + dev->id[c][target_id].tran_len); 212 + #endif 209 213 } 210 214 211 215 /* 212 216 * Flip wide 213 - */ 217 + */ 214 218 if (dev->wide_id[c] != 0) { 215 219 atp_writeb_io(dev, c, 0x1b, 0x01); 216 220 while ((atp_readb_io(dev, c, 0x1b) & 0x01) != 0x01) 217 221 atp_writeb_io(dev, c, 0x1b, 0x01); 218 - } 222 + } 219 223 /* 220 224 * Issue more commands 221 225 */ 222 - spin_lock_irqsave(dev->host->host_lock, flags); 223 - if (((dev->quhd[c] != dev->quend[c]) || (dev->last_cmd[c] != 0xff)) && 226 + spin_lock_irqsave(dev->host->host_lock, flags); 227 + if (((dev->quhd[c] != dev->quend[c]) || 228 + (dev->last_cmd[c] != 0xff)) && 224 229 (dev->in_snd[c] == 0)) { 225 230 #ifdef ED_DBGP 226 231 printk("Call sent_s870\n"); 227 - #endif 232 + #endif 228 233 send_s870(dev,c); 229 234 } 230 235 spin_unlock_irqrestore(dev->host->host_lock, flags); ··· 241 232 dev->in_int[c] = 0; 242 233 #ifdef ED_DBGP 243 234 printk("Status 0x85 return\n"); 244 - #endif 235 + #endif 245 236 return IRQ_HANDLED; 246 237 } 247 238 ··· 256 247 dev->last_cmd[c] = 0xff; 257 248 } 258 249 adrcnt = 0; 259 - ((unsigned char *) &adrcnt)[2] = atp_readb_io(dev, c, 0x12); 260 - ((unsigned char *) &adrcnt)[1] = atp_readb_io(dev, c, 0x13); 261 - ((unsigned char *) &adrcnt)[0] = atp_readb_io(dev, c, 0x14); 250 + ((unsigned char *) &adrcnt)[2] = 251 + atp_readb_io(dev, c, 0x12); 252 + ((unsigned char *) &adrcnt)[1] = 253 + atp_readb_io(dev, c, 0x13); 254 + ((unsigned char *) &adrcnt)[0] = 255 + atp_readb_io(dev, c, 0x14); 262 256 k = dev->id[c][target_id].last_len; 263 257 k -= adrcnt; 264 258 dev->id[c][target_id].tran_len = k; ··· 274 262 275 263 if (is885(dev)) { 276 264 if ((i == 0x4c) || (i == 0x4d) || (i == 0x8c) || (i == 0x8d)) { 277 - if ((i == 0x4c) || (i == 0x8c)) 278 - i=0x48; 279 - else 280 - i=0x49; 281 - } 282 - 265 + if ((i == 0x4c) || (i == 0x8c)) 266 + i=0x48; 267 + else 268 + i=0x49; 269 + } 283 270 } 284 271 if ((i == 0x80) || (i == 0x8f)) { 285 272 #ifdef ED_DBGP 286 273 printk(KERN_DEBUG "Device reselect\n"); 287 - #endif 274 + #endif 288 275 lun = 0; 289 276 if (cmdp == 0x44 || i == 0x80) 290 277 lun = atp_readb_io(dev, c, 0x1d) & 0x07; ··· 294 283 if (cmdp == 0x41) { 295 284 #ifdef ED_DBGP 296 285 printk("cmdp = 0x41\n"); 297 - #endif 286 + #endif 298 287 adrcnt = 0; 299 - ((unsigned char *) &adrcnt)[2] = atp_readb_io(dev, c, 0x12); 300 - ((unsigned char *) &adrcnt)[1] = atp_readb_io(dev, c, 0x13); 301 - ((unsigned char *) &adrcnt)[0] = atp_readb_io(dev, c, 0x14); 288 + ((unsigned char *) &adrcnt)[2] = 289 + atp_readb_io(dev, c, 0x12); 290 + ((unsigned char *) &adrcnt)[1] = 291 + atp_readb_io(dev, c, 0x13); 292 + ((unsigned char *) &adrcnt)[0] = 293 + atp_readb_io(dev, c, 0x14); 302 294 k = dev->id[c][target_id].last_len; 303 295 k -= adrcnt; 304 296 dev->id[c][target_id].tran_len = k; ··· 312 298 } else { 313 299 #ifdef ED_DBGP 314 300 printk("cmdp != 0x41\n"); 315 - #endif 301 + #endif 316 302 atp_writeb_io(dev, c, 0x10, 0x46); 317 303 dev->id[c][target_id].dirct = 0x00; 318 304 atp_writeb_io(dev, c, 0x12, 0x00); ··· 344 330 if (is885(dev)) 345 331 atp_writeb_io(dev, c, 0x10, 0x45); 346 332 workreq = dev->id[c][target_id].curr_req; 347 - #ifdef ED_DBGP 333 + #ifdef ED_DBGP 348 334 scmd_printk(KERN_DEBUG, workreq, "CDB"); 349 335 for (l = 0; l < workreq->cmd_len; l++) 350 336 printk(KERN_DEBUG " %x",workreq->cmnd[l]); 351 337 printk("\n"); 352 - #endif 353 - 338 + #endif 339 + 354 340 atp_writeb_io(dev, c, 0x0f, lun); 355 341 atp_writeb_io(dev, c, 0x11, dev->id[c][target_id].devsp); 356 342 adrcnt = dev->id[c][target_id].tran_len; ··· 359 345 atp_writeb_io(dev, c, 0x12, ((unsigned char *) &k)[2]); 360 346 atp_writeb_io(dev, c, 0x13, ((unsigned char *) &k)[1]); 361 347 atp_writeb_io(dev, c, 0x14, ((unsigned char *) &k)[0]); 362 - #ifdef ED_DBGP 363 - printk("k %x, k[0] 0x%x k[1] 0x%x k[2] 0x%x\n", k, atp_readb_io(dev, c, 0x14), atp_readb_io(dev, c, 0x13), atp_readb_io(dev, c, 0x12)); 364 - #endif 348 + #ifdef ED_DBGP 349 + printk("k %x, k[0] 0x%x k[1] 0x%x k[2] 0x%x\n", k, 350 + atp_readb_io(dev, c, 0x14), 351 + atp_readb_io(dev, c, 0x13), 352 + atp_readb_io(dev, c, 0x12)); 353 + #endif 365 354 /* Remap wide */ 366 355 j = target_id; 367 356 if (target_id > 7) { ··· 374 357 j |= dev->id[c][target_id].dirct; 375 358 atp_writeb_io(dev, c, 0x15, j); 376 359 atp_writeb_io(dev, c, 0x16, 0x80); 377 - 378 - /* enable 32 bit fifo transfer */ 360 + 361 + /* enable 32 bit fifo transfer */ 379 362 if (is885(dev)) { 380 363 i = atp_readb_pci(dev, c, 1) & 0xf3; 381 - //j=workreq->cmnd[0]; 382 - if ((workreq->cmnd[0] == 0x08) || (workreq->cmnd[0] == 0x28) || (workreq->cmnd[0] == 0x0a) || (workreq->cmnd[0] == 0x2a)) { 364 + //j=workreq->cmnd[0]; 365 + if ((workreq->cmnd[0] == 0x08) || 366 + (workreq->cmnd[0] == 0x28) || 367 + (workreq->cmnd[0] == 0x0a) || 368 + (workreq->cmnd[0] == 0x2a)) { 383 369 i |= 0x0c; 384 370 } 385 371 atp_writeb_pci(dev, c, 1, i); 386 372 } else if (is880(dev)) { 387 - if ((workreq->cmnd[0] == 0x08) || (workreq->cmnd[0] == 0x28) || (workreq->cmnd[0] == 0x0a) || (workreq->cmnd[0] == 0x2a)) 388 - atp_writeb_base(dev, 0x3b, (atp_readb_base(dev, 0x3b) & 0x3f) | 0xc0); 373 + if ((workreq->cmnd[0] == 0x08) || 374 + (workreq->cmnd[0] == 0x28) || 375 + (workreq->cmnd[0] == 0x0a) || 376 + (workreq->cmnd[0] == 0x2a)) 377 + atp_writeb_base(dev, 0x3b, 378 + (atp_readb_base(dev, 0x3b) & 0x3f) | 0xc0); 389 379 else 390 - atp_writeb_base(dev, 0x3b, atp_readb_base(dev, 0x3b) & 0x3f); 391 - } else { 392 - if ((workreq->cmnd[0] == 0x08) || (workreq->cmnd[0] == 0x28) || (workreq->cmnd[0] == 0x0a) || (workreq->cmnd[0] == 0x2a)) 393 - atp_writeb_base(dev, 0x3a, (atp_readb_base(dev, 0x3a) & 0xf3) | 0x08); 380 + atp_writeb_base(dev, 0x3b, 381 + atp_readb_base(dev, 0x3b) & 0x3f); 382 + } else { 383 + if ((workreq->cmnd[0] == 0x08) || 384 + (workreq->cmnd[0] == 0x28) || 385 + (workreq->cmnd[0] == 0x0a) || 386 + (workreq->cmnd[0] == 0x2a)) 387 + atp_writeb_base(dev, 0x3a, 388 + (atp_readb_base(dev, 0x3a) & 0xf3) | 0x08); 394 389 else 395 - atp_writeb_base(dev, 0x3a, atp_readb_base(dev, 0x3a) & 0xf3); 396 - } 390 + atp_writeb_base(dev, 0x3a, 391 + atp_readb_base(dev, 0x3a) & 0xf3); 392 + } 397 393 j = 0; 398 394 id = 1; 399 395 id = id << target_id; ··· 424 394 dev->in_int[c] = 0; 425 395 #ifdef ED_DBGP 426 396 printk("dev->id[c][target_id].last_len = 0\n"); 427 - #endif 397 + #endif 428 398 return IRQ_HANDLED; 429 399 } 430 400 #ifdef ED_DBGP 431 401 printk("target_id = %d adrcnt = %d\n",target_id,adrcnt); 432 - #endif 402 + #endif 433 403 prd = dev->id[c][target_id].prd_pos; 434 404 while (adrcnt != 0) { 435 405 id = ((unsigned short int *)prd)[2]; ··· 439 409 k = id; 440 410 } 441 411 if (k > adrcnt) { 442 - ((unsigned short int *)prd)[2] = (unsigned short int) 443 - (k - adrcnt); 412 + ((unsigned short int *)prd)[2] = 413 + (unsigned short int)(k - adrcnt); 444 414 ((unsigned long *)prd)[0] += adrcnt; 445 415 adrcnt = 0; 446 416 dev->id[c][target_id].prd_pos = prd; ··· 451 421 if (adrcnt == 0) { 452 422 dev->id[c][target_id].prd_pos = prd; 453 423 } 454 - } 424 + } 455 425 } 456 426 atp_writel_pci(dev, c, 0x04, dev->id[c][target_id].prdaddr); 457 427 #ifdef ED_DBGP 458 - printk("dev->id[%d][%d].prdaddr 0x%8x\n", c, target_id, dev->id[c][target_id].prdaddr); 428 + printk("dev->id[%d][%d].prdaddr 0x%8x\n", 429 + c, target_id, dev->id[c][target_id].prdaddr); 459 430 #endif 460 431 if (!is885(dev)) { 461 432 atp_writeb_pci(dev, c, 2, 0x06); ··· 471 440 dev->in_int[c] = 0; 472 441 #ifdef ED_DBGP 473 442 printk("status 0x80 return dirct != 0\n"); 474 - #endif 443 + #endif 475 444 return IRQ_HANDLED; 476 445 } 477 446 atp_writeb_io(dev, c, 0x18, 0x08); ··· 479 448 dev->in_int[c] = 0; 480 449 #ifdef ED_DBGP 481 450 printk("status 0x80 return dirct = 0\n"); 482 - #endif 451 + #endif 483 452 return IRQ_HANDLED; 484 453 } 485 454 ··· 515 484 (*workreq->scsi_done) (workreq); 516 485 #ifdef ED_DBGP 517 486 printk("workreq->scsi_done\n"); 518 - #endif 487 + #endif 519 488 /* 520 489 * Clear it off the queue 521 490 */ ··· 529 498 atp_writeb_io(dev, c, 0x1b, 0x01); 530 499 while ((atp_readb_io(dev, c, 0x1b) & 0x01) != 0x01) 531 500 atp_writeb_io(dev, c, 0x1b, 0x01); 532 - } 501 + } 533 502 /* 534 503 * If there is stuff to send and nothing going then send it 535 504 */ 536 505 spin_lock_irqsave(dev->host->host_lock, flags); 537 - if (((dev->last_cmd[c] != 0xff) || (dev->quhd[c] != dev->quend[c])) && 506 + if (((dev->last_cmd[c] != 0xff) || 507 + (dev->quhd[c] != dev->quend[c])) && 538 508 (dev->in_snd[c] == 0)) { 539 509 #ifdef ED_DBGP 540 510 printk("Call sent_s870(scsi_done)\n"); 541 - #endif 511 + #endif 542 512 send_s870(dev,c); 543 513 } 544 514 spin_unlock_irqrestore(dev->host->host_lock, flags); ··· 560 528 atp_writeb_io(dev, c, 0x10, 0x41); 561 529 if (is885(dev)) { 562 530 k = dev->id[c][target_id].last_len; 563 - atp_writeb_io(dev, c, 0x12, ((unsigned char *) (&k))[2]); 564 - atp_writeb_io(dev, c, 0x13, ((unsigned char *) (&k))[1]); 565 - atp_writeb_io(dev, c, 0x14, ((unsigned char *) (&k))[0]); 531 + atp_writeb_io(dev, c, 0x12, 532 + ((unsigned char *) (&k))[2]); 533 + atp_writeb_io(dev, c, 0x13, 534 + ((unsigned char *) (&k))[1]); 535 + atp_writeb_io(dev, c, 0x14, 536 + ((unsigned char *) (&k))[0]); 566 537 dev->id[c][target_id].dirct = 0x00; 567 538 } else { 568 539 dev->id[c][target_id].dirct = 0x00; ··· 582 547 atp_writeb_io(dev, c, 0x10, 0x41); 583 548 if (is885(dev)) { 584 549 k = dev->id[c][target_id].last_len; 585 - atp_writeb_io(dev, c, 0x12, ((unsigned char *) (&k))[2]); 586 - atp_writeb_io(dev, c, 0x13, ((unsigned char *) (&k))[1]); 587 - atp_writeb_io(dev, c, 0x14, ((unsigned char *) (&k))[0]); 550 + atp_writeb_io(dev, c, 0x12, 551 + ((unsigned char *) (&k))[2]); 552 + atp_writeb_io(dev, c, 0x13, 553 + ((unsigned char *) (&k))[1]); 554 + atp_writeb_io(dev, c, 0x14, 555 + ((unsigned char *) (&k))[0]); 588 556 } 589 - atp_writeb_io(dev, c, 0x15, atp_readb_io(dev, c, 0x15) | 0x20); 557 + atp_writeb_io(dev, c, 0x15, 558 + atp_readb_io(dev, c, 0x15) | 0x20); 590 559 dev->id[c][target_id].dirct = 0x20; 591 560 atp_writeb_io(dev, c, 0x18, 0x08); 592 561 atp_writeb_pci(dev, c, 0, 0x01); ··· 632 593 if (scmd_channel(req_p) > 1) { 633 594 req_p->result = 0x00040000; 634 595 done(req_p); 635 - #ifdef ED_DBGP 636 - printk("atp870u_queuecommand : req_p->device->channel > 1\n"); 637 - #endif 596 + #ifdef ED_DBGP 597 + printk("atp870u_queuecommand : req_p->device->channel > 1\n"); 598 + #endif 638 599 return 0; 639 600 } 640 601 641 602 host = req_p->device->host; 642 603 dev = (struct atp_unit *)&host->hostdata; 643 - 644 604 645 - 646 605 m = 1; 647 606 m = m << scmd_id(req_p); 648 607 ··· 657 620 if (done) { 658 621 req_p->scsi_done = done; 659 622 } else { 660 - #ifdef ED_DBGP 623 + #ifdef ED_DBGP 661 624 printk( "atp870u_queuecommand: done can't be NULL\n"); 662 - #endif 625 + #endif 663 626 req_p->result = 0; 664 627 done(req_p); 665 628 return 0; 666 629 } 667 - 630 + 668 631 /* 669 632 * Count new command 670 633 */ ··· 672 635 if (dev->quend[c] >= qcnt) { 673 636 dev->quend[c] = 0; 674 637 } 675 - 638 + 676 639 /* 677 640 * Check queue state 678 641 */ ··· 680 643 if (dev->quend[c] == 0) { 681 644 dev->quend[c] = qcnt; 682 645 } 683 - #ifdef ED_DBGP 646 + #ifdef ED_DBGP 684 647 printk("atp870u_queuecommand : dev->quhd[c] == dev->quend[c]\n"); 685 - #endif 648 + #endif 686 649 dev->quend[c]--; 687 650 req_p->result = 0x00020000; 688 - done(req_p); 651 + done(req_p); 689 652 return 0; 690 653 } 691 654 dev->quereq[c][dev->quend[c]] = req_p; 692 - #ifdef ED_DBGP 693 - printk("dev->ioport[c] = %x atp_readb_io(dev, c, 0x1c) = %x dev->in_int[%d] = %d dev->in_snd[%d] = %d\n",dev->ioport[c],atp_readb_io(dev, c, 0x1c),c,dev->in_int[c],c,dev->in_snd[c]); 655 + #ifdef ED_DBGP 656 + printk("dev->ioport[c] = %x atp_readb_io(dev, c, 0x1c) = %x " 657 + "dev->in_int[%d] = %d dev->in_snd[%d] = %d\n", 658 + dev->ioport[c], atp_readb_io(dev, c, 0x1c), c, 659 + dev->in_int[c],c,dev->in_snd[c]); 694 660 #endif 695 - if ((atp_readb_io(dev, c, 0x1c) == 0) && (dev->in_int[c] == 0) && (dev->in_snd[c] == 0)) { 661 + if ((atp_readb_io(dev, c, 0x1c) == 0) && 662 + (dev->in_int[c] == 0) && 663 + (dev->in_snd[c] == 0)) { 696 664 #ifdef ED_DBGP 697 665 printk("Call sent_s870(atp870u_queuecommand)\n"); 698 - #endif 666 + #endif 699 667 send_s870(dev,c); 700 668 } 701 - #ifdef ED_DBGP 669 + #ifdef ED_DBGP 702 670 printk("atp870u_queuecommand : exit\n"); 703 - #endif 671 + #endif 704 672 return 0; 705 673 } 706 674 ··· 716 674 * @host: host 717 675 * 718 676 * On entry there is work queued to be done. We move some of that work to the 719 - * controller itself. 677 + * controller itself. 720 678 * 721 679 * Caller holds the host lock. 722 680 */ ··· 731 689 unsigned long sg_count; 732 690 733 691 if (dev->in_snd[c] != 0) { 734 - #ifdef ED_DBGP 692 + #ifdef ED_DBGP 735 693 printk("cmnd in_snd\n"); 736 694 #endif 737 695 return; ··· 771 729 dev->id[c][scmd_id(workreq)].curr_req = workreq; 772 730 dev->last_cmd[c] = scmd_id(workreq); 773 731 } 774 - if ((atp_readb_io(dev, c, 0x1f) & 0xb0) != 0 || atp_readb_io(dev, c, 0x1c) != 0) { 732 + if ((atp_readb_io(dev, c, 0x1f) & 0xb0) != 0 || 733 + atp_readb_io(dev, c, 0x1c) != 0) { 775 734 #ifdef ED_DBGP 776 735 printk("Abort to Send\n"); 777 736 #endif ··· 787 744 printk(" %x",workreq->cmnd[i]); 788 745 } 789 746 printk("\n"); 790 - #endif 747 + #endif 791 748 l = scsi_bufflen(workreq); 792 749 793 750 if (is885(dev)) { ··· 795 752 atp_writeb_base(dev, 0x29, j); 796 753 dev->r1f[c][scmd_id(workreq)] = 0; 797 754 } 798 - 755 + 799 756 if (workreq->cmnd[0] == READ_CAPACITY) { 800 757 if (l > 8) 801 758 l = 8; ··· 839 796 * Write the target 840 797 */ 841 798 atp_writeb_io(dev, c, 0x11, dev->id[c][target_id].devsp); 842 - #ifdef ED_DBGP 843 - printk("dev->id[%d][%d].devsp = %2x\n",c,target_id,dev->id[c][target_id].devsp); 799 + #ifdef ED_DBGP 800 + printk("dev->id[%d][%d].devsp = %2x\n",c,target_id, 801 + dev->id[c][target_id].devsp); 844 802 #endif 845 803 846 804 sg_count = scsi_dma_map(workreq); ··· 851 807 atp_writeb_io(dev, c, 0x12, ((unsigned char *) (&l))[2]); 852 808 atp_writeb_io(dev, c, 0x13, ((unsigned char *) (&l))[1]); 853 809 atp_writeb_io(dev, c, 0x14, ((unsigned char *) (&l))[0]); 854 - j = target_id; 810 + j = target_id; 855 811 dev->id[c][j].last_len = l; 856 812 dev->id[c][j].tran_len = 0; 857 - #ifdef ED_DBGP 813 + #ifdef ED_DBGP 858 814 printk("dev->id[%2d][%2d].last_len = %d\n",c,j,dev->id[c][j].last_len); 859 - #endif 815 + #endif 860 816 /* 861 817 * Flip the wide bits 862 818 */ ··· 876 832 if (l == 0) { 877 833 if (atp_readb_io(dev, c, 0x1c) == 0) { 878 834 #ifdef ED_DBGP 879 - printk("change SCSI_CMD_REG 0x08\n"); 880 - #endif 835 + printk("change SCSI_CMD_REG 0x08\n"); 836 + #endif 881 837 atp_writeb_io(dev, c, 0x18, 0x08); 882 838 } else 883 839 dev->last_cmd[c] |= 0x40; ··· 898 854 scsi_for_each_sg(workreq, sgpnt, sg_count, j) { 899 855 bttl = sg_dma_address(sgpnt); 900 856 l=sg_dma_len(sgpnt); 901 - #ifdef ED_DBGP 857 + #ifdef ED_DBGP 902 858 printk("1. bttl %x, l %x\n",bttl, l); 903 - #endif 859 + #endif 904 860 while (l > 0x10000) { 905 861 (((u16 *) (prd))[i + 3]) = 0x0000; 906 862 (((u16 *) (prd))[i + 2]) = 0x0000; ··· 912 868 (((u32 *) (prd))[i >> 1]) = cpu_to_le32(bttl); 913 869 (((u16 *) (prd))[i + 2]) = cpu_to_le16(l); 914 870 (((u16 *) (prd))[i + 3]) = 0; 915 - i += 0x04; 871 + i += 0x04; 916 872 } 917 - (((u16 *) (prd))[i - 1]) = cpu_to_le16(0x8000); 918 - #ifdef ED_DBGP 919 - printk("prd %4x %4x %4x %4x\n",(((unsigned short int *)prd)[0]),(((unsigned short int *)prd)[1]),(((unsigned short int *)prd)[2]),(((unsigned short int *)prd)[3])); 873 + (((u16 *) (prd))[i - 1]) = cpu_to_le16(0x8000); 874 + #ifdef ED_DBGP 875 + printk("prd %4x %4x %4x %4x\n", 876 + (((unsigned short int *)prd)[0]), 877 + (((unsigned short int *)prd)[1]), 878 + (((unsigned short int *)prd)[2]), 879 + (((unsigned short int *)prd)[3])); 920 880 printk("2. bttl %x, l %x\n",bttl, l); 921 - #endif 881 + #endif 922 882 } 923 - #ifdef ED_DBGP 924 - printk("send_s870: prdaddr_2 0x%8x target_id %d\n", dev->id[c][target_id].prdaddr,target_id); 925 - #endif 883 + #ifdef ED_DBGP 884 + printk("send_s870: prdaddr_2 0x%8x target_id %d\n", 885 + dev->id[c][target_id].prdaddr,target_id); 886 + #endif 926 887 dev->id[c][target_id].prdaddr = dev->id[c][target_id].prd_bus; 927 888 atp_writel_pci(dev, c, 4, dev->id[c][target_id].prdaddr); 928 889 atp_writeb_pci(dev, c, 2, 0x06); ··· 935 886 if (is885(dev)) { 936 887 j = atp_readb_pci(dev, c, 1) & 0xf3; 937 888 if ((workreq->cmnd[0] == 0x08) || (workreq->cmnd[0] == 0x28) || 938 - (workreq->cmnd[0] == 0x0a) || (workreq->cmnd[0] == 0x2a)) { 939 - j |= 0x0c; 889 + (workreq->cmnd[0] == 0x0a) || (workreq->cmnd[0] == 0x2a)) { 890 + j |= 0x0c; 940 891 } 941 892 atp_writeb_pci(dev, c, 1, j); 942 893 } else if (is880(dev)) { 943 - if ((workreq->cmnd[0] == 0x08) || (workreq->cmnd[0] == 0x28) || (workreq->cmnd[0] == 0x0a) || (workreq->cmnd[0] == 0x2a)) 944 - atp_writeb_base(dev, 0x3b, (atp_readb_base(dev, 0x3b) & 0x3f) | 0xc0); 894 + if ((workreq->cmnd[0] == 0x08) || (workreq->cmnd[0] == 0x28) || 895 + (workreq->cmnd[0] == 0x0a) || (workreq->cmnd[0] == 0x2a)) 896 + atp_writeb_base(dev, 0x3b, 897 + (atp_readb_base(dev, 0x3b) & 0x3f) | 0xc0); 945 898 else 946 - atp_writeb_base(dev, 0x3b, atp_readb_base(dev, 0x3b) & 0x3f); 947 - } else { 948 - if ((workreq->cmnd[0] == 0x08) || (workreq->cmnd[0] == 0x28) || (workreq->cmnd[0] == 0x0a) || (workreq->cmnd[0] == 0x2a)) 949 - atp_writeb_base(dev, 0x3a, (atp_readb_base(dev, 0x3a) & 0xf3) | 0x08); 899 + atp_writeb_base(dev, 0x3b, 900 + atp_readb_base(dev, 0x3b) & 0x3f); 901 + } else { 902 + if ((workreq->cmnd[0] == 0x08) || (workreq->cmnd[0] == 0x28) || 903 + (workreq->cmnd[0] == 0x0a) || (workreq->cmnd[0] == 0x2a)) 904 + atp_writeb_base(dev, 0x3a, 905 + (atp_readb_base(dev, 0x3a) & 0xf3) | 0x08); 950 906 else 951 - atp_writeb_base(dev, 0x3a, atp_readb_base(dev, 0x3a) & 0xf3); 952 - } 907 + atp_writeb_base(dev, 0x3a, 908 + atp_readb_base(dev, 0x3a) & 0xf3); 909 + } 953 910 954 911 if(workreq->sc_data_direction == DMA_TO_DEVICE) { 955 912 dev->id[c][target_id].dirct = 0x20; 956 913 if (atp_readb_io(dev, c, 0x1c) == 0) { 957 914 atp_writeb_io(dev, c, 0x18, 0x08); 958 915 atp_writeb_pci(dev, c, 0, 0x01); 959 - #ifdef ED_DBGP 916 + #ifdef ED_DBGP 960 917 printk( "start DMA(to target)\n"); 961 - #endif 918 + #endif 962 919 } else { 963 920 dev->last_cmd[c] |= 0x40; 964 921 } ··· 974 919 if (atp_readb_io(dev, c, 0x1c) == 0) { 975 920 atp_writeb_io(dev, c, 0x18, 0x08); 976 921 atp_writeb_pci(dev, c, 0, 0x09); 977 - #ifdef ED_DBGP 922 + #ifdef ED_DBGP 978 923 printk( "start DMA(to host)\n"); 979 - #endif 924 + #endif 980 925 } else { 981 926 dev->last_cmd[c] |= 0x40; 982 927 } ··· 1248 1193 for (k = 0; k < 16; k++) { 1249 1194 if (!atp_dev->id[j][k].prd_table) 1250 1195 continue; 1251 - dma_free_coherent(&atp_dev->pdev->dev, 1024, atp_dev->id[j][k].prd_table, atp_dev->id[j][k].prd_bus); 1196 + dma_free_coherent(&atp_dev->pdev->dev, 1024, 1197 + atp_dev->id[j][k].prd_table, 1198 + atp_dev->id[j][k].prd_bus); 1252 1199 atp_dev->id[j][k].prd_table = NULL; 1253 1200 } 1254 1201 } ··· 1261 1204 struct atp_unit *atp_dev = (struct atp_unit *)&host->hostdata; 1262 1205 int c,k; 1263 1206 for(c=0;c < 2;c++) { 1264 - for(k=0;k<16;k++) { 1265 - atp_dev->id[c][k].prd_table = dma_alloc_coherent(&atp_dev->pdev->dev, 1024, &(atp_dev->id[c][k].prd_bus), GFP_KERNEL); 1266 - if (!atp_dev->id[c][k].prd_table) { 1267 - printk("atp870u_init_tables fail\n"); 1207 + for(k=0;k<16;k++) { 1208 + atp_dev->id[c][k].prd_table = 1209 + dma_alloc_coherent(&atp_dev->pdev->dev, 1024, 1210 + &(atp_dev->id[c][k].prd_bus), 1211 + GFP_KERNEL); 1212 + if (!atp_dev->id[c][k].prd_table) { 1213 + printk("atp870u_init_tables fail\n"); 1268 1214 atp870u_free_tables(host); 1269 1215 return -ENOMEM; 1270 1216 } 1271 1217 atp_dev->id[c][k].prdaddr = atp_dev->id[c][k].prd_bus; 1272 1218 atp_dev->id[c][k].devsp=0x20; 1273 1219 atp_dev->id[c][k].devtype = 0x7f; 1274 - atp_dev->id[c][k].curr_req = NULL; 1275 - } 1276 - 1277 - atp_dev->active_id[c] = 0; 1278 - atp_dev->wide_id[c] = 0; 1279 - atp_dev->host_id[c] = 0x07; 1280 - atp_dev->quhd[c] = 0; 1281 - atp_dev->quend[c] = 0; 1282 - atp_dev->last_cmd[c] = 0xff; 1283 - atp_dev->in_snd[c] = 0; 1284 - atp_dev->in_int[c] = 0; 1285 - 1286 - for (k = 0; k < qcnt; k++) { 1287 - atp_dev->quereq[c][k] = NULL; 1288 - } 1289 - for (k = 0; k < 16; k++) { 1220 + atp_dev->id[c][k].curr_req = NULL; 1221 + } 1222 + 1223 + atp_dev->active_id[c] = 0; 1224 + atp_dev->wide_id[c] = 0; 1225 + atp_dev->host_id[c] = 0x07; 1226 + atp_dev->quhd[c] = 0; 1227 + atp_dev->quend[c] = 0; 1228 + atp_dev->last_cmd[c] = 0xff; 1229 + atp_dev->in_snd[c] = 0; 1230 + atp_dev->in_int[c] = 0; 1231 + 1232 + for (k = 0; k < qcnt; k++) { 1233 + atp_dev->quereq[c][k] = NULL; 1234 + } 1235 + for (k = 0; k < 16; k++) { 1290 1236 atp_dev->id[c][k].curr_req = NULL; 1291 1237 atp_dev->sp[c][k] = 0x04; 1292 - } 1238 + } 1293 1239 } 1294 1240 return 0; 1295 1241 } ··· 1323 1263 1324 1264 pci_read_config_byte(pdev, 0x49, &host_id); 1325 1265 1326 - dev_info(&pdev->dev, "ACARD AEC-671X PCI Ultra/W SCSI-2/3 Host Adapter: IO:%lx, IRQ:%d.\n", 1266 + dev_info(&pdev->dev, "ACARD AEC-671X PCI Ultra/W SCSI-2/3 " 1267 + "Host Adapter: IO:%lx, IRQ:%d.\n", 1327 1268 shpnt->io_port, shpnt->irq); 1328 1269 1329 1270 atpdev->ioport[0] = shpnt->io_port; ··· 1375 1314 1376 1315 host_id = atp_readb_base(atpdev, 0x39) >> 4; 1377 1316 1378 - dev_info(&pdev->dev, "ACARD AEC-67160 PCI Ultra3 LVD Host Adapter: IO:%lx, IRQ:%d.\n", 1317 + dev_info(&pdev->dev, "ACARD AEC-67160 PCI Ultra3 LVD " 1318 + "Host Adapter: IO:%lx, IRQ:%d.\n", 1379 1319 shpnt->io_port, shpnt->irq); 1380 1320 atpdev->host_id[0] = host_id; 1381 1321 ··· 1455 1393 unsigned int n; 1456 1394 unsigned char setupdata[2][16]; 1457 1395 1458 - dev_info(&pdev->dev, "ACARD AEC-67162 PCI Ultra3 LVD Host Adapter: IO:%lx, IRQ:%d.\n", 1396 + dev_info(&pdev->dev, "ACARD AEC-67162 PCI Ultra3 LVD " 1397 + "Host Adapter: IO:%lx, IRQ:%d.\n", 1459 1398 shpnt->io_port, shpnt->irq); 1460 1399 1461 1400 atpdev->ioport[0] = shpnt->io_port + 0x80; ··· 1476 1413 atpdev->global_map[m] = 0; 1477 1414 for (k = 0; k < 4; k++) { 1478 1415 atp_writew_base(atpdev, 0x3c, n++); 1479 - ((u32 *)&setupdata[m][0])[k] = atp_readl_base(atpdev, 0x38); 1416 + ((u32 *)&setupdata[m][0])[k] = 1417 + atp_readl_base(atpdev, 0x38); 1480 1418 } 1481 1419 for (k = 0; k < 4; k++) { 1482 1420 atp_writew_base(atpdev, 0x3c, n++); 1483 - ((u32 *)&atpdev->sp[m][0])[k] = atp_readl_base(atpdev, 0x38); 1421 + ((u32 *)&atpdev->sp[m][0])[k] = 1422 + atp_readl_base(atpdev, 0x38); 1484 1423 } 1485 1424 n += 8; 1486 1425 } ··· 1575 1510 goto fail; 1576 1511 1577 1512 if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(32))) { 1578 - printk(KERN_ERR "atp870u: DMA mask required but not available.\n"); 1579 - err = -EIO; 1580 - goto disable_device; 1581 - } 1513 + printk(KERN_ERR "atp870u: DMA mask required but not available.\n"); 1514 + err = -EIO; 1515 + goto disable_device; 1516 + } 1582 1517 1583 1518 err = pci_request_regions(pdev, "atp870u"); 1584 1519 if (err) 1585 1520 goto disable_device; 1586 1521 pci_set_master(pdev); 1587 1522 1588 - err = -ENOMEM; 1523 + err = -ENOMEM; 1589 1524 shpnt = scsi_host_alloc(&atp870u_template, sizeof(struct atp_unit)); 1590 1525 if (!shpnt) 1591 1526 goto release_region; ··· 1651 1586 { 1652 1587 unsigned char j, k, c; 1653 1588 struct scsi_cmnd *workrequ; 1654 - struct atp_unit *dev; 1589 + struct atp_unit *dev; 1655 1590 struct Scsi_Host *host; 1656 1591 host = SCpnt->device->host; 1657 1592 ··· 1720 1655 } 1721 1656 1722 1657 static void atp870u_remove (struct pci_dev *pdev) 1723 - { 1658 + { 1724 1659 struct atp_unit *devext = pci_get_drvdata(pdev); 1725 1660 struct Scsi_Host *pshost = devext->host; 1726 - 1727 - 1661 + 1728 1662 scsi_remove_host(pshost); 1729 1663 free_irq(pshost->irq, pshost); 1730 1664 pci_release_regions(pdev); ··· 1735 1671 1736 1672 static struct scsi_host_template atp870u_template = { 1737 1673 .module = THIS_MODULE, 1738 - .name = "atp870u" /* name */, 1674 + .name = "atp870u" /* name */, 1739 1675 .proc_name = "atp870u", 1740 1676 .show_info = atp870u_show_info, 1741 - .info = atp870u_info /* info */, 1742 - .queuecommand = atp870u_queuecommand /* queuecommand */, 1743 - .eh_abort_handler = atp870u_abort /* abort */, 1744 - .bios_param = atp870u_biosparam /* biosparm */, 1745 - .can_queue = qcnt /* can_queue */, 1746 - .this_id = 7 /* SCSI ID */, 1747 - .sg_tablesize = ATP870U_SCATTER /*SG_ALL*/, 1677 + .info = atp870u_info /* info */, 1678 + .queuecommand = atp870u_queuecommand /* queuecommand */, 1679 + .eh_abort_handler = atp870u_abort /* abort */, 1680 + .bios_param = atp870u_biosparam /* biosparm */, 1681 + .can_queue = qcnt /* can_queue */, 1682 + .this_id = 7 /* SCSI ID */, 1683 + .sg_tablesize = ATP870U_SCATTER /*SG_ALL*/, 1748 1684 .max_sectors = ATP870U_MAX_SECTORS, 1749 1685 }; 1750 1686 1751 1687 static struct pci_device_id atp870u_id_table[] = { 1752 1688 { PCI_DEVICE(PCI_VENDOR_ID_ARTOP, ATP885_DEVID) }, 1753 - { PCI_DEVICE(PCI_VENDOR_ID_ARTOP, ATP880_DEVID1) }, 1754 - { PCI_DEVICE(PCI_VENDOR_ID_ARTOP, ATP880_DEVID2) }, 1689 + { PCI_DEVICE(PCI_VENDOR_ID_ARTOP, ATP880_DEVID1) }, 1690 + { PCI_DEVICE(PCI_VENDOR_ID_ARTOP, ATP880_DEVID2) }, 1755 1691 { PCI_DEVICE(PCI_VENDOR_ID_ARTOP, PCI_DEVICE_ID_ARTOP_AEC7610) }, 1756 1692 { PCI_DEVICE(PCI_VENDOR_ID_ARTOP, PCI_DEVICE_ID_ARTOP_AEC7612UW) }, 1757 1693 { PCI_DEVICE(PCI_VENDOR_ID_ARTOP, PCI_DEVICE_ID_ARTOP_AEC7612U) }, ··· 1773 1709 1774 1710 module_pci_driver(atp870u_driver); 1775 1711 1776 - static void atp_is(struct atp_unit *dev, unsigned char c, bool wide_chip, unsigned char lvdmode) 1712 + static void atp_is(struct atp_unit *dev, unsigned char c, bool wide_chip, 1713 + unsigned char lvdmode) 1777 1714 { 1778 1715 unsigned char i, j, k, rmb, n; 1779 1716 unsigned short int m; ··· 2047 1982 m = m << i; 2048 1983 dev->wide_id[c] |= m; 2049 1984 dev->id[c][i].devsp = 0xce; 2050 - #ifdef ED_DBGP 2051 - printk("dev->id[%2d][%2d].devsp = %2x\n",c,i,dev->id[c][i].devsp); 1985 + #ifdef ED_DBGP 1986 + printk("dev->id[%2d][%2d].devsp = %2x\n", 1987 + c, i, dev->id[c][i].devsp); 2052 1988 #endif 2053 1989 continue; 2054 1990 } ··· 2071 2005 while ((atp_readb_io(dev, c, 0x1f) & 0x80) == 0x00) 2072 2006 cpu_relax(); 2073 2007 2074 - if (atp_readb_io(dev, c, 0x17) != 0x11 && atp_readb_io(dev, c, 0x17) != 0x8e) 2008 + if (atp_readb_io(dev, c, 0x17) != 0x11 && 2009 + atp_readb_io(dev, c, 0x17) != 0x8e) 2075 2010 continue; 2076 2011 2077 2012 while (atp_readb_io(dev, c, 0x17) != 0x8e) ··· 2176 2109 m = m << i; 2177 2110 dev->wide_id[c] |= m; 2178 2111 not_wide: 2179 - if ((dev->id[c][i].devtype == 0x00) || (dev->id[c][i].devtype == 0x07) || ((dev->id[c][i].devtype == 0x05) && ((n & 0x10) != 0))) { 2112 + if ((dev->id[c][i].devtype == 0x00) || 2113 + (dev->id[c][i].devtype == 0x07) || 2114 + ((dev->id[c][i].devtype == 0x05) && ((n & 0x10) != 0))) { 2180 2115 m = 1; 2181 2116 m = m << i; 2182 2117 if ((dev->async[c] & m) != 0) { ··· 2217 2148 while ((atp_readb_io(dev, c, 0x1f) & 0x80) == 0x00) 2218 2149 cpu_relax(); 2219 2150 2220 - if (atp_readb_io(dev, c, 0x17) != 0x11 && atp_readb_io(dev, c, 0x17) != 0x8e) 2151 + if (atp_readb_io(dev, c, 0x17) != 0x11 && 2152 + atp_readb_io(dev, c, 0x17) != 0x8e) 2221 2153 continue; 2222 2154 2223 2155 while (atp_readb_io(dev, c, 0x17) != 0x8e) ··· 2380 2310 set_syn_ok: 2381 2311 dev->id[c][i].devsp = (dev->id[c][i].devsp & 0x0f) | j; 2382 2312 #ifdef ED_DBGP 2383 - printk("dev->id[%2d][%2d].devsp = %2x\n",c,i,dev->id[c][i].devsp); 2313 + printk("dev->id[%2d][%2d].devsp = %2x\n", 2314 + c,i,dev->id[c][i].devsp); 2384 2315 #endif 2385 2316 } 2386 2317 }
+7 -7
drivers/scsi/atp870u.h
··· 7 7 8 8 /* I/O Port */ 9 9 10 - #define MAX_CDB 12 11 - #define MAX_SENSE 14 12 - #define qcnt 32 13 - #define ATP870U_SCATTER 128 10 + #define MAX_CDB 12 11 + #define MAX_SENSE 14 12 + #define qcnt 32 13 + #define ATP870U_SCATTER 128 14 14 15 15 #define MAX_ADAPTER 8 16 16 #define MAX_SCSI_ID 16 ··· 40 40 unsigned short ultra_map[2]; 41 41 unsigned short async[2]; 42 42 unsigned char sp[2][16]; 43 - unsigned char r1f[2][16]; 43 + unsigned char r1f[2][16]; 44 44 struct scsi_cmnd *quereq[2][qcnt]; 45 45 struct atp_id 46 46 { ··· 55 55 dma_addr_t prdaddr; /* Dynamically updated in driver */ 56 56 struct scsi_cmnd *curr_req; 57 57 } id[2][16]; 58 - struct Scsi_Host *host; 59 - struct pci_dev *pdev; 58 + struct Scsi_Host *host; 59 + struct pci_dev *pdev; 60 60 unsigned int unit; 61 61 }; 62 62