* PATCH 2.5.4 i810_audio, bttv, working at all.
2002-01-29 3:23 ` Linus Torvalds
@ 2002-02-13 12:10 ` Martin Dalecki
2002-02-13 12:35 ` Jeff Garzik
2002-02-13 13:04 ` Alan Cox
0 siblings, 2 replies; 25+ messages in thread
From: Martin Dalecki @ 2002-02-13 12:10 UTC (permalink / raw)
To: Linus Torvalds; +Cc: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 425 bytes --]
The attached 3 patches serve the following purposes:
1. Make the i810_audio.c driver working again. Well it's tested on my
private hardware.
2. Make the bttv driver work again. I know that there is a GREAT REWRITE
of this
driver underway, but still it's a bit annoying to miss the TV until
that's ready.
3. This is just fixing an obvious mistake from the final release and let's
the whole compile at all on IA32.
[-- Attachment #2: i810_audio.patch --]
[-- Type: text/plain, Size: 1616 bytes --]
diff -ur linux/drivers/sound/i810_audio.c linux-new/drivers/sound/i810_audio.c
--- linux/drivers/sound/i810_audio.c Tue Feb 12 18:32:55 2002
+++ linux-new/drivers/sound/i810_audio.c Mon Feb 11 01:34:36 2002
@@ -939,7 +939,7 @@
for(i=0;i<dmabuf->numfrag;i++)
{
- sg->busaddr=virt_to_bus(dmabuf->rawbuf+dmabuf->fragsize*i);
+ sg->busaddr=virt_to_phys(dmabuf->rawbuf+dmabuf->fragsize*i);
// the card will always be doing 16bit stereo
sg->control=dmabuf->fragsamples;
if(state->card->pci_id == PCI_DEVICE_ID_SI_7012)
@@ -954,7 +954,7 @@
}
spin_lock_irqsave(&state->card->lock, flags);
outb(2, state->card->iobase+c->port+OFF_CR); /* reset DMA machine */
- outl(virt_to_bus(&c->sg[0]), state->card->iobase+c->port+OFF_BDBAR);
+ outl(virt_to_phys(&c->sg[0]), state->card->iobase+c->port+OFF_BDBAR);
outb(0, state->card->iobase+c->port+OFF_CIV);
outb(0, state->card->iobase+c->port+OFF_LVI);
@@ -1669,7 +1669,7 @@
if (size > (PAGE_SIZE << dmabuf->buforder))
goto out;
ret = -EAGAIN;
- if (remap_page_range(vma->vm_start, virt_to_phys(dmabuf->rawbuf),
+ if (remap_page_range(vma, vma->vm_start, virt_to_phys(dmabuf->rawbuf),
size, vma->vm_page_prot))
goto out;
dmabuf->mapped = 1;
@@ -1722,7 +1722,7 @@
}
if (c != NULL) {
outb(2, state->card->iobase+c->port+OFF_CR); /* reset DMA machine */
- outl(virt_to_bus(&c->sg[0]), state->card->iobase+c->port+OFF_BDBAR);
+ outl(virt_to_phys(&c->sg[0]), state->card->iobase+c->port+OFF_BDBAR);
outb(0, state->card->iobase+c->port+OFF_CIV);
outb(0, state->card->iobase+c->port+OFF_LVI);
}
[-- Attachment #3: bttv.patch --]
[-- Type: text/plain, Size: 10013 bytes --]
diff -ur linux/drivers/media/video/bttv-driver.c linux-new/drivers/media/video/bttv-driver.c
--- linux/drivers/media/video/bttv-driver.c Tue Feb 12 18:32:53 2002
+++ linux-new/drivers/media/video/bttv-driver.c Mon Feb 11 01:42:05 2002
@@ -166,23 +166,23 @@
return ret;
}
-static inline unsigned long uvirt_to_bus(unsigned long adr)
+static inline unsigned long uvirt_to_phys(unsigned long adr)
{
unsigned long kva, ret;
kva = uvirt_to_kva(pgd_offset(current->mm, adr), adr);
- ret = virt_to_bus((void *)kva);
+ ret = virt_to_phys((void *)kva);
MDEBUG(printk("uv2b(%lx-->%lx)", adr, ret));
return ret;
}
-static inline unsigned long kvirt_to_bus(unsigned long adr)
+static inline unsigned long kvirt_to_phys(unsigned long adr)
{
unsigned long va, kva, ret;
va = VMALLOC_VMADDR(adr);
kva = uvirt_to_kva(pgd_offset_k(va), va);
- ret = virt_to_bus((void *)kva);
+ ret = virt_to_phys((void *)kva);
MDEBUG(printk("kv2b(%lx-->%lx)", adr, ret));
return ret;
}
@@ -530,29 +530,29 @@
if (bttv_debug > 1)
printk("bttv%d: vbi1: po=%08lx pe=%08lx\n",
- btv->nr,virt_to_bus(po), virt_to_bus(pe));
+ btv->nr,virt_to_phys(po), virt_to_phys(pe));
*(po++)=cpu_to_le32(BT848_RISC_SYNC|BT848_FIFO_STATUS_FM1); *(po++)=0;
for (i=0; i<VBI_MAXLINES; i++)
{
*(po++)=cpu_to_le32(VBI_RISC);
- *(po++)=cpu_to_le32(kvirt_to_bus((unsigned long)btv->vbibuf+i*2048));
+ *(po++)=cpu_to_le32(kvirt_to_phys((unsigned long)btv->vbibuf+i*2048));
}
*(po++)=cpu_to_le32(BT848_RISC_JUMP);
- *(po++)=cpu_to_le32(virt_to_bus(btv->risc_jmp+4));
+ *(po++)=cpu_to_le32(virt_to_phys(btv->risc_jmp+4));
*(pe++)=cpu_to_le32(BT848_RISC_SYNC|BT848_FIFO_STATUS_FM1); *(pe++)=0;
for (i=VBI_MAXLINES; i<VBI_MAXLINES*2; i++)
{
*(pe++)=cpu_to_le32(VBI_RISC);
- *(pe++)=cpu_to_le32(kvirt_to_bus((unsigned long)btv->vbibuf+i*2048));
+ *(pe++)=cpu_to_le32(kvirt_to_phys((unsigned long)btv->vbibuf+i*2048));
}
*(pe++)=cpu_to_le32(BT848_RISC_JUMP|BT848_RISC_IRQ|(0x01<<16));
- *(pe++)=cpu_to_le32(virt_to_bus(btv->risc_jmp+10));
+ *(pe++)=cpu_to_le32(virt_to_phys(btv->risc_jmp+10));
if (bttv_debug > 1)
printk("bttv%d: vbi2: po=%08lx pe=%08lx\n",
- btv->nr,virt_to_bus(po), virt_to_bus(pe));
+ btv->nr,virt_to_phys(po), virt_to_phys(pe));
}
static int fmtbppx2[16] = {
@@ -599,9 +599,9 @@
for (line=0; line < 640; line++)
{
*(ro++)=cpu_to_le32(BT848_RISC_WRITE|bpl|BT848_RISC_SOL|BT848_RISC_EOL);
- *(ro++)=cpu_to_le32(kvirt_to_bus(vadr));
+ *(ro++)=cpu_to_le32(kvirt_to_phys(vadr));
*(re++)=cpu_to_le32(BT848_RISC_WRITE|bpl|BT848_RISC_SOL|BT848_RISC_EOL);
- *(re++)=cpu_to_le32(kvirt_to_bus(vadr+gbufsize/2));
+ *(re++)=cpu_to_le32(kvirt_to_phys(vadr+gbufsize/2));
vadr+=bpl;
}
@@ -629,7 +629,7 @@
if (bttv_debug > 1)
printk("bttv%d: prisc1: ro=%08lx re=%08lx\n",
- btv->nr,virt_to_bus(ro), virt_to_bus(re));
+ btv->nr,virt_to_phys(ro), virt_to_phys(re));
switch(fmt)
{
@@ -705,13 +705,13 @@
*((*rp)++)=cpu_to_le32(rcmd|bl);
*((*rp)++)=cpu_to_le32(blcb|(blcr<<16));
- *((*rp)++)=cpu_to_le32(kvirt_to_bus(vadr));
+ *((*rp)++)=cpu_to_le32(kvirt_to_phys(vadr));
vadr+=bl;
if((rcmd&(15<<28))==BT848_RISC_WRITE123)
{
- *((*rp)++)=cpu_to_le32(kvirt_to_bus(cbadr));
+ *((*rp)++)=cpu_to_le32(kvirt_to_phys(cbadr));
cbadr+=blcb;
- *((*rp)++)=cpu_to_le32(kvirt_to_bus(cradr));
+ *((*rp)++)=cpu_to_le32(kvirt_to_phys(cradr));
cradr+=blcr;
}
@@ -726,7 +726,7 @@
if (bttv_debug > 1)
printk("bttv%d: prisc2: ro=%08lx re=%08lx\n",
- btv->nr,virt_to_bus(ro), virt_to_bus(re));
+ btv->nr,virt_to_phys(ro), virt_to_phys(re));
return 0;
}
@@ -751,7 +751,7 @@
if (bttv_debug > 1)
printk("bttv%d: vrisc1: ro=%08lx re=%08lx\n",
- btv->nr,virt_to_bus(ro), virt_to_bus(re));
+ btv->nr,virt_to_phys(ro), virt_to_phys(re));
inter = (height>tvnorms[btv->win.norm].sheight/2) ? 1 : 0;
bpl=width*fmtbppx2[palette2fmt[palette]&0xf]/2;
@@ -773,25 +773,25 @@
{
*((*rp)++)=cpu_to_le32(BT848_RISC_WRITE|BT848_RISC_SOL|
BT848_RISC_EOL|bpl);
- *((*rp)++)=cpu_to_le32(kvirt_to_bus(vadr));
+ *((*rp)++)=cpu_to_le32(kvirt_to_phys(vadr));
vadr+=bpl;
}
else
{
todo=bpl;
*((*rp)++)=cpu_to_le32(BT848_RISC_WRITE|BT848_RISC_SOL|bl);
- *((*rp)++)=cpu_to_le32(kvirt_to_bus(vadr));
+ *((*rp)++)=cpu_to_le32(kvirt_to_phys(vadr));
vadr+=bl;
todo-=bl;
while (todo>PAGE_SIZE)
{
*((*rp)++)=cpu_to_le32(BT848_RISC_WRITE|PAGE_SIZE);
- *((*rp)++)=cpu_to_le32(kvirt_to_bus(vadr));
+ *((*rp)++)=cpu_to_le32(kvirt_to_phys(vadr));
vadr+=PAGE_SIZE;
todo-=PAGE_SIZE;
}
*((*rp)++)=cpu_to_le32(BT848_RISC_WRITE|BT848_RISC_EOL|todo);
- *((*rp)++)=cpu_to_le32(kvirt_to_bus(vadr));
+ *((*rp)++)=cpu_to_le32(kvirt_to_phys(vadr));
vadr+=todo;
}
}
@@ -803,7 +803,7 @@
if (bttv_debug > 1)
printk("bttv%d: vrisc2: ro=%08lx re=%08lx\n",
- btv->nr,virt_to_bus(ro), virt_to_bus(re));
+ btv->nr,virt_to_phys(ro), virt_to_phys(re));
return 0;
}
@@ -896,7 +896,7 @@
if (bttv_debug)
printk("bttv%d: clip: ro=%08lx re=%08lx\n",
- btv->nr,virt_to_bus(ro), virt_to_bus(re));
+ btv->nr,virt_to_phys(ro), virt_to_phys(re));
if ((clipmap=vmalloc(VIDEO_CLIPMAP_SIZE))==NULL) {
/* can't clip, don't generate any risc code */
@@ -1213,8 +1213,8 @@
btv->gbuf[mp->frame].fmt = palette2fmt[mp->format];
btv->gbuf[mp->frame].width = mp->width;
btv->gbuf[mp->frame].height = mp->height;
- btv->gbuf[mp->frame].ro = virt_to_bus(ro);
- btv->gbuf[mp->frame].re = virt_to_bus(re);
+ btv->gbuf[mp->frame].ro = virt_to_phys(ro);
+ btv->gbuf[mp->frame].re = virt_to_phys(re);
#if 1
if (mp->height <= tvnorms[btv->win.norm].sheight/2 &&
@@ -1341,7 +1341,7 @@
btwrite(0xfffffUL, BT848_INT_STAT);
btand(~15, BT848_GPIO_DMA_CTL);
btwrite(0, BT848_SRESET);
- btwrite(virt_to_bus(btv->risc_jmp+2),
+ btwrite(virt_to_phys(btv->risc_jmp+2),
BT848_RISC_STRT_ADD);
/* enforce pll reprogramming */
@@ -2371,7 +2371,7 @@
if (bttv_debug > 1)
printk("bttv%d: set_risc_jmp %08lx:",
- btv->nr,virt_to_bus(btv->risc_jmp));
+ btv->nr,virt_to_phys(btv->risc_jmp));
/* Sync to start of odd field */
btv->risc_jmp[0]=cpu_to_le32(BT848_RISC_SYNC|BT848_RISC_RESYNC
@@ -2382,12 +2382,12 @@
btv->risc_jmp[2]=cpu_to_le32(BT848_RISC_JUMP|(0xd<<20));
if (flags&8) {
if (bttv_debug > 1)
- printk(" ev=%08lx",virt_to_bus(btv->vbi_odd));
- btv->risc_jmp[3]=cpu_to_le32(virt_to_bus(btv->vbi_odd));
+ printk(" ev=%08lx",virt_to_phys(btv->vbi_odd));
+ btv->risc_jmp[3]=cpu_to_le32(virt_to_phys(btv->vbi_odd));
} else {
if (bttv_debug > 1)
printk(" -----------");
- btv->risc_jmp[3]=cpu_to_le32(virt_to_bus(btv->risc_jmp+4));
+ btv->risc_jmp[3]=cpu_to_le32(virt_to_phys(btv->risc_jmp+4));
}
/* Jump to odd sub */
@@ -2400,12 +2400,12 @@
} else if ((flags&2) &&
(!btv->win.interlace || 0 == btv->risc_cap_even)) {
if (bttv_debug > 1)
- printk(" eo=%08lx",virt_to_bus(btv->risc_scr_odd));
- btv->risc_jmp[5]=cpu_to_le32(virt_to_bus(btv->risc_scr_odd));
+ printk(" eo=%08lx",virt_to_phys(btv->risc_scr_odd));
+ btv->risc_jmp[5]=cpu_to_le32(virt_to_phys(btv->risc_scr_odd));
} else {
if (bttv_debug > 1)
printk(" -----------");
- btv->risc_jmp[5]=cpu_to_le32(virt_to_bus(btv->risc_jmp+6));
+ btv->risc_jmp[5]=cpu_to_le32(virt_to_phys(btv->risc_jmp+6));
}
@@ -2418,12 +2418,12 @@
btv->risc_jmp[8]=cpu_to_le32(BT848_RISC_JUMP);
if (flags&4) {
if (bttv_debug > 1)
- printk(" ov=%08lx",virt_to_bus(btv->vbi_even));
- btv->risc_jmp[9]=cpu_to_le32(virt_to_bus(btv->vbi_even));
+ printk(" ov=%08lx",virt_to_phys(btv->vbi_even));
+ btv->risc_jmp[9]=cpu_to_le32(virt_to_phys(btv->vbi_even));
} else {
if (bttv_debug > 1)
printk(" -----------");
- btv->risc_jmp[9]=cpu_to_le32(virt_to_bus(btv->risc_jmp+10));
+ btv->risc_jmp[9]=cpu_to_le32(virt_to_phys(btv->risc_jmp+10));
}
/* Jump to even sub */
@@ -2436,12 +2436,12 @@
} else if ((flags&1) &&
btv->win.interlace) {
if (bttv_debug > 1)
- printk(" oo=%08lx",virt_to_bus(btv->risc_scr_even));
- btv->risc_jmp[11]=cpu_to_le32(virt_to_bus(btv->risc_scr_even));
+ printk(" oo=%08lx",virt_to_phys(btv->risc_scr_even));
+ btv->risc_jmp[11]=cpu_to_le32(virt_to_phys(btv->risc_scr_even));
} else {
if (bttv_debug > 1)
printk(" -----------");
- btv->risc_jmp[11]=cpu_to_le32(virt_to_bus(btv->risc_jmp+12));
+ btv->risc_jmp[11]=cpu_to_le32(virt_to_phys(btv->risc_jmp+12));
}
if (btv->gq_start) {
@@ -2449,7 +2449,7 @@
} else {
btv->risc_jmp[12]=cpu_to_le32(BT848_RISC_JUMP);
}
- btv->risc_jmp[13]=cpu_to_le32(virt_to_bus(btv->risc_jmp));
+ btv->risc_jmp[13]=cpu_to_le32(virt_to_phys(btv->risc_jmp));
/* enable cpaturing and DMA */
if (bttv_debug > 1)
@@ -2546,10 +2546,10 @@
return -1;
btv->vbi_odd=btv->risc_jmp+16;
btv->vbi_even=btv->vbi_odd+256;
- btv->bus_vbi_odd=virt_to_bus(btv->risc_jmp+12);
- btv->bus_vbi_even=virt_to_bus(btv->risc_jmp+6);
+ btv->bus_vbi_odd=virt_to_phys(btv->risc_jmp+12);
+ btv->bus_vbi_even=virt_to_phys(btv->risc_jmp+6);
- btwrite(virt_to_bus(btv->risc_jmp+2), BT848_RISC_STRT_ADD);
+ btwrite(virt_to_phys(btv->risc_jmp+2), BT848_RISC_STRT_ADD);
btv->vbibuf=(unsigned char *) vmalloc_32(VBIBUF_SIZE);
if (!btv->vbibuf)
return -1;
@@ -2719,7 +2719,7 @@
if (btv->errors < BTTV_ERRORS) {
spin_lock(&btv->s_lock);
btand(~15, BT848_GPIO_DMA_CTL);
- btwrite(virt_to_bus(btv->risc_jmp+2),
+ btwrite(virt_to_phys(btv->risc_jmp+2),
BT848_RISC_STRT_ADD);
bt848_set_geo(btv,0);
bt848_set_risc_jmps(btv,-1);
[-- Attachment #4: compile-2.5.4.patch --]
[-- Type: text/plain, Size: 1299 bytes --]
diff -ur linux-2.5.4/arch/i386/kernel/process.c linux/arch/i386/kernel/process.c
--- linux-2.5.4/arch/i386/kernel/process.c Mon Feb 11 02:50:06 2002
+++ linux/arch/i386/kernel/process.c Tue Feb 12 19:58:33 2002
@@ -468,6 +468,14 @@
}
/*
+ * Return saved PC of a blocked thread.
+ */
+unsigned long thread_saved_pc(struct task_struct *tsk)
+{
+ return ((unsigned long *)tsk->thread.esp)[3];
+}
+
+/*
* No need to lock the MM as we are the last user
*/
void release_segments(struct mm_struct *mm)
diff -ur linux-2.5.4/include/asm-i386/processor.h linux/include/asm-i386/processor.h
--- linux-2.5.4/include/asm-i386/processor.h Mon Feb 11 02:50:08 2002
+++ linux/include/asm-i386/processor.h Tue Feb 12 20:03:54 2002
@@ -436,13 +436,8 @@
extern void copy_segments(struct task_struct *p, struct mm_struct * mm);
extern void release_segments(struct mm_struct * mm);
-/*
- * Return saved PC of a blocked thread.
- */
-static inline unsigned long thread_saved_pc(struct task_struct *tsk)
-{
- return ((unsigned long *)tsk->thread->esp)[3];
-}
+/* Return saved PC of a blocked thread. */
+extern unsigned long thread_saved_pc(struct task_struct *tsk);
unsigned long get_wchan(struct task_struct *p);
#define KSTK_EIP(tsk) (((unsigned long *)(4096+(unsigned long)(tsk)->thread_info))[1019])
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: PATCH 2.5.4 i810_audio, bttv, working at all.
2002-02-13 12:10 ` PATCH 2.5.4 i810_audio, bttv, working at all Martin Dalecki
@ 2002-02-13 12:35 ` Jeff Garzik
2002-02-13 12:40 ` Martin Dalecki
2002-02-13 18:30 ` Linus Torvalds
2002-02-13 13:04 ` Alan Cox
1 sibling, 2 replies; 25+ messages in thread
From: Jeff Garzik @ 2002-02-13 12:35 UTC (permalink / raw)
To: Martin Dalecki; +Cc: Linus Torvalds, linux-kernel
Martin Dalecki wrote:
sg->busaddr=virt_to_bus(dmabuf->rawbuf+dmabuf->fragsize*i);
> + sg->busaddr=virt_to_phys(dmabuf->rawbuf+dmabuf->fragsize*i);
> // the card will always be doing 16bit stereo
> sg->control=dmabuf->fragsamples;
> if(state->card->pci_id == PCI_DEVICE_ID_SI_7012)
> @@ -954,7 +954,7 @@
> }
> spin_lock_irqsave(&state->card->lock, flags);
> outb(2, state->card->iobase+c->port+OFF_CR); /* reset DMA machine */
> - outl(virt_to_bus(&c->sg[0]), state->card->iobase+c->port+OFF_BDBAR);
> + outl(virt_to_phys(&c->sg[0]), state->card->iobase+c->port+OFF_BDBAR);
These changes are wrong. The addresses desired need to be obtained from
the pci_alloc_consistent return values.
> outb(2, state->card->iobase+c->port+OFF_CR); /* reset DMA machine */
> - outl(virt_to_bus(&c->sg[0]), state->card->iobase+c->port+OFF_BDBAR);
> + outl(virt_to_phys(&c->sg[0]), state->card->iobase+c->port+OFF_BDBAR);
likewise
> - ret = virt_to_bus((void *)kva);
> + ret = virt_to_phys((void *)kva);
> va = VMALLOC_VMADDR(adr);
> kva = uvirt_to_kva(pgd_offset_k(va), va);
> - ret = virt_to_bus((void *)kva);
> + ret = virt_to_phys((void *)kva);
> - btv->nr,virt_to_bus(po), virt_to_bus(pe));
> + btv->nr,virt_to_phys(po), virt_to_phys(pe));
...likewise, etc.
This works on silly x86 but is not portable at all... definitely not
for application.
--
Jeff Garzik | "I went through my candy like hot oatmeal
Building 1024 | through an internally-buttered weasel."
MandrakeSoft | - goats.com
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: PATCH 2.5.4 i810_audio, bttv, working at all.
2002-02-13 12:35 ` Jeff Garzik
@ 2002-02-13 12:40 ` Martin Dalecki
2002-02-13 12:45 ` David S. Miller
2002-02-13 12:47 ` Martin Dalecki
2002-02-13 18:30 ` Linus Torvalds
1 sibling, 2 replies; 25+ messages in thread
From: Martin Dalecki @ 2002-02-13 12:40 UTC (permalink / raw)
To: Jeff Garzik; +Cc: Linus Torvalds, linux-kernel
Jeff Garzik wrote:
>Martin Dalecki wrote:
>sg->busaddr=virt_to_bus(dmabuf->rawbuf+dmabuf->fragsize*i);
>
>>+ sg->busaddr=virt_to_phys(dmabuf->rawbuf+dmabuf->fragsize*i);
>> // the card will always be doing 16bit stereo
>> sg->control=dmabuf->fragsamples;
>> if(state->card->pci_id == PCI_DEVICE_ID_SI_7012)
>>@@ -954,7 +954,7 @@
>> }
>> spin_lock_irqsave(&state->card->lock, flags);
>> outb(2, state->card->iobase+c->port+OFF_CR); /* reset DMA machine */
>>- outl(virt_to_bus(&c->sg[0]), state->card->iobase+c->port+OFF_BDBAR);
>>+ outl(virt_to_phys(&c->sg[0]), state->card->iobase+c->port+OFF_BDBAR);
>>
>
>
>These changes are wrong. The addresses desired need to be obtained from
>the pci_alloc_consistent return values.
>
>> outb(2, state->card->iobase+c->port+OFF_CR); /* reset DMA machine */
>>- outl(virt_to_bus(&c->sg[0]), state->card->iobase+c->port+OFF_BDBAR);
>>+ outl(virt_to_phys(&c->sg[0]), state->card->iobase+c->port+OFF_BDBAR);
>>
>
>likewise
>
>>- ret = virt_to_bus((void *)kva);
>>+ ret = virt_to_phys((void *)kva);
>>
>> va = VMALLOC_VMADDR(adr);
>> kva = uvirt_to_kva(pgd_offset_k(va), va);
>>- ret = virt_to_bus((void *)kva);
>>+ ret = virt_to_phys((void *)kva);
>>
>>- btv->nr,virt_to_bus(po), virt_to_bus(pe));
>>+ btv->nr,virt_to_phys(po), virt_to_phys(pe));
>>
>
>...likewise, etc.
>
>This works on silly x86 but is not portable at all... definitely not
>for application.
>
The bttv we can argue about, I was just tagging it as beeing a quick fix...
Of course I admit that I have taken the easy shoot here. But it wasn't
possible
to me to deduce the proper thing to do by looking at the patches.
This is the usual way I deal with API changes: Have a look at what has
been done
to the other candidates and do the analogous thing where you need it.
But please just show me a non x86 architecture which is using the
i810_audio driver!
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: PATCH 2.5.4 i810_audio, bttv, working at all.
2002-02-13 12:40 ` Martin Dalecki
@ 2002-02-13 12:45 ` David S. Miller
2002-02-13 12:55 ` Martin Dalecki
2002-02-13 12:47 ` Martin Dalecki
1 sibling, 1 reply; 25+ messages in thread
From: David S. Miller @ 2002-02-13 12:45 UTC (permalink / raw)
To: dalecki; +Cc: jgarzik, torvalds, linux-kernel
From: Martin Dalecki <dalecki@evision-ventures.com>
Date: Wed, 13 Feb 2002 13:40:59 +0100
Of course I admit that I have taken the easy shoot here. But it wasn't
possible
to me to deduce the proper thing to do by looking at the patches.
This is the usual way I deal with API changes: Have a look at what has
been done
to the other candidates and do the analogous thing where you need it.
The API hasn't changed, it is being enforced. The PCI DMA api
has existed for years. Please read Documentation/DMA-mapping.txt
so that you may learn how to properly convert drivers.
But please just show me a non x86 architecture which is using the
i810_audio driver!
Because if all drivers are consistently using the portable interfaces,
people writing new drivers will know exactly what to do.
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: PATCH 2.5.4 i810_audio, bttv, working at all.
2002-02-13 12:40 ` Martin Dalecki
2002-02-13 12:45 ` David S. Miller
@ 2002-02-13 12:47 ` Martin Dalecki
2002-02-13 13:10 ` Alan Cox
1 sibling, 1 reply; 25+ messages in thread
From: Martin Dalecki @ 2002-02-13 12:47 UTC (permalink / raw)
To: Martin Dalecki; +Cc: Jeff Garzik, Linus Torvalds, linux-kernel
Martin Dalecki wrote:
> Jeff Garzik wrote:
>
>> These changes are wrong. The addresses desired need to be obtained from
>> the pci_alloc_consistent return values.
>
>
> The bttv we can argue about, I was just tagging it as beeing a quick
> fix...
>
> Of course I admit that I have taken the easy shoot here. But it wasn't
> possible
> to me to deduce the proper thing to do by looking at the patches.
> This is the usual way I deal with API changes: Have a look at what has
> been done
> to the other candidates and do the analogous thing where you need it.
>
> But please just show me a non x86 architecture which is using the
> i810_audio driver!
Ah OK now I see that the API changes you where referencing too are
missing in bttv.c
already for a longer time then the 2.5.3->2.5.4 stage. This makes it
clear how to deal with that.
>
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: PATCH 2.5.4 i810_audio, bttv, working at all.
2002-02-13 12:45 ` David S. Miller
@ 2002-02-13 12:55 ` Martin Dalecki
0 siblings, 0 replies; 25+ messages in thread
From: Martin Dalecki @ 2002-02-13 12:55 UTC (permalink / raw)
To: David S. Miller; +Cc: jgarzik, torvalds, linux-kernel
David S. Miller wrote:
> From: Martin Dalecki <dalecki@evision-ventures.com>
> Date: Wed, 13 Feb 2002 13:40:59 +0100
>
> Of course I admit that I have taken the easy shoot here. But it wasn't
> possible
> to me to deduce the proper thing to do by looking at the patches.
> This is the usual way I deal with API changes: Have a look at what has
> been done
> to the other candidates and do the analogous thing where you need it.
>
>The API hasn't changed, it is being enforced. The PCI DMA api
>has existed for years. Please read Documentation/DMA-mapping.txt
>so that you may learn how to properly convert drivers.
>
> But please just show me a non x86 architecture which is using the
> i810_audio driver!
>
>Because if all drivers are consistently using the portable interfaces,
>people writing new drivers will know exactly what to do.
>
Agred. I see now in patch-2.5.2 and the changes to ymfpci.c how to deal
with this.
I was already suspicious that the continuous back and forth address
space conversion
in bttv.c could be dealt with by just doing it once at initialization
time and storing both
the physical and virtuall mapping. Will do it, when I have pyhsical
access to the corresponding
hardware at hand.
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: PATCH 2.5.4 i810_audio, bttv, working at all.
2002-02-13 12:10 ` PATCH 2.5.4 i810_audio, bttv, working at all Martin Dalecki
2002-02-13 12:35 ` Jeff Garzik
@ 2002-02-13 13:04 ` Alan Cox
1 sibling, 0 replies; 25+ messages in thread
From: Alan Cox @ 2002-02-13 13:04 UTC (permalink / raw)
To: Martin Dalecki; +Cc: Linus Torvalds, linux-kernel
> {
> - sg->busaddr=virt_to_bus(dmabuf->rawbuf+dmabuf->fragsize*i);
> + sg->busaddr=virt_to_phys(dmabuf->rawbuf+dmabuf->fragsize*i);
No don't do this. The code needs changing to use the new PCI API
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: PATCH 2.5.4 i810_audio, bttv, working at all.
2002-02-13 12:47 ` Martin Dalecki
@ 2002-02-13 13:10 ` Alan Cox
2002-02-18 17:36 ` Eric W. Biederman
0 siblings, 1 reply; 25+ messages in thread
From: Alan Cox @ 2002-02-13 13:10 UTC (permalink / raw)
To: Martin Dalecki; +Cc: Martin Dalecki, Jeff Garzik, Linus Torvalds, linux-kernel
> But please just show me a non x86 architecture which is using the
> i810_audio driver!
To start with the i810 audio code is the same code as is used for the AMD768
southbridge which can be used with an Alpha processor + AMD762
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: PATCH 2.5.4 i810_audio, bttv, working at all.
2002-02-13 18:30 ` Linus Torvalds
@ 2002-02-13 16:49 ` David S. Miller
2002-02-13 16:55 ` Martin Dalecki
` (2 more replies)
0 siblings, 3 replies; 25+ messages in thread
From: David S. Miller @ 2002-02-13 16:49 UTC (permalink / raw)
To: torvalds; +Cc: jgarzik, dalecki, linux-kernel
From: Linus Torvalds <torvalds@transmeta.com>
Date: Wed, 13 Feb 2002 10:30:48 -0800 (PST)
Basic rule: it's up to _other_ architectures to fix drivers that don't
work for them. Always has been. Because there's no way you can get the
people who just want to have something working to care.
And if nobody else ends up doing it, you are right it will be people
like Jeff and myself doing it.
So what we are asking is to allow a few weeks for that and not crap up
the tree meanwhile. This is so that the cases that need to be
converted are harder to find.
Actually, you're only half right in one regard. Most people I've
pointed to Documentation/DMA-mapping.txt have responded "Oh, never saw
that before, that looks easy to do. Thanks I'll fix it up properly
for you."
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: PATCH 2.5.4 i810_audio, bttv, working at all.
2002-02-13 16:49 ` David S. Miller
@ 2002-02-13 16:55 ` Martin Dalecki
2002-02-13 17:10 ` Jeff Garzik
2002-02-13 17:01 ` Jeff Garzik
2002-02-13 18:50 ` Linus Torvalds
2 siblings, 1 reply; 25+ messages in thread
From: Martin Dalecki @ 2002-02-13 16:55 UTC (permalink / raw)
To: David S. Miller; +Cc: torvalds, jgarzik, linux-kernel
David S. Miller wrote:
> From: Linus Torvalds <torvalds@transmeta.com>
> Date: Wed, 13 Feb 2002 10:30:48 -0800 (PST)
>
> Basic rule: it's up to _other_ architectures to fix drivers that don't
> work for them. Always has been. Because there's no way you can get the
> people who just want to have something working to care.
>
>And if nobody else ends up doing it, you are right it will be people
>like Jeff and myself doing it.
>
>So what we are asking is to allow a few weeks for that and not crap up
>the tree meanwhile. This is so that the cases that need to be
>converted are harder to find.
>
If you try to use them, then they are not hard to find - things just
break for you and you fix tem.
If you are fixing things for the "store" Linus is right that indeed it's
just a waiste of time on your behalf.
>Actually, you're only half right in one regard. Most people I've
>pointed to Documentation/DMA-mapping.txt have responded "Oh, never saw
>that before, that looks easy to do. Thanks I'll fix it up properly
>for you."
>
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: PATCH 2.5.4 i810_audio, bttv, working at all.
2002-02-13 16:49 ` David S. Miller
2002-02-13 16:55 ` Martin Dalecki
@ 2002-02-13 17:01 ` Jeff Garzik
2002-02-13 18:50 ` Linus Torvalds
2 siblings, 0 replies; 25+ messages in thread
From: Jeff Garzik @ 2002-02-13 17:01 UTC (permalink / raw)
To: David S. Miller; +Cc: torvalds, dalecki, linux-kernel
In the specific case mentioned in $subject, i810_audio has already been
fixed by Pete Zaitcev "the right way", and IIRC Gerd or somebody posted
a better patch for bttv, too. So $subject is actually taken care of...
"David S. Miller" wrote:
> And if nobody else ends up doing it, you are right it will be people
> like Jeff and myself doing it.
and have been doing it in the past :)
> So what we are asking is to allow a few weeks for that and not crap up
> the tree meanwhile. This is so that the cases that need to be
> converted are harder to find.
Yes, please..
> Actually, you're only half right in one regard. Most people I've
> pointed to Documentation/DMA-mapping.txt have responded "Oh, never saw
> that before, that looks easy to do. Thanks I'll fix it up properly
> for you."
I still get plenty of the "but virt_to_phys works fine for me" crowd too
:)
Jeff
--
Jeff Garzik | "I went through my candy like hot oatmeal
Building 1024 | through an internally-buttered weasel."
MandrakeSoft | - goats.com
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: PATCH 2.5.4 i810_audio, bttv, working at all.
2002-02-13 16:55 ` Martin Dalecki
@ 2002-02-13 17:10 ` Jeff Garzik
2002-02-13 19:02 ` Linus Torvalds
0 siblings, 1 reply; 25+ messages in thread
From: Jeff Garzik @ 2002-02-13 17:10 UTC (permalink / raw)
To: Martin Dalecki; +Cc: David S. Miller, torvalds, linux-kernel
Martin Dalecki wrote:
>
> David S. Miller wrote:
>
> > From: Linus Torvalds <torvalds@transmeta.com>
> > Date: Wed, 13 Feb 2002 10:30:48 -0800 (PST)
> >
> > Basic rule: it's up to _other_ architectures to fix drivers that don't
> > work for them. Always has been. Because there's no way you can get the
> > people who just want to have something working to care.
> >
> >And if nobody else ends up doing it, you are right it will be people
> >like Jeff and myself doing it.
> >
> >So what we are asking is to allow a few weeks for that and not crap up
> >the tree meanwhile. This is so that the cases that need to be
> >converted are harder to find.
> >
> If you try to use them, then they are not hard to find - things just
> break for you and you fix tem.
Applying a patch like s/virt_to_bus/virt_to_phys/ makes it more
difficult to find the right spots to change later.
Patience :) We will fix i810_audio and the other notables. As I noted
in the other message just now, i810_audio and bttv fixes are already
floating around, and hopefully should appear on lkml or in a Linus
pre-patch soon...
> If you are fixing things for the "store" Linus is right that indeed it's
> just a waiste of time on your behalf.
I can tell you it is -not- a waste of time. It's not a waste of time
when a vendor appears out of nowhere, having copied a driver of yours.
Since you did it right(tm), the vendor driver is portable, even though
its original source was for x86-only hardware. It's not a waste of time
when people copy your code or learn from your code. It's not a waste of
time when spiffy new x86 hardware appears that has useful IOMMU stuff,
making a driver's use of the PCI DMA API automatically useful for that
new hardware.
I agree with Linus that there is little motivation for someone to
continue patching a driver, after they have fixed the problem they set
out to fix. But that is not the same as saying driver portability is
worthless... far from it.
Jeff
--
Jeff Garzik | "I went through my candy like hot oatmeal
Building 1024 | through an internally-buttered weasel."
MandrakeSoft | - goats.com
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: PATCH 2.5.4 i810_audio, bttv, working at all.
2002-02-13 18:50 ` Linus Torvalds
@ 2002-02-13 17:19 ` Jeff Garzik
2002-02-14 9:27 ` Pavel Machek
0 siblings, 1 reply; 25+ messages in thread
From: Jeff Garzik @ 2002-02-13 17:19 UTC (permalink / raw)
To: Linus Torvalds; +Cc: David S. Miller, dalecki, linux-kernel
Linus Torvalds wrote:
> But many of them are barely working, written by people who don't care
> about the rest of the kernel (or even about the driver itself, they just
> wanted to have a working machine and forget about it), and if we make
> those kinds of drivers do extra work, it's just not going to work.
Which is why, IMO, we should endeavor to make drivers as cookie-cutter
and dirt simple to create as possible. It will probably take many
months, but I would like to continually factor out from the net drivers
not only common code but -design patterns-.
As an experiment a couple months ago, I got most of the PCI net drivers
down to ~200-300 lines of C code apiece, by factoring out common code
patterns into M4 macros. "m4 netdrivers.m4 epic100.tmpl > epic100.c"
I would prefer to make drivers so dirt simple that people don't need to
worry about details like PCI DMA API changes...
Jeff, dreams on
--
Jeff Garzik | "I went through my candy like hot oatmeal
Building 1024 | through an internally-buttered weasel."
MandrakeSoft | - goats.com
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: PATCH 2.5.4 i810_audio, bttv, working at all.
2002-02-13 19:02 ` Linus Torvalds
@ 2002-02-13 17:38 ` Martin Dalecki
0 siblings, 0 replies; 25+ messages in thread
From: Martin Dalecki @ 2002-02-13 17:38 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Jeff Garzik, David S. Miller, linux-kernel
Linus Torvalds wrote:
>
>On Wed, 13 Feb 2002, Jeff Garzik wrote:
>
>>Applying a patch like s/virt_to_bus/virt_to_phys/ makes it more
>>difficult to find the right spots to change later.
>>
>
>Yes and no.
>
>The thing is, for architectures that care, you can just grep for
>"virt_to_phys()". It's basically _never_ the right thing to do on
>something like sparc.
>
>My personal preference would actually be to keep "virt_to_bus()" for x86
>for now, and undo the change to make it complain. Instead, make it
>complain on other architectures where it _is_ wrong, so that you don't
>have to fix up drivers that simply aren't an issue. What's the point of
>breaking some drivers that only exist on x86?
>
I think that the suggestion from Jeff Garzik, that there is currently
just too much of code
duplication for quite common cases in drivers is the right way to go.
Most of the
stuff doing the virt_to_phys is doing quite common things from a broader
point of view.
Well even worser, there is quite a lot of code replication there as well
... see for example the
ide and scsi midlayers ;-). The whole hostadapter/iobus/device stuff
handling could be made common
at least. There is no real need for different driver handler lookup
mechanisms between them.
HWIF(device)-> and Scsi_Host_Templ come into mind...
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: PATCH 2.5.4 i810_audio, bttv, working at all.
2002-02-13 12:35 ` Jeff Garzik
2002-02-13 12:40 ` Martin Dalecki
@ 2002-02-13 18:30 ` Linus Torvalds
2002-02-13 16:49 ` David S. Miller
1 sibling, 1 reply; 25+ messages in thread
From: Linus Torvalds @ 2002-02-13 18:30 UTC (permalink / raw)
To: Jeff Garzik; +Cc: Martin Dalecki, linux-kernel
On Wed, 13 Feb 2002, Jeff Garzik wrote:
>
> These changes are wrong. The addresses desired need to be obtained from
> the pci_alloc_consistent return values.
Let's face it, people won't care about the complex PCI interfaces unless
they give you something useful.
On most PC's, they don't.
In short, don't expect driver writers to care about somethign that simply
doesn't matter to them. Rant and rail all you want, but I think the thing
needs to be simplified to be acceptable to people. Many of these things
basically exists only on PC's, and are done on 1:1 pages (ie GFP_KERNEL),
so "virt_to_phys()" works.
Basic rule: it's up to _other_ architectures to fix drivers that don't
work for them. Always has been. Because there's no way you can get the
people who just want to have something working to care.
Linus
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: PATCH 2.5.4 i810_audio, bttv, working at all.
2002-02-13 16:49 ` David S. Miller
2002-02-13 16:55 ` Martin Dalecki
2002-02-13 17:01 ` Jeff Garzik
@ 2002-02-13 18:50 ` Linus Torvalds
2002-02-13 17:19 ` Jeff Garzik
2 siblings, 1 reply; 25+ messages in thread
From: Linus Torvalds @ 2002-02-13 18:50 UTC (permalink / raw)
To: David S. Miller; +Cc: jgarzik, dalecki, linux-kernel
On Wed, 13 Feb 2002, David S. Miller wrote:
>
> Actually, you're only half right in one regard. Most people I've
> pointed to Documentation/DMA-mapping.txt have responded "Oh, never saw
> that before, that looks easy to do. Thanks I'll fix it up properly
> for you."
Fair enough. Educating driver writers is always good, and the good ones
will try to do their best even when it doesn't matter for them. I just
wanted to make sure that we don't make driver writers have to chew off too
big a piece.
(One example of this: look at how the big changes in the ll_rw_block
infrastructure were done - the whole locking thing was basically set up to
avoid having to change legacy drivers in anything but trivial ways, while
still sanely getting rid of io_request_lock. Similarly, while the BIO
stuff was a big change on a mid level layer, there was considerable effort
to make it easy to port drivers that didn't try to be clever to it).
Some drivers are written by people who are really passionate about kernel
internals, and that's good.
But many of them are barely working, written by people who don't care
about the rest of the kernel (or even about the driver itself, they just
wanted to have a working machine and forget about it), and if we make
those kinds of drivers do extra work, it's just not going to work.
Linus
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: PATCH 2.5.4 i810_audio, bttv, working at all.
2002-02-13 17:10 ` Jeff Garzik
@ 2002-02-13 19:02 ` Linus Torvalds
2002-02-13 17:38 ` Martin Dalecki
0 siblings, 1 reply; 25+ messages in thread
From: Linus Torvalds @ 2002-02-13 19:02 UTC (permalink / raw)
To: Jeff Garzik; +Cc: Martin Dalecki, David S. Miller, linux-kernel
On Wed, 13 Feb 2002, Jeff Garzik wrote:
>
> Applying a patch like s/virt_to_bus/virt_to_phys/ makes it more
> difficult to find the right spots to change later.
Yes and no.
The thing is, for architectures that care, you can just grep for
"virt_to_phys()". It's basically _never_ the right thing to do on
something like sparc.
My personal preference would actually be to keep "virt_to_bus()" for x86
for now, and undo the change to make it complain. Instead, make it
complain on other architectures where it _is_ wrong, so that you don't
have to fix up drivers that simply aren't an issue. What's the point of
breaking some drivers that only exist on x86?
That, together with a warning and educating more driver writers.
Linus
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: PATCH 2.5.4 i810_audio, bttv, working at all.
2002-02-13 17:19 ` Jeff Garzik
@ 2002-02-14 9:27 ` Pavel Machek
2002-02-15 2:11 ` Jeff Garzik
0 siblings, 1 reply; 25+ messages in thread
From: Pavel Machek @ 2002-02-14 9:27 UTC (permalink / raw)
To: Jeff Garzik; +Cc: Linus Torvalds, David S. Miller, dalecki, linux-kernel
Hi!
> As an experiment a couple months ago, I got most of the PCI net drivers
> down to ~200-300 lines of C code apiece, by factoring out common code
> patterns into M4 macros. "m4 netdrivers.m4 epic100.tmpl > epic100.c"
This is slightly extreme, right?
But I'd like to see resulting epic100.tmpl ;-).
Pavel
--
Philips Velo 1: 1"x4"x8", 300gram, 60, 12MB, 40bogomips, linux, mutt,
details at http://atrey.karlin.mff.cuni.cz/~pavel/velo/index.html.
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: PATCH 2.5.4 i810_audio, bttv, working at all.
2002-02-14 9:27 ` Pavel Machek
@ 2002-02-15 2:11 ` Jeff Garzik
2002-02-15 3:43 ` Linus Torvalds
0 siblings, 1 reply; 25+ messages in thread
From: Jeff Garzik @ 2002-02-15 2:11 UTC (permalink / raw)
To: Pavel Machek; +Cc: Linus Torvalds, David S. Miller, dalecki, linux-kernel
Pavel Machek wrote:
>
> Hi!
>
> > As an experiment a couple months ago, I got most of the PCI net drivers
> > down to ~200-300 lines of C code apiece, by factoring out common code
> > patterns into M4 macros. "m4 netdrivers.m4 epic100.tmpl > epic100.c"
>
> This is slightly extreme, right?
>
> But I'd like to see resulting epic100.tmpl ;-).
When you have to maintain more than 10 "cookie cutter" net drivers that
are 80-90% the same, you start to want such extremes :)
--
Jeff Garzik | "I went through my candy like hot oatmeal
Building 1024 | through an internally-buttered weasel."
MandrakeSoft | - goats.com
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: PATCH 2.5.4 i810_audio, bttv, working at all.
2002-02-15 2:11 ` Jeff Garzik
@ 2002-02-15 3:43 ` Linus Torvalds
2002-02-15 7:38 ` Martin Dalecki
0 siblings, 1 reply; 25+ messages in thread
From: Linus Torvalds @ 2002-02-15 3:43 UTC (permalink / raw)
To: Jeff Garzik; +Cc: Pavel Machek, David S. Miller, dalecki, linux-kernel
On Thu, 14 Feb 2002, Jeff Garzik wrote:
> >
> > But I'd like to see resulting epic100.tmpl ;-).
>
> When you have to maintain more than 10 "cookie cutter" net drivers that
> are 80-90% the same, you start to want such extremes :)
It's not necessarily a bad idea to have a more capable preprocessor than
the C preprocessor. I've cursed preprocessor limitations before, and I
there was some discussion about using m4 several years ago (and I mean
_several_ years ago - if I were to guess I'd say 6-8 years ago..).
Linus
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: PATCH 2.5.4 i810_audio, bttv, working at all.
2002-02-15 3:43 ` Linus Torvalds
@ 2002-02-15 7:38 ` Martin Dalecki
2002-02-25 16:24 ` Olaf Titz
0 siblings, 1 reply; 25+ messages in thread
From: Martin Dalecki @ 2002-02-15 7:38 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Jeff Garzik, Pavel Machek, David S. Miller, linux-kernel
Linus Torvalds wrote:
>On Thu, 14 Feb 2002, Jeff Garzik wrote:
>
>>>But I'd like to see resulting epic100.tmpl ;-).
>>>
>>When you have to maintain more than 10 "cookie cutter" net drivers that
>>are 80-90% the same, you start to want such extremes :)
>>
>
>It's not necessarily a bad idea to have a more capable preprocessor than
>the C preprocessor. I've cursed preprocessor limitations before, and I
>there was some discussion about using m4 several years ago (and I mean
>_several_ years ago - if I were to guess I'd say 6-8 years ago..).
>
The idal solution would be some kind of stripped down C++ for some of
those problems...
No rtti, no templates, no exceptions, no additional cruft requirng back
behind you runtime
support for the language, but just plain simple direct struct
inheritance kind off ;-).
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: PATCH 2.5.4 i810_audio, bttv, working at all.
2002-02-13 13:10 ` Alan Cox
@ 2002-02-18 17:36 ` Eric W. Biederman
0 siblings, 0 replies; 25+ messages in thread
From: Eric W. Biederman @ 2002-02-18 17:36 UTC (permalink / raw)
To: Alan Cox; +Cc: Martin Dalecki, Jeff Garzik, Linus Torvalds, linux-kernel
Alan Cox <alan@lxorguk.ukuu.org.uk> writes:
> > But please just show me a non x86 architecture which is using the
> > i810_audio driver!
>
> To start with the i810 audio code is the same code as is used for the AMD768
> southbridge which can be used with an Alpha processor + AMD762
Or equally fun I won't be surprised if the i870 chipset for the next
generation ia64 itanium processor (mckinley) could use this code.
Eric
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: PATCH 2.5.4 i810_audio, bttv, working at all.
@ 2002-02-19 17:05 Pete Zaitcev
2002-02-19 19:31 ` Doug Ledford
0 siblings, 1 reply; 25+ messages in thread
From: Pete Zaitcev @ 2002-02-19 17:05 UTC (permalink / raw)
To: linux-kernel; +Cc: dledford, zaitcev
> From: Linus Torvalds <torvalds@transmeta.com>
> Date: 2002-02-13 16:47:33
> Subject: Re: PATCH 2.5.4 i810_audio, bttv, working at all.
> On Wed, 13 Feb 2002, Jeff Garzik wrote:
> >
> > These changes are wrong. The addresses desired need to be obtained from
> > the pci_alloc_consistent return values.
>
> Let's face it, people won't care about the complex PCI interfaces unless
> they give you something useful.
I cannot believe that I am reading that. The pinhead penguin
is totally off the thread. The fix for i810 took me less than
10 minutes, and it works perfectly! What the hell are you
talking about here? What complex interfaces?! Is this a list
for kernel programmers or milksuckers? The interface is
simple as a pancake!
-- Pete
P.S. Doug, for heaven's sake, push the fix upstrem ASAP, please.
I cannot stand this stupidity and incompetence anymore.
P.P.S. Posting this FOR THE THIRD TIME in reply for a broken
patch. Next guy to post a broken "fix" for i810 with
isa_virt_to_bus or virt_to_phis may suffer very badly.
--- linux-2.5.3/drivers/sound/i810_audio.c Mon Jan 28 14:35:13 2002
+++ linux-2.5.3-p3/drivers/sound/i810_audio.c Fri Feb 8 16:24:05 2002
@@ -335,7 +335,6 @@
struct i810_card {
- struct i810_channel channel[3];
unsigned int magic;
/* We keep i810 cards in a linked list */
@@ -359,6 +358,8 @@
/* structures for abstraction of hardware facilities, codecs, banks and channels*/
struct ac97_codec *ac97_codec[NR_AC97];
struct i810_state *states[NR_HW_CH];
+ struct i810_channel *channel; /* 1:1 to states[] but diff. lifetime */
+ dma_addr_t chandma;
u16 ac97_features;
u16 ac97_status;
@@ -939,7 +940,7 @@
for(i=0;i<dmabuf->numfrag;i++)
{
- sg->busaddr=virt_to_bus(dmabuf->rawbuf+dmabuf->fragsize*i);
+ sg->busaddr=(u32)dmabuf->dma_handle+dmabuf->fragsize*i;
// the card will always be doing 16bit stereo
sg->control=dmabuf->fragsamples;
if(state->card->pci_id == PCI_DEVICE_ID_SI_7012)
@@ -954,7 +955,9 @@
}
spin_lock_irqsave(&state->card->lock, flags);
outb(2, state->card->iobase+c->port+OFF_CR); /* reset DMA machine */
- outl(virt_to_bus(&c->sg[0]), state->card->iobase+c->port+OFF_BDBAR);
+ outl((u32)state->card->chandma +
+ c->num*sizeof(struct i810_channel),
+ state->card->iobase+c->port+OFF_BDBAR);
outb(0, state->card->iobase+c->port+OFF_CIV);
outb(0, state->card->iobase+c->port+OFF_LVI);
@@ -1669,7 +1672,7 @@
if (size > (PAGE_SIZE << dmabuf->buforder))
goto out;
ret = -EAGAIN;
- if (remap_page_range(vma->vm_start, virt_to_phys(dmabuf->rawbuf),
+ if (remap_page_range(vma, vma->vm_start, virt_to_phys(dmabuf->rawbuf),
size, vma->vm_page_prot))
goto out;
dmabuf->mapped = 1;
@@ -1722,7 +1725,9 @@
}
if (c != NULL) {
outb(2, state->card->iobase+c->port+OFF_CR); /* reset DMA machine */
- outl(virt_to_bus(&c->sg[0]), state->card->iobase+c->port+OFF_BDBAR);
+ outl((u32)state->card->chandma +
+ c->num*sizeof(struct i810_channel),
+ state->card->iobase+c->port+OFF_BDBAR);
outb(0, state->card->iobase+c->port+OFF_CIV);
outb(0, state->card->iobase+c->port+OFF_LVI);
}
@@ -2881,15 +2886,26 @@
card->alloc_rec_pcm_channel = i810_alloc_rec_pcm_channel;
card->alloc_rec_mic_channel = i810_alloc_rec_mic_channel;
card->free_pcm_channel = i810_free_pcm_channel;
- card->channel[0].offset = 0;
- card->channel[0].port = 0x00;
- card->channel[0].num=0;
- card->channel[1].offset = 0;
- card->channel[1].port = 0x10;
- card->channel[1].num=1;
- card->channel[2].offset = 0;
- card->channel[2].port = 0x20;
- card->channel[2].num=2;
+
+ if ((card->channel = pci_alloc_consistent(pci_dev,
+ sizeof(struct i810_channel)*NR_HW_CH, &card->chandma)) == NULL) {
+ printk(KERN_ERR "i810: cannot allocate channel DMA memory\n");
+ goto out_mem;
+ }
+
+ { /* We may dispose of this altogether some time soon, so... */
+ struct i810_channel *cp = card->channel;
+
+ cp[0].offset = 0;
+ cp[0].port = 0x00;
+ cp[0].num = 0;
+ cp[1].offset = 0;
+ cp[1].port = 0x10;
+ cp[1].num = 1;
+ cp[2].offset = 0;
+ cp[2].port = 0x20;
+ cp[2].num = 2;
+ }
/* claim our iospace and irq */
request_region(card->iobase, 64, card_names[pci_id->driver_data]);
@@ -2900,8 +2916,7 @@
printk(KERN_ERR "i810_audio: unable to allocate irq %d\n", card->irq);
release_region(card->iobase, 64);
release_region(card->ac97base, 256);
- kfree(card);
- return -ENODEV;
+ goto out_chan;
}
/* initialize AC97 codec and register /dev/mixer */
@@ -2909,8 +2924,7 @@
release_region(card->iobase, 64);
release_region(card->ac97base, 256);
free_irq(card->irq, card);
- kfree(card);
- return -ENODEV;
+ goto out_chan;
}
pci_set_drvdata(pci_dev, card);
@@ -2931,11 +2945,17 @@
unregister_sound_mixer(card->ac97_codec[i]->dev_mixer);
kfree (card->ac97_codec[i]);
}
- kfree(card);
- return -ENODEV;
+ goto out_chan;
}
card->initializing = 0;
return 0;
+
+ out_chan:
+ pci_free_consistent(pci_dev, sizeof(struct i810_channel)*NR_HW_CH,
+ card->channel, card->chandma);
+ out_mem:
+ kfree(card);
+ return -ENODEV;
}
static void __exit i810_remove(struct pci_dev *pci_dev)
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: PATCH 2.5.4 i810_audio, bttv, working at all.
2002-02-19 17:05 PATCH 2.5.4 i810_audio, bttv, working at all Pete Zaitcev
@ 2002-02-19 19:31 ` Doug Ledford
0 siblings, 0 replies; 25+ messages in thread
From: Doug Ledford @ 2002-02-19 19:31 UTC (permalink / raw)
To: Pete Zaitcev; +Cc: linux-kernel, Linus Torvalds, alan, Marcelo Tosatti
[-- Attachment #1: Type: text/plain, Size: 1460 bytes --]
Pete Zaitcev wrote:
>>From: Linus Torvalds <torvalds@transmeta.com>
>>Date: 2002-02-13 16:47:33
>>Subject: Re: PATCH 2.5.4 i810_audio, bttv, working at all.
>>
>
>>On Wed, 13 Feb 2002, Jeff Garzik wrote:
>>
>>>These changes are wrong. The addresses desired need to be obtained from
>>>the pci_alloc_consistent return values.
>>>
>>Let's face it, people won't care about the complex PCI interfaces unless
>>they give you something useful.
>>
>
> I cannot believe that I am reading that. The pinhead penguin
> is totally off the thread. The fix for i810 took me less than
> 10 minutes, and it works perfectly! What the hell are you
> talking about here? What complex interfaces?! Is this a list
> for kernel programmers or milksuckers? The interface is
> simple as a pancake!
>
> -- Pete
>
> P.S. Doug, for heaven's sake, push the fix upstrem ASAP, please.
> I cannot stand this stupidity and incompetence anymore.
>
> P.P.S. Posting this FOR THE THIRD TIME in reply for a broken
> patch. Next guy to post a broken "fix" for i810 with
> isa_virt_to_bus or virt_to_phis may suffer very badly.
I agree that the patch is the correct fix. All except for the line changing
the remap_page_range() call it's also totally relevant to the 2.4 kernel driver.
--
Doug Ledford <dledford@redhat.com> http://people.redhat.com/dledford
Please check my web site for aic7xxx updates/answers before
e-mailing me about problems
[-- Attachment #2: i810-2.5.3-p3.patch --]
[-- Type: text/plain, Size: 4154 bytes --]
--- linux-2.5.3/drivers/sound/i810_audio.c Mon Jan 28 14:35:13 2002
+++ linux-2.5.3-p3/drivers/sound/i810_audio.c Fri Feb 8 16:24:05 2002
@@ -335,7 +335,6 @@
struct i810_card {
- struct i810_channel channel[3];
unsigned int magic;
/* We keep i810 cards in a linked list */
@@ -359,6 +358,8 @@
/* structures for abstraction of hardware facilities, codecs, banks and channels*/
struct ac97_codec *ac97_codec[NR_AC97];
struct i810_state *states[NR_HW_CH];
+ struct i810_channel *channel; /* 1:1 to states[] but diff. lifetime */
+ dma_addr_t chandma;
u16 ac97_features;
u16 ac97_status;
@@ -939,7 +940,7 @@
for(i=0;i<dmabuf->numfrag;i++)
{
- sg->busaddr=virt_to_bus(dmabuf->rawbuf+dmabuf->fragsize*i);
+ sg->busaddr=(u32)dmabuf->dma_handle+dmabuf->fragsize*i;
// the card will always be doing 16bit stereo
sg->control=dmabuf->fragsamples;
if(state->card->pci_id == PCI_DEVICE_ID_SI_7012)
@@ -954,7 +955,9 @@
}
spin_lock_irqsave(&state->card->lock, flags);
outb(2, state->card->iobase+c->port+OFF_CR); /* reset DMA machine */
- outl(virt_to_bus(&c->sg[0]), state->card->iobase+c->port+OFF_BDBAR);
+ outl((u32)state->card->chandma +
+ c->num*sizeof(struct i810_channel),
+ state->card->iobase+c->port+OFF_BDBAR);
outb(0, state->card->iobase+c->port+OFF_CIV);
outb(0, state->card->iobase+c->port+OFF_LVI);
@@ -1669,7 +1672,7 @@
if (size > (PAGE_SIZE << dmabuf->buforder))
goto out;
ret = -EAGAIN;
- if (remap_page_range(vma->vm_start, virt_to_phys(dmabuf->rawbuf),
+ if (remap_page_range(vma, vma->vm_start, virt_to_phys(dmabuf->rawbuf),
size, vma->vm_page_prot))
goto out;
dmabuf->mapped = 1;
@@ -1722,7 +1725,9 @@
}
if (c != NULL) {
outb(2, state->card->iobase+c->port+OFF_CR); /* reset DMA machine */
- outl(virt_to_bus(&c->sg[0]), state->card->iobase+c->port+OFF_BDBAR);
+ outl((u32)state->card->chandma +
+ c->num*sizeof(struct i810_channel),
+ state->card->iobase+c->port+OFF_BDBAR);
outb(0, state->card->iobase+c->port+OFF_CIV);
outb(0, state->card->iobase+c->port+OFF_LVI);
}
@@ -2881,15 +2886,26 @@
card->alloc_rec_pcm_channel = i810_alloc_rec_pcm_channel;
card->alloc_rec_mic_channel = i810_alloc_rec_mic_channel;
card->free_pcm_channel = i810_free_pcm_channel;
- card->channel[0].offset = 0;
- card->channel[0].port = 0x00;
- card->channel[0].num=0;
- card->channel[1].offset = 0;
- card->channel[1].port = 0x10;
- card->channel[1].num=1;
- card->channel[2].offset = 0;
- card->channel[2].port = 0x20;
- card->channel[2].num=2;
+
+ if ((card->channel = pci_alloc_consistent(pci_dev,
+ sizeof(struct i810_channel)*NR_HW_CH, &card->chandma)) == NULL) {
+ printk(KERN_ERR "i810: cannot allocate channel DMA memory\n");
+ goto out_mem;
+ }
+
+ { /* We may dispose of this altogether some time soon, so... */
+ struct i810_channel *cp = card->channel;
+
+ cp[0].offset = 0;
+ cp[0].port = 0x00;
+ cp[0].num = 0;
+ cp[1].offset = 0;
+ cp[1].port = 0x10;
+ cp[1].num = 1;
+ cp[2].offset = 0;
+ cp[2].port = 0x20;
+ cp[2].num = 2;
+ }
/* claim our iospace and irq */
request_region(card->iobase, 64, card_names[pci_id->driver_data]);
@@ -2900,8 +2916,7 @@
printk(KERN_ERR "i810_audio: unable to allocate irq %d\n", card->irq);
release_region(card->iobase, 64);
release_region(card->ac97base, 256);
- kfree(card);
- return -ENODEV;
+ goto out_chan;
}
/* initialize AC97 codec and register /dev/mixer */
@@ -2909,8 +2924,7 @@
release_region(card->iobase, 64);
release_region(card->ac97base, 256);
free_irq(card->irq, card);
- kfree(card);
- return -ENODEV;
+ goto out_chan;
}
pci_set_drvdata(pci_dev, card);
@@ -2931,11 +2945,17 @@
unregister_sound_mixer(card->ac97_codec[i]->dev_mixer);
kfree (card->ac97_codec[i]);
}
- kfree(card);
- return -ENODEV;
+ goto out_chan;
}
card->initializing = 0;
return 0;
+
+ out_chan:
+ pci_free_consistent(pci_dev, sizeof(struct i810_channel)*NR_HW_CH,
+ card->channel, card->chandma);
+ out_mem:
+ kfree(card);
+ return -ENODEV;
}
static void __exit i810_remove(struct pci_dev *pci_dev)
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: PATCH 2.5.4 i810_audio, bttv, working at all.
2002-02-15 7:38 ` Martin Dalecki
@ 2002-02-25 16:24 ` Olaf Titz
0 siblings, 0 replies; 25+ messages in thread
From: Olaf Titz @ 2002-02-25 16:24 UTC (permalink / raw)
To: linux-kernel
> The idal solution would be some kind of stripped down C++ for some of
> those problems...
> No rtti, no templates, no exceptions, no additional cruft requirng back
> behind you runtime
> support for the language, but just plain simple direct struct
> inheritance kind off ;-).
I have a preprocessor for that. It's part of my squid-filters package
but could be generally useful as well.
<URL:http://sites.inka.de/~bigred/devel/squid-filter.html>
Olaf
^ permalink raw reply [flat|nested] 25+ messages in thread
end of thread, other threads:[~2002-02-25 16:37 UTC | newest]
Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-02-19 17:05 PATCH 2.5.4 i810_audio, bttv, working at all Pete Zaitcev
2002-02-19 19:31 ` Doug Ledford
-- strict thread matches above, loose matches on Subject: below --
2002-01-28 14:10 A modest proposal -- We need a patch penguin Rob Landley
2002-01-29 1:37 ` Francesco Munda
2002-01-29 3:23 ` Linus Torvalds
2002-02-13 12:10 ` PATCH 2.5.4 i810_audio, bttv, working at all Martin Dalecki
2002-02-13 12:35 ` Jeff Garzik
2002-02-13 12:40 ` Martin Dalecki
2002-02-13 12:45 ` David S. Miller
2002-02-13 12:55 ` Martin Dalecki
2002-02-13 12:47 ` Martin Dalecki
2002-02-13 13:10 ` Alan Cox
2002-02-18 17:36 ` Eric W. Biederman
2002-02-13 18:30 ` Linus Torvalds
2002-02-13 16:49 ` David S. Miller
2002-02-13 16:55 ` Martin Dalecki
2002-02-13 17:10 ` Jeff Garzik
2002-02-13 19:02 ` Linus Torvalds
2002-02-13 17:38 ` Martin Dalecki
2002-02-13 17:01 ` Jeff Garzik
2002-02-13 18:50 ` Linus Torvalds
2002-02-13 17:19 ` Jeff Garzik
2002-02-14 9:27 ` Pavel Machek
2002-02-15 2:11 ` Jeff Garzik
2002-02-15 3:43 ` Linus Torvalds
2002-02-15 7:38 ` Martin Dalecki
2002-02-25 16:24 ` Olaf Titz
2002-02-13 13:04 ` Alan Cox
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox