dma-swiotlb.c 626 B

123456789101112131415161718192021222324252627282930
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. /*
  3. * Contains routines needed to support swiotlb for ppc.
  4. *
  5. * Copyright (C) 2009-2010 Freescale Semiconductor, Inc.
  6. * Author: Becky Bruce
  7. */
  8. #include <linux/memblock.h>
  9. #include <asm/machdep.h>
  10. #include <asm/swiotlb.h>
  11. unsigned int ppc_swiotlb_enable;
  12. unsigned int ppc_swiotlb_flags;
  13. void __init swiotlb_detect_4g(void)
  14. {
  15. if ((memblock_end_of_DRAM() - 1) > 0xffffffff)
  16. ppc_swiotlb_enable = 1;
  17. }
  18. static int __init check_swiotlb_enabled(void)
  19. {
  20. if (ppc_swiotlb_enable)
  21. swiotlb_print_info();
  22. else
  23. swiotlb_exit();
  24. return 0;
  25. }
  26. subsys_initcall(check_swiotlb_enabled);