Lines Matching +full:pd +full:- +full:disable
2 pd.c (c) 1997-8 Grant R. Guenther <grant@torque.net>
5 This is the high-level driver for parallel port IDE hard
12 The behaviour of the pd driver can be altered by setting
17 drive1 1-8 integers as follows:
37 <mod> this can be -1 to choose the best mode, or one
39 (-1 if not given)
48 <sby> set this to zero to disable the power saving
52 go more slowly. -1 sets a default value that
56 this to zero will speed up the device. (default -1)
60 choose the slave, -1 (the default) to choose the
72 (default "pd")
75 for adjacent blocks into larger multi-block
93 pd.drive0
94 pd.drive1
95 pd.drive2
96 pd.drive3
97 pd.cluster
98 pd.nice
100 In addition, you can use the parameter pd.disable to disable
119 #define PD_NAME "pd"
134 static int disable = 0; variable
136 static int drive0[8] = { 0, 0, 0, -1, 0, 1, -1, -1 };
137 static int drive1[8] = { 0, 0, 0, -1, 0, 1, -1, -1 };
138 static int drive2[8] = { 0, 0, 0, -1, 0, 1, -1, -1 };
139 static int drive3[8] = { 0, 0, 0, -1, 0, 1, -1, -1 };
154 #include <linux/blk-mq.h>
188 #define PD_SPIN_DEL 50 /* spin delay in micro-seconds */
243 static struct pd_unit pd[PD_UNITS]; variable
261 return pi_read_regr(disk->pi, 1, 6); in status_reg()
266 return pi_read_regr(disk->pi, 0, reg); in read_reg()
271 pi_write_regr(disk->pi, 1, 6, val); in write_status()
276 pi_write_regr(disk->pi, 0, reg, val); in write_reg()
281 return 0xa0+0x10*disk->drive; in DRIVE()
290 printk("%s: %s: status = 0x%x =", disk->name, msg, status); in pd_print_error()
344 if (disk->can_lba) { in pd_ide_command()
350 s = (block % disk->sectors) + 1; in pd_ide_command()
351 h = (block /= disk->sectors) % disk->heads; in pd_ide_command()
352 c0 = (block /= disk->heads) % 256; in pd_ide_command()
376 schedule_delayed_work(&fsm_tq, nice-1); in schedule_fsm()
404 disk = pd[pd_queue].gd; in set_next_request()
405 q = disk ? disk->queue : NULL; in set_next_request()
409 struct pd_unit *disk = q->queuedata; in set_next_request()
411 if (list_empty(&disk->rq_list)) in set_next_request()
414 pd_req = list_first_entry(&disk->rq_list, in set_next_request()
417 list_del_init(&pd_req->queuelist); in set_next_request()
433 pd_current = pd_req->rq_disk->private_data; in run_fsm()
434 pi_current = pd_current->pi; in run_fsm()
446 pi_current->proto->connect(pi_current); in run_fsm()
495 if (pd_block + pd_count > get_capacity(pd_req->rq_disk)) in do_pd_io_start()
498 pd_buf = bio_data(pd_req->bio); in do_pd_io_start()
512 return req->func(pd_current); in pd_special()
519 pd_count--; in pd_next_buf()
520 pd_run--; in pd_next_buf()
535 pd_buf = bio_data(pd_req->bio); in pd_next_buf()
576 pi_write_block(pd_current->pi, pd_buf, 512); in do_pd_write_start()
604 pi_read_block(pd_current->pi, pd_buf, 512); in do_pd_read_drq()
638 pd_send_command(disk, disk->sectors, 0, disk->heads - 1, 0, 0, in pd_init_dev_parms()
680 disk->changed = 1; /* say changed if other error */ in pd_media_check()
682 disk->changed = 1; in pd_media_check()
709 if (disk->drive == 0) in pd_identify()
718 pi_read_block(disk->pi, pd_scratch, 512); in pd_identify()
719 disk->can_lba = pd_scratch[99] & 2; in pd_identify()
720 disk->sectors = le16_to_cpu(*(__le16 *) (pd_scratch + 12)); in pd_identify()
721 disk->heads = le16_to_cpu(*(__le16 *) (pd_scratch + 6)); in pd_identify()
722 disk->cylinders = le16_to_cpu(*(__le16 *) (pd_scratch + 2)); in pd_identify()
723 if (disk->can_lba) in pd_identify()
724 disk->capacity = le32_to_cpu(*(__le32 *) (pd_scratch + 120)); in pd_identify()
726 disk->capacity = disk->sectors * disk->heads * disk->cylinders; in pd_identify()
730 j = PD_ID_LEN - 1; in pd_identify()
732 j--; in pd_identify()
736 disk->removable = pd_scratch[0] & 0x80; in pd_identify()
739 disk->name, id, in pd_identify()
740 disk->drive ? "slave" : "master", in pd_identify()
741 disk->capacity, disk->capacity / 2048, in pd_identify()
742 disk->cylinders, disk->heads, disk->sectors, in pd_identify()
743 disk->removable ? "removable" : "fixed"); in pd_identify()
745 if (disk->capacity) in pd_identify()
747 if (!disk->standby) in pd_identify()
758 struct pd_unit *disk = hctx->queue->queuedata; in pd_queue_rq()
762 pd_req = bd->rq; in pd_queue_rq()
765 list_add_tail(&bd->rq->queuelist, &disk->rq_list); in pd_queue_rq()
778 rq = blk_get_request(disk->gd->queue, REQ_OP_DRV_IN, 0); in pd_special_command()
783 req->func = func; in pd_special_command()
784 blk_execute_rq(disk->gd, rq, 0); in pd_special_command()
793 struct pd_unit *disk = bdev->bd_disk->private_data; in pd_open()
796 disk->access++; in pd_open()
798 if (disk->removable) { in pd_open()
808 struct pd_unit *disk = bdev->bd_disk->private_data; in pd_getgeo()
810 if (disk->alt_geom) { in pd_getgeo()
811 geo->heads = PD_LOG_HEADS; in pd_getgeo()
812 geo->sectors = PD_LOG_SECTS; in pd_getgeo()
813 geo->cylinders = disk->capacity / (geo->heads * geo->sectors); in pd_getgeo()
815 geo->heads = disk->heads; in pd_getgeo()
816 geo->sectors = disk->sectors; in pd_getgeo()
817 geo->cylinders = disk->cylinders; in pd_getgeo()
826 struct pd_unit *disk = bdev->bd_disk->private_data; in pd_ioctl()
831 if (disk->access == 1) in pd_ioctl()
836 return -EINVAL; in pd_ioctl()
842 struct pd_unit *disk = p->private_data; in pd_release()
845 if (!--disk->access && disk->removable) in pd_release()
852 struct pd_unit *disk = p->private_data; in pd_check_events()
854 if (!disk->removable) in pd_check_events()
857 r = disk->changed; in pd_check_events()
858 disk->changed = 0; in pd_check_events()
882 memset(&disk->tag_set, 0, sizeof(disk->tag_set)); in pd_probe_drive()
883 disk->tag_set.ops = &pd_mq_ops; in pd_probe_drive()
884 disk->tag_set.cmd_size = sizeof(struct pd_req); in pd_probe_drive()
885 disk->tag_set.nr_hw_queues = 1; in pd_probe_drive()
886 disk->tag_set.nr_maps = 1; in pd_probe_drive()
887 disk->tag_set.queue_depth = 2; in pd_probe_drive()
888 disk->tag_set.numa_node = NUMA_NO_NODE; in pd_probe_drive()
889 disk->tag_set.flags = BLK_MQ_F_SHOULD_MERGE | BLK_MQ_F_BLOCKING; in pd_probe_drive()
891 if (blk_mq_alloc_tag_set(&disk->tag_set)) in pd_probe_drive()
894 p = blk_mq_alloc_disk(&disk->tag_set, disk); in pd_probe_drive()
896 blk_mq_free_tag_set(&disk->tag_set); in pd_probe_drive()
899 disk->gd = p; in pd_probe_drive()
901 strcpy(p->disk_name, disk->name); in pd_probe_drive()
902 p->fops = &pd_fops; in pd_probe_drive()
903 p->major = major; in pd_probe_drive()
904 p->first_minor = (disk - pd) << PD_BITS; in pd_probe_drive()
905 p->minors = 1 << PD_BITS; in pd_probe_drive()
906 p->events = DISK_EVENT_MEDIA_CHANGE; in pd_probe_drive()
907 p->private_data = disk; in pd_probe_drive()
909 blk_queue_max_hw_sectors(p->queue, cluster); in pd_probe_drive()
910 blk_queue_bounce_limit(p->queue, BLK_BOUNCE_HIGH); in pd_probe_drive()
912 if (disk->drive == -1) { in pd_probe_drive()
913 for (disk->drive = 0; disk->drive <= 1; disk->drive++) in pd_probe_drive()
918 disk->gd = NULL; in pd_probe_drive()
929 struct pd_unit *disk = pd + unit; in pd_detect()
930 disk->pi = &disk->pia; in pd_detect()
931 disk->access = 0; in pd_detect()
932 disk->changed = 1; in pd_detect()
933 disk->capacity = 0; in pd_detect()
934 disk->drive = parm[D_SLV]; in pd_detect()
935 snprintf(disk->name, PD_NAMELEN, "%s%c", name, 'a'+unit); in pd_detect()
936 disk->alt_geom = parm[D_GEO]; in pd_detect()
937 disk->standby = parm[D_SBY]; in pd_detect()
940 INIT_LIST_HEAD(&disk->rq_list); in pd_detect()
946 return -1; in pd_detect()
949 if (pd_drive_count == 0) { /* nothing spec'd - so autoprobe for 1 */ in pd_detect()
950 disk = pd; in pd_detect()
951 if (pi_init(disk->pi, 1, -1, -1, -1, -1, -1, pd_scratch, in pd_detect()
952 PI_PD, verbose, disk->name)) { in pd_detect()
954 if (!disk->gd) in pd_detect()
955 pi_release(disk->pi); in pd_detect()
959 for (unit = 0, disk = pd; unit < PD_UNITS; unit++, disk++) { in pd_detect()
963 if (pi_init(disk->pi, 0, parm[D_PRT], parm[D_MOD], in pd_detect()
965 pd_scratch, PI_PD, verbose, disk->name)) { in pd_detect()
967 if (!disk->gd) in pd_detect()
968 pi_release(disk->pi); in pd_detect()
972 for (unit = 0, disk = pd; unit < PD_UNITS; unit++, disk++) { in pd_detect()
973 if (disk->gd) { in pd_detect()
974 set_capacity(disk->gd, disk->capacity); in pd_detect()
975 add_disk(disk->gd); in pd_detect()
988 if (disable) in pd_init()
1004 return -ENODEV; in pd_init()
1012 for (unit = 0, disk = pd; unit < PD_UNITS; unit++, disk++) { in pd_exit()
1013 struct gendisk *p = disk->gd; in pd_exit()
1015 disk->gd = NULL; in pd_exit()
1018 blk_mq_free_tag_set(&disk->tag_set); in pd_exit()
1019 pi_release(disk->pi); in pd_exit()