linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* ibook, hda power off sequence (for IBM travelstar)
@ 2001-01-06 22:28 Conrad H Ziesler
  2001-01-08 11:26 ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 5+ messages in thread
From: Conrad H Ziesler @ 2001-01-06 22:28 UTC (permalink / raw)
  To: linuxppc-dev


The IBM travelstar hd in the ibook wants a sleep command sent before poweroff.
According to the IBM docs, this orderly shutdown extends the life of some
component stressed by the emergency power fail head lifting mechanism.
It also stops that loud click that happens on linux power off.


This bit of code replaces pmu_shutdown from via-pmu.c, its the easiest
hack to get the IDE code to issue a sleep command to the disk at shutdown
time.

--conrad


void __openfirmware
pmu_shutdown(void)
{
  struct adb_request req;
  int ret;

  ret = broadcast_sleep(PBOOK_SLEEP_REQUEST, PBOOK_SLEEP_REJECT);
  if (ret != PBOOK_SLEEP_OK)
    printk("pmu: shutdown sleep rejected\n");
  fsync_dev(0);
  ret = broadcast_sleep(PBOOK_SLEEP_NOW, PBOOK_WAKE);
  if (ret != PBOOK_SLEEP_OK)
    printk("pmu: shutdown sleep failed\n");

  _disable_interrupts();

  pmu_request(&req, NULL, 2, PMU_SET_INTR_MASK, PMU_INT_ADB |
	      PMU_INT_TICK );
  while(!req.complete)
    pmu_poll();

  pmu_request(&req, NULL, 5, PMU_SHUTDOWN,
	      'M', 'A', 'T', 'T');
  while(!req.complete || (pmu_state != idle))
    pmu_poll();
  for (;;)
    ;
}


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

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

* Re: ibook, hda power off sequence (for IBM travelstar)
  2001-01-06 22:28 ibook, hda power off sequence (for IBM travelstar) Conrad H Ziesler
@ 2001-01-08 11:26 ` Benjamin Herrenschmidt
  2001-01-08 14:32   ` Andreas Tobler
  0 siblings, 1 reply; 5+ messages in thread
From: Benjamin Herrenschmidt @ 2001-01-08 11:26 UTC (permalink / raw)
  To: Conrad H Ziesler, linuxppc-dev


>
>This bit of code replaces pmu_shutdown from via-pmu.c, its the easiest
>hack to get the IDE code to issue a sleep command to the disk at shutdown
>time.

Broadcasting fake sleep requests is definitely not the correct way to
acheive what you want. Either add direct call to some ide-pmac sleep
function in the arch shutdown function, or use the shutdown notifiers in
ide-pmac to force a disk shutdown.

I'll have a look at it when I'm really back.

Ben.


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

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

* Re: ibook, hda power off sequence (for IBM travelstar)
  2001-01-08 11:26 ` Benjamin Herrenschmidt
@ 2001-01-08 14:32   ` Andreas Tobler
  2001-01-11  0:37     ` Henner Eisen
  0 siblings, 1 reply; 5+ messages in thread
From: Andreas Tobler @ 2001-01-08 14:32 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: Conrad H Ziesler, linuxppc-dev


Hi all,


Benjamin Herrenschmidt wrote:
>
> >
> >This bit of code replaces pmu_shutdown from via-pmu.c, its the easiest
> >hack to get the IDE code to issue a sleep command to the disk at shutdown
> >time.
>
> Broadcasting fake sleep requests is definitely not the correct way to
> acheive what you want. Either add direct call to some ide-pmac sleep
> function in the arch shutdown function, or use the shutdown notifiers in
> ide-pmac to force a disk shutdown.
>
> I'll have a look at it when I'm really back.

I'm also interested in this fix since I got my travelstar DJSA-220
finally to work on a WALLSTREET! I remarked the same noisy click and
since the troubles I had with a dead toshiba I pay very much attention
to strange noises.

For those who have a wallstreet and a travelstar, here the link which
made my combination work.

http://www.xlr8yourmac.com/PB_G3/wallstreet_hard_drive/

I first thought I really have to buy a new Powerbook.

Only a notice, it may help some one.....

Cheers

Andreas

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

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

* Re: ibook, hda power off sequence (for IBM travelstar)
  2001-01-08 14:32   ` Andreas Tobler
@ 2001-01-11  0:37     ` Henner Eisen
  2001-01-12 14:56       ` Karim Yaghmour
  0 siblings, 1 reply; 5+ messages in thread
From: Henner Eisen @ 2001-01-11  0:37 UTC (permalink / raw)
  To: toa; +Cc: linuxppc-dev


