Home | History | Annotate | Download | only in pci
History log of /src/sys/arch/x86/pci/pci_intr_machdep.c
RevisionDateAuthorComments
 1.51  01-Aug-2020  jdolecek reorder includes to pull __HAVE_PCI_MSI_MSIX properly via
<x86/pci_machdep_common.h>
 1.50  17-Jun-2019  msaitoh KNF. No functional change.
 1.49  11-Feb-2019  cherry We reorganise definitions for XEN source support as follows:

XEN - common sources required for baseline XEN support.
XENPV - sources required for support of XEN in PV mode.
XENPVHVM - sources required for support for XEN in HVM mode.
XENPVH - sources required for support for XEN in PVH mode.
 1.48  02-Dec-2018  cherry make

options NO_PCI_MSI_MSIX

work again for arch/x86/
 1.47  27-Nov-2018  jdolecek actually allow pci_intr_alloc() with NULL count with MSI-X
 1.46  27-Nov-2018  jdolecek make pci_intr_alloc() try also MSI-X by default (with NULL count);
there are boards/emulators which only have MSI-X and no MSI, and
so far there is no evidence there are devices which support both
and don't work in MSI-X mode

this change is supposed to reduce amount of needed cut&paste code in drivers

discussed briefly with jmcneill@
 1.45  23-Sep-2018  cherry Revert:
http://mail-index.netbsd.org/source-changes/2018/09/10/msg098995.html

It is incorrect to infer semantics from usage.

the problem for which the original commit was intended should be fixed
within the callee intr_establish_xname() and not the caller:
pci_intr_find_intx_irq()

This was accomplished via:
http://mail-index.netbsd.org/source-changes/2018/09/20/msg099286.html
 1.44  10-Sep-2018  cherry In the NIOAPIC case, we do not need to support "legacy" irqs,
ie; We don't need to simultaneously pass back the irq in the
range 0 < irq < 16 (which are sometimes described as "legacy"
in src

This was non-obvious, until the semantics of "legacy" were
used in inconsistent ways in Xen (to also mean interrupts in
the 0 < irq < 256 range) which causes problems with attempting
to unify the sys/arch/x86/isa/isa_machdep.c:isa_intr_establish_xname()
function between XEN and !XEN

This commit should not affect current functionality on any
either native or Xen. It is needed for future code reorg, and
published now as a preview.
 1.43  24-Jun-2018  jdolecek branches: 1.43.2;
provide pci_intr_establish_xname() on x86 independantly from MSI,
so it's available on XEN too; change also the stub to use weak
symbol instead #ifdef
 1.42  04-Jan-2018  knakahara branches: 1.42.2;
fix "intrctl list" panic when ACPI is disabled.

reviewed by cherry@n.o and tested by msaitoh@n.o, thanks.
 1.41  28-Jul-2017  maxv Don't include malloc.h.
 1.40  01-Jun-2017  chs branches: 1.40.2;
remove checks for failure after memory allocation calls that cannot fail:

kmem_alloc() with KM_SLEEP
kmem_zalloc() with KM_SLEEP
percpu_alloc()
pserialize_create()
psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.
 1.39  28-Nov-2016  knakahara fix build of amd64/i386 with NO_PCI_MSI_MSIX option.
 1.38  11-Jul-2016  knakahara branches: 1.38.2;
pci_intr_type() is required pci_chipset_tag_t argument by other than x86.

pointed out by nonaka@n.o.
 1.37  17-Aug-2015  knakahara Add kernel code to support intrctl(8).
 1.36  13-Aug-2015  msaitoh - Don't take pci_attach_args as an argument in pci_msi[x]_count().
- Move prototypes of pci_msi[x]_count() from x86/x86/pci_machdep_common to
sys/dev/pci/pcivar.h.
- Move pci_msi[x]_count() from x86/pci/pci_msi_machdep.c to sys/dev/pci/pci.c
 1.35  24-Jul-2015  knakahara fix pci_intr_alloc(..., NULL, 0). reported nonaka@n.o
 1.34  21-Jul-2015  knakahara add pci_intr_alloc() API
 1.33  15-May-2015  knakahara pci_msi_string() must be used by MD code only.
 1.32  15-May-2015  knakahara refactor: change function names and move them.
 1.31  15-May-2015  knakahara unify INTx, MSI and MSI-X APIs without alloc. (alloc API is under discussion)
 1.30  27-Apr-2015  knakahara add x86 MD MSI/MSI-X support code.
 1.29  27-Apr-2015  knakahara add intr_handle_t and let pci_intr_handle_t use it.
 1.28  27-Apr-2015  knakahara add pci_intr_distribute(9) for x86.
 1.27  29-Mar-2014  christos branches: 1.27.6;
make pci_intr_string and eisa_intr_string take a buffer and a length
instead of relying in local static storage.
 1.26  26-Jan-2013  dyoung branches: 1.26.2;
Several registers and bitfields named IOAPIC_* actually belong to the
LAPIC, so rename them LAPIC_* and move to a more appropriate header
file.
 1.25  15-Jun-2012  yamt branches: 1.25.2;
comment
 1.24  15-Jun-2012  yamt assertions. use a macro. no functional changes.
 1.23  29-Aug-2011  dyoung branches: 1.23.2;
Use a loop instead of tail-recursion for the pci_intr(9) overrides.
This is the same change that I just made to the pci(9) overrides. While
I am here, fix a bug: use PCI_OVERRIDE_INTR_DISESTABLISH instead of
PCI_OVERRIDE_INTR_ESTABLISH for the pci_intr_disestablish(9) override.
 1.22  17-Aug-2011  dyoung In pci_msi_establish(), replace several anonymous constants with IOAPIC_
symbols. No change in the generated assembly.
 1.21  17-Aug-2011  dyoung Redefine PCI_MSI_* and PCI_PCIE_* constants in terms of bits(3).

Use named constants and more conventional variable names in
pci_msi_establish() and pci_msi_disestablish(). Fix a couple of bugs:
pci_msi_establish() returned a pointer to the struct intrhand instead of
to the struct msi_hdl as it was intended to, and pci_msi_disestablish()
did not free(9) the msi_hdl.
 1.20  01-Aug-2011  drochner add an experimental implementation of PCI MSIs (Message Signaled
Interrupts). Successfully tested with hdaudio and "wpi" wireless
ethernet.
notes:
-There seem to be buggy chips around which announce MSI support
but don't correctly implement it. Thus the final word whether MSIs
can be used should be by the driver.
-Only a single vector is supported. For multiple vectors, the IDT
allocation code would have to be changed. (And we would possibly
run into problems due to the limited number of vectors supported
by the current code.)
-The code is "#if NIOAPIC > 0" because it uses the ioapic_edge
interrupt stubs. These actually don't touch any ioapic, so this
is somewhat a misnomer.
-MSIs can't be identified by a "pin" but only by a cpu/vector
pair. Common intr code soesn't deal well with this yet.
-Drivers need to take care of saving/restoring MSI data in the device's
config space on suspend/resume.
 1.19  04-Apr-2011  dyoung Neither pci_dma64_available(), pci_probe_device(), pci_mapreg_map(9),
pci_find_rom(), pci_intr_map(9), pci_enumerate_bus(), nor the match
predicate passed to pciide_compat_intr_establish() should ever modify
their pci_attach_args argument, so make their pci_attach_args arguments
const and deal with the fallout throughout the kernel.

For the most part, these changes add a 'const' where there was no
'const' before, however, some drivers and MD code used to modify
pci_attach_args. Now those drivers either copy their pci_attach_args
and modify the copy, or refrain from modifying pci_attach_args:

Xen: according to Manuel Bouyer, writing to pci_attach_args in
pci_intr_map() was a leftover from Xen 2. Probably a bug. I
stopped writing it. I have not tested this change.

siside(4): sis_hostbr_match() needlessly wrote to pci_attach_args.
Probably a bug. I use a temporary variable. I have not tested this
change.

slide(4): sl82c105_chip_map() overwrote the caller's pci_attach_args.
Probably a bug. Use a local pci_attach_args. I have not tested
this change.

viaide(4): via_sata_chip_map() and via_sata_chip_map_new() overwrote the
caller's pci_attach_args. Probably a bug. Make a local copy of the
caller's pci_attach_args and modify the copy. I have not tested
this change.

While I'm here, make pci_mapreg_submap() static.

With these changes in place, I have tested the compilation of these
kernels:

alpha GENERIC
amd64 GENERIC XEN3_DOM0
arc GENERIC
atari HADES MILAN-PCIIDE
bebox GENERIC
cats GENERIC
cobalt GENERIC
evbarm-eb NSLU2
evbarm-el ADI_BRH ARMADILLO9 CP3100 GEMINI GEMINI_MASTER GEMINI_SLAVE GUMSTIX
HDL_G IMX31LITE INTEGRATOR IQ31244 IQ80310 IQ80321 IXDP425 IXM1200
KUROBOX_PRO LUBBOCK MARVELL_NAS NAPPI SHEEVAPLUG SMDK2800 TEAMASA_NPWR
TEAMASA_NPWR_FC TS7200 TWINTAIL ZAO425
evbmips-el AP30 DBAU1500 DBAU1550 MALTA MERAKI MTX-1 OMSAL400 RB153 WGT624V3
evbmips64-el XLSATX
evbppc EV64260 MPC8536DS MPC8548CDS OPENBLOCKS200 OPENBLOCKS266
OPENBLOCKS266_OPT P2020RDB PMPPC RB800 WALNUT
hp700 GENERIC
i386 ALL XEN3_DOM0 XEN3_DOMU
ibmnws GENERIC
macppc GENERIC
mvmeppc GENERIC
netwinder GENERIC
ofppc GENERIC
prep GENERIC
sandpoint GENERIC
sgimips GENERIC32_IP2x
sparc GENERIC_SUN4U KRUPS
sparc64 GENERIC

As of Sun Apr 3 15:26:26 CDT 2011, I could not compile these kernels
with or without my patches in place:

### evbmips-el GDIUM

nbmake: nbmake: don't know how to make /home/dyoung/pristine-nbsd/src/sys/arch/mips/mips/softintr.c. Stop

### evbarm-el MPCSA_GENERIC
src/sys/arch/evbarm/conf/MPCSA_GENERIC:318: ds1672rtc*: unknown device `ds1672rtc'

### ia64 GENERIC

/tmp/genassym.28085/assym.c: In function 'f111':
/tmp/genassym.28085/assym.c:67: error: invalid application of 'sizeof' to incomplete type 'struct pcb'
/tmp/genassym.28085/assym.c:76: error: dereferencing pointer to incomplete type

### sgimips GENERIC32_IP3x

crmfb.o: In function `crmfb_attach':
crmfb.c:(.text+0x2304): undefined reference to `ddc_read_edid'
crmfb.c:(.text+0x2304): relocation truncated to fit: R_MIPS_26 against `ddc_read_edid'
crmfb.c:(.text+0x234c): undefined reference to `edid_parse'
crmfb.c:(.text+0x234c): relocation truncated to fit: R_MIPS_26 against `edid_parse'
crmfb.c:(.text+0x2354): undefined reference to `edid_print'
crmfb.c:(.text+0x2354): relocation truncated to fit: R_MIPS_26 against `edid_print'
 1.18  20-Dec-2010  matt branches: 1.18.2;
Move counting of faults, traps, intrs, soft[intr]s, syscalls, and nswtch
from uvmexp to per-cpu cpu_data and move them to 64bits. Remove unneeded
includes of <uvm/uvm_extern.h> and/or <uvm/uvm.h>.
 1.17  28-Apr-2010  dyoung Provide an x86 implementation of pci_chipset_tag_create(9) and
pci_chipset_tag_destroy(9).
 1.16  14-Mar-2010  dyoung branches: 1.16.2;
Add a new member, pc_super, to x86's pci_chipset_tag: pc.pc_super points
to the tag that pc inherits its behavior from. Add code to deal with
pc.pc_super.

Pull identical declarations out of xen/include/pci_machdep.h and
x86/include/pci_machdep.h into x86/include/pci_machdep_common.h.
 1.15  25-Feb-2010  dyoung In the x86 pci(9) implementation, test for and call a
pci_chipset_tag_t's override functions.
 1.14  18-Aug-2009  jmcneill branches: 1.14.2;
Switch to ACPICA 20090730, and update for API changes.
 1.13  21-Mar-2009  ad Fix 'boot -z' bogons.
 1.12  03-Jul-2008  drochner branches: 1.12.4; 1.12.10;
Remove "struct device" from "struct pic", where it was only real
for ioapics and faked up for others. Add it to "struct ioapic_softc"
for now, until device/softc get split.
This required all typecasts between "struct pic" and "struct ioapic_softc"
to be replaced, I hope I got them all.
functionally tested on i386, compile-tested on xen, untested on amd64
 1.11  30-May-2008  ad branches: 1.11.2;
pci_intr_setattr(), allows PCI interrupts to be marked MPSAFE on x86, and
other platforms if the code is added.

pci_intr_map(...)
pci_intr_setattr(pc, ih, PCI_INTR_MPSAFE, 1);
pci_intr_establish(...)
 1.10  30-May-2008  ad Add a 'known_mpsafe' argument to intr_establish().
 1.9  03-May-2008  cegger branches: 1.9.2;
ansify
 1.8  28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.7  04-Jan-2008  ad branches: 1.7.6; 1.7.8; 1.7.10;
sys/lock.h isn't needed here.
 1.6  16-Nov-2006  christos branches: 1.6.28; 1.6.34; 1.6.42;
__unused removal on arguments; approved by core.
 1.5  12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.4  04-Jul-2006  christos branches: 1.4.4; 1.4.6; 1.4.8;
spell NACPI correctly.
 1.3  04-Jul-2006  christos PR/33912: tron: Building GENERIC kernel fails
Fallout from ACPI changes.
 1.2  04-Jul-2006  christos Apply fvdl's acpi pci interrupt configuration code.
- MPACPI is no more.
- MPACPI_SCANPCI -> ACPI_SCANPCI
 1.1  03-Feb-2006  bouyer branches: 1.1.4; 1.1.6; 1.1.14; 1.1.16;
Split move interrupt-related PCI functions from pci_machdep.c to
pci_intr_machdep.c. In Xen-3 registers access is done the normal way but
interrupts need custom setup. Proposed on port-amd64, port-i386 and
port-xen a week ago.
 1.1.16.4  21-Jan-2008  yamt sync with head
 1.1.16.3  30-Dec-2006  yamt sync with head.
 1.1.16.2  21-Jun-2006  yamt sync with head.
 1.1.16.1  03-Feb-2006  yamt file pci_intr_machdep.c was added on branch yamt-lazymbuf on 2006-06-21 14:57:56 +0000
 1.1.14.1  13-Jul-2006  gdamore Merge from HEAD.
 1.1.6.1  11-Aug-2006  yamt sync with head
 1.1.4.2  18-Feb-2006  yamt sync with head.
 1.1.4.1  03-Feb-2006  yamt file pci_intr_machdep.c was added on branch yamt-uio_vmspace on 2006-02-18 15:38:54 +0000
 1.4.8.2  10-Dec-2006  yamt sync with head.
 1.4.8.1  22-Oct-2006  yamt sync with head
 1.4.6.2  09-Sep-2006  rpaulo sync with head
 1.4.6.1  04-Jul-2006  rpaulo file pci_intr_machdep.c was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:44:49 +0000
 1.4.4.1  18-Nov-2006  ad Sync with head.
 1.6.42.1  08-Jan-2008  bouyer Sync with HEAD
 1.6.34.1  18-Feb-2008  mjf Sync with HEAD.
 1.6.28.1  09-Jan-2008  matt sync with HEAD
 1.7.10.5  11-Aug-2010  yamt sync with head.
 1.7.10.4  11-Mar-2010  yamt sync with head
 1.7.10.3  19-Aug-2009  yamt sync with head.
 1.7.10.2  04-May-2009  yamt sync with head.
 1.7.10.1  16-May-2008  yamt sync with head.
 1.7.8.2  04-Jun-2008  yamt sync with head
 1.7.8.1  18-May-2008  yamt sync with head.
 1.7.6.2  28-Sep-2008  mjf Sync with HEAD.
 1.7.6.1  02-Jun-2008  mjf Sync with HEAD.
 1.9.2.2  18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.9.2.1  23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.11.2.1  03-Jul-2008  simonb Sync with head.
 1.12.10.6  27-Aug-2011  jym Sync with HEAD. Most notably: uvm/pmap work done by rmind@, and MP Xen
work of cherry@.

No regression observed on suspend/restore.
 1.12.10.5  02-May-2011  jym Sync with head.
 1.12.10.4  10-Jan-2011  jym Sync with HEAD
 1.12.10.3  24-Oct-2010  jym Sync with HEAD
 1.12.10.2  01-Nov-2009  jym Sync with HEAD.
 1.12.10.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.12.4.1  28-Apr-2009  skrll Sync with HEAD.
 1.14.2.1  30-Apr-2010  uebayasi Sync with HEAD.
 1.16.2.3  21-Apr-2011  rmind sync with head
 1.16.2.2  05-Mar-2011  rmind sync with head
 1.16.2.1  30-May-2010  rmind sync with head
 1.18.2.1  06-Jun-2011  jruoho Sync with HEAD.
 1.23.2.2  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.23.2.1  30-Oct-2012  yamt sync with head
 1.25.2.3  03-Dec-2017  jdolecek update from HEAD
 1.25.2.2  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.25.2.1  25-Feb-2013  tls resync with head
 1.26.2.1  18-May-2014  rmind sync with head
 1.27.6.5  28-Aug-2017  skrll Sync with HEAD
 1.27.6.4  05-Dec-2016  skrll Sync with HEAD
 1.27.6.3  05-Oct-2016  skrll Sync with HEAD
 1.27.6.2  22-Sep-2015  skrll Sync with HEAD
 1.27.6.1  06-Jun-2015  skrll Sync with HEAD
 1.38.2.1  07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.40.2.1  13-Jan-2018  snj Pull up following revision(s) (requested by knakahara in ticket #493):
sys/arch/x86/include/intr.h: revision 1.53
sys/arch/x86/pci/pci_intr_machdep.c: revision 1.42
sys/arch/x86/x86/intr.c: revision 1.114 via patch
fix "intrctl list" panic when ACPI is disabled.
reviewed by cherry@n.o and tested by msaitoh@n.o, thanks.
 1.42.2.3  26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.42.2.2  30-Sep-2018  pgoyette Ssync with HEAD
 1.42.2.1  25-Jun-2018  pgoyette Sync with HEAD
 1.43.2.2  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.43.2.1  10-Jun-2019  christos Sync with HEAD

RSS XML Feed