diff options
Diffstat (limited to 'arch/mips/loongson/common/dma-swiotlb.c')
-rw-r--r-- | arch/mips/loongson/common/dma-swiotlb.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/arch/mips/loongson/common/dma-swiotlb.c b/arch/mips/loongson/common/dma-swiotlb.c index c2be01f91575..2c6b989c1bc4 100644 --- a/arch/mips/loongson/common/dma-swiotlb.c +++ b/arch/mips/loongson/common/dma-swiotlb.c | |||
@@ -105,11 +105,25 @@ static int loongson_dma_set_mask(struct device *dev, u64 mask) | |||
105 | 105 | ||
106 | dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr) | 106 | dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr) |
107 | { | 107 | { |
108 | long nid; | ||
109 | #ifdef CONFIG_PHYS48_TO_HT40 | ||
110 | /* We extract 2bit node id (bit 44~47, only bit 44~45 used now) from | ||
111 | * Loongson-3's 48bit address space and embed it into 40bit */ | ||
112 | nid = (paddr >> 44) & 0x3; | ||
113 | paddr = ((nid << 44) ^ paddr) | (nid << 37); | ||
114 | #endif | ||
108 | return paddr; | 115 | return paddr; |
109 | } | 116 | } |
110 | 117 | ||
111 | phys_addr_t dma_to_phys(struct device *dev, dma_addr_t daddr) | 118 | phys_addr_t dma_to_phys(struct device *dev, dma_addr_t daddr) |
112 | { | 119 | { |
120 | long nid; | ||
121 | #ifdef CONFIG_PHYS48_TO_HT40 | ||
122 | /* We extract 2bit node id (bit 44~47, only bit 44~45 used now) from | ||
123 | * Loongson-3's 48bit address space and embed it into 40bit */ | ||
124 | nid = (daddr >> 37) & 0x3; | ||
125 | daddr = ((nid << 37) ^ daddr) | (nid << 44); | ||
126 | #endif | ||
113 | return daddr; | 127 | return daddr; |
114 | } | 128 | } |
115 | 129 | ||