[Skiboot] [PATCH V4 01/21] hw: Move lpc firmware space helpers
Nicholas Piggin
npiggin at gmail.com
Thu Apr 21 13:32:15 AEST 2022
Excerpts from Christophe Lombard's message of April 14, 2022 11:43 pm:
> Add new lpc helpers for doing a bulk io to firmware space.
>
> Signed-off-by: Christophe Lombard <clombard at linux.vnet.ibm.com>
> ---
> hw/lpc.c | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++
> include/lpc.h | 6 +++++
> 2 files changed, 80 insertions(+)
>
> diff --git a/hw/lpc.c b/hw/lpc.c
> index bf3ab1fa..caaacc46 100644
> --- a/hw/lpc.c
> +++ b/hw/lpc.c
> @@ -667,6 +667,80 @@ int64_t lpc_probe_read(enum OpalLPCAddressType addr_type, uint32_t addr,
> return __lpc_read_sanity(addr_type, addr, data, sz, true);
> }
>
> +int64_t lpc_fw_read(uint32_t off, void *buf, uint32_t len)
> +{
> + int rc;
> +
> + prlog(PR_TRACE, "Reading 0x%08x bytes at FW offset 0x%08x\n",
> + len, off);
> +
> + while (len) {
> + uint32_t chunk;
> + uint32_t dat;
> +
> + /* XXX: make this read until it's aligned */
> + if (len > 3 && !(off & 3)) {
> + rc = lpc_read(OPAL_LPC_FW, off, &dat, 4);
Looks fine but can these functions consolidate the 3 pairs of functions
that seem to do the same thing already in the tree?
Thanks,
Nick
More information about the Skiboot
mailing list