.. | .. |
---|
3 | 3 | * |
---|
4 | 4 | * Module Name: oslinuxtbl - Linux OSL for obtaining ACPI tables |
---|
5 | 5 | * |
---|
6 | | - * Copyright (C) 2000 - 2018, Intel Corp. |
---|
| 6 | + * Copyright (C) 2000 - 2020, Intel Corp. |
---|
7 | 7 | * |
---|
8 | 8 | *****************************************************************************/ |
---|
9 | 9 | |
---|
.. | .. |
---|
19 | 19 | typedef struct osl_table_info { |
---|
20 | 20 | struct osl_table_info *next; |
---|
21 | 21 | u32 instance; |
---|
22 | | - char signature[ACPI_NAME_SIZE]; |
---|
| 22 | + char signature[ACPI_NAMESEG_SIZE]; |
---|
23 | 23 | |
---|
24 | 24 | } osl_table_info; |
---|
25 | 25 | |
---|
.. | .. |
---|
35 | 35 | static acpi_status |
---|
36 | 36 | osl_read_table_from_file(char *filename, |
---|
37 | 37 | acpi_size file_offset, |
---|
38 | | - char *signature, struct acpi_table_header **table); |
---|
| 38 | + struct acpi_table_header **table); |
---|
39 | 39 | |
---|
40 | 40 | static acpi_status |
---|
41 | 41 | osl_map_table(acpi_size address, |
---|
.. | .. |
---|
110 | 110 | * |
---|
111 | 111 | * RETURN: Status; Converted from errno. |
---|
112 | 112 | * |
---|
113 | | - * DESCRIPTION: Get last errno and conver it to acpi_status. |
---|
| 113 | + * DESCRIPTION: Get last errno and convert it to acpi_status. |
---|
114 | 114 | * |
---|
115 | 115 | *****************************************************************************/ |
---|
116 | 116 | |
---|
.. | .. |
---|
286 | 286 | return (AE_NO_MEMORY); |
---|
287 | 287 | } |
---|
288 | 288 | |
---|
289 | | - ACPI_MOVE_NAME(new_info->signature, signature); |
---|
| 289 | + ACPI_COPY_NAMESEG(new_info->signature, signature); |
---|
290 | 290 | |
---|
291 | 291 | if (!gbl_table_list_head) { |
---|
292 | 292 | gbl_table_list_head = new_info; |
---|
293 | 293 | } else { |
---|
294 | 294 | next = gbl_table_list_head; |
---|
295 | 295 | while (1) { |
---|
296 | | - if (ACPI_COMPARE_NAME(next->signature, signature)) { |
---|
| 296 | + if (ACPI_COMPARE_NAMESEG(next->signature, signature)) { |
---|
297 | 297 | if (next->instance == instance) { |
---|
298 | 298 | found = TRUE; |
---|
299 | 299 | } |
---|
.. | .. |
---|
782 | 782 | |
---|
783 | 783 | /* Handle special tables whose addresses are not in RSDT/XSDT */ |
---|
784 | 784 | |
---|
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)) { |
---|
790 | 790 | |
---|
791 | 791 | find_next_instance: |
---|
792 | 792 | |
---|
.. | .. |
---|
797 | 797 | * careful about the FADT length and validate table addresses. |
---|
798 | 798 | * Note: The 64-bit addresses have priority. |
---|
799 | 799 | */ |
---|
800 | | - if (ACPI_COMPARE_NAME(signature, ACPI_SIG_DSDT)) { |
---|
| 800 | + if (ACPI_COMPARE_NAMESEG(signature, ACPI_SIG_DSDT)) { |
---|
801 | 801 | if (current_instance < 2) { |
---|
802 | 802 | if ((gbl_fadt->header.length >= |
---|
803 | 803 | MIN_FADT_FOR_XDSDT) && gbl_fadt->Xdsdt |
---|
.. | .. |
---|
815 | 815 | dsdt; |
---|
816 | 816 | } |
---|
817 | 817 | } |
---|
818 | | - } else if (ACPI_COMPARE_NAME(signature, ACPI_SIG_FACS)) { |
---|
| 818 | + } else if (ACPI_COMPARE_NAMESEG(signature, ACPI_SIG_FACS)) { |
---|
819 | 819 | if (current_instance < 2) { |
---|
820 | 820 | if ((gbl_fadt->header.length >= |
---|
821 | 821 | MIN_FADT_FOR_XFACS) && gbl_fadt->Xfacs |
---|
.. | .. |
---|
833 | 833 | facs; |
---|
834 | 834 | } |
---|
835 | 835 | } |
---|
836 | | - } else if (ACPI_COMPARE_NAME(signature, ACPI_SIG_XSDT)) { |
---|
| 836 | + } else if (ACPI_COMPARE_NAMESEG(signature, ACPI_SIG_XSDT)) { |
---|
837 | 837 | if (!gbl_revision) { |
---|
838 | 838 | return (AE_BAD_SIGNATURE); |
---|
839 | 839 | } |
---|
.. | .. |
---|
842 | 842 | (acpi_physical_address)gbl_rsdp. |
---|
843 | 843 | xsdt_physical_address; |
---|
844 | 844 | } |
---|
845 | | - } else if (ACPI_COMPARE_NAME(signature, ACPI_SIG_RSDT)) { |
---|
| 845 | + } else if (ACPI_COMPARE_NAMESEG(signature, ACPI_SIG_RSDT)) { |
---|
846 | 846 | if (current_instance == 0) { |
---|
847 | 847 | table_address = |
---|
848 | 848 | (acpi_physical_address)gbl_rsdp. |
---|
.. | .. |
---|
931 | 931 | |
---|
932 | 932 | /* Does this table match the requested signature? */ |
---|
933 | 933 | |
---|
934 | | - if (!ACPI_COMPARE_NAME |
---|
| 934 | + if (!ACPI_COMPARE_NAMESEG |
---|
935 | 935 | (mapped_table->signature, signature)) { |
---|
936 | 936 | osl_unmap_table(mapped_table); |
---|
937 | 937 | mapped_table = NULL; |
---|
.. | .. |
---|
995 | 995 | { |
---|
996 | 996 | void *table_dir; |
---|
997 | 997 | u32 instance; |
---|
998 | | - char temp_name[ACPI_NAME_SIZE]; |
---|
| 998 | + char temp_name[ACPI_NAMESEG_SIZE]; |
---|
999 | 999 | char *filename; |
---|
1000 | 1000 | acpi_status status = AE_OK; |
---|
1001 | 1001 | |
---|
.. | .. |
---|
1086 | 1086 | return (AE_BAD_SIGNATURE); |
---|
1087 | 1087 | } |
---|
1088 | 1088 | } else |
---|
1089 | | - if (!ACPI_COMPARE_NAME(signature, mapped_table->signature)) |
---|
1090 | | - { |
---|
| 1089 | + if (!ACPI_COMPARE_NAMESEG |
---|
| 1090 | + (signature, mapped_table->signature)) { |
---|
1091 | 1091 | acpi_os_unmap_memory(mapped_table, |
---|
1092 | 1092 | sizeof(struct acpi_table_header)); |
---|
1093 | 1093 | return (AE_BAD_SIGNATURE); |
---|
.. | .. |
---|
1158 | 1158 | |
---|
1159 | 1159 | /* Ignore meaningless files */ |
---|
1160 | 1160 | |
---|
1161 | | - if (strlen(filename) < ACPI_NAME_SIZE) { |
---|
| 1161 | + if (strlen(filename) < ACPI_NAMESEG_SIZE) { |
---|
1162 | 1162 | return (AE_BAD_SIGNATURE); |
---|
1163 | 1163 | } |
---|
1164 | 1164 | |
---|
1165 | 1165 | /* Extract instance number */ |
---|
1166 | 1166 | |
---|
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) { |
---|
1170 | 1170 | return (AE_BAD_SIGNATURE); |
---|
1171 | 1171 | } else { |
---|
1172 | 1172 | *instance = 0; |
---|
.. | .. |
---|
1174 | 1174 | |
---|
1175 | 1175 | /* Extract signature */ |
---|
1176 | 1176 | |
---|
1177 | | - ACPI_MOVE_NAME(signature, filename); |
---|
| 1177 | + ACPI_COPY_NAMESEG(signature, filename); |
---|
1178 | 1178 | return (AE_OK); |
---|
1179 | 1179 | } |
---|
1180 | 1180 | |
---|
.. | .. |
---|
1184 | 1184 | * |
---|
1185 | 1185 | * PARAMETERS: filename - File that contains the desired table |
---|
1186 | 1186 | * file_offset - Offset of the table in file |
---|
1187 | | - * signature - Optional ACPI Signature for desired table. |
---|
1188 | | - * A null terminated 4-character string. |
---|
1189 | 1187 | * table - Where a pointer to the table is returned |
---|
1190 | 1188 | * |
---|
1191 | 1189 | * RETURN: Status; Table buffer is returned if AE_OK. |
---|
.. | .. |
---|
1197 | 1195 | static acpi_status |
---|
1198 | 1196 | osl_read_table_from_file(char *filename, |
---|
1199 | 1197 | acpi_size file_offset, |
---|
1200 | | - char *signature, struct acpi_table_header **table) |
---|
| 1198 | + struct acpi_table_header **table) |
---|
1201 | 1199 | { |
---|
1202 | 1200 | FILE *table_file; |
---|
1203 | 1201 | struct acpi_table_header header; |
---|
.. | .. |
---|
1225 | 1223 | goto exit; |
---|
1226 | 1224 | } |
---|
1227 | 1225 | |
---|
| 1226 | +#ifdef ACPI_OBSOLETE_FUNCTIONS |
---|
| 1227 | + |
---|
1228 | 1228 | /* If signature is specified, it must match the table */ |
---|
1229 | 1229 | |
---|
1230 | 1230 | if (signature) { |
---|
.. | .. |
---|
1236 | 1236 | status = AE_BAD_SIGNATURE; |
---|
1237 | 1237 | goto exit; |
---|
1238 | 1238 | } |
---|
1239 | | - } else if (!ACPI_COMPARE_NAME(signature, header.signature)) { |
---|
| 1239 | + } else if (!ACPI_COMPARE_NAMESEG(signature, header.signature)) { |
---|
1240 | 1240 | fprintf(stderr, |
---|
1241 | 1241 | "Incorrect signature: Expecting %4.4s, found %4.4s\n", |
---|
1242 | 1242 | signature, header.signature); |
---|
.. | .. |
---|
1244 | 1244 | goto exit; |
---|
1245 | 1245 | } |
---|
1246 | 1246 | } |
---|
| 1247 | +#endif |
---|
1247 | 1248 | |
---|
1248 | 1249 | table_length = ap_get_table_length(&header); |
---|
1249 | 1250 | if (table_length == 0) { |
---|
.. | .. |
---|
1311 | 1312 | { |
---|
1312 | 1313 | void *table_dir; |
---|
1313 | 1314 | u32 current_instance = 0; |
---|
1314 | | - char temp_name[ACPI_NAME_SIZE]; |
---|
| 1315 | + char temp_name[ACPI_NAMESEG_SIZE]; |
---|
1315 | 1316 | char table_filename[PATH_MAX]; |
---|
1316 | 1317 | char *filename; |
---|
1317 | 1318 | acpi_status status; |
---|
.. | .. |
---|
1329 | 1330 | |
---|
1330 | 1331 | /* Ignore meaningless files */ |
---|
1331 | 1332 | |
---|
1332 | | - if (!ACPI_COMPARE_NAME(filename, signature)) { |
---|
| 1333 | + if (!ACPI_COMPARE_NAMESEG(filename, signature)) { |
---|
1333 | 1334 | continue; |
---|
1334 | 1335 | } |
---|
1335 | 1336 | |
---|
.. | .. |
---|
1366 | 1367 | /* There is no physical address saved for customized tables, use zero */ |
---|
1367 | 1368 | |
---|
1368 | 1369 | *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); |
---|
1370 | 1371 | |
---|
1371 | 1372 | return (status); |
---|
1372 | 1373 | } |
---|