Lines Matching +full:ats +full:- +full:supported
1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
52 device_t *ivhd_devs; /* IVHD or AMD-Vi device list. */
77 if (ivrs->Header.Length == 0) { in ivrs_hdr_iterate_tbl()
82 end = (ACPI_IVRS_HEADER *)((char *)ivrs + ivrs->Header.Length); in ivrs_hdr_iterate_tbl()
85 if ((uint8_t *)ivrs_hdr + ivrs_hdr->Length > (uint8_t *)end) { in ivrs_hdr_iterate_tbl()
86 printf("AMD-Vi:IVHD/IVMD is corrupted, length : %d\n", in ivrs_hdr_iterate_tbl()
87 ivrs_hdr->Length); in ivrs_hdr_iterate_tbl()
91 switch (ivrs_hdr->Type) { in ivrs_hdr_iterate_tbl()
108 printf("AMD-Vi:Not IVHD/IVMD type(%d)", ivrs_hdr->Type); in ivrs_hdr_iterate_tbl()
112 ivrs_hdr->Length); in ivrs_hdr_iterate_tbl()
131 /* Count the number of AMD-Vi devices in the system. */
138 if (ivrs_is_ivhd(ivrs_he->Type)) in ivhd_count_iter()
155 if (ivrs_is_ivhd(ivrs_hdr->Type)) { in ivrs_hdr_find_iter()
156 if (fi->i == 0) { in ivrs_hdr_find_iter()
157 fi->ptr = ivrs_hdr; in ivrs_hdr_find_iter()
160 fi->i--; in ivrs_hdr_find_iter()
181 uint32_t end_id, uint8_t cfg, bool ats) in ivhd_dev_add_entry() argument
185 KASSERT(softc->dev_cfg_cap >= softc->dev_cfg_cnt, in ivhd_dev_add_entry()
187 if (softc->dev_cfg_cap == softc->dev_cfg_cnt) { in ivhd_dev_add_entry()
188 if (softc->dev_cfg_cap == 0) in ivhd_dev_add_entry()
189 softc->dev_cfg_cap = 1; in ivhd_dev_add_entry()
191 softc->dev_cfg_cap <<= 2; in ivhd_dev_add_entry()
192 softc->dev_cfg = realloc(softc->dev_cfg, in ivhd_dev_add_entry()
193 sizeof(*softc->dev_cfg) * softc->dev_cfg_cap, M_DEVBUF, in ivhd_dev_add_entry()
197 dev_cfg = &softc->dev_cfg[softc->dev_cfg_cnt++]; in ivhd_dev_add_entry()
198 dev_cfg->start_id = start_id; in ivhd_dev_add_entry()
199 dev_cfg->end_id = end_id; in ivhd_dev_add_entry()
200 dev_cfg->data = cfg; in ivhd_dev_add_entry()
201 dev_cfg->enable_ats = ats; in ivhd_dev_add_entry()
212 int range_start_id = -1, range_end_id = -1, i; in ivhd_dev_parse()
217 switch (ivhd->Header.Type) { in ivhd_dev_parse()
228 device_printf(softc->dev, in ivhd_dev_parse()
229 "unknown type: 0x%x\n", ivhd->Header.Type); in ivhd_dev_parse()
230 return (-1); in ivhd_dev_parse()
233 end = (uint8_t *)ivhd + ivhd->Header.Length; in ivhd_dev_parse()
237 switch (de->Type) { in ivhd_dev_parse()
239 all_data = de->DataSetting; in ivhd_dev_parse()
240 for (i = 0; i < softc->dev_cfg_cnt; i++) in ivhd_dev_parse()
241 softc->dev_cfg[i].data |= all_data; in ivhd_dev_parse()
248 if (de->Type == ACPI_IVRS_TYPE_EXT_SELECT) { in ivhd_dev_parse()
254 ivhd_dev_add_entry(softc, de->Id, de->Id, in ivhd_dev_parse()
255 de->DataSetting | all_data, enable_ats); in ivhd_dev_parse()
261 if (range_start_id != -1) { in ivhd_dev_parse()
262 device_printf(softc->dev, in ivhd_dev_parse()
263 "Unexpected start-of-range device entry\n"); in ivhd_dev_parse()
266 range_start_id = de->Id; in ivhd_dev_parse()
267 range_data = de->DataSetting; in ivhd_dev_parse()
268 if (de->Type == ACPI_IVRS_TYPE_EXT_START) { in ivhd_dev_parse()
277 if (range_start_id == -1) { in ivhd_dev_parse()
278 device_printf(softc->dev, in ivhd_dev_parse()
279 "Unexpected end-of-range device entry\n"); in ivhd_dev_parse()
282 range_end_id = de->Id; in ivhd_dev_parse()
284 device_printf(softc->dev, in ivhd_dev_parse()
290 range_start_id = range_end_id = -1; in ivhd_dev_parse()
302 if ((de->Type < 5) || in ivhd_dev_parse()
303 (de->Type >= ACPI_IVRS_TYPE_PAD8)) in ivhd_dev_parse()
304 device_printf(softc->dev, in ivhd_dev_parse()
305 "Unknown dev entry:0x%x\n", de->Type); in ivhd_dev_parse()
308 if (de->Type < 0x40) in ivhd_dev_parse()
310 else if (de->Type < 0x80) in ivhd_dev_parse()
313 printf("Variable size IVHD type 0x%x not supported\n", in ivhd_dev_parse()
314 de->Type); in ivhd_dev_parse()
325 if (old->DeviceId == new->DeviceId) { in ivhd_is_newer()
329 if (old->Type == IVRS_TYPE_HARDWARE_LEGACY && in ivhd_is_newer()
330 ((new->Type == IVRS_TYPE_HARDWARE_EFR) || in ivhd_is_newer()
331 (new->Type == IVRS_TYPE_HARDWARE_MIXED))) in ivhd_is_newer()
338 if (old->Type == IVRS_TYPE_HARDWARE_EFR && in ivhd_is_newer()
339 new->Type == IVRS_TYPE_HARDWARE_MIXED) in ivhd_is_newer()
362 if (ivrs->Header.Length == 0) { in ivhd_identify()
366 ivrs_ivinfo = ivrs->Info; in ivhd_identify()
367 printf("AMD-Vi: IVRS Info VAsize = %d PAsize = %d GVAsize = %d" in ivhd_identify()
384 * Scan for presence of legacy and non-legacy device type in ivhd_identify()
391 if (ivhd_is_newer(&ivhd_hdrs[j]->Header, &ivhd->Header)) in ivhd_identify()
407 * the Host-PCI bridge and the root PCI bus. in ivhd_identify()
419 printf("AMD-Vi: can't find ivhd%d\n", i); in ivhd_identify()
447 switch (ivhd->Header.Type) { in ivhd_probe()
449 device_set_desc(dev, "AMD-Vi/IOMMU ivhd with EFR"); in ivhd_probe()
453 device_set_desc(dev, "AMD-Vi/IOMMU ivhd in mixed format"); in ivhd_probe()
458 device_set_desc(dev, "AMD-Vi/IOMMU ivhd"); in ivhd_probe()
470 * been moved to EFR for non-legacy device. in ivhd_print_flag()
534 /* Fewer features or attributes are reported in non-legacy type. */ in ivhd_print_feature()
614 dev = softc->dev; in ivhd_print_cap()
616 ivhd_print_flag(dev, softc->ivhd_type, softc->ivhd_flag); in ivhd_print_cap()
617 ivhd_print_feature(dev, softc->ivhd_type, softc->ivhd_feature); in ivhd_print_cap()
618 ivhd_print_ext_feature(dev, softc->ext_feature); in ivhd_print_cap()
626 device_printf(softc->dev, "supported paging level:%d, will use only: %d\n", in ivhd_print_cap()
649 softc->dev = dev; in ivhd_attach()
652 softc->pci_dev = pci_find_dbsf(ivhd->PciSegmentGroup, in ivhd_attach()
653 PCI_RID2BUS(ivhd->Header.DeviceId), in ivhd_attach()
654 PCI_RID2SLOT(ivhd->Header.DeviceId), in ivhd_attach()
655 PCI_RID2FUNC(ivhd->Header.DeviceId)); in ivhd_attach()
657 softc->ivhd_type = ivhd->Header.Type; in ivhd_attach()
658 softc->pci_seg = ivhd->PciSegmentGroup; in ivhd_attach()
659 softc->pci_rid = ivhd->Header.DeviceId; in ivhd_attach()
660 softc->ivhd_flag = ivhd->Header.Flags; in ivhd_attach()
665 softc->ivhd_feature = ivhd->FeatureReporting; in ivhd_attach()
669 softc->cap_off = ivhd->CapabilityOffset; in ivhd_attach()
673 softc->event_msix = ivhd->Info & 0x1F; in ivhd_attach()
675 switch (ivhd->Header.Type) { in ivhd_attach()
679 softc->ext_feature = ivhd_efr->EfrRegisterImage; in ivhd_attach()
683 softc->ctrl = (struct amdvi_ctrl *) PHYS_TO_DMAP(ivhd->BaseAddress); in ivhd_attach()
705 free(softc->dev_cfg, M_DEVBUF); in ivhd_attach()
717 free(softc->dev_cfg, M_DEVBUF); in ivhd_detach()
757 * Load this module at the end after PCI re-probing to configure interrupt.