From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by casper.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kb1xa-0003aJ-2S for barebox@lists.infradead.org; Fri, 06 Nov 2020 13:39:28 +0000 From: Sascha Hauer Date: Fri, 6 Nov 2020 14:38:54 +0100 Message-Id: <20201106133900.2656-21-s.hauer@pengutronix.de> In-Reply-To: <20201106133900.2656-1-s.hauer@pengutronix.de> References: <20201106133900.2656-1-s.hauer@pengutronix.de> MIME-Version: 1.0 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH 20/26] mtd: nand: Update to Linux-5.9 To: Barebox List VGhpcyB1cGRhdGVzIHRoZSBiYXJlYm94IE5BTkQgbGF5ZXIgYW5kIHBhcnRzIG9mIHRoZSBtdGQg bGF5ZXIgdG8KTGludXgtNS45LgoKVGhpcyBwYXRjaCBpcyBodWdlLCBidXQgdGhlIGJhcmVib3gg TkFORCBsYXllciBpcyBzbyBmYXIgYXdheSBmcm9tIHRoZQpMaW51eCBOQU5EIGxheWVyIHRoYXQg YSBzdGVwIGJ5IHN0ZXAgdXBkYXRlIHdvdWxkIGhhdmUgdGFrZW4gYWdlcy4KClVubGlrZSBMaW51 eCBiYXJlYm94IGhhcyBmdW5jdGlvbnMgdG8gbWFyayBhIGJsb2NrIGFzIGdvb2QuIFRoaXMgZmVh dHVyZQpoYXMgYmVlbiBwcmVzZXJ2ZWQuIEFsc28gYmFyZWJveCB1c2VkIHRvIG1ha2UgTkFORCB3 cml0ZSBzdXBwb3J0Cm9wdGlvbmFsLCB0aGlzIGZlYXR1cmUgaXMgbG9zdCBkdXJpbmcgdGhlIHVw ZGF0ZSBmb3IgdGhlIHNha2Ugb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0vYm9hcmRzL3NhbWE1ZDNfeHBsYWluZWQvaW5pdC5jIHwgICAgMSArCiBhcmNoL2FybS9j b25maWdzL25oazg4MTVfZGVmY29uZmlnICAgICAgfCAgICAyICstCiBhcmNoL2FybS9tYWNoLWlt eC9leHRlcm5hbC1uYW5kLWJvb3QuYyAgfCAgICAxICsKIGFyY2gvYXJtL21hY2gtaW14L3hsb2Fk LWlteC1uYW5kLmMgICAgICB8ICAgIDEgKwogY29tbWFuZHMvbmFuZC1iaXRmbGlwLmMgICAgICAg ICAgICAgICAgIHwgICAyMSArLQogZHJpdmVycy9idXMvb21hcC1ncG1jLmMgICAgICAgICAgICAg ICAgIHwgICAgMSArCiBkcml2ZXJzL210ZC9LY29uZmlnICAgICAgICAgICAgICAgICAgICAgfCAg ICAyIC0KIGRyaXZlcnMvbXRkL2NvcmUuYyAgICAgICAgICAgICAgICAgICAgICB8ICA1NTcgKy0K IGRyaXZlcnMvbXRkL210ZHJhdy5jICAgICAgICAgICAgICAgICAgICB8ICAgIDEgLQogZHJpdmVy cy9tdGQvbmFuZC9LY29uZmlnICAgICAgICAgICAgICAgIHwgICA1MyArLQogZHJpdmVycy9tdGQv bmFuZC9NYWtlZmlsZSAgICAgICAgICAgICAgIHwgICAxMSArLQogZHJpdmVycy9tdGQvbmFuZC9h dG1lbF9uYW5kLmMgICAgICAgICAgIHwgICA5NSArLQogZHJpdmVycy9tdGQvbmFuZC9iYnQuYyAg ICAgICAgICAgICAgICAgIHwgIDEzMiArCiBkcml2ZXJzL210ZC9uYW5kL2NvcmUuYyAgICAgICAg ICAgICAgICAgfCAgMjc1ICsKIGRyaXZlcnMvbXRkL25hbmQvZGVuYWxpLmggICAgICAgICAgICAg ICB8ICAgIDEgKwogZHJpdmVycy9tdGQvbmFuZC9pbnRlcm5hbHMuaCAgICAgICAgICAgIHwgIDE3 MCArCiBkcml2ZXJzL210ZC9uYW5kL25hbmRfYW1kLmMgICAgICAgICAgICAgfCAgIDUzICsKIGRy aXZlcnMvbXRkL25hbmQvbmFuZF9iYXNlLmMgICAgICAgICAgICB8IDc3NTUgKysrKysrKysrKysr KystLS0tLS0tLS0KIGRyaXZlcnMvbXRkL25hbmQvbmFuZF9iYnQuYyAgICAgICAgICAgICB8ICAz MTcgKy0KIGRyaXZlcnMvbXRkL25hbmQvbmFuZF9iY2guYyAgICAgICAgICAgICB8ICAgODggKy0K IGRyaXZlcnMvbXRkL25hbmQvbmFuZF9kZW5hbGkuYyAgICAgICAgICB8ICAgNjcgKy0KIGRyaXZl cnMvbXRkL25hbmQvbmFuZF9lY2MuYyAgICAgICAgICAgICB8ICA1NzMgKy0KIGRyaXZlcnMvbXRk L25hbmQvbmFuZF9lc210LmMgICAgICAgICAgICB8ICAgNTQgKwogZHJpdmVycy9tdGQvbmFuZC9u YW5kX2h5bml4LmMgICAgICAgICAgIHwgIDcxNiArKysKIGRyaXZlcnMvbXRkL25hbmQvbmFuZF9p ZHMuYyAgICAgICAgICAgICB8ICAyNTggKy0KIGRyaXZlcnMvbXRkL25hbmQvbmFuZF9pbXguYyAg ICAgICAgICAgICB8ICAgNDYgKy0KIGRyaXZlcnMvbXRkL25hbmQvbmFuZF9qZWRlYy5jICAgICAg ICAgICB8ICAxMzUgKwogZHJpdmVycy9tdGQvbmFuZC9uYW5kX2xlZ2FjeS5jICAgICAgICAgIHwg IDYyOSArKwogZHJpdmVycy9tdGQvbmFuZC9uYW5kX21hY3Jvbml4LmMgICAgICAgIHwgIDMzNCAr CiBkcml2ZXJzL210ZC9uYW5kL25hbmRfbWljcm9uLmMgICAgICAgICAgfCAgNTk1ICsrCiBkcml2 ZXJzL210ZC9uYW5kL25hbmRfbXJ2bF9uZmMuYyAgICAgICAgfCAgIDMzICstCiBkcml2ZXJzL210 ZC9uYW5kL25hbmRfbXhzLmMgICAgICAgICAgICAgfCAgIDM3ICstCiBkcml2ZXJzL210ZC9uYW5k L25hbmRfb21hcF9ncG1jLmMgICAgICAgfCAgIDYwICstCiBkcml2ZXJzL210ZC9uYW5kL25hbmRf b25maS5jICAgICAgICAgICAgfCAgMzI2ICsKIGRyaXZlcnMvbXRkL25hbmQvbmFuZF9vcmlvbi5j ICAgICAgICAgICB8ICAgIDMgKy0KIGRyaXZlcnMvbXRkL25hbmQvbmFuZF9zM2MyNHh4LmMgICAg ICAgICB8ICAgIDcgKy0KIGRyaXZlcnMvbXRkL25hbmQvbmFuZF9zYW1zdW5nLmMgICAgICAgICB8 ICAxMzUgKwogZHJpdmVycy9tdGQvbmFuZC9uYW5kX3RpbWluZ3MuYyAgICAgICAgIHwgIDU3NCAr LQogZHJpdmVycy9tdGQvbmFuZC9uYW5kX3Rvc2hpYmEuYyAgICAgICAgIHwgIDI3NCArCiBkcml2 ZXJzL210ZC9uYW5kL25vbWFkaWtfbmFuZC5jICAgICAgICAgfCAgICA3ICstCiBkcml2ZXJzL210 ZC9wYXJ0aXRpb24uYyAgICAgICAgICAgICAgICAgfCAgICAxICsKIGRyaXZlcnMvbXRkL3BlYi5j ICAgICAgICAgICAgICAgICAgICAgICB8ICAgIDEgLQogZHJpdmVycy9vZi9vZl9tdGQuYyAgICAg ICAgICAgICAgICAgICAgIHwgICAgMyArCiBpbmNsdWRlL2xpbnV4L210ZC9qZWRlYy5oICAgICAg ICAgICAgICAgfCAgIDkxICsKIGluY2x1ZGUvbGludXgvbXRkL210ZC1hYmkuaCAgICAgICAgICAg ICB8ICAgIDEgKwogaW5jbHVkZS9saW51eC9tdGQvbXRkLmggICAgICAgICAgICAgICAgIHwgICA5 OCArLQogaW5jbHVkZS9saW51eC9tdGQvbmFuZC5oICAgICAgICAgICAgICAgIHwgMTM1NCArKy0t CiBpbmNsdWRlL2xpbnV4L210ZC9uYW5kX2JjaC5oICAgICAgICAgICAgfCAgIDIyICstCiBpbmNs dWRlL2xpbnV4L210ZC9uYW5kX2VjYy5oICAgICAgICAgICAgfCAgIDM1ICstCiBpbmNsdWRlL2xp bnV4L210ZC9vbmZpLmggICAgICAgICAgICAgICAgfCAgMTc4ICsK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sdCA8PCAyOyBpKyspIHsKKwkJY3VyID0g KmJwKys7CisJCXRtcHBhciA9IGN1cjsKKwkJcnA0IF49IGN1cjsKKwkJY3VyID0gKmJwKys7CisJ CXRtcHBhciBePSBjdXI7CisJCXJwNiBePSB0bXBwYXI7CisJCWN1ciA9ICpicCsrOworCQl0bXBw YXIgXj0gY3VyOworCQlycDQgXj0gY3VyOworCQljdXIgPSAqYnArKzsKKwkJdG1wcGFyIF49IGN1 cjsKKwkJcnA4IF49IHRtcHBhcjsKIAotCQkvKiBBbGwgYml0IFhPUiA9IDEgPyAqLwotCQlpZiAo aWR4ICYgMHg0MCkgewotCQkJcmVnMyBePSAodWludDhfdCkgaTsKLQkJCXJlZzIgXj0gfigodWlu dDhfdCkgaSk7Ci0JCX0KKwkJY3VyID0gKmJwKys7CisJCXRtcHBhciBePSBjdXI7CisJCXJwNCBe PSBjdXI7CisJCXJwNiBePSBjdXI7CisJCWN1ciA9ICpicCsrOworCQl0bXBwYXIgXj0gY3VyOwor CQlycDYgXj0gY3VyOworCQljdXIgPSAqYnArKzsKKwkJdG1wcGFyIF49IGN1cjsKKwkJcnA0IF49 IGN1cjsKKwkJY3VyID0gKmJwKys7CisJCXRtcHBhciBePSBjdXI7CisJCXJwMTAgXj0gdG1wcGFy OworCisJCWN1ciA9ICpicCsrOworCQl0bXBwYXIgXj0gY3VyOworCQlycDQgXj0gY3VyOworCQly cDYgXj0gY3VyOworCQlycDggXj0gY3VyOworCQljdXIgPSAqYnArKzsKKwkJdG1wcGFyIF49IGN1 cjsKKwkJcnA2IF49IGN1cjsKKwkJcnA4IF49IGN1cjsKKwkJY3VyID0gKmJwKys7CisJCXRtcHBh ciBePSBjdXI7CisJCXJwNCBePSBjdXI7CisJCXJwOCBePSBjdXI7CisJCWN1ciA9ICpicCsrOwor CQl0bXBwYXIgXj0gY3VyOworCQlycDggXj0gY3VyOworCisJCWN1ciA9ICpicCsrOworCQl0bXBw YXIgXj0gY3VyOworCQlycDQgXj0gY3Vy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aSA9IDA7IGkgPCBpbmZv LT5ucmVnczsgaSsrKSB7CisJCXJldCA9IGh5bml4X25hbmRfcmVnX3dyaXRlX29wKGNoaXAsIGlu Zm8tPnJlZ3NbaV0sCisJCQkJCSAgICAgIGluZm8tPnZhbHVlc1tpXSk7CisJCWlmIChyZXQpCisJ CQlyZXR1cm4gcmV0OworCX0KKworCXJldCA9IGh5bml4X25hbmRfY21kX29wKGNoaXAsIE5BTkRf SFlOSVhfQ01EX0FQUExZX1BBUkFNUyk7CisJaWYgKHJldCkKKwkJcmV0dXJuIHJldDsKKworCS8q IFNlcXVlbmNlIHRvIGVudGVyIE9UUCBtb2RlPyAqLworCXJldCA9IGh5bml4X25hbmRfY21kX29w KGNoaXAsIDB4MTcpOworCWlmIChyZXQpCisJCXJldHVybiByZXQ7CisKKwlyZXQgPSBoeW5peF9u YW5kX2NtZF9vcChjaGlwLCAweDQpOworCWlmIChyZXQpCisJCXJldHVybiByZXQ7CisKKwlyZXQg PSBoeW5peF9uYW5kX2NtZF9vcChjaGlwLCAweDE5KTsKKwlpZiAocmV0KQorCQlyZXR1cm4gcmV0 OworCisJLyogTm93IHJlYWQgdGhlIHBhZ2UgKi8KKwlyZXQgPSBuYW5kX3JlYWRfcGFnZV9vcChj aGlwLCBpbmZvLT5wYWdlLCAwLCBidWYsIGluZm8tPnNpemUpOworCWlmIChyZXQpCisJCXJldHVy biByZXQ7CisKKwkvKiBQdXQgZXZlcnl0aGluZyBiYWNrIHRvIG5vcm1hbCAqLworCXJldCA9IG5h bmRfcmVzZXRfb3AoY2hpcCk7CisJaWYgKHJldCkKKwkJcmV0dXJuIHJldDsKKworCXJldCA9IGh5 bml4X25hbmRfY21kX29wKGNoaXAsIE5BTkRfSFlOSVhfQ01EX1NFVF9QQVJBTVMpOworCWlmIChy ZXQpCisJCXJldHVybiByZXQ7CisKKwlyZXQgPSBoeW5peF9uYW5kX3JlZ193cml0ZV9vcChjaGlw LCAweDM4LCAwKTsKKwlpZiAocmV0KQorC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dG1h cF9zZXQoY2hpcC0+cGFyYW1ldGVycy5zZXRfZmVhdHVyZV9saXN0LAorCQkJICAgT05GSV9GRUFU VVJFX0FERFJfVElNSU5HX01PREUsIDEpOworCX0KKworCW9uZmkgPSBremFsbG9jKHNpemVvZigq b25maSksIEdGUF9LRVJORUwpOworCWlmICghb25maSkgeworCQlyZXQgPSAtRU5PTUVNOworCQln b3RvIGZyZWVfbW9kZWw7CisJfQorCisJb25maS0+dmVyc2lvbiA9IG9uZmlfdmVyc2lvbjsKKwlv bmZpLT50UFJPRyA9IGxlMTZfdG9fY3B1KHAtPnRfcHJvZyk7CisJb25maS0+dEJFUlMgPSBsZTE2 X3RvX2NwdShwLT50X2JlcnMpOworCW9uZmktPnRSID0gbGUxNl90b19jcHUocC0+dF9yKTsKKwlv bmZpLT50Q0NTID0gbGUxNl90b19jcHUocC0+dF9jY3MpOworCW9uZmktPmFzeW5jX3RpbWluZ19t b2RlID0gbGUxNl90b19jcHUocC0+YXN5bmNfdGltaW5nX21vZGUpOworCW9uZmktPnZlbmRvcl9y ZXZpc2lvbiA9IGxlMTZfdG9fY3B1KHAtPnZlbmRvcl9yZXZpc2lvbik7CisJbWVtY3B5KG9uZmkt PnZlbmRvciwgcC0+dmVuZG9yLCBzaXplb2YocC0+dmVuZG9yKSk7CisJY2hpcC0+cGFyYW1ldGVy cy5vbmZpID0gb25maTsKKworCS8qIElkZW50aWZpY2F0aW9uIGRvbmUsIGZyZWUgdGhlIGZ1bGwg T05GSSBwYXJhbWV0ZXIgcGFnZSBhbmQgZXhpdCAqLworCWtmcmVlKHBidWYpOworCisJcmV0dXJu IDE7CisKK2ZyZWVfbW9kZWw6CisJa2ZyZWUoY2hpcC0+cGFyYW1ldGVycy5tb2RlbCk7CitmcmVl X29uZmlfcGFyYW1fcGFnZToKKwlrZnJlZShwYnVmKTsKKworCXJldHVybiByZXQ7Cit9CmRpZmYg LS1naXQgYS9kcml2ZXJzL210ZC9uYW5kL25hbmRfb3Jpb24uYyB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gMjUwMDAsCisJCQkudENFQV9tYXggPSAxMDAwMDAs CisJCQkudENFSF9taW4gPSAyMDAwMCwKKwkJCS50Q0hfbWluID0gMjAwMDAsCisJCQkudENIWl9t YXggPSAxMDAwMDAsCisJCQkudENMSF9taW4gPSAyMDAwMCwKKwkJCS50Q0xSX21pbiA9IDIwMDAw LAorCQkJLnRDTFNfbWluID0gNTAwMDAsCisJCQkudENPSF9taW4gPSAwLAorCQkJLnRDU19taW4g PSA3MDAwMCwKKwkJCS50REhfbWluID0gMjAwMDAsCisJCQkudERTX21pbiA9IDQwMDAwLAorCQkJ LnRGRUFUX21heCA9IDEwMDAwMDAsCisJCQkudElSX21pbiA9IDEwMDAwLAorCQkJLnRJVENfbWF4 ID0gMTAwMDAwMCwKKwkJCS50UkNfbWluID0gMTAwMDAwLAorCQkJLnRSRUFfbWF4ID0gNDAwMDAs CisJCQkudFJFSF9taW4gPSAzMDAwMCwKKwkJCS50UkhPSF9taW4gPSAwLAorCQkJLnRSSFdfbWlu ID0gMjAwMDAwLAorCQkJLnRSSFpfbWF4ID0gMjAwMDAwLAorCQkJLnRSTE9IX21pbiA9IDAsCisJ CQkudFJQX21pbiA9IDUwMDAwLAorCQkJLnRSUl9taW4gPSA0MDAwMCwKKwkJCS50UlNUX21heCA9 IDI1MDAwMDAwMDAwMFVMTCwKKwkJCS50V0JfbWF4ID0gMjAwMDAwLAorCQkJLnRXQ19taW4gPSAx MDAwMDAsCisJCQkudFdIX21pbiA9IDMwMDAwLAorCQkJLnRXSFJfbWluID0gMTIwMDAwLAorCQkJ LnRXUF9taW4gPSA1MDAwMCwKKwkJCS50V1dfbWluID0gMTAwMDAwLAorCQl9LAogCX0sCiAJLyog TW9kZSAxICovCiAJewotCQkudEFETF9taW4gPSAxMDAwMDAsCi0JCS50QUxIX21pbiA9IDEwMDAw LAotCQkudEFMU19taW4gPSAyNTAwMCwKLQkJLnRBUl9taW4gPSAxMDAwMCwKLQkJLnRDRUFfbWF4 ID0gNDUwMDA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S50 Ul9tYXggPSAyMDAwMDAwMDAsCisJCQkudFBST0dfbWF4ID0gMTAwMDAwMFVMTCAqIE9ORklfRFlO X1RJTUlOR19NQVgsCisJCQkudEJFUlNfbWF4ID0gMTAwMDAwMFVMTCAqIE9ORklfRFlOX1RJTUlO R19NQVgsCisJCQkudEFETF9taW4gPSA0MDAwMDAsCisJCQkudEFMSF9taW4gPSAxMDAwMCwKKwkJ CS50QUxTX21pbiA9IDE1MDAwLAorCQkJLnRBUl9taW4gPSAxMDAwMCwKKwkJCS50Q0VBX21heCA9 IDMwMDAwLAorCQkJLnRDRUhfbWluID0gMjAwMDAsCisJCQkudENIX21pbiA9IDEwMDAwLAorCQkJ LnRDSFpfbWF4ID0gNTAwMDAsCisJCQkudENMSF9taW4gPSAxMDAwMCwKKwkJCS50Q0xSX21pbiA9 IDEwMDAwLAorCQkJLnRDTFNfbWluID0gMTUwMDAsCisJCQkudENPSF9taW4gPSAxNTAwMCwKKwkJ CS50Q1NfbWluID0gMjUwMDAsCisJCQkudERIX21pbiA9IDUwMDAsCisJCQkudERTX21pbiA9IDE1 MDAwLAorCQkJLnRGRUFUX21heCA9IDEwMDAwMDAsCisJCQkudElSX21pbiA9IDAsCisJCQkudElU Q19tYXggPSAxMDAwMDAwLAorCQkJLnRSQ19taW4gPSAzNTAwMCwKKwkJCS50UkVBX21heCA9IDI1 MDAwLAorCQkJLnRSRUhfbWluID0gMTUwMDAsCisJCQkudFJIT0hfbWluID0gMTUwMDAsCisJCQku dFJIV19taW4gPSAxMDAwMDAsCisJCQkudFJIWl9tYXggPSAxMDAwMDAsCisJCQkudFJMT0hfbWlu ID0gMCwKKwkJCS50UlJfbWluID0gMjAwMDAsCisJCQkudFJTVF9tYXggPSA1MDAwMDAwMDAsCisJ CQkudFdCX21heCA9IDEwMDAwMCwKKwkJCS50UlBfbWluID0gMTcwMDAsCisJCQkudFdDX21pbiA9 IDM1MDAwLAorCQkJLnRXSF9taW4gPSAxNTAwMCwKKwkJCS50V0h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orCQkudHlwZSA9IE5BTkRfU0RSX0lGQUNFLAorCQkudGltaW5ncy5tb2RlID0g MywKKwkJLnRpbWluZ3Muc2RyID0geworCQkJLnRDQ1NfbWluID0gNTAwMDAwLAorCQkJLnRSX21h eCA9IDIwMDAwMDAwMCwKKwkJCS50UFJPR19tYXggPSAxMDAwMDAwVUxMICogT05GSV9EWU5fVElN SU5HX01BWCwKKwkJCS50QkVSU19tYXggPSAxMDAwMDAwVUxMICogT05GSV9EWU5fVElNSU5HX01B WCwKKwkJCS50QURMX21pbiA9IDQwMDAwMCwKKwkJCS50QUxIX21pbiA9IDUwMDAsCisJCQkudEFM U19taW4gPSAxMDAwMCwKKwkJCS50QVJfbWluID0gMTAwMDAsCisJCQkudENFQV9tYXggPSAyNTAw MCwKKwkJCS50Q0VIX21pbiA9IDIwMDAwLAorCQkJLnRDSF9taW4gPSA1MDAwLAorCQkJLnRDSFpf bWF4ID0gNTAwMDAsCisJCQkudENMSF9taW4gPSA1MDAwLAorCQkJLnRDTFJfbWluID0gMTAwMDAs CisJCQkudENMU19taW4gPSAxMDAwMCwKKwkJCS50Q09IX21pbiA9IDE1MDAwLAorCQkJLnRDU19t aW4gPSAyNTAwMCwKKwkJCS50REhfbWluID0gNTAwMCwKKwkJCS50RFNfbWluID0gMTAwMDAsCisJ CQkudEZFQVRfbWF4ID0gMTAwMDAwMCwKKwkJCS50SVJfbWluID0gMCwKKwkJCS50SVRDX21heCA9 IDEwMDAwMDAsCisJCQkudFJDX21pbiA9IDMwMDAwLAorCQkJLnRSRUFfbWF4ID0gMjAwMDAsCisJ CQkudFJFSF9taW4gPSAxMDAwMCwKKwkJCS50UkhPSF9taW4gPSAxNTAwMCwKKwkJCS50UkhXX21p biA9IDEwMDAwMCwKKwkJCS50UkhaX21heCA9IDEwMDAwMCwKKwkJCS50UkxPSF9taW4gPSAwLAor CQkJLnRSUF9taW4gPSAxNTAwMCwKKwkJCS50UlJfbWluID0gMjAwMDAsCisJCQkudFJTVF9tYXgg PSA1MDAwMDAwMDAsCisJCQkudFdCX21heCA9IDEwMDAwMCwKKwkJCS50V0NfbWluID0gMzAwMDAs CisJCQkudFdIX21pbiA9IDEwMDAwLAorCQkJLnRXSFJfbWluID0gODAwMDAsCisJCQkudFdQX21p biA9IDE1MDAwLAorCQkJLnRXV19taW4gPSAxMDAwMDAsCisJCX0sCiAJfSwKIAkvKiBNb2RlIDQg Ki8KIAl7Ci0JCS50QURMX21pbiA9IDcwMDAwLAotCQkudEFMSF9taW4gPSA1MDAwLAotCQkudEFM U19taW4gPSAxMDAwMCwKLQkJLnRBUl9taW4gPSAxMDAwMCwKLQkJLnRDRUFfbWF4ID0gMjUwMDAs Ci0JCS50Q0VIX21pbiA9IDIwMDAwLAotCQkudENIX21pbiA9IDUwMDAsCi0JCS50Q0haX21heCA9 IDMwMDAwLAotCQkudENMSF9taW4gPSA1MDAwLAotCQkudENMUl9taW4gPSAxMDAwMCwKLQkJLnRD TFNfbWluID0gMTAwMDAsCi0JCS50Q09IX21pbiA9IDE1MDAwLAotCQkudENTX21pbiA9IDIwMDAw LAotCQkudERIX21pbiA9IDUwMDAsCi0JCS50RFNfbWluID0gMTAwMDAsCi0JCS50RkVBVF9tYXgg PSAxMDAwMDAwLAotCQkudElSX21pbiA9IDAsCi0JCS50SVRDX21heCA9IDEwMDAwMDAsCi0JCS50 UkNfbWluID0gMjUwMDAsCi0JCS50UkVBX21heCA9IDIwMDAwLAotCQkudFJFSF9taW4gPSAxMDAw MCwKLQkJLnRSSE9IX21pbiA9IDE1MDAwLAotCQkudFJIV19taW4gPSAxMDAwMDAsCi0JCS50Ukha X21heCA9IDEwMDAwMCwKLQkJLnRSTE9IX21pbiA9IDUwMDAsCi0JCS50UlBfbWluID0gMTIwMDAs Ci0JCS50UlJfbWluID0gMjAwMDAsCi0JCS50UlNUX21heCA9IDUwMDAwMDAwMCwKLQkJLnRXQl9t YXggPSAxMDAwMDAsCi0JCS50V0NfbWluID0gMjUwMDAsCi0JCS50V0hfbWluID0gMTAwMDAsCi0J CS50V0hSX21pbiA9IDgwMDAwLAotCQkudFdQX21pbiA9IDEyMDAwLAotCQkudFdXX21pbiA9IDEw MDAwMCwKKwkJLnR5cGUgPSBOQU5EX1NEUl9JRkFDRSwKKwkJLnRpbWluZ3MubW9kZSA9IDQsCisJ CS50aW1pbmdzLnNkciA9IHsKKwkJCS50Q0NTX21pbiA9IDUwMDAwMCwKKwkJCS50Ul9tYXggPSAy MDAwMDAwMDAsCisJCQkudFBST0dfbWF4ID0gMTAwMDAwMFVMTCAqIE9ORklfRFlOX1RJTUlOR19N QVgsCisJCQkudEJFUlNfbWF4ID0gMTAwMDAwMFVMTCAqIE9ORklfRFlOX1RJTUlOR19NQVgsCisJ CQkudEFETF9taW4gPSA0MDAwMDAsCisJCQkudEFMSF9taW4gPSA1MDAwLAorCQkJLnRBTFNfbWlu ID0gMTAwMDAsCisJCQkudEFSX21pbiA9IDEwMDAwLAorCQkJLnRDRUFfbWF4ID0gMjUwMDAsCisJ CQkudENFSF9taW4gPSAyMDAwMCwKKwkJCS50Q0hfbWluID0gNTAwMCwKKwkJCS50Q0haX21heCA9 IDMwMDAwLAorCQkJLnRDTEhfbWluID0gNTAwMCwKKwkJCS50Q0xSX21pbiA9IDEwMDAwLAorCQkJ LnRDTFNfbWluID0gMTAwMDAsCisJCQkudENPSF9taW4gPSAxNTAwMCwKKwkJCS50Q1NfbWluID0g MjAwMDAsCisJCQkudERIX21pbiA9IDUwMDAsCisJCQkudERTX21pbiA9IDEwMDAwLAorCQkJLnRG RUFUX21heCA9IDEwMDAwMDAsCisJCQkudElSX21pbiA9IDAsCisJCQkudElUQ19tYXggPSAxMDAw MDAwLAorCQkJLnRSQ19taW4gPSAyNTAwMCwKKwkJCS50UkVBX21heCA9IDIwMDAwLAorCQkJLnRS RUhfbWluID0gMTAwMDAsCisJCQkudFJIT0hfbWluID0gMTUwMDAsCisJCQkudFJIV19taW4gPSAx MDAwMDAsCisJCQkudFJIWl9tYXggPSAxMDAwMDAsCisJCQkudFJMT0hfbWluID0gNTAwMCwKKwkJ CS50UlBfbWluID0gMTIwMDAsCisJCQkudFJSX21pbiA9IDIwMDAwLAorCQkJLnRSU1RfbWF4ID0g NTAwMDAwMDAwLAorCQkJLnRXQl9tYXggPSAxMDAwMDAsCisJCQkudFdDX21pbiA9IDI1MDAwLAor CQkJLnRXSF9taW4gPSAxMDAwMCwKKwkJCS50V0hSX21pbiA9IDgwMDAwLAorCQkJLnRXUF9taW4g PSAxMjAwMCwKKwkJCS50V1dfbWluID0gMTAwMDAwLAorCQl9LAogCX0sCiAJLyogTW9kZSA1ICov CiAJewotCQkudEFETF9taW4gPSA3MDAwMCwKLQkJLnRBTEhfbWluID0gNTAwMCwKLQkJLnRBTFNf bWluID0gMTAwMDAsCi0JCS50QVJfbWluID0gMTAwMDAsCi0JCS50Q0VBX21heCA9IDI1MDAwLAot CQkudENFSF9taW4gPSAyMDAwMCwKLQkJLnRDSF9taW4gPSA1MDAwLAotCQkudENIWl9tYXggPSAz MDAwMCwKLQkJLnRDTEhfbWluID0gNTAwMCwKLQkJLnRDTFJfbWluID0gMTAwMDAsCi0JCS50Q0xT X21pbiA9IDEwMDAwLAotCQkudENPSF9taW4gPSAxNTAwMCwKLQkJLnRDU19taW4gPSAxNTAwMCwK LQkJLnRESF9taW4gPSA1MDAwLAotCQkudERTX21pbiA9IDcwMDAsCi0JCS50RkVBVF9tYXggPSAx MDAwMDAwLAotCQkudElSX21pbiA9IDAsCi0JCS50SVRDX21heCA9IDEwMDAwMDAsCi0JCS50UkNf bWluID0gMjAwMDAsCi0JCS50UkVBX21heCA9IDE2MDAwLAotCQkudFJFSF9taW4gPSA3MDAwLAot CQkudFJIT0hfbWluID0gMTUwMDAsCi0JCS50UkhXX21pbiA9IDEwMDAwMCwKLQkJLnRSSFpfbWF4 ID0gMTAwMDAwLAotCQkudFJMT0hfbWluID0gNTAwMCwKLQkJLnRSUF9taW4gPSAxMDAwMCwKLQkJ LnRSUl9taW4gPSAyMDAwMCwKLQkJLnRSU1RfbWF4ID0gNTAwMDAwMDAwLAotCQkudFdCX21heCA9 IDEwMDAwMCwKLQkJLnRXQ19taW4gPSAyMDAwMCwKLQkJLnRXSF9taW4gPSA3MDAwLAotCQkudFdI Ul9taW4gPSA4MDAwMCwKLQkJLnRXUF9taW4gPSAxMDAwMCwKLQkJLnRXV19taW4gPSAxMDAwMDAs CisJCS50eXBlID0gTkFORF9TRFJfSUZBQ0UsCisJCS50aW1pbmdzLm1vZGUgPSA1LAorCQkudGlt aW5ncy5zZHIgPSB7CisJCQkudENDU19taW4gPSA1MDAwMDAsCisJCQkudFJfbWF4ID0gMjAwMDAw MDAwLAorCQkJLnRQUk9HX21heCA9IDEwMDAwMDBVTEwgKiBPTkZJX0RZTl9USU1JTkdfTUFYLAor CQkJLnRCRVJTX21heCA9IDEwMDAwMDBVTEwgKiBPTkZJX0RZTl9USU1JTkdfTUFYLAorCQkJLnRB RExfbWluID0gNDAwMDAwLAorCQkJLnRBTEhfbWluID0gNTAwMCwKKwkJCS50QUxTX21pbiA9IDEw MDAwLAorCQkJLnRBUl9taW4gPSAxMDAwMCwKKwkJCS50Q0VBX21heCA9IDI1MDAwLAorCQkJLnRD RUhfbWluID0gMjAwMDAsCisJCQkudENIX21pbiA9IDUwMDAsCisJCQkudENIWl9tYXggPSAzMDAw MCwKKwkJCS50Q0xIX21pbiA9IDUwMDAsCisJCQkudENMUl9taW4gPSAxMDAwMCwKKwkJCS50Q0xT X21pbiA9IDEwMDAwLAorCQkJLnRDT0hfbWluID0gMTUwMDAsCisJCQkudENTX21pbiA9IDE1MDAw LAorCQkJLnRESF9taW4gPSA1MDAwLAorCQkJLnREU19taW4gPSA3MDAwLAorCQkJLnRGRUFUX21h eCA9IDEwMDAwMDAsCisJCQkudElSX21pbiA9IDAsCisJCQkudElUQ19tYXggPSAxMDAwMDAwLAor CQkJLnRSQ19taW4gPSAyMDAwMCwKKwkJCS50UkVBX21heCA9IDE2MDAwLAorCQkJLn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qb25maV90aW1pbmdzOworCWludCBtb2RlOworCisJZm9yIChtb2Rl ID0gQVJSQVlfU0laRShvbmZpX3Nkcl90aW1pbmdzKSAtIDE7IG1vZGUgPiAwOyBtb2RlLS0pIHsK KwkJb25maV90aW1pbmdzID0gJm9uZmlfc2RyX3RpbWluZ3NbbW9kZV0udGltaW5ncy5zZHI7CisK KwkJaWYgKHNwZWNfdGltaW5ncy0+dENDU19taW4gPD0gb25maV90aW1pbmdzLT50Q0NTX21pbiAm JgorCQkgICAgc3BlY190aW1pbmdzLT50QURMX21pbiA8PSBvbmZpX3RpbWluZ3MtPnRBRExfbWlu ICYmCisJCSAgICBzcGVjX3RpbWluZ3MtPnRBTEhfbWluIDw9IG9uZmlfdGltaW5ncy0+dEFMSF9t aW4gJiYKKwkJICAgIHNwZWNfdGltaW5ncy0+dEFMU19taW4gPD0gb25maV90aW1pbmdzLT50QUxT X21pbiAmJgorCQkgICAgc3BlY190aW1pbmdzLT50QVJfbWluIDw9IG9uZmlfdGltaW5ncy0+dEFS X21pbiAmJgorCQkgICAgc3BlY190aW1pbmdzLT50Q0VIX21pbiA8PSBvbmZpX3RpbWluZ3MtPnRD RUhfbWluICYmCisJCSAgICBzcGVjX3RpbWluZ3MtPnRDSF9taW4gPD0gb25maV90aW1pbmdzLT50 Q0hfbWluICYmCisJCSAgICBzcGVjX3RpbWluZ3MtPnRDTEhfbWluIDw9IG9uZmlfdGltaW5ncy0+ dENMSF9taW4gJiYKKwkJICAgIHNwZWNfdGltaW5ncy0+dENMUl9taW4gPD0gb25maV90aW1pbmdz LT50Q0xSX21pbiAmJgorCQkgICAgc3BlY190aW1pbmdzLT50Q0xTX21pbiA8PSBvbmZpX3RpbWlu Z3MtPnRDTFNfbWluICYmCisJCSAgICBzcGVjX3RpbWluZ3MtPnRDT0hfbWluIDw9IG9uZmlfdGlt aW5ncy0+dENPSF9taW4gJiYKKwkJICAgIHNwZWNfdGltaW5ncy0+dENTX21pbiA8PSBvbmZpX3Rp bWluZ3MtPnRDU19taW4gJiYKKwkJICAgIHNwZWNfdGltaW5ncy0+dERIX21pbiA8PSBvbmZpX3Rp bWluZ3MtPnRESF9taW4gJiYKKwkJICAgIHNwZWNfdGltaW5ncy0+dERTX21pbiA8PSBvbmZpX3Rp bWluZ3MtPnREU19taW4gJiYKKwkJICAgIHNwZWNfdGltaW5ncy0+dElSX21pbiA8PSBvbmZpX3Rp bWluZ3MtPnRJUl9taW4gJiYKKwkJICAgIHNwZWNfdGltaW5ncy0+dFJDX21pbiA8PSBvbmZpX3Rp bWluZ3MtPnRSQ19taW4gJiYKKwkJICAgIHNwZWNfdGltaW5ncy0+dFJFSF9taW4gPD0gb25maV90 aW1pbmdzLT50UkVIX21pbiAmJgorCQkgICAgc3BlY190aW1pbmdzLT50UkhPSF9taW4gPD0gb25m aV90aW1pbmdzLT50UkhPSF9taW4gJiYKKwkJICAgIHNwZWNfdGltaW5ncy0+dFJIV19taW4gPD0g b25maV90aW1pbmdzLT50UkhXX21pbiAmJgorCQkgICAgc3BlY190aW1pbmdzLT50UkxPSF9taW4g PD0gb25maV90aW1pbmdzLT50UkxPSF9taW4gJiYKKwkJICAgIHNwZWNfdGltaW5ncy0+dFJQX21p biA8PSBvbmZpX3RpbWluZ3MtPnRSUF9taW4gJiYKKwkJICAgIHNwZWNfdGltaW5ncy0+dFJSX21p biA8PSBvbmZpX3RpbWluZ3MtPnRSUl9taW4gJiYKKwkJICAgIHNwZWNfdGltaW5ncy0+dFdDX21p biA8PSBvbmZpX3RpbWluZ3MtPnRXQ19taW4gJiYKKwkJICAgIHNwZWNfdGltaW5ncy0+dFdIX21p biA8PSBvbmZpX3RpbWluZ3MtPnRXSF9taW4gJiYKKwkJICAgIHNwZWNfdGltaW5ncy0+dFdIUl9t aW4gPD0gb25maV90aW1pbmdzLT50V0hSX21pbiAmJgorCQkgICAgc3BlY190aW1pbmdzLT50V1Bf bWluIDw9IG9uZmlfdGltaW5ncy0+dFdQX21pbiAmJgorCQkgICAgc3BlY190aW1pbmdzLT50V1df bWluIDw9IG9uZmlfdGltaW5ncy0+dFdXX21pbikKKwkJCXJldHVybiBtb2RlOworCX0KKworCXJl dHVybiAwOworfQorCisvKioKKyAqIG9uZmlfZmlsbF9pbnRlcmZhY2VfY29uZmlnIC0gSW5pdGlh bGl6ZSBhbiBpbnRlcmZhY2UgY29uZmlnIGZyb20gYSBnaXZlbgorICogICAgICAgICAgICAgICAg ICAgICAgICAgICAgICBPTkZJIG1vZGUKKyAqIEBjaGlwOiBUaGUgTkFORCBjaGlwCisgKiBAaWZh Y2U6IFRoZSBpbnRlcmZhY2UgY29uZmlndXJhdGlvbiB0byBmaWxsCisgKiBAdHlwZTogVGhlIGlu dGVyZmFjZSB0eXBlCisgKiBAdGltaW5nX21vZGU6IFRoZSBPTkZJIHRpbWluZyBtb2RlCisgKi8K K3ZvaWQgb25maV9maWxsX2ludGVyZmFjZV9jb25maWcoc3RydWN0IG5hbmRfY2hpcCAqY2hpcCwK KwkJCQlzdHJ1Y3QgbmFuZF9pbnRlcmZhY2VfY29uZmlnICppZmFjZSwKKwkJCQllbnVtIG5hbmRf aW50ZXJmYWNlX3R5cGUgdHlwZSwKKwkJCQl1bnNpZ25lZCBpbnQgdGltaW5nX21vZGUpCit7CisJ c3RydWN0IG9uZmlfcGFyYW1zICpvbmZpID0gY2hpcC0+cGFyYW1ldGVycy5vbmZpOworCisJaWYg KFdBUk5fT04odHlwZSAhPSBOQU5EX1NEUl9JRkFDRSkpCisJCXJldHVybjsKKworCWlmIChXQVJO X09OKHRpbWluZ19tb2RlID49IEFSUkFZX1NJWkUob25maV9zZHJfdGltaW5ncykpKQorCQlyZXR1 cm47CisKKwkqaWZhY2UgPSBvbmZpX3Nkcl90aW1pbmdzW3RpbWluZ19tb2RlXTsKKworCS8qCisJ ICogSW5pdGlhbGl6ZSB0aW1pbmdzIHRoYXQgY2Fubm90IGJlIGRlZHVjZWQgZnJvbSB0aW1pbmcg bW9kZToKKwkgKiB0UFJPRywgdEJFU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gb25seSkKKyAqIEB0UlNUX21heDogRGV2aWNlIHJlc2V0IHRpbWUsIG1l YXN1cmVkIGZyb20gdGhlIGZhbGxpbmcgZWRnZSBvZiBSL0IjIHRvIHRoZQorICoJICAgICAgcmlz aW5nIGVkZ2Ugb2YgUi9CIy4KKyAqIEB0V0JfbWF4OiBXRSMgaGlnaCB0byBTUls2XSBsb3cKKyAq IEB0V0NfbWluOiBXRSMgY3ljbGUgdGltZQorICogQHRXSF9taW46IFdFIyBoaWdoIGhvbGQgdGlt ZQorICogQHRXSFJfbWluOiBXRSMgaGlnaCB0byBSRSMgbG93CisgKiBAdFdQX21pbjogV0UjIHB1 bHNlIHdpZHRoCisgKiBAdFdXX21pbjogV1AjIHRyYW5zaXRpb24gdG8gV0UjIGxvdworICovCitz dHJ1Y3QgbmFuZF9zZHJfdGltaW5ncyB7CisJdTY0IHRCRVJTX21heDsKKwl1MzIgdENDU19taW47 CisJdTY0IHRQUk9HX21heDsKKwl1NjQgdFJfbWF4OworCXUzMiB0QUxIX21pbjsKKwl1MzIgdEFE TF9taW47CisJdTMyIHRBTFNfbWluOworCXUzMiB0QVJfbWluOworCXUzMiB0Q0VBX21heDsKKwl1 MzIgdENFSF9taW47CisJdTMyIHRDSF9taW47CisJdTMyIHRDSFpfbWF4OworCXUzMiB0Q0xIX21p bjsKKwl1MzIgdENMUl9taW47CisJdTMyIHRDTFNfbWluOworCXUzMiB0Q09IX21pbjsKKwl1MzIg dENTX21pbjsKKwl1MzIgdERIX21pbjsKKwl1MzIgdERTX21pbjsKKwl1MzIgdEZFQVRfbWF4Owor CXUzMiB0SVJfbWluOworCXUzMiB0SVRDX21heDsKKwl1MzIgdFJDX21pbjsKKwl1MzIgdFJFQV9t YXg7CisJdTMyIHRSRUhfbWluOworCXUzMiB0UkhPSF9taW47CisJdTMyIHRSSFdfbWluOworCXUz MiB0UkhaX21heDsKKwl1MzIgdFJMT0hfbWluOworCXUzMiB0UlBfbWluOworCXUzMiB0UlJfbWlu OworCX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