Lines Matching refs:lcu
70 list_for_each_entry(pos, &server->lculist, lcu) { in _find_lcu()
77 static struct alias_pav_group *_find_group(struct alias_lcu *lcu, in _find_group() argument
84 if (lcu->pav == HYPER_PAV) { in _find_group()
85 if (list_empty(&lcu->grouplist)) in _find_group()
88 return list_first_entry(&lcu->grouplist, in _find_group()
97 list_for_each_entry(pos, &lcu->grouplist, group) { in _find_group()
126 struct alias_lcu *lcu; in _allocate_lcu() local
128 lcu = kzalloc(sizeof(*lcu), GFP_KERNEL); in _allocate_lcu()
129 if (!lcu) in _allocate_lcu()
131 lcu->uac = kzalloc(sizeof(*(lcu->uac)), GFP_KERNEL | GFP_DMA); in _allocate_lcu()
132 if (!lcu->uac) in _allocate_lcu()
134 lcu->rsu_cqr = kzalloc(sizeof(*lcu->rsu_cqr), GFP_KERNEL | GFP_DMA); in _allocate_lcu()
135 if (!lcu->rsu_cqr) in _allocate_lcu()
137 lcu->rsu_cqr->cpaddr = kzalloc(sizeof(struct ccw1), in _allocate_lcu()
139 if (!lcu->rsu_cqr->cpaddr) in _allocate_lcu()
141 lcu->rsu_cqr->data = kzalloc(16, GFP_KERNEL | GFP_DMA); in _allocate_lcu()
142 if (!lcu->rsu_cqr->data) in _allocate_lcu()
145 memcpy(lcu->uid.vendor, uid->vendor, sizeof(uid->vendor)); in _allocate_lcu()
146 memcpy(lcu->uid.serial, uid->serial, sizeof(uid->serial)); in _allocate_lcu()
147 lcu->uid.ssid = uid->ssid; in _allocate_lcu()
148 lcu->pav = NO_PAV; in _allocate_lcu()
149 lcu->flags = NEED_UAC_UPDATE | UPDATE_PENDING; in _allocate_lcu()
150 INIT_LIST_HEAD(&lcu->lcu); in _allocate_lcu()
151 INIT_LIST_HEAD(&lcu->inactive_devices); in _allocate_lcu()
152 INIT_LIST_HEAD(&lcu->active_devices); in _allocate_lcu()
153 INIT_LIST_HEAD(&lcu->grouplist); in _allocate_lcu()
154 INIT_WORK(&lcu->suc_data.worker, summary_unit_check_handling_work); in _allocate_lcu()
155 INIT_DELAYED_WORK(&lcu->ruac_data.dwork, lcu_update_work); in _allocate_lcu()
156 spin_lock_init(&lcu->lock); in _allocate_lcu()
157 init_completion(&lcu->lcu_setup); in _allocate_lcu()
158 return lcu; in _allocate_lcu()
161 kfree(lcu->rsu_cqr->cpaddr); in _allocate_lcu()
163 kfree(lcu->rsu_cqr); in _allocate_lcu()
165 kfree(lcu->uac); in _allocate_lcu()
167 kfree(lcu); in _allocate_lcu()
171 static void _free_lcu(struct alias_lcu *lcu) in _free_lcu() argument
173 kfree(lcu->rsu_cqr->data); in _free_lcu()
174 kfree(lcu->rsu_cqr->cpaddr); in _free_lcu()
175 kfree(lcu->rsu_cqr); in _free_lcu()
176 kfree(lcu->uac); in _free_lcu()
177 kfree(lcu); in _free_lcu()
192 struct alias_lcu *lcu, *newlcu; in dasd_alias_make_device_known_to_lcu() local
214 lcu = _find_lcu(server, &uid); in dasd_alias_make_device_known_to_lcu()
215 if (!lcu) { in dasd_alias_make_device_known_to_lcu()
221 lcu = _find_lcu(server, &uid); in dasd_alias_make_device_known_to_lcu()
222 if (!lcu) { in dasd_alias_make_device_known_to_lcu()
223 list_add(&newlcu->lcu, &server->lculist); in dasd_alias_make_device_known_to_lcu()
224 lcu = newlcu; in dasd_alias_make_device_known_to_lcu()
230 spin_lock(&lcu->lock); in dasd_alias_make_device_known_to_lcu()
231 list_add(&device->alias_list, &lcu->inactive_devices); in dasd_alias_make_device_known_to_lcu()
232 private->lcu = lcu; in dasd_alias_make_device_known_to_lcu()
233 spin_unlock(&lcu->lock); in dasd_alias_make_device_known_to_lcu()
248 struct alias_lcu *lcu; in dasd_alias_disconnect_device_from_lcu() local
253 lcu = private->lcu; in dasd_alias_disconnect_device_from_lcu()
255 if (!lcu) in dasd_alias_disconnect_device_from_lcu()
258 spin_lock_irqsave(&lcu->lock, flags); in dasd_alias_disconnect_device_from_lcu()
260 if (device == lcu->suc_data.device) { in dasd_alias_disconnect_device_from_lcu()
261 spin_unlock_irqrestore(&lcu->lock, flags); in dasd_alias_disconnect_device_from_lcu()
262 cancel_work_sync(&lcu->suc_data.worker); in dasd_alias_disconnect_device_from_lcu()
263 spin_lock_irqsave(&lcu->lock, flags); in dasd_alias_disconnect_device_from_lcu()
264 if (device == lcu->suc_data.device) { in dasd_alias_disconnect_device_from_lcu()
266 lcu->suc_data.device = NULL; in dasd_alias_disconnect_device_from_lcu()
270 if (device == lcu->ruac_data.device) { in dasd_alias_disconnect_device_from_lcu()
271 spin_unlock_irqrestore(&lcu->lock, flags); in dasd_alias_disconnect_device_from_lcu()
273 cancel_delayed_work_sync(&lcu->ruac_data.dwork); in dasd_alias_disconnect_device_from_lcu()
274 spin_lock_irqsave(&lcu->lock, flags); in dasd_alias_disconnect_device_from_lcu()
275 if (device == lcu->ruac_data.device) { in dasd_alias_disconnect_device_from_lcu()
277 lcu->ruac_data.device = NULL; in dasd_alias_disconnect_device_from_lcu()
280 private->lcu = NULL; in dasd_alias_disconnect_device_from_lcu()
281 spin_unlock_irqrestore(&lcu->lock, flags); in dasd_alias_disconnect_device_from_lcu()
284 spin_lock(&lcu->lock); in dasd_alias_disconnect_device_from_lcu()
286 if (list_empty(&lcu->grouplist) && in dasd_alias_disconnect_device_from_lcu()
287 list_empty(&lcu->active_devices) && in dasd_alias_disconnect_device_from_lcu()
288 list_empty(&lcu->inactive_devices)) { in dasd_alias_disconnect_device_from_lcu()
289 list_del(&lcu->lcu); in dasd_alias_disconnect_device_from_lcu()
290 spin_unlock(&lcu->lock); in dasd_alias_disconnect_device_from_lcu()
291 _free_lcu(lcu); in dasd_alias_disconnect_device_from_lcu()
292 lcu = NULL; in dasd_alias_disconnect_device_from_lcu()
295 _schedule_lcu_update(lcu, NULL); in dasd_alias_disconnect_device_from_lcu()
296 spin_unlock(&lcu->lock); in dasd_alias_disconnect_device_from_lcu()
312 static int _add_device_to_lcu(struct alias_lcu *lcu, in _add_device_to_lcu() argument
322 private->uid.type = lcu->uac->unit[private->uid.real_unit_addr].ua_type; in _add_device_to_lcu()
324 lcu->uac->unit[private->uid.real_unit_addr].base_ua; in _add_device_to_lcu()
328 if (lcu->pav == NO_PAV) { in _add_device_to_lcu()
329 list_move(&device->alias_list, &lcu->active_devices); in _add_device_to_lcu()
332 group = _find_group(lcu, &uid); in _add_device_to_lcu()
348 list_add(&group->group, &lcu->grouplist); in _add_device_to_lcu()
358 static void _remove_device_from_lcu(struct alias_lcu *lcu, in _remove_device_from_lcu() argument
364 list_move(&device->alias_list, &lcu->inactive_devices); in _remove_device_from_lcu()
416 struct alias_lcu *lcu) in read_unit_address_configuration() argument
449 memset(lcu->uac, 0, sizeof(*(lcu->uac))); in read_unit_address_configuration()
453 ccw->count = sizeof(*(lcu->uac)); in read_unit_address_configuration()
454 ccw->cda = (__u32)(addr_t) lcu->uac; in read_unit_address_configuration()
460 spin_lock_irqsave(&lcu->lock, flags); in read_unit_address_configuration()
461 lcu->flags &= ~NEED_UAC_UPDATE; in read_unit_address_configuration()
462 spin_unlock_irqrestore(&lcu->lock, flags); in read_unit_address_configuration()
473 spin_lock_irqsave(&lcu->lock, flags); in read_unit_address_configuration()
474 lcu->flags |= NEED_UAC_UPDATE; in read_unit_address_configuration()
475 spin_unlock_irqrestore(&lcu->lock, flags); in read_unit_address_configuration()
482 static int _lcu_update(struct dasd_device *refdev, struct alias_lcu *lcu) in _lcu_update() argument
490 spin_lock_irqsave(&lcu->lock, flags); in _lcu_update()
491 list_for_each_entry_safe(pavgroup, tempgroup, &lcu->grouplist, group) { in _lcu_update()
494 list_move(&device->alias_list, &lcu->active_devices); in _lcu_update()
500 list_move(&device->alias_list, &lcu->active_devices); in _lcu_update()
507 spin_unlock_irqrestore(&lcu->lock, flags); in _lcu_update()
509 rc = read_unit_address_configuration(refdev, lcu); in _lcu_update()
513 spin_lock_irqsave(&lcu->lock, flags); in _lcu_update()
520 if (lcu->flags & NEED_UAC_UPDATE) in _lcu_update()
522 lcu->pav = NO_PAV; in _lcu_update()
524 switch (lcu->uac->unit[i].ua_type) { in _lcu_update()
526 lcu->pav = BASE_PAV; in _lcu_update()
529 lcu->pav = HYPER_PAV; in _lcu_update()
532 if (lcu->pav != NO_PAV) in _lcu_update()
536 list_for_each_entry_safe(device, tempdev, &lcu->active_devices, in _lcu_update()
538 _add_device_to_lcu(lcu, device, refdev); in _lcu_update()
541 spin_unlock_irqrestore(&lcu->lock, flags); in _lcu_update()
547 struct alias_lcu *lcu; in lcu_update_work() local
554 lcu = container_of(ruac_data, struct alias_lcu, ruac_data); in lcu_update_work()
556 rc = _lcu_update(device, lcu); in lcu_update_work()
562 spin_lock_irqsave(&lcu->lock, flags); in lcu_update_work()
563 if ((rc && (rc != -EOPNOTSUPP)) || (lcu->flags & NEED_UAC_UPDATE)) { in lcu_update_work()
566 if (!schedule_delayed_work(&lcu->ruac_data.dwork, 30*HZ)) in lcu_update_work()
570 lcu->ruac_data.device = NULL; in lcu_update_work()
571 lcu->flags &= ~UPDATE_PENDING; in lcu_update_work()
573 spin_unlock_irqrestore(&lcu->lock, flags); in lcu_update_work()
576 static int _schedule_lcu_update(struct alias_lcu *lcu, in _schedule_lcu_update() argument
582 lcu->flags |= NEED_UAC_UPDATE; in _schedule_lcu_update()
583 if (lcu->ruac_data.device) { in _schedule_lcu_update()
590 if (!usedev && !list_empty(&lcu->grouplist)) { in _schedule_lcu_update()
591 group = list_first_entry(&lcu->grouplist, in _schedule_lcu_update()
602 if (!usedev && !list_empty(&lcu->active_devices)) { in _schedule_lcu_update()
603 usedev = list_first_entry(&lcu->active_devices, in _schedule_lcu_update()
613 lcu->ruac_data.device = usedev; in _schedule_lcu_update()
614 if (!schedule_delayed_work(&lcu->ruac_data.dwork, 0)) in _schedule_lcu_update()
623 struct alias_lcu *lcu = private->lcu; in dasd_alias_add_device() local
628 spin_lock_irqsave(&lcu->lock, flags); in dasd_alias_add_device()
633 if (private->uid.type != lcu->uac->unit[uaddr].ua_type) { in dasd_alias_add_device()
634 lcu->flags |= UPDATE_PENDING; in dasd_alias_add_device()
638 if (!(lcu->flags & UPDATE_PENDING)) { in dasd_alias_add_device()
639 rc = _add_device_to_lcu(lcu, device, device); in dasd_alias_add_device()
641 lcu->flags |= UPDATE_PENDING; in dasd_alias_add_device()
643 if (lcu->flags & UPDATE_PENDING) { in dasd_alias_add_device()
644 list_move(&device->alias_list, &lcu->active_devices); in dasd_alias_add_device()
646 _schedule_lcu_update(lcu, device); in dasd_alias_add_device()
648 spin_unlock_irqrestore(&lcu->lock, flags); in dasd_alias_add_device()
656 private->lcu->flags |= UPDATE_PENDING; in dasd_alias_update_add_device()
663 struct alias_lcu *lcu = private->lcu; in dasd_alias_remove_device() local
667 if (!lcu) in dasd_alias_remove_device()
669 spin_lock_irqsave(&lcu->lock, flags); in dasd_alias_remove_device()
670 _remove_device_from_lcu(lcu, device); in dasd_alias_remove_device()
671 spin_unlock_irqrestore(&lcu->lock, flags); in dasd_alias_remove_device()
678 struct alias_lcu *lcu = private->lcu; in dasd_alias_get_start_dev() local
683 if (!lcu) in dasd_alias_get_start_dev()
685 if (lcu->pav == NO_PAV || in dasd_alias_get_start_dev()
686 lcu->flags & (NEED_UAC_UPDATE | UPDATE_PENDING)) in dasd_alias_get_start_dev()
699 spin_lock_irqsave(&lcu->lock, flags); in dasd_alias_get_start_dev()
702 spin_unlock_irqrestore(&lcu->lock, flags); in dasd_alias_get_start_dev()
708 spin_unlock_irqrestore(&lcu->lock, flags); in dasd_alias_get_start_dev()
722 spin_unlock_irqrestore(&lcu->lock, flags); in dasd_alias_get_start_dev()
735 static int reset_summary_unit_check(struct alias_lcu *lcu, in reset_summary_unit_check() argument
743 cqr = lcu->rsu_cqr; in reset_summary_unit_check()
766 static void _restart_all_base_devices_on_lcu(struct alias_lcu *lcu) in _restart_all_base_devices_on_lcu() argument
773 list_for_each_entry(device, &lcu->active_devices, alias_list) { in _restart_all_base_devices_on_lcu()
780 list_for_each_entry(device, &lcu->inactive_devices, alias_list) { in _restart_all_base_devices_on_lcu()
787 list_for_each_entry(pavgroup, &lcu->grouplist, group) { in _restart_all_base_devices_on_lcu()
795 static void flush_all_alias_devices_on_lcu(struct alias_lcu *lcu) in flush_all_alias_devices_on_lcu() argument
814 spin_lock_irqsave(&lcu->lock, flags); in flush_all_alias_devices_on_lcu()
815 list_for_each_entry_safe(device, temp, &lcu->active_devices, in flush_all_alias_devices_on_lcu()
823 list_for_each_entry(pavgroup, &lcu->grouplist, group) { in flush_all_alias_devices_on_lcu()
829 spin_unlock_irqrestore(&lcu->lock, flags); in flush_all_alias_devices_on_lcu()
831 spin_lock_irqsave(&lcu->lock, flags); in flush_all_alias_devices_on_lcu()
838 list_move(&device->alias_list, &lcu->active_devices); in flush_all_alias_devices_on_lcu()
843 spin_unlock_irqrestore(&lcu->lock, flags); in flush_all_alias_devices_on_lcu()
846 static void _stop_all_devices_on_lcu(struct alias_lcu *lcu) in _stop_all_devices_on_lcu() argument
851 list_for_each_entry(device, &lcu->active_devices, alias_list) { in _stop_all_devices_on_lcu()
856 list_for_each_entry(device, &lcu->inactive_devices, alias_list) { in _stop_all_devices_on_lcu()
861 list_for_each_entry(pavgroup, &lcu->grouplist, group) { in _stop_all_devices_on_lcu()
875 static void _unstop_all_devices_on_lcu(struct alias_lcu *lcu) in _unstop_all_devices_on_lcu() argument
880 list_for_each_entry(device, &lcu->active_devices, alias_list) { in _unstop_all_devices_on_lcu()
885 list_for_each_entry(device, &lcu->inactive_devices, alias_list) { in _unstop_all_devices_on_lcu()
890 list_for_each_entry(pavgroup, &lcu->grouplist, group) { in _unstop_all_devices_on_lcu()
906 struct alias_lcu *lcu; in summary_unit_check_handling_work() local
913 lcu = container_of(suc_data, struct alias_lcu, suc_data); in summary_unit_check_handling_work()
917 flush_all_alias_devices_on_lcu(lcu); in summary_unit_check_handling_work()
924 reset_summary_unit_check(lcu, device, suc_data->reason); in summary_unit_check_handling_work()
926 spin_lock_irqsave(&lcu->lock, flags); in summary_unit_check_handling_work()
927 _unstop_all_devices_on_lcu(lcu); in summary_unit_check_handling_work()
928 _restart_all_base_devices_on_lcu(lcu); in summary_unit_check_handling_work()
930 _schedule_lcu_update(lcu, device); in summary_unit_check_handling_work()
931 lcu->suc_data.device = NULL; in summary_unit_check_handling_work()
933 spin_unlock_irqrestore(&lcu->lock, flags); in summary_unit_check_handling_work()
941 struct alias_lcu *lcu; in dasd_alias_handle_summary_unit_check() local
944 lcu = private->lcu; in dasd_alias_handle_summary_unit_check()
945 if (!lcu) { in dasd_alias_handle_summary_unit_check()
951 spin_lock_irqsave(&lcu->lock, flags); in dasd_alias_handle_summary_unit_check()
961 if (lcu->suc_data.device) { in dasd_alias_handle_summary_unit_check()
968 _stop_all_devices_on_lcu(lcu); in dasd_alias_handle_summary_unit_check()
970 lcu->flags |= NEED_UAC_UPDATE | UPDATE_PENDING; in dasd_alias_handle_summary_unit_check()
971 lcu->suc_data.reason = private->suc_reason; in dasd_alias_handle_summary_unit_check()
972 lcu->suc_data.device = device; in dasd_alias_handle_summary_unit_check()
974 if (!schedule_work(&lcu->suc_data.worker)) in dasd_alias_handle_summary_unit_check()
977 spin_unlock_irqrestore(&lcu->lock, flags); in dasd_alias_handle_summary_unit_check()