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

[SCSI] aic7xxx: fix the BIOS limits setting routines

Following the go around over the SONY DVD that needs artificial limits,
this should be the correct code for all cases (minus the debugging
prints).

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>

authored by

James Bottomley and committed by
James Bottomley
12021fff d736a27b

+27 -12
+27 -12
drivers/scsi/aic7xxx/aic7xxx_osm.c
··· 621 621 memset(targ, 0, sizeof(*targ)); 622 622 623 623 if (sc) { 624 - if ((ahc->features & AHC_ULTRA2) != 0) { 625 - scsirate = sc->device_flags[target_offset] & CFXFER; 626 - } else { 627 - scsirate = (sc->device_flags[target_offset] & CFXFER) << 4; 628 - if (sc->device_flags[target_offset] & CFSYNCH) 629 - scsirate |= SOFS; 624 + int maxsync = AHC_SYNCRATE_DT; 625 + int ultra = 0; 626 + int flags = sc->device_flags[target_offset]; 627 + 628 + if (ahc->flags & AHC_NEWEEPROM_FMT) { 629 + if (flags & CFSYNCHISULTRA) 630 + ultra = 1; 631 + } else if (flags & CFULTRAEN) 632 + ultra = 1; 633 + /* AIC nutcase; 10MHz appears as ultra = 1, CFXFER = 0x04 634 + * change it to ultra=0, CFXFER = 0 */ 635 + if(ultra && (flags & CFXFER) == 0x04) { 636 + ultra = 0; 637 + flags &= ~CFXFER; 630 638 } 631 - if (sc->device_flags[target_offset] & CFWIDEB) { 632 - scsirate |= WIDEXFER; 633 - spi_max_width(starget) = 1; 634 - } else 635 - spi_max_width(starget) = 0; 639 + 640 + if ((ahc->features & AHC_ULTRA2) != 0) { 641 + scsirate = (flags & CFXFER) | (ultra ? 0x8 : 0); 642 + } else { 643 + scsirate = (flags & CFXFER) << 4; 644 + maxsync = ultra ? AHC_SYNCRATE_ULTRA : 645 + AHC_SYNCRATE_FAST; 646 + } 647 + spi_max_width(starget) = (flags & CFWIDEB) ? 1 : 0; 648 + if (!(flags & CFSYNCH)) 649 + spi_max_offset(starget) = 0; 636 650 spi_min_period(starget) = 637 - ahc_find_period(ahc, scsirate, AHC_SYNCRATE_DT); 651 + ahc_find_period(ahc, scsirate, maxsync); 652 + 638 653 tinfo = ahc_fetch_transinfo(ahc, channel, ahc->our_id, 639 654 starget->id, &tstate); 640 655 }