blob: 6dee8792dcdd04846a5f64df2c12ad49164417f1 [file] [log] [blame]
Patrick Georgi02363b52020-05-05 20:48:50 +02001/* This file is part of the coreboot project. */
V Sowmyac333b982017-11-27 11:31:14 +05302/*
V Sowmyac333b982017-11-27 11:31:14 +05303 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#include <device/device.h>
16#include <device/pci.h>
17#include <device/pci_ids.h>
18#include <intelblocks/sram.h>
19#include <soc/iomap.h>
20
Aaron Durbin64031672018-04-21 14:45:32 -060021__weak void soc_sram_init(struct device *dev) { /* no-op */ }
V Sowmyac333b982017-11-27 11:31:14 +053022
23static void sram_read_resources(struct device *dev)
24{
25 struct resource *res;
26 pci_dev_read_resources(dev);
27
28 res = new_resource(dev, PCI_BASE_ADDRESS_0);
29 res->base = SRAM_BASE_0;
30 res->size = SRAM_SIZE_0;
31 res->flags = IORESOURCE_MEM | IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
32
33 res = new_resource(dev, PCI_BASE_ADDRESS_2);
34 res->base = SRAM_BASE_2;
35 res->size = SRAM_SIZE_2;
36 res->flags = IORESOURCE_MEM | IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
37}
38
39static const struct device_operations device_ops = {
40 .read_resources = sram_read_resources,
41 .set_resources = pci_dev_set_resources,
42 .enable_resources = pci_dev_enable_resources,
43 .init = soc_sram_init,
Subrata Banik6bbc91a2017-12-07 14:55:51 +053044 .ops_pci = &pci_dev_ops_pci,
V Sowmyac333b982017-11-27 11:31:14 +053045};
46
47static const unsigned short pci_device_ids[] = {
48 PCI_DEVICE_ID_INTEL_APL_SRAM,
49 PCI_DEVICE_ID_INTEL_GLK_SRAM,
Aamir Bohra9eac0392018-06-30 12:07:04 +053050 PCI_DEVICE_ID_INTEL_ICL_SRAM,
Ronak Kanabarda7ffb482019-02-05 01:51:13 +053051 PCI_DEVICE_ID_INTEL_CMP_SRAM,
Gaggery Tsai12a651c2019-12-05 11:23:20 -080052 PCI_DEVICE_ID_INTEL_CMP_H_SRAM,
Ravi Sarawadi6b5bf402019-10-21 22:25:04 -070053 PCI_DEVICE_ID_INTEL_TGL_SRAM,
Tan, Lean Sheng26136092020-01-20 19:13:56 -080054 PCI_DEVICE_ID_INTEL_MCC_SRAM,
Meera Ravindranath3f4af0d2020-02-12 16:01:22 +053055 PCI_DEVICE_ID_INTEL_JSP_SRAM,
V Sowmyac333b982017-11-27 11:31:14 +053056 0,
57};
58
59static const struct pci_driver sram __pci_driver = {
60 .ops = &device_ops,
61 .vendor = PCI_VENDOR_ID_INTEL,
62 .devices = pci_device_ids,
63};