freebsd-src/sys
John Baldwin 9bf4c9c1b0 First cut at MI support for PCI Message Signalled Interrupts (MSI):
- Add 3 new functions to the pci_if interface along with suitable wrappers
  to provide the device driver visible API:
  - pci_alloc_msi(dev, int *count) backed by PCI_ALLOC_MSI().  '*count'
    here is an in and out parameter.  The driver stores the desired number
    of messages in '*count' before calling the function.  On success,
    '*count' holds the number of messages allocated to the device.  Also on
    success, the driver can access the messages as SYS_RES_IRQ resources
    starting at rid 1.  Note that the legacy INTx interrupt resource will
    not be available when using MSI.  Note that this function will allocate
    either MSI or MSI-X messages depending on the devices capabilities and
    the 'hw.pci.enable_msix' and 'hw.pci.enable_msi' tunables.  Also note
    that the driver should activate the memory resource that holds the
    MSI-X table and pending bit array (PBA) before calling this function
    if the device supports MSI-X.
  - pci_release_msi(dev) backed by PCI_RELEASE_MSI().  This function
    releases the messages allocated for this device.  All of the
    SYS_RES_IRQ resources need to be released for this function to succeed.
  - pci_msi_count(dev) backed by PCI_MSI_COUNT().  This function returns
    the maximum number of MSI or MSI-X messages supported by this device.
    MSI-X is preferred if present, but this function will honor the
    'hw.pci.enable_msix' and 'hw.pci.enable_msi' tunables.  This function
    should return the largest value that pci_alloc_msi() can return
    (assuming the MD code is able to allocate sufficient backing resources
    for all of the messages).
- Add default implementations for these 3 methods to the pci_driver generic
  PCI bus driver.  (The various other PCI bus drivers such as for ACPI and
  OFW will inherit these default implementations.)  This default
  implementation depends on 4 new pcib_if methods that bubble up through
  the PCI bridges to the MD code to allocate IRQ values and perform any
  needed MD setup code needed:
  - PCIB_ALLOC_MSI() attempts to allocate a group of MSI messages.
  - PCIB_RELEASE_MSI() releases a group of MSI messages.
  - PCIB_ALLOC_MSIX() attempts to allocate a single MSI-X message.
  - PCIB_RELEASE_MSIX() releases a single MSI-X message.
- Add default implementations for these 4 methods that just pass the
  request up to the parent bus's parent bridge driver and use the
  default implementation in the various MI PCI bridge drivers.
- Add MI functions for use by MD code when managing MSI and MSI-X
  interrupts:
  - pci_enable_msi(dev, address, data) programs the MSI capability address
    and data registers for a group of MSI messages
  - pci_enable_msix(dev, index, address, data) initializes a single MSI-X
    message in the MSI-X table
  - pci_mask_msix(dev, index) masks a single MSI-X message
  - pci_unmask_msix(dev, index) unmasks a single MSI-X message
  - pci_pending_msix(dev, index) returns true if the specified MSI-X
    message is currently pending
- Save the MSI capability address and data registers in the pci_cfgreg
  block in a PCI devices ivars and restore the values when a device is
  resumed.  Note that the MSI-X table is not currently restored during
  resume.
- Add constants for MSI-X register offsets and fields.
- Record interesting data about any MSI-X capability blocks we come
  across in the pci_cfgreg block in the ivars for PCI devices.

