static int marvell_pre_reset(struct ata_link *link, unsigned long deadline) { struct ata_port *ap = link->ap; struct pci_dev *pdev = to_pci_dev(ap->host->dev); u32 devices; void __iomem *barp; int i; /* Check if our port is enabled */ barp = pci_iomap(pdev, 5, 0x10); if (barp == NULL) return -ENOMEM; printk("BAR5:"); for(i = 0; i <= 0x0F; i++) printk("%02X:%02X ", i, ioread8(barp + i)); printk("\n"); devices = ioread32(barp + 0x0C); pci_iounmap(pdev, barp); if ((pdev->device == 0x6145) && (ap->port_no == 0) && (!(devices & 0x10))) /* PATA enable ? */ return -ENOENT; return ata_std_prereset(link, deadline); }
static int pacpi_pre_reset(struct ata_link *link, unsigned long deadline) { struct ata_port *ap = link->ap; struct pata_acpi *acpi = ap->private_data; if (ap->acpi_handle == NULL || ata_acpi_gtm(ap, &acpi->gtm) < 0) return -ENODEV; return ata_std_prereset(link, deadline); }
static int phison_pre_reset(struct ata_link *link, unsigned long deadline) { int ret; struct ata_port *ap = link->ap; ap->cbl = ATA_CBL_NONE; ret = ata_std_prereset(link, deadline); dev_dbg(ap->dev, "phison_pre_reset(), ret = %x\n", ret); return ret; }
static int ns87410_pre_reset(struct ata_port *ap, unsigned long deadline) { struct pci_dev *pdev = to_pci_dev(ap->host->dev); static const struct pci_bits ns87410_enable_bits[] = { { 0x43, 1, 0x08, 0x08 }, { 0x47, 1, 0x08, 0x08 } }; if (!pci_test_config_bits(pdev, &ns87410_enable_bits[ap->port_no])) return -ENOENT; return ata_std_prereset(ap, deadline); }
static int opti_pre_reset(struct ata_port *ap, unsigned long deadline) { struct pci_dev *pdev = to_pci_dev(ap->host->dev); static const struct pci_bits opti_enable_bits[] = { { 0x45, 1, 0x80, 0x00 }, { 0x40, 1, 0x08, 0x00 } }; if (!pci_test_config_bits(pdev, &opti_enable_bits[ap->port_no])) return -ENOENT; return ata_std_prereset(ap, deadline); }
static int ns87410_pre_reset(struct ata_port *ap) { struct pci_dev *pdev = to_pci_dev(ap->host->dev); static const struct pci_bits ns87410_enable_bits[] = { { 0x43, 1, 0x08, 0x08 }, { 0x47, 1, 0x08, 0x08 } }; if (!pci_test_config_bits(pdev, &ns87410_enable_bits[ap->port_no])) return -ENOENT; ap->cbl = ATA_CBL_PATA40; return ata_std_prereset(ap); }
static int artop6210_pre_reset(struct ata_port *ap) { struct pci_dev *pdev = to_pci_dev(ap->host->dev); const struct pci_bits artop_enable_bits[] = { { 0x4AU, 1U, 0x02UL, 0x02UL }, /* port 0 */ { 0x4AU, 1U, 0x04UL, 0x04UL }, /* port 1 */ }; if (!pci_test_config_bits(pdev, &artop_enable_bits[ap->port_no])) return -ENOENT; ap->cbl = ATA_CBL_PATA40; return ata_std_prereset(ap); }
static int triflex_prereset(struct ata_port *ap, unsigned long deadline) { static const struct pci_bits triflex_enable_bits[] = { { 0x80, 1, 0x01, 0x01 }, { 0x80, 1, 0x02, 0x02 } }; struct pci_dev *pdev = to_pci_dev(ap->host->dev); if (!pci_test_config_bits(pdev, &triflex_enable_bits[ap->port_no])) return -ENOENT; return ata_std_prereset(ap, deadline); }
static int opti_pre_reset(struct ata_port *ap) { struct pci_dev *pdev = to_pci_dev(ap->host->dev); static const struct pci_bits opti_enable_bits[] = { { 0x45, 1, 0x80, 0x00 }, { 0x40, 1, 0x08, 0x00 } }; if (!pci_test_config_bits(pdev, &opti_enable_bits[ap->port_no])) return -ENOENT; ap->cbl = ATA_CBL_PATA40; return ata_std_prereset(ap); }
static int artop6260_pre_reset(struct ata_port *ap) { static const struct pci_bits artop_enable_bits[] = { { 0x4AU, 1U, 0x02UL, 0x02UL }, /* port 0 */ { 0x4AU, 1U, 0x04UL, 0x04UL }, /* port 1 */ }; struct pci_dev *pdev = to_pci_dev(ap->host->dev); u8 tmp; /* Odd numbered device ids are the units with enable bits (the -R cards) */ if (pdev->device % 1 && !pci_test_config_bits(pdev, &artop_enable_bits[ap->port_no])) return -ENOENT; pci_read_config_byte(pdev, 0x49, &tmp); if (tmp & (1 << ap->port_no)) ap->cbl = ATA_CBL_PATA40; else ap->cbl = ATA_CBL_PATA80; return ata_std_prereset(ap); }
static int cs5530_pre_reset(struct ata_port *ap) { ap->cbl = ATA_CBL_PATA40; return ata_std_prereset(ap); }
static int jmicron_pre_reset(struct ata_port *ap, unsigned long deadline) { struct pci_dev *pdev = to_pci_dev(ap->host->dev); u32 control; u32 control5; int port_mask = 1<< (4 * ap->port_no); int port = ap->port_no; port_type port_map[2]; /* Check if our port is enabled */ pci_read_config_dword(pdev, 0x40, &control); if ((control & port_mask) == 0) return -ENOENT; /* There are two basic mappings. One has the two SATA ports merged as master/slave and the secondary as PATA, the other has only the SATA port mapped */ if (control & (1 << 23)) { port_map[0] = PORT_SATA; port_map[1] = PORT_PATA0; } else { port_map[0] = PORT_SATA; port_map[1] = PORT_SATA; } /* The 365/366 may have this bit set to map the second PATA port as the internal primary channel */ pci_read_config_dword(pdev, 0x80, &control5); if (control5 & (1<<24)) port_map[0] = PORT_PATA1; /* The two ports may then be logically swapped by the firmware */ if (control & (1 << 22)) port = port ^ 1; /* * Now we know which physical port we are talking about we can * actually do our cable checking etc. Thankfully we don't need * to do the plumbing for other cases. */ switch (port_map[port]) { case PORT_PATA0: if (control & (1 << 5)) return 0; if (control & (1 << 3)) /* 40/80 pin primary */ ap->cbl = ATA_CBL_PATA40; else ap->cbl = ATA_CBL_PATA80; break; case PORT_PATA1: /* Bit 21 is set if the port is enabled */ if ((control5 & (1 << 21)) == 0) return 0; if (control5 & (1 << 19)) /* 40/80 pin secondary */ ap->cbl = ATA_CBL_PATA40; else ap->cbl = ATA_CBL_PATA80; break; case PORT_SATA: ap->cbl = ATA_CBL_SATA; break; } return ata_std_prereset(ap, deadline); }
static int scc_pata_prereset (struct ata_port *ap) { ap->cbl = ATA_CBL_PATA80; return ata_std_prereset(ap); }
static int sil680_pre_reset(struct ata_link *link) { link->ap->cbl = sil680_cable_detect(link->ap); return ata_std_prereset(link); }
static int radisys_pre_reset(struct ata_port *ap) { ap->cbl = ATA_CBL_PATA80; return ata_std_prereset(ap); }
static int hpt3x3_probe_init(struct ata_link *link) { link->ap->cbl = ATA_CBL_PATA40; return ata_std_prereset(link); }