Skip to content

Commit a007bb8

Browse files
author
Stefan Richter
committed
firewire: fw-ohci: conditionally log busReset interrupts
Add a debug option to watch bus reset interrupt events. Half of this patch is taken from Jarod Wilson's first version of the JMicron fix. BusReset interrupts are only generated if the respective module parameter flag was set before the controller is being initialized. Else we keep this event masked to reduce IRQ load in normal operation and to avoid potential problems with buggy chips. Note, this is unlike the other IRQ events whose logging can be enabled any time after chip initialization. This and the influence on what interrupts the chip generates is why I added an extra flag for it. Also, reorder the debug parameter flags according to their perceived usefulness. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> Signed-off-by: Jarod Wilson <jwilson@redhat.com>
1 parent 76f73ca commit a007bb8

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

drivers/firewire/fw-ohci.c

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -240,24 +240,32 @@ static char ohci_driver_name[] = KBUILD_MODNAME;
240240

241241
#ifdef CONFIG_FIREWIRE_OHCI_DEBUG
242242

243-
#define OHCI_PARAM_DEBUG_IRQS 1
243+
#define OHCI_PARAM_DEBUG_AT_AR 1
244244
#define OHCI_PARAM_DEBUG_SELFIDS 2
245-
#define OHCI_PARAM_DEBUG_AT_AR 4
245+
#define OHCI_PARAM_DEBUG_IRQS 4
246+
#define OHCI_PARAM_DEBUG_BUSRESETS 8 /* only effective before chip init */
246247

247248
static int param_debug;
248249
module_param_named(debug, param_debug, int, 0644);
249250
MODULE_PARM_DESC(debug, "Verbose logging (default = 0"
250-
", IRQs = " __stringify(OHCI_PARAM_DEBUG_IRQS)
251-
", self-IDs = " __stringify(OHCI_PARAM_DEBUG_SELFIDS)
252251
", AT/AR events = " __stringify(OHCI_PARAM_DEBUG_AT_AR)
252+
", self-IDs = " __stringify(OHCI_PARAM_DEBUG_SELFIDS)
253+
", IRQs = " __stringify(OHCI_PARAM_DEBUG_IRQS)
254+
", busReset events = " __stringify(OHCI_PARAM_DEBUG_BUSRESETS)
253255
", or a combination, or all = -1)");
254256

255257
static void log_irqs(u32 evt)
256258
{
257-
if (likely(!(param_debug & OHCI_PARAM_DEBUG_IRQS)))
259+
if (likely(!(param_debug &
260+
(OHCI_PARAM_DEBUG_IRQS | OHCI_PARAM_DEBUG_BUSRESETS))))
261+
return;
262+
263+
if (!(param_debug & OHCI_PARAM_DEBUG_IRQS) &&
264+
!(evt & OHCI1394_busReset))
258265
return;
259266

260-
printk(KERN_DEBUG KBUILD_MODNAME ": IRQ %08x%s%s%s%s%s%s%s%s%s%s%s%s\n",
267+
printk(KERN_DEBUG KBUILD_MODNAME ": IRQ "
268+
"%08x%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
261269
evt,
262270
evt & OHCI1394_selfIDComplete ? " selfID" : "",
263271
evt & OHCI1394_RQPkt ? " AR_req" : "",
@@ -270,12 +278,13 @@ static void log_irqs(u32 evt)
270278
evt & OHCI1394_cycleTooLong ? " cycleTooLong" : "",
271279
evt & OHCI1394_cycle64Seconds ? " cycle64Seconds" : "",
272280
evt & OHCI1394_regAccessFail ? " regAccessFail" : "",
281+
evt & OHCI1394_busReset ? " busReset" : "",
273282
evt & ~(OHCI1394_selfIDComplete | OHCI1394_RQPkt |
274283
OHCI1394_RSPkt | OHCI1394_reqTxComplete |
275284
OHCI1394_respTxComplete | OHCI1394_isochRx |
276285
OHCI1394_isochTx | OHCI1394_postedWriteErr |
277286
OHCI1394_cycleTooLong | OHCI1394_cycle64Seconds |
278-
OHCI1394_regAccessFail)
287+
OHCI1394_regAccessFail | OHCI1394_busReset)
279288
? " ?" : "");
280289
}
281290

@@ -1328,7 +1337,8 @@ static irqreturn_t irq_handler(int irq, void *data)
13281337
if (!event || !~event)
13291338
return IRQ_NONE;
13301339

1331-
reg_write(ohci, OHCI1394_IntEventClear, event);
1340+
/* busReset must not be cleared yet, see OHCI 1.1 clause 7.2.3.2 */
1341+
reg_write(ohci, OHCI1394_IntEventClear, event & ~OHCI1394_busReset);
13321342
log_irqs(event);
13331343

13341344
if (event & OHCI1394_selfIDComplete)
@@ -1467,6 +1477,8 @@ static int ohci_enable(struct fw_card *card, u32 *config_rom, size_t length)
14671477
OHCI1394_postedWriteErr | OHCI1394_cycleTooLong |
14681478
OHCI1394_cycle64Seconds | OHCI1394_regAccessFail |
14691479
OHCI1394_masterIntEnable);
1480+
if (param_debug & OHCI_PARAM_DEBUG_BUSRESETS)
1481+
reg_write(ohci, OHCI1394_IntMaskSet, OHCI1394_busReset);
14701482

14711483
/* Activate link_on bit and contender bit in our self ID packets.*/
14721484
if (ohci_update_phy_reg(card, 4, 0,

0 commit comments

Comments
 (0)