aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/apei/erst.c7
-rw-r--r--drivers/firmware/efi/efi-pstore.c13
2 files changed, 18 insertions, 2 deletions
diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c
index 006c3894c6ea..f096ab3cb54d 100644
--- a/drivers/acpi/apei/erst.c
+++ b/drivers/acpi/apei/erst.c
@@ -927,7 +927,8 @@ static int erst_open_pstore(struct pstore_info *psi);
927static int erst_close_pstore(struct pstore_info *psi); 927static int erst_close_pstore(struct pstore_info *psi);
928static ssize_t erst_reader(u64 *id, enum pstore_type_id *type, int *count, 928static ssize_t erst_reader(u64 *id, enum pstore_type_id *type, int *count,
929 struct timespec *time, char **buf, 929 struct timespec *time, char **buf,
930 bool *compressed, struct pstore_info *psi); 930 bool *compressed, ssize_t *ecc_notice_size,
931 struct pstore_info *psi);
931static int erst_writer(enum pstore_type_id type, enum kmsg_dump_reason reason, 932static int erst_writer(enum pstore_type_id type, enum kmsg_dump_reason reason,
932 u64 *id, unsigned int part, int count, bool compressed, 933 u64 *id, unsigned int part, int count, bool compressed,
933 size_t size, struct pstore_info *psi); 934 size_t size, struct pstore_info *psi);
@@ -987,7 +988,8 @@ static int erst_close_pstore(struct pstore_info *psi)
987 988
988static ssize_t erst_reader(u64 *id, enum pstore_type_id *type, int *count, 989static ssize_t erst_reader(u64 *id, enum pstore_type_id *type, int *count,
989 struct timespec *time, char **buf, 990 struct timespec *time, char **buf,
990 bool *compressed, struct pstore_info *psi) 991 bool *compressed, ssize_t *ecc_notice_size,
992 struct pstore_info *psi)
991{ 993{
992 int rc; 994 int rc;
993 ssize_t len = 0; 995 ssize_t len = 0;
@@ -1033,6 +1035,7 @@ skip:
1033 memcpy(*buf, rcd->data, len - sizeof(*rcd)); 1035 memcpy(*buf, rcd->data, len - sizeof(*rcd));
1034 *id = record_id; 1036 *id = record_id;
1035 *compressed = false; 1037 *compressed = false;
1038 *ecc_notice_size = 0;
1036 if (uuid_le_cmp(rcd->sec_hdr.section_type, 1039 if (uuid_le_cmp(rcd->sec_hdr.section_type,
1037 CPER_SECTION_TYPE_DMESG_Z) == 0) { 1040 CPER_SECTION_TYPE_DMESG_Z) == 0) {
1038 *type = PSTORE_TYPE_DMESG; 1041 *type = PSTORE_TYPE_DMESG;
diff --git a/drivers/firmware/efi/efi-pstore.c b/drivers/firmware/efi/efi-pstore.c
index eac76a79a880..30a24d09ea6c 100644
--- a/drivers/firmware/efi/efi-pstore.c
+++ b/drivers/firmware/efi/efi-pstore.c
@@ -34,6 +34,7 @@ struct pstore_read_data {
34 int *count; 34 int *count;
35 struct timespec *timespec; 35 struct timespec *timespec;
36 bool *compressed; 36 bool *compressed;
37 ssize_t *ecc_notice_size;
37 char **buf; 38 char **buf;
38}; 39};
39 40
@@ -69,6 +70,7 @@ static int efi_pstore_read_func(struct efivar_entry *entry, void *data)
69 *cb_data->compressed = true; 70 *cb_data->compressed = true;
70 else 71 else
71 *cb_data->compressed = false; 72 *cb_data->compressed = false;
73 *cb_data->ecc_notice_size = 0;
72 } else if (sscanf(name, "dump-type%u-%u-%d-%lu", 74 } else if (sscanf(name, "dump-type%u-%u-%d-%lu",
73 cb_data->type, &part, &cnt, &time) == 4) { 75 cb_data->type, &part, &cnt, &time) == 4) {
74 *cb_data->id = generic_id(time, part, cnt); 76 *cb_data->id = generic_id(time, part, cnt);
@@ -76,6 +78,7 @@ static int efi_pstore_read_func(struct efivar_entry *entry, void *data)
76 cb_data->timespec->tv_sec = time; 78 cb_data->timespec->tv_sec = time;
77 cb_data->timespec->tv_nsec = 0; 79 cb_data->timespec->tv_nsec = 0;
78 *cb_data->compressed = false; 80 *cb_data->compressed = false;
81 *cb_data->ecc_notice_size = 0;
79 } else if (sscanf(name, "dump-type%u-%u-%lu", 82 } else if (sscanf(name, "dump-type%u-%u-%lu",
80 cb_data->type, &part, &time) == 3) { 83 cb_data->type, &part, &time) == 3) {
81 /* 84 /*
@@ -88,6 +91,7 @@ static int efi_pstore_read_func(struct efivar_entry *entry, void *data)
88 cb_data->timespec->tv_sec = time; 91 cb_data->timespec->tv_sec = time;
89 cb_data->timespec->tv_nsec = 0; 92 cb_data->timespec->tv_nsec = 0;
90 *cb_data->compressed = false; 93 *cb_data->compressed = false;
94 *cb_data->ecc_notice_size = 0;
91 } else 95 } else
92 return 0; 96 return 0;
93 97
@@ -210,6 +214,7 @@ static int efi_pstore_sysfs_entry_iter(void *data, struct efivar_entry **pos)
210static ssize_t efi_pstore_read(u64 *id, enum pstore_type_id *type, 214static ssize_t efi_pstore_read(u64 *id, enum pstore_type_id *type,
211 int *count, struct timespec *timespec, 215 int *count, struct timespec *timespec,
212 char **buf, bool *compressed, 216 char **buf, bool *compressed,
217 ssize_t *ecc_notice_size,
213 struct pstore_info *psi) 218 struct pstore_info *psi)
214{ 219{
215 struct pstore_read_data data; 220 struct pstore_read_data data;
@@ -220,6 +225,7 @@ static ssize_t efi_pstore_read(u64 *id, enum pstore_type_id *type,
220 data.count = count; 225 data.count = count;
221 data.timespec = timespec; 226 data.timespec = timespec;
222 data.compressed = compressed; 227 data.compressed = compressed;
228 data.ecc_notice_size = ecc_notice_size;
223 data.buf = buf; 229 data.buf = buf;
224 230
225 *data.buf = kzalloc(EFIVARS_DATA_SIZE_MAX, GFP_KERNEL); 231 *data.buf = kzalloc(EFIVARS_DATA_SIZE_MAX, GFP_KERNEL);
@@ -393,6 +399,13 @@ static __init int efivars_pstore_init(void)
393 399
394static __exit void efivars_pstore_exit(void) 400static __exit void efivars_pstore_exit(void)
395{ 401{
402 if (!efi_pstore_info.bufsize)
403 return;
404
405 pstore_unregister(&efi_pstore_info);
406 kfree(efi_pstore_info.buf);
407 efi_pstore_info.buf = NULL;
408 efi_pstore_info.bufsize = 0;
396} 409}
397 410
398module_init(efivars_pstore_init); 411module_init(efivars_pstore_init);