All of lore.kernel.org
 help / color / mirror / Atom feed
From: Martin Dalecki <dalecki@evision-ventures.com>
To: Mikael Pettersson <mikpe@csd.uu.se>
Cc: vojtech@ucw.cz, linux-kernel@vger.kernel.org
Subject: Re: 2.5.7 pre-UDMA PIIX bug
Date: Fri, 29 Mar 2002 15:00:24 +0100	[thread overview]
Message-ID: <3CA47378.70208@evision-ventures.com> (raw)
In-Reply-To: <200203291239.NAA25704@harpo.it.uu.se>

Mikael Pettersson wrote:
> Vojtech's version of drivers/ide/piix.c which went into 2.5.7
> oopses with a divide-by-zero exception when initialising older
> pre-UDMA chips, like in the following 430HX chipset:
> 
> 00:00.0 Host bridge: Intel Corporation 430HX - 82439HX TXC [Triton II] (rev 03)
> 00:07.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II] (rev 01)
> 00:07.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]
> (PCI IDs 8086:1250, 8086:7000, and 8086:7010, respectively)
> 
> The error occurs in piix.c:piix_set_drive() line 334, shown below.
> The 82371SB has PIIX_UDMA_NONE in the piix_ide_chips[] array,
> so piix_config->flags & PIIX_UDMA is zero, which makes "umul" zero,
> which causes the divide-by-zero on line 334.
> 
>   317	static int piix_set_drive(ide_drive_t *drive, unsigned char speed)
>   318	{
>   319		ide_drive_t *peer = HWIF(drive)->drives + (~drive->dn & 1);
>   320		struct ata_timing t, p;
>   321		int err, T, UT, umul;
>   322	
>   323		if (speed != XFER_PIO_SLOW && speed != drive->current_speed)
>   324			if ((err = ide_config_drive_speed(drive, speed)))
>   325				return err;
>   326	
>   327		umul =  min((speed > XFER_UDMA_4) ? 4 : ((speed > XFER_UDMA_2) ? 2 : 1),
>   328			piix_config->flags & PIIX_UDMA);
>   329	
>   330		if (piix_config->flags & PIIX_VICTORY)
>   331			umul = 2;
>   332	
>   333		T = 1000000000 / piix_clock;
>   334		UT = T / umul;

I think that it should be just sufficient to add the
following test just in front of the offending calculartion.

if (umul == 0)
   ++umul;

Vojtech is this right?


  reply	other threads:[~2002-03-29 14:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-29 12:39 2.5.7 pre-UDMA PIIX bug Mikael Pettersson
2002-03-29 14:00 ` Martin Dalecki [this message]
2002-03-29 15:09   ` Vojtech Pavlik
2002-03-29 15:37   ` Bill Davidsen
2002-03-30 14:26     ` Martin Dalecki
2002-03-29 15:08 ` Vojtech Pavlik
  -- strict thread matches above, loose matches on Subject: below --
2002-03-29 18:20 Mikael Pettersson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3CA47378.70208@evision-ventures.com \
    --to=dalecki@evision-ventures.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mikpe@csd.uu.se \
    --cc=vojtech@ucw.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.