This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
RedBoot - Fix FIS broken commands
- From: Gary Thomas <gary at mlbassoc dot com>
- To: eCos patches <ecos-patches at sources dot redhat dot com>
- Date: 26 Sep 2003 12:45:48 -0600
- Subject: RedBoot - Fix FIS broken commands
- Organization: MLB Associates
FIS 'free' and 'create' were broken by the addition of
NAND device support. These patches fix that.
Thanks to Jani Monoses for pointing out this breakage.
--
Gary Thomas <gary@mlbassoc.com>
MLB Associates
Index: redboot/current/ChangeLog
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/redboot/current/ChangeLog,v
retrieving revision 1.140
diff -u -5 -p -r1.140 ChangeLog
--- redboot/current/ChangeLog 26 Sep 2003 17:44:17 -0000 1.140
+++ redboot/current/ChangeLog 26 Sep 2003 18:42:55 -0000
@@ -3,10 +3,14 @@
* doc/redboot_installing.sgml: Fixed bogus memory sizes in AT91
EB42/55 description.
2003-09-26 Gary Thomas <gary@mlbassoc.com>
+ * src/flash.c (fis_free, fis_find_free):
+ Fix some problems introduced with the new FLASH interfaces (used by
+ NAND devices)
+
* src/fconfig.c: Honor FLASH/FIS configury.
* src/net/bootp.c:
* src/fs/ide.c: Clean up some compiler warnings.
Index: redboot/current/src/flash.c
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/redboot/current/src/flash.c,v
retrieving revision 1.51
diff -u -5 -p -r1.51 flash.c
--- redboot/current/src/flash.c 19 Sep 2003 17:11:34 -0000 1.51
+++ redboot/current/src/flash.c 26 Sep 2003 18:31:10 -0000
@@ -491,32 +491,33 @@ fis_list(int argc, char *argv[])
}
static void
fis_free(int argc, char *argv[])
{
- unsigned long *fis_ptr, *fis_end;
+ unsigned long *fis_ptr, *fis_end, flash_data;
unsigned long *area_start;
void *err_addr;
// Do not search the area reserved for pre-RedBoot systems:
- flash_read(fis_addr, fis_work_block, fisdir_size, (void **)&err_addr);
- fis_ptr = (unsigned long *)((CYG_ADDRESS)fis_work_block +
+ fis_ptr = (unsigned long *)((CYG_ADDRESS)flash_start +
CYGNUM_REDBOOT_FLASH_RESERVED_BASE +
CYGBLD_REDBOOT_MIN_IMAGE_SIZE);
fis_end = (unsigned long *)(CYG_ADDRESS)flash_end;
area_start = fis_ptr;
while (fis_ptr < fis_end) {
- if (*fis_ptr != (unsigned long)0xFFFFFFFF) {
+ flash_read(fis_ptr, &flash_data, sizeof(unsigned long), (void **)&err_addr);
+ if (flash_data != (unsigned long)0xFFFFFFFF) {
if (area_start != fis_ptr) {
// Assume that this is something
diag_printf(" 0x%08lX .. 0x%08lX\n",
(CYG_ADDRESS)area_start, (CYG_ADDRESS)fis_ptr);
}
// Find next blank block
area_start = fis_ptr;
while (area_start < fis_end) {
- if (*area_start == (unsigned long)0xFFFFFFFF) {
+ flash_read(area_start, &flash_data, sizeof(unsigned long), (void **)&err_addr);
+ if (flash_data == (unsigned long)0xFFFFFFFF) {
break;
}
area_start += flash_block_size / sizeof(CYG_ADDRESS);
}
fis_ptr = area_start;
@@ -532,34 +533,35 @@ fis_free(int argc, char *argv[])
// Find the first unused area of flash which is long enough
static bool
fis_find_free(CYG_ADDRESS *addr, unsigned long length)
{
- unsigned long *fis_ptr, *fis_end;
+ unsigned long *fis_ptr, *fis_end, flash_data;
unsigned long *area_start;
void *err_addr;
// Do not search the area reserved for pre-RedBoot systems:
- flash_read(fis_addr, fis_work_block, fisdir_size, (void **)&err_addr);
- fis_ptr = (unsigned long *)((CYG_ADDRESS)fis_work_block +
+ fis_ptr = (unsigned long *)((CYG_ADDRESS)flash_start +
CYGNUM_REDBOOT_FLASH_RESERVED_BASE +
CYGBLD_REDBOOT_MIN_IMAGE_SIZE);
fis_end = (unsigned long *)(CYG_ADDRESS)flash_end;
area_start = fis_ptr;
while (fis_ptr < fis_end) {
- if (*fis_ptr != (unsigned long)0xFFFFFFFF) {
+ flash_read(fis_ptr, &flash_data, sizeof(unsigned long), (void **)&err_addr);
+ if (flash_data != (unsigned long)0xFFFFFFFF) {
if (area_start != fis_ptr) {
// Assume that this is something
if ((fis_ptr-area_start) >= (length/sizeof(unsigned))) {
*addr = (CYG_ADDRESS)area_start;
return true;
}
}
// Find next blank block
area_start = fis_ptr;
while (area_start < fis_end) {
- if (*area_start == (unsigned long)0xFFFFFFFF) {
+ flash_read(area_start, &flash_data, sizeof(unsigned long), (void **)&err_addr);
+ if (flash_data == (unsigned long)0xFFFFFFFF) {
break;
}
area_start += flash_block_size / sizeof(CYG_ADDRESS);
}
fis_ptr = area_start;