blob: c8b2e2217a890c08eb2dc7729c6e4caeb427a072 [file] [log] [blame]
Patrick Georgi70517072020-05-10 18:47:05 +02001/* SPDX-License-Identifier: BSD-3-Clause */
Aaron Durbin76c37002012-10-30 09:03:43 -05002
3#ifndef PEI_DATA_H
4#define PEI_DATA_H
5
Elyes HAOUASc4e41932018-11-01 11:29:50 +01006#include <stdint.h>
7
Aaron Durbin76c37002012-10-30 09:03:43 -05008typedef void (*tx_byte_func)(unsigned char byte);
Stefan Reinauer190688c2013-08-13 11:18:42 -07009#define PEI_VERSION 15
Aaron Durbinb1c25e72013-05-23 15:57:46 -050010
Angel Ponsd0f971f2021-03-12 14:20:05 +010011#define PEI_USB_OC_PIN_SKIP 8
Aaron Durbinb1c25e72013-05-23 15:57:46 -050012
Angel Ponsd0f971f2021-03-12 14:20:05 +010013enum pei_usb2_port_location {
14 PEI_USB_PORT_BACK_PANEL = 0,
15 PEI_USB_PORT_FRONT_PANEL,
16 PEI_USB_PORT_DOCK,
17 PEI_USB_PORT_MINI_PCIE,
18 PEI_USB_PORT_FLEX,
19 PEI_USB_PORT_INTERNAL,
20 PEI_USB_PORT_SKIP
Duncan Lauriebcfcfa42013-06-03 10:41:12 -070021};
22
23/* Usb Port Length:
24 * [16:4] = length in inches in octal format
25 * [3:0] = decimal point
26 */
Angel Ponsd0f971f2021-03-12 14:20:05 +010027struct pei_usb2_port_setting {
Aaron Durbinb1c25e72013-05-23 15:57:46 -050028 uint16_t length;
29 uint8_t enable;
30 uint8_t over_current_pin;
Duncan Lauriebcfcfa42013-06-03 10:41:12 -070031 uint8_t location;
Stefan Reinauer6a001132017-07-13 02:20:27 +020032} __packed;
Aaron Durbinb1c25e72013-05-23 15:57:46 -050033
Angel Ponsd0f971f2021-03-12 14:20:05 +010034struct pei_usb3_port_setting {
Aaron Durbinb1c25e72013-05-23 15:57:46 -050035 uint8_t enable;
36 uint8_t over_current_pin;
Stefan Reinauer6a001132017-07-13 02:20:27 +020037} __packed;
Aaron Durbin8256a9b2012-11-29 17:18:53 -060038
Aaron Durbin76c37002012-10-30 09:03:43 -050039struct pei_data
40{
41 uint32_t pei_version;
42 uint32_t mchbar;
43 uint32_t dmibar;
44 uint32_t epbar;
45 uint32_t pciexbar;
46 uint16_t smbusbar;
Angel Ponse8abb5a2020-04-15 15:01:53 +020047 /* Unused by HSW MRC, but changes to the memory layout of this struct break the ABI */
48 uint32_t _unused_wdbbar;
49 uint32_t _unused_wdbsize;
Aaron Durbin76c37002012-10-30 09:03:43 -050050 uint32_t hpet_address;
51 uint32_t rcba;
52 uint32_t pmbase;
53 uint32_t gpiobase;
Aaron Durbin8256a9b2012-11-29 17:18:53 -060054 uint32_t temp_mmio_base;
Angel Pons6ba3a072020-04-24 17:42:19 +020055 /* System type: 0 => Mobile, 1 => Desktop/Server, 5 => ULT, Others => Reserved */
56 uint32_t system_type;
Aaron Durbin76c37002012-10-30 09:03:43 -050057 uint32_t tseg_size;
58 uint8_t spd_addresses[4];
Aaron Durbin76c37002012-10-30 09:03:43 -050059 int boot_mode;
60 int ec_present;
Stefan Reinauer1cc34162013-06-27 15:59:18 -070061 int gbe_enable;
Aaron Durbin76c37002012-10-30 09:03:43 -050062 // 0 = leave channel enabled
63 // 1 = disable dimm 0 on channel
64 // 2 = disable dimm 1 on channel
65 // 3 = disable dimm 0+1 on channel
66 int dimm_channel0_disabled;
67 int dimm_channel1_disabled;
Duncan Lauriebcfcfa42013-06-03 10:41:12 -070068 /* Enable 2x Refresh Mode */
69 int ddr_refresh_2x;
Stefan Reinauer190688c2013-08-13 11:18:42 -070070 int dq_pins_interleaved;
Aaron Durbin76c37002012-10-30 09:03:43 -050071 /* Data read from flash and passed into MRC */
72 unsigned char *mrc_input;
73 unsigned int mrc_input_len;
74 /* Data from MRC that should be saved to flash */
75 unsigned char *mrc_output;
76 unsigned int mrc_output_len;
Angel Pons1db5bc72020-01-15 00:49:03 +010077 /* Max frequency to run DDR3 at. Can be one of four values: 800, 1067, 1333, 1600 */
Aaron Durbin76c37002012-10-30 09:03:43 -050078 uint32_t max_ddr3_freq;
Duncan Laurie289bac62013-07-30 15:41:42 -070079 /* Route all USB ports to XHCI controller in resume path */
80 int usb_xhci_on_resume;
Angel Ponsd0f971f2021-03-12 14:20:05 +010081 struct pei_usb2_port_setting usb2_ports[16];
82 struct pei_usb3_port_setting usb3_ports[16];
Elyes Haouasca3764a2024-05-12 11:50:08 +020083 uint8_t spd_data[4][SPD_SIZE_MAX_DDR3];
Aaron Durbin76c37002012-10-30 09:03:43 -050084 tx_byte_func tx_byte;
Stefan Reinauer6a001132017-07-13 02:20:27 +020085} __packed;
Aaron Durbin76c37002012-10-30 09:03:43 -050086
87#endif