coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
pch.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <console/console.h>
4 #include <device/pci_ops.h>
5 #include <device/device.h>
6 #include <device/pci.h>
7 #include <device/pci_def.h>
8 #include "pch.h"
9 
10 /* Set bit in function disable register to hide this device */
11 static void pch_disable_devfn(struct device *dev)
12 {
13  switch (dev->path.pci.devfn) {
14  case PCI_DEVFN(22, 0): /* MEI #1 */
16  break;
17  case PCI_DEVFN(22, 1): /* MEI #2 */
19  break;
20  case PCI_DEVFN(22, 2): /* IDE-R */
22  break;
23  case PCI_DEVFN(22, 3): /* KT */
25  break;
26  case PCI_DEVFN(25, 0): /* Gigabit Ethernet */
28  break;
29  case PCI_DEVFN(26, 0): /* EHCI #2 */
31  break;
32  case PCI_DEVFN(27, 0): /* HD Audio Controller */
34  break;
35  case PCI_DEVFN(28, 0): /* PCI Express Root Port 1 */
36  case PCI_DEVFN(28, 1): /* PCI Express Root Port 2 */
37  case PCI_DEVFN(28, 2): /* PCI Express Root Port 3 */
38  case PCI_DEVFN(28, 3): /* PCI Express Root Port 4 */
39  case PCI_DEVFN(28, 4): /* PCI Express Root Port 5 */
40  case PCI_DEVFN(28, 5): /* PCI Express Root Port 6 */
41  case PCI_DEVFN(28, 6): /* PCI Express Root Port 7 */
42  case PCI_DEVFN(28, 7): /* PCI Express Root Port 8 */
44  break;
45  case PCI_DEVFN(29, 0): /* EHCI #1 */
47  break;
48  case PCI_DEVFN(31, 0): /* LPC */
50  break;
51  case PCI_DEVFN(31, 2): /* SATA #1 */
53  break;
54  case PCI_DEVFN(31, 3): /* SMBUS */
56  break;
57  case PCI_DEVFN(31, 5): /* SATA #22 */
59  break;
60  case PCI_DEVFN(31, 6): /* Thermal Subsystem */
62  break;
63  }
64 }
65 
66 void pch_enable(struct device *dev)
67 {
68  u16 reg16;
69 
70  if (!dev->enabled) {
71  printk(BIOS_DEBUG, "%s: Disabling device\n", dev_path(dev));
72 
73  /* Ensure memory, io, and bus master are all disabled */
74  reg16 = pci_read_config16(dev, PCI_COMMAND);
75  reg16 &= ~(PCI_COMMAND_MASTER |
77  pci_write_config16(dev, PCI_COMMAND, reg16);
78 
79  /* Disable this device if possible */
80  pch_disable_devfn(dev);
81  } else {
82  /* Enable SERR */
84  }
85 }
86 
88  CHIP_NAME("Intel Series 5 (Ibexpeak) Southbridge")
89  .enable_dev = pch_enable,
90 };
#define printk(level,...)
Definition: stdlib.h:16
const char * dev_path(const struct device *dev)
Definition: device_util.c:149
#define CHIP_NAME(X)
Definition: device.h:32
static __always_inline void pci_or_config16(const struct device *dev, u16 reg, u16 ormask)
Definition: pci_ops.h:180
static __always_inline u16 pci_read_config16(const struct device *dev, u16 reg)
Definition: pci_ops.h:52
static __always_inline void pci_write_config16(const struct device *dev, u16 reg, u16 val)
Definition: pci_ops.h:70
#define BIOS_DEBUG
BIOS_DEBUG - Verbose output.
Definition: loglevel.h:128
#define PCI_COMMAND_SERR
Definition: pci_def.h:19
#define PCI_DEVFN(slot, func)
Definition: pci_def.h:548
#define PCI_COMMAND_IO
Definition: pci_def.h:11
#define PCI_COMMAND_MASTER
Definition: pci_def.h:13
#define PCI_COMMAND_MEMORY
Definition: pci_def.h:12
#define PCI_FUNC(devfn)
Definition: pci_def.h:550
#define PCI_COMMAND
Definition: pci_def.h:10
#define PCH_DISABLE_HD_AUDIO
Definition: rcba.h:136
#define PCH_DISABLE_KT
Definition: rcba.h:146
#define PCH_DISABLE_MEI1
Definition: rcba.h:149
#define PCH_DISABLE_SMBUS
Definition: rcba.h:135
#define PCH_DISABLE_EHCI1
Definition: rcba.h:139
#define PCH_DISABLE_SATA2
Definition: rcba.h:142
#define PCH_DISABLE_GBE
Definition: rcba.h:124
#define BUC
Definition: rcba.h:123
#define PCH_DISABLE_LPC
Definition: rcba.h:138
#define PCH_DISABLE_EHCI2
Definition: rcba.h:137
#define FD2
Definition: rcba.h:128
#define FD
Definition: rcba.h:125
#define PCH_DISABLE_IDER
Definition: rcba.h:147
#define PCH_DISABLE_SATA1
Definition: rcba.h:134
#define PCH_DISABLE_THERMAL
Definition: rcba.h:141
#define PCH_DISABLE_PCIE(x)
Definition: rcba.h:140
#define PCH_DISABLE_MEI2
Definition: rcba.h:148
void pch_disable_devfn(struct device *dev)
Definition: pch.c:77
void pch_enable(struct device *dev)
Definition: pch.c:404
#define RCBA32_OR(x, or)
Definition: rcba.h:22
struct chip_operations southbridge_intel_ibexpeak_ops
Definition: pch.c:87
uint16_t u16
Definition: stdint.h:48
struct pci_path pci
Definition: path.h:116
Definition: device.h:107
struct device_path path
Definition: device.h:115
unsigned int enabled
Definition: device.h:122
unsigned int devfn
Definition: path.h:54