Date: Sun, 27 Aug 2017 13:51:33 +0000 From: "iateaca (Teaca)" <phabric-noreply@FreeBSD.org> To: freebsd-virtualization@freebsd.org Subject: [Differential] D5473: ATA/ATAPI6 device emulation in bhyve Message-ID: <20774e3b9cd644f6a8fda9289c7404d7@localhost.localdomain> In-Reply-To: <differential-rev-PHID-DREV-2t5o3zrdohcj7mowtyki-req@FreeBSD.org> References: <differential-rev-PHID-DREV-2t5o3zrdohcj7mowtyki-req@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--b1_20774e3b9cd644f6a8fda9289c7404d7 Content-Type: text/plain; charset = "utf-8" Content-Transfer-Encoding: base64 aWF0ZWFjYSB1cGRhdGVkIHRoaXMgcmV2aXNpb24gdG8gRGlmZiAzMjQyMi4KaWF0ZWFjYSBhZGRl ZCBhIGNvbW1lbnQuCgoKICByZW1vdmUgc2VjdG9yc19wZXJfYmxvY2sgZmllbGQgZnJvbSB0aGUg YXRhIGNoYW5uZWwKICBhbGxvdyBzZWNjb3VudCB0byBiZSBzZXQgc21hbGxlciB0aGFuIEFUQV9T RUNUT1JTX1BFUl9CTE9DSwoKQ0hBTkdFUyBTSU5DRSBMQVNUIFVQREFURQogIGh0dHBzOi8vcmV2 aWV3cy5mcmVlYnNkLm9yZy9ENTQ3Mz92cz0zMjA4MSZpZD0zMjQyMgoKUkVWSVNJT04gREVUQUlM CiAgaHR0cHM6Ly9yZXZpZXdzLmZyZWVic2Qub3JnL0Q1NDczCgpBRkZFQ1RFRCBGSUxFUwogIE1h a2VmaWxlCiAgYXRhLmMKICBwY2lfbHBjLmMKCkVNQUlMIFBSRUZFUkVOQ0VTCiAgaHR0cHM6Ly9y ZXZpZXdzLmZyZWVic2Qub3JnL3NldHRpbmdzL3BhbmVsL2VtYWlscHJlZmVyZW5jZXMvCgpUbzog aWF0ZWFjYSwgZ3JlaGFuLCB0eWNob24sIG5lZWwsIG1hdgpDYzogZWRpdG9yX2NhbGxmb3J0ZXN0 aW5nLm9yZywgZnJlZWJzZC12aXJ0dWFsaXphdGlvbi1saXN0Cg== --b1_20774e3b9cd644f6a8fda9289c7404d7 Content-Type: text/x-patch; charset=utf-8; name="D5473.32422.patch" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="D5473.32422.patch" ZGlmZiAtLWdpdCBhL3BjaV9scGMuYyBiL3BjaV9scGMuYwotLS0gYS9wY2lfbHBjLmMKKysrIGIv cGNpX2xwYy5jCkBAIC03Myw2ICs3MywxMSBAQAogCiBzdGF0aWMgY29uc3QgY2hhciAqbHBjX3Vh cnRfbmFtZXNbTFBDX1VBUlRfTlVNXSA9IHsgIkNPTTEiLCAiQ09NMiIgfTsKIAorZXh0ZXJuIGlu dAorbHBjX2F0YV9pbml0KHN0cnVjdCB2bWN0eCAqY3R4LCBjb25zdCBjaGFyICpvcHRzKTsKK3N0 YXRpYyBjb25zdCBjaGFyICpscGNfYXRhMF9vcHRzID0gTlVMTDsKK3N0YXRpYyBjb25zdCBjaGFy ICpscGNfYXRhMV9vcHRzID0gTlVMTDsKKwogLyoKICAqIExQQyBkZXZpY2UgY29uZmlndXJhdGlv biBpcyBpbiB0aGUgZm9sbG93aW5nIGZvcm06CiAgKiA8bHBjX2RldmljZV9uYW1lPlssPG9wdGlv bnM+XQpAQCAtOTUsNiArMTAwLDE2IEBACiAJCQkJZ290byBkb25lOwogCQkJfQogCQl9CisKKwkJ aWYgKHN0cmNhc2VjbXAobHBjZGV2LCAiYXRhLWhkIikgPT0gMCkgeworCQkJaWYgKHN0clswXSA9 PSAnMCcpCisJCQkJbHBjX2F0YTBfb3B0cyA9IHN0cjsKKwkJCWVsc2UgaWYgKHN0clswXSA9PSAn MScpCisJCQkJbHBjX2F0YTFfb3B0cyA9IHN0cjsKKworCQkJZXJyb3IgPSAwOworCQkJZ290byBk b25lOworCQl9CiAJfQogCiBkb25lOgpAQCAtMTk3LDYgKzIxMiwxMSBAQAogCQlzYy0+ZW5hYmxl ZCA9IDE7CiAJfQogCisJaWYgKGxwY19hdG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Y2x1ZGUgImlu b3V0LmgiCisKKworLyoKKyAqIEFUQSBEZWJ1ZyBMb2cKKyAqLworI2RlZmluZQlERUJVR19BVEEJ CQkxCisjaWYgREVCVUdfQVRBID09IDEKKwordHlwZWRlZiBlbnVtIHsKKwlMT0dfREVCVUcgPSAw LAorCUxPR19FUlIgPSAxLAorfSBMT0dfTEVWRUw7CisKK3N0YXRpYyBGSUxFICpkYmc7CisKK3N0 YXRpYyB2b2lkIGF0YV9vcGVuX2RiZ19maWxlKHZvaWQpCit7CisJZGJnID0gZm9wZW4oIi90bXAv Ymh5dmVfYXRhLmxvZyIsICJ3KyIpOworCXJldHVybjsKK30KKworI2RlZmluZSBkcHJpbnQobGV2 ZWwsIGZvcm1hdCwgYXJnLi4uKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICBcCisJZG97ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgXAorCQlpZiAobGV2ZWwgPT0gTE9HX0RFQlVHKSB7ZnByaW50Zihk YmcsIGZvcm1hdCwgIyNhcmcpO30gICAgICAgXAorCQllbHNlIHtmcHJpbnRmKGRiZywgIkxPR19F UlI6ICJmb3JtYXQsICMjYXJnKTt9ICAgICAgICAgICAgICAgXAorCQlmZmx1c2goZGJnKTsgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorCX13aGlsZSgw KQorI2Vsc2UKKyNkZWZpbmUgYXRhX29wZW5fZGJnX2ZpbGUoKQk7CisjZGVmaW5lIGRwcmludChs ZXZlbCwgZm10LCAuLi4pIGRvIHt9IHdoaWxlICgwKQorI2VuZGlmCisKKworLyoKKyAqIEFUQSBk ZWZpbmVzCisgKi8KKworI2RlZmluZSBQQ0lfQVRBX0NIX1NFUAkJCSc7JworCisvKiBBVEEgQ2hh bm5lbHMgKi8KKyNkZWZpbmUgQVRBX0NIQU5ORUxTCQkJMHgwMgorI2RlZ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GlycV9kaXNhYmxlZDsKKworCWlycV9kaXNhYmxlZCA9IGNoYW5uZWwtPmRyaXZl c1tjaGFubmVsLT5kcml2ZV0uaXJxX2Rpc2FibGVkOworCisJaWYgKCFpcnFfZGlzYWJsZWQgJiYg IWNoYW5uZWwtPmxpbnRyKSB7CisJCWNoYW5uZWwtPmxpbnRyID0gMTsKKwkJY2hhbm5lbC0+aW50 cl9hc3NlcnQoY2hhbm5lbC0+cHJfc2MpOworCX0KKworCXJldHVybjsKK30KKworc3RhdGljIHZv aWQKK2F0YV9pcnFfbG93ZXIoc3RydWN0IGF0YV9jaGFubmVsICpjaGFubmVsKQoreworCWlmIChj aGFubmVsLT5saW50cikgeworCQljaGFubmVsLT5saW50ciA9IDA7CisJCWNoYW5uZWwtPmludHJf ZGVhc3NlcnQoY2hhbm5lbC0+cHJfc2MpOworCX0KKworCXJldHVybjsKK30KKworc3RhdGljIGF0 YV9kcml2ZV90eXBlCithdGFfZHJpdmVfdHlwZV9ieV9uYW1lKGNoYXIgKmRyaXZlX25hbWUpCit7 CisJaW50IGksIGxlbjsKKwljaGFyICpleHQgPSBOVUxMOworCisJaWYgKCFkcml2ZV9uYW1lKQor CQlyZXR1cm4gQVRBX0RSSVZFX0VNUFRZOworCisJbGVuID0gc3RybGVuKGRyaXZlX25hbWUpOwor CisJZm9yIChpID0gbGVuIC0gMTsgaSA+PSAwOyBpLS0pIHsKKwkJaWYgKGRyaXZlX25hbWVbaV0g PT0gJy4nKSB7CisJCQlleHQgPSBkcml2ZV9uYW1lICsgaSArIDE7CisJCQlpZiAoc3RyY21wKGV4 dCwgImlzbyIpID09IDApCisJCQkJcmV0dXJuIEFUQVBJX0NEOworCQkJYnJlYWs7CisJCX0KKwl9 CisKKwlyZXR1cm4gQVRBX0hEOworfQorCitzdGF0aWMgaW50CithdGFfcGFyc2VfcGFyYW1zKGNv bnN0IGNoYXIgKm9wdHMsIGludCAqY2hhbm5lbCwgY2hhciAqZGlza19tYXN0ZXIsCisJCSBj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CisJLyogTW9kZWw6IEJIWVZFIEFUQVBJIElE RSBDRFJPTSAqLworCW1lbWNweShpZGVudF9kYXRhLT5tb2RlbCwgICAgIkhCVlkgRVRBUEEgSURJ IEVEQ09SIE0gICAgICAgICAgICAgICAgICAiLCA0MCk7CisJLyogU2VyaWFsIG51bWJlcjogMTIz NDU2ICovCisJbWVtY3B5KGlkZW50X2RhdGEtPnNlcmlhbCwgICAiMjE0MzY1ICAgICAgICAgICAg ICAiLCAyMCk7CisJLyogRmlybXdhcmUgdmVyc2lvbjogMS4wICovCisJbWVtY3B5KGlkZW50X2Rh dGEtPnJldmlzaW9uLCAiLjEgMCAgICAiLCA4KTsKKworCWRwcmludChMT0dfREVCVUcsICJhdGFf YXRhcGlfaW5pdGlhbGl6ZV9pZGVudDogY2hhbm5lbDogJWQsIGRyaXZlOiAlZFxuIiwKKwkgICAg ICAgY2hhbm5lbC0+aW50ZXJmYWNlLCBjaGFubmVsLT5kcml2ZSk7CisKKwlhdGFfcGlvX2RvX3Ry YW5zZmVyKHBpb19zZXR1cCwgc2l6ZW9mKHN0cnVjdCBhdGFfcGFyYW1zKSwgYXRhX3Bpb19nZW5l cmljX2VuZF90cmFuc2ZlciwgY2hhbm5lbC0+dXNlXzE2Yml0KTsKKworCXJldHVybjsKK30KKwor c3RhdGljIGludAorYXRhX2NoYW5uZWxfaXNfb2soc3RydWN0IGF0YV9jaGFubmVsICpjaGFubmVs LCB1aW50OF90IGNoKQoreworCWlmIChjaGFubmVsLT5pbnRlcmZhY2UgPT0gY2gpCisJCXJldHVy biAxOworCisJcmV0dXJuIDA7Cit9CisKK3N0YXRpYyBpbnQKK2F0YV9zZWxlY3RfZHJpdmVfaXNf b2soc3RydWN0IGF0YV9jaGFubmVsICpjaGFubmVsKQoreworCWlmIChjaGFubmVsLT5kcml2ZSA9 PSBBVEFfU0xBVkUgJiYgIWNoYW5uZWwtPmhhc19zbGF2ZSkgeworCQlyZXR1cm4gMDsKKwl9CisK KwlyZXR1cm4gM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mZlci0+Y3VycmVudF9wb3Mp OworCQlwaW9fYnVmZmVyLT5jdXJyZW50X3BvcyArPSBzaXplb2YodWludDE2X3QpOworCX0KKwll bHNlIHsKKwkJdmFsdWUgPSAqKHVpbnQzMl90ICopKHBpb19idWZmZXItPmRhdGEgKyBwaW9fYnVm ZmVyLT5jdXJyZW50X3Bvcyk7CisJCXBpb19idWZmZXItPmN1cnJlbnRfcG9zICs9IHNpemVvZih1 aW50MzJfdCk7CisJfQorCisJYXRhX3Bpb19jaGVja19lbmRfdHJhbnNmZXIocGlvX3NldHVwKTsK KworCXJldHVybiB2YWx1ZTsKK30KKworc3RhdGljIHZvaWQKK2F0YV9waW9fcHV0X3VpbnQoc3Ry dWN0IGF0YV9waW9fc2V0dXAgKnBpb19zZXR1cCwgdWludDMyX3Qgd3JpdGVfdmFsdWUpCit7CisJ c3RydWN0IGF0YV9waW9fYnVmZmVyICpwaW9fYnVmZmVyID0gJnBpb19zZXR1cC0+cGlvX2J1ZmZl cjsKKworCWFzc2VydChwaW9fYnVmZmVyLT5jdXJyZW50X3BvcyA8IHBpb19zZXR1cC0+c2l6ZV90 cmFuc2Zlcik7CisKKwlpZiAocGlvX3NldHVwLT51c2Vfd29yZCkgeworCQkqKHVpbnQxNl90ICop KHBpb19idWZmZXItPmRhdGEgKyBwaW9fYnVmZmVyLT5jdXJyZW50X3BvcykgPSAodWludDE2X3Qp d3JpdGVfdmFsdWU7CisJCXBpb19idWZmZXItPmN1cnJlbnRfcG9zICs9IHNpemVvZih1aW50MTZf dCk7CisJfQorCWVsc2UgeworCQkqKHVpbnQzMl90ICopKHBpb19idWZmZXItPmRhdGEgKyBwaW9f YnVmZmVyLT5jdXJyZW50X3BvcykgPSB3cml0ZV92YWx1ZTsKKwkJcGlvX2J1ZmZlci0+Y3VycmVu dF9wb3MgKz0gc2l6ZW9mKHVpbnQzMl90KTsKKwl9CisKKwlhdGFfcGlvX2NoZWNrX2VuZF90cmFu c2ZlcihwaW9fc2V0dXApOworCis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ICsgNDsK KworCWlmICh0cmFja19udW1iZXIgPD0gMSkgeworCQlkYXRhX3pvbmUgPSBwYWNrZXQgKyA0Owor CQlsZWFkX291dCA9IHBhY2tldCArIDEyOworCisJCWRhdGFfem9uZVswXSA9IDA7CQkvKiBSZXNl cnZlZCAqLworCQlkYXRhX3pvbmVbMV0gPSAweDE0OwkJLyogQURSLCBjb250cm9sICovCisJCWRh dGFfem9uZVsyXSA9IDE7CQkvKiB0cmFjayBudW1iZXIgKi8KKwkJZGF0YV96b25lWzNdID0gMDsJ CS8qIFJlc2VydmVkICovCisJCWlmIChtc2YpIHsKKwkJCWRhdGFfem9uZVs0XSA9IDA7CisJCQls YmFfdG9fbXNmKGRhdGFfem9uZSArIDUsIDApOworCQl9CisJCWVsc2UgeworCQkJYXRhX2NwdV90 b19iZTMyKGRhdGFfem9uZSArIDQsIDApOworCQl9CisJfQorCisJbGVhZF9vdXRbMF0gPSAwOwkJ LyogUmVzZXJ2ZWQgKi8KKwlsZWFkX291dFsxXSA9IDB4MTY7CQkvKiBBRFIsIGNvbnRyb2wgKi8K KwlsZWFkX291dFsyXSA9IDB4YWE7CQkvKiB0cmFjayBudW1iZXIgKi8KKwlsZWFkX291dFszXSA9 IDA7CQkvKiBSZXNlcnZlZCAqLworCWlmIChtc2YpIHsKKwkJbGVhZF9vdXRbNF0gPSAwOworCQls YmFfdG9fbXNmKGxlYWRfb3V0ICsgNSwgbnNlY3RvcnMpOworCX0KKwllbHNlIHsKKwkJYXRhX2Nw dV90b19iZTMyKGxlYWRfb3V0ICsgNCwgbnNlY3RvcnMpOworCX0KKworCWRhdGFfbGVuID0gKGxl YWRfb3V0IC0gcGFja2V0KSArIDg7CisJYXRhX2NwdV90b19iZTE2KHBhY2tldCwgZGF0YV9sZW4g LSAyKTsKKworCWRhdGFfbGVuID0gKGRhdGFfbGVuIDwgYWxsb2NhdGlvbl9sZW5ndGgpID8gZGF0 YV9sZW4gOiBhbGxvY2F0aW9uX2xlbmd0aDsKKworCW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ZGVhc3NlcnQocGkpOworCisJcmV0dXJuOworfQorCitz dGF0aWMgaW50CitwY2lfYXRhX3BhcnNlX3BhcmFtcyhjb25zdCBjaGFyICpvcHRzLCBjaGFyICpv cHQwLCBjaGFyICpvcHQxLCB1aW50OF90ICpucl9jaGFubmVscykKK3sKKwl1aW50OF90IGxlbjsK KwljaGFyIHRtcF9vcHRzWzEyOF07CisJY2hhciAqY2gwID0gTlVMTCwgKmNoMSA9IE5VTEw7CisJ dWludDhfdCBpOworCisJaWYgKCFvcHRzKSB7CisJCWRwcmludChMT0dfRVJSLCAicGNpX2F0YV9w YXJzZV9wYXJhbXM6IG9wdHMgc2hvdWxkIGJlIGxpa2U6ICVzXG4iLAorCQkgICAgICAgIlgsTUFT VEVSX1hbLFNMQVZFX1hdWztZLE1BU1RFUl9ZWyxTTEFWRV9ZXV0iKTsKKwkJcmV0dXJuIC0xOwor CX0KKworCWxlbiA9IHN0cmxlbihvcHRzKTsKKwlpZiAobGVuID49IDEyOCkgeworCQlkcHJpbnQo TE9HX0VSUiwgInBjaV9hdGFfcGFyc2VfcGFyYW1zOiBQQ0kgQVRBIHN0cmluZyBwYXJhbXMgdG9v IGJpZ1xuIik7CisJCXJldHVybiAtMTsKKwl9CisKKwlzdHJjcHkodG1wX29wdHMsIG9wdHMpOwor CisJY2gwID0gdG1wX29wdHM7CisKKwlmb3IgKGkgPSAwOyBpIDwgbGVuOyBpKyspIHsKKwkJaWYg KHRtcF9vcHRzW2ldID09IFBDSV9BVEFfQ0hfU0VQKSB7CisJCQlpZiAoY2gxKSB7CisJCQkJZHBy aW50KExPR19FUlIsICJwY2lfYXRhX3BhcnNlX3BhcmFtczogdG8gbWFueSBjaGFubmVsc1xuIik7 CisJCQkJcmV0dXJuIC0xOworCQkJfQorCQkJdG1wX29wdHNbaV0gPSAnXDAnOworCQkJY2gxID0g dG1wX29wdHMgKyBpICsgMTsKKwkJfQorCX0KKworCWlmIChzdHJsZW4oY2gwKSA+PSA2NCkgewor CQlk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sLCBvZmZzZXQpOworCWVsc2UKKwkJYXRhX2NvbW1hbmRfYmxvY2tfd3JpdGUoY2hhbm5lbCwg b2Zmc2V0LCBieXRlcywgKmVheCk7CisKKwlyZXR1cm4gMDsKK30KKworc3RhdGljIGludAorbHBj X2F0YV9pb2N0bF9oYW5kbGVyKHN0cnVjdCB2bWN0eCAqY3R4LCBpbnQgdmNwdSwKKwkJICAgaW50 IGluLCBpbnQgcG9ydCwgaW50IGJ5dGVzLCB1aW50MzJfdCAqZWF4LCB2b2lkICphcmcpCit7CisJ c3RydWN0IGxwY19hdGFfc29mdGMgKmxwY19zYyA9IChzdHJ1Y3QgbHBjX2F0YV9zb2Z0YyAqKWFy ZzsKKwlzdHJ1Y3QgYXRhX2NoYW5uZWwgKmNoYW5uZWwgPSBOVUxMOworCXVpbnQ4X3Qgb2Zmc2V0 ID0gMDsKKworCWFzc2VydChscGNfc2MpOworCWNoYW5uZWwgPSBscGNfc2MtPmNoYW5uZWw7CisJ YXNzZXJ0KGNoYW5uZWwpOworCisJb2Zmc2V0ID0gcG9ydCAtIGxwY19zYy0+YmFzZV9hZGRyX2lv Y3RsOworCWFzc2VydChvZmZzZXQgPCBBVEFfQ1RMSU9TSVpFKTsKKworCWlmIChpbikKKwkJKmVh eCA9IGF0YV9hbHRzdGF0dXNfcmVhZChjaGFubmVsKTsKKwllbHNlCisJCWF0YV9jb250cm9sX3dy aXRlKGNoYW5uZWwsIGJ5dGVzLCAqZWF4KTsKKworCXJldHVybiAwOworfQorCgo= --b1_20774e3b9cd644f6a8fda9289c7404d7--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20774e3b9cd644f6a8fda9289c7404d7>