Commit 2ee665339b06285a5fd9e36410d1167efc9b0606

Authored by wdenk
1 parent 9455b7f39c

* 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

Showing 4 changed files with 87 additions and 54 deletions Side-by-side Diff

... ... @@ -2,6 +2,12 @@
2 2 Changes since U-Boot 1.1.1:
3 3 ======================================================================
4 4  
  5 +* Patch by Pantelis Antoniou, 14 Sep 2004:
  6 + Fix early serial hang when CONFIG_SERIAL_MULTI is defined.
  7 +
  8 +* Patch by Pantelis Antoniou, 14 Sep 2004:
  9 + Kick watchdog when bz-decompressing
  10 +
5 11 * Fix CFG_HZ problems on AT91RM9200 systems
6 12 [Remember: CFG_HZ should be 1000 on ALL systems!]
7 13  
... ... @@ -31,7 +31,7 @@
31 31 static struct serial_device *serial_current = NULL;
32 32  
33 33 #ifndef CONFIG_LWMON
34   -struct serial_device * default_serial_console (void)
  34 +struct serial_device *default_serial_console (void)
35 35 {
36 36 #if defined(CONFIG_8xx_CONS_SMC1) || defined(CONFIG_8xx_CONS_SMC2)
37 37 return &serial_smc_device;
... ... @@ -44,7 +44,7 @@
44 44 }
45 45 #endif
46 46  
47   -static int serial_register(struct serial_device* dev)
  47 +static int serial_register (struct serial_device *dev)
48 48 {
49 49 DECLARE_GLOBAL_DATA_PTR;
50 50  
51 51  
52 52  
53 53  
54 54  
55 55  
... ... @@ -61,26 +61,25 @@
61 61 return 0;
62 62 }
63 63  
64   -void serial_initialize(void)
  64 +void serial_initialize (void)
65 65 {
66 66 #if defined(CONFIG_8xx_CONS_SMC1) || defined(CONFIG_8xx_CONS_SMC2)
67   - serial_register(&serial_smc_device);
  67 + serial_register (&serial_smc_device);
68 68 #endif
69 69 #if defined(CONFIG_8xx_CONS_SCC1) || defined(CONFIG_8xx_CONS_SCC2) \
70 70 || defined(CONFIG_8xx_CONS_SCC3) || defined(CONFIG_8xx_CONS_SCC4)
71   - serial_register(&serial_scc_device);
  71 + serial_register (&serial_scc_device);
72 72 #endif
73 73  
74   - serial_assign(default_serial_console()->name);
  74 + serial_assign (default_serial_console ()->name);
75 75 }
76 76  
77   -void serial_devices_init(void)
  77 +void serial_devices_init (void)
78 78 {
79 79 device_t dev;
80 80 struct serial_device *s = serial_devices;
81 81  
82   - while (s)
83   - {
  82 + while (s) {
84 83 memset (&dev, 0, sizeof (dev));
85 84  
86 85 strcpy (dev.name, s->name);
87 86  
... ... @@ -98,14 +97,12 @@
98 97 }
99 98 }
100 99  
101   -int serial_assign(char * name)
  100 +int serial_assign (char *name)
102 101 {
103 102 struct serial_device *s;
104 103  
105   - for (s = serial_devices; s; s = s->next)
106   - {
107   - if (strcmp(s->name, name) == 0)
108   - {
  104 + for (s = serial_devices; s; s = s->next) {
  105 + if (strcmp (s->name, name) == 0) {
109 106 serial_current = s;
110 107 return 0;
111 108 }
112 109  
113 110  
114 111  
115 112  
116 113  
117 114  
118 115  
119 116  
120 117  
121 118  
122 119  
123 120  
124 121  
125 122  
126 123  
127 124  
128 125  
129 126  
130 127  
... ... @@ -114,83 +111,94 @@
114 111 return 1;
115 112 }
116 113  
117   -void serial_reinit_all(void)
  114 +void serial_reinit_all (void)
118 115 {
119 116 struct serial_device *s;
120 117  
121   - for (s = serial_devices; s; s = s->next)
122   - {
123   - s->init();
  118 + for (s = serial_devices; s; s = s->next) {
  119 + s->init ();
124 120 }
125 121 }
126 122  
127   -int serial_init(void)
  123 +int serial_init (void)
128 124 {
129   - if (!serial_current)
130   - {
131   - struct serial_device *dev = default_serial_console();
132   - return dev->init();
  125 + DECLARE_GLOBAL_DATA_PTR;
  126 +
  127 + if (!(gd->flags & GD_FLG_RELOC) || !serial_current) {
  128 + struct serial_device *dev = default_serial_console ();
  129 +
  130 + return dev->init ();
133 131 }
134 132  
135   - return serial_current->init();
  133 + return serial_current->init ();
136 134 }
137 135  
138   -void serial_setbrg(void)
  136 +void serial_setbrg (void)
139 137 {
140   - if (!serial_current)
141   - {
142   - struct serial_device *dev = default_serial_console();
143   - dev->setbrg();
  138 + DECLARE_GLOBAL_DATA_PTR;
  139 +
  140 + if (!(gd->flags & GD_FLG_RELOC) || !serial_current) {
  141 + struct serial_device *dev = default_serial_console ();
  142 +
  143 + dev->setbrg ();
144 144 return;
145 145 }
146 146  
147   - serial_current->setbrg();
  147 + serial_current->setbrg ();
148 148 }
149 149  
150   -int serial_getc(void)
  150 +int serial_getc (void)
151 151 {
152   - if (!serial_current)
153   - {
154   - struct serial_device *dev = default_serial_console();
155   - return dev->getc();
  152 + DECLARE_GLOBAL_DATA_PTR;
  153 +
  154 + if (!(gd->flags & GD_FLG_RELOC) || !serial_current) {
  155 + struct serial_device *dev = default_serial_console ();
  156 +
  157 + return dev->getc ();
156 158 }
157 159  
158   - return serial_current->getc();
  160 + return serial_current->getc ();
159 161 }
160 162  
161   -int serial_tstc(void)
  163 +int serial_tstc (void)
162 164 {
163   - if (!serial_current)
164   - {
165   - struct serial_device *dev = default_serial_console();
166   - return dev->tstc();
  165 + DECLARE_GLOBAL_DATA_PTR;
  166 +
  167 + if (!(gd->flags & GD_FLG_RELOC) || !serial_current) {
  168 + struct serial_device *dev = default_serial_console ();
  169 +
  170 + return dev->tstc ();
167 171 }
168 172  
169   - return serial_current->tstc();
  173 + return serial_current->tstc ();
170 174 }
171 175  
172   -void serial_putc(const char c)
  176 +void serial_putc (const char c)
173 177 {
174   - if (!serial_current)
175   - {
176   - struct serial_device *dev = default_serial_console();
177   - dev->putc(c);
  178 + DECLARE_GLOBAL_DATA_PTR;
  179 +
  180 + if (!(gd->flags & GD_FLG_RELOC) || !serial_current) {
  181 + struct serial_device *dev = default_serial_console ();
  182 +
  183 + dev->putc (c);
178 184 return;
179 185 }
180 186  
181   - serial_current->putc(c);
  187 + serial_current->putc (c);
182 188 }
183 189  
184   -void serial_puts(const char *s)
  190 +void serial_puts (const char *s)
185 191 {
186   - if (!serial_current)
187   - {
188   - struct serial_device *dev = default_serial_console();
189   - dev->puts(s);
  192 + DECLARE_GLOBAL_DATA_PTR;
  193 +
  194 + if (!(gd->flags & GD_FLG_RELOC) || !serial_current) {
  195 + struct serial_device *dev = default_serial_console ();
  196 +
  197 + dev->puts (s);
190 198 return;
191 199 }
192 200  
193   - serial_current->puts(s);
  201 + serial_current->puts (s);
194 202 }
195 203  
196 204 #endif /* CONFIG_SERIAL_MULTI */
1 1 #include <config.h>
  2 +#include <common.h>
  3 +#include <watchdog.h>
2 4 #ifdef CONFIG_BZIP2
3 5  
4 6 /*
... ... @@ -841,6 +843,9 @@
841 843 if (s->strm != strm) return BZ_PARAM_ERROR;
842 844  
843 845 while (True) {
  846 +#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
  847 + WATCHDOG_RESET();
  848 +#endif
844 849 if (s->state == BZ_X_IDLE) return BZ_SEQUENCE_ERROR;
845 850 if (s->state == BZ_X_OUTPUT) {
846 851 if (s->smallDecompress)
lib_generic/bzlib_decompress.c
1 1 #include <config.h>
  2 +#include <common.h>
  3 +#include <watchdog.h>
2 4 #ifdef CONFIG_BZIP2
3 5  
4 6 /*-------------------------------------------------------------*/
... ... @@ -416,6 +418,9 @@
416 418  
417 419 while (True) {
418 420  
  421 +#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
  422 + WATCHDOG_RESET();
  423 +#endif
419 424 if (nextSym == EOB) break;
420 425  
421 426 if (nextSym == BZ_RUNA || nextSym == BZ_RUNB) {
... ... @@ -498,6 +503,9 @@
498 503 if (s->mtfbase[0] == 0) {
499 504 kk = MTFA_SIZE-1;
500 505 for (ii = 256 / MTFL_SIZE-1; ii >= 0; ii--) {
  506 +#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
  507 + WATCHDOG_RESET();
  508 +#endif
501 509 for (jj = MTFL_SIZE-1; jj >= 0; jj--) {
502 510 s->mtfa[kk] = s->mtfa[s->mtfbase[ii] + jj];
503 511 kk--;
... ... @@ -560,6 +568,9 @@
560 568 }
561 569 while (i != s->origPtr);
562 570  
  571 +#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
  572 + WATCHDOG_RESET();
  573 +#endif
563 574 s->tPos = s->origPtr;
564 575 s->nblock_used = 0;
565 576 if (s->blockRandomised) {
... ... @@ -572,6 +583,9 @@
572 583  
573 584 } else {
574 585  
  586 +#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
  587 + WATCHDOG_RESET();
  588 +#endif
575 589 /*-- compute the T^(-1) vector --*/
576 590 for (i = 0; i < nblock; i++) {
577 591 uc = (UChar)(s->tt[i] & 0xff);