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()
223 (u16)(pm8001_ha->main_cfg_tbl.pm80xx_tbl.max_sgl >> 16) in pm8001_ctl_max_devices_show()
229 * pm8001_ctl_max_sg_list_show - max sg list supported iff not 0.0 for no
231 * @cdev: pointer to embedded class device
235 * A sysfs 'read-only' shost attribute.
242 struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; in pm8001_ctl_max_sg_list_show()
244 if (pm8001_ha->chip_id == chip_8001) { in pm8001_ctl_max_sg_list_show()
246 pm8001_ha->main_cfg_tbl.pm8001_tbl.max_sgl & 0x0000FFFF in pm8001_ctl_max_sg_list_show()
250 pm8001_ha->main_cfg_tbl.pm80xx_tbl.max_sgl & 0x0000FFFF in pm8001_ctl_max_sg_list_show()
275 * pm8001_ctl_sas_spec_support_show - sas spec supported
276 * @cdev: pointer to embedded class device
280 * A sysfs 'read-only' shost attribute.
288 struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; in pm8001_ctl_sas_spec_support_show()
290 if (pm8001_ha->chip_id == chip_8001) in pm8001_ctl_sas_spec_support_show()
291 mode = (pm8001_ha->main_cfg_tbl.pm8001_tbl.ctrl_cap_flag & in pm8001_ctl_sas_spec_support_show()
295 mode = (pm8001_ha->main_cfg_tbl.pm80xx_tbl.ctrl_cap_flag & in pm8001_ctl_sas_spec_support_show()
303 * pm8001_ctl_host_sas_address_show - sas address
304 * @cdev: pointer to embedded class device
308 * This is the controller sas address
310 * A sysfs 'read-only' shost attribute.
317 struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; in pm8001_ctl_host_sas_address_show()
319 be64_to_cpu(*(__be64 *)pm8001_ha->sas_addr)); in pm8001_ctl_host_sas_address_show()
325 * pm8001_ctl_logging_level_show - logging level
326 * @cdev: pointer to embedded class device
337 struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; in pm8001_ctl_logging_level_show()
339 return snprintf(buf, PAGE_SIZE, "%08xh\n", pm8001_ha->logging_level); in pm8001_ctl_logging_level_show()
347 struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; in pm8001_ctl_logging_level_store()
351 return -EINVAL; in pm8001_ctl_logging_level_store()
353 pm8001_ha->logging_level = val; in pm8001_ctl_logging_level_store()
360 * pm8001_ctl_aap_log_show - aap1 event log
361 * @cdev: pointer to embedded class device
365 * A sysfs 'read-only' shost attribute.
372 struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; in pm8001_ctl_aap_log_show()
373 u8 *ptr = (u8 *)pm8001_ha->memoryMap.region[AAP1].virt_ptr; in pm8001_ctl_aap_log_show()
391 return str - buf; in pm8001_ctl_aap_log_show()
395 * pm8001_ctl_ib_queue_log_show - Out bound Queue log
396 * @cdev:pointer to embedded class device
400 * A sysfs 'read-only' shost attribute.
407 struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; in pm8001_ctl_ib_queue_log_show()
411 u32 ib_offset = pm8001_ha->ib_offset; in pm8001_ctl_ib_queue_log_show()
412 u32 queue_size = pm8001_ha->max_q_num * PM8001_MPI_QUEUE * 128; in pm8001_ctl_ib_queue_log_show()
414 (*(u32 *)((u8 *)pm8001_ha-> \ in pm8001_ctl_ib_queue_log_show()
416 pm8001_ha->evtlog_ib_offset + (c))) in pm8001_ctl_ib_queue_log_show()
422 pm8001_ha->evtlog_ib_offset += SYSFS_OFFSET; in pm8001_ctl_ib_queue_log_show()
423 if (((pm8001_ha->evtlog_ib_offset) % queue_size) == 0) in pm8001_ctl_ib_queue_log_show()
424 pm8001_ha->evtlog_ib_offset = 0; in pm8001_ctl_ib_queue_log_show()
426 return str - buf; in pm8001_ctl_ib_queue_log_show()
431 * pm8001_ctl_ob_queue_log_show - Out bound Queue log
432 * @cdev:pointer to embedded class device
436 * A sysfs 'read-only' shost attribute.
444 struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; in pm8001_ctl_ob_queue_log_show()
448 u32 ob_offset = pm8001_ha->ob_offset; in pm8001_ctl_ob_queue_log_show()
449 u32 queue_size = pm8001_ha->max_q_num * PM8001_MPI_QUEUE * 128; in pm8001_ctl_ob_queue_log_show()
451 (*(u32 *)((u8 *)pm8001_ha-> \ in pm8001_ctl_ob_queue_log_show()
453 pm8001_ha->evtlog_ob_offset + (c))) in pm8001_ctl_ob_queue_log_show()
459 pm8001_ha->evtlog_ob_offset += SYSFS_OFFSET; in pm8001_ctl_ob_queue_log_show()
460 if (((pm8001_ha->evtlog_ob_offset) % queue_size) == 0) in pm8001_ctl_ob_queue_log_show()
461 pm8001_ha->evtlog_ob_offset = 0; in pm8001_ctl_ob_queue_log_show()
463 return str - buf; in pm8001_ctl_ob_queue_log_show()
467 * pm8001_ctl_bios_version_show - Bios version Display
468 * @cdev:pointer to embedded class device
472 * A sysfs 'read-only' shost attribute.
479 struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; in pm8001_ctl_bios_version_show()
485 pm8001_ha->nvmd_completion = &completion; in pm8001_ctl_bios_version_show()
491 return -ENOMEM; in pm8001_ctl_bios_version_show()
492 if (PM8001_CHIP_DISP->get_nvmd_req(pm8001_ha, &payload)) { in pm8001_ctl_bios_version_show()
494 return -ENOMEM; in pm8001_ctl_bios_version_show()
502 return str - buf; in pm8001_ctl_bios_version_show()
506 * event_log_size_show - event log size
507 * @cdev: pointer to embedded class device
518 struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; in event_log_size_show()
521 pm8001_ha->main_cfg_tbl.pm80xx_tbl.event_log_size); in event_log_size_show()
525 * pm8001_ctl_iop_log_show - IOP event log
526 * @cdev: pointer to embedded class device
530 * A sysfs 'read-only' shost attribute.
537 struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; in pm8001_ctl_iop_log_show()
540 pm8001_ha->main_cfg_tbl.pm80xx_tbl.event_log_size / 1024; in pm8001_ctl_iop_log_show()
544 u32 *temp = (u32 *)pm8001_ha->memoryMap.region[IOP].virt_ptr; in pm8001_ctl_iop_log_show()
558 return str - buf; in pm8001_ctl_iop_log_show()
563 * pm8001_ctl_fatal_log_show - fatal error logging
564 * @cdev:pointer to embedded class device
568 * A sysfs 'read-only' shost attribute.
583 * non_fatal_log_show - non fatal error logging
584 * @cdev:pointer to embedded class device
588 * A sysfs 'read-only' shost attribute.
605 struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; in non_fatal_count_show()
608 pm8001_ha->non_fatal_count); in non_fatal_count_show()
616 struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; in non_fatal_count_store()
620 return -EINVAL; in non_fatal_count_store()
622 pm8001_ha->non_fatal_count = val; in non_fatal_count_store()
628 * pm8001_ctl_gsm_log_show - gsm dump collection
629 * @cdev:pointer to embedded class device
633 * A sysfs 'read-only' shost attribute.
688 u32 length = 1024 * 5 + sizeof(*payload) - 1; in pm8001_set_nvmd()
690 if (pm8001_ha->fw_image->size > 4096) { in pm8001_set_nvmd()
691 pm8001_ha->fw_status = FAIL_FILE_SIZE; in pm8001_set_nvmd()
692 return -EFAULT; in pm8001_set_nvmd()
697 pm8001_ha->fw_status = FAIL_OUT_MEMORY; in pm8001_set_nvmd()
698 return -ENOMEM; in pm8001_set_nvmd()
701 memcpy((u8 *)&payload->func_specific, (u8 *)pm8001_ha->fw_image->data, in pm8001_set_nvmd()
702 pm8001_ha->fw_image->size); in pm8001_set_nvmd()
703 payload->wr_length = pm8001_ha->fw_image->size; in pm8001_set_nvmd()
704 payload->id = 0; in pm8001_set_nvmd()
705 payload->minor_function = 0x1; in pm8001_set_nvmd()
706 pm8001_ha->nvmd_completion = &completion; in pm8001_set_nvmd()
707 ret = PM8001_CHIP_DISP->set_nvmd_req(pm8001_ha, payload); in pm8001_set_nvmd()
709 pm8001_ha->fw_status = FAIL_OUT_MEMORY; in pm8001_set_nvmd()
730 u32 length = 1024 * 16 + sizeof(*payload) - 1; in pm8001_update_flash()
734 if (pm8001_ha->fw_image->size < 28) { in pm8001_update_flash()
735 pm8001_ha->fw_status = FAIL_FILE_SIZE; in pm8001_update_flash()
736 return -EFAULT; in pm8001_update_flash()
740 pm8001_ha->fw_status = FAIL_OUT_MEMORY; in pm8001_update_flash()
741 return -ENOMEM; in pm8001_update_flash()
743 image_hdr = (struct pm8001_fw_image_header *)pm8001_ha->fw_image->data; in pm8001_update_flash()
744 while (sizeRead < pm8001_ha->fw_image->size) { in pm8001_update_flash()
746 *(__be32 *)((u8 *)&image_hdr->image_length + sizeRead); in pm8001_update_flash()
752 payload->wr_length = 1024*16; in pm8001_update_flash()
753 payload->id = 0; in pm8001_update_flash()
755 (struct fw_control_info *)&payload->func_specific; in pm8001_update_flash()
756 fwControl->len = IOCTL_BUF_SIZE; /* IN */ in pm8001_update_flash()
757 fwControl->size = partitionSize + HEADER_LEN;/* IN */ in pm8001_update_flash()
758 fwControl->retcode = 0;/* OUT */ in pm8001_update_flash()
759 fwControl->offset = loopNumber * IOCTL_BUF_SIZE;/*OUT */ in pm8001_update_flash()
766 read_buf = (u8 *)pm8001_ha->fw_image->data + sizeRead; in pm8001_update_flash()
769 if (loopcount - loopNumber == 1 && fc_len) { in pm8001_update_flash()
770 fwControl->len = fc_len; in pm8001_update_flash()
771 memcpy((u8 *)fwControl->buffer, read_buf, fc_len); in pm8001_update_flash()
774 memcpy((u8 *)fwControl->buffer, read_buf, IOCTL_BUF_SIZE); in pm8001_update_flash()
778 pm8001_ha->nvmd_completion = &completion; in pm8001_update_flash()
779 ret = PM8001_CHIP_DISP->fw_flash_update_req(pm8001_ha, payload); in pm8001_update_flash()
781 pm8001_ha->fw_status = FAIL_OUT_MEMORY; in pm8001_update_flash()
785 if (fwControl->retcode > FLASH_UPDATE_IN_PROGRESS) { in pm8001_update_flash()
786 pm8001_ha->fw_status = fwControl->retcode; in pm8001_update_flash()
787 ret = -EFAULT; in pm8001_update_flash()
802 struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; in pm8001_store_update_fw()
809 return -EACCES; in pm8001_store_update_fw()
813 if (pm8001_ha->fw_status == FLASH_IN_PROGRESS) in pm8001_store_update_fw()
814 return -EINPROGRESS; in pm8001_store_update_fw()
815 pm8001_ha->fw_status = FLASH_IN_PROGRESS; in pm8001_store_update_fw()
819 pm8001_ha->fw_status = FAIL_OUT_MEMORY; in pm8001_store_update_fw()
820 return -ENOMEM; in pm8001_store_update_fw()
826 pm8001_ha->fw_status = FAIL_PARAMETERS; in pm8001_store_update_fw()
827 ret = -EINVAL; in pm8001_store_update_fw()
839 pm8001_ha->fw_status = FAIL_PARAMETERS; in pm8001_store_update_fw()
840 ret = -EINVAL; in pm8001_store_update_fw()
844 ret = request_firmware(&pm8001_ha->fw_image, in pm8001_store_update_fw()
846 pm8001_ha->dev); in pm8001_store_update_fw()
852 pm8001_ha->fw_status = FAIL_OPEN_BIOS_FILE; in pm8001_store_update_fw()
861 release_firmware(pm8001_ha->fw_image); in pm8001_store_update_fw()
868 pm8001_ha->fw_status = FLASH_OK; in pm8001_store_update_fw()
878 struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; in pm8001_show_update_fw()
881 if (flash_error_table[i].err_code == pm8001_ha->fw_status) in pm8001_show_update_fw()
884 if (pm8001_ha->fw_status != FLASH_IN_PROGRESS) in pm8001_show_update_fw()
885 pm8001_ha->fw_status = FLASH_OK; in pm8001_show_update_fw()
902 * ctl_mpi_state_show - controller MPI state check
903 * @cdev: pointer to embedded class device
907 * A sysfs 'read-only' shost attribute.
914 struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; in ctl_mpi_state_show()
917 mpidw0 = pm8001_mr32(pm8001_ha->general_stat_tbl_addr, 0); in ctl_mpi_state_show()
923 * ctl_hmi_error_show - controller MPI initialization fails
924 * @cdev: pointer to embedded class device
928 * A sysfs 'read-only' shost attribute.
935 struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; in ctl_hmi_error_show()
938 mpidw0 = pm8001_mr32(pm8001_ha->general_stat_tbl_addr, 0); in ctl_hmi_error_show()
944 * ctl_raae_count_show - controller raae count check
945 * @cdev: pointer to embedded class device
949 * A sysfs 'read-only' shost attribute.
956 struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; in ctl_raae_count_show()
959 raaecnt = pm8001_mr32(pm8001_ha->general_stat_tbl_addr, 12); in ctl_raae_count_show()
965 * ctl_iop0_count_show - controller iop0 count check
966 * @cdev: pointer to embedded class device
970 * A sysfs 'read-only' shost attribute.
977 struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; in ctl_iop0_count_show()
980 iop0cnt = pm8001_mr32(pm8001_ha->general_stat_tbl_addr, 16); in ctl_iop0_count_show()
986 * ctl_iop1_count_show - controller iop1 count check
987 * @cdev: pointer to embedded class device
991 * A sysfs 'read-only' shost attribute.
998 struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; in ctl_iop1_count_show()
1001 iop1cnt = pm8001_mr32(pm8001_ha->general_stat_tbl_addr, 20); in ctl_iop1_count_show()