71 while (from && (from->
class & 0xffffff00) !=
class)
166 "PCI: %02x:%02x.%01x",
261 new_res_list =
malloc(64 *
sizeof(*new_res_list));
263 if (new_res_list ==
NULL)
266 memset(new_res_list, 0, 64 *
sizeof(*new_res_list));
268 for (i = 0; i < 64 - 1; i++)
269 new_res_list[i].
next = &new_res_list[i+1];
357 die(
"Couldn't allocate more resources.");
512 unsigned long long base, end;
553 subbus = subbus->
next)
654 struct bus *link, *last =
NULL;
664 int links = total_links - (
link_num + 1);
666 link =
malloc(links *
sizeof(*link));
668 die(
"Couldn't allocate more links!\n");
669 memset(link, 0, links *
sizeof(*link));
676 link =
malloc(total_links *
sizeof(*link));
678 die(
"Couldn't allocate more links!\n");
679 memset(link, 0, total_links *
sizeof(*link));
686 link->
next = link + 1;
701 for (i = 0; i < depth + 1 && i < 29; i++)
712 printk(debug_level,
"%s%s resource base %llx size %llx "
713 "align %d gran %d limit %llx flags %lx index %lx\n",
730 printk(debug_level,
"%s passed NULL for root!\n", __func__);
735 if (!
printk(debug_level,
"Show resources in subtree (%s)...%s\n",
749 for (i = 0; i < depth; i++)
753 printk(debug_level,
"%s%s: enabled %d\n",
757 for (sibling = link->
children; sibling;
766 if (!
printk(debug_level,
"Show all devs in tree form... %s\n", msg))
774 if (!
printk(debug_level,
"Show all devs in subtree %s... %s\n",
777 printk(debug_level,
"%s\n", msg);
786 if (!
printk(debug_level,
"Show all devs... %s\n", msg))
789 printk(debug_level,
"%s: enabled %d\n",
798 unsigned long long base, end;
803 printk(debug_level,
"%s %02lx <- [0x%010llx - 0x%010llx] "
804 "size 0x%08llx gran 0x%02x %s%s%s\n",
dev_path(dev),
813 if (!
printk(debug_level,
"Show all devs with resources... %s\n", msg))
818 printk(debug_level,
"%s: enabled %d\n",
826 unsigned long basek,
unsigned long sizek,
844 unsigned long base,
unsigned long size)
865 printk(
BIOS_DEBUG,
"Adding PCIe enhanced config space BAR 0x%08lx-0x%08lx.\n",
884 if (!best || (best->
base > new->base))
900 if (min && tolm > min->
base)
928 const char *type_name =
"Unknown";
932 type_name = type_names[
type];
void * memset(void *dstpp, int c, size_t len)
#define printk(level,...)
void __noreturn die(const char *fmt,...)
struct resource * free_resources
Linked list of free resources.
DEVTREE_CONST struct device *DEVTREE_CONST all_devices
Linked list of ALL devices.
bool dev_is_active_bridge(struct device *dev)
u32 dev_path_encode(const struct device *dev)
Encode the device path into 3 bytes for logging to CMOS.
void fixed_io_resource(struct device *dev, unsigned long index, unsigned long base, unsigned long size)
static void resource_tree(const struct device *root, int debug_level, int depth)
void dev_set_enabled(struct device *dev, int enable)
void show_all_devs_resources(int debug_level, const char *msg)
const char * dev_name(const struct device *dev)
static resource_t align_down(resource_t val, unsigned long gran)
Round a number up to the previous multiple of gran.
void show_all_devs(int debug_level, const char *msg)
void disable_children(struct bus *bus)
void show_devs_subtree(struct device *root, int debug_level, const char *msg)
struct device * dev_find_lapic(unsigned int apic_id)
Given a Local APIC ID, find the device structure.
void fixed_mem_resource(struct device *dev, unsigned long index, unsigned long basek, unsigned long sizek, unsigned long type)
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.
void compact_resources(struct device *dev)
See if we have unused but allocated resource structures.
struct device * dev_find_device(u16 vendor, u16 device, struct device *from)
Find a device of a given vendor and type.
void show_devs_tree(const struct device *dev, int debug_level, int depth)
static void free_resource(struct device *dev, struct resource *res, struct resource *prev)
Remove resource res from the device's list and add it to the free list.
resource_t resource_max(const struct resource *resource)
Compute the maximum legal value for resource->base.
void show_all_devs_tree(int debug_level, const char *msg)
void search_global_resources(unsigned long type_mask, unsigned long type, resource_search_t search, void *gp)
const char * bus_path(struct bus *bus)
void mmconf_resource(struct device *dev, unsigned long index)
void show_one_resource(int debug_level, struct device *dev, struct resource *resource, const char *comment)
void tolm_test(void *gp, struct device *dev, struct resource *new)
struct device * dev_find_class(unsigned int class, struct device *from)
Find a device of a given class.
struct resource * probe_resource(const struct device *dev, unsigned int index)
See if a resource structure already exists for a given index.
u32 find_pci_tolm(struct bus *bus)
void print_resource_tree(const struct device *root, int debug_level, const char *msg)
const char * resource_type(const struct resource *resource)
Return the resource type of a resource.
void report_resource_stored(struct device *dev, const struct resource *resource, const char *comment)
Print the resource that was just stored.
static resource_t align_up(resource_t val, unsigned long gran)
Round a number up to the next multiple of gran.
resource_t resource_end(const struct resource *resource)
Compute the maximum address that is part of a resource.
void search_bus_resources(struct bus *bus, unsigned long type_mask, unsigned long type, resource_search_t search, void *gp)
struct resource * find_resource(const struct device *dev, unsigned int index)
Return an existing resource structure for a given index.
const char * dev_path_name(enum device_path_type type)
static int allocate_more_resources(void)
Allocate 64 more resources to the free list.
const char * dev_path(const struct device *dev)
void add_more_links(struct device *dev, unsigned int total_links)
Ensure the device has a minimum number of bus links.
void * malloc(size_t size)
#define BIOS_DEBUG
BIOS_DEBUG - Verbose output.
#define BIOS_EMERG
BIOS_EMERG - Emergency / Fatal.
#define BIOS_ERR
BIOS_ERR - System in incomplete state.
@ DEVICE_PATH_CPU_CLUSTER
#define DEVICE_PATH_NAMES
u8 buffer[C2P_BUFFER_MAXSIZE]
static size_t search(const char *p, const u8 *a, size_t lengthp, size_t lengtha)
search: Find first instance of string in a given region
#define IORESOURCE_RESERVE
#define IORESOURCE_SUBTRACTIVE
#define IORESOURCE_PCI_BRIDGE
#define IORESOURCE_STORED
#define IORESOURCE_ASSIGNED
#define RESOURCE_TYPE_MAX
void(* resource_search_t)(void *gp, struct device *dev, struct resource *res)
#define IORESOURCE_PREFETCH
#define IORESOURCE_READONLY
#define IOINDEX_SUBTRACTIVE_LINK(IDX)
char * strcpy(char *dst, const char *src)
DEVTREE_CONST struct bus * next
DEVTREE_CONST struct device * children
DEVTREE_CONST struct device * dev
void(* enable_dev)(struct device *dev)
void(* enable)(struct device *dev)
struct domain_path domain
struct cpu_cluster_path cpu_cluster
struct cpu_bus_path cpu_bus
struct generic_path generic
struct ioapic_path ioapic
enum device_path_type type
struct chip_operations * chip_ops
DEVTREE_CONST struct device * sibling
struct device_operations * ops
DEVTREE_CONST struct bus * bus
DEVTREE_CONST struct bus * link_list
DEVTREE_CONST struct device * next
DEVTREE_CONST struct resource * resource_list
DEVTREE_CONST struct resource * next
int snprintf(char *buf, size_t size, const char *fmt,...)
Note: This file is only for POSIX compatibility, and is meant to be chain-included via string....