Skip to contentSkip to conversation

HPA Detect From Resume

PATCH In review Lee Trager 2 participants 4 messages May 12, 2007 – Jun 15, 2007 libata

lore
Share & tools
lore

Lee Trager

author
#0 lore raw

PATCH 1/1 HPA Detect From Resume

Currently when system which have HPA require HPA to be detected and disabled upon resume from RAM or disk. The current IDE drivers do not do this nor does libata(obviously it since it doesn't support HPA yet). I have implemented this into the current IDE drivers and it has been tested by many others since 7/15/2006 in bug number 6840(http://bugzilla.kernel.org/show_bug.cgi?id=6840) and it has been confirmed to work fine with no problems.

include/linux/ide.h +1 -0
@@ -1005,6 +1005,7 @@
 	int		(*probe)(ide_drive_t *);
 	void		(*remove)(ide_drive_t *);
 	void		(*shutdown)(ide_drive_t *);
+	void		(*resume)(ide_drive_t *);
 } ide_driver_t;
 
 #define to_ide_driver(drv) container_of(drv, ide_driver_t, gen_driver)
drivers/ide/ide.c +8 -1
@@ -1260,9 +1260,11 @@
 {
 	ide_drive_t *drive = dev->driver_data;
 	ide_hwif_t *hwif = HWIF(drive);
+	ide_driver_t *drv = to_ide_driver(dev->driver);
 	struct request rq;
 	struct request_pm_state rqpm;
 	ide_task_t args;
+	int err;
 
 	/* Call ACPI _STM only once */
 	if (!(drive->dn % 2))
@@ -1279,7 +1281,12 @@
 	rqpm.pm_step = ide_pm_state_start_resume;
 	rqpm.pm_state = PM_EVENT_ON;
 
-	return ide_do_drive_cmd(drive, &rq, ide_head_wait);
+	err = ide_do_drive_cmd(drive, &rq, ide_head_wait);
+
+	if (err == 0 && drv->resume)
+		drv->resume(drive);
+
+	return err;
 }
 
 int generic_ide_ioctl(ide_drive_t *drive, struct file *file, struct block_device *bdev,
drivers/ide/ide-disk.c +12 -0
@@ -1024,6 +1024,17 @@
 
 static int ide_disk_probe(ide_drive_t *drive);
 
+/*
+ * On HPA drives the capacity needs to be
+ * reinitilized on resume otherwise the disk
+ * can not be used and a hard reset is required
+ */
+static void ide_disk_resume(ide_drive_t *drive)
+{
+	if (idedisk_supports_hpa(drive->id))
+		init_idedisk_capacity(drive);
+}
+
 static void ide_device_shutdown(ide_drive_t *drive)
 {
 #ifdef	CONFIG_ALPHA
@@ -1067,6 +1078,7 @@
 	.error			= __ide_error,
 	.abort			= __ide_abort,
 	.proc			= idedisk_proc,
+	.resume			= ide_disk_resume,
 };
 
 static int idedisk_open(struct inode *inode, struct file *filp)
#1 lore raw

Hi,

Quoted 7 lines · Lee Trager

Currently when system which have HPA require HPA to be detected and disabled upon resume from RAM or disk. The current IDE drivers do not do this nor does libata(obviously it since it doesn't support HPA yet). I have implemented this into the current IDE drivers and it has been tested by many others since 7/15/2006 in bug number 6840(http://bugzilla.kernel.org/show_bug.cgi?id=6840) and it has been confirmed to work fine with no problems.

Big thanks for working on this bug.

The patch looks good, applied.

include/linux/ide.h line 1009

Quoted 8 lines
include/linux/ide.h +1 -0
@@ -1005,6 +1005,7 @@
 	int		(*probe)(ide_drive_t *);
 	void		(*remove)(ide_drive_t *);
 	void		(*shutdown)(ide_drive_t *);
+	void		(*resume)(ide_drive_t *);
 } ide_driver_t;

ide_driver_t changed a bit in 2.6.22 due to /proc/ide/ rework so this chunk (and one chunk in ide-disk.c) rejected to apply. Fixed them by hand.

include/linux/ide.h line 1288

Quoted 10 lines
include/linux/ide.h +5 -1
@@ -1279,7 +1281,12 @@
 	rqpm.pm_step = ide_pm_state_start_resume;
 	rqpm.pm_state = PM_EVENT_ON;
 
-	return ide_do_drive_cmd(drive, &rq, ide_head_wait);
+	err = ide_do_drive_cmd(drive, &rq, ide_head_wait);
+
+	if (err == 0 && drv->resume)
+		drv->resume(drive);
+

Added extra drv != NULL check (there may be no IDE device driver et all).

author
#2 lore raw
Quoted 36 lines · Bartlomiej Zolnierkiewicz

Hi,

Quoted 8 lines · Lee Trager

Currently when system which have HPA require HPA to be detected and disabled upon resume from RAM or disk. The current IDE drivers do not do this nor does libata(obviously it since it doesn't support HPA yet). I have implemented this into the current IDE drivers and it has been tested by many others since 7/15/2006 in bug number 6840(http://bugzilla.kernel.org/show_bug.cgi?id=6840) and it has been confirmed to work fine with no problems.

Big thanks for working on this bug.

The patch looks good, applied.

include/linux/ide.h line 1010

Quoted 9 lines
include/linux/ide.h +1 -0
@@ -1005,6 +1005,7 @@
 	int		(*probe)(ide_drive_t *);
 	void		(*remove)(ide_drive_t *);
 	void		(*shutdown)(ide_drive_t *);
+	void		(*resume)(ide_drive_t *);
 } ide_driver_t;
 

ide_driver_t changed a bit in 2.6.22 due to /proc/ide/ rework so this chunk (and one chunk in ide-disk.c) rejected to apply. Fixed them by hand.

Quoted 4 lines
include/linux/ide.h +0 -0
@@ -1279,7 +1281,12 @@
 	rqpm.pm_step = ide_pm_state_start_resume;
 	rqpm.pm_state = PM_EVENT_ON;
 
Quoted 14 lines

include/linux/ide.h line 1289

Quoted 7 lines
include/linux/ide.h +5 -1
-	return ide_do_drive_cmd(drive, &rq, ide_head_wait);
+	err = ide_do_drive_cmd(drive, &rq, ide_head_wait);
+
+	if (err == 0 && drv->resume)
+		drv->resume(drive);
+
 

Added extra drv != NULL check (there may be no IDE device driver et all). -
To unsubscribe from this list: send the line "unsubscribe linux-ide" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Thanks for cleaning it up I've been really busy lately. I just downloaded 2.6.22-rc3 and the patch still wasn't in there will it be in rc4 or is there something else I need to do? Also a few weeks ago I tested the HPA patch for libata and the same issue comes up. I'll look into releasing another patch for libata once its in the kernel and I have more time.

Lee

#3 lore raw

Hi,

Quoted 51 lines · Lee Trager
Quoted 36 lines · Bartlomiej Zolnierkiewicz

Hi,

Quoted 8 lines · Lee Trager

Currently when system which have HPA require HPA to be detected and disabled upon resume from RAM or disk. The current IDE drivers do not do this nor does libata(obviously it since it doesn't support HPA yet). I have implemented this into the current IDE drivers and it has been tested by many others since 7/15/2006 in bug number 6840(http://bugzilla.kernel.org/show_bug.cgi?id=6840) and it has been confirmed to work fine with no problems.

Big thanks for working on this bug.

The patch looks good, applied.

include/linux/ide.h line 1010

Quoted 9 lines
include/linux/ide.h +1 -0
@@ -1005,6 +1005,7 @@
 	int		(*probe)(ide_drive_t *);
 	void		(*remove)(ide_drive_t *);
 	void		(*shutdown)(ide_drive_t *);
+	void		(*resume)(ide_drive_t *);
 } ide_driver_t;
 

ide_driver_t changed a bit in 2.6.22 due to /proc/ide/ rework so this chunk (and one chunk in ide-disk.c) rejected to apply. Fixed them by hand.

Quoted 4 lines
include/linux/ide.h +0 -0
@@ -1279,7 +1281,12 @@
 	rqpm.pm_step = ide_pm_state_start_resume;
 	rqpm.pm_state = PM_EVENT_ON;
 
Quoted 14 lines

include/linux/ide.h line 1289

Quoted 7 lines
include/linux/ide.h +5 -1
-	return ide_do_drive_cmd(drive, &rq, ide_head_wait);
+	err = ide_do_drive_cmd(drive, &rq, ide_head_wait);
+
+	if (err == 0 && drv->resume)
+		drv->resume(drive);
+
 

Added extra drv != NULL check (there may be no IDE device driver et all). -
To unsubscribe from this list: send the line "unsubscribe linux-ide" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Quoted 3 lines

Thanks for cleaning it up I've been really busy lately. I just downloaded 2.6.22-rc3 and the patch still wasn't in there will it be in rc4 or is there something else I need to do? Also a few weeks ago I

IDE fixes went in 4 days after -rc4 so this patch will show up in -rc5.

Quoted 3 lines

tested the HPA patch for libata and the same issue comes up. I'll look into releasing another patch for libata once its in the kernel and I have more time.

Please do.

Thanks,
Bart