![]() |
coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
|
#include <device/resource.h>
#include <device/path.h>
#include <device/pci_type.h>
#include <smbios.h>
#include <static.h>
#include <types.h>
Go to the source code of this file.
Data Structures | |
struct | chip_operations |
struct | device_operations |
struct | bus |
struct | pci_irq_info |
struct | device |
Macros | |
#define | CHIP_NAME(X) .name = X, |
#define | amd_cpu_topology(cpu, node, core) set_cpu_topology(cpu, node, 0, core, 0) |
#define | intel_cpu_topology(cpu, package, core, thread) set_cpu_topology(cpu, 0, package, core, thread) |
#define | LOG_MEM_RESOURCE(type, dev, index, base_kb, size_kb) |
#define | LOG_IO_RESOURCE(type, dev, index, base, size) |
#define | DEV_FUNC_ENTER(dev) |
#define | DEV_FUNC_EXIT(dev) |
#define | DEVICE_IO_ALIGN 16 |
#define | DEVICE_MEM_ALIGN 4096 |
#define | ram_resource(dev, idx, basek, sizek) fixed_mem_resource(dev, idx, basek, sizek, IORESOURCE_CACHEABLE) |
#define | reserved_ram_resource(dev, idx, basek, sizek) |
#define | bad_ram_resource(dev, idx, basek, sizek) reserved_ram_resource((dev), (idx), (basek), (sizek)) |
#define | uma_resource(dev, idx, basek, sizek) fixed_mem_resource(dev, idx, basek, sizek, IORESOURCE_RESERVE) |
#define | mmio_resource(dev, idx, basek, sizek) fixed_mem_resource(dev, idx, basek, sizek, IORESOURCE_RESERVE) |
#define | io_resource(dev, idx, base, size) fixed_io_resource(dev, idx, base, size) |
#define | config_of_soc() __pci_0_00_0_config |
#define | DEV_PTR(_alias) _dev_##_alias##_ptr |
#define | WEAK_DEV_PTR(_alias) __weak DEVTREE_CONST struct device *const DEV_PTR(_alias) |
Functions | |
static void | noop_read_resources (struct device *dev) |
Standard device operations function pointers shims. More... | |
static void | noop_set_resources (struct device *dev) |
struct device * | alloc_dev (struct bus *parent, struct device_path *path) |
void | dev_initialize_chips (void) |
Initialize all chips of statically known devices. More... | |
void | dev_enumerate (void) |
Determine the existence of devices and extend the device tree. More... | |
void | dev_configure (void) |
Configure devices on the devices tree. More... | |
void | dev_enable (void) |
Enable devices on the device tree. More... | |
void | dev_initialize (void) |
Initialize all devices in the global device tree. More... | |
void | dev_finalize (void) |
Finalize all devices in the global device tree. More... | |
void | dev_finalize_chips (void) |
Finalize all chips of statically known devices. More... | |
void | devfn_disable (const struct bus *bus, unsigned int devfn) |
int | reset_bus (struct bus *bus) |
Reset all of the devices on a bus and clear the bus's reset_needed flag. More... | |
void | scan_bridges (struct bus *bus) |
void | assign_resources (struct bus *bus) |
Assign the computed resources to the devices on the bus. More... | |
const char * | dev_name (const struct device *dev) |
const char * | dev_path (const struct device *dev) |
u32 | dev_path_encode (const struct device *dev) |
Encode the device path into 3 bytes for logging to CMOS. More... | |
const char * | bus_path (struct bus *bus) |
void | dev_set_enabled (struct device *dev, int enable) |
void | disable_children (struct bus *bus) |
bool | dev_is_active_bridge (struct device *dev) |
void | add_more_links (struct device *dev, unsigned int total_links) |
Ensure the device has a minimum number of bus links. More... | |
bool | is_dev_enabled (const struct device *const dev) |
bool | is_devfn_enabled (unsigned int devfn) |
void | run_bios (struct device *dev, unsigned long addr) |
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... | |
struct device * | alloc_find_dev (struct bus *parent, struct device_path *path) |
See if a device structure already exists and if not allocate it. More... | |
struct device * | dev_find_device (u16 vendor, u16 device, struct device *from) |
Find a device of a given vendor and type. More... | |
struct device * | dev_find_class (unsigned int class, struct device *from) |
Find a device of a given class. 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... | |
struct device * | dev_find_lapic (unsigned int apic_id) |
Given a Local APIC ID, find the device structure. More... | |
int | dev_count_cpu (void) |
struct device * | add_cpu_device (struct bus *cpu_bus, unsigned int apic_id, int enabled) |
void | set_cpu_topology (struct device *cpu, unsigned int node, unsigned int package, unsigned int core, unsigned int thread) |
void | mp_init_cpus (DEVTREE_CONST struct bus *cpu_bus) |
static void | mp_cpu_bus_init (struct device *dev) |
void | print_resource_tree (const struct device *root, int debug_level, const char *msg) |
void | show_devs_tree (const struct device *dev, int debug_level, int depth) |
void | show_devs_subtree (struct device *root, int debug_level, const char *msg) |
void | show_all_devs (int debug_level, const char *msg) |
void | show_all_devs_tree (int debug_level, const char *msg) |
void | show_one_resource (int debug_level, struct device *dev, struct resource *resource, const char *comment) |
void | show_all_devs_resources (int debug_level, const char *msg) |
void | pci_domain_read_resources (struct device *dev) |
void | pci_domain_set_resources (struct device *dev) |
void | pci_domain_scan_bus (struct device *dev) |
Scan a PCI domain. More... | |
void | fixed_io_resource (struct device *dev, unsigned long index, unsigned long base, unsigned long size) |
void | fixed_mem_resource (struct device *dev, unsigned long index, unsigned long basek, unsigned long sizek, unsigned long type) |
void | mmconf_resource (struct device *dev, unsigned long index) |
void | tolm_test (void *gp, struct device *dev, struct resource *new) |
u32 | find_pci_tolm (struct bus *bus) |
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... | |
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... | |
DEVTREE_CONST struct device * | pcidev_path_behind (const struct bus *parent, pci_devfn_t devfn) |
DEVTREE_CONST struct device * | pcidev_path_on_root (pci_devfn_t devfn) |
DEVTREE_CONST struct device * | pcidev_path_on_bus (unsigned int bus, pci_devfn_t devfn) |
DEVTREE_CONST struct device * | pcidev_on_root (uint8_t dev, uint8_t fn) |
DEVTREE_CONST struct bus * | pci_root_bus (void) |
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) |
static DEVTREE_CONST void * | config_of (const struct device *dev) |
void | enable_static_device (struct device *dev) |
void | enable_static_devices (struct device *bus) |
Enable devices on static buses. More... | |
void | scan_smbus (struct device *bus) |
void | scan_generic_bus (struct device *bus) |
void | scan_static_bus (struct device *bus) |
Variables | |
DEVTREE_CONST struct device | dev_root |
This is the root of the device tree. More... | |
DEVTREE_CONST struct device *DEVTREE_CONST | all_devices |
Linked list of ALL devices. More... | |
struct resource * | free_resources |
Linked list of free resources. More... | |
struct bus * | free_links |
const char | mainboard_name [] |
struct device_operations | default_dev_ops_root |
Default device operation for root device. More... | |
#define amd_cpu_topology | ( | cpu, | |
node, | |||
core | |||
) | set_cpu_topology(cpu, node, 0, core, 0) |
#define bad_ram_resource | ( | dev, | |
idx, | |||
basek, | |||
sizek | |||
) | reserved_ram_resource((dev), (idx), (basek), (sizek)) |
#define intel_cpu_topology | ( | cpu, | |
package, | |||
core, | |||
thread | |||
) | set_cpu_topology(cpu, 0, package, core, thread) |
#define io_resource | ( | dev, | |
idx, | |||
base, | |||
size | |||
) | fixed_io_resource(dev, idx, base, size) |
#define LOG_MEM_RESOURCE | ( | type, | |
dev, | |||
index, | |||
base_kb, | |||
size_kb | |||
) |
#define mmio_resource | ( | dev, | |
idx, | |||
basek, | |||
sizek | |||
) | fixed_mem_resource(dev, idx, basek, sizek, IORESOURCE_RESERVE) |
#define ram_resource | ( | dev, | |
idx, | |||
basek, | |||
sizek | |||
) | fixed_mem_resource(dev, idx, basek, sizek, IORESOURCE_CACHEABLE) |
#define reserved_ram_resource | ( | dev, | |
idx, | |||
basek, | |||
sizek | |||
) |
#define uma_resource | ( | dev, | |
idx, | |||
basek, | |||
sizek | |||
) | fixed_mem_resource(dev, idx, basek, sizek, IORESOURCE_RESERVE) |
#define WEAK_DEV_PTR | ( | _alias | ) | __weak DEVTREE_CONST struct device *const DEV_PTR(_alias) |
Definition at line 6 of file cpu_device.c.
References alloc_find_dev(), BIOS_DEBUG, dev_path(), DEVICE_PATH_APIC, device::enabled, find_dev_path(), NULL, and printk.
Referenced by cpu_bus_scan().
Ensure the device has a minimum number of bus links.
dev | The device to add links to. |
total_links | The minimum number of links to have. |
Definition at line 652 of file device_util.c.
References bus::dev, die(), device::link_list, bus::link_num, malloc(), memset(), bus::next, and NULL.
Referenced by cpu_bus_scan(), init_cpus(), and mp_cpu_bus_init().
struct device* alloc_dev | ( | struct bus * | parent, |
struct device_path * | path | ||
) |
Definition at line 122 of file device.c.
References __alloc_dev(), device::path, spin_lock, and spin_unlock.
Referenced by pci_probe_dev().
struct device* alloc_find_dev | ( | struct bus * | parent, |
struct device_path * | path | ||
) |
See if a device structure already exists and if not allocate it.
parent | The bus to find the device on. |
path | The relative path from the bus to the appropriate device. |
Definition at line 138 of file device.c.
References __alloc_dev(), find_dev_path(), device::path, spin_lock, and spin_unlock.
Referenced by add_cpu_device(), allocate_cpu_devices(), google_chromeec_fill_ssdt_generator(), init_bsp(), initialize_cpus(), intel_sibling_init(), and pnp_enable_devices().
Assign the computed resources to the devices on the bus.
Use the device specific set_resources() method to store the computed resources to hardware. For bridge devices, the set_resources() method has to recurse into every down stream buses.
Mutual recursion: assign_resources() -> device_operation::set_resources() device_operation::set_resources() -> assign_resources()
bus | Pointer to the structure for this bus. |
Definition at line 268 of file device.c.
References BIOS_ERR, BIOS_SPEW, bus::children, bus::dev, dev_path(), device::enabled, bus::link_num, device::ops, post_log_clear(), post_log_path(), printk, device::resource_list, bus::secondary, device_operations::set_resources, and device::sibling.
Referenced by cpu_pci_domain_set_resources(), dev_configure(), domain_set_resources(), generic_set_resources(), mch_domain_set_resources(), nb_set_resources(), pci_dev_set_resources(), pci_domain_set_resources(), set_resources(), and xeonsp_pci_domain_set_resources().
const char* bus_path | ( | struct bus * | bus | ) |
Definition at line 243 of file device_util.c.
References buffer, BUS_PATH_MAX, bus::dev, dev_path(), bus::link_num, and snprintf().
|
inlinestatic |
Definition at line 382 of file device.h.
References device::chip_info, and devtree_die().
Referenced by adsp_init(), byt_pcie_enable(), byt_pcie_init(), cr50_devtree_update(), dptf_fill_ssdt(), fpmcu_devtree_update(), gfx_panel_setup(), gma_setup_panel(), graphics_soc_panel_init(), i2c_gpiomux_mux_fill_ssdt(), i2s_machine_dev_fill_ssdt(), igd_get_cdclk_broadwell(), igd_get_cdclk_haswell(), intel_me_init(), lpc_soc_init(), lpe_init(), mainboard_generate_shutdown(), mtk_pcie_domain_enable(), mtk_pcie_domain_read_resources(), mtk_pcie_domain_set_resources(), mtk_pcie_get_controller_base(), northbridge_write_acpi_tables(), pch_pcie_early(), pch_pirq_init(), pcie_rtd3_acpi_fill_ssdt(), pcie_rtd3_device_acpi_fill_ssdt(), pcie_rtd3_device_acpi_name(), platform_fsp_memory_init_params_cb(), platform_fsp_silicon_init_params_cb(), pmc_soc_init(), remove_usb_device_reset_gpio(), root_port_init_config(), sata_enable(), sata_init(), sc_init(), sd_fill_soc_gpio_info(), serialio_init(), setup_codec_clock(), soc_irq_settings(), soc_lockdown(), soc_memory_init_params(), soc_silicon_init_params(), thermal_zone_fill_ssdt(), update_audio_configuration(), update_dmic_gpio(), update_hp_int_odl(), usb2_phy_init(), variant_devtree_update(), variant_touchscreen_update(), write_device_definitions(), and wwan_fm350gl_acpi_fill_ssdt().
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().
Configure devices on the devices tree.
Starting at the root of the device tree, travel it recursively in two passes. In the first pass, we compute and allocate resources (ranges) required by each device. In the second pass, the resources ranges are relocated to their final position and stored to the hardware.
I/O resources grow upward. MEM resources grow downward.
Since the assignment is hierarchical we set the values into the dev_root struct.
Definition at line 453 of file device.c.
References allocate_resources(), assign_resources(), BIOS_INFO, BIOS_SPEW, dev_root, device::link_list, print_resource_tree(), printk, read_resources(), and set_vga_bridge_bits().
Referenced by bs_dev_resources().
int dev_count_cpu | ( | void | ) |
Definition at line 907 of file device_util.c.
References all_devices, device::bus, count, bus::dev, DEVICE_PATH_APIC, DEVICE_PATH_CPU_CLUSTER, device::enabled, device::next, device::path, and device_path::type.
Referenced by generate_cpu_entries(), thermal_zone_fill_ssdt(), and txt_heap_fill_common_bdr().
Enable devices on the device tree.
Starting at the root, walk the tree and enable all devices/bridges by calling the device's enable_resources() method.
Definition at line 492 of file device.c.
References BIOS_INFO, dev_root, enable_resources(), device::link_list, bus::next, and printk.
Referenced by bs_dev_enable().
Determine the existence of devices and extend the device tree.
Most of the devices in the system are listed in the mainboard devicetree.cb file. The device structures for these devices are generated at compile time by the config tool and are organized into the device tree. This function determines if the devices created at compile time actually exist in the physical system.
For devices in the physical system but not listed in devicetree.cb, the device structures have to be created at run time and attached to the device tree.
This function starts from the root device 'dev_root', scans the buses in the system recursively, and modifies the device tree according to the result of the probe.
This function has no idea how to scan and probe buses and devices at all. It depends on the bus/device specific scan_bus() method to do it. The scan_bus() method also has to create the device structure and attach it to the device tree.
Definition at line 416 of file device.c.
References BIOS_ERR, BIOS_INFO, BIOS_SPEW, device::chip_ops, dev_root, chip_operations::enable_dev, device::ops, post_log_clear(), printk, scan_bus(), device_operations::scan_bus, show_all_devs(), and show_devs_tree().
Referenced by bs_dev_enumerate().
Finalize all devices in the global device tree.
Starting at the root device, call the device's final() method to do device-specific cleanup, then call each child's final() method.
Definition at line 625 of file device.c.
References BIOS_INFO, dev_root, final_dev(), final_link(), device::link_list, bus::next, and printk.
Referenced by bs_post_device().
Finalize all chips of statically known devices.
This is the last call before calling the payload. This is a good place to lock registers or other final cleanup.
Definition at line 60 of file device.c.
References all_devices, device::chip_info, device::chip_ops, chip_operations::final, chip_operations::finalized, and device::next.
Referenced by bs_write_tables().
Find a device of a given class.
class | Class of the device. |
from | Pointer to the device structure, used as a starting point in the linked list of all_devices, which can be 0 to start at the head of the list (i.e. all_devices). |
Definition at line 64 of file device_util.c.
References all_devices, device::class, and device::next.
Referenced by set_vga_bridge_bits().
Find a device of a given vendor and type.
vendor | A PCI vendor ID (e.g. 0x8086 for Intel). |
device | A PCI device ID. |
from | Pointer to the device structure, used as a starting point in the linked list of all_devices, which can be 0 to start at the head of the list (i.e. all_devices). |
Definition at line 42 of file device_util.c.
References all_devices, device::device, device::next, vendor, and device::vendor.
Referenced by handleInt1a(), int1a_handler(), lan_init(), mainboard_final(), mainboard_init(), set_imc_locks(), set_upi_locks(), smp_write_config_table(), spi_init(), and variant_mainboard_final().
Given a Local APIC ID, find the device structure.
apic_id | The Local APIC ID number. |
Definition at line 17 of file device_util.c.
References all_devices, device_path::apic, apic_path::apic_id, DEVICE_PATH_APIC, device::next, NULL, device::path, and device_path::type.
Referenced by configure_c_states(), configure_p_states(), configure_thermal_target(), generate_C_state_entries(), get_cpu_index(), initialize_vr_config(), and is_s0ix_enabled().
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().
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().
Initialize all devices in the global device tree.
Starting at the root device, call the device's init() method to do device-specific setup, then call each child's init() method.
Definition at line 563 of file device.c.
References BIOS_INFO, BIOS_SPEW, dev_root, init_dev(), init_link(), device::link_list, bus::next, post_log_clear(), printk, setup_default_ebda(), and show_all_devs().
Referenced by bs_dev_init().
Initialize all chips of statically known devices.
Will be called before bus enumeration to initialize chips stated in the device tree.
Definition at line 38 of file device.c.
References all_devices, device::chip_info, device::chip_ops, chip_operations::init, chip_operations::initialized, device::next, post_log_clear(), and post_log_path().
Referenced by bs_dev_init_chips().
Definition at line 622 of file device_util.c.
References bus::children, DEVICE_PATH_NONE, device::enabled, device::link_list, bus::next, device::path, device::sibling, and device_path::type.
Referenced by smbios_generate_type9_from_devtree().
const char* dev_name | ( | const struct device * | dev | ) |
Definition at line 233 of file device_util.c.
References device::chip_ops, chip_operations::name, and device::name.
const char* dev_path | ( | const struct device * | dev | ) |
Definition at line 149 of file device_util.c.
References mmio_path::addr, device_path::apic, apic_path::apic_id, BIOS_ERR, buffer, device::bus, 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_IOAPIC, DEVICE_PATH_MAX, 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::ioapic, ioapic_path::ioapic_id, device_path::mmio, device::path, device_path::pci, PCI_FUNC, PCI_SLOT, device_path::pnp, pnp_path::port, usb_path::port_id, usb_path::port_type, printk, bus::secondary, snprintf(), device_path::spi, strcpy(), generic_path::subid, device_path::type, and device_path::usb.
Referenced by __allocate_resources(), _pciexp_enable_ltr(), acpi_write_dbg2_pci_uart(), add_cpu_device(), allocate_child_resources(), allocate_resources(), assign_resources(), assign_stack_resources(), attach_iio_stacks(), avoid_fixed_resources(), broadwell_pch_enable_dev(), bus_path(), cardbus_enable_resources(), cleanup_resource_ranges(), compute_resources(), configure_adjustable_base(), configure_child_lpc_windows(), constrain_resources(), cpu_bus_scan(), create_vga_resource(), crosec_audio_codec_fill_ssdt(), crosec_i2c_tunnel_fill_ssdt(), dnv_get_int_line(), do_pci_scan_bridge(), dptf_fill_ssdt(), ecam0_pci_enable_msix(), enable_dev(), enable_static_device(), final_dev(), find_resource(), get_pbus_smbus(), get_pci_bridge_ops(), graphics_dev_init(), handleInt1a(), hudson_lpc_enable_childrens_resources(), i2c_dev_read_at16(), i2c_dev_readb(), i2c_dev_readb_at(), i2c_dev_writeb(), i2c_dev_writeb_at(), i2c_gpiomux_bus_fill_ssdt(), i2c_gpiomux_mux_fill_ssdt(), i2c_link(), i2c_sx9310_fill_ssdt(), i2c_sx9324_fill_ssdt(), i2c_sx9360_fill_ssdt(), i2c_tpm_fill_ssdt(), i2s_machine_dev_fill_ssdt(), i82801gx_enable(), init_dev(), intel_acpi_gen_def_acpi_pirq(), lpc47n217_pnp_set_resource(), lpc47n227_pnp_set_resource(), lv2_enable_ltr(), max98357a_fill_ssdt(), pch_enable(), pch_pcie_check_set_enabled(), pch_pcie_enable(), pci_bus_enable_resources(), pci_cfg_read(), pci_dev_enable_resources(), pci_get_resource(), pci_get_rom_resource(), pci_probe_dev(), pci_rom_probe(), pci_scan_bus(), pci_scan_hidden_device(), pci_set_resource(), pcie_generic_fill_ssdt(), pcie_rp_update_dev(), pcie_rtd3_acpi_fill_ssdt(), pcie_rtd3_device_acpi_fill_ssdt(), pciexp_configure_ltr(), pciexp_retrain_link(), pcix_tune_dev(), pnp_get_ioresource(), pnp_set_resource(), print_resource_ranges(), print_resource_tree(), read_resources(), report_resource_stored(), resource_tree(), rl5c476_set_resources(), root_port_commit_config(), scan_bus(), scan_generic_bus(), scan_static_bus(), sch5545_set_drq(), sch5545_set_iobase(), sch5545_set_irq(), sch5545_set_resource(), set_pci_ops(), set_vga_bridge_bits(), setup_resource_ranges(), show_all_devs(), show_all_devs_resources(), show_devs_subtree(), show_devs_tree(), show_one_resource(), smbios_walk_device_tree(), smp_write_intsrc_pci_bridge(), soc_pmc_fill_ssdt(), soc_silicon_init_params(), spi_acpi_fill_ssdt_generator(), superio_common_fill_ssdt_generator(), tas5825m_init(), thermal_zone_fill_ssdt(), uart_acpi_fill_ssdt(), uart_enable(), update_bridge_resource(), update_constraints(), usb_acpi_fill_ssdt_generator(), wifi_ssdt_write_properties(), write_smp_table(), wwan_fm350gl_acpi_fill_ssdt(), xeonsp_pci_dev_iterator(), xeonsp_pci_domain_scan_bus(), xhci_acpi_name(), and xhci_fill_ssdt().
Encode the device path into 3 bytes for logging to CMOS.
dev | The device path to encode. |
Definition at line 83 of file device_util.c.
References device_path::apic, apic_path::apic_id, device::bus, 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_IOAPIC, 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::ioapic, ioapic_path::ioapic_id, i2c_path::mode_10bit, device::path, device_path::pci, device_path::pnp, pnp_path::port, usb_path::port_id, usb_path::port_type, bus::secondary, device_path::spi, generic_path::subid, device_path::type, and device_path::usb.
Referenced by cmos_post_path(), and wifi_pcie_acpi_name().
Definition at line 594 of file device_util.c.
References device::chip_ops, device_operations::enable, chip_operations::enable_dev, device::enabled, and device::ops.
Referenced by disable_children().
Definition at line 25 of file device.c.
References device::enabled, and pcidev_path_behind().
Referenced by fill_fsps_tsn_params().
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().
Definition at line 606 of file device_util.c.
References bus::children, dev_set_enabled(), device::link_list, bus::next, and device::sibling.
Definition at line 10 of file root_device.c.
References BIOS_DEBUG, device::chip_ops, dev_path(), device_operations::enable, chip_operations::enable_dev, device::enabled, device::ops, and printk.
Referenced by enable_static_devices(), pci_scan_bus(), and scan_generic_bus().
Enable devices on static buses.
The enumeration of certain buses is purely static. The existence of devices on those buses can be completely determined at compile time and is specified in the config file. Typical examples are the 'PNP' devices on a legacy ISA/LPC bus. There is no need of probing of any kind, the only thing we have to do is to walk through the bus and enable or disable devices as indicated in the config file.
On the other hand, some devices are virtual and their existence is artificial. They can not be probed at run time. One example is the debug device. Those virtual devices have to be listed in the config file under some static bus in order to be enumerated at run time.
bus | Pointer to the device to which the static buses are attached to. |
Definition at line 40 of file root_device.c.
References bus::children, enable_static_device(), bus::next, and device::sibling.
Referenced by scan_static_bus().
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 890 of file device_util.c.
References resource::base, IORESOURCE_ASSIGNED, IORESOURCE_MEM, NULL, search_bus_resources(), and tolm_test().
Referenced by domain_set_resources(), i440bx_domain_read_resources(), and mch_domain_read_resources().
void fixed_io_resource | ( | struct device * | dev, |
unsigned long | index, | ||
unsigned long | base, | ||
unsigned long | size | ||
) |
Definition at line 843 of file device_util.c.
References resource::base, base, resource::flags, resource::index, IORESOURCE_ASSIGNED, IORESOURCE_FIXED, IORESOURCE_IO, IORESOURCE_RESERVE, IORESOURCE_STORED, resource::limit, new_resource(), and resource::size.
void fixed_mem_resource | ( | struct device * | dev, |
unsigned long | index, | ||
unsigned long | basek, | ||
unsigned long | sizek, | ||
unsigned long | type | ||
) |
Definition at line 825 of file device_util.c.
References resource::base, resource::flags, resource::index, IORESOURCE_ASSIGNED, IORESOURCE_FIXED, IORESOURCE_MEM, IORESOURCE_STORED, new_resource(), resource::size, and type.
Referenced by hudson_lpc_read_resources(), lpc_read_resources(), and mch_domain_read_resources().
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().
Definition at line 857 of file device_util.c.
References resource::base, BIOS_DEBUG, resource::flags, resource::index, IORESOURCE_ASSIGNED, IORESOURCE_FIXED, IORESOURCE_MEM, IORESOURCE_RESERVE, IORESOURCE_STORED, new_resource(), printk, and resource::size.
Referenced by mc_add_fixed_mmio_resources(), mc_read_resources(), mch_domain_read_resources(), nb_read_resources(), and read_resources().
Definition at line 240 of file device.h.
References add_more_links(), device::link_list, and mp_init_cpus().
Referenced by cpu_bus_init().
void mp_init_cpus | ( | DEVTREE_CONST struct bus * | cpu_bus | ) |
Definition at line 547 of file pci_device.c.
References cpu_phys_address_size(), resource::flags, IOINDEX_SUBTRACTIVE, IORESOURCE_ASSIGNED, IORESOURCE_IO, IORESOURCE_MEM, IORESOURCE_SUBTRACTIVE, resource::limit, and new_resource().
Referenced by cpu_pci_domain_read_resources(), domain_read_resources(), i440bx_domain_read_resources(), mch_domain_read_resources(), and xeonsp_pci_domain_read_resources().
Scan a PCI domain.
This function is the default scan_bus() method for PCI domains.
dev | Pointer to the domain. |
Definition at line 1610 of file pci_device.c.
References bus::dev, device::link_list, PCI_DEVFN, and pci_scan_bus().
Definition at line 564 of file pci_device.c.
References assign_resources(), and device::link_list.
Referenced by mtk_pcie_domain_set_resources().
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().
Definition at line 725 of file device_util.c.
References dev_path(), printk, and resource_tree().
Referenced by dev_configure(), and xeonsp_pci_domain_set_resources().
int reset_bus | ( | struct bus * | bus | ) |
Reset all of the devices on a bus and clear the bus's reset_needed flag.
bus | Pointer to the bus structure. |
Definition at line 329 of file device.c.
References bus::dev, device::ops, device_operations::reset_bus, and bus::reset_needed.
Referenced by scan_bus().
Definition at line 409 of file x86.c.
References addr, BIOS_DEBUG, biosemu(), biosmem, device::bus, device::class, pci_path::devfn, device::path, device_path::pci, PCI_CLASS_DISPLAY_VGA, printk, realmode_call, bus::secondary, setup_i8254(), setup_i8259(), setup_interrupt_handlers(), setup_realmode_code(), setup_realmode_idt(), setup_rombios(), vbe_set_graphics(), vmem, and VMEM_SIZE.
Definition at line 383 of file device.c.
References bus::children, device::ops, scan_bus(), device_operations::scan_bus, and device::sibling.
Referenced by pci_scan_bus(), scan_static_bus(), and xeonsp_pci_domain_scan_bus().
Definition at line 52 of file root_device.c.
References BIOS_DEBUG, BIOS_SPEW, device::bus, bus::children, bus::dev, dev_path(), enable_static_device(), bus::link_num, bus::next, printk, bus::secondary, and device::sibling.
Referenced by scan_smbus().
Definition at line 74 of file root_device.c.
References scan_generic_bus().
Definition at line 89 of file root_device.c.
References BIOS_SPEW, dev_path(), enable_static_devices(), bus::next, printk, and scan_bridges().
void set_cpu_topology | ( | struct device * | cpu, |
unsigned int | node, | ||
unsigned int | package, | ||
unsigned int | core, | ||
unsigned int | thread | ||
) |
Definition at line 31 of file cpu_device.c.
References device_path::apic, apic_path::core_id, apic_path::node_id, apic_path::package_id, device::path, and apic_path::thread_id.
void show_all_devs | ( | int | debug_level, |
const char * | msg | ||
) |
Definition at line 781 of file device_util.c.
References all_devices, dev_path(), device::enabled, device::next, and printk.
Referenced by dev_enumerate(), and dev_initialize().
void show_all_devs_resources | ( | int | debug_level, |
const char * | msg | ||
) |
Definition at line 809 of file device_util.c.
References all_devices, dev_path(), device::enabled, device::next, resource::next, printk, device::resource_list, and show_one_resource().
void show_all_devs_tree | ( | int | debug_level, |
const char * | msg | ||
) |
Definition at line 763 of file device_util.c.
References all_devices, printk, and show_devs_tree().
Definition at line 771 of file device_util.c.
References dev_path(), printk, and show_devs_tree().
Definition at line 742 of file device_util.c.
References bus::children, bus::dev, dev_path(), device::enabled, device::link_list, bus::next, printk, and device::sibling.
Referenced by dev_enumerate(), show_all_devs_tree(), and show_devs_subtree().
void show_one_resource | ( | int | debug_level, |
struct device * | dev, | ||
struct resource * | resource, | ||
const char * | comment | ||
) |
Definition at line 794 of file device_util.c.
References resource::base, base, buf, dev_path(), resource::gran, resource::index, printk, resource_end(), resource_type(), and resource::size.
Referenced by show_all_devs_resources().
Definition at line 870 of file device_util.c.
References resource::base.
Referenced by find_pci_tolm(), and my_find_pci_tolm().
|
extern |
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().
|
extern |
Default device operation for root device.
This is the default device operation for root devices. These operations should be fully usable as is. However the chip_operations::enable_dev() of a motherboard can override this if you want non-default behavior.
Definition at line 103 of file root_device.c.
Referenced by soc_init().
|
extern |
This is the root of the device tree.
The device tree is defined in the static.c file and is generated by the config tool at compile time.
Referenced by dev_configure(), dev_enable(), dev_enumerate(), dev_finalize(), and dev_initialize().
|
extern |
|
extern |
Linked list of free resources.
Definition at line 23 of file device.c.
Referenced by allocate_more_resources(), free_resource(), and new_resource().
|
extern |
Definition at line 8 of file root_device.c.