aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/setup-pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/setup-pci.c')
-rw-r--r--drivers/ide/setup-pci.c82
1 files changed, 38 insertions, 44 deletions
diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c
index 71be6999f967..3517eb0eddbd 100644
--- a/drivers/ide/setup-pci.c
+++ b/drivers/ide/setup-pci.c
@@ -147,15 +147,15 @@ static int ide_setup_pci_baseregs (struct pci_dev *dev, const char *name)
147#ifdef CONFIG_BLK_DEV_IDEDMA_PCI 147#ifdef CONFIG_BLK_DEV_IDEDMA_PCI
148/** 148/**
149 * ide_get_or_set_dma_base - setup BMIBA 149 * ide_get_or_set_dma_base - setup BMIBA
150 * @d: IDE pci device data 150 * @d: IDE port info
151 * @hwif: Interface 151 * @hwif: IDE interface
152 * 152 *
153 * Fetch the DMA Bus-Master-I/O-Base-Address (BMIBA) from PCI space. 153 * Fetch the DMA Bus-Master-I/O-Base-Address (BMIBA) from PCI space.
154 * Where a device has a partner that is already in DMA mode we check 154 * Where a device has a partner that is already in DMA mode we check
155 * and enforce IDE simplex rules. 155 * and enforce IDE simplex rules.
156 */ 156 */
157 157
158static unsigned long ide_get_or_set_dma_base(ide_pci_device_t *d, ide_hwif_t *hwif) 158static unsigned long ide_get_or_set_dma_base(struct ide_port_info *d, ide_hwif_t *hwif)
159{ 159{
160 unsigned long dma_base = 0; 160 unsigned long dma_base = 0;
161 struct pci_dev *dev = hwif->pci_dev; 161 struct pci_dev *dev = hwif->pci_dev;
@@ -225,7 +225,7 @@ static unsigned long ide_get_or_set_dma_base(ide_pci_device_t *d, ide_hwif_t *hw
225} 225}
226#endif /* CONFIG_BLK_DEV_IDEDMA_PCI */ 226#endif /* CONFIG_BLK_DEV_IDEDMA_PCI */
227 227
228void ide_setup_pci_noise (struct pci_dev *dev, ide_pci_device_t *d) 228void ide_setup_pci_noise(struct pci_dev *dev, struct ide_port_info *d)
229{ 229{
230 printk(KERN_INFO "%s: IDE controller at PCI slot %s\n", 230 printk(KERN_INFO "%s: IDE controller at PCI slot %s\n",
231 d->name, pci_name(dev)); 231 d->name, pci_name(dev));
@@ -237,15 +237,15 @@ EXPORT_SYMBOL_GPL(ide_setup_pci_noise);
237/** 237/**
238 * ide_pci_enable - do PCI enables 238 * ide_pci_enable - do PCI enables
239 * @dev: PCI device 239 * @dev: PCI device
240 * @d: IDE pci device data 240 * @d: IDE port info
241 * 241 *
242 * Enable the IDE PCI device. We attempt to enable the device in full 242 * Enable the IDE PCI device. We attempt to enable the device in full
243 * but if that fails then we only need BAR4 so we will enable that. 243 * but if that fails then we only need BAR4 so we will enable that.
244 * 244 *
245 * Returns zero on success or an error code 245 * Returns zero on success or an error code
246 */ 246 */
247 247
248static int ide_pci_enable(struct pci_dev *dev, ide_pci_device_t *d) 248static int ide_pci_enable(struct pci_dev *dev, struct ide_port_info *d)
249{ 249{
250 int ret; 250 int ret;
251 251
@@ -260,9 +260,9 @@ static int ide_pci_enable(struct pci_dev *dev, ide_pci_device_t *d)
260 } 260 }
261 261
262 /* 262 /*
263 * assume all devices can do 32-bit dma for now. we can add a 263 * assume all devices can do 32-bit DMA for now, we can add
264 * dma mask field to the ide_pci_device_t if we need it (or let 264 * a DMA mask field to the struct ide_port_info if we need it
265 * lower level driver set the dma mask) 265 * (or let lower level driver set the DMA mask)
266 */ 266 */
267 ret = pci_set_dma_mask(dev, DMA_32BIT_MASK); 267 ret = pci_set_dma_mask(dev, DMA_32BIT_MASK);
268 if (ret < 0) { 268 if (ret < 0) {
@@ -284,13 +284,13 @@ out:
284/** 284/**
285 * ide_pci_configure - configure an unconfigured device 285 * ide_pci_configure - configure an unconfigured device
286 * @dev: PCI device 286 * @dev: PCI device
287 * @d: IDE pci device data 287 * @d: IDE port info
288 * 288 *
289 * Enable and configure the PCI device we have been passed. 289 * Enable and configure the PCI device we have been passed.
290 * Returns zero on success or an error code. 290 * Returns zero on success or an error code.
291 */ 291 */
292 292
293static int ide_pci_configure(struct pci_dev *dev, ide_pci_device_t *d) 293static int ide_pci_configure(struct pci_dev *dev, struct ide_port_info *d)
294{ 294{
295 u16 pcicmd = 0; 295 u16 pcicmd = 0;
296 /* 296 /*
@@ -318,15 +318,15 @@ static int ide_pci_configure(struct pci_dev *dev, ide_pci_device_t *d)
318 318
319/** 319/**
320 * ide_pci_check_iomem - check a register is I/O 320 * ide_pci_check_iomem - check a register is I/O
321 * @dev: pci device 321 * @dev: PCI device
322 * @d: ide_pci_device 322 * @d: IDE port info
323 * @bar: bar number 323 * @bar: BAR number
324 * 324 *
325 * Checks if a BAR is configured and points to MMIO space. If so 325 * Checks if a BAR is configured and points to MMIO space. If so
326 * print an error and return an error code. Otherwise return 0 326 * print an error and return an error code. Otherwise return 0
327 */ 327 */
328 328
329static int ide_pci_check_iomem(struct pci_dev *dev, ide_pci_device_t *d, int bar) 329static int ide_pci_check_iomem(struct pci_dev *dev, struct ide_port_info *d, int bar)
330{ 330{
331 ulong flags = pci_resource_flags(dev, bar); 331 ulong flags = pci_resource_flags(dev, bar);
332 332
@@ -348,7 +348,7 @@ static int ide_pci_check_iomem(struct pci_dev *dev, ide_pci_device_t *d, int bar
348/** 348/**
349 * ide_hwif_configure - configure an IDE interface 349 * ide_hwif_configure - configure an IDE interface
350 * @dev: PCI device holding interface 350 * @dev: PCI device holding interface
351 * @d: IDE pci data 351 * @d: IDE port info
352 * @mate: Paired interface if any 352 * @mate: Paired interface if any
353 * 353 *
354 * Perform the initial set up for the hardware interface structure. This 354 * Perform the initial set up for the hardware interface structure. This
@@ -357,8 +357,8 @@ static int ide_pci_check_iomem(struct pci_dev *dev, ide_pci_device_t *d, int bar
357 * 357 *
358 * Returns the new hardware interface structure, or NULL on a failure 358 * Returns the new hardware interface structure, or NULL on a failure
359 */ 359 */
360 360
361static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev, ide_pci_device_t *d, ide_hwif_t *mate, int port, int irq) 361static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev, struct ide_port_info *d, ide_hwif_t *mate, int port, int irq)
362{ 362{
363 unsigned long ctl = 0, base = 0; 363 unsigned long ctl = 0, base = 0;
364 ide_hwif_t *hwif; 364 ide_hwif_t *hwif;
@@ -400,7 +400,7 @@ static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev, ide_pci_device_t *d,
400 } 400 }
401 hwif->chipset = d->chipset ? d->chipset : ide_pci; 401 hwif->chipset = d->chipset ? d->chipset : ide_pci;
402 hwif->pci_dev = dev; 402 hwif->pci_dev = dev;
403 hwif->cds = (struct ide_pci_device_s *) d; 403 hwif->cds = d;
404 hwif->channel = port; 404 hwif->channel = port;
405 405
406 if (!hwif->irq) 406 if (!hwif->irq)
@@ -415,21 +415,17 @@ static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev, ide_pci_device_t *d,
415/** 415/**
416 * ide_hwif_setup_dma - configure DMA interface 416 * ide_hwif_setup_dma - configure DMA interface
417 * @dev: PCI device 417 * @dev: PCI device
418 * @d: IDE pci data 418 * @d: IDE port info
419 * @hwif: Hardware interface we are configuring 419 * @hwif: IDE interface
420 * 420 *
421 * Set up the DMA base for the interface. Enable the master bits as 421 * Set up the DMA base for the interface. Enable the master bits as
422 * necessary and attempt to bring the device DMA into a ready to use 422 * necessary and attempt to bring the device DMA into a ready to use
423 * state 423 * state
424 */ 424 */
425 425
426#ifndef CONFIG_BLK_DEV_IDEDMA_PCI 426static void ide_hwif_setup_dma(struct pci_dev *dev, struct ide_port_info *d, ide_hwif_t *hwif)
427static void ide_hwif_setup_dma(struct pci_dev *dev, ide_pci_device_t *d, ide_hwif_t *hwif)
428{
429}
430#else
431static void ide_hwif_setup_dma(struct pci_dev *dev, ide_pci_device_t *d, ide_hwif_t *hwif)
432{ 427{
428#ifdef CONFIG_BLK_DEV_IDEDMA_PCI
433 u16 pcicmd; 429 u16 pcicmd;
434 430
435 pci_read_config_word(dev, PCI_COMMAND, &pcicmd); 431 pci_read_config_word(dev, PCI_COMMAND, &pcicmd);
@@ -461,13 +457,13 @@ static void ide_hwif_setup_dma(struct pci_dev *dev, ide_pci_device_t *d, ide_hwi
461 "(BIOS)\n", hwif->name, d->name); 457 "(BIOS)\n", hwif->name, d->name);
462 } 458 }
463 } 459 }
464}
465#endif /* CONFIG_BLK_DEV_IDEDMA_PCI*/ 460#endif /* CONFIG_BLK_DEV_IDEDMA_PCI*/
461}
466 462
467/** 463/**
468 * ide_setup_pci_controller - set up IDE PCI 464 * ide_setup_pci_controller - set up IDE PCI
469 * @dev: PCI device 465 * @dev: PCI device
470 * @d: IDE PCI data 466 * @d: IDE port info
471 * @noisy: verbose flag 467 * @noisy: verbose flag
472 * @config: returned as 1 if we configured the hardware 468 * @config: returned as 1 if we configured the hardware
473 * 469 *
@@ -475,8 +471,8 @@ static void ide_hwif_setup_dma(struct pci_dev *dev, ide_pci_device_t *d, ide_hwi
475 * up the PCI side of the device, checks that the device is enabled 471 * up the PCI side of the device, checks that the device is enabled
476 * and enables it if need be 472 * and enables it if need be
477 */ 473 */
478 474
479static int ide_setup_pci_controller(struct pci_dev *dev, ide_pci_device_t *d, int noisy, int *config) 475static int ide_setup_pci_controller(struct pci_dev *dev, struct ide_port_info *d, int noisy, int *config)
480{ 476{
481 int ret; 477 int ret;
482 u16 pcicmd; 478 u16 pcicmd;
@@ -511,7 +507,7 @@ out:
511/** 507/**
512 * ide_pci_setup_ports - configure ports/devices on PCI IDE 508 * ide_pci_setup_ports - configure ports/devices on PCI IDE
513 * @dev: PCI device 509 * @dev: PCI device
514 * @d: IDE pci device info 510 * @d: IDE port info
515 * @pciirq: IRQ line 511 * @pciirq: IRQ line
516 * @idx: ATA index table to update 512 * @idx: ATA index table to update
517 * 513 *
@@ -524,7 +520,7 @@ out:
524 * where the chipset setup is not the default PCI IDE one. 520 * where the chipset setup is not the default PCI IDE one.
525 */ 521 */
526 522
527void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, u8 *idx) 523void ide_pci_setup_ports(struct pci_dev *dev, struct ide_port_info *d, int pciirq, u8 *idx)
528{ 524{
529 int channels = (d->host_flags & IDE_HFLAG_SINGLE) ? 1 : 2, port; 525 int channels = (d->host_flags & IDE_HFLAG_SINGLE) ? 1 : 2, port;
530 ide_hwif_t *hwif, *mate = NULL; 526 ide_hwif_t *hwif, *mate = NULL;
@@ -611,10 +607,11 @@ EXPORT_SYMBOL_GPL(ide_pci_setup_ports);
611 * 607 *
612 * One thing that is not standardized is the location of the 608 * One thing that is not standardized is the location of the
613 * primary/secondary interface "enable/disable" bits. For chipsets that 609 * primary/secondary interface "enable/disable" bits. For chipsets that
614 * we "know" about, this information is in the ide_pci_device_t struct; 610 * we "know" about, this information is in the struct ide_port_info;
615 * for all other chipsets, we just assume both interfaces are enabled. 611 * for all other chipsets, we just assume both interfaces are enabled.
616 */ 612 */
617static int do_ide_setup_pci_device(struct pci_dev *dev, ide_pci_device_t *d, 613static int do_ide_setup_pci_device(struct pci_dev *dev,
614 struct ide_port_info *d,
618 u8 *idx, u8 noisy) 615 u8 *idx, u8 noisy)
619{ 616{
620 int tried_config = 0; 617 int tried_config = 0;
@@ -671,7 +668,7 @@ out:
671 return ret; 668 return ret;
672} 669}
673 670
674int ide_setup_pci_device(struct pci_dev *dev, ide_pci_device_t *d) 671int ide_setup_pci_device(struct pci_dev *dev, struct ide_port_info *d)
675{ 672{
676 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; 673 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
677 int ret; 674 int ret;
@@ -687,7 +684,7 @@ int ide_setup_pci_device(struct pci_dev *dev, ide_pci_device_t *d)
687EXPORT_SYMBOL_GPL(ide_setup_pci_device); 684EXPORT_SYMBOL_GPL(ide_setup_pci_device);
688 685
689int ide_setup_pci_devices(struct pci_dev *dev1, struct pci_dev *dev2, 686int ide_setup_pci_devices(struct pci_dev *dev1, struct pci_dev *dev2,
690 ide_pci_device_t *d) 687 struct ide_port_info *d)
691{ 688{
692 struct pci_dev *pdev[] = { dev1, dev2 }; 689 struct pci_dev *pdev[] = { dev1, dev2 };
693 int ret, i; 690 int ret, i;
@@ -728,9 +725,6 @@ static LIST_HEAD(ide_pci_drivers);
728 * hands the controllers off to the core PCI code to do the rest of 725 * hands the controllers off to the core PCI code to do the rest of
729 * the work. 726 * the work.
730 * 727 *
731 * The driver_data of the driver table must point to an ide_pci_device_t
732 * describing the interface.
733 *
734 * Returns are the same as for pci_register_driver 728 * Returns are the same as for pci_register_driver
735 */ 729 */
736 730