coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
|
#include <assert.h>
#include <console/console.h>
#include <device/device.h>
#include <device/path.h>
#include <device/pci.h>
#include <device/pci_def.h>
#include <device/resource.h>
#include <fw_config.h>
Go to the source code of this file.
Functions | |
static DEVTREE_CONST struct device * | dev_find_slot (unsigned int bus, unsigned int devfn) |
Given a PCI bus and a devfn number, find the device structure. More... | |
DEVTREE_CONST struct device * | dev_find_path (DEVTREE_CONST struct device *prev_match, enum device_path_type path_type) |
Given a Device Path Type, find the device structure. More... | |
DEVTREE_CONST struct device * | dev_find_next_pci_device (DEVTREE_CONST struct device *previous_dev) |
Given a device pointer, find the next PCI device. More... | |
static int | path_eq (const struct device_path *path1, const struct device_path *path2) |
DEVTREE_CONST struct device * | find_dev_path (const struct bus *parent, const struct device_path *path) |
See if a device structure exists for path. More... | |
DEVTREE_CONST struct device * | find_dev_nested_path (const struct bus *parent, const struct device_path nested_path[], size_t nested_path_length) |
Find the device structure given an array of nested device paths,. More... | |
DEVTREE_CONST struct device * | pcidev_path_behind (const struct bus *parent, pci_devfn_t devfn) |
DEVTREE_CONST struct device * | pcidev_path_on_bus (unsigned int bus, pci_devfn_t devfn) |
DEVTREE_CONST struct bus * | pci_root_bus (void) |
DEVTREE_CONST struct device * | pcidev_path_on_root (pci_devfn_t devfn) |
DEVTREE_CONST struct device * | pcidev_on_root (uint8_t dev, uint8_t fn) |
DEVTREE_CONST struct device * | pcidev_path_behind_pci2pci_bridge (const struct device *bridge, pci_devfn_t devfn) |
DEVTREE_CONST struct device * | pcidev_path_on_root_debug (pci_devfn_t devfn, const char *func) |
void | devtree_bug (const char *func, pci_devfn_t devfn) |
void __noreturn | devtree_die (void) |
DEVTREE_CONST struct device * | dev_find_slot_on_smbus (unsigned int bus, unsigned int addr) |
Given an SMBus bus and a device number, find the device structure. More... | |
DEVTREE_CONST struct device * | dev_find_slot_pnp (u16 port, u16 device) |
Given a PnP port and a device number, find the device structure. More... | |
DEVTREE_CONST struct device * | dev_bus_each_child (const struct bus *parent, DEVTREE_CONST struct device *prev_child) |
Given a device and previous match iterate through all the children. More... | |
bool | is_dev_enabled (const struct device *dev) |
bool | is_devfn_enabled (unsigned int devfn) |
Variables | |
DEVTREE_CONST struct device *DEVTREE_CONST | all_devices = &dev_root |
Linked list of ALL devices. More... | |
DEVTREE_CONST struct device* dev_bus_each_child | ( | const struct bus * | parent, |
DEVTREE_CONST struct device * | prev_child | ||
) |
Given a device and previous match iterate through all the children.
bus | parent device's bus holding all the children |
prev_child | previous child already traversed, if NULL start at children of parent bus. |
Definition at line 353 of file device_const.c.
References bus::children, DEVTREE_CONST, NULL, and device::sibling.
Referenced by audio_codec_device_update(), variant_devtree_update(), and variant_touchscreen_update().
DEVTREE_CONST struct device* dev_find_next_pci_device | ( | DEVTREE_CONST struct device * | previous_dev | ) |
Given a device pointer, find the next PCI device.
previous_dev | A pointer to a PCI device structure. |
Definition at line 79 of file device_const.c.
References dev_find_path(), and DEVICE_PATH_PCI.
DEVTREE_CONST struct device* dev_find_path | ( | DEVTREE_CONST struct device * | prev_match, |
enum device_path_type | path_type | ||
) |
Given a Device Path Type, find the device structure.
prev_match | The previously matched device instance. |
path_type | The Device Path Type. |
Definition at line 53 of file device_const.c.
References all_devices, DEVTREE_CONST, device::next, NULL, device::path, and device_path::type.
Referenced by dev_find_next_pci_device(), get_usb_port_references(), init_cpus(), pci_root_bus(), and variant_devtree_update().
|
static |
Given a PCI bus and a devfn number, find the device structure.
Note that this function can return the incorrect device prior to PCI enumeration because the secondary field of the bus object is 0. The failing scenario is determined by the order of the devices in all_devices singly-linked list as well as the time when this function is called (secondary reflecting topology).
bus | The bus number. |
devfn | A device/function number. |
Definition at line 29 of file device_const.c.
References all_devices, device::bus, pci_path::devfn, DEVICE_PATH_PCI, DEVTREE_CONST, device::next, device::path, device_path::pci, bus::secondary, and device_path::type.
Referenced by pcidev_path_on_root_debug().
DEVTREE_CONST struct device* dev_find_slot_on_smbus | ( | unsigned int | bus, |
unsigned int | addr | ||
) |
Given an SMBus bus and a device number, find the device structure.
bus | The bus number. |
addr | A device number. |
Definition at line 307 of file device_const.c.
References addr, all_devices, device::bus, i2c_path::device, DEVICE_PATH_I2C, DEVTREE_CONST, device_path::i2c, device::next, device::path, bus::secondary, and device_path::type.
Referenced by at24rf08c_find_bank(), and smbios_system_set_uuid().
DEVTREE_CONST struct device* dev_find_slot_pnp | ( | u16 | port, |
u16 | device | ||
) |
Given a PnP port and a device number, find the device structure.
port | The I/O port. |
device | Logical device number. |
Definition at line 331 of file device_const.c.
References all_devices, pnp_path::device, DEVICE_PATH_PNP, DEVTREE_CONST, device::next, device::path, device_path::pnp, pnp_path::port, and device_path::type.
Referenced by config_addon_uart(), config_gpio_mux(), disable_gpio_io_port(), drivers_lenovo_is_wacom_present(), early_hybrid_graphics(), reset_gpio_default_od(), sch5545_get_gpio(), sch5545_read_emi_bar(), sch5545_set_drq(), sch5545_set_iobase(), and sch5545_set_irq().
void devtree_bug | ( | const char * | func, |
pci_devfn_t | devfn | ||
) |
Definition at line 290 of file device_const.c.
References BIOS_ERR, and printk.
Referenced by pcidev_path_on_root_debug().
void __noreturn devtree_die | ( | void | ) |
Definition at line 295 of file device_const.c.
References die().
Referenced by config_of().
DEVTREE_CONST struct device* find_dev_nested_path | ( | const struct bus * | parent, |
const struct device_path | nested_path[], | ||
size_t | nested_path_length | ||
) |
Find the device structure given an array of nested device paths,.
parent | The parent bus to start the search on. |
nested_path | An array of relative paths from the parent bus to the target device. |
nested_path_length | Number of path elements in nested_path array. |
Definition at line 193 of file device_const.c.
References DEVTREE_CONST, find_dev_path(), device::link_list, and NULL.
Referenced by fill_fspm_misc_params(), and tcss_get_port_info().
DEVTREE_CONST struct device* find_dev_path | ( | const struct bus * | parent, |
const struct device_path * | path | ||
) |
See if a device structure exists for path.
parent | The bus to find the device on. |
path | The relative path from the bus to the appropriate device. |
Definition at line 166 of file device_const.c.
References BUG, bus::children, DEVTREE_CONST, NULL, device::path, path_eq(), and device::sibling.
Referenced by add_cpu_device(), alloc_find_dev(), camera_fill_sensor(), ecam0_fix_missing_devices(), find_dev_nested_path(), and pcidev_path_behind().
Definition at line 369 of file device_const.c.
References DEVTREE_EARLY, device::enabled, fw_config_probe_dev(), and NULL.
Referenced by check_xdci_enable(), fill_fspm_misc_params(), fill_fsps_tcss_params(), is_devfn_enabled(), mainboard_get_dxio_ddi_descriptors(), pcie_generic_fill_ssdt(), pcie_rtd3_acpi_fill_ssdt(), pcie_slot_enable_mask(), platform_fsp_memory_init_params_cb(), platform_fsp_silicon_init_params_cb(), retimer_get_index_for_typec(), tcss_get_port_info(), typec_orientation_fixup(), variant_has_pcie_wwan(), and wwan_fm350gl_acpi_fill_ssdt().
Definition at line 382 of file device_const.c.
References is_dev_enabled(), and pcidev_path_on_root().
Referenced by fill_fspm_audio_params(), fill_fspm_igd_params(), fill_fspm_ipu_params(), fill_fspm_ish_params(), fill_fspm_smbus_params(), fill_fspm_tcss_params(), fill_fspm_trace_params(), fill_fspm_usb4_params(), fill_fsps_cnvi_params(), fill_fsps_igd_params(), fill_fsps_lan_params(), fill_fsps_sata_params(), fill_fsps_storage_params(), fill_fsps_tbt_params(), fill_fsps_thc_params(), fill_fsps_thermal_params(), fill_fsps_tsn_params(), fill_fsps_vmd_params(), get_param_value(), get_supported_lpm_mask(), glk_fsp_silicon_init_params_cb(), is_cse_devfn_visible(), parse_devicetree_setting(), platform_fsp_memory_init_params_cb(), platform_fsp_silicon_init_params_cb(), soc_add_fixed_mmio_resources(), soc_fill_dmar(), soc_gpu_init_params(), soc_memory_init_params(), soc_peg_init_params(), soc_primary_gfx_config_params(), and systemagent_vtd_init().
|
static |
Definition at line 85 of file device_const.c.
References mmio_path::addr, device_path::apic, apic_path::apic_id, assert, BIOS_ERR, cpu_cluster_path::cluster, device_path::cpu, device_path::cpu_bus, device_path::cpu_cluster, spi_path::cs, pci_path::devfn, pnp_path::device, i2c_path::device, DEVICE_PATH_APIC, DEVICE_PATH_CPU, DEVICE_PATH_CPU_BUS, DEVICE_PATH_CPU_CLUSTER, DEVICE_PATH_DOMAIN, DEVICE_PATH_GENERIC, DEVICE_PATH_GPIO, DEVICE_PATH_I2C, DEVICE_PATH_MMIO, DEVICE_PATH_NONE, DEVICE_PATH_PCI, DEVICE_PATH_PNP, DEVICE_PATH_ROOT, DEVICE_PATH_SPI, DEVICE_PATH_USB, domain_path::domain, device_path::domain, device_path::generic, device_path::gpio, device_path::i2c, cpu_path::id, cpu_bus_path::id, generic_path::id, gpio_path::id, device_path::mmio, i2c_path::mode_10bit, device_path::pci, device_path::pnp, pnp_path::port, usb_path::port_id, usb_path::port_type, printk, device_path::spi, generic_path::subid, device_path::type, and device_path::usb.
Referenced by find_dev_path().
DEVTREE_CONST struct bus* pci_root_bus | ( | void | ) |
Definition at line 239 of file device_const.c.
References dev_find_path(), DEVICE_PATH_DOMAIN, DEVTREE_CONST, device::link_list, and NULL.
Referenced by fill_fspm_misc_params(), fill_fsps_tsn_params(), pcidev_path_on_bus(), pcidev_path_on_root(), pcie_rp_update_devicetree(), and tcss_get_port_info().
DEVTREE_CONST struct device* pcidev_on_root | ( | uint8_t | dev, |
uint8_t | fn | ||
) |
Definition at line 260 of file device_const.c.
References PCI_DEVFN, and pcidev_path_on_root().
Referenced by acpi_create_igfx_rmrr(), acpi_fill_dmar(), acpi_fill_fadt(), acpi_fill_ivrs(), acpi_fill_ivrs11(), acpi_fill_ivrs40(), acpi_fill_madt(), AmdMemoryReadSPD(), aseg_smm_install(), aseg_smm_lock(), aseg_smm_relocate(), baytrail_run_reference_code(), bridge_silicon_revision(), camera_fill_sensor(), camera_fill_ssdb_defaults(), configure_dmi_pm(), cpu_bus_scan(), cpu_pci_domain_read_resources(), devicetree_fill_pei_data(), devtree_update(), disable_devices(), disable_p2p(), disable_peg(), early_graphics_setup(), early_lpc_init(), ecam0_init(), enable_lp_clock_gating(), fam16_finalize(), fill_in_pattrs(), find_vbt_location(), get_gpio_base(), get_hostbridge_dev(), get_ich7_sata_ports(), get_lpc_dev(), get_mc_dev(), get_node_pci(), get_num_ports(), get_pmbase(), get_pmc_dev(), get_smbus_dev(), gm45_init(), gma_func0_disable(), gtt_setup(), hide_ast2400(), hide_hsuarts(), hide_pci_dev(), hide_pci_fn(), i82801gx_lpc_setup(), i82801ix_ehci_init(), i82801ix_lpc_setup(), i82801ix_pcie_init(), i82801jx_ehci_init(), i82801jx_lpc_setup(), i82801jx_pcie_init(), init(), intel_acpi_gen_def_acpi_pirq(), intel_gma_init_lvds(), intel_gma_init_vga(), ironlake_init(), is_sandybridge(), lpc_get_pmbase(), lpc_init(), lpt_pm_init(), mainboard_enable(), mainboard_final(), mainboard_init(), mainboard_romstage_entry(), mc_read_resources(), mch_domain_init(), mch_domain_read_resources(), northbridge_fill_pei_data(), northbridge_topology_init(), northbridge_write_smram(), pch_enable_gbe(), pch_enable_lpc(), pch_enable_lpc_decode(), pch_get_lpc_device(), pch_log_state(), pch_silicon_revision(), pch_silicon_type(), pcie_slot_enable_mask(), perform_raminit(), platform_BeforeInitLate(), platform_BeforeInitReset(), platform_fsp_silicon_init_params_cb(), qemu_nb_init(), sata_enable(), sata_init(), sdram_program_row_boundaries(), smbios_mainboard_serial_number(), smm_lock(), smp_write_config_table(), soc_memory_init_params(), soc_silicon_init_params(), SocStepping(), southbridge_fill_pei_data(), southbridge_fill_ssdt(), spi_init(), systemagent_vtd_init(), usb_oc_setup(), and watchdog_off().
DEVTREE_CONST struct device* pcidev_path_behind | ( | const struct bus * | parent, |
pci_devfn_t | devfn | ||
) |
Definition at line 211 of file device_const.c.
References DEVICE_PATH_PCI, find_dev_path(), and device_path::type.
Referenced by acpi_fill_madt(), devfn_disable(), ecam0_init(), pci_scan_bus(), pcidev_path_behind_pci2pci_bridge(), pcidev_path_on_bus(), pcidev_path_on_root(), and smbios_mainboard_serial_number().
DEVTREE_CONST struct device* pcidev_path_behind_pci2pci_bridge | ( | const struct device * | bridge, |
pci_devfn_t | devfn | ||
) |
Definition at line 265 of file device_const.c.
References bridge, BUG, DEVICE_PATH_PCI, NULL, and pcidev_path_behind().
DEVTREE_CONST struct device* pcidev_path_on_bus | ( | unsigned int | bus, |
pci_devfn_t | devfn | ||
) |
Definition at line 221 of file device_const.c.
References device::bus, bus::children, DEVICE_PATH_PCI, DEVTREE_CONST, device::next, NULL, device::path, pci_root_bus(), pcidev_path_behind(), bus::secondary, and device_path::type.
Referenced by handleInt1a(), int1a_handler(), lock_pam0123(), pci_cfg_read(), and pirq_route_irqs().
DEVTREE_CONST struct device* pcidev_path_on_root | ( | pci_devfn_t | devfn | ) |
Definition at line 255 of file device_const.c.
References pci_root_bus(), and pcidev_path_behind().
Referenced by acpi_fill_dmar(), agesa_fch_initenv(), agesa_ReadSpd(), amd_init_late(), audio_codec_device_update(), broadwell_systemagent_finalize(), check_xdci_enable(), chip_final(), disable_devices(), fill_vr_domain_config(), get_mmio_size(), get_pl2(), get_pmc_ipcs_method(), get_sku_ac_dc_loadline(), get_sku_icc_max(), get_vccin_aux_imon_iccmax(), gpp_dxio_update_clk_req_config(), graphics_get_framebuffer_address(), graphics_get_gtt_base(), gspi_calc_base_addr(), i82801dx_enable(), i82801ix_function_disabled(), i82801jx_function_disabled(), igd_disable(), is_cnvi_held_in_reset(), is_devfn_enabled(), mainboard_final(), mainboard_set_power_limits(), mtk_pcie_get_controller_base(), parse_devicetree(), pch_cg_init(), pch_thermal_configuration(), pcidev_on_root(), pcidev_path_on_root_debug(), pcie_update_device_tree(), platform_fsp_memory_init_params_cb(), platform_fsp_silicon_init_params_cb(), platform_is_up3(), pmc_ipc_acpi_set_pci_clock(), sa_fill_gnvs(), sa_lock_pam(), set_board_env_params(), set_sb_aoac(), SetFchEnvParams(), SetFchResetParams(), SetMemParams(), smm_lock(), soc_customize_init_early(), soc_fill_dmar(), soc_irq_settings(), soc_systemagent_init(), soc_vtd_enabled(), system_agent_region_base(), systemagent_revision(), tbt_finalize(), uart_get_device(), variant_devtree_update(), variant_sku_gpio_table(), variant_update_devtree(), wa_init_display_signal(), and wifi_device_update().
DEVTREE_CONST struct device* pcidev_path_on_root_debug | ( | pci_devfn_t | devfn, |
const char * | func | ||
) |
Definition at line 278 of file device_const.c.
References dev_find_slot(), devtree_bug(), DEVTREE_CONST, and pcidev_path_on_root().
DEVTREE_CONST struct device* DEVTREE_CONST all_devices = &dev_root |
Linked list of ALL devices.
Definition at line 13 of file device_const.c.
Referenced by acpi_create_madt_lapics(), acpi_create_srat_lapics(), acpi_create_ssdt_generator(), acpi_fill_ivrs(), acpi_fill_ivrs11(), acpi_fill_ivrs40(), determine_total_number_of_cores(), dev_count_cpu(), dev_finalize_chips(), dev_find_class(), dev_find_device(), dev_find_lapic(), dev_find_path(), dev_find_slot(), dev_find_slot_on_smbus(), dev_find_slot_pnp(), dev_initialize_chips(), find_next_ioapic(), i82801gx_pirq_init(), i82801ix_pirq_init(), i82801jx_pirq_init(), mptable_write_buses(), pch_pcie_check_set_enabled(), pch_pcie_devicetree_update(), pch_pirq_init(), search_global_resources(), show_all_devs(), show_all_devs_resources(), show_all_devs_tree(), smbios_write_tables(), smbios_write_type11(), smp_write_processors(), update_board_layout(), write_acpi_tables(), write_pci_cfg_irqs(), write_pci_config_irqs(), write_smp_table(), and xeonsp_acpi_create_madt_lapics().