Lines Matching refs:ch

52     struct ata_channel *ch = device_get_softc(dev);
55 if (ata_sata_scr_read(ch, port, ATA_SERROR, &error))
64 ata_sata_scr_write(ch, port, ATA_SERROR, error);
67 if ((error & ATA_SE_PHY_CHANGED) && (ch->pm_level == 0)) {
69 if (ata_sata_scr_read(ch, port, ATA_SSTATUS, &status)) {
78 taskqueue_enqueue(taskqueue_thread, &ch->conntask);
83 ata_sata_scr_read(struct ata_channel *ch, int port, int reg, uint32_t *val)
86 if (ch->hw.pm_read != NULL)
87 return (ch->hw.pm_read(ch->dev, port, reg, val));
88 if (ch->r_io[reg].res) {
89 *val = ATA_IDX_INL(ch, reg);
96 ata_sata_scr_write(struct ata_channel *ch, int port, int reg, uint32_t val)
99 if (ch->hw.pm_write != NULL)
100 return (ch->hw.pm_write(ch->dev, port, reg, val));
101 if (ch->r_io[reg].res) {
102 ATA_IDX_OUTL(ch, reg, val);
109 ata_sata_connect(struct ata_channel *ch, int port, int quick)
118 if (ata_sata_scr_read(ch, port, ATA_SSTATUS, &status))
131 device_printf(ch->dev, "SATA connect timeout status=%08x\n",
134 device_printf(ch->dev, "p%d: SATA connect timeout status=%08x\n",
138 device_printf(ch->dev, "SATA connect time=%dms status=%08x\n",
141 device_printf(ch->dev, "p%d: SATA connect time=%dms status=%08x\n",
147 ata_sata_scr_write(ch, port, ATA_SERROR, 0xffffffff);
155 struct ata_channel *ch = device_get_softc(dev);
159 sata_rev = ch->user[port < 0 ? 0 : port].revision;
164 if (ata_sata_scr_read(ch, port, ATA_SCONTROL, &val))
167 ata_sata_scr_write(ch, port, ATA_SCONTROL,
168 ATA_SC_DET_IDLE | ((ch->pm_level > 0) ? 0 :
170 return ata_sata_connect(ch, port, quick);
191 if (ata_sata_scr_write(ch, port, ATA_SCONTROL, ATA_SC_DET_RESET |
195 if (ata_sata_scr_read(ch, port, ATA_SCONTROL, &val))
202 if (ata_sata_scr_write(ch, port, ATA_SCONTROL,
203 ATA_SC_DET_IDLE | val1 | ((ch->pm_level > 0) ? 0 :
207 if (ata_sata_scr_read(ch, port, ATA_SCONTROL, &val))
210 return ata_sata_connect(ch, port, 0);
215 ata_sata_scr_write(ch, port, ATA_SERROR, 0xffffffff);
237 struct ata_channel *ch = device_get_softc(dev);
239 if (ch->r_io[ATA_SSTATUS].res)
240 return ((ATA_IDX_INL(ch, ATA_SSTATUS) & 0x0f0) >> 4);
288 struct ata_channel *ch = device_get_softc(dev);
293 if (ch->hw.pm_read(dev, ATA_PM, 0, &pm_chipid)) {
299 if (ch->hw.pm_read(dev, ATA_PM, 1, &pm_revision)) {
305 if (ch->hw.pm_read(dev, ATA_PM, 2, &pm_ports)) {
352 signature = ch->hw.softreset(dev, port);
360 ch->devices |= (ATA_ATA_MASTER << port);
363 ch->devices |= (ATA_ATAPI_MASTER << port);