From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
To: linux-ide@vger.kernel.org
Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH 1/9] ide: fix HDIO_DRIVE_TASK[FILE] ioctls for CHS commands on LBA devices
Date: Sun, 17 Aug 2008 21:53:36 +0200 [thread overview]
Message-ID: <20080817195336.13393.86030.sendpatchset@localhost.localdomain> (raw)
Add IDE_DFLAG_LBA device flag and use it instead of ->select.b.lba.
Since ->tf_load uses ->select.all for ATA Device/Head register this
fixes HDIO_DRIVE_TASK[FILE] ioctls for CHS commands on LBA devices.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
moar patches (on top of pata tree + previous 9)
drivers/ide/ide-disk.c | 33 ++++++++++++++++++++-------------
drivers/ide/ide-io.c | 4 ++--
include/linux/ide.h | 1 +
3 files changed, 23 insertions(+), 15 deletions(-)
Index: b/drivers/ide/ide-disk.c
===================================================================
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -156,7 +156,7 @@ static ide_startstop_t __ide_do_rw_disk(
memset(&task, 0, sizeof(task));
task.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE;
- if (drive->select.b.lba) {
+ if (drive->dev_flags & IDE_DFLAG_LBA) {
if (lba48) {
pr_debug("%s: LBA=0x%012llx\n", drive->name,
(unsigned long long)block);
@@ -181,6 +181,8 @@ static ide_startstop_t __ide_do_rw_disk(
tf->lbah = block >>= 8;
tf->device = (block >> 8) & 0xf;
}
+
+ tf->device |= ATA_LBA;
} else {
unsigned int sect, head, cyl, track;
@@ -378,28 +380,32 @@ static void idedisk_check_hpa(ide_drive_
static void init_idedisk_capacity(ide_drive_t *drive)
{
u16 *id = drive->id;
- /*
- * If this drive supports the Host Protected Area feature set,
- * then we may need to change our opinion about the drive's capacity.
- */
- int hpa = ata_id_hpa_enabled(id);
+ int lba;
if (ata_id_lba48_enabled(id)) {
/* drive speaks 48-bit LBA */
- drive->select.b.lba = 1;
+ lba = 1;
drive->capacity64 = ata_id_u64(id, ATA_ID_LBA_CAPACITY_2);
- if (hpa)
- idedisk_check_hpa(drive);
} else if (ata_id_has_lba(id) && ata_id_is_lba_capacity_ok(id)) {
/* drive speaks 28-bit LBA */
- drive->select.b.lba = 1;
+ lba = 1;
drive->capacity64 = ata_id_u32(id, ATA_ID_LBA_CAPACITY);
- if (hpa)
- idedisk_check_hpa(drive);
} else {
/* drive speaks boring old 28-bit CHS */
+ lba = 0;
drive->capacity64 = drive->cyl * drive->head * drive->sect;
}
+
+ if (lba) {
+ drive->dev_flags |= IDE_DFLAG_LBA;
+
+ /*
+ * If this device supports the Host Protected Area feature set,
+ * then we may need to change our opinion about its capacity.
+ */
+ if (ata_id_hpa_enabled(id))
+ idedisk_check_hpa(drive);
+ }
}
static sector_t idedisk_capacity(ide_drive_t *drive)
@@ -1105,7 +1111,8 @@ static int ide_disk_probe(ide_drive_t *d
drive->driver_data = idkp;
idedisk_setup(drive);
- if ((!drive->head || drive->head > 16) && !drive->select.b.lba) {
+ if ((drive->dev_flags & IDE_DFLAG_LBA) == 0 &&
+ (drive->head == 0 || drive->head > 16)) {
printk(KERN_ERR "%s: INVALID GEOMETRY: %d PHYSICAL HEADS?\n",
drive->name, drive->head);
drive->dev_flags &= ~IDE_DFLAG_ATTACH;
Index: b/drivers/ide/ide-io.c
===================================================================
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -383,7 +383,7 @@ static ide_startstop_t ide_ata_error(ide
} else if (stat & ATA_ERR) {
/* err has different meaning on cdrom and tape */
if (err == ATA_ABORTED) {
- if (drive->select.b.lba &&
+ if ((drive->dev_flags & IDE_DFLAG_LBA) &&
/* some newer drives don't support ATA_CMD_INIT_DEV_PARAMS */
hwif->tp_ops->read_status(hwif) == ATA_CMD_INIT_DEV_PARAMS)
return ide_stopped;
@@ -513,7 +513,7 @@ static void ide_tf_set_specify_cmd(ide_d
tf->lbal = drive->sect;
tf->lbam = drive->cyl;
tf->lbah = drive->cyl >> 8;
- tf->device = ((drive->head - 1) | drive->select.all) & ~ATA_LBA;
+ tf->device = (drive->head - 1) | drive->select.all;
tf->command = ATA_CMD_INIT_DEV_PARAMS;
}
Index: b/include/linux/ide.h
===================================================================
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -500,6 +500,7 @@ enum {
IDE_DFLAG_NOWERR = (1 << 24),
/* retrying in PIO */
IDE_DFLAG_DMA_PIO_RETRY = (1 << 25),
+ IDE_DFLAG_LBA = (1 << 26),
};
struct ide_drive_s {
next reply other threads:[~2008-08-17 19:55 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-17 19:53 Bartlomiej Zolnierkiewicz [this message]
2008-08-17 19:53 ` [PATCH 2/9] ide: sanitize ide*_pm_* enums Bartlomiej Zolnierkiewicz
2008-08-17 19:53 ` [PATCH 3/9] cy82c693: remove dead CY82C693_SETDMA_CLOCK code Bartlomiej Zolnierkiewicz
2008-08-17 19:53 ` [PATCH 4/9] cy82c693: remove no longer needed CY82C693_DEBUG_LOGS code Bartlomiej Zolnierkiewicz
2008-08-17 19:54 ` [PATCH 5/9] ide: use 'drive->dn & 1' instead of drive->select.b.unit Bartlomiej Zolnierkiewicz
2008-08-17 19:54 ` [PATCH 6/9] ide: remove [ata_]select_t Bartlomiej Zolnierkiewicz
2008-08-20 9:57 ` Sergei Shtylyov
2008-08-17 19:54 ` [PATCH 7/9] ide: convert 'pio_mode' device setting to use DS_SYNC flag Bartlomiej Zolnierkiewicz
2008-08-17 19:54 ` [PATCH 8/9] ide: factor out reset error reporting from reset_pollfunc() Bartlomiej Zolnierkiewicz
2008-08-17 19:54 ` [PATCH 9/9] ide: merge all TASKFILE_NO_DATA data phase handlers into taskfile_no_intr() Bartlomiej Zolnierkiewicz
2008-08-17 19:54 ` Bartlomiej Zolnierkiewicz
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=20080817195336.13393.86030.sendpatchset@localhost.localdomain \
--to=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 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.