Commit b5f18a20 authored by Dave Jiang's avatar Dave Jiang Committed by Dan Williams

isci: exposing user parameters via module params

Exposing the user config parameters through the kernel module parameters.
The kernel module params will have the default values set and we will no
longer pulling the default values for user params from the core.
Signed-off-by: default avatarDave Jiang <dave.jiang@intel.com>
Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
parent 4711ba10
...@@ -2548,41 +2548,46 @@ enum sci_status scic_user_parameters_set( ...@@ -2548,41 +2548,46 @@ enum sci_status scic_user_parameters_set(
struct scic_sds_controller *scic, struct scic_sds_controller *scic,
union scic_user_parameters *scic_parms) union scic_user_parameters *scic_parms)
{ {
if ( u32 state = scic->parent.state_machine.current_state_id;
(scic->parent.state_machine.current_state_id
== SCI_BASE_CONTROLLER_STATE_RESET) if (state == SCI_BASE_CONTROLLER_STATE_RESET ||
|| (scic->parent.state_machine.current_state_id state == SCI_BASE_CONTROLLER_STATE_INITIALIZING ||
== SCI_BASE_CONTROLLER_STATE_INITIALIZING) state == SCI_BASE_CONTROLLER_STATE_INITIALIZED) {
|| (scic->parent.state_machine.current_state_id
== SCI_BASE_CONTROLLER_STATE_INITIALIZED)
) {
u16 index; u16 index;
/* /*
* Validate the user parameters. If they are not legal, then * Validate the user parameters. If they are not legal, then
* return a failure. */ * return a failure.
*/
for (index = 0; index < SCI_MAX_PHYS; index++) { for (index = 0; index < SCI_MAX_PHYS; index++) {
if (!(scic_parms->sds1.phys[index].max_speed_generation struct sci_phy_user_params *user_phy;
<= SCIC_SDS_PARM_MAX_SPEED
&& scic_parms->sds1.phys[index].max_speed_generation user_phy = &scic_parms->sds1.phys[index];
> SCIC_SDS_PARM_NO_SPEED))
if (!((user_phy->max_speed_generation <=
SCIC_SDS_PARM_MAX_SPEED) &&
(user_phy->max_speed_generation >
SCIC_SDS_PARM_NO_SPEED)))
return SCI_FAILURE_INVALID_PARAMETER_VALUE; return SCI_FAILURE_INVALID_PARAMETER_VALUE;
if (scic_parms->sds1.phys[index].in_connection_align_insertion_frequency < 3) if (user_phy->in_connection_align_insertion_frequency <
3)
return SCI_FAILURE_INVALID_PARAMETER_VALUE; return SCI_FAILURE_INVALID_PARAMETER_VALUE;
if (
(scic_parms->sds1.phys[index].in_connection_align_insertion_frequency < 3) || if ((user_phy->in_connection_align_insertion_frequency <
(scic_parms->sds1.phys[index].align_insertion_frequency == 0) || 3) ||
(scic_parms->sds1.phys[index].notify_enable_spin_up_insertion_frequency == 0) (user_phy->align_insertion_frequency == 0) ||
) (user_phy->
notify_enable_spin_up_insertion_frequency ==
0))
return SCI_FAILURE_INVALID_PARAMETER_VALUE; return SCI_FAILURE_INVALID_PARAMETER_VALUE;
} }
if ((scic_parms->sds1.stp_inactivity_timeout == 0) || if ((scic_parms->sds1.stp_inactivity_timeout == 0) ||
(scic_parms->sds1.ssp_inactivity_timeout == 0) || (scic_parms->sds1.ssp_inactivity_timeout == 0) ||
(scic_parms->sds1.stp_max_occupancy_timeout == 0) || (scic_parms->sds1.stp_max_occupancy_timeout == 0) ||
(scic_parms->sds1.ssp_max_occupancy_timeout == 0) || (scic_parms->sds1.ssp_max_occupancy_timeout == 0) ||
(scic_parms->sds1.no_outbound_task_timeout == 0)) (scic_parms->sds1.no_outbound_task_timeout == 0))
return SCI_FAILURE_INVALID_PARAMETER_VALUE; return SCI_FAILURE_INVALID_PARAMETER_VALUE;
memcpy(&scic->user_parameters, scic_parms, sizeof(*scic_parms)); memcpy(&scic->user_parameters, scic_parms, sizeof(*scic_parms));
...@@ -2620,36 +2625,34 @@ enum sci_status scic_oem_parameters_set( ...@@ -2620,36 +2625,34 @@ enum sci_status scic_oem_parameters_set(
* Validate the oem parameters. If they are not legal, then * Validate the oem parameters. If they are not legal, then
* return a failure. */ * return a failure. */
for (index = 0; index < SCI_MAX_PORTS; index++) { for (index = 0; index < SCI_MAX_PORTS; index++) {
if (scic_parms->sds1.ports[index].phy_mask > SCIC_SDS_PARM_PHY_MASK_MAX) { if (scic_parms->sds1.ports[index].phy_mask > SCIC_SDS_PARM_PHY_MASK_MAX)
return SCI_FAILURE_INVALID_PARAMETER_VALUE; return SCI_FAILURE_INVALID_PARAMETER_VALUE;
}
} }
for (index = 0; index < SCI_MAX_PHYS; index++) { for (index = 0; index < SCI_MAX_PHYS; index++) {
if ( if ((scic_parms->sds1.phys[index].sas_address.high == 0) &&
scic_parms->sds1.phys[index].sas_address.high == 0 (scic_parms->sds1.phys[index].sas_address.low == 0))
&& scic_parms->sds1.phys[index].sas_address.low == 0
) {
return SCI_FAILURE_INVALID_PARAMETER_VALUE; return SCI_FAILURE_INVALID_PARAMETER_VALUE;
}
} }
if (scic_parms->sds1.controller.mode_type == SCIC_PORT_AUTOMATIC_CONFIGURATION_MODE) { if (scic_parms->sds1.controller.mode_type ==
SCIC_PORT_AUTOMATIC_CONFIGURATION_MODE) {
for (index = 0; index < SCI_MAX_PHYS; index++) { for (index = 0; index < SCI_MAX_PHYS; index++) {
if (scic_parms->sds1.ports[index].phy_mask != 0) if (scic_parms->sds1.ports[index].phy_mask != 0)
return SCI_FAILURE_INVALID_PARAMETER_VALUE; return SCI_FAILURE_INVALID_PARAMETER_VALUE;
} }
} else if (scic_parms->sds1.controller.mode_type == SCIC_PORT_MANUAL_CONFIGURATION_MODE) { } else if (scic_parms->sds1.controller.mode_type ==
SCIC_PORT_MANUAL_CONFIGURATION_MODE) {
for (index = 0; index < SCI_MAX_PHYS; index++) for (index = 0; index < SCI_MAX_PHYS; index++)
combined_phy_mask |= scic_parms->sds1.ports[index].phy_mask; combined_phy_mask |= scic_parms->sds1.ports[index].phy_mask;
if (combined_phy_mask == 0) if (combined_phy_mask == 0)
return SCI_FAILURE_INVALID_PARAMETER_VALUE; return SCI_FAILURE_INVALID_PARAMETER_VALUE;
} else { } else
return SCI_FAILURE_INVALID_PARAMETER_VALUE; return SCI_FAILURE_INVALID_PARAMETER_VALUE;
}
if (scic_parms->sds1.controller.max_concurrent_dev_spin_up > MAX_CONCURRENT_DEVICE_SPIN_UP_COUNT) if (scic_parms->sds1.controller.max_concurrent_dev_spin_up >
MAX_CONCURRENT_DEVICE_SPIN_UP_COUNT)
return SCI_FAILURE_INVALID_PARAMETER_VALUE; return SCI_FAILURE_INVALID_PARAMETER_VALUE;
scic->oem_parameters.sds1 = scic_parms->sds1; scic->oem_parameters.sds1 = scic_parms->sds1;
......
...@@ -413,6 +413,32 @@ static void __iomem *smu_base(struct isci_host *isci_host) ...@@ -413,6 +413,32 @@ static void __iomem *smu_base(struct isci_host *isci_host)
return pcim_iomap_table(pdev)[SCI_SMU_BAR * 2] + SCI_SMU_BAR_SIZE * id; return pcim_iomap_table(pdev)[SCI_SMU_BAR * 2] + SCI_SMU_BAR_SIZE * id;
} }
static void isci_user_parameters_get(
struct isci_host *isci_host,
union scic_user_parameters *scic_user_params)
{
struct scic_sds_user_parameters *u = &scic_user_params->sds1;
int i;
for (i = 0; i < SCI_MAX_PHYS; i++) {
struct sci_phy_user_params *u_phy = &u->phys[i];
u_phy->max_speed_generation = phy_gen;
/* we are not exporting these for now */
u_phy->align_insertion_frequency = 0x7f;
u_phy->in_connection_align_insertion_frequency = 0xff;
u_phy->notify_enable_spin_up_insertion_frequency = 0x33;
}
u->stp_inactivity_timeout = stp_inactive_to;
u->ssp_inactivity_timeout = ssp_inactive_to;
u->stp_max_occupancy_timeout = stp_max_occ_to;
u->ssp_max_occupancy_timeout = ssp_max_occ_to;
u->no_outbound_task_timeout = no_outbound_task_to;
u->max_number_concurrent_device_spin_up = max_concurr_spinup;
}
int isci_host_init(struct isci_host *isci_host) int isci_host_init(struct isci_host *isci_host)
{ {
int err = 0, i; int err = 0, i;
...@@ -462,7 +488,7 @@ int isci_host_init(struct isci_host *isci_host) ...@@ -462,7 +488,7 @@ int isci_host_init(struct isci_host *isci_host)
* grab initial values stored in the controller object for OEM and USER * grab initial values stored in the controller object for OEM and USER
* parameters * parameters
*/ */
scic_user_parameters_get(controller, &scic_user_params); isci_user_parameters_get(isci_host, &scic_user_params);
status = scic_user_parameters_set(isci_host->core_controller, status = scic_user_parameters_set(isci_host->core_controller,
&scic_user_params); &scic_user_params);
if (status != SCI_SUCCESS) { if (status != SCI_SUCCESS) {
......
...@@ -110,9 +110,37 @@ int isci_si_rev = ISCI_SI_REVA2; ...@@ -110,9 +110,37 @@ int isci_si_rev = ISCI_SI_REVA2;
#else #else
int isci_si_rev = ISCI_SI_REVB0; int isci_si_rev = ISCI_SI_REVB0;
#endif #endif
module_param(isci_si_rev, int, S_IRUGO | S_IWUSR); module_param(isci_si_rev, int, 0);
MODULE_PARM_DESC(isci_si_rev, "override default si rev (0: A0 1: A2 2: B0)"); MODULE_PARM_DESC(isci_si_rev, "override default si rev (0: A0 1: A2 2: B0)");
unsigned char no_outbound_task_to = 20;
module_param(no_outbound_task_to, byte, 0);
MODULE_PARM_DESC(no_outbound_task_to, "No Outbound Task Timeout (1us incr)");
u16 ssp_max_occ_to = 20;
module_param(ssp_max_occ_to, ushort, 0);
MODULE_PARM_DESC(ssp_max_occ_to, "SSP Max occupancy timeout (100us incr)");
u16 stp_max_occ_to = 5;
module_param(stp_max_occ_to, ushort, 0);
MODULE_PARM_DESC(stp_max_occ_to, "STP Max occupancy timeout (100us incr)");
u16 ssp_inactive_to = 5;
module_param(ssp_inactive_to, ushort, 0);
MODULE_PARM_DESC(ssp_inactive_to, "SSP inactivity timeout (100us incr)");
u16 stp_inactive_to = 5;
module_param(stp_inactive_to, ushort, 0);
MODULE_PARM_DESC(stp_inactive_to, "STP inactivity timeout (100us incr)");
unsigned char phy_gen = 3;
module_param(phy_gen, byte, 0);
MODULE_PARM_DESC(phy_gen, "PHY generation (1: 1.5Gbps 2: 3.0Gbps 3: 6.0Gbps)");
unsigned char max_concurr_spinup = 1;
module_param(max_concurr_spinup, byte, 0);
MODULE_PARM_DESC(max_concurr_spinup, "Max concurrent device spinup");
static struct scsi_host_template isci_sht = { static struct scsi_host_template isci_sht = {
.module = THIS_MODULE, .module = THIS_MODULE,
......
...@@ -75,6 +75,14 @@ ...@@ -75,6 +75,14 @@
#include "task.h" #include "task.h"
#include "sata.h" #include "sata.h"
extern unsigned char no_outbound_task_to;
extern u16 ssp_max_occ_to;
extern u16 stp_max_occ_to;
extern u16 ssp_inactive_to;
extern u16 stp_inactive_to;
extern unsigned char phy_gen;
extern unsigned char max_concurr_spinup;
irqreturn_t isci_msix_isr(int vec, void *data); irqreturn_t isci_msix_isr(int vec, void *data);
irqreturn_t isci_intx_isr(int vec, void *data); irqreturn_t isci_intx_isr(int vec, void *data);
irqreturn_t isci_error_isr(int vec, void *data); irqreturn_t isci_error_isr(int vec, void *data);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment