Commit 5fa66df63afe2841ce27596996811469903373a7

Authored by wdenk
1 parent a0f2fe524c

* Prepare for release

* Fix problems in memory test on some boards (which was not
  non-destructive as intended)

* Patch by Gary Jennejohn, 28 Oct 2003:
  Change fs/fat/fat.c to put I/O buffers in BSS instead on the stack
  to prevent stack overflow on ARM systems

Showing 12 changed files with 185 additions and 89 deletions Side-by-side Diff

... ... @@ -2,6 +2,13 @@
2 2 Changes for U-Boot 1.0.0:
3 3 ======================================================================
4 4  
  5 +* Fix problems in memory test on some boards (which was not
  6 + non-destructive as intended)
  7 +
  8 +* Patch by Gary Jennejohn, 28 Oct 2003:
  9 + Change fs/fat/fat.c to put I/O buffers in BSS instead on the stack
  10 + to prevent stack overflow on ARM systems
  11 +
5 12 * Patch by Stephan Linz, 28 Oct 2003:
6 13 fix init sequence error for NIOS port
7 14  
board/RRvision/RRvision.c
... ... @@ -230,8 +230,8 @@
230 230 volatile immap_t *immap = (immap_t *) CFG_IMMR;
231 231 volatile memctl8xx_t *memctl = &immap->im_memctl;
232 232 volatile long int *addr;
233   - ulong cnt, val;
234   - ulong save[32]; /* to make test non-destructive */
  233 + ulong cnt, val, size;
  234 + ulong save[32]; /* to make test non-destructive */
235 235 unsigned char i = 0;
236 236  
237 237 memctl->memc_mamr = mamr_value;
238 238  
... ... @@ -250,7 +250,13 @@
250 250  
251 251 /* check at base address */
252 252 if ((val = *addr) != 0) {
  253 + /* Restore the original data before leaving the function.
  254 + */
253 255 *addr = save[i];
  256 + for (cnt = 1; cnt <= maxsize / sizeof(long); cnt <<= 1) {
  257 + addr = (volatile ulong *) base + cnt;
  258 + *addr = save[--i];
  259 + }
254 260 return (0);
255 261 }
256 262  
... ... @@ -261,7 +267,14 @@
261 267 *addr = save[--i];
262 268  
263 269 if (val != (~cnt)) {
264   - return (cnt * sizeof (long));
  270 + size = cnt * sizeof (long);
  271 + /* Restore the original data before returning
  272 + */
  273 + for (cnt <<= 1; cnt <= maxsize / sizeof (long); cnt <<= 1) {
  274 + addr = (volatile ulong *) base + cnt;
  275 + *addr = save[--i];
  276 + }
  277 + return (size);
265 278 }
266 279 }
267 280 return (maxsize);
... ... @@ -269,7 +269,7 @@
269 269 ulong orx, volatile uchar * base)
270 270 {
271 271 volatile uchar c = 0xff;
272   - ulong cnt, val;
  272 + ulong cnt, val, size;
273 273 volatile ulong *addr;
274 274 volatile uint *sdmr_ptr;
275 275 volatile uint *orx_ptr;
276 276  
... ... @@ -344,7 +344,13 @@
344 344 *addr = 0;
345 345  
346 346 if ((val = *addr) != 0) {
  347 + /* Restore the original data before leaving the function.
  348 + */
347 349 *addr = save[i];
  350 + for (cnt = 1; cnt <= maxsize / sizeof(long); cnt <<= 1) {
  351 + addr = (volatile ulong *) base + cnt;
  352 + *addr = save[--i];
  353 + }
348 354 return (0);
349 355 }
350 356  
351 357  
... ... @@ -353,10 +359,17 @@
353 359 val = *addr;
354 360 *addr = save[--i];
355 361 if (val != ~cnt) {
  362 + size = cnt * sizeof (long);
  363 + /* Restore the original data before returning
  364 + */
  365 + for (cnt <<= 1; cnt <= maxsize / sizeof (long); cnt <<= 1) {
  366 + addr = (volatile ulong *) base + cnt;
  367 + *addr = save[--i];
  368 + }
356 369 /* Write the actual size to ORx
357 370 */
358   - *orx_ptr = orx | ~(cnt * sizeof (long) - 1);
359   - return (cnt * sizeof (long));
  371 + *orx_ptr = orx | ~(size - 1);
  372 + return (size);
360 373 }
361 374 }
362 375 return (maxsize);
... ... @@ -228,8 +228,8 @@
228 228 volatile immap_t *immap = (immap_t *) CFG_IMMR;
229 229 volatile memctl8xx_t *memctl = &immap->im_memctl;
230 230 volatile long int *addr;
231   - ulong cnt, val;
232   - ulong save[32]; /* to make test non-destructive */
  231 + ulong cnt, val, size;
  232 + ulong save[32]; /* to make test non-destructive */
