aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/powerpc/include/asm/hvsi.h16
-rw-r--r--drivers/tty/hvc/hvsi_lib.c25
2 files changed, 20 insertions, 21 deletions
diff --git a/arch/powerpc/include/asm/hvsi.h b/arch/powerpc/include/asm/hvsi.h
index d3f64f361814..d4a5315718ca 100644
--- a/arch/powerpc/include/asm/hvsi.h
+++ b/arch/powerpc/include/asm/hvsi.h
@@ -25,7 +25,7 @@
25struct hvsi_header { 25struct hvsi_header {
26 uint8_t type; 26 uint8_t type;
27 uint8_t len; 27 uint8_t len;
28 uint16_t seqno; 28 __be16 seqno;
29} __attribute__((packed)); 29} __attribute__((packed));
30 30
31struct hvsi_data { 31struct hvsi_data {
@@ -35,24 +35,24 @@ struct hvsi_data {
35 35
36struct hvsi_control { 36struct hvsi_control {
37 struct hvsi_header hdr; 37 struct hvsi_header hdr;
38 uint16_t verb; 38 __be16 verb;
39 /* optional depending on verb: */ 39 /* optional depending on verb: */
40 uint32_t word; 40 __be32 word;
41 uint32_t mask; 41 __be32 mask;
42} __attribute__((packed)); 42} __attribute__((packed));
43 43
44struct hvsi_query { 44struct hvsi_query {
45 struct hvsi_header hdr; 45 struct hvsi_header hdr;
46 uint16_t verb; 46 __be16 verb;
47} __attribute__((packed)); 47} __attribute__((packed));
48 48
49struct hvsi_query_response { 49struct hvsi_query_response {
50 struct hvsi_header hdr; 50 struct hvsi_header hdr;
51 uint16_t verb; 51 __be16 verb;
52 uint16_t query_seqno; 52 __be16 query_seqno;
53 union { 53 union {
54 uint8_t version; 54 uint8_t version;
55 uint32_t mctrl_word; 55 __be32 mctrl_word;
56 } u; 56 } u;
57} __attribute__((packed)); 57} __attribute__((packed));
58 58
diff --git a/drivers/tty/hvc/hvsi_lib.c b/drivers/tty/hvc/hvsi_lib.c
index ac2767100df5..347050ea414a 100644
--- a/drivers/tty/hvc/hvsi_lib.c
+++ b/drivers/tty/hvc/hvsi_lib.c
@@ -9,7 +9,7 @@
9 9
10static int hvsi_send_packet(struct hvsi_priv *pv, struct hvsi_header *packet) 10static int hvsi_send_packet(struct hvsi_priv *pv, struct hvsi_header *packet)
11{ 11{
12 packet->seqno = atomic_inc_return(&pv->seqno); 12 packet->seqno = cpu_to_be16(atomic_inc_return(&pv->seqno));
13 13
14 /* Assumes that always succeeds, works in practice */ 14 /* Assumes that always succeeds, works in practice */
15 return pv->put_chars(pv->termno, (char *)packet, packet->len); 15 return pv->put_chars(pv->termno, (char *)packet, packet->len);
@@ -28,7 +28,7 @@ static void hvsi_start_handshake(struct hvsi_priv *pv)
28 /* Send version query */ 28 /* Send version query */
29 q.hdr.type = VS_QUERY_PACKET_HEADER; 29 q.hdr.type = VS_QUERY_PACKET_HEADER;
30 q.hdr.len = sizeof(struct hvsi_query); 30 q.hdr.len = sizeof(struct hvsi_query);
31 q.verb = VSV_SEND_VERSION_NUMBER; 31 q.verb = cpu_to_be16(VSV_SEND_VERSION_NUMBER);
32 hvsi_send_packet(pv, &q.hdr); 32 hvsi_send_packet(pv, &q.hdr);
33} 33}
34 34
@@ -40,7 +40,7 @@ static int hvsi_send_close(struct hvsi_priv *pv)
40 40
41 ctrl.hdr.type = VS_CONTROL_PACKET_HEADER; 41 ctrl.hdr.type = VS_CONTROL_PACKET_HEADER;
42 ctrl.hdr.len = sizeof(struct hvsi_control); 42 ctrl.hdr.len = sizeof(struct hvsi_control);
43 ctrl.verb = VSV_CLOSE_PROTOCOL; 43 ctrl.verb = cpu_to_be16(VSV_CLOSE_PROTOCOL);
44 return hvsi_send_packet(pv, &ctrl.hdr); 44 return hvsi_send_packet(pv, &ctrl.hdr);
45} 45}
46 46
@@ -69,14 +69,14 @@ static void hvsi_got_control(struct hvsi_priv *pv)
69{ 69{
70 struct hvsi_control *pkt = (struct hvsi_control *)pv->inbuf; 70 struct hvsi_control *pkt = (struct hvsi_control *)pv->inbuf;
71 71
72 switch (pkt->verb) { 72 switch (be16_to_cpu(pkt->verb)) {
73 case VSV_CLOSE_PROTOCOL: 73 case VSV_CLOSE_PROTOCOL:
74 /* We restart the handshaking */ 74 /* We restart the handshaking */
75 hvsi_start_handshake(pv); 75 hvsi_start_handshake(pv);
76 break; 76 break;
77 case VSV_MODEM_CTL_UPDATE: 77 case VSV_MODEM_CTL_UPDATE:
78 /* Transition of carrier detect */ 78 /* Transition of carrier detect */
79 hvsi_cd_change(pv, pkt->word & HVSI_TSCD); 79 hvsi_cd_change(pv, be32_to_cpu(pkt->word) & HVSI_TSCD);
80 break; 80 break;
81 } 81 }
82} 82}
@@ -87,7 +87,7 @@ static void hvsi_got_query(struct hvsi_priv *pv)
87 struct hvsi_query_response r; 87 struct hvsi_query_response r;
88 88
89 /* We only handle version queries */ 89 /* We only handle version queries */
90 if (pkt->verb != VSV_SEND_VERSION_NUMBER) 90 if (be16_to_cpu(pkt->verb) != VSV_SEND_VERSION_NUMBER)
91 return; 91 return;
92 92
93 pr_devel("HVSI@%x: Got version query, sending response...\n", 93 pr_devel("HVSI@%x: Got version query, sending response...\n",
@@ -96,7 +96,7 @@ static void hvsi_got_query(struct hvsi_priv *pv)
96 /* Send version response */ 96 /* Send version response */
97 r.hdr.type = VS_QUERY_RESPONSE_PACKET_HEADER; 97 r.hdr.type = VS_QUERY_RESPONSE_PACKET_HEADER;
98 r.hdr.len = sizeof(struct hvsi_query_response); 98 r.hdr.len = sizeof(struct hvsi_query_response);
99 r.verb = VSV_SEND_VERSION_NUMBER; 99 r.verb = cpu_to_be16(VSV_SEND_VERSION_NUMBER);
100 r.u.version = HVSI_VERSION; 100 r.u.version = HVSI_VERSION;
101 r.query_seqno = pkt->hdr.seqno; 101 r.query_seqno = pkt->hdr.seqno;
102 hvsi_send_packet(pv, &r.hdr); 102 hvsi_send_packet(pv, &r.hdr);
@@ -112,7 +112,7 @@ static void hvsi_got_response(struct hvsi_priv *pv)
112 112
113 switch(r->verb) { 113 switch(r->verb) {
114 case VSV_SEND_MODEM_CTL_STATUS: 114 case VSV_SEND_MODEM_CTL_STATUS:
115 hvsi_cd_change(pv, r->u.mctrl_word & HVSI_TSCD); 115 hvsi_cd_change(pv, be32_to_cpu(r->u.mctrl_word) & HVSI_TSCD);
116 pv->mctrl_update = 1; 116 pv->mctrl_update = 1;
117 break; 117 break;
118 } 118 }
@@ -265,8 +265,7 @@ int hvsilib_read_mctrl(struct hvsi_priv *pv)
265 pv->mctrl_update = 0; 265 pv->mctrl_update = 0;
266 q.hdr.type = VS_QUERY_PACKET_HEADER; 266 q.hdr.type = VS_QUERY_PACKET_HEADER;
267 q.hdr.len = sizeof(struct hvsi_query); 267 q.hdr.len = sizeof(struct hvsi_query);
268 q.hdr.seqno = atomic_inc_return(&pv->seqno); 268 q.verb = cpu_to_be16(VSV_SEND_MODEM_CTL_STATUS);
269 q.verb = VSV_SEND_MODEM_CTL_STATUS;
270 rc = hvsi_send_packet(pv, &q.hdr); 269 rc = hvsi_send_packet(pv, &q.hdr);
271 if (rc <= 0) { 270 if (rc <= 0) {
272 pr_devel("HVSI@%x: Error %d...\n", pv->termno, rc); 271 pr_devel("HVSI@%x: Error %d...\n", pv->termno, rc);
@@ -304,9 +303,9 @@ int hvsilib_write_mctrl(struct hvsi_priv *pv, int dtr)
304 303
305 ctrl.hdr.type = VS_CONTROL_PACKET_HEADER, 304 ctrl.hdr.type = VS_CONTROL_PACKET_HEADER,
306 ctrl.hdr.len = sizeof(struct hvsi_control); 305 ctrl.hdr.len = sizeof(struct hvsi_control);
307 ctrl.verb = VSV_SET_MODEM_CTL; 306 ctrl.verb = cpu_to_be16(VSV_SET_MODEM_CTL);
308 ctrl.mask = HVSI_TSDTR; 307 ctrl.mask = cpu_to_be32(HVSI_TSDTR);
309 ctrl.word = dtr ? HVSI_TSDTR : 0; 308 ctrl.word = cpu_to_be32(dtr ? HVSI_TSDTR : 0);
310 return hvsi_send_packet(pv, &ctrl.hdr); 309 return hvsi_send_packet(pv, &ctrl.hdr);
311} 310}
312 311