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 af2fb29477b0d608fb9e7b179cd83754e7266f81 Author: Edward O'Callaghan eocallaghan@alterapraxis.com Date: Sat Nov 1 13:55:04 2014 +1100
device: Clarify correct typing of 'struct device *'
Disambiguate 'device_t' into 'struct device *', 'pci_devfn_t' and 'pnp_devfn_t' component types where appropriate.
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 | 35 ++++++++++--------- src/device/hypertransport.c | 20 ++++++----- src/device/pci_device.c | 22 ++++++------ src/device/pci_ops.c | 2 +- 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/cpu/amd/model_fxx_rev.h | 7 ++-- src/include/device/agp.h | 2 +- src/include/device/cardbus.h | 4 +-- src/include/device/device.h | 69 ++++++++++++++++++------------------- src/include/device/pci.h | 30 ++++++++-------- src/include/device/pciexp.h | 2 +- src/include/device/pcix.h | 2 +- src/include/device/pnp.h | 38 ++++++++++---------- src/include/device/smbus.h | 54 ++++++++++++++--------------- src/include/reg_script.h | 6 ++-- 23 files changed, 215 insertions(+), 210 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..22dadef 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,10 @@ 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 = NULL; + struct device * result = NULL;
for (dev = all_devices; dev; dev = dev->next) { if (dev->path.type == DEVICE_PATH_APIC && @@ -185,7 +186,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 +239,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 +309,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 +406,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 +425,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 +446,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 +469,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 +516,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 +630,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 +722,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 +737,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 +891,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 +940,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 6ddb493..3d3327c 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; 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/cpu/amd/model_fxx_rev.h b/src/include/cpu/amd/model_fxx_rev.h index 1e85596..c3ef4e9 100644 --- a/src/include/cpu/amd/model_fxx_rev.h +++ b/src/include/cpu/amd/model_fxx_rev.h @@ -1,4 +1,5 @@ #include <arch/cpu.h> +#include <arch/io.h>
int init_processor_name(void);
@@ -59,7 +60,7 @@ static int is_e0_later_in_bsp(int nodeid) return !is_cpu_pre_e0(); } // d0 will be treated as e0 with this methods, but the d0 nb_cfg_54 always 0 - device_t dev; + pci_devfn_t dev; dev = PCI_DEV(0, 0x18+nodeid,2); val_old = pci_read_config32(dev, 0x80); val = val_old; @@ -101,7 +102,7 @@ static inline int is_cpu_pre_f2(void) static inline int is_cpu_f0_in_bsp(int nodeid) { uint32_t dword; - device_t dev; + pci_devfn_t dev; dev = PCI_DEV(0, 0x18+nodeid, 3); dword = pci_read_config32(dev, 0xfc); return (dword & 0xfff00) == 0x40f00; @@ -109,7 +110,7 @@ static inline int is_cpu_f0_in_bsp(int nodeid) static inline int is_cpu_pre_f2_in_bsp(int nodeid) { uint32_t dword; - device_t dev; + pci_devfn_t dev; dev = PCI_DEV(0, 0x18+nodeid, 3); dword = pci_read_config32(dev, 0xfc); return (dword & 0xfff0f) < 0x40f02; diff --git a/src/include/device/agp.h b/src/include/device/agp.h index be2b833..b3791fe 100644 --- a/src/include/device/agp.h +++ b/src/include/device/agp.h @@ -7,7 +7,7 @@
unsigned int agp_scan_bus(struct bus *bus, unsigned min_devfn, unsigned max_devfn, unsigned int max); -unsigned int agp_scan_bridge(device_t dev, unsigned int max); +unsigned int agp_scan_bridge(struct device *dev, unsigned int max);
extern struct device_operations default_agp_ops_bus;
diff --git a/src/include/device/cardbus.h b/src/include/device/cardbus.h index 45ae24f..4443c15 100644 --- a/src/include/device/cardbus.h +++ b/src/include/device/cardbus.h @@ -5,8 +5,8 @@
#include <device/device.h>
-void cardbus_read_resources(device_t dev); -void cardbus_enable_resources(device_t dev); +void cardbus_read_resources(struct device *dev); +void cardbus_enable_resources(struct device *dev);
extern struct device_operations default_cardbus_ops_bus;
diff --git a/src/include/device/device.h b/src/include/device/device.h index c67205c..fe8dbed 100644 --- a/src/include/device/device.h +++ b/src/include/device/device.h @@ -41,19 +41,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); @@ -62,7 +62,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; };
@@ -76,9 +76,8 @@ static inline void device_noop(struct device *dev) {}
struct bus { - - ROMSTAGE_CONST struct device * dev; /* This bridge device */ - ROMSTAGE_CONST struct device * children; /* devices behind this bridge */ + ROMSTAGE_CONST struct device *dev; /* This bridge device */ + ROMSTAGE_CONST struct device *children; /* devices behind this bridge */ ROMSTAGE_CONST struct bus *next; /* The next bridge on this device */ unsigned bridge_ctrl; /* Bridge control register */ unsigned char link_num; /* The index of this link */ @@ -98,7 +97,7 @@ struct pci_irq_info { unsigned int ioapic_irq_pin; unsigned int ioapic_src_pin; unsigned int ioapic_dst_id; - unsigned int ioapic_flags; + unsigned int ioapic_flags; };
struct device { @@ -159,7 +158,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); @@ -175,30 +174,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) @@ -207,7 +206,7 @@ void set_cpu_topology(device_t cpu, unsigned node, unsigned package, unsigned co set_cpu_topology(cpu, 0, package, core, thread)
/* Debug functions */ -void print_resource_tree(struct device * root, int debug_level, +void print_resource_tree(struct device *root, int debug_level, const char *msg); void show_devs_tree(struct device *dev, int debug_level, int depth, int linknum); void show_devs_subtree(struct device *root, int debug_level, const char *msg); @@ -226,9 +225,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);
@@ -257,7 +256,7 @@ u32 find_pci_tolm(struct bus *bus);
ROMSTAGE_CONST struct device * dev_find_slot (unsigned int bus, unsigned int devfn); -ROMSTAGE_CONST struct device *dev_find_next_pci_device( +ROMSTAGE_CONST struct device * dev_find_next_pci_device( ROMSTAGE_CONST struct device *previous_dev); ROMSTAGE_CONST struct device * dev_find_slot_on_smbus (unsigned int bus, unsigned int addr); diff --git a/src/include/device/pci.h b/src/include/device/pci.h index 0670da4..3688322 100644 --- a/src/include/device/pci.h +++ b/src/include/device/pci.h @@ -32,7 +32,7 @@ /* Common pci operations without a standard interface */ struct pci_operations { /* set the Subsystem IDs for the PCI device */ - void (*set_subsystem)(device_t dev, unsigned vendor, unsigned device); + void (*set_subsystem)(struct device *dev, unsigned vendor, unsigned device); };
/* Common pci bus operations */ @@ -62,35 +62,35 @@ extern struct pci_driver epci_drivers[]; extern struct device_operations default_pci_ops_dev; extern struct device_operations default_pci_ops_bus;
-void pci_dev_read_resources(device_t dev); -void pci_bus_read_resources(device_t dev); -void pci_dev_set_resources(device_t dev); -void pci_dev_enable_resources(device_t dev); -void pci_bus_enable_resources(device_t dev); +void pci_dev_read_resources(struct device *dev); +void pci_bus_read_resources(struct device *dev); +void pci_dev_set_resources(struct device *dev); +void pci_dev_enable_resources(struct device *dev); +void pci_bus_enable_resources(struct device *dev); void pci_bus_reset(struct bus *bus); -device_t pci_probe_dev(device_t dev, struct bus *bus, unsigned devfn); -unsigned int do_pci_scan_bridge(device_t bus, unsigned int max, +struct device *pci_probe_dev(struct device *dev, struct bus *bus, unsigned devfn); +unsigned int do_pci_scan_bridge(struct device *bus, unsigned int max, unsigned int (*do_scan_bus)(struct bus *bus, unsigned min_devfn, unsigned max_devfn, unsigned int max)); -unsigned int pci_scan_bridge(device_t bus, unsigned int max); +unsigned int pci_scan_bridge(struct device *bus, unsigned int max); unsigned int pci_scan_bus(struct bus *bus, unsigned min_devfn, unsigned max_devfn, unsigned int max); uint8_t pci_moving_config8(struct device *dev, unsigned reg); uint16_t pci_moving_config16(struct device *dev, unsigned reg); uint32_t pci_moving_config32(struct device *dev, unsigned reg); struct resource *pci_get_resource(struct device *dev, unsigned long index); -void pci_dev_set_subsystem(device_t dev, unsigned vendor, unsigned device); +void pci_dev_set_subsystem(struct device *dev, unsigned vendor, unsigned device); void pci_dev_init(struct device *dev); -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);
const char * pin_to_str(int pin); -int get_pci_irq_pins(device_t dev, device_t *parent_bdg); +int get_pci_irq_pins(struct device *dev, struct device **parent_bdg); void pci_assign_irqs(unsigned bus, unsigned slot, const unsigned char pIntAtoD[4]);
#define PCI_IO_BRIDGE_ALIGN 4096 #define PCI_MEM_BRIDGE_ALIGN (1024*1024)
-static inline const struct pci_operations *ops_pci(device_t dev) +static inline const struct pci_operations *ops_pci(struct device *dev) { const struct pci_operations *pops; pops = 0; @@ -106,8 +106,8 @@ static inline const struct pci_operations *ops_pci(device_t dev) unsigned pci_find_next_capability(pci_devfn_t dev, unsigned cap, unsigned last); unsigned pci_find_capability(pci_devfn_t dev, unsigned cap); #else /* !__PRE_RAM__ */ -unsigned pci_find_next_capability(device_t dev, unsigned cap, unsigned last); -unsigned pci_find_capability(device_t dev, unsigned cap); +unsigned pci_find_next_capability(struct device *dev, unsigned cap, unsigned last); +unsigned pci_find_capability(struct device *dev, unsigned cap); #endif /* __PRE_RAM__ */
void pci_early_bridge_init(void); diff --git a/src/include/device/pciexp.h b/src/include/device/pciexp.h index 87a5002..c7ff4f5 100644 --- a/src/include/device/pciexp.h +++ b/src/include/device/pciexp.h @@ -11,7 +11,7 @@ enum aspm_type {
unsigned int pciexp_scan_bus(struct bus *bus, unsigned int min_devfn, unsigned int max_devfn, unsigned int max); -unsigned int pciexp_scan_bridge(device_t dev, unsigned int max); +unsigned int pciexp_scan_bridge(struct device *dev, unsigned int max);
extern struct device_operations default_pciexp_ops_bus;
diff --git a/src/include/device/pcix.h b/src/include/device/pcix.h index 4ffab5b..8cc83df 100644 --- a/src/include/device/pcix.h +++ b/src/include/device/pcix.h @@ -4,7 +4,7 @@
unsigned int pcix_scan_bus(struct bus *bus, unsigned int min_devfn, unsigned int max_devfn, unsigned int max); -unsigned int pcix_scan_bridge(device_t dev, unsigned int max); +unsigned int pcix_scan_bridge(struct device *dev, unsigned int max); const char *pcix_speed(u16 sstatus);
extern struct device_operations default_pcix_ops_bus; diff --git a/src/include/device/pnp.h b/src/include/device/pnp.h index d0d6fa3..9290056 100644 --- a/src/include/device/pnp.h +++ b/src/include/device/pnp.h @@ -9,21 +9,21 @@ #ifndef __SIMPLE_DEVICE__
/* Primitive PNP resource manipulation */ -void pnp_write_config(device_t dev, u8 reg, u8 value); -u8 pnp_read_config(device_t dev, u8 reg); -void pnp_set_logical_device(device_t dev); -void pnp_set_enable(device_t dev, int enable); -int pnp_read_enable(device_t dev); -void pnp_set_iobase(device_t dev, u8 index, u16 iobase); -void pnp_set_irq(device_t dev, u8 index, u8 irq); -void pnp_set_drq(device_t dev, u8 index, u8 drq); +void pnp_write_config(struct device *dev, u8 reg, u8 value); +u8 pnp_read_config(struct device *dev, u8 reg); +void pnp_set_logical_device(struct device *dev); +void pnp_set_enable(struct device *dev, int enable); +int pnp_read_enable(struct device *dev); +void pnp_set_iobase(struct device *dev, u8 index, u16 iobase); +void pnp_set_irq(struct device *dev, u8 index, u8 irq); +void pnp_set_drq(struct device *dev, u8 index, u8 drq);
/* PNP device operations */ -void pnp_read_resources(device_t dev); -void pnp_set_resources(device_t dev); -void pnp_enable_resources(device_t dev); -void pnp_enable(device_t dev); -void pnp_alt_enable(device_t dev); +void pnp_read_resources(struct device *dev); +void pnp_set_resources(struct device *dev); +void pnp_enable_resources(struct device *dev); +void pnp_enable(struct device *dev); +void pnp_alt_enable(struct device *dev);
extern struct device_operations pnp_ops;
@@ -52,16 +52,16 @@ struct pnp_info { #define PNP_MSC10 0x1000 struct io_info io0, io1, io2, io3; }; -struct resource *pnp_get_resource(device_t dev, unsigned index); +struct resource *pnp_get_resource(struct device *dev, unsigned index); void pnp_enable_devices(struct device *dev, struct device_operations *ops, unsigned int functions, struct pnp_info *info);
struct pnp_mode_ops { - void (*enter_conf_mode)(device_t dev); - void (*exit_conf_mode)(device_t dev); + void (*enter_conf_mode)(struct device *dev); + void (*exit_conf_mode)(struct device *dev); }; -void pnp_enter_conf_mode(device_t dev); -void pnp_exit_conf_mode(device_t dev); +void pnp_enter_conf_mode(struct device *dev); +void pnp_exit_conf_mode(struct device *dev);
#endif /* ! __SIMPLE_DEVICE__ */ -#endif /* DEVICE_PNP_H */ +#endif /*devICE_PNP_H */ diff --git a/src/include/device/smbus.h b/src/include/device/smbus.h index 073d7e2..7002459 100644 --- a/src/include/device/smbus.h +++ b/src/include/device/smbus.h @@ -8,17 +8,17 @@
/* Common SMBus bus operations */ struct smbus_bus_operations { - int (*quick_read) (device_t dev); - int (*quick_write) (device_t dev); - int (*recv_byte) (device_t dev); - int (*send_byte) (device_t dev, u8 value); - int (*read_byte) (device_t dev, u8 addr); - int (*write_byte) (device_t dev, u8 addr, u8 value); - int (*read_word) (device_t dev, u8 addr); - int (*write_word) (device_t dev, u8 addr, u16 value); - int (*process_call)(device_t dev, u8 cmd, u16 data); - int (*block_read) (device_t dev, u8 cmd, u8 bytes, u8 *buffer); - int (*block_write) (device_t dev, u8 cmd, u8 bytes, const u8 *buffer); + int (*quick_read) (struct device *dev); + int (*quick_write) (struct device *dev); + int (*recv_byte) (struct device *dev); + int (*send_byte) (struct device *dev, u8 value); + int (*read_byte) (struct device *dev, u8 addr); + int (*write_byte) (struct device *dev, u8 addr, u8 value); + int (*read_word) (struct device *dev, u8 addr); + int (*write_word) (struct device *dev, u8 addr, u16 value); + int (*process_call)(struct device *dev, u8 cmd, u16 data); + int (*block_read) (struct device *dev, u8 cmd, u8 bytes, u8 *buffer); + int (*block_write) (struct device *dev, u8 cmd, u8 bytes, const u8 *buffer); };
static inline const struct smbus_bus_operations *ops_smbus_bus(struct bus *bus) @@ -32,19 +32,19 @@ static inline const struct smbus_bus_operations *ops_smbus_bus(struct bus *bus) return bops; }
-struct bus *get_pbus_smbus(device_t dev); -int smbus_set_link(device_t dev); - -int smbus_quick_read(device_t dev); -int smbus_quick_write(device_t dev); -int smbus_recv_byte(device_t dev); -int smbus_send_byte(device_t dev, u8 byte); -int smbus_read_byte(device_t dev, u8 addr); -int smbus_write_byte(device_t dev, u8 addr, u8 val); -int smbus_read_word(device_t dev, u8 addr); -int smbus_write_word(device_t dev, u8 addr, u16 val); -int smbus_process_call(device_t dev, u8 cmd, u16 data); -int smbus_block_read(device_t dev, u8 cmd, u8 bytes, u8 *buffer); -int smbus_block_write(device_t dev, u8 cmd, u8 bytes, const u8 *buffer); - -#endif /* DEVICE_SMBUS_H */ +struct bus *get_pbus_smbus(struct device *dev); +int smbus_set_link(struct device *dev); + +int smbus_quick_read(struct device *dev); +int smbus_quick_write(struct device *dev); +int smbus_recv_byte(struct device *dev); +int smbus_send_byte(struct device *dev, u8 byte); +int smbus_read_byte(struct device *dev, u8 addr); +int smbus_write_byte(struct device *dev, u8 addr, u8 val); +int smbus_read_word(struct device *dev, u8 addr); +int smbus_write_word(struct device *dev, u8 addr, u16 val); +int smbus_process_call(struct device *dev, u8 cmd, u16 data); +int smbus_block_read(struct device *dev, u8 cmd, u8 bytes, u8 *buffer); +int smbus_block_write(struct device *dev, u8 cmd, u8 bytes, const u8 *buffer); + +#endif /*devICE_SMBUS_H */ diff --git a/src/include/reg_script.h b/src/include/reg_script.h index 97b4fb0..71be7c2 100644 --- a/src/include/reg_script.h +++ b/src/include/reg_script.h @@ -34,7 +34,7 @@ * are employed: * - Chaining of tables that allow runtime tables to chain to compile-time * tables. - * - Notion of current device (device_t) being worked on. This allows for + * - Notion of current device (struct device *) being worked on. This allows for * PCI config, io, and mmio on a particular device's resources. * * Note that when using REG_SCRIPT_COMMAND_NEXT there is an implicit push @@ -80,7 +80,7 @@ struct reg_script { union { uint32_t id; const struct reg_script *next; - device_t dev; + struct device *dev; unsigned int res_index; }; }; @@ -334,6 +334,6 @@ struct reg_script { _REG_SCRIPT_ENCODE_RAW(REG_SCRIPT_COMMAND_END, 0, 0, 0, 0, 0, 0, 0)
void reg_script_run(const struct reg_script *script); -void reg_script_run_on_dev(device_t dev, const struct reg_script *step); +void reg_script_run_on_dev(struct device *dev, const struct reg_script *step);
#endif /* REG_SCRIPT_H */