From: Pavel Machek <pavel@ucw.cz>
To: Lee Trager <Lee@PicturesInMotion.net>
Cc: B.Zolnierkiewicz@elka.pw.edu.pl, linux-ide@vger.kernel.org,
linux-kernel@vger.kernel.org, akpm@osdl.org, seife@suse.de
Subject: Re: HPA Resume patch
Date: Sun, 27 Aug 2006 15:06:08 +0000 [thread overview]
Message-ID: <20060827150608.GA4534@ucw.cz> (raw)
In-Reply-To: <44F15ADB.5040609@PicturesInMotion.net>
Hi!
> 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. I've
> tested this patch on 2.6.17.x and 2.6.18-rc4 and it works great on both
> of these. This patch also fixes the bug #6840. This is my first patch to
> the kernel and I was told to e-mail the above people to get my patch
> into the kernel.
Congratulations for a first patch.
> If I made a mistake please be gentle and correct me ;)
We'll need signed-off-by: line next time.
Stefan, can we get this some testing? Or anyone else with thinkpad
with host-protected area still enabled?
Pavel
> 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-20 19:13:10.000000000 -0400
> @@ -1201,6 +1201,17 @@
> void ide_register_subdriver(ide_drive_t *, ide_driver_t *);
> void ide_unregister_subdriver(ide_drive_t *, ide_driver_t *);
>
> +/* 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);
> +}
> +
> +extern void init_idedisk_capacity (ide_drive_t *drive);
> +
> #define ON_BOARD 1
> #define NEVER_BOARD 0
>
> 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-20 19:13:56.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)
> @@ -528,7 +518,7 @@
> * in above order (i.e., if value of higher priority is available,
> * reset will be ignored).
> */
> -static void init_idedisk_capacity (ide_drive_t *drive)
> +void init_idedisk_capacity (ide_drive_t *drive)
> {
> struct hd_driveid *id = drive->id;
> /*
> @@ -555,6 +545,8 @@
> }
> }
>
> +EXPORT_SYMBOL(init_idedisk_capacity);
> +
> static sector_t idedisk_capacity (ide_drive_t *drive)
> {
> return drive->capacity64 - drive->sect0;
> 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-20 19:12:38.000000000 -0400
> @@ -1232,6 +1232,7 @@
> struct request rq;
> struct request_pm_state rqpm;
> ide_task_t args;
> + int ide_cmd;
>
> memset(&rq, 0, sizeof(rq));
> memset(&rqpm, 0, sizeof(rqpm));
> @@ -1242,7 +1243,15 @@
> rqpm.pm_step = ide_pm_state_start_resume;
> rqpm.pm_state = PM_EVENT_ON;
>
> - return ide_do_drive_cmd(drive, &rq, ide_head_wait);
> + ide_cmd = ide_do_drive_cmd(drive, &rq, ide_head_wait);
> +
> + /* check to see if this is a hard drive
> + * if it is then checkhpa needs to be
> + * disabled */
> + if(drive->media == ide_disk && idedisk_supports_hpa(drive->id))
> + init_idedisk_capacity(drive);
> +
> + return ide_cmd;
> }
>
> int generic_ide_ioctl(ide_drive_t *drive, struct file *file, struct block_device *bdev,
--
Thanks for all the (sleeping) penguins.
next prev parent reply other threads:[~2006-08-27 15:16 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-27 8:42 HPA Resume patch Lee Trager
2006-08-27 10:16 ` Sergey Vlasov
2006-08-27 15:06 ` Pavel Machek [this message]
2006-08-27 17:05 ` Jens Axboe
2006-08-29 2:14 ` Lee Trager
2006-08-29 4:00 ` Randy.Dunlap
2006-08-29 9:10 ` Lee Trager
2006-08-29 9:12 ` Jens Axboe
2006-09-02 8:53 ` Lee Trager
2006-08-29 14:14 ` Valdis.Kletnieks
2006-08-27 17:09 ` Randy.Dunlap
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=20060827150608.GA4534@ucw.cz \
--to=pavel@ucw.cz \
--cc=B.Zolnierkiewicz@elka.pw.edu.pl \
--cc=Lee@PicturesInMotion.net \
--cc=akpm@osdl.org \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--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).