| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * APEI Error Record Serialization Table support |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 9 | 10 | * |
|---|
| 10 | 11 | * Copyright 2010 Intel Corp. |
|---|
| 11 | 12 | * Author: Huang Ying <ying.huang@intel.com> |
|---|
| 12 | | - * |
|---|
| 13 | | - * This program is free software; you can redistribute it and/or |
|---|
| 14 | | - * modify it under the terms of the GNU General Public License version |
|---|
| 15 | | - * 2 as published by the Free Software Foundation. |
|---|
| 16 | | - * |
|---|
| 17 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 18 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 19 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 20 | | - * GNU General Public License for more details. |
|---|
| 21 | 13 | */ |
|---|
| 22 | 14 | |
|---|
| 23 | 15 | #include <linux/kernel.h> |
|---|
| .. | .. |
|---|
| 899 | 891 | static int __init setup_erst_disable(char *str) |
|---|
| 900 | 892 | { |
|---|
| 901 | 893 | erst_disable = 1; |
|---|
| 902 | | - return 0; |
|---|
| 894 | + return 1; |
|---|
| 903 | 895 | } |
|---|
| 904 | 896 | |
|---|
| 905 | 897 | __setup("erst_disable", setup_erst_disable); |
|---|
| .. | .. |
|---|
| 938 | 930 | }; |
|---|
| 939 | 931 | |
|---|
| 940 | 932 | #define CPER_CREATOR_PSTORE \ |
|---|
| 941 | | - UUID_LE(0x75a574e3, 0x5052, 0x4b29, 0x8a, 0x8e, 0xbe, 0x2c, \ |
|---|
| 942 | | - 0x64, 0x90, 0xb8, 0x9d) |
|---|
| 933 | + GUID_INIT(0x75a574e3, 0x5052, 0x4b29, 0x8a, 0x8e, 0xbe, 0x2c, \ |
|---|
| 934 | + 0x64, 0x90, 0xb8, 0x9d) |
|---|
| 943 | 935 | #define CPER_SECTION_TYPE_DMESG \ |
|---|
| 944 | | - UUID_LE(0xc197e04e, 0xd545, 0x4a70, 0x9c, 0x17, 0xa5, 0x54, \ |
|---|
| 945 | | - 0x94, 0x19, 0xeb, 0x12) |
|---|
| 936 | + GUID_INIT(0xc197e04e, 0xd545, 0x4a70, 0x9c, 0x17, 0xa5, 0x54, \ |
|---|
| 937 | + 0x94, 0x19, 0xeb, 0x12) |
|---|
| 946 | 938 | #define CPER_SECTION_TYPE_DMESG_Z \ |
|---|
| 947 | | - UUID_LE(0x4f118707, 0x04dd, 0x4055, 0xb5, 0xdd, 0x95, 0x6d, \ |
|---|
| 948 | | - 0x34, 0xdd, 0xfa, 0xc6) |
|---|
| 939 | + GUID_INIT(0x4f118707, 0x04dd, 0x4055, 0xb5, 0xdd, 0x95, 0x6d, \ |
|---|
| 940 | + 0x34, 0xdd, 0xfa, 0xc6) |
|---|
| 949 | 941 | #define CPER_SECTION_TYPE_MCE \ |
|---|
| 950 | | - UUID_LE(0xfe08ffbe, 0x95e4, 0x4be7, 0xbc, 0x73, 0x40, 0x96, \ |
|---|
| 951 | | - 0x04, 0x4a, 0x38, 0xfc) |
|---|
| 942 | + GUID_INIT(0xfe08ffbe, 0x95e4, 0x4be7, 0xbc, 0x73, 0x40, 0x96, \ |
|---|
| 943 | + 0x04, 0x4a, 0x38, 0xfc) |
|---|
| 952 | 944 | |
|---|
| 953 | 945 | struct cper_pstore_record { |
|---|
| 954 | 946 | struct cper_record_header hdr; |
|---|
| .. | .. |
|---|
| 1012 | 1004 | rc = -EIO; |
|---|
| 1013 | 1005 | goto out; |
|---|
| 1014 | 1006 | } |
|---|
| 1015 | | - if (uuid_le_cmp(rcd->hdr.creator_id, CPER_CREATOR_PSTORE) != 0) |
|---|
| 1007 | + if (!guid_equal(&rcd->hdr.creator_id, &CPER_CREATOR_PSTORE)) |
|---|
| 1016 | 1008 | goto skip; |
|---|
| 1017 | 1009 | |
|---|
| 1018 | 1010 | record->buf = kmalloc(len, GFP_KERNEL); |
|---|
| .. | .. |
|---|
| 1024 | 1016 | record->id = record_id; |
|---|
| 1025 | 1017 | record->compressed = false; |
|---|
| 1026 | 1018 | record->ecc_notice_size = 0; |
|---|
| 1027 | | - if (uuid_le_cmp(rcd->sec_hdr.section_type, |
|---|
| 1028 | | - CPER_SECTION_TYPE_DMESG_Z) == 0) { |
|---|
| 1019 | + if (guid_equal(&rcd->sec_hdr.section_type, &CPER_SECTION_TYPE_DMESG_Z)) { |
|---|
| 1029 | 1020 | record->type = PSTORE_TYPE_DMESG; |
|---|
| 1030 | 1021 | record->compressed = true; |
|---|
| 1031 | | - } else if (uuid_le_cmp(rcd->sec_hdr.section_type, |
|---|
| 1032 | | - CPER_SECTION_TYPE_DMESG) == 0) |
|---|
| 1022 | + } else if (guid_equal(&rcd->sec_hdr.section_type, &CPER_SECTION_TYPE_DMESG)) |
|---|
| 1033 | 1023 | record->type = PSTORE_TYPE_DMESG; |
|---|
| 1034 | | - else if (uuid_le_cmp(rcd->sec_hdr.section_type, |
|---|
| 1035 | | - CPER_SECTION_TYPE_MCE) == 0) |
|---|
| 1024 | + else if (guid_equal(&rcd->sec_hdr.section_type, &CPER_SECTION_TYPE_MCE)) |
|---|
| 1036 | 1025 | record->type = PSTORE_TYPE_MCE; |
|---|
| 1037 | 1026 | else |
|---|
| 1038 | | - record->type = PSTORE_TYPE_UNKNOWN; |
|---|
| 1027 | + record->type = PSTORE_TYPE_MAX; |
|---|
| 1039 | 1028 | |
|---|
| 1040 | 1029 | if (rcd->hdr.validation_bits & CPER_VALID_TIMESTAMP) |
|---|
| 1041 | 1030 | record->time.tv_sec = rcd->hdr.timestamp; |
|---|
| .. | .. |
|---|
| 1133 | 1122 | rc = erst_check_table(erst_tab); |
|---|
| 1134 | 1123 | if (rc) { |
|---|
| 1135 | 1124 | pr_err(FW_BUG "ERST table is invalid.\n"); |
|---|
| 1136 | | - goto err; |
|---|
| 1125 | + goto err_put_erst_tab; |
|---|
| 1137 | 1126 | } |
|---|
| 1138 | 1127 | |
|---|
| 1139 | 1128 | apei_resources_init(&erst_resources); |
|---|
| .. | .. |
|---|
| 1207 | 1196 | apei_resources_release(&erst_resources); |
|---|
| 1208 | 1197 | err_fini: |
|---|
| 1209 | 1198 | apei_resources_fini(&erst_resources); |
|---|
| 1199 | +err_put_erst_tab: |
|---|
| 1200 | + acpi_put_table((struct acpi_table_header *)erst_tab); |
|---|
| 1210 | 1201 | err: |
|---|
| 1211 | 1202 | erst_disable = 1; |
|---|
| 1212 | 1203 | return rc; |
|---|