Lines Matching +full:- +full:- +full:mode +full:- +full:-

1 // SPDX-License-Identifier: GPL-2.0-only
21 * ide_xfer_verbose - return IDE mode names
22 * @mode: transfer mode
24 * Returns a constant string giving the name of the mode
28 const char *ide_xfer_verbose(u8 mode) in ide_xfer_verbose() argument
31 u8 i = mode & 0xf; in ide_xfer_verbose()
33 if (mode >= XFER_UDMA_0 && mode <= XFER_UDMA_7) in ide_xfer_verbose()
35 else if (mode >= XFER_MW_DMA_0 && mode <= XFER_MW_DMA_4) in ide_xfer_verbose()
37 else if (mode >= XFER_SW_DMA_0 && mode <= XFER_SW_DMA_2) in ide_xfer_verbose()
39 else if (mode >= XFER_PIO_0 && mode <= XFER_PIO_6) in ide_xfer_verbose()
41 else if (mode == XFER_PIO_SLOW) in ide_xfer_verbose()
51 * ide_get_best_pio_mode - get PIO mode from drive
53 * @mode_wanted: preferred mode
54 * @max_mode: highest allowed mode
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()
123 int ide_set_pio_mode(ide_drive_t *drive, const u8 mode) in ide_set_pio_mode() argument
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()
145 if (ide_config_drive_speed(drive, 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()
153 return ide_config_drive_speed(drive, mode); in ide_set_pio_mode()
157 int ide_set_dma_mode(ide_drive_t *drive, const u8 mode) in ide_set_dma_mode() argument
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()
169 if (ide_config_drive_speed(drive, 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()
177 return ide_config_drive_speed(drive, mode); 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()
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
225 ide_hwif_t *hwif = drive->hwif; in ide_rate_filter()
226 u8 mode = ide_find_dma_mode(drive, speed); in ide_rate_filter() local
228 if (mode == 0) { 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()
232 mode = XFER_PIO_4; 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
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()