summaryrefslogtreecommitdiffstats
path: root/sys/sparc64/pci/ofw_pcibus.c
Commit message (Collapse)AuthorAgeFilesLines
* Adapt parts of the sparc64 Open Firmware bus enumeration code (in particular,nwhitehorn2008-12-151-1/+18
| | | | | | | | | | | | | | | the code for parsing interrupt maps) to PowerPC and reflect their new MI status by moving them to the shared dev/ofw directory. This commit also modifies the OFW PCI enumeration procedure on PowerPC to allow the bus to find non-firmware-enumerated devices that Apple likes to add, and adds some useful Open Firmware properties (compat and name) to the pnpinfo string of children on OFW SBus, EBus, PCI, and MacIO links. Because of the change to PCI enumeration on PowerPC, X has started working again on PPC machines with Grackle hostbridges. Reviewed by: marius Obtained from: sparc64
* The PCI specifications don't explain the details on how to calculatemarius2008-08-241-20/+58
| | | | | | | | | | | | | | the latency based on the Min_Gnt register so use the algorithm found in OpenSolaris as they probably know how to interpret the value Sun puts into these registers (previously, the latency calculated for 66MHz was most likely wrong) and for bridges additionally set up the secondary latency register. Also set up the bridge control register the way it's done in OpenSolaris. As the latency register don't apply to PCI-Express and the bridge control setup wasn't tested on sun4v (besides most likely not being needed), expand the #ifndef SUN4V accordingly. MFC after: 3 days
* cosmetic changes and style fixesmarius2008-08-221-19/+21
|
* Remove an header which is unused for sun4v.marius2008-05-021-1/+3
| | | | MFC after: 3 days
* On sparc64 machines with multiple host-PCI-bridges these bridgesmarius2008-04-171-4/+0
| | | | | | | | | | | | | | | | | have separate configuration spaces so by definition they implement different PCI domains. Thus change psycho(4) to use PCI domains instead of reenumerating all PCI busses so they have globally unique bus numbers and drop support for reenumerating busses in the OFW PCI code. According to CVS history reenumeration was also required in order to get some E450 to boot but given that no other open source kernel changes the PCI bus numbers assigned by the firmware I believe the real problem was that the old code used the bus number as the device number for the PCI busses and unlike most of the other machines the firmwares of the problematic ones don't use disjoint PCI bus numbers across the host-PCI-bridges. MFC after: 1 month
* - Add the PCI side of the HOST-PCI bridge itself to the bus. Thismarius2007-11-301-0/+13
| | | | | | | | | | | is required by the X.Org PCI domains code and additionally needs a workaround for Hummingbird and Sabre bridges as these don't allow their config headers to be read at any width, which is an unusual behavior. - In psycho(4) take advantage of DEFINE_CLASS_0 and use more appropriate types for some softc members. MFC after: 3 days
* Make the PCI code aware of PCI domains (aka PCI segments) so we canmarius2007-09-301-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | support machines having multiple independently numbered PCI domains and don't support reenumeration without ambiguity amongst the devices as seen by the OS and represented by PCI location strings. This includes introducing a function pci_find_dbsf(9) which works like pci_find_bsf(9) but additionally takes a domain number argument and limiting pci_find_bsf(9) to only search devices in domain 0 (the only domain in single-domain systems). Bge(4) and ofw_pcibus(4) are changed to use pci_find_dbsf(9) instead of pci_find_bsf(9) in order to no longer report false positives when searching for siblings and dupe devices in the same domain respectively. Along with this change the sole host-PCI bridge driver converted to actually make use of PCI domain support is uninorth(4), the others continue to use domain 0 only for now and need to be converted as appropriate later on. Note that this means that the format of the location strings as used by pciconf(8) has been changed and that consumers of <sys/pciio.h> potentially need to be recompiled. Suggested by: jhb Reviewed by: grehan, jhb, marcel Approved by: re (kensmith), jhb (PCI maintainer hat)
* - Use the actual clock frequency of the PCI bus instead of assumingmarius2007-09-261-17/+16
| | | | | | | | | | | | | | | | | | 33MHz for calculating the latency timer values for its children. Inspired by NetBSD doing the same and Linux as well as OpenSolaris using a similar approach. While at it rename a variable and change its type to be more appropriate fuer values of PCI properties so the variable can be more easily reused. - Initialize the cache line size register of PCI devices to a legal value; the cache line size is limited to 64 bytes by the Fireplane/Safari, JBus and UPA interconnection busses. Setting it to an unsupported value caused bad performance at least with GEM as it causes them to not do cache line bursts and to not issue cache line commands on the PCI bus. Approved by: re (kensmith) MFC after: 1 week
* Remove unused softc.marius2007-06-171-6/+2
|
* Delete the unused/not really used sparc64 (as in sun4u) cache.h,marius2007-05-201-2/+2
| | | | | | iommureg.h (which already began to bitrot) and iommuvar.h from the sun4v source and adjust some of the source which is shared between sparc64 and sun4v as appropriate.
* In ofw_pcibus_attach() skip dupe PCI devices reported by themarius2007-01-081-0/+2
| | | | | | | | | | | | | | | | | | firmware (mainly 'pmu' and its 'lomp' dupe found in a couple of later USII{e,i}-based machines) by checking whether a device with the same triple of bus number, slot and function already has been added. This is the simple yet effective approach introduced in OpenBSD some time ago, but which has the flaw that it assumes that the device and its dupe(s) found in the OFW device tree are equal or at least the one encountered first is in some way the more important one (this is the case with 'pmu' and 'lomp'; the 'pmu' node has couple of properties and children while the 'lomp' one misses most of these). If there's ever a device/dupe pair where we don't encounter the more important node first, we'll probably need to introduce a quirk list in order to add the desired device but prevent its dupe(s) from being added. MFC after: 1 week
* kernel clean up to make the sun4v kernel buildkmacy2006-10-091-2/+8
| | | | | Reviewed by: jmg Approved by: rwatson (mentor)
* Make the ACPI and OpenFirmware PCI bus drivers subclasses of the genericjhb2006-01-201-35/+3
| | | | PCI bus driver.
* Add a new method PCI_FIND_EXTCAP() to the pci bus interface that is usedjhb2005-12-201-0/+1
| | | | | | | to search for a specific extended capability. If the specified capability is found for the given device, then the function returns success and optionally returns the offset of that capability. If the capability is not found, the function returns an error.
* - Adhere style(9) (don't use function calls in initializers, use uintXX_tmarius2005-12-031-1/+3
| | | | | instead of u_intXX_t). - Use FBSDID.
* - Convert these bus drivers to make use of the newly introduced set ofmarius2005-11-221-80/+27
| | | | | | | | | | | | | ofw_bus_gen_get_*() for providing the ofw_bus KOBJ interface in order to reduce code duplication. - While here sync the various sparc64 bus drivers a bit (handle failure to attach a child gracefully instead of panicing, move the printing of child resources common to bus_print_child() and bus_probe_nomatch() implementations of a bus into a <bus>_print_res() function, ...) and fix some minor bugs and nits (plug memory leaks present when attaching a bus or child device fails, remove unused struct members, ...). Additional testing by: kris (central(4) and fhc(4))
* fix kldloading of pci driver modules after boot on sparc64... sincejmg2005-03-231-1/+1
| | | | | | | we weren't using the pci module, we weren't restoring the pci state... Submitted by: imp MFC after: 5 days
* At least on some U30 there's a spurious duplicate device node of an EBusmarius2005-01-201-5/+12
| | | | | | | | | | | | bridge in the device tree which lacks the mandatory (also by the OFW PCI bus binding spec) "reg" property. Change the code to just ignore nodes missing the "reg" property instead of panicing when encountering such a node. Also ignore nodes without a "name" property (guaranteed by the OFW PCI bus binding spec). This brings the behaviour of the MD OFW PCI code regarding such incomplete nodes in line with the EBus and the SBus code. Tested by: Cyril Tikhomiroff <tikho@anor.net> MFC after: 1 month
* Correct some uses of the wrong members of the *min()/*max()-familiy, e.g.marius2004-08-151-2/+2
| | | | | | min() on unsigned long. None of these are believed to have been fatal though. Reviewed by: tmm
* - Introduce an ofw_bus kobj-interface for retrieving the OFW node and amarius2004-08-121-9/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | subset ("compatible", "device_type", "model" and "name") of the standard properties in drivers for devices on Open Firmware supported busses. The standard properties "reg", "interrupts" und "address" are not covered by this interface because they are only of interest in the respective bridge code. There's a remaining standard property "status" which is unclear how to support properly but which also isn't used in FreeBSD at present. This ofw_bus kobj-interface allows to replace the various (ebus_get_node(), ofw_pci_get_node(), etc.) and partially inconsistent (central_get_type() vs. sbus_get_device_type(), etc.) existing IVAR ones with a common one. This in turn allows to simplify and remove code-duplication in drivers for devices that can hang off of more than one OFW supported bus. - Convert the sparc64 Central, EBus, FHC, PCI and SBus bus drivers and the drivers for their children to use the ofw_bus kobj-interface. The IVAR- interfaces of the Central, EBus and FHC are entirely replaced by this. The PCI bus driver used its own kobj-interface and now also uses the ofw_bus one. The IVARs special to the SBus, e.g. for retrieving the burst size, remain. Beware: this causes an ABI-breakage for modules of drivers which used the IVAR-interfaces, i.e. esp(4), hme(4), isp(4) and uart(4), which need to be recompiled. The style-inconsistencies introduced in some of the bus drivers will be fixed by tmm@ in a generic clean-up of the respective drivers later (he requested to add the changes in the "new" style). - Convert the powerpc MacIO bus driver and the drivers for its children to use the ofw_bus kobj-interface. This invloves removing the IVARs related to the "reg" property which were unused and a leftover from the NetBSD origini of the code. There's no ABI-breakage caused by this because none of these driver are currently built as modules. There are other powerpc bus drivers which can be converted to the ofw_bus kobj-interface, e.g. the PCI bus driver, which should be done together with converting powerpc to use the OFW PCI code from sparc64. - Make the SBus and FHC front-end of zs(4) and the sparc64 eeprom(4) take advantage of the ofw_bus kobj-interface and simplify them a bit. Reviewed by: grehan, tmm Approved by: re (scottl) Discussed with: tmm Tested with: Sun AX1105, AXe, Ultra 2, Ultra 60; PPC cross-build on i386
* Add the new sparc64 OFW PCI framework, conditional on options OFW_NEWPCItmm2003-07-011-0/+264
for now. It introduces a OFW PCI bus driver and a generic OFW PCI-PCI bridge driver. By utilizing these, the PCI handling is much more elegant now. The advantages of the new approach are: - Device enumeration should hopefully be more like on Solaris now, so unit numbers should match what's printed on the box more closely. - Real interrupt routing is implemented now, so cardbus bridges etc. have at least a chance to work. - The quirk tables are gone and have been replaced by (hopefully sufficient) heuristics. - Much cleaner code. There was also a report that previously bogus interrupt assignments are fixed now, which can be attributed to the new heuristics. A pitfall, and the reason why this is not the default yet, is that it changes device enumeration, as mentioned above, which can make it necessary to change the system configuration if more than one unit of a device type is present (on a system with two hme cars, for example, it is possible that hme0 becomes hme1 and vice versa after enabling the option). Systems with multiple disk controllers may need to be booted into single user (and require manual specification of the root file system on boot) to adjust the fstab. Nevertheless, I would like to encourage users to use this option, so that it can be made the default soon. In detail, the changes are: - Introduce an OFW PCI bus driver; it inherits most methods from the generic PCI bus driver, but uses the firmware for enumeration, performs additional initialization for devices and firmware-specific interrupt routing. It also implements an OFW-specific method to allow child devices to get their firmware nodes. - Introduce an OFW PCI-PCI bridge driver; again, it inherits most of the generic PCI-PCI bridge driver; it has it's own method for interrupt routing, as well as some sparc64-specific methods (one to get the node again, and one to adjust the bridge bus range, since we need to reenumerate all PCI buses). - Convert the apb driver to the new way of handling things. - Provide a common framework for OFW bridge drivers, used be the two drivers above. - Provide a small common framework for interrupt routing (for all bridge types). - Convert the psycho driver to the new framework; this gets rid of a bunch of old kludges in pci_read_config(), and the whole preinitialization (ofw_pci_init()). - Convert the ISA MD part and the EBus driver to the new way interrupts and nodes are handled. - Introduce types for firmware interrupt properties. - Rename the old sparcbus_if to ofw_pci_if by repo copy (it is only required for PCI), and move it to a more correct location (new support methodsx were also added, and an old one was deprecated). - Fix a bunch of minor bugs, perform some cleanups. In some cases, I introduced some minor code duplication to keep the new code clean, in hopes that the old code will be unifdef'ed soon. Reviewed in part by: imp Tested by: jake, Marius Strobl <marius@alchemy.franken.de>, Sergey Mokryshev <mokr@mokr.net>, Chris Jackman <cjackNOSPAM@klatsch.org> Info on u30 firmware provided by: kris
OpenPOWER on IntegriCloud