Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
torvalds
GitHub Repository: torvalds/linux
Path: blob/master/arch/loongarch/kernel/dma.c
26424 views
1
// SPDX-License-Identifier: GPL-2.0
2
/*
3
* Copyright (C) 2020-2022 Loongson Technology Corporation Limited
4
*/
5
#include <linux/acpi.h>
6
#include <linux/dma-direct.h>
7
8
void acpi_arch_dma_setup(struct device *dev)
9
{
10
int ret;
11
u64 mask, end;
12
const struct bus_dma_region *map = NULL;
13
14
ret = acpi_dma_get_range(dev, &map);
15
if (!ret && map) {
16
end = dma_range_map_max(map);
17
18
mask = DMA_BIT_MASK(ilog2(end) + 1);
19
dev->bus_dma_limit = end;
20
dev->dma_range_map = map;
21
dev->coherent_dma_mask = min(dev->coherent_dma_mask, mask);
22
*dev->dma_mask = min(*dev->dma_mask, mask);
23
}
24
25
}
26
27