From: Tejun Heo <htejun@gmail.com>
To: Bartlomiej Zolnierkiewicz <bzolnier@elka.pw.edu.pl>
Cc: linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org,
Alan Cox <alan@lxorguk.ukuu.org.uk>,
Jeff Garzik <jgarzik@pobox.com>, Tejun Heo <tj@home-tj.org>
Subject: Re: [rfc][patch] ide: fix unneeded LBA48 taskfile registers access
Date: Mon, 07 Feb 2005 13:47:33 +0900 [thread overview]
Message-ID: <4206F2E5.7020501@gmail.com> (raw)
In-Reply-To: <Pine.GSO.4.58.0502062348200.2763@mion.elka.pw.edu.pl>
Hello, Bartlomiej.
Bartlomiej Zolnierkiewicz wrote:
> [ against ide-dev-2.6 tree, boot tested on LBA48 drive ]
>
> This small patch fixes unneeded writes/reads to LBA48 taskfile registers
> on LBA48 capable disks for following cases:
>
> * Power Management requests
> (WIN_FLUSH_CACHE[_EXT], WIN_STANDBYNOW1, WIN_IDLEIMMEDIATE commands)
> * special commands (WIN_SPECIFY, WIN_RESTORE, WIN_SETMULT)
> * Host Protected Area support (WIN_READ_NATIVE_MAX, WIN_SET_MAX)
> * /proc/ide/ SMART support (WIN_SMART with SMART_ENABLE,
> SMART_READ_VALUES and SMART_READ_THRESHOLDS subcommands)
> * write cache enabling/disabling in ide-disk
> (WIN_SETFEATURES with SETFEATURES_{EN,DIS}_WCACHE)
> * write cache flushing in ide-disk (WIN_FLUSH_CACHE[_EXT])
> * acoustic management in ide-disk
> (WIN_SETFEATURES with SETFEATURES_{EN,DIS}_AAM)
> * door (un)locking in ide-disk (WIN_DOORLOCK, WIN_DOORUNLOCK)
> * /proc/ide/hd?/identify support (WIN_IDENTIFY)
>
> Patch adds 'unsinged long flags' to ide_task_t and uses ATA_TFLAG_LBA48
> flag (from <linux/ata.h>) to indicate need of accessing LBA48 taskfile
> registers.
ide_task_t already has fields to enable/disable writing/reading of
taskfile and hob registers (tf_in_flags and tf_out_flags). How about
adding the following two helpers.
static inline ide_init_task[_std](ide_task_t *task)
{
memset(task, 0, sizeof(*task));
task->tf_out_flags = IDE_TASKFILE_STD_OUT_FLAGS;
task->tf_in_flags = IDE_TASKFILE_STD_IN_FLAGS;
}
static inline ide_init_task_lba48(ide_task_t *task)
{
memset(task, 0, sizeof(*task));
task->tf_out_flags = IDE_TASKFILE_STD_OUT_FLAGS
| (IDE_HOB_STD_OUT_FLAGS << 8);
task->tf_in_flags = IDE_TASKFILE_STD_IN_FLAGS
| (IDE_HOB_STD_IN_FLAGS << 8);
}
And, when writing taskfile,
if (task->tf_out_flags & 0xf == IDE_TASKFILE_STD_OUT_FLAGS) {
/* Write taskfile regs without testing flags */
} else {
/* Flagged taskfile */
}
if (task->tf_out_flags & 0xf0 == IDE_TASKFILE_HOB_OUT_FLAGS) {
/* Write hob regs without testing flags */
} else {
/* Flagged hob */
}
And, when reading taskfile back,
if (task->tf_in_flags & 0xf0) {
/* Read all hob regs */
}
/* Read all taskfile regs */
And, we need to check if any of in/out flags is zero in ioctl
functions and set STD flags appropriately. So, basically, in kernel,
tf_{in|out}_flags == 0 now means 0, not default.
By doing like above,
1. Virtually the same effect
2. No need to add new field to ide_task_t
3. Cleaner semantics (ATA_TFLAG_LBA48 and tf_{in|out}_flags carry
duplicate information.)
Thanks.
--
tejun
next prev parent reply other threads:[~2005-02-07 4:47 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-02-06 22:54 [rfc][patch] ide: fix unneeded LBA48 taskfile registers access Bartlomiej Zolnierkiewicz
2005-02-07 4:47 ` Tejun Heo [this message]
2005-02-07 8:58 ` Jeff Garzik
2005-02-07 8:59 ` Bartlomiej Zolnierkiewicz
2005-02-10 0:01 ` Tejun Heo
2005-02-10 0:24 ` Bartlomiej Zolnierkiewicz
2005-02-10 0:52 ` Tejun Heo
2005-02-10 1:31 ` Bartlomiej Zolnierkiewicz
2005-02-10 2:04 ` Jeff Garzik
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=4206F2E5.7020501@gmail.com \
--to=htejun@gmail.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=bzolnier@elka.pw.edu.pl \
--cc=jgarzik@pobox.com \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tj@home-tj.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).