233 233 unsigned char i = 0;
234 234  
235 235 memctl->memc_mamr = mamr_value;
236 236  
... ... @@ -248,7 +248,13 @@
248 248  
249 249 /* check at base address */
250 250 if ((val = *addr) != 0) {
  251 + /* Restore the original data before leaving the function.
  252 + */
251 253 *addr = save[i];
  254 + for (cnt = 1; cnt <= maxsize / sizeof(long); cnt <<= 1) {
  255 + addr = (volatile ulong *) base + cnt;
  256 + *addr = save[--i];
  257 + }
252 258 return (0);
253 259 }
254 260  
... ... @@ -259,7 +265,14 @@
259 265 *addr = save[--i];
260 266  
261 267 if (val != (~cnt)) {
262   - return (cnt * sizeof (long));
  268 + size = cnt * sizeof (long);
  269 + /* Restore the original data before returning
  270 + */
  271 + for (cnt <<= 1; cnt <= maxsize / sizeof (long); cnt <<= 1) {
  272 + addr = (volatile ulong *) base + cnt;
  273 + *addr = save[--i];
  274 + }
  275 + return (size);
263 276 }
264 277 }
265 278 return (maxsize);
board/etx094/etx094.c
... ... @@ -321,8 +321,8 @@
321 321 volatile immap_t *immap = (immap_t *) CFG_IMMR;
322 322 volatile memctl8xx_t *memctl = &immap->im_memctl;
323 323 volatile long int *addr;
324   - ulong cnt, val;
325   - ulong save[32]; /* to make test non-destructive */
  324 + ulong cnt, val, size;
  325 + ulong save[32]; /* to make test non-destructive */
326 326 unsigned char i = 0;
327 327  
328 328 memctl->memc_mamr = mamr_value;
329 329  
... ... @@ -341,7 +341,13 @@
341 341  
342 342 /* check at base address */
343 343 if ((val = *addr) != 0) {
  344 + /* Restore the original data before leaving the function.
  345 + */
344 346 *addr = save[i];
  347 + for (cnt = 1; cnt <= maxsize / sizeof(long); cnt <<= 1) {
  348 + addr = (volatile ulong *) base + cnt;
  349 + *addr = save[--i];
  350 + }
345 351 return (0);
346 352 }
347 353  
... ... @@ -352,7 +358,14 @@
352 358 *addr = save[--i];
353 359  
354 360 if (val != (~cnt)) {
355   - return (cnt * sizeof (long));
  361 + size = cnt * sizeof (long);
  362 + /* Restore the original data before returning
  363 + */
  364 + for (cnt <<= 1; cnt <= maxsize / sizeof (long); cnt <<= 1) {
  365 + addr = (volatile ulong *) base + cnt;
  366 + *addr = save[--i];
  367 + }
  368 + return (size);
356 369 }
357 370 }
358 371 return (maxsize);
board/evb64260/flash.c
... ... @@ -97,7 +97,7 @@
97 97 #ifndef CONFIG_P3G4
98 98 printf("[");
99 99 print_size (size, "");
100   - printf("@%08lX] ", size>>20, base);
  100 + printf("@%08lX] ", base);
