• Home
  • Raw
  • Download

Lines Matching +full:i +full:- +full:drive

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) 1994-1998 Linus Torvalds & authors (see below)
4 * Copyright (C) 2003-2005, 2007 Bartlomiej Zolnierkiewicz
10 * and Andre Hedrick <andre@linux-ide.org>
17 * There can be up to two drives per interface, as per the ATA-2 spec.
23 * | It traverses the request-list, using interrupts to jump between functions.
30 * | in the early extended-partition checks and added DM partitions.
34 * | IRQ-unmask, drive-id, multiple-mode, support for ">16 heads",
37 * October, 1994 -- Complete line-by-line overhaul for linux 1.1.x, by:
41 * Scott Snyder (snyder@fnald0.fnal.gov) (ATAPI IDE cd-rom)
66 * ide_device_get - get an additional reference to a ide_drive_t
67 * @drive: device to get a reference to
72 int ide_device_get(ide_drive_t *drive) in ide_device_get() argument
77 if (!get_device(&drive->gendev)) in ide_device_get()
78 return -ENXIO; in ide_device_get()
80 host_dev = drive->hwif->host->dev[0]; in ide_device_get()
81 module = host_dev ? host_dev->driver->owner : NULL; in ide_device_get()
84 put_device(&drive->gendev); in ide_device_get()
85 return -ENXIO; in ide_device_get()
93 * ide_device_put - release a reference to a ide_drive_t
94 * @drive: device to release a reference on
99 void ide_device_put(ide_drive_t *drive) in ide_device_put() argument
102 struct device *host_dev = drive->hwif->host->dev[0]; in ide_device_put()
103 struct module *module = host_dev ? host_dev->driver->owner : NULL; in ide_device_put()
107 put_device(&drive->gendev); in ide_device_put()
118 ide_drive_t *drive = to_ide_device(dev); in ide_uevent() local
120 add_uevent_var(env, "MEDIA=%s", ide_media_string(drive)); in ide_uevent()
121 add_uevent_var(env, "DRIVENAME=%s", drive->name); in ide_uevent()
122 add_uevent_var(env, "MODALIAS=ide:m-%s", ide_media_string(drive)); in ide_uevent()
128 ide_drive_t *drive = to_ide_device(dev); in generic_ide_probe() local
129 struct ide_driver *drv = to_ide_driver(dev->driver); in generic_ide_probe()
131 return drv->probe ? drv->probe(drive) : -ENODEV; in generic_ide_probe()
136 ide_drive_t *drive = to_ide_device(dev); in generic_ide_remove() local
137 struct ide_driver *drv = to_ide_driver(dev->driver); in generic_ide_remove()
139 if (drv->remove) in generic_ide_remove()
140 drv->remove(drive); in generic_ide_remove()
147 ide_drive_t *drive = to_ide_device(dev); in generic_ide_shutdown() local
148 struct ide_driver *drv = to_ide_driver(dev->driver); in generic_ide_shutdown()
150 if (dev->driver && drv->shutdown) in generic_ide_shutdown()
151 drv->shutdown(drive); in generic_ide_shutdown()
182 unsigned int a, b, i, j = 1; in ide_set_dev_param_mask() local
183 unsigned int *dev_param_mask = (unsigned int *)kp->arg; in ide_set_dev_param_mask()
188 return -EINVAL; in ide_set_dev_param_mask()
190 i = a * MAX_DRIVES + b; in ide_set_dev_param_mask()
192 if (i >= MAX_HWIFS * MAX_DRIVES || j > 1) in ide_set_dev_param_mask()
193 return -EINVAL; in ide_set_dev_param_mask()
196 *dev_param_mask |= (1 << i); in ide_set_dev_param_mask()
198 *dev_param_mask &= ~(1 << i); in ide_set_dev_param_mask()
237 MODULE_PARM_DESC(cdrom, "force device as a CD-ROM");
250 unsigned int a, b, c = 0, h = 0, s = 0, i, j = 1; in ide_set_disk_chs() local
256 return -EINVAL; in ide_set_disk_chs()
258 i = a * MAX_DRIVES + b; in ide_set_disk_chs()
260 if (i >= MAX_HWIFS * MAX_DRIVES || j > 1) in ide_set_disk_chs()
261 return -EINVAL; in ide_set_disk_chs()
264 return -EINVAL; in ide_set_disk_chs()
267 ide_disks |= (1 << i); in ide_set_disk_chs()
269 ide_disks &= ~(1 << i); in ide_set_disk_chs()
271 ide_disks_chs[i].cyl = c; in ide_set_disk_chs()
272 ide_disks_chs[i].head = h; in ide_set_disk_chs()
273 ide_disks_chs[i].sect = s; in ide_set_disk_chs()
281 static void ide_dev_apply_params(ide_drive_t *drive, u8 unit) in ide_dev_apply_params() argument
283 int i = drive->hwif->index * MAX_DRIVES + unit; in ide_dev_apply_params() local
285 if (ide_nodma & (1 << i)) { in ide_dev_apply_params()
286 printk(KERN_INFO "ide: disallowing DMA for %s\n", drive->name); in ide_dev_apply_params()
287 drive->dev_flags |= IDE_DFLAG_NODMA; in ide_dev_apply_params()
289 if (ide_noflush & (1 << i)) { in ide_dev_apply_params()
291 drive->name); in ide_dev_apply_params()
292 drive->dev_flags |= IDE_DFLAG_NOFLUSH; in ide_dev_apply_params()
294 if (ide_nohpa & (1 << i)) { in ide_dev_apply_params()
296 drive->name); in ide_dev_apply_params()
297 drive->dev_flags |= IDE_DFLAG_NOHPA; in ide_dev_apply_params()
299 if (ide_noprobe & (1 << i)) { in ide_dev_apply_params()
300 printk(KERN_INFO "ide: skipping probe for %s\n", drive->name); in ide_dev_apply_params()
301 drive->dev_flags |= IDE_DFLAG_NOPROBE; in ide_dev_apply_params()
303 if (ide_nowerr & (1 << i)) { in ide_dev_apply_params()
305 drive->name); in ide_dev_apply_params()
306 drive->bad_wstat = BAD_R_STAT; in ide_dev_apply_params()
308 if (ide_cdroms & (1 << i)) { in ide_dev_apply_params()
309 printk(KERN_INFO "ide: forcing %s as a CD-ROM\n", drive->name); in ide_dev_apply_params()
310 drive->dev_flags |= IDE_DFLAG_PRESENT; in ide_dev_apply_params()
311 drive->media = ide_cdrom; in ide_dev_apply_params()
313 drive->ready_stat = 0; in ide_dev_apply_params()
315 if (ide_disks & (1 << i)) { in ide_dev_apply_params()
316 drive->cyl = drive->bios_cyl = ide_disks_chs[i].cyl; in ide_dev_apply_params()
317 drive->head = drive->bios_head = ide_disks_chs[i].head; in ide_dev_apply_params()
318 drive->sect = drive->bios_sect = ide_disks_chs[i].sect; in ide_dev_apply_params()
321 drive->name, in ide_dev_apply_params()
322 drive->cyl, drive->head, drive->sect); in ide_dev_apply_params()
324 drive->dev_flags |= IDE_DFLAG_FORCED_GEOM | IDE_DFLAG_PRESENT; in ide_dev_apply_params()
325 drive->media = ide_disk; in ide_dev_apply_params()
326 drive->ready_stat = ATA_DRDY; in ide_dev_apply_params()
334 int i, j = 1; in ide_set_ignore_cable() local
338 if (sscanf(s, "%d:%d", &i, &j) != 2 && sscanf(s, "%d", &i) != 1) in ide_set_ignore_cable()
339 return -EINVAL; in ide_set_ignore_cable()
341 if (i >= MAX_HWIFS || j < 0 || j > 1) in ide_set_ignore_cable()
342 return -EINVAL; in ide_set_ignore_cable()
345 ide_ignore_cable |= (1 << i); in ide_set_ignore_cable()
347 ide_ignore_cable &= ~(1 << i); in ide_set_ignore_cable()
357 ide_drive_t *drive; in ide_port_apply_params() local
358 int i; in ide_port_apply_params() local
360 if (ide_ignore_cable & (1 << hwif->index)) { in ide_port_apply_params()
362 hwif->name); in ide_port_apply_params()
363 hwif->cbl = ATA_CBL_PATA40_SHORT; in ide_port_apply_params()
366 ide_port_for_each_dev(i, drive, hwif) in ide_port_apply_params()
367 ide_dev_apply_params(drive, i); in ide_port_apply_params()
377 printk(KERN_INFO "Uniform Multi-Platform E-IDE driver\n"); in ide_init()