mb/system76/cml-u/dt: Make use of chipset devicetree
[coreboot.git] / src / soc / intel / meteorlake / p2sb.c
blob5863cf0fd7e999a72e73e1de31e693becdf7b018
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <console/console.h>
4 #include <device/device.h>
5 #include <device/pci_def.h>
6 #include <intelblocks/p2sb.h>
7 #include <soc/iomap.h>
9 void p2sb_soc_get_sb_mask(uint32_t *ep_mask, size_t count)
11 uint32_t mask;
13 if (count != P2SB_EP_MASK_MAX_REG) {
14 printk(BIOS_ERR, "Unable to program EPMASK registers\n");
15 return;
18 /* Remove the host accessing right to PSF register range.
19 * Set p2sb PCI offset EPMASK5 [29, 28, 27, 26] to disable Sideband
20 * access for PCI Root Bridge.
22 mask = (1 << 29) | (1 << 28) | (1 << 27) | (1 << 26);
24 ep_mask[P2SB_EP_MASK_5_REG] = mask;
27 * Set p2sb PCI offset EPMASK7 [31, 30] to disable Sideband
28 * access for Broadcast and Multicast.
30 mask = (1 << 31) | (1 << 30);
32 ep_mask[P2SB_EP_MASK_7_REG] = mask;
35 static void ioe_p2sb_read_resources(struct device *dev)
37 /* Add the fixed MMIO resource for IOE P2SB */
38 mmio_range(dev, PCI_BASE_ADDRESS_0, IOE_P2SB_BAR, IOE_P2SB_SIZE);
41 static void p2sb_read_resources(struct device *dev)
44 * There's only one resource on the P2SB device. It's also already
45 * manually set to a fixed address in earlier boot stages.
46 * The following code makes sure that it doesn't change even the
47 * resource allocator is being run.
49 mmio_range(dev, PCI_BASE_ADDRESS_0, P2SB_BAR, P2SB_SIZE);
52 struct device_operations ioe_p2sb_ops = {
53 .read_resources = ioe_p2sb_read_resources,
54 .set_resources = noop_set_resources,
55 .scan_bus = scan_static_bus,
58 struct device_operations soc_p2sb_ops = {
59 .read_resources = p2sb_read_resources,
60 .set_resources = noop_set_resources,
61 .scan_bus = scan_static_bus,