Lines Matching +full:max +full:- +full:speed

1 // SPDX-License-Identifier: GPL-2.0-only
21 * ide_xfer_verbose - return IDE mode names
51 * ide_get_best_pio_mode - get PIO mode from drive
57 * based on the drive->id information and the ide_pio_blacklist[].
59 * Drive PIO mode is auto-selected if 255 is passed as mode_wanted.
60 * This is used by most chipset support modules when "auto-tuning".
65 u16 *id = drive->id; in ide_get_best_pio_mode()
66 int pio_mode = -1, overridden = 0; in ide_get_best_pio_mode()
71 if ((drive->hwif->host_flags & IDE_HFLAG_PIO_NO_BLACKLIST) == 0) in ide_get_best_pio_mode()
74 if (pio_mode != -1) { in ide_get_best_pio_mode()
75 printk(KERN_INFO "%s: is on PIO blacklist\n", drive->name); in ide_get_best_pio_mode()
102 drive->name); in ide_get_best_pio_mode()
117 if (pio == 0 && (drive->hwif->port_flags & IDE_PFLAG_PROBING)) in ide_pio_need_iordy()
119 return ata_id_pio_need_iordy(drive->id, pio); in ide_pio_need_iordy()
125 ide_hwif_t *hwif = drive->hwif; in ide_set_pio_mode()
126 const struct ide_port_ops *port_ops = hwif->port_ops; in ide_set_pio_mode()
128 if (hwif->host_flags & IDE_HFLAG_NO_SET_MODE) in ide_set_pio_mode()
131 if (port_ops == NULL || port_ops->set_pio_mode == NULL) in ide_set_pio_mode()
132 return -1; in ide_set_pio_mode()
136 * set transfer mode on the device in ->set_pio_mode method... in ide_set_pio_mode()
138 if (port_ops->set_dma_mode == NULL) { in ide_set_pio_mode()
139 drive->pio_mode = mode; in ide_set_pio_mode()
140 port_ops->set_pio_mode(hwif, drive); in ide_set_pio_mode()
144 if (hwif->host_flags & IDE_HFLAG_POST_SET_MODE) { in ide_set_pio_mode()
146 return -1; in ide_set_pio_mode()
147 drive->pio_mode = mode; in ide_set_pio_mode()
148 port_ops->set_pio_mode(hwif, drive); in ide_set_pio_mode()
151 drive->pio_mode = mode; in ide_set_pio_mode()
152 port_ops->set_pio_mode(hwif, drive); in ide_set_pio_mode()
159 ide_hwif_t *hwif = drive->hwif; in ide_set_dma_mode()
160 const struct ide_port_ops *port_ops = hwif->port_ops; in ide_set_dma_mode()
162 if (hwif->host_flags & IDE_HFLAG_NO_SET_MODE) in ide_set_dma_mode()
165 if (port_ops == NULL || port_ops->set_dma_mode == NULL) in ide_set_dma_mode()
166 return -1; in ide_set_dma_mode()
168 if (hwif->host_flags & IDE_HFLAG_POST_SET_MODE) { in ide_set_dma_mode()
170 return -1; in ide_set_dma_mode()
171 drive->dma_mode = mode; in ide_set_dma_mode()
172 port_ops->set_dma_mode(hwif, drive); in ide_set_dma_mode()
175 drive->dma_mode = mode; in ide_set_dma_mode()
176 port_ops->set_dma_mode(hwif, drive); in ide_set_dma_mode()
182 /* req_pio == "255" for auto-tune */
185 ide_hwif_t *hwif = drive->hwif; in ide_set_pio()
186 const struct ide_port_ops *port_ops = hwif->port_ops; in ide_set_pio()
189 if (port_ops == NULL || port_ops->set_pio_mode == NULL || in ide_set_pio()
190 (hwif->host_flags & IDE_HFLAG_NO_SET_MODE)) in ide_set_pio()
193 BUG_ON(hwif->pio_mask == 0x00); in ide_set_pio()
195 host_pio = fls(hwif->pio_mask) - 1; in ide_set_pio()
201 * - report device max PIO mode in ide_set_pio()
202 * - check req_pio != 255 against device max PIO mode in ide_set_pio()
204 printk(KERN_DEBUG "%s: host max PIO%d wanted PIO%d%s selected PIO%d\n", in ide_set_pio()
205 drive->name, host_pio, req_pio, in ide_set_pio()
206 req_pio == 255 ? "(auto-tune)" : "", pio); in ide_set_pio()
213 * ide_rate_filter - filter transfer mode
215 * @speed: desired speed
218 * the best available speed at or below the speed requested.
223 static u8 ide_rate_filter(ide_drive_t *drive, u8 speed) in ide_rate_filter() argument
225 ide_hwif_t *hwif = drive->hwif; in ide_rate_filter()
226 u8 mode = ide_find_dma_mode(drive, speed); in ide_rate_filter()
229 if (hwif->pio_mask) in ide_rate_filter()
230 mode = fls(hwif->pio_mask) - 1 + XFER_PIO_0; in ide_rate_filter()
235 /* printk("%s: mode 0x%02x, speed 0x%02x\n", __func__, mode, speed); */ in ide_rate_filter()
237 return min(speed, mode); in ide_rate_filter()
241 * ide_set_xfer_rate - set transfer rate
243 * @rate: speed to attempt to set
245 * General helper for setting the speed of an IDE device. This
247 * which ->set_pio_mode/->set_dma_mode does not.
252 ide_hwif_t *hwif = drive->hwif; in ide_set_xfer_rate()
253 const struct ide_port_ops *port_ops = hwif->port_ops; in ide_set_xfer_rate()
255 if (port_ops == NULL || port_ops->set_dma_mode == NULL || in ide_set_xfer_rate()
256 (hwif->host_flags & IDE_HFLAG_NO_SET_MODE)) in ide_set_xfer_rate()
257 return -1; in ide_set_xfer_rate()