Lines Matching refs:pdev
59 struct pci_dev *pdev; in pci_enable_ats() local
76 pdev = pci_physfn(dev); in pci_enable_ats()
77 if (pdev->ats_stu != ps) in pci_enable_ats()
159 int pci_ats_page_aligned(struct pci_dev *pdev) in pci_ats_page_aligned() argument
163 if (!pdev->ats_cap) in pci_ats_page_aligned()
166 pci_read_config_word(pdev, pdev->ats_cap + PCI_ATS_CAP, &cap); in pci_ats_page_aligned()
175 void pci_pri_init(struct pci_dev *pdev) in pci_pri_init() argument
179 pdev->pri_cap = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_PRI); in pci_pri_init()
181 if (!pdev->pri_cap) in pci_pri_init()
184 pci_read_config_word(pdev, pdev->pri_cap + PCI_PRI_STATUS, &status); in pci_pri_init()
186 pdev->pasid_required = 1; in pci_pri_init()
196 int pci_enable_pri(struct pci_dev *pdev, u32 reqs) in pci_enable_pri() argument
200 int pri = pdev->pri_cap; in pci_enable_pri()
207 if (pdev->is_virtfn) { in pci_enable_pri()
208 if (pci_physfn(pdev)->pri_enabled) in pci_enable_pri()
213 if (WARN_ON(pdev->pri_enabled)) in pci_enable_pri()
219 pci_read_config_word(pdev, pri + PCI_PRI_STATUS, &status); in pci_enable_pri()
223 pci_read_config_dword(pdev, pri + PCI_PRI_MAX_REQ, &max_requests); in pci_enable_pri()
225 pdev->pri_reqs_alloc = reqs; in pci_enable_pri()
226 pci_write_config_dword(pdev, pri + PCI_PRI_ALLOC_REQ, reqs); in pci_enable_pri()
229 pci_write_config_word(pdev, pri + PCI_PRI_CTRL, control); in pci_enable_pri()
231 pdev->pri_enabled = 1; in pci_enable_pri()
242 void pci_disable_pri(struct pci_dev *pdev) in pci_disable_pri() argument
245 int pri = pdev->pri_cap; in pci_disable_pri()
248 if (pdev->is_virtfn) in pci_disable_pri()
251 if (WARN_ON(!pdev->pri_enabled)) in pci_disable_pri()
257 pci_read_config_word(pdev, pri + PCI_PRI_CTRL, &control); in pci_disable_pri()
259 pci_write_config_word(pdev, pri + PCI_PRI_CTRL, control); in pci_disable_pri()
261 pdev->pri_enabled = 0; in pci_disable_pri()
269 void pci_restore_pri_state(struct pci_dev *pdev) in pci_restore_pri_state() argument
272 u32 reqs = pdev->pri_reqs_alloc; in pci_restore_pri_state()
273 int pri = pdev->pri_cap; in pci_restore_pri_state()
275 if (pdev->is_virtfn) in pci_restore_pri_state()
278 if (!pdev->pri_enabled) in pci_restore_pri_state()
284 pci_write_config_dword(pdev, pri + PCI_PRI_ALLOC_REQ, reqs); in pci_restore_pri_state()
285 pci_write_config_word(pdev, pri + PCI_PRI_CTRL, control); in pci_restore_pri_state()
295 int pci_reset_pri(struct pci_dev *pdev) in pci_reset_pri() argument
298 int pri = pdev->pri_cap; in pci_reset_pri()
300 if (pdev->is_virtfn) in pci_reset_pri()
303 if (WARN_ON(pdev->pri_enabled)) in pci_reset_pri()
310 pci_write_config_word(pdev, pri + PCI_PRI_CTRL, control); in pci_reset_pri()
322 int pci_prg_resp_pasid_required(struct pci_dev *pdev) in pci_prg_resp_pasid_required() argument
324 if (pdev->is_virtfn) in pci_prg_resp_pasid_required()
325 pdev = pci_physfn(pdev); in pci_prg_resp_pasid_required()
327 return pdev->pasid_required; in pci_prg_resp_pasid_required()
336 bool pci_pri_supported(struct pci_dev *pdev) in pci_pri_supported() argument
339 if (pci_physfn(pdev)->pri_cap) in pci_pri_supported()
347 void pci_pasid_init(struct pci_dev *pdev) in pci_pasid_init() argument
349 pdev->pasid_cap = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_PASID); in pci_pasid_init()
361 int pci_enable_pasid(struct pci_dev *pdev, int features) in pci_enable_pasid() argument
364 int pasid = pdev->pasid_cap; in pci_enable_pasid()
370 if (pdev->is_virtfn) { in pci_enable_pasid()
371 if (pci_physfn(pdev)->pasid_enabled) in pci_enable_pasid()
376 if (WARN_ON(pdev->pasid_enabled)) in pci_enable_pasid()
379 if (!pdev->eetlp_prefix_path && !pdev->pasid_no_tlp) in pci_enable_pasid()
385 if (!pci_acs_path_enabled(pdev, NULL, PCI_ACS_RR | PCI_ACS_UF)) in pci_enable_pasid()
388 pci_read_config_word(pdev, pasid + PCI_PASID_CAP, &supported); in pci_enable_pasid()
396 pdev->pasid_features = features; in pci_enable_pasid()
398 pci_write_config_word(pdev, pasid + PCI_PASID_CTRL, control); in pci_enable_pasid()
400 pdev->pasid_enabled = 1; in pci_enable_pasid()
410 void pci_disable_pasid(struct pci_dev *pdev) in pci_disable_pasid() argument
413 int pasid = pdev->pasid_cap; in pci_disable_pasid()
416 if (pdev->is_virtfn) in pci_disable_pasid()
419 if (WARN_ON(!pdev->pasid_enabled)) in pci_disable_pasid()
425 pci_write_config_word(pdev, pasid + PCI_PASID_CTRL, control); in pci_disable_pasid()
427 pdev->pasid_enabled = 0; in pci_disable_pasid()
435 void pci_restore_pasid_state(struct pci_dev *pdev) in pci_restore_pasid_state() argument
438 int pasid = pdev->pasid_cap; in pci_restore_pasid_state()
440 if (pdev->is_virtfn) in pci_restore_pasid_state()
443 if (!pdev->pasid_enabled) in pci_restore_pasid_state()
449 control = PCI_PASID_CTRL_ENABLE | pdev->pasid_features; in pci_restore_pasid_state()
450 pci_write_config_word(pdev, pasid + PCI_PASID_CTRL, control); in pci_restore_pasid_state()
463 int pci_pasid_features(struct pci_dev *pdev) in pci_pasid_features() argument
468 if (pdev->is_virtfn) in pci_pasid_features()
469 pdev = pci_physfn(pdev); in pci_pasid_features()
471 pasid = pdev->pasid_cap; in pci_pasid_features()
475 pci_read_config_word(pdev, pasid + PCI_PASID_CAP, &supported); in pci_pasid_features()
492 int pci_max_pasids(struct pci_dev *pdev) in pci_max_pasids() argument
497 if (pdev->is_virtfn) in pci_max_pasids()
498 pdev = pci_physfn(pdev); in pci_max_pasids()
500 pasid = pdev->pasid_cap; in pci_max_pasids()
504 pci_read_config_word(pdev, pasid + PCI_PASID_CAP, &supported); in pci_max_pasids()