>>>>> "Andreas" == Andreas Tobler <toa@pop.agri.ch> writes:

    Andreas> I'm also interested in this fix since I got my travelstar
    Andreas> DJSA-220 finally to work on a WALLSTREET! I remarked the
    Andreas> same noisy click and since the troubles I had with a dead
    Andreas> toshiba I pay very much attention to strange noises.

I just replaced the original 3GB hard disk (Fujitsu MHH 2032AT) of my
revision 1 iBook by a 20 MB (Toshiba MK2016GAP) drive. This works without
problems, except that halting the machine now also causes a rather noisy hard
drive click.

A quick fix to remove this for init-controlled shutdown is
to just append a `hdparm -Y' to the /etc/rc.d/halt script such
that the drive will put into sleep mode before power is switched off.

The only problem is that `hdparm' cannot be the very last command because
the last command needs to be `reboot' or `halt'. One needs to make sure
that `reboot' or `halt' is already in the buffer cache before it is
executed -- otherwise, the system will restart the hard drive in
order to read the `halt' or `reboot' executable from disk. In order to
get them (and the portions of the shell that will execute it) into the
buffer cache, some dummy access to these objects need to be made before
hdparm is called. The follwing modification to the tail of SuSE 6.4
/etc/rc.c/halt scripts causes the HD noise on power down to disappear.
I guess it should work similarly for all sysvinit based systems.


 mount -no remount,ro / 2> /dev/null
 sync

 echo $message
+cat /sbin/$command > /dev/null
+( exec /bin/echo > /dev/null )
+hdparm -Y /dev/hda
 exec $command -d -f


Henner

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

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

* Re: ibook, hda power off sequence (for IBM travelstar)
  2001-01-11  0:37     ` Henner Eisen
@ 2001-01-12 14:56       ` Karim Yaghmour
  0 siblings, 0 replies; 5+ messages in thread
From: Karim Yaghmour @ 2001-01-12 14:56 UTC (permalink / raw)
  To: Henner Eisen; +Cc: toa, linuxppc-dev


Hello Henner,

Nice solution.

This is most usefull to me since I often change kernel versions and couldn't
afford modifying the code every time I change kernels.

Cheers.

Karim

Henner Eisen wrote:
>
> >>>>> "Andreas" == Andreas Tobler <toa@pop.agri.ch> writes:
>
>     Andreas> I'm also interested in this fix since I got my travelstar
>     Andreas> DJSA-220 finally to work on a WALLSTREET! I remarked the
>     Andreas> same noisy click and since the troubles I had with a dead
>     Andreas> toshiba I pay very much attention to strange noises.
>
> I just replaced the original 3GB hard disk (Fujitsu MHH 2032AT) of my
> revision 1 iBook by a 20 MB (Toshiba MK2016GAP) drive. This works without
> problems, except that halting the machine now also causes a rather noisy hard
> drive click.
>
> A quick fix to remove this for init-controlled shutdown is
> to just append a `hdparm -Y' to the /etc/rc.d/halt script such
> that the drive will put into sleep mode before power is switched off.
>
> The only problem is that `hdparm' cannot be the very last command because
> the last command needs to be `reboot' or `halt'. One needs to make sure
> that `reboot' or `halt' is already in the buffer cache before it is
> executed -- otherwise, the system will restart the hard drive in
> order to read the `halt' or `reboot' executable from disk. In order to
> get them (and the portions of the shell that will execute it) into the
> buffer cache, some dummy access to these objects need to be made before
> hdparm is called. The follwing modification to the tail of SuSE 6.4
> /etc/rc.c/halt scripts causes the HD noise on power down to disappear.
> I guess it should work similarly for all sysvinit based systems.
>
>  mount -no remount,ro / 2> /dev/null
>  sync
>
>  echo $message
> +cat /sbin/$command > /dev/null
> +( exec /bin/echo > /dev/null )
> +hdparm -Y /dev/hda
>  exec $command -d -f
>
> Henner
>

--
===================================================
                 Karim Yaghmour
               karym@opersys.com
          Operating System Consultant
 (Linux kernel, real-time and distributed systems)
===================================================

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

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

end of thread, other threads:[~2001-01-12 14:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-01-06 22:28 ibook, hda power off sequence (for IBM travelstar) Conrad H Ziesler
2001-01-08 11:26 ` Benjamin Herrenschmidt
2001-01-08 14:32   ` Andreas Tobler
2001-01-11  0:37     ` Henner Eisen
2001-01-12 14:56       ` Karim Yaghmour

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