diff --git a/drv/Makefile b/drv/Makefile index e9c91e5..6c19288 100644 --- a/drv/Makefile +++ b/drv/Makefile @@ -28,6 +28,7 @@ LINUXINCLUDE := $(LINUXINCLUDE) -I$(src)/asic_reg #ccflags-y += -DCONFIG_GIM_HEARTBEAT_TIMER #ccflags-y += -D DRV_VERSION=1.0 #ccflags-y += -DCONFIG_MMIO_QEMU_SECURITY +ccflags-y += -Wno-error=implicit-function-declaration PWD := $(shell pwd) diff --git a/drv/gim_adapter.c b/drv/gim_adapter.c index 601df39..5ae530d 100644 --- a/drv/gim_adapter.c +++ b/drv/gim_adapter.c @@ -694,7 +694,11 @@ uint32_t set_new_adapter(struct pci_dev *pdev) write_register(pf, mmSMU_IND_INDEX_0, 0); /* Set the dma mask to be 40 bits address range */ +#if(LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0)) pci_set_dma_mask(curr->pf.pci_dev, 0xffffffffffull); +#else + dma_set_mask(&curr->pf.pci_dev->dev, 0xffffffffffull); +#endif /* interrupt */ size = sizeof(struct interrupt_handler); diff --git a/drv/gim_irqmgr.c b/drv/gim_irqmgr.c index e799f74..b676971 100644 --- a/drv/gim_irqmgr.c +++ b/drv/gim_irqmgr.c @@ -140,20 +140,37 @@ static int alloc_iv_ring(struct adapter *adapt) ih->ivr_va = (struct iv_ring_entry *)kcl_mem_map_page_list(list, cnt); gim_info("ih->ivr_va = %p\n", ih->ivr_va); +#if(LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0)) ih->ivr_ma.quad_part = pci_map_page(adapt->pf.pci_dev, (struct page *)list[0], 0, PAGE_SIZE, PCI_DMA_BIDIRECTIONAL); +#else + ih->ivr_ma.quad_part = dma_map_page( + &adapt->pf.pci_dev->dev, + (struct page *)list[0], 0, + PAGE_SIZE, + DMA_BIDIRECTIONAL); +#endif gim_info("ih->ivr_ma.quad_part = 0x%llx\n", ih->ivr_ma.quad_part); + ih->ivr_wptr_wb = (unsigned int *)((unsigned int *)ih->ivr_va + (ih->ivr_size_in_bytes/4)); gim_info("ih->ivr_wptr_wb = %p\n", ih->ivr_wptr_wb); +#if(LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0)) ih->ivr_wptr_wa.quad_part = pci_map_page(adapt->pf.pci_dev, - (struct page *)list[1], 0, - PAGE_SIZE, - PCI_DMA_BIDIRECTIONAL); + (struct page *)list[1], 0, + PAGE_SIZE, + PCI_DMA_BIDIRECTIONAL); +#else + ih->ivr_wptr_wa.quad_part = dma_map_page( + &adapt->pf.pci_dev->dev, + (struct page *)list[1], 0, + PAGE_SIZE, + DMA_BIDIRECTIONAL); +#endif gim_info("ih->ivr_wptr_wa.quad_part = 0x%llx\n", ih->ivr_wptr_wa.quad_part); diff --git a/drv/gim_kcl_os.c b/drv/gim_kcl_os.c index cdfeaf1..f6c37c9 100644 --- a/drv/gim_kcl_os.c +++ b/drv/gim_kcl_os.c @@ -71,8 +71,17 @@ void *kcl_mem_map_page_list(unsigned long *pagelist, unsigned int count) unsigned long long kcl_map_page(struct pci_dev *pci_dev, unsigned long p) { - return pci_map_page(pci_dev, (struct page *)p, 0, - PAGE_SIZE, PCI_DMA_BIDIRECTIONAL); +#if(LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0)) + return pci_map_page(pci_dev, + (struct page *)p, 0, + PAGE_SIZE, + PCI_DMA_BIDIRECTIONAL); +#else + return dma_map_page(&pci_dev->dev, + (struct page *)p, 0, + PAGE_SIZE, + DMA_BIDIRECTIONAL); +#endif } void kcl_mem_unmap(void *addr) diff --git a/drv/gim_monitor_ioctl.c b/drv/gim_monitor_ioctl.c index 8fba6de..3a85cf8 100644 --- a/drv/gim_monitor_ioctl.c +++ b/drv/gim_monitor_ioctl.c @@ -289,8 +289,11 @@ int amdgim_create_cdev(void) gim_err("Error %d while adding amdgim", ret); goto fail_cdevadd; } - +#if(LINUX_VERSION_CODE < KERNEL_VERSION(6,4,0)) amdgim_class = class_create(THIS_MODULE, AMDGIM_CLASS_NAME); +#else + amdgim_class = class_create(AMDGIM_CLASS_NAME); +#endif device_create(amdgim_class, NULL, MKDEV(amdgim_pdev->major, 0), NULL, AMDGIM_DEVICE_FILE_NAME);