1 \ *****************************************************************************
2 \ * Copyright (c) 2004, 2008 IBM Corporation
3 \ * All rights reserved.
4 \ * This program and the accompanying materials
5 \ * are made available under the terms of the BSD License
6 \ * which accompanies this distribution, and is available at
7 \ * http://www.opensource.org/licenses/bsd-license.php
10 \ * IBM Corporation - initial implementation
11 \ ****************************************************************************/
13 \ get the PUID from the node above
14 get-node CONSTANT my-phandle
15 s" my-puid" my-phandle parent $call-static CONSTANT my-puid
17 \ Save the bus number provided by this bridge
18 pci-bus-number 1+ CONSTANT my-bus
20 s" pci-config-bridge.fs" included
21 s" dma-function.fs" included
23 \ generate the rom-fs filename from the vendor and device ID "pci-bridge_VENDORID_DEVICEID.fs"
24 : filename ( -- str len )
26 my-space pci-vendor@ 4 int2str $cat
28 my-space pci-device@ 4 int2str $cat
32 \ Set up the Bridge with either default or special settings
34 \ is there special handling for this device, given vendor and device id?
35 filename romfs-lookup ?dup
37 \ give it a special treatment
40 \ no special handling for this device, attempt autoconfiguration
41 my-space pci-class-name type 2a emit cr
42 my-space pci-bridge-generic-setup
43 my-space pci-reset-2nd
47 \ Disable Bus Master, Memory Space and I/O Space for
48 \ this device and so for the scanning for the devices behind
51 \ Enalbe #PERR and #SERR reporting
54 \ Print out device information
55 my-space 42 pci-out \ config-addr ascii('B')
57 \ and set up the bridge
60 \ And enable Bus Master IO and MEM access again.
61 \ we need that on bridges so that the devices behind
62 \ can set their state on their own.