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

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