23 #define SOURCEFILE_NAME "hpimsgx.c"
45 for (i = 0; asihpi_pci_tbl[
i].
vendor != 0; i++) {
47 && asihpi_pci_tbl[i].
vendor !=
51 && asihpi_pci_tbl[i].
device !=
56 pci_info->
pci_dev->subsystem_vendor)
60 pci_info->
pci_dev->subsystem_device)
71 static inline void hw_entry_point(
struct hpi_message *phm,
97 static void HPIMSGX__reset(
u16 adapter_index);
100 static void HPIMSGX__cleanup(
u16 adapter_index,
void *h_owner);
102 #ifndef DISABLE_PRAGMA_PACK1
103 #pragma pack(push, 1)
137 #ifndef DISABLE_PRAGMA_PACK1
166 "suspicious adapter index %d in subsys message 0x%x.\n",
189 memset(&hpi_entry_points, 0,
sizeof(hpi_entry_points));
210 HPIMSGX__init(phm, phr);
226 adapter_open(phm, phr);
229 adapter_close(phm, phr);
239 hw_entry_point(&hm, &hr);
241 hw_entry_point(phm, phr);
245 hw_entry_point(phm, phr);
254 mixer_open(phm, phr);
257 mixer_close(phm, phr);
260 hw_entry_point(phm, phr);
265 static void outstream_message(
struct hpi_message *phm,
276 outstream_open(phm, phr, h_owner);
279 outstream_close(phm, phr, h_owner);
282 hw_entry_point(phm, phr);
287 static void instream_message(
struct hpi_message *phm,
298 instream_open(phm, phr, h_owner);
301 instream_close(phm, phr, h_owner);
304 hw_entry_point(phm, phr);
332 subsys_message(phm, phr, h_owner);
336 adapter_message(phm, phr, h_owner);
340 mixer_message(phm, phr);
344 outstream_message(phm, phr, h_owner);
348 instream_message(phm, phr, h_owner);
352 hw_entry_point(phm, phr);
363 sizeof(rESP_HPI_ADAPTER_OPEN[0]));
375 sizeof(rESP_HPI_MIXER_OPEN[0]));
401 sizeof(rESP_HPI_ISTREAM_OPEN[0][0]));
404 obj_index].open_flag = 1;
412 hw_entry_point(&hm, &hr);
417 obj_index].open_flag = 0;
418 phr->
error = hr.error;
421 obj_index].open_flag = 1;
423 obj_index].h_owner = h_owner;
427 sizeof(rESP_HPI_ISTREAM_OPEN[0][0]));
445 obj_index].h_owner) {
450 obj_index].h_owner =
NULL;
457 hw_entry_point(&hm, &hr);
461 obj_index].h_owner = h_owner;
462 phr->
error = hr.error;
465 obj_index].open_flag = 0;
467 obj_index].h_owner =
NULL;
471 "%p trying to close %d instream %d owned by %p\n",
498 sizeof(rESP_HPI_OSTREAM_OPEN[0][0]));
501 obj_index].open_flag = 1;
509 hw_entry_point(&hm, &hr);
514 obj_index].open_flag = 0;
515 phr->
error = hr.error;
518 obj_index].open_flag = 1;
520 obj_index].h_owner = h_owner;
524 sizeof(rESP_HPI_OSTREAM_OPEN[0][0]));
543 obj_index].h_owner) {
548 obj_index].h_owner =
NULL;
555 hw_entry_point(&hm, &hr);
559 obj_index].h_owner = h_owner;
560 phr->
error = hr.error;
563 obj_index].open_flag = 0;
565 obj_index].h_owner =
NULL;
569 "%p trying to close %d outstream %d owned by %p\n",
590 hw_entry_point(&hm, &hr);
591 memcpy(&rESP_HPI_ADAPTER_OPEN[adapter], &hr,
592 sizeof(rESP_HPI_ADAPTER_OPEN[0]));
600 hw_entry_point(&hm, &hr);
604 aDAPTER_INFO[
adapter].num_outstreams = hr.u.ax.info.num_outstreams;
605 aDAPTER_INFO[
adapter].num_instreams = hr.u.ax.info.num_instreams;
606 aDAPTER_INFO[
adapter].type = hr.u.ax.info.adapter_type;
609 for (i = 0; i < aDAPTER_INFO[
adapter].num_outstreams; i++) {
614 hw_entry_point(&hm, &hr);
615 memcpy(&rESP_HPI_OSTREAM_OPEN[adapter][i], &hr,
616 sizeof(rESP_HPI_OSTREAM_OPEN[0][0]));
617 outstream_user_open[
adapter][
i].open_flag = 0;
622 for (i = 0; i < aDAPTER_INFO[
adapter].num_instreams; i++) {
627 hw_entry_point(&hm, &hr);
628 memcpy(&rESP_HPI_ISTREAM_OPEN[adapter][i], &hr,
629 sizeof(rESP_HPI_ISTREAM_OPEN[0][0]));
630 instream_user_open[
adapter][
i].open_flag = 0;
637 hw_entry_point(&hm, &hr);
638 memcpy(&rESP_HPI_MIXER_OPEN[adapter], &hr,
639 sizeof(rESP_HPI_MIXER_OPEN[0]));
644 static void HPIMSGX__reset(
u16 adapter_index)
655 memcpy(&rESP_HPI_ADAPTER_OPEN[adapter], &hr,
656 sizeof(rESP_HPI_ADAPTER_OPEN[adapter]));
660 memcpy(&rESP_HPI_MIXER_OPEN[adapter], &hr,
661 sizeof(rESP_HPI_MIXER_OPEN[adapter]));
667 memcpy(&rESP_HPI_OSTREAM_OPEN[adapter][i],
669 sizeof(rESP_HPI_OSTREAM_OPEN[adapter]
674 memcpy(&rESP_HPI_ISTREAM_OPEN[adapter][i],
676 sizeof(rESP_HPI_ISTREAM_OPEN[adapter]
680 }
else if (adapter_index < HPI_MAX_ADAPTERS) {
681 rESP_HPI_ADAPTER_OPEN[adapter_index].h.error =
683 rESP_HPI_MIXER_OPEN[adapter_index].h.error =
686 rESP_HPI_OSTREAM_OPEN[adapter_index][
i].h.error =
688 rESP_HPI_ISTREAM_OPEN[adapter_index][
i].h.error =
709 hpi_lookup_entry_point_function(phm->
u.
s.resource.r.pci);
711 if (entry_point_func) {
713 entry_point_func(phm, &hr);
721 hpi_entry_points[hr.u.s.adapter_index] = entry_point_func;
724 "HPI_SUBSYS_CREATE_ADAPTER successful,"
725 " preparing adapter\n");
726 adapter_prepare(hr.u.s.adapter_index);
732 static void HPIMSGX__cleanup(
u16 adapter_index,
void *h_owner)
743 adapter = adapter_index;
744 adapter_limit = adapter + 1;
747 for (; adapter < adapter_limit; adapter++) {
751 outstream_user_open[adapter][i].h_owner) {
756 "Close adapter %d ostream %d\n",
761 hm.adapter_index = (
u16)adapter;
762 hm.obj_index = (
u16)i;
763 hw_entry_point(&hm, &hr);
766 hw_entry_point(&hm, &hr);
769 hw_entry_point(&hm, &hr);
771 outstream_user_open[
adapter][
i].open_flag = 0;
772 outstream_user_open[
adapter][
i].h_owner =
775 if (h_owner == instream_user_open[adapter][i].h_owner) {
780 "Close adapter %d istream %d\n",
785 hm.adapter_index = (
u16)adapter;
786 hm.obj_index = (
u16)i;
787 hw_entry_point(&hm, &hr);
790 hw_entry_point(&hm, &hr);
793 hw_entry_point(&hm, &hr);
795 instream_user_open[
adapter][
i].open_flag = 0;