aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeoff Levand <geoff@infradead.org>2023-01-15 09:36:22 -0800
committerGeoff Levand <geoff@infradead.org>2023-06-26 08:14:27 -0500
commitf07312152fa8cab911b48fb02c4f7c78808fed98 (patch)
treee37b812f767e4b4c53668e07f98dd1393d5d6415
parent2d1d1b1380ceb1a42ea93768734f369fbfdfcf8f (diff)
downloadps3-linux-f07312152fa8cab911b48fb02c4f7c78808fed98.tar.gz
hvc_console: Allow backends to set I/O buffer size
To allow HVC backends to set the I/O buffer sizes to values that are most efficient for the backend, change the macro definitions where the buffer sizes are set to be conditional on whether or not the macros are already defined. Also, rename the macros from N_OUTBUF to HVC_N_OUBUF and from N_INBUF to HVC_N_INBUF. Typical usage in the backend source file would be: #define HVC_N_OUTBUF 32 #define HVC_N_INBUF 32 #include "hvc_console.h" Signed-off-by: Geoff Levand <geoff@infradead.org>
-rw-r--r--drivers/tty/hvc/hvc_console.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/drivers/tty/hvc/hvc_console.c b/drivers/tty/hvc/hvc_console.c
index 10c10cfdf92a1f..041690d26e5120 100644
--- a/drivers/tty/hvc/hvc_console.c
+++ b/drivers/tty/hvc/hvc_console.c
@@ -42,12 +42,15 @@
#define HVC_CLOSE_WAIT (HZ/100) /* 1/10 of a second */
/*
- * These sizes are most efficient for vio, because they are the
- * native transfer size. We could make them selectable in the
- * future to better deal with backends that want other buffer sizes.
+ * These default sizes are most efficient for vio, because they are
+ * the native transfer size.
*/
-#define N_OUTBUF 16
-#define N_INBUF 16
+#if !defined(HVC_N_OUTBUF)
+# define HVC_N_OUTBUF 16
+#endif
+#if !defined(HVC_N_INBUF)
+# define HVC_N_INBUF 16
+#endif
#define __ALIGNED__ __attribute__((__aligned__(L1_CACHE_BYTES)))
@@ -151,7 +154,7 @@ static uint32_t vtermnos[MAX_NR_HVC_CONSOLES] =
static void hvc_console_print(struct console *co, const char *b,
unsigned count)
{
- char c[N_OUTBUF] __ALIGNED__;
+ char c[HVC_N_OUTBUF] __ALIGNED__;
unsigned i = 0, n = 0;
int r, donecr = 0, index = co->index;
@@ -633,7 +636,7 @@ static int __hvc_poll(struct hvc_struct *hp, bool may_sleep)
{
struct tty_struct *tty;
int i, n, count, poll_mask = 0;
- char buf[N_INBUF] __ALIGNED__;
+ char buf[HVC_N_INBUF] __ALIGNED__;
unsigned long flags;
int read_total = 0;
int written_total = 0;
@@ -674,7 +677,7 @@ static int __hvc_poll(struct hvc_struct *hp, bool may_sleep)
read_again:
/* Read data if any */
- count = tty_buffer_request_room(&hp->port, N_INBUF);
+ count = tty_buffer_request_room(&hp->port, HVC_N_INBUF);
/* If flip is full, just reschedule a later read */
if (count == 0) {