Lines Matching defs:chp
51 satapmp_read_8(struct ata_channel *chp, int port, int reg, uint64_t *value,
54 struct atac_softc *atac = chp->ch_atac;
60 KASSERT(chp->ch_ndrives >= PMP_MAX_DRIVES);
61 drvp = &chp->ch_drive[PMP_PORT_CTL];
63 ata_channel_lock_owned(chp);
74 ata_channel_unlock(chp);
77 ata_wait_cmd(chp, xfer);
80 aprint_error_dev(chp->atabus,
87 aprint_verbose_dev(chp->atabus,
100 ata_channel_lock(chp);
105 satapmp_read(struct ata_channel *chp, int port, int reg, uint32_t *value,
111 ret = satapmp_read_8(chp, port, reg, &value64, xfer);
120 satapmp_write_8(struct ata_channel *chp, int port, int reg, uint64_t value,
123 struct atac_softc *atac = chp->ch_atac;
129 KASSERT(chp->ch_ndrives >= PMP_MAX_DRIVES);
130 drvp = &chp->ch_drive[PMP_PORT_CTL];
132 ata_channel_lock_owned(chp);
147 ata_channel_unlock(chp);
150 ata_wait_cmd(chp, xfer);
153 aprint_error_dev(chp->atabus,
160 aprint_verbose_dev(chp->atabus,
168 ata_channel_lock(chp);
173 satapmp_write(struct ata_channel *chp, int port, int reg, uint32_t value,
176 return satapmp_write_8(chp, port, reg, value, xfer);
184 satapmp_reset_device_port(struct ata_channel *chp, int port,
190 ata_channel_lock_owned(chp);
194 if (satapmp_write(chp, port, PMP_PSCR_SControl, scontrol, xfer) != 0)
197 ata_delay(chp, 50, "sataup", AT_WAIT);
199 if (satapmp_write(chp, port, PMP_PSCR_SControl, scontrol, xfer) != 0)
201 ata_delay(chp, 50, "sataup", AT_WAIT);
206 if (satapmp_read(chp, port, PMP_PSCR_SStatus, &sstatus,
211 ata_delay(chp, 10, "sataup", AT_WAIT);
221 device_xname(chp->atabus), port);
225 device_xname(chp->atabus), port);
229 device_xname(chp->atabus), port, sata_speed(sstatus));
233 device_xname(chp->atabus), port, sstatus);
239 satapmp_rescan(struct ata_channel *chp, struct ata_xfer *xfer)
244 KASSERT(chp->ch_satapmp_nports <= PMP_PORT_CTL);
245 KASSERT(chp->ch_satapmp_nports <= chp->ch_ndrives);
246 ata_channel_lock_owned(chp);
248 for (i = 0; i < chp->ch_satapmp_nports; i++) {
249 if (chp->ch_drive[i].drive_type != ATA_DRIVET_NONE ||
250 satapmp_reset_device_port(chp, i, xfer)
254 if (satapmp_write(chp, i, PMP_PSCR_SError, 0xffffffff, xfer)
257 device_xname(chp->atabus), i);
261 ata_channel_lock_owned(chp);
262 chp->ch_atac->atac_bustype_ata->ata_reset_drive(
263 &chp->ch_drive[i], AT_WAIT, &sig);
265 sata_interpret_sig(chp, i, sig);
270 satapmp_attach(struct ata_channel *chp)
275 xfer = ata_get_xfer(chp, false);
277 aprint_normal_dev(chp->atabus, "no available xfer\n");
281 ata_channel_lock(chp);
283 if (satapmp_read(chp, PMP_PORT_CTL, PMP_GSCR_ID, &id, xfer) != 0 ||
284 satapmp_read(chp, PMP_PORT_CTL, PMP_GSCR_REV, &rev, xfer) != 0 ||
285 satapmp_read(chp, PMP_PORT_CTL, PMP_GSCR_INF, &inf, xfer) != 0) {
286 aprint_normal_dev(chp->atabus, "can't read PMP registers\n");
291 device_xname(chp->atabus),
292 device_xname(chp->ch_atac->atac_dev), chp->ch_channel,
294 aprint_verbose_dev(chp->atabus,
306 chp->ch_satapmp_nports = PMP_INF_NPORTS(inf);
309 satapmp_rescan(chp, xfer);
312 ata_channel_unlock(chp);
313 ata_free_xfer(chp, xfer);