coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
retimer.c
Go to the documentation of this file.
1
/* SPDX-License-Identifier: GPL-2.0-or-later */
2
3
#include <
console/console.h
>
4
#include <
device/device.h
>
5
#include <
drivers/intel/usb4/retimer/retimer.h
>
6
#include <
intelblocks/tcss.h
>
7
8
int
retimer_get_index_for_typec
(
uint8_t
typec_port)
9
{
10
int
ec_port = 0;
11
12
const
struct
device
*tcss_port_arr[] = {
13
DEV_PTR
(tcss_usb3_port1),
14
DEV_PTR
(tcss_usb3_port2),
15
DEV_PTR
(tcss_usb3_port3),
16
DEV_PTR
(tcss_usb3_port4),
17
};
18
19
for
(
uint8_t
i = 0; i <
MAX_TYPE_C_PORTS
; i++) {
20
if
(i == typec_port) {
21
printk
(
BIOS_INFO
,
"USB Type-C %d mapped to EC port %d\n"
, typec_port,
22
ec_port);
23
return
ec_port;
24
}
25
26
if
(
is_dev_enabled
(tcss_port_arr[i]))
27
ec_port++;
28
}
29
30
// Code should not come here if typec_port input is correct
31
return
-1;
32
}
tcss.h
MAX_TYPE_C_PORTS
@ MAX_TYPE_C_PORTS
Definition:
tcss.h:77
printk
#define printk(level,...)
Definition:
stdlib.h:16
console.h
is_dev_enabled
bool is_dev_enabled(const struct device *dev)
Definition:
device_const.c:369
retimer_get_index_for_typec
__weak int retimer_get_index_for_typec(uint8_t typec_port)
Definition:
retimer.c:458
device.h
DEV_PTR
#define DEV_PTR(_alias)
Definition:
device.h:403
BIOS_INFO
#define BIOS_INFO
BIOS_INFO - Expected events.
Definition:
loglevel.h:113
retimer.h
uint8_t
unsigned char uint8_t
Definition:
stdint.h:8
device
Definition:
device.h:107
src
soc
intel
alderlake
retimer.c
Generated by
1.9.1