blob: ead3d9a0576d1361389ea102dc789c996c3f2ff2 [file] [log] [blame]
Patrick Georgi02363b52020-05-05 20:48:50 +02001/* This file is part of the coreboot project. */
Patrick Georgiac959032020-05-05 22:49:26 +02002/* SPDX-License-Identifier: GPL-2.0-or-later */
V Sowmyac333b982017-11-27 11:31:14 +05303
4#include <device/device.h>
5#include <device/pci.h>
6#include <device/pci_ids.h>
7#include <intelblocks/sram.h>
8#include <soc/iomap.h>
9
Aaron Durbin64031672018-04-21 14:45:32 -060010__weak void soc_sram_init(struct device *dev) { /* no-op */ }
V Sowmyac333b982017-11-27 11:31:14 +053011
12static void sram_read_resources(struct device *dev)
13{
14 struct resource *res;
15 pci_dev_read_resources(dev);
16
17 res = new_resource(dev, PCI_BASE_ADDRESS_0);
18 res->base = SRAM_BASE_0;
19 res->size = SRAM_SIZE_0;
20 res->flags = IORESOURCE_MEM | IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
21
22 res = new_resource(dev, PCI_BASE_ADDRESS_2);
23 res->base = SRAM_BASE_2;
24 res->size = SRAM_SIZE_2;
25 res->flags = IORESOURCE_MEM | IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
26}
27
28static const struct device_operations device_ops = {
29 .read_resources = sram_read_resources,
30 .set_resources = pci_dev_set_resources,
31 .enable_resources = pci_dev_enable_resources,
32 .init = soc_sram_init,
Subrata Banik6bbc91a2017-12-07 14:55:51 +053033 .ops_pci = &pci_dev_ops_pci,
V Sowmyac333b982017-11-27 11:31:14 +053034};
35
36static const unsigned short pci_device_ids[] = {
37 PCI_DEVICE_ID_INTEL_APL_SRAM,
38 PCI_DEVICE_ID_INTEL_GLK_SRAM,
Aamir Bohra9eac0392018-06-30 12:07:04 +053039 PCI_DEVICE_ID_INTEL_ICL_SRAM,
Ronak Kanabarda7ffb482019-02-05 01:51:13 +053040 PCI_DEVICE_ID_INTEL_CMP_SRAM,
Gaggery Tsai12a651c2019-12-05 11:23:20 -080041 PCI_DEVICE_ID_INTEL_CMP_H_SRAM,
Ravi Sarawadi6b5bf402019-10-21 22:25:04 -070042 PCI_DEVICE_ID_INTEL_TGL_SRAM,
Tan, Lean Sheng26136092020-01-20 19:13:56 -080043 PCI_DEVICE_ID_INTEL_MCC_SRAM,
Meera Ravindranath3f4af0d2020-02-12 16:01:22 +053044 PCI_DEVICE_ID_INTEL_JSP_SRAM,
V Sowmyac333b982017-11-27 11:31:14 +053045 0,
46};
47
48static const struct pci_driver sram __pci_driver = {
49 .ops = &device_ops,
50 .vendor = PCI_VENDOR_ID_INTEL,
51 .devices = pci_device_ids,
52};