Lines Matching +full:sw +full:- +full:exception
1 // SPDX-License-Identifier: GPL-2.0-only
34 #define CPC925_BIT(nr) (1UL << (CPC925_BITS_PER_REG - 1 - nr))
50 * "CPC925 Bridge and Memory Controller User Manual, SA14-2761-02".
57 * Processor Interface Exception Mask Register (APIMASK)
61 APIMASK_DART = CPC925_BIT(0), /* DART Exception */
64 APIMASK_STAT = CPC925_BIT(3), /* Status Exception */
65 APIMASK_DERR = CPC925_BIT(4), /* Data Error Exception */
66 APIMASK_ADRS0 = CPC925_BIT(5), /* Addressing Exception on PI0 */
67 APIMASK_ADRS1 = CPC925_BIT(6), /* Addressing Exception on PI1 */
83 * Processor Interface Exception Register (APIEXCP)
87 APIEXCP_DART = CPC925_BIT(0), /* DART Exception */
90 APIEXCP_STAT = CPC925_BIT(3), /* Status Exception */
91 APIEXCP_DERR = CPC925_BIT(4), /* Data Error Exception */
92 APIEXCP_ADRS0 = CPC925_BIT(5), /* Addressing Exception on PI0 */
93 APIEXCP_ADRS1 = CPC925_BIT(6), /* Addressing Exception on PI1 */
139 #define MSCR_SCRUB_MOD_MASK 0xC0000000 /* scrub_mod - bit0:1*/
141 #define MSCR_SI_SHIFT 16 /* si - bit8:15*/
217 ERRCTRL_EOC_NF = CPC925_BIT(3), /* End-Of-Chain error */
246 LINKERR_EOC_ERR = CPC925_BIT(17), /* End-Of-Chain error */
288 int len, sw, aw; in get_total_mem() local
296 sw = of_n_size_cells(np); in get_total_mem()
300 pdata->total_mem = 0; in get_total_mem()
304 size = of_read_number(reg, sw); in get_total_mem()
305 reg += sw; in get_total_mem()
307 pdata->total_mem += size; in get_total_mem()
311 edac_dbg(0, "total_mem 0x%lx\n", pdata->total_mem); in get_total_mem()
316 struct cpc925_mc_pdata *pdata = mci->pvt_info; in cpc925_init_csrows()
326 for (index = 0; index < mci->nr_csrows; index++) { in cpc925_init_csrows()
327 mbmr = __raw_readl(pdata->vbase + REG_MBMR_OFFSET + in cpc925_init_csrows()
329 mbbar = __raw_readl(pdata->vbase + REG_MBBAR_OFFSET + in cpc925_init_csrows()
337 csrow = mci->csrows[index]; in cpc925_init_csrows()
340 csrow->first_page = last_nr_pages; in cpc925_init_csrows()
342 csrow->last_page = csrow->first_page + nr_pages - 1; in cpc925_init_csrows()
343 last_nr_pages = csrow->last_page + 1; in cpc925_init_csrows()
345 switch (csrow->nr_channels) { in cpc925_init_csrows()
347 grain = 32; /* four-beat burst of 32 bytes */ in cpc925_init_csrows()
351 grain = 64; /* four-beat burst of 64 bytes */ in cpc925_init_csrows()
368 for (j = 0; j < csrow->nr_channels; j++) { in cpc925_init_csrows()
369 dimm = csrow->channels[j]->dimm; in cpc925_init_csrows()
370 dimm->nr_pages = nr_pages / csrow->nr_channels; in cpc925_init_csrows()
371 dimm->mtype = MEM_RDDR; in cpc925_init_csrows()
372 dimm->edac_mode = EDAC_SECDED; in cpc925_init_csrows()
373 dimm->grain = grain; in cpc925_init_csrows()
374 dimm->dtype = dtype; in cpc925_init_csrows()
382 struct cpc925_mc_pdata *pdata = mci->pvt_info; in cpc925_mc_init()
387 apimask = __raw_readl(pdata->vbase + REG_APIMASK_OFFSET); in cpc925_mc_init()
390 __raw_writel(apimask, pdata->vbase + REG_APIMASK_OFFSET); in cpc925_mc_init()
394 mccr = __raw_readl(pdata->vbase + REG_MCCR_OFFSET); in cpc925_mc_init()
397 __raw_writel(mccr, pdata->vbase + REG_MCCR_OFFSET); in cpc925_mc_init()
408 * are cleared here if we want to re-install CPC925 EDAC in cpc925_mc_exit()
410 * trigger machine check exception. in cpc925_mc_exit()
422 * Suppose memory mode is 0x0111(128-bit mode, identical DIMM pairs),
452 if (mci->csrows[rank]->first_page == 0) { in cpc925_mc_get_pfn()
454 "non-populated csrow, broken hardware?\n"); in cpc925_mc_get_pfn()
460 pa = mci->csrows[rank]->first_page << PAGE_SHIFT; in cpc925_mc_get_pfn()
467 pa |= c << (14 - i); in cpc925_mc_get_pfn()
477 pa |= c << (26 - i); in cpc925_mc_get_pfn()
489 pa |= c << (18 - i); in cpc925_mc_get_pfn()
495 pa |= c << (29 - i); in cpc925_mc_get_pfn()
498 *offset = pa & (PAGE_SIZE - 1); in cpc925_mc_get_pfn()
520 struct cpc925_mc_pdata *pdata = mci->pvt_info; in cpc925_mc_check()
529 apiexcp = __raw_readl(pdata->vbase + REG_APIEXCP_OFFSET); in cpc925_mc_check()
533 mesr = __raw_readl(pdata->vbase + REG_MESR_OFFSET); in cpc925_mc_check()
536 mear = __raw_readl(pdata->vbase + REG_MEAR_OFFSET); in cpc925_mc_check()
546 csrow, channel, -1, in cpc925_mc_check()
547 mci->ctl_name, ""); in cpc925_mc_check()
554 csrow, -1, -1, in cpc925_mc_check()
555 mci->ctl_name, ""); in cpc925_mc_check()
560 __raw_readl(pdata->vbase + REG_APIMASK_OFFSET)); in cpc925_mc_check()
564 __raw_readl(pdata->vbase + REG_MSCR_OFFSET)); in cpc925_mc_check()
566 __raw_readl(pdata->vbase + REG_MSRSR_OFFSET)); in cpc925_mc_check()
568 __raw_readl(pdata->vbase + REG_MSRER_OFFSET)); in cpc925_mc_check()
570 __raw_readl(pdata->vbase + REG_MSPR_OFFSET)); in cpc925_mc_check()
572 __raw_readl(pdata->vbase + REG_MCCR_OFFSET)); in cpc925_mc_check()
574 __raw_readl(pdata->vbase + REG_MCRER_OFFSET)); in cpc925_mc_check()
620 apimask = __raw_readl(dev_info->vbase + REG_APIMASK_OFFSET); in cpc925_cpu_init()
632 __raw_writel(apimask, dev_info->vbase + REG_APIMASK_OFFSET); in cpc925_cpu_init()
642 * are cleared here if we want to re-install CPC925 EDAC in cpc925_cpu_exit()
644 * trigger machine check exception. in cpc925_cpu_exit()
655 struct cpc925_dev_info *dev_info = edac_dev->pvt_info; in cpc925_cpu_check()
660 apiexcp = __raw_readl(dev_info->vbase + REG_APIEXCP_OFFSET); in cpc925_cpu_check()
667 apimask = __raw_readl(dev_info->vbase + REG_APIMASK_OFFSET); in cpc925_cpu_check()
673 edac_device_handle_ue(edac_dev, 0, 0, edac_dev->ctl_name); in cpc925_cpu_check()
682 ht_errctrl = __raw_readl(dev_info->vbase + REG_ERRCTRL_OFFSET); in cpc925_htlink_init()
685 __raw_writel(ht_errctrl, dev_info->vbase + REG_ERRCTRL_OFFSET); in cpc925_htlink_init()
694 ht_errctrl = __raw_readl(dev_info->vbase + REG_ERRCTRL_OFFSET); in cpc925_htlink_exit()
696 __raw_writel(ht_errctrl, dev_info->vbase + REG_ERRCTRL_OFFSET); in cpc925_htlink_exit()
702 struct cpc925_dev_info *dev_info = edac_dev->pvt_info; in cpc925_htlink_check()
703 u32 brgctrl = __raw_readl(dev_info->vbase + REG_BRGCTRL_OFFSET); in cpc925_htlink_check()
704 u32 linkctrl = __raw_readl(dev_info->vbase + REG_LINKCTRL_OFFSET); in cpc925_htlink_check()
705 u32 errctrl = __raw_readl(dev_info->vbase + REG_ERRCTRL_OFFSET); in cpc925_htlink_check()
706 u32 linkerr = __raw_readl(dev_info->vbase + REG_LINKERR_OFFSET); in cpc925_htlink_check()
728 dev_info->vbase + REG_BRGCTRL_OFFSET); in cpc925_htlink_check()
732 dev_info->vbase + REG_LINKCTRL_OFFSET); in cpc925_htlink_check()
737 dev_info->vbase + REG_BRGCTRL_OFFSET); in cpc925_htlink_check()
741 dev_info->vbase + REG_ERRCTRL_OFFSET); in cpc925_htlink_check()
745 dev_info->vbase + REG_LINKERR_OFFSET); in cpc925_htlink_check()
747 edac_device_handle_ce(edac_dev, 0, 0, edac_dev->ctl_name); in cpc925_htlink_check()
782 for (dev_info = &cpc925_devs[0]; dev_info->init; dev_info++) { in cpc925_add_edac_devices()
783 dev_info->vbase = vbase; in cpc925_add_edac_devices()
784 dev_info->pdev = platform_device_register_simple( in cpc925_add_edac_devices()
785 dev_info->ctl_name, 0, NULL, 0); in cpc925_add_edac_devices()
786 if (IS_ERR(dev_info->pdev)) { in cpc925_add_edac_devices()
789 dev_info->ctl_name); in cpc925_add_edac_devices()
797 dev_info->edac_idx = edac_device_alloc_index(); in cpc925_add_edac_devices()
798 dev_info->edac_dev = in cpc925_add_edac_devices()
799 edac_device_alloc_ctl_info(0, dev_info->ctl_name, in cpc925_add_edac_devices()
800 1, NULL, 0, 0, NULL, 0, dev_info->edac_idx); in cpc925_add_edac_devices()
801 if (!dev_info->edac_dev) { in cpc925_add_edac_devices()
806 dev_info->edac_dev->pvt_info = dev_info; in cpc925_add_edac_devices()
807 dev_info->edac_dev->dev = &dev_info->pdev->dev; in cpc925_add_edac_devices()
808 dev_info->edac_dev->ctl_name = dev_info->ctl_name; in cpc925_add_edac_devices()
809 dev_info->edac_dev->mod_name = CPC925_EDAC_MOD_STR; in cpc925_add_edac_devices()
810 dev_info->edac_dev->dev_name = dev_name(&dev_info->pdev->dev); in cpc925_add_edac_devices()
813 dev_info->edac_dev->edac_check = dev_info->check; in cpc925_add_edac_devices()
815 if (dev_info->init) in cpc925_add_edac_devices()
816 dev_info->init(dev_info); in cpc925_add_edac_devices()
818 if (edac_device_add_device(dev_info->edac_dev) > 0) { in cpc925_add_edac_devices()
821 dev_info->ctl_name); in cpc925_add_edac_devices()
826 dev_info->ctl_name); in cpc925_add_edac_devices()
831 if (dev_info->exit) in cpc925_add_edac_devices()
832 dev_info->exit(dev_info); in cpc925_add_edac_devices()
833 edac_device_free_ctl_info(dev_info->edac_dev); in cpc925_add_edac_devices()
835 platform_device_unregister(dev_info->pdev); in cpc925_add_edac_devices()
847 for (dev_info = &cpc925_devs[0]; dev_info->init; dev_info++) { in cpc925_del_edac_devices()
848 if (dev_info->edac_dev) { in cpc925_del_edac_devices()
849 edac_device_del_device(dev_info->edac_dev->dev); in cpc925_del_edac_devices()
850 edac_device_free_ctl_info(dev_info->edac_dev); in cpc925_del_edac_devices()
851 platform_device_unregister(dev_info->pdev); in cpc925_del_edac_devices()
854 if (dev_info->exit) in cpc925_del_edac_devices()
855 dev_info->exit(dev_info); in cpc925_del_edac_devices()
858 dev_info->ctl_name); in cpc925_del_edac_devices()
862 /* Convert current back-ground scrub rate into byte/sec bandwidth */
865 struct cpc925_mc_pdata *pdata = mci->pvt_info; in cpc925_get_sdram_scrub_rate()
870 mscr = __raw_readl(pdata->vbase + REG_MSCR_OFFSET); in cpc925_get_sdram_scrub_rate()
894 * Dual channel only when 128-bit wide physical bus in cpc925_mc_get_channels()
895 * and 128-bit configuration. in cpc925_mc_get_channels()
916 edac_dbg(0, "%s platform device found!\n", pdev->name); in cpc925_probe()
918 if (!devres_open_group(&pdev->dev, cpc925_probe, GFP_KERNEL)) { in cpc925_probe()
919 res = -ENOMEM; in cpc925_probe()
926 res = -ENOENT; in cpc925_probe()
930 if (!devm_request_mem_region(&pdev->dev, in cpc925_probe()
931 r->start, in cpc925_probe()
933 pdev->name)) { in cpc925_probe()
935 res = -EBUSY; in cpc925_probe()
939 vbase = devm_ioremap(&pdev->dev, r->start, resource_size(r)); in cpc925_probe()
942 res = -ENOMEM; in cpc925_probe()
958 res = -ENOMEM; in cpc925_probe()
962 pdata = mci->pvt_info; in cpc925_probe()
963 pdata->vbase = vbase; in cpc925_probe()
964 pdata->edac_idx = edac_mc_idx++; in cpc925_probe()
965 pdata->name = pdev->name; in cpc925_probe()
967 mci->pdev = &pdev->dev; in cpc925_probe()
969 mci->dev_name = dev_name(&pdev->dev); in cpc925_probe()
970 mci->mtype_cap = MEM_FLAG_RDDR | MEM_FLAG_DDR; in cpc925_probe()
971 mci->edac_ctl_cap = EDAC_FLAG_NONE | EDAC_FLAG_SECDED; in cpc925_probe()
972 mci->edac_cap = EDAC_FLAG_SECDED; in cpc925_probe()
973 mci->mod_name = CPC925_EDAC_MOD_STR; in cpc925_probe()
974 mci->ctl_name = pdev->name; in cpc925_probe()
977 mci->edac_check = cpc925_mc_check; in cpc925_probe()
979 mci->ctl_page_to_phys = NULL; in cpc925_probe()
980 mci->scrub_mode = SCRUB_SW_SRC; in cpc925_probe()
981 mci->set_sdram_scrub_rate = NULL; in cpc925_probe()
982 mci->get_sdram_scrub_rate = cpc925_get_sdram_scrub_rate; in cpc925_probe()
1006 devm_release_mem_region(&pdev->dev, r->start, resource_size(r)); in cpc925_probe()
1008 devres_release_group(&pdev->dev, cpc925_probe); in cpc925_probe()
1024 edac_mc_del_mc(&pdev->dev); in cpc925_remove()