[openfirmware] [commit] r2991 - cpu/arm/olpc/1.75 cpu/x86/pc/olpc cpu/x86/pc/olpc/via dev/olpc

repository service svn at openfirmware.info
Thu May 31 08:47:17 CEST 2012


Author: quozl
Date: Thu May 31 08:47:17 2012
New Revision: 2991
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2991

Log:
OLPC - lid close consistent across models, made into common code, #11095

Added:
   dev/olpc/lid.fth
Modified:
   cpu/arm/olpc/1.75/switches.fth
   cpu/x86/pc/olpc/fw.bth
   cpu/x86/pc/olpc/via/cstate.fth

Modified: cpu/arm/olpc/1.75/switches.fth
==============================================================================
--- cpu/arm/olpc/1.75/switches.fth	Thu May 31 07:28:43 2012	(r2990)
+++ cpu/arm/olpc/1.75/switches.fth	Thu May 31 08:47:17 2012	(r2991)
@@ -36,39 +36,7 @@
    ['] all-switch-states catch
 ;
 
-false value lid-already-down?
-0 value lid-down-time
-d# 10000 constant lid-shutdown-ms
-d#  2000 constant lid-warning-ms
-0 value lid-warned?
-
-: ?lid-shutdown  ( -- )
-   lid?  if
-      lid-already-down?  if
-         get-msecs lid-down-time -               ( ms )
-
-         dup lid-warning-ms >=  lid-warned? 0=  and  if
-            ." Lid switch is active - Powering off in 8 seconds" cr
-            ." Type  lid-off  to disable this function" cr
-            true to lid-warned?
-         then                                    ( ms )
-
-         lid-shutdown-ms >=  if
-            ." Powering off after 10 seconds of lid down" cr
-            power-off
-         then
-      else
-         get-msecs to lid-down-time
-         true to lid-already-down?
-      then
-   else
-      false to lid-already-down?
-      false to lid-warned?
-   then
-;
-: lid-on  ( -- )  ['] ?lid-shutdown to do-lid  ;
-' lid-on to do-lid
-
+fload ${BP}/dev/olpc/lid.fth
 end-package
 
 \ LICENSE_BEGIN

Modified: cpu/x86/pc/olpc/fw.bth
==============================================================================
--- cpu/x86/pc/olpc/fw.bth	Thu May 31 07:28:43 2012	(r2990)
+++ cpu/x86/pc/olpc/fw.bth	Thu May 31 08:47:17 2012	(r2991)
@@ -479,7 +479,10 @@
 
 " dhcp" ' ip-address  set-config-string-default
 
-: c1-idle  ( -- )  interrupts-enabled?  if  halt  then  ;
+: lid?  ( -- flag )  h# 30 >hi gpio@  h# 400 and 0=  ;
+fload ${BP}/dev/olpc/lid.fth
+
+: c1-idle  ( -- )  interrupts-enabled?  if  halt  then  do-lid  ;
 ' c1-idle to stdin-idle
 
 : fast-boot?  ( -- flag )

Modified: cpu/x86/pc/olpc/via/cstate.fth
==============================================================================
--- cpu/x86/pc/olpc/via/cstate.fth	Thu May 31 07:28:43 2012	(r2990)
+++ cpu/x86/pc/olpc/via/cstate.fth	Thu May 31 08:47:17 2012	(r2991)
@@ -28,42 +28,8 @@
    then
 ;
 
-: lid-down?  ( -- flag )  h# 48 acpi-l@ h# 80 and 0=  ;
-false value lid-already-down?
-0 value lid-down-time
-d# 10000 constant lid-shutdown-ms
-d#  2000 constant lid-warning-ms
-0 value lid-warned?
-
-: ?lid-shutdown  ( -- )
-   lid-down?  if
-      lid-already-down?  if
-         acpi-timer@ lid-down-time -  d# 3580 /  ( ms )
-
-         dup lid-warning-ms >=  lid-warned? 0=  and  if
-            ." Lid switch is active - Powering off in 8 seconds" cr
-            ." Type  lid-off  to disable this function" cr
-            true to lid-warned?
-         then                                    ( ms )
-
-         lid-shutdown-ms >=  if
-            ." Powering off after 10 seconds of lid down" cr
-            power-off
-         then
-      else
-         acpi-timer@ to lid-down-time
-         true to lid-already-down?
-      then
-   else
-      false to lid-already-down?
-      false to lid-warned?
-   then
-;
-
-defer do-lid
-: lid-on  ( -- )  ['] ?lid-shutdown to do-lid  ;
-: lid-off ( -- )  ['] noop to do-lid  ;
-lid-on
+: lid?  ( -- flag )  h# 48 acpi-l@ h# 80 and 0=  ;
+fload ${BP}/dev/olpc/lid.fth
 
 defer do-idle  ' noop to do-idle
 

Added: dev/olpc/lid.fth
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dev/olpc/lid.fth	Thu May 31 08:47:17 2012	(r2991)
@@ -0,0 +1,68 @@
+\ See license at end of file
+purpose: lid close triggers power off
+
+false value lid-already-down?
+0 value lid-down-time
+d# 10000 constant lid-shutdown-ms
+d#  2000 constant lid-warning-ms
+0 value lid-warned?
+
+: ?lid-shutdown  ( -- )
+   lid?  if
+      lid-already-down?  if
+         get-msecs lid-down-time -               ( ms )
+
+	 dup lid-warning-ms >=  lid-warned? 0=  and  if
+	    cr
+            ." Lid switch is active - powering off in 8 seconds" cr
+            ." Type  lid-off  to disable this" cr
+            true to lid-warned?
+         then                                    ( ms )
+
+         lid-shutdown-ms >=  if
+            ." Powering off after 10 seconds of lid down" cr
+            power-off
+         then
+      else
+         get-msecs to lid-down-time
+         true to lid-already-down?
+      then
+   else
+      false to lid-already-down?
+      false to lid-warned?
+   then
+;
+
+[ifndef] do-lid
+defer do-lid
+[then]
+
+: lid-on  ( -- )  ['] ?lid-shutdown to do-lid  ;
+[ifndef] lid-off
+: lid-off ( -- )  ['] noop to do-lid  ;
+[then]
+' lid-on to do-lid
+
+\ LICENSE_BEGIN
+\ Copyright (c) 2011 FirmWorks
+\ 
+\ Permission is hereby granted, free of charge, to any person obtaining
+\ a copy of this software and associated documentation files (the
+\ "Software"), to deal in the Software without restriction, including
+\ without limitation the rights to use, copy, modify, merge, publish,
+\ distribute, sublicense, and/or sell copies of the Software, and to
+\ permit persons to whom the Software is furnished to do so, subject to
+\ the following conditions:
+\ 
+\ The above copyright notice and this permission notice shall be
+\ included in all copies or substantial portions of the Software.
+\ 
+\ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+\ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+\ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+\ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+\ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+\ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+\ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+\
+\ LICENSE_END



More information about the openfirmware mailing list