36 #define OCS_XPORT_QUIESCED_TIMEOUT_MSEC 60000
44 ocs_log_err(ocs,
"Failed to reset port\n");
47 ocs_log_info(ocs,
"Successfully reset port\n");
51 ocs_log_err(ocs,
"Failed to initialize hal\n");
54 ocs_log_info(ocs,
"Successfully initialized hal\n");
65 ocs_t *other_ocs = NULL;
66 uint8_t bus, dev, func;
72 uint8_t other_bus, other_dev, other_func;
75 if ((bus == other_bus) && (dev == other_dev)) {
89 uint8_t bus, dev, func;
90 uint8_t other_bus, other_dev, other_func;
93 uint32_t ms_waited = 0;
94 uint32_t index = 0, port_index = 0;
98 ocs_device_stop_stats_timers(ocs);
104 if ((bus == other_bus) && (dev == other_dev) && (port_index <
OCS_MAX_HBA_PORTS)) {
108 prev_port_state[port_index] = 1;
110 prev_port_state[port_index] = 0;
121 if ((bus == other_bus) && (dev == other_dev)) {
125 ocs_log_debug(other_ocs,
"Port quiesced\n");
129 ocs_delay_usec(10000);
132 ocs_log_err(other_ocs,
"Timed out waiting for port to quiesce\n");
139 ocs_log_info(ocs,
"Resetting firmware\n");
141 ocs_log_err(ocs,
"Firmware reset NOT successful\n");
144 ocs_log_info(ocs,
"Firmware reset successful\n");
150 if ((bus == other_bus) && (dev == other_dev)) {
151 if (OCS_HAL_STATE_UNINITIALIZED != other_ocs->hal.state) {
152 other_ocs->hal.state = OCS_HAL_STATE_QUEUES_ALLOCATED;
157 ocs_log_err(other_ocs,
"Failed to re-attach the device\n");
160 ocs_log_info(other_ocs,
"Successfully re-attached the device\n");
165 index = port_index = 0;
169 if ((bus == other_bus) && (dev == other_dev) && (port_index <
OCS_MAX_HBA_PORTS)) {
170 if (prev_port_state[port_index]) {
186 for (*ms_waited = 0; *ms_waited < SLI4_FW_DUMP_TIMEOUT_MSEC; *ms_waited += 100) {
193 ocs_hal_get(&ocs->hal, OCS_HAL_DUMP_READY, &dump_present);
205 uint32_t ms_waited = 0;
210 ocs_log_info(ocs,
"Waiting for the recovery dump to complete\n");
215 ocs_log_info(ocs,
"Initiating the FW dump forcefully\n");
218 ocs_log_err(ocs,
"Failed to trigger the FW dump\n");
222 ocs_log_info(ocs,
"Dump requested, waiting for it to complete\n");
227 ocs_log_err(ocs,
"Failed to see the FW dump (%d) after %d msec\n", dump_status, ms_waited);
232 ocs_log_info(ocs,
"Skipped the FW dump\n");
237 ocs_log_info(ocs,
"FW dump was generated successfully in %d msec\n", ms_waited);
239 ocs_log_info(ocs,
"FW dump was already present\n");
249 uint32_t reset_required;
258 ocs_hal_get(&ocs->hal, OCS_HAL_RESET_REQUIRED, &reset_required);
259 ocs_log_info(ocs,
"Reset required=%d\n", reset_required);
260 if (reset_required) {
262 ocs_log_info(ocs,
"All devices reset\n");
264 ocs_log_err(ocs,
"All devices NOT reset\n");
280 uint8_t bus, dev, func;
281 uint8_t other_bus, other_dev, other_func;
288 if ((bus == other_bus) && (dev == other_dev)) {
300 ocs_lock(&other_ocs->fw_dump.lock);
301 if (other_ocs->fw_dump.state) {
303 ocs_unlock(&other_ocs->fw_dump.lock);
306 ocs_unlock(&other_ocs->fw_dump.lock);
int32_t ocs_device_detach(ocs_t *ocs)
Remove the PCI device instance.
#define OCS_XPORT_QUIESCED_TIMEOUT_MSEC
static uint32_t ocs_fw_dump_present(ocs_t *ocs, uint32_t *ms_waited)
int32_t sli_fw_error_status(sli4_t *sli4)
Read the SLIPORT_SEMAPHORE and SLIPORT_STATUS registers to check if the port status indicates that a ...
ocs_t * ocs_get_instance(uint32_t index)
Returns a pointer to the ocs structure given the instance index.
ocs_hal_rtn_e ocs_hal_init(ocs_hal_t *hal)
Set up Hardware Abstraction Layer module.
#define OCS_FW_DUMP_STATUS_SKIP
#define OCS_FW_DUMP_STATUS_SUCCESS
int32_t ocs_trigger_dump(ocs_t *ocs, uint8_t dump_level)
#define OCS_MAX_HBA_PORTS
int32_t ocs_fw_dump_state_check(ocs_t *ocs, uint32_t state)
Check the fw dump state.
#define FW_DUMP_READY_STATUS_SKIP_DUMP
#define FW_FUNC_DUMP_STATE_VALID
int32_t ocs_device_attach(ocs_t *ocs)
int32_t ocs_xport_control(ocs_xport_t *xport, ocs_xport_ctrl_e cmd,...)
Perform transport attach function.
ocs_hal_rtn_e ocs_hal_reset(ocs_hal_t *hal, ocs_hal_reset_e reset)
ocs_hal_rtn_e ocs_hal_get(ocs_hal_t *hal, ocs_hal_property_e prop, uint32_t *value)
int32_t ocs_adapter_reset(ocs_t *ocs)
#define FW_CHIP_DUMP_STATE_VALID
int32_t ocs_fw_reset(ocs_t *ocs)
#define FW_CHIP_LEVEL_DUMP
int32_t ocs_get_bus_dev_func(ocs_t *ocs, uint8_t *bus, uint8_t *dev, uint8_t *func)
int32_t ocs_port_reset(ocs_t *ocs)
#define OCS_FW_DUMP_STATUS_FAILED
int32_t ocs_xport_status(ocs_xport_t *xport, ocs_xport_status_e cmd, ocs_xport_stats_t *result)
Return status on a link.
#define FW_DUMP_READY_STATUS_NOT_READY
int ocs_gen_dump(ocs_t *ocs)