power: supply: axp20x_usb_power: Use a match structure
[linux/fpc-iii.git] / drivers / iommu / amd_iommu_quirks.c
blob5120ce4fdce326b6b59185d66e7ba8cb146bf4d5
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 /*
4 * Quirks for AMD IOMMU
6 * Copyright (C) 2019 Kai-Heng Feng <kai.heng.feng@canonical.com>
7 */
9 #ifdef CONFIG_DMI
10 #include <linux/dmi.h>
12 #include "amd_iommu.h"
14 #define IVHD_SPECIAL_IOAPIC 1
16 struct ivrs_quirk_entry {
17 u8 id;
18 u16 devid;
21 enum {
22 DELL_INSPIRON_7375 = 0,
23 DELL_LATITUDE_5495,
24 LENOVO_IDEAPAD_330S_15ARR,
27 static const struct ivrs_quirk_entry ivrs_ioapic_quirks[][3] __initconst = {
28 /* ivrs_ioapic[4]=00:14.0 ivrs_ioapic[5]=00:00.2 */
29 [DELL_INSPIRON_7375] = {
30 { .id = 4, .devid = 0xa0 },
31 { .id = 5, .devid = 0x2 },
34 /* ivrs_ioapic[4]=00:14.0 */
35 [DELL_LATITUDE_5495] = {
36 { .id = 4, .devid = 0xa0 },
39 /* ivrs_ioapic[32]=00:14.0 */
40 [LENOVO_IDEAPAD_330S_15ARR] = {
41 { .id = 32, .devid = 0xa0 },
47 static int __init ivrs_ioapic_quirk_cb(const struct dmi_system_id *d)
49 const struct ivrs_quirk_entry *i;
51 for (i = d->driver_data; i->id != 0 && i->devid != 0; i++)
52 add_special_device(IVHD_SPECIAL_IOAPIC, i->id, (u16 *)&i->devid, 0);
54 return 0;
57 static const struct dmi_system_id ivrs_quirks[] __initconst = {
59 .callback = ivrs_ioapic_quirk_cb,
60 .ident = "Dell Inspiron 7375",
61 .matches = {
62 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
63 DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 7375"),
65 .driver_data = (void *)&ivrs_ioapic_quirks[DELL_INSPIRON_7375],
68 .callback = ivrs_ioapic_quirk_cb,
69 .ident = "Dell Latitude 5495",
70 .matches = {
71 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
72 DMI_MATCH(DMI_PRODUCT_NAME, "Latitude 5495"),
74 .driver_data = (void *)&ivrs_ioapic_quirks[DELL_LATITUDE_5495],
78 * Acer Aspire A315-41 requires the very same workaround as
79 * Dell Latitude 5495
81 .callback = ivrs_ioapic_quirk_cb,
82 .ident = "Acer Aspire A315-41",
83 .matches = {
84 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
85 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire A315-41"),
87 .driver_data = (void *)&ivrs_ioapic_quirks[DELL_LATITUDE_5495],
90 .callback = ivrs_ioapic_quirk_cb,
91 .ident = "Lenovo ideapad 330S-15ARR",
92 .matches = {
93 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
94 DMI_MATCH(DMI_PRODUCT_NAME, "81FB"),
96 .driver_data = (void *)&ivrs_ioapic_quirks[LENOVO_IDEAPAD_330S_15ARR],
101 void __init amd_iommu_apply_ivrs_quirks(void)
103 dmi_check_system(ivrs_quirks);
105 #endif