hc
2024-05-11 04dd17822334871b23ea2862f7798fb0e0007777
kernel/tools/power/acpi/os_specific/service_layers/oslinuxtbl.c
....@@ -3,7 +3,7 @@
33 *
44 * Module Name: oslinuxtbl - Linux OSL for obtaining ACPI tables
55 *
6
- * Copyright (C) 2000 - 2018, Intel Corp.
6
+ * Copyright (C) 2000 - 2020, Intel Corp.
77 *
88 *****************************************************************************/
99
....@@ -19,7 +19,7 @@
1919 typedef struct osl_table_info {
2020 struct osl_table_info *next;
2121 u32 instance;
22
- char signature[ACPI_NAME_SIZE];
22
+ char signature[ACPI_NAMESEG_SIZE];
2323
2424 } osl_table_info;
2525
....@@ -35,7 +35,7 @@
3535 static acpi_status
3636 osl_read_table_from_file(char *filename,
3737 acpi_size file_offset,
38
- char *signature, struct acpi_table_header **table);
38
+ struct acpi_table_header **table);
3939
4040 static acpi_status
4141 osl_map_table(acpi_size address,
....@@ -110,7 +110,7 @@
110110 *
111111 * RETURN: Status; Converted from errno.
112112 *
113
- * DESCRIPTION: Get last errno and conver it to acpi_status.
113
+ * DESCRIPTION: Get last errno and convert it to acpi_status.
114114 *
115115 *****************************************************************************/
116116
....@@ -286,14 +286,14 @@
286286 return (AE_NO_MEMORY);
287287 }
288288
289
- ACPI_MOVE_NAME(new_info->signature, signature);
289
+ ACPI_COPY_NAMESEG(new_info->signature, signature);
290290
291291 if (!gbl_table_list_head) {
292292 gbl_table_list_head = new_info;
293293 } else {
294294 next = gbl_table_list_head;
295295 while (1) {
296
- if (ACPI_COMPARE_NAME(next->signature, signature)) {
296
+ if (ACPI_COMPARE_NAMESEG(next->signature, signature)) {
297297 if (next->instance == instance) {
298298 found = TRUE;
299299 }
....@@ -782,11 +782,11 @@
782782
783783 /* Handle special tables whose addresses are not in RSDT/XSDT */
784784
785
- if (ACPI_COMPARE_NAME(signature, ACPI_RSDP_NAME) ||
786
- ACPI_COMPARE_NAME(signature, ACPI_SIG_RSDT) ||
787
- ACPI_COMPARE_NAME(signature, ACPI_SIG_XSDT) ||
788
- ACPI_COMPARE_NAME(signature, ACPI_SIG_DSDT) ||
789
- ACPI_COMPARE_NAME(signature, ACPI_SIG_FACS)) {
785
+ if (ACPI_COMPARE_NAMESEG(signature, ACPI_RSDP_NAME) ||
786
+ ACPI_COMPARE_NAMESEG(signature, ACPI_SIG_RSDT) ||
787
+ ACPI_COMPARE_NAMESEG(signature, ACPI_SIG_XSDT) ||
788
+ ACPI_COMPARE_NAMESEG(signature, ACPI_SIG_DSDT) ||
789
+ ACPI_COMPARE_NAMESEG(signature, ACPI_SIG_FACS)) {
790790
791791 find_next_instance:
792792
....@@ -797,7 +797,7 @@
797797 * careful about the FADT length and validate table addresses.
798798 * Note: The 64-bit addresses have priority.
799799 */
800
- if (ACPI_COMPARE_NAME(signature, ACPI_SIG_DSDT)) {
800
+ if (ACPI_COMPARE_NAMESEG(signature, ACPI_SIG_DSDT)) {
801801 if (current_instance < 2) {
802802 if ((gbl_fadt->header.length >=
803803 MIN_FADT_FOR_XDSDT) && gbl_fadt->Xdsdt
....@@ -815,7 +815,7 @@
815815 dsdt;
816816 }
817817 }
818
- } else if (ACPI_COMPARE_NAME(signature, ACPI_SIG_FACS)) {
818
+ } else if (ACPI_COMPARE_NAMESEG(signature, ACPI_SIG_FACS)) {
819819 if (current_instance < 2) {
820820 if ((gbl_fadt->header.length >=
821821 MIN_FADT_FOR_XFACS) && gbl_fadt->Xfacs
....@@ -833,7 +833,7 @@
833833 facs;
834834 }
835835 }
836
- } else if (ACPI_COMPARE_NAME(signature, ACPI_SIG_XSDT)) {
836
+ } else if (ACPI_COMPARE_NAMESEG(signature, ACPI_SIG_XSDT)) {
837837 if (!gbl_revision) {
838838 return (AE_BAD_SIGNATURE);
839839 }
....@@ -842,7 +842,7 @@
842842 (acpi_physical_address)gbl_rsdp.
843843 xsdt_physical_address;
844844 }
845
- } else if (ACPI_COMPARE_NAME(signature, ACPI_SIG_RSDT)) {
845
+ } else if (ACPI_COMPARE_NAMESEG(signature, ACPI_SIG_RSDT)) {
846846 if (current_instance == 0) {
847847 table_address =
848848 (acpi_physical_address)gbl_rsdp.
....@@ -931,7 +931,7 @@
931931
932932 /* Does this table match the requested signature? */
933933
934
- if (!ACPI_COMPARE_NAME
934
+ if (!ACPI_COMPARE_NAMESEG
935935 (mapped_table->signature, signature)) {
936936 osl_unmap_table(mapped_table);
937937 mapped_table = NULL;
....@@ -995,7 +995,7 @@
995995 {
996996 void *table_dir;
997997 u32 instance;
998
- char temp_name[ACPI_NAME_SIZE];
998
+ char temp_name[ACPI_NAMESEG_SIZE];
999999 char *filename;
10001000 acpi_status status = AE_OK;
10011001
....@@ -1086,8 +1086,8 @@
10861086 return (AE_BAD_SIGNATURE);
10871087 }
10881088 } else
1089
- if (!ACPI_COMPARE_NAME(signature, mapped_table->signature))
1090
- {
1089
+ if (!ACPI_COMPARE_NAMESEG
1090
+ (signature, mapped_table->signature)) {
10911091 acpi_os_unmap_memory(mapped_table,
10921092 sizeof(struct acpi_table_header));
10931093 return (AE_BAD_SIGNATURE);
....@@ -1158,15 +1158,15 @@
11581158
11591159 /* Ignore meaningless files */
11601160
1161
- if (strlen(filename) < ACPI_NAME_SIZE) {
1161
+ if (strlen(filename) < ACPI_NAMESEG_SIZE) {
11621162 return (AE_BAD_SIGNATURE);
11631163 }
11641164
11651165 /* Extract instance number */
11661166
1167
- if (isdigit((int)filename[ACPI_NAME_SIZE])) {
1168
- sscanf(&filename[ACPI_NAME_SIZE], "%u", instance);
1169
- } else if (strlen(filename) != ACPI_NAME_SIZE) {
1167
+ if (isdigit((int)filename[ACPI_NAMESEG_SIZE])) {
1168
+ sscanf(&filename[ACPI_NAMESEG_SIZE], "%u", instance);
1169
+ } else if (strlen(filename) != ACPI_NAMESEG_SIZE) {
11701170 return (AE_BAD_SIGNATURE);
11711171 } else {
11721172 *instance = 0;
....@@ -1174,7 +1174,7 @@
11741174
11751175 /* Extract signature */
11761176
1177
- ACPI_MOVE_NAME(signature, filename);
1177
+ ACPI_COPY_NAMESEG(signature, filename);
11781178 return (AE_OK);
11791179 }
11801180
....@@ -1184,8 +1184,6 @@
11841184 *
11851185 * PARAMETERS: filename - File that contains the desired table
11861186 * file_offset - Offset of the table in file
1187
- * signature - Optional ACPI Signature for desired table.
1188
- * A null terminated 4-character string.
11891187 * table - Where a pointer to the table is returned
11901188 *
11911189 * RETURN: Status; Table buffer is returned if AE_OK.
....@@ -1197,7 +1195,7 @@
11971195 static acpi_status
11981196 osl_read_table_from_file(char *filename,
11991197 acpi_size file_offset,
1200
- char *signature, struct acpi_table_header **table)
1198
+ struct acpi_table_header **table)
12011199 {
12021200 FILE *table_file;
12031201 struct acpi_table_header header;
....@@ -1225,6 +1223,8 @@
12251223 goto exit;
12261224 }
12271225
1226
+#ifdef ACPI_OBSOLETE_FUNCTIONS
1227
+
12281228 /* If signature is specified, it must match the table */
12291229
12301230 if (signature) {
....@@ -1236,7 +1236,7 @@
12361236 status = AE_BAD_SIGNATURE;
12371237 goto exit;
12381238 }
1239
- } else if (!ACPI_COMPARE_NAME(signature, header.signature)) {
1239
+ } else if (!ACPI_COMPARE_NAMESEG(signature, header.signature)) {
12401240 fprintf(stderr,
12411241 "Incorrect signature: Expecting %4.4s, found %4.4s\n",
12421242 signature, header.signature);
....@@ -1244,6 +1244,7 @@
12441244 goto exit;
12451245 }
12461246 }
1247
+#endif
12471248
12481249 table_length = ap_get_table_length(&header);
12491250 if (table_length == 0) {
....@@ -1311,7 +1312,7 @@
13111312 {
13121313 void *table_dir;
13131314 u32 current_instance = 0;
1314
- char temp_name[ACPI_NAME_SIZE];
1315
+ char temp_name[ACPI_NAMESEG_SIZE];
13151316 char table_filename[PATH_MAX];
13161317 char *filename;
13171318 acpi_status status;
....@@ -1329,7 +1330,7 @@
13291330
13301331 /* Ignore meaningless files */
13311332
1332
- if (!ACPI_COMPARE_NAME(filename, signature)) {
1333
+ if (!ACPI_COMPARE_NAMESEG(filename, signature)) {
13331334 continue;
13341335 }
13351336
....@@ -1366,7 +1367,7 @@
13661367 /* There is no physical address saved for customized tables, use zero */
13671368
13681369 *address = 0;
1369
- status = osl_read_table_from_file(table_filename, 0, NULL, table);
1370
+ status = osl_read_table_from_file(table_filename, 0, table);
13701371
13711372 return (status);
13721373 }