| 1774 | } |
| 1775 | |
| 1776 | static int ena_device_init(struct ena_adapter *adapter, |
| 1777 | struct rte_pci_device *pdev, |
| 1778 | struct ena_com_dev_get_features_ctx *get_feat_ctx) |
| 1779 | { |
| 1780 | struct ena_com_dev *ena_dev = &adapter->ena_dev; |
| 1781 | uint32_t aenq_groups; |
| 1782 | int rc; |
| 1783 | bool readless_supported; |
| 1784 | |
| 1785 | /* Initialize mmio registers */ |
| 1786 | rc = ena_com_mmio_reg_read_request_init(ena_dev); |
| 1787 | if (rc) { |
| 1788 | PMD_DRV_LOG(ERR, "Failed to init MMIO read less\n"); |
| 1789 | return rc; |
| 1790 | } |
| 1791 | |
| 1792 | /* The PCIe configuration space revision id indicate if mmio reg |
| 1793 | * read is disabled. |
| 1794 | */ |
| 1795 | readless_supported = !(pdev->id.class_id & ENA_MMIO_DISABLE_REG_READ); |
| 1796 | ena_com_set_mmio_read_mode(ena_dev, readless_supported); |
| 1797 | |
| 1798 | /* reset device */ |
| 1799 | rc = ena_com_dev_reset(ena_dev, ENA_REGS_RESET_NORMAL); |
| 1800 | if (rc) { |
| 1801 | PMD_DRV_LOG(ERR, "Cannot reset device\n"); |
| 1802 | goto err_mmio_read_less; |
| 1803 | } |
| 1804 | |
| 1805 | /* check FW version */ |
| 1806 | rc = ena_com_validate_version(ena_dev); |
| 1807 | if (rc) { |
| 1808 | PMD_DRV_LOG(ERR, "Device version is too low\n"); |
| 1809 | goto err_mmio_read_less; |
| 1810 | } |
| 1811 | |
| 1812 | ena_dev->dma_addr_bits = ena_com_get_dma_width(ena_dev); |
| 1813 | |
| 1814 | /* ENA device administration layer init */ |
| 1815 | rc = ena_com_admin_init(ena_dev, &aenq_handlers); |
| 1816 | if (rc) { |
| 1817 | PMD_DRV_LOG(ERR, |
| 1818 | "Cannot initialize ENA admin queue\n"); |
| 1819 | goto err_mmio_read_less; |
| 1820 | } |
| 1821 | |
| 1822 | /* To enable the msix interrupts the driver needs to know the number |
| 1823 | * of queues. So the driver uses polling mode to retrieve this |
| 1824 | * information. |
| 1825 | */ |
| 1826 | ena_com_set_admin_polling_mode(ena_dev, true); |
| 1827 | |
| 1828 | ena_config_host_info(ena_dev); |
| 1829 | |
| 1830 | /* Get Device Attributes and features */ |
| 1831 | rc = ena_com_get_dev_attr_feat(ena_dev, get_feat_ctx); |
| 1832 | if (rc) { |
| 1833 | PMD_DRV_LOG(ERR, |
no test coverage detected