From owner-p4-projects@FreeBSD.ORG Tue Aug 2 20:22:41 2011 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id B36D3106566C; Tue, 2 Aug 2011 20:22:41 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5DC52106566B for ; Tue, 2 Aug 2011 20:22:41 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:4f8:fff6::2d]) by mx1.freebsd.org (Postfix) with ESMTP id 421968FC0C for ; Tue, 2 Aug 2011 20:22:41 +0000 (UTC) Received: from skunkworks.freebsd.org (localhost [127.0.0.1]) by skunkworks.freebsd.org (8.14.4/8.14.4) with ESMTP id p72KMfpU049451 for ; Tue, 2 Aug 2011 20:22:41 GMT (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.4/8.14.4/Submit) id p72KMfhK049448 for perforce@freebsd.org; Tue, 2 Aug 2011 20:22:41 GMT (envelope-from jhb@freebsd.org) Date: Tue, 2 Aug 2011 20:22:41 GMT Message-Id: <201108022022.p72KMfhK049448@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 197089 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Aug 2011 20:22:42 -0000 http://p4web.freebsd.org/@@197089?ac=10 Change 197089 by jhb@jhb_jhbbsd on 2011/08/02 20:21:42 Allow ACPI Host-PCI bridges to permit specific allocations that aren't decoded if they are part of a system resource range. Affected files ... .. //depot/projects/pci/sys/dev/acpica/acpi.c#8 edit .. //depot/projects/pci/sys/dev/acpica/acpi_pcib_acpi.c#28 edit .. //depot/projects/pci/sys/dev/acpica/acpivar.h#5 edit Differences ... ==== //depot/projects/pci/sys/dev/acpica/acpi.c#8 (text+ko) ==== @@ -1238,7 +1238,6 @@ struct resource_list_entry *rle; struct resource_list *rl; struct resource *res; - struct rman *rm; int isdefault = (start == 0UL && end == ~0UL); /* @@ -1291,15 +1290,29 @@ } else res = BUS_ALLOC_RESOURCE(device_get_parent(bus), child, type, rid, start, end, count, flags); - if (res != NULL || start + count - 1 != end) - return (res); /* * If the first attempt failed and this is an allocation of a * specific range, try to satisfy the request via a suballocation - * from our system resource regions. Note that we only handle - * memory and I/O port system resources. + * from our system resource regions. */ + if (res == NULL && start + count - 1 == end) + res = acpi_alloc_sysres(child, type, rid, start, end, count, flags); + return (res); +} + +/* + * Attempt to allocate a specific resource range from the system + * resource ranges. Note that we only handle memory and I/O port + * system resources. + */ +struct resource * +acpi_alloc_sysres(device_t child, int type, int *rid, u_long start, u_long end, + u_long count, u_int flags) +{ + struct rman *rm; + struct resource *res; + switch (type) { case SYS_RES_IOPORT: rm = &acpi_rman_io; @@ -1311,6 +1324,7 @@ return (NULL); } + KASSERT(start + count - 1 == end, ("wildcard resource range")); res = rman_reserve_resource(rm, start, end, count, flags & ~RF_ACTIVE, child); if (res == NULL) ==== //depot/projects/pci/sys/dev/acpica/acpi_pcib_acpi.c#28 (text+ko) ==== @@ -541,6 +541,7 @@ { #ifdef NEW_PCIB struct acpi_hpcib_softc *sc; + struct resource *res; #endif #if defined(__i386__) || defined(__amd64__) @@ -549,8 +550,11 @@ #ifdef NEW_PCIB sc = device_get_softc(dev); - return (pcib_host_res_alloc(&sc->ap_host_res, child, type, rid, start, end, - count, flags)); + res = pcib_host_res_alloc(&sc->ap_host_res, child, type, rid, start, end, + count, flags); + if (res == NULL && start + count - 1 == end) + res = acpi_alloc_sysres(child, type, rid, start, end, count, flags); + return (res); #else return (bus_generic_alloc_resource(dev, child, type, rid, start, end, count, flags)); ==== //depot/projects/pci/sys/dev/acpica/acpivar.h#5 (text+ko) ==== @@ -382,6 +382,8 @@ struct resource *res, ACPI_RESOURCE *acpi_res); ACPI_STATUS acpi_parse_resources(device_t dev, ACPI_HANDLE handle, struct acpi_parse_resource_set *set, void *arg); +struct resource *acpi_alloc_sysres(device_t child, int type, int *rid, + u_long start, u_long end, u_long count, u_int flags); /* ACPI event handling */ UINT32 acpi_event_power_button_sleep(void *context);