Date: Mon, 4 May 2015 17:19:34 +0000 From: "zbb (Zbigniew Bodek)" <phabric-noreply@FreeBSD.org> To: freebsd-arm@freebsd.org Subject: [Differential] [Updated, 1, 488 lines] D2357: Port x86 busdma to ARM64 Message-ID: <1538bc4ebbf7d3d51276fdc30340efcf@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_1538bc4ebbf7d3d51276fdc30340efcf Content-Type: text/plain; charset = "utf-8" Content-Transfer-Encoding: 8bit zbb updated this revision to Diff 5182. CHANGES SINCE LAST UPDATE https://reviews.freebsd.org/D2357?vs=4971&id=5182 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_1538bc4ebbf7d3d51276fdc30340efcf Content-Type: text/x-patch; charset=utf-8; name="D2357.5182.patch" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="D2357.5182.patch" ZGlmZiAtLWdpdCBhL3N5cy9jb25mL2ZpbGVzLmFybTY0IGIvc3lzL2NvbmYvZmlsZXMuYXJtNjQK LS0tIGEvc3lzL2NvbmYvZmlsZXMuYXJtNjQKKysrIGIvc3lzL2NvbmYvZmlsZXMuYXJtNjQKQEAg LTUsNiArNSw3IEBACiBhcm02NC9hcm02NC9iY29weS5jCQlzdGFuZGFyZAogYXJtNjQvYXJtNjQv YnVzX21hY2hkZXAuYwlzdGFuZGFyZAogYXJtNjQvYXJtNjQvYnVzX3NwYWNlX2FzbS5TCXN0YW5k YXJkCithcm02NC9hcm02NC9idXNkbWFf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ywKKwkgICAgInRvdGFsX2JvdW5jZWQi LCBDVExGTEFHX1JELCAmYnotPnRvdGFsX2JvdW5jZWQsIDAsCisJICAgICJUb3RhbCBib3VuY2Ug cmVxdWVzdHMiKTsKKwlTWVNDVExfQUREX0lOVChidXNkbWFfc3lzY3RsX3RyZWUoYnopLAorCSAg ICBTWVNDVExfQ0hJTERSRU4oYnVzZG1hX3N5c2N0bF90cmVlX3RvcChieikpLCBPSURfQVVUTywK KwkgICAgInRvdGFsX2RlZmVycmVkIiwgQ1RMRkxBR19SRCwgJmJ6LT50b3RhbF9kZWZlcnJlZCwg MCwKKwkgICAgIlRvdGFsIGJvdW5jZSByZXF1ZXN0cyB0aGF0IHdlcmUgZGVmZXJyZWQiKTsKKwlT WVNDVExfQUREX1NUUklORyhidXNkbWFfc3lzY3RsX3RyZWUoYnopLAorCSAgICBTWVNDVExfQ0hJ TERSRU4oYnVzZG1hX3N5c2N0bF90cmVlX3RvcChieikpLCBPSURfQVVUTywKKwkgICAgImxvd2Fk ZHIiLCBDVExGTEFHX1JELCBiei0+bG93YWRkcmlkLCAwLCAiIik7CisJU1lTQ1RMX0FERF9VQVVU TyhidXNkbWFfc3lzY3RsX3RyZWUoYnopLAorCSAgICBTWVNDVExfQ0hJTERSRU4oYnVzZG1hX3N5 c2N0bF90cmVlX3RvcChieikpLCBPSURfQVVUTywKKwkgICAgImFsaWdubWVudCIsIENUTEZMQUdf UkQsICZiei0+YWxpZ25tZW50LCAiIik7CisKKwlyZXR1cm4gKDApOworfQorCitzdGF0aWMgaW50 CithbGxvY19ib3VuY2VfcGFnZXMoYnVzX2RtYV90YWdfdCBkbWF0LCB1X2ludCBudW1wYWdlcykK K3sKKwlzdHJ1Y3QgYm91bmNlX3pvbmUgKmJ6OworCWludCBjb3VudDsKKworCWJ6ID0gZG1hdC0+ Ym91bmNlX3pvbmU7CisJY291bnQgPSAwOworCXdoaWxlIChudW1wYWdlcyA+IDApIHsKKwkJc3Ry dWN0IGJvdW5jZV9wY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vY2soJmJvdW5jZV9sb2NrKTsK K30KKworc3RydWN0IGJ1c19kbWFfaW1wbCBidXNfZG1hX2JvdW5jZV9pbXBsID0geworCS50YWdf Y3JlYXRlID0gYm91bmNlX2J1c19kbWFfdGFnX2NyZWF0ZSwKKwkudGFnX2Rlc3Ryb3kgPSBib3Vu Y2VfYnVzX2RtYV90YWdfZGVzdHJveSwKKwkubWFwX2NyZWF0ZSA9IGJvdW5jZV9idXNfZG1hbWFw X2NyZWF0ZSwKKwkubWFwX2Rlc3Ryb3kgPSBib3VuY2VfYnVzX2RtYW1hcF9kZXN0cm95LAorCS5t ZW1fYWxsb2MgPSBib3VuY2VfYnVzX2RtYW1lbV9hbGxvYywKKwkubWVtX2ZyZWUgPSBib3VuY2Vf YnVzX2RtYW1lbV9mcmVlLAorCS5sb2FkX3BoeXMgPSBib3VuY2VfYnVzX2RtYW1hcF9sb2FkX3Bo eXMsCisJLmxvYWRfYnVmZmVyID0gYm91bmNlX2J1c19kbWFtYXBfbG9hZF9idWZmZXIsCisJLmxv YWRfbWEgPSBidXNfZG1hbWFwX2xvYWRfbWFfdHJpdiwKKwkubWFwX3dhaXRvayA9IGJvdW5jZV9i dXNfZG1hbWFwX3dhaXRvaywKKwkubWFwX2NvbXBsZXRlID0gYm91bmNlX2J1c19kbWFtYXBfY29t cGxldGUsCisJLm1hcF91bmxvYWQgPSBib3VuY2VfYnVzX2RtYW1hcF91bmxvYWQsCisJLm1hcF9z eW5jID0gYm91bmNlX2J1c19kbWFtYXBfc3luYworfTsKCg== --b1_1538bc4ebbf7d3d51276fdc30340efcf--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1538bc4ebbf7d3d51276fdc30340efcf>