From b65c247c7a6302ea46eb64059e1da80c5c982b7a Mon Sep 17 00:00:00 2001 From: Renbo Date: Wed, 10 Jul 2024 15:03:14 +0800 Subject: [PATCH 1/5] update to dmidecode-3.5-1.src.rpm Signed-off-by: Renbo --- ...-read_file-when-reading-from-a-dump-.patch | 64 +++++ ...w-system-slot-types-from-SMBIOS-spec.patch | 75 ------ ...r-characteristics-bits-from-SMBIOS-s.patch | 40 --- ...e-Missing-comma-in-the-dmi_slot_type.patch | 45 ---- ...etails-of-uninstalled-memory-modules.patch | 35 --- ...ssor-upgrades-from-SMBIOS-spec-3.4.0.patch | 34 --- ...-device-types-from-SMBIOS-spec-3.4.0.patch | 34 --- 0007-dmidecode-Fix-crash-with-u-option.patch | 34 --- ...e-Split-table-fetching-from-decoding.patch | 232 ------------------ ...de-Write-the-whole-dump-file-at-once.patch | 193 --------------- ...-let-dump-bin-overwrite-an-existing-.patch | 78 ------ ...ode-Make-dmi_slot_bus_width-reusable.patch | 96 -------- ...ssing-bits-from-SMBIOS-3.4.0-specifi.patch | 117 --------- ...-value-of-Processor-Upgrade-field-fr.patch | 31 --- ...-processor-support-from-SMBIOS-3.6.0.patch | 65 ----- ...xpand-list-of-recognized-CPU-sockets.patch | 37 --- dist | 1 + dmidecode.spec | 66 +---- download | 2 +- 19 files changed, 77 insertions(+), 1202 deletions(-) create mode 100644 0001-Consistently-use-read_file-when-reading-from-a-dump-.patch delete mode 100644 0001-dmidecode-Add-new-system-slot-types-from-SMBIOS-spec.patch delete mode 100644 0002-dmidecode-Add-new-processor-characteristics-bits-from-SMBIOS-s.patch delete mode 100644 0003-dmidecode-Missing-comma-in-the-dmi_slot_type.patch delete mode 100644 0004-dmidecode-Skip-details-of-uninstalled-memory-modules.patch delete mode 100644 0005-dmidecode-Add-new-processor-upgrades-from-SMBIOS-spec-3.4.0.patch delete mode 100644 0006-dmidecode-Add-new-memory-device-types-from-SMBIOS-spec-3.4.0.patch delete mode 100644 0007-dmidecode-Fix-crash-with-u-option.patch delete mode 100644 0008-dmidecode-Split-table-fetching-from-decoding.patch delete mode 100644 0009-dmidecode-Write-the-whole-dump-file-at-once.patch delete mode 100644 0010-dmidecode-Do-not-let-dump-bin-overwrite-an-existing-.patch delete mode 100644 0011-dmidecode-Make-dmi_slot_bus_width-reusable.patch delete mode 100644 0012-dmidecode-Add-missing-bits-from-SMBIOS-3.4.0-specifi.patch delete mode 100644 0013-Support-new-byte-value-of-Processor-Upgrade-field-fr.patch delete mode 100644 0014-dmidecode-Add-processor-support-from-SMBIOS-3.6.0.patch delete mode 100644 0015-dmidecode-Expand-list-of-recognized-CPU-sockets.patch create mode 100644 dist diff --git a/0001-Consistently-use-read_file-when-reading-from-a-dump-.patch b/0001-Consistently-use-read_file-when-reading-from-a-dump-.patch new file mode 100644 index 0000000..e1f41bd --- /dev/null +++ b/0001-Consistently-use-read_file-when-reading-from-a-dump-.patch @@ -0,0 +1,64 @@ +From c76ddda0ba0aa99a55945e3290095c2ec493c892 Mon Sep 17 00:00:00 2001 +From: Jean Delvare +Date: Wed, 26 Apr 2023 15:44:27 +0200 +Subject: [PATCH] Consistently use read_file() when reading from a dump file + +Use read_file() instead of mem_chunk() to read the entry point from a +dump file. This is faster, and consistent with how we then read the +actual DMI table from that dump file. + +This made no functional difference so far, which is why it went +unnoticed for years. But now that a file type check was added to the +mem_chunk() function, we must stop using it to read from regular +files. + +This will again allow root to use the --from-dump option. + +Signed-off-by: Jean Delvare +Tested-by: Jerry Hoemann +--- + dmidecode.c | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +diff --git a/dmidecode.c b/dmidecode.c +index 54f59c1..52ddbf1 100644 +--- a/dmidecode.c ++++ b/dmidecode.c +@@ -6025,17 +6025,25 @@ int main(int argc, char * const argv[]) + pr_comment("dmidecode %s", VERSION); + + /* Read from dump if so instructed */ ++ size = 0x20; + if (opt.flags & FLAG_FROM_DUMP) + { + if (!(opt.flags & FLAG_QUIET)) + pr_info("Reading SMBIOS/DMI data from file %s.", + opt.dumpfile); +- if ((buf = mem_chunk(0, 0x20, opt.dumpfile)) == NULL) ++ if ((buf = read_file(0, &size, opt.dumpfile)) == NULL) + { + ret = 1; + goto exit_free; + } + ++ /* Truncated entry point can't be processed */ ++ if (size < 0x20) ++ { ++ ret = 1; ++ goto done; ++ } ++ + if (memcmp(buf, "_SM3_", 5) == 0) + { + if (smbios3_decode(buf, opt.dumpfile, 0)) +@@ -6059,7 +6067,6 @@ int main(int argc, char * const argv[]) + * contain one of several types of entry points, so read enough for + * the largest one, then determine what type it contains. + */ +- size = 0x20; + if (!(opt.flags & FLAG_NO_SYSFS) + && (buf = read_file(0, &size, SYS_ENTRY_FILE)) != NULL) + { +-- +2.43.0 + diff --git a/0001-dmidecode-Add-new-system-slot-types-from-SMBIOS-spec.patch b/0001-dmidecode-Add-new-system-slot-types-from-SMBIOS-spec.patch deleted file mode 100644 index cd9963e..0000000 --- a/0001-dmidecode-Add-new-system-slot-types-from-SMBIOS-spec.patch +++ /dev/null @@ -1,75 +0,0 @@ -From 0d40ff02f2ae692c34cfd63b0617abf66ea58c5e Mon Sep 17 00:00:00 2001 -From: Jean Delvare -Date: Wed, 21 Oct 2020 15:24:40 +0200 -Subject: [PATCH 1/2] dmidecode: Add new system slot types from SMBIOS spec - 3.4.0 - -Based on an earlier patch from Prabhakar Pujeri (Dell). - -Version 3.4.0 of the SMBIOS specification adds 14 new system slot -types and updates 2 (DMI type 9). - -Signed-off-by: Jean Delvare -Signed-off-by: Lianbo Jiang ---- - dmidecode.c | 26 ++++++++++++++++++++------ - 1 file changed, 20 insertions(+), 6 deletions(-) - -diff --git a/dmidecode.c b/dmidecode.c -index 981fe9697458..0e480d3e337b 100644 ---- a/dmidecode.c -+++ b/dmidecode.c -@@ -1931,11 +1931,16 @@ static const char *dmi_slot_type(u8 code) - "MXM Type IV", - "MXM 3.0 Type A", - "MXM 3.0 Type B", -- "PCI Express 2 SFF-8639", -- "PCI Express 3 SFF-8639", -+ "PCI Express 2 SFF-8639 (U.2)", -+ "PCI Express 3 SFF-8639 (U.2)", - "PCI Express Mini 52-pin with bottom-side keep-outs", - "PCI Express Mini 52-pin without bottom-side keep-outs", -- "PCI Express Mini 76-pin" /* 0x23 */ -+ "PCI Express Mini 76-pin" -+ "PCI Express 4 SFF-8639 (U.2)", -+ "PCI Express 5 SFF-8639 (U.2)", -+ "OCP NIC 3.0 Small Form Factor (SFF)", -+ "OCP NIC 3.0 Large Form Factor (LFF)", -+ "OCP NIC Prior to 3.0" /* 0x28 */ - }; - static const char *type_0x30[] = { - "CXL FLexbus 1.0" /* 0x30 */ -@@ -1970,18 +1975,27 @@ static const char *dmi_slot_type(u8 code) - "PCI Express 4 x2", - "PCI Express 4 x4", - "PCI Express 4 x8", -- "PCI Express 4 x16" /* 0xBD */ -+ "PCI Express 4 x16", -+ "PCI Express 5", -+ "PCI Express 5 x1", -+ "PCI Express 5 x2", -+ "PCI Express 5 x4", -+ "PCI Express 5 x8", -+ "PCI Express 5 x16", -+ "PCI Express 6+", -+ "EDSFF E1", -+ "EDSFF E3" /* 0xC6 */ - }; - /* - * Note to developers: when adding entries to these lists, check if - * function dmi_slot_id below needs updating too. - */ - -- if (code >= 0x01 && code <= 0x23) -+ if (code >= 0x01 && code <= 0x28) - return type[code - 0x01]; - if (code == 0x30) - return type_0x30[code - 0x30]; -- if (code >= 0xA0 && code <= 0xBD) -+ if (code >= 0xA0 && code <= 0xC6) - return type_0xA0[code - 0xA0]; - return out_of_spec; - } --- -2.17.1 - diff --git a/0002-dmidecode-Add-new-processor-characteristics-bits-from-SMBIOS-s.patch b/0002-dmidecode-Add-new-processor-characteristics-bits-from-SMBIOS-s.patch deleted file mode 100644 index 4fe50bd..0000000 --- a/0002-dmidecode-Add-new-processor-characteristics-bits-from-SMBIOS-s.patch +++ /dev/null @@ -1,40 +0,0 @@ -From b289de9deb325eeef7919a1f4e3ac1f93b099c16 Mon Sep 17 00:00:00 2001 -From: Prabhakar pujeri -Date: Fri, 23 Oct 2020 17:45:16 +0200 -Subject: [PATCH] Add new processor characteristics bits from SMBIOS spec 3.4.0 - -* The bit to indicate 128-bit capable processor -* The bit to indicate processor supports returning ARM64 SoC ID - -Signed-off-by: Coiby Xu ---- - dmidecode.c | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/dmidecode.c b/dmidecode.c -index 31a49e4..67f6048 100644 ---- a/dmidecode.c -+++ b/dmidecode.c -@@ -1388,7 +1388,9 @@ static void dmi_processor_characteristics(const char *attr, u16 code) - "Hardware Thread", - "Execute Protection", - "Enhanced Virtualization", -- "Power/Performance Control" /* 7 */ -+ "Power/Performance Control", -+ "128-bit Capable" -+ "Arm64 SoC ID" /* 9 */ - }; - - if ((code & 0x00FC) == 0) -@@ -1398,7 +1400,7 @@ static void dmi_processor_characteristics(const char *attr, u16 code) - int i; - - pr_list_start(attr, NULL); -- for (i = 2; i <= 7; i++) -+ for (i = 2; i <= 9; i++) - if (code & (1 << i)) - pr_list_item("%s", characteristics[i - 2]); - pr_list_end(); --- -2.31.1 - diff --git a/0003-dmidecode-Missing-comma-in-the-dmi_slot_type.patch b/0003-dmidecode-Missing-comma-in-the-dmi_slot_type.patch deleted file mode 100644 index dd3a4a6..0000000 --- a/0003-dmidecode-Missing-comma-in-the-dmi_slot_type.patch +++ /dev/null @@ -1,45 +0,0 @@ -From ac6a64496fc99a5cc05ebe4dd7d1b88f60041009 Mon Sep 17 00:00:00 2001 -From: Lianbo Jiang -Date: Thu, 10 Dec 2020 11:21:21 +0100 -Subject: [PATCH] Missing comma in the dmi_slot_type() - -In the initialization of "type", a suspicious concatenated string -"PCI Express Mini 76-pinPCI Express 4 SFF-8639 (U.2)" is produced -due to a missing comma between lines. - -[JD: Fixed a similar bug in dmi_processor_characteristics.] - -Fixes: b289de9deb32 ("Add new processor characteristics bits from SMBIOS spec 3.4.0") -Fixes: c54348130a2a ("dmidecode: Add new system slot types from SMBIOS spec 3.4.0") -Signed-off-by: Lianbo Jiang -Signed-off-by: Jean Delvare -Signed-off-by: Coiby Xu ---- - dmidecode.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/dmidecode.c b/dmidecode.c -index ac96395..4c98553 100644 ---- a/dmidecode.c -+++ b/dmidecode.c -@@ -1389,7 +1389,7 @@ static void dmi_processor_characteristics(const char *attr, u16 code) - "Execute Protection", - "Enhanced Virtualization", - "Power/Performance Control", -- "128-bit Capable" -+ "128-bit Capable", - "Arm64 SoC ID" /* 9 */ - }; - -@@ -1939,7 +1939,7 @@ static const char *dmi_slot_type(u8 code) - "PCI Express 3 SFF-8639 (U.2)", - "PCI Express Mini 52-pin with bottom-side keep-outs", - "PCI Express Mini 52-pin without bottom-side keep-outs", -- "PCI Express Mini 76-pin" -+ "PCI Express Mini 76-pin", - "PCI Express 4 SFF-8639 (U.2)", - "PCI Express 5 SFF-8639 (U.2)", - "OCP NIC 3.0 Small Form Factor (SFF)", --- -2.31.1 - diff --git a/0004-dmidecode-Skip-details-of-uninstalled-memory-modules.patch b/0004-dmidecode-Skip-details-of-uninstalled-memory-modules.patch deleted file mode 100644 index 638534c..0000000 --- a/0004-dmidecode-Skip-details-of-uninstalled-memory-modules.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 02ff0488f7d7a0f7e69ff7141236cbc1392c3b4c Mon Sep 17 00:00:00 2001 -From: Jean Delvare -Date: Fri, 30 Oct 2020 15:36:19 +0100 -Subject: [PATCH 2/2] dmidecode: Skip details of uninstalled memory modules - -If a memory slot is empty then by definition the fields containing -the memory module details are irrelevant. Best case they are filled -with "Unused" and "None", but in some cases they are even invalid -because the manufacturer did not bother setting the fields to -valid neutral values. So it is better to not print these fields -at all, so as to not confuse the user. - -Signed-off-by: Jean Delvare -Signed-off-by: Lianbo Jiang ---- - dmidecode.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/dmidecode.c b/dmidecode.c -index 0e480d3e337b..657a1341470b 100644 ---- a/dmidecode.c -+++ b/dmidecode.c -@@ -4465,6 +4465,9 @@ static void dmi_decode(const struct dmi_header *h, u16 ver) - dmi_memory_device_type(data[0x12])); - dmi_memory_device_type_detail(WORD(data + 0x13)); - if (h->length < 0x17) break; -+ /* If no module is present, the remaining fields are irrelevant */ -+ if (WORD(data + 0x0C) == 0) -+ break; - dmi_memory_device_speed("Speed", WORD(data + 0x15)); - if (h->length < 0x1B) break; - pr_attr("Manufacturer", "%s", --- -2.17.1 - diff --git a/0005-dmidecode-Add-new-processor-upgrades-from-SMBIOS-spec-3.4.0.patch b/0005-dmidecode-Add-new-processor-upgrades-from-SMBIOS-spec-3.4.0.patch deleted file mode 100644 index 94de9a6..0000000 --- a/0005-dmidecode-Add-new-processor-upgrades-from-SMBIOS-spec-3.4.0.patch +++ /dev/null @@ -1,34 +0,0 @@ -From b3b4c29f38b29a6ac3779ff97363d42fd3061c4a Mon Sep 17 00:00:00 2001 -From: Prabhakar pujeri -Date: Mon, 19 Oct 2020 14:38:04 +0200 -Subject: [PATCH] Add new processor upgrades from SMBIOS spec 3.4.0 - -Added 2 more new values (0x3D and 0x3E). - -Signed-off-by: Coiby Xu ---- - dmidecode.c | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/dmidecode.c b/dmidecode.c -index 97ba941..eb5a5af 100644 ---- a/dmidecode.c -+++ b/dmidecode.c -@@ -1355,10 +1355,12 @@ static const char *dmi_processor_upgrade(u8 code) - "Socket LGA2066", - "Socket BGA1392", - "Socket BGA1510", -- "Socket BGA1528" /* 0x3C */ -+ "Socket BGA1528", -+ "Socket LGA4189", -+ "Socket LGA1200" /* 0x3E */ - }; - -- if (code >= 0x01 && code <= 0x3C) -+ if (code >= 0x01 && code <= 0x3E) - return upgrade[code - 0x01]; - return out_of_spec; - } --- -2.31.1 - diff --git a/0006-dmidecode-Add-new-memory-device-types-from-SMBIOS-spec-3.4.0.patch b/0006-dmidecode-Add-new-memory-device-types-from-SMBIOS-spec-3.4.0.patch deleted file mode 100644 index 3b630ce..0000000 --- a/0006-dmidecode-Add-new-memory-device-types-from-SMBIOS-spec-3.4.0.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 7e25483a392e292c58cea67ba4d052856c2f35d0 Mon Sep 17 00:00:00 2001 -From: Prabhakar pujeri -Date: Mon, 19 Oct 2020 14:38:04 +0200 -Subject: [PATCH] Add new memory device types from SMBIOS spec 3.4.0 - -Added 2 more new values (0x22 and 0x23). - -Signed-off-by: Coiby Xu ---- - dmidecode.c | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/dmidecode.c b/dmidecode.c -index 8b6f5af..97ba941 100644 ---- a/dmidecode.c -+++ b/dmidecode.c -@@ -2639,10 +2639,12 @@ static const char *dmi_memory_device_type(u8 code) - "LPDDR4", - "Logical non-volatile device", - "HBM", -- "HBM2" /* 0x21 */ -+ "HBM2", -+ "DDR5", -+ "LPDDR5" /* 0x23 */ - }; - -- if (code >= 0x01 && code <= 0x21) -+ if (code >= 0x01 && code <= 0x23) - return type[code - 0x01]; - return out_of_spec; - } --- -2.31.1 - diff --git a/0007-dmidecode-Fix-crash-with-u-option.patch b/0007-dmidecode-Fix-crash-with-u-option.patch deleted file mode 100644 index a955edc..0000000 --- a/0007-dmidecode-Fix-crash-with-u-option.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 11e134e54d15e67a64c39a623f492a28df922517 Mon Sep 17 00:00:00 2001 -From: Jean Delvare -Date: Tue, 19 Jan 2021 16:26:01 +0100 -Subject: [PATCH] dmidecode: Fix crash with -u option - -A segmentation fault was reported with option -u. Turns out to be a -stupid thinko where the buffer offset was reset at the wrong loop -depth. - -Reported-by: Jerry Hoemann -Fixes: da06888d08b9 ("dmidecode: Use the print helpers in dump mode too") -Signed-off-by: Jean Delvare ---- - dmidecode.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/dmidecode.c b/dmidecode.c -index 572cb1a..69ea0e8 100644 ---- a/dmidecode.c -+++ b/dmidecode.c -@@ -248,9 +248,9 @@ static void dmi_dump(const struct dmi_header *h) - { - int j, l = strlen(s) + 1; - -- off = 0; - for (row = 0; row < ((l - 1) >> 4) + 1; row++) - { -+ off = 0; - for (j = 0; j < 16 && j < l - (row << 4); j++) - off += sprintf(raw_data + off, - j ? " %02X" : "%02X", --- -2.31.0 - diff --git a/0008-dmidecode-Split-table-fetching-from-decoding.patch b/0008-dmidecode-Split-table-fetching-from-decoding.patch deleted file mode 100644 index fcb97f3..0000000 --- a/0008-dmidecode-Split-table-fetching-from-decoding.patch +++ /dev/null @@ -1,232 +0,0 @@ -From ce2ea1eaf7437962ed546fb7aebd4fe84a7dbef7 Mon Sep 17 00:00:00 2001 -From: Jean Delvare -Date: Mon, 20 Feb 2023 14:53:21 +0100 -Subject: [PATCH 1/3] dmidecode: Split table fetching from decoding - -commit 39b2dd7b6ab719b920e96ed832cfb4bdd664e808 upstream. - -Clean up function dmi_table so that it does only one thing: -* dmi_table() is renamed to dmi_table_get(). It now retrieves the - DMI table, but does not process it any longer. -* Decoding or dumping the table is now done in smbios3_decode(), - smbios_decode() and legacy_decode(). -No functional change. - -A side effect of this change is that writing the header and body of -dump files is now done in a single location. This is required to -further consolidate the writing of dump files. - -Signed-off-by: Jean Delvare -Reviewed-by: Jerry Hoemann ---- - dmidecode.c | 86 ++++++++++++++++++++++++++++++++++++++--------------- - 1 file changed, 62 insertions(+), 24 deletions(-) - -diff --git a/dmidecode.c b/dmidecode.c -index 2374f81..fd02ddb 100644 ---- a/dmidecode.c -+++ b/dmidecode.c -@@ -5270,8 +5270,9 @@ static void dmi_table_decode(u8 *buf, u32 len, u16 num, u16 ver, u32 flags) - } - } - --static void dmi_table(off_t base, u32 len, u16 num, u32 ver, const char *devmem, -- u32 flags) -+/* Allocates a buffer for the table, must be freed by the caller */ -+static u8 *dmi_table_get(off_t base, u32 *len, u16 num, u32 ver, -+ const char *devmem, u32 flags) - { - u8 *buf; - -@@ -5290,7 +5291,7 @@ static void dmi_table(off_t base, u32 len, u16 num, u32 ver, const char *devmem, - { - if (num) - pr_info("%u structures occupying %u bytes.", -- num, len); -+ num, *len); - if (!(opt.flags & FLAG_FROM_DUMP)) - pr_info("Table at 0x%08llX.", - (unsigned long long)base); -@@ -5308,19 +5309,19 @@ static void dmi_table(off_t base, u32 len, u16 num, u32 ver, const char *devmem, - * would be the result of the kernel truncating the table on - * parse error. - */ -- size_t size = len; -+ size_t size = *len; - buf = read_file(flags & FLAG_NO_FILE_OFFSET ? 0 : base, - &size, devmem); -- if (!(opt.flags & FLAG_QUIET) && num && size != (size_t)len) -+ if (!(opt.flags & FLAG_QUIET) && num && size != (size_t)*len) - { - fprintf(stderr, "Wrong DMI structures length: %u bytes " - "announced, only %lu bytes available.\n", -- len, (unsigned long)size); -+ *len, (unsigned long)size); - } -- len = size; -+ *len = size; - } - else -- buf = mem_chunk(base, len, devmem); -+ buf = mem_chunk(base, *len, devmem); - - if (buf == NULL) - { -@@ -5330,15 +5331,9 @@ static void dmi_table(off_t base, u32 len, u16 num, u32 ver, const char *devmem, - fprintf(stderr, - "Try compiling dmidecode with -DUSE_MMAP.\n"); - #endif -- return; - } - -- if (opt.flags & FLAG_DUMP_BIN) -- dmi_table_dump(buf, len); -- else -- dmi_table_decode(buf, len, num, ver >> 8, flags); -- -- free(buf); -+ return buf; - } - - -@@ -5373,8 +5368,9 @@ static void overwrite_smbios3_address(u8 *buf) - - static int smbios3_decode(u8 *buf, const char *devmem, u32 flags) - { -- u32 ver; -+ u32 ver, len; - u64 offset; -+ u8 *table; - - /* Don't let checksum run beyond the buffer */ - if (buf[0x06] > 0x20) -@@ -5400,8 +5396,12 @@ static int smbios3_decode(u8 *buf, const char *devmem, u32 flags) - return 0; - } - -- dmi_table(((off_t)offset.h << 32) | offset.l, -- DWORD(buf + 0x0C), 0, ver, devmem, flags | FLAG_STOP_AT_EOT); -+ /* Maximum length, may get trimmed */ -+ len = DWORD(buf + 0x0C); -+ table = dmi_table_get(((off_t)offset.h << 32) | offset.l, &len, 0, ver, -+ devmem, flags | FLAG_STOP_AT_EOT); -+ if (table == NULL) -+ return 1; - - if (opt.flags & FLAG_DUMP_BIN) - { -@@ -5410,18 +5410,28 @@ static int smbios3_decode(u8 *buf, const char *devmem, u32 flags) - memcpy(crafted, buf, 32); - overwrite_smbios3_address(crafted); - -+ dmi_table_dump(table, len); - if (!(opt.flags & FLAG_QUIET)) - pr_comment("Writing %d bytes to %s.", crafted[0x06], - opt.dumpfile); - write_dump(0, crafted[0x06], crafted, opt.dumpfile, 1); - } -+ else -+ { -+ dmi_table_decode(table, len, 0, ver >> 8, -+ flags | FLAG_STOP_AT_EOT); -+ } -+ -+ free(table); - - return 1; - } - - static int smbios_decode(u8 *buf, const char *devmem, u32 flags) - { -- u16 ver; -+ u16 ver, num; -+ u32 len; -+ u8 *table; - - /* Don't let checksum run beyond the buffer */ - if (buf[0x05] > 0x20) -@@ -5461,8 +5471,13 @@ static int smbios_decode(u8 *buf, const char *devmem, u32 flags) - pr_info("SMBIOS %u.%u present.", - ver >> 8, ver & 0xFF); - -- dmi_table(DWORD(buf + 0x18), WORD(buf + 0x16), WORD(buf + 0x1C), -- ver << 8, devmem, flags); -+ /* Maximum length, may get trimmed */ -+ len = WORD(buf + 0x16); -+ num = WORD(buf + 0x1C); -+ table = dmi_table_get(DWORD(buf + 0x18), &len, num, ver << 8, -+ devmem, flags); -+ if (table == NULL) -+ return 1; - - if (opt.flags & FLAG_DUMP_BIN) - { -@@ -5471,27 +5486,43 @@ static int smbios_decode(u8 *buf, const char *devmem, u32 flags) - memcpy(crafted, buf, 32); - overwrite_dmi_address(crafted + 0x10); - -+ dmi_table_dump(table, len); - if (!(opt.flags & FLAG_QUIET)) - pr_comment("Writing %d bytes to %s.", crafted[0x05], - opt.dumpfile); - write_dump(0, crafted[0x05], crafted, opt.dumpfile, 1); - } -+ else -+ { -+ dmi_table_decode(table, len, num, ver, flags); -+ } -+ -+ free(table); - - return 1; - } - - static int legacy_decode(u8 *buf, const char *devmem, u32 flags) - { -+ u16 ver, num; -+ u32 len; -+ u8 *table; -+ - if (!checksum(buf, 0x0F)) - return 0; - -+ ver = ((buf[0x0E] & 0xF0) << 4) + (buf[0x0E] & 0x0F); - if (!(opt.flags & FLAG_QUIET)) - pr_info("Legacy DMI %u.%u present.", - buf[0x0E] >> 4, buf[0x0E] & 0x0F); - -- dmi_table(DWORD(buf + 0x08), WORD(buf + 0x06), WORD(buf + 0x0C), -- ((buf[0x0E] & 0xF0) << 12) + ((buf[0x0E] & 0x0F) << 8), -- devmem, flags); -+ /* Maximum length, may get trimmed */ -+ len = WORD(buf + 0x06); -+ num = WORD(buf + 0x0C); -+ table = dmi_table_get(DWORD(buf + 0x08), &len, num, ver << 8, -+ devmem, flags); -+ if (table == NULL) -+ return 1; - - if (opt.flags & FLAG_DUMP_BIN) - { -@@ -5500,11 +5531,18 @@ static int legacy_decode(u8 *buf, const char *devmem, u32 flags) - memcpy(crafted, buf, 16); - overwrite_dmi_address(crafted); - -+ dmi_table_dump(table, len); - if (!(opt.flags & FLAG_QUIET)) - pr_comment("Writing %d bytes to %s.", 0x0F, - opt.dumpfile); - write_dump(0, 0x0F, crafted, opt.dumpfile, 1); - } -+ else -+ { -+ dmi_table_decode(table, len, num, ver, flags); -+ } -+ -+ free(table); - - return 1; - } --- -2.31.1 - diff --git a/0009-dmidecode-Write-the-whole-dump-file-at-once.patch b/0009-dmidecode-Write-the-whole-dump-file-at-once.patch deleted file mode 100644 index 6c42bf4..0000000 --- a/0009-dmidecode-Write-the-whole-dump-file-at-once.patch +++ /dev/null @@ -1,193 +0,0 @@ -From 53f7947a03ae10d9805eef017be12c0c7c0644d1 Mon Sep 17 00:00:00 2001 -From: Jean Delvare -Date: Mon, 20 Feb 2023 14:53:25 +0100 -Subject: [PATCH 2/3] dmidecode: Write the whole dump file at once - -commit d8cfbc808f387e87091c25e7d5b8c2bb348bb206 upstream. - -When option --dump-bin is used, write the whole dump file at once, -instead of opening and closing the file separately for the table -and then for the entry point. - -As the file writing function is no longer generic, it gets moved -from util.c to dmidecode.c. - -One minor functional change resulting from the new implementation is -that the entry point is written first now, so the messages printed -are swapped. - -Signed-off-by: Jean Delvare -Reviewed-by: Jerry Hoemann ---- - dmidecode.c | 69 +++++++++++++++++++++++++++++++++++++++-------------- - util.c | 40 ------------------------------- - util.h | 1 - - 3 files changed, 51 insertions(+), 59 deletions(-) - -diff --git a/dmidecode.c b/dmidecode.c -index fd02ddb..9d22b72 100644 ---- a/dmidecode.c -+++ b/dmidecode.c -@@ -5153,11 +5153,56 @@ static void dmi_table_string(const struct dmi_header *h, const u8 *data, u16 ver - } - } - --static void dmi_table_dump(const u8 *buf, u32 len) -+static int dmi_table_dump(const u8 *ep, u32 ep_len, const u8 *table, -+ u32 table_len) - { -+ FILE *f; -+ -+ f = fopen(opt.dumpfile, "wb"); -+ if (!f) -+ { -+ fprintf(stderr, "%s: ", opt.dumpfile); -+ perror("fopen"); -+ return -1; -+ } -+ -+ if (!(opt.flags & FLAG_QUIET)) -+ pr_comment("Writing %d bytes to %s.", ep_len, opt.dumpfile); -+ if (fwrite(ep, ep_len, 1, f) != 1) -+ { -+ fprintf(stderr, "%s: ", opt.dumpfile); -+ perror("fwrite"); -+ goto err_close; -+ } -+ -+ if (fseek(f, 32, SEEK_SET) != 0) -+ { -+ fprintf(stderr, "%s: ", opt.dumpfile); -+ perror("fseek"); -+ goto err_close; -+ } -+ - if (!(opt.flags & FLAG_QUIET)) -- pr_comment("Writing %d bytes to %s.", len, opt.dumpfile); -- write_dump(32, len, buf, opt.dumpfile, 0); -+ pr_comment("Writing %d bytes to %s.", table_len, opt.dumpfile); -+ if (fwrite(table, table_len, 1, f) != 1) -+ { -+ fprintf(stderr, "%s: ", opt.dumpfile); -+ perror("fwrite"); -+ goto err_close; -+ } -+ -+ if (fclose(f)) -+ { -+ fprintf(stderr, "%s: ", opt.dumpfile); -+ perror("fclose"); -+ return -1; -+ } -+ -+ return 0; -+ -+err_close: -+ fclose(f); -+ return -1; - } - - static void dmi_table_decode(u8 *buf, u32 len, u16 num, u16 ver, u32 flags) -@@ -5410,11 +5455,7 @@ static int smbios3_decode(u8 *buf, const char *devmem, u32 flags) - memcpy(crafted, buf, 32); - overwrite_smbios3_address(crafted); - -- dmi_table_dump(table, len); -- if (!(opt.flags & FLAG_QUIET)) -- pr_comment("Writing %d bytes to %s.", crafted[0x06], -- opt.dumpfile); -- write_dump(0, crafted[0x06], crafted, opt.dumpfile, 1); -+ dmi_table_dump(crafted, crafted[0x06], table, len); - } - else - { -@@ -5486,11 +5527,7 @@ static int smbios_decode(u8 *buf, const char *devmem, u32 flags) - memcpy(crafted, buf, 32); - overwrite_dmi_address(crafted + 0x10); - -- dmi_table_dump(table, len); -- if (!(opt.flags & FLAG_QUIET)) -- pr_comment("Writing %d bytes to %s.", crafted[0x05], -- opt.dumpfile); -- write_dump(0, crafted[0x05], crafted, opt.dumpfile, 1); -+ dmi_table_dump(crafted, crafted[0x05], table, len); - } - else - { -@@ -5531,11 +5568,7 @@ static int legacy_decode(u8 *buf, const char *devmem, u32 flags) - memcpy(crafted, buf, 16); - overwrite_dmi_address(crafted); - -- dmi_table_dump(table, len); -- if (!(opt.flags & FLAG_QUIET)) -- pr_comment("Writing %d bytes to %s.", 0x0F, -- opt.dumpfile); -- write_dump(0, 0x0F, crafted, opt.dumpfile, 1); -+ dmi_table_dump(crafted, 0x0F, table, len); - } - else - { -diff --git a/util.c b/util.c -index 04aaadd..1547096 100644 ---- a/util.c -+++ b/util.c -@@ -259,46 +259,6 @@ out: - return p; - } - --int write_dump(size_t base, size_t len, const void *data, const char *dumpfile, int add) --{ -- FILE *f; -- -- f = fopen(dumpfile, add ? "r+b" : "wb"); -- if (!f) -- { -- fprintf(stderr, "%s: ", dumpfile); -- perror("fopen"); -- return -1; -- } -- -- if (fseek(f, base, SEEK_SET) != 0) -- { -- fprintf(stderr, "%s: ", dumpfile); -- perror("fseek"); -- goto err_close; -- } -- -- if (fwrite(data, len, 1, f) != 1) -- { -- fprintf(stderr, "%s: ", dumpfile); -- perror("fwrite"); -- goto err_close; -- } -- -- if (fclose(f)) -- { -- fprintf(stderr, "%s: ", dumpfile); -- perror("fclose"); -- return -1; -- } -- -- return 0; -- --err_close: -- fclose(f); -- return -1; --} -- - /* Returns end - start + 1, assuming start < end */ - u64 u64_range(u64 start, u64 end) - { -diff --git a/util.h b/util.h -index 3094cf8..ef24eb9 100644 ---- a/util.h -+++ b/util.h -@@ -27,5 +27,4 @@ - int checksum(const u8 *buf, size_t len); - void *read_file(off_t base, size_t *len, const char *filename); - void *mem_chunk(off_t base, size_t len, const char *devmem); --int write_dump(size_t base, size_t len, const void *data, const char *dumpfile, int add); - u64 u64_range(u64 start, u64 end); --- -2.31.1 - diff --git a/0010-dmidecode-Do-not-let-dump-bin-overwrite-an-existing-.patch b/0010-dmidecode-Do-not-let-dump-bin-overwrite-an-existing-.patch deleted file mode 100644 index 8d9310f..0000000 --- a/0010-dmidecode-Do-not-let-dump-bin-overwrite-an-existing-.patch +++ /dev/null @@ -1,78 +0,0 @@ -From 20986ae42742ce320ee2e6967351b8ff3e3f3a95 Mon Sep 17 00:00:00 2001 -From: Jean Delvare -Date: Mon, 20 Feb 2023 14:53:31 +0100 -Subject: [PATCH 3/3] dmidecode: Do not let --dump-bin overwrite an existing - file - -commit 6ca381c1247c81f74e1ca4e7706f70bdda72e6f2 upstream. - -Make sure that the file passed to option --dump-bin does not already -exist. In practice, it is rather unlikely that an honest user would -want to overwrite an existing dump file, while this possibility -could be used by a rogue user to corrupt a system file. - -Signed-off-by: Jean Delvare -Reviewed-by: Jerry Hoemann ---- - dmidecode.c | 14 ++++++++++++-- - man/dmidecode.8 | 3 ++- - 2 files changed, 14 insertions(+), 3 deletions(-) - -diff --git a/dmidecode.c b/dmidecode.c -index 9d22b72..f4cde27 100644 ---- a/dmidecode.c -+++ b/dmidecode.c -@@ -60,6 +60,7 @@ - * https://www.dmtf.org/sites/default/files/DSP0270_1.0.1.pdf - */ - -+#include - #include - #include - #include -@@ -5156,13 +5157,22 @@ static void dmi_table_string(const struct dmi_header *h, const u8 *data, u16 ver - static int dmi_table_dump(const u8 *ep, u32 ep_len, const u8 *table, - u32 table_len) - { -+ int fd; - FILE *f; - -- f = fopen(opt.dumpfile, "wb"); -+ fd = open(opt.dumpfile, O_WRONLY|O_CREAT|O_EXCL, 0666); -+ if (fd == -1) -+ { -+ fprintf(stderr, "%s: ", opt.dumpfile); -+ perror("open"); -+ return -1; -+ } -+ -+ f = fdopen(fd, "wb"); - if (!f) - { - fprintf(stderr, "%s: ", opt.dumpfile); -- perror("fopen"); -+ perror("fdopen"); - return -1; - } - -diff --git a/man/dmidecode.8 b/man/dmidecode.8 -index 64dc7e7..d5b7f01 100644 ---- a/man/dmidecode.8 -+++ b/man/dmidecode.8 -@@ -1,4 +1,4 @@ --.TH DMIDECODE 8 "January 2019" "dmidecode" -+.TH DMIDECODE 8 "February 2023" "dmidecode" - .\" - .SH NAME - dmidecode \- \s-1DMI\s0 table decoder -@@ -132,6 +132,7 @@ hexadecimal and \s-1ASCII\s0. This option is mainly useful for debugging. - Do not decode the entries, instead dump the DMI data to a file in binary - form. The generated file is suitable to pass to \fB--from-dump\fR - later. -+\fIFILE\fP must not exist. - .TP - .BR " " " " "--from-dump FILE" - Read the DMI data from a binary file previously generated using --- -2.31.1 - diff --git a/0011-dmidecode-Make-dmi_slot_bus_width-reusable.patch b/0011-dmidecode-Make-dmi_slot_bus_width-reusable.patch deleted file mode 100644 index 5ba168c..0000000 --- a/0011-dmidecode-Make-dmi_slot_bus_width-reusable.patch +++ /dev/null @@ -1,96 +0,0 @@ -From f1874a58d981593f4a754fc63b4ca1410a590078 Mon Sep 17 00:00:00 2001 -From: Jean Delvare -Date: Wed, 15 Jun 2022 13:35:25 +0200 -Subject: [PATCH 1/2] dmidecode: Make dmi_slot_bus_width() reusable - -Let dmi_slot_bus_width() return its value without a trailing space, -so that this function can be reused in a different context. - -Signed-off-by: Jean Delvare ---- - dmidecode.c | 52 ++++++++++++++++++++++++++++++++++------------------ - 1 file changed, 34 insertions(+), 18 deletions(-) - -diff --git a/dmidecode.c b/dmidecode.c -index 73e455f..cd29caa 100644 ---- a/dmidecode.c -+++ b/dmidecode.c -@@ -2074,31 +2074,49 @@ static const char *dmi_slot_type(u8 code) - return out_of_spec; - } - --static const char *dmi_slot_bus_width(u8 code) -+/* If hide_unknown is set, return NULL instead of "Other" or "Unknown" */ -+static const char *dmi_slot_bus_width(u8 code, int hide_unknown) - { - /* 7.10.2 */ - static const char *width[] = { -- "", /* 0x01, "Other" */ -- "", /* "Unknown" */ -- "8-bit ", -- "16-bit ", -- "32-bit ", -- "64-bit ", -- "128-bit ", -- "x1 ", -- "x2 ", -- "x4 ", -- "x8 ", -- "x12 ", -- "x16 ", -- "x32 " /* 0x0E */ -+ "Other", /* 0x01 */ -+ "Unknown", -+ "8-bit", -+ "16-bit", -+ "32-bit", -+ "64-bit", -+ "128-bit", -+ "x1", -+ "x2", -+ "x4", -+ "x8", -+ "x12", -+ "x16", -+ "x32" /* 0x0E */ - }; - - if (code >= 0x01 && code <= 0x0E) -+ { -+ if (code <= 0x02 && hide_unknown) -+ return NULL; - return width[code - 0x01]; -+ } - return out_of_spec; - } - -+static void dmi_slot_type_with_width(u8 type, u8 width) -+{ -+ const char *type_str, *width_str; -+ -+ type_str = dmi_slot_type(type); -+ width_str = dmi_slot_bus_width(width, 1); -+ -+ if (width_str) -+ pr_attr("Type", "%s %s", width_str, type_str); -+ else -+ pr_attr("Type", "%s", type_str); -+} -+ - static const char *dmi_slot_current_usage(u8 code) - { - /* 7.10.3 */ -@@ -4405,9 +4423,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver) - if (h->length < 0x0C) break; - pr_attr("Designation", "%s", - dmi_string(h, data[0x04])); -- pr_attr("Type", "%s%s", -- dmi_slot_bus_width(data[0x06]), -- dmi_slot_type(data[0x05])); -+ dmi_slot_type_with_width(data[0x05], data[0x06]); - pr_attr("Current Usage", "%s", - dmi_slot_current_usage(data[0x07])); - pr_attr("Length", "%s", --- -2.31.1 - diff --git a/0012-dmidecode-Add-missing-bits-from-SMBIOS-3.4.0-specifi.patch b/0012-dmidecode-Add-missing-bits-from-SMBIOS-3.4.0-specifi.patch deleted file mode 100644 index c5b9db9..0000000 --- a/0012-dmidecode-Add-missing-bits-from-SMBIOS-3.4.0-specifi.patch +++ /dev/null @@ -1,117 +0,0 @@ -From 7172ba42d24430fefb538b970c76a135feb2dd78 Mon Sep 17 00:00:00 2001 -From: Jean Delvare -Date: Wed, 15 Jun 2022 13:35:25 +0200 -Subject: [PATCH 2/2] dmidecode: Add missing bits from SMBIOS 3.4.0 - specification - -When adding support for SMBIOS 3.4.0, we missed new enumerated -values for the slot type field, and 3 new fields at the end of -System Slots (type 9) structures. - -Signed-off-by: Jean Delvare ---- - dmidecode.c | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++-- - 1 file changed, 72 insertions(+), 2 deletions(-) - -diff --git a/dmidecode.c b/dmidecode.c -index cd29caa..42da9fb 100644 ---- a/dmidecode.c -+++ b/dmidecode.c -@@ -2197,6 +2197,13 @@ static void dmi_slot_id(u8 code1, u8 code2, u8 type) - case 0xBB: /* PCI Express 4 */ - case 0xBC: /* PCI Express 4 */ - case 0xBD: /* PCI Express 4 */ -+ case 0xBE: /* PCI Express 5 */ -+ case 0xBF: /* PCI Express 5 */ -+ case 0xC0: /* PCI Express 5 */ -+ case 0xC1: /* PCI Express 5 */ -+ case 0xC2: /* PCI Express 5 */ -+ case 0xC3: /* PCI Express 5 */ -+ case 0xC4: /* PCI Express 6+ */ - pr_attr("ID", "%u", code1); - break; - case 0x07: /* PCMCIA */ -@@ -2269,6 +2276,65 @@ static void dmi_slot_peers(u8 n, const u8 *data) - } - } - -+static void dmi_slot_information(u8 type, u8 code) -+{ -+ switch (type) -+ { -+ case 0x1F: /* PCI Express 2 */ -+ case 0x20: /* PCI Express 3 */ -+ case 0x21: /* PCI Express Mini */ -+ case 0x22: /* PCI Express Mini */ -+ case 0x23: /* PCI Express Mini */ -+ case 0xA5: /* PCI Express */ -+ case 0xA6: /* PCI Express */ -+ case 0xA7: /* PCI Express */ -+ case 0xA8: /* PCI Express */ -+ case 0xA9: /* PCI Express */ -+ case 0xAA: /* PCI Express */ -+ case 0xAB: /* PCI Express 2 */ -+ case 0xAC: /* PCI Express 2 */ -+ case 0xAD: /* PCI Express 2 */ -+ case 0xAE: /* PCI Express 2 */ -+ case 0xAF: /* PCI Express 2 */ -+ case 0xB0: /* PCI Express 2 */ -+ case 0xB1: /* PCI Express 3 */ -+ case 0xB2: /* PCI Express 3 */ -+ case 0xB3: /* PCI Express 3 */ -+ case 0xB4: /* PCI Express 3 */ -+ case 0xB5: /* PCI Express 3 */ -+ case 0xB6: /* PCI Express 3 */ -+ case 0xB8: /* PCI Express 4 */ -+ case 0xB9: /* PCI Express 4 */ -+ case 0xBA: /* PCI Express 4 */ -+ case 0xBB: /* PCI Express 4 */ -+ case 0xBC: /* PCI Express 4 */ -+ case 0xBD: /* PCI Express 4 */ -+ case 0xBE: /* PCI Express 5 */ -+ case 0xBF: /* PCI Express 5 */ -+ case 0xC0: /* PCI Express 5 */ -+ case 0xC1: /* PCI Express 5 */ -+ case 0xC2: /* PCI Express 5 */ -+ case 0xC3: /* PCI Express 5 */ -+ case 0xC4: /* PCI Express 6+ */ -+ if (code) -+ pr_attr("PCI Express Generation", "%u", code); -+ break; -+ } -+} -+ -+static void dmi_slot_physical_width(u8 code) -+{ -+ if (code) -+ pr_attr("Slot Physical Width", "%s", -+ dmi_slot_bus_width(code, 0)); -+} -+ -+static void dmi_slot_pitch(u16 code) -+{ -+ if (code) -+ pr_attr("Pitch", "%u.%02u mm", code / 100, code % 100); -+} -+ - /* - * 7.11 On Board Devices Information (Type 10) - */ -@@ -4438,8 +4504,12 @@ static void dmi_decode(const struct dmi_header *h, u16 ver) - if (h->length < 0x13) break; - pr_attr("Data Bus Width", "%u", data[0x11]); - pr_attr("Peer Devices", "%u", data[0x12]); -- if (h->length - 0x13 >= data[0x12] * 5) -- dmi_slot_peers(data[0x12], data + 0x13); -+ if (h->length < 0x13 + data[0x12] * 5) break; -+ dmi_slot_peers(data[0x12], data + 0x13); -+ if (h->length < 0x17 + data[0x12] * 5) break; -+ dmi_slot_information(data[0x05], data[0x13 + data[0x12] * 5]); -+ dmi_slot_physical_width(data[0x14 + data[0x12] * 5]); -+ dmi_slot_pitch(WORD(data + 0x15 + data[0x12] * 5)); - break; - - case 10: /* 7.11 On Board Devices Information */ --- -2.31.1 - diff --git a/0013-Support-new-byte-value-of-Processor-Upgrade-field-fr.patch b/0013-Support-new-byte-value-of-Processor-Upgrade-field-fr.patch deleted file mode 100644 index 7d3ff47..0000000 --- a/0013-Support-new-byte-value-of-Processor-Upgrade-field-fr.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 6dceb9b4df4eb4d866bfe2f0de7f92f4e4ad891d Mon Sep 17 00:00:00 2001 -From: wangkaiqiang -Date: Wed, 8 May 2024 17:16:53 +0800 -Subject: [PATCH] Support new byte value of Processor Upgrade field from SMBIOS - 3.5. - ---- - dmidecode.c | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/dmidecode.c b/dmidecode.c -index 202c9bc..54dd69b 100644 ---- a/dmidecode.c -+++ b/dmidecode.c -@@ -1358,10 +1358,11 @@ static const char *dmi_processor_upgrade(u8 code) - "Socket BGA1510", - "Socket BGA1528", - "Socket LGA4189", -- "Socket LGA1200" /* 0x3E */ -+ "Socket LGA1200", -+ "Socket LGA4677" /* 0x3F */ - }; - -- if (code >= 0x01 && code <= 0x3E) -+ if (code >= 0x01 && code <= 0x3F) - return upgrade[code - 0x01]; - return out_of_spec; - } --- -2.31.1 - diff --git a/0014-dmidecode-Add-processor-support-from-SMBIOS-3.6.0.patch b/0014-dmidecode-Add-processor-support-from-SMBIOS-3.6.0.patch deleted file mode 100644 index 60e3026..0000000 --- a/0014-dmidecode-Add-processor-support-from-SMBIOS-3.6.0.patch +++ /dev/null @@ -1,65 +0,0 @@ -From 9524ba91157444f15f587347700550cc4cd7436c Mon Sep 17 00:00:00 2001 -From: wangkaiqiang -Date: Wed, 8 May 2024 17:12:47 +0800 -Subject: [PATCH 2/3] dmidecode: Add processor support from SMBIOS 3.6.0 - ---- - dmidecode.c | 19 ++++++++++++++++--- - 1 file changed, 16 insertions(+), 3 deletions(-) - -diff --git a/dmidecode.c b/dmidecode.c -index 54dd69b..0c6382d 100644 ---- a/dmidecode.c -+++ b/dmidecode.c -@@ -967,6 +967,7 @@ static const char *dmi_processor_family(const struct dmi_header *h, u16 ver) - - { 0x100, "ARMv7" }, - { 0x101, "ARMv8" }, -+ { 0x102, "ARMv9" }, - { 0x104, "SH-3" }, - { 0x105, "SH-4" }, - { 0x118, "ARM" }, -@@ -1124,7 +1125,7 @@ static void dmi_processor_id(const struct dmi_header *h) - return; - } - } -- else if ((type >= 0x100 && type <= 0x101) /* ARM */ -+ else if ((type >= 0x100 && type <= 0x102) /* ARM */ - || (type >= 0x118 && type <= 0x119)) /* ARM */ - { - u32 midr = DWORD(p); -@@ -1359,10 +1360,19 @@ static const char *dmi_processor_upgrade(u8 code) - "Socket BGA1528", - "Socket LGA4189", - "Socket LGA1200", -- "Socket LGA4677" /* 0x3F */ -+ "Socket LGA4677", -+ "Socket LGA1700", -+ "Socket BGA1744", -+ "Socket BGA1781", -+ "Socket BGA1211", -+ "Socket BGA2422", -+ "Socket LGA1211", -+ "Socket LGA2422", -+ "Socket LGA5773", -+ "Socket BGA5773" /* 0x48 */ - }; - -- if (code >= 0x01 && code <= 0x3F) -+ if (code >= 0x01 && code <= 0x48) - return upgrade[code - 0x01]; - return out_of_spec; - } -@@ -4311,6 +4321,9 @@ static void dmi_decode(const struct dmi_header *h, u16 ver) - pr_attr("Thread Count", "%u", - h->length >= 0x30 && data[0x25] == 0xFF ? - WORD(data + 0x2E) : data[0x25]); -+ if (h->length >= 0x32 && WORD(data + 0x30) != 0) -+ pr_attr("Thread Enabled", "%u", -+ WORD(data + 0x30)); - dmi_processor_characteristics("Characteristics", - WORD(data + 0x26)); - break; --- -2.31.1 - diff --git a/0015-dmidecode-Expand-list-of-recognized-CPU-sockets.patch b/0015-dmidecode-Expand-list-of-recognized-CPU-sockets.patch deleted file mode 100644 index a8ad23c..0000000 --- a/0015-dmidecode-Expand-list-of-recognized-CPU-sockets.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 8507ddc337130465df62ee0ca9d9f6e8f5ed0efc Mon Sep 17 00:00:00 2001 -From: wangkaiqiang -Date: Wed, 8 May 2024 17:14:20 +0800 -Subject: [PATCH 3/3] dmidecode: Expand list of recognized CPU sockets - ---- - dmidecode.c | 12 ++++++++++-- - 1 file changed, 10 insertions(+), 2 deletions(-) - -diff --git a/dmidecode.c b/dmidecode.c -index 0c6382d..4b2f6d2 100644 ---- a/dmidecode.c -+++ b/dmidecode.c -@@ -1369,10 +1369,18 @@ static const char *dmi_processor_upgrade(u8 code) - "Socket LGA1211", - "Socket LGA2422", - "Socket LGA5773", -- "Socket BGA5773" /* 0x48 */ -+ "Socket BGA5773", -+ "Socket AM5", -+ "Socket SP5", -+ "Socket SP6", -+ "Socket BGA883", -+ "Socket BGA1190", -+ "Socket BGA4129", -+ "Socket LGA4710", -+ "Socket LGA7529" /* 0x50 */ - }; - -- if (code >= 0x01 && code <= 0x48) -+ if (code >= 0x01 && code <= 0x50) - return upgrade[code - 0x01]; - return out_of_spec; - } --- -2.31.1 - diff --git a/dist b/dist new file mode 100644 index 0000000..9c0e36e --- /dev/null +++ b/dist @@ -0,0 +1 @@ +an8 diff --git a/dmidecode.spec b/dmidecode.spec index 19c79fe..cdd3ab2 100644 --- a/dmidecode.spec +++ b/dmidecode.spec @@ -1,41 +1,16 @@ -%define anolis_release .0.6 Summary: Tool to analyse BIOS DMI data Name: dmidecode -Version: 3.3 -Release: 5%{anolis_release}%{?dist} +Version: 3.5 +Release: 1%{?dist} Epoch: 1 License: GPLv2+ Source0: http://download.savannah.gnu.org/releases/%{name}/%{name}-%{version}.tar.xz URL: http://www.nongnu.org/dmidecode/ -Patch0: 0001-dmidecode-Add-new-system-slot-types-from-SMBIOS-spec.patch -Patch1: 0002-dmidecode-Add-new-processor-characteristics-bits-from-SMBIOS-s.patch -Patch2: 0003-dmidecode-Missing-comma-in-the-dmi_slot_type.patch -Patch3: 0004-dmidecode-Skip-details-of-uninstalled-memory-modules.patch -Patch4: 0005-dmidecode-Add-new-processor-upgrades-from-SMBIOS-spec-3.4.0.patch -Patch5: 0006-dmidecode-Add-new-memory-device-types-from-SMBIOS-spec-3.4.0.patch -Patch6: 0007-dmidecode-Fix-crash-with-u-option.patch -Patch7: 0008-dmidecode-Split-table-fetching-from-decoding.patch -Patch8: 0009-dmidecode-Write-the-whole-dump-file-at-once.patch -Patch9: 0010-dmidecode-Do-not-let-dump-bin-overwrite-an-existing-.patch -Patch10: 0011-dmidecode-Make-dmi_slot_bus_width-reusable.patch -Patch11: 0012-dmidecode-Add-missing-bits-from-SMBIOS-3.4.0-specifi.patch -Patch12: 0013-Support-new-byte-value-of-Processor-Upgrade-field-fr.patch -Patch13: 0014-dmidecode-Add-processor-support-from-SMBIOS-3.6.0.patch -Patch14: 0015-dmidecode-Expand-list-of-recognized-CPU-sockets.patch +Patch0: 0001-Consistently-use-read_file-when-reading-from-a-dump-.patch BuildRequires: gcc make -Requires: glibc -Provides: /usr/sbin/dmidecode -ExclusiveArch: %{ix86} x86_64 ia64 aarch64 loongarch64 sw_64 - -%package doc -Summary: Documents for %{name} -BuildArch: noarch -Requires: %{name} = %{epoch}:%{version}-%{release} - -%description doc -Doc pages for %{name}. +ExclusiveArch: %{ix86} x86_64 ia64 aarch64 %description dmidecode reports information about x86 & ia64 hardware as described in the @@ -49,7 +24,7 @@ slots (e.g. AGP, PCI, ISA) and memory module slots, and the list of I/O ports (e.g. serial, parallel, USB). %prep -%autosetup -n %{name}-%{version} -p1 +%autosetup %build make %{?_smp_mflags} CFLAGS="%{optflags}" LDFLAGS="%{__global_ldflags}" @@ -58,42 +33,23 @@ make %{?_smp_mflags} CFLAGS="%{optflags}" LDFLAGS="%{__global_ldflags}" make %{?_smp_mflags} DESTDIR=%{buildroot} prefix=%{_prefix} install-bin install-man %files +%doc AUTHORS NEWS README %{!?_licensedir:%global license %%doc} %license LICENSE %{_sbindir}/dmidecode -%ifnarch ia64 aarch64 loongarch64 sw_64 +%ifnarch ia64 aarch64 %{_sbindir}/vpddecode %{_sbindir}/ownership %{_sbindir}/biosdecode %endif %{_mandir}/man8/* -%files doc -%doc AUTHORS NEWS README - %changelog -* Tue May 14 2024 Kaiqiang Wang - 1:3.3-5.0.6 -- https://bugzilla.openanolis.cn/show_bug.cgi?id=8972 -- dmidecode Add processor support from SMBIOS 3.6.0 -* Wed May 08 2024 Kaiqiang Wang - 1:3.3-5.0.5 -- https://bugzilla.openanolis.cn/show_bug.cgi?id=8962 -- dmidecode: Make dmi_slot_bus_width() reusable -- dmidecode: Add missing bits from SMBIOS 3.4.0 specification - -* Tue Mar 19 2024 wxiat - 1:3.3-5.0.4 -- cherry-pick `add sw arch in files`. - -* Tue Mar 19 2024 wxiat - 1:3.3-5.0.3 -- cherry-pick `add sw arch`. - -* Wed Sep 20 2023 Bo Liu - 1:3.3-5.0.2 -- fix CVE-2023-30630 - -* Wed Oct 19 2022 Liwei Ge - 1:3.3-4.0.2 -- Enable loongarch64 support +* Wed Dec 20 2023 Lichen Liu - 1:3.5-1 +- Rebase to upstream 3.5 -* Sat Jul 16 2022 Bo Ren - 1:3.3-4.0.1 -- Add doc sub package +* Thu Jun 08 2023 Lichen Liu - 1:3.3-5 +- Resolves: rhbz#2186860 * Wed Jan 26 2022 Coiby Xu - 1:3.3-4 - Resolves: rhbz#2042224 diff --git a/download b/download index 91d775b..116cb34 100644 --- a/download +++ b/download @@ -1 +1 @@ -afca949fd71a23dd39c4a3c9cd946dc0 dmidecode-3.3.tar.xz +b8ed8fa2c01c624a61157f10dbbf2b03 dmidecode-3.5.tar.xz -- Gitee From ac773685e4c0f226d5ce78f43f8308868f7b911b Mon Sep 17 00:00:00 2001 From: Bo Ren Date: Sat, 16 Jul 2022 18:23:08 +0800 Subject: [PATCH 2/5] spec: add doc sub package Signed-off-by: Bo Ren --- dmidecode.spec | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/dmidecode.spec b/dmidecode.spec index cdd3ab2..e29825b 100644 --- a/dmidecode.spec +++ b/dmidecode.spec @@ -1,7 +1,8 @@ +%define anolis_release .0.1 Summary: Tool to analyse BIOS DMI data Name: dmidecode Version: 3.5 -Release: 1%{?dist} +Release: 1%{anolis_release}%{?dist} Epoch: 1 License: GPLv2+ Source0: http://download.savannah.gnu.org/releases/%{name}/%{name}-%{version}.tar.xz @@ -10,8 +11,18 @@ URL: http://www.nongnu.org/dmidecode/ Patch0: 0001-Consistently-use-read_file-when-reading-from-a-dump-.patch BuildRequires: gcc make +Requires: glibc +Provides: /usr/sbin/dmidecode ExclusiveArch: %{ix86} x86_64 ia64 aarch64 +%package doc +Summary: Documents for %{name} +BuildArch: noarch +Requires: %{name} = %{epoch}:%{version}-%{release} + +%description doc +Doc pages for %{name}. + %description dmidecode reports information about x86 & ia64 hardware as described in the system BIOS according to the SMBIOS/DMI standard. This information @@ -33,7 +44,6 @@ make %{?_smp_mflags} CFLAGS="%{optflags}" LDFLAGS="%{__global_ldflags}" make %{?_smp_mflags} DESTDIR=%{buildroot} prefix=%{_prefix} install-bin install-man %files -%doc AUTHORS NEWS README %{!?_licensedir:%global license %%doc} %license LICENSE %{_sbindir}/dmidecode @@ -44,7 +54,13 @@ make %{?_smp_mflags} DESTDIR=%{buildroot} prefix=%{_prefix} install-bin install- %endif %{_mandir}/man8/* +%files doc +%doc AUTHORS NEWS README + %changelog +* Wed Jul 10 2024 Bo Ren - 1:3.5-1.0.1 +- Add doc sub package + * Wed Dec 20 2023 Lichen Liu - 1:3.5-1 - Rebase to upstream 3.5 -- Gitee From 0c15ba32d432144facac5f13e59d119ac7316808 Mon Sep 17 00:00:00 2001 From: Liwei Ge Date: Wed, 19 Oct 2022 09:49:12 +0800 Subject: [PATCH 3/5] spec: enable loongarch64 support --- dmidecode.spec | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/dmidecode.spec b/dmidecode.spec index e29825b..5273ffb 100644 --- a/dmidecode.spec +++ b/dmidecode.spec @@ -1,4 +1,4 @@ -%define anolis_release .0.1 +%define anolis_release .0.2 Summary: Tool to analyse BIOS DMI data Name: dmidecode Version: 3.5 @@ -13,7 +13,7 @@ Patch0: 0001-Consistently-use-read_file-when-reading-from-a-dump-.patch BuildRequires: gcc make Requires: glibc Provides: /usr/sbin/dmidecode -ExclusiveArch: %{ix86} x86_64 ia64 aarch64 +ExclusiveArch: %{ix86} x86_64 ia64 aarch64 loongarch64 %package doc Summary: Documents for %{name} @@ -47,7 +47,7 @@ make %{?_smp_mflags} DESTDIR=%{buildroot} prefix=%{_prefix} install-bin install- %{!?_licensedir:%global license %%doc} %license LICENSE %{_sbindir}/dmidecode -%ifnarch ia64 aarch64 +%ifnarch ia64 aarch64 loongarch64 %{_sbindir}/vpddecode %{_sbindir}/ownership %{_sbindir}/biosdecode @@ -60,6 +60,8 @@ make %{?_smp_mflags} DESTDIR=%{buildroot} prefix=%{_prefix} install-bin install- %changelog * Wed Jul 10 2024 Bo Ren - 1:3.5-1.0.1 - Add doc sub package +- Enable loongarch64 support (geliwei@openanolis.org) + * Wed Dec 20 2023 Lichen Liu - 1:3.5-1 - Rebase to upstream 3.5 -- Gitee From d484f420ff8cfa209e465151fec0bcd87de689a0 Mon Sep 17 00:00:00 2001 From: wxiat Date: Fri, 25 Aug 2023 15:17:46 +0800 Subject: [PATCH 4/5] cherry-pick `add sw`. Signed-off-by: wxiat Signed-off-by: Weisson --- dmidecode.spec | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dmidecode.spec b/dmidecode.spec index 5273ffb..796bb6e 100644 --- a/dmidecode.spec +++ b/dmidecode.spec @@ -1,4 +1,4 @@ -%define anolis_release .0.2 +%define anolis_release .0.1 Summary: Tool to analyse BIOS DMI data Name: dmidecode Version: 3.5 @@ -13,7 +13,7 @@ Patch0: 0001-Consistently-use-read_file-when-reading-from-a-dump-.patch BuildRequires: gcc make Requires: glibc Provides: /usr/sbin/dmidecode -ExclusiveArch: %{ix86} x86_64 ia64 aarch64 loongarch64 +ExclusiveArch: %{ix86} x86_64 ia64 aarch64 loongarch64 sw_64 %package doc Summary: Documents for %{name} @@ -47,7 +47,7 @@ make %{?_smp_mflags} DESTDIR=%{buildroot} prefix=%{_prefix} install-bin install- %{!?_licensedir:%global license %%doc} %license LICENSE %{_sbindir}/dmidecode -%ifnarch ia64 aarch64 loongarch64 +%ifnarch ia64 aarch64 loongarch64 sw_64 %{_sbindir}/vpddecode %{_sbindir}/ownership %{_sbindir}/biosdecode @@ -61,6 +61,7 @@ make %{?_smp_mflags} DESTDIR=%{buildroot} prefix=%{_prefix} install-bin install- * Wed Jul 10 2024 Bo Ren - 1:3.5-1.0.1 - Add doc sub package - Enable loongarch64 support (geliwei@openanolis.org) +- cherry-pick `add sw arch`. (nijie@wxiat.com) * Wed Dec 20 2023 Lichen Liu - 1:3.5-1 -- Gitee From 70bc6f5c06dbc44ccb860f47006e6117d2529060 Mon Sep 17 00:00:00 2001 From: wangkaiqiang Date: Tue, 14 May 2024 14:47:12 +0800 Subject: [PATCH 5/5] dmidecode Add processor support from SMBIOS 3.6.0 --- ...-processor-support-from-SMBIOS-3.6.0.patch | 66 +++++++++++++++++++ ...xpand-list-of-recognized-CPU-sockets.patch | 37 +++++++++++ dmidecode.spec | 4 ++ 3 files changed, 107 insertions(+) create mode 100644 0014-dmidecode-Add-processor-support-from-SMBIOS-3.6.0.patch create mode 100644 0015-dmidecode-Expand-list-of-recognized-CPU-sockets.patch diff --git a/0014-dmidecode-Add-processor-support-from-SMBIOS-3.6.0.patch b/0014-dmidecode-Add-processor-support-from-SMBIOS-3.6.0.patch new file mode 100644 index 0000000..ad7ef94 --- /dev/null +++ b/0014-dmidecode-Add-processor-support-from-SMBIOS-3.6.0.patch @@ -0,0 +1,66 @@ +From 1ea8341bb028fbcea3010df489cedee1bc6ce8d9 Mon Sep 17 00:00:00 2001 +From: wangkaiqiang +Date: Wed, 10 Jul 2024 15:56:26 +0800 +Subject: [PATCH] dmidecode: Add processor support from SMBIOS 3.6.0 + +Signed-off-by: wangkaiqiang +--- + dmidecode.c | 19 ++++++++++++++++--- + 1 file changed, 16 insertions(+), 3 deletions(-) + +diff --git a/dmidecode.c b/dmidecode.c +index 52ddbf1..de1e27d 100644 +--- a/dmidecode.c ++++ b/dmidecode.c +@@ -974,6 +974,7 @@ static const char *dmi_processor_family(const struct dmi_header *h, u16 ver) + + { 0x100, "ARMv7" }, + { 0x101, "ARMv8" }, ++ { 0x102, "ARMv9" }, + { 0x104, "SH-3" }, + { 0x105, "SH-4" }, + { 0x118, "ARM" }, +@@ -1073,7 +1074,7 @@ static enum cpuid_type dmi_get_cpuid_type(const struct dmi_header *h) + else + return cpuid_80486; + } +- else if ((type >= 0x100 && type <= 0x101) /* ARM */ ++ else if ((type >= 0x100 && type <= 0x102) /* ARM */ + || (type >= 0x118 && type <= 0x119)) /* ARM */ + { + /* +@@ -1415,10 +1416,19 @@ static const char *dmi_processor_upgrade(u8 code) + "Socket BGA1528", + "Socket LGA4189", + "Socket LGA1200", +- "Socket LGA4677" /* 0x3F */ ++ "Socket LGA4677", ++ "Socket LGA1700", ++ "Socket BGA1744", ++ "Socket BGA1781", ++ "Socket BGA1211", ++ "Socket BGA2422", ++ "Socket LGA1211", ++ "Socket LGA2422", ++ "Socket LGA5773", ++ "Socket BGA5773" /* 0x48 */ + }; + +- if (code >= 0x01 && code <= 0x3F) ++ if (code >= 0x01 && code <= 0x48) + return upgrade[code - 0x01]; + return out_of_spec; + } +@@ -4451,6 +4461,9 @@ static void dmi_decode(const struct dmi_header *h, u16 ver) + pr_attr("Thread Count", "%u", + h->length >= 0x30 && data[0x25] == 0xFF ? + WORD(data + 0x2E) : data[0x25]); ++ if (h->length >= 0x32 && WORD(data + 0x30) != 0) ++ pr_attr("Thread Enabled", "%u", ++ WORD(data + 0x30)); + dmi_processor_characteristics("Characteristics", + WORD(data + 0x26)); + break; +-- +2.43.0 + diff --git a/0015-dmidecode-Expand-list-of-recognized-CPU-sockets.patch b/0015-dmidecode-Expand-list-of-recognized-CPU-sockets.patch new file mode 100644 index 0000000..a8ad23c --- /dev/null +++ b/0015-dmidecode-Expand-list-of-recognized-CPU-sockets.patch @@ -0,0 +1,37 @@ +From 8507ddc337130465df62ee0ca9d9f6e8f5ed0efc Mon Sep 17 00:00:00 2001 +From: wangkaiqiang +Date: Wed, 8 May 2024 17:14:20 +0800 +Subject: [PATCH 3/3] dmidecode: Expand list of recognized CPU sockets + +--- + dmidecode.c | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +diff --git a/dmidecode.c b/dmidecode.c +index 0c6382d..4b2f6d2 100644 +--- a/dmidecode.c ++++ b/dmidecode.c +@@ -1369,10 +1369,18 @@ static const char *dmi_processor_upgrade(u8 code) + "Socket LGA1211", + "Socket LGA2422", + "Socket LGA5773", +- "Socket BGA5773" /* 0x48 */ ++ "Socket BGA5773", ++ "Socket AM5", ++ "Socket SP5", ++ "Socket SP6", ++ "Socket BGA883", ++ "Socket BGA1190", ++ "Socket BGA4129", ++ "Socket LGA4710", ++ "Socket LGA7529" /* 0x50 */ + }; + +- if (code >= 0x01 && code <= 0x48) ++ if (code >= 0x01 && code <= 0x50) + return upgrade[code - 0x01]; + return out_of_spec; + } +-- +2.31.1 + diff --git a/dmidecode.spec b/dmidecode.spec index 796bb6e..71f7a44 100644 --- a/dmidecode.spec +++ b/dmidecode.spec @@ -9,6 +9,8 @@ Source0: http://download.savannah.gnu.org/releases/%{name}/%{name}-%{vers URL: http://www.nongnu.org/dmidecode/ Patch0: 0001-Consistently-use-read_file-when-reading-from-a-dump-.patch +Patch13: 0014-dmidecode-Add-processor-support-from-SMBIOS-3.6.0.patch +Patch14: 0015-dmidecode-Expand-list-of-recognized-CPU-sockets.patch BuildRequires: gcc make Requires: glibc @@ -62,6 +64,8 @@ make %{?_smp_mflags} DESTDIR=%{buildroot} prefix=%{_prefix} install-bin install- - Add doc sub package - Enable loongarch64 support (geliwei@openanolis.org) - cherry-pick `add sw arch`. (nijie@wxiat.com) +- https://bugzilla.openanolis.cn/show_bug.cgi?id=8972 +- dmidecode Add processor support from SMBIOS 3.6.0 (wangkaiqiang@inspur.com) * Wed Dec 20 2023 Lichen Liu - 1:3.5-1 -- Gitee