Lines Matching +full:embedded +full:- +full:controller

2  * PMC-Sierra 8001/8081/8088/8089 SAS/SATA based host adapters driver
4 * Copyright (c) 2008-2009 USI Co., Ltd.
18 * 3. Neither the names of the above-listed copyright holders nor the names
49 * pm8001_ctl_mpi_interface_rev_show - MPI interface revision number
50 * @cdev: pointer to embedded class device
54 * A sysfs 'read-only' shost attribute.
61 struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; in pm8001_ctl_mpi_interface_rev_show()
63 if (pm8001_ha->chip_id == chip_8001) { in pm8001_ctl_mpi_interface_rev_show()
65 pm8001_ha->main_cfg_tbl.pm8001_tbl.interface_rev); in pm8001_ctl_mpi_interface_rev_show()
68 pm8001_ha->main_cfg_tbl.pm80xx_tbl.interface_rev); in pm8001_ctl_mpi_interface_rev_show()
75 * controller_fatal_error_show - check controller is under fatal err
76 * @cdev: pointer to embedded class device
80 * A sysfs 'read-only' shost attribute.
87 struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; in controller_fatal_error_show()
90 pm8001_ha->controller_fatal_error); in controller_fatal_error_show()
95 * pm8001_ctl_fw_version_show - firmware version
96 * @cdev: pointer to embedded class device
100 * A sysfs 'read-only' shost attribute.
107 struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; in pm8001_ctl_fw_version_show()
109 if (pm8001_ha->chip_id == chip_8001) { in pm8001_ctl_fw_version_show()
111 (u8)(pm8001_ha->main_cfg_tbl.pm8001_tbl.firmware_rev >> 24), in pm8001_ctl_fw_version_show()
112 (u8)(pm8001_ha->main_cfg_tbl.pm8001_tbl.firmware_rev >> 16), in pm8001_ctl_fw_version_show()
113 (u8)(pm8001_ha->main_cfg_tbl.pm8001_tbl.firmware_rev >> 8), in pm8001_ctl_fw_version_show()
114 (u8)(pm8001_ha->main_cfg_tbl.pm8001_tbl.firmware_rev)); in pm8001_ctl_fw_version_show()
117 (u8)(pm8001_ha->main_cfg_tbl.pm80xx_tbl.firmware_rev >> 24), in pm8001_ctl_fw_version_show()
118 (u8)(pm8001_ha->main_cfg_tbl.pm80xx_tbl.firmware_rev >> 16), in pm8001_ctl_fw_version_show()
119 (u8)(pm8001_ha->main_cfg_tbl.pm80xx_tbl.firmware_rev >> 8), in pm8001_ctl_fw_version_show()
120 (u8)(pm8001_ha->main_cfg_tbl.pm80xx_tbl.firmware_rev)); in pm8001_ctl_fw_version_show()
126 * pm8001_ctl_ila_version_show - ila version
127 * @cdev: pointer to embedded class device
131 * A sysfs 'read-only' shost attribute.
138 struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; in pm8001_ctl_ila_version_show()
140 if (pm8001_ha->chip_id != chip_8001) { in pm8001_ctl_ila_version_show()
142 (u8)(pm8001_ha->main_cfg_tbl.pm80xx_tbl.ila_version >> 24), in pm8001_ctl_ila_version_show()
143 (u8)(pm8001_ha->main_cfg_tbl.pm80xx_tbl.ila_version >> 16), in pm8001_ctl_ila_version_show()
144 (u8)(pm8001_ha->main_cfg_tbl.pm80xx_tbl.ila_version >> 8), in pm8001_ctl_ila_version_show()
145 (u8)(pm8001_ha->main_cfg_tbl.pm80xx_tbl.ila_version)); in pm8001_ctl_ila_version_show()
152 * pm8001_ctl_inactive_fw_version_show - Inactive firmware version number
153 * @cdev: pointer to embedded class device
157 * A sysfs 'read-only' shost attribute.
164 struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; in pm8001_ctl_inactive_fw_version_show()
166 if (pm8001_ha->chip_id != chip_8001) { in pm8001_ctl_inactive_fw_version_show()
168 (u8)(pm8001_ha->main_cfg_tbl.pm80xx_tbl.inc_fw_version >> 24), in pm8001_ctl_inactive_fw_version_show()
169 (u8)(pm8001_ha->main_cfg_tbl.pm80xx_tbl.inc_fw_version >> 16), in pm8001_ctl_inactive_fw_version_show()
170 (u8)(pm8001_ha->main_cfg_tbl.pm80xx_tbl.inc_fw_version >> 8), in pm8001_ctl_inactive_fw_version_show()
171 (u8)(pm8001_ha->main_cfg_tbl.pm80xx_tbl.inc_fw_version)); in pm8001_ctl_inactive_fw_version_show()
179 * pm8001_ctl_max_out_io_show - max outstanding io supported
180 * @cdev: pointer to embedded class device
184 * A sysfs 'read-only' shost attribute.
191 struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; in pm8001_ctl_max_out_io_show()
193 if (pm8001_ha->chip_id == chip_8001) { in pm8001_ctl_max_out_io_show()
195 pm8001_ha->main_cfg_tbl.pm8001_tbl.max_out_io); in pm8001_ctl_max_out_io_show()
198 pm8001_ha->main_cfg_tbl.pm80xx_tbl.max_out_io); in pm8001_ctl_max_out_io_show()
203 * pm8001_ctl_max_devices_show - max devices support
204 * @cdev: pointer to embedded class device
208 * A sysfs 'read-only' shost attribute.
215 struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; in pm8001_ctl_max_devices_show()
217 if (pm8001_ha->chip_id == chip_8001) { in pm8001_ctl_max_devices_show()
219 (u16)(pm8001_ha->main_cfg_tbl.pm8001_tbl.max_sgl >> 16)); in pm8001_ctl_max_devices_show()
222 (u16)(pm8001_ha->main_cfg_tbl.pm80xx_tbl.max_sgl >> 16)); in pm8001_ctl_max_devices_show()
227 * pm8001_ctl_max_sg_list_show - max sg list supported iff not 0.0 for no
229 * @cdev: pointer to embedded class device
233 * A sysfs 'read-only' shost attribute.
240 struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; in pm8001_ctl_max_sg_list_show()
242 if (pm8001_ha->chip_id == chip_8001) { in pm8001_ctl_max_sg_list_show()
244 pm8001_ha->main_cfg_tbl.pm8001_tbl.max_sgl & 0x0000FFFF); in pm8001_ctl_max_sg_list_show()
247 pm8001_ha->main_cfg_tbl.pm80xx_tbl.max_sgl & 0x0000FFFF); in pm8001_ctl_max_sg_list_show()
271 * pm8001_ctl_sas_spec_support_show - sas spec supported
272 * @cdev: pointer to embedded class device
276 * A sysfs 'read-only' shost attribute.
284 struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; in pm8001_ctl_sas_spec_support_show()
286 if (pm8001_ha->chip_id == chip_8001) in pm8001_ctl_sas_spec_support_show()
287 mode = (pm8001_ha->main_cfg_tbl.pm8001_tbl.ctrl_cap_flag & in pm8001_ctl_sas_spec_support_show()
291 mode = (pm8001_ha->main_cfg_tbl.pm80xx_tbl.ctrl_cap_flag & in pm8001_ctl_sas_spec_support_show()
299 * pm8001_ctl_host_sas_address_show - sas address
300 * @cdev: pointer to embedded class device
304 * This is the controller sas address
306 * A sysfs 'read-only' shost attribute.
313 struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; in pm8001_ctl_host_sas_address_show()
315 be64_to_cpu(*(__be64 *)pm8001_ha->sas_addr)); in pm8001_ctl_host_sas_address_show()
321 * pm8001_ctl_logging_level_show - logging level
322 * @cdev: pointer to embedded class device
333 struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; in pm8001_ctl_logging_level_show()
335 return sysfs_emit(buf, "%08xh\n", pm8001_ha->logging_level); in pm8001_ctl_logging_level_show()
343 struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; in pm8001_ctl_logging_level_store()
347 return -EINVAL; in pm8001_ctl_logging_level_store()
349 pm8001_ha->logging_level = val; in pm8001_ctl_logging_level_store()
356 * pm8001_ctl_aap_log_show - aap1 event log
357 * @cdev: pointer to embedded class device
361 * A sysfs 'read-only' shost attribute.
368 struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; in pm8001_ctl_aap_log_show()
369 u8 *ptr = (u8 *)pm8001_ha->memoryMap.region[AAP1].virt_ptr; in pm8001_ctl_aap_log_show()
387 return str - buf; in pm8001_ctl_aap_log_show()
391 * pm8001_ctl_ib_queue_log_show - Out bound Queue log
392 * @cdev:pointer to embedded class device
396 * A sysfs 'read-only' shost attribute.
403 struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; in pm8001_ctl_ib_queue_log_show()
407 u32 ib_offset = pm8001_ha->ib_offset; in pm8001_ctl_ib_queue_log_show()
408 u32 queue_size = pm8001_ha->max_q_num * PM8001_MPI_QUEUE * 128; in pm8001_ctl_ib_queue_log_show()
410 (*(u32 *)((u8 *)pm8001_ha-> \ in pm8001_ctl_ib_queue_log_show()
412 pm8001_ha->evtlog_ib_offset + (c))) in pm8001_ctl_ib_queue_log_show()
418 pm8001_ha->evtlog_ib_offset += SYSFS_OFFSET; in pm8001_ctl_ib_queue_log_show()
419 if (((pm8001_ha->evtlog_ib_offset) % queue_size) == 0) in pm8001_ctl_ib_queue_log_show()
420 pm8001_ha->evtlog_ib_offset = 0; in pm8001_ctl_ib_queue_log_show()
422 return str - buf; in pm8001_ctl_ib_queue_log_show()
427 * pm8001_ctl_ob_queue_log_show - Out bound Queue log
428 * @cdev:pointer to embedded class device
432 * A sysfs 'read-only' shost attribute.
440 struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; in pm8001_ctl_ob_queue_log_show()
444 u32 ob_offset = pm8001_ha->ob_offset; in pm8001_ctl_ob_queue_log_show()
445 u32 queue_size = pm8001_ha->max_q_num * PM8001_MPI_QUEUE * 128; in pm8001_ctl_ob_queue_log_show()
447 (*(u32 *)((u8 *)pm8001_ha-> \ in pm8001_ctl_ob_queue_log_show()
449 pm8001_ha->evtlog_ob_offset + (c))) in pm8001_ctl_ob_queue_log_show()
455 pm8001_ha->evtlog_ob_offset += SYSFS_OFFSET; in pm8001_ctl_ob_queue_log_show()
456 if (((pm8001_ha->evtlog_ob_offset) % queue_size) == 0) in pm8001_ctl_ob_queue_log_show()
457 pm8001_ha->evtlog_ob_offset = 0; in pm8001_ctl_ob_queue_log_show()
459 return str - buf; in pm8001_ctl_ob_queue_log_show()
463 * pm8001_ctl_bios_version_show - Bios version Display
464 * @cdev:pointer to embedded class device
468 * A sysfs 'read-only' shost attribute.
475 struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; in pm8001_ctl_bios_version_show()
481 pm8001_ha->nvmd_completion = &completion; in pm8001_ctl_bios_version_show()
487 return -ENOMEM; in pm8001_ctl_bios_version_show()
488 if (PM8001_CHIP_DISP->get_nvmd_req(pm8001_ha, &payload)) { in pm8001_ctl_bios_version_show()
490 return -ENOMEM; in pm8001_ctl_bios_version_show()
498 return str - buf; in pm8001_ctl_bios_version_show()
502 * event_log_size_show - event log size
503 * @cdev: pointer to embedded class device
514 struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; in event_log_size_show()
517 pm8001_ha->main_cfg_tbl.pm80xx_tbl.event_log_size); in event_log_size_show()
521 * pm8001_ctl_iop_log_show - IOP event log
522 * @cdev: pointer to embedded class device
526 * A sysfs 'read-only' shost attribute.
533 struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; in pm8001_ctl_iop_log_show()
536 pm8001_ha->main_cfg_tbl.pm80xx_tbl.event_log_size / 1024; in pm8001_ctl_iop_log_show()
540 u32 *temp = (u32 *)pm8001_ha->memoryMap.region[IOP].virt_ptr; in pm8001_ctl_iop_log_show()
554 return str - buf; in pm8001_ctl_iop_log_show()
559 * pm8001_ctl_fatal_log_show - fatal error logging
560 * @cdev:pointer to embedded class device
564 * A sysfs 'read-only' shost attribute.
579 * non_fatal_log_show - non fatal error logging
580 * @cdev:pointer to embedded class device
584 * A sysfs 'read-only' shost attribute.
601 struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; in non_fatal_count_show()
604 pm8001_ha->non_fatal_count); in non_fatal_count_show()
612 struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; in non_fatal_count_store()
616 return -EINVAL; in non_fatal_count_store()
618 pm8001_ha->non_fatal_count = val; in non_fatal_count_store()
624 * pm8001_ctl_gsm_log_show - gsm dump collection
625 * @cdev:pointer to embedded class device
629 * A sysfs 'read-only' shost attribute.
684 u32 length = 1024 * 5 + sizeof(*payload) - 1; in pm8001_set_nvmd()
686 if (pm8001_ha->fw_image->size > 4096) { in pm8001_set_nvmd()
687 pm8001_ha->fw_status = FAIL_FILE_SIZE; in pm8001_set_nvmd()
688 return -EFAULT; in pm8001_set_nvmd()
693 pm8001_ha->fw_status = FAIL_OUT_MEMORY; in pm8001_set_nvmd()
694 return -ENOMEM; in pm8001_set_nvmd()
697 memcpy((u8 *)&payload->func_specific, (u8 *)pm8001_ha->fw_image->data, in pm8001_set_nvmd()
698 pm8001_ha->fw_image->size); in pm8001_set_nvmd()
699 payload->wr_length = pm8001_ha->fw_image->size; in pm8001_set_nvmd()
700 payload->id = 0; in pm8001_set_nvmd()
701 payload->minor_function = 0x1; in pm8001_set_nvmd()
702 pm8001_ha->nvmd_completion = &completion; in pm8001_set_nvmd()
703 ret = PM8001_CHIP_DISP->set_nvmd_req(pm8001_ha, payload); in pm8001_set_nvmd()
705 pm8001_ha->fw_status = FAIL_OUT_MEMORY; in pm8001_set_nvmd()
726 u32 length = 1024 * 16 + sizeof(*payload) - 1; in pm8001_update_flash()
730 if (pm8001_ha->fw_image->size < 28) { in pm8001_update_flash()
731 pm8001_ha->fw_status = FAIL_FILE_SIZE; in pm8001_update_flash()
732 return -EFAULT; in pm8001_update_flash()
736 pm8001_ha->fw_status = FAIL_OUT_MEMORY; in pm8001_update_flash()
737 return -ENOMEM; in pm8001_update_flash()
739 image_hdr = (struct pm8001_fw_image_header *)pm8001_ha->fw_image->data; in pm8001_update_flash()
740 while (sizeRead < pm8001_ha->fw_image->size) { in pm8001_update_flash()
742 *(__be32 *)((u8 *)&image_hdr->image_length + sizeRead); in pm8001_update_flash()
748 payload->wr_length = 1024*16; in pm8001_update_flash()
749 payload->id = 0; in pm8001_update_flash()
751 (struct fw_control_info *)&payload->func_specific; in pm8001_update_flash()
752 fwControl->len = IOCTL_BUF_SIZE; /* IN */ in pm8001_update_flash()
753 fwControl->size = partitionSize + HEADER_LEN;/* IN */ in pm8001_update_flash()
754 fwControl->retcode = 0;/* OUT */ in pm8001_update_flash()
755 fwControl->offset = loopNumber * IOCTL_BUF_SIZE;/*OUT */ in pm8001_update_flash()
762 read_buf = (u8 *)pm8001_ha->fw_image->data + sizeRead; in pm8001_update_flash()
765 if (loopcount - loopNumber == 1 && fc_len) { in pm8001_update_flash()
766 fwControl->len = fc_len; in pm8001_update_flash()
767 memcpy((u8 *)fwControl->buffer, read_buf, fc_len); in pm8001_update_flash()
770 memcpy((u8 *)fwControl->buffer, read_buf, IOCTL_BUF_SIZE); in pm8001_update_flash()
774 pm8001_ha->nvmd_completion = &completion; in pm8001_update_flash()
775 ret = PM8001_CHIP_DISP->fw_flash_update_req(pm8001_ha, payload); in pm8001_update_flash()
777 pm8001_ha->fw_status = FAIL_OUT_MEMORY; in pm8001_update_flash()
781 if (fwControl->retcode > FLASH_UPDATE_IN_PROGRESS) { in pm8001_update_flash()
782 pm8001_ha->fw_status = fwControl->retcode; in pm8001_update_flash()
783 ret = -EFAULT; in pm8001_update_flash()
798 struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; in pm8001_store_update_fw()
805 return -EACCES; in pm8001_store_update_fw()
809 if (pm8001_ha->fw_status == FLASH_IN_PROGRESS) in pm8001_store_update_fw()
810 return -EINPROGRESS; in pm8001_store_update_fw()
811 pm8001_ha->fw_status = FLASH_IN_PROGRESS; in pm8001_store_update_fw()
815 pm8001_ha->fw_status = FAIL_OUT_MEMORY; in pm8001_store_update_fw()
816 return -ENOMEM; in pm8001_store_update_fw()
822 pm8001_ha->fw_status = FAIL_PARAMETERS; in pm8001_store_update_fw()
823 ret = -EINVAL; in pm8001_store_update_fw()
835 pm8001_ha->fw_status = FAIL_PARAMETERS; in pm8001_store_update_fw()
836 ret = -EINVAL; in pm8001_store_update_fw()
840 ret = request_firmware(&pm8001_ha->fw_image, in pm8001_store_update_fw()
842 pm8001_ha->dev); in pm8001_store_update_fw()
848 pm8001_ha->fw_status = FAIL_OPEN_BIOS_FILE; in pm8001_store_update_fw()
857 release_firmware(pm8001_ha->fw_image); in pm8001_store_update_fw()
864 pm8001_ha->fw_status = FLASH_OK; in pm8001_store_update_fw()
874 struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; in pm8001_show_update_fw()
877 if (flash_error_table[i].err_code == pm8001_ha->fw_status) in pm8001_show_update_fw()
880 if (pm8001_ha->fw_status != FLASH_IN_PROGRESS) in pm8001_show_update_fw()
881 pm8001_ha->fw_status = FLASH_OK; in pm8001_show_update_fw()
898 * ctl_mpi_state_show - controller MPI state check
899 * @cdev: pointer to embedded class device
903 * A sysfs 'read-only' shost attribute.
910 struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; in ctl_mpi_state_show()
913 mpidw0 = pm8001_mr32(pm8001_ha->general_stat_tbl_addr, 0); in ctl_mpi_state_show()
919 * ctl_hmi_error_show - controller MPI initialization fails
920 * @cdev: pointer to embedded class device
924 * A sysfs 'read-only' shost attribute.
931 struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; in ctl_hmi_error_show()
934 mpidw0 = pm8001_mr32(pm8001_ha->general_stat_tbl_addr, 0); in ctl_hmi_error_show()
940 * ctl_raae_count_show - controller raae count check
941 * @cdev: pointer to embedded class device
945 * A sysfs 'read-only' shost attribute.
952 struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; in ctl_raae_count_show()
955 raaecnt = pm8001_mr32(pm8001_ha->general_stat_tbl_addr, 12); in ctl_raae_count_show()
961 * ctl_iop0_count_show - controller iop0 count check
962 * @cdev: pointer to embedded class device
966 * A sysfs 'read-only' shost attribute.
973 struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; in ctl_iop0_count_show()
976 iop0cnt = pm8001_mr32(pm8001_ha->general_stat_tbl_addr, 16); in ctl_iop0_count_show()
982 * ctl_iop1_count_show - controller iop1 count check
983 * @cdev: pointer to embedded class device
987 * A sysfs 'read-only' shost attribute.
994 struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; in ctl_iop1_count_show()
997 iop1cnt = pm8001_mr32(pm8001_ha->general_stat_tbl_addr, 20); in ctl_iop1_count_show()