linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lee Trager <Lee@PicturesInMotion.net>
To: Lee Trager <Lee@PicturesInMotion.net>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>, Pavel Machek <pavel@suse.cz>,
	"Rafael J. Wysocki" <rjw@sisk.pl>, Jason Lunz <lunz@falooley.org>,
	Jens Axboe <axboe@suse.de>, Andi Kleen <ak@suse.de>,
	linux-kernel@vger.kernel.org, linux-ide@vger.kernel.org,
	Stefan Seyfried <seife@suse.de>
Subject: Re: Merging libata PATA support into the base kernel
Date: Sun, 20 Aug 2006 20:44:03 -0400	[thread overview]
Message-ID: <44E901D3.4000902@PicturesInMotion.net> (raw)
In-Reply-To: <44E6C916.2030907@PicturesInMotion.net>

Lee Trager wrote:
> Alan Cox wrote:
>   
>> Ar Gwe, 2006-08-18 am 15:22 -0400, ysgrifennodd Lee Trager:
>>   
>>     
>>> Well where in the kernel is the code that disabled HPA on startup? Im
>>> new to kernel hacking so if you could point me in the right direction I
>>> could try to patch it myself.
>>>     
>>>       
>> drivers/ide/ide-disk.c
>>
>> Particularly:
>> 	idedisk_check_hpa()
>>
>> which if you call at the end of the resume sequence for disks ought to
>> do the right thing for you
>>
>> -
>> To unsubscribe from this list: send the line "unsubscribe linux-ide" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
>>   
>>     
> Well I tried to do exactly what you said. All that happens now is that
> it does not come out of resume. Below is a patch of the code I tried to
> do in case you could like to look at it. Basically I called
> idedisk_check_hpa at the end of generic_ide_resume() in drivers/ide/ide.c
>
> diff -Naur linux-2.6.18-rc4-old/drivers/ide/ide-disk.c
> linux-2.6.18-rc4/drivers/ide/ide-disk.c
> --- linux-2.6.18-rc4-old/drivers/ide/ide-disk.c    2006-08-19
> 03:49:03.000000000 -0400
> +++ linux-2.6.18-rc4/drivers/ide/ide-disk.c    2006-08-19
> 03:41:33.000000000 -0400
> @@ -464,16 +464,6 @@
>  }
>  
>  /*
> - * Bits 10 of command_set_1 and cfs_enable_1 must be equal,
> - * so on non-buggy drives we need test only one.
> - * However, we should also check whether these fields are valid.
> - */
> -static inline int idedisk_supports_hpa(const struct hd_driveid *id)
> -{
> -    return (id->command_set_1 & 0x0400) && (id->cfs_enable_1 & 0x0400);
> -}
> -
> -/*
>   * The same here.
>   */
>  static inline int idedisk_supports_lba48(const struct hd_driveid *id)
> @@ -482,7 +472,7 @@
>             && id->lba_capacity_2;
>  }
>  
> -static void idedisk_check_hpa(ide_drive_t *drive)
> +void idedisk_check_hpa(ide_drive_t *drive)
>  {
>      unsigned long long capacity, set_max;
>      int lba48 = idedisk_supports_lba48(drive->id);
> @@ -514,6 +504,8 @@
>      }
>  }
>  
> +EXPORT_SYMBOL(idedisk_check_hpa);
> +
>  /*
>   * Compute drive->capacity, the full capacity of the drive
>   * Called with drive->id != NULL.
> diff -Naur linux-2.6.18-rc4-old/drivers/ide/ide.c
> linux-2.6.18-rc4/drivers/ide/ide.c
> --- linux-2.6.18-rc4-old/drivers/ide/ide.c    2006-08-19
> 03:49:03.000000000 -0400
> +++ linux-2.6.18-rc4/drivers/ide/ide.c    2006-08-19 03:41:33.000000000
> -0400
> @@ -1242,6 +1242,13 @@
>      rqpm.pm_step = ide_pm_state_start_resume;
>      rqpm.pm_state = PM_EVENT_ON;
>  
> +    /* check to see if this is a hard drive
> +     * if it is then checkhpa needs to be
> +     * disabled */
> +    if(drive->media == ide_disk)
> +        if(idedisk_supports_hpa(drive->id))
> +            idedisk_check_hpa(drive);
> +
>      return ide_do_drive_cmd(drive, &rq, ide_head_wait);
>  }
> diff -Naur linux-2.6.18-rc4-old/include/linux/ide.h
> linux-2.6.18-rc4/include/linux/ide.h
> --- linux-2.6.18-rc4-old/include/linux/ide.h    2006-08-19
> 03:49:03.000000000 -0400
> +++ linux-2.6.18-rc4/include/linux/ide.h    2006-08-19
> 03:42:53.000000000 -0400
> @@ -1377,4 +1377,16 @@
>      return dev ? pcibus_to_node(dev->bus) : -1;
>  }
>  
> +extern void idedisk_check_hpa(ide_drive_t *drive);
> +
> +/*
> + *  * Bits 10 of command_set_1 and cfs_enable_1 must be equal,
> + *   * so on non-buggy drives we need test only one.
> + *    * However, we should also check whether these fields are valid.
> + *     */
> +static inline int idedisk_supports_hpa(const struct hd_driveid *id)
> +{
> +        return (id->command_set_1 & 0x0400) && (id->cfs_enable_1 & 0x0400);
> +}
> +
>  #endif /* _IDE_H */
>
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-ide" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
>   
Ok I have it working now. The problem was that I had to call
ide_do_drive_cmd() first and then I had to call init_idedisk_capacity()
instead of idedisk_check_hpa(). Anyway im submitting the patch on the list.

