diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-02-15 07:06:38 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-02-25 17:42:15 -0500 |
commit | d2a6856614fd34e36352146307a5655efbdbc14d (patch) | |
tree | eafad59b7e82e3da7622dcbf5233c5482bbcf3bf /drivers/edac/ghes_edac.c | |
parent | 5ee726db521fddf991f261e5c45e04a7d2bf1bc1 (diff) |
ghes_edac: Improve driver's printk messages
Provide a better infrastructure for printk's inside the driver:
- use edac_dbg() for debug messages;
- standardize the usage of pr_info();
- provide warning about the risk of relying on this
driver.
While here, changes the size of a fake memory to 1 page. This is
as good or as bad as 1000 pages, but it is easier for userspace to
detect, as I don't expect that any machine implementing GHES would
provide just 1 page available ;)
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Conflicts:
drivers/edac/ghes_edac.c
Diffstat (limited to 'drivers/edac/ghes_edac.c')
-rw-r--r-- | drivers/edac/ghes_edac.c | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/drivers/edac/ghes_edac.c b/drivers/edac/ghes_edac.c index fb866804820c..b4acc4f2074d 100644 --- a/drivers/edac/ghes_edac.c +++ b/drivers/edac/ghes_edac.c | |||
@@ -9,12 +9,13 @@ | |||
9 | * Red Hat Inc. http://www.redhat.com | 9 | * Red Hat Inc. http://www.redhat.com |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
13 | |||
12 | #include <acpi/ghes.h> | 14 | #include <acpi/ghes.h> |
13 | #include <linux/edac.h> | 15 | #include <linux/edac.h> |
14 | #include <linux/dmi.h> | 16 | #include <linux/dmi.h> |
15 | #include "edac_core.h" | 17 | #include "edac_core.h" |
16 | 18 | ||
17 | #define GHES_PFX "ghes_edac: " | ||
18 | #define GHES_EDAC_REVISION " Ver: 1.0.0" | 19 | #define GHES_EDAC_REVISION " Ver: 1.0.0" |
19 | 20 | ||
20 | struct ghes_edac_pvt { | 21 | struct ghes_edac_pvt { |
@@ -27,6 +28,7 @@ static LIST_HEAD(ghes_reglist); | |||
27 | static DEFINE_MUTEX(ghes_edac_lock); | 28 | static DEFINE_MUTEX(ghes_edac_lock); |
28 | static int ghes_edac_mc_num; | 29 | static int ghes_edac_mc_num; |
29 | 30 | ||
31 | |||
30 | /* Memory Device - Type 17 of SMBIOS spec */ | 32 | /* Memory Device - Type 17 of SMBIOS spec */ |
31 | struct memdev_dmi_entry { | 33 | struct memdev_dmi_entry { |
32 | u8 type; | 34 | u8 type; |
@@ -98,7 +100,8 @@ static void ghes_edac_dmidecode(const struct dmi_header *dh, void *arg) | |||
98 | dimm_fill->count, 0, 0); | 100 | dimm_fill->count, 0, 0); |
99 | 101 | ||
100 | if (entry->size == 0xffff) { | 102 | if (entry->size == 0xffff) { |
101 | pr_info(GHES_PFX "Can't get dimm size\n"); | 103 | pr_info("Can't get DIMM%i size\n", |
104 | dimm_fill->count); | ||
102 | dimm->nr_pages = MiB_TO_PAGES(32);/* Unknown */ | 105 | dimm->nr_pages = MiB_TO_PAGES(32);/* Unknown */ |
103 | } else if (entry->size == 0x7fff) { | 106 | } else if (entry->size == 0x7fff) { |
104 | dimm->nr_pages = MiB_TO_PAGES(entry->extended_size); | 107 | dimm->nr_pages = MiB_TO_PAGES(entry->extended_size); |
@@ -163,11 +166,11 @@ static void ghes_edac_dmidecode(const struct dmi_header *dh, void *arg) | |||
163 | */ | 166 | */ |
164 | 167 | ||
165 | if (dimm->nr_pages) { | 168 | if (dimm->nr_pages) { |
166 | pr_info(GHES_PFX "DIMM%i: %s size = %d MB%s\n", | 169 | edac_dbg(1, "DIMM%i: %s size = %d MB%s\n", |
167 | dimm_fill->count, memory_type[dimm->mtype], | 170 | dimm_fill->count, memory_type[dimm->mtype], |
168 | PAGES_TO_MiB(dimm->nr_pages), | 171 | PAGES_TO_MiB(dimm->nr_pages), |
169 | (dimm->edac_mode != EDAC_NONE) ? "(ECC)" : ""); | 172 | (dimm->edac_mode != EDAC_NONE) ? "(ECC)" : ""); |
170 | pr_info(GHES_PFX "\ttype %d, detail 0x%02x, width %d(total %d)\n", | 173 | edac_dbg(2, "\ttype %d, detail 0x%02x, width %d(total %d)\n", |
171 | entry->memory_type, entry->type_detail, | 174 | entry->memory_type, entry->type_detail, |
172 | entry->total_width, entry->data_width); | 175 | entry->total_width, entry->data_width); |
173 | } | 176 | } |
@@ -261,12 +264,10 @@ int ghes_edac_register(struct ghes *ghes, struct device *dev) | |||
261 | * to avoid duplicated memory controller numbers | 264 | * to avoid duplicated memory controller numbers |
262 | */ | 265 | */ |
263 | mutex_lock(&ghes_edac_lock); | 266 | mutex_lock(&ghes_edac_lock); |
264 | pr_info("ghes_edac#%d: allocating space for %d dimms\n", | ||
265 | ghes_edac_mc_num, num_dimm); | ||
266 | mci = edac_mc_alloc(ghes_edac_mc_num, ARRAY_SIZE(layers), layers, | 267 | mci = edac_mc_alloc(ghes_edac_mc_num, ARRAY_SIZE(layers), layers, |
267 | sizeof(*pvt)); | 268 | sizeof(*pvt)); |
268 | if (!mci) { | 269 | if (!mci) { |
269 | pr_info(GHES_PFX "Can't allocate memory for EDAC data\n"); | 270 | pr_info("Can't allocate memory for EDAC data\n"); |
270 | mutex_unlock(&ghes_edac_lock); | 271 | mutex_unlock(&ghes_edac_lock); |
271 | return -ENOMEM; | 272 | return -ENOMEM; |
272 | } | 273 | } |
@@ -286,6 +287,22 @@ int ghes_edac_register(struct ghes *ghes, struct device *dev) | |||
286 | mci->ctl_name = "ghes_edac"; | 287 | mci->ctl_name = "ghes_edac"; |
287 | mci->dev_name = "ghes"; | 288 | mci->dev_name = "ghes"; |
288 | 289 | ||
290 | if (!ghes_edac_mc_num) { | ||
291 | if (!fake) { | ||
292 | pr_info("This EDAC driver relies on BIOS to enumerate memory and get error reports.\n"); | ||
293 | pr_info("Unfortunately, not all BIOSes reflect the memory layout correctly.\n"); | ||
294 | pr_info("So, the end result of using this driver varies from vendor to vendor.\n"); | ||
295 | pr_info("If you find incorrect reports, please contact your hardware vendor\n"); | ||
296 | pr_info("to correct its BIOS.\n"); | ||
297 | pr_info("This system has %d DIMM sockets.\n", | ||
298 | num_dimm); | ||
299 | } else { | ||
300 | pr_info("This system has a very crappy BIOS: It doesn't even list the DIMMS.\n"); | ||
301 | pr_info("Its SMBIOS info is wrong. It is doubtful that the error report would\n"); | ||
302 | pr_info("work on such system. Use this driver with caution\n"); | ||
303 | } | ||
304 | } | ||
305 | |||
289 | if (!fake) { | 306 | if (!fake) { |
290 | /* | 307 | /* |
291 | * Fill DIMM info from DMI for the memory controller #0 | 308 | * Fill DIMM info from DMI for the memory controller #0 |
@@ -304,8 +321,7 @@ int ghes_edac_register(struct ghes *ghes, struct device *dev) | |||
304 | struct dimm_info *dimm = EDAC_DIMM_PTR(mci->layers, mci->dimms, | 321 | struct dimm_info *dimm = EDAC_DIMM_PTR(mci->layers, mci->dimms, |
305 | mci->n_layers, 0, 0, 0); | 322 | mci->n_layers, 0, 0, 0); |
306 | 323 | ||
307 | pr_info(GHES_PFX "Crappy BIOS detected. Faking DIMM EDAC data\n"); | 324 | dimm->nr_pages = 1; |
308 | dimm->nr_pages = 1000; | ||
309 | dimm->grain = 128; | 325 | dimm->grain = 128; |
310 | dimm->mtype = MEM_UNKNOWN; | 326 | dimm->mtype = MEM_UNKNOWN; |
311 | dimm->dtype = DEV_UNKNOWN; | 327 | dimm->dtype = DEV_UNKNOWN; |
@@ -314,7 +330,7 @@ int ghes_edac_register(struct ghes *ghes, struct device *dev) | |||
314 | 330 | ||
315 | rc = edac_mc_add_mc(mci); | 331 | rc = edac_mc_add_mc(mci); |
316 | if (rc < 0) { | 332 | if (rc < 0) { |
317 | pr_info(GHES_PFX "Can't register at EDAC core\n"); | 333 | pr_info("Can't register at EDAC core\n"); |
318 | edac_mc_free(mci); | 334 | edac_mc_free(mci); |
319 | mutex_unlock(&ghes_edac_lock); | 335 | mutex_unlock(&ghes_edac_lock); |
320 | return -ENODEV; | 336 | return -ENODEV; |