diff options
author | Bogicevic Sasa <brutallesale@gmail.com> | 2015-12-27 16:21:11 -0500 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2016-01-08 11:35:24 -0500 |
commit | ff3ce480e8b59fbc0f459476fe1b5451464592a5 (patch) | |
tree | 46500e2528f05508dd8923306368df2855680491 /drivers/pci | |
parent | 1d1e8cdc823b9c0ed9b51dffef59b874b0aac808 (diff) |
PCI: Fix all whitespace issues
Fix all whitespace issues (missing or needed whitespace) in all files in
drivers/pci. Code is compiled with allyesconfig before and after code
changes and objects are recorded and checked with objdiff and they are not
changed after this commit.
Signed-off-by: Bogicevic Sasa <brutallesale@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci')
39 files changed, 1432 insertions, 1432 deletions
diff --git a/drivers/pci/access.c b/drivers/pci/access.c index 59ac36fe7c42..8c05b5ceeaec 100644 --- a/drivers/pci/access.c +++ b/drivers/pci/access.c | |||
@@ -25,7 +25,7 @@ DEFINE_RAW_SPINLOCK(pci_lock); | |||
25 | #define PCI_word_BAD (pos & 1) | 25 | #define PCI_word_BAD (pos & 1) |
26 | #define PCI_dword_BAD (pos & 3) | 26 | #define PCI_dword_BAD (pos & 3) |
27 | 27 | ||
28 | #define PCI_OP_READ(size,type,len) \ | 28 | #define PCI_OP_READ(size, type, len) \ |
29 | int pci_bus_read_config_##size \ | 29 | int pci_bus_read_config_##size \ |
30 | (struct pci_bus *bus, unsigned int devfn, int pos, type *value) \ | 30 | (struct pci_bus *bus, unsigned int devfn, int pos, type *value) \ |
31 | { \ | 31 | { \ |
@@ -40,7 +40,7 @@ int pci_bus_read_config_##size \ | |||
40 | return res; \ | 40 | return res; \ |
41 | } | 41 | } |
42 | 42 | ||
43 | #define PCI_OP_WRITE(size,type,len) \ | 43 | #define PCI_OP_WRITE(size, type, len) \ |
44 | int pci_bus_write_config_##size \ | 44 | int pci_bus_write_config_##size \ |
45 | (struct pci_bus *bus, unsigned int devfn, int pos, type value) \ | 45 | (struct pci_bus *bus, unsigned int devfn, int pos, type value) \ |
46 | { \ | 46 | { \ |
@@ -231,7 +231,7 @@ static noinline void pci_wait_cfg(struct pci_dev *dev) | |||
231 | } | 231 | } |
232 | 232 | ||
233 | /* Returns 0 on success, negative values indicate error. */ | 233 | /* Returns 0 on success, negative values indicate error. */ |
234 | #define PCI_USER_READ_CONFIG(size,type) \ | 234 | #define PCI_USER_READ_CONFIG(size, type) \ |
235 | int pci_user_read_config_##size \ | 235 | int pci_user_read_config_##size \ |
236 | (struct pci_dev *dev, int pos, type *val) \ | 236 | (struct pci_dev *dev, int pos, type *val) \ |
237 | { \ | 237 | { \ |
@@ -251,7 +251,7 @@ int pci_user_read_config_##size \ | |||
251 | EXPORT_SYMBOL_GPL(pci_user_read_config_##size); | 251 | EXPORT_SYMBOL_GPL(pci_user_read_config_##size); |
252 | 252 | ||
253 | /* Returns 0 on success, negative values indicate error. */ | 253 | /* Returns 0 on success, negative values indicate error. */ |
254 | #define PCI_USER_WRITE_CONFIG(size,type) \ | 254 | #define PCI_USER_WRITE_CONFIG(size, type) \ |
255 | int pci_user_write_config_##size \ | 255 | int pci_user_write_config_##size \ |
256 | (struct pci_dev *dev, int pos, type val) \ | 256 | (struct pci_dev *dev, int pos, type val) \ |
257 | { \ | 257 | { \ |
diff --git a/drivers/pci/host/pci-imx6.c b/drivers/pci/host/pci-imx6.c index 22e8224126fd..2dd018cffc57 100644 --- a/drivers/pci/host/pci-imx6.c +++ b/drivers/pci/host/pci-imx6.c | |||
@@ -122,7 +122,7 @@ static int pcie_phy_wait_ack(void __iomem *dbi_base, int addr) | |||
122 | } | 122 | } |
123 | 123 | ||
124 | /* Read from the 16-bit PCIe PHY control registers (not memory-mapped) */ | 124 | /* Read from the 16-bit PCIe PHY control registers (not memory-mapped) */ |
125 | static int pcie_phy_read(void __iomem *dbi_base, int addr , int *data) | 125 | static int pcie_phy_read(void __iomem *dbi_base, int addr, int *data) |
126 | { | 126 | { |
127 | u32 val, phy_ctl; | 127 | u32 val, phy_ctl; |
128 | int ret; | 128 | int ret; |
diff --git a/drivers/pci/hotplug/acpi_pcihp.c b/drivers/pci/hotplug/acpi_pcihp.c index 876ccc620440..a5e66df4ad14 100644 --- a/drivers/pci/hotplug/acpi_pcihp.c +++ b/drivers/pci/hotplug/acpi_pcihp.c | |||
@@ -36,10 +36,10 @@ | |||
36 | 36 | ||
37 | #define MY_NAME "acpi_pcihp" | 37 | #define MY_NAME "acpi_pcihp" |
38 | 38 | ||
39 | #define dbg(fmt, arg...) do { if (debug_acpi) printk(KERN_DEBUG "%s: %s: " fmt , MY_NAME , __func__ , ## arg); } while (0) | 39 | #define dbg(fmt, arg...) do { if (debug_acpi) printk(KERN_DEBUG "%s: %s: " fmt, MY_NAME, __func__, ## arg); } while (0) |
40 | #define err(format, arg...) printk(KERN_ERR "%s: " format , MY_NAME , ## arg) | 40 | #define err(format, arg...) printk(KERN_ERR "%s: " format, MY_NAME, ## arg) |
41 | #define info(format, arg...) printk(KERN_INFO "%s: " format , MY_NAME , ## arg) | 41 | #define info(format, arg...) printk(KERN_INFO "%s: " format, MY_NAME, ## arg) |
42 | #define warn(format, arg...) printk(KERN_WARNING "%s: " format , MY_NAME , ## arg) | 42 | #define warn(format, arg...) printk(KERN_WARNING "%s: " format, MY_NAME, ## arg) |
43 | 43 | ||
44 | #define METHOD_NAME__SUN "_SUN" | 44 | #define METHOD_NAME__SUN "_SUN" |
45 | #define METHOD_NAME_OSHP "OSHP" | 45 | #define METHOD_NAME_OSHP "OSHP" |
@@ -132,7 +132,7 @@ int acpi_get_hp_hw_control_from_firmware(struct pci_dev *pdev, u32 flags) | |||
132 | 132 | ||
133 | while (handle) { | 133 | while (handle) { |
134 | acpi_get_name(handle, ACPI_FULL_PATHNAME, &string); | 134 | acpi_get_name(handle, ACPI_FULL_PATHNAME, &string); |
135 | dbg("Trying to get hotplug control for %s \n", | 135 | dbg("Trying to get hotplug control for %s\n", |
136 | (char *)string.pointer); | 136 | (char *)string.pointer); |
137 | status = acpi_run_oshp(handle); | 137 | status = acpi_run_oshp(handle); |
138 | if (ACPI_SUCCESS(status)) | 138 | if (ACPI_SUCCESS(status)) |
diff --git a/drivers/pci/hotplug/acpiphp.h b/drivers/pci/hotplug/acpiphp.h index b0e61bf261a7..f0ebc8b9a15a 100644 --- a/drivers/pci/hotplug/acpiphp.h +++ b/drivers/pci/hotplug/acpiphp.h | |||
@@ -181,7 +181,7 @@ struct acpiphp_attention_info | |||
181 | /* function prototypes */ | 181 | /* function prototypes */ |
182 | 182 | ||
183 | /* acpiphp_core.c */ | 183 | /* acpiphp_core.c */ |
184 | int acpiphp_register_attention(struct acpiphp_attention_info*info); | 184 | int acpiphp_register_attention(struct acpiphp_attention_info *info); |
185 | int acpiphp_unregister_attention(struct acpiphp_attention_info *info); | 185 | int acpiphp_unregister_attention(struct acpiphp_attention_info *info); |
186 | int acpiphp_register_hotplug_slot(struct acpiphp_slot *slot, unsigned int sun); | 186 | int acpiphp_register_hotplug_slot(struct acpiphp_slot *slot, unsigned int sun); |
187 | void acpiphp_unregister_hotplug_slot(struct acpiphp_slot *slot); | 187 | void acpiphp_unregister_hotplug_slot(struct acpiphp_slot *slot); |
diff --git a/drivers/pci/hotplug/acpiphp_core.c b/drivers/pci/hotplug/acpiphp_core.c index e291efcd02a2..3c81fc8b0103 100644 --- a/drivers/pci/hotplug/acpiphp_core.c +++ b/drivers/pci/hotplug/acpiphp_core.c | |||
@@ -63,13 +63,13 @@ MODULE_LICENSE("GPL"); | |||
63 | MODULE_PARM_DESC(disable, "disable acpiphp driver"); | 63 | MODULE_PARM_DESC(disable, "disable acpiphp driver"); |
64 | module_param_named(disable, acpiphp_disabled, bool, 0444); | 64 | module_param_named(disable, acpiphp_disabled, bool, 0444); |
65 | 65 | ||
66 | static int enable_slot (struct hotplug_slot *slot); | 66 | static int enable_slot(struct hotplug_slot *slot); |
67 | static int disable_slot (struct hotplug_slot *slot); | 67 | static int disable_slot(struct hotplug_slot *slot); |
68 | static int set_attention_status (struct hotplug_slot *slot, u8 value); | 68 | static int set_attention_status(struct hotplug_slot *slot, u8 value); |
69 | static int get_power_status (struct hotplug_slot *slot, u8 *value); | 69 | static int get_power_status(struct hotplug_slot *slot, u8 *value); |
70 | static int get_attention_status (struct hotplug_slot *slot, u8 *value); | 70 | static int get_attention_status(struct hotplug_slot *slot, u8 *value); |
71 | static int get_latch_status (struct hotplug_slot *slot, u8 *value); | 71 | static int get_latch_status(struct hotplug_slot *slot, u8 *value); |
72 | static int get_adapter_status (struct hotplug_slot *slot, u8 *value); | 72 | static int get_adapter_status(struct hotplug_slot *slot, u8 *value); |
73 | 73 | ||
74 | static struct hotplug_slot_ops acpi_hotplug_slot_ops = { | 74 | static struct hotplug_slot_ops acpi_hotplug_slot_ops = { |
75 | .enable_slot = enable_slot, | 75 | .enable_slot = enable_slot, |
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index ff538568a617..5f2fda12e006 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c | |||
@@ -707,7 +707,7 @@ static void acpiphp_sanitize_bus(struct pci_bus *bus) | |||
707 | unsigned long type_mask = IORESOURCE_IO | IORESOURCE_MEM; | 707 | unsigned long type_mask = IORESOURCE_IO | IORESOURCE_MEM; |
708 | 708 | ||
709 | list_for_each_entry_safe_reverse(dev, tmp, &bus->devices, bus_list) { | 709 | list_for_each_entry_safe_reverse(dev, tmp, &bus->devices, bus_list) { |
710 | for (i=0; i<PCI_BRIDGE_RESOURCES; i++) { | 710 | for (i = 0; i < PCI_BRIDGE_RESOURCES; i++) { |
711 | struct resource *res = &dev->resource[i]; | 711 | struct resource *res = &dev->resource[i]; |
712 | if ((res->flags & type_mask) && !res->start && | 712 | if ((res->flags & type_mask) && !res->start && |
713 | res->end) { | 713 | res->end) { |
diff --git a/drivers/pci/hotplug/acpiphp_ibm.c b/drivers/pci/hotplug/acpiphp_ibm.c index 6ca23998ee8f..a6145181500f 100644 --- a/drivers/pci/hotplug/acpiphp_ibm.c +++ b/drivers/pci/hotplug/acpiphp_ibm.c | |||
@@ -325,7 +325,7 @@ static int ibm_get_table_from_acpi(char **bufp) | |||
325 | } | 325 | } |
326 | 326 | ||
327 | size = 0; | 327 | size = 0; |
328 | for (i=0; i<package->package.count; i++) { | 328 | for (i = 0; i < package->package.count; i++) { |
329 | memcpy(&lbuf[size], | 329 | memcpy(&lbuf[size], |
330 | package->package.elements[i].buffer.pointer, | 330 | package->package.elements[i].buffer.pointer, |
331 | package->package.elements[i].buffer.length); | 331 | package->package.elements[i].buffer.length); |
diff --git a/drivers/pci/hotplug/cpci_hotplug.h b/drivers/pci/hotplug/cpci_hotplug.h index 6a0ddf757349..555bcde3b196 100644 --- a/drivers/pci/hotplug/cpci_hotplug.h +++ b/drivers/pci/hotplug/cpci_hotplug.h | |||
@@ -52,13 +52,13 @@ struct slot { | |||
52 | }; | 52 | }; |
53 | 53 | ||
54 | struct cpci_hp_controller_ops { | 54 | struct cpci_hp_controller_ops { |
55 | int (*query_enum) (void); | 55 | int (*query_enum)(void); |
56 | int (*enable_irq) (void); | 56 | int (*enable_irq)(void); |
57 | int (*disable_irq) (void); | 57 | int (*disable_irq)(void); |
58 | int (*check_irq) (void *dev_id); | 58 | int (*check_irq)(void *dev_id); |
59 | int (*hardware_test) (struct slot *slot, u32 value); | 59 | int (*hardware_test)(struct slot *slot, u32 value); |
60 | u8 (*get_power) (struct slot *slot); | 60 | u8 (*get_power)(struct slot *slot); |
61 | int (*set_power) (struct slot *slot, int value); | 61 | int (*set_power)(struct slot *slot, int value); |
62 | }; | 62 | }; |
63 | 63 | ||
64 | struct cpci_hp_controller { | 64 | struct cpci_hp_controller { |
diff --git a/drivers/pci/hotplug/cpci_hotplug_core.c b/drivers/pci/hotplug/cpci_hotplug_core.c index 46db29395a62..7d3866c47312 100644 --- a/drivers/pci/hotplug/cpci_hotplug_core.c +++ b/drivers/pci/hotplug/cpci_hotplug_core.c | |||
@@ -45,12 +45,12 @@ | |||
45 | #define dbg(format, arg...) \ | 45 | #define dbg(format, arg...) \ |
46 | do { \ | 46 | do { \ |
47 | if (cpci_debug) \ | 47 | if (cpci_debug) \ |
48 | printk (KERN_DEBUG "%s: " format "\n", \ | 48 | printk(KERN_DEBUG "%s: " format "\n", \ |
49 | MY_NAME , ## arg); \ | 49 | MY_NAME, ## arg); \ |
50 | } while (0) | 50 | } while (0) |
51 | #define err(format, arg...) printk(KERN_ERR "%s: " format "\n", MY_NAME , ## arg) | 51 | #define err(format, arg...) printk(KERN_ERR "%s: " format "\n", MY_NAME, ## arg) |
52 | #define info(format, arg...) printk(KERN_INFO "%s: " format "\n", MY_NAME , ## arg) | 52 | #define info(format, arg...) printk(KERN_INFO "%s: " format "\n", MY_NAME, ## arg) |
53 | #define warn(format, arg...) printk(KERN_WARNING "%s: " format "\n", MY_NAME , ## arg) | 53 | #define warn(format, arg...) printk(KERN_WARNING "%s: " format "\n", MY_NAME, ## arg) |
54 | 54 | ||
55 | /* local variables */ | 55 | /* local variables */ |
56 | static DECLARE_RWSEM(list_rwsem); | 56 | static DECLARE_RWSEM(list_rwsem); |
@@ -238,21 +238,21 @@ cpci_hp_register_bus(struct pci_bus *bus, u8 first, u8 last) | |||
238 | * with the pci_hotplug subsystem. | 238 | * with the pci_hotplug subsystem. |
239 | */ | 239 | */ |
240 | for (i = first; i <= last; ++i) { | 240 | for (i = first; i <= last; ++i) { |
241 | slot = kzalloc(sizeof (struct slot), GFP_KERNEL); | 241 | slot = kzalloc(sizeof(struct slot), GFP_KERNEL); |
242 | if (!slot) { | 242 | if (!slot) { |
243 | status = -ENOMEM; | 243 | status = -ENOMEM; |
244 | goto error; | 244 | goto error; |
245 | } | 245 | } |
246 | 246 | ||
247 | hotplug_slot = | 247 | hotplug_slot = |
248 | kzalloc(sizeof (struct hotplug_slot), GFP_KERNEL); | 248 | kzalloc(sizeof(struct hotplug_slot), GFP_KERNEL); |
249 | if (!hotplug_slot) { | 249 | if (!hotplug_slot) { |
250 | status = -ENOMEM; | 250 | status = -ENOMEM; |
251 | goto error_slot; | 251 | goto error_slot; |
252 | } | 252 | } |
253 | slot->hotplug_slot = hotplug_slot; | 253 | slot->hotplug_slot = hotplug_slot; |
254 | 254 | ||
255 | info = kzalloc(sizeof (struct hotplug_slot_info), GFP_KERNEL); | 255 | info = kzalloc(sizeof(struct hotplug_slot_info), GFP_KERNEL); |
256 | if (!info) { | 256 | if (!info) { |
257 | status = -ENOMEM; | 257 | status = -ENOMEM; |
258 | goto error_hpslot; | 258 | goto error_hpslot; |
diff --git a/drivers/pci/hotplug/cpci_hotplug_pci.c b/drivers/pci/hotplug/cpci_hotplug_pci.c index 788db48dbbad..80c80017197d 100644 --- a/drivers/pci/hotplug/cpci_hotplug_pci.c +++ b/drivers/pci/hotplug/cpci_hotplug_pci.c | |||
@@ -38,12 +38,12 @@ extern int cpci_debug; | |||
38 | #define dbg(format, arg...) \ | 38 | #define dbg(format, arg...) \ |
39 | do { \ | 39 | do { \ |
40 | if (cpci_debug) \ | 40 | if (cpci_debug) \ |
41 | printk (KERN_DEBUG "%s: " format "\n", \ | 41 | printk(KERN_DEBUG "%s: " format "\n", \ |
42 | MY_NAME , ## arg); \ | 42 | MY_NAME, ## arg); \ |
43 | } while (0) | 43 | } while (0) |
44 | #define err(format, arg...) printk(KERN_ERR "%s: " format "\n", MY_NAME , ## arg) | 44 | #define err(format, arg...) printk(KERN_ERR "%s: " format "\n", MY_NAME, ## arg) |
45 | #define info(format, arg...) printk(KERN_INFO "%s: " format "\n", MY_NAME , ## arg) | 45 | #define info(format, arg...) printk(KERN_INFO "%s: " format "\n", MY_NAME, ## arg) |
46 | #define warn(format, arg...) printk(KERN_WARNING "%s: " format "\n", MY_NAME , ## arg) | 46 | #define warn(format, arg...) printk(KERN_WARNING "%s: " format "\n", MY_NAME, ## arg) |
47 | 47 | ||
48 | 48 | ||
49 | u8 cpci_get_attention_status(struct slot *slot) | 49 | u8 cpci_get_attention_status(struct slot *slot) |
diff --git a/drivers/pci/hotplug/cpcihp_generic.c b/drivers/pci/hotplug/cpcihp_generic.c index 66b7bbebe493..88a44a707b96 100644 --- a/drivers/pci/hotplug/cpcihp_generic.c +++ b/drivers/pci/hotplug/cpcihp_generic.c | |||
@@ -54,12 +54,12 @@ | |||
54 | #define dbg(format, arg...) \ | 54 | #define dbg(format, arg...) \ |
55 | do { \ | 55 | do { \ |
56 | if (debug) \ | 56 | if (debug) \ |
57 | printk (KERN_DEBUG "%s: " format "\n", \ | 57 | printk(KERN_DEBUG "%s: " format "\n", \ |
58 | MY_NAME , ## arg); \ | 58 | MY_NAME, ## arg); \ |
59 | } while (0) | 59 | } while (0) |
60 | #define err(format, arg...) printk(KERN_ERR "%s: " format "\n", MY_NAME , ## arg) | 60 | #define err(format, arg...) printk(KERN_ERR "%s: " format "\n", MY_NAME, ## arg) |
61 | #define info(format, arg...) printk(KERN_INFO "%s: " format "\n", MY_NAME , ## arg) | 61 | #define info(format, arg...) printk(KERN_INFO "%s: " format "\n", MY_NAME, ## arg) |
62 | #define warn(format, arg...) printk(KERN_WARNING "%s: " format "\n", MY_NAME , ## arg) | 62 | #define warn(format, arg...) printk(KERN_WARNING "%s: " format "\n", MY_NAME, ## arg) |
63 | 63 | ||
64 | /* local variables */ | 64 | /* local variables */ |
65 | static bool debug; | 65 | static bool debug; |
@@ -164,7 +164,7 @@ static int __init cpcihp_generic_init(void) | |||
164 | bus = dev->subordinate; | 164 | bus = dev->subordinate; |
165 | pci_dev_put(dev); | 165 | pci_dev_put(dev); |
166 | 166 | ||
167 | memset(&generic_hpc, 0, sizeof (struct cpci_hp_controller)); | 167 | memset(&generic_hpc, 0, sizeof(struct cpci_hp_controller)); |
168 | generic_hpc_ops.query_enum = query_enum; | 168 | generic_hpc_ops.query_enum = query_enum; |
169 | generic_hpc.ops = &generic_hpc_ops; | 169 | generic_hpc.ops = &generic_hpc_ops; |
170 | 170 | ||
diff --git a/drivers/pci/hotplug/cpcihp_zt5550.c b/drivers/pci/hotplug/cpcihp_zt5550.c index 7ecf34e76a61..5f49c3fd736a 100644 --- a/drivers/pci/hotplug/cpcihp_zt5550.c +++ b/drivers/pci/hotplug/cpcihp_zt5550.c | |||
@@ -49,12 +49,12 @@ | |||
49 | #define dbg(format, arg...) \ | 49 | #define dbg(format, arg...) \ |
50 | do { \ | 50 | do { \ |
51 | if (debug) \ | 51 | if (debug) \ |
52 | printk (KERN_DEBUG "%s: " format "\n", \ | 52 | printk(KERN_DEBUG "%s: " format "\n", \ |
53 | MY_NAME , ## arg); \ | 53 | MY_NAME, ## arg); \ |
54 | } while (0) | 54 | } while (0) |
55 | #define err(format, arg...) printk(KERN_ERR "%s: " format "\n", MY_NAME , ## arg) | 55 | #define err(format, arg...) printk(KERN_ERR "%s: " format "\n", MY_NAME, ## arg) |
56 | #define info(format, arg...) printk(KERN_INFO "%s: " format "\n", MY_NAME , ## arg) | 56 | #define info(format, arg...) printk(KERN_INFO "%s: " format "\n", MY_NAME, ## arg) |
57 | #define warn(format, arg...) printk(KERN_WARNING "%s: " format "\n", MY_NAME , ## arg) | 57 | #define warn(format, arg...) printk(KERN_WARNING "%s: " format "\n", MY_NAME, ## arg) |
58 | 58 | ||
59 | /* local variables */ | 59 | /* local variables */ |
60 | static bool debug; | 60 | static bool debug; |
@@ -204,7 +204,7 @@ static int zt5550_hc_disable_irq(void) | |||
204 | return 0; | 204 | return 0; |
205 | } | 205 | } |
206 | 206 | ||
207 | static int zt5550_hc_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | 207 | static int zt5550_hc_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) |
208 | { | 208 | { |
209 | int status; | 209 | int status; |
210 | 210 | ||
@@ -214,7 +214,7 @@ static int zt5550_hc_init_one (struct pci_dev *pdev, const struct pci_device_id | |||
214 | 214 | ||
215 | dbg("returned from zt5550_hc_config"); | 215 | dbg("returned from zt5550_hc_config"); |
216 | 216 | ||
217 | memset(&zt5550_hpc, 0, sizeof (struct cpci_hp_controller)); | 217 | memset(&zt5550_hpc, 0, sizeof(struct cpci_hp_controller)); |
218 | zt5550_hpc_ops.query_enum = zt5550_hc_query_enum; | 218 | zt5550_hpc_ops.query_enum = zt5550_hc_query_enum; |
219 | zt5550_hpc.ops = &zt5550_hpc_ops; | 219 | zt5550_hpc.ops = &zt5550_hpc_ops; |
220 | if (!poll) { | 220 | if (!poll) { |
diff --git a/drivers/pci/hotplug/cpqphp.h b/drivers/pci/hotplug/cpqphp.h index b28b2d2184cd..9103a7b9f3b9 100644 --- a/drivers/pci/hotplug/cpqphp.h +++ b/drivers/pci/hotplug/cpqphp.h | |||
@@ -36,10 +36,10 @@ | |||
36 | 36 | ||
37 | #define MY_NAME "cpqphp" | 37 | #define MY_NAME "cpqphp" |
38 | 38 | ||
39 | #define dbg(fmt, arg...) do { if (cpqhp_debug) printk(KERN_DEBUG "%s: " fmt , MY_NAME , ## arg); } while (0) | 39 | #define dbg(fmt, arg...) do { if (cpqhp_debug) printk(KERN_DEBUG "%s: " fmt, MY_NAME, ## arg); } while (0) |
40 | #define err(format, arg...) printk(KERN_ERR "%s: " format , MY_NAME , ## arg) | 40 | #define err(format, arg...) printk(KERN_ERR "%s: " format, MY_NAME, ## arg) |
41 | #define info(format, arg...) printk(KERN_INFO "%s: " format , MY_NAME , ## arg) | 41 | #define info(format, arg...) printk(KERN_INFO "%s: " format, MY_NAME, ## arg) |
42 | #define warn(format, arg...) printk(KERN_WARNING "%s: " format , MY_NAME , ## arg) | 42 | #define warn(format, arg...) printk(KERN_WARNING "%s: " format, MY_NAME, ## arg) |
43 | 43 | ||
44 | 44 | ||
45 | 45 | ||
@@ -424,7 +424,7 @@ int cpqhp_process_SS(struct controller *ctrl, struct pci_func *func); | |||
424 | int cpqhp_hardware_test(struct controller *ctrl, int test_num); | 424 | int cpqhp_hardware_test(struct controller *ctrl, int test_num); |
425 | 425 | ||
426 | /* resource functions */ | 426 | /* resource functions */ |
427 | int cpqhp_resource_sort_and_combine (struct pci_resource **head); | 427 | int cpqhp_resource_sort_and_combine(struct pci_resource **head); |
428 | 428 | ||
429 | /* pci functions */ | 429 | /* pci functions */ |
430 | int cpqhp_set_irq(u8 bus_num, u8 dev_num, u8 int_pin, u8 irq_num); | 430 | int cpqhp_set_irq(u8 bus_num, u8 dev_num, u8 int_pin, u8 irq_num); |
@@ -685,7 +685,7 @@ static inline int cpq_get_latch_status(struct controller *ctrl, | |||
685 | u8 hp_slot; | 685 | u8 hp_slot; |
686 | 686 | ||
687 | hp_slot = slot->device - ctrl->slot_device_offset; | 687 | hp_slot = slot->device - ctrl->slot_device_offset; |
688 | dbg("%s: slot->device = %d, ctrl->slot_device_offset = %d \n", | 688 | dbg("%s: slot->device = %d, ctrl->slot_device_offset = %d\n", |
689 | __func__, slot->device, ctrl->slot_device_offset); | 689 | __func__, slot->device, ctrl->slot_device_offset); |
690 | 690 | ||
691 | status = (readl(ctrl->hpc_reg + INT_INPUT_CLEAR) & (0x01L << hp_slot)); | 691 | status = (readl(ctrl->hpc_reg + INT_INPUT_CLEAR) & (0x01L << hp_slot)); |
@@ -712,7 +712,7 @@ static inline int get_presence_status(struct controller *ctrl, | |||
712 | 712 | ||
713 | static inline int wait_for_ctrl_irq(struct controller *ctrl) | 713 | static inline int wait_for_ctrl_irq(struct controller *ctrl) |
714 | { | 714 | { |
715 | DECLARE_WAITQUEUE(wait, current); | 715 | DECLARE_WAITQUEUE(wait, current); |
716 | int retval = 0; | 716 | int retval = 0; |
717 | 717 | ||
718 | dbg("%s - start\n", __func__); | 718 | dbg("%s - start\n", __func__); |
diff --git a/drivers/pci/hotplug/cpqphp_core.c b/drivers/pci/hotplug/cpqphp_core.c index a53084ddc118..74f3a0695b43 100644 --- a/drivers/pci/hotplug/cpqphp_core.c +++ b/drivers/pci/hotplug/cpqphp_core.c | |||
@@ -291,7 +291,7 @@ static void release_slot(struct hotplug_slot *hotplug_slot) | |||
291 | kfree(slot); | 291 | kfree(slot); |
292 | } | 292 | } |
293 | 293 | ||
294 | static int ctrl_slot_cleanup (struct controller *ctrl) | 294 | static int ctrl_slot_cleanup(struct controller *ctrl) |
295 | { | 295 | { |
296 | struct slot *old_slot, *next_slot; | 296 | struct slot *old_slot, *next_slot; |
297 | 297 | ||
@@ -301,7 +301,7 @@ static int ctrl_slot_cleanup (struct controller *ctrl) | |||
301 | while (old_slot) { | 301 | while (old_slot) { |
302 | /* memory will be freed by the release_slot callback */ | 302 | /* memory will be freed by the release_slot callback */ |
303 | next_slot = old_slot->next; | 303 | next_slot = old_slot->next; |
304 | pci_hp_deregister (old_slot->hotplug_slot); | 304 | pci_hp_deregister(old_slot->hotplug_slot); |
305 | old_slot = next_slot; | 305 | old_slot = next_slot; |
306 | } | 306 | } |
307 | 307 | ||
@@ -413,9 +413,9 @@ cpqhp_set_attention_status(struct controller *ctrl, struct pci_func *func, | |||
413 | mutex_lock(&ctrl->crit_sect); | 413 | mutex_lock(&ctrl->crit_sect); |
414 | 414 | ||
415 | if (status == 1) | 415 | if (status == 1) |
416 | amber_LED_on (ctrl, hp_slot); | 416 | amber_LED_on(ctrl, hp_slot); |
417 | else if (status == 0) | 417 | else if (status == 0) |
418 | amber_LED_off (ctrl, hp_slot); | 418 | amber_LED_off(ctrl, hp_slot); |
419 | else { | 419 | else { |
420 | /* Done with exclusive hardware access */ | 420 | /* Done with exclusive hardware access */ |
421 | mutex_unlock(&ctrl->crit_sect); | 421 | mutex_unlock(&ctrl->crit_sect); |
@@ -425,7 +425,7 @@ cpqhp_set_attention_status(struct controller *ctrl, struct pci_func *func, | |||
425 | set_SOGO(ctrl); | 425 | set_SOGO(ctrl); |
426 | 426 | ||
427 | /* Wait for SOBS to be unset */ | 427 | /* Wait for SOBS to be unset */ |
428 | wait_for_ctrl_irq (ctrl); | 428 | wait_for_ctrl_irq(ctrl); |
429 | 429 | ||
430 | /* Done with exclusive hardware access */ | 430 | /* Done with exclusive hardware access */ |
431 | mutex_unlock(&ctrl->crit_sect); | 431 | mutex_unlock(&ctrl->crit_sect); |
@@ -439,7 +439,7 @@ cpqhp_set_attention_status(struct controller *ctrl, struct pci_func *func, | |||
439 | * @hotplug_slot: slot to change LED on | 439 | * @hotplug_slot: slot to change LED on |
440 | * @status: LED control flag | 440 | * @status: LED control flag |
441 | */ | 441 | */ |
442 | static int set_attention_status (struct hotplug_slot *hotplug_slot, u8 status) | 442 | static int set_attention_status(struct hotplug_slot *hotplug_slot, u8 status) |
443 | { | 443 | { |
444 | struct pci_func *slot_func; | 444 | struct pci_func *slot_func; |
445 | struct slot *slot = hotplug_slot->private; | 445 | struct slot *slot = hotplug_slot->private; |
@@ -610,7 +610,7 @@ static int ctrl_slot_setup(struct controller *ctrl, | |||
610 | u8 ctrl_slot; | 610 | u8 ctrl_slot; |
611 | u32 tempdword; | 611 | u32 tempdword; |
612 | char name[SLOT_NAME_SIZE]; | 612 | char name[SLOT_NAME_SIZE]; |
613 | void __iomem *slot_entry= NULL; | 613 | void __iomem *slot_entry = NULL; |
614 | int result; | 614 | int result; |
615 | 615 | ||
616 | dbg("%s\n", __func__); | 616 | dbg("%s\n", __func__); |
@@ -755,7 +755,7 @@ static int one_time_init(void) | |||
755 | if (cpqhp_debug) | 755 | if (cpqhp_debug) |
756 | pci_print_IRQ_route(); | 756 | pci_print_IRQ_route(); |
757 | 757 | ||
758 | dbg("Initialize + Start the notification mechanism \n"); | 758 | dbg("Initialize + Start the notification mechanism\n"); |
759 | 759 | ||
760 | retval = cpqhp_event_start_thread(); | 760 | retval = cpqhp_event_start_thread(); |
761 | if (retval) | 761 | if (retval) |
@@ -772,7 +772,7 @@ static int one_time_init(void) | |||
772 | /* Map rom address */ | 772 | /* Map rom address */ |
773 | cpqhp_rom_start = ioremap(ROM_PHY_ADDR, ROM_PHY_LEN); | 773 | cpqhp_rom_start = ioremap(ROM_PHY_ADDR, ROM_PHY_LEN); |
774 | if (!cpqhp_rom_start) { | 774 | if (!cpqhp_rom_start) { |
775 | err ("Could not ioremap memory region for ROM\n"); | 775 | err("Could not ioremap memory region for ROM\n"); |
776 | retval = -EIO; | 776 | retval = -EIO; |
777 | goto error; | 777 | goto error; |
778 | } | 778 | } |
@@ -786,7 +786,7 @@ static int one_time_init(void) | |||
786 | smbios_table = detect_SMBIOS_pointer(cpqhp_rom_start, | 786 | smbios_table = detect_SMBIOS_pointer(cpqhp_rom_start, |
787 | cpqhp_rom_start + ROM_PHY_LEN); | 787 | cpqhp_rom_start + ROM_PHY_LEN); |
788 | if (!smbios_table) { | 788 | if (!smbios_table) { |
789 | err ("Could not find the SMBIOS pointer in memory\n"); | 789 | err("Could not find the SMBIOS pointer in memory\n"); |
790 | retval = -EIO; | 790 | retval = -EIO; |
791 | goto error_rom_start; | 791 | goto error_rom_start; |
792 | } | 792 | } |
@@ -794,7 +794,7 @@ static int one_time_init(void) | |||
794 | smbios_start = ioremap(readl(smbios_table + ST_ADDRESS), | 794 | smbios_start = ioremap(readl(smbios_table + ST_ADDRESS), |
795 | readw(smbios_table + ST_LENGTH)); | 795 | readw(smbios_table + ST_LENGTH)); |
796 | if (!smbios_start) { | 796 | if (!smbios_start) { |
797 | err ("Could not ioremap memory region taken from SMBIOS values\n"); | 797 | err("Could not ioremap memory region taken from SMBIOS values\n"); |
798 | retval = -EIO; | 798 | retval = -EIO; |
799 | goto error_smbios_start; | 799 | goto error_smbios_start; |
800 | } | 800 | } |
@@ -1181,7 +1181,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1181 | * Finish setting up the hot plug ctrl device | 1181 | * Finish setting up the hot plug ctrl device |
1182 | */ | 1182 | */ |
1183 | ctrl->slot_device_offset = readb(ctrl->hpc_reg + SLOT_MASK) >> 4; | 1183 | ctrl->slot_device_offset = readb(ctrl->hpc_reg + SLOT_MASK) >> 4; |
1184 | dbg("NumSlots %d \n", ctrl->slot_device_offset); | 1184 | dbg("NumSlots %d\n", ctrl->slot_device_offset); |
1185 | 1185 | ||
1186 | ctrl->next_event = 0; | 1186 | ctrl->next_event = 0; |
1187 | 1187 | ||
@@ -1198,7 +1198,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1198 | writel(0xFFFFFFFFL, ctrl->hpc_reg + INT_MASK); | 1198 | writel(0xFFFFFFFFL, ctrl->hpc_reg + INT_MASK); |
1199 | 1199 | ||
1200 | /* set up the interrupt */ | 1200 | /* set up the interrupt */ |
1201 | dbg("HPC interrupt = %d \n", ctrl->interrupt); | 1201 | dbg("HPC interrupt = %d\n", ctrl->interrupt); |
1202 | if (request_irq(ctrl->interrupt, cpqhp_ctrl_intr, | 1202 | if (request_irq(ctrl->interrupt, cpqhp_ctrl_intr, |
1203 | IRQF_SHARED, MY_NAME, ctrl)) { | 1203 | IRQF_SHARED, MY_NAME, ctrl)) { |
1204 | err("Can't get irq %d for the hotplug pci controller\n", | 1204 | err("Can't get irq %d for the hotplug pci controller\n", |
@@ -1321,7 +1321,7 @@ static void __exit unload_cpqphpd(void) | |||
1321 | while (ctrl) { | 1321 | while (ctrl) { |
1322 | if (ctrl->hpc_reg) { | 1322 | if (ctrl->hpc_reg) { |
1323 | u16 misc; | 1323 | u16 misc; |
1324 | rc = read_slot_enable (ctrl); | 1324 | rc = read_slot_enable(ctrl); |
1325 | 1325 | ||
1326 | writeb(0, ctrl->hpc_reg + SLOT_SERR); | 1326 | writeb(0, ctrl->hpc_reg + SLOT_SERR); |
1327 | writel(0xFFFFFFC0L | ~rc, ctrl->hpc_reg + INT_MASK); | 1327 | writel(0xFFFFFFC0L | ~rc, ctrl->hpc_reg + INT_MASK); |
@@ -1361,7 +1361,7 @@ static void __exit unload_cpqphpd(void) | |||
1361 | kfree(tres); | 1361 | kfree(tres); |
1362 | } | 1362 | } |
1363 | 1363 | ||
1364 | kfree (ctrl->pci_bus); | 1364 | kfree(ctrl->pci_bus); |
1365 | 1365 | ||
1366 | tctrl = ctrl; | 1366 | tctrl = ctrl; |
1367 | ctrl = ctrl->next; | 1367 | ctrl = ctrl->next; |
@@ -1446,7 +1446,7 @@ static int __init cpqhpc_init(void) | |||
1446 | 1446 | ||
1447 | cpqhp_debug = debug; | 1447 | cpqhp_debug = debug; |
1448 | 1448 | ||
1449 | info (DRIVER_DESC " version: " DRIVER_VERSION "\n"); | 1449 | info(DRIVER_DESC " version: " DRIVER_VERSION "\n"); |
1450 | cpqhp_initialize_debugfs(); | 1450 | cpqhp_initialize_debugfs(); |
1451 | result = pci_register_driver(&cpqhpc_driver); | 1451 | result = pci_register_driver(&cpqhpc_driver); |
1452 | dbg("pci_register_driver = %d\n", result); | 1452 | dbg("pci_register_driver = %d\n", result); |
diff --git a/drivers/pci/hotplug/cpqphp_ctrl.c b/drivers/pci/hotplug/cpqphp_ctrl.c index c5cbefee5236..a55653b54eed 100644 --- a/drivers/pci/hotplug/cpqphp_ctrl.c +++ b/drivers/pci/hotplug/cpqphp_ctrl.c | |||
@@ -155,7 +155,7 @@ static u8 handle_presence_change(u16 change, struct controller *ctrl) | |||
155 | * Presence Change | 155 | * Presence Change |
156 | */ | 156 | */ |
157 | dbg("cpqsbd: Presence/Notify input change.\n"); | 157 | dbg("cpqsbd: Presence/Notify input change.\n"); |
158 | dbg(" Changed bits are 0x%4.4x\n", change ); | 158 | dbg(" Changed bits are 0x%4.4x\n", change); |
159 | 159 | ||
160 | for (hp_slot = 0; hp_slot < 6; hp_slot++) { | 160 | for (hp_slot = 0; hp_slot < 6; hp_slot++) { |
161 | if (change & (0x0101 << hp_slot)) { | 161 | if (change & (0x0101 << hp_slot)) { |
@@ -276,9 +276,9 @@ static u8 handle_power_fault(u8 change, struct controller *ctrl) | |||
276 | taskInfo->event_type = INT_POWER_FAULT; | 276 | taskInfo->event_type = INT_POWER_FAULT; |
277 | 277 | ||
278 | if (ctrl->rev < 4) { | 278 | if (ctrl->rev < 4) { |
279 | amber_LED_on (ctrl, hp_slot); | 279 | amber_LED_on(ctrl, hp_slot); |
280 | green_LED_off (ctrl, hp_slot); | 280 | green_LED_off(ctrl, hp_slot); |
281 | set_SOGO (ctrl); | 281 | set_SOGO(ctrl); |
282 | 282 | ||
283 | /* this is a fatal condition, we want | 283 | /* this is a fatal condition, we want |
284 | * to crash the machine to protect from | 284 | * to crash the machine to protect from |
@@ -438,7 +438,7 @@ static struct pci_resource *do_pre_bridge_resource_split(struct pci_resource **h | |||
438 | 438 | ||
439 | node = *head; | 439 | node = *head; |
440 | 440 | ||
441 | if (node->length & (alignment -1)) { | 441 | if (node->length & (alignment - 1)) { |
442 | /* this one isn't an aligned length, so we'll make a new entry | 442 | /* this one isn't an aligned length, so we'll make a new entry |
443 | * and split it up. | 443 | * and split it up. |
444 | */ | 444 | */ |
@@ -835,13 +835,13 @@ int cpqhp_resource_sort_and_combine(struct pci_resource **head) | |||
835 | if (!(*head)) | 835 | if (!(*head)) |
836 | return 1; | 836 | return 1; |
837 | 837 | ||
838 | dbg("*head->next = %p\n",(*head)->next); | 838 | dbg("*head->next = %p\n", (*head)->next); |
839 | 839 | ||
840 | if (!(*head)->next) | 840 | if (!(*head)->next) |
841 | return 0; /* only one item on the list, already sorted! */ | 841 | return 0; /* only one item on the list, already sorted! */ |
842 | 842 | ||
843 | dbg("*head->base = 0x%x\n",(*head)->base); | 843 | dbg("*head->base = 0x%x\n", (*head)->base); |
844 | dbg("*head->next->base = 0x%x\n",(*head)->next->base); | 844 | dbg("*head->next->base = 0x%x\n", (*head)->next->base); |
845 | while (out_of_order) { | 845 | while (out_of_order) { |
846 | out_of_order = 0; | 846 | out_of_order = 0; |
847 | 847 | ||
@@ -917,7 +917,7 @@ irqreturn_t cpqhp_ctrl_intr(int IRQ, void *data) | |||
917 | /* Read to clear posted writes */ | 917 | /* Read to clear posted writes */ |
918 | misc = readw(ctrl->hpc_reg + MISC); | 918 | misc = readw(ctrl->hpc_reg + MISC); |
919 | 919 | ||
920 | dbg ("%s - waking up\n", __func__); | 920 | dbg("%s - waking up\n", __func__); |
921 | wake_up_interruptible(&ctrl->queue); | 921 | wake_up_interruptible(&ctrl->queue); |
922 | } | 922 | } |
923 | 923 | ||
@@ -1285,18 +1285,18 @@ static u32 board_replaced(struct pci_func *func, struct controller *ctrl) | |||
1285 | /* | 1285 | /* |
1286 | * The board is already on | 1286 | * The board is already on |
1287 | */ | 1287 | */ |
1288 | else if (is_slot_enabled (ctrl, hp_slot)) | 1288 | else if (is_slot_enabled(ctrl, hp_slot)) |
1289 | rc = CARD_FUNCTIONING; | 1289 | rc = CARD_FUNCTIONING; |
1290 | else { | 1290 | else { |
1291 | mutex_lock(&ctrl->crit_sect); | 1291 | mutex_lock(&ctrl->crit_sect); |
1292 | 1292 | ||
1293 | /* turn on board without attaching to the bus */ | 1293 | /* turn on board without attaching to the bus */ |
1294 | enable_slot_power (ctrl, hp_slot); | 1294 | enable_slot_power(ctrl, hp_slot); |
1295 | 1295 | ||
1296 | set_SOGO(ctrl); | 1296 | set_SOGO(ctrl); |
1297 | 1297 | ||
1298 | /* Wait for SOBS to be unset */ | 1298 | /* Wait for SOBS to be unset */ |
1299 | wait_for_ctrl_irq (ctrl); | 1299 | wait_for_ctrl_irq(ctrl); |
1300 | 1300 | ||
1301 | /* Change bits in slot power register to force another shift out | 1301 | /* Change bits in slot power register to force another shift out |
1302 | * NOTE: this is to work around the timer bug */ | 1302 | * NOTE: this is to work around the timer bug */ |
@@ -1307,7 +1307,7 @@ static u32 board_replaced(struct pci_func *func, struct controller *ctrl) | |||
1307 | set_SOGO(ctrl); | 1307 | set_SOGO(ctrl); |
1308 | 1308 | ||
1309 | /* Wait for SOBS to be unset */ | 1309 | /* Wait for SOBS to be unset */ |
1310 | wait_for_ctrl_irq (ctrl); | 1310 | wait_for_ctrl_irq(ctrl); |
1311 | 1311 | ||
1312 | adapter_speed = get_adapter_speed(ctrl, hp_slot); | 1312 | adapter_speed = get_adapter_speed(ctrl, hp_slot); |
1313 | if (bus->cur_bus_speed != adapter_speed) | 1313 | if (bus->cur_bus_speed != adapter_speed) |
@@ -1315,12 +1315,12 @@ static u32 board_replaced(struct pci_func *func, struct controller *ctrl) | |||
1315 | rc = WRONG_BUS_FREQUENCY; | 1315 | rc = WRONG_BUS_FREQUENCY; |
1316 | 1316 | ||
1317 | /* turn off board without attaching to the bus */ | 1317 | /* turn off board without attaching to the bus */ |
1318 | disable_slot_power (ctrl, hp_slot); | 1318 | disable_slot_power(ctrl, hp_slot); |
1319 | 1319 | ||
1320 | set_SOGO(ctrl); | 1320 | set_SOGO(ctrl); |
1321 | 1321 | ||
1322 | /* Wait for SOBS to be unset */ | 1322 | /* Wait for SOBS to be unset */ |
1323 | wait_for_ctrl_irq (ctrl); | 1323 | wait_for_ctrl_irq(ctrl); |
1324 | 1324 | ||
1325 | mutex_unlock(&ctrl->crit_sect); | 1325 | mutex_unlock(&ctrl->crit_sect); |
1326 | 1326 | ||
@@ -1329,15 +1329,15 @@ static u32 board_replaced(struct pci_func *func, struct controller *ctrl) | |||
1329 | 1329 | ||
1330 | mutex_lock(&ctrl->crit_sect); | 1330 | mutex_lock(&ctrl->crit_sect); |
1331 | 1331 | ||
1332 | slot_enable (ctrl, hp_slot); | 1332 | slot_enable(ctrl, hp_slot); |
1333 | green_LED_blink (ctrl, hp_slot); | 1333 | green_LED_blink(ctrl, hp_slot); |
1334 | 1334 | ||
1335 | amber_LED_off (ctrl, hp_slot); | 1335 | amber_LED_off(ctrl, hp_slot); |
1336 | 1336 | ||
1337 | set_SOGO(ctrl); | 1337 | set_SOGO(ctrl); |
1338 | 1338 | ||
1339 | /* Wait for SOBS to be unset */ | 1339 | /* Wait for SOBS to be unset */ |
1340 | wait_for_ctrl_irq (ctrl); | 1340 | wait_for_ctrl_irq(ctrl); |
1341 | 1341 | ||
1342 | mutex_unlock(&ctrl->crit_sect); | 1342 | mutex_unlock(&ctrl->crit_sect); |
1343 | 1343 | ||
@@ -1366,14 +1366,14 @@ static u32 board_replaced(struct pci_func *func, struct controller *ctrl) | |||
1366 | 1366 | ||
1367 | mutex_lock(&ctrl->crit_sect); | 1367 | mutex_lock(&ctrl->crit_sect); |
1368 | 1368 | ||
1369 | amber_LED_on (ctrl, hp_slot); | 1369 | amber_LED_on(ctrl, hp_slot); |
1370 | green_LED_off (ctrl, hp_slot); | 1370 | green_LED_off(ctrl, hp_slot); |
1371 | slot_disable (ctrl, hp_slot); | 1371 | slot_disable(ctrl, hp_slot); |
1372 | 1372 | ||
1373 | set_SOGO(ctrl); | 1373 | set_SOGO(ctrl); |
1374 | 1374 | ||
1375 | /* Wait for SOBS to be unset */ | 1375 | /* Wait for SOBS to be unset */ |
1376 | wait_for_ctrl_irq (ctrl); | 1376 | wait_for_ctrl_irq(ctrl); |
1377 | 1377 | ||
1378 | mutex_unlock(&ctrl->crit_sect); | 1378 | mutex_unlock(&ctrl->crit_sect); |
1379 | 1379 | ||
@@ -1392,14 +1392,14 @@ static u32 board_replaced(struct pci_func *func, struct controller *ctrl) | |||
1392 | 1392 | ||
1393 | mutex_lock(&ctrl->crit_sect); | 1393 | mutex_lock(&ctrl->crit_sect); |
1394 | 1394 | ||
1395 | amber_LED_on (ctrl, hp_slot); | 1395 | amber_LED_on(ctrl, hp_slot); |
1396 | green_LED_off (ctrl, hp_slot); | 1396 | green_LED_off(ctrl, hp_slot); |
1397 | slot_disable (ctrl, hp_slot); | 1397 | slot_disable(ctrl, hp_slot); |
1398 | 1398 | ||
1399 | set_SOGO(ctrl); | 1399 | set_SOGO(ctrl); |
1400 | 1400 | ||
1401 | /* Wait for SOBS to be unset */ | 1401 | /* Wait for SOBS to be unset */ |
1402 | wait_for_ctrl_irq (ctrl); | 1402 | wait_for_ctrl_irq(ctrl); |
1403 | 1403 | ||
1404 | mutex_unlock(&ctrl->crit_sect); | 1404 | mutex_unlock(&ctrl->crit_sect); |
1405 | } | 1405 | } |
@@ -1443,7 +1443,7 @@ static u32 board_added(struct pci_func *func, struct controller *ctrl) | |||
1443 | set_SOGO(ctrl); | 1443 | set_SOGO(ctrl); |
1444 | 1444 | ||
1445 | /* Wait for SOBS to be unset */ | 1445 | /* Wait for SOBS to be unset */ |
1446 | wait_for_ctrl_irq (ctrl); | 1446 | wait_for_ctrl_irq(ctrl); |
1447 | 1447 | ||
1448 | /* Change bits in slot power register to force another shift out | 1448 | /* Change bits in slot power register to force another shift out |
1449 | * NOTE: this is to work around the timer bug | 1449 | * NOTE: this is to work around the timer bug |
@@ -1455,7 +1455,7 @@ static u32 board_added(struct pci_func *func, struct controller *ctrl) | |||
1455 | set_SOGO(ctrl); | 1455 | set_SOGO(ctrl); |
1456 | 1456 | ||
1457 | /* Wait for SOBS to be unset */ | 1457 | /* Wait for SOBS to be unset */ |
1458 | wait_for_ctrl_irq (ctrl); | 1458 | wait_for_ctrl_irq(ctrl); |
1459 | 1459 | ||
1460 | adapter_speed = get_adapter_speed(ctrl, hp_slot); | 1460 | adapter_speed = get_adapter_speed(ctrl, hp_slot); |
1461 | if (bus->cur_bus_speed != adapter_speed) | 1461 | if (bus->cur_bus_speed != adapter_speed) |
@@ -1463,7 +1463,7 @@ static u32 board_added(struct pci_func *func, struct controller *ctrl) | |||
1463 | rc = WRONG_BUS_FREQUENCY; | 1463 | rc = WRONG_BUS_FREQUENCY; |
1464 | 1464 | ||
1465 | /* turn off board without attaching to the bus */ | 1465 | /* turn off board without attaching to the bus */ |
1466 | disable_slot_power (ctrl, hp_slot); | 1466 | disable_slot_power(ctrl, hp_slot); |
1467 | 1467 | ||
1468 | set_SOGO(ctrl); | 1468 | set_SOGO(ctrl); |
1469 | 1469 | ||
@@ -1484,20 +1484,20 @@ static u32 board_added(struct pci_func *func, struct controller *ctrl) | |||
1484 | dbg("%s: after down\n", __func__); | 1484 | dbg("%s: after down\n", __func__); |
1485 | 1485 | ||
1486 | dbg("%s: before slot_enable\n", __func__); | 1486 | dbg("%s: before slot_enable\n", __func__); |
1487 | slot_enable (ctrl, hp_slot); | 1487 | slot_enable(ctrl, hp_slot); |
1488 | 1488 | ||
1489 | dbg("%s: before green_LED_blink\n", __func__); | 1489 | dbg("%s: before green_LED_blink\n", __func__); |
1490 | green_LED_blink (ctrl, hp_slot); | 1490 | green_LED_blink(ctrl, hp_slot); |
1491 | 1491 | ||
1492 | dbg("%s: before amber_LED_blink\n", __func__); | 1492 | dbg("%s: before amber_LED_blink\n", __func__); |
1493 | amber_LED_off (ctrl, hp_slot); | 1493 | amber_LED_off(ctrl, hp_slot); |
1494 | 1494 | ||
1495 | dbg("%s: before set_SOGO\n", __func__); | 1495 | dbg("%s: before set_SOGO\n", __func__); |
1496 | set_SOGO(ctrl); | 1496 | set_SOGO(ctrl); |
1497 | 1497 | ||
1498 | /* Wait for SOBS to be unset */ | 1498 | /* Wait for SOBS to be unset */ |
1499 | dbg("%s: before wait_for_ctrl_irq\n", __func__); | 1499 | dbg("%s: before wait_for_ctrl_irq\n", __func__); |
1500 | wait_for_ctrl_irq (ctrl); | 1500 | wait_for_ctrl_irq(ctrl); |
1501 | dbg("%s: after wait_for_ctrl_irq\n", __func__); | 1501 | dbg("%s: after wait_for_ctrl_irq\n", __func__); |
1502 | 1502 | ||
1503 | dbg("%s: before up\n", __func__); | 1503 | dbg("%s: before up\n", __func__); |
@@ -1520,7 +1520,7 @@ static u32 board_added(struct pci_func *func, struct controller *ctrl) | |||
1520 | } else { | 1520 | } else { |
1521 | /* Get vendor/device ID u32 */ | 1521 | /* Get vendor/device ID u32 */ |
1522 | ctrl->pci_bus->number = func->bus; | 1522 | ctrl->pci_bus->number = func->bus; |
1523 | rc = pci_bus_read_config_dword (ctrl->pci_bus, PCI_DEVFN(func->device, func->function), PCI_VENDOR_ID, &temp_register); | 1523 | rc = pci_bus_read_config_dword(ctrl->pci_bus, PCI_DEVFN(func->device, func->function), PCI_VENDOR_ID, &temp_register); |
1524 | dbg("%s: pci_read_config_dword returns %d\n", __func__, rc); | 1524 | dbg("%s: pci_read_config_dword returns %d\n", __func__, rc); |
1525 | dbg("%s: temp_register is %x\n", __func__, temp_register); | 1525 | dbg("%s: temp_register is %x\n", __func__, temp_register); |
1526 | 1526 | ||
@@ -1557,14 +1557,14 @@ static u32 board_added(struct pci_func *func, struct controller *ctrl) | |||
1557 | if (rc) { | 1557 | if (rc) { |
1558 | mutex_lock(&ctrl->crit_sect); | 1558 | mutex_lock(&ctrl->crit_sect); |
1559 | 1559 | ||
1560 | amber_LED_on (ctrl, hp_slot); | 1560 | amber_LED_on(ctrl, hp_slot); |
1561 | green_LED_off (ctrl, hp_slot); | 1561 | green_LED_off(ctrl, hp_slot); |
1562 | slot_disable (ctrl, hp_slot); | 1562 | slot_disable(ctrl, hp_slot); |
1563 | 1563 | ||
1564 | set_SOGO(ctrl); | 1564 | set_SOGO(ctrl); |
1565 | 1565 | ||
1566 | /* Wait for SOBS to be unset */ | 1566 | /* Wait for SOBS to be unset */ |
1567 | wait_for_ctrl_irq (ctrl); | 1567 | wait_for_ctrl_irq(ctrl); |
1568 | 1568 | ||
1569 | mutex_unlock(&ctrl->crit_sect); | 1569 | mutex_unlock(&ctrl->crit_sect); |
1570 | return rc; | 1570 | return rc; |
@@ -1589,25 +1589,25 @@ static u32 board_added(struct pci_func *func, struct controller *ctrl) | |||
1589 | 1589 | ||
1590 | mutex_lock(&ctrl->crit_sect); | 1590 | mutex_lock(&ctrl->crit_sect); |
1591 | 1591 | ||
1592 | green_LED_on (ctrl, hp_slot); | 1592 | green_LED_on(ctrl, hp_slot); |
1593 | 1593 | ||
1594 | set_SOGO(ctrl); | 1594 | set_SOGO(ctrl); |
1595 | 1595 | ||
1596 | /* Wait for SOBS to be unset */ | 1596 | /* Wait for SOBS to be unset */ |
1597 | wait_for_ctrl_irq (ctrl); | 1597 | wait_for_ctrl_irq(ctrl); |
1598 | 1598 | ||
1599 | mutex_unlock(&ctrl->crit_sect); | 1599 | mutex_unlock(&ctrl->crit_sect); |
1600 | } else { | 1600 | } else { |
1601 | mutex_lock(&ctrl->crit_sect); | 1601 | mutex_lock(&ctrl->crit_sect); |
1602 | 1602 | ||
1603 | amber_LED_on (ctrl, hp_slot); | 1603 | amber_LED_on(ctrl, hp_slot); |
1604 | green_LED_off (ctrl, hp_slot); | 1604 | green_LED_off(ctrl, hp_slot); |
1605 | slot_disable (ctrl, hp_slot); | 1605 | slot_disable(ctrl, hp_slot); |
1606 | 1606 | ||
1607 | set_SOGO(ctrl); | 1607 | set_SOGO(ctrl); |
1608 | 1608 | ||
1609 | /* Wait for SOBS to be unset */ | 1609 | /* Wait for SOBS to be unset */ |
1610 | wait_for_ctrl_irq (ctrl); | 1610 | wait_for_ctrl_irq(ctrl); |
1611 | 1611 | ||
1612 | mutex_unlock(&ctrl->crit_sect); | 1612 | mutex_unlock(&ctrl->crit_sect); |
1613 | 1613 | ||
@@ -1672,8 +1672,8 @@ static u32 remove_board(struct pci_func *func, u32 replace_flag, struct controll | |||
1672 | 1672 | ||
1673 | mutex_lock(&ctrl->crit_sect); | 1673 | mutex_lock(&ctrl->crit_sect); |
1674 | 1674 | ||
1675 | green_LED_off (ctrl, hp_slot); | 1675 | green_LED_off(ctrl, hp_slot); |
1676 | slot_disable (ctrl, hp_slot); | 1676 | slot_disable(ctrl, hp_slot); |
1677 | 1677 | ||
1678 | set_SOGO(ctrl); | 1678 | set_SOGO(ctrl); |
1679 | 1679 | ||
@@ -1683,7 +1683,7 @@ static u32 remove_board(struct pci_func *func, u32 replace_flag, struct controll | |||
1683 | writeb(temp_byte, ctrl->hpc_reg + SLOT_SERR); | 1683 | writeb(temp_byte, ctrl->hpc_reg + SLOT_SERR); |
1684 | 1684 | ||
1685 | /* Wait for SOBS to be unset */ | 1685 | /* Wait for SOBS to be unset */ |
1686 | wait_for_ctrl_irq (ctrl); | 1686 | wait_for_ctrl_irq(ctrl); |
1687 | 1687 | ||
1688 | mutex_unlock(&ctrl->crit_sect); | 1688 | mutex_unlock(&ctrl->crit_sect); |
1689 | 1689 | ||
@@ -1755,7 +1755,7 @@ static int event_thread(void *data) | |||
1755 | if (pushbutton_pending) | 1755 | if (pushbutton_pending) |
1756 | cpqhp_pushbutton_thread(pushbutton_pending); | 1756 | cpqhp_pushbutton_thread(pushbutton_pending); |
1757 | else | 1757 | else |
1758 | for (ctrl = cpqhp_ctrl_list; ctrl; ctrl=ctrl->next) | 1758 | for (ctrl = cpqhp_ctrl_list; ctrl; ctrl = ctrl->next) |
1759 | interrupt_event_handler(ctrl); | 1759 | interrupt_event_handler(ctrl); |
1760 | } | 1760 | } |
1761 | dbg("event_thread signals exit\n"); | 1761 | dbg("event_thread signals exit\n"); |
@@ -1766,7 +1766,7 @@ int cpqhp_event_start_thread(void) | |||
1766 | { | 1766 | { |
1767 | cpqhp_event_thread = kthread_run(event_thread, NULL, "phpd_event"); | 1767 | cpqhp_event_thread = kthread_run(event_thread, NULL, "phpd_event"); |
1768 | if (IS_ERR(cpqhp_event_thread)) { | 1768 | if (IS_ERR(cpqhp_event_thread)) { |
1769 | err ("Can't start up our event thread\n"); | 1769 | err("Can't start up our event thread\n"); |
1770 | return PTR_ERR(cpqhp_event_thread); | 1770 | return PTR_ERR(cpqhp_event_thread); |
1771 | } | 1771 | } |
1772 | 1772 | ||
@@ -1794,7 +1794,7 @@ static int update_slot_info(struct controller *ctrl, struct slot *slot) | |||
1794 | info->latch_status = cpq_get_latch_status(ctrl, slot); | 1794 | info->latch_status = cpq_get_latch_status(ctrl, slot); |
1795 | info->adapter_status = get_presence_status(ctrl, slot); | 1795 | info->adapter_status = get_presence_status(ctrl, slot); |
1796 | result = pci_hp_change_slot_info(slot->hotplug_slot, info); | 1796 | result = pci_hp_change_slot_info(slot->hotplug_slot, info); |
1797 | kfree (info); | 1797 | kfree(info); |
1798 | return result; | 1798 | return result; |
1799 | } | 1799 | } |
1800 | 1800 | ||
@@ -1837,23 +1837,23 @@ static void interrupt_event_handler(struct controller *ctrl) | |||
1837 | if (p_slot->state == BLINKINGOFF_STATE) { | 1837 | if (p_slot->state == BLINKINGOFF_STATE) { |
1838 | /* slot is on */ | 1838 | /* slot is on */ |
1839 | dbg("turn on green LED\n"); | 1839 | dbg("turn on green LED\n"); |
1840 | green_LED_on (ctrl, hp_slot); | 1840 | green_LED_on(ctrl, hp_slot); |
1841 | } else if (p_slot->state == BLINKINGON_STATE) { | 1841 | } else if (p_slot->state == BLINKINGON_STATE) { |
1842 | /* slot is off */ | 1842 | /* slot is off */ |
1843 | dbg("turn off green LED\n"); | 1843 | dbg("turn off green LED\n"); |
1844 | green_LED_off (ctrl, hp_slot); | 1844 | green_LED_off(ctrl, hp_slot); |
1845 | } | 1845 | } |
1846 | 1846 | ||
1847 | info(msg_button_cancel, p_slot->number); | 1847 | info(msg_button_cancel, p_slot->number); |
1848 | 1848 | ||
1849 | p_slot->state = STATIC_STATE; | 1849 | p_slot->state = STATIC_STATE; |
1850 | 1850 | ||
1851 | amber_LED_off (ctrl, hp_slot); | 1851 | amber_LED_off(ctrl, hp_slot); |
1852 | 1852 | ||
1853 | set_SOGO(ctrl); | 1853 | set_SOGO(ctrl); |
1854 | 1854 | ||
1855 | /* Wait for SOBS to be unset */ | 1855 | /* Wait for SOBS to be unset */ |
1856 | wait_for_ctrl_irq (ctrl); | 1856 | wait_for_ctrl_irq(ctrl); |
1857 | 1857 | ||
1858 | mutex_unlock(&ctrl->crit_sect); | 1858 | mutex_unlock(&ctrl->crit_sect); |
1859 | } | 1859 | } |
@@ -1861,7 +1861,7 @@ static void interrupt_event_handler(struct controller *ctrl) | |||
1861 | else if (ctrl->event_queue[loop].event_type == INT_BUTTON_RELEASE) { | 1861 | else if (ctrl->event_queue[loop].event_type == INT_BUTTON_RELEASE) { |
1862 | dbg("button release\n"); | 1862 | dbg("button release\n"); |
1863 | 1863 | ||
1864 | if (is_slot_enabled (ctrl, hp_slot)) { | 1864 | if (is_slot_enabled(ctrl, hp_slot)) { |
1865 | dbg("slot is on\n"); | 1865 | dbg("slot is on\n"); |
1866 | p_slot->state = BLINKINGOFF_STATE; | 1866 | p_slot->state = BLINKINGOFF_STATE; |
1867 | info(msg_button_off, p_slot->number); | 1867 | info(msg_button_off, p_slot->number); |
@@ -1874,13 +1874,13 @@ static void interrupt_event_handler(struct controller *ctrl) | |||
1874 | 1874 | ||
1875 | dbg("blink green LED and turn off amber\n"); | 1875 | dbg("blink green LED and turn off amber\n"); |
1876 | 1876 | ||
1877 | amber_LED_off (ctrl, hp_slot); | 1877 | amber_LED_off(ctrl, hp_slot); |
1878 | green_LED_blink (ctrl, hp_slot); | 1878 | green_LED_blink(ctrl, hp_slot); |
1879 | 1879 | ||
1880 | set_SOGO(ctrl); | 1880 | set_SOGO(ctrl); |
1881 | 1881 | ||
1882 | /* Wait for SOBS to be unset */ | 1882 | /* Wait for SOBS to be unset */ |
1883 | wait_for_ctrl_irq (ctrl); | 1883 | wait_for_ctrl_irq(ctrl); |
1884 | 1884 | ||
1885 | mutex_unlock(&ctrl->crit_sect); | 1885 | mutex_unlock(&ctrl->crit_sect); |
1886 | init_timer(&p_slot->task_event); | 1886 | init_timer(&p_slot->task_event); |
@@ -1940,7 +1940,7 @@ void cpqhp_pushbutton_thread(unsigned long slot) | |||
1940 | dbg("In power_down_board, func = %p, ctrl = %p\n", func, ctrl); | 1940 | dbg("In power_down_board, func = %p, ctrl = %p\n", func, ctrl); |
1941 | if (!func) { | 1941 | if (!func) { |
1942 | dbg("Error! func NULL in %s\n", __func__); | 1942 | dbg("Error! func NULL in %s\n", __func__); |
1943 | return ; | 1943 | return; |
1944 | } | 1944 | } |
1945 | 1945 | ||
1946 | if (cpqhp_process_SS(ctrl, func) != 0) { | 1946 | if (cpqhp_process_SS(ctrl, func) != 0) { |
@@ -1962,7 +1962,7 @@ void cpqhp_pushbutton_thread(unsigned long slot) | |||
1962 | dbg("In add_board, func = %p, ctrl = %p\n", func, ctrl); | 1962 | dbg("In add_board, func = %p, ctrl = %p\n", func, ctrl); |
1963 | if (!func) { | 1963 | if (!func) { |
1964 | dbg("Error! func NULL in %s\n", __func__); | 1964 | dbg("Error! func NULL in %s\n", __func__); |
1965 | return ; | 1965 | return; |
1966 | } | 1966 | } |
1967 | 1967 | ||
1968 | if (ctrl != NULL) { | 1968 | if (ctrl != NULL) { |
@@ -1973,7 +1973,7 @@ void cpqhp_pushbutton_thread(unsigned long slot) | |||
1973 | set_SOGO(ctrl); | 1973 | set_SOGO(ctrl); |
1974 | 1974 | ||
1975 | /* Wait for SOBS to be unset */ | 1975 | /* Wait for SOBS to be unset */ |
1976 | wait_for_ctrl_irq (ctrl); | 1976 | wait_for_ctrl_irq(ctrl); |
1977 | } | 1977 | } |
1978 | } | 1978 | } |
1979 | 1979 | ||
@@ -2086,7 +2086,7 @@ int cpqhp_process_SS(struct controller *ctrl, struct pci_func *func) | |||
2086 | unsigned int devfn; | 2086 | unsigned int devfn; |
2087 | struct slot *p_slot; | 2087 | struct slot *p_slot; |
2088 | struct pci_bus *pci_bus = ctrl->pci_bus; | 2088 | struct pci_bus *pci_bus = ctrl->pci_bus; |
2089 | int physical_slot=0; | 2089 | int physical_slot = 0; |
2090 | 2090 | ||
2091 | device = func->device; | 2091 | device = func->device; |
2092 | func = cpqhp_slot_find(ctrl->bus, device, index++); | 2092 | func = cpqhp_slot_find(ctrl->bus, device, index++); |
@@ -2100,7 +2100,7 @@ int cpqhp_process_SS(struct controller *ctrl, struct pci_func *func) | |||
2100 | devfn = PCI_DEVFN(func->device, func->function); | 2100 | devfn = PCI_DEVFN(func->device, func->function); |
2101 | 2101 | ||
2102 | /* Check the Class Code */ | 2102 | /* Check the Class Code */ |
2103 | rc = pci_bus_read_config_byte (pci_bus, devfn, 0x0B, &class_code); | 2103 | rc = pci_bus_read_config_byte(pci_bus, devfn, 0x0B, &class_code); |
2104 | if (rc) | 2104 | if (rc) |
2105 | return rc; | 2105 | return rc; |
2106 | 2106 | ||
@@ -2109,13 +2109,13 @@ int cpqhp_process_SS(struct controller *ctrl, struct pci_func *func) | |||
2109 | rc = REMOVE_NOT_SUPPORTED; | 2109 | rc = REMOVE_NOT_SUPPORTED; |
2110 | } else { | 2110 | } else { |
2111 | /* See if it's a bridge */ | 2111 | /* See if it's a bridge */ |
2112 | rc = pci_bus_read_config_byte (pci_bus, devfn, PCI_HEADER_TYPE, &header_type); | 2112 | rc = pci_bus_read_config_byte(pci_bus, devfn, PCI_HEADER_TYPE, &header_type); |
2113 | if (rc) | 2113 | if (rc) |
2114 | return rc; | 2114 | return rc; |
2115 | 2115 | ||
2116 | /* If it's a bridge, check the VGA Enable bit */ | 2116 | /* If it's a bridge, check the VGA Enable bit */ |
2117 | if ((header_type & 0x7F) == PCI_HEADER_TYPE_BRIDGE) { | 2117 | if ((header_type & 0x7F) == PCI_HEADER_TYPE_BRIDGE) { |
2118 | rc = pci_bus_read_config_byte (pci_bus, devfn, PCI_BRIDGE_CONTROL, &BCR); | 2118 | rc = pci_bus_read_config_byte(pci_bus, devfn, PCI_BRIDGE_CONTROL, &BCR); |
2119 | if (rc) | 2119 | if (rc) |
2120 | return rc; | 2120 | return rc; |
2121 | 2121 | ||
@@ -2217,7 +2217,7 @@ int cpqhp_hardware_test(struct controller *ctrl, int test_num) | |||
2217 | set_SOGO(ctrl); | 2217 | set_SOGO(ctrl); |
2218 | 2218 | ||
2219 | /* Wait for SOGO interrupt */ | 2219 | /* Wait for SOGO interrupt */ |
2220 | wait_for_ctrl_irq (ctrl); | 2220 | wait_for_ctrl_irq(ctrl); |
2221 | 2221 | ||
2222 | /* Get ready for next iteration */ | 2222 | /* Get ready for next iteration */ |
2223 | long_delay((3*HZ)/10); | 2223 | long_delay((3*HZ)/10); |
@@ -2227,7 +2227,7 @@ int cpqhp_hardware_test(struct controller *ctrl, int test_num) | |||
2227 | set_SOGO(ctrl); | 2227 | set_SOGO(ctrl); |
2228 | 2228 | ||
2229 | /* Wait for SOGO interrupt */ | 2229 | /* Wait for SOGO interrupt */ |
2230 | wait_for_ctrl_irq (ctrl); | 2230 | wait_for_ctrl_irq(ctrl); |
2231 | 2231 | ||
2232 | /* Get ready for next iteration */ | 2232 | /* Get ready for next iteration */ |
2233 | long_delay((3*HZ)/10); | 2233 | long_delay((3*HZ)/10); |
@@ -2243,7 +2243,7 @@ int cpqhp_hardware_test(struct controller *ctrl, int test_num) | |||
2243 | set_SOGO(ctrl); | 2243 | set_SOGO(ctrl); |
2244 | 2244 | ||
2245 | /* Wait for SOBS to be unset */ | 2245 | /* Wait for SOBS to be unset */ |
2246 | wait_for_ctrl_irq (ctrl); | 2246 | wait_for_ctrl_irq(ctrl); |
2247 | break; | 2247 | break; |
2248 | case 2: | 2248 | case 2: |
2249 | /* Do other stuff here! */ | 2249 | /* Do other stuff here! */ |
@@ -2279,7 +2279,7 @@ static u32 configure_new_device(struct controller *ctrl, struct pci_func *func | |||
2279 | dbg("%s\n", __func__); | 2279 | dbg("%s\n", __func__); |
2280 | /* Check for Multi-function device */ | 2280 | /* Check for Multi-function device */ |
2281 | ctrl->pci_bus->number = func->bus; | 2281 | ctrl->pci_bus->number = func->bus; |
2282 | rc = pci_bus_read_config_byte (ctrl->pci_bus, PCI_DEVFN(func->device, func->function), 0x0E, &temp_byte); | 2282 | rc = pci_bus_read_config_byte(ctrl->pci_bus, PCI_DEVFN(func->device, func->function), 0x0E, &temp_byte); |
2283 | if (rc) { | 2283 | if (rc) { |
2284 | dbg("%s: rc = %d\n", __func__, rc); | 2284 | dbg("%s: rc = %d\n", __func__, rc); |
2285 | return rc; | 2285 | return rc; |
@@ -2296,7 +2296,7 @@ static u32 configure_new_device(struct controller *ctrl, struct pci_func *func | |||
2296 | rc = configure_new_function(ctrl, new_slot, behind_bridge, resources); | 2296 | rc = configure_new_function(ctrl, new_slot, behind_bridge, resources); |
2297 | 2297 | ||
2298 | if (rc) { | 2298 | if (rc) { |
2299 | dbg("configure_new_function failed %d\n",rc); | 2299 | dbg("configure_new_function failed %d\n", rc); |
2300 | index = 0; | 2300 | index = 0; |
2301 | 2301 | ||
2302 | while (new_slot) { | 2302 | while (new_slot) { |
@@ -2317,7 +2317,7 @@ static u32 configure_new_device(struct controller *ctrl, struct pci_func *func | |||
2317 | * and creates a board structure */ | 2317 | * and creates a board structure */ |
2318 | 2318 | ||
2319 | while ((function < max_functions) && (!stop_it)) { | 2319 | while ((function < max_functions) && (!stop_it)) { |
2320 | pci_bus_read_config_dword (ctrl->pci_bus, PCI_DEVFN(func->device, function), 0x00, &ID); | 2320 | pci_bus_read_config_dword(ctrl->pci_bus, PCI_DEVFN(func->device, function), 0x00, &ID); |
2321 | 2321 | ||
2322 | if (ID == 0xFFFFFFFF) { | 2322 | if (ID == 0xFFFFFFFF) { |
2323 | function++; | 2323 | function++; |
@@ -2543,10 +2543,10 @@ static int configure_new_function(struct controller *ctrl, struct pci_func *func | |||
2543 | 2543 | ||
2544 | /* set Pre Mem base and Limit registers */ | 2544 | /* set Pre Mem base and Limit registers */ |
2545 | temp_word = p_mem_node->base >> 16; | 2545 | temp_word = p_mem_node->base >> 16; |
2546 | rc = pci_bus_write_config_word (pci_bus, devfn, PCI_PREF_MEMORY_BASE, temp_word); | 2546 | rc = pci_bus_write_config_word(pci_bus, devfn, PCI_PREF_MEMORY_BASE, temp_word); |
2547 | 2547 | ||
2548 | temp_word = (p_mem_node->base + p_mem_node->length - 1) >> 16; | 2548 | temp_word = (p_mem_node->base + p_mem_node->length - 1) >> 16; |
2549 | rc = pci_bus_write_config_word (pci_bus, devfn, PCI_PREF_MEMORY_LIMIT, temp_word); | 2549 | rc = pci_bus_write_config_word(pci_bus, devfn, PCI_PREF_MEMORY_LIMIT, temp_word); |
2550 | 2550 | ||
2551 | /* Adjust this to compensate for extra adjustment in first loop | 2551 | /* Adjust this to compensate for extra adjustment in first loop |
2552 | */ | 2552 | */ |
@@ -2560,7 +2560,7 @@ static int configure_new_function(struct controller *ctrl, struct pci_func *func | |||
2560 | 2560 | ||
2561 | ID = 0xFFFFFFFF; | 2561 | ID = 0xFFFFFFFF; |
2562 | pci_bus->number = hold_bus_node->base; | 2562 | pci_bus->number = hold_bus_node->base; |
2563 | pci_bus_read_config_dword (pci_bus, PCI_DEVFN(device, 0), 0x00, &ID); | 2563 | pci_bus_read_config_dword(pci_bus, PCI_DEVFN(device, 0), 0x00, &ID); |
2564 | pci_bus->number = func->bus; | 2564 | pci_bus->number = func->bus; |
2565 | 2565 | ||
2566 | if (ID != 0xFFFFFFFF) { /* device present */ | 2566 | if (ID != 0xFFFFFFFF) { /* device present */ |
@@ -2579,7 +2579,7 @@ static int configure_new_function(struct controller *ctrl, struct pci_func *func | |||
2579 | new_slot->status = 0; | 2579 | new_slot->status = 0; |
2580 | 2580 | ||
2581 | rc = configure_new_device(ctrl, new_slot, 1, &temp_resources); | 2581 | rc = configure_new_device(ctrl, new_slot, 1, &temp_resources); |
2582 | dbg("configure_new_device rc=0x%x\n",rc); | 2582 | dbg("configure_new_device rc=0x%x\n", rc); |
2583 | } /* End of IF (device in slot?) */ | 2583 | } /* End of IF (device in slot?) */ |
2584 | } /* End of FOR loop */ | 2584 | } /* End of FOR loop */ |
2585 | 2585 | ||
@@ -2615,7 +2615,7 @@ static int configure_new_function(struct controller *ctrl, struct pci_func *func | |||
2615 | temp_byte = temp_resources.bus_head->base - 1; | 2615 | temp_byte = temp_resources.bus_head->base - 1; |
2616 | 2616 | ||
2617 | /* set subordinate bus */ | 2617 | /* set subordinate bus */ |
2618 | rc = pci_bus_write_config_byte (pci_bus, devfn, PCI_SUBORDINATE_BUS, temp_byte); | 2618 | rc = pci_bus_write_config_byte(pci_bus, devfn, PCI_SUBORDINATE_BUS, temp_byte); |
2619 | 2619 | ||
2620 | if (temp_resources.bus_head->length == 0) { | 2620 | if (temp_resources.bus_head->length == 0) { |
2621 | kfree(temp_resources.bus_head); | 2621 | kfree(temp_resources.bus_head); |
@@ -2636,7 +2636,7 @@ static int configure_new_function(struct controller *ctrl, struct pci_func *func | |||
2636 | hold_IO_node->base = io_node->base + io_node->length; | 2636 | hold_IO_node->base = io_node->base + io_node->length; |
2637 | 2637 | ||
2638 | temp_byte = (hold_IO_node->base) >> 8; | 2638 | temp_byte = (hold_IO_node->base) >> 8; |
2639 | rc = pci_bus_write_config_word (pci_bus, devfn, PCI_IO_BASE, temp_byte); | 2639 | rc = pci_bus_write_config_word(pci_bus, devfn, PCI_IO_BASE, temp_byte); |
2640 | 2640 | ||
2641 | return_resource(&(resources->io_head), io_node); | 2641 | return_resource(&(resources->io_head), io_node); |
2642 | } | 2642 | } |
@@ -2655,13 +2655,13 @@ static int configure_new_function(struct controller *ctrl, struct pci_func *func | |||
2655 | func->io_head = hold_IO_node; | 2655 | func->io_head = hold_IO_node; |
2656 | 2656 | ||
2657 | temp_byte = (io_node->base - 1) >> 8; | 2657 | temp_byte = (io_node->base - 1) >> 8; |
2658 | rc = pci_bus_write_config_byte (pci_bus, devfn, PCI_IO_LIMIT, temp_byte); | 2658 | rc = pci_bus_write_config_byte(pci_bus, devfn, PCI_IO_LIMIT, temp_byte); |
2659 | 2659 | ||
2660 | return_resource(&(resources->io_head), io_node); | 2660 | return_resource(&(resources->io_head), io_node); |
2661 | } else { | 2661 | } else { |
2662 | /* it doesn't need any IO */ | 2662 | /* it doesn't need any IO */ |
2663 | temp_word = 0x0000; | 2663 | temp_word = 0x0000; |
2664 | rc = pci_bus_write_config_word (pci_bus, devfn, PCI_IO_LIMIT, temp_word); | 2664 | rc = pci_bus_write_config_word(pci_bus, devfn, PCI_IO_LIMIT, temp_word); |
2665 | 2665 | ||
2666 | return_resource(&(resources->io_head), io_node); | 2666 | return_resource(&(resources->io_head), io_node); |
2667 | kfree(hold_IO_node); | 2667 | kfree(hold_IO_node); |
@@ -2687,7 +2687,7 @@ static int configure_new_function(struct controller *ctrl, struct pci_func *func | |||
2687 | hold_mem_node->base = mem_node->base + mem_node->length; | 2687 | hold_mem_node->base = mem_node->base + mem_node->length; |
2688 | 2688 | ||
2689 | temp_word = (hold_mem_node->base) >> 16; | 2689 | temp_word = (hold_mem_node->base) >> 16; |
2690 | rc = pci_bus_write_config_word (pci_bus, devfn, PCI_MEMORY_BASE, temp_word); | 2690 | rc = pci_bus_write_config_word(pci_bus, devfn, PCI_MEMORY_BASE, temp_word); |
2691 | 2691 | ||
2692 | return_resource(&(resources->mem_head), mem_node); | 2692 | return_resource(&(resources->mem_head), mem_node); |
2693 | } | 2693 | } |
@@ -2706,14 +2706,14 @@ static int configure_new_function(struct controller *ctrl, struct pci_func *func | |||
2706 | 2706 | ||
2707 | /* configure end address */ | 2707 | /* configure end address */ |
2708 | temp_word = (mem_node->base - 1) >> 16; | 2708 | temp_word = (mem_node->base - 1) >> 16; |
2709 | rc = pci_bus_write_config_word (pci_bus, devfn, PCI_MEMORY_LIMIT, temp_word); | 2709 | rc = pci_bus_write_config_word(pci_bus, devfn, PCI_MEMORY_LIMIT, temp_word); |
2710 | 2710 | ||
2711 | /* Return unused resources to the pool */ | 2711 | /* Return unused resources to the pool */ |
2712 | return_resource(&(resources->mem_head), mem_node); | 2712 | return_resource(&(resources->mem_head), mem_node); |
2713 | } else { | 2713 | } else { |
2714 | /* it doesn't need any Mem */ | 2714 | /* it doesn't need any Mem */ |
2715 | temp_word = 0x0000; | 2715 | temp_word = 0x0000; |
2716 | rc = pci_bus_write_config_word (pci_bus, devfn, PCI_MEMORY_LIMIT, temp_word); | 2716 | rc = pci_bus_write_config_word(pci_bus, devfn, PCI_MEMORY_LIMIT, temp_word); |
2717 | 2717 | ||
2718 | return_resource(&(resources->mem_head), mem_node); | 2718 | return_resource(&(resources->mem_head), mem_node); |
2719 | kfree(hold_mem_node); | 2719 | kfree(hold_mem_node); |
@@ -2739,7 +2739,7 @@ static int configure_new_function(struct controller *ctrl, struct pci_func *func | |||
2739 | hold_p_mem_node->base = p_mem_node->base + p_mem_node->length; | 2739 | hold_p_mem_node->base = p_mem_node->base + p_mem_node->length; |
2740 | 2740 | ||
2741 | temp_word = (hold_p_mem_node->base) >> 16; | 2741 | temp_word = (hold_p_mem_node->base) >> 16; |
2742 | rc = pci_bus_write_config_word (pci_bus, devfn, PCI_PREF_MEMORY_BASE, temp_word); | 2742 | rc = pci_bus_write_config_word(pci_bus, devfn, PCI_PREF_MEMORY_BASE, temp_word); |
2743 | 2743 | ||
2744 | return_resource(&(resources->p_mem_head), p_mem_node); | 2744 | return_resource(&(resources->p_mem_head), p_mem_node); |
2745 | } | 2745 | } |
@@ -2758,13 +2758,13 @@ static int configure_new_function(struct controller *ctrl, struct pci_func *func | |||
2758 | func->p_mem_head = hold_p_mem_node; | 2758 | func->p_mem_head = hold_p_mem_node; |
2759 | 2759 | ||
2760 | temp_word = (p_mem_node->base - 1) >> 16; | 2760 | temp_word = (p_mem_node->base - 1) >> 16; |
2761 | rc = pci_bus_write_config_word (pci_bus, devfn, PCI_PREF_MEMORY_LIMIT, temp_word); | 2761 | rc = pci_bus_write_config_word(pci_bus, devfn, PCI_PREF_MEMORY_LIMIT, temp_word); |
2762 | 2762 | ||
2763 | return_resource(&(resources->p_mem_head), p_mem_node); | 2763 | return_resource(&(resources->p_mem_head), p_mem_node); |
2764 | } else { | 2764 | } else { |
2765 | /* it doesn't need any PMem */ | 2765 | /* it doesn't need any PMem */ |
2766 | temp_word = 0x0000; | 2766 | temp_word = 0x0000; |
2767 | rc = pci_bus_write_config_word (pci_bus, devfn, PCI_PREF_MEMORY_LIMIT, temp_word); | 2767 | rc = pci_bus_write_config_word(pci_bus, devfn, PCI_PREF_MEMORY_LIMIT, temp_word); |
2768 | 2768 | ||
2769 | return_resource(&(resources->p_mem_head), p_mem_node); | 2769 | return_resource(&(resources->p_mem_head), p_mem_node); |
2770 | kfree(hold_p_mem_node); | 2770 | kfree(hold_p_mem_node); |
@@ -2790,16 +2790,16 @@ static int configure_new_function(struct controller *ctrl, struct pci_func *func | |||
2790 | * PCI_COMMAND_INVALIDATE | | 2790 | * PCI_COMMAND_INVALIDATE | |
2791 | * PCI_COMMAND_PARITY | | 2791 | * PCI_COMMAND_PARITY | |
2792 | * PCI_COMMAND_SERR */ | 2792 | * PCI_COMMAND_SERR */ |
2793 | rc = pci_bus_write_config_word (pci_bus, devfn, PCI_COMMAND, command); | 2793 | rc = pci_bus_write_config_word(pci_bus, devfn, PCI_COMMAND, command); |
2794 | 2794 | ||
2795 | /* set Bridge Control Register */ | 2795 | /* set Bridge Control Register */ |
2796 | command = 0x07; /* = PCI_BRIDGE_CTL_PARITY | | 2796 | command = 0x07; /* = PCI_BRIDGE_CTL_PARITY | |
2797 | * PCI_BRIDGE_CTL_SERR | | 2797 | * PCI_BRIDGE_CTL_SERR | |
2798 | * PCI_BRIDGE_CTL_NO_ISA */ | 2798 | * PCI_BRIDGE_CTL_NO_ISA */ |
2799 | rc = pci_bus_write_config_word (pci_bus, devfn, PCI_BRIDGE_CONTROL, command); | 2799 | rc = pci_bus_write_config_word(pci_bus, devfn, PCI_BRIDGE_CONTROL, command); |
2800 | } else if ((temp_byte & 0x7F) == PCI_HEADER_TYPE_NORMAL) { | 2800 | } else if ((temp_byte & 0x7F) == PCI_HEADER_TYPE_NORMAL) { |
2801 | /* Standard device */ | 2801 | /* Standard device */ |
2802 | rc = pci_bus_read_config_byte (pci_bus, devfn, 0x0B, &class_code); | 2802 | rc = pci_bus_read_config_byte(pci_bus, devfn, 0x0B, &class_code); |
2803 | 2803 | ||
2804 | if (class_code == PCI_BASE_CLASS_DISPLAY) { | 2804 | if (class_code == PCI_BASE_CLASS_DISPLAY) { |
2805 | /* Display (video) adapter (not supported) */ | 2805 | /* Display (video) adapter (not supported) */ |
@@ -2810,9 +2810,9 @@ static int configure_new_function(struct controller *ctrl, struct pci_func *func | |||
2810 | temp_register = 0xFFFFFFFF; | 2810 | temp_register = 0xFFFFFFFF; |
2811 | 2811 | ||
2812 | dbg("CND: bus=%d, devfn=%d, offset=%d\n", pci_bus->number, devfn, cloop); | 2812 | dbg("CND: bus=%d, devfn=%d, offset=%d\n", pci_bus->number, devfn, cloop); |
2813 | rc = pci_bus_write_config_dword (pci_bus, devfn, cloop, temp_register); | 2813 | rc = pci_bus_write_config_dword(pci_bus, devfn, cloop, temp_register); |
2814 | 2814 | ||
2815 | rc = pci_bus_read_config_dword (pci_bus, devfn, cloop, &temp_register); | 2815 | rc = pci_bus_read_config_dword(pci_bus, devfn, cloop, &temp_register); |
2816 | dbg("CND: base = 0x%x\n", temp_register); | 2816 | dbg("CND: base = 0x%x\n", temp_register); |
2817 | 2817 | ||
2818 | if (temp_register) { /* If this register is implemented */ | 2818 | if (temp_register) { /* If this register is implemented */ |
@@ -2891,7 +2891,7 @@ static int configure_new_function(struct controller *ctrl, struct pci_func *func | |||
2891 | } /* End of base register loop */ | 2891 | } /* End of base register loop */ |
2892 | if (cpqhp_legacy_mode) { | 2892 | if (cpqhp_legacy_mode) { |
2893 | /* Figure out which interrupt pin this function uses */ | 2893 | /* Figure out which interrupt pin this function uses */ |
2894 | rc = pci_bus_read_config_byte (pci_bus, devfn, | 2894 | rc = pci_bus_read_config_byte(pci_bus, devfn, |
2895 | PCI_INTERRUPT_PIN, &temp_byte); | 2895 | PCI_INTERRUPT_PIN, &temp_byte); |
2896 | 2896 | ||
2897 | /* If this function needs an interrupt and we are behind | 2897 | /* If this function needs an interrupt and we are behind |
@@ -2905,7 +2905,7 @@ static int configure_new_function(struct controller *ctrl, struct pci_func *func | |||
2905 | resources->irqs->barber_pole - 1) & 0x03]; | 2905 | resources->irqs->barber_pole - 1) & 0x03]; |
2906 | } else { | 2906 | } else { |
2907 | /* Program IRQ based on card type */ | 2907 | /* Program IRQ based on card type */ |
2908 | rc = pci_bus_read_config_byte (pci_bus, devfn, 0x0B, &class_code); | 2908 | rc = pci_bus_read_config_byte(pci_bus, devfn, 0x0B, &class_code); |
2909 | 2909 | ||
2910 | if (class_code == PCI_BASE_CLASS_STORAGE) | 2910 | if (class_code == PCI_BASE_CLASS_STORAGE) |
2911 | IRQ = cpqhp_disk_irq; | 2911 | IRQ = cpqhp_disk_irq; |
@@ -2914,7 +2914,7 @@ static int configure_new_function(struct controller *ctrl, struct pci_func *func | |||
2914 | } | 2914 | } |
2915 | 2915 | ||
2916 | /* IRQ Line */ | 2916 | /* IRQ Line */ |
2917 | rc = pci_bus_write_config_byte (pci_bus, devfn, PCI_INTERRUPT_LINE, IRQ); | 2917 | rc = pci_bus_write_config_byte(pci_bus, devfn, PCI_INTERRUPT_LINE, IRQ); |
2918 | } | 2918 | } |
2919 | 2919 | ||
2920 | if (!behind_bridge) { | 2920 | if (!behind_bridge) { |
@@ -2950,7 +2950,7 @@ static int configure_new_function(struct controller *ctrl, struct pci_func *func | |||
2950 | * PCI_COMMAND_INVALIDATE | | 2950 | * PCI_COMMAND_INVALIDATE | |
2951 | * PCI_COMMAND_PARITY | | 2951 | * PCI_COMMAND_PARITY | |
2952 | * PCI_COMMAND_SERR */ | 2952 | * PCI_COMMAND_SERR */ |
2953 | rc = pci_bus_write_config_word (pci_bus, devfn, | 2953 | rc = pci_bus_write_config_word(pci_bus, devfn, |
2954 | PCI_COMMAND, temp_word); | 2954 | PCI_COMMAND, temp_word); |
2955 | } else { /* End of Not-A-Bridge else */ | 2955 | } else { /* End of Not-A-Bridge else */ |
2956 | /* It's some strange type of PCI adapter (Cardbus?) */ | 2956 | /* It's some strange type of PCI adapter (Cardbus?) */ |
@@ -2961,11 +2961,11 @@ static int configure_new_function(struct controller *ctrl, struct pci_func *func | |||
2961 | 2961 | ||
2962 | return 0; | 2962 | return 0; |
2963 | free_and_out: | 2963 | free_and_out: |
2964 | cpqhp_destroy_resource_list (&temp_resources); | 2964 | cpqhp_destroy_resource_list(&temp_resources); |
2965 | 2965 | ||
2966 | return_resource(&(resources-> bus_head), hold_bus_node); | 2966 | return_resource(&(resources->bus_head), hold_bus_node); |
2967 | return_resource(&(resources-> io_head), hold_IO_node); | 2967 | return_resource(&(resources->io_head), hold_IO_node); |
2968 | return_resource(&(resources-> mem_head), hold_mem_node); | 2968 | return_resource(&(resources->mem_head), hold_mem_node); |
2969 | return_resource(&(resources-> p_mem_head), hold_p_mem_node); | 2969 | return_resource(&(resources->p_mem_head), hold_p_mem_node); |
2970 | return rc; | 2970 | return rc; |
2971 | } | 2971 | } |
diff --git a/drivers/pci/hotplug/cpqphp_nvram.c b/drivers/pci/hotplug/cpqphp_nvram.c index 1e08ff8c229c..c25fc9061059 100644 --- a/drivers/pci/hotplug/cpqphp_nvram.c +++ b/drivers/pci/hotplug/cpqphp_nvram.c | |||
@@ -114,10 +114,10 @@ static u32 add_byte(u32 **p_buffer, u8 value, u32 *used, u32 *avail) | |||
114 | if ((*used + 1) > *avail) | 114 | if ((*used + 1) > *avail) |
115 | return(1); | 115 | return(1); |
116 | 116 | ||
117 | *((u8*)*p_buffer) = value; | 117 | *((u8 *)*p_buffer) = value; |
118 | tByte = (u8**)p_buffer; | 118 | tByte = (u8 **)p_buffer; |
119 | (*tByte)++; | 119 | (*tByte)++; |
120 | *used+=1; | 120 | *used += 1; |
121 | return(0); | 121 | return(0); |
122 | } | 122 | } |
123 | 123 | ||
@@ -129,7 +129,7 @@ static u32 add_dword(u32 **p_buffer, u32 value, u32 *used, u32 *avail) | |||
129 | 129 | ||
130 | **p_buffer = value; | 130 | **p_buffer = value; |
131 | (*p_buffer)++; | 131 | (*p_buffer)++; |
132 | *used+=4; | 132 | *used += 4; |
133 | return(0); | 133 | return(0); |
134 | } | 134 | } |
135 | 135 | ||
@@ -141,7 +141,7 @@ static u32 add_dword(u32 **p_buffer, u32 value, u32 *used, u32 *avail) | |||
141 | * | 141 | * |
142 | * returns 0 for non-Compaq ROM, 1 for Compaq ROM | 142 | * returns 0 for non-Compaq ROM, 1 for Compaq ROM |
143 | */ | 143 | */ |
144 | static int check_for_compaq_ROM (void __iomem *rom_start) | 144 | static int check_for_compaq_ROM(void __iomem *rom_start) |
145 | { | 145 | { |
146 | u8 temp1, temp2, temp3, temp4, temp5, temp6; | 146 | u8 temp1, temp2, temp3, temp4, temp5, temp6; |
147 | int result = 0; | 147 | int result = 0; |
@@ -160,12 +160,12 @@ static int check_for_compaq_ROM (void __iomem *rom_start) | |||
160 | (temp6 == 'Q')) { | 160 | (temp6 == 'Q')) { |
161 | result = 1; | 161 | result = 1; |
162 | } | 162 | } |
163 | dbg ("%s - returned %d\n", __func__, result); | 163 | dbg("%s - returned %d\n", __func__, result); |
164 | return result; | 164 | return result; |
165 | } | 165 | } |
166 | 166 | ||
167 | 167 | ||
168 | static u32 access_EV (u16 operation, u8 *ev_name, u8 *buffer, u32 *buf_size) | 168 | static u32 access_EV(u16 operation, u8 *ev_name, u8 *buffer, u32 *buf_size) |
169 | { | 169 | { |
170 | unsigned long flags; | 170 | unsigned long flags; |
171 | int op = operation; | 171 | int op = operation; |
@@ -197,7 +197,7 @@ static u32 access_EV (u16 operation, u8 *ev_name, u8 *buffer, u32 *buf_size) | |||
197 | * | 197 | * |
198 | * Read the hot plug Resource Table from NVRAM | 198 | * Read the hot plug Resource Table from NVRAM |
199 | */ | 199 | */ |
200 | static int load_HRT (void __iomem *rom_start) | 200 | static int load_HRT(void __iomem *rom_start) |
201 | { | 201 | { |
202 | u32 available; | 202 | u32 available; |
203 | u32 temp_dword; | 203 | u32 temp_dword; |
@@ -232,7 +232,7 @@ static int load_HRT (void __iomem *rom_start) | |||
232 | * | 232 | * |
233 | * Save the hot plug Resource Table in NVRAM | 233 | * Save the hot plug Resource Table in NVRAM |
234 | */ | 234 | */ |
235 | static u32 store_HRT (void __iomem *rom_start) | 235 | static u32 store_HRT(void __iomem *rom_start) |
236 | { | 236 | { |
237 | u32 *buffer; | 237 | u32 *buffer; |
238 | u32 *pFill; | 238 | u32 *pFill; |
@@ -252,7 +252,7 @@ static u32 store_HRT (void __iomem *rom_start) | |||
252 | if (!check_for_compaq_ROM(rom_start)) | 252 | if (!check_for_compaq_ROM(rom_start)) |
253 | return(1); | 253 | return(1); |
254 | 254 | ||
255 | buffer = (u32*) evbuffer; | 255 | buffer = (u32 *) evbuffer; |
256 | 256 | ||
257 | if (!buffer) | 257 | if (!buffer) |
258 | return(1); | 258 | return(1); |
@@ -306,7 +306,7 @@ static u32 store_HRT (void __iomem *rom_start) | |||
306 | loop = 0; | 306 | loop = 0; |
307 | 307 | ||
308 | while (resNode) { | 308 | while (resNode) { |
309 | loop ++; | 309 | loop++; |
310 | 310 | ||
311 | /* base */ | 311 | /* base */ |
312 | rc = add_dword(&pFill, resNode->base, &usedbytes, &available); | 312 | rc = add_dword(&pFill, resNode->base, &usedbytes, &available); |
@@ -331,7 +331,7 @@ static u32 store_HRT (void __iomem *rom_start) | |||
331 | loop = 0; | 331 | loop = 0; |
332 | 332 | ||
333 | while (resNode) { | 333 | while (resNode) { |
334 | loop ++; | 334 | loop++; |
335 | 335 | ||
336 | /* base */ | 336 | /* base */ |
337 | rc = add_dword(&pFill, resNode->base, &usedbytes, &available); | 337 | rc = add_dword(&pFill, resNode->base, &usedbytes, &available); |
@@ -356,7 +356,7 @@ static u32 store_HRT (void __iomem *rom_start) | |||
356 | loop = 0; | 356 | loop = 0; |
357 | 357 | ||
358 | while (resNode) { | 358 | while (resNode) { |
359 | loop ++; | 359 | loop++; |
360 | 360 | ||
361 | /* base */ | 361 | /* base */ |
362 | rc = add_dword(&pFill, resNode->base, &usedbytes, &available); | 362 | rc = add_dword(&pFill, resNode->base, &usedbytes, &available); |
@@ -381,7 +381,7 @@ static u32 store_HRT (void __iomem *rom_start) | |||
381 | loop = 0; | 381 | loop = 0; |
382 | 382 | ||
383 | while (resNode) { | 383 | while (resNode) { |
384 | loop ++; | 384 | loop++; |
385 | 385 | ||
386 | /* base */ | 386 | /* base */ |
387 | rc = add_dword(&pFill, resNode->base, &usedbytes, &available); | 387 | rc = add_dword(&pFill, resNode->base, &usedbytes, &available); |
@@ -408,7 +408,7 @@ static u32 store_HRT (void __iomem *rom_start) | |||
408 | 408 | ||
409 | temp_dword = usedbytes; | 409 | temp_dword = usedbytes; |
410 | 410 | ||
411 | rc = access_EV(WRITE_EV, "CQTHPS", (u8*) buffer, &temp_dword); | 411 | rc = access_EV(WRITE_EV, "CQTHPS", (u8 *) buffer, &temp_dword); |
412 | 412 | ||
413 | dbg("usedbytes = 0x%x, length = 0x%x\n", usedbytes, temp_dword); | 413 | dbg("usedbytes = 0x%x, length = 0x%x\n", usedbytes, temp_dword); |
414 | 414 | ||
@@ -423,7 +423,7 @@ static u32 store_HRT (void __iomem *rom_start) | |||
423 | } | 423 | } |
424 | 424 | ||
425 | 425 | ||
426 | void compaq_nvram_init (void __iomem *rom_start) | 426 | void compaq_nvram_init(void __iomem *rom_start) |
427 | { | 427 | { |
428 | if (rom_start) | 428 | if (rom_start) |
429 | compaq_int15_entry_point = (rom_start + ROM_INT15_PHY_ADDR - ROM_PHY_ADDR); | 429 | compaq_int15_entry_point = (rom_start + ROM_INT15_PHY_ADDR - ROM_PHY_ADDR); |
@@ -435,7 +435,7 @@ void compaq_nvram_init (void __iomem *rom_start) | |||
435 | } | 435 | } |
436 | 436 | ||
437 | 437 | ||
438 | int compaq_nvram_load (void __iomem *rom_start, struct controller *ctrl) | 438 | int compaq_nvram_load(void __iomem *rom_start, struct controller *ctrl) |
439 | { | 439 | { |
440 | u8 bus, device, function; | 440 | u8 bus, device, function; |
441 | u8 nummem, numpmem, numio, numbus; | 441 | u8 nummem, numpmem, numio, numbus; |
@@ -451,7 +451,7 @@ int compaq_nvram_load (void __iomem *rom_start, struct controller *ctrl) | |||
451 | if (!evbuffer_init) { | 451 | if (!evbuffer_init) { |
452 | /* Read the resource list information in from NVRAM */ | 452 | /* Read the resource list information in from NVRAM */ |
453 | if (load_HRT(rom_start)) | 453 | if (load_HRT(rom_start)) |
454 | memset (evbuffer, 0, 1024); | 454 | memset(evbuffer, 0, 1024); |
455 | 455 | ||
456 | evbuffer_init = 1; | 456 | evbuffer_init = 1; |
457 | } | 457 | } |
@@ -472,7 +472,7 @@ int compaq_nvram_load (void __iomem *rom_start, struct controller *ctrl) | |||
472 | 472 | ||
473 | p_byte += 3; | 473 | p_byte += 3; |
474 | 474 | ||
475 | if (p_byte > ((u8*)p_EV_header + evbuffer_length)) | 475 | if (p_byte > ((u8 *)p_EV_header + evbuffer_length)) |
476 | return 2; | 476 | return 2; |
477 | 477 | ||
478 | bus = p_ev_ctrl->bus; | 478 | bus = p_ev_ctrl->bus; |
@@ -489,20 +489,20 @@ int compaq_nvram_load (void __iomem *rom_start, struct controller *ctrl) | |||
489 | 489 | ||
490 | p_byte += 4; | 490 | p_byte += 4; |
491 | 491 | ||
492 | if (p_byte > ((u8*)p_EV_header + evbuffer_length)) | 492 | if (p_byte > ((u8 *)p_EV_header + evbuffer_length)) |
493 | return 2; | 493 | return 2; |
494 | 494 | ||
495 | /* Skip forward to the next entry */ | 495 | /* Skip forward to the next entry */ |
496 | p_byte += (nummem + numpmem + numio + numbus) * 8; | 496 | p_byte += (nummem + numpmem + numio + numbus) * 8; |
497 | 497 | ||
498 | if (p_byte > ((u8*)p_EV_header + evbuffer_length)) | 498 | if (p_byte > ((u8 *)p_EV_header + evbuffer_length)) |
499 | return 2; | 499 | return 2; |
500 | 500 | ||
501 | p_ev_ctrl = (struct ev_hrt_ctrl *) p_byte; | 501 | p_ev_ctrl = (struct ev_hrt_ctrl *) p_byte; |
502 | 502 | ||
503 | p_byte += 3; | 503 | p_byte += 3; |
504 | 504 | ||
505 | if (p_byte > ((u8*)p_EV_header + evbuffer_length)) | 505 | if (p_byte > ((u8 *)p_EV_header + evbuffer_length)) |
506 | return 2; | 506 | return 2; |
507 | 507 | ||
508 | bus = p_ev_ctrl->bus; | 508 | bus = p_ev_ctrl->bus; |
@@ -517,7 +517,7 @@ int compaq_nvram_load (void __iomem *rom_start, struct controller *ctrl) | |||
517 | 517 | ||
518 | p_byte += 4; | 518 | p_byte += 4; |
519 | 519 | ||
520 | if (p_byte > ((u8*)p_EV_header + evbuffer_length)) | 520 | if (p_byte > ((u8 *)p_EV_header + evbuffer_length)) |
521 | return 2; | 521 | return 2; |
522 | 522 | ||
523 | while (nummem--) { | 523 | while (nummem--) { |
@@ -526,20 +526,20 @@ int compaq_nvram_load (void __iomem *rom_start, struct controller *ctrl) | |||
526 | if (!mem_node) | 526 | if (!mem_node) |
527 | break; | 527 | break; |
528 | 528 | ||
529 | mem_node->base = *(u32*)p_byte; | 529 | mem_node->base = *(u32 *)p_byte; |
530 | dbg("mem base = %8.8x\n",mem_node->base); | 530 | dbg("mem base = %8.8x\n", mem_node->base); |
531 | p_byte += 4; | 531 | p_byte += 4; |
532 | 532 | ||
533 | if (p_byte > ((u8*)p_EV_header + evbuffer_length)) { | 533 | if (p_byte > ((u8 *)p_EV_header + evbuffer_length)) { |
534 | kfree(mem_node); | 534 | kfree(mem_node); |
535 | return 2; | 535 | return 2; |
536 | } | 536 | } |
537 | 537 | ||
538 | mem_node->length = *(u32*)p_byte; | 538 | mem_node->length = *(u32 *)p_byte; |
539 | dbg("mem length = %8.8x\n",mem_node->length); | 539 | dbg("mem length = %8.8x\n", mem_node->length); |
540 | p_byte += 4; | 540 | p_byte += 4; |
541 | 541 | ||
542 | if (p_byte > ((u8*)p_EV_header + evbuffer_length)) { | 542 | if (p_byte > ((u8 *)p_EV_header + evbuffer_length)) { |
543 | kfree(mem_node); | 543 | kfree(mem_node); |
544 | return 2; | 544 | return 2; |
545 | } | 545 | } |
@@ -554,20 +554,20 @@ int compaq_nvram_load (void __iomem *rom_start, struct controller *ctrl) | |||
554 | if (!p_mem_node) | 554 | if (!p_mem_node) |
555 | break; | 555 | break; |
556 | 556 | ||
557 | p_mem_node->base = *(u32*)p_byte; | 557 | p_mem_node->base = *(u32 *)p_byte; |
558 | dbg("pre-mem base = %8.8x\n",p_mem_node->base); | 558 | dbg("pre-mem base = %8.8x\n", p_mem_node->base); |
559 | p_byte += 4; | 559 | p_byte += 4; |
560 | 560 | ||
561 | if (p_byte > ((u8*)p_EV_header + evbuffer_length)) { | 561 | if (p_byte > ((u8 *)p_EV_header + evbuffer_length)) { |
562 | kfree(p_mem_node); | 562 | kfree(p_mem_node); |
563 | return 2; | 563 | return 2; |
564 | } | 564 | } |
565 | 565 | ||
566 | p_mem_node->length = *(u32*)p_byte; | 566 | p_mem_node->length = *(u32 *)p_byte; |
567 | dbg("pre-mem length = %8.8x\n",p_mem_node->length); | 567 | dbg("pre-mem length = %8.8x\n", p_mem_node->length); |
568 | p_byte += 4; | 568 | p_byte += 4; |
569 | 569 | ||
570 | if (p_byte > ((u8*)p_EV_header + evbuffer_length)) { | 570 | if (p_byte > ((u8 *)p_EV_header + evbuffer_length)) { |
571 | kfree(p_mem_node); | 571 | kfree(p_mem_node); |
572 | return 2; | 572 | return 2; |
573 | } | 573 | } |
@@ -582,20 +582,20 @@ int compaq_nvram_load (void __iomem *rom_start, struct controller *ctrl) | |||
582 | if (!io_node) | 582 | if (!io_node) |
583 | break; | 583 | break; |
584 | 584 | ||
585 | io_node->base = *(u32*)p_byte; | 585 | io_node->base = *(u32 *)p_byte; |
586 | dbg("io base = %8.8x\n",io_node->base); | 586 | dbg("io base = %8.8x\n", io_node->base); |
587 | p_byte += 4; | 587 | p_byte += 4; |
588 | 588 | ||
589 | if (p_byte > ((u8*)p_EV_header + evbuffer_length)) { | 589 | if (p_byte > ((u8 *)p_EV_header + evbuffer_length)) { |
590 | kfree(io_node); | 590 | kfree(io_node); |
591 | return 2; | 591 | return 2; |
592 | } | 592 | } |
593 | 593 | ||
594 | io_node->length = *(u32*)p_byte; | 594 | io_node->length = *(u32 *)p_byte; |
595 | dbg("io length = %8.8x\n",io_node->length); | 595 | dbg("io length = %8.8x\n", io_node->length); |
596 | p_byte += 4; | 596 | p_byte += 4; |
597 | 597 | ||
598 | if (p_byte > ((u8*)p_EV_header + evbuffer_length)) { | 598 | if (p_byte > ((u8 *)p_EV_header + evbuffer_length)) { |
599 | kfree(io_node); | 599 | kfree(io_node); |
600 | return 2; | 600 | return 2; |
601 | } | 601 | } |
@@ -610,18 +610,18 @@ int compaq_nvram_load (void __iomem *rom_start, struct controller *ctrl) | |||
610 | if (!bus_node) | 610 | if (!bus_node) |
611 | break; | 611 | break; |
612 | 612 | ||
613 | bus_node->base = *(u32*)p_byte; | 613 | bus_node->base = *(u32 *)p_byte; |
614 | p_byte += 4; | 614 | p_byte += 4; |
615 | 615 | ||
616 | if (p_byte > ((u8*)p_EV_header + evbuffer_length)) { | 616 | if (p_byte > ((u8 *)p_EV_header + evbuffer_length)) { |
617 | kfree(bus_node); | 617 | kfree(bus_node); |
618 | return 2; | 618 | return 2; |
619 | } | 619 | } |
620 | 620 | ||
621 | bus_node->length = *(u32*)p_byte; | 621 | bus_node->length = *(u32 *)p_byte; |
622 | p_byte += 4; | 622 | p_byte += 4; |
623 | 623 | ||
624 | if (p_byte > ((u8*)p_EV_header + evbuffer_length)) { | 624 | if (p_byte > ((u8 *)p_EV_header + evbuffer_length)) { |
625 | kfree(bus_node); | 625 | kfree(bus_node); |
626 | return 2; | 626 | return 2; |
627 | } | 627 | } |
@@ -650,7 +650,7 @@ int compaq_nvram_load (void __iomem *rom_start, struct controller *ctrl) | |||
650 | } | 650 | } |
651 | 651 | ||
652 | 652 | ||
653 | int compaq_nvram_store (void __iomem *rom_start) | 653 | int compaq_nvram_store(void __iomem *rom_start) |
654 | { | 654 | { |
655 | int rc = 1; | 655 | int rc = 1; |
656 | 656 | ||
diff --git a/drivers/pci/hotplug/cpqphp_pci.c b/drivers/pci/hotplug/cpqphp_pci.c index 1c8c2f130d31..e220d49307bd 100644 --- a/drivers/pci/hotplug/cpqphp_pci.c +++ b/drivers/pci/hotplug/cpqphp_pci.c | |||
@@ -81,7 +81,7 @@ static void __iomem *detect_HRT_floating_pointer(void __iomem *begin, void __iom | |||
81 | } | 81 | } |
82 | 82 | ||
83 | 83 | ||
84 | int cpqhp_configure_device (struct controller *ctrl, struct pci_func *func) | 84 | int cpqhp_configure_device(struct controller *ctrl, struct pci_func *func) |
85 | { | 85 | { |
86 | struct pci_bus *child; | 86 | struct pci_bus *child; |
87 | int num; | 87 | int num; |
@@ -89,7 +89,7 @@ int cpqhp_configure_device (struct controller *ctrl, struct pci_func *func) | |||
89 | pci_lock_rescan_remove(); | 89 | pci_lock_rescan_remove(); |
90 | 90 | ||
91 | if (func->pci_dev == NULL) | 91 | if (func->pci_dev == NULL) |
92 | func->pci_dev = pci_get_bus_and_slot(func->bus,PCI_DEVFN(func->device, func->function)); | 92 | func->pci_dev = pci_get_bus_and_slot(func->bus, PCI_DEVFN(func->device, func->function)); |
93 | 93 | ||
94 | /* No pci device, we need to create it then */ | 94 | /* No pci device, we need to create it then */ |
95 | if (func->pci_dev == NULL) { | 95 | if (func->pci_dev == NULL) { |
@@ -128,7 +128,7 @@ int cpqhp_unconfigure_device(struct pci_func *func) | |||
128 | dbg("%s: bus/dev/func = %x/%x/%x\n", __func__, func->bus, func->device, func->function); | 128 | dbg("%s: bus/dev/func = %x/%x/%x\n", __func__, func->bus, func->device, func->function); |
129 | 129 | ||
130 | pci_lock_rescan_remove(); | 130 | pci_lock_rescan_remove(); |
131 | for (j=0; j<8 ; j++) { | 131 | for (j = 0; j < 8 ; j++) { |
132 | struct pci_dev *temp = pci_get_bus_and_slot(func->bus, PCI_DEVFN(func->device, j)); | 132 | struct pci_dev *temp = pci_get_bus_and_slot(func->bus, PCI_DEVFN(func->device, j)); |
133 | if (temp) { | 133 | if (temp) { |
134 | pci_dev_put(temp); | 134 | pci_dev_put(temp); |
@@ -143,11 +143,11 @@ static int PCI_RefinedAccessConfig(struct pci_bus *bus, unsigned int devfn, u8 o | |||
143 | { | 143 | { |
144 | u32 vendID = 0; | 144 | u32 vendID = 0; |
145 | 145 | ||
146 | if (pci_bus_read_config_dword (bus, devfn, PCI_VENDOR_ID, &vendID) == -1) | 146 | if (pci_bus_read_config_dword(bus, devfn, PCI_VENDOR_ID, &vendID) == -1) |
147 | return -1; | 147 | return -1; |
148 | if (vendID == 0xffffffff) | 148 | if (vendID == 0xffffffff) |
149 | return -1; | 149 | return -1; |
150 | return pci_bus_read_config_dword (bus, devfn, offset, value); | 150 | return pci_bus_read_config_dword(bus, devfn, offset, value); |
151 | } | 151 | } |
152 | 152 | ||
153 | 153 | ||
@@ -158,7 +158,7 @@ static int PCI_RefinedAccessConfig(struct pci_bus *bus, unsigned int devfn, u8 o | |||
158 | * @dev_num: device number of PCI device | 158 | * @dev_num: device number of PCI device |
159 | * @slot: pointer to u8 where slot number will be returned | 159 | * @slot: pointer to u8 where slot number will be returned |
160 | */ | 160 | */ |
161 | int cpqhp_set_irq (u8 bus_num, u8 dev_num, u8 int_pin, u8 irq_num) | 161 | int cpqhp_set_irq(u8 bus_num, u8 dev_num, u8 int_pin, u8 irq_num) |
162 | { | 162 | { |
163 | int rc = 0; | 163 | int rc = 0; |
164 | 164 | ||
@@ -230,7 +230,7 @@ static int PCI_ScanBusForNonBridge(struct controller *ctrl, u8 bus_num, u8 *dev_ | |||
230 | dbg("Looking for bridge bus_num %d dev_num %d\n", bus_num, tdevice); | 230 | dbg("Looking for bridge bus_num %d dev_num %d\n", bus_num, tdevice); |
231 | /* Yep we got one. bridge ? */ | 231 | /* Yep we got one. bridge ? */ |
232 | if ((work >> 8) == PCI_TO_PCI_BRIDGE_CLASS) { | 232 | if ((work >> 8) == PCI_TO_PCI_BRIDGE_CLASS) { |
233 | pci_bus_read_config_byte (ctrl->pci_bus, PCI_DEVFN(tdevice, 0), PCI_SECONDARY_BUS, &tbus); | 233 | pci_bus_read_config_byte(ctrl->pci_bus, PCI_DEVFN(tdevice, 0), PCI_SECONDARY_BUS, &tbus); |
234 | /* XXX: no recursion, wtf? */ | 234 | /* XXX: no recursion, wtf? */ |
235 | dbg("Recurse on bus_num %d tdevice %d\n", tbus, tdevice); | 235 | dbg("Recurse on bus_num %d tdevice %d\n", tbus, tdevice); |
236 | return 0; | 236 | return 0; |
@@ -257,16 +257,16 @@ static int PCI_GetBusDevHelper(struct controller *ctrl, u8 *bus_num, u8 *dev_num | |||
257 | *bus_num = tbus; | 257 | *bus_num = tbus; |
258 | *dev_num = tdevice; | 258 | *dev_num = tdevice; |
259 | ctrl->pci_bus->number = tbus; | 259 | ctrl->pci_bus->number = tbus; |
260 | pci_bus_read_config_dword (ctrl->pci_bus, *dev_num, PCI_VENDOR_ID, &work); | 260 | pci_bus_read_config_dword(ctrl->pci_bus, *dev_num, PCI_VENDOR_ID, &work); |
261 | if (!nobridge || (work == 0xffffffff)) | 261 | if (!nobridge || (work == 0xffffffff)) |
262 | return 0; | 262 | return 0; |
263 | 263 | ||
264 | dbg("bus_num %d devfn %d\n", *bus_num, *dev_num); | 264 | dbg("bus_num %d devfn %d\n", *bus_num, *dev_num); |
265 | pci_bus_read_config_dword (ctrl->pci_bus, *dev_num, PCI_CLASS_REVISION, &work); | 265 | pci_bus_read_config_dword(ctrl->pci_bus, *dev_num, PCI_CLASS_REVISION, &work); |
266 | dbg("work >> 8 (%x) = BRIDGE (%x)\n", work >> 8, PCI_TO_PCI_BRIDGE_CLASS); | 266 | dbg("work >> 8 (%x) = BRIDGE (%x)\n", work >> 8, PCI_TO_PCI_BRIDGE_CLASS); |
267 | 267 | ||
268 | if ((work >> 8) == PCI_TO_PCI_BRIDGE_CLASS) { | 268 | if ((work >> 8) == PCI_TO_PCI_BRIDGE_CLASS) { |
269 | pci_bus_read_config_byte (ctrl->pci_bus, *dev_num, PCI_SECONDARY_BUS, &tbus); | 269 | pci_bus_read_config_byte(ctrl->pci_bus, *dev_num, PCI_SECONDARY_BUS, &tbus); |
270 | dbg("Scan bus for Non Bridge: bus %d\n", tbus); | 270 | dbg("Scan bus for Non Bridge: bus %d\n", tbus); |
271 | if (PCI_ScanBusForNonBridge(ctrl, tbus, dev_num) == 0) { | 271 | if (PCI_ScanBusForNonBridge(ctrl, tbus, dev_num) == 0) { |
272 | *bus_num = tbus; | 272 | *bus_num = tbus; |
@@ -280,7 +280,7 @@ static int PCI_GetBusDevHelper(struct controller *ctrl, u8 *bus_num, u8 *dev_num | |||
280 | } | 280 | } |
281 | 281 | ||
282 | 282 | ||
283 | int cpqhp_get_bus_dev (struct controller *ctrl, u8 *bus_num, u8 *dev_num, u8 slot) | 283 | int cpqhp_get_bus_dev(struct controller *ctrl, u8 *bus_num, u8 *dev_num, u8 slot) |
284 | { | 284 | { |
285 | /* plain (bridges allowed) */ | 285 | /* plain (bridges allowed) */ |
286 | return PCI_GetBusDevHelper(ctrl, bus_num, dev_num, slot, 0); | 286 | return PCI_GetBusDevHelper(ctrl, bus_num, dev_num, slot, 0); |
@@ -419,7 +419,7 @@ int cpqhp_save_config(struct controller *ctrl, int busnumber, int is_hot_plug) | |||
419 | new_slot->pci_dev = pci_get_bus_and_slot(new_slot->bus, (new_slot->device << 3) | new_slot->function); | 419 | new_slot->pci_dev = pci_get_bus_and_slot(new_slot->bus, (new_slot->device << 3) | new_slot->function); |
420 | 420 | ||
421 | for (cloop = 0; cloop < 0x20; cloop++) { | 421 | for (cloop = 0; cloop < 0x20; cloop++) { |
422 | rc = pci_bus_read_config_dword(ctrl->pci_bus, PCI_DEVFN(device, function), cloop << 2, (u32 *) & (new_slot-> config_space [cloop])); | 422 | rc = pci_bus_read_config_dword(ctrl->pci_bus, PCI_DEVFN(device, function), cloop << 2, (u32 *) &(new_slot->config_space[cloop])); |
423 | if (rc) | 423 | if (rc) |
424 | return rc; | 424 | return rc; |
425 | } | 425 | } |
@@ -465,7 +465,7 @@ int cpqhp_save_config(struct controller *ctrl, int busnumber, int is_hot_plug) | |||
465 | * | 465 | * |
466 | * returns 0 if success | 466 | * returns 0 if success |
467 | */ | 467 | */ |
468 | int cpqhp_save_slot_config (struct controller *ctrl, struct pci_func *new_slot) | 468 | int cpqhp_save_slot_config(struct controller *ctrl, struct pci_func *new_slot) |
469 | { | 469 | { |
470 | long rc; | 470 | long rc; |
471 | u8 class_code; | 471 | u8 class_code; |
@@ -481,7 +481,7 @@ int cpqhp_save_slot_config (struct controller *ctrl, struct pci_func *new_slot) | |||
481 | ID = 0xFFFFFFFF; | 481 | ID = 0xFFFFFFFF; |
482 | 482 | ||
483 | ctrl->pci_bus->number = new_slot->bus; | 483 | ctrl->pci_bus->number = new_slot->bus; |
484 | pci_bus_read_config_dword (ctrl->pci_bus, PCI_DEVFN(new_slot->device, 0), PCI_VENDOR_ID, &ID); | 484 | pci_bus_read_config_dword(ctrl->pci_bus, PCI_DEVFN(new_slot->device, 0), PCI_VENDOR_ID, &ID); |
485 | 485 | ||
486 | if (ID == 0xFFFFFFFF) | 486 | if (ID == 0xFFFFFFFF) |
487 | return 2; | 487 | return 2; |
@@ -497,7 +497,7 @@ int cpqhp_save_slot_config (struct controller *ctrl, struct pci_func *new_slot) | |||
497 | while (function < max_functions) { | 497 | while (function < max_functions) { |
498 | if ((header_type & 0x7F) == PCI_HEADER_TYPE_BRIDGE) { | 498 | if ((header_type & 0x7F) == PCI_HEADER_TYPE_BRIDGE) { |
499 | /* Recurse the subordinate bus */ | 499 | /* Recurse the subordinate bus */ |
500 | pci_bus_read_config_byte (ctrl->pci_bus, PCI_DEVFN(new_slot->device, function), PCI_SECONDARY_BUS, &secondary_bus); | 500 | pci_bus_read_config_byte(ctrl->pci_bus, PCI_DEVFN(new_slot->device, function), PCI_SECONDARY_BUS, &secondary_bus); |
501 | 501 | ||
502 | sub_bus = (int) secondary_bus; | 502 | sub_bus = (int) secondary_bus; |
503 | 503 | ||
@@ -514,7 +514,7 @@ int cpqhp_save_slot_config (struct controller *ctrl, struct pci_func *new_slot) | |||
514 | new_slot->status = 0; | 514 | new_slot->status = 0; |
515 | 515 | ||
516 | for (cloop = 0; cloop < 0x20; cloop++) | 516 | for (cloop = 0; cloop < 0x20; cloop++) |
517 | pci_bus_read_config_dword(ctrl->pci_bus, PCI_DEVFN(new_slot->device, function), cloop << 2, (u32 *) & (new_slot-> config_space [cloop])); | 517 | pci_bus_read_config_dword(ctrl->pci_bus, PCI_DEVFN(new_slot->device, function), cloop << 2, (u32 *) &(new_slot->config_space[cloop])); |
518 | 518 | ||
519 | function++; | 519 | function++; |
520 | 520 | ||
@@ -571,10 +571,10 @@ int cpqhp_save_base_addr_length(struct controller *ctrl, struct pci_func *func) | |||
571 | devfn = PCI_DEVFN(func->device, func->function); | 571 | devfn = PCI_DEVFN(func->device, func->function); |
572 | 572 | ||
573 | /* Check for Bridge */ | 573 | /* Check for Bridge */ |
574 | pci_bus_read_config_byte (pci_bus, devfn, PCI_HEADER_TYPE, &header_type); | 574 | pci_bus_read_config_byte(pci_bus, devfn, PCI_HEADER_TYPE, &header_type); |
575 | 575 | ||
576 | if ((header_type & 0x7F) == PCI_HEADER_TYPE_BRIDGE) { | 576 | if ((header_type & 0x7F) == PCI_HEADER_TYPE_BRIDGE) { |
577 | pci_bus_read_config_byte (pci_bus, devfn, PCI_SECONDARY_BUS, &secondary_bus); | 577 | pci_bus_read_config_byte(pci_bus, devfn, PCI_SECONDARY_BUS, &secondary_bus); |
578 | 578 | ||
579 | sub_bus = (int) secondary_bus; | 579 | sub_bus = (int) secondary_bus; |
580 | 580 | ||
@@ -595,8 +595,8 @@ int cpqhp_save_base_addr_length(struct controller *ctrl, struct pci_func *func) | |||
595 | */ | 595 | */ |
596 | for (cloop = 0x10; cloop <= 0x14; cloop += 4) { | 596 | for (cloop = 0x10; cloop <= 0x14; cloop += 4) { |
597 | temp_register = 0xFFFFFFFF; | 597 | temp_register = 0xFFFFFFFF; |
598 | pci_bus_write_config_dword (pci_bus, devfn, cloop, temp_register); | 598 | pci_bus_write_config_dword(pci_bus, devfn, cloop, temp_register); |
599 | pci_bus_read_config_dword (pci_bus, devfn, cloop, &base); | 599 | pci_bus_read_config_dword(pci_bus, devfn, cloop, &base); |
600 | /* If this register is implemented */ | 600 | /* If this register is implemented */ |
601 | if (base) { | 601 | if (base) { |
602 | if (base & 0x01L) { | 602 | if (base & 0x01L) { |
@@ -631,8 +631,8 @@ int cpqhp_save_base_addr_length(struct controller *ctrl, struct pci_func *func) | |||
631 | /* Figure out IO and memory base lengths */ | 631 | /* Figure out IO and memory base lengths */ |
632 | for (cloop = 0x10; cloop <= 0x24; cloop += 4) { | 632 | for (cloop = 0x10; cloop <= 0x24; cloop += 4) { |
633 | temp_register = 0xFFFFFFFF; | 633 | temp_register = 0xFFFFFFFF; |
634 | pci_bus_write_config_dword (pci_bus, devfn, cloop, temp_register); | 634 | pci_bus_write_config_dword(pci_bus, devfn, cloop, temp_register); |
635 | pci_bus_read_config_dword (pci_bus, devfn, cloop, &base); | 635 | pci_bus_read_config_dword(pci_bus, devfn, cloop, &base); |
636 | 636 | ||
637 | /* If this register is implemented */ | 637 | /* If this register is implemented */ |
638 | if (base) { | 638 | if (base) { |
@@ -686,7 +686,7 @@ int cpqhp_save_base_addr_length(struct controller *ctrl, struct pci_func *func) | |||
686 | * | 686 | * |
687 | * returns 0 if success | 687 | * returns 0 if success |
688 | */ | 688 | */ |
689 | int cpqhp_save_used_resources (struct controller *ctrl, struct pci_func *func) | 689 | int cpqhp_save_used_resources(struct controller *ctrl, struct pci_func *func) |
690 | { | 690 | { |
691 | u8 cloop; | 691 | u8 cloop; |
692 | u8 header_type; | 692 | u8 header_type; |
@@ -791,7 +791,7 @@ int cpqhp_save_used_resources (struct controller *ctrl, struct pci_func *func) | |||
791 | } | 791 | } |
792 | /* Figure out IO and memory base lengths */ | 792 | /* Figure out IO and memory base lengths */ |
793 | for (cloop = 0x10; cloop <= 0x14; cloop += 4) { | 793 | for (cloop = 0x10; cloop <= 0x14; cloop += 4) { |
794 | pci_bus_read_config_dword (pci_bus, devfn, cloop, &save_base); | 794 | pci_bus_read_config_dword(pci_bus, devfn, cloop, &save_base); |
795 | 795 | ||
796 | temp_register = 0xFFFFFFFF; | 796 | temp_register = 0xFFFFFFFF; |
797 | pci_bus_write_config_dword(pci_bus, devfn, cloop, temp_register); | 797 | pci_bus_write_config_dword(pci_bus, devfn, cloop, temp_register); |
@@ -972,13 +972,13 @@ int cpqhp_configure_board(struct controller *ctrl, struct pci_func *func) | |||
972 | * registers are programmed last | 972 | * registers are programmed last |
973 | */ | 973 | */ |
974 | for (cloop = 0x3C; cloop > 0; cloop -= 4) | 974 | for (cloop = 0x3C; cloop > 0; cloop -= 4) |
975 | pci_bus_write_config_dword (pci_bus, devfn, cloop, func->config_space[cloop >> 2]); | 975 | pci_bus_write_config_dword(pci_bus, devfn, cloop, func->config_space[cloop >> 2]); |
976 | 976 | ||
977 | pci_bus_read_config_byte (pci_bus, devfn, PCI_HEADER_TYPE, &header_type); | 977 | pci_bus_read_config_byte(pci_bus, devfn, PCI_HEADER_TYPE, &header_type); |
978 | 978 | ||
979 | /* If this is a bridge device, restore subordinate devices */ | 979 | /* If this is a bridge device, restore subordinate devices */ |
980 | if ((header_type & 0x7F) == PCI_HEADER_TYPE_BRIDGE) { | 980 | if ((header_type & 0x7F) == PCI_HEADER_TYPE_BRIDGE) { |
981 | pci_bus_read_config_byte (pci_bus, devfn, PCI_SECONDARY_BUS, &secondary_bus); | 981 | pci_bus_read_config_byte(pci_bus, devfn, PCI_SECONDARY_BUS, &secondary_bus); |
982 | 982 | ||
983 | sub_bus = (int) secondary_bus; | 983 | sub_bus = (int) secondary_bus; |
984 | 984 | ||
@@ -998,7 +998,7 @@ int cpqhp_configure_board(struct controller *ctrl, struct pci_func *func) | |||
998 | */ | 998 | */ |
999 | 999 | ||
1000 | for (cloop = 16; cloop < 40; cloop += 4) { | 1000 | for (cloop = 16; cloop < 40; cloop += 4) { |
1001 | pci_bus_read_config_dword (pci_bus, devfn, cloop, &temp); | 1001 | pci_bus_read_config_dword(pci_bus, devfn, cloop, &temp); |
1002 | 1002 | ||
1003 | if (temp != func->config_space[cloop >> 2]) { | 1003 | if (temp != func->config_space[cloop >> 2]) { |
1004 | dbg("Config space compare failure!!! offset = %x\n", cloop); | 1004 | dbg("Config space compare failure!!! offset = %x\n", cloop); |
@@ -1050,7 +1050,7 @@ int cpqhp_valid_replace(struct controller *ctrl, struct pci_func *func) | |||
1050 | pci_bus->number = func->bus; | 1050 | pci_bus->number = func->bus; |
1051 | devfn = PCI_DEVFN(func->device, func->function); | 1051 | devfn = PCI_DEVFN(func->device, func->function); |
1052 | 1052 | ||
1053 | pci_bus_read_config_dword (pci_bus, devfn, PCI_VENDOR_ID, &temp_register); | 1053 | pci_bus_read_config_dword(pci_bus, devfn, PCI_VENDOR_ID, &temp_register); |
1054 | 1054 | ||
1055 | /* No adapter present */ | 1055 | /* No adapter present */ |
1056 | if (temp_register == 0xFFFFFFFF) | 1056 | if (temp_register == 0xFFFFFFFF) |
@@ -1060,14 +1060,14 @@ int cpqhp_valid_replace(struct controller *ctrl, struct pci_func *func) | |||
1060 | return(ADAPTER_NOT_SAME); | 1060 | return(ADAPTER_NOT_SAME); |
1061 | 1061 | ||
1062 | /* Check for same revision number and class code */ | 1062 | /* Check for same revision number and class code */ |
1063 | pci_bus_read_config_dword (pci_bus, devfn, PCI_CLASS_REVISION, &temp_register); | 1063 | pci_bus_read_config_dword(pci_bus, devfn, PCI_CLASS_REVISION, &temp_register); |
1064 | 1064 | ||
1065 | /* Adapter not the same */ | 1065 | /* Adapter not the same */ |
1066 | if (temp_register != func->config_space[0x08 >> 2]) | 1066 | if (temp_register != func->config_space[0x08 >> 2]) |
1067 | return(ADAPTER_NOT_SAME); | 1067 | return(ADAPTER_NOT_SAME); |
1068 | 1068 | ||
1069 | /* Check for Bridge */ | 1069 | /* Check for Bridge */ |
1070 | pci_bus_read_config_byte (pci_bus, devfn, PCI_HEADER_TYPE, &header_type); | 1070 | pci_bus_read_config_byte(pci_bus, devfn, PCI_HEADER_TYPE, &header_type); |
1071 | 1071 | ||
1072 | if ((header_type & 0x7F) == PCI_HEADER_TYPE_BRIDGE) { | 1072 | if ((header_type & 0x7F) == PCI_HEADER_TYPE_BRIDGE) { |
1073 | /* In order to continue checking, we must program the | 1073 | /* In order to continue checking, we must program the |
@@ -1076,7 +1076,7 @@ int cpqhp_valid_replace(struct controller *ctrl, struct pci_func *func) | |||
1076 | */ | 1076 | */ |
1077 | 1077 | ||
1078 | temp_register = func->config_space[0x18 >> 2]; | 1078 | temp_register = func->config_space[0x18 >> 2]; |
1079 | pci_bus_write_config_dword (pci_bus, devfn, PCI_PRIMARY_BUS, temp_register); | 1079 | pci_bus_write_config_dword(pci_bus, devfn, PCI_PRIMARY_BUS, temp_register); |
1080 | 1080 | ||
1081 | secondary_bus = (temp_register >> 8) & 0xFF; | 1081 | secondary_bus = (temp_register >> 8) & 0xFF; |
1082 | 1082 | ||
@@ -1094,7 +1094,7 @@ int cpqhp_valid_replace(struct controller *ctrl, struct pci_func *func) | |||
1094 | /* Check to see if it is a standard config header */ | 1094 | /* Check to see if it is a standard config header */ |
1095 | else if ((header_type & 0x7F) == PCI_HEADER_TYPE_NORMAL) { | 1095 | else if ((header_type & 0x7F) == PCI_HEADER_TYPE_NORMAL) { |
1096 | /* Check subsystem vendor and ID */ | 1096 | /* Check subsystem vendor and ID */ |
1097 | pci_bus_read_config_dword (pci_bus, devfn, PCI_SUBSYSTEM_VENDOR_ID, &temp_register); | 1097 | pci_bus_read_config_dword(pci_bus, devfn, PCI_SUBSYSTEM_VENDOR_ID, &temp_register); |
1098 | 1098 | ||
1099 | if (temp_register != func->config_space[0x2C >> 2]) { | 1099 | if (temp_register != func->config_space[0x2C >> 2]) { |
1100 | /* If it's a SMART-2 and the register isn't | 1100 | /* If it's a SMART-2 and the register isn't |
@@ -1108,8 +1108,8 @@ int cpqhp_valid_replace(struct controller *ctrl, struct pci_func *func) | |||
1108 | /* Figure out IO and memory base lengths */ | 1108 | /* Figure out IO and memory base lengths */ |
1109 | for (cloop = 0x10; cloop <= 0x24; cloop += 4) { | 1109 | for (cloop = 0x10; cloop <= 0x24; cloop += 4) { |
1110 | temp_register = 0xFFFFFFFF; | 1110 | temp_register = 0xFFFFFFFF; |
1111 | pci_bus_write_config_dword (pci_bus, devfn, cloop, temp_register); | 1111 | pci_bus_write_config_dword(pci_bus, devfn, cloop, temp_register); |
1112 | pci_bus_read_config_dword (pci_bus, devfn, cloop, &base); | 1112 | pci_bus_read_config_dword(pci_bus, devfn, cloop, &base); |
1113 | 1113 | ||
1114 | /* If this register is implemented */ | 1114 | /* If this register is implemented */ |
1115 | if (base) { | 1115 | if (base) { |
@@ -1234,7 +1234,7 @@ int cpqhp_find_available_resources(struct controller *ctrl, void __iomem *rom_st | |||
1234 | if (rc) | 1234 | if (rc) |
1235 | return rc; | 1235 | return rc; |
1236 | 1236 | ||
1237 | one_slot = rom_resource_table + sizeof (struct hrt); | 1237 | one_slot = rom_resource_table + sizeof(struct hrt); |
1238 | 1238 | ||
1239 | i = readb(rom_resource_table + NUMBER_OF_ENTRIES); | 1239 | i = readb(rom_resource_table + NUMBER_OF_ENTRIES); |
1240 | dbg("number_of_entries = %d\n", i); | 1240 | dbg("number_of_entries = %d\n", i); |
@@ -1263,12 +1263,12 @@ int cpqhp_find_available_resources(struct controller *ctrl, void __iomem *rom_st | |||
1263 | /* If this entry isn't for our controller's bus, ignore it */ | 1263 | /* If this entry isn't for our controller's bus, ignore it */ |
1264 | if (primary_bus != ctrl->bus) { | 1264 | if (primary_bus != ctrl->bus) { |
1265 | i--; | 1265 | i--; |
1266 | one_slot += sizeof (struct slot_rt); | 1266 | one_slot += sizeof(struct slot_rt); |
1267 | continue; | 1267 | continue; |
1268 | } | 1268 | } |
1269 | /* find out if this entry is for an occupied slot */ | 1269 | /* find out if this entry is for an occupied slot */ |
1270 | ctrl->pci_bus->number = primary_bus; | 1270 | ctrl->pci_bus->number = primary_bus; |
1271 | pci_bus_read_config_dword (ctrl->pci_bus, dev_func, PCI_VENDOR_ID, &temp_dword); | 1271 | pci_bus_read_config_dword(ctrl->pci_bus, dev_func, PCI_VENDOR_ID, &temp_dword); |
1272 | dbg("temp_D_word = %x\n", temp_dword); | 1272 | dbg("temp_D_word = %x\n", temp_dword); |
1273 | 1273 | ||
1274 | if (temp_dword != 0xFFFFFFFF) { | 1274 | if (temp_dword != 0xFFFFFFFF) { |
@@ -1283,7 +1283,7 @@ int cpqhp_find_available_resources(struct controller *ctrl, void __iomem *rom_st | |||
1283 | /* If we can't find a match, skip this table entry */ | 1283 | /* If we can't find a match, skip this table entry */ |
1284 | if (!func) { | 1284 | if (!func) { |
1285 | i--; | 1285 | i--; |
1286 | one_slot += sizeof (struct slot_rt); | 1286 | one_slot += sizeof(struct slot_rt); |
1287 | continue; | 1287 | continue; |
1288 | } | 1288 | } |
1289 | /* this may not work and shouldn't be used */ | 1289 | /* this may not work and shouldn't be used */ |
@@ -1395,7 +1395,7 @@ int cpqhp_find_available_resources(struct controller *ctrl, void __iomem *rom_st | |||
1395 | } | 1395 | } |
1396 | 1396 | ||
1397 | i--; | 1397 | i--; |
1398 | one_slot += sizeof (struct slot_rt); | 1398 | one_slot += sizeof(struct slot_rt); |
1399 | } | 1399 | } |
1400 | 1400 | ||
1401 | /* If all of the following fail, we don't have any resources for | 1401 | /* If all of the following fail, we don't have any resources for |
@@ -1475,7 +1475,7 @@ int cpqhp_return_board_resources(struct pci_func *func, struct resource_lists *r | |||
1475 | * | 1475 | * |
1476 | * Puts node back in the resource list pointed to by head | 1476 | * Puts node back in the resource list pointed to by head |
1477 | */ | 1477 | */ |
1478 | void cpqhp_destroy_resource_list (struct resource_lists *resources) | 1478 | void cpqhp_destroy_resource_list(struct resource_lists *resources) |
1479 | { | 1479 | { |
1480 | struct pci_resource *res, *tres; | 1480 | struct pci_resource *res, *tres; |
1481 | 1481 | ||
@@ -1522,7 +1522,7 @@ void cpqhp_destroy_resource_list (struct resource_lists *resources) | |||
1522 | * | 1522 | * |
1523 | * Puts node back in the resource list pointed to by head | 1523 | * Puts node back in the resource list pointed to by head |
1524 | */ | 1524 | */ |
1525 | void cpqhp_destroy_board_resources (struct pci_func *func) | 1525 | void cpqhp_destroy_board_resources(struct pci_func *func) |
1526 | { | 1526 | { |
1527 | struct pci_resource *res, *tres; | 1527 | struct pci_resource *res, *tres; |
1528 | 1528 | ||
diff --git a/drivers/pci/hotplug/cpqphp_sysfs.c b/drivers/pci/hotplug/cpqphp_sysfs.c index d81648f71425..775974deda74 100644 --- a/drivers/pci/hotplug/cpqphp_sysfs.c +++ b/drivers/pci/hotplug/cpqphp_sysfs.c | |||
@@ -39,7 +39,7 @@ | |||
39 | #include "cpqphp.h" | 39 | #include "cpqphp.h" |
40 | 40 | ||
41 | static DEFINE_MUTEX(cpqphp_mutex); | 41 | static DEFINE_MUTEX(cpqphp_mutex); |
42 | static int show_ctrl (struct controller *ctrl, char *buf) | 42 | static int show_ctrl(struct controller *ctrl, char *buf) |
43 | { | 43 | { |
44 | char *out = buf; | 44 | char *out = buf; |
45 | int index; | 45 | int index; |
@@ -77,7 +77,7 @@ static int show_ctrl (struct controller *ctrl, char *buf) | |||
77 | return out - buf; | 77 | return out - buf; |
78 | } | 78 | } |
79 | 79 | ||
80 | static int show_dev (struct controller *ctrl, char *buf) | 80 | static int show_dev(struct controller *ctrl, char *buf) |
81 | { | 81 | { |
82 | char *out = buf; | 82 | char *out = buf; |
83 | int index; | 83 | int index; |
@@ -119,7 +119,7 @@ static int show_dev (struct controller *ctrl, char *buf) | |||
119 | out += sprintf(out, "start = %8.8x, length = %8.8x\n", res->base, res->length); | 119 | out += sprintf(out, "start = %8.8x, length = %8.8x\n", res->base, res->length); |
120 | res = res->next; | 120 | res = res->next; |
121 | } | 121 | } |
122 | slot=slot->next; | 122 | slot = slot->next; |
123 | } | 123 | } |
124 | 124 | ||
125 | return out - buf; | 125 | return out - buf; |
diff --git a/drivers/pci/hotplug/ibmphp.h b/drivers/pci/hotplug/ibmphp.h index e3e46a7b3ee7..d3256838cb05 100644 --- a/drivers/pci/hotplug/ibmphp.h +++ b/drivers/pci/hotplug/ibmphp.h | |||
@@ -39,11 +39,11 @@ extern int ibmphp_debug; | |||
39 | #else | 39 | #else |
40 | #define MY_NAME THIS_MODULE->name | 40 | #define MY_NAME THIS_MODULE->name |
41 | #endif | 41 | #endif |
42 | #define debug(fmt, arg...) do { if (ibmphp_debug == 1) printk(KERN_DEBUG "%s: " fmt , MY_NAME , ## arg); } while (0) | 42 | #define debug(fmt, arg...) do { if (ibmphp_debug == 1) printk(KERN_DEBUG "%s: " fmt, MY_NAME, ## arg); } while (0) |
43 | #define debug_pci(fmt, arg...) do { if (ibmphp_debug) printk(KERN_DEBUG "%s: " fmt , MY_NAME , ## arg); } while (0) | 43 | #define debug_pci(fmt, arg...) do { if (ibmphp_debug) printk(KERN_DEBUG "%s: " fmt, MY_NAME, ## arg); } while (0) |
44 | #define err(format, arg...) printk(KERN_ERR "%s: " format , MY_NAME , ## arg) | 44 | #define err(format, arg...) printk(KERN_ERR "%s: " format, MY_NAME, ## arg) |
45 | #define info(format, arg...) printk(KERN_INFO "%s: " format , MY_NAME , ## arg) | 45 | #define info(format, arg...) printk(KERN_INFO "%s: " format, MY_NAME, ## arg) |
46 | #define warn(format, arg...) printk(KERN_WARNING "%s: " format , MY_NAME , ## arg) | 46 | #define warn(format, arg...) printk(KERN_WARNING "%s: " format, MY_NAME, ## arg) |
47 | 47 | ||
48 | 48 | ||
49 | /* EBDA stuff */ | 49 | /* EBDA stuff */ |
@@ -603,7 +603,7 @@ void ibmphp_hpc_stop_poll_thread(void); | |||
603 | #define SLOT_CONNECT(s) ((u8) ((s & HPC_SLOT_CONNECT) \ | 603 | #define SLOT_CONNECT(s) ((u8) ((s & HPC_SLOT_CONNECT) \ |
604 | ? HPC_SLOT_DISCONNECTED : HPC_SLOT_CONNECTED)) | 604 | ? HPC_SLOT_DISCONNECTED : HPC_SLOT_CONNECTED)) |
605 | 605 | ||
606 | #define SLOT_ATTN(s,es) ((u8) ((es & HPC_SLOT_BLINK_ATTN) \ | 606 | #define SLOT_ATTN(s, es) ((u8) ((es & HPC_SLOT_BLINK_ATTN) \ |
607 | ? HPC_SLOT_ATTN_BLINK \ | 607 | ? HPC_SLOT_ATTN_BLINK \ |
608 | : ((s & HPC_SLOT_ATTN) ? HPC_SLOT_ATTN_ON : HPC_SLOT_ATTN_OFF))) | 608 | : ((s & HPC_SLOT_ATTN) ? HPC_SLOT_ATTN_ON : HPC_SLOT_ATTN_OFF))) |
609 | 609 | ||
diff --git a/drivers/pci/hotplug/ibmphp_core.c b/drivers/pci/hotplug/ibmphp_core.c index 15302475f5b7..4504d3ee86c9 100644 --- a/drivers/pci/hotplug/ibmphp_core.c +++ b/drivers/pci/hotplug/ibmphp_core.c | |||
@@ -39,11 +39,11 @@ | |||
39 | #include <asm/io_apic.h> | 39 | #include <asm/io_apic.h> |
40 | #include "ibmphp.h" | 40 | #include "ibmphp.h" |
41 | 41 | ||
42 | #define attn_on(sl) ibmphp_hpc_writeslot (sl, HPC_SLOT_ATTNON) | 42 | #define attn_on(sl) ibmphp_hpc_writeslot(sl, HPC_SLOT_ATTNON) |
43 | #define attn_off(sl) ibmphp_hpc_writeslot (sl, HPC_SLOT_ATTNOFF) | 43 | #define attn_off(sl) ibmphp_hpc_writeslot(sl, HPC_SLOT_ATTNOFF) |
44 | #define attn_LED_blink(sl) ibmphp_hpc_writeslot (sl, HPC_SLOT_BLINKLED) | 44 | #define attn_LED_blink(sl) ibmphp_hpc_writeslot(sl, HPC_SLOT_BLINKLED) |
45 | #define get_ctrl_revision(sl, rev) ibmphp_hpc_readslot (sl, READ_REVLEVEL, rev) | 45 | #define get_ctrl_revision(sl, rev) ibmphp_hpc_readslot(sl, READ_REVLEVEL, rev) |
46 | #define get_hpc_options(sl, opt) ibmphp_hpc_readslot (sl, READ_HPCOPTIONS, opt) | 46 | #define get_hpc_options(sl, opt) ibmphp_hpc_readslot(sl, READ_HPCOPTIONS, opt) |
47 | 47 | ||
48 | #define DRIVER_VERSION "0.6" | 48 | #define DRIVER_VERSION "0.6" |
49 | #define DRIVER_DESC "IBM Hot Plug PCI Controller Driver" | 49 | #define DRIVER_DESC "IBM Hot Plug PCI Controller Driver" |
@@ -52,9 +52,9 @@ int ibmphp_debug; | |||
52 | 52 | ||
53 | static bool debug; | 53 | static bool debug; |
54 | module_param(debug, bool, S_IRUGO | S_IWUSR); | 54 | module_param(debug, bool, S_IRUGO | S_IWUSR); |
55 | MODULE_PARM_DESC (debug, "Debugging mode enabled or not"); | 55 | MODULE_PARM_DESC(debug, "Debugging mode enabled or not"); |
56 | MODULE_LICENSE ("GPL"); | 56 | MODULE_LICENSE("GPL"); |
57 | MODULE_DESCRIPTION (DRIVER_DESC); | 57 | MODULE_DESCRIPTION(DRIVER_DESC); |
58 | 58 | ||
59 | struct pci_bus *ibmphp_pci_bus; | 59 | struct pci_bus *ibmphp_pci_bus; |
60 | static int max_slots; | 60 | static int max_slots; |
@@ -113,7 +113,7 @@ static inline int slot_update(struct slot **sl) | |||
113 | return rc; | 113 | return rc; |
114 | } | 114 | } |
115 | 115 | ||
116 | static int __init get_max_slots (void) | 116 | static int __init get_max_slots(void) |
117 | { | 117 | { |
118 | struct slot *slot_cur; | 118 | struct slot *slot_cur; |
119 | struct list_head *tmp; | 119 | struct list_head *tmp; |
@@ -459,7 +459,7 @@ static int get_max_adapter_speed_1(struct hotplug_slot *hotplug_slot, u8 *value, | |||
459 | *value = SLOT_SPEED(myslot.ext_status); | 459 | *value = SLOT_SPEED(myslot.ext_status); |
460 | } else | 460 | } else |
461 | *value = MAX_ADAPTER_NONE; | 461 | *value = MAX_ADAPTER_NONE; |
462 | } | 462 | } |
463 | } | 463 | } |
464 | 464 | ||
465 | if (flag) | 465 | if (flag) |
@@ -620,11 +620,11 @@ int ibmphp_update_slot_info(struct slot *slot_cur) | |||
620 | info->attention_status = SLOT_ATTN(slot_cur->status, | 620 | info->attention_status = SLOT_ATTN(slot_cur->status, |
621 | slot_cur->ext_status); | 621 | slot_cur->ext_status); |
622 | info->latch_status = SLOT_LATCH(slot_cur->status); | 622 | info->latch_status = SLOT_LATCH(slot_cur->status); |
623 | if (!SLOT_PRESENT(slot_cur->status)) { | 623 | if (!SLOT_PRESENT(slot_cur->status)) { |
624 | info->adapter_status = 0; | 624 | info->adapter_status = 0; |
625 | /* info->max_adapter_speed_status = MAX_ADAPTER_NONE; */ | 625 | /* info->max_adapter_speed_status = MAX_ADAPTER_NONE; */ |
626 | } else { | 626 | } else { |
627 | info->adapter_status = 1; | 627 | info->adapter_status = 1; |
628 | /* get_max_adapter_speed_1(slot_cur->hotplug_slot, | 628 | /* get_max_adapter_speed_1(slot_cur->hotplug_slot, |
629 | &info->max_adapter_speed_status, 0); */ | 629 | &info->max_adapter_speed_status, 0); */ |
630 | } | 630 | } |
@@ -866,7 +866,7 @@ static int set_bus(struct slot *slot_cur) | |||
866 | int retval; | 866 | int retval; |
867 | static struct pci_device_id ciobx[] = { | 867 | static struct pci_device_id ciobx[] = { |
868 | { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, 0x0101) }, | 868 | { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, 0x0101) }, |
869 | { }, | 869 | { }, |
870 | }; | 870 | }; |
871 | 871 | ||
872 | debug("%s - entry slot # %d\n", __func__, slot_cur->number); | 872 | debug("%s - entry slot # %d\n", __func__, slot_cur->number); |
@@ -1182,7 +1182,7 @@ error_power: | |||
1182 | * HOT REMOVING ADAPTER CARD * | 1182 | * HOT REMOVING ADAPTER CARD * |
1183 | * INPUT: POINTER TO THE HOTPLUG SLOT STRUCTURE * | 1183 | * INPUT: POINTER TO THE HOTPLUG SLOT STRUCTURE * |
1184 | * OUTPUT: SUCCESS 0 ; FAILURE: UNCONFIGURE , VALIDATE * | 1184 | * OUTPUT: SUCCESS 0 ; FAILURE: UNCONFIGURE , VALIDATE * |
1185 | DISABLE POWER , * | 1185 | * DISABLE POWER , * |
1186 | **************************************************************/ | 1186 | **************************************************************/ |
1187 | static int ibmphp_disable_slot(struct hotplug_slot *hotplug_slot) | 1187 | static int ibmphp_disable_slot(struct hotplug_slot *hotplug_slot) |
1188 | { | 1188 | { |
diff --git a/drivers/pci/hotplug/ibmphp_ebda.c b/drivers/pci/hotplug/ibmphp_ebda.c index d9b197d5c6b4..bb72b0ae9c6a 100644 --- a/drivers/pci/hotplug/ibmphp_ebda.c +++ b/drivers/pci/hotplug/ibmphp_ebda.c | |||
@@ -49,32 +49,32 @@ | |||
49 | */ | 49 | */ |
50 | 50 | ||
51 | /* Global lists */ | 51 | /* Global lists */ |
52 | LIST_HEAD (ibmphp_ebda_pci_rsrc_head); | 52 | LIST_HEAD(ibmphp_ebda_pci_rsrc_head); |
53 | LIST_HEAD (ibmphp_slot_head); | 53 | LIST_HEAD(ibmphp_slot_head); |
54 | 54 | ||
55 | /* Local variables */ | 55 | /* Local variables */ |
56 | static struct ebda_hpc_list *hpc_list_ptr; | 56 | static struct ebda_hpc_list *hpc_list_ptr; |
57 | static struct ebda_rsrc_list *rsrc_list_ptr; | 57 | static struct ebda_rsrc_list *rsrc_list_ptr; |
58 | static struct rio_table_hdr *rio_table_ptr = NULL; | 58 | static struct rio_table_hdr *rio_table_ptr = NULL; |
59 | static LIST_HEAD (ebda_hpc_head); | 59 | static LIST_HEAD(ebda_hpc_head); |
60 | static LIST_HEAD (bus_info_head); | 60 | static LIST_HEAD(bus_info_head); |
61 | static LIST_HEAD (rio_vg_head); | 61 | static LIST_HEAD(rio_vg_head); |
62 | static LIST_HEAD (rio_lo_head); | 62 | static LIST_HEAD(rio_lo_head); |
63 | static LIST_HEAD (opt_vg_head); | 63 | static LIST_HEAD(opt_vg_head); |
64 | static LIST_HEAD (opt_lo_head); | 64 | static LIST_HEAD(opt_lo_head); |
65 | static void __iomem *io_mem; | 65 | static void __iomem *io_mem; |
66 | 66 | ||
67 | /* Local functions */ | 67 | /* Local functions */ |
68 | static int ebda_rsrc_controller (void); | 68 | static int ebda_rsrc_controller(void); |
69 | static int ebda_rsrc_rsrc (void); | 69 | static int ebda_rsrc_rsrc(void); |
70 | static int ebda_rio_table (void); | 70 | static int ebda_rio_table(void); |
71 | 71 | ||
72 | static struct ebda_hpc_list * __init alloc_ebda_hpc_list (void) | 72 | static struct ebda_hpc_list * __init alloc_ebda_hpc_list(void) |
73 | { | 73 | { |
74 | return kzalloc(sizeof(struct ebda_hpc_list), GFP_KERNEL); | 74 | return kzalloc(sizeof(struct ebda_hpc_list), GFP_KERNEL); |
75 | } | 75 | } |
76 | 76 | ||
77 | static struct controller *alloc_ebda_hpc (u32 slot_count, u32 bus_count) | 77 | static struct controller *alloc_ebda_hpc(u32 slot_count, u32 bus_count) |
78 | { | 78 | { |
79 | struct controller *controller; | 79 | struct controller *controller; |
80 | struct ebda_hpc_slot *slots; | 80 | struct ebda_hpc_slot *slots; |
@@ -103,146 +103,146 @@ error: | |||
103 | return NULL; | 103 | return NULL; |
104 | } | 104 | } |
105 | 105 | ||
106 | static void free_ebda_hpc (struct controller *controller) | 106 | static void free_ebda_hpc(struct controller *controller) |
107 | { | 107 | { |
108 | kfree (controller->slots); | 108 | kfree(controller->slots); |
109 | kfree (controller->buses); | 109 | kfree(controller->buses); |
110 | kfree (controller); | 110 | kfree(controller); |
111 | } | 111 | } |
112 | 112 | ||
113 | static struct ebda_rsrc_list * __init alloc_ebda_rsrc_list (void) | 113 | static struct ebda_rsrc_list * __init alloc_ebda_rsrc_list(void) |
114 | { | 114 | { |
115 | return kzalloc(sizeof(struct ebda_rsrc_list), GFP_KERNEL); | 115 | return kzalloc(sizeof(struct ebda_rsrc_list), GFP_KERNEL); |
116 | } | 116 | } |
117 | 117 | ||
118 | static struct ebda_pci_rsrc *alloc_ebda_pci_rsrc (void) | 118 | static struct ebda_pci_rsrc *alloc_ebda_pci_rsrc(void) |
119 | { | 119 | { |
120 | return kzalloc(sizeof(struct ebda_pci_rsrc), GFP_KERNEL); | 120 | return kzalloc(sizeof(struct ebda_pci_rsrc), GFP_KERNEL); |
121 | } | 121 | } |
122 | 122 | ||
123 | static void __init print_bus_info (void) | 123 | static void __init print_bus_info(void) |
124 | { | 124 | { |
125 | struct bus_info *ptr; | 125 | struct bus_info *ptr; |
126 | 126 | ||
127 | list_for_each_entry(ptr, &bus_info_head, bus_info_list) { | 127 | list_for_each_entry(ptr, &bus_info_head, bus_info_list) { |
128 | debug ("%s - slot_min = %x\n", __func__, ptr->slot_min); | 128 | debug("%s - slot_min = %x\n", __func__, ptr->slot_min); |
129 | debug ("%s - slot_max = %x\n", __func__, ptr->slot_max); | 129 | debug("%s - slot_max = %x\n", __func__, ptr->slot_max); |
130 | debug ("%s - slot_count = %x\n", __func__, ptr->slot_count); | 130 | debug("%s - slot_count = %x\n", __func__, ptr->slot_count); |
131 | debug ("%s - bus# = %x\n", __func__, ptr->busno); | 131 | debug("%s - bus# = %x\n", __func__, ptr->busno); |
132 | debug ("%s - current_speed = %x\n", __func__, ptr->current_speed); | 132 | debug("%s - current_speed = %x\n", __func__, ptr->current_speed); |
133 | debug ("%s - controller_id = %x\n", __func__, ptr->controller_id); | 133 | debug("%s - controller_id = %x\n", __func__, ptr->controller_id); |
134 | 134 | ||
135 | debug ("%s - slots_at_33_conv = %x\n", __func__, ptr->slots_at_33_conv); | 135 | debug("%s - slots_at_33_conv = %x\n", __func__, ptr->slots_at_33_conv); |
136 | debug ("%s - slots_at_66_conv = %x\n", __func__, ptr->slots_at_66_conv); | 136 | debug("%s - slots_at_66_conv = %x\n", __func__, ptr->slots_at_66_conv); |
137 | debug ("%s - slots_at_66_pcix = %x\n", __func__, ptr->slots_at_66_pcix); | 137 | debug("%s - slots_at_66_pcix = %x\n", __func__, ptr->slots_at_66_pcix); |
138 | debug ("%s - slots_at_100_pcix = %x\n", __func__, ptr->slots_at_100_pcix); | 138 | debug("%s - slots_at_100_pcix = %x\n", __func__, ptr->slots_at_100_pcix); |
139 | debug ("%s - slots_at_133_pcix = %x\n", __func__, ptr->slots_at_133_pcix); | 139 | debug("%s - slots_at_133_pcix = %x\n", __func__, ptr->slots_at_133_pcix); |
140 | 140 | ||
141 | } | 141 | } |
142 | } | 142 | } |
143 | 143 | ||
144 | static void print_lo_info (void) | 144 | static void print_lo_info(void) |
145 | { | 145 | { |
146 | struct rio_detail *ptr; | 146 | struct rio_detail *ptr; |
147 | debug ("print_lo_info ----\n"); | 147 | debug("print_lo_info ----\n"); |
148 | list_for_each_entry(ptr, &rio_lo_head, rio_detail_list) { | 148 | list_for_each_entry(ptr, &rio_lo_head, rio_detail_list) { |
149 | debug ("%s - rio_node_id = %x\n", __func__, ptr->rio_node_id); | 149 | debug("%s - rio_node_id = %x\n", __func__, ptr->rio_node_id); |
150 | debug ("%s - rio_type = %x\n", __func__, ptr->rio_type); | 150 | debug("%s - rio_type = %x\n", __func__, ptr->rio_type); |
151 | debug ("%s - owner_id = %x\n", __func__, ptr->owner_id); | 151 | debug("%s - owner_id = %x\n", __func__, ptr->owner_id); |
152 | debug ("%s - first_slot_num = %x\n", __func__, ptr->first_slot_num); | 152 | debug("%s - first_slot_num = %x\n", __func__, ptr->first_slot_num); |
153 | debug ("%s - wpindex = %x\n", __func__, ptr->wpindex); | 153 | debug("%s - wpindex = %x\n", __func__, ptr->wpindex); |
154 | debug ("%s - chassis_num = %x\n", __func__, ptr->chassis_num); | 154 | debug("%s - chassis_num = %x\n", __func__, ptr->chassis_num); |
155 | 155 | ||
156 | } | 156 | } |
157 | } | 157 | } |
158 | 158 | ||
159 | static void print_vg_info (void) | 159 | static void print_vg_info(void) |
160 | { | 160 | { |
161 | struct rio_detail *ptr; | 161 | struct rio_detail *ptr; |
162 | debug ("%s ---\n", __func__); | 162 | debug("%s ---\n", __func__); |
163 | list_for_each_entry(ptr, &rio_vg_head, rio_detail_list) { | 163 | list_for_each_entry(ptr, &rio_vg_head, rio_detail_list) { |
164 | debug ("%s - rio_node_id = %x\n", __func__, ptr->rio_node_id); | 164 | debug("%s - rio_node_id = %x\n", __func__, ptr->rio_node_id); |
165 | debug ("%s - rio_type = %x\n", __func__, ptr->rio_type); | 165 | debug("%s - rio_type = %x\n", __func__, ptr->rio_type); |
166 | debug ("%s - owner_id = %x\n", __func__, ptr->owner_id); | 166 | debug("%s - owner_id = %x\n", __func__, ptr->owner_id); |
167 | debug ("%s - first_slot_num = %x\n", __func__, ptr->first_slot_num); | 167 | debug("%s - first_slot_num = %x\n", __func__, ptr->first_slot_num); |
168 | debug ("%s - wpindex = %x\n", __func__, ptr->wpindex); | 168 | debug("%s - wpindex = %x\n", __func__, ptr->wpindex); |
169 | debug ("%s - chassis_num = %x\n", __func__, ptr->chassis_num); | 169 | debug("%s - chassis_num = %x\n", __func__, ptr->chassis_num); |
170 | 170 | ||
171 | } | 171 | } |
172 | } | 172 | } |
173 | 173 | ||
174 | static void __init print_ebda_pci_rsrc (void) | 174 | static void __init print_ebda_pci_rsrc(void) |
175 | { | 175 | { |
176 | struct ebda_pci_rsrc *ptr; | 176 | struct ebda_pci_rsrc *ptr; |
177 | 177 | ||
178 | list_for_each_entry(ptr, &ibmphp_ebda_pci_rsrc_head, ebda_pci_rsrc_list) { | 178 | list_for_each_entry(ptr, &ibmphp_ebda_pci_rsrc_head, ebda_pci_rsrc_list) { |
179 | debug ("%s - rsrc type: %x bus#: %x dev_func: %x start addr: %x end addr: %x\n", | 179 | debug("%s - rsrc type: %x bus#: %x dev_func: %x start addr: %x end addr: %x\n", |
180 | __func__, ptr->rsrc_type ,ptr->bus_num, ptr->dev_fun,ptr->start_addr, ptr->end_addr); | 180 | __func__, ptr->rsrc_type, ptr->bus_num, ptr->dev_fun, ptr->start_addr, ptr->end_addr); |
181 | } | 181 | } |
182 | } | 182 | } |
183 | 183 | ||
184 | static void __init print_ibm_slot (void) | 184 | static void __init print_ibm_slot(void) |
185 | { | 185 | { |
186 | struct slot *ptr; | 186 | struct slot *ptr; |
187 | 187 | ||
188 | list_for_each_entry(ptr, &ibmphp_slot_head, ibm_slot_list) { | 188 | list_for_each_entry(ptr, &ibmphp_slot_head, ibm_slot_list) { |
189 | debug ("%s - slot_number: %x\n", __func__, ptr->number); | 189 | debug("%s - slot_number: %x\n", __func__, ptr->number); |
190 | } | 190 | } |
191 | } | 191 | } |
192 | 192 | ||
193 | static void __init print_opt_vg (void) | 193 | static void __init print_opt_vg(void) |
194 | { | 194 | { |
195 | struct opt_rio *ptr; | 195 | struct opt_rio *ptr; |
196 | debug ("%s ---\n", __func__); | 196 | debug("%s ---\n", __func__); |
197 | list_for_each_entry(ptr, &opt_vg_head, opt_rio_list) { | 197 | list_for_each_entry(ptr, &opt_vg_head, opt_rio_list) { |
198 | debug ("%s - rio_type %x\n", __func__, ptr->rio_type); | 198 | debug("%s - rio_type %x\n", __func__, ptr->rio_type); |
199 | debug ("%s - chassis_num: %x\n", __func__, ptr->chassis_num); | 199 | debug("%s - chassis_num: %x\n", __func__, ptr->chassis_num); |
200 | debug ("%s - first_slot_num: %x\n", __func__, ptr->first_slot_num); | 200 | debug("%s - first_slot_num: %x\n", __func__, ptr->first_slot_num); |
201 | debug ("%s - middle_num: %x\n", __func__, ptr->middle_num); | 201 | debug("%s - middle_num: %x\n", __func__, ptr->middle_num); |
202 | } | 202 | } |
203 | } | 203 | } |
204 | 204 | ||
205 | static void __init print_ebda_hpc (void) | 205 | static void __init print_ebda_hpc(void) |
206 | { | 206 | { |
207 | struct controller *hpc_ptr; | 207 | struct controller *hpc_ptr; |
208 | u16 index; | 208 | u16 index; |
209 | 209 | ||
210 | list_for_each_entry(hpc_ptr, &ebda_hpc_head, ebda_hpc_list) { | 210 | list_for_each_entry(hpc_ptr, &ebda_hpc_head, ebda_hpc_list) { |
211 | for (index = 0; index < hpc_ptr->slot_count; index++) { | 211 | for (index = 0; index < hpc_ptr->slot_count; index++) { |
212 | debug ("%s - physical slot#: %x\n", __func__, hpc_ptr->slots[index].slot_num); | 212 | debug("%s - physical slot#: %x\n", __func__, hpc_ptr->slots[index].slot_num); |
213 | debug ("%s - pci bus# of the slot: %x\n", __func__, hpc_ptr->slots[index].slot_bus_num); | 213 | debug("%s - pci bus# of the slot: %x\n", __func__, hpc_ptr->slots[index].slot_bus_num); |
214 | debug ("%s - index into ctlr addr: %x\n", __func__, hpc_ptr->slots[index].ctl_index); | 214 | debug("%s - index into ctlr addr: %x\n", __func__, hpc_ptr->slots[index].ctl_index); |
215 | debug ("%s - cap of the slot: %x\n", __func__, hpc_ptr->slots[index].slot_cap); | 215 | debug("%s - cap of the slot: %x\n", __func__, hpc_ptr->slots[index].slot_cap); |
216 | } | 216 | } |
217 | 217 | ||
218 | for (index = 0; index < hpc_ptr->bus_count; index++) | 218 | for (index = 0; index < hpc_ptr->bus_count; index++) |
219 | debug ("%s - bus# of each bus controlled by this ctlr: %x\n", __func__, hpc_ptr->buses[index].bus_num); | 219 | debug("%s - bus# of each bus controlled by this ctlr: %x\n", __func__, hpc_ptr->buses[index].bus_num); |
220 | 220 | ||
221 | debug ("%s - type of hpc: %x\n", __func__, hpc_ptr->ctlr_type); | 221 | debug("%s - type of hpc: %x\n", __func__, hpc_ptr->ctlr_type); |
222 | switch (hpc_ptr->ctlr_type) { | 222 | switch (hpc_ptr->ctlr_type) { |
223 | case 1: | 223 | case 1: |
224 | debug ("%s - bus: %x\n", __func__, hpc_ptr->u.pci_ctlr.bus); | 224 | debug("%s - bus: %x\n", __func__, hpc_ptr->u.pci_ctlr.bus); |
225 | debug ("%s - dev_fun: %x\n", __func__, hpc_ptr->u.pci_ctlr.dev_fun); | 225 | debug("%s - dev_fun: %x\n", __func__, hpc_ptr->u.pci_ctlr.dev_fun); |
226 | debug ("%s - irq: %x\n", __func__, hpc_ptr->irq); | 226 | debug("%s - irq: %x\n", __func__, hpc_ptr->irq); |
227 | break; | 227 | break; |
228 | 228 | ||
229 | case 0: | 229 | case 0: |
230 | debug ("%s - io_start: %x\n", __func__, hpc_ptr->u.isa_ctlr.io_start); | 230 | debug("%s - io_start: %x\n", __func__, hpc_ptr->u.isa_ctlr.io_start); |
231 | debug ("%s - io_end: %x\n", __func__, hpc_ptr->u.isa_ctlr.io_end); | 231 | debug("%s - io_end: %x\n", __func__, hpc_ptr->u.isa_ctlr.io_end); |
232 | debug ("%s - irq: %x\n", __func__, hpc_ptr->irq); | 232 | debug("%s - irq: %x\n", __func__, hpc_ptr->irq); |
233 | break; | 233 | break; |
234 | 234 | ||
235 | case 2: | 235 | case 2: |
236 | case 4: | 236 | case 4: |
237 | debug ("%s - wpegbbar: %lx\n", __func__, hpc_ptr->u.wpeg_ctlr.wpegbbar); | 237 | debug("%s - wpegbbar: %lx\n", __func__, hpc_ptr->u.wpeg_ctlr.wpegbbar); |
238 | debug ("%s - i2c_addr: %x\n", __func__, hpc_ptr->u.wpeg_ctlr.i2c_addr); | 238 | debug("%s - i2c_addr: %x\n", __func__, hpc_ptr->u.wpeg_ctlr.i2c_addr); |
239 | debug ("%s - irq: %x\n", __func__, hpc_ptr->irq); | 239 | debug("%s - irq: %x\n", __func__, hpc_ptr->irq); |
240 | break; | 240 | break; |
241 | } | 241 | } |
242 | } | 242 | } |
243 | } | 243 | } |
244 | 244 | ||
245 | int __init ibmphp_access_ebda (void) | 245 | int __init ibmphp_access_ebda(void) |
246 | { | 246 | { |
247 | u8 format, num_ctlrs, rio_complete, hs_complete, ebda_sz; | 247 | u8 format, num_ctlrs, rio_complete, hs_complete, ebda_sz; |
248 | u16 ebda_seg, num_entries, next_offset, offset, blk_id, sub_addr, re, rc_id, re_id, base; | 248 | u16 ebda_seg, num_entries, next_offset, offset, blk_id, sub_addr, re, rc_id, re_id, base; |
@@ -252,12 +252,12 @@ int __init ibmphp_access_ebda (void) | |||
252 | rio_complete = 0; | 252 | rio_complete = 0; |
253 | hs_complete = 0; | 253 | hs_complete = 0; |
254 | 254 | ||
255 | io_mem = ioremap ((0x40 << 4) + 0x0e, 2); | 255 | io_mem = ioremap((0x40 << 4) + 0x0e, 2); |
256 | if (!io_mem ) | 256 | if (!io_mem) |
257 | return -ENOMEM; | 257 | return -ENOMEM; |
258 | ebda_seg = readw (io_mem); | 258 | ebda_seg = readw(io_mem); |
259 | iounmap (io_mem); | 259 | iounmap(io_mem); |
260 | debug ("returned ebda segment: %x\n", ebda_seg); | 260 | debug("returned ebda segment: %x\n", ebda_seg); |
261 | 261 | ||
262 | io_mem = ioremap(ebda_seg<<4, 1); | 262 | io_mem = ioremap(ebda_seg<<4, 1); |
263 | if (!io_mem) | 263 | if (!io_mem) |
@@ -269,7 +269,7 @@ int __init ibmphp_access_ebda (void) | |||
269 | return -ENOMEM; | 269 | return -ENOMEM; |
270 | 270 | ||
271 | io_mem = ioremap(ebda_seg<<4, (ebda_sz * 1024)); | 271 | io_mem = ioremap(ebda_seg<<4, (ebda_sz * 1024)); |
272 | if (!io_mem ) | 272 | if (!io_mem) |
273 | return -ENOMEM; | 273 | return -ENOMEM; |
274 | next_offset = 0x180; | 274 | next_offset = 0x180; |
275 | 275 | ||
@@ -281,12 +281,12 @@ int __init ibmphp_access_ebda (void) | |||
281 | "ibmphp_ebda: next read is beyond ebda_sz\n")) | 281 | "ibmphp_ebda: next read is beyond ebda_sz\n")) |
282 | break; | 282 | break; |
283 | 283 | ||
284 | next_offset = readw (io_mem + offset); /* offset of next blk */ | 284 | next_offset = readw(io_mem + offset); /* offset of next blk */ |
285 | 285 | ||
286 | offset += 2; | 286 | offset += 2; |
287 | if (next_offset == 0) /* 0 indicate it's last blk */ | 287 | if (next_offset == 0) /* 0 indicate it's last blk */ |
288 | break; | 288 | break; |
289 | blk_id = readw (io_mem + offset); /* this blk id */ | 289 | blk_id = readw(io_mem + offset); /* this blk id */ |
290 | 290 | ||
291 | offset += 2; | 291 | offset += 2; |
292 | /* check if it is hot swap block or rio block */ | 292 | /* check if it is hot swap block or rio block */ |
@@ -294,31 +294,31 @@ int __init ibmphp_access_ebda (void) | |||
294 | continue; | 294 | continue; |
295 | /* found hs table */ | 295 | /* found hs table */ |
296 | if (blk_id == 0x4853) { | 296 | if (blk_id == 0x4853) { |
297 | debug ("now enter hot swap block---\n"); | 297 | debug("now enter hot swap block---\n"); |
298 | debug ("hot blk id: %x\n", blk_id); | 298 | debug("hot blk id: %x\n", blk_id); |
299 | format = readb (io_mem + offset); | 299 | format = readb(io_mem + offset); |
300 | 300 | ||
301 | offset += 1; | 301 | offset += 1; |
302 | if (format != 4) | 302 | if (format != 4) |
303 | goto error_nodev; | 303 | goto error_nodev; |
304 | debug ("hot blk format: %x\n", format); | 304 | debug("hot blk format: %x\n", format); |
305 | /* hot swap sub blk */ | 305 | /* hot swap sub blk */ |
306 | base = offset; | 306 | base = offset; |
307 | 307 | ||
308 | sub_addr = base; | 308 | sub_addr = base; |
309 | re = readw (io_mem + sub_addr); /* next sub blk */ | 309 | re = readw(io_mem + sub_addr); /* next sub blk */ |
310 | 310 | ||
311 | sub_addr += 2; | 311 | sub_addr += 2; |
312 | rc_id = readw (io_mem + sub_addr); /* sub blk id */ | 312 | rc_id = readw(io_mem + sub_addr); /* sub blk id */ |
313 | 313 | ||
314 | sub_addr += 2; | 314 | sub_addr += 2; |
315 | if (rc_id != 0x5243) | 315 | if (rc_id != 0x5243) |
316 | goto error_nodev; | 316 | goto error_nodev; |
317 | /* rc sub blk signature */ | 317 | /* rc sub blk signature */ |
318 | num_ctlrs = readb (io_mem + sub_addr); | 318 | num_ctlrs = readb(io_mem + sub_addr); |
319 | 319 | ||
320 | sub_addr += 1; | 320 | sub_addr += 1; |
321 | hpc_list_ptr = alloc_ebda_hpc_list (); | 321 | hpc_list_ptr = alloc_ebda_hpc_list(); |
322 | if (!hpc_list_ptr) { | 322 | if (!hpc_list_ptr) { |
323 | rc = -ENOMEM; | 323 | rc = -ENOMEM; |
324 | goto out; | 324 | goto out; |
@@ -326,28 +326,28 @@ int __init ibmphp_access_ebda (void) | |||
326 | hpc_list_ptr->format = format; | 326 | hpc_list_ptr->format = format; |
327 | hpc_list_ptr->num_ctlrs = num_ctlrs; | 327 | hpc_list_ptr->num_ctlrs = num_ctlrs; |
328 | hpc_list_ptr->phys_addr = sub_addr; /* offset of RSRC_CONTROLLER blk */ | 328 | hpc_list_ptr->phys_addr = sub_addr; /* offset of RSRC_CONTROLLER blk */ |
329 | debug ("info about hpc descriptor---\n"); | 329 | debug("info about hpc descriptor---\n"); |
330 | debug ("hot blk format: %x\n", format); | 330 | debug("hot blk format: %x\n", format); |
331 | debug ("num of controller: %x\n", num_ctlrs); | 331 | debug("num of controller: %x\n", num_ctlrs); |
332 | debug ("offset of hpc data structure entries: %x\n ", sub_addr); | 332 | debug("offset of hpc data structure entries: %x\n ", sub_addr); |
333 | 333 | ||
334 | sub_addr = base + re; /* re sub blk */ | 334 | sub_addr = base + re; /* re sub blk */ |
335 | /* FIXME: rc is never used/checked */ | 335 | /* FIXME: rc is never used/checked */ |
336 | rc = readw (io_mem + sub_addr); /* next sub blk */ | 336 | rc = readw(io_mem + sub_addr); /* next sub blk */ |
337 | 337 | ||
338 | sub_addr += 2; | 338 | sub_addr += 2; |
339 | re_id = readw (io_mem + sub_addr); /* sub blk id */ | 339 | re_id = readw(io_mem + sub_addr); /* sub blk id */ |
340 | 340 | ||
341 | sub_addr += 2; | 341 | sub_addr += 2; |
342 | if (re_id != 0x5245) | 342 | if (re_id != 0x5245) |
343 | goto error_nodev; | 343 | goto error_nodev; |
344 | 344 | ||
345 | /* signature of re */ | 345 | /* signature of re */ |
346 | num_entries = readw (io_mem + sub_addr); | 346 | num_entries = readw(io_mem + sub_addr); |
347 | 347 | ||
348 | sub_addr += 2; /* offset of RSRC_ENTRIES blk */ | 348 | sub_addr += 2; /* offset of RSRC_ENTRIES blk */ |
349 | rsrc_list_ptr = alloc_ebda_rsrc_list (); | 349 | rsrc_list_ptr = alloc_ebda_rsrc_list(); |
350 | if (!rsrc_list_ptr ) { | 350 | if (!rsrc_list_ptr) { |
351 | rc = -ENOMEM; | 351 | rc = -ENOMEM; |
352 | goto out; | 352 | goto out; |
353 | } | 353 | } |
@@ -355,26 +355,26 @@ int __init ibmphp_access_ebda (void) | |||
355 | rsrc_list_ptr->num_entries = num_entries; | 355 | rsrc_list_ptr->num_entries = num_entries; |
356 | rsrc_list_ptr->phys_addr = sub_addr; | 356 | rsrc_list_ptr->phys_addr = sub_addr; |
357 | 357 | ||
358 | debug ("info about rsrc descriptor---\n"); | 358 | debug("info about rsrc descriptor---\n"); |
359 | debug ("format: %x\n", format); | 359 | debug("format: %x\n", format); |
360 | debug ("num of rsrc: %x\n", num_entries); | 360 | debug("num of rsrc: %x\n", num_entries); |
361 | debug ("offset of rsrc data structure entries: %x\n ", sub_addr); | 361 | debug("offset of rsrc data structure entries: %x\n ", sub_addr); |
362 | 362 | ||
363 | hs_complete = 1; | 363 | hs_complete = 1; |
364 | } else { | 364 | } else { |
365 | /* found rio table, blk_id == 0x4752 */ | 365 | /* found rio table, blk_id == 0x4752 */ |
366 | debug ("now enter io table ---\n"); | 366 | debug("now enter io table ---\n"); |
367 | debug ("rio blk id: %x\n", blk_id); | 367 | debug("rio blk id: %x\n", blk_id); |
368 | 368 | ||
369 | rio_table_ptr = kzalloc(sizeof(struct rio_table_hdr), GFP_KERNEL); | 369 | rio_table_ptr = kzalloc(sizeof(struct rio_table_hdr), GFP_KERNEL); |
370 | if (!rio_table_ptr) { | 370 | if (!rio_table_ptr) { |
371 | rc = -ENOMEM; | 371 | rc = -ENOMEM; |
372 | goto out; | 372 | goto out; |
373 | } | 373 | } |
374 | rio_table_ptr->ver_num = readb (io_mem + offset); | 374 | rio_table_ptr->ver_num = readb(io_mem + offset); |
375 | rio_table_ptr->scal_count = readb (io_mem + offset + 1); | 375 | rio_table_ptr->scal_count = readb(io_mem + offset + 1); |
376 | rio_table_ptr->riodev_count = readb (io_mem + offset + 2); | 376 | rio_table_ptr->riodev_count = readb(io_mem + offset + 2); |
377 | rio_table_ptr->offset = offset +3 ; | 377 | rio_table_ptr->offset = offset + 3 ; |
378 | 378 | ||
379 | debug("info about rio table hdr ---\n"); | 379 | debug("info about rio table hdr ---\n"); |
380 | debug("ver_num: %x\nscal_count: %x\nriodev_count: %x\noffset of rio table: %x\n ", | 380 | debug("ver_num: %x\nscal_count: %x\nriodev_count: %x\noffset of rio table: %x\n ", |
@@ -390,28 +390,28 @@ int __init ibmphp_access_ebda (void) | |||
390 | 390 | ||
391 | if (rio_table_ptr) { | 391 | if (rio_table_ptr) { |
392 | if (rio_complete && rio_table_ptr->ver_num == 3) { | 392 | if (rio_complete && rio_table_ptr->ver_num == 3) { |
393 | rc = ebda_rio_table (); | 393 | rc = ebda_rio_table(); |
394 | if (rc) | 394 | if (rc) |
395 | goto out; | 395 | goto out; |
396 | } | 396 | } |
397 | } | 397 | } |
398 | rc = ebda_rsrc_controller (); | 398 | rc = ebda_rsrc_controller(); |
399 | if (rc) | 399 | if (rc) |
400 | goto out; | 400 | goto out; |
401 | 401 | ||
402 | rc = ebda_rsrc_rsrc (); | 402 | rc = ebda_rsrc_rsrc(); |
403 | goto out; | 403 | goto out; |
404 | error_nodev: | 404 | error_nodev: |
405 | rc = -ENODEV; | 405 | rc = -ENODEV; |
406 | out: | 406 | out: |
407 | iounmap (io_mem); | 407 | iounmap(io_mem); |
408 | return rc; | 408 | return rc; |
409 | } | 409 | } |
410 | 410 | ||
411 | /* | 411 | /* |
412 | * map info of scalability details and rio details from physical address | 412 | * map info of scalability details and rio details from physical address |
413 | */ | 413 | */ |
414 | static int __init ebda_rio_table (void) | 414 | static int __init ebda_rio_table(void) |
415 | { | 415 | { |
416 | u16 offset; | 416 | u16 offset; |
417 | u8 i; | 417 | u8 i; |
@@ -425,39 +425,39 @@ static int __init ebda_rio_table (void) | |||
425 | rio_detail_ptr = kzalloc(sizeof(struct rio_detail), GFP_KERNEL); | 425 | rio_detail_ptr = kzalloc(sizeof(struct rio_detail), GFP_KERNEL); |
426 | if (!rio_detail_ptr) | 426 | if (!rio_detail_ptr) |
427 | return -ENOMEM; | 427 | return -ENOMEM; |
428 | rio_detail_ptr->rio_node_id = readb (io_mem + offset); | 428 | rio_detail_ptr->rio_node_id = readb(io_mem + offset); |
429 | rio_detail_ptr->bbar = readl (io_mem + offset + 1); | 429 | rio_detail_ptr->bbar = readl(io_mem + offset + 1); |
430 | rio_detail_ptr->rio_type = readb (io_mem + offset + 5); | 430 | rio_detail_ptr->rio_type = readb(io_mem + offset + 5); |
431 | rio_detail_ptr->owner_id = readb (io_mem + offset + 6); | 431 | rio_detail_ptr->owner_id = readb(io_mem + offset + 6); |
432 | rio_detail_ptr->port0_node_connect = readb (io_mem + offset + 7); | 432 | rio_detail_ptr->port0_node_connect = readb(io_mem + offset + 7); |
433 | rio_detail_ptr->port0_port_connect = readb (io_mem + offset + 8); | 433 | rio_detail_ptr->port0_port_connect = readb(io_mem + offset + 8); |
434 | rio_detail_ptr->port1_node_connect = readb (io_mem + offset + 9); | 434 | rio_detail_ptr->port1_node_connect = readb(io_mem + offset + 9); |
435 | rio_detail_ptr->port1_port_connect = readb (io_mem + offset + 10); | 435 | rio_detail_ptr->port1_port_connect = readb(io_mem + offset + 10); |
436 | rio_detail_ptr->first_slot_num = readb (io_mem + offset + 11); | 436 | rio_detail_ptr->first_slot_num = readb(io_mem + offset + 11); |
437 | rio_detail_ptr->status = readb (io_mem + offset + 12); | 437 | rio_detail_ptr->status = readb(io_mem + offset + 12); |
438 | rio_detail_ptr->wpindex = readb (io_mem + offset + 13); | 438 | rio_detail_ptr->wpindex = readb(io_mem + offset + 13); |
439 | rio_detail_ptr->chassis_num = readb (io_mem + offset + 14); | 439 | rio_detail_ptr->chassis_num = readb(io_mem + offset + 14); |
440 | // debug ("rio_node_id: %x\nbbar: %x\nrio_type: %x\nowner_id: %x\nport0_node: %x\nport0_port: %x\nport1_node: %x\nport1_port: %x\nfirst_slot_num: %x\nstatus: %x\n", rio_detail_ptr->rio_node_id, rio_detail_ptr->bbar, rio_detail_ptr->rio_type, rio_detail_ptr->owner_id, rio_detail_ptr->port0_node_connect, rio_detail_ptr->port0_port_connect, rio_detail_ptr->port1_node_connect, rio_detail_ptr->port1_port_connect, rio_detail_ptr->first_slot_num, rio_detail_ptr->status); | 440 | // debug("rio_node_id: %x\nbbar: %x\nrio_type: %x\nowner_id: %x\nport0_node: %x\nport0_port: %x\nport1_node: %x\nport1_port: %x\nfirst_slot_num: %x\nstatus: %x\n", rio_detail_ptr->rio_node_id, rio_detail_ptr->bbar, rio_detail_ptr->rio_type, rio_detail_ptr->owner_id, rio_detail_ptr->port0_node_connect, rio_detail_ptr->port0_port_connect, rio_detail_ptr->port1_node_connect, rio_detail_ptr->port1_port_connect, rio_detail_ptr->first_slot_num, rio_detail_ptr->status); |
441 | //create linked list of chassis | 441 | //create linked list of chassis |
442 | if (rio_detail_ptr->rio_type == 4 || rio_detail_ptr->rio_type == 5) | 442 | if (rio_detail_ptr->rio_type == 4 || rio_detail_ptr->rio_type == 5) |
443 | list_add (&rio_detail_ptr->rio_detail_list, &rio_vg_head); | 443 | list_add(&rio_detail_ptr->rio_detail_list, &rio_vg_head); |
444 | //create linked list of expansion box | 444 | //create linked list of expansion box |
445 | else if (rio_detail_ptr->rio_type == 6 || rio_detail_ptr->rio_type == 7) | 445 | else if (rio_detail_ptr->rio_type == 6 || rio_detail_ptr->rio_type == 7) |
446 | list_add (&rio_detail_ptr->rio_detail_list, &rio_lo_head); | 446 | list_add(&rio_detail_ptr->rio_detail_list, &rio_lo_head); |
447 | else | 447 | else |
448 | // not in my concern | 448 | // not in my concern |
449 | kfree (rio_detail_ptr); | 449 | kfree(rio_detail_ptr); |
450 | offset += 15; | 450 | offset += 15; |
451 | } | 451 | } |
452 | print_lo_info (); | 452 | print_lo_info(); |
453 | print_vg_info (); | 453 | print_vg_info(); |
454 | return 0; | 454 | return 0; |
455 | } | 455 | } |
456 | 456 | ||
457 | /* | 457 | /* |
458 | * reorganizing linked list of chassis | 458 | * reorganizing linked list of chassis |
459 | */ | 459 | */ |
460 | static struct opt_rio *search_opt_vg (u8 chassis_num) | 460 | static struct opt_rio *search_opt_vg(u8 chassis_num) |
461 | { | 461 | { |
462 | struct opt_rio *ptr; | 462 | struct opt_rio *ptr; |
463 | list_for_each_entry(ptr, &opt_vg_head, opt_rio_list) { | 463 | list_for_each_entry(ptr, &opt_vg_head, opt_rio_list) { |
@@ -467,13 +467,13 @@ static struct opt_rio *search_opt_vg (u8 chassis_num) | |||
467 | return NULL; | 467 | return NULL; |
468 | } | 468 | } |
469 | 469 | ||
470 | static int __init combine_wpg_for_chassis (void) | 470 | static int __init combine_wpg_for_chassis(void) |
471 | { | 471 | { |
472 | struct opt_rio *opt_rio_ptr = NULL; | 472 | struct opt_rio *opt_rio_ptr = NULL; |
473 | struct rio_detail *rio_detail_ptr = NULL; | 473 | struct rio_detail *rio_detail_ptr = NULL; |
474 | 474 | ||
475 | list_for_each_entry(rio_detail_ptr, &rio_vg_head, rio_detail_list) { | 475 | list_for_each_entry(rio_detail_ptr, &rio_vg_head, rio_detail_list) { |
476 | opt_rio_ptr = search_opt_vg (rio_detail_ptr->chassis_num); | 476 | opt_rio_ptr = search_opt_vg(rio_detail_ptr->chassis_num); |
477 | if (!opt_rio_ptr) { | 477 | if (!opt_rio_ptr) { |
478 | opt_rio_ptr = kzalloc(sizeof(struct opt_rio), GFP_KERNEL); | 478 | opt_rio_ptr = kzalloc(sizeof(struct opt_rio), GFP_KERNEL); |
479 | if (!opt_rio_ptr) | 479 | if (!opt_rio_ptr) |
@@ -482,20 +482,20 @@ static int __init combine_wpg_for_chassis (void) | |||
482 | opt_rio_ptr->chassis_num = rio_detail_ptr->chassis_num; | 482 | opt_rio_ptr->chassis_num = rio_detail_ptr->chassis_num; |
483 | opt_rio_ptr->first_slot_num = rio_detail_ptr->first_slot_num; | 483 | opt_rio_ptr->first_slot_num = rio_detail_ptr->first_slot_num; |
484 | opt_rio_ptr->middle_num = rio_detail_ptr->first_slot_num; | 484 | opt_rio_ptr->middle_num = rio_detail_ptr->first_slot_num; |
485 | list_add (&opt_rio_ptr->opt_rio_list, &opt_vg_head); | 485 | list_add(&opt_rio_ptr->opt_rio_list, &opt_vg_head); |
486 | } else { | 486 | } else { |
487 | opt_rio_ptr->first_slot_num = min (opt_rio_ptr->first_slot_num, rio_detail_ptr->first_slot_num); | 487 | opt_rio_ptr->first_slot_num = min(opt_rio_ptr->first_slot_num, rio_detail_ptr->first_slot_num); |
488 | opt_rio_ptr->middle_num = max (opt_rio_ptr->middle_num, rio_detail_ptr->first_slot_num); | 488 | opt_rio_ptr->middle_num = max(opt_rio_ptr->middle_num, rio_detail_ptr->first_slot_num); |
489 | } | 489 | } |
490 | } | 490 | } |
491 | print_opt_vg (); | 491 | print_opt_vg(); |
492 | return 0; | 492 | return 0; |
493 | } | 493 | } |
494 | 494 | ||
495 | /* | 495 | /* |
496 | * reorganizing linked list of expansion box | 496 | * reorganizing linked list of expansion box |
497 | */ | 497 | */ |
498 | static struct opt_rio_lo *search_opt_lo (u8 chassis_num) | 498 | static struct opt_rio_lo *search_opt_lo(u8 chassis_num) |
499 | { | 499 | { |
500 | struct opt_rio_lo *ptr; | 500 | struct opt_rio_lo *ptr; |
501 | list_for_each_entry(ptr, &opt_lo_head, opt_rio_lo_list) { | 501 | list_for_each_entry(ptr, &opt_lo_head, opt_rio_lo_list) { |
@@ -505,13 +505,13 @@ static struct opt_rio_lo *search_opt_lo (u8 chassis_num) | |||
505 | return NULL; | 505 | return NULL; |
506 | } | 506 | } |
507 | 507 | ||
508 | static int combine_wpg_for_expansion (void) | 508 | static int combine_wpg_for_expansion(void) |
509 | { | 509 | { |
510 | struct opt_rio_lo *opt_rio_lo_ptr = NULL; | 510 | struct opt_rio_lo *opt_rio_lo_ptr = NULL; |
511 | struct rio_detail *rio_detail_ptr = NULL; | 511 | struct rio_detail *rio_detail_ptr = NULL; |
512 | 512 | ||
513 | list_for_each_entry(rio_detail_ptr, &rio_lo_head, rio_detail_list) { | 513 | list_for_each_entry(rio_detail_ptr, &rio_lo_head, rio_detail_list) { |
514 | opt_rio_lo_ptr = search_opt_lo (rio_detail_ptr->chassis_num); | 514 | opt_rio_lo_ptr = search_opt_lo(rio_detail_ptr->chassis_num); |
515 | if (!opt_rio_lo_ptr) { | 515 | if (!opt_rio_lo_ptr) { |
516 | opt_rio_lo_ptr = kzalloc(sizeof(struct opt_rio_lo), GFP_KERNEL); | 516 | opt_rio_lo_ptr = kzalloc(sizeof(struct opt_rio_lo), GFP_KERNEL); |
517 | if (!opt_rio_lo_ptr) | 517 | if (!opt_rio_lo_ptr) |
@@ -522,10 +522,10 @@ static int combine_wpg_for_expansion (void) | |||
522 | opt_rio_lo_ptr->middle_num = rio_detail_ptr->first_slot_num; | 522 | opt_rio_lo_ptr->middle_num = rio_detail_ptr->first_slot_num; |
523 | opt_rio_lo_ptr->pack_count = 1; | 523 | opt_rio_lo_ptr->pack_count = 1; |
524 | 524 | ||
525 | list_add (&opt_rio_lo_ptr->opt_rio_lo_list, &opt_lo_head); | 525 | list_add(&opt_rio_lo_ptr->opt_rio_lo_list, &opt_lo_head); |
526 | } else { | 526 | } else { |
527 | opt_rio_lo_ptr->first_slot_num = min (opt_rio_lo_ptr->first_slot_num, rio_detail_ptr->first_slot_num); | 527 | opt_rio_lo_ptr->first_slot_num = min(opt_rio_lo_ptr->first_slot_num, rio_detail_ptr->first_slot_num); |
528 | opt_rio_lo_ptr->middle_num = max (opt_rio_lo_ptr->middle_num, rio_detail_ptr->first_slot_num); | 528 | opt_rio_lo_ptr->middle_num = max(opt_rio_lo_ptr->middle_num, rio_detail_ptr->first_slot_num); |
529 | opt_rio_lo_ptr->pack_count = 2; | 529 | opt_rio_lo_ptr->pack_count = 2; |
530 | } | 530 | } |
531 | } | 531 | } |
@@ -538,7 +538,7 @@ static int combine_wpg_for_expansion (void) | |||
538 | * Arguments: slot_num, 1st slot number of the chassis we think we are on, | 538 | * Arguments: slot_num, 1st slot number of the chassis we think we are on, |
539 | * var (0 = chassis, 1 = expansion box) | 539 | * var (0 = chassis, 1 = expansion box) |
540 | */ | 540 | */ |
541 | static int first_slot_num (u8 slot_num, u8 first_slot, u8 var) | 541 | static int first_slot_num(u8 slot_num, u8 first_slot, u8 var) |
542 | { | 542 | { |
543 | struct opt_rio *opt_vg_ptr = NULL; | 543 | struct opt_rio *opt_vg_ptr = NULL; |
544 | struct opt_rio_lo *opt_lo_ptr = NULL; | 544 | struct opt_rio_lo *opt_lo_ptr = NULL; |
@@ -562,25 +562,25 @@ static int first_slot_num (u8 slot_num, u8 first_slot, u8 var) | |||
562 | return rc; | 562 | return rc; |
563 | } | 563 | } |
564 | 564 | ||
565 | static struct opt_rio_lo *find_rxe_num (u8 slot_num) | 565 | static struct opt_rio_lo *find_rxe_num(u8 slot_num) |
566 | { | 566 | { |
567 | struct opt_rio_lo *opt_lo_ptr; | 567 | struct opt_rio_lo *opt_lo_ptr; |
568 | 568 | ||
569 | list_for_each_entry(opt_lo_ptr, &opt_lo_head, opt_rio_lo_list) { | 569 | list_for_each_entry(opt_lo_ptr, &opt_lo_head, opt_rio_lo_list) { |
570 | //check to see if this slot_num belongs to expansion box | 570 | //check to see if this slot_num belongs to expansion box |
571 | if ((slot_num >= opt_lo_ptr->first_slot_num) && (!first_slot_num (slot_num, opt_lo_ptr->first_slot_num, 1))) | 571 | if ((slot_num >= opt_lo_ptr->first_slot_num) && (!first_slot_num(slot_num, opt_lo_ptr->first_slot_num, 1))) |
572 | return opt_lo_ptr; | 572 | return opt_lo_ptr; |
573 | } | 573 | } |
574 | return NULL; | 574 | return NULL; |
575 | } | 575 | } |
576 | 576 | ||
577 | static struct opt_rio *find_chassis_num (u8 slot_num) | 577 | static struct opt_rio *find_chassis_num(u8 slot_num) |
578 | { | 578 | { |
579 | struct opt_rio *opt_vg_ptr; | 579 | struct opt_rio *opt_vg_ptr; |
580 | 580 | ||
581 | list_for_each_entry(opt_vg_ptr, &opt_vg_head, opt_rio_list) { | 581 | list_for_each_entry(opt_vg_ptr, &opt_vg_head, opt_rio_list) { |
582 | //check to see if this slot_num belongs to chassis | 582 | //check to see if this slot_num belongs to chassis |
583 | if ((slot_num >= opt_vg_ptr->first_slot_num) && (!first_slot_num (slot_num, opt_vg_ptr->first_slot_num, 0))) | 583 | if ((slot_num >= opt_vg_ptr->first_slot_num) && (!first_slot_num(slot_num, opt_vg_ptr->first_slot_num, 0))) |
584 | return opt_vg_ptr; | 584 | return opt_vg_ptr; |
585 | } | 585 | } |
586 | return NULL; | 586 | return NULL; |
@@ -589,7 +589,7 @@ static struct opt_rio *find_chassis_num (u8 slot_num) | |||
589 | /* This routine will find out how many slots are in the chassis, so that | 589 | /* This routine will find out how many slots are in the chassis, so that |
590 | * the slot numbers for rxe100 would start from 1, and not from 7, or 6 etc | 590 | * the slot numbers for rxe100 would start from 1, and not from 7, or 6 etc |
591 | */ | 591 | */ |
592 | static u8 calculate_first_slot (u8 slot_num) | 592 | static u8 calculate_first_slot(u8 slot_num) |
593 | { | 593 | { |
594 | u8 first_slot = 1; | 594 | u8 first_slot = 1; |
595 | struct slot *slot_cur; | 595 | struct slot *slot_cur; |
@@ -606,7 +606,7 @@ static u8 calculate_first_slot (u8 slot_num) | |||
606 | 606 | ||
607 | #define SLOT_NAME_SIZE 30 | 607 | #define SLOT_NAME_SIZE 30 |
608 | 608 | ||
609 | static char *create_file_name (struct slot *slot_cur) | 609 | static char *create_file_name(struct slot *slot_cur) |
610 | { | 610 | { |
611 | struct opt_rio *opt_vg_ptr = NULL; | 611 | struct opt_rio *opt_vg_ptr = NULL; |
612 | struct opt_rio_lo *opt_lo_ptr = NULL; | 612 | struct opt_rio_lo *opt_lo_ptr = NULL; |
@@ -618,18 +618,18 @@ static char *create_file_name (struct slot *slot_cur) | |||
618 | u8 flag = 0; | 618 | u8 flag = 0; |
619 | 619 | ||
620 | if (!slot_cur) { | 620 | if (!slot_cur) { |
621 | err ("Structure passed is empty\n"); | 621 | err("Structure passed is empty\n"); |
622 | return NULL; | 622 | return NULL; |
623 | } | 623 | } |
624 | 624 | ||
625 | slot_num = slot_cur->number; | 625 | slot_num = slot_cur->number; |
626 | 626 | ||
627 | memset (str, 0, sizeof(str)); | 627 | memset(str, 0, sizeof(str)); |
628 | 628 | ||
629 | if (rio_table_ptr) { | 629 | if (rio_table_ptr) { |
630 | if (rio_table_ptr->ver_num == 3) { | 630 | if (rio_table_ptr->ver_num == 3) { |
631 | opt_vg_ptr = find_chassis_num (slot_num); | 631 | opt_vg_ptr = find_chassis_num(slot_num); |
632 | opt_lo_ptr = find_rxe_num (slot_num); | 632 | opt_lo_ptr = find_rxe_num(slot_num); |
633 | } | 633 | } |
634 | } | 634 | } |
635 | if (opt_vg_ptr) { | 635 | if (opt_vg_ptr) { |
@@ -662,7 +662,7 @@ static char *create_file_name (struct slot *slot_cur) | |||
662 | } | 662 | } |
663 | if (!flag) { | 663 | if (!flag) { |
664 | if (slot_cur->ctrl->ctlr_type == 4) { | 664 | if (slot_cur->ctrl->ctlr_type == 4) { |
665 | first_slot = calculate_first_slot (slot_num); | 665 | first_slot = calculate_first_slot(slot_num); |
666 | which = 1; | 666 | which = 1; |
667 | } else { | 667 | } else { |
668 | which = 0; | 668 | which = 0; |
@@ -698,7 +698,7 @@ static int fillslotinfo(struct hotplug_slot *hotplug_slot) | |||
698 | hotplug_slot->info->latch_status = SLOT_LATCH(slot->status); | 698 | hotplug_slot->info->latch_status = SLOT_LATCH(slot->status); |
699 | 699 | ||
700 | // pci board - present:1 not:0 | 700 | // pci board - present:1 not:0 |
701 | if (SLOT_PRESENT (slot->status)) | 701 | if (SLOT_PRESENT(slot->status)) |
702 | hotplug_slot->info->adapter_status = 1; | 702 | hotplug_slot->info->adapter_status = 1; |
703 | else | 703 | else |
704 | hotplug_slot->info->adapter_status = 0; | 704 | hotplug_slot->info->adapter_status = 0; |
@@ -729,7 +729,7 @@ static void release_slot(struct hotplug_slot *hotplug_slot) | |||
729 | /* we don't want to actually remove the resources, since free_resources will do just that */ | 729 | /* we don't want to actually remove the resources, since free_resources will do just that */ |
730 | ibmphp_unconfigure_card(&slot, -1); | 730 | ibmphp_unconfigure_card(&slot, -1); |
731 | 731 | ||
732 | kfree (slot); | 732 | kfree(slot); |
733 | } | 733 | } |
734 | 734 | ||
735 | static struct pci_driver ibmphp_driver; | 735 | static struct pci_driver ibmphp_driver; |
@@ -739,7 +739,7 @@ static struct pci_driver ibmphp_driver; | |||
739 | * each hpc from physical address to a list of hot plug controllers based on | 739 | * each hpc from physical address to a list of hot plug controllers based on |
740 | * hpc descriptors. | 740 | * hpc descriptors. |
741 | */ | 741 | */ |
742 | static int __init ebda_rsrc_controller (void) | 742 | static int __init ebda_rsrc_controller(void) |
743 | { | 743 | { |
744 | u16 addr, addr_slot, addr_bus; | 744 | u16 addr, addr_slot, addr_bus; |
745 | u8 ctlr_id, temp, bus_index; | 745 | u8 ctlr_id, temp, bus_index; |
@@ -757,25 +757,25 @@ static int __init ebda_rsrc_controller (void) | |||
757 | addr = hpc_list_ptr->phys_addr; | 757 | addr = hpc_list_ptr->phys_addr; |
758 | for (ctlr = 0; ctlr < hpc_list_ptr->num_ctlrs; ctlr++) { | 758 | for (ctlr = 0; ctlr < hpc_list_ptr->num_ctlrs; ctlr++) { |
759 | bus_index = 1; | 759 | bus_index = 1; |
760 | ctlr_id = readb (io_mem + addr); | 760 | ctlr_id = readb(io_mem + addr); |
761 | addr += 1; | 761 | addr += 1; |
762 | slot_num = readb (io_mem + addr); | 762 | slot_num = readb(io_mem + addr); |
763 | 763 | ||
764 | addr += 1; | 764 | addr += 1; |
765 | addr_slot = addr; /* offset of slot structure */ | 765 | addr_slot = addr; /* offset of slot structure */ |
766 | addr += (slot_num * 4); | 766 | addr += (slot_num * 4); |
767 | 767 | ||
768 | bus_num = readb (io_mem + addr); | 768 | bus_num = readb(io_mem + addr); |
769 | 769 | ||
770 | addr += 1; | 770 | addr += 1; |
771 | addr_bus = addr; /* offset of bus */ | 771 | addr_bus = addr; /* offset of bus */ |
772 | addr += (bus_num * 9); /* offset of ctlr_type */ | 772 | addr += (bus_num * 9); /* offset of ctlr_type */ |
773 | temp = readb (io_mem + addr); | 773 | temp = readb(io_mem + addr); |
774 | 774 | ||
775 | addr += 1; | 775 | addr += 1; |
776 | /* init hpc structure */ | 776 | /* init hpc structure */ |
777 | hpc_ptr = alloc_ebda_hpc (slot_num, bus_num); | 777 | hpc_ptr = alloc_ebda_hpc(slot_num, bus_num); |
778 | if (!hpc_ptr ) { | 778 | if (!hpc_ptr) { |
779 | rc = -ENOMEM; | 779 | rc = -ENOMEM; |
780 | goto error_no_hpc; | 780 | goto error_no_hpc; |
781 | } | 781 | } |
@@ -783,23 +783,23 @@ static int __init ebda_rsrc_controller (void) | |||
783 | hpc_ptr->ctlr_relative_id = ctlr; | 783 | hpc_ptr->ctlr_relative_id = ctlr; |
784 | hpc_ptr->slot_count = slot_num; | 784 | hpc_ptr->slot_count = slot_num; |
785 | hpc_ptr->bus_count = bus_num; | 785 | hpc_ptr->bus_count = bus_num; |
786 | debug ("now enter ctlr data structure ---\n"); | 786 | debug("now enter ctlr data structure ---\n"); |
787 | debug ("ctlr id: %x\n", ctlr_id); | 787 | debug("ctlr id: %x\n", ctlr_id); |
788 | debug ("ctlr_relative_id: %x\n", hpc_ptr->ctlr_relative_id); | 788 | debug("ctlr_relative_id: %x\n", hpc_ptr->ctlr_relative_id); |
789 | debug ("count of slots controlled by this ctlr: %x\n", slot_num); | 789 | debug("count of slots controlled by this ctlr: %x\n", slot_num); |
790 | debug ("count of buses controlled by this ctlr: %x\n", bus_num); | 790 | debug("count of buses controlled by this ctlr: %x\n", bus_num); |
791 | 791 | ||
792 | /* init slot structure, fetch slot, bus, cap... */ | 792 | /* init slot structure, fetch slot, bus, cap... */ |
793 | slot_ptr = hpc_ptr->slots; | 793 | slot_ptr = hpc_ptr->slots; |
794 | for (slot = 0; slot < slot_num; slot++) { | 794 | for (slot = 0; slot < slot_num; slot++) { |
795 | slot_ptr->slot_num = readb (io_mem + addr_slot); | 795 | slot_ptr->slot_num = readb(io_mem + addr_slot); |
796 | slot_ptr->slot_bus_num = readb (io_mem + addr_slot + slot_num); | 796 | slot_ptr->slot_bus_num = readb(io_mem + addr_slot + slot_num); |
797 | slot_ptr->ctl_index = readb (io_mem + addr_slot + 2*slot_num); | 797 | slot_ptr->ctl_index = readb(io_mem + addr_slot + 2*slot_num); |
798 | slot_ptr->slot_cap = readb (io_mem + addr_slot + 3*slot_num); | 798 | slot_ptr->slot_cap = readb(io_mem + addr_slot + 3*slot_num); |
799 | 799 | ||
800 | // create bus_info lined list --- if only one slot per bus: slot_min = slot_max | 800 | // create bus_info lined list --- if only one slot per bus: slot_min = slot_max |
801 | 801 | ||
802 | bus_info_ptr2 = ibmphp_find_same_bus_num (slot_ptr->slot_bus_num); | 802 | bus_info_ptr2 = ibmphp_find_same_bus_num(slot_ptr->slot_bus_num); |
803 | if (!bus_info_ptr2) { | 803 | if (!bus_info_ptr2) { |
804 | bus_info_ptr1 = kzalloc(sizeof(struct bus_info), GFP_KERNEL); | 804 | bus_info_ptr1 = kzalloc(sizeof(struct bus_info), GFP_KERNEL); |
805 | if (!bus_info_ptr1) { | 805 | if (!bus_info_ptr1) { |
@@ -816,11 +816,11 @@ static int __init ebda_rsrc_controller (void) | |||
816 | 816 | ||
817 | bus_info_ptr1->controller_id = hpc_ptr->ctlr_id; | 817 | bus_info_ptr1->controller_id = hpc_ptr->ctlr_id; |
818 | 818 | ||
819 | list_add_tail (&bus_info_ptr1->bus_info_list, &bus_info_head); | 819 | list_add_tail(&bus_info_ptr1->bus_info_list, &bus_info_head); |
820 | 820 | ||
821 | } else { | 821 | } else { |
822 | bus_info_ptr2->slot_min = min (bus_info_ptr2->slot_min, slot_ptr->slot_num); | 822 | bus_info_ptr2->slot_min = min(bus_info_ptr2->slot_min, slot_ptr->slot_num); |
823 | bus_info_ptr2->slot_max = max (bus_info_ptr2->slot_max, slot_ptr->slot_num); | 823 | bus_info_ptr2->slot_max = max(bus_info_ptr2->slot_max, slot_ptr->slot_num); |
824 | bus_info_ptr2->slot_count += 1; | 824 | bus_info_ptr2->slot_count += 1; |
825 | 825 | ||
826 | } | 826 | } |
@@ -834,17 +834,17 @@ static int __init ebda_rsrc_controller (void) | |||
834 | /* init bus structure */ | 834 | /* init bus structure */ |
835 | bus_ptr = hpc_ptr->buses; | 835 | bus_ptr = hpc_ptr->buses; |
836 | for (bus = 0; bus < bus_num; bus++) { | 836 | for (bus = 0; bus < bus_num; bus++) { |
837 | bus_ptr->bus_num = readb (io_mem + addr_bus + bus); | 837 | bus_ptr->bus_num = readb(io_mem + addr_bus + bus); |
838 | bus_ptr->slots_at_33_conv = readb (io_mem + addr_bus + bus_num + 8 * bus); | 838 | bus_ptr->slots_at_33_conv = readb(io_mem + addr_bus + bus_num + 8 * bus); |
839 | bus_ptr->slots_at_66_conv = readb (io_mem + addr_bus + bus_num + 8 * bus + 1); | 839 | bus_ptr->slots_at_66_conv = readb(io_mem + addr_bus + bus_num + 8 * bus + 1); |
840 | 840 | ||
841 | bus_ptr->slots_at_66_pcix = readb (io_mem + addr_bus + bus_num + 8 * bus + 2); | 841 | bus_ptr->slots_at_66_pcix = readb(io_mem + addr_bus + bus_num + 8 * bus + 2); |
842 | 842 | ||
843 | bus_ptr->slots_at_100_pcix = readb (io_mem + addr_bus + bus_num + 8 * bus + 3); | 843 | bus_ptr->slots_at_100_pcix = readb(io_mem + addr_bus + bus_num + 8 * bus + 3); |
844 | 844 | ||
845 | bus_ptr->slots_at_133_pcix = readb (io_mem + addr_bus + bus_num + 8 * bus + 4); | 845 | bus_ptr->slots_at_133_pcix = readb(io_mem + addr_bus + bus_num + 8 * bus + 4); |
846 | 846 | ||
847 | bus_info_ptr2 = ibmphp_find_same_bus_num (bus_ptr->bus_num); | 847 | bus_info_ptr2 = ibmphp_find_same_bus_num(bus_ptr->bus_num); |
848 | if (bus_info_ptr2) { | 848 | if (bus_info_ptr2) { |
849 | bus_info_ptr2->slots_at_33_conv = bus_ptr->slots_at_33_conv; | 849 | bus_info_ptr2->slots_at_33_conv = bus_ptr->slots_at_33_conv; |
850 | bus_info_ptr2->slots_at_66_conv = bus_ptr->slots_at_66_conv; | 850 | bus_info_ptr2->slots_at_66_conv = bus_ptr->slots_at_66_conv; |
@@ -859,33 +859,33 @@ static int __init ebda_rsrc_controller (void) | |||
859 | 859 | ||
860 | switch (hpc_ptr->ctlr_type) { | 860 | switch (hpc_ptr->ctlr_type) { |
861 | case 1: | 861 | case 1: |
862 | hpc_ptr->u.pci_ctlr.bus = readb (io_mem + addr); | 862 | hpc_ptr->u.pci_ctlr.bus = readb(io_mem + addr); |
863 | hpc_ptr->u.pci_ctlr.dev_fun = readb (io_mem + addr + 1); | 863 | hpc_ptr->u.pci_ctlr.dev_fun = readb(io_mem + addr + 1); |
864 | hpc_ptr->irq = readb (io_mem + addr + 2); | 864 | hpc_ptr->irq = readb(io_mem + addr + 2); |
865 | addr += 3; | 865 | addr += 3; |
866 | debug ("ctrl bus = %x, ctlr devfun = %x, irq = %x\n", | 866 | debug("ctrl bus = %x, ctlr devfun = %x, irq = %x\n", |
867 | hpc_ptr->u.pci_ctlr.bus, | 867 | hpc_ptr->u.pci_ctlr.bus, |
868 | hpc_ptr->u.pci_ctlr.dev_fun, hpc_ptr->irq); | 868 | hpc_ptr->u.pci_ctlr.dev_fun, hpc_ptr->irq); |
869 | break; | 869 | break; |
870 | 870 | ||
871 | case 0: | 871 | case 0: |
872 | hpc_ptr->u.isa_ctlr.io_start = readw (io_mem + addr); | 872 | hpc_ptr->u.isa_ctlr.io_start = readw(io_mem + addr); |
873 | hpc_ptr->u.isa_ctlr.io_end = readw (io_mem + addr + 2); | 873 | hpc_ptr->u.isa_ctlr.io_end = readw(io_mem + addr + 2); |
874 | if (!request_region (hpc_ptr->u.isa_ctlr.io_start, | 874 | if (!request_region(hpc_ptr->u.isa_ctlr.io_start, |
875 | (hpc_ptr->u.isa_ctlr.io_end - hpc_ptr->u.isa_ctlr.io_start + 1), | 875 | (hpc_ptr->u.isa_ctlr.io_end - hpc_ptr->u.isa_ctlr.io_start + 1), |
876 | "ibmphp")) { | 876 | "ibmphp")) { |
877 | rc = -ENODEV; | 877 | rc = -ENODEV; |
878 | goto error_no_hp_slot; | 878 | goto error_no_hp_slot; |
879 | } | 879 | } |
880 | hpc_ptr->irq = readb (io_mem + addr + 4); | 880 | hpc_ptr->irq = readb(io_mem + addr + 4); |
881 | addr += 5; | 881 | addr += 5; |
882 | break; | 882 | break; |
883 | 883 | ||
884 | case 2: | 884 | case 2: |
885 | case 4: | 885 | case 4: |
886 | hpc_ptr->u.wpeg_ctlr.wpegbbar = readl (io_mem + addr); | 886 | hpc_ptr->u.wpeg_ctlr.wpegbbar = readl(io_mem + addr); |
887 | hpc_ptr->u.wpeg_ctlr.i2c_addr = readb (io_mem + addr + 4); | 887 | hpc_ptr->u.wpeg_ctlr.i2c_addr = readb(io_mem + addr + 4); |
888 | hpc_ptr->irq = readb (io_mem + addr + 5); | 888 | hpc_ptr->irq = readb(io_mem + addr + 5); |
889 | addr += 6; | 889 | addr += 6; |
890 | break; | 890 | break; |
891 | default: | 891 | default: |
@@ -894,8 +894,8 @@ static int __init ebda_rsrc_controller (void) | |||
894 | } | 894 | } |
895 | 895 | ||
896 | //reorganize chassis' linked list | 896 | //reorganize chassis' linked list |
897 | combine_wpg_for_chassis (); | 897 | combine_wpg_for_chassis(); |
898 | combine_wpg_for_expansion (); | 898 | combine_wpg_for_expansion(); |
899 | hpc_ptr->revision = 0xff; | 899 | hpc_ptr->revision = 0xff; |
900 | hpc_ptr->options = 0xff; | 900 | hpc_ptr->options = 0xff; |
901 | hpc_ptr->starting_slot_num = hpc_ptr->slots[0].slot_num; | 901 | hpc_ptr->starting_slot_num = hpc_ptr->slots[0].slot_num; |
@@ -940,7 +940,7 @@ static int __init ebda_rsrc_controller (void) | |||
940 | 940 | ||
941 | tmp_slot->bus = hpc_ptr->slots[index].slot_bus_num; | 941 | tmp_slot->bus = hpc_ptr->slots[index].slot_bus_num; |
942 | 942 | ||
943 | bus_info_ptr1 = ibmphp_find_same_bus_num (hpc_ptr->slots[index].slot_bus_num); | 943 | bus_info_ptr1 = ibmphp_find_same_bus_num(hpc_ptr->slots[index].slot_bus_num); |
944 | if (!bus_info_ptr1) { | 944 | if (!bus_info_ptr1) { |
945 | kfree(tmp_slot); | 945 | kfree(tmp_slot); |
946 | rc = -ENODEV; | 946 | rc = -ENODEV; |
@@ -961,18 +961,18 @@ static int __init ebda_rsrc_controller (void) | |||
961 | if (rc) | 961 | if (rc) |
962 | goto error; | 962 | goto error; |
963 | 963 | ||
964 | rc = ibmphp_init_devno ((struct slot **) &hp_slot_ptr->private); | 964 | rc = ibmphp_init_devno((struct slot **) &hp_slot_ptr->private); |
965 | if (rc) | 965 | if (rc) |
966 | goto error; | 966 | goto error; |
967 | hp_slot_ptr->ops = &ibmphp_hotplug_slot_ops; | 967 | hp_slot_ptr->ops = &ibmphp_hotplug_slot_ops; |
968 | 968 | ||
969 | // end of registering ibm slot with hotplug core | 969 | // end of registering ibm slot with hotplug core |
970 | 970 | ||
971 | list_add (& ((struct slot *)(hp_slot_ptr->private))->ibm_slot_list, &ibmphp_slot_head); | 971 | list_add(&((struct slot *)(hp_slot_ptr->private))->ibm_slot_list, &ibmphp_slot_head); |
972 | } | 972 | } |
973 | 973 | ||
974 | print_bus_info (); | 974 | print_bus_info(); |
975 | list_add (&hpc_ptr->ebda_hpc_list, &ebda_hpc_head ); | 975 | list_add(&hpc_ptr->ebda_hpc_list, &ebda_hpc_head); |
976 | 976 | ||
977 | } /* each hpc */ | 977 | } /* each hpc */ |
978 | 978 | ||
@@ -982,20 +982,20 @@ static int __init ebda_rsrc_controller (void) | |||
982 | pci_find_bus(0, tmp_slot->bus), tmp_slot->device, name); | 982 | pci_find_bus(0, tmp_slot->bus), tmp_slot->device, name); |
983 | } | 983 | } |
984 | 984 | ||
985 | print_ebda_hpc (); | 985 | print_ebda_hpc(); |
986 | print_ibm_slot (); | 986 | print_ibm_slot(); |
987 | return 0; | 987 | return 0; |
988 | 988 | ||
989 | error: | 989 | error: |
990 | kfree (hp_slot_ptr->private); | 990 | kfree(hp_slot_ptr->private); |
991 | error_no_slot: | 991 | error_no_slot: |
992 | kfree (hp_slot_ptr->info); | 992 | kfree(hp_slot_ptr->info); |
993 | error_no_hp_info: | 993 | error_no_hp_info: |
994 | kfree (hp_slot_ptr); | 994 | kfree(hp_slot_ptr); |
995 | error_no_hp_slot: | 995 | error_no_hp_slot: |
996 | free_ebda_hpc (hpc_ptr); | 996 | free_ebda_hpc(hpc_ptr); |
997 | error_no_hpc: | 997 | error_no_hpc: |
998 | iounmap (io_mem); | 998 | iounmap(io_mem); |
999 | return rc; | 999 | return rc; |
1000 | } | 1000 | } |
1001 | 1001 | ||
@@ -1003,7 +1003,7 @@ error_no_hpc: | |||
1003 | * map info (bus, devfun, start addr, end addr..) of i/o, memory, | 1003 | * map info (bus, devfun, start addr, end addr..) of i/o, memory, |
1004 | * pfm from the physical addr to a list of resource. | 1004 | * pfm from the physical addr to a list of resource. |
1005 | */ | 1005 | */ |
1006 | static int __init ebda_rsrc_rsrc (void) | 1006 | static int __init ebda_rsrc_rsrc(void) |
1007 | { | 1007 | { |
1008 | u16 addr; | 1008 | u16 addr; |
1009 | short rsrc; | 1009 | short rsrc; |
@@ -1011,69 +1011,69 @@ static int __init ebda_rsrc_rsrc (void) | |||
1011 | struct ebda_pci_rsrc *rsrc_ptr; | 1011 | struct ebda_pci_rsrc *rsrc_ptr; |
1012 | 1012 | ||
1013 | addr = rsrc_list_ptr->phys_addr; | 1013 | addr = rsrc_list_ptr->phys_addr; |
1014 | debug ("now entering rsrc land\n"); | 1014 | debug("now entering rsrc land\n"); |
1015 | debug ("offset of rsrc: %x\n", rsrc_list_ptr->phys_addr); | 1015 | debug("offset of rsrc: %x\n", rsrc_list_ptr->phys_addr); |
1016 | 1016 | ||
1017 | for (rsrc = 0; rsrc < rsrc_list_ptr->num_entries; rsrc++) { | 1017 | for (rsrc = 0; rsrc < rsrc_list_ptr->num_entries; rsrc++) { |
1018 | type = readb (io_mem + addr); | 1018 | type = readb(io_mem + addr); |
1019 | 1019 | ||
1020 | addr += 1; | 1020 | addr += 1; |
1021 | rsrc_type = type & EBDA_RSRC_TYPE_MASK; | 1021 | rsrc_type = type & EBDA_RSRC_TYPE_MASK; |
1022 | 1022 | ||
1023 | if (rsrc_type == EBDA_IO_RSRC_TYPE) { | 1023 | if (rsrc_type == EBDA_IO_RSRC_TYPE) { |
1024 | rsrc_ptr = alloc_ebda_pci_rsrc (); | 1024 | rsrc_ptr = alloc_ebda_pci_rsrc(); |
1025 | if (!rsrc_ptr) { | 1025 | if (!rsrc_ptr) { |
1026 | iounmap (io_mem); | 1026 | iounmap(io_mem); |
1027 | return -ENOMEM; | 1027 | return -ENOMEM; |
1028 | } | 1028 | } |
1029 | rsrc_ptr->rsrc_type = type; | 1029 | rsrc_ptr->rsrc_type = type; |
1030 | 1030 | ||
1031 | rsrc_ptr->bus_num = readb (io_mem + addr); | 1031 | rsrc_ptr->bus_num = readb(io_mem + addr); |
1032 | rsrc_ptr->dev_fun = readb (io_mem + addr + 1); | 1032 | rsrc_ptr->dev_fun = readb(io_mem + addr + 1); |
1033 | rsrc_ptr->start_addr = readw (io_mem + addr + 2); | 1033 | rsrc_ptr->start_addr = readw(io_mem + addr + 2); |
1034 | rsrc_ptr->end_addr = readw (io_mem + addr + 4); | 1034 | rsrc_ptr->end_addr = readw(io_mem + addr + 4); |
1035 | addr += 6; | 1035 | addr += 6; |
1036 | 1036 | ||
1037 | debug ("rsrc from io type ----\n"); | 1037 | debug("rsrc from io type ----\n"); |
1038 | debug ("rsrc type: %x bus#: %x dev_func: %x start addr: %x end addr: %x\n", | 1038 | debug("rsrc type: %x bus#: %x dev_func: %x start addr: %x end addr: %x\n", |
1039 | rsrc_ptr->rsrc_type, rsrc_ptr->bus_num, rsrc_ptr->dev_fun, rsrc_ptr->start_addr, rsrc_ptr->end_addr); | 1039 | rsrc_ptr->rsrc_type, rsrc_ptr->bus_num, rsrc_ptr->dev_fun, rsrc_ptr->start_addr, rsrc_ptr->end_addr); |
1040 | 1040 | ||
1041 | list_add (&rsrc_ptr->ebda_pci_rsrc_list, &ibmphp_ebda_pci_rsrc_head); | 1041 | list_add(&rsrc_ptr->ebda_pci_rsrc_list, &ibmphp_ebda_pci_rsrc_head); |
1042 | } | 1042 | } |
1043 | 1043 | ||
1044 | if (rsrc_type == EBDA_MEM_RSRC_TYPE || rsrc_type == EBDA_PFM_RSRC_TYPE) { | 1044 | if (rsrc_type == EBDA_MEM_RSRC_TYPE || rsrc_type == EBDA_PFM_RSRC_TYPE) { |
1045 | rsrc_ptr = alloc_ebda_pci_rsrc (); | 1045 | rsrc_ptr = alloc_ebda_pci_rsrc(); |
1046 | if (!rsrc_ptr ) { | 1046 | if (!rsrc_ptr) { |
1047 | iounmap (io_mem); | 1047 | iounmap(io_mem); |
1048 | return -ENOMEM; | 1048 | return -ENOMEM; |
1049 | } | 1049 | } |
1050 | rsrc_ptr->rsrc_type = type; | 1050 | rsrc_ptr->rsrc_type = type; |
1051 | 1051 | ||
1052 | rsrc_ptr->bus_num = readb (io_mem + addr); | 1052 | rsrc_ptr->bus_num = readb(io_mem + addr); |
1053 | rsrc_ptr->dev_fun = readb (io_mem + addr + 1); | 1053 | rsrc_ptr->dev_fun = readb(io_mem + addr + 1); |
1054 | rsrc_ptr->start_addr = readl (io_mem + addr + 2); | 1054 | rsrc_ptr->start_addr = readl(io_mem + addr + 2); |
1055 | rsrc_ptr->end_addr = readl (io_mem + addr + 6); | 1055 | rsrc_ptr->end_addr = readl(io_mem + addr + 6); |
1056 | addr += 10; | 1056 | addr += 10; |
1057 | 1057 | ||
1058 | debug ("rsrc from mem or pfm ---\n"); | 1058 | debug("rsrc from mem or pfm ---\n"); |
1059 | debug ("rsrc type: %x bus#: %x dev_func: %x start addr: %x end addr: %x\n", | 1059 | debug("rsrc type: %x bus#: %x dev_func: %x start addr: %x end addr: %x\n", |
1060 | rsrc_ptr->rsrc_type, rsrc_ptr->bus_num, rsrc_ptr->dev_fun, rsrc_ptr->start_addr, rsrc_ptr->end_addr); | 1060 | rsrc_ptr->rsrc_type, rsrc_ptr->bus_num, rsrc_ptr->dev_fun, rsrc_ptr->start_addr, rsrc_ptr->end_addr); |
1061 | 1061 | ||
1062 | list_add (&rsrc_ptr->ebda_pci_rsrc_list, &ibmphp_ebda_pci_rsrc_head); | 1062 | list_add(&rsrc_ptr->ebda_pci_rsrc_list, &ibmphp_ebda_pci_rsrc_head); |
1063 | } | 1063 | } |
1064 | } | 1064 | } |
1065 | kfree (rsrc_list_ptr); | 1065 | kfree(rsrc_list_ptr); |
1066 | rsrc_list_ptr = NULL; | 1066 | rsrc_list_ptr = NULL; |
1067 | print_ebda_pci_rsrc (); | 1067 | print_ebda_pci_rsrc(); |
1068 | return 0; | 1068 | return 0; |
1069 | } | 1069 | } |
1070 | 1070 | ||
1071 | u16 ibmphp_get_total_controllers (void) | 1071 | u16 ibmphp_get_total_controllers(void) |
1072 | { | 1072 | { |
1073 | return hpc_list_ptr->num_ctlrs; | 1073 | return hpc_list_ptr->num_ctlrs; |
1074 | } | 1074 | } |
1075 | 1075 | ||
1076 | struct slot *ibmphp_get_slot_from_physical_num (u8 physical_num) | 1076 | struct slot *ibmphp_get_slot_from_physical_num(u8 physical_num) |
1077 | { | 1077 | { |
1078 | struct slot *slot; | 1078 | struct slot *slot; |
1079 | 1079 | ||
@@ -1090,7 +1090,7 @@ struct slot *ibmphp_get_slot_from_physical_num (u8 physical_num) | |||
1090 | * - the total number of the slots based on each bus | 1090 | * - the total number of the slots based on each bus |
1091 | * (if only one slot per bus slot_min = slot_max ) | 1091 | * (if only one slot per bus slot_min = slot_max ) |
1092 | */ | 1092 | */ |
1093 | struct bus_info *ibmphp_find_same_bus_num (u32 num) | 1093 | struct bus_info *ibmphp_find_same_bus_num(u32 num) |
1094 | { | 1094 | { |
1095 | struct bus_info *ptr; | 1095 | struct bus_info *ptr; |
1096 | 1096 | ||
@@ -1104,7 +1104,7 @@ struct bus_info *ibmphp_find_same_bus_num (u32 num) | |||
1104 | /* Finding relative bus number, in order to map corresponding | 1104 | /* Finding relative bus number, in order to map corresponding |
1105 | * bus register | 1105 | * bus register |
1106 | */ | 1106 | */ |
1107 | int ibmphp_get_bus_index (u8 num) | 1107 | int ibmphp_get_bus_index(u8 num) |
1108 | { | 1108 | { |
1109 | struct bus_info *ptr; | 1109 | struct bus_info *ptr; |
1110 | 1110 | ||
@@ -1115,46 +1115,46 @@ int ibmphp_get_bus_index (u8 num) | |||
1115 | return -ENODEV; | 1115 | return -ENODEV; |
1116 | } | 1116 | } |
1117 | 1117 | ||
1118 | void ibmphp_free_bus_info_queue (void) | 1118 | void ibmphp_free_bus_info_queue(void) |
1119 | { | 1119 | { |
1120 | struct bus_info *bus_info; | 1120 | struct bus_info *bus_info; |
1121 | struct list_head *list; | 1121 | struct list_head *list; |
1122 | struct list_head *next; | 1122 | struct list_head *next; |
1123 | 1123 | ||
1124 | list_for_each_safe (list, next, &bus_info_head ) { | 1124 | list_for_each_safe(list, next, &bus_info_head) { |
1125 | bus_info = list_entry (list, struct bus_info, bus_info_list); | 1125 | bus_info = list_entry(list, struct bus_info, bus_info_list); |
1126 | kfree (bus_info); | 1126 | kfree(bus_info); |
1127 | } | 1127 | } |
1128 | } | 1128 | } |
1129 | 1129 | ||
1130 | void ibmphp_free_ebda_hpc_queue (void) | 1130 | void ibmphp_free_ebda_hpc_queue(void) |
1131 | { | 1131 | { |
1132 | struct controller *controller = NULL; | 1132 | struct controller *controller = NULL; |
1133 | struct list_head *list; | 1133 | struct list_head *list; |
1134 | struct list_head *next; | 1134 | struct list_head *next; |
1135 | int pci_flag = 0; | 1135 | int pci_flag = 0; |
1136 | 1136 | ||
1137 | list_for_each_safe (list, next, &ebda_hpc_head) { | 1137 | list_for_each_safe(list, next, &ebda_hpc_head) { |
1138 | controller = list_entry (list, struct controller, ebda_hpc_list); | 1138 | controller = list_entry(list, struct controller, ebda_hpc_list); |
1139 | if (controller->ctlr_type == 0) | 1139 | if (controller->ctlr_type == 0) |
1140 | release_region (controller->u.isa_ctlr.io_start, (controller->u.isa_ctlr.io_end - controller->u.isa_ctlr.io_start + 1)); | 1140 | release_region(controller->u.isa_ctlr.io_start, (controller->u.isa_ctlr.io_end - controller->u.isa_ctlr.io_start + 1)); |
1141 | else if ((controller->ctlr_type == 1) && (!pci_flag)) { | 1141 | else if ((controller->ctlr_type == 1) && (!pci_flag)) { |
1142 | ++pci_flag; | 1142 | ++pci_flag; |
1143 | pci_unregister_driver (&ibmphp_driver); | 1143 | pci_unregister_driver(&ibmphp_driver); |
1144 | } | 1144 | } |
1145 | free_ebda_hpc (controller); | 1145 | free_ebda_hpc(controller); |
1146 | } | 1146 | } |
1147 | } | 1147 | } |
1148 | 1148 | ||
1149 | void ibmphp_free_ebda_pci_rsrc_queue (void) | 1149 | void ibmphp_free_ebda_pci_rsrc_queue(void) |
1150 | { | 1150 | { |
1151 | struct ebda_pci_rsrc *resource; | 1151 | struct ebda_pci_rsrc *resource; |
1152 | struct list_head *list; | 1152 | struct list_head *list; |
1153 | struct list_head *next; | 1153 | struct list_head *next; |
1154 | 1154 | ||
1155 | list_for_each_safe (list, next, &ibmphp_ebda_pci_rsrc_head) { | 1155 | list_for_each_safe(list, next, &ibmphp_ebda_pci_rsrc_head) { |
1156 | resource = list_entry (list, struct ebda_pci_rsrc, ebda_pci_rsrc_list); | 1156 | resource = list_entry(list, struct ebda_pci_rsrc, ebda_pci_rsrc_list); |
1157 | kfree (resource); | 1157 | kfree(resource); |
1158 | resource = NULL; | 1158 | resource = NULL; |
1159 | } | 1159 | } |
1160 | } | 1160 | } |
@@ -1171,14 +1171,14 @@ static struct pci_device_id id_table[] = { | |||
1171 | 1171 | ||
1172 | MODULE_DEVICE_TABLE(pci, id_table); | 1172 | MODULE_DEVICE_TABLE(pci, id_table); |
1173 | 1173 | ||
1174 | static int ibmphp_probe (struct pci_dev *, const struct pci_device_id *); | 1174 | static int ibmphp_probe(struct pci_dev *, const struct pci_device_id *); |
1175 | static struct pci_driver ibmphp_driver = { | 1175 | static struct pci_driver ibmphp_driver = { |
1176 | .name = "ibmphp", | 1176 | .name = "ibmphp", |
1177 | .id_table = id_table, | 1177 | .id_table = id_table, |
1178 | .probe = ibmphp_probe, | 1178 | .probe = ibmphp_probe, |
1179 | }; | 1179 | }; |
1180 | 1180 | ||
1181 | int ibmphp_register_pci (void) | 1181 | int ibmphp_register_pci(void) |
1182 | { | 1182 | { |
1183 | struct controller *ctrl; | 1183 | struct controller *ctrl; |
1184 | int rc = 0; | 1184 | int rc = 0; |
@@ -1191,18 +1191,18 @@ int ibmphp_register_pci (void) | |||
1191 | } | 1191 | } |
1192 | return rc; | 1192 | return rc; |
1193 | } | 1193 | } |
1194 | static int ibmphp_probe (struct pci_dev *dev, const struct pci_device_id *ids) | 1194 | static int ibmphp_probe(struct pci_dev *dev, const struct pci_device_id *ids) |
1195 | { | 1195 | { |
1196 | struct controller *ctrl; | 1196 | struct controller *ctrl; |
1197 | 1197 | ||
1198 | debug ("inside ibmphp_probe\n"); | 1198 | debug("inside ibmphp_probe\n"); |
1199 | 1199 | ||
1200 | list_for_each_entry(ctrl, &ebda_hpc_head, ebda_hpc_list) { | 1200 | list_for_each_entry(ctrl, &ebda_hpc_head, ebda_hpc_list) { |
1201 | if (ctrl->ctlr_type == 1) { | 1201 | if (ctrl->ctlr_type == 1) { |
1202 | if ((dev->devfn == ctrl->u.pci_ctlr.dev_fun) && (dev->bus->number == ctrl->u.pci_ctlr.bus)) { | 1202 | if ((dev->devfn == ctrl->u.pci_ctlr.dev_fun) && (dev->bus->number == ctrl->u.pci_ctlr.bus)) { |
1203 | ctrl->ctrl_dev = dev; | 1203 | ctrl->ctrl_dev = dev; |
1204 | debug ("found device!!!\n"); | 1204 | debug("found device!!!\n"); |
1205 | debug ("dev->device = %x, dev->subsystem_device = %x\n", dev->device, dev->subsystem_device); | 1205 | debug("dev->device = %x, dev->subsystem_device = %x\n", dev->device, dev->subsystem_device); |
1206 | return 0; | 1206 | return 0; |
1207 | } | 1207 | } |
1208 | } | 1208 | } |
diff --git a/drivers/pci/hotplug/ibmphp_hpc.c b/drivers/pci/hotplug/ibmphp_hpc.c index 220876715a08..035425adb24e 100644 --- a/drivers/pci/hotplug/ibmphp_hpc.c +++ b/drivers/pci/hotplug/ibmphp_hpc.c | |||
@@ -40,7 +40,7 @@ | |||
40 | #include "ibmphp.h" | 40 | #include "ibmphp.h" |
41 | 41 | ||
42 | static int to_debug = 0; | 42 | static int to_debug = 0; |
43 | #define debug_polling(fmt, arg...) do { if (to_debug) debug (fmt, arg); } while (0) | 43 | #define debug_polling(fmt, arg...) do { if (to_debug) debug(fmt, arg); } while (0) |
44 | 44 | ||
45 | //---------------------------------------------------------------------------- | 45 | //---------------------------------------------------------------------------- |
46 | // timeout values | 46 | // timeout values |
@@ -110,16 +110,16 @@ static struct task_struct *ibmphp_poll_thread; | |||
110 | //---------------------------------------------------------------------------- | 110 | //---------------------------------------------------------------------------- |
111 | // local function prototypes | 111 | // local function prototypes |
112 | //---------------------------------------------------------------------------- | 112 | //---------------------------------------------------------------------------- |
113 | static u8 i2c_ctrl_read (struct controller *, void __iomem *, u8); | 113 | static u8 i2c_ctrl_read(struct controller *, void __iomem *, u8); |
114 | static u8 i2c_ctrl_write (struct controller *, void __iomem *, u8, u8); | 114 | static u8 i2c_ctrl_write(struct controller *, void __iomem *, u8, u8); |
115 | static u8 hpc_writecmdtoindex (u8, u8); | 115 | static u8 hpc_writecmdtoindex(u8, u8); |
116 | static u8 hpc_readcmdtoindex (u8, u8); | 116 | static u8 hpc_readcmdtoindex(u8, u8); |
117 | static void get_hpc_access (void); | 117 | static void get_hpc_access(void); |
118 | static void free_hpc_access (void); | 118 | static void free_hpc_access(void); |
119 | static int poll_hpc(void *data); | 119 | static int poll_hpc(void *data); |
120 | static int process_changeinstatus (struct slot *, struct slot *); | 120 | static int process_changeinstatus(struct slot *, struct slot *); |
121 | static int process_changeinlatch (u8, u8, struct controller *); | 121 | static int process_changeinlatch(u8, u8, struct controller *); |
122 | static int hpc_wait_ctlr_notworking (int, struct controller *, void __iomem *, u8 *); | 122 | static int hpc_wait_ctlr_notworking(int, struct controller *, void __iomem *, u8 *); |
123 | //---------------------------------------------------------------------------- | 123 | //---------------------------------------------------------------------------- |
124 | 124 | ||
125 | 125 | ||
@@ -128,16 +128,16 @@ static int hpc_wait_ctlr_notworking (int, struct controller *, void __iomem *, u | |||
128 | * | 128 | * |
129 | * Action: initialize semaphores and variables | 129 | * Action: initialize semaphores and variables |
130 | *---------------------------------------------------------------------*/ | 130 | *---------------------------------------------------------------------*/ |
131 | void __init ibmphp_hpc_initvars (void) | 131 | void __init ibmphp_hpc_initvars(void) |
132 | { | 132 | { |
133 | debug ("%s - Entry\n", __func__); | 133 | debug("%s - Entry\n", __func__); |
134 | 134 | ||
135 | mutex_init(&sem_hpcaccess); | 135 | mutex_init(&sem_hpcaccess); |
136 | sema_init(&semOperations, 1); | 136 | sema_init(&semOperations, 1); |
137 | sema_init(&sem_exit, 0); | 137 | sema_init(&sem_exit, 0); |
138 | to_debug = 0; | 138 | to_debug = 0; |
139 | 139 | ||
140 | debug ("%s - Exit\n", __func__); | 140 | debug("%s - Exit\n", __func__); |
141 | } | 141 | } |
142 | 142 | ||
143 | /*---------------------------------------------------------------------- | 143 | /*---------------------------------------------------------------------- |
@@ -146,7 +146,7 @@ void __init ibmphp_hpc_initvars (void) | |||
146 | * Action: read from HPC over I2C | 146 | * Action: read from HPC over I2C |
147 | * | 147 | * |
148 | *---------------------------------------------------------------------*/ | 148 | *---------------------------------------------------------------------*/ |
149 | static u8 i2c_ctrl_read (struct controller *ctlr_ptr, void __iomem *WPGBbar, u8 index) | 149 | static u8 i2c_ctrl_read(struct controller *ctlr_ptr, void __iomem *WPGBbar, u8 index) |
150 | { | 150 | { |
151 | u8 status; | 151 | u8 status; |
152 | int i; | 152 | int i; |
@@ -155,7 +155,7 @@ static u8 i2c_ctrl_read (struct controller *ctlr_ptr, void __iomem *WPGBbar, u8 | |||
155 | unsigned long ultemp; | 155 | unsigned long ultemp; |
156 | unsigned long data; // actual data HILO format | 156 | unsigned long data; // actual data HILO format |
157 | 157 | ||
158 | debug_polling ("%s - Entry WPGBbar[%p] index[%x] \n", __func__, WPGBbar, index); | 158 | debug_polling("%s - Entry WPGBbar[%p] index[%x] \n", __func__, WPGBbar, index); |
159 | 159 | ||
160 | //-------------------------------------------------------------------- | 160 | //-------------------------------------------------------------------- |
161 | // READ - step 1 | 161 | // READ - step 1 |
@@ -178,28 +178,28 @@ static u8 i2c_ctrl_read (struct controller *ctlr_ptr, void __iomem *WPGBbar, u8 | |||
178 | ultemp = ultemp << 8; | 178 | ultemp = ultemp << 8; |
179 | data |= ultemp; | 179 | data |= ultemp; |
180 | } else { | 180 | } else { |
181 | err ("this controller type is not supported \n"); | 181 | err("this controller type is not supported \n"); |
182 | return HPC_ERROR; | 182 | return HPC_ERROR; |
183 | } | 183 | } |
184 | 184 | ||
185 | wpg_data = swab32 (data); // swap data before writing | 185 | wpg_data = swab32(data); // swap data before writing |
186 | wpg_addr = WPGBbar + WPG_I2CMOSUP_OFFSET; | 186 | wpg_addr = WPGBbar + WPG_I2CMOSUP_OFFSET; |
187 | writel (wpg_data, wpg_addr); | 187 | writel(wpg_data, wpg_addr); |
188 | 188 | ||
189 | //-------------------------------------------------------------------- | 189 | //-------------------------------------------------------------------- |
190 | // READ - step 2 : clear the message buffer | 190 | // READ - step 2 : clear the message buffer |
191 | data = 0x00000000; | 191 | data = 0x00000000; |
192 | wpg_data = swab32 (data); | 192 | wpg_data = swab32(data); |
193 | wpg_addr = WPGBbar + WPG_I2CMBUFL_OFFSET; | 193 | wpg_addr = WPGBbar + WPG_I2CMBUFL_OFFSET; |
194 | writel (wpg_data, wpg_addr); | 194 | writel(wpg_data, wpg_addr); |
195 | 195 | ||
196 | //-------------------------------------------------------------------- | 196 | //-------------------------------------------------------------------- |
197 | // READ - step 3 : issue start operation, I2C master control bit 30:ON | 197 | // READ - step 3 : issue start operation, I2C master control bit 30:ON |
198 | // 2020 : [20] OR operation at [20] offset 0x20 | 198 | // 2020 : [20] OR operation at [20] offset 0x20 |
199 | data = WPG_I2CMCNTL_STARTOP_MASK; | 199 | data = WPG_I2CMCNTL_STARTOP_MASK; |
200 | wpg_data = swab32 (data); | 200 | wpg_data = swab32(data); |
201 | wpg_addr = WPGBbar + WPG_I2CMCNTL_OFFSET + WPG_I2C_OR; | 201 | wpg_addr = WPGBbar + WPG_I2CMCNTL_OFFSET + WPG_I2C_OR; |
202 | writel (wpg_data, wpg_addr); | 202 | writel(wpg_data, wpg_addr); |
203 | 203 | ||
204 | //-------------------------------------------------------------------- | 204 | //-------------------------------------------------------------------- |
205 | // READ - step 4 : wait until start operation bit clears | 205 | // READ - step 4 : wait until start operation bit clears |
@@ -207,14 +207,14 @@ static u8 i2c_ctrl_read (struct controller *ctlr_ptr, void __iomem *WPGBbar, u8 | |||
207 | while (i) { | 207 | while (i) { |
208 | msleep(10); | 208 | msleep(10); |
209 | wpg_addr = WPGBbar + WPG_I2CMCNTL_OFFSET; | 209 | wpg_addr = WPGBbar + WPG_I2CMCNTL_OFFSET; |
210 | wpg_data = readl (wpg_addr); | 210 | wpg_data = readl(wpg_addr); |
211 | data = swab32 (wpg_data); | 211 | data = swab32(wpg_data); |
212 | if (!(data & WPG_I2CMCNTL_STARTOP_MASK)) | 212 | if (!(data & WPG_I2CMCNTL_STARTOP_MASK)) |
213 | break; | 213 | break; |
214 | i--; | 214 | i--; |
215 | } | 215 | } |
216 | if (i == 0) { | 216 | if (i == 0) { |
217 | debug ("%s - Error : WPG timeout\n", __func__); | 217 | debug("%s - Error : WPG timeout\n", __func__); |
218 | return HPC_ERROR; | 218 | return HPC_ERROR; |
219 | } | 219 | } |
220 | //-------------------------------------------------------------------- | 220 | //-------------------------------------------------------------------- |
@@ -223,26 +223,26 @@ static u8 i2c_ctrl_read (struct controller *ctlr_ptr, void __iomem *WPGBbar, u8 | |||
223 | while (i) { | 223 | while (i) { |
224 | msleep(10); | 224 | msleep(10); |
225 | wpg_addr = WPGBbar + WPG_I2CSTAT_OFFSET; | 225 | wpg_addr = WPGBbar + WPG_I2CSTAT_OFFSET; |
226 | wpg_data = readl (wpg_addr); | 226 | wpg_data = readl(wpg_addr); |
227 | data = swab32 (wpg_data); | 227 | data = swab32(wpg_data); |
228 | if (HPC_I2CSTATUS_CHECK (data)) | 228 | if (HPC_I2CSTATUS_CHECK(data)) |
229 | break; | 229 | break; |
230 | i--; | 230 | i--; |
231 | } | 231 | } |
232 | if (i == 0) { | 232 | if (i == 0) { |
233 | debug ("ctrl_read - Exit Error:I2C timeout\n"); | 233 | debug("ctrl_read - Exit Error:I2C timeout\n"); |
234 | return HPC_ERROR; | 234 | return HPC_ERROR; |
235 | } | 235 | } |
236 | 236 | ||
237 | //-------------------------------------------------------------------- | 237 | //-------------------------------------------------------------------- |
238 | // READ - step 6 : get DATA | 238 | // READ - step 6 : get DATA |
239 | wpg_addr = WPGBbar + WPG_I2CMBUFL_OFFSET; | 239 | wpg_addr = WPGBbar + WPG_I2CMBUFL_OFFSET; |
240 | wpg_data = readl (wpg_addr); | 240 | wpg_data = readl(wpg_addr); |
241 | data = swab32 (wpg_data); | 241 | data = swab32(wpg_data); |
242 | 242 | ||
243 | status = (u8) data; | 243 | status = (u8) data; |
244 | 244 | ||
245 | debug_polling ("%s - Exit index[%x] status[%x]\n", __func__, index, status); | 245 | debug_polling("%s - Exit index[%x] status[%x]\n", __func__, index, status); |
246 | 246 | ||
247 | return (status); | 247 | return (status); |
248 | } | 248 | } |
@@ -254,7 +254,7 @@ static u8 i2c_ctrl_read (struct controller *ctlr_ptr, void __iomem *WPGBbar, u8 | |||
254 | * | 254 | * |
255 | * Return 0 or error codes | 255 | * Return 0 or error codes |
256 | *---------------------------------------------------------------------*/ | 256 | *---------------------------------------------------------------------*/ |
257 | static u8 i2c_ctrl_write (struct controller *ctlr_ptr, void __iomem *WPGBbar, u8 index, u8 cmd) | 257 | static u8 i2c_ctrl_write(struct controller *ctlr_ptr, void __iomem *WPGBbar, u8 index, u8 cmd) |
258 | { | 258 | { |
259 | u8 rc; | 259 | u8 rc; |
260 | void __iomem *wpg_addr; // base addr + offset | 260 | void __iomem *wpg_addr; // base addr + offset |
@@ -263,7 +263,7 @@ static u8 i2c_ctrl_write (struct controller *ctlr_ptr, void __iomem *WPGBbar, u8 | |||
263 | unsigned long data; // actual data HILO format | 263 | unsigned long data; // actual data HILO format |
264 | int i; | 264 | int i; |
265 | 265 | ||
266 | debug_polling ("%s - Entry WPGBbar[%p] index[%x] cmd[%x]\n", __func__, WPGBbar, index, cmd); | 266 | debug_polling("%s - Entry WPGBbar[%p] index[%x] cmd[%x]\n", __func__, WPGBbar, index, cmd); |
267 | 267 | ||
268 | rc = 0; | 268 | rc = 0; |
269 | //-------------------------------------------------------------------- | 269 | //-------------------------------------------------------------------- |
@@ -289,28 +289,28 @@ static u8 i2c_ctrl_write (struct controller *ctlr_ptr, void __iomem *WPGBbar, u8 | |||
289 | ultemp = ultemp << 8; | 289 | ultemp = ultemp << 8; |
290 | data |= ultemp; | 290 | data |= ultemp; |
291 | } else { | 291 | } else { |
292 | err ("this controller type is not supported \n"); | 292 | err("this controller type is not supported \n"); |
293 | return HPC_ERROR; | 293 | return HPC_ERROR; |
294 | } | 294 | } |
295 | 295 | ||
296 | wpg_data = swab32 (data); // swap data before writing | 296 | wpg_data = swab32(data); // swap data before writing |
297 | wpg_addr = WPGBbar + WPG_I2CMOSUP_OFFSET; | 297 | wpg_addr = WPGBbar + WPG_I2CMOSUP_OFFSET; |
298 | writel (wpg_data, wpg_addr); | 298 | writel(wpg_data, wpg_addr); |
299 | 299 | ||
300 | //-------------------------------------------------------------------- | 300 | //-------------------------------------------------------------------- |
301 | // WRITE - step 2 : clear the message buffer | 301 | // WRITE - step 2 : clear the message buffer |
302 | data = 0x00000000 | (unsigned long)cmd; | 302 | data = 0x00000000 | (unsigned long)cmd; |
303 | wpg_data = swab32 (data); | 303 | wpg_data = swab32(data); |
304 | wpg_addr = WPGBbar + WPG_I2CMBUFL_OFFSET; | 304 | wpg_addr = WPGBbar + WPG_I2CMBUFL_OFFSET; |
305 | writel (wpg_data, wpg_addr); | 305 | writel(wpg_data, wpg_addr); |
306 | 306 | ||
307 | //-------------------------------------------------------------------- | 307 | //-------------------------------------------------------------------- |
308 | // WRITE - step 3 : issue start operation,I2C master control bit 30:ON | 308 | // WRITE - step 3 : issue start operation,I2C master control bit 30:ON |
309 | // 2020 : [20] OR operation at [20] offset 0x20 | 309 | // 2020 : [20] OR operation at [20] offset 0x20 |
310 | data = WPG_I2CMCNTL_STARTOP_MASK; | 310 | data = WPG_I2CMCNTL_STARTOP_MASK; |
311 | wpg_data = swab32 (data); | 311 | wpg_data = swab32(data); |
312 | wpg_addr = WPGBbar + WPG_I2CMCNTL_OFFSET + WPG_I2C_OR; | 312 | wpg_addr = WPGBbar + WPG_I2CMCNTL_OFFSET + WPG_I2C_OR; |
313 | writel (wpg_data, wpg_addr); | 313 | writel(wpg_data, wpg_addr); |
314 | 314 | ||
315 | //-------------------------------------------------------------------- | 315 | //-------------------------------------------------------------------- |
316 | // WRITE - step 4 : wait until start operation bit clears | 316 | // WRITE - step 4 : wait until start operation bit clears |
@@ -318,14 +318,14 @@ static u8 i2c_ctrl_write (struct controller *ctlr_ptr, void __iomem *WPGBbar, u8 | |||
318 | while (i) { | 318 | while (i) { |
319 | msleep(10); | 319 | msleep(10); |
320 | wpg_addr = WPGBbar + WPG_I2CMCNTL_OFFSET; | 320 | wpg_addr = WPGBbar + WPG_I2CMCNTL_OFFSET; |
321 | wpg_data = readl (wpg_addr); | 321 | wpg_data = readl(wpg_addr); |
322 | data = swab32 (wpg_data); | 322 | data = swab32(wpg_data); |
323 | if (!(data & WPG_I2CMCNTL_STARTOP_MASK)) | 323 | if (!(data & WPG_I2CMCNTL_STARTOP_MASK)) |
324 | break; | 324 | break; |
325 | i--; | 325 | i--; |
326 | } | 326 | } |
327 | if (i == 0) { | 327 | if (i == 0) { |
328 | debug ("%s - Exit Error:WPG timeout\n", __func__); | 328 | debug("%s - Exit Error:WPG timeout\n", __func__); |
329 | rc = HPC_ERROR; | 329 | rc = HPC_ERROR; |
330 | } | 330 | } |
331 | 331 | ||
@@ -335,25 +335,25 @@ static u8 i2c_ctrl_write (struct controller *ctlr_ptr, void __iomem *WPGBbar, u8 | |||
335 | while (i) { | 335 | while (i) { |
336 | msleep(10); | 336 | msleep(10); |
337 | wpg_addr = WPGBbar + WPG_I2CSTAT_OFFSET; | 337 | wpg_addr = WPGBbar + WPG_I2CSTAT_OFFSET; |
338 | wpg_data = readl (wpg_addr); | 338 | wpg_data = readl(wpg_addr); |
339 | data = swab32 (wpg_data); | 339 | data = swab32(wpg_data); |
340 | if (HPC_I2CSTATUS_CHECK (data)) | 340 | if (HPC_I2CSTATUS_CHECK(data)) |
341 | break; | 341 | break; |
342 | i--; | 342 | i--; |
343 | } | 343 | } |
344 | if (i == 0) { | 344 | if (i == 0) { |
345 | debug ("ctrl_read - Error : I2C timeout\n"); | 345 | debug("ctrl_read - Error : I2C timeout\n"); |
346 | rc = HPC_ERROR; | 346 | rc = HPC_ERROR; |
347 | } | 347 | } |
348 | 348 | ||
349 | debug_polling ("%s Exit rc[%x]\n", __func__, rc); | 349 | debug_polling("%s Exit rc[%x]\n", __func__, rc); |
350 | return (rc); | 350 | return (rc); |
351 | } | 351 | } |
352 | 352 | ||
353 | //------------------------------------------------------------ | 353 | //------------------------------------------------------------ |
354 | // Read from ISA type HPC | 354 | // Read from ISA type HPC |
355 | //------------------------------------------------------------ | 355 | //------------------------------------------------------------ |
356 | static u8 isa_ctrl_read (struct controller *ctlr_ptr, u8 offset) | 356 | static u8 isa_ctrl_read(struct controller *ctlr_ptr, u8 offset) |
357 | { | 357 | { |
358 | u16 start_address; | 358 | u16 start_address; |
359 | u16 end_address; | 359 | u16 end_address; |
@@ -361,56 +361,56 @@ static u8 isa_ctrl_read (struct controller *ctlr_ptr, u8 offset) | |||
361 | 361 | ||
362 | start_address = ctlr_ptr->u.isa_ctlr.io_start; | 362 | start_address = ctlr_ptr->u.isa_ctlr.io_start; |
363 | end_address = ctlr_ptr->u.isa_ctlr.io_end; | 363 | end_address = ctlr_ptr->u.isa_ctlr.io_end; |
364 | data = inb (start_address + offset); | 364 | data = inb(start_address + offset); |
365 | return data; | 365 | return data; |
366 | } | 366 | } |
367 | 367 | ||
368 | //-------------------------------------------------------------- | 368 | //-------------------------------------------------------------- |
369 | // Write to ISA type HPC | 369 | // Write to ISA type HPC |
370 | //-------------------------------------------------------------- | 370 | //-------------------------------------------------------------- |
371 | static void isa_ctrl_write (struct controller *ctlr_ptr, u8 offset, u8 data) | 371 | static void isa_ctrl_write(struct controller *ctlr_ptr, u8 offset, u8 data) |
372 | { | 372 | { |
373 | u16 start_address; | 373 | u16 start_address; |
374 | u16 port_address; | 374 | u16 port_address; |
375 | 375 | ||
376 | start_address = ctlr_ptr->u.isa_ctlr.io_start; | 376 | start_address = ctlr_ptr->u.isa_ctlr.io_start; |
377 | port_address = start_address + (u16) offset; | 377 | port_address = start_address + (u16) offset; |
378 | outb (data, port_address); | 378 | outb(data, port_address); |
379 | } | 379 | } |
380 | 380 | ||
381 | static u8 pci_ctrl_read (struct controller *ctrl, u8 offset) | 381 | static u8 pci_ctrl_read(struct controller *ctrl, u8 offset) |
382 | { | 382 | { |
383 | u8 data = 0x00; | 383 | u8 data = 0x00; |
384 | debug ("inside pci_ctrl_read\n"); | 384 | debug("inside pci_ctrl_read\n"); |
385 | if (ctrl->ctrl_dev) | 385 | if (ctrl->ctrl_dev) |
386 | pci_read_config_byte (ctrl->ctrl_dev, HPC_PCI_OFFSET + offset, &data); | 386 | pci_read_config_byte(ctrl->ctrl_dev, HPC_PCI_OFFSET + offset, &data); |
387 | return data; | 387 | return data; |
388 | } | 388 | } |
389 | 389 | ||
390 | static u8 pci_ctrl_write (struct controller *ctrl, u8 offset, u8 data) | 390 | static u8 pci_ctrl_write(struct controller *ctrl, u8 offset, u8 data) |
391 | { | 391 | { |
392 | u8 rc = -ENODEV; | 392 | u8 rc = -ENODEV; |
393 | debug ("inside pci_ctrl_write\n"); | 393 | debug("inside pci_ctrl_write\n"); |
394 | if (ctrl->ctrl_dev) { | 394 | if (ctrl->ctrl_dev) { |
395 | pci_write_config_byte (ctrl->ctrl_dev, HPC_PCI_OFFSET + offset, data); | 395 | pci_write_config_byte(ctrl->ctrl_dev, HPC_PCI_OFFSET + offset, data); |
396 | rc = 0; | 396 | rc = 0; |
397 | } | 397 | } |
398 | return rc; | 398 | return rc; |
399 | } | 399 | } |
400 | 400 | ||
401 | static u8 ctrl_read (struct controller *ctlr, void __iomem *base, u8 offset) | 401 | static u8 ctrl_read(struct controller *ctlr, void __iomem *base, u8 offset) |
402 | { | 402 | { |
403 | u8 rc; | 403 | u8 rc; |
404 | switch (ctlr->ctlr_type) { | 404 | switch (ctlr->ctlr_type) { |
405 | case 0: | 405 | case 0: |
406 | rc = isa_ctrl_read (ctlr, offset); | 406 | rc = isa_ctrl_read(ctlr, offset); |
407 | break; | 407 | break; |
408 | case 1: | 408 | case 1: |
409 | rc = pci_ctrl_read (ctlr, offset); | 409 | rc = pci_ctrl_read(ctlr, offset); |
410 | break; | 410 | break; |
411 | case 2: | 411 | case 2: |
412 | case 4: | 412 | case 4: |
413 | rc = i2c_ctrl_read (ctlr, base, offset); | 413 | rc = i2c_ctrl_read(ctlr, base, offset); |
414 | break; | 414 | break; |
415 | default: | 415 | default: |
416 | return -ENODEV; | 416 | return -ENODEV; |
@@ -418,7 +418,7 @@ static u8 ctrl_read (struct controller *ctlr, void __iomem *base, u8 offset) | |||
418 | return rc; | 418 | return rc; |
419 | } | 419 | } |
420 | 420 | ||
421 | static u8 ctrl_write (struct controller *ctlr, void __iomem *base, u8 offset, u8 data) | 421 | static u8 ctrl_write(struct controller *ctlr, void __iomem *base, u8 offset, u8 data) |
422 | { | 422 | { |
423 | u8 rc = 0; | 423 | u8 rc = 0; |
424 | switch (ctlr->ctlr_type) { | 424 | switch (ctlr->ctlr_type) { |
@@ -426,7 +426,7 @@ static u8 ctrl_write (struct controller *ctlr, void __iomem *base, u8 offset, u8 | |||
426 | isa_ctrl_write(ctlr, offset, data); | 426 | isa_ctrl_write(ctlr, offset, data); |
427 | break; | 427 | break; |
428 | case 1: | 428 | case 1: |
429 | rc = pci_ctrl_write (ctlr, offset, data); | 429 | rc = pci_ctrl_write(ctlr, offset, data); |
430 | break; | 430 | break; |
431 | case 2: | 431 | case 2: |
432 | case 4: | 432 | case 4: |
@@ -444,7 +444,7 @@ static u8 ctrl_write (struct controller *ctlr, void __iomem *base, u8 offset, u8 | |||
444 | * | 444 | * |
445 | * Return index, HPC_ERROR | 445 | * Return index, HPC_ERROR |
446 | *---------------------------------------------------------------------*/ | 446 | *---------------------------------------------------------------------*/ |
447 | static u8 hpc_writecmdtoindex (u8 cmd, u8 index) | 447 | static u8 hpc_writecmdtoindex(u8 cmd, u8 index) |
448 | { | 448 | { |
449 | u8 rc; | 449 | u8 rc; |
450 | 450 | ||
@@ -476,7 +476,7 @@ static u8 hpc_writecmdtoindex (u8 cmd, u8 index) | |||
476 | break; | 476 | break; |
477 | 477 | ||
478 | default: | 478 | default: |
479 | err ("hpc_writecmdtoindex - Error invalid cmd[%x]\n", cmd); | 479 | err("hpc_writecmdtoindex - Error invalid cmd[%x]\n", cmd); |
480 | rc = HPC_ERROR; | 480 | rc = HPC_ERROR; |
481 | } | 481 | } |
482 | 482 | ||
@@ -490,7 +490,7 @@ static u8 hpc_writecmdtoindex (u8 cmd, u8 index) | |||
490 | * | 490 | * |
491 | * Return index, HPC_ERROR | 491 | * Return index, HPC_ERROR |
492 | *---------------------------------------------------------------------*/ | 492 | *---------------------------------------------------------------------*/ |
493 | static u8 hpc_readcmdtoindex (u8 cmd, u8 index) | 493 | static u8 hpc_readcmdtoindex(u8 cmd, u8 index) |
494 | { | 494 | { |
495 | u8 rc; | 495 | u8 rc; |
496 | 496 | ||
@@ -533,7 +533,7 @@ static u8 hpc_readcmdtoindex (u8 cmd, u8 index) | |||
533 | * | 533 | * |
534 | * Return 0 or error codes | 534 | * Return 0 or error codes |
535 | *---------------------------------------------------------------------*/ | 535 | *---------------------------------------------------------------------*/ |
536 | int ibmphp_hpc_readslot (struct slot *pslot, u8 cmd, u8 *pstatus) | 536 | int ibmphp_hpc_readslot(struct slot *pslot, u8 cmd, u8 *pstatus) |
537 | { | 537 | { |
538 | void __iomem *wpg_bbar = NULL; | 538 | void __iomem *wpg_bbar = NULL; |
539 | struct controller *ctlr_ptr; | 539 | struct controller *ctlr_ptr; |
@@ -542,69 +542,69 @@ int ibmphp_hpc_readslot (struct slot *pslot, u8 cmd, u8 *pstatus) | |||
542 | int rc = 0; | 542 | int rc = 0; |
543 | int busindex; | 543 | int busindex; |
544 | 544 | ||
545 | debug_polling ("%s - Entry pslot[%p] cmd[%x] pstatus[%p]\n", __func__, pslot, cmd, pstatus); | 545 | debug_polling("%s - Entry pslot[%p] cmd[%x] pstatus[%p]\n", __func__, pslot, cmd, pstatus); |
546 | 546 | ||
547 | if ((pslot == NULL) | 547 | if ((pslot == NULL) |
548 | || ((pstatus == NULL) && (cmd != READ_ALLSTAT) && (cmd != READ_BUSSTATUS))) { | 548 | || ((pstatus == NULL) && (cmd != READ_ALLSTAT) && (cmd != READ_BUSSTATUS))) { |
549 | rc = -EINVAL; | 549 | rc = -EINVAL; |
550 | err ("%s - Error invalid pointer, rc[%d]\n", __func__, rc); | 550 | err("%s - Error invalid pointer, rc[%d]\n", __func__, rc); |
551 | return rc; | 551 | return rc; |
552 | } | 552 | } |
553 | 553 | ||
554 | if (cmd == READ_BUSSTATUS) { | 554 | if (cmd == READ_BUSSTATUS) { |
555 | busindex = ibmphp_get_bus_index (pslot->bus); | 555 | busindex = ibmphp_get_bus_index(pslot->bus); |
556 | if (busindex < 0) { | 556 | if (busindex < 0) { |
557 | rc = -EINVAL; | 557 | rc = -EINVAL; |
558 | err ("%s - Exit Error:invalid bus, rc[%d]\n", __func__, rc); | 558 | err("%s - Exit Error:invalid bus, rc[%d]\n", __func__, rc); |
559 | return rc; | 559 | return rc; |
560 | } else | 560 | } else |
561 | index = (u8) busindex; | 561 | index = (u8) busindex; |
562 | } else | 562 | } else |
563 | index = pslot->ctlr_index; | 563 | index = pslot->ctlr_index; |
564 | 564 | ||
565 | index = hpc_readcmdtoindex (cmd, index); | 565 | index = hpc_readcmdtoindex(cmd, index); |
566 | 566 | ||
567 | if (index == HPC_ERROR) { | 567 | if (index == HPC_ERROR) { |
568 | rc = -EINVAL; | 568 | rc = -EINVAL; |
569 | err ("%s - Exit Error:invalid index, rc[%d]\n", __func__, rc); | 569 | err("%s - Exit Error:invalid index, rc[%d]\n", __func__, rc); |
570 | return rc; | 570 | return rc; |
571 | } | 571 | } |
572 | 572 | ||
573 | ctlr_ptr = pslot->ctrl; | 573 | ctlr_ptr = pslot->ctrl; |
574 | 574 | ||
575 | get_hpc_access (); | 575 | get_hpc_access(); |
576 | 576 | ||
577 | //-------------------------------------------------------------------- | 577 | //-------------------------------------------------------------------- |
578 | // map physical address to logical address | 578 | // map physical address to logical address |
579 | //-------------------------------------------------------------------- | 579 | //-------------------------------------------------------------------- |
580 | if ((ctlr_ptr->ctlr_type == 2) || (ctlr_ptr->ctlr_type == 4)) | 580 | if ((ctlr_ptr->ctlr_type == 2) || (ctlr_ptr->ctlr_type == 4)) |
581 | wpg_bbar = ioremap (ctlr_ptr->u.wpeg_ctlr.wpegbbar, WPG_I2C_IOREMAP_SIZE); | 581 | wpg_bbar = ioremap(ctlr_ptr->u.wpeg_ctlr.wpegbbar, WPG_I2C_IOREMAP_SIZE); |
582 | 582 | ||
583 | //-------------------------------------------------------------------- | 583 | //-------------------------------------------------------------------- |
584 | // check controller status before reading | 584 | // check controller status before reading |
585 | //-------------------------------------------------------------------- | 585 | //-------------------------------------------------------------------- |
586 | rc = hpc_wait_ctlr_notworking (HPC_CTLR_WORKING_TOUT, ctlr_ptr, wpg_bbar, &status); | 586 | rc = hpc_wait_ctlr_notworking(HPC_CTLR_WORKING_TOUT, ctlr_ptr, wpg_bbar, &status); |
587 | if (!rc) { | 587 | if (!rc) { |
588 | switch (cmd) { | 588 | switch (cmd) { |
589 | case READ_ALLSTAT: | 589 | case READ_ALLSTAT: |
590 | // update the slot structure | 590 | // update the slot structure |
591 | pslot->ctrl->status = status; | 591 | pslot->ctrl->status = status; |
592 | pslot->status = ctrl_read (ctlr_ptr, wpg_bbar, index); | 592 | pslot->status = ctrl_read(ctlr_ptr, wpg_bbar, index); |
593 | rc = hpc_wait_ctlr_notworking (HPC_CTLR_WORKING_TOUT, ctlr_ptr, wpg_bbar, | 593 | rc = hpc_wait_ctlr_notworking(HPC_CTLR_WORKING_TOUT, ctlr_ptr, wpg_bbar, |
594 | &status); | 594 | &status); |
595 | if (!rc) | 595 | if (!rc) |
596 | pslot->ext_status = ctrl_read (ctlr_ptr, wpg_bbar, index + WPG_1ST_EXTSLOT_INDEX); | 596 | pslot->ext_status = ctrl_read(ctlr_ptr, wpg_bbar, index + WPG_1ST_EXTSLOT_INDEX); |
597 | 597 | ||
598 | break; | 598 | break; |
599 | 599 | ||
600 | case READ_SLOTSTATUS: | 600 | case READ_SLOTSTATUS: |
601 | // DO NOT update the slot structure | 601 | // DO NOT update the slot structure |
602 | *pstatus = ctrl_read (ctlr_ptr, wpg_bbar, index); | 602 | *pstatus = ctrl_read(ctlr_ptr, wpg_bbar, index); |
603 | break; | 603 | break; |
604 | 604 | ||
605 | case READ_EXTSLOTSTATUS: | 605 | case READ_EXTSLOTSTATUS: |
606 | // DO NOT update the slot structure | 606 | // DO NOT update the slot structure |
607 | *pstatus = ctrl_read (ctlr_ptr, wpg_bbar, index); | 607 | *pstatus = ctrl_read(ctlr_ptr, wpg_bbar, index); |
608 | break; | 608 | break; |
609 | 609 | ||
610 | case READ_CTLRSTATUS: | 610 | case READ_CTLRSTATUS: |
@@ -613,36 +613,36 @@ int ibmphp_hpc_readslot (struct slot *pslot, u8 cmd, u8 *pstatus) | |||
613 | break; | 613 | break; |
614 | 614 | ||
615 | case READ_BUSSTATUS: | 615 | case READ_BUSSTATUS: |
616 | pslot->busstatus = ctrl_read (ctlr_ptr, wpg_bbar, index); | 616 | pslot->busstatus = ctrl_read(ctlr_ptr, wpg_bbar, index); |
617 | break; | 617 | break; |
618 | case READ_REVLEVEL: | 618 | case READ_REVLEVEL: |
619 | *pstatus = ctrl_read (ctlr_ptr, wpg_bbar, index); | 619 | *pstatus = ctrl_read(ctlr_ptr, wpg_bbar, index); |
620 | break; | 620 | break; |
621 | case READ_HPCOPTIONS: | 621 | case READ_HPCOPTIONS: |
622 | *pstatus = ctrl_read (ctlr_ptr, wpg_bbar, index); | 622 | *pstatus = ctrl_read(ctlr_ptr, wpg_bbar, index); |
623 | break; | 623 | break; |
624 | case READ_SLOTLATCHLOWREG: | 624 | case READ_SLOTLATCHLOWREG: |
625 | // DO NOT update the slot structure | 625 | // DO NOT update the slot structure |
626 | *pstatus = ctrl_read (ctlr_ptr, wpg_bbar, index); | 626 | *pstatus = ctrl_read(ctlr_ptr, wpg_bbar, index); |
627 | break; | 627 | break; |
628 | 628 | ||
629 | // Not used | 629 | // Not used |
630 | case READ_ALLSLOT: | 630 | case READ_ALLSLOT: |
631 | list_for_each (pslotlist, &ibmphp_slot_head) { | 631 | list_for_each(pslotlist, &ibmphp_slot_head) { |
632 | pslot = list_entry (pslotlist, struct slot, ibm_slot_list); | 632 | pslot = list_entry(pslotlist, struct slot, ibm_slot_list); |
633 | index = pslot->ctlr_index; | 633 | index = pslot->ctlr_index; |
634 | rc = hpc_wait_ctlr_notworking (HPC_CTLR_WORKING_TOUT, ctlr_ptr, | 634 | rc = hpc_wait_ctlr_notworking(HPC_CTLR_WORKING_TOUT, ctlr_ptr, |
635 | wpg_bbar, &status); | 635 | wpg_bbar, &status); |
636 | if (!rc) { | 636 | if (!rc) { |
637 | pslot->status = ctrl_read (ctlr_ptr, wpg_bbar, index); | 637 | pslot->status = ctrl_read(ctlr_ptr, wpg_bbar, index); |
638 | rc = hpc_wait_ctlr_notworking (HPC_CTLR_WORKING_TOUT, | 638 | rc = hpc_wait_ctlr_notworking(HPC_CTLR_WORKING_TOUT, |
639 | ctlr_ptr, wpg_bbar, &status); | 639 | ctlr_ptr, wpg_bbar, &status); |
640 | if (!rc) | 640 | if (!rc) |
641 | pslot->ext_status = | 641 | pslot->ext_status = |
642 | ctrl_read (ctlr_ptr, wpg_bbar, | 642 | ctrl_read(ctlr_ptr, wpg_bbar, |
643 | index + WPG_1ST_EXTSLOT_INDEX); | 643 | index + WPG_1ST_EXTSLOT_INDEX); |
644 | } else { | 644 | } else { |
645 | err ("%s - Error ctrl_read failed\n", __func__); | 645 | err("%s - Error ctrl_read failed\n", __func__); |
646 | rc = -EINVAL; | 646 | rc = -EINVAL; |
647 | break; | 647 | break; |
648 | } | 648 | } |
@@ -659,11 +659,11 @@ int ibmphp_hpc_readslot (struct slot *pslot, u8 cmd, u8 *pstatus) | |||
659 | 659 | ||
660 | // remove physical to logical address mapping | 660 | // remove physical to logical address mapping |
661 | if ((ctlr_ptr->ctlr_type == 2) || (ctlr_ptr->ctlr_type == 4)) | 661 | if ((ctlr_ptr->ctlr_type == 2) || (ctlr_ptr->ctlr_type == 4)) |
662 | iounmap (wpg_bbar); | 662 | iounmap(wpg_bbar); |
663 | 663 | ||
664 | free_hpc_access (); | 664 | free_hpc_access(); |
665 | 665 | ||
666 | debug_polling ("%s - Exit rc[%d]\n", __func__, rc); | 666 | debug_polling("%s - Exit rc[%d]\n", __func__, rc); |
667 | return rc; | 667 | return rc; |
668 | } | 668 | } |
669 | 669 | ||
@@ -672,7 +672,7 @@ int ibmphp_hpc_readslot (struct slot *pslot, u8 cmd, u8 *pstatus) | |||
672 | * | 672 | * |
673 | * Action: issue a WRITE command to HPC | 673 | * Action: issue a WRITE command to HPC |
674 | *---------------------------------------------------------------------*/ | 674 | *---------------------------------------------------------------------*/ |
675 | int ibmphp_hpc_writeslot (struct slot *pslot, u8 cmd) | 675 | int ibmphp_hpc_writeslot(struct slot *pslot, u8 cmd) |
676 | { | 676 | { |
677 | void __iomem *wpg_bbar = NULL; | 677 | void __iomem *wpg_bbar = NULL; |
678 | struct controller *ctlr_ptr; | 678 | struct controller *ctlr_ptr; |
@@ -682,55 +682,55 @@ int ibmphp_hpc_writeslot (struct slot *pslot, u8 cmd) | |||
682 | int rc = 0; | 682 | int rc = 0; |
683 | int timeout; | 683 | int timeout; |
684 | 684 | ||
685 | debug_polling ("%s - Entry pslot[%p] cmd[%x]\n", __func__, pslot, cmd); | 685 | debug_polling("%s - Entry pslot[%p] cmd[%x]\n", __func__, pslot, cmd); |
686 | if (pslot == NULL) { | 686 | if (pslot == NULL) { |
687 | rc = -EINVAL; | 687 | rc = -EINVAL; |
688 | err ("%s - Error Exit rc[%d]\n", __func__, rc); | 688 | err("%s - Error Exit rc[%d]\n", __func__, rc); |
689 | return rc; | 689 | return rc; |
690 | } | 690 | } |
691 | 691 | ||
692 | if ((cmd == HPC_BUS_33CONVMODE) || (cmd == HPC_BUS_66CONVMODE) || | 692 | if ((cmd == HPC_BUS_33CONVMODE) || (cmd == HPC_BUS_66CONVMODE) || |
693 | (cmd == HPC_BUS_66PCIXMODE) || (cmd == HPC_BUS_100PCIXMODE) || | 693 | (cmd == HPC_BUS_66PCIXMODE) || (cmd == HPC_BUS_100PCIXMODE) || |
694 | (cmd == HPC_BUS_133PCIXMODE)) { | 694 | (cmd == HPC_BUS_133PCIXMODE)) { |
695 | busindex = ibmphp_get_bus_index (pslot->bus); | 695 | busindex = ibmphp_get_bus_index(pslot->bus); |
696 | if (busindex < 0) { | 696 | if (busindex < 0) { |
697 | rc = -EINVAL; | 697 | rc = -EINVAL; |
698 | err ("%s - Exit Error:invalid bus, rc[%d]\n", __func__, rc); | 698 | err("%s - Exit Error:invalid bus, rc[%d]\n", __func__, rc); |
699 | return rc; | 699 | return rc; |
700 | } else | 700 | } else |
701 | index = (u8) busindex; | 701 | index = (u8) busindex; |
702 | } else | 702 | } else |
703 | index = pslot->ctlr_index; | 703 | index = pslot->ctlr_index; |
704 | 704 | ||
705 | index = hpc_writecmdtoindex (cmd, index); | 705 | index = hpc_writecmdtoindex(cmd, index); |
706 | 706 | ||
707 | if (index == HPC_ERROR) { | 707 | if (index == HPC_ERROR) { |
708 | rc = -EINVAL; | 708 | rc = -EINVAL; |
709 | err ("%s - Error Exit rc[%d]\n", __func__, rc); | 709 | err("%s - Error Exit rc[%d]\n", __func__, rc); |
710 | return rc; | 710 | return rc; |
711 | } | 711 | } |
712 | 712 | ||
713 | ctlr_ptr = pslot->ctrl; | 713 | ctlr_ptr = pslot->ctrl; |
714 | 714 | ||
715 | get_hpc_access (); | 715 | get_hpc_access(); |
716 | 716 | ||
717 | //-------------------------------------------------------------------- | 717 | //-------------------------------------------------------------------- |
718 | // map physical address to logical address | 718 | // map physical address to logical address |
719 | //-------------------------------------------------------------------- | 719 | //-------------------------------------------------------------------- |
720 | if ((ctlr_ptr->ctlr_type == 2) || (ctlr_ptr->ctlr_type == 4)) { | 720 | if ((ctlr_ptr->ctlr_type == 2) || (ctlr_ptr->ctlr_type == 4)) { |
721 | wpg_bbar = ioremap (ctlr_ptr->u.wpeg_ctlr.wpegbbar, WPG_I2C_IOREMAP_SIZE); | 721 | wpg_bbar = ioremap(ctlr_ptr->u.wpeg_ctlr.wpegbbar, WPG_I2C_IOREMAP_SIZE); |
722 | 722 | ||
723 | debug ("%s - ctlr id[%x] physical[%lx] logical[%lx] i2c[%x]\n", __func__, | 723 | debug("%s - ctlr id[%x] physical[%lx] logical[%lx] i2c[%x]\n", __func__, |
724 | ctlr_ptr->ctlr_id, (ulong) (ctlr_ptr->u.wpeg_ctlr.wpegbbar), (ulong) wpg_bbar, | 724 | ctlr_ptr->ctlr_id, (ulong) (ctlr_ptr->u.wpeg_ctlr.wpegbbar), (ulong) wpg_bbar, |
725 | ctlr_ptr->u.wpeg_ctlr.i2c_addr); | 725 | ctlr_ptr->u.wpeg_ctlr.i2c_addr); |
726 | } | 726 | } |
727 | //-------------------------------------------------------------------- | 727 | //-------------------------------------------------------------------- |
728 | // check controller status before writing | 728 | // check controller status before writing |
729 | //-------------------------------------------------------------------- | 729 | //-------------------------------------------------------------------- |
730 | rc = hpc_wait_ctlr_notworking (HPC_CTLR_WORKING_TOUT, ctlr_ptr, wpg_bbar, &status); | 730 | rc = hpc_wait_ctlr_notworking(HPC_CTLR_WORKING_TOUT, ctlr_ptr, wpg_bbar, &status); |
731 | if (!rc) { | 731 | if (!rc) { |
732 | 732 | ||
733 | ctrl_write (ctlr_ptr, wpg_bbar, index, cmd); | 733 | ctrl_write(ctlr_ptr, wpg_bbar, index, cmd); |
734 | 734 | ||
735 | //-------------------------------------------------------------------- | 735 | //-------------------------------------------------------------------- |
736 | // check controller is still not working on the command | 736 | // check controller is still not working on the command |
@@ -738,11 +738,11 @@ int ibmphp_hpc_writeslot (struct slot *pslot, u8 cmd) | |||
738 | timeout = CMD_COMPLETE_TOUT_SEC; | 738 | timeout = CMD_COMPLETE_TOUT_SEC; |
739 | done = 0; | 739 | done = 0; |
740 | while (!done) { | 740 | while (!done) { |
741 | rc = hpc_wait_ctlr_notworking (HPC_CTLR_WORKING_TOUT, ctlr_ptr, wpg_bbar, | 741 | rc = hpc_wait_ctlr_notworking(HPC_CTLR_WORKING_TOUT, ctlr_ptr, wpg_bbar, |
742 | &status); | 742 | &status); |
743 | if (!rc) { | 743 | if (!rc) { |
744 | if (NEEDTOCHECK_CMDSTATUS (cmd)) { | 744 | if (NEEDTOCHECK_CMDSTATUS(cmd)) { |
745 | if (CTLR_FINISHED (status) == HPC_CTLR_FINISHED_YES) | 745 | if (CTLR_FINISHED(status) == HPC_CTLR_FINISHED_YES) |
746 | done = 1; | 746 | done = 1; |
747 | } else | 747 | } else |
748 | done = 1; | 748 | done = 1; |
@@ -751,7 +751,7 @@ int ibmphp_hpc_writeslot (struct slot *pslot, u8 cmd) | |||
751 | msleep(1000); | 751 | msleep(1000); |
752 | if (timeout < 1) { | 752 | if (timeout < 1) { |
753 | done = 1; | 753 | done = 1; |
754 | err ("%s - Error command complete timeout\n", __func__); | 754 | err("%s - Error command complete timeout\n", __func__); |
755 | rc = -EFAULT; | 755 | rc = -EFAULT; |
756 | } else | 756 | } else |
757 | timeout--; | 757 | timeout--; |
@@ -763,10 +763,10 @@ int ibmphp_hpc_writeslot (struct slot *pslot, u8 cmd) | |||
763 | 763 | ||
764 | // remove physical to logical address mapping | 764 | // remove physical to logical address mapping |
765 | if ((ctlr_ptr->ctlr_type == 2) || (ctlr_ptr->ctlr_type == 4)) | 765 | if ((ctlr_ptr->ctlr_type == 2) || (ctlr_ptr->ctlr_type == 4)) |
766 | iounmap (wpg_bbar); | 766 | iounmap(wpg_bbar); |
767 | free_hpc_access (); | 767 | free_hpc_access(); |
768 | 768 | ||
769 | debug_polling ("%s - Exit rc[%d]\n", __func__, rc); | 769 | debug_polling("%s - Exit rc[%d]\n", __func__, rc); |
770 | return rc; | 770 | return rc; |
771 | } | 771 | } |
772 | 772 | ||
@@ -775,7 +775,7 @@ int ibmphp_hpc_writeslot (struct slot *pslot, u8 cmd) | |||
775 | * | 775 | * |
776 | * Action: make sure only one process can access HPC at one time | 776 | * Action: make sure only one process can access HPC at one time |
777 | *---------------------------------------------------------------------*/ | 777 | *---------------------------------------------------------------------*/ |
778 | static void get_hpc_access (void) | 778 | static void get_hpc_access(void) |
779 | { | 779 | { |
780 | mutex_lock(&sem_hpcaccess); | 780 | mutex_lock(&sem_hpcaccess); |
781 | } | 781 | } |
@@ -783,7 +783,7 @@ static void get_hpc_access (void) | |||
783 | /*---------------------------------------------------------------------- | 783 | /*---------------------------------------------------------------------- |
784 | * Name: free_hpc_access() | 784 | * Name: free_hpc_access() |
785 | *---------------------------------------------------------------------*/ | 785 | *---------------------------------------------------------------------*/ |
786 | void free_hpc_access (void) | 786 | void free_hpc_access(void) |
787 | { | 787 | { |
788 | mutex_unlock(&sem_hpcaccess); | 788 | mutex_unlock(&sem_hpcaccess); |
789 | } | 789 | } |
@@ -793,21 +793,21 @@ void free_hpc_access (void) | |||
793 | * | 793 | * |
794 | * Action: make sure only one process can change the data structure | 794 | * Action: make sure only one process can change the data structure |
795 | *---------------------------------------------------------------------*/ | 795 | *---------------------------------------------------------------------*/ |
796 | void ibmphp_lock_operations (void) | 796 | void ibmphp_lock_operations(void) |
797 | { | 797 | { |
798 | down (&semOperations); | 798 | down(&semOperations); |
799 | to_debug = 1; | 799 | to_debug = 1; |
800 | } | 800 | } |
801 | 801 | ||
802 | /*---------------------------------------------------------------------- | 802 | /*---------------------------------------------------------------------- |
803 | * Name: ibmphp_unlock_operations() | 803 | * Name: ibmphp_unlock_operations() |
804 | *---------------------------------------------------------------------*/ | 804 | *---------------------------------------------------------------------*/ |
805 | void ibmphp_unlock_operations (void) | 805 | void ibmphp_unlock_operations(void) |
806 | { | 806 | { |
807 | debug ("%s - Entry\n", __func__); | 807 | debug("%s - Entry\n", __func__); |
808 | up (&semOperations); | 808 | up(&semOperations); |
809 | to_debug = 0; | 809 | to_debug = 0; |
810 | debug ("%s - Exit\n", __func__); | 810 | debug("%s - Exit\n", __func__); |
811 | } | 811 | } |
812 | 812 | ||
813 | /*---------------------------------------------------------------------- | 813 | /*---------------------------------------------------------------------- |
@@ -828,28 +828,28 @@ static int poll_hpc(void *data) | |||
828 | int poll_count = 0; | 828 | int poll_count = 0; |
829 | u8 ctrl_count = 0x00; | 829 | u8 ctrl_count = 0x00; |
830 | 830 | ||
831 | debug ("%s - Entry\n", __func__); | 831 | debug("%s - Entry\n", __func__); |
832 | 832 | ||
833 | while (!kthread_should_stop()) { | 833 | while (!kthread_should_stop()) { |
834 | /* try to get the lock to do some kind of hardware access */ | 834 | /* try to get the lock to do some kind of hardware access */ |
835 | down (&semOperations); | 835 | down(&semOperations); |
836 | 836 | ||
837 | switch (poll_state) { | 837 | switch (poll_state) { |
838 | case POLL_LATCH_REGISTER: | 838 | case POLL_LATCH_REGISTER: |
839 | oldlatchlow = curlatchlow; | 839 | oldlatchlow = curlatchlow; |
840 | ctrl_count = 0x00; | 840 | ctrl_count = 0x00; |
841 | list_for_each (pslotlist, &ibmphp_slot_head) { | 841 | list_for_each(pslotlist, &ibmphp_slot_head) { |
842 | if (ctrl_count >= ibmphp_get_total_controllers()) | 842 | if (ctrl_count >= ibmphp_get_total_controllers()) |
843 | break; | 843 | break; |
844 | pslot = list_entry (pslotlist, struct slot, ibm_slot_list); | 844 | pslot = list_entry(pslotlist, struct slot, ibm_slot_list); |
845 | if (pslot->ctrl->ctlr_relative_id == ctrl_count) { | 845 | if (pslot->ctrl->ctlr_relative_id == ctrl_count) { |
846 | ctrl_count++; | 846 | ctrl_count++; |
847 | if (READ_SLOT_LATCH (pslot->ctrl)) { | 847 | if (READ_SLOT_LATCH(pslot->ctrl)) { |
848 | rc = ibmphp_hpc_readslot (pslot, | 848 | rc = ibmphp_hpc_readslot(pslot, |
849 | READ_SLOTLATCHLOWREG, | 849 | READ_SLOTLATCHLOWREG, |
850 | &curlatchlow); | 850 | &curlatchlow); |
851 | if (oldlatchlow != curlatchlow) | 851 | if (oldlatchlow != curlatchlow) |
852 | process_changeinlatch (oldlatchlow, | 852 | process_changeinlatch(oldlatchlow, |
853 | curlatchlow, | 853 | curlatchlow, |
854 | pslot->ctrl); | 854 | pslot->ctrl); |
855 | } | 855 | } |
@@ -859,25 +859,25 @@ static int poll_hpc(void *data) | |||
859 | poll_state = POLL_SLEEP; | 859 | poll_state = POLL_SLEEP; |
860 | break; | 860 | break; |
861 | case POLL_SLOTS: | 861 | case POLL_SLOTS: |
862 | list_for_each (pslotlist, &ibmphp_slot_head) { | 862 | list_for_each(pslotlist, &ibmphp_slot_head) { |
863 | pslot = list_entry (pslotlist, struct slot, ibm_slot_list); | 863 | pslot = list_entry(pslotlist, struct slot, ibm_slot_list); |
864 | // make a copy of the old status | 864 | // make a copy of the old status |
865 | memcpy ((void *) &myslot, (void *) pslot, | 865 | memcpy((void *) &myslot, (void *) pslot, |
866 | sizeof (struct slot)); | 866 | sizeof(struct slot)); |
867 | rc = ibmphp_hpc_readslot (pslot, READ_ALLSTAT, NULL); | 867 | rc = ibmphp_hpc_readslot(pslot, READ_ALLSTAT, NULL); |
868 | if ((myslot.status != pslot->status) | 868 | if ((myslot.status != pslot->status) |
869 | || (myslot.ext_status != pslot->ext_status)) | 869 | || (myslot.ext_status != pslot->ext_status)) |
870 | process_changeinstatus (pslot, &myslot); | 870 | process_changeinstatus(pslot, &myslot); |
871 | } | 871 | } |
872 | ctrl_count = 0x00; | 872 | ctrl_count = 0x00; |
873 | list_for_each (pslotlist, &ibmphp_slot_head) { | 873 | list_for_each(pslotlist, &ibmphp_slot_head) { |
874 | if (ctrl_count >= ibmphp_get_total_controllers()) | 874 | if (ctrl_count >= ibmphp_get_total_controllers()) |
875 | break; | 875 | break; |
876 | pslot = list_entry (pslotlist, struct slot, ibm_slot_list); | 876 | pslot = list_entry(pslotlist, struct slot, ibm_slot_list); |
877 | if (pslot->ctrl->ctlr_relative_id == ctrl_count) { | 877 | if (pslot->ctrl->ctlr_relative_id == ctrl_count) { |
878 | ctrl_count++; | 878 | ctrl_count++; |
879 | if (READ_SLOT_LATCH (pslot->ctrl)) | 879 | if (READ_SLOT_LATCH(pslot->ctrl)) |
880 | rc = ibmphp_hpc_readslot (pslot, | 880 | rc = ibmphp_hpc_readslot(pslot, |
881 | READ_SLOTLATCHLOWREG, | 881 | READ_SLOTLATCHLOWREG, |
882 | &curlatchlow); | 882 | &curlatchlow); |
883 | } | 883 | } |
@@ -887,13 +887,13 @@ static int poll_hpc(void *data) | |||
887 | break; | 887 | break; |
888 | case POLL_SLEEP: | 888 | case POLL_SLEEP: |
889 | /* don't sleep with a lock on the hardware */ | 889 | /* don't sleep with a lock on the hardware */ |
890 | up (&semOperations); | 890 | up(&semOperations); |
891 | msleep(POLL_INTERVAL_SEC * 1000); | 891 | msleep(POLL_INTERVAL_SEC * 1000); |
892 | 892 | ||
893 | if (kthread_should_stop()) | 893 | if (kthread_should_stop()) |
894 | goto out_sleep; | 894 | goto out_sleep; |
895 | 895 | ||
896 | down (&semOperations); | 896 | down(&semOperations); |
897 | 897 | ||
898 | if (poll_count >= POLL_LATCH_CNT) { | 898 | if (poll_count >= POLL_LATCH_CNT) { |
899 | poll_count = 0; | 899 | poll_count = 0; |
@@ -903,13 +903,13 @@ static int poll_hpc(void *data) | |||
903 | break; | 903 | break; |
904 | } | 904 | } |
905 | /* give up the hardware semaphore */ | 905 | /* give up the hardware semaphore */ |
906 | up (&semOperations); | 906 | up(&semOperations); |
907 | /* sleep for a short time just for good measure */ | 907 | /* sleep for a short time just for good measure */ |
908 | out_sleep: | 908 | out_sleep: |
909 | msleep(100); | 909 | msleep(100); |
910 | } | 910 | } |
911 | up (&sem_exit); | 911 | up(&sem_exit); |
912 | debug ("%s - Exit\n", __func__); | 912 | debug("%s - Exit\n", __func__); |
913 | return 0; | 913 | return 0; |
914 | } | 914 | } |
915 | 915 | ||
@@ -929,14 +929,14 @@ out_sleep: | |||
929 | * | 929 | * |
930 | * Notes: | 930 | * Notes: |
931 | *---------------------------------------------------------------------*/ | 931 | *---------------------------------------------------------------------*/ |
932 | static int process_changeinstatus (struct slot *pslot, struct slot *poldslot) | 932 | static int process_changeinstatus(struct slot *pslot, struct slot *poldslot) |
933 | { | 933 | { |
934 | u8 status; | 934 | u8 status; |
935 | int rc = 0; | 935 | int rc = 0; |
936 | u8 disable = 0; | 936 | u8 disable = 0; |
937 | u8 update = 0; | 937 | u8 update = 0; |
938 | 938 | ||
939 | debug ("process_changeinstatus - Entry pslot[%p], poldslot[%p]\n", pslot, poldslot); | 939 | debug("process_changeinstatus - Entry pslot[%p], poldslot[%p]\n", pslot, poldslot); |
940 | 940 | ||
941 | // bit 0 - HPC_SLOT_POWER | 941 | // bit 0 - HPC_SLOT_POWER |
942 | if ((pslot->status & 0x01) != (poldslot->status & 0x01)) | 942 | if ((pslot->status & 0x01) != (poldslot->status & 0x01)) |
@@ -958,7 +958,7 @@ static int process_changeinstatus (struct slot *pslot, struct slot *poldslot) | |||
958 | // bit 5 - HPC_SLOT_PWRGD | 958 | // bit 5 - HPC_SLOT_PWRGD |
959 | if ((pslot->status & 0x20) != (poldslot->status & 0x20)) | 959 | if ((pslot->status & 0x20) != (poldslot->status & 0x20)) |
960 | // OFF -> ON: ignore, ON -> OFF: disable slot | 960 | // OFF -> ON: ignore, ON -> OFF: disable slot |
961 | if ((poldslot->status & 0x20) && (SLOT_CONNECT (poldslot->status) == HPC_SLOT_CONNECTED) && (SLOT_PRESENT (poldslot->status))) | 961 | if ((poldslot->status & 0x20) && (SLOT_CONNECT(poldslot->status) == HPC_SLOT_CONNECTED) && (SLOT_PRESENT(poldslot->status))) |
962 | disable = 1; | 962 | disable = 1; |
963 | 963 | ||
964 | // bit 6 - HPC_SLOT_BUS_SPEED | 964 | // bit 6 - HPC_SLOT_BUS_SPEED |
@@ -969,20 +969,20 @@ static int process_changeinstatus (struct slot *pslot, struct slot *poldslot) | |||
969 | update = 1; | 969 | update = 1; |
970 | // OPEN -> CLOSE | 970 | // OPEN -> CLOSE |
971 | if (pslot->status & 0x80) { | 971 | if (pslot->status & 0x80) { |
972 | if (SLOT_PWRGD (pslot->status)) { | 972 | if (SLOT_PWRGD(pslot->status)) { |
973 | // power goes on and off after closing latch | 973 | // power goes on and off after closing latch |
974 | // check again to make sure power is still ON | 974 | // check again to make sure power is still ON |
975 | msleep(1000); | 975 | msleep(1000); |
976 | rc = ibmphp_hpc_readslot (pslot, READ_SLOTSTATUS, &status); | 976 | rc = ibmphp_hpc_readslot(pslot, READ_SLOTSTATUS, &status); |
977 | if (SLOT_PWRGD (status)) | 977 | if (SLOT_PWRGD(status)) |
978 | update = 1; | 978 | update = 1; |
979 | else // overwrite power in pslot to OFF | 979 | else // overwrite power in pslot to OFF |
980 | pslot->status &= ~HPC_SLOT_POWER; | 980 | pslot->status &= ~HPC_SLOT_POWER; |
981 | } | 981 | } |
982 | } | 982 | } |
983 | // CLOSE -> OPEN | 983 | // CLOSE -> OPEN |
984 | else if ((SLOT_PWRGD (poldslot->status) == HPC_SLOT_PWRGD_GOOD) | 984 | else if ((SLOT_PWRGD(poldslot->status) == HPC_SLOT_PWRGD_GOOD) |
985 | && (SLOT_CONNECT (poldslot->status) == HPC_SLOT_CONNECTED) && (SLOT_PRESENT (poldslot->status))) { | 985 | && (SLOT_CONNECT(poldslot->status) == HPC_SLOT_CONNECTED) && (SLOT_PRESENT(poldslot->status))) { |
986 | disable = 1; | 986 | disable = 1; |
987 | } | 987 | } |
988 | // else - ignore | 988 | // else - ignore |
@@ -992,15 +992,15 @@ static int process_changeinstatus (struct slot *pslot, struct slot *poldslot) | |||
992 | update = 1; | 992 | update = 1; |
993 | 993 | ||
994 | if (disable) { | 994 | if (disable) { |
995 | debug ("process_changeinstatus - disable slot\n"); | 995 | debug("process_changeinstatus - disable slot\n"); |
996 | pslot->flag = 0; | 996 | pslot->flag = 0; |
997 | rc = ibmphp_do_disable_slot (pslot); | 997 | rc = ibmphp_do_disable_slot(pslot); |
998 | } | 998 | } |
999 | 999 | ||
1000 | if (update || disable) | 1000 | if (update || disable) |
1001 | ibmphp_update_slot_info (pslot); | 1001 | ibmphp_update_slot_info(pslot); |
1002 | 1002 | ||
1003 | debug ("%s - Exit rc[%d] disable[%x] update[%x]\n", __func__, rc, disable, update); | 1003 | debug("%s - Exit rc[%d] disable[%x] update[%x]\n", __func__, rc, disable, update); |
1004 | 1004 | ||
1005 | return rc; | 1005 | return rc; |
1006 | } | 1006 | } |
@@ -1015,32 +1015,32 @@ static int process_changeinstatus (struct slot *pslot, struct slot *poldslot) | |||
1015 | * Return 0 or error codes | 1015 | * Return 0 or error codes |
1016 | * Value: | 1016 | * Value: |
1017 | *---------------------------------------------------------------------*/ | 1017 | *---------------------------------------------------------------------*/ |
1018 | static int process_changeinlatch (u8 old, u8 new, struct controller *ctrl) | 1018 | static int process_changeinlatch(u8 old, u8 new, struct controller *ctrl) |
1019 | { | 1019 | { |
1020 | struct slot myslot, *pslot; | 1020 | struct slot myslot, *pslot; |
1021 | u8 i; | 1021 | u8 i; |
1022 | u8 mask; | 1022 | u8 mask; |
1023 | int rc = 0; | 1023 | int rc = 0; |
1024 | 1024 | ||
1025 | debug ("%s - Entry old[%x], new[%x]\n", __func__, old, new); | 1025 | debug("%s - Entry old[%x], new[%x]\n", __func__, old, new); |
1026 | // bit 0 reserved, 0 is LSB, check bit 1-6 for 6 slots | 1026 | // bit 0 reserved, 0 is LSB, check bit 1-6 for 6 slots |
1027 | 1027 | ||
1028 | for (i = ctrl->starting_slot_num; i <= ctrl->ending_slot_num; i++) { | 1028 | for (i = ctrl->starting_slot_num; i <= ctrl->ending_slot_num; i++) { |
1029 | mask = 0x01 << i; | 1029 | mask = 0x01 << i; |
1030 | if ((mask & old) != (mask & new)) { | 1030 | if ((mask & old) != (mask & new)) { |
1031 | pslot = ibmphp_get_slot_from_physical_num (i); | 1031 | pslot = ibmphp_get_slot_from_physical_num(i); |
1032 | if (pslot) { | 1032 | if (pslot) { |
1033 | memcpy ((void *) &myslot, (void *) pslot, sizeof (struct slot)); | 1033 | memcpy((void *) &myslot, (void *) pslot, sizeof(struct slot)); |
1034 | rc = ibmphp_hpc_readslot (pslot, READ_ALLSTAT, NULL); | 1034 | rc = ibmphp_hpc_readslot(pslot, READ_ALLSTAT, NULL); |
1035 | debug ("%s - call process_changeinstatus for slot[%d]\n", __func__, i); | 1035 | debug("%s - call process_changeinstatus for slot[%d]\n", __func__, i); |
1036 | process_changeinstatus (pslot, &myslot); | 1036 | process_changeinstatus(pslot, &myslot); |
1037 | } else { | 1037 | } else { |
1038 | rc = -EINVAL; | 1038 | rc = -EINVAL; |
1039 | err ("%s - Error bad pointer for slot[%d]\n", __func__, i); | 1039 | err("%s - Error bad pointer for slot[%d]\n", __func__, i); |
1040 | } | 1040 | } |
1041 | } | 1041 | } |
1042 | } | 1042 | } |
1043 | debug ("%s - Exit rc[%d]\n", __func__, rc); | 1043 | debug("%s - Exit rc[%d]\n", __func__, rc); |
1044 | return rc; | 1044 | return rc; |
1045 | } | 1045 | } |
1046 | 1046 | ||
@@ -1049,13 +1049,13 @@ static int process_changeinlatch (u8 old, u8 new, struct controller *ctrl) | |||
1049 | * | 1049 | * |
1050 | * Action: start polling thread | 1050 | * Action: start polling thread |
1051 | *---------------------------------------------------------------------*/ | 1051 | *---------------------------------------------------------------------*/ |
1052 | int __init ibmphp_hpc_start_poll_thread (void) | 1052 | int __init ibmphp_hpc_start_poll_thread(void) |
1053 | { | 1053 | { |
1054 | debug ("%s - Entry\n", __func__); | 1054 | debug("%s - Entry\n", __func__); |
1055 | 1055 | ||
1056 | ibmphp_poll_thread = kthread_run(poll_hpc, NULL, "hpc_poll"); | 1056 | ibmphp_poll_thread = kthread_run(poll_hpc, NULL, "hpc_poll"); |
1057 | if (IS_ERR(ibmphp_poll_thread)) { | 1057 | if (IS_ERR(ibmphp_poll_thread)) { |
1058 | err ("%s - Error, thread not started\n", __func__); | 1058 | err("%s - Error, thread not started\n", __func__); |
1059 | return PTR_ERR(ibmphp_poll_thread); | 1059 | return PTR_ERR(ibmphp_poll_thread); |
1060 | } | 1060 | } |
1061 | return 0; | 1061 | return 0; |
@@ -1066,30 +1066,30 @@ int __init ibmphp_hpc_start_poll_thread (void) | |||
1066 | * | 1066 | * |
1067 | * Action: stop polling thread and cleanup | 1067 | * Action: stop polling thread and cleanup |
1068 | *---------------------------------------------------------------------*/ | 1068 | *---------------------------------------------------------------------*/ |
1069 | void __exit ibmphp_hpc_stop_poll_thread (void) | 1069 | void __exit ibmphp_hpc_stop_poll_thread(void) |
1070 | { | 1070 | { |
1071 | debug ("%s - Entry\n", __func__); | 1071 | debug("%s - Entry\n", __func__); |
1072 | 1072 | ||
1073 | kthread_stop(ibmphp_poll_thread); | 1073 | kthread_stop(ibmphp_poll_thread); |
1074 | debug ("before locking operations \n"); | 1074 | debug("before locking operations\n"); |
1075 | ibmphp_lock_operations (); | 1075 | ibmphp_lock_operations(); |
1076 | debug ("after locking operations \n"); | 1076 | debug("after locking operations\n"); |
1077 | 1077 | ||
1078 | // wait for poll thread to exit | 1078 | // wait for poll thread to exit |
1079 | debug ("before sem_exit down \n"); | 1079 | debug("before sem_exit down\n"); |
1080 | down (&sem_exit); | 1080 | down(&sem_exit); |
1081 | debug ("after sem_exit down \n"); | 1081 | debug("after sem_exit down\n"); |
1082 | 1082 | ||
1083 | // cleanup | 1083 | // cleanup |
1084 | debug ("before free_hpc_access \n"); | 1084 | debug("before free_hpc_access\n"); |
1085 | free_hpc_access (); | 1085 | free_hpc_access(); |
1086 | debug ("after free_hpc_access \n"); | 1086 | debug("after free_hpc_access\n"); |
1087 | ibmphp_unlock_operations (); | 1087 | ibmphp_unlock_operations(); |
1088 | debug ("after unlock operations \n"); | 1088 | debug("after unlock operations\n"); |
1089 | up (&sem_exit); | 1089 | up(&sem_exit); |
1090 | debug ("after sem exit up\n"); | 1090 | debug("after sem exit up\n"); |
1091 | 1091 | ||
1092 | debug ("%s - Exit\n", __func__); | 1092 | debug("%s - Exit\n", __func__); |
1093 | } | 1093 | } |
1094 | 1094 | ||
1095 | /*---------------------------------------------------------------------- | 1095 | /*---------------------------------------------------------------------- |
@@ -1100,32 +1100,32 @@ void __exit ibmphp_hpc_stop_poll_thread (void) | |||
1100 | * Return 0, HPC_ERROR | 1100 | * Return 0, HPC_ERROR |
1101 | * Value: | 1101 | * Value: |
1102 | *---------------------------------------------------------------------*/ | 1102 | *---------------------------------------------------------------------*/ |
1103 | static int hpc_wait_ctlr_notworking (int timeout, struct controller *ctlr_ptr, void __iomem *wpg_bbar, | 1103 | static int hpc_wait_ctlr_notworking(int timeout, struct controller *ctlr_ptr, void __iomem *wpg_bbar, |
1104 | u8 *pstatus) | 1104 | u8 *pstatus) |
1105 | { | 1105 | { |
1106 | int rc = 0; | 1106 | int rc = 0; |
1107 | u8 done = 0; | 1107 | u8 done = 0; |
1108 | 1108 | ||
1109 | debug_polling ("hpc_wait_ctlr_notworking - Entry timeout[%d]\n", timeout); | 1109 | debug_polling("hpc_wait_ctlr_notworking - Entry timeout[%d]\n", timeout); |
1110 | 1110 | ||
1111 | while (!done) { | 1111 | while (!done) { |
1112 | *pstatus = ctrl_read (ctlr_ptr, wpg_bbar, WPG_CTLR_INDEX); | 1112 | *pstatus = ctrl_read(ctlr_ptr, wpg_bbar, WPG_CTLR_INDEX); |
1113 | if (*pstatus == HPC_ERROR) { | 1113 | if (*pstatus == HPC_ERROR) { |
1114 | rc = HPC_ERROR; | 1114 | rc = HPC_ERROR; |
1115 | done = 1; | 1115 | done = 1; |
1116 | } | 1116 | } |
1117 | if (CTLR_WORKING (*pstatus) == HPC_CTLR_WORKING_NO) | 1117 | if (CTLR_WORKING(*pstatus) == HPC_CTLR_WORKING_NO) |
1118 | done = 1; | 1118 | done = 1; |
1119 | if (!done) { | 1119 | if (!done) { |
1120 | msleep(1000); | 1120 | msleep(1000); |
1121 | if (timeout < 1) { | 1121 | if (timeout < 1) { |
1122 | done = 1; | 1122 | done = 1; |
1123 | err ("HPCreadslot - Error ctlr timeout\n"); | 1123 | err("HPCreadslot - Error ctlr timeout\n"); |
1124 | rc = HPC_ERROR; | 1124 | rc = HPC_ERROR; |
1125 | } else | 1125 | } else |
1126 | timeout--; | 1126 | timeout--; |
1127 | } | 1127 | } |
1128 | } | 1128 | } |
1129 | debug_polling ("hpc_wait_ctlr_notworking - Exit rc[%x] status[%x]\n", rc, *pstatus); | 1129 | debug_polling("hpc_wait_ctlr_notworking - Exit rc[%x] status[%x]\n", rc, *pstatus); |
1130 | return rc; | 1130 | return rc; |
1131 | } | 1131 | } |
diff --git a/drivers/pci/hotplug/ibmphp_pci.c b/drivers/pci/hotplug/ibmphp_pci.c index 814cea22a9fa..eb89a1838d18 100644 --- a/drivers/pci/hotplug/ibmphp_pci.c +++ b/drivers/pci/hotplug/ibmphp_pci.c | |||
@@ -37,8 +37,8 @@ | |||
37 | static int configure_device(struct pci_func *); | 37 | static int configure_device(struct pci_func *); |
38 | static int configure_bridge(struct pci_func **, u8); | 38 | static int configure_bridge(struct pci_func **, u8); |
39 | static struct res_needed *scan_behind_bridge(struct pci_func *, u8); | 39 | static struct res_needed *scan_behind_bridge(struct pci_func *, u8); |
40 | static int add_new_bus (struct bus_node *, struct resource_node *, struct resource_node *, struct resource_node *, u8); | 40 | static int add_new_bus(struct bus_node *, struct resource_node *, struct resource_node *, struct resource_node *, u8); |
41 | static u8 find_sec_number (u8 primary_busno, u8 slotno); | 41 | static u8 find_sec_number(u8 primary_busno, u8 slotno); |
42 | 42 | ||
43 | /* | 43 | /* |
44 | * NOTE..... If BIOS doesn't provide default routing, we assign: | 44 | * NOTE..... If BIOS doesn't provide default routing, we assign: |
@@ -47,7 +47,7 @@ static u8 find_sec_number (u8 primary_busno, u8 slotno); | |||
47 | * We also assign the same irq numbers for multi function devices. | 47 | * We also assign the same irq numbers for multi function devices. |
48 | * These are PIC mode, so shouldn't matter n.e.ways (hopefully) | 48 | * These are PIC mode, so shouldn't matter n.e.ways (hopefully) |
49 | */ | 49 | */ |
50 | static void assign_alt_irq (struct pci_func *cur_func, u8 class_code) | 50 | static void assign_alt_irq(struct pci_func *cur_func, u8 class_code) |
51 | { | 51 | { |
52 | int j; | 52 | int j; |
53 | for (j = 0; j < 4; j++) { | 53 | for (j = 0; j < 4; j++) { |
@@ -78,7 +78,7 @@ static void assign_alt_irq (struct pci_func *cur_func, u8 class_code) | |||
78 | * if there is an error, will need to go through all previous functions and | 78 | * if there is an error, will need to go through all previous functions and |
79 | * unconfigure....or can add some code into unconfigure_card.... | 79 | * unconfigure....or can add some code into unconfigure_card.... |
80 | */ | 80 | */ |
81 | int ibmphp_configure_card (struct pci_func *func, u8 slotno) | 81 | int ibmphp_configure_card(struct pci_func *func, u8 slotno) |
82 | { | 82 | { |
83 | u16 vendor_id; | 83 | u16 vendor_id; |
84 | u32 class; | 84 | u32 class; |
@@ -92,7 +92,7 @@ int ibmphp_configure_card (struct pci_func *func, u8 slotno) | |||
92 | u8 flag; | 92 | u8 flag; |
93 | u8 valid_device = 0x00; /* to see if we are able to read from card any device info at all */ | 93 | u8 valid_device = 0x00; /* to see if we are able to read from card any device info at all */ |
94 | 94 | ||
95 | debug ("inside configure_card, func->busno = %x\n", func->busno); | 95 | debug("inside configure_card, func->busno = %x\n", func->busno); |
96 | 96 | ||
97 | device = func->device; | 97 | device = func->device; |
98 | cur_func = func; | 98 | cur_func = func; |
@@ -109,15 +109,15 @@ int ibmphp_configure_card (struct pci_func *func, u8 slotno) | |||
109 | 109 | ||
110 | cur_func->function = function; | 110 | cur_func->function = function; |
111 | 111 | ||
112 | debug ("inside the loop, cur_func->busno = %x, cur_func->device = %x, cur_func->function = %x\n", | 112 | debug("inside the loop, cur_func->busno = %x, cur_func->device = %x, cur_func->function = %x\n", |
113 | cur_func->busno, cur_func->device, cur_func->function); | 113 | cur_func->busno, cur_func->device, cur_func->function); |
114 | 114 | ||
115 | pci_bus_read_config_word (ibmphp_pci_bus, devfn, PCI_VENDOR_ID, &vendor_id); | 115 | pci_bus_read_config_word(ibmphp_pci_bus, devfn, PCI_VENDOR_ID, &vendor_id); |
116 | 116 | ||
117 | debug ("vendor_id is %x\n", vendor_id); | 117 | debug("vendor_id is %x\n", vendor_id); |
118 | if (vendor_id != PCI_VENDOR_ID_NOTVALID) { | 118 | if (vendor_id != PCI_VENDOR_ID_NOTVALID) { |
119 | /* found correct device!!! */ | 119 | /* found correct device!!! */ |
120 | debug ("found valid device, vendor_id = %x\n", vendor_id); | 120 | debug("found valid device, vendor_id = %x\n", vendor_id); |
121 | 121 | ||
122 | ++valid_device; | 122 | ++valid_device; |
123 | 123 | ||
@@ -126,29 +126,29 @@ int ibmphp_configure_card (struct pci_func *func, u8 slotno) | |||
126 | * |_=> 0 = single function device, 1 = multi-function device | 126 | * |_=> 0 = single function device, 1 = multi-function device |
127 | */ | 127 | */ |
128 | 128 | ||
129 | pci_bus_read_config_byte (ibmphp_pci_bus, devfn, PCI_HEADER_TYPE, &hdr_type); | 129 | pci_bus_read_config_byte(ibmphp_pci_bus, devfn, PCI_HEADER_TYPE, &hdr_type); |
130 | pci_bus_read_config_dword (ibmphp_pci_bus, devfn, PCI_CLASS_REVISION, &class); | 130 | pci_bus_read_config_dword(ibmphp_pci_bus, devfn, PCI_CLASS_REVISION, &class); |
131 | 131 | ||
132 | class_code = class >> 24; | 132 | class_code = class >> 24; |
133 | debug ("hrd_type = %x, class = %x, class_code %x\n", hdr_type, class, class_code); | 133 | debug("hrd_type = %x, class = %x, class_code %x\n", hdr_type, class, class_code); |
134 | class >>= 8; /* to take revision out, class = class.subclass.prog i/f */ | 134 | class >>= 8; /* to take revision out, class = class.subclass.prog i/f */ |
135 | if (class == PCI_CLASS_NOT_DEFINED_VGA) { | 135 | if (class == PCI_CLASS_NOT_DEFINED_VGA) { |
136 | err ("The device %x is VGA compatible and as is not supported for hot plugging. " | 136 | err("The device %x is VGA compatible and as is not supported for hot plugging. " |
137 | "Please choose another device.\n", cur_func->device); | 137 | "Please choose another device.\n", cur_func->device); |
138 | return -ENODEV; | 138 | return -ENODEV; |
139 | } else if (class == PCI_CLASS_DISPLAY_VGA) { | 139 | } else if (class == PCI_CLASS_DISPLAY_VGA) { |
140 | err ("The device %x is not supported for hot plugging. Please choose another device.\n", | 140 | err("The device %x is not supported for hot plugging. Please choose another device.\n", |
141 | cur_func->device); | 141 | cur_func->device); |
142 | return -ENODEV; | 142 | return -ENODEV; |
143 | } | 143 | } |
144 | switch (hdr_type) { | 144 | switch (hdr_type) { |
145 | case PCI_HEADER_TYPE_NORMAL: | 145 | case PCI_HEADER_TYPE_NORMAL: |
146 | debug ("single device case.... vendor id = %x, hdr_type = %x, class = %x\n", vendor_id, hdr_type, class); | 146 | debug("single device case.... vendor id = %x, hdr_type = %x, class = %x\n", vendor_id, hdr_type, class); |
147 | assign_alt_irq (cur_func, class_code); | 147 | assign_alt_irq(cur_func, class_code); |
148 | rc = configure_device(cur_func); | 148 | rc = configure_device(cur_func); |
149 | if (rc < 0) { | 149 | if (rc < 0) { |
150 | /* We need to do this in case some other BARs were properly inserted */ | 150 | /* We need to do this in case some other BARs were properly inserted */ |
151 | err ("was not able to configure devfunc %x on bus %x.\n", | 151 | err("was not able to configure devfunc %x on bus %x.\n", |
152 | cur_func->device, cur_func->busno); | 152 | cur_func->device, cur_func->busno); |
153 | cleanup_count = 6; | 153 | cleanup_count = 6; |
154 | goto error; | 154 | goto error; |
@@ -157,18 +157,18 @@ int ibmphp_configure_card (struct pci_func *func, u8 slotno) | |||
157 | function = 0x8; | 157 | function = 0x8; |
158 | break; | 158 | break; |
159 | case PCI_HEADER_TYPE_MULTIDEVICE: | 159 | case PCI_HEADER_TYPE_MULTIDEVICE: |
160 | assign_alt_irq (cur_func, class_code); | 160 | assign_alt_irq(cur_func, class_code); |
161 | rc = configure_device(cur_func); | 161 | rc = configure_device(cur_func); |
162 | if (rc < 0) { | 162 | if (rc < 0) { |
163 | /* We need to do this in case some other BARs were properly inserted */ | 163 | /* We need to do this in case some other BARs were properly inserted */ |
164 | err ("was not able to configure devfunc %x on bus %x...bailing out\n", | 164 | err("was not able to configure devfunc %x on bus %x...bailing out\n", |
165 | cur_func->device, cur_func->busno); | 165 | cur_func->device, cur_func->busno); |
166 | cleanup_count = 6; | 166 | cleanup_count = 6; |
167 | goto error; | 167 | goto error; |
168 | } | 168 | } |
169 | newfunc = kzalloc(sizeof(*newfunc), GFP_KERNEL); | 169 | newfunc = kzalloc(sizeof(*newfunc), GFP_KERNEL); |
170 | if (!newfunc) { | 170 | if (!newfunc) { |
171 | err ("out of system memory\n"); | 171 | err("out of system memory\n"); |
172 | return -ENOMEM; | 172 | return -ENOMEM; |
173 | } | 173 | } |
174 | newfunc->busno = cur_func->busno; | 174 | newfunc->busno = cur_func->busno; |
@@ -181,32 +181,32 @@ int ibmphp_configure_card (struct pci_func *func, u8 slotno) | |||
181 | case PCI_HEADER_TYPE_MULTIBRIDGE: | 181 | case PCI_HEADER_TYPE_MULTIBRIDGE: |
182 | class >>= 8; | 182 | class >>= 8; |
183 | if (class != PCI_CLASS_BRIDGE_PCI) { | 183 | if (class != PCI_CLASS_BRIDGE_PCI) { |
184 | err ("This %x is not PCI-to-PCI bridge, and as is not supported for hot-plugging. Please insert another card.\n", | 184 | err("This %x is not PCI-to-PCI bridge, and as is not supported for hot-plugging. Please insert another card.\n", |
185 | cur_func->device); | 185 | cur_func->device); |
186 | return -ENODEV; | 186 | return -ENODEV; |
187 | } | 187 | } |
188 | assign_alt_irq (cur_func, class_code); | 188 | assign_alt_irq(cur_func, class_code); |
189 | rc = configure_bridge (&cur_func, slotno); | 189 | rc = configure_bridge(&cur_func, slotno); |
190 | if (rc == -ENODEV) { | 190 | if (rc == -ENODEV) { |
191 | err ("You chose to insert Single Bridge, or nested bridges, this is not supported...\n"); | 191 | err("You chose to insert Single Bridge, or nested bridges, this is not supported...\n"); |
192 | err ("Bus %x, devfunc %x\n", cur_func->busno, cur_func->device); | 192 | err("Bus %x, devfunc %x\n", cur_func->busno, cur_func->device); |
193 | return rc; | 193 | return rc; |
194 | } | 194 | } |
195 | if (rc) { | 195 | if (rc) { |
196 | /* We need to do this in case some other BARs were properly inserted */ | 196 | /* We need to do this in case some other BARs were properly inserted */ |
197 | err ("was not able to hot-add PPB properly.\n"); | 197 | err("was not able to hot-add PPB properly.\n"); |
198 | func->bus = 1; /* To indicate to the unconfigure function that this is a PPB */ | 198 | func->bus = 1; /* To indicate to the unconfigure function that this is a PPB */ |
199 | cleanup_count = 2; | 199 | cleanup_count = 2; |
200 | goto error; | 200 | goto error; |
201 | } | 201 | } |
202 | 202 | ||
203 | pci_bus_read_config_byte (ibmphp_pci_bus, devfn, PCI_SECONDARY_BUS, &sec_number); | 203 | pci_bus_read_config_byte(ibmphp_pci_bus, devfn, PCI_SECONDARY_BUS, &sec_number); |
204 | flag = 0; | 204 | flag = 0; |
205 | for (i = 0; i < 32; i++) { | 205 | for (i = 0; i < 32; i++) { |
206 | if (func->devices[i]) { | 206 | if (func->devices[i]) { |
207 | newfunc = kzalloc(sizeof(*newfunc), GFP_KERNEL); | 207 | newfunc = kzalloc(sizeof(*newfunc), GFP_KERNEL); |
208 | if (!newfunc) { | 208 | if (!newfunc) { |
209 | err ("out of system memory\n"); | 209 | err("out of system memory\n"); |
210 | return -ENOMEM; | 210 | return -ENOMEM; |
211 | } | 211 | } |
212 | newfunc->busno = sec_number; | 212 | newfunc->busno = sec_number; |
@@ -220,7 +220,7 @@ int ibmphp_configure_card (struct pci_func *func, u8 slotno) | |||
220 | } else | 220 | } else |
221 | cur_func->next = newfunc; | 221 | cur_func->next = newfunc; |
222 | 222 | ||
223 | rc = ibmphp_configure_card (newfunc, slotno); | 223 | rc = ibmphp_configure_card(newfunc, slotno); |
224 | /* This could only happen if kmalloc failed */ | 224 | /* This could only happen if kmalloc failed */ |
225 | if (rc) { | 225 | if (rc) { |
226 | /* We need to do this in case bridge itself got configured properly, but devices behind it failed */ | 226 | /* We need to do this in case bridge itself got configured properly, but devices behind it failed */ |
@@ -234,53 +234,53 @@ int ibmphp_configure_card (struct pci_func *func, u8 slotno) | |||
234 | 234 | ||
235 | newfunc = kzalloc(sizeof(*newfunc), GFP_KERNEL); | 235 | newfunc = kzalloc(sizeof(*newfunc), GFP_KERNEL); |
236 | if (!newfunc) { | 236 | if (!newfunc) { |
237 | err ("out of system memory\n"); | 237 | err("out of system memory\n"); |
238 | return -ENOMEM; | 238 | return -ENOMEM; |
239 | } | 239 | } |
240 | newfunc->busno = cur_func->busno; | 240 | newfunc->busno = cur_func->busno; |
241 | newfunc->device = device; | 241 | newfunc->device = device; |
242 | for (j = 0; j < 4; j++) | 242 | for (j = 0; j < 4; j++) |
243 | newfunc->irq[j] = cur_func->irq[j]; | 243 | newfunc->irq[j] = cur_func->irq[j]; |
244 | for (prev_func = cur_func; prev_func->next; prev_func = prev_func->next) ; | 244 | for (prev_func = cur_func; prev_func->next; prev_func = prev_func->next); |
245 | prev_func->next = newfunc; | 245 | prev_func->next = newfunc; |
246 | cur_func = newfunc; | 246 | cur_func = newfunc; |
247 | break; | 247 | break; |
248 | case PCI_HEADER_TYPE_BRIDGE: | 248 | case PCI_HEADER_TYPE_BRIDGE: |
249 | class >>= 8; | 249 | class >>= 8; |
250 | debug ("class now is %x\n", class); | 250 | debug("class now is %x\n", class); |
251 | if (class != PCI_CLASS_BRIDGE_PCI) { | 251 | if (class != PCI_CLASS_BRIDGE_PCI) { |
252 | err ("This %x is not PCI-to-PCI bridge, and as is not supported for hot-plugging. Please insert another card.\n", | 252 | err("This %x is not PCI-to-PCI bridge, and as is not supported for hot-plugging. Please insert another card.\n", |
253 | cur_func->device); | 253 | cur_func->device); |
254 | return -ENODEV; | 254 | return -ENODEV; |
255 | } | 255 | } |
256 | 256 | ||
257 | assign_alt_irq (cur_func, class_code); | 257 | assign_alt_irq(cur_func, class_code); |
258 | 258 | ||
259 | debug ("cur_func->busno b4 configure_bridge is %x\n", cur_func->busno); | 259 | debug("cur_func->busno b4 configure_bridge is %x\n", cur_func->busno); |
260 | rc = configure_bridge (&cur_func, slotno); | 260 | rc = configure_bridge(&cur_func, slotno); |
261 | if (rc == -ENODEV) { | 261 | if (rc == -ENODEV) { |
262 | err ("You chose to insert Single Bridge, or nested bridges, this is not supported...\n"); | 262 | err("You chose to insert Single Bridge, or nested bridges, this is not supported...\n"); |
263 | err ("Bus %x, devfunc %x\n", cur_func->busno, cur_func->device); | 263 | err("Bus %x, devfunc %x\n", cur_func->busno, cur_func->device); |
264 | return rc; | 264 | return rc; |
265 | } | 265 | } |
266 | if (rc) { | 266 | if (rc) { |
267 | /* We need to do this in case some other BARs were properly inserted */ | 267 | /* We need to do this in case some other BARs were properly inserted */ |
268 | func->bus = 1; /* To indicate to the unconfigure function that this is a PPB */ | 268 | func->bus = 1; /* To indicate to the unconfigure function that this is a PPB */ |
269 | err ("was not able to hot-add PPB properly.\n"); | 269 | err("was not able to hot-add PPB properly.\n"); |
270 | cleanup_count = 2; | 270 | cleanup_count = 2; |
271 | goto error; | 271 | goto error; |
272 | } | 272 | } |
273 | debug ("cur_func->busno = %x, device = %x, function = %x\n", | 273 | debug("cur_func->busno = %x, device = %x, function = %x\n", |
274 | cur_func->busno, device, function); | 274 | cur_func->busno, device, function); |
275 | pci_bus_read_config_byte (ibmphp_pci_bus, devfn, PCI_SECONDARY_BUS, &sec_number); | 275 | pci_bus_read_config_byte(ibmphp_pci_bus, devfn, PCI_SECONDARY_BUS, &sec_number); |
276 | debug ("after configuring bridge..., sec_number = %x\n", sec_number); | 276 | debug("after configuring bridge..., sec_number = %x\n", sec_number); |
277 | flag = 0; | 277 | flag = 0; |
278 | for (i = 0; i < 32; i++) { | 278 | for (i = 0; i < 32; i++) { |
279 | if (func->devices[i]) { | 279 | if (func->devices[i]) { |
280 | debug ("inside for loop, device is %x\n", i); | 280 | debug("inside for loop, device is %x\n", i); |
281 | newfunc = kzalloc(sizeof(*newfunc), GFP_KERNEL); | 281 | newfunc = kzalloc(sizeof(*newfunc), GFP_KERNEL); |
282 | if (!newfunc) { | 282 | if (!newfunc) { |
283 | err (" out of system memory\n"); | 283 | err(" out of system memory\n"); |
284 | return -ENOMEM; | 284 | return -ENOMEM; |
285 | } | 285 | } |
286 | newfunc->busno = sec_number; | 286 | newfunc->busno = sec_number; |
@@ -289,12 +289,12 @@ int ibmphp_configure_card (struct pci_func *func, u8 slotno) | |||
289 | newfunc->irq[j] = cur_func->irq[j]; | 289 | newfunc->irq[j] = cur_func->irq[j]; |
290 | 290 | ||
291 | if (flag) { | 291 | if (flag) { |
292 | for (prev_func = cur_func; prev_func->next; prev_func = prev_func->next) ; | 292 | for (prev_func = cur_func; prev_func->next; prev_func = prev_func->next); |
293 | prev_func->next = newfunc; | 293 | prev_func->next = newfunc; |
294 | } else | 294 | } else |
295 | cur_func->next = newfunc; | 295 | cur_func->next = newfunc; |
296 | 296 | ||
297 | rc = ibmphp_configure_card (newfunc, slotno); | 297 | rc = ibmphp_configure_card(newfunc, slotno); |
298 | 298 | ||
299 | /* Again, this case should not happen... For complete paranoia, will need to call remove_bus */ | 299 | /* Again, this case should not happen... For complete paranoia, will need to call remove_bus */ |
300 | if (rc) { | 300 | if (rc) { |
@@ -310,7 +310,7 @@ int ibmphp_configure_card (struct pci_func *func, u8 slotno) | |||
310 | function = 0x8; | 310 | function = 0x8; |
311 | break; | 311 | break; |
312 | default: | 312 | default: |
313 | err ("MAJOR PROBLEM!!!!, header type not supported? %x\n", hdr_type); | 313 | err("MAJOR PROBLEM!!!!, header type not supported? %x\n", hdr_type); |
314 | return -ENXIO; | 314 | return -ENXIO; |
315 | break; | 315 | break; |
316 | } /* end of switch */ | 316 | } /* end of switch */ |
@@ -318,7 +318,7 @@ int ibmphp_configure_card (struct pci_func *func, u8 slotno) | |||
318 | } /* end of for */ | 318 | } /* end of for */ |
319 | 319 | ||
320 | if (!valid_device) { | 320 | if (!valid_device) { |
321 | err ("Cannot find any valid devices on the card. Or unable to read from card.\n"); | 321 | err("Cannot find any valid devices on the card. Or unable to read from card.\n"); |
322 | return -ENODEV; | 322 | return -ENODEV; |
323 | } | 323 | } |
324 | 324 | ||
@@ -327,13 +327,13 @@ int ibmphp_configure_card (struct pci_func *func, u8 slotno) | |||
327 | error: | 327 | error: |
328 | for (i = 0; i < cleanup_count; i++) { | 328 | for (i = 0; i < cleanup_count; i++) { |
329 | if (cur_func->io[i]) { | 329 | if (cur_func->io[i]) { |
330 | ibmphp_remove_resource (cur_func->io[i]); | 330 | ibmphp_remove_resource(cur_func->io[i]); |
331 | cur_func->io[i] = NULL; | 331 | cur_func->io[i] = NULL; |
332 | } else if (cur_func->pfmem[i]) { | 332 | } else if (cur_func->pfmem[i]) { |
333 | ibmphp_remove_resource (cur_func->pfmem[i]); | 333 | ibmphp_remove_resource(cur_func->pfmem[i]); |
334 | cur_func->pfmem[i] = NULL; | 334 | cur_func->pfmem[i] = NULL; |
335 | } else if (cur_func->mem[i]) { | 335 | } else if (cur_func->mem[i]) { |
336 | ibmphp_remove_resource (cur_func->mem[i]); | 336 | ibmphp_remove_resource(cur_func->mem[i]); |
337 | cur_func->mem[i] = NULL; | 337 | cur_func->mem[i] = NULL; |
338 | } | 338 | } |
339 | } | 339 | } |
@@ -345,7 +345,7 @@ error: | |||
345 | * Input: pointer to the pci_func | 345 | * Input: pointer to the pci_func |
346 | * Output: configured PCI, 0, or error | 346 | * Output: configured PCI, 0, or error |
347 | */ | 347 | */ |
348 | static int configure_device (struct pci_func *func) | 348 | static int configure_device(struct pci_func *func) |
349 | { | 349 | { |
350 | u32 bar[6]; | 350 | u32 bar[6]; |
351 | u32 address[] = { | 351 | u32 address[] = { |
@@ -366,7 +366,7 @@ static int configure_device (struct pci_func *func) | |||
366 | struct resource_node *pfmem[6]; | 366 | struct resource_node *pfmem[6]; |
367 | unsigned int devfn; | 367 | unsigned int devfn; |
368 | 368 | ||
369 | debug ("%s - inside\n", __func__); | 369 | debug("%s - inside\n", __func__); |
370 | 370 | ||
371 | devfn = PCI_DEVFN(func->device, func->function); | 371 | devfn = PCI_DEVFN(func->device, func->function); |
372 | ibmphp_pci_bus->number = func->busno; | 372 | ibmphp_pci_bus->number = func->busno; |
@@ -386,27 +386,27 @@ static int configure_device (struct pci_func *func) | |||
386 | pcibios_write_config_dword(cur_func->busno, cur_func->device, | 386 | pcibios_write_config_dword(cur_func->busno, cur_func->device, |
387 | PCI_BASE_ADDRESS_0 + 4 * count, 0xFFFFFFFF); | 387 | PCI_BASE_ADDRESS_0 + 4 * count, 0xFFFFFFFF); |
388 | */ | 388 | */ |
389 | pci_bus_write_config_dword (ibmphp_pci_bus, devfn, address[count], 0xFFFFFFFF); | 389 | pci_bus_write_config_dword(ibmphp_pci_bus, devfn, address[count], 0xFFFFFFFF); |
390 | pci_bus_read_config_dword (ibmphp_pci_bus, devfn, address[count], &bar[count]); | 390 | pci_bus_read_config_dword(ibmphp_pci_bus, devfn, address[count], &bar[count]); |
391 | 391 | ||
392 | if (!bar[count]) /* This BAR is not implemented */ | 392 | if (!bar[count]) /* This BAR is not implemented */ |
393 | continue; | 393 | continue; |
394 | 394 | ||
395 | debug ("Device %x BAR %d wants %x\n", func->device, count, bar[count]); | 395 | debug("Device %x BAR %d wants %x\n", func->device, count, bar[count]); |
396 | 396 | ||
397 | if (bar[count] & PCI_BASE_ADDRESS_SPACE_IO) { | 397 | if (bar[count] & PCI_BASE_ADDRESS_SPACE_IO) { |
398 | /* This is IO */ | 398 | /* This is IO */ |
399 | debug ("inside IO SPACE\n"); | 399 | debug("inside IO SPACE\n"); |
400 | 400 | ||
401 | len[count] = bar[count] & 0xFFFFFFFC; | 401 | len[count] = bar[count] & 0xFFFFFFFC; |
402 | len[count] = ~len[count] + 1; | 402 | len[count] = ~len[count] + 1; |
403 | 403 | ||
404 | debug ("len[count] in IO %x, count %d\n", len[count], count); | 404 | debug("len[count] in IO %x, count %d\n", len[count], count); |
405 | 405 | ||
406 | io[count] = kzalloc(sizeof(struct resource_node), GFP_KERNEL); | 406 | io[count] = kzalloc(sizeof(struct resource_node), GFP_KERNEL); |
407 | 407 | ||
408 | if (!io[count]) { | 408 | if (!io[count]) { |
409 | err ("out of system memory\n"); | 409 | err("out of system memory\n"); |
410 | return -ENOMEM; | 410 | return -ENOMEM; |
411 | } | 411 | } |
412 | io[count]->type = IO; | 412 | io[count]->type = IO; |
@@ -414,36 +414,36 @@ static int configure_device (struct pci_func *func) | |||
414 | io[count]->devfunc = PCI_DEVFN(func->device, func->function); | 414 | io[count]->devfunc = PCI_DEVFN(func->device, func->function); |
415 | io[count]->len = len[count]; | 415 | io[count]->len = len[count]; |
416 | if (ibmphp_check_resource(io[count], 0) == 0) { | 416 | if (ibmphp_check_resource(io[count], 0) == 0) { |
417 | ibmphp_add_resource (io[count]); | 417 | ibmphp_add_resource(io[count]); |
418 | func->io[count] = io[count]; | 418 | func->io[count] = io[count]; |
419 | } else { | 419 | } else { |
420 | err ("cannot allocate requested io for bus %x device %x function %x len %x\n", | 420 | err("cannot allocate requested io for bus %x device %x function %x len %x\n", |
421 | func->busno, func->device, func->function, len[count]); | 421 | func->busno, func->device, func->function, len[count]); |
422 | kfree (io[count]); | 422 | kfree(io[count]); |
423 | return -EIO; | 423 | return -EIO; |
424 | } | 424 | } |
425 | pci_bus_write_config_dword (ibmphp_pci_bus, devfn, address[count], func->io[count]->start); | 425 | pci_bus_write_config_dword(ibmphp_pci_bus, devfn, address[count], func->io[count]->start); |
426 | 426 | ||
427 | /* _______________This is for debugging purposes only_____________________ */ | 427 | /* _______________This is for debugging purposes only_____________________ */ |
428 | debug ("b4 writing, the IO address is %x\n", func->io[count]->start); | 428 | debug("b4 writing, the IO address is %x\n", func->io[count]->start); |
429 | pci_bus_read_config_dword (ibmphp_pci_bus, devfn, address[count], &bar[count]); | 429 | pci_bus_read_config_dword(ibmphp_pci_bus, devfn, address[count], &bar[count]); |
430 | debug ("after writing.... the start address is %x\n", bar[count]); | 430 | debug("after writing.... the start address is %x\n", bar[count]); |
431 | /* _________________________________________________________________________*/ | 431 | /* _________________________________________________________________________*/ |
432 | 432 | ||
433 | } else { | 433 | } else { |
434 | /* This is Memory */ | 434 | /* This is Memory */ |
435 | if (bar[count] & PCI_BASE_ADDRESS_MEM_PREFETCH) { | 435 | if (bar[count] & PCI_BASE_ADDRESS_MEM_PREFETCH) { |
436 | /* pfmem */ | 436 | /* pfmem */ |
437 | debug ("PFMEM SPACE\n"); | 437 | debug("PFMEM SPACE\n"); |
438 | 438 | ||
439 | len[count] = bar[count] & 0xFFFFFFF0; | 439 | len[count] = bar[count] & 0xFFFFFFF0; |
440 | len[count] = ~len[count] + 1; | 440 | len[count] = ~len[count] + 1; |
441 | 441 | ||
442 | debug ("len[count] in PFMEM %x, count %d\n", len[count], count); | 442 | debug("len[count] in PFMEM %x, count %d\n", len[count], count); |
443 | 443 | ||
444 | pfmem[count] = kzalloc(sizeof(struct resource_node), GFP_KERNEL); | 444 | pfmem[count] = kzalloc(sizeof(struct resource_node), GFP_KERNEL); |
445 | if (!pfmem[count]) { | 445 | if (!pfmem[count]) { |
446 | err ("out of system memory\n"); | 446 | err("out of system memory\n"); |
447 | return -ENOMEM; | 447 | return -ENOMEM; |
448 | } | 448 | } |
449 | pfmem[count]->type = PFMEM; | 449 | pfmem[count]->type = PFMEM; |
@@ -452,64 +452,64 @@ static int configure_device (struct pci_func *func) | |||
452 | func->function); | 452 | func->function); |
453 | pfmem[count]->len = len[count]; | 453 | pfmem[count]->len = len[count]; |
454 | pfmem[count]->fromMem = 0; | 454 | pfmem[count]->fromMem = 0; |
455 | if (ibmphp_check_resource (pfmem[count], 0) == 0) { | 455 | if (ibmphp_check_resource(pfmem[count], 0) == 0) { |
456 | ibmphp_add_resource (pfmem[count]); | 456 | ibmphp_add_resource(pfmem[count]); |
457 | func->pfmem[count] = pfmem[count]; | 457 | func->pfmem[count] = pfmem[count]; |
458 | } else { | 458 | } else { |
459 | mem_tmp = kzalloc(sizeof(*mem_tmp), GFP_KERNEL); | 459 | mem_tmp = kzalloc(sizeof(*mem_tmp), GFP_KERNEL); |
460 | if (!mem_tmp) { | 460 | if (!mem_tmp) { |
461 | err ("out of system memory\n"); | 461 | err("out of system memory\n"); |
462 | kfree (pfmem[count]); | 462 | kfree(pfmem[count]); |
463 | return -ENOMEM; | 463 | return -ENOMEM; |
464 | } | 464 | } |
465 | mem_tmp->type = MEM; | 465 | mem_tmp->type = MEM; |
466 | mem_tmp->busno = pfmem[count]->busno; | 466 | mem_tmp->busno = pfmem[count]->busno; |
467 | mem_tmp->devfunc = pfmem[count]->devfunc; | 467 | mem_tmp->devfunc = pfmem[count]->devfunc; |
468 | mem_tmp->len = pfmem[count]->len; | 468 | mem_tmp->len = pfmem[count]->len; |
469 | debug ("there's no pfmem... going into mem.\n"); | 469 | debug("there's no pfmem... going into mem.\n"); |
470 | if (ibmphp_check_resource (mem_tmp, 0) == 0) { | 470 | if (ibmphp_check_resource(mem_tmp, 0) == 0) { |
471 | ibmphp_add_resource (mem_tmp); | 471 | ibmphp_add_resource(mem_tmp); |
472 | pfmem[count]->fromMem = 1; | 472 | pfmem[count]->fromMem = 1; |
473 | pfmem[count]->rangeno = mem_tmp->rangeno; | 473 | pfmem[count]->rangeno = mem_tmp->rangeno; |
474 | pfmem[count]->start = mem_tmp->start; | 474 | pfmem[count]->start = mem_tmp->start; |
475 | pfmem[count]->end = mem_tmp->end; | 475 | pfmem[count]->end = mem_tmp->end; |
476 | ibmphp_add_pfmem_from_mem (pfmem[count]); | 476 | ibmphp_add_pfmem_from_mem(pfmem[count]); |
477 | func->pfmem[count] = pfmem[count]; | 477 | func->pfmem[count] = pfmem[count]; |
478 | } else { | 478 | } else { |
479 | err ("cannot allocate requested pfmem for bus %x, device %x, len %x\n", | 479 | err("cannot allocate requested pfmem for bus %x, device %x, len %x\n", |
480 | func->busno, func->device, len[count]); | 480 | func->busno, func->device, len[count]); |
481 | kfree (mem_tmp); | 481 | kfree(mem_tmp); |
482 | kfree (pfmem[count]); | 482 | kfree(pfmem[count]); |
483 | return -EIO; | 483 | return -EIO; |
484 | } | 484 | } |
485 | } | 485 | } |
486 | 486 | ||
487 | pci_bus_write_config_dword (ibmphp_pci_bus, devfn, address[count], func->pfmem[count]->start); | 487 | pci_bus_write_config_dword(ibmphp_pci_bus, devfn, address[count], func->pfmem[count]->start); |
488 | 488 | ||
489 | /*_______________This is for debugging purposes only______________________________*/ | 489 | /*_______________This is for debugging purposes only______________________________*/ |
490 | debug ("b4 writing, start address is %x\n", func->pfmem[count]->start); | 490 | debug("b4 writing, start address is %x\n", func->pfmem[count]->start); |
491 | pci_bus_read_config_dword (ibmphp_pci_bus, devfn, address[count], &bar[count]); | 491 | pci_bus_read_config_dword(ibmphp_pci_bus, devfn, address[count], &bar[count]); |
492 | debug ("after writing, start address is %x\n", bar[count]); | 492 | debug("after writing, start address is %x\n", bar[count]); |
493 | /*_________________________________________________________________________________*/ | 493 | /*_________________________________________________________________________________*/ |
494 | 494 | ||
495 | if (bar[count] & PCI_BASE_ADDRESS_MEM_TYPE_64) { /* takes up another dword */ | 495 | if (bar[count] & PCI_BASE_ADDRESS_MEM_TYPE_64) { /* takes up another dword */ |
496 | debug ("inside the mem 64 case, count %d\n", count); | 496 | debug("inside the mem 64 case, count %d\n", count); |
497 | count += 1; | 497 | count += 1; |
498 | /* on the 2nd dword, write all 0s, since we can't handle them n.e.ways */ | 498 | /* on the 2nd dword, write all 0s, since we can't handle them n.e.ways */ |
499 | pci_bus_write_config_dword (ibmphp_pci_bus, devfn, address[count], 0x00000000); | 499 | pci_bus_write_config_dword(ibmphp_pci_bus, devfn, address[count], 0x00000000); |
500 | } | 500 | } |
501 | } else { | 501 | } else { |
502 | /* regular memory */ | 502 | /* regular memory */ |
503 | debug ("REGULAR MEM SPACE\n"); | 503 | debug("REGULAR MEM SPACE\n"); |
504 | 504 | ||
505 | len[count] = bar[count] & 0xFFFFFFF0; | 505 | len[count] = bar[count] & 0xFFFFFFF0; |
506 | len[count] = ~len[count] + 1; | 506 | len[count] = ~len[count] + 1; |
507 | 507 | ||
508 | debug ("len[count] in Mem %x, count %d\n", len[count], count); | 508 | debug("len[count] in Mem %x, count %d\n", len[count], count); |
509 | 509 | ||
510 | mem[count] = kzalloc(sizeof(struct resource_node), GFP_KERNEL); | 510 | mem[count] = kzalloc(sizeof(struct resource_node), GFP_KERNEL); |
511 | if (!mem[count]) { | 511 | if (!mem[count]) { |
512 | err ("out of system memory\n"); | 512 | err("out of system memory\n"); |
513 | return -ENOMEM; | 513 | return -ENOMEM; |
514 | } | 514 | } |
515 | mem[count]->type = MEM; | 515 | mem[count]->type = MEM; |
@@ -517,43 +517,43 @@ static int configure_device (struct pci_func *func) | |||
517 | mem[count]->devfunc = PCI_DEVFN(func->device, | 517 | mem[count]->devfunc = PCI_DEVFN(func->device, |
518 | func->function); | 518 | func->function); |
519 | mem[count]->len = len[count]; | 519 | mem[count]->len = len[count]; |
520 | if (ibmphp_check_resource (mem[count], 0) == 0) { | 520 | if (ibmphp_check_resource(mem[count], 0) == 0) { |
521 | ibmphp_add_resource (mem[count]); | 521 | ibmphp_add_resource(mem[count]); |
522 | func->mem[count] = mem[count]; | 522 | func->mem[count] = mem[count]; |
523 | } else { | 523 | } else { |
524 | err ("cannot allocate requested mem for bus %x, device %x, len %x\n", | 524 | err("cannot allocate requested mem for bus %x, device %x, len %x\n", |
525 | func->busno, func->device, len[count]); | 525 | func->busno, func->device, len[count]); |
526 | kfree (mem[count]); | 526 | kfree(mem[count]); |
527 | return -EIO; | 527 | return -EIO; |
528 | } | 528 | } |
529 | pci_bus_write_config_dword (ibmphp_pci_bus, devfn, address[count], func->mem[count]->start); | 529 | pci_bus_write_config_dword(ibmphp_pci_bus, devfn, address[count], func->mem[count]->start); |
530 | /* _______________________This is for debugging purposes only _______________________*/ | 530 | /* _______________________This is for debugging purposes only _______________________*/ |
531 | debug ("b4 writing, start address is %x\n", func->mem[count]->start); | 531 | debug("b4 writing, start address is %x\n", func->mem[count]->start); |
532 | pci_bus_read_config_dword (ibmphp_pci_bus, devfn, address[count], &bar[count]); | 532 | pci_bus_read_config_dword(ibmphp_pci_bus, devfn, address[count], &bar[count]); |
533 | debug ("after writing, the address is %x\n", bar[count]); | 533 | debug("after writing, the address is %x\n", bar[count]); |
534 | /* __________________________________________________________________________________*/ | 534 | /* __________________________________________________________________________________*/ |
535 | 535 | ||
536 | if (bar[count] & PCI_BASE_ADDRESS_MEM_TYPE_64) { | 536 | if (bar[count] & PCI_BASE_ADDRESS_MEM_TYPE_64) { |
537 | /* takes up another dword */ | 537 | /* takes up another dword */ |
538 | debug ("inside mem 64 case, reg. mem, count %d\n", count); | 538 | debug("inside mem 64 case, reg. mem, count %d\n", count); |
539 | count += 1; | 539 | count += 1; |
540 | /* on the 2nd dword, write all 0s, since we can't handle them n.e.ways */ | 540 | /* on the 2nd dword, write all 0s, since we can't handle them n.e.ways */ |
541 | pci_bus_write_config_dword (ibmphp_pci_bus, devfn, address[count], 0x00000000); | 541 | pci_bus_write_config_dword(ibmphp_pci_bus, devfn, address[count], 0x00000000); |
542 | } | 542 | } |
543 | } | 543 | } |
544 | } /* end of mem */ | 544 | } /* end of mem */ |
545 | } /* end of for */ | 545 | } /* end of for */ |
546 | 546 | ||
547 | func->bus = 0; /* To indicate that this is not a PPB */ | 547 | func->bus = 0; /* To indicate that this is not a PPB */ |
548 | pci_bus_read_config_byte (ibmphp_pci_bus, devfn, PCI_INTERRUPT_PIN, &irq); | 548 | pci_bus_read_config_byte(ibmphp_pci_bus, devfn, PCI_INTERRUPT_PIN, &irq); |
549 | if ((irq > 0x00) && (irq < 0x05)) | 549 | if ((irq > 0x00) && (irq < 0x05)) |
550 | pci_bus_write_config_byte (ibmphp_pci_bus, devfn, PCI_INTERRUPT_LINE, func->irq[irq - 1]); | 550 | pci_bus_write_config_byte(ibmphp_pci_bus, devfn, PCI_INTERRUPT_LINE, func->irq[irq - 1]); |
551 | 551 | ||
552 | pci_bus_write_config_byte (ibmphp_pci_bus, devfn, PCI_CACHE_LINE_SIZE, CACHE); | 552 | pci_bus_write_config_byte(ibmphp_pci_bus, devfn, PCI_CACHE_LINE_SIZE, CACHE); |
553 | pci_bus_write_config_byte (ibmphp_pci_bus, devfn, PCI_LATENCY_TIMER, LATENCY); | 553 | pci_bus_write_config_byte(ibmphp_pci_bus, devfn, PCI_LATENCY_TIMER, LATENCY); |
554 | 554 | ||
555 | pci_bus_write_config_dword (ibmphp_pci_bus, devfn, PCI_ROM_ADDRESS, 0x00L); | 555 | pci_bus_write_config_dword(ibmphp_pci_bus, devfn, PCI_ROM_ADDRESS, 0x00L); |
556 | pci_bus_write_config_word (ibmphp_pci_bus, devfn, PCI_COMMAND, DEVICEENABLE); | 556 | pci_bus_write_config_word(ibmphp_pci_bus, devfn, PCI_COMMAND, DEVICEENABLE); |
557 | 557 | ||
558 | return 0; | 558 | return 0; |
559 | } | 559 | } |
@@ -563,7 +563,7 @@ static int configure_device (struct pci_func *func) | |||
563 | * Parameters: pci_func | 563 | * Parameters: pci_func |
564 | * Returns: | 564 | * Returns: |
565 | ******************************************************************************/ | 565 | ******************************************************************************/ |
566 | static int configure_bridge (struct pci_func **func_passed, u8 slotno) | 566 | static int configure_bridge(struct pci_func **func_passed, u8 slotno) |
567 | { | 567 | { |
568 | int count; | 568 | int count; |
569 | int i; | 569 | int i; |
@@ -597,7 +597,7 @@ static int configure_bridge (struct pci_func **func_passed, u8 slotno) | |||
597 | u8 irq; | 597 | u8 irq; |
598 | int retval; | 598 | int retval; |
599 | 599 | ||
600 | debug ("%s - enter\n", __func__); | 600 | debug("%s - enter\n", __func__); |
601 | 601 | ||
602 | devfn = PCI_DEVFN(func->function, func->device); | 602 | devfn = PCI_DEVFN(func->function, func->device); |
603 | ibmphp_pci_bus->number = func->busno; | 603 | ibmphp_pci_bus->number = func->busno; |
@@ -606,43 +606,43 @@ static int configure_bridge (struct pci_func **func_passed, u8 slotno) | |||
606 | * behind it | 606 | * behind it |
607 | */ | 607 | */ |
608 | 608 | ||
609 | pci_bus_write_config_byte (ibmphp_pci_bus, devfn, PCI_PRIMARY_BUS, func->busno); | 609 | pci_bus_write_config_byte(ibmphp_pci_bus, devfn, PCI_PRIMARY_BUS, func->busno); |
610 | 610 | ||
611 | /* _____________________For debugging purposes only __________________________ | 611 | /* _____________________For debugging purposes only __________________________ |
612 | pci_bus_config_byte (ibmphp_pci_bus, devfn, PCI_PRIMARY_BUS, &pri_number); | 612 | pci_bus_config_byte(ibmphp_pci_bus, devfn, PCI_PRIMARY_BUS, &pri_number); |
613 | debug ("primary # written into the bridge is %x\n", pri_number); | 613 | debug("primary # written into the bridge is %x\n", pri_number); |
614 | ___________________________________________________________________________*/ | 614 | ___________________________________________________________________________*/ |
615 | 615 | ||
616 | /* in EBDA, only get allocated 1 additional bus # per slot */ | 616 | /* in EBDA, only get allocated 1 additional bus # per slot */ |
617 | sec_number = find_sec_number (func->busno, slotno); | 617 | sec_number = find_sec_number(func->busno, slotno); |
618 | if (sec_number == 0xff) { | 618 | if (sec_number == 0xff) { |
619 | err ("cannot allocate secondary bus number for the bridged device\n"); | 619 | err("cannot allocate secondary bus number for the bridged device\n"); |
620 | return -EINVAL; | 620 | return -EINVAL; |
621 | } | 621 | } |
622 | 622 | ||
623 | debug ("after find_sec_number, the number we got is %x\n", sec_number); | 623 | debug("after find_sec_number, the number we got is %x\n", sec_number); |
624 | debug ("AFTER FIND_SEC_NUMBER, func->busno IS %x\n", func->busno); | 624 | debug("AFTER FIND_SEC_NUMBER, func->busno IS %x\n", func->busno); |
625 | 625 | ||
626 | pci_bus_write_config_byte (ibmphp_pci_bus, devfn, PCI_SECONDARY_BUS, sec_number); | 626 | pci_bus_write_config_byte(ibmphp_pci_bus, devfn, PCI_SECONDARY_BUS, sec_number); |
627 | 627 | ||
628 | /* __________________For debugging purposes only __________________________________ | 628 | /* __________________For debugging purposes only __________________________________ |
629 | pci_bus_read_config_byte (ibmphp_pci_bus, devfn, PCI_SECONDARY_BUS, &sec_number); | 629 | pci_bus_read_config_byte(ibmphp_pci_bus, devfn, PCI_SECONDARY_BUS, &sec_number); |
630 | debug ("sec_number after write/read is %x\n", sec_number); | 630 | debug("sec_number after write/read is %x\n", sec_number); |
631 | ________________________________________________________________________________*/ | 631 | ________________________________________________________________________________*/ |
632 | 632 | ||
633 | pci_bus_write_config_byte (ibmphp_pci_bus, devfn, PCI_SUBORDINATE_BUS, sec_number); | 633 | pci_bus_write_config_byte(ibmphp_pci_bus, devfn, PCI_SUBORDINATE_BUS, sec_number); |
634 | 634 | ||
635 | /* __________________For debugging purposes only ____________________________________ | 635 | /* __________________For debugging purposes only ____________________________________ |
636 | pci_bus_read_config_byte (ibmphp_pci_bus, devfn, PCI_SUBORDINATE_BUS, &sec_number); | 636 | pci_bus_read_config_byte(ibmphp_pci_bus, devfn, PCI_SUBORDINATE_BUS, &sec_number); |
637 | debug ("subordinate number after write/read is %x\n", sec_number); | 637 | debug("subordinate number after write/read is %x\n", sec_number); |
638 | __________________________________________________________________________________*/ | 638 | __________________________________________________________________________________*/ |
639 | 639 | ||
640 | pci_bus_write_config_byte (ibmphp_pci_bus, devfn, PCI_CACHE_LINE_SIZE, CACHE); | 640 | pci_bus_write_config_byte(ibmphp_pci_bus, devfn, PCI_CACHE_LINE_SIZE, CACHE); |
641 | pci_bus_write_config_byte (ibmphp_pci_bus, devfn, PCI_LATENCY_TIMER, LATENCY); | 641 | pci_bus_write_config_byte(ibmphp_pci_bus, devfn, PCI_LATENCY_TIMER, LATENCY); |
642 | pci_bus_write_config_byte (ibmphp_pci_bus, devfn, PCI_SEC_LATENCY_TIMER, LATENCY); | 642 | pci_bus_write_config_byte(ibmphp_pci_bus, devfn, PCI_SEC_LATENCY_TIMER, LATENCY); |
643 | 643 | ||
644 | debug ("func->busno is %x\n", func->busno); | 644 | debug("func->busno is %x\n", func->busno); |
645 | debug ("sec_number after writing is %x\n", sec_number); | 645 | debug("sec_number after writing is %x\n", sec_number); |
646 | 646 | ||
647 | 647 | ||
648 | /* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 648 | /* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
@@ -652,29 +652,29 @@ static int configure_bridge (struct pci_func **func_passed, u8 slotno) | |||
652 | 652 | ||
653 | /* First we need to allocate mem/io for the bridge itself in case it needs it */ | 653 | /* First we need to allocate mem/io for the bridge itself in case it needs it */ |
654 | for (count = 0; address[count]; count++) { /* for 2 BARs */ | 654 | for (count = 0; address[count]; count++) { /* for 2 BARs */ |
655 | pci_bus_write_config_dword (ibmphp_pci_bus, devfn, address[count], 0xFFFFFFFF); | 655 | pci_bus_write_config_dword(ibmphp_pci_bus, devfn, address[count], 0xFFFFFFFF); |
656 | pci_bus_read_config_dword (ibmphp_pci_bus, devfn, address[count], &bar[count]); | 656 | pci_bus_read_config_dword(ibmphp_pci_bus, devfn, address[count], &bar[count]); |
657 | 657 | ||
658 | if (!bar[count]) { | 658 | if (!bar[count]) { |
659 | /* This BAR is not implemented */ | 659 | /* This BAR is not implemented */ |
660 | debug ("so we come here then, eh?, count = %d\n", count); | 660 | debug("so we come here then, eh?, count = %d\n", count); |
661 | continue; | 661 | continue; |
662 | } | 662 | } |
663 | // tmp_bar = bar[count]; | 663 | // tmp_bar = bar[count]; |
664 | 664 | ||
665 | debug ("Bar %d wants %x\n", count, bar[count]); | 665 | debug("Bar %d wants %x\n", count, bar[count]); |
666 | 666 | ||
667 | if (bar[count] & PCI_BASE_ADDRESS_SPACE_IO) { | 667 | if (bar[count] & PCI_BASE_ADDRESS_SPACE_IO) { |
668 | /* This is IO */ | 668 | /* This is IO */ |
669 | len[count] = bar[count] & 0xFFFFFFFC; | 669 | len[count] = bar[count] & 0xFFFFFFFC; |
670 | len[count] = ~len[count] + 1; | 670 | len[count] = ~len[count] + 1; |
671 | 671 | ||
672 | debug ("len[count] in IO = %x\n", len[count]); | 672 | debug("len[count] in IO = %x\n", len[count]); |
673 | 673 | ||
674 | bus_io[count] = kzalloc(sizeof(struct resource_node), GFP_KERNEL); | 674 | bus_io[count] = kzalloc(sizeof(struct resource_node), GFP_KERNEL); |
675 | 675 | ||
676 | if (!bus_io[count]) { | 676 | if (!bus_io[count]) { |
677 | err ("out of system memory\n"); | 677 | err("out of system memory\n"); |
678 | retval = -ENOMEM; | 678 | retval = -ENOMEM; |
679 | goto error; | 679 | goto error; |
680 | } | 680 | } |
@@ -683,17 +683,17 @@ static int configure_bridge (struct pci_func **func_passed, u8 slotno) | |||
683 | bus_io[count]->devfunc = PCI_DEVFN(func->device, | 683 | bus_io[count]->devfunc = PCI_DEVFN(func->device, |
684 | func->function); | 684 | func->function); |
685 | bus_io[count]->len = len[count]; | 685 | bus_io[count]->len = len[count]; |
686 | if (ibmphp_check_resource (bus_io[count], 0) == 0) { | 686 | if (ibmphp_check_resource(bus_io[count], 0) == 0) { |
687 | ibmphp_add_resource (bus_io[count]); | 687 | ibmphp_add_resource(bus_io[count]); |
688 | func->io[count] = bus_io[count]; | 688 | func->io[count] = bus_io[count]; |
689 | } else { | 689 | } else { |
690 | err ("cannot allocate requested io for bus %x, device %x, len %x\n", | 690 | err("cannot allocate requested io for bus %x, device %x, len %x\n", |
691 | func->busno, func->device, len[count]); | 691 | func->busno, func->device, len[count]); |
692 | kfree (bus_io[count]); | 692 | kfree(bus_io[count]); |
693 | return -EIO; | 693 | return -EIO; |
694 | } | 694 | } |
695 | 695 | ||
696 | pci_bus_write_config_dword (ibmphp_pci_bus, devfn, address[count], func->io[count]->start); | 696 | pci_bus_write_config_dword(ibmphp_pci_bus, devfn, address[count], func->io[count]->start); |
697 | 697 | ||
698 | } else { | 698 | } else { |
699 | /* This is Memory */ | 699 | /* This is Memory */ |
@@ -702,11 +702,11 @@ static int configure_bridge (struct pci_func **func_passed, u8 slotno) | |||
702 | len[count] = bar[count] & 0xFFFFFFF0; | 702 | len[count] = bar[count] & 0xFFFFFFF0; |
703 | len[count] = ~len[count] + 1; | 703 | len[count] = ~len[count] + 1; |
704 | 704 | ||
705 | debug ("len[count] in PFMEM = %x\n", len[count]); | 705 | debug("len[count] in PFMEM = %x\n", len[count]); |
706 | 706 | ||
707 | bus_pfmem[count] = kzalloc(sizeof(struct resource_node), GFP_KERNEL); | 707 | bus_pfmem[count] = kzalloc(sizeof(struct resource_node), GFP_KERNEL); |
708 | if (!bus_pfmem[count]) { | 708 | if (!bus_pfmem[count]) { |
709 | err ("out of system memory\n"); | 709 | err("out of system memory\n"); |
710 | retval = -ENOMEM; | 710 | retval = -ENOMEM; |
711 | goto error; | 711 | goto error; |
712 | } | 712 | } |
@@ -716,13 +716,13 @@ static int configure_bridge (struct pci_func **func_passed, u8 slotno) | |||
716 | func->function); | 716 | func->function); |
717 | bus_pfmem[count]->len = len[count]; | 717 | bus_pfmem[count]->len = len[count]; |
718 | bus_pfmem[count]->fromMem = 0; | 718 | bus_pfmem[count]->fromMem = 0; |
719 | if (ibmphp_check_resource (bus_pfmem[count], 0) == 0) { | 719 | if (ibmphp_check_resource(bus_pfmem[count], 0) == 0) { |
720 | ibmphp_add_resource (bus_pfmem[count]); | 720 | ibmphp_add_resource(bus_pfmem[count]); |
721 | func->pfmem[count] = bus_pfmem[count]; | 721 | func->pfmem[count] = bus_pfmem[count]; |
722 | } else { | 722 | } else { |
723 | mem_tmp = kzalloc(sizeof(*mem_tmp), GFP_KERNEL); | 723 | mem_tmp = kzalloc(sizeof(*mem_tmp), GFP_KERNEL); |
724 | if (!mem_tmp) { | 724 | if (!mem_tmp) { |
725 | err ("out of system memory\n"); | 725 | err("out of system memory\n"); |
726 | retval = -ENOMEM; | 726 | retval = -ENOMEM; |
727 | goto error; | 727 | goto error; |
728 | } | 728 | } |
@@ -730,28 +730,28 @@ static int configure_bridge (struct pci_func **func_passed, u8 slotno) | |||
730 | mem_tmp->busno = bus_pfmem[count]->busno; | 730 | mem_tmp->busno = bus_pfmem[count]->busno; |
731 | mem_tmp->devfunc = bus_pfmem[count]->devfunc; | 731 | mem_tmp->devfunc = bus_pfmem[count]->devfunc; |
732 | mem_tmp->len = bus_pfmem[count]->len; | 732 | mem_tmp->len = bus_pfmem[count]->len; |
733 | if (ibmphp_check_resource (mem_tmp, 0) == 0) { | 733 | if (ibmphp_check_resource(mem_tmp, 0) == 0) { |
734 | ibmphp_add_resource (mem_tmp); | 734 | ibmphp_add_resource(mem_tmp); |
735 | bus_pfmem[count]->fromMem = 1; | 735 | bus_pfmem[count]->fromMem = 1; |
736 | bus_pfmem[count]->rangeno = mem_tmp->rangeno; | 736 | bus_pfmem[count]->rangeno = mem_tmp->rangeno; |
737 | ibmphp_add_pfmem_from_mem (bus_pfmem[count]); | 737 | ibmphp_add_pfmem_from_mem(bus_pfmem[count]); |
738 | func->pfmem[count] = bus_pfmem[count]; | 738 | func->pfmem[count] = bus_pfmem[count]; |
739 | } else { | 739 | } else { |
740 | err ("cannot allocate requested pfmem for bus %x, device %x, len %x\n", | 740 | err("cannot allocate requested pfmem for bus %x, device %x, len %x\n", |
741 | func->busno, func->device, len[count]); | 741 | func->busno, func->device, len[count]); |
742 | kfree (mem_tmp); | 742 | kfree(mem_tmp); |
743 | kfree (bus_pfmem[count]); | 743 | kfree(bus_pfmem[count]); |
744 | return -EIO; | 744 | return -EIO; |
745 | } | 745 | } |
746 | } | 746 | } |
747 | 747 | ||
748 | pci_bus_write_config_dword (ibmphp_pci_bus, devfn, address[count], func->pfmem[count]->start); | 748 | pci_bus_write_config_dword(ibmphp_pci_bus, devfn, address[count], func->pfmem[count]->start); |
749 | 749 | ||
750 | if (bar[count] & PCI_BASE_ADDRESS_MEM_TYPE_64) { | 750 | if (bar[count] & PCI_BASE_ADDRESS_MEM_TYPE_64) { |
751 | /* takes up another dword */ | 751 | /* takes up another dword */ |
752 | count += 1; | 752 | count += 1; |
753 | /* on the 2nd dword, write all 0s, since we can't handle them n.e.ways */ | 753 | /* on the 2nd dword, write all 0s, since we can't handle them n.e.ways */ |
754 | pci_bus_write_config_dword (ibmphp_pci_bus, devfn, address[count], 0x00000000); | 754 | pci_bus_write_config_dword(ibmphp_pci_bus, devfn, address[count], 0x00000000); |
755 | 755 | ||
756 | } | 756 | } |
757 | } else { | 757 | } else { |
@@ -759,11 +759,11 @@ static int configure_bridge (struct pci_func **func_passed, u8 slotno) | |||
759 | len[count] = bar[count] & 0xFFFFFFF0; | 759 | len[count] = bar[count] & 0xFFFFFFF0; |
760 | len[count] = ~len[count] + 1; | 760 | len[count] = ~len[count] + 1; |
761 | 761 | ||
762 | debug ("len[count] in Memory is %x\n", len[count]); | 762 | debug("len[count] in Memory is %x\n", len[count]); |
763 | 763 | ||
764 | bus_mem[count] = kzalloc(sizeof(struct resource_node), GFP_KERNEL); | 764 | bus_mem[count] = kzalloc(sizeof(struct resource_node), GFP_KERNEL); |
765 | if (!bus_mem[count]) { | 765 | if (!bus_mem[count]) { |
766 | err ("out of system memory\n"); | 766 | err("out of system memory\n"); |
767 | retval = -ENOMEM; | 767 | retval = -ENOMEM; |
768 | goto error; | 768 | goto error; |
769 | } | 769 | } |
@@ -772,23 +772,23 @@ static int configure_bridge (struct pci_func **func_passed, u8 slotno) | |||
772 | bus_mem[count]->devfunc = PCI_DEVFN(func->device, | 772 | bus_mem[count]->devfunc = PCI_DEVFN(func->device, |
773 | func->function); | 773 | func->function); |
774 | bus_mem[count]->len = len[count]; | 774 | bus_mem[count]->len = len[count]; |
775 | if (ibmphp_check_resource (bus_mem[count], 0) == 0) { | 775 | if (ibmphp_check_resource(bus_mem[count], 0) == 0) { |
776 | ibmphp_add_resource (bus_mem[count]); | 776 | ibmphp_add_resource(bus_mem[count]); |
777 | func->mem[count] = bus_mem[count]; | 777 | func->mem[count] = bus_mem[count]; |
778 | } else { | 778 | } else { |
779 | err ("cannot allocate requested mem for bus %x, device %x, len %x\n", | 779 | err("cannot allocate requested mem for bus %x, device %x, len %x\n", |
780 | func->busno, func->device, len[count]); | 780 | func->busno, func->device, len[count]); |
781 | kfree (bus_mem[count]); | 781 | kfree(bus_mem[count]); |
782 | return -EIO; | 782 | return -EIO; |
783 | } | 783 | } |
784 | 784 | ||
785 | pci_bus_write_config_dword (ibmphp_pci_bus, devfn, address[count], func->mem[count]->start); | 785 | pci_bus_write_config_dword(ibmphp_pci_bus, devfn, address[count], func->mem[count]->start); |
786 | 786 | ||
787 | if (bar[count] & PCI_BASE_ADDRESS_MEM_TYPE_64) { | 787 | if (bar[count] & PCI_BASE_ADDRESS_MEM_TYPE_64) { |
788 | /* takes up another dword */ | 788 | /* takes up another dword */ |
789 | count += 1; | 789 | count += 1; |
790 | /* on the 2nd dword, write all 0s, since we can't handle them n.e.ways */ | 790 | /* on the 2nd dword, write all 0s, since we can't handle them n.e.ways */ |
791 | pci_bus_write_config_dword (ibmphp_pci_bus, devfn, address[count], 0x00000000); | 791 | pci_bus_write_config_dword(ibmphp_pci_bus, devfn, address[count], 0x00000000); |
792 | 792 | ||
793 | } | 793 | } |
794 | } | 794 | } |
@@ -796,45 +796,45 @@ static int configure_bridge (struct pci_func **func_passed, u8 slotno) | |||
796 | } /* end of for */ | 796 | } /* end of for */ |
797 | 797 | ||
798 | /* Now need to see how much space the devices behind the bridge needed */ | 798 | /* Now need to see how much space the devices behind the bridge needed */ |
799 | amount_needed = scan_behind_bridge (func, sec_number); | 799 | amount_needed = scan_behind_bridge(func, sec_number); |
800 | if (amount_needed == NULL) | 800 | if (amount_needed == NULL) |
801 | return -ENOMEM; | 801 | return -ENOMEM; |
802 | 802 | ||
803 | ibmphp_pci_bus->number = func->busno; | 803 | ibmphp_pci_bus->number = func->busno; |
804 | debug ("after coming back from scan_behind_bridge\n"); | 804 | debug("after coming back from scan_behind_bridge\n"); |
805 | debug ("amount_needed->not_correct = %x\n", amount_needed->not_correct); | 805 | debug("amount_needed->not_correct = %x\n", amount_needed->not_correct); |
806 | debug ("amount_needed->io = %x\n", amount_needed->io); | 806 | debug("amount_needed->io = %x\n", amount_needed->io); |
807 | debug ("amount_needed->mem = %x\n", amount_needed->mem); | 807 | debug("amount_needed->mem = %x\n", amount_needed->mem); |
808 | debug ("amount_needed->pfmem = %x\n", amount_needed->pfmem); | 808 | debug("amount_needed->pfmem = %x\n", amount_needed->pfmem); |
809 | 809 | ||
810 | if (amount_needed->not_correct) { | 810 | if (amount_needed->not_correct) { |
811 | debug ("amount_needed is not correct\n"); | 811 | debug("amount_needed is not correct\n"); |
812 | for (count = 0; address[count]; count++) { | 812 | for (count = 0; address[count]; count++) { |
813 | /* for 2 BARs */ | 813 | /* for 2 BARs */ |
814 | if (bus_io[count]) { | 814 | if (bus_io[count]) { |
815 | ibmphp_remove_resource (bus_io[count]); | 815 | ibmphp_remove_resource(bus_io[count]); |
816 | func->io[count] = NULL; | 816 | func->io[count] = NULL; |
817 | } else if (bus_pfmem[count]) { | 817 | } else if (bus_pfmem[count]) { |
818 | ibmphp_remove_resource (bus_pfmem[count]); | 818 | ibmphp_remove_resource(bus_pfmem[count]); |
819 | func->pfmem[count] = NULL; | 819 | func->pfmem[count] = NULL; |
820 | } else if (bus_mem[count]) { | 820 | } else if (bus_mem[count]) { |
821 | ibmphp_remove_resource (bus_mem[count]); | 821 | ibmphp_remove_resource(bus_mem[count]); |
822 | func->mem[count] = NULL; | 822 | func->mem[count] = NULL; |
823 | } | 823 | } |
824 | } | 824 | } |
825 | kfree (amount_needed); | 825 | kfree(amount_needed); |
826 | return -ENODEV; | 826 | return -ENODEV; |
827 | } | 827 | } |
828 | 828 | ||
829 | if (!amount_needed->io) { | 829 | if (!amount_needed->io) { |
830 | debug ("it doesn't want IO?\n"); | 830 | debug("it doesn't want IO?\n"); |
831 | flag_io = 1; | 831 | flag_io = 1; |
832 | } else { | 832 | } else { |
833 | debug ("it wants %x IO behind the bridge\n", amount_needed->io); | 833 | debug("it wants %x IO behind the bridge\n", amount_needed->io); |
834 | io = kzalloc(sizeof(*io), GFP_KERNEL); | 834 | io = kzalloc(sizeof(*io), GFP_KERNEL); |
835 | 835 | ||
836 | if (!io) { | 836 | if (!io) { |
837 | err ("out of system memory\n"); | 837 | err("out of system memory\n"); |
838 | retval = -ENOMEM; | 838 | retval = -ENOMEM; |
839 | goto error; | 839 | goto error; |
840 | } | 840 | } |
@@ -842,21 +842,21 @@ static int configure_bridge (struct pci_func **func_passed, u8 slotno) | |||
842 | io->busno = func->busno; | 842 | io->busno = func->busno; |
843 | io->devfunc = PCI_DEVFN(func->device, func->function); | 843 | io->devfunc = PCI_DEVFN(func->device, func->function); |
844 | io->len = amount_needed->io; | 844 | io->len = amount_needed->io; |
845 | if (ibmphp_check_resource (io, 1) == 0) { | 845 | if (ibmphp_check_resource(io, 1) == 0) { |
846 | debug ("were we able to add io\n"); | 846 | debug("were we able to add io\n"); |
847 | ibmphp_add_resource (io); | 847 | ibmphp_add_resource(io); |
848 | flag_io = 1; | 848 | flag_io = 1; |
849 | } | 849 | } |
850 | } | 850 | } |
851 | 851 | ||
852 | if (!amount_needed->mem) { | 852 | if (!amount_needed->mem) { |
853 | debug ("it doesn't want n.e.memory?\n"); | 853 | debug("it doesn't want n.e.memory?\n"); |
854 | flag_mem = 1; | 854 | flag_mem = 1; |
855 | } else { | 855 | } else { |
856 | debug ("it wants %x memory behind the bridge\n", amount_needed->mem); | 856 | debug("it wants %x memory behind the bridge\n", amount_needed->mem); |
857 | mem = kzalloc(sizeof(*mem), GFP_KERNEL); | 857 | mem = kzalloc(sizeof(*mem), GFP_KERNEL); |
858 | if (!mem) { | 858 | if (!mem) { |
859 | err ("out of system memory\n"); | 859 | err("out of system memory\n"); |
860 | retval = -ENOMEM; | 860 | retval = -ENOMEM; |
861 | goto error; | 861 | goto error; |
862 | } | 862 | } |
@@ -864,21 +864,21 @@ static int configure_bridge (struct pci_func **func_passed, u8 slotno) | |||
864 | mem->busno = func->busno; | 864 | mem->busno = func->busno; |
865 | mem->devfunc = PCI_DEVFN(func->device, func->function); | 865 | mem->devfunc = PCI_DEVFN(func->device, func->function); |
866 | mem->len = amount_needed->mem; | 866 | mem->len = amount_needed->mem; |
867 | if (ibmphp_check_resource (mem, 1) == 0) { | 867 | if (ibmphp_check_resource(mem, 1) == 0) { |
868 | ibmphp_add_resource (mem); | 868 | ibmphp_add_resource(mem); |
869 | flag_mem = 1; | 869 | flag_mem = 1; |
870 | debug ("were we able to add mem\n"); | 870 | debug("were we able to add mem\n"); |
871 | } | 871 | } |
872 | } | 872 | } |
873 | 873 | ||
874 | if (!amount_needed->pfmem) { | 874 | if (!amount_needed->pfmem) { |
875 | debug ("it doesn't want n.e.pfmem mem?\n"); | 875 | debug("it doesn't want n.e.pfmem mem?\n"); |
876 | flag_pfmem = 1; | 876 | flag_pfmem = 1; |
877 | } else { | 877 | } else { |
878 | debug ("it wants %x pfmemory behind the bridge\n", amount_needed->pfmem); | 878 | debug("it wants %x pfmemory behind the bridge\n", amount_needed->pfmem); |
879 | pfmem = kzalloc(sizeof(*pfmem), GFP_KERNEL); | 879 | pfmem = kzalloc(sizeof(*pfmem), GFP_KERNEL); |
880 | if (!pfmem) { | 880 | if (!pfmem) { |
881 | err ("out of system memory\n"); | 881 | err("out of system memory\n"); |
882 | retval = -ENOMEM; | 882 | retval = -ENOMEM; |
883 | goto error; | 883 | goto error; |
884 | } | 884 | } |
@@ -887,13 +887,13 @@ static int configure_bridge (struct pci_func **func_passed, u8 slotno) | |||
887 | pfmem->devfunc = PCI_DEVFN(func->device, func->function); | 887 | pfmem->devfunc = PCI_DEVFN(func->device, func->function); |
888 | pfmem->len = amount_needed->pfmem; | 888 | pfmem->len = amount_needed->pfmem; |
889 | pfmem->fromMem = 0; | 889 | pfmem->fromMem = 0; |
890 | if (ibmphp_check_resource (pfmem, 1) == 0) { | 890 | if (ibmphp_check_resource(pfmem, 1) == 0) { |
891 | ibmphp_add_resource (pfmem); | 891 | ibmphp_add_resource(pfmem); |
892 | flag_pfmem = 1; | 892 | flag_pfmem = 1; |
893 | } else { | 893 | } else { |
894 | mem_tmp = kzalloc(sizeof(*mem_tmp), GFP_KERNEL); | 894 | mem_tmp = kzalloc(sizeof(*mem_tmp), GFP_KERNEL); |
895 | if (!mem_tmp) { | 895 | if (!mem_tmp) { |
896 | err ("out of system memory\n"); | 896 | err("out of system memory\n"); |
897 | retval = -ENOMEM; | 897 | retval = -ENOMEM; |
898 | goto error; | 898 | goto error; |
899 | } | 899 | } |
@@ -901,18 +901,18 @@ static int configure_bridge (struct pci_func **func_passed, u8 slotno) | |||
901 | mem_tmp->busno = pfmem->busno; | 901 | mem_tmp->busno = pfmem->busno; |
902 | mem_tmp->devfunc = pfmem->devfunc; | 902 | mem_tmp->devfunc = pfmem->devfunc; |
903 | mem_tmp->len = pfmem->len; | 903 | mem_tmp->len = pfmem->len; |
904 | if (ibmphp_check_resource (mem_tmp, 1) == 0) { | 904 | if (ibmphp_check_resource(mem_tmp, 1) == 0) { |
905 | ibmphp_add_resource (mem_tmp); | 905 | ibmphp_add_resource(mem_tmp); |
906 | pfmem->fromMem = 1; | 906 | pfmem->fromMem = 1; |
907 | pfmem->rangeno = mem_tmp->rangeno; | 907 | pfmem->rangeno = mem_tmp->rangeno; |
908 | ibmphp_add_pfmem_from_mem (pfmem); | 908 | ibmphp_add_pfmem_from_mem(pfmem); |
909 | flag_pfmem = 1; | 909 | flag_pfmem = 1; |
910 | } | 910 | } |
911 | } | 911 | } |
912 | } | 912 | } |
913 | 913 | ||
914 | debug ("b4 if (flag_io && flag_mem && flag_pfmem)\n"); | 914 | debug("b4 if (flag_io && flag_mem && flag_pfmem)\n"); |
915 | debug ("flag_io = %x, flag_mem = %x, flag_pfmem = %x\n", flag_io, flag_mem, flag_pfmem); | 915 | debug("flag_io = %x, flag_mem = %x, flag_pfmem = %x\n", flag_io, flag_mem, flag_pfmem); |
916 | 916 | ||
917 | if (flag_io && flag_mem && flag_pfmem) { | 917 | if (flag_io && flag_mem && flag_pfmem) { |
918 | /* If on bootup, there was a bridged card in this slot, | 918 | /* If on bootup, there was a bridged card in this slot, |
@@ -920,127 +920,127 @@ static int configure_bridge (struct pci_func **func_passed, u8 slotno) | |||
920 | * back again, there's no way for us to remove the bus | 920 | * back again, there's no way for us to remove the bus |
921 | * struct, so no need to kmalloc, can use existing node | 921 | * struct, so no need to kmalloc, can use existing node |
922 | */ | 922 | */ |
923 | bus = ibmphp_find_res_bus (sec_number); | 923 | bus = ibmphp_find_res_bus(sec_number); |
924 | if (!bus) { | 924 | if (!bus) { |
925 | bus = kzalloc(sizeof(*bus), GFP_KERNEL); | 925 | bus = kzalloc(sizeof(*bus), GFP_KERNEL); |
926 | if (!bus) { | 926 | if (!bus) { |
927 | err ("out of system memory\n"); | 927 | err("out of system memory\n"); |
928 | retval = -ENOMEM; | 928 | retval = -ENOMEM; |
929 | goto error; | 929 | goto error; |
930 | } | 930 | } |
931 | bus->busno = sec_number; | 931 | bus->busno = sec_number; |
932 | debug ("b4 adding new bus\n"); | 932 | debug("b4 adding new bus\n"); |
933 | rc = add_new_bus (bus, io, mem, pfmem, func->busno); | 933 | rc = add_new_bus(bus, io, mem, pfmem, func->busno); |
934 | } else if (!(bus->rangeIO) && !(bus->rangeMem) && !(bus->rangePFMem)) | 934 | } else if (!(bus->rangeIO) && !(bus->rangeMem) && !(bus->rangePFMem)) |
935 | rc = add_new_bus (bus, io, mem, pfmem, 0xFF); | 935 | rc = add_new_bus(bus, io, mem, pfmem, 0xFF); |
936 | else { | 936 | else { |
937 | err ("expected bus structure not empty?\n"); | 937 | err("expected bus structure not empty?\n"); |
938 | retval = -EIO; | 938 | retval = -EIO; |
939 | goto error; | 939 | goto error; |
940 | } | 940 | } |
941 | if (rc) { | 941 | if (rc) { |
942 | if (rc == -ENOMEM) { | 942 | if (rc == -ENOMEM) { |
943 | ibmphp_remove_bus (bus, func->busno); | 943 | ibmphp_remove_bus(bus, func->busno); |
944 | kfree (amount_needed); | 944 | kfree(amount_needed); |
945 | return rc; | 945 | return rc; |
946 | } | 946 | } |
947 | retval = rc; | 947 | retval = rc; |
948 | goto error; | 948 | goto error; |
949 | } | 949 | } |
950 | pci_bus_read_config_byte (ibmphp_pci_bus, devfn, PCI_IO_BASE, &io_base); | 950 | pci_bus_read_config_byte(ibmphp_pci_bus, devfn, PCI_IO_BASE, &io_base); |
951 | pci_bus_read_config_word (ibmphp_pci_bus, devfn, PCI_PREF_MEMORY_BASE, &pfmem_base); | 951 | pci_bus_read_config_word(ibmphp_pci_bus, devfn, PCI_PREF_MEMORY_BASE, &pfmem_base); |
952 | 952 | ||
953 | if ((io_base & PCI_IO_RANGE_TYPE_MASK) == PCI_IO_RANGE_TYPE_32) { | 953 | if ((io_base & PCI_IO_RANGE_TYPE_MASK) == PCI_IO_RANGE_TYPE_32) { |
954 | debug ("io 32\n"); | 954 | debug("io 32\n"); |
955 | need_io_upper = 1; | 955 | need_io_upper = 1; |
956 | } | 956 | } |
957 | if ((pfmem_base & PCI_PREF_RANGE_TYPE_MASK) == PCI_PREF_RANGE_TYPE_64) { | 957 | if ((pfmem_base & PCI_PREF_RANGE_TYPE_MASK) == PCI_PREF_RANGE_TYPE_64) { |
958 | debug ("pfmem 64\n"); | 958 | debug("pfmem 64\n"); |
959 | need_pfmem_upper = 1; | 959 | need_pfmem_upper = 1; |
960 | } | 960 | } |
961 | 961 | ||
962 | if (bus->noIORanges) { | 962 | if (bus->noIORanges) { |
963 | pci_bus_write_config_byte (ibmphp_pci_bus, devfn, PCI_IO_BASE, 0x00 | bus->rangeIO->start >> 8); | 963 | pci_bus_write_config_byte(ibmphp_pci_bus, devfn, PCI_IO_BASE, 0x00 | bus->rangeIO->start >> 8); |
964 | pci_bus_write_config_byte (ibmphp_pci_bus, devfn, PCI_IO_LIMIT, 0x00 | bus->rangeIO->end >> 8); | 964 | pci_bus_write_config_byte(ibmphp_pci_bus, devfn, PCI_IO_LIMIT, 0x00 | bus->rangeIO->end >> 8); |
965 | 965 | ||
966 | /* _______________This is for debugging purposes only ____________________ | 966 | /* _______________This is for debugging purposes only ____________________ |
967 | pci_bus_read_config_byte (ibmphp_pci_bus, devfn, PCI_IO_BASE, &temp); | 967 | pci_bus_read_config_byte(ibmphp_pci_bus, devfn, PCI_IO_BASE, &temp); |
968 | debug ("io_base = %x\n", (temp & PCI_IO_RANGE_TYPE_MASK) << 8); | 968 | debug("io_base = %x\n", (temp & PCI_IO_RANGE_TYPE_MASK) << 8); |
969 | pci_bus_read_config_byte (ibmphp_pci_bus, devfn, PCI_IO_LIMIT, &temp); | 969 | pci_bus_read_config_byte(ibmphp_pci_bus, devfn, PCI_IO_LIMIT, &temp); |
970 | debug ("io_limit = %x\n", (temp & PCI_IO_RANGE_TYPE_MASK) << 8); | 970 | debug("io_limit = %x\n", (temp & PCI_IO_RANGE_TYPE_MASK) << 8); |
971 | ________________________________________________________________________*/ | 971 | ________________________________________________________________________*/ |
972 | 972 | ||
973 | if (need_io_upper) { /* since can't support n.e.ways */ | 973 | if (need_io_upper) { /* since can't support n.e.ways */ |
974 | pci_bus_write_config_word (ibmphp_pci_bus, devfn, PCI_IO_BASE_UPPER16, 0x0000); | 974 | pci_bus_write_config_word(ibmphp_pci_bus, devfn, PCI_IO_BASE_UPPER16, 0x0000); |
975 | pci_bus_write_config_word (ibmphp_pci_bus, devfn, PCI_IO_LIMIT_UPPER16, 0x0000); | 975 | pci_bus_write_config_word(ibmphp_pci_bus, devfn, PCI_IO_LIMIT_UPPER16, 0x0000); |
976 | } | 976 | } |
977 | } else { | 977 | } else { |
978 | pci_bus_write_config_byte (ibmphp_pci_bus, devfn, PCI_IO_BASE, 0x00); | 978 | pci_bus_write_config_byte(ibmphp_pci_bus, devfn, PCI_IO_BASE, 0x00); |
979 | pci_bus_write_config_byte (ibmphp_pci_bus, devfn, PCI_IO_LIMIT, 0x00); | 979 | pci_bus_write_config_byte(ibmphp_pci_bus, devfn, PCI_IO_LIMIT, 0x00); |
980 | } | 980 | } |
981 | 981 | ||
982 | if (bus->noMemRanges) { | 982 | if (bus->noMemRanges) { |
983 | pci_bus_write_config_word (ibmphp_pci_bus, devfn, PCI_MEMORY_BASE, 0x0000 | bus->rangeMem->start >> 16); | 983 | pci_bus_write_config_word(ibmphp_pci_bus, devfn, PCI_MEMORY_BASE, 0x0000 | bus->rangeMem->start >> 16); |
984 | pci_bus_write_config_word (ibmphp_pci_bus, devfn, PCI_MEMORY_LIMIT, 0x0000 | bus->rangeMem->end >> 16); | 984 | pci_bus_write_config_word(ibmphp_pci_bus, devfn, PCI_MEMORY_LIMIT, 0x0000 | bus->rangeMem->end >> 16); |
985 | 985 | ||
986 | /* ____________________This is for debugging purposes only ________________________ | 986 | /* ____________________This is for debugging purposes only ________________________ |
987 | pci_bus_read_config_word (ibmphp_pci_bus, devfn, PCI_MEMORY_BASE, &temp); | 987 | pci_bus_read_config_word(ibmphp_pci_bus, devfn, PCI_MEMORY_BASE, &temp); |
988 | debug ("mem_base = %x\n", (temp & PCI_MEMORY_RANGE_TYPE_MASK) << 16); | 988 | debug("mem_base = %x\n", (temp & PCI_MEMORY_RANGE_TYPE_MASK) << 16); |
989 | pci_bus_read_config_word (ibmphp_pci_bus, devfn, PCI_MEMORY_LIMIT, &temp); | 989 | pci_bus_read_config_word(ibmphp_pci_bus, devfn, PCI_MEMORY_LIMIT, &temp); |
990 | debug ("mem_limit = %x\n", (temp & PCI_MEMORY_RANGE_TYPE_MASK) << 16); | 990 | debug("mem_limit = %x\n", (temp & PCI_MEMORY_RANGE_TYPE_MASK) << 16); |
991 | __________________________________________________________________________________*/ | 991 | __________________________________________________________________________________*/ |
992 | 992 | ||
993 | } else { | 993 | } else { |
994 | pci_bus_write_config_word (ibmphp_pci_bus, devfn, PCI_MEMORY_BASE, 0xffff); | 994 | pci_bus_write_config_word(ibmphp_pci_bus, devfn, PCI_MEMORY_BASE, 0xffff); |
995 | pci_bus_write_config_word (ibmphp_pci_bus, devfn, PCI_MEMORY_LIMIT, 0x0000); | 995 | pci_bus_write_config_word(ibmphp_pci_bus, devfn, PCI_MEMORY_LIMIT, 0x0000); |
996 | } | 996 | } |
997 | if (bus->noPFMemRanges) { | 997 | if (bus->noPFMemRanges) { |
998 | pci_bus_write_config_word (ibmphp_pci_bus, devfn, PCI_PREF_MEMORY_BASE, 0x0000 | bus->rangePFMem->start >> 16); | 998 | pci_bus_write_config_word(ibmphp_pci_bus, devfn, PCI_PREF_MEMORY_BASE, 0x0000 | bus->rangePFMem->start >> 16); |
999 | pci_bus_write_config_word (ibmphp_pci_bus, devfn, PCI_PREF_MEMORY_LIMIT, 0x0000 | bus->rangePFMem->end >> 16); | 999 | pci_bus_write_config_word(ibmphp_pci_bus, devfn, PCI_PREF_MEMORY_LIMIT, 0x0000 | bus->rangePFMem->end >> 16); |
1000 | 1000 | ||
1001 | /* __________________________This is for debugging purposes only _______________________ | 1001 | /* __________________________This is for debugging purposes only _______________________ |
1002 | pci_bus_read_config_word (ibmphp_pci_bus, devfn, PCI_PREF_MEMORY_BASE, &temp); | 1002 | pci_bus_read_config_word(ibmphp_pci_bus, devfn, PCI_PREF_MEMORY_BASE, &temp); |
1003 | debug ("pfmem_base = %x", (temp & PCI_MEMORY_RANGE_TYPE_MASK) << 16); | 1003 | debug("pfmem_base = %x", (temp & PCI_MEMORY_RANGE_TYPE_MASK) << 16); |
1004 | pci_bus_read_config_word (ibmphp_pci_bus, devfn, PCI_PREF_MEMORY_LIMIT, &temp); | 1004 | pci_bus_read_config_word(ibmphp_pci_bus, devfn, PCI_PREF_MEMORY_LIMIT, &temp); |
1005 | debug ("pfmem_limit = %x\n", (temp & PCI_MEMORY_RANGE_TYPE_MASK) << 16); | 1005 | debug("pfmem_limit = %x\n", (temp & PCI_MEMORY_RANGE_TYPE_MASK) << 16); |
1006 | ______________________________________________________________________________________*/ | 1006 | ______________________________________________________________________________________*/ |
1007 | 1007 | ||
1008 | if (need_pfmem_upper) { /* since can't support n.e.ways */ | 1008 | if (need_pfmem_upper) { /* since can't support n.e.ways */ |
1009 | pci_bus_write_config_dword (ibmphp_pci_bus, devfn, PCI_PREF_BASE_UPPER32, 0x00000000); | 1009 | pci_bus_write_config_dword(ibmphp_pci_bus, devfn, PCI_PREF_BASE_UPPER32, 0x00000000); |
1010 | pci_bus_write_config_dword (ibmphp_pci_bus, devfn, PCI_PREF_LIMIT_UPPER32, 0x00000000); | 1010 | pci_bus_write_config_dword(ibmphp_pci_bus, devfn, PCI_PREF_LIMIT_UPPER32, 0x00000000); |
1011 | } | 1011 | } |
1012 | } else { | 1012 | } else { |
1013 | pci_bus_write_config_word (ibmphp_pci_bus, devfn, PCI_PREF_MEMORY_BASE, 0xffff); | 1013 | pci_bus_write_config_word(ibmphp_pci_bus, devfn, PCI_PREF_MEMORY_BASE, 0xffff); |
1014 | pci_bus_write_config_word (ibmphp_pci_bus, devfn, PCI_PREF_MEMORY_LIMIT, 0x0000); | 1014 | pci_bus_write_config_word(ibmphp_pci_bus, devfn, PCI_PREF_MEMORY_LIMIT, 0x0000); |
1015 | } | 1015 | } |
1016 | 1016 | ||
1017 | debug ("b4 writing control information\n"); | 1017 | debug("b4 writing control information\n"); |
1018 | 1018 | ||
1019 | pci_bus_read_config_byte (ibmphp_pci_bus, devfn, PCI_INTERRUPT_PIN, &irq); | 1019 | pci_bus_read_config_byte(ibmphp_pci_bus, devfn, PCI_INTERRUPT_PIN, &irq); |
1020 | if ((irq > 0x00) && (irq < 0x05)) | 1020 | if ((irq > 0x00) && (irq < 0x05)) |
1021 | pci_bus_write_config_byte (ibmphp_pci_bus, devfn, PCI_INTERRUPT_LINE, func->irq[irq - 1]); | 1021 | pci_bus_write_config_byte(ibmphp_pci_bus, devfn, PCI_INTERRUPT_LINE, func->irq[irq - 1]); |
1022 | /* | 1022 | /* |
1023 | pci_bus_write_config_byte (ibmphp_pci_bus, devfn, PCI_BRIDGE_CONTROL, ctrl); | 1023 | pci_bus_write_config_byte(ibmphp_pci_bus, devfn, PCI_BRIDGE_CONTROL, ctrl); |
1024 | pci_bus_write_config_byte (ibmphp_pci_bus, devfn, PCI_BRIDGE_CONTROL, PCI_BRIDGE_CTL_PARITY); | 1024 | pci_bus_write_config_byte(ibmphp_pci_bus, devfn, PCI_BRIDGE_CONTROL, PCI_BRIDGE_CTL_PARITY); |
1025 | pci_bus_write_config_byte (ibmphp_pci_bus, devfn, PCI_BRIDGE_CONTROL, PCI_BRIDGE_CTL_SERR); | 1025 | pci_bus_write_config_byte(ibmphp_pci_bus, devfn, PCI_BRIDGE_CONTROL, PCI_BRIDGE_CTL_SERR); |
1026 | */ | 1026 | */ |
1027 | 1027 | ||
1028 | pci_bus_write_config_word (ibmphp_pci_bus, devfn, PCI_COMMAND, DEVICEENABLE); | 1028 | pci_bus_write_config_word(ibmphp_pci_bus, devfn, PCI_COMMAND, DEVICEENABLE); |
1029 | pci_bus_write_config_word (ibmphp_pci_bus, devfn, PCI_BRIDGE_CONTROL, 0x07); | 1029 | pci_bus_write_config_word(ibmphp_pci_bus, devfn, PCI_BRIDGE_CONTROL, 0x07); |
1030 | for (i = 0; i < 32; i++) { | 1030 | for (i = 0; i < 32; i++) { |
1031 | if (amount_needed->devices[i]) { | 1031 | if (amount_needed->devices[i]) { |
1032 | debug ("device where devices[i] is 1 = %x\n", i); | 1032 | debug("device where devices[i] is 1 = %x\n", i); |
1033 | func->devices[i] = 1; | 1033 | func->devices[i] = 1; |
1034 | } | 1034 | } |
1035 | } | 1035 | } |
1036 | func->bus = 1; /* For unconfiguring, to indicate it's PPB */ | 1036 | func->bus = 1; /* For unconfiguring, to indicate it's PPB */ |
1037 | func_passed = &func; | 1037 | func_passed = &func; |
1038 | debug ("func->busno b4 returning is %x\n", func->busno); | 1038 | debug("func->busno b4 returning is %x\n", func->busno); |
1039 | debug ("func->busno b4 returning in the other structure is %x\n", (*func_passed)->busno); | 1039 | debug("func->busno b4 returning in the other structure is %x\n", (*func_passed)->busno); |
1040 | kfree (amount_needed); | 1040 | kfree(amount_needed); |
1041 | return 0; | 1041 | return 0; |
1042 | } else { | 1042 | } else { |
1043 | err ("Configuring bridge was unsuccessful...\n"); | 1043 | err("Configuring bridge was unsuccessful...\n"); |
1044 | mem_tmp = NULL; | 1044 | mem_tmp = NULL; |
1045 | retval = -EIO; | 1045 | retval = -EIO; |
1046 | goto error; | 1046 | goto error; |
@@ -1049,20 +1049,20 @@ static int configure_bridge (struct pci_func **func_passed, u8 slotno) | |||
1049 | error: | 1049 | error: |
1050 | kfree(amount_needed); | 1050 | kfree(amount_needed); |
1051 | if (pfmem) | 1051 | if (pfmem) |
1052 | ibmphp_remove_resource (pfmem); | 1052 | ibmphp_remove_resource(pfmem); |
1053 | if (io) | 1053 | if (io) |
1054 | ibmphp_remove_resource (io); | 1054 | ibmphp_remove_resource(io); |
1055 | if (mem) | 1055 | if (mem) |
1056 | ibmphp_remove_resource (mem); | 1056 | ibmphp_remove_resource(mem); |
1057 | for (i = 0; i < 2; i++) { /* for 2 BARs */ | 1057 | for (i = 0; i < 2; i++) { /* for 2 BARs */ |
1058 | if (bus_io[i]) { | 1058 | if (bus_io[i]) { |
1059 | ibmphp_remove_resource (bus_io[i]); | 1059 | ibmphp_remove_resource(bus_io[i]); |
1060 | func->io[i] = NULL; | 1060 | func->io[i] = NULL; |
1061 | } else if (bus_pfmem[i]) { | 1061 | } else if (bus_pfmem[i]) { |
1062 | ibmphp_remove_resource (bus_pfmem[i]); | 1062 | ibmphp_remove_resource(bus_pfmem[i]); |
1063 | func->pfmem[i] = NULL; | 1063 | func->pfmem[i] = NULL; |
1064 | } else if (bus_mem[i]) { | 1064 | } else if (bus_mem[i]) { |
1065 | ibmphp_remove_resource (bus_mem[i]); | 1065 | ibmphp_remove_resource(bus_mem[i]); |
1066 | func->mem[i] = NULL; | 1066 | func->mem[i] = NULL; |
1067 | } | 1067 | } |
1068 | } | 1068 | } |
@@ -1075,7 +1075,7 @@ error: | |||
1075 | * Input: bridge function | 1075 | * Input: bridge function |
1076 | * Output: amount of resources needed | 1076 | * Output: amount of resources needed |
1077 | *****************************************************************************/ | 1077 | *****************************************************************************/ |
1078 | static struct res_needed *scan_behind_bridge (struct pci_func *func, u8 busno) | 1078 | static struct res_needed *scan_behind_bridge(struct pci_func *func, u8 busno) |
1079 | { | 1079 | { |
1080 | int count, len[6]; | 1080 | int count, len[6]; |
1081 | u16 vendor_id; | 1081 | u16 vendor_id; |
@@ -1102,36 +1102,36 @@ static struct res_needed *scan_behind_bridge (struct pci_func *func, u8 busno) | |||
1102 | 1102 | ||
1103 | ibmphp_pci_bus->number = busno; | 1103 | ibmphp_pci_bus->number = busno; |
1104 | 1104 | ||
1105 | debug ("the bus_no behind the bridge is %x\n", busno); | 1105 | debug("the bus_no behind the bridge is %x\n", busno); |
1106 | debug ("scanning devices behind the bridge...\n"); | 1106 | debug("scanning devices behind the bridge...\n"); |
1107 | for (device = 0; device < 32; device++) { | 1107 | for (device = 0; device < 32; device++) { |
1108 | amount->devices[device] = 0; | 1108 | amount->devices[device] = 0; |
1109 | for (function = 0; function < 8; function++) { | 1109 | for (function = 0; function < 8; function++) { |
1110 | devfn = PCI_DEVFN(device, function); | 1110 | devfn = PCI_DEVFN(device, function); |
1111 | 1111 | ||
1112 | pci_bus_read_config_word (ibmphp_pci_bus, devfn, PCI_VENDOR_ID, &vendor_id); | 1112 | pci_bus_read_config_word(ibmphp_pci_bus, devfn, PCI_VENDOR_ID, &vendor_id); |
1113 | 1113 | ||
1114 | if (vendor_id != PCI_VENDOR_ID_NOTVALID) { | 1114 | if (vendor_id != PCI_VENDOR_ID_NOTVALID) { |
1115 | /* found correct device!!! */ | 1115 | /* found correct device!!! */ |
1116 | howmany++; | 1116 | howmany++; |
1117 | 1117 | ||
1118 | pci_bus_read_config_byte (ibmphp_pci_bus, devfn, PCI_HEADER_TYPE, &hdr_type); | 1118 | pci_bus_read_config_byte(ibmphp_pci_bus, devfn, PCI_HEADER_TYPE, &hdr_type); |
1119 | pci_bus_read_config_dword (ibmphp_pci_bus, devfn, PCI_CLASS_REVISION, &class); | 1119 | pci_bus_read_config_dword(ibmphp_pci_bus, devfn, PCI_CLASS_REVISION, &class); |
1120 | 1120 | ||
1121 | debug ("hdr_type behind the bridge is %x\n", hdr_type); | 1121 | debug("hdr_type behind the bridge is %x\n", hdr_type); |
1122 | if (hdr_type & PCI_HEADER_TYPE_BRIDGE) { | 1122 | if (hdr_type & PCI_HEADER_TYPE_BRIDGE) { |
1123 | err ("embedded bridges not supported for hot-plugging.\n"); | 1123 | err("embedded bridges not supported for hot-plugging.\n"); |
1124 | amount->not_correct = 1; | 1124 | amount->not_correct = 1; |
1125 | return amount; | 1125 | return amount; |
1126 | } | 1126 | } |
1127 | 1127 | ||
1128 | class >>= 8; /* to take revision out, class = class.subclass.prog i/f */ | 1128 | class >>= 8; /* to take revision out, class = class.subclass.prog i/f */ |
1129 | if (class == PCI_CLASS_NOT_DEFINED_VGA) { | 1129 | if (class == PCI_CLASS_NOT_DEFINED_VGA) { |
1130 | err ("The device %x is VGA compatible and as is not supported for hot plugging. Please choose another device.\n", device); | 1130 | err("The device %x is VGA compatible and as is not supported for hot plugging. Please choose another device.\n", device); |
1131 | amount->not_correct = 1; | 1131 | amount->not_correct = 1; |
1132 | return amount; | 1132 | return amount; |
1133 | } else if (class == PCI_CLASS_DISPLAY_VGA) { | 1133 | } else if (class == PCI_CLASS_DISPLAY_VGA) { |
1134 | err ("The device %x is not supported for hot plugging. Please choose another device.\n", device); | 1134 | err("The device %x is not supported for hot plugging. Please choose another device.\n", device); |
1135 | amount->not_correct = 1; | 1135 | amount->not_correct = 1; |
1136 | return amount; | 1136 | return amount; |
1137 | } | 1137 | } |
@@ -1141,23 +1141,23 @@ static struct res_needed *scan_behind_bridge (struct pci_func *func, u8 busno) | |||
1141 | for (count = 0; address[count]; count++) { | 1141 | for (count = 0; address[count]; count++) { |
1142 | /* for 6 BARs */ | 1142 | /* for 6 BARs */ |
1143 | /* | 1143 | /* |
1144 | pci_bus_read_config_byte (ibmphp_pci_bus, devfn, address[count], &tmp); | 1144 | pci_bus_read_config_byte(ibmphp_pci_bus, devfn, address[count], &tmp); |
1145 | if (tmp & 0x01) // IO | 1145 | if (tmp & 0x01) // IO |
1146 | pci_bus_write_config_dword (ibmphp_pci_bus, devfn, address[count], 0xFFFFFFFD); | 1146 | pci_bus_write_config_dword(ibmphp_pci_bus, devfn, address[count], 0xFFFFFFFD); |
1147 | else // MEMORY | 1147 | else // MEMORY |
1148 | pci_bus_write_config_dword (ibmphp_pci_bus, devfn, address[count], 0xFFFFFFFF); | 1148 | pci_bus_write_config_dword(ibmphp_pci_bus, devfn, address[count], 0xFFFFFFFF); |
1149 | */ | 1149 | */ |
1150 | pci_bus_write_config_dword (ibmphp_pci_bus, devfn, address[count], 0xFFFFFFFF); | 1150 | pci_bus_write_config_dword(ibmphp_pci_bus, devfn, address[count], 0xFFFFFFFF); |
1151 | pci_bus_read_config_dword (ibmphp_pci_bus, devfn, address[count], &bar[count]); | 1151 | pci_bus_read_config_dword(ibmphp_pci_bus, devfn, address[count], &bar[count]); |
1152 | 1152 | ||
1153 | debug ("what is bar[count]? %x, count = %d\n", bar[count], count); | 1153 | debug("what is bar[count]? %x, count = %d\n", bar[count], count); |
1154 | 1154 | ||
1155 | if (!bar[count]) /* This BAR is not implemented */ | 1155 | if (!bar[count]) /* This BAR is not implemented */ |
1156 | continue; | 1156 | continue; |
1157 | 1157 | ||
1158 | //tmp_bar = bar[count]; | 1158 | //tmp_bar = bar[count]; |
1159 | 1159 | ||
1160 | debug ("count %d device %x function %x wants %x resources\n", count, device, function, bar[count]); | 1160 | debug("count %d device %x function %x wants %x resources\n", count, device, function, bar[count]); |
1161 | 1161 | ||
1162 | if (bar[count] & PCI_BASE_ADDRESS_SPACE_IO) { | 1162 | if (bar[count] & PCI_BASE_ADDRESS_SPACE_IO) { |
1163 | /* This is IO */ | 1163 | /* This is IO */ |
@@ -1211,7 +1211,7 @@ static struct res_needed *scan_behind_bridge (struct pci_func *func, u8 busno) | |||
1211 | * Change: we also call these functions even if we configured the card ourselves (i.e., not | 1211 | * Change: we also call these functions even if we configured the card ourselves (i.e., not |
1212 | * the bootup case), since it should work same way | 1212 | * the bootup case), since it should work same way |
1213 | */ | 1213 | */ |
1214 | static int unconfigure_boot_device (u8 busno, u8 device, u8 function) | 1214 | static int unconfigure_boot_device(u8 busno, u8 device, u8 function) |
1215 | { | 1215 | { |
1216 | u32 start_address; | 1216 | u32 start_address; |
1217 | u32 address[] = { | 1217 | u32 address[] = { |
@@ -1234,30 +1234,30 @@ static int unconfigure_boot_device (u8 busno, u8 device, u8 function) | |||
1234 | u32 tmp_address; | 1234 | u32 tmp_address; |
1235 | unsigned int devfn; | 1235 | unsigned int devfn; |
1236 | 1236 | ||
1237 | debug ("%s - enter\n", __func__); | 1237 | debug("%s - enter\n", __func__); |
1238 | 1238 | ||
1239 | bus = ibmphp_find_res_bus (busno); | 1239 | bus = ibmphp_find_res_bus(busno); |
1240 | if (!bus) { | 1240 | if (!bus) { |
1241 | debug ("cannot find corresponding bus.\n"); | 1241 | debug("cannot find corresponding bus.\n"); |
1242 | return -EINVAL; | 1242 | return -EINVAL; |
1243 | } | 1243 | } |
1244 | 1244 | ||
1245 | devfn = PCI_DEVFN(device, function); | 1245 | devfn = PCI_DEVFN(device, function); |
1246 | ibmphp_pci_bus->number = busno; | 1246 | ibmphp_pci_bus->number = busno; |
1247 | for (count = 0; address[count]; count++) { /* for 6 BARs */ | 1247 | for (count = 0; address[count]; count++) { /* for 6 BARs */ |
1248 | pci_bus_read_config_dword (ibmphp_pci_bus, devfn, address[count], &start_address); | 1248 | pci_bus_read_config_dword(ibmphp_pci_bus, devfn, address[count], &start_address); |
1249 | 1249 | ||
1250 | /* We can do this here, b/c by that time the device driver of the card has been stopped */ | 1250 | /* We can do this here, b/c by that time the device driver of the card has been stopped */ |
1251 | 1251 | ||
1252 | pci_bus_write_config_dword (ibmphp_pci_bus, devfn, address[count], 0xFFFFFFFF); | 1252 | pci_bus_write_config_dword(ibmphp_pci_bus, devfn, address[count], 0xFFFFFFFF); |
1253 | pci_bus_read_config_dword (ibmphp_pci_bus, devfn, address[count], &size); | 1253 | pci_bus_read_config_dword(ibmphp_pci_bus, devfn, address[count], &size); |
1254 | pci_bus_write_config_dword (ibmphp_pci_bus, devfn, address[count], start_address); | 1254 | pci_bus_write_config_dword(ibmphp_pci_bus, devfn, address[count], start_address); |
1255 | 1255 | ||
1256 | debug ("start_address is %x\n", start_address); | 1256 | debug("start_address is %x\n", start_address); |
1257 | debug ("busno, device, function %x %x %x\n", busno, device, function); | 1257 | debug("busno, device, function %x %x %x\n", busno, device, function); |
1258 | if (!size) { | 1258 | if (!size) { |
1259 | /* This BAR is not implemented */ | 1259 | /* This BAR is not implemented */ |
1260 | debug ("is this bar no implemented?, count = %d\n", count); | 1260 | debug("is this bar no implemented?, count = %d\n", count); |
1261 | continue; | 1261 | continue; |
1262 | } | 1262 | } |
1263 | tmp_address = start_address; | 1263 | tmp_address = start_address; |
@@ -1267,24 +1267,24 @@ static int unconfigure_boot_device (u8 busno, u8 device, u8 function) | |||
1267 | size = size & 0xFFFFFFFC; | 1267 | size = size & 0xFFFFFFFC; |
1268 | size = ~size + 1; | 1268 | size = ~size + 1; |
1269 | end_address = start_address + size - 1; | 1269 | end_address = start_address + size - 1; |
1270 | if (ibmphp_find_resource (bus, start_address, &io, IO) < 0) { | 1270 | if (ibmphp_find_resource(bus, start_address, &io, IO) < 0) { |
1271 | err ("cannot find corresponding IO resource to remove\n"); | 1271 | err("cannot find corresponding IO resource to remove\n"); |
1272 | return -EIO; | 1272 | return -EIO; |
1273 | } | 1273 | } |
1274 | debug ("io->start = %x\n", io->start); | 1274 | debug("io->start = %x\n", io->start); |
1275 | temp_end = io->end; | 1275 | temp_end = io->end; |
1276 | start_address = io->end + 1; | 1276 | start_address = io->end + 1; |
1277 | ibmphp_remove_resource (io); | 1277 | ibmphp_remove_resource(io); |
1278 | /* This is needed b/c of the old I/O restrictions in the BIOS */ | 1278 | /* This is needed b/c of the old I/O restrictions in the BIOS */ |
1279 | while (temp_end < end_address) { | 1279 | while (temp_end < end_address) { |
1280 | if (ibmphp_find_resource (bus, start_address, &io, IO) < 0) { | 1280 | if (ibmphp_find_resource(bus, start_address, &io, IO) < 0) { |
1281 | err ("cannot find corresponding IO resource to remove\n"); | 1281 | err("cannot find corresponding IO resource to remove\n"); |
1282 | return -EIO; | 1282 | return -EIO; |
1283 | } | 1283 | } |
1284 | debug ("io->start = %x\n", io->start); | 1284 | debug("io->start = %x\n", io->start); |
1285 | temp_end = io->end; | 1285 | temp_end = io->end; |
1286 | start_address = io->end + 1; | 1286 | start_address = io->end + 1; |
1287 | ibmphp_remove_resource (io); | 1287 | ibmphp_remove_resource(io); |
1288 | } | 1288 | } |
1289 | 1289 | ||
1290 | /* ????????? DO WE NEED TO WRITE ANYTHING INTO THE PCI CONFIG SPACE BACK ?????????? */ | 1290 | /* ????????? DO WE NEED TO WRITE ANYTHING INTO THE PCI CONFIG SPACE BACK ?????????? */ |
@@ -1292,29 +1292,29 @@ static int unconfigure_boot_device (u8 busno, u8 device, u8 function) | |||
1292 | /* This is Memory */ | 1292 | /* This is Memory */ |
1293 | if (start_address & PCI_BASE_ADDRESS_MEM_PREFETCH) { | 1293 | if (start_address & PCI_BASE_ADDRESS_MEM_PREFETCH) { |
1294 | /* pfmem */ | 1294 | /* pfmem */ |
1295 | debug ("start address of pfmem is %x\n", start_address); | 1295 | debug("start address of pfmem is %x\n", start_address); |
1296 | start_address &= PCI_BASE_ADDRESS_MEM_MASK; | 1296 | start_address &= PCI_BASE_ADDRESS_MEM_MASK; |
1297 | 1297 | ||
1298 | if (ibmphp_find_resource (bus, start_address, &pfmem, PFMEM) < 0) { | 1298 | if (ibmphp_find_resource(bus, start_address, &pfmem, PFMEM) < 0) { |
1299 | err ("cannot find corresponding PFMEM resource to remove\n"); | 1299 | err("cannot find corresponding PFMEM resource to remove\n"); |
1300 | return -EIO; | 1300 | return -EIO; |
1301 | } | 1301 | } |
1302 | if (pfmem) { | 1302 | if (pfmem) { |
1303 | debug ("pfmem->start = %x\n", pfmem->start); | 1303 | debug("pfmem->start = %x\n", pfmem->start); |
1304 | 1304 | ||
1305 | ibmphp_remove_resource(pfmem); | 1305 | ibmphp_remove_resource(pfmem); |
1306 | } | 1306 | } |
1307 | } else { | 1307 | } else { |
1308 | /* regular memory */ | 1308 | /* regular memory */ |
1309 | debug ("start address of mem is %x\n", start_address); | 1309 | debug("start address of mem is %x\n", start_address); |
1310 | start_address &= PCI_BASE_ADDRESS_MEM_MASK; | 1310 | start_address &= PCI_BASE_ADDRESS_MEM_MASK; |
1311 | 1311 | ||
1312 | if (ibmphp_find_resource (bus, start_address, &mem, MEM) < 0) { | 1312 | if (ibmphp_find_resource(bus, start_address, &mem, MEM) < 0) { |
1313 | err ("cannot find corresponding MEM resource to remove\n"); | 1313 | err("cannot find corresponding MEM resource to remove\n"); |
1314 | return -EIO; | 1314 | return -EIO; |
1315 | } | 1315 | } |
1316 | if (mem) { | 1316 | if (mem) { |
1317 | debug ("mem->start = %x\n", mem->start); | 1317 | debug("mem->start = %x\n", mem->start); |
1318 | 1318 | ||
1319 | ibmphp_remove_resource(mem); | 1319 | ibmphp_remove_resource(mem); |
1320 | } | 1320 | } |
@@ -1329,7 +1329,7 @@ static int unconfigure_boot_device (u8 busno, u8 device, u8 function) | |||
1329 | return 0; | 1329 | return 0; |
1330 | } | 1330 | } |
1331 | 1331 | ||
1332 | static int unconfigure_boot_bridge (u8 busno, u8 device, u8 function) | 1332 | static int unconfigure_boot_bridge(u8 busno, u8 device, u8 function) |
1333 | { | 1333 | { |
1334 | int count; | 1334 | int count; |
1335 | int bus_no, pri_no, sub_no, sec_no = 0; | 1335 | int bus_no, pri_no, sub_no, sec_no = 0; |
@@ -1349,40 +1349,40 @@ static int unconfigure_boot_bridge (u8 busno, u8 device, u8 function) | |||
1349 | devfn = PCI_DEVFN(device, function); | 1349 | devfn = PCI_DEVFN(device, function); |
1350 | ibmphp_pci_bus->number = busno; | 1350 | ibmphp_pci_bus->number = busno; |
1351 | bus_no = (int) busno; | 1351 | bus_no = (int) busno; |
1352 | debug ("busno is %x\n", busno); | 1352 | debug("busno is %x\n", busno); |
1353 | pci_bus_read_config_byte (ibmphp_pci_bus, devfn, PCI_PRIMARY_BUS, &pri_number); | 1353 | pci_bus_read_config_byte(ibmphp_pci_bus, devfn, PCI_PRIMARY_BUS, &pri_number); |
1354 | debug ("%s - busno = %x, primary_number = %x\n", __func__, busno, pri_number); | 1354 | debug("%s - busno = %x, primary_number = %x\n", __func__, busno, pri_number); |
1355 | 1355 | ||
1356 | pci_bus_read_config_byte (ibmphp_pci_bus, devfn, PCI_SECONDARY_BUS, &sec_number); | 1356 | pci_bus_read_config_byte(ibmphp_pci_bus, devfn, PCI_SECONDARY_BUS, &sec_number); |
1357 | debug ("sec_number is %x\n", sec_number); | 1357 | debug("sec_number is %x\n", sec_number); |
1358 | sec_no = (int) sec_number; | 1358 | sec_no = (int) sec_number; |
1359 | pri_no = (int) pri_number; | 1359 | pri_no = (int) pri_number; |
1360 | if (pri_no != bus_no) { | 1360 | if (pri_no != bus_no) { |
1361 | err ("primary numbers in our structures and pci config space don't match.\n"); | 1361 | err("primary numbers in our structures and pci config space don't match.\n"); |
1362 | return -EINVAL; | 1362 | return -EINVAL; |
1363 | } | 1363 | } |
1364 | 1364 | ||
1365 | pci_bus_read_config_byte (ibmphp_pci_bus, devfn, PCI_SUBORDINATE_BUS, &sub_number); | 1365 | pci_bus_read_config_byte(ibmphp_pci_bus, devfn, PCI_SUBORDINATE_BUS, &sub_number); |
1366 | sub_no = (int) sub_number; | 1366 | sub_no = (int) sub_number; |
1367 | debug ("sub_no is %d, sec_no is %d\n", sub_no, sec_no); | 1367 | debug("sub_no is %d, sec_no is %d\n", sub_no, sec_no); |
1368 | if (sec_no != sub_number) { | 1368 | if (sec_no != sub_number) { |
1369 | err ("there're more buses behind this bridge. Hot removal is not supported. Please choose another card\n"); | 1369 | err("there're more buses behind this bridge. Hot removal is not supported. Please choose another card\n"); |
1370 | return -ENODEV; | 1370 | return -ENODEV; |
1371 | } | 1371 | } |
1372 | 1372 | ||
1373 | bus = ibmphp_find_res_bus (sec_number); | 1373 | bus = ibmphp_find_res_bus(sec_number); |
1374 | if (!bus) { | 1374 | if (!bus) { |
1375 | err ("cannot find Bus structure for the bridged device\n"); | 1375 | err("cannot find Bus structure for the bridged device\n"); |
1376 | return -EINVAL; | 1376 | return -EINVAL; |
1377 | } | 1377 | } |
1378 | debug("bus->busno is %x\n", bus->busno); | 1378 | debug("bus->busno is %x\n", bus->busno); |
1379 | debug("sec_number is %x\n", sec_number); | 1379 | debug("sec_number is %x\n", sec_number); |
1380 | 1380 | ||
1381 | ibmphp_remove_bus (bus, busno); | 1381 | ibmphp_remove_bus(bus, busno); |
1382 | 1382 | ||
1383 | for (count = 0; address[count]; count++) { | 1383 | for (count = 0; address[count]; count++) { |
1384 | /* for 2 BARs */ | 1384 | /* for 2 BARs */ |
1385 | pci_bus_read_config_dword (ibmphp_pci_bus, devfn, address[count], &start_address); | 1385 | pci_bus_read_config_dword(ibmphp_pci_bus, devfn, address[count], &start_address); |
1386 | 1386 | ||
1387 | if (!start_address) { | 1387 | if (!start_address) { |
1388 | /* This BAR is not implemented */ | 1388 | /* This BAR is not implemented */ |
@@ -1394,14 +1394,14 @@ static int unconfigure_boot_bridge (u8 busno, u8 device, u8 function) | |||
1394 | if (start_address & PCI_BASE_ADDRESS_SPACE_IO) { | 1394 | if (start_address & PCI_BASE_ADDRESS_SPACE_IO) { |
1395 | /* This is IO */ | 1395 | /* This is IO */ |
1396 | start_address &= PCI_BASE_ADDRESS_IO_MASK; | 1396 | start_address &= PCI_BASE_ADDRESS_IO_MASK; |
1397 | if (ibmphp_find_resource (bus, start_address, &io, IO) < 0) { | 1397 | if (ibmphp_find_resource(bus, start_address, &io, IO) < 0) { |
1398 | err ("cannot find corresponding IO resource to remove\n"); | 1398 | err("cannot find corresponding IO resource to remove\n"); |
1399 | return -EIO; | 1399 | return -EIO; |
1400 | } | 1400 | } |
1401 | if (io) | 1401 | if (io) |
1402 | debug ("io->start = %x\n", io->start); | 1402 | debug("io->start = %x\n", io->start); |
1403 | 1403 | ||
1404 | ibmphp_remove_resource (io); | 1404 | ibmphp_remove_resource(io); |
1405 | 1405 | ||
1406 | /* ????????? DO WE NEED TO WRITE ANYTHING INTO THE PCI CONFIG SPACE BACK ?????????? */ | 1406 | /* ????????? DO WE NEED TO WRITE ANYTHING INTO THE PCI CONFIG SPACE BACK ?????????? */ |
1407 | } else { | 1407 | } else { |
@@ -1409,24 +1409,24 @@ static int unconfigure_boot_bridge (u8 busno, u8 device, u8 function) | |||
1409 | if (start_address & PCI_BASE_ADDRESS_MEM_PREFETCH) { | 1409 | if (start_address & PCI_BASE_ADDRESS_MEM_PREFETCH) { |
1410 | /* pfmem */ | 1410 | /* pfmem */ |
1411 | start_address &= PCI_BASE_ADDRESS_MEM_MASK; | 1411 | start_address &= PCI_BASE_ADDRESS_MEM_MASK; |
1412 | if (ibmphp_find_resource (bus, start_address, &pfmem, PFMEM) < 0) { | 1412 | if (ibmphp_find_resource(bus, start_address, &pfmem, PFMEM) < 0) { |
1413 | err ("cannot find corresponding PFMEM resource to remove\n"); | 1413 | err("cannot find corresponding PFMEM resource to remove\n"); |
1414 | return -EINVAL; | 1414 | return -EINVAL; |
1415 | } | 1415 | } |
1416 | if (pfmem) { | 1416 | if (pfmem) { |
1417 | debug ("pfmem->start = %x\n", pfmem->start); | 1417 | debug("pfmem->start = %x\n", pfmem->start); |
1418 | 1418 | ||
1419 | ibmphp_remove_resource(pfmem); | 1419 | ibmphp_remove_resource(pfmem); |
1420 | } | 1420 | } |
1421 | } else { | 1421 | } else { |
1422 | /* regular memory */ | 1422 | /* regular memory */ |
1423 | start_address &= PCI_BASE_ADDRESS_MEM_MASK; | 1423 | start_address &= PCI_BASE_ADDRESS_MEM_MASK; |
1424 | if (ibmphp_find_resource (bus, start_address, &mem, MEM) < 0) { | 1424 | if (ibmphp_find_resource(bus, start_address, &mem, MEM) < 0) { |
1425 | err ("cannot find corresponding MEM resource to remove\n"); | 1425 | err("cannot find corresponding MEM resource to remove\n"); |
1426 | return -EINVAL; | 1426 | return -EINVAL; |
1427 | } | 1427 | } |
1428 | if (mem) { | 1428 | if (mem) { |
1429 | debug ("mem->start = %x\n", mem->start); | 1429 | debug("mem->start = %x\n", mem->start); |
1430 | 1430 | ||
1431 | ibmphp_remove_resource(mem); | 1431 | ibmphp_remove_resource(mem); |
1432 | } | 1432 | } |
@@ -1437,11 +1437,11 @@ static int unconfigure_boot_bridge (u8 busno, u8 device, u8 function) | |||
1437 | } | 1437 | } |
1438 | } /* end of mem */ | 1438 | } /* end of mem */ |
1439 | } /* end of for */ | 1439 | } /* end of for */ |
1440 | debug ("%s - exiting, returning success\n", __func__); | 1440 | debug("%s - exiting, returning success\n", __func__); |
1441 | return 0; | 1441 | return 0; |
1442 | } | 1442 | } |
1443 | 1443 | ||
1444 | static int unconfigure_boot_card (struct slot *slot_cur) | 1444 | static int unconfigure_boot_card(struct slot *slot_cur) |
1445 | { | 1445 | { |
1446 | u16 vendor_id; | 1446 | u16 vendor_id; |
1447 | u32 class; | 1447 | u32 class; |
@@ -1453,57 +1453,57 @@ static int unconfigure_boot_card (struct slot *slot_cur) | |||
1453 | unsigned int devfn; | 1453 | unsigned int devfn; |
1454 | u8 valid_device = 0x00; /* To see if we are ever able to find valid device and read it */ | 1454 | u8 valid_device = 0x00; /* To see if we are ever able to find valid device and read it */ |
1455 | 1455 | ||
1456 | debug ("%s - enter\n", __func__); | 1456 | debug("%s - enter\n", __func__); |
1457 | 1457 | ||
1458 | device = slot_cur->device; | 1458 | device = slot_cur->device; |
1459 | busno = slot_cur->bus; | 1459 | busno = slot_cur->bus; |
1460 | 1460 | ||
1461 | debug ("b4 for loop, device is %x\n", device); | 1461 | debug("b4 for loop, device is %x\n", device); |
1462 | /* For every function on the card */ | 1462 | /* For every function on the card */ |
1463 | for (function = 0x0; function < 0x08; function++) { | 1463 | for (function = 0x0; function < 0x08; function++) { |
1464 | devfn = PCI_DEVFN(device, function); | 1464 | devfn = PCI_DEVFN(device, function); |
1465 | ibmphp_pci_bus->number = busno; | 1465 | ibmphp_pci_bus->number = busno; |
1466 | 1466 | ||
1467 | pci_bus_read_config_word (ibmphp_pci_bus, devfn, PCI_VENDOR_ID, &vendor_id); | 1467 | pci_bus_read_config_word(ibmphp_pci_bus, devfn, PCI_VENDOR_ID, &vendor_id); |
1468 | 1468 | ||
1469 | if (vendor_id != PCI_VENDOR_ID_NOTVALID) { | 1469 | if (vendor_id != PCI_VENDOR_ID_NOTVALID) { |
1470 | /* found correct device!!! */ | 1470 | /* found correct device!!! */ |
1471 | ++valid_device; | 1471 | ++valid_device; |
1472 | 1472 | ||
1473 | debug ("%s - found correct device\n", __func__); | 1473 | debug("%s - found correct device\n", __func__); |
1474 | 1474 | ||
1475 | /* header: x x x x x x x x | 1475 | /* header: x x x x x x x x |
1476 | * | |___________|=> 1=PPB bridge, 0=normal device, 2=CardBus Bridge | 1476 | * | |___________|=> 1=PPB bridge, 0=normal device, 2=CardBus Bridge |
1477 | * |_=> 0 = single function device, 1 = multi-function device | 1477 | * |_=> 0 = single function device, 1 = multi-function device |
1478 | */ | 1478 | */ |
1479 | 1479 | ||
1480 | pci_bus_read_config_byte (ibmphp_pci_bus, devfn, PCI_HEADER_TYPE, &hdr_type); | 1480 | pci_bus_read_config_byte(ibmphp_pci_bus, devfn, PCI_HEADER_TYPE, &hdr_type); |
1481 | pci_bus_read_config_dword (ibmphp_pci_bus, devfn, PCI_CLASS_REVISION, &class); | 1481 | pci_bus_read_config_dword(ibmphp_pci_bus, devfn, PCI_CLASS_REVISION, &class); |
1482 | 1482 | ||
1483 | debug ("hdr_type %x, class %x\n", hdr_type, class); | 1483 | debug("hdr_type %x, class %x\n", hdr_type, class); |
1484 | class >>= 8; /* to take revision out, class = class.subclass.prog i/f */ | 1484 | class >>= 8; /* to take revision out, class = class.subclass.prog i/f */ |
1485 | if (class == PCI_CLASS_NOT_DEFINED_VGA) { | 1485 | if (class == PCI_CLASS_NOT_DEFINED_VGA) { |
1486 | err ("The device %x function %x is VGA compatible and is not supported for hot removing. Please choose another device.\n", device, function); | 1486 | err("The device %x function %x is VGA compatible and is not supported for hot removing. Please choose another device.\n", device, function); |
1487 | return -ENODEV; | 1487 | return -ENODEV; |
1488 | } else if (class == PCI_CLASS_DISPLAY_VGA) { | 1488 | } else if (class == PCI_CLASS_DISPLAY_VGA) { |
1489 | err ("The device %x function %x is not supported for hot removing. Please choose another device.\n", device, function); | 1489 | err("The device %x function %x is not supported for hot removing. Please choose another device.\n", device, function); |
1490 | return -ENODEV; | 1490 | return -ENODEV; |
1491 | } | 1491 | } |
1492 | 1492 | ||
1493 | switch (hdr_type) { | 1493 | switch (hdr_type) { |
1494 | case PCI_HEADER_TYPE_NORMAL: | 1494 | case PCI_HEADER_TYPE_NORMAL: |
1495 | rc = unconfigure_boot_device (busno, device, function); | 1495 | rc = unconfigure_boot_device(busno, device, function); |
1496 | if (rc) { | 1496 | if (rc) { |
1497 | err ("was not able to unconfigure device %x func %x on bus %x. bailing out...\n", | 1497 | err("was not able to unconfigure device %x func %x on bus %x. bailing out...\n", |
1498 | device, function, busno); | 1498 | device, function, busno); |
1499 | return rc; | 1499 | return rc; |
1500 | } | 1500 | } |
1501 | function = 0x8; | 1501 | function = 0x8; |
1502 | break; | 1502 | break; |
1503 | case PCI_HEADER_TYPE_MULTIDEVICE: | 1503 | case PCI_HEADER_TYPE_MULTIDEVICE: |
1504 | rc = unconfigure_boot_device (busno, device, function); | 1504 | rc = unconfigure_boot_device(busno, device, function); |
1505 | if (rc) { | 1505 | if (rc) { |
1506 | err ("was not able to unconfigure device %x func %x on bus %x. bailing out...\n", | 1506 | err("was not able to unconfigure device %x func %x on bus %x. bailing out...\n", |
1507 | device, function, busno); | 1507 | device, function, busno); |
1508 | return rc; | 1508 | return rc; |
1509 | } | 1509 | } |
@@ -1511,12 +1511,12 @@ static int unconfigure_boot_card (struct slot *slot_cur) | |||
1511 | case PCI_HEADER_TYPE_BRIDGE: | 1511 | case PCI_HEADER_TYPE_BRIDGE: |
1512 | class >>= 8; | 1512 | class >>= 8; |
1513 | if (class != PCI_CLASS_BRIDGE_PCI) { | 1513 | if (class != PCI_CLASS_BRIDGE_PCI) { |
1514 | err ("This device %x function %x is not PCI-to-PCI bridge, and is not supported for hot-removing. Please try another card.\n", device, function); | 1514 | err("This device %x function %x is not PCI-to-PCI bridge, and is not supported for hot-removing. Please try another card.\n", device, function); |
1515 | return -ENODEV; | 1515 | return -ENODEV; |
1516 | } | 1516 | } |
1517 | rc = unconfigure_boot_bridge (busno, device, function); | 1517 | rc = unconfigure_boot_bridge(busno, device, function); |
1518 | if (rc != 0) { | 1518 | if (rc != 0) { |
1519 | err ("was not able to hot-remove PPB properly.\n"); | 1519 | err("was not able to hot-remove PPB properly.\n"); |
1520 | return rc; | 1520 | return rc; |
1521 | } | 1521 | } |
1522 | 1522 | ||
@@ -1525,17 +1525,17 @@ static int unconfigure_boot_card (struct slot *slot_cur) | |||
1525 | case PCI_HEADER_TYPE_MULTIBRIDGE: | 1525 | case PCI_HEADER_TYPE_MULTIBRIDGE: |
1526 | class >>= 8; | 1526 | class >>= 8; |
1527 | if (class != PCI_CLASS_BRIDGE_PCI) { | 1527 | if (class != PCI_CLASS_BRIDGE_PCI) { |
1528 | err ("This device %x function %x is not PCI-to-PCI bridge, and is not supported for hot-removing. Please try another card.\n", device, function); | 1528 | err("This device %x function %x is not PCI-to-PCI bridge, and is not supported for hot-removing. Please try another card.\n", device, function); |
1529 | return -ENODEV; | 1529 | return -ENODEV; |
1530 | } | 1530 | } |
1531 | rc = unconfigure_boot_bridge (busno, device, function); | 1531 | rc = unconfigure_boot_bridge(busno, device, function); |
1532 | if (rc != 0) { | 1532 | if (rc != 0) { |
1533 | err ("was not able to hot-remove PPB properly.\n"); | 1533 | err("was not able to hot-remove PPB properly.\n"); |
1534 | return rc; | 1534 | return rc; |
1535 | } | 1535 | } |
1536 | break; | 1536 | break; |
1537 | default: | 1537 | default: |
1538 | err ("MAJOR PROBLEM!!!! Cannot read device's header\n"); | 1538 | err("MAJOR PROBLEM!!!! Cannot read device's header\n"); |
1539 | return -1; | 1539 | return -1; |
1540 | break; | 1540 | break; |
1541 | } /* end of switch */ | 1541 | } /* end of switch */ |
@@ -1543,7 +1543,7 @@ static int unconfigure_boot_card (struct slot *slot_cur) | |||
1543 | } /* end of for */ | 1543 | } /* end of for */ |
1544 | 1544 | ||
1545 | if (!valid_device) { | 1545 | if (!valid_device) { |
1546 | err ("Could not find device to unconfigure. Or could not read the card.\n"); | 1546 | err("Could not find device to unconfigure. Or could not read the card.\n"); |
1547 | return -1; | 1547 | return -1; |
1548 | } | 1548 | } |
1549 | return 0; | 1549 | return 0; |
@@ -1558,7 +1558,7 @@ static int unconfigure_boot_card (struct slot *slot_cur) | |||
1558 | * !!!!!!!!!!!!!!!!!!!!!!!!!FOR BUSES!!!!!!!!!!!! | 1558 | * !!!!!!!!!!!!!!!!!!!!!!!!!FOR BUSES!!!!!!!!!!!! |
1559 | * Returns: 0, -1, -ENODEV | 1559 | * Returns: 0, -1, -ENODEV |
1560 | */ | 1560 | */ |
1561 | int ibmphp_unconfigure_card (struct slot **slot_cur, int the_end) | 1561 | int ibmphp_unconfigure_card(struct slot **slot_cur, int the_end) |
1562 | { | 1562 | { |
1563 | int i; | 1563 | int i; |
1564 | int count; | 1564 | int count; |
@@ -1567,11 +1567,11 @@ int ibmphp_unconfigure_card (struct slot **slot_cur, int the_end) | |||
1567 | struct pci_func *cur_func = NULL; | 1567 | struct pci_func *cur_func = NULL; |
1568 | struct pci_func *temp_func; | 1568 | struct pci_func *temp_func; |
1569 | 1569 | ||
1570 | debug ("%s - enter\n", __func__); | 1570 | debug("%s - enter\n", __func__); |
1571 | 1571 | ||
1572 | if (!the_end) { | 1572 | if (!the_end) { |
1573 | /* Need to unconfigure the card */ | 1573 | /* Need to unconfigure the card */ |
1574 | rc = unconfigure_boot_card (sl); | 1574 | rc = unconfigure_boot_card(sl); |
1575 | if ((rc == -ENODEV) || (rc == -EIO) || (rc == -EINVAL)) { | 1575 | if ((rc == -ENODEV) || (rc == -EIO) || (rc == -EINVAL)) { |
1576 | /* In all other cases, will still need to get rid of func structure if it exists */ | 1576 | /* In all other cases, will still need to get rid of func structure if it exists */ |
1577 | return rc; | 1577 | return rc; |
@@ -1591,34 +1591,34 @@ int ibmphp_unconfigure_card (struct slot **slot_cur, int the_end) | |||
1591 | 1591 | ||
1592 | for (i = 0; i < count; i++) { | 1592 | for (i = 0; i < count; i++) { |
1593 | if (cur_func->io[i]) { | 1593 | if (cur_func->io[i]) { |
1594 | debug ("io[%d] exists\n", i); | 1594 | debug("io[%d] exists\n", i); |
1595 | if (the_end > 0) | 1595 | if (the_end > 0) |
1596 | ibmphp_remove_resource (cur_func->io[i]); | 1596 | ibmphp_remove_resource(cur_func->io[i]); |
1597 | cur_func->io[i] = NULL; | 1597 | cur_func->io[i] = NULL; |
1598 | } | 1598 | } |
1599 | if (cur_func->mem[i]) { | 1599 | if (cur_func->mem[i]) { |
1600 | debug ("mem[%d] exists\n", i); | 1600 | debug("mem[%d] exists\n", i); |
1601 | if (the_end > 0) | 1601 | if (the_end > 0) |
1602 | ibmphp_remove_resource (cur_func->mem[i]); | 1602 | ibmphp_remove_resource(cur_func->mem[i]); |
1603 | cur_func->mem[i] = NULL; | 1603 | cur_func->mem[i] = NULL; |
1604 | } | 1604 | } |
1605 | if (cur_func->pfmem[i]) { | 1605 | if (cur_func->pfmem[i]) { |
1606 | debug ("pfmem[%d] exists\n", i); | 1606 | debug("pfmem[%d] exists\n", i); |
1607 | if (the_end > 0) | 1607 | if (the_end > 0) |
1608 | ibmphp_remove_resource (cur_func->pfmem[i]); | 1608 | ibmphp_remove_resource(cur_func->pfmem[i]); |
1609 | cur_func->pfmem[i] = NULL; | 1609 | cur_func->pfmem[i] = NULL; |
1610 | } | 1610 | } |
1611 | } | 1611 | } |
1612 | 1612 | ||
1613 | temp_func = cur_func->next; | 1613 | temp_func = cur_func->next; |
1614 | kfree (cur_func); | 1614 | kfree(cur_func); |
1615 | cur_func = temp_func; | 1615 | cur_func = temp_func; |
1616 | } | 1616 | } |
1617 | } | 1617 | } |
1618 | 1618 | ||
1619 | sl->func = NULL; | 1619 | sl->func = NULL; |
1620 | *slot_cur = sl; | 1620 | *slot_cur = sl; |
1621 | debug ("%s - exit\n", __func__); | 1621 | debug("%s - exit\n", __func__); |
1622 | return 0; | 1622 | return 0; |
1623 | } | 1623 | } |
1624 | 1624 | ||
@@ -1630,7 +1630,7 @@ int ibmphp_unconfigure_card (struct slot **slot_cur, int the_end) | |||
1630 | * Output: bus added to the correct spot | 1630 | * Output: bus added to the correct spot |
1631 | * 0, -1, error | 1631 | * 0, -1, error |
1632 | */ | 1632 | */ |
1633 | static int add_new_bus (struct bus_node *bus, struct resource_node *io, struct resource_node *mem, struct resource_node *pfmem, u8 parent_busno) | 1633 | static int add_new_bus(struct bus_node *bus, struct resource_node *io, struct resource_node *mem, struct resource_node *pfmem, u8 parent_busno) |
1634 | { | 1634 | { |
1635 | struct range_node *io_range = NULL; | 1635 | struct range_node *io_range = NULL; |
1636 | struct range_node *mem_range = NULL; | 1636 | struct range_node *mem_range = NULL; |
@@ -1639,18 +1639,18 @@ static int add_new_bus (struct bus_node *bus, struct resource_node *io, struct r | |||
1639 | 1639 | ||
1640 | /* Trying to find the parent bus number */ | 1640 | /* Trying to find the parent bus number */ |
1641 | if (parent_busno != 0xFF) { | 1641 | if (parent_busno != 0xFF) { |
1642 | cur_bus = ibmphp_find_res_bus (parent_busno); | 1642 | cur_bus = ibmphp_find_res_bus(parent_busno); |
1643 | if (!cur_bus) { | 1643 | if (!cur_bus) { |
1644 | err ("strange, cannot find bus which is supposed to be at the system... something is terribly wrong...\n"); | 1644 | err("strange, cannot find bus which is supposed to be at the system... something is terribly wrong...\n"); |
1645 | return -ENODEV; | 1645 | return -ENODEV; |
1646 | } | 1646 | } |
1647 | 1647 | ||
1648 | list_add (&bus->bus_list, &cur_bus->bus_list); | 1648 | list_add(&bus->bus_list, &cur_bus->bus_list); |
1649 | } | 1649 | } |
1650 | if (io) { | 1650 | if (io) { |
1651 | io_range = kzalloc(sizeof(*io_range), GFP_KERNEL); | 1651 | io_range = kzalloc(sizeof(*io_range), GFP_KERNEL); |
1652 | if (!io_range) { | 1652 | if (!io_range) { |
1653 | err ("out of system memory\n"); | 1653 | err("out of system memory\n"); |
1654 | return -ENOMEM; | 1654 | return -ENOMEM; |
1655 | } | 1655 | } |
1656 | io_range->start = io->start; | 1656 | io_range->start = io->start; |
@@ -1662,7 +1662,7 @@ static int add_new_bus (struct bus_node *bus, struct resource_node *io, struct r | |||
1662 | if (mem) { | 1662 | if (mem) { |
1663 | mem_range = kzalloc(sizeof(*mem_range), GFP_KERNEL); | 1663 | mem_range = kzalloc(sizeof(*mem_range), GFP_KERNEL); |
1664 | if (!mem_range) { | 1664 | if (!mem_range) { |
1665 | err ("out of system memory\n"); | 1665 | err("out of system memory\n"); |
1666 | return -ENOMEM; | 1666 | return -ENOMEM; |
1667 | } | 1667 | } |
1668 | mem_range->start = mem->start; | 1668 | mem_range->start = mem->start; |
@@ -1674,7 +1674,7 @@ static int add_new_bus (struct bus_node *bus, struct resource_node *io, struct r | |||
1674 | if (pfmem) { | 1674 | if (pfmem) { |
1675 | pfmem_range = kzalloc(sizeof(*pfmem_range), GFP_KERNEL); | 1675 | pfmem_range = kzalloc(sizeof(*pfmem_range), GFP_KERNEL); |
1676 | if (!pfmem_range) { | 1676 | if (!pfmem_range) { |
1677 | err ("out of system memory\n"); | 1677 | err("out of system memory\n"); |
1678 | return -ENOMEM; | 1678 | return -ENOMEM; |
1679 | } | 1679 | } |
1680 | pfmem_range->start = pfmem->start; | 1680 | pfmem_range->start = pfmem->start; |
@@ -1691,27 +1691,27 @@ static int add_new_bus (struct bus_node *bus, struct resource_node *io, struct r | |||
1691 | * Parameters: bus_number of the primary bus | 1691 | * Parameters: bus_number of the primary bus |
1692 | * Returns: bus_number of the secondary bus or 0xff in case of failure | 1692 | * Returns: bus_number of the secondary bus or 0xff in case of failure |
1693 | */ | 1693 | */ |
1694 | static u8 find_sec_number (u8 primary_busno, u8 slotno) | 1694 | static u8 find_sec_number(u8 primary_busno, u8 slotno) |
1695 | { | 1695 | { |
1696 | int min, max; | 1696 | int min, max; |
1697 | u8 busno; | 1697 | u8 busno; |
1698 | struct bus_info *bus; | 1698 | struct bus_info *bus; |
1699 | struct bus_node *bus_cur; | 1699 | struct bus_node *bus_cur; |
1700 | 1700 | ||
1701 | bus = ibmphp_find_same_bus_num (primary_busno); | 1701 | bus = ibmphp_find_same_bus_num(primary_busno); |
1702 | if (!bus) { | 1702 | if (!bus) { |
1703 | err ("cannot get slot range of the bus from the BIOS\n"); | 1703 | err("cannot get slot range of the bus from the BIOS\n"); |
1704 | return 0xff; | 1704 | return 0xff; |
1705 | } | 1705 | } |
1706 | max = bus->slot_max; | 1706 | max = bus->slot_max; |
1707 | min = bus->slot_min; | 1707 | min = bus->slot_min; |
1708 | if ((slotno > max) || (slotno < min)) { | 1708 | if ((slotno > max) || (slotno < min)) { |
1709 | err ("got the wrong range\n"); | 1709 | err("got the wrong range\n"); |
1710 | return 0xff; | 1710 | return 0xff; |
1711 | } | 1711 | } |
1712 | busno = (u8) (slotno - (u8) min); | 1712 | busno = (u8) (slotno - (u8) min); |
1713 | busno += primary_busno + 0x01; | 1713 | busno += primary_busno + 0x01; |
1714 | bus_cur = ibmphp_find_res_bus (busno); | 1714 | bus_cur = ibmphp_find_res_bus(busno); |
1715 | /* either there is no such bus number, or there are no ranges, which | 1715 | /* either there is no such bus number, or there are no ranges, which |
1716 | * can only happen if we removed the bridged device in previous load | 1716 | * can only happen if we removed the bridged device in previous load |
1717 | * of the driver, and now only have the skeleton bus struct | 1717 | * of the driver, and now only have the skeleton bus struct |
diff --git a/drivers/pci/hotplug/ibmphp_res.c b/drivers/pci/hotplug/ibmphp_res.c index f279060cf6e2..56fd48fe1c31 100644 --- a/drivers/pci/hotplug/ibmphp_res.c +++ b/drivers/pci/hotplug/ibmphp_res.c | |||
@@ -36,28 +36,28 @@ | |||
36 | 36 | ||
37 | static int flags = 0; /* for testing */ | 37 | static int flags = 0; /* for testing */ |
38 | 38 | ||
39 | static void update_resources (struct bus_node *bus_cur, int type, int rangeno); | 39 | static void update_resources(struct bus_node *bus_cur, int type, int rangeno); |
40 | static int once_over (void); | 40 | static int once_over(void); |
41 | static int remove_ranges (struct bus_node *, struct bus_node *); | 41 | static int remove_ranges(struct bus_node *, struct bus_node *); |
42 | static int update_bridge_ranges (struct bus_node **); | 42 | static int update_bridge_ranges(struct bus_node **); |
43 | static int add_bus_range (int type, struct range_node *, struct bus_node *); | 43 | static int add_bus_range(int type, struct range_node *, struct bus_node *); |
44 | static void fix_resources (struct bus_node *); | 44 | static void fix_resources(struct bus_node *); |
45 | static struct bus_node *find_bus_wprev (u8, struct bus_node **, u8); | 45 | static struct bus_node *find_bus_wprev(u8, struct bus_node **, u8); |
46 | 46 | ||
47 | static LIST_HEAD(gbuses); | 47 | static LIST_HEAD(gbuses); |
48 | 48 | ||
49 | static struct bus_node * __init alloc_error_bus (struct ebda_pci_rsrc *curr, u8 busno, int flag) | 49 | static struct bus_node * __init alloc_error_bus(struct ebda_pci_rsrc *curr, u8 busno, int flag) |
50 | { | 50 | { |
51 | struct bus_node *newbus; | 51 | struct bus_node *newbus; |
52 | 52 | ||
53 | if (!(curr) && !(flag)) { | 53 | if (!(curr) && !(flag)) { |
54 | err ("NULL pointer passed\n"); | 54 | err("NULL pointer passed\n"); |
55 | return NULL; | 55 | return NULL; |
56 | } | 56 | } |
57 | 57 | ||
58 | newbus = kzalloc(sizeof(struct bus_node), GFP_KERNEL); | 58 | newbus = kzalloc(sizeof(struct bus_node), GFP_KERNEL); |
59 | if (!newbus) { | 59 | if (!newbus) { |
60 | err ("out of system memory\n"); | 60 | err("out of system memory\n"); |
61 | return NULL; | 61 | return NULL; |
62 | } | 62 | } |
63 | 63 | ||
@@ -65,22 +65,22 @@ static struct bus_node * __init alloc_error_bus (struct ebda_pci_rsrc *curr, u8 | |||
65 | newbus->busno = busno; | 65 | newbus->busno = busno; |
66 | else | 66 | else |
67 | newbus->busno = curr->bus_num; | 67 | newbus->busno = curr->bus_num; |
68 | list_add_tail (&newbus->bus_list, &gbuses); | 68 | list_add_tail(&newbus->bus_list, &gbuses); |
69 | return newbus; | 69 | return newbus; |
70 | } | 70 | } |
71 | 71 | ||
72 | static struct resource_node * __init alloc_resources (struct ebda_pci_rsrc *curr) | 72 | static struct resource_node * __init alloc_resources(struct ebda_pci_rsrc *curr) |
73 | { | 73 | { |
74 | struct resource_node *rs; | 74 | struct resource_node *rs; |
75 | 75 | ||
76 | if (!curr) { | 76 | if (!curr) { |
77 | err ("NULL passed to allocate\n"); | 77 | err("NULL passed to allocate\n"); |
78 | return NULL; | 78 | return NULL; |
79 | } | 79 | } |
80 | 80 | ||
81 | rs = kzalloc(sizeof(struct resource_node), GFP_KERNEL); | 81 | rs = kzalloc(sizeof(struct resource_node), GFP_KERNEL); |
82 | if (!rs) { | 82 | if (!rs) { |
83 | err ("out of system memory\n"); | 83 | err("out of system memory\n"); |
84 | return NULL; | 84 | return NULL; |
85 | } | 85 | } |
86 | rs->busno = curr->bus_num; | 86 | rs->busno = curr->bus_num; |
@@ -91,7 +91,7 @@ static struct resource_node * __init alloc_resources (struct ebda_pci_rsrc *curr | |||
91 | return rs; | 91 | return rs; |
92 | } | 92 | } |
93 | 93 | ||
94 | static int __init alloc_bus_range (struct bus_node **new_bus, struct range_node **new_range, struct ebda_pci_rsrc *curr, int flag, u8 first_bus) | 94 | static int __init alloc_bus_range(struct bus_node **new_bus, struct range_node **new_range, struct ebda_pci_rsrc *curr, int flag, u8 first_bus) |
95 | { | 95 | { |
96 | struct bus_node *newbus; | 96 | struct bus_node *newbus; |
97 | struct range_node *newrange; | 97 | struct range_node *newrange; |
@@ -100,7 +100,7 @@ static int __init alloc_bus_range (struct bus_node **new_bus, struct range_node | |||
100 | if (first_bus) { | 100 | if (first_bus) { |
101 | newbus = kzalloc(sizeof(struct bus_node), GFP_KERNEL); | 101 | newbus = kzalloc(sizeof(struct bus_node), GFP_KERNEL); |
102 | if (!newbus) { | 102 | if (!newbus) { |
103 | err ("out of system memory.\n"); | 103 | err("out of system memory.\n"); |
104 | return -ENOMEM; | 104 | return -ENOMEM; |
105 | } | 105 | } |
106 | newbus->busno = curr->bus_num; | 106 | newbus->busno = curr->bus_num; |
@@ -122,8 +122,8 @@ static int __init alloc_bus_range (struct bus_node **new_bus, struct range_node | |||
122 | newrange = kzalloc(sizeof(struct range_node), GFP_KERNEL); | 122 | newrange = kzalloc(sizeof(struct range_node), GFP_KERNEL); |
123 | if (!newrange) { | 123 | if (!newrange) { |
124 | if (first_bus) | 124 | if (first_bus) |
125 | kfree (newbus); | 125 | kfree(newbus); |
126 | err ("out of system memory\n"); | 126 | err("out of system memory\n"); |
127 | return -ENOMEM; | 127 | return -ENOMEM; |
128 | } | 128 | } |
129 | newrange->start = curr->start_addr; | 129 | newrange->start = curr->start_addr; |
@@ -133,8 +133,8 @@ static int __init alloc_bus_range (struct bus_node **new_bus, struct range_node | |||
133 | newrange->rangeno = 1; | 133 | newrange->rangeno = 1; |
134 | else { | 134 | else { |
135 | /* need to insert our range */ | 135 | /* need to insert our range */ |
136 | add_bus_range (flag, newrange, newbus); | 136 | add_bus_range(flag, newrange, newbus); |
137 | debug ("%d resource Primary Bus inserted on bus %x [%x - %x]\n", flag, newbus->busno, newrange->start, newrange->end); | 137 | debug("%d resource Primary Bus inserted on bus %x [%x - %x]\n", flag, newbus->busno, newrange->start, newrange->end); |
138 | } | 138 | } |
139 | 139 | ||
140 | switch (flag) { | 140 | switch (flag) { |
@@ -143,9 +143,9 @@ static int __init alloc_bus_range (struct bus_node **new_bus, struct range_node | |||
143 | if (first_bus) | 143 | if (first_bus) |
144 | newbus->noMemRanges = 1; | 144 | newbus->noMemRanges = 1; |
145 | else { | 145 | else { |
146 | debug ("First Memory Primary on bus %x, [%x - %x]\n", newbus->busno, newrange->start, newrange->end); | 146 | debug("First Memory Primary on bus %x, [%x - %x]\n", newbus->busno, newrange->start, newrange->end); |
147 | ++newbus->noMemRanges; | 147 | ++newbus->noMemRanges; |
148 | fix_resources (newbus); | 148 | fix_resources(newbus); |
149 | } | 149 | } |
150 | break; | 150 | break; |
151 | case IO: | 151 | case IO: |
@@ -153,9 +153,9 @@ static int __init alloc_bus_range (struct bus_node **new_bus, struct range_node | |||
153 | if (first_bus) | 153 | if (first_bus) |
154 | newbus->noIORanges = 1; | 154 | newbus->noIORanges = 1; |
155 | else { | 155 | else { |
156 | debug ("First IO Primary on bus %x, [%x - %x]\n", newbus->busno, newrange->start, newrange->end); | 156 | debug("First IO Primary on bus %x, [%x - %x]\n", newbus->busno, newrange->start, newrange->end); |
157 | ++newbus->noIORanges; | 157 | ++newbus->noIORanges; |
158 | fix_resources (newbus); | 158 | fix_resources(newbus); |
159 | } | 159 | } |
160 | break; | 160 | break; |
161 | case PFMEM: | 161 | case PFMEM: |
@@ -163,9 +163,9 @@ static int __init alloc_bus_range (struct bus_node **new_bus, struct range_node | |||
163 | if (first_bus) | 163 | if (first_bus) |
164 | newbus->noPFMemRanges = 1; | 164 | newbus->noPFMemRanges = 1; |
165 | else { | 165 | else { |
166 | debug ("1st PFMemory Primary on Bus %x [%x - %x]\n", newbus->busno, newrange->start, newrange->end); | 166 | debug("1st PFMemory Primary on Bus %x [%x - %x]\n", newbus->busno, newrange->start, newrange->end); |
167 | ++newbus->noPFMemRanges; | 167 | ++newbus->noPFMemRanges; |
168 | fix_resources (newbus); | 168 | fix_resources(newbus); |
169 | } | 169 | } |
170 | 170 | ||
171 | break; | 171 | break; |
@@ -183,7 +183,7 @@ static int __init alloc_bus_range (struct bus_node **new_bus, struct range_node | |||
183 | * 2. If cannot allocate out of PFMem range, allocate from Mem ranges. PFmemFromMem | 183 | * 2. If cannot allocate out of PFMem range, allocate from Mem ranges. PFmemFromMem |
184 | * are not sorted. (no need since use mem node). To not change the entire code, we | 184 | * are not sorted. (no need since use mem node). To not change the entire code, we |
185 | * also add mem node whenever this case happens so as not to change | 185 | * also add mem node whenever this case happens so as not to change |
186 | * ibmphp_check_mem_resource etc (and since it really is taking Mem resource) | 186 | * ibmphp_check_mem_resource etc(and since it really is taking Mem resource) |
187 | */ | 187 | */ |
188 | 188 | ||
189 | /***************************************************************************** | 189 | /***************************************************************************** |
@@ -196,7 +196,7 @@ static int __init alloc_bus_range (struct bus_node **new_bus, struct range_node | |||
196 | * Input: ptr to the head of the resource list from EBDA | 196 | * Input: ptr to the head of the resource list from EBDA |
197 | * Output: 0, -1 or error codes | 197 | * Output: 0, -1 or error codes |
198 | ***************************************************************************/ | 198 | ***************************************************************************/ |
199 | int __init ibmphp_rsrc_init (void) | 199 | int __init ibmphp_rsrc_init(void) |
200 | { | 200 | { |
201 | struct ebda_pci_rsrc *curr; | 201 | struct ebda_pci_rsrc *curr; |
202 | struct range_node *newrange = NULL; | 202 | struct range_node *newrange = NULL; |
@@ -210,11 +210,11 @@ int __init ibmphp_rsrc_init (void) | |||
210 | int rc; | 210 | int rc; |
211 | struct list_head *tmp_ebda; | 211 | struct list_head *tmp_ebda; |
212 | 212 | ||
213 | list_for_each (tmp_ebda, &ibmphp_ebda_pci_rsrc_head) { | 213 | list_for_each(tmp_ebda, &ibmphp_ebda_pci_rsrc_head) { |
214 | curr = list_entry (tmp_ebda, struct ebda_pci_rsrc, ebda_pci_rsrc_list); | 214 | curr = list_entry(tmp_ebda, struct ebda_pci_rsrc, ebda_pci_rsrc_list); |
215 | if (!(curr->rsrc_type & PCIDEVMASK)) { | 215 | if (!(curr->rsrc_type & PCIDEVMASK)) { |
216 | /* EBDA still lists non PCI devices, so ignore... */ | 216 | /* EBDA still lists non PCI devices, so ignore... */ |
217 | debug ("this is not a PCI DEVICE in rsrc_init, please take care\n"); | 217 | debug("this is not a PCI DEVICE in rsrc_init, please take care\n"); |
218 | // continue; | 218 | // continue; |
219 | } | 219 | } |
220 | 220 | ||
@@ -223,17 +223,17 @@ int __init ibmphp_rsrc_init (void) | |||
223 | /* memory */ | 223 | /* memory */ |
224 | if ((curr->rsrc_type & RESTYPE) == MMASK) { | 224 | if ((curr->rsrc_type & RESTYPE) == MMASK) { |
225 | /* no bus structure exists in place yet */ | 225 | /* no bus structure exists in place yet */ |
226 | if (list_empty (&gbuses)) { | 226 | if (list_empty(&gbuses)) { |
227 | rc = alloc_bus_range(&newbus, &newrange, curr, MEM, 1); | 227 | rc = alloc_bus_range(&newbus, &newrange, curr, MEM, 1); |
228 | if (rc) | 228 | if (rc) |
229 | return rc; | 229 | return rc; |
230 | list_add_tail (&newbus->bus_list, &gbuses); | 230 | list_add_tail(&newbus->bus_list, &gbuses); |
231 | debug ("gbuses = NULL, Memory Primary Bus %x [%x - %x]\n", newbus->busno, newrange->start, newrange->end); | 231 | debug("gbuses = NULL, Memory Primary Bus %x [%x - %x]\n", newbus->busno, newrange->start, newrange->end); |
232 | } else { | 232 | } else { |
233 | bus_cur = find_bus_wprev (curr->bus_num, &bus_prev, 1); | 233 | bus_cur = find_bus_wprev(curr->bus_num, &bus_prev, 1); |
234 | /* found our bus */ | 234 | /* found our bus */ |
235 | if (bus_cur) { | 235 | if (bus_cur) { |
236 | rc = alloc_bus_range (&bus_cur, &newrange, curr, MEM, 0); | 236 | rc = alloc_bus_range(&bus_cur, &newrange, curr, MEM, 0); |
237 | if (rc) | 237 | if (rc) |
238 | return rc; | 238 | return rc; |
239 | } else { | 239 | } else { |
@@ -242,24 +242,24 @@ int __init ibmphp_rsrc_init (void) | |||
242 | if (rc) | 242 | if (rc) |
243 | return rc; | 243 | return rc; |
244 | 244 | ||
245 | list_add_tail (&newbus->bus_list, &gbuses); | 245 | list_add_tail(&newbus->bus_list, &gbuses); |
246 | debug ("New Bus, Memory Primary Bus %x [%x - %x]\n", newbus->busno, newrange->start, newrange->end); | 246 | debug("New Bus, Memory Primary Bus %x [%x - %x]\n", newbus->busno, newrange->start, newrange->end); |
247 | } | 247 | } |
248 | } | 248 | } |
249 | } else if ((curr->rsrc_type & RESTYPE) == PFMASK) { | 249 | } else if ((curr->rsrc_type & RESTYPE) == PFMASK) { |
250 | /* prefetchable memory */ | 250 | /* prefetchable memory */ |
251 | if (list_empty (&gbuses)) { | 251 | if (list_empty(&gbuses)) { |
252 | /* no bus structure exists in place yet */ | 252 | /* no bus structure exists in place yet */ |
253 | rc = alloc_bus_range(&newbus, &newrange, curr, PFMEM, 1); | 253 | rc = alloc_bus_range(&newbus, &newrange, curr, PFMEM, 1); |
254 | if (rc) | 254 | if (rc) |
255 | return rc; | 255 | return rc; |
256 | list_add_tail (&newbus->bus_list, &gbuses); | 256 | list_add_tail(&newbus->bus_list, &gbuses); |
257 | debug ("gbuses = NULL, PFMemory Primary Bus %x [%x - %x]\n", newbus->busno, newrange->start, newrange->end); | 257 | debug("gbuses = NULL, PFMemory Primary Bus %x [%x - %x]\n", newbus->busno, newrange->start, newrange->end); |
258 | } else { | 258 | } else { |
259 | bus_cur = find_bus_wprev (curr->bus_num, &bus_prev, 1); | 259 | bus_cur = find_bus_wprev(curr->bus_num, &bus_prev, 1); |
260 | if (bus_cur) { | 260 | if (bus_cur) { |
261 | /* found our bus */ | 261 | /* found our bus */ |
262 | rc = alloc_bus_range (&bus_cur, &newrange, curr, PFMEM, 0); | 262 | rc = alloc_bus_range(&bus_cur, &newrange, curr, PFMEM, 0); |
263 | if (rc) | 263 | if (rc) |
264 | return rc; | 264 | return rc; |
265 | } else { | 265 | } else { |
@@ -267,23 +267,23 @@ int __init ibmphp_rsrc_init (void) | |||
267 | rc = alloc_bus_range(&newbus, &newrange, curr, PFMEM, 1); | 267 | rc = alloc_bus_range(&newbus, &newrange, curr, PFMEM, 1); |
268 | if (rc) | 268 | if (rc) |
269 | return rc; | 269 | return rc; |
270 | list_add_tail (&newbus->bus_list, &gbuses); | 270 | list_add_tail(&newbus->bus_list, &gbuses); |
271 | debug ("1st Bus, PFMemory Primary Bus %x [%x - %x]\n", newbus->busno, newrange->start, newrange->end); | 271 | debug("1st Bus, PFMemory Primary Bus %x [%x - %x]\n", newbus->busno, newrange->start, newrange->end); |
272 | } | 272 | } |
273 | } | 273 | } |
274 | } else if ((curr->rsrc_type & RESTYPE) == IOMASK) { | 274 | } else if ((curr->rsrc_type & RESTYPE) == IOMASK) { |
275 | /* IO */ | 275 | /* IO */ |
276 | if (list_empty (&gbuses)) { | 276 | if (list_empty(&gbuses)) { |
277 | /* no bus structure exists in place yet */ | 277 | /* no bus structure exists in place yet */ |
278 | rc = alloc_bus_range(&newbus, &newrange, curr, IO, 1); | 278 | rc = alloc_bus_range(&newbus, &newrange, curr, IO, 1); |
279 | if (rc) | 279 | if (rc) |
280 | return rc; | 280 | return rc; |
281 | list_add_tail (&newbus->bus_list, &gbuses); | 281 | list_add_tail(&newbus->bus_list, &gbuses); |
282 | debug ("gbuses = NULL, IO Primary Bus %x [%x - %x]\n", newbus->busno, newrange->start, newrange->end); | 282 | debug("gbuses = NULL, IO Primary Bus %x [%x - %x]\n", newbus->busno, newrange->start, newrange->end); |
283 | } else { | 283 | } else { |
284 | bus_cur = find_bus_wprev (curr->bus_num, &bus_prev, 1); | 284 | bus_cur = find_bus_wprev(curr->bus_num, &bus_prev, 1); |
285 | if (bus_cur) { | 285 | if (bus_cur) { |
286 | rc = alloc_bus_range (&bus_cur, &newrange, curr, IO, 0); | 286 | rc = alloc_bus_range(&bus_cur, &newrange, curr, IO, 0); |
287 | if (rc) | 287 | if (rc) |
288 | return rc; | 288 | return rc; |
289 | } else { | 289 | } else { |
@@ -291,8 +291,8 @@ int __init ibmphp_rsrc_init (void) | |||
291 | rc = alloc_bus_range(&newbus, &newrange, curr, IO, 1); | 291 | rc = alloc_bus_range(&newbus, &newrange, curr, IO, 1); |
292 | if (rc) | 292 | if (rc) |
293 | return rc; | 293 | return rc; |
294 | list_add_tail (&newbus->bus_list, &gbuses); | 294 | list_add_tail(&newbus->bus_list, &gbuses); |
295 | debug ("1st Bus, IO Primary Bus %x [%x - %x]\n", newbus->busno, newrange->start, newrange->end); | 295 | debug("1st Bus, IO Primary Bus %x [%x - %x]\n", newbus->busno, newrange->start, newrange->end); |
296 | } | 296 | } |
297 | } | 297 | } |
298 | 298 | ||
@@ -304,7 +304,7 @@ int __init ibmphp_rsrc_init (void) | |||
304 | /* regular pci device resource */ | 304 | /* regular pci device resource */ |
305 | if ((curr->rsrc_type & RESTYPE) == MMASK) { | 305 | if ((curr->rsrc_type & RESTYPE) == MMASK) { |
306 | /* Memory resource */ | 306 | /* Memory resource */ |
307 | new_mem = alloc_resources (curr); | 307 | new_mem = alloc_resources(curr); |
308 | if (!new_mem) | 308 | if (!new_mem) |
309 | return -ENOMEM; | 309 | return -ENOMEM; |
310 | new_mem->type = MEM; | 310 | new_mem->type = MEM; |
@@ -315,25 +315,25 @@ int __init ibmphp_rsrc_init (void) | |||
315 | * assign a -1 and then update once the range | 315 | * assign a -1 and then update once the range |
316 | * actually appears... | 316 | * actually appears... |
317 | */ | 317 | */ |
318 | if (ibmphp_add_resource (new_mem) < 0) { | 318 | if (ibmphp_add_resource(new_mem) < 0) { |
319 | newbus = alloc_error_bus (curr, 0, 0); | 319 | newbus = alloc_error_bus(curr, 0, 0); |
320 | if (!newbus) | 320 | if (!newbus) |
321 | return -ENOMEM; | 321 | return -ENOMEM; |
322 | newbus->firstMem = new_mem; | 322 | newbus->firstMem = new_mem; |
323 | ++newbus->needMemUpdate; | 323 | ++newbus->needMemUpdate; |
324 | new_mem->rangeno = -1; | 324 | new_mem->rangeno = -1; |
325 | } | 325 | } |
326 | debug ("Memory resource for device %x, bus %x, [%x - %x]\n", new_mem->devfunc, new_mem->busno, new_mem->start, new_mem->end); | 326 | debug("Memory resource for device %x, bus %x, [%x - %x]\n", new_mem->devfunc, new_mem->busno, new_mem->start, new_mem->end); |
327 | 327 | ||
328 | } else if ((curr->rsrc_type & RESTYPE) == PFMASK) { | 328 | } else if ((curr->rsrc_type & RESTYPE) == PFMASK) { |
329 | /* PFMemory resource */ | 329 | /* PFMemory resource */ |
330 | new_pfmem = alloc_resources (curr); | 330 | new_pfmem = alloc_resources(curr); |
331 | if (!new_pfmem) | 331 | if (!new_pfmem) |
332 | return -ENOMEM; | 332 | return -ENOMEM; |
333 | new_pfmem->type = PFMEM; | 333 | new_pfmem->type = PFMEM; |
334 | new_pfmem->fromMem = 0; | 334 | new_pfmem->fromMem = 0; |
335 | if (ibmphp_add_resource (new_pfmem) < 0) { | 335 | if (ibmphp_add_resource(new_pfmem) < 0) { |
336 | newbus = alloc_error_bus (curr, 0, 0); | 336 | newbus = alloc_error_bus(curr, 0, 0); |
337 | if (!newbus) | 337 | if (!newbus) |
338 | return -ENOMEM; | 338 | return -ENOMEM; |
339 | newbus->firstPFMem = new_pfmem; | 339 | newbus->firstPFMem = new_pfmem; |
@@ -341,10 +341,10 @@ int __init ibmphp_rsrc_init (void) | |||
341 | new_pfmem->rangeno = -1; | 341 | new_pfmem->rangeno = -1; |
342 | } | 342 | } |
343 | 343 | ||
344 | debug ("PFMemory resource for device %x, bus %x, [%x - %x]\n", new_pfmem->devfunc, new_pfmem->busno, new_pfmem->start, new_pfmem->end); | 344 | debug("PFMemory resource for device %x, bus %x, [%x - %x]\n", new_pfmem->devfunc, new_pfmem->busno, new_pfmem->start, new_pfmem->end); |
345 | } else if ((curr->rsrc_type & RESTYPE) == IOMASK) { | 345 | } else if ((curr->rsrc_type & RESTYPE) == IOMASK) { |
346 | /* IO resource */ | 346 | /* IO resource */ |
347 | new_io = alloc_resources (curr); | 347 | new_io = alloc_resources(curr); |
348 | if (!new_io) | 348 | if (!new_io) |
349 | return -ENOMEM; | 349 | return -ENOMEM; |
350 | new_io->type = IO; | 350 | new_io->type = IO; |
@@ -356,27 +356,27 @@ int __init ibmphp_rsrc_init (void) | |||
356 | * Can assign a -1 and then update once the | 356 | * Can assign a -1 and then update once the |
357 | * range actually appears... | 357 | * range actually appears... |
358 | */ | 358 | */ |
359 | if (ibmphp_add_resource (new_io) < 0) { | 359 | if (ibmphp_add_resource(new_io) < 0) { |
360 | newbus = alloc_error_bus (curr, 0, 0); | 360 | newbus = alloc_error_bus(curr, 0, 0); |
361 | if (!newbus) | 361 | if (!newbus) |
362 | return -ENOMEM; | 362 | return -ENOMEM; |
363 | newbus->firstIO = new_io; | 363 | newbus->firstIO = new_io; |
364 | ++newbus->needIOUpdate; | 364 | ++newbus->needIOUpdate; |
365 | new_io->rangeno = -1; | 365 | new_io->rangeno = -1; |
366 | } | 366 | } |
367 | debug ("IO resource for device %x, bus %x, [%x - %x]\n", new_io->devfunc, new_io->busno, new_io->start, new_io->end); | 367 | debug("IO resource for device %x, bus %x, [%x - %x]\n", new_io->devfunc, new_io->busno, new_io->start, new_io->end); |
368 | } | 368 | } |
369 | } | 369 | } |
370 | } | 370 | } |
371 | 371 | ||
372 | list_for_each (tmp, &gbuses) { | 372 | list_for_each(tmp, &gbuses) { |
373 | bus_cur = list_entry (tmp, struct bus_node, bus_list); | 373 | bus_cur = list_entry(tmp, struct bus_node, bus_list); |
374 | /* This is to get info about PPB resources, since EBDA doesn't put this info into the primary bus info */ | 374 | /* This is to get info about PPB resources, since EBDA doesn't put this info into the primary bus info */ |
375 | rc = update_bridge_ranges (&bus_cur); | 375 | rc = update_bridge_ranges(&bus_cur); |
376 | if (rc) | 376 | if (rc) |
377 | return rc; | 377 | return rc; |
378 | } | 378 | } |
379 | return once_over (); /* This is to align ranges (so no -1) */ | 379 | return once_over(); /* This is to align ranges (so no -1) */ |
380 | } | 380 | } |
381 | 381 | ||
382 | /******************************************************************************** | 382 | /******************************************************************************** |
@@ -387,7 +387,7 @@ int __init ibmphp_rsrc_init (void) | |||
387 | * Input: type of the resource, range to add, current bus | 387 | * Input: type of the resource, range to add, current bus |
388 | * Output: 0 or -1, bus and range ptrs | 388 | * Output: 0 or -1, bus and range ptrs |
389 | ********************************************************************************/ | 389 | ********************************************************************************/ |
390 | static int add_bus_range (int type, struct range_node *range, struct bus_node *bus_cur) | 390 | static int add_bus_range(int type, struct range_node *range, struct bus_node *bus_cur) |
391 | { | 391 | { |
392 | struct range_node *range_cur = NULL; | 392 | struct range_node *range_cur = NULL; |
393 | struct range_node *range_prev; | 393 | struct range_node *range_prev; |
@@ -452,7 +452,7 @@ static int add_bus_range (int type, struct range_node *range, struct bus_node *b | |||
452 | range_cur = range_cur->next; | 452 | range_cur = range_cur->next; |
453 | } | 453 | } |
454 | 454 | ||
455 | update_resources (bus_cur, type, i_init + 1); | 455 | update_resources(bus_cur, type, i_init + 1); |
456 | return 0; | 456 | return 0; |
457 | } | 457 | } |
458 | 458 | ||
@@ -462,7 +462,7 @@ static int add_bus_range (int type, struct range_node *range, struct bus_node *b | |||
462 | * | 462 | * |
463 | * Input: bus, type of the resource, the rangeno starting from which to update | 463 | * Input: bus, type of the resource, the rangeno starting from which to update |
464 | ******************************************************************************/ | 464 | ******************************************************************************/ |
465 | static void update_resources (struct bus_node *bus_cur, int type, int rangeno) | 465 | static void update_resources(struct bus_node *bus_cur, int type, int rangeno) |
466 | { | 466 | { |
467 | struct resource_node *res = NULL; | 467 | struct resource_node *res = NULL; |
468 | u8 eol = 0; /* end of list indicator */ | 468 | u8 eol = 0; /* end of list indicator */ |
@@ -506,9 +506,9 @@ static void update_resources (struct bus_node *bus_cur, int type, int rangeno) | |||
506 | } | 506 | } |
507 | } | 507 | } |
508 | 508 | ||
509 | static void fix_me (struct resource_node *res, struct bus_node *bus_cur, struct range_node *range) | 509 | static void fix_me(struct resource_node *res, struct bus_node *bus_cur, struct range_node *range) |
510 | { | 510 | { |
511 | char * str = ""; | 511 | char *str = ""; |
512 | switch (res->type) { | 512 | switch (res->type) { |
513 | case IO: | 513 | case IO: |
514 | str = "io"; | 514 | str = "io"; |
@@ -526,7 +526,7 @@ static void fix_me (struct resource_node *res, struct bus_node *bus_cur, struct | |||
526 | while (range) { | 526 | while (range) { |
527 | if ((res->start >= range->start) && (res->end <= range->end)) { | 527 | if ((res->start >= range->start) && (res->end <= range->end)) { |
528 | res->rangeno = range->rangeno; | 528 | res->rangeno = range->rangeno; |
529 | debug ("%s->rangeno in fix_resources is %d\n", str, res->rangeno); | 529 | debug("%s->rangeno in fix_resources is %d\n", str, res->rangeno); |
530 | switch (res->type) { | 530 | switch (res->type) { |
531 | case IO: | 531 | case IO: |
532 | --bus_cur->needIOUpdate; | 532 | --bus_cur->needIOUpdate; |
@@ -561,27 +561,27 @@ static void fix_me (struct resource_node *res, struct bus_node *bus_cur, struct | |||
561 | * Input: current bus | 561 | * Input: current bus |
562 | * Output: none, list of resources for that bus are fixed if can be | 562 | * Output: none, list of resources for that bus are fixed if can be |
563 | *******************************************************************************/ | 563 | *******************************************************************************/ |
564 | static void fix_resources (struct bus_node *bus_cur) | 564 | static void fix_resources(struct bus_node *bus_cur) |
565 | { | 565 | { |
566 | struct range_node *range; | 566 | struct range_node *range; |
567 | struct resource_node *res; | 567 | struct resource_node *res; |
568 | 568 | ||
569 | debug ("%s - bus_cur->busno = %d\n", __func__, bus_cur->busno); | 569 | debug("%s - bus_cur->busno = %d\n", __func__, bus_cur->busno); |
570 | 570 | ||
571 | if (bus_cur->needIOUpdate) { | 571 | if (bus_cur->needIOUpdate) { |
572 | res = bus_cur->firstIO; | 572 | res = bus_cur->firstIO; |
573 | range = bus_cur->rangeIO; | 573 | range = bus_cur->rangeIO; |
574 | fix_me (res, bus_cur, range); | 574 | fix_me(res, bus_cur, range); |
575 | } | 575 | } |
576 | if (bus_cur->needMemUpdate) { | 576 | if (bus_cur->needMemUpdate) { |
577 | res = bus_cur->firstMem; | 577 | res = bus_cur->firstMem; |
578 | range = bus_cur->rangeMem; | 578 | range = bus_cur->rangeMem; |
579 | fix_me (res, bus_cur, range); | 579 | fix_me(res, bus_cur, range); |
580 | } | 580 | } |
581 | if (bus_cur->needPFMemUpdate) { | 581 | if (bus_cur->needPFMemUpdate) { |
582 | res = bus_cur->firstPFMem; | 582 | res = bus_cur->firstPFMem; |
583 | range = bus_cur->rangePFMem; | 583 | range = bus_cur->rangePFMem; |
584 | fix_me (res, bus_cur, range); | 584 | fix_me(res, bus_cur, range); |
585 | } | 585 | } |
586 | } | 586 | } |
587 | 587 | ||
@@ -594,7 +594,7 @@ static void fix_resources (struct bus_node *bus_cur) | |||
594 | * Output: ptrs assigned (to the node) | 594 | * Output: ptrs assigned (to the node) |
595 | * 0 or -1 | 595 | * 0 or -1 |
596 | *******************************************************************************/ | 596 | *******************************************************************************/ |
597 | int ibmphp_add_resource (struct resource_node *res) | 597 | int ibmphp_add_resource(struct resource_node *res) |
598 | { | 598 | { |
599 | struct resource_node *res_cur; | 599 | struct resource_node *res_cur; |
600 | struct resource_node *res_prev; | 600 | struct resource_node *res_prev; |
@@ -602,18 +602,18 @@ int ibmphp_add_resource (struct resource_node *res) | |||
602 | struct range_node *range_cur = NULL; | 602 | struct range_node *range_cur = NULL; |
603 | struct resource_node *res_start = NULL; | 603 | struct resource_node *res_start = NULL; |
604 | 604 | ||
605 | debug ("%s - enter\n", __func__); | 605 | debug("%s - enter\n", __func__); |
606 | 606 | ||
607 | if (!res) { | 607 | if (!res) { |
608 | err ("NULL passed to add\n"); | 608 | err("NULL passed to add\n"); |
609 | return -ENODEV; | 609 | return -ENODEV; |
610 | } | 610 | } |
611 | 611 | ||
612 | bus_cur = find_bus_wprev (res->busno, NULL, 0); | 612 | bus_cur = find_bus_wprev(res->busno, NULL, 0); |
613 | 613 | ||
614 | if (!bus_cur) { | 614 | if (!bus_cur) { |
615 | /* didn't find a bus, something's wrong!!! */ | 615 | /* didn't find a bus, something's wrong!!! */ |
616 | debug ("no bus in the system, either pci_dev's wrong or allocation failed\n"); | 616 | debug("no bus in the system, either pci_dev's wrong or allocation failed\n"); |
617 | return -ENODEV; | 617 | return -ENODEV; |
618 | } | 618 | } |
619 | 619 | ||
@@ -632,7 +632,7 @@ int ibmphp_add_resource (struct resource_node *res) | |||
632 | res_start = bus_cur->firstPFMem; | 632 | res_start = bus_cur->firstPFMem; |
633 | break; | 633 | break; |
634 | default: | 634 | default: |
635 | err ("cannot read the type of the resource to add... problem\n"); | 635 | err("cannot read the type of the resource to add... problem\n"); |
636 | return -EINVAL; | 636 | return -EINVAL; |
637 | } | 637 | } |
638 | while (range_cur) { | 638 | while (range_cur) { |
@@ -663,7 +663,7 @@ int ibmphp_add_resource (struct resource_node *res) | |||
663 | res->rangeno = -1; | 663 | res->rangeno = -1; |
664 | } | 664 | } |
665 | 665 | ||
666 | debug ("The range is %d\n", res->rangeno); | 666 | debug("The range is %d\n", res->rangeno); |
667 | if (!res_start) { | 667 | if (!res_start) { |
668 | /* no first{IO,Mem,Pfmem} on the bus, 1st IO/Mem/Pfmem resource ever */ | 668 | /* no first{IO,Mem,Pfmem} on the bus, 1st IO/Mem/Pfmem resource ever */ |
669 | switch (res->type) { | 669 | switch (res->type) { |
@@ -683,7 +683,7 @@ int ibmphp_add_resource (struct resource_node *res) | |||
683 | res_cur = res_start; | 683 | res_cur = res_start; |
684 | res_prev = NULL; | 684 | res_prev = NULL; |
685 | 685 | ||
686 | debug ("res_cur->rangeno is %d\n", res_cur->rangeno); | 686 | debug("res_cur->rangeno is %d\n", res_cur->rangeno); |
687 | 687 | ||
688 | while (res_cur) { | 688 | while (res_cur) { |
689 | if (res_cur->rangeno >= res->rangeno) | 689 | if (res_cur->rangeno >= res->rangeno) |
@@ -697,7 +697,7 @@ int ibmphp_add_resource (struct resource_node *res) | |||
697 | 697 | ||
698 | if (!res_cur) { | 698 | if (!res_cur) { |
699 | /* at the end of the resource list */ | 699 | /* at the end of the resource list */ |
700 | debug ("i should be here, [%x - %x]\n", res->start, res->end); | 700 | debug("i should be here, [%x - %x]\n", res->start, res->end); |
701 | res_prev->nextRange = res; | 701 | res_prev->nextRange = res; |
702 | res->next = NULL; | 702 | res->next = NULL; |
703 | res->nextRange = NULL; | 703 | res->nextRange = NULL; |
@@ -765,7 +765,7 @@ int ibmphp_add_resource (struct resource_node *res) | |||
765 | } | 765 | } |
766 | } | 766 | } |
767 | 767 | ||
768 | debug ("%s - exit\n", __func__); | 768 | debug("%s - exit\n", __func__); |
769 | return 0; | 769 | return 0; |
770 | } | 770 | } |
771 | 771 | ||
@@ -776,23 +776,23 @@ int ibmphp_add_resource (struct resource_node *res) | |||
776 | * Output: modified resource list | 776 | * Output: modified resource list |
777 | * 0 or error code | 777 | * 0 or error code |
778 | ****************************************************************************/ | 778 | ****************************************************************************/ |
779 | int ibmphp_remove_resource (struct resource_node *res) | 779 | int ibmphp_remove_resource(struct resource_node *res) |
780 | { | 780 | { |
781 | struct bus_node *bus_cur; | 781 | struct bus_node *bus_cur; |
782 | struct resource_node *res_cur = NULL; | 782 | struct resource_node *res_cur = NULL; |
783 | struct resource_node *res_prev; | 783 | struct resource_node *res_prev; |
784 | struct resource_node *mem_cur; | 784 | struct resource_node *mem_cur; |
785 | char * type = ""; | 785 | char *type = ""; |
786 | 786 | ||
787 | if (!res) { | 787 | if (!res) { |
788 | err ("resource to remove is NULL\n"); | 788 | err("resource to remove is NULL\n"); |
789 | return -ENODEV; | 789 | return -ENODEV; |
790 | } | 790 | } |
791 | 791 | ||
792 | bus_cur = find_bus_wprev (res->busno, NULL, 0); | 792 | bus_cur = find_bus_wprev(res->busno, NULL, 0); |
793 | 793 | ||
794 | if (!bus_cur) { | 794 | if (!bus_cur) { |
795 | err ("cannot find corresponding bus of the io resource to remove bailing out...\n"); | 795 | err("cannot find corresponding bus of the io resource to remove bailing out...\n"); |
796 | return -ENODEV; | 796 | return -ENODEV; |
797 | } | 797 | } |
798 | 798 | ||
@@ -810,7 +810,7 @@ int ibmphp_remove_resource (struct resource_node *res) | |||
810 | type = "pfmem"; | 810 | type = "pfmem"; |
811 | break; | 811 | break; |
812 | default: | 812 | default: |
813 | err ("unknown type for resource to remove\n"); | 813 | err("unknown type for resource to remove\n"); |
814 | return -EINVAL; | 814 | return -EINVAL; |
815 | } | 815 | } |
816 | res_prev = NULL; | 816 | res_prev = NULL; |
@@ -848,16 +848,16 @@ int ibmphp_remove_resource (struct resource_node *res) | |||
848 | mem_cur = mem_cur->nextRange; | 848 | mem_cur = mem_cur->nextRange; |
849 | } | 849 | } |
850 | if (!mem_cur) { | 850 | if (!mem_cur) { |
851 | err ("cannot find corresponding mem node for pfmem...\n"); | 851 | err("cannot find corresponding mem node for pfmem...\n"); |
852 | return -EINVAL; | 852 | return -EINVAL; |
853 | } | 853 | } |
854 | 854 | ||
855 | ibmphp_remove_resource (mem_cur); | 855 | ibmphp_remove_resource(mem_cur); |
856 | if (!res_prev) | 856 | if (!res_prev) |
857 | bus_cur->firstPFMemFromMem = res_cur->next; | 857 | bus_cur->firstPFMemFromMem = res_cur->next; |
858 | else | 858 | else |
859 | res_prev->next = res_cur->next; | 859 | res_prev->next = res_cur->next; |
860 | kfree (res_cur); | 860 | kfree(res_cur); |
861 | return 0; | 861 | return 0; |
862 | } | 862 | } |
863 | res_prev = res_cur; | 863 | res_prev = res_cur; |
@@ -867,11 +867,11 @@ int ibmphp_remove_resource (struct resource_node *res) | |||
867 | res_cur = res_cur->nextRange; | 867 | res_cur = res_cur->nextRange; |
868 | } | 868 | } |
869 | if (!res_cur) { | 869 | if (!res_cur) { |
870 | err ("cannot find pfmem to delete...\n"); | 870 | err("cannot find pfmem to delete...\n"); |
871 | return -EINVAL; | 871 | return -EINVAL; |
872 | } | 872 | } |
873 | } else { | 873 | } else { |
874 | err ("the %s resource is not in the list to be deleted...\n", type); | 874 | err("the %s resource is not in the list to be deleted...\n", type); |
875 | return -EINVAL; | 875 | return -EINVAL; |
876 | } | 876 | } |
877 | } | 877 | } |
@@ -914,7 +914,7 @@ int ibmphp_remove_resource (struct resource_node *res) | |||
914 | break; | 914 | break; |
915 | } | 915 | } |
916 | } | 916 | } |
917 | kfree (res_cur); | 917 | kfree(res_cur); |
918 | return 0; | 918 | return 0; |
919 | } else { | 919 | } else { |
920 | if (res_cur->next) { | 920 | if (res_cur->next) { |
@@ -929,14 +929,14 @@ int ibmphp_remove_resource (struct resource_node *res) | |||
929 | res_prev->next = NULL; | 929 | res_prev->next = NULL; |
930 | res_prev->nextRange = NULL; | 930 | res_prev->nextRange = NULL; |
931 | } | 931 | } |
932 | kfree (res_cur); | 932 | kfree(res_cur); |
933 | return 0; | 933 | return 0; |
934 | } | 934 | } |
935 | 935 | ||
936 | return 0; | 936 | return 0; |
937 | } | 937 | } |
938 | 938 | ||
939 | static struct range_node *find_range (struct bus_node *bus_cur, struct resource_node *res) | 939 | static struct range_node *find_range(struct bus_node *bus_cur, struct resource_node *res) |
940 | { | 940 | { |
941 | struct range_node *range = NULL; | 941 | struct range_node *range = NULL; |
942 | 942 | ||
@@ -951,7 +951,7 @@ static struct range_node *find_range (struct bus_node *bus_cur, struct resource_ | |||
951 | range = bus_cur->rangePFMem; | 951 | range = bus_cur->rangePFMem; |
952 | break; | 952 | break; |
953 | default: | 953 | default: |
954 | err ("cannot read resource type in find_range\n"); | 954 | err("cannot read resource type in find_range\n"); |
955 | } | 955 | } |
956 | 956 | ||
957 | while (range) { | 957 | while (range) { |
@@ -971,7 +971,7 @@ static struct range_node *find_range (struct bus_node *bus_cur, struct resource_ | |||
971 | * Output: the correct start and end address are inputted into the resource node, | 971 | * Output: the correct start and end address are inputted into the resource node, |
972 | * 0 or -EINVAL | 972 | * 0 or -EINVAL |
973 | *****************************************************************************/ | 973 | *****************************************************************************/ |
974 | int ibmphp_check_resource (struct resource_node *res, u8 bridge) | 974 | int ibmphp_check_resource(struct resource_node *res, u8 bridge) |
975 | { | 975 | { |
976 | struct bus_node *bus_cur; | 976 | struct bus_node *bus_cur; |
977 | struct range_node *range = NULL; | 977 | struct range_node *range = NULL; |
@@ -995,16 +995,16 @@ int ibmphp_check_resource (struct resource_node *res, u8 bridge) | |||
995 | } else | 995 | } else |
996 | tmp_divide = res->len; | 996 | tmp_divide = res->len; |
997 | 997 | ||
998 | bus_cur = find_bus_wprev (res->busno, NULL, 0); | 998 | bus_cur = find_bus_wprev(res->busno, NULL, 0); |
999 | 999 | ||
1000 | if (!bus_cur) { | 1000 | if (!bus_cur) { |
1001 | /* didn't find a bus, something's wrong!!! */ | 1001 | /* didn't find a bus, something's wrong!!! */ |
1002 | debug ("no bus in the system, either pci_dev's wrong or allocation failed\n"); | 1002 | debug("no bus in the system, either pci_dev's wrong or allocation failed\n"); |
1003 | return -EINVAL; | 1003 | return -EINVAL; |
1004 | } | 1004 | } |
1005 | 1005 | ||
1006 | debug ("%s - enter\n", __func__); | 1006 | debug("%s - enter\n", __func__); |
1007 | debug ("bus_cur->busno is %d\n", bus_cur->busno); | 1007 | debug("bus_cur->busno is %d\n", bus_cur->busno); |
1008 | 1008 | ||
1009 | /* This is a quick fix to not mess up with the code very much. i.e., | 1009 | /* This is a quick fix to not mess up with the code very much. i.e., |
1010 | * 2000-2fff, len = 1000, but when we compare, we need it to be fff */ | 1010 | * 2000-2fff, len = 1000, but when we compare, we need it to be fff */ |
@@ -1024,17 +1024,17 @@ int ibmphp_check_resource (struct resource_node *res, u8 bridge) | |||
1024 | noranges = bus_cur->noPFMemRanges; | 1024 | noranges = bus_cur->noPFMemRanges; |
1025 | break; | 1025 | break; |
1026 | default: | 1026 | default: |
1027 | err ("wrong type of resource to check\n"); | 1027 | err("wrong type of resource to check\n"); |
1028 | return -EINVAL; | 1028 | return -EINVAL; |
1029 | } | 1029 | } |
1030 | res_prev = NULL; | 1030 | res_prev = NULL; |
1031 | 1031 | ||
1032 | while (res_cur) { | 1032 | while (res_cur) { |
1033 | range = find_range (bus_cur, res_cur); | 1033 | range = find_range(bus_cur, res_cur); |
1034 | debug ("%s - rangeno = %d\n", __func__, res_cur->rangeno); | 1034 | debug("%s - rangeno = %d\n", __func__, res_cur->rangeno); |
1035 | 1035 | ||
1036 | if (!range) { | 1036 | if (!range) { |
1037 | err ("no range for the device exists... bailing out...\n"); | 1037 | err("no range for the device exists... bailing out...\n"); |
1038 | return -EINVAL; | 1038 | return -EINVAL; |
1039 | } | 1039 | } |
1040 | 1040 | ||
@@ -1044,7 +1044,7 @@ int ibmphp_check_resource (struct resource_node *res, u8 bridge) | |||
1044 | len_tmp = res_cur->start - 1 - range->start; | 1044 | len_tmp = res_cur->start - 1 - range->start; |
1045 | 1045 | ||
1046 | if ((res_cur->start != range->start) && (len_tmp >= res->len)) { | 1046 | if ((res_cur->start != range->start) && (len_tmp >= res->len)) { |
1047 | debug ("len_tmp = %x\n", len_tmp); | 1047 | debug("len_tmp = %x\n", len_tmp); |
1048 | 1048 | ||
1049 | if ((len_tmp < len_cur) || (len_cur == 0)) { | 1049 | if ((len_tmp < len_cur) || (len_cur == 0)) { |
1050 | 1050 | ||
@@ -1072,7 +1072,7 @@ int ibmphp_check_resource (struct resource_node *res, u8 bridge) | |||
1072 | } | 1072 | } |
1073 | 1073 | ||
1074 | if (flag && len_cur == res->len) { | 1074 | if (flag && len_cur == res->len) { |
1075 | debug ("but we are not here, right?\n"); | 1075 | debug("but we are not here, right?\n"); |
1076 | res->start = start_cur; | 1076 | res->start = start_cur; |
1077 | res->len += 1; /* To restore the balance */ | 1077 | res->len += 1; /* To restore the balance */ |
1078 | res->end = res->start + res->len - 1; | 1078 | res->end = res->start + res->len - 1; |
@@ -1086,7 +1086,7 @@ int ibmphp_check_resource (struct resource_node *res, u8 bridge) | |||
1086 | len_tmp = range->end - (res_cur->end + 1); | 1086 | len_tmp = range->end - (res_cur->end + 1); |
1087 | 1087 | ||
1088 | if ((range->end != res_cur->end) && (len_tmp >= res->len)) { | 1088 | if ((range->end != res_cur->end) && (len_tmp >= res->len)) { |
1089 | debug ("len_tmp = %x\n", len_tmp); | 1089 | debug("len_tmp = %x\n", len_tmp); |
1090 | if ((len_tmp < len_cur) || (len_cur == 0)) { | 1090 | if ((len_tmp < len_cur) || (len_cur == 0)) { |
1091 | 1091 | ||
1092 | if (((res_cur->end + 1) % tmp_divide) == 0) { | 1092 | if (((res_cur->end + 1) % tmp_divide) == 0) { |
@@ -1262,7 +1262,7 @@ int ibmphp_check_resource (struct resource_node *res, u8 bridge) | |||
1262 | 1262 | ||
1263 | if ((!range) && (len_cur == 0)) { | 1263 | if ((!range) && (len_cur == 0)) { |
1264 | /* have gone through the list of devices and ranges and haven't found n.e.thing */ | 1264 | /* have gone through the list of devices and ranges and haven't found n.e.thing */ |
1265 | err ("no appropriate range.. bailing out...\n"); | 1265 | err("no appropriate range.. bailing out...\n"); |
1266 | return -EINVAL; | 1266 | return -EINVAL; |
1267 | } else if (len_cur) { | 1267 | } else if (len_cur) { |
1268 | res->start = start_cur; | 1268 | res->start = start_cur; |
@@ -1273,7 +1273,7 @@ int ibmphp_check_resource (struct resource_node *res, u8 bridge) | |||
1273 | } | 1273 | } |
1274 | 1274 | ||
1275 | if (!res_cur) { | 1275 | if (!res_cur) { |
1276 | debug ("prev->rangeno = %d, noranges = %d\n", res_prev->rangeno, noranges); | 1276 | debug("prev->rangeno = %d, noranges = %d\n", res_prev->rangeno, noranges); |
1277 | if (res_prev->rangeno < noranges) { | 1277 | if (res_prev->rangeno < noranges) { |
1278 | /* if there're more ranges out there to check */ | 1278 | /* if there're more ranges out there to check */ |
1279 | switch (res->type) { | 1279 | switch (res->type) { |
@@ -1328,7 +1328,7 @@ int ibmphp_check_resource (struct resource_node *res, u8 bridge) | |||
1328 | 1328 | ||
1329 | if ((!range) && (len_cur == 0)) { | 1329 | if ((!range) && (len_cur == 0)) { |
1330 | /* have gone through the list of devices and ranges and haven't found n.e.thing */ | 1330 | /* have gone through the list of devices and ranges and haven't found n.e.thing */ |
1331 | err ("no appropriate range.. bailing out...\n"); | 1331 | err("no appropriate range.. bailing out...\n"); |
1332 | return -EINVAL; | 1332 | return -EINVAL; |
1333 | } else if (len_cur) { | 1333 | } else if (len_cur) { |
1334 | res->start = start_cur; | 1334 | res->start = start_cur; |
@@ -1345,7 +1345,7 @@ int ibmphp_check_resource (struct resource_node *res, u8 bridge) | |||
1345 | return 0; | 1345 | return 0; |
1346 | } else { | 1346 | } else { |
1347 | /* have gone through the list of devices and haven't found n.e.thing */ | 1347 | /* have gone through the list of devices and haven't found n.e.thing */ |
1348 | err ("no appropriate range.. bailing out...\n"); | 1348 | err("no appropriate range.. bailing out...\n"); |
1349 | return -EINVAL; | 1349 | return -EINVAL; |
1350 | } | 1350 | } |
1351 | } | 1351 | } |
@@ -1359,23 +1359,23 @@ int ibmphp_check_resource (struct resource_node *res, u8 bridge) | |||
1359 | * Input: Bus | 1359 | * Input: Bus |
1360 | * Output: 0, -ENODEV | 1360 | * Output: 0, -ENODEV |
1361 | ********************************************************************************/ | 1361 | ********************************************************************************/ |
1362 | int ibmphp_remove_bus (struct bus_node *bus, u8 parent_busno) | 1362 | int ibmphp_remove_bus(struct bus_node *bus, u8 parent_busno) |
1363 | { | 1363 | { |
1364 | struct resource_node *res_cur; | 1364 | struct resource_node *res_cur; |
1365 | struct resource_node *res_tmp; | 1365 | struct resource_node *res_tmp; |
1366 | struct bus_node *prev_bus; | 1366 | struct bus_node *prev_bus; |
1367 | int rc; | 1367 | int rc; |
1368 | 1368 | ||
1369 | prev_bus = find_bus_wprev (parent_busno, NULL, 0); | 1369 | prev_bus = find_bus_wprev(parent_busno, NULL, 0); |
1370 | 1370 | ||
1371 | if (!prev_bus) { | 1371 | if (!prev_bus) { |
1372 | debug ("something terribly wrong. Cannot find parent bus to the one to remove\n"); | 1372 | debug("something terribly wrong. Cannot find parent bus to the one to remove\n"); |
1373 | return -ENODEV; | 1373 | return -ENODEV; |
1374 | } | 1374 | } |
1375 | 1375 | ||
1376 | debug ("In ibmphp_remove_bus... prev_bus->busno is %x\n", prev_bus->busno); | 1376 | debug("In ibmphp_remove_bus... prev_bus->busno is %x\n", prev_bus->busno); |
1377 | 1377 | ||
1378 | rc = remove_ranges (bus, prev_bus); | 1378 | rc = remove_ranges(bus, prev_bus); |
1379 | if (rc) | 1379 | if (rc) |
1380 | return rc; | 1380 | return rc; |
1381 | 1381 | ||
@@ -1387,7 +1387,7 @@ int ibmphp_remove_bus (struct bus_node *bus, u8 parent_busno) | |||
1387 | res_cur = res_cur->next; | 1387 | res_cur = res_cur->next; |
1388 | else | 1388 | else |
1389 | res_cur = res_cur->nextRange; | 1389 | res_cur = res_cur->nextRange; |
1390 | kfree (res_tmp); | 1390 | kfree(res_tmp); |
1391 | res_tmp = NULL; | 1391 | res_tmp = NULL; |
1392 | } | 1392 | } |
1393 | bus->firstIO = NULL; | 1393 | bus->firstIO = NULL; |
@@ -1400,7 +1400,7 @@ int ibmphp_remove_bus (struct bus_node *bus, u8 parent_busno) | |||
1400 | res_cur = res_cur->next; | 1400 | res_cur = res_cur->next; |
1401 | else | 1401 | else |
1402 | res_cur = res_cur->nextRange; | 1402 | res_cur = res_cur->nextRange; |
1403 | kfree (res_tmp); | 1403 | kfree(res_tmp); |
1404 | res_tmp = NULL; | 1404 | res_tmp = NULL; |
1405 | } | 1405 | } |
1406 | bus->firstMem = NULL; | 1406 | bus->firstMem = NULL; |
@@ -1413,7 +1413,7 @@ int ibmphp_remove_bus (struct bus_node *bus, u8 parent_busno) | |||
1413 | res_cur = res_cur->next; | 1413 | res_cur = res_cur->next; |
1414 | else | 1414 | else |
1415 | res_cur = res_cur->nextRange; | 1415 | res_cur = res_cur->nextRange; |
1416 | kfree (res_tmp); | 1416 | kfree(res_tmp); |
1417 | res_tmp = NULL; | 1417 | res_tmp = NULL; |
1418 | } | 1418 | } |
1419 | bus->firstPFMem = NULL; | 1419 | bus->firstPFMem = NULL; |
@@ -1425,14 +1425,14 @@ int ibmphp_remove_bus (struct bus_node *bus, u8 parent_busno) | |||
1425 | res_tmp = res_cur; | 1425 | res_tmp = res_cur; |
1426 | res_cur = res_cur->next; | 1426 | res_cur = res_cur->next; |
1427 | 1427 | ||
1428 | kfree (res_tmp); | 1428 | kfree(res_tmp); |
1429 | res_tmp = NULL; | 1429 | res_tmp = NULL; |
1430 | } | 1430 | } |
1431 | bus->firstPFMemFromMem = NULL; | 1431 | bus->firstPFMemFromMem = NULL; |
1432 | } | 1432 | } |
1433 | 1433 | ||
1434 | list_del (&bus->bus_list); | 1434 | list_del(&bus->bus_list); |
1435 | kfree (bus); | 1435 | kfree(bus); |
1436 | return 0; | 1436 | return 0; |
1437 | } | 1437 | } |
1438 | 1438 | ||
@@ -1442,7 +1442,7 @@ int ibmphp_remove_bus (struct bus_node *bus, u8 parent_busno) | |||
1442 | * Input: current bus, previous bus | 1442 | * Input: current bus, previous bus |
1443 | * Output: 0, -EINVAL | 1443 | * Output: 0, -EINVAL |
1444 | ******************************************************************************/ | 1444 | ******************************************************************************/ |
1445 | static int remove_ranges (struct bus_node *bus_cur, struct bus_node *bus_prev) | 1445 | static int remove_ranges(struct bus_node *bus_cur, struct bus_node *bus_prev) |
1446 | { | 1446 | { |
1447 | struct range_node *range_cur; | 1447 | struct range_node *range_cur; |
1448 | struct range_node *range_tmp; | 1448 | struct range_node *range_tmp; |
@@ -1452,13 +1452,13 @@ static int remove_ranges (struct bus_node *bus_cur, struct bus_node *bus_prev) | |||
1452 | if (bus_cur->noIORanges) { | 1452 | if (bus_cur->noIORanges) { |
1453 | range_cur = bus_cur->rangeIO; | 1453 | range_cur = bus_cur->rangeIO; |
1454 | for (i = 0; i < bus_cur->noIORanges; i++) { | 1454 | for (i = 0; i < bus_cur->noIORanges; i++) { |
1455 | if (ibmphp_find_resource (bus_prev, range_cur->start, &res, IO) < 0) | 1455 | if (ibmphp_find_resource(bus_prev, range_cur->start, &res, IO) < 0) |
1456 | return -EINVAL; | 1456 | return -EINVAL; |
1457 | ibmphp_remove_resource (res); | 1457 | ibmphp_remove_resource(res); |
1458 | 1458 | ||
1459 | range_tmp = range_cur; | 1459 | range_tmp = range_cur; |
1460 | range_cur = range_cur->next; | 1460 | range_cur = range_cur->next; |
1461 | kfree (range_tmp); | 1461 | kfree(range_tmp); |
1462 | range_tmp = NULL; | 1462 | range_tmp = NULL; |
1463 | } | 1463 | } |
1464 | bus_cur->rangeIO = NULL; | 1464 | bus_cur->rangeIO = NULL; |
@@ -1466,13 +1466,13 @@ static int remove_ranges (struct bus_node *bus_cur, struct bus_node *bus_prev) | |||
1466 | if (bus_cur->noMemRanges) { | 1466 | if (bus_cur->noMemRanges) { |
1467 | range_cur = bus_cur->rangeMem; | 1467 | range_cur = bus_cur->rangeMem; |
1468 | for (i = 0; i < bus_cur->noMemRanges; i++) { | 1468 | for (i = 0; i < bus_cur->noMemRanges; i++) { |
1469 | if (ibmphp_find_resource (bus_prev, range_cur->start, &res, MEM) < 0) | 1469 | if (ibmphp_find_resource(bus_prev, range_cur->start, &res, MEM) < 0) |
1470 | return -EINVAL; | 1470 | return -EINVAL; |
1471 | 1471 | ||
1472 | ibmphp_remove_resource (res); | 1472 | ibmphp_remove_resource(res); |
1473 | range_tmp = range_cur; | 1473 | range_tmp = range_cur; |
1474 | range_cur = range_cur->next; | 1474 | range_cur = range_cur->next; |
1475 | kfree (range_tmp); | 1475 | kfree(range_tmp); |
1476 | range_tmp = NULL; | 1476 | range_tmp = NULL; |
1477 | } | 1477 | } |
1478 | bus_cur->rangeMem = NULL; | 1478 | bus_cur->rangeMem = NULL; |
@@ -1480,13 +1480,13 @@ static int remove_ranges (struct bus_node *bus_cur, struct bus_node *bus_prev) | |||
1480 | if (bus_cur->noPFMemRanges) { | 1480 | if (bus_cur->noPFMemRanges) { |
1481 | range_cur = bus_cur->rangePFMem; | 1481 | range_cur = bus_cur->rangePFMem; |
1482 | for (i = 0; i < bus_cur->noPFMemRanges; i++) { | 1482 | for (i = 0; i < bus_cur->noPFMemRanges; i++) { |
1483 | if (ibmphp_find_resource (bus_prev, range_cur->start, &res, PFMEM) < 0) | 1483 | if (ibmphp_find_resource(bus_prev, range_cur->start, &res, PFMEM) < 0) |
1484 | return -EINVAL; | 1484 | return -EINVAL; |
1485 | 1485 | ||
1486 | ibmphp_remove_resource (res); | 1486 | ibmphp_remove_resource(res); |
1487 | range_tmp = range_cur; | 1487 | range_tmp = range_cur; |
1488 | range_cur = range_cur->next; | 1488 | range_cur = range_cur->next; |
1489 | kfree (range_tmp); | 1489 | kfree(range_tmp); |
1490 | range_tmp = NULL; | 1490 | range_tmp = NULL; |
1491 | } | 1491 | } |
1492 | bus_cur->rangePFMem = NULL; | 1492 | bus_cur->rangePFMem = NULL; |
@@ -1498,13 +1498,13 @@ static int remove_ranges (struct bus_node *bus_cur, struct bus_node *bus_prev) | |||
1498 | * find the resource node in the bus | 1498 | * find the resource node in the bus |
1499 | * Input: Resource needed, start address of the resource, type of resource | 1499 | * Input: Resource needed, start address of the resource, type of resource |
1500 | */ | 1500 | */ |
1501 | int ibmphp_find_resource (struct bus_node *bus, u32 start_address, struct resource_node **res, int flag) | 1501 | int ibmphp_find_resource(struct bus_node *bus, u32 start_address, struct resource_node **res, int flag) |
1502 | { | 1502 | { |
1503 | struct resource_node *res_cur = NULL; | 1503 | struct resource_node *res_cur = NULL; |
1504 | char * type = ""; | 1504 | char *type = ""; |
1505 | 1505 | ||
1506 | if (!bus) { | 1506 | if (!bus) { |
1507 | err ("The bus passed in NULL to find resource\n"); | 1507 | err("The bus passed in NULL to find resource\n"); |
1508 | return -ENODEV; | 1508 | return -ENODEV; |
1509 | } | 1509 | } |
1510 | 1510 | ||
@@ -1522,7 +1522,7 @@ int ibmphp_find_resource (struct bus_node *bus, u32 start_address, struct resour | |||
1522 | type = "pfmem"; | 1522 | type = "pfmem"; |
1523 | break; | 1523 | break; |
1524 | default: | 1524 | default: |
1525 | err ("wrong type of flag\n"); | 1525 | err("wrong type of flag\n"); |
1526 | return -EINVAL; | 1526 | return -EINVAL; |
1527 | } | 1527 | } |
1528 | 1528 | ||
@@ -1548,17 +1548,17 @@ int ibmphp_find_resource (struct bus_node *bus, u32 start_address, struct resour | |||
1548 | res_cur = res_cur->next; | 1548 | res_cur = res_cur->next; |
1549 | } | 1549 | } |
1550 | if (!res_cur) { | 1550 | if (!res_cur) { |
1551 | debug ("SOS...cannot find %s resource in the bus.\n", type); | 1551 | debug("SOS...cannot find %s resource in the bus.\n", type); |
1552 | return -EINVAL; | 1552 | return -EINVAL; |
1553 | } | 1553 | } |
1554 | } else { | 1554 | } else { |
1555 | debug ("SOS... cannot find %s resource in the bus.\n", type); | 1555 | debug("SOS... cannot find %s resource in the bus.\n", type); |
1556 | return -EINVAL; | 1556 | return -EINVAL; |
1557 | } | 1557 | } |
1558 | } | 1558 | } |
1559 | 1559 | ||
1560 | if (*res) | 1560 | if (*res) |
1561 | debug ("*res->start = %x\n", (*res)->start); | 1561 | debug("*res->start = %x\n", (*res)->start); |
1562 | 1562 | ||
1563 | return 0; | 1563 | return 0; |
1564 | } | 1564 | } |
@@ -1569,7 +1569,7 @@ int ibmphp_find_resource (struct bus_node *bus, u32 start_address, struct resour | |||
1569 | * Parameters: none | 1569 | * Parameters: none |
1570 | * Returns: none | 1570 | * Returns: none |
1571 | ***********************************************************************/ | 1571 | ***********************************************************************/ |
1572 | void ibmphp_free_resources (void) | 1572 | void ibmphp_free_resources(void) |
1573 | { | 1573 | { |
1574 | struct bus_node *bus_cur = NULL; | 1574 | struct bus_node *bus_cur = NULL; |
1575 | struct bus_node *bus_tmp; | 1575 | struct bus_node *bus_tmp; |
@@ -1582,8 +1582,8 @@ void ibmphp_free_resources (void) | |||
1582 | int i = 0; | 1582 | int i = 0; |
1583 | flags = 1; | 1583 | flags = 1; |
1584 | 1584 | ||
1585 | list_for_each_safe (tmp, next, &gbuses) { | 1585 | list_for_each_safe(tmp, next, &gbuses) { |
1586 | bus_cur = list_entry (tmp, struct bus_node, bus_list); | 1586 | bus_cur = list_entry(tmp, struct bus_node, bus_list); |
1587 | if (bus_cur->noIORanges) { | 1587 | if (bus_cur->noIORanges) { |
1588 | range_cur = bus_cur->rangeIO; | 1588 | range_cur = bus_cur->rangeIO; |
1589 | for (i = 0; i < bus_cur->noIORanges; i++) { | 1589 | for (i = 0; i < bus_cur->noIORanges; i++) { |
@@ -1591,7 +1591,7 @@ void ibmphp_free_resources (void) | |||
1591 | break; | 1591 | break; |
1592 | range_tmp = range_cur; | 1592 | range_tmp = range_cur; |
1593 | range_cur = range_cur->next; | 1593 | range_cur = range_cur->next; |
1594 | kfree (range_tmp); | 1594 | kfree(range_tmp); |
1595 | range_tmp = NULL; | 1595 | range_tmp = NULL; |
1596 | } | 1596 | } |
1597 | } | 1597 | } |
@@ -1602,7 +1602,7 @@ void ibmphp_free_resources (void) | |||
1602 | break; | 1602 | break; |
1603 | range_tmp = range_cur; | 1603 | range_tmp = range_cur; |
1604 | range_cur = range_cur->next; | 1604 | range_cur = range_cur->next; |
1605 | kfree (range_tmp); | 1605 | kfree(range_tmp); |
1606 | range_tmp = NULL; | 1606 | range_tmp = NULL; |
1607 | } | 1607 | } |
1608 | } | 1608 | } |
@@ -1613,7 +1613,7 @@ void ibmphp_free_resources (void) | |||
1613 | break; | 1613 | break; |
1614 | range_tmp = range_cur; | 1614 | range_tmp = range_cur; |
1615 | range_cur = range_cur->next; | 1615 | range_cur = range_cur->next; |
1616 | kfree (range_tmp); | 1616 | kfree(range_tmp); |
1617 | range_tmp = NULL; | 1617 | range_tmp = NULL; |
1618 | } | 1618 | } |
1619 | } | 1619 | } |
@@ -1626,7 +1626,7 @@ void ibmphp_free_resources (void) | |||
1626 | res_cur = res_cur->next; | 1626 | res_cur = res_cur->next; |
1627 | else | 1627 | else |
1628 | res_cur = res_cur->nextRange; | 1628 | res_cur = res_cur->nextRange; |
1629 | kfree (res_tmp); | 1629 | kfree(res_tmp); |
1630 | res_tmp = NULL; | 1630 | res_tmp = NULL; |
1631 | } | 1631 | } |
1632 | bus_cur->firstIO = NULL; | 1632 | bus_cur->firstIO = NULL; |
@@ -1639,7 +1639,7 @@ void ibmphp_free_resources (void) | |||
1639 | res_cur = res_cur->next; | 1639 | res_cur = res_cur->next; |
1640 | else | 1640 | else |
1641 | res_cur = res_cur->nextRange; | 1641 | res_cur = res_cur->nextRange; |
1642 | kfree (res_tmp); | 1642 | kfree(res_tmp); |
1643 | res_tmp = NULL; | 1643 | res_tmp = NULL; |
1644 | } | 1644 | } |
1645 | bus_cur->firstMem = NULL; | 1645 | bus_cur->firstMem = NULL; |
@@ -1652,7 +1652,7 @@ void ibmphp_free_resources (void) | |||
1652 | res_cur = res_cur->next; | 1652 | res_cur = res_cur->next; |
1653 | else | 1653 | else |
1654 | res_cur = res_cur->nextRange; | 1654 | res_cur = res_cur->nextRange; |
1655 | kfree (res_tmp); | 1655 | kfree(res_tmp); |
1656 | res_tmp = NULL; | 1656 | res_tmp = NULL; |
1657 | } | 1657 | } |
1658 | bus_cur->firstPFMem = NULL; | 1658 | bus_cur->firstPFMem = NULL; |
@@ -1664,15 +1664,15 @@ void ibmphp_free_resources (void) | |||
1664 | res_tmp = res_cur; | 1664 | res_tmp = res_cur; |
1665 | res_cur = res_cur->next; | 1665 | res_cur = res_cur->next; |
1666 | 1666 | ||
1667 | kfree (res_tmp); | 1667 | kfree(res_tmp); |
1668 | res_tmp = NULL; | 1668 | res_tmp = NULL; |
1669 | } | 1669 | } |
1670 | bus_cur->firstPFMemFromMem = NULL; | 1670 | bus_cur->firstPFMemFromMem = NULL; |
1671 | } | 1671 | } |
1672 | 1672 | ||
1673 | bus_tmp = bus_cur; | 1673 | bus_tmp = bus_cur; |
1674 | list_del (&bus_cur->bus_list); | 1674 | list_del(&bus_cur->bus_list); |
1675 | kfree (bus_tmp); | 1675 | kfree(bus_tmp); |
1676 | bus_tmp = NULL; | 1676 | bus_tmp = NULL; |
1677 | } | 1677 | } |
1678 | } | 1678 | } |
@@ -1685,7 +1685,7 @@ void ibmphp_free_resources (void) | |||
1685 | * a new Mem node | 1685 | * a new Mem node |
1686 | * This routine is called right after initialization | 1686 | * This routine is called right after initialization |
1687 | *******************************************************************************/ | 1687 | *******************************************************************************/ |
1688 | static int __init once_over (void) | 1688 | static int __init once_over(void) |
1689 | { | 1689 | { |
1690 | struct resource_node *pfmem_cur; | 1690 | struct resource_node *pfmem_cur; |
1691 | struct resource_node *pfmem_prev; | 1691 | struct resource_node *pfmem_prev; |
@@ -1693,8 +1693,8 @@ static int __init once_over (void) | |||
1693 | struct bus_node *bus_cur; | 1693 | struct bus_node *bus_cur; |
1694 | struct list_head *tmp; | 1694 | struct list_head *tmp; |
1695 | 1695 | ||
1696 | list_for_each (tmp, &gbuses) { | 1696 | list_for_each(tmp, &gbuses) { |
1697 | bus_cur = list_entry (tmp, struct bus_node, bus_list); | 1697 | bus_cur = list_entry(tmp, struct bus_node, bus_list); |
1698 | if ((!bus_cur->rangePFMem) && (bus_cur->firstPFMem)) { | 1698 | if ((!bus_cur->rangePFMem) && (bus_cur->firstPFMem)) { |
1699 | for (pfmem_cur = bus_cur->firstPFMem, pfmem_prev = NULL; pfmem_cur; pfmem_prev = pfmem_cur, pfmem_cur = pfmem_cur->next) { | 1699 | for (pfmem_cur = bus_cur->firstPFMem, pfmem_prev = NULL; pfmem_cur; pfmem_prev = pfmem_cur, pfmem_cur = pfmem_cur->next) { |
1700 | pfmem_cur->fromMem = 1; | 1700 | pfmem_cur->fromMem = 1; |
@@ -1716,7 +1716,7 @@ static int __init once_over (void) | |||
1716 | 1716 | ||
1717 | mem = kzalloc(sizeof(struct resource_node), GFP_KERNEL); | 1717 | mem = kzalloc(sizeof(struct resource_node), GFP_KERNEL); |
1718 | if (!mem) { | 1718 | if (!mem) { |
1719 | err ("out of system memory\n"); | 1719 | err("out of system memory\n"); |
1720 | return -ENOMEM; | 1720 | return -ENOMEM; |
1721 | } | 1721 | } |
1722 | mem->type = MEM; | 1722 | mem->type = MEM; |
@@ -1725,8 +1725,8 @@ static int __init once_over (void) | |||
1725 | mem->start = pfmem_cur->start; | 1725 | mem->start = pfmem_cur->start; |
1726 | mem->end = pfmem_cur->end; | 1726 | mem->end = pfmem_cur->end; |
1727 | mem->len = pfmem_cur->len; | 1727 | mem->len = pfmem_cur->len; |
1728 | if (ibmphp_add_resource (mem) < 0) | 1728 | if (ibmphp_add_resource(mem) < 0) |
1729 | err ("Trouble...trouble... EBDA allocated pfmem from mem, but system doesn't display it has this space... unless not PCI device...\n"); | 1729 | err("Trouble...trouble... EBDA allocated pfmem from mem, but system doesn't display it has this space... unless not PCI device...\n"); |
1730 | pfmem_cur->rangeno = mem->rangeno; | 1730 | pfmem_cur->rangeno = mem->rangeno; |
1731 | } /* end for pfmem */ | 1731 | } /* end for pfmem */ |
1732 | } /* end if */ | 1732 | } /* end if */ |
@@ -1734,12 +1734,12 @@ static int __init once_over (void) | |||
1734 | return 0; | 1734 | return 0; |
1735 | } | 1735 | } |
1736 | 1736 | ||
1737 | int ibmphp_add_pfmem_from_mem (struct resource_node *pfmem) | 1737 | int ibmphp_add_pfmem_from_mem(struct resource_node *pfmem) |
1738 | { | 1738 | { |
1739 | struct bus_node *bus_cur = find_bus_wprev (pfmem->busno, NULL, 0); | 1739 | struct bus_node *bus_cur = find_bus_wprev(pfmem->busno, NULL, 0); |
1740 | 1740 | ||
1741 | if (!bus_cur) { | 1741 | if (!bus_cur) { |
1742 | err ("cannot find bus of pfmem to add...\n"); | 1742 | err("cannot find bus of pfmem to add...\n"); |
1743 | return -ENODEV; | 1743 | return -ENODEV; |
1744 | } | 1744 | } |
1745 | 1745 | ||
@@ -1759,22 +1759,22 @@ int ibmphp_add_pfmem_from_mem (struct resource_node *pfmem) | |||
1759 | * Parameters: bus_number | 1759 | * Parameters: bus_number |
1760 | * Returns: Bus pointer or NULL | 1760 | * Returns: Bus pointer or NULL |
1761 | */ | 1761 | */ |
1762 | struct bus_node *ibmphp_find_res_bus (u8 bus_number) | 1762 | struct bus_node *ibmphp_find_res_bus(u8 bus_number) |
1763 | { | 1763 | { |
1764 | return find_bus_wprev (bus_number, NULL, 0); | 1764 | return find_bus_wprev(bus_number, NULL, 0); |
1765 | } | 1765 | } |
1766 | 1766 | ||
1767 | static struct bus_node *find_bus_wprev (u8 bus_number, struct bus_node **prev, u8 flag) | 1767 | static struct bus_node *find_bus_wprev(u8 bus_number, struct bus_node **prev, u8 flag) |
1768 | { | 1768 | { |
1769 | struct bus_node *bus_cur; | 1769 | struct bus_node *bus_cur; |
1770 | struct list_head *tmp; | 1770 | struct list_head *tmp; |
1771 | struct list_head *tmp_prev; | 1771 | struct list_head *tmp_prev; |
1772 | 1772 | ||
1773 | list_for_each (tmp, &gbuses) { | 1773 | list_for_each(tmp, &gbuses) { |
1774 | tmp_prev = tmp->prev; | 1774 | tmp_prev = tmp->prev; |
1775 | bus_cur = list_entry (tmp, struct bus_node, bus_list); | 1775 | bus_cur = list_entry(tmp, struct bus_node, bus_list); |
1776 | if (flag) | 1776 | if (flag) |
1777 | *prev = list_entry (tmp_prev, struct bus_node, bus_list); | 1777 | *prev = list_entry(tmp_prev, struct bus_node, bus_list); |
1778 | if (bus_cur->busno == bus_number) | 1778 | if (bus_cur->busno == bus_number) |
1779 | return bus_cur; | 1779 | return bus_cur; |
1780 | } | 1780 | } |
@@ -1782,7 +1782,7 @@ static struct bus_node *find_bus_wprev (u8 bus_number, struct bus_node **prev, u | |||
1782 | return NULL; | 1782 | return NULL; |
1783 | } | 1783 | } |
1784 | 1784 | ||
1785 | void ibmphp_print_test (void) | 1785 | void ibmphp_print_test(void) |
1786 | { | 1786 | { |
1787 | int i = 0; | 1787 | int i = 0; |
1788 | struct bus_node *bus_cur = NULL; | 1788 | struct bus_node *bus_cur = NULL; |
@@ -1790,59 +1790,59 @@ void ibmphp_print_test (void) | |||
1790 | struct resource_node *res; | 1790 | struct resource_node *res; |
1791 | struct list_head *tmp; | 1791 | struct list_head *tmp; |
1792 | 1792 | ||
1793 | debug_pci ("*****************START**********************\n"); | 1793 | debug_pci("*****************START**********************\n"); |
1794 | 1794 | ||
1795 | if ((!list_empty(&gbuses)) && flags) { | 1795 | if ((!list_empty(&gbuses)) && flags) { |
1796 | err ("The GBUSES is not NULL?!?!?!?!?\n"); | 1796 | err("The GBUSES is not NULL?!?!?!?!?\n"); |
1797 | return; | 1797 | return; |
1798 | } | 1798 | } |
1799 | 1799 | ||
1800 | list_for_each (tmp, &gbuses) { | 1800 | list_for_each(tmp, &gbuses) { |
1801 | bus_cur = list_entry (tmp, struct bus_node, bus_list); | 1801 | bus_cur = list_entry(tmp, struct bus_node, bus_list); |
1802 | debug_pci ("This is bus # %d. There are\n", bus_cur->busno); | 1802 | debug_pci("This is bus # %d. There are\n", bus_cur->busno); |
1803 | debug_pci ("IORanges = %d\t", bus_cur->noIORanges); | 1803 | debug_pci("IORanges = %d\t", bus_cur->noIORanges); |
1804 | debug_pci ("MemRanges = %d\t", bus_cur->noMemRanges); | 1804 | debug_pci("MemRanges = %d\t", bus_cur->noMemRanges); |
1805 | debug_pci ("PFMemRanges = %d\n", bus_cur->noPFMemRanges); | 1805 | debug_pci("PFMemRanges = %d\n", bus_cur->noPFMemRanges); |
1806 | debug_pci ("The IO Ranges are as follows:\n"); | 1806 | debug_pci("The IO Ranges are as follows:\n"); |
1807 | if (bus_cur->rangeIO) { | 1807 | if (bus_cur->rangeIO) { |
1808 | range = bus_cur->rangeIO; | 1808 | range = bus_cur->rangeIO; |
1809 | for (i = 0; i < bus_cur->noIORanges; i++) { | 1809 | for (i = 0; i < bus_cur->noIORanges; i++) { |
1810 | debug_pci ("rangeno is %d\n", range->rangeno); | 1810 | debug_pci("rangeno is %d\n", range->rangeno); |
1811 | debug_pci ("[%x - %x]\n", range->start, range->end); | 1811 | debug_pci("[%x - %x]\n", range->start, range->end); |
1812 | range = range->next; | 1812 | range = range->next; |
1813 | } | 1813 | } |
1814 | } | 1814 | } |
1815 | 1815 | ||
1816 | debug_pci ("The Mem Ranges are as follows:\n"); | 1816 | debug_pci("The Mem Ranges are as follows:\n"); |
1817 | if (bus_cur->rangeMem) { | 1817 | if (bus_cur->rangeMem) { |
1818 | range = bus_cur->rangeMem; | 1818 | range = bus_cur->rangeMem; |
1819 | for (i = 0; i < bus_cur->noMemRanges; i++) { | 1819 | for (i = 0; i < bus_cur->noMemRanges; i++) { |
1820 | debug_pci ("rangeno is %d\n", range->rangeno); | 1820 | debug_pci("rangeno is %d\n", range->rangeno); |
1821 | debug_pci ("[%x - %x]\n", range->start, range->end); | 1821 | debug_pci("[%x - %x]\n", range->start, range->end); |
1822 | range = range->next; | 1822 | range = range->next; |
1823 | } | 1823 | } |
1824 | } | 1824 | } |
1825 | 1825 | ||
1826 | debug_pci ("The PFMem Ranges are as follows:\n"); | 1826 | debug_pci("The PFMem Ranges are as follows:\n"); |
1827 | 1827 | ||
1828 | if (bus_cur->rangePFMem) { | 1828 | if (bus_cur->rangePFMem) { |
1829 | range = bus_cur->rangePFMem; | 1829 | range = bus_cur->rangePFMem; |
1830 | for (i = 0; i < bus_cur->noPFMemRanges; i++) { | 1830 | for (i = 0; i < bus_cur->noPFMemRanges; i++) { |
1831 | debug_pci ("rangeno is %d\n", range->rangeno); | 1831 | debug_pci("rangeno is %d\n", range->rangeno); |
1832 | debug_pci ("[%x - %x]\n", range->start, range->end); | 1832 | debug_pci("[%x - %x]\n", range->start, range->end); |
1833 | range = range->next; | 1833 | range = range->next; |
1834 | } | 1834 | } |
1835 | } | 1835 | } |
1836 | 1836 | ||
1837 | debug_pci ("The resources on this bus are as follows\n"); | 1837 | debug_pci("The resources on this bus are as follows\n"); |
1838 | 1838 | ||
1839 | debug_pci ("IO...\n"); | 1839 | debug_pci("IO...\n"); |
1840 | if (bus_cur->firstIO) { | 1840 | if (bus_cur->firstIO) { |
1841 | res = bus_cur->firstIO; | 1841 | res = bus_cur->firstIO; |
1842 | while (res) { | 1842 | while (res) { |
1843 | debug_pci ("The range # is %d\n", res->rangeno); | 1843 | debug_pci("The range # is %d\n", res->rangeno); |
1844 | debug_pci ("The bus, devfnc is %d, %x\n", res->busno, res->devfunc); | 1844 | debug_pci("The bus, devfnc is %d, %x\n", res->busno, res->devfunc); |
1845 | debug_pci ("[%x - %x], len=%x\n", res->start, res->end, res->len); | 1845 | debug_pci("[%x - %x], len=%x\n", res->start, res->end, res->len); |
1846 | if (res->next) | 1846 | if (res->next) |
1847 | res = res->next; | 1847 | res = res->next; |
1848 | else if (res->nextRange) | 1848 | else if (res->nextRange) |
@@ -1851,13 +1851,13 @@ void ibmphp_print_test (void) | |||
1851 | break; | 1851 | break; |
1852 | } | 1852 | } |
1853 | } | 1853 | } |
1854 | debug_pci ("Mem...\n"); | 1854 | debug_pci("Mem...\n"); |
1855 | if (bus_cur->firstMem) { | 1855 | if (bus_cur->firstMem) { |
1856 | res = bus_cur->firstMem; | 1856 | res = bus_cur->firstMem; |
1857 | while (res) { | 1857 | while (res) { |
1858 | debug_pci ("The range # is %d\n", res->rangeno); | 1858 | debug_pci("The range # is %d\n", res->rangeno); |
1859 | debug_pci ("The bus, devfnc is %d, %x\n", res->busno, res->devfunc); | 1859 | debug_pci("The bus, devfnc is %d, %x\n", res->busno, res->devfunc); |
1860 | debug_pci ("[%x - %x], len=%x\n", res->start, res->end, res->len); | 1860 | debug_pci("[%x - %x], len=%x\n", res->start, res->end, res->len); |
1861 | if (res->next) | 1861 | if (res->next) |
1862 | res = res->next; | 1862 | res = res->next; |
1863 | else if (res->nextRange) | 1863 | else if (res->nextRange) |
@@ -1866,13 +1866,13 @@ void ibmphp_print_test (void) | |||
1866 | break; | 1866 | break; |
1867 | } | 1867 | } |
1868 | } | 1868 | } |
1869 | debug_pci ("PFMem...\n"); | 1869 | debug_pci("PFMem...\n"); |
1870 | if (bus_cur->firstPFMem) { | 1870 | if (bus_cur->firstPFMem) { |
1871 | res = bus_cur->firstPFMem; | 1871 | res = bus_cur->firstPFMem; |
1872 | while (res) { | 1872 | while (res) { |
1873 | debug_pci ("The range # is %d\n", res->rangeno); | 1873 | debug_pci("The range # is %d\n", res->rangeno); |
1874 | debug_pci ("The bus, devfnc is %d, %x\n", res->busno, res->devfunc); | 1874 | debug_pci("The bus, devfnc is %d, %x\n", res->busno, res->devfunc); |
1875 | debug_pci ("[%x - %x], len=%x\n", res->start, res->end, res->len); | 1875 | debug_pci("[%x - %x], len=%x\n", res->start, res->end, res->len); |
1876 | if (res->next) | 1876 | if (res->next) |
1877 | res = res->next; | 1877 | res = res->next; |
1878 | else if (res->nextRange) | 1878 | else if (res->nextRange) |
@@ -1882,23 +1882,23 @@ void ibmphp_print_test (void) | |||
1882 | } | 1882 | } |
1883 | } | 1883 | } |
1884 | 1884 | ||
1885 | debug_pci ("PFMemFromMem...\n"); | 1885 | debug_pci("PFMemFromMem...\n"); |
1886 | if (bus_cur->firstPFMemFromMem) { | 1886 | if (bus_cur->firstPFMemFromMem) { |
1887 | res = bus_cur->firstPFMemFromMem; | 1887 | res = bus_cur->firstPFMemFromMem; |
1888 | while (res) { | 1888 | while (res) { |
1889 | debug_pci ("The range # is %d\n", res->rangeno); | 1889 | debug_pci("The range # is %d\n", res->rangeno); |
1890 | debug_pci ("The bus, devfnc is %d, %x\n", res->busno, res->devfunc); | 1890 | debug_pci("The bus, devfnc is %d, %x\n", res->busno, res->devfunc); |
1891 | debug_pci ("[%x - %x], len=%x\n", res->start, res->end, res->len); | 1891 | debug_pci("[%x - %x], len=%x\n", res->start, res->end, res->len); |
1892 | res = res->next; | 1892 | res = res->next; |
1893 | } | 1893 | } |
1894 | } | 1894 | } |
1895 | } | 1895 | } |
1896 | debug_pci ("***********************END***********************\n"); | 1896 | debug_pci("***********************END***********************\n"); |
1897 | } | 1897 | } |
1898 | 1898 | ||
1899 | static int range_exists_already (struct range_node * range, struct bus_node * bus_cur, u8 type) | 1899 | static int range_exists_already(struct range_node *range, struct bus_node *bus_cur, u8 type) |
1900 | { | 1900 | { |
1901 | struct range_node * range_cur = NULL; | 1901 | struct range_node *range_cur = NULL; |
1902 | switch (type) { | 1902 | switch (type) { |
1903 | case IO: | 1903 | case IO: |
1904 | range_cur = bus_cur->rangeIO; | 1904 | range_cur = bus_cur->rangeIO; |
@@ -1910,7 +1910,7 @@ static int range_exists_already (struct range_node * range, struct bus_node * bu | |||
1910 | range_cur = bus_cur->rangePFMem; | 1910 | range_cur = bus_cur->rangePFMem; |
1911 | break; | 1911 | break; |
1912 | default: | 1912 | default: |
1913 | err ("wrong type passed to find out if range already exists\n"); | 1913 | err("wrong type passed to find out if range already exists\n"); |
1914 | return -ENODEV; | 1914 | return -ENODEV; |
1915 | } | 1915 | } |
1916 | 1916 | ||
@@ -1937,7 +1937,7 @@ static int range_exists_already (struct range_node * range, struct bus_node * bu | |||
1937 | * behind them All these are TO DO. | 1937 | * behind them All these are TO DO. |
1938 | * Also need to add more error checkings... (from fnc returns etc) | 1938 | * Also need to add more error checkings... (from fnc returns etc) |
1939 | */ | 1939 | */ |
1940 | static int __init update_bridge_ranges (struct bus_node **bus) | 1940 | static int __init update_bridge_ranges(struct bus_node **bus) |
1941 | { | 1941 | { |
1942 | u8 sec_busno, device, function, hdr_type, start_io_address, end_io_address; | 1942 | u8 sec_busno, device, function, hdr_type, start_io_address, end_io_address; |
1943 | u16 vendor_id, upper_io_start, upper_io_end, start_mem_address, end_mem_address; | 1943 | u16 vendor_id, upper_io_start, upper_io_end, start_mem_address, end_mem_address; |
@@ -1955,17 +1955,17 @@ static int __init update_bridge_ranges (struct bus_node **bus) | |||
1955 | return -ENODEV; | 1955 | return -ENODEV; |
1956 | ibmphp_pci_bus->number = bus_cur->busno; | 1956 | ibmphp_pci_bus->number = bus_cur->busno; |
1957 | 1957 | ||
1958 | debug ("inside %s\n", __func__); | 1958 | debug("inside %s\n", __func__); |
1959 | debug ("bus_cur->busno = %x\n", bus_cur->busno); | 1959 | debug("bus_cur->busno = %x\n", bus_cur->busno); |
1960 | 1960 | ||
1961 | for (device = 0; device < 32; device++) { | 1961 | for (device = 0; device < 32; device++) { |
1962 | for (function = 0x00; function < 0x08; function++) { | 1962 | for (function = 0x00; function < 0x08; function++) { |
1963 | devfn = PCI_DEVFN(device, function); | 1963 | devfn = PCI_DEVFN(device, function); |
1964 | pci_bus_read_config_word (ibmphp_pci_bus, devfn, PCI_VENDOR_ID, &vendor_id); | 1964 | pci_bus_read_config_word(ibmphp_pci_bus, devfn, PCI_VENDOR_ID, &vendor_id); |
1965 | 1965 | ||
1966 | if (vendor_id != PCI_VENDOR_ID_NOTVALID) { | 1966 | if (vendor_id != PCI_VENDOR_ID_NOTVALID) { |
1967 | /* found correct device!!! */ | 1967 | /* found correct device!!! */ |
1968 | pci_bus_read_config_byte (ibmphp_pci_bus, devfn, PCI_HEADER_TYPE, &hdr_type); | 1968 | pci_bus_read_config_byte(ibmphp_pci_bus, devfn, PCI_HEADER_TYPE, &hdr_type); |
1969 | 1969 | ||
1970 | switch (hdr_type) { | 1970 | switch (hdr_type) { |
1971 | case PCI_HEADER_TYPE_NORMAL: | 1971 | case PCI_HEADER_TYPE_NORMAL: |
@@ -1984,18 +1984,18 @@ static int __init update_bridge_ranges (struct bus_node **bus) | |||
1984 | temp++; | 1984 | temp++; |
1985 | } | 1985 | } |
1986 | */ | 1986 | */ |
1987 | pci_bus_read_config_byte (ibmphp_pci_bus, devfn, PCI_SECONDARY_BUS, &sec_busno); | 1987 | pci_bus_read_config_byte(ibmphp_pci_bus, devfn, PCI_SECONDARY_BUS, &sec_busno); |
1988 | bus_sec = find_bus_wprev (sec_busno, NULL, 0); | 1988 | bus_sec = find_bus_wprev(sec_busno, NULL, 0); |
1989 | /* this bus structure doesn't exist yet, PPB was configured during previous loading of ibmphp */ | 1989 | /* this bus structure doesn't exist yet, PPB was configured during previous loading of ibmphp */ |
1990 | if (!bus_sec) { | 1990 | if (!bus_sec) { |
1991 | bus_sec = alloc_error_bus (NULL, sec_busno, 1); | 1991 | bus_sec = alloc_error_bus(NULL, sec_busno, 1); |
1992 | /* the rest will be populated during NVRAM call */ | 1992 | /* the rest will be populated during NVRAM call */ |
1993 | return 0; | 1993 | return 0; |
1994 | } | 1994 | } |
1995 | pci_bus_read_config_byte (ibmphp_pci_bus, devfn, PCI_IO_BASE, &start_io_address); | 1995 | pci_bus_read_config_byte(ibmphp_pci_bus, devfn, PCI_IO_BASE, &start_io_address); |
1996 | pci_bus_read_config_byte (ibmphp_pci_bus, devfn, PCI_IO_LIMIT, &end_io_address); | 1996 | pci_bus_read_config_byte(ibmphp_pci_bus, devfn, PCI_IO_LIMIT, &end_io_address); |
1997 | pci_bus_read_config_word (ibmphp_pci_bus, devfn, PCI_IO_BASE_UPPER16, &upper_io_start); | 1997 | pci_bus_read_config_word(ibmphp_pci_bus, devfn, PCI_IO_BASE_UPPER16, &upper_io_start); |
1998 | pci_bus_read_config_word (ibmphp_pci_bus, devfn, PCI_IO_LIMIT_UPPER16, &upper_io_end); | 1998 | pci_bus_read_config_word(ibmphp_pci_bus, devfn, PCI_IO_LIMIT_UPPER16, &upper_io_end); |
1999 | start_address = (start_io_address & PCI_IO_RANGE_MASK) << 8; | 1999 | start_address = (start_io_address & PCI_IO_RANGE_MASK) << 8; |
2000 | start_address |= (upper_io_start << 16); | 2000 | start_address |= (upper_io_start << 16); |
2001 | end_address = (end_io_address & PCI_IO_RANGE_MASK) << 8; | 2001 | end_address = (end_io_address & PCI_IO_RANGE_MASK) << 8; |
@@ -2004,18 +2004,18 @@ static int __init update_bridge_ranges (struct bus_node **bus) | |||
2004 | if ((start_address) && (start_address <= end_address)) { | 2004 | if ((start_address) && (start_address <= end_address)) { |
2005 | range = kzalloc(sizeof(struct range_node), GFP_KERNEL); | 2005 | range = kzalloc(sizeof(struct range_node), GFP_KERNEL); |
2006 | if (!range) { | 2006 | if (!range) { |
2007 | err ("out of system memory\n"); | 2007 | err("out of system memory\n"); |
2008 | return -ENOMEM; | 2008 | return -ENOMEM; |
2009 | } | 2009 | } |
2010 | range->start = start_address; | 2010 | range->start = start_address; |
2011 | range->end = end_address + 0xfff; | 2011 | range->end = end_address + 0xfff; |
2012 | 2012 | ||
2013 | if (bus_sec->noIORanges > 0) { | 2013 | if (bus_sec->noIORanges > 0) { |
2014 | if (!range_exists_already (range, bus_sec, IO)) { | 2014 | if (!range_exists_already(range, bus_sec, IO)) { |
2015 | add_bus_range (IO, range, bus_sec); | 2015 | add_bus_range(IO, range, bus_sec); |
2016 | ++bus_sec->noIORanges; | 2016 | ++bus_sec->noIORanges; |
2017 | } else { | 2017 | } else { |
2018 | kfree (range); | 2018 | kfree(range); |
2019 | range = NULL; | 2019 | range = NULL; |
2020 | } | 2020 | } |
2021 | } else { | 2021 | } else { |
@@ -2024,13 +2024,13 @@ static int __init update_bridge_ranges (struct bus_node **bus) | |||
2024 | bus_sec->rangeIO = range; | 2024 | bus_sec->rangeIO = range; |
2025 | ++bus_sec->noIORanges; | 2025 | ++bus_sec->noIORanges; |
2026 | } | 2026 | } |
2027 | fix_resources (bus_sec); | 2027 | fix_resources(bus_sec); |
2028 | 2028 | ||
2029 | if (ibmphp_find_resource (bus_cur, start_address, &io, IO)) { | 2029 | if (ibmphp_find_resource(bus_cur, start_address, &io, IO)) { |
2030 | io = kzalloc(sizeof(struct resource_node), GFP_KERNEL); | 2030 | io = kzalloc(sizeof(struct resource_node), GFP_KERNEL); |
2031 | if (!io) { | 2031 | if (!io) { |
2032 | kfree (range); | 2032 | kfree(range); |
2033 | err ("out of system memory\n"); | 2033 | err("out of system memory\n"); |
2034 | return -ENOMEM; | 2034 | return -ENOMEM; |
2035 | } | 2035 | } |
2036 | io->type = IO; | 2036 | io->type = IO; |
@@ -2039,12 +2039,12 @@ static int __init update_bridge_ranges (struct bus_node **bus) | |||
2039 | io->start = start_address; | 2039 | io->start = start_address; |
2040 | io->end = end_address + 0xfff; | 2040 | io->end = end_address + 0xfff; |
2041 | io->len = io->end - io->start + 1; | 2041 | io->len = io->end - io->start + 1; |
2042 | ibmphp_add_resource (io); | 2042 | ibmphp_add_resource(io); |
2043 | } | 2043 | } |
2044 | } | 2044 | } |
2045 | 2045 | ||
2046 | pci_bus_read_config_word (ibmphp_pci_bus, devfn, PCI_MEMORY_BASE, &start_mem_address); | 2046 | pci_bus_read_config_word(ibmphp_pci_bus, devfn, PCI_MEMORY_BASE, &start_mem_address); |
2047 | pci_bus_read_config_word (ibmphp_pci_bus, devfn, PCI_MEMORY_LIMIT, &end_mem_address); | 2047 | pci_bus_read_config_word(ibmphp_pci_bus, devfn, PCI_MEMORY_LIMIT, &end_mem_address); |
2048 | 2048 | ||
2049 | start_address = 0x00000000 | (start_mem_address & PCI_MEMORY_RANGE_MASK) << 16; | 2049 | start_address = 0x00000000 | (start_mem_address & PCI_MEMORY_RANGE_MASK) << 16; |
2050 | end_address = 0x00000000 | (end_mem_address & PCI_MEMORY_RANGE_MASK) << 16; | 2050 | end_address = 0x00000000 | (end_mem_address & PCI_MEMORY_RANGE_MASK) << 16; |
@@ -2053,18 +2053,18 @@ static int __init update_bridge_ranges (struct bus_node **bus) | |||
2053 | 2053 | ||
2054 | range = kzalloc(sizeof(struct range_node), GFP_KERNEL); | 2054 | range = kzalloc(sizeof(struct range_node), GFP_KERNEL); |
2055 | if (!range) { | 2055 | if (!range) { |
2056 | err ("out of system memory\n"); | 2056 | err("out of system memory\n"); |
2057 | return -ENOMEM; | 2057 | return -ENOMEM; |
2058 | } | 2058 | } |
2059 | range->start = start_address; | 2059 | range->start = start_address; |
2060 | range->end = end_address + 0xfffff; | 2060 | range->end = end_address + 0xfffff; |
2061 | 2061 | ||
2062 | if (bus_sec->noMemRanges > 0) { | 2062 | if (bus_sec->noMemRanges > 0) { |
2063 | if (!range_exists_already (range, bus_sec, MEM)) { | 2063 | if (!range_exists_already(range, bus_sec, MEM)) { |
2064 | add_bus_range (MEM, range, bus_sec); | 2064 | add_bus_range(MEM, range, bus_sec); |
2065 | ++bus_sec->noMemRanges; | 2065 | ++bus_sec->noMemRanges; |
2066 | } else { | 2066 | } else { |
2067 | kfree (range); | 2067 | kfree(range); |
2068 | range = NULL; | 2068 | range = NULL; |
2069 | } | 2069 | } |
2070 | } else { | 2070 | } else { |
@@ -2074,13 +2074,13 @@ static int __init update_bridge_ranges (struct bus_node **bus) | |||
2074 | ++bus_sec->noMemRanges; | 2074 | ++bus_sec->noMemRanges; |
2075 | } | 2075 | } |
2076 | 2076 | ||
2077 | fix_resources (bus_sec); | 2077 | fix_resources(bus_sec); |
2078 | 2078 | ||
2079 | if (ibmphp_find_resource (bus_cur, start_address, &mem, MEM)) { | 2079 | if (ibmphp_find_resource(bus_cur, start_address, &mem, MEM)) { |
2080 | mem = kzalloc(sizeof(struct resource_node), GFP_KERNEL); | 2080 | mem = kzalloc(sizeof(struct resource_node), GFP_KERNEL); |
2081 | if (!mem) { | 2081 | if (!mem) { |
2082 | kfree (range); | 2082 | kfree(range); |
2083 | err ("out of system memory\n"); | 2083 | err("out of system memory\n"); |
2084 | return -ENOMEM; | 2084 | return -ENOMEM; |
2085 | } | 2085 | } |
2086 | mem->type = MEM; | 2086 | mem->type = MEM; |
@@ -2089,13 +2089,13 @@ static int __init update_bridge_ranges (struct bus_node **bus) | |||
2089 | mem->start = start_address; | 2089 | mem->start = start_address; |
2090 | mem->end = end_address + 0xfffff; | 2090 | mem->end = end_address + 0xfffff; |
2091 | mem->len = mem->end - mem->start + 1; | 2091 | mem->len = mem->end - mem->start + 1; |
2092 | ibmphp_add_resource (mem); | 2092 | ibmphp_add_resource(mem); |
2093 | } | 2093 | } |
2094 | } | 2094 | } |
2095 | pci_bus_read_config_word (ibmphp_pci_bus, devfn, PCI_PREF_MEMORY_BASE, &start_mem_address); | 2095 | pci_bus_read_config_word(ibmphp_pci_bus, devfn, PCI_PREF_MEMORY_BASE, &start_mem_address); |
2096 | pci_bus_read_config_word (ibmphp_pci_bus, devfn, PCI_PREF_MEMORY_LIMIT, &end_mem_address); | 2096 | pci_bus_read_config_word(ibmphp_pci_bus, devfn, PCI_PREF_MEMORY_LIMIT, &end_mem_address); |
2097 | pci_bus_read_config_dword (ibmphp_pci_bus, devfn, PCI_PREF_BASE_UPPER32, &upper_start); | 2097 | pci_bus_read_config_dword(ibmphp_pci_bus, devfn, PCI_PREF_BASE_UPPER32, &upper_start); |
2098 | pci_bus_read_config_dword (ibmphp_pci_bus, devfn, PCI_PREF_LIMIT_UPPER32, &upper_end); | 2098 | pci_bus_read_config_dword(ibmphp_pci_bus, devfn, PCI_PREF_LIMIT_UPPER32, &upper_end); |
2099 | start_address = 0x00000000 | (start_mem_address & PCI_MEMORY_RANGE_MASK) << 16; | 2099 | start_address = 0x00000000 | (start_mem_address & PCI_MEMORY_RANGE_MASK) << 16; |
2100 | end_address = 0x00000000 | (end_mem_address & PCI_MEMORY_RANGE_MASK) << 16; | 2100 | end_address = 0x00000000 | (end_mem_address & PCI_MEMORY_RANGE_MASK) << 16; |
2101 | #if BITS_PER_LONG == 64 | 2101 | #if BITS_PER_LONG == 64 |
@@ -2107,18 +2107,18 @@ static int __init update_bridge_ranges (struct bus_node **bus) | |||
2107 | 2107 | ||
2108 | range = kzalloc(sizeof(struct range_node), GFP_KERNEL); | 2108 | range = kzalloc(sizeof(struct range_node), GFP_KERNEL); |
2109 | if (!range) { | 2109 | if (!range) { |
2110 | err ("out of system memory\n"); | 2110 | err("out of system memory\n"); |
2111 | return -ENOMEM; | 2111 | return -ENOMEM; |
2112 | } | 2112 | } |
2113 | range->start = start_address; | 2113 | range->start = start_address; |
2114 | range->end = end_address + 0xfffff; | 2114 | range->end = end_address + 0xfffff; |
2115 | 2115 | ||
2116 | if (bus_sec->noPFMemRanges > 0) { | 2116 | if (bus_sec->noPFMemRanges > 0) { |
2117 | if (!range_exists_already (range, bus_sec, PFMEM)) { | 2117 | if (!range_exists_already(range, bus_sec, PFMEM)) { |
2118 | add_bus_range (PFMEM, range, bus_sec); | 2118 | add_bus_range(PFMEM, range, bus_sec); |
2119 | ++bus_sec->noPFMemRanges; | 2119 | ++bus_sec->noPFMemRanges; |
2120 | } else { | 2120 | } else { |
2121 | kfree (range); | 2121 | kfree(range); |
2122 | range = NULL; | 2122 | range = NULL; |
2123 | } | 2123 | } |
2124 | } else { | 2124 | } else { |
@@ -2128,12 +2128,12 @@ static int __init update_bridge_ranges (struct bus_node **bus) | |||
2128 | ++bus_sec->noPFMemRanges; | 2128 | ++bus_sec->noPFMemRanges; |
2129 | } | 2129 | } |
2130 | 2130 | ||
2131 | fix_resources (bus_sec); | 2131 | fix_resources(bus_sec); |
2132 | if (ibmphp_find_resource (bus_cur, start_address, &pfmem, PFMEM)) { | 2132 | if (ibmphp_find_resource(bus_cur, start_address, &pfmem, PFMEM)) { |
2133 | pfmem = kzalloc(sizeof(struct resource_node), GFP_KERNEL); | 2133 | pfmem = kzalloc(sizeof(struct resource_node), GFP_KERNEL); |
2134 | if (!pfmem) { | 2134 | if (!pfmem) { |
2135 | kfree (range); | 2135 | kfree(range); |
2136 | err ("out of system memory\n"); | 2136 | err("out of system memory\n"); |
2137 | return -ENOMEM; | 2137 | return -ENOMEM; |
2138 | } | 2138 | } |
2139 | pfmem->type = PFMEM; | 2139 | pfmem->type = PFMEM; |
@@ -2144,7 +2144,7 @@ static int __init update_bridge_ranges (struct bus_node **bus) | |||
2144 | pfmem->len = pfmem->end - pfmem->start + 1; | 2144 | pfmem->len = pfmem->end - pfmem->start + 1; |
2145 | pfmem->fromMem = 0; | 2145 | pfmem->fromMem = 0; |
2146 | 2146 | ||
2147 | ibmphp_add_resource (pfmem); | 2147 | ibmphp_add_resource(pfmem); |
2148 | } | 2148 | } |
2149 | } | 2149 | } |
2150 | break; | 2150 | break; |
diff --git a/drivers/pci/hotplug/pci_hotplug_core.c b/drivers/pci/hotplug/pci_hotplug_core.c index d1fab97d6b01..d379d49f733d 100644 --- a/drivers/pci/hotplug/pci_hotplug_core.c +++ b/drivers/pci/hotplug/pci_hotplug_core.c | |||
@@ -45,10 +45,10 @@ | |||
45 | 45 | ||
46 | #define MY_NAME "pci_hotplug" | 46 | #define MY_NAME "pci_hotplug" |
47 | 47 | ||
48 | #define dbg(fmt, arg...) do { if (debug) printk(KERN_DEBUG "%s: %s: " fmt , MY_NAME , __func__ , ## arg); } while (0) | 48 | #define dbg(fmt, arg...) do { if (debug) printk(KERN_DEBUG "%s: %s: " fmt, MY_NAME, __func__, ## arg); } while (0) |
49 | #define err(format, arg...) printk(KERN_ERR "%s: " format , MY_NAME , ## arg) | 49 | #define err(format, arg...) printk(KERN_ERR "%s: " format, MY_NAME, ## arg) |
50 | #define info(format, arg...) printk(KERN_INFO "%s: " format , MY_NAME , ## arg) | 50 | #define info(format, arg...) printk(KERN_INFO "%s: " format, MY_NAME, ## arg) |
51 | #define warn(format, arg...) printk(KERN_WARNING "%s: " format , MY_NAME , ## arg) | 51 | #define warn(format, arg...) printk(KERN_WARNING "%s: " format, MY_NAME, ## arg) |
52 | 52 | ||
53 | 53 | ||
54 | /* local variables */ | 54 | /* local variables */ |
@@ -226,7 +226,7 @@ static ssize_t test_write_file(struct pci_slot *pci_slot, const char *buf, | |||
226 | u32 test; | 226 | u32 test; |
227 | int retval = 0; | 227 | int retval = 0; |
228 | 228 | ||
229 | ltest = simple_strtoul (buf, NULL, 10); | 229 | ltest = simple_strtoul(buf, NULL, 10); |
230 | test = (u32)(ltest & 0xffffffff); | 230 | test = (u32)(ltest & 0xffffffff); |
231 | dbg("test = %d\n", test); | 231 | dbg("test = %d\n", test); |
232 | 232 | ||
diff --git a/drivers/pci/hotplug/pciehp.h b/drivers/pci/hotplug/pciehp.h index 62d6fe6c3714..e764918641ae 100644 --- a/drivers/pci/hotplug/pciehp.h +++ b/drivers/pci/hotplug/pciehp.h | |||
@@ -47,14 +47,14 @@ extern bool pciehp_debug; | |||
47 | #define dbg(format, arg...) \ | 47 | #define dbg(format, arg...) \ |
48 | do { \ | 48 | do { \ |
49 | if (pciehp_debug) \ | 49 | if (pciehp_debug) \ |
50 | printk(KERN_DEBUG "%s: " format, MY_NAME , ## arg); \ | 50 | printk(KERN_DEBUG "%s: " format, MY_NAME, ## arg); \ |
51 | } while (0) | 51 | } while (0) |
52 | #define err(format, arg...) \ | 52 | #define err(format, arg...) \ |
53 | printk(KERN_ERR "%s: " format, MY_NAME , ## arg) | 53 | printk(KERN_ERR "%s: " format, MY_NAME, ## arg) |
54 | #define info(format, arg...) \ | 54 | #define info(format, arg...) \ |
55 | printk(KERN_INFO "%s: " format, MY_NAME , ## arg) | 55 | printk(KERN_INFO "%s: " format, MY_NAME, ## arg) |
56 | #define warn(format, arg...) \ | 56 | #define warn(format, arg...) \ |
57 | printk(KERN_WARNING "%s: " format, MY_NAME , ## arg) | 57 | printk(KERN_WARNING "%s: " format, MY_NAME, ## arg) |
58 | 58 | ||
59 | #define ctrl_dbg(ctrl, format, arg...) \ | 59 | #define ctrl_dbg(ctrl, format, arg...) \ |
60 | do { \ | 60 | do { \ |
diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c index 612b21a14df5..ac531e674a05 100644 --- a/drivers/pci/hotplug/pciehp_core.c +++ b/drivers/pci/hotplug/pciehp_core.c | |||
@@ -62,14 +62,14 @@ MODULE_PARM_DESC(pciehp_force, "Force pciehp, even if OSHP is missing"); | |||
62 | 62 | ||
63 | #define PCIE_MODULE_NAME "pciehp" | 63 | #define PCIE_MODULE_NAME "pciehp" |
64 | 64 | ||
65 | static int set_attention_status (struct hotplug_slot *slot, u8 value); | 65 | static int set_attention_status(struct hotplug_slot *slot, u8 value); |
66 | static int enable_slot (struct hotplug_slot *slot); | 66 | static int enable_slot(struct hotplug_slot *slot); |
67 | static int disable_slot (struct hotplug_slot *slot); | 67 | static int disable_slot(struct hotplug_slot *slot); |
68 | static int get_power_status (struct hotplug_slot *slot, u8 *value); | 68 | static int get_power_status(struct hotplug_slot *slot, u8 *value); |
69 | static int get_attention_status (struct hotplug_slot *slot, u8 *value); | 69 | static int get_attention_status(struct hotplug_slot *slot, u8 *value); |
70 | static int get_latch_status (struct hotplug_slot *slot, u8 *value); | 70 | static int get_latch_status(struct hotplug_slot *slot, u8 *value); |
71 | static int get_adapter_status (struct hotplug_slot *slot, u8 *value); | 71 | static int get_adapter_status(struct hotplug_slot *slot, u8 *value); |
72 | static int reset_slot (struct hotplug_slot *slot, int probe); | 72 | static int reset_slot(struct hotplug_slot *slot, int probe); |
73 | 73 | ||
74 | /** | 74 | /** |
75 | * release_slot - free up the memory used by a slot | 75 | * release_slot - free up the memory used by a slot |
diff --git a/drivers/pci/hotplug/pcihp_skeleton.c b/drivers/pci/hotplug/pcihp_skeleton.c index d062c008fc95..cade1411e23c 100644 --- a/drivers/pci/hotplug/pcihp_skeleton.c +++ b/drivers/pci/hotplug/pcihp_skeleton.c | |||
@@ -52,11 +52,11 @@ static LIST_HEAD(slot_list); | |||
52 | do { \ | 52 | do { \ |
53 | if (debug) \ | 53 | if (debug) \ |
54 | printk(KERN_DEBUG "%s: " format "\n", \ | 54 | printk(KERN_DEBUG "%s: " format "\n", \ |
55 | MY_NAME , ## arg); \ | 55 | MY_NAME, ## arg); \ |
56 | } while (0) | 56 | } while (0) |
57 | #define err(format, arg...) printk(KERN_ERR "%s: " format "\n", MY_NAME , ## arg) | 57 | #define err(format, arg...) printk(KERN_ERR "%s: " format "\n", MY_NAME, ## arg) |
58 | #define info(format, arg...) printk(KERN_INFO "%s: " format "\n", MY_NAME , ## arg) | 58 | #define info(format, arg...) printk(KERN_INFO "%s: " format "\n", MY_NAME, ## arg) |
59 | #define warn(format, arg...) printk(KERN_WARNING "%s: " format "\n", MY_NAME , ## arg) | 59 | #define warn(format, arg...) printk(KERN_WARNING "%s: " format "\n", MY_NAME, ## arg) |
60 | 60 | ||
61 | /* local variables */ | 61 | /* local variables */ |
62 | static bool debug; | 62 | static bool debug; |
@@ -72,14 +72,14 @@ MODULE_LICENSE("GPL"); | |||
72 | module_param(debug, bool, 0644); | 72 | module_param(debug, bool, 0644); |
73 | MODULE_PARM_DESC(debug, "Debugging mode enabled or not"); | 73 | MODULE_PARM_DESC(debug, "Debugging mode enabled or not"); |
74 | 74 | ||
75 | static int enable_slot (struct hotplug_slot *slot); | 75 | static int enable_slot(struct hotplug_slot *slot); |
76 | static int disable_slot (struct hotplug_slot *slot); | 76 | static int disable_slot(struct hotplug_slot *slot); |
77 | static int set_attention_status (struct hotplug_slot *slot, u8 value); | 77 | static int set_attention_status(struct hotplug_slot *slot, u8 value); |
78 | static int hardware_test (struct hotplug_slot *slot, u32 value); | 78 | static int hardware_test(struct hotplug_slot *slot, u32 value); |
79 | static int get_power_status (struct hotplug_slot *slot, u8 *value); | 79 | static int get_power_status(struct hotplug_slot *slot, u8 *value); |
80 | static int get_attention_status (struct hotplug_slot *slot, u8 *value); | 80 | static int get_attention_status(struct hotplug_slot *slot, u8 *value); |
81 | static int get_latch_status (struct hotplug_slot *slot, u8 *value); | 81 | static int get_latch_status(struct hotplug_slot *slot, u8 *value); |
82 | static int get_adapter_status (struct hotplug_slot *slot, u8 *value); | 82 | static int get_adapter_status(struct hotplug_slot *slot, u8 *value); |
83 | 83 | ||
84 | static struct hotplug_slot_ops skel_hotplug_slot_ops = { | 84 | static struct hotplug_slot_ops skel_hotplug_slot_ops = { |
85 | .enable_slot = enable_slot, | 85 | .enable_slot = enable_slot, |
diff --git a/drivers/pci/hotplug/rpaphp.h b/drivers/pci/hotplug/rpaphp.h index b2593e876a09..7db024e68fe6 100644 --- a/drivers/pci/hotplug/rpaphp.h +++ b/drivers/pci/hotplug/rpaphp.h | |||
@@ -51,11 +51,11 @@ extern bool rpaphp_debug; | |||
51 | do { \ | 51 | do { \ |
52 | if (rpaphp_debug) \ | 52 | if (rpaphp_debug) \ |
53 | printk(KERN_DEBUG "%s: " format, \ | 53 | printk(KERN_DEBUG "%s: " format, \ |
54 | MY_NAME , ## arg); \ | 54 | MY_NAME, ## arg); \ |
55 | } while (0) | 55 | } while (0) |
56 | #define err(format, arg...) printk(KERN_ERR "%s: " format, MY_NAME , ## arg) | 56 | #define err(format, arg...) printk(KERN_ERR "%s: " format, MY_NAME, ## arg) |
57 | #define info(format, arg...) printk(KERN_INFO "%s: " format, MY_NAME , ## arg) | 57 | #define info(format, arg...) printk(KERN_INFO "%s: " format, MY_NAME, ## arg) |
58 | #define warn(format, arg...) printk(KERN_WARNING "%s: " format, MY_NAME , ## arg) | 58 | #define warn(format, arg...) printk(KERN_WARNING "%s: " format, MY_NAME, ## arg) |
59 | 59 | ||
60 | /* slot states */ | 60 | /* slot states */ |
61 | 61 | ||
diff --git a/drivers/pci/hotplug/rpaphp_core.c b/drivers/pci/hotplug/rpaphp_core.c index f2945fa73d4f..fd365b498bea 100644 --- a/drivers/pci/hotplug/rpaphp_core.c +++ b/drivers/pci/hotplug/rpaphp_core.c | |||
@@ -94,7 +94,7 @@ static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value) | |||
94 | int retval, level; | 94 | int retval, level; |
95 | struct slot *slot = (struct slot *)hotplug_slot->private; | 95 | struct slot *slot = (struct slot *)hotplug_slot->private; |
96 | 96 | ||
97 | retval = rtas_get_power_level (slot->power_domain, &level); | 97 | retval = rtas_get_power_level(slot->power_domain, &level); |
98 | if (!retval) | 98 | if (!retval) |
99 | *value = level; | 99 | *value = level; |
100 | return retval; | 100 | return retval; |
diff --git a/drivers/pci/hotplug/rpaphp_pci.c b/drivers/pci/hotplug/rpaphp_pci.c index 9243f3e7a1c9..7836d6913e67 100644 --- a/drivers/pci/hotplug/rpaphp_pci.c +++ b/drivers/pci/hotplug/rpaphp_pci.c | |||
@@ -126,7 +126,7 @@ int rpaphp_enable_slot(struct slot *slot) | |||
126 | if (rpaphp_debug) { | 126 | if (rpaphp_debug) { |
127 | struct pci_dev *dev; | 127 | struct pci_dev *dev; |
128 | dbg("%s: pci_devs of slot[%s]\n", __func__, slot->dn->full_name); | 128 | dbg("%s: pci_devs of slot[%s]\n", __func__, slot->dn->full_name); |
129 | list_for_each_entry (dev, &bus->devices, bus_list) | 129 | list_for_each_entry(dev, &bus->devices, bus_list) |
130 | dbg("\t%s\n", pci_name(dev)); | 130 | dbg("\t%s\n", pci_name(dev)); |
131 | } | 131 | } |
132 | } | 132 | } |
diff --git a/drivers/pci/hotplug/rpaphp_slot.c b/drivers/pci/hotplug/rpaphp_slot.c index a6082cc263f7..6937c725b00b 100644 --- a/drivers/pci/hotplug/rpaphp_slot.c +++ b/drivers/pci/hotplug/rpaphp_slot.c | |||
@@ -48,7 +48,7 @@ void dealloc_slot_struct(struct slot *slot) | |||
48 | } | 48 | } |
49 | 49 | ||
50 | struct slot *alloc_slot_struct(struct device_node *dn, | 50 | struct slot *alloc_slot_struct(struct device_node *dn, |
51 | int drc_index, char *drc_name, int power_domain) | 51 | int drc_index, char *drc_name, int power_domain) |
52 | { | 52 | { |
53 | struct slot *slot; | 53 | struct slot *slot; |
54 | 54 | ||
diff --git a/drivers/pci/hotplug/sgi_hotplug.c b/drivers/pci/hotplug/sgi_hotplug.c index c32fb786d48e..339bce0403dd 100644 --- a/drivers/pci/hotplug/sgi_hotplug.c +++ b/drivers/pci/hotplug/sgi_hotplug.c | |||
@@ -99,7 +99,7 @@ static ssize_t path_show(struct pci_slot *pci_slot, char *buf) | |||
99 | if (!slot) | 99 | if (!slot) |
100 | return retval; | 100 | return retval; |
101 | 101 | ||
102 | retval = sprintf (buf, "%s\n", slot->physical_path); | 102 | retval = sprintf(buf, "%s\n", slot->physical_path); |
103 | return retval; | 103 | return retval; |
104 | } | 104 | } |
105 | 105 | ||
@@ -313,7 +313,7 @@ static int sn_slot_disable(struct hotplug_slot *bss_hotplug_slot, | |||
313 | } | 313 | } |
314 | 314 | ||
315 | if ((action == PCI_REQ_SLOT_DISABLE) && rc) { | 315 | if ((action == PCI_REQ_SLOT_DISABLE) && rc) { |
316 | dev_dbg(&slot->pci_bus->self->dev,"remove failed rc = %d\n", rc); | 316 | dev_dbg(&slot->pci_bus->self->dev, "remove failed rc = %d\n", rc); |
317 | } | 317 | } |
318 | 318 | ||
319 | return rc; | 319 | return rc; |
@@ -488,7 +488,7 @@ static int disable_slot(struct hotplug_slot *bss_hotplug_slot) | |||
488 | 488 | ||
489 | /* free the ACPI resources for the slot */ | 489 | /* free the ACPI resources for the slot */ |
490 | if (SN_ACPI_BASE_SUPPORT() && | 490 | if (SN_ACPI_BASE_SUPPORT() && |
491 | PCI_CONTROLLER(slot->pci_bus)->companion) { | 491 | PCI_CONTROLLER(slot->pci_bus)->companion) { |
492 | unsigned long long adr; | 492 | unsigned long long adr; |
493 | struct acpi_device *device; | 493 | struct acpi_device *device; |
494 | acpi_handle phandle; | 494 | acpi_handle phandle; |
diff --git a/drivers/pci/hotplug/shpchp.h b/drivers/pci/hotplug/shpchp.h index 5897d516427b..821227f415e4 100644 --- a/drivers/pci/hotplug/shpchp.h +++ b/drivers/pci/hotplug/shpchp.h | |||
@@ -50,14 +50,14 @@ extern bool shpchp_debug; | |||
50 | #define dbg(format, arg...) \ | 50 | #define dbg(format, arg...) \ |
51 | do { \ | 51 | do { \ |
52 | if (shpchp_debug) \ | 52 | if (shpchp_debug) \ |
53 | printk(KERN_DEBUG "%s: " format, MY_NAME , ## arg); \ | 53 | printk(KERN_DEBUG "%s: " format, MY_NAME, ## arg); \ |
54 | } while (0) | 54 | } while (0) |
55 | #define err(format, arg...) \ | 55 | #define err(format, arg...) \ |
56 | printk(KERN_ERR "%s: " format, MY_NAME , ## arg) | 56 | printk(KERN_ERR "%s: " format, MY_NAME, ## arg) |
57 | #define info(format, arg...) \ | 57 | #define info(format, arg...) \ |
58 | printk(KERN_INFO "%s: " format, MY_NAME , ## arg) | 58 | printk(KERN_INFO "%s: " format, MY_NAME, ## arg) |
59 | #define warn(format, arg...) \ | 59 | #define warn(format, arg...) \ |
60 | printk(KERN_WARNING "%s: " format, MY_NAME , ## arg) | 60 | printk(KERN_WARNING "%s: " format, MY_NAME, ## arg) |
61 | 61 | ||
62 | #define ctrl_dbg(ctrl, format, arg...) \ | 62 | #define ctrl_dbg(ctrl, format, arg...) \ |
63 | do { \ | 63 | do { \ |
@@ -295,7 +295,7 @@ static inline void amd_pogo_errata_restore_misc_reg(struct slot *p_slot) | |||
295 | pci_write_config_dword(p_slot->ctrl->pci_dev, PCIX_MEM_BASE_LIMIT_OFFSET, rse_set); | 295 | pci_write_config_dword(p_slot->ctrl->pci_dev, PCIX_MEM_BASE_LIMIT_OFFSET, rse_set); |
296 | } | 296 | } |
297 | /* restore MiscII register */ | 297 | /* restore MiscII register */ |
298 | pci_read_config_dword(p_slot->ctrl->pci_dev, PCIX_MISCII_OFFSET, &pcix_misc2_temp ); | 298 | pci_read_config_dword(p_slot->ctrl->pci_dev, PCIX_MISCII_OFFSET, &pcix_misc2_temp); |
299 | 299 | ||
300 | if (p_slot->ctrl->pcix_misc2_reg & SERRFATALENABLE_MASK) | 300 | if (p_slot->ctrl->pcix_misc2_reg & SERRFATALENABLE_MASK) |
301 | pcix_misc2_temp |= SERRFATALENABLE_MASK; | 301 | pcix_misc2_temp |= SERRFATALENABLE_MASK; |
diff --git a/drivers/pci/hotplug/shpchp_core.c b/drivers/pci/hotplug/shpchp_core.c index 294ef4b10cf1..c3fbf3ed351e 100644 --- a/drivers/pci/hotplug/shpchp_core.c +++ b/drivers/pci/hotplug/shpchp_core.c | |||
@@ -57,13 +57,13 @@ MODULE_PARM_DESC(shpchp_poll_time, "Polling mechanism frequency, in seconds"); | |||
57 | 57 | ||
58 | #define SHPC_MODULE_NAME "shpchp" | 58 | #define SHPC_MODULE_NAME "shpchp" |
59 | 59 | ||
60 | static int set_attention_status (struct hotplug_slot *slot, u8 value); | 60 | static int set_attention_status(struct hotplug_slot *slot, u8 value); |
61 | static int enable_slot (struct hotplug_slot *slot); | 61 | static int enable_slot(struct hotplug_slot *slot); |
62 | static int disable_slot (struct hotplug_slot *slot); | 62 | static int disable_slot(struct hotplug_slot *slot); |
63 | static int get_power_status (struct hotplug_slot *slot, u8 *value); | 63 | static int get_power_status(struct hotplug_slot *slot, u8 *value); |
64 | static int get_attention_status (struct hotplug_slot *slot, u8 *value); | 64 | static int get_attention_status(struct hotplug_slot *slot, u8 *value); |
65 | static int get_latch_status (struct hotplug_slot *slot, u8 *value); | 65 | static int get_latch_status(struct hotplug_slot *slot, u8 *value); |
66 | static int get_adapter_status (struct hotplug_slot *slot, u8 *value); | 66 | static int get_adapter_status(struct hotplug_slot *slot, u8 *value); |
67 | 67 | ||
68 | static struct hotplug_slot_ops shpchp_hotplug_slot_ops = { | 68 | static struct hotplug_slot_ops shpchp_hotplug_slot_ops = { |
69 | .set_attention_status = set_attention_status, | 69 | .set_attention_status = set_attention_status, |
@@ -194,7 +194,7 @@ void cleanup_slots(struct controller *ctrl) | |||
194 | /* | 194 | /* |
195 | * set_attention_status - Turns the Amber LED for a slot on, off or blink | 195 | * set_attention_status - Turns the Amber LED for a slot on, off or blink |
196 | */ | 196 | */ |
197 | static int set_attention_status (struct hotplug_slot *hotplug_slot, u8 status) | 197 | static int set_attention_status(struct hotplug_slot *hotplug_slot, u8 status) |
198 | { | 198 | { |
199 | struct slot *slot = get_slot(hotplug_slot); | 199 | struct slot *slot = get_slot(hotplug_slot); |
200 | 200 | ||
@@ -207,7 +207,7 @@ static int set_attention_status (struct hotplug_slot *hotplug_slot, u8 status) | |||
207 | return 0; | 207 | return 0; |
208 | } | 208 | } |
209 | 209 | ||
210 | static int enable_slot (struct hotplug_slot *hotplug_slot) | 210 | static int enable_slot(struct hotplug_slot *hotplug_slot) |
211 | { | 211 | { |
212 | struct slot *slot = get_slot(hotplug_slot); | 212 | struct slot *slot = get_slot(hotplug_slot); |
213 | 213 | ||
@@ -217,7 +217,7 @@ static int enable_slot (struct hotplug_slot *hotplug_slot) | |||
217 | return shpchp_sysfs_enable_slot(slot); | 217 | return shpchp_sysfs_enable_slot(slot); |
218 | } | 218 | } |
219 | 219 | ||
220 | static int disable_slot (struct hotplug_slot *hotplug_slot) | 220 | static int disable_slot(struct hotplug_slot *hotplug_slot) |
221 | { | 221 | { |
222 | struct slot *slot = get_slot(hotplug_slot); | 222 | struct slot *slot = get_slot(hotplug_slot); |
223 | 223 | ||
@@ -227,7 +227,7 @@ static int disable_slot (struct hotplug_slot *hotplug_slot) | |||
227 | return shpchp_sysfs_disable_slot(slot); | 227 | return shpchp_sysfs_disable_slot(slot); |
228 | } | 228 | } |
229 | 229 | ||
230 | static int get_power_status (struct hotplug_slot *hotplug_slot, u8 *value) | 230 | static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value) |
231 | { | 231 | { |
232 | struct slot *slot = get_slot(hotplug_slot); | 232 | struct slot *slot = get_slot(hotplug_slot); |
233 | int retval; | 233 | int retval; |
@@ -242,7 +242,7 @@ static int get_power_status (struct hotplug_slot *hotplug_slot, u8 *value) | |||
242 | return 0; | 242 | return 0; |
243 | } | 243 | } |
244 | 244 | ||
245 | static int get_attention_status (struct hotplug_slot *hotplug_slot, u8 *value) | 245 | static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 *value) |
246 | { | 246 | { |
247 | struct slot *slot = get_slot(hotplug_slot); | 247 | struct slot *slot = get_slot(hotplug_slot); |
248 | int retval; | 248 | int retval; |
@@ -257,7 +257,7 @@ static int get_attention_status (struct hotplug_slot *hotplug_slot, u8 *value) | |||
257 | return 0; | 257 | return 0; |
258 | } | 258 | } |
259 | 259 | ||
260 | static int get_latch_status (struct hotplug_slot *hotplug_slot, u8 *value) | 260 | static int get_latch_status(struct hotplug_slot *hotplug_slot, u8 *value) |
261 | { | 261 | { |
262 | struct slot *slot = get_slot(hotplug_slot); | 262 | struct slot *slot = get_slot(hotplug_slot); |
263 | int retval; | 263 | int retval; |
@@ -272,7 +272,7 @@ static int get_latch_status (struct hotplug_slot *hotplug_slot, u8 *value) | |||
272 | return 0; | 272 | return 0; |
273 | } | 273 | } |
274 | 274 | ||
275 | static int get_adapter_status (struct hotplug_slot *hotplug_slot, u8 *value) | 275 | static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value) |
276 | { | 276 | { |
277 | struct slot *slot = get_slot(hotplug_slot); | 277 | struct slot *slot = get_slot(hotplug_slot); |
278 | int retval; | 278 | int retval; |
diff --git a/drivers/pci/hotplug/shpchp_hpc.c b/drivers/pci/hotplug/shpchp_hpc.c index 7d223e9080ef..e03341c95745 100644 --- a/drivers/pci/hotplug/shpchp_hpc.c +++ b/drivers/pci/hotplug/shpchp_hpc.c | |||
@@ -542,7 +542,7 @@ static int hpc_set_attention_status(struct slot *slot, u8 value) | |||
542 | u8 slot_cmd = 0; | 542 | u8 slot_cmd = 0; |
543 | 543 | ||
544 | switch (value) { | 544 | switch (value) { |
545 | case 0 : | 545 | case 0: |
546 | slot_cmd = SET_ATTN_OFF; /* OFF */ | 546 | slot_cmd = SET_ATTN_OFF; /* OFF */ |
547 | break; | 547 | break; |
548 | case 1: | 548 | case 1: |
diff --git a/drivers/pci/hotplug/shpchp_sysfs.c b/drivers/pci/hotplug/shpchp_sysfs.c index 52875b360463..1b4d73d8c728 100644 --- a/drivers/pci/hotplug/shpchp_sysfs.c +++ b/drivers/pci/hotplug/shpchp_sysfs.c | |||
@@ -35,7 +35,7 @@ | |||
35 | 35 | ||
36 | /* A few routines that create sysfs entries for the hot plug controller */ | 36 | /* A few routines that create sysfs entries for the hot plug controller */ |
37 | 37 | ||
38 | static ssize_t show_ctrl (struct device *dev, struct device_attribute *attr, char *buf) | 38 | static ssize_t show_ctrl(struct device *dev, struct device_attribute *attr, char *buf) |
39 | { | 39 | { |
40 | struct pci_dev *pdev; | 40 | struct pci_dev *pdev; |
41 | char *out = buf; | 41 | char *out = buf; |
@@ -43,7 +43,7 @@ static ssize_t show_ctrl (struct device *dev, struct device_attribute *attr, cha | |||
43 | struct resource *res; | 43 | struct resource *res; |
44 | struct pci_bus *bus; | 44 | struct pci_bus *bus; |
45 | 45 | ||
46 | pdev = container_of (dev, struct pci_dev, dev); | 46 | pdev = container_of(dev, struct pci_dev, dev); |
47 | bus = pdev->subordinate; | 47 | bus = pdev->subordinate; |
48 | 48 | ||
49 | out += sprintf(buf, "Free resources: memory\n"); | 49 | out += sprintf(buf, "Free resources: memory\n"); |
@@ -83,11 +83,11 @@ static ssize_t show_ctrl (struct device *dev, struct device_attribute *attr, cha | |||
83 | 83 | ||
84 | return out - buf; | 84 | return out - buf; |
85 | } | 85 | } |
86 | static DEVICE_ATTR (ctrl, S_IRUGO, show_ctrl, NULL); | 86 | static DEVICE_ATTR(ctrl, S_IRUGO, show_ctrl, NULL); |
87 | 87 | ||
88 | int shpchp_create_ctrl_files (struct controller *ctrl) | 88 | int shpchp_create_ctrl_files(struct controller *ctrl) |
89 | { | 89 | { |
90 | return device_create_file (&ctrl->pci_dev->dev, &dev_attr_ctrl); | 90 | return device_create_file(&ctrl->pci_dev->dev, &dev_attr_ctrl); |
91 | } | 91 | } |
92 | 92 | ||
93 | void shpchp_remove_ctrl_files(struct controller *ctrl) | 93 | void shpchp_remove_ctrl_files(struct controller *ctrl) |
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 314db8c1047a..db2e22707678 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -1534,7 +1534,7 @@ void __weak pcibios_release_device(struct pci_dev *dev) {} | |||
1534 | * is the default implementation. Architecture implementations can | 1534 | * is the default implementation. Architecture implementations can |
1535 | * override this. | 1535 | * override this. |
1536 | */ | 1536 | */ |
1537 | void __weak pcibios_disable_device (struct pci_dev *dev) {} | 1537 | void __weak pcibios_disable_device(struct pci_dev *dev) {} |
1538 | 1538 | ||
1539 | /** | 1539 | /** |
1540 | * pcibios_penalize_isa_irq - penalize an ISA IRQ | 1540 | * pcibios_penalize_isa_irq - penalize an ISA IRQ |
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index 1723ac1b30e1..7796d0a5befa 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c | |||
@@ -442,7 +442,7 @@ static void __assign_resources_sorted(struct list_head *head, | |||
442 | break; | 442 | break; |
443 | } | 443 | } |
444 | } | 444 | } |
445 | } | 445 | } |
446 | 446 | ||
447 | } | 447 | } |
448 | 448 | ||