Files
@ d0a14f973771
Branch filter:
Location: vmkdrivers/BLD/build/HEADERS/vmkapi-current-all-public/vmkernel64/release/core/vmkapi_memdefs.h
d0a14f973771
7.5 KiB
text/x-chdr
ESXi-5.0-U1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 | /* **********************************************************
* Copyright 2010 VMware, Inc. All rights reserved.
* **********************************************************/
/*
* @VMKAPIMOD_LICENSE@
*/
/*
*****************************************************************************
* Memory Types and Definitions */ /**
*
* \addtogroup Core
* @{
* \defgroup MemDefs Memory Types and Definitions
* @{
*****************************************************************************
*/
#ifndef _VMKAPI_CORE_MEMDEFS_H_
#define _VMKAPI_CORE_MEMDEFS_H_
/** \cond never */
#ifndef VMK_HEADER_INCLUDED_FROM_VMKAPI_H
#error This vmkapi file should never be included directly but only via vmkapi.h
#endif
/** \endcond never */
typedef vmk_uint64 vmk_PageAddress;
typedef vmk_uint64 vmk_PageNumber;
/**
* \brief Machine Address
*/
typedef vmk_PageAddress vmk_MA;
/**
* \brief Page number of a machine page.
*
* The machine page number is obtained by cutting the page offset from a page
* address (machine page address >> page offset)
*/
typedef vmk_PageNumber vmk_MPN;
/**
* \brief Guaranteed invalid machine page.
*/
#define VMK_INVALID_MPN ((vmk_MPN)-1)
/**
* \brief Virtual Address
*/
typedef vmk_PageAddress vmk_VA;
/**
* \brief Page Number of a virtual page.
*
* The virtual page number is obtained by cutting the page offset from a page
* address (virtual page address >> page offset)
*/
typedef vmk_PageNumber vmk_VPN;
/**
* \brief Guaranteed invalid virtual page.
*/
#define VMK_INVALID_VPN ((vmk_VPN)-1)
/**
* \brief An address translated through an IOMMU for a device.
*
* This represents the address a device would use to access
* main-memory using DMA where the address is translated through
* an IOMMU. Systems without an IOMMU may still make use of this
* address type to represent addresses presented to devices
* for DMA.
*
* \note This is <b>not</b> the same as an IO-port address.
*/
typedef vmk_PageAddress vmk_IOA;
/**
* \brief Page number of an IO page.
*/
typedef vmk_PageNumber vmk_IOPN;
/**
* \brief Abstract address
*/
typedef union {
vmk_VA addr;
void *ptr;
} vmk_AddrCookie __attribute__ ((__transparent_union__));
/**
* \brief A collection of possible address types.
*/
typedef enum vmk_AddressType {
VMK_ADDRESS_TYPE_NONE=0,
VMK_ADDRESS_TYPE_UNKNOWN=1,
VMK_ADDRESS_TYPE_VIRTUAL=2,
VMK_ADDRESS_TYPE_MACHINE=3,
VMK_ADDRESS_TYPE_IO=4,
} vmk_AddressType;
/*
* Common address mask values
*/
#define VMK_ADDRESS_MASK_64BIT (~(VMK_CONST64U(0)))
#define VMK_ADDRESS_MASK_39BIT ((VMK_CONST64U(1) << 39) - VMK_CONST64U(1))
#define VMK_ADDRESS_MASK_32BIT ((VMK_CONST64U(1) << 32) - VMK_CONST64U(1))
#define VMK_ADDRESS_MASK_31BIT ((VMK_CONST64U(1) << 31) - VMK_CONST64U(1))
/**
* \brief Physical contiguity property for memory allocators.
*/
typedef enum vmk_MemPhysContiguity {
/** \brief All allocations will be physically contiguous. */
VMK_MEM_PHYS_CONTIGUOUS,
/** \brief Allocations may not be physically contiguous. */
VMK_MEM_PHYS_ANY_CONTIGUITY,
/** \brief Allocations will be physically discontiguous. */
VMK_MEM_PHYS_DISCONTIGUOUS,
} vmk_MemPhysContiguity;
/**
* \brief Address range restrictions for memory allocators.
*/
typedef enum vmk_MemPhysAddrConstraint {
/** \brief Allocate memory without any address restrictions.
*
* This memory range should be used for all allocations that do not have
* device-specific constraints.
*/
VMK_PHYS_ADDR_ANY,
/**
* \brief Allocate memory below 2GB.
*
* Should be used sparingly, only when absolutely necessary for
* handling a device (never for general purpose use - even in a
* device driver).
*/
VMK_PHYS_ADDR_BELOW_2GB,
/**
* \brief Allocate memory below 4GB.
*
* Should be used sparingly, only when absolutely necessary for
* handling a device (never for general purpose use - even in a
* device driver).
*/
VMK_PHYS_ADDR_BELOW_4GB,
/**
* \brief Allocate memory below 512GB.
*
* Should be used sparingly, only when absolutely necessary for
* handling a device (never for general purpose use - even in a
* device driver).
*/
VMK_PHYS_ADDR_BELOW_512GB,
} vmk_MemPhysAddrConstraint;
/*
***********************************************************************
* vmk_MA2MPN -- */ /**
*
* \brief Convert a machine address into a machine page number.
*
* \param[in] ma Machine address to convert.
*
* \return Machine page number for the given machine address.
*
* \note This function will not block.
*
***********************************************************************
*/
static VMK_ALWAYS_INLINE vmk_MPN
vmk_MA2MPN(vmk_MA ma)
{
return (ma >> VMK_PAGE_SHIFT);
}
/*
***********************************************************************
* vmk_MPN2MA -- */ /**
*
* \brief Convert a machine page number into a machine address.
*
* \param[in] mpn Machine page number to convert.
*
* \return Machine page address for the given machine page number.
*
* \note This function will not block.
*
***********************************************************************
*/
static VMK_ALWAYS_INLINE vmk_MA
vmk_MPN2MA(vmk_MPN mpn)
{
return (mpn << VMK_PAGE_SHIFT);
}
/*
***********************************************************************
* vmk_VA2VPN -- */ /**
*
* \brief Convert a virtual address into a virtual page number.
*
* \param[in] va Virtual address to convert.
*
* \return Virtual page number for the given virtual address.
*
* \note This function will not block.
*
***********************************************************************
*/
static VMK_ALWAYS_INLINE vmk_VPN
vmk_VA2VPN(vmk_VA va)
{
return (va >> VMK_PAGE_SHIFT);
}
/*
***********************************************************************
* vmk_VPN2VA -- */ /**
*
* \brief Convert a virtual page number into a virtual address.
*
* \param[in] vpn Virtual page number to convert.
*
* \return Virtual page address for the given virtual page number.
*
* \note This function will not block.
*
***********************************************************************
*/
static VMK_ALWAYS_INLINE vmk_VA
vmk_VPN2VA(vmk_VPN vpn)
{
return (vpn << VMK_PAGE_SHIFT);
}
/*
***********************************************************************
* vmk_IOA2IOPN -- */ /**
*
* \brief Convert a IO address into a IO page number.
*
* \param[in] ioa IO address to convert.
*
* \return IO page number for the given IO address.
*
* \note This function will not block.
*
***********************************************************************
*/
static VMK_ALWAYS_INLINE vmk_IOPN
vmk_IOA2IOPN(vmk_IOA ioa)
{
return (ioa >> VMK_PAGE_SHIFT);
}
/*
***********************************************************************
* vmk_IOPN2IOA -- */ /**
*
* \brief Convert a IO page number into a IO address.
*
* \param[in] iopn IO page number to convert.
*
* \return IO page address for the given IO page number.
*
* \note This function will not block.
*
***********************************************************************
*/
static VMK_ALWAYS_INLINE vmk_IOA
vmk_IOPN2IOA(vmk_IOPN iopn)
{
return (iopn << VMK_PAGE_SHIFT);
}
#endif
/** @} */
/** @} */
|