Furquan Shaikh 76cedd2c29 acpi: Move ACPI table support out of arch/x86 (3/5)
This change moves all ACPI table support in coreboot currently living
under arch/x86 into common code to make it architecture
independent. ACPI table generation is not really tied to any
architecture and hence it makes sense to move this to its own
directory.

In order to make it easier to review, this change is being split into
multiple CLs. This is change 3/5 which basically is generated by
running the following command:
$ git grep -iIl "arch/acpi" | xargs sed -i 's/arch\/acpi/acpi\/acpi/g'

BUG=b:155428745

Change-Id: I16b1c45d954d6440fb9db1d3710063a47b582eae
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/40938
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: HAOUAS Elyes <ehaouas@noos.fr>
2020-05-02 18:45:16 +00:00

71 lines
1.9 KiB
C

/* SPDX-License-Identifier: GPL-2.0-only */
/* This file is part of the coreboot project. */
#include <acpi/acpi_device.h>
#include <acpi/acpigen.h>
#include <console/console.h>
#include <device/pci.h>
#include <device/pci_ids.h>
#include "chip.h"
static void ish_fill_ssdt_generator(const struct device *dev)
{
struct drivers_intel_ish_config *config = dev->chip_info;
struct device *root = dev->bus->dev;
struct acpi_dp *dsd;
if (!dev->enabled || !config || !config->firmware_name)
return;
acpigen_write_scope(acpi_device_path(root));
dsd = acpi_dp_new_table("_DSD");
acpi_dp_add_string(dsd, "firmware-name", config->firmware_name);
acpi_dp_write(dsd);
acpigen_pop_len(); /* Scope */
printk(BIOS_INFO, "%s: Set firmware-name: %s\n",
acpi_device_path(root), config->firmware_name);
}
static struct device_operations intel_ish_ops = {
.read_resources = noop_read_resources,
.set_resources = noop_set_resources,
.acpi_fill_ssdt = ish_fill_ssdt_generator,
};
static void intel_ish_enable(struct device *dev)
{
/* This dev is a generic device that is a child to the ISH PCI device */
dev->ops = &intel_ish_ops;
}
/* Copy of default_pci_ops_dev with scan_bus addition */
static const struct device_operations pci_ish_device_ops = {
.read_resources = pci_dev_read_resources,
.set_resources = pci_dev_set_resources,
.enable_resources = pci_dev_enable_resources,
.init = pci_dev_init,
.scan_bus = &scan_generic_bus, /* Non-default */
.ops_pci = &pci_dev_ops_pci,
};
static const unsigned short pci_device_ids[] = {
PCI_DEVICE_ID_INTEL_CNL_ISHB,
PCI_DEVICE_ID_INTEL_CML_ISHB,
PCI_DEVICE_ID_INTEL_TGL_ISHB,
0
};
static const struct pci_driver ish_intel_driver __pci_driver = {
.ops = &pci_ish_device_ops,
.vendor = PCI_VENDOR_ID_INTEL,
.devices = pci_device_ids,
};
struct chip_operations drivers_intel_ish_ops = {
CHIP_NAME("Intel ISH Chip")
.enable_dev = intel_ish_enable,
};