Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5f032119 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab
Browse files

i7300_edac: Fix error cleanup logic



The error cleanup logic was broken. Due to that, one error is generated for
every error polling.

Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 767ba4a5
Loading
Loading
Loading
Loading
+26 −25
Original line number Original line Diff line number Diff line
@@ -372,7 +372,7 @@ static const char *get_err_from_table(const char *table[], int size, int pos)
static void i7300_process_error_global(struct mem_ctl_info *mci)
static void i7300_process_error_global(struct mem_ctl_info *mci)
{
{
	struct i7300_pvt *pvt;
	struct i7300_pvt *pvt;
	u32 errnum, value;
	u32 errnum, error_reg;
	unsigned long errors;
	unsigned long errors;
	const char *specific;
	const char *specific;
	bool is_fatal;
	bool is_fatal;
@@ -381,9 +381,9 @@ static void i7300_process_error_global(struct mem_ctl_info *mci)


	/* read in the 1st FATAL error register */
	/* read in the 1st FATAL error register */
	pci_read_config_dword(pvt->pci_dev_16_2_fsb_err_regs,
	pci_read_config_dword(pvt->pci_dev_16_2_fsb_err_regs,
			      FERR_GLOBAL_HI, &value);
			      FERR_GLOBAL_HI, &error_reg);
	if (unlikely(value)) {
	if (unlikely(error_reg)) {
		errors = value;
		errors = error_reg;
		errnum = find_first_bit(&errors,
		errnum = find_first_bit(&errors,
					ARRAY_SIZE(ferr_global_hi_name));
					ARRAY_SIZE(ferr_global_hi_name));
		specific = GET_ERR_FROM_TABLE(ferr_global_hi_name, errnum);
		specific = GET_ERR_FROM_TABLE(ferr_global_hi_name, errnum);
@@ -391,15 +391,15 @@ static void i7300_process_error_global(struct mem_ctl_info *mci)


		/* Clear the error bit */
		/* Clear the error bit */
		pci_write_config_dword(pvt->pci_dev_16_2_fsb_err_regs,
		pci_write_config_dword(pvt->pci_dev_16_2_fsb_err_regs,
				       FERR_GLOBAL_HI, value);
				       FERR_GLOBAL_HI, error_reg);


		goto error_global;
		goto error_global;
	}
	}


	pci_read_config_dword(pvt->pci_dev_16_2_fsb_err_regs,
	pci_read_config_dword(pvt->pci_dev_16_2_fsb_err_regs,
			      FERR_GLOBAL_LO, &value);
			      FERR_GLOBAL_LO, &error_reg);
	if (unlikely(value)) {
	if (unlikely(error_reg)) {
		errors = value;
		errors = error_reg;
		errnum = find_first_bit(&errors,
		errnum = find_first_bit(&errors,
					ARRAY_SIZE(ferr_global_lo_name));
					ARRAY_SIZE(ferr_global_lo_name));
		specific = GET_ERR_FROM_TABLE(ferr_global_lo_name, errnum);
		specific = GET_ERR_FROM_TABLE(ferr_global_lo_name, errnum);
@@ -407,7 +407,7 @@ static void i7300_process_error_global(struct mem_ctl_info *mci)


		/* Clear the error bit */
		/* Clear the error bit */
		pci_write_config_dword(pvt->pci_dev_16_2_fsb_err_regs,
		pci_write_config_dword(pvt->pci_dev_16_2_fsb_err_regs,
				       FERR_GLOBAL_LO, value);
				       FERR_GLOBAL_LO, error_reg);


		goto error_global;
		goto error_global;
	}
	}
@@ -427,7 +427,7 @@ static void i7300_process_error_global(struct mem_ctl_info *mci)
static void i7300_process_fbd_error(struct mem_ctl_info *mci)
static void i7300_process_fbd_error(struct mem_ctl_info *mci)
{
{
	struct i7300_pvt *pvt;
	struct i7300_pvt *pvt;
	u32 errnum, value;
	u32 errnum, value, error_reg;
	u16 val16;
	u16 val16;
	unsigned branch, channel, bank, rank, cas, ras;
	unsigned branch, channel, bank, rank, cas, ras;
	u32 syndrome;
	u32 syndrome;
@@ -440,14 +440,14 @@ static void i7300_process_fbd_error(struct mem_ctl_info *mci)


	/* read in the 1st FATAL error register */
	/* read in the 1st FATAL error register */
	pci_read_config_dword(pvt->pci_dev_16_1_fsb_addr_map,
	pci_read_config_dword(pvt->pci_dev_16_1_fsb_addr_map,
			      FERR_FAT_FBD, &value);
			      FERR_FAT_FBD, &error_reg);
	if (unlikely(value & FERR_FAT_FBD_ERR_MASK)) {
	if (unlikely(error_reg & FERR_FAT_FBD_ERR_MASK)) {
		errors = value & FERR_FAT_FBD_ERR_MASK ;
		errors = error_reg & FERR_FAT_FBD_ERR_MASK ;
		errnum = find_first_bit(&errors,
		errnum = find_first_bit(&errors,
					ARRAY_SIZE(ferr_fat_fbd_name));
					ARRAY_SIZE(ferr_fat_fbd_name));
		specific = GET_ERR_FROM_TABLE(ferr_fat_fbd_name, errnum);
		specific = GET_ERR_FROM_TABLE(ferr_fat_fbd_name, errnum);
		branch = (GET_FBD_FAT_IDX(error_reg) == 2) ? 1 : 0;


		branch = (GET_FBD_FAT_IDX(value) == 2) ? 1 : 0;
		pci_read_config_word(pvt->pci_dev_16_1_fsb_addr_map,
		pci_read_config_word(pvt->pci_dev_16_1_fsb_addr_map,
				     NRECMEMA, &val16);
				     NRECMEMA, &val16);
		bank = NRECMEMA_BANK(val16);
		bank = NRECMEMA_BANK(val16);
@@ -455,11 +455,14 @@ static void i7300_process_fbd_error(struct mem_ctl_info *mci)


		pci_read_config_dword(pvt->pci_dev_16_1_fsb_addr_map,
		pci_read_config_dword(pvt->pci_dev_16_1_fsb_addr_map,
				NRECMEMB, &value);
				NRECMEMB, &value);

		is_wr = NRECMEMB_IS_WR(value);
		is_wr = NRECMEMB_IS_WR(value);
		cas = NRECMEMB_CAS(value);
		cas = NRECMEMB_CAS(value);
		ras = NRECMEMB_RAS(value);
		ras = NRECMEMB_RAS(value);


		/* Clean the error register */
		pci_write_config_dword(pvt->pci_dev_16_1_fsb_addr_map,
				FERR_FAT_FBD, error_reg);

		snprintf(pvt->tmp_prt_buffer, PAGE_SIZE,
		snprintf(pvt->tmp_prt_buffer, PAGE_SIZE,
			"FATAL (Branch=%d DRAM-Bank=%d %s "
			"FATAL (Branch=%d DRAM-Bank=%d %s "
			"RAS=%d CAS=%d Err=0x%lx (%s))",
			"RAS=%d CAS=%d Err=0x%lx (%s))",
@@ -476,21 +479,17 @@ static void i7300_process_fbd_error(struct mem_ctl_info *mci)


	/* read in the 1st NON-FATAL error register */
	/* read in the 1st NON-FATAL error register */
	pci_read_config_dword(pvt->pci_dev_16_1_fsb_addr_map,
	pci_read_config_dword(pvt->pci_dev_16_1_fsb_addr_map,
			      FERR_NF_FBD, &value);
			      FERR_NF_FBD, &error_reg);
	if (unlikely(value & FERR_NF_FBD_ERR_MASK)) {
	if (unlikely(error_reg & FERR_NF_FBD_ERR_MASK)) {
		errors = value & FERR_NF_FBD_ERR_MASK;
		errors = error_reg & FERR_NF_FBD_ERR_MASK;
		errnum = find_first_bit(&errors,
		errnum = find_first_bit(&errors,
					ARRAY_SIZE(ferr_nf_fbd_name));
					ARRAY_SIZE(ferr_nf_fbd_name));
		specific = GET_ERR_FROM_TABLE(ferr_nf_fbd_name, errnum);
		specific = GET_ERR_FROM_TABLE(ferr_nf_fbd_name, errnum);

		branch = (GET_FBD_FAT_IDX(error_reg) == 2) ? 1 : 0;
		/* Clear the error bit */
		pci_write_config_dword(pvt->pci_dev_16_2_fsb_err_regs,
				       FERR_GLOBAL_LO, value);


		pci_read_config_dword(pvt->pci_dev_16_1_fsb_addr_map,
		pci_read_config_dword(pvt->pci_dev_16_1_fsb_addr_map,
			REDMEMA, &syndrome);
			REDMEMA, &syndrome);


		branch = (GET_FBD_FAT_IDX(value) == 2) ? 1 : 0;
		pci_read_config_word(pvt->pci_dev_16_1_fsb_addr_map,
		pci_read_config_word(pvt->pci_dev_16_1_fsb_addr_map,
				     RECMEMA, &val16);
				     RECMEMA, &val16);
		bank = RECMEMA_BANK(val16);
		bank = RECMEMA_BANK(val16);
@@ -498,18 +497,20 @@ static void i7300_process_fbd_error(struct mem_ctl_info *mci)


		pci_read_config_dword(pvt->pci_dev_16_1_fsb_addr_map,
		pci_read_config_dword(pvt->pci_dev_16_1_fsb_addr_map,
				RECMEMB, &value);
				RECMEMB, &value);

		is_wr = RECMEMB_IS_WR(value);
		is_wr = RECMEMB_IS_WR(value);
		cas = RECMEMB_CAS(value);
		cas = RECMEMB_CAS(value);
		ras = RECMEMB_RAS(value);
		ras = RECMEMB_RAS(value);


		pci_read_config_dword(pvt->pci_dev_16_1_fsb_addr_map,
		pci_read_config_dword(pvt->pci_dev_16_1_fsb_addr_map,
				     REDMEMB, &value);
				     REDMEMB, &value);

		channel = (branch << 1);
		channel = (branch << 1);
		if (IS_SECOND_CH(value))
		if (IS_SECOND_CH(value))
			channel++;
			channel++;


		/* Clear the error bit */
		pci_write_config_dword(pvt->pci_dev_16_1_fsb_addr_map,
				FERR_NF_FBD, error_reg);

		/* Form out message */
		/* Form out message */
		snprintf(pvt->tmp_prt_buffer, PAGE_SIZE,
		snprintf(pvt->tmp_prt_buffer, PAGE_SIZE,
			"Corrected error (Branch=%d, Channel %d), "
			"Corrected error (Branch=%d, Channel %d), "