[okl4-developer] vlcd - virtual_lcd_set_fb_impl() - problem with memsection_virt_to_phys() in OKL4-2.1.x
Geoffrey Lee
glee at ok-labs.com
Thu Oct 16 02:40:44 EST 2008
On Wed, Oct 15, 2008 at 04:20:33AM -0700, Gabi Voiculescu wrote:
> Hello again.
>
> Do you have an example on how to use the vlcd server with an example application for OKL4.2.1.0 or more recent?
>
> Is there an updated iguana lcd example for OKL4 2.1.x?
Unfortunately there is no updated lcd example for OKL4 2.1.x.
Previously other users of OKL4 pointed out they needed to do
some extra work in order to get it to run - have a look at this
thread for details:
http://wiki.ok-labs.com/forum#nabble-td472260%7Ca472260
-gl
>
> Can you tell me the proper way to add enough capabilities to vlcd so as to make memsection_virt_to_phys() work in my case?
>
> I am interested in a model on how to program capabilities per protected domain to make the framebuffer memsection shared between my iguana example and the vlcd server.
>
> I created an example starting from your document:
> http://wiki.ok-labs.com/DriverFramework?action=AttachFile&do=view&target=OKL4-Tutorial-UsingVirtualDevice.pdf
>
> I use project=iguana example=lcd.
>
> I have added
> env.required_vdevs["lcd_example"] = (["vlcd"])
> in the example SConstruct.
>
> My problem: memsection_virt_to_phys() from virtual_lcd_set_fb_impl() fails with error -2 (the vlcd server has no access permission for the memory section created within my iguana user level example).
>
> Below I depict my source code.
>
>
> Thank you,
> Gabi Voiculescu
> Newgate Design
>
> My iguana example level init_fb function:
>
> static int
> init_fb(struct ig_fb * fb, struct ig_lcd * lcd)
> {
> struct lcd_control_block *ctrl = lcd->control;
> fb->size = ctrl->xres * ctrl->yres * ctrl->bpp / 8;
> // size of fb in bytes
>
> fb->ms = memsection_create_dma ( fb->size,
> &fb->vbase,
> &fb->pm,
> L4_WriteThroughMemory );
>
>
> printf("[%s] pd_attach result %d, L4_FullyAccessible %d\n", __func__, pd_attach(pd_myself(), fb->ms, L4_FullyAccessible) , L4_FullyAccessible);
>
> uintptr_t pbase, psize;
> physmem_info(fb->pm, &pbase, &psize);
>
> printf("[%s] Addressing info: size=0x%x vbase=0x%x pbase=0x%x psize=0x%x\n", __func__, fb->size, (int) fb->vbase, (int) pbase, (int) psize); //FIXME: remove. -gabi virtual <-> phisical mapping verified via kdb ptab
>
> virtual_lcd_set_fb(lcd->server, lcd->handle, fb->vbase, NULL);
>
> return 0;
> }
>
> And my modifications to the vlcd server virtual_lcd_set_fb function (I tried to attach the memsection to vlcd, as well):
>
> int
> virtual_lcd_set_fb_impl
> (
> CORBA_Object _caller, /* AUTO */
> device_t handle,
> uintptr_t new_vaddr,
> idl4_server_environment *_env /* AUTO */
> )
> {
> ......
> uintptr_t old_size;
> size_t new_size;
> uintptr_t dummy;
> uintptr_t new_paddr;
> thread_ref_t server;
>
> dDEBUG_PRINT("%s [vlcd]: vaddr = 0x%lx\n", __func__, new_vaddr);
>
>
> dDEBUG_PRINT("%s pd_attach = %d\n", __func__, pd_attach(pd_myself(), memsection_lookup(new_vaddr, &server)/*fb memsection*/, L4_Readable)); //-gabi FIXME: fails with error -1
> /* See if given vaddr is really backed, and get its size */
> new_paddr = memsection_virt_to_phys(new_vaddr, &new_size); //-gabi: FIXME: fails with error code -2
> dDEBUG_PRINT("%s [vlcd]: paddr = 0x%lx(%ld), vaddr=0x%lx\n", __func__, new_paddr, new_paddr, new_vaddr); //-gabi
> .......
> }
>
>
>
>
>
>
> _______________________________________________
> Developer mailing list
> Developer at okl4.org
> https://lists.okl4.org/mailman/listinfo/developer
--
More information about the Developer
mailing list