summaryrefslogtreecommitdiff
path: root/src/soc/amd/stoneyridge/mca.c
blob: 240e75db319729126bf2292c234b2534c030c684 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* SPDX-License-Identifier: GPL-2.0-only */

#include <amdblocks/mca.h>
#include <types.h>

static const char *const mca_bank_name[] = {
	[0] = "Load-store unit",
	[1] = "Instruction fetch unit",
	[2] = "Combined unit",
	/* Bank 3 is reserved and not all corresponding MSRs are implemented in Family 15h.
	   Accessing non-existing MSRs causes a general protection fault. */
	[3] = NULL,
	[4] = "Northbridge",
	[5] = "Execution unit",
	[6] = "Floating point unit"
};

bool mca_is_valid_bank(unsigned int bank)
{
	return (bank < ARRAY_SIZE(mca_bank_name) && mca_bank_name[bank] != NULL);
}

const char *mca_get_bank_name(unsigned int bank)
{
	if (mca_is_valid_bank(bank))
		return mca_bank_name[bank];
	else
		return "";
}