Skip to content

Commit efcf945

Browse files
Erik Schmaussrafaeljw
authored andcommitted
ACPICA: utilities: add flag to only display data when dumping buffers
ACPICA commit fb18935fcf940c5854a055975c6b9ee31f0e1a5a Link: acpica/acpica@fb18935f Signed-off-by: Erik Schmauss <[email protected]> Signed-off-by: Bob Moore <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 1770093 commit efcf945

File tree

2 files changed

+34
-27
lines changed

2 files changed

+34
-27
lines changed

drivers/acpi/acpica/acutils.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,11 @@ struct acpi_pkg_info {
142142

143143
/* acpi_ut_dump_buffer */
144144

145-
#define DB_BYTE_DISPLAY 1
146-
#define DB_WORD_DISPLAY 2
147-
#define DB_DWORD_DISPLAY 4
148-
#define DB_QWORD_DISPLAY 8
145+
#define DB_BYTE_DISPLAY 0x01
146+
#define DB_WORD_DISPLAY 0x02
147+
#define DB_DWORD_DISPLAY 0x04
148+
#define DB_QWORD_DISPLAY 0x08
149+
#define DB_DISPLAY_DATA_ONLY 0x10
149150

150151
/*
151152
* utascii - ASCII utilities

drivers/acpi/acpica/utbuffer.c

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ void acpi_ut_dump_buffer(u8 *buffer, u32 count, u32 display, u32 base_offset)
3737
u32 j;
3838
u32 temp32;
3939
u8 buf_char;
40+
u32 display_data_only = display & DB_DISPLAY_DATA_ONLY;
4041

42+
display &= ~DB_DISPLAY_DATA_ONLY;
4143
if (!buffer) {
4244
acpi_os_printf("Null Buffer Pointer in DumpBuffer!\n");
4345
return;
@@ -53,7 +55,9 @@ void acpi_ut_dump_buffer(u8 *buffer, u32 count, u32 display, u32 base_offset)
5355

5456
/* Print current offset */
5557

56-
acpi_os_printf("%8.4X: ", (base_offset + i));
58+
if (!display_data_only) {
59+
acpi_os_printf("%8.4X: ", (base_offset + i));
60+
}
5761

5862
/* Print 16 hex chars */
5963

@@ -109,32 +113,34 @@ void acpi_ut_dump_buffer(u8 *buffer, u32 count, u32 display, u32 base_offset)
109113
* Print the ASCII equivalent characters but watch out for the bad
110114
* unprintable ones (printable chars are 0x20 through 0x7E)
111115
*/
112-
acpi_os_printf(" ");
113-
for (j = 0; j < 16; j++) {
114-
if (i + j >= count) {
115-
acpi_os_printf("\n");
116-
return;
116+
if (!display_data_only) {
117+
acpi_os_printf(" ");
118+
for (j = 0; j < 16; j++) {
119+
if (i + j >= count) {
120+
acpi_os_printf("\n");
121+
return;
122+
}
123+
124+
/*
125+
* Add comment characters so rest of line is ignored when
126+
* compiled
127+
*/
128+
if (j == 0) {
129+
acpi_os_printf("// ");
130+
}
131+
132+
buf_char = buffer[(acpi_size)i + j];
133+
if (isprint(buf_char)) {
134+
acpi_os_printf("%c", buf_char);
135+
} else {
136+
acpi_os_printf(".");
137+
}
117138
}
118139

119-
/*
120-
* Add comment characters so rest of line is ignored when
121-
* compiled
122-
*/
123-
if (j == 0) {
124-
acpi_os_printf("// ");
125-
}
140+
/* Done with that line. */
126141

127-
buf_char = buffer[(acpi_size)i + j];
128-
if (isprint(buf_char)) {
129-
acpi_os_printf("%c", buf_char);
130-
} else {
131-
acpi_os_printf(".");
132-
}
142+
acpi_os_printf("\n");
133143
}
134-
135-
/* Done with that line. */
136-
137-
acpi_os_printf("\n");
138144
i += 16;
139145
}
140146

0 commit comments

Comments
 (0)