aboutsummaryrefslogtreecommitdiff
path: root/board-qemu
diff options
context:
space:
mode:
authorNikunj A Dadhania <nikunj@linux.vnet.ibm.com>2015-04-15 11:15:27 +0530
committerAlexey Kardashevskiy <aik@ozlabs.ru>2015-05-07 16:53:13 +1000
commitbe9b2fa44c73201518aec2431137b4b2d4924945 (patch)
tree09c2f56233673406c4c125047fed073c51e12889 /board-qemu
parentd5c4b4710459a9b6e883b6c87cc795b8ad52cc66 (diff)
downloadSLOF-be9b2fa44c73201518aec2431137b4b2d4924945.zip
SLOF-be9b2fa44c73201518aec2431137b4b2d4924945.tar.gz
SLOF-be9b2fa44c73201518aec2431137b4b2d4924945.tar.bz2
pci: Use QEMU created PCI device nodes
PCI Enumeration has been part of SLOF. Now with hotplug code addition in QEMU, it makes more sense to have this code in one place, i.e. QEMU. Adding routines to walk through the device nodes created by QEMU. SLOF will now configure the device/bridges and program the BARs for communicating with the devices. Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Diffstat (limited to 'board-qemu')
-rw-r--r--board-qemu/slof/pci-phb.fs44
1 files changed, 43 insertions, 1 deletions
diff --git a/board-qemu/slof/pci-phb.fs b/board-qemu/slof/pci-phb.fs
index 529772f..a8fb7ca 100644
--- a/board-qemu/slof/pci-phb.fs
+++ b/board-qemu/slof/pci-phb.fs
@@ -282,6 +282,41 @@ setup-puid
THEN
;
+: phb-pci-walk-bridge ( -- )
+ phb-debug? IF ." Calling pci-walk-bridge " pwd cr THEN
+
+ get-node child ?dup 0= IF EXIT THEN \ get and check if we have children
+ 0 to pci-device-slots \ reset slot array to unpoppulated
+ BEGIN
+ dup \ Continue as long as there are children
+ WHILE
+ dup set-node \ Set child node as current node
+ my-space pci-set-slot \ set the slot bit
+ my-space pci-htype@ \ read HEADER-Type
+ 7f and \ Mask bit 7 - multifunction device
+ CASE
+ 0 OF my-space pci-device-setup ENDOF \ | set up the device
+ 1 OF my-space pci-bridge-setup ENDOF \ | set up the bridge
+ dup OF my-space pci-htype@ pci-out ENDOF
+ ENDCASE
+ peer
+ REPEAT drop
+ get-parent set-node
+;
+
+\ Landing routing to probe the popuated device tree
+: phb-pci-probe-bus ( busnr -- )
+ drop phb-pci-walk-bridge
+;
+
+\ Stub routine, as qemu has enumerated, we already have the device
+\ properties set.
+: phb-pci-device-props ( addr -- )
+ dup pci-class-name device-name
+ dup pci-device-assigned-addresses-prop
+ drop
+;
+
\ Scan the child nodes of the pci root node to assign bars, fixup
\ properties etc.
: phb-setup-children
@@ -289,7 +324,14 @@ setup-puid
my-puid TO puid \ Set current puid
phb-parse-ranges
1 TO pci-hotplug-enabled
- 1 0 (probe-pci-host-bridge)
+ s" qemu,phb-enumerated" get-node get-property 0<> IF
+ 1 0 (probe-pci-host-bridge)
+ ELSE
+ 2drop
+ ['] phb-pci-probe-bus TO func-pci-probe-bus
+ ['] phb-pci-device-props TO func-pci-device-props
+ phb-pci-walk-bridge \ PHB device tree is already populated.
+ THEN
r> TO puid \ Restore previous puid
;
phb-setup-children