coreboot/util/mec152x/utils.h
Patrick Rudolph e63620012c util: Add Microchip EC FW tool
The Microchip EC can share the SPI flash with the x86 host. Since
it boots first and does power sequencing, there's no problem with
concurrent access happening. Due to various vendor specific flash
layouts used on x86, the EC needs a pointer to it's own firmware.

The pointer resides at flash offset 0 and is read by MEC152x and
MEC1701 and MEC172x ECs, probably others as well.

The introduced tool generates the EC FW PTR at flash offset 0.

Allows to get rid of hand-crafted binary files (EC_SIG) being used
on AMD mainboards that hardcode the offset and must manually being
checked if those match the FMAP.

When there'll be additional firmware regions added it becomes
unconvienient to maintain those by hand.

Usage output:

Usage: ./util/mec152x/mec152xtool <rom-file> <command>
        -h|--help
        -f|--fmap_region_name

Command:
 GEN_ECFW_PTR - Writes the ECFW PTR

Based on https://chromium.googlesource.com/chromiumos/platform/ec/+/08f5a1e6fc2c9467230444ac9b582dcf4d9f0068/chip/mchp/util/pack_ec_mec172x.py

Change-Id: I3b74c9f65643ad4437de29d4aed307b1a2b33286
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/87428
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
2025-07-17 18:13:10 +00:00

20 lines
397 B
C

/* SPDX-License-Identifier: GPL-2.0-or-later */
#ifndef MEC152X__UTILS_H__
#define MEC152X__UTILS_H__
#include <stddef.h>
#include <stdbool.h>
#include <stdint.h>
struct mem_range {
uint8_t *start;
size_t length;
};
uint8_t crc8_itu(const uint8_t *data, int len);
struct mem_range map_file(const char path[], bool rw);
void unmap_file(struct mem_range store);
#endif // MEC152X__UTILS_H__