Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 259130
b: refs/heads/master
c: 048bee7
h: refs/heads/master
v: v3
  • Loading branch information
Benjamin Herrenschmidt committed Jun 29, 2011
1 parent 7215bc7 commit f5a5d03
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 46 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 725e789f228641fdfafcd65458f0ac78b87acc5a
refs/heads/master: 048bee7718bb3532aa96d0ce8572cced2ea951e6
16 changes: 4 additions & 12 deletions trunk/arch/powerpc/include/asm/hvsi.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,33 +29,25 @@ struct hvsi_header {
} __attribute__((packed));

struct hvsi_data {
uint8_t type;
uint8_t len;
uint16_t seqno;
struct hvsi_header hdr;
uint8_t data[HVSI_MAX_OUTGOING_DATA];
} __attribute__((packed));

struct hvsi_control {
uint8_t type;
uint8_t len;
uint16_t seqno;
struct hvsi_header hdr;
uint16_t verb;
/* optional depending on verb: */
uint32_t word;
uint32_t mask;
} __attribute__((packed));

struct hvsi_query {
uint8_t type;
uint8_t len;
uint16_t seqno;
struct hvsi_header hdr;
uint16_t verb;
} __attribute__((packed));

struct hvsi_query_response {
uint8_t type;
uint8_t len;
uint16_t seqno;
struct hvsi_header hdr;
uint16_t verb;
uint16_t query_seqno;
union {
Expand Down
66 changes: 33 additions & 33 deletions trunk/drivers/tty/hvc/hvsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,18 +295,18 @@ static int hvsi_version_respond(struct hvsi_struct *hp, uint16_t query_seqno)
struct hvsi_query_response packet __ALIGNED__;
int wrote;

packet.type = VS_QUERY_RESPONSE_PACKET_HEADER;
packet.len = sizeof(struct hvsi_query_response);
packet.seqno = atomic_inc_return(&hp->seqno);
packet.hdr.type = VS_QUERY_RESPONSE_PACKET_HEADER;
packet.hdr.len = sizeof(struct hvsi_query_response);
packet.hdr.seqno = atomic_inc_return(&hp->seqno);
packet.verb = VSV_SEND_VERSION_NUMBER;
packet.u.version = HVSI_VERSION;
packet.query_seqno = query_seqno+1;

pr_debug("%s: sending %i bytes\n", __func__, packet.len);
dbg_dump_hex((uint8_t*)&packet, packet.len);
pr_debug("%s: sending %i bytes\n", __func__, packet.hdr.len);
dbg_dump_hex((uint8_t*)&packet, packet.hdr.len);

wrote = hvc_put_chars(hp->vtermno, (char *)&packet, packet.len);
if (wrote != packet.len) {
wrote = hvc_put_chars(hp->vtermno, (char *)&packet, packet.hdr.len);
if (wrote != packet.hdr.len) {
printk(KERN_ERR "hvsi%i: couldn't send query response!\n",
hp->index);
return -EIO;
Expand All @@ -321,7 +321,7 @@ static void hvsi_recv_query(struct hvsi_struct *hp, uint8_t *packet)

switch (hp->state) {
case HVSI_WAIT_FOR_VER_QUERY:
hvsi_version_respond(hp, query->seqno);
hvsi_version_respond(hp, query->hdr.seqno);
__set_state(hp, HVSI_OPEN);
break;
default:
Expand Down Expand Up @@ -579,16 +579,16 @@ static int hvsi_query(struct hvsi_struct *hp, uint16_t verb)
struct hvsi_query packet __ALIGNED__;
int wrote;

packet.type = VS_QUERY_PACKET_HEADER;
packet.len = sizeof(struct hvsi_query);
packet.seqno = atomic_inc_return(&hp->seqno);
packet.hdr.type = VS_QUERY_PACKET_HEADER;
packet.hdr.len = sizeof(struct hvsi_query);
packet.hdr.seqno = atomic_inc_return(&hp->seqno);
packet.verb = verb;

pr_debug("%s: sending %i bytes\n", __func__, packet.len);
dbg_dump_hex((uint8_t*)&packet, packet.len);
pr_debug("%s: sending %i bytes\n", __func__, packet.hdr.len);
dbg_dump_hex((uint8_t*)&packet, packet.hdr.len);

wrote = hvc_put_chars(hp->vtermno, (char *)&packet, packet.len);
if (wrote != packet.len) {
wrote = hvc_put_chars(hp->vtermno, (char *)&packet, packet.hdr.len);
if (wrote != packet.hdr.len) {
printk(KERN_ERR "hvsi%i: couldn't send query (%i)!\n", hp->index,
wrote);
return -EIO;
Expand Down Expand Up @@ -622,20 +622,20 @@ static int hvsi_set_mctrl(struct hvsi_struct *hp, uint16_t mctrl)
struct hvsi_control packet __ALIGNED__;
int wrote;

packet.type = VS_CONTROL_PACKET_HEADER,
packet.seqno = atomic_inc_return(&hp->seqno);
packet.len = sizeof(struct hvsi_control);
packet.hdr.type = VS_CONTROL_PACKET_HEADER,
packet.hdr.seqno = atomic_inc_return(&hp->seqno);
packet.hdr.len = sizeof(struct hvsi_control);
packet.verb = VSV_SET_MODEM_CTL;
packet.mask = HVSI_TSDTR;

if (mctrl & TIOCM_DTR)
packet.word = HVSI_TSDTR;

pr_debug("%s: sending %i bytes\n", __func__, packet.len);
dbg_dump_hex((uint8_t*)&packet, packet.len);
pr_debug("%s: sending %i bytes\n", __func__, packet.hdr.len);
dbg_dump_hex((uint8_t*)&packet, packet.hdr.len);

wrote = hvc_put_chars(hp->vtermno, (char *)&packet, packet.len);
if (wrote != packet.len) {
wrote = hvc_put_chars(hp->vtermno, (char *)&packet, packet.hdr.len);
if (wrote != packet.hdr.len) {
printk(KERN_ERR "hvsi%i: couldn't set DTR!\n", hp->index);
return -EIO;
}
Expand Down Expand Up @@ -705,13 +705,13 @@ static int hvsi_put_chars(struct hvsi_struct *hp, const char *buf, int count)

BUG_ON(count > HVSI_MAX_OUTGOING_DATA);

packet.type = VS_DATA_PACKET_HEADER;
packet.seqno = atomic_inc_return(&hp->seqno);
packet.len = count + sizeof(struct hvsi_header);
packet.hdr.type = VS_DATA_PACKET_HEADER;
packet.hdr.seqno = atomic_inc_return(&hp->seqno);
packet.hdr.len = count + sizeof(struct hvsi_header);
memcpy(&packet.data, buf, count);

ret = hvc_put_chars(hp->vtermno, (char *)&packet, packet.len);
if (ret == packet.len) {
ret = hvc_put_chars(hp->vtermno, (char *)&packet, packet.hdr.len);
if (ret == packet.hdr.len) {
/* return the number of chars written, not the packet length */
return count;
}
Expand All @@ -722,15 +722,15 @@ static void hvsi_close_protocol(struct hvsi_struct *hp)
{
struct hvsi_control packet __ALIGNED__;

packet.type = VS_CONTROL_PACKET_HEADER;
packet.seqno = atomic_inc_return(&hp->seqno);
packet.len = 6;
packet.hdr.type = VS_CONTROL_PACKET_HEADER;
packet.hdr.seqno = atomic_inc_return(&hp->seqno);
packet.hdr.len = 6;
packet.verb = VSV_CLOSE_PROTOCOL;

pr_debug("%s: sending %i bytes\n", __func__, packet.len);
dbg_dump_hex((uint8_t*)&packet, packet.len);
pr_debug("%s: sending %i bytes\n", __func__, packet.hdr.len);
dbg_dump_hex((uint8_t*)&packet, packet.hdr.len);

hvc_put_chars(hp->vtermno, (char *)&packet, packet.len);
hvc_put_chars(hp->vtermno, (char *)&packet, packet.hdr.len);
}

static int hvsi_open(struct tty_struct *tty, struct file *filp)
Expand Down

0 comments on commit f5a5d03

Please sign in to comment.