From owner-svn-src-head@FreeBSD.ORG Fri Jun 18 14:16:25 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8B192106566B; Fri, 18 Jun 2010 14:16:25 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7911A8FC1D; Fri, 18 Jun 2010 14:16:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o5IEGPFJ080245; Fri, 18 Jun 2010 14:16:25 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o5IEGPRO080241; Fri, 18 Jun 2010 14:16:25 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201006181416.o5IEGPRO080241@svn.freebsd.org> From: Nathan Whitehorn Date: Fri, 18 Jun 2010 14:16:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r209299 - in head/sys/powerpc: ofw powermac powerpc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Jun 2010 14:16:25 -0000 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);