aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/hvc_console.c
diff options
context:
space:
mode:
authorStephen Rothwell <sfr@canb.auug.org.au>2006-07-13 04:53:32 -0400
committerStephen Rothwell <sfr@canb.auug.org.au>2006-07-13 04:53:32 -0400
commit4e9e95a3554e98e7383a3591283ffcd850c9ef48 (patch)
tree245703cc917a274b84f02cf68c43ba5efe370f59 /drivers/char/hvc_console.c
parent8bff05b052db7a4cfaaf0eee7f8145600548e9c9 (diff)
[POWERPC] Make the hvc_console output buffer size settable
So the iSeries console will be faster since it can send up to 200 bytes at a time to the Hypervisor. This only affects the tty part of the console, the console writes are still in 16 byte lots. Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Diffstat (limited to 'drivers/char/hvc_console.c')
-rw-r--r--drivers/char/hvc_console.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c
index ca2f538e549e..dbee8bed0530 100644
--- a/drivers/char/hvc_console.c
+++ b/drivers/char/hvc_console.c
@@ -80,7 +80,8 @@ struct hvc_struct {
80 struct tty_struct *tty; 80 struct tty_struct *tty;
81 unsigned int count; 81 unsigned int count;
82 int do_wakeup; 82 int do_wakeup;
83 char outbuf[N_OUTBUF] __ALIGNED__; 83 char *outbuf;
84 int outbuf_size;
84 int n_outbuf; 85 int n_outbuf;
85 uint32_t vtermno; 86 uint32_t vtermno;
86 struct hv_ops *ops; 87 struct hv_ops *ops;
@@ -505,7 +506,7 @@ static int hvc_write(struct tty_struct *tty, const unsigned char *buf, int count
505 if (hp->n_outbuf > 0) 506 if (hp->n_outbuf > 0)
506 hvc_push(hp); 507 hvc_push(hp);
507 508
508 while (count > 0 && (rsize = N_OUTBUF - hp->n_outbuf) > 0) { 509 while (count > 0 && (rsize = hp->outbuf_size - hp->n_outbuf) > 0) {
509 if (rsize > count) 510 if (rsize > count)
510 rsize = count; 511 rsize = count;
511 memcpy(hp->outbuf + hp->n_outbuf, buf, rsize); 512 memcpy(hp->outbuf + hp->n_outbuf, buf, rsize);
@@ -538,7 +539,7 @@ static int hvc_write_room(struct tty_struct *tty)
538 if (!hp) 539 if (!hp)
539 return -1; 540 return -1;
540 541
541 return N_OUTBUF - hp->n_outbuf; 542 return hp->outbuf_size - hp->n_outbuf;
542} 543}
543 544
544static int hvc_chars_in_buffer(struct tty_struct *tty) 545static int hvc_chars_in_buffer(struct tty_struct *tty)
@@ -728,12 +729,13 @@ static struct kobj_type hvc_kobj_type = {
728}; 729};
729 730
730struct hvc_struct __devinit *hvc_alloc(uint32_t vtermno, int irq, 731struct hvc_struct __devinit *hvc_alloc(uint32_t vtermno, int irq,
731 struct hv_ops *ops) 732 struct hv_ops *ops, int outbuf_size)
732{ 733{
733 struct hvc_struct *hp; 734 struct hvc_struct *hp;
734 int i; 735 int i;
735 736
736 hp = kmalloc(sizeof(*hp), GFP_KERNEL); 737 hp = kmalloc(ALIGN(sizeof(*hp), sizeof(long)) + outbuf_size,
738 GFP_KERNEL);
737 if (!hp) 739 if (!hp)
738 return ERR_PTR(-ENOMEM); 740 return ERR_PTR(-ENOMEM);
739 741
@@ -742,6 +744,8 @@ struct hvc_struct __devinit *hvc_alloc(uint32_t vtermno, int irq,
742 hp->vtermno = vtermno; 744 hp->vtermno = vtermno;
743 hp->irq = irq; 745 hp->irq = irq;
744 hp->ops = ops; 746 hp->ops = ops;
747 hp->outbuf_size = outbuf_size;
748 hp->outbuf = &((char *)hp)[ALIGN(sizeof(*hp), sizeof(long))];
745 749
746 kobject_init(&hp->kobj); 750 kobject_init(&hp->kobj);
747 hp->kobj.ktype = &hvc_kobj_type; 751 hp->kobj.ktype = &hvc_kobj_type;