interface.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. *
  3. * Intel Management Engine Interface (Intel MEI) Linux driver
  4. * Copyright (c) 2003-2012, Intel Corporation.
  5. *
  6. * This program is free software; you can redistribute it and/or modify it
  7. * under the terms and conditions of the GNU General Public License,
  8. * version 2, as published by the Free Software Foundation.
  9. *
  10. * This program is distributed in the hope it will be useful, but WITHOUT
  11. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  13. * more details.
  14. *
  15. */
  16. #ifndef _MEI_INTERFACE_H_
  17. #define _MEI_INTERFACE_H_
  18. #include <linux/mei.h>
  19. #include "mei_dev.h"
  20. void mei_read_slots(struct mei_device *dev,
  21. unsigned char *buffer,
  22. unsigned long buffer_length);
  23. int mei_write_message(struct mei_device *dev,
  24. struct mei_msg_hdr *header,
  25. unsigned char *buf);
  26. bool mei_hbuf_is_empty(struct mei_device *dev);
  27. int mei_hbuf_empty_slots(struct mei_device *dev);
  28. static inline size_t mei_hbuf_max_data(const struct mei_device *dev)
  29. {
  30. return dev->hbuf_depth * sizeof(u32) - sizeof(struct mei_msg_hdr);
  31. }
  32. /* get slots (dwords) from a message length + header (bytes) */
  33. static inline unsigned char mei_data2slots(size_t length)
  34. {
  35. return DIV_ROUND_UP(sizeof(struct mei_msg_hdr) + length, 4);
  36. }
  37. int mei_count_full_read_slots(struct mei_device *dev);
  38. #endif /* _MEI_INTERFACE_H_ */