From: Tejun Heo <tj@home-tj.org>
To: bzolnier@gmail.com, linux-ide@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2.6.11-rc2 03/04] ide: ide_read_taskfile() implemented.
Date: Sun, 6 Feb 2005 20:26:56 +0900 (KST) [thread overview]
Message-ID: <20050206112656.44F7F132649@htj.dyndns.org> (raw)
In-Reply-To: <20050206112628.GA31274@htj.dyndns.org>
03_ide_read_taskfile.patch
Status reading part of ide_end_drive_cmd() is moved into
a separate function ide_read_taskfile().
Signed-off-by: Tejun Heo <tj@home-tj.org>
Index: linux-ide-series3-export/drivers/ide/ide-io.c
===================================================================
--- linux-ide-series3-export.orig/drivers/ide/ide-io.c 2005-02-06 19:48:58.680279593 +0900
+++ linux-ide-series3-export/drivers/ide/ide-io.c 2005-02-06 19:49:19.496897703 +0900
@@ -339,7 +339,6 @@ static void ide_complete_barrier(ide_dri
void ide_end_drive_cmd (ide_drive_t *drive, u8 stat, u8 err)
{
- ide_hwif_t *hwif = HWIF(drive);
unsigned long flags;
struct request *rq;
@@ -351,32 +350,8 @@ void ide_end_drive_cmd (ide_drive_t *dri
ide_task_t *args = (ide_task_t *) rq->special;
if (rq->errors == 0)
rq->errors = !OK_STAT(stat,READY_STAT,BAD_STAT);
-
- if (args) {
- if (args->tf_in_flags.b.data) {
- u16 data = hwif->INW(IDE_DATA_REG);
- args->tfRegister[IDE_DATA_OFFSET] = (data) & 0xFF;
- args->hobRegister[IDE_DATA_OFFSET] = (data >> 8) & 0xFF;
- }
- args->tfRegister[IDE_ERROR_OFFSET] = err;
- /* be sure we're looking at the low order bits */
- hwif->OUTB(drive->ctl & ~0x80, IDE_CONTROL_REG);
- args->tfRegister[IDE_NSECTOR_OFFSET] = hwif->INB(IDE_NSECTOR_REG);
- args->tfRegister[IDE_SECTOR_OFFSET] = hwif->INB(IDE_SECTOR_REG);
- args->tfRegister[IDE_LCYL_OFFSET] = hwif->INB(IDE_LCYL_REG);
- args->tfRegister[IDE_HCYL_OFFSET] = hwif->INB(IDE_HCYL_REG);
- args->tfRegister[IDE_SELECT_OFFSET] = hwif->INB(IDE_SELECT_REG);
- args->tfRegister[IDE_STATUS_OFFSET] = stat;
-
- if (drive->addressing == 1) {
- hwif->OUTB(drive->ctl|0x80, IDE_CONTROL_REG);
- args->hobRegister[IDE_FEATURE_OFFSET] = hwif->INB(IDE_FEATURE_REG);
- args->hobRegister[IDE_NSECTOR_OFFSET] = hwif->INB(IDE_NSECTOR_REG);
- args->hobRegister[IDE_SECTOR_OFFSET] = hwif->INB(IDE_SECTOR_REG);
- args->hobRegister[IDE_LCYL_OFFSET] = hwif->INB(IDE_LCYL_REG);
- args->hobRegister[IDE_HCYL_OFFSET] = hwif->INB(IDE_HCYL_REG);
- }
- }
+ if (args)
+ ide_read_taskfile(drive, args, stat, err);
} else if (blk_pm_request(rq)) {
#ifdef DEBUG_PM
printk("%s: complete_power_step(step: %d, stat: %x, err: %x)\n",
Index: linux-ide-series3-export/drivers/ide/ide-taskfile.c
===================================================================
--- linux-ide-series3-export.orig/drivers/ide/ide-taskfile.c 2005-02-06 19:49:18.730022291 +0900
+++ linux-ide-series3-export/drivers/ide/ide-taskfile.c 2005-02-06 19:49:19.493898191 +0900
@@ -180,6 +180,41 @@ void ide_write_taskfile(ide_drive_t *dri
EXPORT_SYMBOL(ide_write_taskfile);
+void ide_read_taskfile(ide_drive_t *drive, ide_task_t *task, u8 stat, u8 err)
+{
+ ide_hwif_t *hwif = drive->hwif;
+ u8 (*INB)(unsigned long) = hwif->INB;
+ unsigned long *ports = hwif->io_ports;
+ task_struct_t *tf = (task_struct_t *)task->tfRegister;
+ hob_struct_t *hob = (hob_struct_t *)task->hobRegister;
+
+ if (task->tf_in_flags.b.data) {
+ u16 data = hwif->INW(ports[IDE_DATA_OFFSET]);
+ tf->data = (data) & 0xFF;
+ hob->data = (data >> 8) & 0xFF;
+ }
+
+ if (drive->addressing == 1) {
+ /* read HOB first such that HOB bit stays cleared when
+ we leave this function. */
+ hwif->OUTB(drive->ctl|0x80, ports[IDE_CONTROL_OFFSET]);
+ hob->feature = INB(ports[IDE_FEATURE_OFFSET]);
+ hob->sector_count = INB(ports[IDE_NSECTOR_OFFSET]);
+ hob->sector_number = INB(ports[IDE_SECTOR_OFFSET]);
+ hob->low_cylinder = INB(ports[IDE_LCYL_OFFSET]);
+ hob->high_cylinder = INB(ports[IDE_HCYL_OFFSET]);
+ }
+
+ hwif->OUTB(drive->ctl & ~0x80, ports[IDE_CONTROL_OFFSET]);
+ tf->feature = err;
+ tf->sector_count = INB(ports[IDE_NSECTOR_OFFSET]);
+ tf->sector_number = INB(ports[IDE_SECTOR_OFFSET]);
+ tf->low_cylinder = INB(ports[IDE_LCYL_OFFSET]);
+ tf->high_cylinder = INB(ports[IDE_HCYL_OFFSET]);
+ tf->device_head = INB(ports[IDE_SELECT_OFFSET]);
+ tf->command = stat;
+}
+
ide_startstop_t do_rw_taskfile (ide_drive_t *drive, ide_task_t *task)
{
ide_hwif_t *hwif = HWIF(drive);
Index: linux-ide-series3-export/include/linux/ide.h
===================================================================
--- linux-ide-series3-export.orig/include/linux/ide.h 2005-02-06 19:49:18.732021966 +0900
+++ linux-ide-series3-export/include/linux/ide.h 2005-02-06 19:49:19.495897866 +0900
@@ -1296,6 +1296,7 @@ extern int drive_is_ready(ide_drive_t *)
extern int wait_for_ready(ide_drive_t *, int /* timeout */);
void ide_write_taskfile(ide_drive_t *drive, ide_task_t *task);
+void ide_read_taskfile(ide_drive_t *drive, ide_task_t *task, u8 stat, u8 err);
/*
* taskfile io for disks for now...and builds request from ide_ioctl
prev parent reply other threads:[~2005-02-06 11:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-02-06 11:26 [PATCH 2.6.11-rc2] ide: driver updates, series 3 Tejun Heo
2005-02-06 11:26 ` [PATCH 2.6.11-rc2 01/04] ide: ide_write_taskfile() implemented Tejun Heo
2005-02-06 11:26 ` [PATCH 2.6.11-rc2 02/04] ide: __ide_do_rw_disk() rewritten ide_write_taskfile() Tejun Heo
2005-02-06 11:26 ` [PATCH 2.6.11-rc2 04/04] ide: merge flagged_taskfile() into do_rw_taskfile() Tejun Heo
2005-02-06 11:26 ` Tejun Heo [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=20050206112656.44F7F132649@htj.dyndns.org \
--to=tj@home-tj.org \
--cc=bzolnier@gmail.com \
--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
all inboxes | Powered by JetHome®