summaryrefslogtreecommitdiffstats
path: root/sys/dev/firewire
diff options
context:
space:
mode:
authorsimokawa <simokawa@FreeBSD.org>2007-06-07 13:20:48 +0000
committersimokawa <simokawa@FreeBSD.org>2007-06-07 13:20:48 +0000
commit18d7fd2d4371f5d79c2ac1c217e458bfda61f04d (patch)
tree83fc5cd4b3460eb14dfa30054d61cacad953ae19 /sys/dev/firewire
parent50b46323332dccf71371a6dcce216db32734e531 (diff)
downloadFreeBSD-src-18d7fd2d4371f5d79c2ac1c217e458bfda61f04d.zip
FreeBSD-src-18d7fd2d4371f5d79c2ac1c217e458bfda61f04d.tar.gz
Add a tunable hw.firewire.phydma_enable.
This is enabled by default. It should be disabled for those who are uneasy with peeking/poking from FireWire. Please note sbp(4) and dcons(4) over FireWire need this feature.
Diffstat (limited to 'sys/dev/firewire')
-rw-r--r--sys/dev/firewire/firewirereg.h1
-rw-r--r--sys/dev/firewire/fwohci.c17
-rw-r--r--sys/dev/firewire/sbp.c7
3 files changed, 19 insertions, 6 deletions
diff --git a/sys/dev/firewire/firewirereg.h b/sys/dev/firewire/firewirereg.h
index 5038868..d2d9d65 100644
--- a/sys/dev/firewire/firewirereg.h
+++ b/sys/dev/firewire/firewirereg.h
@@ -299,6 +299,7 @@ int fw_open_isodma(struct firewire_comm *, int);
extern int firewire_debug;
extern devclass_t firewire_devclass;
+extern int firewire_phydma_enable;
#ifdef __DragonFly__
#define FWPRI PCATCH
diff --git a/sys/dev/firewire/fwohci.c b/sys/dev/firewire/fwohci.c
index 06bdc01..cf8dfec 100644
--- a/sys/dev/firewire/fwohci.c
+++ b/sys/dev/firewire/fwohci.c
@@ -79,9 +79,13 @@
#undef OHCI_DEBUG
static int nocyclemaster = 0;
+int firewire_phydma_enable = 1;
SYSCTL_DECL(_hw_firewire);
SYSCTL_INT(_hw_firewire, OID_AUTO, nocyclemaster, CTLFLAG_RW, &nocyclemaster, 0,
"Do not send cycle start packets");
+SYSCTL_INT(_hw_firewire, OID_AUTO, phydma_enable, CTLFLAG_RW,
+ &firewire_phydma_enable, 1, "Allow physical request DMA from firewire");
+TUNABLE_INT("hw.firewire.phydma_enable", &firewire_phydma_enable);
static char dbcode[16][0x10]={"OUTM", "OUTL","INPM","INPL",
"STOR","LOAD","NOP ","STOP",};
@@ -1862,12 +1866,13 @@ fwohci_intr_core(struct fwohci_softc *sc, uint32_t stat, int count)
/* Allow async. request to us */
OWRITE(sc, OHCI_AREQHI, 1 << 31);
- /* XXX insecure ?? */
- /* allow from all nodes */
- OWRITE(sc, OHCI_PREQHI, 0x7fffffff);
- OWRITE(sc, OHCI_PREQLO, 0xffffffff);
- /* 0 to 4GB regison */
- OWRITE(sc, OHCI_PREQUPPER, 0x10000);
+ if (firewire_phydma_enable) {
+ /* allow from all nodes */
+ OWRITE(sc, OHCI_PREQHI, 0x7fffffff);
+ OWRITE(sc, OHCI_PREQLO, 0xffffffff);
+ /* 0 to 4GB region */
+ OWRITE(sc, OHCI_PREQUPPER, 0x10000);
+ }
/* Set ATRetries register */
OWRITE(sc, OHCI_ATRETRY, 1<<(13+16) | 0xfff);
diff --git a/sys/dev/firewire/sbp.c b/sys/dev/firewire/sbp.c
index 2d14bfd..6dc4de9 100644
--- a/sys/dev/firewire/sbp.c
+++ b/sys/dev/firewire/sbp.c
@@ -824,6 +824,10 @@ sbp_post_explore(void *arg)
SBP_DEBUG(0)
printf("sbp_post_explore (sbp_cold=%d)\n", sbp_cold);
END_DEBUG
+ /* We need physical access */
+ if (!firewire_phydma_enable)
+ return;
+
if (sbp_cold > 0)
sbp_cold --;
@@ -1946,6 +1950,9 @@ sbp_attach(device_t dev)
"SBP_MAXPHYS(%dKB).\n", DFLTPHYS / 1024,
SBP_MAXPHYS / 1024);
+ if (!firewire_phydma_enable)
+ device_printf(dev, "Warning, hw.firewire.phydma_enable must be 1 "
+ "for SBP over FireWire.\n");
SBP_DEBUG(0)
printf("sbp_attach (cold=%d)\n", cold);
END_DEBUG
OpenPOWER on IntegriCloud