diff options
-rw-r--r-- | meta-oe/recipes-devtools/pmtools/pmtools/pmtools-switch-to-dynamic-buffer-for-huge-ACPI-table.patch | 66 | ||||
-rw-r--r-- | meta-oe/recipes-devtools/pmtools/pmtools_git.bb | 4 |
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 @@ | |||
1 | From 03a886252f6555d6b0af76b654e76459642b89da Mon Sep 17 00:00:00 2001 | ||
2 | From: Yunguo Wei <yunguo.wei@windriver.com> | ||
3 | Date: Tue, 3 Dec 2013 18:12:50 +0800 | ||
4 | Subject: [PATCH] pmtools: switch to dynamic buffer for huge ACPI tables | ||
5 | |||
6 | For servers like Canoe Pass or Thunder Ridge, there are much more | ||
7 | entries in ACPI table, so original 1K buffer is insufficient. | ||
8 | |||
9 | We switch to dynamic buffer on this situation. | ||
10 | |||
11 | Signed-off-by: Yunguo Wei <yunguo.wei@windriver.com> | ||
12 | |||
13 | |||
14 | Upstream-Status: Pending | ||
15 | |||
16 | Signed-off-by: Kai Kang <kai.kang@windriver.com> | ||
17 | --- | ||
18 | madt/madt.c | 18 +++++++++++++++++- | ||
19 | 1 file changed, 17 insertions(+), 1 deletion(-) | ||
20 | |||
21 | diff --git a/madt/madt.c b/madt/madt.c | ||
22 | index 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 | -- | ||
65 | 1.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 | ||
7 | PV = "20130209+git${SRCPV}" | 7 | PV = "20130209+git${SRCPV}" |
8 | 8 | ||
9 | SRC_URI = "git://github.com/anyc/pmtools.git;protocol=https" | 9 | SRC_URI = "git://github.com/anyc/pmtools.git \ |
10 | file://pmtools-switch-to-dynamic-buffer-for-huge-ACPI-table.patch \ | ||
11 | " | ||
10 | SRCREV = "3ebe0e54c54061b4c627236cbe35d820de2e1168" | 12 | SRCREV = "3ebe0e54c54061b4c627236cbe35d820de2e1168" |
11 | 13 | ||
12 | COMPATIBLE_HOST = "(i.86|x86_64).*-linux" | 14 | COMPATIBLE_HOST = "(i.86|x86_64).*-linux" |