12f768af7SAlan Cox /* 22f768af7SAlan Cox * Radisys 82600 Embedded chipset Memory Controller kernel module 32f768af7SAlan Cox * (C) 2005 EADS Astrium 42f768af7SAlan Cox * This file may be distributed under the terms of the 52f768af7SAlan Cox * GNU General Public License. 62f768af7SAlan Cox * 72f768af7SAlan Cox * Written by Tim Small <tim@buttersideup.com>, based on work by Thayne 82f768af7SAlan Cox * Harbaugh, Dan Hollis <goemon at anime dot net> and others. 92f768af7SAlan Cox * 102f768af7SAlan Cox * $Id: edac_r82600.c,v 1.1.2.6 2005/10/05 00:43:44 dsp_llnl Exp $ 112f768af7SAlan Cox * 122f768af7SAlan Cox * Written with reference to 82600 High Integration Dual PCI System 132f768af7SAlan Cox * Controller Data Book: 14c4192705SDave Jiang * www.radisys.com/files/support_downloads/007-01277-0002.82600DataBook.pdf 152f768af7SAlan Cox * references to this document given in [] 162f768af7SAlan Cox */ 172f768af7SAlan Cox 182f768af7SAlan Cox #include <linux/module.h> 192f768af7SAlan Cox #include <linux/init.h> 202f768af7SAlan Cox #include <linux/pci.h> 212f768af7SAlan Cox #include <linux/pci_ids.h> 22c3c52bceSHitoshi Mitake #include <linux/edac.h> 2320bcb7a8SDouglas Thompson #include "edac_core.h" 242f768af7SAlan Cox 25152ba394SMichal Marek #define R82600_REVISION " Ver: 2.0.2" 26929a40ecSDoug Thompson #define EDAC_MOD_STR "r82600_edac" 2737f04581SDoug Thompson 28537fba28SDave Peterson #define r82600_printk(level, fmt, arg...) \ 29537fba28SDave Peterson edac_printk(level, "r82600", fmt, ##arg) 30537fba28SDave Peterson 31537fba28SDave Peterson #define r82600_mc_printk(mci, level, fmt, arg...) \ 32537fba28SDave Peterson edac_mc_chipset_printk(mci, level, "r82600", fmt, ##arg) 33537fba28SDave Peterson 342f768af7SAlan Cox /* Radisys say "The 82600 integrates a main memory SDRAM controller that 352f768af7SAlan Cox * supports up to four banks of memory. The four banks can support a mix of 362f768af7SAlan Cox * sizes of 64 bit wide (72 bits with ECC) Synchronous DRAM (SDRAM) DIMMs, 372f768af7SAlan Cox * each of which can be any size from 16MB to 512MB. Both registered (control 382f768af7SAlan Cox * signals buffered) and unbuffered DIMM types are supported. Mixing of 392f768af7SAlan Cox * registered and unbuffered DIMMs as well as mixing of ECC and non-ECC DIMMs 402f768af7SAlan Cox * is not allowed. The 82600 SDRAM interface operates at the same frequency as 412f768af7SAlan Cox * the CPU bus, 66MHz, 100MHz or 133MHz." 422f768af7SAlan Cox */ 432f768af7SAlan Cox 442f768af7SAlan Cox #define R82600_NR_CSROWS 4 452f768af7SAlan Cox #define R82600_NR_CHANS 1 462f768af7SAlan Cox #define R82600_NR_DIMMS 4 472f768af7SAlan Cox 482f768af7SAlan Cox #define R82600_BRIDGE_ID 0x8200 492f768af7SAlan Cox 502f768af7SAlan Cox /* Radisys 82600 register addresses - device 0 function 0 - PCI bridge */ 512f768af7SAlan Cox #define R82600_DRAMC 0x57 /* Various SDRAM related control bits 522f768af7SAlan Cox * all bits are R/W 532f768af7SAlan Cox * 542f768af7SAlan Cox * 7 SDRAM ISA Hole Enable 552f768af7SAlan Cox * 6 Flash Page Mode Enable 562f768af7SAlan Cox * 5 ECC Enable: 1=ECC 0=noECC 572f768af7SAlan Cox * 4 DRAM DIMM Type: 1= 582f768af7SAlan Cox * 3 BIOS Alias Disable 592f768af7SAlan Cox * 2 SDRAM BIOS Flash Write Enable 602f768af7SAlan Cox * 1:0 SDRAM Refresh Rate: 00=Disabled 612f768af7SAlan Cox * 01=7.8usec (256Mbit SDRAMs) 622f768af7SAlan Cox * 10=15.6us 11=125usec 632f768af7SAlan Cox */ 642f768af7SAlan Cox 652f768af7SAlan Cox #define R82600_SDRAMC 0x76 /* "SDRAM Control Register" 662f768af7SAlan Cox * More SDRAM related control bits 672f768af7SAlan Cox * all bits are R/W 682f768af7SAlan Cox * 692f768af7SAlan Cox * 15:8 Reserved. 702f768af7SAlan Cox * 712f768af7SAlan Cox * 7:5 Special SDRAM Mode Select 722f768af7SAlan Cox * 732f768af7SAlan Cox * 4 Force ECC 742f768af7SAlan Cox * 752f768af7SAlan Cox * 1=Drive ECC bits to 0 during 762f768af7SAlan Cox * write cycles (i.e. ECC test mode) 772f768af7SAlan Cox * 782f768af7SAlan Cox * 0=Normal ECC functioning 792f768af7SAlan Cox * 802f768af7SAlan Cox * 3 Enhanced Paging Enable 812f768af7SAlan Cox * 822f768af7SAlan Cox * 2 CAS# Latency 0=3clks 1=2clks 832f768af7SAlan Cox * 842f768af7SAlan Cox * 1 RAS# to CAS# Delay 0=3 1=2 852f768af7SAlan Cox * 862f768af7SAlan Cox * 0 RAS# Precharge 0=3 1=2 872f768af7SAlan Cox */ 882f768af7SAlan Cox 892f768af7SAlan Cox #define R82600_EAP 0x80 /* ECC Error Address Pointer Register 902f768af7SAlan Cox * 912f768af7SAlan Cox * 31 Disable Hardware Scrubbing (RW) 922f768af7SAlan Cox * 0=Scrub on corrected read 932f768af7SAlan Cox * 1=Don't scrub on corrected read 942f768af7SAlan Cox * 952f768af7SAlan Cox * 30:12 Error Address Pointer (RO) 962f768af7SAlan Cox * Upper 19 bits of error address 972f768af7SAlan Cox * 982f768af7SAlan Cox * 11:4 Syndrome Bits (RO) 992f768af7SAlan Cox * 1002f768af7SAlan Cox * 3 BSERR# on multibit error (RW) 1012f768af7SAlan Cox * 1=enable 0=disable 1022f768af7SAlan Cox * 1032f768af7SAlan Cox * 2 NMI on Single Bit Eror (RW) 1042f768af7SAlan Cox * 1=NMI triggered by SBE n.b. other 1052f768af7SAlan Cox * prerequeists 1062f768af7SAlan Cox * 0=NMI not triggered 1072f768af7SAlan Cox * 1082f768af7SAlan Cox * 1 MBE (R/WC) 1092f768af7SAlan Cox * read 1=MBE at EAP (see above) 1102f768af7SAlan Cox * read 0=no MBE, or SBE occurred first 1112f768af7SAlan Cox * write 1=Clear MBE status (must also 1122f768af7SAlan Cox * clear SBE) 1132f768af7SAlan Cox * write 0=NOP 1142f768af7SAlan Cox * 1152f768af7SAlan Cox * 1 SBE (R/WC) 1162f768af7SAlan Cox * read 1=SBE at EAP (see above) 1172f768af7SAlan Cox * read 0=no SBE, or MBE occurred first 1182f768af7SAlan Cox * write 1=Clear SBE status (must also 1192f768af7SAlan Cox * clear MBE) 1202f768af7SAlan Cox * write 0=NOP 1212f768af7SAlan Cox */ 1222f768af7SAlan Cox 12325985edcSLucas De Marchi #define R82600_DRBA 0x60 /* + 0x60..0x63 SDRAM Row Boundary Address 1242f768af7SAlan Cox * Registers 1252f768af7SAlan Cox * 1262f768af7SAlan Cox * 7:0 Address lines 30:24 - upper limit of 1272f768af7SAlan Cox * each row [p57] 1282f768af7SAlan Cox */ 1292f768af7SAlan Cox 1302f768af7SAlan Cox struct r82600_error_info { 1312f768af7SAlan Cox u32 eapr; 1322f768af7SAlan Cox }; 1332f768af7SAlan Cox 13490ab5ee9SRusty Russell static bool disable_hardware_scrub; 1352f768af7SAlan Cox 136456a2f95SDave Jiang static struct edac_pci_ctl_info *r82600_pci; 137456a2f95SDave Jiang 1382f768af7SAlan Cox static void r82600_get_error_info(struct mem_ctl_info *mci, 1392f768af7SAlan Cox struct r82600_error_info *info) 1402f768af7SAlan Cox { 14137f04581SDoug Thompson struct pci_dev *pdev; 14237f04581SDoug Thompson 143fd687502SMauro Carvalho Chehab pdev = to_pci_dev(mci->pdev); 14437f04581SDoug Thompson pci_read_config_dword(pdev, R82600_EAP, &info->eapr); 1452f768af7SAlan Cox 1462f768af7SAlan Cox if (info->eapr & BIT(0)) 1472f768af7SAlan Cox /* Clear error to allow next error to be reported [p.62] */ 14837f04581SDoug Thompson pci_write_bits32(pdev, R82600_EAP, 1492f768af7SAlan Cox ((u32) BIT(0) & (u32) BIT(1)), 1502f768af7SAlan Cox ((u32) BIT(0) & (u32) BIT(1))); 1512f768af7SAlan Cox 1522f768af7SAlan Cox if (info->eapr & BIT(1)) 1532f768af7SAlan Cox /* Clear error to allow next error to be reported [p.62] */ 15437f04581SDoug Thompson pci_write_bits32(pdev, R82600_EAP, 1552f768af7SAlan Cox ((u32) BIT(0) & (u32) BIT(1)), 1562f768af7SAlan Cox ((u32) BIT(0) & (u32) BIT(1))); 1572f768af7SAlan Cox } 1582f768af7SAlan Cox 1592f768af7SAlan Cox static int r82600_process_error_info(struct mem_ctl_info *mci, 160cddbfcacSDouglas Thompson struct r82600_error_info *info, 161cddbfcacSDouglas Thompson int handle_errors) 1622f768af7SAlan Cox { 1632f768af7SAlan Cox int error_found; 1642f768af7SAlan Cox u32 eapaddr, page; 1652f768af7SAlan Cox u32 syndrome; 1662f768af7SAlan Cox 1672f768af7SAlan Cox error_found = 0; 1682f768af7SAlan Cox 1692f768af7SAlan Cox /* bits 30:12 store the upper 19 bits of the 32 bit error address */ 1702f768af7SAlan Cox eapaddr = ((info->eapr >> 12) & 0x7FFF) << 13; 1712f768af7SAlan Cox /* Syndrome in bits 11:4 [p.62] */ 1722f768af7SAlan Cox syndrome = (info->eapr >> 4) & 0xFF; 1732f768af7SAlan Cox 1742f768af7SAlan Cox /* the R82600 reports at less than page * 1752f768af7SAlan Cox * granularity (upper 19 bits only) */ 1762f768af7SAlan Cox page = eapaddr >> PAGE_SHIFT; 1772f768af7SAlan Cox 1782f768af7SAlan Cox if (info->eapr & BIT(0)) { /* CE? */ 1792f768af7SAlan Cox error_found = 1; 1802f768af7SAlan Cox 1812f768af7SAlan Cox if (handle_errors) 18263b5d1d9SMauro Carvalho Chehab edac_mc_handle_error(HW_EVENT_ERR_CORRECTED, mci, 18363b5d1d9SMauro Carvalho Chehab page, 0, syndrome, 184052dfb45SDouglas Thompson edac_mc_find_csrow_by_page(mci, page), 18563b5d1d9SMauro Carvalho Chehab 0, -1, 18663b5d1d9SMauro Carvalho Chehab mci->ctl_name, "", NULL); 1872f768af7SAlan Cox } 1882f768af7SAlan Cox 1892f768af7SAlan Cox if (info->eapr & BIT(1)) { /* UE? */ 1902f768af7SAlan Cox error_found = 1; 1912f768af7SAlan Cox 1922f768af7SAlan Cox if (handle_errors) 1932f768af7SAlan Cox /* 82600 doesn't give enough info */ 19463b5d1d9SMauro Carvalho Chehab edac_mc_handle_error(HW_EVENT_ERR_UNCORRECTED, mci, 19563b5d1d9SMauro Carvalho Chehab page, 0, 0, 1962f768af7SAlan Cox edac_mc_find_csrow_by_page(mci, page), 19763b5d1d9SMauro Carvalho Chehab 0, -1, 19863b5d1d9SMauro Carvalho Chehab mci->ctl_name, "", NULL); 1992f768af7SAlan Cox } 2002f768af7SAlan Cox 2012f768af7SAlan Cox return error_found; 2022f768af7SAlan Cox } 2032f768af7SAlan Cox 2042f768af7SAlan Cox static void r82600_check(struct mem_ctl_info *mci) 2052f768af7SAlan Cox { 2062f768af7SAlan Cox struct r82600_error_info info; 2072f768af7SAlan Cox 208537fba28SDave Peterson debugf1("MC%d: %s()\n", mci->mc_idx, __func__); 2092f768af7SAlan Cox r82600_get_error_info(mci, &info); 2102f768af7SAlan Cox r82600_process_error_info(mci, &info, 1); 2112f768af7SAlan Cox } 2122f768af7SAlan Cox 21313189525SDoug Thompson static inline int ecc_enabled(u8 dramcr) 21413189525SDoug Thompson { 21513189525SDoug Thompson return dramcr & BIT(5); 21613189525SDoug Thompson } 21713189525SDoug Thompson 21813189525SDoug Thompson static void r82600_init_csrows(struct mem_ctl_info *mci, struct pci_dev *pdev, 21913189525SDoug Thompson u8 dramcr) 22013189525SDoug Thompson { 22113189525SDoug Thompson struct csrow_info *csrow; 222084a4fccSMauro Carvalho Chehab struct dimm_info *dimm; 22313189525SDoug Thompson int index; 22425985edcSLucas De Marchi u8 drbar; /* SDRAM Row Boundary Address Register */ 22513189525SDoug Thompson u32 row_high_limit, row_high_limit_last; 22613189525SDoug Thompson u32 reg_sdram, ecc_on, row_base; 22713189525SDoug Thompson 22813189525SDoug Thompson ecc_on = ecc_enabled(dramcr); 22913189525SDoug Thompson reg_sdram = dramcr & BIT(4); 23013189525SDoug Thompson row_high_limit_last = 0; 23113189525SDoug Thompson 23213189525SDoug Thompson for (index = 0; index < mci->nr_csrows; index++) { 233*de3910ebSMauro Carvalho Chehab csrow = mci->csrows[index]; 234*de3910ebSMauro Carvalho Chehab dimm = csrow->channels[0]->dimm; 23513189525SDoug Thompson 23613189525SDoug Thompson /* find the DRAM Chip Select Base address and mask */ 23713189525SDoug Thompson pci_read_config_byte(pdev, R82600_DRBA + index, &drbar); 23813189525SDoug Thompson 23913189525SDoug Thompson debugf1("%s() Row=%d DRBA = %#0x\n", __func__, index, drbar); 24013189525SDoug Thompson 24113189525SDoug Thompson row_high_limit = ((u32) drbar << 24); 24213189525SDoug Thompson /* row_high_limit = ((u32)drbar << 24) | 0xffffffUL; */ 24313189525SDoug Thompson 24425985edcSLucas De Marchi debugf1("%s() Row=%d, Boundary Address=%#0x, Last = %#0x\n", 24513189525SDoug Thompson __func__, index, row_high_limit, row_high_limit_last); 24613189525SDoug Thompson 24713189525SDoug Thompson /* Empty row [p.57] */ 24813189525SDoug Thompson if (row_high_limit == row_high_limit_last) 24913189525SDoug Thompson continue; 25013189525SDoug Thompson 25113189525SDoug Thompson row_base = row_high_limit_last; 25213189525SDoug Thompson 25313189525SDoug Thompson csrow->first_page = row_base >> PAGE_SHIFT; 25413189525SDoug Thompson csrow->last_page = (row_high_limit >> PAGE_SHIFT) - 1; 255a895bf8bSMauro Carvalho Chehab 256a895bf8bSMauro Carvalho Chehab dimm->nr_pages = csrow->last_page - csrow->first_page + 1; 25713189525SDoug Thompson /* Error address is top 19 bits - so granularity is * 25813189525SDoug Thompson * 14 bits */ 259084a4fccSMauro Carvalho Chehab dimm->grain = 1 << 14; 260084a4fccSMauro Carvalho Chehab dimm->mtype = reg_sdram ? MEM_RDDR : MEM_DDR; 26113189525SDoug Thompson /* FIXME - check that this is unknowable with this chipset */ 262084a4fccSMauro Carvalho Chehab dimm->dtype = DEV_UNKNOWN; 26313189525SDoug Thompson 26413189525SDoug Thompson /* Mode is global on 82600 */ 265084a4fccSMauro Carvalho Chehab dimm->edac_mode = ecc_on ? EDAC_SECDED : EDAC_NONE; 26613189525SDoug Thompson row_high_limit_last = row_high_limit; 26713189525SDoug Thompson } 26813189525SDoug Thompson } 26913189525SDoug Thompson 2702f768af7SAlan Cox static int r82600_probe1(struct pci_dev *pdev, int dev_idx) 2712f768af7SAlan Cox { 27213189525SDoug Thompson struct mem_ctl_info *mci; 27363b5d1d9SMauro Carvalho Chehab struct edac_mc_layer layers[2]; 2742f768af7SAlan Cox u8 dramcr; 2752f768af7SAlan Cox u32 eapr; 2762f768af7SAlan Cox u32 scrub_disabled; 2772f768af7SAlan Cox u32 sdram_refresh_rate; 278749ede57SDave Peterson struct r82600_error_info discard; 2792f768af7SAlan Cox 280537fba28SDave Peterson debugf0("%s()\n", __func__); 2812f768af7SAlan Cox pci_read_config_byte(pdev, R82600_DRAMC, &dramcr); 2822f768af7SAlan Cox pci_read_config_dword(pdev, R82600_EAP, &eapr); 2832f768af7SAlan Cox scrub_disabled = eapr & BIT(31); 2842f768af7SAlan Cox sdram_refresh_rate = dramcr & (BIT(0) | BIT(1)); 285537fba28SDave Peterson debugf2("%s(): sdram refresh rate = %#0x\n", __func__, 286537fba28SDave Peterson sdram_refresh_rate); 287537fba28SDave Peterson debugf2("%s(): DRAMC register = %#0x\n", __func__, dramcr); 28863b5d1d9SMauro Carvalho Chehab layers[0].type = EDAC_MC_LAYER_CHIP_SELECT; 28963b5d1d9SMauro Carvalho Chehab layers[0].size = R82600_NR_CSROWS; 29063b5d1d9SMauro Carvalho Chehab layers[0].is_virt_csrow = true; 29163b5d1d9SMauro Carvalho Chehab layers[1].type = EDAC_MC_LAYER_CHANNEL; 29263b5d1d9SMauro Carvalho Chehab layers[1].size = R82600_NR_CHANS; 29363b5d1d9SMauro Carvalho Chehab layers[1].is_virt_csrow = false; 294ca0907b9SMauro Carvalho Chehab mci = edac_mc_alloc(0, ARRAY_SIZE(layers), layers, 0); 29513189525SDoug Thompson if (mci == NULL) 29613189525SDoug Thompson return -ENOMEM; 2972f768af7SAlan Cox 298537fba28SDave Peterson debugf0("%s(): mci = %p\n", __func__, mci); 299fd687502SMauro Carvalho Chehab mci->pdev = &pdev->dev; 3002f768af7SAlan Cox mci->mtype_cap = MEM_FLAG_RDDR | MEM_FLAG_DDR; 3012f768af7SAlan Cox mci->edac_ctl_cap = EDAC_FLAG_NONE | EDAC_FLAG_EC | EDAC_FLAG_SECDED; 302e7ecd891SDave Peterson /* FIXME try to work out if the chip leads have been used for COM2 303e7ecd891SDave Peterson * instead on this board? [MA6?] MAYBE: 304e7ecd891SDave Peterson */ 3052f768af7SAlan Cox 3062f768af7SAlan Cox /* On the R82600, the pins for memory bits 72:65 - i.e. the * 3072f768af7SAlan Cox * EC bits are shared with the pins for COM2 (!), so if COM2 * 3082f768af7SAlan Cox * is enabled, we assume COM2 is wired up, and thus no EDAC * 3092f768af7SAlan Cox * is possible. */ 3102f768af7SAlan Cox mci->edac_cap = EDAC_FLAG_NONE | EDAC_FLAG_EC | EDAC_FLAG_SECDED; 311e7ecd891SDave Peterson 31213189525SDoug Thompson if (ecc_enabled(dramcr)) { 3132f768af7SAlan Cox if (scrub_disabled) 314537fba28SDave Peterson debugf3("%s(): mci = %p - Scrubbing disabled! EAP: " 315537fba28SDave Peterson "%#0x\n", __func__, mci, eapr); 3162f768af7SAlan Cox } else 3172f768af7SAlan Cox mci->edac_cap = EDAC_FLAG_NONE; 3182f768af7SAlan Cox 319680cbbbbSDave Peterson mci->mod_name = EDAC_MOD_STR; 32037f04581SDoug Thompson mci->mod_ver = R82600_REVISION; 3212f768af7SAlan Cox mci->ctl_name = "R82600"; 322c4192705SDave Jiang mci->dev_name = pci_name(pdev); 3232f768af7SAlan Cox mci->edac_check = r82600_check; 3242f768af7SAlan Cox mci->ctl_page_to_phys = NULL; 32513189525SDoug Thompson r82600_init_csrows(mci, pdev, dramcr); 326749ede57SDave Peterson r82600_get_error_info(mci, &discard); /* clear counters */ 3272f768af7SAlan Cox 3282d7bbb91SDoug Thompson /* Here we assume that we will never see multiple instances of this 3292d7bbb91SDoug Thompson * type of memory controller. The ID is therefore hardcoded to 0. 3302d7bbb91SDoug Thompson */ 331b8f6f975SDoug Thompson if (edac_mc_add_mc(mci)) { 332537fba28SDave Peterson debugf3("%s(): failed edac_mc_add_mc()\n", __func__); 3332f768af7SAlan Cox goto fail; 3342f768af7SAlan Cox } 3352f768af7SAlan Cox 3362f768af7SAlan Cox /* get this far and it's successful */ 3372f768af7SAlan Cox 3382f768af7SAlan Cox if (disable_hardware_scrub) { 339537fba28SDave Peterson debugf3("%s(): Disabling Hardware Scrub (scrub on error)\n", 340537fba28SDave Peterson __func__); 34137f04581SDoug Thompson pci_write_bits32(pdev, R82600_EAP, BIT(31), BIT(31)); 3422f768af7SAlan Cox } 3432f768af7SAlan Cox 344456a2f95SDave Jiang /* allocating generic PCI control info */ 345456a2f95SDave Jiang r82600_pci = edac_pci_create_generic_ctl(&pdev->dev, EDAC_MOD_STR); 346456a2f95SDave Jiang if (!r82600_pci) { 347456a2f95SDave Jiang printk(KERN_WARNING 348456a2f95SDave Jiang "%s(): Unable to create PCI control\n", 349456a2f95SDave Jiang __func__); 350456a2f95SDave Jiang printk(KERN_WARNING 351456a2f95SDave Jiang "%s(): PCI error report via EDAC not setup\n", 352456a2f95SDave Jiang __func__); 353456a2f95SDave Jiang } 354456a2f95SDave Jiang 355537fba28SDave Peterson debugf3("%s(): success\n", __func__); 3562f768af7SAlan Cox return 0; 3572f768af7SAlan Cox 3582f768af7SAlan Cox fail: 3592f768af7SAlan Cox edac_mc_free(mci); 36013189525SDoug Thompson return -ENODEV; 3612f768af7SAlan Cox } 3622f768af7SAlan Cox 3632f768af7SAlan Cox /* returns count (>= 0), or negative on error */ 3642f768af7SAlan Cox static int __devinit r82600_init_one(struct pci_dev *pdev, 3652f768af7SAlan Cox const struct pci_device_id *ent) 3662f768af7SAlan Cox { 367537fba28SDave Peterson debugf0("%s()\n", __func__); 3682f768af7SAlan Cox 369ee6583f6SRoman Fietze /* don't need to call pci_enable_device() */ 3702f768af7SAlan Cox return r82600_probe1(pdev, ent->driver_data); 3712f768af7SAlan Cox } 3722f768af7SAlan Cox 3732f768af7SAlan Cox static void __devexit r82600_remove_one(struct pci_dev *pdev) 3742f768af7SAlan Cox { 3752f768af7SAlan Cox struct mem_ctl_info *mci; 3762f768af7SAlan Cox 377537fba28SDave Peterson debugf0("%s()\n", __func__); 3782f768af7SAlan Cox 379456a2f95SDave Jiang if (r82600_pci) 380456a2f95SDave Jiang edac_pci_release_generic_ctl(r82600_pci); 381456a2f95SDave Jiang 38237f04581SDoug Thompson if ((mci = edac_mc_del_mc(&pdev->dev)) == NULL) 38318dbc337SDave Peterson return; 38418dbc337SDave Peterson 3852f768af7SAlan Cox edac_mc_free(mci); 3862f768af7SAlan Cox } 3872f768af7SAlan Cox 38836c46f31SLionel Debroux static DEFINE_PCI_DEVICE_TABLE(r82600_pci_tbl) = { 389e7ecd891SDave Peterson { 390e7ecd891SDave Peterson PCI_DEVICE(PCI_VENDOR_ID_RADISYS, R82600_BRIDGE_ID) 391e7ecd891SDave Peterson }, 392e7ecd891SDave Peterson { 393e7ecd891SDave Peterson 0, 394e7ecd891SDave Peterson } /* 0 terminated list. */ 3952f768af7SAlan Cox }; 3962f768af7SAlan Cox 3972f768af7SAlan Cox MODULE_DEVICE_TABLE(pci, r82600_pci_tbl); 3982f768af7SAlan Cox 3992f768af7SAlan Cox static struct pci_driver r82600_driver = { 400680cbbbbSDave Peterson .name = EDAC_MOD_STR, 4012f768af7SAlan Cox .probe = r82600_init_one, 4022f768af7SAlan Cox .remove = __devexit_p(r82600_remove_one), 4032f768af7SAlan Cox .id_table = r82600_pci_tbl, 4042f768af7SAlan Cox }; 4052f768af7SAlan Cox 406da9bb1d2SAlan Cox static int __init r82600_init(void) 4072f768af7SAlan Cox { 408c3c52bceSHitoshi Mitake /* Ensure that the OPSTATE is set correctly for POLL or NMI */ 409c3c52bceSHitoshi Mitake opstate_init(); 410c3c52bceSHitoshi Mitake 4112f768af7SAlan Cox return pci_register_driver(&r82600_driver); 4122f768af7SAlan Cox } 4132f768af7SAlan Cox 4142f768af7SAlan Cox static void __exit r82600_exit(void) 4152f768af7SAlan Cox { 4162f768af7SAlan Cox pci_unregister_driver(&r82600_driver); 4172f768af7SAlan Cox } 4182f768af7SAlan Cox 4192f768af7SAlan Cox module_init(r82600_init); 4202f768af7SAlan Cox module_exit(r82600_exit); 4212f768af7SAlan Cox 4222f768af7SAlan Cox MODULE_LICENSE("GPL"); 4232f768af7SAlan Cox MODULE_AUTHOR("Tim Small <tim@buttersideup.com> - WPAD Ltd. " 4242f768af7SAlan Cox "on behalf of EADS Astrium"); 4252f768af7SAlan Cox MODULE_DESCRIPTION("MC support for Radisys 82600 memory controllers"); 4262f768af7SAlan Cox 4272f768af7SAlan Cox module_param(disable_hardware_scrub, bool, 0644); 4282f768af7SAlan Cox MODULE_PARM_DESC(disable_hardware_scrub, 4292f768af7SAlan Cox "If set, disable the chipset's automatic scrub for CEs"); 430c3c52bceSHitoshi Mitake 431c3c52bceSHitoshi Mitake module_param(edac_op_state, int, 0444); 432c3c52bceSHitoshi Mitake MODULE_PARM_DESC(edac_op_state, "EDAC Error Reporting state: 0=Poll,1=NMI"); 433