Haven't tried it, but for those interested, the cmem function for
virt->phys translation is below.  Anybody familiar with Linux know if
anything's changed in recent kernels that would cause this technique to
fail?  Or want to offer up a better way to do this translation?

Can anyone confirm this [mis-]behavior?

Thanks in advance!

========================================
/* Traverses the page tables and translates a virtual adress to a
physical. */
static unsigned long get_phys(unsigned long virtp)
{
    pgd_t *pgd;
    pmd_t *pmd;
    pte_t *pte;
    struct mm_struct *mm = current->mm;

    pgd = pgd_offset(mm, virtp);
    if (!(pgd_none(*pgd) || pgd_bad(*pgd))) {
        pmd = pmd_offset(pgd, virtp);

        if (!(pmd_none(*pmd) || pmd_bad(*pmd))) {
            pte = pte_offset_kernel(pmd, virtp);

            if (pte_present(*pte)) {
                return __pa(page_address(pte_page(*pte)) +
                            (virtp & ~PAGE_MASK));
            }
        }
    }

    return 0;
}
========================================

Chris 

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED]
> ] On Behalf Of Peter Wippich
> Sent: Wednesday, December 06, 2006 12:08 PM
> To: davinci-linux-open-source@linux.davincidsp.com
> Subject: CMEMK and 2.6.19 Kernel 
> 
> 
> Dear, 
> 
> I'm trying to use a (rebuild) cmemk with the GIT kernel. I 
> can compile and 
> load the module. However, when I try to start the decode demo 
> I get an  
> error message from cmemk that it can not map physical memory. 
> It looks 
> like the problem is with the virt->phyc mapping in cmemk. 
> When I check 
> the proc entry for cmem I get all buffer pools with physical address 0
> (right after the module load): 
> 
> Pool 0 has 1 buffers of size 3145728 (3145728 requested)
> Pool 0 busy buffers:
> Pool 0 free buffers:
> Buffer id 0 at physical address 0x0
> 
> Pool 1 has 3 buffers of size 831488 (829440 requested)
> Pool 1 busy buffers:
> Pool 1 free buffers:
> Buffer id 0 at physical address 0x0
> Buffer id 1 at physical address 0x0
> Buffer id 2 at physical address 0x0
> 
> Pool 2 has 1 buffers of size 61440 (61440 requested)
> Pool 2 busy buffers:
> Pool 2 free buffers:
> Buffer id 0 at physical address 0x0
> 
> Pool 3 has 1 buffers of size 12288 (10240 requested)
> Pool 3 busy buffers:
> Pool 3 free buffers:
> Buffer id 0 at physical address 0x0
> 
> Any hints ?? 
> 
> Thank you and best regards, 
> 
> Peter 
> 
> 
> |       Peter Wippich                   Voice: +49 30 
> 46776411          |
> |       G&W Instruments GmbH            fax:   +49 30 
> 46776419          |
> |       Gustav-Meyer-Allee 25, Geb. 12  Email: 
> [EMAIL PROTECTED]   |
> |       D-13355 Berlin  / Germany                             
>           |
> 
> _______________________________________________
> Davinci-linux-open-source mailing list
> Davinci-linux-open-source@linux.davincidsp.com
> http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
> 
_______________________________________________
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Reply via email to