Lines Matching full:msb

182 	struct mspro_block_data *msb = disk->private_data;  in mspro_block_bd_free_disk()  local
189 kfree(msb); in mspro_block_bd_free_disk()
195 struct mspro_block_data *msb = bdev->bd_disk->private_data; in mspro_block_bd_getgeo() local
197 geo->heads = msb->heads; in mspro_block_bd_getgeo()
198 geo->sectors = msb->sectors_per_track; in mspro_block_bd_getgeo()
199 geo->cylinders = msb->cylinders; in mspro_block_bd_getgeo()
452 struct mspro_block_data *msb = memstick_get_drvdata(card); in h_mspro_block_req_init() local
455 card->next_request = msb->mrq_handler; in h_mspro_block_req_init()
474 struct mspro_block_data *msb = memstick_get_drvdata(card); in h_mspro_block_get_ro() local
479 msb->read_only = 1; in h_mspro_block_get_ro()
481 msb->read_only = 0; in h_mspro_block_get_ro()
505 struct mspro_block_data *msb = memstick_get_drvdata(card); in h_mspro_block_transfer_data() local
515 memstick_init_req(*mrq, MS_TPC_SET_CMD, &msb->transfer_cmd, 1); in h_mspro_block_transfer_data()
521 if (msb->caps & MEMSTICK_CAP_AUTO_GET_INT) in h_mspro_block_transfer_data()
534 if (msb->current_page in h_mspro_block_transfer_data()
535 == (msb->req_sg[msb->current_seg].length in h_mspro_block_transfer_data()
536 / msb->page_size)) { in h_mspro_block_transfer_data()
537 msb->current_page = 0; in h_mspro_block_transfer_data()
538 msb->current_seg++; in h_mspro_block_transfer_data()
540 if (msb->current_seg == msb->seg_count) { in h_mspro_block_transfer_data()
559 t_offset = msb->req_sg[msb->current_seg].offset; in h_mspro_block_transfer_data()
560 t_offset += msb->current_page * msb->page_size; in h_mspro_block_transfer_data()
563 nth_page(sg_page(&(msb->req_sg[msb->current_seg])), in h_mspro_block_transfer_data()
565 msb->page_size, offset_in_page(t_offset)); in h_mspro_block_transfer_data()
567 memstick_init_req_sg(*mrq, msb->data_dir == READ in h_mspro_block_transfer_data()
575 msb->current_page++; in h_mspro_block_transfer_data()
576 if (msb->caps & MEMSTICK_CAP_AUTO_GET_INT) { in h_mspro_block_transfer_data()
601 struct mspro_block_data *msb = memstick_get_drvdata(card); in h_mspro_block_setup_cmd() local
603 .system = msb->system, in h_mspro_block_setup_cmd()
604 .data_count = cpu_to_be16((uint16_t)(length / msb->page_size)), in h_mspro_block_setup_cmd()
610 do_div(offset, msb->page_size); in h_mspro_block_setup_cmd()
614 msb->mrq_handler = h_mspro_block_transfer_data; in h_mspro_block_setup_cmd()
623 struct mspro_block_data *msb = memstick_get_drvdata(card); in mspro_block_issue_req() local
628 msb->current_page = 0; in mspro_block_issue_req()
629 msb->current_seg = 0; in mspro_block_issue_req()
630 msb->seg_count = blk_rq_map_sg(msb->block_req->q, in mspro_block_issue_req()
631 msb->block_req, in mspro_block_issue_req()
632 msb->req_sg); in mspro_block_issue_req()
634 if (!msb->seg_count) { in mspro_block_issue_req()
635 unsigned int bytes = blk_rq_cur_bytes(msb->block_req); in mspro_block_issue_req()
638 chunk = blk_update_request(msb->block_req, in mspro_block_issue_req()
643 __blk_mq_end_request(msb->block_req, in mspro_block_issue_req()
645 msb->block_req = NULL; in mspro_block_issue_req()
649 t_off = blk_rq_pos(msb->block_req); in mspro_block_issue_req()
651 count = blk_rq_bytes(msb->block_req); in mspro_block_issue_req()
653 msb->setup_transfer(card, t_off, count); in mspro_block_issue_req()
655 msb->data_dir = rq_data_dir(msb->block_req); in mspro_block_issue_req()
656 msb->transfer_cmd = msb->data_dir == READ in mspro_block_issue_req()
667 struct mspro_block_data *msb = memstick_get_drvdata(card); in mspro_block_complete_req() local
673 spin_lock_irqsave(&msb->q_lock, flags); in mspro_block_complete_req()
674 dev_dbg(&card->dev, "complete %d, %d\n", msb->block_req ? 1 : 0, in mspro_block_complete_req()
677 if (msb->block_req) { in mspro_block_complete_req()
683 if (msb->data_dir == READ) { in mspro_block_complete_req()
684 for (cnt = 0; cnt < msb->current_seg; cnt++) { in mspro_block_complete_req()
685 t_len += msb->req_sg[cnt].length in mspro_block_complete_req()
686 / msb->page_size; in mspro_block_complete_req()
688 if (msb->current_page) in mspro_block_complete_req()
689 t_len += msb->current_page - 1; in mspro_block_complete_req()
691 t_len *= msb->page_size; in mspro_block_complete_req()
695 t_len = blk_rq_bytes(msb->block_req); in mspro_block_complete_req()
700 t_len = blk_rq_cur_bytes(msb->block_req); in mspro_block_complete_req()
702 chunk = blk_update_request(msb->block_req, in mspro_block_complete_req()
709 __blk_mq_end_request(msb->block_req, in mspro_block_complete_req()
711 msb->block_req = NULL; in mspro_block_complete_req()
721 spin_unlock_irqrestore(&msb->q_lock, flags); in mspro_block_complete_req()
727 struct mspro_block_data *msb = memstick_get_drvdata(card); in mspro_block_stop() local
732 spin_lock_irqsave(&msb->q_lock, flags); in mspro_block_stop()
733 if (!msb->block_req) { in mspro_block_stop()
734 blk_mq_stop_hw_queues(msb->queue); in mspro_block_stop()
737 spin_unlock_irqrestore(&msb->q_lock, flags); in mspro_block_stop()
748 struct mspro_block_data *msb = memstick_get_drvdata(card); in mspro_block_start() local
750 blk_mq_start_hw_queues(msb->queue); in mspro_block_start()
757 struct mspro_block_data *msb = memstick_get_drvdata(card); in mspro_queue_rq() local
759 spin_lock_irq(&msb->q_lock); in mspro_queue_rq()
761 if (msb->block_req) { in mspro_queue_rq()
762 spin_unlock_irq(&msb->q_lock); in mspro_queue_rq()
766 if (msb->eject) { in mspro_queue_rq()
767 spin_unlock_irq(&msb->q_lock); in mspro_queue_rq()
772 msb->block_req = bd->rq; in mspro_queue_rq()
776 msb->block_req = NULL; in mspro_queue_rq()
778 spin_unlock_irq(&msb->q_lock); in mspro_queue_rq()
786 struct mspro_block_data *msb = memstick_get_drvdata(card); in mspro_block_wait_for_ced() local
789 msb->mrq_handler = h_mspro_block_wait_for_ced; in mspro_block_wait_for_ced()
800 struct mspro_block_data *msb = memstick_get_drvdata(card); in mspro_block_set_interface() local
809 msb->mrq_handler = h_mspro_block_default; in mspro_block_set_interface()
820 struct mspro_block_data *msb = memstick_get_drvdata(card); in mspro_block_switch_interface() local
824 if (msb->caps & MEMSTICK_CAP_PAR4) in mspro_block_switch_interface()
836 msb->system = MEMSTICK_SYS_PAR4; in mspro_block_switch_interface()
841 if (msb->caps & MEMSTICK_CAP_PAR8) { in mspro_block_switch_interface()
845 msb->system = MEMSTICK_SYS_PAR8; in mspro_block_switch_interface()
858 msb->mrq_handler = h_mspro_block_default; in mspro_block_switch_interface()
868 msb->system = MEMSTICK_SYS_SERIAL; in mspro_block_switch_interface()
876 rc = mspro_block_set_interface(card, msb->system); in mspro_block_switch_interface()
884 if (msb->caps & MEMSTICK_CAP_PAR8) { in mspro_block_switch_interface()
885 msb->caps &= ~MEMSTICK_CAP_PAR8; in mspro_block_switch_interface()
899 struct mspro_block_data *msb = memstick_get_drvdata(card); in mspro_block_read_attributes() local
909 unsigned int addr, attr_offset = 0, attr_len = msb->page_size; in mspro_block_read_attributes()
911 attr = kmalloc(msb->page_size, GFP_KERNEL); in mspro_block_read_attributes()
915 sg_init_one(&msb->req_sg[0], attr, msb->page_size); in mspro_block_read_attributes()
916 msb->seg_count = 1; in mspro_block_read_attributes()
917 msb->current_seg = 0; in mspro_block_read_attributes()
918 msb->current_page = 0; in mspro_block_read_attributes()
919 msb->data_dir = READ; in mspro_block_read_attributes()
920 msb->transfer_cmd = MSPRO_CMD_READ_ATRB; in mspro_block_read_attributes()
922 msb->setup_transfer(card, attr_offset, attr_len); in mspro_block_read_attributes()
945 msb->attr_group.attrs = kcalloc(attr_count + 1, in mspro_block_read_attributes()
946 sizeof(*msb->attr_group.attrs), in mspro_block_read_attributes()
948 if (!msb->attr_group.attrs) { in mspro_block_read_attributes()
952 msb->attr_group.name = "media_attributes"; in mspro_block_read_attributes()
967 msb->attr_group.attrs[cnt] = &s_attr->dev_attr.attr; in mspro_block_read_attributes()
995 if (((addr / msb->page_size) == (attr_offset / msb->page_size)) in mspro_block_read_attributes()
996 && (((addr + s_attr->size - 1) / msb->page_size) in mspro_block_read_attributes()
997 == (attr_offset / msb->page_size))) { in mspro_block_read_attributes()
998 memcpy(s_attr->data, buffer + addr % msb->page_size, in mspro_block_read_attributes()
1003 attr_offset = (addr / msb->page_size) * msb->page_size; in mspro_block_read_attributes()
1007 attr_len = (((addr + s_attr->size) / msb->page_size) in mspro_block_read_attributes()
1008 + 1 ) * msb->page_size - attr_offset; in mspro_block_read_attributes()
1016 sg_init_one(&msb->req_sg[0], buffer, attr_len); in mspro_block_read_attributes()
1017 msb->seg_count = 1; in mspro_block_read_attributes()
1018 msb->current_seg = 0; in mspro_block_read_attributes()
1019 msb->current_page = 0; in mspro_block_read_attributes()
1020 msb->data_dir = READ; in mspro_block_read_attributes()
1021 msb->transfer_cmd = MSPRO_CMD_READ_ATRB; in mspro_block_read_attributes()
1026 msb->setup_transfer(card, attr_offset, attr_len); in mspro_block_read_attributes()
1034 memcpy(s_attr->data, buffer + addr % msb->page_size, in mspro_block_read_attributes()
1048 struct mspro_block_data *msb = memstick_get_drvdata(card); in mspro_block_init_card() local
1052 msb->system = MEMSTICK_SYS_SERIAL; in mspro_block_init_card()
1053 msb->setup_transfer = h_mspro_block_setup_cmd; in mspro_block_init_card()
1063 msb->caps = host->caps; in mspro_block_init_card()
1075 if (msb->system != MEMSTICK_SYS_SERIAL) in mspro_block_init_card()
1076 msb->caps |= MEMSTICK_CAP_AUTO_GET_INT; in mspro_block_init_card()
1079 msb->mrq_handler = h_mspro_block_get_ro; in mspro_block_init_card()
1087 dev_dbg(&card->dev, "card r/w status %d\n", msb->read_only ? 0 : 1); in mspro_block_init_card()
1089 msb->page_size = 512; in mspro_block_init_card()
1105 struct mspro_block_data *msb = memstick_get_drvdata(card); in mspro_block_init_disk() local
1107 .logical_block_size = msb->page_size, in mspro_block_init_disk()
1110 .max_segment_size = MSPRO_BLOCK_MAX_PAGES * msb->page_size, in mspro_block_init_disk()
1118 for (rc = 0; msb->attr_group.attrs[rc]; ++rc) { in mspro_block_init_disk()
1119 s_attr = mspro_from_sysfs_attr(msb->attr_group.attrs[rc]); in mspro_block_init_disk()
1130 msb->cylinders = be16_to_cpu(dev_info->cylinders); in mspro_block_init_disk()
1131 msb->heads = be16_to_cpu(dev_info->heads); in mspro_block_init_disk()
1132 msb->sectors_per_track = be16_to_cpu(dev_info->sectors_per_track); in mspro_block_init_disk()
1134 msb->page_size = be16_to_cpu(sys_info->unit_size); in mspro_block_init_disk()
1142 rc = blk_mq_alloc_sq_tag_set(&msb->tag_set, &mspro_mq_ops, 2, in mspro_block_init_disk()
1147 msb->disk = blk_mq_alloc_disk(&msb->tag_set, &lim, card); in mspro_block_init_disk()
1148 if (IS_ERR(msb->disk)) { in mspro_block_init_disk()
1149 rc = PTR_ERR(msb->disk); in mspro_block_init_disk()
1152 msb->queue = msb->disk->queue; in mspro_block_init_disk()
1154 msb->disk->major = major; in mspro_block_init_disk()
1155 msb->disk->first_minor = disk_id << MSPRO_BLOCK_PART_SHIFT; in mspro_block_init_disk()
1156 msb->disk->minors = 1 << MSPRO_BLOCK_PART_SHIFT; in mspro_block_init_disk()
1157 msb->disk->fops = &ms_block_bdops; in mspro_block_init_disk()
1158 msb->disk->private_data = msb; in mspro_block_init_disk()
1160 sprintf(msb->disk->disk_name, "mspblk%d", disk_id); in mspro_block_init_disk()
1164 capacity *= msb->page_size >> 9; in mspro_block_init_disk()
1165 set_capacity(msb->disk, capacity); in mspro_block_init_disk()
1168 if (msb->read_only) in mspro_block_init_disk()
1169 set_disk_ro(msb->disk, true); in mspro_block_init_disk()
1171 rc = device_add_disk(&card->dev, msb->disk, NULL); in mspro_block_init_disk()
1174 msb->active = 1; in mspro_block_init_disk()
1178 put_disk(msb->disk); in mspro_block_init_disk()
1180 blk_mq_free_tag_set(&msb->tag_set); in mspro_block_init_disk()
1188 static void mspro_block_data_clear(struct mspro_block_data *msb) in mspro_block_data_clear() argument
1193 if (msb->attr_group.attrs) { in mspro_block_data_clear()
1194 for (cnt = 0; msb->attr_group.attrs[cnt]; ++cnt) { in mspro_block_data_clear()
1195 s_attr = mspro_from_sysfs_attr(msb->attr_group in mspro_block_data_clear()
1200 kfree(msb->attr_group.attrs); in mspro_block_data_clear()
1203 msb->card = NULL; in mspro_block_data_clear()
1208 struct mspro_block_data *msb = memstick_get_drvdata(card); in mspro_block_check_card() local
1210 return (msb->active == 1); in mspro_block_check_card()
1215 struct mspro_block_data *msb; in mspro_block_probe() local
1218 msb = kzalloc(sizeof(struct mspro_block_data), GFP_KERNEL); in mspro_block_probe()
1219 if (!msb) in mspro_block_probe()
1221 memstick_set_drvdata(card, msb); in mspro_block_probe()
1222 msb->card = card; in mspro_block_probe()
1223 spin_lock_init(&msb->q_lock); in mspro_block_probe()
1230 rc = sysfs_create_group(&card->dev.kobj, &msb->attr_group); in mspro_block_probe()
1242 sysfs_remove_group(&card->dev.kobj, &msb->attr_group); in mspro_block_probe()
1245 mspro_block_data_clear(msb); in mspro_block_probe()
1246 kfree(msb); in mspro_block_probe()
1252 struct mspro_block_data *msb = memstick_get_drvdata(card); in mspro_block_remove() local
1255 spin_lock_irqsave(&msb->q_lock, flags); in mspro_block_remove()
1256 msb->eject = 1; in mspro_block_remove()
1257 spin_unlock_irqrestore(&msb->q_lock, flags); in mspro_block_remove()
1258 blk_mq_start_hw_queues(msb->queue); in mspro_block_remove()
1260 del_gendisk(msb->disk); in mspro_block_remove()
1263 blk_mq_free_tag_set(&msb->tag_set); in mspro_block_remove()
1264 msb->queue = NULL; in mspro_block_remove()
1266 sysfs_remove_group(&card->dev.kobj, &msb->attr_group); in mspro_block_remove()
1269 mspro_block_data_clear(msb); in mspro_block_remove()
1272 put_disk(msb->disk); in mspro_block_remove()
1280 struct mspro_block_data *msb = memstick_get_drvdata(card); in mspro_block_suspend() local
1283 blk_mq_stop_hw_queues(msb->queue); in mspro_block_suspend()
1285 spin_lock_irqsave(&msb->q_lock, flags); in mspro_block_suspend()
1286 msb->active = 0; in mspro_block_suspend()
1287 spin_unlock_irqrestore(&msb->q_lock, flags); in mspro_block_suspend()
1294 struct mspro_block_data *msb = memstick_get_drvdata(card); in mspro_block_resume() local
1318 && msb->attr_group.attrs[cnt]; ++cnt) { in mspro_block_resume()
1320 r_attr = mspro_from_sysfs_attr(msb->attr_group.attrs[cnt]); in mspro_block_resume()
1327 msb->active = 1; in mspro_block_resume()
1333 memstick_set_drvdata(card, msb); in mspro_block_resume()
1341 blk_mq_start_hw_queues(msb->queue); in mspro_block_resume()