summaryrefslogtreecommitdiffstats
path: root/sys/dev/pci
Commit message (Collapse)AuthorAgeFilesLines
* Add SATA and PCI Advanced Features capabilities constants.mav2009-02-151-0/+11
|
* - Add a new ioctl to /dev/pci to fetch details on an individual BAR of ajhb2009-02-022-4/+73
| | | | | | | | | | | | | | device. The details include the current value of the BAR (including all the flag bits and the current base address), its length, and whether or not it is enabled. Since this operation is not invasive, non-root users are allowed to use it (unlike manual config register access which requires root). The intention is that userland apps (such as Xorg) will use this interface rather than dangerously frobbing the BARs from userland to obtain this information. - Add a new sub-mode to the 'list' mode of pciconf. The -b flag when used with -l will now list all the active BARs for each device. MFC after: 1 month
* Change the probe priority for PCI and I2C generic bus modules fromnwhitehorn2009-01-201-1/+1
| | | | | | numerical constants to BUS_PROBE_GENERIC. Suggested by: jhb
* Disable decoding of BARs by devices before we trash the value in the BARjhb2009-01-161-0/+18
| | | | | | | | | | | | | by writing all 1's to it to determine its length. This fixes issues with MCFG on at least some machines where a trashed BAR claimed subsequent attempts at PCI config transactions because the addresses in the MCFG window fell in the decoding range of the BAR. In general it is a bad idea to leave the BARs enabled while we are frobbing with them in this manner. Sleuthing by: tegge MFC after: 1 week
* Add ADMA, SATA and SAS mass storage subclasses reporting.mav2008-11-131-0/+3
|
* Nit: Add a few leading zeros to make this match other mask constantsimp2008-11-031-1/+1
| | | | in this file. Also to make sure that I got other ASI constants right.
* Add HDA multimedia subclass.mav2008-10-212-0/+2
|
* Add "SD host controller" subclass name.mav2008-10-211-0/+1
|
* pci_setup_intr() will only enable MSI/MSI-X for direct children. Add methodsrnoland2008-09-191-2/+18
| | | | | | | to vga_pci.c to request on behalf of it's children. This causes vgapci to show up as the interrupt owner in vmstat -i, rather than the child device. Approved by: jhb(mentor)
* Allow child devices of vgapci(4) to query VPD strings and use MSI/MSI-Xjhb2008-09-161-1/+99
| | | | | | | interrupts. For the MSI/MSI-X case, we only allow 1 child device to use MSI or MSI-X at a time. Tested by: rnoland
* Style nit. Continued lines are indented 2 spaces in this file.imp2008-09-031-4/+4
|
* Cope with errors from device_get_children(). These errors can happenimp2008-08-231-4/+7
| | | | | | | only in low memory situations, so the error fork of these fixes is lightly tested, but they should do the least-wrong thing... Submitted by: Hans Petter Selasky
* Cosmetic nit.imp2008-08-231-2/+0
|
* The config space registers holding the upper 32-bits of the prefetchablejhb2008-08-202-4/+19
| | | | | | | | | | | | | memory area's base and limit are optional. The low 4-bits of the "low" prefetchable registers indicates whether or not a 32-bit or 64-bit region is supported. The PCI-PCI driver had been assuming that all bridges supported a 64-bit region (and thus the two upper 32-bit registers). Fix the driver to only use those registers if the low 4-bits of the "low" registers indicate that a 64-bit region is supported. The PCI-PCI bridge in the XBox happens to be a bridge that only supports a 32-bit region. Reported by: rink MFC after: 1 week
* Update a comment about not numbering pci busses. This may soon beimp2008-08-171-7/+9
| | | | OBE, but was sitting around in one of my trees for a while...
* Remove useless #if 1.imp2008-08-161-2/+0
|
* Add some sysctl reporting for most pci_pci bridges. We now reportimp2008-08-162-3/+21
| | | | | | | | | | | | | domain, pribus (the primary bus, eg the bus that this chip is on), secbus (the secondary bus, eg the bus immediately behind this chip) and subbus (the number of the highest bus behind this chip). Normally, this information is reported via bootverbose parameters, but that's hard to use for debugging in some cases. This adds reading of pribus to make this happen. In addition, change the narrow types to u_int to allow for easier reporting via sysctl for domain, secbus and subbus. This should have no effect, but if it does, please let me know.
* Change -1 to 0xfffffffful since the interface returns uint32_t.imp2008-08-091-1/+1
|
* Remove the second check for a 64-bit BAR value on a 32-bit system injhb2008-08-051-19/+1
| | | | | | | | | | pci_add_map(). First, this condition is already handled earlier in the function. Second, as written the check would never fire as the 'start' value was overwritten with a long value (rman_get_start() returns long) before the comparison was done. Discussed with: imp MFC after: 2 weeks
* If the kernel fails to allocate resources for the initial value of a BARjhb2008-08-051-13/+33
| | | | | | | | | | | | | for a PCI device during the boot-time probe of the parent PCI bus, then zero the BAR and clear the resource list entry for that BAR. This forces the PCI bus driver to request a valid resource range from the parent bridge driver when the device driver tries to allocate the BAR. Similarly, if the initial value of a BAR is a valid range but it is > 4GB and the current OS only has 32-bit longs, then do a full teardown of the initial value of the BAR to force a reallocation. Reviewed by: imp MFC after: 1 week
* SATA device on some nForce based boards could get confused if MSI is notluoqi2008-07-233-5/+59
| | | | | | | | | | | | | | | used but MSI to HyperTransport IRQ mapping is enabled, and would act as if MSI is turned on, resulting in interrupt loss. This commit will, 1. enable MSI mapping on a device only when MSI is enabled for that device and the MSI address matches the HT mapping window. 2. enable MSI mapping on a bridge only when a downstream device is allocated an MSI address in the mapping window PR: kern/118842 Reviewed by: jhb MFC after: 1 week
* Remove some remnant alpha hacks.marius2008-04-261-7/+0
| | | | Approved by: PCI-maintainers (imp, jhb)
* Remove a trailing comma which FlexeLint whines about.phk2008-04-121-1/+1
|
* Relax the check for a PCI-express chipset by assuming the system is ajhb2008-02-011-5/+2
| | | | | | | | | | | | | | | | PCI-express chipset (and thus has functional MSI) if there are any PCI-express devices in the system, not requiring a root port device. With PCI-X the chipset detection has to be very conservative because there are known systems with PCI-X devices that do not appear to have PCI-X chipsets. However, with PCI-express I'm not sure it is possible to have a PCI-express device in a system with a non-PCI-express chipset. If we assume that is the case then this change is valid. It is also required for at least some PCI-express systems that don't have any devices with a root port capability (some ICH9 systems). MFC after: 1 week Reported by: jfv
* Don't cache the new-bus name of a PCI device in the PCI conf structure,jhb2008-01-151-1/+4
| | | | | | | | | | | but reread it from the device_t every time the device list is fetched. Previously the device name in pciconf -l would not be updated when a driver was unloaded or if a device was detached and attached to a different driver. MFC after: 1 week PR: kern/104777 Submitted by: "Iasen Kostoff" tbyte | otel net
* Fix some bugs in the FreeBSD 4/5/6 pci(4) IOCTLs compatibility code:marius2007-12-261-12/+9
| | | | | | | | | | | | | | | | - Use the correct offsets when copying out the results of PCIOCGETCONF_OLD. This happened to not affect the 64-bit architectures because there the addition of pc_domain to struct pcisel didn't change the overall size of struct pci_conf. [1] - Always copy the name and unit information to conf_old so it's also part of the output once this information is cached in dinfo. - Use the correct type for flags in struct pci_match_conf_old. This change is more or less cosmetic though. Reported and tested by: bde [1] Reviewed by: imp MFC after: 3 days Committed from: 24C3
* Make VPD register access more robust:jkim2007-11-161-69/+121
| | | | | | | | | | | | | - Implement timing out of VPD register access.[1] - Fix an off-by-one error of freeing malloc'd space when checksum is invalid. - Fix style(9) bugs, i.e., sizeof cannot be followed by space. - Retire now obsolete 'hw.pci.enable_vpd' tunable. Submitted by: cokane (initial revision)[1] Reviewed by: marius (intermediate revision) Silence from: jhb, jmg, rwatson Tested by: cokane, jkim MFC after: 3 days
* Simplify the old compat #ifdefs.imp2007-10-261-22/+12
|
* Add ABI backwards compatibility to the FreeBSD 4/5/6 versions ofmarius2007-10-241-51/+295
| | | | | | | | | | | | | | the PCIOCGETCONF, PCIOCREAD and PCIOCWRITE IOCTLs, which was broken with the introduction of PCI domain support. As the size of struct pci_conf_io wasn't changed with that commit, this unfortunately requires the ABI of PCIOCGETCONF to be broken again in order to be able to provide backwards compatibility to the old version of that IOCTL. Requested by: imp Discussed with: re (kensmith) Reviewed by: PCI maintainers (imp, jhb) MFC after: 5 days
* Make the PCI code aware of PCI domains (aka PCI segments) so we canmarius2007-09-306-41/+89
| | | | | | | | | | | | | | | | | | | | | | | | 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)
* - Fix a small bit slip in PCIM_PCAP_D[0-2]PME defines.sepotvin2007-09-191-3/+5
| | | | | | | | - Add the definitions for D3PME_COLD and D3PME_HOT capabilities. Reviewed by: njl (mentor), imp Approved by: re (kensmith) MFC after: 1 week
* In pci_alloc_map(), restore the original value of the BAR formarcel2007-07-291-0/+8
| | | | | | | | | the duration of the function. The device we would otherwise have left in an useless state may just as well be the low-level console. When booting verbose, we do need it addressable if we want to avoid a MCA. Approved by: re (kensmith)
* Fix a typo in pcib_alloc_msi{x} which resulted in thegallatin2007-05-231-2/+2
| | | | | | | | | | device's, not the bridge's, softc to be used to check the PCIB_DISABLE_MSI flag. This resulted in randomly allowing or denying MSI interrupts based on whatever value the driver happened to store at sizeof(device_t) bytes into its softc. I noticed this when I stopped getting MSI interrupts after slighly re-arranging mxge's softc yesterday.
* Don't completely skip pci_cfg_save() in the PCI nomatch routine ifjhb2007-05-161-3/+1
| | | | | | | | the power_nodriver tunable is off. pci_cfg_save() already checks the tunable internally, and no other callers of pci_cfg_save() check the tunable. Reviewed by: imp
* Change PCIM_CIS_ASI_TUPLE to _CONFIG.imp2007-05-161-3/+5
| | | | | | Add PCI_MAX_BAR_0 minor style nit. Add PCIM_CIS_CONFIG_MASK
* Add some doxygen docs for pci_cfg_{save,restore}.imp2007-05-161-0/+10
|
* Fix a typo in a bootverbose printf.jhb2007-05-071-1/+1
| | | | | MFC after: 3 days Submitted by: yongari
* Revamp the MSI/MSI-X code a bit to achieve two main goals:jhb2007-05-027-123/+495
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Simplify the amount of work that has be done for each architecture by pushing more of the truly MI code down into the PCI bus driver. - Don't bind MSI-X indicies to IRQs so that we can allow a driver to map multiple MSI-X messages into a single IRQ when handling a message shortage. The changes include: - Add a new pcib_if method: PCIB_MAP_MSI() which is called by the PCI bus to calculate the address and data values for a given MSI/MSI-X IRQ. The x86 nexus drivers map this into a call to a new 'msi_map()' function in msi.c that does the mapping. - Retire the pcib_if method PCIB_REMAP_MSIX() and remove the 'index' parameter from PCIB_ALLOC_MSIX(). MD code no longer has any knowledge of the MSI-X index for a given MSI-X IRQ. - The PCI bus driver now stores more MSI-X state in a child's ivars. Specifically, it now stores an array of IRQs (called "message vectors" in the code) that have associated address and data values, and a small virtual version of the MSI-X table that specifies the message vector that a given MSI-X table entry uses. Sparse mappings are permitted in the virtual table. - The PCI bus driver now configures the MSI and MSI-X address/data registers directly via custom bus_setup_intr() and bus_teardown_intr() methods. pci_setup_intr() invokes PCIB_MAP_MSI() to determine the address and data values for a given message as needed. The MD code no longer has to call back down into the PCI bus code to set these values from the nexus' bus_setup_intr() handler. - The PCI bus code provides a callout (pci_remap_msi_irq()) that the MD code can call to force the PCI bus to re-invoke PCIB_MAP_MSI() to get new values of the address and data fields for a given IRQ. The x86 MSI code uses this when an MSI IRQ is moved to a different CPU, requiring a new value of the 'address' field. - The x86 MSI psuedo-driver loses a lot of code, and in fact the separate MSI/MSI-X pseudo-PICs are collapsed down into a single MSI PIC driver since the only remaining diff between the two is a substring in a bootverbose printf. - The PCI bus driver will now restore MSI-X state (including programming entries in the MSI-X table) on device resume. - The interface for pci_remap_msix() has changed. Instead of accepting indices for the allocated vectors, it accepts a mini-virtual table (with a new length parameter). This table is an array of u_ints, where each value specifies which allocated message vector to use for the corresponding MSI-X message. A vector of 0 forces a message to not have an associated IRQ. The device may choose to only use some of the IRQs assigned, in which case the unused IRQs must be at the "end" and will be released back to the system. This allows a driver to use the same remap table for different shortage values. For example, if a driver wants 4 messages, it can use the same remap table (which only uses the first two messages) for the cases when it only gets 2 or 3 messages and in the latter case the PCI bus will release the 3rd IRQ back to the system. MFC after: 1 month
* Use more specific local variable pointers to narrow some expressions.jhb2007-05-021-73/+72
| | | | MFC after: 1 week
* - HT 2.00b added a new flag to the MSI mapping HT capability to indicatejhb2007-04-252-8/+14
| | | | | | | | | | | that the MSI mapping window is fixed at 0xfee00000 and the capability does not include two more dwords used to program the address. Supporting this mostly results in quieting spurious warnings during boot about non-default MSI mapping windows. - HT 2.00b also added a new HT capability type, so support that in pciconf. MFC after: 3 days Tested by: jmg
* Add constants for the fields in a BAR. Also, add two new macrosjhb2007-03-312-34/+43
| | | | | | | PCI_BAR_(IO|MEM)() that return true if the passed in value from a BAR is for an IO or memory BAR, respectively. Reviewed by: imp
* - Add missing constants for subclasses.jhb2007-03-313-7/+33
| | | | - Add a few progif constants as well.
* Change the VPD code to read the VPD data on-demand when a driver asks forjhb2007-03-262-30/+14
| | | | | | | | | | | | it via pci_get_vpd_*() rather than always reading it for each device during boot. I've left the tunable so that it can still be turned off if a device driver causes a lockup via a query to a broken device, but devices whose drivers do not use VPD (the vast majority) should no longer result in lockups during boot, and most folks should not need to tweak the tunable now. Tested on: bge(4) Silence from: jmg
* - Use constants for VPD capability register offsets.jhb2007-03-051-13/+13
| | | | - Add missing ()'s around return values.
* - Flesh out list of UART simple comms programming interfaces.jhb2007-03-051-1/+15
| | | | | | | - Add list of PIC base peripheral programming interfaces. - Add VPD capability register offsets. MFC after: 3 days
* Add support for chipsets that has NULL'd BAR's for legacy ports.sos2007-02-171-1/+3
| | | | | | | This allows DMA to be used on a fine little geode system I got here and most like on lots of older systems like that. HW donated by: Paul Ghering
* Adjust the global MSI blacklisting strategy so we don't have to explicitlyjhb2007-02-141-0/+26
| | | | | | | | | blacklist a bunch of old chipsets. If a system contains a PCI-PCI bridge that supports PCI-X, assume the chipset supports PCI-X. If a system contains a PCI-express root port, assume the chipset supports PCI-express. If the chipset doesn't support either PCI-X or PCI-express, then blacklist it by default. We should now only need to explicitly blacklist PCI-X or PCI-express chipsets that don't properly handle MSI.
* - Fix an off by one error in pci_remap_msix_method() that effectivelyjhb2007-02-141-2/+10
| | | | | | broke the method as all the MSI-X table indices were off by one in the backend MD code. - Fix a cosmetic nit in the bootverbose printf in pci_alloc_msix_method().
* Add missing 'break' that in this case is harmless.jhb2007-02-141-0/+1
|
* As VPD support still causes hard hangs on boot with some hardware, add arwatson2007-02-081-2/+9
| | | | | | | | | | | tunable allowing automatic parsing of VPD data to be disabled. The default is left as-is; if you are having problems with hard hangs at boot due to VPD, try setting hw.pci.enable_vpd=0. A proper architectural solution has been under discussion for some time, but this allows me to boot my test machines in the mean time. Submitted by: bz Head nod: jmg
OpenPOWER on IntegriCloud