diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-06-22 21:48:30 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-05-10 10:44:47 -0400 |
commit | 1c6fed808f1ccd0804786e87f6b2c907dcd730fa (patch) | |
tree | cb1970e2c31f1a85afbdf9bb25ebb70ba118fff6 /drivers | |
parent | ef708b53b98f2b53d9686a9f8f0b8d437952c295 (diff) |
i7core_edac: Properly fill struct csrow_info
Thanks-to: Aristeu Rozanski <aris@redhat.com> for part of the code
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/edac/i7core_edac.c | 48 |
1 files changed, 38 insertions, 10 deletions
diff --git a/drivers/edac/i7core_edac.c b/drivers/edac/i7core_edac.c index bfa462f6fa0e..556a150e645b 100644 --- a/drivers/edac/i7core_edac.c +++ b/drivers/edac/i7core_edac.c | |||
@@ -348,13 +348,17 @@ static int i7core_get_active_channels(int *channels) | |||
348 | (*channels)++; | 348 | (*channels)++; |
349 | } | 349 | } |
350 | 350 | ||
351 | debugf0("Number of active channels: %d\n", *channels); | ||
352 | |||
351 | return 0; | 353 | return 0; |
352 | } | 354 | } |
353 | 355 | ||
354 | static int get_dimm_config(struct mem_ctl_info *mci) | 356 | static int get_dimm_config(struct mem_ctl_info *mci) |
355 | { | 357 | { |
356 | struct i7core_pvt *pvt = mci->pvt_info; | 358 | struct i7core_pvt *pvt = mci->pvt_info; |
357 | int i; | 359 | struct csrow_info *csr; |
360 | int i, csrow = 0; | ||
361 | enum edac_type mode; | ||
358 | 362 | ||
359 | if (!pvt->pci_mcr[0]) | 363 | if (!pvt->pci_mcr[0]) |
360 | return -ENODEV; | 364 | return -ENODEV; |
@@ -365,7 +369,7 @@ static int get_dimm_config(struct mem_ctl_info *mci) | |||
365 | pci_read_config_dword(pvt->pci_mcr[0], MC_STATUS, | 369 | pci_read_config_dword(pvt->pci_mcr[0], MC_STATUS, |
366 | &pvt->info.mc_status); | 370 | &pvt->info.mc_status); |
367 | pci_read_config_dword(pvt->pci_mcr[0], MC_MAX_DOD, | 371 | pci_read_config_dword(pvt->pci_mcr[0], MC_MAX_DOD, |
368 | &pvt->info.max_dod); | 372 | &pvt->info.max_dod); |
369 | pci_read_config_dword(pvt->pci_mcr[0], MC_CHANNEL_MAPPER, | 373 | pci_read_config_dword(pvt->pci_mcr[0], MC_CHANNEL_MAPPER, |
370 | &pvt->info.ch_map); | 374 | &pvt->info.ch_map); |
371 | 375 | ||
@@ -373,10 +377,16 @@ static int get_dimm_config(struct mem_ctl_info *mci) | |||
373 | pvt->info.mc_control, pvt->info.mc_status, | 377 | pvt->info.mc_control, pvt->info.mc_status, |
374 | pvt->info.max_dod, pvt->info.ch_map); | 378 | pvt->info.max_dod, pvt->info.ch_map); |
375 | 379 | ||
376 | if (ECC_ENABLED(pvt)) | 380 | if (ECC_ENABLED(pvt)) { |
377 | debugf0("ECC enabled with x%d SDCC\n", ECCx8(pvt)?8:4); | 381 | debugf0("ECC enabled with x%d SDCC\n", ECCx8(pvt)?8:4); |
378 | else | 382 | if (ECCx8(pvt)) |
383 | mode = EDAC_S8ECD8ED; | ||
384 | else | ||
385 | mode = EDAC_S4ECD4ED; | ||
386 | } else { | ||
379 | debugf0("ECC disabled\n"); | 387 | debugf0("ECC disabled\n"); |
388 | mode = EDAC_NONE; | ||
389 | } | ||
380 | 390 | ||
381 | /* FIXME: need to handle the error codes */ | 391 | /* FIXME: need to handle the error codes */ |
382 | debugf0("DOD Maximum limits: DIMMS: %d, %d-ranked, %d-banked\n", | 392 | debugf0("DOD Maximum limits: DIMMS: %d, %d-ranked, %d-banked\n", |
@@ -411,13 +421,31 @@ static int get_dimm_config(struct mem_ctl_info *mci) | |||
411 | else | 421 | else |
412 | pvt->channel[i].dimms = 2; | 422 | pvt->channel[i].dimms = 2; |
413 | 423 | ||
414 | debugf0("Ch%d (0x%08x): rd ch %d, wr ch %d, " | 424 | debugf0("Ch%d phy rd%d, wr%d (0x%08x): " |
415 | "%d ranks, %d %cDIMMs\n", | 425 | "%d ranks, %d %cDIMMs, offset = %d\n", |
416 | i, data, | 426 | i, |
417 | RDLCH(pvt->info.ch_map, i), | 427 | RDLCH(pvt->info.ch_map, i), WRLCH(pvt->info.ch_map, i), |
418 | WRLCH(pvt->info.ch_map, i), | 428 | data, |
419 | pvt->channel[i].ranks, pvt->channel[i].dimms, | 429 | pvt->channel[i].ranks, pvt->channel[i].dimms, |
420 | (data & REGISTERED_DIMM)? 'R' : 'U' ); | 430 | (data & REGISTERED_DIMM)? 'R' : 'U', |
431 | RANKOFFSET(data)); | ||
432 | |||
433 | csr = &mci->csrows[csrow]; | ||
434 | csr->first_page = 0; | ||
435 | csr->last_page = 0; | ||
436 | csr->page_mask = 0; | ||
437 | csr->nr_pages = 0; | ||
438 | csr->grain = 0; | ||
439 | csr->csrow_idx = csrow; | ||
440 | csr->dtype = DEV_X8; /* FIXME: check this */ | ||
441 | |||
442 | if (data & REGISTERED_DIMM) | ||
443 | csr->mtype = MEM_RDDR3; | ||
444 | else | ||
445 | csr->mtype = MEM_DDR3; | ||
446 | csr->edac_mode = mode; | ||
447 | |||
448 | csrow++; | ||
421 | } | 449 | } |
422 | 450 | ||
423 | return 0; | 451 | return 0; |