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