John Zhao | b1dd019 | 2022-03-09 17:19:33 -0800 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
| 2 | |
| 3 | #define __SIMPLE_DEVICE__ |
| 4 | |
| 5 | #include <console/console.h> |
| 6 | #include <device/pci.h> |
| 7 | #include <device/pci_ids.h> |
| 8 | #include <intelblocks/p2sb.h> |
| 9 | #include <intelblocks/p2sblib.h> |
| 10 | #include <intelblocks/pcr.h> |
| 11 | #include <soc/iomap.h> |
| 12 | #include <soc/pci_devs.h> |
| 13 | |
| 14 | uint32_t ioe_p2sb_sbi_read(uint8_t pid, uint16_t reg) |
| 15 | { |
| 16 | return p2sb_dev_sbi_read(PCI_DEV_IOE_P2SB, pid, reg); |
| 17 | } |
| 18 | |
| 19 | void ioe_p2sb_sbi_write(uint8_t pid, uint16_t reg, uint32_t val) |
| 20 | { |
| 21 | p2sb_dev_sbi_write(PCI_DEV_IOE_P2SB, pid, reg, val); |
| 22 | } |
| 23 | |
| 24 | void ioe_p2sb_enable_bar(void) |
| 25 | { |
| 26 | p2sb_dev_enable_bar(PCI_DEV_IOE_P2SB, IOE_P2SB_BAR); |
| 27 | } |
| 28 | |
| 29 | static void read_resources(struct device *dev) |
| 30 | { |
| 31 | mmio_resource(dev, 0, IOE_P2SB_BAR / KiB, IOE_P2SB_SIZE / KiB); |
| 32 | } |
| 33 | |
| 34 | struct device_operations device_ops = { |
| 35 | .read_resources = read_resources, |
| 36 | .set_resources = noop_set_resources, |
| 37 | .ops_pci = &pci_dev_ops_pci, |
| 38 | }; |
| 39 | |
| 40 | static const unsigned short pci_device_ids[] = { |
| 41 | PCI_DID_INTEL_MTL_IOE_M_P2SB, |
| 42 | PCI_DID_INTEL_MTL_IOE_P_P2SB, |
| 43 | 0, |
| 44 | }; |
| 45 | |
| 46 | static const struct pci_driver ioe_p2sb __pci_driver = { |
| 47 | .ops = &device_ops, |
| 48 | .vendor = PCI_VID_INTEL, |
| 49 | .devices = pci_device_ids, |
| 50 | }; |