pci-dma.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607
  1. /*
  2. * Copyright 2010 Tilera Corporation. All Rights Reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation, version 2.
  7. *
  8. * This program is distributed in the hope that it will be useful, but
  9. * WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  11. * NON INFRINGEMENT. See the GNU General Public License for
  12. * more details.
  13. */
  14. #include <linux/mm.h>
  15. #include <linux/dma-mapping.h>
  16. #include <linux/swiotlb.h>
  17. #include <linux/vmalloc.h>
  18. #include <linux/export.h>
  19. #include <asm/tlbflush.h>
  20. #include <asm/homecache.h>
  21. /* Generic DMA mapping functions: */
  22. /*
  23. * Allocate what Linux calls "coherent" memory. On TILEPro this is
  24. * uncached memory; on TILE-Gx it is hash-for-home memory.
  25. */
  26. #ifdef __tilepro__
  27. #define PAGE_HOME_DMA PAGE_HOME_UNCACHED
  28. #else
  29. #define PAGE_HOME_DMA PAGE_HOME_HASH
  30. #endif
  31. static void *tile_dma_alloc_coherent(struct device *dev, size_t size,
  32. dma_addr_t *dma_handle, gfp_t gfp,
  33. unsigned long attrs)
  34. {
  35. u64 dma_mask = (dev && dev->coherent_dma_mask) ?
  36. dev->coherent_dma_mask : DMA_BIT_MASK(32);
  37. int node = dev ? dev_to_node(dev) : 0;
  38. int order = get_order(size);
  39. struct page *pg;
  40. dma_addr_t addr;
  41. gfp |= __GFP_ZERO;
  42. /*
  43. * If the mask specifies that the memory be in the first 4 GB, then
  44. * we force the allocation to come from the DMA zone. We also
  45. * force the node to 0 since that's the only node where the DMA
  46. * zone isn't empty. If the mask size is smaller than 32 bits, we
  47. * may still not be able to guarantee a suitable memory address, in
  48. * which case we will return NULL. But such devices are uncommon.
  49. */
  50. if (dma_mask <= DMA_BIT_MASK(32)) {
  51. gfp |= GFP_DMA32;
  52. node = 0;
  53. }
  54. pg = homecache_alloc_pages_node(node, gfp, order, PAGE_HOME_DMA);
  55. if (pg == NULL)
  56. return NULL;
  57. addr = page_to_phys(pg);
  58. if (addr + size > dma_mask) {
  59. __homecache_free_pages(pg, order);
  60. return NULL;
  61. }
  62. *dma_handle = addr;
  63. return page_address(pg);
  64. }
  65. /*
  66. * Free memory that was allocated with tile_dma_alloc_coherent.
  67. */
  68. static void tile_dma_free_coherent(struct device *dev, size_t size,
  69. void *vaddr, dma_addr_t dma_handle,
  70. unsigned long attrs)
  71. {
  72. homecache_free_pages((unsigned long)vaddr, get_order(size));
  73. }
  74. /*
  75. * The map routines "map" the specified address range for DMA
  76. * accesses. The memory belongs to the device after this call is
  77. * issued, until it is unmapped with dma_unmap_single.
  78. *
  79. * We don't need to do any mapping, we just flush the address range
  80. * out of the cache and return a DMA address.
  81. *
  82. * The unmap routines do whatever is necessary before the processor
  83. * accesses the memory again, and must be called before the driver
  84. * touches the memory. We can get away with a cache invalidate if we
  85. * can count on nothing having been touched.
  86. */
  87. /* Set up a single page for DMA access. */
  88. static void __dma_prep_page(struct page *page, unsigned long offset,
  89. size_t size, enum dma_data_direction direction)
  90. {
  91. /*
  92. * Flush the page from cache if necessary.
  93. * On tilegx, data is delivered to hash-for-home L3; on tilepro,
  94. * data is delivered direct to memory.
  95. *
  96. * NOTE: If we were just doing DMA_TO_DEVICE we could optimize
  97. * this to be a "flush" not a "finv" and keep some of the
  98. * state in cache across the DMA operation, but it doesn't seem
  99. * worth creating the necessary flush_buffer_xxx() infrastructure.
  100. */
  101. int home = page_home(page);
  102. switch (home) {
  103. case PAGE_HOME_HASH:
  104. #ifdef __tilegx__
  105. return;
  106. #endif
  107. break;
  108. case PAGE_HOME_UNCACHED:
  109. #ifdef __tilepro__
  110. return;
  111. #endif
  112. break;
  113. case PAGE_HOME_IMMUTABLE:
  114. /* Should be going to the device only. */
  115. BUG_ON(direction == DMA_FROM_DEVICE ||
  116. direction == DMA_BIDIRECTIONAL);
  117. return;
  118. case PAGE_HOME_INCOHERENT:
  119. /* Incoherent anyway, so no need to work hard here. */
  120. return;
  121. default:
  122. BUG_ON(home < 0 || home >= NR_CPUS);
  123. break;
  124. }
  125. homecache_finv_page(page);
  126. #ifdef DEBUG_ALIGNMENT
  127. /* Warn if the region isn't cacheline aligned. */
  128. if (offset & (L2_CACHE_BYTES - 1) || (size & (L2_CACHE_BYTES - 1)))
  129. pr_warn("Unaligned DMA to non-hfh memory: PA %#llx/%#lx\n",
  130. PFN_PHYS(page_to_pfn(page)) + offset, size);
  131. #endif
  132. }
  133. /* Make the page ready to be read by the core. */
  134. static void __dma_complete_page(struct page *page, unsigned long offset,
  135. size_t size, enum dma_data_direction direction)
  136. {
  137. #ifdef __tilegx__
  138. switch (page_home(page)) {
  139. case PAGE_HOME_HASH:
  140. /* I/O device delivered data the way the cpu wanted it. */
  141. break;
  142. case PAGE_HOME_INCOHERENT:
  143. /* Incoherent anyway, so no need to work hard here. */
  144. break;
  145. case PAGE_HOME_IMMUTABLE:
  146. /* Extra read-only copies are not a problem. */
  147. break;
  148. default:
  149. /* Flush the bogus hash-for-home I/O entries to memory. */
  150. homecache_finv_map_page(page, PAGE_HOME_HASH);
  151. break;
  152. }
  153. #endif
  154. }
  155. static void __dma_prep_pa_range(dma_addr_t dma_addr, size_t size,
  156. enum dma_data_direction direction)
  157. {
  158. struct page *page = pfn_to_page(PFN_DOWN(dma_addr));
  159. unsigned long offset = dma_addr & (PAGE_SIZE - 1);
  160. size_t bytes = min(size, (size_t)(PAGE_SIZE - offset));
  161. while (size != 0) {
  162. __dma_prep_page(page, offset, bytes, direction);
  163. size -= bytes;
  164. ++page;
  165. offset = 0;
  166. bytes = min((size_t)PAGE_SIZE, size);
  167. }
  168. }
  169. static void __dma_complete_pa_range(dma_addr_t dma_addr, size_t size,
  170. enum dma_data_direction direction)
  171. {
  172. struct page *page = pfn_to_page(PFN_DOWN(dma_addr));
  173. unsigned long offset = dma_addr & (PAGE_SIZE - 1);
  174. size_t bytes = min(size, (size_t)(PAGE_SIZE - offset));
  175. while (size != 0) {
  176. __dma_complete_page(page, offset, bytes, direction);
  177. size -= bytes;
  178. ++page;
  179. offset = 0;
  180. bytes = min((size_t)PAGE_SIZE, size);
  181. }
  182. }
  183. static int tile_dma_map_sg(struct device *dev, struct scatterlist *sglist,
  184. int nents, enum dma_data_direction direction,
  185. unsigned long attrs)
  186. {
  187. struct scatterlist *sg;
  188. int i;
  189. BUG_ON(!valid_dma_direction(direction));
  190. WARN_ON(nents == 0 || sglist->length == 0);
  191. for_each_sg(sglist, sg, nents, i) {
  192. sg->dma_address = sg_phys(sg);
  193. #ifdef CONFIG_NEED_SG_DMA_LENGTH
  194. sg->dma_length = sg->length;
  195. #endif
  196. if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
  197. continue;
  198. __dma_prep_pa_range(sg->dma_address, sg->length, direction);
  199. }
  200. return nents;
  201. }
  202. static void tile_dma_unmap_sg(struct device *dev, struct scatterlist *sglist,
  203. int nents, enum dma_data_direction direction,
  204. unsigned long attrs)
  205. {
  206. struct scatterlist *sg;
  207. int i;
  208. BUG_ON(!valid_dma_direction(direction));
  209. for_each_sg(sglist, sg, nents, i) {
  210. sg->dma_address = sg_phys(sg);
  211. if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
  212. continue;
  213. __dma_complete_pa_range(sg->dma_address, sg->length,
  214. direction);
  215. }
  216. }
  217. static dma_addr_t tile_dma_map_page(struct device *dev, struct page *page,
  218. unsigned long offset, size_t size,
  219. enum dma_data_direction direction,
  220. unsigned long attrs)
  221. {
  222. BUG_ON(!valid_dma_direction(direction));
  223. BUG_ON(offset + size > PAGE_SIZE);
  224. if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
  225. __dma_prep_page(page, offset, size, direction);
  226. return page_to_pa(page) + offset;
  227. }
  228. static void tile_dma_unmap_page(struct device *dev, dma_addr_t dma_address,
  229. size_t size, enum dma_data_direction direction,
  230. unsigned long attrs)
  231. {
  232. BUG_ON(!valid_dma_direction(direction));
  233. if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
  234. return;
  235. __dma_complete_page(pfn_to_page(PFN_DOWN(dma_address)),
  236. dma_address & (PAGE_SIZE - 1), size, direction);
  237. }
  238. static void tile_dma_sync_single_for_cpu(struct device *dev,
  239. dma_addr_t dma_handle,
  240. size_t size,
  241. enum dma_data_direction direction)
  242. {
  243. BUG_ON(!valid_dma_direction(direction));
  244. __dma_complete_pa_range(dma_handle, size, direction);
  245. }
  246. static void tile_dma_sync_single_for_device(struct device *dev,
  247. dma_addr_t dma_handle, size_t size,
  248. enum dma_data_direction direction)
  249. {
  250. __dma_prep_pa_range(dma_handle, size, direction);
  251. }
  252. static void tile_dma_sync_sg_for_cpu(struct device *dev,
  253. struct scatterlist *sglist, int nelems,
  254. enum dma_data_direction direction)
  255. {
  256. struct scatterlist *sg;
  257. int i;
  258. BUG_ON(!valid_dma_direction(direction));
  259. WARN_ON(nelems == 0 || sglist->length == 0);
  260. for_each_sg(sglist, sg, nelems, i) {
  261. dma_sync_single_for_cpu(dev, sg->dma_address,
  262. sg_dma_len(sg), direction);
  263. }
  264. }
  265. static void tile_dma_sync_sg_for_device(struct device *dev,
  266. struct scatterlist *sglist, int nelems,
  267. enum dma_data_direction direction)
  268. {
  269. struct scatterlist *sg;
  270. int i;
  271. BUG_ON(!valid_dma_direction(direction));
  272. WARN_ON(nelems == 0 || sglist->length == 0);
  273. for_each_sg(sglist, sg, nelems, i) {
  274. dma_sync_single_for_device(dev, sg->dma_address,
  275. sg_dma_len(sg), direction);
  276. }
  277. }
  278. static const struct dma_map_ops tile_default_dma_map_ops = {
  279. .alloc = tile_dma_alloc_coherent,
  280. .free = tile_dma_free_coherent,
  281. .map_page = tile_dma_map_page,
  282. .unmap_page = tile_dma_unmap_page,
  283. .map_sg = tile_dma_map_sg,
  284. .unmap_sg = tile_dma_unmap_sg,
  285. .sync_single_for_cpu = tile_dma_sync_single_for_cpu,
  286. .sync_single_for_device = tile_dma_sync_single_for_device,
  287. .sync_sg_for_cpu = tile_dma_sync_sg_for_cpu,
  288. .sync_sg_for_device = tile_dma_sync_sg_for_device,
  289. };
  290. const struct dma_map_ops *tile_dma_map_ops = &tile_default_dma_map_ops;
  291. EXPORT_SYMBOL(tile_dma_map_ops);
  292. /* Generic PCI DMA mapping functions */
  293. static void *tile_pci_dma_alloc_coherent(struct device *dev, size_t size,
  294. dma_addr_t *dma_handle, gfp_t gfp,
  295. unsigned long attrs)
  296. {
  297. int node = dev_to_node(dev);
  298. int order = get_order(size);
  299. struct page *pg;
  300. dma_addr_t addr;
  301. gfp |= __GFP_ZERO;
  302. pg = homecache_alloc_pages_node(node, gfp, order, PAGE_HOME_DMA);
  303. if (pg == NULL)
  304. return NULL;
  305. addr = page_to_phys(pg);
  306. *dma_handle = addr + get_dma_offset(dev);
  307. return page_address(pg);
  308. }
  309. /*
  310. * Free memory that was allocated with tile_pci_dma_alloc_coherent.
  311. */
  312. static void tile_pci_dma_free_coherent(struct device *dev, size_t size,
  313. void *vaddr, dma_addr_t dma_handle,
  314. unsigned long attrs)
  315. {
  316. homecache_free_pages((unsigned long)vaddr, get_order(size));
  317. }
  318. static int tile_pci_dma_map_sg(struct device *dev, struct scatterlist *sglist,
  319. int nents, enum dma_data_direction direction,
  320. unsigned long attrs)
  321. {
  322. struct scatterlist *sg;
  323. int i;
  324. BUG_ON(!valid_dma_direction(direction));
  325. WARN_ON(nents == 0 || sglist->length == 0);
  326. for_each_sg(sglist, sg, nents, i) {
  327. sg->dma_address = sg_phys(sg);
  328. __dma_prep_pa_range(sg->dma_address, sg->length, direction);
  329. sg->dma_address = sg->dma_address + get_dma_offset(dev);
  330. #ifdef CONFIG_NEED_SG_DMA_LENGTH
  331. sg->dma_length = sg->length;
  332. #endif
  333. }
  334. return nents;
  335. }
  336. static void tile_pci_dma_unmap_sg(struct device *dev,
  337. struct scatterlist *sglist, int nents,
  338. enum dma_data_direction direction,
  339. unsigned long attrs)
  340. {
  341. struct scatterlist *sg;
  342. int i;
  343. BUG_ON(!valid_dma_direction(direction));
  344. for_each_sg(sglist, sg, nents, i) {
  345. sg->dma_address = sg_phys(sg);
  346. __dma_complete_pa_range(sg->dma_address, sg->length,
  347. direction);
  348. }
  349. }
  350. static dma_addr_t tile_pci_dma_map_page(struct device *dev, struct page *page,
  351. unsigned long offset, size_t size,
  352. enum dma_data_direction direction,
  353. unsigned long attrs)
  354. {
  355. BUG_ON(!valid_dma_direction(direction));
  356. BUG_ON(offset + size > PAGE_SIZE);
  357. __dma_prep_page(page, offset, size, direction);
  358. return page_to_pa(page) + offset + get_dma_offset(dev);
  359. }
  360. static void tile_pci_dma_unmap_page(struct device *dev, dma_addr_t dma_address,
  361. size_t size,
  362. enum dma_data_direction direction,
  363. unsigned long attrs)
  364. {
  365. BUG_ON(!valid_dma_direction(direction));
  366. dma_address -= get_dma_offset(dev);
  367. __dma_complete_page(pfn_to_page(PFN_DOWN(dma_address)),
  368. dma_address & (PAGE_SIZE - 1), size, direction);
  369. }
  370. static void tile_pci_dma_sync_single_for_cpu(struct device *dev,
  371. dma_addr_t dma_handle,
  372. size_t size,
  373. enum dma_data_direction direction)
  374. {
  375. BUG_ON(!valid_dma_direction(direction));
  376. dma_handle -= get_dma_offset(dev);
  377. __dma_complete_pa_range(dma_handle, size, direction);
  378. }
  379. static void tile_pci_dma_sync_single_for_device(struct device *dev,
  380. dma_addr_t dma_handle,
  381. size_t size,
  382. enum dma_data_direction
  383. direction)
  384. {
  385. dma_handle -= get_dma_offset(dev);
  386. __dma_prep_pa_range(dma_handle, size, direction);
  387. }
  388. static void tile_pci_dma_sync_sg_for_cpu(struct device *dev,
  389. struct scatterlist *sglist,
  390. int nelems,
  391. enum dma_data_direction direction)
  392. {
  393. struct scatterlist *sg;
  394. int i;
  395. BUG_ON(!valid_dma_direction(direction));
  396. WARN_ON(nelems == 0 || sglist->length == 0);
  397. for_each_sg(sglist, sg, nelems, i) {
  398. dma_sync_single_for_cpu(dev, sg->dma_address,
  399. sg_dma_len(sg), direction);
  400. }
  401. }
  402. static void tile_pci_dma_sync_sg_for_device(struct device *dev,
  403. struct scatterlist *sglist,
  404. int nelems,
  405. enum dma_data_direction direction)
  406. {
  407. struct scatterlist *sg;
  408. int i;
  409. BUG_ON(!valid_dma_direction(direction));
  410. WARN_ON(nelems == 0 || sglist->length == 0);
  411. for_each_sg(sglist, sg, nelems, i) {
  412. dma_sync_single_for_device(dev, sg->dma_address,
  413. sg_dma_len(sg), direction);
  414. }
  415. }
  416. static const struct dma_map_ops tile_pci_default_dma_map_ops = {
  417. .alloc = tile_pci_dma_alloc_coherent,
  418. .free = tile_pci_dma_free_coherent,
  419. .map_page = tile_pci_dma_map_page,
  420. .unmap_page = tile_pci_dma_unmap_page,
  421. .map_sg = tile_pci_dma_map_sg,
  422. .unmap_sg = tile_pci_dma_unmap_sg,
  423. .sync_single_for_cpu = tile_pci_dma_sync_single_for_cpu,
  424. .sync_single_for_device = tile_pci_dma_sync_single_for_device,
  425. .sync_sg_for_cpu = tile_pci_dma_sync_sg_for_cpu,
  426. .sync_sg_for_device = tile_pci_dma_sync_sg_for_device,
  427. };
  428. const struct dma_map_ops *gx_pci_dma_map_ops = &tile_pci_default_dma_map_ops;
  429. EXPORT_SYMBOL(gx_pci_dma_map_ops);
  430. /* PCI DMA mapping functions for legacy PCI devices */
  431. #ifdef CONFIG_SWIOTLB
  432. static const struct dma_map_ops pci_hybrid_dma_ops = {
  433. .alloc = swiotlb_alloc,
  434. .free = swiotlb_free,
  435. .map_page = tile_pci_dma_map_page,
  436. .unmap_page = tile_pci_dma_unmap_page,
  437. .map_sg = tile_pci_dma_map_sg,
  438. .unmap_sg = tile_pci_dma_unmap_sg,
  439. .sync_single_for_cpu = tile_pci_dma_sync_single_for_cpu,
  440. .sync_single_for_device = tile_pci_dma_sync_single_for_device,
  441. .sync_sg_for_cpu = tile_pci_dma_sync_sg_for_cpu,
  442. .sync_sg_for_device = tile_pci_dma_sync_sg_for_device,
  443. };
  444. const struct dma_map_ops *gx_legacy_pci_dma_map_ops = &swiotlb_dma_ops;
  445. const struct dma_map_ops *gx_hybrid_pci_dma_map_ops = &pci_hybrid_dma_ops;
  446. #else
  447. const struct dma_map_ops *gx_legacy_pci_dma_map_ops;
  448. const struct dma_map_ops *gx_hybrid_pci_dma_map_ops;
  449. #endif
  450. EXPORT_SYMBOL(gx_legacy_pci_dma_map_ops);
  451. EXPORT_SYMBOL(gx_hybrid_pci_dma_map_ops);
  452. int dma_set_mask(struct device *dev, u64 mask)
  453. {
  454. const struct dma_map_ops *dma_ops = get_dma_ops(dev);
  455. /*
  456. * For PCI devices with 64-bit DMA addressing capability, promote
  457. * the dma_ops to hybrid, with the consistent memory DMA space limited
  458. * to 32-bit. For 32-bit capable devices, limit the streaming DMA
  459. * address range to max_direct_dma_addr.
  460. */
  461. if (dma_ops == gx_pci_dma_map_ops ||
  462. dma_ops == gx_hybrid_pci_dma_map_ops ||
  463. dma_ops == gx_legacy_pci_dma_map_ops) {
  464. if (mask == DMA_BIT_MASK(64) &&
  465. dma_ops == gx_legacy_pci_dma_map_ops)
  466. set_dma_ops(dev, gx_hybrid_pci_dma_map_ops);
  467. else if (mask > dev->archdata.max_direct_dma_addr)
  468. mask = dev->archdata.max_direct_dma_addr;
  469. }
  470. if (!dev->dma_mask || !dma_supported(dev, mask))
  471. return -EIO;
  472. *dev->dma_mask = mask;
  473. return 0;
  474. }
  475. EXPORT_SYMBOL(dma_set_mask);
  476. #ifdef CONFIG_ARCH_HAS_DMA_SET_COHERENT_MASK
  477. int dma_set_coherent_mask(struct device *dev, u64 mask)
  478. {
  479. const struct dma_map_ops *dma_ops = get_dma_ops(dev);
  480. /*
  481. * For PCI devices with 64-bit DMA addressing capability, promote
  482. * the dma_ops to full capability for both streams and consistent
  483. * memory access. For 32-bit capable devices, limit the consistent
  484. * memory DMA range to max_direct_dma_addr.
  485. */
  486. if (dma_ops == gx_pci_dma_map_ops ||
  487. dma_ops == gx_hybrid_pci_dma_map_ops ||
  488. dma_ops == gx_legacy_pci_dma_map_ops) {
  489. if (mask == DMA_BIT_MASK(64))
  490. set_dma_ops(dev, gx_pci_dma_map_ops);
  491. else if (mask > dev->archdata.max_direct_dma_addr)
  492. mask = dev->archdata.max_direct_dma_addr;
  493. }
  494. if (!dma_supported(dev, mask))
  495. return -EIO;
  496. dev->coherent_dma_mask = mask;
  497. return 0;
  498. }
  499. EXPORT_SYMBOL(dma_set_coherent_mask);
  500. #endif
  501. #ifdef ARCH_HAS_DMA_GET_REQUIRED_MASK
  502. /*
  503. * The generic dma_get_required_mask() uses the highest physical address
  504. * (max_pfn) to provide the hint to the PCI drivers regarding 32-bit or
  505. * 64-bit DMA configuration. Since TILEGx has I/O TLB/MMU, allowing the
  506. * DMAs to use the full 64-bit PCI address space and not limited by
  507. * the physical memory space, we always let the PCI devices use
  508. * 64-bit DMA if they have that capability, by returning the 64-bit
  509. * DMA mask here. The device driver has the option to use 32-bit DMA if
  510. * the device is not capable of 64-bit DMA.
  511. */
  512. u64 dma_get_required_mask(struct device *dev)
  513. {
  514. return DMA_BIT_MASK(64);
  515. }
  516. EXPORT_SYMBOL_GPL(dma_get_required_mask);
  517. #endif