@@ -69,7 +69,7 @@ struct vpl011_init_info {
int domain_vpl011_init(struct domain *d,
struct vpl011_init_info *info);
void domain_vpl011_deinit(struct domain *d);
-void vpl011_rx_char_xen(struct domain *d, char c);
+int vpl011_rx_char_xen(struct domain *d, char c);
#else
static inline int domain_vpl011_init(struct domain *d,
struct vpl011_init_info *info)
@@ -569,14 +569,21 @@ static void vpl011_data_avail(struct domain *d,
* vpl011_rx_char_xen adds a char to a domain's vpl011 receive buffer.
* It is only used when the vpl011 backend is in Xen.
*/
-void vpl011_rx_char_xen(struct domain *d, char c)
+int vpl011_rx_char_xen(struct domain *d, char c)
{
unsigned long flags;
struct vpl011 *vpl011 = &d->arch.vpl011;
struct vpl011_xen_backend *intf = vpl011->backend.xen;
XENCONS_RING_IDX in_cons, in_prod, in_fifo_level;
- ASSERT(!vpl011->backend_in_domain);
+ /*
+ * If we have a properly initialized vpl011 console for the
+ * domain, without a full PV ring to Dom0 (in that case input
+ * comes from the PV ring), then send the character to it.
+ */
+ if ( vpl011->backend_in_domain || intf == NULL )
+ return -ENODEV;
+
VPL011_LOCK(d, flags);
in_cons = intf->in_cons;
@@ -584,7 +591,7 @@ void vpl011_rx_char_xen(struct domain *d, char c)
if ( xencons_queued(in_prod, in_cons, sizeof(intf->in)) == sizeof(intf->in) )
{
VPL011_UNLOCK(d, flags);
- return;
+ return -ENOSPC;
}
intf->in[xencons_mask(in_prod, sizeof(intf->in))] = c;
@@ -596,6 +603,8 @@ void vpl011_rx_char_xen(struct domain *d, char c)
vpl011_data_avail(d, in_fifo_level, sizeof(intf->in), 0, SBSA_UART_FIFO_SIZE);
VPL011_UNLOCK(d, flags);
+
+ return 0;
}
static void vpl011_notification(struct vcpu *v, unsigned int port)
@@ -559,9 +559,7 @@ static void __serial_rx(char c)
* domain, without a full PV ring to Dom0 (in that case input
* comes from the PV ring), then send the character to it.
*/
- if ( d != NULL &&
- !d->arch.vpl011.backend_in_domain &&
- d->arch.vpl011.backend.xen != NULL )
+ if ( d != NULL )
vpl011_rx_char_xen(d, c);
else
printk("Cannot send chars to Dom%d: no UART available\n",