Lines Matching +full:1 +full:p

121 ipmi_firewall_parse_args(int argc, char ** argv, struct ipmi_function_params * p)  in ipmi_firewall_parse_args()  argument
126 if (!p) { in ipmi_firewall_parse_args()
127 lprintf(LOG_ERR, "ipmi_firewall_parse_args: p is NULL"); in ipmi_firewall_parse_args()
128 return -1; in ipmi_firewall_parse_args()
134 conv_err = 1; in ipmi_firewall_parse_args()
137 p->channel = channel_tmp; in ipmi_firewall_parse_args()
141 if (str2int(argv[i], &(p->lun)) != 0) { in ipmi_firewall_parse_args()
143 conv_err = 1; in ipmi_firewall_parse_args()
148 p->force = 1; in ipmi_firewall_parse_args()
151 if (str2int(argv[i], &(p->netfn)) != 0) { in ipmi_firewall_parse_args()
153 conv_err = 1; in ipmi_firewall_parse_args()
158 if (str2int(argv[i], &(p->command)) != 0) { in ipmi_firewall_parse_args()
160 conv_err = 1; in ipmi_firewall_parse_args()
165 if (str2int(argv[i], &(p->subfn)) != 0) { in ipmi_firewall_parse_args()
167 conv_err = 1; in ipmi_firewall_parse_args()
173 return (-1); in ipmi_firewall_parse_args()
175 if (p->subfn >= MAX_SUBFN) { in ipmi_firewall_parse_args()
176 lprintf(LOG_ERR, "subfn is out of range (0-%d)", MAX_SUBFN-1); in ipmi_firewall_parse_args()
177 return -1; in ipmi_firewall_parse_args()
179 if (p->command >= MAX_COMMAND) { in ipmi_firewall_parse_args()
180 lprintf(LOG_ERR, "command is out of range (0-%d)", MAX_COMMAND-1); in ipmi_firewall_parse_args()
181 return -1; in ipmi_firewall_parse_args()
183 if (p->netfn >= MAX_NETFN) { in ipmi_firewall_parse_args()
184 lprintf(LOG_ERR, "netfn is out of range (0-%d)", MAX_NETFN-1); in ipmi_firewall_parse_args()
185 return -1; in ipmi_firewall_parse_args()
187 if (p->lun >= MAX_LUN) { in ipmi_firewall_parse_args()
188 lprintf(LOG_ERR, "lun is out of range (0-%d)", MAX_LUN-1); in ipmi_firewall_parse_args()
189 return -1; in ipmi_firewall_parse_args()
191 if (p->netfn >= 0 && p->lun < 0) { in ipmi_firewall_parse_args()
193 return -1; in ipmi_firewall_parse_args()
195 if (p->command >= 0 && p->netfn < 0) { in ipmi_firewall_parse_args()
197 return -1; in ipmi_firewall_parse_args()
199 if (p->subfn >= 0 && p->command < 0) { in ipmi_firewall_parse_args()
201 return -1; in ipmi_firewall_parse_args()
215 * returns -1 on error
227 return -1; in _get_netfn_support()
235 req.msg.data_len = 1; in _get_netfn_support()
240 return -1; in _get_netfn_support()
245 return -1; in _get_netfn_support()
262 * @p: a pointer to a struct ipmi_function_params
265 * returns 0 on success and fills in lnfn according to the request in p
266 * returns -1 on error
270 struct ipmi_function_params * p, struct lun_netfn_support * lnfn) in _get_command_support() argument
277 if (!p || !lnfn) { in _get_command_support()
278 lprintf(LOG_ERR, "_get_netfn_suport: p or lnfn is NULL"); in _get_command_support()
279 return -1; in _get_command_support()
285 rqdata[0] = (unsigned char) p->channel; in _get_command_support()
286 rqdata[1] = p->netfn; in _get_command_support()
287 rqdata[2] = p->lun; in _get_command_support()
293 lprintf(LOG_ERR, "Get Command Support (LUN=%d, NetFn=%d, op=0) command failed", p->lun, p->netfn); in _get_command_support()
294 return -1; in _get_command_support()
298 p->lun, p->netfn, val2str(rsp->ccode, completion_code_vals)); in _get_command_support()
299 return -1; in _get_command_support()
304 if (!(d[c>>3] & (1<<(c%8)))) in _get_command_support()
312 rqdata[0] = (unsigned char) p->channel; in _get_command_support()
313 rqdata[1] = 0x40 | p->netfn; in _get_command_support()
314 rqdata[2] = p->lun; in _get_command_support()
320 lprintf(LOG_ERR, "Get Command Support (LUN=%d, NetFn=%d, op=1) command failed", p->lun, p->netfn); in _get_command_support()
321 return -1; in _get_command_support()
324 lprintf(LOG_ERR, "Get Command Support (LUN=%d, NetFn=%d, op=1) command failed: %s", in _get_command_support()
325 p->lun, p->netfn, val2str(rsp->ccode, completion_code_vals)); in _get_command_support()
326 return -1; in _get_command_support()
331 if (!(d[c>>3] & (1<<(c%8)))) in _get_command_support()
341 * @p: a pointer to a struct ipmi_function_params
344 * returns 0 on success and fills in lnfn according to the request in p
345 * returns -1 on error
349 struct ipmi_function_params * p, struct lun_netfn_support * lnfn) in _get_command_configurable() argument
356 if (!p || !lnfn) { in _get_command_configurable()
357 lprintf(LOG_ERR, "_get_command_configurable: p or lnfn is NULL"); in _get_command_configurable()
358 return -1; in _get_command_configurable()
364 rqdata[0] = (unsigned char) p->channel; in _get_command_configurable()
365 rqdata[1] = p->netfn; in _get_command_configurable()
366 rqdata[2] = p->lun; in _get_command_configurable()
372 …lprintf(LOG_ERR, "Get Configurable Command (LUN=%d, NetFn=%d, op=0) command failed", p->lun, p->ne… in _get_command_configurable()
373 return -1; in _get_command_configurable()
377 p->lun, p->netfn, val2str(rsp->ccode, completion_code_vals)); in _get_command_configurable()
378 return -1; in _get_command_configurable()
383 if (d[c>>3] & (1<<(c%8))) in _get_command_configurable()
391 rqdata[0] = (unsigned char) p->channel; in _get_command_configurable()
392 rqdata[1] = 0x40 | p->netfn; in _get_command_configurable()
393 rqdata[2] = p->lun; in _get_command_configurable()
399 …lprintf(LOG_ERR, "Get Configurable Command (LUN=%d, NetFn=%d, op=1) command failed", p->lun, p->ne… in _get_command_configurable()
400 return -1; in _get_command_configurable()
403 lprintf(LOG_ERR, "Get Configurable Command (LUN=%d, NetFn=%d, op=1) command failed: %s", in _get_command_configurable()
404 p->lun, p->netfn, val2str(rsp->ccode, completion_code_vals)); in _get_command_configurable()
405 return -1; in _get_command_configurable()
410 if (d[c>>3] & (1<<(c%8))) in _get_command_configurable()
420 * @p: a pointer to a struct ipmi_function_params
423 * returns 0 on success and fills in lnfn according to the request in p
424 * returns -1 on error
428 struct ipmi_function_params * p, struct lun_netfn_support * lnfn) in _get_command_enables() argument
435 if (!p || !lnfn) { in _get_command_enables()
436 lprintf(LOG_ERR, "_get_command_enables: p or lnfn is NULL"); in _get_command_enables()
437 return -1; in _get_command_enables()
443 rqdata[0] = (unsigned char) p->channel; in _get_command_enables()
444 rqdata[1] = p->netfn; in _get_command_enables()
445 rqdata[2] = p->lun; in _get_command_enables()
451 lprintf(LOG_ERR, "Get Command Enables (LUN=%d, NetFn=%d, op=0) command failed", p->lun, p->netfn); in _get_command_enables()
452 return -1; in _get_command_enables()
456 p->lun, p->netfn, val2str(rsp->ccode, completion_code_vals)); in _get_command_enables()
457 return -1; in _get_command_enables()
462 if (d[c>>3] & (1<<(c%8))) in _get_command_enables()
470 rqdata[0] = (unsigned char) p->channel; in _get_command_enables()
471 rqdata[1] = 0x40 | p->netfn; in _get_command_enables()
472 rqdata[2] = p->lun; in _get_command_enables()
478 lprintf(LOG_ERR, "Get Command Enables (LUN=%d, NetFn=%d, op=1) command failed", p->lun, p->netfn); in _get_command_enables()
479 return -1; in _get_command_enables()
482 lprintf(LOG_ERR, "Get Command Enables (LUN=%d, NetFn=%d, op=1) command failed: %s", in _get_command_enables()
483 p->lun, p->netfn, val2str(rsp->ccode, completion_code_vals)); in _get_command_enables()
484 return -1; in _get_command_enables()
489 if (d[c>>3] & (1<<(c%8))) in _get_command_enables()
499 * @p: a pointer to a struct ipmi_function_params
506 * returns -1 on error
510 struct ipmi_function_params * p, struct lun_netfn_support * lnfn, in _set_command_enables() argument
518 if (!p || !lnfn) { in _set_command_enables()
519 lprintf(LOG_ERR, "_set_command_enables: p or lnfn is NULL"); in _set_command_enables()
520 return -1; in _set_command_enables()
524 print_bitfield(lnfn->command_mask, MAX_COMMAND_BYTES, 1, LOG_INFO); in _set_command_enables()
553 rqdata[0] = (unsigned char) p->channel; in _set_command_enables()
554 rqdata[1] = p->netfn; in _set_command_enables()
555 rqdata[2] = p->lun; in _set_command_enables()
562 lprintf(LOG_ERR, "Set Command Enables (LUN=%d, NetFn=%d, op=0) command failed", p->lun, p->netfn); in _set_command_enables()
563 return -1; in _set_command_enables()
567 p->lun, p->netfn, val2str(rsp->ccode, completion_code_vals)); in _set_command_enables()
568 return -1; in _set_command_enables()
574 rqdata[0] = (unsigned char) p->channel; in _set_command_enables()
575 rqdata[1] = 0x40 | p->netfn; in _set_command_enables()
576 rqdata[2] = p->lun; in _set_command_enables()
583 lprintf(LOG_ERR, "Set Command Enables (LUN=%d, NetFn=%d, op=1) command failed", p->lun, p->netfn); in _set_command_enables()
584 return -1; in _set_command_enables()
587 lprintf(LOG_ERR, "Set Command Enables (LUN=%d, NetFn=%d, op=1) command failed: %s", in _set_command_enables()
588 p->lun, p->netfn, val2str(rsp->ccode, completion_code_vals)); in _set_command_enables()
589 return -1; in _set_command_enables()
598 * @p: a pointer to a struct ipmi_function_params
601 * returns 0 on success and fills in cmd according to the request in p
602 * returns -1 on error
606 struct ipmi_function_params * p, struct command_support * cmd) in _get_subfn_support() argument
612 if (!p || !cmd) { in _get_subfn_support()
613 lprintf(LOG_ERR, "_get_subfn_support: p or cmd is NULL"); in _get_subfn_support()
614 return -1; in _get_subfn_support()
620 rqdata[0] = (unsigned char) p->channel; in _get_subfn_support()
621 rqdata[1] = p->netfn; in _get_subfn_support()
622 rqdata[2] = p->lun; in _get_subfn_support()
623 rqdata[3] = p->command; in _get_subfn_support()
629 …Sub-function Support (LUN=%d, NetFn=%d, command=%d) command failed", p->lun, p->netfn, p->command); in _get_subfn_support()
630 return -1; in _get_subfn_support()
634 p->lun, p->netfn, p->command, val2str(rsp->ccode, completion_code_vals)); in _get_subfn_support()
635 return -1; in _get_subfn_support()
645 * @p: a pointer to a struct ipmi_function_params
648 * returns 0 on success and fills in cmd according to the request in p
649 * returns -1 on error
653 struct ipmi_function_params * p, struct command_support * cmd) in _get_subfn_configurable() argument
659 if (!p || !cmd) { in _get_subfn_configurable()
660 lprintf(LOG_ERR, "_get_subfn_configurable: p or cmd is NULL"); in _get_subfn_configurable()
661 return -1; in _get_subfn_configurable()
667 rqdata[0] = (unsigned char) p->channel; in _get_subfn_configurable()
668 rqdata[1] = p->netfn; in _get_subfn_configurable()
669 rqdata[2] = p->lun; in _get_subfn_configurable()
670 rqdata[3] = p->command; in _get_subfn_configurable()
676 …Command Sub-function (LUN=%d, NetFn=%d, command=%d) command failed", p->lun, p->netfn, p->command); in _get_subfn_configurable()
677 return -1; in _get_subfn_configurable()
681 p->lun, p->netfn, p->command, val2str(rsp->ccode, completion_code_vals)); in _get_subfn_configurable()
682 return -1; in _get_subfn_configurable()
692 * @p: a pointer to a struct ipmi_function_params
695 * returns 0 on success and fills in cmd according to the request in p
696 * returns -1 on error
700 struct ipmi_function_params * p, struct command_support * cmd) in _get_subfn_enables() argument
706 if (!p || !cmd) { in _get_subfn_enables()
707 lprintf(LOG_ERR, "_get_subfn_enables: p or cmd is NULL"); in _get_subfn_enables()
708 return -1; in _get_subfn_enables()
714 rqdata[0] = (unsigned char) p->channel; in _get_subfn_enables()
715 rqdata[1] = p->netfn; in _get_subfn_enables()
716 rqdata[2] = p->lun; in _get_subfn_enables()
717 rqdata[3] = p->command; in _get_subfn_enables()
723 …Sub-function Enables (LUN=%d, NetFn=%d, command=%d) command failed", p->lun, p->netfn, p->command); in _get_subfn_enables()
724 return -1; in _get_subfn_enables()
728 p->lun, p->netfn, p->command, val2str(rsp->ccode, completion_code_vals)); in _get_subfn_enables()
729 return -1; in _get_subfn_enables()
739 * @p: a pointer to a struct ipmi_function_params
744 * returns -1 on error
748 struct ipmi_function_params * p, struct command_support * cmd, in _set_subfn_enables() argument
756 if (!p || !cmd) { in _set_subfn_enables()
757 lprintf(LOG_ERR, "_set_subfn_enables: p or cmd is NULL"); in _set_subfn_enables()
758 return -1; in _set_subfn_enables()
762 print_bitfield(cmd->subfn_support, MAX_SUBFN_BYTES, 1, LOG_INFO); in _set_subfn_enables()
781 rqdata[0] = (unsigned char) p->channel; in _set_subfn_enables()
782 rqdata[1] = p->netfn; in _set_subfn_enables()
783 rqdata[2] = p->lun; in _set_subfn_enables()
784 rqdata[3] = p->command; in _set_subfn_enables()
791 …Sub-function Enables (LUN=%d, NetFn=%d, command=%d) command failed", p->lun, p->netfn, p->command); in _set_subfn_enables()
792 return -1; in _set_subfn_enables()
796 p->lun, p->netfn, p->command, val2str(rsp->ccode, completion_code_vals)); in _set_subfn_enables()
797 return -1; in _set_subfn_enables()
806 * @p: a pointer to a struct ipmi_function_params
810 * returns 0 on success and fills in bmc according to request p
811 * returns -1 on error
813 static int _gather_info(struct ipmi_intf * intf, struct ipmi_function_params * p, struct bmc_fn_sup… in _gather_info() argument
818 ret = _get_netfn_support(intf, p->channel, lun, netfn); in _gather_info()
821 if (p->lun >= 0 && p->lun != l) in _gather_info()
828 !!(netfn[offset>>3] & (1<<(offset%8))); in _gather_info()
833 if (p->netfn >= 0) { in _gather_info()
834 if (!((p->lun < 0 || bmc->lun[p->lun].support) && in _gather_info()
835 (p->netfn < 0 || bmc->lun[p->lun].netfn[p->netfn>>1].support))) { in _gather_info()
836 lprintf(LOG_ERR, "LUN or LUN/NetFn pair %d,%d not supported", p->lun, p->netfn); in _gather_info()
839 ret = _get_command_support(intf, p, &(bmc->lun[p->lun].netfn[p->netfn>>1])); in _gather_info()
840 ret |= _get_command_configurable(intf, p, &(bmc->lun[p->lun].netfn[p->netfn>>1])); in _gather_info()
841 ret |= _get_command_enables(intf, p, &(bmc->lun[p->lun].netfn[p->netfn>>1])); in _gather_info()
842 if (!ret && p->command >= 0) { in _gather_info()
843 ret = _get_subfn_support(intf, p, in _gather_info()
844 &(bmc->lun[p->lun].netfn[p->netfn>>1].command[p->command])); in _gather_info()
845 ret |= _get_subfn_configurable(intf, p, in _gather_info()
846 &(bmc->lun[p->lun].netfn[p->netfn>>1].command[p->command])); in _gather_info()
847 ret |= _get_subfn_enables(intf, p, in _gather_info()
848 &(bmc->lun[p->lun].netfn[p->netfn>>1].command[p->command])); in _gather_info()
851 else if (p->lun >= 0) { in _gather_info()
852 l = p->lun; in _gather_info()
855 p->netfn = n*2; in _gather_info()
857 ret = _get_command_support(intf, p, &(bmc->lun[l].netfn[n])); in _gather_info()
858 ret |= _get_command_configurable(intf, p, &(bmc->lun[l].netfn[n])); in _gather_info()
859 ret |= _get_command_enables(intf, p, &(bmc->lun[l].netfn[n])); in _gather_info()
865 p->netfn = -1; in _gather_info()
868 p->lun = l; in _gather_info()
871 p->netfn = n*2; in _gather_info()
873 ret = _get_command_support(intf, p, &(bmc->lun[l].netfn[n])); in _gather_info()
874 ret |= _get_command_configurable(intf, p, &(bmc->lun[l].netfn[n])); in _gather_info()
875 ret |= _get_command_enables(intf, p, &(bmc->lun[l].netfn[n])); in _gather_info()
882 p->lun = -1; in _gather_info()
883 p->netfn = -1; in _gather_info()
896 * returns -1 on error
902 struct ipmi_function_params p = {0xe, -1, -1, -1, -1}; in ipmi_firewall_info() local
906 if ((argc > 0 && strncmp(argv[0], "help", 4) == 0) || ipmi_firewall_parse_args(argc, argv, &p) < 0) in ipmi_firewall_info()
915 return -1; in ipmi_firewall_info()
918 ret = _gather_info(intf, &p, bmc_fn_support); in ipmi_firewall_info()
920 if (p.command >= 0) { in ipmi_firewall_info()
922 if (!((p.lun < 0 || bmc_fn_support->lun[p.lun].support) && in ipmi_firewall_info()
923 (p.netfn < 0 || bmc_fn_support->lun[p.lun].netfn[p.netfn>>1].support) && in ipmi_firewall_info()
924 bmc_fn_support->lun[p.lun].netfn[p.netfn>>1].command[p.command].support)) in ipmi_firewall_info()
927 p.command, p.lun, p.netfn); in ipmi_firewall_info()
933 &bmc_fn_support->lun[p.lun].netfn[p.netfn>>1].command[p.command]; in ipmi_firewall_info()
938 p.lun, p.netfn, p.command, in ipmi_firewall_info()
950 else if (p.netfn >= 0) { in ipmi_firewall_info()
951 if (!((p.lun < 0 || bmc_fn_support->lun[p.lun].support) && in ipmi_firewall_info()
952 (bmc_fn_support->lun[p.lun].netfn[p.netfn>>1].support))) in ipmi_firewall_info()
955 p.lun, p.netfn); in ipmi_firewall_info()
960 n = p.netfn >> 1; in ipmi_firewall_info()
961 l = p.lun; in ipmi_firewall_info()
962 printf("Commands on LUN 0x%02x, NetFn 0x%02x\n", p.lun, p.netfn); in ipmi_firewall_info()
965 MAX_COMMAND_BYTES, 1, -1); in ipmi_firewall_info()
968 MAX_COMMAND_BYTES, 0, -1); in ipmi_firewall_info()
971 MAX_COMMAND_BYTES, 0, -1); in ipmi_firewall_info()
975 p.lun = l; in ipmi_firewall_info()
978 p.netfn = n*2; in ipmi_firewall_info()
980 printf("%02x,%02x support: ", p.lun, p.netfn); in ipmi_firewall_info()
982 MAX_COMMAND_BYTES, 1, -1); in ipmi_firewall_info()
983 printf("%02x,%02x configurable: ", p.lun, p.netfn); in ipmi_firewall_info()
985 MAX_COMMAND_BYTES, 0, -1); in ipmi_firewall_info()
986 printf("%02x,%02x enabled: ", p.lun, p.netfn); in ipmi_firewall_info()
988 MAX_COMMAND_BYTES, 0, -1); in ipmi_firewall_info()
993 p.lun = -1; in ipmi_firewall_info()
994 p.netfn = -1; in ipmi_firewall_info()
1010 * returns -1 on error
1015 struct ipmi_function_params p = {0xe, -1, -1, -1, -1}; in ipmi_firewall_enable_disable() local
1021 if (argc < 1 || strncmp(argv[0], "help", 4) == 0) { in ipmi_firewall_enable_disable()
1037 if (ipmi_firewall_parse_args(argc, argv, &p) < 0) in ipmi_firewall_enable_disable()
1038 return -1; in ipmi_firewall_enable_disable()
1043 return -1; in ipmi_firewall_enable_disable()
1046 ret = _gather_info(intf, &p, bmc_fn_support); in ipmi_firewall_enable_disable()
1053 l = p.lun; in ipmi_firewall_enable_disable()
1054 n = p.netfn>>1; in ipmi_firewall_enable_disable()
1055 c = p.command; in ipmi_firewall_enable_disable()
1056 if (p.subfn >= 0) { in ipmi_firewall_enable_disable()
1062 bit_set(enables, p.subfn, enable); in ipmi_firewall_enable_disable()
1063 ret = _set_subfn_enables(intf, &p, in ipmi_firewall_enable_disable()
1066 } else if (p.command >= 0) { in ipmi_firewall_enable_disable()
1070 ret = _set_subfn_enables(intf, &p, in ipmi_firewall_enable_disable()
1074 bit_set(enables, p.command, enable); in ipmi_firewall_enable_disable()
1075 ret |= _set_command_enables(intf, &p, in ipmi_firewall_enable_disable()
1076 &bmc_fn_support->lun[l].netfn[n], enables, p.force); in ipmi_firewall_enable_disable()
1077 } else if (p.netfn >= 0) { in ipmi_firewall_enable_disable()
1081 ret = _set_command_enables(intf, &p, in ipmi_firewall_enable_disable()
1082 &bmc_fn_support->lun[l].netfn[n], enables, p.force); in ipmi_firewall_enable_disable()
1084 } else if (p.lun >= 0) { in ipmi_firewall_enable_disable()
1101 * returns -1 on error
1106 struct ipmi_function_params p = {0xe, -1, -1, -1, -1}; in ipmi_firewall_reset() local
1112 if (argc < 1) { in ipmi_firewall_reset()
1115 return (-1); in ipmi_firewall_reset()
1120 if (ipmi_firewall_parse_args(argc, argv, &p) < 0) in ipmi_firewall_reset()
1121 return -1; in ipmi_firewall_reset()
1126 return -1; in ipmi_firewall_reset()
1129 ret = _gather_info(intf, &p, bmc_fn_support); in ipmi_firewall_reset()
1137 p.lun = l; in ipmi_firewall_reset()
1139 p.netfn = n; in ipmi_firewall_reset()
1141 p.command = c; in ipmi_firewall_reset()
1144 ret = _set_subfn_enables(intf, &p, in ipmi_firewall_reset()
1149 ret = _set_command_enables(intf, &p, in ipmi_firewall_reset()
1167 * returns -1 on error
1174 if (argc < 1 || strncmp(argv[0], "help", 4) == 0) { in ipmi_firewall_main()
1178 rc = ipmi_firewall_info(intf, argc-1, &(argv[1])); in ipmi_firewall_main()
1181 rc = ipmi_firewall_enable_disable(intf, 1, argc-1, &(argv[1])); in ipmi_firewall_main()
1184 rc = ipmi_firewall_enable_disable(intf, 0, argc-1, &(argv[1])); in ipmi_firewall_main()
1187 rc = ipmi_firewall_reset(intf, argc-1, &(argv[1])); in ipmi_firewall_main()