diff options
author | Angel Pons <th3fanbus@gmail.com> | 2020-05-02 21:48:46 +0200 |
---|---|---|
committer | Angel Pons <th3fanbus@gmail.com> | 2020-05-21 18:28:18 +0000 |
commit | d5b780c5b1a7f6d7f12d3305dcfd36413a429c39 (patch) | |
tree | 493ae1af39b6c7b891a247aa6151417555a417b0 /src/northbridge/intel/sandybridge/raminit_common.c | |
parent | 2be59000874eef6829e279ac4f5ec02f35eadf4a (diff) | |
download | coreboot-d5b780c5b1a7f6d7f12d3305dcfd36413a429c39.tar.xz |
nb/intel/sandybridge: Redefine IOSAV_SUBSEQUENCE
Instead of directly writing values to the IOSAV registers, use a struct
and some helper functions to provide a cleaner interface for the IOSAV.
Having IOSAV_SUBSEQUENCE refer to a static function is weird, but we
will remove this macro in a follow-up that does not change the binary.
Tested on Asus P8Z77-V LX2, still boots.
Change-Id: I73f13c18a739c5586a7415966f9017c2335fdfd1
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/40980
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Diffstat (limited to 'src/northbridge/intel/sandybridge/raminit_common.c')
-rw-r--r-- | src/northbridge/intel/sandybridge/raminit_common.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/northbridge/intel/sandybridge/raminit_common.c b/src/northbridge/intel/sandybridge/raminit_common.c index d66a0f0ed3..c4bf5ff50e 100644 --- a/src/northbridge/intel/sandybridge/raminit_common.c +++ b/src/northbridge/intel/sandybridge/raminit_common.c @@ -17,10 +17,25 @@ /* FIXME: no support for 3-channel chipsets */ +/* Number of programmed IOSAV subsequences. */ +static unsigned int ssq_count = 0; + +static void iosav_write_ssq(const int ch, const int n, const struct iosav_ssq *ssq) +{ + MCHBAR32(IOSAV_n_SP_CMD_CTRL_ch(ch, ssq_count)) = ssq->sp_cmd_ctrl.raw; + MCHBAR32(IOSAV_n_SUBSEQ_CTRL_ch(ch, ssq_count)) = ssq->subseq_ctrl.raw; + MCHBAR32(IOSAV_n_SP_CMD_ADDR_ch(ch, ssq_count)) = ssq->sp_cmd_addr.raw; + MCHBAR32(IOSAV_n_ADDR_UPDATE_ch(ch, ssq_count)) = ssq->addr_update.raw; + + ssq_count++; +} + /* length: [1..4] */ static void iosav_run_queue(const int ch, const u8 loops, const u8 length, const u8 as_timer) { - MCHBAR32(IOSAV_SEQ_CTL_ch(ch)) = loops | ((length - 1) << 18) | (as_timer << 22); + MCHBAR32(IOSAV_SEQ_CTL_ch(ch)) = loops | ((ssq_count - 1) << 18) | (as_timer << 22); + + ssq_count = 0; } static void iosav_run_once(const int ch, const u8 length) |