diff options
author | Jeff Garzik <jeff@garzik.org> | 2007-06-12 22:34:34 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-06-12 22:34:34 -0400 |
commit | b232923966f1210e1183353bbd1d52ee53b79fbf (patch) | |
tree | e90c72b2cb400af53e1f92aff0af122782d7f65c /drivers | |
parent | bca1a5518cab2d58c766863c61ee4ef5f1cc4caa (diff) | |
parent | 99f9f3d49cbc7d944476f6fde53a77ec789ab2aa (diff) |
Merge branch 'master' into upstream-fixes
Diffstat (limited to 'drivers')
47 files changed, 969 insertions, 628 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 7baeaffefe7a..545f330e59a5 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
@@ -426,6 +426,30 @@ static const struct pci_device_id ahci_pci_tbl[] = { | |||
426 | { PCI_VDEVICE(NVIDIA, 0x0559), board_ahci }, /* MCP67 */ | 426 | { PCI_VDEVICE(NVIDIA, 0x0559), board_ahci }, /* MCP67 */ |
427 | { PCI_VDEVICE(NVIDIA, 0x055a), board_ahci }, /* MCP67 */ | 427 | { PCI_VDEVICE(NVIDIA, 0x055a), board_ahci }, /* MCP67 */ |
428 | { PCI_VDEVICE(NVIDIA, 0x055b), board_ahci }, /* MCP67 */ | 428 | { PCI_VDEVICE(NVIDIA, 0x055b), board_ahci }, /* MCP67 */ |
429 | { PCI_VDEVICE(NVIDIA, 0x07f0), board_ahci }, /* MCP73 */ | ||
430 | { PCI_VDEVICE(NVIDIA, 0x07f1), board_ahci }, /* MCP73 */ | ||
431 | { PCI_VDEVICE(NVIDIA, 0x07f2), board_ahci }, /* MCP73 */ | ||
432 | { PCI_VDEVICE(NVIDIA, 0x07f3), board_ahci }, /* MCP73 */ | ||
433 | { PCI_VDEVICE(NVIDIA, 0x07f4), board_ahci }, /* MCP73 */ | ||
434 | { PCI_VDEVICE(NVIDIA, 0x07f5), board_ahci }, /* MCP73 */ | ||
435 | { PCI_VDEVICE(NVIDIA, 0x07f6), board_ahci }, /* MCP73 */ | ||
436 | { PCI_VDEVICE(NVIDIA, 0x07f7), board_ahci }, /* MCP73 */ | ||
437 | { PCI_VDEVICE(NVIDIA, 0x07f8), board_ahci }, /* MCP73 */ | ||
438 | { PCI_VDEVICE(NVIDIA, 0x07f9), board_ahci }, /* MCP73 */ | ||
439 | { PCI_VDEVICE(NVIDIA, 0x07fa), board_ahci }, /* MCP73 */ | ||
440 | { PCI_VDEVICE(NVIDIA, 0x07fb), board_ahci }, /* MCP73 */ | ||
441 | { PCI_VDEVICE(NVIDIA, 0x0ad0), board_ahci }, /* MCP77 */ | ||
442 | { PCI_VDEVICE(NVIDIA, 0x0ad1), board_ahci }, /* MCP77 */ | ||
443 | { PCI_VDEVICE(NVIDIA, 0x0ad2), board_ahci }, /* MCP77 */ | ||
444 | { PCI_VDEVICE(NVIDIA, 0x0ad3), board_ahci }, /* MCP77 */ | ||
445 | { PCI_VDEVICE(NVIDIA, 0x0ad4), board_ahci }, /* MCP77 */ | ||
446 | { PCI_VDEVICE(NVIDIA, 0x0ad5), board_ahci }, /* MCP77 */ | ||
447 | { PCI_VDEVICE(NVIDIA, 0x0ad6), board_ahci }, /* MCP77 */ | ||
448 | { PCI_VDEVICE(NVIDIA, 0x0ad7), board_ahci }, /* MCP77 */ | ||
449 | { PCI_VDEVICE(NVIDIA, 0x0ad8), board_ahci }, /* MCP77 */ | ||
450 | { PCI_VDEVICE(NVIDIA, 0x0ad9), board_ahci }, /* MCP77 */ | ||
451 | { PCI_VDEVICE(NVIDIA, 0x0ada), board_ahci }, /* MCP77 */ | ||
452 | { PCI_VDEVICE(NVIDIA, 0x0adb), board_ahci }, /* MCP77 */ | ||
429 | 453 | ||
430 | /* SiS */ | 454 | /* SiS */ |
431 | { PCI_VDEVICE(SI, 0x1184), board_ahci }, /* SiS 966 */ | 455 | { PCI_VDEVICE(SI, 0x1184), board_ahci }, /* SiS 966 */ |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 4733f009c7c9..047eabd75363 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -1727,7 +1727,7 @@ int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class, | |||
1727 | 1727 | ||
1728 | /* sanity check */ | 1728 | /* sanity check */ |
1729 | rc = -EINVAL; | 1729 | rc = -EINVAL; |
1730 | reason = "device reports illegal type"; | 1730 | reason = "device reports invalid type"; |
1731 | 1731 | ||
1732 | if (class == ATA_DEV_ATA) { | 1732 | if (class == ATA_DEV_ATA) { |
1733 | if (!ata_id_is_ata(id) && !ata_id_is_cfa(id)) | 1733 | if (!ata_id_is_ata(id) && !ata_id_is_cfa(id)) |
@@ -1900,6 +1900,13 @@ int ata_dev_configure(struct ata_device *dev) | |||
1900 | if (ata_msg_probe(ap)) | 1900 | if (ata_msg_probe(ap)) |
1901 | ata_dump_id(id); | 1901 | ata_dump_id(id); |
1902 | 1902 | ||
1903 | /* SCSI only uses 4-char revisions, dump full 8 chars from ATA */ | ||
1904 | ata_id_c_string(dev->id, fwrevbuf, ATA_ID_FW_REV, | ||
1905 | sizeof(fwrevbuf)); | ||
1906 | |||
1907 | ata_id_c_string(dev->id, modelbuf, ATA_ID_PROD, | ||
1908 | sizeof(modelbuf)); | ||
1909 | |||
1903 | /* ATA-specific feature tests */ | 1910 | /* ATA-specific feature tests */ |
1904 | if (dev->class == ATA_DEV_ATA) { | 1911 | if (dev->class == ATA_DEV_ATA) { |
1905 | if (ata_id_is_cfa(id)) { | 1912 | if (ata_id_is_cfa(id)) { |
@@ -1914,13 +1921,6 @@ int ata_dev_configure(struct ata_device *dev) | |||
1914 | 1921 | ||
1915 | dev->n_sectors = ata_id_n_sectors(id); | 1922 | dev->n_sectors = ata_id_n_sectors(id); |
1916 | 1923 | ||
1917 | /* SCSI only uses 4-char revisions, dump full 8 chars from ATA */ | ||
1918 | ata_id_c_string(dev->id, fwrevbuf, ATA_ID_FW_REV, | ||
1919 | sizeof(fwrevbuf)); | ||
1920 | |||
1921 | ata_id_c_string(dev->id, modelbuf, ATA_ID_PROD, | ||
1922 | sizeof(modelbuf)); | ||
1923 | |||
1924 | if (dev->id[59] & 0x100) | 1924 | if (dev->id[59] & 0x100) |
1925 | dev->multi_count = dev->id[59] & 0xff; | 1925 | dev->multi_count = dev->id[59] & 0xff; |
1926 | 1926 | ||
@@ -2009,7 +2009,9 @@ int ata_dev_configure(struct ata_device *dev) | |||
2009 | 2009 | ||
2010 | /* print device info to dmesg */ | 2010 | /* print device info to dmesg */ |
2011 | if (ata_msg_drv(ap) && print_info) | 2011 | if (ata_msg_drv(ap) && print_info) |
2012 | ata_dev_printk(dev, KERN_INFO, "ATAPI, max %s%s\n", | 2012 | ata_dev_printk(dev, KERN_INFO, |
2013 | "ATAPI: %s, %s, max %s%s\n", | ||
2014 | modelbuf, fwrevbuf, | ||
2013 | ata_mode_string(xfer_mask), | 2015 | ata_mode_string(xfer_mask), |
2014 | cdb_intr_string); | 2016 | cdb_intr_string); |
2015 | } | 2017 | } |
@@ -3059,22 +3061,28 @@ static int ata_bus_post_reset(struct ata_port *ap, unsigned int devmask, | |||
3059 | } | 3061 | } |
3060 | } | 3062 | } |
3061 | 3063 | ||
3062 | /* if device 1 was found in ata_devchk, wait for | 3064 | /* if device 1 was found in ata_devchk, wait for register |
3063 | * register access, then wait for BSY to clear | 3065 | * access briefly, then wait for BSY to clear. |
3064 | */ | 3066 | */ |
3065 | while (dev1) { | 3067 | if (dev1) { |
3066 | u8 nsect, lbal; | 3068 | int i; |
3067 | 3069 | ||
3068 | ap->ops->dev_select(ap, 1); | 3070 | ap->ops->dev_select(ap, 1); |
3069 | nsect = ioread8(ioaddr->nsect_addr); | 3071 | |
3070 | lbal = ioread8(ioaddr->lbal_addr); | 3072 | /* Wait for register access. Some ATAPI devices fail |
3071 | if ((nsect == 1) && (lbal == 1)) | 3073 | * to set nsect/lbal after reset, so don't waste too |
3072 | break; | 3074 | * much time on it. We're gonna wait for !BSY anyway. |
3073 | if (time_after(jiffies, deadline)) | 3075 | */ |
3074 | return -EBUSY; | 3076 | for (i = 0; i < 2; i++) { |
3075 | msleep(50); /* give drive a breather */ | 3077 | u8 nsect, lbal; |
3076 | } | 3078 | |
3077 | if (dev1) { | 3079 | nsect = ioread8(ioaddr->nsect_addr); |
3080 | lbal = ioread8(ioaddr->lbal_addr); | ||
3081 | if ((nsect == 1) && (lbal == 1)) | ||
3082 | break; | ||
3083 | msleep(50); /* give drive a breather */ | ||
3084 | } | ||
3085 | |||
3078 | rc = ata_wait_ready(ap, deadline); | 3086 | rc = ata_wait_ready(ap, deadline); |
3079 | if (rc) { | 3087 | if (rc) { |
3080 | if (rc != -ENODEV) | 3088 | if (rc != -ENODEV) |
@@ -3769,6 +3777,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | |||
3769 | { "_NEC DV5800A", NULL, ATA_HORKAGE_NODMA }, | 3777 | { "_NEC DV5800A", NULL, ATA_HORKAGE_NODMA }, |
3770 | { "SAMSUNG CD-ROM SN-124","N001", ATA_HORKAGE_NODMA }, | 3778 | { "SAMSUNG CD-ROM SN-124","N001", ATA_HORKAGE_NODMA }, |
3771 | { "Seagate STT20000A", NULL, ATA_HORKAGE_NODMA }, | 3779 | { "Seagate STT20000A", NULL, ATA_HORKAGE_NODMA }, |
3780 | { "IOMEGA ZIP 250 ATAPI", NULL, ATA_HORKAGE_NODMA }, /* temporary fix */ | ||
3772 | 3781 | ||
3773 | /* Weird ATAPI devices */ | 3782 | /* Weird ATAPI devices */ |
3774 | { "TORiSAN DVD-ROM DRD-N216", NULL, ATA_HORKAGE_MAX_SEC_128 | | 3783 | { "TORiSAN DVD-ROM DRD-N216", NULL, ATA_HORKAGE_MAX_SEC_128 | |
@@ -3791,6 +3800,8 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | |||
3791 | { "HTS541060G9SA00", "MB3OC60D", ATA_HORKAGE_NONCQ, }, | 3800 | { "HTS541060G9SA00", "MB3OC60D", ATA_HORKAGE_NONCQ, }, |
3792 | { "HTS541080G9SA00", "MB4OC60D", ATA_HORKAGE_NONCQ, }, | 3801 | { "HTS541080G9SA00", "MB4OC60D", ATA_HORKAGE_NONCQ, }, |
3793 | { "HTS541010G9SA00", "MBZOC60D", ATA_HORKAGE_NONCQ, }, | 3802 | { "HTS541010G9SA00", "MBZOC60D", ATA_HORKAGE_NONCQ, }, |
3803 | /* Drives which do spurious command completion */ | ||
3804 | { "HTS541680J9SA00", "SB2IC7EP", ATA_HORKAGE_NONCQ, }, | ||
3794 | 3805 | ||
3795 | /* Devices with NCQ limits */ | 3806 | /* Devices with NCQ limits */ |
3796 | 3807 | ||
@@ -6313,7 +6324,8 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht) | |||
6313 | /* init sata_spd_limit to the current value */ | 6324 | /* init sata_spd_limit to the current value */ |
6314 | if (sata_scr_read(ap, SCR_CONTROL, &scontrol) == 0) { | 6325 | if (sata_scr_read(ap, SCR_CONTROL, &scontrol) == 0) { |
6315 | int spd = (scontrol >> 4) & 0xf; | 6326 | int spd = (scontrol >> 4) & 0xf; |
6316 | ap->hw_sata_spd_limit &= (1 << spd) - 1; | 6327 | if (spd) |
6328 | ap->hw_sata_spd_limit &= (1 << spd) - 1; | ||
6317 | } | 6329 | } |
6318 | ap->sata_spd_limit = ap->hw_sata_spd_limit; | 6330 | ap->sata_spd_limit = ap->hw_sata_spd_limit; |
6319 | 6331 | ||
@@ -6433,6 +6445,9 @@ int ata_host_activate(struct ata_host *host, int irq, | |||
6433 | if (rc) | 6445 | if (rc) |
6434 | devm_free_irq(host->dev, irq, host); | 6446 | devm_free_irq(host->dev, irq, host); |
6435 | 6447 | ||
6448 | /* Used to print device info at probe */ | ||
6449 | host->irq = irq; | ||
6450 | |||
6436 | return rc; | 6451 | return rc; |
6437 | } | 6452 | } |
6438 | 6453 | ||
@@ -6818,6 +6833,7 @@ EXPORT_SYMBOL_GPL(ata_check_status); | |||
6818 | EXPORT_SYMBOL_GPL(ata_altstatus); | 6833 | EXPORT_SYMBOL_GPL(ata_altstatus); |
6819 | EXPORT_SYMBOL_GPL(ata_exec_command); | 6834 | EXPORT_SYMBOL_GPL(ata_exec_command); |
6820 | EXPORT_SYMBOL_GPL(ata_port_start); | 6835 | EXPORT_SYMBOL_GPL(ata_port_start); |
6836 | EXPORT_SYMBOL_GPL(ata_sff_port_start); | ||
6821 | EXPORT_SYMBOL_GPL(ata_interrupt); | 6837 | EXPORT_SYMBOL_GPL(ata_interrupt); |
6822 | EXPORT_SYMBOL_GPL(ata_do_set_mode); | 6838 | EXPORT_SYMBOL_GPL(ata_do_set_mode); |
6823 | EXPORT_SYMBOL_GPL(ata_data_xfer); | 6839 | EXPORT_SYMBOL_GPL(ata_data_xfer); |
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index b3900cfbd880..c228df298bd8 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
@@ -1363,12 +1363,22 @@ static void ata_scsi_qc_complete(struct ata_queued_cmd *qc) | |||
1363 | * schedule EH_REVALIDATE operation to update the IDENTIFY DEVICE | 1363 | * schedule EH_REVALIDATE operation to update the IDENTIFY DEVICE |
1364 | * cache | 1364 | * cache |
1365 | */ | 1365 | */ |
1366 | if (ap->ops->error_handler && | 1366 | if (ap->ops->error_handler && !need_sense) { |
1367 | !need_sense && (qc->tf.command == ATA_CMD_SET_FEATURES) && | 1367 | switch (qc->tf.command) { |
1368 | ((qc->tf.feature == SETFEATURES_WC_ON) || | 1368 | case ATA_CMD_SET_FEATURES: |
1369 | (qc->tf.feature == SETFEATURES_WC_OFF))) { | 1369 | if ((qc->tf.feature == SETFEATURES_WC_ON) || |
1370 | ap->eh_info.action |= ATA_EH_REVALIDATE; | 1370 | (qc->tf.feature == SETFEATURES_WC_OFF)) { |
1371 | ata_port_schedule_eh(ap); | 1371 | ap->eh_info.action |= ATA_EH_REVALIDATE; |
1372 | ata_port_schedule_eh(ap); | ||
1373 | } | ||
1374 | break; | ||
1375 | |||
1376 | case ATA_CMD_INIT_DEV_PARAMS: /* CHS translation changed */ | ||
1377 | case ATA_CMD_SET_MULTI: /* multi_count changed */ | ||
1378 | ap->eh_info.action |= ATA_EH_REVALIDATE; | ||
1379 | ata_port_schedule_eh(ap); | ||
1380 | break; | ||
1381 | } | ||
1372 | } | 1382 | } |
1373 | 1383 | ||
1374 | /* For ATA pass thru (SAT) commands, generate a sense block if | 1384 | /* For ATA pass thru (SAT) commands, generate a sense block if |
@@ -2506,22 +2516,21 @@ ata_scsi_map_proto(u8 byte1) | |||
2506 | return ATA_PROT_NODATA; | 2516 | return ATA_PROT_NODATA; |
2507 | 2517 | ||
2508 | case 6: /* DMA */ | 2518 | case 6: /* DMA */ |
2519 | case 10: /* UDMA Data-in */ | ||
2520 | case 11: /* UDMA Data-Out */ | ||
2509 | return ATA_PROT_DMA; | 2521 | return ATA_PROT_DMA; |
2510 | 2522 | ||
2511 | case 4: /* PIO Data-in */ | 2523 | case 4: /* PIO Data-in */ |
2512 | case 5: /* PIO Data-out */ | 2524 | case 5: /* PIO Data-out */ |
2513 | return ATA_PROT_PIO; | 2525 | return ATA_PROT_PIO; |
2514 | 2526 | ||
2515 | case 10: /* Device Reset */ | ||
2516 | case 0: /* Hard Reset */ | 2527 | case 0: /* Hard Reset */ |
2517 | case 1: /* SRST */ | 2528 | case 1: /* SRST */ |
2518 | case 2: /* Bus Idle */ | 2529 | case 8: /* Device Diagnostic */ |
2519 | case 7: /* Packet */ | 2530 | case 9: /* Device Reset */ |
2520 | case 8: /* DMA Queued */ | 2531 | case 7: /* DMA Queued */ |
2521 | case 9: /* Device Diagnostic */ | 2532 | case 12: /* FPDMA */ |
2522 | case 11: /* UDMA Data-in */ | 2533 | case 15: /* Return Response Info */ |
2523 | case 12: /* UDMA Data-Out */ | ||
2524 | case 13: /* FPDMA */ | ||
2525 | default: /* Reserved */ | 2534 | default: /* Reserved */ |
2526 | break; | 2535 | break; |
2527 | } | 2536 | } |
@@ -2552,10 +2561,6 @@ static unsigned int ata_scsi_pass_thru(struct ata_queued_cmd *qc) | |||
2552 | if (tf->protocol == ATA_PROT_DMA && dev->dma_mode == 0) | 2561 | if (tf->protocol == ATA_PROT_DMA && dev->dma_mode == 0) |
2553 | goto invalid_fld; | 2562 | goto invalid_fld; |
2554 | 2563 | ||
2555 | if (cdb[1] & 0xe0) | ||
2556 | /* PIO multi not supported yet */ | ||
2557 | goto invalid_fld; | ||
2558 | |||
2559 | /* | 2564 | /* |
2560 | * 12 and 16 byte CDBs use different offsets to | 2565 | * 12 and 16 byte CDBs use different offsets to |
2561 | * provide the various register values. | 2566 | * provide the various register values. |
@@ -2600,12 +2605,26 @@ static unsigned int ata_scsi_pass_thru(struct ata_queued_cmd *qc) | |||
2600 | tf->device = cdb[8]; | 2605 | tf->device = cdb[8]; |
2601 | tf->command = cdb[9]; | 2606 | tf->command = cdb[9]; |
2602 | } | 2607 | } |
2603 | /* | 2608 | |
2604 | * If slave is possible, enforce correct master/slave bit | 2609 | /* enforce correct master/slave bit */ |
2605 | */ | 2610 | tf->device = dev->devno ? |
2606 | if (qc->ap->flags & ATA_FLAG_SLAVE_POSS) | 2611 | tf->device | ATA_DEV1 : tf->device & ~ATA_DEV1; |
2607 | tf->device = qc->dev->devno ? | 2612 | |
2608 | tf->device | ATA_DEV1 : tf->device & ~ATA_DEV1; | 2613 | /* sanity check for pio multi commands */ |
2614 | if ((cdb[1] & 0xe0) && !is_multi_taskfile(tf)) | ||
2615 | goto invalid_fld; | ||
2616 | |||
2617 | if (is_multi_taskfile(tf)) { | ||
2618 | unsigned int multi_count = 1 << (cdb[1] >> 5); | ||
2619 | |||
2620 | /* compare the passed through multi_count | ||
2621 | * with the cached multi_count of libata | ||
2622 | */ | ||
2623 | if (multi_count != dev->multi_count) | ||
2624 | ata_dev_printk(dev, KERN_WARNING, | ||
2625 | "invalid multi_count %u ignored\n", | ||
2626 | multi_count); | ||
2627 | } | ||
2609 | 2628 | ||
2610 | /* READ/WRITE LONG use a non-standard sect_size */ | 2629 | /* READ/WRITE LONG use a non-standard sect_size */ |
2611 | qc->sect_size = ATA_SECT_SIZE; | 2630 | qc->sect_size = ATA_SECT_SIZE; |
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c index e35d13466c69..ce84805ba5f1 100644 --- a/drivers/ata/libata-sff.c +++ b/drivers/ata/libata-sff.c | |||
@@ -80,25 +80,25 @@ u8 ata_dummy_irq_on (struct ata_port *ap) { return 0; } | |||
80 | u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq) | 80 | u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq) |
81 | { | 81 | { |
82 | unsigned int bits = chk_drq ? ATA_BUSY | ATA_DRQ : ATA_BUSY; | 82 | unsigned int bits = chk_drq ? ATA_BUSY | ATA_DRQ : ATA_BUSY; |
83 | u8 host_stat, post_stat, status; | 83 | u8 host_stat = 0, post_stat = 0, status; |
84 | 84 | ||
85 | status = ata_busy_wait(ap, bits, 1000); | 85 | status = ata_busy_wait(ap, bits, 1000); |
86 | if (status & bits) | 86 | if (status & bits) |
87 | if (ata_msg_err(ap)) | 87 | if (ata_msg_err(ap)) |
88 | printk(KERN_ERR "abnormal status 0x%X\n", status); | 88 | printk(KERN_ERR "abnormal status 0x%X\n", status); |
89 | 89 | ||
90 | /* get controller status; clear intr, err bits */ | 90 | if (ap->ioaddr.bmdma_addr) { |
91 | host_stat = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS); | 91 | /* get controller status; clear intr, err bits */ |
92 | iowrite8(host_stat | ATA_DMA_INTR | ATA_DMA_ERR, | 92 | host_stat = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS); |
93 | ap->ioaddr.bmdma_addr + ATA_DMA_STATUS); | 93 | iowrite8(host_stat | ATA_DMA_INTR | ATA_DMA_ERR, |
94 | 94 | ap->ioaddr.bmdma_addr + ATA_DMA_STATUS); | |
95 | post_stat = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS); | ||
96 | 95 | ||
96 | post_stat = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS); | ||
97 | } | ||
97 | if (ata_msg_intr(ap)) | 98 | if (ata_msg_intr(ap)) |
98 | printk(KERN_INFO "%s: irq ack: host_stat 0x%X, new host_stat 0x%X, drv_stat 0x%X\n", | 99 | printk(KERN_INFO "%s: irq ack: host_stat 0x%X, new host_stat 0x%X, drv_stat 0x%X\n", |
99 | __FUNCTION__, | 100 | __FUNCTION__, |
100 | host_stat, post_stat, status); | 101 | host_stat, post_stat, status); |
101 | |||
102 | return status; | 102 | return status; |
103 | } | 103 | } |
104 | 104 | ||
@@ -516,6 +516,27 @@ void ata_bmdma_post_internal_cmd(struct ata_queued_cmd *qc) | |||
516 | ata_bmdma_stop(qc); | 516 | ata_bmdma_stop(qc); |
517 | } | 517 | } |
518 | 518 | ||
519 | /** | ||
520 | * ata_sff_port_start - Set port up for dma. | ||
521 | * @ap: Port to initialize | ||
522 | * | ||
523 | * Called just after data structures for each port are | ||
524 | * initialized. Allocates space for PRD table if the device | ||
525 | * is DMA capable SFF. | ||
526 | * | ||
527 | * May be used as the port_start() entry in ata_port_operations. | ||
528 | * | ||
529 | * LOCKING: | ||
530 | * Inherited from caller. | ||
531 | */ | ||
532 | |||
533 | int ata_sff_port_start(struct ata_port *ap) | ||
534 | { | ||
535 | if (ap->ioaddr.bmdma_addr) | ||
536 | return ata_port_start(ap); | ||
537 | return 0; | ||
538 | } | ||
539 | |||
519 | #ifdef CONFIG_PCI | 540 | #ifdef CONFIG_PCI |
520 | 541 | ||
521 | static int ata_resources_present(struct pci_dev *pdev, int port) | 542 | static int ata_resources_present(struct pci_dev *pdev, int port) |
diff --git a/drivers/ata/pata_isapnp.c b/drivers/ata/pata_isapnp.c index 1f647b648204..5525518204e6 100644 --- a/drivers/ata/pata_isapnp.c +++ b/drivers/ata/pata_isapnp.c | |||
@@ -77,7 +77,6 @@ static int isapnp_init_one(struct pnp_dev *idev, const struct pnp_device_id *dev | |||
77 | struct ata_host *host; | 77 | struct ata_host *host; |
78 | struct ata_port *ap; | 78 | struct ata_port *ap; |
79 | void __iomem *cmd_addr, *ctl_addr; | 79 | void __iomem *cmd_addr, *ctl_addr; |
80 | int rc; | ||
81 | 80 | ||
82 | if (pnp_port_valid(idev, 0) == 0) | 81 | if (pnp_port_valid(idev, 0) == 0) |
83 | return -ENODEV; | 82 | return -ENODEV; |
diff --git a/drivers/char/agp/agp.h b/drivers/char/agp/agp.h index fdbca25a3948..35ab1a9f8e8b 100644 --- a/drivers/char/agp/agp.h +++ b/drivers/char/agp/agp.h | |||
@@ -176,7 +176,7 @@ struct agp_bridge_data { | |||
176 | #define I830_GMCH_MEM_MASK 0x1 | 176 | #define I830_GMCH_MEM_MASK 0x1 |
177 | #define I830_GMCH_MEM_64M 0x1 | 177 | #define I830_GMCH_MEM_64M 0x1 |
178 | #define I830_GMCH_MEM_128M 0 | 178 | #define I830_GMCH_MEM_128M 0 |
179 | #define I830_GMCH_GMS_MASK 0x70 | 179 | #define I830_GMCH_GMS_MASK 0xF0 |
180 | #define I830_GMCH_GMS_DISABLED 0x00 | 180 | #define I830_GMCH_GMS_DISABLED 0x00 |
181 | #define I830_GMCH_GMS_LOCAL 0x10 | 181 | #define I830_GMCH_GMS_LOCAL 0x10 |
182 | #define I830_GMCH_GMS_STOLEN_512 0x20 | 182 | #define I830_GMCH_GMS_STOLEN_512 0x20 |
@@ -231,6 +231,10 @@ struct agp_bridge_data { | |||
231 | #define I965_PGETBL_SIZE_512KB (0 << 1) | 231 | #define I965_PGETBL_SIZE_512KB (0 << 1) |
232 | #define I965_PGETBL_SIZE_256KB (1 << 1) | 232 | #define I965_PGETBL_SIZE_256KB (1 << 1) |
233 | #define I965_PGETBL_SIZE_128KB (2 << 1) | 233 | #define I965_PGETBL_SIZE_128KB (2 << 1) |
234 | #define G33_PGETBL_SIZE_MASK (3 << 8) | ||
235 | #define G33_PGETBL_SIZE_1M (1 << 8) | ||
236 | #define G33_PGETBL_SIZE_2M (2 << 8) | ||
237 | |||
234 | #define I810_DRAM_CTL 0x3000 | 238 | #define I810_DRAM_CTL 0x3000 |
235 | #define I810_DRAM_ROW_0 0x00000001 | 239 | #define I810_DRAM_ROW_0 0x00000001 |
236 | #define I810_DRAM_ROW_0_SDRAM 0x00000001 | 240 | #define I810_DRAM_ROW_0_SDRAM 0x00000001 |
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c index 9c69f2e761f5..d383168b75fa 100644 --- a/drivers/char/agp/intel-agp.c +++ b/drivers/char/agp/intel-agp.c | |||
@@ -20,6 +20,14 @@ | |||
20 | #define PCI_DEVICE_ID_INTEL_82965G_IG 0x29A2 | 20 | #define PCI_DEVICE_ID_INTEL_82965G_IG 0x29A2 |
21 | #define PCI_DEVICE_ID_INTEL_82965GM_HB 0x2A00 | 21 | #define PCI_DEVICE_ID_INTEL_82965GM_HB 0x2A00 |
22 | #define PCI_DEVICE_ID_INTEL_82965GM_IG 0x2A02 | 22 | #define PCI_DEVICE_ID_INTEL_82965GM_IG 0x2A02 |
23 | #define PCI_DEVICE_ID_INTEL_82965GME_IG 0x2A12 | ||
24 | #define PCI_DEVICE_ID_INTEL_82945GME_IG 0x27AE | ||
25 | #define PCI_DEVICE_ID_INTEL_G33_HB 0x29C0 | ||
26 | #define PCI_DEVICE_ID_INTEL_G33_IG 0x29C2 | ||
27 | #define PCI_DEVICE_ID_INTEL_Q35_HB 0x29B0 | ||
28 | #define PCI_DEVICE_ID_INTEL_Q35_IG 0x29B2 | ||
29 | #define PCI_DEVICE_ID_INTEL_Q33_HB 0x29D0 | ||
30 | #define PCI_DEVICE_ID_INTEL_Q33_IG 0x29D2 | ||
23 | 31 | ||
24 | #define IS_I965 (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82946GZ_HB || \ | 32 | #define IS_I965 (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82946GZ_HB || \ |
25 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965G_1_HB || \ | 33 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965G_1_HB || \ |
@@ -27,6 +35,9 @@ | |||
27 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965G_HB || \ | 35 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965G_HB || \ |
28 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965GM_HB) | 36 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965GM_HB) |
29 | 37 | ||
38 | #define IS_G33 (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_G33_HB || \ | ||
39 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_Q35_HB || \ | ||
40 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_Q33_HB) | ||
30 | 41 | ||
31 | extern int agp_memory_reserved; | 42 | extern int agp_memory_reserved; |
32 | 43 | ||
@@ -53,6 +64,8 @@ extern int agp_memory_reserved; | |||
53 | #define I915_PTEADDR 0x1C | 64 | #define I915_PTEADDR 0x1C |
54 | #define I915_GMCH_GMS_STOLEN_48M (0x6 << 4) | 65 | #define I915_GMCH_GMS_STOLEN_48M (0x6 << 4) |
55 | #define I915_GMCH_GMS_STOLEN_64M (0x7 << 4) | 66 | #define I915_GMCH_GMS_STOLEN_64M (0x7 << 4) |
67 | #define G33_GMCH_GMS_STOLEN_128M (0x8 << 4) | ||
68 | #define G33_GMCH_GMS_STOLEN_256M (0x9 << 4) | ||
56 | 69 | ||
57 | /* Intel 965G registers */ | 70 | /* Intel 965G registers */ |
58 | #define I965_MSAC 0x62 | 71 | #define I965_MSAC 0x62 |
@@ -86,11 +99,18 @@ static struct gatt_mask intel_i810_masks[] = | |||
86 | .type = INTEL_AGP_CACHED_MEMORY} | 99 | .type = INTEL_AGP_CACHED_MEMORY} |
87 | }; | 100 | }; |
88 | 101 | ||
89 | static struct _intel_i810_private { | 102 | static struct _intel_private { |
90 | struct pci_dev *i810_dev; /* device one */ | 103 | struct pci_dev *pcidev; /* device one */ |
91 | volatile u8 __iomem *registers; | 104 | u8 __iomem *registers; |
105 | u32 __iomem *gtt; /* I915G */ | ||
92 | int num_dcache_entries; | 106 | int num_dcache_entries; |
93 | } intel_i810_private; | 107 | /* gtt_entries is the number of gtt entries that are already mapped |
108 | * to stolen memory. Stolen memory is larger than the memory mapped | ||
109 | * through gtt_entries, as it includes some reserved space for the BIOS | ||
110 | * popup and for the GTT. | ||
111 | */ | ||
112 | int gtt_entries; /* i830+ */ | ||
113 | } intel_private; | ||
94 | 114 | ||
95 | static int intel_i810_fetch_size(void) | 115 | static int intel_i810_fetch_size(void) |
96 | { | 116 | { |
@@ -127,32 +147,32 @@ static int intel_i810_configure(void) | |||
127 | 147 | ||
128 | current_size = A_SIZE_FIX(agp_bridge->current_size); | 148 | current_size = A_SIZE_FIX(agp_bridge->current_size); |
129 | 149 | ||
130 | if (!intel_i810_private.registers) { | 150 | if (!intel_private.registers) { |
131 | pci_read_config_dword(intel_i810_private.i810_dev, I810_MMADDR, &temp); | 151 | pci_read_config_dword(intel_private.pcidev, I810_MMADDR, &temp); |
132 | temp &= 0xfff80000; | 152 | temp &= 0xfff80000; |
133 | 153 | ||
134 | intel_i810_private.registers = ioremap(temp, 128 * 4096); | 154 | intel_private.registers = ioremap(temp, 128 * 4096); |
135 | if (!intel_i810_private.registers) { | 155 | if (!intel_private.registers) { |
136 | printk(KERN_ERR PFX "Unable to remap memory.\n"); | 156 | printk(KERN_ERR PFX "Unable to remap memory.\n"); |
137 | return -ENOMEM; | 157 | return -ENOMEM; |
138 | } | 158 | } |
139 | } | 159 | } |
140 | 160 | ||
141 | if ((readl(intel_i810_private.registers+I810_DRAM_CTL) | 161 | if ((readl(intel_private.registers+I810_DRAM_CTL) |
142 | & I810_DRAM_ROW_0) == I810_DRAM_ROW_0_SDRAM) { | 162 | & I810_DRAM_ROW_0) == I810_DRAM_ROW_0_SDRAM) { |
143 | /* This will need to be dynamically assigned */ | 163 | /* This will need to be dynamically assigned */ |
144 | printk(KERN_INFO PFX "detected 4MB dedicated video ram.\n"); | 164 | printk(KERN_INFO PFX "detected 4MB dedicated video ram.\n"); |
145 | intel_i810_private.num_dcache_entries = 1024; | 165 | intel_private.num_dcache_entries = 1024; |
146 | } | 166 | } |
147 | pci_read_config_dword(intel_i810_private.i810_dev, I810_GMADDR, &temp); | 167 | pci_read_config_dword(intel_private.pcidev, I810_GMADDR, &temp); |
148 | agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK); | 168 | agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK); |
149 | writel(agp_bridge->gatt_bus_addr | I810_PGETBL_ENABLED, intel_i810_private.registers+I810_PGETBL_CTL); | 169 | writel(agp_bridge->gatt_bus_addr | I810_PGETBL_ENABLED, intel_private.registers+I810_PGETBL_CTL); |
150 | readl(intel_i810_private.registers+I810_PGETBL_CTL); /* PCI Posting. */ | 170 | readl(intel_private.registers+I810_PGETBL_CTL); /* PCI Posting. */ |
151 | 171 | ||
152 | if (agp_bridge->driver->needs_scratch_page) { | 172 | if (agp_bridge->driver->needs_scratch_page) { |
153 | for (i = 0; i < current_size->num_entries; i++) { | 173 | for (i = 0; i < current_size->num_entries; i++) { |
154 | writel(agp_bridge->scratch_page, intel_i810_private.registers+I810_PTE_BASE+(i*4)); | 174 | writel(agp_bridge->scratch_page, intel_private.registers+I810_PTE_BASE+(i*4)); |
155 | readl(intel_i810_private.registers+I810_PTE_BASE+(i*4)); /* PCI posting. */ | 175 | readl(intel_private.registers+I810_PTE_BASE+(i*4)); /* PCI posting. */ |
156 | } | 176 | } |
157 | } | 177 | } |
158 | global_cache_flush(); | 178 | global_cache_flush(); |
@@ -161,9 +181,9 @@ static int intel_i810_configure(void) | |||
161 | 181 | ||
162 | static void intel_i810_cleanup(void) | 182 | static void intel_i810_cleanup(void) |
163 | { | 183 | { |
164 | writel(0, intel_i810_private.registers+I810_PGETBL_CTL); | 184 | writel(0, intel_private.registers+I810_PGETBL_CTL); |
165 | readl(intel_i810_private.registers); /* PCI Posting. */ | 185 | readl(intel_private.registers); /* PCI Posting. */ |
166 | iounmap(intel_i810_private.registers); | 186 | iounmap(intel_private.registers); |
167 | } | 187 | } |
168 | 188 | ||
169 | static void intel_i810_tlbflush(struct agp_memory *mem) | 189 | static void intel_i810_tlbflush(struct agp_memory *mem) |
@@ -261,9 +281,9 @@ static int intel_i810_insert_entries(struct agp_memory *mem, off_t pg_start, | |||
261 | global_cache_flush(); | 281 | global_cache_flush(); |
262 | for (i = pg_start; i < (pg_start + mem->page_count); i++) { | 282 | for (i = pg_start; i < (pg_start + mem->page_count); i++) { |
263 | writel((i*4096)|I810_PTE_LOCAL|I810_PTE_VALID, | 283 | writel((i*4096)|I810_PTE_LOCAL|I810_PTE_VALID, |
264 | intel_i810_private.registers+I810_PTE_BASE+(i*4)); | 284 | intel_private.registers+I810_PTE_BASE+(i*4)); |
265 | } | 285 | } |
266 | readl(intel_i810_private.registers+I810_PTE_BASE+((i-1)*4)); | 286 | readl(intel_private.registers+I810_PTE_BASE+((i-1)*4)); |
267 | break; | 287 | break; |
268 | case AGP_PHYS_MEMORY: | 288 | case AGP_PHYS_MEMORY: |
269 | case AGP_NORMAL_MEMORY: | 289 | case AGP_NORMAL_MEMORY: |
@@ -273,9 +293,9 @@ static int intel_i810_insert_entries(struct agp_memory *mem, off_t pg_start, | |||
273 | writel(agp_bridge->driver->mask_memory(agp_bridge, | 293 | writel(agp_bridge->driver->mask_memory(agp_bridge, |
274 | mem->memory[i], | 294 | mem->memory[i], |
275 | mask_type), | 295 | mask_type), |
276 | intel_i810_private.registers+I810_PTE_BASE+(j*4)); | 296 | intel_private.registers+I810_PTE_BASE+(j*4)); |
277 | } | 297 | } |
278 | readl(intel_i810_private.registers+I810_PTE_BASE+((j-1)*4)); | 298 | readl(intel_private.registers+I810_PTE_BASE+((j-1)*4)); |
279 | break; | 299 | break; |
280 | default: | 300 | default: |
281 | goto out_err; | 301 | goto out_err; |
@@ -298,9 +318,9 @@ static int intel_i810_remove_entries(struct agp_memory *mem, off_t pg_start, | |||
298 | return 0; | 318 | return 0; |
299 | 319 | ||
300 | for (i = pg_start; i < (mem->page_count + pg_start); i++) { | 320 | for (i = pg_start; i < (mem->page_count + pg_start); i++) { |
301 | writel(agp_bridge->scratch_page, intel_i810_private.registers+I810_PTE_BASE+(i*4)); | 321 | writel(agp_bridge->scratch_page, intel_private.registers+I810_PTE_BASE+(i*4)); |
302 | } | 322 | } |
303 | readl(intel_i810_private.registers+I810_PTE_BASE+((i-1)*4)); | 323 | readl(intel_private.registers+I810_PTE_BASE+((i-1)*4)); |
304 | 324 | ||
305 | agp_bridge->driver->tlb_flush(mem); | 325 | agp_bridge->driver->tlb_flush(mem); |
306 | return 0; | 326 | return 0; |
@@ -354,7 +374,7 @@ static struct agp_memory *intel_i810_alloc_by_type(size_t pg_count, int type) | |||
354 | struct agp_memory *new; | 374 | struct agp_memory *new; |
355 | 375 | ||
356 | if (type == AGP_DCACHE_MEMORY) { | 376 | if (type == AGP_DCACHE_MEMORY) { |
357 | if (pg_count != intel_i810_private.num_dcache_entries) | 377 | if (pg_count != intel_private.num_dcache_entries) |
358 | return NULL; | 378 | return NULL; |
359 | 379 | ||
360 | new = agp_create_memory(1); | 380 | new = agp_create_memory(1); |
@@ -404,18 +424,6 @@ static struct aper_size_info_fixed intel_i830_sizes[] = | |||
404 | {512, 131072, 7}, | 424 | {512, 131072, 7}, |
405 | }; | 425 | }; |
406 | 426 | ||
407 | static struct _intel_i830_private { | ||
408 | struct pci_dev *i830_dev; /* device one */ | ||
409 | volatile u8 __iomem *registers; | ||
410 | volatile u32 __iomem *gtt; /* I915G */ | ||
411 | /* gtt_entries is the number of gtt entries that are already mapped | ||
412 | * to stolen memory. Stolen memory is larger than the memory mapped | ||
413 | * through gtt_entries, as it includes some reserved space for the BIOS | ||
414 | * popup and for the GTT. | ||
415 | */ | ||
416 | int gtt_entries; | ||
417 | } intel_i830_private; | ||
418 | |||
419 | static void intel_i830_init_gtt_entries(void) | 427 | static void intel_i830_init_gtt_entries(void) |
420 | { | 428 | { |
421 | u16 gmch_ctrl; | 429 | u16 gmch_ctrl; |
@@ -429,7 +437,7 @@ static void intel_i830_init_gtt_entries(void) | |||
429 | 437 | ||
430 | if (IS_I965) { | 438 | if (IS_I965) { |
431 | u32 pgetbl_ctl; | 439 | u32 pgetbl_ctl; |
432 | pgetbl_ctl = readl(intel_i830_private.registers+I810_PGETBL_CTL); | 440 | pgetbl_ctl = readl(intel_private.registers+I810_PGETBL_CTL); |
433 | 441 | ||
434 | /* The 965 has a field telling us the size of the GTT, | 442 | /* The 965 has a field telling us the size of the GTT, |
435 | * which may be larger than what is necessary to map the | 443 | * which may be larger than what is necessary to map the |
@@ -451,6 +459,22 @@ static void intel_i830_init_gtt_entries(void) | |||
451 | size = 512; | 459 | size = 512; |
452 | } | 460 | } |
453 | size += 4; /* add in BIOS popup space */ | 461 | size += 4; /* add in BIOS popup space */ |
462 | } else if (IS_G33) { | ||
463 | /* G33's GTT size defined in gmch_ctrl */ | ||
464 | switch (gmch_ctrl & G33_PGETBL_SIZE_MASK) { | ||
465 | case G33_PGETBL_SIZE_1M: | ||
466 | size = 1024; | ||
467 | break; | ||
468 | case G33_PGETBL_SIZE_2M: | ||
469 | size = 2048; | ||
470 | break; | ||
471 | default: | ||
472 | printk(KERN_INFO PFX "Unknown page table size 0x%x, " | ||
473 | "assuming 512KB\n", | ||
474 | (gmch_ctrl & G33_PGETBL_SIZE_MASK)); | ||
475 | size = 512; | ||
476 | } | ||
477 | size += 4; | ||
454 | } else { | 478 | } else { |
455 | /* On previous hardware, the GTT size was just what was | 479 | /* On previous hardware, the GTT size was just what was |
456 | * required to map the aperture. | 480 | * required to map the aperture. |
@@ -471,7 +495,7 @@ static void intel_i830_init_gtt_entries(void) | |||
471 | gtt_entries = MB(8) - KB(size); | 495 | gtt_entries = MB(8) - KB(size); |
472 | break; | 496 | break; |
473 | case I830_GMCH_GMS_LOCAL: | 497 | case I830_GMCH_GMS_LOCAL: |
474 | rdct = readb(intel_i830_private.registers+I830_RDRAM_CHANNEL_TYPE); | 498 | rdct = readb(intel_private.registers+I830_RDRAM_CHANNEL_TYPE); |
475 | gtt_entries = (I830_RDRAM_ND(rdct) + 1) * | 499 | gtt_entries = (I830_RDRAM_ND(rdct) + 1) * |
476 | MB(ddt[I830_RDRAM_DDT(rdct)]); | 500 | MB(ddt[I830_RDRAM_DDT(rdct)]); |
477 | local = 1; | 501 | local = 1; |
@@ -502,7 +526,8 @@ static void intel_i830_init_gtt_entries(void) | |||
502 | if (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915G_HB || | 526 | if (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915G_HB || |
503 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915GM_HB || | 527 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915GM_HB || |
504 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945G_HB || | 528 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945G_HB || |
505 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945GM_HB || IS_I965 ) | 529 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945GM_HB || |
530 | IS_I965 || IS_G33) | ||
506 | gtt_entries = MB(48) - KB(size); | 531 | gtt_entries = MB(48) - KB(size); |
507 | else | 532 | else |
508 | gtt_entries = 0; | 533 | gtt_entries = 0; |
@@ -512,10 +537,24 @@ static void intel_i830_init_gtt_entries(void) | |||
512 | if (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915G_HB || | 537 | if (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915G_HB || |
513 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915GM_HB || | 538 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915GM_HB || |
514 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945G_HB || | 539 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945G_HB || |
515 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945GM_HB || IS_I965) | 540 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945GM_HB || |
541 | IS_I965 || IS_G33) | ||
516 | gtt_entries = MB(64) - KB(size); | 542 | gtt_entries = MB(64) - KB(size); |
517 | else | 543 | else |
518 | gtt_entries = 0; | 544 | gtt_entries = 0; |
545 | break; | ||
546 | case G33_GMCH_GMS_STOLEN_128M: | ||
547 | if (IS_G33) | ||
548 | gtt_entries = MB(128) - KB(size); | ||
549 | else | ||
550 | gtt_entries = 0; | ||
551 | break; | ||
552 | case G33_GMCH_GMS_STOLEN_256M: | ||
553 | if (IS_G33) | ||
554 | gtt_entries = MB(256) - KB(size); | ||
555 | else | ||
556 | gtt_entries = 0; | ||
557 | break; | ||
519 | default: | 558 | default: |
520 | gtt_entries = 0; | 559 | gtt_entries = 0; |
521 | break; | 560 | break; |
@@ -529,7 +568,7 @@ static void intel_i830_init_gtt_entries(void) | |||
529 | "No pre-allocated video memory detected.\n"); | 568 | "No pre-allocated video memory detected.\n"); |
530 | gtt_entries /= KB(4); | 569 | gtt_entries /= KB(4); |
531 | 570 | ||
532 | intel_i830_private.gtt_entries = gtt_entries; | 571 | intel_private.gtt_entries = gtt_entries; |
533 | } | 572 | } |
534 | 573 | ||
535 | /* The intel i830 automatically initializes the agp aperture during POST. | 574 | /* The intel i830 automatically initializes the agp aperture during POST. |
@@ -547,14 +586,14 @@ static int intel_i830_create_gatt_table(struct agp_bridge_data *bridge) | |||
547 | num_entries = size->num_entries; | 586 | num_entries = size->num_entries; |
548 | agp_bridge->gatt_table_real = NULL; | 587 | agp_bridge->gatt_table_real = NULL; |
549 | 588 | ||
550 | pci_read_config_dword(intel_i830_private.i830_dev,I810_MMADDR,&temp); | 589 | pci_read_config_dword(intel_private.pcidev,I810_MMADDR,&temp); |
551 | temp &= 0xfff80000; | 590 | temp &= 0xfff80000; |
552 | 591 | ||
553 | intel_i830_private.registers = ioremap(temp,128 * 4096); | 592 | intel_private.registers = ioremap(temp,128 * 4096); |
554 | if (!intel_i830_private.registers) | 593 | if (!intel_private.registers) |
555 | return -ENOMEM; | 594 | return -ENOMEM; |
556 | 595 | ||
557 | temp = readl(intel_i830_private.registers+I810_PGETBL_CTL) & 0xfffff000; | 596 | temp = readl(intel_private.registers+I810_PGETBL_CTL) & 0xfffff000; |
558 | global_cache_flush(); /* FIXME: ?? */ | 597 | global_cache_flush(); /* FIXME: ?? */ |
559 | 598 | ||
560 | /* we have to call this as early as possible after the MMIO base address is known */ | 599 | /* we have to call this as early as possible after the MMIO base address is known */ |
@@ -614,20 +653,20 @@ static int intel_i830_configure(void) | |||
614 | 653 | ||
615 | current_size = A_SIZE_FIX(agp_bridge->current_size); | 654 | current_size = A_SIZE_FIX(agp_bridge->current_size); |
616 | 655 | ||
617 | pci_read_config_dword(intel_i830_private.i830_dev,I810_GMADDR,&temp); | 656 | pci_read_config_dword(intel_private.pcidev,I810_GMADDR,&temp); |
618 | agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK); | 657 | agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK); |
619 | 658 | ||
620 | pci_read_config_word(agp_bridge->dev,I830_GMCH_CTRL,&gmch_ctrl); | 659 | pci_read_config_word(agp_bridge->dev,I830_GMCH_CTRL,&gmch_ctrl); |
621 | gmch_ctrl |= I830_GMCH_ENABLED; | 660 | gmch_ctrl |= I830_GMCH_ENABLED; |
622 | pci_write_config_word(agp_bridge->dev,I830_GMCH_CTRL,gmch_ctrl); | 661 | pci_write_config_word(agp_bridge->dev,I830_GMCH_CTRL,gmch_ctrl); |
623 | 662 | ||
624 | writel(agp_bridge->gatt_bus_addr|I810_PGETBL_ENABLED, intel_i830_private.registers+I810_PGETBL_CTL); | 663 | writel(agp_bridge->gatt_bus_addr|I810_PGETBL_ENABLED, intel_private.registers+I810_PGETBL_CTL); |
625 | readl(intel_i830_private.registers+I810_PGETBL_CTL); /* PCI Posting. */ | 664 | readl(intel_private.registers+I810_PGETBL_CTL); /* PCI Posting. */ |
626 | 665 | ||
627 | if (agp_bridge->driver->needs_scratch_page) { | 666 | if (agp_bridge->driver->needs_scratch_page) { |
628 | for (i = intel_i830_private.gtt_entries; i < current_size->num_entries; i++) { | 667 | for (i = intel_private.gtt_entries; i < current_size->num_entries; i++) { |
629 | writel(agp_bridge->scratch_page, intel_i830_private.registers+I810_PTE_BASE+(i*4)); | 668 | writel(agp_bridge->scratch_page, intel_private.registers+I810_PTE_BASE+(i*4)); |
630 | readl(intel_i830_private.registers+I810_PTE_BASE+(i*4)); /* PCI Posting. */ | 669 | readl(intel_private.registers+I810_PTE_BASE+(i*4)); /* PCI Posting. */ |
631 | } | 670 | } |
632 | } | 671 | } |
633 | 672 | ||
@@ -637,7 +676,7 @@ static int intel_i830_configure(void) | |||
637 | 676 | ||
638 | static void intel_i830_cleanup(void) | 677 | static void intel_i830_cleanup(void) |
639 | { | 678 | { |
640 | iounmap(intel_i830_private.registers); | 679 | iounmap(intel_private.registers); |
641 | } | 680 | } |
642 | 681 | ||
643 | static int intel_i830_insert_entries(struct agp_memory *mem,off_t pg_start, int type) | 682 | static int intel_i830_insert_entries(struct agp_memory *mem,off_t pg_start, int type) |
@@ -653,9 +692,9 @@ static int intel_i830_insert_entries(struct agp_memory *mem,off_t pg_start, int | |||
653 | temp = agp_bridge->current_size; | 692 | temp = agp_bridge->current_size; |
654 | num_entries = A_SIZE_FIX(temp)->num_entries; | 693 | num_entries = A_SIZE_FIX(temp)->num_entries; |
655 | 694 | ||
656 | if (pg_start < intel_i830_private.gtt_entries) { | 695 | if (pg_start < intel_private.gtt_entries) { |
657 | printk (KERN_DEBUG PFX "pg_start == 0x%.8lx,intel_i830_private.gtt_entries == 0x%.8x\n", | 696 | printk (KERN_DEBUG PFX "pg_start == 0x%.8lx,intel_private.gtt_entries == 0x%.8x\n", |
658 | pg_start,intel_i830_private.gtt_entries); | 697 | pg_start,intel_private.gtt_entries); |
659 | 698 | ||
660 | printk (KERN_INFO PFX "Trying to insert into local/stolen memory\n"); | 699 | printk (KERN_INFO PFX "Trying to insert into local/stolen memory\n"); |
661 | goto out_err; | 700 | goto out_err; |
@@ -683,9 +722,9 @@ static int intel_i830_insert_entries(struct agp_memory *mem,off_t pg_start, int | |||
683 | for (i = 0, j = pg_start; i < mem->page_count; i++, j++) { | 722 | for (i = 0, j = pg_start; i < mem->page_count; i++, j++) { |
684 | writel(agp_bridge->driver->mask_memory(agp_bridge, | 723 | writel(agp_bridge->driver->mask_memory(agp_bridge, |
685 | mem->memory[i], mask_type), | 724 | mem->memory[i], mask_type), |
686 | intel_i830_private.registers+I810_PTE_BASE+(j*4)); | 725 | intel_private.registers+I810_PTE_BASE+(j*4)); |
687 | } | 726 | } |
688 | readl(intel_i830_private.registers+I810_PTE_BASE+((j-1)*4)); | 727 | readl(intel_private.registers+I810_PTE_BASE+((j-1)*4)); |
689 | agp_bridge->driver->tlb_flush(mem); | 728 | agp_bridge->driver->tlb_flush(mem); |
690 | 729 | ||
691 | out: | 730 | out: |
@@ -703,15 +742,15 @@ static int intel_i830_remove_entries(struct agp_memory *mem,off_t pg_start, | |||
703 | if (mem->page_count == 0) | 742 | if (mem->page_count == 0) |
704 | return 0; | 743 | return 0; |
705 | 744 | ||
706 | if (pg_start < intel_i830_private.gtt_entries) { | 745 | if (pg_start < intel_private.gtt_entries) { |
707 | printk (KERN_INFO PFX "Trying to disable local/stolen memory\n"); | 746 | printk (KERN_INFO PFX "Trying to disable local/stolen memory\n"); |
708 | return -EINVAL; | 747 | return -EINVAL; |
709 | } | 748 | } |
710 | 749 | ||
711 | for (i = pg_start; i < (mem->page_count + pg_start); i++) { | 750 | for (i = pg_start; i < (mem->page_count + pg_start); i++) { |
712 | writel(agp_bridge->scratch_page, intel_i830_private.registers+I810_PTE_BASE+(i*4)); | 751 | writel(agp_bridge->scratch_page, intel_private.registers+I810_PTE_BASE+(i*4)); |
713 | } | 752 | } |
714 | readl(intel_i830_private.registers+I810_PTE_BASE+((i-1)*4)); | 753 | readl(intel_private.registers+I810_PTE_BASE+((i-1)*4)); |
715 | 754 | ||
716 | agp_bridge->driver->tlb_flush(mem); | 755 | agp_bridge->driver->tlb_flush(mem); |
717 | return 0; | 756 | return 0; |
@@ -734,7 +773,7 @@ static int intel_i915_configure(void) | |||
734 | 773 | ||
735 | current_size = A_SIZE_FIX(agp_bridge->current_size); | 774 | current_size = A_SIZE_FIX(agp_bridge->current_size); |
736 | 775 | ||
737 | pci_read_config_dword(intel_i830_private.i830_dev, I915_GMADDR, &temp); | 776 | pci_read_config_dword(intel_private.pcidev, I915_GMADDR, &temp); |
738 | 777 | ||
739 | agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK); | 778 | agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK); |
740 | 779 | ||
@@ -742,13 +781,13 @@ static int intel_i915_configure(void) | |||
742 | gmch_ctrl |= I830_GMCH_ENABLED; | 781 | gmch_ctrl |= I830_GMCH_ENABLED; |
743 | pci_write_config_word(agp_bridge->dev,I830_GMCH_CTRL,gmch_ctrl); | 782 | pci_write_config_word(agp_bridge->dev,I830_GMCH_CTRL,gmch_ctrl); |
744 | 783 | ||
745 | writel(agp_bridge->gatt_bus_addr|I810_PGETBL_ENABLED, intel_i830_private.registers+I810_PGETBL_CTL); | 784 | writel(agp_bridge->gatt_bus_addr|I810_PGETBL_ENABLED, intel_private.registers+I810_PGETBL_CTL); |
746 | readl(intel_i830_private.registers+I810_PGETBL_CTL); /* PCI Posting. */ | 785 | readl(intel_private.registers+I810_PGETBL_CTL); /* PCI Posting. */ |
747 | 786 | ||
748 | if (agp_bridge->driver->needs_scratch_page) { | 787 | if (agp_bridge->driver->needs_scratch_page) { |
749 | for (i = intel_i830_private.gtt_entries; i < current_size->num_entries; i++) { | 788 | for (i = intel_private.gtt_entries; i < current_size->num_entries; i++) { |
750 | writel(agp_bridge->scratch_page, intel_i830_private.gtt+i); | 789 | writel(agp_bridge->scratch_page, intel_private.gtt+i); |
751 | readl(intel_i830_private.gtt+i); /* PCI Posting. */ | 790 | readl(intel_private.gtt+i); /* PCI Posting. */ |
752 | } | 791 | } |
753 | } | 792 | } |
754 | 793 | ||
@@ -758,8 +797,8 @@ static int intel_i915_configure(void) | |||
758 | 797 | ||
759 | static void intel_i915_cleanup(void) | 798 | static void intel_i915_cleanup(void) |
760 | { | 799 | { |
761 | iounmap(intel_i830_private.gtt); | 800 | iounmap(intel_private.gtt); |
762 | iounmap(intel_i830_private.registers); | 801 | iounmap(intel_private.registers); |
763 | } | 802 | } |
764 | 803 | ||
765 | static int intel_i915_insert_entries(struct agp_memory *mem,off_t pg_start, | 804 | static int intel_i915_insert_entries(struct agp_memory *mem,off_t pg_start, |
@@ -776,9 +815,9 @@ static int intel_i915_insert_entries(struct agp_memory *mem,off_t pg_start, | |||
776 | temp = agp_bridge->current_size; | 815 | temp = agp_bridge->current_size; |
777 | num_entries = A_SIZE_FIX(temp)->num_entries; | 816 | num_entries = A_SIZE_FIX(temp)->num_entries; |
778 | 817 | ||
779 | if (pg_start < intel_i830_private.gtt_entries) { | 818 | if (pg_start < intel_private.gtt_entries) { |
780 | printk (KERN_DEBUG PFX "pg_start == 0x%.8lx,intel_i830_private.gtt_entries == 0x%.8x\n", | 819 | printk (KERN_DEBUG PFX "pg_start == 0x%.8lx,intel_private.gtt_entries == 0x%.8x\n", |
781 | pg_start,intel_i830_private.gtt_entries); | 820 | pg_start,intel_private.gtt_entries); |
782 | 821 | ||
783 | printk (KERN_INFO PFX "Trying to insert into local/stolen memory\n"); | 822 | printk (KERN_INFO PFX "Trying to insert into local/stolen memory\n"); |
784 | goto out_err; | 823 | goto out_err; |
@@ -805,10 +844,10 @@ static int intel_i915_insert_entries(struct agp_memory *mem,off_t pg_start, | |||
805 | 844 | ||
806 | for (i = 0, j = pg_start; i < mem->page_count; i++, j++) { | 845 | for (i = 0, j = pg_start; i < mem->page_count; i++, j++) { |
807 | writel(agp_bridge->driver->mask_memory(agp_bridge, | 846 | writel(agp_bridge->driver->mask_memory(agp_bridge, |
808 | mem->memory[i], mask_type), intel_i830_private.gtt+j); | 847 | mem->memory[i], mask_type), intel_private.gtt+j); |
809 | } | 848 | } |
810 | 849 | ||
811 | readl(intel_i830_private.gtt+j-1); | 850 | readl(intel_private.gtt+j-1); |
812 | agp_bridge->driver->tlb_flush(mem); | 851 | agp_bridge->driver->tlb_flush(mem); |
813 | 852 | ||
814 | out: | 853 | out: |
@@ -826,15 +865,15 @@ static int intel_i915_remove_entries(struct agp_memory *mem,off_t pg_start, | |||
826 | if (mem->page_count == 0) | 865 | if (mem->page_count == 0) |
827 | return 0; | 866 | return 0; |
828 | 867 | ||
829 | if (pg_start < intel_i830_private.gtt_entries) { | 868 | if (pg_start < intel_private.gtt_entries) { |
830 | printk (KERN_INFO PFX "Trying to disable local/stolen memory\n"); | 869 | printk (KERN_INFO PFX "Trying to disable local/stolen memory\n"); |
831 | return -EINVAL; | 870 | return -EINVAL; |
832 | } | 871 | } |
833 | 872 | ||
834 | for (i = pg_start; i < (mem->page_count + pg_start); i++) { | 873 | for (i = pg_start; i < (mem->page_count + pg_start); i++) { |
835 | writel(agp_bridge->scratch_page, intel_i830_private.gtt+i); | 874 | writel(agp_bridge->scratch_page, intel_private.gtt+i); |
836 | } | 875 | } |
837 | readl(intel_i830_private.gtt+i-1); | 876 | readl(intel_private.gtt+i-1); |
838 | 877 | ||
839 | agp_bridge->driver->tlb_flush(mem); | 878 | agp_bridge->driver->tlb_flush(mem); |
840 | return 0; | 879 | return 0; |
@@ -850,7 +889,7 @@ static int intel_i9xx_fetch_size(void) | |||
850 | int aper_size; /* size in megabytes */ | 889 | int aper_size; /* size in megabytes */ |
851 | int i; | 890 | int i; |
852 | 891 | ||
853 | aper_size = pci_resource_len(intel_i830_private.i830_dev, 2) / MB(1); | 892 | aper_size = pci_resource_len(intel_private.pcidev, 2) / MB(1); |
854 | 893 | ||
855 | for (i = 0; i < num_sizes; i++) { | 894 | for (i = 0; i < num_sizes; i++) { |
856 | if (aper_size == intel_i830_sizes[i].size) { | 895 | if (aper_size == intel_i830_sizes[i].size) { |
@@ -878,20 +917,20 @@ static int intel_i915_create_gatt_table(struct agp_bridge_data *bridge) | |||
878 | num_entries = size->num_entries; | 917 | num_entries = size->num_entries; |
879 | agp_bridge->gatt_table_real = NULL; | 918 | agp_bridge->gatt_table_real = NULL; |
880 | 919 | ||
881 | pci_read_config_dword(intel_i830_private.i830_dev, I915_MMADDR, &temp); | 920 | pci_read_config_dword(intel_private.pcidev, I915_MMADDR, &temp); |
882 | pci_read_config_dword(intel_i830_private.i830_dev, I915_PTEADDR,&temp2); | 921 | pci_read_config_dword(intel_private.pcidev, I915_PTEADDR,&temp2); |
883 | 922 | ||
884 | intel_i830_private.gtt = ioremap(temp2, 256 * 1024); | 923 | intel_private.gtt = ioremap(temp2, 256 * 1024); |
885 | if (!intel_i830_private.gtt) | 924 | if (!intel_private.gtt) |
886 | return -ENOMEM; | 925 | return -ENOMEM; |
887 | 926 | ||
888 | temp &= 0xfff80000; | 927 | temp &= 0xfff80000; |
889 | 928 | ||
890 | intel_i830_private.registers = ioremap(temp,128 * 4096); | 929 | intel_private.registers = ioremap(temp,128 * 4096); |
891 | if (!intel_i830_private.registers) | 930 | if (!intel_private.registers) |
892 | return -ENOMEM; | 931 | return -ENOMEM; |
893 | 932 | ||
894 | temp = readl(intel_i830_private.registers+I810_PGETBL_CTL) & 0xfffff000; | 933 | temp = readl(intel_private.registers+I810_PGETBL_CTL) & 0xfffff000; |
895 | global_cache_flush(); /* FIXME: ? */ | 934 | global_cache_flush(); /* FIXME: ? */ |
896 | 935 | ||
897 | /* we have to call this as early as possible after the MMIO base address is known */ | 936 | /* we have to call this as early as possible after the MMIO base address is known */ |
@@ -938,20 +977,20 @@ static int intel_i965_create_gatt_table(struct agp_bridge_data *bridge) | |||
938 | num_entries = size->num_entries; | 977 | num_entries = size->num_entries; |
939 | agp_bridge->gatt_table_real = NULL; | 978 | agp_bridge->gatt_table_real = NULL; |
940 | 979 | ||
941 | pci_read_config_dword(intel_i830_private.i830_dev, I915_MMADDR, &temp); | 980 | pci_read_config_dword(intel_private.pcidev, I915_MMADDR, &temp); |
942 | 981 | ||
943 | temp &= 0xfff00000; | 982 | temp &= 0xfff00000; |
944 | intel_i830_private.gtt = ioremap((temp + (512 * 1024)) , 512 * 1024); | 983 | intel_private.gtt = ioremap((temp + (512 * 1024)) , 512 * 1024); |
945 | 984 | ||
946 | if (!intel_i830_private.gtt) | 985 | if (!intel_private.gtt) |
947 | return -ENOMEM; | 986 | return -ENOMEM; |
948 | 987 | ||
949 | 988 | ||
950 | intel_i830_private.registers = ioremap(temp,128 * 4096); | 989 | intel_private.registers = ioremap(temp,128 * 4096); |
951 | if (!intel_i830_private.registers) | 990 | if (!intel_private.registers) |
952 | return -ENOMEM; | 991 | return -ENOMEM; |
953 | 992 | ||
954 | temp = readl(intel_i830_private.registers+I810_PGETBL_CTL) & 0xfffff000; | 993 | temp = readl(intel_private.registers+I810_PGETBL_CTL) & 0xfffff000; |
955 | global_cache_flush(); /* FIXME: ? */ | 994 | global_cache_flush(); /* FIXME: ? */ |
956 | 995 | ||
957 | /* we have to call this as early as possible after the MMIO base address is known */ | 996 | /* we have to call this as early as possible after the MMIO base address is known */ |
@@ -1722,41 +1761,126 @@ static const struct agp_bridge_driver intel_7505_driver = { | |||
1722 | .agp_type_to_mask_type = agp_generic_type_to_mask_type, | 1761 | .agp_type_to_mask_type = agp_generic_type_to_mask_type, |
1723 | }; | 1762 | }; |
1724 | 1763 | ||
1725 | static int find_i810(u16 device) | 1764 | static const struct agp_bridge_driver intel_g33_driver = { |
1726 | { | 1765 | .owner = THIS_MODULE, |
1727 | struct pci_dev *i810_dev; | 1766 | .aperture_sizes = intel_i830_sizes, |
1728 | 1767 | .size_type = FIXED_APER_SIZE, | |
1729 | i810_dev = pci_get_device(PCI_VENDOR_ID_INTEL, device, NULL); | 1768 | .num_aperture_sizes = 4, |
1730 | if (!i810_dev) | 1769 | .needs_scratch_page = TRUE, |
1731 | return 0; | 1770 | .configure = intel_i915_configure, |
1732 | intel_i810_private.i810_dev = i810_dev; | 1771 | .fetch_size = intel_i9xx_fetch_size, |
1733 | return 1; | 1772 | .cleanup = intel_i915_cleanup, |
1734 | } | 1773 | .tlb_flush = intel_i810_tlbflush, |
1774 | .mask_memory = intel_i965_mask_memory, | ||
1775 | .masks = intel_i810_masks, | ||
1776 | .agp_enable = intel_i810_agp_enable, | ||
1777 | .cache_flush = global_cache_flush, | ||
1778 | .create_gatt_table = intel_i915_create_gatt_table, | ||
1779 | .free_gatt_table = intel_i830_free_gatt_table, | ||
1780 | .insert_memory = intel_i915_insert_entries, | ||
1781 | .remove_memory = intel_i915_remove_entries, | ||
1782 | .alloc_by_type = intel_i830_alloc_by_type, | ||
1783 | .free_by_type = intel_i810_free_by_type, | ||
1784 | .agp_alloc_page = agp_generic_alloc_page, | ||
1785 | .agp_destroy_page = agp_generic_destroy_page, | ||
1786 | .agp_type_to_mask_type = intel_i830_type_to_mask_type, | ||
1787 | }; | ||
1735 | 1788 | ||
1736 | static int find_i830(u16 device) | 1789 | static int find_gmch(u16 device) |
1737 | { | 1790 | { |
1738 | struct pci_dev *i830_dev; | 1791 | struct pci_dev *gmch_device; |
1739 | 1792 | ||
1740 | i830_dev = pci_get_device(PCI_VENDOR_ID_INTEL, device, NULL); | 1793 | gmch_device = pci_get_device(PCI_VENDOR_ID_INTEL, device, NULL); |
1741 | if (i830_dev && PCI_FUNC(i830_dev->devfn) != 0) { | 1794 | if (gmch_device && PCI_FUNC(gmch_device->devfn) != 0) { |
1742 | i830_dev = pci_get_device(PCI_VENDOR_ID_INTEL, | 1795 | gmch_device = pci_get_device(PCI_VENDOR_ID_INTEL, |
1743 | device, i830_dev); | 1796 | device, gmch_device); |
1744 | } | 1797 | } |
1745 | 1798 | ||
1746 | if (!i830_dev) | 1799 | if (!gmch_device) |
1747 | return 0; | 1800 | return 0; |
1748 | 1801 | ||
1749 | intel_i830_private.i830_dev = i830_dev; | 1802 | intel_private.pcidev = gmch_device; |
1750 | return 1; | 1803 | return 1; |
1751 | } | 1804 | } |
1752 | 1805 | ||
1806 | /* Table to describe Intel GMCH and AGP/PCIE GART drivers. At least one of | ||
1807 | * driver and gmch_driver must be non-null, and find_gmch will determine | ||
1808 | * which one should be used if a gmch_chip_id is present. | ||
1809 | */ | ||
1810 | static const struct intel_driver_description { | ||
1811 | unsigned int chip_id; | ||
1812 | unsigned int gmch_chip_id; | ||
1813 | char *name; | ||
1814 | const struct agp_bridge_driver *driver; | ||
1815 | const struct agp_bridge_driver *gmch_driver; | ||
1816 | } intel_agp_chipsets[] = { | ||
1817 | { PCI_DEVICE_ID_INTEL_82443LX_0, 0, "440LX", &intel_generic_driver, NULL }, | ||
1818 | { PCI_DEVICE_ID_INTEL_82443BX_0, 0, "440BX", &intel_generic_driver, NULL }, | ||
1819 | { PCI_DEVICE_ID_INTEL_82443GX_0, 0, "440GX", &intel_generic_driver, NULL }, | ||
1820 | { PCI_DEVICE_ID_INTEL_82810_MC1, PCI_DEVICE_ID_INTEL_82810_IG1, "i810", | ||
1821 | NULL, &intel_810_driver }, | ||
1822 | { PCI_DEVICE_ID_INTEL_82810_MC3, PCI_DEVICE_ID_INTEL_82810_IG3, "i810", | ||
1823 | NULL, &intel_810_driver }, | ||
1824 | { PCI_DEVICE_ID_INTEL_82810E_MC, PCI_DEVICE_ID_INTEL_82810E_IG, "i810", | ||
1825 | NULL, &intel_810_driver }, | ||
1826 | { PCI_DEVICE_ID_INTEL_82815_MC, PCI_DEVICE_ID_INTEL_82815_CGC, "i815", | ||
1827 | &intel_810_driver, &intel_815_driver }, | ||
1828 | { PCI_DEVICE_ID_INTEL_82820_HB, 0, "i820", &intel_820_driver, NULL }, | ||
1829 | { PCI_DEVICE_ID_INTEL_82820_UP_HB, 0, "i820", &intel_820_driver, NULL }, | ||
1830 | { PCI_DEVICE_ID_INTEL_82830_HB, PCI_DEVICE_ID_INTEL_82830_CGC, "830M", | ||
1831 | &intel_830mp_driver, &intel_830_driver }, | ||
1832 | { PCI_DEVICE_ID_INTEL_82840_HB, 0, "i840", &intel_840_driver, NULL }, | ||
1833 | { PCI_DEVICE_ID_INTEL_82845_HB, 0, "845G", &intel_845_driver, NULL }, | ||
1834 | { PCI_DEVICE_ID_INTEL_82845G_HB, PCI_DEVICE_ID_INTEL_82845G_IG, "830M", | ||
1835 | &intel_845_driver, &intel_830_driver }, | ||
1836 | { PCI_DEVICE_ID_INTEL_82850_HB, 0, "i850", &intel_850_driver, NULL }, | ||
1837 | { PCI_DEVICE_ID_INTEL_82855PM_HB, 0, "855PM", &intel_845_driver, NULL }, | ||
1838 | { PCI_DEVICE_ID_INTEL_82855GM_HB, PCI_DEVICE_ID_INTEL_82855GM_IG, "855GM", | ||
1839 | &intel_845_driver, &intel_830_driver }, | ||
1840 | { PCI_DEVICE_ID_INTEL_82860_HB, 0, "i860", &intel_860_driver, NULL }, | ||
1841 | { PCI_DEVICE_ID_INTEL_82865_HB, PCI_DEVICE_ID_INTEL_82865_IG, "865", | ||
1842 | &intel_845_driver, &intel_830_driver }, | ||
1843 | { PCI_DEVICE_ID_INTEL_82875_HB, 0, "i875", &intel_845_driver, NULL }, | ||
1844 | { PCI_DEVICE_ID_INTEL_82915G_HB, PCI_DEVICE_ID_INTEL_82915G_IG, "915G", | ||
1845 | &intel_845_driver, &intel_915_driver }, | ||
1846 | { PCI_DEVICE_ID_INTEL_82915GM_HB, PCI_DEVICE_ID_INTEL_82915GM_IG, "915GM", | ||
1847 | &intel_845_driver, &intel_915_driver }, | ||
1848 | { PCI_DEVICE_ID_INTEL_82945G_HB, PCI_DEVICE_ID_INTEL_82945G_IG, "945G", | ||
1849 | &intel_845_driver, &intel_915_driver }, | ||
1850 | { PCI_DEVICE_ID_INTEL_82945GM_HB, PCI_DEVICE_ID_INTEL_82945GM_IG, "945GM", | ||
1851 | &intel_845_driver, &intel_915_driver }, | ||
1852 | { PCI_DEVICE_ID_INTEL_82945GM_HB, PCI_DEVICE_ID_INTEL_82945GME_IG, "945GME", | ||
1853 | &intel_845_driver, &intel_915_driver }, | ||
1854 | { PCI_DEVICE_ID_INTEL_82946GZ_HB, PCI_DEVICE_ID_INTEL_82946GZ_IG, "946GZ", | ||
1855 | &intel_845_driver, &intel_i965_driver }, | ||
1856 | { PCI_DEVICE_ID_INTEL_82965G_1_HB, PCI_DEVICE_ID_INTEL_82965G_1_IG, "965G", | ||
1857 | &intel_845_driver, &intel_i965_driver }, | ||
1858 | { PCI_DEVICE_ID_INTEL_82965Q_HB, PCI_DEVICE_ID_INTEL_82965Q_IG, "965Q", | ||
1859 | &intel_845_driver, &intel_i965_driver }, | ||
1860 | { PCI_DEVICE_ID_INTEL_82965G_HB, PCI_DEVICE_ID_INTEL_82965G_IG, "965G", | ||
1861 | &intel_845_driver, &intel_i965_driver }, | ||
1862 | { PCI_DEVICE_ID_INTEL_82965GM_HB, PCI_DEVICE_ID_INTEL_82965GM_IG, "965GM", | ||
1863 | &intel_845_driver, &intel_i965_driver }, | ||
1864 | { PCI_DEVICE_ID_INTEL_82965GM_HB, PCI_DEVICE_ID_INTEL_82965GME_IG, "965GME/GLE", | ||
1865 | &intel_845_driver, &intel_i965_driver }, | ||
1866 | { PCI_DEVICE_ID_INTEL_7505_0, 0, "E7505", &intel_7505_driver, NULL }, | ||
1867 | { PCI_DEVICE_ID_INTEL_7205_0, 0, "E7205", &intel_7505_driver, NULL }, | ||
1868 | { PCI_DEVICE_ID_INTEL_G33_HB, PCI_DEVICE_ID_INTEL_G33_IG, "G33", | ||
1869 | &intel_845_driver, &intel_g33_driver }, | ||
1870 | { PCI_DEVICE_ID_INTEL_Q35_HB, PCI_DEVICE_ID_INTEL_Q35_IG, "Q35", | ||
1871 | &intel_845_driver, &intel_g33_driver }, | ||
1872 | { PCI_DEVICE_ID_INTEL_Q33_HB, PCI_DEVICE_ID_INTEL_Q33_IG, "Q33", | ||
1873 | &intel_845_driver, &intel_g33_driver }, | ||
1874 | { 0, 0, NULL, NULL, NULL } | ||
1875 | }; | ||
1876 | |||
1753 | static int __devinit agp_intel_probe(struct pci_dev *pdev, | 1877 | static int __devinit agp_intel_probe(struct pci_dev *pdev, |
1754 | const struct pci_device_id *ent) | 1878 | const struct pci_device_id *ent) |
1755 | { | 1879 | { |
1756 | struct agp_bridge_data *bridge; | 1880 | struct agp_bridge_data *bridge; |
1757 | char *name = "(unknown)"; | ||
1758 | u8 cap_ptr = 0; | 1881 | u8 cap_ptr = 0; |
1759 | struct resource *r; | 1882 | struct resource *r; |
1883 | int i; | ||
1760 | 1884 | ||
1761 | cap_ptr = pci_find_capability(pdev, PCI_CAP_ID_AGP); | 1885 | cap_ptr = pci_find_capability(pdev, PCI_CAP_ID_AGP); |
1762 | 1886 | ||
@@ -1764,195 +1888,42 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev, | |||
1764 | if (!bridge) | 1888 | if (!bridge) |
1765 | return -ENOMEM; | 1889 | return -ENOMEM; |
1766 | 1890 | ||
1767 | switch (pdev->device) { | 1891 | for (i = 0; intel_agp_chipsets[i].name != NULL; i++) { |
1768 | case PCI_DEVICE_ID_INTEL_82443LX_0: | 1892 | /* In case that multiple models of gfx chip may |
1769 | bridge->driver = &intel_generic_driver; | 1893 | stand on same host bridge type, this can be |
1770 | name = "440LX"; | 1894 | sure we detect the right IGD. */ |
1771 | break; | 1895 | if ((pdev->device == intel_agp_chipsets[i].chip_id) && |
1772 | case PCI_DEVICE_ID_INTEL_82443BX_0: | 1896 | ((intel_agp_chipsets[i].gmch_chip_id == 0) || |
1773 | bridge->driver = &intel_generic_driver; | 1897 | find_gmch(intel_agp_chipsets[i].gmch_chip_id))) |
1774 | name = "440BX"; | 1898 | break; |
1775 | break; | 1899 | } |
1776 | case PCI_DEVICE_ID_INTEL_82443GX_0: | 1900 | |
1777 | bridge->driver = &intel_generic_driver; | 1901 | if (intel_agp_chipsets[i].name == NULL) { |
1778 | name = "440GX"; | ||
1779 | break; | ||
1780 | case PCI_DEVICE_ID_INTEL_82810_MC1: | ||
1781 | name = "i810"; | ||
1782 | if (!find_i810(PCI_DEVICE_ID_INTEL_82810_IG1)) | ||
1783 | goto fail; | ||
1784 | bridge->driver = &intel_810_driver; | ||
1785 | break; | ||
1786 | case PCI_DEVICE_ID_INTEL_82810_MC3: | ||
1787 | name = "i810 DC100"; | ||
1788 | if (!find_i810(PCI_DEVICE_ID_INTEL_82810_IG3)) | ||
1789 | goto fail; | ||
1790 | bridge->driver = &intel_810_driver; | ||
1791 | break; | ||
1792 | case PCI_DEVICE_ID_INTEL_82810E_MC: | ||
1793 | name = "i810 E"; | ||
1794 | if (!find_i810(PCI_DEVICE_ID_INTEL_82810E_IG)) | ||
1795 | goto fail; | ||
1796 | bridge->driver = &intel_810_driver; | ||
1797 | break; | ||
1798 | case PCI_DEVICE_ID_INTEL_82815_MC: | ||
1799 | /* | ||
1800 | * The i815 can operate either as an i810 style | ||
1801 | * integrated device, or as an AGP4X motherboard. | ||
1802 | */ | ||
1803 | if (find_i810(PCI_DEVICE_ID_INTEL_82815_CGC)) | ||
1804 | bridge->driver = &intel_810_driver; | ||
1805 | else | ||
1806 | bridge->driver = &intel_815_driver; | ||
1807 | name = "i815"; | ||
1808 | break; | ||
1809 | case PCI_DEVICE_ID_INTEL_82820_HB: | ||
1810 | case PCI_DEVICE_ID_INTEL_82820_UP_HB: | ||
1811 | bridge->driver = &intel_820_driver; | ||
1812 | name = "i820"; | ||
1813 | break; | ||
1814 | case PCI_DEVICE_ID_INTEL_82830_HB: | ||
1815 | if (find_i830(PCI_DEVICE_ID_INTEL_82830_CGC)) | ||
1816 | bridge->driver = &intel_830_driver; | ||
1817 | else | ||
1818 | bridge->driver = &intel_830mp_driver; | ||
1819 | name = "830M"; | ||
1820 | break; | ||
1821 | case PCI_DEVICE_ID_INTEL_82840_HB: | ||
1822 | bridge->driver = &intel_840_driver; | ||
1823 | name = "i840"; | ||
1824 | break; | ||
1825 | case PCI_DEVICE_ID_INTEL_82845_HB: | ||
1826 | bridge->driver = &intel_845_driver; | ||
1827 | name = "i845"; | ||
1828 | break; | ||
1829 | case PCI_DEVICE_ID_INTEL_82845G_HB: | ||
1830 | if (find_i830(PCI_DEVICE_ID_INTEL_82845G_IG)) | ||
1831 | bridge->driver = &intel_830_driver; | ||
1832 | else | ||
1833 | bridge->driver = &intel_845_driver; | ||
1834 | name = "845G"; | ||
1835 | break; | ||
1836 | case PCI_DEVICE_ID_INTEL_82850_HB: | ||
1837 | bridge->driver = &intel_850_driver; | ||
1838 | name = "i850"; | ||
1839 | break; | ||
1840 | case PCI_DEVICE_ID_INTEL_82855PM_HB: | ||
1841 | bridge->driver = &intel_845_driver; | ||
1842 | name = "855PM"; | ||
1843 | break; | ||
1844 | case PCI_DEVICE_ID_INTEL_82855GM_HB: | ||
1845 | if (find_i830(PCI_DEVICE_ID_INTEL_82855GM_IG)) { | ||
1846 | bridge->driver = &intel_830_driver; | ||
1847 | name = "855"; | ||
1848 | } else { | ||
1849 | bridge->driver = &intel_845_driver; | ||
1850 | name = "855GM"; | ||
1851 | } | ||
1852 | break; | ||
1853 | case PCI_DEVICE_ID_INTEL_82860_HB: | ||
1854 | bridge->driver = &intel_860_driver; | ||
1855 | name = "i860"; | ||
1856 | break; | ||
1857 | case PCI_DEVICE_ID_INTEL_82865_HB: | ||
1858 | if (find_i830(PCI_DEVICE_ID_INTEL_82865_IG)) | ||
1859 | bridge->driver = &intel_830_driver; | ||
1860 | else | ||
1861 | bridge->driver = &intel_845_driver; | ||
1862 | name = "865"; | ||
1863 | break; | ||
1864 | case PCI_DEVICE_ID_INTEL_82875_HB: | ||
1865 | bridge->driver = &intel_845_driver; | ||
1866 | name = "i875"; | ||
1867 | break; | ||
1868 | case PCI_DEVICE_ID_INTEL_82915G_HB: | ||
1869 | if (find_i830(PCI_DEVICE_ID_INTEL_82915G_IG)) | ||
1870 | bridge->driver = &intel_915_driver; | ||
1871 | else | ||
1872 | bridge->driver = &intel_845_driver; | ||
1873 | name = "915G"; | ||
1874 | break; | ||
1875 | case PCI_DEVICE_ID_INTEL_82915GM_HB: | ||
1876 | if (find_i830(PCI_DEVICE_ID_INTEL_82915GM_IG)) | ||
1877 | bridge->driver = &intel_915_driver; | ||
1878 | else | ||
1879 | bridge->driver = &intel_845_driver; | ||
1880 | name = "915GM"; | ||
1881 | break; | ||
1882 | case PCI_DEVICE_ID_INTEL_82945G_HB: | ||
1883 | if (find_i830(PCI_DEVICE_ID_INTEL_82945G_IG)) | ||
1884 | bridge->driver = &intel_915_driver; | ||
1885 | else | ||
1886 | bridge->driver = &intel_845_driver; | ||
1887 | name = "945G"; | ||
1888 | break; | ||
1889 | case PCI_DEVICE_ID_INTEL_82945GM_HB: | ||
1890 | if (find_i830(PCI_DEVICE_ID_INTEL_82945GM_IG)) | ||
1891 | bridge->driver = &intel_915_driver; | ||
1892 | else | ||
1893 | bridge->driver = &intel_845_driver; | ||
1894 | name = "945GM"; | ||
1895 | break; | ||
1896 | case PCI_DEVICE_ID_INTEL_82946GZ_HB: | ||
1897 | if (find_i830(PCI_DEVICE_ID_INTEL_82946GZ_IG)) | ||
1898 | bridge->driver = &intel_i965_driver; | ||
1899 | else | ||
1900 | bridge->driver = &intel_845_driver; | ||
1901 | name = "946GZ"; | ||
1902 | break; | ||
1903 | case PCI_DEVICE_ID_INTEL_82965G_1_HB: | ||
1904 | if (find_i830(PCI_DEVICE_ID_INTEL_82965G_1_IG)) | ||
1905 | bridge->driver = &intel_i965_driver; | ||
1906 | else | ||
1907 | bridge->driver = &intel_845_driver; | ||
1908 | name = "965G"; | ||
1909 | break; | ||
1910 | case PCI_DEVICE_ID_INTEL_82965Q_HB: | ||
1911 | if (find_i830(PCI_DEVICE_ID_INTEL_82965Q_IG)) | ||
1912 | bridge->driver = &intel_i965_driver; | ||
1913 | else | ||
1914 | bridge->driver = &intel_845_driver; | ||
1915 | name = "965Q"; | ||
1916 | break; | ||
1917 | case PCI_DEVICE_ID_INTEL_82965G_HB: | ||
1918 | if (find_i830(PCI_DEVICE_ID_INTEL_82965G_IG)) | ||
1919 | bridge->driver = &intel_i965_driver; | ||
1920 | else | ||
1921 | bridge->driver = &intel_845_driver; | ||
1922 | name = "965G"; | ||
1923 | break; | ||
1924 | case PCI_DEVICE_ID_INTEL_82965GM_HB: | ||
1925 | if (find_i830(PCI_DEVICE_ID_INTEL_82965GM_IG)) | ||
1926 | bridge->driver = &intel_i965_driver; | ||
1927 | else | ||
1928 | bridge->driver = &intel_845_driver; | ||
1929 | name = "965GM"; | ||
1930 | break; | ||
1931 | case PCI_DEVICE_ID_INTEL_7505_0: | ||
1932 | bridge->driver = &intel_7505_driver; | ||
1933 | name = "E7505"; | ||
1934 | break; | ||
1935 | case PCI_DEVICE_ID_INTEL_7205_0: | ||
1936 | bridge->driver = &intel_7505_driver; | ||
1937 | name = "E7205"; | ||
1938 | break; | ||
1939 | default: | ||
1940 | if (cap_ptr) | 1902 | if (cap_ptr) |
1941 | printk(KERN_WARNING PFX "Unsupported Intel chipset (device id: %04x)\n", | 1903 | printk(KERN_WARNING PFX "Unsupported Intel chipset" |
1942 | pdev->device); | 1904 | "(device id: %04x)\n", pdev->device); |
1943 | agp_put_bridge(bridge); | 1905 | agp_put_bridge(bridge); |
1944 | return -ENODEV; | 1906 | return -ENODEV; |
1945 | }; | 1907 | } |
1908 | |||
1909 | if (intel_agp_chipsets[i].gmch_chip_id != 0) | ||
1910 | bridge->driver = intel_agp_chipsets[i].gmch_driver; | ||
1911 | else | ||
1912 | bridge->driver = intel_agp_chipsets[i].driver; | ||
1913 | |||
1914 | if (bridge->driver == NULL) { | ||
1915 | printk(KERN_WARNING PFX "Failed to find bridge device " | ||
1916 | "(chip_id: %04x)\n", intel_agp_chipsets[i].gmch_chip_id); | ||
1917 | agp_put_bridge(bridge); | ||
1918 | return -ENODEV; | ||
1919 | } | ||
1946 | 1920 | ||
1947 | bridge->dev = pdev; | 1921 | bridge->dev = pdev; |
1948 | bridge->capndx = cap_ptr; | 1922 | bridge->capndx = cap_ptr; |
1923 | bridge->dev_private_data = &intel_private; | ||
1949 | 1924 | ||
1950 | if (bridge->driver == &intel_810_driver) | 1925 | printk(KERN_INFO PFX "Detected an Intel %s Chipset.\n", |
1951 | bridge->dev_private_data = &intel_i810_private; | 1926 | intel_agp_chipsets[i].name); |
1952 | else if (bridge->driver == &intel_830_driver) | ||
1953 | bridge->dev_private_data = &intel_i830_private; | ||
1954 | |||
1955 | printk(KERN_INFO PFX "Detected an Intel %s Chipset.\n", name); | ||
1956 | 1927 | ||
1957 | /* | 1928 | /* |
1958 | * The following fixes the case where the BIOS has "forgotten" to | 1929 | * The following fixes the case where the BIOS has "forgotten" to |
@@ -1988,12 +1959,6 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev, | |||
1988 | 1959 | ||
1989 | pci_set_drvdata(pdev, bridge); | 1960 | pci_set_drvdata(pdev, bridge); |
1990 | return agp_add_bridge(bridge); | 1961 | return agp_add_bridge(bridge); |
1991 | |||
1992 | fail: | ||
1993 | printk(KERN_ERR PFX "Detected an Intel %s chipset, " | ||
1994 | "but could not find the secondary device.\n", name); | ||
1995 | agp_put_bridge(bridge); | ||
1996 | return -ENODEV; | ||
1997 | } | 1962 | } |
1998 | 1963 | ||
1999 | static void __devexit agp_intel_remove(struct pci_dev *pdev) | 1964 | static void __devexit agp_intel_remove(struct pci_dev *pdev) |
@@ -2002,10 +1967,8 @@ static void __devexit agp_intel_remove(struct pci_dev *pdev) | |||
2002 | 1967 | ||
2003 | agp_remove_bridge(bridge); | 1968 | agp_remove_bridge(bridge); |
2004 | 1969 | ||
2005 | if (intel_i810_private.i810_dev) | 1970 | if (intel_private.pcidev) |
2006 | pci_dev_put(intel_i810_private.i810_dev); | 1971 | pci_dev_put(intel_private.pcidev); |
2007 | if (intel_i830_private.i830_dev) | ||
2008 | pci_dev_put(intel_i830_private.i830_dev); | ||
2009 | 1972 | ||
2010 | agp_put_bridge(bridge); | 1973 | agp_put_bridge(bridge); |
2011 | } | 1974 | } |
@@ -2021,10 +1984,8 @@ static int agp_intel_resume(struct pci_dev *pdev) | |||
2021 | * as host bridge (00:00) resumes before graphics device (02:00), | 1984 | * as host bridge (00:00) resumes before graphics device (02:00), |
2022 | * then our access to its pci space can work right. | 1985 | * then our access to its pci space can work right. |
2023 | */ | 1986 | */ |
2024 | if (intel_i810_private.i810_dev) | 1987 | if (intel_private.pcidev) |
2025 | pci_restore_state(intel_i810_private.i810_dev); | 1988 | pci_restore_state(intel_private.pcidev); |
2026 | if (intel_i830_private.i830_dev) | ||
2027 | pci_restore_state(intel_i830_private.i830_dev); | ||
2028 | 1989 | ||
2029 | if (bridge->driver == &intel_generic_driver) | 1990 | if (bridge->driver == &intel_generic_driver) |
2030 | intel_configure(); | 1991 | intel_configure(); |
@@ -2087,6 +2048,9 @@ static struct pci_device_id agp_intel_pci_table[] = { | |||
2087 | ID(PCI_DEVICE_ID_INTEL_82965Q_HB), | 2048 | ID(PCI_DEVICE_ID_INTEL_82965Q_HB), |
2088 | ID(PCI_DEVICE_ID_INTEL_82965G_HB), | 2049 | ID(PCI_DEVICE_ID_INTEL_82965G_HB), |
2089 | ID(PCI_DEVICE_ID_INTEL_82965GM_HB), | 2050 | ID(PCI_DEVICE_ID_INTEL_82965GM_HB), |
2051 | ID(PCI_DEVICE_ID_INTEL_G33_HB), | ||
2052 | ID(PCI_DEVICE_ID_INTEL_Q35_HB), | ||
2053 | ID(PCI_DEVICE_ID_INTEL_Q33_HB), | ||
2090 | { } | 2054 | { } |
2091 | }; | 2055 | }; |
2092 | 2056 | ||
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index 7fff773f2df7..dc2175c81f5e 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c | |||
@@ -1037,6 +1037,17 @@ static void ide_disk_release(struct kref *kref) | |||
1037 | 1037 | ||
1038 | static int ide_disk_probe(ide_drive_t *drive); | 1038 | static int ide_disk_probe(ide_drive_t *drive); |
1039 | 1039 | ||
1040 | /* | ||
1041 | * On HPA drives the capacity needs to be | ||
1042 | * reinitilized on resume otherwise the disk | ||
1043 | * can not be used and a hard reset is required | ||
1044 | */ | ||
1045 | static void ide_disk_resume(ide_drive_t *drive) | ||
1046 | { | ||
1047 | if (idedisk_supports_hpa(drive->id)) | ||
1048 | init_idedisk_capacity(drive); | ||
1049 | } | ||
1050 | |||
1040 | static void ide_device_shutdown(ide_drive_t *drive) | 1051 | static void ide_device_shutdown(ide_drive_t *drive) |
1041 | { | 1052 | { |
1042 | #ifdef CONFIG_ALPHA | 1053 | #ifdef CONFIG_ALPHA |
@@ -1071,6 +1082,7 @@ static ide_driver_t idedisk_driver = { | |||
1071 | }, | 1082 | }, |
1072 | .probe = ide_disk_probe, | 1083 | .probe = ide_disk_probe, |
1073 | .remove = ide_disk_remove, | 1084 | .remove = ide_disk_remove, |
1085 | .resume = ide_disk_resume, | ||
1074 | .shutdown = ide_device_shutdown, | 1086 | .shutdown = ide_device_shutdown, |
1075 | .version = IDEDISK_VERSION, | 1087 | .version = IDEDISK_VERSION, |
1076 | .media = ide_disk, | 1088 | .media = ide_disk, |
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index 3cebed77f55d..41bfa4d21ab6 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c | |||
@@ -717,7 +717,7 @@ EXPORT_SYMBOL_GPL(ide_undecoded_slave); | |||
717 | * This routine only knows how to look for drive units 0 and 1 | 717 | * This routine only knows how to look for drive units 0 and 1 |
718 | * on an interface, so any setting of MAX_DRIVES > 2 won't work here. | 718 | * on an interface, so any setting of MAX_DRIVES > 2 won't work here. |
719 | */ | 719 | */ |
720 | static void probe_hwif(ide_hwif_t *hwif) | 720 | static void probe_hwif(ide_hwif_t *hwif, void (*fixup)(ide_hwif_t *hwif)) |
721 | { | 721 | { |
722 | unsigned int unit; | 722 | unsigned int unit; |
723 | unsigned long flags; | 723 | unsigned long flags; |
@@ -820,6 +820,9 @@ static void probe_hwif(ide_hwif_t *hwif) | |||
820 | return; | 820 | return; |
821 | } | 821 | } |
822 | 822 | ||
823 | if (fixup) | ||
824 | fixup(hwif); | ||
825 | |||
823 | for (unit = 0; unit < MAX_DRIVES; ++unit) { | 826 | for (unit = 0; unit < MAX_DRIVES; ++unit) { |
824 | ide_drive_t *drive = &hwif->drives[unit]; | 827 | ide_drive_t *drive = &hwif->drives[unit]; |
825 | 828 | ||
@@ -874,10 +877,7 @@ static int hwif_init(ide_hwif_t *hwif); | |||
874 | 877 | ||
875 | int probe_hwif_init_with_fixup(ide_hwif_t *hwif, void (*fixup)(ide_hwif_t *hwif)) | 878 | int probe_hwif_init_with_fixup(ide_hwif_t *hwif, void (*fixup)(ide_hwif_t *hwif)) |
876 | { | 879 | { |
877 | probe_hwif(hwif); | 880 | probe_hwif(hwif, fixup); |
878 | |||
879 | if (fixup) | ||
880 | fixup(hwif); | ||
881 | 881 | ||
882 | if (!hwif_init(hwif)) { | 882 | if (!hwif_init(hwif)) { |
883 | printk(KERN_INFO "%s: failed to initialize IDE interface\n", | 883 | printk(KERN_INFO "%s: failed to initialize IDE interface\n", |
@@ -1404,7 +1404,7 @@ int ideprobe_init (void) | |||
1404 | 1404 | ||
1405 | for (index = 0; index < MAX_HWIFS; ++index) | 1405 | for (index = 0; index < MAX_HWIFS; ++index) |
1406 | if (probe[index]) | 1406 | if (probe[index]) |
1407 | probe_hwif(&ide_hwifs[index]); | 1407 | probe_hwif(&ide_hwifs[index], NULL); |
1408 | for (index = 0; index < MAX_HWIFS; ++index) | 1408 | for (index = 0; index < MAX_HWIFS; ++index) |
1409 | if (probe[index]) | 1409 | if (probe[index]) |
1410 | hwif_init(&ide_hwifs[index]); | 1410 | hwif_init(&ide_hwifs[index]); |
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index 6002713a20a1..0af0d1614f75 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c | |||
@@ -1010,9 +1010,11 @@ static int generic_ide_resume(struct device *dev) | |||
1010 | { | 1010 | { |
1011 | ide_drive_t *drive = dev->driver_data; | 1011 | ide_drive_t *drive = dev->driver_data; |
1012 | ide_hwif_t *hwif = HWIF(drive); | 1012 | ide_hwif_t *hwif = HWIF(drive); |
1013 | ide_driver_t *drv = to_ide_driver(dev->driver); | ||
1013 | struct request rq; | 1014 | struct request rq; |
1014 | struct request_pm_state rqpm; | 1015 | struct request_pm_state rqpm; |
1015 | ide_task_t args; | 1016 | ide_task_t args; |
1017 | int err; | ||
1016 | 1018 | ||
1017 | /* Call ACPI _STM only once */ | 1019 | /* Call ACPI _STM only once */ |
1018 | if (!(drive->dn % 2)) | 1020 | if (!(drive->dn % 2)) |
@@ -1029,7 +1031,12 @@ static int generic_ide_resume(struct device *dev) | |||
1029 | rqpm.pm_step = ide_pm_state_start_resume; | 1031 | rqpm.pm_step = ide_pm_state_start_resume; |
1030 | rqpm.pm_state = PM_EVENT_ON; | 1032 | rqpm.pm_state = PM_EVENT_ON; |
1031 | 1033 | ||
1032 | return ide_do_drive_cmd(drive, &rq, ide_head_wait); | 1034 | err = ide_do_drive_cmd(drive, &rq, ide_head_wait); |
1035 | |||
1036 | if (err == 0 && drv && drv->resume) | ||
1037 | drv->resume(drive); | ||
1038 | |||
1039 | return err; | ||
1033 | } | 1040 | } |
1034 | 1041 | ||
1035 | int generic_ide_ioctl(ide_drive_t *drive, struct file *file, struct block_device *bdev, | 1042 | int generic_ide_ioctl(ide_drive_t *drive, struct file *file, struct block_device *bdev, |
diff --git a/drivers/ide/pci/amd74xx.c b/drivers/ide/pci/amd74xx.c index becb1a5648b0..9db1be826e80 100644 --- a/drivers/ide/pci/amd74xx.c +++ b/drivers/ide/pci/amd74xx.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Version 2.13 | 2 | * Version 2.15 |
3 | * | 3 | * |
4 | * AMD 755/756/766/8111 and nVidia nForce/2/2s/3/3s/CK804/MCP04 | 4 | * AMD 755/756/766/8111 and nVidia nForce/2/2s/3/3s/CK804/MCP04 |
5 | * IDE driver for Linux. | 5 | * IDE driver for Linux. |
@@ -76,6 +76,8 @@ static struct amd_ide_chip { | |||
76 | { PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_IDE, 0x50, AMD_UDMA_133 }, | 76 | { PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_IDE, 0x50, AMD_UDMA_133 }, |
77 | { PCI_DEVICE_ID_NVIDIA_NFORCE_MCP65_IDE, 0x50, AMD_UDMA_133 }, | 77 | { PCI_DEVICE_ID_NVIDIA_NFORCE_MCP65_IDE, 0x50, AMD_UDMA_133 }, |
78 | { PCI_DEVICE_ID_NVIDIA_NFORCE_MCP67_IDE, 0x50, AMD_UDMA_133 }, | 78 | { PCI_DEVICE_ID_NVIDIA_NFORCE_MCP67_IDE, 0x50, AMD_UDMA_133 }, |
79 | { PCI_DEVICE_ID_NVIDIA_NFORCE_MCP73_IDE, 0x50, AMD_UDMA_133 }, | ||
80 | { PCI_DEVICE_ID_NVIDIA_NFORCE_MCP77_IDE, 0x50, AMD_UDMA_133 }, | ||
79 | { PCI_DEVICE_ID_AMD_CS5536_IDE, 0x40, AMD_UDMA_100 }, | 81 | { PCI_DEVICE_ID_AMD_CS5536_IDE, 0x40, AMD_UDMA_100 }, |
80 | { 0 } | 82 | { 0 } |
81 | }; | 83 | }; |
@@ -494,7 +496,9 @@ static ide_pci_device_t amd74xx_chipsets[] __devinitdata = { | |||
494 | /* 17 */ DECLARE_NV_DEV("NFORCE-MCP61"), | 496 | /* 17 */ DECLARE_NV_DEV("NFORCE-MCP61"), |
495 | /* 18 */ DECLARE_NV_DEV("NFORCE-MCP65"), | 497 | /* 18 */ DECLARE_NV_DEV("NFORCE-MCP65"), |
496 | /* 19 */ DECLARE_NV_DEV("NFORCE-MCP67"), | 498 | /* 19 */ DECLARE_NV_DEV("NFORCE-MCP67"), |
497 | /* 20 */ DECLARE_AMD_DEV("AMD5536"), | 499 | /* 20 */ DECLARE_NV_DEV("NFORCE-MCP73"), |
500 | /* 21 */ DECLARE_NV_DEV("NFORCE-MCP77"), | ||
501 | /* 22 */ DECLARE_AMD_DEV("AMD5536"), | ||
498 | }; | 502 | }; |
499 | 503 | ||
500 | static int __devinit amd74xx_probe(struct pci_dev *dev, const struct pci_device_id *id) | 504 | static int __devinit amd74xx_probe(struct pci_dev *dev, const struct pci_device_id *id) |
@@ -534,7 +538,9 @@ static struct pci_device_id amd74xx_pci_tbl[] = { | |||
534 | { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 17 }, | 538 | { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 17 }, |
535 | { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP65_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 18 }, | 539 | { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP65_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 18 }, |
536 | { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP67_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 19 }, | 540 | { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP67_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 19 }, |
537 | { PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CS5536_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 20 }, | 541 | { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP73_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 20 }, |
542 | { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP77_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 21 }, | ||
543 | { PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CS5536_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 22 }, | ||
538 | { 0, }, | 544 | { 0, }, |
539 | }; | 545 | }; |
540 | MODULE_DEVICE_TABLE(pci, amd74xx_pci_tbl); | 546 | MODULE_DEVICE_TABLE(pci, amd74xx_pci_tbl); |
diff --git a/drivers/ide/pci/generic.c b/drivers/ide/pci/generic.c index f2c5a141ca10..0d51a11e81da 100644 --- a/drivers/ide/pci/generic.c +++ b/drivers/ide/pci/generic.c | |||
@@ -198,32 +198,41 @@ static ide_pci_device_t generic_chipsets[] __devinitdata = { | |||
198 | static int __devinit generic_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 198 | static int __devinit generic_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
199 | { | 199 | { |
200 | ide_pci_device_t *d = &generic_chipsets[id->driver_data]; | 200 | ide_pci_device_t *d = &generic_chipsets[id->driver_data]; |
201 | u16 command; | ||
202 | int ret = -ENODEV; | 201 | int ret = -ENODEV; |
203 | 202 | ||
204 | /* Don't use the generic entry unless instructed to do so */ | 203 | /* Don't use the generic entry unless instructed to do so */ |
205 | if (id->driver_data == 0 && ide_generic_all == 0) | 204 | if (id->driver_data == 0 && ide_generic_all == 0) |
206 | goto out; | 205 | goto out; |
207 | 206 | ||
208 | if (dev->vendor == PCI_VENDOR_ID_UMC && | 207 | switch (dev->vendor) { |
209 | dev->device == PCI_DEVICE_ID_UMC_UM8886A && | 208 | case PCI_VENDOR_ID_UMC: |
210 | (!(PCI_FUNC(dev->devfn) & 1))) | 209 | if (dev->device == PCI_DEVICE_ID_UMC_UM8886A && |
211 | goto out; /* UM8886A/BF pair */ | 210 | !(PCI_FUNC(dev->devfn) & 1)) |
212 | 211 | goto out; /* UM8886A/BF pair */ | |
213 | if (dev->vendor == PCI_VENDOR_ID_OPTI && | 212 | break; |
214 | dev->device == PCI_DEVICE_ID_OPTI_82C558 && | 213 | case PCI_VENDOR_ID_OPTI: |
215 | (!(PCI_FUNC(dev->devfn) & 1))) | 214 | if (dev->device == PCI_DEVICE_ID_OPTI_82C558 && |
216 | goto out; | 215 | !(PCI_FUNC(dev->devfn) & 1)) |
217 | 216 | goto out; | |
218 | if (dev->vendor == PCI_VENDOR_ID_JMICRON) { | 217 | break; |
219 | if (dev->device != PCI_DEVICE_ID_JMICRON_JMB368 && PCI_FUNC(dev->devfn) != 1) | 218 | case PCI_VENDOR_ID_JMICRON: |
219 | if (dev->device != PCI_DEVICE_ID_JMICRON_JMB368 && | ||
220 | PCI_FUNC(dev->devfn) != 1) | ||
221 | goto out; | ||
222 | break; | ||
223 | case PCI_VENDOR_ID_NS: | ||
224 | if (dev->device == PCI_DEVICE_ID_NS_87410 && | ||
225 | (dev->class >> 8) != PCI_CLASS_STORAGE_IDE) | ||
220 | goto out; | 226 | goto out; |
227 | break; | ||
221 | } | 228 | } |
222 | 229 | ||
223 | if (dev->vendor != PCI_VENDOR_ID_JMICRON) { | 230 | if (dev->vendor != PCI_VENDOR_ID_JMICRON) { |
231 | u16 command; | ||
224 | pci_read_config_word(dev, PCI_COMMAND, &command); | 232 | pci_read_config_word(dev, PCI_COMMAND, &command); |
225 | if (!(command & PCI_COMMAND_IO)) { | 233 | if (!(command & PCI_COMMAND_IO)) { |
226 | printk(KERN_INFO "Skipping disabled %s IDE controller.\n", d->name); | 234 | printk(KERN_INFO "Skipping disabled %s IDE " |
235 | "controller.\n", d->name); | ||
227 | goto out; | 236 | goto out; |
228 | } | 237 | } |
229 | } | 238 | } |
diff --git a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c index fcbc5605b38e..ce8a5449a574 100644 --- a/drivers/ide/pci/hpt366.c +++ b/drivers/ide/pci/hpt366.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * linux/drivers/ide/pci/hpt366.c Version 1.03 May 4, 2007 | 2 | * linux/drivers/ide/pci/hpt366.c Version 1.04 Jun 4, 2007 |
3 | * | 3 | * |
4 | * Copyright (C) 1999-2003 Andre Hedrick <andre@linux-ide.org> | 4 | * Copyright (C) 1999-2003 Andre Hedrick <andre@linux-ide.org> |
5 | * Portions Copyright (C) 2001 Sun Microsystems, Inc. | 5 | * Portions Copyright (C) 2001 Sun Microsystems, Inc. |
@@ -106,7 +106,8 @@ | |||
106 | * switch to calculating PCI clock frequency based on the chip's base DPLL | 106 | * switch to calculating PCI clock frequency based on the chip's base DPLL |
107 | * frequency | 107 | * frequency |
108 | * - switch to using the DPLL clock and enable UltraATA/133 mode by default on | 108 | * - switch to using the DPLL clock and enable UltraATA/133 mode by default on |
109 | * anything newer than HPT370/A | 109 | * anything newer than HPT370/A (except HPT374 that is not capable of this |
110 | * mode according to the manual) | ||
110 | * - fold PCI clock detection and DPLL setup code into init_chipset_hpt366(), | 111 | * - fold PCI clock detection and DPLL setup code into init_chipset_hpt366(), |
111 | * also fixing the interchanged 25/40 MHz PCI clock cases for HPT36x chips; | 112 | * also fixing the interchanged 25/40 MHz PCI clock cases for HPT36x chips; |
112 | * unify HPT36x/37x timing setup code and the speedproc handlers by joining | 113 | * unify HPT36x/37x timing setup code and the speedproc handlers by joining |
@@ -365,7 +366,6 @@ static u32 sixty_six_base_hpt37x[] = { | |||
365 | }; | 366 | }; |
366 | 367 | ||
367 | #define HPT366_DEBUG_DRIVE_INFO 0 | 368 | #define HPT366_DEBUG_DRIVE_INFO 0 |
368 | #define HPT374_ALLOW_ATA133_6 1 | ||
369 | #define HPT371_ALLOW_ATA133_6 1 | 369 | #define HPT371_ALLOW_ATA133_6 1 |
370 | #define HPT302_ALLOW_ATA133_6 1 | 370 | #define HPT302_ALLOW_ATA133_6 1 |
371 | #define HPT372_ALLOW_ATA133_6 1 | 371 | #define HPT372_ALLOW_ATA133_6 1 |
@@ -450,7 +450,7 @@ static struct hpt_info hpt370a __devinitdata = { | |||
450 | 450 | ||
451 | static struct hpt_info hpt374 __devinitdata = { | 451 | static struct hpt_info hpt374 __devinitdata = { |
452 | .chip_type = HPT374, | 452 | .chip_type = HPT374, |
453 | .max_mode = HPT374_ALLOW_ATA133_6 ? 4 : 3, | 453 | .max_mode = 3, |
454 | .dpll_clk = 48, | 454 | .dpll_clk = 48, |
455 | .settings = hpt37x_settings | 455 | .settings = hpt37x_settings |
456 | }; | 456 | }; |
diff --git a/drivers/ide/pci/it821x.c b/drivers/ide/pci/it821x.c index 5faaff87d580..4bd4bf02e917 100644 --- a/drivers/ide/pci/it821x.c +++ b/drivers/ide/pci/it821x.c | |||
@@ -1,6 +1,6 @@ | |||
1 | 1 | ||
2 | /* | 2 | /* |
3 | * linux/drivers/ide/pci/it821x.c Version 0.10 Mar 10 2007 | 3 | * linux/drivers/ide/pci/it821x.c Version 0.15 Jun 2 2007 |
4 | * | 4 | * |
5 | * Copyright (C) 2004 Red Hat <alan@redhat.com> | 5 | * Copyright (C) 2004 Red Hat <alan@redhat.com> |
6 | * Copyright (C) 2007 Bartlomiej Zolnierkiewicz | 6 | * Copyright (C) 2007 Bartlomiej Zolnierkiewicz |
@@ -262,7 +262,7 @@ static int it821x_tunepio(ide_drive_t *drive, u8 set_pio) | |||
262 | } | 262 | } |
263 | 263 | ||
264 | if (itdev->smart) | 264 | if (itdev->smart) |
265 | goto set_drive_speed; | 265 | return 0; |
266 | 266 | ||
267 | /* We prefer 66Mhz clock for PIO 0-3, don't care for PIO4 */ | 267 | /* We prefer 66Mhz clock for PIO 0-3, don't care for PIO4 */ |
268 | itdev->want[unit][1] = pio_want[set_pio]; | 268 | itdev->want[unit][1] = pio_want[set_pio]; |
@@ -271,7 +271,6 @@ static int it821x_tunepio(ide_drive_t *drive, u8 set_pio) | |||
271 | it821x_clock_strategy(drive); | 271 | it821x_clock_strategy(drive); |
272 | it821x_program(drive, itdev->pio[unit]); | 272 | it821x_program(drive, itdev->pio[unit]); |
273 | 273 | ||
274 | set_drive_speed: | ||
275 | return ide_config_drive_speed(drive, XFER_PIO_0 + set_pio); | 274 | return ide_config_drive_speed(drive, XFER_PIO_0 + set_pio); |
276 | } | 275 | } |
277 | 276 | ||
@@ -455,12 +454,12 @@ static int it821x_tune_chipset (ide_drive_t *drive, byte xferspeed) | |||
455 | default: | 454 | default: |
456 | return 1; | 455 | return 1; |
457 | } | 456 | } |
457 | |||
458 | return ide_config_drive_speed(drive, speed); | ||
458 | } | 459 | } |
459 | /* | 460 | |
460 | * In smart mode the clocking is done by the host controller | 461 | /* don't touch anything in the smart mode */ |
461 | * snooping the mode we picked. The rest of it is not our problem | 462 | return 0; |
462 | */ | ||
463 | return ide_config_drive_speed(drive, speed); | ||
464 | } | 463 | } |
465 | 464 | ||
466 | /** | 465 | /** |
@@ -559,17 +558,10 @@ static void __devinit it821x_fixups(ide_hwif_t *hwif) | |||
559 | if(idbits[129] != 1) | 558 | if(idbits[129] != 1) |
560 | printk("(%dK stripe)", idbits[146]); | 559 | printk("(%dK stripe)", idbits[146]); |
561 | printk(".\n"); | 560 | printk(".\n"); |
562 | /* Now the core code will have wrongly decided no DMA | ||
563 | so we need to fix this */ | ||
564 | hwif->dma_off_quietly(drive); | ||
565 | #ifdef CONFIG_IDEDMA_ONLYDISK | ||
566 | if (drive->media == ide_disk) | ||
567 | #endif | ||
568 | ide_set_dma(drive); | ||
569 | } else { | 561 | } else { |
570 | /* Non RAID volume. Fixups to stop the core code | 562 | /* Non RAID volume. Fixups to stop the core code |
571 | doing unsupported things */ | 563 | doing unsupported things */ |
572 | id->field_valid &= 1; | 564 | id->field_valid &= 3; |
573 | id->queue_depth = 0; | 565 | id->queue_depth = 0; |
574 | id->command_set_1 = 0; | 566 | id->command_set_1 = 0; |
575 | id->command_set_2 &= 0xC400; | 567 | id->command_set_2 &= 0xC400; |
@@ -584,6 +576,16 @@ static void __devinit it821x_fixups(ide_hwif_t *hwif) | |||
584 | printk(KERN_INFO "%s: Performing identify fixups.\n", | 576 | printk(KERN_INFO "%s: Performing identify fixups.\n", |
585 | drive->name); | 577 | drive->name); |
586 | } | 578 | } |
579 | |||
580 | /* | ||
581 | * Set MWDMA0 mode as enabled/support - just to tell | ||
582 | * IDE core that DMA is supported (it821x hardware | ||
583 | * takes care of DMA mode programming). | ||
584 | */ | ||
585 | if (id->capability & 1) { | ||
586 | id->dma_mword |= 0x0101; | ||
587 | drive->current_speed = XFER_MW_DMA_0; | ||
588 | } | ||
587 | } | 589 | } |
588 | 590 | ||
589 | } | 591 | } |
diff --git a/drivers/ide/pci/serverworks.c b/drivers/ide/pci/serverworks.c index 47bcd91c9b5f..d9c4fd1ae996 100644 --- a/drivers/ide/pci/serverworks.c +++ b/drivers/ide/pci/serverworks.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * linux/drivers/ide/pci/serverworks.c Version 0.9 Mar 4 2007 | 2 | * linux/drivers/ide/pci/serverworks.c Version 0.11 Jun 2 2007 |
3 | * | 3 | * |
4 | * Copyright (C) 1998-2000 Michel Aubry | 4 | * Copyright (C) 1998-2000 Michel Aubry |
5 | * Copyright (C) 1998-2000 Andrzej Krzysztofowicz | 5 | * Copyright (C) 1998-2000 Andrzej Krzysztofowicz |
@@ -170,42 +170,55 @@ static int svwks_tune_chipset (ide_drive_t *drive, u8 xferspeed) | |||
170 | if (!drive->init_speed) { | 170 | if (!drive->init_speed) { |
171 | u8 dma_stat = inb(hwif->dma_status); | 171 | u8 dma_stat = inb(hwif->dma_status); |
172 | 172 | ||
173 | dma_pio: | ||
174 | if (((ultra_enable << (7-drive->dn) & 0x80) == 0x80) && | 173 | if (((ultra_enable << (7-drive->dn) & 0x80) == 0x80) && |
175 | ((dma_stat & (1<<(5+unit))) == (1<<(5+unit)))) { | 174 | ((dma_stat & (1<<(5+unit))) == (1<<(5+unit)))) { |
176 | drive->current_speed = drive->init_speed = XFER_UDMA_0 + udma_modes[(ultra_timing >> (4*unit)) & ~(0xF0)]; | 175 | drive->current_speed = drive->init_speed = XFER_UDMA_0 + udma_modes[(ultra_timing >> (4*unit)) & ~(0xF0)]; |
177 | return 0; | 176 | return 0; |
178 | } else if ((dma_timing) && | 177 | } else if ((dma_timing) && |
179 | ((dma_stat&(1<<(5+unit)))==(1<<(5+unit)))) { | 178 | ((dma_stat&(1<<(5+unit)))==(1<<(5+unit)))) { |
180 | u8 dmaspeed = dma_timing; | 179 | u8 dmaspeed; |
181 | 180 | ||
182 | dma_timing &= ~0xFFU; | 181 | switch (dma_timing & 0x77) { |
183 | if ((dmaspeed & 0x20) == 0x20) | 182 | case 0x20: |
184 | dmaspeed = XFER_MW_DMA_2; | 183 | dmaspeed = XFER_MW_DMA_2; |
185 | else if ((dmaspeed & 0x21) == 0x21) | 184 | break; |
185 | case 0x21: | ||
186 | dmaspeed = XFER_MW_DMA_1; | 186 | dmaspeed = XFER_MW_DMA_1; |
187 | else if ((dmaspeed & 0x77) == 0x77) | 187 | break; |
188 | case 0x77: | ||
188 | dmaspeed = XFER_MW_DMA_0; | 189 | dmaspeed = XFER_MW_DMA_0; |
189 | else | 190 | break; |
191 | default: | ||
190 | goto dma_pio; | 192 | goto dma_pio; |
193 | } | ||
194 | |||
191 | drive->current_speed = drive->init_speed = dmaspeed; | 195 | drive->current_speed = drive->init_speed = dmaspeed; |
192 | return 0; | 196 | return 0; |
193 | } else if (pio_timing) { | 197 | } |
194 | u8 piospeed = pio_timing; | 198 | dma_pio: |
199 | if (pio_timing) { | ||
200 | u8 piospeed; | ||
195 | 201 | ||
196 | pio_timing &= ~0xFFU; | 202 | switch (pio_timing & 0x7f) { |
197 | if ((piospeed & 0x20) == 0x20) | 203 | case 0x20: |
198 | piospeed = XFER_PIO_4; | 204 | piospeed = XFER_PIO_4; |
199 | else if ((piospeed & 0x22) == 0x22) | 205 | break; |
206 | case 0x22: | ||
200 | piospeed = XFER_PIO_3; | 207 | piospeed = XFER_PIO_3; |
201 | else if ((piospeed & 0x34) == 0x34) | 208 | break; |
209 | case 0x34: | ||
202 | piospeed = XFER_PIO_2; | 210 | piospeed = XFER_PIO_2; |
203 | else if ((piospeed & 0x47) == 0x47) | 211 | break; |
212 | case 0x47: | ||
204 | piospeed = XFER_PIO_1; | 213 | piospeed = XFER_PIO_1; |
205 | else if ((piospeed & 0x5d) == 0x5d) | 214 | break; |
215 | case 0x5d: | ||
206 | piospeed = XFER_PIO_0; | 216 | piospeed = XFER_PIO_0; |
207 | else | 217 | break; |
218 | default: | ||
208 | goto oem_setup_failed; | 219 | goto oem_setup_failed; |
220 | } | ||
221 | |||
209 | drive->current_speed = drive->init_speed = piospeed; | 222 | drive->current_speed = drive->init_speed = piospeed; |
210 | return 0; | 223 | return 0; |
211 | } | 224 | } |
@@ -214,8 +227,8 @@ dma_pio: | |||
214 | 227 | ||
215 | oem_setup_failed: | 228 | oem_setup_failed: |
216 | 229 | ||
217 | pio_timing &= ~0xFFU; | 230 | pio_timing = 0; |
218 | dma_timing &= ~0xFFU; | 231 | dma_timing = 0; |
219 | ultra_timing &= ~(0x0F << (4*unit)); | 232 | ultra_timing &= ~(0x0F << (4*unit)); |
220 | ultra_enable &= ~(0x01 << drive->dn); | 233 | ultra_enable &= ~(0x01 << drive->dn); |
221 | csb5_pio &= ~(0x0F << (4*drive->dn)); | 234 | csb5_pio &= ~(0x0F << (4*drive->dn)); |
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index 2eb52b7a71da..32a0e66d2a23 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c | |||
@@ -2773,8 +2773,8 @@ static int cma_init(void) | |||
2773 | int ret; | 2773 | int ret; |
2774 | 2774 | ||
2775 | get_random_bytes(&next_port, sizeof next_port); | 2775 | get_random_bytes(&next_port, sizeof next_port); |
2776 | next_port = (next_port % (sysctl_local_port_range[1] - | 2776 | next_port = ((unsigned int) next_port % |
2777 | sysctl_local_port_range[0])) + | 2777 | (sysctl_local_port_range[1] - sysctl_local_port_range[0])) + |
2778 | sysctl_local_port_range[0]; | 2778 | sysctl_local_port_range[0]; |
2779 | cma_wq = create_singlethread_workqueue("rdma_cm"); | 2779 | cma_wq = create_singlethread_workqueue("rdma_cm"); |
2780 | if (!cma_wq) | 2780 | if (!cma_wq) |
diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c index dc137dec2308..5c6d05427a0f 100644 --- a/drivers/infiniband/hw/mlx4/qp.c +++ b/drivers/infiniband/hw/mlx4/qp.c | |||
@@ -189,18 +189,28 @@ static int send_wqe_overhead(enum ib_qp_type type) | |||
189 | } | 189 | } |
190 | 190 | ||
191 | static int set_rq_size(struct mlx4_ib_dev *dev, struct ib_qp_cap *cap, | 191 | static int set_rq_size(struct mlx4_ib_dev *dev, struct ib_qp_cap *cap, |
192 | struct mlx4_ib_qp *qp) | 192 | int is_user, int has_srq, struct mlx4_ib_qp *qp) |
193 | { | 193 | { |
194 | /* Sanity check RQ size before proceeding */ | 194 | /* Sanity check RQ size before proceeding */ |
195 | if (cap->max_recv_wr > dev->dev->caps.max_wqes || | 195 | if (cap->max_recv_wr > dev->dev->caps.max_wqes || |
196 | cap->max_recv_sge > dev->dev->caps.max_rq_sg) | 196 | cap->max_recv_sge > dev->dev->caps.max_rq_sg) |
197 | return -EINVAL; | 197 | return -EINVAL; |
198 | 198 | ||
199 | qp->rq.max = cap->max_recv_wr ? roundup_pow_of_two(cap->max_recv_wr) : 0; | 199 | if (has_srq) { |
200 | /* QPs attached to an SRQ should have no RQ */ | ||
201 | if (cap->max_recv_wr) | ||
202 | return -EINVAL; | ||
203 | |||
204 | qp->rq.max = qp->rq.max_gs = 0; | ||
205 | } else { | ||
206 | /* HW requires >= 1 RQ entry with >= 1 gather entry */ | ||
207 | if (is_user && (!cap->max_recv_wr || !cap->max_recv_sge)) | ||
208 | return -EINVAL; | ||
200 | 209 | ||
201 | qp->rq.wqe_shift = ilog2(roundup_pow_of_two(cap->max_recv_sge * | 210 | qp->rq.max = roundup_pow_of_two(max(1, cap->max_recv_wr)); |
202 | sizeof (struct mlx4_wqe_data_seg))); | 211 | qp->rq.max_gs = roundup_pow_of_two(max(1, cap->max_recv_sge)); |
203 | qp->rq.max_gs = (1 << qp->rq.wqe_shift) / sizeof (struct mlx4_wqe_data_seg); | 212 | qp->rq.wqe_shift = ilog2(qp->rq.max_gs * sizeof (struct mlx4_wqe_data_seg)); |
213 | } | ||
204 | 214 | ||
205 | cap->max_recv_wr = qp->rq.max; | 215 | cap->max_recv_wr = qp->rq.max; |
206 | cap->max_recv_sge = qp->rq.max_gs; | 216 | cap->max_recv_sge = qp->rq.max_gs; |
@@ -285,7 +295,7 @@ static int create_qp_common(struct mlx4_ib_dev *dev, struct ib_pd *pd, | |||
285 | qp->sq.head = 0; | 295 | qp->sq.head = 0; |
286 | qp->sq.tail = 0; | 296 | qp->sq.tail = 0; |
287 | 297 | ||
288 | err = set_rq_size(dev, &init_attr->cap, qp); | 298 | err = set_rq_size(dev, &init_attr->cap, !!pd->uobject, !!init_attr->srq, qp); |
289 | if (err) | 299 | if (err) |
290 | goto err; | 300 | goto err; |
291 | 301 | ||
@@ -762,11 +772,6 @@ static int __mlx4_ib_modify_qp(struct ib_qp *ibqp, | |||
762 | optpar |= MLX4_QP_OPTPAR_PKEY_INDEX; | 772 | optpar |= MLX4_QP_OPTPAR_PKEY_INDEX; |
763 | } | 773 | } |
764 | 774 | ||
765 | if (attr_mask & IB_QP_RNR_RETRY) { | ||
766 | context->params1 |= cpu_to_be32(attr->rnr_retry << 13); | ||
767 | optpar |= MLX4_QP_OPTPAR_RNR_RETRY; | ||
768 | } | ||
769 | |||
770 | if (attr_mask & IB_QP_AV) { | 775 | if (attr_mask & IB_QP_AV) { |
771 | if (mlx4_set_path(dev, &attr->ah_attr, &context->pri_path, | 776 | if (mlx4_set_path(dev, &attr->ah_attr, &context->pri_path, |
772 | attr_mask & IB_QP_PORT ? attr->port_num : qp->port)) { | 777 | attr_mask & IB_QP_PORT ? attr->port_num : qp->port)) { |
@@ -802,6 +807,12 @@ static int __mlx4_ib_modify_qp(struct ib_qp *ibqp, | |||
802 | 807 | ||
803 | context->pd = cpu_to_be32(to_mpd(ibqp->pd)->pdn); | 808 | context->pd = cpu_to_be32(to_mpd(ibqp->pd)->pdn); |
804 | context->params1 = cpu_to_be32(MLX4_IB_ACK_REQ_FREQ << 28); | 809 | context->params1 = cpu_to_be32(MLX4_IB_ACK_REQ_FREQ << 28); |
810 | |||
811 | if (attr_mask & IB_QP_RNR_RETRY) { | ||
812 | context->params1 |= cpu_to_be32(attr->rnr_retry << 13); | ||
813 | optpar |= MLX4_QP_OPTPAR_RNR_RETRY; | ||
814 | } | ||
815 | |||
805 | if (attr_mask & IB_QP_RETRY_CNT) { | 816 | if (attr_mask & IB_QP_RETRY_CNT) { |
806 | context->params1 |= cpu_to_be32(attr->retry_cnt << 16); | 817 | context->params1 |= cpu_to_be32(attr->retry_cnt << 16); |
807 | optpar |= MLX4_QP_OPTPAR_RETRY_COUNT; | 818 | optpar |= MLX4_QP_OPTPAR_RETRY_COUNT; |
diff --git a/drivers/infiniband/hw/mthca/mthca_cmd.c b/drivers/infiniband/hw/mthca/mthca_cmd.c index 38102520ffb3..f40558d76475 100644 --- a/drivers/infiniband/hw/mthca/mthca_cmd.c +++ b/drivers/infiniband/hw/mthca/mthca_cmd.c | |||
@@ -772,7 +772,7 @@ int mthca_QUERY_FW(struct mthca_dev *dev, u8 *status) | |||
772 | 772 | ||
773 | MTHCA_GET(dev->fw_ver, outbox, QUERY_FW_VER_OFFSET); | 773 | MTHCA_GET(dev->fw_ver, outbox, QUERY_FW_VER_OFFSET); |
774 | /* | 774 | /* |
775 | * FW subminor version is at more signifant bits than minor | 775 | * FW subminor version is at more significant bits than minor |
776 | * version, so swap here. | 776 | * version, so swap here. |
777 | */ | 777 | */ |
778 | dev->fw_ver = (dev->fw_ver & 0xffff00000000ull) | | 778 | dev->fw_ver = (dev->fw_ver & 0xffff00000000ull) | |
diff --git a/drivers/media/common/Kconfig b/drivers/media/common/Kconfig index c120114c241b..5c63c8e24ee7 100644 --- a/drivers/media/common/Kconfig +++ b/drivers/media/common/Kconfig | |||
@@ -4,5 +4,6 @@ config VIDEO_SAA7146 | |||
4 | 4 | ||
5 | config VIDEO_SAA7146_VV | 5 | config VIDEO_SAA7146_VV |
6 | tristate | 6 | tristate |
7 | depends on VIDEO_DEV | ||
7 | select VIDEO_BUF | 8 | select VIDEO_BUF |
8 | select VIDEO_SAA7146 | 9 | select VIDEO_SAA7146 |
diff --git a/drivers/media/dvb/b2c2/Makefile b/drivers/media/dvb/b2c2/Makefile index 1a1c3bca55fa..bff00b58bf65 100644 --- a/drivers/media/dvb/b2c2/Makefile +++ b/drivers/media/dvb/b2c2/Makefile | |||
@@ -1,8 +1,11 @@ | |||
1 | b2c2-flexcop-objs = flexcop.o flexcop-fe-tuner.o flexcop-i2c.o \ | 1 | b2c2-flexcop-objs = flexcop.o flexcop-fe-tuner.o flexcop-i2c.o \ |
2 | flexcop-sram.o flexcop-eeprom.o flexcop-misc.o flexcop-hw-filter.o \ | 2 | flexcop-sram.o flexcop-eeprom.o flexcop-misc.o flexcop-hw-filter.o |
3 | flexcop-dma.o | ||
4 | obj-$(CONFIG_DVB_B2C2_FLEXCOP) += b2c2-flexcop.o | 3 | obj-$(CONFIG_DVB_B2C2_FLEXCOP) += b2c2-flexcop.o |
5 | 4 | ||
5 | ifneq ($(CONFIG_DVB_B2C2_FLEXCOP_PCI),) | ||
6 | b2c2-flexcop-objs += flexcop-dma.o | ||
7 | endif | ||
8 | |||
6 | b2c2-flexcop-pci-objs = flexcop-pci.o | 9 | b2c2-flexcop-pci-objs = flexcop-pci.o |
7 | obj-$(CONFIG_DVB_B2C2_FLEXCOP_PCI) += b2c2-flexcop-pci.o | 10 | obj-$(CONFIG_DVB_B2C2_FLEXCOP_PCI) += b2c2-flexcop-pci.o |
8 | 11 | ||
diff --git a/drivers/media/dvb/cinergyT2/cinergyT2.c b/drivers/media/dvb/cinergyT2/cinergyT2.c index 34d7abc900d7..6aba5b39ed14 100644 --- a/drivers/media/dvb/cinergyT2/cinergyT2.c +++ b/drivers/media/dvb/cinergyT2/cinergyT2.c | |||
@@ -519,8 +519,7 @@ static int cinergyt2_release (struct inode *inode, struct file *file) | |||
519 | struct dvb_device *dvbdev = file->private_data; | 519 | struct dvb_device *dvbdev = file->private_data; |
520 | struct cinergyt2 *cinergyt2 = dvbdev->priv; | 520 | struct cinergyt2 *cinergyt2 = dvbdev->priv; |
521 | 521 | ||
522 | if (mutex_lock_interruptible(&cinergyt2->sem)) | 522 | mutex_lock(&cinergyt2->sem); |
523 | return -ERESTARTSYS; | ||
524 | 523 | ||
525 | if (!cinergyt2->disconnect_pending && (file->f_flags & O_ACCMODE) != O_RDONLY) { | 524 | if (!cinergyt2->disconnect_pending && (file->f_flags & O_ACCMODE) != O_RDONLY) { |
526 | cancel_delayed_work(&cinergyt2->query_work); | 525 | cancel_delayed_work(&cinergyt2->query_work); |
diff --git a/drivers/media/dvb/frontends/tda10086.c b/drivers/media/dvb/frontends/tda10086.c index ccc429cbbad0..0f2d4b415560 100644 --- a/drivers/media/dvb/frontends/tda10086.c +++ b/drivers/media/dvb/frontends/tda10086.c | |||
@@ -41,6 +41,7 @@ struct tda10086_state { | |||
41 | /* private demod data */ | 41 | /* private demod data */ |
42 | u32 frequency; | 42 | u32 frequency; |
43 | u32 symbol_rate; | 43 | u32 symbol_rate; |
44 | bool has_lock; | ||
44 | }; | 45 | }; |
45 | 46 | ||
46 | static int debug = 0; | 47 | static int debug = 0; |
@@ -116,7 +117,7 @@ static int tda10086_init(struct dvb_frontend* fe) | |||
116 | // misc setup | 117 | // misc setup |
117 | tda10086_write_byte(state, 0x01, 0x94); | 118 | tda10086_write_byte(state, 0x01, 0x94); |
118 | tda10086_write_byte(state, 0x02, 0x35); // NOTE: TT drivers appear to disable CSWP | 119 | tda10086_write_byte(state, 0x02, 0x35); // NOTE: TT drivers appear to disable CSWP |
119 | tda10086_write_byte(state, 0x03, 0x64); | 120 | tda10086_write_byte(state, 0x03, 0xe4); |
120 | tda10086_write_byte(state, 0x04, 0x43); | 121 | tda10086_write_byte(state, 0x04, 0x43); |
121 | tda10086_write_byte(state, 0x0c, 0x0c); | 122 | tda10086_write_byte(state, 0x0c, 0x0c); |
122 | tda10086_write_byte(state, 0x1b, 0xb0); // noise threshold | 123 | tda10086_write_byte(state, 0x1b, 0xb0); // noise threshold |
@@ -146,7 +147,7 @@ static int tda10086_init(struct dvb_frontend* fe) | |||
146 | // setup AGC | 147 | // setup AGC |
147 | tda10086_write_byte(state, 0x05, 0x0B); | 148 | tda10086_write_byte(state, 0x05, 0x0B); |
148 | tda10086_write_byte(state, 0x37, 0x63); | 149 | tda10086_write_byte(state, 0x37, 0x63); |
149 | tda10086_write_byte(state, 0x3f, 0x03); // NOTE: flydvb uses 0x0a and varies it | 150 | tda10086_write_byte(state, 0x3f, 0x0a); // NOTE: flydvb varies it |
150 | tda10086_write_byte(state, 0x40, 0x64); | 151 | tda10086_write_byte(state, 0x40, 0x64); |
151 | tda10086_write_byte(state, 0x41, 0x4f); | 152 | tda10086_write_byte(state, 0x41, 0x4f); |
152 | tda10086_write_byte(state, 0x42, 0x43); | 153 | tda10086_write_byte(state, 0x42, 0x43); |
@@ -398,6 +399,10 @@ static int tda10086_set_frontend(struct dvb_frontend* fe, | |||
398 | 399 | ||
399 | dprintk ("%s\n", __FUNCTION__); | 400 | dprintk ("%s\n", __FUNCTION__); |
400 | 401 | ||
402 | // modify parameters for tuning | ||
403 | tda10086_write_byte(state, 0x02, 0x35); | ||
404 | state->has_lock = false; | ||
405 | |||
401 | // set params | 406 | // set params |
402 | if (fe->ops.tuner_ops.set_params) { | 407 | if (fe->ops.tuner_ops.set_params) { |
403 | fe->ops.tuner_ops.set_params(fe, fe_params); | 408 | fe->ops.tuner_ops.set_params(fe, fe_params); |
@@ -542,8 +547,14 @@ static int tda10086_read_status(struct dvb_frontend* fe, fe_status_t *fe_status) | |||
542 | *fe_status |= FE_HAS_VITERBI; | 547 | *fe_status |= FE_HAS_VITERBI; |
543 | if (val & 0x08) | 548 | if (val & 0x08) |
544 | *fe_status |= FE_HAS_SYNC; | 549 | *fe_status |= FE_HAS_SYNC; |
545 | if (val & 0x10) | 550 | if (val & 0x10) { |
546 | *fe_status |= FE_HAS_LOCK; | 551 | *fe_status |= FE_HAS_LOCK; |
552 | if (!state->has_lock) { | ||
553 | state->has_lock = true; | ||
554 | // modify parameters for stable reception | ||
555 | tda10086_write_byte(state, 0x02, 0x00); | ||
556 | } | ||
557 | } | ||
547 | 558 | ||
548 | return 0; | 559 | return 0; |
549 | } | 560 | } |
@@ -555,7 +566,7 @@ static int tda10086_read_signal_strength(struct dvb_frontend* fe, u16 * signal) | |||
555 | 566 | ||
556 | dprintk ("%s\n", __FUNCTION__); | 567 | dprintk ("%s\n", __FUNCTION__); |
557 | 568 | ||
558 | _str = tda10086_read_byte(state, 0x43); | 569 | _str = 0xff - tda10086_read_byte(state, 0x43); |
559 | *signal = (_str << 8) | _str; | 570 | *signal = (_str << 8) | _str; |
560 | 571 | ||
561 | return 0; | 572 | return 0; |
@@ -568,7 +579,7 @@ static int tda10086_read_snr(struct dvb_frontend* fe, u16 * snr) | |||
568 | 579 | ||
569 | dprintk ("%s\n", __FUNCTION__); | 580 | dprintk ("%s\n", __FUNCTION__); |
570 | 581 | ||
571 | _snr = tda10086_read_byte(state, 0x1c); | 582 | _snr = 0xff - tda10086_read_byte(state, 0x1c); |
572 | *snr = (_snr << 8) | _snr; | 583 | *snr = (_snr << 8) | _snr; |
573 | 584 | ||
574 | return 0; | 585 | return 0; |
diff --git a/drivers/media/dvb/frontends/tda826x.c b/drivers/media/dvb/frontends/tda826x.c index 79f971dc52b6..bd3ebc284835 100644 --- a/drivers/media/dvb/frontends/tda826x.c +++ b/drivers/media/dvb/frontends/tda826x.c | |||
@@ -89,8 +89,8 @@ static int tda826x_set_params(struct dvb_frontend *fe, struct dvb_frontend_param | |||
89 | buf[2] = (1<<5) | 0x0b; // 1Mhz + 0.45 VCO | 89 | buf[2] = (1<<5) | 0x0b; // 1Mhz + 0.45 VCO |
90 | buf[3] = div >> 7; | 90 | buf[3] = div >> 7; |
91 | buf[4] = div << 1; | 91 | buf[4] = div << 1; |
92 | buf[5] = 0xff; // basedband filter to max | 92 | buf[5] = 0x77; // baseband cut-off 19 MHz |
93 | buf[6] = 0xfe; // gains at max + no RF attenuation | 93 | buf[6] = 0xfe; // baseband gain 9 db + no RF attenuation |
94 | buf[7] = 0x83; // charge pumps at high, tests off | 94 | buf[7] = 0x83; // charge pumps at high, tests off |
95 | buf[8] = 0x80; // recommended value 4 for AMPVCO + disable ports. | 95 | buf[8] = 0x80; // recommended value 4 for AMPVCO + disable ports. |
96 | buf[9] = 0x1a; // normal caltime + recommended values for SELTH + SELVTL | 96 | buf[9] = 0x1a; // normal caltime + recommended values for SELTH + SELVTL |
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index 5cb3f54b548b..4cca55170e21 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig | |||
@@ -347,7 +347,7 @@ endmenu # encoder / decoder chips | |||
347 | 347 | ||
348 | config VIDEO_VIVI | 348 | config VIDEO_VIVI |
349 | tristate "Virtual Video Driver" | 349 | tristate "Virtual Video Driver" |
350 | depends on VIDEO_V4L2 && !SPARC32 && !SPARC64 && PCI | 350 | depends on VIDEO_V4L2 && !SPARC32 && !SPARC64 && PCI && VIDEO_DEV |
351 | select VIDEO_BUF | 351 | select VIDEO_BUF |
352 | default n | 352 | default n |
353 | ---help--- | 353 | ---help--- |
diff --git a/drivers/media/video/ivtv/ivtv-cards.h b/drivers/media/video/ivtv/ivtv-cards.h index 15012f88b802..91e9e90c14a5 100644 --- a/drivers/media/video/ivtv/ivtv-cards.h +++ b/drivers/media/video/ivtv/ivtv-cards.h | |||
@@ -86,7 +86,7 @@ | |||
86 | V4L2_CAP_AUDIO | V4L2_CAP_READWRITE | V4L2_CAP_VBI_CAPTURE | \ | 86 | V4L2_CAP_AUDIO | V4L2_CAP_READWRITE | V4L2_CAP_VBI_CAPTURE | \ |
87 | V4L2_CAP_SLICED_VBI_CAPTURE) | 87 | V4L2_CAP_SLICED_VBI_CAPTURE) |
88 | #define IVTV_CAP_DECODER (V4L2_CAP_VBI_OUTPUT | V4L2_CAP_VIDEO_OUTPUT | \ | 88 | #define IVTV_CAP_DECODER (V4L2_CAP_VBI_OUTPUT | V4L2_CAP_VIDEO_OUTPUT | \ |
89 | V4L2_CAP_SLICED_VBI_OUTPUT | V4L2_CAP_VIDEO_OUTPUT_OVERLAY | V4L2_CAP_VIDEO_OUTPUT_POS) | 89 | V4L2_CAP_SLICED_VBI_OUTPUT | V4L2_CAP_VIDEO_OUTPUT_OVERLAY) |
90 | 90 | ||
91 | struct ivtv_card_video_input { | 91 | struct ivtv_card_video_input { |
92 | u8 video_type; /* video input type */ | 92 | u8 video_type; /* video input type */ |
diff --git a/drivers/media/video/ivtv/ivtv-driver.c b/drivers/media/video/ivtv/ivtv-driver.c index e29f949adf57..efc66355339a 100644 --- a/drivers/media/video/ivtv/ivtv-driver.c +++ b/drivers/media/video/ivtv/ivtv-driver.c | |||
@@ -652,6 +652,7 @@ static int __devinit ivtv_init_struct1(struct ivtv *itv) | |||
652 | itv->dma_timer.data = (unsigned long)itv; | 652 | itv->dma_timer.data = (unsigned long)itv; |
653 | 653 | ||
654 | itv->cur_dma_stream = -1; | 654 | itv->cur_dma_stream = -1; |
655 | itv->cur_pio_stream = -1; | ||
655 | itv->audio_stereo_mode = AUDIO_STEREO; | 656 | itv->audio_stereo_mode = AUDIO_STEREO; |
656 | itv->audio_bilingual_mode = AUDIO_MONO_LEFT; | 657 | itv->audio_bilingual_mode = AUDIO_MONO_LEFT; |
657 | 658 | ||
diff --git a/drivers/media/video/ivtv/ivtv-driver.h b/drivers/media/video/ivtv/ivtv-driver.h index 552f04511ead..e6e56f175f3f 100644 --- a/drivers/media/video/ivtv/ivtv-driver.h +++ b/drivers/media/video/ivtv/ivtv-driver.h | |||
@@ -237,6 +237,7 @@ extern const u32 yuv_offset[4]; | |||
237 | #define IVTV_IRQ_ENC_VBI_CAP (0x1 << 29) | 237 | #define IVTV_IRQ_ENC_VBI_CAP (0x1 << 29) |
238 | #define IVTV_IRQ_ENC_VIM_RST (0x1 << 28) | 238 | #define IVTV_IRQ_ENC_VIM_RST (0x1 << 28) |
239 | #define IVTV_IRQ_ENC_DMA_COMPLETE (0x1 << 27) | 239 | #define IVTV_IRQ_ENC_DMA_COMPLETE (0x1 << 27) |
240 | #define IVTV_IRQ_ENC_PIO_COMPLETE (0x1 << 25) | ||
240 | #define IVTV_IRQ_DEC_AUD_MODE_CHG (0x1 << 24) | 241 | #define IVTV_IRQ_DEC_AUD_MODE_CHG (0x1 << 24) |
241 | #define IVTV_IRQ_DEC_DATA_REQ (0x1 << 22) | 242 | #define IVTV_IRQ_DEC_DATA_REQ (0x1 << 22) |
242 | #define IVTV_IRQ_DEC_DMA_COMPLETE (0x1 << 20) | 243 | #define IVTV_IRQ_DEC_DMA_COMPLETE (0x1 << 20) |
@@ -247,7 +248,8 @@ extern const u32 yuv_offset[4]; | |||
247 | #define IVTV_IRQ_DEC_VSYNC (0x1 << 10) | 248 | #define IVTV_IRQ_DEC_VSYNC (0x1 << 10) |
248 | 249 | ||
249 | /* IRQ Masks */ | 250 | /* IRQ Masks */ |
250 | #define IVTV_IRQ_MASK_INIT (IVTV_IRQ_DMA_ERR|IVTV_IRQ_ENC_DMA_COMPLETE|IVTV_IRQ_DMA_READ) | 251 | #define IVTV_IRQ_MASK_INIT (IVTV_IRQ_DMA_ERR|IVTV_IRQ_ENC_DMA_COMPLETE|\ |
252 | IVTV_IRQ_DMA_READ|IVTV_IRQ_ENC_PIO_COMPLETE) | ||
251 | 253 | ||
252 | #define IVTV_IRQ_MASK_CAPTURE (IVTV_IRQ_ENC_START_CAP | IVTV_IRQ_ENC_EOS) | 254 | #define IVTV_IRQ_MASK_CAPTURE (IVTV_IRQ_ENC_START_CAP | IVTV_IRQ_ENC_EOS) |
253 | #define IVTV_IRQ_MASK_DECODE (IVTV_IRQ_DEC_DATA_REQ|IVTV_IRQ_DEC_AUD_MODE_CHG) | 255 | #define IVTV_IRQ_MASK_DECODE (IVTV_IRQ_DEC_DATA_REQ|IVTV_IRQ_DEC_AUD_MODE_CHG) |
@@ -374,6 +376,9 @@ struct ivtv_mailbox_data { | |||
374 | #define IVTV_F_S_STREAMOFF 7 /* signal end of stream EOS */ | 376 | #define IVTV_F_S_STREAMOFF 7 /* signal end of stream EOS */ |
375 | #define IVTV_F_S_APPL_IO 8 /* this stream is used read/written by an application */ | 377 | #define IVTV_F_S_APPL_IO 8 /* this stream is used read/written by an application */ |
376 | 378 | ||
379 | #define IVTV_F_S_PIO_PENDING 9 /* this stream has pending PIO */ | ||
380 | #define IVTV_F_S_PIO_HAS_VBI 1 /* the current PIO request also requests VBI data */ | ||
381 | |||
377 | /* per-ivtv, i_flags */ | 382 | /* per-ivtv, i_flags */ |
378 | #define IVTV_F_I_DMA 0 /* DMA in progress */ | 383 | #define IVTV_F_I_DMA 0 /* DMA in progress */ |
379 | #define IVTV_F_I_UDMA 1 /* UDMA in progress */ | 384 | #define IVTV_F_I_UDMA 1 /* UDMA in progress */ |
@@ -390,8 +395,11 @@ struct ivtv_mailbox_data { | |||
390 | #define IVTV_F_I_DECODING_YUV 12 /* this stream is YUV frame decoding */ | 395 | #define IVTV_F_I_DECODING_YUV 12 /* this stream is YUV frame decoding */ |
391 | #define IVTV_F_I_ENC_PAUSED 13 /* the encoder is paused */ | 396 | #define IVTV_F_I_ENC_PAUSED 13 /* the encoder is paused */ |
392 | #define IVTV_F_I_VALID_DEC_TIMINGS 14 /* last_dec_timing is valid */ | 397 | #define IVTV_F_I_VALID_DEC_TIMINGS 14 /* last_dec_timing is valid */ |
393 | #define IVTV_F_I_WORK_HANDLER_VBI 15 /* there is work to be done for VBI */ | 398 | #define IVTV_F_I_HAVE_WORK 15 /* Used in the interrupt handler: there is work to be done */ |
394 | #define IVTV_F_I_WORK_HANDLER_YUV 16 /* there is work to be done for YUV */ | 399 | #define IVTV_F_I_WORK_HANDLER_VBI 16 /* there is work to be done for VBI */ |
400 | #define IVTV_F_I_WORK_HANDLER_YUV 17 /* there is work to be done for YUV */ | ||
401 | #define IVTV_F_I_WORK_HANDLER_PIO 18 /* there is work to be done for PIO */ | ||
402 | #define IVTV_F_I_PIO 19 /* PIO in progress */ | ||
395 | 403 | ||
396 | /* Event notifications */ | 404 | /* Event notifications */ |
397 | #define IVTV_F_I_EV_DEC_STOPPED 28 /* decoder stopped event */ | 405 | #define IVTV_F_I_EV_DEC_STOPPED 28 /* decoder stopped event */ |
@@ -484,6 +492,7 @@ struct ivtv_stream { | |||
484 | 492 | ||
485 | /* Base Dev SG Array for cx23415/6 */ | 493 | /* Base Dev SG Array for cx23415/6 */ |
486 | struct ivtv_SG_element *SGarray; | 494 | struct ivtv_SG_element *SGarray; |
495 | struct ivtv_SG_element *PIOarray; | ||
487 | dma_addr_t SG_handle; | 496 | dma_addr_t SG_handle; |
488 | int SG_length; | 497 | int SG_length; |
489 | 498 | ||
@@ -706,6 +715,7 @@ struct ivtv { | |||
706 | atomic_t decoding; /* count number of active decoding streams */ | 715 | atomic_t decoding; /* count number of active decoding streams */ |
707 | u32 irq_rr_idx; /* Round-robin stream index */ | 716 | u32 irq_rr_idx; /* Round-robin stream index */ |
708 | int cur_dma_stream; /* index of stream doing DMA */ | 717 | int cur_dma_stream; /* index of stream doing DMA */ |
718 | int cur_pio_stream; /* index of stream doing PIO */ | ||
709 | u32 dma_data_req_offset; | 719 | u32 dma_data_req_offset; |
710 | u32 dma_data_req_size; | 720 | u32 dma_data_req_size; |
711 | int output_mode; /* NONE, MPG, YUV, UDMA YUV, passthrough */ | 721 | int output_mode; /* NONE, MPG, YUV, UDMA YUV, passthrough */ |
diff --git a/drivers/media/video/ivtv/ivtv-fileops.c b/drivers/media/video/ivtv/ivtv-fileops.c index 8976487a65f3..555d5e6369c3 100644 --- a/drivers/media/video/ivtv/ivtv-fileops.c +++ b/drivers/media/video/ivtv/ivtv-fileops.c | |||
@@ -32,6 +32,8 @@ | |||
32 | #include "ivtv-yuv.h" | 32 | #include "ivtv-yuv.h" |
33 | #include "ivtv-controls.h" | 33 | #include "ivtv-controls.h" |
34 | #include "ivtv-ioctl.h" | 34 | #include "ivtv-ioctl.h" |
35 | #include "ivtv-cards.h" | ||
36 | #include <media/saa7115.h> | ||
35 | 37 | ||
36 | /* This function tries to claim the stream for a specific file descriptor. | 38 | /* This function tries to claim the stream for a specific file descriptor. |
37 | If no one else is using this stream then the stream is claimed and | 39 | If no one else is using this stream then the stream is claimed and |
@@ -786,6 +788,13 @@ int ivtv_v4l2_close(struct inode *inode, struct file *filp) | |||
786 | ivtv_call_i2c_clients(itv, VIDIOC_S_STD, &itv->std); | 788 | ivtv_call_i2c_clients(itv, VIDIOC_S_STD, &itv->std); |
787 | /* Select correct audio input (i.e. TV tuner or Line in) */ | 789 | /* Select correct audio input (i.e. TV tuner or Line in) */ |
788 | ivtv_audio_set_io(itv); | 790 | ivtv_audio_set_io(itv); |
791 | if (itv->hw_flags & IVTV_HW_SAA711X) | ||
792 | { | ||
793 | struct v4l2_crystal_freq crystal_freq; | ||
794 | crystal_freq.freq = SAA7115_FREQ_32_11_MHZ; | ||
795 | crystal_freq.flags = 0; | ||
796 | ivtv_saa7115(itv, VIDIOC_INT_S_CRYSTAL_FREQ, &crystal_freq); | ||
797 | } | ||
789 | /* Done! Unmute and continue. */ | 798 | /* Done! Unmute and continue. */ |
790 | ivtv_unmute(itv); | 799 | ivtv_unmute(itv); |
791 | ivtv_release_stream(s); | 800 | ivtv_release_stream(s); |
@@ -872,6 +881,13 @@ int ivtv_v4l2_open(struct inode *inode, struct file *filp) | |||
872 | set_bit(IVTV_F_I_RADIO_USER, &itv->i_flags); | 881 | set_bit(IVTV_F_I_RADIO_USER, &itv->i_flags); |
873 | /* Select the correct audio input (i.e. radio tuner) */ | 882 | /* Select the correct audio input (i.e. radio tuner) */ |
874 | ivtv_audio_set_io(itv); | 883 | ivtv_audio_set_io(itv); |
884 | if (itv->hw_flags & IVTV_HW_SAA711X) | ||
885 | { | ||
886 | struct v4l2_crystal_freq crystal_freq; | ||
887 | crystal_freq.freq = SAA7115_FREQ_32_11_MHZ; | ||
888 | crystal_freq.flags = SAA7115_FREQ_FL_APLL; | ||
889 | ivtv_saa7115(itv, VIDIOC_INT_S_CRYSTAL_FREQ, &crystal_freq); | ||
890 | } | ||
875 | /* Done! Unmute and continue. */ | 891 | /* Done! Unmute and continue. */ |
876 | ivtv_unmute(itv); | 892 | ivtv_unmute(itv); |
877 | } | 893 | } |
diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c b/drivers/media/video/ivtv/ivtv-ioctl.c index 1989ec1cb973..57af1762de1f 100644 --- a/drivers/media/video/ivtv/ivtv-ioctl.c +++ b/drivers/media/video/ivtv/ivtv-ioctl.c | |||
@@ -532,11 +532,6 @@ static int ivtv_try_or_set_fmt(struct ivtv *itv, int streamtype, | |||
532 | itv->yuv_info.yuv_forced_update = 1; | 532 | itv->yuv_info.yuv_forced_update = 1; |
533 | return 0; | 533 | return 0; |
534 | } | 534 | } |
535 | if (!ivtv_vapi(itv, CX2341X_OSD_SET_FRAMEBUFFER_WINDOW, 4, | ||
536 | r.width, r.height, r.left, r.top)) | ||
537 | itv->main_rect = r; | ||
538 | else | ||
539 | return -EINVAL; | ||
540 | } | 535 | } |
541 | return 0; | 536 | return 0; |
542 | } | 537 | } |
@@ -799,9 +794,39 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void | |||
799 | return ivtv_get_fmt(itv, id->type, fmt); | 794 | return ivtv_get_fmt(itv, id->type, fmt); |
800 | } | 795 | } |
801 | 796 | ||
797 | case VIDIOC_CROPCAP: { | ||
798 | struct v4l2_cropcap *cropcap = arg; | ||
799 | |||
800 | if (cropcap->type != V4L2_BUF_TYPE_VIDEO_CAPTURE && | ||
801 | cropcap->type != V4L2_BUF_TYPE_VIDEO_OUTPUT) | ||
802 | return -EINVAL; | ||
803 | cropcap->bounds.top = cropcap->bounds.left = 0; | ||
804 | cropcap->bounds.width = 720; | ||
805 | if (cropcap->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) { | ||
806 | cropcap->bounds.height = itv->is_50hz ? 576 : 480; | ||
807 | cropcap->pixelaspect.numerator = itv->is_50hz ? 59 : 10; | ||
808 | cropcap->pixelaspect.denominator = itv->is_50hz ? 54 : 11; | ||
809 | } else { | ||
810 | cropcap->bounds.height = itv->is_out_50hz ? 576 : 480; | ||
811 | cropcap->pixelaspect.numerator = itv->is_out_50hz ? 59 : 10; | ||
812 | cropcap->pixelaspect.denominator = itv->is_out_50hz ? 54 : 11; | ||
813 | } | ||
814 | cropcap->defrect = cropcap->bounds; | ||
815 | return 0; | ||
816 | } | ||
817 | |||
802 | case VIDIOC_S_CROP: { | 818 | case VIDIOC_S_CROP: { |
803 | struct v4l2_crop *crop = arg; | 819 | struct v4l2_crop *crop = arg; |
804 | 820 | ||
821 | if (crop->type == V4L2_BUF_TYPE_VIDEO_OUTPUT && | ||
822 | (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)) { | ||
823 | if (!ivtv_vapi(itv, CX2341X_OSD_SET_FRAMEBUFFER_WINDOW, 4, | ||
824 | crop->c.width, crop->c.height, crop->c.left, crop->c.top)) { | ||
825 | itv->main_rect = crop->c; | ||
826 | return 0; | ||
827 | } | ||
828 | return -EINVAL; | ||
829 | } | ||
805 | if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | 830 | if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) |
806 | return -EINVAL; | 831 | return -EINVAL; |
807 | return itv->video_dec_func(itv, VIDIOC_S_CROP, arg); | 832 | return itv->video_dec_func(itv, VIDIOC_S_CROP, arg); |
@@ -810,6 +835,11 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void | |||
810 | case VIDIOC_G_CROP: { | 835 | case VIDIOC_G_CROP: { |
811 | struct v4l2_crop *crop = arg; | 836 | struct v4l2_crop *crop = arg; |
812 | 837 | ||
838 | if (crop->type == V4L2_BUF_TYPE_VIDEO_OUTPUT && | ||
839 | (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)) { | ||
840 | crop->c = itv->main_rect; | ||
841 | return 0; | ||
842 | } | ||
813 | if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | 843 | if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) |
814 | return -EINVAL; | 844 | return -EINVAL; |
815 | return itv->video_dec_func(itv, VIDIOC_G_CROP, arg); | 845 | return itv->video_dec_func(itv, VIDIOC_G_CROP, arg); |
@@ -977,7 +1007,7 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void | |||
977 | if (itv->hw_flags & IVTV_HW_CX25840) { | 1007 | if (itv->hw_flags & IVTV_HW_CX25840) { |
978 | itv->vbi.sliced_decoder_line_size = itv->is_60hz ? 272 : 284; | 1008 | itv->vbi.sliced_decoder_line_size = itv->is_60hz ? 272 : 284; |
979 | } | 1009 | } |
980 | IVTV_DEBUG_INFO("Switching standard to %llx.\n", itv->std); | 1010 | IVTV_DEBUG_INFO("Switching standard to %llx.\n", (unsigned long long)itv->std); |
981 | 1011 | ||
982 | /* Tuner */ | 1012 | /* Tuner */ |
983 | ivtv_call_i2c_clients(itv, VIDIOC_S_STD, &itv->std); | 1013 | ivtv_call_i2c_clients(itv, VIDIOC_S_STD, &itv->std); |
@@ -1207,7 +1237,7 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void | |||
1207 | (s->buffers - s->q_free.buffers) * 100 / s->buffers, | 1237 | (s->buffers - s->q_free.buffers) * 100 / s->buffers, |
1208 | (s->buffers * s->buf_size) / 1024, s->buffers); | 1238 | (s->buffers * s->buf_size) / 1024, s->buffers); |
1209 | } | 1239 | } |
1210 | IVTV_INFO("Read MPEG/VBI: %lld/%lld bytes\n", itv->mpg_data_received, itv->vbi_data_inserted); | 1240 | IVTV_INFO("Read MPEG/VBI: %lld/%lld bytes\n", (long long)itv->mpg_data_received, (long long)itv->vbi_data_inserted); |
1211 | IVTV_INFO("================== END STATUS CARD #%d ==================\n", itv->num); | 1241 | IVTV_INFO("================== END STATUS CARD #%d ==================\n", itv->num); |
1212 | break; | 1242 | break; |
1213 | } | 1243 | } |
@@ -1455,6 +1485,7 @@ static int ivtv_v4l2_do_ioctl(struct inode *inode, struct file *filp, | |||
1455 | case VIDIOC_S_FMT: | 1485 | case VIDIOC_S_FMT: |
1456 | case VIDIOC_TRY_FMT: | 1486 | case VIDIOC_TRY_FMT: |
1457 | case VIDIOC_ENUM_FMT: | 1487 | case VIDIOC_ENUM_FMT: |
1488 | case VIDIOC_CROPCAP: | ||
1458 | case VIDIOC_G_CROP: | 1489 | case VIDIOC_G_CROP: |
1459 | case VIDIOC_S_CROP: | 1490 | case VIDIOC_S_CROP: |
1460 | case VIDIOC_G_FREQUENCY: | 1491 | case VIDIOC_G_FREQUENCY: |
diff --git a/drivers/media/video/ivtv/ivtv-irq.c b/drivers/media/video/ivtv/ivtv-irq.c index c3a047b381b3..ba98bf054f2e 100644 --- a/drivers/media/video/ivtv/ivtv-irq.c +++ b/drivers/media/video/ivtv/ivtv-irq.c | |||
@@ -31,8 +31,6 @@ | |||
31 | 31 | ||
32 | #define DMA_MAGIC_COOKIE 0x000001fe | 32 | #define DMA_MAGIC_COOKIE 0x000001fe |
33 | 33 | ||
34 | #define SLICED_VBI_PIO 1 | ||
35 | |||
36 | static void ivtv_dma_dec_start(struct ivtv_stream *s); | 34 | static void ivtv_dma_dec_start(struct ivtv_stream *s); |
37 | 35 | ||
38 | static const int ivtv_stream_map[] = { | 36 | static const int ivtv_stream_map[] = { |
@@ -42,12 +40,40 @@ static const int ivtv_stream_map[] = { | |||
42 | IVTV_ENC_STREAM_TYPE_VBI, | 40 | IVTV_ENC_STREAM_TYPE_VBI, |
43 | }; | 41 | }; |
44 | 42 | ||
45 | static inline int ivtv_use_pio(struct ivtv_stream *s) | 43 | |
44 | static void ivtv_pio_work_handler(struct ivtv *itv) | ||
46 | { | 45 | { |
47 | struct ivtv *itv = s->itv; | 46 | struct ivtv_stream *s = &itv->streams[itv->cur_pio_stream]; |
47 | struct ivtv_buffer *buf; | ||
48 | struct list_head *p; | ||
49 | int i = 0; | ||
50 | |||
51 | IVTV_DEBUG_DMA("ivtv_pio_work_handler\n"); | ||
52 | if (itv->cur_pio_stream < 0 || itv->cur_pio_stream >= IVTV_MAX_STREAMS || | ||
53 | s->v4l2dev == NULL || !ivtv_use_pio(s)) { | ||
54 | itv->cur_pio_stream = -1; | ||
55 | /* trigger PIO complete user interrupt */ | ||
56 | write_reg(IVTV_IRQ_ENC_PIO_COMPLETE, 0x44); | ||
57 | return; | ||
58 | } | ||
59 | IVTV_DEBUG_DMA("Process PIO %s\n", s->name); | ||
60 | buf = list_entry(s->q_dma.list.next, struct ivtv_buffer, list); | ||
61 | list_for_each(p, &s->q_dma.list) { | ||
62 | struct ivtv_buffer *buf = list_entry(p, struct ivtv_buffer, list); | ||
63 | u32 size = s->PIOarray[i].size & 0x3ffff; | ||
48 | 64 | ||
49 | return s->dma == PCI_DMA_NONE || | 65 | /* Copy the data from the card to the buffer */ |
50 | (SLICED_VBI_PIO && s->type == IVTV_ENC_STREAM_TYPE_VBI && itv->vbi.sliced_in->service_set); | 66 | if (s->type == IVTV_DEC_STREAM_TYPE_VBI) { |
67 | memcpy_fromio(buf->buf, itv->dec_mem + s->PIOarray[i].src - IVTV_DECODER_OFFSET, size); | ||
68 | } | ||
69 | else { | ||
70 | memcpy_fromio(buf->buf, itv->enc_mem + s->PIOarray[i].src, size); | ||
71 | } | ||
72 | if (s->PIOarray[i].size & 0x80000000) | ||
73 | break; | ||
74 | i++; | ||
75 | } | ||
76 | write_reg(IVTV_IRQ_ENC_PIO_COMPLETE, 0x44); | ||
51 | } | 77 | } |
52 | 78 | ||
53 | void ivtv_irq_work_handler(struct work_struct *work) | 79 | void ivtv_irq_work_handler(struct work_struct *work) |
@@ -56,8 +82,11 @@ void ivtv_irq_work_handler(struct work_struct *work) | |||
56 | 82 | ||
57 | DEFINE_WAIT(wait); | 83 | DEFINE_WAIT(wait); |
58 | 84 | ||
85 | if (test_and_clear_bit(IVTV_F_I_WORK_HANDLER_PIO, &itv->i_flags)) | ||
86 | ivtv_pio_work_handler(itv); | ||
87 | |||
59 | if (test_and_clear_bit(IVTV_F_I_WORK_HANDLER_VBI, &itv->i_flags)) | 88 | if (test_and_clear_bit(IVTV_F_I_WORK_HANDLER_VBI, &itv->i_flags)) |
60 | vbi_work_handler(itv); | 89 | ivtv_vbi_work_handler(itv); |
61 | 90 | ||
62 | if (test_and_clear_bit(IVTV_F_I_WORK_HANDLER_YUV, &itv->i_flags)) | 91 | if (test_and_clear_bit(IVTV_F_I_WORK_HANDLER_YUV, &itv->i_flags)) |
63 | ivtv_yuv_work_handler(itv); | 92 | ivtv_yuv_work_handler(itv); |
@@ -173,8 +202,7 @@ static int stream_enc_dma_append(struct ivtv_stream *s, u32 data[CX2341X_MBOX_MA | |||
173 | } | 202 | } |
174 | s->buffers_stolen = rc; | 203 | s->buffers_stolen = rc; |
175 | 204 | ||
176 | /* got the buffers, now fill in SGarray (DMA) or copy the data from the card | 205 | /* got the buffers, now fill in SGarray (DMA) */ |
177 | to the buffers (PIO). */ | ||
178 | buf = list_entry(s->q_predma.list.next, struct ivtv_buffer, list); | 206 | buf = list_entry(s->q_predma.list.next, struct ivtv_buffer, list); |
179 | memset(buf->buf, 0, 128); | 207 | memset(buf->buf, 0, 128); |
180 | list_for_each(p, &s->q_predma.list) { | 208 | list_for_each(p, &s->q_predma.list) { |
@@ -182,21 +210,11 @@ static int stream_enc_dma_append(struct ivtv_stream *s, u32 data[CX2341X_MBOX_MA | |||
182 | 210 | ||
183 | if (skip_bufs-- > 0) | 211 | if (skip_bufs-- > 0) |
184 | continue; | 212 | continue; |
185 | if (!ivtv_use_pio(s)) { | 213 | s->SGarray[idx].dst = cpu_to_le32(buf->dma_handle); |
186 | s->SGarray[idx].dst = cpu_to_le32(buf->dma_handle); | 214 | s->SGarray[idx].src = cpu_to_le32(offset); |
187 | s->SGarray[idx].src = cpu_to_le32(offset); | 215 | s->SGarray[idx].size = cpu_to_le32(s->buf_size); |
188 | s->SGarray[idx].size = cpu_to_le32(s->buf_size); | ||
189 | } | ||
190 | buf->bytesused = (size < s->buf_size) ? size : s->buf_size; | 216 | buf->bytesused = (size < s->buf_size) ? size : s->buf_size; |
191 | 217 | ||
192 | /* If PIO, then copy the data from the card to the buffer */ | ||
193 | if (s->type == IVTV_DEC_STREAM_TYPE_VBI) { | ||
194 | memcpy_fromio(buf->buf, itv->dec_mem + offset - IVTV_DECODER_OFFSET, buf->bytesused); | ||
195 | } | ||
196 | else if (ivtv_use_pio(s)) { | ||
197 | memcpy_fromio(buf->buf, itv->enc_mem + offset, buf->bytesused); | ||
198 | } | ||
199 | |||
200 | s->q_predma.bytesused += buf->bytesused; | 218 | s->q_predma.bytesused += buf->bytesused; |
201 | size -= buf->bytesused; | 219 | size -= buf->bytesused; |
202 | offset += s->buf_size; | 220 | offset += s->buf_size; |
@@ -224,11 +242,6 @@ static void dma_post(struct ivtv_stream *s) | |||
224 | u32 *u32buf; | 242 | u32 *u32buf; |
225 | int x = 0; | 243 | int x = 0; |
226 | 244 | ||
227 | if (ivtv_use_pio(s)) { | ||
228 | if (s->q_predma.bytesused) | ||
229 | ivtv_queue_move(s, &s->q_predma, NULL, &s->q_dma, s->q_predma.bytesused); | ||
230 | s->SG_length = 0; | ||
231 | } | ||
232 | IVTV_DEBUG_DMA("%s %s completed (%x)\n", ivtv_use_pio(s) ? "PIO" : "DMA", | 245 | IVTV_DEBUG_DMA("%s %s completed (%x)\n", ivtv_use_pio(s) ? "PIO" : "DMA", |
233 | s->name, s->dma_offset); | 246 | s->name, s->dma_offset); |
234 | list_for_each(p, &s->q_dma.list) { | 247 | list_for_each(p, &s->q_dma.list) { |
@@ -278,10 +291,14 @@ static void dma_post(struct ivtv_stream *s) | |||
278 | if (buf) | 291 | if (buf) |
279 | buf->bytesused += s->dma_last_offset; | 292 | buf->bytesused += s->dma_last_offset; |
280 | if (buf && s->type == IVTV_DEC_STREAM_TYPE_VBI) { | 293 | if (buf && s->type == IVTV_DEC_STREAM_TYPE_VBI) { |
281 | /* Parse and Groom VBI Data */ | 294 | list_for_each(p, &s->q_dma.list) { |
282 | s->q_dma.bytesused -= buf->bytesused; | 295 | buf = list_entry(p, struct ivtv_buffer, list); |
283 | ivtv_process_vbi_data(itv, buf, 0, s->type); | 296 | |
284 | s->q_dma.bytesused += buf->bytesused; | 297 | /* Parse and Groom VBI Data */ |
298 | s->q_dma.bytesused -= buf->bytesused; | ||
299 | ivtv_process_vbi_data(itv, buf, 0, s->type); | ||
300 | s->q_dma.bytesused += buf->bytesused; | ||
301 | } | ||
285 | if (s->id == -1) { | 302 | if (s->id == -1) { |
286 | ivtv_queue_move(s, &s->q_dma, NULL, &s->q_free, 0); | 303 | ivtv_queue_move(s, &s->q_dma, NULL, &s->q_free, 0); |
287 | return; | 304 | return; |
@@ -351,10 +368,14 @@ static void ivtv_dma_enc_start(struct ivtv_stream *s) | |||
351 | struct ivtv_stream *s_vbi = &itv->streams[IVTV_ENC_STREAM_TYPE_VBI]; | 368 | struct ivtv_stream *s_vbi = &itv->streams[IVTV_ENC_STREAM_TYPE_VBI]; |
352 | int i; | 369 | int i; |
353 | 370 | ||
371 | IVTV_DEBUG_DMA("start %s for %s\n", ivtv_use_dma(s) ? "DMA" : "PIO", s->name); | ||
372 | |||
354 | if (s->q_predma.bytesused) | 373 | if (s->q_predma.bytesused) |
355 | ivtv_queue_move(s, &s->q_predma, NULL, &s->q_dma, s->q_predma.bytesused); | 374 | ivtv_queue_move(s, &s->q_predma, NULL, &s->q_dma, s->q_predma.bytesused); |
356 | IVTV_DEBUG_DMA("start DMA for %s\n", s->name); | 375 | |
357 | s->SGarray[s->SG_length - 1].size = cpu_to_le32(le32_to_cpu(s->SGarray[s->SG_length - 1].size) + 256); | 376 | if (ivtv_use_dma(s)) |
377 | s->SGarray[s->SG_length - 1].size = | ||
378 | cpu_to_le32(le32_to_cpu(s->SGarray[s->SG_length - 1].size) + 256); | ||
358 | 379 | ||
359 | /* If this is an MPEG stream, and VBI data is also pending, then append the | 380 | /* If this is an MPEG stream, and VBI data is also pending, then append the |
360 | VBI DMA to the MPEG DMA and transfer both sets of data at once. | 381 | VBI DMA to the MPEG DMA and transfer both sets of data at once. |
@@ -368,7 +389,8 @@ static void ivtv_dma_enc_start(struct ivtv_stream *s) | |||
368 | if (s->type == IVTV_ENC_STREAM_TYPE_MPG && s_vbi->SG_length && | 389 | if (s->type == IVTV_ENC_STREAM_TYPE_MPG && s_vbi->SG_length && |
369 | s->SG_length + s_vbi->SG_length <= s->buffers) { | 390 | s->SG_length + s_vbi->SG_length <= s->buffers) { |
370 | ivtv_queue_move(s_vbi, &s_vbi->q_predma, NULL, &s_vbi->q_dma, s_vbi->q_predma.bytesused); | 391 | ivtv_queue_move(s_vbi, &s_vbi->q_predma, NULL, &s_vbi->q_dma, s_vbi->q_predma.bytesused); |
371 | s_vbi->SGarray[s_vbi->SG_length - 1].size = cpu_to_le32(le32_to_cpu(s_vbi->SGarray[s->SG_length - 1].size) + 256); | 392 | if (ivtv_use_dma(s_vbi)) |
393 | s_vbi->SGarray[s_vbi->SG_length - 1].size = cpu_to_le32(le32_to_cpu(s_vbi->SGarray[s->SG_length - 1].size) + 256); | ||
372 | for (i = 0; i < s_vbi->SG_length; i++) { | 394 | for (i = 0; i < s_vbi->SG_length; i++) { |
373 | s->SGarray[s->SG_length++] = s_vbi->SGarray[i]; | 395 | s->SGarray[s->SG_length++] = s_vbi->SGarray[i]; |
374 | } | 396 | } |
@@ -381,14 +403,26 @@ static void ivtv_dma_enc_start(struct ivtv_stream *s) | |||
381 | /* Mark last buffer size for Interrupt flag */ | 403 | /* Mark last buffer size for Interrupt flag */ |
382 | s->SGarray[s->SG_length - 1].size |= cpu_to_le32(0x80000000); | 404 | s->SGarray[s->SG_length - 1].size |= cpu_to_le32(0x80000000); |
383 | 405 | ||
384 | /* Sync Hardware SG List of buffers */ | 406 | if (ivtv_use_pio(s)) { |
385 | ivtv_stream_sync_for_device(s); | 407 | for (i = 0; i < s->SG_length; i++) { |
386 | write_reg(s->SG_handle, IVTV_REG_ENCDMAADDR); | 408 | s->PIOarray[i].src = le32_to_cpu(s->SGarray[i].src); |
387 | write_reg_sync(read_reg(IVTV_REG_DMAXFER) | 0x02, IVTV_REG_DMAXFER); | 409 | s->PIOarray[i].size = le32_to_cpu(s->SGarray[i].size); |
388 | set_bit(IVTV_F_I_DMA, &itv->i_flags); | 410 | } |
389 | itv->cur_dma_stream = s->type; | 411 | set_bit(IVTV_F_I_WORK_HANDLER_PIO, &itv->i_flags); |
390 | itv->dma_timer.expires = jiffies + HZ / 10; | 412 | set_bit(IVTV_F_I_HAVE_WORK, &itv->i_flags); |
391 | add_timer(&itv->dma_timer); | 413 | set_bit(IVTV_F_I_PIO, &itv->i_flags); |
414 | itv->cur_pio_stream = s->type; | ||
415 | } | ||
416 | else { | ||
417 | /* Sync Hardware SG List of buffers */ | ||
418 | ivtv_stream_sync_for_device(s); | ||
419 | write_reg(s->SG_handle, IVTV_REG_ENCDMAADDR); | ||
420 | write_reg_sync(read_reg(IVTV_REG_DMAXFER) | 0x02, IVTV_REG_DMAXFER); | ||
421 | set_bit(IVTV_F_I_DMA, &itv->i_flags); | ||
422 | itv->cur_dma_stream = s->type; | ||
423 | itv->dma_timer.expires = jiffies + HZ / 10; | ||
424 | add_timer(&itv->dma_timer); | ||
425 | } | ||
392 | } | 426 | } |
393 | 427 | ||
394 | static void ivtv_dma_dec_start(struct ivtv_stream *s) | 428 | static void ivtv_dma_dec_start(struct ivtv_stream *s) |
@@ -489,6 +523,40 @@ static void ivtv_irq_enc_dma_complete(struct ivtv *itv) | |||
489 | wake_up(&itv->dma_waitq); | 523 | wake_up(&itv->dma_waitq); |
490 | } | 524 | } |
491 | 525 | ||
526 | static void ivtv_irq_enc_pio_complete(struct ivtv *itv) | ||
527 | { | ||
528 | struct ivtv_stream *s; | ||
529 | |||
530 | if (itv->cur_pio_stream < 0 || itv->cur_pio_stream >= IVTV_MAX_STREAMS) { | ||
531 | itv->cur_pio_stream = -1; | ||
532 | return; | ||
533 | } | ||
534 | s = &itv->streams[itv->cur_pio_stream]; | ||
535 | IVTV_DEBUG_IRQ("ENC PIO COMPLETE %s\n", s->name); | ||
536 | s->SG_length = 0; | ||
537 | clear_bit(IVTV_F_I_ENC_VBI, &itv->i_flags); | ||
538 | clear_bit(IVTV_F_I_PIO, &itv->i_flags); | ||
539 | itv->cur_pio_stream = -1; | ||
540 | dma_post(s); | ||
541 | if (s->type == IVTV_ENC_STREAM_TYPE_MPG) | ||
542 | ivtv_vapi(itv, CX2341X_ENC_SCHED_DMA_TO_HOST, 3, 0, 0, 0); | ||
543 | else if (s->type == IVTV_ENC_STREAM_TYPE_YUV) | ||
544 | ivtv_vapi(itv, CX2341X_ENC_SCHED_DMA_TO_HOST, 3, 0, 0, 1); | ||
545 | else if (s->type == IVTV_ENC_STREAM_TYPE_PCM) | ||
546 | ivtv_vapi(itv, CX2341X_ENC_SCHED_DMA_TO_HOST, 3, 0, 0, 2); | ||
547 | clear_bit(IVTV_F_I_PIO, &itv->i_flags); | ||
548 | if (test_and_clear_bit(IVTV_F_S_DMA_HAS_VBI, &s->s_flags)) { | ||
549 | u32 tmp; | ||
550 | |||
551 | s = &itv->streams[IVTV_ENC_STREAM_TYPE_VBI]; | ||
552 | tmp = s->dma_offset; | ||
553 | s->dma_offset = itv->vbi.dma_offset; | ||
554 | dma_post(s); | ||
555 | s->dma_offset = tmp; | ||
556 | } | ||
557 | wake_up(&itv->dma_waitq); | ||
558 | } | ||
559 | |||
492 | static void ivtv_irq_dma_err(struct ivtv *itv) | 560 | static void ivtv_irq_dma_err(struct ivtv *itv) |
493 | { | 561 | { |
494 | u32 data[CX2341X_MBOX_MAX_DATA]; | 562 | u32 data[CX2341X_MBOX_MAX_DATA]; |
@@ -532,13 +600,7 @@ static void ivtv_irq_enc_start_cap(struct ivtv *itv) | |||
532 | clear_bit(IVTV_F_I_ENC_VBI, &itv->i_flags); | 600 | clear_bit(IVTV_F_I_ENC_VBI, &itv->i_flags); |
533 | s = &itv->streams[ivtv_stream_map[data[0]]]; | 601 | s = &itv->streams[ivtv_stream_map[data[0]]]; |
534 | if (!stream_enc_dma_append(s, data)) { | 602 | if (!stream_enc_dma_append(s, data)) { |
535 | if (ivtv_use_pio(s)) { | 603 | set_bit(ivtv_use_pio(s) ? IVTV_F_S_PIO_PENDING : IVTV_F_S_DMA_PENDING, &s->s_flags); |
536 | dma_post(s); | ||
537 | ivtv_vapi(itv, CX2341X_ENC_SCHED_DMA_TO_HOST, 3, 0, 0, data[0]); | ||
538 | } | ||
539 | else { | ||
540 | set_bit(IVTV_F_S_DMA_PENDING, &s->s_flags); | ||
541 | } | ||
542 | } | 604 | } |
543 | } | 605 | } |
544 | 606 | ||
@@ -551,15 +613,6 @@ static void ivtv_irq_enc_vbi_cap(struct ivtv *itv) | |||
551 | IVTV_DEBUG_IRQ("ENC START VBI CAP\n"); | 613 | IVTV_DEBUG_IRQ("ENC START VBI CAP\n"); |
552 | s = &itv->streams[IVTV_ENC_STREAM_TYPE_VBI]; | 614 | s = &itv->streams[IVTV_ENC_STREAM_TYPE_VBI]; |
553 | 615 | ||
554 | if (ivtv_use_pio(s)) { | ||
555 | if (stream_enc_dma_append(s, data)) | ||
556 | return; | ||
557 | if (s->q_predma.bytesused) | ||
558 | ivtv_queue_move(s, &s->q_predma, NULL, &s->q_dma, s->q_predma.bytesused); | ||
559 | s->SG_length = 0; | ||
560 | dma_post(s); | ||
561 | return; | ||
562 | } | ||
563 | /* If more than two VBI buffers are pending, then | 616 | /* If more than two VBI buffers are pending, then |
564 | clear the old ones and start with this new one. | 617 | clear the old ones and start with this new one. |
565 | This can happen during transition stages when MPEG capturing is | 618 | This can happen during transition stages when MPEG capturing is |
@@ -582,11 +635,11 @@ static void ivtv_irq_enc_vbi_cap(struct ivtv *itv) | |||
582 | if (!stream_enc_dma_append(s, data) && | 635 | if (!stream_enc_dma_append(s, data) && |
583 | !test_bit(IVTV_F_S_STREAMING, &s_mpg->s_flags)) { | 636 | !test_bit(IVTV_F_S_STREAMING, &s_mpg->s_flags)) { |
584 | set_bit(IVTV_F_I_ENC_VBI, &itv->i_flags); | 637 | set_bit(IVTV_F_I_ENC_VBI, &itv->i_flags); |
585 | set_bit(IVTV_F_S_DMA_PENDING, &s->s_flags); | 638 | set_bit(ivtv_use_pio(s) ? IVTV_F_S_PIO_PENDING : IVTV_F_S_DMA_PENDING, &s->s_flags); |
586 | } | 639 | } |
587 | } | 640 | } |
588 | 641 | ||
589 | static void ivtv_irq_dev_vbi_reinsert(struct ivtv *itv) | 642 | static void ivtv_irq_dec_vbi_reinsert(struct ivtv *itv) |
590 | { | 643 | { |
591 | u32 data[CX2341X_MBOX_MAX_DATA]; | 644 | u32 data[CX2341X_MBOX_MAX_DATA]; |
592 | struct ivtv_stream *s = &itv->streams[IVTV_DEC_STREAM_TYPE_VBI]; | 645 | struct ivtv_stream *s = &itv->streams[IVTV_DEC_STREAM_TYPE_VBI]; |
@@ -594,7 +647,7 @@ static void ivtv_irq_dev_vbi_reinsert(struct ivtv *itv) | |||
594 | IVTV_DEBUG_IRQ("DEC VBI REINSERT\n"); | 647 | IVTV_DEBUG_IRQ("DEC VBI REINSERT\n"); |
595 | if (test_bit(IVTV_F_S_CLAIMED, &s->s_flags) && | 648 | if (test_bit(IVTV_F_S_CLAIMED, &s->s_flags) && |
596 | !stream_enc_dma_append(s, data)) { | 649 | !stream_enc_dma_append(s, data)) { |
597 | dma_post(s); | 650 | set_bit(IVTV_F_S_PIO_PENDING, &s->s_flags); |
598 | } | 651 | } |
599 | } | 652 | } |
600 | 653 | ||
@@ -657,7 +710,6 @@ static void ivtv_irq_vsync(struct ivtv *itv) | |||
657 | } | 710 | } |
658 | if (frame != (itv->lastVsyncFrame & 1)) { | 711 | if (frame != (itv->lastVsyncFrame & 1)) { |
659 | struct ivtv_stream *s = ivtv_get_output_stream(itv); | 712 | struct ivtv_stream *s = ivtv_get_output_stream(itv); |
660 | int work = 0; | ||
661 | 713 | ||
662 | itv->lastVsyncFrame += 1; | 714 | itv->lastVsyncFrame += 1; |
663 | if (frame == 0) { | 715 | if (frame == 0) { |
@@ -678,7 +730,7 @@ static void ivtv_irq_vsync(struct ivtv *itv) | |||
678 | /* Send VBI to saa7127 */ | 730 | /* Send VBI to saa7127 */ |
679 | if (frame) { | 731 | if (frame) { |
680 | set_bit(IVTV_F_I_WORK_HANDLER_VBI, &itv->i_flags); | 732 | set_bit(IVTV_F_I_WORK_HANDLER_VBI, &itv->i_flags); |
681 | work = 1; | 733 | set_bit(IVTV_F_I_HAVE_WORK, &itv->i_flags); |
682 | } | 734 | } |
683 | 735 | ||
684 | /* Check if we need to update the yuv registers */ | 736 | /* Check if we need to update the yuv registers */ |
@@ -691,11 +743,9 @@ static void ivtv_irq_vsync(struct ivtv *itv) | |||
691 | itv->yuv_info.new_frame_info[last_dma_frame].update = 0; | 743 | itv->yuv_info.new_frame_info[last_dma_frame].update = 0; |
692 | itv->yuv_info.yuv_forced_update = 0; | 744 | itv->yuv_info.yuv_forced_update = 0; |
693 | set_bit(IVTV_F_I_WORK_HANDLER_YUV, &itv->i_flags); | 745 | set_bit(IVTV_F_I_WORK_HANDLER_YUV, &itv->i_flags); |
694 | work = 1; | 746 | set_bit(IVTV_F_I_HAVE_WORK, &itv->i_flags); |
695 | } | 747 | } |
696 | } | 748 | } |
697 | if (work) | ||
698 | queue_work(itv->irq_work_queues, &itv->irq_work_queue); | ||
699 | } | 749 | } |
700 | } | 750 | } |
701 | 751 | ||
@@ -755,6 +805,10 @@ irqreturn_t ivtv_irq_handler(int irq, void *dev_id) | |||
755 | ivtv_irq_enc_dma_complete(itv); | 805 | ivtv_irq_enc_dma_complete(itv); |
756 | } | 806 | } |
757 | 807 | ||
808 | if (combo & IVTV_IRQ_ENC_PIO_COMPLETE) { | ||
809 | ivtv_irq_enc_pio_complete(itv); | ||
810 | } | ||
811 | |||
758 | if (combo & IVTV_IRQ_DMA_ERR) { | 812 | if (combo & IVTV_IRQ_DMA_ERR) { |
759 | ivtv_irq_dma_err(itv); | 813 | ivtv_irq_dma_err(itv); |
760 | } | 814 | } |
@@ -768,7 +822,7 @@ irqreturn_t ivtv_irq_handler(int irq, void *dev_id) | |||
768 | } | 822 | } |
769 | 823 | ||
770 | if (combo & IVTV_IRQ_DEC_VBI_RE_INSERT) { | 824 | if (combo & IVTV_IRQ_DEC_VBI_RE_INSERT) { |
771 | ivtv_irq_dev_vbi_reinsert(itv); | 825 | ivtv_irq_dec_vbi_reinsert(itv); |
772 | } | 826 | } |
773 | 827 | ||
774 | if (combo & IVTV_IRQ_ENC_EOS) { | 828 | if (combo & IVTV_IRQ_ENC_EOS) { |
@@ -813,6 +867,22 @@ irqreturn_t ivtv_irq_handler(int irq, void *dev_id) | |||
813 | } | 867 | } |
814 | } | 868 | } |
815 | 869 | ||
870 | if ((combo & IVTV_IRQ_DMA) && !test_bit(IVTV_F_I_PIO, &itv->i_flags)) { | ||
871 | for (i = 0; i < IVTV_MAX_STREAMS; i++) { | ||
872 | int idx = (i + itv->irq_rr_idx++) % IVTV_MAX_STREAMS; | ||
873 | struct ivtv_stream *s = &itv->streams[idx]; | ||
874 | |||
875 | if (!test_and_clear_bit(IVTV_F_S_PIO_PENDING, &s->s_flags)) | ||
876 | continue; | ||
877 | if (s->type == IVTV_DEC_STREAM_TYPE_VBI || s->type < IVTV_DEC_STREAM_TYPE_MPG) | ||
878 | ivtv_dma_enc_start(s); | ||
879 | break; | ||
880 | } | ||
881 | } | ||
882 | |||
883 | if (test_and_clear_bit(IVTV_F_I_HAVE_WORK, &itv->i_flags)) | ||
884 | queue_work(itv->irq_work_queues, &itv->irq_work_queue); | ||
885 | |||
816 | spin_unlock(&itv->dma_reg_lock); | 886 | spin_unlock(&itv->dma_reg_lock); |
817 | 887 | ||
818 | /* If we've just handled a 'forced' vsync, it's safest to say it | 888 | /* If we've just handled a 'forced' vsync, it's safest to say it |
diff --git a/drivers/media/video/ivtv/ivtv-queue.c b/drivers/media/video/ivtv/ivtv-queue.c index ccfcef1ad91a..a04f9387f63d 100644 --- a/drivers/media/video/ivtv/ivtv-queue.c +++ b/drivers/media/video/ivtv/ivtv-queue.c | |||
@@ -195,14 +195,26 @@ int ivtv_stream_alloc(struct ivtv_stream *s) | |||
195 | s->dma != PCI_DMA_NONE ? "DMA " : "", | 195 | s->dma != PCI_DMA_NONE ? "DMA " : "", |
196 | s->name, s->buffers, s->buf_size, s->buffers * s->buf_size / 1024); | 196 | s->name, s->buffers, s->buf_size, s->buffers * s->buf_size / 1024); |
197 | 197 | ||
198 | /* Allocate DMA SG Arrays */ | 198 | if (ivtv_might_use_pio(s)) { |
199 | if (s->dma != PCI_DMA_NONE) { | 199 | s->PIOarray = (struct ivtv_SG_element *)kzalloc(SGsize, GFP_KERNEL); |
200 | s->SGarray = (struct ivtv_SG_element *)kzalloc(SGsize, GFP_KERNEL); | 200 | if (s->PIOarray == NULL) { |
201 | if (s->SGarray == NULL) { | 201 | IVTV_ERR("Could not allocate PIOarray for %s stream\n", s->name); |
202 | IVTV_ERR("Could not allocate SGarray for %s stream\n", s->name); | ||
203 | return -ENOMEM; | 202 | return -ENOMEM; |
204 | } | 203 | } |
205 | s->SG_length = 0; | 204 | } |
205 | |||
206 | /* Allocate DMA SG Arrays */ | ||
207 | s->SGarray = (struct ivtv_SG_element *)kzalloc(SGsize, GFP_KERNEL); | ||
208 | if (s->SGarray == NULL) { | ||
209 | IVTV_ERR("Could not allocate SGarray for %s stream\n", s->name); | ||
210 | if (ivtv_might_use_pio(s)) { | ||
211 | kfree(s->PIOarray); | ||
212 | s->PIOarray = NULL; | ||
213 | } | ||
214 | return -ENOMEM; | ||
215 | } | ||
216 | s->SG_length = 0; | ||
217 | if (ivtv_might_use_dma(s)) { | ||
206 | s->SG_handle = pci_map_single(itv->dev, s->SGarray, SGsize, s->dma); | 218 | s->SG_handle = pci_map_single(itv->dev, s->SGarray, SGsize, s->dma); |
207 | ivtv_stream_sync_for_cpu(s); | 219 | ivtv_stream_sync_for_cpu(s); |
208 | } | 220 | } |
@@ -219,7 +231,7 @@ int ivtv_stream_alloc(struct ivtv_stream *s) | |||
219 | break; | 231 | break; |
220 | } | 232 | } |
221 | INIT_LIST_HEAD(&buf->list); | 233 | INIT_LIST_HEAD(&buf->list); |
222 | if (s->dma != PCI_DMA_NONE) { | 234 | if (ivtv_might_use_dma(s)) { |
223 | buf->dma_handle = pci_map_single(s->itv->dev, | 235 | buf->dma_handle = pci_map_single(s->itv->dev, |
224 | buf->buf, s->buf_size + 256, s->dma); | 236 | buf->buf, s->buf_size + 256, s->dma); |
225 | ivtv_buf_sync_for_cpu(s, buf); | 237 | ivtv_buf_sync_for_cpu(s, buf); |
@@ -242,7 +254,7 @@ void ivtv_stream_free(struct ivtv_stream *s) | |||
242 | 254 | ||
243 | /* empty q_free */ | 255 | /* empty q_free */ |
244 | while ((buf = ivtv_dequeue(s, &s->q_free))) { | 256 | while ((buf = ivtv_dequeue(s, &s->q_free))) { |
245 | if (s->dma != PCI_DMA_NONE) | 257 | if (ivtv_might_use_dma(s)) |
246 | pci_unmap_single(s->itv->dev, buf->dma_handle, | 258 | pci_unmap_single(s->itv->dev, buf->dma_handle, |
247 | s->buf_size + 256, s->dma); | 259 | s->buf_size + 256, s->dma); |
248 | kfree(buf->buf); | 260 | kfree(buf->buf); |
@@ -256,6 +268,9 @@ void ivtv_stream_free(struct ivtv_stream *s) | |||
256 | sizeof(struct ivtv_SG_element) * s->buffers, PCI_DMA_TODEVICE); | 268 | sizeof(struct ivtv_SG_element) * s->buffers, PCI_DMA_TODEVICE); |
257 | s->SG_handle = IVTV_DMA_UNMAPPED; | 269 | s->SG_handle = IVTV_DMA_UNMAPPED; |
258 | } | 270 | } |
271 | kfree(s->SGarray); | ||
272 | kfree(s->PIOarray); | ||
273 | s->PIOarray = NULL; | ||
259 | s->SGarray = NULL; | 274 | s->SGarray = NULL; |
260 | s->SG_length = 0; | 275 | s->SG_length = 0; |
261 | } | 276 | } |
diff --git a/drivers/media/video/ivtv/ivtv-queue.h b/drivers/media/video/ivtv/ivtv-queue.h index 903edd4b4381..2ed8d548255d 100644 --- a/drivers/media/video/ivtv/ivtv-queue.h +++ b/drivers/media/video/ivtv/ivtv-queue.h | |||
@@ -20,18 +20,43 @@ | |||
20 | */ | 20 | */ |
21 | 21 | ||
22 | #define IVTV_DMA_UNMAPPED ((u32) -1) | 22 | #define IVTV_DMA_UNMAPPED ((u32) -1) |
23 | #define SLICED_VBI_PIO 1 | ||
23 | 24 | ||
24 | /* ivtv_buffer utility functions */ | 25 | /* ivtv_buffer utility functions */ |
26 | |||
27 | static inline int ivtv_might_use_pio(struct ivtv_stream *s) | ||
28 | { | ||
29 | return s->dma == PCI_DMA_NONE || (SLICED_VBI_PIO && s->type == IVTV_ENC_STREAM_TYPE_VBI); | ||
30 | } | ||
31 | |||
32 | static inline int ivtv_use_pio(struct ivtv_stream *s) | ||
33 | { | ||
34 | struct ivtv *itv = s->itv; | ||
35 | |||
36 | return s->dma == PCI_DMA_NONE || | ||
37 | (SLICED_VBI_PIO && s->type == IVTV_ENC_STREAM_TYPE_VBI && itv->vbi.sliced_in->service_set); | ||
38 | } | ||
39 | |||
40 | static inline int ivtv_might_use_dma(struct ivtv_stream *s) | ||
41 | { | ||
42 | return s->dma != PCI_DMA_NONE; | ||
43 | } | ||
44 | |||
45 | static inline int ivtv_use_dma(struct ivtv_stream *s) | ||
46 | { | ||
47 | return !ivtv_use_pio(s); | ||
48 | } | ||
49 | |||
25 | static inline void ivtv_buf_sync_for_cpu(struct ivtv_stream *s, struct ivtv_buffer *buf) | 50 | static inline void ivtv_buf_sync_for_cpu(struct ivtv_stream *s, struct ivtv_buffer *buf) |
26 | { | 51 | { |
27 | if (s->dma != PCI_DMA_NONE) | 52 | if (ivtv_use_dma(s)) |
28 | pci_dma_sync_single_for_cpu(s->itv->dev, buf->dma_handle, | 53 | pci_dma_sync_single_for_cpu(s->itv->dev, buf->dma_handle, |
29 | s->buf_size + 256, s->dma); | 54 | s->buf_size + 256, s->dma); |
30 | } | 55 | } |
31 | 56 | ||
32 | static inline void ivtv_buf_sync_for_device(struct ivtv_stream *s, struct ivtv_buffer *buf) | 57 | static inline void ivtv_buf_sync_for_device(struct ivtv_stream *s, struct ivtv_buffer *buf) |
33 | { | 58 | { |
34 | if (s->dma != PCI_DMA_NONE) | 59 | if (ivtv_use_dma(s)) |
35 | pci_dma_sync_single_for_device(s->itv->dev, buf->dma_handle, | 60 | pci_dma_sync_single_for_device(s->itv->dev, buf->dma_handle, |
36 | s->buf_size + 256, s->dma); | 61 | s->buf_size + 256, s->dma); |
37 | } | 62 | } |
@@ -53,12 +78,14 @@ void ivtv_stream_free(struct ivtv_stream *s); | |||
53 | 78 | ||
54 | static inline void ivtv_stream_sync_for_cpu(struct ivtv_stream *s) | 79 | static inline void ivtv_stream_sync_for_cpu(struct ivtv_stream *s) |
55 | { | 80 | { |
56 | pci_dma_sync_single_for_cpu(s->itv->dev, s->SG_handle, | 81 | if (ivtv_use_dma(s)) |
57 | sizeof(struct ivtv_SG_element) * s->buffers, PCI_DMA_TODEVICE); | 82 | pci_dma_sync_single_for_cpu(s->itv->dev, s->SG_handle, |
83 | sizeof(struct ivtv_SG_element) * s->buffers, PCI_DMA_TODEVICE); | ||
58 | } | 84 | } |
59 | 85 | ||
60 | static inline void ivtv_stream_sync_for_device(struct ivtv_stream *s) | 86 | static inline void ivtv_stream_sync_for_device(struct ivtv_stream *s) |
61 | { | 87 | { |
62 | pci_dma_sync_single_for_device(s->itv->dev, s->SG_handle, | 88 | if (ivtv_use_dma(s)) |
63 | sizeof(struct ivtv_SG_element) * s->buffers, PCI_DMA_TODEVICE); | 89 | pci_dma_sync_single_for_device(s->itv->dev, s->SG_handle, |
90 | sizeof(struct ivtv_SG_element) * s->buffers, PCI_DMA_TODEVICE); | ||
64 | } | 91 | } |
diff --git a/drivers/media/video/ivtv/ivtv-streams.c b/drivers/media/video/ivtv/ivtv-streams.c index 01a41a844a30..6af88ae9295f 100644 --- a/drivers/media/video/ivtv/ivtv-streams.c +++ b/drivers/media/video/ivtv/ivtv-streams.c | |||
@@ -868,7 +868,7 @@ int ivtv_stop_v4l2_decode_stream(struct ivtv_stream *s, int flags, u64 pts) | |||
868 | if (!test_bit(IVTV_F_S_STREAMING, &s->s_flags)) | 868 | if (!test_bit(IVTV_F_S_STREAMING, &s->s_flags)) |
869 | return 0; | 869 | return 0; |
870 | 870 | ||
871 | IVTV_DEBUG_INFO("Stop Decode at %llu, flags: %x\n", pts, flags); | 871 | IVTV_DEBUG_INFO("Stop Decode at %llu, flags: %x\n", (unsigned long long)pts, flags); |
872 | 872 | ||
873 | /* Stop Decoder */ | 873 | /* Stop Decoder */ |
874 | if (!(flags & VIDEO_CMD_STOP_IMMEDIATELY) || pts) { | 874 | if (!(flags & VIDEO_CMD_STOP_IMMEDIATELY) || pts) { |
diff --git a/drivers/media/video/ivtv/ivtv-vbi.c b/drivers/media/video/ivtv/ivtv-vbi.c index 5efa5a867818..3ba46e07ea1f 100644 --- a/drivers/media/video/ivtv/ivtv-vbi.c +++ b/drivers/media/video/ivtv/ivtv-vbi.c | |||
@@ -450,7 +450,7 @@ void ivtv_disable_vbi(struct ivtv *itv) | |||
450 | } | 450 | } |
451 | 451 | ||
452 | 452 | ||
453 | void vbi_work_handler(struct ivtv *itv) | 453 | void ivtv_vbi_work_handler(struct ivtv *itv) |
454 | { | 454 | { |
455 | struct v4l2_sliced_vbi_data data; | 455 | struct v4l2_sliced_vbi_data data; |
456 | 456 | ||
diff --git a/drivers/media/video/ivtv/ivtv-vbi.h b/drivers/media/video/ivtv/ivtv-vbi.h index cdaea697b3ec..ec211b49702c 100644 --- a/drivers/media/video/ivtv/ivtv-vbi.h +++ b/drivers/media/video/ivtv/ivtv-vbi.h | |||
@@ -23,4 +23,4 @@ void ivtv_process_vbi_data(struct ivtv *itv, struct ivtv_buffer *buf, | |||
23 | int ivtv_used_line(struct ivtv *itv, int line, int field); | 23 | int ivtv_used_line(struct ivtv *itv, int line, int field); |
24 | void ivtv_disable_vbi(struct ivtv *itv); | 24 | void ivtv_disable_vbi(struct ivtv *itv); |
25 | void ivtv_set_vbi(unsigned long arg); | 25 | void ivtv_set_vbi(unsigned long arg); |
26 | void vbi_work_handler(struct ivtv *itv); | 26 | void ivtv_vbi_work_handler(struct ivtv *itv); |
diff --git a/drivers/media/video/saa7111.c b/drivers/media/video/saa7111.c index 74839f98b7c4..c1a392e47170 100644 --- a/drivers/media/video/saa7111.c +++ b/drivers/media/video/saa7111.c | |||
@@ -75,10 +75,6 @@ struct saa7111 { | |||
75 | int norm; | 75 | int norm; |
76 | int input; | 76 | int input; |
77 | int enable; | 77 | int enable; |
78 | int bright; | ||
79 | int contrast; | ||
80 | int hue; | ||
81 | int sat; | ||
82 | }; | 78 | }; |
83 | 79 | ||
84 | #define I2C_SAA7111 0x48 | 80 | #define I2C_SAA7111 0x48 |
@@ -96,6 +92,17 @@ saa7111_write (struct i2c_client *client, | |||
96 | return i2c_smbus_write_byte_data(client, reg, value); | 92 | return i2c_smbus_write_byte_data(client, reg, value); |
97 | } | 93 | } |
98 | 94 | ||
95 | static inline void | ||
96 | saa7111_write_if_changed(struct i2c_client *client, u8 reg, u8 value) | ||
97 | { | ||
98 | struct saa7111 *decoder = i2c_get_clientdata(client); | ||
99 | |||
100 | if (decoder->reg[reg] != value) { | ||
101 | decoder->reg[reg] = value; | ||
102 | i2c_smbus_write_byte_data(client, reg, value); | ||
103 | } | ||
104 | } | ||
105 | |||
99 | static int | 106 | static int |
100 | saa7111_write_block (struct i2c_client *client, | 107 | saa7111_write_block (struct i2c_client *client, |
101 | const u8 *data, | 108 | const u8 *data, |
@@ -439,28 +446,14 @@ saa7111_command (struct i2c_client *client, | |||
439 | { | 446 | { |
440 | struct video_picture *pic = arg; | 447 | struct video_picture *pic = arg; |
441 | 448 | ||
442 | if (decoder->bright != pic->brightness) { | 449 | /* We want 0 to 255 we get 0-65535 */ |
443 | /* We want 0 to 255 we get 0-65535 */ | 450 | saa7111_write_if_changed(client, 0x0a, pic->brightness >> 8); |
444 | decoder->bright = pic->brightness; | 451 | /* We want 0 to 127 we get 0-65535 */ |
445 | saa7111_write(client, 0x0a, decoder->bright >> 8); | 452 | saa7111_write(client, 0x0b, pic->contrast >> 9); |
446 | } | 453 | /* We want 0 to 127 we get 0-65535 */ |
447 | if (decoder->contrast != pic->contrast) { | 454 | saa7111_write(client, 0x0c, pic->colour >> 9); |
448 | /* We want 0 to 127 we get 0-65535 */ | 455 | /* We want -128 to 127 we get 0-65535 */ |
449 | decoder->contrast = pic->contrast; | 456 | saa7111_write(client, 0x0d, (pic->hue - 32768) >> 8); |
450 | saa7111_write(client, 0x0b, | ||
451 | decoder->contrast >> 9); | ||
452 | } | ||
453 | if (decoder->sat != pic->colour) { | ||
454 | /* We want 0 to 127 we get 0-65535 */ | ||
455 | decoder->sat = pic->colour; | ||
456 | saa7111_write(client, 0x0c, decoder->sat >> 9); | ||
457 | } | ||
458 | if (decoder->hue != pic->hue) { | ||
459 | /* We want -128 to 127 we get 0-65535 */ | ||
460 | decoder->hue = pic->hue; | ||
461 | saa7111_write(client, 0x0d, | ||
462 | (decoder->hue - 32768) >> 8); | ||
463 | } | ||
464 | } | 457 | } |
465 | break; | 458 | break; |
466 | 459 | ||
@@ -524,10 +517,6 @@ saa7111_detect_client (struct i2c_adapter *adapter, | |||
524 | decoder->norm = VIDEO_MODE_NTSC; | 517 | decoder->norm = VIDEO_MODE_NTSC; |
525 | decoder->input = 0; | 518 | decoder->input = 0; |
526 | decoder->enable = 1; | 519 | decoder->enable = 1; |
527 | decoder->bright = 32768; | ||
528 | decoder->contrast = 32768; | ||
529 | decoder->hue = 32768; | ||
530 | decoder->sat = 32768; | ||
531 | i2c_set_clientdata(client, decoder); | 520 | i2c_set_clientdata(client, decoder); |
532 | 521 | ||
533 | i = i2c_attach_client(client); | 522 | i = i2c_attach_client(client); |
diff --git a/drivers/media/video/usbvision/usbvision-core.c b/drivers/media/video/usbvision/usbvision-core.c index 9118a6227ea6..7df071eb0a3b 100644 --- a/drivers/media/video/usbvision/usbvision-core.c +++ b/drivers/media/video/usbvision/usbvision-core.c | |||
@@ -1414,6 +1414,11 @@ static void usbvision_isocIrq(struct urb *urb) | |||
1414 | if (!USBVISION_IS_OPERATIONAL(usbvision)) | 1414 | if (!USBVISION_IS_OPERATIONAL(usbvision)) |
1415 | return; | 1415 | return; |
1416 | 1416 | ||
1417 | /* any urb with wrong status is ignored without acknowledgement */ | ||
1418 | if (urb->status == -ENOENT) { | ||
1419 | return; | ||
1420 | } | ||
1421 | |||
1417 | f = &usbvision->curFrame; | 1422 | f = &usbvision->curFrame; |
1418 | 1423 | ||
1419 | /* Manage streaming interruption */ | 1424 | /* Manage streaming interruption */ |
@@ -1436,18 +1441,21 @@ static void usbvision_isocIrq(struct urb *urb) | |||
1436 | if (usbvision->streaming == Stream_On) { | 1441 | if (usbvision->streaming == Stream_On) { |
1437 | 1442 | ||
1438 | /* If we collected enough data let's parse! */ | 1443 | /* If we collected enough data let's parse! */ |
1439 | if (scratch_len(usbvision) > USBVISION_HEADER_LENGTH) { /* 12 == header_length */ | 1444 | if ((scratch_len(usbvision) > USBVISION_HEADER_LENGTH) && |
1440 | /*If we don't have a frame we're current working on, complain */ | 1445 | (!list_empty(&(usbvision->inqueue))) ) { |
1441 | if(!list_empty(&(usbvision->inqueue))) { | 1446 | if (!(*f)) { |
1442 | if (!(*f)) { | 1447 | (*f) = list_entry(usbvision->inqueue.next, |
1443 | (*f) = list_entry(usbvision->inqueue.next,struct usbvision_frame, frame); | 1448 | struct usbvision_frame, |
1444 | } | 1449 | frame); |
1445 | usbvision_parse_data(usbvision); | ||
1446 | } | ||
1447 | else { | ||
1448 | PDEBUG(DBG_IRQ, "received data, but no one needs it"); | ||
1449 | scratch_reset(usbvision); | ||
1450 | } | 1450 | } |
1451 | usbvision_parse_data(usbvision); | ||
1452 | } | ||
1453 | else { | ||
1454 | /*If we don't have a frame | ||
1455 | we're current working on, complain */ | ||
1456 | PDEBUG(DBG_IRQ, | ||
1457 | "received data, but no one needs it"); | ||
1458 | scratch_reset(usbvision); | ||
1451 | } | 1459 | } |
1452 | } | 1460 | } |
1453 | else { | 1461 | else { |
@@ -1466,10 +1474,10 @@ static void usbvision_isocIrq(struct urb *urb) | |||
1466 | urb->dev = usbvision->dev; | 1474 | urb->dev = usbvision->dev; |
1467 | errCode = usb_submit_urb (urb, GFP_ATOMIC); | 1475 | errCode = usb_submit_urb (urb, GFP_ATOMIC); |
1468 | 1476 | ||
1469 | /* Disable this warning. By design of the driver. */ | 1477 | if(errCode) { |
1470 | // if(errCode) { | 1478 | err("%s: usb_submit_urb failed: error %d", |
1471 | // err("%s: usb_submit_urb failed: error %d", __FUNCTION__, errCode); | 1479 | __FUNCTION__, errCode); |
1472 | // } | 1480 | } |
1473 | 1481 | ||
1474 | return; | 1482 | return; |
1475 | } | 1483 | } |
@@ -2394,7 +2402,7 @@ int usbvision_init_isoc(struct usb_usbvision *usbvision) | |||
2394 | { | 2402 | { |
2395 | struct usb_device *dev = usbvision->dev; | 2403 | struct usb_device *dev = usbvision->dev; |
2396 | int bufIdx, errCode, regValue; | 2404 | int bufIdx, errCode, regValue; |
2397 | const int sb_size = USBVISION_URB_FRAMES * USBVISION_MAX_ISOC_PACKET_SIZE; | 2405 | int sb_size; |
2398 | 2406 | ||
2399 | if (!USBVISION_IS_OPERATIONAL(usbvision)) | 2407 | if (!USBVISION_IS_OPERATIONAL(usbvision)) |
2400 | return -EFAULT; | 2408 | return -EFAULT; |
@@ -2408,11 +2416,14 @@ int usbvision_init_isoc(struct usb_usbvision *usbvision) | |||
2408 | usbvision->last_error = errCode; | 2416 | usbvision->last_error = errCode; |
2409 | return -EBUSY; | 2417 | return -EBUSY; |
2410 | } | 2418 | } |
2419 | sb_size = USBVISION_URB_FRAMES * usbvision->isocPacketSize; | ||
2411 | 2420 | ||
2412 | regValue = (16 - usbvision_read_reg(usbvision, USBVISION_ALTER_REG)) & 0x0F; | 2421 | regValue = (16 - usbvision_read_reg(usbvision, |
2422 | USBVISION_ALTER_REG)) & 0x0F; | ||
2413 | 2423 | ||
2414 | usbvision->usb_bandwidth = regValue >> 1; | 2424 | usbvision->usb_bandwidth = regValue >> 1; |
2415 | PDEBUG(DBG_ISOC, "USB Bandwidth Usage: %dMbit/Sec", usbvision->usb_bandwidth); | 2425 | PDEBUG(DBG_ISOC, "USB Bandwidth Usage: %dMbit/Sec", |
2426 | usbvision->usb_bandwidth); | ||
2416 | 2427 | ||
2417 | 2428 | ||
2418 | 2429 | ||
@@ -2428,7 +2439,11 @@ int usbvision_init_isoc(struct usb_usbvision *usbvision) | |||
2428 | return -ENOMEM; | 2439 | return -ENOMEM; |
2429 | } | 2440 | } |
2430 | usbvision->sbuf[bufIdx].urb = urb; | 2441 | usbvision->sbuf[bufIdx].urb = urb; |
2431 | usbvision->sbuf[bufIdx].data = usb_buffer_alloc(usbvision->dev, sb_size, GFP_KERNEL,&urb->transfer_dma); | 2442 | usbvision->sbuf[bufIdx].data = |
2443 | usb_buffer_alloc(usbvision->dev, | ||
2444 | sb_size, | ||
2445 | GFP_KERNEL, | ||
2446 | &urb->transfer_dma); | ||
2432 | urb->dev = dev; | 2447 | urb->dev = dev; |
2433 | urb->context = usbvision; | 2448 | urb->context = usbvision; |
2434 | urb->pipe = usb_rcvisocpipe(dev, usbvision->video_endp); | 2449 | urb->pipe = usb_rcvisocpipe(dev, usbvision->video_endp); |
@@ -2442,21 +2457,26 @@ int usbvision_init_isoc(struct usb_usbvision *usbvision) | |||
2442 | for (j = k = 0; j < USBVISION_URB_FRAMES; j++, | 2457 | for (j = k = 0; j < USBVISION_URB_FRAMES; j++, |
2443 | k += usbvision->isocPacketSize) { | 2458 | k += usbvision->isocPacketSize) { |
2444 | urb->iso_frame_desc[j].offset = k; | 2459 | urb->iso_frame_desc[j].offset = k; |
2445 | urb->iso_frame_desc[j].length = usbvision->isocPacketSize; | 2460 | urb->iso_frame_desc[j].length = |
2461 | usbvision->isocPacketSize; | ||
2446 | } | 2462 | } |
2447 | } | 2463 | } |
2448 | 2464 | ||
2449 | 2465 | ||
2450 | /* Submit all URBs */ | 2466 | /* Submit all URBs */ |
2451 | for (bufIdx = 0; bufIdx < USBVISION_NUMSBUF; bufIdx++) { | 2467 | for (bufIdx = 0; bufIdx < USBVISION_NUMSBUF; bufIdx++) { |
2452 | errCode = usb_submit_urb(usbvision->sbuf[bufIdx].urb, GFP_KERNEL); | 2468 | errCode = usb_submit_urb(usbvision->sbuf[bufIdx].urb, |
2469 | GFP_KERNEL); | ||
2453 | if (errCode) { | 2470 | if (errCode) { |
2454 | err("%s: usb_submit_urb(%d) failed: error %d", __FUNCTION__, bufIdx, errCode); | 2471 | err("%s: usb_submit_urb(%d) failed: error %d", |
2472 | __FUNCTION__, bufIdx, errCode); | ||
2455 | } | 2473 | } |
2456 | } | 2474 | } |
2457 | 2475 | ||
2458 | usbvision->streaming = Stream_Idle; | 2476 | usbvision->streaming = Stream_Idle; |
2459 | PDEBUG(DBG_ISOC, "%s: streaming=1 usbvision->video_endp=$%02x", __FUNCTION__, usbvision->video_endp); | 2477 | PDEBUG(DBG_ISOC, "%s: streaming=1 usbvision->video_endp=$%02x", |
2478 | __FUNCTION__, | ||
2479 | usbvision->video_endp); | ||
2460 | return 0; | 2480 | return 0; |
2461 | } | 2481 | } |
2462 | 2482 | ||
@@ -2470,7 +2490,7 @@ int usbvision_init_isoc(struct usb_usbvision *usbvision) | |||
2470 | void usbvision_stop_isoc(struct usb_usbvision *usbvision) | 2490 | void usbvision_stop_isoc(struct usb_usbvision *usbvision) |
2471 | { | 2491 | { |
2472 | int bufIdx, errCode, regValue; | 2492 | int bufIdx, errCode, regValue; |
2473 | const int sb_size = USBVISION_URB_FRAMES * USBVISION_MAX_ISOC_PACKET_SIZE; | 2493 | int sb_size = USBVISION_URB_FRAMES * usbvision->isocPacketSize; |
2474 | 2494 | ||
2475 | if ((usbvision->streaming == Stream_Off) || (usbvision->dev == NULL)) | 2495 | if ((usbvision->streaming == Stream_Off) || (usbvision->dev == NULL)) |
2476 | return; | 2496 | return; |
@@ -2499,15 +2519,19 @@ void usbvision_stop_isoc(struct usb_usbvision *usbvision) | |||
2499 | errCode = usb_set_interface(usbvision->dev, usbvision->iface, | 2519 | errCode = usb_set_interface(usbvision->dev, usbvision->iface, |
2500 | usbvision->ifaceAlt); | 2520 | usbvision->ifaceAlt); |
2501 | if (errCode < 0) { | 2521 | if (errCode < 0) { |
2502 | err("%s: usb_set_interface() failed: error %d", __FUNCTION__, errCode); | 2522 | err("%s: usb_set_interface() failed: error %d", |
2523 | __FUNCTION__, errCode); | ||
2503 | usbvision->last_error = errCode; | 2524 | usbvision->last_error = errCode; |
2504 | } | 2525 | } |
2505 | regValue = (16 - usbvision_read_reg(usbvision, USBVISION_ALTER_REG)) & 0x0F; | 2526 | regValue = (16-usbvision_read_reg(usbvision, USBVISION_ALTER_REG)) & 0x0F; |
2506 | usbvision->isocPacketSize = (regValue == 0) ? 0 : (regValue * 64) - 1; | 2527 | usbvision->isocPacketSize = |
2507 | PDEBUG(DBG_ISOC, "ISO Packet Length:%d", usbvision->isocPacketSize); | 2528 | (regValue == 0) ? 0 : (regValue * 64) - 1; |
2529 | PDEBUG(DBG_ISOC, "ISO Packet Length:%d", | ||
2530 | usbvision->isocPacketSize); | ||
2508 | 2531 | ||
2509 | usbvision->usb_bandwidth = regValue >> 1; | 2532 | usbvision->usb_bandwidth = regValue >> 1; |
2510 | PDEBUG(DBG_ISOC, "USB Bandwidth Usage: %dMbit/Sec", usbvision->usb_bandwidth); | 2533 | PDEBUG(DBG_ISOC, "USB Bandwidth Usage: %dMbit/Sec", |
2534 | usbvision->usb_bandwidth); | ||
2511 | } | 2535 | } |
2512 | } | 2536 | } |
2513 | 2537 | ||
diff --git a/drivers/media/video/usbvision/usbvision.h b/drivers/media/video/usbvision/usbvision.h index bd6f6422ed54..c759d00d7014 100644 --- a/drivers/media/video/usbvision/usbvision.h +++ b/drivers/media/video/usbvision/usbvision.h | |||
@@ -146,7 +146,6 @@ | |||
146 | #define USBVISION_CLIPMASK_SIZE (MAX_FRAME_WIDTH * MAX_FRAME_HEIGHT / 8) //bytesize of clipmask | 146 | #define USBVISION_CLIPMASK_SIZE (MAX_FRAME_WIDTH * MAX_FRAME_HEIGHT / 8) //bytesize of clipmask |
147 | 147 | ||
148 | #define USBVISION_URB_FRAMES 32 | 148 | #define USBVISION_URB_FRAMES 32 |
149 | #define USBVISION_MAX_ISOC_PACKET_SIZE 959 // NT1003 Specs Document says 1023 | ||
150 | 149 | ||
151 | #define USBVISION_NUM_HEADERMARKER 20 | 150 | #define USBVISION_NUM_HEADERMARKER 20 |
152 | #define USBVISION_NUMFRAMES 3 /* Maximum number of frames an application can get */ | 151 | #define USBVISION_NUMFRAMES 3 /* Maximum number of frames an application can get */ |
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c index c1dfd03d559a..41bfb5dfe6ff 100644 --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/mmc/host.h> | 15 | #include <linux/mmc/host.h> |
16 | #include <linux/mmc/card.h> | 16 | #include <linux/mmc/card.h> |
17 | #include <linux/mmc/mmc.h> | 17 | #include <linux/mmc/mmc.h> |
18 | #include <linux/mmc/sd.h> | ||
18 | 19 | ||
19 | #include "core.h" | 20 | #include "core.h" |
20 | #include "sysfs.h" | 21 | #include "sysfs.h" |
@@ -192,6 +193,16 @@ static int mmc_read_switch(struct mmc_card *card) | |||
192 | int err; | 193 | int err; |
193 | u8 *status; | 194 | u8 *status; |
194 | 195 | ||
196 | if (card->scr.sda_vsn < SCR_SPEC_VER_1) | ||
197 | return MMC_ERR_NONE; | ||
198 | |||
199 | if (!(card->csd.cmdclass & CCC_SWITCH)) { | ||
200 | printk(KERN_WARNING "%s: card lacks mandatory switch " | ||
201 | "function, performance might suffer.\n", | ||
202 | mmc_hostname(card->host)); | ||
203 | return MMC_ERR_NONE; | ||
204 | } | ||
205 | |||
195 | err = MMC_ERR_FAILED; | 206 | err = MMC_ERR_FAILED; |
196 | 207 | ||
197 | status = kmalloc(64, GFP_KERNEL); | 208 | status = kmalloc(64, GFP_KERNEL); |
@@ -204,10 +215,9 @@ static int mmc_read_switch(struct mmc_card *card) | |||
204 | 215 | ||
205 | err = mmc_sd_switch(card, 0, 0, 1, status); | 216 | err = mmc_sd_switch(card, 0, 0, 1, status); |
206 | if (err != MMC_ERR_NONE) { | 217 | if (err != MMC_ERR_NONE) { |
207 | /* | 218 | printk(KERN_WARNING "%s: problem reading switch " |
208 | * Card not supporting high-speed will ignore the | 219 | "capabilities, performance might suffer.\n", |
209 | * command. | 220 | mmc_hostname(card->host)); |
210 | */ | ||
211 | err = MMC_ERR_NONE; | 221 | err = MMC_ERR_NONE; |
212 | goto out; | 222 | goto out; |
213 | } | 223 | } |
@@ -229,6 +239,12 @@ static int mmc_switch_hs(struct mmc_card *card) | |||
229 | int err; | 239 | int err; |
230 | u8 *status; | 240 | u8 *status; |
231 | 241 | ||
242 | if (card->scr.sda_vsn < SCR_SPEC_VER_1) | ||
243 | return MMC_ERR_NONE; | ||
244 | |||
245 | if (!(card->csd.cmdclass & CCC_SWITCH)) | ||
246 | return MMC_ERR_NONE; | ||
247 | |||
232 | if (!(card->host->caps & MMC_CAP_SD_HIGHSPEED)) | 248 | if (!(card->host->caps & MMC_CAP_SD_HIGHSPEED)) |
233 | return MMC_ERR_NONE; | 249 | return MMC_ERR_NONE; |
234 | 250 | ||
@@ -402,7 +418,7 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr, | |||
402 | /* | 418 | /* |
403 | * Switch to wider bus (if supported). | 419 | * Switch to wider bus (if supported). |
404 | */ | 420 | */ |
405 | if ((host->caps && MMC_CAP_4_BIT_DATA) && | 421 | if ((host->caps & MMC_CAP_4_BIT_DATA) && |
406 | (card->scr.bus_widths & SD_SCR_BUS_WIDTH_4)) { | 422 | (card->scr.bus_widths & SD_SCR_BUS_WIDTH_4)) { |
407 | err = mmc_app_set_bus_width(card, MMC_BUS_WIDTH_4); | 423 | err = mmc_app_set_bus_width(card, MMC_BUS_WIDTH_4); |
408 | if (err != MMC_ERR_NONE) | 424 | if (err != MMC_ERR_NONE) |
diff --git a/drivers/mmc/host/at91_mci.c b/drivers/mmc/host/at91_mci.c index e37943c314cb..5b00c194b628 100644 --- a/drivers/mmc/host/at91_mci.c +++ b/drivers/mmc/host/at91_mci.c | |||
@@ -417,7 +417,7 @@ static unsigned int at91_mci_send_command(struct at91mci_host *host, struct mmc_ | |||
417 | blocks = 0; | 417 | blocks = 0; |
418 | } | 418 | } |
419 | 419 | ||
420 | if (cmd->opcode == MMC_STOP_TRANSMISSION) | 420 | if (host->flags & FL_SENT_STOP) |
421 | cmdr |= AT91_MCI_TRCMD_STOP; | 421 | cmdr |= AT91_MCI_TRCMD_STOP; |
422 | 422 | ||
423 | if (host->bus_mode == MMC_BUSMODE_OPENDRAIN) | 423 | if (host->bus_mode == MMC_BUSMODE_OPENDRAIN) |
@@ -563,8 +563,7 @@ static void at91mci_completed_command(struct at91mci_host *host) | |||
563 | if (status & (AT91_MCI_RINDE | AT91_MCI_RDIRE | AT91_MCI_RCRCE | | 563 | if (status & (AT91_MCI_RINDE | AT91_MCI_RDIRE | AT91_MCI_RCRCE | |
564 | AT91_MCI_RENDE | AT91_MCI_RTOE | AT91_MCI_DCRCE | | 564 | AT91_MCI_RENDE | AT91_MCI_RTOE | AT91_MCI_DCRCE | |
565 | AT91_MCI_DTOE | AT91_MCI_OVRE | AT91_MCI_UNRE)) { | 565 | AT91_MCI_DTOE | AT91_MCI_OVRE | AT91_MCI_UNRE)) { |
566 | if ((status & AT91_MCI_RCRCE) && | 566 | if ((status & AT91_MCI_RCRCE) && !(mmc_resp_type(cmd) & MMC_RSP_CRC)) { |
567 | ((cmd->opcode == MMC_SEND_OP_COND) || (cmd->opcode == SD_APP_OP_COND))) { | ||
568 | cmd->error = MMC_ERR_NONE; | 567 | cmd->error = MMC_ERR_NONE; |
569 | } | 568 | } |
570 | else { | 569 | else { |
diff --git a/drivers/mmc/host/au1xmmc.c b/drivers/mmc/host/au1xmmc.c index f967226d7505..52b63f11ddd6 100644 --- a/drivers/mmc/host/au1xmmc.c +++ b/drivers/mmc/host/au1xmmc.c | |||
@@ -76,8 +76,7 @@ const struct { | |||
76 | #endif | 76 | #endif |
77 | }; | 77 | }; |
78 | 78 | ||
79 | #define AU1XMMC_CONTROLLER_COUNT \ | 79 | #define AU1XMMC_CONTROLLER_COUNT (ARRAY_SIZE(au1xmmc_card_table)) |
80 | (sizeof(au1xmmc_card_table) / sizeof(au1xmmc_card_table[0])) | ||
81 | 80 | ||
82 | /* This array stores pointers for the hosts (used by the IRQ handler) */ | 81 | /* This array stores pointers for the hosts (used by the IRQ handler) */ |
83 | struct au1xmmc_host *au1xmmc_hosts[AU1XMMC_CONTROLLER_COUNT]; | 82 | struct au1xmmc_host *au1xmmc_hosts[AU1XMMC_CONTROLLER_COUNT]; |
diff --git a/drivers/net/mlx4/cq.c b/drivers/net/mlx4/cq.c index 437d78ad0912..39253d0c1590 100644 --- a/drivers/net/mlx4/cq.c +++ b/drivers/net/mlx4/cq.c | |||
@@ -61,7 +61,7 @@ struct mlx4_cq_context { | |||
61 | __be32 solicit_producer_index; | 61 | __be32 solicit_producer_index; |
62 | __be32 consumer_index; | 62 | __be32 consumer_index; |
63 | __be32 producer_index; | 63 | __be32 producer_index; |
64 | u8 reserved6[2]; | 64 | u32 reserved6[2]; |
65 | __be64 db_rec_addr; | 65 | __be64 db_rec_addr; |
66 | }; | 66 | }; |
67 | 67 | ||
diff --git a/drivers/net/mlx4/eq.c b/drivers/net/mlx4/eq.c index 0f11adb8eb4a..27a82cecd693 100644 --- a/drivers/net/mlx4/eq.c +++ b/drivers/net/mlx4/eq.c | |||
@@ -490,9 +490,11 @@ static void mlx4_free_irqs(struct mlx4_dev *dev) | |||
490 | 490 | ||
491 | if (eq_table->have_irq) | 491 | if (eq_table->have_irq) |
492 | free_irq(dev->pdev->irq, dev); | 492 | free_irq(dev->pdev->irq, dev); |
493 | for (i = 0; i < MLX4_NUM_EQ; ++i) | 493 | for (i = 0; i < MLX4_EQ_CATAS; ++i) |
494 | if (eq_table->eq[i].have_irq) | 494 | if (eq_table->eq[i].have_irq) |
495 | free_irq(eq_table->eq[i].irq, eq_table->eq + i); | 495 | free_irq(eq_table->eq[i].irq, eq_table->eq + i); |
496 | if (eq_table->eq[MLX4_EQ_CATAS].have_irq) | ||
497 | free_irq(eq_table->eq[MLX4_EQ_CATAS].irq, dev); | ||
496 | } | 498 | } |
497 | 499 | ||
498 | static int __devinit mlx4_map_clr_int(struct mlx4_dev *dev) | 500 | static int __devinit mlx4_map_clr_int(struct mlx4_dev *dev) |
diff --git a/drivers/net/mlx4/fw.c b/drivers/net/mlx4/fw.c index cfa5cc072339..e7ca118c8dfd 100644 --- a/drivers/net/mlx4/fw.c +++ b/drivers/net/mlx4/fw.c | |||
@@ -37,6 +37,10 @@ | |||
37 | #include "fw.h" | 37 | #include "fw.h" |
38 | #include "icm.h" | 38 | #include "icm.h" |
39 | 39 | ||
40 | enum { | ||
41 | MLX4_COMMAND_INTERFACE_REV = 1 | ||
42 | }; | ||
43 | |||
40 | extern void __buggy_use_of_MLX4_GET(void); | 44 | extern void __buggy_use_of_MLX4_GET(void); |
41 | extern void __buggy_use_of_MLX4_PUT(void); | 45 | extern void __buggy_use_of_MLX4_PUT(void); |
42 | 46 | ||
@@ -452,10 +456,12 @@ int mlx4_QUERY_FW(struct mlx4_dev *dev) | |||
452 | u32 *outbox; | 456 | u32 *outbox; |
453 | int err = 0; | 457 | int err = 0; |
454 | u64 fw_ver; | 458 | u64 fw_ver; |
459 | u16 cmd_if_rev; | ||
455 | u8 lg; | 460 | u8 lg; |
456 | 461 | ||
457 | #define QUERY_FW_OUT_SIZE 0x100 | 462 | #define QUERY_FW_OUT_SIZE 0x100 |
458 | #define QUERY_FW_VER_OFFSET 0x00 | 463 | #define QUERY_FW_VER_OFFSET 0x00 |
464 | #define QUERY_FW_CMD_IF_REV_OFFSET 0x0a | ||
459 | #define QUERY_FW_MAX_CMD_OFFSET 0x0f | 465 | #define QUERY_FW_MAX_CMD_OFFSET 0x0f |
460 | #define QUERY_FW_ERR_START_OFFSET 0x30 | 466 | #define QUERY_FW_ERR_START_OFFSET 0x30 |
461 | #define QUERY_FW_ERR_SIZE_OFFSET 0x38 | 467 | #define QUERY_FW_ERR_SIZE_OFFSET 0x38 |
@@ -477,21 +483,36 @@ int mlx4_QUERY_FW(struct mlx4_dev *dev) | |||
477 | 483 | ||
478 | MLX4_GET(fw_ver, outbox, QUERY_FW_VER_OFFSET); | 484 | MLX4_GET(fw_ver, outbox, QUERY_FW_VER_OFFSET); |
479 | /* | 485 | /* |
480 | * FW subminor version is at more signifant bits than minor | 486 | * FW subminor version is at more significant bits than minor |
481 | * version, so swap here. | 487 | * version, so swap here. |
482 | */ | 488 | */ |
483 | dev->caps.fw_ver = (fw_ver & 0xffff00000000ull) | | 489 | dev->caps.fw_ver = (fw_ver & 0xffff00000000ull) | |
484 | ((fw_ver & 0xffff0000ull) >> 16) | | 490 | ((fw_ver & 0xffff0000ull) >> 16) | |
485 | ((fw_ver & 0x0000ffffull) << 16); | 491 | ((fw_ver & 0x0000ffffull) << 16); |
486 | 492 | ||
493 | MLX4_GET(cmd_if_rev, outbox, QUERY_FW_CMD_IF_REV_OFFSET); | ||
494 | if (cmd_if_rev != MLX4_COMMAND_INTERFACE_REV) { | ||
495 | mlx4_err(dev, "Installed FW has unsupported " | ||
496 | "command interface revision %d.\n", | ||
497 | cmd_if_rev); | ||
498 | mlx4_err(dev, "(Installed FW version is %d.%d.%03d)\n", | ||
499 | (int) (dev->caps.fw_ver >> 32), | ||
500 | (int) (dev->caps.fw_ver >> 16) & 0xffff, | ||
501 | (int) dev->caps.fw_ver & 0xffff); | ||
502 | mlx4_err(dev, "This driver version supports only revision %d.\n", | ||
503 | MLX4_COMMAND_INTERFACE_REV); | ||
504 | err = -ENODEV; | ||
505 | goto out; | ||
506 | } | ||
507 | |||
487 | MLX4_GET(lg, outbox, QUERY_FW_MAX_CMD_OFFSET); | 508 | MLX4_GET(lg, outbox, QUERY_FW_MAX_CMD_OFFSET); |
488 | cmd->max_cmds = 1 << lg; | 509 | cmd->max_cmds = 1 << lg; |
489 | 510 | ||
490 | mlx4_dbg(dev, "FW version %d.%d.%03d, max commands %d\n", | 511 | mlx4_dbg(dev, "FW version %d.%d.%03d (cmd intf rev %d), max commands %d\n", |
491 | (int) (dev->caps.fw_ver >> 32), | 512 | (int) (dev->caps.fw_ver >> 32), |
492 | (int) (dev->caps.fw_ver >> 16) & 0xffff, | 513 | (int) (dev->caps.fw_ver >> 16) & 0xffff, |
493 | (int) dev->caps.fw_ver & 0xffff, | 514 | (int) dev->caps.fw_ver & 0xffff, |
494 | cmd->max_cmds); | 515 | cmd_if_rev, cmd->max_cmds); |
495 | 516 | ||
496 | MLX4_GET(fw->catas_offset, outbox, QUERY_FW_ERR_START_OFFSET); | 517 | MLX4_GET(fw->catas_offset, outbox, QUERY_FW_ERR_START_OFFSET); |
497 | MLX4_GET(fw->catas_size, outbox, QUERY_FW_ERR_SIZE_OFFSET); | 518 | MLX4_GET(fw->catas_size, outbox, QUERY_FW_ERR_SIZE_OFFSET); |
diff --git a/drivers/net/mlx4/intf.c b/drivers/net/mlx4/intf.c index 65854f9e9c76..9ae951bf6aa6 100644 --- a/drivers/net/mlx4/intf.c +++ b/drivers/net/mlx4/intf.c | |||
@@ -135,9 +135,6 @@ int mlx4_register_device(struct mlx4_dev *dev) | |||
135 | struct mlx4_priv *priv = mlx4_priv(dev); | 135 | struct mlx4_priv *priv = mlx4_priv(dev); |
136 | struct mlx4_interface *intf; | 136 | struct mlx4_interface *intf; |
137 | 137 | ||
138 | INIT_LIST_HEAD(&priv->ctx_list); | ||
139 | spin_lock_init(&priv->ctx_lock); | ||
140 | |||
141 | mutex_lock(&intf_mutex); | 138 | mutex_lock(&intf_mutex); |
142 | 139 | ||
143 | list_add_tail(&priv->dev_list, &dev_list); | 140 | list_add_tail(&priv->dev_list, &dev_list); |
diff --git a/drivers/net/mlx4/main.c b/drivers/net/mlx4/main.c index 20b8c0d3ced4..d4172937025b 100644 --- a/drivers/net/mlx4/main.c +++ b/drivers/net/mlx4/main.c | |||
@@ -787,6 +787,8 @@ static int __devinit mlx4_init_one(struct pci_dev *pdev, | |||
787 | 787 | ||
788 | dev = &priv->dev; | 788 | dev = &priv->dev; |
789 | dev->pdev = pdev; | 789 | dev->pdev = pdev; |
790 | INIT_LIST_HEAD(&priv->ctx_list); | ||
791 | spin_lock_init(&priv->ctx_lock); | ||
790 | 792 | ||
791 | /* | 793 | /* |
792 | * Now reset the HCA before we touch the PCI capabilities or | 794 | * Now reset the HCA before we touch the PCI capabilities or |
diff --git a/drivers/net/mlx4/mr.c b/drivers/net/mlx4/mr.c index b33864dab179..d0808fa3ec82 100644 --- a/drivers/net/mlx4/mr.c +++ b/drivers/net/mlx4/mr.c | |||
@@ -324,15 +324,17 @@ int mlx4_mr_enable(struct mlx4_dev *dev, struct mlx4_mr *mr) | |||
324 | MLX4_MPT_FLAG_MIO | | 324 | MLX4_MPT_FLAG_MIO | |
325 | MLX4_MPT_FLAG_REGION | | 325 | MLX4_MPT_FLAG_REGION | |
326 | mr->access); | 326 | mr->access); |
327 | if (mr->mtt.order < 0) | ||
328 | mpt_entry->flags |= cpu_to_be32(MLX4_MPT_FLAG_PHYSICAL); | ||
329 | 327 | ||
330 | mpt_entry->key = cpu_to_be32(key_to_hw_index(mr->key)); | 328 | mpt_entry->key = cpu_to_be32(key_to_hw_index(mr->key)); |
331 | mpt_entry->pd = cpu_to_be32(mr->pd); | 329 | mpt_entry->pd = cpu_to_be32(mr->pd); |
332 | mpt_entry->start = cpu_to_be64(mr->iova); | 330 | mpt_entry->start = cpu_to_be64(mr->iova); |
333 | mpt_entry->length = cpu_to_be64(mr->size); | 331 | mpt_entry->length = cpu_to_be64(mr->size); |
334 | mpt_entry->entity_size = cpu_to_be32(mr->mtt.page_shift); | 332 | mpt_entry->entity_size = cpu_to_be32(mr->mtt.page_shift); |
335 | mpt_entry->mtt_seg = cpu_to_be64(mlx4_mtt_addr(dev, &mr->mtt)); | 333 | if (mr->mtt.order < 0) { |
334 | mpt_entry->flags |= cpu_to_be32(MLX4_MPT_FLAG_PHYSICAL); | ||
335 | mpt_entry->mtt_seg = 0; | ||
336 | } else | ||
337 | mpt_entry->mtt_seg = cpu_to_be64(mlx4_mtt_addr(dev, &mr->mtt)); | ||
336 | 338 | ||
337 | err = mlx4_SW2HW_MPT(dev, mailbox, | 339 | err = mlx4_SW2HW_MPT(dev, mailbox, |
338 | key_to_hw_index(mr->key) & (dev->caps.num_mpts - 1)); | 340 | key_to_hw_index(mr->key) & (dev->caps.num_mpts - 1)); |