Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 125019
b: refs/heads/master
c: 52e15f0
h: refs/heads/master
i:
  125017: de6b5e3
  125015: 522f787
v: v3
  • Loading branch information
Sonic Zhang authored and Linus Torvalds committed Jan 2, 2009
1 parent 5309ddf commit 8ceaa83
Show file tree
Hide file tree
Showing 7 changed files with 111 additions and 111 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 609e5b71d0eca163df017ecfcf917b149875e744
refs/heads/master: 52e15f0eae193a8e4ca31c1520179b8d65c79811
187 changes: 89 additions & 98 deletions trunk/drivers/serial/bfin_5xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
#include <linux/tty_flip.h>
#include <linux/serial_core.h>

#ifdef CONFIG_KGDB_UART
#if defined(CONFIG_KGDB_SERIAL_CONSOLE) || \
defined(CONFIG_KGDB_SERIAL_CONSOLE_MODULE)
#include <linux/kgdb.h>
#include <asm/irq_regs.h>
#endif
Expand All @@ -45,6 +46,16 @@
static struct bfin_serial_port bfin_serial_ports[BFIN_UART_NR_PORTS];
static int nr_active_ports = ARRAY_SIZE(bfin_serial_resource);

#if defined(CONFIG_KGDB_SERIAL_CONSOLE) || \
defined(CONFIG_KGDB_SERIAL_CONSOLE_MODULE)

# ifndef CONFIG_SERIAL_BFIN_PIO
# error KGDB only support UART in PIO mode.
# endif

static int kgdboc_port_line;
static int kgdboc_break_enabled;
#endif
/*
* Setup for console. Argument comes from the menuconfig
*/
Expand Down Expand Up @@ -110,9 +121,7 @@ static void bfin_serial_start_tx(struct uart_port *port)
static void bfin_serial_stop_rx(struct uart_port *port)
{
struct bfin_serial_port *uart = (struct bfin_serial_port *)port;
#ifdef CONFIG_KGDB_UART
if (uart->port.line != CONFIG_KGDB_UART_PORT)
#endif

UART_CLEAR_IER(uart, ERBFI);
}

Expand All @@ -123,49 +132,6 @@ static void bfin_serial_enable_ms(struct uart_port *port)
{
}

#ifdef CONFIG_KGDB_UART
static int kgdb_entry_state;

void kgdb_put_debug_char(int chr)
{
struct bfin_serial_port *uart;

if (CONFIG_KGDB_UART_PORT < 0
|| CONFIG_KGDB_UART_PORT >= BFIN_UART_NR_PORTS)
uart = &bfin_serial_ports[0];
else
uart = &bfin_serial_ports[CONFIG_KGDB_UART_PORT];

while (!(UART_GET_LSR(uart) & THRE)) {
SSYNC();
}

UART_CLEAR_DLAB(uart);
UART_PUT_CHAR(uart, (unsigned char)chr);
SSYNC();
}

int kgdb_get_debug_char(void)
{
struct bfin_serial_port *uart;
unsigned char chr;

if (CONFIG_KGDB_UART_PORT < 0
|| CONFIG_KGDB_UART_PORT >= BFIN_UART_NR_PORTS)
uart = &bfin_serial_ports[0];
else
uart = &bfin_serial_ports[CONFIG_KGDB_UART_PORT];

while(!(UART_GET_LSR(uart) & DR)) {
SSYNC();
}
UART_CLEAR_DLAB(uart);
chr = UART_GET_CHAR(uart);
SSYNC();

return chr;
}
#endif

