Date: Tue, 29 Sep 2009 18:19:43 GMT From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 169023 for review Message-ID: <200909291819.n8TIJhm9013615@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=169023 Change 169023 by jhb@jhb_jhbbsd on 2009/09/29 18:19:07 Teach the acpi(4) bus to mark all resources as reserved aside from a few cases: 1) We ignore IRQ resources for PCI link devices completely. These are not real resources, at least not in the way that we want to manage with rman. 2) Do not reserve resources for system resource devices since they are handled specially. Affected files ... .. //depot/projects/multipass/sys/dev/acpica/acpi.c#6 edit Differences ... ==== //depot/projects/multipass/sys/dev/acpica/acpi.c#6 (text+ko) ==== @@ -118,6 +118,8 @@ uintptr_t value); static struct resource_list *acpi_get_rlist(device_t dev, device_t child); static int acpi_sysres_alloc(device_t dev); +static int acpi_set_resource(device_t dev, device_t child, int type, + int rid, u_long start, u_long count); static struct resource *acpi_alloc_resource(device_t bus, device_t child, int type, int *rid, u_long start, u_long end, u_long count, u_int flags); @@ -190,7 +192,7 @@ DEVMETHOD(bus_read_ivar, acpi_read_ivar), DEVMETHOD(bus_write_ivar, acpi_write_ivar), DEVMETHOD(bus_get_resource_list, acpi_get_rlist), - DEVMETHOD(bus_set_resource, bus_generic_rl_set_resource), + DEVMETHOD(bus_set_resource, acpi_set_resource), DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource), DEVMETHOD(bus_alloc_resource, acpi_alloc_resource), DEVMETHOD(bus_release_resource, acpi_release_resource), @@ -1114,6 +1116,38 @@ return (0); } +static int +acpi_set_resource(device_t dev, device_t child, int type, int rid, + u_long start, u_long count) +{ + struct acpi_device *ad = device_get_ivars(child); + struct resource_list *rl = &ad->ad_rl; + char *pcilink_ids[] = { "PNP0C0F", NULL }; + char *sysres_ids[] = { "PNP0C01", "PNP0C02", NULL }; + u_long end; + + /* Ignore IRQ resources for PCI link devices. */ + if (type == SYS_RES_IRQ && ACPI_ID_PROBE(dev, child, pcilink_ids) != NULL) + return (0); + + /* Add the resource. */ + end = (start + count - 1); + resource_list_add(rl, type, rid, start, end, count); + + /* Don't reserve system resources. */ + if (ACPI_ID_PROBE(dev, child, sysres_ids) != NULL) + return (0); + + /* + * Reserve the resource. + * + * XXX: Ignores failure for now. Failure here is probably a + * BIOS/firmware bug? + */ + resource_list_reserve(rl, dev, child, type, &rid, start, end, count, 0); + return (0); +} + static struct resource * acpi_alloc_resource(device_t bus, device_t child, int type, int *rid, u_long start, u_long end, u_long count, u_int flags) @@ -1246,6 +1280,12 @@ struct resource_list *rl; rl = acpi_get_rlist(bus, child); + if (resource_list_busy(rl, type, rid)) { + device_printf(bus, "delete_resource: Resource still owned by child" + " (type=%d, rid=%d)\n", type, rid); + return; + } + resource_list_unreserve(rl, bus, child, type, rid); resource_list_delete(rl, type, rid); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200909291819.n8TIJhm9013615>