Date: Thu, 7 May 2015 12:07:40 +0000 From: "zbb (Zbigniew Bodek)" <phabric-noreply@FreeBSD.org> To: freebsd-arm@freebsd.org Subject: [Differential] [Updated, 1, 482 lines] D2357: Port x86 busdma to ARM64 Message-ID: <0898dab31300b56c7a2404adbbcb53b3@localhost.localdomain> In-Reply-To: <differential-rev-PHID-DREV-h7f3zkqdq4qxyli7oe3v-req@FreeBSD.org> References: <differential-rev-PHID-DREV-h7f3zkqdq4qxyli7oe3v-req@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--b1_0898dab31300b56c7a2404adbbcb53b3 Content-Type: text/plain; charset = "utf-8" Content-Transfer-Encoding: 8bit zbb updated this revision to Diff 5257. CHANGES SINCE LAST UPDATE https://reviews.freebsd.org/D2357?vs=5182&id=5257 REVISION DETAIL https://reviews.freebsd.org/D2357 AFFECTED FILES sys/arm64/arm64/busdma_bounce.c sys/arm64/arm64/busdma_machdep.c sys/arm64/include/bus_dma_impl.h sys/conf/files.arm64 EMAIL PREFERENCES https://reviews.freebsd.org/settings/panel/emailpreferences/ To: zbb, emaste, ian, imp, andrew Cc: onwahe-gmail-com, emaste, freebsd-arm --b1_0898dab31300b56c7a2404adbbcb53b3 Content-Type: text/x-patch; charset=utf-8; name="D2357.5257.patch" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="D2357.5257.patch" ZGlmZiAtLWdpdCBhL3N5cy9jb25mL2ZpbGVzLmFybTY0IGIvc3lzL2NvbmYvZmlsZXMuYXJtNjQK LS0tIGEvc3lzL2NvbmYvZmlsZXMuYXJtNjQKKysrIGIvc3lzL2NvbmYvZmlsZXMuYXJtNjQKQEAg LTUsNiArNSw3IEBACiBhcm02NC9hcm02NC9iY29weS5jCQlzdGFuZGFyZAogYXJtNjQvYXJtNjQv YnVzX21hY2hkZXAuYwlzdGFuZGFyZAogYXJtNjQvYXJtNjQvYnVzX3NwYWNlX2FzbS5TCXN0YW5k YXJkCithcm02NC9hcm02NC9idXNkbWFfYm91b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uY2VfbG9jayk7CisJfQorCW10eF91bmxvY2soJmJvdW5jZV9sb2NrKTsKK30KKworc3RydWN0 IGJ1c19kbWFfaW1wbCBidXNfZG1hX2JvdW5jZV9pbXBsID0geworCS50YWdfY3JlYXRlID0gYm91 bmNlX2J1c19kbWFfdGFnX2NyZWF0ZSwKKwkudGFnX2Rlc3Ryb3kgPSBib3VuY2VfYnVzX2RtYV90 YWdfZGVzdHJveSwKKwkubWFwX2NyZWF0ZSA9IGJvdW5jZV9idXNfZG1hbWFwX2NyZWF0ZSwKKwku bWFwX2Rlc3Ryb3kgPSBib3VuY2VfYnVzX2RtYW1hcF9kZXN0cm95LAorCS5tZW1fYWxsb2MgPSBi b3VuY2VfYnVzX2RtYW1lbV9hbGxvYywKKwkubWVtX2ZyZWUgPSBib3VuY2VfYnVzX2RtYW1lbV9m cmVlLAorCS5sb2FkX3BoeXMgPSBib3VuY2VfYnVzX2RtYW1hcF9sb2FkX3BoeXMsCisJLmxvYWRf YnVmZmVyID0gYm91bmNlX2J1c19kbWFtYXBfbG9hZF9idWZmZXIsCisJLmxvYWRfbWEgPSBidXNf ZG1hbWFwX2xvYWRfbWFfdHJpdiwKKwkubWFwX3dhaXRvayA9IGJvdW5jZV9idXNfZG1hbWFwX3dh aXRvaywKKwkubWFwX2NvbXBsZXRlID0gYm91bmNlX2J1c19kbWFtYXBfY29tcGxldGUsCisJLm1h cF91bmxvYWQgPSBib3VuY2VfYnVzX2RtYW1hcF91bmxvYWQsCisJLm1hcF9zeW5jID0gYm91bmNl X2J1c19kbWFtYXBfc3luYworfTsKCg== --b1_0898dab31300b56c7a2404adbbcb53b3--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?0898dab31300b56c7a2404adbbcb53b3>