From: Bin Meng <bmeng.cn@gmail.com>
To: u-boot@lists.denx.de
Subject: [PATCH 1/2] of: addr: Abort address translation for parent nodes missing 'ranges'
Date: Fri, 26 Feb 2021 15:35:48 +0800 [thread overview]
Message-ID: <1614324949-61314-1-git-send-email-bmeng.cn@gmail.com> (raw)
The implementation of of_translate_one() was taken from the one in
Linux kernel drivers/of/address.c, and the Linux one added a quirk
for Apple Macs that don't have the <ranges> property in the parent
node. Since U-Boot does not support Apple Macs, remove the comment
block and adhere to the spec to abort the translation.
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---
drivers/core/of_addr.c | 24 ++++++------------------
1 file changed, 6 insertions(+), 18 deletions(-)
diff --git a/drivers/core/of_addr.c b/drivers/core/of_addr.c
index 5bc6ca1..36cdfd3 100644
--- a/drivers/core/of_addr.c
+++ b/drivers/core/of_addr.c
@@ -173,25 +173,13 @@ static int of_translate_one(const struct device_node *parent,
int rone;
u64 offset = OF_BAD_ADDR;
- /*
- * Normally, an absence of a "ranges" property means we are
- * crossing a non-translatable boundary, and thus the addresses
- * below the current cannot be converted to CPU physical ones.
- * Unfortunately, while this is very clear in the spec, it's not
- * what Apple understood, and they do have things like /uni-n or
- * /ht nodes with no "ranges" property and a lot of perfectly
- * useable mapped devices below them. Thus we treat the absence of
- * "ranges" as equivalent to an empty "ranges" property which means
- * a 1:1 translation at that level. It's up to the caller not to try
- * to translate addresses that aren't supposed to be translated in
- * the first place. --BenH.
- *
- * As far as we know, this damage only exists on Apple machines, so
- * This code is only enabled on powerpc. --gcl
- */
-
ranges = of_get_property(parent, rprop, &rlen);
- if (ranges == NULL || rlen == 0) {
+ if (ranges == NULL) {
+ debug("no ranges; cannot translate\n");
+ return 1;
+ }
+
+ if (rlen == 0) {
offset = of_read_number(addr, na);
memset(addr, 0, pna * 4);
debug("empty ranges; 1:1 translation\n");
--
2.7.4
next reply other threads:[~2021-02-26 7:35 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-26 7:35 Bin Meng [this message]
2021-02-26 7:35 ` [PATCH 2/2] of: addr: Translate 'dma-ranges' for parent nodes missing 'dma-ranges' Bin Meng
2021-03-03 1:54 ` Simon Glass
2021-03-03 1:54 ` [PATCH 1/2] of: addr: Abort address translation for parent nodes missing 'ranges' Simon Glass
2021-03-15 7:11 ` Simon Glass
2021-03-15 14:47 ` Bin Meng
2021-03-15 18:23 ` Simon Glass
2021-03-15 22:49 ` Dario Binacchi
2021-03-16 1:28 ` Bin Meng
2021-03-16 20:57 ` Dario Binacchi
2021-03-17 1:26 ` Bin Meng
2021-03-18 7:27 ` Dario Binacchi
2021-03-18 19:51 ` Tom Rini
2021-03-21 15:19 ` Dario Binacchi
2021-03-22 1:25 ` Bin Meng
2021-03-23 17:27 ` Dario Binacchi
2021-03-24 1:35 ` Bin Meng
2021-04-06 14:26 ` Rob Herring
2021-04-06 21:52 ` Dario Binacchi
2021-04-07 14:42 ` Rob Herring
2021-04-07 16:14 ` Simon Glass
2021-04-07 18:45 ` Tom Rini
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=1614324949-61314-1-git-send-email-bmeng.cn@gmail.com \
--to=bmeng.cn@gmail.com \
--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