refactor(dlog): move `dlog_flush_buffer` to `api.c`
Move `dlog_flush_vm_buffer` into `api.c` and rename it to
`api_flush_vm_buffer`. `dlog.c` doesn't need to have knowledge of how
VMs' buffer their output.
Change-Id: I21943df2e35288b46575fb28daf5df4b5edd73fe
Signed-off-by: Karl Meakin <karl.meakin@arm.com>
diff --git a/src/api.c b/src/api.c
index e320e6e..0affad1 100644
--- a/src/api.c
+++ b/src/api.c
@@ -4507,6 +4507,16 @@
}
/**
+ * Send the contents of the given VM's log buffer to the log, preceded
+ * by the VM ID and followed by a newline.
+ */
+void api_flush_vm_buffer(ffa_id_t id, char *buffer, size_t length)
+{
+ buffer[length] = '\0';
+ dlog("%s %x: %s\n", ffa_is_vm_id(id) ? "VM" : "SP", id, buffer);
+}
+
+/**
* Implements FF-A v1.2 FFA_CONSOLE_LOG ABI for buffered logging.
*/
struct ffa_value api_ffa_console_log(const struct ffa_value args,
@@ -4582,9 +4592,9 @@
}
if (flush) {
- dlog_flush_vm_buffer(vm_locked.vm->id,
- vm_locked.vm->log_buffer,
- vm_locked.vm->log_buffer_length);
+ api_flush_vm_buffer(vm_locked.vm->id,
+ vm_locked.vm->log_buffer,
+ vm_locked.vm->log_buffer_length);
vm_locked.vm->log_buffer_length = 0;
}
}