From: J. William Campbell <jwilliamcampbell@comcast.net>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] Atmel DataFlash hooks.
Date: Mon, 29 Jan 2007 15:03:19 -0800 [thread overview]
Message-ID: <45BE7D37.5090601@comcast.net> (raw)
In-Reply-To: <20070129214801.E7F8C353AA1@atlas.denx.de>
Wolfgang Denk wrote:
<snip>
>>>No - if flash regions are mapped contiguously, a "cp" should be able
>>>to cross device boundaries transparently.
>>>
>>>
>>Actually, what I said above is wrong. The flash_write code DOES allow
>>crossing flash type boundaries. What is not allowed in the flash_write
>>routine is starting in flash and ending in non-flash. This throws an
>>error. Starting in flash, intervening ram, ending in flash would not
>>work properly. Holes in the memory map between flash regions also would
>>
>>
>
>
>
Actually, I am still wrong. The flash code allows crossing flash chip
boundaries of the same type. It does not support crossing flash type
boundaries of different types unless the write_buff routine chosen for
the target board does some additional de-multiplexing. Thus, if you use
common/cfi_flash.c, all your flash needs to be cfi flash. Many of the
flash routines in the board/ directory do support more than one type of
flash. I just wanted to state this correctly.
>You are right. But anybody who is crazy enough to come up with such a
>memory map should fix his design before complaining that U-Boot does
>not support all possible pathologic cases.
>
>
OK, that makes sense.
>
>
>>not work properly. This may be defined as an error, but you don't get
>>an error message in these cases as near as I can tell. Rather, the code
>>
>>
>
>There are many other misconfigurations that result in non-working
>systems without useful error message (in most cases because the code
>crashes long before it can send any messages at all).
>
>
OK, but there are also cases where you DO get an error. I assume it
depends mostly on the cost of detecting the error and how
important/probable the error condition may be.
>
>
>>seems to do something untoward in the next flash bank. It would be
>>trivial to detect and throw an error for these cases, but the current
>>code does not. Also, there are several places in the current code where
>>
>>
>
>As mentioned before: I tend to consider this as a design error which
>is not worth the code for runtime error checking.
>
>
OK. I'm not sure I totally agree, as I think the parameters could easily
be checked in addr2info in a manner that should not increase the
footprint much if at all. I will submit a patch and see what you think.
On the other hand you are quite right that nothing prevents the user
from copying from non-existent memory to non-existent memory, so other
address errors are no different.
>
>
>>it is assumed that if the initial destination address is in ram, the
>>entire operation is in ram. This can be false if ram and flash are
>>contiguously mapped. IMNSHO this condition should either work or be an
>>error that is detected.
>>
>>
>
>If you look close enough, you can find many problematic situations -
>eception vectors, malloc arena, stack, U-Boot code, data and BSS etc.
>are not protected in RAM - you can easily overwrite any of these
>without any protection.
>
>You can do a lot more mess when meddeling with PCI memory.
>
>U-Boot does not attampt to prevent all possible kind of user errors.
>It was designed to be small, powerful, and easy to port.
>
>Here is one of my favorite quotes which fully applies to U-Boot, too:
>
>"UNIX was not designed to stop you from doing stupid things, because
>that would also stop you from doing clever things." - Doug Gwyn
>
>
Agreed and understood.
>
>
>>There is also a semantic question regarding the meaning of the size part
>>of the cp.X command when the destination operand is flash. If the
>>destination operand is in flash, the size of the operand for both the
>>source and destination addresses is not enforced. The size of access is
>>enforced if the destination is ram. This may be a bit of a nit, but I
>>
>>
>
>Sorry, I cannot parse this. Please explain.
>
>
>
>>bring it up for completeness. cp.l commands that look like they for sure
>>should generate an alignment exception will not do so if the destination
>>is flash.
>>
>>
>
>Why should they?
>
Well, my thought on this is that UNIX (and u-boot) also follows the
Principle of Least Surprise, namely that like cases tend to work alike.
If I type cp.l 0x3 0x10 0x1 on a system that enforces longword (4 byte
words) to be aligned, it will throw an exception and not work. I would
therefore also expect cp.l 0x3 <some flash address> 0x1 to also throw an
exception and not work for the same reason, yet it does not do so. It is
executed as cp.b 0x3 <some flash address> 0x1, which is not what I asked
for. Like I said, this is a nit and probably not important. I expect few
people use cp.l to copy into flash anyway. It was just a difference
between flash and ram that I noticed.
Best Regards,
Bill Campbell
>
>
>Best regards,
>
>Wolfgang Denk
>
>
>
next prev parent reply other threads:[~2007-01-29 23:03 UTC|newest]
Thread overview: 78+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-26 16:45 [U-Boot-Users] Atmel DataFlash hooks Peter.Pearse
2007-01-26 19:11 ` Grant Likely
2007-01-26 21:25 ` Wolfgang Denk
2007-01-26 22:34 ` Grant Likely
2007-01-27 0:42 ` Wolfgang Denk
2007-01-27 1:52 ` Grant Likely
2007-01-27 4:11 ` [U-Boot-Users] Arm-linux-gcc malloc get failure while arm-elf-gcc ok Rui.Zhou at nokia.com
2007-01-27 11:46 ` Rui.Zhou at nokia.com
2007-01-27 13:34 ` [U-Boot-Users] Atmel DataFlash hooks Andreas Schweigstill
2007-01-27 16:36 ` Wolfgang Denk
2007-01-27 17:04 ` Andreas Schweigstill
2007-01-27 17:17 ` Ulf Samuelsson
2007-01-28 14:39 ` Wolfgang Denk
2007-01-29 1:32 ` Andreas Schweigstill
2007-01-29 12:52 ` Wolfgang Denk
2007-01-27 22:19 ` Grant Likely
2007-01-28 1:47 ` J. William Campbell
2007-01-28 15:17 ` Wolfgang Denk
2007-01-28 22:21 ` J. William Campbell
2007-01-28 22:50 ` Wolfgang Denk
2007-01-29 2:50 ` Grant Likely
2007-01-29 13:07 ` Wolfgang Denk
2007-01-29 21:06 ` Haavard Skinnemoen
2007-01-29 22:57 ` Ulf Samuelsson
2007-01-29 23:55 ` Wolfgang Denk
2007-01-30 0:28 ` Haavard Skinnemoen
2007-01-30 1:03 ` Wolfgang Denk
2007-01-30 1:16 ` Haavard Skinnemoen
2007-01-30 22:23 ` Wolfgang Denk
2007-01-30 6:52 ` Ulf Samuelsson
2007-01-31 7:44 ` Tolunay Orkun
2007-01-29 3:17 ` J. William Campbell
2007-01-29 7:35 ` Ulf Samuelsson
2007-01-29 13:36 ` Wolfgang Denk
2007-01-29 13:29 ` Wolfgang Denk
2007-01-29 20:45 ` J. William Campbell
2007-01-29 21:48 ` Wolfgang Denk
2007-01-29 23:03 ` J. William Campbell [this message]
2007-01-30 0:01 ` Wolfgang Denk
2007-01-29 23:08 ` Ulf Samuelsson
2007-01-30 0:48 ` J. William Campbell
2007-01-30 1:06 ` Wolfgang Denk
2007-01-30 6:55 ` Ulf Samuelsson
2007-01-31 17:11 ` Grant Likely
2007-01-31 17:37 ` Ulf Samuelsson
2007-01-31 21:55 ` Wolfgang Denk
2007-01-31 23:13 ` Ulf Samuelsson
2007-01-31 23:50 ` Grant Likely
2007-02-01 0:06 ` Wolfgang Denk
2007-02-01 2:46 ` Tolunay Orkun
2007-01-29 11:10 ` Stefan Roese
2007-01-29 2:27 ` Grant Likely
2007-01-28 15:01 ` Wolfgang Denk
2007-01-29 2:33 ` Grant Likely
2007-01-29 7:49 ` Ulf Samuelsson
2007-01-29 13:38 ` Wolfgang Denk
[not found] ` <528646bc0701310848x4c63cf53gd228f860c0fd0444@mail.gmail.com>
2007-01-31 16:50 ` Grant Likely
2007-02-01 12:40 ` Andreas Schweigstill
2007-01-29 12:56 ` Wolfgang Denk
2007-01-29 10:43 ` Stefan Roese
-- strict thread matches above, loose matches on Subject: below --
2007-01-26 8:44 Grant Likely
2007-01-26 9:42 ` Peter.Pearse
2007-01-26 13:53 ` Wolfgang Denk
2007-01-26 19:24 ` Grant Likely
2007-01-26 21:27 ` Wolfgang Denk
2007-01-26 22:35 ` Grant Likely
[not found] ` <000001c7416f$fa61fed0$01c4af0a@atmel.com>
2007-01-26 19:02 ` Grant Likely
[not found] ` <02eb01c74180$c4911410$01c4af0a@atmel.com>
2007-01-26 20:27 ` Grant Likely
2007-01-26 21:21 ` Ulf Samuelsson
2007-01-26 22:40 ` Grant Likely
2007-01-26 23:01 ` Ulf Samuelsson
2007-01-26 23:46 ` Grant Likely
2007-01-27 9:44 ` Ulf Samuelsson
2007-01-29 10:49 ` Stefan Roese
2007-01-29 13:44 ` Peter.Pearse
2007-01-29 14:47 ` Stefan Roese
2007-01-29 16:03 ` Wolfgang Denk
2007-01-29 10:33 ` Stefan Roese
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=45BE7D37.5090601@comcast.net \
--to=jwilliamcampbell@comcast.net \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox