From owner-p4-projects@FreeBSD.ORG Tue Jul 9 03:12:19 2013 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id E6207956; Tue, 9 Jul 2013 03:12:18 +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 A9B33954 for ; Tue, 9 Jul 2013 03:12:18 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [8.8.178.74]) by mx1.freebsd.org (Postfix) with ESMTP id 8B763129C for ; Tue, 9 Jul 2013 03:12:18 +0000 (UTC) Received: from skunkworks.freebsd.org ([127.0.1.74]) by skunkworks.freebsd.org (8.14.7/8.14.7) with ESMTP id r693CIuF021158 for ; Tue, 9 Jul 2013 03:12:18 GMT (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.7/8.14.6/Submit) id r693CIvh021155 for perforce@freebsd.org; Tue, 9 Jul 2013 03:12:18 GMT (envelope-from jhb@freebsd.org) Date: Tue, 9 Jul 2013 03:12:18 GMT Message-Id: <201307090312.r693CIvh021155@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin Subject: PERFORCE change 230880 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, 09 Jul 2013 03:12:19 -0000 http://p4web.freebsd.org/@@230880?ac=10 Change 230880 by jhb@jhb_pipkin on 2013/07/09 03:11:51 Compile, but doesn't really work yet. Affected files ... .. //depot/projects/pci/sys/amd64/include/resource.h#5 edit .. //depot/projects/pci/sys/dev/acpica/acpi_pcib_acpi.c#33 edit .. //depot/projects/pci/sys/dev/pci/pci_private.h#16 edit .. //depot/projects/pci/sys/dev/pci/pci_subr.c#7 edit .. //depot/projects/pci/sys/dev/pci/pcib_private.h#23 edit .. //depot/projects/pci/sys/i386/include/resource.h#3 edit .. //depot/projects/pci/sys/x86/x86/nexus.c#12 edit Differences ... ==== //depot/projects/pci/sys/amd64/include/resource.h#5 (text+ko) ==== @@ -41,7 +41,7 @@ #define SYS_RES_MEMORY 3 /* i/o memory */ #define SYS_RES_IOPORT 4 /* i/o ports */ #ifdef NEW_PCIB -//#define PCI_RES_BUS 5 /* PCI bus numbers */ +#define PCI_RES_BUS 5 /* PCI bus numbers */ #endif #endif /* !_MACHINE_RESOURCE_H_ */ ==== //depot/projects/pci/sys/dev/acpica/acpi_pcib_acpi.c#33 (text+ko) ==== @@ -44,6 +44,7 @@ #include #include +#include #include #include #include "pcib_if.h" @@ -271,7 +272,21 @@ } #endif +#if defined(NEW_PCIB) && defined(PCI_RES_BUS) static int +first_decoded_bus(struct acpi_hpcib_softc *sc, u_long *startp) +{ + struct resource_list_entry *rle; + + rle = resource_list_find(&sc->ap_host_res.hr_rl, PCI_RES_BUS, 0); + if (rle == NULL) + return (ENXIO); + *startp = rle->start; + return (0); +} +#endif + +static int acpi_pcib_acpi_attach(device_t dev) { struct acpi_hpcib_softc *sc; @@ -280,7 +295,7 @@ u_int slot, func, busok; #if defined(NEW_PCIB) && defined(PCI_RES_BUS) struct resource *bus_res; - u_long start, end; + u_long start; int rid; #endif uint8_t busno; @@ -405,8 +420,7 @@ * If we have a region of bus numbers, use the first * number for our bus. */ - if (rman_first_free_region(&sc->ap_host_res.hr_bus_rman, &start, - &end) == 0) + if (first_decoded_bus(sc, &start) == 0) sc->ap_bus = start; else { rid = 0; @@ -422,8 +436,7 @@ } } else { #ifdef INVARIANTS - if (rman_first_free_region(&sc->ap_host_res.hr_bus_rman, &start, - &end) == 0) + if (first_decoded_bus(sc, &start) == 0) KASSERT(start == sc->ap_bus, ("bus number mismatch")); #endif } ==== //depot/projects/pci/sys/dev/pci/pci_private.h#16 (text+ko) ==== @@ -132,13 +132,4 @@ */ void pci_cfg_save(device_t, struct pci_devinfo *, int); -#ifdef PCI_RES_BUS -struct resource *pci_domain_alloc_bus(int domain, device_t dev, int *rid, - u_long start, u_long end, u_long count, u_int flags); -int pci_domain_adjust_bus(int domain, device_t dev, - struct resource *r, u_long start, u_long end); -int pci_domain_release_bus(int domain, device_t dev, int rid, - struct resource *r); -#endif - #endif /* _PCI_PRIVATE_H_ */ ==== //depot/projects/pci/sys/dev/pci/pci_subr.c#7 (text+ko) ==== @@ -35,11 +35,13 @@ #include #include +#include #include #include #include #include +#include #include /* @@ -183,7 +185,11 @@ struct resource_list_entry *rle; int rid; +#ifdef PCI_RES_BUS + if (bootverbose || type == PCI_RES_BUS) +#else if (bootverbose) +#endif device_printf(hr->hr_pcib, "decoding %d %srange %#lx-%#lx\n", type, flags & RF_PREFETCHABLE ? "prefetchable ": "", start, end); @@ -237,7 +243,11 @@ r = bus_generic_alloc_resource(hr->hr_pcib, dev, type, rid, new_start, new_end, count, flags); if (r != NULL) { +#ifdef PCI_RES_BUS + if (bootverbose || type == PCI_RES_BUS) +#else if (bootverbose) +#endif device_printf(hr->hr_pcib, "allocated type %d (%#lx-%#lx) for rid %x of %s\n", type, rman_get_start(r), rman_get_end(r), ==== //depot/projects/pci/sys/dev/pci/pcib_private.h#23 (text+ko) ==== @@ -118,6 +118,14 @@ int host_pcib_get_busno(pci_read_config_fn read_config, int bus, int slot, int func, uint8_t *busnum); +#if defined(NEW_PCIB) && defined(PCI_RES_BUS) +struct resource *pci_domain_alloc_bus(int domain, device_t dev, int *rid, + u_long start, u_long end, u_long count, u_int flags); +int pci_domain_adjust_bus(int domain, device_t dev, + struct resource *r, u_long start, u_long end); +int pci_domain_release_bus(int domain, device_t dev, int rid, + struct resource *r); +#endif int pcib_attach(device_t dev); void pcib_attach_common(device_t dev); #ifdef NEW_PCIB ==== //depot/projects/pci/sys/i386/include/resource.h#3 (text+ko) ==== @@ -40,5 +40,8 @@ #define SYS_RES_DRQ 2 /* isa dma lines */ #define SYS_RES_MEMORY 3 /* i/o memory */ #define SYS_RES_IOPORT 4 /* i/o ports */ +#ifdef NEW_PCIB +#define PCI_RES_BUS 5 /* PCI bus numbers */ +#endif #endif /* !_MACHINE_RESOURCE_H_ */ ==== //depot/projects/pci/sys/x86/x86/nexus.c#12 (text+ko) ==== @@ -521,7 +521,7 @@ { #ifdef PCI_RES_BUS - if (type == PCI_RES_BUS) { + if (type == PCI_RES_BUS) return (pci_domain_release_bus(pcib_get_domain(child), child, rid, r)); #endif