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