[coreboot] [PATCH] nb/intel/nehalem/raminit.c: Add timeouts when waiting for heci.
Timothy Pearson
tpearson at raptorengineering.com
Mon Mar 27 22:19:17 CEST 2017
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 03/27/2017 03:05 PM, Denis 'GNUtoo' Carikli wrote:
> Since until now, the code running on the management engine is:
> - Signed by its manufacturer
> - Proprietary software, without corresponding source code
> It can desirable to run the least ammount possible of such
> code, which is what me_cleaner[1] enables.
>
> It does it by removing partitions of the management engine
> firmwares, however when doing so, the HECI interface might
> not be present anymore.
>
> So it is desirable not to have the RAM initialisation code
> wait forever for the HECI interface to appear.
>
> [1] https://github.com/corna/me_cleaner/
>
> Change-Id: Iebafa353ecd8875395d6c3a986da6082772e2e18
> Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo at no-log.org>
> ---
> src/northbridge/intel/nehalem/raminit.c | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/src/northbridge/intel/nehalem/raminit.c b/src/northbridge/intel/nehalem/raminit.c
> index 122b8ac7cf..27065d139e 100644
> --- a/src/northbridge/intel/nehalem/raminit.c
> +++ b/src/northbridge/intel/nehalem/raminit.c
> @@ -1753,23 +1753,27 @@ static const struct ram_training *get_cached_training(void)
> }
> #endif
>
> -/* FIXME: add timeout. */
> static void wait_heci_ready(void)
> {
> - while (!(read32(DEFAULT_HECIBAR + 0xc) & 8)); // = 0x8000000c
> + int i = 1000*1000;
> +
> + while (i-- && !(read32(DEFAULT_HECIBAR + 0xc) & 8)) /* = 0x8000000c */
> + udelay(1);
> write32((DEFAULT_HECIBAR + 0x4),
> (read32(DEFAULT_HECIBAR + 0x4) & ~0x10) | 0xc);
> }
>
> -/* FIXME: add timeout. */
> static void wait_heci_cb_avail(int len)
> {
> + int i = 1000*1000;
> +
> union {
> struct mei_csr csr;
> u32 raw;
> } csr;
>
> - while (!(read32(DEFAULT_HECIBAR + 0xc) & 8));
> + while (i-- && !(read32(DEFAULT_HECIBAR + 0xc) & 8))
> + udelay(1);
>
> do
> csr.raw = read32(DEFAULT_HECIBAR + 0x4);
In general static timeouts are not a good idea. Is there a reliable way
for coreboot to determine if the ME image has been "cleaned" (i.e. can
it parse the ME descriptor and not even search for the HECI interface if
the ME size is less than a certain value?)
- --
Timothy Pearson
Raptor Engineering
+1 (415) 727-8645 (direct line)
+1 (512) 690-0200 (switchboard)
https://www.raptorengineering.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iQEcBAEBAgAGBQJY2XPDAAoJEK+E3vEXDOFbb0sIAJHmOXqjZ1hHWkyzV76DEf/k
oUwb0aabKt+hNN8IeB0N0Au/t145hu5nJdUyp8jVcqjtJzyB3A2exxpuo3nS8h6G
yHU/ztizxgUz5oW9VR1z9Zp5n6UpUxtaEz+4IlO/TCef/1nMwkFM8k5f7o19vx2c
R2ug39Am69o6xaJiojvFlGnsSyKsWkhBZ5a4rx9PKgTltqU3F0NUdCIKsufcKeJo
Po8FTn/mF3zPpWC1pxX9pIOGauPHhtVZ8sazYMg6R7gdqb7PgL3fcVl/xUZFZkpp
OQVKAlpv7h6A0lzrWssfsBXjhnK9+HsND76ZxaQ3wCBnTzTeUq4iYWVl7E7SCrs=
=+EBy
-----END PGP SIGNATURE-----
More information about the coreboot
mailing list