aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2011-02-17 18:01:46 -0500
committerDan Williams <dan.j.williams@intel.com>2011-07-03 06:55:27 -0400
commit11c88986290712fc3ae6993af85a0f9a15886278 (patch)
tree225ca7338be35bff3f1343d60f31c6a9638a0557
parentf7d36e1872c0d79ea9e31445c3b1b70602dbac4b (diff)
isci: remove SCIC_DEBUG_ENABLED, and fixup an odd macro
This will be replaced by state machine tracepoints and should have been a part of the logger removal. Ran across scic_sds_port_decrement_request_count() which is an ugly macro which silently hides accounting errors. Turn it into a WARN_ONCE to see if it ever triggers. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
-rw-r--r--drivers/scsi/isci/core/scic_sds_phy.c99
-rw-r--r--drivers/scsi/isci/core/scic_sds_phy.h23
-rw-r--r--drivers/scsi/isci/core/scic_sds_port.c13
-rw-r--r--drivers/scsi/isci/core/scic_sds_port.h48
4 files changed, 15 insertions, 168 deletions
diff --git a/drivers/scsi/isci/core/scic_sds_phy.c b/drivers/scsi/isci/core/scic_sds_phy.c
index 01da46ae270a..d9213e215beb 100644
--- a/drivers/scsi/isci/core/scic_sds_phy.c
+++ b/drivers/scsi/isci/core/scic_sds_phy.c
@@ -267,101 +267,6 @@ static void scic_sds_phy_sata_timeout(void *phy)
267 ); 267 );
268} 268}
269 269
270/*
271 * *****************************************************************************
272 * * SCIC SDS PHY External Methods
273 * ***************************************************************************** */
274
275/**
276 * This method returns the object size for a phy object.
277 *
278 * u32
279 */
280
281/**
282 * This method returns the minimum number of timers required for a phy object.
283 *
284 * u32
285 */
286
287/**
288 * This method returns the maximum number of timers required for a phy object.
289 *
290 * u32
291 */
292
293#ifdef SCIC_DEBUG_ENABLED
294/**
295 * scic_sds_phy_observe_state_change() -
296 * @our_observer:
297 *
298 * Debug code to record the state transitions in the phy
299 */
300void scic_sds_phy_observe_state_change(
301 struct sci_base_observer *our_observer,
302 struct sci_base_subject *the_subject)
303{
304 struct scic_sds_phy *this_phy;
305 struct sci_base_state_machine *the_state_machine;
306
307 u8 transition_requestor;
308 u32 base_state_id;
309 u32 starting_substate_id;
310
311 the_state_machine = (struct sci_base_state_machine *)the_subject;
312 this_phy = (struct scic_sds_phy *)the_state_machine->state_machine_owner;
313
314 if (the_state_machine == &this_phy->parent.state_machine) {
315 transition_requestor = 0x01;
316 } else if (the_state_machine == &this_phy->starting_substate_machine) {
317 transition_requestor = 0x02;
318 } else {
319 transition_requestor = 0xFF;
320 }
321
322 base_state_id =
323 sci_base_state_machine_get_state(&this_phy->parent.state_machine);
324 starting_substate_id =
325 sci_base_state_machine_get_state(&this_phy->starting_substate_machine);
326
327 this_phy->state_record.state_transition_table[
328 this_phy->state_record.index++] = ((transition_requestor << 24)
329 | ((u8)base_state_id << 8)
330 | ((u8)starting_substate_id));
331
332 this_phy->state_record.index =
333 this_phy->state_record.index & (MAX_STATE_TRANSITION_RECORD - 1);
334
335}
336#endif /* SCIC_DEBUG_ENABLED */
337
338#ifdef SCIC_DEBUG_ENABLED
339/**
340 * scic_sds_phy_initialize_state_recording() -
341 *
342 * This method initializes the state record debug information for the phy
343 * object. The state machines for the phy object must be constructed before
344 * this function is called.
345 */
346void scic_sds_phy_initialize_state_recording(
347 struct scic_sds_phy *this_phy)
348{
349 this_phy->state_record.index = 0;
350
351 sci_base_observer_initialize(
352 &this_phy->state_record.base_state_observer,
353 scic_sds_phy_observe_state_change,
354 &this_phy->parent.state_machine.parent
355 );
356
357 sci_base_observer_initialize(
358 &this_phy->state_record.starting_state_observer,
359 scic_sds_phy_observe_state_change,
360 &this_phy->starting_substate_machine.parent
361 );
362}
363#endif /* SCIC_DEBUG_ENABLED */
364
365/** 270/**
366 * This method will construct the struct scic_sds_phy object 271 * This method will construct the struct scic_sds_phy object
367 * @this_phy: 272 * @this_phy:
@@ -400,10 +305,6 @@ void scic_sds_phy_construct(
400 scic_sds_phy_starting_substates, 305 scic_sds_phy_starting_substates,
401 SCIC_SDS_PHY_STARTING_SUBSTATE_INITIAL 306 SCIC_SDS_PHY_STARTING_SUBSTATE_INITIAL
402 ); 307 );
403
404 #ifdef SCIC_DEBUG_ENABLED
405 scic_sds_phy_initialize_state_recording(this_phy);
406 #endif /* SCIC_DEBUG_ENABLED */
407} 308}
408 309
409/** 310/**
diff --git a/drivers/scsi/isci/core/scic_sds_phy.h b/drivers/scsi/isci/core/scic_sds_phy.h
index d9691b30e457..3b88259d7c87 100644
--- a/drivers/scsi/isci/core/scic_sds_phy.h
+++ b/drivers/scsi/isci/core/scic_sds_phy.h
@@ -156,25 +156,6 @@ enum SCIC_SDS_PHY_STARTING_SUBSTATES {
156struct scic_sds_port; 156struct scic_sds_port;
157struct scic_sds_controller; 157struct scic_sds_controller;
158 158
159#ifdef SCIC_DEBUG_ENABLED
160#define MAX_STATE_TRANSITION_RECORD (256)
161
162/**
163 *
164 *
165 * Debug code to record the state transitions for the phy object
166 */
167struct scic_sds_phy_state_record {
168 struct sci_base_observer base_state_observer;
169 struct sci_base_observer starting_state_observer;
170
171 u16 index;
172
173 u32 state_transition_table[MAX_STATE_TRANSITION_RECORD];
174
175};
176#endif /* SCIC_DEBUG_ENABLED */
177
178/** 159/**
179 * This enumeration provides a named phy type for the state machine 160 * This enumeration provides a named phy type for the state machine
180 * 161 *
@@ -271,10 +252,6 @@ struct scic_sds_phy {
271 252
272 struct sci_base_state_machine starting_substate_machine; 253 struct sci_base_state_machine starting_substate_machine;
273 254
274 #ifdef SCIC_DEBUG_ENABLED
275 struct scic_sds_phy_state_record state_record;
276 #endif /* SCIC_DEBUG_ENABLED */
277
278 /** 255 /**
279 * This field points to the link layer register set within the SCU. 256 * This field points to the link layer register set within the SCU.
280 */ 257 */
diff --git a/drivers/scsi/isci/core/scic_sds_port.c b/drivers/scsi/isci/core/scic_sds_port.c
index 9749e3abbf8e..ff06f8cb15b8 100644
--- a/drivers/scsi/isci/core/scic_sds_port.c
+++ b/drivers/scsi/isci/core/scic_sds_port.c
@@ -974,19 +974,6 @@ static void scic_sds_port_timeout_handler(void *port)
974 974
975/* --------------------------------------------------------------------------- */ 975/* --------------------------------------------------------------------------- */
976 976
977#ifdef SCIC_DEBUG_ENABLED
978void scic_sds_port_decrement_request_count(struct scic_sds_port *this_port)
979{
980 if (this_port->started_request_count == 0)
981 dev_warn(sciport_to_dev(this_port),
982 __func__,
983 "%s: SCIC Port object requested to decrement started "
984 "io count past zero.\n");
985 else
986 this_port->started_request_count--;
987}
988#endif
989
990/** 977/**
991 * This function updates the hardwares VIIT entry for this port. 978 * This function updates the hardwares VIIT entry for this port.
992 * 979 *
diff --git a/drivers/scsi/isci/core/scic_sds_port.h b/drivers/scsi/isci/core/scic_sds_port.h
index bbb9de5228ed..56c15fcbeb8d 100644
--- a/drivers/scsi/isci/core/scic_sds_port.h
+++ b/drivers/scsi/isci/core/scic_sds_port.h
@@ -63,6 +63,7 @@
63 * 63 *
64 */ 64 */
65 65
66#include <linux/kernel.h>
66#include "sci_controller_constants.h" 67#include "sci_controller_constants.h"
67#include "intel_sas.h" 68#include "intel_sas.h"
68#include "sci_base_port.h" 69#include "sci_base_port.h"
@@ -286,40 +287,21 @@ extern struct scic_sds_port_state_handler scic_sds_port_ready_substate_handler_t
286#define scic_sds_port_get_index(this_port) \ 287#define scic_sds_port_get_index(this_port) \
287 ((this_port)->physical_port_index) 288 ((this_port)->physical_port_index)
288 289
289/**
290 * scic_sds_port_increment_request_count() -
291 *
292 * Helper macro to increment the started request count
293 */
294#define scic_sds_port_increment_request_count(this_port) \
295 ((this_port)->started_request_count++)
296 290
297#ifdef SCIC_DEBUG_ENABLED 291static inline void scic_sds_port_increment_request_count(struct scic_sds_port *sci_port)
298/** 292{
299 * scic_sds_port_decrement_request_count() - This method decrements the started 293 sci_port->started_request_count++;
300 * io request count. The method will not decrment the started io request 294}
301 * count below 0 and will log a debug message if this is attempted. 295
302 * 296static inline void scic_sds_port_decrement_request_count(struct scic_sds_port *sci_port)
303 * 297{
304 */ 298 if (WARN_ONCE(sci_port->started_request_count == 0,
305void scic_sds_port_decrement_request_count( 299 "%s: tried to decrement started_request_count past 0!?",
306 struct scic_sds_port *this_port); 300 __func__))
307#else 301 /* pass */;
308/** 302 else
309 * scic_sds_port_decrement_request_count() - 303 sci_port->started_request_count--;
310 * 304}
311 * Helper macro to decrement the started io request count. The macro will not
312 * decrement the started io request count below 0.
313 */
314#define scic_sds_port_decrement_request_count(this_port) \
315 (\
316 (this_port)->started_request_count = (\
317 ((this_port)->started_request_count == 0) ? \
318 (this_port)->started_request_count : \
319 ((this_port)->started_request_count - 1) \
320 ) \
321 )
322#endif
323 305
324/** 306/**
325 * scic_sds_port_write_phy_assignment() - 307 * scic_sds_port_write_phy_assignment() -