Skip to content

Commit 6d3b29d

Browse files
ardbiesheuvelwilldeacon
authored andcommitted
Revert "ACPI/IORT: Fix 'Number of IDs' handling in iort_id_map()"
This reverts commit 3c23b83. Signed-off-by: Ard Biesheuvel <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent 7fb89e1 commit 6d3b29d

File tree

1 file changed

+2
-55
lines changed

1 file changed

+2
-55
lines changed

drivers/acpi/arm64/iort.c

Lines changed: 2 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -299,59 +299,6 @@ static acpi_status iort_match_node_callback(struct acpi_iort_node *node,
299299
return status;
300300
}
301301

302-
struct iort_workaround_oem_info {
303-
char oem_id[ACPI_OEM_ID_SIZE + 1];
304-
char oem_table_id[ACPI_OEM_TABLE_ID_SIZE + 1];
305-
u32 oem_revision;
306-
};
307-
308-
static bool apply_id_count_workaround;
309-
310-
static struct iort_workaround_oem_info wa_info[] __initdata = {
311-
{
312-
.oem_id = "HISI ",
313-
.oem_table_id = "HIP07 ",
314-
.oem_revision = 0,
315-
}, {
316-
.oem_id = "HISI ",
317-
.oem_table_id = "HIP08 ",
318-
.oem_revision = 0,
319-
}
320-
};
321-
322-
static void __init
323-
iort_check_id_count_workaround(struct acpi_table_header *tbl)
324-
{
325-
int i;
326-
327-
for (i = 0; i < ARRAY_SIZE(wa_info); i++) {
328-
if (!memcmp(wa_info[i].oem_id, tbl->oem_id, ACPI_OEM_ID_SIZE) &&
329-
!memcmp(wa_info[i].oem_table_id, tbl->oem_table_id, ACPI_OEM_TABLE_ID_SIZE) &&
330-
wa_info[i].oem_revision == tbl->oem_revision) {
331-
apply_id_count_workaround = true;
332-
pr_warn(FW_BUG "ID count for ID mapping entry is wrong, applying workaround\n");
333-
break;
334-
}
335-
}
336-
}
337-
338-
static inline u32 iort_get_map_max(struct acpi_iort_id_mapping *map)
339-
{
340-
u32 map_max = map->input_base + map->id_count;
341-
342-
/*
343-
* The IORT specification revision D (Section 3, table 4, page 9) says
344-
* Number of IDs = The number of IDs in the range minus one, but the
345-
* IORT code ignored the "minus one", and some firmware did that too,
346-
* so apply a workaround here to keep compatible with both the spec
347-
* compliant and non-spec compliant firmwares.
348-
*/
349-
if (apply_id_count_workaround)
350-
map_max--;
351-
352-
return map_max;
353-
}
354-
355302
static int iort_id_map(struct acpi_iort_id_mapping *map, u8 type, u32 rid_in,
356303
u32 *rid_out)
357304
{
@@ -368,7 +315,8 @@ static int iort_id_map(struct acpi_iort_id_mapping *map, u8 type, u32 rid_in,
368315
return -ENXIO;
369316
}
370317

371-
if (rid_in < map->input_base || rid_in > iort_get_map_max(map))
318+
if (rid_in < map->input_base ||
319+
(rid_in >= map->input_base + map->id_count))
372320
return -ENXIO;
373321

374322
*rid_out = map->output_base + (rid_in - map->input_base);
@@ -1700,6 +1648,5 @@ void __init acpi_iort_init(void)
17001648
return;
17011649
}
17021650

1703-
iort_check_id_count_workaround(iort_table);
17041651
iort_init_platform_devices();
17051652
}

0 commit comments

Comments
 (0)