blob: dfc34d8ce9d5a890a428730368d2dbd1affc67ee [file] [log] [blame]
Aaron Durbin76c37002012-10-30 09:03:43 -05001/*
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 HAOUASc4e41932018-11-01 11:29:50 +010033#include <stdint.h>
34
Aaron Durbin76c37002012-10-30 09:03:43 -050035typedef void (*tx_byte_func)(unsigned char byte);
Stefan Reinauer190688c2013-08-13 11:18:42 -070036#define PEI_VERSION 15
Aaron Durbinb1c25e72013-05-23 15:57:46 -050037
38#define MAX_USB2_PORTS 16
39#define MAX_USB3_PORTS 16
40#define USB_OC_PIN_SKIP 8
41
Duncan Lauriebcfcfa42013-06-03 10:41:12 -070042enum 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 Durbinb1c25e72013-05-23 15:57:46 -050056struct usb2_port_setting {
57 uint16_t length;
58 uint8_t enable;
59 uint8_t over_current_pin;
Duncan Lauriebcfcfa42013-06-03 10:41:12 -070060 uint8_t location;
Stefan Reinauer6a001132017-07-13 02:20:27 +020061} __packed;
Aaron Durbinb1c25e72013-05-23 15:57:46 -050062
63struct usb3_port_setting {
64 uint8_t enable;
65 uint8_t over_current_pin;
Stefan Reinauer6a001132017-07-13 02:20:27 +020066} __packed;
Aaron Durbin8256a9b2012-11-29 17:18:53 -060067
Aaron Durbin76c37002012-10-30 09:03:43 -050068struct 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 Durbin8256a9b2012-11-29 17:18:53 -060082 uint32_t temp_mmio_base;
Aaron Durbin76c37002012-10-30 09:03:43 -050083 uint32_t system_type; // 0 Mobile, 1 Desktop/Server
84 uint32_t tseg_size;
85 uint8_t spd_addresses[4];
Aaron Durbin76c37002012-10-30 09:03:43 -050086 int boot_mode;
87 int ec_present;
Stefan Reinauer1cc34162013-06-27 15:59:18 -070088 int gbe_enable;
Aaron Durbin76c37002012-10-30 09:03:43 -050089 // 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 Lauriebcfcfa42013-06-03 10:41:12 -070095 /* Enable 2x Refresh Mode */
96 int ddr_refresh_2x;
Stefan Reinauer190688c2013-08-13 11:18:42 -070097 int dq_pins_interleaved;
Aaron Durbin76c37002012-10-30 09:03:43 -050098 /* 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 Durbinb1c25e72013-05-23 15:57:46 -0500105 * Max frequency DDR3 could be ran at. Could be one of four values: 800,
106 * 1067, 1333, 1600
107 */
Aaron Durbin76c37002012-10-30 09:03:43 -0500108 uint32_t max_ddr3_freq;
Duncan Laurie289bac62013-07-30 15:41:42 -0700109 /* Route all USB ports to XHCI controller in resume path */
110 int usb_xhci_on_resume;
Aaron Durbinb1c25e72013-05-23 15:57:46 -0500111 struct usb2_port_setting usb2_ports[MAX_USB2_PORTS];
112 struct usb3_port_setting usb3_ports[MAX_USB3_PORTS];
Aaron Durbin76c37002012-10-30 09:03:43 -0500113 uint8_t spd_data[4][256];
114 tx_byte_func tx_byte;
Stefan Reinauer6a001132017-07-13 02:20:27 +0200115} __packed;
Aaron Durbin76c37002012-10-30 09:03:43 -0500116
117#endif