aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/amr
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2012-10-05 15:52:31 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2012-10-05 15:52:31 +0000
commitf8d6c20a0f02e7ee63b21404d86219e231010961 (patch)
treefbcaa7f4d6fa89841cae7352eae3f277c2d2a87f /sys/dev/amr
parent102548d14322fe3350136f843346b003d1088f16 (diff)
downloadsrc-f8d6c20a0f02e7ee63b21404d86219e231010961.tar.gz
src-f8d6c20a0f02e7ee63b21404d86219e231010961.zip
Notes
Diffstat (limited to 'sys/dev/amr')
-rw-r--r--sys/dev/amr/amr.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/sys/dev/amr/amr.c b/sys/dev/amr/amr.c
index 6c7d2ea9870f..03a69858d053 100644
--- a/sys/dev/amr/amr.c
+++ b/sys/dev/amr/amr.c
@@ -533,13 +533,19 @@ shutdown_out:
* The amr(4) firmware relies on this feature. In fact, it assumes
* the buffer is always a power of 2 up to a max of 64k. There is
* also at least one case where it assumes a buffer less than 16k is
- * greater than 16k. Force a minimum buffer size of 32k and round
- * sizes between 32k and 64k up to 64k as a workaround.
+ * greater than 16k. However, forcing all buffers to a size of 32k
+ * causes stalls in the firmware. Force each command smaller than
+ * 64k up to the next power of two except that commands between 8k
+ * and 16k are rounded up to 32k instead of 16k.
*/
static unsigned long
amr_ioctl_buffer_length(unsigned long len)
{
+ if (len <= 4 * 1024)
+ return (4 * 1024);
+ if (len <= 8 * 1024)
+ return (8 * 1024);
if (len <= 32 * 1024)
return (32 * 1024);
if (len <= 64 * 1024)