Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F109459773
D29063.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D29063.diff
View Options
diff --git a/sys/powerpc/powernv/opal.h b/sys/powerpc/powernv/opal.h
--- a/sys/powerpc/powernv/opal.h
+++ b/sys/powerpc/powernv/opal.h
@@ -56,6 +56,7 @@
#define OPAL_PCI_CONFIG_WRITE_HALF_WORD 17
#define OPAL_PCI_CONFIG_WRITE_WORD 18
#define OPAL_PCI_EEH_FREEZE_STATUS 23
+#define OPAL_CONSOLE_WRITE_BUFFER_SPACE 25
#define OPAL_PCI_EEH_FREEZE_CLEAR 26
#define OPAL_PCI_PHB_MMIO_ENABLE 27
#define OPAL_PCI_SET_PHB_MEM_WINDOW 28
diff --git a/sys/powerpc/powernv/opal_console.c b/sys/powerpc/powernv/opal_console.c
--- a/sys/powerpc/powernv/opal_console.c
+++ b/sys/powerpc/powernv/opal_console.c
@@ -171,6 +171,24 @@
mtx_unlock_spin(&opalcons_buffer.mtx);
}
+static int64_t
+uart_opal_console_write_buffer_space(int vtermid)
+{
+ int64_t buffer_space_val = 0;
+ vm_paddr_t buffer_space_ptr;
+
+ if (pmap_bootstrapped)
+ buffer_space_ptr = vtophys(&buffer_space_val);
+ else
+ buffer_space_ptr = (vm_paddr_t)&buffer_space_val;
+
+ if (opal_call(OPAL_CONSOLE_WRITE_BUFFER_SPACE, vtermid,
+ buffer_space_ptr) != OPAL_SUCCESS)
+ return (-1);
+
+ return (be64toh(buffer_space_val));
+}
+
static int
uart_opal_probe_node(struct uart_opal_softc *sc)
{
@@ -420,12 +438,12 @@
len -= 4;
}
-#if 0
- if (err != OPAL_SUCCESS)
- len = 0;
-#endif
+ if (err == OPAL_SUCCESS)
+ return (len);
+ else if (err == OPAL_BUSY_EVENT)
+ return(0);
- return (len);
+ return (-1);
}
static int
@@ -481,11 +499,28 @@
struct uart_opal_softc *sc;
char buffer[8];
int len;
+ int64_t buffer_space;
sc = tty_softc(tp);
- while ((len = ttydisc_getc(tp, buffer, sizeof(buffer))) != 0)
- uart_opal_put(sc, buffer, len);
+ while ((len = ttydisc_getc(tp, buffer, sizeof(buffer))) != 0) {
+ int bytes_written = 0;
+ while (bytes_written == 0) {
+ buffer_space = uart_opal_console_write_buffer_space(sc->vtermid);
+ if (buffer_space == -1)
+ /* OPAL failure or invalid terminal */
+ break;
+ else if (buffer_space >= len)
+ bytes_written = uart_opal_put(sc, buffer, len);
+
+ if (bytes_written == 0)
+ /* OPAL must be busy, poll and retry */
+ opal_call(OPAL_POLL_EVENTS, NULL);
+ else if (bytes_written == -1)
+ /* OPAL failure or invalid terminal */
+ break;
+ }
+ }
}
static void
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Feb 6, 8:55 AM (21 h, 5 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16490178
Default Alt Text
D29063.diff (2 KB)
Attached To
Mode
D29063: [POWERPC] opal_console: fix serial console output corruption
Attached
Detach File
Event Timeline
Log In to Comment