Lines Matching full:mci

64 	struct mem_ctl_info *mci = dimm->mci;  in edac_dimm_info_location()  local
68 for (i = 0; i < mci->n_layers; i++) { in edac_dimm_info_location()
70 edac_layer_name[mci->layers[i].type], in edac_dimm_info_location()
100 dimm->mci->csbased ? "rank" : "dimm", in edac_mc_dump_dimm()
117 edac_dbg(4, " csrow->mci = %p\n", csrow->mci); in edac_mc_dump_csrow()
120 static void edac_mc_dump_mci(struct mem_ctl_info *mci) in edac_mc_dump_mci() argument
122 edac_dbg(3, "\tmci = %p\n", mci); in edac_mc_dump_mci()
123 edac_dbg(3, "\tmci->mtype_cap = %lx\n", mci->mtype_cap); in edac_mc_dump_mci()
124 edac_dbg(3, "\tmci->edac_ctl_cap = %lx\n", mci->edac_ctl_cap); in edac_mc_dump_mci()
125 edac_dbg(3, "\tmci->edac_cap = %lx\n", mci->edac_cap); in edac_mc_dump_mci()
126 edac_dbg(4, "\tmci->edac_check = %p\n", mci->edac_check); in edac_mc_dump_mci()
128 mci->nr_csrows, mci->csrows); in edac_mc_dump_mci()
130 mci->tot_dimms, mci->dimms); in edac_mc_dump_mci()
131 edac_dbg(3, "\tdev = %p\n", mci->pdev); in edac_mc_dump_mci()
133 mci->mod_name, mci->ctl_name); in edac_mc_dump_mci()
134 edac_dbg(3, "\tpvt_info = %p\n\n", mci->pvt_info); in edac_mc_dump_mci()
173 static void _edac_mc_free(struct mem_ctl_info *mci) in _edac_mc_free() argument
175 put_device(&mci->dev); in _edac_mc_free()
180 struct mem_ctl_info *mci = container_of(dev, struct mem_ctl_info, dev); in mci_release() local
184 if (mci->dimms) { in mci_release()
185 for (i = 0; i < mci->tot_dimms; i++) in mci_release()
186 kfree(mci->dimms[i]); in mci_release()
187 kfree(mci->dimms); in mci_release()
190 if (mci->csrows) { in mci_release()
191 for (row = 0; row < mci->nr_csrows; row++) { in mci_release()
192 csr = mci->csrows[row]; in mci_release()
197 for (chn = 0; chn < mci->num_cschannel; chn++) in mci_release()
203 kfree(mci->csrows); in mci_release()
205 kfree(mci->pvt_info); in mci_release()
206 kfree(mci->layers); in mci_release()
207 kfree(mci); in mci_release()
210 static int edac_mc_alloc_csrows(struct mem_ctl_info *mci) in edac_mc_alloc_csrows() argument
212 unsigned int tot_channels = mci->num_cschannel; in edac_mc_alloc_csrows()
213 unsigned int tot_csrows = mci->nr_csrows; in edac_mc_alloc_csrows()
219 mci->csrows = kcalloc(tot_csrows, sizeof(*mci->csrows), GFP_KERNEL); in edac_mc_alloc_csrows()
220 if (!mci->csrows) in edac_mc_alloc_csrows()
226 csr = kzalloc(sizeof(**mci->csrows), GFP_KERNEL); in edac_mc_alloc_csrows()
230 mci->csrows[row] = csr; in edac_mc_alloc_csrows()
232 csr->mci = mci; in edac_mc_alloc_csrows()
255 static int edac_mc_alloc_dimms(struct mem_ctl_info *mci) in edac_mc_alloc_dimms() argument
265 mci->dimms = kcalloc(mci->tot_dimms, sizeof(*mci->dimms), GFP_KERNEL); in edac_mc_alloc_dimms()
266 if (!mci->dimms) in edac_mc_alloc_dimms()
272 for (idx = 0; idx < mci->tot_dimms; idx++) { in edac_mc_alloc_dimms()
277 chan = mci->csrows[row]->channels[chn]; in edac_mc_alloc_dimms()
279 dimm = kzalloc(sizeof(**mci->dimms), GFP_KERNEL); in edac_mc_alloc_dimms()
282 mci->dimms[idx] = dimm; in edac_mc_alloc_dimms()
283 dimm->mci = mci; in edac_mc_alloc_dimms()
291 n = scnprintf(p, len, "mc#%u", mci->mc_idx); in edac_mc_alloc_dimms()
294 for (layer = 0; layer < mci->n_layers; layer++) { in edac_mc_alloc_dimms()
296 edac_layer_name[mci->layers[layer].type], in edac_mc_alloc_dimms()
309 if (mci->layers[0].is_virt_csrow) { in edac_mc_alloc_dimms()
311 if (chn == mci->num_cschannel) { in edac_mc_alloc_dimms()
317 if (row == mci->nr_csrows) { in edac_mc_alloc_dimms()
324 for (layer = mci->n_layers - 1; layer >= 0; layer--) { in edac_mc_alloc_dimms()
326 if (pos[layer] < mci->layers[layer].size) in edac_mc_alloc_dimms()
340 struct mem_ctl_info *mci; in edac_mc_alloc() local
365 mci = kzalloc(sizeof(struct mem_ctl_info), GFP_KERNEL); in edac_mc_alloc()
366 if (!mci) in edac_mc_alloc()
369 mci->layers = kcalloc(n_layers, sizeof(struct edac_mc_layer), GFP_KERNEL); in edac_mc_alloc()
370 if (!mci->layers) in edac_mc_alloc()
373 mci->pvt_info = kzalloc(sz_pvt, GFP_KERNEL); in edac_mc_alloc()
374 if (!mci->pvt_info) in edac_mc_alloc()
377 mci->dev.release = mci_release; in edac_mc_alloc()
378 device_initialize(&mci->dev); in edac_mc_alloc()
381 mci->mc_idx = mc_num; in edac_mc_alloc()
382 mci->tot_dimms = tot_dimms; in edac_mc_alloc()
383 mci->n_layers = n_layers; in edac_mc_alloc()
384 memcpy(mci->layers, layers, sizeof(*layer) * n_layers); in edac_mc_alloc()
385 mci->nr_csrows = tot_csrows; in edac_mc_alloc()
386 mci->num_cschannel = tot_channels; in edac_mc_alloc()
387 mci->csbased = per_rank; in edac_mc_alloc()
389 if (edac_mc_alloc_csrows(mci)) in edac_mc_alloc()
392 if (edac_mc_alloc_dimms(mci)) in edac_mc_alloc()
395 mci->op_state = OP_ALLOC; in edac_mc_alloc()
397 return mci; in edac_mc_alloc()
400 _edac_mc_free(mci); in edac_mc_alloc()
406 void edac_mc_free(struct mem_ctl_info *mci) in edac_mc_free() argument
410 _edac_mc_free(mci); in edac_mc_free()
431 struct mem_ctl_info *mci; in __find_mci_by_dev() local
437 mci = list_entry(item, struct mem_ctl_info, link); in __find_mci_by_dev()
439 if (mci->pdev == dev) in __find_mci_by_dev()
440 return mci; in __find_mci_by_dev()
451 * @dev: pointer to a struct device related with the MCI
472 struct mem_ctl_info *mci = to_edac_mem_ctl_work(d_work); in edac_mc_workq_function() local
476 if (mci->op_state != OP_RUNNING_POLL) { in edac_mc_workq_function()
482 mci->edac_check(mci); in edac_mc_workq_function()
487 edac_queue_work(&mci->work, msecs_to_jiffies(edac_mc_get_poll_msec())); in edac_mc_workq_function()
498 struct mem_ctl_info *mci; in edac_mc_reset_delay_period() local
504 mci = list_entry(item, struct mem_ctl_info, link); in edac_mc_reset_delay_period()
506 if (mci->op_state == OP_RUNNING_POLL) in edac_mc_reset_delay_period()
507 edac_mod_work(&mci->work, value); in edac_mc_reset_delay_period()
516 * assign a unique value to mci->mc_idx.
522 static int add_mc_to_global_list(struct mem_ctl_info *mci) in add_mc_to_global_list() argument
529 p = __find_mci_by_dev(mci->pdev); in add_mc_to_global_list()
536 if (p->mc_idx >= mci->mc_idx) { in add_mc_to_global_list()
537 if (unlikely(p->mc_idx == mci->mc_idx)) in add_mc_to_global_list()
545 list_add_tail_rcu(&mci->link, insert_before); in add_mc_to_global_list()
551 edac_dev_name(mci), p->mod_name, p->ctl_name, p->mc_idx); in add_mc_to_global_list()
561 static int del_mc_from_global_list(struct mem_ctl_info *mci) in del_mc_from_global_list() argument
563 list_del_rcu(&mci->link); in del_mc_from_global_list()
569 INIT_LIST_HEAD(&mci->link); in del_mc_from_global_list()
576 struct mem_ctl_info *mci; in edac_mc_find() local
582 mci = list_entry(item, struct mem_ctl_info, link); in edac_mc_find()
583 if (mci->mc_idx == idx) in edac_mc_find()
587 mci = NULL; in edac_mc_find()
590 return mci; in edac_mc_find()
601 int edac_mc_add_mc_with_groups(struct mem_ctl_info *mci, in edac_mc_add_mc_with_groups() argument
609 edac_mc_dump_mci(mci); in edac_mc_add_mc_with_groups()
615 for (i = 0; i < mci->nr_csrows; i++) { in edac_mc_add_mc_with_groups()
616 struct csrow_info *csrow = mci->csrows[i]; in edac_mc_add_mc_with_groups()
630 mci_for_each_dimm(mci, dimm) in edac_mc_add_mc_with_groups()
636 if (edac_mc_owner && edac_mc_owner != mci->mod_name) { in edac_mc_add_mc_with_groups()
641 if (add_mc_to_global_list(mci)) in edac_mc_add_mc_with_groups()
645 mci->start_time = jiffies; in edac_mc_add_mc_with_groups()
647 mci->bus = edac_get_sysfs_subsys(); in edac_mc_add_mc_with_groups()
649 if (edac_create_sysfs_mci_device(mci, groups)) { in edac_mc_add_mc_with_groups()
650 edac_mc_printk(mci, KERN_WARNING, in edac_mc_add_mc_with_groups()
655 if (mci->edac_check) { in edac_mc_add_mc_with_groups()
656 mci->op_state = OP_RUNNING_POLL; in edac_mc_add_mc_with_groups()
658 INIT_DELAYED_WORK(&mci->work, edac_mc_workq_function); in edac_mc_add_mc_with_groups()
659 edac_queue_work(&mci->work, msecs_to_jiffies(edac_mc_get_poll_msec())); in edac_mc_add_mc_with_groups()
662 mci->op_state = OP_RUNNING_INTERRUPT; in edac_mc_add_mc_with_groups()
666 edac_mc_printk(mci, KERN_INFO, in edac_mc_add_mc_with_groups()
668 mci->mod_name, mci->ctl_name, mci->dev_name, in edac_mc_add_mc_with_groups()
669 edac_op_state_to_string(mci->op_state)); in edac_mc_add_mc_with_groups()
671 edac_mc_owner = mci->mod_name; in edac_mc_add_mc_with_groups()
677 del_mc_from_global_list(mci); in edac_mc_add_mc_with_groups()
687 struct mem_ctl_info *mci; in edac_mc_del_mc() local
693 /* find the requested mci struct in the global list */ in edac_mc_del_mc()
694 mci = __find_mci_by_dev(dev); in edac_mc_del_mc()
695 if (mci == NULL) { in edac_mc_del_mc()
700 /* mark MCI offline: */ in edac_mc_del_mc()
701 mci->op_state = OP_OFFLINE; in edac_mc_del_mc()
703 if (del_mc_from_global_list(mci)) in edac_mc_del_mc()
708 if (mci->edac_check) in edac_mc_del_mc()
709 edac_stop_work(&mci->work); in edac_mc_del_mc()
712 edac_remove_sysfs_mci_device(mci); in edac_mc_del_mc()
715 "Removed device %d for %s %s: DEV %s\n", mci->mc_idx, in edac_mc_del_mc()
716 mci->mod_name, mci->ctl_name, edac_dev_name(mci)); in edac_mc_del_mc()
718 return mci; in edac_mc_del_mc()
754 int edac_mc_find_csrow_by_page(struct mem_ctl_info *mci, unsigned long page) in edac_mc_find_csrow_by_page() argument
756 struct csrow_info **csrows = mci->csrows; in edac_mc_find_csrow_by_page()
759 edac_dbg(1, "MC%d: 0x%lx\n", mci->mc_idx, page); in edac_mc_find_csrow_by_page()
762 for (i = 0; i < mci->nr_csrows; i++) { in edac_mc_find_csrow_by_page()
773 mci->mc_idx, in edac_mc_find_csrow_by_page()
787 edac_mc_printk(mci, KERN_ERR, in edac_mc_find_csrow_by_page()
807 struct mem_ctl_info *mci = error_desc_to_mci(e); in edac_inc_ce_error() local
808 struct dimm_info *dimm = edac_get_dimm(mci, pos[0], pos[1], pos[2]); in edac_inc_ce_error()
810 mci->ce_mc += e->error_count; in edac_inc_ce_error()
815 mci->ce_noinfo_count += e->error_count; in edac_inc_ce_error()
821 struct mem_ctl_info *mci = error_desc_to_mci(e); in edac_inc_ue_error() local
822 struct dimm_info *dimm = edac_get_dimm(mci, pos[0], pos[1], pos[2]); in edac_inc_ue_error()
824 mci->ue_mc += e->error_count; in edac_inc_ue_error()
829 mci->ue_noinfo_count += e->error_count; in edac_inc_ue_error()
834 struct mem_ctl_info *mci = error_desc_to_mci(e); in edac_ce_error() local
838 edac_mc_printk(mci, KERN_WARNING, in edac_ce_error()
850 if (mci->scrub_mode == SCRUB_SW_SRC) { in edac_ce_error()
862 remapped_page = mci->ctl_page_to_phys ? in edac_ce_error()
863 mci->ctl_page_to_phys(mci, e->page_frame_number) : in edac_ce_error()
872 struct mem_ctl_info *mci = error_desc_to_mci(e); in edac_ue_error() local
875 edac_mc_printk(mci, KERN_WARNING, in edac_ue_error()
900 struct mem_ctl_info *mci = error_desc_to_mci(e); in edac_inc_csrow() local
910 mci->csrows[row]->ce_count += count; in edac_inc_csrow()
912 mci->csrows[row]->channels[chan]->ce_count += count; in edac_inc_csrow()
914 mci->csrows[row]->ue_count += count; in edac_inc_csrow()
920 struct mem_ctl_info *mci = error_desc_to_mci(e); in edac_raw_mc_handle_error() local
932 mci->mc_idx, e->top_layer, e->mid_layer, in edac_raw_mc_handle_error()
945 struct mem_ctl_info *mci, in edac_mc_handle_error() argument
961 struct edac_raw_error_desc *e = &mci->error_desc; in edac_mc_handle_error()
965 edac_dbg(3, "MC%d\n", mci->mc_idx); in edac_mc_handle_error()
986 for (i = 0; i < mci->n_layers; i++) { in edac_mc_handle_error()
987 if (pos[i] >= (int)mci->layers[i].size) { in edac_mc_handle_error()
989 edac_mc_printk(mci, KERN_ERR, in edac_mc_handle_error()
991 edac_layer_name[mci->layers[i].type], in edac_mc_handle_error()
992 pos[i], mci->layers[i].size); in edac_mc_handle_error()
1021 mci_for_each_dimm(mci, dimm) { in edac_mc_handle_error()
1056 mci->csbased ? "rank" : "dimm", in edac_mc_handle_error()
1081 for (i = 0; i < mci->n_layers; i++) { in edac_mc_handle_error()
1086 edac_layer_name[mci->layers[i].type], pos[i]); in edac_mc_handle_error()