Commit 451e93e3 authored by Jaco Hofmann's avatar Jaco Hofmann
Browse files

Move dma_mask selection to pcie_device

parent 48b243c4
......@@ -300,18 +300,6 @@ static int dma_initialize(void) {
fflink_notice("Initializing private data");
dma_init_pdata(&priv_data);
dma_set_mask_and_coherent(&get_pcie_dev()->dev, DMA_BIT_MASK(DMA_MAX_BIT));
/* get buffers for dma, this could possibly go wrong */
if(DMA_MAX_BIT == 32) {
zone = GFP_DMA32;
} else if (DMA_MAX_BIT == 64) {
zone = GFP_DMA32;
} else {
fflink_warn("Wrong bit mask setting - only 32/64 supported, but have %d\n", DMA_MAX_BIT);
err_return = -EFAULT;
goto open_failed;
}
err_1 = dma_alloc_pbufs(&priv_data.kvirt_h2l, &priv_data.dma_handle_h2l, zone, PCI_DMA_TODEVICE);
err_2 = dma_alloc_pbufs(&priv_data.kvirt_l2h, &priv_data.dma_handle_l2h, zone, PCI_DMA_FROMDEVICE);
......
......@@ -95,8 +95,23 @@ error_pci_en:
* */
static int configure_device(struct pci_dev *pdev)
{
fflink_warn("Settings of MPS: %d and Maximum Read Request %d\n", pcie_get_mps(pdev), pcie_get_readrq(pdev));
fflink_info("Settings of MPS: %d and Maximum Read Request %d\n", pcie_get_mps(pdev), pcie_get_readrq(pdev));
if(!dma_set_mask(&pdev->dev, DMA_BIT_MASK(64))) {
fflink_info("dma_set_mask: Using 64 bit dma addresses\n");
dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64));
} else if(!dma_set_mask(&pdev->dev, DMA_BIT_MASK(32))) {
fflink_info("dma_set_mask: Using 32 bit dma addresses\n");
dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
} else {
fflink_warn("No suitable dma available\n");
goto mask_error;
}
return 0;
mask_error:
return -ENODEV;
}
/**
* @brief Register specific function with msi interrupt line
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment