check_signature.c 599 B

123456789101112131415161718192021222324252627
  1. #include <linux/io.h>
  2. #include <linux/module.h>
  3. /**
  4. * check_signature - find BIOS signatures
  5. * @io_addr: mmio address to check
  6. * @signature: signature block
  7. * @length: length of signature
  8. *
  9. * Perform a signature comparison with the mmio address io_addr. This
  10. * address should have been obtained by ioremap.
  11. * Returns 1 on a match.
  12. */
  13. int check_signature(const volatile void __iomem *io_addr,
  14. const unsigned char *signature, int length)
  15. {
  16. while (length--) {
  17. if (readb(io_addr) != *signature)
  18. return 0;
  19. io_addr++;
  20. signature++;
  21. }
  22. return 1;
  23. }
  24. EXPORT_SYMBOL(check_signature);