Add HVC/SMC call for debug logging.

Bug: 115484857
Change-Id: I253adf03ebde97d4b620be9d3f2cc05f5265f45d
diff --git a/inc/hf/api.h b/inc/hf/api.h
index af21d00..a808e5d 100644
--- a/inc/hf/api.h
+++ b/inc/hf/api.h
@@ -39,6 +39,7 @@
 int64_t api_mailbox_waiter_get(spci_vm_id_t vm_id, const struct vcpu *current);
 int64_t api_share_memory(spci_vm_id_t vm_id, ipaddr_t addr, size_t size,
 			 enum hf_share share, struct vcpu *current);
+int64_t api_debug_log(char c, struct vcpu *current);
 
 struct vcpu *api_preempt(struct vcpu *current);
 struct vcpu *api_wait_for_interrupt(struct vcpu *current);
diff --git a/inc/hf/dlog.h b/inc/hf/dlog.h
index 3e83624..01dddd9 100644
--- a/inc/hf/dlog.h
+++ b/inc/hf/dlog.h
@@ -18,6 +18,8 @@
 
 #include <stdarg.h>
 
+#include "vm.h"
+
 #if DEBUG
 void dlog_enable_lock(void);
 void dlog(const char *fmt, ...);
@@ -27,3 +29,5 @@
 #define dlog(...)
 #define vdlog(fmt, args)
 #endif
+
+void dlog_flush_vm_buffer(struct vm_locked vm);
diff --git a/inc/hf/vm.h b/inc/hf/vm.h
index 8930c11..4abff00 100644
--- a/inc/hf/vm.h
+++ b/inc/hf/vm.h
@@ -27,6 +27,8 @@
 
 #include "vmapi/hf/spci.h"
 
+#define LOG_BUFFER_SIZE 256
+
 enum mailbox_state {
 	/** There is no message in the mailbox. */
 	MAILBOX_STATE_EMPTY,
@@ -83,6 +85,8 @@
 	struct vcpu vcpus[MAX_CPUS];
 	struct mm_ptable ptable;
 	struct mailbox mailbox;
+	char log_buffer[LOG_BUFFER_SIZE];
+	size_t log_buffer_length;
 
 	/** Wait entries to be used when waiting on other VM mailboxes. */
 	struct wait_entry wait_entries[MAX_VMS];