* 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
This commit is contained in:
wdenk 2004-10-11 22:43:02 +00:00
parent 9455b7f39c
commit 2ee665339b
4 changed files with 87 additions and 54 deletions

View File

@ -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!]

View File

@ -79,8 +79,7 @@ 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);
@ -102,10 +101,8 @@ 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;
}
@ -118,17 +115,18 @@ void serial_reinit_all(void)
{
struct serial_device *s;
for (s = serial_devices; s; s = s->next)
{
for (s = serial_devices; s; s = s->next) {
s->init ();
}
}
int serial_init (void)
{
if (!serial_current)
{
DECLARE_GLOBAL_DATA_PTR;
if (!(gd->flags & GD_FLG_RELOC) || !serial_current) {
struct serial_device *dev = default_serial_console ();
return dev->init ();
}
@ -137,9 +135,11 @@ int serial_init(void)
void serial_setbrg (void)
{
if (!serial_current)
{
DECLARE_GLOBAL_DATA_PTR;
if (!(gd->flags & GD_FLG_RELOC) || !serial_current) {
struct serial_device *dev = default_serial_console ();
dev->setbrg ();
return;
}
@ -149,9 +149,11 @@ void serial_setbrg(void)
int serial_getc (void)
{
if (!serial_current)
{
DECLARE_GLOBAL_DATA_PTR;
if (!(gd->flags & GD_FLG_RELOC) || !serial_current) {
struct serial_device *dev = default_serial_console ();
return dev->getc ();
}
@ -160,9 +162,11 @@ int serial_getc(void)
int serial_tstc (void)
{
if (!serial_current)
{
DECLARE_GLOBAL_DATA_PTR;
if (!(gd->flags & GD_FLG_RELOC) || !serial_current) {
struct serial_device *dev = default_serial_console ();
return dev->tstc ();
}
@ -171,9 +175,11 @@ int serial_tstc(void)
void serial_putc (const char c)
{
if (!serial_current)
{
DECLARE_GLOBAL_DATA_PTR;
if (!(gd->flags & GD_FLG_RELOC) || !serial_current) {
struct serial_device *dev = default_serial_console ();
dev->putc (c);
return;
}
@ -183,9 +189,11 @@ void serial_putc(const char c)
void serial_puts (const char *s)
{
if (!serial_current)
{
DECLARE_GLOBAL_DATA_PTR;
if (!(gd->flags & GD_FLG_RELOC) || !serial_current) {
struct serial_device *dev = default_serial_console ();
dev->puts (s);
return;
}

View File

@ -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)

View File

@ -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);