H A D | qlge_mpi.c | 126 static int ql_get_mb_sts(struct ql_adapter *qdev, struct mbox_params *mbcp) ql_get_mb_sts() argument 133 for (i = 0; i < mbcp->out_count; i++) { ql_get_mb_sts() 136 &mbcp->mbox_out[i]); ql_get_mb_sts() 166 static int ql_exec_mb_cmd(struct ql_adapter *qdev, struct mbox_params *mbcp) ql_exec_mb_cmd() argument 184 for (i = 0; i < mbcp->in_count; i++) { ql_exec_mb_cmd() 186 mbcp->mbox_in[i]); ql_exec_mb_cmd() 209 struct mbox_params *mbcp = &qdev->idc_mbc; ql_idc_req_aen() local 215 mbcp = &qdev->idc_mbc; ql_idc_req_aen() 216 mbcp->out_count = 4; ql_idc_req_aen() 217 status = ql_get_mb_sts(qdev, mbcp); ql_idc_req_aen() 239 struct mbox_params *mbcp = &qdev->idc_mbc; ql_idc_cmplt_aen() local 240 mbcp->out_count = 4; ql_idc_cmplt_aen() 241 status = ql_get_mb_sts(qdev, mbcp); ql_idc_cmplt_aen() 255 static void ql_link_up(struct ql_adapter *qdev, struct mbox_params *mbcp) ql_link_up() argument 258 mbcp->out_count = 2; ql_link_up() 260 status = ql_get_mb_sts(qdev, mbcp); ql_link_up() 267 qdev->link_status = mbcp->mbox_out[1]; ql_link_up() 302 static void ql_link_down(struct ql_adapter *qdev, struct mbox_params *mbcp) ql_link_down() argument 306 mbcp->out_count = 3; ql_link_down() 308 status = ql_get_mb_sts(qdev, mbcp); ql_link_down() 315 static int ql_sfp_in(struct ql_adapter *qdev, struct mbox_params *mbcp) ql_sfp_in() argument 319 mbcp->out_count = 5; ql_sfp_in() 321 status = ql_get_mb_sts(qdev, mbcp); ql_sfp_in() 330 static int ql_sfp_out(struct ql_adapter *qdev, struct mbox_params *mbcp) ql_sfp_out() argument 334 mbcp->out_count = 1; ql_sfp_out() 336 status = ql_get_mb_sts(qdev, mbcp); ql_sfp_out() 345 static int ql_aen_lost(struct ql_adapter *qdev, struct mbox_params *mbcp) ql_aen_lost() argument 349 mbcp->out_count = 6; ql_aen_lost() 351 status = ql_get_mb_sts(qdev, mbcp); ql_aen_lost() 357 for (i = 0; i < mbcp->out_count; i++) ql_aen_lost() 359 i, mbcp->mbox_out[i]); ql_aen_lost() 366 static void ql_init_fw_done(struct ql_adapter *qdev, struct mbox_params *mbcp) ql_init_fw_done() argument 370 mbcp->out_count = 2; ql_init_fw_done() 372 status = ql_get_mb_sts(qdev, mbcp); ql_init_fw_done() 377 mbcp->mbox_out[1]); ql_init_fw_done() 378 qdev->fw_rev_id = mbcp->mbox_out[1]; ql_init_fw_done() 392 static int ql_mpi_handler(struct ql_adapter *qdev, struct mbox_params *mbcp) ql_mpi_handler() argument 395 int orig_count = mbcp->out_count; ql_mpi_handler() 398 mbcp->out_count = 1; ql_mpi_handler() 399 status = ql_get_mb_sts(qdev, mbcp); ql_mpi_handler() 407 switch (mbcp->mbox_out[0]) { ql_mpi_handler() 426 mbcp->out_count = orig_count; ql_mpi_handler() 427 status = ql_get_mb_sts(qdev, mbcp); ql_mpi_handler() 450 ql_link_up(qdev, mbcp); ql_mpi_handler() 454 ql_link_down(qdev, mbcp); ql_mpi_handler() 461 if (mbcp->mbox_in[0] == MB_CMD_EX_FW) { ql_mpi_handler() 462 mbcp->out_count = orig_count; ql_mpi_handler() 463 status = ql_get_mb_sts(qdev, mbcp); ql_mpi_handler() 464 mbcp->mbox_out[0] = MB_CMD_STS_GOOD; ql_mpi_handler() 467 ql_init_fw_done(qdev, mbcp); ql_mpi_handler() 471 ql_sfp_in(qdev, mbcp); ql_mpi_handler() 475 ql_sfp_out(qdev, mbcp); ql_mpi_handler() 485 if (mbcp->mbox_in[0] == MB_CMD_EX_FW) { ql_mpi_handler() 486 mbcp->out_count = orig_count; ql_mpi_handler() 487 status = ql_get_mb_sts(qdev, mbcp); ql_mpi_handler() 488 mbcp->mbox_out[0] = MB_CMD_STS_ERR; ql_mpi_handler() 504 ql_aen_lost(qdev, mbcp); ql_mpi_handler() 512 "Unsupported AE %.08x.\n", mbcp->mbox_out[0]); ql_mpi_handler() 523 mbcp->out_count = orig_count; ql_mpi_handler() 528 * mbcp is a pointer to an array of u32. Each 532 static int ql_mailbox_command(struct ql_adapter *qdev, struct mbox_params *mbcp) ql_mailbox_command() argument 543 status = ql_exec_mb_cmd(qdev, mbcp); ql_mailbox_command() 551 if (mbcp->mbox_in[0] == MB_CMD_MAKE_SYS_ERR) ql_mailbox_command() 571 status = ql_mpi_handler(qdev, mbcp); ql_mailbox_command() 579 if (((mbcp->mbox_out[0] & 0x0000f000) == ql_mailbox_command() 581 ((mbcp->mbox_out[0] & 0x0000f000) == ql_mailbox_command() 598 if (((mbcp->mbox_out[0] & 0x0000f000) != ql_mailbox_command() 600 ((mbcp->mbox_out[0] & 0x0000f000) != ql_mailbox_command() 618 struct mbox_params *mbcp = &mbc; ql_mb_about_fw() local 621 memset(mbcp, 0, sizeof(struct mbox_params)); ql_mb_about_fw() 623 mbcp->in_count = 1; ql_mb_about_fw() 624 mbcp->out_count = 3; ql_mb_about_fw() 626 mbcp->mbox_in[0] = MB_CMD_ABOUT_FW; ql_mb_about_fw() 628 status = ql_mailbox_command(qdev, mbcp); ql_mb_about_fw() 632 if (mbcp->mbox_out[0] != MB_CMD_STS_GOOD) { ql_mb_about_fw() 639 qdev->fw_rev_id = mbcp->mbox_out[1]; ql_mb_about_fw() 650 struct mbox_params *mbcp = &mbc; ql_mb_get_fw_state() local 653 memset(mbcp, 0, sizeof(struct mbox_params)); ql_mb_get_fw_state() 655 mbcp->in_count = 1; ql_mb_get_fw_state() 656 mbcp->out_count = 2; ql_mb_get_fw_state() 658 mbcp->mbox_in[0] = MB_CMD_GET_FW_STATE; ql_mb_get_fw_state() 660 status = ql_mailbox_command(qdev, mbcp); ql_mb_get_fw_state() 664 if (mbcp->mbox_out[0] != MB_CMD_STS_GOOD) { ql_mb_get_fw_state() 674 if (mbcp->mbox_out[1] & 1) { ql_mb_get_fw_state() 689 struct mbox_params *mbcp = &mbc; ql_mb_idc_ack() local 692 memset(mbcp, 0, sizeof(struct mbox_params)); ql_mb_idc_ack() 694 mbcp->in_count = 5; ql_mb_idc_ack() 695 mbcp->out_count = 1; ql_mb_idc_ack() 697 mbcp->mbox_in[0] = MB_CMD_IDC_ACK; ql_mb_idc_ack() 698 mbcp->mbox_in[1] = qdev->idc_mbc.mbox_out[1]; ql_mb_idc_ack() 699 mbcp->mbox_in[2] = qdev->idc_mbc.mbox_out[2]; ql_mb_idc_ack() 700 mbcp->mbox_in[3] = qdev->idc_mbc.mbox_out[3]; ql_mb_idc_ack() 701 mbcp->mbox_in[4] = qdev->idc_mbc.mbox_out[4]; ql_mb_idc_ack() 703 status = ql_mailbox_command(qdev, mbcp); ql_mb_idc_ack() 707 if (mbcp->mbox_out[0] != MB_CMD_STS_GOOD) { ql_mb_idc_ack() 721 struct mbox_params *mbcp = &mbc; ql_mb_set_port_cfg() local 724 memset(mbcp, 0, sizeof(struct mbox_params)); ql_mb_set_port_cfg() 726 mbcp->in_count = 3; ql_mb_set_port_cfg() 727 mbcp->out_count = 1; ql_mb_set_port_cfg() 729 mbcp->mbox_in[0] = MB_CMD_SET_PORT_CFG; ql_mb_set_port_cfg() 730 mbcp->mbox_in[1] = qdev->link_config; ql_mb_set_port_cfg() 731 mbcp->mbox_in[2] = qdev->max_frame_size; ql_mb_set_port_cfg() 734 status = ql_mailbox_command(qdev, mbcp); ql_mb_set_port_cfg() 738 if (mbcp->mbox_out[0] == MB_CMD_STS_INTRMDT) { ql_mb_set_port_cfg() 741 } else if (mbcp->mbox_out[0] != MB_CMD_STS_GOOD) { ql_mb_set_port_cfg() 754 struct mbox_params *mbcp = &mbc; ql_mb_dump_ram() local 756 memset(mbcp, 0, sizeof(struct mbox_params)); ql_mb_dump_ram() 758 mbcp->in_count = 9; ql_mb_dump_ram() 759 mbcp->out_count = 1; ql_mb_dump_ram() 761 mbcp->mbox_in[0] = MB_CMD_DUMP_RISC_RAM; ql_mb_dump_ram() 762 mbcp->mbox_in[1] = LSW(addr); ql_mb_dump_ram() 763 mbcp->mbox_in[2] = MSW(req_dma); ql_mb_dump_ram() 764 mbcp->mbox_in[3] = LSW(req_dma); ql_mb_dump_ram() 765 mbcp->mbox_in[4] = MSW(size); ql_mb_dump_ram() 766 mbcp->mbox_in[5] = LSW(size); ql_mb_dump_ram() 767 mbcp->mbox_in[6] = MSW(MSD(req_dma)); ql_mb_dump_ram() 768 mbcp->mbox_in[7] = LSW(MSD(req_dma)); ql_mb_dump_ram() 769 mbcp->mbox_in[8] = MSW(addr); ql_mb_dump_ram() 772 status = ql_mailbox_command(qdev, mbcp); ql_mb_dump_ram() 776 if (mbcp->mbox_out[0] != MB_CMD_STS_GOOD) { ql_mb_dump_ram() 812 struct mbox_params *mbcp = &mbc; ql_mb_get_port_cfg() local 815 memset(mbcp, 0, sizeof(struct mbox_params)); ql_mb_get_port_cfg() 817 mbcp->in_count = 1; ql_mb_get_port_cfg() 818 mbcp->out_count = 3; ql_mb_get_port_cfg() 820 mbcp->mbox_in[0] = MB_CMD_GET_PORT_CFG; ql_mb_get_port_cfg() 822 status = ql_mailbox_command(qdev, mbcp); ql_mb_get_port_cfg() 826 if (mbcp->mbox_out[0] != MB_CMD_STS_GOOD) { ql_mb_get_port_cfg() 833 qdev->link_config = mbcp->mbox_out[1]; ql_mb_get_port_cfg() 834 qdev->max_frame_size = mbcp->mbox_out[2]; ql_mb_get_port_cfg() 842 struct mbox_params *mbcp = &mbc; ql_mb_wol_mode() local 845 memset(mbcp, 0, sizeof(struct mbox_params)); ql_mb_wol_mode() 847 mbcp->in_count = 2; ql_mb_wol_mode() 848 mbcp->out_count = 1; ql_mb_wol_mode() 850 mbcp->mbox_in[0] = MB_CMD_SET_WOL_MODE; ql_mb_wol_mode() 851 mbcp->mbox_in[1] = wol; ql_mb_wol_mode() 854 status = ql_mailbox_command(qdev, mbcp); ql_mb_wol_mode() 858 if (mbcp->mbox_out[0] != MB_CMD_STS_GOOD) { ql_mb_wol_mode() 868 struct mbox_params *mbcp = &mbc; ql_mb_wol_set_magic() local 872 memset(mbcp, 0, sizeof(struct mbox_params)); ql_mb_wol_set_magic() 874 mbcp->in_count = 8; ql_mb_wol_set_magic() 875 mbcp->out_count = 1; ql_mb_wol_set_magic() 877 mbcp->mbox_in[0] = MB_CMD_SET_WOL_MAGIC; ql_mb_wol_set_magic() 879 mbcp->mbox_in[1] = (u32)addr[0]; ql_mb_wol_set_magic() 880 mbcp->mbox_in[2] = (u32)addr[1]; ql_mb_wol_set_magic() 881 mbcp->mbox_in[3] = (u32)addr[2]; ql_mb_wol_set_magic() 882 mbcp->mbox_in[4] = (u32)addr[3]; ql_mb_wol_set_magic() 883 mbcp->mbox_in[5] = (u32)addr[4]; ql_mb_wol_set_magic() 884 mbcp->mbox_in[6] = (u32)addr[5]; ql_mb_wol_set_magic() 885 mbcp->mbox_in[7] = 0; ql_mb_wol_set_magic() 887 mbcp->mbox_in[1] = 0; ql_mb_wol_set_magic() 888 mbcp->mbox_in[2] = 1; ql_mb_wol_set_magic() 889 mbcp->mbox_in[3] = 1; ql_mb_wol_set_magic() 890 mbcp->mbox_in[4] = 1; ql_mb_wol_set_magic() 891 mbcp->mbox_in[5] = 1; ql_mb_wol_set_magic() 892 mbcp->mbox_in[6] = 1; ql_mb_wol_set_magic() 893 mbcp->mbox_in[7] = 0; ql_mb_wol_set_magic() 896 status = ql_mailbox_command(qdev, mbcp); ql_mb_wol_set_magic() 900 if (mbcp->mbox_out[0] != MB_CMD_STS_GOOD) { ql_mb_wol_set_magic() 918 struct mbox_params *mbcp = &qdev->idc_mbc; ql_idc_wait() local 934 if (mbcp->mbox_out[0] == AEN_IDC_EXT) { ql_idc_wait() 937 wait_time += (mbcp->mbox_out[1] >> 8) & 0x0000000f; ql_idc_wait() 938 } else if (mbcp->mbox_out[0] == AEN_IDC_CMPLT) { ql_idc_wait() 945 mbcp->mbox_out[0]); ql_idc_wait() 957 struct mbox_params *mbcp = &mbc; ql_mb_set_led_cfg() local 960 memset(mbcp, 0, sizeof(struct mbox_params)); ql_mb_set_led_cfg() 962 mbcp->in_count = 2; ql_mb_set_led_cfg() 963 mbcp->out_count = 1; ql_mb_set_led_cfg() 965 mbcp->mbox_in[0] = MB_CMD_SET_LED_CFG; ql_mb_set_led_cfg() 966 mbcp->mbox_in[1] = led_config; ql_mb_set_led_cfg() 969 status = ql_mailbox_command(qdev, mbcp); ql_mb_set_led_cfg() 973 if (mbcp->mbox_out[0] != MB_CMD_STS_GOOD) { ql_mb_set_led_cfg() 985 struct mbox_params *mbcp = &mbc; ql_mb_get_led_cfg() local 988 memset(mbcp, 0, sizeof(struct mbox_params)); ql_mb_get_led_cfg() 990 mbcp->in_count = 1; ql_mb_get_led_cfg() 991 mbcp->out_count = 2; ql_mb_get_led_cfg() 993 mbcp->mbox_in[0] = MB_CMD_GET_LED_CFG; ql_mb_get_led_cfg() 995 status = ql_mailbox_command(qdev, mbcp); ql_mb_get_led_cfg() 999 if (mbcp->mbox_out[0] != MB_CMD_STS_GOOD) { ql_mb_get_led_cfg() 1004 qdev->led_config = mbcp->mbox_out[1]; ql_mb_get_led_cfg() 1012 struct mbox_params *mbcp = &mbc; ql_mb_set_mgmnt_traffic_ctl() local 1015 memset(mbcp, 0, sizeof(struct mbox_params)); ql_mb_set_mgmnt_traffic_ctl() 1017 mbcp->in_count = 1; ql_mb_set_mgmnt_traffic_ctl() 1018 mbcp->out_count = 2; ql_mb_set_mgmnt_traffic_ctl() 1020 mbcp->mbox_in[0] = MB_CMD_SET_MGMNT_TFK_CTL; ql_mb_set_mgmnt_traffic_ctl() 1021 mbcp->mbox_in[1] = control; ql_mb_set_mgmnt_traffic_ctl() 1023 status = ql_mailbox_command(qdev, mbcp); ql_mb_set_mgmnt_traffic_ctl() 1027 if (mbcp->mbox_out[0] == MB_CMD_STS_GOOD) ql_mb_set_mgmnt_traffic_ctl() 1030 if (mbcp->mbox_out[0] == MB_CMD_STS_INVLD_CMD) { ql_mb_set_mgmnt_traffic_ctl() 1034 } else if (mbcp->mbox_out[0] == MB_CMD_STS_ERR) { ql_mb_set_mgmnt_traffic_ctl() 1049 struct mbox_params *mbcp = &mbc; ql_mb_get_mgmnt_traffic_ctl() local 1052 memset(mbcp, 0, sizeof(struct mbox_params)); ql_mb_get_mgmnt_traffic_ctl() 1055 mbcp->in_count = 1; ql_mb_get_mgmnt_traffic_ctl() 1056 mbcp->out_count = 1; ql_mb_get_mgmnt_traffic_ctl() 1058 mbcp->mbox_in[0] = MB_CMD_GET_MGMNT_TFK_CTL; ql_mb_get_mgmnt_traffic_ctl() 1060 status = ql_mailbox_command(qdev, mbcp); ql_mb_get_mgmnt_traffic_ctl() 1064 if (mbcp->mbox_out[0] == MB_CMD_STS_GOOD) { ql_mb_get_mgmnt_traffic_ctl() 1065 *control = mbcp->mbox_in[1]; ql_mb_get_mgmnt_traffic_ctl() 1069 if (mbcp->mbox_out[0] == MB_CMD_STS_INVLD_CMD) { ql_mb_get_mgmnt_traffic_ctl() 1073 } else if (mbcp->mbox_out[0] == MB_CMD_STS_ERR) { ql_mb_get_mgmnt_traffic_ctl() 1164 struct mbox_params *mbcp = &qdev->idc_mbc; ql_mpi_idc_work() local 1168 aen = mbcp->mbox_out[1] >> 16; ql_mpi_idc_work() 1169 timeout = (mbcp->mbox_out[1] >> 8) & 0xf; ql_mpi_idc_work() 1238 struct mbox_params *mbcp = &mbc; ql_mpi_work() local 1246 memset(mbcp, 0, sizeof(struct mbox_params)); ql_mpi_work() 1247 mbcp->out_count = 1; ql_mpi_work() 1251 err = ql_mpi_handler(qdev, mbcp); ql_mpi_work()
|