[SLOF] [PATCH v2 04/20] Add initial support for logging

Thomas Huth thuth at redhat.com
Thu Nov 19 20:39:01 AEDT 2015


On 17/11/15 18:02, Stefan Berger wrote:
> From: Stefan Berger <stefanb at linux.vnet.ibm.com>
> 
> This patch adds initial support for the logging that will be done
> following measurements done by further code added to SLOF.
> 
> Signed-off-by: Stefan Berger <stefanb at linux.vnet.ibm.com>
> Reviewed-by: Nikunj A Dadhania <nikunj at linux.vnet.ibm.com>
> ---
[...]
> diff --git a/lib/libtpm/tcgbios.c b/lib/libtpm/tcgbios.c
> index 0dae810..7e2ae1e 100644
> --- a/lib/libtpm/tcgbios.c
> +++ b/lib/libtpm/tcgbios.c
> @@ -80,6 +80,9 @@ static struct tpm_state tpm_state = {
>  
>  extern struct tpm_driver tpm_drivers[];
>  
> +static void *log_base;
> +static uint32_t log_area_size;
> +
>  /* prototypes */
>  static uint32_t build_and_send_cmd(uint32_t ordinal, const uint8_t *append,
>  				   uint32_t append_size, uint8_t *resbuffer,
> @@ -90,6 +93,33 @@ static uint32_t build_and_send_cmd(uint32_t ordinal, const uint8_t *append,
>    Extensions for TCG-enabled BIOS
>   *******************************************************/
>  
> +void tpm_set_log_parameters(void *addr, unsigned int size)
> +{
> +	dprintf("Log is at 0x%llx; size is %u bytes\n",
> +		(uint64_t)addr, size);
> +	log_base = addr;
> +	log_area_size = size;
> +}
> +
> +static uint8_t *get_log_base_ptr(void)
> +{
> +	return log_base;
> +}
> +
> +static uint32_t get_log_area_size(void)
> +{
> +	return log_area_size;
> +}

Static functions that just return the value of static variables? ...
well, IMHO it's then nicer to use the static variables directly instead.

> +/* clear the OpenFirmware device tree log */
> +static void reset_ofdt_log(void)
> +{
> +	uint8_t *log_area_start_address = get_log_base_ptr();
> +
> +	if (log_area_start_address)
> +		memset(log_area_start_address, 0, get_log_area_size());
> +}
> +
[...]

 Thomas



More information about the SLOF mailing list