summaryrefslogtreecommitdiffstats
path: root/sys/powerpc/booke
diff options
context:
space:
mode:
authorpfg <pfg@FreeBSD.org>2016-04-21 19:57:40 +0000
committerpfg <pfg@FreeBSD.org>2016-04-21 19:57:40 +0000
commit729533413f4e97bb65852c22fb914805e2759b5a (patch)
treecd4dfa8859a5f57124d315ff395b524d7587e1ea /sys/powerpc/booke
parent0d55061d05ce55d28aff0c06bad831448d172425 (diff)
downloadFreeBSD-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/powerpc/booke')
-rw-r--r--sys/powerpc/booke/pmap.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/powerpc/booke/pmap.c b/sys/powerpc/booke/pmap.c
index 50cd78a..cd71526 100644
--- a/sys/powerpc/booke/pmap.c
+++ b/sys/powerpc/booke/pmap.c
@@ -2687,7 +2687,7 @@ mmu_booke_dumpsys_map(mmu_t mmu, vm_paddr_t pa, size_t sz, void **va)
/* Raw physical memory dumps don't have a virtual address. */
/* We always map a 256MB page at 256M. */
gran = 256 * 1024 * 1024;
- ppa = pa & ~(gran - 1);
+ ppa = rounddown2(pa, gran);
ofs = pa - ppa;
*va = (void *)gran;
tlb1_set_entry((vm_offset_t)va, ppa, gran, _TLB_ENTRY_IO);
@@ -2725,7 +2725,7 @@ mmu_booke_dumpsys_unmap(mmu_t mmu, vm_paddr_t pa, size_t sz, void *va)
tlb1_write_entry(&e, i);
gran = 256 * 1024 * 1024;
- ppa = pa & ~(gran - 1);
+ ppa = rounddown2(pa, gran);
ofs = pa - ppa;
if (sz > (gran - ofs)) {
i--;
@@ -3332,7 +3332,7 @@ tlb1_mapin_region(vm_offset_t va, vm_paddr_t pa, vm_size_t size)
int idx, nents;
/* Round up to the next 1M */
- size = (size + (1 << 20) - 1) & ~((1 << 20) - 1);
+ size = roundup2(size, 1 << 20);
mapped = 0;
idx = 0;
OpenPOWER on IntegriCloud