Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Dec 2007 19:29:46 -0500
From:      John Baldwin <jhb@freebsd.org>
To:        cokane@freebsd.org
Cc:        freebsd-hardware@freebsd.org
Subject:   Re: Overlapping PCI Memory Locations
Message-ID:  <200712121929.47314.jhb@freebsd.org>
In-Reply-To: <476036E9.9010002@FreeBSD.org>
References:  <4759730F.6090302@FreeBSD.org> <200712121311.06777.jhb@freebsd.org> <476036E9.9010002@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wednesday 12 December 2007 02:30:49 pm Coleman Kane wrote:
> John Baldwin wrote:
> > On Friday 07 December 2007 11:21:35 am Coleman Kane wrote:
> >   
> >> Hi,
> >>
> >> I've got a problem where two components on my system have overlapping
> >> PCI memory regions:
> >>
> >> atapci0: <ATI ATA controller> port 
> >>     
> > 0x9000-0x9007,0x9008-0x900b,0x9010-0x9017,0x5018-0x501b,0x5020-0x502f mem 
> > 0xd0609000-0xd06093ff irq 16 at device 18.0 on pci0
> >   
> >> atapci0: [ITHREAD]
> >>
> >> pcm0: <ATI SB600 High Definition Audio Controller> mem 
0xd0608000-0xd060bfff 
> >>     
> > irq 16 at device 20.2 on pci0
> >   
> >> pcm0: hdac_mem_alloc: Unable to allocate memory resource
> >>
> >>
> >>
> >> Because of this, I cannot use the sound hardware on this system. In
> >> addition, the memory range used by atapci0 is the SATA AHCI space. The
> >> ata-chipset.c doesn't currently identify the ATI IXP600 SATA controller
> >> (just the paired PATA controller), so I can actually use my drives
> >> through the PATA/IDE compatibility registers in the I/O space. However,
> >> if I modify ata-chipset.c to add support for the IXP600 SATA controller,
> >> I get weird results using ATA_INL(..) calls, which look like something
> >> is interfering with the data I *should* be getting from the SATA mem 
space.
> >>
> >> In addition, the pcm0 refuses to attach, as above.
> >>
> >> Also, this is a notebook and has one of those crummy notebook BIOSes
> >> that don't allow fiddling with this sort of stuff in BIOS. Is there any
> >> facility in the kernel to force these to be remapped (or to perform the
> >> mappings ourselves and ignore what BIOS tells us)?
> >>     
> >
> > No.  You can hack the pci driver to zero out the BAR in either device 
during 
> > boot though as a test.
> >   
> What would the kernel do if the BAR were to be zeroed out?

PCI's bus_alloc_resource() method will try to assign free resources to the 
BAR.

> I applied the attached fixup to sys/dev/pci/pci.c that allows me to
> specify the desired base address from a loader.conf tunable. Is there a
> better way? Is there a project to make a better way?

There is currently not a better way.  Eventually there will be a way to do 
this as part of improving PCI's resource management in general, but I 
wouldn't count on it any time soon.

-- 
John Baldwin



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