aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMatthew Wilcox <matthew@wil.cx>2006-10-11 04:22:02 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-11 14:14:23 -0400
commite50190a8341485b413f599033cb74649f849d939 (patch)
treec45e165f8167dd95f3b5d4163433b91c8b7afd55 /include
parent53d5ed627df852ba8bab7f70df25290bd733792c (diff)
[PATCH] Consolidate check_signature
There's nothing arch-specific about check_signature(), so move it to <linux/io.h>. Use a cross between the Alpha and i386 implementations as the generic one. Signed-off-by: Matthew Wilcox <willy@parisc-linux.org> Acked-by: Alan Cox <alan@redhat.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include')
-rw-r--r--include/asm-alpha/io.h13
-rw-r--r--include/asm-arm/io.h17
-rw-r--r--include/asm-frv/io.h21
-rw-r--r--include/asm-i386/io.h27
-rw-r--r--include/asm-m32r/io.h32
-rw-r--r--include/asm-mips/io.h26
-rw-r--r--include/asm-powerpc/io.h26
-rw-r--r--include/asm-ppc/io.h16
-rw-r--r--include/asm-sh/io.h16
-rw-r--r--include/asm-sh64/io.h16
-rw-r--r--include/asm-sparc64/io.h15
-rw-r--r--include/asm-x86_64/io.h27
-rw-r--r--include/linux/io.h27
13 files changed, 27 insertions, 252 deletions
diff --git a/include/asm-alpha/io.h b/include/asm-alpha/io.h
index f5ae98c25d1..5d15af24573 100644
--- a/include/asm-alpha/io.h
+++ b/include/asm-alpha/io.h
@@ -533,19 +533,6 @@ extern void outsl (unsigned long port, const void *src, unsigned long count);
533#define eth_io_copy_and_sum(skb,src,len,unused) \ 533#define eth_io_copy_and_sum(skb,src,len,unused) \
534 memcpy_fromio((skb)->data,src,len) 534 memcpy_fromio((skb)->data,src,len)
535 535
536static inline int
537check_signature(const volatile void __iomem *io_addr,
538 const unsigned char *signature, int length)
539{
540 do {
541 if (readb(io_addr) != *signature)
542 return 0;
543 io_addr++;
544 signature++;
545 } while (--length);
546 return 1;
547}
548
549/* 536/*
550 * The Alpha Jensen hardware for some rather strange reason puts 537 * The Alpha Jensen hardware for some rather strange reason puts
551 * the RTC clock at 0x170 instead of 0x70. Probably due to some 538 * the RTC clock at 0x170 instead of 0x70. Probably due to some
diff --git a/include/asm-arm/io.h b/include/asm-arm/io.h
index 34aaaac4f61..ae999fd5dc6 100644
--- a/include/asm-arm/io.h
+++ b/include/asm-arm/io.h
@@ -193,23 +193,6 @@ extern void _memset_io(volatile void __iomem *, int, size_t);
193#define eth_io_copy_and_sum(s,c,l,b) \ 193#define eth_io_copy_and_sum(s,c,l,b) \
194 eth_copy_and_sum((s),__mem_pci(c),(l),(b)) 194 eth_copy_and_sum((s),__mem_pci(c),(l),(b))
195 195
196static inline int
197check_signature(void __iomem *io_addr, const unsigned char *signature,
198 int length)
199{
200 int retval = 0;
201 do {
202 if (readb(io_addr) != *signature)
203 goto out;
204 io_addr++;
205 signature++;
206 length--;
207 } while (length);
208 retval = 1;
209out:
210 return retval;
211}
212
213#elif !defined(readb) 196#elif !defined(readb)
214 197
215#define readb(c) (__readwrite_bug("readb"),0) 198#define readb(c) (__readwrite_bug("readb"),0)
diff --git a/include/asm-frv/io.h b/include/asm-frv/io.h
index 7765f552889..20e44fe00ab 100644
--- a/include/asm-frv/io.h
+++ b/include/asm-frv/io.h
@@ -385,27 +385,6 @@ static inline void pci_iounmap(struct pci_dev *dev, void __iomem *p)
385 */ 385 */
386#define xlate_dev_kmem_ptr(p) p 386#define xlate_dev_kmem_ptr(p) p
387 387
388/*
389 * Check BIOS signature
390 */
391static inline int check_signature(volatile void __iomem *io_addr,
392 const unsigned char *signature, int length)
393{
394 int retval = 0;
395
396 do {
397 if (readb(io_addr) != *signature)
398 goto out;
399 io_addr++;
400 signature++;
401 length--;
402 } while (length);
403
404 retval = 1;
405out:
406 return retval;
407}
408
409#endif /* __KERNEL__ */ 388#endif /* __KERNEL__ */
410 389
411#endif /* _ASM_IO_H */ 390#endif /* _ASM_IO_H */
diff --git a/include/asm-i386/io.h b/include/asm-i386/io.h
index b3724fe93ff..68df0dc3ab8 100644
--- a/include/asm-i386/io.h
+++ b/include/asm-i386/io.h
@@ -224,33 +224,6 @@ static inline void memcpy_toio(volatile void __iomem *dst, const void *src, int
224 224
225#define eth_io_copy_and_sum(a,b,c,d) eth_copy_and_sum((a),(void __force *)(b),(c),(d)) 225#define eth_io_copy_and_sum(a,b,c,d) eth_copy_and_sum((a),(void __force *)(b),(c),(d))
226 226
227/**
228 * check_signature - find BIOS signatures
229 * @io_addr: mmio address to check
230 * @signature: signature block
231 * @length: length of signature
232 *
233 * Perform a signature comparison with the mmio address io_addr. This
234 * address should have been obtained by ioremap.
235 * Returns 1 on a match.
236 */
237
238static inline int check_signature(volatile void __iomem * io_addr,
239 const unsigned char *signature, int length)
240{
241 int retval = 0;
242 do {
243 if (readb(io_addr) != *signature)
244 goto out;
245 io_addr++;
246 signature++;
247 length--;
248 } while (length);
249 retval = 1;
250out:
251 return retval;
252}
253
254/* 227/*
255 * Cache management 228 * Cache management
256 * 229 *
diff --git a/include/asm-m32r/io.h b/include/asm-m32r/io.h
index 70ad1c949c2..d06933bd631 100644
--- a/include/asm-m32r/io.h
+++ b/include/asm-m32r/io.h
@@ -166,38 +166,6 @@ static inline void _writel(unsigned long l, unsigned long addr)
166 166
167#define flush_write_buffers() do { } while (0) /* M32R_FIXME */ 167#define flush_write_buffers() do { } while (0) /* M32R_FIXME */
168 168
169/**
170 * check_signature - find BIOS signatures
171 * @io_addr: mmio address to check
172 * @signature: signature block
173 * @length: length of signature
174 *
175 * Perform a signature comparison with the ISA mmio address io_addr.
176 * Returns 1 on a match.
177 *
178 * This function is deprecated. New drivers should use ioremap and
179 * check_signature.
180 */
181
182static inline int check_signature(void __iomem *io_addr,
183 const unsigned char *signature, int length)
184{
185 int retval = 0;
186#if 0
187printk("check_signature\n");
188 do {
189 if (readb(io_addr) != *signature)
190 goto out;
191 io_addr++;
192 signature++;
193 length--;
194 } while (length);
195 retval = 1;
196out:
197#endif
198 return retval;
199}
200
201static inline void 169static inline void
202memset_io(volatile void __iomem *addr, unsigned char val, int count) 170memset_io(volatile void __iomem *addr, unsigned char val, int count)
203{ 171{
diff --git a/include/asm-mips/io.h b/include/asm-mips/io.h
index df624e1ee6e..c2d124badbe 100644
--- a/include/asm-mips/io.h
+++ b/include/asm-mips/io.h
@@ -562,32 +562,6 @@ extern void pci_iounmap(struct pci_dev *dev, void __iomem *);
562#define eth_io_copy_and_sum(skb,src,len,unused) memcpy_fromio((skb)->data,(src),(len)) 562#define eth_io_copy_and_sum(skb,src,len,unused) memcpy_fromio((skb)->data,(src),(len))
563 563
564/* 564/*
565 * check_signature - find BIOS signatures
566 * @io_addr: mmio address to check
567 * @signature: signature block
568 * @length: length of signature
569 *
570 * Perform a signature comparison with the mmio address io_addr. This
571 * address should have been obtained by ioremap.
572 * Returns 1 on a match.
573 */
574static inline int check_signature(char __iomem *io_addr,
575 const unsigned char *signature, int length)
576{
577 int retval = 0;
578 do {
579 if (readb(io_addr) != *signature)
580 goto out;
581 io_addr++;
582 signature++;
583 length--;
584 } while (length);
585 retval = 1;
586out:
587 return retval;
588}
589
590/*
591 * The caches on some architectures aren't dma-coherent and have need to 565 * The caches on some architectures aren't dma-coherent and have need to
592 * handle this in software. There are three types of operations that 566 * handle this in software. There are three types of operations that
593 * can be applied to dma buffers. 567 * can be applied to dma buffers.
diff --git a/include/asm-powerpc/io.h b/include/asm-powerpc/io.h
index cbbd8c648df..3baff8b0fd5 100644
--- a/include/asm-powerpc/io.h
+++ b/include/asm-powerpc/io.h
@@ -404,32 +404,6 @@ static inline void __out_be64(volatile unsigned long __iomem *addr, unsigned lon
404 404
405#include <asm/eeh.h> 405#include <asm/eeh.h>
406 406
407/**
408 * check_signature - find BIOS signatures
409 * @io_addr: mmio address to check
410 * @signature: signature block
411 * @length: length of signature
412 *
413 * Perform a signature comparison with the mmio address io_addr. This
414 * address should have been obtained by ioremap.
415 * Returns 1 on a match.
416 */
417static inline int check_signature(const volatile void __iomem * io_addr,
418 const unsigned char *signature, int length)
419{
420 int retval = 0;
421 do {
422 if (readb(io_addr) != *signature)
423 goto out;
424 io_addr++;
425 signature++;
426 length--;
427 } while (length);
428 retval = 1;
429out:
430 return retval;
431}
432
433/* Nothing to do */ 407/* Nothing to do */
434 408
435#define dma_cache_inv(_start,_size) do { } while (0) 409#define dma_cache_inv(_start,_size) do { } while (0)
diff --git a/include/asm-ppc/io.h b/include/asm-ppc/io.h
index 3d9a9e6f332..a4c411b753e 100644
--- a/include/asm-ppc/io.h
+++ b/include/asm-ppc/io.h
@@ -439,22 +439,6 @@ extern inline void * phys_to_virt(unsigned long address)
439#define iobarrier_r() eieio() 439#define iobarrier_r() eieio()
440#define iobarrier_w() eieio() 440#define iobarrier_w() eieio()
441 441
442static inline int check_signature(volatile void __iomem * io_addr,
443 const unsigned char *signature, int length)
444{
445 int retval = 0;
446 do {
447 if (readb(io_addr) != *signature)
448 goto out;
449 io_addr++;
450 signature++;
451 length--;
452 } while (length);
453 retval = 1;
454out:
455 return retval;
456}
457
458/* 442/*
459 * Here comes the ppc implementation of the IOMAP 443 * Here comes the ppc implementation of the IOMAP
460 * interfaces. 444 * interfaces.
diff --git a/include/asm-sh/io.h b/include/asm-sh/io.h
index ed12d38e8c0..a0e55b09e4f 100644
--- a/include/asm-sh/io.h
+++ b/include/asm-sh/io.h
@@ -304,22 +304,6 @@ __ioremap_mode(unsigned long offset, unsigned long size, unsigned long flags)
304#define iounmap(addr) \ 304#define iounmap(addr) \
305 __iounmap((addr)) 305 __iounmap((addr))
306 306
307static inline int check_signature(char __iomem *io_addr,
308 const unsigned char *signature, int length)
309{
310 int retval = 0;
311 do {
312 if (readb(io_addr) != *signature)
313 goto out;
314 io_addr++;
315 signature++;
316 length--;
317 } while (length);
318 retval = 1;
319out:
320 return retval;
321}
322
323/* 307/*
324 * The caches on some architectures aren't dma-coherent and have need to 308 * The caches on some architectures aren't dma-coherent and have need to
325 * handle this in software. There are three types of operations that 309 * handle this in software. There are three types of operations that
diff --git a/include/asm-sh64/io.h b/include/asm-sh64/io.h
index 252fedbb662..14d8e7b4bf4 100644
--- a/include/asm-sh64/io.h
+++ b/include/asm-sh64/io.h
@@ -178,22 +178,6 @@ extern void iounmap(void *addr);
178unsigned long onchip_remap(unsigned long addr, unsigned long size, const char* name); 178unsigned long onchip_remap(unsigned long addr, unsigned long size, const char* name);
179extern void onchip_unmap(unsigned long vaddr); 179extern void onchip_unmap(unsigned long vaddr);
180 180
181static __inline__ int check_signature(volatile void __iomem *io_addr,
182 const unsigned char *signature, int length)
183{
184 int retval = 0;
185 do {
186 if (readb(io_addr) != *signature)
187 goto out;
188 io_addr++;
189 signature++;
190 length--;
191 } while (length);
192 retval = 1;
193out:
194 return retval;
195}
196
197/* 181/*
198 * The caches on some architectures aren't dma-coherent and have need to 182 * The caches on some architectures aren't dma-coherent and have need to
199 * handle this in software. There are three types of operations that 183 * handle this in software. There are three types of operations that
diff --git a/include/asm-sparc64/io.h b/include/asm-sparc64/io.h
index 0056770e83a..30b912d8e8b 100644
--- a/include/asm-sparc64/io.h
+++ b/include/asm-sparc64/io.h
@@ -440,21 +440,6 @@ _memcpy_toio(volatile void __iomem *dst, const void *src, __kernel_size_t n)
440 440
441#define memcpy_toio(d,s,sz) _memcpy_toio(d,s,sz) 441#define memcpy_toio(d,s,sz) _memcpy_toio(d,s,sz)
442 442
443static inline int check_signature(void __iomem *io_addr,
444 const unsigned char *signature,
445 int length)
446{
447 int retval = 0;
448 do {
449 if (readb(io_addr) != *signature++)
450 goto out;
451 io_addr++;
452 } while (--length);
453 retval = 1;
454out:
455 return retval;
456}
457
458#define mmiowb() 443#define mmiowb()
459 444
460#ifdef __KERNEL__ 445#ifdef __KERNEL__
diff --git a/include/asm-x86_64/io.h b/include/asm-x86_64/io.h
index 70e91fe7634..6ee9fadaaac 100644
--- a/include/asm-x86_64/io.h
+++ b/include/asm-x86_64/io.h
@@ -254,33 +254,6 @@ void memset_io(volatile void __iomem *a, int b, size_t c);
254 254
255#define eth_io_copy_and_sum(a,b,c,d) eth_copy_and_sum((a),(void *)(b),(c),(d)) 255#define eth_io_copy_and_sum(a,b,c,d) eth_copy_and_sum((a),(void *)(b),(c),(d))
256 256
257/**
258 * check_signature - find BIOS signatures
259 * @io_addr: mmio address to check
260 * @signature: signature block
261 * @length: length of signature
262 *
263 * Perform a signature comparison with the mmio address io_addr. This
264 * address should have been obtained by ioremap.
265 * Returns 1 on a match.
266 */
267
268static inline int check_signature(void __iomem *io_addr,
269 const unsigned char *signature, int length)
270{
271 int retval = 0;
272 do {
273 if (readb(io_addr) != *signature)
274 goto out;
275 io_addr++;
276 signature++;
277 length--;
278 } while (length);
279 retval = 1;
280out:
281 return retval;
282}
283
284/* Nothing to do */ 257/* Nothing to do */
285 258
286#define dma_cache_inv(_start,_size) do { } while (0) 259#define dma_cache_inv(_start,_size) do { } while (0)
diff --git a/include/linux/io.h b/include/linux/io.h
index 2ad96c3f0e4..81877ea3930 100644
--- a/include/linux/io.h
+++ b/include/linux/io.h
@@ -28,4 +28,31 @@ void __iowrite64_copy(void __iomem *to, const void *from, size_t count);
28int ioremap_page_range(unsigned long addr, unsigned long end, 28int ioremap_page_range(unsigned long addr, unsigned long end,
29 unsigned long phys_addr, pgprot_t prot); 29 unsigned long phys_addr, pgprot_t prot);
30 30
31/**
32 * check_signature - find BIOS signatures
33 * @io_addr: mmio address to check
34 * @signature: signature block
35 * @length: length of signature
36 *
37 * Perform a signature comparison with the mmio address io_addr. This
38 * address should have been obtained by ioremap.
39 * Returns 1 on a match.
40 */
41
42static inline int check_signature(const volatile void __iomem *io_addr,
43 const unsigned char *signature, int length)
44{
45 int retval = 0;
46 do {
47 if (readb(io_addr) != *signature)
48 goto out;
49 io_addr++;
50 signature++;
51 length--;
52 } while (length);
53 retval = 1;
54out:
55 return retval;
56}
57
31#endif /* _LINUX_IO_H */ 58#endif /* _LINUX_IO_H */