aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/scan.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/scan.c')
-rw-r--r--drivers/acpi/scan.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index daf9fc8329e6..78d5f02a073b 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -1308,6 +1308,48 @@ void acpi_free_pnp_ids(struct acpi_device_pnp *pnp)
1308 kfree(pnp->unique_id); 1308 kfree(pnp->unique_id);
1309} 1309}
1310 1310
1311/**
1312 * acpi_dma_supported - Check DMA support for the specified device.
1313 * @adev: The pointer to acpi device
1314 *
1315 * Return false if DMA is not supported. Otherwise, return true
1316 */
1317bool acpi_dma_supported(struct acpi_device *adev)
1318{
1319 if (!adev)
1320 return false;
1321
1322 if (adev->flags.cca_seen)
1323 return true;
1324
1325 /*
1326 * Per ACPI 6.0 sec 6.2.17, assume devices can do cache-coherent
1327 * DMA on "Intel platforms". Presumably that includes all x86 and
1328 * ia64, and other arches will set CONFIG_ACPI_CCA_REQUIRED=y.
1329 */
1330 if (!IS_ENABLED(CONFIG_ACPI_CCA_REQUIRED))
1331 return true;
1332
1333 return false;
1334}
1335
1336/**
1337 * acpi_get_dma_attr - Check the supported DMA attr for the specified device.
1338 * @adev: The pointer to acpi device
1339 *
1340 * Return enum dev_dma_attr.
1341 */
1342enum dev_dma_attr acpi_get_dma_attr(struct acpi_device *adev)
1343{
1344 if (!acpi_dma_supported(adev))
1345 return DEV_DMA_NOT_SUPPORTED;
1346
1347 if (adev->flags.coherent_dma)
1348 return DEV_DMA_COHERENT;
1349 else
1350 return DEV_DMA_NON_COHERENT;
1351}
1352
1311static void acpi_init_coherency(struct acpi_device *adev) 1353static void acpi_init_coherency(struct acpi_device *adev)
1312{ 1354{
1313 unsigned long long cca = 0; 1355 unsigned long long cca = 0;