Tested on:	em (i386, MSI), bce (amd64/i386, MSI), mpt (amd64, MSI-X)
Reviewed by:	scottl, grehan, jfv
MFC after:	2 months
2006-11-13 21:47:30 +00:00
..
amd64 Various fixes: 2006-11-13 21:14:54 +00:00
arm Fix a comment. 2006-11-13 06:26:57 +00:00
boot MFp4: boot2 should now build 2006-11-09 20:45:22 +00:00
bsm Merge OpenBSM 1.0 alpha 12 import changes into src/sys/bsm. New events 2006-09-25 12:22:07 +00:00
cam XPT_GET_TRAN_SETTINGS can fail- so check for an error and 2006-11-07 23:06:00 +00:00
coda change vop_lock handling to allowing tracking of callers' file and line for 2006-11-13 05:51:22 +00:00
compat Regen. 2006-11-11 21:49:08 +00:00
conf Add time-of-day support to sun4v 2006-11-13 01:02:18 +00:00
contrib Sweep kernel replacing suser(9) calls with priv(9) calls, assigning 2006-11-06 13:42:10 +00:00
crypto Initialize T1 to silent gcc warning. 2006-10-22 02:19:33 +00:00
ddb Set up the context for the dbbe_trace callback in the ddb. Otherwise, 2006-11-06 11:10:57 +00:00
dev First cut at MI support for PCI Message Signalled Interrupts (MSI): 2006-11-13 21:47:30 +00:00
fs change vop_lock handling to allowing tracking of callers' file and line for 2006-11-13 05:51:22 +00:00
gdb Convert to new console api 2006-05-26 13:54:27 +00:00
geom Fix ia64 build breakage. 2006-11-02 16:24:18 +00:00
gnu Sweep kernel replacing suser(9) calls with priv(9) calls, assigning 2006-11-06 13:42:10 +00:00
i4b Sweep kernel replacing suser(9) calls with priv(9) calls, assigning 2006-11-06 13:42:10 +00:00
i386 Fix NKPT comments to match reality. Note that the current value 2006-11-13 20:33:54 +00:00
ia64 Fix a comment. 2006-11-13 06:26:57 +00:00
isa Use calendaric calculation support from subr_clock.c instead of home-rolled. 2006-10-02 16:18:40 +00:00
isofs/cd9660 Sweep kernel replacing suser(9) calls with priv(9) calls, assigning 2006-11-06 13:42:10 +00:00
kern change vop_lock handling to allowing tracking of callers' file and line for 2006-11-13 05:51:22 +00:00
libkern Add strstr() function to the libkern. 2006-08-12 15:28:39 +00:00
modules Re-enable module build for POSIX semaphores. 2006-11-11 16:49:29 +00:00
net Teach an IPv6 to ppp(4). 2006-11-11 15:02:04 +00:00
net80211 Sweep kernel replacing suser(9) calls with priv(9) calls, assigning 2006-11-06 13:42:10 +00:00
netatalk Sweep kernel replacing suser(9) calls with priv(9) calls, assigning 2006-11-06 13:42:10 +00:00
netatm Sweep kernel replacing suser(9) calls with priv(9) calls, assigning 2006-11-06 13:42:10 +00:00
netgraph Sweep kernel replacing suser(9) calls with priv(9) calls, assigning 2006-11-06 13:42:10 +00:00
netinet Add SCTP as a known upper layer protocol over v6. 2006-11-13 19:07:32 +00:00
netinet6 -Fixes first of all the getcred on IPv6 and V4. The 2006-11-08 00:21:13 +00:00
netipsec Add priv.h include required to build FAST_IPSEC, which is not present in 2006-11-07 08:58:06 +00:00
netipx Sweep kernel replacing suser(9) calls with priv(9) calls, assigning 2006-11-06 13:42:10 +00:00
netkey With exception of the if_name() macro, all definitions in net_osdep.h 2006-08-04 21:27:40 +00:00
netnatm Change semantics of socket close and detach. Add a new protocol switch 2006-07-21 17:11:15 +00:00
netncp Sweep kernel replacing suser(9) calls with priv(9) calls, assigning 2006-11-06 13:42:10 +00:00
netsmb Sweep kernel replacing suser(9) calls with priv(9) calls, assigning 2006-11-06 13:42:10 +00:00
nfs
nfs4client Fixes up the handling of shared vnode lock lookups in the NFS client, 2006-09-13 18:39:09 +00:00
nfsclient honor nolockd flag in root mount options 2006-11-07 18:02:45 +00:00
nfsserver Sweep kernel replacing suser(9) calls with priv(9) calls, assigning 2006-11-06 13:42:10 +00:00
opencrypto When DIAGNOSTIC is defined, verify if we don't free crypto requests from 2006-06-06 15:04:52 +00:00
pc98 MFi386: revisions 1.634 and 1.639. 2006-11-09 08:03:37 +00:00
pccard
pci - Don't bother to include IDs of PCnet chips which are not supported 2006-11-07 19:44:41 +00:00
powerpc Make pmap_enter() responsible for setting PG_WRITEABLE instead 2006-11-12 21:48:34 +00:00
rpc
security Merge posix4/* into normal kernel hierarchy. 2006-11-11 16:26:58 +00:00
sparc64 Make pmap_enter() responsible for setting PG_WRITEABLE instead 2006-11-12 21:48:34 +00:00
sun4v Fix a comment. 2006-11-13 06:26:57 +00:00
sys change vop_lock handling to allowing tracking of callers' file and line for 2006-11-13 05:51:22 +00:00
tools Check for errors when registering and unregistering firmware modules. This 2006-06-16 21:06:03 +00:00
ufs change vop_lock handling to allowing tracking of callers' file and line for 2006-11-13 05:51:22 +00:00
vm There is no point in setting PG_REFERENCED on kmem_object pages because 2006-11-13 00:27:02 +00:00
Makefile Merge posix4/* into normal kernel hierarchy. 2006-11-11 16:26:58 +00:00