2.6.1-mm4: ALSA es1968 DMA alloc problem
Subsystems (2)
Hi,
the ALSA driver snd_es1968 for my Terratec DMX (ES1978 Maestro 2E) fails in 2.6.1-mm4 with the following message:
Jan 16 01:59:15 abc vmunix: PCI: Found IRQ 10 for device 0000:00:0e.0 Jan 16 01:59:15 abc vmunix: es1968: not attempting power management. Jan 16 01:59:16 abc vmunix: es1968: DMA buffer beyond 256MB. Jan 16 01:59:16 abc vmunix: ES1968 (ESS Maestro): probe of 0000:00:0e.0 failed with error -12
The seems to be caused by the following change:
sound/pci/es1968.c 2004-01-15 22:25:44.000000000 -0800 renamed from sound/pci/es1968.c 2003-09-27 18:57:48.000000000 -0700 +1 -1
@@ -2538,7 +2567,7 @@ static int __devinit snd_es1968_create(s snd_printk("architecture does not support 28bit PCI busmaster DMA\n"); return -ENXIO; } - pci_set_dma_mask(pci, 0x0fffffff); + pci_set_consistent_dma_mask(pci, 0x0fffffff); chip = (es1968_t *) snd_magic_kcalloc(es1968_t, 0, GFP_KERNEL); if (! chip)
I don't fully understand Documentation/DMA-mapping.txt, and Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl says to use pci_set_consistent_dma_mask(). I decided to call both pci_set_dma_mask() and pci_set_consistent_dma_mask(), and then the driver works again.
Regards,
Johannes
At Sat, 17 Jan 2004 17:10:13 +0100,
Quoted 10 lines · Johannes Stezenbach
Hi,
the ALSA driver
snd_es1968for my Terratec DMX (ES1978 Maestro 2E) fails in 2.6.1-mm4 with the following message:Jan 16 01:59:15 abc vmunix: PCI: Found IRQ 10 for device 0000:00:0e.0 Jan 16 01:59:15 abc vmunix: es1968: not attempting power management. Jan 16 01:59:16 abc vmunix: es1968: DMA buffer beyond 256MB. Jan 16 01:59:16 abc vmunix: ES1968 (ESS Maestro): probe of 0000:00:0e.0 failed with error -12
(snip)
Quoted 5 lines
I don't fully understand
Documentation/DMA-mapping.txt, andDocumentation/sound/alsa/DocBook/writing-an-alsa-driver.tmplsays to usepci_set_consistent_dma_mask(). I decided to call bothpci_set_dma_mask()andpci_set_consistent_dma_mask(), and then the driver works again.
it looks like calling pci_set_consistent_dma_mask() isn't enough for i386... could you try the attached patch?
--
Takashi Iwai <[email protected]> ALSA Developer - www.alsa-project.org
Fix the DMA allocation for i386 arch and clean up. Replaced pci_dma_supported() with pci_set_dma_mask() (together with pci_set_consistent_dma_mask()) for avoid double checks.
Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl +2 -2
@@ -1291,7 +1291,7 @@ // check PCI availability (28bit DMA) if ((err = pci_enable_device(pci)) < 0) return err; - if (!pci_dma_supported(pci, 0x0fffffff)) { + if (pci_set_dma_mask(pci, 0x0fffffff)) { printk(KERN_ERR "error to set 28bit mask DMA\n"); return -ENXIO; }
@@ -1409,7 +1409,7 @@ <![CDATA[ if ((err = pci_enable_device(pci)) < 0) return err; - if (!pci_dma_supported(pci, 0x0fffffff)) { + if (pci_set_dma_mask(pci, 0x0fffffff)) { printk(KERN_ERR "error to set 28bit mask DMA\n"); return -ENXIO; }
sound/core/memalloc.c +9 -5
@@ -94,16 +94,19 @@ dma_addr_t *dma_handle) {void *ret; -u64 dma_mask; +u64 dma_mask, cdma_mask;unsigned long mask;if (hwdev ==NULL )return pci_alloc_consistent (hwdev, size, dma_handle); - dma_mask = hwdev->consistent_dma_mask; - mask = (unsigned long )dma_mask; + dma_mask = hwdev->dma_mask; + cdma_mask = hwdev->consistent_dma_mask; + mask = (unsigned long )dma_mask && (unsigned long )cdma_mask; + hwdev->dma_mask =0xffffffff ;/* do without masking */ hwdev->consistent_dma_mask =0xffffffff ;/* do without masking */ ret =pci_alloc_consistent (hwdev, size, dma_handle); - hwdev->consistent_dma_mask = dma_mask;/* restore */ + hwdev->dma_mask = dma_mask;/* restore */ + hwdev->consistent_dma_mask = cdma_mask;/* restore */ if (ret) {/* obtained address is out of range? */ if (((unsigned long )*dma_handle + size -1 ) & ~mask) {
@@ -841,10 +844,11 @@continue ; } -if (pci_set_consistent_dma_mask (pci, dev->dma_mask) <0 ) { +if (pci_set_dma_mask (pci, dev->dma_mask) <0 ) {printk (KERN_ERR "snd-page-alloc: cannot set DMA mask %lx for pci %04x:%04x\n" , dev->dma_mask, dev->vendor, dev->device);continue ; } +pci_set_consistent_dma_mask (pci, dev->dma_mask);for (i =0 ; i < dev->buffers; i++) {struct snd_mem_list *mem; mem =kmalloc (sizeof (*mem),GFP_KERNEL );
sound/pci/als4000.c +1 -1
@@ -621,7 +621,7 @@return err; }/* check, if we can restrict PCI DMA transfers to 24 bits */ -if (!pci_dma_supported (pci,0x00ffffff )) { +if (pci_set_dma_mask (pci,0x00ffffff )) {snd_printk ("architecture does not support 24bit PCI busmaster DMA\n" );return -ENXIO ; }
sound/pci/azt3328.c +1 -1
@@ -1361,7 +1361,7 @@ chip->irq =-1 ;/* check if we can restrict PCI DMA transfers to 24 bits */ -if (!pci_dma_supported (pci,0x00ffffff )) { +if (pci_set_dma_mask (pci,0x00ffffff )) {snd_printk ("architecture does not support 24bit PCI busmaster DMA\n" );return -ENXIO ; }
sound/pci/es1938.c +1 -1
@@ -1398,7 +1398,7 @@if ((err =pci_enable_device (pci)) <0 )return err;/* check, if we can restrict PCI DMA transfers to 24 bits */ -if (!pci_dma_supported (pci,0x00ffffff )) { +if (pci_set_dma_mask (pci,0x00ffffff )) {snd_printk ("architecture does not support 24bit PCI busmaster DMA\n" );return -ENXIO ; }
sound/pci/es1968.c +1 -1
@@ -2563,7 +2563,7 @@if ((err =pci_enable_device (pci)) <0 )return err;/* check, if we can restrict PCI DMA transfers to 28 bits */ -if (!pci_dma_supported (pci,0x0fffffff )) { +if (pci_set_dma_mask (pci,0x0fffffff )) {snd_printk ("architecture does not support 28bit PCI busmaster DMA\n" );return -ENXIO ; }
sound/pci/maestro3.c +1 -1
@@ -2547,7 +2547,7 @@return -EIO ;/* check, if we can restrict PCI DMA transfers to 28 bits */ -if (!pci_dma_supported (pci,0x0fffffff )) { +if (pci_set_dma_mask (pci,0x0fffffff )) {snd_printk ("architecture does not support 28bit PCI busmaster DMA\n" );return -ENXIO ; }
sound/pci/sonicvibes.c +1 -1
@@ -1249,7 +1249,7 @@if ((err =pci_enable_device (pci)) <0 )return err;/* check, if we can restrict PCI DMA transfers to 24 bits */ -if (!pci_dma_supported (pci,0x00ffffff )) { +if (pci_set_dma_mask (pci,0x00ffffff )) {snd_printk ("architecture does not support 24bit PCI busmaster DMA\n" );return -ENXIO ; }
sound/pci/ali5451/ali5451.c +1 -1
@@ -2106,7 +2106,7 @@if ((err =pci_enable_device (pci)) <0 )return err;/* check, if we can restrict PCI DMA transfers to 31 bits */ -if (!pci_dma_supported (pci,0x7fffffff )) { +if (pci_set_dma_mask (pci,0x7fffffff )) {snd_printk ("architecture does not support 31bit PCI busmaster DMA\n" );return -ENXIO ; }
sound/pci/emu10k1/emu10k1_main.c +2 -1
@@ -599,11 +599,12 @@return -ENOMEM ;/* set the DMA transfer mask */ emu->dma_mask = is_audigy ?AUDIGY_DMA_MASK :EMU10K1_DMA_MASK ; -if (pci_set_consistent_dma_mask (pci, emu->dma_mask) <0 ) { +if (pci_set_dma_mask (pci, emu->dma_mask)) {snd_printk (KERN_ERR "architecture does not support PCI busmaster DMA with mask 0x%lx\n" , emu->dma_mask);snd_magic_kfree (emu);return -ENXIO ; } +pci_set_consistent_dma_mask (pci, emu->dma_mask); emu->card = card;spin_lock_init (&emu->reg_lock);spin_lock_init (&emu->emu_lock);
sound/pci/ice1712/ice1712.c +1 -1
@@ -2363,7 +2363,7 @@if ((err =pci_enable_device (pci)) <0 )return err;/* check, if we can restrict PCI DMA transfers to 28 bits */ -if (!pci_dma_supported (pci,0x0fffffff )) { +if (pci_set_dma_mask (pci,0x0fffffff )) {snd_printk ("architecture does not support 28bit PCI busmaster DMA\n" );return -ENXIO ; }
sound/pci/ice1712/ice1724.c +0 -1
@@ -1801,7 +1801,6 @@/* enable PCI device */ if ((err =pci_enable_device (pci)) <0 )return err; -pci_set_consistent_dma_mask (pci,0xffffffff ); ice =snd_magic_kcalloc (ice1712_t,0 ,GFP_KERNEL );if (ice ==NULL )
sound/pci/trident/trident_main.c +2 -1
@@ -3523,7 +3523,7 @@if ((err =pci_enable_device (pci)) <0 )return err;/* check, if we can restrict PCI DMA transfers to 30 bits */ -if (!pci_dma_supported (pci,0x3fffffff )) { +if (pci_set_dma_massk (pci,0x3fffffff )) {snd_printk ("architecture does not support 30bit PCI busmaster DMA\n" );return -ENXIO ; }
@@ -3952,6 +3952,7 @@return ;pci_enable_device (trident->pci); +pci_set_dma_mask (trident->pci,0x3fffffff );/* FIXME: correct? */ pci_set_consistent_dma_mask (trident->pci,0x3fffffff );/* FIXME: correct? */ pci_set_master (trident->pci);/* to be sure */
Quoted 1 line · Takashi Iwai
At Sat, 17 Jan 2004 17:10:13 +0100,
all throughout the patch:pci_set_dma_mask() and friends need their return value checked!
Hi,
At Mon, 19 Jan 2004 17:43:22 +0100,
Quoted 8 lines · Arjan van de Ven
[1 <text/plain (quoted-printable)>]
Quoted 1 line · Takashi Iwai
At Sat, 17 Jan 2004 17:10:13 +0100,
all throughout the patch:
pci_set_dma_mask()and friends need their return value checked!
it does check. the patch replaces the code like
if (! pci_dma_support(pci, XXXX)) error; pci_set_dma_mask(pci, XXXX);
with
if (pci_dma_set_mask(pci, XXXX)) error;
(there is one place which doesn't check, but it's in the resume
callback.)
the problem is that in the former version only pci_set_consistent_dma_mask() was called without pci_dma_set_mask(). apparently, this doesn't work properly.
ciao,
Takashi
Quoted 5 lines · Takashi Iwai
sound/core/memalloc.c +0
-0@@ -841,10 +844,11 @@continue ; }
sound/core/memalloc.c line 854
Quoted 10 lines
sound/core/memalloc.c +2
-1-if (pci_set_consistent_dma_mask (pci, dev->dma_mask) <0 ) { +if (pci_set_dma_mask (pci, dev->dma_mask) <0 ) {printk (KERN_ERR "snd-page-alloc: cannot set DMA mask %lx for pci %04x:%04x\n" , dev->dma_mask, dev->vendor, dev->device);continue ; } +pci_set_consistent_dma_mask (pci, dev->dma_mask);for (i =0 ; i < dev->buffers; i++) {struct snd_mem_list *mem; mem =kmalloc (sizeof (*mem),GFP_KERNEL );
unchecked
Quoted 6 lines
sound/pci/emu10k1/emu10k1_main.c +0
-0@@ -599,11 +599,12 @@return -ENOMEM ;/* set the DMA transfer mask */ emu->dma_mask = is_audigy ?AUDIGY_DMA_MASK :EMU10K1_DMA_MASK ;
sound/pci/emu10k1/emu10k1_main.c line 610
Quoted 10 lines
sound/pci/emu10k1/emu10k1_main.c +2
-1-if (pci_set_consistent_dma_mask (pci, emu->dma_mask) <0 ) { +if (pci_set_dma_mask (pci, emu->dma_mask)) {snd_printk (KERN_ERR "architecture does not support PCI busmaster DMA with mask 0x%lx\n" , emu->dma_mask);snd_magic_kfree (emu);return -ENXIO ; } +pci_set_consistent_dma_mask (pci, emu->dma_mask); emu->card = card;spin_lock_init (&emu->reg_lock);spin_lock_init (&emu->emu_lock);
unchecked
sound/pci/trident/trident_main.c line 3958
Quoted 10 lines
sound/pci/trident/trident_main.c +1
-0@@ -3952,6 +3952,7 @@return ;pci_enable_device (trident->pci); +pci_set_dma_mask (trident->pci,0x3fffffff );/* FIXME: correct? */ pci_set_consistent_dma_mask (trident->pci,0x3fffffff );/* FIXME: correct? */ pci_set_master (trident->pci);/* to be sure */
unchecked
At Mon, 19 Jan 2004 18:05:54 +0100,
Quoted 32 lines · Arjan van de Ven
[1 <text/plain (quoted-printable)>]
Quoted 5 lines · Takashi Iwai
sound/core/memalloc.c +0
-0@@ -841,10 +844,11 @@continue ; }sound/core/memalloc.c line 854
Quoted 10 lines
sound/core/memalloc.c +2
-1-if (pci_set_consistent_dma_mask (pci, dev->dma_mask) <0 ) { +if (pci_set_dma_mask (pci, dev->dma_mask) <0 ) {printk (KERN_ERR "snd-page-alloc: cannot set DMA mask %lx for pci %04x:%04x\n" , dev->dma_mask, dev->vendor, dev->device);continue ; } +pci_set_consistent_dma_mask (pci, dev->dma_mask);for (i =0 ; i < dev->buffers; i++) {struct snd_mem_list *mem; mem =kmalloc (sizeof (*mem),GFP_KERNEL );unchecked
Quoted 10 lines
sound/pci/emu10k1/emu10k1_main.c +1
-1@@ -599,11 +599,12 @@return -ENOMEM ;/* set the DMA transfer mask */ emu->dma_mask = is_audigy ?AUDIGY_DMA_MASK :EMU10K1_DMA_MASK ; -if (pci_set_consistent_dma_mask (pci, emu->dma_mask) <0 ) { +if (pci_set_dma_mask (pci, emu->dma_mask)) {snd_printk (KERN_ERR "architecture does not support PCI busmaster DMA with mask 0x%lx\n" , emu->dma_mask);snd_magic_kfree (emu);
Quoted 8 lines
sound/pci/emu10k1/emu10k1_main.c line 610
Quoted 6 lines
sound/pci/emu10k1/emu10k1_main.c +1
-0return -ENXIO ; } +pci_set_consistent_dma_mask (pci, emu->dma_mask); emu->card = card;spin_lock_init (&emu->reg_lock);spin_lock_init (&emu->emu_lock);unchecked
hmm, can calling pci_set_consistent_dma_mask() after pci_set_dma_mask() fail? then we need to fix Documentation/DMA-mapping.txt, too.
Quoted 5 lines
Quoted 5 lines
sound/pci/trident/trident_main.c +0
-0@@ -3952,6 +3952,7 @@return ;
Quoted 7 lines
sound/pci/trident/trident_main.c line 3958
Quoted 5 lines
sound/pci/trident/trident_main.c +1
-0pci_enable_device (trident->pci); +pci_set_dma_mask (trident->pci,0x3fffffff );/* FIXME: correct? */ pci_set_consistent_dma_mask (trident->pci,0x3fffffff );/* FIXME: correct? */ pci_set_master (trident->pci);/* to be sure */ unchecked
this one is in the resume callback.
Takashi
At Mon, 19 Jan 2004 18:14:12 +0100,
Quoted 4 lines · I wrote:
hmm, can calling
pci_set_consistent_dma_mask()afterpci_set_dma_mask()fail? then we need to fixDocumentation/DMA-mapping.txt, too.
well, anyway, the attached is one with checks of both returns.
Takashi
Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl +5 -4
@@ -1291,11 +1291,11 @@ // check PCI availability (28bit DMA) if ((err = pci_enable_device(pci)) < 0) return err; - if (!pci_dma_supported(pci, 0x0fffffff)) { + if (pci_set_dma_mask(pci, 0x0fffffff) < 0 || + pci_set_consistent_dma_mask(pci, 0x0fffffff) < 0) { printk(KERN_ERR "error to set 28bit mask DMA\n"); return -ENXIO; } - pci_set_consistent_dma_mask(pci, 0x0fffffff); chip = snd_magic_kcalloc(mychip_t, 0, GFP_KERNEL); if (chip == NULL)
@@ -1409,11 +1409,12 @@ <![CDATA[ if ((err = pci_enable_device(pci)) < 0) return err; - if (!pci_dma_supported(pci, 0x0fffffff)) { + if (pci_set_dma_mask(pci, 0x0fffffff) < 0 || + pci_set_consistent_dma_mask(pci, 0x0fffffff) < 0) { printk(KERN_ERR "error to set 28bit mask DMA\n"); return -ENXIO; } - pci_set_consistent_dma_mask(pci, 0x0fffffff); + ]]> </programlisting> </informalexample>
sound/core/memalloc.c +9 -5
@@ -94,16 +94,19 @@ dma_addr_t *dma_handle) {void *ret; -u64 dma_mask; +u64 dma_mask, cdma_mask;unsigned long mask;if (hwdev ==NULL )return pci_alloc_consistent (hwdev, size, dma_handle); - dma_mask = hwdev->consistent_dma_mask; - mask = (unsigned long )dma_mask; + dma_mask = hwdev->dma_mask; + cdma_mask = hwdev->consistent_dma_mask; + mask = (unsigned long )dma_mask && (unsigned long )cdma_mask; + hwdev->dma_mask =0xffffffff ;/* do without masking */ hwdev->consistent_dma_mask =0xffffffff ;/* do without masking */ ret =pci_alloc_consistent (hwdev, size, dma_handle); - hwdev->consistent_dma_mask = dma_mask;/* restore */ + hwdev->dma_mask = dma_mask;/* restore */ + hwdev->consistent_dma_mask = cdma_mask;/* restore */ if (ret) {/* obtained address is out of range? */ if (((unsigned long )*dma_handle + size -1 ) & ~mask) {
@@ -841,7 +844,8 @@continue ; } -if (pci_set_consistent_dma_mask (pci, dev->dma_mask) <0 ) { +if (pci_set_dma_mask (pci, dev->dma_mask) <0 || +pci_set_consistent_dma_mask (pci, dev->dma_mask) <0 ) {printk (KERN_ERR "snd-page-alloc: cannot set DMA mask %lx for pci %04x:%04x\n" , dev->dma_mask, dev->vendor, dev->device);continue ; }
sound/pci/als4000.c +2 -2
@@ -621,11 +621,11 @@return err; }/* check, if we can restrict PCI DMA transfers to 24 bits */ -if (!pci_dma_supported (pci,0x00ffffff )) { +if (pci_set_dma_mask (pci,0x00ffffff ) <0 || +pci_set_consistent_dma_mask (pci,0x00ffffff ) <0 ) {snd_printk ("architecture does not support 24bit PCI busmaster DMA\n" );return -ENXIO ; } -pci_set_consistent_dma_mask (pci,0x00ffffff ); gcr =pci_resource_start (pci,0 );if ((res_gcr_port =request_region (gcr,0x40 ,"ALS4000" )) ==NULL ) {
sound/pci/azt3328.c +2 -2
@@ -1361,11 +1361,11 @@ chip->irq =-1 ;/* check if we can restrict PCI DMA transfers to 24 bits */ -if (!pci_dma_supported (pci,0x00ffffff )) { +if (pci_set_dma_mask (pci,0x00ffffff ) <0 || +pci_set_consistent_dma_mask (pci,0x00ffffff ) <0 ) {snd_printk ("architecture does not support 24bit PCI busmaster DMA\n" );return -ENXIO ; } -pci_set_consistent_dma_mask (pci,0x00ffffff ); chip->codec_port =pci_resource_start (pci,0 );if ((chip->res_codec_port =request_region (chip->codec_port,0x80 ,"Aztech AZF3328 I/O" )) ==NULL ) {
sound/pci/es1938.c +2 -2
@@ -1398,11 +1398,11 @@if ((err =pci_enable_device (pci)) <0 )return err;/* check, if we can restrict PCI DMA transfers to 24 bits */ -if (!pci_dma_supported (pci,0x00ffffff )) { +if (pci_set_dma_mask (pci,0x00ffffff ) <0 || +pci_set_consistent_dma_mask (pci,0x00ffffff ) <0 ) {snd_printk ("architecture does not support 24bit PCI busmaster DMA\n" );return -ENXIO ; } -pci_set_consistent_dma_mask (pci,0x00ffffff ); chip =snd_magic_kcalloc (es1938_t,0 ,GFP_KERNEL );if (chip ==NULL )
sound/pci/es1968.c +2 -2
@@ -2563,11 +2563,11 @@if ((err =pci_enable_device (pci)) <0 )return err;/* check, if we can restrict PCI DMA transfers to 28 bits */ -if (!pci_dma_supported (pci,0x0fffffff )) { +if (pci_set_dma_mask (pci,0x0fffffff ) <0 || +pci_set_consistent_dma_mask (pci,0x0fffffff ) <0 ) {snd_printk ("architecture does not support 28bit PCI busmaster DMA\n" );return -ENXIO ; } -pci_set_consistent_dma_mask (pci,0x0fffffff ); chip = (es1968_t *)snd_magic_kcalloc (es1968_t,0 ,GFP_KERNEL );if (! chip)
sound/pci/maestro3.c +2 -2
@@ -2547,11 +2547,11 @@return -EIO ;/* check, if we can restrict PCI DMA transfers to 28 bits */ -if (!pci_dma_supported (pci,0x0fffffff )) { +if (pci_set_dma_mask (pci,0x0fffffff ) <0 || +pci_set_consistent_dma_mask (pci,0x0fffffff ) <0 ) {snd_printk ("architecture does not support 28bit PCI busmaster DMA\n" );return -ENXIO ; } -pci_set_consistent_dma_mask (pci,0x0fffffff ); chip =snd_magic_kcalloc (m3_t,0 ,GFP_KERNEL );if (chip ==NULL )
sound/pci/sonicvibes.c +2 -2
@@ -1249,11 +1249,11 @@if ((err =pci_enable_device (pci)) <0 )return err;/* check, if we can restrict PCI DMA transfers to 24 bits */ -if (!pci_dma_supported (pci,0x00ffffff )) { +if (pci_set_dma_mask (pci,0x00ffffff ) <0 || +pci_set_consistent_dma_mask (pci,0x00ffffff ) <0 ) {snd_printk ("architecture does not support 24bit PCI busmaster DMA\n" );return -ENXIO ; } -pci_set_consistent_dma_mask (pci,0x00ffffff ); sonic =snd_magic_kcalloc (sonicvibes_t,0 ,GFP_KERNEL );if (sonic ==NULL )
sound/pci/ali5451/ali5451.c +2 -2
@@ -2106,11 +2106,11 @@if ((err =pci_enable_device (pci)) <0 )return err;/* check, if we can restrict PCI DMA transfers to 31 bits */ -if (!pci_dma_supported (pci,0x7fffffff )) { +if (pci_set_dma_mask (pci,0x7fffffff ) <0 || +pci_set_consistent_dma_mask (pci,0x7fffffff ) <0 ) {snd_printk ("architecture does not support 31bit PCI busmaster DMA\n" );return -ENXIO ; } -pci_set_consistent_dma_mask (pci,0x7fffffff );if ((codec =snd_magic_kcalloc (ali_t,0 ,GFP_KERNEL )) ==NULL )return -ENOMEM ;
sound/pci/emu10k1/emu10k1_main.c +2 -1
@@ -599,7 +599,8 @@return -ENOMEM ;/* set the DMA transfer mask */ emu->dma_mask = is_audigy ?AUDIGY_DMA_MASK :EMU10K1_DMA_MASK ; -if (pci_set_consistent_dma_mask (pci, emu->dma_mask) <0 ) { +if (pci_set_dma_mask (pci, emu->dma_mask) <0 || +pci_set_consistent_dma_mask (pci, emu->dma_mask) <0 ) {snd_printk (KERN_ERR "architecture does not support PCI busmaster DMA with mask 0x%lx\n" , emu->dma_mask);snd_magic_kfree (emu);return -ENXIO ;
sound/pci/ice1712/ice1712.c +2 -2
@@ -2363,11 +2363,11 @@if ((err =pci_enable_device (pci)) <0 )return err;/* check, if we can restrict PCI DMA transfers to 28 bits */ -if (!pci_dma_supported (pci,0x0fffffff )) { +if (pci_set_dma_mask (pci,0x0fffffff ) <0 || +pci_set_consistent_dma_mask (pci,0x0fffffff ) <0 ) {snd_printk ("architecture does not support 28bit PCI busmaster DMA\n" );return -ENXIO ; } -pci_set_consistent_dma_mask (pci,0x0fffffff ); ice =snd_magic_kcalloc (ice1712_t,0 ,GFP_KERNEL );if (ice ==NULL )
sound/pci/ice1712/ice1724.c +0 -1
@@ -1801,7 +1801,6 @@/* enable PCI device */ if ((err =pci_enable_device (pci)) <0 )return err; -pci_set_consistent_dma_mask (pci,0xffffffff ); ice =snd_magic_kcalloc (ice1712_t,0 ,GFP_KERNEL );if (ice ==NULL )
sound/pci/trident/trident_main.c +5 -3
@@ -3523,11 +3523,11 @@if ((err =pci_enable_device (pci)) <0 )return err;/* check, if we can restrict PCI DMA transfers to 30 bits */ -if (!pci_dma_supported (pci,0x3fffffff )) { +if (pci_set_dma_massk (pci,0x3fffffff ) <0 || +pci_set_consistent_dma_mask (pci,0x3fffffff ) <0 ) {snd_printk ("architecture does not support 30bit PCI busmaster DMA\n" );return -ENXIO ; } -pci_set_consistent_dma_mask (pci,0x3fffffff ); trident =snd_magic_kcalloc (trident_t,0 ,GFP_KERNEL );if (trident ==NULL )
@@ -3952,7 +3952,9 @@return ;pci_enable_device (trident->pci); -pci_set_consistent_dma_mask (trident->pci,0x3fffffff );/* FIXME: correct? */ +if (pci_set_dma_mask (trident->pci,0x3fffffff ) <0 || +pci_set_consistent_dma_mask (trident->pci,0x3fffffff ) <0 ) +snd_printk (KERN_WARNING "trident: can't set the proper DMA mask\n" );pci_set_master (trident->pci);/* to be sure */ switch (trident->device) {
Quoted 8 lines · Takashi Iwai
At Mon, 19 Jan 2004 18:14:12 +0100,
Quoted 4 lines · I wrote:
hmm, can calling
pci_set_consistent_dma_mask()afterpci_set_dma_mask()fail? then we need to fixDocumentation/DMA-mapping.txt, too.well, anyway, the attached is one with checks of both returns.
The patch did not apply cleanly because it is against a newer core/memalloc.c than the one in 2.6.1-mm4 (rev 1.19 vs. 1.20). I fetched memalloc.c rev1.20 from ALSA CVS and applied the patch on top of that: My es1968 soundcard works.
(To make sure the whole problem was not just caused by an out-of-date memalloc.c in 2.6.1-mm4 I also tried just the updated memalloc.c without your patch, but this did not cure the "DMA buffer beyond 256MB" problem.)
Johannes