From owner-svn-src-stable@FreeBSD.ORG Tue Nov 9 22:18:20 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8A9B11065693; Tue, 9 Nov 2010 22:18:20 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 773288FC1E; Tue, 9 Nov 2010 22:18:20 +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 oA9MIKFL054158; Tue, 9 Nov 2010 22:18:20 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA9MIKXh054153; Tue, 9 Nov 2010 22:18:20 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201011092218.oA9MIKXh054153@svn.freebsd.org> From: Alexander Motin Date: Tue, 9 Nov 2010 22:18:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215064 - in stable/8/sys: dev/pci kern x86/x86 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Nov 2010 22:18:20 -0000 Author: mav Date: Tue Nov 9 22:18:20 2010 New Revision: 215064 URL: http://svn.freebsd.org/changeset/base/215064 Log: MFC r209154: Virtualize pci_remap_msi_irq() call from general MSI code. It allows MSI (FSB interrupts) to be used by non-PCI devices, such as HPET. Modified: stable/8/sys/dev/pci/pci.c stable/8/sys/dev/pci/pcivar.h stable/8/sys/kern/bus_if.m stable/8/sys/x86/x86/msi.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/pci/pci.c ============================================================================== --- stable/8/sys/dev/pci/pci.c Tue Nov 9 22:17:53 2010 (r215063) +++ stable/8/sys/dev/pci/pci.c Tue Nov 9 22:18:20 2010 (r215064) @@ -116,6 +116,8 @@ static void pci_unmask_msix(device_t de static int pci_msi_blacklisted(void); static void pci_resume_msi(device_t dev); static void pci_resume_msix(device_t dev); +static int pci_remap_intr_method(device_t bus, device_t dev, + u_int irq); static device_method_t pci_methods[] = { /* Device interface */ @@ -145,6 +147,7 @@ static device_method_t pci_methods[] = { DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), DEVMETHOD(bus_child_pnpinfo_str, pci_child_pnpinfo_str_method), DEVMETHOD(bus_child_location_str, pci_child_location_str_method), + DEVMETHOD(bus_remap_intr, pci_remap_intr_method), /* PCI interface */ DEVMETHOD(pci_read_config, pci_read_config_method), @@ -1713,21 +1716,18 @@ pci_resume_msi(device_t dev) 2); } -int -pci_remap_msi_irq(device_t dev, u_int irq) +static int +pci_remap_intr_method(device_t bus, device_t dev, u_int irq) { struct pci_devinfo *dinfo = device_get_ivars(dev); pcicfgregs *cfg = &dinfo->cfg; struct resource_list_entry *rle; struct msix_table_entry *mte; struct msix_vector *mv; - device_t bus; uint64_t addr; uint32_t data; int error, i, j; - bus = device_get_parent(dev); - /* * Handle MSI first. We try to find this IRQ among our list * of MSI IRQs. If we find it, we request updated address and Modified: stable/8/sys/dev/pci/pcivar.h ============================================================================== --- stable/8/sys/dev/pci/pcivar.h Tue Nov 9 22:17:53 2010 (r215063) +++ stable/8/sys/dev/pci/pcivar.h Tue Nov 9 22:18:20 2010 (r215064) @@ -445,12 +445,6 @@ device_t pci_find_bsf(uint8_t, uint8_t, device_t pci_find_dbsf(uint32_t, uint8_t, uint8_t, uint8_t); device_t pci_find_device(uint16_t, uint16_t); -/* - * Can be used by MD code to request the PCI bus to re-map an MSI or - * MSI-X message. - */ -int pci_remap_msi_irq(device_t dev, u_int irq); - /* Can be used by drivers to manage the MSI-X table. */ int pci_pending_msix(device_t dev, u_int index); Modified: stable/8/sys/kern/bus_if.m ============================================================================== --- stable/8/sys/kern/bus_if.m Tue Nov 9 22:17:53 2010 (r215063) +++ stable/8/sys/kern/bus_if.m Tue Nov 9 22:18:20 2010 (r215064) @@ -50,6 +50,15 @@ CODE { return (0); } + static int + null_remap_intr(device_t bus, device_t dev, u_int irq) + { + + if (dev != NULL) + return (BUS_REMAP_INTR(dev, NULL, irq)); + return (ENXIO); + } + static device_t null_add_child(device_t bus, int order, const char *name, int unit) @@ -610,3 +619,16 @@ METHOD void hint_device_unit { METHOD void new_pass { device_t _dev; } DEFAULT bus_generic_new_pass; + +/** + * @brief Notify a bus that specified child's IRQ should be remapped. + * + * @param _dev the bus device + * @param _child the child device + * @param _irq the irq number + */ +METHOD int remap_intr { + device_t _dev; + device_t _child; + u_int _irq; +} DEFAULT null_remap_intr; Modified: stable/8/sys/x86/x86/msi.c ============================================================================== --- stable/8/sys/x86/x86/msi.c Tue Nov 9 22:17:53 2010 (r215063) +++ stable/8/sys/x86/x86/msi.c Tue Nov 9 22:18:20 2010 (r215064) @@ -247,7 +247,8 @@ msi_assign_cpu(struct intsrc *isrc, u_in "msi: Assigning MSI IRQ %d to local APIC %u vector %u\n", sib->msi_irq, sib->msi_cpu, sib->msi_vector); } - pci_remap_msi_irq(msi->msi_dev, msi->msi_irq); + BUS_REMAP_INTR(device_get_parent(msi->msi_dev), msi->msi_dev, + msi->msi_irq); /* * Free the old vector after the new one is established. This is done