From: Ben Collins <ben.collins@ubuntu.com>
To: Mark Lord <liml@rtr.ca>
Cc: linux-kernel@vger.kernel.org, alan@lxorguk.ukuu.org.uk,
Kyle McMartin <kyle@ubuntu.com>,
linux-ide@vger.kernel.org
Subject: Re: [PATCH] Cleanup libata HPA support
Date: Tue, 08 May 2007 16:43:14 +0200 [thread overview]
Message-ID: <1178635394.6962.97.camel@cunning> (raw)
In-Reply-To: <46407ED4.9090301@rtr.ca>
On Tue, 2007-05-08 at 09:44 -0400, Mark Lord wrote:
> Ben Collins wrote:
> ..
> > static u64 ata_tf_to_lba48(struct ata_taskfile *tf)
> > {
> > - u64 sectors = 0;
> > + u64 sectors;
> > + u32 high, low;
> >
> > - sectors |= ((u64)(tf->hob_lbah & 0xff)) << 40;
> > - sectors |= ((u64)(tf->hob_lbam & 0xff)) << 32;
> > - sectors |= (tf->hob_lbal & 0xff) << 24;
> > - sectors |= (tf->lbah & 0xff) << 16;
> > - sectors |= (tf->lbam & 0xff) << 8;
> > - sectors |= (tf->lbal & 0xff);
> > + high = (tf->hob_lbah << 16) |
> > + (tf->hob_lbam << 8) |
> > + tf->hob_lbal;
> > + low = (tf->lbah << 16) |
> > + (tf->lbam << 8) |
> > + tf->lbal;
> >
> > - return ++sectors;
> > + sectors = ((u64)high << 24) | low;
> > +
> > + return sectors + 1;
> > }
>
> Ben, I very much prefer the fixed version of this function
> as implemented by the patch above.
>
> But.. is the original code actually broken, or just messy?
Due to the bugs we were seeing, we actually noticed that this function
was having signed extension issues as originally implemented. I didn't
look for the actual bug, but reimplemented it based on code in
ide_disk.c, which resolved the issue.
--
Ubuntu : http://www.ubuntu.com/
Linux1394: http://wiki.linux1394.org/
prev parent reply other threads:[~2007-05-08 14:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-08 10:59 [PATCH] Cleanup libata HPA support Ben Collins
2007-05-08 13:44 ` Mark Lord
2007-05-08 14:43 ` Ben Collins [this message]
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=1178635394.6962.97.camel@cunning \
--to=ben.collins@ubuntu.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=kyle@ubuntu.com \
--cc=liml@rtr.ca \
--cc=linux-ide@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).