VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   32 Branches   54 Tags
b24413180f560 (Greg Kroah-Hartman 2017-11-01 15:07:57 +0100  1) // SPDX-License-Identifier: GPL-2.0
cc2ea416b2aa0 (Andrew Morton      2007-07-15 23:41:38 -0700  2) #include <linux/io.h>
8bc3bcc93a2b4 (Paul Gortmaker     2011-11-16 21:29:17 -0500  3) #include <linux/export.h>
cc2ea416b2aa0 (Andrew Morton      2007-07-15 23:41:38 -0700  4) 
cc2ea416b2aa0 (Andrew Morton      2007-07-15 23:41:38 -0700  5) /**
cc2ea416b2aa0 (Andrew Morton      2007-07-15 23:41:38 -0700  6)  *	check_signature		-	find BIOS signatures
cc2ea416b2aa0 (Andrew Morton      2007-07-15 23:41:38 -0700  7)  *	@io_addr: mmio address to check
cc2ea416b2aa0 (Andrew Morton      2007-07-15 23:41:38 -0700  8)  *	@signature:  signature block
cc2ea416b2aa0 (Andrew Morton      2007-07-15 23:41:38 -0700  9)  *	@length: length of signature
cc2ea416b2aa0 (Andrew Morton      2007-07-15 23:41:38 -0700 10)  *
cc2ea416b2aa0 (Andrew Morton      2007-07-15 23:41:38 -0700 11)  *	Perform a signature comparison with the mmio address io_addr. This
cc2ea416b2aa0 (Andrew Morton      2007-07-15 23:41:38 -0700 12)  *	address should have been obtained by ioremap.
cc2ea416b2aa0 (Andrew Morton      2007-07-15 23:41:38 -0700 13)  *	Returns 1 on a match.
cc2ea416b2aa0 (Andrew Morton      2007-07-15 23:41:38 -0700 14)  */
cc2ea416b2aa0 (Andrew Morton      2007-07-15 23:41:38 -0700 15) 
cc2ea416b2aa0 (Andrew Morton      2007-07-15 23:41:38 -0700 16) int check_signature(const volatile void __iomem *io_addr,
cc2ea416b2aa0 (Andrew Morton      2007-07-15 23:41:38 -0700 17) 			const unsigned char *signature, int length)
cc2ea416b2aa0 (Andrew Morton      2007-07-15 23:41:38 -0700 18) {
cc2ea416b2aa0 (Andrew Morton      2007-07-15 23:41:38 -0700 19) 	while (length--) {
cc2ea416b2aa0 (Andrew Morton      2007-07-15 23:41:38 -0700 20) 		if (readb(io_addr) != *signature)
cc2ea416b2aa0 (Andrew Morton      2007-07-15 23:41:38 -0700 21) 			return 0;
cc2ea416b2aa0 (Andrew Morton      2007-07-15 23:41:38 -0700 22) 		io_addr++;
cc2ea416b2aa0 (Andrew Morton      2007-07-15 23:41:38 -0700 23) 		signature++;
cc2ea416b2aa0 (Andrew Morton      2007-07-15 23:41:38 -0700 24) 	}
cc2ea416b2aa0 (Andrew Morton      2007-07-15 23:41:38 -0700 25) 	return 1;
cc2ea416b2aa0 (Andrew Morton      2007-07-15 23:41:38 -0700 26) }
cc2ea416b2aa0 (Andrew Morton      2007-07-15 23:41:38 -0700 27) EXPORT_SYMBOL(check_signature);