coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
pci_xhci.c File Reference
#include "pci_xhci.h"
#include <acpi/acpigen.h>
#include <acpi/acpigen_pci.h>
#include <console/console.h>
#include <device/pci.h>
#include <device/pci_ids.h>
#include <device/xhci.h>
#include <stdlib.h>
Include dependency graph for pci_xhci.c:

Go to the source code of this file.

Data Structures

struct  port_counts
 

Macros

#define PCI_XHCI_CLASSCODE   0x0c0330 /* USB3.0 xHCI controller */
 

Functions

__weak enum cb_err pci_xhci_get_wake_gpe (const struct device *dev, int *gpe)
 
static void xhci_count_ports (void *context, const struct xhci_supported_protocol *data)
 
static bool xhci_port_exists (const struct device *dev, const struct usb_path *path)
 
static const struct deviceget_xhci_dev (const struct device *dev)
 
static const char * xhci_acpi_name (const struct device *dev)
 
static void xhci_generate_port_acpi (void *context, const struct xhci_supported_protocol *data)
 
static void xhci_add_devices (const struct device *dev)
 
static void xhci_fill_ssdt (const struct device *dev)
 
static void xhci_enable (struct device *dev)
 

Variables

static unsigned int controller_count
 
static const struct device_operations xhci_pci_ops
 
static const unsigned short amd_pci_device_ids []
 
static const struct pci_driver xhci_pci_driver __pci_driver
 

Macro Definition Documentation

◆ PCI_XHCI_CLASSCODE

#define PCI_XHCI_CLASSCODE   0x0c0330 /* USB3.0 xHCI controller */

Definition at line 12 of file pci_xhci.c.

Function Documentation

◆ get_xhci_dev()

static const struct device* get_xhci_dev ( const struct device dev)
static

Definition at line 73 of file pci_xhci.c.

References device::bus, bus::dev, DEVICE_PATH_ROOT, NULL, device::ops, device::path, device_path::type, and xhci_pci_ops.

Referenced by xhci_acpi_name().

Here is the caller graph for this function:

◆ pci_xhci_get_wake_gpe()

__weak enum cb_err pci_xhci_get_wake_gpe ( const struct device dev,
int *  gpe 
)

Definition at line 22 of file pci_xhci.c.

References CB_SUCCESS.

Referenced by xhci_fill_ssdt().

Here is the caller graph for this function:

◆ xhci_acpi_name()

static const char* xhci_acpi_name ( const struct device dev)
static

◆ xhci_add_devices()

static void xhci_add_devices ( const struct device dev)
static

Definition at line 174 of file pci_xhci.c.

References acpigen_pop_len(), acpigen_write_device(), acpigen_write_name_integer(), xhci_for_each_supported_usb_cap(), and xhci_generate_port_acpi().

Referenced by xhci_fill_ssdt().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xhci_count_ports()

static void xhci_count_ports ( void context,
const struct xhci_supported_protocol data 
)
static

Definition at line 28 of file pci_xhci.c.

References BIOS_INFO, port_counts::high_speed, xhci_supported_protocol::major_rev, xhci_supported_protocol::port_count, printk, and port_counts::super_speed.

Referenced by xhci_port_exists().

Here is the caller graph for this function:

◆ xhci_enable()

static void xhci_enable ( struct device dev)
static

Definition at line 225 of file pci_xhci.c.

References ACPI_NAME_BUFFER_SIZE, BIOS_ERR, controller_count, device::enabled, malloc(), name, device::name, PCI_CLASS_REVISION, pci_read_config32(), PCI_XHCI_CLASSCODE, printk, and snprintf().

Here is the call graph for this function:

◆ xhci_fill_ssdt()

◆ xhci_generate_port_acpi()

static void xhci_generate_port_acpi ( void context,
const struct xhci_supported_protocol data 
)
static

◆ xhci_port_exists()

static bool xhci_port_exists ( const struct device dev,
const struct usb_path path 
)
static

Definition at line 45 of file pci_xhci.c.

References BIOS_INFO, port_counts::high_speed, usb_path::port_id, usb_path::port_type, printk, xhci_count_ports(), and xhci_for_each_supported_usb_cap().

Referenced by xhci_acpi_name().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ __pci_driver

const struct pci_driver xhci_pci_driver __pci_driver
static
Initial value:
= {
.ops = &xhci_pci_ops,
.vendor = PCI_VID_AMD,
.devices = amd_pci_device_ids,
}
#define PCI_VID_AMD
Definition: pci_ids.h:496
static const struct device_operations xhci_pci_ops
Definition: pci_xhci.c:15
static const unsigned short amd_pci_device_ids[]
Definition: pci_xhci.c:255

Definition at line 255 of file pci_xhci.c.

◆ amd_pci_device_ids

const unsigned short amd_pci_device_ids[]
static
Initial value:
= {
0
}
#define PCI_DID_AMD_FAM17H_MODELA0H_XHCI2
Definition: pci_ids.h:602
#define PCI_DID_AMD_FAM17H_MODELA0H_XHCI0
Definition: pci_ids.h:600
#define PCI_DID_AMD_FAM17H_MODELA0H_XHCI1
Definition: pci_ids.h:601
#define PCI_DID_AMD_FAM17H_MODEL20H_XHCI0
Definition: pci_ids.h:598
#define PCI_DID_AMD_FAM17H_MODEL60H_XHCI
Definition: pci_ids.h:599
#define PCI_DID_AMD_FAM17H_MODEL18H_XHCI0
Definition: pci_ids.h:596
#define PCI_DID_AMD_FAM17H_MODEL18H_XHCI1
Definition: pci_ids.h:597

Definition at line 255 of file pci_xhci.c.

◆ controller_count

unsigned int controller_count
static

Definition at line 14 of file pci_xhci.c.

Referenced by xhci_enable().

◆ xhci_pci_ops

static const struct device_operations xhci_pci_ops
static
Initial value:
= {
.read_resources = pci_dev_read_resources,
.set_resources = pci_dev_set_resources,
.enable_resources = pci_dev_enable_resources,
.init = pci_dev_init,
.scan_bus = scan_static_bus,
.enable = xhci_enable,
.ops_pci = &pci_dev_ops_pci,
.acpi_fill_ssdt = xhci_fill_ssdt,
.acpi_name = xhci_acpi_name,
}
void pci_dev_init(struct device *dev)
Default handler: only runs the relevant PCI BIOS.
Definition: pci_device.c:873
void pci_dev_enable_resources(struct device *dev)
Definition: pci_device.c:721
void pci_dev_read_resources(struct device *dev)
Definition: pci_device.c:534
struct pci_operations pci_dev_ops_pci
Default device operation for PCI devices.
Definition: pci_device.c:911
void pci_dev_set_resources(struct device *dev)
Definition: pci_device.c:691
static const char * xhci_acpi_name(const struct device *dev)
Definition: pci_xhci.c:85
static void xhci_fill_ssdt(const struct device *dev)
Definition: pci_xhci.c:187
static void xhci_enable(struct device *dev)
Definition: pci_xhci.c:225
void scan_static_bus(struct device *bus)
Definition: root_device.c:89

Definition at line 14 of file pci_xhci.c.

Referenced by get_xhci_dev(), and xhci_acpi_name().