aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/ats.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci/ats.c')
-rw-r--r--drivers/pci/ats.c82
1 files changed, 0 insertions, 82 deletions
diff --git a/drivers/pci/ats.c b/drivers/pci/ats.c
index e52d7ffa38b9..a8099d4d0c9d 100644
--- a/drivers/pci/ats.c
+++ b/drivers/pci/ats.c
@@ -235,27 +235,6 @@ void pci_disable_pri(struct pci_dev *pdev)
235EXPORT_SYMBOL_GPL(pci_disable_pri); 235EXPORT_SYMBOL_GPL(pci_disable_pri);
236 236
237/** 237/**
238 * pci_pri_enabled - Checks if PRI capability is enabled
239 * @pdev: PCI device structure
240 *
241 * Returns true if PRI is enabled on the device, false otherwise
242 */
243bool pci_pri_enabled(struct pci_dev *pdev)
244{
245 u16 control;
246 int pos;
247
248 pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_PRI);
249 if (!pos)
250 return false;
251
252 pci_read_config_word(pdev, pos + PCI_PRI_CTRL, &control);
253
254 return (control & PCI_PRI_CTRL_ENABLE) ? true : false;
255}
256EXPORT_SYMBOL_GPL(pci_pri_enabled);
257
258/**
259 * pci_reset_pri - Resets device's PRI state 238 * pci_reset_pri - Resets device's PRI state
260 * @pdev: PCI device structure 239 * @pdev: PCI device structure
261 * 240 *
@@ -282,67 +261,6 @@ int pci_reset_pri(struct pci_dev *pdev)
282 return 0; 261 return 0;
283} 262}
284EXPORT_SYMBOL_GPL(pci_reset_pri); 263EXPORT_SYMBOL_GPL(pci_reset_pri);
285
286/**
287 * pci_pri_stopped - Checks whether the PRI capability is stopped
288 * @pdev: PCI device structure
289 *
290 * Returns true if the PRI capability on the device is disabled and the
291 * device has no outstanding PRI requests, false otherwise. The device
292 * indicates this via the STOPPED bit in the status register of the
293 * capability.
294 * The device internal state can be cleared by resetting the PRI state
295 * with pci_reset_pri(). This can force the capability into the STOPPED
296 * state.
297 */
298bool pci_pri_stopped(struct pci_dev *pdev)
299{
300 u16 control, status;
301 int pos;
302
303 pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_PRI);
304 if (!pos)
305 return true;
306
307 pci_read_config_word(pdev, pos + PCI_PRI_CTRL, &control);
308 pci_read_config_word(pdev, pos + PCI_PRI_STATUS, &status);
309
310 if (control & PCI_PRI_CTRL_ENABLE)
311 return false;
312
313 return (status & PCI_PRI_STATUS_STOPPED) ? true : false;
314}
315EXPORT_SYMBOL_GPL(pci_pri_stopped);
316
317/**
318 * pci_pri_status - Request PRI status of a device
319 * @pdev: PCI device structure
320 *
321 * Returns negative value on failure, status on success. The status can
322 * be checked against status-bits. Supported bits are currently:
323 * PCI_PRI_STATUS_RF: Response failure
324 * PCI_PRI_STATUS_UPRGI: Unexpected Page Request Group Index
325 * PCI_PRI_STATUS_STOPPED: PRI has stopped
326 */
327int pci_pri_status(struct pci_dev *pdev)
328{
329 u16 status, control;
330 int pos;
331
332 pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_PRI);
333 if (!pos)
334 return -EINVAL;
335
336 pci_read_config_word(pdev, pos + PCI_PRI_CTRL, &control);
337 pci_read_config_word(pdev, pos + PCI_PRI_STATUS, &status);
338
339 /* Stopped bit is undefined when enable == 1, so clear it */
340 if (control & PCI_PRI_CTRL_ENABLE)
341 status &= ~PCI_PRI_STATUS_STOPPED;
342
343 return status;
344}
345EXPORT_SYMBOL_GPL(pci_pri_status);
346#endif /* CONFIG_PCI_PRI */ 264#endif /* CONFIG_PCI_PRI */
347 265
348#ifdef CONFIG_PCI_PASID 266#ifdef CONFIG_PCI_PASID