From 6f7bd78463e051dad239b349caf5dd641e2a4dd7 Mon Sep 17 00:00:00 2001 From: Oliver O'Halloran Date: Wed, 21 Dec 2016 15:52:29 +1100 Subject: console: add opal_con_ops structure Adds a separate structure to house the operations for the OPAL console. This is used to define a new API for dealing with the OPAL console in the next patch. Signed-off-by: Oliver O'Halloran Reviewed-by: Andrew Donnellan Signed-off-by: Stewart Smith --- include/console.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'include/console.h') diff --git a/include/console.h b/include/console.h index 08d2961e..e821ce70 100644 --- a/include/console.h +++ b/include/console.h @@ -54,6 +54,28 @@ struct con_ops { int64_t (*flush)(void); }; +struct opal_con_ops { + const char *name; + + /* + * OPAL console driver specific init function. + */ + void (*init)(void); + + int64_t (*write)(int64_t term, int64_t *len, const uint8_t *buf); + int64_t (*read)(int64_t term, int64_t *len, uint8_t *buf); + + /* + * returns the amount of space available in the console write buffer + */ + int64_t (*space)(int64_t term_number, int64_t *length); + + /* + * Forces the write buffer to be flushed by the driver + */ + int64_t (*flush)(int64_t term_number); +}; + extern bool dummy_console_enabled(void); extern void force_dummy_console(void); extern bool flush_console(void); @@ -73,4 +95,9 @@ extern void dummy_console_add_nodes(void); struct dt_node *add_opal_console_node(int index, const char *type, uint32_t write_buffer_size); +/* OPAL console drivers */ +extern struct opal_con_ops uart_opal_con; +extern struct opal_con_ops fsp_opal_con; +extern struct opal_con_ops dummy_opal_con; + #endif /* __CONSOLE_H */ -- cgit v1.2.1