Changeset 20471 in vbox for trunk/src/VBox/Runtime/r0drv/solaris/vbi/i86pc
- Timestamp:
- Jun 10, 2009 5:11:49 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 48451
- 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 20 20 */ 21 21 /* 22 * Copyright 200 8Sun Microsystems, Inc. All rights reserved.22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 23 23 * Use is subject to license terms. 24 24 */ … … 111 111 */ 112 112 static struct modlmisc vbi_modlmisc = { 113 &mod_miscops, "VirtualBox Interfaces V 4"113 &mod_miscops, "VirtualBox Interfaces V5" 114 114 }; 115 115 … … 199 199 }; 200 200 201 void *202 vbi_ contig_alloc(uint64_t *phys, size_t size)201 static void * 202 vbi_internal_alloc(uint64_t *phys, size_t size, int contig) 203 203 { 204 204 ddi_dma_attr_t attr; 205 205 pfn_t pfn; 206 206 void *ptr; 207 uint_t npages; 207 208 208 209 if ((size & PAGEOFFSET) != 0) 209 210 return (NULL); 211 npages = size >> PAGESHIFT; 212 if (npages == 0) 213 return (NULL); 210 214 211 215 attr = base_attr; 212 216 attr.dma_attr_addr_hi = *phys; 217 if (!contig) 218 attr.dma_attr_sgllen = npages; 213 219 ptr = contig_alloc(size, &attr, PAGESIZE, 1); 214 220 215 221 if (ptr == NULL) { 216 VBI_VERBOSE("vbi_ contig_alloc() failure");222 VBI_VERBOSE("vbi_internal_alloc() failure"); 217 223 return (NULL); 218 224 } … … 223 229 *phys = (uint64_t)pfn << PAGESHIFT; 224 230 return (ptr); 231 } 232 233 void * 234 vbi_contig_alloc(uint64_t *phys, size_t size) 235 { 236 return (vbi_internal_alloc(phys, size, 1)); 225 237 } 226 238 … … 1060 1072 } 1061 1073 1062 /* 1063 * This is revision 4 of the interface. As more functions are added, 1074 void 1075 vbi_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, 1064 1083 * they should go after this point in the file and the revision level 1065 1084 * increased. Also change vbi_modlmisc at the top of the file. 1066 1085 */ 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 } 1086 uint_t vbi_revision_level = 5; 1087 1088 void * 1089 vbi_lowmem_alloc(uint64_t phys, size_t size) 1090 { 1091 return (vbi_internal_alloc(&phys, size, 0)); 1092 } 1093 1094 void 1095 vbi_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 310 310 /* end of interfaces defined for version 4 */ 311 311 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 */ 324 extern 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 */ 330 extern void vbi_lowmem_free(void *va, size_t size); 331 /* end of interfaces defined for version 5 */ 332 312 333 #ifdef __cplusplus 313 334 }
Note:
See TracChangeset
for help on using the changeset viewer.