svn commit: r189619 - head/sys/dev/cardbus
John Baldwin
jhb at freebsd.org
Tue Mar 10 06:13:46 PDT 2009
On Tuesday 10 March 2009 8:10:50 am Warner Losh wrote:
> Author: imp
> Date: Tue Mar 10 12:10:50 2009
> New Revision: 189619
> URL: http://svn.freebsd.org/changeset/base/189619
>
> Log:
> When freeing all the resources of the card, it is better to turn off
> the PORTEN and MEMEN bits in the command register than to zero the
> bars.
>
> Modified:
> head/sys/dev/cardbus/cardbus.c
>
> Modified: head/sys/dev/cardbus/cardbus.c
>
==============================================================================
> --- head/sys/dev/cardbus/cardbus.c Tue Mar 10 11:46:41 2009 (r189618)
> +++ head/sys/dev/cardbus/cardbus.c Tue Mar 10 12:10:50 2009 (r189619)
> @@ -287,6 +289,7 @@ static void
> cardbus_release_all_resources(device_t cbdev, struct cardbus_devinfo
*dinfo)
> {
> struct resource_list_entry *rle;
> + device_t dev;
>
> /* Free all allocated resources */
> STAILQ_FOREACH(rle, &dinfo->pci.resources, link) {
> @@ -294,15 +297,14 @@ cardbus_release_all_resources(device_t c
> BUS_RELEASE_RESOURCE(device_get_parent(cbdev),
> cbdev, rle->type, rle->rid, rle->res);
> rle->res = NULL;
> - /*
> - * zero out config so the card won't acknowledge
> - * access to the space anymore. XXX doesn't handle
> - * 64-bit bars.
> - */
> - pci_write_config(dinfo->pci.cfg.dev, rle->rid, 0, 4);
> }
> }
> resource_list_free(&dinfo->pci.resources);
> + /* turn off the card's decoding now that the resources are done */
> + dev = dinfo->pci.cfg.dev;
> + pci_write_config(dev, PCIR_COMMAND,
> + pci_read_config(dev, PCIR_COMMAND, 2) &
> + ~(PCIM_CMD_MEMEN | PCIM_CMD_PORTEN), 2);
> }
It might be best to do this before releasing the resources rather than
afterwards.
--
John Baldwin
More information about the svn-src-all
mailing list