diff options
Diffstat (limited to 'sound/pci/asihpi/hpimsgx.c')
-rw-r--r-- | sound/pci/asihpi/hpimsgx.c | 203 |
1 files changed, 51 insertions, 152 deletions
diff --git a/sound/pci/asihpi/hpimsgx.c b/sound/pci/asihpi/hpimsgx.c index f01ab964f602..bcbdf30a6aa0 100644 --- a/sound/pci/asihpi/hpimsgx.c +++ b/sound/pci/asihpi/hpimsgx.c | |||
@@ -23,6 +23,7 @@ Extended Message Function With Response Cacheing | |||
23 | #define SOURCEFILE_NAME "hpimsgx.c" | 23 | #define SOURCEFILE_NAME "hpimsgx.c" |
24 | #include "hpi_internal.h" | 24 | #include "hpi_internal.h" |
25 | #include "hpimsginit.h" | 25 | #include "hpimsginit.h" |
26 | #include "hpicmn.h" | ||
26 | #include "hpimsgx.h" | 27 | #include "hpimsgx.h" |
27 | #include "hpidebug.h" | 28 | #include "hpidebug.h" |
28 | 29 | ||
@@ -42,22 +43,24 @@ static hpi_handler_func *hpi_lookup_entry_point_function(const struct hpi_pci | |||
42 | 43 | ||
43 | for (i = 0; asihpi_pci_tbl[i].vendor != 0; i++) { | 44 | for (i = 0; asihpi_pci_tbl[i].vendor != 0; i++) { |
44 | if (asihpi_pci_tbl[i].vendor != PCI_ANY_ID | 45 | if (asihpi_pci_tbl[i].vendor != PCI_ANY_ID |
45 | && asihpi_pci_tbl[i].vendor != pci_info->vendor_id) | 46 | && asihpi_pci_tbl[i].vendor != |
47 | pci_info->pci_dev->vendor) | ||
46 | continue; | 48 | continue; |
47 | if (asihpi_pci_tbl[i].device != PCI_ANY_ID | 49 | if (asihpi_pci_tbl[i].device != PCI_ANY_ID |
48 | && asihpi_pci_tbl[i].device != pci_info->device_id) | 50 | && asihpi_pci_tbl[i].device != |
51 | pci_info->pci_dev->device) | ||
49 | continue; | 52 | continue; |
50 | if (asihpi_pci_tbl[i].subvendor != PCI_ANY_ID | 53 | if (asihpi_pci_tbl[i].subvendor != PCI_ANY_ID |
51 | && asihpi_pci_tbl[i].subvendor != | 54 | && asihpi_pci_tbl[i].subvendor != |
52 | pci_info->subsys_vendor_id) | 55 | pci_info->pci_dev->subsystem_vendor) |
53 | continue; | 56 | continue; |
54 | if (asihpi_pci_tbl[i].subdevice != PCI_ANY_ID | 57 | if (asihpi_pci_tbl[i].subdevice != PCI_ANY_ID |
55 | && asihpi_pci_tbl[i].subdevice != | 58 | && asihpi_pci_tbl[i].subdevice != |
56 | pci_info->subsys_device_id) | 59 | pci_info->pci_dev->subsystem_device) |
57 | continue; | 60 | continue; |
58 | 61 | ||
59 | HPI_DEBUG_LOG(DEBUG, " %x,%lu\n", i, | 62 | /* HPI_DEBUG_LOG(DEBUG, " %x,%lx\n", i, |
60 | asihpi_pci_tbl[i].driver_data); | 63 | asihpi_pci_tbl[i].driver_data); */ |
61 | return (hpi_handler_func *) asihpi_pci_tbl[i].driver_data; | 64 | return (hpi_handler_func *) asihpi_pci_tbl[i].driver_data; |
62 | } | 65 | } |
63 | 66 | ||
@@ -67,21 +70,12 @@ static hpi_handler_func *hpi_lookup_entry_point_function(const struct hpi_pci | |||
67 | static inline void hw_entry_point(struct hpi_message *phm, | 70 | static inline void hw_entry_point(struct hpi_message *phm, |
68 | struct hpi_response *phr) | 71 | struct hpi_response *phr) |
69 | { | 72 | { |
70 | 73 | if ((phm->adapter_index < HPI_MAX_ADAPTERS) | |
71 | hpi_handler_func *ep; | 74 | && hpi_entry_points[phm->adapter_index]) |
72 | 75 | hpi_entry_points[phm->adapter_index] (phm, phr); | |
73 | if (phm->adapter_index < HPI_MAX_ADAPTERS) { | 76 | else |
74 | ep = (hpi_handler_func *) hpi_entry_points[phm-> | 77 | hpi_init_response(phr, phm->object, phm->function, |
75 | adapter_index]; | 78 | HPI_ERROR_PROCESSING_MESSAGE); |
76 | if (ep) { | ||
77 | HPI_DEBUG_MESSAGE(DEBUG, phm); | ||
78 | ep(phm, phr); | ||
79 | HPI_DEBUG_RESPONSE(phr); | ||
80 | return; | ||
81 | } | ||
82 | } | ||
83 | hpi_init_response(phr, phm->object, phm->function, | ||
84 | HPI_ERROR_PROCESSING_MESSAGE); | ||
85 | } | 79 | } |
86 | 80 | ||
87 | static void adapter_open(struct hpi_message *phm, struct hpi_response *phr); | 81 | static void adapter_open(struct hpi_message *phm, struct hpi_response *phr); |
@@ -100,6 +94,7 @@ static void instream_close(struct hpi_message *phm, struct hpi_response *phr, | |||
100 | void *h_owner); | 94 | void *h_owner); |
101 | 95 | ||
102 | static void HPIMSGX__reset(u16 adapter_index); | 96 | static void HPIMSGX__reset(u16 adapter_index); |
97 | |||
103 | static u16 HPIMSGX__init(struct hpi_message *phm, struct hpi_response *phr); | 98 | static u16 HPIMSGX__init(struct hpi_message *phm, struct hpi_response *phr); |
104 | static void HPIMSGX__cleanup(u16 adapter_index, void *h_owner); | 99 | static void HPIMSGX__cleanup(u16 adapter_index, void *h_owner); |
105 | 100 | ||
@@ -153,8 +148,6 @@ static struct hpi_stream_response | |||
153 | 148 | ||
154 | static struct hpi_mixer_response rESP_HPI_MIXER_OPEN[HPI_MAX_ADAPTERS]; | 149 | static struct hpi_mixer_response rESP_HPI_MIXER_OPEN[HPI_MAX_ADAPTERS]; |
155 | 150 | ||
156 | static struct hpi_subsys_response gRESP_HPI_SUBSYS_FIND_ADAPTERS; | ||
157 | |||
158 | static struct adapter_info aDAPTER_INFO[HPI_MAX_ADAPTERS]; | 151 | static struct adapter_info aDAPTER_INFO[HPI_MAX_ADAPTERS]; |
159 | 152 | ||
160 | /* use these to keep track of opens from user mode apps/DLLs */ | 153 | /* use these to keep track of opens from user mode apps/DLLs */ |
@@ -167,6 +160,11 @@ static struct asi_open_state | |||
167 | static void subsys_message(struct hpi_message *phm, struct hpi_response *phr, | 160 | static void subsys_message(struct hpi_message *phm, struct hpi_response *phr, |
168 | void *h_owner) | 161 | void *h_owner) |
169 | { | 162 | { |
163 | if (phm->adapter_index != HPI_ADAPTER_INDEX_INVALID) | ||
164 | HPI_DEBUG_LOG(WARNING, | ||
165 | "suspicious adapter index %d in subsys message 0x%x.\n", | ||
166 | phm->adapter_index, phm->function); | ||
167 | |||
170 | switch (phm->function) { | 168 | switch (phm->function) { |
171 | case HPI_SUBSYS_GET_VERSION: | 169 | case HPI_SUBSYS_GET_VERSION: |
172 | hpi_init_response(phr, HPI_OBJ_SUBSYSTEM, | 170 | hpi_init_response(phr, HPI_OBJ_SUBSYSTEM, |
@@ -204,85 +202,37 @@ static void subsys_message(struct hpi_message *phm, struct hpi_response *phr, | |||
204 | HPI_SUBSYS_DRIVER_UNLOAD, 0); | 202 | HPI_SUBSYS_DRIVER_UNLOAD, 0); |
205 | return; | 203 | return; |
206 | 204 | ||
207 | case HPI_SUBSYS_GET_INFO: | ||
208 | HPI_COMMON(phm, phr); | ||
209 | break; | ||
210 | |||
211 | case HPI_SUBSYS_FIND_ADAPTERS: | ||
212 | memcpy(phr, &gRESP_HPI_SUBSYS_FIND_ADAPTERS, | ||
213 | sizeof(gRESP_HPI_SUBSYS_FIND_ADAPTERS)); | ||
214 | break; | ||
215 | case HPI_SUBSYS_GET_NUM_ADAPTERS: | 205 | case HPI_SUBSYS_GET_NUM_ADAPTERS: |
216 | memcpy(phr, &gRESP_HPI_SUBSYS_FIND_ADAPTERS, | ||
217 | sizeof(gRESP_HPI_SUBSYS_FIND_ADAPTERS)); | ||
218 | phr->function = HPI_SUBSYS_GET_NUM_ADAPTERS; | ||
219 | break; | ||
220 | case HPI_SUBSYS_GET_ADAPTER: | 206 | case HPI_SUBSYS_GET_ADAPTER: |
221 | { | 207 | HPI_COMMON(phm, phr); |
222 | int count = phm->adapter_index; | 208 | break; |
223 | int index = 0; | ||
224 | hpi_init_response(phr, HPI_OBJ_SUBSYSTEM, | ||
225 | HPI_SUBSYS_GET_ADAPTER, 0); | ||
226 | |||
227 | /* This is complicated by the fact that we want to | ||
228 | * "skip" 0's in the adapter list. | ||
229 | * First, make sure we are pointing to a | ||
230 | * non-zero adapter type. | ||
231 | */ | ||
232 | while (gRESP_HPI_SUBSYS_FIND_ADAPTERS. | ||
233 | s.aw_adapter_list[index] == 0) { | ||
234 | index++; | ||
235 | if (index >= HPI_MAX_ADAPTERS) | ||
236 | break; | ||
237 | } | ||
238 | while (count) { | ||
239 | /* move on to the next adapter */ | ||
240 | index++; | ||
241 | if (index >= HPI_MAX_ADAPTERS) | ||
242 | break; | ||
243 | while (gRESP_HPI_SUBSYS_FIND_ADAPTERS. | ||
244 | s.aw_adapter_list[index] == 0) { | ||
245 | index++; | ||
246 | if (index >= HPI_MAX_ADAPTERS) | ||
247 | break; | ||
248 | } | ||
249 | count--; | ||
250 | } | ||
251 | 209 | ||
252 | if (index < HPI_MAX_ADAPTERS) { | ||
253 | phr->u.s.adapter_index = (u16)index; | ||
254 | phr->u.s.aw_adapter_list[0] = | ||
255 | gRESP_HPI_SUBSYS_FIND_ADAPTERS. | ||
256 | s.aw_adapter_list[index]; | ||
257 | } else { | ||
258 | phr->u.s.adapter_index = 0; | ||
259 | phr->u.s.aw_adapter_list[0] = 0; | ||
260 | phr->error = HPI_ERROR_BAD_ADAPTER_NUMBER; | ||
261 | } | ||
262 | break; | ||
263 | } | ||
264 | case HPI_SUBSYS_CREATE_ADAPTER: | 210 | case HPI_SUBSYS_CREATE_ADAPTER: |
265 | HPIMSGX__init(phm, phr); | 211 | HPIMSGX__init(phm, phr); |
266 | break; | 212 | break; |
213 | |||
267 | case HPI_SUBSYS_DELETE_ADAPTER: | 214 | case HPI_SUBSYS_DELETE_ADAPTER: |
268 | HPIMSGX__cleanup(phm->adapter_index, h_owner); | 215 | HPIMSGX__cleanup(phm->obj_index, h_owner); |
269 | { | 216 | { |
270 | struct hpi_message hm; | 217 | struct hpi_message hm; |
271 | struct hpi_response hr; | 218 | struct hpi_response hr; |
272 | /* call to HPI_ADAPTER_CLOSE */ | ||
273 | hpi_init_message_response(&hm, &hr, HPI_OBJ_ADAPTER, | 219 | hpi_init_message_response(&hm, &hr, HPI_OBJ_ADAPTER, |
274 | HPI_ADAPTER_CLOSE); | 220 | HPI_ADAPTER_CLOSE); |
275 | hm.adapter_index = phm->adapter_index; | 221 | hm.adapter_index = phm->obj_index; |
276 | hw_entry_point(&hm, &hr); | 222 | hw_entry_point(&hm, &hr); |
277 | } | 223 | } |
278 | hw_entry_point(phm, phr); | 224 | if ((phm->obj_index < HPI_MAX_ADAPTERS) |
279 | gRESP_HPI_SUBSYS_FIND_ADAPTERS.s. | 225 | && hpi_entry_points[phm->obj_index]) { |
280 | aw_adapter_list[phm->adapter_index] | 226 | hpi_entry_points[phm->obj_index] (phm, phr); |
281 | = 0; | 227 | hpi_entry_points[phm->obj_index] = NULL; |
282 | hpi_entry_points[phm->adapter_index] = NULL; | 228 | } else |
229 | phr->error = HPI_ERROR_INVALID_OBJ_INDEX; | ||
230 | |||
283 | break; | 231 | break; |
284 | default: | 232 | default: |
285 | hw_entry_point(phm, phr); | 233 | /* Must explicitly handle every subsys message in this switch */ |
234 | hpi_init_response(phr, HPI_OBJ_SUBSYSTEM, phm->function, | ||
235 | HPI_ERROR_INVALID_FUNC); | ||
286 | break; | 236 | break; |
287 | } | 237 | } |
288 | } | 238 | } |
@@ -409,33 +359,7 @@ void hpi_send_recv_ex(struct hpi_message *phm, struct hpi_response *phr, | |||
409 | break; | 359 | break; |
410 | } | 360 | } |
411 | HPI_DEBUG_RESPONSE(phr); | 361 | HPI_DEBUG_RESPONSE(phr); |
412 | #if 1 | 362 | |
413 | if (phr->error >= HPI_ERROR_BACKEND_BASE) { | ||
414 | void *ep = NULL; | ||
415 | char *ep_name; | ||
416 | |||
417 | HPI_DEBUG_MESSAGE(ERROR, phm); | ||
418 | |||
419 | if (phm->adapter_index < HPI_MAX_ADAPTERS) | ||
420 | ep = hpi_entry_points[phm->adapter_index]; | ||
421 | |||
422 | /* Don't need this? Have adapter index in debug info | ||
423 | Know at driver load time index->backend mapping */ | ||
424 | if (ep == HPI_6000) | ||
425 | ep_name = "HPI_6000"; | ||
426 | else if (ep == HPI_6205) | ||
427 | ep_name = "HPI_6205"; | ||
428 | else | ||
429 | ep_name = "unknown"; | ||
430 | |||
431 | HPI_DEBUG_LOG(ERROR, "HPI %s response - error# %d\n", ep_name, | ||
432 | phr->error); | ||
433 | |||
434 | if (hpi_debug_level >= HPI_DEBUG_LEVEL_VERBOSE) | ||
435 | hpi_debug_data((u16 *)phm, | ||
436 | sizeof(*phm) / sizeof(u16)); | ||
437 | } | ||
438 | #endif | ||
439 | } | 363 | } |
440 | 364 | ||
441 | static void adapter_open(struct hpi_message *phm, struct hpi_response *phr) | 365 | static void adapter_open(struct hpi_message *phm, struct hpi_response *phr) |
@@ -484,7 +408,7 @@ static void instream_open(struct hpi_message *phm, struct hpi_response *phr, | |||
484 | else { | 408 | else { |
485 | instream_user_open[phm->adapter_index][phm-> | 409 | instream_user_open[phm->adapter_index][phm-> |
486 | obj_index].open_flag = 1; | 410 | obj_index].open_flag = 1; |
487 | hpios_msgxlock_un_lock(&msgx_lock); | 411 | hpios_msgxlock_unlock(&msgx_lock); |
488 | 412 | ||
489 | /* issue a reset */ | 413 | /* issue a reset */ |
490 | hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM, | 414 | hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM, |
@@ -509,7 +433,7 @@ static void instream_open(struct hpi_message *phm, struct hpi_response *phr, | |||
509 | sizeof(rESP_HPI_ISTREAM_OPEN[0][0])); | 433 | sizeof(rESP_HPI_ISTREAM_OPEN[0][0])); |
510 | } | 434 | } |
511 | } | 435 | } |
512 | hpios_msgxlock_un_lock(&msgx_lock); | 436 | hpios_msgxlock_unlock(&msgx_lock); |
513 | } | 437 | } |
514 | 438 | ||
515 | static void instream_close(struct hpi_message *phm, struct hpi_response *phr, | 439 | static void instream_close(struct hpi_message *phm, struct hpi_response *phr, |
@@ -530,7 +454,7 @@ static void instream_close(struct hpi_message *phm, struct hpi_response *phr, | |||
530 | phm->wAdapterIndex, phm->wObjIndex, hOwner); */ | 454 | phm->wAdapterIndex, phm->wObjIndex, hOwner); */ |
531 | instream_user_open[phm->adapter_index][phm-> | 455 | instream_user_open[phm->adapter_index][phm-> |
532 | obj_index].h_owner = NULL; | 456 | obj_index].h_owner = NULL; |
533 | hpios_msgxlock_un_lock(&msgx_lock); | 457 | hpios_msgxlock_unlock(&msgx_lock); |
534 | /* issue a reset */ | 458 | /* issue a reset */ |
535 | hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM, | 459 | hpi_init_message_response(&hm, &hr, HPI_OBJ_ISTREAM, |
536 | HPI_ISTREAM_RESET); | 460 | HPI_ISTREAM_RESET); |
@@ -556,7 +480,7 @@ static void instream_close(struct hpi_message *phm, struct hpi_response *phr, | |||
556 | obj_index].h_owner); | 480 | obj_index].h_owner); |
557 | phr->error = HPI_ERROR_OBJ_NOT_OPEN; | 481 | phr->error = HPI_ERROR_OBJ_NOT_OPEN; |
558 | } | 482 | } |
559 | hpios_msgxlock_un_lock(&msgx_lock); | 483 | hpios_msgxlock_unlock(&msgx_lock); |
560 | } | 484 | } |
561 | 485 | ||
562 | static void outstream_open(struct hpi_message *phm, struct hpi_response *phr, | 486 | static void outstream_open(struct hpi_message *phm, struct hpi_response *phr, |
@@ -581,7 +505,7 @@ static void outstream_open(struct hpi_message *phm, struct hpi_response *phr, | |||
581 | else { | 505 | else { |
582 | outstream_user_open[phm->adapter_index][phm-> | 506 | outstream_user_open[phm->adapter_index][phm-> |
583 | obj_index].open_flag = 1; | 507 | obj_index].open_flag = 1; |
584 | hpios_msgxlock_un_lock(&msgx_lock); | 508 | hpios_msgxlock_unlock(&msgx_lock); |
585 | 509 | ||
586 | /* issue a reset */ | 510 | /* issue a reset */ |
587 | hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM, | 511 | hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM, |
@@ -606,7 +530,7 @@ static void outstream_open(struct hpi_message *phm, struct hpi_response *phr, | |||
606 | sizeof(rESP_HPI_OSTREAM_OPEN[0][0])); | 530 | sizeof(rESP_HPI_OSTREAM_OPEN[0][0])); |
607 | } | 531 | } |
608 | } | 532 | } |
609 | hpios_msgxlock_un_lock(&msgx_lock); | 533 | hpios_msgxlock_unlock(&msgx_lock); |
610 | } | 534 | } |
611 | 535 | ||
612 | static void outstream_close(struct hpi_message *phm, struct hpi_response *phr, | 536 | static void outstream_close(struct hpi_message *phm, struct hpi_response *phr, |
@@ -628,7 +552,7 @@ static void outstream_close(struct hpi_message *phm, struct hpi_response *phr, | |||
628 | phm->wAdapterIndex, phm->wObjIndex, hOwner); */ | 552 | phm->wAdapterIndex, phm->wObjIndex, hOwner); */ |
629 | outstream_user_open[phm->adapter_index][phm-> | 553 | outstream_user_open[phm->adapter_index][phm-> |
630 | obj_index].h_owner = NULL; | 554 | obj_index].h_owner = NULL; |
631 | hpios_msgxlock_un_lock(&msgx_lock); | 555 | hpios_msgxlock_unlock(&msgx_lock); |
632 | /* issue a reset */ | 556 | /* issue a reset */ |
633 | hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM, | 557 | hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM, |
634 | HPI_OSTREAM_RESET); | 558 | HPI_OSTREAM_RESET); |
@@ -654,7 +578,7 @@ static void outstream_close(struct hpi_message *phm, struct hpi_response *phr, | |||
654 | obj_index].h_owner); | 578 | obj_index].h_owner); |
655 | phr->error = HPI_ERROR_OBJ_NOT_OPEN; | 579 | phr->error = HPI_ERROR_OBJ_NOT_OPEN; |
656 | } | 580 | } |
657 | hpios_msgxlock_un_lock(&msgx_lock); | 581 | hpios_msgxlock_unlock(&msgx_lock); |
658 | } | 582 | } |
659 | 583 | ||
660 | static u16 adapter_prepare(u16 adapter) | 584 | static u16 adapter_prepare(u16 adapter) |
@@ -683,16 +607,9 @@ static u16 adapter_prepare(u16 adapter) | |||
683 | if (hr.error) | 607 | if (hr.error) |
684 | return hr.error; | 608 | return hr.error; |
685 | 609 | ||
686 | aDAPTER_INFO[adapter].num_outstreams = hr.u.a.num_outstreams; | 610 | aDAPTER_INFO[adapter].num_outstreams = hr.u.ax.info.num_outstreams; |
687 | aDAPTER_INFO[adapter].num_instreams = hr.u.a.num_instreams; | 611 | aDAPTER_INFO[adapter].num_instreams = hr.u.ax.info.num_instreams; |
688 | aDAPTER_INFO[adapter].type = hr.u.a.adapter_type; | 612 | aDAPTER_INFO[adapter].type = hr.u.ax.info.adapter_type; |
689 | |||
690 | gRESP_HPI_SUBSYS_FIND_ADAPTERS.s.aw_adapter_list[adapter] = | ||
691 | hr.u.a.adapter_type; | ||
692 | gRESP_HPI_SUBSYS_FIND_ADAPTERS.s.num_adapters++; | ||
693 | if (gRESP_HPI_SUBSYS_FIND_ADAPTERS.s.num_adapters > HPI_MAX_ADAPTERS) | ||
694 | gRESP_HPI_SUBSYS_FIND_ADAPTERS.s.num_adapters = | ||
695 | HPI_MAX_ADAPTERS; | ||
696 | 613 | ||
697 | /* call to HPI_OSTREAM_OPEN */ | 614 | /* call to HPI_OSTREAM_OPEN */ |
698 | for (i = 0; i < aDAPTER_INFO[adapter].num_outstreams; i++) { | 615 | for (i = 0; i < aDAPTER_INFO[adapter].num_outstreams; i++) { |
@@ -727,7 +644,7 @@ static u16 adapter_prepare(u16 adapter) | |||
727 | memcpy(&rESP_HPI_MIXER_OPEN[adapter], &hr, | 644 | memcpy(&rESP_HPI_MIXER_OPEN[adapter], &hr, |
728 | sizeof(rESP_HPI_MIXER_OPEN[0])); | 645 | sizeof(rESP_HPI_MIXER_OPEN[0])); |
729 | 646 | ||
730 | return gRESP_HPI_SUBSYS_FIND_ADAPTERS.h.error; | 647 | return 0; |
731 | } | 648 | } |
732 | 649 | ||
733 | static void HPIMSGX__reset(u16 adapter_index) | 650 | static void HPIMSGX__reset(u16 adapter_index) |
@@ -737,12 +654,6 @@ static void HPIMSGX__reset(u16 adapter_index) | |||
737 | struct hpi_response hr; | 654 | struct hpi_response hr; |
738 | 655 | ||
739 | if (adapter_index == HPIMSGX_ALLADAPTERS) { | 656 | if (adapter_index == HPIMSGX_ALLADAPTERS) { |
740 | /* reset all responses to contain errors */ | ||
741 | hpi_init_response(&hr, HPI_OBJ_SUBSYSTEM, | ||
742 | HPI_SUBSYS_FIND_ADAPTERS, 0); | ||
743 | memcpy(&gRESP_HPI_SUBSYS_FIND_ADAPTERS, &hr, | ||
744 | sizeof(gRESP_HPI_SUBSYS_FIND_ADAPTERS)); | ||
745 | |||
746 | for (adapter = 0; adapter < HPI_MAX_ADAPTERS; adapter++) { | 657 | for (adapter = 0; adapter < HPI_MAX_ADAPTERS; adapter++) { |
747 | 658 | ||
748 | hpi_init_response(&hr, HPI_OBJ_ADAPTER, | 659 | hpi_init_response(&hr, HPI_OBJ_ADAPTER, |
@@ -783,12 +694,6 @@ static void HPIMSGX__reset(u16 adapter_index) | |||
783 | rESP_HPI_ISTREAM_OPEN[adapter_index][i].h.error = | 694 | rESP_HPI_ISTREAM_OPEN[adapter_index][i].h.error = |
784 | HPI_ERROR_INVALID_OBJ; | 695 | HPI_ERROR_INVALID_OBJ; |
785 | } | 696 | } |
786 | if (gRESP_HPI_SUBSYS_FIND_ADAPTERS. | ||
787 | s.aw_adapter_list[adapter_index]) { | ||
788 | gRESP_HPI_SUBSYS_FIND_ADAPTERS. | ||
789 | s.aw_adapter_list[adapter_index] = 0; | ||
790 | gRESP_HPI_SUBSYS_FIND_ADAPTERS.s.num_adapters--; | ||
791 | } | ||
792 | } | 697 | } |
793 | } | 698 | } |
794 | 699 | ||
@@ -802,15 +707,9 @@ static u16 HPIMSGX__init(struct hpi_message *phm, | |||
802 | hpi_handler_func *entry_point_func; | 707 | hpi_handler_func *entry_point_func; |
803 | struct hpi_response hr; | 708 | struct hpi_response hr; |
804 | 709 | ||
805 | if (gRESP_HPI_SUBSYS_FIND_ADAPTERS.s.num_adapters >= HPI_MAX_ADAPTERS) | ||
806 | return HPI_ERROR_BAD_ADAPTER_NUMBER; | ||
807 | |||
808 | /* Init response here so we can pass in previous adapter list */ | 710 | /* Init response here so we can pass in previous adapter list */ |
809 | hpi_init_response(&hr, phm->object, phm->function, | 711 | hpi_init_response(&hr, phm->object, phm->function, |
810 | HPI_ERROR_INVALID_OBJ); | 712 | HPI_ERROR_INVALID_OBJ); |
811 | memcpy(hr.u.s.aw_adapter_list, | ||
812 | gRESP_HPI_SUBSYS_FIND_ADAPTERS.s.aw_adapter_list, | ||
813 | sizeof(gRESP_HPI_SUBSYS_FIND_ADAPTERS.s.aw_adapter_list)); | ||
814 | 713 | ||
815 | entry_point_func = | 714 | entry_point_func = |
816 | hpi_lookup_entry_point_function(phm->u.s.resource.r.pci); | 715 | hpi_lookup_entry_point_function(phm->u.s.resource.r.pci); |
@@ -860,7 +759,7 @@ static void HPIMSGX__cleanup(u16 adapter_index, void *h_owner) | |||
860 | struct hpi_response hr; | 759 | struct hpi_response hr; |
861 | 760 | ||
862 | HPI_DEBUG_LOG(DEBUG, | 761 | HPI_DEBUG_LOG(DEBUG, |
863 | "close adapter %d ostream %d\n", | 762 | "Close adapter %d ostream %d\n", |
864 | adapter, i); | 763 | adapter, i); |
865 | 764 | ||
866 | hpi_init_message_response(&hm, &hr, | 765 | hpi_init_message_response(&hm, &hr, |
@@ -884,7 +783,7 @@ static void HPIMSGX__cleanup(u16 adapter_index, void *h_owner) | |||
884 | struct hpi_response hr; | 783 | struct hpi_response hr; |
885 | 784 | ||
886 | HPI_DEBUG_LOG(DEBUG, | 785 | HPI_DEBUG_LOG(DEBUG, |
887 | "close adapter %d istream %d\n", | 786 | "Close adapter %d istream %d\n", |
888 | adapter, i); | 787 | adapter, i); |
889 | 788 | ||
890 | hpi_init_message_response(&hm, &hr, | 789 | hpi_init_message_response(&hm, &hr, |