genwqe_driver.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. #ifndef __GENWQE_DRIVER_H__
  3. #define __GENWQE_DRIVER_H__
  4. /**
  5. * IBM Accelerator Family 'GenWQE'
  6. *
  7. * (C) Copyright IBM Corp. 2013
  8. *
  9. * Author: Frank Haverkamp <[email protected]>
  10. * Author: Joerg-Stephan Vogt <[email protected]>
  11. * Author: Michael Jung <[email protected]>
  12. * Author: Michael Ruettger <[email protected]>
  13. */
  14. #include <linux/types.h>
  15. #include <linux/stddef.h>
  16. #include <linux/cdev.h>
  17. #include <linux/list.h>
  18. #include <linux/kthread.h>
  19. #include <linux/scatterlist.h>
  20. #include <linux/iommu.h>
  21. #include <linux/spinlock.h>
  22. #include <linux/mutex.h>
  23. #include <linux/platform_device.h>
  24. #include <linux/printk.h>
  25. #include <asm/byteorder.h>
  26. #include <linux/genwqe/genwqe_card.h>
  27. #define DRV_VERSION "2.0.25"
  28. /*
  29. * Static minor number assignement, until we decide/implement
  30. * something dynamic.
  31. */
  32. #define GENWQE_MAX_MINOR 128 /* up to 128 possible genwqe devices */
  33. /**
  34. * genwqe_requ_alloc() - Allocate a new DDCB execution request
  35. *
  36. * This data structure contains the user visiable fields of the DDCB
  37. * to be executed.
  38. *
  39. * Return: ptr to genwqe_ddcb_cmd data structure
  40. */
  41. struct genwqe_ddcb_cmd *ddcb_requ_alloc(void);
  42. /**
  43. * ddcb_requ_free() - Free DDCB execution request.
  44. * @req: ptr to genwqe_ddcb_cmd data structure.
  45. */
  46. void ddcb_requ_free(struct genwqe_ddcb_cmd *req);
  47. u32 genwqe_crc32(u8 *buff, size_t len, u32 init);
  48. static inline void genwqe_hexdump(struct pci_dev *pci_dev,
  49. const void *buff, unsigned int size)
  50. {
  51. char prefix[32];
  52. scnprintf(prefix, sizeof(prefix), "%s %s: ",
  53. GENWQE_DEVNAME, pci_name(pci_dev));
  54. print_hex_dump_debug(prefix, DUMP_PREFIX_OFFSET, 16, 1, buff,
  55. size, true);
  56. }
  57. #endif /* __GENWQE_DRIVER_H__ */