coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
xhci.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #ifndef SOC_INTEL_COMMON_BLOCK_XHCI_H
4 #define SOC_INTEL_COMMON_BLOCK_XHCI_H
5 
6 #include <device/device.h>
7 #include <elog.h>
8 #include <stdint.h>
9 
10 /*
11  * struct xhci_usb_info - Data containing number of USB ports & offset.
12  * @usb2_port_status_reg: Offset to USB2 port status register.
13  * @num_usb2_ports: Number of USB2 ports.
14  * @usb3_port_status_reg: Offset to USB3 port status register.
15  * @num_usb3_ports: Number of USB3 ports.
16  */
17 struct xhci_usb_info {
22 };
23 
24 /*
25  * struct xhci_wake_info - Relates an XHCI device to registers and wake types
26  * @xhci_dev: devfn of the XHCI device
27  * @elog_wake_type_host: the wake type for the controller device
28  */
32 };
33 
34 /*
35  * xhci_update_wake_event() - Identify and log XHCI wake events.
36  * @wake_info: A mapping of XHCI devfn to elog wake types
37  * @wake_info_count: Count of items in wake_info
38  * @info: Information about number of USB ports and their status reg offset.
39  *
40  * This function goes through individual USB port status registers within the
41  * XHCI block and identifies if any of those USB ports triggered a wake-up and
42  * log information about those ports to the event log.
43  *
44  * Return: True if any port is identified as a wake source, false if none.
45  */
46 bool xhci_update_wake_event(const struct xhci_wake_info *wake_info,
47  size_t wake_info_count);
48 
49 /* xhci_host_reset() - Function to reset the host controller */
50 void xhci_host_reset(void);
51 void soc_xhci_init(struct device *dev);
52 
53 /*
54  * soc_get_xhci_usb_info() - Get the information about USB2 & USB3 ports.
55  *
56  * This function is used to get USB ports and status register offset information
57  * within a XHCI controller.
58  *
59  * Return: USB ports and status register offset info for the SoC.
60  */
61 const struct xhci_usb_info *soc_get_xhci_usb_info(pci_devfn_t xhci_dev);
62 
63 /*
64  * usb_xhci_disable_unused() - Disable unused USB devices
65  * @ext_usb_xhci_en_cb: Callback function to be invoked, supplied by mainboard,
66  * to identify the status of externally visible USB ports.
67  * (Return true if port is present, false if port is absent)
68  *
69  * This function is used to disable unused USB devices/ports that are configured
70  * in the device tree. For the internal USB ports, the connect status of the port
71  * is probed from the XHCI controller block and the port is disabled if it is not
72  * connected. For the external USB ports, the mainboard provides the connect status
73  * of the concerned port depending on the variants and their SKUs. If the mainboard
74  * supplied callback function is NULL, then all the externally visible USB devices
75  * in the device tree are enabled.
76  */
77 void usb_xhci_disable_unused(bool (*ext_usb_xhci_en_cb)(unsigned int port_type,
78  unsigned int port_id));
79 
80 #endif /* SOC_INTEL_COMMON_BLOCK_XHCI_H */
u32 pci_devfn_t
Definition: pci_type.h:8
const struct xhci_usb_info * soc_get_xhci_usb_info(pci_devfn_t xhci_dev)
Definition: xhci.c:36
void usb_xhci_disable_unused(bool(*ext_usb_xhci_en_cb)(unsigned int port_type, unsigned int port_id))
void soc_xhci_init(struct device *dev)
Definition: xhci.c:56
bool xhci_update_wake_event(const struct xhci_wake_info *wake_info, size_t wake_info_count)
Definition: elog.c:98
void xhci_host_reset(void)
Definition: xhci.c:33
unsigned int uint32_t
Definition: stdint.h:14
unsigned char uint8_t
Definition: stdint.h:8
Definition: device.h:107
uint32_t usb3_port_status_reg
Definition: xhci.h:20
uint32_t usb2_port_status_reg
Definition: xhci.h:18
uint32_t num_usb2_ports
Definition: xhci.h:19
uint32_t num_usb3_ports
Definition: xhci.h:21
uint8_t elog_wake_type_host
Definition: xhci.h:31
pci_devfn_t xhci_dev
Definition: xhci.h:30