15a2c675cSTim Small /* 25a2c675cSTim Small * Intel 82443BX/GX (440BX/GX chipset) Memory Controller EDAC kernel 35a2c675cSTim Small * module (C) 2006 Tim Small 45a2c675cSTim Small * 55a2c675cSTim Small * This file may be distributed under the terms of the GNU General 65a2c675cSTim Small * Public License. 75a2c675cSTim Small * 85a2c675cSTim Small * Written by Tim Small <tim@buttersideup.com>, based on work by Linux 95a2c675cSTim Small * Networx, Thayne Harbaugh, Dan Hollis <goemon at anime dot net> and 105a2c675cSTim Small * others. 115a2c675cSTim Small * 125a2c675cSTim Small * 440GX fix by Jason Uhlenkott <juhlenko@akamai.com>. 135a2c675cSTim Small * 145a2c675cSTim Small * Written with reference to 82443BX Host Bridge Datasheet: 155a2c675cSTim Small * http://www.intel.com/design/chipsets/440/documentation.htm 165a2c675cSTim Small * references to this document given in []. 175a2c675cSTim Small * 185a2c675cSTim Small * This module doesn't support the 440LX, but it may be possible to 195a2c675cSTim Small * make it do so (the 440LX's register definitions are different, but 205a2c675cSTim Small * not completely so - I haven't studied them in enough detail to know 215a2c675cSTim Small * how easy this would be). 225a2c675cSTim Small */ 235a2c675cSTim Small 245a2c675cSTim Small #include <linux/module.h> 255a2c675cSTim Small #include <linux/init.h> 265a2c675cSTim Small 275a2c675cSTim Small #include <linux/pci.h> 285a2c675cSTim Small #include <linux/pci_ids.h> 295a2c675cSTim Small 305a2c675cSTim Small #include <linux/slab.h> 315a2c675cSTim Small 32*c3c52bceSHitoshi Mitake #include <linux/edac.h> 3320bcb7a8SDouglas Thompson #include "edac_core.h" 345a2c675cSTim Small 355a2c675cSTim Small #define I82443_REVISION "0.1" 365a2c675cSTim Small 375a2c675cSTim Small #define EDAC_MOD_STR "i82443bxgx_edac" 385a2c675cSTim Small 395a2c675cSTim Small /* The 82443BX supports SDRAM, or EDO (EDO for mobile only), "Memory 405a2c675cSTim Small * Size: 8 MB to 512 MB (1GB with Registered DIMMs) with eight memory 415a2c675cSTim Small * rows" "The 82443BX supports multiple-bit error detection and 425a2c675cSTim Small * single-bit error correction when ECC mode is enabled and 435a2c675cSTim Small * single/multi-bit error detection when correction is disabled. 445a2c675cSTim Small * During writes to the DRAM, the 82443BX generates ECC for the data 455a2c675cSTim Small * on a QWord basis. Partial QWord writes require a read-modify-write 465a2c675cSTim Small * cycle when ECC is enabled." 475a2c675cSTim Small */ 485a2c675cSTim Small 495a2c675cSTim Small /* "Additionally, the 82443BX ensures that the data is corrected in 505a2c675cSTim Small * main memory so that accumulation of errors is prevented. Another 515a2c675cSTim Small * error within the same QWord would result in a double-bit error 525a2c675cSTim Small * which is unrecoverable. This is known as hardware scrubbing since 535a2c675cSTim Small * it requires no software intervention to correct the data in memory." 545a2c675cSTim Small */ 555a2c675cSTim Small 565a2c675cSTim Small /* [Also see page 100 (section 4.3), "DRAM Interface"] 575a2c675cSTim Small * [Also see page 112 (section 4.6.1.4), ECC] 585a2c675cSTim Small */ 595a2c675cSTim Small 605a2c675cSTim Small #define I82443BXGX_NR_CSROWS 8 615a2c675cSTim Small #define I82443BXGX_NR_CHANS 1 625a2c675cSTim Small #define I82443BXGX_NR_DIMMS 4 635a2c675cSTim Small 645a2c675cSTim Small /* 82443 PCI Device 0 */ 655a2c675cSTim Small #define I82443BXGX_NBXCFG 0x50 /* 32bit register starting at this PCI 665a2c675cSTim Small * config space offset */ 675a2c675cSTim Small #define I82443BXGX_NBXCFG_OFFSET_NON_ECCROW 24 /* Array of bits, zero if 685a2c675cSTim Small * row is non-ECC */ 695a2c675cSTim Small #define I82443BXGX_NBXCFG_OFFSET_DRAM_FREQ 12 /* 2 bits,00=100MHz,10=66 MHz */ 705a2c675cSTim Small 715a2c675cSTim Small #define I82443BXGX_NBXCFG_OFFSET_DRAM_INTEGRITY 7 /* 2 bits: */ 725a2c675cSTim Small #define I82443BXGX_NBXCFG_INTEGRITY_NONE 0x0 /* 00 = Non-ECC */ 735a2c675cSTim Small #define I82443BXGX_NBXCFG_INTEGRITY_EC 0x1 /* 01 = EC (only) */ 745a2c675cSTim Small #define I82443BXGX_NBXCFG_INTEGRITY_ECC 0x2 /* 10 = ECC */ 755a2c675cSTim Small #define I82443BXGX_NBXCFG_INTEGRITY_SCRUB 0x3 /* 11 = ECC + HW Scrub */ 765a2c675cSTim Small 775a2c675cSTim Small #define I82443BXGX_NBXCFG_OFFSET_ECC_DIAG_ENABLE 6 785a2c675cSTim Small 795a2c675cSTim Small /* 82443 PCI Device 0 */ 805a2c675cSTim Small #define I82443BXGX_EAP 0x80 /* 32bit register starting at this PCI 815a2c675cSTim Small * config space offset, Error Address 825a2c675cSTim Small * Pointer Register */ 835a2c675cSTim Small #define I82443BXGX_EAP_OFFSET_EAP 12 /* High 20 bits of error address */ 845a2c675cSTim Small #define I82443BXGX_EAP_OFFSET_MBE BIT(1) /* Err at EAP was multi-bit (W1TC) */ 855a2c675cSTim Small #define I82443BXGX_EAP_OFFSET_SBE BIT(0) /* Err at EAP was single-bit (W1TC) */ 865a2c675cSTim Small 875a2c675cSTim Small #define I82443BXGX_ERRCMD 0x90 /* 8bit register starting at this PCI 885a2c675cSTim Small * config space offset. */ 895a2c675cSTim Small #define I82443BXGX_ERRCMD_OFFSET_SERR_ON_MBE BIT(1) /* 1 = enable */ 905a2c675cSTim Small #define I82443BXGX_ERRCMD_OFFSET_SERR_ON_SBE BIT(0) /* 1 = enable */ 915a2c675cSTim Small 925a2c675cSTim Small #define I82443BXGX_ERRSTS 0x91 /* 16bit register starting at this PCI 935a2c675cSTim Small * config space offset. */ 945a2c675cSTim Small #define I82443BXGX_ERRSTS_OFFSET_MBFRE 5 /* 3 bits - first err row multibit */ 955a2c675cSTim Small #define I82443BXGX_ERRSTS_OFFSET_MEF BIT(4) /* 1 = MBE occurred */ 965a2c675cSTim Small #define I82443BXGX_ERRSTS_OFFSET_SBFRE 1 /* 3 bits - first err row singlebit */ 975a2c675cSTim Small #define I82443BXGX_ERRSTS_OFFSET_SEF BIT(0) /* 1 = SBE occurred */ 985a2c675cSTim Small 995a2c675cSTim Small #define I82443BXGX_DRAMC 0x57 /* 8bit register starting at this PCI 1005a2c675cSTim Small * config space offset. */ 1015a2c675cSTim Small #define I82443BXGX_DRAMC_OFFSET_DT 3 /* 2 bits, DRAM Type */ 1025a2c675cSTim Small #define I82443BXGX_DRAMC_DRAM_IS_EDO 0 /* 00 = EDO */ 1035a2c675cSTim Small #define I82443BXGX_DRAMC_DRAM_IS_SDRAM 1 /* 01 = SDRAM */ 1045a2c675cSTim Small #define I82443BXGX_DRAMC_DRAM_IS_RSDRAM 2 /* 10 = Registered SDRAM */ 1055a2c675cSTim Small 1065a2c675cSTim Small #define I82443BXGX_DRB 0x60 /* 8x 8bit registers starting at this PCI 1075a2c675cSTim Small * config space offset. */ 1085a2c675cSTim Small 1095a2c675cSTim Small /* FIXME - don't poll when ECC disabled? */ 1105a2c675cSTim Small 1115a2c675cSTim Small struct i82443bxgx_edacmc_error_info { 1125a2c675cSTim Small u32 eap; 1135a2c675cSTim Small }; 1145a2c675cSTim Small 115456a2f95SDave Jiang static struct edac_pci_ctl_info *i82443bxgx_pci; 116456a2f95SDave Jiang 1175a2c675cSTim Small static void i82443bxgx_edacmc_get_error_info(struct mem_ctl_info *mci, 11811116601SDouglas Thompson struct i82443bxgx_edacmc_error_info 11911116601SDouglas Thompson *info) 1205a2c675cSTim Small { 1215a2c675cSTim Small struct pci_dev *pdev; 1225a2c675cSTim Small pdev = to_pci_dev(mci->dev); 1235a2c675cSTim Small pci_read_config_dword(pdev, I82443BXGX_EAP, &info->eap); 1245a2c675cSTim Small if (info->eap & I82443BXGX_EAP_OFFSET_SBE) 1255a2c675cSTim Small /* Clear error to allow next error to be reported [p.61] */ 1265a2c675cSTim Small pci_write_bits32(pdev, I82443BXGX_EAP, 1275a2c675cSTim Small I82443BXGX_EAP_OFFSET_SBE, 1285a2c675cSTim Small I82443BXGX_EAP_OFFSET_SBE); 1295a2c675cSTim Small 1305a2c675cSTim Small if (info->eap & I82443BXGX_EAP_OFFSET_MBE) 1315a2c675cSTim Small /* Clear error to allow next error to be reported [p.61] */ 1325a2c675cSTim Small pci_write_bits32(pdev, I82443BXGX_EAP, 1335a2c675cSTim Small I82443BXGX_EAP_OFFSET_MBE, 1345a2c675cSTim Small I82443BXGX_EAP_OFFSET_MBE); 1355a2c675cSTim Small } 1365a2c675cSTim Small 1375a2c675cSTim Small static int i82443bxgx_edacmc_process_error_info(struct mem_ctl_info *mci, 13811116601SDouglas Thompson struct 13911116601SDouglas Thompson i82443bxgx_edacmc_error_info 14011116601SDouglas Thompson *info, int handle_errors) 1415a2c675cSTim Small { 1425a2c675cSTim Small int error_found = 0; 1435a2c675cSTim Small u32 eapaddr, page, pageoffset; 1445a2c675cSTim Small 1455a2c675cSTim Small /* bits 30:12 hold the 4kb block in which the error occurred 1465a2c675cSTim Small * [p.61] */ 1475a2c675cSTim Small eapaddr = (info->eap & 0xfffff000); 1485a2c675cSTim Small page = eapaddr >> PAGE_SHIFT; 1495a2c675cSTim Small pageoffset = eapaddr - (page << PAGE_SHIFT); 1505a2c675cSTim Small 1515a2c675cSTim Small if (info->eap & I82443BXGX_EAP_OFFSET_SBE) { 1525a2c675cSTim Small error_found = 1; 1535a2c675cSTim Small if (handle_errors) 15411116601SDouglas Thompson edac_mc_handle_ce(mci, page, pageoffset, 155052dfb45SDouglas Thompson /* 440BX/GX don't make syndrome information 156052dfb45SDouglas Thompson * available */ 157052dfb45SDouglas Thompson 0, edac_mc_find_csrow_by_page(mci, page), 0, 1585a2c675cSTim Small mci->ctl_name); 1595a2c675cSTim Small } 1605a2c675cSTim Small 1615a2c675cSTim Small if (info->eap & I82443BXGX_EAP_OFFSET_MBE) { 1625a2c675cSTim Small error_found = 1; 1635a2c675cSTim Small if (handle_errors) 16411116601SDouglas Thompson edac_mc_handle_ue(mci, page, pageoffset, 1655a2c675cSTim Small edac_mc_find_csrow_by_page(mci, page), 1665a2c675cSTim Small mci->ctl_name); 1675a2c675cSTim Small } 1685a2c675cSTim Small 1695a2c675cSTim Small return error_found; 1705a2c675cSTim Small } 1715a2c675cSTim Small 1725a2c675cSTim Small static void i82443bxgx_edacmc_check(struct mem_ctl_info *mci) 1735a2c675cSTim Small { 1745a2c675cSTim Small struct i82443bxgx_edacmc_error_info info; 1755a2c675cSTim Small 1765a2c675cSTim Small debugf1("MC%d: " __FILE__ ": %s()\n", mci->mc_idx, __func__); 1775a2c675cSTim Small i82443bxgx_edacmc_get_error_info(mci, &info); 1785a2c675cSTim Small i82443bxgx_edacmc_process_error_info(mci, &info, 1); 1795a2c675cSTim Small } 1805a2c675cSTim Small 1815a2c675cSTim Small static void i82443bxgx_init_csrows(struct mem_ctl_info *mci, 1825a2c675cSTim Small struct pci_dev *pdev, 1835a2c675cSTim Small enum edac_type edac_mode, 1845a2c675cSTim Small enum mem_type mtype) 1855a2c675cSTim Small { 1865a2c675cSTim Small struct csrow_info *csrow; 1875a2c675cSTim Small int index; 1885a2c675cSTim Small u8 drbar, dramc; 1895a2c675cSTim Small u32 row_base, row_high_limit, row_high_limit_last; 1905a2c675cSTim Small 1915a2c675cSTim Small pci_read_config_byte(pdev, I82443BXGX_DRAMC, &dramc); 1925a2c675cSTim Small row_high_limit_last = 0; 1935a2c675cSTim Small for (index = 0; index < mci->nr_csrows; index++) { 1945a2c675cSTim Small csrow = &mci->csrows[index]; 1955a2c675cSTim Small pci_read_config_byte(pdev, I82443BXGX_DRB + index, &drbar); 1965a2c675cSTim Small debugf1("MC%d: " __FILE__ ": %s() Row=%d DRB = %#0x\n", 1975a2c675cSTim Small mci->mc_idx, __func__, index, drbar); 1985a2c675cSTim Small row_high_limit = ((u32) drbar << 23); 1995a2c675cSTim Small /* find the DRAM Chip Select Base address and mask */ 2005a2c675cSTim Small debugf1("MC%d: " __FILE__ ": %s() Row=%d, " 2015a2c675cSTim Small "Boundry Address=%#0x, Last = %#0x \n", 2025a2c675cSTim Small mci->mc_idx, __func__, index, row_high_limit, 2035a2c675cSTim Small row_high_limit_last); 2045a2c675cSTim Small 2055a2c675cSTim Small /* 440GX goes to 2GB, represented with a DRB of 0. */ 2065a2c675cSTim Small if (row_high_limit_last && !row_high_limit) 2075a2c675cSTim Small row_high_limit = 1UL << 31; 2085a2c675cSTim Small 2095a2c675cSTim Small /* This row is empty [p.49] */ 2105a2c675cSTim Small if (row_high_limit == row_high_limit_last) 2115a2c675cSTim Small continue; 2125a2c675cSTim Small row_base = row_high_limit_last; 2135a2c675cSTim Small csrow->first_page = row_base >> PAGE_SHIFT; 2145a2c675cSTim Small csrow->last_page = (row_high_limit >> PAGE_SHIFT) - 1; 2155a2c675cSTim Small csrow->nr_pages = csrow->last_page - csrow->first_page + 1; 2165a2c675cSTim Small /* EAP reports in 4kilobyte granularity [61] */ 2175a2c675cSTim Small csrow->grain = 1 << 12; 2185a2c675cSTim Small csrow->mtype = mtype; 2195a2c675cSTim Small /* I don't think 440BX can tell you device type? FIXME? */ 2205a2c675cSTim Small csrow->dtype = DEV_UNKNOWN; 2215a2c675cSTim Small /* Mode is global to all rows on 440BX */ 2225a2c675cSTim Small csrow->edac_mode = edac_mode; 2235a2c675cSTim Small row_high_limit_last = row_high_limit; 2245a2c675cSTim Small } 2255a2c675cSTim Small } 2265a2c675cSTim Small 2275a2c675cSTim Small static int i82443bxgx_edacmc_probe1(struct pci_dev *pdev, int dev_idx) 2285a2c675cSTim Small { 2295a2c675cSTim Small struct mem_ctl_info *mci; 2305a2c675cSTim Small u8 dramc; 2315a2c675cSTim Small u32 nbxcfg, ecc_mode; 2325a2c675cSTim Small enum mem_type mtype; 2335a2c675cSTim Small enum edac_type edac_mode; 2345a2c675cSTim Small 2355a2c675cSTim Small debugf0("MC: " __FILE__ ": %s()\n", __func__); 2365a2c675cSTim Small 2375a2c675cSTim Small /* Something is really hosed if PCI config space reads from 238052dfb45SDouglas Thompson * the MC aren't working. 239052dfb45SDouglas Thompson */ 2405a2c675cSTim Small if (pci_read_config_dword(pdev, I82443BXGX_NBXCFG, &nbxcfg)) 2415a2c675cSTim Small return -EIO; 2425a2c675cSTim Small 243b8f6f975SDoug Thompson mci = edac_mc_alloc(0, I82443BXGX_NR_CSROWS, I82443BXGX_NR_CHANS, 0); 2445a2c675cSTim Small 2455a2c675cSTim Small if (mci == NULL) 2465a2c675cSTim Small return -ENOMEM; 2475a2c675cSTim Small 2485a2c675cSTim Small debugf0("MC: " __FILE__ ": %s(): mci = %p\n", __func__, mci); 2495a2c675cSTim Small mci->dev = &pdev->dev; 2505a2c675cSTim Small mci->mtype_cap = MEM_FLAG_EDO | MEM_FLAG_SDR | MEM_FLAG_RDR; 2515a2c675cSTim Small mci->edac_ctl_cap = EDAC_FLAG_NONE | EDAC_FLAG_EC | EDAC_FLAG_SECDED; 2525a2c675cSTim Small pci_read_config_byte(pdev, I82443BXGX_DRAMC, &dramc); 2535a2c675cSTim Small switch ((dramc >> I82443BXGX_DRAMC_OFFSET_DT) & (BIT(0) | BIT(1))) { 2545a2c675cSTim Small case I82443BXGX_DRAMC_DRAM_IS_EDO: 2555a2c675cSTim Small mtype = MEM_EDO; 2565a2c675cSTim Small break; 2575a2c675cSTim Small case I82443BXGX_DRAMC_DRAM_IS_SDRAM: 2585a2c675cSTim Small mtype = MEM_SDR; 2595a2c675cSTim Small break; 2605a2c675cSTim Small case I82443BXGX_DRAMC_DRAM_IS_RSDRAM: 2615a2c675cSTim Small mtype = MEM_RDR; 2625a2c675cSTim Small break; 2635a2c675cSTim Small default: 264052dfb45SDouglas Thompson debugf0("Unknown/reserved DRAM type value " 265052dfb45SDouglas Thompson "in DRAMC register!\n"); 2665a2c675cSTim Small mtype = -MEM_UNKNOWN; 2675a2c675cSTim Small } 2685a2c675cSTim Small 2695a2c675cSTim Small if ((mtype == MEM_SDR) || (mtype == MEM_RDR)) 2705a2c675cSTim Small mci->edac_cap = mci->edac_ctl_cap; 2715a2c675cSTim Small else 2725a2c675cSTim Small mci->edac_cap = EDAC_FLAG_NONE; 2735a2c675cSTim Small 2745a2c675cSTim Small mci->scrub_cap = SCRUB_FLAG_HW_SRC; 2755a2c675cSTim Small pci_read_config_dword(pdev, I82443BXGX_NBXCFG, &nbxcfg); 2765a2c675cSTim Small ecc_mode = ((nbxcfg >> I82443BXGX_NBXCFG_OFFSET_DRAM_INTEGRITY) & 2775a2c675cSTim Small (BIT(0) | BIT(1))); 2785a2c675cSTim Small 2795a2c675cSTim Small mci->scrub_mode = (ecc_mode == I82443BXGX_NBXCFG_INTEGRITY_SCRUB) 28011116601SDouglas Thompson ? SCRUB_HW_SRC : SCRUB_NONE; 2815a2c675cSTim Small 2825a2c675cSTim Small switch (ecc_mode) { 2835a2c675cSTim Small case I82443BXGX_NBXCFG_INTEGRITY_NONE: 2845a2c675cSTim Small edac_mode = EDAC_NONE; 2855a2c675cSTim Small break; 2865a2c675cSTim Small case I82443BXGX_NBXCFG_INTEGRITY_EC: 2875a2c675cSTim Small edac_mode = EDAC_EC; 2885a2c675cSTim Small break; 2895a2c675cSTim Small case I82443BXGX_NBXCFG_INTEGRITY_ECC: 2905a2c675cSTim Small case I82443BXGX_NBXCFG_INTEGRITY_SCRUB: 2915a2c675cSTim Small edac_mode = EDAC_SECDED; 2925a2c675cSTim Small break; 2935a2c675cSTim Small default: 294052dfb45SDouglas Thompson debugf0("%s(): Unknown/reserved ECC state " 295052dfb45SDouglas Thompson "in NBXCFG register!\n", __func__); 2965a2c675cSTim Small edac_mode = EDAC_UNKNOWN; 2975a2c675cSTim Small break; 2985a2c675cSTim Small } 2995a2c675cSTim Small 3005a2c675cSTim Small i82443bxgx_init_csrows(mci, pdev, edac_mode, mtype); 3015a2c675cSTim Small 3025a2c675cSTim Small /* Many BIOSes don't clear error flags on boot, so do this 3035a2c675cSTim Small * here, or we get "phantom" errors occuring at module-load 3045a2c675cSTim Small * time. */ 3055a2c675cSTim Small pci_write_bits32(pdev, I82443BXGX_EAP, 30611116601SDouglas Thompson (I82443BXGX_EAP_OFFSET_SBE | 30711116601SDouglas Thompson I82443BXGX_EAP_OFFSET_MBE), 30811116601SDouglas Thompson (I82443BXGX_EAP_OFFSET_SBE | 30911116601SDouglas Thompson I82443BXGX_EAP_OFFSET_MBE)); 3105a2c675cSTim Small 3115a2c675cSTim Small mci->mod_name = EDAC_MOD_STR; 3125a2c675cSTim Small mci->mod_ver = I82443_REVISION; 3135a2c675cSTim Small mci->ctl_name = "I82443BXGX"; 314c4192705SDave Jiang mci->dev_name = pci_name(pdev); 3155a2c675cSTim Small mci->edac_check = i82443bxgx_edacmc_check; 3165a2c675cSTim Small mci->ctl_page_to_phys = NULL; 3175a2c675cSTim Small 318b8f6f975SDoug Thompson if (edac_mc_add_mc(mci)) { 3195a2c675cSTim Small debugf3("%s(): failed edac_mc_add_mc()\n", __func__); 3205a2c675cSTim Small goto fail; 3215a2c675cSTim Small } 3225a2c675cSTim Small 323456a2f95SDave Jiang /* allocating generic PCI control info */ 324456a2f95SDave Jiang i82443bxgx_pci = edac_pci_create_generic_ctl(&pdev->dev, EDAC_MOD_STR); 325456a2f95SDave Jiang if (!i82443bxgx_pci) { 326456a2f95SDave Jiang printk(KERN_WARNING 327456a2f95SDave Jiang "%s(): Unable to create PCI control\n", 328456a2f95SDave Jiang __func__); 329456a2f95SDave Jiang printk(KERN_WARNING 330456a2f95SDave Jiang "%s(): PCI error report via EDAC not setup\n", 331456a2f95SDave Jiang __func__); 332456a2f95SDave Jiang } 333456a2f95SDave Jiang 3345a2c675cSTim Small debugf3("MC: " __FILE__ ": %s(): success\n", __func__); 3355a2c675cSTim Small return 0; 3365a2c675cSTim Small 3375a2c675cSTim Small fail: 3385a2c675cSTim Small edac_mc_free(mci); 3395a2c675cSTim Small return -ENODEV; 3405a2c675cSTim Small } 34111116601SDouglas Thompson 3425a2c675cSTim Small EXPORT_SYMBOL_GPL(i82443bxgx_edacmc_probe1); 3435a2c675cSTim Small 3445a2c675cSTim Small /* returns count (>= 0), or negative on error */ 3455a2c675cSTim Small static int __devinit i82443bxgx_edacmc_init_one(struct pci_dev *pdev, 3465a2c675cSTim Small const struct pci_device_id *ent) 3475a2c675cSTim Small { 3485a2c675cSTim Small debugf0("MC: " __FILE__ ": %s()\n", __func__); 3495a2c675cSTim Small 3505a2c675cSTim Small /* don't need to call pci_device_enable() */ 3515a2c675cSTim Small return i82443bxgx_edacmc_probe1(pdev, ent->driver_data); 3525a2c675cSTim Small } 3535a2c675cSTim Small 3545a2c675cSTim Small static void __devexit i82443bxgx_edacmc_remove_one(struct pci_dev *pdev) 3555a2c675cSTim Small { 3565a2c675cSTim Small struct mem_ctl_info *mci; 3575a2c675cSTim Small 3585a2c675cSTim Small debugf0(__FILE__ ": %s()\n", __func__); 3595a2c675cSTim Small 360456a2f95SDave Jiang if (i82443bxgx_pci) 361456a2f95SDave Jiang edac_pci_release_generic_ctl(i82443bxgx_pci); 362456a2f95SDave Jiang 3635a2c675cSTim Small if ((mci = edac_mc_del_mc(&pdev->dev)) == NULL) 3645a2c675cSTim Small return; 3655a2c675cSTim Small 3665a2c675cSTim Small edac_mc_free(mci); 3675a2c675cSTim Small } 3685a2c675cSTim Small 36911116601SDouglas Thompson EXPORT_SYMBOL_GPL(i82443bxgx_edacmc_remove_one); 3705a2c675cSTim Small 3715a2c675cSTim Small static const struct pci_device_id i82443bxgx_pci_tbl[] __devinitdata = { 3725a2c675cSTim Small {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82443BX_0)}, 3735a2c675cSTim Small {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82443BX_2)}, 3745a2c675cSTim Small {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82443GX_0)}, 3755a2c675cSTim Small {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82443GX_2)}, 3765a2c675cSTim Small {0,} /* 0 terminated list. */ 3775a2c675cSTim Small }; 3785a2c675cSTim Small 3795a2c675cSTim Small MODULE_DEVICE_TABLE(pci, i82443bxgx_pci_tbl); 3805a2c675cSTim Small 3815a2c675cSTim Small static struct pci_driver i82443bxgx_edacmc_driver = { 3825a2c675cSTim Small .name = EDAC_MOD_STR, 3835a2c675cSTim Small .probe = i82443bxgx_edacmc_init_one, 3845a2c675cSTim Small .remove = __devexit_p(i82443bxgx_edacmc_remove_one), 3855a2c675cSTim Small .id_table = i82443bxgx_pci_tbl, 3865a2c675cSTim Small }; 3875a2c675cSTim Small 3885a2c675cSTim Small static int __init i82443bxgx_edacmc_init(void) 3895a2c675cSTim Small { 390*c3c52bceSHitoshi Mitake /* Ensure that the OPSTATE is set correctly for POLL or NMI */ 391*c3c52bceSHitoshi Mitake opstate_init(); 392*c3c52bceSHitoshi Mitake 3935a2c675cSTim Small return pci_register_driver(&i82443bxgx_edacmc_driver); 3945a2c675cSTim Small } 3955a2c675cSTim Small 3965a2c675cSTim Small static void __exit i82443bxgx_edacmc_exit(void) 3975a2c675cSTim Small { 3985a2c675cSTim Small pci_unregister_driver(&i82443bxgx_edacmc_driver); 3995a2c675cSTim Small } 4005a2c675cSTim Small 4015a2c675cSTim Small module_init(i82443bxgx_edacmc_init); 4025a2c675cSTim Small module_exit(i82443bxgx_edacmc_exit); 4035a2c675cSTim Small 4045a2c675cSTim Small MODULE_LICENSE("GPL"); 4055a2c675cSTim Small MODULE_AUTHOR("Tim Small <tim@buttersideup.com> - WPAD"); 4065a2c675cSTim Small MODULE_DESCRIPTION("EDAC MC support for Intel 82443BX/GX memory controllers"); 407*c3c52bceSHitoshi Mitake 408*c3c52bceSHitoshi Mitake module_param(edac_op_state, int, 0444); 409*c3c52bceSHitoshi Mitake MODULE_PARM_DESC(edac_op_state, "EDAC Error Reporting state: 0=Poll,1=NMI"); 410