Home | History | Annotate | Download | only in pci
History log of /src/sys/arch/alpha/pci/sio_pic.c
RevisionDateAuthorComments
 1.54  17-Aug-2024  thorpej In cy82c693_setup_elcr(), panic if cy82c693_init() fails as I suggested
should be done in a comment I wrote in this very file 26 years ago.
 1.53  15-Jul-2021  thorpej - Use defined constants for PIC registers, not magic numbers.
- Inline specific_eoi().

NFC.
 1.52  04-Jul-2021  thorpej Remove unnecessary #include <sys/malloc.h>
 1.51  04-Jul-2021  thorpej Reduce code duplication when setting up the interrupt handler data
structures:
- alpha_shared_intr_alloc() no longer takes a "string length" argument,
and just uses kmem_asprintf() to create an "irq %u" string by default.
This is suitable for nearly every caller.
- Add a alpha_shared_intr_set_string() that allows callers to override
the default IRQ description string.
- Related: make alpha_shared_intr_string() return a const char *, since
no callers should need to modify the string directly now.
- Re-factor PCI shared interrupt structure allocation / initialization
into a new alpha_pci_intr_alloc(), which is suitable for nearly every
Alpha PCI platform. Callers are expected to first have initialized
the interrupt hardware to the quiescent state.

Adjust various call sites of above functions to account for changes,
even if they are not able to use the newly re-factored code.
 1.50  25-Jun-2021  thorpej Tweak how the IRQ description strings are generated to enable additional
duplicated code re-factoring.
 1.49  25-Jun-2021  thorpej Reduce code duplication among platforms that use the i82378 SIO to
route PCI interrupts to the ISA PIC by refactoring it into a new
sio_pirq_intr_map() function.
 1.48  08-May-2021  thorpej More symbol sanitizing.
 1.47  07-May-2021  thorpej Liberally sprinkle static around to get more symbols out of the
global namespace. A small bit of const poisoning in the TC code.
 1.46  29-Sep-2020  thorpej branches: 1.46.6;
If running in Qemu, don't report stray edge-triggered ISA interrupts.
Works around an issue I obvserved with serial console in Qemu.
 1.45  25-Sep-2020  thorpej Changes to make interrupt {,dis}establish MP-safe on Alpha:
- Protect all of the system interrupt linkage with the cpu_lock mutex.
- Re-order some of the stores to the SCB vector table to make it safe
in the face of lockless interrupt dispatch.
- Add a framework for routing interrupts to specific CPUs. Interrupts
are still funneled only to the primary CPU, but that will change for
some systems soon. Ensure that interrupt handler lists are manipulated
only on the CPUs that handle that specific interrupt source. This required
a re-factor of the alpha_shared_intr_*() family of functions.
- Enable __HAVE_INTR_CONTROL, although interrupt redistribution is still
a no-op.
- Reduce code duplication in the Jenson direct-SCB interrupt handlers.
 1.44  22-Sep-2020  thorpej Changes to make MPSAFE interrupts work on Alpha:

- Remove the ipl argument to scb_set() and the associated array of
"mpsafe" booleans initialized based on the ipl. It was bogus
anyway; all IPL_{BIO,NET,TTY}, etc. values are aliases of IPL_VM,
and for all practical purposes, there is really only one device
interrrupt level on Alpha anyway. Intead, we now treat all dispatches
from the SCB vector table as MP-safe, and it is now the handler for
that vector who is responsible for acquiring the KERNEL_LOCK if needed.

- Update the direct interrupt vector handlers in jensenio and TURBOchannel
to acquire the KERNEL_LOCK.

- Introduce a new ALPHA_INTR_MPSAFE flag, and add a flags argument to
alpha_shared_intr_establish(). When it is set, indicate that the
handler is MP-safe. Update alpha_shared_intr_dispatch() to pay
attention and acquire the KERNEL_LOCK (or not) as indicated.

- Re-factor all of the PCI interrupt handling, providing "generic PCI"
"PCI interrupts through ISA IRQs" implementations to significantly
reduce code duplication. Supplement the PCI chipset tag with more
info to facilitate this, and make the PCI interrupt-related routines
take a pci_chipset_tag_t argument rather than a void * argument.

