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