hgsmi_defs.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /* SPDX-License-Identifier: MIT */
  2. /* Copyright (C) 2006-2017 Oracle Corporation */
  3. #ifndef __HGSMI_DEFS_H__
  4. #define __HGSMI_DEFS_H__
  5. /* Buffer sequence type mask. */
  6. #define HGSMI_BUFFER_HEADER_F_SEQ_MASK 0x03
  7. /* Single buffer, not a part of a sequence. */
  8. #define HGSMI_BUFFER_HEADER_F_SEQ_SINGLE 0x00
  9. /* The first buffer in a sequence. */
  10. #define HGSMI_BUFFER_HEADER_F_SEQ_START 0x01
  11. /* A middle buffer in a sequence. */
  12. #define HGSMI_BUFFER_HEADER_F_SEQ_CONTINUE 0x02
  13. /* The last buffer in a sequence. */
  14. #define HGSMI_BUFFER_HEADER_F_SEQ_END 0x03
  15. /* 16 bytes buffer header. */
  16. struct hgsmi_buffer_header {
  17. u32 data_size; /* Size of data that follows the header. */
  18. u8 flags; /* HGSMI_BUFFER_HEADER_F_* */
  19. u8 channel; /* The channel the data must be routed to. */
  20. u16 channel_info; /* Opaque to the HGSMI, used by the channel. */
  21. union {
  22. /* Opaque placeholder to make the union 8 bytes. */
  23. u8 header_data[8];
  24. /* HGSMI_BUFFER_HEADER_F_SEQ_SINGLE */
  25. struct {
  26. u32 reserved1; /* A reserved field, initialize to 0. */
  27. u32 reserved2; /* A reserved field, initialize to 0. */
  28. } buffer;
  29. /* HGSMI_BUFFER_HEADER_F_SEQ_START */
  30. struct {
  31. /* Must be the same for all buffers in the sequence. */
  32. u32 sequence_number;
  33. /* The total size of the sequence. */
  34. u32 sequence_size;
  35. } sequence_start;
  36. /*
  37. * HGSMI_BUFFER_HEADER_F_SEQ_CONTINUE and
  38. * HGSMI_BUFFER_HEADER_F_SEQ_END
  39. */
  40. struct {
  41. /* Must be the same for all buffers in the sequence. */
  42. u32 sequence_number;
  43. /* Data offset in the entire sequence. */
  44. u32 sequence_offset;
  45. } sequence_continue;
  46. } u;
  47. } __packed;
  48. /* 8 bytes buffer tail. */
  49. struct hgsmi_buffer_tail {
  50. /* Reserved, must be initialized to 0. */
  51. u32 reserved;
  52. /*
  53. * One-at-a-Time Hash: https://www.burtleburtle.net/bob/hash/doobs.html
  54. * Over the header, offset and for first 4 bytes of the tail.
  55. */
  56. u32 checksum;
  57. } __packed;
  58. /*
  59. * The size of the array of channels. Array indexes are u8.
  60. * Note: the value must not be changed.
  61. */
  62. #define HGSMI_NUMBER_OF_CHANNELS 0x100
  63. #endif