diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2013-08-26 05:15:22 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2013-08-26 05:15:22 +0000 |
commit | 4812606c308a8c1ffe9fdf8412050e8255ce802b (patch) | |
tree | d624799bbd51ba9e55f5059eda640ae6bbc53a06 /sys/dev/pci/drm/drm_drv.c | |
parent | 9164059c67330a31aa4e77d5fe2a3a4621ed2a0a (diff) |
Add a stubbed out version of drm_pcie_get_speed_cap_mask() and
enable all the code in the various radeon pcie_gen2_enable() functions.
no functional change
Diffstat (limited to 'sys/dev/pci/drm/drm_drv.c')
-rw-r--r-- | sys/dev/pci/drm/drm_drv.c | 54 |
1 files changed, 53 insertions, 1 deletions
diff --git a/sys/dev/pci/drm/drm_drv.c b/sys/dev/pci/drm/drm_drv.c index 8c7470e7d6d..f7446a0a5bc 100644 --- a/sys/dev/pci/drm/drm_drv.c +++ b/sys/dev/pci/drm/drm_drv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: drm_drv.c,v 1.110 2013/08/12 04:11:52 jsg Exp $ */ +/* $OpenBSD: drm_drv.c,v 1.111 2013/08/26 05:15:20 jsg Exp $ */ /*- * Copyright 2007-2009 Owain G. Ainsworth <oga@openbsd.org> * Copyright © 2008 Intel Corporation @@ -1822,6 +1822,58 @@ again: return &obj->uobj; } +int drm_pcie_get_speed_cap_mask(struct drm_device *dev, u32 *mask) +{ + printf("%s stub\n", __func__); + return -EINVAL; +#ifdef notyet + struct pci_dev *root; + int pos; + u32 lnkcap = 0, lnkcap2 = 0; + + *mask = 0; + if (!dev->pdev) + return -EINVAL; + + if (!pci_is_pcie(dev->pdev)) + return -EINVAL; + + root = dev->pdev->bus->self; + + pos = pci_pcie_cap(root); + if (!pos) + return -EINVAL; + + /* we've been informed via and serverworks don't make the cut */ + if (root->vendor == PCI_VENDOR_ID_VIA || + root->vendor == PCI_VENDOR_ID_SERVERWORKS) + return -EINVAL; + + pci_read_config_dword(root, pos + PCI_EXP_LNKCAP, &lnkcap); + pci_read_config_dword(root, pos + PCI_EXP_LNKCAP2, &lnkcap2); + + lnkcap &= PCI_EXP_LNKCAP_SLS; + lnkcap2 &= 0xfe; + + if (lnkcap2) { /* PCIE GEN 3.0 */ + if (lnkcap2 & PCI_EXP_LNKCAP2_SLS_2_5GB) + *mask |= DRM_PCIE_SPEED_25; + if (lnkcap2 & PCI_EXP_LNKCAP2_SLS_5_0GB) + *mask |= DRM_PCIE_SPEED_50; + if (lnkcap2 & PCI_EXP_LNKCAP2_SLS_8_0GB) + *mask |= DRM_PCIE_SPEED_80; + } else { + if (lnkcap & 1) + *mask |= DRM_PCIE_SPEED_25; + if (lnkcap & 2) + *mask |= DRM_PCIE_SPEED_50; + } + + DRM_INFO("probing gen 2 caps for device %x:%x = %x/%x\n", root->vendor, root->device, lnkcap, lnkcap2); + return 0; +#endif +} + int drm_handle_cmp(struct drm_handle *a, struct drm_handle *b) { |