aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/asihpi
diff options
context:
space:
mode:
authorEliot Blennerhassett <eblennerhassett@audioscience.com>2011-07-21 23:52:38 -0400
committerTakashi Iwai <tiwai@suse.de>2011-07-22 01:45:26 -0400
commitc6c2c9aba16c41a8f72bec0738880447d158bdf7 (patch)
tree5b89bbe77676b528fd40c939d160689d4ec3f726 /sound/pci/asihpi
parent82b5774fe02c61fc70aed6bc885f0d26b708e925 (diff)
ALSA: asihpi - Increase request and response buffer sizes
Allow for up to 256 bytes of extra data on top of standard hpi request and response sizes. Signed-off-by: Eliot Blennerhassett <eblennerhassett@audioscience.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/asihpi')
-rw-r--r--sound/pci/asihpi/hpi6205.c15
-rw-r--r--sound/pci/asihpi/hpi6205.h25
-rw-r--r--sound/pci/asihpi/hpicmn.c13
3 files changed, 34 insertions, 19 deletions
diff --git a/sound/pci/asihpi/hpi6205.c b/sound/pci/asihpi/hpi6205.c
index faff9e377798..8831a6f179e3 100644
--- a/sound/pci/asihpi/hpi6205.c
+++ b/sound/pci/asihpi/hpi6205.c
@@ -2085,13 +2085,13 @@ static u16 message_response_sequence(struct hpi_adapter_obj *pao,
2085 u16 err = 0; 2085 u16 err = 0;
2086 2086
2087 message_count++; 2087 message_count++;
2088 if (phm->size > sizeof(interface->u)) { 2088 if (phm->size > sizeof(interface->u.message_buffer)) {
2089 phr->error = HPI_ERROR_MESSAGE_BUFFER_TOO_SMALL; 2089 phr->error = HPI_ERROR_MESSAGE_BUFFER_TOO_SMALL;
2090 phr->specific_error = sizeof(interface->u); 2090 phr->specific_error = sizeof(interface->u.message_buffer);
2091 phr->size = sizeof(struct hpi_response_header); 2091 phr->size = sizeof(struct hpi_response_header);
2092 HPI_DEBUG_LOG(ERROR, 2092 HPI_DEBUG_LOG(ERROR,
2093 "message len %d too big for buffer %zd \n", phm->size, 2093 "message len %d too big for buffer %zd \n", phm->size,
2094 sizeof(interface->u)); 2094 sizeof(interface->u.message_buffer));
2095 return 0; 2095 return 0;
2096 } 2096 }
2097 2097
@@ -2123,18 +2123,19 @@ static u16 message_response_sequence(struct hpi_adapter_obj *pao,
2123 2123
2124 /* read the result */ 2124 /* read the result */
2125 if (time_out) { 2125 if (time_out) {
2126 if (interface->u.response_buffer.size <= phr->size) 2126 if (interface->u.response_buffer.response.size <= phr->size)
2127 memcpy(phr, &interface->u.response_buffer, 2127 memcpy(phr, &interface->u.response_buffer,
2128 interface->u.response_buffer.size); 2128 interface->u.response_buffer.response.size);
2129 else { 2129 else {
2130 HPI_DEBUG_LOG(ERROR, 2130 HPI_DEBUG_LOG(ERROR,
2131 "response len %d too big for buffer %d\n", 2131 "response len %d too big for buffer %d\n",
2132 interface->u.response_buffer.size, phr->size); 2132 interface->u.response_buffer.response.size,
2133 phr->size);
2133 memcpy(phr, &interface->u.response_buffer, 2134 memcpy(phr, &interface->u.response_buffer,
2134 sizeof(struct hpi_response_header)); 2135 sizeof(struct hpi_response_header));
2135 phr->error = HPI_ERROR_RESPONSE_BUFFER_TOO_SMALL; 2136 phr->error = HPI_ERROR_RESPONSE_BUFFER_TOO_SMALL;
2136 phr->specific_error = 2137 phr->specific_error =
2137 interface->u.response_buffer.size; 2138 interface->u.response_buffer.response.size;
2138 phr->size = sizeof(struct hpi_response_header); 2139 phr->size = sizeof(struct hpi_response_header);
2139 } 2140 }
2140 } 2141 }
diff --git a/sound/pci/asihpi/hpi6205.h b/sound/pci/asihpi/hpi6205.h
index df2f02c0c7b4..ec0827b633a6 100644
--- a/sound/pci/asihpi/hpi6205.h
+++ b/sound/pci/asihpi/hpi6205.h
@@ -1,7 +1,7 @@
1/***************************************************************************** 1/*****************************************************************************
2 2
3 AudioScience HPI driver 3 AudioScience HPI driver
4 Copyright (C) 1997-2010 AudioScience Inc. <support@audioscience.com> 4 Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of version 2 of the GNU General Public License as 7 it under the terms of version 2 of the GNU General Public License as
@@ -70,15 +70,28 @@ The Host located memory buffer that the 6205 will bus master
70in and out of. 70in and out of.
71************************************************************/ 71************************************************************/
72#define HPI6205_SIZEOF_DATA (16*1024) 72#define HPI6205_SIZEOF_DATA (16*1024)
73
74struct message_buffer_6205 {
75 struct hpi_message message;
76 char data[256];
77};
78
79struct response_buffer_6205 {
80 struct hpi_response response;
81 char data[256];
82};
83
84union buffer_6205 {
85 struct message_buffer_6205 message_buffer;
86 struct response_buffer_6205 response_buffer;
87 u8 b_data[HPI6205_SIZEOF_DATA];
88};
89
73struct bus_master_interface { 90struct bus_master_interface {
74 u32 host_cmd; 91 u32 host_cmd;
75 u32 dsp_ack; 92 u32 dsp_ack;
76 u32 transfer_size_in_bytes; 93 u32 transfer_size_in_bytes;
77 union { 94 union buffer_6205 u;
78 struct hpi_message_header message_buffer;
79 struct hpi_response_header response_buffer;
80 u8 b_data[HPI6205_SIZEOF_DATA];
81 } u;
82 struct controlcache_6205 control_cache; 95 struct controlcache_6205 control_cache;
83 struct async_event_buffer_6205 async_buffer; 96 struct async_event_buffer_6205 async_buffer;
84 struct hpi_hostbuffer_status 97 struct hpi_hostbuffer_status
diff --git a/sound/pci/asihpi/hpicmn.c b/sound/pci/asihpi/hpicmn.c
index 801dcd89c86e..fe2e1ae3853d 100644
--- a/sound/pci/asihpi/hpicmn.c
+++ b/sound/pci/asihpi/hpicmn.c
@@ -315,8 +315,7 @@ short hpi_check_control_cache(struct hpi_control_cache *p_cache,
315 short found = 1; 315 short found = 1;
316 struct hpi_control_cache_info *pI; 316 struct hpi_control_cache_info *pI;
317 struct hpi_control_cache_single *pC; 317 struct hpi_control_cache_single *pC;
318 struct hpi_control_cache_pad *p_pad; 318 u16 response_size;
319
320 if (!find_control(phm->obj_index, p_cache, &pI)) { 319 if (!find_control(phm->obj_index, p_cache, &pI)) {
321 HPI_DEBUG_LOG(VERBOSE, 320 HPI_DEBUG_LOG(VERBOSE,
322 "HPICMN find_control() failed for adap %d\n", 321 "HPICMN find_control() failed for adap %d\n",
@@ -326,11 +325,15 @@ short hpi_check_control_cache(struct hpi_control_cache *p_cache,
326 325
327 phr->error = 0; 326 phr->error = 0;
328 327
328 /* set the default response size */
329 response_size =
330 sizeof(struct hpi_response_header) +
331 sizeof(struct hpi_control_res);
332
329 /* pC is the default cached control strucure. May be cast to 333 /* pC is the default cached control strucure. May be cast to
330 something else in the following switch statement. 334 something else in the following switch statement.
331 */ 335 */
332 pC = (struct hpi_control_cache_single *)pI; 336 pC = (struct hpi_control_cache_single *)pI;
333 p_pad = (struct hpi_control_cache_pad *)pI;
334 337
335 switch (pI->control_type) { 338 switch (pI->control_type) {
336 339
@@ -529,9 +532,7 @@ short hpi_check_control_cache(struct hpi_control_cache *p_cache,
529 pI->control_index, pI->control_type, phm->u.c.attribute); 532 pI->control_index, pI->control_type, phm->u.c.attribute);
530 533
531 if (found) 534 if (found)
532 phr->size = 535 phr->size = response_size;
533 sizeof(struct hpi_response_header) +
534 sizeof(struct hpi_control_res);
535 536
536 return found; 537 return found;
537} 538}