Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 14 Jun 2009 10:27:31 +0300
From:      Alexander Motin <mav@FreeBSD.org>
To:        rick-freebsd2008@kiwi-computer.com
Cc:        freebsd-multimedia@freebsd.org
Subject:   Re: snd_hda works on i386, fails on amd64 (RELENG_7)
Message-ID:  <4A34A663.2010503@FreeBSD.org>
In-Reply-To: <20090614062157.GA67705@keira.kiwi-computer.com>
References:  <1242609781.00113421.1242598202@10.7.7.3> <4A122B72.80206@FreeBSD.org> <20090519184150.GA990@keira.kiwi-computer.com> <20090605020054.GA67365@keira.kiwi-computer.com> <4A28D79C.6070406@FreeBSD.org> <20090614050211.GA67556@keira.kiwi-computer.com> <20090614062157.GA67705@keira.kiwi-computer.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Rick C. Petty wrote:
> On Fri, Jun 05, 2009 at 11:30:20AM +0300, Alexander Motin wrote:
> 
>> Also you may try to change
>> 	sc->support_64bit = HDA_FLAG_MATCH(gcap, HDAC_GCAP_64OK);
>> line to
>> 	sc->support_64bit = 0;
>> , to strictly limit driver to 32bit addresses ignoring hardware
>> capabilities.
> 
> Hmm, I looked at the place that queries support_64bit, in hdac_dma_alloc as
> part of the lowaddr to the bus_dma_tag_create(9) call:
> 
> 	lowaddr = (sc->support_64bit) ? BUS_SPACE_MAXADDR :
> 	    BUS_SPACE_MAXADDR_32BIT;
> 	...
> 
> On a whim, I tried manually setting lowaddr to BUS_SPACE_MAXADDR_24BIT and
> it worked!  A binary search revealed that it breaks for me when
> lowaddr > 0x7FFFFFFF ... perhaps a 32-bit overflow bug related to DMA?

You are right. There is definitely overflow. Try this:

--- hdac.c.prev 2009-04-01 21:55:08.000000000 +0300
+++ hdac.c      2009-06-14 10:24:18.000000000 +0300
@@ -1589,9 +1589,9 @@ hdac_dma_cb(void *callback_arg, bus_dma_
  static int
  hdac_dma_alloc(struct hdac_softc *sc, struct hdac_dma *dma, bus_size_t 
size)
  {
+       bus_addr_t lowaddr;
         bus_size_t roundsz;
         int result;
-       int lowaddr;

         roundsz = roundup2(size, HDAC_DMA_ALIGNMENT);
         lowaddr = (sc->support_64bit) ? BUS_SPACE_MAXADDR :

-- 
Alexander Motin



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