1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
|
/* SPDX-License-Identifier: GPL-2.0-only */
#include <console/console.h>
#include <espi.h>
#include <stdint.h>
void espi_show_slave_general_configuration(uint32_t config)
{
uint32_t io_mode;
uint32_t op_freq;
printk(BIOS_DEBUG, "eSPI Slave configuration:\n");
if (config & ESPI_SLAVE_CRC_ENABLE)
printk(BIOS_DEBUG, " CRC checking enabled\n");
if (config & ESPI_SLAVE_RESP_MOD_ENABLE)
printk(BIOS_DEBUG, " Response modifier enabled\n");
if (config & ESPI_SLAVE_ALERT_MODE_PIN)
printk(BIOS_DEBUG, " Dedicated Alert# used to signal alert event\n");
else
printk(BIOS_DEBUG, " IO bit1 pin used to signal alert event\n");
io_mode = config & ESPI_SLAVE_IO_MODE_SEL_MASK;
switch (io_mode) {
case ESPI_SLAVE_IO_MODE_SEL_SINGLE:
printk(BIOS_DEBUG, " eSPI single IO mode selected\n");
break;
case ESPI_SLAVE_IO_MODE_SEL_DUAL:
printk(BIOS_DEBUG, " eSPI dual IO mode selected\n");
break;
case ESPI_SLAVE_IO_MODE_SEL_QUAD:
printk(BIOS_DEBUG, " eSPI quad IO mode selected\n");
break;
default:
printk(BIOS_DEBUG, " Error: Invalid eSPI IO mode selected\n");
}
io_mode = config & ESPI_SLAVE_IO_MODE_SUPP_MASK;
switch (io_mode) {
case ESPI_SLAVE_IO_MODE_SUPP_SINGLE_QUAD:
printk(BIOS_DEBUG, " eSPI quad and single IO modes supported\n");
break;
case ESPI_SLAVE_IO_MODE_SUPP_SINGLE_DUAL:
printk(BIOS_DEBUG, " eSPI dual and single IO modes supported\n");
break;
case ESPI_SLAVE_IO_MODE_SUPP_SINGLE_DUAL_QUAD:
printk(BIOS_DEBUG, " eSPI quad, dual and single IO modes supported\n");
break;
default:
printk(BIOS_DEBUG, " Only eSPI single IO mode supported\n");
}
if (config & ESPI_SLAVE_OPEN_DRAIN_ALERT_SEL)
printk(BIOS_DEBUG, " Alert# pin is open-drain\n");
else
printk(BIOS_DEBUG, " Alert# pin is driven\n");
op_freq = config & ESPI_SLAVE_OP_FREQ_SEL_MASK;
switch (op_freq) {
case ESPI_SLAVE_OP_FREQ_SEL_20_MHZ:
printk(BIOS_DEBUG, " eSPI 20MHz selected\n");
break;
case ESPI_SLAVE_OP_FREQ_SEL_25_MHZ:
printk(BIOS_DEBUG, " eSPI 25MHz selected\n");
break;
case ESPI_SLAVE_OP_FREQ_SEL_33_MHZ:
printk(BIOS_DEBUG, " eSPI 33MHz selected\n");
break;
case ESPI_SLAVE_OP_FREQ_SEL_50_MHZ:
printk(BIOS_DEBUG, " eSPI 50MHz selected\n");
break;
case ESPI_SLAVE_OP_FREQ_SEL_66_MHZ:
printk(BIOS_DEBUG, " eSPI 66MHz selected\n");
break;
default:
printk(BIOS_DEBUG, " Error: Invalid eSPI frequency\n");
}
if (config & ESPI_SLAVE_OPEN_DRAIN_ALERT_SUPP)
printk(BIOS_DEBUG, " Open-drain Alert# pin supported\n");
op_freq = config & ESPI_SLAVE_OP_FREQ_SUPP_MASK;
switch (op_freq) {
case ESPI_SLAVE_OP_FREQ_SUPP_20_MHZ:
printk(BIOS_DEBUG, " eSPI up to 20MHz supported\n");
break;
case ESPI_SLAVE_OP_FREQ_SUPP_25_MHZ:
printk(BIOS_DEBUG, " eSPI up to 25MHz supported\n");
break;
case ESPI_SLAVE_OP_FREQ_SUPP_33_MHZ:
printk(BIOS_DEBUG, " eSPI up to 33MHz supported\n");
break;
case ESPI_SLAVE_OP_FREQ_SUPP_50_MHZ:
printk(BIOS_DEBUG, " eSPI up to 50MHz supported\n");
break;
case ESPI_SLAVE_OP_FREQ_SUPP_66_MHZ:
printk(BIOS_DEBUG, " eSPI up to 66MHz supported\n");
break;
default:
printk(BIOS_DEBUG, " Error: Invalid eSPI frequency\n");
}
printk(BIOS_DEBUG, " Maximum Wait state: %d\n",
(config & ESPI_SLAVE_MAX_WAIT_MASK) >> ESPI_SLAVE_MAX_WAIT_SHIFT);
if (config & ESPI_SLAVE_PERIPH_CH_SUPP)
printk(BIOS_DEBUG, " Peripheral Channel supported\n");
if (config & ESPI_SLAVE_VW_CH_SUPP)
printk(BIOS_DEBUG, " Virtual Wire Channel supported\n");
if (config & ESPI_SLAVE_OOB_CH_SUPP)
printk(BIOS_DEBUG, " OOB Channel supported\n");
if (config & ESPI_SLAVE_FLASH_CH_SUPP)
printk(BIOS_DEBUG, " Flash Access Channel supported\n");
printk(BIOS_DEBUG, "\n");
}
void espi_show_slave_peripheral_channel_configuration(uint32_t config)
{
uint32_t request_size;
uint32_t payload_size;
printk(BIOS_DEBUG, "eSPI Slave Peripheral configuration:\n");
printk(BIOS_DEBUG, " Peripheral Channel Maximum Read Request Size: ");
request_size = config & ESPI_SLAVE_PERIPH_MAX_READ_SIZE_MASK;
switch (request_size) {
case ESPI_SLAVE_PERIPH_MAX_READ_64B:
printk(BIOS_DEBUG, "64 bytes\n");
break;
case ESPI_SLAVE_PERIPH_MAX_READ_128B:
printk(BIOS_DEBUG, "128 bytes\n");
break;
case ESPI_SLAVE_PERIPH_MAX_READ_256B:
printk(BIOS_DEBUG, "256 bytes\n");
break;
case ESPI_SLAVE_PERIPH_MAX_READ_512B:
printk(BIOS_DEBUG, "512 bytes\n");
break;
case ESPI_SLAVE_PERIPH_MAX_READ_1024B:
printk(BIOS_DEBUG, "1024 bytes\n");
break;
case ESPI_SLAVE_PERIPH_MAX_READ_2048B:
printk(BIOS_DEBUG, "2048 bytes\n");
break;
case ESPI_SLAVE_PERIPH_MAX_READ_4096B:
printk(BIOS_DEBUG, "4096 bytes\n");
break;
default:
printk(BIOS_DEBUG, "Unknown\n");
}
printk(BIOS_DEBUG, " Peripheral Channel Maximum Payload Size Selected: ");
payload_size = config & ESPI_SLAVE_PERIPH_MAX_PAYLOAD_SIZE_SEL_MASK;
switch (payload_size) {
case ESPI_SLAVE_PERIPH_MAX_PAYLOAD_SIZE_SEL_64B:
printk(BIOS_DEBUG, "64 bytes\n");
break;
case ESPI_SLAVE_PERIPH_MAX_PAYLOAD_SIZE_SEL_128B:
printk(BIOS_DEBUG, "128 bytes\n");
break;
case ESPI_SLAVE_PERIPH_MAX_PAYLOAD_SIZE_SEL_256B:
printk(BIOS_DEBUG, "256 bytes\n");
break;
default:
printk(BIOS_DEBUG, "Unknown\n");
}
printk(BIOS_DEBUG, " Peripheral Channel Maximum Payload Size Supported: ");
payload_size = config & ESPI_SLAVE_PERIPH_MAX_PAYLOAD_SIZE_SUPP_MASK;
switch (payload_size) {
case ESPI_SLAVE_PERIPH_MAX_PAYLOAD_SIZE_SUPP_64B:
printk(BIOS_DEBUG, "64 bytes\n");
break;
case ESPI_SLAVE_PERIPH_MAX_PAYLOAD_SIZE_SUPP_128B:
printk(BIOS_DEBUG, "128 bytes\n");
break;
case ESPI_SLAVE_PERIPH_MAX_PAYLOAD_SIZE_SUPP_256B:
printk(BIOS_DEBUG, "256 bytes\n");
break;
default:
printk(BIOS_DEBUG, "Unknown\n");
}
printk(BIOS_DEBUG, " Bus master: ");
if (config & ESPI_SLAVE_PERIPH_BUS_MASTER_ENABLE)
printk(BIOS_DEBUG, "enabled\n");
else
printk(BIOS_DEBUG, "disabled\n");
printk(BIOS_DEBUG, " Peripheral Channel: ");
if (config & ESPI_SLAVE_CHANNEL_READY)
printk(BIOS_DEBUG, "ready\n");
else
printk(BIOS_DEBUG, "not ready\n");
printk(BIOS_DEBUG, " Peripheral Channel: ");
if (config & ESPI_SLAVE_CHANNEL_ENABLE)
printk(BIOS_DEBUG, "enabled\n");
else
printk(BIOS_DEBUG, "disabled\n");
}
|