Author: quozl
Date: Tue Jun 19 04:17:19 2012
New Revision: 3013
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/3013
Log:
OLPC - dev/usb2, revert svn 3011 as it broke production use of USB scanners, reproduced also by me.
Modified:
dev/usb2/hcd/device.fth
dev/usb2/hcd/ehci/probe.fth
Modified: dev/usb2/hcd/device.fth
==============================================================================
--- dev/usb2/hcd/device.fth Sat Jun 16 05:00:26 2012 (r3012)
+++ dev/usb2/hcd/device.fth Tue Jun 19 04:17:19 2012 (r3013)
@@ -391,30 +391,33 @@
\ Executed in root hub node context
: get-str-descriptors ( -- )
- language ( lang )
- dup d# 14 dev-desc@ v$-desc-buf get-string to /v$-desc-buf
- dup d# 15 dev-desc@ d$-desc-buf get-string to /d$-desc-buf
- d# 16 dev-desc@ s$-desc-buf get-string to /s$-desc-buf
+ language ( lang )
+ dup dev-desc-buf d# 14 + c@ v$-desc-buf get-string to /v$-desc-buf
+ dup dev-desc-buf d# 15 + c@ d$-desc-buf get-string to /d$-desc-buf
+ dev-desc-buf d# 16 + c@ s$-desc-buf get-string to /s$-desc-buf
;
\ Executed in root hub node context
: refresh-desc-bufs ( dev -- )
set-target
- dev-desc-buf d# 18 get-dev-desc to /dev-desc-buf \ Refresh dev-desc-buf
- cfg-desc-buf 0 get-cfg-desc to /cfg-desc-buf \ Refresh cfg-desc-buf
+ dev-desc-buf 12 get-dev-desc to /dev-desc-buf \ Refresh dev-desc-buf
+ cfg-desc-buf 0 get-cfg-desc to /cfg-desc-buf \ Refresh cfg-desc-buf
get-str-descriptors
;
\ Executed in root hub node context
-: get-initial-descriptors ( -- )
- \ Re-read the full device descriptor to pick up the vendor info
- dev-desc-buf d# 18 get-dev-desc drop ( )
- cfg-desc-buf 0 get-cfg-desc to /cfg-desc-buf ( )
+: get-initial-descriptors ( dev -- )
+ dev-desc-buf /pipe0 get-dev-desc if ( dev )
+ dev-desc-buf 7 + c@ 0 rot di-maxpayload! ( )
+ else ( dev )
+ drop ( )
+ then ( )
+ cfg-desc-buf 0 get-cfg-desc to /cfg-desc-buf ( )
;
\ Executed in hub node context (root hub or subordinate hub) - creates new child nodes via (make-device-node)
: make-device-node ( port dev -- )
- " get-initial-descriptors" my-self $call-method ( port dev )
+ dup " get-initial-descriptors" my-self $call-method ( port dev )
/cfg-desc-buf 0= if 2drop exit then ( port dev )
asso-class? if 1 else cfg-desc-buf 4 + c@ then ( port dev #intf )
0 ?do ( port dev )
@@ -440,16 +443,6 @@
then ( port )
;
-: get-initial-dev-desc ( dev -- )
- dev-desc-buf d# 18 erase ( dev )
- dev-desc-buf d# 64 get-dev-desc 0= if ( dev )
- dev-desc-buf /pipe0 get-dev-desc 0= if ( dev )
- drop exit
- then
- then
- 7 dev-desc@ 0 rot di-maxpayload! ( )
-;
-
\ Executed in the root hub node context
: setup-new-node ( port speed hub-port hub-dev -- true | port dev xt false )
\ Allocate device number
@@ -460,11 +453,7 @@
tuck di-speed! ( port dev )
0 set-target ( port dev ) \ Address it as device 0
-
- \ Some devices (e.g. Lexar USB-to-SD and at least one USB FLASH drive) fail
- \ on set-address unless you first read the device descriptor from address 0.
- dup get-initial-dev-desc ( port dev )
-
+ over reset-port ( port dev ) \ Some devices want to be reset here
dup set-address if ( port dev ) \ Assign it usb addr dev
." Retrying with a delay" cr
over reset-port d# 5000 ms
Modified: dev/usb2/hcd/ehci/probe.fth
==============================================================================
--- dev/usb2/hcd/ehci/probe.fth Sat Jun 16 05:00:26 2012 (r3012)
+++ dev/usb2/hcd/ehci/probe.fth Tue Jun 19 04:17:19 2012 (r3013)
@@ -7,16 +7,18 @@
0 value port-speed
: make-root-hub-node ( port -- )
+ \ Some devices (e.g. Lexar USB-to-SD) fail unless you get the cfg desc from device 0 first
0 set-target \ First address it as device 0 ( port )
port-speed 0 di-speed! \ Use high speed for getting the device descriptor
- dup reset-port ( port )
+ dev-desc-buf h# 40 get-cfg-desc drop ( port )
+
port-speed ( port speed )
\ hub-port and hub-dev route USB 1.1 transactions through USB 2.0 hubs
over get-hub20-port get-hub20-dev ( port speed hub-port hub-dev )
\ Execute setup-new-node in root context and make-device-node in hub node context
- setup-new-node if execute then ( )
+ setup-new-node if execute then ( )
;
0 instance value probe-error? \ Back channel to selftest
Author: quozl
Date: Sat Jun 16 04:13:21 2012
New Revision: 3011
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/3011
Log:
OLPC - dev/usb2, read the device descriptor after reset and before set-address, instead of after set-address. Erase the device descriptor buffer before reading. #11931
Modified:
dev/usb2/hcd/device.fth
dev/usb2/hcd/ehci/probe.fth
Modified: dev/usb2/hcd/device.fth
==============================================================================
--- dev/usb2/hcd/device.fth Fri Jun 15 03:58:55 2012 (r3010)
+++ dev/usb2/hcd/device.fth Sat Jun 16 04:13:21 2012 (r3011)
@@ -391,33 +391,30 @@
\ Executed in root hub node context
: get-str-descriptors ( -- )
- language ( lang )
- dup dev-desc-buf d# 14 + c@ v$-desc-buf get-string to /v$-desc-buf
- dup dev-desc-buf d# 15 + c@ d$-desc-buf get-string to /d$-desc-buf
- dev-desc-buf d# 16 + c@ s$-desc-buf get-string to /s$-desc-buf
+ language ( lang )
+ dup d# 14 dev-desc@ v$-desc-buf get-string to /v$-desc-buf
+ dup d# 15 dev-desc@ d$-desc-buf get-string to /d$-desc-buf
+ d# 16 dev-desc@ s$-desc-buf get-string to /s$-desc-buf
;
\ Executed in root hub node context
: refresh-desc-bufs ( dev -- )
set-target
- dev-desc-buf 12 get-dev-desc to /dev-desc-buf \ Refresh dev-desc-buf
- cfg-desc-buf 0 get-cfg-desc to /cfg-desc-buf \ Refresh cfg-desc-buf
+ dev-desc-buf d# 18 get-dev-desc to /dev-desc-buf \ Refresh dev-desc-buf
+ cfg-desc-buf 0 get-cfg-desc to /cfg-desc-buf \ Refresh cfg-desc-buf
get-str-descriptors
;
\ Executed in root hub node context
-: get-initial-descriptors ( dev -- )
- dev-desc-buf /pipe0 get-dev-desc if ( dev )
- dev-desc-buf 7 + c@ 0 rot di-maxpayload! ( )
- else ( dev )
- drop ( )
- then ( )
- cfg-desc-buf 0 get-cfg-desc to /cfg-desc-buf ( )
+: get-initial-descriptors ( -- )
+ \ Re-read the full device descriptor to pick up the vendor info
+ dev-desc-buf d# 18 get-dev-desc drop ( )
+ cfg-desc-buf 0 get-cfg-desc to /cfg-desc-buf ( )
;
\ Executed in hub node context (root hub or subordinate hub) - creates new child nodes via (make-device-node)
: make-device-node ( port dev -- )
- dup " get-initial-descriptors" my-self $call-method ( port dev )
+ " get-initial-descriptors" my-self $call-method ( port dev )
/cfg-desc-buf 0= if 2drop exit then ( port dev )
asso-class? if 1 else cfg-desc-buf 4 + c@ then ( port dev #intf )
0 ?do ( port dev )
@@ -443,6 +440,16 @@
then ( port )
;
+: get-initial-dev-desc ( dev -- )
+ dev-desc-buf d# 18 erase ( dev )
+ dev-desc-buf d# 64 get-dev-desc 0= if ( dev )
+ dev-desc-buf /pipe0 get-dev-desc 0= if ( dev )
+ drop exit
+ then
+ then
+ 7 dev-desc@ 0 rot di-maxpayload! ( )
+;
+
\ Executed in the root hub node context
: setup-new-node ( port speed hub-port hub-dev -- true | port dev xt false )
\ Allocate device number
@@ -453,7 +460,11 @@
tuck di-speed! ( port dev )
0 set-target ( port dev ) \ Address it as device 0
- over reset-port ( port dev ) \ Some devices want to be reset here
+
+ \ Some devices (e.g. Lexar USB-to-SD and at least one USB FLASH drive) fail
+ \ on set-address unless you first read the device descriptor from address 0.
+ dup get-initial-dev-desc ( port dev )
+
dup set-address if ( port dev ) \ Assign it usb addr dev
." Retrying with a delay" cr
over reset-port d# 5000 ms
Modified: dev/usb2/hcd/ehci/probe.fth
==============================================================================
--- dev/usb2/hcd/ehci/probe.fth Fri Jun 15 03:58:55 2012 (r3010)
+++ dev/usb2/hcd/ehci/probe.fth Sat Jun 16 04:13:21 2012 (r3011)
@@ -7,18 +7,16 @@
0 value port-speed
: make-root-hub-node ( port -- )
- \ Some devices (e.g. Lexar USB-to-SD) fail unless you get the cfg desc from device 0 first
0 set-target \ First address it as device 0 ( port )
port-speed 0 di-speed! \ Use high speed for getting the device descriptor
- dev-desc-buf h# 40 get-cfg-desc drop ( port )
-
+ dup reset-port ( port )
port-speed ( port speed )
\ hub-port and hub-dev route USB 1.1 transactions through USB 2.0 hubs
over get-hub20-port get-hub20-dev ( port speed hub-port hub-dev )
\ Execute setup-new-node in root context and make-device-node in hub node context
- setup-new-node if execute then ( )
+ setup-new-node if execute then ( )
;
0 instance value probe-error? \ Back channel to selftest
Author: quozl
Date: Wed Jun 13 07:05:13 2012
New Revision: 3007
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/3007
Log:
OLPC - security, add visual response to escape key when in secure mode, without consuming keystroke, to improve usability for service and support (since it is otherwise difficult to tell if a laptop is secured, or the keyboard is broken). #11609
Modified:
cpu/x86/pc/olpc/security.fth
Modified: cpu/x86/pc/olpc/security.fth
==============================================================================
--- cpu/x86/pc/olpc/security.fth Sat Jun 9 09:58:12 2012 (r3006)
+++ cpu/x86/pc/olpc/security.fth Wed Jun 13 07:05:13 2012 (r3007)
@@ -1304,6 +1304,12 @@
alternate? if " \boot-alt" else " \boot" then pn-buf place
+ key? if
+ pending-char c@ h# 1b = if
+ visible red-letters ." Secured, continuing" cancel cr
+ then
+ then
+
all-devices$ load-from-list if exit then \ Returns only if no images found
" Boot failed" .security-failure
Author: wmb
Date: Sat Jun 9 09:58:12 2012
New Revision: 3006
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/3006
Log:
OFW core - execute-device-method was using device-end, which sets the search order to a fixed value, inside of the wrapping code that modifies the search order reversibly. That's probably a holdover from some ancient behavior. Fixes OLPC trac #11926.
Modified:
ofw/core/ofwcore.fth
Modified: ofw/core/ofwcore.fth
==============================================================================
--- ofw/core/ofwcore.fth Sat Jun 9 05:53:59 2012 (r3005)
+++ ofw/core/ofwcore.fth Sat Jun 9 09:58:12 2012 (r3006)
@@ -2489,7 +2489,6 @@
else ( ??? )
close-chain true ( ??? true )
then ( false | ??? true )
- device-end ( false | ??? true )
r> push-device )package ( false | ??? true )
;
Author: quozl
Date: Thu Jun 7 08:05:24 2012
New Revision: 3004
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/3004
Log:
OLPC - probe all ports of the EHC during a test, regardless of whether they are in use. Remove fisheye test from default testing, because it is not used in manufacturing, and had been incorrectly used in the field to verify a port is working. No change to manufacturing tests. #11845.
Modified:
dev/usb2/hcd/ehci/probe.fth
Modified: dev/usb2/hcd/ehci/probe.fth
==============================================================================
--- dev/usb2/hcd/ehci/probe.fth Thu Jun 7 02:04:14 2012 (r3003)
+++ dev/usb2/hcd/ehci/probe.fth Thu Jun 7 08:05:24 2012 (r3004)
@@ -60,6 +60,7 @@
then ( #testable-ports )
;
+\ Port owned by usb 1.1 controller (2000) or device is present (1)
: port-connected? ( port# -- flag ) portsc@ h# 2001 and ;
: wait-connect ( port# -- error? )
begin ( port# )
@@ -153,29 +154,60 @@
open-count 0= if free-dma-buf unmap-regs then
;
-: selftest ( -- error? )
- ehci-reg dup 0= if map-regs then
+: .occupied ( port -- ) ." USB 2.0 port " u. ." in use" cr ;
+: regs{ ( -- prev ) ehci-reg dup 0= if map-regs then ;
+: }regs ( prev -- ) 0= if unmap-regs then ;
+: fisheye ( -- )
+ regs{
#testable-ports 0 ?do
- i port-connected? if \ Port owned by usb 1.1 controller (2000) or device is present (1)
- ." USB 2.0 port " i u. ." in use" cr
+ i port-connected? if
+ i .occupied
else
- diagnostic-mode? if
- ." Please connect a device to USB port " i u. cr
- i wait-connect if true unloop exit then
- else
- ." Fisheye pattern out to USB 2.0 port " i u. cr
- i test-port-begin
- d# 2,000 ms
- i test-port-end
- 0 i portsc! i reset-port i power-port
- then
+ ." Fisheye pattern out to USB 2.0 port " i u. cr
+ i test-port-begin
+ d# 2,000 ms
+ i test-port-end
+ 0 i portsc! i reset-port i power-port
+ then
+ loop
+ }regs
+;
+
+: thorough ( -- error? )
+ #testable-ports 0 ?do
+ i port-connected? if
+ i .occupied
+ else
+ ." Please connect a device to USB port " i u. cr
+ i wait-connect if true unloop exit then
+ then
+ loop
+ false
+;
+
+: sagacity ( -- error? )
+ #testable-ports 0 ?do
+ ." USB port " i u. ." ... "
+ i port-connected? if
+ i wait-connect if true unloop exit then
+ else
+ ." Empty" cr
then
loop
- 0= if unmap-regs then
false
;
+: selftest ( -- error? )
+ regs{ ( prev )
+ diagnostic-mode? if
+ thorough
+ else
+ sagacity
+ then ( prev error? )
+ swap }regs ( error? )
+;
+
headers
\ LICENSE_BEGIN