Lines Matching refs:devid
109 u16 devid; member
127 u16 devid; member
145 u16 devid; member
291 static inline void update_last_devid(u16 devid) in update_last_devid() argument
293 if (devid > amd_iommu_last_bdf) in update_last_devid()
294 amd_iommu_last_bdf = devid; in update_last_devid()
534 update_last_devid(dev->devid); in find_last_devid_from_ivhd()
853 static void set_dev_entry_bit(u16 devid, u8 bit) in set_dev_entry_bit() argument
858 amd_iommu_dev_table[devid].data[i] |= (1UL << _bit); in set_dev_entry_bit()
861 static int get_dev_entry_bit(u16 devid, u8 bit) in get_dev_entry_bit() argument
866 return (amd_iommu_dev_table[devid].data[i] & (1UL << _bit)) >> _bit; in get_dev_entry_bit()
874 u32 lo, hi, devid, old_devtb_size; in copy_device_table() local
922 for (devid = 0; devid <= amd_iommu_last_bdf; ++devid) { in copy_device_table()
923 old_dev_tbl_cpy[devid] = old_devtb[devid]; in copy_device_table()
924 dom_id = old_devtb[devid].data[1] & DEV_DOMID_MASK; in copy_device_table()
925 dte_v = old_devtb[devid].data[0] & DTE_FLAG_V; in copy_device_table()
928 old_dev_tbl_cpy[devid].data[0] = old_devtb[devid].data[0]; in copy_device_table()
929 old_dev_tbl_cpy[devid].data[1] = old_devtb[devid].data[1]; in copy_device_table()
932 if (old_devtb[devid].data[0] & DTE_FLAG_GV) { in copy_device_table()
935 old_dev_tbl_cpy[devid].data[1] &= ~tmp; in copy_device_table()
938 old_dev_tbl_cpy[devid].data[0] &= ~tmp; in copy_device_table()
942 irq_v = old_devtb[devid].data[2] & DTE_IRQ_REMAP_ENABLE; in copy_device_table()
943 int_ctl = old_devtb[devid].data[2] & DTE_IRQ_REMAP_INTCTL_MASK; in copy_device_table()
944 int_tab_len = old_devtb[devid].data[2] & DTE_IRQ_TABLE_LEN_MASK; in copy_device_table()
948 pr_err("Wrong old irq remapping flag: %#x\n", devid); in copy_device_table()
952 old_dev_tbl_cpy[devid].data[2] = old_devtb[devid].data[2]; in copy_device_table()
960 void amd_iommu_apply_erratum_63(u16 devid) in amd_iommu_apply_erratum_63() argument
964 sysmgt = get_dev_entry_bit(devid, DEV_ENTRY_SYSMGT1) | in amd_iommu_apply_erratum_63()
965 (get_dev_entry_bit(devid, DEV_ENTRY_SYSMGT2) << 1); in amd_iommu_apply_erratum_63()
968 set_dev_entry_bit(devid, DEV_ENTRY_IW); in amd_iommu_apply_erratum_63()
972 static void __init set_iommu_for_device(struct amd_iommu *iommu, u16 devid) in set_iommu_for_device() argument
974 amd_iommu_rlookup_table[devid] = iommu; in set_iommu_for_device()
982 u16 devid, u32 flags, u32 ext_flags) in set_dev_entry_from_acpi() argument
985 set_dev_entry_bit(devid, DEV_ENTRY_INIT_PASS); in set_dev_entry_from_acpi()
987 set_dev_entry_bit(devid, DEV_ENTRY_EINT_PASS); in set_dev_entry_from_acpi()
989 set_dev_entry_bit(devid, DEV_ENTRY_NMI_PASS); in set_dev_entry_from_acpi()
991 set_dev_entry_bit(devid, DEV_ENTRY_SYSMGT1); in set_dev_entry_from_acpi()
993 set_dev_entry_bit(devid, DEV_ENTRY_SYSMGT2); in set_dev_entry_from_acpi()
995 set_dev_entry_bit(devid, DEV_ENTRY_LINT0_PASS); in set_dev_entry_from_acpi()
997 set_dev_entry_bit(devid, DEV_ENTRY_LINT1_PASS); in set_dev_entry_from_acpi()
999 amd_iommu_apply_erratum_63(devid); in set_dev_entry_from_acpi()
1001 set_iommu_for_device(iommu, devid); in set_dev_entry_from_acpi()
1004 static int __init add_special_device(u8 type, u8 id, u16 *devid, bool cmd_line) in add_special_device() argument
1023 *devid = entry->devid; in add_special_device()
1033 entry->devid = *devid; in add_special_device()
1041 static int __init add_acpi_hid_device(u8 *hid, u8 *uid, u16 *devid, in add_acpi_hid_device() argument
1055 *devid = entry->devid; in add_acpi_hid_device()
1065 entry->devid = *devid; in add_acpi_hid_device()
1067 entry->root_devid = (entry->devid & (~0x7)); in add_acpi_hid_device()
1084 &early_ioapic_map[i].devid, in add_early_maps()
1093 &early_hpet_map[i].devid, in add_early_maps()
1102 &early_acpihid_map[i].devid, in add_early_maps()
1115 static void __init set_device_exclusion_range(u16 devid, struct ivmd_header *m) in set_device_exclusion_range() argument
1117 struct amd_iommu *iommu = amd_iommu_rlookup_table[devid]; in set_device_exclusion_range()
1128 set_dev_entry_bit(devid, DEV_ENTRY_EX); in set_device_exclusion_range()
1143 u16 devid = 0, devid_start = 0, devid_to = 0; in init_iommu_from_acpi() local
1188 PCI_BUS_NUM(e->devid), in init_iommu_from_acpi()
1189 PCI_SLOT(e->devid), in init_iommu_from_acpi()
1190 PCI_FUNC(e->devid), in init_iommu_from_acpi()
1193 devid = e->devid; in init_iommu_from_acpi()
1194 set_dev_entry_from_acpi(iommu, devid, e->flags, 0); in init_iommu_from_acpi()
1200 PCI_BUS_NUM(e->devid), in init_iommu_from_acpi()
1201 PCI_SLOT(e->devid), in init_iommu_from_acpi()
1202 PCI_FUNC(e->devid), in init_iommu_from_acpi()
1205 devid_start = e->devid; in init_iommu_from_acpi()
1214 PCI_BUS_NUM(e->devid), in init_iommu_from_acpi()
1215 PCI_SLOT(e->devid), in init_iommu_from_acpi()
1216 PCI_FUNC(e->devid), in init_iommu_from_acpi()
1222 devid = e->devid; in init_iommu_from_acpi()
1224 set_dev_entry_from_acpi(iommu, devid , e->flags, 0); in init_iommu_from_acpi()
1226 amd_iommu_alias_table[devid] = devid_to; in init_iommu_from_acpi()
1233 PCI_BUS_NUM(e->devid), in init_iommu_from_acpi()
1234 PCI_SLOT(e->devid), in init_iommu_from_acpi()
1235 PCI_FUNC(e->devid), in init_iommu_from_acpi()
1241 devid_start = e->devid; in init_iommu_from_acpi()
1251 PCI_BUS_NUM(e->devid), in init_iommu_from_acpi()
1252 PCI_SLOT(e->devid), in init_iommu_from_acpi()
1253 PCI_FUNC(e->devid), in init_iommu_from_acpi()
1256 devid = e->devid; in init_iommu_from_acpi()
1257 set_dev_entry_from_acpi(iommu, devid, e->flags, in init_iommu_from_acpi()
1264 PCI_BUS_NUM(e->devid), in init_iommu_from_acpi()
1265 PCI_SLOT(e->devid), in init_iommu_from_acpi()
1266 PCI_FUNC(e->devid), in init_iommu_from_acpi()
1269 devid_start = e->devid; in init_iommu_from_acpi()
1277 PCI_BUS_NUM(e->devid), in init_iommu_from_acpi()
1278 PCI_SLOT(e->devid), in init_iommu_from_acpi()
1279 PCI_FUNC(e->devid)); in init_iommu_from_acpi()
1281 devid = e->devid; in init_iommu_from_acpi()
1282 for (dev_i = devid_start; dev_i <= devid; ++dev_i) { in init_iommu_from_acpi()
1295 u16 devid; in init_iommu_from_acpi() local
1299 devid = (e->ext >> 8) & 0xffff; in init_iommu_from_acpi()
1311 PCI_BUS_NUM(devid), in init_iommu_from_acpi()
1312 PCI_SLOT(devid), in init_iommu_from_acpi()
1313 PCI_FUNC(devid)); in init_iommu_from_acpi()
1315 ret = add_special_device(type, handle, &devid, false); in init_iommu_from_acpi()
1324 set_dev_entry_from_acpi(iommu, devid, e->flags, 0); in init_iommu_from_acpi()
1329 u16 devid; in init_iommu_from_acpi() local
1370 devid = e->devid; in init_iommu_from_acpi()
1373 PCI_BUS_NUM(devid), in init_iommu_from_acpi()
1374 PCI_SLOT(devid), in init_iommu_from_acpi()
1375 PCI_FUNC(devid)); in init_iommu_from_acpi()
1379 ret = add_acpi_hid_device(hid, uid, &devid, false); in init_iommu_from_acpi()
1388 set_dev_entry_from_acpi(iommu, devid, e->flags, 0); in init_iommu_from_acpi()
1508 iommu->devid = h->devid; in init_iommu_one()
1577 amd_iommu_rlookup_table[iommu->devid] = NULL; in init_iommu_one()
1594 u16 devid = ivhd->devid; in get_highest_supported_ivhd_type() local
1600 if (ivhd->devid == devid) in get_highest_supported_ivhd_type()
1628 PCI_BUS_NUM(h->devid), PCI_SLOT(h->devid), in init_iommu_all()
1629 PCI_FUNC(h->devid), h->cap_ptr, in init_iommu_all()
1718 iommu->dev = pci_get_domain_bus_and_slot(0, PCI_BUS_NUM(iommu->devid), in iommu_init_pci()
1719 iommu->devid & 0xff); in iommu_init_pci()
1976 set_device_exclusion_range(m->devid, m); in init_exclusion_range()
1983 for (i = m->devid; i <= m->aux; ++i) in init_exclusion_range()
2009 e->devid_start = e->devid_end = m->devid; in init_unity_map_range()
2018 e->devid_start = m->devid; in init_unity_map_range()
2065 u32 devid; in init_device_table_dma() local
2067 for (devid = 0; devid <= amd_iommu_last_bdf; ++devid) { in init_device_table_dma()
2068 set_dev_entry_bit(devid, DEV_ENTRY_VALID); in init_device_table_dma()
2069 set_dev_entry_bit(devid, DEV_ENTRY_TRANSLATION); in init_device_table_dma()
2075 u32 devid; in uninit_device_table_dma() local
2077 for (devid = 0; devid <= amd_iommu_last_bdf; ++devid) { in uninit_device_table_dma()
2078 amd_iommu_dev_table[devid].data[0] = 0ULL; in uninit_device_table_dma()
2079 amd_iommu_dev_table[devid].data[1] = 0ULL; in uninit_device_table_dma()
2085 u32 devid; in init_device_table() local
2090 for (devid = 0; devid <= amd_iommu_last_bdf; ++devid) in init_device_table()
2091 set_dev_entry_bit(devid, DEV_ENTRY_IRQ_TBL_EN); in init_device_table()
2364 int devid, id = mpc_ioapic_id(idx); in check_ioapic_information() local
2366 devid = get_ioapic_devid(id); in check_ioapic_information()
2367 if (devid < 0) { in check_ioapic_information()
2371 } else if (devid == IOAPIC_SB_DEVID) { in check_ioapic_information()
2860 u16 devid; in parse_ivrs_ioapic() local
2875 devid = ((bus & 0xff) << 8) | ((dev & 0x1f) << 3) | (fn & 0x7); in parse_ivrs_ioapic()
2880 early_ioapic_map[i].devid = devid; in parse_ivrs_ioapic()
2890 u16 devid; in parse_ivrs_hpet() local
2905 devid = ((bus & 0xff) << 8) | ((dev & 0x1f) << 3) | (fn & 0x7); in parse_ivrs_hpet()
2910 early_hpet_map[i].devid = devid; in parse_ivrs_hpet()
2941 early_acpihid_map[i].devid = in parse_ivrs_acpihid()