#if ANOMALY_05000363 && defined(CONFIG_SERIAL_BFIN_PIO)
# define UART_GET_ANOMALY_THRESHOLD(uart) ((uart)->anomaly_threshold)
Expand All @@ -178,7 +144,7 @@ int kgdb_get_debug_char(void)
#ifdef CONFIG_SERIAL_BFIN_PIO
static void bfin_serial_rx_chars(struct bfin_serial_port *uart)
{
struct tty_struct *tty = uart->port.info->port.tty;
struct tty_struct *tty = NULL;
unsigned int status, ch, flg;
static struct timeval anomaly_start = { .tv_sec = 0 };

Expand All @@ -188,27 +154,18 @@ static void bfin_serial_rx_chars(struct bfin_serial_port *uart)
ch = UART_GET_CHAR(uart);
uart->port.icount.rx++;

#ifdef CONFIG_KGDB_UART
if (uart->port.line == CONFIG_KGDB_UART_PORT) {
struct pt_regs *regs = get_irq_regs();
if (uart->port.cons->index == CONFIG_KGDB_UART_PORT && ch == 0x1) { /* Ctrl + A */
kgdb_breakkey_pressed(regs);
return;
} else if (kgdb_entry_state == 0 && ch == '$') {/* connection from KGDB */
kgdb_entry_state = 1;
} else if (kgdb_entry_state == 1 && ch == 'q') {
kgdb_entry_state = 0;
kgdb_breakkey_pressed(regs);
#if defined(CONFIG_KGDB_SERIAL_CONSOLE) || \
defined(CONFIG_KGDB_SERIAL_CONSOLE_MODULE)
if (kgdb_connected && kgdboc_port_line == uart->port.line)
if (ch == 0x3) {/* Ctrl + C */
kgdb_breakpoint();
return;
} else if (ch == 0x3) {/* Ctrl + C */
kgdb_entry_state = 0;
kgdb_breakkey_pressed(regs);
return;
} else {
kgdb_entry_state = 0;
}
}

if (!uart->port.info || !uart->port.info->tty)
return;
#endif
tty = uart->port.info->tty;

if (ANOMALY_05000363) {
/* The BF533 (and BF561) family of processors have a nice anomaly
Expand Down Expand Up @@ -630,16 +587,16 @@ static int bfin_serial_startup(struct uart_port *port)
uart->rx_dma_timer.expires = jiffies + DMA_RX_FLUSH_JIFFIES;
add_timer(&(uart->rx_dma_timer));
#else
#if defined(CONFIG_KGDB_SERIAL_CONSOLE) || \
defined(CONFIG_KGDB_SERIAL_CONSOLE_MODULE)
if (kgdboc_port_line == uart->port.line && kgdboc_break_enabled)
kgdboc_break_enabled = 0;
else {
# endif
if (request_irq(uart->port.irq, bfin_serial_rx_int, IRQF_DISABLED,
"BFIN_UART_RX", uart)) {
# ifdef CONFIG_KGDB_UART
if (uart->port.line != CONFIG_KGDB_UART_PORT) {
# endif
printk(KERN_NOTICE "Unable to attach BlackFin UART RX interrupt\n");
return -EBUSY;
# ifdef CONFIG_KGDB_UART
}
# endif
}

if (request_irq
Expand Down Expand Up @@ -685,6 +642,10 @@ static int bfin_serial_startup(struct uart_port *port)
}
}
# endif
#if defined(CONFIG_KGDB_SERIAL_CONSOLE) || \
defined(CONFIG_KGDB_SERIAL_CONSOLE_MODULE)
}
# endif
#endif
UART_SET_IER(uart, ERBFI);
return 0;
Expand Down Expand Up @@ -715,9 +676,6 @@ static void bfin_serial_shutdown(struct uart_port *port)
default:
break;
};
#endif
#ifdef CONFIG_KGDB_UART
if (uart->port.line != CONFIG_KGDB_UART_PORT)
#endif
free_irq(uart->port.irq, uart);
free_irq(uart->port.irq+1, uart);
Expand Down Expand Up @@ -887,6 +845,51 @@ static void bfin_serial_set_ldisc(struct uart_port *port)
}
}

#ifdef CONFIG_CONSOLE_POLL
static void bfin_serial_poll_put_char(struct uart_port *port, unsigned char chr)
{
struct bfin_serial_port *uart = (struct bfin_serial_port *)port;

while (!(UART_GET_LSR(uart) & THRE))
cpu_relax();

UART_CLEAR_DLAB(uart);
UART_PUT_CHAR(uart, (unsigned char)chr);
}

static int bfin_serial_poll_get_char(struct uart_port *port)
{
struct bfin_serial_port *uart = (struct bfin_serial_port *)port;
unsigned char chr;

while (!(UART_GET_LSR(uart) & DR))
cpu_relax();

UART_CLEAR_DLAB(uart);
chr = UART_GET_CHAR(uart);

return chr;
}
#endif

#if defined(CONFIG_KGDB_SERIAL_CONSOLE) || \
defined(CONFIG_KGDB_SERIAL_CONSOLE_MODULE)
static void bfin_kgdboc_port_shutdown(struct uart_port *port)
{
if (kgdboc_break_enabled) {
kgdboc_break_enabled = 0;
bfin_serial_shutdown(port);
}
}

static int bfin_kgdboc_port_startup(struct uart_port *port)
{
kgdboc_port_line = port->line;
kgdboc_break_enabled = !bfin_serial_startup(port);
return 0;
}
#endif

static struct uart_ops bfin_serial_pops = {
.tx_empty = bfin_serial_tx_empty,
.set_mctrl = bfin_serial_set_mctrl,
Expand All @@ -905,6 +908,15 @@ static struct uart_ops bfin_serial_pops = {
.request_port = bfin_serial_request_port,
.config_port = bfin_serial_config_port,
.verify_port = bfin_serial_verify_port,
#if defined(CONFIG_KGDB_SERIAL_CONSOLE) || \
defined(CONFIG_KGDB_SERIAL_CONSOLE_MODULE)
.kgdboc_port_startup = bfin_kgdboc_port_startup,
.kgdboc_port_shutdown = bfin_kgdboc_port_shutdown,
#endif
#ifdef CONFIG_CONSOLE_POLL
.poll_put_char = bfin_serial_poll_put_char,
.poll_get_char = bfin_serial_poll_get_char,
#endif
};

static void __init bfin_serial_init_ports(void)
Expand Down Expand Up @@ -1076,10 +1088,7 @@ static int __init bfin_serial_rs_console_init(void)
{
bfin_serial_init_ports();
register_console(&bfin_serial_console);
#ifdef CONFIG_KGDB_UART
kgdb_entry_state = 0;
init_kgdb_uart();
#endif

return 0;
}
console_initcall(bfin_serial_rs_console_init);
Expand Down Expand Up @@ -1235,10 +1244,6 @@ static struct platform_driver bfin_serial_driver = {
static int __init bfin_serial_init(void)
{
int ret;
#ifdef CONFIG_KGDB_UART
struct bfin_serial_port *uart = &bfin_serial_ports[CONFIG_KGDB_UART_PORT];
struct ktermios t;
#endif

pr_info("Serial: Blackfin serial driver\n");

Expand All @@ -1252,21 +1257,6 @@ static int __init bfin_serial_init(void)
uart_unregister_driver(&bfin_serial_reg);
}
}
#ifdef CONFIG_KGDB_UART
if (uart->port.cons->index != CONFIG_KGDB_UART_PORT) {
request_irq(uart->port.irq, bfin_serial_rx_int,
IRQF_DISABLED, "BFIN_UART_RX", uart);
pr_info("Request irq for kgdb uart port\n");
UART_SET_IER(uart, ERBFI);
SSYNC();
t.c_cflag = CS8|B57600;
t.c_iflag = 0;
t.c_oflag = 0;
t.c_lflag = ICANON;
t.c_line = CONFIG_KGDB_UART_PORT;
bfin_serial_set_termios(&uart->port, &t, &t);
}
#endif
return ret;
}

Expand All @@ -1276,6 +1266,7 @@ static void __exit bfin_serial_exit(void)
uart_unregister_driver(&bfin_serial_reg);
}


module_init(bfin_serial_init);
module_exit(bfin_serial_exit);

Expand Down
5 changes: 0 additions & 5 deletions trunk/include/linux/compiler-gcc.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,3 @@
#define noinline __attribute__((noinline))
#define __attribute_const__ __attribute__((__const__))
#define __maybe_unused __attribute__((unused))

#define __gcc_header(x) #x
#define _gcc_header(x) __gcc_header(linux/compiler-gcc##x.h)
#define gcc_header(x) _gcc_header(x)
#include gcc_header(__GNUC__)
3 changes: 3 additions & 0 deletions trunk/include/linux/compiler-gcc3.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
#error "Please don't include <linux/compiler-gcc3.h> directly, include <linux/compiler.h> instead."
#endif

/* These definitions are for GCC v3.x. */
#include <linux/compiler-gcc.h>

#if __GNUC_MINOR__ >= 3
# define __used __attribute__((__used__))
#else
Expand Down
8 changes: 3 additions & 5 deletions trunk/include/linux/compiler-gcc4.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@
#error "Please don't include <linux/compiler-gcc4.h> directly, include <linux/compiler.h> instead."
#endif

/* GCC 4.1.[01] miscompiles __weak */
#if __GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ <= 1
# error Your version of gcc miscompiles the __weak directive
#endif
/* These definitions are for GCC v4.x. */
#include <linux/compiler-gcc.h>

#define __used __attribute__((__used__))
#define __must_check __attribute__((warn_unused_result))
Expand All @@ -18,7 +16,7 @@
*/
#define uninitialized_var(x) x = x

#if __GNUC_MINOR__ >= 3
#if !(__GNUC__ == 4 && __GNUC_MINOR__ < 3)
/* Mark functions as cold. gcc will assume any path leading to a call
to them will be unlikely. This means a lot of manual unlikely()s
are unnecessary now for any paths leading to the usual suspects
Expand Down
8 changes: 6 additions & 2 deletions trunk/include/linux/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,12 @@ extern void __chk_io_ptr(const volatile void __iomem *);

#ifdef __KERNEL__

#ifdef __GNUC__
#include <linux/compiler-gcc.h>
#if __GNUC__ >= 4
# include <linux/compiler-gcc4.h>
#elif __GNUC__ == 3 && __GNUC_MINOR__ >= 2
# include <linux/compiler-gcc3.h>
#else
# error Sorry, your compiler is too old/not recognized.
#endif

#define notrace __attribute__((no_instrument_function))
Expand Down
9 changes: 9 additions & 0 deletions trunk/init/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,15 @@
#include <asm/smp.h>
#endif

/*
* This is one of the first .c files built. Error out early if we have compiler
* trouble.
*/

#if __GNUC__ == 4 && __GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ == 0
#warning gcc-4.1.0 is known to miscompile the kernel. A different compiler version is recommended.
#endif

static int kernel_init(void *);

extern void init_IRQ(void);
Expand Down

0 comments on commit 8ceaa83

Please sign in to comment.