All of lore.kernel.org
 help / color / mirror / Atom feed
From: Roland Dreier <roland@topspin.com>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Brenden Matthews <brenden@rty.ca>,
	Linux Kernel list <linux-kernel@vger.kernel.org>
Subject: Re: Si3112 S-ATA bug preventing use of udma5.
Date: 23 Apr 2004 19:30:41 -0700	[thread overview]
Message-ID: <52ad12qf8u.fsf@topspin.com> (raw)
In-Reply-To: <1082771045.10727.46.camel@gaston>

    Brenden> Incase the link is down/broken, to fix the bug change line 269
    Brenden> of drivers/ide/pci/siimage.c from:

    Brenden> u32 speedt = 0;

    Brenden> to: u16 speedt = 0;

    Brenden> The crux of the problem is that the first arguent to OUTW
    Brenden> (out WORD) was a doubleword. The arguments were getting
    Brenden> all screwed up on the stack.  The lower order 16-bit were
    Brenden> being used in the second argument of OUTW, and the upper
    Brenden> order word was being used as the whole first argument,
    Brenden> which was always 0000.

    Ben> Hrm... that's strange. I'd tend to think it's a bogus
    Ben> definition of outw on this architecture (x86 ?) instead. an
    Ben> u32 should be casted down to u16 without problem.

Assuming I'm reading the siimage.c code correctly, it's calling
default_hwif_mmiops() to set up its OUTW pointer, which sets the
function pointer to call

static void ide_mm_outw (u16 value, unsigned long port)
{
        writew(value, port);
}

In asm-i386/io.h, we have

#define writew(b,addr) (*(volatile unsigned short *) __io_virt(addr) = (b))

Finally, siimage.c does

                hwif->OUTW(speedt, addr);

and speedt is a u32 -- however, as you say, the compiler should just
cast speedt down to a u16.  What am I missing?

 - R.

  reply	other threads:[~2004-04-24  2:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-23 22:02 Si3112 S-ATA bug preventing use of udma5 Brenden Matthews
2004-04-24  1:44 ` Benjamin Herrenschmidt
2004-04-24  2:30   ` Roland Dreier [this message]
2004-04-24  4:31     ` Benjamin Herrenschmidt
2004-04-24 19:35       ` Denis Vlasenko

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=52ad12qf8u.fsf@topspin.com \
    --to=roland@topspin.com \
    --cc=benh@kernel.crashing.org \
    --cc=brenden@rty.ca \
    --cc=linux-kernel@vger.kernel.org \
    /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.