New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ecc injection enable #207

Merged
merged 3 commits into from Oct 4, 2018
File filter...
Filter file types
Jump to file or symbol
Failed to load files and symbols.
+40 −0
Diff settings

Always

Just for now

@@ -250,6 +250,46 @@ static void mainboard_enable(struct device *dev)

static void mainboard_final(void *chip_info)
{
/* ECC was not working because all memory was marked
* as excluded from ECC checking and error reporting.
* Normally one contiguous range is excluded to cover
* framebuffer region in systems with internal GPUs.
* AGESA set bit 0, EccExclEn, in register D18F5x240 as 1.
* Range was incorrectly enabled to cover all memory
* for cases without UMA (no integrated graphics).
*
* In order to clear EccExclEn DRAM scrubber needs to be
* disabled temporarily by setting D18F3x88[DisDramScrub]
*/
u32 val;
device_t D18F3 = dev_find_device(0x1022, 0x1583, NULL);
device_t D18F5 = dev_find_device(0x1022, 0x1585, NULL);
This conversation was marked as resolved by pietrushnic

This comment has been minimized.

@pietrushnic

pietrushnic Oct 1, 2018

Member

@krystian-hebel IMO variables names are not very descriptive. Do we really don't know what this device is?

This comment has been minimized.

@krystian-hebel

krystian-hebel Oct 2, 2018

Host bridge: Advanced Micro Devices, Inc. [AMD] Device 1583, which isn't any more descriptive in my opinion.

This comment has been minimized.

@miczyg1

miczyg1 Oct 4, 2018

@pietrushnic I also have not found a name which could satisfy You. Looked in BKDG and other sources, but found only that these are all memory controller/northbridge devices

This comment has been minimized.

@pietrushnic

pietrushnic Oct 4, 2018

Member

@miczyg1 @krystian-hebel it looks fine to me, let's send that upstream and see what will happen.


/* Disable DRAM ECC scrubbing */
val = pci_read_config32(D18F3, 0x88);
val |= (1 << 27);
pci_write_config32(D18F3, 0x88, val);

/* Clear reserved bits in register D18F3xB8
*
* D18F3xB8 NB Array Address has reserved bits [27:10]
* Multiple experiments showed that ECC injection
* doesn't work when these bits are set.
*/
val = pci_read_config32(D18F3, 0xB8);
val &= 0xF000003F;
pci_write_config32(D18F3, 0xB8, val);

/* Disable ECC exclusion range */
val = pci_read_config32(D18F5, 0x240);
val &= ~1;
pci_write_config32(D18F5, 0x240, val);

/* Re-enable DRAM ECC scrubbing */
val = pci_read_config32(D18F3, 0x88);
val &= ~(1 << 27);
pci_write_config32(D18F3, 0x88, val);

//
// Turn off LED 2 and LED 3
//
ProTip! Use n and p to navigate between commits in a pull request.