summaryrefslogtreecommitdiff
path: root/src/include/device/device.h
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2017-11-10 10:47:54 -0700
committerAaron Durbin <adurbin@chromium.org>2017-11-15 05:19:42 +0000
commitf0349023a21b03df6c3db572590de8ba556e07db (patch)
tree860f9e45918dd0c6f9ab92997e5681b03f981844 /src/include/device/device.h
parent09ab15798a232d70824e60699f4c7c296234f82f (diff)
downloadcoreboot-f0349023a21b03df6c3db572590de8ba556e07db.tar.xz
device: further untangle device_t from struct device
This further allows compilation units to be re-used without having to add macro guards because of declarations not being around in the __SIMPLE_DEVICE__ case. These declarations are for functions that operate on struct device. struct device is a known type so just expose the functions using the correct type. Also, DEVTREE_CONST is empty while in ramstage so there's no reason to separate the declarations. Lastly, fix up device_util.c to use the proper types. It's only compiled in ramstage and it only operates on struct device. Change-Id: I306e0ad220cdab738cb727dda4a93bdec77c5521 Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://review.coreboot.org/22420 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Furquan Shaikh <furquan@google.com>
Diffstat (limited to 'src/include/device/device.h')
-rw-r--r--src/include/device/device.h42
1 files changed, 20 insertions, 22 deletions
diff --git a/src/include/device/device.h b/src/include/device/device.h
index b20c452fb7..15e477afd6 100644
--- a/src/include/device/device.h
+++ b/src/include/device/device.h
@@ -153,10 +153,8 @@ struct device {
* static.c file and is generated by the config tool at compile time.
*/
extern DEVTREE_CONST struct device dev_root;
-
-#ifndef __SIMPLE_DEVICE__
-
-extern struct device *all_devices; /* list of all devices */
+/* list of all devices */
+extern DEVTREE_CONST struct device * DEVTREE_CONST all_devices;
extern struct resource *free_resources;
extern struct bus *free_links;
@@ -169,7 +167,7 @@ extern uint64_t uma_memory_size;
#endif
/* Generic device interface functions */
-device_t alloc_dev(struct bus *parent, struct device_path *path);
+struct device *alloc_dev(struct bus *parent, struct device_path *path);
void dev_initialize_chips(void);
void dev_enumerate(void);
void dev_configure(void);
@@ -183,29 +181,31 @@ void dev_finalize_chips(void);
int reset_bus(struct bus *bus);
void scan_bridges(struct bus *bus);
void assign_resources(struct bus *bus);
-const char *dev_name(device_t dev);
-const char *dev_path(device_t dev);
-u32 dev_path_encode(device_t dev);
+const char *dev_name(struct device *dev);
+const char *dev_path(struct device *dev);
+u32 dev_path_encode(struct device *dev);
const char *bus_path(struct bus *bus);
-void dev_set_enabled(device_t dev, int enable);
+void dev_set_enabled(struct device *dev, int enable);
void disable_children(struct bus *bus);
-bool dev_is_active_bridge(device_t dev);
+bool dev_is_active_bridge(struct device *dev);
/* Option ROM helper functions */
void run_bios(struct device *dev, unsigned long addr);
/* Helper functions */
-device_t find_dev_path(struct bus *parent, struct device_path *path);
-device_t alloc_find_dev(struct bus *parent, struct device_path *path);
-device_t dev_find_device(u16 vendor, u16 device, device_t from);
-device_t dev_find_class(unsigned int class, device_t from);
-device_t dev_find_path(device_t prev_match, enum device_path_type path_type);
-device_t dev_find_lapic(unsigned int apic_id);
+struct device *find_dev_path(struct bus *parent, struct device_path *path);
+struct device *alloc_find_dev(struct bus *parent, struct device_path *path);
+struct device *dev_find_device(u16 vendor, u16 device, struct device *from);
+struct device *dev_find_class(unsigned int class, struct device *from);
+struct device *dev_find_path(struct device *prev_match,
+ enum device_path_type path_type);
+struct device *dev_find_lapic(unsigned int apic_id);
int dev_count_cpu(void);
-device_t add_cpu_device(struct bus *cpu_bus, unsigned int apic_id, int enabled);
-void set_cpu_topology(device_t cpu, unsigned int node, unsigned int package,
- unsigned int core, unsigned int thread);
+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);
#define amd_cpu_topology(cpu, node, core) \
set_cpu_topology(cpu, node, 0, core, 0)
@@ -234,7 +234,7 @@ extern struct device_operations default_dev_ops_root;
void pci_domain_read_resources(struct device *dev);
void pci_domain_scan_bus(struct device *dev);
-void fixed_mem_resource(device_t dev, unsigned long index,
+void fixed_mem_resource(struct device *dev, unsigned long index,
unsigned long basek, unsigned long sizek, unsigned long type);
void mmconf_resource_init(struct resource *res, resource_t base, int buses);
@@ -262,8 +262,6 @@ 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);
-#endif
-
DEVTREE_CONST struct device *dev_find_slot(unsigned int bus,
unsigned int devfn);
DEVTREE_CONST struct device *dev_find_next_pci_device(