diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2011-06-16 11:08:12 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2011-06-29 03:48:28 -0400 |
commit | 725e789f228641fdfafcd65458f0ac78b87acc5a (patch) | |
tree | 579d90a2a22de79dd6bec4e36434a3bf30b9513e | |
parent | 8a0360a563cffc9a0712426820bedbb96bbc511b (diff) |
powerpc/hvsi: Move HVSI protocol definitions to a header file
This moves various HVSI protocol definitions from the hvsi.c
driver to a header file that can be used later on by a udbg
implementation
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r-- | arch/powerpc/include/asm/hvsi.h | 68 | ||||
-rw-r--r-- | drivers/tty/hvc/hvsi.c | 63 |
2 files changed, 69 insertions, 62 deletions
diff --git a/arch/powerpc/include/asm/hvsi.h b/arch/powerpc/include/asm/hvsi.h new file mode 100644 index 000000000000..f13125a0cb3a --- /dev/null +++ b/arch/powerpc/include/asm/hvsi.h | |||
@@ -0,0 +1,68 @@ | |||
1 | #ifndef _HVSI_H | ||
2 | #define _HVSI_H | ||
3 | |||
4 | #define VS_DATA_PACKET_HEADER 0xff | ||
5 | #define VS_CONTROL_PACKET_HEADER 0xfe | ||
6 | #define VS_QUERY_PACKET_HEADER 0xfd | ||
7 | #define VS_QUERY_RESPONSE_PACKET_HEADER 0xfc | ||
8 | |||
9 | /* control verbs */ | ||
10 | #define VSV_SET_MODEM_CTL 1 /* to service processor only */ | ||
11 | #define VSV_MODEM_CTL_UPDATE 2 /* from service processor only */ | ||
12 | #define VSV_CLOSE_PROTOCOL 3 | ||
13 | |||
14 | /* query verbs */ | ||
15 | #define VSV_SEND_VERSION_NUMBER 1 | ||
16 | #define VSV_SEND_MODEM_CTL_STATUS 2 | ||
17 | |||
18 | /* yes, these masks are not consecutive. */ | ||
19 | #define HVSI_TSDTR 0x01 | ||
20 | #define HVSI_TSCD 0x20 | ||
21 | |||
22 | #define HVSI_MAX_OUTGOING_DATA 12 | ||
23 | #define HVSI_VERSION 1 | ||
24 | |||
25 | struct hvsi_header { | ||
26 | uint8_t type; | ||
27 | uint8_t len; | ||
28 | uint16_t seqno; | ||
29 | } __attribute__((packed)); | ||
30 | |||
31 | struct hvsi_data { | ||
32 | uint8_t type; | ||
33 | uint8_t len; | ||
34 | uint16_t seqno; | ||
35 | uint8_t data[HVSI_MAX_OUTGOING_DATA]; | ||
36 | } __attribute__((packed)); | ||
37 | |||
38 | struct hvsi_control { | ||
39 | uint8_t type; | ||
40 | uint8_t len; | ||
41 | uint16_t seqno; | ||
42 | uint16_t verb; | ||
43 | /* optional depending on verb: */ | ||
44 | uint32_t word; | ||
45 | uint32_t mask; | ||
46 | } __attribute__((packed)); | ||
47 | |||
48 | struct hvsi_query { | ||
49 | uint8_t type; | ||
50 | uint8_t len; | ||
51 | uint16_t seqno; | ||
52 | uint16_t verb; | ||
53 | } __attribute__((packed)); | ||
54 | |||
55 | struct hvsi_query_response { | ||
56 | uint8_t type; | ||
57 | uint8_t len; | ||
58 | uint16_t seqno; | ||
59 | uint16_t verb; | ||
60 | uint16_t query_seqno; | ||
61 | union { | ||
62 | uint8_t version; | ||
63 | uint32_t mctrl_word; | ||
64 | } u; | ||
65 | } __attribute__((packed)); | ||
66 | |||
67 | |||
68 | #endif /* _HVSI_H */ | ||
diff --git a/drivers/tty/hvc/hvsi.c b/drivers/tty/hvc/hvsi.c index 8a8d6373f164..0b35793de1fa 100644 --- a/drivers/tty/hvc/hvsi.c +++ b/drivers/tty/hvc/hvsi.c | |||
@@ -49,6 +49,7 @@ | |||
49 | #include <asm/uaccess.h> | 49 | #include <asm/uaccess.h> |
50 | #include <asm/vio.h> | 50 | #include <asm/vio.h> |
51 | #include <asm/param.h> | 51 | #include <asm/param.h> |
52 | #include <asm/hvsi.h> | ||
52 | 53 | ||
53 | #define HVSI_MAJOR 229 | 54 | #define HVSI_MAJOR 229 |
54 | #define HVSI_MINOR 128 | 55 | #define HVSI_MINOR 128 |
@@ -109,68 +110,6 @@ enum HVSI_PROTOCOL_STATE { | |||
109 | }; | 110 | }; |
110 | #define HVSI_CONSOLE 0x1 | 111 | #define HVSI_CONSOLE 0x1 |
111 | 112 | ||
112 | #define VS_DATA_PACKET_HEADER 0xff | ||
113 | #define VS_CONTROL_PACKET_HEADER 0xfe | ||
114 | #define VS_QUERY_PACKET_HEADER 0xfd | ||
115 | #define VS_QUERY_RESPONSE_PACKET_HEADER 0xfc | ||
116 | |||
117 | /* control verbs */ | ||
118 | #define VSV_SET_MODEM_CTL 1 /* to service processor only */ | ||
119 | #define VSV_MODEM_CTL_UPDATE 2 /* from service processor only */ | ||
120 | #define VSV_CLOSE_PROTOCOL 3 | ||
121 | |||
122 | /* query verbs */ | ||
123 | #define VSV_SEND_VERSION_NUMBER 1 | ||
124 | #define VSV_SEND_MODEM_CTL_STATUS 2 | ||
125 | |||
126 | /* yes, these masks are not consecutive. */ | ||
127 | #define HVSI_TSDTR 0x01 | ||
128 | #define HVSI_TSCD 0x20 | ||
129 | |||
130 | struct hvsi_header { | ||
131 | uint8_t type; | ||
132 | uint8_t len; | ||
133 | uint16_t seqno; | ||
134 | } __attribute__((packed)); | ||
135 | |||
136 | struct hvsi_data { | ||
137 | uint8_t type; | ||
138 | uint8_t len; | ||
139 | uint16_t seqno; | ||
140 | uint8_t data[HVSI_MAX_OUTGOING_DATA]; | ||
141 | } __attribute__((packed)); | ||
142 | |||
143 | struct hvsi_control { | ||
144 | uint8_t type; | ||
145 | uint8_t len; | ||
146 | uint16_t seqno; | ||
147 | uint16_t verb; | ||
148 | /* optional depending on verb: */ | ||
149 | uint32_t word; | ||
150 | uint32_t mask; | ||
151 | } __attribute__((packed)); | ||
152 | |||
153 | struct hvsi_query { | ||
154 | uint8_t type; | ||
155 | uint8_t len; | ||
156 | uint16_t seqno; | ||
157 | uint16_t verb; | ||
158 | } __attribute__((packed)); | ||
159 | |||
160 | struct hvsi_query_response { | ||
161 | uint8_t type; | ||
162 | uint8_t len; | ||
163 | uint16_t seqno; | ||
164 | uint16_t verb; | ||
165 | uint16_t query_seqno; | ||
166 | union { | ||
167 | uint8_t version; | ||
168 | uint32_t mctrl_word; | ||
169 | } u; | ||
170 | } __attribute__((packed)); | ||
171 | |||
172 | |||
173 | |||
174 | static inline int is_console(struct hvsi_struct *hp) | 113 | static inline int is_console(struct hvsi_struct *hp) |
175 | { | 114 | { |
176 | return hp->flags & HVSI_CONSOLE; | 115 | return hp->flags & HVSI_CONSOLE; |