mirror of
https://github.com/hardkernel/linux.git
synced 2026-04-01 10:42:58 +09:00
PD#SWPL-6028 Problem: enable ftrce in ramoops for new tm2 dtbs Solution: enable ftrce in ramoops for new tm2 dtbs Verify: verified ok Change-Id: Ia7ee3b11784a69ef7d6b7671f9ad75c14ae477f7 Signed-off-by: Jianxin Pan <jianxin.pan@amlogic.com> Signed-off-by: Luan Yuan <luan.yuan@amlogic.com> debug: improve ftrace_ramoops for io trace [2/2] PD#SWPL-6028 Problem: improve ftrace_ramoops to debug bus hang Solution: 1. in uboot setenv initargs $initargs ramoops_io_en=1 loglevel=3;save;reset 2. in linux command line: cat /sys/module/kernel/parameters/ramoops_io_en to check if success. 3. after watchdog reboot, get trace data with: cat /sys/fs/pstore/ftrace-ramoops-0 Verify: TL1 x301 Change-Id: If1a2582b40a3ded31eedef5355eb0b8a5bf495c3 Signed-off-by: Jianxin Pan <jianxin.pan@amlogic.com> debug: save irqflag locally when ftrace_ramoops io [1/1] PD#SWPL-6028 Problem: save irqflag locally when ftrace_ramoops io Solution: save irqflag locally when ftrace_ramoops io Verify: TL1 x301 Change-Id: I6df9700cceaccc97dc983d88ada73197a6968f73 Signed-off-by: Jianxin Pan <jianxin.pan@amlogic.com> debug: do not print old_size when ftrace_size is 0 [1/1] PD#SWPL-6028 Problem: do not print old_size when ftrace_size is 0 Solution: do not print old_size when ftrace_size is 0 Verify: TL1 x301 Change-Id: I00a71c83fede14a2606c5e7eea5d8c4fdaeb5553 Signed-off-by: Jianxin Pan <jianxin.pan@amlogic.com> dts: change ftrace-size. [1/1] PD#SWPL-6028 Problem: add ftrace-size. Solution: add ftrace-size. Verify: no. Change-Id: I42d34edf665632dfe29d04df192964238b8e3df8 Signed-off-by: Jianxiong Pan <jianxiong.pan@amlogic.com> Signed-off-by: Luan Yuan <luan.yuan@amlogic.com>
132 lines
2.8 KiB
C
132 lines
2.8 KiB
C
/*
|
|
* Based on arch/arm/kernel/io.c
|
|
*
|
|
* Copyright (C) 2012 ARM Ltd.
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
* published by the Free Software Foundation.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#include <linux/export.h>
|
|
#include <linux/types.h>
|
|
#define SKIP_IO_TRACE
|
|
#include <linux/io.h>
|
|
#undef SKIP_IO_TRACE
|
|
#ifdef CONFIG_AMLOGIC_DEBUG_FTRACE_PSTORE
|
|
#include <linux/amlogic/debug_ftrace_ramoops.h>
|
|
#endif
|
|
|
|
/*
|
|
* Copy data from IO memory space to "real" memory space.
|
|
*/
|
|
void __memcpy_fromio(void *to, const volatile void __iomem *from, size_t count)
|
|
{
|
|
#ifdef CONFIG_AMLOGIC_DEBUG_FTRACE_PSTORE
|
|
pstore_ftrace_io_rd((unsigned long)addr);
|
|
#endif
|
|
while (count && !IS_ALIGNED((unsigned long)from, 8)) {
|
|
*(u8 *)to = __raw_readb(from);
|
|
from++;
|
|
to++;
|
|
count--;
|
|
}
|
|
|
|
while (count >= 8) {
|
|
*(u64 *)to = __raw_readq(from);
|
|
from += 8;
|
|
to += 8;
|
|
count -= 8;
|
|
}
|
|
|
|
while (count) {
|
|
*(u8 *)to = __raw_readb(from);
|
|
from++;
|
|
to++;
|
|
count--;
|
|
}
|
|
#ifdef CONFIG_AMLOGIC_DEBUG_FTRACE_PSTORE
|
|
pstore_ftrace_io_rd_end((unsigned long)addr);
|
|
#endif
|
|
}
|
|
EXPORT_SYMBOL(__memcpy_fromio);
|
|
|
|
/*
|
|
* Copy data from "real" memory space to IO memory space.
|
|
*/
|
|
void __memcpy_toio(volatile void __iomem *to, const void *from, size_t count)
|
|
{
|
|
#ifdef CONFIG_AMLOGIC_DEBUG_FTRACE_PSTORE
|
|
pstore_ftrace_io_wr((unsigned long)addr, 0x1234);
|
|
#endif
|
|
while (count && !IS_ALIGNED((unsigned long)to, 8)) {
|
|
__raw_writeb(*(u8 *)from, to);
|
|
from++;
|
|
to++;
|
|
count--;
|
|
}
|
|
|
|
while (count >= 8) {
|
|
__raw_writeq(*(u64 *)from, to);
|
|
from += 8;
|
|
to += 8;
|
|
count -= 8;
|
|
}
|
|
|
|
while (count) {
|
|
__raw_writeb(*(u8 *)from, to);
|
|
from++;
|
|
to++;
|
|
count--;
|
|
}
|
|
#ifdef CONFIG_AMLOGIC_DEBUG_FTRACE_PSTORE
|
|
pstore_ftrace_io_wr_end((unsigned long)addr, 0x1234);
|
|
#endif
|
|
}
|
|
EXPORT_SYMBOL(__memcpy_toio);
|
|
|
|
/*
|
|
* "memset" on IO memory space.
|
|
*/
|
|
void __memset_io(volatile void __iomem *dst, int c, size_t count)
|
|
{
|
|
u64 qc = (u8)c;
|
|
|
|
#ifdef CONFIG_AMLOGIC_DEBUG_FTRACE_PSTORE
|
|
pstore_ftrace_io_wr((unsigned long)addr, 0xabcd);
|
|
#endif
|
|
qc |= qc << 8;
|
|
qc |= qc << 16;
|
|
qc |= qc << 32;
|
|
|
|
while (count && !IS_ALIGNED((unsigned long)dst, 8)) {
|
|
__raw_writeb(c, dst);
|
|
dst++;
|
|
count--;
|
|
}
|
|
|
|
while (count >= 8) {
|
|
__raw_writeq(qc, dst);
|
|
dst += 8;
|
|
count -= 8;
|
|
}
|
|
|
|
while (count) {
|
|
__raw_writeb(c, dst);
|
|
dst++;
|
|
count--;
|
|
}
|
|
#ifdef CONFIG_AMLOGIC_DEBUG_FTRACE_PSTORE
|
|
pstore_ftrace_io_wr_end((unsigned long)addr, 0xabcd);
|
|
#endif
|
|
}
|
|
EXPORT_SYMBOL(__memset_io);
|