Thanks,


Lee Trager

  reply	other threads:[~2006-08-21  0:44 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-09 17:29 Merging libata PATA support into the base kernel Alan Cox
2006-08-09 20:16 ` Mark Lord
2006-08-10  6:13   ` Jeff Garzik
2006-08-10  6:20     ` Jan Engelhardt
2006-08-10  6:25     ` Olaf Hering
2006-08-11 15:47     ` Mark Lord
2006-08-15 13:31       ` Matthieu CASTET
2006-08-15 13:35         ` Tejun Heo
2006-08-15 14:01         ` Jeff Garzik
2006-08-09 21:21 ` /dev/sd* Adrian Bunk
2006-08-09 21:40   ` /dev/sd* Mark Lord
2006-08-09 22:01   ` /dev/sd* Alan Cox
2006-08-09 22:18     ` /dev/sd* Adrian Bunk
2006-08-10  1:44       ` /dev/sd* Alan Cox
2006-08-10  6:19         ` /dev/sd* Jan Engelhardt
2006-08-10  4:46       ` /dev/sd* Greg KH
2006-08-10 12:36       ` /dev/sd* Gabor Gombas
2006-08-10 12:37         ` /dev/sd* Jeff Garzik
2006-08-17  3:17           ` /dev/sd* Lee Trager
2006-08-17  7:58             ` /dev/sd* Michael Tokarev
2006-08-17  8:10               ` /dev/sd* Jan Engelhardt
2006-08-17  8:42               ` /dev/sd* Alan Cox
2006-08-17  8:01             ` /dev/sd* Jan Engelhardt
2006-08-17  8:29               ` /dev/sd* Lee Trager
2006-08-17  9:21                 ` /dev/sd* Jan Engelhardt
2006-08-18  7:11                   ` /dev/sd* Seewer Philippe
2006-08-18  8:52                     ` /dev/sd* Jan Engelhardt
2006-08-18  9:19                       ` /dev/sd* Tejun Heo
2006-08-18 14:57                       ` /dev/sd* Alan Cox
2006-08-18 15:51                         ` /dev/sd* Jan Engelhardt
2006-08-18 16:47                           ` /dev/sd* Lee Revell
2006-08-18 17:02                           ` /dev/sd* Alan Cox
2006-08-21  6:04                             ` /dev/sd* Lee Trager
2006-08-21  6:17                               ` /dev/sd* Jan Engelhardt
2006-08-18 12:45                     ` /dev/sd* Bill Davidsen
2006-08-18 15:48                       ` /dev/sd* Jan Engelhardt
2006-08-19  0:15                       ` /dev/sd* Gabor Gombas
2006-08-17  8:45               ` /dev/sd* Alan Cox
2006-08-10  6:24 ` Merging libata PATA support into the base kernel Andi Kleen
2006-08-10 12:37   ` Alan Cox
2006-08-10 12:20     ` Jens Axboe
2006-08-10 14:14       ` Alan Cox
2006-08-10 13:59         ` Jens Axboe
2006-08-10 15:54           ` Alan Cox
2006-08-10 19:02       ` Jason Lunz
2006-08-10 19:40         ` Rafael J. Wysocki
2006-08-17  3:26           ` Lee Trager
2006-08-17  9:18             ` Pavel Machek
2006-08-17  9:52               ` Alan Cox
2006-08-17  9:45                 ` Pavel Machek
2006-08-17 11:51                   ` Alan Cox
2006-08-18  3:38                     ` Lee Trager
2006-08-18  3:57                       ` Lee Trager
2006-08-18 16:01                         ` Alan Cox
2006-08-18 19:22                           ` Lee Trager
2006-08-18 20:50                             ` Alan Cox
2006-08-19  8:17                               ` Lee Trager
2006-08-21  0:44                                 ` Lee Trager [this message]
2006-08-10 19:47         ` Jens Axboe
2006-08-10 19:54           ` Rafael J. Wysocki
2006-08-11 15:48           ` Mark Lord
2006-08-10 22:27 ` Krzysztof Halasa
2006-08-24  3:31 ` Albert Lee
2006-08-24  3:38   ` Jeff Garzik
2006-08-24  4:13     ` Doug Maxey

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=44E901D3.4000902@PicturesInMotion.net \
    --to=lee@picturesinmotion.net \
    --cc=ak@suse.de \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=axboe@suse.de \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lunz@falooley.org \
    --cc=pavel@suse.cz \
    --cc=rjw@sisk.pl \
    --cc=seife@suse.de \
    /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;
as well as URLs for NNTP newsgroup(s).