diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-alpha/bitops.h | 5 | ||||
-rw-r--r-- | include/asm-generic/bitops/__fls.h | 43 | ||||
-rw-r--r-- | include/asm-generic/bitops/find.h | 2 | ||||
-rw-r--r-- | include/asm-generic/bitops/fls64.h | 22 | ||||
-rw-r--r-- | include/asm-ia64/bitops.h | 16 | ||||
-rw-r--r-- | include/asm-mips/bitops.h | 5 | ||||
-rw-r--r-- | include/asm-mips/mach-au1x00/au1xxx_ide.h | 42 | ||||
-rw-r--r-- | include/asm-parisc/bitops.h | 1 | ||||
-rw-r--r-- | include/asm-powerpc/bitops.h | 5 | ||||
-rw-r--r-- | include/asm-s390/bitops.h | 1 | ||||
-rw-r--r-- | include/asm-sh/bitops.h | 1 | ||||
-rw-r--r-- | include/asm-sparc64/bitops.h | 1 | ||||
-rw-r--r-- | include/asm-x86/bitops.h | 149 | ||||
-rw-r--r-- | include/asm-x86/bitops_32.h | 166 | ||||
-rw-r--r-- | include/asm-x86/bitops_64.h | 162 | ||||
-rw-r--r-- | include/asm-x86/bootparam.h | 14 | ||||
-rw-r--r-- | include/asm-x86/e820_64.h | 1 | ||||
-rw-r--r-- | include/linux/bitops.h | 140 | ||||
-rw-r--r-- | include/linux/ide.h | 109 |
19 files changed, 455 insertions, 430 deletions
diff --git a/include/asm-alpha/bitops.h b/include/asm-alpha/bitops.h index 9e19a704d484..15f3ae25c511 100644 --- a/include/asm-alpha/bitops.h +++ b/include/asm-alpha/bitops.h | |||
@@ -388,6 +388,11 @@ static inline int fls64(unsigned long x) | |||
388 | } | 388 | } |
389 | #endif | 389 | #endif |
390 | 390 | ||
391 | static inline unsigned long __fls(unsigned long x) | ||
392 | { | ||
393 | return fls64(x) - 1; | ||
394 | } | ||
395 | |||
391 | static inline int fls(int x) | 396 | static inline int fls(int x) |
392 | { | 397 | { |
393 | return fls64((unsigned int) x); | 398 | return fls64((unsigned int) x); |
diff --git a/include/asm-generic/bitops/__fls.h b/include/asm-generic/bitops/__fls.h new file mode 100644 index 000000000000..be24465403d6 --- /dev/null +++ b/include/asm-generic/bitops/__fls.h | |||
@@ -0,0 +1,43 @@ | |||
1 | #ifndef _ASM_GENERIC_BITOPS___FLS_H_ | ||
2 | #define _ASM_GENERIC_BITOPS___FLS_H_ | ||
3 | |||
4 | #include <asm/types.h> | ||
5 | |||
6 | /** | ||
7 | * __fls - find last (most-significant) set bit in a long word | ||
8 | * @word: the word to search | ||
9 | * | ||
10 | * Undefined if no set bit exists, so code should check against 0 first. | ||
11 | */ | ||
12 | static inline unsigned long __fls(unsigned long word) | ||
13 | { | ||
14 | int num = BITS_PER_LONG - 1; | ||
15 | |||
16 | #if BITS_PER_LONG == 64 | ||
17 | if (!(word & (~0ul << 32))) { | ||
18 | num -= 32; | ||
19 | word <<= 32; | ||
20 | } | ||
21 | #endif | ||
22 | if (!(word & (~0ul << (BITS_PER_LONG-16)))) { | ||
23 | num -= 16; | ||
24 | word <<= 16; | ||
25 | } | ||
26 | if (!(word & (~0ul << (BITS_PER_LONG-8)))) { | ||
27 | num -= 8; | ||
28 | word <<= 8; | ||
29 | } | ||
30 | if (!(word & (~0ul << (BITS_PER_LONG-4)))) { | ||
31 | num -= 4; | ||
32 | word <<= 4; | ||
33 | } | ||
34 | if (!(word & (~0ul << (BITS_PER_LONG-2)))) { | ||
35 | num -= 2; | ||
36 | word <<= 2; | ||
37 | } | ||
38 | if (!(word & (~0ul << (BITS_PER_LONG-1)))) | ||
39 | num -= 1; | ||
40 | return num; | ||
41 | } | ||
42 | |||
43 | #endif /* _ASM_GENERIC_BITOPS___FLS_H_ */ | ||
diff --git a/include/asm-generic/bitops/find.h b/include/asm-generic/bitops/find.h index 72a51e5a12ef..1914e9742512 100644 --- a/include/asm-generic/bitops/find.h +++ b/include/asm-generic/bitops/find.h | |||
@@ -1,11 +1,13 @@ | |||
1 | #ifndef _ASM_GENERIC_BITOPS_FIND_H_ | 1 | #ifndef _ASM_GENERIC_BITOPS_FIND_H_ |
2 | #define _ASM_GENERIC_BITOPS_FIND_H_ | 2 | #define _ASM_GENERIC_BITOPS_FIND_H_ |
3 | 3 | ||
4 | #ifndef CONFIG_GENERIC_FIND_NEXT_BIT | ||
4 | extern unsigned long find_next_bit(const unsigned long *addr, unsigned long | 5 | extern unsigned long find_next_bit(const unsigned long *addr, unsigned long |
5 | size, unsigned long offset); | 6 | size, unsigned long offset); |
6 | 7 | ||
7 | extern unsigned long find_next_zero_bit(const unsigned long *addr, unsigned | 8 | extern unsigned long find_next_zero_bit(const unsigned long *addr, unsigned |
8 | long size, unsigned long offset); | 9 | long size, unsigned long offset); |
10 | #endif | ||
9 | 11 | ||
10 | #define find_first_bit(addr, size) find_next_bit((addr), (size), 0) | 12 | #define find_first_bit(addr, size) find_next_bit((addr), (size), 0) |
11 | #define find_first_zero_bit(addr, size) find_next_zero_bit((addr), (size), 0) | 13 | #define find_first_zero_bit(addr, size) find_next_zero_bit((addr), (size), 0) |
diff --git a/include/asm-generic/bitops/fls64.h b/include/asm-generic/bitops/fls64.h index 1b6b17ce2428..86d403f8b256 100644 --- a/include/asm-generic/bitops/fls64.h +++ b/include/asm-generic/bitops/fls64.h | |||
@@ -3,6 +3,18 @@ | |||
3 | 3 | ||
4 | #include <asm/types.h> | 4 | #include <asm/types.h> |
5 | 5 | ||
6 | /** | ||
7 | * fls64 - find last set bit in a 64-bit word | ||
8 | * @x: the word to search | ||
9 | * | ||
10 | * This is defined in a similar way as the libc and compiler builtin | ||
11 | * ffsll, but returns the position of the most significant set bit. | ||
12 | * | ||
13 | * fls64(value) returns 0 if value is 0 or the position of the last | ||
14 | * set bit if value is nonzero. The last (most significant) bit is | ||
15 | * at position 64. | ||
16 | */ | ||
17 | #if BITS_PER_LONG == 32 | ||
6 | static inline int fls64(__u64 x) | 18 | static inline int fls64(__u64 x) |
7 | { | 19 | { |
8 | __u32 h = x >> 32; | 20 | __u32 h = x >> 32; |
@@ -10,5 +22,15 @@ static inline int fls64(__u64 x) | |||
10 | return fls(h) + 32; | 22 | return fls(h) + 32; |
11 | return fls(x); | 23 | return fls(x); |
12 | } | 24 | } |
25 | #elif BITS_PER_LONG == 64 | ||
26 | static inline int fls64(__u64 x) | ||
27 | { | ||
28 | if (x == 0) | ||
29 | return 0; | ||
30 | return __fls(x) + 1; | ||
31 | } | ||
32 | #else | ||
33 | #error BITS_PER_LONG not 32 or 64 | ||
34 | #endif | ||
13 | 35 | ||
14 | #endif /* _ASM_GENERIC_BITOPS_FLS64_H_ */ | 36 | #endif /* _ASM_GENERIC_BITOPS_FLS64_H_ */ |
diff --git a/include/asm-ia64/bitops.h b/include/asm-ia64/bitops.h index 953d3df9dd22..e2ca80037335 100644 --- a/include/asm-ia64/bitops.h +++ b/include/asm-ia64/bitops.h | |||
@@ -407,6 +407,22 @@ fls (int t) | |||
407 | return ia64_popcnt(x); | 407 | return ia64_popcnt(x); |
408 | } | 408 | } |
409 | 409 | ||
410 | /* | ||
411 | * Find the last (most significant) bit set. Undefined for x==0. | ||
412 | * Bits are numbered from 0..63 (e.g., __fls(9) == 3). | ||
413 | */ | ||
414 | static inline unsigned long | ||
415 | __fls (unsigned long x) | ||
416 | { | ||
417 | x |= x >> 1; | ||
418 | x |= x >> 2; | ||
419 | x |= x >> 4; | ||
420 | x |= x >> 8; | ||
421 | x |= x >> 16; | ||
422 | x |= x >> 32; | ||
423 | return ia64_popcnt(x) - 1; | ||
424 | } | ||
425 | |||
410 | #include <asm-generic/bitops/fls64.h> | 426 | #include <asm-generic/bitops/fls64.h> |
411 | 427 | ||
412 | /* | 428 | /* |
diff --git a/include/asm-mips/bitops.h b/include/asm-mips/bitops.h index ec75ce4cdb8c..c2bd126c3b4e 100644 --- a/include/asm-mips/bitops.h +++ b/include/asm-mips/bitops.h | |||
@@ -591,6 +591,11 @@ static inline int __ilog2(unsigned long x) | |||
591 | return 63 - lz; | 591 | return 63 - lz; |
592 | } | 592 | } |
593 | 593 | ||
594 | static inline unsigned long __fls(unsigned long x) | ||
595 | { | ||
596 | return __ilog2(x); | ||
597 | } | ||
598 | |||
594 | #if defined(CONFIG_CPU_MIPS32) || defined(CONFIG_CPU_MIPS64) | 599 | #if defined(CONFIG_CPU_MIPS32) || defined(CONFIG_CPU_MIPS64) |
595 | 600 | ||
596 | /* | 601 | /* |
diff --git a/include/asm-mips/mach-au1x00/au1xxx_ide.h b/include/asm-mips/mach-au1x00/au1xxx_ide.h index 89655c0cdcd6..b493a5e46c63 100644 --- a/include/asm-mips/mach-au1x00/au1xxx_ide.h +++ b/include/asm-mips/mach-au1x00/au1xxx_ide.h | |||
@@ -70,7 +70,6 @@ typedef struct | |||
70 | ide_hwif_t *hwif; | 70 | ide_hwif_t *hwif; |
71 | #ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA | 71 | #ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA |
72 | ide_drive_t *drive; | 72 | ide_drive_t *drive; |
73 | u8 white_list, black_list; | ||
74 | struct dbdma_cmd *dma_table_cpu; | 73 | struct dbdma_cmd *dma_table_cpu; |
75 | dma_addr_t dma_table_dma; | 74 | dma_addr_t dma_table_dma; |
76 | #endif | 75 | #endif |
@@ -81,47 +80,6 @@ typedef struct | |||
81 | #endif | 80 | #endif |
82 | } _auide_hwif; | 81 | } _auide_hwif; |
83 | 82 | ||
84 | #ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA | ||
85 | /* HD white list */ | ||
86 | static const struct drive_list_entry dma_white_list [] = { | ||
87 | /* | ||
88 | * Hitachi | ||
89 | */ | ||
90 | { "HITACHI_DK14FA-20" , NULL }, | ||
91 | { "HTS726060M9AT00" , NULL }, | ||
92 | /* | ||
93 | * Maxtor | ||
94 | */ | ||
95 | { "Maxtor 6E040L0" , NULL }, | ||
96 | { "Maxtor 6Y080P0" , NULL }, | ||
97 | { "Maxtor 6Y160P0" , NULL }, | ||
98 | /* | ||
99 | * Seagate | ||
100 | */ | ||
101 | { "ST3120026A" , NULL }, | ||
102 | { "ST320014A" , NULL }, | ||
103 | { "ST94011A" , NULL }, | ||
104 | { "ST340016A" , NULL }, | ||
105 | /* | ||
106 | * Western Digital | ||
107 | */ | ||
108 | { "WDC WD400UE-00HCT0" , NULL }, | ||
109 | { "WDC WD400JB-00JJC0" , NULL }, | ||
110 | { NULL , NULL } | ||
111 | }; | ||
112 | |||
113 | /* HD black list */ | ||
114 | static const struct drive_list_entry dma_black_list [] = { | ||
115 | /* | ||
116 | * Western Digital | ||
117 | */ | ||
118 | { "WDC WD100EB-00CGH0" , NULL }, | ||
119 | { "WDC WD200BB-00AUA1" , NULL }, | ||
120 | { "WDC AC24300L" , NULL }, | ||
121 | { NULL , NULL } | ||
122 | }; | ||
123 | #endif | ||
124 | |||
125 | /******************************************************************************* | 83 | /******************************************************************************* |
126 | * PIO Mode timing calculation : * | 84 | * PIO Mode timing calculation : * |
127 | * * | 85 | * * |
diff --git a/include/asm-parisc/bitops.h b/include/asm-parisc/bitops.h index f8eebcbad01f..7a6ea10bd231 100644 --- a/include/asm-parisc/bitops.h +++ b/include/asm-parisc/bitops.h | |||
@@ -210,6 +210,7 @@ static __inline__ int fls(int x) | |||
210 | return ret; | 210 | return ret; |
211 | } | 211 | } |
212 | 212 | ||
213 | #include <asm-generic/bitops/__fls.h> | ||
213 | #include <asm-generic/bitops/fls64.h> | 214 | #include <asm-generic/bitops/fls64.h> |
214 | #include <asm-generic/bitops/hweight.h> | 215 | #include <asm-generic/bitops/hweight.h> |
215 | #include <asm-generic/bitops/lock.h> | 216 | #include <asm-generic/bitops/lock.h> |
diff --git a/include/asm-powerpc/bitops.h b/include/asm-powerpc/bitops.h index a99a74929475..897eade3afbe 100644 --- a/include/asm-powerpc/bitops.h +++ b/include/asm-powerpc/bitops.h | |||
@@ -313,6 +313,11 @@ static __inline__ int fls(unsigned int x) | |||
313 | return 32 - lz; | 313 | return 32 - lz; |
314 | } | 314 | } |
315 | 315 | ||
316 | static __inline__ unsigned long __fls(unsigned long x) | ||
317 | { | ||
318 | return __ilog2(x); | ||
319 | } | ||
320 | |||
316 | /* | 321 | /* |
317 | * 64-bit can do this using one cntlzd (count leading zeroes doubleword) | 322 | * 64-bit can do this using one cntlzd (count leading zeroes doubleword) |
318 | * instruction; for 32-bit we use the generic version, which does two | 323 | * instruction; for 32-bit we use the generic version, which does two |
diff --git a/include/asm-s390/bitops.h b/include/asm-s390/bitops.h index 965394e69452..b4eb24ab5af9 100644 --- a/include/asm-s390/bitops.h +++ b/include/asm-s390/bitops.h | |||
@@ -769,6 +769,7 @@ static inline int sched_find_first_bit(unsigned long *b) | |||
769 | } | 769 | } |
770 | 770 | ||
771 | #include <asm-generic/bitops/fls.h> | 771 | #include <asm-generic/bitops/fls.h> |
772 | #include <asm-generic/bitops/__fls.h> | ||
772 | #include <asm-generic/bitops/fls64.h> | 773 | #include <asm-generic/bitops/fls64.h> |
773 | 774 | ||
774 | #include <asm-generic/bitops/hweight.h> | 775 | #include <asm-generic/bitops/hweight.h> |
diff --git a/include/asm-sh/bitops.h b/include/asm-sh/bitops.h index b6ba5a60dec2..d7d382f63ee5 100644 --- a/include/asm-sh/bitops.h +++ b/include/asm-sh/bitops.h | |||
@@ -95,6 +95,7 @@ static inline unsigned long ffz(unsigned long word) | |||
95 | #include <asm-generic/bitops/ext2-atomic.h> | 95 | #include <asm-generic/bitops/ext2-atomic.h> |
96 | #include <asm-generic/bitops/minix.h> | 96 | #include <asm-generic/bitops/minix.h> |
97 | #include <asm-generic/bitops/fls.h> | 97 | #include <asm-generic/bitops/fls.h> |
98 | #include <asm-generic/bitops/__fls.h> | ||
98 | #include <asm-generic/bitops/fls64.h> | 99 | #include <asm-generic/bitops/fls64.h> |
99 | 100 | ||
100 | #endif /* __KERNEL__ */ | 101 | #endif /* __KERNEL__ */ |
diff --git a/include/asm-sparc64/bitops.h b/include/asm-sparc64/bitops.h index 982ce8992b91..11f9d8146cdf 100644 --- a/include/asm-sparc64/bitops.h +++ b/include/asm-sparc64/bitops.h | |||
@@ -34,6 +34,7 @@ extern void change_bit(unsigned long nr, volatile unsigned long *addr); | |||
34 | #include <asm-generic/bitops/ffz.h> | 34 | #include <asm-generic/bitops/ffz.h> |
35 | #include <asm-generic/bitops/__ffs.h> | 35 | #include <asm-generic/bitops/__ffs.h> |
36 | #include <asm-generic/bitops/fls.h> | 36 | #include <asm-generic/bitops/fls.h> |
37 | #include <asm-generic/bitops/__fls.h> | ||
37 | #include <asm-generic/bitops/fls64.h> | 38 | #include <asm-generic/bitops/fls64.h> |
38 | 39 | ||
39 | #ifdef __KERNEL__ | 40 | #ifdef __KERNEL__ |
diff --git a/include/asm-x86/bitops.h b/include/asm-x86/bitops.h index 1ae7b270a1ef..b81a4d4d3337 100644 --- a/include/asm-x86/bitops.h +++ b/include/asm-x86/bitops.h | |||
@@ -62,12 +62,9 @@ static inline void set_bit(int nr, volatile void *addr) | |||
62 | */ | 62 | */ |
63 | static inline void __set_bit(int nr, volatile void *addr) | 63 | static inline void __set_bit(int nr, volatile void *addr) |
64 | { | 64 | { |
65 | asm volatile("bts %1,%0" | 65 | asm volatile("bts %1,%0" : ADDR : "Ir" (nr) : "memory"); |
66 | : ADDR | ||
67 | : "Ir" (nr) : "memory"); | ||
68 | } | 66 | } |
69 | 67 | ||
70 | |||
71 | /** | 68 | /** |
72 | * clear_bit - Clears a bit in memory | 69 | * clear_bit - Clears a bit in memory |
73 | * @nr: Bit to clear | 70 | * @nr: Bit to clear |
@@ -297,19 +294,145 @@ static inline int variable_test_bit(int nr, volatile const void *addr) | |||
297 | static int test_bit(int nr, const volatile unsigned long *addr); | 294 | static int test_bit(int nr, const volatile unsigned long *addr); |
298 | #endif | 295 | #endif |
299 | 296 | ||
300 | #define test_bit(nr,addr) \ | 297 | #define test_bit(nr, addr) \ |
301 | (__builtin_constant_p(nr) ? \ | 298 | (__builtin_constant_p((nr)) \ |
302 | constant_test_bit((nr),(addr)) : \ | 299 | ? constant_test_bit((nr), (addr)) \ |
303 | variable_test_bit((nr),(addr))) | 300 | : variable_test_bit((nr), (addr))) |
301 | |||
302 | /** | ||
303 | * __ffs - find first set bit in word | ||
304 | * @word: The word to search | ||
305 | * | ||
306 | * Undefined if no bit exists, so code should check against 0 first. | ||
307 | */ | ||
308 | static inline unsigned long __ffs(unsigned long word) | ||
309 | { | ||
310 | asm("bsf %1,%0" | ||
311 | : "=r" (word) | ||
312 | : "rm" (word)); | ||
313 | return word; | ||
314 | } | ||
315 | |||
316 | /** | ||
317 | * ffz - find first zero bit in word | ||
318 | * @word: The word to search | ||
319 | * | ||
320 | * Undefined if no zero exists, so code should check against ~0UL first. | ||
321 | */ | ||
322 | static inline unsigned long ffz(unsigned long word) | ||
323 | { | ||
324 | asm("bsf %1,%0" | ||
325 | : "=r" (word) | ||
326 | : "r" (~word)); | ||
327 | return word; | ||
328 | } | ||
329 | |||
330 | /* | ||
331 | * __fls: find last set bit in word | ||
332 | * @word: The word to search | ||
333 | * | ||
334 | * Undefined if no zero exists, so code should check against ~0UL first. | ||
335 | */ | ||
336 | static inline unsigned long __fls(unsigned long word) | ||
337 | { | ||
338 | asm("bsr %1,%0" | ||
339 | : "=r" (word) | ||
340 | : "rm" (word)); | ||
341 | return word; | ||
342 | } | ||
343 | |||
344 | #ifdef __KERNEL__ | ||
345 | /** | ||
346 | * ffs - find first set bit in word | ||
347 | * @x: the word to search | ||
348 | * | ||
349 | * This is defined the same way as the libc and compiler builtin ffs | ||
350 | * routines, therefore differs in spirit from the other bitops. | ||
351 | * | ||
352 | * ffs(value) returns 0 if value is 0 or the position of the first | ||
353 | * set bit if value is nonzero. The first (least significant) bit | ||
354 | * is at position 1. | ||
355 | */ | ||
356 | static inline int ffs(int x) | ||
357 | { | ||
358 | int r; | ||
359 | #ifdef CONFIG_X86_CMOV | ||
360 | asm("bsfl %1,%0\n\t" | ||
361 | "cmovzl %2,%0" | ||
362 | : "=r" (r) : "rm" (x), "r" (-1)); | ||
363 | #else | ||
364 | asm("bsfl %1,%0\n\t" | ||
365 | "jnz 1f\n\t" | ||
366 | "movl $-1,%0\n" | ||
367 | "1:" : "=r" (r) : "rm" (x)); | ||
368 | #endif | ||
369 | return r + 1; | ||
370 | } | ||
371 | |||
372 | /** | ||
373 | * fls - find last set bit in word | ||
374 | * @x: the word to search | ||
375 | * | ||
376 | * This is defined in a similar way as the libc and compiler builtin | ||
377 | * ffs, but returns the position of the most significant set bit. | ||
378 | * | ||
379 | * fls(value) returns 0 if value is 0 or the position of the last | ||
380 | * set bit if value is nonzero. The last (most significant) bit is | ||
381 | * at position 32. | ||
382 | */ | ||
383 | static inline int fls(int x) | ||
384 | { | ||
385 | int r; | ||
386 | #ifdef CONFIG_X86_CMOV | ||
387 | asm("bsrl %1,%0\n\t" | ||
388 | "cmovzl %2,%0" | ||
389 | : "=&r" (r) : "rm" (x), "rm" (-1)); | ||
390 | #else | ||
391 | asm("bsrl %1,%0\n\t" | ||
392 | "jnz 1f\n\t" | ||
393 | "movl $-1,%0\n" | ||
394 | "1:" : "=r" (r) : "rm" (x)); | ||
395 | #endif | ||
396 | return r + 1; | ||
397 | } | ||
398 | #endif /* __KERNEL__ */ | ||
304 | 399 | ||
305 | #undef BASE_ADDR | 400 | #undef BASE_ADDR |
306 | #undef BIT_ADDR | 401 | #undef BIT_ADDR |
307 | #undef ADDR | 402 | #undef ADDR |
308 | 403 | ||
309 | #ifdef CONFIG_X86_32 | 404 | static inline void set_bit_string(unsigned long *bitmap, |
310 | # include "bitops_32.h" | 405 | unsigned long i, int len) |
311 | #else | 406 | { |
312 | # include "bitops_64.h" | 407 | unsigned long end = i + len; |
313 | #endif | 408 | while (i < end) { |
409 | __set_bit(i, bitmap); | ||
410 | i++; | ||
411 | } | ||
412 | } | ||
413 | |||
414 | #ifdef __KERNEL__ | ||
415 | |||
416 | #include <asm-generic/bitops/sched.h> | ||
417 | |||
418 | #define ARCH_HAS_FAST_MULTIPLIER 1 | ||
419 | |||
420 | #include <asm-generic/bitops/hweight.h> | ||
421 | |||
422 | #endif /* __KERNEL__ */ | ||
423 | |||
424 | #include <asm-generic/bitops/fls64.h> | ||
425 | |||
426 | #ifdef __KERNEL__ | ||
427 | |||
428 | #include <asm-generic/bitops/ext2-non-atomic.h> | ||
429 | |||
430 | #define ext2_set_bit_atomic(lock, nr, addr) \ | ||
431 | test_and_set_bit((nr), (unsigned long *)(addr)) | ||
432 | #define ext2_clear_bit_atomic(lock, nr, addr) \ | ||
433 | test_and_clear_bit((nr), (unsigned long *)(addr)) | ||
434 | |||
435 | #include <asm-generic/bitops/minix.h> | ||
314 | 436 | ||
437 | #endif /* __KERNEL__ */ | ||
315 | #endif /* _ASM_X86_BITOPS_H */ | 438 | #endif /* _ASM_X86_BITOPS_H */ |
diff --git a/include/asm-x86/bitops_32.h b/include/asm-x86/bitops_32.h deleted file mode 100644 index 2513a81f82aa..000000000000 --- a/include/asm-x86/bitops_32.h +++ /dev/null | |||
@@ -1,166 +0,0 @@ | |||
1 | #ifndef _I386_BITOPS_H | ||
2 | #define _I386_BITOPS_H | ||
3 | |||
4 | /* | ||
5 | * Copyright 1992, Linus Torvalds. | ||
6 | */ | ||
7 | |||
8 | /** | ||
9 | * find_first_zero_bit - find the first zero bit in a memory region | ||
10 | * @addr: The address to start the search at | ||
11 | * @size: The maximum size to search | ||
12 | * | ||
13 | * Returns the bit number of the first zero bit, not the number of the byte | ||
14 | * containing a bit. | ||
15 | */ | ||
16 | static inline int find_first_zero_bit(const unsigned long *addr, unsigned size) | ||
17 | { | ||
18 | int d0, d1, d2; | ||
19 | int res; | ||
20 | |||
21 | if (!size) | ||
22 | return 0; | ||
23 | /* This looks at memory. | ||
24 | * Mark it volatile to tell gcc not to move it around | ||
25 | */ | ||
26 | asm volatile("movl $-1,%%eax\n\t" | ||
27 | "xorl %%edx,%%edx\n\t" | ||
28 | "repe; scasl\n\t" | ||
29 | "je 1f\n\t" | ||
30 | "xorl -4(%%edi),%%eax\n\t" | ||
31 | "subl $4,%%edi\n\t" | ||
32 | "bsfl %%eax,%%edx\n" | ||
33 | "1:\tsubl %%ebx,%%edi\n\t" | ||
34 | "shll $3,%%edi\n\t" | ||
35 | "addl %%edi,%%edx" | ||
36 | : "=d" (res), "=&c" (d0), "=&D" (d1), "=&a" (d2) | ||
37 | : "1" ((size + 31) >> 5), "2" (addr), | ||
38 | "b" (addr) : "memory"); | ||
39 | return res; | ||
40 | } | ||
41 | |||
42 | /** | ||
43 | * find_next_zero_bit - find the first zero bit in a memory region | ||
44 | * @addr: The address to base the search on | ||
45 | * @offset: The bit number to start searching at | ||
46 | * @size: The maximum size to search | ||
47 | */ | ||
48 | int find_next_zero_bit(const unsigned long *addr, int size, int offset); | ||
49 | |||
50 | /** | ||
51 | * __ffs - find first bit in word. | ||
52 | * @word: The word to search | ||
53 | * | ||
54 | * Undefined if no bit exists, so code should check against 0 first. | ||
55 | */ | ||
56 | static inline unsigned long __ffs(unsigned long word) | ||
57 | { | ||
58 | __asm__("bsfl %1,%0" | ||
59 | :"=r" (word) | ||
60 | :"rm" (word)); | ||
61 | return word; | ||
62 | } | ||
63 | |||
64 | /** | ||
65 | * find_first_bit - find the first set bit in a memory region | ||
66 | * @addr: The address to start the search at | ||
67 | * @size: The maximum size to search | ||
68 | * | ||
69 | * Returns the bit number of the first set bit, not the number of the byte | ||
70 | * containing a bit. | ||
71 | */ | ||
72 | static inline unsigned find_first_bit(const unsigned long *addr, unsigned size) | ||
73 | { | ||
74 | unsigned x = 0; | ||
75 | |||
76 | while (x < size) { | ||
77 | unsigned long val = *addr++; | ||
78 | if (val) | ||
79 | return __ffs(val) + x; | ||
80 | x += sizeof(*addr) << 3; | ||
81 | } | ||
82 | return x; | ||
83 | } | ||
84 | |||
85 | /** | ||
86 | * find_next_bit - find the first set bit in a memory region | ||
87 | * @addr: The address to base the search on | ||
88 | * @offset: The bit number to start searching at | ||
89 | * @size: The maximum size to search | ||
90 | */ | ||
91 | int find_next_bit(const unsigned long *addr, int size, int offset); | ||
92 | |||
93 | /** | ||
94 | * ffz - find first zero in word. | ||
95 | * @word: The word to search | ||
96 | * | ||
97 | * Undefined if no zero exists, so code should check against ~0UL first. | ||
98 | */ | ||
99 | static inline unsigned long ffz(unsigned long word) | ||
100 | { | ||
101 | __asm__("bsfl %1,%0" | ||
102 | :"=r" (word) | ||
103 | :"r" (~word)); | ||
104 | return word; | ||
105 | } | ||
106 | |||
107 | #ifdef __KERNEL__ | ||
108 | |||
109 | #include <asm-generic/bitops/sched.h> | ||
110 | |||
111 | /** | ||
112 | * ffs - find first bit set | ||
113 | * @x: the word to search | ||
114 | * | ||
115 | * This is defined the same way as | ||
116 | * the libc and compiler builtin ffs routines, therefore | ||
117 | * differs in spirit from the above ffz() (man ffs). | ||
118 | */ | ||
119 | static inline int ffs(int x) | ||
120 | { | ||
121 | int r; | ||
122 | |||
123 | __asm__("bsfl %1,%0\n\t" | ||
124 | "jnz 1f\n\t" | ||
125 | "movl $-1,%0\n" | ||
126 | "1:" : "=r" (r) : "rm" (x)); | ||
127 | return r+1; | ||
128 | } | ||
129 | |||
130 | /** | ||
131 | * fls - find last bit set | ||
132 | * @x: the word to search | ||
133 | * | ||
134 | * This is defined the same way as ffs(). | ||
135 | */ | ||
136 | static inline int fls(int x) | ||
137 | { | ||
138 | int r; | ||
139 | |||
140 | __asm__("bsrl %1,%0\n\t" | ||
141 | "jnz 1f\n\t" | ||
142 | "movl $-1,%0\n" | ||
143 | "1:" : "=r" (r) : "rm" (x)); | ||
144 | return r+1; | ||
145 | } | ||
146 | |||
147 | #include <asm-generic/bitops/hweight.h> | ||
148 | |||
149 | #endif /* __KERNEL__ */ | ||
150 | |||
151 | #include <asm-generic/bitops/fls64.h> | ||
152 | |||
153 | #ifdef __KERNEL__ | ||
154 | |||
155 | #include <asm-generic/bitops/ext2-non-atomic.h> | ||
156 | |||
157 | #define ext2_set_bit_atomic(lock, nr, addr) \ | ||
158 | test_and_set_bit((nr), (unsigned long *)(addr)) | ||
159 | #define ext2_clear_bit_atomic(lock, nr, addr) \ | ||
160 | test_and_clear_bit((nr), (unsigned long *)(addr)) | ||
161 | |||
162 | #include <asm-generic/bitops/minix.h> | ||
163 | |||
164 | #endif /* __KERNEL__ */ | ||
165 | |||
166 | #endif /* _I386_BITOPS_H */ | ||
diff --git a/include/asm-x86/bitops_64.h b/include/asm-x86/bitops_64.h deleted file mode 100644 index 365f8207ea59..000000000000 --- a/include/asm-x86/bitops_64.h +++ /dev/null | |||
@@ -1,162 +0,0 @@ | |||
1 | #ifndef _X86_64_BITOPS_H | ||
2 | #define _X86_64_BITOPS_H | ||
3 | |||
4 | /* | ||
5 | * Copyright 1992, Linus Torvalds. | ||
6 | */ | ||
7 | |||
8 | extern long find_first_zero_bit(const unsigned long *addr, unsigned long size); | ||
9 | extern long find_next_zero_bit(const unsigned long *addr, long size, long offset); | ||
10 | extern long find_first_bit(const unsigned long *addr, unsigned long size); | ||
11 | extern long find_next_bit(const unsigned long *addr, long size, long offset); | ||
12 | |||
13 | /* return index of first bet set in val or max when no bit is set */ | ||
14 | static inline long __scanbit(unsigned long val, unsigned long max) | ||
15 | { | ||
16 | asm("bsfq %1,%0 ; cmovz %2,%0" : "=&r" (val) : "r" (val), "r" (max)); | ||
17 | return val; | ||
18 | } | ||
19 | |||
20 | #define find_next_bit(addr,size,off) \ | ||
21 | ((__builtin_constant_p(size) && (size) <= BITS_PER_LONG ? \ | ||
22 | ((off) + (__scanbit((*(unsigned long *)addr) >> (off),(size)-(off)))) : \ | ||
23 | find_next_bit(addr,size,off))) | ||
24 | |||
25 | #define find_next_zero_bit(addr,size,off) \ | ||
26 | ((__builtin_constant_p(size) && (size) <= BITS_PER_LONG ? \ | ||
27 | ((off)+(__scanbit(~(((*(unsigned long *)addr)) >> (off)),(size)-(off)))) : \ | ||
28 | find_next_zero_bit(addr,size,off))) | ||
29 | |||
30 | #define find_first_bit(addr, size) \ | ||
31 | ((__builtin_constant_p((size)) && (size) <= BITS_PER_LONG \ | ||
32 | ? (__scanbit(*(unsigned long *)(addr), (size))) \ | ||
33 | : find_first_bit((addr), (size)))) | ||
34 | |||
35 | #define find_first_zero_bit(addr, size) \ | ||
36 | ((__builtin_constant_p((size)) && (size) <= BITS_PER_LONG \ | ||
37 | ? (__scanbit(~*(unsigned long *)(addr), (size))) \ | ||
38 | : find_first_zero_bit((addr), (size)))) | ||
39 | |||
40 | static inline void set_bit_string(unsigned long *bitmap, unsigned long i, | ||
41 | int len) | ||
42 | { | ||
43 | unsigned long end = i + len; | ||
44 | while (i < end) { | ||
45 | __set_bit(i, bitmap); | ||
46 | i++; | ||
47 | } | ||
48 | } | ||
49 | |||
50 | /** | ||
51 | * ffz - find first zero in word. | ||
52 | * @word: The word to search | ||
53 | * | ||
54 | * Undefined if no zero exists, so code should check against ~0UL first. | ||
55 | */ | ||
56 | static inline unsigned long ffz(unsigned long word) | ||
57 | { | ||
58 | __asm__("bsfq %1,%0" | ||
59 | :"=r" (word) | ||
60 | :"r" (~word)); | ||
61 | return word; | ||
62 | } | ||
63 | |||
64 | /** | ||
65 | * __ffs - find first bit in word. | ||
66 | * @word: The word to search | ||
67 | * | ||
68 | * Undefined if no bit exists, so code should check against 0 first. | ||
69 | */ | ||
70 | static inline unsigned long __ffs(unsigned long word) | ||
71 | { | ||
72 | __asm__("bsfq %1,%0" | ||
73 | :"=r" (word) | ||
74 | :"rm" (word)); | ||
75 | return word; | ||
76 | } | ||
77 | |||
78 | /* | ||
79 | * __fls: find last bit set. | ||
80 | * @word: The word to search | ||
81 | * | ||
82 | * Undefined if no zero exists, so code should check against ~0UL first. | ||
83 | */ | ||
84 | static inline unsigned long __fls(unsigned long word) | ||
85 | { | ||
86 | __asm__("bsrq %1,%0" | ||
87 | :"=r" (word) | ||
88 | :"rm" (word)); | ||
89 | return word; | ||
90 | } | ||
91 | |||
92 | #ifdef __KERNEL__ | ||
93 | |||
94 | #include <asm-generic/bitops/sched.h> | ||
95 | |||
96 | /** | ||
97 | * ffs - find first bit set | ||
98 | * @x: the word to search | ||
99 | * | ||
100 | * This is defined the same way as | ||
101 | * the libc and compiler builtin ffs routines, therefore | ||
102 | * differs in spirit from the above ffz (man ffs). | ||
103 | */ | ||
104 | static inline int ffs(int x) | ||
105 | { | ||
106 | int r; | ||
107 | |||
108 | __asm__("bsfl %1,%0\n\t" | ||
109 | "cmovzl %2,%0" | ||
110 | : "=r" (r) : "rm" (x), "r" (-1)); | ||
111 | return r+1; | ||
112 | } | ||
113 | |||
114 | /** | ||
115 | * fls64 - find last bit set in 64 bit word | ||
116 | * @x: the word to search | ||
117 | * | ||
118 | * This is defined the same way as fls. | ||
119 | */ | ||
120 | static inline int fls64(__u64 x) | ||
121 | { | ||
122 | if (x == 0) | ||
123 | return 0; | ||
124 | return __fls(x) + 1; | ||
125 | } | ||
126 | |||
127 | /** | ||
128 | * fls - find last bit set | ||
129 | * @x: the word to search | ||
130 | * | ||
131 | * This is defined the same way as ffs. | ||
132 | */ | ||
133 | static inline int fls(int x) | ||
134 | { | ||
135 | int r; | ||
136 | |||
137 | __asm__("bsrl %1,%0\n\t" | ||
138 | "cmovzl %2,%0" | ||
139 | : "=&r" (r) : "rm" (x), "rm" (-1)); | ||
140 | return r+1; | ||
141 | } | ||
142 | |||
143 | #define ARCH_HAS_FAST_MULTIPLIER 1 | ||
144 | |||
145 | #include <asm-generic/bitops/hweight.h> | ||
146 | |||
147 | #endif /* __KERNEL__ */ | ||
148 | |||
149 | #ifdef __KERNEL__ | ||
150 | |||
151 | #include <asm-generic/bitops/ext2-non-atomic.h> | ||
152 | |||
153 | #define ext2_set_bit_atomic(lock, nr, addr) \ | ||
154 | test_and_set_bit((nr), (unsigned long *)(addr)) | ||
155 | #define ext2_clear_bit_atomic(lock, nr, addr) \ | ||
156 | test_and_clear_bit((nr), (unsigned long *)(addr)) | ||
157 | |||
158 | #include <asm-generic/bitops/minix.h> | ||
159 | |||
160 | #endif /* __KERNEL__ */ | ||
161 | |||
162 | #endif /* _X86_64_BITOPS_H */ | ||
diff --git a/include/asm-x86/bootparam.h b/include/asm-x86/bootparam.h index 51151356840f..e8659909e5f6 100644 --- a/include/asm-x86/bootparam.h +++ b/include/asm-x86/bootparam.h | |||
@@ -9,6 +9,17 @@ | |||
9 | #include <asm/ist.h> | 9 | #include <asm/ist.h> |
10 | #include <video/edid.h> | 10 | #include <video/edid.h> |
11 | 11 | ||
12 | /* setup data types */ | ||
13 | #define SETUP_NONE 0 | ||
14 | |||
15 | /* extensible setup data list node */ | ||
16 | struct setup_data { | ||
17 | u64 next; | ||
18 | u32 type; | ||
19 | u32 len; | ||
20 | u8 data[0]; | ||
21 | }; | ||
22 | |||
12 | struct setup_header { | 23 | struct setup_header { |
13 | __u8 setup_sects; | 24 | __u8 setup_sects; |
14 | __u16 root_flags; | 25 | __u16 root_flags; |
@@ -46,6 +57,9 @@ struct setup_header { | |||
46 | __u32 cmdline_size; | 57 | __u32 cmdline_size; |
47 | __u32 hardware_subarch; | 58 | __u32 hardware_subarch; |
48 | __u64 hardware_subarch_data; | 59 | __u64 hardware_subarch_data; |
60 | __u32 payload_offset; | ||
61 | __u32 payload_length; | ||
62 | __u64 setup_data; | ||
49 | } __attribute__((packed)); | 63 | } __attribute__((packed)); |
50 | 64 | ||
51 | struct sys_desc_table { | 65 | struct sys_desc_table { |
diff --git a/include/asm-x86/e820_64.h b/include/asm-x86/e820_64.h index f478c57eb060..b5e02e379af3 100644 --- a/include/asm-x86/e820_64.h +++ b/include/asm-x86/e820_64.h | |||
@@ -48,6 +48,7 @@ extern struct e820map e820; | |||
48 | extern void update_e820(void); | 48 | extern void update_e820(void); |
49 | 49 | ||
50 | extern void reserve_early(unsigned long start, unsigned long end, char *name); | 50 | extern void reserve_early(unsigned long start, unsigned long end, char *name); |
51 | extern void free_early(unsigned long start, unsigned long end); | ||
51 | extern void early_res_to_bootmem(void); | 52 | extern void early_res_to_bootmem(void); |
52 | 53 | ||
53 | #endif/*!__ASSEMBLY__*/ | 54 | #endif/*!__ASSEMBLY__*/ |
diff --git a/include/linux/bitops.h b/include/linux/bitops.h index 40d54731de7e..48bde600a2db 100644 --- a/include/linux/bitops.h +++ b/include/linux/bitops.h | |||
@@ -112,4 +112,144 @@ static inline unsigned fls_long(unsigned long l) | |||
112 | return fls64(l); | 112 | return fls64(l); |
113 | } | 113 | } |
114 | 114 | ||
115 | #ifdef __KERNEL__ | ||
116 | #ifdef CONFIG_GENERIC_FIND_FIRST_BIT | ||
117 | extern unsigned long __find_first_bit(const unsigned long *addr, | ||
118 | unsigned long size); | ||
119 | |||
120 | /** | ||
121 | * find_first_bit - find the first set bit in a memory region | ||
122 | * @addr: The address to start the search at | ||
123 | * @size: The maximum size to search | ||
124 | * | ||
125 | * Returns the bit number of the first set bit. | ||
126 | */ | ||
127 | static __always_inline unsigned long | ||
128 | find_first_bit(const unsigned long *addr, unsigned long size) | ||
129 | { | ||
130 | /* Avoid a function call if the bitmap size is a constant */ | ||
131 | /* and not bigger than BITS_PER_LONG. */ | ||
132 | |||
133 | /* insert a sentinel so that __ffs returns size if there */ | ||
134 | /* are no set bits in the bitmap */ | ||
135 | if (__builtin_constant_p(size) && (size < BITS_PER_LONG)) | ||
136 | return __ffs((*addr) | (1ul << size)); | ||
137 | |||
138 | /* the result of __ffs(0) is undefined, so it needs to be */ | ||
139 | /* handled separately */ | ||
140 | if (__builtin_constant_p(size) && (size == BITS_PER_LONG)) | ||
141 | return ((*addr) == 0) ? BITS_PER_LONG : __ffs(*addr); | ||
142 | |||
143 | /* size is not constant or too big */ | ||
144 | return __find_first_bit(addr, size); | ||
145 | } | ||
146 | |||
147 | extern unsigned long __find_first_zero_bit(const unsigned long *addr, | ||
148 | unsigned long size); | ||
149 | |||
150 | /** | ||
151 | * find_first_zero_bit - find the first cleared bit in a memory region | ||
152 | * @addr: The address to start the search at | ||
153 | * @size: The maximum size to search | ||
154 | * | ||
155 | * Returns the bit number of the first cleared bit. | ||
156 | */ | ||
157 | static __always_inline unsigned long | ||
158 | find_first_zero_bit(const unsigned long *addr, unsigned long size) | ||
159 | { | ||
160 | /* Avoid a function call if the bitmap size is a constant */ | ||
161 | /* and not bigger than BITS_PER_LONG. */ | ||
162 | |||
163 | /* insert a sentinel so that __ffs returns size if there */ | ||
164 | /* are no set bits in the bitmap */ | ||
165 | if (__builtin_constant_p(size) && (size < BITS_PER_LONG)) { | ||
166 | return __ffs(~(*addr) | (1ul << size)); | ||
167 | } | ||
168 | |||
169 | /* the result of __ffs(0) is undefined, so it needs to be */ | ||
170 | /* handled separately */ | ||
171 | if (__builtin_constant_p(size) && (size == BITS_PER_LONG)) | ||
172 | return (~(*addr) == 0) ? BITS_PER_LONG : __ffs(~(*addr)); | ||
173 | |||
174 | /* size is not constant or too big */ | ||
175 | return __find_first_zero_bit(addr, size); | ||
176 | } | ||
177 | #endif /* CONFIG_GENERIC_FIND_FIRST_BIT */ | ||
178 | |||
179 | #ifdef CONFIG_GENERIC_FIND_NEXT_BIT | ||
180 | extern unsigned long __find_next_bit(const unsigned long *addr, | ||
181 | unsigned long size, unsigned long offset); | ||
182 | |||
183 | /** | ||
184 | * find_next_bit - find the next set bit in a memory region | ||
185 | * @addr: The address to base the search on | ||
186 | * @offset: The bitnumber to start searching at | ||
187 | * @size: The bitmap size in bits | ||
188 | */ | ||
189 | static __always_inline unsigned long | ||
190 | find_next_bit(const unsigned long *addr, unsigned long size, | ||
191 | unsigned long offset) | ||
192 | { | ||
193 | unsigned long value; | ||
194 | |||
195 | /* Avoid a function call if the bitmap size is a constant */ | ||
196 | /* and not bigger than BITS_PER_LONG. */ | ||
197 | |||
198 | /* insert a sentinel so that __ffs returns size if there */ | ||
199 | /* are no set bits in the bitmap */ | ||
200 | if (__builtin_constant_p(size) && (size < BITS_PER_LONG)) { | ||
201 | value = (*addr) & ((~0ul) << offset); | ||
202 | value |= (1ul << size); | ||
203 | return __ffs(value); | ||
204 | } | ||
205 | |||
206 | /* the result of __ffs(0) is undefined, so it needs to be */ | ||
207 | /* handled separately */ | ||
208 | if (__builtin_constant_p(size) && (size == BITS_PER_LONG)) { | ||
209 | value = (*addr) & ((~0ul) << offset); | ||
210 | return (value == 0) ? BITS_PER_LONG : __ffs(value); | ||
211 | } | ||
212 | |||
213 | /* size is not constant or too big */ | ||
214 | return __find_next_bit(addr, size, offset); | ||
215 | } | ||
216 | |||
217 | extern unsigned long __find_next_zero_bit(const unsigned long *addr, | ||
218 | unsigned long size, unsigned long offset); | ||
219 | |||
220 | /** | ||
221 | * find_next_zero_bit - find the next cleared bit in a memory region | ||
222 | * @addr: The address to base the search on | ||
223 | * @offset: The bitnumber to start searching at | ||
224 | * @size: The bitmap size in bits | ||
225 | */ | ||
226 | static __always_inline unsigned long | ||
227 | find_next_zero_bit(const unsigned long *addr, unsigned long size, | ||
228 | unsigned long offset) | ||
229 | { | ||
230 | unsigned long value; | ||
231 | |||
232 | /* Avoid a function call if the bitmap size is a constant */ | ||
233 | /* and not bigger than BITS_PER_LONG. */ | ||
234 | |||
235 | /* insert a sentinel so that __ffs returns size if there */ | ||
236 | /* are no set bits in the bitmap */ | ||
237 | if (__builtin_constant_p(size) && (size < BITS_PER_LONG)) { | ||
238 | value = (~(*addr)) & ((~0ul) << offset); | ||
239 | value |= (1ul << size); | ||
240 | return __ffs(value); | ||
241 | } | ||
242 | |||
243 | /* the result of __ffs(0) is undefined, so it needs to be */ | ||
244 | /* handled separately */ | ||
245 | if (__builtin_constant_p(size) && (size == BITS_PER_LONG)) { | ||
246 | value = (~(*addr)) & ((~0ul) << offset); | ||
247 | return (value == 0) ? BITS_PER_LONG : __ffs(value); | ||
248 | } | ||
249 | |||
250 | /* size is not constant or too big */ | ||
251 | return __find_next_zero_bit(addr, size, offset); | ||
252 | } | ||
253 | #endif /* CONFIG_GENERIC_FIND_NEXT_BIT */ | ||
254 | #endif /* __KERNEL__ */ | ||
115 | #endif | 255 | #endif |
diff --git a/include/linux/ide.h b/include/linux/ide.h index f20410dd4482..f0af504dfa42 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h | |||
@@ -387,6 +387,43 @@ typedef struct ide_drive_s { | |||
387 | 387 | ||
388 | struct ide_port_info; | 388 | struct ide_port_info; |
389 | 389 | ||
390 | struct ide_port_ops { | ||
391 | /* host specific initialization of devices on a port */ | ||
392 | void (*port_init_devs)(struct hwif_s *); | ||
393 | /* routine to program host for PIO mode */ | ||
394 | void (*set_pio_mode)(ide_drive_t *, const u8); | ||
395 | /* routine to program host for DMA mode */ | ||
396 | void (*set_dma_mode)(ide_drive_t *, const u8); | ||
397 | /* tweaks hardware to select drive */ | ||
398 | void (*selectproc)(ide_drive_t *); | ||
399 | /* chipset polling based on hba specifics */ | ||
400 | int (*reset_poll)(ide_drive_t *); | ||
401 | /* chipset specific changes to default for device-hba resets */ | ||
402 | void (*pre_reset)(ide_drive_t *); | ||
403 | /* routine to reset controller after a disk reset */ | ||
404 | void (*resetproc)(ide_drive_t *); | ||
405 | /* special host masking for drive selection */ | ||
406 | void (*maskproc)(ide_drive_t *, int); | ||
407 | /* check host's drive quirk list */ | ||
408 | void (*quirkproc)(ide_drive_t *); | ||
409 | |||
410 | u8 (*mdma_filter)(ide_drive_t *); | ||
411 | u8 (*udma_filter)(ide_drive_t *); | ||
412 | |||
413 | u8 (*cable_detect)(struct hwif_s *); | ||
414 | }; | ||
415 | |||
416 | struct ide_dma_ops { | ||
417 | void (*dma_host_set)(struct ide_drive_s *, int); | ||
418 | int (*dma_setup)(struct ide_drive_s *); | ||
419 | void (*dma_exec_cmd)(struct ide_drive_s *, u8); | ||
420 | void (*dma_start)(struct ide_drive_s *); | ||
421 | int (*dma_end)(struct ide_drive_s *); | ||
422 | int (*dma_test_irq)(struct ide_drive_s *); | ||
423 | void (*dma_lost_irq)(struct ide_drive_s *); | ||
424 | void (*dma_timeout)(struct ide_drive_s *); | ||
425 | }; | ||
426 | |||
390 | typedef struct hwif_s { | 427 | typedef struct hwif_s { |
391 | struct hwif_s *next; /* for linked-list in ide_hwgroup_t */ | 428 | struct hwif_s *next; /* for linked-list in ide_hwgroup_t */ |
392 | struct hwif_s *mate; /* other hwif from same PCI chip */ | 429 | struct hwif_s *mate; /* other hwif from same PCI chip */ |
@@ -420,38 +457,12 @@ typedef struct hwif_s { | |||
420 | 457 | ||
421 | struct device *dev; | 458 | struct device *dev; |
422 | 459 | ||
423 | const struct ide_port_info *cds; /* chipset device struct */ | ||
424 | |||
425 | ide_ack_intr_t *ack_intr; | 460 | ide_ack_intr_t *ack_intr; |
426 | 461 | ||
427 | void (*rw_disk)(ide_drive_t *, struct request *); | 462 | void (*rw_disk)(ide_drive_t *, struct request *); |
428 | 463 | ||
429 | #if 0 | 464 | const struct ide_port_ops *port_ops; |
430 | ide_hwif_ops_t *hwifops; | 465 | const struct ide_dma_ops *dma_ops; |
431 | #else | ||
432 | /* host specific initialization of devices on a port */ | ||
433 | void (*port_init_devs)(struct hwif_s *); | ||
434 | /* routine to program host for PIO mode */ | ||
435 | void (*set_pio_mode)(ide_drive_t *, const u8); | ||
436 | /* routine to program host for DMA mode */ | ||
437 | void (*set_dma_mode)(ide_drive_t *, const u8); | ||
438 | /* tweaks hardware to select drive */ | ||
439 | void (*selectproc)(ide_drive_t *); | ||
440 | /* chipset polling based on hba specifics */ | ||
441 | int (*reset_poll)(ide_drive_t *); | ||
442 | /* chipset specific changes to default for device-hba resets */ | ||
443 | void (*pre_reset)(ide_drive_t *); | ||
444 | /* routine to reset controller after a disk reset */ | ||
445 | void (*resetproc)(ide_drive_t *); | ||
446 | /* special host masking for drive selection */ | ||
447 | void (*maskproc)(ide_drive_t *, int); | ||
448 | /* check host's drive quirk list */ | ||
449 | void (*quirkproc)(ide_drive_t *); | ||
450 | #endif | ||
451 | u8 (*mdma_filter)(ide_drive_t *); | ||
452 | u8 (*udma_filter)(ide_drive_t *); | ||
453 | |||
454 | u8 (*cable_detect)(struct hwif_s *); | ||
455 | 466 | ||
456 | void (*ata_input_data)(ide_drive_t *, void *, u32); | 467 | void (*ata_input_data)(ide_drive_t *, void *, u32); |
457 | void (*ata_output_data)(ide_drive_t *, void *, u32); | 468 | void (*ata_output_data)(ide_drive_t *, void *, u32); |
@@ -459,15 +470,7 @@ typedef struct hwif_s { | |||
459 | void (*atapi_input_bytes)(ide_drive_t *, void *, u32); | 470 | void (*atapi_input_bytes)(ide_drive_t *, void *, u32); |
460 | void (*atapi_output_bytes)(ide_drive_t *, void *, u32); | 471 | void (*atapi_output_bytes)(ide_drive_t *, void *, u32); |
461 | 472 | ||
462 | void (*dma_host_set)(ide_drive_t *, int); | ||
463 | int (*dma_setup)(ide_drive_t *); | ||
464 | void (*dma_exec_cmd)(ide_drive_t *, u8); | ||
465 | void (*dma_start)(ide_drive_t *); | ||
466 | int (*ide_dma_end)(ide_drive_t *drive); | ||
467 | int (*ide_dma_test_irq)(ide_drive_t *drive); | ||
468 | void (*ide_dma_clear_irq)(ide_drive_t *drive); | 473 | void (*ide_dma_clear_irq)(ide_drive_t *drive); |
469 | void (*dma_lost_irq)(ide_drive_t *drive); | ||
470 | void (*dma_timeout)(ide_drive_t *drive); | ||
471 | 474 | ||
472 | void (*OUTB)(u8 addr, unsigned long port); | 475 | void (*OUTB)(u8 addr, unsigned long port); |
473 | void (*OUTBSYNC)(ide_drive_t *drive, u8 addr, unsigned long port); | 476 | void (*OUTBSYNC)(ide_drive_t *drive, u8 addr, unsigned long port); |
@@ -514,7 +517,6 @@ typedef struct hwif_s { | |||
514 | unsigned long extra_base; /* extra addr for dma ports */ | 517 | unsigned long extra_base; /* extra addr for dma ports */ |
515 | unsigned extra_ports; /* number of extra dma ports */ | 518 | unsigned extra_ports; /* number of extra dma ports */ |
516 | 519 | ||
517 | unsigned noprobe : 1; /* don't probe for this interface */ | ||
518 | unsigned present : 1; /* this interface exists */ | 520 | unsigned present : 1; /* this interface exists */ |
519 | unsigned serialized : 1; /* serialized all channel operation */ | 521 | unsigned serialized : 1; /* serialized all channel operation */ |
520 | unsigned sharing_irq: 1; /* 1 = sharing irq with another hwif */ | 522 | unsigned sharing_irq: 1; /* 1 = sharing irq with another hwif */ |
@@ -1009,10 +1011,15 @@ void ide_pci_setup_ports(struct pci_dev *, const struct ide_port_info *, int, u8 | |||
1009 | void ide_setup_pci_noise(struct pci_dev *, const struct ide_port_info *); | 1011 | void ide_setup_pci_noise(struct pci_dev *, const struct ide_port_info *); |
1010 | 1012 | ||
1011 | #ifdef CONFIG_BLK_DEV_IDEDMA_PCI | 1013 | #ifdef CONFIG_BLK_DEV_IDEDMA_PCI |
1012 | void ide_hwif_setup_dma(ide_hwif_t *, const struct ide_port_info *); | 1014 | int ide_pci_set_master(struct pci_dev *, const char *); |
1015 | unsigned long ide_pci_dma_base(ide_hwif_t *, const struct ide_port_info *); | ||
1016 | int ide_hwif_setup_dma(ide_hwif_t *, const struct ide_port_info *); | ||
1013 | #else | 1017 | #else |
1014 | static inline void ide_hwif_setup_dma(ide_hwif_t *hwif, | 1018 | static inline int ide_hwif_setup_dma(ide_hwif_t *hwif, |
1015 | const struct ide_port_info *d) { } | 1019 | const struct ide_port_info *d) |
1020 | { | ||
1021 | return -EINVAL; | ||
1022 | } | ||
1016 | #endif | 1023 | #endif |
1017 | 1024 | ||
1018 | extern void default_hwif_iops(ide_hwif_t *); | 1025 | extern void default_hwif_iops(ide_hwif_t *); |
@@ -1084,6 +1091,8 @@ enum { | |||
1084 | /* unmask IRQs */ | 1091 | /* unmask IRQs */ |
1085 | IDE_HFLAG_UNMASK_IRQS = (1 << 25), | 1092 | IDE_HFLAG_UNMASK_IRQS = (1 << 25), |
1086 | IDE_HFLAG_ABUSE_SET_DMA_MODE = (1 << 26), | 1093 | IDE_HFLAG_ABUSE_SET_DMA_MODE = (1 << 26), |
1094 | /* serialize ports if DMA is possible (for sl82c105) */ | ||
1095 | IDE_HFLAG_SERIALIZE_DMA = (1 << 27), | ||
1087 | /* force host out of "simplex" mode */ | 1096 | /* force host out of "simplex" mode */ |
1088 | IDE_HFLAG_CLEAR_SIMPLEX = (1 << 28), | 1097 | IDE_HFLAG_CLEAR_SIMPLEX = (1 << 28), |
1089 | /* DSC overlap is unsupported */ | 1098 | /* DSC overlap is unsupported */ |
@@ -1105,10 +1114,14 @@ struct ide_port_info { | |||
1105 | unsigned int (*init_chipset)(struct pci_dev *, const char *); | 1114 | unsigned int (*init_chipset)(struct pci_dev *, const char *); |
1106 | void (*init_iops)(ide_hwif_t *); | 1115 | void (*init_iops)(ide_hwif_t *); |
1107 | void (*init_hwif)(ide_hwif_t *); | 1116 | void (*init_hwif)(ide_hwif_t *); |
1108 | void (*init_dma)(ide_hwif_t *, unsigned long); | 1117 | int (*init_dma)(ide_hwif_t *, |
1118 | const struct ide_port_info *); | ||
1119 | |||
1120 | const struct ide_port_ops *port_ops; | ||
1121 | const struct ide_dma_ops *dma_ops; | ||
1122 | |||
1109 | ide_pci_enablebit_t enablebits[2]; | 1123 | ide_pci_enablebit_t enablebits[2]; |
1110 | hwif_chipset_t chipset; | 1124 | hwif_chipset_t chipset; |
1111 | u8 extra; | ||
1112 | u32 host_flags; | 1125 | u32 host_flags; |
1113 | u8 pio_mask; | 1126 | u8 pio_mask; |
1114 | u8 swdma_mask; | 1127 | u8 swdma_mask; |
@@ -1155,13 +1168,16 @@ void ide_destroy_dmatable(ide_drive_t *); | |||
1155 | 1168 | ||
1156 | #ifdef CONFIG_BLK_DEV_IDEDMA_SFF | 1169 | #ifdef CONFIG_BLK_DEV_IDEDMA_SFF |
1157 | extern int ide_build_dmatable(ide_drive_t *, struct request *); | 1170 | extern int ide_build_dmatable(ide_drive_t *, struct request *); |
1158 | extern int ide_release_dma(ide_hwif_t *); | 1171 | int ide_allocate_dma_engine(ide_hwif_t *); |
1159 | extern void ide_setup_dma(ide_hwif_t *, unsigned long); | 1172 | void ide_release_dma_engine(ide_hwif_t *); |
1173 | void ide_setup_dma(ide_hwif_t *, unsigned long); | ||
1160 | 1174 | ||
1161 | void ide_dma_host_set(ide_drive_t *, int); | 1175 | void ide_dma_host_set(ide_drive_t *, int); |
1162 | extern int ide_dma_setup(ide_drive_t *); | 1176 | extern int ide_dma_setup(ide_drive_t *); |
1177 | void ide_dma_exec_cmd(ide_drive_t *, u8); | ||
1163 | extern void ide_dma_start(ide_drive_t *); | 1178 | extern void ide_dma_start(ide_drive_t *); |
1164 | extern int __ide_dma_end(ide_drive_t *); | 1179 | extern int __ide_dma_end(ide_drive_t *); |
1180 | int ide_dma_test_irq(ide_drive_t *); | ||
1165 | extern void ide_dma_lost_irq(ide_drive_t *); | 1181 | extern void ide_dma_lost_irq(ide_drive_t *); |
1166 | extern void ide_dma_timeout(ide_drive_t *); | 1182 | extern void ide_dma_timeout(ide_drive_t *); |
1167 | #endif /* CONFIG_BLK_DEV_IDEDMA_SFF */ | 1183 | #endif /* CONFIG_BLK_DEV_IDEDMA_SFF */ |
@@ -1179,7 +1195,7 @@ static inline void ide_check_dma_crc(ide_drive_t *drive) { ; } | |||
1179 | #endif /* CONFIG_BLK_DEV_IDEDMA */ | 1195 | #endif /* CONFIG_BLK_DEV_IDEDMA */ |
1180 | 1196 | ||
1181 | #ifndef CONFIG_BLK_DEV_IDEDMA_SFF | 1197 | #ifndef CONFIG_BLK_DEV_IDEDMA_SFF |
1182 | static inline void ide_release_dma(ide_hwif_t *drive) {;} | 1198 | static inline void ide_release_dma_engine(ide_hwif_t *hwif) { ; } |
1183 | #endif | 1199 | #endif |
1184 | 1200 | ||
1185 | #ifdef CONFIG_BLK_DEV_IDEACPI | 1201 | #ifdef CONFIG_BLK_DEV_IDEACPI |
@@ -1199,8 +1215,6 @@ static inline void ide_acpi_set_state(ide_hwif_t *hwif, int on) {} | |||
1199 | #endif | 1215 | #endif |
1200 | 1216 | ||
1201 | void ide_remove_port_from_hwgroup(ide_hwif_t *); | 1217 | void ide_remove_port_from_hwgroup(ide_hwif_t *); |
1202 | extern int ide_hwif_request_regions(ide_hwif_t *hwif); | ||
1203 | extern void ide_hwif_release_regions(ide_hwif_t* hwif); | ||
1204 | void ide_unregister(unsigned int); | 1218 | void ide_unregister(unsigned int); |
1205 | 1219 | ||
1206 | void ide_register_region(struct gendisk *); | 1220 | void ide_register_region(struct gendisk *); |
@@ -1210,6 +1224,7 @@ void ide_undecoded_slave(ide_drive_t *); | |||
1210 | 1224 | ||
1211 | int ide_device_add_all(u8 *idx, const struct ide_port_info *); | 1225 | int ide_device_add_all(u8 *idx, const struct ide_port_info *); |
1212 | int ide_device_add(u8 idx[4], const struct ide_port_info *); | 1226 | int ide_device_add(u8 idx[4], const struct ide_port_info *); |
1227 | int ide_legacy_device_add(const struct ide_port_info *, unsigned long); | ||
1213 | void ide_port_unregister_devices(ide_hwif_t *); | 1228 | void ide_port_unregister_devices(ide_hwif_t *); |
1214 | void ide_port_scan(ide_hwif_t *); | 1229 | void ide_port_scan(ide_hwif_t *); |
1215 | 1230 | ||