[Intel-gfx] [PATCH i-g-t 01/10] lib: add 16 and 8 bit versions of INREG and OUTREG

Daniel Vetter daniel at ffwll.ch
Mon May 4 08:12:19 PDT 2015


On Tue, Apr 28, 2015 at 03:04:26PM +0300, Jani Nikula wrote:
> Signed-off-by: Jani Nikula <jani.nikula at intel.com>
> ---
>  lib/intel_io.h   |  4 ++++
>  lib/intel_mmio.c | 24 ++++++++++++++++++++++++
>  2 files changed, 28 insertions(+)
> 
> diff --git a/lib/intel_io.h b/lib/intel_io.h
> index 04aa3fd496b4..1c3b4445cd5b 100644
> --- a/lib/intel_io.h
> +++ b/lib/intel_io.h
> @@ -43,7 +43,11 @@ void intel_register_write(uint32_t reg, uint32_t val);
>  int intel_register_access_needs_fakewake(void);
>  
>  uint32_t INREG(uint32_t reg);
> +uint16_t INREG16(uint32_t reg);
> +uint8_t INREG8(uint32_t reg);
>  void OUTREG(uint32_t reg, uint32_t val);
> +void OUTREG16(uint32_t reg, uint16_t val);
> +void OUTREG8(uint32_t reg, uint8_t val);
>  
>  /* sideband access functions from intel_iosf.c */
>  uint32_t intel_dpio_reg_read(uint32_t reg, int phy);
> diff --git a/lib/intel_mmio.c b/lib/intel_mmio.c
> index 9a2ee27bd5e5..40ce94c8f600 100644
> --- a/lib/intel_mmio.c
> +++ b/lib/intel_mmio.c
> @@ -324,6 +324,18 @@ uint32_t INREG(uint32_t reg)
>  	return *(volatile uint32_t *)((volatile char *)mmio + reg);
>  }
>  
> +/* 16-bit version of INREG */

gtkdoc is missing here for these new functions. And while at it please
also do the s/OUTRET/OUTREG/ type ;-)

Otherise entire series looks really nifty and has my Ack.

Cheers, Daniel

> +uint16_t INREG16(uint32_t reg)
> +{
> +	return *(volatile uint16_t *)((volatile char *)mmio + reg);
> +}
> +
> +/* 8-bit version of INREG */
> +uint8_t INREG8(uint32_t reg)
> +{
> +	return *((volatile uint8_t *)mmio + reg);
> +}
> +
>  /**
>   * OUTRET:
>   * @reg: register offset
> @@ -338,3 +350,15 @@ void OUTREG(uint32_t reg, uint32_t val)
>  {
>  	*(volatile uint32_t *)((volatile char *)mmio + reg) = val;
>  }
> +
> +/* 16-bit version of OUTREG */
> +void OUTREG16(uint32_t reg, uint16_t val)
> +{
> +	*(volatile uint16_t *)((volatile char *)mmio + reg) = val;
> +}
> +
> +/* 8-bit version of OUTREG */
> +void OUTREG8(uint32_t reg, uint8_t val)
> +{
> +	*((volatile uint8_t *)mmio + reg) = val;
> +}
> -- 
> 2.1.4
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the Intel-gfx mailing list