/*ARGSUSED*/ int gfxp_devmap_umem_setup(devmap_cookie_t dhc, dev_info_t *dip, struct devmap_callback_ctl *callbackops, ddi_umem_cookie_t cookie, offset_t off, size_t len, uint_t maxprot, uint_t flags, ddi_device_acc_attr_t *accattrp) { uint_t l_flags = flags & ~IOMEM_DATA_MASK; /* clear cache attrs */ int e; /* * Set an appropriate attribute from devacc_attr_dataorder * to keep compatibility. The cache attributes are igonred * if specified. */ if (accattrp != NULL) { if (accattrp->devacc_attr_dataorder == DDI_STRICTORDER_ACC) { l_flags |= IOMEM_DATA_UNCACHED; } else if (accattrp->devacc_attr_dataorder == DDI_MERGING_OK_ACC) { l_flags |= IOMEM_DATA_UC_WR_COMBINE; } else { l_flags |= IOMEM_DATA_CACHED; } } e = devmap_umem_setup(dhc, dip, callbackops, cookie, off, len, maxprot, l_flags, accattrp); return (e); }
/*ARGSUSED*/ static int xpvtap_devmap(dev_t dev, devmap_cookie_t dhp, offset_t off, size_t len, size_t *maplen, uint_t model) { xpvtap_user_ring_t *usring; xpvtap_state_t *state; int instance; int e; instance = getminor(dev); state = ddi_get_soft_state(xpvtap_statep, instance); if (state == NULL) { return (EBADF); } /* we should only get here if the offset was == 0 */ if (off != 0) { return (EINVAL); } /* we should only be mapping in one page */ if (len != PAGESIZE) { return (EINVAL); } /* * we already allocated the user ring during driver attach, all we * need to do is map it into the user app's VA. */ usring = &state->bt_user_ring; e = devmap_umem_setup(dhp, state->bt_dip, NULL, usring->ur_cookie, 0, PAGESIZE, PROT_ALL, DEVMAP_DEFAULTS, NULL); if (e < 0) { return (e); } /* return the size to compete the devmap */ *maplen = PAGESIZE; return (0); }