[igt-dev] [PATCH i-g-t v8 2/3] lib/intel_mmio: add funtions for read/write register funtions
Chris Wilson
chris at chris-wilson.co.uk
Tue Aug 27 13:31:34 UTC 2019
Quoting Daniel Mrzyglod (2019-08-27 14:21:09)
> This patch is first move to extend functionality of intel_mmio library.
> There was limitation for 1 device, adding pointer for IO functions to
> mmaped area gives us possibility to use those IO functions for other mmaped
> devices.
>
> v8: remove unnecessary castings
> diff --git a/lib/intel_mmio.c b/lib/intel_mmio.c
> index a5458aeb..c257f7a0 100644
> --- a/lib/intel_mmio.c
> +++ b/lib/intel_mmio.c
> @@ -405,3 +405,110 @@ void OUTREG8(uint32_t reg, uint8_t val)
> {
> *((volatile uint8_t *)igt_global_mmio + reg) = val;
*(volatile uint32_t *)(igt_mmio + reg) = val;
> }
> +
> +
> +/**
> + * INREG_DEV:
> + * @igt_mmio maped memory pointer
> + * @reg: register offset
> + *
> + * 32-bit read of the register at offset @reg. This function only works when the
> + * new register access helper is initialized with intel_register_access_init().
> + *
> + * This function directly accesses the igt_mmio without safety checks.
> + *
> + * Returns:
> + * The value read from the register.
> + */
> +uint32_t INREG_DEV(void *igt_mmio, uint32_t reg)
> +{
> + return *((volatile char *)igt_mmio + reg);
return *(volatile uint32_t *)(igt_mmio + reg);
etc
-Chris
More information about the igt-dev
mailing list