svn commit: r208277 - in projects/ppc64/sys/powerpc: ofw powermac
powerpc
Nathan Whitehorn
nwhitehorn at FreeBSD.org
Tue May 18 21:01:43 UTC 2010
Author: nwhitehorn
Date: Tue May 18 21:01:42 2010
New Revision: 208277
URL: http://svn.freebsd.org/changeset/base/208277
Log:
Switch the default OpenPIC polarity from high to low, following OS X
and Linux. It seems that at least in Apple's case, all interrupts but
IRQ 0 ignore the level part of the interrupt sense and all should be low.
This meant that IRQ 0 was being misprogrammed, causing loss of interrupts.
Submitted by: Andreas Tobler
Merge after: Review on MPC85XX
Modified:
projects/ppc64/sys/powerpc/ofw/ofw_pcibus.c
projects/ppc64/sys/powerpc/powermac/uninorth.c
projects/ppc64/sys/powerpc/powerpc/openpic.c
Modified: projects/ppc64/sys/powerpc/ofw/ofw_pcibus.c
==============================================================================
--- projects/ppc64/sys/powerpc/ofw/ofw_pcibus.c Tue May 18 18:28:17 2010 (r208276)
+++ projects/ppc64/sys/powerpc/ofw/ofw_pcibus.c Tue May 18 21:01:42 2010 (r208277)
@@ -216,11 +216,10 @@ ofw_pcibus_enum_devtree(device_t dev, u_
intr[0] = INTR_VEC(iparent, intr[0]);
if (iparent != 0 && icells > 1) {
- powerpc_config_intr(
- INTR_VEC(iparent, intr[0]),
+ powerpc_config_intr(intr[0],
(intr[1] & 1) ? INTR_TRIGGER_LEVEL :
INTR_TRIGGER_EDGE,
- INTR_POLARITY_HIGH);
+ INTR_POLARITY_LOW);
}
resource_list_add(&dinfo->opd_dinfo.resources,
@@ -266,15 +265,27 @@ ofw_pcibus_enum_bus(device_t dev, u_int
dinfo = (struct ofw_pcibus_devinfo *)pci_read_device(
pcib, domain, busno, s, f, sizeof(*dinfo));
- if (dinfo != NULL) {
- dinfo->opd_obdinfo.obd_node = -1;
+ if (dinfo == NULL)
+ continue;
+
+ dinfo->opd_obdinfo.obd_node = -1;
- dinfo->opd_obdinfo.obd_name = NULL;
- dinfo->opd_obdinfo.obd_compat = NULL;
- dinfo->opd_obdinfo.obd_type = NULL;
- dinfo->opd_obdinfo.obd_model = NULL;
- pci_add_child(dev, (struct pci_devinfo *)dinfo);
+ dinfo->opd_obdinfo.obd_name = NULL;
+ dinfo->opd_obdinfo.obd_compat = NULL;
+ dinfo->opd_obdinfo.obd_type = NULL;
+ dinfo->opd_obdinfo.obd_model = NULL;
+
+ /*
+ * For non OFW-devices, don't believe 0
+ * for an interrupt.
+ */
+ if (dinfo->opd_dinfo.cfg.intline == 0) {
+ dinfo->opd_dinfo.cfg.intline = PCI_INVALID_IRQ;
+ PCIB_WRITE_CONFIG(pcib, busno, s, f,
+ PCIR_INTLINE, PCI_INVALID_IRQ, 1);
}
+
+ pci_add_child(dev, (struct pci_devinfo *)dinfo);
}
}
}
@@ -312,7 +323,7 @@ ofw_pcibus_assign_interrupt(device_t dev
* spec will need to be studied.
*/
- return (0);
+ return (PCI_INVALID_IRQ);
#ifdef NOTYET
intr = pci_get_intpin(child);
Modified: projects/ppc64/sys/powerpc/powermac/uninorth.c
==============================================================================
--- projects/ppc64/sys/powerpc/powermac/uninorth.c Tue May 18 18:28:17 2010 (r208276)
+++ projects/ppc64/sys/powerpc/powermac/uninorth.c Tue May 18 21:01:42 2010 (r208277)
@@ -180,7 +180,7 @@ unin_chip_add_intr(phandle_t devnode, st
if (icells > 1) {
powerpc_config_intr(INTR_VEC(iparent, intr[i]),
(intr[i+1] & 1) ? INTR_TRIGGER_LEVEL :
- INTR_TRIGGER_EDGE, INTR_POLARITY_HIGH);
+ INTR_TRIGGER_EDGE, INTR_POLARITY_LOW);
}
dinfo->udi_interrupts[dinfo->udi_ninterrupts] =
Modified: projects/ppc64/sys/powerpc/powerpc/openpic.c
==============================================================================
--- projects/ppc64/sys/powerpc/powerpc/openpic.c Tue May 18 18:28:17 2010 (r208276)
+++ projects/ppc64/sys/powerpc/powerpc/openpic.c Tue May 18 21:01:42 2010 (r208277)
@@ -165,7 +165,7 @@ openpic_attach(device_t dev)
for (irq = 0; irq < sc->sc_nirq; irq++) {
x = irq; /* irq == vector. */
x |= OPENPIC_IMASK;
- x |= OPENPIC_POLARITY_POSITIVE;
+ x |= OPENPIC_POLARITY_NEGATIVE;
x |= OPENPIC_SENSE_LEVEL;
x |= 8 << OPENPIC_PRIORITY_SHIFT;
openpic_write(sc, OPENPIC_SRC_VECTOR(irq), x);
More information about the svn-src-projects
mailing list