diff options
| -rw-r--r-- | drivers/edac/i7300_edac.c | 116 |
1 files changed, 60 insertions, 56 deletions
diff --git a/drivers/edac/i7300_edac.c b/drivers/edac/i7300_edac.c index a85a8e5163b7..6278209fec07 100644 --- a/drivers/edac/i7300_edac.c +++ b/drivers/edac/i7300_edac.c | |||
| @@ -41,6 +41,10 @@ | |||
| 41 | #define i7300_mc_printk(mci, level, fmt, arg...) \ | 41 | #define i7300_mc_printk(mci, level, fmt, arg...) \ |
| 42 | edac_mc_chipset_printk(mci, level, "i7300", fmt, ##arg) | 42 | edac_mc_chipset_printk(mci, level, "i7300", fmt, ##arg) |
| 43 | 43 | ||
| 44 | /*********************************************** | ||
| 45 | * i7300 Limit constants Structs and static vars | ||
| 46 | ***********************************************/ | ||
| 47 | |||
| 44 | /* | 48 | /* |
| 45 | * Memory topology is organized as: | 49 | * Memory topology is organized as: |
| 46 | * Branch 0 - 2 channels: channels 0 and 1 (FDB0 PCI dev 21.0) | 50 | * Branch 0 - 2 channels: channels 0 and 1 (FDB0 PCI dev 21.0) |
| @@ -67,18 +71,64 @@ | |||
| 67 | #define to_csrow(slot, ch, branch) \ | 71 | #define to_csrow(slot, ch, branch) \ |
| 68 | (to_channel(ch, branch) | ((slot) << 2)) | 72 | (to_channel(ch, branch) | ((slot) << 2)) |
| 69 | 73 | ||
| 74 | /* Device name and register DID (Device ID) */ | ||
| 75 | struct i7300_dev_info { | ||
| 76 | const char *ctl_name; /* name for this device */ | ||
| 77 | u16 fsb_mapping_errors; /* DID for the branchmap,control */ | ||
| 78 | }; | ||
| 79 | |||
| 80 | /* Table of devices attributes supported by this driver */ | ||
| 81 | static const struct i7300_dev_info i7300_devs[] = { | ||
| 82 | { | ||
| 83 | .ctl_name = "I7300", | ||
| 84 | .fsb_mapping_errors = PCI_DEVICE_ID_INTEL_I7300_MCH_ERR, | ||
| 85 | }, | ||
| 86 | }; | ||
| 87 | |||
| 88 | struct i7300_dimm_info { | ||
| 89 | int megabytes; /* size, 0 means not present */ | ||
| 90 | }; | ||
| 91 | |||
| 92 | /* driver private data structure */ | ||
| 93 | struct i7300_pvt { | ||
| 94 | struct pci_dev *pci_dev_16_0_fsb_ctlr; /* 16.0 */ | ||
| 95 | struct pci_dev *pci_dev_16_1_fsb_addr_map; /* 16.1 */ | ||
| 96 | struct pci_dev *pci_dev_16_2_fsb_err_regs; /* 16.2 */ | ||
| 97 | struct pci_dev *pci_dev_2x_0_fbd_branch[MAX_BRANCHES]; /* 21.0 and 22.0 */ | ||
| 98 | |||
| 99 | u16 tolm; /* top of low memory */ | ||
| 100 | u64 ambase; /* AMB BAR */ | ||
| 101 | |||
| 102 | u32 mc_settings; /* Report several settings */ | ||
| 103 | u32 mc_settings_a; | ||
| 104 | |||
| 105 | u16 mir[MAX_MIR]; /* Memory Interleave Reg*/ | ||
| 106 | |||
| 107 | u16 mtr[MAX_SLOTS][MAX_BRANCHES]; /* Memory Technlogy Reg */ | ||
| 108 | u16 ambpresent[MAX_CHANNELS]; /* AMB present regs */ | ||
| 109 | |||
| 110 | /* DIMM information matrix, allocating architecture maximums */ | ||
| 111 | struct i7300_dimm_info dimm_info[MAX_SLOTS][MAX_CHANNELS]; | ||
| 112 | |||
| 113 | /* Temporary buffer for use when preparing error messages */ | ||
| 114 | char *tmp_prt_buffer; | ||
| 115 | }; | ||
| 116 | |||
| 117 | /* FIXME: Why do we need to have this static? */ | ||
| 118 | static struct edac_pci_ctl_info *i7300_pci; | ||
| 119 | |||
| 120 | /*************************************************** | ||
| 121 | * i7300 Register definitions for memory enumeration | ||
| 122 | ***************************************************/ | ||
| 123 | |||
| 70 | /* | 124 | /* |
| 71 | * I7300 devices | 125 | * I7300 devices: |
| 72 | * All 3 functions of Device 16 (0,1,2) share the SAME DID and | 126 | * All 3 functions of Device 16 (0,1,2) share the SAME DID and |
| 73 | * uses PCI_DEVICE_ID_INTEL_I7300_MCH_ERR for device 16 (0,1,2), | 127 | * uses PCI_DEVICE_ID_INTEL_I7300_MCH_ERR for device 16 (0,1,2). |
| 74 | * PCI_DEVICE_ID_INTEL_I7300_MCH_FB0 and PCI_DEVICE_ID_INTEL_I7300_MCH_FB1 | 128 | * PCI_DEVICE_ID_INTEL_I7300_MCH_FB0 is used for device 21 (0,1) |
| 75 | * for device 21 (0,1). | 129 | * and PCI_DEVICE_ID_INTEL_I7300_MCH_FB1 is used for device 21 (0,1). |
| 76 | */ | 130 | */ |
| 77 | 131 | ||
| 78 | /**************************************************** | ||
| 79 | * i7300 Register definitions for memory enumberation | ||
| 80 | ****************************************************/ | ||
| 81 | |||
| 82 | /* | 132 | /* |
| 83 | * Device 16, | 133 | * Device 16, |
| 84 | * Function 0: System Address (not documented) | 134 | * Function 0: System Address (not documented) |
| @@ -125,7 +175,8 @@ const static u16 mtr_regs [MAX_SLOTS] = { | |||
| 125 | 0x82, 0x86, 0x8a, 0x8e | 175 | 0x82, 0x86, 0x8a, 0x8e |
| 126 | }; | 176 | }; |
| 127 | 177 | ||
| 128 | /* Defines to extract the vaious fields from the | 178 | /* |
| 179 | * Defines to extract the vaious fields from the | ||
| 129 | * MTRx - Memory Technology Registers | 180 | * MTRx - Memory Technology Registers |
| 130 | */ | 181 | */ |
| 131 | #define MTR_DIMMS_PRESENT(mtr) ((mtr) & (1 << 8)) | 182 | #define MTR_DIMMS_PRESENT(mtr) ((mtr) & (1 << 8)) |
| @@ -290,53 +341,6 @@ static const char *ferr_global_lo_name[] = { | |||
| 290 | #define RECMEMB_CAS(v) (((v) >> 16) & 0x1fff) | 341 | #define RECMEMB_CAS(v) (((v) >> 16) & 0x1fff) |
| 291 | #define RECMEMB_RAS(v) ((v) & 0xffff) | 342 | #define RECMEMB_RAS(v) ((v) & 0xffff) |
| 292 | 343 | ||
| 293 | |||
| 294 | /* Device name and register DID (Device ID) */ | ||
| 295 | struct i7300_dev_info { | ||
| 296 | const char *ctl_name; /* name for this device */ | ||
| 297 | u16 fsb_mapping_errors; /* DID for the branchmap,control */ | ||
| 298 | }; | ||
| 299 | |||
| 300 | /* Table of devices attributes supported by this driver */ | ||
| 301 | static const struct i7300_dev_info i7300_devs[] = { | ||
| 302 | { | ||
| 303 | .ctl_name = "I7300", | ||
| 304 | .fsb_mapping_errors = PCI_DEVICE_ID_INTEL_I7300_MCH_ERR, | ||
| 305 | }, | ||
| 306 | }; | ||
| 307 | |||
| 308 | struct i7300_dimm_info { | ||
| 309 | int megabytes; /* size, 0 means not present */ | ||
| 310 | }; | ||
| 311 | |||
| 312 | /* driver private data structure */ | ||
| 313 | struct i7300_pvt { | ||
| 314 | struct pci_dev *pci_dev_16_0_fsb_ctlr; /* 16.0 */ | ||
| 315 | struct pci_dev *pci_dev_16_1_fsb_addr_map; /* 16.1 */ | ||
| 316 | struct pci_dev *pci_dev_16_2_fsb_err_regs; /* 16.2 */ | ||
| 317 | struct pci_dev *pci_dev_2x_0_fbd_branch[MAX_BRANCHES]; /* 21.0 and 22.0 */ | ||
| 318 | |||
| 319 | u16 tolm; /* top of low memory */ | ||
| 320 | u64 ambase; /* AMB BAR */ | ||
| 321 | |||
| 322 | u32 mc_settings; /* Report several settings */ | ||
| 323 | u32 mc_settings_a; | ||
| 324 | |||
| 325 | u16 mir[MAX_MIR]; /* Memory Interleave Reg*/ | ||
| 326 | |||
| 327 | u16 mtr[MAX_SLOTS][MAX_BRANCHES]; /* Memory Technlogy Reg */ | ||
| 328 | u16 ambpresent[MAX_CHANNELS]; /* AMB present regs */ | ||
| 329 | |||
| 330 | /* DIMM information matrix, allocating architecture maximums */ | ||
| 331 | struct i7300_dimm_info dimm_info[MAX_SLOTS][MAX_CHANNELS]; | ||
| 332 | |||
| 333 | /* Temporary buffer for use when preparing error messages */ | ||
| 334 | char *tmp_prt_buffer; | ||
| 335 | }; | ||
| 336 | |||
| 337 | /* FIXME: Why do we need to have this static? */ | ||
| 338 | static struct edac_pci_ctl_info *i7300_pci; | ||
| 339 | |||
| 340 | /******************************************** | 344 | /******************************************** |
| 341 | * i7300 Functions related to error detection | 345 | * i7300 Functions related to error detection |
| 342 | ********************************************/ | 346 | ********************************************/ |
