diff mbox series

[13/20] fwts_clog: add fwts_clog_read

Message ID 20180620121446.31470-14-info@marcellobauer.com
State Accepted
Headers show
Series coreboot test intergration | expand

Commit Message

Marcello Sylvester Bauer June 20, 2018, 12:14 p.m. UTC
Signed-off-by: Marcello Sylvester Bauer <info@marcellobauer.com>
---
 src/lib/include/fwts_clog.h |  1 +
 src/lib/src/fwts_clog.c     | 21 +++++++++++++++++++++
 2 files changed, 22 insertions(+)

Comments

Colin Ian King June 21, 2018, 3:54 p.m. UTC | #1
On 20/06/18 13:14, Marcello Sylvester Bauer wrote:
> Signed-off-by: Marcello Sylvester Bauer <info@marcellobauer.com>
> ---
>  src/lib/include/fwts_clog.h |  1 +
>  src/lib/src/fwts_clog.c     | 21 +++++++++++++++++++++
>  2 files changed, 22 insertions(+)
> 
> diff --git a/src/lib/include/fwts_clog.h b/src/lib/include/fwts_clog.h
> index 87ecc438..f29aaa3f 100644
> --- a/src/lib/include/fwts_clog.h
> +++ b/src/lib/include/fwts_clog.h
> @@ -24,5 +24,6 @@
>  #include "fwts.h"
>  
>  void       fwts_clog_free(fwts_list *list);
> +fwts_list *fwts_clog_read(void);
>  
>  #endif
> diff --git a/src/lib/src/fwts_clog.c b/src/lib/src/fwts_clog.c
> index 3887e6fc..fe04e090 100644
> --- a/src/lib/src/fwts_clog.c
> +++ b/src/lib/src/fwts_clog.c
> @@ -20,6 +20,12 @@
>  
>  #include "fwts.h"
>  
> +/*
> + *  coreboot logfile exposed by Google firmware module
> + *  Kernel option nessesary (GOOGLE_MEMCONSOLE_COREBOOT=m/y)
> + */
> +#define GOOGLE_MEMCONSOLE_COREBOOT_PATH	"/sys/firmware/log"
> +
>  /*
>   *  free coreboot log list
>   */
> @@ -27,3 +33,18 @@ void fwts_clog_free(fwts_list *clog)
>  {
>          fwts_log_free(clog);
>  }
> +
> +/*
> + *  read coreboot log and return as list of lines
> + *  TODO:	1) parse coreboot logfile as argument
> + *  		2) find coreboot log in /dev/mem
> + */
> +fwts_list *fwts_clog_read(void)
> +{
> +    fwts_list *list;
> +
> +    if ((list = fwts_file_open_and_read(GOOGLE_MEMCONSOLE_COREBOOT_PATH)) == NULL)
> +        return NULL;
> +
> +    return list;
> +}
> 
Acked-by: Colin Ian King <colin.king@canonical.com>
Alex Hung June 27, 2018, 10:55 p.m. UTC | #2
On 2018-06-20 05:14 AM, Marcello Sylvester Bauer wrote:
> Signed-off-by: Marcello Sylvester Bauer <info@marcellobauer.com>
> ---
>   src/lib/include/fwts_clog.h |  1 +
>   src/lib/src/fwts_clog.c     | 21 +++++++++++++++++++++
>   2 files changed, 22 insertions(+)
> 
> diff --git a/src/lib/include/fwts_clog.h b/src/lib/include/fwts_clog.h
> index 87ecc438..f29aaa3f 100644
> --- a/src/lib/include/fwts_clog.h
> +++ b/src/lib/include/fwts_clog.h
> @@ -24,5 +24,6 @@
>   #include "fwts.h"
>   
>   void       fwts_clog_free(fwts_list *list);
> +fwts_list *fwts_clog_read(void);
>   
>   #endif
> diff --git a/src/lib/src/fwts_clog.c b/src/lib/src/fwts_clog.c
> index 3887e6fc..fe04e090 100644
> --- a/src/lib/src/fwts_clog.c
> +++ b/src/lib/src/fwts_clog.c
> @@ -20,6 +20,12 @@
>   
>   #include "fwts.h"
>   
> +/*
> + *  coreboot logfile exposed by Google firmware module
> + *  Kernel option nessesary (GOOGLE_MEMCONSOLE_COREBOOT=m/y)
> + */
> +#define GOOGLE_MEMCONSOLE_COREBOOT_PATH	"/sys/firmware/log"
> +
>   /*
>    *  free coreboot log list
>    */
> @@ -27,3 +33,18 @@ void fwts_clog_free(fwts_list *clog)
>   {
>           fwts_log_free(clog);
>   }
> +
> +/*
> + *  read coreboot log and return as list of lines
> + *  TODO:	1) parse coreboot logfile as argument
> + *  		2) find coreboot log in /dev/mem
> + */
> +fwts_list *fwts_clog_read(void)
> +{
> +    fwts_list *list;
> +
> +    if ((list = fwts_file_open_and_read(GOOGLE_MEMCONSOLE_COREBOOT_PATH)) == NULL)
> +        return NULL;
> +
> +    return list;
> +}
> 

Acked-by: Alex Hung <alex.hung@canonical.com>
diff mbox series

Patch

diff --git a/src/lib/include/fwts_clog.h b/src/lib/include/fwts_clog.h
index 87ecc438..f29aaa3f 100644
--- a/src/lib/include/fwts_clog.h
+++ b/src/lib/include/fwts_clog.h
@@ -24,5 +24,6 @@ 
 #include "fwts.h"
 
 void       fwts_clog_free(fwts_list *list);
+fwts_list *fwts_clog_read(void);
 
 #endif
diff --git a/src/lib/src/fwts_clog.c b/src/lib/src/fwts_clog.c
index 3887e6fc..fe04e090 100644
--- a/src/lib/src/fwts_clog.c
+++ b/src/lib/src/fwts_clog.c
@@ -20,6 +20,12 @@ 
 
 #include "fwts.h"
 
+/*
+ *  coreboot logfile exposed by Google firmware module
+ *  Kernel option nessesary (GOOGLE_MEMCONSOLE_COREBOOT=m/y)
+ */
+#define GOOGLE_MEMCONSOLE_COREBOOT_PATH	"/sys/firmware/log"
+
 /*
  *  free coreboot log list
  */
@@ -27,3 +33,18 @@  void fwts_clog_free(fwts_list *clog)
 {
         fwts_log_free(clog);
 }
+
+/*
+ *  read coreboot log and return as list of lines
+ *  TODO:	1) parse coreboot logfile as argument
+ *  		2) find coreboot log in /dev/mem
+ */
+fwts_list *fwts_clog_read(void)
+{
+    fwts_list *list;
+
+    if ((list = fwts_file_open_and_read(GOOGLE_MEMCONSOLE_COREBOOT_PATH)) == NULL)
+        return NULL;
+
+    return list;
+}