diff options
Diffstat (limited to 'arch/alpha')
-rw-r--r-- | arch/alpha/kernel/pci_iommu.c | 3 | ||||
-rw-r--r-- | arch/alpha/kernel/setup.c | 3 | ||||
-rw-r--r-- | arch/alpha/lib/Makefile | 3 | ||||
-rw-r--r-- | arch/alpha/lib/fls.c | 38 |
4 files changed, 44 insertions, 3 deletions
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 @@ | |||
7 | #include <linux/pci.h> | 7 | #include <linux/pci.h> |
8 | #include <linux/slab.h> | 8 | #include <linux/slab.h> |
9 | #include <linux/bootmem.h> | 9 | #include <linux/bootmem.h> |
10 | #include <linux/log2.h> | ||
10 | 11 | ||
11 | #include <asm/io.h> | 12 | #include <asm/io.h> |
12 | #include <asm/hwrpb.h> | 13 | #include <asm/hwrpb.h> |
@@ -53,7 +54,7 @@ size_for_memory(unsigned long max) | |||
53 | { | 54 | { |
54 | unsigned long mem = max_low_pfn << PAGE_SHIFT; | 55 | unsigned long mem = max_low_pfn << PAGE_SHIFT; |
55 | if (mem < max) | 56 | if (mem < max) |
56 | max = 1UL << ceil_log2(mem); | 57 | max = roundup_pow_of_two(mem); |
57 | return max; | 58 | return max; |
58 | } | 59 | } |
59 | 60 | ||
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 @@ | |||
43 | #include <linux/notifier.h> | 43 | #include <linux/notifier.h> |
44 | #include <asm/setup.h> | 44 | #include <asm/setup.h> |
45 | #include <asm/io.h> | 45 | #include <asm/io.h> |
46 | #include <linux/log2.h> | ||
46 | 47 | ||
47 | extern struct atomic_notifier_head panic_notifier_list; | 48 | extern struct atomic_notifier_head panic_notifier_list; |
48 | static int alpha_panic_event(struct notifier_block *, unsigned long, void *); | 49 | static int alpha_panic_event(struct notifier_block *, unsigned long, void *); |
@@ -1303,7 +1304,7 @@ external_cache_probe(int minsize, int width) | |||
1303 | long size = minsize, maxsize = MAX_BCACHE_SIZE * 2; | 1304 | long size = minsize, maxsize = MAX_BCACHE_SIZE * 2; |
1304 | 1305 | ||
1305 | if (maxsize > (max_low_pfn + 1) << PAGE_SHIFT) | 1306 | if (maxsize > (max_low_pfn + 1) << PAGE_SHIFT) |
1306 | maxsize = 1 << (floor_log2(max_low_pfn + 1) + PAGE_SHIFT); | 1307 | maxsize = 1 << (ilog2(max_low_pfn + 1) + PAGE_SHIFT); |
1307 | 1308 | ||
1308 | /* Get the first block cached. */ | 1309 | /* Get the first block cached. */ |
1309 | read_mem_block(__va(0), stride, size); | 1310 | 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 \ | |||
37 | $(ev6-y)clear_page.o \ | 37 | $(ev6-y)clear_page.o \ |
38 | $(ev6-y)copy_page.o \ | 38 | $(ev6-y)copy_page.o \ |
39 | fpreg.o \ | 39 | fpreg.o \ |
40 | callback_srm.o srm_puts.o srm_printk.o | 40 | callback_srm.o srm_puts.o srm_printk.o \ |
41 | fls.o | ||
41 | 42 | ||
42 | lib-$(CONFIG_SMP) += dec_and_lock.o | 43 | lib-$(CONFIG_SMP) += dec_and_lock.o |
43 | 44 | ||
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 @@ | |||
1 | /* | ||
2 | * arch/alpha/lib/fls.c | ||
3 | */ | ||
4 | |||
5 | #include <linux/module.h> | ||
6 | #include <asm/bitops.h> | ||
7 | |||
8 | /* This is fls(x)-1, except zero is held to zero. This allows most | ||
9 | efficent input into extbl, plus it allows easy handling of fls(0)=0. */ | ||
10 | |||
11 | const unsigned char __flsm1_tab[256] = | ||
12 | { | ||
13 | 0, | ||
14 | 0, | ||
15 | 1, 1, | ||
16 | 2, 2, 2, 2, | ||
17 | 3, 3, 3, 3, 3, 3, 3, 3, | ||
18 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | ||
19 | |||
20 | 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | ||
21 | 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | ||
22 | |||
23 | 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, | ||
24 | 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, | ||
25 | 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, | ||
26 | 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, | ||
27 | |||
28 | 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, | ||
29 | 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, | ||
30 | 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, | ||
31 | 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, | ||
32 | 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, | ||
33 | 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, | ||
34 | 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, | ||
35 | 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, | ||
36 | }; | ||
37 | |||
38 | EXPORT_SYMBOL(__flsm1_tab); | ||