diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-07-24 16:53:31 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-07-24 16:53:31 -0400 |
commit | 28cfd8af52a9ed4e5bd1751ea6bc0b8c870f68ec (patch) | |
tree | 77491546baa6572cfc22ba7a93062cc857f9adbe /drivers/ide/setup-pci.c | |
parent | 2a8f7450f828eaee49d66f41f99ac2e54f1160a6 (diff) |
ide: include PCI device name in messages from IDE PCI host drivers
While at it:
* Apply small fixes to messages (s/dma/DMA/, remove trailing '.', etc).
* Fix printk() call in ide_setup_pci_baseregs() to use KERN_INFO.
* Move printk() call from ide_pci_clear_simplex() to the caller.
* Cleanup do_ide_setup_pci_device() a bit.
* amd74xx.c: remove superfluous PCI device revision information.
* hpt366.c: fix two printk() calls in ->init_chipset to use KERN_INFO.
* pdc202xx_new.c: fix printk() call in ->init_chipset to use KERN_INFO.
* pdc202xx_old.c: fix driver message in pdc202xx_init_one().
* via82cxxx.c: fix driver warning message in via_init_one().
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/setup-pci.c')
-rw-r--r-- | drivers/ide/setup-pci.c | 99 |
1 files changed, 56 insertions, 43 deletions
diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c index 20f0ee004695..d9655aeb013b 100644 --- a/drivers/ide/setup-pci.c +++ b/drivers/ide/setup-pci.c | |||
@@ -39,17 +39,18 @@ static int ide_setup_pci_baseregs(struct pci_dev *dev, const char *name) | |||
39 | if (pci_read_config_byte(dev, PCI_CLASS_PROG, &progif) || | 39 | if (pci_read_config_byte(dev, PCI_CLASS_PROG, &progif) || |
40 | (progif & 5) != 5) { | 40 | (progif & 5) != 5) { |
41 | if ((progif & 0xa) != 0xa) { | 41 | if ((progif & 0xa) != 0xa) { |
42 | printk(KERN_INFO "%s: device not capable of full " | 42 | printk(KERN_INFO "%s %s: device not capable of full " |
43 | "native PCI mode\n", name); | 43 | "native PCI mode\n", name, pci_name(dev)); |
44 | return -EOPNOTSUPP; | 44 | return -EOPNOTSUPP; |
45 | } | 45 | } |
46 | printk("%s: placing both ports into native PCI mode\n", name); | 46 | printk(KERN_INFO "%s %s: placing both ports into native PCI " |
47 | "mode\n", name, pci_name(dev)); | ||
47 | (void) pci_write_config_byte(dev, PCI_CLASS_PROG, progif|5); | 48 | (void) pci_write_config_byte(dev, PCI_CLASS_PROG, progif|5); |
48 | if (pci_read_config_byte(dev, PCI_CLASS_PROG, &progif) || | 49 | if (pci_read_config_byte(dev, PCI_CLASS_PROG, &progif) || |
49 | (progif & 5) != 5) { | 50 | (progif & 5) != 5) { |
50 | printk(KERN_ERR "%s: rewrite of PROGIF failed, wanted " | 51 | printk(KERN_ERR "%s %s: rewrite of PROGIF failed, " |
51 | "0x%04x, got 0x%04x\n", | 52 | "wanted 0x%04x, got 0x%04x\n", |
52 | name, progif|5, progif); | 53 | name, pci_name(dev), progif | 5, progif); |
53 | return -EOPNOTSUPP; | 54 | return -EOPNOTSUPP; |
54 | } | 55 | } |
55 | } | 56 | } |
@@ -57,14 +58,14 @@ static int ide_setup_pci_baseregs(struct pci_dev *dev, const char *name) | |||
57 | } | 58 | } |
58 | 59 | ||
59 | #ifdef CONFIG_BLK_DEV_IDEDMA_PCI | 60 | #ifdef CONFIG_BLK_DEV_IDEDMA_PCI |
60 | static void ide_pci_clear_simplex(unsigned long dma_base, const char *name) | 61 | static int ide_pci_clear_simplex(unsigned long dma_base, const char *name) |
61 | { | 62 | { |
62 | u8 dma_stat = inb(dma_base + 2); | 63 | u8 dma_stat = inb(dma_base + 2); |
63 | 64 | ||
64 | outb(dma_stat & 0x60, dma_base + 2); | 65 | outb(dma_stat & 0x60, dma_base + 2); |
65 | dma_stat = inb(dma_base + 2); | 66 | dma_stat = inb(dma_base + 2); |
66 | if (dma_stat & 0x80) | 67 | |
67 | printk(KERN_INFO "%s: simplex device: DMA forced\n", name); | 68 | return (dma_stat & 0x80) ? 1 : 0; |
68 | } | 69 | } |
69 | 70 | ||
70 | /** | 71 | /** |
@@ -91,7 +92,8 @@ unsigned long ide_pci_dma_base(ide_hwif_t *hwif, const struct ide_port_info *d) | |||
91 | dma_base = pci_resource_start(dev, baridx); | 92 | dma_base = pci_resource_start(dev, baridx); |
92 | 93 | ||
93 | if (dma_base == 0) { | 94 | if (dma_base == 0) { |
94 | printk(KERN_ERR "%s: DMA base is invalid\n", d->name); | 95 | printk(KERN_ERR "%s %s: DMA base is invalid\n", |
96 | d->name, pci_name(dev)); | ||
95 | return 0; | 97 | return 0; |
96 | } | 98 | } |
97 | } | 99 | } |
@@ -105,13 +107,16 @@ EXPORT_SYMBOL_GPL(ide_pci_dma_base); | |||
105 | 107 | ||
106 | int ide_pci_check_simplex(ide_hwif_t *hwif, const struct ide_port_info *d) | 108 | int ide_pci_check_simplex(ide_hwif_t *hwif, const struct ide_port_info *d) |
107 | { | 109 | { |
110 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
108 | u8 dma_stat; | 111 | u8 dma_stat; |
109 | 112 | ||
110 | if (d->host_flags & (IDE_HFLAG_MMIO | IDE_HFLAG_CS5520)) | 113 | if (d->host_flags & (IDE_HFLAG_MMIO | IDE_HFLAG_CS5520)) |
111 | goto out; | 114 | goto out; |
112 | 115 | ||
113 | if (d->host_flags & IDE_HFLAG_CLEAR_SIMPLEX) { | 116 | if (d->host_flags & IDE_HFLAG_CLEAR_SIMPLEX) { |
114 | ide_pci_clear_simplex(hwif->dma_base, d->name); | 117 | if (ide_pci_clear_simplex(hwif->dma_base, d->name)) |
118 | printk(KERN_INFO "%s %s: simplex device: DMA forced\n", | ||
119 | d->name, pci_name(dev)); | ||
115 | goto out; | 120 | goto out; |
116 | } | 121 | } |
117 | 122 | ||
@@ -127,7 +132,8 @@ int ide_pci_check_simplex(ide_hwif_t *hwif, const struct ide_port_info *d) | |||
127 | */ | 132 | */ |
128 | dma_stat = hwif->tp_ops->read_sff_dma_status(hwif); | 133 | dma_stat = hwif->tp_ops->read_sff_dma_status(hwif); |
129 | if ((dma_stat & 0x80) && hwif->mate && hwif->mate->dma_base) { | 134 | if ((dma_stat & 0x80) && hwif->mate && hwif->mate->dma_base) { |
130 | printk(KERN_INFO "%s: simplex device: DMA disabled\n", d->name); | 135 | printk(KERN_INFO "%s %s: simplex device: DMA disabled\n", |
136 | d->name, pci_name(dev)); | ||
131 | return -1; | 137 | return -1; |
132 | } | 138 | } |
133 | out: | 139 | out: |
@@ -149,8 +155,8 @@ int ide_pci_set_master(struct pci_dev *dev, const char *name) | |||
149 | 155 | ||
150 | if (pci_read_config_word(dev, PCI_COMMAND, &pcicmd) || | 156 | if (pci_read_config_word(dev, PCI_COMMAND, &pcicmd) || |
151 | (pcicmd & PCI_COMMAND_MASTER) == 0) { | 157 | (pcicmd & PCI_COMMAND_MASTER) == 0) { |
152 | printk(KERN_ERR "%s: error updating PCICMD on %s\n", | 158 | printk(KERN_ERR "%s %s: error updating PCICMD\n", |
153 | name, pci_name(dev)); | 159 | name, pci_name(dev)); |
154 | return -EIO; | 160 | return -EIO; |
155 | } | 161 | } |
156 | } | 162 | } |
@@ -162,9 +168,9 @@ EXPORT_SYMBOL_GPL(ide_pci_set_master); | |||
162 | 168 | ||
163 | void ide_setup_pci_noise(struct pci_dev *dev, const struct ide_port_info *d) | 169 | void ide_setup_pci_noise(struct pci_dev *dev, const struct ide_port_info *d) |
164 | { | 170 | { |
165 | printk(KERN_INFO "%s: IDE controller (0x%04x:0x%04x rev 0x%02x) at " | 171 | printk(KERN_INFO "%s %s: IDE controller (0x%04x:0x%04x rev 0x%02x)\n", |
166 | " PCI slot %s\n", d->name, dev->vendor, dev->device, | 172 | d->name, pci_name(dev), |
167 | dev->revision, pci_name(dev)); | 173 | dev->vendor, dev->device, dev->revision); |
168 | } | 174 | } |
169 | EXPORT_SYMBOL_GPL(ide_setup_pci_noise); | 175 | EXPORT_SYMBOL_GPL(ide_setup_pci_noise); |
170 | 176 | ||
@@ -189,11 +195,12 @@ static int ide_pci_enable(struct pci_dev *dev, const struct ide_port_info *d) | |||
189 | if (pci_enable_device(dev)) { | 195 | if (pci_enable_device(dev)) { |
190 | ret = pci_enable_device_io(dev); | 196 | ret = pci_enable_device_io(dev); |
191 | if (ret < 0) { | 197 | if (ret < 0) { |
192 | printk(KERN_WARNING "%s: (ide_setup_pci_device:) " | 198 | printk(KERN_WARNING "%s %s: couldn't enable device\n", |
193 | "Could not enable device.\n", d->name); | 199 | d->name, pci_name(dev)); |
194 | goto out; | 200 | goto out; |
195 | } | 201 | } |
196 | printk(KERN_WARNING "%s: BIOS configuration fixed.\n", d->name); | 202 | printk(KERN_WARNING "%s %s: BIOS configuration fixed\n", |
203 | d->name, pci_name(dev)); | ||
197 | } | 204 | } |
198 | 205 | ||
199 | /* | 206 | /* |
@@ -203,7 +210,8 @@ static int ide_pci_enable(struct pci_dev *dev, const struct ide_port_info *d) | |||
203 | */ | 210 | */ |
204 | ret = pci_set_dma_mask(dev, DMA_32BIT_MASK); | 211 | ret = pci_set_dma_mask(dev, DMA_32BIT_MASK); |
205 | if (ret < 0) { | 212 | if (ret < 0) { |
206 | printk(KERN_ERR "%s: can't set dma mask\n", d->name); | 213 | printk(KERN_ERR "%s %s: can't set DMA mask\n", |
214 | d->name, pci_name(dev)); | ||
207 | goto out; | 215 | goto out; |
208 | } | 216 | } |
209 | 217 | ||
@@ -221,7 +229,8 @@ static int ide_pci_enable(struct pci_dev *dev, const struct ide_port_info *d) | |||
221 | 229 | ||
222 | ret = pci_request_selected_regions(dev, bars, d->name); | 230 | ret = pci_request_selected_regions(dev, bars, d->name); |
223 | if (ret < 0) | 231 | if (ret < 0) |
224 | printk(KERN_ERR "%s: can't reserve resources\n", d->name); | 232 | printk(KERN_ERR "%s %s: can't reserve resources\n", |
233 | d->name, pci_name(dev)); | ||
225 | out: | 234 | out: |
226 | return ret; | 235 | return ret; |
227 | } | 236 | } |
@@ -247,15 +256,18 @@ static int ide_pci_configure(struct pci_dev *dev, const struct ide_port_info *d) | |||
247 | */ | 256 | */ |
248 | if (ide_setup_pci_baseregs(dev, d->name) || | 257 | if (ide_setup_pci_baseregs(dev, d->name) || |
249 | pci_write_config_word(dev, PCI_COMMAND, pcicmd | PCI_COMMAND_IO)) { | 258 | pci_write_config_word(dev, PCI_COMMAND, pcicmd | PCI_COMMAND_IO)) { |
250 | printk(KERN_INFO "%s: device disabled (BIOS)\n", d->name); | 259 | printk(KERN_INFO "%s %s: device disabled (BIOS)\n", |
260 | d->name, pci_name(dev)); | ||
251 | return -ENODEV; | 261 | return -ENODEV; |
252 | } | 262 | } |
253 | if (pci_read_config_word(dev, PCI_COMMAND, &pcicmd)) { | 263 | if (pci_read_config_word(dev, PCI_COMMAND, &pcicmd)) { |
254 | printk(KERN_ERR "%s: error accessing PCI regs\n", d->name); | 264 | printk(KERN_ERR "%s %s: error accessing PCI regs\n", |
265 | d->name, pci_name(dev)); | ||
255 | return -EIO; | 266 | return -EIO; |
256 | } | 267 | } |
257 | if (!(pcicmd & PCI_COMMAND_IO)) { | 268 | if (!(pcicmd & PCI_COMMAND_IO)) { |
258 | printk(KERN_ERR "%s: unable to enable IDE controller\n", d->name); | 269 | printk(KERN_ERR "%s %s: unable to enable IDE controller\n", |
270 | d->name, pci_name(dev)); | ||
259 | return -ENXIO; | 271 | return -ENXIO; |
260 | } | 272 | } |
261 | return 0; | 273 | return 0; |
@@ -311,8 +323,9 @@ static int ide_hw_configure(struct pci_dev *dev, const struct ide_port_info *d, | |||
311 | if ((d->host_flags & IDE_HFLAG_ISA_PORTS) == 0) { | 323 | if ((d->host_flags & IDE_HFLAG_ISA_PORTS) == 0) { |
312 | if (ide_pci_check_iomem(dev, d, 2 * port) || | 324 | if (ide_pci_check_iomem(dev, d, 2 * port) || |
313 | ide_pci_check_iomem(dev, d, 2 * port + 1)) { | 325 | ide_pci_check_iomem(dev, d, 2 * port + 1)) { |
314 | printk(KERN_ERR "%s: I/O baseregs (BIOS) are reported " | 326 | printk(KERN_ERR "%s %s: I/O baseregs (BIOS) are " |
315 | "as MEM for port %d!\n", d->name, port); | 327 | "reported as MEM for port %d!\n", |
328 | d->name, pci_name(dev), port); | ||
316 | return -EINVAL; | 329 | return -EINVAL; |
317 | } | 330 | } |
318 | 331 | ||
@@ -325,8 +338,8 @@ static int ide_hw_configure(struct pci_dev *dev, const struct ide_port_info *d, | |||
325 | } | 338 | } |
326 | 339 | ||
327 | if (!base || !ctl) { | 340 | if (!base || !ctl) { |
328 | printk(KERN_ERR "%s: bad PCI BARs for port %d, skipping\n", | 341 | printk(KERN_ERR "%s %s: bad PCI BARs for port %d, skipping\n", |
329 | d->name, port); | 342 | d->name, pci_name(dev), port); |
330 | return -EINVAL; | 343 | return -EINVAL; |
331 | } | 344 | } |
332 | 345 | ||
@@ -414,14 +427,16 @@ static int ide_setup_pci_controller(struct pci_dev *dev, | |||
414 | 427 | ||
415 | ret = pci_read_config_word(dev, PCI_COMMAND, &pcicmd); | 428 | ret = pci_read_config_word(dev, PCI_COMMAND, &pcicmd); |
416 | if (ret < 0) { | 429 | if (ret < 0) { |
417 | printk(KERN_ERR "%s: error accessing PCI regs\n", d->name); | 430 | printk(KERN_ERR "%s %s: error accessing PCI regs\n", |
431 | d->name, pci_name(dev)); | ||
418 | goto out; | 432 | goto out; |
419 | } | 433 | } |
420 | if (!(pcicmd & PCI_COMMAND_IO)) { /* is device disabled? */ | 434 | if (!(pcicmd & PCI_COMMAND_IO)) { /* is device disabled? */ |
421 | ret = ide_pci_configure(dev, d); | 435 | ret = ide_pci_configure(dev, d); |
422 | if (ret < 0) | 436 | if (ret < 0) |
423 | goto out; | 437 | goto out; |
424 | printk(KERN_INFO "%s: device enabled (Linux)\n", d->name); | 438 | printk(KERN_INFO "%s %s: device enabled (Linux)\n", |
439 | d->name, pci_name(dev)); | ||
425 | } | 440 | } |
426 | 441 | ||
427 | out: | 442 | out: |
@@ -460,7 +475,8 @@ void ide_pci_setup_ports(struct pci_dev *dev, const struct ide_port_info *d, | |||
460 | 475 | ||
461 | if (e->reg && (pci_read_config_byte(dev, e->reg, &tmp) || | 476 | if (e->reg && (pci_read_config_byte(dev, e->reg, &tmp) || |
462 | (tmp & e->mask) != e->val)) { | 477 | (tmp & e->mask) != e->val)) { |
463 | printk(KERN_INFO "%s: IDE port disabled\n", d->name); | 478 | printk(KERN_INFO "%s %s: IDE port disabled\n", |
479 | d->name, pci_name(dev)); | ||
464 | continue; /* port not enabled */ | 480 | continue; /* port not enabled */ |
465 | } | 481 | } |
466 | 482 | ||
@@ -506,18 +522,15 @@ static int do_ide_setup_pci_device(struct pci_dev *dev, | |||
506 | /* Is it an "IDE storage" device in non-PCI mode? */ | 522 | /* Is it an "IDE storage" device in non-PCI mode? */ |
507 | if ((dev->class >> 8) == PCI_CLASS_STORAGE_IDE && (dev->class & 5) != 5) { | 523 | if ((dev->class >> 8) == PCI_CLASS_STORAGE_IDE && (dev->class & 5) != 5) { |
508 | if (noisy) | 524 | if (noisy) |
509 | printk(KERN_INFO "%s: not 100%% native mode: " | 525 | printk(KERN_INFO "%s %s: not 100%% native mode: will " |
510 | "will probe irqs later\n", d->name); | 526 | "probe irqs later\n", d->name, pci_name(dev)); |
511 | pciirq = ret; | 527 | pciirq = ret; |
512 | } else if (!pciirq) { | 528 | } else if (!pciirq && noisy) { |
513 | if (noisy) | 529 | printk(KERN_WARNING "%s %s: bad irq (%d): will probe later\n", |
514 | printk(KERN_WARNING "%s: bad irq (%d): will probe later\n", | 530 | d->name, pci_name(dev), pciirq); |
515 | d->name, pciirq); | 531 | } else if (noisy) { |
516 | pciirq = 0; | 532 | printk(KERN_INFO "%s %s: 100%% native mode on irq %d\n", |
517 | } else { | 533 | d->name, pci_name(dev), pciirq); |
518 | if (noisy) | ||
519 | printk(KERN_INFO "%s: 100%% native mode on irq %d\n", | ||
520 | d->name, pciirq); | ||
521 | } | 534 | } |
522 | 535 | ||
523 | ret = pciirq; | 536 | ret = pciirq; |