diff options
-rw-r--r-- | board-js2x/slof/pci-bridge_1022_7460.fs | 9 | ||||
-rw-r--r-- | slof/fs/pci-config-bridge.fs | 25 |
2 files changed, 27 insertions, 7 deletions
diff --git a/board-js2x/slof/pci-bridge_1022_7460.fs b/board-js2x/slof/pci-bridge_1022_7460.fs index c28e0d2..d6a73d3 100644 --- a/board-js2x/slof/pci-bridge_1022_7460.fs +++ b/board-js2x/slof/pci-bridge_1022_7460.fs @@ -15,6 +15,15 @@ \ See the documentation at http://www.amd.com ; the datasheet for this chip is \ document #24674. +\ Config space access functions - we're touching multiple device numbers and +\ device functions below, so we've got to add our own my-space base here: +: config-b@ dup 1000 < IF my-space + THEN config-b@ ; +: config-w@ dup 1000 < IF my-space + THEN config-w@ ; +: config-l@ dup 1000 < IF my-space + THEN config-l@ ; +: config-b! dup 1000 < IF my-space + THEN config-b! ; +: config-w! dup 1000 < IF my-space + THEN config-w! ; +: config-l! dup 1000 < IF my-space + THEN config-l! ; + \ First, some master config. Not all of this logically belongs to just \ one function, and certainly not to the LPC bridge; also, we'll \ initialize all functions in "downstream" order, and this code has to be diff --git a/slof/fs/pci-config-bridge.fs b/slof/fs/pci-config-bridge.fs index f813431..e1fe92b 100644 --- a/slof/fs/pci-config-bridge.fs +++ b/slof/fs/pci-config-bridge.fs @@ -1,5 +1,5 @@ \ ***************************************************************************** -\ * Copyright (c) 2004, 2008 IBM Corporation +\ * Copyright (c) 2004, 2011 IBM Corporation \ * All rights reserved. \ * This program and the accompanying materials \ * are made available under the terms of the BSD License @@ -10,15 +10,26 @@ \ * IBM Corporation - initial implementation \ ****************************************************************************/ +\ Generic config space access function - xt is execution token of rtas-config-xx +: config-xt ( config-addr xt -- data ) + puid >r \ Safe puid + my-puid TO puid \ Set my-puid + swap dup ffff00 AND 0= IF \ Has bus-device-function been specified? + my-space OR \ No: use my-space instead + THEN + swap execute \ Execute the rtas-config-xx function + r> TO puid \ Restore previous puid +; + \ define the config reads -: config-b@ puid >r my-puid TO puid my-space + rtas-config-b@ r> TO puid ; -: config-w@ puid >r my-puid TO puid my-space + rtas-config-w@ r> TO puid ; -: config-l@ puid >r my-puid TO puid my-space + rtas-config-l@ r> TO puid ; +: config-b@ ( config-addr -- data ) ['] rtas-config-b@ config-xt ; +: config-w@ ( config-addr -- data ) ['] rtas-config-w@ config-xt ; +: config-l@ ( config-addr -- data ) ['] rtas-config-l@ config-xt ; \ define the config writes -: config-b! puid >r my-puid TO puid my-space + rtas-config-b! r> TO puid ; -: config-w! puid >r my-puid TO puid my-space + rtas-config-w! r> TO puid ; -: config-l! puid >r my-puid TO puid my-space + rtas-config-l! r> TO puid ; +: config-b! ( data config-addr -- ) ['] rtas-config-b! config-xt ; +: config-w! ( data config-addr -- ) ['] rtas-config-w! config-xt ; +: config-l! ( data config-addr -- ) ['] rtas-config-l! config-xt ; \ for Debug purposes: dumps the whole config space : config-dump puid >r my-puid TO puid my-space pci-dump r> TO puid ; |