diff options
author | Jeremy Katz <katzj@redhat.com> | 2003-10-24 19:15:27 +0000 |
---|---|---|
committer | Jeremy Katz <katzj@redhat.com> | 2003-10-24 19:15:27 +0000 |
commit | 7919d6a98026d84bd1c24fa14f0c7400bbf67caf (patch) | |
tree | 6e98b53fe1b17cf9c47a6064084bb40893226e2a | |
parent | 718e77dfd51bdadf8c53a580d52354f90296fde8 (diff) | |
download | anaconda-7919d6a98026d84bd1c24fa14f0c7400bbf67caf.tar.gz anaconda-7919d6a98026d84bd1c24fa14f0c7400bbf67caf.tar.xz anaconda-7919d6a98026d84bd1c24fa14f0c7400bbf67caf.zip |
FIXME: having dma on for CD devices seems to break media check
as well as causing other problems for people. To avoid having
to tell everyone to use ide=nodma all the time, let's do it
ourselves for IDE cdrom devices (#107280)
-rw-r--r-- | loader2/hardware.c | 38 | ||||
-rw-r--r-- | loader2/loader.c | 2 | ||||
-rw-r--r-- | loader2/loader.h | 4 |
3 files changed, 44 insertions, 0 deletions
diff --git a/loader2/hardware.c b/loader2/hardware.c index 7638bcbbd..c108f6570 100644 --- a/loader2/hardware.c +++ b/loader2/hardware.c @@ -16,6 +16,7 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include <errno.h> #include <fcntl.h> #include <kudzu/kudzu.h> #include <popt.h> @@ -29,6 +30,12 @@ #include "pcmcia.h" #include "log.h" +/* FIXME: for turning off dma */ +#include <sys/ioctl.h> +#include <linux/hdreg.h> +#include "../isys/isys.h" + + /* JKFIXME: this is the same hack as in loader.c for second stage modules */ extern struct moduleBallLocation * secondStageModuleLocation; @@ -309,7 +316,38 @@ void scsiSetup(moduleList modLoaded, moduleDeps modDeps, void ideSetup(moduleList modLoaded, moduleDeps modDeps, moduleInfoSet modInfo, int flags, struct knownDevices * kd) { + struct device ** devices; + int fd, i; + mlLoadModuleSet("ide-cd", modLoaded, modDeps, modInfo, flags); + + /* FIXME: having dma on for CD devices seems to break media check + * as well as causing other problems for people. To avoid having + * to tell everyone to use ide=nodma all the time, let's do it + * ourselves. + */ + if (FL_ENABLECDDMA(flags)) + return; + devices = probeDevices(CLASS_CDROM, BUS_IDE, PROBE_ALL); + for (i = 0; devices[i]; i++) { + if ((devices[i]->detached != 0) || (devices[i]->device == NULL)) + continue; + devMakeInode(devices[i]->device, "/tmp/cdrom"); + fd = open("/tmp/cdrom", O_RDONLY|O_NONBLOCK); + if (fd == -1) { + logMessage("failed to open /tmp/cdrom: %s", strerror(errno)); + unlink("/tmp/cdrom"); + continue; + } + if (ioctl(fd, HDIO_SET_DMA, 0) == -1) + logMessage("failed to disable dma for %s: %s", devices[i]->device, + strerror(errno)); + else + logMessage("disabled DMA for CD devices %s", devices[i]->device); + close(fd); + unlink("/tmp/cdrom"); + } + } diff --git a/loader2/loader.c b/loader2/loader.c index d3086a8ba..03f4f8848 100644 --- a/loader2/loader.c +++ b/loader2/loader.c @@ -553,6 +553,8 @@ static int parseCmdLineFlags(int flags, struct loaderData_s * loaderData, loaderData->dns = strdup(argv[i] + 4); else if (!strncasecmp(argv[i], "ethtool=", 8)) loaderData->ethtool = strdup(argv[i] + 8); + else if (!strncasecmp(argv[i], "allowcddma", 10)) + flags |= LOADER_FLAGS_ENABLECDDMA; else if (numExtraArgs < (MAX_EXTRA_ARGS - 1)) { /* go through and append args we just want to pass on to */ /* the anaconda script, but don't want to represent as a */ diff --git a/loader2/loader.h b/loader2/loader.h index 711a969a5..f18705759 100644 --- a/loader2/loader.h +++ b/loader2/loader.h @@ -32,6 +32,8 @@ #define LOADER_FLAGS_NOFB (1 << 27) #define LOADER_FLAGS_CMDLINE (1 << 28) #define LOADER_FLAGS_GRAPHICAL (1 << 29) +/* FIXME: this should go away */ +#define LOADER_FLAGS_ENABLECDDMA (1 << 13) #define FL_TESTING(a) ((a) & LOADER_FLAGS_TESTING) #define FL_EXPERT(a) ((a) & LOADER_FLAGS_EXPERT) @@ -60,6 +62,8 @@ #define FL_NOFB(a) ((a) & LOADER_FLAGS_NOFB) #define FL_GRAPHICAL(a) ((a) & LOADER_FLAGS_GRAPHICAL) #define FL_CMDLINE(a) ((a) & LOADER_FLAGS_CMDLINE) +/* FIXME: this should go away */ +#define FL_ENABLECDDMA(a) ((a) & LOADER_FLAGS_ENABLECDDMA) void startNewt(int flags); |