diff options
Diffstat (limited to 'include/asm-alpha')
-rw-r--r-- | include/asm-alpha/bitops.h | 133 | ||||
-rw-r--r-- | include/asm-alpha/fpu.h | 4 | ||||
-rw-r--r-- | include/asm-alpha/mmzone.h | 19 | ||||
-rw-r--r-- | include/asm-alpha/page.h | 4 | ||||
-rw-r--r-- | include/asm-alpha/poll.h | 4 |
5 files changed, 20 insertions, 144 deletions
diff --git a/include/asm-alpha/bitops.h b/include/asm-alpha/bitops.h index 302201f1a097..3f88715e811e 100644 --- a/include/asm-alpha/bitops.h +++ b/include/asm-alpha/bitops.h | |||
@@ -261,7 +261,7 @@ static inline unsigned long ffz_b(unsigned long x) | |||
261 | 261 | ||
262 | static inline unsigned long ffz(unsigned long word) | 262 | static inline unsigned long ffz(unsigned long word) |
263 | { | 263 | { |
264 | #if defined(__alpha_cix__) && defined(__alpha_fix__) | 264 | #if defined(CONFIG_ALPHA_EV6) && defined(CONFIG_ALPHA_EV67) |
265 | /* Whee. EV67 can calculate it directly. */ | 265 | /* Whee. EV67 can calculate it directly. */ |
266 | return __kernel_cttz(~word); | 266 | return __kernel_cttz(~word); |
267 | #else | 267 | #else |
@@ -281,7 +281,7 @@ static inline unsigned long ffz(unsigned long word) | |||
281 | */ | 281 | */ |
282 | static inline unsigned long __ffs(unsigned long word) | 282 | static inline unsigned long __ffs(unsigned long word) |
283 | { | 283 | { |
284 | #if defined(__alpha_cix__) && defined(__alpha_fix__) | 284 | #if defined(CONFIG_ALPHA_EV6) && defined(CONFIG_ALPHA_EV67) |
285 | /* Whee. EV67 can calculate it directly. */ | 285 | /* Whee. EV67 can calculate it directly. */ |
286 | return __kernel_cttz(word); | 286 | return __kernel_cttz(word); |
287 | #else | 287 | #else |
@@ -313,20 +313,20 @@ static inline int ffs(int word) | |||
313 | /* | 313 | /* |
314 | * fls: find last bit set. | 314 | * fls: find last bit set. |
315 | */ | 315 | */ |
316 | #if defined(__alpha_cix__) && defined(__alpha_fix__) | 316 | #if defined(CONFIG_ALPHA_EV6) && defined(CONFIG_ALPHA_EV67) |
317 | static inline int fls(int word) | 317 | static inline int fls(int word) |
318 | { | 318 | { |
319 | return 64 - __kernel_ctlz(word & 0xffffffff); | 319 | return 64 - __kernel_ctlz(word & 0xffffffff); |
320 | } | 320 | } |
321 | #else | 321 | #else |
322 | #define fls generic_fls | 322 | #include <asm-generic/bitops/fls.h> |
323 | #endif | 323 | #endif |
324 | #define fls64 generic_fls64 | 324 | #include <asm-generic/bitops/fls64.h> |
325 | 325 | ||
326 | /* Compute powers of two for the given integer. */ | 326 | /* Compute powers of two for the given integer. */ |
327 | static inline long floor_log2(unsigned long word) | 327 | static inline long floor_log2(unsigned long word) |
328 | { | 328 | { |
329 | #if defined(__alpha_cix__) && defined(__alpha_fix__) | 329 | #if defined(CONFIG_ALPHA_EV6) && defined(CONFIG_ALPHA_EV67) |
330 | return 63 - __kernel_ctlz(word); | 330 | return 63 - __kernel_ctlz(word); |
331 | #else | 331 | #else |
332 | long bit; | 332 | long bit; |
@@ -347,7 +347,7 @@ static inline long ceil_log2(unsigned long word) | |||
347 | * of bits set) of a N-bit word | 347 | * of bits set) of a N-bit word |
348 | */ | 348 | */ |
349 | 349 | ||
350 | #if defined(__alpha_cix__) && defined(__alpha_fix__) | 350 | #if defined(CONFIG_ALPHA_EV6) && defined(CONFIG_ALPHA_EV67) |
351 | /* Whee. EV67 can calculate it directly. */ | 351 | /* Whee. EV67 can calculate it directly. */ |
352 | static inline unsigned long hweight64(unsigned long w) | 352 | static inline unsigned long hweight64(unsigned long w) |
353 | { | 353 | { |
@@ -358,112 +358,12 @@ static inline unsigned long hweight64(unsigned long w) | |||
358 | #define hweight16(x) (unsigned int) hweight64((x) & 0xfffful) | 358 | #define hweight16(x) (unsigned int) hweight64((x) & 0xfffful) |
359 | #define hweight8(x) (unsigned int) hweight64((x) & 0xfful) | 359 | #define hweight8(x) (unsigned int) hweight64((x) & 0xfful) |
360 | #else | 360 | #else |
361 | static inline unsigned long hweight64(unsigned long w) | 361 | #include <asm-generic/bitops/hweight.h> |
362 | { | ||
363 | unsigned long result; | ||
364 | for (result = 0; w ; w >>= 1) | ||
365 | result += (w & 1); | ||
366 | return result; | ||
367 | } | ||
368 | |||
369 | #define hweight32(x) generic_hweight32(x) | ||
370 | #define hweight16(x) generic_hweight16(x) | ||
371 | #define hweight8(x) generic_hweight8(x) | ||
372 | #endif | 362 | #endif |
373 | 363 | ||
374 | #endif /* __KERNEL__ */ | 364 | #endif /* __KERNEL__ */ |
375 | 365 | ||
376 | /* | 366 | #include <asm-generic/bitops/find.h> |
377 | * Find next zero bit in a bitmap reasonably efficiently.. | ||
378 | */ | ||
379 | static inline unsigned long | ||
380 | find_next_zero_bit(const void *addr, unsigned long size, unsigned long offset) | ||
381 | { | ||
382 | const unsigned long *p = addr; | ||
383 | unsigned long result = offset & ~63UL; | ||
384 | unsigned long tmp; | ||
385 | |||
386 | p += offset >> 6; | ||
387 | if (offset >= size) | ||
388 | return size; | ||
389 | size -= result; | ||
390 | offset &= 63UL; | ||
391 | if (offset) { | ||
392 | tmp = *(p++); | ||
393 | tmp |= ~0UL >> (64-offset); | ||
394 | if (size < 64) | ||
395 | goto found_first; | ||
396 | if (~tmp) | ||
397 | goto found_middle; | ||
398 | size -= 64; | ||
399 | result += 64; | ||
400 | } | ||
401 | while (size & ~63UL) { | ||
402 | if (~(tmp = *(p++))) | ||
403 | goto found_middle; | ||
404 | result += 64; | ||
405 | size -= 64; | ||
406 | } | ||
407 | if (!size) | ||
408 | return result; | ||
409 | tmp = *p; | ||
410 | found_first: | ||
411 | tmp |= ~0UL << size; | ||
412 | if (tmp == ~0UL) /* Are any bits zero? */ | ||
413 | return result + size; /* Nope. */ | ||
414 | found_middle: | ||
415 | return result + ffz(tmp); | ||
416 | } | ||
417 | |||
418 | /* | ||
419 | * Find next one bit in a bitmap reasonably efficiently. | ||
420 | */ | ||
421 | static inline unsigned long | ||
422 | find_next_bit(const void * addr, unsigned long size, unsigned long offset) | ||
423 | { | ||
424 | const unsigned long *p = addr; | ||
425 | unsigned long result = offset & ~63UL; | ||
426 | unsigned long tmp; | ||
427 | |||
428 | p += offset >> 6; | ||
429 | if (offset >= size) | ||
430 | return size; | ||
431 | size -= result; | ||
432 | offset &= 63UL; | ||
433 | if (offset) { | ||
434 | tmp = *(p++); | ||
435 | tmp &= ~0UL << offset; | ||
436 | if (size < 64) | ||
437 | goto found_first; | ||
438 | if (tmp) | ||
439 | goto found_middle; | ||
440 | size -= 64; | ||
441 | result += 64; | ||
442 | } | ||
443 | while (size & ~63UL) { | ||
444 | if ((tmp = *(p++))) | ||
445 | goto found_middle; | ||
446 | result += 64; | ||
447 | size -= 64; | ||
448 | } | ||
449 | if (!size) | ||
450 | return result; | ||
451 | tmp = *p; | ||
452 | found_first: | ||
453 | tmp &= ~0UL >> (64 - size); | ||
454 | if (!tmp) | ||
455 | return result + size; | ||
456 | found_middle: | ||
457 | return result + __ffs(tmp); | ||
458 | } | ||
459 | |||
460 | /* | ||
461 | * The optimizer actually does good code for this case. | ||
462 | */ | ||
463 | #define find_first_zero_bit(addr, size) \ | ||
464 | find_next_zero_bit((addr), (size), 0) | ||
465 | #define find_first_bit(addr, size) \ | ||
466 | find_next_bit((addr), (size), 0) | ||
467 | 367 | ||
468 | #ifdef __KERNEL__ | 368 | #ifdef __KERNEL__ |
469 | 369 | ||
@@ -487,21 +387,12 @@ sched_find_first_bit(unsigned long b[3]) | |||
487 | return __ffs(b0) + ofs; | 387 | return __ffs(b0) + ofs; |
488 | } | 388 | } |
489 | 389 | ||
390 | #include <asm-generic/bitops/ext2-non-atomic.h> | ||
490 | 391 | ||
491 | #define ext2_set_bit __test_and_set_bit | ||
492 | #define ext2_set_bit_atomic(l,n,a) test_and_set_bit(n,a) | 392 | #define ext2_set_bit_atomic(l,n,a) test_and_set_bit(n,a) |
493 | #define ext2_clear_bit __test_and_clear_bit | ||
494 | #define ext2_clear_bit_atomic(l,n,a) test_and_clear_bit(n,a) | 393 | #define ext2_clear_bit_atomic(l,n,a) test_and_clear_bit(n,a) |
495 | #define ext2_test_bit test_bit | 394 | |
496 | #define ext2_find_first_zero_bit find_first_zero_bit | 395 | #include <asm-generic/bitops/minix.h> |
497 | #define ext2_find_next_zero_bit find_next_zero_bit | ||
498 | |||
499 | /* Bitmap functions for the minix filesystem. */ | ||
500 | #define minix_test_and_set_bit(nr,addr) __test_and_set_bit(nr,addr) | ||
501 | #define minix_set_bit(nr,addr) __set_bit(nr,addr) | ||
502 | #define minix_test_and_clear_bit(nr,addr) __test_and_clear_bit(nr,addr) | ||
503 | #define minix_test_bit(nr,addr) test_bit(nr,addr) | ||
504 | #define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size) | ||
505 | 396 | ||
506 | #endif /* __KERNEL__ */ | 397 | #endif /* __KERNEL__ */ |
507 | 398 | ||
diff --git a/include/asm-alpha/fpu.h b/include/asm-alpha/fpu.h index c203fc2fa5cd..ecb17a72acc3 100644 --- a/include/asm-alpha/fpu.h +++ b/include/asm-alpha/fpu.h | |||
@@ -130,7 +130,7 @@ rdfpcr(void) | |||
130 | { | 130 | { |
131 | unsigned long tmp, ret; | 131 | unsigned long tmp, ret; |
132 | 132 | ||
133 | #if defined(__alpha_cix__) || defined(__alpha_fix__) | 133 | #if defined(CONFIG_ALPHA_EV6) || defined(CONFIG_ALPHA_EV67) |
134 | __asm__ __volatile__ ( | 134 | __asm__ __volatile__ ( |
135 | "ftoit $f0,%0\n\t" | 135 | "ftoit $f0,%0\n\t" |
136 | "mf_fpcr $f0\n\t" | 136 | "mf_fpcr $f0\n\t" |
@@ -154,7 +154,7 @@ wrfpcr(unsigned long val) | |||
154 | { | 154 | { |
155 | unsigned long tmp; | 155 | unsigned long tmp; |
156 | 156 | ||
157 | #if defined(__alpha_cix__) || defined(__alpha_fix__) | 157 | #if defined(CONFIG_ALPHA_EV6) || defined(CONFIG_ALPHA_EV67) |
158 | __asm__ __volatile__ ( | 158 | __asm__ __volatile__ ( |
159 | "ftoit $f0,%0\n\t" | 159 | "ftoit $f0,%0\n\t" |
160 | "itoft %1,$f0\n\t" | 160 | "itoft %1,$f0\n\t" |
diff --git a/include/asm-alpha/mmzone.h b/include/asm-alpha/mmzone.h index a011ef4cf3d3..192d80c875b0 100644 --- a/include/asm-alpha/mmzone.h +++ b/include/asm-alpha/mmzone.h | |||
@@ -59,9 +59,6 @@ PLAT_NODE_DATA_LOCALNR(unsigned long p, int n) | |||
59 | #define kvaddr_to_nid(kaddr) pa_to_nid(__pa(kaddr)) | 59 | #define kvaddr_to_nid(kaddr) pa_to_nid(__pa(kaddr)) |
60 | #define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn) | 60 | #define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn) |
61 | 61 | ||
62 | #define local_mapnr(kvaddr) \ | ||
63 | ((__pa(kvaddr) >> PAGE_SHIFT) - node_start_pfn(kvaddr_to_nid(kvaddr))) | ||
64 | |||
65 | /* | 62 | /* |
66 | * Given a kaddr, LOCAL_BASE_ADDR finds the owning node of the memory | 63 | * Given a kaddr, LOCAL_BASE_ADDR finds the owning node of the memory |
67 | * and returns the kaddr corresponding to first physical page in the | 64 | * and returns the kaddr corresponding to first physical page in the |
@@ -86,8 +83,7 @@ PLAT_NODE_DATA_LOCALNR(unsigned long p, int n) | |||
86 | pte_t pte; \ | 83 | pte_t pte; \ |
87 | unsigned long pfn; \ | 84 | unsigned long pfn; \ |
88 | \ | 85 | \ |
89 | pfn = ((unsigned long)((page)-page_zone(page)->zone_mem_map)) << 32; \ | 86 | pfn = page_to_pfn(page) << 32; \ |
90 | pfn += page_zone(page)->zone_start_pfn << 32; \ | ||
91 | pte_val(pte) = pfn | pgprot_val(pgprot); \ | 87 | pte_val(pte) = pfn | pgprot_val(pgprot); \ |
92 | \ | 88 | \ |
93 | pte; \ | 89 | pte; \ |
@@ -104,19 +100,8 @@ PLAT_NODE_DATA_LOCALNR(unsigned long p, int n) | |||
104 | __xx; \ | 100 | __xx; \ |
105 | }) | 101 | }) |
106 | 102 | ||
107 | #define pfn_to_page(pfn) \ | ||
108 | ({ \ | ||
109 | unsigned long kaddr = (unsigned long)__va((pfn) << PAGE_SHIFT); \ | ||
110 | (NODE_DATA(kvaddr_to_nid(kaddr))->node_mem_map + local_mapnr(kaddr)); \ | ||
111 | }) | ||
112 | |||
113 | #define page_to_pfn(page) \ | ||
114 | ((page) - page_zone(page)->zone_mem_map + \ | ||
115 | (page_zone(page)->zone_start_pfn)) | ||
116 | |||
117 | #define page_to_pa(page) \ | 103 | #define page_to_pa(page) \ |
118 | ((( (page) - page_zone(page)->zone_mem_map ) \ | 104 | (page_to_pfn(page) << PAGE_SHIFT) |
119 | + page_zone(page)->zone_start_pfn) << PAGE_SHIFT) | ||
120 | 105 | ||
121 | #define pfn_to_nid(pfn) pa_to_nid(((u64)(pfn) << PAGE_SHIFT)) | 106 | #define pfn_to_nid(pfn) pa_to_nid(((u64)(pfn) << PAGE_SHIFT)) |
122 | #define pfn_valid(pfn) \ | 107 | #define pfn_valid(pfn) \ |
diff --git a/include/asm-alpha/page.h b/include/asm-alpha/page.h index fa0b41b164a7..61bcf70b5eac 100644 --- a/include/asm-alpha/page.h +++ b/include/asm-alpha/page.h | |||
@@ -85,8 +85,6 @@ typedef unsigned long pgprot_t; | |||
85 | #define __pa(x) ((unsigned long) (x) - PAGE_OFFSET) | 85 | #define __pa(x) ((unsigned long) (x) - PAGE_OFFSET) |
86 | #define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET)) | 86 | #define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET)) |
87 | #ifndef CONFIG_DISCONTIGMEM | 87 | #ifndef CONFIG_DISCONTIGMEM |
88 | #define pfn_to_page(pfn) (mem_map + (pfn)) | ||
89 | #define page_to_pfn(page) ((unsigned long)((page) - mem_map)) | ||
90 | #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) | 88 | #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) |
91 | 89 | ||
92 | #define pfn_valid(pfn) ((pfn) < max_mapnr) | 90 | #define pfn_valid(pfn) ((pfn) < max_mapnr) |
@@ -95,9 +93,9 @@ typedef unsigned long pgprot_t; | |||
95 | 93 | ||
96 | #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ | 94 | #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ |
97 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) | 95 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) |
98 | |||
99 | #endif /* __KERNEL__ */ | 96 | #endif /* __KERNEL__ */ |
100 | 97 | ||
98 | #include <asm-generic/memory_model.h> | ||
101 | #include <asm-generic/page.h> | 99 | #include <asm-generic/page.h> |
102 | 100 | ||
103 | #endif /* _ALPHA_PAGE_H */ | 101 | #endif /* _ALPHA_PAGE_H */ |
diff --git a/include/asm-alpha/poll.h b/include/asm-alpha/poll.h index 34f333b762a0..76f89356b6a7 100644 --- a/include/asm-alpha/poll.h +++ b/include/asm-alpha/poll.h | |||
@@ -12,7 +12,9 @@ | |||
12 | #define POLLWRNORM (1 << 8) | 12 | #define POLLWRNORM (1 << 8) |
13 | #define POLLWRBAND (1 << 9) | 13 | #define POLLWRBAND (1 << 9) |
14 | #define POLLMSG (1 << 10) | 14 | #define POLLMSG (1 << 10) |
15 | #define POLLREMOVE (1 << 11) | 15 | #define POLLREMOVE (1 << 12) |
16 | #define POLLRDHUP (1 << 13) | ||
17 | |||
16 | 18 | ||
17 | struct pollfd { | 19 | struct pollfd { |
18 | int fd; | 20 | int fd; |