aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLee Trager <lt73@cs.drexel.edu>2007-06-08 09:14:30 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-06-08 09:14:30 -0400
commit0d2157f78d17fcee17791f54959e67cc0af0da74 (patch)
tree22782319df55322375f5fe3b8c23d1591e3fbcf0
parent0380dad45e4f5a606025cc4df2a2cd26af08796b (diff)
ide: 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. bart: added drv != NULL check to generic_ide_suspend() From: Lee Trager <lt73@cs.drexel.edu> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
-rw-r--r--drivers/ide/ide-disk.c12
-rw-r--r--drivers/ide/ide.c9
-rw-r--r--include/linux/ide.h1
3 files changed, 21 insertions, 1 deletions
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
index 7fff773f2df7..dc2175c81f5e 100644
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -1037,6 +1037,17 @@ static void ide_disk_release(struct kref *kref)
1037 1037
1038static int ide_disk_probe(ide_drive_t *drive); 1038static int ide_disk_probe(ide_drive_t *drive);
1039 1039
1040/*
1041 * On HPA drives the capacity needs to be
1042 * reinitilized on resume otherwise the disk
1043 * can not be used and a hard reset is required
1044 */
1045static void ide_disk_resume(ide_drive_t *drive)
1046{
1047 if (idedisk_supports_hpa(drive->id))
1048 init_idedisk_capacity(drive);
1049}
1050
1040static void ide_device_shutdown(ide_drive_t *drive) 1051static void ide_device_shutdown(ide_drive_t *drive)
1041{ 1052{
1042#ifdef CONFIG_ALPHA 1053#ifdef CONFIG_ALPHA
@@ -1071,6 +1082,7 @@ static ide_driver_t idedisk_driver = {
1071 }, 1082 },
1072 .probe = ide_disk_probe, 1083 .probe = ide_disk_probe,
1073 .remove = ide_disk_remove, 1084 .remove = ide_disk_remove,
1085 .resume = ide_disk_resume,
1074 .shutdown = ide_device_shutdown, 1086 .shutdown = ide_device_shutdown,
1075 .version = IDEDISK_VERSION, 1087 .version = IDEDISK_VERSION,
1076 .media = ide_disk, 1088 .media = ide_disk,
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
index 6002713a20a1..0af0d1614f75 100644
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -1010,9 +1010,11 @@ static int generic_ide_resume(struct device *dev)
1010{ 1010{
1011 ide_drive_t *drive = dev->driver_data; 1011 ide_drive_t *drive = dev->driver_data;
1012 ide_hwif_t *hwif = HWIF(drive); 1012 ide_hwif_t *hwif = HWIF(drive);
1013 ide_driver_t *drv = to_ide_driver(dev->driver);
1013 struct request rq; 1014 struct request rq;
1014 struct request_pm_state rqpm; 1015 struct request_pm_state rqpm;
1015 ide_task_t args; 1016 ide_task_t args;
1017 int err;
1016 1018
1017 /* Call ACPI _STM only once */ 1019 /* Call ACPI _STM only once */
1018 if (!(drive->dn % 2)) 1020 if (!(drive->dn % 2))
@@ -1029,7 +1031,12 @@ static int generic_ide_resume(struct device *dev)
1029 rqpm.pm_step = ide_pm_state_start_resume; 1031 rqpm.pm_step = ide_pm_state_start_resume;
1030 rqpm.pm_state = PM_EVENT_ON; 1032 rqpm.pm_state = PM_EVENT_ON;
1031 1033
1032 return ide_do_drive_cmd(drive, &rq, ide_head_wait); 1034 err = ide_do_drive_cmd(drive, &rq, ide_head_wait);
1035
1036 if (err == 0 && drv && drv->resume)
1037 drv->resume(drive);
1038
1039 return err;
1033} 1040}
1034 1041
1035int generic_ide_ioctl(ide_drive_t *drive, struct file *file, struct block_device *bdev, 1042int generic_ide_ioctl(ide_drive_t *drive, struct file *file, struct block_device *bdev,
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 07aba87d369d..1e365acdd369 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -1001,6 +1001,7 @@ struct ide_driver_s {
1001 struct device_driver gen_driver; 1001 struct device_driver gen_driver;
1002 int (*probe)(ide_drive_t *); 1002 int (*probe)(ide_drive_t *);
1003 void (*remove)(ide_drive_t *); 1003 void (*remove)(ide_drive_t *);
1004 void (*resume)(ide_drive_t *);
1004 void (*shutdown)(ide_drive_t *); 1005 void (*shutdown)(ide_drive_t *);
1005#ifdef CONFIG_IDE_PROC_FS 1006#ifdef CONFIG_IDE_PROC_FS
1006 ide_proc_entry_t *proc; 1007 ide_proc_entry_t *proc;