From: Wolfgang Denk Date: Sun, 20 Apr 2008 23:52:31 +0200 Subject: [U-Boot-Users] [PATCH] cfi-flash: Add CFG_FLASH_AUTOPROTECT_LIST In-Reply-To: Your message of "Sun, 20 Apr 2008 15:22:40 +0200." <200804201522.40808.matthias.fuchs@esd-electronics.com> Message-ID: <20080420215231.9B0F824657@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Matthias, in message <200804201522.40808.matthias.fuchs@esd-electronics.com> you wrote: > > even though I like the weak stuff, I agree with you. I also like Stefan's > idea about removing the #ifdef from the code. > > So I will update my patch in this direction. Thanks. > The main idea behind my patch is to fix the bootloader autoprotection > for 4xx. Do you (sr, J., others) think i is also a good idea to add this: > > /* Monitor protection ON by default */ > #if (CFG_MONITOR_BASE >= CFG_FLASH_BASE) > flash_protect (FLAG_PROTECT_SET, > CFG_MONITOR_BASE, > +#if defined(CONFIG_4xx) > 0xffffffff, > +#else > CFG_MONITOR_BASE + monitor_flash_len - 1, > +#endif > flash_get_info(CFG_MONITOR_BASE)); > #endif No, I don't think this is a good idea. First, I don't see what is so special about 4xx here. There are other processors which have the reset vector at the end of the address space as well, so why do it for 4xx and not - for example - for 85xx? Also, what makes you think it is reasonable to protect everything from CFG_MONITOR_BASE to the end of memory? Yes, we usually pot U-Boot close to the end of the flash memory, but there is no guarantee that every board configuration works that way. We could put U-Boot at the beginning of the flash instead and just reserve a single sector at the end of the flash for the reset vector. OK, that would need adaption of the linker script as well, but ... I don't think this hardwired, absolute constant makes sense to me. If 0xffffffff is really the value to use, then it should be identical to the "CFG_MONITOR_BASE + monitor_flash_len - 1" expression, and then we should have no need for the #ifdef at all. > To be honest, I hope to get my autoprotection patch into 1.3.3 (as a bug fix). I see. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Microsoft Compatibility: your old Windows 3.11 application crash exactly as the new ones.