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

Commit de4772c6 authored by Tony Luck's avatar Tony Luck Committed by Mauro Carvalho Chehab
Browse files

edac: sb_edac.c should not require prescence of IMC_DDRIO device



The Sandy Bridge EDAC driver uses a register in the IMC_DDRIO CSR
space to determine the type of DIMMs (registered or unregistered).
But this device does not exist on some single socket Sandy Bridge
servers.  While the type of DIMMs is nice to know, it is not essential
for this driver's other functions. So it seems harsh to have it
refuse to load at all when it cannot find this device.

Make the check for this device be optional. If it isn't present
just report the memory type as "MEM_UNKNOWN".

Signed-off-by: default avatarTony Luck <tony.luck@intel.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 33ad4126
Loading
Loading
Loading
Loading
+29 −24
Original line number Original line Diff line number Diff line
@@ -331,30 +331,31 @@ struct sbridge_pvt {
	u64			tolm, tohm;
	u64			tolm, tohm;
};
};


#define PCI_DESCR(device, function, device_id)	\
#define PCI_DESCR(device, function, device_id, opt)	\
	.dev = (device),				\
	.dev = (device),				\
	.func = (function),				\
	.func = (function),				\
	.dev_id = (device_id)
	.dev_id = (device_id),				\
	.optional = opt


static const struct pci_id_descr pci_dev_descr_sbridge[] = {
static const struct pci_id_descr pci_dev_descr_sbridge[] = {
		/* Processor Home Agent */
		/* Processor Home Agent */
	{ PCI_DESCR(14, 0, PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_HA0)		},
	{ PCI_DESCR(14, 0, PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_HA0, 0)	},


		/* Memory controller */
		/* Memory controller */
	{ PCI_DESCR(15, 0, PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_TA)		},
	{ PCI_DESCR(15, 0, PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_TA, 0)	},
	{ PCI_DESCR(15, 1, PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_RAS)		},
	{ PCI_DESCR(15, 1, PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_RAS, 0)	},
	{ PCI_DESCR(15, 2, PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_TAD0)	},
	{ PCI_DESCR(15, 2, PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_TAD0, 0)	},
	{ PCI_DESCR(15, 3, PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_TAD1)	},
	{ PCI_DESCR(15, 3, PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_TAD1, 0)	},
	{ PCI_DESCR(15, 4, PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_TAD2)	},
	{ PCI_DESCR(15, 4, PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_TAD2, 0)	},
	{ PCI_DESCR(15, 5, PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_TAD3)	},
	{ PCI_DESCR(15, 5, PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_TAD3, 0)	},
	{ PCI_DESCR(17, 0, PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_DDRIO)	},
	{ PCI_DESCR(17, 0, PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_DDRIO, 1)	},


		/* System Address Decoder */
		/* System Address Decoder */
	{ PCI_DESCR(12, 6, PCI_DEVICE_ID_INTEL_SBRIDGE_SAD0)		},
	{ PCI_DESCR(12, 6, PCI_DEVICE_ID_INTEL_SBRIDGE_SAD0, 0)		},
	{ PCI_DESCR(12, 7, PCI_DEVICE_ID_INTEL_SBRIDGE_SAD1)		},
	{ PCI_DESCR(12, 7, PCI_DEVICE_ID_INTEL_SBRIDGE_SAD1, 0)		},


		/* Broadcast Registers */
		/* Broadcast Registers */
	{ PCI_DESCR(13, 6, PCI_DEVICE_ID_INTEL_SBRIDGE_BR)		},
	{ PCI_DESCR(13, 6, PCI_DEVICE_ID_INTEL_SBRIDGE_BR, 0)		},
};
};


#define PCI_ID_TABLE_ENTRY(A) { .descr=A, .n_devs = ARRAY_SIZE(A) }
#define PCI_ID_TABLE_ENTRY(A) { .descr=A, .n_devs = ARRAY_SIZE(A) }
@@ -556,6 +557,7 @@ static int get_dimm_config(struct mem_ctl_info *mci)
		pvt->is_close_pg = false;
		pvt->is_close_pg = false;
	}
	}


	if (pvt->pci_ddrio) {
		pci_read_config_dword(pvt->pci_ddrio, RANK_CFG_A, &reg);
		pci_read_config_dword(pvt->pci_ddrio, RANK_CFG_A, &reg);
		if (IS_RDIMM_ENABLED(reg)) {
		if (IS_RDIMM_ENABLED(reg)) {
			/* FIXME: Can also be LRDIMM */
			/* FIXME: Can also be LRDIMM */
@@ -565,6 +567,10 @@ static int get_dimm_config(struct mem_ctl_info *mci)
			edac_dbg(0, "Memory is unregistered\n");
			edac_dbg(0, "Memory is unregistered\n");
			mtype = MEM_DDR3;
			mtype = MEM_DDR3;
		}
		}
	} else {
		edac_dbg(0, "Cannot determine memory type\n");
		mtype = MEM_UNKNOWN;
	}


	/* On all supported DDR3 DIMM types, there are 8 banks available */
	/* On all supported DDR3 DIMM types, there are 8 banks available */
	banks = 8;
	banks = 8;
@@ -1303,8 +1309,7 @@ static int mci_bind_devs(struct mem_ctl_info *mci,


	/* Check if everything were registered */
	/* Check if everything were registered */
	if (!pvt->pci_sad0 || !pvt->pci_sad1 || !pvt->pci_ha0 ||
	if (!pvt->pci_sad0 || !pvt->pci_sad1 || !pvt->pci_ha0 ||
	    !pvt-> pci_tad || !pvt->pci_ras  || !pvt->pci_ta ||
	    !pvt-> pci_tad || !pvt->pci_ras  || !pvt->pci_ta)
	    !pvt->pci_ddrio)
		goto enodev;
		goto enodev;


	for (i = 0; i < NUM_CHANNELS; i++) {
	for (i = 0; i < NUM_CHANNELS; i++) {