VirtualBox

Ignore:
Timestamp:
Jun 10, 2009 5:11:49 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
48451
Message:

xtracker 3945 - allow lowmem allocs to be non-contig

Location:
trunk/src/VBox/Runtime/r0drv/solaris/vbi/i86pc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r0drv/solaris/vbi/i86pc/os/vbi.c

    r19998 r20471  
    2020 */
    2121/*
    22  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
     22 * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
    2323 * Use is subject to license terms.
    2424 */
     
    111111 */
    112112static struct modlmisc vbi_modlmisc = {
    113         &mod_miscops, "VirtualBox Interfaces V4"
     113        &mod_miscops, "VirtualBox Interfaces V5"
    114114};
    115115
     
    199199};
    200200
    201 void *
    202 vbi_contig_alloc(uint64_t *phys, size_t size)
     201static void *
     202vbi_internal_alloc(uint64_t *phys, size_t size, int contig)
    203203{
    204204        ddi_dma_attr_t attr;
    205205        pfn_t pfn;
    206206        void *ptr;
     207        uint_t npages;
    207208
    208209        if ((size & PAGEOFFSET) != 0)
    209210                return (NULL);
     211        npages = size >> PAGESHIFT;
     212        if (npages == 0)
     213                return (NULL);
    210214
    211215        attr = base_attr;
    212216        attr.dma_attr_addr_hi = *phys;
     217        if (!contig)
     218                attr.dma_attr_sgllen = npages;
    213219        ptr = contig_alloc(size, &attr, PAGESIZE, 1);
    214220
    215221        if (ptr == NULL) {
    216                 VBI_VERBOSE("vbi_contig_alloc() failure");
     222                VBI_VERBOSE("vbi_internal_alloc() failure");
    217223                return (NULL);
    218224        }
     
    223229        *phys = (uint64_t)pfn << PAGESHIFT;
    224230        return (ptr);
     231}
     232
     233void *
     234vbi_contig_alloc(uint64_t *phys, size_t size)
     235{
     236        return (vbi_internal_alloc(phys, size, 1));
    225237}
    226238
     
    10601072}
    10611073
    1062 /*
    1063  * This is revision 4 of the interface. As more functions are added,
     1074void
     1075vbi_poke_cpu(int c)
     1076{
     1077        if (c < ncpus)
     1078                poke_cpu(c);
     1079}
     1080
     1081/*
     1082 * This is revision 5 of the interface. As more functions are added,
    10641083 * they should go after this point in the file and the revision level
    10651084 * increased. Also change vbi_modlmisc at the top of the file.
    10661085 */
    1067 uint_t vbi_revision_level = 4;
    1068 
    1069 void
    1070 vbi_poke_cpu(int c)
    1071 {
    1072         if (c < ncpus)
    1073                 poke_cpu(c);
    1074 }
     1086uint_t vbi_revision_level = 5;
     1087
     1088void *
     1089vbi_lowmem_alloc(uint64_t phys, size_t size)
     1090{
     1091        return (vbi_internal_alloc(&phys, size, 0));
     1092}
     1093
     1094void
     1095vbi_lowmem_free(void *va, size_t size)
     1096{
     1097        p_contig_free(va, size);
     1098}
  • trunk/src/VBox/Runtime/r0drv/solaris/vbi/i86pc/sys/vbi.h

    r19496 r20471  
    310310/* end of interfaces defined for version 4 */
    311311
     312/* begin interfaces defined for version 5 */
     313/*
     314 * Allocate and free physically limited, page aligned memory. Note that
     315 * the allocated pages are not physically contiguous.
     316 *
     317 * return value is a) NULL if memory below "phys" not available or
     318 * b) virtual address of memory in kernel heap
     319 *
     320 * phys on input is set to the upper boundary of acceptable memory
     321 *
     322 * size is the amount to allocate and must be a multiple of PAGESIZE
     323 */
     324extern void *vbi_lowmem_alloc(uint64_t phys, size_t size);
     325
     326/*
     327 * va is from vbi_lowmem_alloc() return value
     328 * size must match from vbi_lowmem_alloc()
     329 */
     330extern void vbi_lowmem_free(void *va, size_t size);
     331/* end of interfaces defined for version 5 */
     332
    312333#ifdef  __cplusplus
    313334}
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette