1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (C) 2020-2022 Loongson Technology Corporation Limited
5 #include <linux/acpi.h>
6 #include <linux/dma-direct.h>
8 void acpi_arch_dma_setup(struct device *dev)
12 const struct bus_dma_region *map = NULL;
14 ret = acpi_dma_get_range(dev, &map);
16 end = dma_range_map_max(map);
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);