David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0-or-later |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 2 | /* |
| 3 | * Contains routines needed to support swiotlb for ppc. |
| 4 | * |
| 5 | * Copyright (C) 2009-2010 Freescale Semiconductor, Inc. |
| 6 | * Author: Becky Bruce |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 7 | */ |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 8 | #include <linux/memblock.h> |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 9 | #include <asm/machdep.h> |
| 10 | #include <asm/swiotlb.h> |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 11 | |
| 12 | unsigned int ppc_swiotlb_enable; |
| 13 | |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 14 | void __init swiotlb_detect_4g(void) |
| 15 | { |
David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame] | 16 | if ((memblock_end_of_DRAM() - 1) > 0xffffffff) |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 17 | ppc_swiotlb_enable = 1; |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 18 | } |
| 19 | |
| 20 | static int __init check_swiotlb_enabled(void) |
| 21 | { |
| 22 | if (ppc_swiotlb_enable) |
| 23 | swiotlb_print_info(); |
| 24 | else |
| 25 | swiotlb_exit(); |
| 26 | |
| 27 | return 0; |
| 28 | } |
| 29 | subsys_initcall(check_swiotlb_enabled); |