mirror of
https://github.com/Stichting-MINIX-Research-Foundation/u-boot.git
synced 2025-09-10 12:39:22 -04:00
* 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:
parent
9455b7f39c
commit
2ee665339b
@ -2,6 +2,12 @@
|
|||||||
Changes since U-Boot 1.1.1:
|
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
|
* Fix CFG_HZ problems on AT91RM9200 systems
|
||||||
[Remember: CFG_HZ should be 1000 on ALL systems!]
|
[Remember: CFG_HZ should be 1000 on ALL systems!]
|
||||||
|
|
||||||
|
116
common/serial.c
116
common/serial.c
@ -31,7 +31,7 @@ static struct serial_device *serial_devices = NULL;
|
|||||||
static struct serial_device *serial_current = NULL;
|
static struct serial_device *serial_current = NULL;
|
||||||
|
|
||||||
#ifndef CONFIG_LWMON
|
#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)
|
#if defined(CONFIG_8xx_CONS_SMC1) || defined(CONFIG_8xx_CONS_SMC2)
|
||||||
return &serial_smc_device;
|
return &serial_smc_device;
|
||||||
@ -44,7 +44,7 @@ struct serial_device * default_serial_console (void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int serial_register(struct serial_device* dev)
|
static int serial_register (struct serial_device *dev)
|
||||||
{
|
{
|
||||||
DECLARE_GLOBAL_DATA_PTR;
|
DECLARE_GLOBAL_DATA_PTR;
|
||||||
|
|
||||||
@ -61,26 +61,25 @@ static int serial_register(struct serial_device* dev)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void serial_initialize(void)
|
void serial_initialize (void)
|
||||||
{
|
{
|
||||||
#if defined(CONFIG_8xx_CONS_SMC1) || defined(CONFIG_8xx_CONS_SMC2)
|
#if defined(CONFIG_8xx_CONS_SMC1) || defined(CONFIG_8xx_CONS_SMC2)
|
||||||
serial_register(&serial_smc_device);
|
serial_register (&serial_smc_device);
|
||||||
#endif
|
#endif
|
||||||
#if defined(CONFIG_8xx_CONS_SCC1) || defined(CONFIG_8xx_CONS_SCC2) \
|
#if defined(CONFIG_8xx_CONS_SCC1) || defined(CONFIG_8xx_CONS_SCC2) \
|
||||||
|| defined(CONFIG_8xx_CONS_SCC3) || defined(CONFIG_8xx_CONS_SCC4)
|
|| defined(CONFIG_8xx_CONS_SCC3) || defined(CONFIG_8xx_CONS_SCC4)
|
||||||
serial_register(&serial_scc_device);
|
serial_register (&serial_scc_device);
|
||||||
#endif
|
#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;
|
device_t dev;
|
||||||
struct serial_device *s = serial_devices;
|
struct serial_device *s = serial_devices;
|
||||||
|
|
||||||
while (s)
|
while (s) {
|
||||||
{
|
|
||||||
memset (&dev, 0, sizeof (dev));
|
memset (&dev, 0, sizeof (dev));
|
||||||
|
|
||||||
strcpy (dev.name, s->name);
|
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;
|
struct serial_device *s;
|
||||||
|
|
||||||
for (s = serial_devices; s; s = s->next)
|
for (s = serial_devices; s; s = s->next) {
|
||||||
{
|
if (strcmp (s->name, name) == 0) {
|
||||||
if (strcmp(s->name, name) == 0)
|
|
||||||
{
|
|
||||||
serial_current = s;
|
serial_current = s;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -114,83 +111,94 @@ int serial_assign(char * name)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void serial_reinit_all(void)
|
void serial_reinit_all (void)
|
||||||
{
|
{
|
||||||
struct serial_device *s;
|
struct serial_device *s;
|
||||||
|
|
||||||
for (s = serial_devices; s; s = s->next)
|
for (s = serial_devices; s; s = s->next) {
|
||||||
{
|
s->init ();
|
||||||
s->init();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int serial_init(void)
|
int serial_init (void)
|
||||||
{
|
{
|
||||||
if (!serial_current)
|
DECLARE_GLOBAL_DATA_PTR;
|
||||||
{
|
|
||||||
struct serial_device *dev = default_serial_console();
|
if (!(gd->flags & GD_FLG_RELOC) || !serial_current) {
|
||||||
return dev->init();
|
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)
|
DECLARE_GLOBAL_DATA_PTR;
|
||||||
{
|
|
||||||
struct serial_device *dev = default_serial_console();
|
if (!(gd->flags & GD_FLG_RELOC) || !serial_current) {
|
||||||
dev->setbrg();
|
struct serial_device *dev = default_serial_console ();
|
||||||
|
|
||||||
|
dev->setbrg ();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
serial_current->setbrg();
|
serial_current->setbrg ();
|
||||||
}
|
}
|
||||||
|
|
||||||
int serial_getc(void)
|
int serial_getc (void)
|
||||||
{
|
{
|
||||||
if (!serial_current)
|
DECLARE_GLOBAL_DATA_PTR;
|
||||||
{
|
|
||||||
struct serial_device *dev = default_serial_console();
|
if (!(gd->flags & GD_FLG_RELOC) || !serial_current) {
|
||||||
return dev->getc();
|
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)
|
DECLARE_GLOBAL_DATA_PTR;
|
||||||
{
|
|
||||||
struct serial_device *dev = default_serial_console();
|
if (!(gd->flags & GD_FLG_RELOC) || !serial_current) {
|
||||||
return dev->tstc();
|
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)
|
DECLARE_GLOBAL_DATA_PTR;
|
||||||
{
|
|
||||||
struct serial_device *dev = default_serial_console();
|
if (!(gd->flags & GD_FLG_RELOC) || !serial_current) {
|
||||||
dev->putc(c);
|
struct serial_device *dev = default_serial_console ();
|
||||||
|
|
||||||
|
dev->putc (c);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
serial_current->putc(c);
|
serial_current->putc (c);
|
||||||
}
|
}
|
||||||
|
|
||||||
void serial_puts(const char *s)
|
void serial_puts (const char *s)
|
||||||
{
|
{
|
||||||
if (!serial_current)
|
DECLARE_GLOBAL_DATA_PTR;
|
||||||
{
|
|
||||||
struct serial_device *dev = default_serial_console();
|
if (!(gd->flags & GD_FLG_RELOC) || !serial_current) {
|
||||||
dev->puts(s);
|
struct serial_device *dev = default_serial_console ();
|
||||||
|
|
||||||
|
dev->puts (s);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
serial_current->puts(s);
|
serial_current->puts (s);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_SERIAL_MULTI */
|
#endif /* CONFIG_SERIAL_MULTI */
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
#include <common.h>
|
||||||
|
#include <watchdog.h>
|
||||||
#ifdef CONFIG_BZIP2
|
#ifdef CONFIG_BZIP2
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -841,6 +843,9 @@ int BZ_API(BZ2_bzDecompress) ( bz_stream *strm )
|
|||||||
if (s->strm != strm) return BZ_PARAM_ERROR;
|
if (s->strm != strm) return BZ_PARAM_ERROR;
|
||||||
|
|
||||||
while (True) {
|
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_IDLE) return BZ_SEQUENCE_ERROR;
|
||||||
if (s->state == BZ_X_OUTPUT) {
|
if (s->state == BZ_X_OUTPUT) {
|
||||||
if (s->smallDecompress)
|
if (s->smallDecompress)
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
#include <common.h>
|
||||||
|
#include <watchdog.h>
|
||||||
#ifdef CONFIG_BZIP2
|
#ifdef CONFIG_BZIP2
|
||||||
|
|
||||||
/*-------------------------------------------------------------*/
|
/*-------------------------------------------------------------*/
|
||||||
@ -416,6 +418,9 @@ Int32 BZ2_decompress ( DState* s )
|
|||||||
|
|
||||||
while (True) {
|
while (True) {
|
||||||
|
|
||||||
|
#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
|
||||||
|
WATCHDOG_RESET();
|
||||||
|
#endif
|
||||||
if (nextSym == EOB) break;
|
if (nextSym == EOB) break;
|
||||||
|
|
||||||
if (nextSym == BZ_RUNA || nextSym == BZ_RUNB) {
|
if (nextSym == BZ_RUNA || nextSym == BZ_RUNB) {
|
||||||
@ -498,6 +503,9 @@ Int32 BZ2_decompress ( DState* s )
|
|||||||
if (s->mtfbase[0] == 0) {
|
if (s->mtfbase[0] == 0) {
|
||||||
kk = MTFA_SIZE-1;
|
kk = MTFA_SIZE-1;
|
||||||
for (ii = 256 / MTFL_SIZE-1; ii >= 0; ii--) {
|
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--) {
|
for (jj = MTFL_SIZE-1; jj >= 0; jj--) {
|
||||||
s->mtfa[kk] = s->mtfa[s->mtfbase[ii] + jj];
|
s->mtfa[kk] = s->mtfa[s->mtfbase[ii] + jj];
|
||||||
kk--;
|
kk--;
|
||||||
@ -560,6 +568,9 @@ Int32 BZ2_decompress ( DState* s )
|
|||||||
}
|
}
|
||||||
while (i != s->origPtr);
|
while (i != s->origPtr);
|
||||||
|
|
||||||
|
#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
|
||||||
|
WATCHDOG_RESET();
|
||||||
|
#endif
|
||||||
s->tPos = s->origPtr;
|
s->tPos = s->origPtr;
|
||||||
s->nblock_used = 0;
|
s->nblock_used = 0;
|
||||||
if (s->blockRandomised) {
|
if (s->blockRandomised) {
|
||||||
@ -572,6 +583,9 @@ Int32 BZ2_decompress ( DState* s )
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
|
||||||
|
WATCHDOG_RESET();
|
||||||
|
#endif
|
||||||
/*-- compute the T^(-1) vector --*/
|
/*-- compute the T^(-1) vector --*/
|
||||||
for (i = 0; i < nblock; i++) {
|
for (i = 0; i < nblock; i++) {
|
||||||
uc = (UChar)(s->tt[i] & 0xff);
|
uc = (UChar)(s->tt[i] & 0xff);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user