Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 4 | * |
| 5 | * This program is free software; you can redistribute it and/or |
| 6 | * modify it under the terms of the GNU General Public License as |
| 7 | * published by the Free Software Foundation; version 2 of |
| 8 | * the License. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 14 | */ |
| 15 | |
| 16 | #include <console/console.h> |
| 17 | #include <delay.h> |
Kyösti Mälkki | f1b58b7 | 2019-03-01 13:43:02 +0200 | [diff] [blame] | 18 | #include <device/pci_ops.h> |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 19 | #include <device/device.h> |
| 20 | #include <device/pci.h> |
Stefan Reinauer | 5605f1b | 2013-03-21 18:43:51 -0700 | [diff] [blame] | 21 | #include <device/pci_def.h> |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 22 | #include "pch.h" |
| 23 | |
Elyes HAOUAS | 1dcd8db | 2018-12-05 10:59:42 +0100 | [diff] [blame] | 24 | #ifdef __SIMPLE_DEVICE__ |
| 25 | static pci_devfn_t pch_get_lpc_device(void) |
Duncan Laurie | 5cc51c0 | 2013-03-07 14:06:43 -0800 | [diff] [blame] | 26 | { |
Duncan Laurie | 5cc51c0 | 2013-03-07 14:06:43 -0800 | [diff] [blame] | 27 | return PCI_DEV(0, 0x1f, 0); |
Duncan Laurie | 5cc51c0 | 2013-03-07 14:06:43 -0800 | [diff] [blame] | 28 | } |
Elyes HAOUAS | 1dcd8db | 2018-12-05 10:59:42 +0100 | [diff] [blame] | 29 | #else |
| 30 | static struct device *pch_get_lpc_device(void) |
| 31 | { |
Kyösti Mälkki | c70eed1 | 2018-05-22 02:18:00 +0300 | [diff] [blame] | 32 | return pcidev_on_root(0x1f, 0); |
Elyes HAOUAS | 1dcd8db | 2018-12-05 10:59:42 +0100 | [diff] [blame] | 33 | } |
| 34 | #endif |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 35 | |
| 36 | int pch_silicon_revision(void) |
| 37 | { |
Duncan Laurie | 5cc51c0 | 2013-03-07 14:06:43 -0800 | [diff] [blame] | 38 | static int pch_revision_id = -1; |
| 39 | |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 40 | if (pch_revision_id < 0) |
Duncan Laurie | 5cc51c0 | 2013-03-07 14:06:43 -0800 | [diff] [blame] | 41 | pch_revision_id = pci_read_config8(pch_get_lpc_device(), |
| 42 | PCI_REVISION_ID); |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 43 | return pch_revision_id; |
| 44 | } |
| 45 | |
Tristan Corrick | d3f01b2 | 2018-12-06 22:46:58 +1300 | [diff] [blame] | 46 | int pch_silicon_id(void) |
| 47 | { |
| 48 | static int pch_id = -1; |
| 49 | |
| 50 | if (pch_id < 0) |
| 51 | pch_id = pci_read_config16(pch_get_lpc_device(), PCI_DEVICE_ID); |
| 52 | |
| 53 | return pch_id; |
| 54 | } |
| 55 | |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 56 | int pch_silicon_type(void) |
| 57 | { |
Duncan Laurie | 5cc51c0 | 2013-03-07 14:06:43 -0800 | [diff] [blame] | 58 | static int pch_type = -1; |
| 59 | |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 60 | if (pch_type < 0) |
Duncan Laurie | 5cc51c0 | 2013-03-07 14:06:43 -0800 | [diff] [blame] | 61 | pch_type = pci_read_config8(pch_get_lpc_device(), |
| 62 | PCI_DEVICE_ID + 1); |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 63 | return pch_type; |
| 64 | } |
| 65 | |
Duncan Laurie | 5cc51c0 | 2013-03-07 14:06:43 -0800 | [diff] [blame] | 66 | int pch_is_lp(void) |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 67 | { |
Duncan Laurie | 5cc51c0 | 2013-03-07 14:06:43 -0800 | [diff] [blame] | 68 | return pch_silicon_type() == PCH_TYPE_LPT_LP; |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 69 | } |
| 70 | |
Duncan Laurie | 1ad5564 | 2013-03-07 14:08:04 -0800 | [diff] [blame] | 71 | u16 get_pmbase(void) |
| 72 | { |
| 73 | static u16 pmbase; |
| 74 | |
| 75 | if (!pmbase) |
| 76 | pmbase = pci_read_config16(pch_get_lpc_device(), |
| 77 | PMBASE) & 0xfffc; |
| 78 | return pmbase; |
| 79 | } |
| 80 | |
| 81 | u16 get_gpiobase(void) |
| 82 | { |
| 83 | static u16 gpiobase; |
| 84 | |
| 85 | if (!gpiobase) |
| 86 | gpiobase = pci_read_config16(pch_get_lpc_device(), |
| 87 | GPIOBASE) & 0xfffc; |
| 88 | return gpiobase; |
| 89 | } |
| 90 | |
Kyösti Mälkki | 21d6a27 | 2019-11-05 18:50:38 +0200 | [diff] [blame] | 91 | #ifndef __SIMPLE_DEVICE__ |
Duncan Laurie | 5cc51c0 | 2013-03-07 14:06:43 -0800 | [diff] [blame] | 92 | |
Duncan Laurie | 98c4062 | 2013-05-21 16:37:40 -0700 | [diff] [blame] | 93 | /* Put device in D3Hot Power State */ |
Elyes HAOUAS | 38f1d13 | 2018-09-17 08:44:18 +0200 | [diff] [blame] | 94 | static void pch_enable_d3hot(struct device *dev) |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 95 | { |
Duncan Laurie | 98c4062 | 2013-05-21 16:37:40 -0700 | [diff] [blame] | 96 | u32 reg32 = pci_read_config32(dev, PCH_PCS); |
| 97 | reg32 |= PCH_PCS_PS_D3HOT; |
| 98 | pci_write_config32(dev, PCH_PCS, reg32); |
| 99 | } |
| 100 | |
Frans Hendriks | e6bf51f | 2019-05-01 10:48:31 +0200 | [diff] [blame] | 101 | /* Set bit in function disable register to hide this device */ |
Elyes HAOUAS | 38f1d13 | 2018-09-17 08:44:18 +0200 | [diff] [blame] | 102 | void pch_disable_devfn(struct device *dev) |
Duncan Laurie | 98c4062 | 2013-05-21 16:37:40 -0700 | [diff] [blame] | 103 | { |
| 104 | switch (dev->path.pci.devfn) { |
Duncan Laurie | 26e7dd7 | 2012-12-19 09:12:31 -0800 | [diff] [blame] | 105 | case PCI_DEVFN(19, 0): /* Audio DSP */ |
| 106 | RCBA32_OR(FD, PCH_DISABLE_ADSPD); |
| 107 | break; |
| 108 | case PCI_DEVFN(20, 0): /* XHCI */ |
| 109 | RCBA32_OR(FD, PCH_DISABLE_XHCI); |
| 110 | break; |
Duncan Laurie | 71346c0 | 2013-01-10 13:20:40 -0800 | [diff] [blame] | 111 | case PCI_DEVFN(21, 0): /* DMA */ |
Duncan Laurie | 98c4062 | 2013-05-21 16:37:40 -0700 | [diff] [blame] | 112 | pch_enable_d3hot(dev); |
Duncan Laurie | 71346c0 | 2013-01-10 13:20:40 -0800 | [diff] [blame] | 113 | pch_iobp_update(SIO_IOBP_FUNCDIS0, ~0UL, SIO_IOBP_FUNCDIS_DIS); |
| 114 | break; |
| 115 | case PCI_DEVFN(21, 1): /* I2C0 */ |
Duncan Laurie | 98c4062 | 2013-05-21 16:37:40 -0700 | [diff] [blame] | 116 | pch_enable_d3hot(dev); |
Duncan Laurie | 71346c0 | 2013-01-10 13:20:40 -0800 | [diff] [blame] | 117 | pch_iobp_update(SIO_IOBP_FUNCDIS1, ~0UL, SIO_IOBP_FUNCDIS_DIS); |
| 118 | break; |
| 119 | case PCI_DEVFN(21, 2): /* I2C1 */ |
Duncan Laurie | 98c4062 | 2013-05-21 16:37:40 -0700 | [diff] [blame] | 120 | pch_enable_d3hot(dev); |
Duncan Laurie | 71346c0 | 2013-01-10 13:20:40 -0800 | [diff] [blame] | 121 | pch_iobp_update(SIO_IOBP_FUNCDIS2, ~0UL, SIO_IOBP_FUNCDIS_DIS); |
| 122 | break; |
| 123 | case PCI_DEVFN(21, 3): /* SPI0 */ |
Duncan Laurie | 98c4062 | 2013-05-21 16:37:40 -0700 | [diff] [blame] | 124 | pch_enable_d3hot(dev); |
Duncan Laurie | 71346c0 | 2013-01-10 13:20:40 -0800 | [diff] [blame] | 125 | pch_iobp_update(SIO_IOBP_FUNCDIS3, ~0UL, SIO_IOBP_FUNCDIS_DIS); |
| 126 | break; |
| 127 | case PCI_DEVFN(21, 4): /* SPI1 */ |
Duncan Laurie | 98c4062 | 2013-05-21 16:37:40 -0700 | [diff] [blame] | 128 | pch_enable_d3hot(dev); |
Duncan Laurie | 71346c0 | 2013-01-10 13:20:40 -0800 | [diff] [blame] | 129 | pch_iobp_update(SIO_IOBP_FUNCDIS4, ~0UL, SIO_IOBP_FUNCDIS_DIS); |
| 130 | break; |
| 131 | case PCI_DEVFN(21, 5): /* UART0 */ |
Duncan Laurie | 98c4062 | 2013-05-21 16:37:40 -0700 | [diff] [blame] | 132 | pch_enable_d3hot(dev); |
Duncan Laurie | 71346c0 | 2013-01-10 13:20:40 -0800 | [diff] [blame] | 133 | pch_iobp_update(SIO_IOBP_FUNCDIS5, ~0UL, SIO_IOBP_FUNCDIS_DIS); |
| 134 | break; |
| 135 | case PCI_DEVFN(21, 6): /* UART1 */ |
Duncan Laurie | 98c4062 | 2013-05-21 16:37:40 -0700 | [diff] [blame] | 136 | pch_enable_d3hot(dev); |
Duncan Laurie | 71346c0 | 2013-01-10 13:20:40 -0800 | [diff] [blame] | 137 | pch_iobp_update(SIO_IOBP_FUNCDIS6, ~0UL, SIO_IOBP_FUNCDIS_DIS); |
| 138 | break; |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 139 | case PCI_DEVFN(22, 0): /* MEI #1 */ |
| 140 | RCBA32_OR(FD2, PCH_DISABLE_MEI1); |
| 141 | break; |
| 142 | case PCI_DEVFN(22, 1): /* MEI #2 */ |
| 143 | RCBA32_OR(FD2, PCH_DISABLE_MEI2); |
| 144 | break; |
| 145 | case PCI_DEVFN(22, 2): /* IDE-R */ |
| 146 | RCBA32_OR(FD2, PCH_DISABLE_IDER); |
| 147 | break; |
| 148 | case PCI_DEVFN(22, 3): /* KT */ |
| 149 | RCBA32_OR(FD2, PCH_DISABLE_KT); |
| 150 | break; |
Duncan Laurie | 71346c0 | 2013-01-10 13:20:40 -0800 | [diff] [blame] | 151 | case PCI_DEVFN(23, 0): /* SDIO */ |
Duncan Laurie | 98c4062 | 2013-05-21 16:37:40 -0700 | [diff] [blame] | 152 | pch_enable_d3hot(dev); |
Duncan Laurie | 71346c0 | 2013-01-10 13:20:40 -0800 | [diff] [blame] | 153 | pch_iobp_update(SIO_IOBP_FUNCDIS7, ~0UL, SIO_IOBP_FUNCDIS_DIS); |
| 154 | break; |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 155 | case PCI_DEVFN(25, 0): /* Gigabit Ethernet */ |
| 156 | RCBA32_OR(BUC, PCH_DISABLE_GBE); |
| 157 | break; |
| 158 | case PCI_DEVFN(26, 0): /* EHCI #2 */ |
| 159 | RCBA32_OR(FD, PCH_DISABLE_EHCI2); |
| 160 | break; |
| 161 | case PCI_DEVFN(27, 0): /* HD Audio Controller */ |
| 162 | RCBA32_OR(FD, PCH_DISABLE_HD_AUDIO); |
| 163 | break; |
| 164 | case PCI_DEVFN(28, 0): /* PCI Express Root Port 1 */ |
| 165 | case PCI_DEVFN(28, 1): /* PCI Express Root Port 2 */ |
| 166 | case PCI_DEVFN(28, 2): /* PCI Express Root Port 3 */ |
| 167 | case PCI_DEVFN(28, 3): /* PCI Express Root Port 4 */ |
| 168 | case PCI_DEVFN(28, 4): /* PCI Express Root Port 5 */ |
| 169 | case PCI_DEVFN(28, 5): /* PCI Express Root Port 6 */ |
| 170 | case PCI_DEVFN(28, 6): /* PCI Express Root Port 7 */ |
| 171 | case PCI_DEVFN(28, 7): /* PCI Express Root Port 8 */ |
Duncan Laurie | 98c4062 | 2013-05-21 16:37:40 -0700 | [diff] [blame] | 172 | RCBA32_OR(FD, PCH_DISABLE_PCIE(PCI_FUNC(dev->path.pci.devfn))); |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 173 | break; |
| 174 | case PCI_DEVFN(29, 0): /* EHCI #1 */ |
| 175 | RCBA32_OR(FD, PCH_DISABLE_EHCI1); |
| 176 | break; |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 177 | case PCI_DEVFN(31, 0): /* LPC */ |
| 178 | RCBA32_OR(FD, PCH_DISABLE_LPC); |
| 179 | break; |
| 180 | case PCI_DEVFN(31, 2): /* SATA #1 */ |
| 181 | RCBA32_OR(FD, PCH_DISABLE_SATA1); |
| 182 | break; |
| 183 | case PCI_DEVFN(31, 3): /* SMBUS */ |
| 184 | RCBA32_OR(FD, PCH_DISABLE_SMBUS); |
| 185 | break; |
Duncan Laurie | 26e7dd7 | 2012-12-19 09:12:31 -0800 | [diff] [blame] | 186 | case PCI_DEVFN(31, 5): /* SATA #2 */ |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 187 | RCBA32_OR(FD, PCH_DISABLE_SATA2); |
| 188 | break; |
| 189 | case PCI_DEVFN(31, 6): /* Thermal Subsystem */ |
| 190 | RCBA32_OR(FD, PCH_DISABLE_THERMAL); |
| 191 | break; |
| 192 | } |
| 193 | } |
| 194 | |
| 195 | #define IOBP_RETRY 1000 |
| 196 | static inline int iobp_poll(void) |
| 197 | { |
Martin Roth | ff744bf | 2019-10-23 21:46:03 -0600 | [diff] [blame] | 198 | unsigned int try; |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 199 | |
Duncan Laurie | 7302d1e | 2013-01-10 13:19:23 -0800 | [diff] [blame] | 200 | for (try = IOBP_RETRY; try > 0; try--) { |
| 201 | u16 status = RCBA16(IOBPS); |
| 202 | if ((status & IOBPS_READY) == 0) |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 203 | return 1; |
| 204 | udelay(10); |
| 205 | } |
| 206 | |
Duncan Laurie | 7302d1e | 2013-01-10 13:19:23 -0800 | [diff] [blame] | 207 | printk(BIOS_ERR, "IOBP: timeout waiting for transaction to complete\n"); |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 208 | return 0; |
| 209 | } |
| 210 | |
Aaron Durbin | c17aac3 | 2013-06-19 13:12:48 -0500 | [diff] [blame] | 211 | u32 pch_iobp_read(u32 address) |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 212 | { |
Duncan Laurie | 7302d1e | 2013-01-10 13:19:23 -0800 | [diff] [blame] | 213 | u16 status; |
| 214 | |
| 215 | if (!iobp_poll()) |
| 216 | return 0; |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 217 | |
| 218 | /* Set the address */ |
| 219 | RCBA32(IOBPIRI) = address; |
| 220 | |
| 221 | /* READ OPCODE */ |
Duncan Laurie | 7302d1e | 2013-01-10 13:19:23 -0800 | [diff] [blame] | 222 | status = RCBA16(IOBPS); |
| 223 | status &= ~IOBPS_MASK; |
| 224 | status |= IOBPS_READ; |
| 225 | RCBA16(IOBPS) = status; |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 226 | |
Duncan Laurie | 7302d1e | 2013-01-10 13:19:23 -0800 | [diff] [blame] | 227 | /* Undocumented magic */ |
| 228 | RCBA16(IOBPU) = IOBPU_MAGIC; |
| 229 | |
| 230 | /* Set ready bit */ |
| 231 | status = RCBA16(IOBPS); |
| 232 | status |= IOBPS_READY; |
| 233 | RCBA16(IOBPS) = status; |
| 234 | |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 235 | if (!iobp_poll()) |
Duncan Laurie | 7302d1e | 2013-01-10 13:19:23 -0800 | [diff] [blame] | 236 | return 0; |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 237 | |
| 238 | /* Check for successful transaction */ |
Duncan Laurie | 7302d1e | 2013-01-10 13:19:23 -0800 | [diff] [blame] | 239 | status = RCBA16(IOBPS); |
| 240 | if (status & IOBPS_TX_MASK) { |
| 241 | printk(BIOS_ERR, "IOBP: read 0x%08x failed\n", address); |
| 242 | return 0; |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 243 | } |
| 244 | |
Duncan Laurie | 7302d1e | 2013-01-10 13:19:23 -0800 | [diff] [blame] | 245 | /* Read IOBP data */ |
| 246 | return RCBA32(IOBPD); |
| 247 | } |
| 248 | |
Aaron Durbin | c17aac3 | 2013-06-19 13:12:48 -0500 | [diff] [blame] | 249 | void pch_iobp_write(u32 address, u32 data) |
Duncan Laurie | 7302d1e | 2013-01-10 13:19:23 -0800 | [diff] [blame] | 250 | { |
| 251 | u16 status; |
Aaron Durbin | c17aac3 | 2013-06-19 13:12:48 -0500 | [diff] [blame] | 252 | |
| 253 | if (!iobp_poll()) |
| 254 | return; |
| 255 | |
| 256 | /* Set the address */ |
| 257 | RCBA32(IOBPIRI) = address; |
Duncan Laurie | 7302d1e | 2013-01-10 13:19:23 -0800 | [diff] [blame] | 258 | |
| 259 | /* WRITE OPCODE */ |
| 260 | status = RCBA16(IOBPS); |
| 261 | status &= ~IOBPS_MASK; |
| 262 | status |= IOBPS_WRITE; |
| 263 | RCBA16(IOBPS) = status; |
| 264 | |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 265 | RCBA32(IOBPD) = data; |
Duncan Laurie | 7302d1e | 2013-01-10 13:19:23 -0800 | [diff] [blame] | 266 | |
| 267 | /* Undocumented magic */ |
| 268 | RCBA16(IOBPU) = IOBPU_MAGIC; |
| 269 | |
| 270 | /* Set ready bit */ |
| 271 | status = RCBA16(IOBPS); |
| 272 | status |= IOBPS_READY; |
| 273 | RCBA16(IOBPS) = status; |
| 274 | |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 275 | if (!iobp_poll()) |
| 276 | return; |
Duncan Laurie | 7302d1e | 2013-01-10 13:19:23 -0800 | [diff] [blame] | 277 | |
| 278 | /* Check for successful transaction */ |
| 279 | status = RCBA16(IOBPS); |
| 280 | if (status & IOBPS_TX_MASK) { |
| 281 | printk(BIOS_ERR, "IOBP: write 0x%08x failed\n", address); |
| 282 | return; |
| 283 | } |
| 284 | |
| 285 | printk(BIOS_INFO, "IOBP: set 0x%08x to 0x%08x\n", address, data); |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 286 | } |
| 287 | |
Aaron Durbin | c17aac3 | 2013-06-19 13:12:48 -0500 | [diff] [blame] | 288 | void pch_iobp_update(u32 address, u32 andvalue, u32 orvalue) |
| 289 | { |
| 290 | u32 data = pch_iobp_read(address); |
| 291 | |
| 292 | /* Update the data */ |
| 293 | data &= andvalue; |
| 294 | data |= orvalue; |
| 295 | |
| 296 | pch_iobp_write(address, data); |
| 297 | } |
| 298 | |
Elyes HAOUAS | 38f1d13 | 2018-09-17 08:44:18 +0200 | [diff] [blame] | 299 | void pch_enable(struct device *dev) |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 300 | { |
| 301 | u32 reg32; |
| 302 | |
Aaron Durbin | c0254e6 | 2013-06-20 01:20:30 -0500 | [diff] [blame] | 303 | /* PCH PCIe Root Ports are handled in PCIe driver. */ |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 304 | if (PCI_SLOT(dev->path.pci.devfn) == PCH_PCIE_DEV_SLOT) |
Aaron Durbin | c0254e6 | 2013-06-20 01:20:30 -0500 | [diff] [blame] | 305 | return; |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 306 | |
| 307 | if (!dev->enabled) { |
| 308 | printk(BIOS_DEBUG, "%s: Disabling device\n", dev_path(dev)); |
| 309 | |
| 310 | /* Ensure memory, io, and bus master are all disabled */ |
| 311 | reg32 = pci_read_config32(dev, PCI_COMMAND); |
| 312 | reg32 &= ~(PCI_COMMAND_MASTER | |
| 313 | PCI_COMMAND_MEMORY | PCI_COMMAND_IO); |
| 314 | pci_write_config32(dev, PCI_COMMAND, reg32); |
| 315 | |
Aaron Durbin | 3fcd356 | 2013-06-19 13:20:37 -0500 | [diff] [blame] | 316 | /* Disable this device if possible */ |
| 317 | pch_disable_devfn(dev); |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 318 | } else { |
| 319 | /* Enable SERR */ |
| 320 | reg32 = pci_read_config32(dev, PCI_COMMAND); |
| 321 | reg32 |= PCI_COMMAND_SERR; |
| 322 | pci_write_config32(dev, PCI_COMMAND, reg32); |
| 323 | } |
| 324 | } |
| 325 | |
| 326 | struct chip_operations southbridge_intel_lynxpoint_ops = { |
| 327 | CHIP_NAME("Intel Series 8 (Lynx Point) Southbridge") |
| 328 | .enable_dev = pch_enable, |
| 329 | }; |
Duncan Laurie | 5cc51c0 | 2013-03-07 14:06:43 -0800 | [diff] [blame] | 330 | |
Kyösti Mälkki | 21d6a27 | 2019-11-05 18:50:38 +0200 | [diff] [blame] | 331 | #endif /* __SIMPLE_DEVICE__ */ |