kernels/linux-2.4.0/drivers/ide/qd6580.c
/*
 * tune_ide
 *
 * Tunes the whole hwif, ie tunes each drives, and in case we have to share,
 * takes the worse timings to tune qd6580
 */
tune_ide
Tunes the whole hwif, ie tunes each drives, and in case we have to share,
takes the worse timings to tune qd6580
tune_ide Tunes the whole hwif ie tunes each drives and in case we have to share takes the worse timings to tune qd6580
static void tune_ide ( ide_hwif_t *hwif, byte pio )
{
	unsigned long flags;
	ide_hd_timings_t t[2]={{0,0},{0,0}};
	int bus_speed = ide_system_bus_speed ();
	bus_clock = 1000 / bus_speed;
	save_flags(flags);		
	cli();					
	outb( (bus_clock<30) ? 0x0 : 0x0a, basePort + 0x02);
	outb( 0x40 | ((control & 0x02) ? 0x9f:0x1f), basePort+0x03);
	restore_flags(flags);
	tune_drive (&hwif->drives[0], pio, &t[0]);
	tune_drive (&hwif->drives[1], pio, &t[1]);
	if (control & 0x01) { 
		write_reg(compute_timing (hwif->drives[0].name, &t[0]),basePort);
		write_reg(compute_timing (hwif->drives[1].name, &t[1]),basePort+0x02);
	} else {			  
		t[0].active_time   = IDE_MAX(t[0].active_time,  t[1].active_time);
		t[0].recovery_time = IDE_MAX(t[0].recovery_time,t[1].recovery_time);
		write_reg(compute_timing (hwif->name, &t[0]),basePort);
	}
}
static void tune_ide ( ide_hwif_t * hwif , byte pio ) { unsigned long flags ; ide_hd_timings_t t [ 2 ] = { { 0 , 0 } , { 0 , 0 } } ; int bus_speed = ide_system_bus_speed ( ) ; bus_clock = 1000 / bus_speed ; save_flags ( flags ) ; cli ( ) ; outb ( ( bus_clock < 30 ) ? 0x0 : 0x0a , basePort + 0x02 ) ; outb ( 0x40 | ( ( control & 0x02 ) ? 0x9f : 0x1f ) , basePort + 0x03 ) ; restore_flags ( flags ) ; tune_drive ( & hwif -> drives [ 0 ] , pio , & t [ 0 ] ) ; tune_drive ( & hwif -> drives [ 1 ] , pio , & t [ 1 ] ) ; if ( control & 0x01 ) { write_reg ( compute_timing ( hwif -> drives [ 0 ] . name , & t [ 0 ] ) , basePort ) ; write_reg ( compute_timing ( hwif -> drives [ 1 ] . name , & t [ 1 ] ) , basePort + 0x02 ) ; } else { t [ 0 ] . active_time = IDE_MAX ( t [ 0 ] . active_time , t [ 1 ] . active_time ) ; t [ 0 ] . recovery_time = IDE_MAX ( t [ 0 ] . recovery_time , t [ 1 ] . recovery_time ) ; write_reg ( compute_timing ( hwif -> name , & t [ 0 ] ) , basePort ) ; } }
tune_ide
 Tunes the whole hwif, ie tunes each drives, and in case we have to share,
 takes the worse timings to tune qd6580
tune_ide Tunes the whole hwif ie tunes each drives and in case we have to share takes the worse timings to tune qd6580
/* all CPUs */ /* all CPUs */ /* only primary port enabled, can tune separately */ /* both ports enabled, we have to share */