aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/tidspbridge/pmgr/dspapi.c50
1 files changed, 29 insertions, 21 deletions
diff --git a/drivers/staging/tidspbridge/pmgr/dspapi.c b/drivers/staging/tidspbridge/pmgr/dspapi.c
index f46aaf683e3..d7613eb49da 100644
--- a/drivers/staging/tidspbridge/pmgr/dspapi.c
+++ b/drivers/staging/tidspbridge/pmgr/dspapi.c
@@ -616,6 +616,7 @@ u32 procwrap_ctrl(union trapped_args *args, void *pr_ctxt)
616 args->args_proc_ctrl.pargs; 616 args->args_proc_ctrl.pargs;
617 u8 *pargs = NULL; 617 u8 *pargs = NULL;
618 int status = 0; 618 int status = 0;
619 void *hprocessor = ((struct process_context *)pr_ctxt)->hprocessor;
619 620
620 if (psize) { 621 if (psize) {
621 if (get_user(cb_data_size, psize)) { 622 if (get_user(cb_data_size, psize)) {
@@ -633,7 +634,7 @@ u32 procwrap_ctrl(union trapped_args *args, void *pr_ctxt)
633 cb_data_size); 634 cb_data_size);
634 } 635 }
635 if (!status) { 636 if (!status) {
636 status = proc_ctrl(args->args_proc_ctrl.hprocessor, 637 status = proc_ctrl(hprocessor,
637 args->args_proc_ctrl.dw_cmd, 638 args->args_proc_ctrl.dw_cmd,
638 (struct dsp_cbdata *)pargs); 639 (struct dsp_cbdata *)pargs);
639 } 640 }
@@ -663,11 +664,12 @@ u32 procwrap_enum_node_info(union trapped_args *args, void *pr_ctxt)
663 void *node_tab[MAX_NODES]; 664 void *node_tab[MAX_NODES];
664 u32 num_nodes; 665 u32 num_nodes;
665 u32 alloc_cnt; 666 u32 alloc_cnt;
667 void *hprocessor = ((struct process_context *)pr_ctxt)->hprocessor;
666 668
667 if (!args->args_proc_enumnode_info.node_tab_size) 669 if (!args->args_proc_enumnode_info.node_tab_size)
668 return -EINVAL; 670 return -EINVAL;
669 671
670 status = proc_enum_nodes(args->args_proc_enumnode_info.hprocessor, 672 status = proc_enum_nodes(hprocessor,
671 node_tab, 673 node_tab,
672 args->args_proc_enumnode_info.node_tab_size, 674 args->args_proc_enumnode_info.node_tab_size,
673 &num_nodes, &alloc_cnt); 675 &num_nodes, &alloc_cnt);
@@ -747,13 +749,14 @@ u32 procwrap_enum_resources(union trapped_args *args, void *pr_ctxt)
747{ 749{
748 int status = 0; 750 int status = 0;
749 struct dsp_resourceinfo resource_info; 751 struct dsp_resourceinfo resource_info;
752 void *hprocessor = ((struct process_context *)pr_ctxt)->hprocessor;
750 753
751 if (args->args_proc_enumresources.resource_info_size < 754 if (args->args_proc_enumresources.resource_info_size <
752 sizeof(struct dsp_resourceinfo)) 755 sizeof(struct dsp_resourceinfo))
753 return -EINVAL; 756 return -EINVAL;
754 757
755 status = 758 status =
756 proc_get_resource_info(args->args_proc_enumresources.hprocessor, 759 proc_get_resource_info(hprocessor,
757 args->args_proc_enumresources.resource_type, 760 args->args_proc_enumresources.resource_type,
758 &resource_info, 761 &resource_info,
759 args->args_proc_enumresources. 762 args->args_proc_enumresources.
@@ -773,13 +776,13 @@ u32 procwrap_get_state(union trapped_args *args, void *pr_ctxt)
773{ 776{
774 int status; 777 int status;
775 struct dsp_processorstate proc_state; 778 struct dsp_processorstate proc_state;
779 void *hprocessor = ((struct process_context *)pr_ctxt)->hprocessor;
776 780
777 if (args->args_proc_getstate.state_info_size < 781 if (args->args_proc_getstate.state_info_size <
778 sizeof(struct dsp_processorstate)) 782 sizeof(struct dsp_processorstate))
779 return -EINVAL; 783 return -EINVAL;
780 784
781 status = 785 status = proc_get_state(hprocessor, &proc_state,
782 proc_get_state(args->args_proc_getstate.hprocessor, &proc_state,
783 args->args_proc_getstate.state_info_size); 786 args->args_proc_getstate.state_info_size);
784 CP_TO_USR(args->args_proc_getstate.proc_state_obj, &proc_state, status, 787 CP_TO_USR(args->args_proc_getstate.proc_state_obj, &proc_state, status,
785 1); 788 1);
@@ -794,14 +797,14 @@ u32 procwrap_get_trace(union trapped_args *args, void *pr_ctxt)
794{ 797{
795 int status; 798 int status;
796 u8 *pbuf; 799 u8 *pbuf;
800 void *hprocessor = ((struct process_context *)pr_ctxt)->hprocessor;
797 801
798 if (args->args_proc_gettrace.max_size > MAX_TRACEBUFLEN) 802 if (args->args_proc_gettrace.max_size > MAX_TRACEBUFLEN)
799 return -EINVAL; 803 return -EINVAL;
800 804
801 pbuf = kzalloc(args->args_proc_gettrace.max_size, GFP_KERNEL); 805 pbuf = kzalloc(args->args_proc_gettrace.max_size, GFP_KERNEL);
802 if (pbuf != NULL) { 806 if (pbuf != NULL) {
803 status = proc_get_trace(args->args_proc_gettrace.hprocessor, 807 status = proc_get_trace(hprocessor, pbuf,
804 pbuf,
805 args->args_proc_gettrace.max_size); 808 args->args_proc_gettrace.max_size);
806 } else { 809 } else {
807 status = -ENOMEM; 810 status = -ENOMEM;
@@ -823,6 +826,7 @@ u32 procwrap_load(union trapped_args *args, void *pr_ctxt)
823 char *temp; 826 char *temp;
824 s32 count = args->args_proc_load.argc_index; 827 s32 count = args->args_proc_load.argc_index;
825 u8 **argv = NULL, **envp = NULL; 828 u8 **argv = NULL, **envp = NULL;
829 void *hprocessor = ((struct process_context *)pr_ctxt)->hprocessor;
826 830
827 if (count <= 0 || count > MAX_LOADARGS) { 831 if (count <= 0 || count > MAX_LOADARGS) {
828 status = -EINVAL; 832 status = -EINVAL;
@@ -905,7 +909,7 @@ u32 procwrap_load(union trapped_args *args, void *pr_ctxt)
905 } 909 }
906 910
907 if (!status) { 911 if (!status) {
908 status = proc_load(args->args_proc_load.hprocessor, 912 status = proc_load(hprocessor,
909 args->args_proc_load.argc_index, 913 args->args_proc_load.argc_index,
910 (const char **)argv, (const char **)envp); 914 (const char **)argv, (const char **)envp);
911 } 915 }
@@ -936,6 +940,7 @@ u32 procwrap_map(union trapped_args *args, void *pr_ctxt)
936{ 940{
937 int status; 941 int status;
938 void *map_addr; 942 void *map_addr;
943 void *hprocessor = ((struct process_context *)pr_ctxt)->hprocessor;
939 944
940 if (!args->args_proc_mapmem.ul_size) 945 if (!args->args_proc_mapmem.ul_size)
941 return -EINVAL; 946 return -EINVAL;
@@ -948,8 +953,7 @@ u32 procwrap_map(union trapped_args *args, void *pr_ctxt)
948 if (!status) { 953 if (!status) {
949 if (put_user(map_addr, args->args_proc_mapmem.pp_map_addr)) { 954 if (put_user(map_addr, args->args_proc_mapmem.pp_map_addr)) {
950 status = -EINVAL; 955 status = -EINVAL;
951 proc_un_map(args->args_proc_mapmem.hprocessor, 956 proc_un_map(hprocessor, map_addr, pr_ctxt);
952 map_addr, pr_ctxt);
953 } 957 }
954 958
955 } 959 }
@@ -963,13 +967,13 @@ u32 procwrap_register_notify(union trapped_args *args, void *pr_ctxt)
963{ 967{
964 int status; 968 int status;
965 struct dsp_notification notification; 969 struct dsp_notification notification;
970 void *hprocessor = ((struct process_context *)pr_ctxt)->hprocessor;
966 971
967 /* Initialize the notification data structure */ 972 /* Initialize the notification data structure */
968 notification.ps_name = NULL; 973 notification.ps_name = NULL;
969 notification.handle = NULL; 974 notification.handle = NULL;
970 975
971 status = 976 status = proc_register_notify(hprocessor,
972 proc_register_notify(args->args_proc_register_notify.hprocessor,
973 args->args_proc_register_notify.event_mask, 977 args->args_proc_register_notify.event_mask,
974 args->args_proc_register_notify.notify_type, 978 args->args_proc_register_notify.notify_type,
975 &notification); 979 &notification);
@@ -985,12 +989,13 @@ u32 procwrap_reserve_memory(union trapped_args *args, void *pr_ctxt)
985{ 989{
986 int status; 990 int status;
987 void *prsv_addr; 991 void *prsv_addr;
992 void *hprocessor = ((struct process_context *)pr_ctxt)->hprocessor;
988 993
989 if ((args->args_proc_rsvmem.ul_size <= 0) || 994 if ((args->args_proc_rsvmem.ul_size <= 0) ||
990 (args->args_proc_rsvmem.ul_size & (PG_SIZE4K - 1)) != 0) 995 (args->args_proc_rsvmem.ul_size & (PG_SIZE4K - 1)) != 0)
991 return -EINVAL; 996 return -EINVAL;
992 997
993 status = proc_reserve_memory(args->args_proc_rsvmem.hprocessor, 998 status = proc_reserve_memory(hprocessor,
994 args->args_proc_rsvmem.ul_size, &prsv_addr, 999 args->args_proc_rsvmem.ul_size, &prsv_addr,
995 pr_ctxt); 1000 pr_ctxt);
996 if (!status) { 1001 if (!status) {
@@ -1010,7 +1015,7 @@ u32 procwrap_start(union trapped_args *args, void *pr_ctxt)
1010{ 1015{
1011 u32 ret; 1016 u32 ret;
1012 1017
1013 ret = proc_start(args->args_proc_start.hprocessor); 1018 ret = proc_start(((struct process_context *)pr_ctxt)->hprocessor);
1014 return ret; 1019 return ret;
1015} 1020}
1016 1021
@@ -1021,7 +1026,7 @@ u32 procwrap_un_map(union trapped_args *args, void *pr_ctxt)
1021{ 1026{
1022 int status; 1027 int status;
1023 1028
1024 status = proc_un_map(args->args_proc_unmapmem.hprocessor, 1029 status = proc_un_map(((struct process_context *)pr_ctxt)->hprocessor,
1025 args->args_proc_unmapmem.map_addr, pr_ctxt); 1030 args->args_proc_unmapmem.map_addr, pr_ctxt);
1026 return status; 1031 return status;
1027} 1032}
@@ -1032,8 +1037,9 @@ u32 procwrap_un_map(union trapped_args *args, void *pr_ctxt)
1032u32 procwrap_un_reserve_memory(union trapped_args *args, void *pr_ctxt) 1037u32 procwrap_un_reserve_memory(union trapped_args *args, void *pr_ctxt)
1033{ 1038{
1034 int status; 1039 int status;
1040 void *hprocessor = ((struct process_context *)pr_ctxt)->hprocessor;
1035 1041
1036 status = proc_un_reserve_memory(args->args_proc_unrsvmem.hprocessor, 1042 status = proc_un_reserve_memory(hprocessor,
1037 args->args_proc_unrsvmem.prsv_addr, 1043 args->args_proc_unrsvmem.prsv_addr,
1038 pr_ctxt); 1044 pr_ctxt);
1039 return status; 1045 return status;
@@ -1046,7 +1052,7 @@ u32 procwrap_stop(union trapped_args *args, void *pr_ctxt)
1046{ 1052{
1047 u32 ret; 1053 u32 ret;
1048 1054
1049 ret = proc_stop(args->args_proc_stop.hprocessor); 1055 ret = proc_stop(((struct process_context *)pr_ctxt)->hprocessor);
1050 1056
1051 return ret; 1057 return ret;
1052} 1058}
@@ -1078,6 +1084,7 @@ u32 nodewrap_allocate(union trapped_args *args, void *pr_ctxt)
1078 struct dsp_nodeattrin proc_attr_in, *attr_in = NULL; 1084 struct dsp_nodeattrin proc_attr_in, *attr_in = NULL;
1079 struct node_res_object *node_res; 1085 struct node_res_object *node_res;
1080 int nodeid; 1086 int nodeid;
1087 void *hprocessor = ((struct process_context *)pr_ctxt)->hprocessor;
1081 1088
1082 /* Optional argument */ 1089 /* Optional argument */
1083 if (psize) { 1090 if (psize) {
@@ -1108,7 +1115,7 @@ u32 nodewrap_allocate(union trapped_args *args, void *pr_ctxt)
1108 1115
1109 } 1116 }
1110 if (!status) { 1117 if (!status) {
1111 status = node_allocate(args->args_node_allocate.hprocessor, 1118 status = node_allocate(hprocessor,
1112 &node_uuid, (struct dsp_cbdata *)pargs, 1119 &node_uuid, (struct dsp_cbdata *)pargs,
1113 attr_in, &node_res, pr_ctxt); 1120 attr_in, &node_res, pr_ctxt);
1114 } 1121 }
@@ -1493,6 +1500,7 @@ u32 nodewrap_get_uuid_props(union trapped_args *args, void *pr_ctxt)
1493 int status = 0; 1500 int status = 0;
1494 struct dsp_uuid node_uuid; 1501 struct dsp_uuid node_uuid;
1495 struct dsp_ndbprops *pnode_props = NULL; 1502 struct dsp_ndbprops *pnode_props = NULL;
1503 void *hprocessor = ((struct process_context *)pr_ctxt)->hprocessor;
1496 1504
1497 CP_FM_USR(&node_uuid, args->args_node_getuuidprops.node_id_ptr, status, 1505 CP_FM_USR(&node_uuid, args->args_node_getuuidprops.node_id_ptr, status,
1498 1); 1506 1);
@@ -1501,8 +1509,7 @@ u32 nodewrap_get_uuid_props(union trapped_args *args, void *pr_ctxt)
1501 pnode_props = kmalloc(sizeof(struct dsp_ndbprops), GFP_KERNEL); 1509 pnode_props = kmalloc(sizeof(struct dsp_ndbprops), GFP_KERNEL);
1502 if (pnode_props != NULL) { 1510 if (pnode_props != NULL) {
1503 status = 1511 status =
1504 node_get_uuid_props(args->args_node_getuuidprops.hprocessor, 1512 node_get_uuid_props(hprocessor, &node_uuid, pnode_props);
1505 &node_uuid, pnode_props);
1506 CP_TO_USR(args->args_node_getuuidprops.node_props, pnode_props, 1513 CP_TO_USR(args->args_node_getuuidprops.node_props, pnode_props,
1507 status, 1); 1514 status, 1);
1508 } else 1515 } else
@@ -1788,8 +1795,9 @@ u32 cmmwrap_get_handle(union trapped_args *args, void *pr_ctxt)
1788{ 1795{
1789 int status = 0; 1796 int status = 0;
1790 struct cmm_object *hcmm_mgr; 1797 struct cmm_object *hcmm_mgr;
1798 void *hprocessor = ((struct process_context *)pr_ctxt)->hprocessor;
1791 1799
1792 status = cmm_get_handle(args->args_cmm_gethandle.hprocessor, &hcmm_mgr); 1800 status = cmm_get_handle(hprocessor, &hcmm_mgr);
1793 1801
1794 CP_TO_USR(args->args_cmm_gethandle.ph_cmm_mgr, &hcmm_mgr, status, 1); 1802 CP_TO_USR(args->args_cmm_gethandle.ph_cmm_mgr, &hcmm_mgr, status, 1);
1795 1803