Skip to content

Commit f83a052

Browse files
aaeeggtakaswie
authored andcommitted
firewire: core: option to log bus reset initiation
Add a debug parameter to firewire-core, analogous to the one in firewire-ohci. When this is set to 1, log when we schedule, delay, or initiate a bus reset. Since FireWire bus resets can originate from any node on the bus, specific logging of the resets we initiate provides additional insight. Signed-off-by: Adam Goldman <[email protected]> Signed-off-by: Takashi Sakamoto <[email protected]>
1 parent dd5a440 commit f83a052

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

drivers/firewire/core-card.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,11 +221,19 @@ static int reset_bus(struct fw_card *card, bool short_reset)
221221
int reg = short_reset ? 5 : 1;
222222
int bit = short_reset ? PHY_BUS_SHORT_RESET : PHY_BUS_RESET;
223223

224+
if (unlikely(fw_core_param_debug & FW_CORE_PARAM_DEBUG_BUSRESETS))
225+
fw_notice(card, "initiating %s bus reset\n",
226+
short_reset ? "short" : "long");
227+
224228
return card->driver->update_phy_reg(card, reg, 0, bit);
225229
}
226230

227231
void fw_schedule_bus_reset(struct fw_card *card, bool delayed, bool short_reset)
228232
{
233+
if (unlikely(fw_core_param_debug & FW_CORE_PARAM_DEBUG_BUSRESETS))
234+
fw_notice(card, "scheduling %s bus reset\n",
235+
short_reset ? "short" : "long");
236+
229237
/* We don't try hard to sort out requests of long vs. short resets. */
230238
card->br_short = short_reset;
231239

@@ -244,6 +252,8 @@ static void br_work(struct work_struct *work)
244252
/* Delay for 2s after last reset per IEEE 1394 clause 8.2.1. */
245253
if (card->reset_jiffies != 0 &&
246254
time_before64(get_jiffies_64(), card->reset_jiffies + 2 * HZ)) {
255+
if (unlikely(fw_core_param_debug & FW_CORE_PARAM_DEBUG_BUSRESETS))
256+
fw_notice(card, "delaying bus reset\n");
247257
if (!queue_delayed_work(fw_workqueue, &card->br_work, 2 * HZ))
248258
fw_card_put(card);
249259
return;

drivers/firewire/core-transaction.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1385,5 +1385,12 @@ static void __exit fw_core_cleanup(void)
13851385
idr_destroy(&fw_device_idr);
13861386
}
13871387

1388+
int fw_core_param_debug;
1389+
module_param_named(debug, fw_core_param_debug, int, 0644);
1390+
MODULE_PARM_DESC(debug, "Verbose logging (default = 0"
1391+
", bus resets = " __stringify(FW_CORE_PARAM_DEBUG_BUSRESETS)
1392+
")");
1393+
1394+
13881395
module_init(fw_core_init);
13891396
module_exit(fw_core_cleanup);

drivers/firewire/core.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,10 @@ static inline bool is_next_generation(int new_generation, int old_generation)
238238
/* OHCI-1394's default upper bound for physical DMA: 4 GB */
239239
#define FW_MAX_PHYSICAL_RANGE (1ULL << 32)
240240

241+
#define FW_CORE_PARAM_DEBUG_BUSRESETS 1
242+
243+
extern int fw_core_param_debug;
244+
241245
void fw_core_handle_request(struct fw_card *card, struct fw_packet *request);
242246
void fw_core_handle_response(struct fw_card *card, struct fw_packet *packet);
243247
int fw_get_response_length(struct fw_request *request);

0 commit comments

Comments
 (0)