summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorDuncan Laurie <dlaurie@chromium.org>2013-11-08 23:00:24 -0800
committerKyösti Mälkki <kyosti.malkki@gmail.com>2014-05-06 17:19:57 +0200
commitfd461e396b482cd5d0cd81cb11c4973f4ebfa94c (patch)
treee1cb7bddc006c5b3dbbb79a1c48c1a3736cf6e57 /src/include
parent9e68fe68ff272619ead17d8497fc6050e28caac6 (diff)
downloadcoreboot-fd461e396b482cd5d0cd81cb11c4973f4ebfa94c.tar.xz
regscript: Add support for MSR type
This required changing value/mask types to uint64_t. Another option would be to use id field to select low or high 32 bits of the MSR and set them independently. BUG=chrome-os-partner:23505 BRANCH=none TEST=build and boot on rambi Change-Id: Ied9998058a8035bf3f003185236f3be3e0df7fc9 Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/176304 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Commit-Queue: Aaron Durbin <adurbin@chromium.org> Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: http://review.coreboot.org/4951 Tested-by: build bot (Jenkins) Reviewed-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Diffstat (limited to 'src/include')
-rw-r--r--src/include/reg_script.h26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/include/reg_script.h b/src/include/reg_script.h
index 18eda0c0d8..81a4648473 100644
--- a/src/include/reg_script.h
+++ b/src/include/reg_script.h
@@ -59,12 +59,14 @@ enum {
REG_SCRIPT_TYPE_MMIO,
REG_SCRIPT_TYPE_RES,
REG_SCRIPT_TYPE_IOSF,
+ REG_SCRIPT_TYPE_MSR,
};
enum {
REG_SCRIPT_SIZE_8,
REG_SCRIPT_SIZE_16,
REG_SCRIPT_SIZE_32,
+ REG_SCRIPT_SIZE_64,
};
struct reg_script {
@@ -72,8 +74,8 @@ struct reg_script {
uint32_t type;
uint32_t size;
uint32_t reg;
- uint32_t mask;
- uint32_t value;
+ uint64_t mask;
+ uint64_t value;
uint32_t timeout;
union {
uint32_t id;
@@ -290,6 +292,26 @@ struct reg_script {
REG_SCRIPT_IOSF(POLL, unit_, reg_, mask_, value_, timeout_)
/*
+ * CPU Model Specific Register
+ */
+
+#define REG_SCRIPT_MSR(cmd_, reg_, mask_, value_, timeout_) \
+ _REG_SCRIPT_ENCODE_RAW(REG_SCRIPT_COMMAND_##cmd_, \
+ REG_SCRIPT_TYPE_MSR, \
+ REG_SCRIPT_SIZE_64, \
+ reg_, mask_, value_, timeout_, 0)
+#define REG_MSR_READ(reg_) \
+ REG_SCRIPT_MSR(READ, reg_, 0, 0, 0)
+#define REG_MSR_WRITE(reg_, value_) \
+ REG_SCRIPT_MSR(WRITE, reg_, 0, value_, 0)
+#define REG_MSR_RMW(reg_, mask_, value_) \
+ REG_SCRIPT_MSR(RMW, reg_, mask_, value_, 0)
+#define REG_MSR_OR(reg_, value_) \
+ REG_MSR_RMW(reg_, -1ULL, value_)
+#define REG_MSR_POLL(reg_, mask_, value_, timeout_) \
+ REG_SCRIPT_MSR(POLL, reg_, mask_, value_, timeout_)
+
+/*
* Chain to another table.
*/
#define REG_SCRIPT_NEXT(next_) \