Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 358154
b: refs/heads/master
c: dd66cc2
h: refs/heads/master
v: v3
  • Loading branch information
Bjorn Helgaas authored and Dave Airlie committed Feb 8, 2013
1 parent 13b6780 commit c43d0e9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 17 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f8acf6f4c8fe1fd4de1f669ac6a3c71e89f13523
refs/heads/master: dd66cc2e1f4765d0e6f39eb1e7d8d64d3f1cc522
21 changes: 5 additions & 16 deletions trunk/drivers/gpu/drm/drm_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -469,41 +469,30 @@ EXPORT_SYMBOL(drm_pci_exit);
int drm_pcie_get_speed_cap_mask(struct drm_device *dev, u32 *mask)
{
struct pci_dev *root;
int pos;
u32 lnkcap = 0, lnkcap2 = 0;
u32 lnkcap, lnkcap2;

*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;
pcie_capability_read_dword(root, PCI_EXP_LNKCAP, &lnkcap);
pcie_capability_read_dword(root, PCI_EXP_LNKCAP2, &lnkcap2);

if (lnkcap2) { /* PCIE GEN 3.0 */
if (lnkcap2) { /* PCIe r3.0-compliant */
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 {
} else { /* pre-r3.0 */
if (lnkcap & PCI_EXP_LNKCAP_SLS_2_5GB)
*mask |= DRM_PCIE_SPEED_25;
if (lnkcap & PCI_EXP_LNKCAP_SLS_5_0GB)
Expand Down

0 comments on commit c43d0e9

Please sign in to comment.