aboutsummaryrefslogtreecommitdiff
path: root/sys/sparc64/pci
Commit message (Collapse)AuthorAgeFilesLines
* Clean up OF_getprop_alloc APIOleksandr Tymoshenko2018-04-081-1/+1
| | | | | | | | | | | | | | | | | | | | OF_getprop_alloc takes element size argument and returns number of elements in the property. There are valid use cases for such behavior but mostly API consumers pass 1 as element size to get string properties. What API users would expect from OF_getprop_alloc is to be a combination of malloc + OF_getprop with the same semantic of return value. This patch modifies API signature to match these expectations. For the valid use cases with element size != 1 and to reduce modification scope new OF_getprop_alloc_multi function has been introduced that behaves the same way OF_getprop_alloc behaved prior to this patch. Reviewed by: ian, manu Differential Revision: https://reviews.freebsd.org/D14850 Notes: svn path=/head/; revision=332310
* Mark psycho interrupts as MPSAFE. It's safe to do so now that we don'tWarner Losh2018-03-211-1/+1
| | | | | | | need Giant to call shutdown_nice(). Notes: svn path=/head/; revision=331299
* kernel: Fix several typos and minor errorsEitan Adler2017-12-271-1/+1
| | | | | | | | | | | - duplicate words - typos - references to old versions of FreeBSD Reviewed by: imp, benno Notes: svn path=/head/; revision=327231
* SPDX: Fix some cases wrongly attributed to MIT.Pedro F. Giffuni2017-11-301-1/+1
| | | | | | | | In the cases of BSD-style license variants without clauses, use 0BSD for the time being in lack of a better description. Notes: svn path=/head/; revision=326398
* sys/sparc64: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-2716-0/+32
| | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Notes: svn path=/head/; revision=326262
* Fix a bug introduced as part of r287726; use the right device_t forMarius Strobl2017-04-291-7/+7
| | | | | | | | | | | | | determining the softc of the bridge in psycho_route_interrupt(). [1] While at it, update the corresponding comment that the code in question is also necessary for U30s in addition to E450s (a fact that has been known for ages). PR: 218478 Submitted by: Yoshihiko Iwama Notes: svn path=/head/; revision=317578
* Allow setting access-width for UART registers.Ruslan Bukin2017-02-271-1/+1
| | | | | | | | | | | | | | | This is required for FDT's standard "reg-io-width" property (similar to "reg-shift" property) found in many DTS files. This fixes operation on Altera Arria 10 SOC Development Kit, where standard ns8250 uart allows 4-byte access only. Reviewed by: kan, marcel Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D9785 Notes: svn path=/head/; revision=314362
* Include pcib_private.h for prototypes.Warner Losh2017-02-263-0/+3
| | | | | | | | Noticed by: rpokala@ Sponsored by: Netflix Notes: svn path=/head/; revision=314317
* Convert PCIe Hot Plug to using pci_request_featureWarner Losh2017-02-255-0/+5
| | | | | | | | | | | | Convert PCIe hot plug support over to asking the firmware, if any, for permission to use the HotPlug hardware. Implement pci_request_feature for ACPI. All other host pci connections to allowing all valid feature requests. Sponsored by: Netflix Notes: svn path=/head/; revision=314250
* sys: replace comma with semicolon when pertinent.Pedro F. Giffuni2016-08-091-3/+3
| | | | | | | | | | | | | Uses of commas instead of a semicolons can easily go undetected. The comma can serve as a statement separator but this shouldn't be abused when statements are meant to be standalone. Detected with devel/coccinelle following a hint from DragonFlyBSD. MFC after: 1 month Notes: svn path=/head/; revision=303892
* Use OF_prop_free instead of direct call to free(9)Oleksandr Tymoshenko2016-05-181-2/+2
| | | | | | | Reviewed by: marius Notes: svn path=/head/; revision=300173
* Add a bus_null_rescan() method that always fails with an error.John Baldwin2016-04-271-1/+1
| | | | | | | | Use this in place of kobj_error_method to disable BUS_RESCAN() on PCI drivers that do not use the "standard" scanning algorithm. Notes: svn path=/head/; revision=298712
* Add a pcib_attach_child() method to manage adding the child "pci" device.John Baldwin2016-04-271-2/+1
| | | | | | | | | | | | | | | This allows the PCI-PCI bridge driver to save a reference to the child device in its softc. Note that this required moving the "pci" device creation out of acpi_pcib_attach(). Instead, acpi_pcib_attach() is renamed to acpi_pcib_fetch_prt() as it's sole action now is to fetch the PCI interrupt routing table. Differential Revision: https://reviews.freebsd.org/D6021 Notes: svn path=/head/; revision=298711
* Implement a PCI bus rescan method.John Baldwin2016-04-271-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Rescanning a PCI bus uses the following steps: - Fetch the current set of child devices and save it in the 'devlist' array. - Allocate a parallel array 'unchanged' initalized with NULL pointers. - Scan the bus checking each slot (and each function on slots with a multifunction device). - If a valid function is found, look for a matching device in the 'devlist' array. If a device is found, save the pointer in the 'unchanged' array. If a device is not found, add a new device. - After the scan has finished, walk the 'devlist' array deleting any devices that do not have a matching pointer in the 'unchanged' array. - Finally, fetch an updated set of child devices and explicitly attach any devices that are not present in the 'unchanged' array. This builds on the previous changes to move subclass data management into pci_alloc_devinfo(), pci_child_added(), and bus_child_deleted(). Subclasses of the PCI bus use custom rescan logic explicitly override the rescan method to disable rescans. Differential Revision: https://reviews.freebsd.org/D6018 Notes: svn path=/head/; revision=298708
* Add a new PCI bus interface method to alloc the ivars (dinfo) for a device.John Baldwin2016-04-151-4/+15
| | | | | | | | | | | | | | | | | The ACPI and OFW PCI bus drivers as well as CardBus override this to allocate the larger ivars to hold additional info beyond the stock PCI ivars. This removes the need to pass the size to functions like pci_add_iov_child() and pci_read_device() simplifying IOV and bus rescanning implementations. As a result of this and earlier changes, the ACPI PCI bus driver no longer needs its own device_attach and pci_create_iov_child methods but can use the methods in the stock PCI bus driver instead. Differential Revision: https://reviews.freebsd.org/D5891 Notes: svn path=/head/; revision=298029
* Convert pci_delete_child() to a bus_child_deleted() method.John Baldwin2016-04-061-0/+12
| | | | | | | | | | | | | | | | | | | | | | | Instead of providing a wrapper around device_delete_child() that the PCI bus and child bus drivers must call explicitly, move the bulk of the logic from pci_delete_child() into a bus_child_deleted() method (pci_child_deleted()). This allows PCI devices to be safely deleted via device_delete_child(). - Add a bus_child_deleted method to the ACPI PCI bus which clears the device_t associated with the corresponding ACPI handle in addition to the normal PCI bus cleanup. - Change cardbus_detach_card to call device_delete_children() and move CardBus-specific delete logic into a new cardbus_child_deleted() method. - Use device_delete_child() instead of pci_delete_child() in the SRIOV code. - Add a bus_child_deleted method to the OpenFirmware PCI bus drivers which frees the OpenFirmware device info for each PCI device. Reviewed by: imp Tested on: amd64 (CardBus and PCI-e hotplug) Differential Revision: https://reviews.freebsd.org/D5831 Notes: svn path=/head/; revision=297608
* Use uintmax_t (typedef'd to rman_res_t type) for rman ranges.Justin Hibbits2016-03-181-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On some architectures, u_long isn't large enough for resource definitions. Particularly, powerpc and arm allow 36-bit (or larger) physical addresses, but type `long' is only 32-bit. This extends rman's resources to uintmax_t. With this change, any resource can feasibly be placed anywhere in physical memory (within the constraints of the driver). Why uintmax_t and not something machine dependent, or uint64_t? Though it's possible for uintmax_t to grow, it's highly unlikely it will become 128-bit on 32-bit architectures. 64-bit architectures should have plenty of RAM to absorb the increase on resource sizes if and when this occurs, and the number of resources on memory-constrained systems should be sufficiently small as to not pose a drastic overhead. That being said, uintmax_t was chosen for source clarity. If it's specified as uint64_t, all printf()-like calls would either need casts to uintmax_t, or be littered with PRI*64 macros. Casts to uintmax_t aren't horrible, but it would also bake into the API for resource_list_print_type() either a hidden assumption that entries get cast to uintmax_t for printing, or these calls would need the PRI*64 macros. Since source code is meant to be read more often than written, I chose the clearest path of simply using uintmax_t. Tested on a PowerPC p5020-based board, which places all device resources in 0xfxxxxxxxx, and has 8GB RAM. Regression tested on qemu-system-i386 Regression tested on qemu-system-mips (malta profile) Tested PAE and devinfo on virtualbox (live CD) Special thanks to bz for his testing on ARM. Reviewed By: bz, jhb (previous) Relnotes: Yes Sponsored by: Alex Perez/Inertial Computing Differential Revision: https://reviews.freebsd.org/D4544 Notes: svn path=/head/; revision=297000
* As <machine/pmap.h> is included from <vm/pmap.h>, there is no need toSvatopluk Kraus2016-02-221-1/+0
| | | | | | | | | | include it explicitly when <vm/pmap.h> is already included. Reviewed by: alc, kib Differential Revision: https://reviews.freebsd.org/D5373 Notes: svn path=/head/; revision=295880
* Introduce a RMAN_IS_DEFAULT_RANGE() macro, and use it.Justin Hibbits2016-02-201-1/+1
| | | | | | | | | | | | | | This simplifies checking for default resource range for bus_alloc_resource(), and improves readability. This is part of, and related to, the migration of rman_res_t from u_long to uintmax_t. Discussed with: jhb Suggested by: marcel Notes: svn path=/head/; revision=295832
* Convert rman to use rman_res_t instead of u_longJustin Hibbits2016-01-276-12/+12
| | | | | | | | | | | | | | | | | | | | | | | Summary: Migrate to using the semi-opaque type rman_res_t to specify rman resources. For now, this is still compatible with u_long. This is step one in migrating rman to use uintmax_t for resources instead of u_long. Going forward, this could feasibly be used to specify architecture-specific definitions of resource ranges, rather than baking a specific integer type into the API. This change has been broken out to facilitate MFC'ing drivers back to 10 without breaking ABI. Reviewed By: jhb Sponsored by: Alex Perez/Inertial Computing Differential Revision: https://reviews.freebsd.org/D5075 Notes: svn path=/head/; revision=294883
* - Factor out the common and generic parts of the sparc64 host-PCI-bridgeMarius Strobl2015-09-1211-966/+614
| | | | | | | | | | | | | | | drivers into the revived sys/sparc64/pci/ofw_pci.c, previously already serving a similar purpose. This has been done with sun4v in mind, which explains a) the otherwise not that obvious scheme employed and b) why reusing sys/powerpc/ofw/ofw_pci.c was even lesser an option. - Add a workaround for QEMU once again not emulating real machines, in this case by not providing the OFW_PCI_CS_MEM64 range. [1] Submitted by: jhb [1] MFC after: 1 week Notes: svn path=/head/; revision=287726
* Update this driver to not save copies of registers that are no longer usedJohn Baldwin2015-04-241-8/+2
| | | | | | | | after r281874. While here, also update it to always write the parent's PCI bus number to the primary bus register. Notes: svn path=/head/; revision=281930
* Add support for the uart classes to set their default register shift value.Andrew Turner2015-04-111-1/+2
| | | | | | | | | | | | | | This is needed with the pl011 driver. Before this change it would default to a shift of 0, however the hardware places the registers at 4-byte addresses meaning the value should be 2. This patch fixes this for the pl011 when configured using the fdt. The other drivers have a default value of 0 to keep this a no-op. MFC after: 1 week Notes: svn path=/head/; revision=281438
* Revert unrelated changes accidentally committed in r271192.John Baldwin2014-09-171-13/+7
| | | | Notes: svn path=/head/; revision=271717
* Create a separate structure for per-CPU state saved across suspend andJohn Baldwin2014-09-061-7/+13
| | | | | | | | | | | | resume that is a superset of a pcb. Move the FPU state out of the pcb and into this new structure. As part of this, move the FPU resume code on amd64 into a C function. This allows resumectx() to still operate only on a pcb and more closely mirrors the i386 code. Reviewed by: kib (earlier version) Notes: svn path=/head/; revision=271192
* Pull in r267961 and r267973 again. Fix for issues reported will follow.Hans Petter Selasky2014-06-281-1/+0
| | | | Notes: svn path=/head/; revision=267992
* Revert r267961, r267973:Glen Barber2014-06-271-0/+1
| | | | | | | | | | | | | These changes prevent sysctl(8) from returning proper output, such as: 1) no output from sysctl(8) 2) erroneously returning ENOMEM with tools like truss(1) or uname(1) truss: can not get etype: Cannot allocate memory Notes: svn path=/head/; revision=267985
* Extend the meaning of the CTLFLAG_TUN flag to automatically check ifHans Petter Selasky2014-06-271-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | there is an environment variable which shall initialize the SYSCTL during early boot. This works for all SYSCTL types both statically and dynamically created ones, except for the SYSCTL NODE type and SYSCTLs which belong to VNETs. A new flag, CTLFLAG_NOFETCH, has been added to be used in the case a tunable sysctl has a custom initialisation function allowing the sysctl to still be marked as a tunable. The kernel SYSCTL API is mostly the same, with a few exceptions for some special operations like iterating childrens of a static/extern SYSCTL node. This operation should probably be made into a factored out common macro, hence some device drivers use this. The reason for changing the SYSCTL API was the need for a SYSCTL parent OID pointer and not only the SYSCTL parent OID list pointer in order to quickly generate the sysctl path. The motivation behind this patch is to avoid parameter loading cludges inside the OFED driver subsystem. Instead of adding special code to the OFED driver subsystem to post-load tunables into dynamically created sysctls, we generalize this in the kernel. Other changes: - Corrected a possibly incorrect sysctl name from "hw.cbb.intr_mask" to "hw.pcic.intr_mask". - Removed redundant TUNABLE statements throughout the kernel. - Some minor code rewrites in connection to removing not needed TUNABLE statements. - Added a missing SYSCTL_DECL(). - Wrapped two very long lines. - Avoid malloc()/free() inside sysctl string handling, in case it is called to initialize a sysctl from a tunable, hence malloc()/free() is not ready when sysctls from the sysctl dataset are registered. - Bumped FreeBSD version to indicate SYSCTL API change. MFC after: 2 weeks Sponsored by: Mellanox Technologies Notes: svn path=/head/; revision=267961
* Merge from head up to r262472.Dimitry Andric2014-02-251-1/+1
|\ | | | | | | Notes: svn path=/projects/clang-sparc64/; revision=262473
| * Make sure a for loop in fire_alloc_msix() terminates, by making the loopDimitry Andric2014-02-251-1/+1
| | | | | | | | | | | | | | | | | | | | counter signed. Reviewed by: marius MFC after: 3 days Notes: svn path=/head/; revision=262472
* | Remove more superfluous const specifiers.Dimitry Andric2014-02-231-2/+2
|/ | | | Notes: svn path=/projects/clang-sparc64/; revision=262376
* Add support for managing PCI bus numbers. As with BARs and PCI-PCI bridgeJohn Baldwin2014-02-121-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | I/O windows, the default is to preserve the firmware-assigned resources. PCI bus numbers are only managed if NEW_PCIB is enabled and the architecture defines a PCI_RES_BUS resource type. - Add a helper API to create top-level PCI bus resource managers for each PCI domain/segment. Host-PCI bridge drivers use this API to allocate bus numbers from their associated domain. - Change the PCI bus and CardBus drivers to allocate a bus resource for their bus number from the parent PCI bridge device. - Change the PCI-PCI and PCI-CardBus bridge drivers to allocate the full range of bus numbers from secbus to subbus from their parent bridge. The drivers also always program their primary bus register. The bridge drivers also support growing their bus range by extending the bus resource and updating subbus to match the larger range. - Add support for managing PCI bus resources to the Host-PCI bridge drivers used for amd64 and i386 (acpi_pcib, mptable_pcib, legacy_pcib, and qpi_pcib). - Define a PCI_RES_BUS resource type for amd64 and i386. Reviewed by: imp MFC after: 1 month Notes: svn path=/head/; revision=261790
* Simplify the ofw_bus_lookup_imap() API slightly: make it allocate maskbufNathan Whitehorn2013-12-174-8/+4
| | | | | | | internally instead of requiring the caller to allocate it. Notes: svn path=/head/; revision=259516
* Move the implementation of bus_space_barrier(9) to the inline function inMarius Strobl2013-10-243-18/+9
| | | | | | | | the header. Actually, there's only one version for all types of busses, so it doesn't make sense to walk up the hierarchy. Notes: svn path=/head/; revision=257066
* Fix low-level uart drivers that set their fifo sizes in the softc too late.Ian Lepore2013-04-011-9/+15
| | | | | | | | | | | | uart(4) allocates send and receiver buffers in attach() before it calls the low-level driver's attach routine. Many low-level drivers set the fifo sizes in their attach routine, which is too late. Other drivers set them in the probe() routine, so that they're available when uart(4) allocates buffers. This fixes the ones that were setting the values too late by moving the code to probe(). Notes: svn path=/head/; revision=248965
* Correct two spelling mistakes in a comment.Gavin Atkinson2013-03-071-1/+1
| | | | Notes: svn path=/head/; revision=247914
* Revert the part of r247600 which turned the overtemperature and power failMarius Strobl2013-03-021-18/+16
| | | | | | | | | | | interrupt shutdown handlers into filters. Shutdown_nice(9) acquires a sleep lock, which filters shouldn't do. It also seems that kern_reboot(9) still may require Giant to be hold. Submitted by: bde Notes: svn path=/head/; revision=247620
* - While Netra X1 generally show no ill effects when registering a powerMarius Strobl2013-03-021-27/+44
| | | | | | | | | | | | | | | | | | | | fail interrupt handler, there seems to be either a broken batch of them or a tendency to develop a defect which causes this interrupt to fire inadvertedly. Given that apart from this problem these machines work just fine, add a tunable allowing the setup of the power fail interrupt to be disabled. While at it, remove the DEBUGGER_ON_POWERFAIL compile time option and make that behavior also selectable via the newly added tunable. - Apparently, it's no longer a problem to call shutdown_nice(9) from within an interrupt filter (some other drivers in the tree do the same). So change the power fail interrupt from an handler in order to simplify the code and get rid of a !INTR_MPSAFE handler. - Use NULL instead of 0 for pointers. MFC after: 1 week Notes: svn path=/head/; revision=247600
* - In sbbc_pci_attach() just pass the already obtained bus tag and handleMarius Strobl2013-03-011-4/+3
| | | | | | | | | | instead of acquiring these anew. - Use NULL instead of 0 for pointers. MFC after: 1 week Notes: svn path=/head/; revision=247574
* - Remove an unused header.Marius Strobl2013-03-011-6/+41
| | | | | | | | | | | | | | - Use NULL instead of 0 for pointers. - Let ofw_pcib_probe() return BUS_PROBE_DEFAULT instead of 0 so specialized PCI-PCI-bridge drivers may attach instead. - Add WARs for PLX Technology PEX 8114 bridges and PEX 8532 switches. Ideally, these should live in MI code but at least for the latter we're missing the necessary infrastructure there. MFC after: 1 week Notes: svn path=/head/; revision=247573
* Remove duplicate const specifiers in many drivers (I hope I got all ofDimitry Andric2012-11-053-4/+4
| | | | | | | | | | | | | | | | | | | | | | | them, please let me know if not). Most of these are of the form: static const struct bzzt_type { [...list of members...] } const bzzt_devs[] = { [...list of initializers...] }; The second const is unnecessary, as arrays cannot be modified anyway, and if the elements are const, the whole thing is const automatically (e.g. it is placed in .rodata). I have verified this does not change the binary output of a full kernel build (except for build timestamps embedded in the object files). Reviewed by: yongari, marius MFC after: 1 week Notes: svn path=/head/; revision=242625
* Add a global MD macro for the VIS block size instead of duplicatingMarius Strobl2012-08-312-4/+0
| | | | | | | | | it and using magic values all over the place. MFC after: 1 week Notes: svn path=/head/; revision=239941
* - Remove erroneous trailing semicolon. [1]Marius Strobl2012-03-302-2/+10
| | | | | | | | | | | - Correctly determine the maximum payload size for setting the TX link frequent NACK latency and replay timer thresholds. Submitted by: stefanf [1] MFC after: 3 days Notes: svn path=/head/; revision=233701
* Given that this is a host-PCI-Express bridge driver, create the parentMarius Strobl2012-03-241-1/+1
| | | | | | | | | | | DMA tag with a 4 GB boundary as required by PCI-Express. With r232403 in place this actually is redundant. However, the host-PCI-Express bridge driver is the more appropriate place for implementing this restriction. MFC after: 3 days Notes: svn path=/head/; revision=233421
* Make ofw_bus_get_node() consistently return -1 when there is no associatedNathan Whitehorn2012-03-151-1/+1
| | | | | | | | | | OF node, instead of a random mixture of 0 and -1. Update all checks for 0 to check for -1 instead. MFC after: 4 weeks Notes: svn path=/head/; revision=233018
* - Add a bus_dma tag to each PCI bus that is a child of a Host-PCI bridge.John Baldwin2012-03-021-5/+6
| | | | | | | | | | | | | | | | | | The tag enforces a single restriction that all DMA transactions must not cross a 4GB boundary. Note that while this restriction technically only applies to PCI-express, this change applies it to all PCI devices as it is simpler to implement that way and errs on the side of caution. - Add a softc structure for PCI bus devices to hold the bus_dma tag and a new pci_attach_common() routine that performs actions common to the attach phase of all PCI bus drivers. Right now this only consists of a bootverbose printf and the allocate of a bus_dma tag if necessary. - Adjust all PCI bus drivers to allocate a PCI bus softc and to call pci_attach_common() from their attach routines. MFC after: 2 weeks Notes: svn path=/head/; revision=232403
* As it turns out r227960 may still be insufficient with PREEMPTIONMarius Strobl2012-01-282-16/+42
| | | | | | | | | | | | | | | | | | | | | so try harder to get the CDMA sync interrupt delivered and also in a more efficient way: - wrap the whole process of sending and receiving the CDMA sync interrupt in a critical section so we don't get preempted, - send the CDMA sync interrupt to the CPU that is actually waiting for it to happen so we don't take a detour via another CPU, - instead of waiting for up to 15 seconds for the interrupt to trigger try the whole process for up to 15 times using a one second timeout (the code was also changed to just ignore belated interrupts of a previous tries should they appear). According to testing done by Peter Jeremy with the debugging also added as part of this commit the first two changes apparently are sufficient to now properly get the CDMA sync interrupts delivered at the first try though. Notes: svn path=/head/; revision=230664
* Increase the CDMA sync timeout for Schizo bridges to 15 seconds as used byMarius Strobl2011-11-241-1/+1
| | | | | | | | | | | OpenSolaris. One second turned out to be not enough for certain loads while 10 seconds were sufficient. Reported by: Peter Jeremy MFC after: 3 days Notes: svn path=/head/; revision=227960
* s,KOBJMETHOD_END,DEVMETHOD_END,g in order to fully hide the explicit mentionMarius Strobl2011-11-223-3/+3
| | | | | | | of kobj(9) from device drivers. Notes: svn path=/head/; revision=227848
* - There's no need to overwrite the default device method with the defaultMarius Strobl2011-11-224-11/+6
| | | | | | | | | | | | | one. Interestingly, these are actually the default for quite some time (bus_generic_driver_added(9) since r52045 and bus_generic_print_child(9) since r52045) but even recently added device drivers do this unnecessarily. Discussed with: jhb, marcel - While at it, use DEVMETHOD_END. Discussed with: jhb - Also while at it, use __FBSDID. Notes: svn path=/head/; revision=227843