linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] HPA resume fix
@ 2006-08-29  9:55 Lee Trager
  2006-08-29 11:11 ` Alan Cox
  0 siblings, 1 reply; 7+ messages in thread
From: Lee Trager @ 2006-08-29  9:55 UTC (permalink / raw)
  To: B.Zolnierkiewicz; +Cc: linux-kernel, linux-ide

This patch fixes a problem with computers that have HPA on their hard
drive and not being able to come out of resume from RAM or disk. This is
my first patch to the kernel and third time submitting it, hopefully I
got it right this time.

Signed-off-by: Lee Trager <Lee@PicturesInMotion.net>

---

diff -uprN -X linux-2.6.18-rc5/Documentation/dontdiff linux-2.6.18-rc5-old/drivers/ide/ide-disk.c linux-2.6.18-rc5/drivers/ide/ide-disk.c
--- linux-2.6.18-rc5-old/drivers/ide/ide-disk.c	2006-08-29 05:14:43.000000000 -0400
+++ linux-2.6.18-rc5/drivers/ide/ide-disk.c	2006-08-29 05:18:13.000000000 -0400
@@ -1024,6 +1024,17 @@ static void ide_disk_release(struct kref
 
 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 @@ static ide_driver_t idedisk_driver = {
 	.error			= __ide_error,
 	.abort			= __ide_abort,
 	.proc			= idedisk_proc,
+	.resume			= ide_disk_resume,
 };
 
 static int idedisk_open(struct inode *inode, struct file *filp)
diff -uprN -X linux-2.6.18-rc5/Documentation/dontdiff linux-2.6.18-rc5-old/drivers/ide/ide.c linux-2.6.18-rc5/drivers/ide/ide.c
--- linux-2.6.18-rc5-old/drivers/ide/ide.c	2006-08-29 05:14:43.000000000 -0400
+++ linux-2.6.18-rc5/drivers/ide/ide.c	2006-08-29 05:18:13.000000000 -0400
@@ -1229,9 +1229,11 @@ static int generic_ide_suspend(struct de
 static int generic_ide_resume(struct device *dev)
 {
 	ide_drive_t *drive = dev->driver_data;
+	ide_driver_t *drv = to_ide_driver(dev->driver);
 	struct request rq;
 	struct request_pm_state rqpm;
 	ide_task_t args;
+	int err;
 
 	memset(&rq, 0, sizeof(rq));
 	memset(&rqpm, 0, sizeof(rqpm));
@@ -1242,7 +1244,12 @@ static int generic_ide_resume(struct dev
 	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,
diff -uprN -X linux-2.6.18-rc5/Documentation/dontdiff linux-2.6.18-rc5-old/include/linux/ide.h linux-2.6.18-rc5/include/linux/ide.h
--- linux-2.6.18-rc5-old/include/linux/ide.h	2006-08-29 05:15:53.000000000 -0400
+++ linux-2.6.18-rc5/include/linux/ide.h	2006-08-29 05:18:13.000000000 -0400
@@ -987,6 +987,7 @@ typedef struct ide_driver_s {
 	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)



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] HPA resume fix
  2006-08-29  9:55 [PATCH] HPA resume fix Lee Trager
@ 2006-08-29 11:11 ` Alan Cox
  2006-08-29 11:42   ` Jens Axboe
  0 siblings, 1 reply; 7+ messages in thread
From: Alan Cox @ 2006-08-29 11:11 UTC (permalink / raw)
  To: Lee Trager; +Cc: akpm, linux-kernel, linux-ide

Ar Maw, 2006-08-29 am 05:55 -0400, ysgrifennodd Lee Trager:
> This patch fixes a problem with computers that have HPA on their hard
> drive and not being able to come out of resume from RAM or disk. This is
> my first patch to the kernel and third time submitting it, hopefully I
> got it right this time.
> 
> Signed-off-by: Lee Trager <Lee@PicturesInMotion.net>

For -mm only to get more testing

Acked-by: Alan Cox <alan@redhat.com>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] HPA resume fix
  2006-08-29 11:11 ` Alan Cox
@ 2006-08-29 11:42   ` Jens Axboe
  2006-08-29 12:50     ` Alan Cox
  0 siblings, 1 reply; 7+ messages in thread
From: Jens Axboe @ 2006-08-29 11:42 UTC (permalink / raw)
  To: Alan Cox; +Cc: Lee Trager, akpm, linux-kernel, linux-ide, bzolnier

On Tue, Aug 29 2006, Alan Cox wrote:
> Ar Maw, 2006-08-29 am 05:55 -0400, ysgrifennodd Lee Trager:
> > This patch fixes a problem with computers that have HPA on their hard
> > drive and not being able to come out of resume from RAM or disk. This is
> > my first patch to the kernel and third time submitting it, hopefully I
> > got it right this time.
> > 
> > Signed-off-by: Lee Trager <Lee@PicturesInMotion.net>
> 
> For -mm only to get more testing
> 
> Acked-by: Alan Cox <alan@redhat.com>

