Home | History | Annotate | Download | only in pci
History log of /src/sys/arch/i386/pci/pci_intr_fixup.c
RevisionDateAuthorComments
 1.52  16-Sep-2021  andvar fix typos in word "successfully", mainly s/succesfully/successfully/.
 1.51  10-Nov-2019  chs in many device attach paths, allocate memory with M_WAITOK instead of M_NOWAIT
and remove code to handle failures that can no longer happen.
 1.50  09-Sep-2014  apb branches: 1.50.20;
__USE(id) in the !PCIBIOSVERBOSE case.
Fixes PR 49181.
 1.49  01-Jul-2011  dyoung branches: 1.49.12; 1.49.28;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.48  06-Jun-2011  msaitoh Rename to use PCI_PRODUCT_INTEL_82801DBM_LPC
 1.47  28-Apr-2008  martin branches: 1.47.14; 1.47.22; 1.47.32;
Remove clause 3 and 4 from TNF licenses
 1.46  10-Dec-2006  uwe branches: 1.46.44; 1.46.46; 1.46.48;
For consistency use PCIBIOS_PRINTV instead of printf even under
#ifdef PCIBIOSVERBOSE.
 1.45  16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.44  12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.43  03-Sep-2006  christos branches: 1.43.2; 1.43.4;
add missing initializers.
 1.42  22-Jun-2006  jmcneill Add an 'uninit' callback to PCI ICU drivers. This allows (for example) the
PIIX support to release its mapping on the edge/level control registers.

Now that these are guaranteed to be unmapped, capture and restore the
registers in piixpcib(4)'s powerhook. The same will need to be done on a
per-chipset basis.

Concerns were raised about calling pci_intr_fixup on resume WRT hotplug
devices, so this has been removed.

Ok cube@.
 1.41  21-Jun-2006  jmcneill Allow pci_intr_fixup() to be called more than once.
 1.40  18-Jun-2006  xtraeme Fix AMD 766 PMC entry.
 1.39  18-Jun-2006  xtraeme Match the following products:

* SIS 962 and SIS 963
* AMD 766 and AMD 768
* ALI M1533

... syncing the code with openbsd.
 1.38  20-May-2006  christos branches: 1.38.2;
Add another fixup entry Arthur Dimitrelis
 1.37  16-Feb-2006  kochi branches: 1.37.2; 1.37.6; 1.37.8;
add some more Intel LPC controllers
 1.36  01-Jan-2006  xtraeme branches: 1.36.2; 1.36.4;
PCI Interrupt router support for VIA VT823[1357] Southbridges.
From OpenBSD.
 1.35  26-Dec-2005  perry branches: 1.35.2;
u_intN_t -> uintN_t
 1.34  25-Dec-2005  rpaulo Add Intel 82801FBM ICH6M LPC Interface Bridge. There seem to be more
pci products missing, but I can only test this one.
 1.33  11-Dec-2005  christos merge ktrace-lwp.
 1.32  21-Jun-2005  sekiya branches: 1.32.2;
Rework the configuration scheme for PCI fixups:

* bus enumeration fixups are not PCIBIOS-specific, interrupt fixups are done
by both PCIBIOS and ACPI. The redundancy is very redundant. Therefore,
rename PCIBIOS_*_FIXUP to PCI_*_FIXUP, use PCI_INTR_FIXUP in place of
ACPI_PCI_FIXUP, and change code refences to match.

* move the fixup defines from opt_pcibios.h to opt_pcifixup.h to reflect
the above.

* fix up the PCI bus numbering in mainbus_attach(), right after we detect the
configuration mode. This probably renders the fixup in pcibios.c
redundant -- but it should be harmless.

These changes make cardbus work in ACPI-only machines, when PCI_BUS_FIXUP
and PCI_INTR_FIXUP are defined.
 1.31  03-Feb-2005  perry de-__P, partially ANSIfy
 1.30  30-Apr-2004  christos branches: 1.30.4; 1.30.6;
Deal with edge versus level interrupts properly. From Masanori Kanaoka.
 1.29  11-Apr-2004  kochi de __P, ANSIfy PCIBIOS related files.
 1.28  04-Apr-2004  kochi Support for PIRQ[E-H], found in recent intel south bridges
