From 74fd1b687fbeba566ceb59cc1fdbc7a64c5e0c0b Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Tue, 29 May 2007 16:01:35 -0700 Subject: alpha: cleanup in bitops.h Remove 2 functions private to the alpha implemetation, in favor of similar functions in . Provide a more efficient version of the fls64 function for pre-ev67 alphas. Signed-off-by: Richard Henderson Signed-off-by: Linus Torvalds --- arch/alpha/kernel/pci_iommu.c | 3 ++- arch/alpha/kernel/setup.c | 3 ++- arch/alpha/lib/Makefile | 3 ++- arch/alpha/lib/fls.c | 38 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 arch/alpha/lib/fls.c (limited to 'arch/alpha') diff --git a/arch/alpha/kernel/pci_iommu.c b/arch/alpha/kernel/pci_iommu.c index 6e7d1fe6e935..28c84e55feb9 100644 --- a/arch/alpha/kernel/pci_iommu.c +++ b/arch/alpha/kernel/pci_iommu.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -53,7 +54,7 @@ size_for_memory(unsigned long max) { unsigned long mem = max_low_pfn << PAGE_SHIFT; if (mem < max) - max = 1UL << ceil_log2(mem); + max = roundup_pow_of_two(mem); return max; } diff --git a/arch/alpha/kernel/setup.c b/arch/alpha/kernel/setup.c index 915f26345c45..bd5e68cd61e8 100644 --- a/arch/alpha/kernel/setup.c +++ b/arch/alpha/kernel/setup.c @@ -43,6 +43,7 @@ #include #include #include +#include extern struct atomic_notifier_head panic_notifier_list; static int alpha_panic_event(struct notifier_block *, unsigned long, void *); @@ -1303,7 +1304,7 @@ external_cache_probe(int minsize, int width) long size = minsize, maxsize = MAX_BCACHE_SIZE * 2; if (maxsize > (max_low_pfn + 1) << PAGE_SHIFT) - maxsize = 1 << (floor_log2(max_low_pfn + 1) + PAGE_SHIFT); + maxsize = 1 << (ilog2(max_low_pfn + 1) + PAGE_SHIFT); /* Get the first block cached. */ read_mem_block(__va(0), stride, size); diff --git a/arch/alpha/lib/Makefile b/arch/alpha/lib/Makefile index ea098f3b629f..266f78e13076 100644 --- a/arch/alpha/lib/Makefile +++ b/arch/alpha/lib/Makefile @@ -37,7 +37,8 @@ lib-y = __divqu.o __remqu.o __divlu.o __remlu.o \ $(ev6-y)clear_page.o \ $(ev6-y)copy_page.o \ fpreg.o \ - callback_srm.o srm_puts.o srm_printk.o + callback_srm.o srm_puts.o srm_printk.o \ + fls.o lib-$(CONFIG_SMP) += dec_and_lock.o diff --git a/arch/alpha/lib/fls.c b/arch/alpha/lib/fls.c new file mode 100644 index 000000000000..7ad84ea0acf8 --- /dev/null +++ b/arch/alpha/lib/fls.c @@ -0,0 +1,38 @@ +/* + * arch/alpha/lib/fls.c + */ + +#include +#include + +/* This is fls(x)-1, except zero is held to zero. This allows most + efficent input into extbl, plus it allows easy handling of fls(0)=0. */ + +const unsigned char __flsm1_tab[256] = +{ + 0, + 0, + 1, 1, + 2, 2, 2, 2, + 3, 3, 3, 3, 3, 3, 3, 3, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, +}; + +EXPORT_SYMBOL(__flsm1_tab); -- cgit v1.2.3-59-g8ed1b