Stefan Reinauer | 00636b0 | 2012-04-04 00:08:51 +0200 | [diff] [blame] | 1 | /* |
| 2 | * coreboot UEFI PEI wrapper |
| 3 | * |
| 4 | * Copyright (c) 2011, Google Inc. |
| 5 | * All rights reserved. |
| 6 | * |
| 7 | * Redistribution and use in source and binary forms, with or without |
| 8 | * modification, are permitted provided that the following conditions are met: |
| 9 | * * Redistributions of source code must retain the above copyright |
| 10 | * notice, this list of conditions and the following disclaimer. |
| 11 | * * Redistributions in binary form must reproduce the above copyright |
| 12 | * notice, this list of conditions and the following disclaimer in the |
| 13 | * documentation and/or other materials provided with the distribution. |
| 14 | * * Neither the name of Google Inc. nor the |
| 15 | * names of its contributors may be used to endorse or promote products |
| 16 | * derived from this software without specific prior written permission. |
| 17 | * |
| 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 21 | * ARE DISCLAIMED. IN NO EVENT SHALL GOOGLE INC BE LIABLE FOR ANY DIRECT, |
| 22 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 | */ |
| 29 | |
| 30 | #ifndef PEI_DATA_H |
| 31 | #define PEI_DATA_H |
| 32 | |
Elyes HAOUAS | c4e4193 | 2018-11-01 11:29:50 +0100 | [diff] [blame] | 33 | #include <stdint.h> |
| 34 | |
Marc Jones | e7ae96f | 2012-11-13 15:07:45 -0700 | [diff] [blame] | 35 | typedef struct { |
Angel Pons | 7c49cb8 | 2020-03-16 23:17:32 +0100 | [diff] [blame] | 36 | uint16_t mode; /* 0: Disable, 1: Enable, 2: Auto, 3: Smart Auto */ |
| 37 | uint16_t hs_port_switch_mask; /* 4 bit mask, 1: switchable, 0: not switchable */ |
| 38 | uint16_t preboot_support; /* 0: No xHCI preOS driver, 1: xHCI preOS driver */ |
| 39 | uint16_t xhci_streams; /* 0: Disable, 1: Enable */ |
Marc Jones | e7ae96f | 2012-11-13 15:07:45 -0700 | [diff] [blame] | 40 | } pch_usb3_controller_settings; |
| 41 | |
Vadim Bendebury | 48a4a7f | 2012-06-07 18:47:13 -0700 | [diff] [blame] | 42 | typedef void (*tx_byte_func)(unsigned char byte); |
Stefan Reinauer | 1cc3416 | 2013-06-27 15:59:18 -0700 | [diff] [blame] | 43 | #define PEI_VERSION 6 |
Marc Jones | e7ae96f | 2012-11-13 15:07:45 -0700 | [diff] [blame] | 44 | |
Stefan Reinauer | 00636b0 | 2012-04-04 00:08:51 +0200 | [diff] [blame] | 45 | struct pei_data |
| 46 | { |
| 47 | uint32_t pei_version; |
| 48 | uint32_t mchbar; |
| 49 | uint32_t dmibar; |
| 50 | uint32_t epbar; |
| 51 | uint32_t pciexbar; |
| 52 | uint16_t smbusbar; |
| 53 | uint32_t wdbbar; |
| 54 | uint32_t wdbsize; |
| 55 | uint32_t hpet_address; |
| 56 | uint32_t rcba; |
| 57 | uint32_t pmbase; |
| 58 | uint32_t gpiobase; |
| 59 | uint32_t thermalbase; |
Angel Pons | 7c49cb8 | 2020-03-16 23:17:32 +0100 | [diff] [blame] | 60 | uint32_t system_type; /* 0 Mobile, 1 Desktop/Server */ |
Stefan Reinauer | 00636b0 | 2012-04-04 00:08:51 +0200 | [diff] [blame] | 61 | uint32_t tseg_size; |
| 62 | uint8_t spd_addresses[4]; |
| 63 | uint8_t ts_addresses[4]; |
| 64 | int boot_mode; |
| 65 | int ec_present; |
Stefan Reinauer | 1cc3416 | 2013-06-27 15:59:18 -0700 | [diff] [blame] | 66 | int gbe_enable; |
Angel Pons | 7c49cb8 | 2020-03-16 23:17:32 +0100 | [diff] [blame] | 67 | /* |
| 68 | * 0 = leave channel enabled |
| 69 | * 1 = disable dimm 0 on channel |
| 70 | * 2 = disable dimm 1 on channel |
| 71 | * 3 = disable dimm 0+1 on channel |
| 72 | */ |
Stefan Reinauer | 00636b0 | 2012-04-04 00:08:51 +0200 | [diff] [blame] | 73 | int dimm_channel0_disabled; |
| 74 | int dimm_channel1_disabled; |
| 75 | /* Seed values saved in CMOS */ |
| 76 | uint32_t scrambler_seed; |
| 77 | uint32_t scrambler_seed_s3; |
| 78 | /* Data read from flash and passed into MRC */ |
| 79 | unsigned char *mrc_input; |
| 80 | unsigned int mrc_input_len; |
| 81 | /* Data from MRC that should be saved to flash */ |
| 82 | unsigned char *mrc_output; |
| 83 | unsigned int mrc_output_len; |
| 84 | /* |
| 85 | * Max frequency DDR3 could be ran at. Could be one of four values: |
| 86 | * 800, 1067, 1333, 1600 |
| 87 | */ |
| 88 | uint32_t max_ddr3_freq; |
| 89 | /* |
| 90 | * USB Port Configuration: |
| 91 | * [0] = enable |
| 92 | * [1] = overcurrent pin |
| 93 | * [2] = length |
| 94 | * |
Angel Pons | 7c49cb8 | 2020-03-16 23:17:32 +0100 | [diff] [blame] | 95 | * Ports 0-7 can be mapped to OC0-OC3 |
Marc Jones | 53508fe | 2012-07-11 16:30:28 -0600 | [diff] [blame] | 96 | * Ports 8-13 can be mapped to OC4-OC7 |
| 97 | * |
Stefan Reinauer | 00636b0 | 2012-04-04 00:08:51 +0200 | [diff] [blame] | 98 | * Port Length |
| 99 | * MOBILE: |
Angel Pons | 7c49cb8 | 2020-03-16 23:17:32 +0100 | [diff] [blame] | 100 | * < 0x050 = Setting 1 (back panel, 1 to 5 in, lowest tx amplitude) |
| 101 | * < 0x140 = Setting 2 (back panel, 5 to 14 in, highest tx amplitude) |
Stefan Reinauer | 00636b0 | 2012-04-04 00:08:51 +0200 | [diff] [blame] | 102 | * DESKTOP: |
Angel Pons | 7c49cb8 | 2020-03-16 23:17:32 +0100 | [diff] [blame] | 103 | * < 0x080 = Setting 1 (front/back panel, less than 8 in, lowest tx amplitude) |
| 104 | * < 0x130 = Setting 2 (back panel, 8 to 13 in, higher tx amplitude) |
| 105 | * < 0x150 = Setting 3 (back panel, 13 to 15 in, highest tx amplitude) |
Stefan Reinauer | 00636b0 | 2012-04-04 00:08:51 +0200 | [diff] [blame] | 106 | */ |
| 107 | uint16_t usb_port_config[16][3]; |
Marc Jones | e7ae96f | 2012-11-13 15:07:45 -0700 | [diff] [blame] | 108 | /* See the usb3 struct above for details */ |
| 109 | pch_usb3_controller_settings usb3; |
Angel Pons | 7c49cb8 | 2020-03-16 23:17:32 +0100 | [diff] [blame] | 110 | /* |
| 111 | * SPD data array for onboard RAM. Note that spd_data [1..3] are ignored: instead, |
| 112 | * the "dimm_channel{0,1}_disabled" flag and the spd_addresses are used to determine |
| 113 | * which DIMMs should use the SPD from spd_data[0]. |
Stefan Reinauer | 00636b0 | 2012-04-04 00:08:51 +0200 | [diff] [blame] | 114 | */ |
| 115 | uint8_t spd_data[4][256]; |
Vadim Bendebury | 48a4a7f | 2012-06-07 18:47:13 -0700 | [diff] [blame] | 116 | tx_byte_func tx_byte; |
Duncan Laurie | e8179b5 | 2012-07-11 10:40:45 -0700 | [diff] [blame] | 117 | int ddr3lv_support; |
Angel Pons | 7c49cb8 | 2020-03-16 23:17:32 +0100 | [diff] [blame] | 118 | /* |
| 119 | * pcie_init needs to be set to 1 to have the system agent initialize PCIe. |
| 120 | * Note: This should only be required if your system has Gen3 devices and |
| 121 | * it will increase your boot time by at least 100ms. |
Stefan Reinauer | 7e8c8e9 | 2012-09-04 10:59:29 -0700 | [diff] [blame] | 122 | */ |
| 123 | int pcie_init; |
Angel Pons | 7c49cb8 | 2020-03-16 23:17:32 +0100 | [diff] [blame] | 124 | /* |
| 125 | * N mode functionality. Leave this setting at 0. |
| 126 | * |
| 127 | * 0: Auto |
| 128 | * 1: 1N |
| 129 | * 2: 2N |
Stefan Reinauer | 7e8c8e9 | 2012-09-04 10:59:29 -0700 | [diff] [blame] | 130 | */ |
| 131 | int nmode; |
Angel Pons | 7c49cb8 | 2020-03-16 23:17:32 +0100 | [diff] [blame] | 132 | /* |
| 133 | * DDR refresh rate config. JEDEC Standard No.21-C Annex K allows for DIMM SPD data to |
| 134 | * specify whether double-rate is required for extended operating temperature range. |
| 135 | * |
| 136 | * 0: Enable double rate based upon temperature thresholds |
| 137 | * 1: Normal rate |
| 138 | * 2: Always enable double rate |
Shawn Nematbakhsh | 932fbd6 | 2013-05-08 11:41:04 -0700 | [diff] [blame] | 139 | */ |
| 140 | int ddr_refresh_rate_config; |
Stefan Reinauer | 6a00113 | 2017-07-13 02:20:27 +0200 | [diff] [blame] | 141 | } __packed; |
Stefan Reinauer | 00636b0 | 2012-04-04 00:08:51 +0200 | [diff] [blame] | 142 | |
| 143 | #endif |