From owner-p4-projects@FreeBSD.ORG Tue Jul 23 17:57:48 2013 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 6860447A; Tue, 23 Jul 2013 17:57:48 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id AB4AC478 for ; Tue, 23 Jul 2013 17:57:47 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [8.8.178.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 984502C37 for ; Tue, 23 Jul 2013 17:57:47 +0000 (UTC) Received: from skunkworks.freebsd.org ([127.0.1.74]) by skunkworks.freebsd.org (8.14.7/8.14.7) with ESMTP id r6NHvllW068100 for ; Tue, 23 Jul 2013 17:57:47 GMT (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.7/8.14.6/Submit) id r6NHvlqu068097 for perforce@freebsd.org; Tue, 23 Jul 2013 17:57:47 GMT (envelope-from jhb@freebsd.org) Date: Tue, 23 Jul 2013 17:57:47 GMT Message-Id: <201307231757.r6NHvlqu068097@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin Subject: PERFORCE change 231377 for review To: Perforce Change Reviews Precedence: bulk X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.14 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jul 2013 17:57:48 -0000 http://p4web.freebsd.org/@@231377?ac=10 Change 231377 by jhb@jhb_pippin on 2013/07/23 17:57:07 qpi(4) has to learn about bus numbers, too. Affected files ... .. //depot/projects/pci/sys/x86/include/legacyvar.h#3 edit .. //depot/projects/pci/sys/x86/pci/pci_bus.c#5 edit .. //depot/projects/pci/sys/x86/pci/qpi.c#6 edit Differences ... ==== //depot/projects/pci/sys/x86/include/legacyvar.h#3 (text+ko) ==== @@ -57,6 +57,8 @@ uintptr_t value); struct resource *legacy_pcib_alloc_resource(device_t dev, device_t child, int type, int *rid, u_long start, u_long end, u_long count, u_int flags); +int legacy_pcib_adjust_resource(device_t dev, device_t child, int type, + struct resource *r, u_long start, u_long end); int legacy_pcib_release_resource(device_t dev, device_t child, int type, int rid, struct resource *r); int legacy_pcib_map_msi(device_t pcib, device_t dev, int irq, ==== //depot/projects/pci/sys/x86/pci/pci_bus.c#5 (text+ko) ==== @@ -608,7 +608,7 @@ } #if defined(NEW_PCIB) && defined(PCI_RES_BUS) -static int +int legacy_pcib_adjust_resource(device_t dev, device_t child, int type, struct resource *r, u_long start, u_long end) { ==== //depot/projects/pci/sys/x86/pci/qpi.c#6 (text+ko) ==== @@ -45,8 +45,9 @@ #include #include -#include -#include +#include +#include +#include #include #include @@ -237,22 +238,20 @@ } } -static uint32_t -qpi_pcib_read_config(device_t dev, u_int bus, u_int slot, u_int func, - u_int reg, int bytes) +#if defined(NEW_PCIB) && defined(PCI_RES_BUS) +static struct resource * +qpi_pcib_alloc_resource(device_t dev, device_t child, int type, int *rid, + u_long start, u_long end, u_long count, u_int flags) { - return (pci_cfgregread(bus, slot, func, reg, bytes)); + if (type == PCI_RES_BUS) + return (pci_domain_alloc_bus(0, child, rid, start, end, count, + flags)); + return (bus_generic_alloc_resource(dev, child, type, rid, start, end, + count, flags)); } +#endif -static void -qpi_pcib_write_config(device_t dev, u_int bus, u_int slot, u_int func, - u_int reg, uint32_t data, int bytes) -{ - - pci_cfgregwrite(bus, slot, func, reg, data, bytes); -} - static int qpi_pcib_alloc_msi(device_t pcib, device_t dev, int count, int maxcount, int *irqs) @@ -293,8 +292,14 @@ /* Bus interface */ DEVMETHOD(bus_read_ivar, qpi_pcib_read_ivar), +#if defined(NEW_PCIB) && defined(PCI_RES_BUS) + DEVMETHOD(bus_alloc_resource, qpi_pcib_alloc_resource), + DEVMETHOD(bus_adjust_resource, legacy_pcib_adjust_resource), + DEVMETHOD(bus_release_resource, legacy_pcib_release_resource), +#else DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource), DEVMETHOD(bus_release_resource, bus_generic_release_resource), +#endif DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), @@ -302,8 +307,8 @@ /* pcib interface */ DEVMETHOD(pcib_maxslots, pcib_maxslots), - DEVMETHOD(pcib_read_config, qpi_pcib_read_config), - DEVMETHOD(pcib_write_config, qpi_pcib_write_config), + DEVMETHOD(pcib_read_config, legacy_pcib_read_config), + DEVMETHOD(pcib_write_config, legacy_pcib_write_config), DEVMETHOD(pcib_alloc_msi, qpi_pcib_alloc_msi), DEVMETHOD(pcib_release_msi, pcib_release_msi), DEVMETHOD(pcib_alloc_msix, qpi_pcib_alloc_msix),