From e50190a8341485b413f599033cb74649f849d939 Mon Sep 17 00:00:00 2001 From: Matthew Wilcox Date: Wed, 11 Oct 2006 01:22:02 -0700 Subject: [PATCH] Consolidate check_signature There's nothing arch-specific about check_signature(), so move it to . Use a cross between the Alpha and i386 implementations as the generic one. Signed-off-by: Matthew Wilcox Acked-by: Alan Cox Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/linux/io.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'include/linux/io.h') diff --git a/include/linux/io.h b/include/linux/io.h index 2ad96c3f0e4e..81877ea39309 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); int ioremap_page_range(unsigned long addr, unsigned long end, unsigned long phys_addr, pgprot_t prot); +/** + * check_signature - find BIOS signatures + * @io_addr: mmio address to check + * @signature: signature block + * @length: length of signature + * + * Perform a signature comparison with the mmio address io_addr. This + * address should have been obtained by ioremap. + * Returns 1 on a match. + */ + +static inline int check_signature(const volatile void __iomem *io_addr, + const unsigned char *signature, int length) +{ + int retval = 0; + do { + if (readb(io_addr) != *signature) + goto out; + io_addr++; + signature++; + length--; + } while (length); + retval = 1; +out: + return retval; +} + #endif /* _LINUX_IO_H */ -- cgit v1.2.3-55-g7522