blob: 58402869f450437dee34571c64b1c155224c6101 [file] [log] [blame]
Angel Pons8a3453f2020-04-02 23:48:19 +02001/* SPDX-License-Identifier: GPL-2.0-only */
2/* This file is part of the coreboot project. */
Jett Rink6bdfc802019-03-01 10:20:34 -07003
4#include <arch/acpi_device.h>
5#include <arch/acpigen.h>
6#include <console/console.h>
7#include <device/pci.h>
8#include <device/pci_ids.h>
9#include "chip.h"
10
Furquan Shaikh7536a392020-04-24 21:59:21 -070011static void ish_fill_ssdt_generator(const struct device *dev)
Jett Rink6bdfc802019-03-01 10:20:34 -070012{
13 struct drivers_intel_ish_config *config = dev->chip_info;
14 struct device *root = dev->bus->dev;
15 struct acpi_dp *dsd;
16
17 if (!dev->enabled || !config || !config->firmware_name)
18 return;
19
20 acpigen_write_scope(acpi_device_path(root));
21
22 dsd = acpi_dp_new_table("_DSD");
23 acpi_dp_add_string(dsd, "firmware-name", config->firmware_name);
24 acpi_dp_write(dsd);
25
26 acpigen_pop_len(); /* Scope */
27
28 printk(BIOS_INFO, "%s: Set firmware-name: %s\n",
29 acpi_device_path(root), config->firmware_name);
30}
31
32static struct device_operations intel_ish_ops = {
Nico Huber2f8ba692020-04-05 14:05:24 +020033 .read_resources = noop_read_resources,
34 .set_resources = noop_set_resources,
Nico Huber68680dd2020-03-31 17:34:52 +020035 .acpi_fill_ssdt = ish_fill_ssdt_generator,
Jett Rink6bdfc802019-03-01 10:20:34 -070036};
37
38static void intel_ish_enable(struct device *dev)
39{
40 /* This dev is a generic device that is a child to the ISH PCI device */
41 dev->ops = &intel_ish_ops;
42}
43
44/* Copy of default_pci_ops_dev with scan_bus addition */
45static const struct device_operations pci_ish_device_ops = {
46 .read_resources = pci_dev_read_resources,
47 .set_resources = pci_dev_set_resources,
48 .enable_resources = pci_dev_enable_resources,
49 .init = pci_dev_init,
50 .scan_bus = &scan_generic_bus, /* Non-default */
51 .ops_pci = &pci_dev_ops_pci,
52};
53
54static const unsigned short pci_device_ids[] = {
55 PCI_DEVICE_ID_INTEL_CNL_ISHB,
Bernardo Perez Priegoab9a7c02019-08-02 18:25:01 -070056 PCI_DEVICE_ID_INTEL_CML_ISHB,
li fengdb992ac2020-03-12 11:37:13 -070057 PCI_DEVICE_ID_INTEL_TGL_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,
63 .vendor = PCI_VENDOR_ID_INTEL,
64 .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};