Thread (3 messages) flat view 3 messages, 3 authors, 2001-01-08

ibook, hda power off sequence (for IBM travelstar)

From: Conrad H Ziesler <hidden>
Date: 2001-01-06 22:28:22

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/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help