Angel Pons | f94ac9a | 2020-04-05 15:46:48 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 2 | |
| 3 | #include <console/console.h> |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 4 | #include <device/device.h> |
| 5 | #include <device/pci.h> |
| 6 | #include <device/pci_ids.h> |
Kyösti Mälkki | cbf9571 | 2020-01-05 08:05:45 +0200 | [diff] [blame] | 7 | #include <option.h> |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 8 | #include <pc80/isa-dma.h> |
| 9 | #include <pc80/i8259.h> |
Kyösti Mälkki | f1b58b7 | 2019-03-01 13:43:02 +0200 | [diff] [blame] | 10 | #include <device/pci_ops.h> |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 11 | #include <arch/ioapic.h> |
Furquan Shaikh | 76cedd2 | 2020-05-02 10:24:23 -0700 | [diff] [blame] | 12 | #include <acpi/acpi.h> |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 13 | #include <cpu/x86/smm.h> |
Julius Werner | 4ee4bd5 | 2014-10-20 13:46:39 -0700 | [diff] [blame] | 14 | #include <soc/iomap.h> |
| 15 | #include <soc/lpc.h> |
Julius Werner | 4ee4bd5 | 2014-10-20 13:46:39 -0700 | [diff] [blame] | 16 | #include <soc/pch.h> |
| 17 | #include <soc/pci_devs.h> |
| 18 | #include <soc/pm.h> |
Julius Werner | 4ee4bd5 | 2014-10-20 13:46:39 -0700 | [diff] [blame] | 19 | #include <soc/rcba.h> |
Angel Pons | 3cc2c38 | 2020-10-23 20:38:23 +0200 | [diff] [blame] | 20 | #include <soc/intel/broadwell/pch/chip.h> |
Furquan Shaikh | 76cedd2 | 2020-05-02 10:24:23 -0700 | [diff] [blame] | 21 | #include <acpi/acpigen.h> |
Arthur Heymans | 2abbe46 | 2019-06-04 14:12:01 +0200 | [diff] [blame] | 22 | #include <southbridge/intel/common/rtc.h> |
Angel Pons | c423ce2 | 2021-04-19 16:13:31 +0200 | [diff] [blame] | 23 | #include <southbridge/intel/lynxpoint/iobp.h> |
Angel Pons | 733f03d | 2021-01-28 16:59:04 +0100 | [diff] [blame] | 24 | #include <southbridge/intel/lynxpoint/lp_gpio.h> |
Duncan Laurie | 35dc00f | 2015-01-18 14:06:42 -0800 | [diff] [blame] | 25 | |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 26 | static void pch_enable_ioapic(struct device *dev) |
| 27 | { |
| 28 | u32 reg32; |
| 29 | |
Matt DeVillier | 81a6f10 | 2018-02-19 17:33:48 -0600 | [diff] [blame] | 30 | /* Assign unique bus/dev/fn for I/O APIC */ |
| 31 | pci_write_config16(dev, LPC_IBDF, |
| 32 | PCH_IOAPIC_PCI_BUS << 8 | PCH_IOAPIC_PCI_SLOT << 3); |
| 33 | |
Kevin Paul Herbert | bde6d30 | 2014-12-24 18:43:20 -0800 | [diff] [blame] | 34 | set_ioapic_id(VIO_APIC_VADDR, 0x02); |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 35 | |
| 36 | /* affirm full set of redirection table entries ("write once") */ |
Kevin Paul Herbert | bde6d30 | 2014-12-24 18:43:20 -0800 | [diff] [blame] | 37 | reg32 = io_apic_read(VIO_APIC_VADDR, 0x01); |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 38 | |
| 39 | /* PCH-LP has 39 redirection entries */ |
| 40 | reg32 &= ~0x00ff0000; |
| 41 | reg32 |= 0x00270000; |
| 42 | |
Kevin Paul Herbert | bde6d30 | 2014-12-24 18:43:20 -0800 | [diff] [blame] | 43 | io_apic_write(VIO_APIC_VADDR, 0x01, reg32); |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 44 | } |
| 45 | |
Matt DeVillier | 81a6f10 | 2018-02-19 17:33:48 -0600 | [diff] [blame] | 46 | static void enable_hpet(struct device *dev) |
| 47 | { |
| 48 | size_t i; |
| 49 | |
| 50 | /* Assign unique bus/dev/fn for each HPET */ |
| 51 | for (i = 0; i < 8; ++i) |
| 52 | pci_write_config16(dev, LPC_HnBDF(i), |
| 53 | PCH_HPET_PCI_BUS << 8 | PCH_HPET_PCI_SLOT << 3 | i); |
| 54 | } |
| 55 | |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 56 | /* PIRQ[n]_ROUT[3:0] - PIRQ Routing Control |
| 57 | * 0x00 - 0000 = Reserved |
| 58 | * 0x01 - 0001 = Reserved |
| 59 | * 0x02 - 0010 = Reserved |
| 60 | * 0x03 - 0011 = IRQ3 |
| 61 | * 0x04 - 0100 = IRQ4 |
| 62 | * 0x05 - 0101 = IRQ5 |
| 63 | * 0x06 - 0110 = IRQ6 |
| 64 | * 0x07 - 0111 = IRQ7 |
| 65 | * 0x08 - 1000 = Reserved |
| 66 | * 0x09 - 1001 = IRQ9 |
| 67 | * 0x0A - 1010 = IRQ10 |
| 68 | * 0x0B - 1011 = IRQ11 |
| 69 | * 0x0C - 1100 = IRQ12 |
| 70 | * 0x0D - 1101 = Reserved |
| 71 | * 0x0E - 1110 = IRQ14 |
| 72 | * 0x0F - 1111 = IRQ15 |
| 73 | * PIRQ[n]_ROUT[7] - PIRQ Routing Control |
| 74 | * 0x80 - The PIRQ is not routed. |
| 75 | */ |
| 76 | |
Elyes HAOUAS | 040aff2 | 2018-05-27 16:30:36 +0200 | [diff] [blame] | 77 | static void pch_pirq_init(struct device *dev) |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 78 | { |
Elyes HAOUAS | 040aff2 | 2018-05-27 16:30:36 +0200 | [diff] [blame] | 79 | struct device *irq_dev; |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 80 | |
Angel Pons | 4a6c0a3 | 2020-07-25 15:11:15 +0200 | [diff] [blame] | 81 | const uint8_t pirq = 0x80; |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 82 | |
Angel Pons | 4a6c0a3 | 2020-07-25 15:11:15 +0200 | [diff] [blame] | 83 | pci_write_config8(dev, PIRQA_ROUT, pirq); |
| 84 | pci_write_config8(dev, PIRQB_ROUT, pirq); |
| 85 | pci_write_config8(dev, PIRQC_ROUT, pirq); |
| 86 | pci_write_config8(dev, PIRQD_ROUT, pirq); |
| 87 | |
| 88 | pci_write_config8(dev, PIRQE_ROUT, pirq); |
| 89 | pci_write_config8(dev, PIRQF_ROUT, pirq); |
| 90 | pci_write_config8(dev, PIRQG_ROUT, pirq); |
| 91 | pci_write_config8(dev, PIRQH_ROUT, pirq); |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 92 | |
Elyes HAOUAS | 4a83f1c | 2016-08-25 21:07:59 +0200 | [diff] [blame] | 93 | for (irq_dev = all_devices; irq_dev; irq_dev = irq_dev->next) { |
Lee Leahy | 26b7cd0 | 2017-03-16 18:47:55 -0700 | [diff] [blame] | 94 | u8 int_pin = 0, int_line = 0; |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 95 | |
| 96 | if (!irq_dev->enabled || irq_dev->path.type != DEVICE_PATH_PCI) |
| 97 | continue; |
| 98 | |
| 99 | int_pin = pci_read_config8(irq_dev, PCI_INTERRUPT_PIN); |
| 100 | |
| 101 | switch (int_pin) { |
Lee Leahy | 8a9c7dc | 2017-03-17 10:43:25 -0700 | [diff] [blame] | 102 | case 1: /* INTA# */ |
Lee Leahy | 8a9c7dc | 2017-03-17 10:43:25 -0700 | [diff] [blame] | 103 | case 2: /* INTB# */ |
Lee Leahy | 8a9c7dc | 2017-03-17 10:43:25 -0700 | [diff] [blame] | 104 | case 3: /* INTC# */ |
Lee Leahy | 8a9c7dc | 2017-03-17 10:43:25 -0700 | [diff] [blame] | 105 | case 4: /* INTD# */ |
Angel Pons | 4a6c0a3 | 2020-07-25 15:11:15 +0200 | [diff] [blame] | 106 | int_line = pirq; |
Lee Leahy | 8a9c7dc | 2017-03-17 10:43:25 -0700 | [diff] [blame] | 107 | break; |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 108 | } |
| 109 | |
| 110 | if (!int_line) |
| 111 | continue; |
| 112 | |
| 113 | pci_write_config8(irq_dev, PCI_INTERRUPT_LINE, int_line); |
| 114 | } |
| 115 | } |
| 116 | |
Elyes HAOUAS | 040aff2 | 2018-05-27 16:30:36 +0200 | [diff] [blame] | 117 | static void pch_power_options(struct device *dev) |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 118 | { |
| 119 | u16 reg16; |
| 120 | const char *state; |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 121 | |
| 122 | /* Which state do we want to goto after g3 (power restored)? |
| 123 | * 0 == S0 Full On |
| 124 | * 1 == S5 Soft Off |
| 125 | * |
| 126 | * If the option is not existent (Laptops), use Kconfig setting. |
| 127 | */ |
Angel Pons | 88dcb31 | 2021-04-26 17:10:28 +0200 | [diff] [blame] | 128 | const unsigned int pwr_on = get_uint_option("power_on_after_fail", |
Angel Pons | 62719a3 | 2021-04-19 13:15:28 +0200 | [diff] [blame] | 129 | CONFIG_MAINBOARD_POWER_FAILURE_STATE); |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 130 | |
| 131 | reg16 = pci_read_config16(dev, GEN_PMCON_3); |
| 132 | reg16 &= 0xfffe; |
| 133 | switch (pwr_on) { |
| 134 | case MAINBOARD_POWER_OFF: |
| 135 | reg16 |= 1; |
| 136 | state = "off"; |
| 137 | break; |
| 138 | case MAINBOARD_POWER_ON: |
| 139 | reg16 &= ~1; |
| 140 | state = "on"; |
| 141 | break; |
| 142 | case MAINBOARD_POWER_KEEP: |
| 143 | reg16 &= ~1; |
| 144 | state = "state keep"; |
| 145 | break; |
| 146 | default: |
| 147 | state = "undefined"; |
| 148 | } |
Angel Pons | 6fb87c2 | 2020-10-30 20:40:48 +0100 | [diff] [blame] | 149 | |
| 150 | reg16 &= ~(3 << 4); /* SLP_S4# Assertion Stretch 4s */ |
| 151 | reg16 |= (1 << 3); /* SLP_S4# Assertion Stretch Enable */ |
| 152 | |
| 153 | reg16 &= ~(1 << 10); |
| 154 | reg16 |= (1 << 11); /* SLP_S3# Min Assertion Width 50ms */ |
| 155 | |
| 156 | reg16 |= (1 << 12); /* Disable SLP stretch after SUS well */ |
| 157 | |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 158 | pci_write_config16(dev, GEN_PMCON_3, reg16); |
| 159 | printk(BIOS_INFO, "Set power %s after power failure.\n", state); |
| 160 | |
Angel Pons | 02414f8 | 2020-10-28 13:50:38 +0100 | [diff] [blame] | 161 | if (dev->chip_info) { |
| 162 | const struct soc_intel_broadwell_pch_config *config = dev->chip_info; |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 163 | |
Angel Pons | 02414f8 | 2020-10-28 13:50:38 +0100 | [diff] [blame] | 164 | /* GPE setup based on device tree configuration */ |
| 165 | enable_all_gpe(config->gpe0_en_1, config->gpe0_en_2, |
| 166 | config->gpe0_en_3, config->gpe0_en_4); |
| 167 | |
| 168 | /* SMI setup based on device tree configuration */ |
| 169 | enable_alt_smi(config->alt_gp_smi_en); |
| 170 | } |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 171 | } |
| 172 | |
Angel Pons | f2e2b96 | 2020-10-13 20:19:40 +0200 | [diff] [blame] | 173 | static void pch_misc_init(struct device *dev) |
| 174 | { |
| 175 | u8 reg8; |
Angel Pons | f2e2b96 | 2020-10-13 20:19:40 +0200 | [diff] [blame] | 176 | u32 reg32; |
| 177 | |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 178 | /* Prepare sleep mode */ |
Angel Pons | f2e2b96 | 2020-10-13 20:19:40 +0200 | [diff] [blame] | 179 | reg32 = inl(ACPI_BASE_ADDRESS + PM1_CNT); |
| 180 | reg32 &= ~SLP_TYP; |
| 181 | reg32 |= SCI_EN; |
| 182 | outl(reg32, ACPI_BASE_ADDRESS + PM1_CNT); |
| 183 | |
| 184 | /* Set up NMI on errors */ |
| 185 | reg8 = inb(0x61); |
| 186 | reg8 &= ~0xf0; /* Higher nibble must be 0 */ |
| 187 | reg8 |= (1 << 2); /* PCI SERR# disable for now */ |
| 188 | outb(reg8, 0x61); |
| 189 | |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 190 | /* Disable NMI sources */ |
Angel Pons | f2e2b96 | 2020-10-13 20:19:40 +0200 | [diff] [blame] | 191 | reg8 = inb(0x70); |
| 192 | reg8 |= (1 << 7); /* Can't mask NMI from PCI-E and NMI_NOW */ |
| 193 | outb(reg8, 0x70); |
| 194 | |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 195 | /* Indicate DRAM init done for MRC */ |
Angel Pons | f2e2b96 | 2020-10-13 20:19:40 +0200 | [diff] [blame] | 196 | pci_or_config8(dev, GEN_PMCON_2, 1 << 7); |
| 197 | |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 198 | /* Enable BIOS updates outside of SMM */ |
Angel Pons | f2e2b96 | 2020-10-13 20:19:40 +0200 | [diff] [blame] | 199 | pci_and_config8(dev, BIOS_CNTL, ~(1 << 5)); |
| 200 | |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 201 | /* Clear status bits to prevent unexpected wake */ |
Angel Pons | f2e2b96 | 2020-10-13 20:19:40 +0200 | [diff] [blame] | 202 | RCBA32_OR(0x3310, 0x2f); |
| 203 | |
| 204 | RCBA32_AND_OR(0x3f02, ~0xf, 0); |
| 205 | |
Kenji Chen | 074a028 | 2014-09-20 01:39:20 +0800 | [diff] [blame] | 206 | /* Enable PCIe Releaxed Order */ |
Angel Pons | f2e2b96 | 2020-10-13 20:19:40 +0200 | [diff] [blame] | 207 | RCBA32_OR(0x2314, (1 << 31) | (1 << 7)), |
| 208 | RCBA32_OR(0x1114, (1 << 15) | (1 << 14)), |
| 209 | |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 210 | /* Setup SERIRQ, enable continuous mode */ |
Angel Pons | f2e2b96 | 2020-10-13 20:19:40 +0200 | [diff] [blame] | 211 | reg8 = pci_read_config8(dev, SERIRQ_CNTL); |
| 212 | reg8 |= 1 << 7; |
| 213 | |
| 214 | if (CONFIG(SERIRQ_CONTINUOUS_MODE)) |
| 215 | reg8 |= 1 << 6; |
| 216 | |
| 217 | pci_write_config8(dev, SERIRQ_CNTL, reg8); |
| 218 | } |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 219 | |
| 220 | /* Magic register settings for power management */ |
Angel Pons | 2436ac0 | 2020-10-13 20:03:49 +0200 | [diff] [blame] | 221 | static void pch_pm_init_magic(struct device *dev) |
| 222 | { |
| 223 | pci_write_config8(dev, 0xa9, 0x46); |
| 224 | |
| 225 | RCBA32_AND_OR(0x232c, ~1, 0); |
| 226 | |
| 227 | RCBA32_OR(0x1100, 0x0000c13f); |
| 228 | |
| 229 | RCBA32_AND_OR(0x2320, ~0x60, 0x10); |
| 230 | |
| 231 | RCBA32(0x3314) = 0x00012fff; |
| 232 | |
| 233 | RCBA32_AND_OR(0x3318, ~0x000f0330, 0x0dcf0400); |
| 234 | |
| 235 | RCBA32(0x3324) = 0x04000000; |
| 236 | RCBA32(0x3368) = 0x00041400; |
| 237 | RCBA32(0x3388) = 0x3f8ddbff; |
| 238 | RCBA32(0x33ac) = 0x00007001; |
| 239 | RCBA32(0x33b0) = 0x00181900; |
| 240 | RCBA32(0x33c0) = 0x00060A00; |
| 241 | RCBA32(0x33d0) = 0x06200840; |
| 242 | RCBA32(0x3a28) = 0x01010101; |
| 243 | RCBA32(0x3a2c) = 0x040c0404; |
| 244 | RCBA32(0x3a9c) = 0x9000000a; |
| 245 | RCBA32(0x2b1c) = 0x03808033; |
| 246 | RCBA32(0x2b34) = 0x80000009; |
| 247 | RCBA32(0x3348) = 0x022ddfff; |
| 248 | RCBA32(0x334c) = 0x00000001; |
| 249 | RCBA32(0x3358) = 0x0001c000; |
| 250 | RCBA32(0x3380) = 0x3f8ddbff; |
| 251 | RCBA32(0x3384) = 0x0001c7e1; |
| 252 | RCBA32(0x338c) = 0x0001c7e1; |
| 253 | RCBA32(0x3398) = 0x0001c000; |
| 254 | RCBA32(0x33a8) = 0x00181900; |
| 255 | RCBA32(0x33dc) = 0x00080000; |
| 256 | RCBA32(0x33e0) = 0x00000001; |
| 257 | RCBA32(0x3a20) = 0x0000040c; |
| 258 | RCBA32(0x3a24) = 0x01010101; |
| 259 | RCBA32(0x3a30) = 0x01010101; |
| 260 | |
| 261 | pci_update_config32(dev, 0xac, ~0x00200000, 0); |
| 262 | |
| 263 | RCBA32_OR(0x0410, 0x00000003); |
| 264 | RCBA32_OR(0x2618, 0x08000000); |
| 265 | RCBA32_OR(0x2300, 0x00000002); |
| 266 | RCBA32_OR(0x2600, 0x00000008); |
| 267 | |
| 268 | RCBA32(0x33b4) = 0x00007001; |
| 269 | RCBA32(0x3350) = 0x022ddfff; |
| 270 | RCBA32(0x3354) = 0x00000001; |
| 271 | |
Duncan Laurie | 446fb8e | 2014-08-08 09:59:43 -0700 | [diff] [blame] | 272 | /* Power Optimizer */ |
Angel Pons | 2436ac0 | 2020-10-13 20:03:49 +0200 | [diff] [blame] | 273 | RCBA32_OR(0x33d4, 0x08000000); |
| 274 | RCBA32_OR(0x33c8, 0x00000080); |
| 275 | |
| 276 | RCBA32(0x2b10) = 0x0000883c; |
| 277 | RCBA32(0x2b14) = 0x1e0a4616; |
| 278 | RCBA32(0x2b24) = 0x40000005; |
| 279 | RCBA32(0x2b20) = 0x0005db01; |
| 280 | RCBA32(0x3a80) = 0x05145005; |
| 281 | RCBA32(0x3a84) = 0x00001005; |
| 282 | |
| 283 | RCBA32_OR(0x33d4, 0x2fff2fb1); |
| 284 | RCBA32_OR(0x33c8, 0x00008000); |
| 285 | } |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 286 | |
| 287 | static void pch_enable_mphy(void) |
| 288 | { |
| 289 | u32 gpio71_native = gpio_is_native(71); |
| 290 | u32 data_and = 0xffffffff; |
| 291 | u32 data_or = (1 << 14) | (1 << 13) | (1 << 12); |
| 292 | |
| 293 | if (gpio71_native) { |
| 294 | data_or |= (1 << 0); |
| 295 | if (pch_is_wpt()) { |
| 296 | data_and &= ~((1 << 7) | (1 << 6) | (1 << 3)); |
| 297 | data_or |= (1 << 5) | (1 << 4); |
| 298 | |
| 299 | if (pch_is_wpt_ulx()) { |
| 300 | /* Check if SATA and USB3 MPHY are enabled */ |
| 301 | u32 strap19 = pch_read_soft_strap(19); |
| 302 | strap19 &= ((1 << 31) | (1 << 30)); |
| 303 | strap19 >>= 30; |
| 304 | if (strap19 == 3) { |
| 305 | data_or |= (1 << 3); |
| 306 | printk(BIOS_DEBUG, "Enable ULX MPHY PG " |
| 307 | "control in single domain\n"); |
| 308 | } else if (strap19 == 0) { |
| 309 | printk(BIOS_DEBUG, "Enable ULX MPHY PG " |
| 310 | "control in split domains\n"); |
| 311 | } else { |
| 312 | printk(BIOS_DEBUG, "Invalid PCH Soft " |
| 313 | "Strap 19 configuration\n"); |
| 314 | } |
| 315 | } else { |
| 316 | data_or |= (1 << 3); |
| 317 | } |
| 318 | } |
| 319 | } |
| 320 | |
| 321 | pch_iobp_update(0xCF000000, data_and, data_or); |
| 322 | } |
| 323 | |
Duncan Laurie | 446fb8e | 2014-08-08 09:59:43 -0700 | [diff] [blame] | 324 | static void pch_init_deep_sx(struct device *dev) |
| 325 | { |
Angel Pons | 02414f8 | 2020-10-28 13:50:38 +0100 | [diff] [blame] | 326 | const struct soc_intel_broadwell_pch_config *config = dev->chip_info; |
| 327 | |
| 328 | if (!config) |
| 329 | return; |
Duncan Laurie | 446fb8e | 2014-08-08 09:59:43 -0700 | [diff] [blame] | 330 | |
| 331 | if (config->deep_sx_enable_ac) { |
| 332 | RCBA32_OR(DEEP_S3_POL, DEEP_S3_EN_AC); |
| 333 | RCBA32_OR(DEEP_S5_POL, DEEP_S5_EN_AC); |
| 334 | } |
| 335 | |
| 336 | if (config->deep_sx_enable_dc) { |
| 337 | RCBA32_OR(DEEP_S3_POL, DEEP_S3_EN_DC); |
| 338 | RCBA32_OR(DEEP_S5_POL, DEEP_S5_EN_DC); |
| 339 | } |
| 340 | |
| 341 | if (config->deep_sx_enable_ac || config->deep_sx_enable_dc) |
| 342 | RCBA32_OR(DEEP_SX_CONFIG, |
| 343 | DEEP_SX_WAKE_PIN_EN | DEEP_SX_GP27_PIN_EN); |
| 344 | } |
| 345 | |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 346 | /* Power Management init */ |
| 347 | static void pch_pm_init(struct device *dev) |
| 348 | { |
| 349 | printk(BIOS_DEBUG, "PCH PM init\n"); |
| 350 | |
Duncan Laurie | 446fb8e | 2014-08-08 09:59:43 -0700 | [diff] [blame] | 351 | pch_init_deep_sx(dev); |
| 352 | |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 353 | pch_enable_mphy(); |
| 354 | |
Angel Pons | 2436ac0 | 2020-10-13 20:03:49 +0200 | [diff] [blame] | 355 | pch_pm_init_magic(dev); |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 356 | |
Duncan Laurie | 446fb8e | 2014-08-08 09:59:43 -0700 | [diff] [blame] | 357 | if (pch_is_wpt()) { |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 358 | RCBA32_OR(0x33e0, (1 << 4) | (1 << 1)); |
Duncan Laurie | 446fb8e | 2014-08-08 09:59:43 -0700 | [diff] [blame] | 359 | RCBA32_OR(0x2b1c, (1 << 22) | (1 << 14) | (1 << 13)); |
| 360 | RCBA32(0x33e4) = 0x16bf0002; |
| 361 | RCBA32_OR(0x33e4, 0x1); |
| 362 | } |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 363 | |
| 364 | pch_iobp_update(0xCA000000, ~0UL, 0x00000009); |
| 365 | |
| 366 | /* Set RCBA 0x2b1c[29]=1 if DSP disabled */ |
| 367 | if (RCBA32(FD) & PCH_DISABLE_ADSPD) |
| 368 | RCBA32_OR(0x2b1c, (1 << 29)); |
| 369 | |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 370 | } |
| 371 | |
Elyes HAOUAS | 040aff2 | 2018-05-27 16:30:36 +0200 | [diff] [blame] | 372 | static void pch_cg_init(struct device *dev) |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 373 | { |
| 374 | u32 reg32; |
| 375 | u16 reg16; |
Kyösti Mälkki | 71756c21 | 2019-07-12 13:10:19 +0300 | [diff] [blame] | 376 | struct device *igd_dev = pcidev_path_on_root(SA_DEVFN_IGD); |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 377 | |
| 378 | /* DMI */ |
| 379 | RCBA32_OR(0x2234, 0xf); |
| 380 | |
| 381 | reg16 = pci_read_config16(dev, GEN_PMCON_1); |
| 382 | reg16 &= ~(1 << 10); /* Disable BIOS_PCI_EXP_EN for native PME */ |
| 383 | if (pch_is_wpt()) |
| 384 | reg16 &= ~(1 << 11); |
| 385 | else |
| 386 | reg16 |= (1 << 11); |
| 387 | reg16 |= (1 << 5) | (1 << 6) | (1 << 7) | (1 << 12); |
| 388 | reg16 |= (1 << 2); // PCI CLKRUN# Enable |
| 389 | pci_write_config16(dev, GEN_PMCON_1, reg16); |
| 390 | |
| 391 | /* |
| 392 | * RCBA + 0x2614[27:25,14:13,10,8] = 101,11,1,1 |
| 393 | * RCBA + 0x2614[23:16] = 0x20 |
| 394 | * RCBA + 0x2614[30:28] = 0x0 |
| 395 | * RCBA + 0x2614[26] = 1 (IF 0:2.0@0x08 >= 0x0b) |
| 396 | */ |
Duncan Laurie | 446fb8e | 2014-08-08 09:59:43 -0700 | [diff] [blame] | 397 | RCBA32_AND_OR(0x2614, ~0x64ff0000, 0x0a206500); |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 398 | |
| 399 | /* Check for 0:2.0@0x08 >= 0x0b */ |
Kyösti Mälkki | 71756c21 | 2019-07-12 13:10:19 +0300 | [diff] [blame] | 400 | if (pch_is_wpt() || pci_read_config8(igd_dev, 0x8) >= 0x0b) |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 401 | RCBA32_OR(0x2614, (1 << 26)); |
| 402 | |
| 403 | RCBA32_OR(0x900, 0x0000031f); |
| 404 | |
| 405 | reg32 = RCBA32(CG); |
| 406 | if (RCBA32(0x3454) & (1 << 4)) |
| 407 | reg32 &= ~(1 << 29); // LPC Dynamic |
| 408 | else |
| 409 | reg32 |= (1 << 29); // LPC Dynamic |
| 410 | reg32 |= (1 << 31); // LP LPC |
| 411 | reg32 |= (1 << 30); // LP BLA |
Duncan Laurie | 446fb8e | 2014-08-08 09:59:43 -0700 | [diff] [blame] | 412 | if (RCBA32(0x3454) & (1 << 4)) |
| 413 | reg32 &= ~(1 << 29); |
| 414 | else |
| 415 | reg32 |= (1 << 29); |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 416 | reg32 |= (1 << 28); // GPIO Dynamic |
| 417 | reg32 |= (1 << 27); // HPET Dynamic |
| 418 | reg32 |= (1 << 26); // Generic Platform Event Clock |
| 419 | if (RCBA32(BUC) & PCH_DISABLE_GBE) |
| 420 | reg32 |= (1 << 23); // GbE Static |
Duncan Laurie | 446fb8e | 2014-08-08 09:59:43 -0700 | [diff] [blame] | 421 | if (RCBA32(FD) & PCH_DISABLE_HD_AUDIO) |
| 422 | reg32 |= (1 << 21); // HDA Static |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 423 | reg32 |= (1 << 22); // HDA Dynamic |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 424 | RCBA32(CG) = reg32; |
| 425 | |
| 426 | /* PCH-LP LPC */ |
| 427 | if (pch_is_wpt()) |
| 428 | RCBA32_AND_OR(0x3434, ~0x1f, 0x17); |
| 429 | else |
| 430 | RCBA32_OR(0x3434, 0x7); |
| 431 | |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 432 | /* SPI */ |
| 433 | RCBA32_OR(0x38c0, 0x3c07); |
| 434 | |
| 435 | pch_iobp_update(0xCE00C000, ~1UL, 0x00000000); |
| 436 | } |
| 437 | |
| 438 | static void pch_set_acpi_mode(void) |
| 439 | { |
Kyösti Mälkki | ad882c3 | 2020-06-02 05:05:30 +0300 | [diff] [blame] | 440 | if (!acpi_is_wakeup_s3()) { |
Kyösti Mälkki | b658548 | 2020-06-01 15:11:14 +0300 | [diff] [blame] | 441 | apm_control(APM_CNT_ACPI_DISABLE); |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 442 | } |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 443 | } |
| 444 | |
| 445 | static void lpc_init(struct device *dev) |
| 446 | { |
| 447 | /* Legacy initialization */ |
| 448 | isa_dma_init(); |
Arthur Heymans | 2abbe46 | 2019-06-04 14:12:01 +0200 | [diff] [blame] | 449 | sb_rtc_init(); |
Angel Pons | f2e2b96 | 2020-10-13 20:19:40 +0200 | [diff] [blame] | 450 | pch_misc_init(dev); |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 451 | |
| 452 | /* Interrupt configuration */ |
| 453 | pch_enable_ioapic(dev); |
| 454 | pch_pirq_init(dev); |
| 455 | setup_i8259(); |
| 456 | i8259_configure_irq_trigger(9, 1); |
Matt DeVillier | 81a6f10 | 2018-02-19 17:33:48 -0600 | [diff] [blame] | 457 | enable_hpet(dev); |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 458 | |
| 459 | /* Initialize power management */ |
| 460 | pch_power_options(dev); |
| 461 | pch_pm_init(dev); |
| 462 | pch_cg_init(dev); |
| 463 | |
| 464 | pch_set_acpi_mode(); |
| 465 | } |
| 466 | |
Elyes HAOUAS | 040aff2 | 2018-05-27 16:30:36 +0200 | [diff] [blame] | 467 | static void pch_lpc_add_mmio_resources(struct device *dev) |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 468 | { |
| 469 | u32 reg; |
| 470 | struct resource *res; |
| 471 | const u32 default_decode_base = IO_APIC_ADDR; |
| 472 | |
| 473 | /* |
| 474 | * Just report all resources from IO-APIC base to 4GiB. Don't mark |
| 475 | * them reserved as that may upset the OS if this range is marked |
| 476 | * as reserved in the e820. |
| 477 | */ |
| 478 | res = new_resource(dev, OIC); |
| 479 | res->base = default_decode_base; |
| 480 | res->size = 0 - default_decode_base; |
| 481 | res->flags = IORESOURCE_MEM | IORESOURCE_ASSIGNED | IORESOURCE_FIXED; |
| 482 | |
| 483 | /* RCBA */ |
Angel Pons | 64c6a74 | 2021-01-28 15:09:39 +0100 | [diff] [blame] | 484 | if (default_decode_base > CONFIG_FIXED_RCBA_MMIO_BASE) { |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 485 | res = new_resource(dev, RCBA); |
Angel Pons | 64c6a74 | 2021-01-28 15:09:39 +0100 | [diff] [blame] | 486 | res->base = CONFIG_FIXED_RCBA_MMIO_BASE; |
| 487 | res->size = CONFIG_RCBA_LENGTH; |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 488 | res->flags = IORESOURCE_MEM | IORESOURCE_ASSIGNED | |
Lee Leahy | 26b7cd0 | 2017-03-16 18:47:55 -0700 | [diff] [blame] | 489 | IORESOURCE_FIXED | IORESOURCE_RESERVE; |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 490 | } |
| 491 | |
| 492 | /* Check LPC Memory Decode register. */ |
| 493 | reg = pci_read_config32(dev, LGMR); |
| 494 | if (reg & 1) { |
| 495 | reg &= ~0xffff; |
| 496 | if (reg < default_decode_base) { |
| 497 | res = new_resource(dev, LGMR); |
| 498 | res->base = reg; |
| 499 | res->size = 16 * 1024; |
| 500 | res->flags = IORESOURCE_MEM | IORESOURCE_ASSIGNED | |
Lee Leahy | 26b7cd0 | 2017-03-16 18:47:55 -0700 | [diff] [blame] | 501 | IORESOURCE_FIXED | IORESOURCE_RESERVE; |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 502 | } |
| 503 | } |
| 504 | } |
| 505 | |
| 506 | /* Default IO range claimed by the LPC device. The upper bound is exclusive. */ |
| 507 | #define LPC_DEFAULT_IO_RANGE_LOWER 0 |
| 508 | #define LPC_DEFAULT_IO_RANGE_UPPER 0x1000 |
| 509 | |
Julius Werner | 7c712bb | 2019-05-01 16:51:20 -0700 | [diff] [blame] | 510 | static inline int pch_io_range_in_default(int base, int size) |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 511 | { |
| 512 | /* Does it start above the range? */ |
| 513 | if (base >= LPC_DEFAULT_IO_RANGE_UPPER) |
| 514 | return 0; |
| 515 | |
| 516 | /* Is it entirely contained? */ |
| 517 | if (base >= LPC_DEFAULT_IO_RANGE_LOWER && |
| 518 | (base + size) < LPC_DEFAULT_IO_RANGE_UPPER) |
| 519 | return 1; |
| 520 | |
| 521 | /* This will return not in range for partial overlaps. */ |
| 522 | return 0; |
| 523 | } |
| 524 | |
| 525 | /* |
| 526 | * Note: this function assumes there is no overlap with the default LPC device's |
| 527 | * claimed range: LPC_DEFAULT_IO_RANGE_LOWER -> LPC_DEFAULT_IO_RANGE_UPPER. |
| 528 | */ |
Elyes HAOUAS | 040aff2 | 2018-05-27 16:30:36 +0200 | [diff] [blame] | 529 | static void pch_lpc_add_io_resource(struct device *dev, u16 base, u16 size, |
| 530 | int index) |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 531 | { |
| 532 | struct resource *res; |
| 533 | |
| 534 | if (pch_io_range_in_default(base, size)) |
| 535 | return; |
| 536 | |
| 537 | res = new_resource(dev, index); |
| 538 | res->base = base; |
| 539 | res->size = size; |
| 540 | res->flags = IORESOURCE_IO | IORESOURCE_ASSIGNED | IORESOURCE_FIXED; |
| 541 | } |
| 542 | |
Elyes HAOUAS | 040aff2 | 2018-05-27 16:30:36 +0200 | [diff] [blame] | 543 | static void pch_lpc_add_gen_io_resources(struct device *dev, int reg_value, |
| 544 | int index) |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 545 | { |
| 546 | /* |
| 547 | * Check if the register is enabled. If so and the base exceeds the |
Martin Roth | de7ed6f | 2014-12-07 14:58:18 -0700 | [diff] [blame] | 548 | * device's default claim range add the resource. |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 549 | */ |
| 550 | if (reg_value & 1) { |
| 551 | u16 base = reg_value & 0xfffc; |
| 552 | u16 size = (0x3 | ((reg_value >> 16) & 0xfc)) + 1; |
| 553 | pch_lpc_add_io_resource(dev, base, size, index); |
| 554 | } |
| 555 | } |
| 556 | |
Elyes HAOUAS | 040aff2 | 2018-05-27 16:30:36 +0200 | [diff] [blame] | 557 | static void pch_lpc_add_io_resources(struct device *dev) |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 558 | { |
| 559 | struct resource *res; |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 560 | |
| 561 | /* Add the default claimed IO range for the LPC device. */ |
| 562 | res = new_resource(dev, 0); |
| 563 | res->base = LPC_DEFAULT_IO_RANGE_LOWER; |
| 564 | res->size = LPC_DEFAULT_IO_RANGE_UPPER - LPC_DEFAULT_IO_RANGE_LOWER; |
| 565 | res->flags = IORESOURCE_IO | IORESOURCE_ASSIGNED | IORESOURCE_FIXED; |
| 566 | |
| 567 | /* GPIOBASE */ |
| 568 | pch_lpc_add_io_resource(dev, GPIO_BASE_ADDRESS, |
| 569 | GPIO_BASE_SIZE, GPIO_BASE); |
| 570 | |
| 571 | /* PMBASE */ |
| 572 | pch_lpc_add_io_resource(dev, ACPI_BASE_ADDRESS, ACPI_BASE_SIZE, PMBASE); |
| 573 | |
| 574 | /* LPC Generic IO Decode range. */ |
Angel Pons | 02414f8 | 2020-10-28 13:50:38 +0100 | [diff] [blame] | 575 | if (dev->chip_info) { |
| 576 | const struct soc_intel_broadwell_pch_config *config = dev->chip_info; |
| 577 | pch_lpc_add_gen_io_resources(dev, config->gen1_dec, LPC_GEN1_DEC); |
| 578 | pch_lpc_add_gen_io_resources(dev, config->gen2_dec, LPC_GEN2_DEC); |
| 579 | pch_lpc_add_gen_io_resources(dev, config->gen3_dec, LPC_GEN3_DEC); |
| 580 | pch_lpc_add_gen_io_resources(dev, config->gen4_dec, LPC_GEN4_DEC); |
| 581 | } |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 582 | } |
| 583 | |
Elyes HAOUAS | 040aff2 | 2018-05-27 16:30:36 +0200 | [diff] [blame] | 584 | static void pch_lpc_read_resources(struct device *dev) |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 585 | { |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 586 | /* Get the normal PCI resources of this device. */ |
| 587 | pci_dev_read_resources(dev); |
| 588 | |
| 589 | /* Add non-standard MMIO resources. */ |
| 590 | pch_lpc_add_mmio_resources(dev); |
| 591 | |
| 592 | /* Add IO resources. */ |
| 593 | pch_lpc_add_io_resources(dev); |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 594 | } |
| 595 | |
Angel Pons | 68d8357 | 2021-04-19 22:31:49 +0200 | [diff] [blame] | 596 | static unsigned long acpi_write_serialio_ssdt(unsigned long current, struct acpi_rsdp *rsdp) |
| 597 | { |
| 598 | printk(BIOS_DEBUG, "ACPI: * SSDT2\n"); |
| 599 | acpi_header_t *ssdt = (acpi_header_t *)current; |
| 600 | acpi_create_serialio_ssdt(ssdt); |
| 601 | current += ssdt->length; |
| 602 | acpi_add_table(rsdp, ssdt); |
| 603 | return acpi_align_current(current); |
| 604 | } |
| 605 | |
Furquan Shaikh | 0f007d8 | 2020-04-24 06:41:18 -0700 | [diff] [blame] | 606 | static unsigned long broadwell_write_acpi_tables(const struct device *device, |
Duncan Laurie | 93bbd41 | 2017-11-11 20:03:29 -0800 | [diff] [blame] | 607 | unsigned long current, |
| 608 | struct acpi_rsdp *rsdp) |
| 609 | { |
Angel Pons | 07baa7a | 2021-04-19 17:12:42 +0200 | [diff] [blame] | 610 | if (CONFIG(SERIALIO_UART_CONSOLE)) { |
Duncan Laurie | 93bbd41 | 2017-11-11 20:03:29 -0800 | [diff] [blame] | 611 | current = acpi_write_dbg2_pci_uart(rsdp, current, |
Angel Pons | 07baa7a | 2021-04-19 17:12:42 +0200 | [diff] [blame] | 612 | (CONFIG_UART_FOR_CONSOLE == 1) ? |
Duncan Laurie | 93bbd41 | 2017-11-11 20:03:29 -0800 | [diff] [blame] | 613 | PCH_DEV_UART1 : PCH_DEV_UART0, |
Angel Pons | 07baa7a | 2021-04-19 17:12:42 +0200 | [diff] [blame] | 614 | ACPI_ACCESS_SIZE_DWORD_ACCESS); |
| 615 | } |
Angel Pons | 68d8357 | 2021-04-19 22:31:49 +0200 | [diff] [blame] | 616 | current = acpi_write_hpet(device, current, rsdp); |
| 617 | current = acpi_align_current(current); |
| 618 | current = acpi_write_serialio_ssdt(current, rsdp); |
| 619 | return current; |
Duncan Laurie | 93bbd41 | 2017-11-11 20:03:29 -0800 | [diff] [blame] | 620 | } |
| 621 | |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 622 | static struct device_operations device_ops = { |
| 623 | .read_resources = &pch_lpc_read_resources, |
| 624 | .set_resources = &pci_dev_set_resources, |
| 625 | .enable_resources = &pci_dev_enable_resources, |
Duncan Laurie | 93bbd41 | 2017-11-11 20:03:29 -0800 | [diff] [blame] | 626 | .write_acpi_tables = broadwell_write_acpi_tables, |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 627 | .init = &lpc_init, |
Nico Huber | 51b75ae | 2019-03-14 16:02:05 +0100 | [diff] [blame] | 628 | .scan_bus = &scan_static_bus, |
Angel Pons | cb2080f | 2020-10-23 15:45:44 +0200 | [diff] [blame] | 629 | .ops_pci = &pci_dev_ops_pci, |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 630 | }; |
| 631 | |
| 632 | static const unsigned short pci_device_ids[] = { |
| 633 | PCH_LPT_LP_SAMPLE, |
| 634 | PCH_LPT_LP_PREMIUM, |
| 635 | PCH_LPT_LP_MAINSTREAM, |
| 636 | PCH_LPT_LP_VALUE, |
| 637 | PCH_WPT_HSW_U_SAMPLE, |
| 638 | PCH_WPT_BDW_U_SAMPLE, |
| 639 | PCH_WPT_BDW_U_PREMIUM, |
| 640 | PCH_WPT_BDW_U_BASE, |
| 641 | PCH_WPT_BDW_Y_SAMPLE, |
| 642 | PCH_WPT_BDW_Y_PREMIUM, |
| 643 | PCH_WPT_BDW_Y_BASE, |
| 644 | PCH_WPT_BDW_H, |
| 645 | 0 |
| 646 | }; |
| 647 | |
| 648 | static const struct pci_driver pch_lpc __pci_driver = { |
| 649 | .ops = &device_ops, |
| 650 | .vendor = PCI_VENDOR_ID_INTEL, |
| 651 | .devices = pci_device_ids, |
| 652 | }; |