101 101 #endif
102 102  
103 103 if (flash_info[i].flash_id == FLASH_UNKNOWN) {
... ... @@ -94,39 +94,41 @@
94 94  
95 95 long int initdram (int board_type)
96 96 {
97   - volatile immap_t *immap = (immap_t *)CFG_IMMR;
98   - volatile memctl8xx_t *memctl = &immap->im_memctl;
99   - long int size9 ;
  97 + volatile immap_t *immap = (immap_t *) CFG_IMMR;
  98 + volatile memctl8xx_t *memctl = &immap->im_memctl;
  99 + long int size9;
100 100  
101   - upmconfig(UPMA, (uint *)sdram_table, sizeof(sdram_table)/sizeof(uint));
  101 + upmconfig (UPMA, (uint *) sdram_table,
  102 + sizeof (sdram_table) / sizeof (uint));
102 103  
103 104 /* Refresh clock prescalar */
104   - memctl->memc_mptpr = CFG_MPTPR ;
  105 + memctl->memc_mptpr = CFG_MPTPR;
105 106  
106   - memctl->memc_mar = 0x00000088;
  107 + memctl->memc_mar = 0x00000088;
107 108  
108 109 /* Map controller banks 1 to the SDRAM bank */
109   - memctl->memc_or1 = CFG_OR1_PRELIM;
110   - memctl->memc_br1 = CFG_BR1_PRELIM;
  110 + memctl->memc_or1 = CFG_OR1_PRELIM;
  111 + memctl->memc_br1 = CFG_BR1_PRELIM;
111 112  
112   - memctl->memc_mamr = CFG_MAMR_9COL & (~(MAMR_PTAE)); /* no refresh yet */
  113 + memctl->memc_mamr = CFG_MAMR_9COL & (~(MAMR_PTAE)); /* no refresh yet */
113 114  
114   - udelay(200);
  115 + udelay (200);
115 116  
116   - /* perform SDRAM initializsation sequence */
  117 + /* perform SDRAM initializsation sequence */
117 118  
118   - memctl->memc_mcr = 0x80002136 ; /* SDRAM bank 0 */
119   - udelay(1);
  119 + memctl->memc_mcr = 0x80002136; /* SDRAM bank 0 */
  120 + udelay (1);
120 121  
121   - memctl->memc_mamr |= MAMR_PTAE; /* enable refresh */
  122 + memctl->memc_mamr |= MAMR_PTAE; /* enable refresh */
122 123  
123   - udelay (1000);
  124 + udelay (1000);
124 125  
125 126 /* Check Bank 0 Memory Size,
126 127 * 9 column mode
127 128 */
128 129  
129   - size9 = dram_size (CFG_MAMR_9COL, (ulong *)SDRAM_BASE_PRELIM, SDRAM_MAX_SIZE) ;
  130 + size9 = dram_size (CFG_MAMR_9COL, (ulong *) SDRAM_BASE_PRELIM,
  131 + SDRAM_MAX_SIZE);
130 132  
131 133 /*
132 134 * Final mapping:
... ... @@ -135,7 +137,7 @@
135 137 memctl->memc_or1 = ((-size9) & 0xFFFF0000) | CFG_OR_TIMING_SDRAM;
136 138 udelay (1000);
137 139  
138   - return (size9);
  140 + return (size9);
139 141 }
140 142  
141 143 /* ------------------------------------------------------------------------- */
142 144  
143 145  
144 146  
145 147  
146 148  
147 149  
148 150  
149 151  
150 152  
151 153  
... ... @@ -148,45 +150,59 @@
148 150 * - short between data lines
149 151 */
150 152  
151   -static long int dram_size (long int mamr_value, long int *base, long int maxsize)
  153 +static long int dram_size (long int mamr_value, long int *base,
  154 + long int maxsize)
152 155 {
153   - volatile immap_t *immap = (immap_t *)CFG_IMMR;
154   - volatile memctl8xx_t *memctl = &immap->im_memctl;
155   - volatile long int *addr;
156   - ulong cnt, val;
157   - ulong save[32]; /* to make test non-destructive */
158   - unsigned char i = 0;
  156 + volatile immap_t *immap = (immap_t *) CFG_IMMR;
  157 + volatile memctl8xx_t *memctl = &immap->im_memctl;
  158 + volatile long int *addr;
  159 + ulong cnt, val, size;
  160 + ulong save[32]; /* to make test non-destructive */
  161 + unsigned char i = 0;
159 162  
160   - memctl->memc_mamr = mamr_value;
  163 + memctl->memc_mamr = mamr_value;
161 164  
162   - for (cnt = maxsize/sizeof(long); cnt > 0; cnt >>= 1) {
163   - addr = base + cnt; /* pointer arith! */
  165 + for (cnt = maxsize / sizeof (long); cnt > 0; cnt >>= 1) {
  166 + addr = base + cnt; /* pointer arith! */
164 167  
165   - save[i++] = *addr;
166   - *addr = ~cnt;
167   - }
  168 + save[i++] = *addr;
  169 + *addr = ~cnt;
  170 + }
168 171  
169   - /* write 0 to base address */
170   - addr = base;
171   - save[i] = *addr;
172   - *addr = 0;
  172 + /* write 0 to base address */
  173 + addr = base;
  174 + save[i] = *addr;
  175 + *addr = 0;
173 176  
174   - /* check at base address */
175   - if ((val = *addr) != 0) {
176   - *addr = save[i];
177   - return (0);
178   - }
  177 + /* check at base address */
  178 + if ((val = *addr) != 0) {
  179 + /* Restore the original data before leaving the function.
  180 + */
  181 + *addr = save[i];
  182 + for (cnt = 1; cnt <= maxsize / sizeof(long); cnt <<= 1) {
  183 + addr = (volatile ulong *) base + cnt;
  184 + *addr = save[--i];
  185 + }
  186 + return (0);
  187 + }
179 188  
180   - for (cnt = 1; cnt <= maxsize/sizeof(long); cnt <<= 1) {
181   - addr = base + cnt; /* pointer arith! */
  189 + for (cnt = 1; cnt <= maxsize / sizeof (long); cnt <<= 1) {
  190 + addr = base + cnt; /* pointer arith! */
182 191  
183   - val = *addr;
184   - *addr = save[--i];
  192 + val = *addr;
  193 + *addr = save[--i];
185 194  
186   - if (val != (~cnt)) {
187   - return (cnt * sizeof(long));
  195 + if (val != (~cnt)) {
  196 + size = cnt * sizeof (long);
  197 + /* Restore the original data before returning
  198 + */
  199 + for (cnt <<= 1; cnt <= maxsize / sizeof (long); cnt <<= 1) {
  200 + addr = (volatile ulong *) base + cnt;
  201 + *addr = save[--i];
  202 + }
  203 + return (size);
  204 + }
188 205 }
189   - }
190   - return (maxsize);
  206 + return (maxsize);
191 207 }
board/tqm8260/tqm8260.c
... ... @@ -230,7 +230,7 @@
230 230 volatile uint *orx_ptr;
231 231 int i;
232 232 ulong save[32]; /* to make test non-destructive */
233   - ulong maxsize;
  233 + ulong maxsize, size;
234 234  
235 235 /* We must be able to test a location outsize the maximum legal size
236 236 * to find out THAT we are outside; but this address still has to be
237 237  
... ... @@ -299,7 +299,13 @@
299 299 *addr = 0;
300 300  
301 301 if ((val = *addr) != 0) {
  302 + /* Restore the original data before leaving the function.
  303 + */
302 304 *addr = save[i];
  305 + for (cnt = 1; cnt <= maxsize / sizeof(long); cnt <<= 1) {
  306 + addr = (volatile ulong *) base + cnt;
  307 + *addr = save[--i];
  308 + }
303 309 return (0);
304 310 }
305 311  
306 312  
... ... @@ -308,10 +314,17 @@
308 314 val = *addr;
309 315 *addr = save[--i];
310 316 if (val != ~cnt) {
  317 + size = cnt * sizeof (long);
  318 + /* Restore the original data before leaving the function.
  319 + */
  320 + for (cnt <<= 1; cnt <= maxsize / sizeof (long); cnt <<= 1) {
  321 + addr = (volatile ulong *) base + cnt;
  322 + *addr = save[--i];
  323 + }
311 324 /* Write the actual size to ORx
312 325 */
313   - *orx_ptr = orx | ~(cnt * sizeof (long) - 1);
314   - return (cnt * sizeof (long));
  326 + *orx_ptr = orx | ~(size - 1);
  327 + return (size);
315 328 }
316 329 }
317 330 return (maxsize);
board/tqm8xx/tqm8xx.c
... ... @@ -389,8 +389,8 @@
389 389 volatile immap_t *immap = (immap_t *) CFG_IMMR;
390 390 volatile memctl8xx_t *memctl = &immap->im_memctl;
391 391 volatile long int *addr;
392   - ulong cnt, val;
393   - ulong save[32]; /* to make test non-destructive */
  392 + ulong cnt, val, size;
  393 + ulong save[32]; /* to make test non-destructive */
394 394 unsigned char i = 0;
395 395  
396 396 memctl->memc_mamr = mamr_value;
397 397  
... ... @@ -409,7 +409,13 @@
409 409  
410 410 /* check at base address */
411 411 if ((val = *addr) != 0) {
  412 + /* Restore the original data before leaving the function.
  413 + */
412 414 *addr = save[i];
  415 + for (cnt = 1; cnt <= maxsize / sizeof(long); cnt <<= 1) {
  416 + addr = (volatile ulong *) base + cnt;
  417 + *addr = save[--i];
  418 + }
413 419 return (0);
414 420 }
415 421  
... ... @@ -420,7 +426,14 @@
420 426 *addr = save[--i];
421 427  
422 428 if (val != (~cnt)) {
423   - return (cnt * sizeof (long));
  429 + size = cnt * sizeof (long);
  430 + /* Restore the original data before returning
  431 + */
  432 + for (cnt <<= 1; cnt <= maxsize / sizeof (long); cnt <<= 1) {
  433 + addr = (volatile ulong *) base + cnt;
  434 + *addr = save[--i];
  435 + }
  436 + return (size);
424 437 }
425 438 }
426 439 return (maxsize);
... ... @@ -33,11 +33,6 @@
33 33  
34 34 #if (CONFIG_COMMANDS & CFG_CMD_FAT)
35 35  
36   -#ifdef CONFIG_AUTO_UPDATE
37   -/* the VFAT code has a bug which breaks auto update */
38   -#undef CONFIG_SUPPORT_VFAT
39   -#endif
40   -
41 36 /*
42 37 * Convert a string to lowercase.
43 38 */
... ... @@ -429,6 +424,7 @@
429 424 * into 'retdent'
430 425 * Return 0 on success, -1 otherwise.
431 426 */
  427 +__u8 get_vfatname_block[MAX_CLUSTSIZE];
