diff options
-rw-r--r-- | drivers/md/raid6.h | 4 | ||||
-rw-r--r-- | drivers/md/raid6algos.c | 1 | ||||
-rw-r--r-- | drivers/md/raid6altivec.uc | 18 | ||||
-rw-r--r-- | drivers/md/raid6test/Makefile | 27 |
4 files changed, 40 insertions, 10 deletions
diff --git a/drivers/md/raid6.h b/drivers/md/raid6.h index f80ee6350edf..31cbee71365f 100644 --- a/drivers/md/raid6.h +++ b/drivers/md/raid6.h | |||
@@ -69,9 +69,13 @@ extern const char raid6_empty_zero_page[PAGE_SIZE]; | |||
69 | #define __init | 69 | #define __init |
70 | #define __exit | 70 | #define __exit |
71 | #define __attribute_const__ __attribute__((const)) | 71 | #define __attribute_const__ __attribute__((const)) |
72 | #define noinline __attribute__((noinline)) | ||
72 | 73 | ||
73 | #define preempt_enable() | 74 | #define preempt_enable() |
74 | #define preempt_disable() | 75 | #define preempt_disable() |
76 | #define cpu_has_feature(x) 1 | ||
77 | #define enable_kernel_altivec() | ||
78 | #define disable_kernel_altivec() | ||
75 | 79 | ||
76 | #endif /* __KERNEL__ */ | 80 | #endif /* __KERNEL__ */ |
77 | 81 | ||
diff --git a/drivers/md/raid6algos.c b/drivers/md/raid6algos.c index acf386fc4b4f..51c63c0cf1c9 100644 --- a/drivers/md/raid6algos.c +++ b/drivers/md/raid6algos.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include "raid6.h" | 19 | #include "raid6.h" |
20 | #ifndef __KERNEL__ | 20 | #ifndef __KERNEL__ |
21 | #include <sys/mman.h> | 21 | #include <sys/mman.h> |
22 | #include <stdio.h> | ||
22 | #endif | 23 | #endif |
23 | 24 | ||
24 | struct raid6_calls raid6_call; | 25 | struct raid6_calls raid6_call; |
diff --git a/drivers/md/raid6altivec.uc b/drivers/md/raid6altivec.uc index 1de8f030eee0..b9afd35b8812 100644 --- a/drivers/md/raid6altivec.uc +++ b/drivers/md/raid6altivec.uc | |||
@@ -27,16 +27,20 @@ | |||
27 | #ifdef CONFIG_ALTIVEC | 27 | #ifdef CONFIG_ALTIVEC |
28 | 28 | ||
29 | #include <altivec.h> | 29 | #include <altivec.h> |
30 | #include <asm/system.h> | 30 | #ifdef __KERNEL__ |
31 | #include <asm/cputable.h> | 31 | # include <asm/system.h> |
32 | # include <asm/cputable.h> | ||
33 | #endif | ||
32 | 34 | ||
33 | /* | 35 | /* |
34 | * This is the C data type to use | 36 | * This is the C data type to use. We use a vector of |
37 | * signed char so vec_cmpgt() will generate the right | ||
38 | * instruction. | ||
35 | */ | 39 | */ |
36 | 40 | ||
37 | typedef vector unsigned char unative_t; | 41 | typedef vector signed char unative_t; |
38 | 42 | ||
39 | #define NBYTES(x) ((vector unsigned char) {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x}) | 43 | #define NBYTES(x) ((vector signed char) {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x}) |
40 | #define NSIZE sizeof(unative_t) | 44 | #define NSIZE sizeof(unative_t) |
41 | 45 | ||
42 | /* | 46 | /* |
@@ -108,7 +112,11 @@ int raid6_have_altivec(void); | |||
108 | int raid6_have_altivec(void) | 112 | int raid6_have_altivec(void) |
109 | { | 113 | { |
110 | /* This assumes either all CPUs have Altivec or none does */ | 114 | /* This assumes either all CPUs have Altivec or none does */ |
115 | # ifdef __KERNEL__ | ||
111 | return cpu_has_feature(CPU_FTR_ALTIVEC); | 116 | return cpu_has_feature(CPU_FTR_ALTIVEC); |
117 | # else | ||
118 | return 1; | ||
119 | # endif | ||
112 | } | 120 | } |
113 | #endif | 121 | #endif |
114 | 122 | ||
diff --git a/drivers/md/raid6test/Makefile b/drivers/md/raid6test/Makefile index 557806728609..78e0396adf2a 100644 --- a/drivers/md/raid6test/Makefile +++ b/drivers/md/raid6test/Makefile | |||
@@ -8,6 +8,8 @@ OPTFLAGS = -O2 # Adjust as desired | |||
8 | CFLAGS = -I.. -g $(OPTFLAGS) | 8 | CFLAGS = -I.. -g $(OPTFLAGS) |
9 | LD = ld | 9 | LD = ld |
10 | PERL = perl | 10 | PERL = perl |
11 | AR = ar | ||
12 | RANLIB = ranlib | ||
11 | 13 | ||
12 | .c.o: | 14 | .c.o: |
13 | $(CC) $(CFLAGS) -c -o $@ $< | 15 | $(CC) $(CFLAGS) -c -o $@ $< |
@@ -18,18 +20,33 @@ PERL = perl | |||
18 | %.uc: ../%.uc | 20 | %.uc: ../%.uc |
19 | cp -f $< $@ | 21 | cp -f $< $@ |
20 | 22 | ||
21 | all: raid6.o raid6test | 23 | all: raid6.a raid6test |
22 | 24 | ||
23 | raid6.o: raid6int1.o raid6int2.o raid6int4.o raid6int8.o raid6int16.o \ | 25 | raid6.a: raid6int1.o raid6int2.o raid6int4.o raid6int8.o raid6int16.o \ |
24 | raid6int32.o \ | 26 | raid6int32.o \ |
25 | raid6mmx.o raid6sse1.o raid6sse2.o \ | 27 | raid6mmx.o raid6sse1.o raid6sse2.o \ |
28 | raid6altivec1.o raid6altivec2.o raid6altivec4.o raid6altivec8.o \ | ||
26 | raid6recov.o raid6algos.o \ | 29 | raid6recov.o raid6algos.o \ |
27 | raid6tables.o | 30 | raid6tables.o |
28 | $(LD) -r -o $@ $^ | 31 | rm -f $@ |
32 | $(AR) cq $@ $^ | ||
33 | $(RANLIB) $@ | ||
29 | 34 | ||
30 | raid6test: raid6.o test.c | 35 | raid6test: test.c raid6.a |
31 | $(CC) $(CFLAGS) -o raid6test $^ | 36 | $(CC) $(CFLAGS) -o raid6test $^ |
32 | 37 | ||
38 | raid6altivec1.c: raid6altivec.uc ../unroll.pl | ||
39 | $(PERL) ../unroll.pl 1 < raid6altivec.uc > $@ | ||
40 | |||
41 | raid6altivec2.c: raid6altivec.uc ../unroll.pl | ||
42 | $(PERL) ../unroll.pl 2 < raid6altivec.uc > $@ | ||
43 | |||
44 | raid6altivec4.c: raid6altivec.uc ../unroll.pl | ||
45 | $(PERL) ../unroll.pl 4 < raid6altivec.uc > $@ | ||
46 | |||
47 | raid6altivec8.c: raid6altivec.uc ../unroll.pl | ||
48 | $(PERL) ../unroll.pl 8 < raid6altivec.uc > $@ | ||
49 | |||
33 | raid6int1.c: raid6int.uc ../unroll.pl | 50 | raid6int1.c: raid6int.uc ../unroll.pl |
34 | $(PERL) ../unroll.pl 1 < raid6int.uc > $@ | 51 | $(PERL) ../unroll.pl 1 < raid6int.uc > $@ |
35 | 52 | ||
@@ -52,7 +69,7 @@ raid6tables.c: mktables | |||
52 | ./mktables > raid6tables.c | 69 | ./mktables > raid6tables.c |
53 | 70 | ||
54 | clean: | 71 | clean: |
55 | rm -f *.o mktables mktables.c raid6int.uc raid6*.c raid6test | 72 | rm -f *.o *.a mktables mktables.c raid6int.uc raid6*.c raid6test |
56 | 73 | ||
57 | spotless: clean | 74 | spotless: clean |
58 | rm -f *~ | 75 | rm -f *~ |