-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathwl-kmod-022_kernel_5.18_adaptation.patch
101 lines (93 loc) · 2.99 KB
/
wl-kmod-022_kernel_5.18_adaptation.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
diff -Naur hybrid-v35_64-nodebug-pcoem-6_30_223_271.orig/src/shared/linux_osl.c hybrid-v35_64-nodebug-pcoem-6_30_223_271-022_kernel_5.18_adaptation/src/shared/linux_osl.c
--- hybrid-v35_64-nodebug-pcoem-6_30_223_271.orig/src/shared/linux_osl.c 2020-12-29 18:29:39.434940249 +0100
+++ hybrid-v35_64-nodebug-pcoem-6_30_223_271-022_kernel_5.18_adaptation/src/shared/linux_osl.c 2022-06-06 17:14:25.587543256 +0200
@@ -48,7 +48,11 @@
struct osl_info {
osl_pubinfo_t pub;
uint magic;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
+ struct pci_dev *pdev;
+#else
void *pdev;
+#endif
atomic_t malloced;
atomic_t pktalloced;
uint failed;
@@ -600,8 +604,12 @@
if (va)
*pap = (ulong)__virt_to_phys(va);
#else
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
+ va = dma_alloc_coherent(&osh->pdev->dev, size, (dma_addr_t *)pap, GFP_ATOMIC);
+#else
va = pci_alloc_consistent(osh->pdev, size, (dma_addr_t*)pap);
#endif
+#endif
return va;
}
@@ -613,8 +621,12 @@
#ifdef __ARM_ARCH_7A__
kfree(va);
#else
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
+ dma_free_coherent(&osh->pdev->dev, size, va, (dma_addr_t)pa);
+#else
pci_free_consistent(osh->pdev, size, va, (dma_addr_t)pa);
#endif
+#endif
}
uint BCMFASTPATH
@@ -623,7 +635,11 @@
int dir;
ASSERT((osh && (osh->magic == OS_HANDLE_MAGIC)));
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
+ dir = (direction == DMA_TX)? DMA_TO_DEVICE : DMA_FROM_DEVICE;
+#else
dir = (direction == DMA_TX)? PCI_DMA_TODEVICE: PCI_DMA_FROMDEVICE;
+#endif
#if defined(__ARM_ARCH_7A__) && defined(BCMDMASGLISTOSL)
if (dmah != NULL) {
@@ -635,13 +651,21 @@
if (skb_is_nonlinear(skb)) {
nsegs = skb_to_sgvec(skb, sg, 0, PKTLEN(osh, skb));
ASSERT((nsegs > 0) && (totsegs + nsegs <= MAX_DMA_SEGS));
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
+ dma_map_sg(&osh->pdev->dev, sg, nsegs, dir);
+#else
pci_map_sg(osh->pdev, sg, nsegs, dir);
+#endif
} else {
nsegs = 1;
ASSERT(totsegs + nsegs <= MAX_DMA_SEGS);
sg->page_link = 0;
sg_set_buf(sg, PKTDATA(osh, skb), PKTLEN(osh, skb));
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
+ dma_map_single(&osh->pdev->dev, PKTDATA(osh, skb), PKTLEN(osh, skb), dir);
+#else
pci_map_single(osh->pdev, PKTDATA(osh, skb), PKTLEN(osh, skb), dir);
+#endif
}
totsegs += nsegs;
totlen += PKTLEN(osh, skb);
@@ -656,7 +680,11 @@
}
#endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
+ return (dma_map_single(&osh->pdev->dev, va, size, dir));
+#else
return (pci_map_single(osh->pdev, va, size, dir));
+#endif
}
void BCMFASTPATH
@@ -665,8 +693,13 @@
int dir;
ASSERT((osh && (osh->magic == OS_HANDLE_MAGIC)));
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
+ dir = (direction == DMA_TX)? DMA_TO_DEVICE : DMA_FROM_DEVICE;
+ dma_unmap_single(&osh->pdev->dev, (uint32)pa, size, dir);
+#else
dir = (direction == DMA_TX)? PCI_DMA_TODEVICE: PCI_DMA_FROMDEVICE;
pci_unmap_single(osh->pdev, (uint32)pa, size, dir);
+#endif
}
#if defined(BCMDBG_ASSERT)