summaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2014-03-30 01:10:37 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2014-03-30 01:10:37 +0000
commitf5554fc467f3b8400a0af1c17a269c12d039c4c9 (patch)
tree71f3866a11629806a04158e0bda01747dfefe88c /sys/dev/pci
parent96d281ced41306802b305d3a0178d21f74d6d26c (diff)
drm/i915/dp: add native aux defer retry limit
From Jani Nikula b4cdadf2591e12c61f895556cf93a8b61a36892c in ubuntu 3.8 f51a44b9a6c4982cc25bfb3727de9bb893621ebc in mainline linux
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/drm/i915/intel_dp.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/sys/dev/pci/drm/i915/intel_dp.c b/sys/dev/pci/drm/i915/intel_dp.c
index f63aae7c21a..fa668cf697c 100644
--- a/sys/dev/pci/drm/i915/intel_dp.c
+++ b/sys/dev/pci/drm/i915/intel_dp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: intel_dp.c,v 1.17 2014/03/30 01:06:31 jsg Exp $ */
+/* $OpenBSD: intel_dp.c,v 1.18 2014/03/30 01:10:36 jsg Exp $ */
/*
* Copyright © 2008 Intel Corporation
*
@@ -491,6 +491,7 @@ intel_dp_aux_native_write(struct intel_dp *intel_dp,
uint8_t msg[20];
int msg_bytes;
uint8_t ack;
+ int retry;
intel_dp_check_edp(intel_dp);
if (send_bytes > 16)
@@ -501,18 +502,20 @@ intel_dp_aux_native_write(struct intel_dp *intel_dp,
msg[3] = send_bytes - 1;
memcpy(&msg[4], send, send_bytes);
msg_bytes = send_bytes + 4;
- for (;;) {
+ for (retry = 0; retry < 7; retry++) {
ret = intel_dp_aux_ch(intel_dp, msg, msg_bytes, &ack, 1);
if (ret < 0)
return ret;
if ((ack & AUX_NATIVE_REPLY_MASK) == AUX_NATIVE_REPLY_ACK)
- break;
+ return send_bytes;
else if ((ack & AUX_NATIVE_REPLY_MASK) == AUX_NATIVE_REPLY_DEFER)
usleep_range(400, 500);
else
return -EIO;
}
- return send_bytes;
+
+ DRM_ERROR("too many retries, giving up\n");
+ return -EIO;
}
/* Write a single byte to the aux channel in native mode */
@@ -534,6 +537,7 @@ intel_dp_aux_native_read(struct intel_dp *intel_dp,
int reply_bytes;
uint8_t ack;
int ret;
+ int retry;
intel_dp_check_edp(intel_dp);
msg[0] = AUX_NATIVE_READ << 4;
@@ -544,7 +548,7 @@ intel_dp_aux_native_read(struct intel_dp *intel_dp,
msg_bytes = 4;
reply_bytes = recv_bytes + 1;
- for (;;) {
+ for (retry = 0; retry < 7; retry++) {
ret = intel_dp_aux_ch(intel_dp, msg, msg_bytes,
reply, reply_bytes);
if (ret == 0)
@@ -561,6 +565,9 @@ intel_dp_aux_native_read(struct intel_dp *intel_dp,
else
return -EIO;
}
+
+ DRM_ERROR("too many retries, giving up\n");
+ return -EIO;
}
static int