coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
|
Go to the source code of this file.
Data Structures | |
struct | resource |
Macros | |
#define | IORESOURCE_BITS 0x000000ff /* Bus-specific bits */ |
#define | IORESOURCE_IO 0x00000100 /* Resource type */ |
#define | IORESOURCE_MEM 0x00000200 |
#define | IORESOURCE_IRQ 0x00000400 |
#define | IORESOURCE_DRQ 0x00000800 |
#define | IORESOURCE_TYPE_MASK |
#define | IORESOURCE_PREFETCH 0x00001000 /* No side effects */ |
#define | IORESOURCE_READONLY 0x00002000 |
#define | IORESOURCE_CACHEABLE 0x00004000 |
#define | IORESOURCE_RANGELENGTH 0x00008000 |
#define | IORESOURCE_SHADOWABLE 0x00010000 |
#define | IORESOURCE_BUS_HAS_VGA 0x00020000 |
#define | IORESOURCE_SUBTRACTIVE 0x00040000 |
#define | IORESOURCE_BRIDGE 0x00080000 |
#define | IORESOURCE_ABOVE_4G 0x00100000 |
#define | IORESOURCE_RESERVE 0x10000000 |
#define | IORESOURCE_STORED 0x20000000 |
#define | IORESOURCE_ASSIGNED 0x40000000 |
#define | IORESOURCE_FIXED 0x80000000 |
#define | IORESOURCE_PCI64 (1<<0) /* 64bit long pci resource */ |
#define | IORESOURCE_PCI_BRIDGE (1<<1) /* A bridge pci resource */ |
#define | IORESOURCE_PCIE_RESIZABLE_BAR (1<<2) /* A Resizable BAR */ |
#define | IOINDEX_SUBTRACTIVE(IDX, LINK) (0x10000000 + ((IDX) << 8) + LINK) |
#define | IOINDEX_SUBTRACTIVE_LINK(IDX) (IDX & 0xff) |
#define | IOINDEX(IDX, LINK) (((LINK) << 16) + IDX) |
#define | IOINDEX_LINK(IDX) ((IDX & 0xf0000) >> 16) |
#define | IOINDEX_IDX(IDX) (IDX & 0xffff) |
#define | RESOURCE_TYPE_MAX 20 |
Typedefs | |
typedef u64 | resource_t |
typedef void(* | resource_search_t) (void *gp, struct device *dev, struct resource *res) |
Functions | |
void | compact_resources (struct device *dev) |
See if we have unused but allocated resource structures. More... | |
struct resource * | probe_resource (const struct device *dev, unsigned int index) |
See if a resource structure already exists for a given index. More... | |
struct resource * | new_resource (struct device *dev, unsigned int index) |
See if a resource structure already exists for a given index and if not allocate one. More... | |
struct resource * | find_resource (const struct device *dev, unsigned int index) |
Return an existing resource structure for a given index. More... | |
resource_t | resource_end (const struct resource *resource) |
Compute the maximum address that is part of a resource. More... | |
resource_t | resource_max (const struct resource *resource) |
Compute the maximum legal value for resource->base. More... | |
void | report_resource_stored (struct device *dev, const struct resource *resource, const char *comment) |
Print the resource that was just stored. More... | |
void | search_bus_resources (struct bus *bus, unsigned long type_mask, unsigned long type, resource_search_t search, void *gp) |
void | search_global_resources (unsigned long type_mask, unsigned long type, resource_search_t search, void *gp) |
const char * | resource_type (const struct resource *resource) |
Return the resource type of a resource. More... | |
static void * | res2mmio (const struct resource *res, unsigned long offset, unsigned long mask) |
const struct device * | largest_resource (struct bus *bus, struct resource **result_res, unsigned long type_mask, unsigned long type) |
void | allocate_resources (const struct device *root) |
#define IOINDEX | ( | IDX, | |
LINK | |||
) | (((LINK) << 16) + IDX) |
Definition at line 60 of file resource.h.
#define IOINDEX_IDX | ( | IDX | ) | (IDX & 0xffff) |
Definition at line 62 of file resource.h.
#define IOINDEX_LINK | ( | IDX | ) | ((IDX & 0xf0000) >> 16) |
Definition at line 61 of file resource.h.
#define IOINDEX_SUBTRACTIVE | ( | IDX, | |
LINK | |||
) | (0x10000000 + ((IDX) << 8) + LINK) |
Definition at line 57 of file resource.h.
#define IOINDEX_SUBTRACTIVE_LINK | ( | IDX | ) | (IDX & 0xff) |
Definition at line 58 of file resource.h.
#define IORESOURCE_ABOVE_4G 0x00100000 |
Definition at line 28 of file resource.h.
#define IORESOURCE_ASSIGNED 0x40000000 |
Definition at line 34 of file resource.h.
#define IORESOURCE_BITS 0x000000ff /* Bus-specific bits */ |
Definition at line 7 of file resource.h.
#define IORESOURCE_BRIDGE 0x00080000 |
Definition at line 26 of file resource.h.
#define IORESOURCE_BUS_HAS_VGA 0x00020000 |
Definition at line 22 of file resource.h.
#define IORESOURCE_CACHEABLE 0x00004000 |
Definition at line 19 of file resource.h.
#define IORESOURCE_DRQ 0x00000800 |
Definition at line 12 of file resource.h.
#define IORESOURCE_FIXED 0x80000000 |
Definition at line 36 of file resource.h.
#define IORESOURCE_IO 0x00000100 /* Resource type */ |
Definition at line 9 of file resource.h.
#define IORESOURCE_IRQ 0x00000400 |
Definition at line 11 of file resource.h.
#define IORESOURCE_MEM 0x00000200 |
Definition at line 10 of file resource.h.
#define IORESOURCE_PCI64 (1<<0) /* 64bit long pci resource */ |
Definition at line 39 of file resource.h.
Definition at line 40 of file resource.h.
#define IORESOURCE_PCIE_RESIZABLE_BAR (1<<2) /* A Resizable BAR */ |
Definition at line 41 of file resource.h.
#define IORESOURCE_PREFETCH 0x00001000 /* No side effects */ |
Definition at line 17 of file resource.h.
#define IORESOURCE_RANGELENGTH 0x00008000 |
Definition at line 20 of file resource.h.
#define IORESOURCE_READONLY 0x00002000 |
Definition at line 18 of file resource.h.
#define IORESOURCE_RESERVE 0x10000000 |
Definition at line 30 of file resource.h.
#define IORESOURCE_SHADOWABLE 0x00010000 |
Definition at line 21 of file resource.h.
#define IORESOURCE_STORED 0x20000000 |
Definition at line 32 of file resource.h.
#define IORESOURCE_SUBTRACTIVE 0x00040000 |
Definition at line 24 of file resource.h.
#define IORESOURCE_TYPE_MASK |
Definition at line 14 of file resource.h.
#define RESOURCE_TYPE_MAX 20 |
Definition at line 84 of file resource.h.
Definition at line 76 of file resource.h.
typedef u64 resource_t |
Definition at line 43 of file resource.h.
Definition at line 490 of file resource_allocator_v3.c.
References allocate_domain_resources(), BIOS_INFO, bus::children, compute_domain_resources(), dev_path(), DEVICE_PATH_DOMAIN, device::link_list, NULL, device::path, post_log_path(), printk, device::sibling, and device_path::type.
Referenced by dev_configure().
See if we have unused but allocated resource structures.
If so remove the allocation.
dev | The device to find the resource on. |
Definition at line 302 of file device_util.c.
References resource::flags, free_resource(), resource::next, NULL, and device::resource_list.
Referenced by cardbus_read_resources(), hudson_lpc_read_resources(), lpc_read_resources(), new_resource(), pci_bridge_read_bases(), pci_get_rom_resource(), and pci_read_bases().
Return an existing resource structure for a given index.
dev | The device to find the resource on. |
index | The index of the resource on the device. return TODO. |
Definition at line 394 of file device_util.c.
References BIOS_EMERG, dev_path(), die(), resource::index, printk, and probe_resource().
Referenced by acpi_fill_madt(), configure_host_mode_port0(), configure_xhci_host_mode_port0(), cpu_cl_discovery(), disable_xhci_lfps_pm(), f71863fg_init(), gma_func0_init(), hudson_lpc_set_resources(), igd_init(), kbc1100_init(), lpc47n217_pnp_set_enable(), lpc47n227_pnp_set_enable(), lpc_set_resources(), lpe_stash_firmware_info(), lsmbus_block_write(), lsmbus_read_byte(), lsmbus_recv_byte(), lsmbus_send_byte(), lsmbus_write_byte(), platform_fsp_notify_status(), r8168_init(), reg_script_get_resource(), rl5c476_set_resources(), usb_ehci_init(), w83627ehg_init(), w83627hf_init(), and wa_init_display_signal().
const struct device* largest_resource | ( | struct bus * | bus, |
struct resource ** | result_res, | ||
unsigned long | type_mask, | ||
unsigned long | type | ||
) |
Definition at line 43 of file resource_allocator_common.c.
References pick_largest_state::last, NULL, pick_largest_resource(), search_bus_resources(), and type.
Referenced by __allocate_resources(), allocate_child_resources(), compute_resources(), and update_bridge_resource().
See if a resource structure already exists for a given index and if not allocate one.
Then initialize the resource to default values.
dev | The device to find the resource on. |
index | The index of the resource on the device. |
Definition at line 346 of file device_util.c.
References resource::align, allocate_more_resources(), resource::base, compact_resources(), die(), resource::flags, free_resources, resource::gran, resource::index, IORESOURCE_FIXED, resource::limit, memset(), resource::next, NULL, probe_resource(), device::resource_list, and resource::size.
Referenced by add_fixed_resources(), amdfam14_find_iopair(), amdfam14_find_mempair(), amdfam15_find_iopair(), amdfam15_find_mempair(), amdfam16_find_iopair(), amdfam16_find_mempair(), cardbus_record_bridge_resource(), cpu_pci_domain_read_resources(), domain_read_resources(), fixed_io_resource(), fixed_mem_resource(), generic_read_resources(), get_resources(), hudson_lpc_read_resources(), i82801gx_lpc_read_resources(), i82801ix_lpc_read_resources(), i82801jx_lpc_read_resources(), iommu_read_resources(), ipmi_read_resources(), kempld_uart_read_resources(), lpc_ec_read_resources(), lpc_read_resources(), lpe_read_resources(), mainboard_reserve_resources(), mc_add_dram_resources(), mc_add_fixed_mmio_resources(), mmconf_resource(), mtk_pcie_domain_new_res(), nb_read_resources(), pch_lpc_add_io_resource(), pch_lpc_add_io_resources(), pch_lpc_add_mmio_resources(), pch_lpc_add_new_resource(), pch_lpc_read_resources(), pch_pmc_add_new_resource(), pci_domain_read_resources(), pci_get_resource(), pci_get_rom_resource(), pci_p2sb_read_resources(), pci_record_bridge_resource(), pnp_get_ioresource(), pnp_raw_resource(), qemu_reserve_ports(), read_resources(), rl5c476_read_resources(), sc_add_io_resource(), sc_add_io_resources(), smbus_read_resources(), soc_pmc_read_resources(), and wilco_ec_resource().
See if a resource structure already exists for a given index.
dev | The device to find the resource on. |
index | The index of the resource on the device. |
Definition at line 323 of file device_util.c.
References resource::index, resource::next, and device::resource_list.
Referenced by acpi_write_dbg2_pci_uart(), adsp_init(), assign_device_nvs(), ast_crtc_do_set_base(), ast_driver_load(), azalia_audio_init(), azalia_init(), bochs_init_linear_fb(), dev_enable_acpi_mode(), f71808a_hwm_init(), f71869ad_hwm_init(), f81866d_hwm_init(), f81866d_uart_init(), find_resource(), gma_func0_init(), gma_pm_init_pre_vbios(), gma_read_resources(), graphics_dev_init(), graphics_get_bar(), graphics_soc_panel_init(), has_resources(), hda_init(), igd_init(), init(), intel_mei_setup(), it8613e_init(), it8623e_init(), it8720f_init(), it8728f_init(), it8772f_init(), it8783ef_init(), it8786e_init(), ldn_gen_resources(), ldn_gen_resources_use(), lpe_stash_firmware_info(), mainboard_final(), mch_domain_set_resources(), minihd_init(), new_resource(), npcd378_init(), oxford_oxpcie_enable(), pch_smbus_init(), pch_thermal_configuration(), pci_msix_get_table(), reg_useable(), sata_enable_ahci_mmap(), sata_init(), sata_read_resources(), sata_set_resources(), scc_enable_acpi_mode(), serialio_init(), set_backlight_pwm(), set_xhci_lfps_sampling_offtime(), superio_guess_function(), and usb_ehci_init().
void report_resource_stored | ( | struct device * | dev, |
const struct resource * | resource, | ||
const char * | comment | ||
) |
Print the resource that was just stored.
dev | The device the stored resource lives on. |
resource | The resource that was just stored. |
comment | TODO |
Definition at line 508 of file device_util.c.
References resource::base, base, BIOS_DEBUG, buf, dev_path(), resource::flags, resource::gran, resource::index, IORESOURCE_PCI_BRIDGE, IORESOURCE_STORED, device::link_list, printk, resource_end(), resource_type(), bus::secondary, resource::size, and snprintf().
Referenced by generic_set_resources(), ipmi_set_resources(), lpc47n217_pnp_set_resource(), lpc47n227_pnp_set_resource(), mch_domain_set_resources(), pci_set_resource(), pnp_set_resource(), sch5545_set_resource(), and set_resource().
|
inlinestatic |
Definition at line 87 of file resource.h.
References resource::base, mask, and offset.
Referenced by adsp_init(), ast_crtc_do_set_base(), ast_driver_load(), azalia_audio_init(), azalia_init(), bochs_read(), bochs_vga_write(), bochs_write(), gma_func0_init(), gtt_read(), gtt_write(), hda_init(), intel_mei_setup(), mainboard_final(), minihd_init(), oxford_oxpcie_enable(), sata_enable_ahci_mmap(), sata_init(), serialio_d21_ltr(), serialio_d23_ltr(), serialio_enable_clock(), serialio_enable_d3hot(), serialio_i2c_voltage_sel(), and usb_ehci_init().
resource_t resource_end | ( | const struct resource * | resource | ) |
Compute the maximum address that is part of a resource.
resource | The resource whose limit is desired. |
Definition at line 445 of file device_util.c.
References align_up(), resource::base, base, resource::gran, and resource::size.
Referenced by configure_child_lpc_windows(), hudson_lpc_enable_childrens_resources(), pci_store_bridge_resource(), report_resource_stored(), set_resource(), and show_one_resource().
resource_t resource_max | ( | const struct resource * | resource | ) |
Compute the maximum legal value for resource->base.
resource | The resource whose maximum is desired. |
Definition at line 471 of file device_util.c.
References resource::align, align_down(), resource::limit, and resource::size.
Referenced by avoid_fixed_resources().
const char* resource_type | ( | const struct resource * | resource | ) |
Return the resource type of a resource.
resource | The resource type to decode. |
Definition at line 486 of file device_util.c.
References buffer, resource::flags, IORESOURCE_DRQ, IORESOURCE_IO, IORESOURCE_IRQ, IORESOURCE_MEM, IORESOURCE_PCI64, IORESOURCE_PREFETCH, IORESOURCE_READONLY, RESOURCE_TYPE_MAX, and snprintf().
Referenced by pci_set_resource(), pnp_set_resource(), report_resource_stored(), sch5545_set_resource(), and show_one_resource().
void search_bus_resources | ( | struct bus * | bus, |
unsigned long | type_mask, | ||
unsigned long | type, | ||
resource_search_t | search, | ||
void * | gp | ||
) |
Definition at line 531 of file device_util.c.
References bus::children, device::enabled, resource::flags, resource::index, IOINDEX_SUBTRACTIVE_LINK, IORESOURCE_SUBTRACTIVE, device::link_list, bus::link_num, bus::next, resource::next, device::resource_list, search(), device::sibling, and type.
Referenced by find_pci_tolm(), largest_resource(), and my_find_pci_tolm().
void search_global_resources | ( | unsigned long | type_mask, |
unsigned long | type, | ||
resource_search_t | search, | ||
void * | gp | ||
) |
Definition at line 568 of file device_util.c.
References all_devices, device::enabled, resource::flags, IORESOURCE_SUBTRACTIVE, device::next, resource::next, device::resource_list, search(), and type.
Referenced by acpigen_write_mainboard_resource_template(), and memranges_add_resources_filter().