It should go into the state machine as described imho. Bart?

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] HPA resume fix
  2006-08-29 12:50     ` Alan Cox
@ 2006-08-29 12:32       ` Jens Axboe
  2006-08-30  8:55         ` Lee Trager
  0 siblings, 1 reply; 7+ messages in thread
From: Jens Axboe @ 2006-08-29 12:32 UTC (permalink / raw)
  To: Alan Cox; +Cc: Lee Trager, akpm, linux-kernel, linux-ide, bzolnier

On Tue, Aug 29 2006, Alan Cox wrote:
> Ar Maw, 2006-08-29 am 13:42 +0200, ysgrifennodd Jens Axboe:
> > On Tue, Aug 29 2006, Alan Cox wrote:
> > > For -mm only to get more testing
> > > 
> > > Acked-by: Alan Cox <alan@redhat.com>
> > 
> > It should go into the state machine as described imho. Bart?
> 
> If it works then yes it can become an explicit state. Firstly we need to
> find out if it works.

I think Lee tested and verified both this variant and the first one he
had, so I hope that it works :-)

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] HPA resume fix
  2006-08-29 11:42   ` Jens Axboe
@ 2006-08-29 12:50     ` Alan Cox
  2006-08-29 12:32       ` Jens Axboe
  0 siblings, 1 reply; 7+ messages in thread
From: Alan Cox @ 2006-08-29 12:50 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Lee Trager, akpm, linux-kernel, linux-ide, bzolnier

Ar Maw, 2006-08-29 am 13:42 +0200, ysgrifennodd Jens Axboe:
> On Tue, Aug 29 2006, Alan Cox wrote:
> > For -mm only to get more testing
> > 
> > Acked-by: Alan Cox <alan@redhat.com>
> 
> It should go into the state machine as described imho. Bart?

If it works then yes it can become an explicit state. Firstly we need to
find out if it works.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] HPA resume fix
  2006-08-29 12:32       ` Jens Axboe
@ 2006-08-30  8:55         ` Lee Trager
  2006-08-30  8:59           ` Jens Axboe
  0 siblings, 1 reply; 7+ messages in thread
From: Lee Trager @ 2006-08-30  8:55 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Alan Cox, akpm, linux-kernel, linux-ide, bzolnier

Jens Axboe wrote:
> On Tue, Aug 29 2006, Alan Cox wrote:
>   
>> Ar Maw, 2006-08-29 am 13:42 +0200, ysgrifennodd Jens Axboe:
>>     
>>> On Tue, Aug 29 2006, Alan Cox wrote:
>>>       
>>>> For -mm only to get more testing
>>>>
>>>> Acked-by: Alan Cox <alan@redhat.com>
>>>>         
>>> It should go into the state machine as described imho. Bart?
>>>       
>> If it works then yes it can become an explicit state. Firstly we need to
>> find out if it works.
>>     
>
> I think Lee tested and verified both this variant and the first one he
> had, so I hope that it works :-)
>
>   
It looks like we cross mailed. Anyway my patch is going into the mm
sources for testing. For the record I've been using this for the past
few weeks and its working great. I'll try to figure out how to create
it's own resume step next and submit that.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] HPA resume fix
  2006-08-30  8:55         ` Lee Trager
@ 2006-08-30  8:59           ` Jens Axboe
  0 siblings, 0 replies; 7+ messages in thread
From: Jens Axboe @ 2006-08-30  8:59 UTC (permalink / raw)
  To: Lee Trager; +Cc: Alan Cox, akpm, linux-kernel, linux-ide, bzolnier

On Wed, Aug 30 2006, Lee Trager wrote:
> Jens Axboe wrote:
> > On Tue, Aug 29 2006, Alan Cox wrote:
> >   
> >> Ar Maw, 2006-08-29 am 13:42 +0200, ysgrifennodd Jens Axboe:
> >>     
> >>> On Tue, Aug 29 2006, Alan Cox wrote:
> >>>       
> >>>> For -mm only to get more testing
> >>>>
> >>>> Acked-by: Alan Cox <alan@redhat.com>
> >>>>         
> >>> It should go into the state machine as described imho. Bart?
> >>>       
> >> If it works then yes it can become an explicit state. Firstly we need to
> >> find out if it works.
> >>     
> >
> > I think Lee tested and verified both this variant and the first one he
> > had, so I hope that it works :-)
> >
> >   
> It looks like we cross mailed. Anyway my patch is going into the mm
> sources for testing. For the record I've been using this for the past
> few weeks and its working great. I'll try to figure out how to create
> it's own resume step next and submit that.

Thanks, it should not be a lot of work!

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2006-08-30  8:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-29  9:55 [PATCH] HPA resume fix Lee Trager
2006-08-29 11:11 ` Alan Cox
2006-08-29 11:42   ` Jens Axboe
2006-08-29 12:50     ` Alan Cox
2006-08-29 12:32       ` Jens Axboe
2006-08-30  8:55         ` Lee Trager
2006-08-30  8:59           ` Jens Axboe

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).