* cleanup for i810 chipset for 2.5.5-pre1. Second... @ 2002-02-14 17:26 ` Luigi Genoni 2002-02-15 7:29 ` Martin Dalecki 2002-02-15 19:33 ` Pete Zaitcev 0 siblings, 2 replies; 4+ messages in thread From: Luigi Genoni @ 2002-02-14 17:26 UTC (permalink / raw) To: linux-kernel Well, my mailer did some bad things with tabs, spaces and so on... What can I say, I hate when it happens, I hope this time is the good one. Luigi (definitelly should find a better mailer) --- linux/sound/oss/i810_audio.c.old Thu Feb 14 10:33:12 2002 +++ linux/sound/oss/i810_audio.c Thu Feb 14 12:29:15 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, 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); } --- linux/sound/oss/dmabuf.c.old Thu Feb 14 12:34:45 2002 +++ linux/sound/oss/dmabuf.c Thu Feb 14 12:35:00 2002 @@ -113,7 +113,7 @@ } } dmap->raw_buf = start_addr; - dmap->raw_buf_phys = virt_to_bus(start_addr); + dmap->raw_buf_phys = virt_to_phys(start_addr); for (page = virt_to_page(start_addr); page <= virt_to_page(end_addr); page++) mem_map_reserve(page); --- linux/drivers/char/drm/i810_dma.c.old Thu Feb 14 12:36:36 2002 +++ linux/drivers/char/drm/i810_dma.c Thu Feb 14 12:36:53 2002 @@ -491,7 +491,7 @@ memset((void *) dev_priv->hw_status_page, 0, PAGE_SIZE); DRM_DEBUG("hw status page @ %lx\n", dev_priv->hw_status_page); - I810_WRITE(0x02080, virt_to_bus((void *)dev_priv->hw_status_page)); + I810_WRITE(0x02080, virt_to_phys((void *)dev_priv->hw_status_page)); DRM_DEBUG("Enabled hardware status page\n"); /* Now we need to init our freelist */ --- linux/sound/oss/i810_audio.c.old Thu Feb 14 10:33:12 2002 +++ linux/sound/oss/i810_audio.c Thu Feb 14 12:29:15 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); } ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: cleanup for i810 chipset for 2.5.5-pre1. Second... 2002-02-14 17:26 ` cleanup for i810 chipset for 2.5.5-pre1. Second Luigi Genoni @ 2002-02-15 7:29 ` Martin Dalecki 2002-02-15 7:55 ` Jeff Garzik 2002-02-15 19:33 ` Pete Zaitcev 1 sibling, 1 reply; 4+ messages in thread From: Martin Dalecki @ 2002-02-15 7:29 UTC (permalink / raw) To: Luigi Genoni; +Cc: linux-kernel, torvalds [-- Attachment #1: Type: text/plain, Size: 381 bytes --] Luigi Genoni wrote: >Well, my mailer did some bad things with tabs, spaces and so on... >What can I say, I hate when it happens, I hope this time is the good one. > Well better take this, it should make even DM and JG as well as other "portability" fanatics happy ;-). And as a bonus I'm just adding a fixing note to the documentation, which by the way is no longer accurate. [-- Attachment #2: i810_audio.patch --] [-- Type: text/plain, Size: 3200 bytes --] diff -ur linux-2.5.4/Documentation/IO-mapping.txt linux/Documentation/IO-mapping.txt --- linux-2.5.4/Documentation/IO-mapping.txt Mon Feb 11 02:50:14 2002 +++ linux/Documentation/IO-mapping.txt Thu Feb 14 23:08:05 2002 @@ -76,9 +76,13 @@ phys_addr = virt_to_phys(virt_addr); virt_addr = phys_to_virt(phys_addr); - bus_addr = virt_to_bus(virt_addr); + bus_addr = xxx_virt_to_bus(virt_addr); virt_addr = bus_to_virt(bus_addr); +Where xxx is denotifying the particular bus architecture tragetted like: + + ias_virt_to_bus(); + Now, when do you need these? You want the _virtual_ address when you are actually going to access that diff -ur linux-2.5.4/sound/oss/i810_audio.c linux/sound/oss/i810_audio.c --- linux-2.5.4/sound/oss/i810_audio.c Thu Feb 14 23:26:47 2002 +++ linux/sound/oss/i810_audio.c Thu Feb 14 23:09:50 2002 @@ -66,7 +66,7 @@ * * This driver is cursed. (Ben LaHaise) */ - + #include <linux/module.h> #include <linux/version.h> #include <linux/string.h> @@ -135,14 +135,17 @@ /* the 810's array of pointers to data buffers */ +/* Since this structure get's accessed by the AC'97 codec device, we fixup the + * in core layout of it by adding the packed attribute here. */ + struct sg_item { #define BUSADDR_MASK 0xFFFFFFFE - u32 busaddr; -#define CON_IOC 0x80000000 /* interrupt on completion */ + u32 bus_addr; +#define CON_IOC 0x80000000 /* interrupt on completion */ #define CON_BUFPAD 0x40000000 /* pad underrun with last sample, else 0 */ #define CON_BUFLEN_MASK 0x0000ffff /* buffer length in samples */ u32 control; -}; +} __attribute__ ((packed)); /* an instance of the i810 channel */ #define SG_LEN 32 @@ -936,10 +939,10 @@ * Load up 32 sg entries and take an interrupt at half * way (we might want more interrupts later..) */ - + for(i=0;i<dmabuf->numfrag;i++) { - sg->busaddr=virt_to_bus(dmabuf->rawbuf+dmabuf->fragsize*i); + sg->bus_addr= 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 +957,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(isa_virt_to_bus(&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 +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,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(isa_virt_to_bus(&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); } ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: cleanup for i810 chipset for 2.5.5-pre1. Second... 2002-02-15 7:29 ` Martin Dalecki @ 2002-02-15 7:55 ` Jeff Garzik 0 siblings, 0 replies; 4+ messages in thread From: Jeff Garzik @ 2002-02-15 7:55 UTC (permalink / raw) To: Martin Dalecki; +Cc: Luigi Genoni, linux-kernel, torvalds Martin Dalecki wrote: > > Luigi Genoni wrote: > > >Well, my mailer did some bad things with tabs, spaces and so on... > >What can I say, I hate when it happens, I hope this time is the good one. > > > > Well better take this, it should make even DM and JG as well as other > "portability" fanatics happy ;-). > And as a bonus I'm just adding a fixing note to the documentation, which > by the way is > no longer accurate. Well, I've mentioned this at least three times, Pete Zaitcev has a patch which fixes i810_audio properly -- and he even posted it to lkml less than 24 hours ago. Subject "Re: 2.5.5-pre1 and i810_audio.c", message-id <200202141842.g1EIgcR12566@devserv.devel.redhat.com> Further, Alan Cox pointed out that the i810_audio workalike chipsets exist on Alpha, so your solution is still non-portable specifically for case where portability is needed. 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] 4+ messages in thread
* Re: cleanup for i810 chipset for 2.5.5-pre1. Second... 2002-02-14 17:26 ` cleanup for i810 chipset for 2.5.5-pre1. Second Luigi Genoni 2002-02-15 7:29 ` Martin Dalecki @ 2002-02-15 19:33 ` Pete Zaitcev 1 sibling, 0 replies; 4+ messages in thread From: Pete Zaitcev @ 2002-02-15 19:33 UTC (permalink / raw) To: dalecki; +Cc: linux-kernel > diff -ur linux-2.5.4/sound/oss/i810_audio.c linux/sound/oss/i810_audio.c > --- linux-2.5.4/sound/oss/i810_audio.c Thu Feb 14 23:26:47 2002 > +++ linux/sound/oss/i810_audio.c Thu Feb 14 23:09:50 2002 > @@ -66,7 +66,7 @@ > * > * This driver is cursed. (Ben LaHaise) > */ > - > + > #include <linux/module.h> > #include <linux/version.h> > #include <linux/string.h> Leave the syntax sugar out, will you? It's dledford's job to clean it. > @@ -135,14 +135,17 @@ > > /* the 810's array of pointers to data buffers */ > > +/* Since this structure get's accessed by the AC'97 codec device, we fixup the > + * in core layout of it by adding the packed attribute here. */ > + > struct sg_item { > #define BUSADDR_MASK 0xFFFFFFFE > - u32 busaddr; > -#define CON_IOC 0x80000000 /* interrupt on completion */ > + u32 bus_addr; > +#define CON_IOC 0x80000000 /* interrupt on completion */ > #define CON_BUFPAD 0x40000000 /* pad underrun with last sample, else 0 */ > #define CON_BUFLEN_MASK 0x0000ffff /* buffer length in samples */ > u32 control; > -}; > +} __attribute__ ((packed)); > > /* an instance of the i810 channel */ > #define SG_LEN 32 Sounds like a nonsense to me. Show me one architecture that does not pack the structure correctly without ((packed)). You got Linux on CRAY-1 going? > - sg->busaddr=virt_to_bus(dmabuf->rawbuf+dmabuf->fragsize*i); > + sg->bus_addr= dmabuf->dma_handle + dmabuf->fragsize * i; Close, but no cigar, see below. > @@ -954,7 +957,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(isa_virt_to_bus(&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); > Why not to use pci_alloc_consistent here? I did it in 10 minutes, even posted a patch here. > @@ -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; OK > - outl(virt_to_bus(&c->sg[0]), state->card->iobase+c->port+OFF_BDBAR); > + outl(isa_virt_to_bus(&c->sg[0]), state->card->iobase+c->port+OFF_BDBAR); Same as above - must be reworked. -- Pete ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2002-02-15 19:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <mailman.1013758321.20800.linux-kernel2news@redhat.com>
2002-02-14 17:26 ` cleanup for i810 chipset for 2.5.5-pre1. Second Luigi Genoni
2002-02-15 7:29 ` Martin Dalecki
2002-02-15 7:55 ` Jeff Garzik
2002-02-15 19:33 ` Pete Zaitcev
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®