diff mbox

[36/67] drm/i915: Add MMIO helper for 6 ports with different offsets.

Message ID 1491506163-14587-36-git-send-email-rodrigo.vivi@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Rodrigo Vivi April 6, 2017, 7:15 p.m. UTC
Also new registers can have different mmio offsets
per different lane per port.

v2: Use _PICK as PORT3 instead of creating a new
    macro with if per port.

Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
---
 drivers/gpu/drm/i915/i915_reg.h | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Navare, Manasi May 17, 2017, 7:20 p.m. UTC | #1
On Thu, Apr 06, 2017 at 12:15:32PM -0700, Rodrigo Vivi wrote:
> Also new registers can have different mmio offsets
> per different lane per port.
> 
> v2: Use _PICK as PORT3 instead of creating a new
>     macro with if per port.
> 
> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_reg.h | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> index c38c1fd..5777925 100644
> --- a/drivers/gpu/drm/i915/i915_reg.h
> +++ b/drivers/gpu/drm/i915/i915_reg.h
> @@ -64,6 +64,10 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
>  #define _MMIO_PIPE3(pipe, a, b, c) _MMIO(_PIPE3(pipe, a, b, c))
>  #define _PORT3(port, ...) _PICK(port, __VA_ARGS__)
>  #define _MMIO_PORT3(pipe, a, b, c) _MMIO(_PORT3(pipe, a, b, c))
> +#define _PORT6(port, ...) _PICK(port, __VA_ARGS__)

Why do we need to define _PORT6() as a separate macro when all it has to do
is _PICK between given ports so we can jsut use _PORT3 and it will pick amongst the
_VA_ARGS_.

Jani/Ville am I correct?

Manasi
> +#define _MMIO_PORT6(port, a, b, c, d, e, f) _MMIO(_PORT6(port, a, b, c, d, e, f))
> +#define _MMIO_PORT6_LN(port, ln, a0, a1, b, c, d, e, f)			\
> +	_MMIO(_PORT6(port, a0, b, c, d, e, f) + (ln * (a1 - a0)))
>  #define _PHY3(phy, ...) _PICK(phy, __VA_ARGS__)
>  #define _MMIO_PHY3(phy, a, b, c) _MMIO(_PHY3(phy, a, b, c))
>  
> -- 
> 1.9.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Rodrigo Vivi May 23, 2017, 7:16 p.m. UTC | #2
On Wed, May 17, 2017 at 12:20 PM, Manasi Navare
<manasi.d.navare@intel.com> wrote:
> On Thu, Apr 06, 2017 at 12:15:32PM -0700, Rodrigo Vivi wrote:
>> Also new registers can have different mmio offsets
>> per different lane per port.
>>
>> v2: Use _PICK as PORT3 instead of creating a new
>>     macro with if per port.
>>
>> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
>> ---
>>  drivers/gpu/drm/i915/i915_reg.h | 4 ++++
>>  1 file changed, 4 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
>> index c38c1fd..5777925 100644
>> --- a/drivers/gpu/drm/i915/i915_reg.h
>> +++ b/drivers/gpu/drm/i915/i915_reg.h
>> @@ -64,6 +64,10 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
>>  #define _MMIO_PIPE3(pipe, a, b, c) _MMIO(_PIPE3(pipe, a, b, c))
>>  #define _PORT3(port, ...) _PICK(port, __VA_ARGS__)
>>  #define _MMIO_PORT3(pipe, a, b, c) _MMIO(_PORT3(pipe, a, b, c))
>> +#define _PORT6(port, ...) _PICK(port, __VA_ARGS__)
>
> Why do we need to define _PORT6() as a separate macro when all it has to do
> is _PICK between given ports so we can jsut use _PORT3 and it will pick amongst the
> _VA_ARGS_.

It was just my OCD refusing to use "3" for "6"...
Any idea for a better generic name for the PORT3?

>
> Jani/Ville am I correct?
>
> Manasi
>> +#define _MMIO_PORT6(port, a, b, c, d, e, f) _MMIO(_PORT6(port, a, b, c, d, e, f))
>> +#define _MMIO_PORT6_LN(port, ln, a0, a1, b, c, d, e, f)                      \
>> +     _MMIO(_PORT6(port, a0, b, c, d, e, f) + (ln * (a1 - a0)))
>>  #define _PHY3(phy, ...) _PICK(phy, __VA_ARGS__)
>>  #define _MMIO_PHY3(phy, a, b, c) _MMIO(_PHY3(phy, a, b, c))
>>
>> --
>> 1.9.1
>>
>> _______________________________________________
>> Intel-gfx mailing list
>> Intel-gfx@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Navare, Manasi June 5, 2017, 6:45 p.m. UTC | #3
Rodrigo,

Any thoughts on the ocmment here regarding defining a new macro _PORT6?
I am facing a similar issue with ICL - whether to define a new macro or use
the existing one _PORT3?

Manasi

On Wed, May 17, 2017 at 12:20:34PM -0700, Manasi Navare wrote:
> On Thu, Apr 06, 2017 at 12:15:32PM -0700, Rodrigo Vivi wrote:
> > Also new registers can have different mmio offsets
> > per different lane per port.
> > 
> > v2: Use _PICK as PORT3 instead of creating a new
> >     macro with if per port.
> > 
> > Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > ---
> >  drivers/gpu/drm/i915/i915_reg.h | 4 ++++
> >  1 file changed, 4 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> > index c38c1fd..5777925 100644
> > --- a/drivers/gpu/drm/i915/i915_reg.h
> > +++ b/drivers/gpu/drm/i915/i915_reg.h
> > @@ -64,6 +64,10 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
> >  #define _MMIO_PIPE3(pipe, a, b, c) _MMIO(_PIPE3(pipe, a, b, c))
> >  #define _PORT3(port, ...) _PICK(port, __VA_ARGS__)
> >  #define _MMIO_PORT3(pipe, a, b, c) _MMIO(_PORT3(pipe, a, b, c))
> > +#define _PORT6(port, ...) _PICK(port, __VA_ARGS__)
> 
> Why do we need to define _PORT6() as a separate macro when all it has to do
> is _PICK between given ports so we can jsut use _PORT3 and it will pick amongst the
> _VA_ARGS_.
> 
> Jani/Ville am I correct?
> 
> Manasi
> > +#define _MMIO_PORT6(port, a, b, c, d, e, f) _MMIO(_PORT6(port, a, b, c, d, e, f))
> > +#define _MMIO_PORT6_LN(port, ln, a0, a1, b, c, d, e, f)			\
> > +	_MMIO(_PORT6(port, a0, b, c, d, e, f) + (ln * (a1 - a0)))
> >  #define _PHY3(phy, ...) _PICK(phy, __VA_ARGS__)
> >  #define _MMIO_PHY3(phy, a, b, c) _MMIO(_PHY3(phy, a, b, c))
> >  
> > -- 
> > 1.9.1
> > 
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index c38c1fd..5777925 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -64,6 +64,10 @@  static inline bool i915_mmio_reg_valid(i915_reg_t reg)
 #define _MMIO_PIPE3(pipe, a, b, c) _MMIO(_PIPE3(pipe, a, b, c))
 #define _PORT3(port, ...) _PICK(port, __VA_ARGS__)
 #define _MMIO_PORT3(pipe, a, b, c) _MMIO(_PORT3(pipe, a, b, c))
+#define _PORT6(port, ...) _PICK(port, __VA_ARGS__)
+#define _MMIO_PORT6(port, a, b, c, d, e, f) _MMIO(_PORT6(port, a, b, c, d, e, f))
+#define _MMIO_PORT6_LN(port, ln, a0, a1, b, c, d, e, f)			\
+	_MMIO(_PORT6(port, a0, b, c, d, e, f) + (ln * (a1 - a0)))
 #define _PHY3(phy, ...) _PICK(phy, __VA_ARGS__)
 #define _MMIO_PHY3(phy, a, b, c) _MMIO(_PHY3(phy, a, b, c))