Edward O'Callaghan (eocallaghan@alterapraxis.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/7138
-gerrit
commit ddfad847ff4040d77c6acb126e214b5df622c5ce Author: Edward O'Callaghan eocallaghan@alterapraxis.com Date: Tue Oct 21 08:07:47 2014 +1100
device/*: Don't hide pointers behind typedefs
Change-Id: Ic4239efe0462d86694bf4ac0ec898f589b6adf1c Signed-off-by: Edward O'Callaghan eocallaghan@alterapraxis.com --- src/device/agp_device.c | 6 ++--- src/device/cardbus_device.c | 8 +++---- src/device/cpu_device.c | 8 +++---- src/device/device_util.c | 34 +++++++++++++------------- src/device/hypertransport.c | 20 +++++++++------- src/device/pci_device.c | 22 ++++++++--------- src/device/pci_ops.c | 30 +++++++++++------------ src/device/pci_rom.c | 2 +- src/device/pciexp_device.c | 22 ++++++++--------- src/device/pcix_device.c | 6 ++--- src/device/pnp_device.c | 40 +++++++++++++++---------------- src/device/root_device.c | 14 +++++------ src/device/smbus_ops.c | 26 ++++++++++---------- src/include/device/device.h | 58 ++++++++++++++++++++++----------------------- 14 files changed, 150 insertions(+), 146 deletions(-)
diff --git a/src/device/agp_device.c b/src/device/agp_device.c index 550297a..f972b1c 100644 --- a/src/device/agp_device.c +++ b/src/device/agp_device.c @@ -24,7 +24,7 @@ #include <device/pci_ids.h> #include <device/agp.h>
-static void agp_tune_dev(device_t dev) +static void agp_tune_dev(struct device * dev) { unsigned int cap;
@@ -38,7 +38,7 @@ static void agp_tune_dev(device_t dev) unsigned int agp_scan_bus(struct bus *bus, unsigned int min_devfn, unsigned int max_devfn, unsigned int max) { - device_t child; + struct device * child;
max = pci_scan_bus(bus, min_devfn, max_devfn, max);
@@ -53,7 +53,7 @@ unsigned int agp_scan_bus(struct bus *bus, unsigned int min_devfn, return max; }
-unsigned int agp_scan_bridge(device_t dev, unsigned int max) +unsigned int agp_scan_bridge(struct device * dev, unsigned int max) { return do_pci_scan_bridge(dev, max, agp_scan_bus); } diff --git a/src/device/cardbus_device.c b/src/device/cardbus_device.c index f25f96c..b0e7c9a 100644 --- a/src/device/cardbus_device.c +++ b/src/device/cardbus_device.c @@ -38,7 +38,7 @@ #define CARDBUS_IO_SIZE 4096 #define CARDBUS_MEM_SIZE (32 * 1024 * 1024)
-static void cardbus_record_bridge_resource(device_t dev, resource_t moving, +static void cardbus_record_bridge_resource(struct device * dev, resource_t moving, resource_t min_size, unsigned int index, unsigned long type) { struct resource *resource; @@ -70,7 +70,7 @@ static void cardbus_record_bridge_resource(device_t dev, resource_t moving, resource->size = min_size; }
-static void cardbus_size_bridge_resource(device_t dev, unsigned int index) +static void cardbus_size_bridge_resource(struct device * dev, unsigned int index) { struct resource *resource; resource_t min_size; @@ -87,7 +87,7 @@ static void cardbus_size_bridge_resource(device_t dev, unsigned int index) } }
-void cardbus_read_resources(device_t dev) +void cardbus_read_resources(struct device * dev) { resource_t moving_base, moving_limit, moving; unsigned long type; @@ -153,7 +153,7 @@ void cardbus_read_resources(device_t dev) compact_resources(dev); }
-void cardbus_enable_resources(device_t dev) +void cardbus_enable_resources(struct device * dev) { u16 ctrl;
diff --git a/src/device/cpu_device.c b/src/device/cpu_device.c index e76b539..7c72da4 100644 --- a/src/device/cpu_device.c +++ b/src/device/cpu_device.c @@ -25,7 +25,7 @@ void remap_bsp_lapic(struct bus *cpu_bus) { struct device_path cpu_path; - device_t cpu; + struct device * cpu; u32 bsp_lapic_id = lapicid();
if (bsp_lapic_id) { @@ -37,10 +37,10 @@ void remap_bsp_lapic(struct bus *cpu_bus) } }
-device_t add_cpu_device(struct bus *cpu_bus, unsigned apic_id, int enabled) +struct device * add_cpu_device(struct bus *cpu_bus, unsigned apic_id, int enabled) { struct device_path cpu_path; - device_t cpu; + struct device * cpu;
/* Build the cpu device path */ cpu_path.type = DEVICE_PATH_APIC; @@ -61,7 +61,7 @@ device_t add_cpu_device(struct bus *cpu_bus, unsigned apic_id, int enabled) return cpu; }
-void set_cpu_topology(device_t cpu, unsigned node, unsigned package, unsigned core, unsigned thread) +void set_cpu_topology(struct device * cpu, unsigned node, unsigned package, unsigned core, unsigned thread) { cpu->path.apic.node_id = node; cpu->path.apic.package_id = package; diff --git a/src/device/device_util.c b/src/device/device_util.c index d5466cb..b0b69d1 100644 --- a/src/device/device_util.c +++ b/src/device/device_util.c @@ -37,9 +37,9 @@ * @return Pointer to a device structure for the device on bus at path * or 0/NULL if no device is found. */ -device_t find_dev_path(struct bus *parent, struct device_path *path) +struct device * find_dev_path(struct bus *parent, struct device_path *path) { - device_t child; + struct device * child; for (child = parent->children; child; child = child->sibling) { if (path_eq(path, &child->path)) break; @@ -120,9 +120,9 @@ struct device *dev_find_slot_pnp(u16 port, u16 device) * @param apic_id The Local APIC ID number. * @return Pointer to the device structure (if found), 0 otherwise. */ -device_t dev_find_lapic(unsigned apic_id) +struct device * dev_find_lapic(unsigned apic_id) { - device_t dev, result = NULL; + struct device * dev, result = NULL;
for (dev = all_devices; dev; dev = dev->next) { if (dev->path.type == DEVICE_PATH_APIC && @@ -185,7 +185,7 @@ struct device *dev_find_class(unsigned int class, struct device *from) * @param dev The device path to encode. * @return Device path encoded into lower 3 bytes of dword. */ -u32 dev_path_encode(device_t dev) +u32 dev_path_encode(struct device * dev) { u32 ret;
@@ -238,7 +238,7 @@ u32 dev_path_encode(device_t dev) * Warning: This function uses a static buffer. Don't call it more than once * from the same print statement! */ -const char *dev_path(device_t dev) +const char *dev_path(struct device * dev) { static char buffer[DEVICE_PATH_MAX];
@@ -308,7 +308,7 @@ const char *dev_path(device_t dev) return buffer; }
-const char *dev_name(device_t dev) +const char *dev_name(struct device * dev) { if (dev->name) return dev->name; @@ -405,7 +405,7 @@ static int allocate_more_resources(void) * @param prev TODO * @return TODO. */ -static void free_resource(device_t dev, struct resource *res, +static void free_resource(struct device * dev, struct resource *res, struct resource *prev) { if (prev) @@ -424,7 +424,7 @@ static void free_resource(device_t dev, struct resource *res, * * @param dev The device to find the resource on. */ -void compact_resources(device_t dev) +void compact_resources(struct device * dev) { struct resource *res, *next, *prev = NULL;
@@ -445,7 +445,7 @@ void compact_resources(device_t dev) * @param index The index of the resource on the device. * @return The resource, if it already exists. */ -struct resource *probe_resource(device_t dev, unsigned index) +struct resource *probe_resource(struct device * dev, unsigned index) { struct resource *res;
@@ -468,7 +468,7 @@ struct resource *probe_resource(device_t dev, unsigned index) * @param index The index of the resource on the device. * @return TODO. */ -struct resource *new_resource(device_t dev, unsigned index) +struct resource *new_resource(struct device * dev, unsigned index) { struct resource *resource, *tail;
@@ -515,7 +515,7 @@ struct resource *new_resource(device_t dev, unsigned index) * @param index The index of the resource on the device. * return TODO. */ -struct resource *find_resource(device_t dev, unsigned index) +struct resource *find_resource(struct device * dev, unsigned index) { struct resource *resource;
@@ -629,7 +629,7 @@ const char *resource_type(struct resource *resource) * @param resource The resource that was just stored. * @param comment TODO */ -void report_resource_stored(device_t dev, struct resource *resource, +void report_resource_stored(struct device * dev, struct resource *resource, const char *comment) { char buf[10]; @@ -721,7 +721,7 @@ void search_global_resources(unsigned long type_mask, unsigned long type, } }
-void dev_set_enabled(device_t dev, int enable) +void dev_set_enabled(struct device * dev, int enable) { if (dev->enabled == enable) return; @@ -736,7 +736,7 @@ void dev_set_enabled(device_t dev, int enable)
void disable_children(struct bus *bus) { - device_t child; + struct device * child;
for (child = bus->children; child; child = child->sibling) { struct bus *link; @@ -890,7 +890,7 @@ void show_all_devs_resources(int debug_level, const char* msg) } }
-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) { struct resource *resource; @@ -939,7 +939,7 @@ u32 find_pci_tolm(struct bus *bus) /* Count of enabled CPUs */ int dev_count_cpu(void) { - device_t cpu; + struct device * cpu; int count = 0;
for (cpu = all_devices; cpu; cpu = cpu->next) { diff --git a/src/device/hypertransport.c b/src/device/hypertransport.c index d9ab486..a4c06e1 100644 --- a/src/device/hypertransport.c +++ b/src/device/hypertransport.c @@ -41,9 +41,10 @@ #include <cpu/amd/model_fxx_rev.h> #endif
-static device_t ht_scan_get_devs(device_t *old_devices) +static struct device * ht_scan_get_devs(struct device * *old_devices) { - device_t first, last; + struct device * first; + struct device * last;
first = *old_devices; last = first; @@ -60,7 +61,7 @@ static device_t ht_scan_get_devs(device_t *old_devices) }
if (first) { - device_t child; + struct device * child;
/* Unlink the chain from the list of old devices. */ *old_devices = last->sibling; @@ -81,7 +82,7 @@ static device_t ht_scan_get_devs(device_t *old_devices) }
#if OPT_HT_LINK == 1 -static unsigned ht_read_freq_cap(device_t dev, unsigned pos) +static unsigned ht_read_freq_cap(struct device * dev, unsigned pos) { /* Handle bugs in valid hypertransport frequency reporting. */ unsigned freq_cap; @@ -126,7 +127,7 @@ struct ht_link { unsigned char ctrl_off, config_off, freq_off, freq_cap_off; };
-static int ht_setup_link(struct ht_link *prev, device_t dev, unsigned pos) +static int ht_setup_link(struct ht_link *prev, struct device * dev, unsigned pos) { #if OPT_HT_LINK == 1 static const u8 link_width_to_pow2[] = { 3, 4, 0, 5, 1, 2, 0, 0 }; @@ -420,7 +421,10 @@ unsigned int hypertransport_scan_chain(struct bus *bus, unsigned min_devfn, * optimize link. */ unsigned int next_unitid, last_unitid, min_unitid, max_unitid; - device_t old_devices, dev, func, last_func = 0; + struct device * old_devices; + struct device * dev; + struct device * func; + struct device * last_func = NULL; struct ht_link prev; int ht_dev_num = 0;
@@ -433,7 +437,7 @@ unsigned int hypertransport_scan_chain(struct bus *bus, unsigned min_devfn, */ unsigned int real_last_unitid = 0, end_used = 0; u8 real_last_pos = 0; - device_t real_last_dev = NULL; + struct device * real_last_dev = NULL; #endif
/* Restore the hypertransport chain to it's uninitialized state. */ @@ -627,7 +631,7 @@ end_of_chain: * a problem in devicetree.cb. */ if (old_devices) { - device_t left; + struct device * left; for (left = old_devices; left; left = left->sibling) printk(BIOS_DEBUG, "%s\n", dev_path(left));
diff --git a/src/device/pci_device.c b/src/device/pci_device.c index 8351e9c..75827b4 100644 --- a/src/device/pci_device.c +++ b/src/device/pci_device.c @@ -157,7 +157,7 @@ unsigned pci_find_next_capability(struct device *dev, unsigned cap, * @param cap PCI_CAP_LIST_ID of the PCI capability we're looking for. * @return The next matching capability. */ -unsigned pci_find_capability(device_t dev, unsigned cap) +unsigned pci_find_capability(struct device * dev, unsigned cap) { return pci_find_next_capability(dev, cap, 0); } @@ -761,7 +761,7 @@ struct device_operations default_pci_ops_bus = { * @param dev Pointer to the device structure of the bridge. * @return Appropriate bridge operations. */ -static struct device_operations *get_pci_bridge_ops(device_t dev) +static struct device_operations *get_pci_bridge_ops(struct device * dev) { #if CONFIG_PCIX_PLUGIN_SUPPORT unsigned int pcixpos; @@ -959,7 +959,7 @@ static struct device *pci_scan_get_dev(struct device **list, unsigned int devfn) * @param devfn A device/function number to look at. * @return The device structure for the device (if found), NULL otherwise. */ -device_t pci_probe_dev(device_t dev, struct bus *bus, unsigned devfn) +struct device * pci_probe_dev(struct device * dev, struct bus *bus, unsigned devfn) { u32 id, class; u8 hdr_type; @@ -1066,7 +1066,7 @@ device_t pci_probe_dev(device_t dev, struct bus *bus, unsigned devfn) * @param sdev Simple device model identifier, created with PCI_DEV(). * @return Non-zero if bus:dev.fn of device matches. */ -unsigned int pci_match_simple_dev(device_t dev, pci_devfn_t sdev) +unsigned int pci_match_simple_dev(struct device * dev, pci_devfn_t sdev) { return dev->bus->secondary == PCI_DEV2SEGBUS(sdev) && dev->path.pci.devfn == PCI_DEV2DEVFN(sdev); @@ -1146,7 +1146,7 @@ unsigned int pci_scan_bus(struct bus *bus, unsigned min_devfn, * There's probably a problem in devicetree.cb. */ if (old_devices) { - device_t left; + struct device * left; printk(BIOS_WARNING, "PCI: Left over static devices:\n"); for (left = old_devices; left; left = left->sibling) printk(BIOS_WARNING, "%s\n", dev_path(left)); @@ -1280,7 +1280,7 @@ unsigned int pci_scan_bridge(struct device *dev, unsigned int max) * @param max The highest bus number assigned up to now. * @return The maximum bus number found, after scanning all subordinate busses. */ -unsigned int pci_domain_scan_bus(device_t dev, unsigned int max) +unsigned int pci_domain_scan_bus(struct device * dev, unsigned int max) { max = pci_scan_bus(dev->link_list, PCI_DEVFN(0, 0), 0xff, max); return max; @@ -1326,10 +1326,10 @@ const char *pin_to_str(int pin) * @return The interrupt pin number (1 - 4) that 'dev' will * trigger when generating an interrupt */ -static int swizzle_irq_pins(device_t dev, device_t *parent_bridge) +static int swizzle_irq_pins(struct device * dev, struct device * *parent_bridge) { - device_t parent; /* Our current device's parent device */ - device_t child; /* The child device of the parent */ + struct device * parent; /* Our current device's parent device */ + struct device * child; /* The child device of the parent */ uint8_t parent_bus = 0; /* Parent Bus number */ uint16_t parent_devfn = 0; /* Parent Device and Function number */ uint16_t child_devfn = 0; /* Child Device and Function number */ @@ -1394,7 +1394,7 @@ static int swizzle_irq_pins(device_t dev, device_t *parent_bridge) * Errors: -1 is returned if the device is not enabled * -2 is returned if a parent bridge could not be found. */ -int get_pci_irq_pins(device_t dev, device_t *parent_bdg) +int get_pci_irq_pins(struct device * dev, struct device * *parent_bdg) { uint8_t bus = 0; /* The bus this device is on */ uint16_t devfn = 0; /* This device's device and function numbers */ @@ -1456,7 +1456,7 @@ void pci_assign_irqs(unsigned bus, unsigned slot, const unsigned char pIntAtoD[4]) { unsigned int funct; - device_t pdev; + struct device * pdev; u8 line, irq;
/* Each slot may contain up to eight functions. */ diff --git a/src/device/pci_ops.c b/src/device/pci_ops.c index 5b633c8..21b45d0 100644 --- a/src/device/pci_ops.c +++ b/src/device/pci_ops.c @@ -25,7 +25,7 @@ #include <device/pci_ids.h> #include <device/pci_ops.h>
-const struct pci_bus_operations *pci_bus_default_ops(device_t dev) +const struct pci_bus_operations *pci_bus_default_ops(struct device * dev) { #if CONFIG_MMCONF_SUPPORT_DEFAULT return &pci_ops_mmconf; @@ -34,7 +34,7 @@ const struct pci_bus_operations *pci_bus_default_ops(device_t dev) #endif }
-static const struct pci_bus_operations *pci_bus_ops(struct bus *bus, device_t dev) +static const struct pci_bus_operations *pci_bus_ops(struct bus *bus, struct device * dev) { const struct pci_bus_operations *bops; bops = NULL; @@ -50,7 +50,7 @@ static const struct pci_bus_operations *pci_bus_ops(struct bus *bus, device_t de * The only consumer of the return value of get_pbus() is pci_bus_ops(). * pci_bus_ops() can handle being passed NULL and auto-picks working ops. */ -static struct bus *get_pbus(device_t dev) +static struct bus *get_pbus(struct device * dev) { struct bus *pbus = NULL;
@@ -82,42 +82,42 @@ static struct bus *get_pbus(device_t dev) return pbus; }
-u8 pci_read_config8(device_t dev, unsigned int where) +u8 pci_read_config8(struct device * dev, unsigned int where) { struct bus *pbus = get_pbus(dev); return pci_bus_ops(pbus, dev)->read8(pbus, dev->bus->secondary, dev->path.pci.devfn, where); }
-u16 pci_read_config16(device_t dev, unsigned int where) +u16 pci_read_config16(struct device * dev, unsigned int where) { struct bus *pbus = get_pbus(dev); return pci_bus_ops(pbus, dev)->read16(pbus, dev->bus->secondary, dev->path.pci.devfn, where); }
-u32 pci_read_config32(device_t dev, unsigned int where) +u32 pci_read_config32(struct device * dev, unsigned int where) { struct bus *pbus = get_pbus(dev); return pci_bus_ops(pbus, dev)->read32(pbus, dev->bus->secondary, dev->path.pci.devfn, where); }
-void pci_write_config8(device_t dev, unsigned int where, u8 val) +void pci_write_config8(struct device * dev, unsigned int where, u8 val) { struct bus *pbus = get_pbus(dev); pci_bus_ops(pbus, dev)->write8(pbus, dev->bus->secondary, dev->path.pci.devfn, where, val); }
-void pci_write_config16(device_t dev, unsigned int where, u16 val) +void pci_write_config16(struct device * dev, unsigned int where, u16 val) { struct bus *pbus = get_pbus(dev); pci_bus_ops(pbus, dev)->write16(pbus, dev->bus->secondary, dev->path.pci.devfn, where, val); }
-void pci_write_config32(device_t dev, unsigned int where, u32 val) +void pci_write_config32(struct device * dev, unsigned int where, u32 val) { struct bus *pbus = get_pbus(dev); pci_bus_ops(pbus, dev)->write32(pbus, dev->bus->secondary, @@ -125,42 +125,42 @@ void pci_write_config32(device_t dev, unsigned int where, u32 val) }
#if CONFIG_MMCONF_SUPPORT -u8 pci_mmio_read_config8(device_t dev, unsigned int where) +u8 pci_mmio_read_config8(struct device * dev, unsigned int where) { struct bus *pbus = get_pbus(dev); return pci_ops_mmconf.read8(pbus, dev->bus->secondary, dev->path.pci.devfn, where); }
-u16 pci_mmio_read_config16(device_t dev, unsigned int where) +u16 pci_mmio_read_config16(struct device * dev, unsigned int where) { struct bus *pbus = get_pbus(dev); return pci_ops_mmconf.read16(pbus, dev->bus->secondary, dev->path.pci.devfn, where); }
-u32 pci_mmio_read_config32(device_t dev, unsigned int where) +u32 pci_mmio_read_config32(struct device * dev, unsigned int where) { struct bus *pbus = get_pbus(dev); return pci_ops_mmconf.read32(pbus, dev->bus->secondary, dev->path.pci.devfn, where); }
-void pci_mmio_write_config8(device_t dev, unsigned int where, u8 val) +void pci_mmio_write_config8(struct device * dev, unsigned int where, u8 val) { struct bus *pbus = get_pbus(dev); pci_ops_mmconf.write8(pbus, dev->bus->secondary, dev->path.pci.devfn, where, val); }
-void pci_mmio_write_config16(device_t dev, unsigned int where, u16 val) +void pci_mmio_write_config16(struct device * dev, unsigned int where, u16 val) { struct bus *pbus = get_pbus(dev); pci_ops_mmconf.write16(pbus, dev->bus->secondary, dev->path.pci.devfn, where, val); }
-void pci_mmio_write_config32(device_t dev, unsigned int where, u32 val) +void pci_mmio_write_config32(struct device * dev, unsigned int where, u32 val) { struct bus *pbus = get_pbus(dev); pci_ops_mmconf.write32(pbus, dev->bus->secondary, dev->path.pci.devfn, diff --git a/src/device/pci_rom.c b/src/device/pci_rom.c index 1bdccf0..cc7972e 100644 --- a/src/device/pci_rom.c +++ b/src/device/pci_rom.c @@ -155,7 +155,7 @@ struct rom_header *pci_rom_load(struct device *dev, */ if (PCI_CLASS_DISPLAY_VGA == (dev->class >> 8)) { #if !CONFIG_MULTIPLE_VGA_ADAPTERS - extern device_t vga_pri; /* Primary VGA device (device.c). */ + extern struct device * vga_pri; /* Primary VGA device (device.c). */ if (dev != vga_pri) return NULL; /* Only one VGA supported. */ #endif if ((void *)PCI_VGA_RAM_IMAGE_START != rom_header) { diff --git a/src/device/pciexp_device.c b/src/device/pciexp_device.c index 87aea67..d1752f7 100644 --- a/src/device/pciexp_device.c +++ b/src/device/pciexp_device.c @@ -30,7 +30,7 @@ * Re-train a PCIe link */ #define PCIE_TRAIN_RETRY 10000 -static int pciexp_retrain_link(device_t dev, unsigned cap) +static int pciexp_retrain_link(struct device * dev, unsigned cap) { unsigned try = PCIE_TRAIN_RETRY; u16 lnk; @@ -57,8 +57,8 @@ static int pciexp_retrain_link(device_t dev, unsigned cap) * and enable Common Clock Configuration if possible. If CCC is * enabled the link must be retrained. */ -static void pciexp_enable_common_clock(device_t root, unsigned root_cap, - device_t endp, unsigned endp_cap) +static void pciexp_enable_common_clock(struct device * root, unsigned root_cap, + struct device * endp, unsigned endp_cap) { u16 root_scc, endp_scc, lnkctl;
@@ -96,8 +96,8 @@ static void pciexp_enable_common_clock(device_t root, unsigned root_cap, * by checking both root port and endpoint and returning * the highest latency value. */ -static int pciexp_aspm_latency(device_t root, unsigned root_cap, - device_t endp, unsigned endp_cap, +static int pciexp_aspm_latency(struct device * root, unsigned root_cap, + struct device * endp, unsigned endp_cap, enum aspm_type type) { int root_lat = 0, endp_lat = 0; @@ -139,8 +139,8 @@ static int pciexp_aspm_latency(device_t root, unsigned root_cap, * 2 = L1 Enabled * 3 = L0s and L1 Enabled */ -static enum aspm_type pciexp_enable_aspm(device_t root, unsigned root_cap, - device_t endp, unsigned endp_cap) +static enum aspm_type pciexp_enable_aspm(struct device * root, unsigned root_cap, + struct device * endp, unsigned endp_cap) { const char *aspm_type_str[] = { "None", "L0s", "L1", "L0s and L1" }; enum aspm_type apmc = PCIE_ASPM_NONE; @@ -182,9 +182,9 @@ static enum aspm_type pciexp_enable_aspm(device_t root, unsigned root_cap, } #endif /* CONFIG_PCIEXP_ASPM */
-static void pciexp_tune_dev(device_t dev) +static void pciexp_tune_dev(struct device * dev) { - device_t root = dev->bus->dev; + struct device * root = dev->bus->dev; unsigned int root_cap, cap;
cap = pci_find_capability(dev, PCI_CAP_ID_PCIE); @@ -216,7 +216,7 @@ static void pciexp_tune_dev(device_t dev) unsigned int pciexp_scan_bus(struct bus *bus, unsigned int min_devfn, unsigned int max_devfn, unsigned int max) { - device_t child; + struct device * child;
max = pci_scan_bus(bus, min_devfn, max_devfn, max);
@@ -230,7 +230,7 @@ unsigned int pciexp_scan_bus(struct bus *bus, unsigned int min_devfn, return max; }
-unsigned int pciexp_scan_bridge(device_t dev, unsigned int max) +unsigned int pciexp_scan_bridge(struct device * dev, unsigned int max) { return do_pci_scan_bridge(dev, max, pciexp_scan_bus); } diff --git a/src/device/pcix_device.c b/src/device/pcix_device.c index a20c3bf..90999c9 100644 --- a/src/device/pcix_device.c +++ b/src/device/pcix_device.c @@ -24,7 +24,7 @@ #include <device/pci_ids.h> #include <device/pcix.h>
-static void pcix_tune_dev(device_t dev) +static void pcix_tune_dev(struct device * dev) { u32 status; u16 orig_cmd, cmd; @@ -65,7 +65,7 @@ static void pcix_tune_dev(device_t dev)
static void pcix_tune_bus(struct bus *bus) { - device_t child; + struct device * child;
for (child = bus->children; child; child = child->sibling) pcix_tune_dev(child); @@ -112,7 +112,7 @@ const char *pcix_speed(u16 sstatus) return result; }
-unsigned int pcix_scan_bridge(device_t dev, unsigned int max) +unsigned int pcix_scan_bridge(struct device * dev, unsigned int max) { unsigned int pos; u16 sstatus; diff --git a/src/device/pnp_device.c b/src/device/pnp_device.c index e4aa4d3..d017178 100644 --- a/src/device/pnp_device.c +++ b/src/device/pnp_device.c @@ -32,13 +32,13 @@
/* PNP config mode wrappers */
-void pnp_enter_conf_mode(device_t dev) +void pnp_enter_conf_mode(struct device * dev) { if (dev->ops->ops_pnp_mode) dev->ops->ops_pnp_mode->enter_conf_mode(dev); }
-void pnp_exit_conf_mode(device_t dev) +void pnp_exit_conf_mode(struct device * dev) { if (dev->ops->ops_pnp_mode) dev->ops->ops_pnp_mode->exit_conf_mode(dev); @@ -46,24 +46,24 @@ void pnp_exit_conf_mode(device_t dev)
/* PNP fundamental operations */
-void pnp_write_config(device_t dev, u8 reg, u8 value) +void pnp_write_config(struct device * dev, u8 reg, u8 value) { outb(reg, dev->path.pnp.port); outb(value, dev->path.pnp.port + 1); }
-u8 pnp_read_config(device_t dev, u8 reg) +u8 pnp_read_config(struct device * dev, u8 reg) { outb(reg, dev->path.pnp.port); return inb(dev->path.pnp.port + 1); }
-void pnp_set_logical_device(device_t dev) +void pnp_set_logical_device(struct device * dev) { pnp_write_config(dev, 0x07, dev->path.pnp.device & 0xff); }
-void pnp_set_enable(device_t dev, int enable) +void pnp_set_enable(struct device * dev, int enable) { u8 tmp, bitpos;
@@ -80,7 +80,7 @@ void pnp_set_enable(device_t dev, int enable) pnp_write_config(dev, 0x30, tmp); }
-int pnp_read_enable(device_t dev) +int pnp_read_enable(struct device * dev) { u8 tmp, bitpos;
@@ -92,20 +92,20 @@ int pnp_read_enable(device_t dev) return !!(tmp & (1 << bitpos)); }
-void pnp_set_iobase(device_t dev, u8 index, u16 iobase) +void pnp_set_iobase(struct device * dev, u8 index, u16 iobase) { /* Index == 0x60 or 0x62. */ pnp_write_config(dev, index + 0, (iobase >> 8) & 0xff); pnp_write_config(dev, index + 1, iobase & 0xff); }
-void pnp_set_irq(device_t dev, u8 index, u8 irq) +void pnp_set_irq(struct device * dev, u8 index, u8 irq) { /* Index == 0x70 or 0x72. */ pnp_write_config(dev, index, irq); }
-void pnp_set_drq(device_t dev, u8 index, u8 drq) +void pnp_set_drq(struct device * dev, u8 index, u8 drq) { /* Index == 0x74. */ pnp_write_config(dev, index, drq & 0xff); @@ -113,12 +113,12 @@ void pnp_set_drq(device_t dev, u8 index, u8 drq)
/* PNP device operations */
-void pnp_read_resources(device_t dev) +void pnp_read_resources(struct device * dev) { return; }
-static void pnp_set_resource(device_t dev, struct resource *resource) +static void pnp_set_resource(struct device * dev, struct resource *resource) { if (!(resource->flags & IORESOURCE_ASSIGNED)) { printk(BIOS_ERR, "ERROR: %s %02lx %s size: 0x%010llx " @@ -144,7 +144,7 @@ static void pnp_set_resource(device_t dev, struct resource *resource) report_resource_stored(dev, resource, ""); }
-void pnp_set_resources(device_t dev) +void pnp_set_resources(struct device * dev) { struct resource *res;
@@ -160,7 +160,7 @@ void pnp_set_resources(device_t dev) pnp_exit_conf_mode(dev); }
-void pnp_enable_resources(device_t dev) +void pnp_enable_resources(struct device * dev) { pnp_enter_conf_mode(dev); pnp_set_logical_device(dev); @@ -168,7 +168,7 @@ void pnp_enable_resources(device_t dev) pnp_exit_conf_mode(dev); }
-void pnp_enable(device_t dev) +void pnp_enable(struct device * dev) { if (!dev->enabled) { pnp_enter_conf_mode(dev); @@ -178,7 +178,7 @@ void pnp_enable(device_t dev) } }
-void pnp_alt_enable(device_t dev) +void pnp_alt_enable(struct device * dev) { pnp_enter_conf_mode(dev); pnp_set_logical_device(dev); @@ -195,7 +195,7 @@ struct device_operations pnp_ops = {
/* PNP chip operations */
-static void pnp_get_ioresource(device_t dev, u8 index, struct io_info *info) +static void pnp_get_ioresource(struct device * dev, u8 index, struct io_info *info) { struct resource *resource; unsigned moving, gran, step; @@ -246,7 +246,7 @@ static void pnp_get_ioresource(device_t dev, u8 index, struct io_info *info) resource->size = 1 << gran; }
-static void get_resources(device_t dev, struct pnp_info *info) +static void get_resources(struct device * dev, struct pnp_info *info) { struct resource *resource;
@@ -312,11 +312,11 @@ static void get_resources(device_t dev, struct pnp_info *info) } }
-void pnp_enable_devices(device_t base_dev, struct device_operations *ops, +void pnp_enable_devices(struct device * base_dev, struct device_operations *ops, unsigned int functions, struct pnp_info *info) { struct device_path path; - device_t dev; + struct device * dev; int i;
path.type = DEVICE_PATH_PNP; diff --git a/src/device/root_device.c b/src/device/root_device.c index 49fa711..2130ba2 100644 --- a/src/device/root_device.c +++ b/src/device/root_device.c @@ -35,7 +35,7 @@ const char mainboard_name[] = CONFIG_MAINBOARD_VENDOR " " CONFIG_MAINBOARD_PART_ * * @param root Pointer to the device structure for the system root device. */ -static void root_dev_read_resources(device_t root) +static void root_dev_read_resources(struct device * root) { printk(BIOS_ERR, "%s should never be called.\n", __func__); } @@ -48,7 +48,7 @@ static void root_dev_read_resources(device_t root) * * @param root Pointer to the device structure for the system root device. */ -static void root_dev_set_resources(device_t root) +static void root_dev_set_resources(struct device * root) { printk(BIOS_ERR, "%s should never be called.\n", __func__); } @@ -76,9 +76,9 @@ static void root_dev_set_resources(device_t root) * @return The largest bus number used. */ static int smbus_max = 0; -unsigned int scan_static_bus(device_t bus, unsigned int max) +unsigned int scan_static_bus(struct device * bus, unsigned int max) { - device_t child; + struct device * child; struct bus *link;
printk(BIOS_SPEW, "%s for %s\n", __func__, dev_path(bus)); @@ -121,7 +121,7 @@ unsigned int scan_static_bus(device_t bus, unsigned int max) return max; }
-static void root_dev_enable_resources(device_t dev) +static void root_dev_enable_resources(struct device * dev) { }
@@ -134,12 +134,12 @@ static void root_dev_enable_resources(device_t dev) * @param max The current bus number scanned so far, usually 0x00. * @return The largest bus number used. */ -static unsigned int root_dev_scan_bus(device_t root, unsigned int max) +static unsigned int root_dev_scan_bus(struct device * root, unsigned int max) { return scan_static_bus(root, max); }
-static void root_dev_init(device_t root) +static void root_dev_init(struct device * root) { }
diff --git a/src/device/smbus_ops.c b/src/device/smbus_ops.c index 41b31ed..ddba6d8 100644 --- a/src/device/smbus_ops.c +++ b/src/device/smbus_ops.c @@ -25,7 +25,7 @@ #include <device/path.h> #include <device/smbus.h>
-struct bus *get_pbus_smbus(device_t dev) +struct bus *get_pbus_smbus(struct device * dev) { struct bus *pbus = dev->bus;
@@ -51,7 +51,7 @@ struct bus *get_pbus_smbus(device_t dev) * * @param dev TODO. */ -int smbus_set_link(device_t dev) +int smbus_set_link(struct device * dev) { struct bus *pbus_a[4]; // 4 level mux only. Enough? struct bus *pbus = dev->bus; @@ -87,70 +87,70 @@ int smbus_set_link(device_t dev) }
-int smbus_quick_read(device_t dev) +int smbus_quick_read(struct device * dev) { CHECK_PRESENCE(quick_read);
return ops_smbus_bus(get_pbus_smbus(dev))->quick_read(dev); }
-int smbus_quick_write(device_t dev) +int smbus_quick_write(struct device * dev) { CHECK_PRESENCE(quick_write);
return ops_smbus_bus(get_pbus_smbus(dev))->quick_write(dev); }
-int smbus_recv_byte(device_t dev) +int smbus_recv_byte(struct device * dev) { CHECK_PRESENCE(recv_byte);
return ops_smbus_bus(get_pbus_smbus(dev))->recv_byte(dev); }
-int smbus_send_byte(device_t dev, u8 byte) +int smbus_send_byte(struct device * dev, u8 byte) { CHECK_PRESENCE(send_byte);
return ops_smbus_bus(get_pbus_smbus(dev))->send_byte(dev, byte); }
-int smbus_read_byte(device_t dev, u8 addr) +int smbus_read_byte(struct device * dev, u8 addr) { CHECK_PRESENCE(read_byte);
return ops_smbus_bus(get_pbus_smbus(dev))->read_byte(dev, addr); }
-int smbus_write_byte(device_t dev, u8 addr, u8 val) +int smbus_write_byte(struct device * dev, u8 addr, u8 val) { CHECK_PRESENCE(write_byte);
return ops_smbus_bus(get_pbus_smbus(dev))->write_byte(dev, addr, val); }
-int smbus_read_word(device_t dev, u8 addr) +int smbus_read_word(struct device * dev, u8 addr) { CHECK_PRESENCE(read_word);
return ops_smbus_bus(get_pbus_smbus(dev))->read_word(dev, addr); }
-int smbus_write_word(device_t dev, u8 addr, u16 val) +int smbus_write_word(struct device * dev, u8 addr, u16 val) { CHECK_PRESENCE(write_word);
return ops_smbus_bus(get_pbus_smbus(dev))->write_word(dev, addr, val); }
-int smbus_process_call(device_t dev, u8 cmd, u16 data) +int smbus_process_call(struct device * dev, u8 cmd, u16 data) { CHECK_PRESENCE(process_call);
return ops_smbus_bus(get_pbus_smbus(dev))->process_call(dev, cmd, data); }
-int smbus_block_read(device_t dev, u8 cmd, u8 bytes, u8 *buffer) +int smbus_block_read(struct device * dev, u8 cmd, u8 bytes, u8 *buffer) { CHECK_PRESENCE(block_read);
@@ -158,7 +158,7 @@ int smbus_block_read(device_t dev, u8 cmd, u8 bytes, u8 *buffer) bytes, buffer); }
-int smbus_block_write(device_t dev, u8 cmd, u8 bytes, const u8 *buffer) +int smbus_block_write(struct device * dev, u8 cmd, u8 bytes, const u8 *buffer) { CHECK_PRESENCE(block_write);
diff --git a/src/include/device/device.h b/src/include/device/device.h index cf4cb8c..6c4a590 100644 --- a/src/include/device/device.h +++ b/src/include/device/device.h @@ -43,19 +43,19 @@ struct smbios_type11; struct acpi_rsdp;
struct device_operations { - void (*read_resources)(device_t dev); - void (*set_resources)(device_t dev); - void (*enable_resources)(device_t dev); - void (*init)(device_t dev); - void (*final)(device_t dev); - unsigned int (*scan_bus)(device_t bus, unsigned int _max); - void (*enable)(device_t dev); - void (*disable)(device_t dev); - void (*set_link)(device_t dev, unsigned int link); + void (*read_resources)(struct device * dev); + void (*set_resources)(struct device * dev); + void (*enable_resources)(struct device * dev); + void (*init)(struct device * dev); + void (*final)(struct device * dev); + unsigned int (*scan_bus)(struct device * bus, unsigned int _max); + void (*enable)(struct device * dev); + void (*disable)(struct device * dev); + void (*set_link)(struct device * dev, unsigned int link); void (*reset_bus)(struct bus *bus); #if CONFIG_GENERATE_SMBIOS_TABLES - int (*get_smbios_data)(device_t dev, int *handle, unsigned long *current); - void (*get_smbios_strings)(device_t dev, struct smbios_type11 *t); + int (*get_smbios_data)(struct device * dev, int *handle, unsigned long *current); + void (*get_smbios_strings)(struct device * dev, struct smbios_type11 *t); #endif #if IS_ENABLED(CONFIG_HAVE_ACPI_TABLES) && IS_ENABLED(CONFIG_PER_DEVICE_ACPI_TABLES) unsigned long (*write_acpi_tables)(unsigned long start, struct acpi_rsdp *rsdp); @@ -64,7 +64,7 @@ struct device_operations { #endif const struct pci_operations *ops_pci; const struct smbus_bus_operations *ops_smbus_bus; - const struct pci_bus_operations * (*ops_pci_bus)(device_t dev); + const struct pci_bus_operations * (*ops_pci_bus)(struct device * dev); const struct pnp_mode_ops *ops_pnp_mode; };
@@ -155,7 +155,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); @@ -171,30 +171,30 @@ unsigned int scan_bus(struct device *bus, unsigned int _max); void assign_resources(struct bus *bus); void enumerate_static_device(void); void enumerate_static_devices(void); -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);
/* 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_slot (unsigned int bus, unsigned int devfn); -device_t dev_find_slot_on_smbus (unsigned int bus, unsigned int addr); -device_t dev_find_slot_pnp(u16 port, u16 device); -device_t dev_find_lapic(unsigned 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_slot (unsigned int bus, unsigned int devfn); +struct device * dev_find_slot_on_smbus (unsigned int bus, unsigned int addr); +struct device * dev_find_slot_pnp(u16 port, u16 device); +struct device * dev_find_lapic(unsigned apic_id); int dev_count_cpu(void);
void remap_bsp_lapic(struct bus *cpu_bus); -device_t add_cpu_device(struct bus *cpu_bus, unsigned apic_id, int enabled); -void set_cpu_topology(device_t cpu, unsigned node, unsigned package, unsigned core, unsigned thread); +struct device * add_cpu_device(struct bus *cpu_bus, unsigned apic_id, int enabled); +void set_cpu_topology(struct device * cpu, unsigned node, unsigned package, unsigned core, unsigned thread);
#define amd_cpu_topology(cpu, node, core) \ set_cpu_topology(cpu, node, 0, core, 0) @@ -222,9 +222,9 @@ void show_all_devs_resources(int debug_level, const char* msg); extern struct device_operations default_dev_ops_root; void pci_domain_read_resources(struct device *dev); unsigned int pci_domain_scan_bus(struct device *dev, unsigned int _max); -unsigned int scan_static_bus(device_t bus, unsigned int _max); +unsigned int scan_static_bus(struct device * bus, unsigned int _max);
-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);