| 1 |
|
| 2 |
|
| 3 |
#include <acpi/acpi_device.h> |
| 4 |
#include <acpi/acpigen.h> |
| 5 |
#include <cbmem.h> |
| 6 |
#include <console/console.h> |
| 7 |
#include <device/pci.h> |
| 8 |
#include <device/pci_ids.h> |
| 9 |
#include <intelblocks/cse.h> |
| 10 |
#include "chip.h" |
| 11 |
|
| 12 |
static void ish_fill_ssdt_generator(const struct device *dev) |
| 13 |
{ |
| 14 |
struct drivers_intel_ish_config *config = dev->chip_info; |
| 15 |
struct device *root = dev->upstream->dev; |
| 16 |
struct acpi_dp *dsd; |
| 17 |
|
| 18 |
if (!config) |
| 19 |
return; |
| 20 |
|
| 21 |
acpigen_write_scope(acpi_device_path(root)); |
| 22 |
|
| 23 |
dsd = acpi_dp_new_table("_DSD"); |
| 24 |
|
| 25 |
if (config->firmware_name) { |
| 26 |
acpi_dp_add_string(dsd, "firmware-name", config->firmware_name); |
| 27 |
printk(BIOS_INFO, "%s: Set firmware-name: %s\n", |
| 28 |
acpi_device_path(root), config->firmware_name); |
| 29 |
} |
| 30 |
|
| 31 |
if (config->add_acpi_dma_property) |
| 32 |
acpi_device_add_dma_property(dsd); |
| 33 |
|
| 34 |
acpi_dp_write(dsd); |
| 35 |
|
| 36 |
acpigen_pop_len(); |
| 37 |
} |
| 38 |
|
| 39 |
static struct device_operations intel_ish_ops = { |
| 40 |
.read_resources = noop_read_resources, |
| 41 |
.set_resources = noop_set_resources, |
| 42 |
.acpi_fill_ssdt = ish_fill_ssdt_generator, |
| 43 |
}; |
| 44 |
|
| 45 |
static void intel_ish_enable(struct device *dev) |
| 46 |
{ |
| 47 |
|
| 48 |
dev->ops = &intel_ish_ops; |
| 49 |
} |
| 50 |
|
| 51 |
static void intel_ish_get_version(void) |
| 52 |
{ |
| 53 |
if (CONFIG(SOC_INTEL_CSE_LITE_SYNC_BY_PAYLOAD)) |
| 54 |
return; |
| 55 |
|
| 56 |
struct cse_specific_info *info = cbmem_find(CBMEM_ID_CSE_INFO); |
| 57 |
if (info == NULL) |
| 58 |
return; |
| 59 |
|
| 60 |
printk(BIOS_DEBUG, "ISH version: %d.%d.%d.%d\n", |
| 61 |
info->cse_fwp_version.ish_partition_info.cur_ish_fw_version.major, |
| 62 |
info->cse_fwp_version.ish_partition_info.cur_ish_fw_version.minor, |
| 63 |
info->cse_fwp_version.ish_partition_info.cur_ish_fw_version.hotfix, |
| 64 |
info->cse_fwp_version.ish_partition_info.cur_ish_fw_version.build); |
| 65 |
} |
| 66 |
|
| 67 |
static void intel_ish_final(struct device *dev) |
| 68 |
{ |
| 69 |
if (CONFIG(DRIVER_INTEL_ISH_HAS_MAIN_FW)) |
| 70 |
return; |
| 71 |
|
| 72 |
if (CONFIG(SOC_INTEL_STORE_ISH_FW_VERSION)) |
| 73 |
intel_ish_get_version(); |
| 74 |
} |
| 75 |
|
| 76 |
|
| 77 |
static const struct device_operations pci_ish_device_ops = { |
| 78 |
.read_resources = pci_dev_read_resources, |
| 79 |
.set_resources = pci_dev_set_resources, |
| 80 |
.enable_resources = pci_dev_enable_resources, |
| 81 |
.init = pci_dev_init, |
| 82 |
.scan_bus = &scan_generic_bus, |
| 83 |
.ops_pci = &pci_dev_ops_pci, |
| 84 |
.final = intel_ish_final, |
| 85 |
}; |
| 86 |
|
| 87 |
static const unsigned short pci_device_ids[] = { |
| 88 |
PCI_DID_INTEL_WCL_ISHB, |
| 89 |
PCI_DID_INTEL_PTL_H_ISHB, |
| 90 |
PCI_DID_INTEL_PTL_U_H_ISHB, |
| 91 |
PCI_DID_INTEL_LNL_ISHB, |
| 92 |
PCI_DID_INTEL_MTL_ISHB, |
| 93 |
PCI_DID_INTEL_ARL_ISHB, |
| 94 |
PCI_DID_INTEL_ARP_S_ISHB, |
| 95 |
PCI_DID_INTEL_CNL_ISHB, |
| 96 |
PCI_DID_INTEL_CML_ISHB, |
| 97 |
PCI_DID_INTEL_TGL_ISHB, |
| 98 |
PCI_DID_INTEL_TGL_H_ISHB, |
| 99 |
PCI_DID_INTEL_ADL_N_ISHB, |
| 100 |
PCI_DID_INTEL_ADL_P_ISHB, |
| 101 |
0 |
| 102 |
}; |
| 103 |
|
| 104 |
static const struct pci_driver ish_intel_driver __pci_driver = { |
| 105 |
.ops = &pci_ish_device_ops, |
| 106 |
.vendor = PCI_VID_INTEL, |
| 107 |
.devices = pci_device_ids, |
| 108 |
}; |
| 109 |
|
| 110 |
struct chip_operations drivers_intel_ish_ops = { |
| 111 |
.name = "Intel ISH Chip", |
| 112 |
.enable_dev = intel_ish_enable, |
| 113 |
}; |