(ICH2 and later), which fixes PR/23700.
The changes are from Hiroyuki Bessho and Masanori Kanaoka in PR/23700
with a little modification of interrupt router lookup from mine.
 1.27  27-Oct-2003  christos branches: 1.27.2;
Back out the libretto related hacks I accidentally committed. They are
in CVS in case one wants them :-)
 1.26  25-Oct-2003  christos Fix uninitialized variable warnings
 1.25  13-Oct-2003  dyoung Add the 82801EB LPC, which provides the PCI Interrupt Router on
the Dell PowerEdge 400SC.
 1.24  05-Apr-2003  perry branches: 1.24.2;
Recognize VT82C596A
Patch from Christopher SEKIYA in PR port-i386/21013
 1.23  26-Feb-2003  fvdl Adapt for i386/x86 change.
 1.22  22-Nov-2002  fvdl New interrupt code. The basic idea behind it is to hide the differences
in interrupt controllers in struct pic, and try to keep as much
common code as possible. At the lowest (asm) level, this is done
with CPP macros.

The main structure is now struct intrsource, describing an established
interrupt line, of any kind (soft/hard local apic/legacy apic/IO apic).
For quick masking, there may be a maximum of 32 sources per CPU.
Sources can be assigned to any CPU in the MP case, though currently they
all go to the boot CPU.
 1.21  20-Sep-2002  kanaoka Add support for "Intel 82801DB LPC".
kern/18348: From Andreas Wrede <andreas@planix.com>.
 1.20  01-Jun-2002  lukem branches: 1.20.2;
SIMPLEQ rototill:
- implement SIMPLEQ_REMOVE(head, elm, type, field). whilst it's O(n),
this mirrors the functionality of SLIST_REMOVE() (the other
singly-linked list type) and FreeBSD's STAILQ_REMOVE()
- remove the unnecessary elm arg from SIMPLEQ_REMOVE_HEAD().
this mirrors the functionality of SLIST_REMOVE_HEAD() (the other
singly-linked list type) and FreeBSD's STAILQ_REMOVE_HEAD()
- remove notes about SIMPLEQ not supporting arbitrary element removal
- use SIMPLEQ_FOREACH() instead of home-grown for loops
- use SIMPLEQ_EMPTY() appropriately
- use SIMPLEQ_*() instead of accessing sqh_first,sqh_last,sqe_next directly
- reorder manual page; be consistent about how the types are listed
- other minor cleanups
 1.19  07-Dec-2001  onoe branches: 1.19.10;
