#include <palacios/vmm_host_events.h>
#include <palacios/vm_guest.h>
+#include <devices/serial.h>
+
#ifndef CONFIG_DEBUG_SERIAL
#undef PrintDebug
struct serial_buffer tx_buffer;
struct serial_buffer rx_buffer;
uint_t irq_number;
+
+ struct v3_stream_ops *stream_ops;
+ void *backend_data;
+
};
struct serial_port com2;
struct serial_port com3;
struct serial_port com4;
+
+
};
com_port->dll.data = *val;
} else {
queue_data(&(com_port->tx_buffer), *val, com_port, dev);
+ if (com_port->stream_ops) {
+ uint8_t c;
+ dequeue_data(&(com_port->tx_buffer), &c, com_port, dev);
+ com_port->stream_ops->stream_write(&c,1,com_port->backend_data);
+ }
}
return 0;
}
+int v3_stream_register_serial(struct vm_device * serial_dev, struct v3_stream_ops * ops, void * private_data)
+{
+ struct serial_state *state = (struct serial_state *)(serial_dev->private_data);
+
+ state->com1.stream_ops = ops;
+ state->com1.backend_data = private_data;
+ /* bind to other ports here */
+}
+
device_register("SERIAL", serial_init)