| 1 |
|
| 2 |
|
| 3 |
#include <acpi/acpigen.h> |
| 4 |
#include <device/pci.h> |
| 5 |
#include <device/pci_ids.h> |
| 6 |
#include <intelblocks/sd.h> |
| 7 |
|
| 8 |
#if CONFIG(HAVE_ACPI_TABLES) |
| 9 |
static void sd_fill_ssdt(const struct device *dev) |
| 10 |
{ |
| 11 |
const char *path; |
| 12 |
struct acpi_gpio default_gpio = { 0 }; |
| 13 |
struct acpi_dp *dp; |
| 14 |
|
| 15 |
if (sd_fill_soc_gpio_info(&default_gpio, dev) != 0) |
| 16 |
return; |
| 17 |
|
| 18 |
|
| 19 |
path = acpi_device_path(dev); |
| 20 |
if (!path) |
| 21 |
return; |
| 22 |
acpigen_write_scope(path); |
| 23 |
acpigen_write_name("_CRS"); |
| 24 |
|
| 25 |
|
| 26 |
acpigen_write_resourcetemplate_header(); |
| 27 |
acpi_device_write_gpio(&default_gpio); |
| 28 |
acpigen_write_resourcetemplate_footer(); |
| 29 |
|
| 30 |
|
| 31 |
dp = acpi_dp_new_table("_DSD"); |
| 32 |
if (!dp) |
| 33 |
return; |
| 34 |
acpi_dp_add_gpio(dp, "cd-gpio", path, 0, 0, 1); |
| 35 |
acpi_dp_write(dp); |
| 36 |
|
| 37 |
acpigen_pop_len(); |
| 38 |
} |
| 39 |
#endif |
| 40 |
|
| 41 |
struct device_operations sd_ops = { |
| 42 |
.read_resources = pci_dev_read_resources, |
| 43 |
.set_resources = pci_dev_set_resources, |
| 44 |
.enable_resources = pci_dev_enable_resources, |
| 45 |
#if CONFIG(HAVE_ACPI_TABLES) |
| 46 |
.acpi_fill_ssdt = sd_fill_ssdt, |
| 47 |
#endif |
| 48 |
.ops_pci = &pci_dev_ops_pci, |
| 49 |
}; |
| 50 |
|
| 51 |
static const unsigned short pci_device_ids[] = { |
| 52 |
PCI_DID_INTEL_APL_SD, |
| 53 |
PCI_DID_INTEL_CNL_SD, |
| 54 |
PCI_DID_INTEL_GLK_SD, |
| 55 |
PCI_DID_INTEL_CNP_H_SD, |
| 56 |
PCI_DID_INTEL_CMP_SD, |
| 57 |
PCI_DID_INTEL_CMP_H_SD, |
| 58 |
PCI_DID_INTEL_MCC_SD, |
| 59 |
PCI_DID_INTEL_JSP_SD, |
| 60 |
0 |
| 61 |
}; |
| 62 |
|
| 63 |
static const struct pci_driver pch_sd __pci_driver = { |
| 64 |
.ops = &sd_ops, |
| 65 |
.vendor = PCI_VID_INTEL, |
| 66 |
.devices = pci_device_ids |
| 67 |
}; |