[okl4-developer] v2 driver with multiple memory ranges in okl4 3.0

Gabi Voiculescu boy3dfx2 at yahoo.com
Wed Jul 1 05:25:08 EST 2009


What is the Okl4 3.0 code that creates a page table entry in a given space in a user land example. The goal is to map in virtual memory a given physical range [X, X+4k).

I can't find any useful example.

All I can find is how to create the memory section I want (see below) but not how to actually create a page table entry out of it!



Thank you, 

Gabi Voiculescu

-----------------------------------------------------------------------------------------------------------------------------
    /* get root weaver object */
    root_virtmem_pool = okl4_env_get("MAIN_VIRTMEM_POOL");
    assert(root_virtmem_pool);

    /* Create a virtmem item. 4k size */
    okl4_range_item_setsize(&virt, 0x1000);
    error = okl4_virtmem_pool_alloc(root_virtmem_pool, &virt);
    if (error) {
        printf("%s: Failed to allocate virtual memory from the root pool for PHYS_ADDR\n", string);
        return 0;
    }
    printf("Allocated virtual memory from the root pool for PHYS_ADDR\n");
  
    /* Create a physseg item. 4k size, PHYS_ADDR phys base address */
    okl4_range_item_setrange(&phys.range, PHYS_ADDR, 0x1000);

    /* Create a static memsec. */
    okl4_static_memsec_attr_init(&attr);
    okl4_static_memsec_attr_setrange(&attr, virt);
    okl4_static_memsec_attr_settarget(&attr, phys);
    okl4_static_memsec_attr_setperms(&attr, L4_Readable | L4_Writable);
    okl4_static_memsec_attr_setattributes(&attr, L4_UncachedMemory);
    okl4_static_memsec_init(&static_ms, &attr);

    /* get the base virtual address of the SFR to use in irq helper functions */
    USER1_VADDR = okl4_range_item_getbase(&virt);
-----------------------------------------------------------------------------------------------------------------------------


--- On Mon, 6/29/09, Gabi Voiculescu <boy3dfx2 at yahoo.com> wrote:

From: Gabi Voiculescu <boy3dfx2 at yahoo.com>
Subject: [okl4-developer] v2 driver with multiple memory ranges in okl4 3.0
To: developer at okl4.org
Date: Monday, June 29, 2009, 5:03 PM

Hello.

I need to map into my v2 drivers multiple noncontiguous physical memory sections to properly program the particular peripherals on my machine. The (imediate) goal here is to run the ktest suite on my platform in okl4 3.

I need to map the SFR for the peripheral plus 2x 4k SFRs to program an additional Interrupt Controller.

On Okl4 2.1.0 there was an error in importing multiple memory ranges into the final image. Using multiple range entries defined in memory_xxx array in machines.py caused a compilation bug. 
At the time my fix was to have:
only added one range from the platform machines.py  used iguana interface functions: memsection_create_user() and hardware_back_memsection()to map in the additional memory ranges required, directly in my v2 driverI am now searching for the best
 solution to fulfill the same need (of mapping more, non-contiguous physical memory ranges), in my v2 drivers in order to be okl4 3+ compatible.

Can anyone give me an advice?

Thank you,
Gabi Voiculescu





      
-----Inline Attachment Follows-----

_______________________________________________
Developer mailing list
Developer at okl4.org
https://lists.okl4.org/mailman/listinfo/developer



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.okl4.org/pipermail/developer/attachments/20090630/4a1d65fa/attachment.htm 


More information about the Developer mailing list