Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [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 | |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 35 | typedef void (*tx_byte_func)(unsigned char byte); |
Stefan Reinauer | 190688c | 2013-08-13 11:18:42 -0700 | [diff] [blame] | 36 | #define PEI_VERSION 15 |
Aaron Durbin | b1c25e7 | 2013-05-23 15:57:46 -0500 | [diff] [blame] | 37 | |
| 38 | #define MAX_USB2_PORTS 16 |
| 39 | #define MAX_USB3_PORTS 16 |
| 40 | #define USB_OC_PIN_SKIP 8 |
| 41 | |
Duncan Laurie | bcfcfa4 | 2013-06-03 10:41:12 -0700 | [diff] [blame] | 42 | enum usb2_port_location { |
| 43 | USB_PORT_BACK_PANEL = 0, |
| 44 | USB_PORT_FRONT_PANEL, |
| 45 | USB_PORT_DOCK, |
| 46 | USB_PORT_MINI_PCIE, |
| 47 | USB_PORT_FLEX, |
| 48 | USB_PORT_INTERNAL, |
| 49 | USB_PORT_SKIP |
| 50 | }; |
| 51 | |
| 52 | /* Usb Port Length: |
| 53 | * [16:4] = length in inches in octal format |
| 54 | * [3:0] = decimal point |
| 55 | */ |
Aaron Durbin | b1c25e7 | 2013-05-23 15:57:46 -0500 | [diff] [blame] | 56 | struct usb2_port_setting { |
| 57 | uint16_t length; |
| 58 | uint8_t enable; |
| 59 | uint8_t over_current_pin; |
Duncan Laurie | bcfcfa4 | 2013-06-03 10:41:12 -0700 | [diff] [blame] | 60 | uint8_t location; |
Stefan Reinauer | 6a00113 | 2017-07-13 02:20:27 +0200 | [diff] [blame] | 61 | } __packed; |
Aaron Durbin | b1c25e7 | 2013-05-23 15:57:46 -0500 | [diff] [blame] | 62 | |
| 63 | struct usb3_port_setting { |
| 64 | uint8_t enable; |
| 65 | uint8_t over_current_pin; |
Stefan Reinauer | 6a00113 | 2017-07-13 02:20:27 +0200 | [diff] [blame] | 66 | } __packed; |
Aaron Durbin | 8256a9b | 2012-11-29 17:18:53 -0600 | [diff] [blame] | 67 | |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 68 | struct pei_data |
| 69 | { |
| 70 | uint32_t pei_version; |
| 71 | uint32_t mchbar; |
| 72 | uint32_t dmibar; |
| 73 | uint32_t epbar; |
| 74 | uint32_t pciexbar; |
| 75 | uint16_t smbusbar; |
| 76 | uint32_t wdbbar; |
| 77 | uint32_t wdbsize; |
| 78 | uint32_t hpet_address; |
| 79 | uint32_t rcba; |
| 80 | uint32_t pmbase; |
| 81 | uint32_t gpiobase; |
Aaron Durbin | 8256a9b | 2012-11-29 17:18:53 -0600 | [diff] [blame] | 82 | uint32_t temp_mmio_base; |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 83 | uint32_t system_type; // 0 Mobile, 1 Desktop/Server |
| 84 | uint32_t tseg_size; |
| 85 | uint8_t spd_addresses[4]; |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 86 | int boot_mode; |
| 87 | int ec_present; |
Stefan Reinauer | 1cc3416 | 2013-06-27 15:59:18 -0700 | [diff] [blame] | 88 | int gbe_enable; |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 89 | // 0 = leave channel enabled |
| 90 | // 1 = disable dimm 0 on channel |
| 91 | // 2 = disable dimm 1 on channel |
| 92 | // 3 = disable dimm 0+1 on channel |
| 93 | int dimm_channel0_disabled; |
| 94 | int dimm_channel1_disabled; |
Duncan Laurie | bcfcfa4 | 2013-06-03 10:41:12 -0700 | [diff] [blame] | 95 | /* Enable 2x Refresh Mode */ |
| 96 | int ddr_refresh_2x; |
Stefan Reinauer | 190688c | 2013-08-13 11:18:42 -0700 | [diff] [blame] | 97 | int dq_pins_interleaved; |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 98 | /* Data read from flash and passed into MRC */ |
| 99 | unsigned char *mrc_input; |
| 100 | unsigned int mrc_input_len; |
| 101 | /* Data from MRC that should be saved to flash */ |
| 102 | unsigned char *mrc_output; |
| 103 | unsigned int mrc_output_len; |
| 104 | /* |
Aaron Durbin | b1c25e7 | 2013-05-23 15:57:46 -0500 | [diff] [blame] | 105 | * Max frequency DDR3 could be ran at. Could be one of four values: 800, |
| 106 | * 1067, 1333, 1600 |
| 107 | */ |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 108 | uint32_t max_ddr3_freq; |
Duncan Laurie | 289bac6 | 2013-07-30 15:41:42 -0700 | [diff] [blame] | 109 | /* Route all USB ports to XHCI controller in resume path */ |
| 110 | int usb_xhci_on_resume; |
Aaron Durbin | b1c25e7 | 2013-05-23 15:57:46 -0500 | [diff] [blame] | 111 | struct usb2_port_setting usb2_ports[MAX_USB2_PORTS]; |
| 112 | struct usb3_port_setting usb3_ports[MAX_USB3_PORTS]; |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 113 | uint8_t spd_data[4][256]; |
| 114 | tx_byte_func tx_byte; |
Stefan Reinauer | 6a00113 | 2017-07-13 02:20:27 +0200 | [diff] [blame] | 115 | } __packed; |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 116 | |
| 117 | #endif |