Commit 7000f7c7 authored by Andrzej Jakowski's avatar Andrzej Jakowski Committed by James Bottomley

[SCSI] isci: overriding max_concurr_spinup oem parameter by max(oem, user)

Fixes bug where max_concurr_spinup oem parameter should be
overriden by max_concurr_spinup user parameter. Override should
happen only when max_concurr_spinup user parameter is specified
in command line (greater than 0). Also this fix shortens variables
representing max_conxurr_spinup for oem and user parameters.
Signed-off-by: default avatarAndrzej Jakowski <andrzej.jakowski@intel.com>
Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
parent 52d74634
...@@ -1350,7 +1350,7 @@ static void isci_user_parameters_get(struct sci_user_parameters *u) ...@@ -1350,7 +1350,7 @@ static void isci_user_parameters_get(struct sci_user_parameters *u)
u->stp_max_occupancy_timeout = stp_max_occ_to; u->stp_max_occupancy_timeout = stp_max_occ_to;
u->ssp_max_occupancy_timeout = ssp_max_occ_to; u->ssp_max_occupancy_timeout = ssp_max_occ_to;
u->no_outbound_task_timeout = no_outbound_task_to; u->no_outbound_task_timeout = no_outbound_task_to;
u->max_number_concurrent_device_spin_up = max_concurr_spinup; u->max_concurr_spinup = max_concurr_spinup;
} }
static void sci_controller_initial_state_enter(struct sci_base_state_machine *sm) static void sci_controller_initial_state_enter(struct sci_base_state_machine *sm)
...@@ -1661,7 +1661,7 @@ static void sci_controller_set_default_config_parameters(struct isci_host *ihost ...@@ -1661,7 +1661,7 @@ static void sci_controller_set_default_config_parameters(struct isci_host *ihost
ihost->oem_parameters.controller.mode_type = SCIC_PORT_AUTOMATIC_CONFIGURATION_MODE; ihost->oem_parameters.controller.mode_type = SCIC_PORT_AUTOMATIC_CONFIGURATION_MODE;
/* Default to APC mode. */ /* Default to APC mode. */
ihost->oem_parameters.controller.max_concurrent_dev_spin_up = 1; ihost->oem_parameters.controller.max_concurr_spin_up = 1;
/* Default to no SSC operation. */ /* Default to no SSC operation. */
ihost->oem_parameters.controller.do_enable_ssc = false; ihost->oem_parameters.controller.do_enable_ssc = false;
...@@ -1787,7 +1787,8 @@ int sci_oem_parameters_validate(struct sci_oem_params *oem) ...@@ -1787,7 +1787,8 @@ int sci_oem_parameters_validate(struct sci_oem_params *oem)
} else } else
return -EINVAL; return -EINVAL;
if (oem->controller.max_concurrent_dev_spin_up > MAX_CONCURRENT_DEVICE_SPIN_UP_COUNT) if (oem->controller.max_concurr_spin_up > MAX_CONCURRENT_DEVICE_SPIN_UP_COUNT ||
oem->controller.max_concurr_spin_up < 1)
return -EINVAL; return -EINVAL;
return 0; return 0;
...@@ -1810,6 +1811,16 @@ static enum sci_status sci_oem_parameters_set(struct isci_host *ihost) ...@@ -1810,6 +1811,16 @@ static enum sci_status sci_oem_parameters_set(struct isci_host *ihost)
return SCI_FAILURE_INVALID_STATE; return SCI_FAILURE_INVALID_STATE;
} }
static u8 max_spin_up(struct isci_host *ihost)
{
if (ihost->user_parameters.max_concurr_spinup)
return min_t(u8, ihost->user_parameters.max_concurr_spinup,
MAX_CONCURRENT_DEVICE_SPIN_UP_COUNT);
else
return min_t(u8, ihost->oem_parameters.controller.max_concurr_spin_up,
MAX_CONCURRENT_DEVICE_SPIN_UP_COUNT);
}
static void power_control_timeout(unsigned long data) static void power_control_timeout(unsigned long data)
{ {
struct sci_timer *tmr = (struct sci_timer *)data; struct sci_timer *tmr = (struct sci_timer *)data;
...@@ -1839,8 +1850,7 @@ static void power_control_timeout(unsigned long data) ...@@ -1839,8 +1850,7 @@ static void power_control_timeout(unsigned long data)
if (iphy == NULL) if (iphy == NULL)
continue; continue;
if (ihost->power_control.phys_granted_power >= if (ihost->power_control.phys_granted_power >= max_spin_up(ihost))
ihost->oem_parameters.controller.max_concurrent_dev_spin_up)
break; break;
ihost->power_control.requesters[i] = NULL; ihost->power_control.requesters[i] = NULL;
...@@ -1865,8 +1875,7 @@ void sci_controller_power_control_queue_insert(struct isci_host *ihost, ...@@ -1865,8 +1875,7 @@ void sci_controller_power_control_queue_insert(struct isci_host *ihost,
{ {
BUG_ON(iphy == NULL); BUG_ON(iphy == NULL);
if (ihost->power_control.phys_granted_power < if (ihost->power_control.phys_granted_power < max_spin_up(ihost)) {
ihost->oem_parameters.controller.max_concurrent_dev_spin_up) {
ihost->power_control.phys_granted_power++; ihost->power_control.phys_granted_power++;
sci_phy_consume_power_handler(iphy); sci_phy_consume_power_handler(iphy);
......
...@@ -118,7 +118,7 @@ unsigned char phy_gen = 3; ...@@ -118,7 +118,7 @@ unsigned char phy_gen = 3;
module_param(phy_gen, byte, 0); module_param(phy_gen, byte, 0);
MODULE_PARM_DESC(phy_gen, "PHY generation (1: 1.5Gbps 2: 3.0Gbps 3: 6.0Gbps)"); MODULE_PARM_DESC(phy_gen, "PHY generation (1: 1.5Gbps 2: 3.0Gbps 3: 6.0Gbps)");
unsigned char max_concurr_spinup = 1; unsigned char max_concurr_spinup;
module_param(max_concurr_spinup, byte, 0); module_param(max_concurr_spinup, byte, 0);
MODULE_PARM_DESC(max_concurr_spinup, "Max concurrent device spinup"); MODULE_PARM_DESC(max_concurr_spinup, "Max concurrent device spinup");
......
...@@ -112,7 +112,7 @@ struct sci_user_parameters { ...@@ -112,7 +112,7 @@ struct sci_user_parameters {
* This field specifies the maximum number of direct attached devices * This field specifies the maximum number of direct attached devices
* that can have power supplied to them simultaneously. * that can have power supplied to them simultaneously.
*/ */
u8 max_number_concurrent_device_spin_up; u8 max_concurr_spinup;
/** /**
* This field specifies the number of seconds to allow a phy to consume * This field specifies the number of seconds to allow a phy to consume
...@@ -219,7 +219,7 @@ struct sci_bios_oem_param_block_hdr { ...@@ -219,7 +219,7 @@ struct sci_bios_oem_param_block_hdr {
struct sci_oem_params { struct sci_oem_params {
struct { struct {
uint8_t mode_type; uint8_t mode_type;
uint8_t max_concurrent_dev_spin_up; uint8_t max_concurr_spin_up;
uint8_t do_enable_ssc; uint8_t do_enable_ssc;
uint8_t reserved; uint8_t reserved;
} controller; } controller;
......
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