Re: [PATCH 1/2] parisc/firmware: add functions to retrieve TOC data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> --- a/arch/parisc/include/uapi/asm/pdc.h
> +++ b/arch/parisc/include/uapi/asm/pdc.h
> @@ -689,6 +689,28 @@ struct pdc_hpmc_pim_20 { /* PDC_PIM */
>  	unsigned long long fr[32];
>  };
> 
> +struct pdc_toc_pim_11 {
> +	unsigned int gr[32];
> +	unsigned int cr[32];
> +	unsigned int sr[8];
> +	unsigned int iasq_back;
> +	unsigned int iaoq_back;
> +	unsigned int check_type;
> +	unsigned int hversion;
> +	unsigned int cpu_state;
> +};
> +
> +struct pdc_toc_pim_20 {
> +	unsigned long long gr[32];
> +	unsigned long long cr[32];
> +	unsigned long long sr[8];
> +	unsigned long long iasq_back;
> +	unsigned long long iaoq_back;
> +	unsigned int check_type;
> +	unsigned int hversion;
> +	unsigned int cpu_state;
> +};
> +
>  #endif /* !defined(__ASSEMBLY__) */

Since these are defined by the hardware and have a well defined size I suggest 
using u32 and u64 to cover this.

> diff --git a/arch/parisc/kernel/firmware.c b/arch/parisc/kernel/firmware.c
> index 7034227dbdf3..9179b4409b63 100644
> --- a/arch/parisc/kernel/firmware.c
> +++ b/arch/parisc/kernel/firmware.c
> @@ -1061,6 +1061,38 @@ int pdc_mem_pdt_read_entries(struct pdc_mem_read_pdt
> *pret, return retval;
>  }
> 
> +/**
> + * pdc_pim_toc11 - Fetch TOC PIM 1.1 data from firmware.
> + * @ret: pointer to return buffer
> + */
> +int pdc_pim_toc11(struct pdc_toc_pim_11 *ret)
> +{
> +	int retval;
> +	unsigned long flags;
> +
> +	spin_lock_irqsave(&pdc_lock, flags);
> +	retval = mem_pdc_call(PDC_PIM, PDC_PIM_TOC, __pa(pdc_result),
> +			      __pa(ret), sizeof(struct 
pdc_toc_pim_11));
sizeof(*ret)

> +	spin_unlock_irqrestore(&pdc_lock, flags);
> +	return retval;
> +}
> +
> +/**
> + * pdc_pim_toc20 - Fetch TOC PIM 2.0 data from firmware.
> + * @ret: pointer to return buffer
> + */
> +int pdc_pim_toc20(struct pdc_toc_pim_20 *ret)
> +{
> +	int retval;
> +	unsigned long flags;
> +
> +	spin_lock_irqsave(&pdc_lock, flags);
> +	retval = mem_pdc_call(PDC_PIM, PDC_PIM_TOC, __pa(pdc_result),
> +			      __pa(ret), sizeof(struct 
pdc_toc_pim_20));
sizeof(*ret)

> +	spin_unlock_irqrestore(&pdc_lock, flags);
> +	return retval;
> +}
> +
>  /**
>   * pdc_tod_set - Set the Time-Of-Day clock.
>   * @sec: The number of seconds since epoch.

Attachment: signature.asc
Description: This is a digitally signed message part.


[Index of Archives]     [Linux SoC]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux