@@ -64,6 +64,10 @@ static bool pm8001_use_tasklet = true;
6464module_param_named (use_tasklet , pm8001_use_tasklet , bool , 0444 );
6565MODULE_PARM_DESC (zoned , "Use MSIX interrupts. Default: true" );
6666
67+ static bool pm8001_read_wwn = true;
68+ module_param_named (read_wwn , pm8001_read_wwn , bool , 0444 );
69+ MODULE_PARM_DESC (zoned , "Get WWN from the controller. Default: true" );
70+
6771static struct scsi_transport_template * pm8001_stt ;
6872static int pm8001_init_ccb_tag (struct pm8001_hba_info * );
6973
@@ -683,19 +687,30 @@ static void pm8001_post_sas_ha_init(struct Scsi_Host *shost,
683687 */
684688static int pm8001_init_sas_add (struct pm8001_hba_info * pm8001_ha )
685689{
686- u8 i , j ;
687- u8 sas_add [8 ];
688- #ifdef PM8001_READ_VPD
689- /* For new SPC controllers WWN is stored in flash vpd
690- * For SPC/SPCve controllers WWN is stored in EEPROM
691- * For Older SPC WWN is stored in NVMD
692- */
693690 DECLARE_COMPLETION_ONSTACK (completion );
694691 struct pm8001_ioctl_payload payload ;
692+ unsigned long time_remaining ;
693+ u8 sas_add [8 ];
695694 u16 deviceid ;
696695 int rc ;
697- unsigned long time_remaining ;
696+ u8 i , j ;
697+
698+ if (!pm8001_read_wwn ) {
699+ __be64 dev_sas_addr = cpu_to_be64 (0x50010c600047f9d0ULL );
700+
701+ for (i = 0 ; i < pm8001_ha -> chip -> n_phy ; i ++ )
702+ memcpy (& pm8001_ha -> phy [i ].dev_sas_addr , & dev_sas_addr ,
703+ SAS_ADDR_SIZE );
704+ memcpy (pm8001_ha -> sas_addr , & pm8001_ha -> phy [0 ].dev_sas_addr ,
705+ SAS_ADDR_SIZE );
706+ return 0 ;
707+ }
698708
709+ /*
710+ * For new SPC controllers WWN is stored in flash vpd. For SPC/SPCve
711+ * controllers WWN is stored in EEPROM. And for Older SPC WWN is stored
712+ * in NVMD.
713+ */
699714 if (PM8001_CHIP_DISP -> fatal_errors (pm8001_ha )) {
700715 pm8001_dbg (pm8001_ha , FAIL , "controller is in fatal error state\n" );
701716 return - EIO ;
@@ -769,16 +784,7 @@ static int pm8001_init_sas_add(struct pm8001_hba_info *pm8001_ha)
769784 pm8001_ha -> phy [i ].dev_sas_addr );
770785 }
771786 kfree (payload .func_specific );
772- #else
773- for (i = 0 ; i < pm8001_ha -> chip -> n_phy ; i ++ ) {
774- pm8001_ha -> phy [i ].dev_sas_addr = 0x50010c600047f9d0ULL ;
775- pm8001_ha -> phy [i ].dev_sas_addr =
776- cpu_to_be64 ((u64 )
777- (* (u64 * )& pm8001_ha -> phy [i ].dev_sas_addr ));
778- }
779- memcpy (pm8001_ha -> sas_addr , & pm8001_ha -> phy [0 ].dev_sas_addr ,
780- SAS_ADDR_SIZE );
781- #endif
787+
782788 return 0 ;
783789}
784790
@@ -788,13 +794,13 @@ static int pm8001_init_sas_add(struct pm8001_hba_info *pm8001_ha)
788794 */
789795static int pm8001_get_phy_settings_info (struct pm8001_hba_info * pm8001_ha )
790796{
791-
792- #ifdef PM8001_READ_VPD
793- /*OPTION ROM FLASH read for the SPC cards */
794797 DECLARE_COMPLETION_ONSTACK (completion );
795798 struct pm8001_ioctl_payload payload ;
796799 int rc ;
797800
801+ if (!pm8001_read_wwn )
802+ return 0 ;
803+
798804 pm8001_ha -> nvmd_completion = & completion ;
799805 /* SAS ADDRESS read from flash / EEPROM */
800806 payload .minor_function = 6 ;
@@ -813,7 +819,7 @@ static int pm8001_get_phy_settings_info(struct pm8001_hba_info *pm8001_ha)
813819 wait_for_completion (& completion );
814820 pm8001_set_phy_profile (pm8001_ha , sizeof (u8 ), payload .func_specific );
815821 kfree (payload .func_specific );
816- #endif
822+
817823 return 0 ;
818824}
819825
0 commit comments