Angel Pons | 64b5d97 | 2020-04-05 13:20:50 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Matt DeVillier | 81ae67a | 2016-11-08 15:04:30 -0600 | [diff] [blame] | 2 | |
Matt DeVillier | 81ae67a | 2016-11-08 15:04:30 -0600 | [diff] [blame] | 3 | #include <stdint.h> |
Kyösti Mälkki | cd7a70f | 2019-08-17 20:51:08 +0300 | [diff] [blame] | 4 | #include <arch/romstage.h> |
Matt DeVillier | 81ae67a | 2016-11-08 15:04:30 -0600 | [diff] [blame] | 5 | #include <cpu/intel/haswell/haswell.h> |
| 6 | #include <northbridge/intel/haswell/haswell.h> |
| 7 | #include <northbridge/intel/haswell/raminit.h> |
| 8 | #include <southbridge/intel/lynxpoint/lp_gpio.h> |
| 9 | #include <southbridge/intel/lynxpoint/pch.h> |
Matt DeVillier | 81ae67a | 2016-11-08 15:04:30 -0600 | [diff] [blame] | 10 | |
Angel Pons | 6e1c471 | 2020-07-03 13:05:10 +0200 | [diff] [blame] | 11 | void mainboard_config_rcba(void) |
| 12 | { |
Matt DeVillier | 81ae67a | 2016-11-08 15:04:30 -0600 | [diff] [blame] | 13 | /* |
| 14 | * GFX INTA -> PIRQA (MSI) |
| 15 | * D28IP_P1IP PCIE INTA -> PIRQA |
| 16 | * D29IP_E1P EHCI INTA -> PIRQD |
| 17 | * D20IP_XHCI XHCI INTA -> PIRQC (MSI) |
| 18 | * D31IP_SIP SATA INTA -> PIRQF (MSI) |
| 19 | * D31IP_SMIP SMBUS INTB -> PIRQG |
| 20 | * D31IP_TTIP THRT INTC -> PIRQA |
| 21 | * D27IP_ZIP HDA INTA -> PIRQG (MSI) |
| 22 | */ |
| 23 | |
| 24 | /* Device interrupt pin register (board specific) */ |
Angel Pons | 6e1c471 | 2020-07-03 13:05:10 +0200 | [diff] [blame] | 25 | RCBA32(D31IP) = (INTC << D31IP_TTIP) | (NOINT << D31IP_SIP2) | |
| 26 | (INTB << D31IP_SMIP) | (INTA << D31IP_SIP); |
| 27 | RCBA32(D29IP) = (INTA << D29IP_E1P); |
| 28 | RCBA32(D28IP) = (INTA << D28IP_P1IP) | (INTC << D28IP_P3IP) | |
| 29 | (INTB << D28IP_P4IP); |
| 30 | RCBA32(D27IP) = (INTA << D27IP_ZIP); |
| 31 | RCBA32(D26IP) = (INTA << D26IP_E2P); |
| 32 | RCBA32(D22IP) = (NOINT << D22IP_MEI1IP); |
| 33 | RCBA32(D20IP) = (INTA << D20IP_XHCI); |
Matt DeVillier | 81ae67a | 2016-11-08 15:04:30 -0600 | [diff] [blame] | 34 | |
| 35 | /* Device interrupt route registers */ |
Angel Pons | c05c2b3 | 2020-07-03 14:28:48 +0200 | [diff] [blame^] | 36 | RCBA16(D31IR) = DIR_ROUTE(PIRQG, PIRQC, PIRQB, PIRQA); /* LPC */ |
| 37 | RCBA16(D29IR) = DIR_ROUTE(PIRQD, PIRQD, PIRQD, PIRQD); /* EHCI */ |
| 38 | RCBA16(D28IR) = DIR_ROUTE(PIRQA, PIRQB, PIRQC, PIRQD); /* PCIE */ |
| 39 | RCBA16(D27IR) = DIR_ROUTE(PIRQG, PIRQG, PIRQG, PIRQG); /* HDA */ |
| 40 | RCBA16(D22IR) = DIR_ROUTE(PIRQA, PIRQA, PIRQA, PIRQA); /* ME */ |
| 41 | RCBA16(D21IR) = DIR_ROUTE(PIRQE, PIRQF, PIRQF, PIRQF); /* SIO */ |
| 42 | RCBA16(D20IR) = DIR_ROUTE(PIRQC, PIRQC, PIRQC, PIRQC); /* XHCI */ |
| 43 | RCBA16(D23IR) = DIR_ROUTE(PIRQH, PIRQH, PIRQH, PIRQH); /* SDIO */ |
Angel Pons | 6e1c471 | 2020-07-03 13:05:10 +0200 | [diff] [blame] | 44 | } |
Matt DeVillier | 81ae67a | 2016-11-08 15:04:30 -0600 | [diff] [blame] | 45 | |
Kyösti Mälkki | 157b189 | 2019-08-16 14:02:25 +0300 | [diff] [blame] | 46 | void mainboard_romstage_entry(void) |
Matt DeVillier | 81ae67a | 2016-11-08 15:04:30 -0600 | [diff] [blame] | 47 | { |
| 48 | struct pei_data pei_data = { |
| 49 | .pei_version = PEI_VERSION, |
| 50 | .mchbar = (uintptr_t)DEFAULT_MCHBAR, |
| 51 | .dmibar = (uintptr_t)DEFAULT_DMIBAR, |
| 52 | .epbar = DEFAULT_EPBAR, |
Kyösti Mälkki | 503d324 | 2019-03-05 07:54:28 +0200 | [diff] [blame] | 53 | .pciexbar = CONFIG_MMCONF_BASE_ADDRESS, |
Matt DeVillier | 81ae67a | 2016-11-08 15:04:30 -0600 | [diff] [blame] | 54 | .smbusbar = SMBUS_IO_BASE, |
Matt DeVillier | 81ae67a | 2016-11-08 15:04:30 -0600 | [diff] [blame] | 55 | .hpet_address = HPET_ADDR, |
| 56 | .rcba = (uintptr_t)DEFAULT_RCBA, |
| 57 | .pmbase = DEFAULT_PMBASE, |
| 58 | .gpiobase = DEFAULT_GPIOBASE, |
| 59 | .temp_mmio_base = 0xfed08000, |
| 60 | .system_type = 5, /* ULT */ |
| 61 | .tseg_size = CONFIG_SMM_TSEG_SIZE, |
| 62 | .spd_addresses = { 0xa0, 0x00, 0xa4, 0x00 }, |
| 63 | .ec_present = 0, |
| 64 | // 0 = leave channel enabled |
| 65 | // 1 = disable dimm 0 on channel |
| 66 | // 2 = disable dimm 1 on channel |
| 67 | // 3 = disable dimm 0+1 on channel |
| 68 | .dimm_channel0_disabled = 2, |
| 69 | .dimm_channel1_disabled = 2, |
| 70 | // Enable 2x refresh mode |
| 71 | .ddr_refresh_2x = 1, |
| 72 | .dq_pins_interleaved = 1, |
| 73 | .max_ddr3_freq = 1600, |
| 74 | .usb_xhci_on_resume = 1, |
| 75 | .usb2_ports = { |
| 76 | /* Length, Enable, OCn#, Location */ |
| 77 | { 0x0064, 1, 0, /* P0: VP8 */ |
| 78 | USB_PORT_MINI_PCIE }, |
| 79 | { 0x0040, 1, 0, /* P1: Port A, CN22 */ |
| 80 | USB_PORT_INTERNAL }, |
| 81 | { 0x0040, 1, 1, /* P2: Port B, CN23 */ |
| 82 | USB_PORT_INTERNAL }, |
| 83 | { 0x0040, 1, USB_OC_PIN_SKIP, /* P3: WLAN */ |
| 84 | USB_PORT_INTERNAL }, |
| 85 | { 0x0040, 1, 2, /* P4: Port C, CN25 */ |
| 86 | USB_PORT_INTERNAL }, |
| 87 | { 0x0040, 1, 2, /* P5: Port D, CN25 */ |
| 88 | USB_PORT_INTERNAL }, |
| 89 | { 0x0040, 1, USB_OC_PIN_SKIP, /* P6: Card Reader */ |
| 90 | USB_PORT_INTERNAL }, |
| 91 | { 0x0000, 0, 0, /* P7: N/C */ |
| 92 | USB_PORT_SKIP }, |
| 93 | }, |
| 94 | .usb3_ports = { |
| 95 | /* Enable, OCn# */ |
| 96 | { 1, 0 }, /* P1; CN22 */ |
| 97 | { 1, 1 }, /* P2; CN23 */ |
| 98 | { 1, 2 }, /* P3; CN25 */ |
| 99 | { 1, 2 }, /* P4; CN25 */ |
| 100 | }, |
| 101 | }; |
| 102 | |
Matt DeVillier | 81ae67a | 2016-11-08 15:04:30 -0600 | [diff] [blame] | 103 | /* Call into the real romstage main with this board's attributes. */ |
Angel Pons | 14c4f4f | 2020-07-03 14:22:20 +0200 | [diff] [blame] | 104 | romstage_common(&pei_data); |
Matt DeVillier | 81ae67a | 2016-11-08 15:04:30 -0600 | [diff] [blame] | 105 | } |