diff options
Diffstat (limited to 'drivers/message/i2o/pci.c')
-rw-r--r-- | drivers/message/i2o/pci.c | 67 |
1 files changed, 19 insertions, 48 deletions
diff --git a/drivers/message/i2o/pci.c b/drivers/message/i2o/pci.c index f33fd81f77a4..a499af096a68 100644 --- a/drivers/message/i2o/pci.c +++ b/drivers/message/i2o/pci.c | |||
@@ -50,30 +50,6 @@ static struct pci_device_id __devinitdata i2o_pci_ids[] = { | |||
50 | }; | 50 | }; |
51 | 51 | ||
52 | /** | 52 | /** |
53 | * i2o_dma_realloc - Realloc DMA memory | ||
54 | * @dev: struct device pointer to the PCI device of the I2O controller | ||
55 | * @addr: pointer to a i2o_dma struct DMA buffer | ||
56 | * @len: new length of memory | ||
57 | * @gfp_mask: GFP mask | ||
58 | * | ||
59 | * If there was something allocated in the addr, free it first. If len > 0 | ||
60 | * than try to allocate it and write the addresses back to the addr | ||
61 | * structure. If len == 0 set the virtual address to NULL. | ||
62 | * | ||
63 | * Returns the 0 on success or negative error code on failure. | ||
64 | */ | ||
65 | int i2o_dma_realloc(struct device *dev, struct i2o_dma *addr, size_t len, | ||
66 | unsigned int gfp_mask) | ||
67 | { | ||
68 | i2o_dma_free(dev, addr); | ||
69 | |||
70 | if (len) | ||
71 | return i2o_dma_alloc(dev, addr, len, gfp_mask); | ||
72 | |||
73 | return 0; | ||
74 | }; | ||
75 | |||
76 | /** | ||
77 | * i2o_pci_free - Frees the DMA memory for the I2O controller | 53 | * i2o_pci_free - Frees the DMA memory for the I2O controller |
78 | * @c: I2O controller to free | 54 | * @c: I2O controller to free |
79 | * | 55 | * |
@@ -185,6 +161,7 @@ static int __devinit i2o_pci_alloc(struct i2o_controller *c) | |||
185 | } else | 161 | } else |
186 | c->in_queue = c->base; | 162 | c->in_queue = c->base; |
187 | 163 | ||
164 | c->irq_status = c->base.virt + I2O_IRQ_STATUS; | ||
188 | c->irq_mask = c->base.virt + I2O_IRQ_MASK; | 165 | c->irq_mask = c->base.virt + I2O_IRQ_MASK; |
189 | c->in_port = c->base.virt + I2O_IN_PORT; | 166 | c->in_port = c->base.virt + I2O_IN_PORT; |
190 | c->out_port = c->base.virt + I2O_OUT_PORT; | 167 | c->out_port = c->base.virt + I2O_OUT_PORT; |
@@ -232,36 +209,30 @@ static int __devinit i2o_pci_alloc(struct i2o_controller *c) | |||
232 | static irqreturn_t i2o_pci_interrupt(int irq, void *dev_id, struct pt_regs *r) | 209 | static irqreturn_t i2o_pci_interrupt(int irq, void *dev_id, struct pt_regs *r) |
233 | { | 210 | { |
234 | struct i2o_controller *c = dev_id; | 211 | struct i2o_controller *c = dev_id; |
235 | struct device *dev = &c->pdev->dev; | 212 | u32 m; |
236 | u32 mv = readl(c->out_port); | 213 | irqreturn_t rc = IRQ_NONE; |
237 | 214 | ||
238 | /* | 215 | while (readl(c->irq_status) & I2O_IRQ_OUTBOUND_POST) { |
239 | * Old 960 steppings had a bug in the I2O unit that caused | 216 | m = readl(c->out_port); |
240 | * the queue to appear empty when it wasn't. | 217 | if (m == I2O_QUEUE_EMPTY) { |
241 | */ | 218 | /* |
242 | if (mv == I2O_QUEUE_EMPTY) { | 219 | * Old 960 steppings had a bug in the I2O unit that |
243 | mv = readl(c->out_port); | 220 | * caused the queue to appear empty when it wasn't. |
244 | if (unlikely(mv == I2O_QUEUE_EMPTY)) | 221 | */ |
245 | return IRQ_NONE; | 222 | m = readl(c->out_port); |
246 | else | 223 | if (unlikely(m == I2O_QUEUE_EMPTY)) |
247 | pr_debug("%s: 960 bug detected\n", c->name); | 224 | break; |
248 | } | 225 | } |
249 | 226 | ||
250 | while (mv != I2O_QUEUE_EMPTY) { | ||
251 | /* dispatch it */ | 227 | /* dispatch it */ |
252 | if (i2o_driver_dispatch(c, mv)) | 228 | if (i2o_driver_dispatch(c, m)) |
253 | /* flush it if result != 0 */ | 229 | /* flush it if result != 0 */ |
254 | i2o_flush_reply(c, mv); | 230 | i2o_flush_reply(c, m); |
255 | 231 | ||
256 | /* | 232 | rc = IRQ_HANDLED; |
257 | * That 960 bug again... | ||
258 | */ | ||
259 | mv = readl(c->out_port); | ||
260 | if (mv == I2O_QUEUE_EMPTY) | ||
261 | mv = readl(c->out_port); | ||
262 | } | 233 | } |
263 | 234 | ||
264 | return IRQ_HANDLED; | 235 | return rc; |
265 | } | 236 | } |
266 | 237 | ||
267 | /** | 238 | /** |