Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 14 Apr 2013 17:05:07 +0200
From:      Marius Strobl <marius@alchemy.franken.de>
To:        Konstantin Belousov <kib@FreeBSD.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r249476 - in head/sys/dev: ata pci
Message-ID:  <20130414150507.GA62578@alchemy.franken.de>
In-Reply-To: <201304141402.r3EE2YIi001357@svn.freebsd.org>
References:  <201304141402.r3EE2YIi001357@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Apr 14, 2013 at 02:02:34PM +0000, Konstantin Belousov wrote:
> Author: kib
> Date: Sun Apr 14 14:02:34 2013
> New Revision: 249476
> URL: http://svnweb.freebsd.org/changeset/base/249476
> 
> Log:
>   Usnure that PCI bus BIS_GET_DMA_TAG() method sees the actual PCI
>   device which makes the request for dma tag, instead of some descendant
>   of the PCI device, by creating a pass-through trampoline for vga_pci
>   and ata_pci buses.

If you need to know the last PCI device requesting the DMA tag,
wouldn't it make more sense to let the consumer of this walk up the
tree as necessary instead of hacking N drivers? I.e.:
foo_get_dma_tag(device_t bus, device_t child)
{
	device_t device, parent;
	devclass_t pci_devclass;

	pci_devclass = devclass_find("pci");
	for (device = child; child != bus; device = parent) {
		parent = device_get_parent(device);
		if (device_get_devclass(parent) != pci_devclass)
			continue;
		break;
	}
	/* use device */
}

I suspect the problem you are hitting is also true for ISA devices
behind a PCI-ISA-bridge, PCI device drivers attaching non-PCI sub-
devices requesting DMA tags like sk(4) etc.

Marius




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130414150507.GA62578>