- Because PCI interrupts on KN8AE are dispatched directly from the
SCB, provide a wrapper for non-MPSAFE interrupt handlers that
acquires the KERNEL_LOCK.

- Change the pci_intr_handle_t type to be a struct rather than an
integer type in order to catch any direct use of it as a value.
Add a set of functions to interact with pci_intr_handle_t, including
setting interrupt flags.

- Implement pci_intr_setattr() so that the PCI_INTR_MPSAFE attribute
can be set on a pci_intr_handle_t.

- While I'm here, make all of the MI PCI back-end operations call
through real functions rather than hopping directly through function
pointers in the chipset tag.

This change looks a lot bigger than it really is because of the re-factor
in the plethora of model-specific PCI interrupt back-ends. The KN8AE,
KN300, and T2/T3/T4 (Sable) are largely un-changed.
 1.43  21-Mar-2014  christos gc sprintf; reduce local static usage of interrupt strings that are only
used once for autoconf printing.
 1.42  06-Feb-2012  matt branches: 1.42.6; 1.42.10;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.41  01-Jul-2011  dyoung branches: 1.41.2; 1.41.6;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.40  16-Mar-2009  dsl ANSIfy functions with function-pointer arguments
 1.39  14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.38  14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.37  14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.36  28-Apr-2008  martin branches: 1.36.8; 1.36.14;
Remove clause 3 and 4 from TNF licenses
 1.35  03-Dec-2007  ad branches: 1.35.14; 1.35.16; 1.35.18;
Interrupt handling changes, in discussion since February:

- Reduce available SPL levels for hardware devices to none, vm, sched, high.
- Acquire kernel_lock only for interrupts at IPL_VM.
- Implement threaded soft interrupts.
 1.34  11-Dec-2005  christos branches: 1.34.30; 1.34.48; 1.34.50; 1.34.56;
merge ktrace-lwp.
 1.33  29-Mar-2005  thorpej branches: 1.33.2;
- Add a alpha_shared_intr_reset_strays() function that resets the stray
interrupt counter for a given shared interrupt descriptor.
- When an interrupt is successfully handled, reset the strays counter,
thus preventing a "slow leak" from eventually shutting off the interrupt
vector. Idea taken from pci_kn300.c (which was changed to use the new
alpha_shared_intr_reset_strays() function).
 1.32  01-Jul-2004  mycroft branches: 1.32.4; 1.32.10;
Fix a really old ("since day one") bug: send specific EOIs to the PIC, not
non-specific EOIs. This really shouldn't matter so much, but I'm guessing
there's a strange interaction with the PALcode (possibly related to the fact
that the PALcode itself may be sending an EOI itself on some systems).

I have tested this on a Multia, and it appears to work just fine without the
INITIALLY_{ENABLED,LEVEL_TRIGGERED}() stuff now, so I'm also removing that.
 1.31  27-Sep-2002  provos branches: 1.31.6; 1.31.8;
remove trailing \n in panic(). approved perry.
 1.30  27-Jul-2001  thorpej branches: 1.30.2;
Rework the interrupt code, shaving some cycles off in the process.
Rather than an "iointr" routine that decomposes a vector into an
IRQ, we maintain a vector table directly, hooking up each "iointr"
routine at the correct vector. This also allows us to hook device
interrupts up to specific vectors (c.f. Jensen).

We can shave even more cycles off, here, and I will, but it requires
some changes to the alpha_shared_intr stuff.
 1.29  18-Dec-2000  thorpej branches: 1.29.4;
Put back the INITIALLY_{ENABLED,LEVEL_TRIGGERED}() PROM brain-damage
work-around. It's required in order for the DEC Multia (a very
brain-damaged little machine) to work properly.

Submitted by Juergen Weiss <weiss@uni-mainz.de>, addresses
port-alpha/11202.
 1.28  06-Jun-2000  thorpej Use the common 82c693 access functions to read/write the ELCR.
 1.27  05-Jun-2000  thorpej Switch to the new `evcnt' mechanism for counting interrupts. Maintain
a per-CPU interrupt counter for clock, device, and interprocessor
interrupts.
 1.26  04-Jun-2000  cgd Implement the more flexiable `evcnt' interface as discussed (briefly) on
