Fixes to compile with Linux kernel 6.1

deepcrayon-6.1
Jeff Moe 2023-08-27 22:41:32 -06:00
parent 10ef68a0b0
commit bea979c164
5 changed files with 19 additions and 16 deletions

View File

@ -8,6 +8,8 @@
//
//==========================================================================
#include <linux/dma-mapping.h>
#if defined(CONFIG_SMP)
#define __SMP__
#endif
@ -473,9 +475,10 @@ int dmaInit(ULWord deviceNumber)
for (iDes = 0; iDes < pDmaEngine->numDescriptorPages; iDes++)
{
pDmaEngine->pDescriptorVirtual[iDes] =
pci_alloc_consistent(pNTV2Params->pci_dev,
dma_alloc_coherent(&(pNTV2Params->pci_dev)->dev,
PAGE_SIZE,
&pDmaEngine->descriptorPhysical[iDes]);
&pDmaEngine->descriptorPhysical[iDes],
GFP_ATOMIC);
if ((pDmaEngine->pDescriptorVirtual[iDes] == NULL) ||
(pDmaEngine->descriptorPhysical[iDes] == 0))
{
@ -556,7 +559,7 @@ static void dmaFreeEngine(PDMA_ENGINE pDmaEngine)
if ((pDmaEngine->pDescriptorVirtual[iDes] != NULL) &&
(pDmaEngine->descriptorPhysical[iDes] != 0))
{
pci_free_consistent(pNTV2Params->pci_dev,
dma_free_coherent(&(pNTV2Params->pci_dev)->dev,
PAGE_SIZE,
pDmaEngine->pDescriptorVirtual[iDes],
pDmaEngine->descriptorPhysical[iDes]);
@ -914,7 +917,7 @@ int dmaTransfer(PDMA_PARAMS pDmaParams)
pDmaContext->dmaC2H = pDmaParams->toHost;
}
dmaC2H = pDmaContext->dmaC2H;
direction = dmaC2H? PCI_DMA_FROMDEVICE : PCI_DMA_TODEVICE;
direction = dmaC2H? DMA_FROM_DEVICE : DMA_TO_DEVICE;
// do nothing by default
pDmaContext->pVideoPageBuffer = NULL;
@ -2282,7 +2285,7 @@ int dmaPageRootAdd(ULWord deviceNumber, PDMA_PAGE_ROOT pRoot,
}
// lock buffer
ret = dmaPageLock(deviceNumber, pBuffer, pAddress, size, PCI_DMA_BIDIRECTIONAL);
ret = dmaPageLock(deviceNumber, pBuffer, pAddress, size, DMA_BIDIRECTIONAL);
if (ret < 0)
{
kfree(pBuffer);
@ -2655,7 +2658,7 @@ static int dmaPageLock(ULWord deviceNumber, PDMA_PAGE_BUFFER pBuffer,
}
// determine if buffer will be written
write = (direction == PCI_DMA_BIDIRECTIONAL) || (direction == PCI_DMA_FROMDEVICE);
write = (direction == DMA_BIDIRECTIONAL) || (direction == DMA_FROM_DEVICE);
// get the map semaphore
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,8,0))
@ -2785,7 +2788,7 @@ static void dmaPageUnlock(ULWord deviceNumber, PDMA_PAGE_BUFFER pBuffer)
// release the locked pages
for (i = 0; i < pBuffer->numPages; i++)
{
if ((pBuffer->direction == PCI_DMA_FROMDEVICE) &&
if ((pBuffer->direction == DMA_FROM_DEVICE) &&
!PageReserved(pBuffer->pPageList[i]))
{
set_page_dirty(pBuffer->pPageList[i]);
@ -2907,7 +2910,7 @@ static int dmaSgMap(ULWord deviceNumber, PDMA_PAGE_BUFFER pBuffer)
ret = nvidia_p2p_dma_map_pages(&(pNTV2Params->pci_dev)->dev,
pBuffer->rdmaPage,
&pBuffer->rdmaMap,
(pBuffer->direction == PCI_DMA_TODEVICE)? DMA_TO_DEVICE : DMA_FROM_DEVICE);
(pBuffer->direction == DMA_TO_DEVICE)? DMA_TO_DEVICE : DMA_FROM_DEVICE);
#else
ret = nvidia_p2p_dma_map_pages(pNTV2Params->pci_dev,
pBuffer->rdmaPage,

View File

@ -4388,9 +4388,9 @@ pci_resources_config (struct pci_dev *pdev, NTV2PrivateParams * ntv2pp)
// a 64-bit mask from a previous driver load.
#if defined(DMA_BIT_MASK)
if((res = pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) != 0)
if((res = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32))) != 0)
#else
if((res = pci_set_dma_mask(pdev, DMA_32BIT_MASK)) != 0)
if((res = dma_set_mask(&pdev->dev, DMA_32BIT_MASK)) != 0)
#endif
{
MSG("%s: Unable to set DMA mask. Disabling this board.\n",
@ -4694,9 +4694,9 @@ dma_registers_init (struct pci_dev *pdev, NTV2PrivateParams * ntv2pp)
}
#if defined(DMA_BIT_MASK)
if(!pci_set_dma_mask(pdev, DMA_BIT_MASK(64)))
if(!dma_set_mask(&pdev->dev, DMA_BIT_MASK(64)))
#else
if(!pci_set_dma_mask(pdev, DMA_64BIT_MASK))
if(!dma_set_mask(&pdev->dev, DMA_64BIT_MASK))
#endif
{
MSG("%s: Using 64-bit DMA mask with 64-bit capable firmware\n",

View File

@ -170,7 +170,7 @@ static void ntv2_uartops_shutdown(struct uart_port *port)
static void ntv2_uartops_set_termios(struct uart_port *port,
struct ktermios *termios,
struct ktermios *old)
const struct ktermios *old)
{
struct ntv2_serial *ntv2_ser = container_of(port, struct ntv2_serial, uart_port);
u32 valid = ntv2_kona_fld_serial_rx_valid;

View File

@ -1513,7 +1513,7 @@ bool ntv2DmaMemoryAlloc(Ntv2DmaMemory* pDmaMemory, Ntv2SystemContext* pSysCon, u
(pSysCon->pDevice == NULL) ||
(size == 0)) return false;
pAddress = pci_alloc_consistent(pSysCon->pDevice, size, &dmaAddress);
pAddress = dma_alloc_coherent(&(pSysCon->pDevice)->dev, size, &dmaAddress, GFP_ATOMIC);
if((pAddress == NULL) || (dmaAddress == 0)) return false;
// initialize memory data structure
@ -1534,7 +1534,7 @@ void ntv2DmaMemoryFree(Ntv2DmaMemory* pDmaMemory)
(pDmaMemory->dmaAddress == 0) ||
(pDmaMemory->size == 0)) return;
pci_free_consistent(pDmaMemory->pDevice,
dma_free_coherent(&(pDmaMemory->pDevice)->dev,
pDmaMemory->size,
pDmaMemory->pAddress,
pDmaMemory->dmaAddress);

View File

@ -10,7 +10,7 @@
#define NTV2DEVICEFEATURES_H
#if defined(AJALinux) || defined(AJA_LINUX)
#include <stddef.h> // For size_t
#include <linux/stddef.h> // For size_t
#endif
#include "ajaexport.h"