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 bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eHSBO-0007Gn-Al for barebox@lists.infradead.org; Wed, 22 Nov 2017 10:23:11 +0000 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Wed, 22 Nov 2017 11:22:29 +0100 Message-Id: <20171122102231.16872-5-u.kleine-koenig@pengutronix.de> In-Reply-To: <20171122102231.16872-1-u.kleine-koenig@pengutronix.de> References: <20171122102231.16872-1-u.kleine-koenig@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 4/6] net/e1000: provide access to iNVM even if a flash is present To: barebox@lists.infradead.org Cc: Andrey Smirnov QW4gaTIxMCAoYWthIGUxMDAwX2lnYikgc3VwcG9ydHMgdHdvIGRpZmZlcmVudCBub24tdm9sYXRp bGUgc3RvcmFnZXMgZm9yCmNvbmZpZ3VyYXRpb24uIFRoZXJlIGlzIGEgYnVpbHQtaW4gb25lLXRp bWUgcHJvZ3JhbW1hYmxlIHN0b3JhZ2UgY2FsbGVkCmlOVk0gYW5kIGFuIG9wdGlvbmFsIGV4dGVy bmFsIFNQSS1GbGFzaC4gSWYgYSBmbGFzaCBpcyBwb3B1bGF0ZWQgYW5kCmNvbnRhaW5zIGEgdmFs aWQgY29uZmlndXJhdGlvbiBpbWFnZSB0aGUgaU5WTSBpcyBub3QgdXNlZCAoaWYgSQp1bmRlcnN0 b29kIHRoZSBkb2N1bWVudGF0aW9uIGNvcnJlY3RseSkuIFN0aWxsIHRoZSBpTlZNIGNhbiBiZSB1 c2VmdWwgaWYKdGhlIGZsYXNoIGlzIG5vdCBjb25ma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CkKKwkJcmV0dXJuIHJldDsKIAotCQlyZXQgPSBkZXZmc19jcmVhdGUoJmh3LT5pbnZtLmNk ZXYpOwotCQlpZiAocmV0IDwgMCkKLQkJCWJyZWFrOworCXN0cmNweShody0+aW52bS5kZXYubmFt ZSwgImludm0iKTsKKwlody0+aW52bS5kZXYucGFyZW50ID0gaHctPmRldjsKKwlyZXQgPSByZWdp c3Rlcl9kZXZpY2UoJmh3LT5pbnZtLmRldik7CisJaWYgKHJldCA8IDApIHsKKwkJZGV2ZnNfcmVt b3ZlKCZody0+aW52bS5jZGV2KTsKKwkJcmV0dXJuIHJldDsKKwl9CiAKLQkJc3RyY3B5KGh3LT5p bnZtLmRldi5uYW1lLCAiaW52bSIpOwotCQlody0+aW52bS5kZXYucGFyZW50ID0gaHctPmRldjsK LQkJcmV0ID0gcmVnaXN0ZXJfZGV2aWNlKCZody0+aW52bS5kZXYpOwotCQlpZiAocmV0IDwgMCkg ewotCQkJZGV2ZnNfcmVtb3ZlKCZody0+aW52bS5jZGV2KTsKLQkJCWJyZWFrOwotCQl9CisJcCA9 IGRldl9hZGRfcGFyYW1faW50KCZody0+aW52bS5kZXYsICJsb2NrIiwgZTEwMDBfaW52bV9zZXRf bG9jaywKKwkJCSAgICAgIE5VTEwsICZody0+aW52bS5saW5lLCAiJXUiLCBodyk7CisJaWYgKElT X0VSUihwKSkgeworCQl1bnJlZ2lzdGVyX2RldmljZSgmaHctPmludm0uZGV2KTsKKwkJZGV2ZnNf cmVtb3ZlKCZody0+aW52bS5jZGV2KTsKKwkJcmV0ID0gUFRSX0VSUihwKTsKKwl9CiAKLQkJcCA9 IGRldl9hZGRfcGFyYW1faW50KCZody0+aW52bS5kZXYsICJsb2NrIiwgZTEwMDBfaW52bV9zZXRf bG9jaywKLQkJCQkgICAgICBOVUxMLCAmaHctPmludm0ubGluZSwgIiV1IiwgaHcpOwotCQlpZiAo SVNfRVJSKHApKSB7Ci0JCQl1bnJlZ2lzdGVyX2RldmljZSgmaHctPm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