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