0001
0002
0003
0004
0005
0006
0007
0008 #include <linux/device.h>
0009 #include <linux/dmi.h>
0010 #include <linux/soundwire/sdw.h>
0011 #include "bus.h"
0012
0013 struct adr_remap {
0014 u64 adr;
0015 u64 remapped_adr;
0016 };
0017
0018
0019
0020
0021
0022
0023 static const struct adr_remap intel_tgl_bios[] = {
0024 {
0025 0x000010025D070100ull,
0026 0x000020025D071100ull
0027 },
0028 {
0029 0x000110025d070100ull,
0030 0x000120025D130800ull
0031 },
0032 {}
0033 };
0034
0035
0036
0037
0038
0039 static const struct adr_remap dell_sku_0A3E[] = {
0040
0041 {
0042 0x00020025d071100ull,
0043 0x00021025d071500ull
0044 },
0045
0046 {
0047 0x000120025d130800ull,
0048 0x000120025d071100ull,
0049 },
0050
0051 {
0052 0x000220025d071500ull,
0053 0x000220025d130800ull
0054 },
0055 {}
0056 };
0057
0058 static const struct dmi_system_id adr_remap_quirk_table[] = {
0059 {
0060 .matches = {
0061 DMI_MATCH(DMI_SYS_VENDOR, "HP"),
0062 DMI_MATCH(DMI_PRODUCT_NAME, "HP Spectre x360 Conv"),
0063 },
0064 .driver_data = (void *)intel_tgl_bios,
0065 },
0066 {
0067
0068 .matches = {
0069 DMI_MATCH(DMI_SYS_VENDOR, "Intel(R) Client Systems"),
0070 DMI_MATCH(DMI_PRODUCT_NAME, "LAPBC"),
0071 },
0072 .driver_data = (void *)intel_tgl_bios,
0073 },
0074 {
0075 .matches = {
0076 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc"),
0077 DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "0A3E")
0078 },
0079 .driver_data = (void *)dell_sku_0A3E,
0080 },
0081 {}
0082 };
0083
0084 u64 sdw_dmi_override_adr(struct sdw_bus *bus, u64 addr)
0085 {
0086 const struct dmi_system_id *dmi_id;
0087
0088
0089 dmi_id = dmi_first_match(adr_remap_quirk_table);
0090 if (dmi_id) {
0091 struct adr_remap *map;
0092
0093 for (map = dmi_id->driver_data; map->adr; map++) {
0094 if (map->adr == addr) {
0095 dev_dbg(bus->dev, "remapped _ADR 0x%llx as 0x%llx\n",
0096 addr, map->remapped_adr);
0097 addr = map->remapped_adr;
0098 break;
0099 }
0100 }
0101 }
0102
0103 return addr;
0104 }