Lines Matching refs:immu_devi

78 static void destroy_immu_devi(immu_devi_t *immu_devi);
186 bdf_domain_lookup(immu_devi_t *immu_devi)
189 int16_t seg = immu_devi->imd_seg;
190 int16_t bus = immu_devi->imd_bus;
191 int16_t devfunc = immu_devi->imd_devfunc;
210 bdf_domain_insert(immu_devi_t *immu_devi, domain_t *domain)
212 int16_t seg = immu_devi->imd_seg;
213 int16_t bus = immu_devi->imd_bus;
214 int16_t devfunc = immu_devi->imd_devfunc;
227 immu_devi_t *immu_devi;
234 immu_devi = list_head(dvap->dva_list);
235 for (; immu_devi; immu_devi = list_next(dvap->dva_list,
236 immu_devi)) {
237 if (immu_devi->imd_dip == pdip) {
251 immu_devi_t *immu_devi;
253 immu_devi = IMMU_DEVI(dip);
254 if (immu_devi->imd_display == B_TRUE) {
256 } else if (immu_devi->imd_lpc == B_TRUE) {
262 list_insert_head(spclist, immu_devi);
268 * Set the immu_devi struct in the immu_devi field of a devinfo node
275 immu_devi_t *immu_devi;
277 immu_devi = immu_devi_get(dip);
278 if (immu_devi != NULL) {
285 * Assume a new immu_devi struct is needed
290 * We still need to create a immu_devi struct
300 ddi_err(DER_WARN, dip, "Failed to create immu_devi "
306 * Check if some other thread allocated a immu_devi while we
348 immu_devi_t *immu_devi;
355 immu_devi = NULL;
360 immu_devi = list_head(list_gfx);
365 if (immu_devi == NULL) {
372 ddi_node_name(immu_devi->imd_dip));
374 return (immu_devi->imd_dip);
613 immu_devi_t *immu_devi;
618 * If yes, then it will be stashed in immu_devi struct.
620 immu_devi = immu_devi_get(dip);
621 if (immu_devi == NULL) {
628 "No immu_devi structure");
631 immu_devi = immu_devi_get(dip);
635 if (immu_devi->imd_immu) {
636 immu = immu_devi->imd_immu;
653 immu_devi = immu_devi_get(dip);
654 /* immu_devi should be present as we found it earlier */
655 if (immu_devi == NULL) {
657 "immu_dvma_get_immu: No immu_devi structure");
662 if (immu_devi->imd_immu == NULL) {
664 immu_devi->imd_immu = immu;
671 if (immu_devi->imd_immu != immu) {
675 (void *)immu_devi->imd_immu);
689 * Allocate a immu_devi structure and initialize it
697 immu_devi_t *immu_devi;
708 immu_devi = kmem_zalloc(sizeof (immu_devi_t), kmflags);
709 if (immu_devi == NULL) {
711 "Intel IOMMU immu_devi structure");
714 immu_devi->imd_dip = rdip;
715 immu_devi->imd_seg = 0; /* Currently seg can only be 0 */
716 immu_devi->imd_bus = bus;
717 immu_devi->imd_pcib_type = IMMU_PCIB_BAD;
720 immu_devi->imd_pcib_type = IMMU_PCIB_NOBDF;
721 return (immu_devi);
724 immu_devi->imd_devfunc = IMMU_PCI_DEVFUNC(dev, func);
725 immu_devi->imd_sec = 0;
726 immu_devi->imd_sub = 0;
736 immu_devi->imd_sec = pci_getb_func(bus, dev, func,
738 immu_devi->imd_sub = pci_getb_func(bus, dev, func,
743 immu_devi->imd_pcib_type = IMMU_PCIB_PCIE_PCI;
745 immu_devi->imd_pcib_type = IMMU_PCIB_PCIE_PCIE;
747 immu_devi->imd_pcib_type = IMMU_PCIB_PCI_PCI;
750 immu_devi->imd_pcib_type = IMMU_PCIB_ENDPOINT;
754 immu_devi->imd_display = device_is_display(classcode);
755 immu_devi->imd_lpc = ((baseclass == PCI_CLASS_BRIDGE) &&
757 immu_devi->imd_use_premap = device_use_premap(classcode);
759 immu_devi->imd_domain = NULL;
761 immu_devi->imd_dvma_flags = immu_global_dvma_flags;
763 return (immu_devi);
767 destroy_immu_devi(immu_devi_t *immu_devi)
769 kmem_free(immu_devi, sizeof (immu_devi_t));
775 immu_devi_t *immu_devi;
781 immu_devi = immu_devi_get(rdip);
782 if (immu_devi == NULL) {
787 domain = immu_devi->imd_domain;
788 ddip = immu_devi->imd_ddip;
828 immu_devi_t *immu_devi;
842 /* immu_devi may not be set. */
843 immu_devi = immu_devi_get(pdip);
844 if (immu_devi == NULL) {
851 immu_devi = immu_devi_get(pdip);
852 immu = immu_devi->imd_immu;
863 immu_devi->imd_pcib_type == IMMU_PCIB_PCIE_PCIE) {
871 if (immu_devi->imd_pcib_type != IMMU_PCIB_BAD &&
872 immu_devi->imd_pcib_type != IMMU_PCIB_NOBDF) {
873 ASSERT(immu_devi->imd_bus >= 0);
874 ASSERT(immu_devi->imd_devfunc >= 0);
878 if (immu_devi->imd_display == B_TRUE ||
886 domain = immu_devi->imd_domain;
887 ddip = immu_devi->imd_ddip;
905 /* domain is not set in either immu_devi or dvp */
906 domain = bdf_domain_lookup(immu_devi);
913 /* Grab lock again to check if something else set immu_devi fields */
915 if (immu_devi->imd_domain != NULL) {
1133 immu_devi_t *immu_devi;
1137 immu_devi = immu_devi_get(dip);
1140 fddip = immu_devi->imd_ddip;
1141 fdomain = immu_devi->imd_domain;
1146 immu_devi->imd_ddip = ddip;
1152 immu_devi->imd_domain = domain;
1163 * Local domains may be shared or immu_devi, although the
1168 * immu_devi a domain may be either UNITY or translation (XLATE) domain.
1227 * (i.e. ddip) will also be found in the same immu_devi struct.
1318 immu_devi_t *immu_devi;
1323 immu_devi = immu_devi_get(rdip);
1387 bdf_domain_insert(immu_devi, domain);
1616 immu_devi_t *immu_devi;
1619 immu_devi = immu_devi_get(dip);
1621 if (immu_devi->imd_pcib_type == IMMU_PCIB_PCI_PCI) {
1651 * To do that we need the immu_devi field.
1652 * Set the immu_devi field (if not already set)
1656 "immu_context_update: failed to set immu_devi for ddip");
1662 "immu_context_update: failed to set immu_devi for rdip");
2987 immu_devi_t *immu_devi;
2991 immu_devi = (immu_devi_t *)(uintptr_t)atomic_or_64_nv((uint64_t *)vptr,
2993 return (immu_devi);
3014 immu_devi_t *immu_devi;
3037 immu_devi = IMMU_DEVI(dip);
3043 if (immu_devi->imd_domain->dom_did == IMMU_UNITY_DID)
3046 if (immu_devi->imd_immu->immu_dip == iommulib_iommu_getdip(handle))