diff options
author | Eric Anholt <eric@anholt.net> | 2007-10-09 12:12:34 -0700 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2007-10-09 12:12:34 -0700 |
commit | 042735df2aa5846fcabfd74c5f73877132728b25 (patch) | |
tree | 8268307b3dbbb58ac0a95e78b6fceb00d61466d2 | |
parent | 4bdaca5295eeacdaeb80f2e7d0fa17674dcbc77a (diff) |
FreeBSD: don't set the MTRR if it's the default mode (uncacheable).
-rw-r--r-- | src/freebsd_pci.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/freebsd_pci.c b/src/freebsd_pci.c index 84a0a78..be934a8 100644 --- a/src/freebsd_pci.c +++ b/src/freebsd_pci.c @@ -108,8 +108,11 @@ pci_device_freebsd_map_range(struct pci_device *dev, mro.mo_desc = &mrd; mro.mo_arg[0] = MEMRANGE_SET_UPDATE; - if (ioctl(fd, MEMRANGE_SET, &mro)) { - fprintf(stderr, "failed to set mtrr: %s\n", strerror(errno)); + /* No need to set an MTRR if it's the default mode. */ + if (mrd.mr_flags != MDF_UNCACHEABLE) { + if (ioctl(fd, MEMRANGE_SET, &mro)) { + fprintf(stderr, "failed to set mtrr: %s\n", strerror(errno)); + } } close(fd); |