aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-08-05 16:50:12 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-08-05 16:50:12 -0400
commit8b80c0f187d8711fede71b7bd6fb80cb76bb8be9 (patch)
tree1f7582124a4dc42eded38668f393db16ddd7d658 /drivers
parent49c68fd448568e79598b159efc09a7864bc59ede (diff)
parent796ca778585d833023c18e1815b2e30a2d2f00fd (diff)
Merge branch 'acpica'
* acpica: ACPICA: Update version to 20140724. ACPICA: ACPI 5.1: Update for PCCT table changes. ACPICA/ARM: ACPI 5.1: Update for GTDT table changes. ACPICA/ARM: ACPI 5.1: Update for MADT changes. ACPICA/ARM: ACPI 5.1: Update for FADT changes. ACPICA: ACPI 5.1: Support for the _CCA predifined name. ACPICA: ACPI 5.1: New notify value for System Affinity Update. ACPICA: ACPI 5.1: Support for the _DSD predefined name. ACPICA: Debug object: Add current value of Timer() to debug line prefix. ACPICA: acpihelp: Add UUID support, restructure some existing files. ACPICA: Utilities: Fix local printf issue. ACPICA: Tables: Update for DMAR table changes. ACPICA: Remove some extraneous printf arguments. ACPICA: Update for comments/formatting. No functional changes. ACPICA: Disassembler: Add support for the ToUUID opererator (macro). ACPICA: Remove a redundant cast to acpi_size for ACPI_OFFSET() macro. ACPICA: Work around an ancient GCC bug.
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/acpica/Makefile8
-rw-r--r--drivers/acpi/acpica/aclocal.h18
-rw-r--r--drivers/acpi/acpica/acpredef.h16
-rw-r--r--drivers/acpi/acpica/acutils.h9
-rw-r--r--drivers/acpi/acpica/exdebug.c11
-rw-r--r--drivers/acpi/acpica/exdump.c6
-rw-r--r--drivers/acpi/acpica/exfield.c22
-rw-r--r--drivers/acpi/acpica/utdecode.c32
-rw-r--r--drivers/acpi/acpica/utfileio.c3
-rw-r--r--drivers/acpi/acpica/uthex.c100
-rw-r--r--drivers/acpi/acpica/utprint.c9
-rw-r--r--drivers/acpi/acpica/utuuid.c96
-rw-r--r--drivers/iommu/dmar.c28
13 files changed, 286 insertions, 72 deletions
diff --git a/drivers/acpi/acpica/Makefile b/drivers/acpi/acpica/Makefile
index 4be4cc94572d..c1a963581dc0 100644
--- a/drivers/acpi/acpica/Makefile
+++ b/drivers/acpi/acpica/Makefile
@@ -157,6 +157,7 @@ acpi-y += \
157 uterror.o \ 157 uterror.o \
158 uteval.o \ 158 uteval.o \
159 utglobal.o \ 159 utglobal.o \
160 uthex.o \
160 utids.o \ 161 utids.o \
161 utinit.o \ 162 utinit.o \
162 utlock.o \ 163 utlock.o \
@@ -175,5 +176,10 @@ acpi-y += \
175 utxferror.o \ 176 utxferror.o \
176 utxfmutex.o 177 utxfmutex.o
177 178
178acpi-$(ACPI_FUTURE_USAGE) += utfileio.o utprint.o uttrack.o utcache.o 179acpi-$(ACPI_FUTURE_USAGE) += \
180 utcache.o \
181 utfileio.o \
182 utprint.o \
183 uttrack.o \
184 utuuid.o
179 185
diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h
index 91f801a2e689..1f9aba5fb81f 100644
--- a/drivers/acpi/acpica/aclocal.h
+++ b/drivers/acpi/acpica/aclocal.h
@@ -730,12 +730,13 @@ union acpi_parse_value {
730#define ACPI_DASM_STRING 0x02 /* Buffer is a ASCII string */ 730#define ACPI_DASM_STRING 0x02 /* Buffer is a ASCII string */
731#define ACPI_DASM_UNICODE 0x03 /* Buffer is a Unicode string */ 731#define ACPI_DASM_UNICODE 0x03 /* Buffer is a Unicode string */
732#define ACPI_DASM_PLD_METHOD 0x04 /* Buffer is a _PLD method bit-packed buffer */ 732#define ACPI_DASM_PLD_METHOD 0x04 /* Buffer is a _PLD method bit-packed buffer */
733#define ACPI_DASM_EISAID 0x05 /* Integer is an EISAID */ 733#define ACPI_DASM_UUID 0x05 /* Buffer is a UUID/GUID */
734#define ACPI_DASM_MATCHOP 0x06 /* Parent opcode is a Match() operator */ 734#define ACPI_DASM_EISAID 0x06 /* Integer is an EISAID */
735#define ACPI_DASM_LNOT_PREFIX 0x07 /* Start of a Lnot_equal (etc.) pair of opcodes */ 735#define ACPI_DASM_MATCHOP 0x07 /* Parent opcode is a Match() operator */
736#define ACPI_DASM_LNOT_SUFFIX 0x08 /* End of a Lnot_equal (etc.) pair of opcodes */ 736#define ACPI_DASM_LNOT_PREFIX 0x08 /* Start of a Lnot_equal (etc.) pair of opcodes */
737#define ACPI_DASM_HID_STRING 0x09 /* String is a _HID or _CID */ 737#define ACPI_DASM_LNOT_SUFFIX 0x09 /* End of a Lnot_equal (etc.) pair of opcodes */
738#define ACPI_DASM_IGNORE 0x0A /* Not used at this time */ 738#define ACPI_DASM_HID_STRING 0x0A /* String is a _HID or _CID */
739#define ACPI_DASM_IGNORE 0x0B /* Not used at this time */
739 740
740/* 741/*
741 * Generic operation (for example: If, While, Store) 742 * Generic operation (for example: If, While, Store)
@@ -1154,4 +1155,9 @@ struct ah_device_id {
1154 char *description; 1155 char *description;
1155}; 1156};
1156 1157
1158struct ah_uuid {
1159 char *description;
1160 char *string;
1161};
1162
1157#endif /* __ACLOCAL_H__ */ 1163#endif /* __ACLOCAL_H__ */
diff --git a/drivers/acpi/acpica/acpredef.h b/drivers/acpi/acpica/acpredef.h
index bd08817cafd8..bd3908d26c4f 100644
--- a/drivers/acpi/acpica/acpredef.h
+++ b/drivers/acpi/acpica/acpredef.h
@@ -105,6 +105,11 @@
105 * count = 0 (optional) 105 * count = 0 (optional)
106 * (Used for _DLM) 106 * (Used for _DLM)
107 * 107 *
108 * ACPI_PTYPE2_UUID_PAIR: Each subpackage is preceded by a UUID Buffer. The UUID
109 * defines the format of the package. Zero-length parent package is
110 * allowed.
111 * (Used for _DSD)
112 *
108 *****************************************************************************/ 113 *****************************************************************************/
109 114
110enum acpi_return_package_types { 115enum acpi_return_package_types {
@@ -117,7 +122,8 @@ enum acpi_return_package_types {
117 ACPI_PTYPE2_FIXED = 7, 122 ACPI_PTYPE2_FIXED = 7,
118 ACPI_PTYPE2_MIN = 8, 123 ACPI_PTYPE2_MIN = 8,
119 ACPI_PTYPE2_REV_FIXED = 9, 124 ACPI_PTYPE2_REV_FIXED = 9,
120 ACPI_PTYPE2_FIX_VAR = 10 125 ACPI_PTYPE2_FIX_VAR = 10,
126 ACPI_PTYPE2_UUID_PAIR = 11
121}; 127};
122 128
123/* Support macros for users of the predefined info table */ 129/* Support macros for users of the predefined info table */
@@ -364,6 +370,9 @@ const union acpi_predefined_info acpi_gbl_predefined_methods[] = {
364 {{"_CBA", METHOD_0ARGS, 370 {{"_CBA", METHOD_0ARGS,
365 METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, /* See PCI firmware spec 3.0 */ 371 METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, /* See PCI firmware spec 3.0 */
366 372
373 {{"_CCA", METHOD_0ARGS,
374 METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, /* ACPI 5.1 */
375
367 {{"_CDM", METHOD_0ARGS, 376 {{"_CDM", METHOD_0ARGS,
368 METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, 377 METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
369 378
@@ -436,6 +445,11 @@ const union acpi_predefined_info acpi_gbl_predefined_methods[] = {
436 {{"_DOS", METHOD_1ARGS(ACPI_TYPE_INTEGER), 445 {{"_DOS", METHOD_1ARGS(ACPI_TYPE_INTEGER),
437 METHOD_NO_RETURN_VALUE}}, 446 METHOD_NO_RETURN_VALUE}},
438 447
448 {{"_DSD", METHOD_0ARGS,
449 METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each: 1 Buf, 1 Pkg */
450 PACKAGE_INFO(ACPI_PTYPE2_UUID_PAIR, ACPI_RTYPE_BUFFER, 1,
451 ACPI_RTYPE_PACKAGE, 1, 0),
452
439 {{"_DSM", 453 {{"_DSM",
440 METHOD_4ARGS(ACPI_TYPE_BUFFER, ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER, 454 METHOD_4ARGS(ACPI_TYPE_BUFFER, ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER,
441 ACPI_TYPE_PACKAGE), 455 ACPI_TYPE_PACKAGE),
diff --git a/drivers/acpi/acpica/acutils.h b/drivers/acpi/acpica/acutils.h
index ed614f4b2182..486d342e74b6 100644
--- a/drivers/acpi/acpica/acutils.h
+++ b/drivers/acpi/acpica/acutils.h
@@ -194,6 +194,8 @@ char *acpi_ut_get_event_name(u32 event_id);
194 194
195char acpi_ut_hex_to_ascii_char(u64 integer, u32 position); 195char acpi_ut_hex_to_ascii_char(u64 integer, u32 position);
196 196
197u8 acpi_ut_ascii_char_to_hex(int hex_char);
198
197u8 acpi_ut_valid_object_type(acpi_object_type type); 199u8 acpi_ut_valid_object_type(acpi_object_type type);
198 200
199/* 201/*
@@ -759,6 +761,8 @@ const struct ah_predefined_name *acpi_ah_match_predefined_name(char *nameseg);
759 761
760const struct ah_device_id *acpi_ah_match_hardware_id(char *hid); 762const struct ah_device_id *acpi_ah_match_hardware_id(char *hid);
761 763
764const char *acpi_ah_match_uuid(u8 *data);
765
762/* 766/*
763 * utprint - printf/vprintf output functions 767 * utprint - printf/vprintf output functions
764 */ 768 */
@@ -778,4 +782,9 @@ int acpi_ut_file_vprintf(ACPI_FILE file, const char *format, va_list args);
778int acpi_ut_file_printf(ACPI_FILE file, const char *format, ...); 782int acpi_ut_file_printf(ACPI_FILE file, const char *format, ...);
779#endif 783#endif
780 784
785/*
786 * utuuid -- UUID support functions
787 */
788void acpi_ut_convert_string_to_uuid(char *in_string, u8 *uuid_buffer);
789
781#endif /* _ACUTILS_H */ 790#endif /* _ACUTILS_H */
diff --git a/drivers/acpi/acpica/exdebug.c b/drivers/acpi/acpica/exdebug.c
index 4cfc3d3b5c97..6fbfad47518c 100644
--- a/drivers/acpi/acpica/exdebug.c
+++ b/drivers/acpi/acpica/exdebug.c
@@ -75,6 +75,7 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc,
75 u32 level, u32 index) 75 u32 level, u32 index)
76{ 76{
77 u32 i; 77 u32 i;
78 u32 timer;
78 79
79 ACPI_FUNCTION_TRACE_PTR(ex_do_debug_object, source_desc); 80 ACPI_FUNCTION_TRACE_PTR(ex_do_debug_object, source_desc);
80 81
@@ -86,11 +87,19 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc,
86 } 87 }
87 88
88 /* 89 /*
90 * We will emit the current timer value (in microseconds) with each
91 * debug output. Only need the lower 26 bits. This allows for 67
92 * million microseconds or 67 seconds before rollover.
93 */
94 timer = ((u32)acpi_os_get_timer() / 10); /* (100 nanoseconds to microseconds) */
95 timer &= 0x03FFFFFF;
96
97 /*
89 * Print line header as long as we are not in the middle of an 98 * Print line header as long as we are not in the middle of an
90 * object display 99 * object display
91 */ 100 */
92 if (!((level > 0) && index == 0)) { 101 if (!((level > 0) && index == 0)) {
93 acpi_os_printf("[ACPI Debug] %*s", level, " "); 102 acpi_os_printf("[ACPI Debug %.8u] %*s", timer, level, " ");
94 } 103 }
95 104
96 /* Display the index for package output only */ 105 /* Display the index for package output only */
diff --git a/drivers/acpi/acpica/exdump.c b/drivers/acpi/acpica/exdump.c
index 925202acc3e4..0f23c3f2678e 100644
--- a/drivers/acpi/acpica/exdump.c
+++ b/drivers/acpi/acpica/exdump.c
@@ -494,7 +494,7 @@ acpi_ex_dump_object(union acpi_operand_object *obj_desc,
494 } 494 }
495 } 495 }
496 496
497 acpi_os_printf("\n", next); 497 acpi_os_printf("\n");
498 break; 498 break;
499 499
500 case ACPI_EXD_HDLR_LIST: 500 case ACPI_EXD_HDLR_LIST:
@@ -528,7 +528,7 @@ acpi_ex_dump_object(union acpi_operand_object *obj_desc,
528 } 528 }
529 } 529 }
530 530
531 acpi_os_printf("\n", next); 531 acpi_os_printf("\n");
532 break; 532 break;
533 533
534 case ACPI_EXD_RGN_LIST: 534 case ACPI_EXD_RGN_LIST:
@@ -562,7 +562,7 @@ acpi_ex_dump_object(union acpi_operand_object *obj_desc,
562 } 562 }
563 } 563 }
564 564
565 acpi_os_printf("\n", next); 565 acpi_os_printf("\n");
566 break; 566 break;
567 567
568 case ACPI_EXD_NODE: 568 case ACPI_EXD_NODE:
diff --git a/drivers/acpi/acpica/exfield.c b/drivers/acpi/acpica/exfield.c
index 1ff42c07b42b..6907ce0c704c 100644
--- a/drivers/acpi/acpica/exfield.c
+++ b/drivers/acpi/acpica/exfield.c
@@ -186,12 +186,11 @@ acpi_ex_read_data_from_field(struct acpi_walk_state * walk_state,
186 access_length); 186 access_length);
187 187
188 /* 188 /*
189 * Add additional 2 bytes for modeled generic_serial_bus data buffer: 189 * Add additional 2 bytes for the generic_serial_bus data buffer:
190 * typedef struct { 190 *
191 * BYTEStatus; // Byte 0 of the data buffer 191 * Status; (Byte 0 of the data buffer)
192 * BYTELength; // Byte 1 of the data buffer 192 * Length; (Byte 1 of the data buffer)
193 * BYTE[x-1]Data; // Bytes 2-x of the arbitrary length data buffer, 193 * Data[x-1]; (Bytes 2-x of the arbitrary length data buffer)
194 * }
195 */ 194 */
196 length += 2; 195 length += 2;
197 function = ACPI_READ | (accessor_type << 16); 196 function = ACPI_READ | (accessor_type << 16);
@@ -368,12 +367,11 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,
368 access_length); 367 access_length);
369 368
370 /* 369 /*
371 * Add additional 2 bytes for modeled generic_serial_bus data buffer: 370 * Add additional 2 bytes for the generic_serial_bus data buffer:
372 * typedef struct { 371 *
373 * BYTEStatus; // Byte 0 of the data buffer 372 * Status; (Byte 0 of the data buffer)
374 * BYTELength; // Byte 1 of the data buffer 373 * Length; (Byte 1 of the data buffer)
375 * BYTE[x-1]Data; // Bytes 2-x of the arbitrary length data buffer, 374 * Data[x-1]; (Bytes 2-x of the arbitrary length data buffer)
376 * }
377 */ 375 */
378 length += 2; 376 length += 2;
379 function = ACPI_WRITE | (accessor_type << 16); 377 function = ACPI_WRITE | (accessor_type << 16);
diff --git a/drivers/acpi/acpica/utdecode.c b/drivers/acpi/acpica/utdecode.c
index 90ec37c473c6..40e923e675fc 100644
--- a/drivers/acpi/acpica/utdecode.c
+++ b/drivers/acpi/acpica/utdecode.c
@@ -88,33 +88,6 @@ const u8 acpi_gbl_ns_properties[ACPI_NUM_NS_TYPES] = {
88 88
89/******************************************************************************* 89/*******************************************************************************
90 * 90 *
91 * FUNCTION: acpi_ut_hex_to_ascii_char
92 *
93 * PARAMETERS: integer - Contains the hex digit
94 * position - bit position of the digit within the
95 * integer (multiple of 4)
96 *
97 * RETURN: The converted Ascii character
98 *
99 * DESCRIPTION: Convert a hex digit to an Ascii character
100 *
101 ******************************************************************************/
102
103/* Hex to ASCII conversion table */
104
105static const char acpi_gbl_hex_to_ascii[] = {
106 '0', '1', '2', '3', '4', '5', '6', '7',
107 '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
108};
109
110char acpi_ut_hex_to_ascii_char(u64 integer, u32 position)
111{
112
113 return (acpi_gbl_hex_to_ascii[(integer >> position) & 0xF]);
114}
115
116/*******************************************************************************
117 *
118 * FUNCTION: acpi_ut_get_region_name 91 * FUNCTION: acpi_ut_get_region_name
119 * 92 *
120 * PARAMETERS: Space ID - ID for the region 93 * PARAMETERS: Space ID - ID for the region
@@ -475,7 +448,8 @@ static const char *acpi_gbl_generic_notify[ACPI_NOTIFY_MAX + 1] = {
475 /* 09 */ "Device PLD Check", 448 /* 09 */ "Device PLD Check",
476 /* 0A */ "Reserved", 449 /* 0A */ "Reserved",
477 /* 0B */ "System Locality Update", 450 /* 0B */ "System Locality Update",
478 /* 0C */ "Shutdown Request" 451 /* 0C */ "Shutdown Request",
452 /* 0D */ "System Resource Affinity Update"
479}; 453};
480 454
481static const char *acpi_gbl_device_notify[4] = { 455static const char *acpi_gbl_device_notify[4] = {
@@ -502,7 +476,7 @@ static const char *acpi_gbl_thermal_notify[4] = {
502const char *acpi_ut_get_notify_name(u32 notify_value, acpi_object_type type) 476const char *acpi_ut_get_notify_name(u32 notify_value, acpi_object_type type)
503{ 477{
504 478
505 /* 00 - 0C are common to all object types */ 479 /* 00 - 0D are common to all object types */
506 480
507 if (notify_value <= ACPI_NOTIFY_MAX) { 481 if (notify_value <= ACPI_NOTIFY_MAX) {
508 return (acpi_gbl_generic_notify[notify_value]); 482 return (acpi_gbl_generic_notify[notify_value]);
diff --git a/drivers/acpi/acpica/utfileio.c b/drivers/acpi/acpica/utfileio.c
index bdf9914733cb..4e263a8cc6f0 100644
--- a/drivers/acpi/acpica/utfileio.c
+++ b/drivers/acpi/acpica/utfileio.c
@@ -201,8 +201,7 @@ acpi_ut_read_table(FILE * fp,
201 status = fl_check_for_ascii(fp, NULL, FALSE); 201 status = fl_check_for_ascii(fp, NULL, FALSE);
202 if (ACPI_SUCCESS(status)) { 202 if (ACPI_SUCCESS(status)) {
203 acpi_os_printf 203 acpi_os_printf
204 ("File appears to be ASCII only, must be binary\n", 204 ("File appears to be ASCII only, must be binary\n");
205 table_header.length, file_size);
206 } 205 }
207#endif 206#endif
208 return (AE_BAD_HEADER); 207 return (AE_BAD_HEADER);
diff --git a/drivers/acpi/acpica/uthex.c b/drivers/acpi/acpica/uthex.c
new file mode 100644
index 000000000000..9afa9441b183
--- /dev/null
+++ b/drivers/acpi/acpica/uthex.c
@@ -0,0 +1,100 @@
1/******************************************************************************
2 *
3 * Module Name: uthex -- Hex/ASCII support functions
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2014, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#include <acpi/acpi.h>
45#include "accommon.h"
46
47#define _COMPONENT ACPI_COMPILER
48ACPI_MODULE_NAME("uthex")
49
50/* Hex to ASCII conversion table */
51static char acpi_gbl_hex_to_ascii[] = {
52 '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D',
53 'E', 'F'
54};
55
56/*******************************************************************************
57 *
58 * FUNCTION: acpi_ut_hex_to_ascii_char
59 *
60 * PARAMETERS: integer - Contains the hex digit
61 * position - bit position of the digit within the
62 * integer (multiple of 4)
63 *
64 * RETURN: The converted Ascii character
65 *
66 * DESCRIPTION: Convert a hex digit to an Ascii character
67 *
68 ******************************************************************************/
69
70char acpi_ut_hex_to_ascii_char(u64 integer, u32 position)
71{
72
73 return (acpi_gbl_hex_to_ascii[(integer >> position) & 0xF]);
74}
75
76/*******************************************************************************
77 *
78 * FUNCTION: acpi_ut_hex_char_to_value
79 *
80 * PARAMETERS: ascii_char - Hex character in Ascii
81 *
82 * RETURN: The binary value of the ascii/hex character
83 *
84 * DESCRIPTION: Perform ascii-to-hex translation
85 *
86 ******************************************************************************/
87
88u8 acpi_ut_ascii_char_to_hex(int hex_char)
89{
90
91 if (hex_char <= 0x39) {
92 return ((u8)(hex_char - 0x30));
93 }
94
95 if (hex_char <= 0x46) {
96 return ((u8)(hex_char - 0x37));
97 }
98
99 return ((u8)(hex_char - 0x57));
100}
diff --git a/drivers/acpi/acpica/utprint.c b/drivers/acpi/acpica/utprint.c
index 10311648f701..0ce3f5a0dd67 100644
--- a/drivers/acpi/acpica/utprint.c
+++ b/drivers/acpi/acpica/utprint.c
@@ -242,6 +242,7 @@ static char *acpi_ut_format_number(char *string,
242 u64 number, 242 u64 number,
243 u8 base, s32 width, s32 precision, u8 type) 243 u8 base, s32 width, s32 precision, u8 type)
244{ 244{
245 char *pos;
245 char sign; 246 char sign;
246 char zero; 247 char zero;
247 u8 need_prefix; 248 u8 need_prefix;
@@ -289,9 +290,8 @@ static char *acpi_ut_format_number(char *string,
289 290
290 /* Generate full string in reverse order */ 291 /* Generate full string in reverse order */
291 292
292 i = ACPI_PTR_DIFF(acpi_ut_put_number 293 pos = acpi_ut_put_number(reversed_string, number, base, upper);
293 (reversed_string, number, base, upper), 294 i = ACPI_PTR_DIFF(pos, reversed_string);
294 reversed_string);
295 295
296 /* Printing 100 using %2d gives "100", not "00" */ 296 /* Printing 100 using %2d gives "100", not "00" */
297 297
@@ -401,6 +401,7 @@ acpi_ut_vsnprintf(char *string,
401 401
402 /* Process width */ 402 /* Process width */
403 403
404 width = -1;
404 if (ACPI_IS_DIGIT(*format)) { 405 if (ACPI_IS_DIGIT(*format)) {
405 format = acpi_ut_scan_number(format, &number); 406 format = acpi_ut_scan_number(format, &number);
406 width = (s32) number; 407 width = (s32) number;
@@ -415,6 +416,7 @@ acpi_ut_vsnprintf(char *string,
415 416
416 /* Process precision */ 417 /* Process precision */
417 418
419 precision = -1;
418 if (*format == '.') { 420 if (*format == '.') {
419 ++format; 421 ++format;
420 if (ACPI_IS_DIGIT(*format)) { 422 if (ACPI_IS_DIGIT(*format)) {
@@ -431,6 +433,7 @@ acpi_ut_vsnprintf(char *string,
431 433
432 /* Process qualifier */ 434 /* Process qualifier */
433 435
436 qualifier = -1;
434 if (*format == 'h' || *format == 'l' || *format == 'L') { 437 if (*format == 'h' || *format == 'l' || *format == 'L') {
435 qualifier = *format; 438 qualifier = *format;
436 ++format; 439 ++format;
diff --git a/drivers/acpi/acpica/utuuid.c b/drivers/acpi/acpica/utuuid.c
new file mode 100644
index 000000000000..4dc33130f134
--- /dev/null
+++ b/drivers/acpi/acpica/utuuid.c
@@ -0,0 +1,96 @@
1/******************************************************************************
2 *
3 * Module Name: utuuid -- UUID support functions
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2014, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#include <acpi/acpi.h>
45#include "accommon.h"
46
47#define _COMPONENT ACPI_COMPILER
48ACPI_MODULE_NAME("utuuid")
49
50/*
51 * UUID support functions.
52 *
53 * This table is used to convert an input UUID ascii string to a 16 byte
54 * buffer and the reverse. The table maps a UUID buffer index 0-15 to
55 * the index within the 36-byte UUID string where the associated 2-byte
56 * hex value can be found.
57 *
58 * 36-byte UUID strings are of the form:
59 * aabbccdd-eeff-gghh-iijj-kkllmmnnoopp
60 * Where aa-pp are one byte hex numbers, made up of two hex digits
61 *
62 * Note: This table is basically the inverse of the string-to-offset table
63 * found in the ACPI spec in the description of the to_UUID macro.
64 */
65const u8 acpi_gbl_map_to_uuid_offset[UUID_BUFFER_LENGTH] = {
66 6, 4, 2, 0, 11, 9, 16, 14, 19, 21, 24, 26, 28, 30, 32, 34
67};
68
69/*******************************************************************************
70 *
71 * FUNCTION: acpi_ut_convert_string_to_uuid
72 *
73 * PARAMETERS: in_string - 36-byte formatted UUID string
74 * uuid_buffer - Where the 16-byte UUID buffer is returned
75 *
76 * RETURN: None. Output data is returned in the uuid_buffer
77 *
78 * DESCRIPTION: Convert a 36-byte formatted UUID string to 16-byte UUID buffer
79 *
80 ******************************************************************************/
81
82void acpi_ut_convert_string_to_uuid(char *in_string, u8 *uuid_buffer)
83{
84 u32 i;
85
86 for (i = 0; i < UUID_BUFFER_LENGTH; i++) {
87 uuid_buffer[i] =
88 (acpi_ut_ascii_char_to_hex
89 (in_string[acpi_gbl_map_to_uuid_offset[i]]) << 4);
90
91 uuid_buffer[i] |=
92 acpi_ut_ascii_char_to_hex(in_string
93 [acpi_gbl_map_to_uuid_offset[i] +
94 1]);
95 }
96}
diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c
index 9a4f05e5b23f..bbe33a81015c 100644
--- a/drivers/iommu/dmar.c
+++ b/drivers/iommu/dmar.c
@@ -84,7 +84,7 @@ void *dmar_alloc_dev_scope(void *start, void *end, int *cnt)
84 *cnt = 0; 84 *cnt = 0;
85 while (start < end) { 85 while (start < end) {
86 scope = start; 86 scope = start;
87 if (scope->entry_type == ACPI_DMAR_SCOPE_TYPE_ACPI || 87 if (scope->entry_type == ACPI_DMAR_SCOPE_TYPE_NAMESPACE ||
88 scope->entry_type == ACPI_DMAR_SCOPE_TYPE_ENDPOINT || 88 scope->entry_type == ACPI_DMAR_SCOPE_TYPE_ENDPOINT ||
89 scope->entry_type == ACPI_DMAR_SCOPE_TYPE_BRIDGE) 89 scope->entry_type == ACPI_DMAR_SCOPE_TYPE_BRIDGE)
90 (*cnt)++; 90 (*cnt)++;
@@ -380,7 +380,7 @@ static int __init dmar_parse_one_andd(struct acpi_dmar_header *header)
380 struct acpi_dmar_andd *andd = (void *)header; 380 struct acpi_dmar_andd *andd = (void *)header;
381 381
382 /* Check for NUL termination within the designated length */ 382 /* Check for NUL termination within the designated length */
383 if (strnlen(andd->object_name, header->length - 8) == header->length - 8) { 383 if (strnlen(andd->device_name, header->length - 8) == header->length - 8) {
384 WARN_TAINT(1, TAINT_FIRMWARE_WORKAROUND, 384 WARN_TAINT(1, TAINT_FIRMWARE_WORKAROUND,
385 "Your BIOS is broken; ANDD object name is not NUL-terminated\n" 385 "Your BIOS is broken; ANDD object name is not NUL-terminated\n"
386 "BIOS vendor: %s; Ver: %s; Product Version: %s\n", 386 "BIOS vendor: %s; Ver: %s; Product Version: %s\n",
@@ -390,7 +390,7 @@ static int __init dmar_parse_one_andd(struct acpi_dmar_header *header)
390 return -EINVAL; 390 return -EINVAL;
391 } 391 }
392 pr_info("ANDD device: %x name: %s\n", andd->device_number, 392 pr_info("ANDD device: %x name: %s\n", andd->device_number,
393 andd->object_name); 393 andd->device_name);
394 394
395 return 0; 395 return 0;
396} 396}
@@ -448,17 +448,17 @@ dmar_table_print_dmar_entry(struct acpi_dmar_header *header)
448 (unsigned long long)rmrr->base_address, 448 (unsigned long long)rmrr->base_address,
449 (unsigned long long)rmrr->end_address); 449 (unsigned long long)rmrr->end_address);
450 break; 450 break;
451 case ACPI_DMAR_TYPE_ATSR: 451 case ACPI_DMAR_TYPE_ROOT_ATS:
452 atsr = container_of(header, struct acpi_dmar_atsr, header); 452 atsr = container_of(header, struct acpi_dmar_atsr, header);
453 pr_info("ATSR flags: %#x\n", atsr->flags); 453 pr_info("ATSR flags: %#x\n", atsr->flags);
454 break; 454 break;
455 case ACPI_DMAR_HARDWARE_AFFINITY: 455 case ACPI_DMAR_TYPE_HARDWARE_AFFINITY:
456 rhsa = container_of(header, struct acpi_dmar_rhsa, header); 456 rhsa = container_of(header, struct acpi_dmar_rhsa, header);
457 pr_info("RHSA base: %#016Lx proximity domain: %#x\n", 457 pr_info("RHSA base: %#016Lx proximity domain: %#x\n",
458 (unsigned long long)rhsa->base_address, 458 (unsigned long long)rhsa->base_address,
459 rhsa->proximity_domain); 459 rhsa->proximity_domain);
460 break; 460 break;
461 case ACPI_DMAR_TYPE_ANDD: 461 case ACPI_DMAR_TYPE_NAMESPACE:
462 /* We don't print this here because we need to sanity-check 462 /* We don't print this here because we need to sanity-check
463 it first. So print it in dmar_parse_one_andd() instead. */ 463 it first. So print it in dmar_parse_one_andd() instead. */
464 break; 464 break;
@@ -539,15 +539,15 @@ parse_dmar_table(void)
539 case ACPI_DMAR_TYPE_RESERVED_MEMORY: 539 case ACPI_DMAR_TYPE_RESERVED_MEMORY:
540 ret = dmar_parse_one_rmrr(entry_header); 540 ret = dmar_parse_one_rmrr(entry_header);
541 break; 541 break;
542 case ACPI_DMAR_TYPE_ATSR: 542 case ACPI_DMAR_TYPE_ROOT_ATS:
543 ret = dmar_parse_one_atsr(entry_header); 543 ret = dmar_parse_one_atsr(entry_header);
544 break; 544 break;
545 case ACPI_DMAR_HARDWARE_AFFINITY: 545 case ACPI_DMAR_TYPE_HARDWARE_AFFINITY:
546#ifdef CONFIG_ACPI_NUMA 546#ifdef CONFIG_ACPI_NUMA
547 ret = dmar_parse_one_rhsa(entry_header); 547 ret = dmar_parse_one_rhsa(entry_header);
548#endif 548#endif
549 break; 549 break;
550 case ACPI_DMAR_TYPE_ANDD: 550 case ACPI_DMAR_TYPE_NAMESPACE:
551 ret = dmar_parse_one_andd(entry_header); 551 ret = dmar_parse_one_andd(entry_header);
552 break; 552 break;
553 default: 553 default:
@@ -631,7 +631,7 @@ static void __init dmar_acpi_insert_dev_scope(u8 device_number,
631 for (scope = (void *)(drhd + 1); 631 for (scope = (void *)(drhd + 1);
632 (unsigned long)scope < ((unsigned long)drhd) + drhd->header.length; 632 (unsigned long)scope < ((unsigned long)drhd) + drhd->header.length;
633 scope = ((void *)scope) + scope->length) { 633 scope = ((void *)scope) + scope->length) {
634 if (scope->entry_type != ACPI_DMAR_SCOPE_TYPE_ACPI) 634 if (scope->entry_type != ACPI_DMAR_SCOPE_TYPE_NAMESPACE)
635 continue; 635 continue;
636 if (scope->enumeration_id != device_number) 636 if (scope->enumeration_id != device_number)
637 continue; 637 continue;
@@ -666,21 +666,21 @@ static int __init dmar_acpi_dev_scope_init(void)
666 for (andd = (void *)dmar_tbl + sizeof(struct acpi_table_dmar); 666 for (andd = (void *)dmar_tbl + sizeof(struct acpi_table_dmar);
667 ((unsigned long)andd) < ((unsigned long)dmar_tbl) + dmar_tbl->length; 667 ((unsigned long)andd) < ((unsigned long)dmar_tbl) + dmar_tbl->length;
668 andd = ((void *)andd) + andd->header.length) { 668 andd = ((void *)andd) + andd->header.length) {
669 if (andd->header.type == ACPI_DMAR_TYPE_ANDD) { 669 if (andd->header.type == ACPI_DMAR_TYPE_NAMESPACE) {
670 acpi_handle h; 670 acpi_handle h;
671 struct acpi_device *adev; 671 struct acpi_device *adev;
672 672
673 if (!ACPI_SUCCESS(acpi_get_handle(ACPI_ROOT_OBJECT, 673 if (!ACPI_SUCCESS(acpi_get_handle(ACPI_ROOT_OBJECT,
674 andd->object_name, 674 andd->device_name,
675 &h))) { 675 &h))) {
676 pr_err("Failed to find handle for ACPI object %s\n", 676 pr_err("Failed to find handle for ACPI object %s\n",
677 andd->object_name); 677 andd->device_name);
678 continue; 678 continue;
679 } 679 }
680 acpi_bus_get_device(h, &adev); 680 acpi_bus_get_device(h, &adev);
681 if (!adev) { 681 if (!adev) {
682 pr_err("Failed to get device for ACPI object %s\n", 682 pr_err("Failed to get device for ACPI object %s\n",
683 andd->object_name); 683 andd->device_name);
684 continue; 684 continue;
685 } 685 }
686 dmar_acpi_insert_dev_scope(andd->device_number, adev); 686 dmar_acpi_insert_dev_scope(andd->device_number, adev);