linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <htejun@gmail.com>
To: Jeff Garzik <jgarzik@pobox.com>, Albert Lee <albertcc@tw.ibm.com>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>,
	Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>,
	Linux-ide <linux-ide@vger.kernel.org>
Subject: regarding xfer mode representation in dev, ap and other places
Date: Wed, 15 Feb 2006 21:53:31 +0900	[thread overview]
Message-ID: <43F3244B.2010600@gmail.com> (raw)

Hello, all.

Now that new reset mechanism is in tree and configuration changes are 
submitted, I'm about to send out transfer mode setting changes.  Two 
major goals of the changes are...

* Give upper layer the power to determine whether devices/ports go 
offline or not.

* Add per-device xfermode limit mask such that EH can limit transfer 
mode later.

One thing that bothers me is various representations of xfermode in 
ata_device, ata_port and other places.

* In ata_device, the current pio and dma transfer mode are recorded in 
->pio_mode and ->dma_mode using SETFEATURES XFERMODE constants.  Of the 
two, currently active mode is copied in ->xfer_mode and ->xfer_shift 
indicates which one is copied.

* In ata_port, supported transfer modes are recorded in three unsigned 
int fields, ->pio_mask, ->mwdma_mask and ->udma_mask.

* Yet another representation is used for printing supported transfer 
mode.  This is a combined mask of ->pio_mask, ->mwdma_mask and 
->udma_mask shifted by respective ATA_SHIFT_XXX.

IMHO, storing SETFEATURES XFERMODE constants and ATA_SHIFT_xxx isn't a 
very good idea.  Except for writing directly to the device, this value 
is just cumbersome to deal with.  e.g. we currently have awkward code 
involving base_from_shift() and offset arithmetics to reverse map and 
print configured transfer mode in ata_dev_set_mode().  Logical transfer 
mode -> constants is easy, the other way around, not.  Also, multiple 
transfer modes cannot be represented in this way.

Of the left two representations, IMHO, the packed one is easier to deal 
with.  It can be easily passed, returned and masked.  Storing as a 
single mask and unpacking when needed is much more convenient then 
carrying around three values, and it isn't like we're gonna need more 
than 32 bits in any foreseeable future; also, we always have u64.

So, I'm proposing to convert all transfer mode representations to one 
packed bit mask which would be u32 for now.  How does it sound?

Thanks.

-- 
tejun

             reply	other threads:[~2006-02-15 12:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-15 12:53 Tejun Heo [this message]
2006-02-16 14:09 ` [PATCH 2/3] libata: make ata_device and ata_port use unsigned int xfer_mask Tejun Heo
2006-02-16 14:32   ` Alan Cox
2006-02-16 15:01     ` Tejun Heo
2006-02-16 14:09 ` [PATCH 3/3] libata: make ata_port_info and ata_probe_ent use xfer_mask Tejun Heo
2006-02-16 14:09 ` [PATCHSET] libata: use single unsigned int xfer_mask Tejun Heo
2006-02-16 14:27   ` Tejun Heo
2006-02-16 14:46     ` Alan Cox
2006-02-16 14:09 ` [PATCH 1/3] libata: fix sata_sil24 mwdma_mask setting Tejun Heo

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=43F3244B.2010600@gmail.com \
    --to=htejun@gmail.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=albertcc@tw.ibm.com \
    --cc=bzolnier@gmail.com \
    --cc=jgarzik@pobox.com \
    --cc=linux-ide@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).