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