Date: Fri, 18 Jun 2010 14:16:25 +0000 (UTC) From: Nathan Whitehorn <nwhitehorn@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r209299 - in head/sys/powerpc: ofw powermac powerpc Message-ID: <201006181416.o5IEGPRO080241@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: nwhitehorn Date: Fri Jun 18 14:16:24 2010 New Revision: 209299 URL: http://svn.freebsd.org/changeset/base/209299 Log: Change the default interrupt polarity on PowerPC systems from high to low. On Apple systems at least, all the level interrupts are wired active low. Before this change, our PIC programming only worked because Apple hardware ignores the interrupt polarity bit on all interrupts except IRQ 0. Modified: head/sys/powerpc/ofw/ofw_pcibus.c head/sys/powerpc/powermac/uninorth.c head/sys/powerpc/powerpc/openpic.c Modified: head/sys/powerpc/ofw/ofw_pcibus.c ============================================================================== --- head/sys/powerpc/ofw/ofw_pcibus.c Fri Jun 18 14:06:27 2010 (r209298) +++ head/sys/powerpc/ofw/ofw_pcibus.c Fri Jun 18 14:16:24 2010 (r209299) @@ -219,7 +219,7 @@ ofw_pcibus_enum_devtree(device_t dev, u_ 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, @@ -265,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); } } } @@ -311,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: head/sys/powerpc/powermac/uninorth.c ============================================================================== --- head/sys/powerpc/powermac/uninorth.c Fri Jun 18 14:06:27 2010 (r209298) +++ head/sys/powerpc/powermac/uninorth.c Fri Jun 18 14:16:24 2010 (r209299) @@ -182,7 +182,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: head/sys/powerpc/powerpc/openpic.c ============================================================================== --- head/sys/powerpc/powerpc/openpic.c Fri Jun 18 14:06:27 2010 (r209298) +++ head/sys/powerpc/powerpc/openpic.c Fri Jun 18 14:16:24 2010 (r209299) @@ -175,7 +175,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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201006181416.o5IEGPRO080241>