Lines Matching refs:devid
103 u16 devid; member
121 u16 devid; member
139 u16 devid; member
279 static inline void update_last_devid(u16 devid) in update_last_devid() argument
281 if (devid > amd_iommu_last_bdf) in update_last_devid()
282 amd_iommu_last_bdf = devid; in update_last_devid()
525 update_last_devid(dev->devid); in find_last_devid_from_ivhd()
845 static void set_dev_entry_bit(u16 devid, u8 bit) in set_dev_entry_bit() argument
850 amd_iommu_dev_table[devid].data[i] |= (1UL << _bit); in set_dev_entry_bit()
853 static int get_dev_entry_bit(u16 devid, u8 bit) in get_dev_entry_bit() argument
858 return (amd_iommu_dev_table[devid].data[i] & (1UL << _bit)) >> _bit; in get_dev_entry_bit()
866 u32 lo, hi, devid, old_devtb_size; in copy_device_table() local
924 for (devid = 0; devid <= amd_iommu_last_bdf; ++devid) { in copy_device_table()
925 old_dev_tbl_cpy[devid] = old_devtb[devid]; in copy_device_table()
926 dom_id = old_devtb[devid].data[1] & DEV_DOMID_MASK; in copy_device_table()
927 dte_v = old_devtb[devid].data[0] & DTE_FLAG_V; in copy_device_table()
930 old_dev_tbl_cpy[devid].data[0] = old_devtb[devid].data[0]; in copy_device_table()
931 old_dev_tbl_cpy[devid].data[1] = old_devtb[devid].data[1]; in copy_device_table()
934 if (old_devtb[devid].data[0] & DTE_FLAG_GV) { in copy_device_table()
937 old_dev_tbl_cpy[devid].data[1] &= ~tmp; in copy_device_table()
940 old_dev_tbl_cpy[devid].data[0] &= ~tmp; in copy_device_table()
944 irq_v = old_devtb[devid].data[2] & DTE_IRQ_REMAP_ENABLE; in copy_device_table()
945 int_ctl = old_devtb[devid].data[2] & DTE_IRQ_REMAP_INTCTL_MASK; in copy_device_table()
946 int_tab_len = old_devtb[devid].data[2] & DTE_IRQ_TABLE_LEN_MASK; in copy_device_table()
950 pr_err("Wrong old irq remapping flag: %#x\n", devid); in copy_device_table()
954 old_dev_tbl_cpy[devid].data[2] = old_devtb[devid].data[2]; in copy_device_table()
962 void amd_iommu_apply_erratum_63(u16 devid) in amd_iommu_apply_erratum_63() argument
966 sysmgt = get_dev_entry_bit(devid, DEV_ENTRY_SYSMGT1) | in amd_iommu_apply_erratum_63()
967 (get_dev_entry_bit(devid, DEV_ENTRY_SYSMGT2) << 1); in amd_iommu_apply_erratum_63()
970 set_dev_entry_bit(devid, DEV_ENTRY_IW); in amd_iommu_apply_erratum_63()
974 static void __init set_iommu_for_device(struct amd_iommu *iommu, u16 devid) in set_iommu_for_device() argument
976 amd_iommu_rlookup_table[devid] = iommu; in set_iommu_for_device()
984 u16 devid, u32 flags, u32 ext_flags) in set_dev_entry_from_acpi() argument
987 set_dev_entry_bit(devid, DEV_ENTRY_INIT_PASS); in set_dev_entry_from_acpi()
989 set_dev_entry_bit(devid, DEV_ENTRY_EINT_PASS); in set_dev_entry_from_acpi()
991 set_dev_entry_bit(devid, DEV_ENTRY_NMI_PASS); in set_dev_entry_from_acpi()
993 set_dev_entry_bit(devid, DEV_ENTRY_SYSMGT1); in set_dev_entry_from_acpi()
995 set_dev_entry_bit(devid, DEV_ENTRY_SYSMGT2); in set_dev_entry_from_acpi()
997 set_dev_entry_bit(devid, DEV_ENTRY_LINT0_PASS); in set_dev_entry_from_acpi()
999 set_dev_entry_bit(devid, DEV_ENTRY_LINT1_PASS); in set_dev_entry_from_acpi()
1001 amd_iommu_apply_erratum_63(devid); in set_dev_entry_from_acpi()
1003 set_iommu_for_device(iommu, devid); in set_dev_entry_from_acpi()
1006 int __init add_special_device(u8 type, u8 id, u16 *devid, bool cmd_line) in add_special_device() argument
1025 *devid = entry->devid; in add_special_device()
1035 entry->devid = *devid; in add_special_device()
1043 static int __init add_acpi_hid_device(u8 *hid, u8 *uid, u16 *devid, in add_acpi_hid_device() argument
1057 *devid = entry->devid; in add_acpi_hid_device()
1067 entry->devid = *devid; in add_acpi_hid_device()
1069 entry->root_devid = (entry->devid & (~0x7)); in add_acpi_hid_device()
1086 &early_ioapic_map[i].devid, in add_early_maps()
1095 &early_hpet_map[i].devid, in add_early_maps()
1104 &early_acpihid_map[i].devid, in add_early_maps()
1117 static void __init set_device_exclusion_range(u16 devid, struct ivmd_header *m) in set_device_exclusion_range() argument
1119 struct amd_iommu *iommu = amd_iommu_rlookup_table[devid]; in set_device_exclusion_range()
1130 set_dev_entry_bit(devid, DEV_ENTRY_EX); in set_device_exclusion_range()
1145 u16 devid = 0, devid_start = 0, devid_to = 0; in init_iommu_from_acpi() local
1192 PCI_BUS_NUM(e->devid), in init_iommu_from_acpi()
1193 PCI_SLOT(e->devid), in init_iommu_from_acpi()
1194 PCI_FUNC(e->devid), in init_iommu_from_acpi()
1197 devid = e->devid; in init_iommu_from_acpi()
1198 set_dev_entry_from_acpi(iommu, devid, e->flags, 0); in init_iommu_from_acpi()
1204 PCI_BUS_NUM(e->devid), in init_iommu_from_acpi()
1205 PCI_SLOT(e->devid), in init_iommu_from_acpi()
1206 PCI_FUNC(e->devid), in init_iommu_from_acpi()
1209 devid_start = e->devid; in init_iommu_from_acpi()
1218 PCI_BUS_NUM(e->devid), in init_iommu_from_acpi()
1219 PCI_SLOT(e->devid), in init_iommu_from_acpi()
1220 PCI_FUNC(e->devid), in init_iommu_from_acpi()
1226 devid = e->devid; in init_iommu_from_acpi()
1228 set_dev_entry_from_acpi(iommu, devid , e->flags, 0); in init_iommu_from_acpi()
1230 amd_iommu_alias_table[devid] = devid_to; in init_iommu_from_acpi()
1237 PCI_BUS_NUM(e->devid), in init_iommu_from_acpi()
1238 PCI_SLOT(e->devid), in init_iommu_from_acpi()
1239 PCI_FUNC(e->devid), in init_iommu_from_acpi()
1245 devid_start = e->devid; in init_iommu_from_acpi()
1255 PCI_BUS_NUM(e->devid), in init_iommu_from_acpi()
1256 PCI_SLOT(e->devid), in init_iommu_from_acpi()
1257 PCI_FUNC(e->devid), in init_iommu_from_acpi()
1260 devid = e->devid; in init_iommu_from_acpi()
1261 set_dev_entry_from_acpi(iommu, devid, e->flags, in init_iommu_from_acpi()
1268 PCI_BUS_NUM(e->devid), in init_iommu_from_acpi()
1269 PCI_SLOT(e->devid), in init_iommu_from_acpi()
1270 PCI_FUNC(e->devid), in init_iommu_from_acpi()
1273 devid_start = e->devid; in init_iommu_from_acpi()
1281 PCI_BUS_NUM(e->devid), in init_iommu_from_acpi()
1282 PCI_SLOT(e->devid), in init_iommu_from_acpi()
1283 PCI_FUNC(e->devid)); in init_iommu_from_acpi()
1285 devid = e->devid; in init_iommu_from_acpi()
1286 for (dev_i = devid_start; dev_i <= devid; ++dev_i) { in init_iommu_from_acpi()
1299 u16 devid; in init_iommu_from_acpi() local
1303 devid = (e->ext >> 8) & 0xffff; in init_iommu_from_acpi()
1315 PCI_BUS_NUM(devid), in init_iommu_from_acpi()
1316 PCI_SLOT(devid), in init_iommu_from_acpi()
1317 PCI_FUNC(devid)); in init_iommu_from_acpi()
1319 ret = add_special_device(type, handle, &devid, false); in init_iommu_from_acpi()
1328 set_dev_entry_from_acpi(iommu, devid, e->flags, 0); in init_iommu_from_acpi()
1333 u16 devid; in init_iommu_from_acpi() local
1374 devid = e->devid; in init_iommu_from_acpi()
1377 PCI_BUS_NUM(devid), in init_iommu_from_acpi()
1378 PCI_SLOT(devid), in init_iommu_from_acpi()
1379 PCI_FUNC(devid)); in init_iommu_from_acpi()
1383 ret = add_acpi_hid_device(hid, uid, &devid, false); in init_iommu_from_acpi()
1392 set_dev_entry_from_acpi(iommu, devid, e->flags, 0); in init_iommu_from_acpi()
1510 iommu->devid = h->devid; in init_iommu_one()
1579 amd_iommu_rlookup_table[iommu->devid] = NULL; in init_iommu_one()
1596 u16 devid = ivhd->devid; in get_highest_supported_ivhd_type() local
1602 if (ivhd->devid == devid) in get_highest_supported_ivhd_type()
1630 PCI_BUS_NUM(h->devid), PCI_SLOT(h->devid), in init_iommu_all()
1631 PCI_FUNC(h->devid), h->cap_ptr, in init_iommu_all()
1721 iommu->dev = pci_get_domain_bus_and_slot(0, PCI_BUS_NUM(iommu->devid), in iommu_init_pci()
1722 iommu->devid & 0xff); in iommu_init_pci()
2003 iommu->devid, iommu->dev->irq); in iommu_init_intcapxt()
2067 set_device_exclusion_range(m->devid, m); in init_exclusion_range()
2074 for (i = m->devid; i <= m->aux; ++i) in init_exclusion_range()
2103 e->devid_start = e->devid_end = m->devid; in init_unity_map_range()
2112 e->devid_start = m->devid; in init_unity_map_range()
2157 u32 devid; in init_device_table_dma() local
2159 for (devid = 0; devid <= amd_iommu_last_bdf; ++devid) { in init_device_table_dma()
2160 set_dev_entry_bit(devid, DEV_ENTRY_VALID); in init_device_table_dma()
2161 set_dev_entry_bit(devid, DEV_ENTRY_TRANSLATION); in init_device_table_dma()
2167 u32 devid; in uninit_device_table_dma() local
2169 for (devid = 0; devid <= amd_iommu_last_bdf; ++devid) { in uninit_device_table_dma()
2170 amd_iommu_dev_table[devid].data[0] = 0ULL; in uninit_device_table_dma()
2171 amd_iommu_dev_table[devid].data[1] = 0ULL; in uninit_device_table_dma()
2177 u32 devid; in init_device_table() local
2182 for (devid = 0; devid <= amd_iommu_last_bdf; ++devid) in init_device_table()
2183 set_dev_entry_bit(devid, DEV_ENTRY_IRQ_TBL_EN); in init_device_table()
2447 int devid, id = mpc_ioapic_id(idx); in check_ioapic_information() local
2449 devid = get_ioapic_devid(id); in check_ioapic_information()
2450 if (devid < 0) { in check_ioapic_information()
2454 } else if (devid == IOAPIC_SB_DEVID) { in check_ioapic_information()
2950 u16 devid; in parse_ivrs_ioapic() local
2965 devid = ((bus & 0xff) << 8) | ((dev & 0x1f) << 3) | (fn & 0x7); in parse_ivrs_ioapic()
2970 early_ioapic_map[i].devid = devid; in parse_ivrs_ioapic()
2980 u16 devid; in parse_ivrs_hpet() local
2995 devid = ((bus & 0xff) << 8) | ((dev & 0x1f) << 3) | (fn & 0x7); in parse_ivrs_hpet()
3000 early_hpet_map[i].devid = devid; in parse_ivrs_hpet()
3031 early_acpihid_map[i].devid = in parse_ivrs_acpihid()