diff options
author | Timothy Pearson <tpearson@raptorengineeringinc.com> | 2015-02-16 14:57:06 -0600 |
---|---|---|
committer | Marc Jones <marc.jones@se-eng.com> | 2015-03-13 21:17:58 +0100 |
commit | 586d6e2a8800f29cdfb6111a91d6e8fc8f4fc43c (patch) | |
tree | 6411cb4093f6a7bb1fb2207b25350e37114b8374 /src/northbridge/amd/amdht/h3finit.c | |
parent | 668828d3b3ffbe2891d6176379d990e99ae29be7 (diff) |
northbridge/amd/amdht: Allow mainboards to set HT frequency limit
This is useful when the PCB layout of a mainboard does not allow
stable operation at the increased HyperTransport speeds of newer
processors.
Change-Id: Idc93a1294608178ddf38ca72d40e6bad7deb9004
Signed-off-by: Timothy Pearson <tpearson@raptorengineeringinc.com>
Reviewed-on: http://review.coreboot.org/8464
Tested-by: build bot (Jenkins)
Reviewed-by: Marc Jones <marc.jones@se-eng.com>
Diffstat (limited to 'src/northbridge/amd/amdht/h3finit.c')
-rw-r--r-- | src/northbridge/amd/amdht/h3finit.c | 40 |
1 files changed, 37 insertions, 3 deletions
diff --git a/src/northbridge/amd/amdht/h3finit.c b/src/northbridge/amd/amdht/h3finit.c index 4059182c54..47bf80972f 100644 --- a/src/northbridge/amd/amdht/h3finit.c +++ b/src/northbridge/amd/amdht/h3finit.c @@ -75,6 +75,41 @@ static const uint16_t ht_speed_limit[16] = 0x00FF, 0x007F, 0x003F, 0x001F, 0x000F, 0x0007, 0x0003, 0x0001}; +static const struct ht_speed_limit_map_t { + uint16_t mhz; + uint8_t config; +} ht_speed_limit_map[] = { + {0, NVRAM_LIMIT_HT_SPEED_AUTO}, + {200, NVRAM_LIMIT_HT_SPEED_200}, + {300, NVRAM_LIMIT_HT_SPEED_300}, + {400, NVRAM_LIMIT_HT_SPEED_400}, + {500, NVRAM_LIMIT_HT_SPEED_500}, + {600, NVRAM_LIMIT_HT_SPEED_600}, + {800, NVRAM_LIMIT_HT_SPEED_800}, + {1000, NVRAM_LIMIT_HT_SPEED_1000}, + {1200, NVRAM_LIMIT_HT_SPEED_1200}, + {1400, NVRAM_LIMIT_HT_SPEED_1400}, + {1600, NVRAM_LIMIT_HT_SPEED_1600}, + {1800, NVRAM_LIMIT_HT_SPEED_1800}, + {2000, NVRAM_LIMIT_HT_SPEED_2000}, + {2200, NVRAM_LIMIT_HT_SPEED_2200}, + {2400, NVRAM_LIMIT_HT_SPEED_2400}, + {2600, NVRAM_LIMIT_HT_SPEED_2600}, +}; + +static const uint16_t ht_speed_mhz_to_hw(uint16_t mhz) +{ + size_t i; + for (i = 0; i < ARRAY_SIZE(ht_speed_limit_map); i++) + if (ht_speed_limit_map[i].mhz == mhz) + return ht_speed_limit_map[i].config; + + printk(BIOS_WARNING, + "WARNING: Invalid HT link limit frequency %d specified, ignoring...\n", + mhz); + return ht_speed_limit[NVRAM_LIMIT_HT_SPEED_AUTO]; +} + /*---------------------------------------------------------------------------- * TYPEDEFS AND STRUCTURES * @@ -1359,10 +1394,9 @@ static void selectOptimalWidthAndFrequency(sMainData *pDat) for (i = 0; i < pDat->TotalLinks*2; i += 2) { - /* FIXME - * Mainboards need to be able to set cbPCBFreqLimit - */ cbPCBFreqLimit = 0xFFFF; // Maximum allowed by autoconfiguration + if (pDat->HtBlock->ht_link_configuration) + cbPCBFreqLimit = ht_speed_mhz_to_hw(pDat->HtBlock->ht_link_configuration->ht_speed_limit); cbPCBFreqLimit = min(cbPCBFreqLimit, cbPCBFreqLimit_NVRAM); #if CONFIG_EXPERT && CONFIG_LIMIT_HT_DOWN_WIDTH_8 |