Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8bc588e

Browse files
lkundrakStefan Richter
authored andcommitted
firewire: ohci: Turn remote DMA support into a module parameter
This makes it possible to debug kernel over FireWire without the need to recompile it. [Stefan R: changed description from "...0" to "...N"] Cc: Dave Hansen <[email protected]> Signed-off-by: Lubomir Rintel <[email protected]> Signed-off-by: Stefan Richter <[email protected]>
1 parent a9954ce commit 8bc588e

File tree

3 files changed

+12
-22
lines changed

3 files changed

+12
-22
lines changed

Documentation/debugging-via-ohci1394.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,7 @@ Drivers
3838

3939
The firewire-ohci driver in drivers/firewire uses filtered physical
4040
DMA by default, which is more secure but not suitable for remote debugging.
41-
Compile the driver with CONFIG_FIREWIRE_OHCI_REMOTE_DMA (Kernel hacking menu:
42-
Remote debugging over FireWire with firewire-ohci) to get unfiltered physical
43-
DMA.
41+
Pass the remote_dma=1 parameter to the driver to get unfiltered physical DMA.
4442

4543
Because the firewire-ohci driver depends on the PCI enumeration to be
4644
completed, an initialization routine which runs pretty early has been

drivers/firewire/ohci.c

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,10 @@ MODULE_PARM_DESC(debug, "Verbose logging (default = 0"
370370
", busReset events = " __stringify(OHCI_PARAM_DEBUG_BUSRESETS)
371371
", or a combination, or all = -1)");
372372

373+
static bool param_remote_dma;
374+
module_param_named(remote_dma, param_remote_dma, bool, 0444);
375+
MODULE_PARM_DESC(remote_dma, "Enable unfiltered remote DMA (default = N)");
376+
373377
static void log_irqs(struct fw_ohci *ohci, u32 evt)
374378
{
375379
if (likely(!(param_debug &
@@ -2050,10 +2054,10 @@ static void bus_reset_work(struct work_struct *work)
20502054
be32_to_cpu(ohci->next_header));
20512055
}
20522056

2053-
#ifdef CONFIG_FIREWIRE_OHCI_REMOTE_DMA
2054-
reg_write(ohci, OHCI1394_PhyReqFilterHiSet, ~0);
2055-
reg_write(ohci, OHCI1394_PhyReqFilterLoSet, ~0);
2056-
#endif
2057+
if (param_remote_dma) {
2058+
reg_write(ohci, OHCI1394_PhyReqFilterHiSet, ~0);
2059+
reg_write(ohci, OHCI1394_PhyReqFilterLoSet, ~0);
2060+
}
20572061

20582062
spin_unlock_irq(&ohci->lock);
20592063

@@ -2587,13 +2591,13 @@ static int ohci_cancel_packet(struct fw_card *card, struct fw_packet *packet)
25872591
static int ohci_enable_phys_dma(struct fw_card *card,
25882592
int node_id, int generation)
25892593
{
2590-
#ifdef CONFIG_FIREWIRE_OHCI_REMOTE_DMA
2591-
return 0;
2592-
#else
25932594
struct fw_ohci *ohci = fw_ohci(card);
25942595
unsigned long flags;
25952596
int n, ret = 0;
25962597

2598+
if (param_remote_dma)
2599+
return 0;
2600+
25972601
/*
25982602
* FIXME: Make sure this bitmask is cleared when we clear the busReset
25992603
* interrupt bit. Clear physReqResourceAllBuses on bus reset.
@@ -2622,7 +2626,6 @@ static int ohci_enable_phys_dma(struct fw_card *card,
26222626
spin_unlock_irqrestore(&ohci->lock, flags);
26232627

26242628
return ret;
2625-
#endif /* CONFIG_FIREWIRE_OHCI_REMOTE_DMA */
26262629
}
26272630

26282631
static u32 ohci_read_csr(struct fw_card *card, int csr_offset)

lib/Kconfig.debug

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1547,17 +1547,6 @@ config PROVIDE_OHCI1394_DMA_INIT
15471547

15481548
See Documentation/debugging-via-ohci1394.txt for more information.
15491549

1550-
config FIREWIRE_OHCI_REMOTE_DMA
1551-
bool "Remote debugging over FireWire with firewire-ohci"
1552-
depends on FIREWIRE_OHCI
1553-
help
1554-
This option lets you use the FireWire bus for remote debugging
1555-
with help of the firewire-ohci driver. It enables unfiltered
1556-
remote DMA in firewire-ohci.
1557-
See Documentation/debugging-via-ohci1394.txt for more information.
1558-
1559-
If unsure, say N.
1560-
15611550
config BUILD_DOCSRC
15621551
bool "Build targets in Documentation/ tree"
15631552
depends on HEADERS_CHECK

0 commit comments

Comments
 (0)