2019-05-27 06:55:01 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2009-05-14 12:42:28 +00:00
|
|
|
/*
|
|
|
|
* Contains routines needed to support swiotlb for ppc.
|
|
|
|
*
|
2010-05-03 12:36:22 +00:00
|
|
|
* Copyright (C) 2009-2010 Freescale Semiconductor, Inc.
|
|
|
|
* Author: Becky Bruce
|
2009-05-14 12:42:28 +00:00
|
|
|
*/
|
2012-07-25 21:20:03 +00:00
|
|
|
#include <linux/memblock.h>
|
2009-05-14 12:42:28 +00:00
|
|
|
#include <asm/machdep.h>
|
|
|
|
#include <asm/swiotlb.h>
|
|
|
|
|
|
|
|
unsigned int ppc_swiotlb_enable;
|
|
|
|
|
2014-08-08 23:40:44 +00:00
|
|
|
void __init swiotlb_detect_4g(void)
|
2012-08-03 10:14:10 +00:00
|
|
|
{
|
2018-12-16 16:53:49 +00:00
|
|
|
if ((memblock_end_of_DRAM() - 1) > 0xffffffff)
|
2012-08-03 10:14:10 +00:00
|
|
|
ppc_swiotlb_enable = 1;
|
|
|
|
}
|
|
|
|
|
2015-04-10 03:15:47 +00:00
|
|
|
static int __init check_swiotlb_enabled(void)
|
2012-08-03 10:14:10 +00:00
|
|
|
{
|
2015-04-10 03:15:47 +00:00
|
|
|
if (ppc_swiotlb_enable)
|
2012-08-03 10:14:10 +00:00
|
|
|
swiotlb_print_info();
|
2015-04-10 03:15:47 +00:00
|
|
|
else
|
2017-12-23 13:14:54 +00:00
|
|
|
swiotlb_exit();
|
2012-08-03 10:14:10 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2015-04-10 03:15:47 +00:00
|
|
|
subsys_initcall(check_swiotlb_enabled);
|