Change-Id: Ibb536c88f0dbaf4766d0599296907e35e42cbfd6
Signed-off-by: Iliyan Malchev <malchev@google.com>
Signed-off-by: Arve Hjønnevåg <arve@android.com>
[AmitP: Upstream commit 2a1f062a4a
("sched/headers: Move signal wakeup &
sigpending methods from <linux/sched.h> into <linux/sched/signal.h>")
moved few signal definitions to <linux/sched/signal.h>. Hence include
that instead of <linux/sched.h>.
Also folded following android-4.9 commit changes into this patch
69279c68eed4 ("ANDROID: ARM: fiq_debugger: fix compiling for v3.3")
d05890d37ecc ("ANDROID: ARM: fiq_debugger: Fix to compile on 3.7")
9de62e0d3f24 ("ANDROID: ARM: fiq_debugger: Use kmsg_dumper to dump kernel logs")]
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
tirimbino
parent
e329aaf322
commit
05e1c7f617
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,94 @@ |
||||
/*
|
||||
* arch/arm/common/fiq_debugger_ringbuf.c |
||||
* |
||||
* simple lockless ringbuffer |
||||
* |
||||
* Copyright (C) 2010 Google, Inc. |
||||
* |
||||
* This software is licensed under the terms of the GNU General Public |
||||
* License version 2, as published by the Free Software Foundation, and |
||||
* may be copied, distributed, and modified under those terms. |
||||
* |
||||
* 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. |
||||
*/ |
||||
|
||||
#include <linux/kernel.h> |
||||
#include <linux/slab.h> |
||||
|
||||
struct fiq_debugger_ringbuf { |
||||
int len; |
||||
int head; |
||||
int tail; |
||||
u8 buf[]; |
||||
}; |
||||
|
||||
|
||||
static inline struct fiq_debugger_ringbuf *fiq_debugger_ringbuf_alloc(int len) |
||||
{ |
||||
struct fiq_debugger_ringbuf *rbuf; |
||||
|
||||
rbuf = kzalloc(sizeof(*rbuf) + len, GFP_KERNEL); |
||||
if (rbuf == NULL) |
||||
return NULL; |
||||
|
||||
rbuf->len = len; |
||||
rbuf->head = 0; |
||||
rbuf->tail = 0; |
||||
smp_mb(); |
||||
|
||||
return rbuf; |
||||
} |
||||
|
||||
static inline void fiq_debugger_ringbuf_free(struct fiq_debugger_ringbuf *rbuf) |
||||
{ |
||||
kfree(rbuf); |
||||
} |
||||
|
||||
static inline int fiq_debugger_ringbuf_level(struct fiq_debugger_ringbuf *rbuf) |
||||
{ |
||||
int level = rbuf->head - rbuf->tail; |
||||
|
||||
if (level < 0) |
||||
level = rbuf->len + level; |
||||
|
||||
return level; |
||||
} |
||||
|
||||
static inline int fiq_debugger_ringbuf_room(struct fiq_debugger_ringbuf *rbuf) |
||||
{ |
||||
return rbuf->len - fiq_debugger_ringbuf_level(rbuf) - 1; |
||||
} |
||||
|
||||
static inline u8 |
||||
fiq_debugger_ringbuf_peek(struct fiq_debugger_ringbuf *rbuf, int i) |
||||
{ |
||||
return rbuf->buf[(rbuf->tail + i) % rbuf->len]; |
||||
} |
||||
|
||||
static inline int |
||||
fiq_debugger_ringbuf_consume(struct fiq_debugger_ringbuf *rbuf, int count) |
||||
{ |
||||
count = min(count, fiq_debugger_ringbuf_level(rbuf)); |
||||
|
||||
rbuf->tail = (rbuf->tail + count) % rbuf->len; |
||||
smp_mb(); |
||||
|
||||
return count; |
||||
} |
||||
|
||||
static inline int |
||||
fiq_debugger_ringbuf_push(struct fiq_debugger_ringbuf *rbuf, u8 datum) |
||||
{ |
||||
if (fiq_debugger_ringbuf_room(rbuf) == 0) |
||||
return 0; |
||||
|
||||
rbuf->buf[rbuf->head] = datum; |
||||
smp_mb(); |
||||
rbuf->head = (rbuf->head + 1) % rbuf->len; |
||||
smp_mb(); |
||||
|
||||
return 1; |
||||
} |
@ -0,0 +1,64 @@ |
||||
/*
|
||||
* arch/arm/include/asm/fiq_debugger.h |
||||
* |
||||
* Copyright (C) 2010 Google, Inc. |
||||
* Author: Colin Cross <ccross@android.com> |
||||
* |
||||
* This software is licensed under the terms of the GNU General Public |
||||
* License version 2, as published by the Free Software Foundation, and |
||||
* may be copied, distributed, and modified under those terms. |
||||
* |
||||
* 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. |
||||
* |
||||
*/ |
||||
|
||||
#ifndef _ARCH_ARM_MACH_TEGRA_FIQ_DEBUGGER_H_ |
||||
#define _ARCH_ARM_MACH_TEGRA_FIQ_DEBUGGER_H_ |
||||
|
||||
#include <linux/serial_core.h> |
||||
|
||||
#define FIQ_DEBUGGER_NO_CHAR NO_POLL_CHAR |
||||
#define FIQ_DEBUGGER_BREAK 0x00ff0100 |
||||
|
||||
#define FIQ_DEBUGGER_FIQ_IRQ_NAME "fiq" |
||||
#define FIQ_DEBUGGER_SIGNAL_IRQ_NAME "signal" |
||||
#define FIQ_DEBUGGER_WAKEUP_IRQ_NAME "wakeup" |
||||
|
||||
/**
|
||||
* struct fiq_debugger_pdata - fiq debugger platform data |
||||
* @uart_resume: used to restore uart state right before enabling |
||||
* the fiq. |
||||
* @uart_enable: Do the work necessary to communicate with the uart |
||||
* hw (enable clocks, etc.). This must be ref-counted. |
||||
* @uart_disable: Do the work necessary to disable the uart hw |
||||
* (disable clocks, etc.). This must be ref-counted. |
||||
* @uart_dev_suspend: called during PM suspend, generally not needed |
||||
* for real fiq mode debugger. |
||||
* @uart_dev_resume: called during PM resume, generally not needed |
||||
* for real fiq mode debugger. |
||||
*/ |
||||
struct fiq_debugger_pdata { |
||||
int (*uart_init)(struct platform_device *pdev); |
||||
void (*uart_free)(struct platform_device *pdev); |
||||
int (*uart_resume)(struct platform_device *pdev); |
||||
int (*uart_getc)(struct platform_device *pdev); |
||||
void (*uart_putc)(struct platform_device *pdev, unsigned int c); |
||||
void (*uart_flush)(struct platform_device *pdev); |
||||
void (*uart_enable)(struct platform_device *pdev); |
||||
void (*uart_disable)(struct platform_device *pdev); |
||||
|
||||
int (*uart_dev_suspend)(struct platform_device *pdev); |
||||
int (*uart_dev_resume)(struct platform_device *pdev); |
||||
|
||||
void (*fiq_enable)(struct platform_device *pdev, unsigned int fiq, |
||||
bool enable); |
||||
void (*fiq_ack)(struct platform_device *pdev, unsigned int fiq); |
||||
|
||||
void (*force_irq)(struct platform_device *pdev, unsigned int irq); |
||||
void (*force_irq_ack)(struct platform_device *pdev, unsigned int irq); |
||||
}; |
||||
|
||||
#endif |
Loading…
Reference in new issue