mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-05 05:42:36 +00:00
platform/x86/intel/vsec: Rework early hardware code
In the Intel VSEC PCI driver, use a new VSEC_QUIRK_EARLY_HW flag in driver_data to indicate the need for early hardware quirks in auxiliary devices. Remove the separate PCI ID list maintained by the Intel PMT auxiliary driver. Cc: Srinivas Pandruvada <srinivas.pandruvada@intel.com> Signed-off-by: David E. Box <david.e.box@linux.intel.com> Signed-off-by: Gayatri Kammela <gayatri.kammela@linux.intel.com> Link: https://lore.kernel.org/r/20220629221334.434307-2-gayatri.kammela@linux.intel.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
parent
9a1aac8a96
commit
f21c179e12
3 changed files with 39 additions and 41 deletions
|
@ -20,25 +20,16 @@
|
||||||
#define PMT_XA_MAX INT_MAX
|
#define PMT_XA_MAX INT_MAX
|
||||||
#define PMT_XA_LIMIT XA_LIMIT(PMT_XA_START, PMT_XA_MAX)
|
#define PMT_XA_LIMIT XA_LIMIT(PMT_XA_START, PMT_XA_MAX)
|
||||||
|
|
||||||
/*
|
|
||||||
* Early implementations of PMT on client platforms have some
|
|
||||||
* differences from the server platforms (which use the Out Of Band
|
|
||||||
* Management Services Module OOBMSM). This list tracks those
|
|
||||||
* platforms as needed to handle those differences. Newer client
|
|
||||||
* platforms are expected to be fully compatible with server.
|
|
||||||
*/
|
|
||||||
static const struct pci_device_id pmt_telem_early_client_pci_ids[] = {
|
|
||||||
{ PCI_VDEVICE(INTEL, 0x467d) }, /* ADL */
|
|
||||||
{ PCI_VDEVICE(INTEL, 0x490e) }, /* DG1 */
|
|
||||||
{ PCI_VDEVICE(INTEL, 0x9a0d) }, /* TGL */
|
|
||||||
{ }
|
|
||||||
};
|
|
||||||
|
|
||||||
bool intel_pmt_is_early_client_hw(struct device *dev)
|
bool intel_pmt_is_early_client_hw(struct device *dev)
|
||||||
{
|
{
|
||||||
struct pci_dev *parent = to_pci_dev(dev->parent);
|
struct intel_vsec_device *ivdev = dev_to_ivdev(dev);
|
||||||
|
|
||||||
return !!pci_match_id(pmt_telem_early_client_pci_ids, parent);
|
/*
|
||||||
|
* Early implementations of PMT on client platforms have some
|
||||||
|
* differences from the server platforms (which use the Out Of Band
|
||||||
|
* Management Services Module OOBMSM).
|
||||||
|
*/
|
||||||
|
return !!(ivdev->info->quirks & VSEC_QUIRK_EARLY_HW);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(intel_pmt_is_early_client_hw);
|
EXPORT_SYMBOL_GPL(intel_pmt_is_early_client_hw);
|
||||||
|
|
||||||
|
|
|
@ -54,12 +54,6 @@ struct intel_vsec_header {
|
||||||
u32 offset;
|
u32 offset;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Platform specific data */
|
|
||||||
struct intel_vsec_platform_info {
|
|
||||||
struct intel_vsec_header **capabilities;
|
|
||||||
unsigned long quirks;
|
|
||||||
};
|
|
||||||
|
|
||||||
enum intel_vsec_id {
|
enum intel_vsec_id {
|
||||||
VSEC_ID_TELEMETRY = 2,
|
VSEC_ID_TELEMETRY = 2,
|
||||||
VSEC_ID_WATCHER = 3,
|
VSEC_ID_WATCHER = 3,
|
||||||
|
@ -169,10 +163,11 @@ static int intel_vsec_add_aux(struct pci_dev *pdev, struct intel_vsec_device *in
|
||||||
}
|
}
|
||||||
|
|
||||||
static int intel_vsec_add_dev(struct pci_dev *pdev, struct intel_vsec_header *header,
|
static int intel_vsec_add_dev(struct pci_dev *pdev, struct intel_vsec_header *header,
|
||||||
unsigned long quirks)
|
struct intel_vsec_platform_info *info)
|
||||||
{
|
{
|
||||||
struct intel_vsec_device *intel_vsec_dev;
|
struct intel_vsec_device *intel_vsec_dev;
|
||||||
struct resource *res, *tmp;
|
struct resource *res, *tmp;
|
||||||
|
unsigned long quirks = info->quirks;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!intel_vsec_allowed(header->id) || intel_vsec_disabled(header->id, quirks))
|
if (!intel_vsec_allowed(header->id) || intel_vsec_disabled(header->id, quirks))
|
||||||
|
@ -216,7 +211,7 @@ static int intel_vsec_add_dev(struct pci_dev *pdev, struct intel_vsec_header *he
|
||||||
intel_vsec_dev->pcidev = pdev;
|
intel_vsec_dev->pcidev = pdev;
|
||||||
intel_vsec_dev->resource = res;
|
intel_vsec_dev->resource = res;
|
||||||
intel_vsec_dev->num_resources = header->num_entries;
|
intel_vsec_dev->num_resources = header->num_entries;
|
||||||
intel_vsec_dev->quirks = quirks;
|
intel_vsec_dev->info = info;
|
||||||
|
|
||||||
if (header->id == VSEC_ID_SDSI)
|
if (header->id == VSEC_ID_SDSI)
|
||||||
intel_vsec_dev->ida = &intel_vsec_sdsi_ida;
|
intel_vsec_dev->ida = &intel_vsec_sdsi_ida;
|
||||||
|
@ -226,14 +221,15 @@ static int intel_vsec_add_dev(struct pci_dev *pdev, struct intel_vsec_header *he
|
||||||
return intel_vsec_add_aux(pdev, intel_vsec_dev, intel_vsec_name(header->id));
|
return intel_vsec_add_aux(pdev, intel_vsec_dev, intel_vsec_name(header->id));
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool intel_vsec_walk_header(struct pci_dev *pdev, unsigned long quirks,
|
static bool intel_vsec_walk_header(struct pci_dev *pdev,
|
||||||
struct intel_vsec_header **header)
|
struct intel_vsec_platform_info *info)
|
||||||
{
|
{
|
||||||
|
struct intel_vsec_header **header = info->capabilities;
|
||||||
bool have_devices = false;
|
bool have_devices = false;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
for ( ; *header; header++) {
|
for ( ; *header; header++) {
|
||||||
ret = intel_vsec_add_dev(pdev, *header, quirks);
|
ret = intel_vsec_add_dev(pdev, *header, info);
|
||||||
if (ret)
|
if (ret)
|
||||||
dev_info(&pdev->dev, "Could not add device for DVSEC id %d\n",
|
dev_info(&pdev->dev, "Could not add device for DVSEC id %d\n",
|
||||||
(*header)->id);
|
(*header)->id);
|
||||||
|
@ -244,7 +240,8 @@ static bool intel_vsec_walk_header(struct pci_dev *pdev, unsigned long quirks,
|
||||||
return have_devices;
|
return have_devices;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool intel_vsec_walk_dvsec(struct pci_dev *pdev, unsigned long quirks)
|
static bool intel_vsec_walk_dvsec(struct pci_dev *pdev,
|
||||||
|
struct intel_vsec_platform_info *info)
|
||||||
{
|
{
|
||||||
bool have_devices = false;
|
bool have_devices = false;
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
|
@ -283,7 +280,7 @@ static bool intel_vsec_walk_dvsec(struct pci_dev *pdev, unsigned long quirks)
|
||||||
pci_read_config_dword(pdev, pos + PCI_DVSEC_HEADER2, &hdr);
|
pci_read_config_dword(pdev, pos + PCI_DVSEC_HEADER2, &hdr);
|
||||||
header.id = PCI_DVSEC_HEADER2_ID(hdr);
|
header.id = PCI_DVSEC_HEADER2_ID(hdr);
|
||||||
|
|
||||||
ret = intel_vsec_add_dev(pdev, &header, quirks);
|
ret = intel_vsec_add_dev(pdev, &header, info);
|
||||||
if (ret)
|
if (ret)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -293,7 +290,8 @@ static bool intel_vsec_walk_dvsec(struct pci_dev *pdev, unsigned long quirks)
|
||||||
return have_devices;
|
return have_devices;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool intel_vsec_walk_vsec(struct pci_dev *pdev, unsigned long quirks)
|
static bool intel_vsec_walk_vsec(struct pci_dev *pdev,
|
||||||
|
struct intel_vsec_platform_info *info)
|
||||||
{
|
{
|
||||||
bool have_devices = false;
|
bool have_devices = false;
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
|
@ -327,7 +325,7 @@ static bool intel_vsec_walk_vsec(struct pci_dev *pdev, unsigned long quirks)
|
||||||
header.tbir = INTEL_DVSEC_TABLE_BAR(table);
|
header.tbir = INTEL_DVSEC_TABLE_BAR(table);
|
||||||
header.offset = INTEL_DVSEC_TABLE_OFFSET(table);
|
header.offset = INTEL_DVSEC_TABLE_OFFSET(table);
|
||||||
|
|
||||||
ret = intel_vsec_add_dev(pdev, &header, quirks);
|
ret = intel_vsec_add_dev(pdev, &header, info);
|
||||||
if (ret)
|
if (ret)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -341,7 +339,6 @@ static int intel_vsec_pci_probe(struct pci_dev *pdev, const struct pci_device_id
|
||||||
{
|
{
|
||||||
struct intel_vsec_platform_info *info;
|
struct intel_vsec_platform_info *info;
|
||||||
bool have_devices = false;
|
bool have_devices = false;
|
||||||
unsigned long quirks = 0;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = pcim_enable_device(pdev);
|
ret = pcim_enable_device(pdev);
|
||||||
|
@ -349,17 +346,17 @@ static int intel_vsec_pci_probe(struct pci_dev *pdev, const struct pci_device_id
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
info = (struct intel_vsec_platform_info *)id->driver_data;
|
info = (struct intel_vsec_platform_info *)id->driver_data;
|
||||||
if (info)
|
if (!info)
|
||||||
quirks = info->quirks;
|
return -EINVAL;
|
||||||
|
|
||||||
if (intel_vsec_walk_dvsec(pdev, quirks))
|
if (intel_vsec_walk_dvsec(pdev, info))
|
||||||
have_devices = true;
|
have_devices = true;
|
||||||
|
|
||||||
if (intel_vsec_walk_vsec(pdev, quirks))
|
if (intel_vsec_walk_vsec(pdev, info))
|
||||||
have_devices = true;
|
have_devices = true;
|
||||||
|
|
||||||
if (info && (info->quirks & VSEC_QUIRK_NO_DVSEC) &&
|
if (info && (info->quirks & VSEC_QUIRK_NO_DVSEC) &&
|
||||||
intel_vsec_walk_header(pdev, quirks, info->capabilities))
|
intel_vsec_walk_header(pdev, info))
|
||||||
have_devices = true;
|
have_devices = true;
|
||||||
|
|
||||||
if (!have_devices)
|
if (!have_devices)
|
||||||
|
@ -370,7 +367,8 @@ static int intel_vsec_pci_probe(struct pci_dev *pdev, const struct pci_device_id
|
||||||
|
|
||||||
/* TGL info */
|
/* TGL info */
|
||||||
static const struct intel_vsec_platform_info tgl_info = {
|
static const struct intel_vsec_platform_info tgl_info = {
|
||||||
.quirks = VSEC_QUIRK_NO_WATCHER | VSEC_QUIRK_NO_CRASHLOG | VSEC_QUIRK_TABLE_SHIFT,
|
.quirks = VSEC_QUIRK_NO_WATCHER | VSEC_QUIRK_NO_CRASHLOG |
|
||||||
|
VSEC_QUIRK_TABLE_SHIFT | VSEC_QUIRK_EARLY_HW,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* DG1 info */
|
/* DG1 info */
|
||||||
|
@ -390,7 +388,7 @@ static struct intel_vsec_header *dg1_capabilities[] = {
|
||||||
|
|
||||||
static const struct intel_vsec_platform_info dg1_info = {
|
static const struct intel_vsec_platform_info dg1_info = {
|
||||||
.capabilities = dg1_capabilities,
|
.capabilities = dg1_capabilities,
|
||||||
.quirks = VSEC_QUIRK_NO_DVSEC,
|
.quirks = VSEC_QUIRK_NO_DVSEC | VSEC_QUIRK_EARLY_HW,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define PCI_DEVICE_ID_INTEL_VSEC_ADL 0x467d
|
#define PCI_DEVICE_ID_INTEL_VSEC_ADL 0x467d
|
||||||
|
@ -400,7 +398,7 @@ static const struct intel_vsec_platform_info dg1_info = {
|
||||||
static const struct pci_device_id intel_vsec_pci_ids[] = {
|
static const struct pci_device_id intel_vsec_pci_ids[] = {
|
||||||
{ PCI_DEVICE_DATA(INTEL, VSEC_ADL, &tgl_info) },
|
{ PCI_DEVICE_DATA(INTEL, VSEC_ADL, &tgl_info) },
|
||||||
{ PCI_DEVICE_DATA(INTEL, VSEC_DG1, &dg1_info) },
|
{ PCI_DEVICE_DATA(INTEL, VSEC_DG1, &dg1_info) },
|
||||||
{ PCI_DEVICE_DATA(INTEL, VSEC_OOBMSM, NULL) },
|
{ PCI_DEVICE_DATA(INTEL, VSEC_OOBMSM, &(struct intel_vsec_platform_info) {}) },
|
||||||
{ PCI_DEVICE_DATA(INTEL, VSEC_TGL, &tgl_info) },
|
{ PCI_DEVICE_DATA(INTEL, VSEC_TGL, &tgl_info) },
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
|
|
@ -20,6 +20,15 @@ enum intel_vsec_quirks {
|
||||||
|
|
||||||
/* DVSEC not present (provided in driver data) */
|
/* DVSEC not present (provided in driver data) */
|
||||||
VSEC_QUIRK_NO_DVSEC = BIT(3),
|
VSEC_QUIRK_NO_DVSEC = BIT(3),
|
||||||
|
|
||||||
|
/* Platforms requiring quirk in the auxiliary driver */
|
||||||
|
VSEC_QUIRK_EARLY_HW = BIT(4),
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Platform specific data */
|
||||||
|
struct intel_vsec_platform_info {
|
||||||
|
struct intel_vsec_header **capabilities;
|
||||||
|
unsigned long quirks;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct intel_vsec_device {
|
struct intel_vsec_device {
|
||||||
|
@ -27,7 +36,7 @@ struct intel_vsec_device {
|
||||||
struct pci_dev *pcidev;
|
struct pci_dev *pcidev;
|
||||||
struct resource *resource;
|
struct resource *resource;
|
||||||
struct ida *ida;
|
struct ida *ida;
|
||||||
unsigned long quirks;
|
struct intel_vsec_platform_info *info;
|
||||||
int num_resources;
|
int num_resources;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue