Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Nov 2011 13:22:13 +0530
From:      "Jayachandran C." <jchandra@freebsd.org>
To:        Rafal Jaworowski <raj@semihalf.com>, Nathan Whitehorn <nwhitehorn@freebsd.org>, freebsd-arm@freebsd.org,  freebsd-ppc@freebsd.org, FreeBSD Current <freebsd-current@freebsd.org>
Cc:        Marcel Moolenaar <marcel@freebsd.org>
Subject:   [RFC] Fix OF_finddevice return code for FDT
Message-ID:  <CA%2B7sy7DMHQgo8f%2Byj7oNOkti28Hg8zOtwJwhNCgVUdksMPru1g@mail.gmail.com>
In-Reply-To: <CA%2B7sy7DJEHNjSQvL3mySEoN0KQyCbhwQF8odaoysTDkv1AQLRg@mail.gmail.com>
References:  <CA%2B7sy7DJEHNjSQvL3mySEoN0KQyCbhwQF8odaoysTDkv1AQLRg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
--0016e65a0986df04a304b0cfdd47
Content-Type: text/plain; charset=ISO-8859-1

[I had posted this to freebsd-ppc@ and freebsd-arm@, did not see any
comments, posting to freebsd-current@ to see if there is any interest
or comments]

While reviewing the previous FDT patch, nwhitehorn@ noted that the
return code of OF_finddevice was not correct in case of FDT. According
to the 1275 standard, we should return a phandle value of -1 in case
of error, but the ofw_fdt_finddevice implementation now returns 0.

The attached patches fixes this in the FDT code, and makes changes in
the callers to check the return code correctly. Since most of the
callers are in ARM, any testing on ARM would be really appreciated.

Thanks,
JC.

--0016e65a0986df04a304b0cfdd47
Content-Type: application/octet-stream; name="fdt-finddevice-fix.patch"
Content-Disposition: attachment; filename="fdt-finddevice-fix.patch"
Content-Transfer-Encoding: base64
X-Attachment-Id: f_gtygvap00

Y29tbWl0IDgxMDc2ZThhYTRjYmYyM2M4YWQ4OTBlYzg1MTVmNzkxN2JhZTJhYjgKQXV0aG9yOiBK
YXlhY2hhbmRyYW4gQyA8amF5YWNoYW5kcmFuY0BuZXRsb2dpY21pY3JvLmNvbT4KRGF0ZTogICBU
dWUgT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vdXQpKSA9PSAtMSkKIAkJCXN0
ZG91dCA9IC0xOwogCmRpZmYgLS1naXQgYS9zeXMvZGV2L3VhcnQvdWFydF9idXNfZmR0LmMgYi9z
eXMvZGV2L3VhcnQvdWFydF9idXNfZmR0LmMKaW5kZXggNDIwOTg2Ni4uOGJiNjJlYSAxMDA2NDQK
LS0tIGEvc3lzL2Rldi91YXJ0L3VhcnRfYnVzX2ZkdC5jCisrKyBiL3N5cy9kZXYvdWFydC91YXJ0
X2J1c19mZHQuYwpAQCAtMTU1LDExICsxNTUsMTEgQEAgdWFydF9jcHVfZ2V0ZGV2KGludCBkZXZ0
eXBlLCBzdHJ1Y3QgdWFydF9kZXZpbmZvICpkaSkKIAkvKgogCSAqIFJldHJpZXZlIC9jaG9zZW4v
c3Rke2luLG91dH0uCiAJICovCi0JaWYgKChjaG9zZW4gPSBPRl9maW5kZGV2aWNlKCIvY2hvc2Vu
IikpID09IDApCisJaWYgKChjaG9zZW4gPSBPRl9maW5kZGV2aWNlKCIvY2hvc2VuIikpID09IC0x
KQogCQlyZXR1cm4gKEVOWElPKTsKIAlpZiAoT0ZfZ2V0cHJvcChjaG9zZW4sICJzdGRpbiIsIGJ1
Ziwgc2l6ZW9mKGJ1ZikpIDw9IDApCiAJCXJldHVybiAoRU5YSU8pOwotCWlmICgobm9kZSA9IE9G
X2ZpbmRkZXZpY2UoYnVmKSkgPT0gMCkKKwlpZiAoKG5vZGUgPSBPRl9maW5kZGV2aWNlKGJ1Zikp
ID09IC0xKQogCQlyZXR1cm4gKEVOWElPKTsKIAlpZiAoT0ZfZ2V0cHJvcChjaG9zZW4sICJzdGRv
dXQiLCBidWYsIHNpemVvZihidWYpKSA8PSAwKQogCQlyZXR1cm4gKEVOWElPKTsK
--0016e65a0986df04a304b0cfdd47
Content-Type: application/octet-stream; name="arm-fixes.patch"
Content-Disposition: attachment; filename="arm-fixes.patch"
Content-Transfer-Encoding: base64
X-Attachment-Id: f_gtygvc7g1

ZGlmZiAtLWdpdC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MSkKIAkJcmV0dXJuIChFTlhJTyk7CiAKIAlpZiAoKG5vZGUgPSBmZHRfZmluZF9jb21w
YXRpYmxlKG5vZGUsICJzaW1wbGUtYnVzIiwgMCkpID09IDApCkBAIC03NTIsNyArNzUyLDcgQEAg
cGxhdGZvcm1fZGV2bWFwX2luaXQodm9pZCkKIAkvKgogCSAqIFBDSSByYW5nZShzKS4KIAkgKi8K
LQlpZiAoKHJvb3QgPSBPRl9maW5kZGV2aWNlKCIvIikpID09IDApCisJaWYgKChyb290ID0gT0Zf
ZmluZGRldmljZSgiLyIpKSA9PSAtMSkKIAkJcmV0dXJuIChFTlhJTyk7CiAKIAlmb3IgKGNoaWxk
ID0gT0ZfY2hpbGQocm9vdCk7IGNoaWxkICE9IDA7IGNoaWxkID0gT0ZfcGVlcihjaGlsZCkpCkBA
IC03NzksNyArNzc5LDcgQEAgcGxhdGZvcm1fZGV2bWFwX2luaXQodm9pZCkKIAkvKgogCSAqIENF
U0EgU1JBTSByYW5nZS4KIAkgKi8KLQlpZiAoKGNoaWxkID0gT0ZfZmluZGRldmljZSgic3JhbSIp
KSAhPSAwKQorCWlmICgoY2hpbGQgPSBPRl9maW5kZGV2aWNlKCJzcmFtIikpICE9IC0xKQogCQlp
ZiAoZmR0X2lzX2NvbXBhdGlibGUoY2hpbGQsICJtcnZsLGNlc2Etc3JhbSIpKQogCQkJZ290byBt
b3Zlb247CiAK
--0016e65a0986df04a304b0cfdd47
Content-Type: application/octet-stream; name="ppc-fixes.patch"
Content-Disposition: attachment; filename="ppc-fixes.patch"
Content-Transfer-Encoding: base64
X-Attachment-Id: f_gtygvczc2

ZGlmZiAtLWdpdCBhL3N5cy9kZXYvZmR0L2ZkdF9wb3dlcnBjLmMgYi9zeXMvZGV2L2ZkdC9mZHRf
cG93ZXJwYy5jCmluZGV4IGVhNjE0ZGIuLmFjODFjMDggMTAwNjQ0Ci0tLSBhL3N5cy9kZXYvZmR0
L2ZkdF9wb3dlcnBjLmMKKysrIGIvc3l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