aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/pata_mpiix.c
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2007-08-18 00:14:55 -0400
committerJeff Garzik <jeff@garzik.org>2007-10-12 14:55:37 -0400
commitcbcdd87593a1d85c5c4b259945a3a09eee12814d (patch)
treeee03df963a12ec7f30f6c3a8742421daf2c34f50 /drivers/ata/pata_mpiix.c
parente923090ddd9fef1d4e06dc6c5295e29baced19f3 (diff)
libata: implement and use ata_port_desc() to report port configuration
Currently, port configuration reporting has the following problems. * iomapped address is reported instead of raw address * report contains irrelevant fields or lacks necessary fields for non-SFF controllers. * host->irq/irq2 are there just for reporting and hacky. This patch implements and uses ata_port_desc() and ata_port_pbar_desc(). ata_port_desc() is almost identical to ata_ehi_push_desc() except that it takes @ap instead of @ehi, has no locking requirement, can only be used during host initialization and " " is used as separator instead of ", ". ata_port_pbar_desc() is a helper to ease reporting of a PCI BAR or an offsetted address into it. LLD pushes whatever description it wants using the above two functions. The accumulated description is printed on host registration after "[S/P]ATA max MAX_XFERMODE ". SFF init helpers and ata_host_activate() automatically add descriptions for addresses and irq respectively, so only LLDs which isn't standard SFF need to add custom descriptions. In many cases, such controllers need to report different things anyway. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/pata_mpiix.c')
-rw-r--r--drivers/ata/pata_mpiix.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/ata/pata_mpiix.c b/drivers/ata/pata_mpiix.c
index cb78b7bfe143..d5483087a3fa 100644
--- a/drivers/ata/pata_mpiix.c
+++ b/drivers/ata/pata_mpiix.c
@@ -201,7 +201,7 @@ static int mpiix_init_one(struct pci_dev *dev, const struct pci_device_id *id)
201 struct ata_port *ap; 201 struct ata_port *ap;
202 void __iomem *cmd_addr, *ctl_addr; 202 void __iomem *cmd_addr, *ctl_addr;
203 u16 idetim; 203 u16 idetim;
204 int irq; 204 int cmd, ctl, irq;
205 205
206 if (!printed_version++) 206 if (!printed_version++)
207 dev_printk(KERN_DEBUG, &dev->dev, "version " DRV_VERSION "\n"); 207 dev_printk(KERN_DEBUG, &dev->dev, "version " DRV_VERSION "\n");
@@ -209,6 +209,7 @@ static int mpiix_init_one(struct pci_dev *dev, const struct pci_device_id *id)
209 host = ata_host_alloc(&dev->dev, 1); 209 host = ata_host_alloc(&dev->dev, 1);
210 if (!host) 210 if (!host)
211 return -ENOMEM; 211 return -ENOMEM;
212 ap = host->ports[0];
212 213
213 /* MPIIX has many functions which can be turned on or off according 214 /* MPIIX has many functions which can be turned on or off according
214 to other devices present. Make sure IDE is enabled before we try 215 to other devices present. Make sure IDE is enabled before we try
@@ -220,25 +221,28 @@ static int mpiix_init_one(struct pci_dev *dev, const struct pci_device_id *id)
220 221
221 /* See if it's primary or secondary channel... */ 222 /* See if it's primary or secondary channel... */
222 if (!(idetim & SECONDARY)) { 223 if (!(idetim & SECONDARY)) {
224 cmd = 0x1F0;
225 ctl = 0x3F6;
223 irq = 14; 226 irq = 14;
224 cmd_addr = devm_ioport_map(&dev->dev, 0x1F0, 8);
225 ctl_addr = devm_ioport_map(&dev->dev, 0x3F6, 1);
226 } else { 227 } else {
228 cmd = 0x170;
229 ctl = 0x376;
227 irq = 15; 230 irq = 15;
228 cmd_addr = devm_ioport_map(&dev->dev, 0x170, 8);
229 ctl_addr = devm_ioport_map(&dev->dev, 0x376, 1);
230 } 231 }
231 232
233 cmd_addr = devm_ioport_map(&dev->dev, cmd, 8);
234 ctl_addr = devm_ioport_map(&dev->dev, ctl, 1);
232 if (!cmd_addr || !ctl_addr) 235 if (!cmd_addr || !ctl_addr)
233 return -ENOMEM; 236 return -ENOMEM;
234 237
238 ata_port_desc(ap, "cmd 0x%x ctl 0x%x", cmd, ctl);
239
235 /* We do our own plumbing to avoid leaking special cases for whacko 240 /* We do our own plumbing to avoid leaking special cases for whacko
236 ancient hardware into the core code. There are two issues to 241 ancient hardware into the core code. There are two issues to
237 worry about. #1 The chip is a bridge so if in legacy mode and 242 worry about. #1 The chip is a bridge so if in legacy mode and
238 without BARs set fools the setup. #2 If you pci_disable_device 243 without BARs set fools the setup. #2 If you pci_disable_device
239 the MPIIX your box goes castors up */ 244 the MPIIX your box goes castors up */
240 245
241 ap = host->ports[0];
242 ap->ops = &mpiix_port_ops; 246 ap->ops = &mpiix_port_ops;
243 ap->pio_mask = 0x1F; 247 ap->pio_mask = 0x1F;
244 ap->flags |= ATA_FLAG_SLAVE_POSS; 248 ap->flags |= ATA_FLAG_SLAVE_POSS;