Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1625713

[PATCH V15 03/11] cper: add timestamp print to CPER status printing

From Tyler Baicar <tbaicar@codeaurora.org>
Newsgroups linux.kernel
Subject [PATCH V15 03/11] cper: add timestamp print to CPER status printing
Date 2017-04-19 01:20 +0200
Message-ID <txKzD-3PB-7@gated-at.bofh.it> (permalink)
References <txKpX-3KK-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


The ACPI 6.1 spec added a timestamp to the HEST generic data
structure. Print the timestamp out when printing out the error
status information.

Signed-off-by: Tyler Baicar <tbaicar@codeaurora.org>
CC: Jonathan (Zhixiong) Zhang <zjzhang@codeaurora.org>
Reviewed-by: James Morse <james.morse@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 drivers/firmware/efi/cper.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/drivers/firmware/efi/cper.c b/drivers/firmware/efi/cper.c
index 8328a6f..46585f9 100644
--- a/drivers/firmware/efi/cper.c
+++ b/drivers/firmware/efi/cper.c
@@ -32,6 +32,8 @@
 #include <linux/acpi.h>
 #include <linux/pci.h>
 #include <linux/aer.h>
+#include <linux/printk.h>
+#include <linux/bcd.h>
 #include <acpi/ghes.h>
 
 #define INDENT_SP	" "
@@ -387,6 +389,29 @@ static void cper_print_pcie(const char *pfx, const struct cper_sec_pcie *pcie,
 	pfx, pcie->bridge.secondary_status, pcie->bridge.control);
 }
 
+static void cper_estatus_timestamp(const char *pfx,
+				   struct acpi_hest_generic_data_v300 *gdata)
+{
+	__u8 hour, min, sec, day, mon, year, century, *timestamp;
+
+	if (gdata->validation_bits & ACPI_HEST_GEN_VALID_TIMESTAMP) {
+		timestamp = (__u8 *)&(gdata->time_stamp);
+		sec       = bcd2bin(timestamp[0]);
+		min       = bcd2bin(timestamp[1]);
+		hour      = bcd2bin(timestamp[2]);
+		day       = bcd2bin(timestamp[4]);
+		mon       = bcd2bin(timestamp[5]);
+		year      = bcd2bin(timestamp[6]);
+		century   = bcd2bin(timestamp[7]);
+
+		if (*(timestamp + 3) & 0x1)
+			printk("%stimestamp is precise\n", pfx);
+
+		printk("%stime: %02d%02d-%02d-%02d %02d:%02d:%02d\n", pfx,
+			century, year, mon, day, hour, min, sec);
+	}
+}
+
 static void
 cper_estatus_print_section(const char *pfx, struct acpi_hest_generic_data *gdata,
 			   int sec_no)
@@ -395,6 +420,9 @@ static void cper_print_pcie(const char *pfx, const struct cper_sec_pcie *pcie,
 	__u16 severity;
 	char newpfx[64];
 
+	if (acpi_hest_get_version(gdata) >= 3)
+		cper_estatus_timestamp(pfx, (struct acpi_hest_generic_data_v300 *)gdata);
+
 	severity = gdata->error_severity;
 	printk("%s""Error %d, type: %s\n", pfx, sec_no,
 	       cper_severity_str(severity));
-- 
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH V15 00/11] Add UEFI 2.6 and ACPI 6.1 updates for RAS on ARM64 Tyler Baicar <tbaicar@codeaurora.org> - 2017-04-19 01:10 +0200
  [PATCH V15 04/11] efi: parse ARM processor error Tyler Baicar <tbaicar@codeaurora.org> - 2017-04-19 01:10 +0200
    Re: [PATCH V15 04/11] efi: parse ARM processor error Borislav Petkov <bp@alien8.de> - 2017-04-21 20:30 +0200
      Re: [PATCH V15 04/11] efi: parse ARM processor error "Baicar, Tyler" <tbaicar@codeaurora.org> - 2017-04-21 20:30 +0200
        Re: [PATCH V15 04/11] efi: parse ARM processor error Borislav Petkov <bp@alien8.de> - 2017-04-24 20:00 +0200
  [PATCH V15 05/11] arm64: exception: handle Synchronous External Abort Tyler Baicar <tbaicar@codeaurora.org> - 2017-04-19 01:10 +0200
  [PATCH V15 03/11] cper: add timestamp print to CPER status printing Tyler Baicar <tbaicar@codeaurora.org> - 2017-04-19 01:20 +0200
    Re: [PATCH V15 03/11] cper: add timestamp print to CPER status  printing Borislav Petkov <bp@alien8.de> - 2017-04-21 14:30 +0200
      Re: [PATCH V15 03/11] cper: add timestamp print to CPER status  printing Borislav Petkov <bp@alien8.de> - 2017-04-21 20:20 +0200
        Re: [PATCH V15 03/11] cper: add timestamp print to CPER status  printing "Baicar, Tyler" <tbaicar@codeaurora.org> - 2017-04-21 20:20 +0200
          Re: [PATCH V15 03/11] cper: add timestamp print to CPER status  printing Borislav Petkov <bp@alien8.de> - 2017-04-21 20:30 +0200
      Re: [PATCH V15 03/11] cper: add timestamp print to CPER status  printing "Baicar, Tyler" <tbaicar@codeaurora.org> - 2017-04-21 20:50 +0200

csiph-web