Linux ATA/IDE development
 help / color / mirror / Atom feed
From: Shaohua Li <shaohua.li@intel.com>
To: "Randy.Dunlap" <rdunlap@xenotime.net>
Cc: linux-ide <linux-ide@vger.kernel.org>,
	lkml <linux-kernel@vger.kernel.org>, pavel <pavel@ucw.cz>,
	Len Brown <len.brown@intel.com>,
	Matthew Garrett <mjg59@srcf.ucam.org>, akpm <akpm@osdl.org>
Subject: Re: [RFC]add ACPI hooks for IDE suspend/resume
Date: Wed, 07 Dec 2005 09:15:57 +0800	[thread overview]
Message-ID: <1133918157.2936.5.camel@sli10-mobl.sh.intel.com> (raw)
In-Reply-To: <Pine.LNX.4.58.0512061557420.5519@shark.he.net>

On Tue, 2005-12-06 at 16:11 -0800, Randy.Dunlap wrote:
> On Tue, 6 Dec 2005, Shaohua Li wrote:
> 
> > Hi,
> > Adding ACPI IDE hook in IDE suspend/resume. The ACPI spec
> > explicitly says we must call some ACPI methods to restore IDE drives.
> > The sequences defined by ACPI spec are:
> > suspend:
> > 1. Get the DMA and PIO info from IDE channel's _GTM method.
> >
> > resume:
> > 1. Calling IDE channel's _STM to set the transfer timing setting.
> > 2. For each drive on the IDE channel, running drive's _GTF to get the
> > ATA commands required to reinitialize each drive.
> > 3. Sending the ATA commands gotton from step 2 to drives.
> >
> > TODO: invoking ATA commands.
> >
> > Though we didn't invoke ATA commands, this patch fixes the bug at
> > http://bugzilla.kernel.org/show_bug.cgi?id=5604. And Matthew said this
> > actually fixes a lot of systems in his test.
> > I'm not familiar with IDE, so comments/suggestions are welcome.
> >
> > ---
> >
> >  linux-2.6.15-rc5-root/drivers/ide/ide.c |  282 ++++++++++++++++++++++++++++++++
> >  1 files changed, 282 insertions(+)
> >
> > diff -puN drivers/ide/ide.c~acpi-ide drivers/ide/ide.c
> > --- linux-2.6.15-rc5/drivers/ide/ide.c~acpi-ide	2005-12-07 03:01:36.000000000 +0800
> > +++ linux-2.6.15-rc5-root/drivers/ide/ide.c	2005-12-07 03:01:36.000000000 +0800
> > @@ -155,6 +155,10 @@
> >  #include <linux/device.h>
> >  #include <linux/bitops.h>
> >
> > +#ifdef CONFIG_ACPI
> > +#include <linux/acpi.h>
> > +#endif
> 
> Shouldn't need or use ifdef/endif for #includes.
Ok.

> > +
> > +/* The _GTM return package length is 5 dwords */
> > +#define GTM_LEN (sizeof(u32) * 5)
> > +struct acpi_ide_state {
> > +	acpi_handle handle; /* channel device's handle */
> > +	u32 gtm[GTM_LEN/sizeof(u32)]; /* info from _GTM */
> > +	struct hd_driveid id_buff[2]; /* one chanel has two drives */
> 
> s/2/MAX_DRIVES/
> s/chanel/channel/
:), thanks!

> > +	if (!handle) {
> > +		printk(KERN_DEBUG "IDE device's ACPI handler is NULL\n");
> 
> s/handler/handle/ ??
A typo.


> > +	status = acpi_evaluate_object(parent_handle, "_GTM", NULL, &buffer);
> > +	if (ACPI_FAILURE(status)) {
> > +		printk(KERN_ERR "Error evaluating _GTM\n");
> 
> I don't read the ACPI spec. as saying that _GTM is required, (?)
> so I would make this a KERN_DEBUG instead of KERN_ERR.
Yes, _GTM is required.


> > +	status = acpi_evaluate_object(state->handle, "_STM", &input, NULL);
> > +	if (ACPI_FAILURE(status)) {
> > +		printk(KERN_ERR "Evaluating _STM error\n");
> 
> Same as for _GTM, KERN_DEBUG instead of KERN_ERR.
_STM also is required.

> > +	acpi_status status;
> > +
> > +	status = acpi_evaluate_object(handle, "_GTF", NULL, &output);
> > +	if (ACPI_FAILURE(status)) {
> > +		printk(KERN_ERR "evaluate _GTF error\n");
> 
> KERN_DEBUG if not present since it's not required AFAIK.
Actually it's required, but I have no idea how to invoke the ata
commands gotten from _GTF.

Thanks for your time. I'll update this patch as you suggested after the
IDE gurus think it's ok.

Thanks,
Shaohua


  reply	other threads:[~2005-12-07 17:16 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-06  6:10 [RFC]add ACPI hooks for IDE suspend/resume Shaohua Li
2005-12-06 22:20 ` Matthew Garrett
2005-12-06 22:50   ` Alan Cox
2005-12-07  8:17   ` Bartlomiej Zolnierkiewicz
2005-12-07 13:14     ` Matthew Garrett
2005-12-07 14:19       ` Bartlomiej Zolnierkiewicz
2005-12-07 14:26         ` Bartlomiej Zolnierkiewicz
2005-12-07 14:34           ` Matthew Garrett
2005-12-07 14:33         ` Matthew Garrett
2005-12-07 14:45           ` Bartlomiej Zolnierkiewicz
2005-12-07 14:58             ` Matthew Garrett
2005-12-07 15:44               ` Bartlomiej Zolnierkiewicz
2005-12-07 15:53                 ` Matthew Garrett
2005-12-07 15:41             ` Alan Cox
2005-12-07 15:49               ` Bartlomiej Zolnierkiewicz
2005-12-07  1:22                 ` Shaohua Li
2005-12-07 19:15                   ` Bartlomiej Zolnierkiewicz
2005-12-07 22:35                     ` Alan Cox
2005-12-07 22:42                       ` Bartlomiej Zolnierkiewicz
2005-12-07 22:43                       ` Pavel Machek
2005-12-07 22:48                         ` Matthew Garrett
2005-12-07  0:11 ` Randy.Dunlap
2005-12-07  1:15   ` Shaohua Li [this message]
  -- strict thread matches above, loose matches on Subject: below --
2005-12-07 21:58 Li, Shaohua
2005-12-07 23:19 Li, Shaohua

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=1133918157.2936.5.camel@sli10-mobl.sh.intel.com \
    --to=shaohua.li@intel.com \
    --cc=akpm@osdl.org \
    --cc=len.brown@intel.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mjg59@srcf.ucam.org \
    --cc=pavel@ucw.cz \
    --cc=rdunlap@xenotime.net \
    /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