Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 12021fff authored by James Bottomley's avatar James Bottomley Committed by James Bottomley
Browse files

[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: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent d736a27b
Loading
Loading
Loading
Loading
+25 −10
Original line number Original line Diff line number Diff line
@@ -621,20 +621,35 @@ ahc_linux_target_alloc(struct scsi_target *starget)
	memset(targ, 0, sizeof(*targ));
	memset(targ, 0, sizeof(*targ));


	if (sc) {
	if (sc) {
		int maxsync = AHC_SYNCRATE_DT;
		int ultra = 0;
		int flags = sc->device_flags[target_offset];

		if (ahc->flags & AHC_NEWEEPROM_FMT) {
		    if (flags & CFSYNCHISULTRA)
			ultra = 1;
		} else if (flags & CFULTRAEN)
			ultra = 1;
		/* AIC nutcase; 10MHz appears as ultra = 1, CFXFER = 0x04
		 * change it to ultra=0, CFXFER = 0 */
		if(ultra && (flags & CFXFER) == 0x04) {
			ultra = 0;
			flags &= ~CFXFER;
		}
	    
		if ((ahc->features & AHC_ULTRA2) != 0) {
		if ((ahc->features & AHC_ULTRA2) != 0) {
			scsirate = sc->device_flags[target_offset] & CFXFER;
			scsirate = (flags & CFXFER) | (ultra ? 0x8 : 0);
		} else {
		} else {
			scsirate = (sc->device_flags[target_offset] & CFXFER) << 4;
			scsirate = (flags & CFXFER) << 4;
			if (sc->device_flags[target_offset] & CFSYNCH)
			maxsync = ultra ? AHC_SYNCRATE_ULTRA : 
				scsirate |= SOFS;
				AHC_SYNCRATE_FAST;
		}
		}
		if (sc->device_flags[target_offset] & CFWIDEB) {
		spi_max_width(starget) = (flags & CFWIDEB) ? 1 : 0;
			scsirate |= WIDEXFER;
		if (!(flags & CFSYNCH))
			spi_max_width(starget) = 1;
			spi_max_offset(starget) = 0;
		} else
			spi_max_width(starget) = 0;
		spi_min_period(starget) = 
		spi_min_period(starget) = 
			ahc_find_period(ahc, scsirate, AHC_SYNCRATE_DT);
			ahc_find_period(ahc, scsirate, maxsync);

		tinfo = ahc_fetch_transinfo(ahc, channel, ahc->our_id,
		tinfo = ahc_fetch_transinfo(ahc, channel, ahc->our_id,
					    starget->id, &tstate);
					    starget->id, &tstate);
	}
	}