blob: a9081f87e05853e1c03ebcbf2eee4d9d058f2bb8 [file] [log] [blame]
Marc Jones24484842017-05-04 21:17:45 -06001/*
2 * This file is part of the coreboot project.
3 *
Richard Spiegel376dc822017-12-01 08:24:26 -07004 * Copyright (C) 2010-2017 Advanced Micro Devices, Inc.
Marc Jones24484842017-05-04 21:17:45 -06005 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of 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.
14 */
15
16#include <console/console.h>
17
18#include <arch/io.h>
19#include <arch/acpi.h>
Marshall Dawson8a906df2017-06-13 14:19:02 -060020#include <bootstate.h>
Marshall Dawsone9b862e2017-09-22 15:14:46 -060021#include <cpu/x86/smm.h>
Marc Jones24484842017-05-04 21:17:45 -060022#include <device/device.h>
23#include <device/pci.h>
24#include <device/pci_ids.h>
25#include <device/pci_ops.h>
26#include <cbmem.h>
Richard Spiegel2bbc3dc2017-12-06 16:14:58 -070027#include <amdblocks/amd_pci_util.h>
Marc Jonesdfeb1c42017-08-07 19:08:24 -060028#include <soc/southbridge.h>
Marc Jones24484842017-05-04 21:17:45 -060029#include <soc/smi.h>
Richard Spiegel376dc822017-12-01 08:24:26 -070030#include <soc/amd_pci_int_defs.h>
Marc Jones24484842017-05-04 21:17:45 -060031#include <fchec.h>
Richard Spiegelbec44f22017-11-24 07:41:29 -070032#include <delay.h>
33#include <soc/pci_devs.h>
Marc Jones24484842017-05-04 21:17:45 -060034
Richard Spiegel376dc822017-12-01 08:24:26 -070035/*
36 * Table of APIC register index and associated IRQ name. Using IDX_XXX_NAME
37 * provides a visible association with the index, therefor helping
38 * maintainability of table. If a new index/name is defined in
39 * amd_pci_int_defs.h, just add the pair at the end of this table.
40 * Order is not important.
41 */
42const static struct irq_idx_name irq_association[] = {
Richard Spiegele89d4442017-12-08 07:52:42 -070043 { PIRQ_A, "INTA#" },
44 { PIRQ_B, "INTB#" },
45 { PIRQ_C, "INTC#" },
46 { PIRQ_D, "INTD#" },
47 { PIRQ_E, "INTE#" },
48 { PIRQ_F, "INTF#" },
49 { PIRQ_G, "INTG#" },
50 { PIRQ_H, "INTH#" },
51 { PIRQ_MISC, "Misc" },
52 { PIRQ_MISC0, "Misc0" },
53 { PIRQ_MISC1, "Misc1" },
54 { PIRQ_MISC2, "Misc2" },
Richard Spiegel376dc822017-12-01 08:24:26 -070055 { PIRQ_SIRQA, "Ser IRQ INTA" },
56 { PIRQ_SIRQB, "Ser IRQ INTB" },
57 { PIRQ_SIRQC, "Ser IRQ INTC" },
58 { PIRQ_SIRQD, "Ser IRQ INTD" },
Richard Spiegele89d4442017-12-08 07:52:42 -070059 { PIRQ_SCI, "SCI" },
60 { PIRQ_SMBUS, "SMBUS" },
61 { PIRQ_ASF, "ASF" },
62 { PIRQ_HDA, "HDA" },
63 { PIRQ_FC, "FC" },
64 { PIRQ_PMON, "PerMon" },
65 { PIRQ_SD, "SD" },
66 { PIRQ_SDIO, "SDIOt" },
67 { PIRQ_IMC0, "IMC INT0" },
68 { PIRQ_IMC1, "IMC INT1" },
69 { PIRQ_IMC2, "IMC INT2" },
70 { PIRQ_IMC3, "IMC INT3" },
71 { PIRQ_IMC4, "IMC INT4" },
72 { PIRQ_IMC5, "IMC INT5" },
73 { PIRQ_EHCI, "EHCI" },
74 { PIRQ_XHCI, "XHCI" },
75 { PIRQ_SATA, "SATA" },
76 { PIRQ_GPIO, "GPIO" },
77 { PIRQ_I2C0, "I2C0" },
78 { PIRQ_I2C1, "I2C1" },
79 { PIRQ_I2C2, "I2C2" },
80 { PIRQ_I2C3, "I2C3" },
81 { PIRQ_UART0, "UART0" },
82 { PIRQ_UART1, "UART1" },
Richard Spiegel376dc822017-12-01 08:24:26 -070083};
84
Richard Spiegelebf3aa82017-11-24 07:47:42 -070085/*
86 * Structure to simplify code obtaining the total of used wide IO
87 * registers and the size assigned to each.
88 */
89static struct wide_io_ioport_and_bits {
90 uint32_t enable;
91 uint16_t port;
92 uint8_t alt;
93} wio_io_en[TOTAL_WIDEIO_PORTS] = {
94 {
95 LPC_WIDEIO0_ENABLE,
96 LPC_WIDEIO_GENERIC_PORT,
97 LPC_ALT_WIDEIO0_ENABLE
98 },
99 {
100 LPC_WIDEIO1_ENABLE,
101 LPC_WIDEIO1_GENERIC_PORT,
102 LPC_ALT_WIDEIO1_ENABLE
103 },
104 {
105 LPC_WIDEIO2_ENABLE,
106 LPC_WIDEIO2_GENERIC_PORT,
107 LPC_ALT_WIDEIO2_ENABLE
108 }
109};
110
Richard Spiegel376dc822017-12-01 08:24:26 -0700111const struct irq_idx_name *sb_get_apic_reg_association(size_t *size)
112{
113 *size = ARRAY_SIZE(irq_association);
114 return irq_association;
115}
116
Richard Spiegelebf3aa82017-11-24 07:47:42 -0700117/**
118 * @brief Find the size of a particular wide IO
119 *
120 * @param index = index of desired wide IO
121 *
122 * @return size of desired wide IO
123 */
124uint16_t sb_wideio_size(int index)
125{
126 uint32_t enable_register;
127 uint16_t size = 0;
128 uint8_t alternate_register;
129
130 if (index >= TOTAL_WIDEIO_PORTS)
131 return size;
132 enable_register = pci_read_config32(SOC_LPC_DEV,
133 LPC_IO_OR_MEM_DECODE_ENABLE);
134 alternate_register = pci_read_config8(SOC_LPC_DEV,
135 LPC_ALT_WIDEIO_RANGE_ENABLE);
136 if (enable_register & wio_io_en[index].enable)
137 size = (alternate_register & wio_io_en[index].alt) ?
138 16 : 512;
139 return size;
140}
141
142/**
143 * @brief Identify if any LPC wide IO is covering the IO range
144 *
145 * @param start = start of IO range
146 * @param size = size of IO range
147 *
148 * @return Index of wide IO covering the range or error
149 */
150int sb_find_wideio_range(uint16_t start, uint16_t size)
151{
152 uint32_t enable_register;
153 int i, index = WIDEIO_RANGE_ERROR;
154 uint16_t end, current_size, start_wideio, end_wideio;
155
156 end = start + size;
157 enable_register = pci_read_config32(SOC_LPC_DEV,
158 LPC_IO_OR_MEM_DECODE_ENABLE);
159 for (i = 0; i < TOTAL_WIDEIO_PORTS; i++) {
160 current_size = sb_wideio_size(i);
161 if (current_size == 0)
162 continue;
163 start_wideio = pci_read_config16(SOC_LPC_DEV,
164 wio_io_en[i].port);
165 end_wideio = start_wideio + current_size;
166 if ((start >= start_wideio) && (end <= end_wideio)) {
167 index = i;
168 break;
169 }
170 }
171 return index;
172}
173
174/**
175 * @brief Program a LPC wide IO to support an IO range
176 *
177 * @param start = start of range to be routed through wide IO
178 * @param size = size of range to be routed through wide IO
179 *
180 * @return Index of wide IO register used or error
181 */
182int sb_set_wideio_range(uint16_t start, uint16_t size)
183{
184 int i, index = WIDEIO_RANGE_ERROR;
185 uint32_t enable_register;
186 uint8_t alternate_register;
187
188 enable_register = pci_read_config32(SOC_LPC_DEV,
189 LPC_IO_OR_MEM_DECODE_ENABLE);
190 alternate_register = pci_read_config8(SOC_LPC_DEV,
191 LPC_ALT_WIDEIO_RANGE_ENABLE);
192 for (i = 0; i < TOTAL_WIDEIO_PORTS; i++) {
193 if (enable_register & wio_io_en[i].enable)
194 continue;
195 index = i;
196 pci_write_config16(SOC_LPC_DEV, wio_io_en[i].port, start);
197 enable_register |= wio_io_en[i].enable;
198 pci_write_config32(SOC_LPC_DEV, LPC_IO_OR_MEM_DECODE_ENABLE,
199 enable_register);
200 if (size <= 16)
201 alternate_register |= wio_io_en[i].alt;
202 else
203 alternate_register &= ~wio_io_en[i].alt;
204 pci_write_config8(SOC_LPC_DEV,
205 LPC_ALT_WIDEIO_RANGE_ENABLE,
206 alternate_register);
207 break;
208 }
209 return index;
210}
211
Richard Spiegelbec44f22017-11-24 07:41:29 -0700212void configure_stoneyridge_uart(void)
213{
214 u8 byte, byte2;
215
216 if (CONFIG_UART_FOR_CONSOLE < 0 || CONFIG_UART_FOR_CONSOLE > 1)
217 return;
218
219 /* Power on the UART and AMBA devices */
220 byte = read8((void *)ACPI_MMIO_BASE + AOAC_BASE + FCH_AOAC_REG56
221 + CONFIG_UART_FOR_CONSOLE * 2);
222 byte |= AOAC_PWR_ON_DEV;
223 write8((void *)ACPI_MMIO_BASE + AOAC_BASE + FCH_AOAC_REG56
224 + CONFIG_UART_FOR_CONSOLE * 2, byte);
225
226 byte = read8((void *)ACPI_MMIO_BASE + AOAC_BASE + FCH_AOAC_REG62);
227 byte |= AOAC_PWR_ON_DEV;
228 write8((void *)ACPI_MMIO_BASE + AOAC_BASE + FCH_AOAC_REG62, byte);
229
230 /* Set the GPIO mux to UART */
231 write8((void *)FCH_IOMUXx89_UART0_RTS_L_EGPIO137, 0);
232 write8((void *)FCH_IOMUXx8A_UART0_TXD_EGPIO138, 0);
233 write8((void *)FCH_IOMUXx8E_UART1_RTS_L_EGPIO142, 0);
234 write8((void *)FCH_IOMUXx8F_UART1_TXD_EGPIO143, 0);
235
236 /* Wait for the UART and AMBA devices to indicate power and clock OK */
237 do {
238 udelay(100);
239 byte = read8((void *)ACPI_MMIO_BASE + AOAC_BASE + FCH_AOAC_REG57
240 + CONFIG_UART_FOR_CONSOLE * 2);
241 byte &= (A0AC_PWR_RST_STATE | AOAC_RST_CLK_OK_STATE);
242 byte2 = read8((void *)ACPI_MMIO_BASE + AOAC_BASE
243 + FCH_AOAC_REG63);
244 byte2 &= (A0AC_PWR_RST_STATE | AOAC_RST_CLK_OK_STATE);
245 } while (!((byte == (A0AC_PWR_RST_STATE | AOAC_RST_CLK_OK_STATE)) &&
246 (byte2 == (A0AC_PWR_RST_STATE | AOAC_RST_CLK_OK_STATE))));
247
248}
249
250void sb_pci_port80(void)
251{
252 u8 byte;
253
254 byte = pci_read_config8(SOC_LPC_DEV, LPC_IO_OR_MEM_DEC_EN_HIGH);
255 byte &= ~DECODE_IO_PORT_ENABLE4_H; /* disable lpc port 80 */
256 pci_write_config8(SOC_LPC_DEV, LPC_IO_OR_MEM_DEC_EN_HIGH, byte);
257}
258
259void sb_lpc_port80(void)
260{
261 u8 byte;
262
263 /* Enable LPC controller */
264 outb(PM_LPC_GATING, PM_INDEX);
265 byte = inb(PM_DATA);
266 byte |= PM_LPC_ENABLE;
267 outb(PM_LPC_GATING, PM_INDEX);
268 outb(byte, PM_DATA);
269
270 /* Enable port 80 LPC decode in pci function 3 configuration space. */
271 byte = pci_read_config8(SOC_LPC_DEV, LPC_IO_OR_MEM_DEC_EN_HIGH);
272 byte |= DECODE_IO_PORT_ENABLE4_H; /* enable port 80 */
273 pci_write_config8(SOC_LPC_DEV, LPC_IO_OR_MEM_DEC_EN_HIGH, byte);
274}
275
276void sb_lpc_decode(void)
277{
278 u32 tmp = 0;
279
280 /* Enable I/O decode to LPC bus */
281 tmp = DECODE_ENABLE_PARALLEL_PORT0 | DECODE_ENABLE_PARALLEL_PORT2
282 | DECODE_ENABLE_PARALLEL_PORT4 | DECODE_ENABLE_SERIAL_PORT0
283 | DECODE_ENABLE_SERIAL_PORT1 | DECODE_ENABLE_SERIAL_PORT2
284 | DECODE_ENABLE_SERIAL_PORT3 | DECODE_ENABLE_SERIAL_PORT4
285 | DECODE_ENABLE_SERIAL_PORT5 | DECODE_ENABLE_SERIAL_PORT6
286 | DECODE_ENABLE_SERIAL_PORT7 | DECODE_ENABLE_AUDIO_PORT0
287 | DECODE_ENABLE_AUDIO_PORT1 | DECODE_ENABLE_AUDIO_PORT2
288 | DECODE_ENABLE_AUDIO_PORT3 | DECODE_ENABLE_MSS_PORT2
289 | DECODE_ENABLE_MSS_PORT3 | DECODE_ENABLE_FDC_PORT0
290 | DECODE_ENABLE_FDC_PORT1 | DECODE_ENABLE_GAME_PORT
291 | DECODE_ENABLE_KBC_PORT | DECODE_ENABLE_ACPIUC_PORT
292 | DECODE_ENABLE_ADLIB_PORT;
293
294 pci_write_config32(SOC_LPC_DEV, LPC_IO_PORT_DECODE_ENABLE, tmp);
295}
296
297void sb_clk_output_48Mhz(void)
298{
299 u32 ctrl;
300
301 /*
302 * Enable the X14M_25M_48M_OSC pin and leaving it at it's default so
303 * 48Mhz will be on ball AP13 (FT3b package)
304 */
305 ctrl = read32((void *)(ACPI_MMIO_BASE + MISC_BASE + FCH_MISC_REG40));
306
307 /* clear the OSCOUT1_ClkOutputEnb to enable the 48 Mhz clock */
308 ctrl &= ~FCH_MISC_REG40_OSCOUT1_EN;
309 write32((void *)(ACPI_MMIO_BASE + MISC_BASE + FCH_MISC_REG40), ctrl);
310}
311
312static uintptr_t sb_spibase(void)
313{
314 u32 base, enables;
315
316 /* Make sure the base address is predictable */
317 base = pci_read_config32(SOC_LPC_DEV, SPIROM_BASE_ADDRESS_REGISTER);
318 enables = base & 0xf;
319 base &= ~0x3f;
320
321 if (!base) {
322 base = SPI_BASE_ADDRESS;
323 pci_write_config32(SOC_LPC_DEV, SPIROM_BASE_ADDRESS_REGISTER,
324 base | enables | SPI_ROM_ENABLE);
325 /* PCI_COMMAND_MEMORY is read-only and enabled. */
326 }
327 return (uintptr_t)base;
328}
329
330void sb_set_spi100(u16 norm, u16 fast, u16 alt, u16 tpm)
331{
332 uintptr_t base = sb_spibase();
333 write16((void *)base + SPI100_SPEED_CONFIG,
334 (norm << SPI_NORM_SPEED_NEW_SH) |
335 (fast << SPI_FAST_SPEED_NEW_SH) |
336 (alt << SPI_ALT_SPEED_NEW_SH) |
337 (tpm << SPI_TPM_SPEED_NEW_SH));
338 write16((void *)base + SPI100_ENABLE, SPI_USE_SPI100);
339}
340
341void sb_disable_4dw_burst(void)
342{
343 uintptr_t base = sb_spibase();
344 write16((void *)base + SPI100_HOST_PREF_CONFIG,
345 read16((void *)base + SPI100_HOST_PREF_CONFIG)
346 & ~SPI_RD4DW_EN_HOST);
347}
348
349void sb_set_readspeed(u16 norm, u16 fast)
350{
351 uintptr_t base = sb_spibase();
352 write16((void *)base + SPI_CNTRL1, (read16((void *)base + SPI_CNTRL1)
353 & ~SPI_CNTRL1_SPEED_MASK)
354 | (norm << SPI_NORM_SPEED_SH)
355 | (fast << SPI_FAST_SPEED_SH));
356}
357
358void sb_read_mode(u32 mode)
359{
360 uintptr_t base = sb_spibase();
361 write32((void *)base + SPI_CNTRL0,
362 (read32((void *)base + SPI_CNTRL0)
363 & ~SPI_READ_MODE_MASK) | mode);
364}
365
366void sb_tpm_decode_spi(void)
367{
368 u32 spibase = pci_read_config32(SOC_LPC_DEV,
369 SPIROM_BASE_ADDRESS_REGISTER);
370 pci_write_config32(SOC_LPC_DEV, SPIROM_BASE_ADDRESS_REGISTER, spibase
371 | ROUTE_TPM_2_SPI);
372}
373
374/*
375 * Enable 4MB (LPC) ROM access at 0xFFC00000 - 0xFFFFFFFF.
376 *
377 * Hardware should enable LPC ROM by pin straps. This function does not
378 * handle the theoretically possible PCI ROM, FWH, or SPI ROM configurations.
379 *
380 * The southbridge power-on default is to map 512K ROM space.
381 *
382 */
383void sb_enable_rom(void)
384{
385 u8 reg8;
386
387 /*
388 * Decode variable LPC ROM address ranges 1 and 2.
389 * Bits 3-4 are not defined in any publicly available datasheet
390 */
391 reg8 = pci_read_config8(SOC_LPC_DEV, LPC_IO_OR_MEM_DECODE_ENABLE);
392 reg8 |= (1 << 3) | (1 << 4);
393 pci_write_config8(SOC_LPC_DEV, LPC_IO_OR_MEM_DECODE_ENABLE, reg8);
394
395 /*
396 * LPC ROM address range 1:
397 * Enable LPC ROM range mirroring start at 0x000e(0000).
398 */
399 pci_write_config16(SOC_LPC_DEV, ROM_ADDRESS_RANGE1_START, 0x000e);
400
401 /* Enable LPC ROM range mirroring end at 0x000f(ffff). */
402 pci_write_config16(SOC_LPC_DEV, ROM_ADDRESS_RANGE1_END, 0x000f);
403
404 /*
405 * LPC ROM address range 2:
406 *
407 * Enable LPC ROM range start at:
408 * 0xfff8(0000): 512KB
409 * 0xfff0(0000): 1MB
410 * 0xffe0(0000): 2MB
411 * 0xffc0(0000): 4MB
412 */
413 pci_write_config16(SOC_LPC_DEV, ROM_ADDRESS_RANGE2_START, 0x10000
414 - (CONFIG_COREBOOT_ROMSIZE_KB >> 6));
415
416 /* Enable LPC ROM range end at 0xffff(ffff). */
417 pci_write_config16(SOC_LPC_DEV, ROM_ADDRESS_RANGE2_END, 0xffff);
418}
419
420void bootblock_fch_early_init(void)
421{
422 sb_enable_rom();
423 sb_lpc_port80();
424 sb_lpc_decode();
425}
426
427int s3_save_nvram_early(u32 dword, int size, int nvram_pos)
428{
429 int i;
430 printk(BIOS_DEBUG, "Writing %x of size %d to nvram pos: %d\n",
431 dword, size, nvram_pos);
432
433 for (i = 0; i < size; i++) {
434 outb(nvram_pos, BIOSRAM_INDEX);
435 outb((dword >> (8 * i)) & 0xff, BIOSRAM_DATA);
436 nvram_pos++;
437 }
438
439 return nvram_pos;
440}
441
442int s3_load_nvram_early(int size, u32 *old_dword, int nvram_pos)
443{
444 u32 data = *old_dword;
445 int i;
446 for (i = 0; i < size; i++) {
447 outb(nvram_pos, BIOSRAM_INDEX);
448 data &= ~(0xff << (i * 8));
449 data |= inb(BIOSRAM_DATA) << (i * 8);
450 nvram_pos++;
451 }
452 *old_dword = data;
453 printk(BIOS_DEBUG, "Loading %x of size %d to nvram pos:%d\n",
454 *old_dword, size, nvram_pos-size);
455 return nvram_pos;
456}
Marc Jones24484842017-05-04 21:17:45 -0600457
458int acpi_get_sleep_type(void)
459{
Marshall Dawsonf9592cc2017-11-09 16:55:31 -0700460 return acpi_sleep_from_pm1(inw(pm_acpi_pm_cnt_blk()));
Marc Jones24484842017-05-04 21:17:45 -0600461}
462
Marc Jonesdfeb1c42017-08-07 19:08:24 -0600463void sb_enable(device_t dev)
Marc Jones24484842017-05-04 21:17:45 -0600464{
Marc Jonesdfeb1c42017-08-07 19:08:24 -0600465 printk(BIOS_DEBUG, "%s\n", __func__);
Marc Jones24484842017-05-04 21:17:45 -0600466}
467
Marc Jonesdfeb1c42017-08-07 19:08:24 -0600468static void sb_init_acpi_ports(void)
Marc Jones24484842017-05-04 21:17:45 -0600469{
Marshall Dawson91b80412017-09-27 16:44:40 -0600470 u32 reg;
471
Marc Jones24484842017-05-04 21:17:45 -0600472 /* We use some of these ports in SMM regardless of whether or not
473 * ACPI tables are generated. Enable these ports indiscriminately.
474 */
475
476 pm_write16(PM_EVT_BLK, ACPI_PM_EVT_BLK);
477 pm_write16(PM1_CNT_BLK, ACPI_PM1_CNT_BLK);
478 pm_write16(PM_TMR_BLK, ACPI_PM_TMR_BLK);
479 pm_write16(PM_GPE0_BLK, ACPI_GPE0_BLK);
480 /* CpuControl is in \_PR.CP00, 6 bytes */
481 pm_write16(PM_CPU_CTRL, ACPI_CPU_CONTROL);
482
483 if (IS_ENABLED(CONFIG_HAVE_SMI_HANDLER)) {
Marshall Dawsona05fdcb2017-09-27 15:01:37 -0600484 /* APMC - SMI Command Port */
Marshall Dawsone9b862e2017-09-22 15:14:46 -0600485 pm_write16(PM_ACPI_SMI_CMD, APM_CNT);
Marshall Dawsona05fdcb2017-09-27 15:01:37 -0600486 configure_smi(SMITYPE_SMI_CMD_PORT, SMI_MODE_SMI);
Marshall Dawson91b80412017-09-27 16:44:40 -0600487
488 /* SMI on SlpTyp requires sending SMI before completion
489 * response of the I/O write. The BKDG also specifies
490 * clearing ForceStpClkRetry for SMI trapping.
491 */
492 reg = pm_read32(PM_PCI_CTRL);
493 reg |= FORCE_SLPSTATE_RETRY;
494 reg &= ~FORCE_STPCLK_RETRY;
495 pm_write32(PM_PCI_CTRL, reg);
496
497 /* Disable SlpTyp feature */
498 reg = pm_read8(PM_RST_CTRL1);
499 reg &= ~SLPTYPE_CONTROL_EN;
500 pm_write8(PM_RST_CTRL1, reg);
501
502 configure_smi(SMITYPE_SLP_TYP, SMI_MODE_SMI);
Marc Jones24484842017-05-04 21:17:45 -0600503 } else {
504 pm_write16(PM_ACPI_SMI_CMD, 0);
505 }
506
Marshall Dawson5e2e74f2017-11-10 09:59:56 -0700507 /* Decode ACPI registers and enable standard features */
508 pm_write8(PM_ACPI_CONF, PM_ACPI_DECODE_STD |
509 PM_ACPI_GLOBAL_EN |
510 PM_ACPI_RTC_EN_EN |
511 PM_ACPI_TIMER_EN_EN);
Marc Jones24484842017-05-04 21:17:45 -0600512}
513
Marc Jonesdfeb1c42017-08-07 19:08:24 -0600514void southbridge_init(void *chip_info)
Marc Jones24484842017-05-04 21:17:45 -0600515{
Marc Jonesdfeb1c42017-08-07 19:08:24 -0600516 sb_init_acpi_ports();
Marc Jones24484842017-05-04 21:17:45 -0600517}
518
Marc Jonesdfeb1c42017-08-07 19:08:24 -0600519void southbridge_final(void *chip_info)
Marc Jones24484842017-05-04 21:17:45 -0600520{
Richard Spiegel38f19402017-09-29 11:39:46 -0700521 if (IS_ENABLED(CONFIG_STONEYRIDGE_IMC_FWM)) {
522 agesawrapper_fchecfancontrolservice();
523 if (!IS_ENABLED(CONFIG_ACPI_ENABLE_THERMAL_ZONE))
524 enable_imc_thermal_zone();
525 }
Marc Jones24484842017-05-04 21:17:45 -0600526}
Marshall Dawson8a906df2017-06-13 14:19:02 -0600527
528/*
529 * Update the PCI devices with a valid IRQ number
530 * that is set in the mainboard PCI_IRQ structures.
531 */
532static void set_pci_irqs(void *unused)
533{
534 /* Write PCI_INTR regs 0xC00/0xC01 */
535 write_pci_int_table();
536
537 /* Write IRQs for all devicetree enabled devices */
538 write_pci_cfg_irqs();
539}
540
541/*
542 * Hook this function into the PCI state machine
543 * on entry into BS_DEV_ENABLE.
544 */
545BOOT_STATE_INIT_ENTRY(BS_DEV_ENABLE, BS_ON_ENTRY, set_pci_irqs, NULL);