2000-08-11 01:18:27 +04:00
|
|
|
/* $NetBSD: pci_intr_fixup.c,v 1.10 2000/08/10 21:18:27 soda Exp $ */
|
1999-11-17 04:20:38 +03:00
|
|
|
|
|
|
|
/*-
|
|
|
|
* Copyright (c) 1999 The NetBSD Foundation, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This code is derived from software contributed to The NetBSD Foundation
|
|
|
|
* by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
|
|
|
|
* NASA Ames Research Center.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software developed by the NetBSD
|
|
|
|
* Foundation, Inc. and its contributors.
|
|
|
|
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
|
|
|
* contributors may be used to endorse or promote products derived
|
|
|
|
* from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
|
|
|
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
|
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
|
|
|
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 1999, by UCHIYAMA Yasushi
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. The name of the developer may NOT be used to endorse or promote products
|
|
|
|
* derived from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* PCI Interrupt Router support.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "opt_pcibios.h"
|
|
|
|
|
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/systm.h>
|
|
|
|
#include <sys/kernel.h>
|
|
|
|
#include <sys/malloc.h>
|
|
|
|
#include <sys/queue.h>
|
|
|
|
#include <sys/device.h>
|
|
|
|
|
|
|
|
#include <machine/bus.h>
|
|
|
|
#include <machine/intr.h>
|
|
|
|
|
|
|
|
#include <dev/pci/pcireg.h>
|
|
|
|
#include <dev/pci/pcivar.h>
|
|
|
|
#include <dev/pci/pcidevs.h>
|
|
|
|
|
|
|
|
#include <i386/isa/icu.h>
|
|
|
|
#include <i386/pci/pci_intr_fixup.h>
|
|
|
|
#include <i386/pci/pcibios.h>
|
|
|
|
|
|
|
|
struct pciintr_link_map {
|
|
|
|
int link;
|
|
|
|
int clink;
|
|
|
|
int irq;
|
|
|
|
u_int16_t bitmap;
|
|
|
|
int fixup_stage;
|
|
|
|
SIMPLEQ_ENTRY(pciintr_link_map) list;
|
|
|
|
};
|
|
|
|
|
2000-08-11 01:18:27 +04:00
|
|
|
pciintr_icu_tag_t pciintr_icu_tag = NULL;
|
1999-11-17 04:20:38 +03:00
|
|
|
pciintr_icu_handle_t pciintr_icu_handle;
|
|
|
|
|
2000-07-18 15:37:56 +04:00
|
|
|
#ifdef PCIBIOS_IRQS_HINT
|
|
|
|
int pcibios_irqs_hint = PCIBIOS_IRQS_HINT;
|
|
|
|
#endif
|
|
|
|
|
- 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.
2000-07-18 15:22:36 +04:00
|
|
|
struct pciintr_link_map *pciintr_link_lookup __P((int));
|
1999-11-17 04:20:38 +03:00
|
|
|
struct pciintr_link_map *pciintr_link_alloc __P((struct pcibios_intr_routing *,
|
|
|
|
int));
|
|
|
|
struct pcibios_intr_routing *pciintr_pir_lookup __P((int, int));
|
- 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.
2000-07-18 15:22:36 +04:00
|
|
|
static int pciintr_bitmap_count_irq __P((int, int *));
|
|
|
|
static int pciintr_bitmap_find_lowest_irq __P((int, int *));
|
1999-11-17 04:20:38 +03:00
|
|
|
int pciintr_link_init __P((void));
|
2000-08-11 01:18:27 +04:00
|
|
|
#ifdef PCIBIOS_INTR_GUESS
|
|
|
|
int pciintr_guess_irq __P((void));
|
|
|
|
#endif
|
1999-11-17 04:20:38 +03:00
|
|
|
int pciintr_link_fixup __P((void));
|
|
|
|
int pciintr_link_route __P((u_int16_t *));
|
|
|
|
int pciintr_irq_release __P((u_int16_t *));
|
|
|
|
int pciintr_header_fixup __P((pci_chipset_tag_t));
|
2000-04-28 21:15:15 +04:00
|
|
|
void pciintr_do_header_fixup __P((pci_chipset_tag_t, pcitag_t));
|
1999-11-17 04:20:38 +03:00
|
|
|
|
|
|
|
SIMPLEQ_HEAD(, pciintr_link_map) pciintr_link_map_list;
|
|
|
|
|
|
|
|
const struct pciintr_icu_table {
|
|
|
|
pci_vendor_id_t piit_vendor;
|
|
|
|
pci_product_id_t piit_product;
|
|
|
|
int (*piit_init) __P((pci_chipset_tag_t,
|
|
|
|
bus_space_tag_t, pcitag_t, pciintr_icu_tag_t *,
|
|
|
|
pciintr_icu_handle_t *));
|
|
|
|
} pciintr_icu_table[] = {
|
|
|
|
{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82371MX,
|
|
|
|
piix_init },
|
|
|
|
{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82371AB_ISA,
|
|
|
|
piix_init },
|
|
|
|
{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82371FB_ISA,
|
|
|
|
piix_init },
|
|
|
|
{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82371SB_ISA,
|
|
|
|
piix_init },
|
|
|
|
|
|
|
|
{ PCI_VENDOR_OPTI, PCI_PRODUCT_OPTI_82C558,
|
|
|
|
opti82c558_init },
|
|
|
|
{ PCI_VENDOR_OPTI, PCI_PRODUCT_OPTI_82C700,
|
|
|
|
opti82c700_init },
|
|
|
|
|
|
|
|
{ PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT82C586_ISA,
|
|
|
|
via82c586_init, },
|
|
|
|
|
|
|
|
{ PCI_VENDOR_SIS, PCI_PRODUCT_SIS_85C503,
|
|
|
|
sis85c503_init },
|
|
|
|
|
|
|
|
{ 0, 0,
|
|
|
|
NULL },
|
|
|
|
};
|
|
|
|
|
|
|
|
const struct pciintr_icu_table *pciintr_icu_lookup __P((pcireg_t));
|
|
|
|
|
|
|
|
const struct pciintr_icu_table *
|
|
|
|
pciintr_icu_lookup(id)
|
|
|
|
pcireg_t id;
|
|
|
|
{
|
|
|
|
const struct pciintr_icu_table *piit;
|
|
|
|
|
|
|
|
for (piit = pciintr_icu_table;
|
|
|
|
piit->piit_init != NULL;
|
|
|
|
piit++) {
|
|
|
|
if (PCI_VENDOR(id) == piit->piit_vendor &&
|
|
|
|
PCI_PRODUCT(id) == piit->piit_product)
|
|
|
|
return (piit);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
struct pciintr_link_map *
|
- 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.
2000-07-18 15:22:36 +04:00
|
|
|
pciintr_link_lookup(link)
|
1999-11-17 04:20:38 +03:00
|
|
|
int link;
|
|
|
|
{
|
|
|
|
struct pciintr_link_map *l;
|
|
|
|
|
|
|
|
for (l = SIMPLEQ_FIRST(&pciintr_link_map_list); l != NULL;
|
|
|
|
l = SIMPLEQ_NEXT(l, list)) {
|
|
|
|
if (l->link == link)
|
|
|
|
return (l);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
struct pciintr_link_map *
|
|
|
|
pciintr_link_alloc(pir, pin)
|
|
|
|
struct pcibios_intr_routing *pir;
|
|
|
|
int pin;
|
|
|
|
{
|
- 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.
2000-07-18 15:22:36 +04:00
|
|
|
int link = pir->linkmap[pin].link, clink, irq;
|
1999-11-17 04:20:38 +03:00
|
|
|
struct pciintr_link_map *l, *lstart;
|
|
|
|
|
2000-08-11 01:18:27 +04:00
|
|
|
if (pciintr_icu_tag != NULL) { /* compatible PCI ICU found */
|
- 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.
2000-07-18 15:22:36 +04:00
|
|
|
/*
|
2000-08-11 01:18:27 +04:00
|
|
|
* Get the canonical link value for this entry.
|
- 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.
2000-07-18 15:22:36 +04:00
|
|
|
*/
|
2000-08-11 01:18:27 +04:00
|
|
|
if (pciintr_icu_getclink(pciintr_icu_tag, pciintr_icu_handle,
|
|
|
|
link, &clink) != 0) {
|
|
|
|
/*
|
|
|
|
* ICU doesn't understand the link value.
|
|
|
|
* Just ignore this PIR entry.
|
|
|
|
*/
|
- 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.
2000-07-18 15:22:36 +04:00
|
|
|
#ifdef DIAGNOSTIC
|
2000-08-11 01:18:27 +04:00
|
|
|
printf("pciintr_link_alloc: bus %d device %d: "
|
|
|
|
"link 0x%02x invalid\n",
|
|
|
|
pir->bus, PIR_DEVFUNC_DEVICE(pir->device), link);
|
- 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.
2000-07-18 15:22:36 +04:00
|
|
|
#endif
|
2000-08-11 01:18:27 +04:00
|
|
|
return (NULL);
|
|
|
|
}
|
- 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.
2000-07-18 15:22:36 +04:00
|
|
|
|
|
|
|
/*
|
2000-08-11 01:18:27 +04:00
|
|
|
* Check the link value by asking the ICU for the
|
|
|
|
* canonical link value.
|
|
|
|
* Also, determine if this PIRQ is mapped to an IRQ.
|
- 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.
2000-07-18 15:22:36 +04:00
|
|
|
*/
|
2000-08-11 01:18:27 +04:00
|
|
|
if (pciintr_icu_get_intr(pciintr_icu_tag, pciintr_icu_handle,
|
|
|
|
clink, &irq) != 0) {
|
|
|
|
/*
|
|
|
|
* ICU doesn't understand the canonical link value.
|
|
|
|
* Just ignore this PIR entry.
|
|
|
|
*/
|
- 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.
2000-07-18 15:22:36 +04:00
|
|
|
#ifdef DIAGNOSTIC
|
2000-08-11 01:18:27 +04:00
|
|
|
printf("pciintr_link_alloc: "
|
|
|
|
"bus %d device %d link 0x%02x: "
|
|
|
|
"PIRQ 0x%02x invalid\n",
|
|
|
|
pir->bus, PIR_DEVFUNC_DEVICE(pir->device), link,
|
|
|
|
clink);
|
- 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.
2000-07-18 15:22:36 +04:00
|
|
|
#endif
|
2000-08-11 01:18:27 +04:00
|
|
|
return (NULL);
|
|
|
|
}
|
- 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.
2000-07-18 15:22:36 +04:00
|
|
|
}
|
|
|
|
|
1999-11-17 04:20:38 +03:00
|
|
|
l = malloc(sizeof(*l), M_DEVBUF, M_NOWAIT);
|
|
|
|
if (l == NULL)
|
|
|
|
panic("pciintr_link_alloc");
|
|
|
|
|
|
|
|
memset(l, 0, sizeof(*l));
|
|
|
|
|
- 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.
2000-07-18 15:22:36 +04:00
|
|
|
l->link = link;
|
1999-11-17 04:20:38 +03:00
|
|
|
l->bitmap = pir->linkmap[pin].bitmap;
|
2000-08-11 01:18:27 +04:00
|
|
|
if (pciintr_icu_tag != NULL) { /* compatible PCI ICU found */
|
|
|
|
l->clink = clink;
|
|
|
|
l->irq = irq; /* maybe I386_PCI_INTERRUPT_LINE_NO_CONNECTION */
|
|
|
|
} else {
|
|
|
|
l->clink = link; /* only for PCIBIOSVERBOSE diagnostic */
|
|
|
|
l->irq = I386_PCI_INTERRUPT_LINE_NO_CONNECTION;
|
|
|
|
}
|
1999-11-17 04:20:38 +03:00
|
|
|
|
|
|
|
lstart = SIMPLEQ_FIRST(&pciintr_link_map_list);
|
|
|
|
if (lstart == NULL || lstart->link < l->link)
|
|
|
|
SIMPLEQ_INSERT_TAIL(&pciintr_link_map_list, l, list);
|
|
|
|
else
|
|
|
|
SIMPLEQ_INSERT_HEAD(&pciintr_link_map_list, l, list);
|
|
|
|
|
|
|
|
return (l);
|
|
|
|
}
|
|
|
|
|
|
|
|
struct pcibios_intr_routing *
|
|
|
|
pciintr_pir_lookup(bus, device)
|
|
|
|
int bus, device;
|
|
|
|
{
|
|
|
|
struct pcibios_intr_routing *pir;
|
|
|
|
int entry;
|
|
|
|
|
|
|
|
if (pcibios_pir_table == NULL)
|
|
|
|
return (NULL);
|
|
|
|
|
|
|
|
for (entry = 0; entry < pcibios_pir_table_nentries; entry++) {
|
|
|
|
pir = &pcibios_pir_table[entry];
|
- 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.
2000-07-18 15:22:36 +04:00
|
|
|
if (pir->bus == bus &&
|
|
|
|
PIR_DEVFUNC_DEVICE(pir->device) == device)
|
1999-11-17 04:20:38 +03:00
|
|
|
return (pir);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (NULL);
|
|
|
|
}
|
|
|
|
|
- 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.
2000-07-18 15:22:36 +04:00
|
|
|
static int
|
|
|
|
pciintr_bitmap_count_irq(irq_bitmap, irqp)
|
|
|
|
int irq_bitmap, *irqp;
|
|
|
|
{
|
|
|
|
int i, bit, count = 0, irq = I386_PCI_INTERRUPT_LINE_NO_CONNECTION;
|
|
|
|
|
|
|
|
if (irq_bitmap != 0) {
|
|
|
|
for (i = 0, bit = 1; i < 16; i++, bit <<= 1) {
|
|
|
|
if (irq_bitmap & bit) {
|
|
|
|
irq = i;
|
|
|
|
count++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*irqp = irq;
|
|
|
|
return (count);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
pciintr_bitmap_find_lowest_irq(irq_bitmap, irqp)
|
|
|
|
int irq_bitmap, *irqp;
|
|
|
|
{
|
|
|
|
int i, bit;
|
|
|
|
|
|
|
|
if (irq_bitmap != 0) {
|
|
|
|
for (i = 0, bit = 1; i < 16; i++, bit <<= 1) {
|
|
|
|
if (irq_bitmap & bit) {
|
|
|
|
*irqp = i;
|
|
|
|
return (1); /* found */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return (0); /* not found */
|
|
|
|
}
|
|
|
|
|
1999-11-17 04:20:38 +03:00
|
|
|
int
|
|
|
|
pciintr_link_init()
|
|
|
|
{
|
2000-08-11 01:18:27 +04:00
|
|
|
int entry, pin, link;
|
1999-11-17 04:20:38 +03:00
|
|
|
struct pcibios_intr_routing *pir;
|
|
|
|
struct pciintr_link_map *l;
|
|
|
|
|
|
|
|
if (pcibios_pir_table == NULL) {
|
|
|
|
/* No PIR table; can't do anything. */
|
|
|
|
printf("pciintr_link_init: no PIR table\n");
|
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
|
|
|
|
SIMPLEQ_INIT(&pciintr_link_map_list);
|
|
|
|
|
|
|
|
for (entry = 0; entry < pcibios_pir_table_nentries; entry++) {
|
|
|
|
pir = &pcibios_pir_table[entry];
|
- 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.
2000-07-18 15:22:36 +04:00
|
|
|
for (pin = 0; pin < PCI_INTERRUPT_PIN_MAX; pin++) {
|
1999-11-17 04:20:38 +03:00
|
|
|
link = pir->linkmap[pin].link;
|
|
|
|
if (link == 0) {
|
|
|
|
/* No connection for this pin. */
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* Multiple devices may be wired to the same
|
|
|
|
* interrupt; check to see if we've seen this
|
|
|
|
* one already. If not, allocate a new link
|
|
|
|
* map entry and stuff it in the map.
|
|
|
|
*/
|
- 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.
2000-07-18 15:22:36 +04:00
|
|
|
l = pciintr_link_lookup(link);
|
|
|
|
if (l == NULL) {
|
1999-11-17 04:20:38 +03:00
|
|
|
(void) pciintr_link_alloc(pir, pin);
|
- 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.
2000-07-18 15:22:36 +04:00
|
|
|
} else if (pir->linkmap[pin].bitmap != l->bitmap) {
|
|
|
|
/*
|
|
|
|
* violates PCI IRQ Routing Table Specification
|
|
|
|
*/
|
|
|
|
#ifdef DIAGNOSTIC
|
|
|
|
printf("pciintr_link_init: "
|
|
|
|
"bus %d device %d link 0x%02x: "
|
|
|
|
"bad irq bitmap 0x%04x, "
|
|
|
|
"should be 0x%04x\n",
|
|
|
|
pir->bus, PIR_DEVFUNC_DEVICE(pir->device),
|
|
|
|
link, pir->linkmap[pin].bitmap, l->bitmap);
|
|
|
|
#endif
|
|
|
|
/* safer value. */
|
|
|
|
l->bitmap &= pir->linkmap[pin].bitmap;
|
|
|
|
/* XXX - or, should ignore this entry? */
|
|
|
|
}
|
1999-11-17 04:20:38 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-08-11 01:18:27 +04:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef PCIBIOS_INTR_GUESS
|
|
|
|
/*
|
|
|
|
* No compatible PCI ICU found.
|
|
|
|
* Hopes the BIOS already setup the ICU.
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
pciintr_guess_irq()
|
|
|
|
{
|
|
|
|
struct pciintr_link_map *l;
|
|
|
|
int irq, guessed = 0;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Stage 1: If only one IRQ is available for the link, use it.
|
|
|
|
*/
|
|
|
|
for (l = SIMPLEQ_FIRST(&pciintr_link_map_list); l != NULL;
|
|
|
|
l = SIMPLEQ_NEXT(l, list)) {
|
|
|
|
if (l->irq != I386_PCI_INTERRUPT_LINE_NO_CONNECTION)
|
|
|
|
continue;
|
|
|
|
if (pciintr_bitmap_count_irq(l->bitmap, &irq) == 1) {
|
|
|
|
l->irq = irq;
|
|
|
|
l->fixup_stage = 1;
|
|
|
|
#ifdef PCIINTR_DEBUG
|
|
|
|
printf("pciintr_guess_irq (stage 1): "
|
|
|
|
"guessing PIRQ 0x%02x to be IRQ %d\n",
|
|
|
|
l->clink, l->irq);
|
|
|
|
#endif
|
|
|
|
guessed = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return (guessed ? 0 : -1);
|
1999-11-17 04:20:38 +03:00
|
|
|
}
|
2000-08-11 01:18:27 +04:00
|
|
|
#endif /* PCIBIOS_INTR_GUESS */
|
1999-11-17 04:20:38 +03:00
|
|
|
|
|
|
|
int
|
|
|
|
pciintr_link_fixup()
|
|
|
|
{
|
|
|
|
struct pciintr_link_map *l;
|
- 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.
2000-07-18 15:22:36 +04:00
|
|
|
int irq;
|
|
|
|
u_int16_t pciirq = 0;
|
1999-11-17 04:20:38 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* First stage: Attempt to connect PIRQs which aren't
|
|
|
|
* yet connected.
|
|
|
|
*/
|
|
|
|
for (l = SIMPLEQ_FIRST(&pciintr_link_map_list); l != NULL;
|
|
|
|
l = SIMPLEQ_NEXT(l, list)) {
|
- 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.
2000-07-18 15:22:36 +04:00
|
|
|
if (l->irq != I386_PCI_INTERRUPT_LINE_NO_CONNECTION) {
|
1999-11-17 04:20:38 +03:00
|
|
|
/*
|
- 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.
2000-07-18 15:22:36 +04:00
|
|
|
* Interrupt is already connected. Don't do
|
|
|
|
* anything to it.
|
|
|
|
* In this case, l->fixup_stage == 0.
|
1999-11-17 04:20:38 +03:00
|
|
|
*/
|
- 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.
2000-07-18 15:22:36 +04:00
|
|
|
pciirq |= 1 << l->irq;
|
1999-11-17 04:20:38 +03:00
|
|
|
#ifdef PCIINTR_DEBUG
|
- 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.
2000-07-18 15:22:36 +04:00
|
|
|
printf("pciintr_link_fixup: PIRQ 0x%02x already "
|
|
|
|
"connected to IRQ %d\n", l->clink, l->irq);
|
1999-11-17 04:20:38 +03:00
|
|
|
#endif
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
/*
|
- 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.
2000-07-18 15:22:36 +04:00
|
|
|
* Interrupt isn't connected. Attempt to assign it to an IRQ.
|
1999-11-17 04:20:38 +03:00
|
|
|
*/
|
|
|
|
#ifdef PCIINTR_DEBUG
|
- 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.
2000-07-18 15:22:36 +04:00
|
|
|
printf("pciintr_link_fixup: PIRQ 0x%02x not connected",
|
|
|
|
l->clink);
|
1999-11-17 04:20:38 +03:00
|
|
|
#endif
|
- 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.
2000-07-18 15:22:36 +04:00
|
|
|
/*
|
|
|
|
* Just do the easy case now; we'll defer the harder ones
|
|
|
|
* to Stage 2.
|
|
|
|
*/
|
|
|
|
if (pciintr_bitmap_count_irq(l->bitmap, &irq) == 1) {
|
1999-11-17 04:20:38 +03:00
|
|
|
l->irq = irq;
|
- 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.
2000-07-18 15:22:36 +04:00
|
|
|
l->fixup_stage = 1;
|
1999-11-17 04:20:38 +03:00
|
|
|
pciirq |= 1 << irq;
|
|
|
|
#ifdef PCIINTR_DEBUG
|
- 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.
2000-07-18 15:22:36 +04:00
|
|
|
printf(", assigning IRQ %d", l->irq);
|
1999-11-17 04:20:38 +03:00
|
|
|
#endif
|
|
|
|
}
|
- 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.
2000-07-18 15:22:36 +04:00
|
|
|
#ifdef PCIINTR_DEBUG
|
|
|
|
printf("\n");
|
|
|
|
#endif
|
1999-11-17 04:20:38 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Stage 2: Attempt to connect PIRQs which we didn't
|
|
|
|
* connect in Stage 1.
|
|
|
|
*/
|
|
|
|
for (l = SIMPLEQ_FIRST(&pciintr_link_map_list); l != NULL;
|
|
|
|
l = SIMPLEQ_NEXT(l, list)) {
|
- 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.
2000-07-18 15:22:36 +04:00
|
|
|
if (l->irq != I386_PCI_INTERRUPT_LINE_NO_CONNECTION)
|
2000-04-28 21:15:15 +04:00
|
|
|
continue;
|
- 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.
2000-07-18 15:22:36 +04:00
|
|
|
if (pciintr_bitmap_find_lowest_irq(l->bitmap & pciirq,
|
|
|
|
&l->irq)) {
|
|
|
|
/*
|
|
|
|
* This IRQ is a valid PCI IRQ already
|
|
|
|
* connected to another PIRQ, and also an
|
|
|
|
* IRQ our PIRQ can use; connect it up!
|
|
|
|
*/
|
|
|
|
l->fixup_stage = 2;
|
1999-11-17 04:20:38 +03:00
|
|
|
#ifdef PCIINTR_DEBUG
|
- 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.
2000-07-18 15:22:36 +04:00
|
|
|
printf("pciintr_link_fixup (stage 2): "
|
|
|
|
"assigning IRQ %d to PIRQ 0x%02x\n",
|
|
|
|
l->irq, l->clink);
|
1999-11-17 04:20:38 +03:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-04-28 21:15:15 +04:00
|
|
|
#ifdef PCIBIOS_IRQS_HINT
|
1999-11-17 04:20:38 +03:00
|
|
|
/*
|
2000-04-28 21:15:15 +04:00
|
|
|
* Stage 3: The worst case. I need configuration hint that
|
|
|
|
* user supplied a mask for the PCI irqs
|
1999-11-17 04:20:38 +03:00
|
|
|
*/
|
2000-04-28 21:15:15 +04:00
|
|
|
for (l = SIMPLEQ_FIRST(&pciintr_link_map_list); l != NULL;
|
|
|
|
l = SIMPLEQ_NEXT(l, list)) {
|
- 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.
2000-07-18 15:22:36 +04:00
|
|
|
if (l->irq != I386_PCI_INTERRUPT_LINE_NO_CONNECTION)
|
2000-04-28 21:15:15 +04:00
|
|
|
continue;
|
- 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.
2000-07-18 15:22:36 +04:00
|
|
|
if (pciintr_bitmap_find_lowest_irq(
|
2000-07-18 15:37:56 +04:00
|
|
|
l->bitmap & pcibios_irqs_hint, &l->irq)) {
|
- 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.
2000-07-18 15:22:36 +04:00
|
|
|
l->fixup_stage = 3;
|
2000-04-28 21:15:15 +04:00
|
|
|
#ifdef PCIINTR_DEBUG
|
- 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.
2000-07-18 15:22:36 +04:00
|
|
|
printf("pciintr_link_fixup (stage 3): "
|
|
|
|
"assigning IRQ %d to PIRQ 0x%02x\n",
|
|
|
|
l->irq, l->clink);
|
2000-04-28 21:15:15 +04:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif /* PCIBIOS_IRQS_HINT */
|
1999-11-17 04:20:38 +03:00
|
|
|
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
pciintr_link_route(pciirq)
|
|
|
|
u_int16_t *pciirq;
|
|
|
|
{
|
|
|
|
struct pciintr_link_map *l;
|
|
|
|
int rv = 0;
|
|
|
|
|
|
|
|
*pciirq = 0;
|
|
|
|
|
|
|
|
for (l = SIMPLEQ_FIRST(&pciintr_link_map_list); l != NULL;
|
|
|
|
l = SIMPLEQ_NEXT(l, list)) {
|
- 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.
2000-07-18 15:22:36 +04:00
|
|
|
if (l->fixup_stage == 0) {
|
|
|
|
if (l->irq == I386_PCI_INTERRUPT_LINE_NO_CONNECTION) {
|
|
|
|
/* Appropriate interrupt was not found. */
|
|
|
|
#ifdef DIAGNOSTIC
|
|
|
|
printf("pciintr_link_route: "
|
|
|
|
"PIRQ 0x%02x: no IRQ, try "
|
|
|
|
"\"options PCIBIOS_IRQS_HINT=0x%04x\"\n",
|
|
|
|
l->clink,
|
|
|
|
/* suggest irq 9/10/11, if possible */
|
|
|
|
(l->bitmap & 0x0e00) ? (l->bitmap & 0x0e00)
|
|
|
|
: l->bitmap);
|
|
|
|
#endif
|
|
|
|
} else {
|
|
|
|
/* BIOS setting has no problem */
|
|
|
|
#ifdef PCIINTR_DEBUG
|
|
|
|
printf("pciintr_link_route: "
|
|
|
|
"route of PIRQ 0x%02x -> "
|
|
|
|
"IRQ %d preserved BIOS setting\n",
|
|
|
|
l->clink, l->irq);
|
|
|
|
#endif
|
|
|
|
*pciirq |= (1 << l->irq);
|
|
|
|
}
|
|
|
|
continue; /* nothing to do. */
|
|
|
|
}
|
|
|
|
|
1999-11-17 04:20:38 +03:00
|
|
|
if (pciintr_icu_set_intr(pciintr_icu_tag, pciintr_icu_handle,
|
|
|
|
l->clink, l->irq) != 0 ||
|
- 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.
2000-07-18 15:22:36 +04:00
|
|
|
pciintr_icu_set_trigger(pciintr_icu_tag,
|
|
|
|
pciintr_icu_handle,
|
1999-11-17 04:20:38 +03:00
|
|
|
l->irq, IST_LEVEL) != 0) {
|
- 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.
2000-07-18 15:22:36 +04:00
|
|
|
printf("pciintr_link_route: route of PIRQ 0x%02x -> "
|
|
|
|
"IRQ %d failed\n", l->clink, l->irq);
|
1999-11-17 04:20:38 +03:00
|
|
|
rv = 1;
|
|
|
|
} else {
|
|
|
|
/*
|
|
|
|
* Succssfully routed interrupt. Mark this as
|
|
|
|
* a PCI interrupt.
|
|
|
|
*/
|
|
|
|
*pciirq |= (1 << l->irq);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return (rv);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
pciintr_irq_release(pciirq)
|
|
|
|
u_int16_t *pciirq;
|
|
|
|
{
|
- 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.
2000-07-18 15:22:36 +04:00
|
|
|
int i, bit;
|
1999-11-17 04:20:38 +03:00
|
|
|
|
- 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.
2000-07-18 15:22:36 +04:00
|
|
|
for (i = 0, bit = 1; i < 16; i++, bit <<= 1) {
|
|
|
|
if ((*pciirq & bit) == 0)
|
1999-11-17 04:20:38 +03:00
|
|
|
(void) pciintr_icu_set_trigger(pciintr_icu_tag,
|
|
|
|
pciintr_icu_handle, i, IST_EDGE);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
pciintr_header_fixup(pc)
|
|
|
|
pci_chipset_tag_t pc;
|
|
|
|
{
|
- 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.
2000-07-18 15:22:36 +04:00
|
|
|
PCIBIOS_PRINTV(("------------------------------------------\n"));
|
|
|
|
PCIBIOS_PRINTV((" device vendor product pin PIRQ IRQ stage\n"));
|
|
|
|
PCIBIOS_PRINTV(("------------------------------------------\n"));
|
2000-07-09 04:42:47 +04:00
|
|
|
pci_device_foreach(pc, pcibios_max_bus, pciintr_do_header_fixup);
|
- 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.
2000-07-18 15:22:36 +04:00
|
|
|
PCIBIOS_PRINTV(("------------------------------------------\n"));
|
1999-11-17 04:20:38 +03:00
|
|
|
|
2000-04-28 21:15:15 +04:00
|
|
|
return (0);
|
|
|
|
}
|
1999-11-17 04:20:38 +03:00
|
|
|
|
2000-04-28 21:15:15 +04:00
|
|
|
void
|
|
|
|
pciintr_do_header_fixup(pc, tag)
|
|
|
|
pci_chipset_tag_t pc;
|
|
|
|
pcitag_t tag;
|
|
|
|
{
|
|
|
|
struct pcibios_intr_routing *pir;
|
|
|
|
struct pciintr_link_map *l;
|
|
|
|
int pin, irq, link;
|
|
|
|
int bus, device, function;
|
|
|
|
pcireg_t intr, id;
|
1999-11-17 04:20:38 +03:00
|
|
|
|
2000-04-28 21:15:15 +04:00
|
|
|
pci_decompose_tag(pc, tag, &bus, &device, &function);
|
|
|
|
id = pci_conf_read(pc, tag, PCI_ID_REG);
|
1999-11-17 04:20:38 +03:00
|
|
|
|
2000-04-28 21:15:15 +04:00
|
|
|
intr = pci_conf_read(pc, tag, PCI_INTERRUPT_REG);
|
|
|
|
pin = PCI_INTERRUPT_PIN(intr);
|
|
|
|
irq = PCI_INTERRUPT_LINE(intr);
|
1999-11-17 04:20:38 +03:00
|
|
|
|
2000-04-28 21:15:15 +04:00
|
|
|
if (pin == 0) {
|
|
|
|
/*
|
|
|
|
* No interrupt used.
|
|
|
|
*/
|
|
|
|
return;
|
|
|
|
}
|
1999-11-17 04:20:38 +03:00
|
|
|
|
2000-04-28 21:15:15 +04:00
|
|
|
pir = pciintr_pir_lookup(bus, device);
|
|
|
|
if (pir == NULL || (link = pir->linkmap[pin - 1].link) == 0) {
|
|
|
|
/*
|
|
|
|
* Interrupt not connected; no
|
|
|
|
* need to change.
|
|
|
|
*/
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
- 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.
2000-07-18 15:22:36 +04:00
|
|
|
l = pciintr_link_lookup(link);
|
2000-04-28 21:15:15 +04:00
|
|
|
if (l == NULL) {
|
- 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.
2000-07-18 15:22:36 +04:00
|
|
|
#ifdef PCIINTR_DEBUG
|
2000-04-28 21:15:15 +04:00
|
|
|
/*
|
- 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.
2000-07-18 15:22:36 +04:00
|
|
|
* No link map entry.
|
|
|
|
* Probably pciintr_icu_getclink() or pciintr_icu_get_intr()
|
|
|
|
* was failed.
|
2000-04-28 21:15:15 +04:00
|
|
|
*/
|
|
|
|
printf("pciintr_header_fixup: no entry for link 0x%02x "
|
|
|
|
"(%d:%d:%d:%c)\n", link, bus, device, function,
|
|
|
|
'@' + pin);
|
- 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.
2000-07-18 15:22:36 +04:00
|
|
|
#endif
|
2000-04-28 21:15:15 +04:00
|
|
|
return;
|
1999-11-17 04:20:38 +03:00
|
|
|
}
|
- 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.
2000-07-18 15:22:36 +04:00
|
|
|
|
|
|
|
#ifdef PCIBIOSVERBOSE
|
|
|
|
if (pcibiosverbose) {
|
|
|
|
printf("%03d:%02d:%d 0x%04x 0x%04x %c 0x%02x",
|
|
|
|
bus, device, function, PCI_VENDOR(id), PCI_PRODUCT(id),
|
|
|
|
'@' + pin, l->clink);
|
|
|
|
if (l->irq == I386_PCI_INTERRUPT_LINE_NO_CONNECTION)
|
|
|
|
printf(" -");
|
|
|
|
else
|
|
|
|
printf(" %3d", l->irq);
|
|
|
|
printf(" %d ", l->fixup_stage);
|
|
|
|
}
|
|
|
|
#endif
|
2000-04-28 21:15:15 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* IRQs 14 and 15 are reserved for PCI IDE interrupts; don't muck
|
|
|
|
* with them.
|
|
|
|
*/
|
- 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.
2000-07-18 15:22:36 +04:00
|
|
|
if (irq == 14 || irq == 15) {
|
|
|
|
PCIBIOS_PRINTV((" WARNING: ignored\n"));
|
2000-04-28 21:15:15 +04:00
|
|
|
return;
|
- 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.
2000-07-18 15:22:36 +04:00
|
|
|
}
|
1999-11-17 04:20:38 +03:00
|
|
|
|
- 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.
2000-07-18 15:22:36 +04:00
|
|
|
if (l->irq == I386_PCI_INTERRUPT_LINE_NO_CONNECTION) {
|
|
|
|
/* Appropriate interrupt was not found. */
|
2000-08-11 01:18:27 +04:00
|
|
|
if (pciintr_icu_tag == NULL &&
|
|
|
|
irq != 0 && irq != I386_PCI_INTERRUPT_LINE_NO_CONNECTION) {
|
|
|
|
/*
|
|
|
|
* Do not print warning,
|
|
|
|
* if no compatible PCI ICU found,
|
|
|
|
* but the irq is already assigned by BIOS.
|
|
|
|
*/
|
|
|
|
PCIBIOS_PRINTV(("\n"));
|
|
|
|
} else {
|
|
|
|
PCIBIOS_PRINTV((" WARNING: missing IRQ\n"));
|
|
|
|
}
|
- 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.
2000-07-18 15:22:36 +04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (l->irq == irq) {
|
|
|
|
/* don't have to reconfigure */
|
|
|
|
PCIBIOS_PRINTV((" already assigned\n"));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (irq == 0 || irq == I386_PCI_INTERRUPT_LINE_NO_CONNECTION) {
|
|
|
|
PCIBIOS_PRINTV((" fixed up\n"));
|
|
|
|
} else {
|
|
|
|
/* routed by BIOS, but inconsistent */
|
|
|
|
#ifdef PCIBIOS_INTR_FIXUP_FORCE
|
|
|
|
/* believe PCI IRQ Routing table */
|
2000-07-22 21:43:36 +04:00
|
|
|
PCIBIOS_PRINTV((" WARNING: overriding irq %d\n", irq));
|
- 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.
2000-07-18 15:22:36 +04:00
|
|
|
#else
|
2000-08-11 01:18:27 +04:00
|
|
|
/* believe PCI Interrupt Configuration Register (default) */
|
2000-07-22 21:43:36 +04:00
|
|
|
PCIBIOS_PRINTV((" WARNING: preserving irq %d\n", irq));
|
- 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.
2000-07-18 15:22:36 +04:00
|
|
|
return;
|
1999-11-17 04:20:38 +03:00
|
|
|
#endif
|
- 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.
2000-07-18 15:22:36 +04:00
|
|
|
}
|
1999-11-17 04:20:38 +03:00
|
|
|
|
2000-04-28 21:15:15 +04:00
|
|
|
intr &= ~(PCI_INTERRUPT_LINE_MASK << PCI_INTERRUPT_LINE_SHIFT);
|
|
|
|
intr |= (l->irq << PCI_INTERRUPT_LINE_SHIFT);
|
|
|
|
pci_conf_write(pc, tag, PCI_INTERRUPT_REG, intr);
|
1999-11-17 04:20:38 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
pci_intr_fixup(pc, iot, pciirq)
|
|
|
|
pci_chipset_tag_t pc;
|
|
|
|
bus_space_tag_t iot;
|
|
|
|
u_int16_t *pciirq;
|
|
|
|
{
|
|
|
|
const struct pciintr_icu_table *piit = NULL;
|
|
|
|
pcitag_t icutag;
|
|
|
|
pcireg_t icuid;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Attempt to initialize our PCI interrupt router. If
|
|
|
|
* the PIR Table is present in ROM, use the location
|
|
|
|
* specified by the PIR Table, and use the compat ID,
|
|
|
|
* if present. Otherwise, we have to look for the router
|
|
|
|
* ourselves (the PCI-ISA bridge).
|
|
|
|
*/
|
|
|
|
if (pcibios_pir_header.signature != 0) {
|
|
|
|
icutag = pci_make_tag(pc, pcibios_pir_header.router_bus,
|
- 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.
2000-07-18 15:22:36 +04:00
|
|
|
PIR_DEVFUNC_DEVICE(pcibios_pir_header.router_devfunc),
|
|
|
|
PIR_DEVFUNC_FUNCTION(pcibios_pir_header.router_devfunc));
|
1999-11-17 04:20:38 +03:00
|
|
|
icuid = pcibios_pir_header.compat_router;
|
|
|
|
if (icuid == 0 ||
|
|
|
|
(piit = pciintr_icu_lookup(icuid)) == NULL) {
|
|
|
|
/*
|
|
|
|
* No compat ID, or don't know the compat ID? Read
|
|
|
|
* it from the configuration header.
|
|
|
|
*/
|
|
|
|
icuid = pci_conf_read(pc, icutag, PCI_ID_REG);
|
|
|
|
}
|
|
|
|
if (piit == NULL)
|
|
|
|
piit = pciintr_icu_lookup(icuid);
|
|
|
|
} else {
|
|
|
|
int device, maxdevs = pci_bus_maxdevs(pc, 0);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Search configuration space for a known interrupt
|
|
|
|
* router.
|
|
|
|
*/
|
|
|
|
for (device = 0; device < maxdevs; device++) {
|
|
|
|
icutag = pci_make_tag(pc, 0, device, 0);
|
|
|
|
icuid = pci_conf_read(pc, icutag, PCI_ID_REG);
|
|
|
|
|
|
|
|
/* Invalid vendor ID value? */
|
|
|
|
if (PCI_VENDOR(icuid) == PCI_VENDOR_INVALID)
|
|
|
|
continue;
|
|
|
|
/* XXX Not invalid, but we've done this ~forever. */
|
|
|
|
if (PCI_VENDOR(icuid) == 0)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
piit = pciintr_icu_lookup(icuid);
|
|
|
|
if (piit != NULL)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (piit == NULL) {
|
2000-08-11 01:18:27 +04:00
|
|
|
printf("pci_intr_fixup: no compatible PCI ICU found");
|
|
|
|
if (pcibios_pir_header.signature != 0 && icuid != 0)
|
|
|
|
printf(": ICU vendor 0x%04x product 0x%04x",
|
|
|
|
PCI_VENDOR(icuid), PCI_PRODUCT(icuid));
|
|
|
|
printf("\n");
|
|
|
|
#ifdef PCIBIOS_INTR_GUESS
|
|
|
|
if (pciintr_link_init())
|
|
|
|
return (-1); /* non-fatal */
|
|
|
|
if (pciintr_guess_irq())
|
|
|
|
return (-1); /* non-fatal */
|
|
|
|
if (pciintr_header_fixup(pc))
|
|
|
|
return (1); /* fatal */
|
|
|
|
return (0); /* success! */
|
|
|
|
#else
|
1999-11-17 04:20:38 +03:00
|
|
|
return (-1); /* non-fatal */
|
2000-08-11 01:18:27 +04:00
|
|
|
#endif
|
1999-11-17 04:20:38 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Initialize the PCI ICU.
|
|
|
|
*/
|
|
|
|
if ((*piit->piit_init)(pc, iot, icutag, &pciintr_icu_tag,
|
|
|
|
&pciintr_icu_handle) != 0)
|
|
|
|
return (-1); /* non-fatal */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Initialize the PCI interrupt link map.
|
|
|
|
*/
|
|
|
|
if (pciintr_link_init())
|
|
|
|
return (-1); /* non-fatal */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Fix up the link->IRQ mappings.
|
|
|
|
*/
|
|
|
|
if (pciintr_link_fixup() != 0)
|
|
|
|
return (-1); /* non-fatal */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Now actually program the PCI ICU with the new
|
|
|
|
* routing information.
|
|
|
|
*/
|
|
|
|
if (pciintr_link_route(pciirq) != 0)
|
|
|
|
return (1); /* fatal */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Now that we've routed all of the PIRQs, rewrite the PCI
|
|
|
|
* configuration headers to reflect the new mapping.
|
|
|
|
*/
|
|
|
|
if (pciintr_header_fixup(pc) != 0)
|
|
|
|
return (1); /* fatal */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Free any unused PCI IRQs for ISA devices.
|
|
|
|
*/
|
|
|
|
if (pciintr_irq_release(pciirq) != 0)
|
|
|
|
return (-1); /* non-fatal */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* All done!
|
|
|
|
*/
|
|
|
|
return (0); /* success! */
|
|
|
|
}
|