342
343 /*
344 * Tests whether map2 is a subset of map1, returns 1 if
345 * this assertion is true.
346 */
347 #define SF_RGNMAP_IS_SUBSET(map1, map2, rval) { \
348 int _i; \
349 for (_i = 0; _i < SFMMU_RGNMAP_WORDS; _i++) { \
350 if (((map1)->bitmap[_i] & (map2)->bitmap[_i]) \
351 != (map2)->bitmap[_i]) { \
352 break; \
353 } \
354 } \
355 if (_i < SFMMU_RGNMAP_WORDS) \
356 rval = 0; \
357 else \
358 rval = 1; \
359 }
360
361 #define SF_SCD_INCR_REF(scdp) { \
362 atomic_add_32((volatile uint32_t *)&(scdp)->scd_refcnt, 1); \
363 }
364
365 #define SF_SCD_DECR_REF(srdp, scdp) { \
366 sf_region_map_t _scd_rmap = (scdp)->scd_region_map; \
367 if (!atomic_add_32_nv( \
368 (volatile uint32_t *)&(scdp)->scd_refcnt, -1)) { \
369 sfmmu_destroy_scd((srdp), (scdp), &_scd_rmap); \
370 } \
371 }
372
373 /*
374 * A sfmmup link in the link list of sfmmups that share the same region.
375 */
376 typedef struct sf_rgn_link {
377 sfmmu_t *next;
378 sfmmu_t *prev;
379 } sf_rgn_link_t;
380
381 /*
382 * rgn_flags values.
383 */
384 #define SFMMU_REGION_HME 0x1
385 #define SFMMU_REGION_ISM 0x2
386 #define SFMMU_REGION_FREE 0x8
387
388 #define SFMMU_REGION_TYPE_MASK (0x3)
|
342
343 /*
344 * Tests whether map2 is a subset of map1, returns 1 if
345 * this assertion is true.
346 */
347 #define SF_RGNMAP_IS_SUBSET(map1, map2, rval) { \
348 int _i; \
349 for (_i = 0; _i < SFMMU_RGNMAP_WORDS; _i++) { \
350 if (((map1)->bitmap[_i] & (map2)->bitmap[_i]) \
351 != (map2)->bitmap[_i]) { \
352 break; \
353 } \
354 } \
355 if (_i < SFMMU_RGNMAP_WORDS) \
356 rval = 0; \
357 else \
358 rval = 1; \
359 }
360
361 #define SF_SCD_INCR_REF(scdp) { \
362 atomic_inc_32((volatile uint32_t *)&(scdp)->scd_refcnt); \
363 }
364
365 #define SF_SCD_DECR_REF(srdp, scdp) { \
366 sf_region_map_t _scd_rmap = (scdp)->scd_region_map; \
367 if (!atomic_dec_32_nv((volatile uint32_t *)&(scdp)->scd_refcnt)) {\
368 sfmmu_destroy_scd((srdp), (scdp), &_scd_rmap); \
369 } \
370 }
371
372 /*
373 * A sfmmup link in the link list of sfmmups that share the same region.
374 */
375 typedef struct sf_rgn_link {
376 sfmmu_t *next;
377 sfmmu_t *prev;
378 } sf_rgn_link_t;
379
380 /*
381 * rgn_flags values.
382 */
383 #define SFMMU_REGION_HME 0x1
384 #define SFMMU_REGION_ISM 0x2
385 #define SFMMU_REGION_FREE 0x8
386
387 #define SFMMU_REGION_TYPE_MASK (0x3)
|