• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/components/opensource/linux/linux-2.6.36/drivers/ide/

Lines Matching refs:hwif

193 	ide_hwif_t *hwif = drive->hwif;
201 hwif->tp_ops->input_data(drive, NULL, id, SECTOR_SIZE);
252 ide_hwif_t *hwif = drive->hwif;
253 struct ide_io_ports *io_ports = &hwif->io_ports;
254 const struct ide_tp_ops *tp_ops = hwif->tp_ops;
264 tp_ops->write_devctl(hwif, ATA_NIEN | ATA_DEVCTL_OBS);
273 (hwif->host_flags & IDE_HFLAG_BROKEN_ALTSTATUS) == 0) {
274 a = tp_ops->read_altstatus(hwif);
275 s = tp_ops->read_status(hwif);
298 tp_ops->exec_command(hwif, cmd);
313 s = tp_ops->read_status(hwif);
322 (void)tp_ops->read_status(hwif);
332 ide_hwif_t *hwif = drive->hwif;
339 stat = altstatus ? hwif->tp_ops->read_altstatus(hwif)
340 : hwif->tp_ops->read_status(hwif);
354 drive->hwif->tp_ops->tf_read(drive, &tf, IDE_VALID_DEVICE);
382 ide_hwif_t *hwif = drive->hwif;
383 const struct ide_tp_ops *tp_ops = hwif->tp_ops;
408 tp_ops->dev_select(hwif->devices[0]);
416 stat = tp_ops->read_status(hwif);
425 stat = tp_ops->read_status(hwif);
436 tp_ops->exec_command(hwif, ATA_CMD_DEV_RESET);
442 stat = tp_ops->read_status(hwif);
453 tp_ops->dev_select(hwif->devices[0]);
456 (void)tp_ops->read_status(hwif);
538 ide_hwif_t *hwif = container_of(dev, ide_hwif_t, gendev);
540 complete(&hwif->gendev_rel_comp);
543 static int ide_register_port(ide_hwif_t *hwif)
548 dev_set_name(&hwif->gendev, hwif->name);
549 dev_set_drvdata(&hwif->gendev, hwif);
550 if (hwif->gendev.parent == NULL)
551 hwif->gendev.parent = hwif->dev;
552 hwif->gendev.release = hwif_release_dev;
554 ret = device_register(&hwif->gendev);
561 hwif->portdev = device_create(ide_port_class, &hwif->gendev,
562 MKDEV(0, 0), hwif, hwif->name);
563 if (IS_ERR(hwif->portdev)) {
564 ret = PTR_ERR(hwif->portdev);
565 device_unregister(&hwif->gendev);
573 * @hwif: IDE port
597 static int ide_port_wait_ready(ide_hwif_t *hwif)
599 const struct ide_tp_ops *tp_ops = hwif->tp_ops;
603 printk(KERN_DEBUG "Probing IDE interface %s...\n", hwif->name);
613 rc = ide_wait_not_busy(hwif, 35000);
618 ide_port_for_each_dev(i, drive, hwif) {
623 tp_ops->write_devctl(hwif, ATA_DEVCTL_OBS);
625 rc = ide_wait_not_busy(hwif, 35000);
635 tp_ops->dev_select(hwif->devices[0]);
651 ide_drive_t *dev0 = dev1->hwif->devices[0];
678 static int ide_probe_port(ide_hwif_t *hwif)
684 BUG_ON(hwif->present);
686 if ((hwif->devices[0]->dev_flags & IDE_DFLAG_NOPROBE) &&
687 (hwif->devices[1]->dev_flags & IDE_DFLAG_NOPROBE))
694 irqd = hwif->irq;
696 disable_irq(hwif->irq);
698 if (ide_port_wait_ready(hwif) == -EBUSY)
699 printk(KERN_DEBUG "%s: Wait for ready failed before probe !\n", hwif->name);
705 ide_port_for_each_dev(i, drive, hwif) {
721 static void ide_port_tune_devices(ide_hwif_t *hwif)
723 const struct ide_port_ops *port_ops = hwif->port_ops;
727 ide_port_for_each_present_dev(i, drive, hwif) {
734 ide_port_for_each_present_dev(i, drive, hwif) {
739 if (hwif->dma_ops)
750 ide_hwif_t *hwif = drive->hwif;
762 q = blk_init_queue_node(do_ide_request, NULL, hwif_to_node(hwif));
769 if (hwif->rqsize < max_sectors)
770 max_sectors = hwif->rqsize;
795 static int ide_port_setup_devices(ide_hwif_t *hwif)
801 ide_port_for_each_present_dev(i, drive, hwif) {
818 ide_hwif_t *hwif;
821 ide_host_for_each_port(i, hwif, host) {
822 if (hwif == NULL)
826 hwif->tp_ops->read_status(hwif);
829 if (hwif->io_ports.ctl_addr)
830 hwif->tp_ops->write_devctl(hwif, ATA_DEVCTL_OBS);
837 static int init_irq (ide_hwif_t *hwif)
839 struct ide_io_ports *io_ports = &hwif->io_ports;
840 struct ide_host *host = hwif->host;
847 if (request_irq(hwif->irq, irq_handler, sa, hwif->name, hwif))
851 printk(KERN_INFO "%s at 0x%03lx-0x%03lx,0x%03lx on irq %d", hwif->name,
853 io_ports->ctl_addr, hwif->irq);
855 printk(KERN_INFO "%s at 0x%08lx on irq %d", hwif->name,
856 io_ports->data_addr, hwif->irq);
858 if (hwif->host->host_flags & IDE_HFLAG_SERIALIZE)
874 ide_hwif_t *hwif = data;
876 ide_drive_t *drive = hwif->devices[unit];
927 ide_hwif_t *hwif = drive->hwif;
930 disk->major = hwif->major;
932 sprintf(disk->disk_name, "hd%c", 'a' + hwif->index * MAX_DRIVES + unit);
952 static int hwif_init(ide_hwif_t *hwif)
954 if (!hwif->irq) {
955 printk(KERN_ERR "%s: disabled, no IRQ\n", hwif->name);
959 if (register_blkdev(hwif->major, hwif->name))
962 if (!hwif->sg_max_nents)
963 hwif->sg_max_nents = PRD_ENTRIES;
965 hwif->sg_table = kmalloc(sizeof(struct scatterlist)*hwif->sg_max_nents,
967 if (!hwif->sg_table) {
968 printk(KERN_ERR "%s: unable to allocate SG table.\n", hwif->name);
972 sg_init_table(hwif->sg_table, hwif->sg_max_nents);
974 if (init_irq(hwif)) {
976 hwif->name, hwif->irq);
980 blk_register_region(MKDEV(hwif->major, 0), MAX_DRIVES << PARTN_BITS,
981 THIS_MODULE, ata_probe, ata_lock, hwif);
985 unregister_blkdev(hwif->major, hwif->name);
989 static void hwif_register_devices(ide_hwif_t *hwif)
994 ide_port_for_each_present_dev(i, drive, hwif) {
998 dev_set_name(dev, "%u.%u", hwif->index, i);
1000 dev->parent = &hwif->gendev;
1011 static void ide_port_init_devices(ide_hwif_t *hwif)
1013 const struct ide_port_ops *port_ops = hwif->port_ops;
1017 ide_port_for_each_dev(i, drive, hwif) {
1018 drive->dn = i + hwif->channel * 2;
1020 if (hwif->host_flags & IDE_HFLAG_IO_32BIT)
1022 if (hwif->host_flags & IDE_HFLAG_NO_IO_32BIT)
1024 if (hwif->host_flags & IDE_HFLAG_UNMASK_IRQS)
1026 if (hwif->host_flags & IDE_HFLAG_NO_UNMASK_IRQS)
1036 static void ide_init_port(ide_hwif_t *hwif, unsigned int port,
1039 hwif->channel = port;
1041 hwif->chipset = d->chipset ? d->chipset : ide_pci;
1044 d->init_iops(hwif);
1047 hwif->host_flags |= d->host_flags;
1048 hwif->pio_mask = d->pio_mask;
1051 hwif->tp_ops = d->tp_ops;
1054 if ((hwif->host_flags & IDE_HFLAG_DTC2278) == 0 || hwif->channel == 0)
1055 hwif->port_ops = d->port_ops;
1057 hwif->swdma_mask = d->swdma_mask;
1058 hwif->mwdma_mask = d->mwdma_mask;
1059 hwif->ultra_mask = d->udma_mask;
1064 hwif->dma_ops = d->dma_ops;
1067 rc = d->init_dma(hwif, d);
1069 rc = ide_hwif_setup_dma(hwif, d);
1072 printk(KERN_INFO "%s: DMA disabled\n", hwif->name);
1074 hwif->dma_ops = NULL;
1075 hwif->dma_base = 0;
1076 hwif->swdma_mask = 0;
1077 hwif->mwdma_mask = 0;
1078 hwif->ultra_mask = 0;
1083 ((d->host_flags & IDE_HFLAG_SERIALIZE_DMA) && hwif->dma_base))
1084 hwif->host->host_flags |= IDE_HFLAG_SERIALIZE;
1087 hwif->rqsize = d->max_sectors;
1089 if ((hwif->host_flags & IDE_HFLAG_NO_LBA48) ||
1090 (hwif->host_flags & IDE_HFLAG_NO_LBA48_DMA))
1091 hwif->rqsize = 256;
1093 hwif->rqsize = 65536;
1098 d->init_hwif(hwif);
1101 static void ide_port_cable_detect(ide_hwif_t *hwif)
1103 const struct ide_port_ops *port_ops = hwif->port_ops;
1105 if (port_ops && port_ops->cable_detect && (hwif->ultra_mask & 0x78)) {
1106 if (hwif->cbl != ATA_CBL_PATA40_SHORT)
1107 hwif->cbl = port_ops->cable_detect(hwif);
1115 static void ide_port_init_devices_data(ide_hwif_t *hwif)
1120 ide_port_for_each_dev(i, drive, hwif) {
1121 u8 j = (hwif->index * MAX_DRIVES) + i;
1130 drive->hwif = hwif;
1145 static void ide_init_port_data(ide_hwif_t *hwif, unsigned int index)
1148 hwif->index = index;
1149 hwif->major = ide_hwif_to_major[index];
1151 hwif->name[0] = 'i';
1152 hwif->name[1] = 'd';
1153 hwif->name[2] = 'e';
1154 hwif->name[3] = '0' + index;
1156 spin_lock_init(&hwif->lock);
1158 init_timer(&hwif->timer);
1159 hwif->timer.function = &ide_timer_expiry;
1160 hwif->timer.data = (unsigned long)hwif;
1162 init_completion(&hwif->gendev_rel_comp);
1164 hwif->tp_ops = &default_tp_ops;
1166 ide_port_init_devices_data(hwif);
1169 static void ide_init_port_hw(ide_hwif_t *hwif, struct ide_hw *hw)
1171 memcpy(&hwif->io_ports, &hw->io_ports, sizeof(hwif->io_ports));
1172 hwif->irq = hw->irq;
1173 hwif->dev = hw->dev;
1174 hwif->gendev.parent = hw->parent ? hw->parent : hw->dev;
1175 hwif->config_data = hw->config;
1227 static void ide_port_free_devices(ide_hwif_t *hwif)
1232 ide_port_for_each_dev(i, drive, hwif) {
1238 static int ide_port_alloc_devices(ide_hwif_t *hwif, int node)
1261 hwif->devices[i] = drive;
1266 ide_port_free_devices(hwif);
1283 ide_hwif_t *hwif;
1289 hwif = kzalloc_node(sizeof(*hwif), GFP_KERNEL, node);
1290 if (hwif == NULL)
1293 if (ide_port_alloc_devices(hwif, node) < 0) {
1294 kfree(hwif);
1302 ide_port_free_devices(hwif);
1303 kfree(hwif);
1307 ide_init_port_data(hwif, idx);
1309 hwif->host = host;
1311 host->ports[i] = hwif;
1334 static void ide_port_free(ide_hwif_t *hwif)
1336 ide_port_free_devices(hwif);
1337 ide_free_port_slot(hwif->index);
1338 kfree(hwif);
1341 static void ide_disable_port(ide_hwif_t *hwif)
1343 struct ide_host *host = hwif->host;
1346 printk(KERN_INFO "%s: disabling port\n", hwif->name);
1349 if (host->ports[i] == hwif) {
1355 ide_port_free(hwif);
1361 ide_hwif_t *hwif, *mate = NULL;
1364 ide_host_for_each_port(i, hwif, host) {
1365 if (hwif == NULL) {
1370 ide_init_port_hw(hwif, hws[i]);
1371 ide_port_apply_params(hwif);
1374 hwif->mate = mate;
1375 mate->mate = hwif;
1378 mate = (i & 1) ? NULL : hwif;
1380 ide_init_port(hwif, i & 1, d);
1381 ide_port_cable_detect(hwif);
1383 hwif->port_flags |= IDE_PFLAG_PROBING;
1385 ide_port_init_devices(hwif);
1388 ide_host_for_each_port(i, hwif, host) {
1389 if (hwif == NULL)
1392 if (ide_probe_port(hwif) == 0)
1393 hwif->present = 1;
1395 hwif->port_flags &= ~IDE_PFLAG_PROBING;
1397 if ((hwif->host_flags & IDE_HFLAG_4DRIVES) == 0 ||
1398 hwif->mate == NULL || hwif->mate->present == 0) {
1399 if (ide_register_port(hwif)) {
1400 ide_disable_port(hwif);
1405 if (hwif->present)
1406 ide_port_tune_devices(hwif);
1411 ide_host_for_each_port(i, hwif, host) {
1412 if (hwif == NULL)
1415 if (hwif_init(hwif) == 0) {
1417 "interface\n", hwif->name);
1418 device_unregister(&hwif->gendev);
1419 ide_disable_port(hwif);
1423 if (hwif->present)
1424 if (ide_port_setup_devices(hwif) == 0) {
1425 hwif->present = 0;
1431 ide_acpi_init_port(hwif);
1433 if (hwif->present)
1434 ide_acpi_port_init_devices(hwif);
1437 ide_host_for_each_port(i, hwif, host) {
1438 if (hwif == NULL)
1441 ide_sysfs_register_port(hwif);
1442 ide_proc_register_port(hwif);
1444 if (hwif->present) {
1445 ide_proc_port_register_devices(hwif);
1446 hwif_register_devices(hwif);
1477 static void __ide_port_unregister_devices(ide_hwif_t *hwif)
1482 ide_port_for_each_present_dev(i, drive, hwif) {
1488 void ide_port_unregister_devices(ide_hwif_t *hwif)
1491 __ide_port_unregister_devices(hwif);
1492 hwif->present = 0;
1493 ide_port_init_devices_data(hwif);
1500 * @hwif: IDE interface
1512 static void ide_unregister(ide_hwif_t *hwif)
1519 if (hwif->present) {
1520 __ide_port_unregister_devices(hwif);
1521 hwif->present = 0;
1524 ide_proc_unregister_port(hwif);
1526 free_irq(hwif->irq, hwif);
1528 device_unregister(hwif->portdev);
1529 device_unregister(&hwif->gendev);
1530 wait_for_completion(&hwif->gendev_rel_comp);
1535 blk_unregister_region(MKDEV(hwif->major, 0), MAX_DRIVES<<PARTN_BITS);
1536 kfree(hwif->sg_table);
1537 unregister_blkdev(hwif->major, hwif->name);
1539 ide_release_dma_engine(hwif);
1546 ide_hwif_t *hwif;
1549 ide_host_for_each_port(i, hwif, host) {
1550 if (hwif)
1551 ide_port_free(hwif);
1560 ide_hwif_t *hwif;
1563 ide_host_for_each_port(i, hwif, host) {
1564 if (hwif)
1565 ide_unregister(hwif);
1572 void ide_port_scan(ide_hwif_t *hwif)
1576 ide_port_apply_params(hwif);
1577 ide_port_cable_detect(hwif);
1579 hwif->port_flags |= IDE_PFLAG_PROBING;
1581 ide_port_init_devices(hwif);
1583 rc = ide_probe_port(hwif);
1585 hwif->port_flags &= ~IDE_PFLAG_PROBING;
1590 hwif->present = 1;
1592 ide_port_tune_devices(hwif);
1593 ide_port_setup_devices(hwif);
1594 ide_acpi_port_init_devices(hwif);
1595 hwif_register_devices(hwif);
1596 ide_proc_port_register_devices(hwif);