Stefan Reinauer | d7bd4eb | 2013-02-11 11:11:36 -0800 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2007-2010 coresystems GmbH |
| 5 | * Copyright (C) 2011 The ChromiumOS Authors. All rights reserved. |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; version 2 of the License. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
Stefan Reinauer | d7bd4eb | 2013-02-11 11:11:36 -0800 | [diff] [blame] | 15 | */ |
| 16 | |
| 17 | #include <stdint.h> |
Stefan Reinauer | d7bd4eb | 2013-02-11 11:11:36 -0800 | [diff] [blame] | 18 | #include <cpu/x86/lapic.h> |
Kyösti Mälkki | 6722f8d | 2014-06-16 09:14:49 +0300 | [diff] [blame] | 19 | #include <arch/acpi.h> |
Edward O'Callaghan | 77757c2 | 2015-01-04 21:33:39 +1100 | [diff] [blame] | 20 | #include <northbridge/intel/sandybridge/sandybridge.h> |
Vladimir Serbinenko | 421b340 | 2016-02-10 02:39:51 +0100 | [diff] [blame] | 21 | #include <northbridge/intel/sandybridge/raminit.h> |
Alexandru Gagniuc | 83b05eb | 2015-02-15 14:09:21 -0600 | [diff] [blame] | 22 | #include <northbridge/intel/sandybridge/raminit_native.h> |
Edward O'Callaghan | 77757c2 | 2015-01-04 21:33:39 +1100 | [diff] [blame] | 23 | #include <southbridge/intel/bd82x6x/pch.h> |
Patrick Rudolph | e8e66f4 | 2016-02-06 17:42:42 +0100 | [diff] [blame] | 24 | #include <southbridge/intel/common/gpio.h> |
Julius Werner | cd49cce | 2019-03-05 16:53:33 -0800 | [diff] [blame] | 25 | #if CONFIG(CHROMEOS) |
Stefan Reinauer | d7bd4eb | 2013-02-11 11:11:36 -0800 | [diff] [blame] | 26 | #include <vendorcode/google/chromeos/chromeos.h> |
| 27 | #endif |
Stefan Reinauer | d7bd4eb | 2013-02-11 11:11:36 -0800 | [diff] [blame] | 28 | |
Arthur Heymans | 9c53834 | 2019-11-12 16:42:33 +0100 | [diff] [blame] | 29 | void mainboard_late_rcba_config(void) |
Stefan Reinauer | d7bd4eb | 2013-02-11 11:11:36 -0800 | [diff] [blame] | 30 | { |
Kyösti Mälkki | 6f49906 | 2015-06-06 11:52:24 +0300 | [diff] [blame] | 31 | /* |
| 32 | * GFX INTA -> PIRQA (MSI) |
| 33 | * D28IP_P1IP WLAN INTA -> PIRQB |
| 34 | * D28IP_P2IP ETH0 INTB -> PIRQF |
| 35 | * D28IP_P3IP SDCARD INTC -> PIRQD |
| 36 | * D29IP_E1P EHCI1 INTA -> PIRQD |
| 37 | * D26IP_E2P EHCI2 INTA -> PIRQF |
| 38 | * D31IP_SIP SATA INTA -> PIRQB (MSI) |
| 39 | * D31IP_SMIP SMBUS INTB -> PIRQH |
| 40 | * D31IP_TTIP THRT INTC -> PIRQA |
| 41 | * D27IP_ZIP HDA INTA -> PIRQA (MSI) |
| 42 | * |
| 43 | * Trackpad interrupt is edge triggered and cannot be shared. |
| 44 | * TRACKPAD -> PIRQG |
| 45 | |
| 46 | */ |
| 47 | |
| 48 | /* Device interrupt pin register (board specific) */ |
| 49 | RCBA32(D31IP) = (INTC << D31IP_TTIP) | (NOINT << D31IP_SIP2) | |
| 50 | (INTB << D31IP_SMIP) | (INTA << D31IP_SIP); |
| 51 | RCBA32(D29IP) = (INTA << D29IP_E1P); |
| 52 | RCBA32(D28IP) = (INTA << D28IP_P1IP) | (INTB << D28IP_P2IP) | |
| 53 | (INTC << D28IP_P3IP); |
| 54 | RCBA32(D27IP) = (INTA << D27IP_ZIP); |
| 55 | RCBA32(D26IP) = (INTA << D26IP_E2P); |
| 56 | RCBA32(D25IP) = (NOINT << D25IP_LIP); |
| 57 | RCBA32(D22IP) = (NOINT << D22IP_MEI1IP); |
| 58 | |
| 59 | /* Device interrupt route registers */ |
| 60 | DIR_ROUTE(D31IR, PIRQB, PIRQH, PIRQA, PIRQC); |
| 61 | DIR_ROUTE(D29IR, PIRQD, PIRQE, PIRQF, PIRQG); |
| 62 | DIR_ROUTE(D28IR, PIRQB, PIRQF, PIRQD, PIRQE); |
| 63 | DIR_ROUTE(D27IR, PIRQA, PIRQH, PIRQA, PIRQB); |
| 64 | DIR_ROUTE(D26IR, PIRQF, PIRQE, PIRQG, PIRQH); |
| 65 | DIR_ROUTE(D25IR, PIRQA, PIRQB, PIRQC, PIRQD); |
| 66 | DIR_ROUTE(D22IR, PIRQA, PIRQB, PIRQC, PIRQD); |
Stefan Reinauer | d7bd4eb | 2013-02-11 11:11:36 -0800 | [diff] [blame] | 67 | } |
| 68 | |
Alexandru Gagniuc | 83b05eb | 2015-02-15 14:09:21 -0600 | [diff] [blame] | 69 | const struct southbridge_usb_port mainboard_usb_ports[] = { |
Vladimir Serbinenko | 4a84e47 | 2016-02-10 02:51:48 +0100 | [diff] [blame] | 70 | /* enabled power usb oc pin */ |
| 71 | { 1, 0, -1 }, /* P0: Right USB 3.0 #1 (no OC) */ |
| 72 | { 1, 0, -1 }, /* P1: Right USB 3.0 #2 (no OC) */ |
| 73 | { 1, 0, -1 }, /* P2: Camera (no OC) */ |
| 74 | { 0, 0, -1 }, /* P3: Empty */ |
| 75 | { 0, 0, -1 }, /* P4: Empty */ |
| 76 | { 0, 0, -1 }, /* P5: Empty */ |
| 77 | { 0, 0, -1 }, /* P6: Empty */ |
| 78 | { 0, 0, -1 }, /* P7: Empty */ |
| 79 | { 0, 0, -1 }, /* P8: Empty */ |
| 80 | { 1, 1, -1 }, /* P9: Left USB 1 (no OC) */ |
| 81 | { 1, 0, -1 }, /* P10: Mini PCIe - WLAN / BT (no OC) */ |
| 82 | { 0, 0, -1 }, /* P11: Empty */ |
| 83 | { 0, 0, -1 }, /* P12: Empty */ |
| 84 | { 0, 0, -1 }, /* P13: Empty */ |
Alexandru Gagniuc | 83b05eb | 2015-02-15 14:09:21 -0600 | [diff] [blame] | 85 | }; |
Stefan Reinauer | d7bd4eb | 2013-02-11 11:11:36 -0800 | [diff] [blame] | 86 | |
Peter Lemenkov | 498f1cc | 2019-02-07 10:48:10 +0100 | [diff] [blame] | 87 | void mainboard_get_spd(spd_raw_data *spd, bool id_only) |
| 88 | { |
Kyösti Mälkki | e258b9a | 2016-11-18 19:59:23 +0200 | [diff] [blame] | 89 | read_spd(&spd[0], 0x50, id_only); |
| 90 | read_spd(&spd[2], 0x52, id_only); |
Stefan Reinauer | d7bd4eb | 2013-02-11 11:11:36 -0800 | [diff] [blame] | 91 | } |
Vladimir Serbinenko | 609bd94 | 2016-01-31 14:00:54 +0100 | [diff] [blame] | 92 | |
Vladimir Serbinenko | 421b340 | 2016-02-10 02:39:51 +0100 | [diff] [blame] | 93 | void mainboard_fill_pei_data(struct pei_data *pei_data) |
| 94 | { |
| 95 | struct pei_data pei_data_template = { |
| 96 | .pei_version = PEI_VERSION, |
| 97 | .mchbar = (uintptr_t)DEFAULT_MCHBAR, |
| 98 | .dmibar = (uintptr_t)DEFAULT_DMIBAR, |
| 99 | .epbar = DEFAULT_EPBAR, |
| 100 | .pciexbar = CONFIG_MMCONF_BASE_ADDRESS, |
| 101 | .smbusbar = SMBUS_IO_BASE, |
| 102 | .wdbbar = 0x4000000, |
| 103 | .wdbsize = 0x1000, |
| 104 | .hpet_address = CONFIG_HPET_ADDRESS, |
| 105 | .rcba = (uintptr_t)DEFAULT_RCBABASE, |
| 106 | .pmbase = DEFAULT_PMBASE, |
| 107 | .gpiobase = DEFAULT_GPIOBASE, |
| 108 | .thermalbase = 0xfed08000, |
| 109 | .system_type = 0, // 0 Mobile, 1 Desktop/Server |
| 110 | .tseg_size = CONFIG_SMM_TSEG_SIZE, |
| 111 | .spd_addresses = { 0xA0, 0x00,0xA4,0x00 }, |
| 112 | .ts_addresses = { 0x00, 0x00, 0x00, 0x00 }, |
| 113 | .ec_present = 1, |
| 114 | .ddr3lv_support = 0, |
| 115 | // 0 = leave channel enabled |
| 116 | // 1 = disable dimm 0 on channel |
| 117 | // 2 = disable dimm 1 on channel |
| 118 | // 3 = disable dimm 0+1 on channel |
| 119 | .dimm_channel0_disabled = 2, |
| 120 | .dimm_channel1_disabled = 2, |
| 121 | .max_ddr3_freq = 1600, |
| 122 | .usb_port_config = { |
| 123 | /* enabled usb oc pin length */ |
| 124 | { 1, 0, 0x0040 }, /* P0: Right USB 3.0 #1 (no OC) */ |
| 125 | { 1, 0, 0x0040 }, /* P1: Right USB 3.0 #2 (no OC) */ |
| 126 | { 1, 0, 0x0040 }, /* P2: Camera (no OC) */ |
| 127 | { 0, 0, 0x0000 }, /* P3: Empty */ |
| 128 | { 0, 0, 0x0000 }, /* P4: Empty */ |
| 129 | { 0, 0, 0x0000 }, /* P5: Empty */ |
| 130 | { 0, 0, 0x0000 }, /* P6: Empty */ |
| 131 | { 0, 0, 0x0000 }, /* P7: Empty */ |
| 132 | { 0, 4, 0x0000 }, /* P8: Empty */ |
| 133 | { 1, 4, 0x0080 }, /* P9: Left USB 1 (no OC) */ |
| 134 | { 1, 4, 0x0040 }, /* P10: Mini PCIe - WLAN / BT (no OC) */ |
| 135 | { 0, 4, 0x0000 }, /* P11: Empty */ |
| 136 | { 0, 4, 0x0000 }, /* P12: Empty */ |
| 137 | { 0, 4, 0x0000 }, /* P13: Empty */ |
| 138 | }, |
| 139 | .ddr_refresh_rate_config = 2, /* Force double refresh rate */ |
| 140 | }; |
| 141 | *pei_data = pei_data_template; |
| 142 | } |
Matt DeVillier | c35a1e8 | 2017-07-11 23:59:53 -0500 | [diff] [blame] | 143 | |
| 144 | int mainboard_should_reset_usb(int s3resume) |
| 145 | { |
| 146 | return !s3resume; |
| 147 | } |