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