diff options
author | Daniel J Blueman <daniel@numascale-asia.com> | 2012-11-30 03:44:20 -0500 |
---|---|---|
committer | Borislav Petkov <bp@suse.de> | 2013-01-10 10:18:00 -0500 |
commit | c7e5301a1b7c3f47af635a8b1b14480b81426025 (patch) | |
tree | 29892bae948424292eb9b2f07610b7d579ab1417 /drivers | |
parent | e2c0bffea2574c088d86a9f1f661a84bc8fea2fd (diff) |
amd64_edac: Fix type usage in NB IDs and memory ranges
Use appropriate types for northbridge IDs and memory ranges. Mark
immutable data const and keep within compilation unit on related
structures.
Signed-off-by: Daniel J Blueman <daniel@numascale-asia.com>
Link: http://lkml.kernel.org/r/1354265060-22956-2-git-send-email-daniel@numascale-asia.com
[Boris: Drop arg change to node_to_amd_nb]
Signed-off-by: Borislav Petkov <bp@alien8.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/edac/amd64_edac.c | 26 | ||||
-rw-r--r-- | drivers/edac/amd64_edac.h | 6 |
2 files changed, 16 insertions, 16 deletions
diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index da76912a873d..2d3f8825e8b8 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c | |||
@@ -31,7 +31,7 @@ static struct ecc_settings **ecc_stngs; | |||
31 | * | 31 | * |
32 | *FIXME: Produce a better mapping/linearisation. | 32 | *FIXME: Produce a better mapping/linearisation. |
33 | */ | 33 | */ |
34 | struct scrubrate { | 34 | static const struct scrubrate { |
35 | u32 scrubval; /* bit pattern for scrub rate */ | 35 | u32 scrubval; /* bit pattern for scrub rate */ |
36 | u32 bandwidth; /* bandwidth consumed (bytes/sec) */ | 36 | u32 bandwidth; /* bandwidth consumed (bytes/sec) */ |
37 | } scrubrates[] = { | 37 | } scrubrates[] = { |
@@ -239,7 +239,7 @@ static int amd64_get_scrub_rate(struct mem_ctl_info *mci) | |||
239 | * DRAM base/limit associated with node_id | 239 | * DRAM base/limit associated with node_id |
240 | */ | 240 | */ |
241 | static bool amd64_base_limit_match(struct amd64_pvt *pvt, u64 sys_addr, | 241 | static bool amd64_base_limit_match(struct amd64_pvt *pvt, u64 sys_addr, |
242 | unsigned nid) | 242 | u8 nid) |
243 | { | 243 | { |
244 | u64 addr; | 244 | u64 addr; |
245 | 245 | ||
@@ -265,7 +265,7 @@ static struct mem_ctl_info *find_mc_by_sys_addr(struct mem_ctl_info *mci, | |||
265 | u64 sys_addr) | 265 | u64 sys_addr) |
266 | { | 266 | { |
267 | struct amd64_pvt *pvt; | 267 | struct amd64_pvt *pvt; |
268 | unsigned node_id; | 268 | u8 node_id; |
269 | u32 intlv_en, bits; | 269 | u32 intlv_en, bits; |
270 | 270 | ||
271 | /* | 271 | /* |
@@ -1327,7 +1327,7 @@ static u8 f1x_determine_channel(struct amd64_pvt *pvt, u64 sys_addr, | |||
1327 | } | 1327 | } |
1328 | 1328 | ||
1329 | /* Convert the sys_addr to the normalized DCT address */ | 1329 | /* Convert the sys_addr to the normalized DCT address */ |
1330 | static u64 f1x_get_norm_dct_addr(struct amd64_pvt *pvt, unsigned range, | 1330 | static u64 f1x_get_norm_dct_addr(struct amd64_pvt *pvt, u8 range, |
1331 | u64 sys_addr, bool hi_rng, | 1331 | u64 sys_addr, bool hi_rng, |
1332 | u32 dct_sel_base_addr) | 1332 | u32 dct_sel_base_addr) |
1333 | { | 1333 | { |
@@ -1403,7 +1403,7 @@ static int f10_process_possible_spare(struct amd64_pvt *pvt, u8 dct, int csrow) | |||
1403 | * -EINVAL: NOT FOUND | 1403 | * -EINVAL: NOT FOUND |
1404 | * 0..csrow = Chip-Select Row | 1404 | * 0..csrow = Chip-Select Row |
1405 | */ | 1405 | */ |
1406 | static int f1x_lookup_addr_in_dct(u64 in_addr, u32 nid, u8 dct) | 1406 | static int f1x_lookup_addr_in_dct(u64 in_addr, u8 nid, u8 dct) |
1407 | { | 1407 | { |
1408 | struct mem_ctl_info *mci; | 1408 | struct mem_ctl_info *mci; |
1409 | struct amd64_pvt *pvt; | 1409 | struct amd64_pvt *pvt; |
@@ -1701,7 +1701,7 @@ static struct amd64_family_type amd64_family_types[] = { | |||
1701 | * | 1701 | * |
1702 | * Algorithm courtesy of Ross LaFetra from AMD. | 1702 | * Algorithm courtesy of Ross LaFetra from AMD. |
1703 | */ | 1703 | */ |
1704 | static u16 x4_vectors[] = { | 1704 | static const u16 x4_vectors[] = { |
1705 | 0x2f57, 0x1afe, 0x66cc, 0xdd88, | 1705 | 0x2f57, 0x1afe, 0x66cc, 0xdd88, |
1706 | 0x11eb, 0x3396, 0x7f4c, 0xeac8, | 1706 | 0x11eb, 0x3396, 0x7f4c, 0xeac8, |
1707 | 0x0001, 0x0002, 0x0004, 0x0008, | 1707 | 0x0001, 0x0002, 0x0004, 0x0008, |
@@ -1740,7 +1740,7 @@ static u16 x4_vectors[] = { | |||
1740 | 0x19a9, 0x2efe, 0xb5cc, 0x6f88, | 1740 | 0x19a9, 0x2efe, 0xb5cc, 0x6f88, |
1741 | }; | 1741 | }; |
1742 | 1742 | ||
1743 | static u16 x8_vectors[] = { | 1743 | static const u16 x8_vectors[] = { |
1744 | 0x0145, 0x028a, 0x2374, 0x43c8, 0xa1f0, 0x0520, 0x0a40, 0x1480, | 1744 | 0x0145, 0x028a, 0x2374, 0x43c8, 0xa1f0, 0x0520, 0x0a40, 0x1480, |
1745 | 0x0211, 0x0422, 0x0844, 0x1088, 0x01b0, 0x44e0, 0x23c0, 0xed80, | 1745 | 0x0211, 0x0422, 0x0844, 0x1088, 0x01b0, 0x44e0, 0x23c0, 0xed80, |
1746 | 0x1011, 0x0116, 0x022c, 0x0458, 0x08b0, 0x8c60, 0x2740, 0x4e80, | 1746 | 0x1011, 0x0116, 0x022c, 0x0458, 0x08b0, 0x8c60, 0x2740, 0x4e80, |
@@ -1762,7 +1762,7 @@ static u16 x8_vectors[] = { | |||
1762 | 0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000, 0x8000, | 1762 | 0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000, 0x8000, |
1763 | }; | 1763 | }; |
1764 | 1764 | ||
1765 | static int decode_syndrome(u16 syndrome, u16 *vectors, unsigned num_vecs, | 1765 | static int decode_syndrome(u16 syndrome, const u16 *vectors, unsigned num_vecs, |
1766 | unsigned v_dim) | 1766 | unsigned v_dim) |
1767 | { | 1767 | { |
1768 | unsigned int i, err_sym; | 1768 | unsigned int i, err_sym; |
@@ -2196,7 +2196,7 @@ static void get_cpus_on_this_dct_cpumask(struct cpumask *mask, u16 nid) | |||
2196 | } | 2196 | } |
2197 | 2197 | ||
2198 | /* check MCG_CTL on all the cpus on this node */ | 2198 | /* check MCG_CTL on all the cpus on this node */ |
2199 | static bool amd64_nb_mce_bank_enabled_on_node(unsigned nid) | 2199 | static bool amd64_nb_mce_bank_enabled_on_node(u16 nid) |
2200 | { | 2200 | { |
2201 | cpumask_var_t mask; | 2201 | cpumask_var_t mask; |
2202 | int cpu, nbe; | 2202 | int cpu, nbe; |
@@ -2229,7 +2229,7 @@ out: | |||
2229 | return ret; | 2229 | return ret; |
2230 | } | 2230 | } |
2231 | 2231 | ||
2232 | static int toggle_ecc_err_reporting(struct ecc_settings *s, u8 nid, bool on) | 2232 | static int toggle_ecc_err_reporting(struct ecc_settings *s, u16 nid, bool on) |
2233 | { | 2233 | { |
2234 | cpumask_var_t cmask; | 2234 | cpumask_var_t cmask; |
2235 | int cpu; | 2235 | int cpu; |
@@ -2267,7 +2267,7 @@ static int toggle_ecc_err_reporting(struct ecc_settings *s, u8 nid, bool on) | |||
2267 | return 0; | 2267 | return 0; |
2268 | } | 2268 | } |
2269 | 2269 | ||
2270 | static bool enable_ecc_error_reporting(struct ecc_settings *s, u8 nid, | 2270 | static bool enable_ecc_error_reporting(struct ecc_settings *s, u16 nid, |
2271 | struct pci_dev *F3) | 2271 | struct pci_dev *F3) |
2272 | { | 2272 | { |
2273 | bool ret = true; | 2273 | bool ret = true; |
@@ -2319,7 +2319,7 @@ static bool enable_ecc_error_reporting(struct ecc_settings *s, u8 nid, | |||
2319 | return ret; | 2319 | return ret; |
2320 | } | 2320 | } |
2321 | 2321 | ||
2322 | static void restore_ecc_error_reporting(struct ecc_settings *s, u8 nid, | 2322 | static void restore_ecc_error_reporting(struct ecc_settings *s, u16 nid, |
2323 | struct pci_dev *F3) | 2323 | struct pci_dev *F3) |
2324 | { | 2324 | { |
2325 | u32 value, mask = 0x3; /* UECC/CECC enable */ | 2325 | u32 value, mask = 0x3; /* UECC/CECC enable */ |
@@ -2358,7 +2358,7 @@ static const char *ecc_msg = | |||
2358 | "'ecc_enable_override'.\n" | 2358 | "'ecc_enable_override'.\n" |
2359 | " (Note that use of the override may cause unknown side effects.)\n"; | 2359 | " (Note that use of the override may cause unknown side effects.)\n"; |
2360 | 2360 | ||
2361 | static bool ecc_enabled(struct pci_dev *F3, u8 nid) | 2361 | static bool ecc_enabled(struct pci_dev *F3, u16 nid) |
2362 | { | 2362 | { |
2363 | u32 value; | 2363 | u32 value; |
2364 | u8 ecc_en = 0; | 2364 | u8 ecc_en = 0; |
diff --git a/drivers/edac/amd64_edac.h b/drivers/edac/amd64_edac.h index cd7845fcc272..35637d83f235 100644 --- a/drivers/edac/amd64_edac.h +++ b/drivers/edac/amd64_edac.h | |||
@@ -334,7 +334,7 @@ struct amd64_pvt { | |||
334 | /* pci_device handles which we utilize */ | 334 | /* pci_device handles which we utilize */ |
335 | struct pci_dev *F1, *F2, *F3; | 335 | struct pci_dev *F1, *F2, *F3; |
336 | 336 | ||
337 | unsigned mc_node_id; /* MC index of this MC node */ | 337 | u16 mc_node_id; /* MC index of this MC node */ |
338 | int ext_model; /* extended model value of this node */ | 338 | int ext_model; /* extended model value of this node */ |
339 | int channel_count; | 339 | int channel_count; |
340 | 340 | ||
@@ -387,7 +387,7 @@ struct err_info { | |||
387 | u32 offset; | 387 | u32 offset; |
388 | }; | 388 | }; |
389 | 389 | ||
390 | static inline u64 get_dram_base(struct amd64_pvt *pvt, unsigned i) | 390 | static inline u64 get_dram_base(struct amd64_pvt *pvt, u8 i) |
391 | { | 391 | { |
392 | u64 addr = ((u64)pvt->ranges[i].base.lo & 0xffff0000) << 8; | 392 | u64 addr = ((u64)pvt->ranges[i].base.lo & 0xffff0000) << 8; |
393 | 393 | ||
@@ -397,7 +397,7 @@ static inline u64 get_dram_base(struct amd64_pvt *pvt, unsigned i) | |||
397 | return (((u64)pvt->ranges[i].base.hi & 0x000000ff) << 40) | addr; | 397 | return (((u64)pvt->ranges[i].base.hi & 0x000000ff) << 40) | addr; |
398 | } | 398 | } |
399 | 399 | ||
400 | static inline u64 get_dram_limit(struct amd64_pvt *pvt, unsigned i) | 400 | static inline u64 get_dram_limit(struct amd64_pvt *pvt, u8 i) |
401 | { | 401 | { |
402 | u64 lim = (((u64)pvt->ranges[i].lim.lo & 0xffff0000) << 8) | 0x00ffffff; | 402 | u64 lim = (((u64)pvt->ranges[i].lim.lo & 0xffff0000) << 8) | 0x00ffffff; |
403 | 403 | ||