tech-kern and now documented in evcnt(9).
 1.25  27-Feb-2000  mycroft branches: 1.25.2;
Nuke all the code associated with the INITIALLY_LEVEL_TRIGGERED() lossage, and
instead register a shutdownhook to restore the PIC state.
 1.24  30-Jul-1999  ross branches: 1.24.2;
Fix the 16-bytes-of-death bug by generating specific-EOI cycles during
sio_intr_setup().
 1.23  01-Aug-1998  thorpej branches: 1.23.6; 1.23.8; 1.23.10;
In sio_intr_disestablish, also make sure that IRQs 0, 1, 8, and 13
default to edge-triggered, just like in the setup.
 1.22  01-Aug-1998  thorpej Implement sio_intr_disestablish(), and ensure that an initially-enabled
interrupt is never disabled and an initially-level-triggered interrupt
never becomes untyped.
 1.21  23-May-1998  matt Add sio_intr_alloc (copied from i386's isa_intr_alloc) for PCMCIA.
 1.20  14-Apr-1998  thorpej Add support for the Cypress CY82C693 PCI-ISA bridge. This bridge is more or
less like an Intel SIO except that the ELCR registers are accessed differently
than on the Intel SIO.

XXX This code needs to be split up into bridge front-end and PIC back-end
XXX pieces.
 1.19  02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.18  07-Apr-1997  cgd branches: 1.18.4;
by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.17  07-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 1.16  17-Nov-1996  cgd branches: 1.16.2;
use the new common chained-interrupt support code.
 1.15  13-Nov-1996  cgd compile cleanly with:
-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual
 1.14  23-Oct-1996  cgd update for new bus.h macros. bus_io_* and bus_mem_* integrated into
single bus_space_* framework. Unfortunately, bus_space_{read,write}_*
operations still imply barriers. That will change soon.
 1.13  13-Oct-1996  christos backout previous kprintf change
 1.12  10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.11  15-Aug-1996  cgd clean up stray interrupt handling a bit.
 1.10  14-Jul-1996  cgd (1) Clean up interrupt handling slightly.
 1.9  05-Jun-1996  cgd pull down changes from NetBSD 1.2 release branch:
>Update for present reality (function names), clean up a bit (printfs,
>"panic: foo XXX"), and fix a couple of printf format specified bugs
>(which were normally #if 0'd out). Inspired by Multia/UDB support
>changes sent by Matt Thomas.
and:
>changes from Matt Thomas so that the Multia/UDB can attach its
>'com' interrupts, cleaned up some. Basically: if sharing type of
>new interrupt is different than what the hardware is currently set up
>for (e.g. requesting edge-triggered and the hardware is set up by
>the PROM for level triggered) and there are no interrupt handlers on
>that line already, warn about it and use the hardware type that the
>line was already set for (to avoid making the console blow up on
>reboot). If same circumstances but there is already a handler, panic
>as before.
 1.8  05-Jun-1996  cgd avoid lots of upper-case letters in interrupt names. prettier that way.
 1.7  13-Apr-1996  cgd branches: 1.7.4;
note that these IRQs are ISA IRQs
 1.6  12-Apr-1996  cgd clean up copyrights and RCS IDs
 1.5  12-Apr-1996  cgd remove (hack) version of isa_intr_establish()
 1.4  12-Apr-1996  cgd clean up for new ISA and 'bus' code, etc.
 1.3  24-Dec-1995  mycroft The IST_* and IPL_* constants are not bus-specific; don't treat them as such.
Change splimp -> splnet in Ethernet, ARCnet, and FDDI drivers.
 1.2  23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.1  28-Jun-1995  cgd ISA and PCI support for DEC AlphaStations
 1.7.4.3  05-Jun-1996  cgd changes from Matt Thomas so that the Multia/UDB can attach its
'com' interrupts, cleaned up some. Basically: if sharing type of
new interrupt is different than what the hardware is currently set up
for (e.g. requesting edge-triggered and the hardware is set up by
the PROM for level triggered) and there are no interrupt handlers on
that line already, warn about it and use the hardware type that the
line was already set for (to avoid making the console blow up on
reboot). If same circumstances but there is already a handler, panic
as before.
 1.7.4.2  05-Jun-1996  cgd Update for present reality (function names), clean up a bit (printfs,
"panic: foo XXX"), and fix a couple of printf format specified bugs
(which were normally #if 0'd out). Inspired by Multia/UDB support
changes sent by Matt Thomas.
 1.7.4.1  05-Jun-1996  cgd Pull up from trunk:
>avoid lots of upper-case letters in interrupt names. prettier that way.
 1.16.2.1  01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.18.4.1  04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.23.10.1  30-Nov-1999  itojun bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

The branch does not compile at all (due to the lack of ALTQ and some other
source code). Please do not try to modify the branch, this is just for
referenre purposes.

synchronization to latest KAME will take place on HEAD branch soon.
 1.23.8.1  02-Aug-1999  thorpej Update from trunk.
 1.23.6.1  08-Aug-1999  cgd pull up rev 1.24 from trunk (ross)
 1.24.2.2  05-Jan-2001  bouyer Sync with HEAD
 1.24.2.1  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.25.2.1  22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.29.4.2  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.29.4.1  03-Aug-2001  lukem update to -current
 1.30.2.2  18-Oct-2002  nathanw Catch up to -current.
 1.30.2.1  27-Jul-2001  nathanw file sio_pic.c was added on branch nathanw_sa on 2002-10-18 02:34:25 +0000
 1.31.8.1  02-Jul-2004  he branches: 1.31.8.1.2;
Pull up revision 1.32 (requested by mycroft in ticket #582):
Fix a really old ("since day one" bug: send specific EOIs
to the PIC, not non-specific EOIs. Should not matter so
much, but strange interaction with PALcode, possibly only
on some systems, is suspected.
 1.31.8.1.2.1  11-May-2005  riz Pull up revision 1.33 (requested by thorpej in ticket #1373):
- Add a alpha_shared_intr_reset_strays() function that resets the
stray
interrupt counter for a given shared interrupt descriptor.
- When an interrupt is successfully handled, reset the strays counter,
thus preventing a "slow leak" from eventually shutting off the
interrupt
vector. Idea taken from pci_kn300.c (which was changed to use
the new
alpha_shared_intr_reset_strays() function).
 1.31.6.4  01-Apr-2005  skrll Sync with HEAD.
 1.31.6.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.31.6.2  18-Sep-2004  skrll Sync with HEAD.
 1.31.6.1  03-Aug-2004  skrll Sync with HEAD
 1.32.10.1  30-Mar-2005  tron Pull up revision 1.33 (requested by thorpej in ticket #76):
- Add a alpha_shared_intr_reset_strays() function that resets the
stray
interrupt counter for a given shared interrupt descriptor.
- When an interrupt is successfully handled, reset the strays counter,
thus preventing a "slow leak" from eventually shutting off the
interrupt
vector. Idea taken from pci_kn300.c (which was changed to use
the new
alpha_shared_intr_reset_strays() function).
 1.32.4.1  29-Apr-2005  kent sync with -current
 1.33.2.1  07-Dec-2007  yamt sync with head
 1.34.56.1  08-Dec-2007  mjf Sync with HEAD.
 1.34.50.1  09-Jan-2008  matt sync with HEAD
 1.34.48.1  09-Dec-2007  jmcneill Sync with HEAD.
 1.34.30.1  03-Dec-2007  ad Sync with HEAD.
 1.35.18.2  04-May-2009  yamt sync with head.
 1.35.18.1  16-May-2008  yamt sync with head.
 1.35.16.1  18-May-2008  yamt sync with head.
 1.35.14.1  02-Jun-2008  mjf Sync with HEAD.
 1.36.14.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.36.8.1  28-Apr-2009  skrll Sync with HEAD.
 1.41.6.1  18-Feb-2012  mrg merge to -current.
 1.41.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.41.2.1  17-Apr-2012  yamt sync with head
 1.42.10.1  18-May-2014  rmind sync with head
 1.42.6.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.46.6.2  01-Aug-2021  thorpej Sync with HEAD.
 1.46.6.1  13-May-2021  thorpej Sync with HEAD.

RSS XML Feed