diff options
Diffstat (limited to 'drivers/ide/pci/piix.c')
-rw-r--r-- | drivers/ide/pci/piix.c | 118 |
1 files changed, 56 insertions, 62 deletions
diff --git a/drivers/ide/pci/piix.c b/drivers/ide/pci/piix.c index 0ce41b4dddaf..7fc3022dcf68 100644 --- a/drivers/ide/pci/piix.c +++ b/drivers/ide/pci/piix.c | |||
@@ -54,6 +54,8 @@ | |||
54 | 54 | ||
55 | #include <asm/io.h> | 55 | #include <asm/io.h> |
56 | 56 | ||
57 | #define DRV_NAME "piix" | ||
58 | |||
57 | static int no_piix_dma; | 59 | static int no_piix_dma; |
58 | 60 | ||
59 | /** | 61 | /** |
@@ -198,13 +200,12 @@ static void piix_set_dma_mode(ide_drive_t *drive, const u8 speed) | |||
198 | /** | 200 | /** |
199 | * init_chipset_ich - set up the ICH chipset | 201 | * init_chipset_ich - set up the ICH chipset |
200 | * @dev: PCI device to set up | 202 | * @dev: PCI device to set up |
201 | * @name: Name of the device | ||
202 | * | 203 | * |
203 | * Initialize the PCI device as required. For the ICH this turns | 204 | * Initialize the PCI device as required. For the ICH this turns |
204 | * out to be nice and simple. | 205 | * out to be nice and simple. |
205 | */ | 206 | */ |
206 | 207 | ||
207 | static unsigned int __devinit init_chipset_ich(struct pci_dev *dev, const char *name) | 208 | static unsigned int __devinit init_chipset_ich(struct pci_dev *dev) |
208 | { | 209 | { |
209 | u32 extra = 0; | 210 | u32 extra = 0; |
210 | 211 | ||
@@ -314,9 +315,9 @@ static const struct ide_port_ops piix_port_ops = { | |||
314 | #define IDE_HFLAGS_PIIX 0 | 315 | #define IDE_HFLAGS_PIIX 0 |
315 | #endif | 316 | #endif |
316 | 317 | ||
317 | #define DECLARE_PIIX_DEV(name_str, udma) \ | 318 | #define DECLARE_PIIX_DEV(udma) \ |
318 | { \ | 319 | { \ |
319 | .name = name_str, \ | 320 | .name = DRV_NAME, \ |
320 | .init_hwif = init_hwif_piix, \ | 321 | .init_hwif = init_hwif_piix, \ |
321 | .enablebits = {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, \ | 322 | .enablebits = {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, \ |
322 | .port_ops = &piix_port_ops, \ | 323 | .port_ops = &piix_port_ops, \ |
@@ -327,9 +328,9 @@ static const struct ide_port_ops piix_port_ops = { | |||
327 | .udma_mask = udma, \ | 328 | .udma_mask = udma, \ |
328 | } | 329 | } |
329 | 330 | ||
330 | #define DECLARE_ICH_DEV(name_str, udma) \ | 331 | #define DECLARE_ICH_DEV(udma) \ |
331 | { \ | 332 | { \ |
332 | .name = name_str, \ | 333 | .name = DRV_NAME, \ |
333 | .init_chipset = init_chipset_ich, \ | 334 | .init_chipset = init_chipset_ich, \ |
334 | .init_hwif = init_hwif_ich, \ | 335 | .init_hwif = init_hwif_ich, \ |
335 | .enablebits = {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, \ | 336 | .enablebits = {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, \ |
@@ -342,45 +343,31 @@ static const struct ide_port_ops piix_port_ops = { | |||
342 | } | 343 | } |
343 | 344 | ||
344 | static const struct ide_port_info piix_pci_info[] __devinitdata = { | 345 | static const struct ide_port_info piix_pci_info[] __devinitdata = { |
345 | /* 0 */ DECLARE_PIIX_DEV("PIIXa", 0x00), /* no udma */ | 346 | /* 0: MPIIX */ |
346 | /* 1 */ DECLARE_PIIX_DEV("PIIXb", 0x00), /* no udma */ | ||
347 | |||
348 | /* 2 */ | ||
349 | { /* | 347 | { /* |
350 | * MPIIX actually has only a single IDE channel mapped to | 348 | * MPIIX actually has only a single IDE channel mapped to |
351 | * the primary or secondary ports depending on the value | 349 | * the primary or secondary ports depending on the value |
352 | * of the bit 14 of the IDETIM register at offset 0x6c | 350 | * of the bit 14 of the IDETIM register at offset 0x6c |
353 | */ | 351 | */ |
354 | .name = "MPIIX", | 352 | .name = DRV_NAME, |
355 | .enablebits = {{0x6d,0xc0,0x80}, {0x6d,0xc0,0xc0}}, | 353 | .enablebits = {{0x6d,0xc0,0x80}, {0x6d,0xc0,0xc0}}, |
356 | .host_flags = IDE_HFLAG_ISA_PORTS | IDE_HFLAG_NO_DMA | | 354 | .host_flags = IDE_HFLAG_ISA_PORTS | IDE_HFLAG_NO_DMA | |
357 | IDE_HFLAGS_PIIX, | 355 | IDE_HFLAGS_PIIX, |
358 | .pio_mask = ATA_PIO4, | 356 | .pio_mask = ATA_PIO4, |
359 | /* This is a painful system best to let it self tune for now */ | 357 | /* This is a painful system best to let it self tune for now */ |
360 | }, | 358 | }, |
361 | 359 | /* 1: PIIXa/PIIXb/PIIX3 */ | |
362 | /* 3 */ DECLARE_PIIX_DEV("PIIX3", 0x00), /* no udma */ | 360 | DECLARE_PIIX_DEV(0x00), /* no udma */ |
363 | /* 4 */ DECLARE_PIIX_DEV("PIIX4", ATA_UDMA2), | 361 | /* 2: PIIX4 */ |
364 | /* 5 */ DECLARE_ICH_DEV("ICH0", ATA_UDMA2), | 362 | DECLARE_PIIX_DEV(ATA_UDMA2), |
365 | /* 6 */ DECLARE_PIIX_DEV("PIIX4", ATA_UDMA2), | 363 | /* 3: ICH0 */ |
366 | /* 7 */ DECLARE_ICH_DEV("ICH", ATA_UDMA4), | 364 | DECLARE_ICH_DEV(ATA_UDMA2), |
367 | /* 8 */ DECLARE_PIIX_DEV("PIIX4", ATA_UDMA4), | 365 | /* 4: ICH */ |
368 | /* 9 */ DECLARE_PIIX_DEV("PIIX4", ATA_UDMA2), | 366 | DECLARE_ICH_DEV(ATA_UDMA4), |
369 | /* 10 */ DECLARE_ICH_DEV("ICH2", ATA_UDMA5), | 367 | /* 5: PIIX4 */ |
370 | /* 11 */ DECLARE_ICH_DEV("ICH2M", ATA_UDMA5), | 368 | DECLARE_PIIX_DEV(ATA_UDMA4), |
371 | /* 12 */ DECLARE_ICH_DEV("ICH3M", ATA_UDMA5), | 369 | /* 6: ICH[2-7]/ICH[2-3]M/C-ICH/ICH5-SATA/ESB2/ICH8M */ |
372 | /* 13 */ DECLARE_ICH_DEV("ICH3", ATA_UDMA5), | 370 | DECLARE_ICH_DEV(ATA_UDMA5), |
373 | /* 14 */ DECLARE_ICH_DEV("ICH4", ATA_UDMA5), | ||
374 | /* 15 */ DECLARE_ICH_DEV("ICH5", ATA_UDMA5), | ||
375 | /* 16 */ DECLARE_ICH_DEV("C-ICH", ATA_UDMA5), | ||
376 | /* 17 */ DECLARE_ICH_DEV("ICH4", ATA_UDMA5), | ||
377 | /* 18 */ DECLARE_ICH_DEV("ICH5-SATA", ATA_UDMA5), | ||
378 | /* 19 */ DECLARE_ICH_DEV("ICH5", ATA_UDMA5), | ||
379 | /* 20 */ DECLARE_ICH_DEV("ICH6", ATA_UDMA5), | ||
380 | /* 21 */ DECLARE_ICH_DEV("ICH7", ATA_UDMA5), | ||
381 | /* 22 */ DECLARE_ICH_DEV("ICH4", ATA_UDMA5), | ||
382 | /* 23 */ DECLARE_ICH_DEV("ESB2", ATA_UDMA5), | ||
383 | /* 24 */ DECLARE_ICH_DEV("ICH8M", ATA_UDMA5), | ||
384 | }; | 371 | }; |
385 | 372 | ||
386 | /** | 373 | /** |
@@ -394,7 +381,7 @@ static const struct ide_port_info piix_pci_info[] __devinitdata = { | |||
394 | 381 | ||
395 | static int __devinit piix_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 382 | static int __devinit piix_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
396 | { | 383 | { |
397 | return ide_setup_pci_device(dev, &piix_pci_info[id->driver_data]); | 384 | return ide_pci_init_one(dev, &piix_pci_info[id->driver_data], NULL); |
398 | } | 385 | } |
399 | 386 | ||
400 | /** | 387 | /** |
@@ -421,39 +408,39 @@ static void __devinit piix_check_450nx(void) | |||
421 | no_piix_dma = 2; | 408 | no_piix_dma = 2; |
422 | } | 409 | } |
423 | if(no_piix_dma) | 410 | if(no_piix_dma) |
424 | printk(KERN_WARNING "piix: 450NX errata present, disabling IDE DMA.\n"); | 411 | printk(KERN_WARNING DRV_NAME ": 450NX errata present, disabling IDE DMA.\n"); |
425 | if(no_piix_dma == 2) | 412 | if(no_piix_dma == 2) |
426 | printk(KERN_WARNING "piix: A BIOS update may resolve this.\n"); | 413 | printk(KERN_WARNING DRV_NAME ": A BIOS update may resolve this.\n"); |
427 | } | 414 | } |
428 | 415 | ||
429 | static const struct pci_device_id piix_pci_tbl[] = { | 416 | static const struct pci_device_id piix_pci_tbl[] = { |
430 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82371FB_0), 0 }, | 417 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82371FB_0), 1 }, |
431 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82371FB_1), 1 }, | 418 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82371FB_1), 1 }, |
432 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82371MX), 2 }, | 419 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82371MX), 0 }, |
433 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82371SB_1), 3 }, | 420 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82371SB_1), 1 }, |
434 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82371AB), 4 }, | 421 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82371AB), 2 }, |
435 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82801AB_1), 5 }, | 422 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82801AB_1), 3 }, |
436 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82443MX_1), 6 }, | 423 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82443MX_1), 2 }, |
437 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82801AA_1), 7 }, | 424 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82801AA_1), 4 }, |
438 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82372FB_1), 8 }, | 425 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82372FB_1), 5 }, |
439 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82451NX), 9 }, | 426 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82451NX), 2 }, |
440 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82801BA_9), 10 }, | 427 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82801BA_9), 6 }, |
441 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82801BA_8), 11 }, | 428 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82801BA_8), 6 }, |
442 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82801CA_10), 12 }, | 429 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82801CA_10), 6 }, |
443 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82801CA_11), 13 }, | 430 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82801CA_11), 6 }, |
444 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82801DB_11), 14 }, | 431 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82801DB_11), 6 }, |
445 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82801EB_11), 15 }, | 432 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82801EB_11), 6 }, |
446 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82801E_11), 16 }, | 433 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82801E_11), 6 }, |
447 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82801DB_10), 17 }, | 434 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82801DB_10), 6 }, |
448 | #ifdef CONFIG_BLK_DEV_IDE_SATA | 435 | #ifdef CONFIG_BLK_DEV_IDE_SATA |
449 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82801EB_1), 18 }, | 436 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82801EB_1), 6 }, |
450 | #endif | 437 | #endif |
451 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ESB_2), 19 }, | 438 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ESB_2), 6 }, |
452 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ICH6_19), 20 }, | 439 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ICH6_19), 6 }, |
453 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ICH7_21), 21 }, | 440 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ICH7_21), 6 }, |
454 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82801DB_1), 22 }, | 441 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82801DB_1), 6 }, |
455 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ESB2_18), 23 }, | 442 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ESB2_18), 6 }, |
456 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ICH8_6), 24 }, | 443 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ICH8_6), 6 }, |
457 | { 0, }, | 444 | { 0, }, |
458 | }; | 445 | }; |
459 | MODULE_DEVICE_TABLE(pci, piix_pci_tbl); | 446 | MODULE_DEVICE_TABLE(pci, piix_pci_tbl); |
@@ -462,6 +449,7 @@ static struct pci_driver driver = { | |||
462 | .name = "PIIX_IDE", | 449 | .name = "PIIX_IDE", |
463 | .id_table = piix_pci_tbl, | 450 | .id_table = piix_pci_tbl, |
464 | .probe = piix_init_one, | 451 | .probe = piix_init_one, |
452 | .remove = ide_pci_remove, | ||
465 | }; | 453 | }; |
466 | 454 | ||
467 | static int __init piix_ide_init(void) | 455 | static int __init piix_ide_init(void) |
@@ -470,7 +458,13 @@ static int __init piix_ide_init(void) | |||
470 | return ide_pci_register_driver(&driver); | 458 | return ide_pci_register_driver(&driver); |
471 | } | 459 | } |
472 | 460 | ||
461 | static void __exit piix_ide_exit(void) | ||
462 | { | ||
463 | pci_unregister_driver(&driver); | ||
464 | } | ||
465 | |||
473 | module_init(piix_ide_init); | 466 | module_init(piix_ide_init); |
467 | module_exit(piix_ide_exit); | ||
474 | 468 | ||
475 | MODULE_AUTHOR("Andre Hedrick, Andrzej Krzysztofowicz"); | 469 | MODULE_AUTHOR("Andre Hedrick, Andrzej Krzysztofowicz"); |
476 | MODULE_DESCRIPTION("PCI driver module for Intel PIIX IDE"); | 470 | MODULE_DESCRIPTION("PCI driver module for Intel PIIX IDE"); |