sys/powerpc: make use of the howmany() macro when available.
We have a howmany() macro in the <sys/param.h> header that is convenient to re-use as it makes things easier to read.
This commit is contained in:
parent
9af9422682
commit
910c079886
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=298642
@ -1115,8 +1115,8 @@ mmu_booke_bootstrap(mmu_t mmu, vm_offset_t start, vm_offset_t kernelend)
|
||||
|
||||
/* Allocate PTE tables for kernel KVA. */
|
||||
kernel_pdir = data_end;
|
||||
kernel_ptbls = (VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS +
|
||||
PDIR_SIZE - 1) / PDIR_SIZE;
|
||||
kernel_ptbls = howmany(VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS,
|
||||
PDIR_SIZE);
|
||||
data_end += kernel_ptbls * PTBL_PAGES * PAGE_SIZE;
|
||||
debugf(" kernel ptbls: %d\n", kernel_ptbls);
|
||||
debugf(" kernel pdir at 0x%08x end = 0x%08x\n", kernel_pdir, data_end);
|
||||
|
@ -271,7 +271,7 @@ set_clock(struct fsl_sdhc_softc *sc, uint32_t clock)
|
||||
* divisor = ceil(base_clock / clock)
|
||||
* TODO: Reconsider symmetric rounding here instead of ceiling.
|
||||
*/
|
||||
divisor = (base_clock + clock - 1) / clock;
|
||||
divisor = howmany(base_clock, clock);
|
||||
|
||||
while (divisor > 16) {
|
||||
round = divisor & 0x1;
|
||||
|
@ -301,7 +301,7 @@ DELAY(int n)
|
||||
u_quad_t tb, ttb;
|
||||
|
||||
tb = mftb();
|
||||
ttb = tb + (n * 1000 + ns_per_tick - 1) / ns_per_tick;
|
||||
ttb = tb + howmany(n * 1000, ns_per_tick);
|
||||
while (tb < ttb)
|
||||
tb = mftb();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user