aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwdenk <wdenk>2004-10-11 22:43:02 +0000
committerwdenk <wdenk>2004-10-11 22:43:02 +0000
commit2ee665339b06285a5fd9e36410d1167efc9b0606 (patch)
treed6de628020ca2600a1ecb20027ce06d1b7986d1d
parent9455b7f39cecbcd869b1ba49a1307cb97e67360f (diff)
downloadu-boot-linaro-stable-2ee665339b06285a5fd9e36410d1167efc9b0606.tar.gz
* Patch by Pantelis Antoniou, 14 Sep 2004:
Fix early serial hang when CONFIG_SERIAL_MULTI is defined. * Patch by Pantelis Antoniou, 14 Sep 2004: Kick watchdog when bz-decompressing
-rw-r--r--CHANGELOG6
-rw-r--r--common/serial.c116
-rw-r--r--lib_generic/bzlib.c5
-rw-r--r--lib_generic/bzlib_decompress.c14
4 files changed, 87 insertions, 54 deletions
diff --git a/CHANGELOG b/CHANGELOG
index a561208f0..b8ae75f37 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -2,6 +2,12 @@
Changes since U-Boot 1.1.1:
======================================================================
+* Patch by Pantelis Antoniou, 14 Sep 2004:
+ Fix early serial hang when CONFIG_SERIAL_MULTI is defined.
+
+* Patch by Pantelis Antoniou, 14 Sep 2004:
+ Kick watchdog when bz-decompressing
+
* Fix CFG_HZ problems on AT91RM9200 systems
[Remember: CFG_HZ should be 1000 on ALL systems!]
diff --git a/common/serial.c b/common/serial.c
index f89bb0a7a..c0f5a4cf3 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -31,7 +31,7 @@ static struct serial_device *serial_devices = NULL;
static struct serial_device *serial_current = NULL;
#ifndef CONFIG_LWMON
-struct serial_device * default_serial_console (void)
+struct serial_device *default_serial_console (void)
{
#if defined(CONFIG_8xx_CONS_SMC1) || defined(CONFIG_8xx_CONS_SMC2)
return &serial_smc_device;
@@ -44,7 +44,7 @@ struct serial_device * default_serial_console (void)
}
#endif
-static int serial_register(struct serial_device* dev)
+static int serial_register (struct serial_device *dev)
{
DECLARE_GLOBAL_DATA_PTR;
@@ -61,26 +61,25 @@ static int serial_register(struct serial_device* dev)
return 0;
}
-void serial_initialize(void)
+void serial_initialize (void)
{
#if defined(CONFIG_8xx_CONS_SMC1) || defined(CONFIG_8xx_CONS_SMC2)
- serial_register(&serial_smc_device);
+ serial_register (&serial_smc_device);
#endif
#if defined(CONFIG_8xx_CONS_SCC1) || defined(CONFIG_8xx_CONS_SCC2) \
|| defined(CONFIG_8xx_CONS_SCC3) || defined(CONFIG_8xx_CONS_SCC4)
- serial_register(&serial_scc_device);
+ serial_register (&serial_scc_device);
#endif
- serial_assign(default_serial_console()->name);
+ serial_assign (default_serial_console ()->name);
}
-void serial_devices_init(void)
+void serial_devices_init (void)
{
device_t dev;
struct serial_device *s = serial_devices;
- while (s)
- {
+ while (s) {
memset (&dev, 0, sizeof (dev));
strcpy (dev.name, s->name);
@@ -98,14 +97,12 @@ void serial_devices_init(void)
}
}
-int serial_assign(char * name)
+int serial_assign (char *name)
{
struct serial_device *s;
- for (s = serial_devices; s; s = s->next)
- {
- if (strcmp(s->name, name) == 0)
- {
+ for (s = serial_devices; s; s = s->next) {
+ if (strcmp (s->name, name) == 0) {
serial_current = s;
return 0;
}
@@ -114,83 +111,94 @@ int serial_assign(char * name)
return 1;
}
-void serial_reinit_all(void)
+void serial_reinit_all (void)
{
struct serial_device *s;
- for (s = serial_devices; s; s = s->next)
- {
- s->init();
+ for (s = serial_devices; s; s = s->next) {
+ s->init ();
}
}
-int serial_init(void)
+int serial_init (void)
{
- if (!serial_current)
- {
- struct serial_device *dev = default_serial_console();
- return dev->init();
+ DECLARE_GLOBAL_DATA_PTR;
+
+ if (!(gd->flags & GD_FLG_RELOC) || !serial_current) {
+ struct serial_device *dev = default_serial_console ();
+
+ return dev->init ();
}
- return serial_current->init();
+ return serial_current->init ();
}
-void serial_setbrg(void)
+void serial_setbrg (void)
{
- if (!serial_current)
- {
- struct serial_device *dev = default_serial_console();
- dev->setbrg();
+ DECLARE_GLOBAL_DATA_PTR;
+
+ if (!(gd->flags & GD_FLG_RELOC) || !serial_current) {
+ struct serial_device *dev = default_serial_console ();
+
+ dev->setbrg ();
return;
}
- serial_current->setbrg();
+ serial_current->setbrg ();
}
-int serial_getc(void)
+int serial_getc (void)
{
- if (!serial_current)
- {
- struct serial_device *dev = default_serial_console();
- return dev->getc();
+ DECLARE_GLOBAL_DATA_PTR;
+
+ if (!(gd->flags & GD_FLG_RELOC) || !serial_current) {
+ struct serial_device *dev = default_serial_console ();
+
+ return dev->getc ();
}
- return serial_current->getc();
+ return serial_current->getc ();
}
-int serial_tstc(void)
+int serial_tstc (void)
{
- if (!serial_current)
- {
- struct serial_device *dev = default_serial_console();
- return dev->tstc();
+ DECLARE_GLOBAL_DATA_PTR;
+
+ if (!(gd->flags & GD_FLG_RELOC) || !serial_current) {
+ struct serial_device *dev = default_serial_console ();
+
+ return dev->tstc ();
}
- return serial_current->tstc();
+ return serial_current->tstc ();
}
-void serial_putc(const char c)
+void serial_putc (const char c)
{
- if (!serial_current)
- {
- struct serial_device *dev = default_serial_console();
- dev->putc(c);
+ DECLARE_GLOBAL_DATA_PTR;
+
+ if (!(gd->flags & GD_FLG_RELOC) || !serial_current) {
+ struct serial_device *dev = default_serial_console ();
+
+ dev->putc (c);
return;
}
- serial_current->putc(c);
+ serial_current->putc (c);
}
-void serial_puts(const char *s)
+void serial_puts (const char *s)
{
- if (!serial_current)
- {
- struct serial_device *dev = default_serial_console();
- dev->puts(s);
+ DECLARE_GLOBAL_DATA_PTR;
+
+ if (!(gd->flags & GD_FLG_RELOC) || !serial_current) {
+ struct serial_device *dev = default_serial_console ();
+
+ dev->puts (s);
return;
}
- serial_current->puts(s);
+ serial_current->puts (s);
}
#endif /* CONFIG_SERIAL_MULTI */
diff --git a/lib_generic/bzlib.c b/lib_generic/bzlib.c
index 8a64b799e..87e6a6eed 100644
--- a/lib_generic/bzlib.c
+++ b/lib_generic/bzlib.c
@@ -1,4 +1,6 @@
#include <config.h>
+#include <common.h>
+#include <watchdog.h>
#ifdef CONFIG_BZIP2
/*
@@ -841,6 +843,9 @@ int BZ_API(BZ2_bzDecompress) ( bz_stream *strm )
if (s->strm != strm) return BZ_PARAM_ERROR;
while (True) {
+#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
+ WATCHDOG_RESET();
+#endif
if (s->state == BZ_X_IDLE) return BZ_SEQUENCE_ERROR;
if (s->state == BZ_X_OUTPUT) {
if (s->smallDecompress)
diff --git a/lib_generic/bzlib_decompress.c b/lib_generic/bzlib_decompress.c
index a4a16879e..a5750520c 100644
--- a/lib_generic/bzlib_decompress.c
+++ b/lib_generic/bzlib_decompress.c
@@ -1,4 +1,6 @@
#include <config.h>
+#include <common.h>
+#include <watchdog.h>
#ifdef CONFIG_BZIP2
/*-------------------------------------------------------------*/
@@ -416,6 +418,9 @@ Int32 BZ2_decompress ( DState* s )
while (True) {
+#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
+ WATCHDOG_RESET();
+#endif
if (nextSym == EOB) break;
if (nextSym == BZ_RUNA || nextSym == BZ_RUNB) {
@@ -498,6 +503,9 @@ Int32 BZ2_decompress ( DState* s )
if (s->mtfbase[0] == 0) {
kk = MTFA_SIZE-1;
for (ii = 256 / MTFL_SIZE-1; ii >= 0; ii--) {
+#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
+ WATCHDOG_RESET();
+#endif
for (jj = MTFL_SIZE-1; jj >= 0; jj--) {
s->mtfa[kk] = s->mtfa[s->mtfbase[ii] + jj];
kk--;
@@ -560,6 +568,9 @@ Int32 BZ2_decompress ( DState* s )
}
while (i != s->origPtr);
+#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
+ WATCHDOG_RESET();
+#endif
s->tPos = s->origPtr;
s->nblock_used = 0;
if (s->blockRandomised) {
@@ -572,6 +583,9 @@ Int32 BZ2_decompress ( DState* s )
} else {
+#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
+ WATCHDOG_RESET();
+#endif
/*-- compute the T^(-1) vector --*/
for (i = 0; i < nblock; i++) {
uc = (UChar)(s->tt[i] & 0xff);