Add 82801BAM as piix.
Do not initialize global variables 'pciintr_icu_tag' to NULL.
Its type is 'const struct pciintr_icu *' (typedef'ed) and gcc sometimes(!)
put it in Text region. So force arrrange it to BSS.
 1.18  15-Nov-2001  lukem add RCSID
 1.17  27-Aug-2001  haya Add support for ALi M1543 in pcibios.
 1.16  01-Aug-2001  haya Add new entry for intel ICH2 LPC interrupt router. It has
upper compatibility with piix.
 1.15  17-Jul-2001  mrg fix a statementless label that gcc-current picked up.
 1.14  06-Jul-2001  mcr branches: 1.14.2;
extra argument to pci_device_foreach().
 1.13  16-May-2001  kanaoka Search the entire device-space of bus 0 if the router device
address is set to 000:00:0, and the compatible router entry
is undefined.

Patch PR port-i386/12880 by Dave Sainty <dave@dtsp.co.nz>.
 1.12  19-Apr-2001  uch patch PR port-i386/11114 by MINOURA Makoto.
 1.11  05-Jan-2001  aymeric branches: 1.11.4;
Initialize VIA Technologies' 82C686's ICU as if it were a 82C586.
This fixes interrupt allocation problems on modern Compaq laptops.
 1.10  10-Aug-2000  soda branches: 1.10.2;
Add another option PCIBIOS_INTR_GUESS for no compatible ICU found case.

Under this option, if only one IRQ is available for the link,
we assumes that the IRQ is already connected, and configure
PCI Interrupt Configuration Register accordingly.
This is what Linux pcmcia-cs-3.1.19 does by default.

This fixes unconfigured pccbb interrupt problem of
Sharp Mebius MN-5500. It's interrupt router is ITExpress Inc. IT8330G.
(http://www.ite.com.tw/, vendor=0x1283, product=0x8330)
Problem reporeted by Kitagawa <sk@kiu.ac.jp> in
http://www.kaynet.or.jp/~kay/ml/netbsd-pcmcia/msg/msg00608.html
 1.9  22-Jul-2000  soda better message from John Hawkinson <jhawk@MIT.EDU>
 1.8  18-Jul-2000  soda make PCIBIOS_IRQS_HINT patchable.
 1.7  18-Jul-2000  soda - Use PCIBIOS_PRINTV().
- Use PCI_INTERRUPT_PIN_MAX and I386_PCI_INTERRUPT_LINE_NO_CONNECTION
instead of magic number.

the Following changes are
{Modified with,Approved by} UCHIYAMA Yasushi <uch@netbsd.org>:

- Do not touch a PIRQ router, if the PIRQ is already routed
by the BIOS, or no appropriate IRQ is found for the PIRQ.
The latter prevents a panic on the machine of Frank van der Linden.

- Do not modify a PCI Interrupt Configuration register,
if it is already set by the BIOS, even if it is inconsistent
with the PCI IRQ routing table provided by the BIOS.
(The PCI Interrupt Configuration register seems to be more reliable
than the PCI IRQ routing table.)
This is needed to prevent a incorrect header_fixup() caused
by the incorrect PIR table on a Panasonic Let's Note AL-N2T516J5.

Provide "options PCIBIOS_INTR_FIXUP_FORCE" to retain
previous behavior, i.e. believe the PCI IRQ routing table
and ignore the PCI Interrupt Configuration register.
Although I'm not sure this is really needed.

- Do not modify a PCI Interrupt Configuration register,
if appropriate IRQ is not found for the link.

- Move a pciintr_icu_getclink() call and a pciintr_icu_get_intr()
call from pciintr_link_fixup() to pciintr_link_alloc(),
and only allocate pciintr_link_map if those calls succeeded.
This reduces number of calls of pciintr_icu_getclink(),
and also avoid necessity to validate a clink value in
ICU's {get,set}_{intr,trigger}() functions.
The sanity checks are not removed yet, though.

- Fix uninitialized usage of variable `bitmap' on stage 3
of pciintr_link_fixup().

- Remove a member variable `old_irq' from struct pciintr_link_map.

- Always use 0x%02x for printf format of canonical link value.

- Use DIAGNOSTIC instead of PCIINTR_DEBUG for really weird situation.
 1.6  09-Jul-2000  mycroft Do the interrupt fixup for all busses, not just bus 0.
This is necessary on some machines with multiple onboard PCI busses.
 1.5  28-Apr-2000  uch branches: 1.5.6;
PCIBIOS_IRQS changed to PCIBIOS_IRQS_HINT. PCIBIOS_IRQS_HINT is
used when no IRQ guess. when at least 1 PCI device configured
correctly, unused.
 1.4  25-Jan-2000  augustss Allow the set of PCI irqs to be overridden.
 1.3  13-Dec-1999  uch branches: 1.3.2;
initialize pciirq.
 1.2  17-Nov-1999  thorpej If we see a bogus $PIR table entry, just ignore it. The MPIIX has
entries for the IRQs used by the IDE controller, which aren't really
PCI IRQs (they're ISA compat IRQs), and thus have link values that
don't make a lot of sense.
 1.1  17-Nov-1999  thorpej PCI interrupt routing fixup code, from UCHIYAMA Yasushi's PCI BIOS
patches, cleaned up and heavily reworked by me. Basic algorithm is
the same, although the code structure is now quite different.

Main differences:
- Initialization path is totally different.
- We use the `compat router' information, if present, to determine which
PCI ICU driver we should use.
- Fixup configuration headers on devices not on bus 0.
 1.3.2.1  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.5.6.4  27-Oct-2001  he Pull up revision 1.17 (requested by hubertf):
Add support for ALi M1543 in pcibios as e.g. found in a Toshiba
Portege 4000.
Tested by hubertf.
 1.5.6.3  07-Jun-2001  he Pull up revision 1.11 (requested by aymeric):
Initialize VIA Tehcnologies' 82C686's ICU as if it were an 82C586.
Fixes interrupt allocation on modern Compaq laptops.
 1.5.6.2  10-Aug-2000  soda Pull up to netbsd-1-5 branch
Approved by: thorpej

- Use PCIBIOS_PRINTV().

- Use PCI_INTERRUPT_PIN_MAX and I386_PCI_INTERRUPT_LINE_NO_CONNECTION
instead of magic number.

- Do not touch a PIRQ router, if the PIRQ is already routed
by the BIOS, or no appropriate IRQ is found for the PIRQ.
The latter prevents a panic on the machine of Frank van der Linden.

Do not modify a PCI Interrupt Configuration register,
if it is already set by the BIOS, even if it is inconsistent
with the PCI IRQ routing table provided by the BIOS.
(The PCI Interrupt Configuration register seems to be more reliable
than the PCI IRQ routing table.)
This is needed to prevent a incorrect header_fixup() caused
by the incorrect PIR table on a Panasonic Let's Note AL-N2T516J5.
Provide "options PCIBIOS_INTR_FIXUP_FORCE" to retain
previous behavior, i.e. believe the PCI IRQ routing table
and ignore the PCI Interrupt Configuration register.
Although I'm not sure this is really needed.

Do not modify a PCI Interrupt Configuration register,
if appropriate IRQ is not found for the link.

Move a pciintr_icu_getclink() call and a pciintr_icu_get_intr()
call from pciintr_link_fixup() to pciintr_link_alloc(),
and only allocate pciintr_link_map if those calls succeeded.
This reduces number of calls of pciintr_icu_getclink(),
and also avoid necessity to validate a clink value in
ICU's {get,set}_{intr,trigger}() functions.
The sanity checks are not removed yet, though.

Fix uninitialized usage of variable `bitmap' on stage 3
of pciintr_link_fixup().

Remove a member variable `old_irq' from struct pciintr_link_map.

Always use 0x%02x for printf format of canonical link value.

Use DIAGNOSTIC instead of PCIINTR_DEBUG for really weird situation.

Modified with UCHIYAMA Yasushi <uch@netbsd.org>.

- make PCIBIOS_IRQS_HINT patchable.

- better message from John Hawkinson <jhawk@MIT.EDU>

- Add another option PCIBIOS_INTR_GUESS for no compatible ICU found case.

Under this option, if only one IRQ is available for the link,
we assumes that the IRQ is already connected, and configure
PCI Interrupt Configuration Register accordingly.
This is what Linux pcmcia-cs-3.1.19 does by default.

This fixes unconfigured pccbb interrupt problem of
Sharp Mebius MN-5500. It's interrupt router is ITExpress Inc. IT8330G.
(http://www.ite.com.tw/, vendor=0x1283, product=0x8330)
Problem reporeted by Kitagawa <sk@kiu.ac.jp> in
http://www.kaynet.or.jp/~kay/ml/netbsd-pcmcia/msg/msg00608.html

Revision pulled up:
> cvs rdiff -r1.6 -r1.10 syssrc/sys/arch/i386/pci/pci_intr_fixup.c
 1.5.6.1  27-Jul-2000  mycroft Approved by thorpej:
Do interrupt fixup for all busses, not just bus 0. (There may be onboard
devices at other bus numbers, particularly on a machine with multiple primary
busses.)

syssrc/sys/arch/i386/pci/pci_intr_fixup.c 1.5 -> 1.6
 1.10.2.4  23-Apr-2001  bouyer Sync with HEAD.
 1.10.2.3  18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.10.2.2  20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.10.2.1  10-Aug-2000  bouyer file pci_intr_fixup.c was added on branch thorpej_scsipi on 2000-11-20 20:09:35 +0000
 1.11.4.7  11-Dec-2002  thorpej Sync with HEAD.
 1.11.4.6  18-Oct-2002  nathanw Catch up to -current.
 1.11.4.5  20-Jun-2002  nathanw Catch up to -current.
 1.11.4.4  08-Jan-2002  nathanw Catch up to -current.
 1.11.4.3  21-Sep-2001  nathanw Catch up to -current.
 1.11.4.2  24-Aug-2001  nathanw Catch up with -current.
 1.11.4.1  21-Jun-2001  nathanw Catch up to -current.
 1.14.2.5  10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.14.2.4  23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.14.2.3  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.14.2.2  13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.14.2.1  03-Aug-2001  lukem update to -current
 1.19.10.1  14-Jul-2002  gehenna catch up with -current.
 1.20.2.2  01-Jun-2002  lukem SIMPLEQ rototill:
- implement SIMPLEQ_REMOVE(head, elm, type, field). whilst it's O(n),
this mirrors the functionality of SLIST_REMOVE() (the other
singly-linked list type) and FreeBSD's STAILQ_REMOVE()
- remove the unnecessary elm arg from SIMPLEQ_REMOVE_HEAD().
this mirrors the functionality of SLIST_REMOVE_HEAD() (the other
singly-linked list type) and FreeBSD's STAILQ_REMOVE_HEAD()
- remove notes about SIMPLEQ not supporting arbitrary element removal
- use SIMPLEQ_FOREACH() instead of home-grown for loops
- use SIMPLEQ_EMPTY() appropriately
- use SIMPLEQ_*() instead of accessing sqh_first,sqh_last,sqe_next directly
- reorder manual page; be consistent about how the types are listed
- other minor cleanups
 1.20.2.1  01-Jun-2002  lukem file pci_intr_fixup.c was added on branch sommerfeld_i386mp_1 on 2002-06-01 23:50:56 +0000
 1.24.2.5  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.24.2.4  04-Feb-2005  skrll Sync with HEAD.
 1.24.2.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.24.2.2  18-Sep-2004  skrll Sync with HEAD.
 1.24.2.1  03-Aug-2004  skrll Sync with HEAD
 1.27.2.1  28-Apr-2004  jmc Pullup rev 1.28 (requested by kochi in ticket #188)

Support for PIRQ[E-H], found in recent intel south bridges
(ICH2 and later). PR#23700
 1.30.6.1  12-Feb-2005  yamt sync with head.
 1.30.4.1  29-Apr-2005  kent sync with -current
 1.32.2.2  30-Dec-2006  yamt sync with head.
 1.32.2.1  21-Jun-2006  yamt sync with head.
 1.35.2.2  18-Feb-2006  yamt sync with head.
 1.35.2.1  15-Jan-2006  yamt sync with head.
 1.36.4.2  01-Jun-2006  kardel Sync with head.
 1.36.4.1  22-Apr-2006  simonb Sync with head.
 1.36.2.1  09-Sep-2006  rpaulo sync with head
 1.37.8.1  19-Jun-2006  chap Sync with head.
 1.37.6.1  24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.37.2.3  14-Sep-2006  yamt sync with head.
 1.37.2.2  26-Jun-2006  yamt sync with head.
 1.37.2.1  24-May-2006  yamt sync with head.
 1.38.2.1  13-Jul-2006  gdamore Merge from HEAD.
 1.43.4.2  10-Dec-2006  yamt sync with head.
 1.43.4.1  22-Oct-2006  yamt sync with head
 1.43.2.2  12-Jan-2007  ad Sync with head.
 1.43.2.1  18-Nov-2006  ad Sync with head.
 1.46.48.1  16-May-2008  yamt sync with head.
 1.46.46.1  18-May-2008  yamt sync with head.
 1.46.44.1  02-Jun-2008  mjf Sync with HEAD.
 1.47.32.1  23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.47.22.1  12-Jun-2011  rmind sync with head
 1.47.14.1  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.49.28.1  11-Sep-2014  martin Pull up following revision(s) (requested by apb in ticket #88):
sys/arch/i386/pci/pci_intr_fixup.c: revision 1.50
__USE(id) in the !PCIBIOSVERBOSE case.
Fixes PR 49181.
 1.49.12.1  03-Dec-2017  jdolecek update from HEAD
 1.50.20.1  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411

RSS XML Feed