probe.c (e42010d8207f9d15a605ceb8e321bcd9648071b0) probe.c (d760a1baf20e067d3a063aa134834ddd3d183e2f)
1/*
2 * probe.c - PCI detection and setup code
3 */
4
5#include <linux/kernel.h>
6#include <linux/delay.h>
7#include <linux/init.h>
8#include <linux/pci.h>

--- 1425 unchanged lines hidden (view full) ---

1434}
1435
1436static void program_hpp_type1(struct pci_dev *dev, struct hpp_type1 *hpp)
1437{
1438 if (hpp)
1439 dev_warn(&dev->dev, "PCI-X settings not supported\n");
1440}
1441
1/*
2 * probe.c - PCI detection and setup code
3 */
4
5#include <linux/kernel.h>
6#include <linux/delay.h>
7#include <linux/init.h>
8#include <linux/pci.h>

--- 1425 unchanged lines hidden (view full) ---

1434}
1435
1436static void program_hpp_type1(struct pci_dev *dev, struct hpp_type1 *hpp)
1437{
1438 if (hpp)
1439 dev_warn(&dev->dev, "PCI-X settings not supported\n");
1440}
1441
1442static bool pcie_root_rcb_set(struct pci_dev *dev)
1443{
1444 struct pci_dev *rp = pcie_find_root_port(dev);
1445 u16 lnkctl;
1446
1447 if (!rp)
1448 return false;
1449
1450 pcie_capability_read_word(rp, PCI_EXP_LNKCTL, &lnkctl);
1451 if (lnkctl & PCI_EXP_LNKCTL_RCB)
1452 return true;
1453
1454 return false;
1455}
1456
1457static void program_hpp_type2(struct pci_dev *dev, struct hpp_type2 *hpp)
1458{
1459 int pos;
1460 u32 reg32;
1461
1462 if (!hpp)
1463 return;
1464

--- 13 unchanged lines hidden (view full) ---

1478 hpp->pci_exp_devctl_or &= ~(PCI_EXP_DEVCTL_PAYLOAD |
1479 PCI_EXP_DEVCTL_READRQ);
1480
1481 /* Initialize Device Control Register */
1482 pcie_capability_clear_and_set_word(dev, PCI_EXP_DEVCTL,
1483 ~hpp->pci_exp_devctl_and, hpp->pci_exp_devctl_or);
1484
1485 /* Initialize Link Control Register */
1442static void program_hpp_type2(struct pci_dev *dev, struct hpp_type2 *hpp)
1443{
1444 int pos;
1445 u32 reg32;
1446
1447 if (!hpp)
1448 return;
1449

--- 13 unchanged lines hidden (view full) ---

1463 hpp->pci_exp_devctl_or &= ~(PCI_EXP_DEVCTL_PAYLOAD |
1464 PCI_EXP_DEVCTL_READRQ);
1465
1466 /* Initialize Device Control Register */
1467 pcie_capability_clear_and_set_word(dev, PCI_EXP_DEVCTL,
1468 ~hpp->pci_exp_devctl_and, hpp->pci_exp_devctl_or);
1469
1470 /* Initialize Link Control Register */
1486 if (pcie_cap_has_lnkctl(dev)) {
1487
1488 /*
1489 * If the Root Port supports Read Completion Boundary of
1490 * 128, set RCB to 128. Otherwise, clear it.
1491 */
1492 hpp->pci_exp_lnkctl_and |= PCI_EXP_LNKCTL_RCB;
1493 hpp->pci_exp_lnkctl_or &= ~PCI_EXP_LNKCTL_RCB;
1494 if (pcie_root_rcb_set(dev))
1495 hpp->pci_exp_lnkctl_or |= PCI_EXP_LNKCTL_RCB;
1496
1471 if (pcie_cap_has_lnkctl(dev))
1497 pcie_capability_clear_and_set_word(dev, PCI_EXP_LNKCTL,
1498 ~hpp->pci_exp_lnkctl_and, hpp->pci_exp_lnkctl_or);
1472 pcie_capability_clear_and_set_word(dev, PCI_EXP_LNKCTL,
1473 ~hpp->pci_exp_lnkctl_and, hpp->pci_exp_lnkctl_or);
1499 }
1500
1501 /* Find Advanced Error Reporting Enhanced Capability */
1502 pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ERR);
1503 if (!pos)
1504 return;
1505
1506 /* Initialize Uncorrectable Error Mask Register */
1507 pci_read_config_dword(dev, pos + PCI_ERR_UNCOR_MASK, &reg32);

--- 251 unchanged lines hidden (view full) ---

1759 of_dma_configure(&dev->dev, bridge->parent->of_node);
1760 } else if (has_acpi_companion(bridge)) {
1761 struct acpi_device *adev = to_acpi_device_node(bridge->fwnode);
1762 enum dev_dma_attr attr = acpi_get_dma_attr(adev);
1763
1764 if (attr == DEV_DMA_NOT_SUPPORTED)
1765 dev_warn(&dev->dev, "DMA not supported.\n");
1766 else
1474
1475 /* Find Advanced Error Reporting Enhanced Capability */
1476 pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ERR);
1477 if (!pos)
1478 return;
1479
1480 /* Initialize Uncorrectable Error Mask Register */
1481 pci_read_config_dword(dev, pos + PCI_ERR_UNCOR_MASK, &reg32);

--- 251 unchanged lines hidden (view full) ---

1733 of_dma_configure(&dev->dev, bridge->parent->of_node);
1734 } else if (has_acpi_companion(bridge)) {
1735 struct acpi_device *adev = to_acpi_device_node(bridge->fwnode);
1736 enum dev_dma_attr attr = acpi_get_dma_attr(adev);
1737
1738 if (attr == DEV_DMA_NOT_SUPPORTED)
1739 dev_warn(&dev->dev, "DMA not supported.\n");
1740 else
1767 arch_setup_dma_ops(&dev->dev, 0, 0, NULL,
1768 attr == DEV_DMA_COHERENT);
1741 acpi_dma_configure(&dev->dev, attr);
1769 }
1770
1771 pci_put_host_bridge_device(bridge);
1772}
1773
1774void pci_device_add(struct pci_dev *dev, struct pci_bus *bus)
1775{
1776 int ret;

--- 703 unchanged lines hidden ---
1742 }
1743
1744 pci_put_host_bridge_device(bridge);
1745}
1746
1747void pci_device_add(struct pci_dev *dev, struct pci_bus *bus)
1748{
1749 int ret;

--- 703 unchanged lines hidden ---