Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/macppc/macppc Enter power saving mode in idle loop ...



details:   https://anonhg.NetBSD.org/src/rev/00a1806392b0
branches:  trunk
changeset: 481869:00a1806392b0
user:      tsubai <tsubai%NetBSD.org@localhost>
date:      Tue Feb 08 12:49:06 2000 +0000

description:
Enter power saving mode in idle loop on 603, 750, and 7400.
603 uses doze mode, 750 and 7400 use nap mode.

diffstat:

 sys/arch/macppc/macppc/cpu.c    |  18 ++++++++++++++----
 sys/arch/macppc/macppc/locore.S |  19 ++++++++++++++++---
 2 files changed, 30 insertions(+), 7 deletions(-)

diffs (84 lines):

diff -r 31467e745cab -r 00a1806392b0 sys/arch/macppc/macppc/cpu.c
--- a/sys/arch/macppc/macppc/cpu.c      Tue Feb 08 12:43:25 2000 +0000
+++ b/sys/arch/macppc/macppc/cpu.c      Tue Feb 08 12:49:06 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.c,v 1.5 2000/01/21 18:49:52 tsubai Exp $   */
+/*     $NetBSD: cpu.c,v 1.6 2000/02/08 12:49:06 tsubai Exp $   */
 
 /*-
  * Copyright (C) 1998, 1999 Internet Research Institute, Inc.
@@ -49,6 +49,7 @@
 };
 
 extern struct cfdriver cpu_cd;
+extern int powersave;
 
 int
 cpumatch(parent, cf, aux)
@@ -89,13 +90,22 @@
        case MPC603:
        case MPC603e:
        case MPC603ev:
-       case MPC750:
-       case MPC7400:
-               /* Select DOZE power-save mode. */
+               /* Select DOZE power-saving mode. */
                __asm __volatile ("mfspr %0,1008" : "=r"(hid0));
                hid0 &= ~(HID0_DOZE | HID0_NAP | HID0_SLEEP);
                hid0 |= HID0_DOZE | HID0_DPM;
                __asm __volatile ("mtspr 1008,%0" :: "r"(hid0));
+               powersave = 1;
+               break;
+       case MPC750:
+       case MPC7400:
+               /* Select NAP power-saving mode. */
+               __asm __volatile ("mfspr %0,1008" : "=r"(hid0));
+               hid0 &= ~(HID0_DOZE | HID0_NAP | HID0_SLEEP);
+               hid0 |= HID0_NAP | HID0_DPM;
+               __asm __volatile ("mtspr 1008,%0" :: "r"(hid0));
+               powersave = 1;
+               break;
        }
 
        if ((pvr >> 16) == MPC750 || (pvr >> 16) == MPC7400)
diff -r 31467e745cab -r 00a1806392b0 sys/arch/macppc/macppc/locore.S
--- a/sys/arch/macppc/macppc/locore.S   Tue Feb 08 12:43:25 2000 +0000
+++ b/sys/arch/macppc/macppc/locore.S   Tue Feb 08 12:49:06 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locore.S,v 1.19 2000/01/19 03:28:21 danw Exp $ */
+/*     $NetBSD: locore.S,v 1.20 2000/02/08 12:49:07 tsubai Exp $       */
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -88,6 +88,9 @@
 GLOBAL(ofmsr)
        .long   0                       /* msr used in Open Firmware */
 
+GLOBAL(powersave)
+       .long   0
+
 /*
  * File-scope for locore.S
  */
@@ -331,9 +334,19 @@
        ori     3,3,PSL_EE@l            /* reenable ints again */
        mtmsr   3
        isync
-       
-/* May do some power saving here? */
+
+/* Check if we can use power saving mode */
+       lis     8,_C_LABEL(powersave)@ha
+       lwz     9,_C_LABEL(powersave)@l(8)
 
+       or.     9,9,9
+       beq     1f
+
+       sync
+       oris    3,3,PSL_POW@h           /* enter power saving mode */
+       mtmsr   3
+       isync
+1:
        b       _ASM_LABEL(Idle)
 
 /*



Home | Main Index | Thread Index | Old Index