diff options
author | pfg <pfg@FreeBSD.org> | 2016-04-21 19:57:40 +0000 |
---|---|---|
committer | pfg <pfg@FreeBSD.org> | 2016-04-21 19:57:40 +0000 |
commit | 729533413f4e97bb65852c22fb914805e2759b5a (patch) | |
tree | cd4dfa8859a5f57124d315ff395b524d7587e1ea /sys/dev/agp | |
parent | 0d55061d05ce55d28aff0c06bad831448d172425 (diff) | |
download | FreeBSD-src-729533413f4e97bb65852c22fb914805e2759b5a.zip FreeBSD-src-729533413f4e97bb65852c22fb914805e2759b5a.tar.gz |
sys: use our roundup2/rounddown2() macros when param.h is available.
rounddown2 tends to produce longer lines than the original code
and when the code has a high indentation level it was not really
advantageous to do the replacement.
This tries to strike a balance between readability using the macros
and flexibility of having the expressions, so not everything is
converted.
Diffstat (limited to 'sys/dev/agp')
-rw-r--r-- | sys/dev/agp/agp_nvidia.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/dev/agp/agp_nvidia.c b/sys/dev/agp/agp_nvidia.c index a0098f0..61ae551 100644 --- a/sys/dev/agp/agp_nvidia.c +++ b/sys/dev/agp/agp_nvidia.c @@ -216,8 +216,8 @@ agp_nvidia_attach (device_t dev) if (sc->num_dirs == 0) { sc->num_dirs = 1; sc->num_active_entries /= (64 / size); - sc->pg_offset = (apbase & (64 * 1024 * 1024 - 1) & - ~(AGP_GET_APERTURE(dev) - 1)) / PAGE_SIZE; + sc->pg_offset = rounddown2(apbase & (64 * 1024 * 1024 - 1), + AGP_GET_APERTURE(dev)) / PAGE_SIZE; } /* (G)ATT Base Address */ @@ -410,7 +410,7 @@ nvidia_init_iorr(u_int32_t addr, u_int32_t size) } base = (addr & ~0xfff) | 0x18; - mask = (0xfULL << 32) | ((~(size - 1)) & 0xfffff000) | 0x800; + mask = (0xfULL << 32) | rounddown2(0xfffff000, size) | 0x800; wrmsr(IORR_BASE0 + 2 * iorr_addr, base); wrmsr(IORR_MASK0 + 2 * iorr_addr, mask); |