Lines Matching +full:8 +full:- +full:ch

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
4 * Copyright (c) 1998 - 2008 Søren Schmidt <sos@FreeBSD.org>
45 #include <dev/ata/ata-all.h>
51 struct ata_channel *ch = device_get_softc(dev); in ata_sata_phy_check_events() local
54 if (ata_sata_scr_read(ch, port, ATA_SERROR, &error)) in ata_sata_phy_check_events()
63 ata_sata_scr_write(ch, port, ATA_SERROR, error); in ata_sata_phy_check_events()
66 if ((error & ATA_SE_PHY_CHANGED) && (ch->pm_level == 0)) { in ata_sata_phy_check_events()
68 if (ata_sata_scr_read(ch, port, ATA_SSTATUS, &status)) { in ata_sata_phy_check_events()
77 taskqueue_enqueue(taskqueue_thread, &ch->conntask); in ata_sata_phy_check_events()
82 ata_sata_scr_read(struct ata_channel *ch, int port, int reg, uint32_t *val) in ata_sata_scr_read() argument
85 if (ch->hw.pm_read != NULL) in ata_sata_scr_read()
86 return (ch->hw.pm_read(ch->dev, port, reg, val)); in ata_sata_scr_read()
87 if (ch->r_io[reg].res) { in ata_sata_scr_read()
88 *val = ATA_IDX_INL(ch, reg); in ata_sata_scr_read()
91 return (-1); in ata_sata_scr_read()
95 ata_sata_scr_write(struct ata_channel *ch, int port, int reg, uint32_t val) in ata_sata_scr_write() argument
98 if (ch->hw.pm_write != NULL) in ata_sata_scr_write()
99 return (ch->hw.pm_write(ch->dev, port, reg, val)); in ata_sata_scr_write()
100 if (ch->r_io[reg].res) { in ata_sata_scr_write()
101 ATA_IDX_OUTL(ch, reg, val); in ata_sata_scr_write()
104 return (-1); in ata_sata_scr_write()
108 ata_sata_connect(struct ata_channel *ch, int port, int quick) in ata_sata_connect() argument
117 if (ata_sata_scr_read(ch, port, ATA_SSTATUS, &status)) in ata_sata_connect()
130 device_printf(ch->dev, "SATA connect timeout status=%08x\n", in ata_sata_connect()
133 device_printf(ch->dev, "p%d: SATA connect timeout status=%08x\n", in ata_sata_connect()
137 device_printf(ch->dev, "SATA connect time=%dms status=%08x\n", in ata_sata_connect()
140 device_printf(ch->dev, "p%d: SATA connect time=%dms status=%08x\n", in ata_sata_connect()
146 ata_sata_scr_write(ch, port, ATA_SERROR, 0xffffffff); in ata_sata_connect()
154 struct ata_channel *ch = device_get_softc(dev); in ata_sata_phy_reset() local
158 sata_rev = ch->user[port < 0 ? 0 : port].revision; in ata_sata_phy_reset()
163 if (ata_sata_scr_read(ch, port, ATA_SCONTROL, &val)) in ata_sata_phy_reset()
166 ata_sata_scr_write(ch, port, ATA_SCONTROL, in ata_sata_phy_reset()
167 ATA_SC_DET_IDLE | ((ch->pm_level > 0) ? 0 : in ata_sata_phy_reset()
169 return ata_sata_connect(ch, port, quick); in ata_sata_phy_reset()
190 if (ata_sata_scr_write(ch, port, ATA_SCONTROL, ATA_SC_DET_RESET | in ata_sata_phy_reset()
194 if (ata_sata_scr_read(ch, port, ATA_SCONTROL, &val)) in ata_sata_phy_reset()
201 if (ata_sata_scr_write(ch, port, ATA_SCONTROL, in ata_sata_phy_reset()
202 ATA_SC_DET_IDLE | val1 | ((ch->pm_level > 0) ? 0 : in ata_sata_phy_reset()
206 if (ata_sata_scr_read(ch, port, ATA_SCONTROL, &val)) in ata_sata_phy_reset()
209 return ata_sata_connect(ch, port, 0); in ata_sata_phy_reset()
214 ata_sata_scr_write(ch, port, ATA_SERROR, 0xffffffff); in ata_sata_phy_reset()
236 struct ata_channel *ch = device_get_softc(dev); in ata_sata_getrev() local
238 if (ch->r_io[ATA_SSTATUS].res) in ata_sata_getrev()
239 return ((ATA_IDX_INL(ch, ATA_SSTATUS) & 0x0f0) >> 4); in ata_sata_getrev()
247 if (request->flags & ATA_R_ATAPI) { in ata_request2fis_h2d()
249 fis[1] = 0x80 | (request->unit & 0x0f); in ata_request2fis_h2d()
251 if (request->flags & (ATA_R_READ | ATA_R_WRITE)) in ata_request2fis_h2d()
254 fis[5] = request->transfersize; in ata_request2fis_h2d()
255 fis[6] = request->transfersize >> 8; in ata_request2fis_h2d()
263 fis[1] = 0x80 | (request->unit & 0x0f); in ata_request2fis_h2d()
264 fis[2] = request->u.ata.command; in ata_request2fis_h2d()
265 fis[3] = request->u.ata.feature; in ata_request2fis_h2d()
266 fis[4] = request->u.ata.lba; in ata_request2fis_h2d()
267 fis[5] = request->u.ata.lba >> 8; in ata_request2fis_h2d()
268 fis[6] = request->u.ata.lba >> 16; in ata_request2fis_h2d()
270 if (!(request->flags & ATA_R_48BIT)) in ata_request2fis_h2d()
271 fis[7] |= (ATA_D_IBM | (request->u.ata.lba >> 24 & 0x0f)); in ata_request2fis_h2d()
272 fis[8] = request->u.ata.lba >> 24; in ata_request2fis_h2d()
273 fis[9] = request->u.ata.lba >> 32; in ata_request2fis_h2d()
274 fis[10] = request->u.ata.lba >> 40; in ata_request2fis_h2d()
275 fis[11] = request->u.ata.feature >> 8; in ata_request2fis_h2d()
276 fis[12] = request->u.ata.count; in ata_request2fis_h2d()
277 fis[13] = request->u.ata.count >> 8; in ata_request2fis_h2d()
287 struct ata_channel *ch = device_get_softc(dev); in ata_pm_identify() local
292 if (ch->hw.pm_read(dev, ATA_PM, 0, &pm_chipid)) { in ata_pm_identify()
298 if (ch->hw.pm_read(dev, ATA_PM, 1, &pm_revision)) { in ata_pm_identify()
304 if (ch->hw.pm_read(dev, ATA_PM, 2, &pm_ports)) { in ata_pm_identify()
351 signature = ch->hw.softreset(dev, port); in ata_pm_identify()
359 ch->devices |= (ATA_ATA_MASTER << port); in ata_pm_identify()
362 ch->devices |= (ATA_ATAPI_MASTER << port); in ata_pm_identify()