From owner-svn-src-all@FreeBSD.ORG Sun May 16 17:55:09 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7EA6C106564A; Sun, 16 May 2010 17:55:09 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 619548FC18; Sun, 16 May 2010 17:55:09 +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 o4GHt9Nm072937; Sun, 16 May 2010 17:55:09 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4GHt9ie072934; Sun, 16 May 2010 17:55:09 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201005161755.o4GHt9ie072934@svn.freebsd.org> From: Nathan Whitehorn Date: Sun, 16 May 2010 17:55:09 +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: r208162 - in head/sys: dev/ata/chipsets powerpc/ofw X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 May 2010 17:55:09 -0000 Author: nwhitehorn Date: Sun May 16 17:55:09 2010 New Revision: 208162 URL: http://svn.freebsd.org/changeset/base/208162 Log: Relocate interrupt sense setting for K2 SATA from the ATA driver to the OFW PCI layer and read the sense directly from the device tree instead of guessing. MFC after: 1 week Modified: head/sys/dev/ata/chipsets/ata-serverworks.c head/sys/powerpc/ofw/ofw_pcibus.c Modified: head/sys/dev/ata/chipsets/ata-serverworks.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-serverworks.c Sun May 16 17:22:54 2010 (r208161) +++ head/sys/dev/ata/chipsets/ata-serverworks.c Sun May 16 17:55:09 2010 (r208162) @@ -41,9 +41,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#ifdef __powerpc__ -#include -#endif #include #include #include @@ -220,10 +217,6 @@ ata_serverworks_ch_attach(device_t dev) ch->hw.tf_write = ata_serverworks_tf_write; #ifdef __powerpc__ ch->hw.status = ata_serverworks_status; - - /* Make sure that our interrupt is edge triggered */ - powerpc_config_intr(bus_get_resource_start(device_get_parent(dev), - SYS_RES_IRQ, 0), INTR_TRIGGER_EDGE, INTR_POLARITY_HIGH); #endif if (ctlr->chip->chipid == ATA_K2) { Modified: head/sys/powerpc/ofw/ofw_pcibus.c ============================================================================== --- head/sys/powerpc/ofw/ofw_pcibus.c Sun May 16 17:22:54 2010 (r208161) +++ head/sys/powerpc/ofw/ofw_pcibus.c Sun May 16 17:55:09 2010 (r208162) @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -192,20 +193,36 @@ ofw_pcibus_enum_devtree(device_t dev, u_ pci_add_child(dev, (struct pci_devinfo *)dinfo); /* - * Some devices don't have an intpin set, but do have - * interrupts. These are fully specified, and set in the + * Some devices don't have an intpin set, but do have + * interrupts. These are fully specified, and set in the * interrupts property, so add that value to the device's * resource list. - */ - if (dinfo->opd_dinfo.cfg.intpin == 0) { - ofw_pci_intr_t intr; + */ + if (dinfo->opd_dinfo.cfg.intpin == 0) { + ofw_pci_intr_t intr[2]; + phandle_t iparent; + int icells; if (OF_getprop(child, "interrupts", &intr, sizeof(intr)) > 0) { - resource_list_add(&dinfo->opd_dinfo.resources, - SYS_RES_IRQ, 0, intr, intr, 1); + iparent = 0; + icells = 1; + OF_getprop(child, "interrupt-parent", &iparent, + sizeof(iparent)); + OF_getprop(iparent, "#interrupt-cells", &icells, + sizeof(icells)); + + if (iparent != 0 && icells > 1) { + powerpc_config_intr(intr[0], + (intr[1] & 1) ? INTR_TRIGGER_LEVEL : + INTR_TRIGGER_EDGE, + INTR_POLARITY_HIGH); + } + + resource_list_add(&dinfo->opd_dinfo.resources, + SYS_RES_IRQ, 0, intr[0], intr[0], 1); } - } + } } }