blob: 7718ac543f3fb3c3797fd9717c9e8a5c9accefea [file] [log] [blame]
Angel Pons8a3453f2020-04-02 23:48:19 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Jett Rink6bdfc802019-03-01 10:20:34 -07002
Furquan Shaikh76cedd22020-05-02 10:24:23 -07003#include <acpi/acpi_device.h>
4#include <acpi/acpigen.h>
Jett Rink6bdfc802019-03-01 10:20:34 -07005#include <console/console.h>
6#include <device/pci.h>
7#include <device/pci_ids.h>
8#include "chip.h"
9
Furquan Shaikh7536a392020-04-24 21:59:21 -070010static void ish_fill_ssdt_generator(const struct device *dev)
Jett Rink6bdfc802019-03-01 10:20:34 -070011{
12 struct drivers_intel_ish_config *config = dev->chip_info;
13 struct device *root = dev->bus->dev;
14 struct acpi_dp *dsd;
15
Karthikeyan Ramasubramaniand1c0f952020-11-02 16:26:52 -070016 if (!config || !config->firmware_name)
Jett Rink6bdfc802019-03-01 10:20:34 -070017 return;
18
19 acpigen_write_scope(acpi_device_path(root));
20
21 dsd = acpi_dp_new_table("_DSD");
22 acpi_dp_add_string(dsd, "firmware-name", config->firmware_name);
23 acpi_dp_write(dsd);
24
25 acpigen_pop_len(); /* Scope */
26
27 printk(BIOS_INFO, "%s: Set firmware-name: %s\n",
28 acpi_device_path(root), config->firmware_name);
29}
30
31static struct device_operations intel_ish_ops = {
Nico Huber2f8ba692020-04-05 14:05:24 +020032 .read_resources = noop_read_resources,
33 .set_resources = noop_set_resources,
Nico Huber68680dd2020-03-31 17:34:52 +020034 .acpi_fill_ssdt = ish_fill_ssdt_generator,
Jett Rink6bdfc802019-03-01 10:20:34 -070035};
36
37static void intel_ish_enable(struct device *dev)
38{
39 /* This dev is a generic device that is a child to the ISH PCI device */
40 dev->ops = &intel_ish_ops;
41}
42
43/* Copy of default_pci_ops_dev with scan_bus addition */
44static const struct device_operations pci_ish_device_ops = {
45 .read_resources = pci_dev_read_resources,
46 .set_resources = pci_dev_set_resources,
47 .enable_resources = pci_dev_enable_resources,
48 .init = pci_dev_init,
49 .scan_bus = &scan_generic_bus, /* Non-default */
50 .ops_pci = &pci_dev_ops_pci,
51};
52
53static const unsigned short pci_device_ids[] = {
Felix Singer43b7f412022-03-07 04:34:52 +010054 PCI_DID_INTEL_CNL_ISHB,
55 PCI_DID_INTEL_CML_ISHB,
56 PCI_DID_INTEL_TGL_ISHB,
57 PCI_DID_INTEL_TGL_H_ISHB,
Jett Rink6bdfc802019-03-01 10:20:34 -070058 0
59};
60
61static const struct pci_driver ish_intel_driver __pci_driver = {
62 .ops = &pci_ish_device_ops,
Felix Singer43b7f412022-03-07 04:34:52 +010063 .vendor = PCI_VID_INTEL,
Jett Rink6bdfc802019-03-01 10:20:34 -070064 .devices = pci_device_ids,
65};
66
67struct chip_operations drivers_intel_ish_ops = {
68 CHIP_NAME("Intel ISH Chip")
69 .enable_dev = intel_ish_enable,
70};