432 428 static int
433 429 get_vfatname(fsdata *mydata, int curclust, __u8 *cluster,
434 430 dir_entry *retdent, char *l_name)
... ... @@ -447,7 +443,6 @@
447 443 }
448 444  
449 445 if ((__u8*)slotptr >= nextclust) {
450   - __u8 block[MAX_CLUSTSIZE];
451 446 dir_slot *slotptr2;
452 447  
453 448 slotptr--;
454 449  
455 450  
... ... @@ -457,18 +452,18 @@
457 452 FAT_ERROR("Invalid FAT entry\n");
458 453 return -1;
459 454 }
460   - if (get_cluster(mydata, curclust, block,
  455 + if (get_cluster(mydata, curclust, get_vfatname_block,
461 456 mydata->clust_size * SECTOR_SIZE) != 0) {
462 457 FAT_DPRINT("Error: reading directory block\n");
463 458 return -1;
464 459 }
465   - slotptr2 = (dir_slot*) block;
  460 + slotptr2 = (dir_slot*) get_vfatname_block;
466 461 while (slotptr2->id > 0x01) {
467 462 slotptr2++;
468 463 }
469 464 /* Save the real directory entry */
470 465 realdent = (dir_entry*)slotptr2 + 1;
471   - while ((__u8*)slotptr2 >= block) {
  466 + while ((__u8*)slotptr2 >= get_vfatname_block) {
472 467 slot2str(slotptr2, l_name, &idx);
473 468 slotptr2--;
474 469 }
475 470  
... ... @@ -514,12 +509,12 @@
514 509 * Get the directory entry associated with 'filename' from the directory
515 510 * starting at 'startsect'
516 511 */
  512 +__u8 get_dentfromdir_block[MAX_CLUSTSIZE];
517 513 static dir_entry *get_dentfromdir (fsdata * mydata, int startsect,
518 514 char *filename, dir_entry * retdent,
519 515 int dols)
520 516 {
521 517 __u16 prevcksum = 0xffff;
522   - __u8 block[MAX_CLUSTSIZE];
523 518 __u32 curclust = START (retdent);
524 519 int files = 0, dirs = 0;
525 520  
526 521  
... ... @@ -528,12 +523,12 @@
528 523 dir_entry *dentptr;
529 524 int i;
530 525  
531   - if (get_cluster (mydata, curclust, block,
  526 + if (get_cluster (mydata, curclust, get_dentfromdir_block,
532 527 mydata->clust_size * SECTOR_SIZE) != 0) {
533 528 FAT_DPRINT ("Error: reading directory block\n");
534 529 return NULL;
535 530 }
536   - dentptr = (dir_entry *) block;
  531 + dentptr = (dir_entry *) get_dentfromdir_block;
537 532 for (i = 0; i < DIRENTSPERCLUST; i++) {
538 533 char s_name[14], l_name[256];
539 534  
... ... @@ -544,7 +539,7 @@
544 539 (dentptr->name[0] & 0x40)) {
545 540 prevcksum = ((dir_slot *) dentptr)
546 541 ->alias_checksum;
547   - get_vfatname (mydata, curclust, block,
  542 + get_vfatname (mydata, curclust, get_dentfromdir_block,
548 543 dentptr, l_name);
549 544 if (dols) {
550 545 int isdir = (dentptr->attr & ATTR_DIR);
551 546  
... ... @@ -716,11 +711,11 @@
716 711 }
717 712  
718 713  
  714 +__u8 do_fat_read_block[MAX_CLUSTSIZE]; /* Block buffer */
719 715 static long
720 716 do_fat_read (const char *filename, void *buffer, unsigned long maxsize,
721 717 int dols)
722 718 {
723   - __u8 block[MAX_CLUSTSIZE]; /* Block buffer */
724 719 char fnamecopy[2048];
725 720 boot_sector bs;
726 721 volume_info volinfo;
727 722  
... ... @@ -792,11 +787,11 @@
792 787 while (1) {
793 788 int i;
794 789  
795   - if (disk_read (cursect, mydata->clust_size, block) < 0) {
  790 + if (disk_read (cursect, mydata->clust_size, do_fat_read_block) < 0) {
796 791 FAT_DPRINT ("Error: reading rootdir block\n");
797 792 return -1;
798 793 }
799   - dentptr = (dir_entry *) block;
  794 + dentptr = (dir_entry *) do_fat_read_block;
800 795 for (i = 0; i < DIRENTSPERBLOCK; i++) {
801 796 char s_name[14], l_name[256];
802 797  
... ... @@ -806,7 +801,7 @@
806 801 if ((dentptr->attr & ATTR_VFAT) &&
807 802 (dentptr->name[0] & 0x40)) {
808 803 prevcksum = ((dir_slot *) dentptr)->alias_checksum;
809   - get_vfatname (mydata, 0, block, dentptr, l_name);
  804 + get_vfatname (mydata, 0, do_fat_read_block, dentptr, l_name);
810 805 if (dols == LS_ROOT) {
811 806 int isdir = (dentptr->attr & ATTR_DIR);
812 807 char dirc;
... ... @@ -24,7 +24,7 @@
24 24 #ifndef __VERSION_H__
25 25 #define __VERSION_H__
26 26  
27   -#define U_BOOT_VERSION "U-Boot 1.0.0-pre"
  27 +#define U_BOOT_VERSION "U-Boot 1.0.0"
28 28  
29 29 #endif /* __VERSION_H__ */
... ... @@ -111,9 +111,9 @@
111 111  
112 112 static int display_banner (void)
113 113 {
  114 +#ifdef CONFIG_SILENT_CONSOLE
114 115 DECLARE_GLOBAL_DATA_PTR;
115 116  
116   -#ifdef CONFIG_SILENT_CONSOLE
117 117 if (gd->flags & GD_FLG_SILENT)
118 118 return (0);
119 119 #endif
120 120  
... ... @@ -161,9 +161,9 @@
161 161  
162 162 static void display_flash_config (ulong size)
163 163 {
  164 +#ifdef CONFIG_SILENT_CONSOLE
164 165 DECLARE_GLOBAL_DATA_PTR;
165 166  
166   -#ifdef CONFIG_SILENT_CONSOLE
167 167 if (gd->flags & GD_FLG_SILENT)
168 168 return;
169 169 #endif