xref: /linux/arch/powerpc/kernel/dma-swiotlb.c (revision b60a5b8dcf49af9f2c60ae82e0383ee8e62a9a52)
1 /*
2  * Contains routines needed to support swiotlb for ppc.
3  *
4  * Copyright (C) 2009-2010 Freescale Semiconductor, Inc.
5  * Author: Becky Bruce
6  *
7  * This program is free software; you can redistribute  it and/or modify it
8  * under  the terms of  the GNU General  Public License as published by the
9  * Free Software Foundation;  either version 2 of the  License, or (at your
10  * option) any later version.
11  *
12  */
13 #include <linux/memblock.h>
14 #include <asm/machdep.h>
15 #include <asm/swiotlb.h>
16 
17 unsigned int ppc_swiotlb_enable;
18 
19 void __init swiotlb_detect_4g(void)
20 {
21 	if ((memblock_end_of_DRAM() - 1) > 0xffffffff)
22 		ppc_swiotlb_enable = 1;
23 }
24 
25 static int __init check_swiotlb_enabled(void)
26 {
27 	if (ppc_swiotlb_enable)
28 		swiotlb_print_info();
29 	else
30 		swiotlb_exit();
31 
32 	return 0;
33 }
34 subsys_initcall(check_swiotlb_enabled);
35