summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta-oe/recipes-devtools/pmtools/pmtools/pmtools-switch-to-dynamic-buffer-for-huge-ACPI-table.patch66
-rw-r--r--meta-oe/recipes-devtools/pmtools/pmtools_git.bb4
2 files changed, 69 insertions, 1 deletions
diff --git a/meta-oe/recipes-devtools/pmtools/pmtools/pmtools-switch-to-dynamic-buffer-for-huge-ACPI-table.patch b/meta-oe/recipes-devtools/pmtools/pmtools/pmtools-switch-to-dynamic-buffer-for-huge-ACPI-table.patch
new file mode 100644
index 000000000..7ccdab0f2
--- /dev/null
+++ b/meta-oe/recipes-devtools/pmtools/pmtools/pmtools-switch-to-dynamic-buffer-for-huge-ACPI-table.patch
@@ -0,0 +1,66 @@
1From 03a886252f6555d6b0af76b654e76459642b89da Mon Sep 17 00:00:00 2001
2From: Yunguo Wei <yunguo.wei@windriver.com>
3Date: Tue, 3 Dec 2013 18:12:50 +0800
4Subject: [PATCH] pmtools: switch to dynamic buffer for huge ACPI tables
5
6For servers like Canoe Pass or Thunder Ridge, there are much more
7entries in ACPI table, so original 1K buffer is insufficient.
8
9We switch to dynamic buffer on this situation.
10
11Signed-off-by: Yunguo Wei <yunguo.wei@windriver.com>
12
13
14Upstream-Status: Pending
15
16Signed-off-by: Kai Kang <kai.kang@windriver.com>
17---
18 madt/madt.c | 18 +++++++++++++++++-
19 1 file changed, 17 insertions(+), 1 deletion(-)
20
21diff --git a/madt/madt.c b/madt/madt.c
22index aed965c..8770cd5 100644
23--- a/madt/madt.c
24+++ b/madt/madt.c
25@@ -51,7 +51,9 @@ get_next_entry(acpi_table_entry_header * entry_header)
26 return retval;
27 }
28
29-u8 buffer[1024];
30+
31+u8 buf[1024];
32+u8 *buffer = buf;
33
34 main()
35 {
36@@ -75,6 +77,17 @@ main()
37
38 if (verbose) printf("header.length %d\n", madt_header->header.length);
39
40+ /* if 1K buffer is insufficient for acpi table, switch to a larger memory buffer */
41+ if(expected_length > sizeof(buf)) {
42+ buffer = malloc(expected_length);
43+ if (!buffer) {
44+ perror("malloc");
45+ exit(1);
46+ }
47+ memset(buffer, 0, expected_length);
48+ memcpy(buffer, buf, sizeof(struct acpi_table_madt));
49+ }
50+
51 acpi_table_print((void*)&(buffer[bytes_read]), 0);
52
53 bytes_read = sizeof(struct acpi_table_madt);
54@@ -118,6 +131,9 @@ done:
55 printf("Checksum 0x%x != 0; 0x%x in header ERROR\n", csum,
56 madt_header->header.checksum);
57
58+ if(buffer != buf)
59+ free(buffer);
60+
61 return 0;
62 }
63
64--
651.8.1.2
66
diff --git a/meta-oe/recipes-devtools/pmtools/pmtools_git.bb b/meta-oe/recipes-devtools/pmtools/pmtools_git.bb
index 602da5e20..22ed8e2ff 100644
--- a/meta-oe/recipes-devtools/pmtools/pmtools_git.bb
+++ b/meta-oe/recipes-devtools/pmtools/pmtools_git.bb
@@ -6,7 +6,9 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=0636e73ff0215e8d672dc4c32c317bb3"
6 6
7PV = "20130209+git${SRCPV}" 7PV = "20130209+git${SRCPV}"
8 8
9SRC_URI = "git://github.com/anyc/pmtools.git;protocol=https" 9SRC_URI = "git://github.com/anyc/pmtools.git \
10 file://pmtools-switch-to-dynamic-buffer-for-huge-ACPI-table.patch \
11"
10SRCREV = "3ebe0e54c54061b4c627236cbe35d820de2e1168" 12SRCREV = "3ebe0e54c54061b4c627236cbe35d820de2e1168"
11 13
12COMPATIBLE_HOST = "(i.86|x86_64).*-linux" 14COMPATIBLE_HOST = "(i.86|x86_64).*-linux"