Revert "ACPI/IORT: Fix 'Number of IDs' handling in iort_id_map()"
This reverts commit 3c23b83a88
.
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Link: https://lore.kernel.org/r/20200501161014.5935-2-ardb@kernel.org
Signed-off-by: Will Deacon <will@kernel.org>
This commit is contained in:
parent
7fb89e1d44
commit
6d3b29d07c
@ -299,59 +299,6 @@ out:
|
||||
return status;
|
||||
}
|
||||
|
||||
struct iort_workaround_oem_info {
|
||||
char oem_id[ACPI_OEM_ID_SIZE + 1];
|
||||
char oem_table_id[ACPI_OEM_TABLE_ID_SIZE + 1];
|
||||
u32 oem_revision;
|
||||
};
|
||||
|
||||
static bool apply_id_count_workaround;
|
||||
|
||||
static struct iort_workaround_oem_info wa_info[] __initdata = {
|
||||
{
|
||||
.oem_id = "HISI ",
|
||||
.oem_table_id = "HIP07 ",
|
||||
.oem_revision = 0,
|
||||
}, {
|
||||
.oem_id = "HISI ",
|
||||
.oem_table_id = "HIP08 ",
|
||||
.oem_revision = 0,
|
||||
}
|
||||
};
|
||||
|
||||
static void __init
|
||||
iort_check_id_count_workaround(struct acpi_table_header *tbl)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(wa_info); i++) {
|
||||
if (!memcmp(wa_info[i].oem_id, tbl->oem_id, ACPI_OEM_ID_SIZE) &&
|
||||
!memcmp(wa_info[i].oem_table_id, tbl->oem_table_id, ACPI_OEM_TABLE_ID_SIZE) &&
|
||||
wa_info[i].oem_revision == tbl->oem_revision) {
|
||||
apply_id_count_workaround = true;
|
||||
pr_warn(FW_BUG "ID count for ID mapping entry is wrong, applying workaround\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline u32 iort_get_map_max(struct acpi_iort_id_mapping *map)
|
||||
{
|
||||
u32 map_max = map->input_base + map->id_count;
|
||||
|
||||
/*
|
||||
* The IORT specification revision D (Section 3, table 4, page 9) says
|
||||
* Number of IDs = The number of IDs in the range minus one, but the
|
||||
* IORT code ignored the "minus one", and some firmware did that too,
|
||||
* so apply a workaround here to keep compatible with both the spec
|
||||
* compliant and non-spec compliant firmwares.
|
||||
*/
|
||||
if (apply_id_count_workaround)
|
||||
map_max--;
|
||||
|
||||
return map_max;
|
||||
}
|
||||
|
||||
static int iort_id_map(struct acpi_iort_id_mapping *map, u8 type, u32 rid_in,
|
||||
u32 *rid_out)
|
||||
{
|
||||
@ -368,7 +315,8 @@ static int iort_id_map(struct acpi_iort_id_mapping *map, u8 type, u32 rid_in,
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
if (rid_in < map->input_base || rid_in > iort_get_map_max(map))
|
||||
if (rid_in < map->input_base ||
|
||||
(rid_in >= map->input_base + map->id_count))
|
||||
return -ENXIO;
|
||||
|
||||
*rid_out = map->output_base + (rid_in - map->input_base);
|
||||
@ -1700,6 +1648,5 @@ void __init acpi_iort_init(void)
|
||||
return;
|
||||
}
|
||||
|
||||
iort_check_id_count_workaround(iort_table);
|
||||
iort_init_platform_devices();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user